algolia-uploader 0.0.4 → 0.0.5

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.mjs CHANGED
@@ -1,29 +1,29 @@
1
1
  #!/usr/bin/env node
2
- import{defineCommand as gi,runMain as mi}from"citty";import Be from"fs";import de from"path";import bi from"tty";import Zn from"os";import Ei from"crypto";import _i from"node:crypto";import zn from"child_process";import{isEqual as wi}from"es-toolkit";import{algoliasearch as xi}from"algoliasearch";const Ai="algolia-uploader",Si="0.0.4",Ri="command-line util to upload Algolia source";function Bi(e){return Be.readdirSync(e).filter(n=>n.endsWith(".json")).map(n=>{const a=Be.readFileSync(de.join(e,n),"utf8");return JSON.parse(a)})}function Xn(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var n=e.default;if(typeof n=="function"){var a=function i(){return this instanceof i?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};a.prototype=n.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var h=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(a,i,h.get?h:{enumerable:!0,get:function(){return e[i]}})}),a}var Qn={};const Jn="1.38.4",er="@dotenvx/dotenvx",tr="a better dotenv\u2013from the creator of `dotenv`",nr="@motdotla",rr=["dotenv","env"],sr="https://github.com/dotenvx/dotenvx",or={type:"git",url:"git+https://github.com/dotenvx/dotenvx.git"},ir="BSD-3-Clause",cr=["src/**/*","CHANGELOG.md"],ar="src/lib/main.js",ur="src/lib/main.d.ts",lr={".":{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"},fr={dotenvx:"./src/cli/dotenvx.js","git-dotenvx":"./src/cli/dotenvx.js"},dr={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"},hr="https://dotenvx.com",pr={commander:"^11.1.0",dotenv:"^16.4.5",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"},yr={"@yao-pkg/pkg":"^5.14.2","capture-console":"^1.0.2",esbuild:"^0.24.0",proxyquire:"^2.1.3",sinon:"^14.0.1",standard:"^17.1.0","standard-version":"^9.5.0",tap:"^21.0.1"},vr={access:"public",provenance:!0},Oi={version:Jn,name:er,description:tr,author:nr,keywords:rr,homepage:sr,repository:or,license:ir,files:cr,main:ar,types:ur,exports:lr,bin:fr,scripts:dr,funding:hr,dependencies:pr,devDependencies:yr,publishConfig:vr},Ii={__proto__:null,author:nr,bin:fr,default:Oi,dependencies:pr,description:tr,devDependencies:yr,exports:lr,files:cr,funding:hr,homepage:sr,keywords:rr,license:ir,main:ar,name:er,publishConfig:vr,repository:or,scripts:dr,types:ur,version:Jn},Ci=Xn(Ii);var wt,gr;function Pi(){if(gr)return wt;gr=1;const{name:e,version:n,description:a}=Ci;return wt={name:e,version:n,description:a},wt}var xt,mr;function Ti(){if(mr)return xt;mr=1;const{WriteStream:e}=bi;return xt={getColorDepth:()=>{try{return e.prototype.getColorDepth()}catch{const i=process.env.TERM;return i&&(i.includes("256color")||i.includes("xterm"))?8:4}}},xt}var At,br;function Er(){if(br)return At;br=1;const e=Ti(),n=new Map([["blue",34],["gray",37],["green",32],["olive",33],["orangered",31],["plum",35],["red",31],["electricblue",36],["dodgerblue",36]]),a=new Map([["blue",21],["gray",244],["green",34],["olive",142],["orangered",202],["plum",182],["red",196],["electricblue",45],["dodgerblue",33]]);function i(r){const t=e.getColorDepth();if(!a.has(r))throw new Error(`Invalid color ${r}`);if(t>=8){const s=a.get(r);return d=>`\x1B[38;5;${s}m${d}\x1B[39m`}if(t>=4){const s=n.get(r);return d=>`\x1B[${s}m${d}\x1B[39m`}return s=>s}function h(r){return e.getColorDepth()>=4?`\x1B[1m${r}\x1B[22m`:r}return At={getColor:i,bold:h},At}var St,_r;function wr(){if(_r)return St;_r=1;const e=Pi(),{getColor:n,bold:a}=Er(),i={error:0,errorv:0,errornocolor:0,warn:1,success:2,successv:2,info:2,help:2,blank:2,verbose:4,debug:5,silly:6},h=v=>a(n("red")(v)),r=n("orangered"),t=n("green"),s=n("olive"),d=n("dodgerblue"),m=n("plum"),p=n("plum");let g=i.info;function l(v,_){if(i[v]===void 0)throw new Error(`MISSING_LOG_LEVEL: '${v}'. implement in logger.`);if(i[v]<=g){const R=S(v,_);console.log(R)}}function S(v,_){const R=typeof _=="object"?JSON.stringify(_):_;switch(v.toLowerCase()){case"error":return h(R);case"errorv":return h(`[dotenvx@${e.version}] ${R}`);case"errornocolor":return R;case"warn":return r(R);case"success":return t(R);case"successv":return s(`[dotenvx@${e.version}] ${R}`);case"info":return R;case"help":return d(R);case"verbose":return m(R);case"debug":return p(R);case"blank":return R}}const A={level:"info",error:v=>l("error",v),errorv:v=>l("errorv",v),errornocolor:v=>l("errornocolor",v),warn:v=>l("warn",v),success:v=>l("success",v),successv:v=>l("successv",v),info:v=>l("info",v),help:v=>l("help",v),verbose:v=>l("verbose",v),debug:v=>l("debug",v),blank:v=>l("blank",v),setLevel:v=>{i[v]!==void 0&&(g=i[v],A.level=v)}};function k(v){const _=v.debug?"debug":v.verbose?"verbose":v.quiet?"error":v.logLevel;_&&(A.setLevel(_),(!v.quiet||v.quiet&&_!=="error")&&A.debug(`Setting log level to ${_}`))}return St={logger:A,getColor:n,setLogLevel:k,levels:i},St}var Ke={},Qe={},Je={},qe={},me={},Oe={},xr;function Ar(){if(xr)return Oe;xr=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.normalizePath=Oe.convertSlashes=Oe.cleanPath=void 0;const e=de;function n(r){let t=(0,e.normalize)(r);return t.length>1&&t[t.length-1]===e.sep&&(t=t.substring(0,t.length-1)),t}Oe.cleanPath=n;const a=/[\\/]/g;function i(r,t){return r.replace(a,t)}Oe.convertSlashes=i;function h(r,t){const{resolvePaths:s,normalizePath:d,pathSeparator:m}=t,p=process.platform==="win32"&&r.includes("/")||r.startsWith(".");if(s&&(r=(0,e.resolve)(r)),(d||p)&&(r=n(r)),r===".")return"";const g=r[r.length-1]!==m;return i(g?r+m:r,m)}return Oe.normalizePath=h,Oe}var Ie={},Sr;function Ni(){if(Sr)return Ie;Sr=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.build=Ie.joinDirectoryPath=Ie.joinPathWithBasePath=void 0;const e=de,n=Ar();function a(s,d){return d+s}Ie.joinPathWithBasePath=a;function i(s,d){return function(m,p){return p.startsWith(s)?p.replace(s,"")+m:(0,n.convertSlashes)((0,e.relative)(s,p),d.pathSeparator)+d.pathSeparator+m}}function h(s){return s}function r(s,d,m){return d+s+m}Ie.joinDirectoryPath=r;function t(s,d){const{relativePaths:m,includeBasePath:p}=d;return m&&s?i(s,d):p?a:h}return Ie.build=t,Ie}var et={},Rr;function Li(){if(Rr)return et;Rr=1,Object.defineProperty(et,"__esModule",{value:!0}),et.build=void 0;function e(t){return function(s,d){d.push(s.substring(t.length)||".")}}function n(t){return function(s,d,m){const p=s.substring(t.length)||".";m.every(g=>g(p,!0))&&d.push(p)}}const a=(t,s)=>{s.push(t||".")},i=(t,s,d)=>{const m=t||".";d.every(p=>p(m,!0))&&s.push(m)},h=()=>{};function r(t,s){const{includeDirs:d,filters:m,relativePaths:p}=s;return d?p?m&&m.length?n(t):e(t):m&&m.length?i:a:h}return et.build=r,et}var tt={},Br;function $i(){if(Br)return tt;Br=1,Object.defineProperty(tt,"__esModule",{value:!0}),tt.build=void 0;const e=(t,s,d,m)=>{m.every(p=>p(t,!1))&&d.files++},n=(t,s,d,m)=>{m.every(p=>p(t,!1))&&s.push(t)},a=(t,s,d,m)=>{d.files++},i=(t,s)=>{s.push(t)},h=()=>{};function r(t){const{excludeFiles:s,filters:d,onlyCounts:m}=t;return s?h:d&&d.length?m?e:n:m?a:i}return tt.build=r,tt}var nt={},Or;function Di(){if(Or)return nt;Or=1,Object.defineProperty(nt,"__esModule",{value:!0}),nt.build=void 0;const e=i=>i,n=()=>[""].slice(0,0);function a(i){return i.group?n:e}return nt.build=a,nt}var rt={},Ir;function Ki(){if(Ir)return rt;Ir=1,Object.defineProperty(rt,"__esModule",{value:!0}),rt.build=void 0;const e=(i,h,r)=>{i.push({directory:h,files:r,dir:h})},n=()=>{};function a(i){return i.group?e:n}return rt.build=a,rt}var He={},Cr;function qi(){if(Cr)return He;Cr=1;var e=He&&He.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(He,"__esModule",{value:!0}),He.build=void 0;const n=e(Be),a=de,i=function(d,m,p){const{queue:g,options:{suppressErrors:l}}=m;g.enqueue(),n.default.realpath(d,(S,A)=>{if(S)return g.dequeue(l?null:S,m);n.default.stat(A,(k,v)=>{if(k)return g.dequeue(l?null:k,m);if(v.isDirectory()&&t(d,A,m))return g.dequeue(null,m);p(v,A),g.dequeue(null,m)})})},h=function(d,m,p){const{queue:g,options:{suppressErrors:l}}=m;g.enqueue();try{const S=n.default.realpathSync(d),A=n.default.statSync(S);if(A.isDirectory()&&t(d,S,m))return;p(A,S)}catch(S){if(!l)throw S}};function r(d,m){return!d.resolveSymlinks||d.excludeSymlinks?null:m?h:i}He.build=r;function t(d,m,p){if(p.options.useRealPaths)return s(m,p);let g=(0,a.dirname)(d),l=1;for(;g!==p.root&&l<2;){const S=p.symlinks.get(g);!!S&&(S===m||S.startsWith(m)||m.startsWith(S))?l++:g=(0,a.dirname)(g)}return p.symlinks.set(d,m),l>1}function s(d,m){return m.visited.includes(d+m.options.pathSeparator)}return He}var st={},Pr;function Hi(){if(Pr)return st;Pr=1,Object.defineProperty(st,"__esModule",{value:!0}),st.build=void 0;const e=p=>p.counts,n=p=>p.groups,a=p=>p.paths,i=p=>p.paths.slice(0,p.options.maxFiles),h=(p,g,l)=>(d(g,l,p.counts,p.options.suppressErrors),null),r=(p,g,l)=>(d(g,l,p.paths,p.options.suppressErrors),null),t=(p,g,l)=>(d(g,l,p.paths.slice(0,p.options.maxFiles),p.options.suppressErrors),null),s=(p,g,l)=>(d(g,l,p.groups,p.options.suppressErrors),null);function d(p,g,l,S){g(p&&!S?p:null,l)}function m(p,g){const{onlyCounts:l,group:S,maxFiles:A}=p;return l?g?e:h:S?g?n:s:A?g?i:t:g?a:r}return st.build=m,st}var ke={},Tr;function ki(){if(Tr)return ke;Tr=1;var e=ke&&ke.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ke,"__esModule",{value:!0}),ke.build=void 0;const n=e(Be),a={withFileTypes:!0},i=(t,s,d,m,p)=>{if(m<0)return t.queue.dequeue(null,t);t.visited.push(s),t.counts.directories++,t.queue.enqueue(),n.default.readdir(s||".",a,(g,l=[])=>{p(l,d,m),t.queue.dequeue(t.options.suppressErrors?null:g,t)})},h=(t,s,d,m,p)=>{if(m<0)return;t.visited.push(s),t.counts.directories++;let g=[];try{g=n.default.readdirSync(s||".",a)}catch(l){if(!t.options.suppressErrors)throw l}p(g,d,m)};function r(t){return t?h:i}return ke.build=r,ke}var ot={},Nr;function ji(){if(Nr)return ot;Nr=1,Object.defineProperty(ot,"__esModule",{value:!0}),ot.Queue=void 0;class e{onQueueEmpty;count=0;constructor(a){this.onQueueEmpty=a}enqueue(){this.count++}dequeue(a,i){(--this.count<=0||a)&&this.onQueueEmpty(a,i)}}return ot.Queue=e,ot}var it={},Lr;function Fi(){if(Lr)return it;Lr=1,Object.defineProperty(it,"__esModule",{value:!0}),it.Counter=void 0;class e{_files=0;_directories=0;set files(a){this._files=a}get files(){return this._files}set directories(a){this._directories=a}get directories(){return this._directories}get dirs(){return this._directories}}return it.Counter=e,it}var $r;function Dr(){if($r)return me;$r=1;var e=me&&me.__createBinding||(Object.create?function(v,_,R,P){P===void 0&&(P=R);var f=Object.getOwnPropertyDescriptor(_,R);(!f||("get"in f?!_.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return _[R]}}),Object.defineProperty(v,P,f)}:function(v,_,R,P){P===void 0&&(P=R),v[P]=_[R]}),n=me&&me.__setModuleDefault||(Object.create?function(v,_){Object.defineProperty(v,"default",{enumerable:!0,value:_})}:function(v,_){v.default=_}),a=me&&me.__importStar||function(v){if(v&&v.__esModule)return v;var _={};if(v!=null)for(var R in v)R!=="default"&&Object.prototype.hasOwnProperty.call(v,R)&&e(_,v,R);return n(_,v),_};Object.defineProperty(me,"__esModule",{value:!0}),me.Walker=void 0;const i=de,h=Ar(),r=a(Ni()),t=a(Li()),s=a($i()),d=a(Di()),m=a(Ki()),p=a(qi()),g=a(Hi()),l=a(ki()),S=ji(),A=Fi();class k{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(_,R,P){this.isSynchronous=!P,this.callbackInvoker=g.build(R,this.isSynchronous),this.root=(0,h.normalizePath)(_,R),this.state={root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new A.Counter,options:R,queue:new S.Queue((f,y)=>this.callbackInvoker(y,f,P)),symlinks:new Map,visited:[""].slice(0,0)},this.joinPath=r.build(this.root,R),this.pushDirectory=t.build(this.root,R),this.pushFile=s.build(R),this.getArray=d.build(R),this.groupFiles=m.build(R),this.resolveSymlink=p.build(R,this.isSynchronous),this.walkDirectory=l.build(this.isSynchronous)}start(){return this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(_,R,P)=>{const{paths:f,options:{filters:y,resolveSymlinks:c,excludeSymlinks:q,exclude:D,maxFiles:$,signal:H,useRealPaths:E,pathSeparator:O}}=this.state;if(H&&H.aborted||$&&f.length>$)return;this.pushDirectory(R,f,y);const j=this.getArray(this.state.paths);for(let u=0;u<_.length;++u){const N=_[u];if(N.isFile()||N.isSymbolicLink()&&!c&&!q){const b=this.joinPath(N.name,R);this.pushFile(b,j,this.state.counts,y)}else if(N.isDirectory()){let b=r.joinDirectoryPath(N.name,R,this.state.options.pathSeparator);if(D&&D(N.name,b))continue;this.walkDirectory(this.state,b,b,P-1,this.walk)}else if(N.isSymbolicLink()&&this.resolveSymlink){let b=r.joinPathWithBasePath(N.name,R);this.resolveSymlink(b,this.state,(B,T)=>{if(B.isDirectory()){if(T=(0,h.normalizePath)(T,this.state.options),D&&D(N.name,E?T:b+O))return;this.walkDirectory(this.state,T,E?T:b+O,P-1,this.walk)}else{T=E?T:b;const L=(0,i.basename)(T),o=(0,h.normalizePath)((0,i.dirname)(T),this.state.options);T=this.joinPath(L,o),this.pushFile(T,j,this.state.counts,y)}})}}this.groupFiles(this.state.groups,R,j)}}return me.Walker=k,me}var Kr;function Mi(){if(Kr)return qe;Kr=1,Object.defineProperty(qe,"__esModule",{value:!0}),qe.callback=qe.promise=void 0;const e=Dr();function n(i,h){return new Promise((r,t)=>{a(i,h,(s,d)=>{if(s)return t(s);r(d)})})}qe.promise=n;function a(i,h,r){new e.Walker(i,h,r).start()}return qe.callback=a,qe}var ct={},qr;function Vi(){if(qr)return ct;qr=1,Object.defineProperty(ct,"__esModule",{value:!0}),ct.sync=void 0;const e=Dr();function n(a,i){return new e.Walker(a,i).start()}return ct.sync=n,ct}var Hr;function Ui(){if(Hr)return Je;Hr=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.APIBuilder=void 0;const e=Mi(),n=Vi();class a{root;options;constructor(h,r){this.root=h,this.options=r}withPromise(){return(0,e.promise)(this.root,this.options)}withCallback(h){(0,e.callback)(this.root,this.options,h)}sync(){return(0,n.sync)(this.root,this.options)}}return Je.APIBuilder=a,Je}var Rt={},Bt,kr;function vt(){if(kr)return Bt;kr=1;const e="\\\\/",n=`[^${e}]`,a="\\.",i="\\+",h="\\?",r="\\/",t="(?=.)",s="[^/]",d=`(?:${r}|$)`,m=`(?:^|${r})`,p=`${a}{1,2}${d}`,g=`(?!${a})`,l=`(?!${m}${p})`,S=`(?!${a}{0,1}${d})`,A=`(?!${p})`,k=`[^.${r}]`,v=`${s}*?`,R={DOT_LITERAL:a,PLUS_LITERAL:i,QMARK_LITERAL:h,SLASH_LITERAL:r,ONE_CHAR:t,QMARK:s,END_ANCHOR:d,DOTS_SLASH:p,NO_DOT:g,NO_DOTS:l,NO_DOT_SLASH:S,NO_DOTS_SLASH:A,QMARK_NO_DOT:k,STAR:v,START_ANCHOR:m,SEP:"/"},P={...R,SLASH_LITERAL:`[${e}]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`${a}{1,2}(?:[${e}]|$)`,NO_DOT:`(?!${a})`,NO_DOTS:`(?!(?:^|[${e}])${a}{1,2}(?:[${e}]|$))`,NO_DOT_SLASH:`(?!${a}{0,1}(?:[${e}]|$))`,NO_DOTS_SLASH:`(?!${a}{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:{"***":"*","**/**":"**","**/**/**":"**"},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(y){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${y.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(y){return y===!0?P:R}},Bt}var jr;function gt(){return jr||(jr=1,function(e){const{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:a,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:h}=vt();e.isObject=r=>r!==null&&typeof r=="object"&&!Array.isArray(r),e.hasRegexChars=r=>i.test(r),e.isRegexChar=r=>r.length===1&&e.hasRegexChars(r),e.escapeRegex=r=>r.replace(h,"\\$1"),e.toPosixSlashes=r=>r.replace(n,"/"),e.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const r=navigator.platform.toLowerCase();return r==="win32"||r==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1},e.removeBackslashes=r=>r.replace(a,t=>t==="\\"?"":t),e.escapeLast=(r,t,s)=>{const d=r.lastIndexOf(t,s);return d===-1?r:r[d-1]==="\\"?e.escapeLast(r,t,d-1):`${r.slice(0,d)}\\${r.slice(d)}`},e.removePrefix=(r,t={})=>{let s=r;return s.startsWith("./")&&(s=s.slice(2),t.prefix="./"),s},e.wrapOutput=(r,t={},s={})=>{const d=s.contains?"":"^",m=s.contains?"":"$";let p=`${d}(?:${r})${m}`;return t.negated===!0&&(p=`(?:^(?!${p}).*$)`),p},e.basename=(r,{windows:t}={})=>{const s=r.split(t?/[\\/]/:"/"),d=s[s.length-1];return d===""?s[s.length-2]:d}}(Rt)),Rt}var Ot,Fr;function Gi(){if(Fr)return Ot;Fr=1;const e=gt(),{CHAR_ASTERISK:n,CHAR_AT:a,CHAR_BACKWARD_SLASH:i,CHAR_COMMA:h,CHAR_DOT:r,CHAR_EXCLAMATION_MARK:t,CHAR_FORWARD_SLASH:s,CHAR_LEFT_CURLY_BRACE:d,CHAR_LEFT_PARENTHESES:m,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_PLUS:g,CHAR_QUESTION_MARK:l,CHAR_RIGHT_CURLY_BRACE:S,CHAR_RIGHT_PARENTHESES:A,CHAR_RIGHT_SQUARE_BRACKET:k}=vt(),v=P=>P===s||P===i,_=P=>{P.isPrefix!==!0&&(P.depth=P.isGlobstar?1/0:1)};return Ot=(P,f)=>{const y=f||{},c=P.length-1,q=y.parts===!0||y.scanToEnd===!0,D=[],$=[],H=[];let E=P,O=-1,j=0,u=0,N=!1,b=!1,B=!1,T=!1,L=!1,o=!1,w=!1,C=!1,G=!1,x=!1,K=0,te,M,I={value:"",depth:0,isGlob:!1};const F=()=>O>=c,Z=()=>E.charCodeAt(O+1),W=()=>(te=M,E.charCodeAt(++O));for(;O<c;){M=W();let z;if(M===i){w=I.backslashes=!0,M=W(),M===d&&(o=!0);continue}if(o===!0||M===d){for(K++;F()!==!0&&(M=W());){if(M===i){w=I.backslashes=!0,W();continue}if(M===d){K++;continue}if(o!==!0&&M===r&&(M=W())===r){if(N=I.isBrace=!0,B=I.isGlob=!0,x=!0,q===!0)continue;break}if(o!==!0&&M===h){if(N=I.isBrace=!0,B=I.isGlob=!0,x=!0,q===!0)continue;break}if(M===S&&(K--,K===0)){o=!1,N=I.isBrace=!0,x=!0;break}}if(q===!0)continue;break}if(M===s){if(D.push(O),$.push(I),I={value:"",depth:0,isGlob:!1},x===!0)continue;if(te===r&&O===j+1){j+=2;continue}u=O+1;continue}if(y.noext!==!0&&(M===g||M===a||M===n||M===l||M===t)===!0&&Z()===m){if(B=I.isGlob=!0,T=I.isExtglob=!0,x=!0,M===t&&O===j&&(G=!0),q===!0){for(;F()!==!0&&(M=W());){if(M===i){w=I.backslashes=!0,M=W();continue}if(M===A){B=I.isGlob=!0,x=!0;break}}continue}break}if(M===n){if(te===n&&(L=I.isGlobstar=!0),B=I.isGlob=!0,x=!0,q===!0)continue;break}if(M===l){if(B=I.isGlob=!0,x=!0,q===!0)continue;break}if(M===p){for(;F()!==!0&&(z=W());){if(z===i){w=I.backslashes=!0,W();continue}if(z===k){b=I.isBracket=!0,B=I.isGlob=!0,x=!0;break}}if(q===!0)continue;break}if(y.nonegate!==!0&&M===t&&O===j){C=I.negated=!0,j++;continue}if(y.noparen!==!0&&M===m){if(B=I.isGlob=!0,q===!0){for(;F()!==!0&&(M=W());){if(M===m){w=I.backslashes=!0,M=W();continue}if(M===A){x=!0;break}}continue}break}if(B===!0){if(x=!0,q===!0)continue;break}}y.noext===!0&&(T=!1,B=!1);let J=E,Q="",V="";j>0&&(Q=E.slice(0,j),E=E.slice(j),u-=j),J&&B===!0&&u>0?(J=E.slice(0,u),V=E.slice(u)):B===!0?(J="",V=E):J=E,J&&J!==""&&J!=="/"&&J!==E&&v(J.charCodeAt(J.length-1))&&(J=J.slice(0,-1)),y.unescape===!0&&(V&&(V=e.removeBackslashes(V)),J&&w===!0&&(J=e.removeBackslashes(J)));const U={prefix:Q,input:P,start:j,base:J,glob:V,isBrace:N,isBracket:b,isGlob:B,isExtglob:T,isGlobstar:L,negated:C,negatedExtglob:G};if(y.tokens===!0&&(U.maxDepth=0,v(M)||$.push(I),U.tokens=$),y.parts===!0||y.tokens===!0){let z;for(let ee=0;ee<D.length;ee++){const Y=z?z+1:j,re=D[ee],X=P.slice(Y,re);y.tokens&&(ee===0&&j!==0?($[ee].isPrefix=!0,$[ee].value=Q):$[ee].value=X,_($[ee]),U.maxDepth+=$[ee].depth),(ee!==0||X!=="")&&H.push(X),z=re}if(z&&z+1<P.length){const ee=P.slice(z+1);H.push(ee),y.tokens&&($[$.length-1].value=ee,_($[$.length-1]),U.maxDepth+=$[$.length-1].depth)}U.slashes=D,U.parts=H}return U},Ot}var It,Mr;function Yi(){if(Mr)return It;Mr=1;const e=vt(),n=gt(),{MAX_LENGTH:a,POSIX_REGEX_SOURCE:i,REGEX_NON_SPECIAL_CHARS:h,REGEX_SPECIAL_CHARS_BACKREF:r,REPLACEMENTS:t}=e,s=(p,g)=>{if(typeof g.expandRange=="function")return g.expandRange(...p,g);p.sort();const l=`[${p.join("-")}]`;try{new RegExp(l)}catch{return p.map(A=>n.escapeRegex(A)).join("..")}return l},d=(p,g)=>`Missing ${p}: "${g}" - use "\\\\${g}" to match literal characters`,m=(p,g)=>{if(typeof p!="string")throw new TypeError("Expected a string");p=t[p]||p;const l={...g},S=typeof l.maxLength=="number"?Math.min(a,l.maxLength):a;let A=p.length;if(A>S)throw new SyntaxError(`Input length: ${A}, exceeds maximum allowed length: ${S}`);const k={type:"bos",value:"",output:l.prepend||""},v=[k],_=l.capture?"":"?:",R=e.globChars(l.windows),P=e.extglobChars(R),{DOT_LITERAL:f,PLUS_LITERAL:y,SLASH_LITERAL:c,ONE_CHAR:q,DOTS_SLASH:D,NO_DOT:$,NO_DOT_SLASH:H,NO_DOTS_SLASH:E,QMARK:O,QMARK_NO_DOT:j,STAR:u,START_ANCHOR:N}=R,b=Y=>`(${_}(?:(?!${N}${Y.dot?D:f}).)*?)`,B=l.dot?"":$,T=l.dot?O:j;let L=l.bash===!0?b(l):u;l.capture&&(L=`(${L})`),typeof l.noext=="boolean"&&(l.noextglob=l.noext);const o={input:p,index:-1,start:0,dot:l.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:v};p=n.removePrefix(p,o),A=p.length;const w=[],C=[],G=[];let x=k,K;const te=()=>o.index===A-1,M=o.peek=(Y=1)=>p[o.index+Y],I=o.advance=()=>p[++o.index]||"",F=()=>p.slice(o.index+1),Z=(Y="",re=0)=>{o.consumed+=Y,o.index+=re},W=Y=>{o.output+=Y.output!=null?Y.output:Y.value,Z(Y.value)},J=()=>{let Y=1;for(;M()==="!"&&(M(2)!=="("||M(3)==="?");)I(),o.start++,Y++;return Y%2===0?!1:(o.negated=!0,o.start++,!0)},Q=Y=>{o[Y]++,G.push(Y)},V=Y=>{o[Y]--,G.pop()},U=Y=>{if(x.type==="globstar"){const re=o.braces>0&&(Y.type==="comma"||Y.type==="brace"),X=Y.extglob===!0||w.length&&(Y.type==="pipe"||Y.type==="paren");Y.type!=="slash"&&Y.type!=="paren"&&!re&&!X&&(o.output=o.output.slice(0,-x.output.length),x.type="star",x.value="*",x.output=L,o.output+=x.output)}if(w.length&&Y.type!=="paren"&&(w[w.length-1].inner+=Y.value),(Y.value||Y.output)&&W(Y),x&&x.type==="text"&&Y.type==="text"){x.output=(x.output||x.value)+Y.value,x.value+=Y.value;return}Y.prev=x,v.push(Y),x=Y},z=(Y,re)=>{const X={...P[re],conditions:1,inner:""};X.prev=x,X.parens=o.parens,X.output=o.output;const ne=(l.capture?"(":"")+X.open;Q("parens"),U({type:Y,value:re,output:o.output?"":q}),U({type:"paren",extglob:!0,value:I(),output:ne}),w.push(X)},ee=Y=>{let re=Y.close+(l.capture?")":""),X;if(Y.type==="negate"){let ne=L;if(Y.inner&&Y.inner.length>1&&Y.inner.includes("/")&&(ne=b(l)),(ne!==L||te()||/^\)+$/.test(F()))&&(re=Y.close=`)$))${ne}`),Y.inner.includes("*")&&(X=F())&&/^\.[^\\/.]+$/.test(X)){const se=m(X,{...g,fastpaths:!1}).output;re=Y.close=`)${se})${ne})`}Y.prev.type==="bos"&&(o.negatedExtglob=!0)}U({type:"paren",extglob:!0,value:K,output:re}),V("parens")};if(l.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(p)){let Y=!1,re=p.replace(r,(X,ne,se,oe,ie,fe)=>oe==="\\"?(Y=!0,X):oe==="?"?ne?ne+oe+(ie?O.repeat(ie.length):""):fe===0?T+(ie?O.repeat(ie.length):""):O.repeat(se.length):oe==="."?f.repeat(se.length):oe==="*"?ne?ne+oe+(ie?L:""):L:ne?X:`\\${X}`);return Y===!0&&(l.unescape===!0?re=re.replace(/\\/g,""):re=re.replace(/\\+/g,X=>X.length%2===0?"\\\\":X?"\\":"")),re===p&&l.contains===!0?(o.output=p,o):(o.output=n.wrapOutput(re,o,g),o)}for(;!te();){if(K=I(),K==="\0")continue;if(K==="\\"){const X=M();if(X==="/"&&l.bash!==!0||X==="."||X===";")continue;if(!X){K+="\\",U({type:"text",value:K});continue}const ne=/^\\+/.exec(F());let se=0;if(ne&&ne[0].length>2&&(se=ne[0].length,o.index+=se,se%2!==0&&(K+="\\")),l.unescape===!0?K=I():K+=I(),o.brackets===0){U({type:"text",value:K});continue}}if(o.brackets>0&&(K!=="]"||x.value==="["||x.value==="[^")){if(l.posix!==!1&&K===":"){const X=x.value.slice(1);if(X.includes("[")&&(x.posix=!0,X.includes(":"))){const ne=x.value.lastIndexOf("["),se=x.value.slice(0,ne),oe=x.value.slice(ne+2),ie=i[oe];if(ie){x.value=se+ie,o.backtrack=!0,I(),!k.output&&v.indexOf(x)===1&&(k.output=q);continue}}}(K==="["&&M()!==":"||K==="-"&&M()==="]")&&(K=`\\${K}`),K==="]"&&(x.value==="["||x.value==="[^")&&(K=`\\${K}`),l.posix===!0&&K==="!"&&x.value==="["&&(K="^"),x.value+=K,W({value:K});continue}if(o.quotes===1&&K!=='"'){K=n.escapeRegex(K),x.value+=K,W({value:K});continue}if(K==='"'){o.quotes=o.quotes===1?0:1,l.keepQuotes===!0&&U({type:"text",value:K});continue}if(K==="("){Q("parens"),U({type:"paren",value:K});continue}if(K===")"){if(o.parens===0&&l.strictBrackets===!0)throw new SyntaxError(d("opening","("));const X=w[w.length-1];if(X&&o.parens===X.parens+1){ee(w.pop());continue}U({type:"paren",value:K,output:o.parens?")":"\\)"}),V("parens");continue}if(K==="["){if(l.nobracket===!0||!F().includes("]")){if(l.nobracket!==!0&&l.strictBrackets===!0)throw new SyntaxError(d("closing","]"));K=`\\${K}`}else Q("brackets");U({type:"bracket",value:K});continue}if(K==="]"){if(l.nobracket===!0||x&&x.type==="bracket"&&x.value.length===1){U({type:"text",value:K,output:`\\${K}`});continue}if(o.brackets===0){if(l.strictBrackets===!0)throw new SyntaxError(d("opening","["));U({type:"text",value:K,output:`\\${K}`});continue}V("brackets");const X=x.value.slice(1);if(x.posix!==!0&&X[0]==="^"&&!X.includes("/")&&(K=`/${K}`),x.value+=K,W({value:K}),l.literalBrackets===!1||n.hasRegexChars(X))continue;const ne=n.escapeRegex(x.value);if(o.output=o.output.slice(0,-x.value.length),l.literalBrackets===!0){o.output+=ne,x.value=ne;continue}x.value=`(${_}${ne}|${x.value})`,o.output+=x.value;continue}if(K==="{"&&l.nobrace!==!0){Q("braces");const X={type:"brace",value:K,output:"(",outputIndex:o.output.length,tokensIndex:o.tokens.length};C.push(X),U(X);continue}if(K==="}"){const X=C[C.length-1];if(l.nobrace===!0||!X){U({type:"text",value:K,output:K});continue}let ne=")";if(X.dots===!0){const se=v.slice(),oe=[];for(let ie=se.length-1;ie>=0&&(v.pop(),se[ie].type!=="brace");ie--)se[ie].type!=="dots"&&oe.unshift(se[ie].value);ne=s(oe,l),o.backtrack=!0}if(X.comma!==!0&&X.dots!==!0){const se=o.output.slice(0,X.outputIndex),oe=o.tokens.slice(X.tokensIndex);X.value=X.output="\\{",K=ne="\\}",o.output=se;for(const ie of oe)o.output+=ie.output||ie.value}U({type:"brace",value:K,output:ne}),V("braces"),C.pop();continue}if(K==="|"){w.length>0&&w[w.length-1].conditions++,U({type:"text",value:K});continue}if(K===","){let X=K;const ne=C[C.length-1];ne&&G[G.length-1]==="braces"&&(ne.comma=!0,X="|"),U({type:"comma",value:K,output:X});continue}if(K==="/"){if(x.type==="dot"&&o.index===o.start+1){o.start=o.index+1,o.consumed="",o.output="",v.pop(),x=k;continue}U({type:"slash",value:K,output:c});continue}if(K==="."){if(o.braces>0&&x.type==="dot"){x.value==="."&&(x.output=f);const X=C[C.length-1];x.type="dots",x.output+=K,x.value+=K,X.dots=!0;continue}if(o.braces+o.parens===0&&x.type!=="bos"&&x.type!=="slash"){U({type:"text",value:K,output:f});continue}U({type:"dot",value:K,output:f});continue}if(K==="?"){if(!(x&&x.value==="(")&&l.noextglob!==!0&&M()==="("&&M(2)!=="?"){z("qmark",K);continue}if(x&&x.type==="paren"){const ne=M();let se=K;(x.value==="("&&!/[!=<:]/.test(ne)||ne==="<"&&!/<([!=]|\w+>)/.test(F()))&&(se=`\\${K}`),U({type:"text",value:K,output:se});continue}if(l.dot!==!0&&(x.type==="slash"||x.type==="bos")){U({type:"qmark",value:K,output:j});continue}U({type:"qmark",value:K,output:O});continue}if(K==="!"){if(l.noextglob!==!0&&M()==="("&&(M(2)!=="?"||!/[!=<:]/.test(M(3)))){z("negate",K);continue}if(l.nonegate!==!0&&o.index===0){J();continue}}if(K==="+"){if(l.noextglob!==!0&&M()==="("&&M(2)!=="?"){z("plus",K);continue}if(x&&x.value==="("||l.regex===!1){U({type:"plus",value:K,output:y});continue}if(x&&(x.type==="bracket"||x.type==="paren"||x.type==="brace")||o.parens>0){U({type:"plus",value:K});continue}U({type:"plus",value:y});continue}if(K==="@"){if(l.noextglob!==!0&&M()==="("&&M(2)!=="?"){U({type:"at",extglob:!0,value:K,output:""});continue}U({type:"text",value:K});continue}if(K!=="*"){(K==="$"||K==="^")&&(K=`\\${K}`);const X=h.exec(F());X&&(K+=X[0],o.index+=X[0].length),U({type:"text",value:K});continue}if(x&&(x.type==="globstar"||x.star===!0)){x.type="star",x.star=!0,x.value+=K,x.output=L,o.backtrack=!0,o.globstar=!0,Z(K);continue}let Y=F();if(l.noextglob!==!0&&/^\([^?]/.test(Y)){z("star",K);continue}if(x.type==="star"){if(l.noglobstar===!0){Z(K);continue}const X=x.prev,ne=X.prev,se=X.type==="slash"||X.type==="bos",oe=ne&&(ne.type==="star"||ne.type==="globstar");if(l.bash===!0&&(!se||Y[0]&&Y[0]!=="/")){U({type:"star",value:K,output:""});continue}const ie=o.braces>0&&(X.type==="comma"||X.type==="brace"),fe=w.length&&(X.type==="pipe"||X.type==="paren");if(!se&&X.type!=="paren"&&!ie&&!fe){U({type:"star",value:K,output:""});continue}for(;Y.slice(0,3)==="/**";){const le=p[o.index+4];if(le&&le!=="/")break;Y=Y.slice(3),Z("/**",3)}if(X.type==="bos"&&te()){x.type="globstar",x.value+=K,x.output=b(l),o.output=x.output,o.globstar=!0,Z(K);continue}if(X.type==="slash"&&X.prev.type!=="bos"&&!oe&&te()){o.output=o.output.slice(0,-(X.output+x.output).length),X.output=`(?:${X.output}`,x.type="globstar",x.output=b(l)+(l.strictSlashes?")":"|$)"),x.value+=K,o.globstar=!0,o.output+=X.output+x.output,Z(K);continue}if(X.type==="slash"&&X.prev.type!=="bos"&&Y[0]==="/"){const le=Y[1]!==void 0?"|$":"";o.output=o.output.slice(0,-(X.output+x.output).length),X.output=`(?:${X.output}`,x.type="globstar",x.output=`${b(l)}${c}|${c}${le})`,x.value+=K,o.output+=X.output+x.output,o.globstar=!0,Z(K+I()),U({type:"slash",value:"/",output:""});continue}if(X.type==="bos"&&Y[0]==="/"){x.type="globstar",x.value+=K,x.output=`(?:^|${c}|${b(l)}${c})`,o.output=x.output,o.globstar=!0,Z(K+I()),U({type:"slash",value:"/",output:""});continue}o.output=o.output.slice(0,-x.output.length),x.type="globstar",x.output=b(l),x.value+=K,o.output+=x.output,o.globstar=!0,Z(K);continue}const re={type:"star",value:K,output:L};if(l.bash===!0){re.output=".*?",(x.type==="bos"||x.type==="slash")&&(re.output=B+re.output),U(re);continue}if(x&&(x.type==="bracket"||x.type==="paren")&&l.regex===!0){re.output=K,U(re);continue}(o.index===o.start||x.type==="slash"||x.type==="dot")&&(x.type==="dot"?(o.output+=H,x.output+=H):l.dot===!0?(o.output+=E,x.output+=E):(o.output+=B,x.output+=B),M()!=="*"&&(o.output+=q,x.output+=q)),U(re)}for(;o.brackets>0;){if(l.strictBrackets===!0)throw new SyntaxError(d("closing","]"));o.output=n.escapeLast(o.output,"["),V("brackets")}for(;o.parens>0;){if(l.strictBrackets===!0)throw new SyntaxError(d("closing",")"));o.output=n.escapeLast(o.output,"("),V("parens")}for(;o.braces>0;){if(l.strictBrackets===!0)throw new SyntaxError(d("closing","}"));o.output=n.escapeLast(o.output,"{"),V("braces")}if(l.strictSlashes!==!0&&(x.type==="star"||x.type==="bracket")&&U({type:"maybe_slash",value:"",output:`${c}?`}),o.backtrack===!0){o.output="";for(const Y of o.tokens)o.output+=Y.output!=null?Y.output:Y.value,Y.suffix&&(o.output+=Y.suffix)}return o};return m.fastpaths=(p,g)=>{const l={...g},S=typeof l.maxLength=="number"?Math.min(a,l.maxLength):a,A=p.length;if(A>S)throw new SyntaxError(`Input length: ${A}, exceeds maximum allowed length: ${S}`);p=t[p]||p;const{DOT_LITERAL:k,SLASH_LITERAL:v,ONE_CHAR:_,DOTS_SLASH:R,NO_DOT:P,NO_DOTS:f,NO_DOTS_SLASH:y,STAR:c,START_ANCHOR:q}=e.globChars(l.windows),D=l.dot?f:P,$=l.dot?y:P,H=l.capture?"":"?:",E={negated:!1,prefix:""};let O=l.bash===!0?".*?":c;l.capture&&(O=`(${O})`);const j=B=>B.noglobstar===!0?O:`(${H}(?:(?!${q}${B.dot?R:k}).)*?)`,u=B=>{switch(B){case"*":return`${D}${_}${O}`;case".*":return`${k}${_}${O}`;case"*.*":return`${D}${O}${k}${_}${O}`;case"*/*":return`${D}${O}${v}${_}${$}${O}`;case"**":return D+j(l);case"**/*":return`(?:${D}${j(l)}${v})?${$}${_}${O}`;case"**/*.*":return`(?:${D}${j(l)}${v})?${$}${O}${k}${_}${O}`;case"**/.*":return`(?:${D}${j(l)}${v})?${k}${_}${O}`;default:{const T=/^(.*?)\.(\w+)$/.exec(B);if(!T)return;const L=u(T[1]);return L?L+k+T[2]:void 0}}},N=n.removePrefix(p,E);let b=u(N);return b&&l.strictSlashes!==!0&&(b+=`${v}?`),b},It=m,It}var Ct,Vr;function Wi(){if(Vr)return Ct;Vr=1;const e=Gi(),n=Yi(),a=gt(),i=vt(),h=t=>t&&typeof t=="object"&&!Array.isArray(t),r=(t,s,d=!1)=>{if(Array.isArray(t)){const v=t.map(R=>r(R,s,d));return R=>{for(const P of v){const f=P(R);if(f)return f}return!1}}const m=h(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!m)throw new TypeError("Expected pattern to be a non-empty string");const p=s||{},g=p.windows,l=m?r.compileRe(t,s):r.makeRe(t,s,!1,!0),S=l.state;delete l.state;let A=()=>!1;if(p.ignore){const v={...s,ignore:null,onMatch:null,onResult:null};A=r(p.ignore,v,d)}const k=(v,_=!1)=>{const{isMatch:R,match:P,output:f}=r.test(v,l,s,{glob:t,posix:g}),y={glob:t,state:S,regex:l,posix:g,input:v,output:f,match:P,isMatch:R};return typeof p.onResult=="function"&&p.onResult(y),R===!1?(y.isMatch=!1,_?y:!1):A(v)?(typeof p.onIgnore=="function"&&p.onIgnore(y),y.isMatch=!1,_?y:!1):(typeof p.onMatch=="function"&&p.onMatch(y),_?y:!0)};return d&&(k.state=S),k};return r.test=(t,s,d,{glob:m,posix:p}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};const g=d||{},l=g.format||(p?a.toPosixSlashes:null);let S=t===m,A=S&&l?l(t):t;return S===!1&&(A=l?l(t):t,S=A===m),(S===!1||g.capture===!0)&&(g.matchBase===!0||g.basename===!0?S=r.matchBase(t,s,d,p):S=s.exec(A)),{isMatch:!!S,match:S,output:A}},r.matchBase=(t,s,d)=>(s instanceof RegExp?s:r.makeRe(s,d)).test(a.basename(t)),r.isMatch=(t,s,d)=>r(s,d)(t),r.parse=(t,s)=>Array.isArray(t)?t.map(d=>r.parse(d,s)):n(t,{...s,fastpaths:!1}),r.scan=(t,s)=>e(t,s),r.compileRe=(t,s,d=!1,m=!1)=>{if(d===!0)return t.output;const p=s||{},g=p.contains?"":"^",l=p.contains?"":"$";let S=`${g}(?:${t.output})${l}`;t&&t.negated===!0&&(S=`^(?!${S}).*$`);const A=r.toRegex(S,s);return m===!0&&(A.state=t),A},r.makeRe=(t,s={},d=!1,m=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let p={negated:!1,fastpaths:!0};return s.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(p.output=n.fastpaths(t,s)),p.output||(p=n(t,s)),r.compileRe(p,s,d,m)},r.toRegex=(t,s)=>{try{const d=s||{};return new RegExp(t,d.flags||(d.nocase?"i":""))}catch(d){if(s&&s.debug===!0)throw d;return/$^/}},r.constants=i,Ct=r,Ct}var Pt,Ur;function Gr(){if(Ur)return Pt;Ur=1;const e=Wi(),n=gt();function a(i,h,r=!1){return h&&(h.windows===null||h.windows===void 0)&&(h={...h,windows:n.isWindows()}),e(i,h,r)}return Object.assign(a,e),Pt=a,Pt}var Yr;function Zi(){if(Yr)return Qe;Yr=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.Builder=void 0;const e=de,n=Ui();var a=null;try{require.resolve("picomatch"),a=Gr()}catch{}class i{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:e.sep,filters:[]};globFunction;constructor(r){this.options={...this.options,...r},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(r){return this.options.pathSeparator=r,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(r){return this.options.maxDepth=r,this}withMaxFiles(r){return this.options.maxFiles=r,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:r=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=r,this.withFullPaths()}withAbortSignal(r){return this.options.signal=r,this}normalize(){return this.options.normalizePath=!0,this}filter(r){return this.options.filters.push(r),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(r){return this.options.exclude=r,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(r){return new n.APIBuilder(r||".",this.options)}withGlobFunction(r){return this.globFunction=r,this}crawlWithOptions(r,t){return this.options={...this.options,...t},new n.APIBuilder(r||".",this.options)}glob(...r){return this.globFunction?this.globWithOptions(r):this.globWithOptions(r,{dot:!0})}globWithOptions(r,...t){const s=this.globFunction||a;if(!s)throw new Error("Please specify a glob function to use glob matching.");var d=this.globCache[r.join("\0")];return d||(d=s(r,...t),this.globCache[r.join("\0")]=d),this.options.filters.push(m=>d(m)),this}}return Qe.Builder=i,Qe}var Tt={},Wr;function zi(){return Wr||(Wr=1,Object.defineProperty(Tt,"__esModule",{value:!0})),Tt}var Zr;function Xi(){return Zr||(Zr=1,function(e){var n=Ke&&Ke.__createBinding||(Object.create?function(h,r,t,s){s===void 0&&(s=t);var d=Object.getOwnPropertyDescriptor(r,t);(!d||("get"in d?!r.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(h,s,d)}:function(h,r,t,s){s===void 0&&(s=t),h[s]=r[t]}),a=Ke&&Ke.__exportStar||function(h,r){for(var t in h)t!=="default"&&!Object.prototype.hasOwnProperty.call(r,t)&&n(r,h,t)};Object.defineProperty(e,"__esModule",{value:!0}),e.fdir=void 0;const i=Zi();Object.defineProperty(e,"fdir",{enumerable:!0,get:function(){return i.Builder}}),a(zi(),e)}(Ke)),Ke}var Nt,zr;function Qi(){if(zr)return Nt;zr=1;const{fdir:e}=Xi(),n=de,a=Gr();class i{constructor(r="./",t=[".env*"],s=[]){this.ignore=["node_modules/**",".git/**"],this.cwd=n.resolve(r),this.envFile=t,this.excludeEnvFile=s}run(){return this._filepaths()}_filepaths(){const r=a(this._exclude()),t=a(this._patterns(),{ignore:this._exclude()});return new e().withRelativePaths().exclude((s,d)=>r(d)).filter(s=>t(s)).crawl(this.cwd).sync()}_patterns(){return Array.isArray(this.envFile)?this.envFile.map(r=>`**/${r}`):[`**/${this.envFile}`]}_excludePatterns(){return Array.isArray(this.excludeEnvFile)?this.excludeEnvFile.map(r=>`**/${r}`):[`**/${this.excludeEnvFile}`]}_exclude(){return this._excludePatterns().length>0?this.ignore.concat(this._excludePatterns()):this.ignore}}return Nt=i,Nt}var Lt,Xr;function Te(){if(Xr)return Lt;Xr=1;const e=Be,n="utf8";function a(r,t=null){return t||(t=n),e.readFileSync(r,t)}function i(r,t){return e.writeFileSync(r,t,n)}return Lt={chmodSync:e.chmodSync,existsSync:e.existsSync,readdirSync:e.readdirSync,readFileSync:e.readFileSync,writeFileSync:e.writeFileSync,appendFileSync:e.appendFileSync,readFileX:a,writeFileX:i},Lt}var we={exports:{}};const Qr="dotenv",Jr="16.4.7",es="Loads environment variables from .env file",ts="lib/main.js",ns="lib/main.d.ts",rs={".":{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"},ss={"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},os={type:"git",url:"git://github.com/motdotla/dotenv.git"},is="https://dotenvx.com",cs=["dotenv","env",".env","environment","variables","config","settings"],as="README.md",us="BSD-2-Clause",ls={"@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"},fs={node:">=12"},ds={fs:!1},Ji={name:Qr,version:Jr,description:es,main:ts,types:ns,exports:rs,scripts:ss,repository:os,funding:is,keywords:cs,readmeFilename:as,license:us,devDependencies:ls,engines:fs,browser:ds},ec={__proto__:null,browser:ds,default:Ji,description:es,devDependencies:ls,engines:fs,exports:rs,funding:is,keywords:cs,license:us,main:ts,name:Qr,readmeFilename:as,repository:os,scripts:ss,types:ns,version:Jr},tc=Xn(ec);var hs;function nc(){if(hs)return we.exports;hs=1;const e=Be,n=de,a=Zn,i=Ei,r=tc.version,t=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function s(c){const q={};let D=c.toString();D=D.replace(/\r\n?/mg,`
3
- `);let $;for(;($=t.exec(D))!=null;){const H=$[1];let E=$[2]||"";E=E.trim();const O=E[0];E=E.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),O==='"'&&(E=E.replace(/\\n/g,`
4
- `),E=E.replace(/\\r/g,"\r")),q[H]=E}return q}function d(c){const q=A(c),D=y.configDotenv({path:q});if(!D.parsed){const O=new Error(`MISSING_DATA: Cannot parse ${q} for an unknown reason`);throw O.code="MISSING_DATA",O}const $=l(c).split(","),H=$.length;let E;for(let O=0;O<H;O++)try{const j=$[O].trim(),u=S(D,j);E=y.decrypt(u.ciphertext,u.key);break}catch(j){if(O+1>=H)throw j}return y.parse(E)}function m(c){console.log(`[dotenv@${r}][INFO] ${c}`)}function p(c){console.log(`[dotenv@${r}][WARN] ${c}`)}function g(c){console.log(`[dotenv@${r}][DEBUG] ${c}`)}function l(c){return c&&c.DOTENV_KEY&&c.DOTENV_KEY.length>0?c.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function S(c,q){let D;try{D=new URL(q)}catch(j){if(j.code==="ERR_INVALID_URL"){const u=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 u.code="INVALID_DOTENV_KEY",u}throw j}const $=D.password;if(!$){const j=new Error("INVALID_DOTENV_KEY: Missing key part");throw j.code="INVALID_DOTENV_KEY",j}const H=D.searchParams.get("environment");if(!H){const j=new Error("INVALID_DOTENV_KEY: Missing environment part");throw j.code="INVALID_DOTENV_KEY",j}const E=`DOTENV_VAULT_${H.toUpperCase()}`,O=c.parsed[E];if(!O){const j=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${E} in your .env.vault file.`);throw j.code="NOT_FOUND_DOTENV_ENVIRONMENT",j}return{ciphertext:O,key:$}}function A(c){let q=null;if(c&&c.path&&c.path.length>0)if(Array.isArray(c.path))for(const D of c.path)e.existsSync(D)&&(q=D.endsWith(".vault")?D:`${D}.vault`);else q=c.path.endsWith(".vault")?c.path:`${c.path}.vault`;else q=n.resolve(process.cwd(),".env.vault");return e.existsSync(q)?q:null}function k(c){return c[0]==="~"?n.join(a.homedir(),c.slice(1)):c}function v(c){m("Loading env from encrypted .env.vault");const q=y._parseVault(c);let D=process.env;return c&&c.processEnv!=null&&(D=c.processEnv),y.populate(D,q,c),{parsed:q}}function _(c){const q=n.resolve(process.cwd(),".env");let D="utf8";const $=!!(c&&c.debug);c&&c.encoding?D=c.encoding:$&&g("No encoding is specified. UTF-8 is used by default");let H=[q];if(c&&c.path)if(!Array.isArray(c.path))H=[k(c.path)];else{H=[];for(const u of c.path)H.push(k(u))}let E;const O={};for(const u of H)try{const N=y.parse(e.readFileSync(u,{encoding:D}));y.populate(O,N,c)}catch(N){$&&g(`Failed to load ${u} ${N.message}`),E=N}let j=process.env;return c&&c.processEnv!=null&&(j=c.processEnv),y.populate(j,O,c),E?{parsed:O,error:E}:{parsed:O}}function R(c){if(l(c).length===0)return y.configDotenv(c);const q=A(c);return q?y._configVault(c):(p(`You set DOTENV_KEY but you are missing a .env.vault file at ${q}. Did you forget to build it?`),y.configDotenv(c))}function P(c,q){const D=Buffer.from(q.slice(-64),"hex");let $=Buffer.from(c,"base64");const H=$.subarray(0,12),E=$.subarray(-16);$=$.subarray(12,-16);try{const O=i.createDecipheriv("aes-256-gcm",D,H);return O.setAuthTag(E),`${O.update($)}${O.final()}`}catch(O){const j=O instanceof RangeError,u=O.message==="Invalid key length",N=O.message==="Unsupported state or unable to authenticate data";if(j||u){const b=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw b.code="INVALID_DOTENV_KEY",b}else if(N){const b=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw b.code="DECRYPTION_FAILED",b}else throw O}}function f(c,q,D={}){const $=!!(D&&D.debug),H=!!(D&&D.override);if(typeof q!="object"){const E=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw E.code="OBJECT_REQUIRED",E}for(const E of Object.keys(q))Object.prototype.hasOwnProperty.call(c,E)?(H===!0&&(c[E]=q[E]),$&&g(H===!0?`"${E}" is already defined and WAS overwritten`:`"${E}" is already defined and was NOT overwritten`)):c[E]=q[E]}const y={configDotenv:_,_configVault:v,_parseVault:d,config:R,decrypt:P,parse:s,populate:f};return we.exports.configDotenv=y.configDotenv,we.exports._configVault=y._configVault,we.exports._parseVault=y._parseVault,we.exports.config=y.config,we.exports.decrypt=y.decrypt,we.exports.parse=y.parse,we.exports.populate=y.populate,we.exports=y,we.exports}var $t,ps;function rc(){if(ps)return $t;ps=1;function e(n){let a;try{a=new URL(n)}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=a.password;if(!i)throw new Error("INVALID_DOTENV_KEY: Missing key part");return Buffer.from(i.slice(-64),"hex")}return $t=e,$t}var Dt,ys;function sc(){if(ys)return Dt;ys=1;const e=nc(),n=rc();function a(i,h){const r=n(h);try{return e.decrypt(i,r)}catch(t){if(t.code==="DECRYPTION_FAILED"){const s=new Error("[DECRYPTION_FAILED] Unable to decrypt .env.vault with DOTENV_KEY.");throw s.code="DECRYPTION_FAILED",s.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.",s.debug=`[DECRYPTION_FAILED] DOTENV_KEY is ${h}`,s}if(t.code==="ERR_CRYPTO_INVALID_AUTH_TAG"){const s=new Error("[INVALID_CIPHERTEXT] Unable to decrypt what appears to be invalid ciphertext.");throw s.code="INVALID_CIPHERTEXT",s.help="[INVALID_CIPHERTEXT] Run with debug flag [dotenvx run --debug -- yourcommand] or manually check .env.vault.",s.debug=`[INVALID_CIPHERTEXT] ciphertext is '${i}'`,s}throw t}}return Dt=a,Dt}var Kt={},qt={},xe={},vs;function gs(){if(vs)return xe;vs=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.abool=t,xe.abytes=a,xe.aexists=h,xe.ahash=i,xe.anumber=e,xe.aoutput=r,xe.isBytes=n;function e(s){if(!Number.isSafeInteger(s)||s<0)throw new Error("positive integer expected, got "+s)}function n(s){return s instanceof Uint8Array||ArrayBuffer.isView(s)&&s.constructor.name==="Uint8Array"}function a(s,...d){if(!n(s))throw new Error("Uint8Array expected");if(d.length>0&&!d.includes(s.length))throw new Error("Uint8Array expected of length "+d+", got length="+s.length)}function i(s){if(typeof s!="function"||typeof s.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");e(s.outputLen),e(s.blockLen)}function h(s,d=!0){if(s.destroyed)throw new Error("Hash instance has been destroyed");if(d&&s.finished)throw new Error("Hash#digest() has already been called")}function r(s,d){a(s);const m=d.outputLen;if(s.length<m)throw new Error("digestInto() expects output buffer of length at least "+m)}function t(s){if(typeof s!="boolean")throw new Error(`boolean expected, not ${s}`)}return xe}var ms;function Ce(){return ms||(ms=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.wrapCipher=e.Hash=e.nextTick=e.isLE=e.createView=e.u32=e.u8=void 0,e.bytesToHex=t,e.hexToBytes=m,e.hexToNumber=p,e.bytesToNumberBE=g,e.numberToBytesBE=l,e.utf8ToBytes=A,e.bytesToUtf8=k,e.toBytes=v,e.overlapBytes=_,e.complexOverlapBytes=R,e.concatBytes=P,e.checkOpts=f,e.equalBytes=y,e.getOutput=D,e.setBigUint64=$,e.u64Lengths=H,e.isAligned32=E,e.copyBytes=O,e.clean=j;/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */const n=gs(),a=u=>new Uint8Array(u.buffer,u.byteOffset,u.byteLength);e.u8=a;const i=u=>new Uint32Array(u.buffer,u.byteOffset,Math.floor(u.byteLength/4));e.u32=i;const h=u=>new DataView(u.buffer,u.byteOffset,u.byteLength);if(e.createView=h,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!e.isLE)throw new Error("Non little-endian hardware is not supported");const r=Array.from({length:256},(u,N)=>N.toString(16).padStart(2,"0"));function t(u){(0,n.abytes)(u);let N="";for(let b=0;b<u.length;b++)N+=r[u[b]];return N}const s={_0:48,_9:57,A:65,F:70,a:97,f:102};function d(u){if(u>=s._0&&u<=s._9)return u-s._0;if(u>=s.A&&u<=s.F)return u-(s.A-10);if(u>=s.a&&u<=s.f)return u-(s.a-10)}function m(u){if(typeof u!="string")throw new Error("hex string expected, got "+typeof u);const N=u.length,b=N/2;if(N%2)throw new Error("hex string expected, got unpadded hex of length "+N);const B=new Uint8Array(b);for(let T=0,L=0;T<b;T++,L+=2){const o=d(u.charCodeAt(L)),w=d(u.charCodeAt(L+1));if(o===void 0||w===void 0){const C=u[L]+u[L+1];throw new Error('hex string expected, got non-hex character "'+C+'" at index '+L)}B[T]=o*16+w}return B}function p(u){if(typeof u!="string")throw new Error("hex string expected, got "+typeof u);return BigInt(u===""?"0":"0x"+u)}function g(u){return p(t(u))}function l(u,N){return m(u.toString(16).padStart(N*2,"0"))}const S=async()=>{};e.nextTick=S;function A(u){if(typeof u!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(u))}function k(u){return new TextDecoder().decode(u)}function v(u){if(typeof u=="string")u=A(u);else if((0,n.isBytes)(u))u=O(u);else throw new Error("Uint8Array expected, got "+typeof u);return u}function _(u,N){return u.buffer===N.buffer&&u.byteOffset<N.byteOffset+N.byteLength&&N.byteOffset<u.byteOffset+u.byteLength}function R(u,N){if(_(u,N)&&u.byteOffset<N.byteOffset)throw new Error("complex overlap of input and output is not supported")}function P(...u){let N=0;for(let B=0;B<u.length;B++){const T=u[B];(0,n.abytes)(T),N+=T.length}const b=new Uint8Array(N);for(let B=0,T=0;B<u.length;B++){const L=u[B];b.set(L,T),T+=L.length}return b}function f(u,N){if(N==null||typeof N!="object")throw new Error("options must be defined");return Object.assign(u,N)}function y(u,N){if(u.length!==N.length)return!1;let b=0;for(let B=0;B<u.length;B++)b|=u[B]^N[B];return b===0}class c{}e.Hash=c;const q=(u,N)=>{function b(B,...T){if((0,n.abytes)(B),u.nonceLength!==void 0){const x=T[0];if(!x)throw new Error("nonce / iv required");u.varSizeNonce?(0,n.abytes)(x):(0,n.abytes)(x,u.nonceLength)}const L=u.tagLength;L&&T[1]!==void 0&&(0,n.abytes)(T[1]);const o=N(B,...T),w=(x,K)=>{if(K!==void 0){if(x!==2)throw new Error("cipher output not supported");(0,n.abytes)(K)}};let C=!1;return{encrypt(x,K){if(C)throw new Error("cannot encrypt() twice with same key + nonce");return C=!0,(0,n.abytes)(x),w(o.encrypt.length,K),o.encrypt(x,K)},decrypt(x,K){if((0,n.abytes)(x),L&&x.length<L)throw new Error("invalid ciphertext length: smaller than tagLength="+L);return w(o.decrypt.length,K),o.decrypt(x,K)}}}return Object.assign(b,u),b};e.wrapCipher=q;function D(u,N,b=!0){if(N===void 0)return new Uint8Array(u);if(N.length!==u)throw new Error("invalid output length, expected "+u+", got: "+N.length);if(b&&!E(N))throw new Error("invalid output, must be aligned");return N}function $(u,N,b,B){if(typeof u.setBigUint64=="function")return u.setBigUint64(N,b,B);const T=BigInt(32),L=BigInt(4294967295),o=Number(b>>T&L),w=Number(b&L),C=B?4:0,G=B?0:4;u.setUint32(N+C,o,B),u.setUint32(N+G,w,B)}function H(u,N){const b=new Uint8Array(16),B=(0,e.createView)(b);return $(B,0,BigInt(N?N.length:0),!0),$(B,8,BigInt(u.length),!0),b}function E(u){return u.byteOffset%4===0}function O(u){return Uint8Array.from(u)}function j(...u){for(let N=0;N<u.length;N++)u[N].fill(0)}}(qt)),qt}var Ht={},pe={},bs;function kt(){return bs||(bs=1,Object.defineProperty(pe,"__esModule",{value:!0}),pe.AEAD_TAG_LENGTH=pe.XCHACHA20_NONCE_LENGTH=pe.CURVE25519_PUBLIC_KEY_SIZE=pe.ETH_PUBLIC_KEY_SIZE=pe.UNCOMPRESSED_PUBLIC_KEY_SIZE=pe.COMPRESSED_PUBLIC_KEY_SIZE=pe.SECRET_KEY_LENGTH=void 0,pe.SECRET_KEY_LENGTH=32,pe.COMPRESSED_PUBLIC_KEY_SIZE=33,pe.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,pe.ETH_PUBLIC_KEY_SIZE=64,pe.CURVE25519_PUBLIC_KEY_SIZE=32,pe.XCHACHA20_NONCE_LENGTH=24,pe.AEAD_TAG_LENGTH=16),pe}var Es;function mt(){return Es||(Es=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 n=kt(),a=function(){function m(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16}return m}();e.ECIES_CONFIG=new a;var i=function(){return e.ECIES_CONFIG.ellipticCurve};e.ellipticCurve=i;var h=function(){return e.ECIES_CONFIG.isEphemeralKeyCompressed};e.isEphemeralKeyCompressed=h;var r=function(){return e.ECIES_CONFIG.isHkdfKeyCompressed};e.isHkdfKeyCompressed=r;var t=function(){return e.ECIES_CONFIG.symmetricAlgorithm};e.symmetricAlgorithm=t;var s=function(){return e.ECIES_CONFIG.symmetricNonceLength};e.symmetricNonceLength=s;var d=function(){var m={secp256k1:e.ECIES_CONFIG.isEphemeralKeyCompressed?n.COMPRESSED_PUBLIC_KEY_SIZE:n.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:n.CURVE25519_PUBLIC_KEY_SIZE,ed25519:n.CURVE25519_PUBLIC_KEY_SIZE};if(e.ECIES_CONFIG.ellipticCurve in m)return m[e.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")};e.ephemeralKeySize=d}(Ht)),Ht}var jt={},at={},je={},Ft={},Mt={},ut={},_s;function oc(){return _s||(_s=1,Object.defineProperty(ut,"__esModule",{value:!0}),ut.crypto=void 0,ut.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),ut}var ws;function xs(){return ws||(ws=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.gcm=e.ctr=e.cbc=e.utils=void 0,e.randomBytes=h,e.getWebcryptoSubtle=r,e.managedNonce=t;const n=oc(),a=gs(),i=Ce();function h(p=32){if(n.crypto&&typeof n.crypto.getRandomValues=="function")return n.crypto.getRandomValues(new Uint8Array(p));if(n.crypto&&typeof n.crypto.randomBytes=="function")return n.crypto.randomBytes(p);throw new Error("crypto.getRandomValues must be defined")}function r(){if(n.crypto&&typeof n.crypto.subtle=="object"&&n.crypto.subtle!=null)return n.crypto.subtle;throw new Error("crypto.subtle must be defined")}function t(p){const{nonceLength:g}=p;return(0,a.anumber)(g),(l,...S)=>({encrypt(A,...k){const v=h(g),_=p(l,v,...S).encrypt(A,...k),R=(0,i.concatBytes)(v,_);return _.fill(0),R},decrypt(A,...k){const v=A.subarray(0,g),_=A.subarray(g);return p(l,v,...S).decrypt(_,...k)}})}e.utils={async encrypt(p,g,l,S){const A=r(),k=await A.importKey("raw",p,g,!0,["encrypt"]),v=await A.encrypt(l,k,S);return new Uint8Array(v)},async decrypt(p,g,l,S){const A=r(),k=await A.importKey("raw",p,g,!0,["decrypt"]),v=await A.decrypt(l,k,S);return new Uint8Array(v)}};const s={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function d(p,g,l){if(p===s.CBC)return{name:s.CBC,iv:g};if(p===s.CTR)return{name:s.CTR,counter:g,length:64};if(p===s.GCM)return l?{name:s.GCM,iv:g,additionalData:l}:{name:s.GCM,iv:g};throw new Error("unknown aes block mode")}function m(p){return(g,l,S)=>{(0,a.abytes)(g),(0,a.abytes)(l);const A={name:p,length:g.length*8},k=d(p,l,S);let v=!1;return{encrypt(_){if((0,a.abytes)(_),v)throw new Error("Cannot encrypt() twice with same key / nonce");return v=!0,e.utils.encrypt(g,A,k,_)},decrypt(_){return(0,a.abytes)(_),e.utils.decrypt(g,A,k,_)}}}}e.cbc=m(s.CBC),e.ctr=m(s.CTR),e.gcm=m(s.GCM)}(Mt)),Mt}var Vt={},he={},Ne={},Le={},As;function bt(){if(As)return Le;As=1,Object.defineProperty(Le,"__esModule",{value:!0}),Le.anumber=e,Le.abytes=a,Le.ahash=i,Le.aexists=h,Le.aoutput=r;function e(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function n(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function a(t,...s){if(!n(t))throw new Error("Uint8Array expected");if(s.length>0&&!s.includes(t.length))throw new Error("Uint8Array expected of length "+s+", got length="+t.length)}function i(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");e(t.outputLen),e(t.blockLen)}function h(t,s=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(s&&t.finished)throw new Error("Hash#digest() has already been called")}function r(t,s){a(t);const d=s.outputLen;if(t.length<d)throw new Error("digestInto() expects output buffer of length at least "+d)}return Le}var Ut={},lt={},Ss;function ic(){return Ss||(Ss=1,Object.defineProperty(lt,"__esModule",{value:!0}),lt.crypto=void 0,lt.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),lt}var Rs;function $e(){return Rs||(Rs=1,function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.nextTick=e.byteSwapIfBE=e.isLE=void 0,e.isBytes=i,e.u8=h,e.u32=r,e.createView=t,e.rotr=s,e.rotl=d,e.byteSwap=m,e.byteSwap32=p,e.bytesToHex=l,e.hexToBytes=k,e.asyncLoop=_,e.utf8ToBytes=R,e.toBytes=P,e.concatBytes=f,e.checkOpts=c,e.wrapConstructor=q,e.wrapConstructorWithOpts=D,e.wrapXOFConstructorWithOpts=$,e.randomBytes=H;const n=ic(),a=bt();function i(E){return E instanceof Uint8Array||ArrayBuffer.isView(E)&&E.constructor.name==="Uint8Array"}function h(E){return new Uint8Array(E.buffer,E.byteOffset,E.byteLength)}function r(E){return new Uint32Array(E.buffer,E.byteOffset,Math.floor(E.byteLength/4))}function t(E){return new DataView(E.buffer,E.byteOffset,E.byteLength)}function s(E,O){return E<<32-O|E>>>O}function d(E,O){return E<<O|E>>>32-O>>>0}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function m(E){return E<<24&4278190080|E<<8&16711680|E>>>8&65280|E>>>24&255}e.byteSwapIfBE=e.isLE?E=>E:E=>m(E);function p(E){for(let O=0;O<E.length;O++)E[O]=m(E[O])}const g=Array.from({length:256},(E,O)=>O.toString(16).padStart(2,"0"));function l(E){(0,a.abytes)(E);let O="";for(let j=0;j<E.length;j++)O+=g[E[j]];return O}const S={_0:48,_9:57,A:65,F:70,a:97,f:102};function A(E){if(E>=S._0&&E<=S._9)return E-S._0;if(E>=S.A&&E<=S.F)return E-(S.A-10);if(E>=S.a&&E<=S.f)return E-(S.a-10)}function k(E){if(typeof E!="string")throw new Error("hex string expected, got "+typeof E);const O=E.length,j=O/2;if(O%2)throw new Error("hex string expected, got unpadded hex of length "+O);const u=new Uint8Array(j);for(let N=0,b=0;N<j;N++,b+=2){const B=A(E.charCodeAt(b)),T=A(E.charCodeAt(b+1));if(B===void 0||T===void 0){const L=E[b]+E[b+1];throw new Error('hex string expected, got non-hex character "'+L+'" at index '+b)}u[N]=B*16+T}return u}const v=async()=>{};e.nextTick=v;async function _(E,O,j){let u=Date.now();for(let N=0;N<E;N++){j(N);const b=Date.now()-u;b>=0&&b<O||(await(0,e.nextTick)(),u+=b)}}function R(E){if(typeof E!="string")throw new Error("utf8ToBytes expected string, got "+typeof E);return new Uint8Array(new TextEncoder().encode(E))}function P(E){return typeof E=="string"&&(E=R(E)),(0,a.abytes)(E),E}function f(...E){let O=0;for(let u=0;u<E.length;u++){const N=E[u];(0,a.abytes)(N),O+=N.length}const j=new Uint8Array(O);for(let u=0,N=0;u<E.length;u++){const b=E[u];j.set(b,N),N+=b.length}return j}class y{clone(){return this._cloneInto()}}e.Hash=y;function c(E,O){if(O!==void 0&&{}.toString.call(O)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(E,O)}function q(E){const O=u=>E().update(P(u)).digest(),j=E();return O.outputLen=j.outputLen,O.blockLen=j.blockLen,O.create=()=>E(),O}function D(E){const O=(u,N)=>E(N).update(P(u)).digest(),j=E({});return O.outputLen=j.outputLen,O.blockLen=j.blockLen,O.create=u=>E(u),O}function $(E){const O=(u,N)=>E(N).update(P(u)).digest(),j=E({});return O.outputLen=j.outputLen,O.blockLen=j.blockLen,O.create=u=>E(u),O}function H(E=32){if(n.crypto&&typeof n.crypto.getRandomValues=="function")return n.crypto.getRandomValues(new Uint8Array(E));if(n.crypto&&typeof n.crypto.randomBytes=="function")return n.crypto.randomBytes(E);throw new Error("crypto.getRandomValues must be defined")}}(Ut)),Ut}var Bs;function Os(){if(Bs)return Ne;Bs=1,Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.HashMD=void 0,Ne.setBigUint64=a,Ne.Chi=i,Ne.Maj=h;const e=bt(),n=$e();function a(t,s,d,m){if(typeof t.setBigUint64=="function")return t.setBigUint64(s,d,m);const p=BigInt(32),g=BigInt(4294967295),l=Number(d>>p&g),S=Number(d&g),A=m?4:0,k=m?0:4;t.setUint32(s+A,l,m),t.setUint32(s+k,S,m)}function i(t,s,d){return t&s^~t&d}function h(t,s,d){return t&s^t&d^s&d}class r extends n.Hash{constructor(s,d,m,p){super(),this.blockLen=s,this.outputLen=d,this.padOffset=m,this.isLE=p,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(s),this.view=(0,n.createView)(this.buffer)}update(s){(0,e.aexists)(this);const{view:d,buffer:m,blockLen:p}=this;s=(0,n.toBytes)(s);const g=s.length;for(let l=0;l<g;){const S=Math.min(p-this.pos,g-l);if(S===p){const A=(0,n.createView)(s);for(;p<=g-l;l+=p)this.process(A,l);continue}m.set(s.subarray(l,l+S),this.pos),this.pos+=S,l+=S,this.pos===p&&(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:m,blockLen:p,isLE:g}=this;let{pos:l}=this;d[l++]=128,this.buffer.subarray(l).fill(0),this.padOffset>p-l&&(this.process(m,0),l=0);for(let _=l;_<p;_++)d[_]=0;a(m,p-8,BigInt(this.length*8),g),this.process(m,0);const S=(0,n.createView)(s),A=this.outputLen;if(A%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const k=A/4,v=this.get();if(k>v.length)throw new Error("_sha2: outputLen bigger than state");for(let _=0;_<k;_++)S.setUint32(4*_,v[_],g)}digest(){const{buffer:s,outputLen:d}=this;this.digestInto(s);const m=s.slice(0,d);return this.destroy(),m}_cloneInto(s){s||(s=new this.constructor),s.set(...this.get());const{blockLen:d,buffer:m,length:p,finished:g,destroyed:l,pos:S}=this;return s.length=p,s.pos=S,s.finished=g,s.destroyed=l,p%d&&s.buffer.set(m),s}}return Ne.HashMD=r,Ne}var ce={},Is;function cc(){if(Is)return ce;Is=1,Object.defineProperty(ce,"__esModule",{value:!0}),ce.add5L=ce.add5H=ce.add4H=ce.add4L=ce.add3H=ce.add3L=ce.rotlBL=ce.rotlBH=ce.rotlSL=ce.rotlSH=ce.rotr32L=ce.rotr32H=ce.rotrBL=ce.rotrBH=ce.rotrSL=ce.rotrSH=ce.shrSL=ce.shrSH=ce.toBig=void 0,ce.fromBig=a,ce.split=i,ce.add=_;const e=BigInt(2**32-1),n=BigInt(32);function a($,H=!1){return H?{h:Number($&e),l:Number($>>n&e)}:{h:Number($>>n&e)|0,l:Number($&e)|0}}function i($,H=!1){let E=new Uint32Array($.length),O=new Uint32Array($.length);for(let j=0;j<$.length;j++){const{h:u,l:N}=a($[j],H);[E[j],O[j]]=[u,N]}return[E,O]}const h=($,H)=>BigInt($>>>0)<<n|BigInt(H>>>0);ce.toBig=h;const r=($,H,E)=>$>>>E;ce.shrSH=r;const t=($,H,E)=>$<<32-E|H>>>E;ce.shrSL=t;const s=($,H,E)=>$>>>E|H<<32-E;ce.rotrSH=s;const d=($,H,E)=>$<<32-E|H>>>E;ce.rotrSL=d;const m=($,H,E)=>$<<64-E|H>>>E-32;ce.rotrBH=m;const p=($,H,E)=>$>>>E-32|H<<64-E;ce.rotrBL=p;const g=($,H)=>H;ce.rotr32H=g;const l=($,H)=>$;ce.rotr32L=l;const S=($,H,E)=>$<<E|H>>>32-E;ce.rotlSH=S;const A=($,H,E)=>H<<E|$>>>32-E;ce.rotlSL=A;const k=($,H,E)=>H<<E-32|$>>>64-E;ce.rotlBH=k;const v=($,H,E)=>$<<E-32|H>>>64-E;ce.rotlBL=v;function _($,H,E,O){const j=(H>>>0)+(O>>>0);return{h:$+E+(j/2**32|0)|0,l:j|0}}const R=($,H,E)=>($>>>0)+(H>>>0)+(E>>>0);ce.add3L=R;const P=($,H,E,O)=>H+E+O+($/2**32|0)|0;ce.add3H=P;const f=($,H,E,O)=>($>>>0)+(H>>>0)+(E>>>0)+(O>>>0);ce.add4L=f;const y=($,H,E,O,j)=>H+E+O+j+($/2**32|0)|0;ce.add4H=y;const c=($,H,E,O,j)=>($>>>0)+(H>>>0)+(E>>>0)+(O>>>0)+(j>>>0);ce.add5L=c;const q=($,H,E,O,j,u)=>H+E+O+j+u+($/2**32|0)|0;ce.add5H=q;const D={fromBig:a,split:i,toBig:h,shrSH:r,shrSL:t,rotrSH:s,rotrSL:d,rotrBH:m,rotrBL:p,rotr32H:g,rotr32L:l,rotlSH:S,rotlSL:A,rotlBH:k,rotlBL:v,add:_,add3L:R,add3H:P,add4L:f,add4H:y,add5H:q,add5L:c};return ce.default=D,ce}var Cs;function ac(){if(Cs)return he;Cs=1,Object.defineProperty(he,"__esModule",{value:!0}),he.sha384=he.sha512_256=he.sha512_224=he.sha512=he.SHA384=he.SHA512_256=he.SHA512_224=he.SHA512=void 0;const e=Os(),n=cc(),a=$e(),[i,h]=n.default.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(g=>BigInt(g))),r=new Uint32Array(80),t=new Uint32Array(80);class s extends e.HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:l,Al:S,Bh:A,Bl:k,Ch:v,Cl:_,Dh:R,Dl:P,Eh:f,El:y,Fh:c,Fl:q,Gh:D,Gl:$,Hh:H,Hl:E}=this;return[l,S,A,k,v,_,R,P,f,y,c,q,D,$,H,E]}set(l,S,A,k,v,_,R,P,f,y,c,q,D,$,H,E){this.Ah=l|0,this.Al=S|0,this.Bh=A|0,this.Bl=k|0,this.Ch=v|0,this.Cl=_|0,this.Dh=R|0,this.Dl=P|0,this.Eh=f|0,this.El=y|0,this.Fh=c|0,this.Fl=q|0,this.Gh=D|0,this.Gl=$|0,this.Hh=H|0,this.Hl=E|0}process(l,S){for(let u=0;u<16;u++,S+=4)r[u]=l.getUint32(S),t[u]=l.getUint32(S+=4);for(let u=16;u<80;u++){const N=r[u-15]|0,b=t[u-15]|0,B=n.default.rotrSH(N,b,1)^n.default.rotrSH(N,b,8)^n.default.shrSH(N,b,7),T=n.default.rotrSL(N,b,1)^n.default.rotrSL(N,b,8)^n.default.shrSL(N,b,7),L=r[u-2]|0,o=t[u-2]|0,w=n.default.rotrSH(L,o,19)^n.default.rotrBH(L,o,61)^n.default.shrSH(L,o,6),C=n.default.rotrSL(L,o,19)^n.default.rotrBL(L,o,61)^n.default.shrSL(L,o,6),G=n.default.add4L(T,C,t[u-7],t[u-16]),x=n.default.add4H(G,B,w,r[u-7],r[u-16]);r[u]=x|0,t[u]=G|0}let{Ah:A,Al:k,Bh:v,Bl:_,Ch:R,Cl:P,Dh:f,Dl:y,Eh:c,El:q,Fh:D,Fl:$,Gh:H,Gl:E,Hh:O,Hl:j}=this;for(let u=0;u<80;u++){const N=n.default.rotrSH(c,q,14)^n.default.rotrSH(c,q,18)^n.default.rotrBH(c,q,41),b=n.default.rotrSL(c,q,14)^n.default.rotrSL(c,q,18)^n.default.rotrBL(c,q,41),B=c&D^~c&H,T=q&$^~q&E,L=n.default.add5L(j,b,T,h[u],t[u]),o=n.default.add5H(L,O,N,B,i[u],r[u]),w=L|0,C=n.default.rotrSH(A,k,28)^n.default.rotrBH(A,k,34)^n.default.rotrBH(A,k,39),G=n.default.rotrSL(A,k,28)^n.default.rotrBL(A,k,34)^n.default.rotrBL(A,k,39),x=A&v^A&R^v&R,K=k&_^k&P^_&P;O=H|0,j=E|0,H=D|0,E=$|0,D=c|0,$=q|0,{h:c,l:q}=n.default.add(f|0,y|0,o|0,w|0),f=R|0,y=P|0,R=v|0,P=_|0,v=A|0,_=k|0;const te=n.default.add3L(w,G,K);A=n.default.add3H(te,o,C,x),k=te|0}({h:A,l:k}=n.default.add(this.Ah|0,this.Al|0,A|0,k|0)),{h:v,l:_}=n.default.add(this.Bh|0,this.Bl|0,v|0,_|0),{h:R,l:P}=n.default.add(this.Ch|0,this.Cl|0,R|0,P|0),{h:f,l:y}=n.default.add(this.Dh|0,this.Dl|0,f|0,y|0),{h:c,l:q}=n.default.add(this.Eh|0,this.El|0,c|0,q|0),{h:D,l:$}=n.default.add(this.Fh|0,this.Fl|0,D|0,$|0),{h:H,l:E}=n.default.add(this.Gh|0,this.Gl|0,H|0,E|0),{h:O,l:j}=n.default.add(this.Hh|0,this.Hl|0,O|0,j|0),this.set(A,k,v,_,R,P,f,y,c,q,D,$,H,E,O,j)}roundClean(){r.fill(0),t.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}he.SHA512=s;class d extends s{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}he.SHA512_224=d;class m extends s{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}he.SHA512_256=m;class p extends s{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}return he.SHA384=p,he.sha512=(0,a.wrapConstructor)(()=>new s),he.sha512_224=(0,a.wrapConstructor)(()=>new d),he.sha512_256=(0,a.wrapConstructor)(()=>new m),he.sha384=(0,a.wrapConstructor)(()=>new p),he}var Fe={},ue={},ae={},Ps;function Ae(){if(Ps)return ae;Ps=1;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(ae,"__esModule",{value:!0}),ae.notImplemented=ae.bitMask=void 0,ae.isBytes=i,ae.abytes=h,ae.abool=r,ae.bytesToHex=s,ae.numberToHexUnpadded=d,ae.hexToNumber=m,ae.hexToBytes=l,ae.bytesToNumberBE=S,ae.bytesToNumberLE=A,ae.numberToBytesBE=k,ae.numberToBytesLE=v,ae.numberToVarBytesBE=_,ae.ensureBytes=R,ae.concatBytes=P,ae.equalBytes=f,ae.utf8ToBytes=y,ae.inRange=q,ae.aInRange=D,ae.bitLen=$,ae.bitGet=H,ae.bitSet=E,ae.createHmacDrbg=N,ae.validateObject=B,ae.memoized=L;const e=BigInt(0),n=BigInt(1),a=BigInt(2);function i(o){return o instanceof Uint8Array||ArrayBuffer.isView(o)&&o.constructor.name==="Uint8Array"}function h(o){if(!i(o))throw new Error("Uint8Array expected")}function r(o,w){if(typeof w!="boolean")throw new Error(o+" boolean expected, got "+w)}const t=Array.from({length:256},(o,w)=>w.toString(16).padStart(2,"0"));function s(o){h(o);let w="";for(let C=0;C<o.length;C++)w+=t[o[C]];return w}function d(o){const w=o.toString(16);return w.length&1?"0"+w:w}function m(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);return o===""?e:BigInt("0x"+o)}const p={_0:48,_9:57,A:65,F:70,a:97,f:102};function g(o){if(o>=p._0&&o<=p._9)return o-p._0;if(o>=p.A&&o<=p.F)return o-(p.A-10);if(o>=p.a&&o<=p.f)return o-(p.a-10)}function l(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);const w=o.length,C=w/2;if(w%2)throw new Error("hex string expected, got unpadded hex of length "+w);const G=new Uint8Array(C);for(let x=0,K=0;x<C;x++,K+=2){const te=g(o.charCodeAt(K)),M=g(o.charCodeAt(K+1));if(te===void 0||M===void 0){const I=o[K]+o[K+1];throw new Error('hex string expected, got non-hex character "'+I+'" at index '+K)}G[x]=te*16+M}return G}function S(o){return m(s(o))}function A(o){return h(o),m(s(Uint8Array.from(o).reverse()))}function k(o,w){return l(o.toString(16).padStart(w*2,"0"))}function v(o,w){return k(o,w).reverse()}function _(o){return l(d(o))}function R(o,w,C){let G;if(typeof w=="string")try{G=l(w)}catch(K){throw new Error(o+" must be hex string or Uint8Array, cause: "+K)}else if(i(w))G=Uint8Array.from(w);else throw new Error(o+" must be hex string or Uint8Array");const x=G.length;if(typeof C=="number"&&x!==C)throw new Error(o+" of length "+C+" expected, got "+x);return G}function P(...o){let w=0;for(let G=0;G<o.length;G++){const x=o[G];h(x),w+=x.length}const C=new Uint8Array(w);for(let G=0,x=0;G<o.length;G++){const K=o[G];C.set(K,x),x+=K.length}return C}function f(o,w){if(o.length!==w.length)return!1;let C=0;for(let G=0;G<o.length;G++)C|=o[G]^w[G];return C===0}function y(o){if(typeof o!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(o))}const c=o=>typeof o=="bigint"&&e<=o;function q(o,w,C){return c(o)&&c(w)&&c(C)&&w<=o&&o<C}function D(o,w,C,G){if(!q(w,C,G))throw new Error("expected valid "+o+": "+C+" <= n < "+G+", got "+w)}function $(o){let w;for(w=0;o>e;o>>=n,w+=1);return w}function H(o,w){return o>>BigInt(w)&n}function E(o,w,C){return o|(C?n:e)<<BigInt(w)}const O=o=>(a<<BigInt(o-1))-n;ae.bitMask=O;const j=o=>new Uint8Array(o),u=o=>Uint8Array.from(o);function N(o,w,C){if(typeof o!="number"||o<2)throw new Error("hashLen must be a number");if(typeof w!="number"||w<2)throw new Error("qByteLen must be a number");if(typeof C!="function")throw new Error("hmacFn must be a function");let G=j(o),x=j(o),K=0;const te=()=>{G.fill(1),x.fill(0),K=0},M=(...W)=>C(x,G,...W),I=(W=j())=>{x=M(u([0]),W),G=M(),W.length!==0&&(x=M(u([1]),W),G=M())},F=()=>{if(K++>=1e3)throw new Error("drbg: tried 1000 values");let W=0;const J=[];for(;W<w;){G=M();const Q=G.slice();J.push(Q),W+=G.length}return P(...J)};return(W,J)=>{te(),I(W);let Q;for(;!(Q=J(F()));)I();return te(),Q}}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"||i(o),isSafeInteger:o=>Number.isSafeInteger(o),array:o=>Array.isArray(o),field:(o,w)=>w.Fp.isValid(o),hash:o=>typeof o=="function"&&Number.isSafeInteger(o.outputLen)};function B(o,w,C={}){const G=(x,K,te)=>{const M=b[K];if(typeof M!="function")throw new Error("invalid validator function");const I=o[x];if(!(te&&I===void 0)&&!M(I,o))throw new Error("param "+String(x)+" is invalid. Expected "+K+", got "+I)};for(const[x,K]of Object.entries(w))G(x,K,!1);for(const[x,K]of Object.entries(C))G(x,K,!0);return o}const T=()=>{throw new Error("not implemented")};ae.notImplemented=T;function L(o){const w=new WeakMap;return(C,...G)=>{const x=w.get(C);if(x!==void 0)return x;const K=o(C,...G);return w.set(C,K),K}}return ae}var Ts;function Me(){if(Ts)return ue;Ts=1,Object.defineProperty(ue,"__esModule",{value:!0}),ue.isNegativeLE=void 0,ue.mod=d,ue.pow=m,ue.pow2=p,ue.invert=g,ue.tonelliShanks=l,ue.FpSqrt=S,ue.validateField=v,ue.FpPow=_,ue.FpInvertBatch=R,ue.FpDiv=P,ue.FpLegendre=f,ue.FpIsSquare=y,ue.nLength=c,ue.Field=q,ue.FpSqrtOdd=D,ue.FpSqrtEven=$,ue.hashToPrivateScalar=H,ue.getFieldBytesLength=E,ue.getMinHashLength=O,ue.mapHashToField=j;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=Ae(),n=BigInt(0),a=BigInt(1),i=BigInt(2),h=BigInt(3),r=BigInt(4),t=BigInt(5),s=BigInt(8);function d(u,N){const b=u%N;return b>=n?b:N+b}function m(u,N,b){if(N<n)throw new Error("invalid exponent, negatives unsupported");if(b<=n)throw new Error("invalid modulus");if(b===a)return n;let B=a;for(;N>n;)N&a&&(B=B*u%b),u=u*u%b,N>>=a;return B}function p(u,N,b){let B=u;for(;N-- >n;)B*=B,B%=b;return B}function g(u,N){if(u===n)throw new Error("invert: expected non-zero number");if(N<=n)throw new Error("invert: expected positive modulus, got "+N);let b=d(u,N),B=N,T=n,L=a;for(;b!==n;){const w=B/b,C=B%b,G=T-L*w;B=b,b=C,T=L,L=G}if(B!==a)throw new Error("invert: does not exist");return d(T,N)}function l(u){const N=(u-a)/i;let b,B,T;for(b=u-a,B=0;b%i===n;b/=i,B++);for(T=i;T<u&&m(T,N,u)!==u-a;T++)if(T>1e3)throw new Error("Cannot find square root: likely non-prime P");if(B===1){const o=(u+a)/r;return function(C,G){const x=C.pow(G,o);if(!C.eql(C.sqr(x),G))throw new Error("Cannot find square root");return x}}const L=(b+a)/i;return function(w,C){if(w.pow(C,N)===w.neg(w.ONE))throw new Error("Cannot find square root");let G=B,x=w.pow(w.mul(w.ONE,T),b),K=w.pow(C,L),te=w.pow(C,b);for(;!w.eql(te,w.ONE);){if(w.eql(te,w.ZERO))return w.ZERO;let M=1;for(let F=w.sqr(te);M<G&&!w.eql(F,w.ONE);M++)F=w.sqr(F);const I=w.pow(x,a<<BigInt(G-M-1));x=w.sqr(I),K=w.mul(K,I),te=w.mul(te,x),G=M}return K}}function S(u){if(u%r===h){const N=(u+a)/r;return function(B,T){const L=B.pow(T,N);if(!B.eql(B.sqr(L),T))throw new Error("Cannot find square root");return L}}if(u%s===t){const N=(u-t)/s;return function(B,T){const L=B.mul(T,i),o=B.pow(L,N),w=B.mul(T,o),C=B.mul(B.mul(w,i),o),G=B.mul(w,B.sub(C,B.ONE));if(!B.eql(B.sqr(G),T))throw new Error("Cannot find square root");return G}}return l(u)}const A=(u,N)=>(d(u,N)&a)===a;ue.isNegativeLE=A;const k=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function v(u){const N={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},b=k.reduce((B,T)=>(B[T]="function",B),N);return(0,e.validateObject)(u,b)}function _(u,N,b){if(b<n)throw new Error("invalid exponent, negatives unsupported");if(b===n)return u.ONE;if(b===a)return N;let B=u.ONE,T=N;for(;b>n;)b&a&&(B=u.mul(B,T)),T=u.sqr(T),b>>=a;return B}function R(u,N){const b=new Array(N.length),B=N.reduce((L,o,w)=>u.is0(o)?L:(b[w]=L,u.mul(L,o)),u.ONE),T=u.inv(B);return N.reduceRight((L,o,w)=>u.is0(o)?L:(b[w]=u.mul(L,b[w]),u.mul(L,o)),T),b}function P(u,N,b){return u.mul(N,typeof b=="bigint"?g(b,u.ORDER):u.inv(b))}function f(u){const N=(u-a)/i;return(b,B)=>b.pow(B,N)}function y(u){const N=f(u.ORDER);return b=>{const B=N(u,b);return u.eql(B,u.ZERO)||u.eql(B,u.ONE)}}function c(u,N){const b=N!==void 0?N:u.toString(2).length,B=Math.ceil(b/8);return{nBitLength:b,nByteLength:B}}function q(u,N,b=!1,B={}){if(u<=n)throw new Error("invalid field: expected ORDER > 0, got "+u);const{nBitLength:T,nByteLength:L}=c(u,N);if(L>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const w=Object.freeze({ORDER:u,isLE:b,BITS:T,BYTES:L,MASK:(0,e.bitMask)(T),ZERO:n,ONE:a,create:C=>d(C,u),isValid:C=>{if(typeof C!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof C);return n<=C&&C<u},is0:C=>C===n,isOdd:C=>(C&a)===a,neg:C=>d(-C,u),eql:(C,G)=>C===G,sqr:C=>d(C*C,u),add:(C,G)=>d(C+G,u),sub:(C,G)=>d(C-G,u),mul:(C,G)=>d(C*G,u),pow:(C,G)=>_(w,C,G),div:(C,G)=>d(C*g(G,u),u),sqrN:C=>C*C,addN:(C,G)=>C+G,subN:(C,G)=>C-G,mulN:(C,G)=>C*G,inv:C=>g(C,u),sqrt:B.sqrt||(C=>(o||(o=S(u)),o(w,C))),invertBatch:C=>R(w,C),cmov:(C,G,x)=>x?G:C,toBytes:C=>b?(0,e.numberToBytesLE)(C,L):(0,e.numberToBytesBE)(C,L),fromBytes:C=>{if(C.length!==L)throw new Error("Field.fromBytes: expected "+L+" bytes, got "+C.length);return b?(0,e.bytesToNumberLE)(C):(0,e.bytesToNumberBE)(C)}});return Object.freeze(w)}function D(u,N){if(!u.isOdd)throw new Error("Field doesn't have isOdd");const b=u.sqrt(N);return u.isOdd(b)?b:u.neg(b)}function $(u,N){if(!u.isOdd)throw new Error("Field doesn't have isOdd");const b=u.sqrt(N);return u.isOdd(b)?u.neg(b):b}function H(u,N,b=!1){u=(0,e.ensureBytes)("privateHash",u);const B=u.length,T=c(N).nByteLength+8;if(T<24||B<T||B>1024)throw new Error("hashToPrivateScalar: expected "+T+"-1024 bytes of input, got "+B);const L=b?(0,e.bytesToNumberLE)(u):(0,e.bytesToNumberBE)(u);return d(L,N-a)+a}function E(u){if(typeof u!="bigint")throw new Error("field order must be bigint");const N=u.toString(2).length;return Math.ceil(N/8)}function O(u){const N=E(u);return N+Math.ceil(N/2)}function j(u,N,b=!1){const B=u.length,T=E(N),L=O(N);if(B<16||B<L||B>1024)throw new Error("expected "+L+"-1024 bytes of input, got "+B);const o=b?(0,e.bytesToNumberLE)(u):(0,e.bytesToNumberBE)(u),w=d(o,N-a)+a;return b?(0,e.numberToBytesLE)(w,T):(0,e.numberToBytesBE)(w,T)}return ue}var Ns;function Gt(){if(Ns)return Fe;Ns=1,Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.wNAF=l,Fe.pippenger=S,Fe.precomputeMSMUnsafe=A,Fe.validateBasic=k;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=Me(),n=Ae(),a=BigInt(0),i=BigInt(1);function h(v,_){const R=_.negate();return v?R:_}function r(v,_){if(!Number.isSafeInteger(v)||v<=0||v>_)throw new Error("invalid window size, expected [1.."+_+"], got W="+v)}function t(v,_){r(v,_);const R=Math.ceil(_/v)+1,P=2**(v-1);return{windows:R,windowSize:P}}function s(v,_){if(!Array.isArray(v))throw new Error("array expected");v.forEach((R,P)=>{if(!(R instanceof _))throw new Error("invalid point at index "+P)})}function d(v,_){if(!Array.isArray(v))throw new Error("array of scalars expected");v.forEach((R,P)=>{if(!_.isValid(R))throw new Error("invalid scalar at index "+P)})}const m=new WeakMap,p=new WeakMap;function g(v){return p.get(v)||1}function l(v,_){return{constTimeNegate:h,hasPrecomputes(R){return g(R)!==1},unsafeLadder(R,P,f=v.ZERO){let y=R;for(;P>a;)P&i&&(f=f.add(y)),y=y.double(),P>>=i;return f},precomputeWindow(R,P){const{windows:f,windowSize:y}=t(P,_),c=[];let q=R,D=q;for(let $=0;$<f;$++){D=q,c.push(D);for(let H=1;H<y;H++)D=D.add(q),c.push(D);q=D.double()}return c},wNAF(R,P,f){const{windows:y,windowSize:c}=t(R,_);let q=v.ZERO,D=v.BASE;const $=BigInt(2**R-1),H=2**R,E=BigInt(R);for(let O=0;O<y;O++){const j=O*c;let u=Number(f&$);f>>=E,u>c&&(u-=H,f+=i);const N=j,b=j+Math.abs(u)-1,B=O%2!==0,T=u<0;u===0?D=D.add(h(B,P[N])):q=q.add(h(T,P[b]))}return{p:q,f:D}},wNAFUnsafe(R,P,f,y=v.ZERO){const{windows:c,windowSize:q}=t(R,_),D=BigInt(2**R-1),$=2**R,H=BigInt(R);for(let E=0;E<c;E++){const O=E*q;if(f===a)break;let j=Number(f&D);if(f>>=H,j>q&&(j-=$,f+=i),j===0)continue;let u=P[O+Math.abs(j)-1];j<0&&(u=u.negate()),y=y.add(u)}return y},getPrecomputes(R,P,f){let y=m.get(P);return y||(y=this.precomputeWindow(P,R),R!==1&&m.set(P,f(y))),y},wNAFCached(R,P,f){const y=g(R);return this.wNAF(y,this.getPrecomputes(y,R,f),P)},wNAFCachedUnsafe(R,P,f,y){const c=g(R);return c===1?this.unsafeLadder(R,P,y):this.wNAFUnsafe(c,this.getPrecomputes(c,R,f),P,y)},setWindowSize(R,P){r(P,_),p.set(R,P),m.delete(R)}}}function S(v,_,R,P){if(s(R,v),d(P,_),R.length!==P.length)throw new Error("arrays of points and scalars must have equal length");const f=v.ZERO,y=(0,n.bitLen)(BigInt(R.length)),c=y>12?y-3:y>4?y-2:y?2:1,q=(1<<c)-1,D=new Array(q+1).fill(f),$=Math.floor((_.BITS-1)/c)*c;let H=f;for(let E=$;E>=0;E-=c){D.fill(f);for(let j=0;j<P.length;j++){const u=P[j],N=Number(u>>BigInt(E)&BigInt(q));D[N]=D[N].add(R[j])}let O=f;for(let j=D.length-1,u=f;j>0;j--)u=u.add(D[j]),O=O.add(u);if(H=H.add(O),E!==0)for(let j=0;j<c;j++)H=H.double()}return H}function A(v,_,R,P){r(P,_.BITS),s(R,v);const f=v.ZERO,y=2**P-1,c=Math.ceil(_.BITS/P),q=BigInt((1<<P)-1),D=R.map($=>{const H=[];for(let E=0,O=$;E<y;E++)H.push(O),O=O.add($);return H});return $=>{if(d($,_),$.length>R.length)throw new Error("array of scalars must be smaller than array of points");let H=f;for(let E=0;E<c;E++){if(H!==f)for(let j=0;j<P;j++)H=H.double();const O=BigInt(c*P-(E+1)*P);for(let j=0;j<$.length;j++){const u=$[j],N=Number(u>>O&q);N&&(H=H.add(D[j][N-1]))}}return H}}function k(v){return(0,e.validateField)(v.Fp),(0,n.validateObject)(v,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,e.nLength)(v.n,v.nBitLength),...v,p:v.Fp.ORDER})}return Fe}var Et={},Ls;function uc(){if(Ls)return Et;Ls=1,Object.defineProperty(Et,"__esModule",{value:!0}),Et.twistedEdwards=p;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=Gt(),n=Me(),a=Ae(),i=Ae(),h=BigInt(0),r=BigInt(1),t=BigInt(2),s=BigInt(8),d={zip215:!0};function m(g){const l=(0,e.validateBasic)(g);return a.validateObject(g,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...l})}function p(g){const l=m(g),{Fp:S,n:A,prehash:k,hash:v,randomBytes:_,nByteLength:R,h:P}=l,f=t<<BigInt(R*8)-r,y=S.create,c=(0,n.Field)(l.n,l.nBitLength),q=l.uvRatio||((M,I)=>{try{return{isValid:!0,value:S.sqrt(M*S.inv(I))}}catch{return{isValid:!1,value:h}}}),D=l.adjustScalarBytes||(M=>M),$=l.domain||((M,I,F)=>{if((0,i.abool)("phflag",F),I.length||F)throw new Error("Contexts/pre-hash are not supported");return M});function H(M,I){a.aInRange("coordinate "+M,I,h,f)}function E(M){if(!(M instanceof u))throw new Error("ExtendedPoint expected")}const O=(0,i.memoized)((M,I)=>{const{ex:F,ey:Z,ez:W}=M,J=M.is0();I==null&&(I=J?s:S.inv(W));const Q=y(F*I),V=y(Z*I),U=y(W*I);if(J)return{x:h,y:r};if(U!==r)throw new Error("invZ was invalid");return{x:Q,y:V}}),j=(0,i.memoized)(M=>{const{a:I,d:F}=l;if(M.is0())throw new Error("bad point: ZERO");const{ex:Z,ey:W,ez:J,et:Q}=M,V=y(Z*Z),U=y(W*W),z=y(J*J),ee=y(z*z),Y=y(V*I),re=y(z*y(Y+U)),X=y(ee+y(F*y(V*U)));if(re!==X)throw new Error("bad point: equation left != right (1)");const ne=y(Z*W),se=y(J*Q);if(ne!==se)throw new Error("bad point: equation left != right (2)");return!0});class u{constructor(I,F,Z,W){this.ex=I,this.ey=F,this.ez=Z,this.et=W,H("x",I),H("y",F),H("z",Z),H("t",W),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(I){if(I instanceof u)throw new Error("extended point not allowed");const{x:F,y:Z}=I||{};return H("x",F),H("y",Z),new u(F,Z,r,y(F*Z))}static normalizeZ(I){const F=S.invertBatch(I.map(Z=>Z.ez));return I.map((Z,W)=>Z.toAffine(F[W])).map(u.fromAffine)}static msm(I,F){return(0,e.pippenger)(u,c,I,F)}_setWindowSize(I){B.setWindowSize(this,I)}assertValidity(){j(this)}equals(I){E(I);const{ex:F,ey:Z,ez:W}=this,{ex:J,ey:Q,ez:V}=I,U=y(F*V),z=y(J*W),ee=y(Z*V),Y=y(Q*W);return U===z&&ee===Y}is0(){return this.equals(u.ZERO)}negate(){return new u(y(-this.ex),this.ey,this.ez,y(-this.et))}double(){const{a:I}=l,{ex:F,ey:Z,ez:W}=this,J=y(F*F),Q=y(Z*Z),V=y(t*y(W*W)),U=y(I*J),z=F+Z,ee=y(y(z*z)-J-Q),Y=U+Q,re=Y-V,X=U-Q,ne=y(ee*re),se=y(Y*X),oe=y(ee*X),ie=y(re*Y);return new u(ne,se,ie,oe)}add(I){E(I);const{a:F,d:Z}=l,{ex:W,ey:J,ez:Q,et:V}=this,{ex:U,ey:z,ez:ee,et:Y}=I;if(F===BigInt(-1)){const Ee=y((J-W)*(z+U)),_e=y((J+W)*(z-U)),Se=y(_e-Ee);if(Se===h)return this.double();const Re=y(Q*t*Y),Xe=y(V*t*ee),Gn=Xe+Re,Yn=_e+Ee,Wn=Xe-Re,hi=y(Gn*Se),pi=y(Yn*Wn),yi=y(Gn*Wn),vi=y(Se*Yn);return new u(hi,pi,vi,yi)}const re=y(W*U),X=y(J*z),ne=y(V*Z*Y),se=y(Q*ee),oe=y((W+J)*(U+z)-re-X),ie=se-ne,fe=se+ne,le=y(X-F*re),ve=y(oe*ie),ye=y(fe*le),be=y(oe*le),ge=y(ie*fe);return new u(ve,ye,ge,be)}subtract(I){return this.add(I.negate())}wNAF(I){return B.wNAFCached(this,I,u.normalizeZ)}multiply(I){const F=I;a.aInRange("scalar",F,r,A);const{p:Z,f:W}=this.wNAF(F);return u.normalizeZ([Z,W])[0]}multiplyUnsafe(I,F=u.ZERO){const Z=I;return a.aInRange("scalar",Z,h,A),Z===h?b:this.is0()||Z===r?this:B.wNAFCachedUnsafe(this,Z,u.normalizeZ,F)}isSmallOrder(){return this.multiplyUnsafe(P).is0()}isTorsionFree(){return B.unsafeLadder(this,A).is0()}toAffine(I){return O(this,I)}clearCofactor(){const{h:I}=l;return I===r?this:this.multiplyUnsafe(I)}static fromHex(I,F=!1){const{d:Z,a:W}=l,J=S.BYTES;I=(0,i.ensureBytes)("pointHex",I,J),(0,i.abool)("zip215",F);const Q=I.slice(),V=I[J-1];Q[J-1]=V&-129;const U=a.bytesToNumberLE(Q),z=F?f:S.ORDER;a.aInRange("pointHex.y",U,h,z);const ee=y(U*U),Y=y(ee-r),re=y(Z*ee-W);let{isValid:X,value:ne}=q(Y,re);if(!X)throw new Error("Point.fromHex: invalid y coordinate");const se=(ne&r)===r,oe=(V&128)!==0;if(!F&&ne===h&&oe)throw new Error("Point.fromHex: x=0 and x_0=1");return oe!==se&&(ne=y(-ne)),u.fromAffine({x:ne,y:U})}static fromPrivateKey(I){return o(I).point}toRawBytes(){const{x:I,y:F}=this.toAffine(),Z=a.numberToBytesLE(F,S.BYTES);return Z[Z.length-1]|=I&r?128:0,Z}toHex(){return a.bytesToHex(this.toRawBytes())}}u.BASE=new u(l.Gx,l.Gy,r,y(l.Gx*l.Gy)),u.ZERO=new u(h,r,r,h);const{BASE:N,ZERO:b}=u,B=(0,e.wNAF)(u,R*8);function T(M){return(0,n.mod)(M,A)}function L(M){return T(a.bytesToNumberLE(M))}function o(M){const I=S.BYTES;M=(0,i.ensureBytes)("private key",M,I);const F=(0,i.ensureBytes)("hashed private key",v(M),2*I),Z=D(F.slice(0,I)),W=F.slice(I,2*I),J=L(Z),Q=N.multiply(J),V=Q.toRawBytes();return{head:Z,prefix:W,scalar:J,point:Q,pointBytes:V}}function w(M){return o(M).pointBytes}function C(M=new Uint8Array,...I){const F=a.concatBytes(...I);return L(v($(F,(0,i.ensureBytes)("context",M),!!k)))}function G(M,I,F={}){M=(0,i.ensureBytes)("message",M),k&&(M=k(M));const{prefix:Z,scalar:W,pointBytes:J}=o(I),Q=C(F.context,Z,M),V=N.multiply(Q).toRawBytes(),U=C(F.context,V,J,M),z=T(Q+U*W);a.aInRange("signature.s",z,h,A);const ee=a.concatBytes(V,a.numberToBytesLE(z,S.BYTES));return(0,i.ensureBytes)("result",ee,S.BYTES*2)}const x=d;function K(M,I,F,Z=x){const{context:W,zip215:J}=Z,Q=S.BYTES;M=(0,i.ensureBytes)("signature",M,2*Q),I=(0,i.ensureBytes)("message",I),F=(0,i.ensureBytes)("publicKey",F,Q),J!==void 0&&(0,i.abool)("zip215",J),k&&(I=k(I));const V=a.bytesToNumberLE(M.slice(Q,2*Q));let U,z,ee;try{U=u.fromHex(F,J),z=u.fromHex(M.slice(0,Q),J),ee=N.multiplyUnsafe(V)}catch{return!1}if(!J&&U.isSmallOrder())return!1;const Y=C(W,z.toRawBytes(),U.toRawBytes(),I);return z.add(U.multiplyUnsafe(Y)).subtract(ee).clearCofactor().equals(u.ZERO)}return N._setWindowSize(8),{CURVE:l,getPublicKey:w,sign:G,verify:K,ExtendedPoint:u,utils:{getExtendedPublicKey:o,randomPrivateKey:()=>_(S.BYTES),precompute(M=8,I=u.BASE){return I._setWindowSize(M),I.multiply(BigInt(3)),I}}}}return Et}var De={},$s;function Ds(){if($s)return De;$s=1,Object.defineProperty(De,"__esModule",{value:!0}),De.expand_message_xmd=t,De.expand_message_xof=s,De.hash_to_field=d,De.isogenyMap=m,De.createHasher=p;const e=Me(),n=Ae(),a=n.bytesToNumberBE;function i(g,l){if(r(g),r(l),g<0||g>=1<<8*l)throw new Error("invalid I2OSP input: "+g);const S=Array.from({length:l}).fill(0);for(let A=l-1;A>=0;A--)S[A]=g&255,g>>>=8;return new Uint8Array(S)}function h(g,l){const S=new Uint8Array(g.length);for(let A=0;A<g.length;A++)S[A]=g[A]^l[A];return S}function r(g){if(!Number.isSafeInteger(g))throw new Error("number expected")}function t(g,l,S,A){(0,n.abytes)(g),(0,n.abytes)(l),r(S),l.length>255&&(l=A((0,n.concatBytes)((0,n.utf8ToBytes)("H2C-OVERSIZE-DST-"),l)));const{outputLen:k,blockLen:v}=A,_=Math.ceil(S/k);if(S>65535||_>255)throw new Error("expand_message_xmd: invalid lenInBytes");const R=(0,n.concatBytes)(l,i(l.length,1)),P=i(0,v),f=i(S,2),y=new Array(_),c=A((0,n.concatBytes)(P,g,f,i(0,1),R));y[0]=A((0,n.concatBytes)(c,i(1,1),R));for(let D=1;D<=_;D++){const $=[h(c,y[D-1]),i(D+1,1),R];y[D]=A((0,n.concatBytes)(...$))}return(0,n.concatBytes)(...y).slice(0,S)}function s(g,l,S,A,k){if((0,n.abytes)(g),(0,n.abytes)(l),r(S),l.length>255){const v=Math.ceil(2*A/8);l=k.create({dkLen:v}).update((0,n.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(l).digest()}if(S>65535||l.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return k.create({dkLen:S}).update(g).update(i(S,2)).update(l).update(i(l.length,1)).digest()}function d(g,l,S){(0,n.validateObject)(S,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:A,k,m:v,hash:_,expand:R,DST:P}=S;(0,n.abytes)(g),r(l);const f=typeof P=="string"?(0,n.utf8ToBytes)(P):P,y=A.toString(2).length,c=Math.ceil((y+k)/8),q=l*v*c;let D;if(R==="xmd")D=t(g,f,q,_);else if(R==="xof")D=s(g,f,q,k,_);else if(R==="_internal_pass")D=g;else throw new Error('expand must be "xmd" or "xof"');const $=new Array(l);for(let H=0;H<l;H++){const E=new Array(v);for(let O=0;O<v;O++){const j=c*(O+H*v),u=D.subarray(j,j+c);E[O]=(0,e.mod)(a(u),A)}$[H]=E}return $}function m(g,l){const S=l.map(A=>Array.from(A).reverse());return(A,k)=>{const[v,_,R,P]=S.map(f=>f.reduce((y,c)=>g.add(g.mul(y,A),c)));return A=g.div(v,_),k=g.mul(k,g.div(R,P)),{x:A,y:k}}}function p(g,l,S){if(typeof l!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(A,k){const v=d(A,2,{...S,DST:S.DST,...k}),_=g.fromAffine(l(v[0])),R=g.fromAffine(l(v[1])),P=_.add(R).clearCofactor();return P.assertValidity(),P},encodeToCurve(A,k){const v=d(A,1,{...S,DST:S.encodeDST,...k}),_=g.fromAffine(l(v[0])).clearCofactor();return _.assertValidity(),_},mapToCurve(A){if(!Array.isArray(A))throw new Error("mapToCurve: expected array of bigints");for(const v of A)if(typeof v!="bigint")throw new Error("mapToCurve: expected array of bigints");const k=g.fromAffine(l(A)).clearCofactor();return k.assertValidity(),k}}}return De}var _t={},Ks;function lc(){if(Ks)return _t;Ks=1,Object.defineProperty(_t,"__esModule",{value:!0}),_t.montgomery=r;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=Me(),n=Ae(),a=BigInt(0),i=BigInt(1);function h(t){return(0,n.validateObject)(t,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...t})}function r(t){const s=h(t),{P:d}=s,m=D=>(0,e.mod)(D,d),p=s.montgomeryBits,g=Math.ceil(p/8),l=s.nByteLength,S=s.adjustScalarBytes||(D=>D),A=s.powPminus2||(D=>(0,e.pow)(D,d-BigInt(2),d));function k(D,$,H){const E=m(D*($-H));return $=m($-E),H=m(H+E),[$,H]}const v=(s.a-BigInt(2))/BigInt(4);function _(D,$){(0,n.aInRange)("u",D,a,d),(0,n.aInRange)("scalar",$,a,d);const H=$,E=D;let O=i,j=a,u=D,N=i,b=a,B;for(let L=BigInt(p-1);L>=a;L--){const o=H>>L&i;b^=o,B=k(b,O,u),O=B[0],u=B[1],B=k(b,j,N),j=B[0],N=B[1],b=o;const w=O+j,C=m(w*w),G=O-j,x=m(G*G),K=C-x,te=u+N,M=u-N,I=m(M*w),F=m(te*G),Z=I+F,W=I-F;u=m(Z*Z),N=m(E*m(W*W)),O=m(C*x),j=m(K*(C+m(v*K)))}B=k(b,O,u),O=B[0],u=B[1],B=k(b,j,N),j=B[0],N=B[1];const T=A(j);return m(O*T)}function R(D){return(0,n.numberToBytesLE)(m(D),g)}function P(D){const $=(0,n.ensureBytes)("u coordinate",D,g);return l===32&&($[31]&=127),(0,n.bytesToNumberLE)($)}function f(D){const $=(0,n.ensureBytes)("scalar",D),H=$.length;if(H!==g&&H!==l){let E=""+g+" or "+l;throw new Error("invalid scalar, expected "+E+" bytes, got "+H)}return(0,n.bytesToNumberLE)(S($))}function y(D,$){const H=P($),E=f(D),O=_(H,E);if(O===a)throw new Error("invalid private or public key received");return R(O)}const c=R(s.Gu);function q(D){return y(D,c)}return{scalarMult:y,scalarMultBase:q,getSharedSecret:(D,$)=>y(D,$),getPublicKey:D=>q(D),utils:{randomPrivateKey:()=>s.randomBytes(s.nByteLength)},GuBytes:c}}return _t}var qs;function fc(){return qs||(qs=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hash_to_ristretto255=e.hashToRistretto255=e.RistrettoPoint=e.encodeToCurve=e.hashToCurve=e.edwardsToMontgomery=e.x25519=e.ed25519ph=e.ed25519ctx=e.ed25519=e.ED25519_TORSION_SUBGROUP=void 0,e.edwardsToMontgomeryPub=q,e.edwardsToMontgomeryPriv=D;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const n=ac(),a=$e(),i=Gt(),h=uc(),r=Ds(),t=Me(),s=lc(),d=Ae(),m=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),p=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),g=BigInt(0),l=BigInt(1),S=BigInt(2),A=BigInt(3),k=BigInt(5),v=BigInt(8);function _(I){const F=BigInt(10),Z=BigInt(20),W=BigInt(40),J=BigInt(80),Q=m,U=I*I%Q*I%Q,z=(0,t.pow2)(U,S,Q)*U%Q,ee=(0,t.pow2)(z,l,Q)*I%Q,Y=(0,t.pow2)(ee,k,Q)*ee%Q,re=(0,t.pow2)(Y,F,Q)*Y%Q,X=(0,t.pow2)(re,Z,Q)*re%Q,ne=(0,t.pow2)(X,W,Q)*X%Q,se=(0,t.pow2)(ne,J,Q)*ne%Q,oe=(0,t.pow2)(se,J,Q)*ne%Q,ie=(0,t.pow2)(oe,F,Q)*Y%Q;return{pow_p_5_8:(0,t.pow2)(ie,S,Q)*I%Q,b2:U}}function R(I){return I[0]&=248,I[31]&=127,I[31]|=64,I}function P(I,F){const Z=m,W=(0,t.mod)(F*F*F,Z),J=(0,t.mod)(W*W*F,Z),Q=_(I*J).pow_p_5_8;let V=(0,t.mod)(I*W*Q,Z);const U=(0,t.mod)(F*V*V,Z),z=V,ee=(0,t.mod)(V*p,Z),Y=U===I,re=U===(0,t.mod)(-I,Z),X=U===(0,t.mod)(-I*p,Z);return Y&&(V=z),(re||X)&&(V=ee),(0,t.isNegativeLE)(V,Z)&&(V=(0,t.mod)(-V,Z)),{isValid:Y||re,value:V}}e.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];const f=(0,t.Field)(m,void 0,!0),y={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:f,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:v,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:n.sha512,randomBytes:a.randomBytes,adjustScalarBytes:R,uvRatio:P};e.ed25519=(0,h.twistedEdwards)(y);function c(I,F,Z){if(F.length>255)throw new Error("Context is too big");return(0,a.concatBytes)((0,a.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([Z?1:0,F.length]),F,I)}e.ed25519ctx=(0,h.twistedEdwards)({...y,domain:c}),e.ed25519ph=(0,h.twistedEdwards)(Object.assign({},y,{domain:c,prehash:n.sha512})),e.x25519=(0,s.montgomery)({P:m,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:I=>{const F=m,{pow_p_5_8:Z,b2:W}=_(I);return(0,t.mod)((0,t.pow2)(Z,A,F)*W,F)},adjustScalarBytes:R,randomBytes:a.randomBytes});function q(I){const{y:F}=e.ed25519.ExtendedPoint.fromHex(I),Z=BigInt(1);return f.toBytes(f.create((Z+F)*f.inv(Z-F)))}e.edwardsToMontgomery=q;function D(I){const F=y.hash(I.subarray(0,32));return y.adjustScalarBytes(F).subarray(0,32)}const $=(f.ORDER+A)/v,H=f.pow(S,$),E=f.sqrt(f.neg(f.ONE));function O(I){const F=(f.ORDER-k)/v,Z=BigInt(486662);let W=f.sqr(I);W=f.mul(W,S);let J=f.add(W,f.ONE),Q=f.neg(Z),V=f.sqr(J),U=f.mul(V,J),z=f.mul(W,Z);z=f.mul(z,Q),z=f.add(z,V),z=f.mul(z,Q);let ee=f.sqr(U);V=f.sqr(ee),ee=f.mul(ee,U),ee=f.mul(ee,z),V=f.mul(V,ee);let Y=f.pow(V,F);Y=f.mul(Y,ee);let re=f.mul(Y,E);V=f.sqr(Y),V=f.mul(V,U);let X=f.eql(V,z),ne=f.cmov(re,Y,X),se=f.mul(Q,W),oe=f.mul(Y,I);oe=f.mul(oe,H);let ie=f.mul(oe,E),fe=f.mul(z,W);V=f.sqr(oe),V=f.mul(V,U);let le=f.eql(V,fe),ve=f.cmov(ie,oe,le);V=f.sqr(ne),V=f.mul(V,U);let ye=f.eql(V,z),be=f.cmov(se,Q,ye),ge=f.cmov(ve,ne,ye),Ee=f.isOdd(ge);return ge=f.cmov(ge,f.neg(ge),ye!==Ee),{xMn:be,xMd:J,yMn:ge,yMd:l}}const j=(0,t.FpSqrtEven)(f,f.neg(BigInt(486664)));function u(I){const{xMn:F,xMd:Z,yMn:W,yMd:J}=O(I);let Q=f.mul(F,J);Q=f.mul(Q,j);let V=f.mul(Z,W),U=f.sub(F,Z),z=f.add(F,Z),ee=f.mul(V,z),Y=f.eql(ee,f.ZERO);Q=f.cmov(Q,f.ZERO,Y),V=f.cmov(V,f.ONE,Y),U=f.cmov(U,f.ONE,Y),z=f.cmov(z,f.ONE,Y);const re=f.invertBatch([V,z]);return{x:f.mul(Q,re[0]),y:f.mul(U,re[1])}}const N=(0,r.createHasher)(e.ed25519.ExtendedPoint,I=>u(I[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:f.ORDER,m:1,k:128,expand:"xmd",hash:n.sha512});e.hashToCurve=N.hashToCurve,e.encodeToCurve=N.encodeToCurve;function b(I){if(!(I instanceof te))throw new Error("RistrettoPoint expected")}const B=p,T=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),L=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),o=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),w=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),C=I=>P(l,I),G=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),x=I=>e.ed25519.CURVE.Fp.create((0,d.bytesToNumberLE)(I)&G);function K(I){const{d:F}=e.ed25519.CURVE,Z=e.ed25519.CURVE.Fp.ORDER,W=e.ed25519.CURVE.Fp.create,J=W(B*I*I),Q=W((J+l)*o);let V=BigInt(-1);const U=W((V-F*J)*W(J+F));let{isValid:z,value:ee}=P(Q,U),Y=W(ee*I);(0,t.isNegativeLE)(Y,Z)||(Y=W(-Y)),z||(ee=Y),z||(V=J);const re=W(V*(J-l)*w-U),X=ee*ee,ne=W((ee+ee)*U),se=W(re*T),oe=W(l-X),ie=W(l+X);return new e.ed25519.ExtendedPoint(W(ne*ie),W(oe*se),W(se*ie),W(ne*oe))}class te{constructor(F){this.ep=F}static fromAffine(F){return new te(e.ed25519.ExtendedPoint.fromAffine(F))}static hashToCurve(F){F=(0,d.ensureBytes)("ristrettoHash",F,64);const Z=x(F.slice(0,32)),W=K(Z),J=x(F.slice(32,64)),Q=K(J);return new te(W.add(Q))}static fromHex(F){F=(0,d.ensureBytes)("ristrettoHex",F,32);const{a:Z,d:W}=e.ed25519.CURVE,J=e.ed25519.CURVE.Fp.ORDER,Q=e.ed25519.CURVE.Fp.create,V="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",U=x(F);if(!(0,d.equalBytes)((0,d.numberToBytesLE)(U,32),F)||(0,t.isNegativeLE)(U,J))throw new Error(V);const z=Q(U*U),ee=Q(l+Z*z),Y=Q(l-Z*z),re=Q(ee*ee),X=Q(Y*Y),ne=Q(Z*W*re-X),{isValid:se,value:oe}=C(Q(ne*X)),ie=Q(oe*Y),fe=Q(oe*ie*ne);let le=Q((U+U)*ie);(0,t.isNegativeLE)(le,J)&&(le=Q(-le));const ve=Q(ee*fe),ye=Q(le*ve);if(!se||(0,t.isNegativeLE)(ye,J)||ve===g)throw new Error(V);return new te(new e.ed25519.ExtendedPoint(le,ve,l,ye))}static msm(F,Z){const W=(0,t.Field)(e.ed25519.CURVE.n,e.ed25519.CURVE.nBitLength);return(0,i.pippenger)(te,W,F,Z)}toRawBytes(){let{ex:F,ey:Z,ez:W,et:J}=this.ep;const Q=e.ed25519.CURVE.Fp.ORDER,V=e.ed25519.CURVE.Fp.create,U=V(V(W+Z)*V(W-Z)),z=V(F*Z),ee=V(z*z),{value:Y}=C(V(U*ee)),re=V(Y*U),X=V(Y*z),ne=V(re*X*J);let se;if((0,t.isNegativeLE)(J*ne,Q)){let ie=V(Z*B),fe=V(F*B);F=ie,Z=fe,se=V(re*L)}else se=X;(0,t.isNegativeLE)(F*ne,Q)&&(Z=V(-Z));let oe=V((W-Z)*se);return(0,t.isNegativeLE)(oe,Q)&&(oe=V(-oe)),(0,d.numberToBytesLE)(oe,32)}toHex(){return(0,d.bytesToHex)(this.toRawBytes())}toString(){return this.toHex()}equals(F){b(F);const{ex:Z,ey:W}=this.ep,{ex:J,ey:Q}=F.ep,V=e.ed25519.CURVE.Fp.create,U=V(Z*Q)===V(W*J),z=V(W*Q)===V(Z*J);return U||z}add(F){return b(F),new te(this.ep.add(F.ep))}subtract(F){return b(F),new te(this.ep.subtract(F.ep))}multiply(F){return new te(this.ep.multiply(F))}multiplyUnsafe(F){return new te(this.ep.multiplyUnsafe(F))}double(){return new te(this.ep.double())}negate(){return new te(this.ep.negate())}}e.RistrettoPoint=(te.BASE||(te.BASE=new te(e.ed25519.ExtendedPoint.BASE)),te.ZERO||(te.ZERO=new te(e.ed25519.ExtendedPoint.ZERO)),te);const M=(I,F)=>{const Z=F.DST,W=typeof Z=="string"?(0,a.utf8ToBytes)(Z):Z,J=(0,r.expand_message_xmd)(I,W,64,n.sha512);return te.hashToCurve(J)};e.hashToRistretto255=M,e.hash_to_ristretto255=e.hashToRistretto255}(Vt)),Vt}var Yt={},Pe={},Hs;function ks(){if(Hs)return Pe;Hs=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.sha224=Pe.sha256=Pe.SHA256=void 0;const e=Os(),n=$e(),a=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),i=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),h=new Uint32Array(64);class r extends e.HashMD{constructor(){super(64,32,8,!1),this.A=i[0]|0,this.B=i[1]|0,this.C=i[2]|0,this.D=i[3]|0,this.E=i[4]|0,this.F=i[5]|0,this.G=i[6]|0,this.H=i[7]|0}get(){const{A:d,B:m,C:p,D:g,E:l,F:S,G:A,H:k}=this;return[d,m,p,g,l,S,A,k]}set(d,m,p,g,l,S,A,k){this.A=d|0,this.B=m|0,this.C=p|0,this.D=g|0,this.E=l|0,this.F=S|0,this.G=A|0,this.H=k|0}process(d,m){for(let R=0;R<16;R++,m+=4)h[R]=d.getUint32(m,!1);for(let R=16;R<64;R++){const P=h[R-15],f=h[R-2],y=(0,n.rotr)(P,7)^(0,n.rotr)(P,18)^P>>>3,c=(0,n.rotr)(f,17)^(0,n.rotr)(f,19)^f>>>10;h[R]=c+h[R-7]+y+h[R-16]|0}let{A:p,B:g,C:l,D:S,E:A,F:k,G:v,H:_}=this;for(let R=0;R<64;R++){const P=(0,n.rotr)(A,6)^(0,n.rotr)(A,11)^(0,n.rotr)(A,25),f=_+P+(0,e.Chi)(A,k,v)+a[R]+h[R]|0,c=((0,n.rotr)(p,2)^(0,n.rotr)(p,13)^(0,n.rotr)(p,22))+(0,e.Maj)(p,g,l)|0;_=v,v=k,k=A,A=S+f|0,S=l,l=g,g=p,p=f+c|0}p=p+this.A|0,g=g+this.B|0,l=l+this.C|0,S=S+this.D|0,A=A+this.E|0,k=k+this.F|0,v=v+this.G|0,_=_+this.H|0,this.set(p,g,l,S,A,k,v,_)}roundClean(){h.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}Pe.SHA256=r;class t extends r{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}return Pe.sha256=(0,n.wrapConstructor)(()=>new r),Pe.sha224=(0,n.wrapConstructor)(()=>new t),Pe}var ft={},Wt={},js;function Fs(){return js||(js=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const n=bt(),a=$e();class i extends a.Hash{constructor(t,s){super(),this.finished=!1,this.destroyed=!1,(0,n.ahash)(t);const d=(0,a.toBytes)(s);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const m=this.blockLen,p=new Uint8Array(m);p.set(d.length>m?t.create().update(d).digest():d);for(let g=0;g<p.length;g++)p[g]^=54;this.iHash.update(p),this.oHash=t.create();for(let g=0;g<p.length;g++)p[g]^=106;this.oHash.update(p),p.fill(0)}update(t){return(0,n.aexists)(this),this.iHash.update(t),this}digestInto(t){(0,n.aexists)(this),(0,n.abytes)(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:s,iHash:d,finished:m,destroyed:p,blockLen:g,outputLen:l}=this;return t=t,t.finished=m,t.destroyed=p,t.blockLen=g,t.outputLen=l,t.oHash=s._cloneInto(t.oHash),t.iHash=d._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=i;const h=(r,t,s)=>new i(r,t).update(s).digest();e.hmac=h,e.hmac.create=(r,t)=>new i(r,t)}(Wt)),Wt}var Zt={},Ms;function Vs(){return Ms||(Ms=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=e.DERErr=void 0,e.weierstrassPoints=k,e.weierstrass=_,e.SWUFpSqrtRatio=R,e.mapToCurveSimpleSWU=P;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const n=Gt(),a=Me(),i=Ae(),h=Ae();function r(f){f.lowS!==void 0&&(0,h.abool)("lowS",f.lowS),f.prehash!==void 0&&(0,h.abool)("prehash",f.prehash)}function t(f){const y=(0,n.validateBasic)(f);i.validateObject(y,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:c,Fp:q,a:D}=y;if(c){if(!q.eql(D,q.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof c!="object"||typeof c.beta!="bigint"||typeof c.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...y})}const{bytesToNumberBE:s,hexToBytes:d}=i;class m extends Error{constructor(y=""){super(y)}}e.DERErr=m,e.DER={Err:m,_tlv:{encode:(f,y)=>{const{Err:c}=e.DER;if(f<0||f>256)throw new c("tlv.encode: wrong tag");if(y.length&1)throw new c("tlv.encode: unpadded data");const q=y.length/2,D=i.numberToHexUnpadded(q);if(D.length/2&128)throw new c("tlv.encode: long form length too big");const $=q>127?i.numberToHexUnpadded(D.length/2|128):"";return i.numberToHexUnpadded(f)+$+D+y},decode(f,y){const{Err:c}=e.DER;let q=0;if(f<0||f>256)throw new c("tlv.encode: wrong tag");if(y.length<2||y[q++]!==f)throw new c("tlv.decode: wrong tlv");const D=y[q++],$=!!(D&128);let H=0;if(!$)H=D;else{const O=D&127;if(!O)throw new c("tlv.decode(long): indefinite length not supported");if(O>4)throw new c("tlv.decode(long): byte length is too big");const j=y.subarray(q,q+O);if(j.length!==O)throw new c("tlv.decode: length bytes not complete");if(j[0]===0)throw new c("tlv.decode(long): zero leftmost byte");for(const u of j)H=H<<8|u;if(q+=O,H<128)throw new c("tlv.decode(long): not minimal encoding")}const E=y.subarray(q,q+H);if(E.length!==H)throw new c("tlv.decode: wrong value length");return{v:E,l:y.subarray(q+H)}}},_int:{encode(f){const{Err:y}=e.DER;if(f<p)throw new y("integer: negative integers are not allowed");let c=i.numberToHexUnpadded(f);if(Number.parseInt(c[0],16)&8&&(c="00"+c),c.length&1)throw new y("unexpected DER parsing assertion: unpadded hex");return c},decode(f){const{Err:y}=e.DER;if(f[0]&128)throw new y("invalid signature integer: negative");if(f[0]===0&&!(f[1]&128))throw new y("invalid signature integer: unnecessary leading zero");return s(f)}},toSig(f){const{Err:y,_int:c,_tlv:q}=e.DER,D=typeof f=="string"?d(f):f;i.abytes(D);const{v:$,l:H}=q.decode(48,D);if(H.length)throw new y("invalid signature: left bytes after parsing");const{v:E,l:O}=q.decode(2,$),{v:j,l:u}=q.decode(2,O);if(u.length)throw new y("invalid signature: left bytes after parsing");return{r:c.decode(E),s:c.decode(j)}},hexFromSig(f){const{_tlv:y,_int:c}=e.DER,q=y.encode(2,c.encode(f.r)),D=y.encode(2,c.encode(f.s)),$=q+D;return y.encode(48,$)}};const p=BigInt(0),g=BigInt(1),l=BigInt(2),S=BigInt(3),A=BigInt(4);function k(f){const y=t(f),{Fp:c}=y,q=(0,a.Field)(y.n,y.nBitLength),D=y.toBytes||((L,o,w)=>{const C=o.toAffine();return i.concatBytes(Uint8Array.from([4]),c.toBytes(C.x),c.toBytes(C.y))}),$=y.fromBytes||(L=>{const o=L.subarray(1),w=c.fromBytes(o.subarray(0,c.BYTES)),C=c.fromBytes(o.subarray(c.BYTES,2*c.BYTES));return{x:w,y:C}});function H(L){const{a:o,b:w}=y,C=c.sqr(L),G=c.mul(C,L);return c.add(c.add(G,c.mul(L,o)),w)}if(!c.eql(c.sqr(y.Gy),H(y.Gx)))throw new Error("bad generator point: equation left != right");function E(L){return i.inRange(L,g,y.n)}function O(L){const{allowedPrivateKeyLengths:o,nByteLength:w,wrapPrivateKey:C,n:G}=y;if(o&&typeof L!="bigint"){if(i.isBytes(L)&&(L=i.bytesToHex(L)),typeof L!="string"||!o.includes(L.length))throw new Error("invalid private key");L=L.padStart(w*2,"0")}let x;try{x=typeof L=="bigint"?L:i.bytesToNumberBE((0,h.ensureBytes)("private key",L,w))}catch{throw new Error("invalid private key, expected hex or "+w+" bytes, got "+typeof L)}return C&&(x=(0,a.mod)(x,G)),i.aInRange("private key",x,g,G),x}function j(L){if(!(L instanceof b))throw new Error("ProjectivePoint expected")}const u=(0,h.memoized)((L,o)=>{const{px:w,py:C,pz:G}=L;if(c.eql(G,c.ONE))return{x:w,y:C};const x=L.is0();o==null&&(o=x?c.ONE:c.inv(G));const K=c.mul(w,o),te=c.mul(C,o),M=c.mul(G,o);if(x)return{x:c.ZERO,y:c.ZERO};if(!c.eql(M,c.ONE))throw new Error("invZ was invalid");return{x:K,y:te}}),N=(0,h.memoized)(L=>{if(L.is0()){if(y.allowInfinityPoint&&!c.is0(L.py))return;throw new Error("bad point: ZERO")}const{x:o,y:w}=L.toAffine();if(!c.isValid(o)||!c.isValid(w))throw new Error("bad point: x or y not FE");const C=c.sqr(w),G=H(o);if(!c.eql(C,G))throw new Error("bad point: equation left != right");if(!L.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class b{constructor(o,w,C){if(this.px=o,this.py=w,this.pz=C,o==null||!c.isValid(o))throw new Error("x required");if(w==null||!c.isValid(w))throw new Error("y required");if(C==null||!c.isValid(C))throw new Error("z required");Object.freeze(this)}static fromAffine(o){const{x:w,y:C}=o||{};if(!o||!c.isValid(w)||!c.isValid(C))throw new Error("invalid affine point");if(o instanceof b)throw new Error("projective point not allowed");const G=x=>c.eql(x,c.ZERO);return G(w)&&G(C)?b.ZERO:new b(w,C,c.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(o){const w=c.invertBatch(o.map(C=>C.pz));return o.map((C,G)=>C.toAffine(w[G])).map(b.fromAffine)}static fromHex(o){const w=b.fromAffine($((0,h.ensureBytes)("pointHex",o)));return w.assertValidity(),w}static fromPrivateKey(o){return b.BASE.multiply(O(o))}static msm(o,w){return(0,n.pippenger)(b,q,o,w)}_setWindowSize(o){T.setWindowSize(this,o)}assertValidity(){N(this)}hasEvenY(){const{y:o}=this.toAffine();if(c.isOdd)return!c.isOdd(o);throw new Error("Field doesn't support isOdd")}equals(o){j(o);const{px:w,py:C,pz:G}=this,{px:x,py:K,pz:te}=o,M=c.eql(c.mul(w,te),c.mul(x,G)),I=c.eql(c.mul(C,te),c.mul(K,G));return M&&I}negate(){return new b(this.px,c.neg(this.py),this.pz)}double(){const{a:o,b:w}=y,C=c.mul(w,S),{px:G,py:x,pz:K}=this;let te=c.ZERO,M=c.ZERO,I=c.ZERO,F=c.mul(G,G),Z=c.mul(x,x),W=c.mul(K,K),J=c.mul(G,x);return J=c.add(J,J),I=c.mul(G,K),I=c.add(I,I),te=c.mul(o,I),M=c.mul(C,W),M=c.add(te,M),te=c.sub(Z,M),M=c.add(Z,M),M=c.mul(te,M),te=c.mul(J,te),I=c.mul(C,I),W=c.mul(o,W),J=c.sub(F,W),J=c.mul(o,J),J=c.add(J,I),I=c.add(F,F),F=c.add(I,F),F=c.add(F,W),F=c.mul(F,J),M=c.add(M,F),W=c.mul(x,K),W=c.add(W,W),F=c.mul(W,J),te=c.sub(te,F),I=c.mul(W,Z),I=c.add(I,I),I=c.add(I,I),new b(te,M,I)}add(o){j(o);const{px:w,py:C,pz:G}=this,{px:x,py:K,pz:te}=o;let M=c.ZERO,I=c.ZERO,F=c.ZERO;const Z=y.a,W=c.mul(y.b,S);let J=c.mul(w,x),Q=c.mul(C,K),V=c.mul(G,te),U=c.add(w,C),z=c.add(x,K);U=c.mul(U,z),z=c.add(J,Q),U=c.sub(U,z),z=c.add(w,G);let ee=c.add(x,te);return z=c.mul(z,ee),ee=c.add(J,V),z=c.sub(z,ee),ee=c.add(C,G),M=c.add(K,te),ee=c.mul(ee,M),M=c.add(Q,V),ee=c.sub(ee,M),F=c.mul(Z,z),M=c.mul(W,V),F=c.add(M,F),M=c.sub(Q,F),F=c.add(Q,F),I=c.mul(M,F),Q=c.add(J,J),Q=c.add(Q,J),V=c.mul(Z,V),z=c.mul(W,z),Q=c.add(Q,V),V=c.sub(J,V),V=c.mul(Z,V),z=c.add(z,V),J=c.mul(Q,z),I=c.add(I,J),J=c.mul(ee,z),M=c.mul(U,M),M=c.sub(M,J),J=c.mul(U,Q),F=c.mul(ee,F),F=c.add(F,J),new b(M,I,F)}subtract(o){return this.add(o.negate())}is0(){return this.equals(b.ZERO)}wNAF(o){return T.wNAFCached(this,o,b.normalizeZ)}multiplyUnsafe(o){const{endo:w,n:C}=y;i.aInRange("scalar",o,p,C);const G=b.ZERO;if(o===p)return G;if(this.is0()||o===g)return this;if(!w||T.hasPrecomputes(this))return T.wNAFCachedUnsafe(this,o,b.normalizeZ);let{k1neg:x,k1:K,k2neg:te,k2:M}=w.splitScalar(o),I=G,F=G,Z=this;for(;K>p||M>p;)K&g&&(I=I.add(Z)),M&g&&(F=F.add(Z)),Z=Z.double(),K>>=g,M>>=g;return x&&(I=I.negate()),te&&(F=F.negate()),F=new b(c.mul(F.px,w.beta),F.py,F.pz),I.add(F)}multiply(o){const{endo:w,n:C}=y;i.aInRange("scalar",o,g,C);let G,x;if(w){const{k1neg:K,k1:te,k2neg:M,k2:I}=w.splitScalar(o);let{p:F,f:Z}=this.wNAF(te),{p:W,f:J}=this.wNAF(I);F=T.constTimeNegate(K,F),W=T.constTimeNegate(M,W),W=new b(c.mul(W.px,w.beta),W.py,W.pz),G=F.add(W),x=Z.add(J)}else{const{p:K,f:te}=this.wNAF(o);G=K,x=te}return b.normalizeZ([G,x])[0]}multiplyAndAddUnsafe(o,w,C){const G=b.BASE,x=(te,M)=>M===p||M===g||!te.equals(G)?te.multiplyUnsafe(M):te.multiply(M),K=x(this,w).add(x(o,C));return K.is0()?void 0:K}toAffine(o){return u(this,o)}isTorsionFree(){const{h:o,isTorsionFree:w}=y;if(o===g)return!0;if(w)return w(b,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:o,clearCofactor:w}=y;return o===g?this:w?w(b,this):this.multiplyUnsafe(y.h)}toRawBytes(o=!0){return(0,h.abool)("isCompressed",o),this.assertValidity(),D(b,this,o)}toHex(o=!0){return(0,h.abool)("isCompressed",o),i.bytesToHex(this.toRawBytes(o))}}b.BASE=new b(y.Gx,y.Gy,c.ONE),b.ZERO=new b(c.ZERO,c.ONE,c.ZERO);const B=y.nBitLength,T=(0,n.wNAF)(b,y.endo?Math.ceil(B/2):B);return{CURVE:y,ProjectivePoint:b,normPrivateKeyToScalar:O,weierstrassEquation:H,isWithinCurveOrder:E}}function v(f){const y=(0,n.validateBasic)(f);return i.validateObject(y,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...y})}function _(f){const y=v(f),{Fp:c,n:q}=y,D=c.BYTES+1,$=2*c.BYTES+1;function H(V){return(0,a.mod)(V,q)}function E(V){return(0,a.invert)(V,q)}const{ProjectivePoint:O,normPrivateKeyToScalar:j,weierstrassEquation:u,isWithinCurveOrder:N}=k({...y,toBytes(V,U,z){const ee=U.toAffine(),Y=c.toBytes(ee.x),re=i.concatBytes;return(0,h.abool)("isCompressed",z),z?re(Uint8Array.from([U.hasEvenY()?2:3]),Y):re(Uint8Array.from([4]),Y,c.toBytes(ee.y))},fromBytes(V){const U=V.length,z=V[0],ee=V.subarray(1);if(U===D&&(z===2||z===3)){const Y=i.bytesToNumberBE(ee);if(!i.inRange(Y,g,c.ORDER))throw new Error("Point is not on curve");const re=u(Y);let X;try{X=c.sqrt(re)}catch(oe){const ie=oe instanceof Error?": "+oe.message:"";throw new Error("Point is not on curve"+ie)}const ne=(X&g)===g;return(z&1)===1!==ne&&(X=c.neg(X)),{x:Y,y:X}}else if(U===$&&z===4){const Y=c.fromBytes(ee.subarray(0,c.BYTES)),re=c.fromBytes(ee.subarray(c.BYTES,2*c.BYTES));return{x:Y,y:re}}else{const Y=D,re=$;throw new Error("invalid Point, expected length of "+Y+", or uncompressed "+re+", got "+U)}}}),b=V=>i.bytesToHex(i.numberToBytesBE(V,y.nByteLength));function B(V){const U=q>>g;return V>U}function T(V){return B(V)?H(-V):V}const L=(V,U,z)=>i.bytesToNumberBE(V.slice(U,z));class o{constructor(U,z,ee){this.r=U,this.s=z,this.recovery=ee,this.assertValidity()}static fromCompact(U){const z=y.nByteLength;return U=(0,h.ensureBytes)("compactSignature",U,z*2),new o(L(U,0,z),L(U,z,2*z))}static fromDER(U){const{r:z,s:ee}=e.DER.toSig((0,h.ensureBytes)("DER",U));return new o(z,ee)}assertValidity(){i.aInRange("r",this.r,g,q),i.aInRange("s",this.s,g,q)}addRecoveryBit(U){return new o(this.r,this.s,U)}recoverPublicKey(U){const{r:z,s:ee,recovery:Y}=this,re=te((0,h.ensureBytes)("msgHash",U));if(Y==null||![0,1,2,3].includes(Y))throw new Error("recovery id invalid");const X=Y===2||Y===3?z+y.n:z;if(X>=c.ORDER)throw new Error("recovery id 2 or 3 invalid");const ne=(Y&1)===0?"02":"03",se=O.fromHex(ne+b(X)),oe=E(X),ie=H(-re*oe),fe=H(ee*oe),le=O.BASE.multiplyAndAddUnsafe(se,ie,fe);if(!le)throw new Error("point at infinify");return le.assertValidity(),le}hasHighS(){return B(this.s)}normalizeS(){return this.hasHighS()?new o(this.r,H(-this.s),this.recovery):this}toDERRawBytes(){return i.hexToBytes(this.toDERHex())}toDERHex(){return e.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return i.hexToBytes(this.toCompactHex())}toCompactHex(){return b(this.r)+b(this.s)}}const w={isValidPrivateKey(V){try{return j(V),!0}catch{return!1}},normPrivateKeyToScalar:j,randomPrivateKey:()=>{const V=(0,a.getMinHashLength)(y.n);return(0,a.mapHashToField)(y.randomBytes(V),y.n)},precompute(V=8,U=O.BASE){return U._setWindowSize(V),U.multiply(BigInt(3)),U}};function C(V,U=!0){return O.fromPrivateKey(V).toRawBytes(U)}function G(V){const U=i.isBytes(V),z=typeof V=="string",ee=(U||z)&&V.length;return U?ee===D||ee===$:z?ee===2*D||ee===2*$:V instanceof O}function x(V,U,z=!0){if(G(V))throw new Error("first arg must be private key");if(!G(U))throw new Error("second arg must be public key");return O.fromHex(U).multiply(j(V)).toRawBytes(z)}const K=y.bits2int||function(V){if(V.length>8192)throw new Error("input is too large");const U=i.bytesToNumberBE(V),z=V.length*8-y.nBitLength;return z>0?U>>BigInt(z):U},te=y.bits2int_modN||function(V){return H(K(V))},M=i.bitMask(y.nBitLength);function I(V){return i.aInRange("num < 2^"+y.nBitLength,V,p,M),i.numberToBytesBE(V,y.nByteLength)}function F(V,U,z=Z){if(["recovered","canonical"].some(ye=>ye in z))throw new Error("sign() legacy options not supported");const{hash:ee,randomBytes:Y}=y;let{lowS:re,prehash:X,extraEntropy:ne}=z;re==null&&(re=!0),V=(0,h.ensureBytes)("msgHash",V),r(z),X&&(V=(0,h.ensureBytes)("prehashed msgHash",ee(V)));const se=te(V),oe=j(U),ie=[I(oe),I(se)];if(ne!=null&&ne!==!1){const ye=ne===!0?Y(c.BYTES):ne;ie.push((0,h.ensureBytes)("extraEntropy",ye))}const fe=i.concatBytes(...ie),le=se;function ve(ye){const be=K(ye);if(!N(be))return;const ge=E(be),Ee=O.BASE.multiply(be).toAffine(),_e=H(Ee.x);if(_e===p)return;const Se=H(ge*H(le+_e*oe));if(Se===p)return;let Re=(Ee.x===_e?0:2)|Number(Ee.y&g),Xe=Se;return re&&B(Se)&&(Xe=T(Se),Re^=1),new o(_e,Xe,Re)}return{seed:fe,k2sig:ve}}const Z={lowS:y.lowS,prehash:!1},W={lowS:y.lowS,prehash:!1};function J(V,U,z=Z){const{seed:ee,k2sig:Y}=F(V,U,z),re=y;return i.createHmacDrbg(re.hash.outputLen,re.nByteLength,re.hmac)(ee,Y)}O.BASE._setWindowSize(8);function Q(V,U,z,ee=W){const Y=V;U=(0,h.ensureBytes)("msgHash",U),z=(0,h.ensureBytes)("publicKey",z);const{lowS:re,prehash:X,format:ne}=ee;if(r(ee),"strict"in ee)throw new Error("options.strict was renamed to lowS");if(ne!==void 0&&ne!=="compact"&&ne!=="der")throw new Error("format must be compact or der");const se=typeof Y=="string"||i.isBytes(Y),oe=!se&&!ne&&typeof Y=="object"&&Y!==null&&typeof Y.r=="bigint"&&typeof Y.s=="bigint";if(!se&&!oe)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let ie,fe;try{if(oe&&(ie=new o(Y.r,Y.s)),se){try{ne!=="compact"&&(ie=o.fromDER(Y))}catch(Re){if(!(Re instanceof e.DER.Err))throw Re}!ie&&ne!=="der"&&(ie=o.fromCompact(Y))}fe=O.fromHex(z)}catch{return!1}if(!ie||re&&ie.hasHighS())return!1;X&&(U=y.hash(U));const{r:le,s:ve}=ie,ye=te(U),be=E(ve),ge=H(ye*be),Ee=H(le*be),_e=O.BASE.multiplyAndAddUnsafe(fe,ge,Ee)?.toAffine();return _e?H(_e.x)===le:!1}return{CURVE:y,getPublicKey:C,getSharedSecret:x,sign:J,verify:Q,ProjectivePoint:O,Signature:o,utils:w}}function R(f,y){const c=f.ORDER;let q=p;for(let T=c-g;T%l===p;T/=l)q+=g;const D=q,$=l<<D-g-g,H=$*l,E=(c-g)/H,O=(E-g)/l,j=H-g,u=$,N=f.pow(y,E),b=f.pow(y,(E+g)/l);let B=(T,L)=>{let o=N,w=f.pow(L,j),C=f.sqr(w);C=f.mul(C,L);let G=f.mul(T,C);G=f.pow(G,O),G=f.mul(G,w),w=f.mul(G,L),C=f.mul(G,T);let x=f.mul(C,w);G=f.pow(x,u);let K=f.eql(G,f.ONE);w=f.mul(C,b),G=f.mul(x,o),C=f.cmov(w,C,K),x=f.cmov(G,x,K);for(let te=D;te>g;te--){let M=te-l;M=l<<M-g;let I=f.pow(x,M);const F=f.eql(I,f.ONE);w=f.mul(C,o),o=f.mul(o,o),I=f.mul(x,o),C=f.cmov(w,C,F),x=f.cmov(I,x,F)}return{isValid:K,value:C}};if(f.ORDER%A===S){const T=(f.ORDER-S)/A,L=f.sqrt(f.neg(y));B=(o,w)=>{let C=f.sqr(w);const G=f.mul(o,w);C=f.mul(C,G);let x=f.pow(C,T);x=f.mul(x,G);const K=f.mul(x,L),te=f.mul(f.sqr(x),w),M=f.eql(te,o);let I=f.cmov(K,x,M);return{isValid:M,value:I}}}return B}function P(f,y){if((0,a.validateField)(f),!f.isValid(y.A)||!f.isValid(y.B)||!f.isValid(y.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const c=R(f,y.Z);if(!f.isOdd)throw new Error("Fp.isOdd is not implemented!");return q=>{let D,$,H,E,O,j,u,N;D=f.sqr(q),D=f.mul(D,y.Z),$=f.sqr(D),$=f.add($,D),H=f.add($,f.ONE),H=f.mul(H,y.B),E=f.cmov(y.Z,f.neg($),!f.eql($,f.ZERO)),E=f.mul(E,y.A),$=f.sqr(H),j=f.sqr(E),O=f.mul(j,y.A),$=f.add($,O),$=f.mul($,H),j=f.mul(j,E),O=f.mul(j,y.B),$=f.add($,O),u=f.mul(D,H);const{isValid:b,value:B}=c($,j);N=f.mul(D,q),N=f.mul(N,B),u=f.cmov(u,H,b),N=f.cmov(N,B,b);const T=f.isOdd(q)===f.isOdd(N);return N=f.cmov(f.neg(N),N,T),u=f.div(u,E),{x:u,y:N}}}}(Zt)),Zt}var Us;function dc(){if(Us)return ft;Us=1,Object.defineProperty(ft,"__esModule",{value:!0}),ft.getHash=i,ft.createCurve=h;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=Fs(),n=$e(),a=Vs();function i(r){return{hash:r,hmac:(t,...s)=>(0,e.hmac)(r,t,(0,n.concatBytes)(...s)),randomBytes:n.randomBytes}}function h(r,t){const s=d=>(0,a.weierstrass)({...r,...i(d)});return{...s(t),create:s}}return ft}var Gs;function hc(){return Gs||(Gs=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.schnorr=e.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const n=ks(),a=$e(),i=dc(),h=Ds(),r=Me(),t=Ae(),s=Vs(),d=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),m=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),p=BigInt(1),g=BigInt(2),l=(T,L)=>(T+L/g)/L;function S(T){const L=d,o=BigInt(3),w=BigInt(6),C=BigInt(11),G=BigInt(22),x=BigInt(23),K=BigInt(44),te=BigInt(88),M=T*T*T%L,I=M*M*T%L,F=(0,r.pow2)(I,o,L)*I%L,Z=(0,r.pow2)(F,o,L)*I%L,W=(0,r.pow2)(Z,g,L)*M%L,J=(0,r.pow2)(W,C,L)*W%L,Q=(0,r.pow2)(J,G,L)*J%L,V=(0,r.pow2)(Q,K,L)*Q%L,U=(0,r.pow2)(V,te,L)*V%L,z=(0,r.pow2)(U,K,L)*Q%L,ee=(0,r.pow2)(z,o,L)*I%L,Y=(0,r.pow2)(ee,x,L)*J%L,re=(0,r.pow2)(Y,w,L)*M%L,X=(0,r.pow2)(re,g,L);if(!A.eql(A.sqr(X),T))throw new Error("Cannot find square root");return X}const A=(0,r.Field)(d,void 0,void 0,{sqrt:S});e.secp256k1=(0,i.createCurve)({a:BigInt(0),b:BigInt(7),Fp:A,n:m,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:T=>{const L=m,o=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),w=-p*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),C=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),G=o,x=BigInt("0x100000000000000000000000000000000"),K=l(G*T,L),te=l(-w*T,L);let M=(0,r.mod)(T-K*o-te*C,L),I=(0,r.mod)(-K*w-te*G,L);const F=M>x,Z=I>x;if(F&&(M=L-M),Z&&(I=L-I),M>x||I>x)throw new Error("splitScalar: Endomorphism failed, k="+T);return{k1neg:F,k1:M,k2neg:Z,k2:I}}}},n.sha256);const k=BigInt(0),v={};function _(T,...L){let o=v[T];if(o===void 0){const w=(0,n.sha256)(Uint8Array.from(T,C=>C.charCodeAt(0)));o=(0,t.concatBytes)(w,w),v[T]=o}return(0,n.sha256)((0,t.concatBytes)(o,...L))}const R=T=>T.toRawBytes(!0).slice(1),P=T=>(0,t.numberToBytesBE)(T,32),f=T=>(0,r.mod)(T,d),y=T=>(0,r.mod)(T,m),c=e.secp256k1.ProjectivePoint,q=(T,L,o)=>c.BASE.multiplyAndAddUnsafe(T,L,o);function D(T){let L=e.secp256k1.utils.normPrivateKeyToScalar(T),o=c.fromPrivateKey(L);return{scalar:o.hasEvenY()?L:y(-L),bytes:R(o)}}function $(T){(0,t.aInRange)("x",T,p,d);const L=f(T*T),o=f(L*T+BigInt(7));let w=S(o);w%g!==k&&(w=f(-w));const C=new c(T,w,p);return C.assertValidity(),C}const H=t.bytesToNumberBE;function E(...T){return y(H(_("BIP0340/challenge",...T)))}function O(T){return D(T).bytes}function j(T,L,o=(0,a.randomBytes)(32)){const w=(0,t.ensureBytes)("message",T),{bytes:C,scalar:G}=D(L),x=(0,t.ensureBytes)("auxRand",o,32),K=P(G^H(_("BIP0340/aux",x))),te=_("BIP0340/nonce",K,C,w),M=y(H(te));if(M===k)throw new Error("sign failed: k is zero");const{bytes:I,scalar:F}=D(M),Z=E(I,C,w),W=new Uint8Array(64);if(W.set(I,0),W.set(P(y(F+Z*G)),32),!u(W,w,C))throw new Error("sign: Invalid signature produced");return W}function u(T,L,o){const w=(0,t.ensureBytes)("signature",T,64),C=(0,t.ensureBytes)("message",L),G=(0,t.ensureBytes)("publicKey",o,32);try{const x=$(H(G)),K=H(w.subarray(0,32));if(!(0,t.inRange)(K,p,d))return!1;const te=H(w.subarray(32,64));if(!(0,t.inRange)(te,p,m))return!1;const M=E(P(K),R(x),C),I=q(x,te,y(-M));return!(!I||!I.hasEvenY()||I.toAffine().x!==K)}catch{return!1}}e.schnorr={getPublicKey:O,sign:j,verify:u,utils:{randomPrivateKey:e.secp256k1.utils.randomPrivateKey,lift_x:$,pointToBytes:R,numberToBytesBE:t.numberToBytesBE,bytesToNumberBE:t.bytesToNumberBE,taggedHash:_,mod:r.mod}};const N=(0,h.isogenyMap)(A,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(T=>T.map(L=>BigInt(L)))),b=(0,s.mapToCurveSimpleSWU)(A,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:A.create(BigInt("-11"))}),B=(0,h.createHasher)(e.secp256k1.ProjectivePoint,T=>{const{x:L,y:o}=b(A.create(T[0]));return N(L,o)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:A.ORDER,m:1,k:128,expand:"xmd",hash:n.sha256});e.hashToCurve=B.hashToCurve,e.encodeToCurve=B.encodeToCurve}(Yt)),Yt}var zt={},Ys;function Ws(){return Ys||(Ys=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeHex=e.remove0x=void 0;var n=Ce(),a=function(h){return h.startsWith("0x")||h.startsWith("0X")?h.slice(2):h};e.remove0x=a;var i=function(h){return(0,n.hexToBytes)((0,e.remove0x)(h))};e.decodeHex=i}(zt)),zt}var Zs;function pc(){return Zs||(Zs=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hexToPublicKey=e.convertPublicKeyFormat=e.getSharedPoint=e.getPublicKey=e.isValidPrivateKey=e.getValidSecret=void 0;var n=xs(),a=fc(),i=hc(),h=mt(),r=kt(),t=Ws(),s=function(){var v;do v=(0,n.randomBytes)(r.SECRET_KEY_LENGTH);while(!(0,e.isValidPrivateKey)(v));return v};e.getValidSecret=s;var d=function(v){return S((0,h.ellipticCurve)(),function(_){return _.utils.isValidPrivateKey(v)},function(){return!0},function(){return!0})};e.isValidPrivateKey=d;var m=function(v){return S((0,h.ellipticCurve)(),function(_){return _.getPublicKey(v)},function(_){return _.getPublicKey(v)},function(_){return _.getPublicKey(v)})};e.getPublicKey=m;var p=function(v,_,R){return S((0,h.ellipticCurve)(),function(P){return P.getSharedSecret(v,_,R)},function(P){return P.getSharedSecret(v,_)},function(P){return k(P,v,_)})};e.getSharedPoint=p;var g=function(v,_){return S((0,h.ellipticCurve)(),function(R){return R.getSharedSecret(BigInt(1),v,_)},function(){return v},function(){return v})};e.convertPublicKeyFormat=g;var l=function(v){var _=(0,t.decodeHex)(v);return S((0,h.ellipticCurve)(),function(){return A(_)},function(){return _},function(){return _})};e.hexToPublicKey=l;function S(v,_,R,P){if(v==="secp256k1")return _(i.secp256k1);if(v==="x25519")return R(a.x25519);if(v==="ed25519")return P(a.ed25519);throw new Error("Not implemented")}var A=function(v){if(v.length===r.ETH_PUBLIC_KEY_SIZE){var _=new Uint8Array(1+v.length);return _.set([4]),_.set(v,1),_}return v},k=function(v,_,R){var P=v.utils.getExtendedPublicKey(_).scalar,f=v.ExtendedPoint.fromHex(R).multiply(P);return f.toRawBytes()}}(Ft)),Ft}var Xt={},Ve={},zs;function yc(){if(zs)return Ve;zs=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.hkdf=void 0,Ve.extract=i,Ve.expand=t;const e=bt(),n=Fs(),a=$e();function i(d,m,p){return(0,e.ahash)(d),p===void 0&&(p=new Uint8Array(d.outputLen)),(0,n.hmac)(d,(0,a.toBytes)(p),(0,a.toBytes)(m))}const h=new Uint8Array([0]),r=new Uint8Array;function t(d,m,p,g=32){if((0,e.ahash)(d),(0,e.anumber)(g),g>255*d.outputLen)throw new Error("Length should be <= 255*HashLen");const l=Math.ceil(g/d.outputLen);p===void 0&&(p=r);const S=new Uint8Array(l*d.outputLen),A=n.hmac.create(d,m),k=A._cloneInto(),v=new Uint8Array(A.outputLen);for(let _=0;_<l;_++)h[0]=_+1,k.update(_===0?r:v).update(p).update(h).digestInto(v),S.set(v,d.outputLen*_),A._cloneInto(k);return A.destroy(),k.destroy(),v.fill(0),h.fill(0),S.slice(0,g)}const s=(d,m,p,g,l)=>t(d,i(d,m,p),g,l);return Ve.hkdf=s,Ve}var Xs;function vc(){return Xs||(Xs=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSharedKey=e.deriveKey=void 0;var n=Ce(),a=yc(),i=ks(),h=function(t,s,d){return(0,a.hkdf)(i.sha256,t,s,d,32)};e.deriveKey=h;var r=function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];return(0,e.deriveKey)(n.concatBytes.apply(void 0,t))};e.getSharedKey=r}(Xt)),Xt}var Qt={},Ue={},dt={},Qs;function Js(){if(Qs)return dt;Qs=1,Object.defineProperty(dt,"__esModule",{value:!0}),dt._compat=void 0;var e=Ce(),n=_i,a=16,i=globalThis.Deno!==void 0,h=function(r,t,s,d){var m=r==="aes-256-gcm"||r==="chacha20-poly1305",p=m?a:0,g=m?{authTagLength:p}:void 0,l=function(A){var k=(0,n.createCipheriv)(r,t,s,g);m&&d!==void 0&&k.setAAD(d);var v=k.update(A),_=k.final(),R=m?k.getAuthTag():new Uint8Array(0);return(0,e.concatBytes)(v,_,R)},S=function(A){var k=A.subarray(0,A.length-p),v=A.subarray(A.length-p),_=(0,n.createDecipheriv)(r,t,s,g);m&&(d!==void 0&&_.setAAD(d),_.setAuthTag(v)),!m&&i&&_.setAutoPadding(!1);var R=_.update(k),P=_.final();return(0,e.concatBytes)(R,P)};return{encrypt:l,decrypt:S}};return dt._compat=h,dt}var eo;function gc(){if(eo)return Ue;eo=1,Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.aes256cbc=Ue.aes256gcm=void 0;var e=Js(),n=function(i,h,r){return(0,e._compat)("aes-256-gcm",i,h,r)};Ue.aes256gcm=n;var a=function(i,h,r){return(0,e._compat)("aes-256-cbc",i,h)};return Ue.aes256cbc=a,Ue}var Ge={},ht={},to;function mc(){if(to)return ht;to=1,Object.defineProperty(ht,"__esModule",{value:!0}),ht._hchacha20=void 0;var e=function(a,i,h,r){for(var t=a[0],s=a[1],d=a[2],m=a[3],p=i[0],g=i[1],l=i[2],S=i[3],A=i[4],k=i[5],v=i[6],_=i[7],R=h[0],P=h[1],f=h[2],y=h[3],c=0;c<20;c+=2)t=t+p|0,R=n(R^t,16),A=A+R|0,p=n(p^A,12),t=t+p|0,R=n(R^t,8),A=A+R|0,p=n(p^A,7),s=s+g|0,P=n(P^s,16),k=k+P|0,g=n(g^k,12),s=s+g|0,P=n(P^s,8),k=k+P|0,g=n(g^k,7),d=d+l|0,f=n(f^d,16),v=v+f|0,l=n(l^v,12),d=d+l|0,f=n(f^d,8),v=v+f|0,l=n(l^v,7),m=m+S|0,y=n(y^m,16),_=_+y|0,S=n(S^_,12),m=m+S|0,y=n(y^m,8),_=_+y|0,S=n(S^_,7),t=t+g|0,y=n(y^t,16),v=v+y|0,g=n(g^v,12),t=t+g|0,y=n(y^t,8),v=v+y|0,g=n(g^v,7),s=s+l|0,R=n(R^s,16),_=_+R|0,l=n(l^_,12),s=s+l|0,R=n(R^s,8),_=_+R|0,l=n(l^_,7),d=d+S|0,P=n(P^d,16),A=A+P|0,S=n(S^A,12),d=d+S|0,P=n(P^d,8),A=A+P|0,S=n(S^A,7),m=m+p|0,f=n(f^m,16),k=k+f|0,p=n(p^k,12),m=m+p|0,f=n(f^m,8),k=k+f|0,p=n(p^k,7);var q=0;r[q++]=t,r[q++]=s,r[q++]=d,r[q++]=m,r[q++]=R,r[q++]=P,r[q++]=f,r[q++]=y};ht._hchacha20=e;var n=function(a,i){return a<<i|a>>>32-i};return ht}var no;function bc(){if(no)return Ge;no=1,Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.chacha20=Ge.xchacha20=void 0;var e=Ce(),n=Js(),a=mc(),i=function(r,t,s){if(t.length!==24)throw new Error("xchacha20's nonce must be 24 bytes");var d=new Uint32Array([1634760805,857760878,2036477234,1797285236]),m=new Uint32Array(8);(0,a._hchacha20)(d,(0,e.u32)(r),(0,e.u32)(t.subarray(0,16)),m);var p=new Uint8Array(12);return p.set([0,0,0,0]),p.set(t.subarray(16),4),(0,n._compat)("chacha20-poly1305",(0,e.u8)(m),p,s)};Ge.xchacha20=i;var h=function(r,t,s){if(t.length!==12)throw new Error("chacha20's nonce must be 12 bytes");return(0,n._compat)("chacha20-poly1305",r,t,s)};return Ge.chacha20=h,Ge}var ro;function Ec(){return ro||(ro=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.aesDecrypt=e.aesEncrypt=e.symDecrypt=e.symEncrypt=void 0;var n=Ce(),a=xs(),i=gc(),h=bc(),r=mt(),t=kt(),s=function(l,S,A){return m(p,l,S,A)};e.symEncrypt=s;var d=function(l,S,A){return m(g,l,S,A)};e.symDecrypt=d,e.aesEncrypt=e.symEncrypt,e.aesDecrypt=e.symDecrypt;function m(l,S,A,k){var v=(0,r.symmetricAlgorithm)();if(v==="aes-256-gcm")return l(i.aes256gcm,S,A,(0,r.symmetricNonceLength)(),t.AEAD_TAG_LENGTH,k);if(v==="xchacha20")return l(h.xchacha20,S,A,t.XCHACHA20_NONCE_LENGTH,t.AEAD_TAG_LENGTH,k);if(v==="aes-256-cbc")return l(i.aes256cbc,S,A,16,0);throw new Error("Not implemented")}function p(l,S,A,k,v,_){var R=(0,a.randomBytes)(k),P=l(S,R,_),f=P.encrypt(A);if(v===0)return(0,n.concatBytes)(R,f);var y=f.length-v,c=f.subarray(0,y),q=f.subarray(y);return(0,n.concatBytes)(R,q,c)}function g(l,S,A,k,v,_){var R=A.subarray(0,k),P=l(S,Uint8Array.from(R),_),f=A.subarray(k);if(v===0)return P.decrypt(f);var y=f.subarray(0,v),c=f.subarray(v);return P.decrypt((0,n.concatBytes)(c,y))}}(Qt)),Qt}var so;function Jt(){return so||(so=1,function(e){var n=je&&je.__createBinding||(Object.create?function(i,h,r,t){t===void 0&&(t=r);var s=Object.getOwnPropertyDescriptor(h,r);(!s||("get"in s?!h.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return h[r]}}),Object.defineProperty(i,t,s)}:function(i,h,r,t){t===void 0&&(t=r),i[t]=h[r]}),a=je&&je.__exportStar||function(i,h){for(var r in i)r!=="default"&&!Object.prototype.hasOwnProperty.call(h,r)&&n(h,i,r)};Object.defineProperty(e,"__esModule",{value:!0}),a(pc(),e),a(vc(),e),a(Ws(),e),a(Ec(),e)}(je)),je}var pt={},oo;function io(){if(oo)return pt;oo=1,Object.defineProperty(pt,"__esModule",{value:!0}),pt.PublicKey=void 0;var e=Ce(),n=Jt(),a=function(){function i(h){var r=(0,n.convertPublicKeyFormat)(h,!0),t=(0,n.convertPublicKeyFormat)(h,!1);this.data=r,this.dataUncompressed=r.length!==t.length?t:null}return i.fromHex=function(h){return new i((0,n.hexToPublicKey)(h))},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(h){return h===void 0&&(h=!0),h?this.data:this._uncompressed},i.prototype.toHex=function(h){return h===void 0&&(h=!0),(0,e.bytesToHex)(this.toBytes(h))},i.prototype.decapsulate=function(h,r){r===void 0&&(r=!1);var t=this.toBytes(r),s=h.multiply(this,r);return(0,n.getSharedKey)(t,s)},i.prototype.equals=function(h){return(0,e.equalBytes)(this.data,h.data)},i}();return pt.PublicKey=a,pt}var co;function _c(){if(co)return at;co=1,Object.defineProperty(at,"__esModule",{value:!0}),at.PrivateKey=void 0;var e=Ce(),n=Jt(),a=io(),i=function(){function h(r){if(r===void 0)this.data=(0,n.getValidSecret)();else if((0,n.isValidPrivateKey)(r))this.data=r;else throw new Error("Invalid private key");this.publicKey=new a.PublicKey((0,n.getPublicKey)(this.data))}return h.fromHex=function(r){return new h((0,n.decodeHex)(r))},Object.defineProperty(h.prototype,"secret",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),h.prototype.toHex=function(){return(0,e.bytesToHex)(this.data)},h.prototype.encapsulate=function(r,t){t===void 0&&(t=!1);var s=this.publicKey.toBytes(t),d=this.multiply(r,t);return(0,n.getSharedKey)(s,d)},h.prototype.multiply=function(r,t){return t===void 0&&(t=!1),(0,n.getSharedPoint)(this.data,r.toBytes(!0),t)},h.prototype.equals=function(r){return(0,e.equalBytes)(this.data,r.data)},h}();return at.PrivateKey=i,at}var ao;function uo(){return ao||(ao=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.PrivateKey=void 0;var n=_c();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return n.PrivateKey}});var a=io();Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return a.PublicKey}})}(jt)),jt}var lo;function en(){return lo||(lo=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.PublicKey=e.PrivateKey=e.ECIES_CONFIG=void 0,e.encrypt=r,e.decrypt=s;var n=Ce(),a=mt(),i=uo(),h=Jt();function r(g,l){return Buffer.from(t(g,l))}function t(g,l){var S=new i.PrivateKey,A=g instanceof Uint8Array?new i.PublicKey(g):i.PublicKey.fromHex(g),k=S.encapsulate(A,(0,a.isHkdfKeyCompressed)()),v=S.publicKey.toBytes((0,a.isEphemeralKeyCompressed)()),_=(0,h.symEncrypt)(k,l);return(0,n.concatBytes)(v,_)}function s(g,l){return Buffer.from(d(g,l))}function d(g,l){var S=g instanceof Uint8Array?new i.PrivateKey(g):i.PrivateKey.fromHex(g),A=(0,a.ephemeralKeySize)(),k=new i.PublicKey(l.subarray(0,A)),v=l.subarray(A),_=k.decapsulate(S,(0,a.isHkdfKeyCompressed)());return(0,h.symDecrypt)(_,v)}var m=mt();Object.defineProperty(e,"ECIES_CONFIG",{enumerable:!0,get:function(){return m.ECIES_CONFIG}});var p=uo();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return p.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return p.PublicKey}}),e.utils={aesEncrypt:h.aesEncrypt,aesDecrypt:h.aesDecrypt,symEncrypt:h.symEncrypt,symDecrypt:h.symDecrypt,decodeHex:h.decodeHex,getValidSecret:h.getValidSecret,remove0x:h.remove0x}}(Kt)),Kt}var tn,fo;function ho(){if(fo)return tn;fo=1;function e(n,a=7){return n&&n.length>0?n.slice(0,a)+"\u2026":""}return tn=e,tn}var nn,po;function We(){if(po)return nn;po=1;const e=ho();class n{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",h=`[${i}] missing ${this.envFilepath} file (${this.filepath})`,r=`[${i}] https://github.com/dotenvx/dotenvx/issues/484`,t=new Error(h);return t.code=i,t.help=r,t}missingKey(){const i="MISSING_KEY",h=`[${i}] missing ${this.key} key`,r=new Error(h);return r.code=i,r}missingPrivateKey(){const i="MISSING_PRIVATE_KEY",h=`[${i}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,r=`[${i}] https://github.com/dotenvx/dotenvx/issues/464`,t=new Error(h);return t.code=i,t.help=r,t}invalidPrivateKey(){const i="INVALID_PRIVATE_KEY",h=`[${i}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,r=`[${i}] https://github.com/dotenvx/dotenvx/issues/465`,t=new Error(h);return t.code=i,t.help=r,t}looksWrongPrivateKey(){const i="WRONG_PRIVATE_KEY",h=`[${i}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,r=`[${i}] https://github.com/dotenvx/dotenvx/issues/466`,t=new Error(h);return t.code=i,t.help=r,t}malformedEncryptedData(){const i="MALFORMED_ENCRYPTED_DATA",h=`[${i}] could not decrypt ${this.key} because encrypted data appears malformed`,r=`[${i}] https://github.com/dotenvx/dotenvx/issues/467`,t=new Error(h);return t.code=i,t.help=r,t}decryptionFailed(){const i="DECRYPTION_FAILED",h=this.message,r=new Error(h);return r.code=i,r}commandSubstitutionFailed(){const i="COMMAND_SUBSTITUTION_FAILED",h=`[${i}] could not eval ${this.key} containing command '${this.command}': ${this.message}`,r=`[${i}] https://github.com/dotenvx/dotenvx/issues/532`,t=new Error(h);return t.code=i,t.help=r,t}}return nn=n,nn}var rn,yo;function vo(){if(yo)return rn;yo=1;const{decrypt:e}=en(),n=We(),a="encrypted:";function i(h,r,t,s){let d,m;if(!r.startsWith(a))return r;if(s=s||"",s.length<=0)m=new n({key:h,privateKeyName:t,privateKey:s}).missingPrivateKey();else{const p=s.split(",");for(const g of p){const l=Buffer.from(g,"hex"),S=r.substring(a.length),A=Buffer.from(S,"base64");try{d=e(l,A).toString(),m=null;break}catch(k){k.message==="Invalid private key"?m=new n({key:h,privateKeyName:t,privateKey:s}).invalidPrivateKey():k.message==="Unsupported state or unable to authenticate data"?m=new n({key:h,privateKeyName:t,privateKey:s}).looksWrongPrivateKey():k.message==="Point of length 65 was invalid. Expected 33 compressed bytes or 65 uncompressed bytes"?m=new n({key:h,privateKeyName:t,privateKey:s}).malformedEncryptedData():m=new n({key:h,privateKeyName:t,privateKey:s,message:k.message}).decryptionFailed()}}}if(m)throw m;return d}return rn=i,rn}var sn,go;function wc(){if(go)return sn;go=1;function e(n){return n.replace(/[\r\n]+$/,"")}return sn=e,sn}var on,mo;function xc(){if(mo)return on;mo=1;const{execSync:e}=zn,n=wc(),a=We();function i(h,r,t,s){return(r.match(/\$\(([^)]+(?:\)[^(]*)*)\)/g)||[]).reduce((m,p)=>{const g=p.slice(2,-1);let l;try{l=e(g,{env:{...t,...s}}).toString()}catch(S){throw new a({key:h,command:g,message:S.message.trim()}).commandSubstitutionFailed()}return l=n(l),m.replace(p,l)},r)}return on=i,on}var cn,bo;function Ac(){if(bo)return cn;bo=1;function e(n){return n.replace(/\\\$/g,"$")}return cn=e,cn}var an,Eo;function _o(){if(Eo)return an;Eo=1;const e=vo(),n=xc(),a=Ac();class i{static LINE=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;constructor(r,t=null,s=process.env,d=!1,m=null){this.src=r,this.privateKey=t,this.privateKeyName=m,this.processEnv=s,this.overload=d,this.parsed={},this.preExisted={},this.injected={},this.errors=[],this.runningParsed={},this.literals={}}run(){const r=this.getLines();let t;for(;(t=i.LINE.exec(r))!==null;){const s=t[1],d=t[2],m=this.quote(d);this.parsed[s]=this.clean(d,m),!this.overload&&this.inProcessEnv(s)&&(this.parsed[s]=this.processEnv[s]);try{this.parsed[s]=this.decrypt(s,this.parsed[s])}catch(g){this.errors.push(g)}let p=!1;if(m!=="'"&&(!this.inProcessEnv(s)||this.processEnv[s]===this.parsed[s])){const g=this.parsed[s];try{this.parsed[s]=this.eval(s,g)}catch(l){this.errors.push(l)}g!==this.parsed[s]&&(p=!0)}!p&&m!=="'"&&(!this.processEnv[s]||this.overload)&&(this.parsed[s]=a(this.expand(this.parsed[s]))),m==="'"&&(this.literals[s]=this.parsed[s]),this.runningParsed[s]=this.parsed[s],Object.prototype.hasOwnProperty.call(this.processEnv,s)&&!this.overload?this.preExisted[s]=this.processEnv[s]:this.injected[s]=this.parsed[s]}return{parsed:this.parsed,processEnv:this.processEnv,injected:this.injected,preExisted:this.preExisted,errors:this.errors}}trimmer(r){return(r||"").trim()}quote(r){const s=this.trimmer(r)[0];let d="";switch(s){case"'":d="'";break;case'"':d='"';break;case"`":d="`";break;default:d=""}return d}clean(r,t){let s=this.trimmer(r);return s=s.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),t==='"'&&(s=s.replace(/\\n/g,`
5
- `),s=s.replace(/\\r/g,"\r"),s=s.replace(/\\t/g," ")),s}decrypt(r,t){return e(r,t,this.privateKeyName,this.privateKey)}eval(r,t){return n(r,t,this.processEnv,this.runningParsed)}expand(r){let t={...this.runningParsed,...this.processEnv};this.overload&&(t={...this.processEnv,...this.runningParsed});const s=/(?<!\\)\${([^{}]+)}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g;let d=r,m;for(;(m=s.exec(d))!==null;){const[p,g,l]=m,S=g||l,A=/(:\+|\+|:-|-)/,k=S.match(A),v=k?k[0]:null,_=S.split(v);let R,P;const f=_.shift();if([":+","+"].includes(v)?(R=t[f]?_.join(v):"",P=null):(R=_.join(v),P=t[f]),P?d=d.replace(p,P):d=d.replace(p,R),d===t[f]||this.literals[f])break;s.lastIndex=0}return d}inProcessEnv(r){return Object.prototype.hasOwnProperty.call(this.processEnv,r)}getLines(){return(this.src||"").toString().replace(/\r\n?/mg,`
2
+ import{defineCommand as gi,runMain as mi}from"citty";import Be from"fs";import de from"path";import bi from"tty";import Zn from"os";import Ei from"crypto";import _i from"node:crypto";import zn from"child_process";import{isEqual as wi}from"es-toolkit";import{algoliasearch as xi}from"algoliasearch";const Ai="algolia-uploader",Si="0.0.5",Ri="command-line util to upload Algolia source";function Bi(e){return Be.readdirSync(e).filter(n=>n.endsWith(".json")).map(n=>{const a=Be.readFileSync(de.join(e,n),"utf8");return JSON.parse(a)})}function Xn(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var n=e.default;if(typeof n=="function"){var a=function i(){return this instanceof i?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};a.prototype=n.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var h=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(a,i,h.get?h:{enumerable:!0,get:function(){return e[i]}})}),a}var Qn={};const Jn="1.38.4",er="@dotenvx/dotenvx",tr="a better dotenv\u2013from the creator of `dotenv`",nr="@motdotla",rr=["dotenv","env"],sr="https://github.com/dotenvx/dotenvx",or={type:"git",url:"git+https://github.com/dotenvx/dotenvx.git"},ir="BSD-3-Clause",cr=["src/**/*","CHANGELOG.md"],ar="src/lib/main.js",ur="src/lib/main.d.ts",lr={".":{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"},fr={dotenvx:"./src/cli/dotenvx.js","git-dotenvx":"./src/cli/dotenvx.js"},dr={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"},hr="https://dotenvx.com",pr={commander:"^11.1.0",dotenv:"^16.4.5",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"},yr={"@yao-pkg/pkg":"^5.14.2","capture-console":"^1.0.2",esbuild:"^0.24.0",proxyquire:"^2.1.3",sinon:"^14.0.1",standard:"^17.1.0","standard-version":"^9.5.0",tap:"^21.0.1"},vr={access:"public",provenance:!0},Ii={version:Jn,name:er,description:tr,author:nr,keywords:rr,homepage:sr,repository:or,license:ir,files:cr,main:ar,types:ur,exports:lr,bin:fr,scripts:dr,funding:hr,dependencies:pr,devDependencies:yr,publishConfig:vr},Oi={__proto__:null,author:nr,bin:fr,default:Ii,dependencies:pr,description:tr,devDependencies:yr,exports:lr,files:cr,funding:hr,homepage:sr,keywords:rr,license:ir,main:ar,name:er,publishConfig:vr,repository:or,scripts:dr,types:ur,version:Jn},Ci=Xn(Oi);var wt,gr;function Pi(){if(gr)return wt;gr=1;const{name:e,version:n,description:a}=Ci;return wt={name:e,version:n,description:a},wt}var xt,mr;function Ti(){if(mr)return xt;mr=1;const{WriteStream:e}=bi;return xt={getColorDepth:()=>{try{return e.prototype.getColorDepth()}catch{const i=process.env.TERM;return i&&(i.includes("256color")||i.includes("xterm"))?8:4}}},xt}var At,br;function Er(){if(br)return At;br=1;const e=Ti(),n=new Map([["blue",34],["gray",37],["green",32],["olive",33],["orangered",31],["plum",35],["red",31],["electricblue",36],["dodgerblue",36]]),a=new Map([["blue",21],["gray",244],["green",34],["olive",142],["orangered",202],["plum",182],["red",196],["electricblue",45],["dodgerblue",33]]);function i(r){const t=e.getColorDepth();if(!a.has(r))throw new Error(`Invalid color ${r}`);if(t>=8){const s=a.get(r);return d=>`\x1B[38;5;${s}m${d}\x1B[39m`}if(t>=4){const s=n.get(r);return d=>`\x1B[${s}m${d}\x1B[39m`}return s=>s}function h(r){return e.getColorDepth()>=4?`\x1B[1m${r}\x1B[22m`:r}return At={getColor:i,bold:h},At}var St,_r;function wr(){if(_r)return St;_r=1;const e=Pi(),{getColor:n,bold:a}=Er(),i={error:0,errorv:0,errornocolor:0,warn:1,success:2,successv:2,info:2,help:2,blank:2,verbose:4,debug:5,silly:6},h=v=>a(n("red")(v)),r=n("orangered"),t=n("green"),s=n("olive"),d=n("dodgerblue"),m=n("plum"),p=n("plum");let g=i.info;function l(v,_){if(i[v]===void 0)throw new Error(`MISSING_LOG_LEVEL: '${v}'. implement in logger.`);if(i[v]<=g){const R=S(v,_);console.log(R)}}function S(v,_){const R=typeof _=="object"?JSON.stringify(_):_;switch(v.toLowerCase()){case"error":return h(R);case"errorv":return h(`[dotenvx@${e.version}] ${R}`);case"errornocolor":return R;case"warn":return r(R);case"success":return t(R);case"successv":return s(`[dotenvx@${e.version}] ${R}`);case"info":return R;case"help":return d(R);case"verbose":return m(R);case"debug":return p(R);case"blank":return R}}const A={level:"info",error:v=>l("error",v),errorv:v=>l("errorv",v),errornocolor:v=>l("errornocolor",v),warn:v=>l("warn",v),success:v=>l("success",v),successv:v=>l("successv",v),info:v=>l("info",v),help:v=>l("help",v),verbose:v=>l("verbose",v),debug:v=>l("debug",v),blank:v=>l("blank",v),setLevel:v=>{i[v]!==void 0&&(g=i[v],A.level=v)}};function j(v){const _=v.debug?"debug":v.verbose?"verbose":v.quiet?"error":v.logLevel;_&&(A.setLevel(_),(!v.quiet||v.quiet&&_!=="error")&&A.debug(`Setting log level to ${_}`))}return St={logger:A,getColor:n,setLogLevel:j,levels:i},St}var Ke={},Qe={},Je={},qe={},me={},Ie={},xr;function Ar(){if(xr)return Ie;xr=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.normalizePath=Ie.convertSlashes=Ie.cleanPath=void 0;const e=de;function n(r){let t=(0,e.normalize)(r);return t.length>1&&t[t.length-1]===e.sep&&(t=t.substring(0,t.length-1)),t}Ie.cleanPath=n;const a=/[\\/]/g;function i(r,t){return r.replace(a,t)}Ie.convertSlashes=i;function h(r,t){const{resolvePaths:s,normalizePath:d,pathSeparator:m}=t,p=process.platform==="win32"&&r.includes("/")||r.startsWith(".");if(s&&(r=(0,e.resolve)(r)),(d||p)&&(r=n(r)),r===".")return"";const g=r[r.length-1]!==m;return i(g?r+m:r,m)}return Ie.normalizePath=h,Ie}var Oe={},Sr;function Ni(){if(Sr)return Oe;Sr=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.build=Oe.joinDirectoryPath=Oe.joinPathWithBasePath=void 0;const e=de,n=Ar();function a(s,d){return d+s}Oe.joinPathWithBasePath=a;function i(s,d){return function(m,p){return p.startsWith(s)?p.replace(s,"")+m:(0,n.convertSlashes)((0,e.relative)(s,p),d.pathSeparator)+d.pathSeparator+m}}function h(s){return s}function r(s,d,m){return d+s+m}Oe.joinDirectoryPath=r;function t(s,d){const{relativePaths:m,includeBasePath:p}=d;return m&&s?i(s,d):p?a:h}return Oe.build=t,Oe}var et={},Rr;function Li(){if(Rr)return et;Rr=1,Object.defineProperty(et,"__esModule",{value:!0}),et.build=void 0;function e(t){return function(s,d){d.push(s.substring(t.length)||".")}}function n(t){return function(s,d,m){const p=s.substring(t.length)||".";m.every(g=>g(p,!0))&&d.push(p)}}const a=(t,s)=>{s.push(t||".")},i=(t,s,d)=>{const m=t||".";d.every(p=>p(m,!0))&&s.push(m)},h=()=>{};function r(t,s){const{includeDirs:d,filters:m,relativePaths:p}=s;return d?p?m&&m.length?n(t):e(t):m&&m.length?i:a:h}return et.build=r,et}var tt={},Br;function $i(){if(Br)return tt;Br=1,Object.defineProperty(tt,"__esModule",{value:!0}),tt.build=void 0;const e=(t,s,d,m)=>{m.every(p=>p(t,!1))&&d.files++},n=(t,s,d,m)=>{m.every(p=>p(t,!1))&&s.push(t)},a=(t,s,d,m)=>{d.files++},i=(t,s)=>{s.push(t)},h=()=>{};function r(t){const{excludeFiles:s,filters:d,onlyCounts:m}=t;return s?h:d&&d.length?m?e:n:m?a:i}return tt.build=r,tt}var nt={},Ir;function Di(){if(Ir)return nt;Ir=1,Object.defineProperty(nt,"__esModule",{value:!0}),nt.build=void 0;const e=i=>i,n=()=>[""].slice(0,0);function a(i){return i.group?n:e}return nt.build=a,nt}var rt={},Or;function Ki(){if(Or)return rt;Or=1,Object.defineProperty(rt,"__esModule",{value:!0}),rt.build=void 0;const e=(i,h,r)=>{i.push({directory:h,files:r,dir:h})},n=()=>{};function a(i){return i.group?e:n}return rt.build=a,rt}var He={},Cr;function qi(){if(Cr)return He;Cr=1;var e=He&&He.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(He,"__esModule",{value:!0}),He.build=void 0;const n=e(Be),a=de,i=function(d,m,p){const{queue:g,options:{suppressErrors:l}}=m;g.enqueue(),n.default.realpath(d,(S,A)=>{if(S)return g.dequeue(l?null:S,m);n.default.stat(A,(j,v)=>{if(j)return g.dequeue(l?null:j,m);if(v.isDirectory()&&t(d,A,m))return g.dequeue(null,m);p(v,A),g.dequeue(null,m)})})},h=function(d,m,p){const{queue:g,options:{suppressErrors:l}}=m;g.enqueue();try{const S=n.default.realpathSync(d),A=n.default.statSync(S);if(A.isDirectory()&&t(d,S,m))return;p(A,S)}catch(S){if(!l)throw S}};function r(d,m){return!d.resolveSymlinks||d.excludeSymlinks?null:m?h:i}He.build=r;function t(d,m,p){if(p.options.useRealPaths)return s(m,p);let g=(0,a.dirname)(d),l=1;for(;g!==p.root&&l<2;){const S=p.symlinks.get(g);!!S&&(S===m||S.startsWith(m)||m.startsWith(S))?l++:g=(0,a.dirname)(g)}return p.symlinks.set(d,m),l>1}function s(d,m){return m.visited.includes(d+m.options.pathSeparator)}return He}var st={},Pr;function Hi(){if(Pr)return st;Pr=1,Object.defineProperty(st,"__esModule",{value:!0}),st.build=void 0;const e=p=>p.counts,n=p=>p.groups,a=p=>p.paths,i=p=>p.paths.slice(0,p.options.maxFiles),h=(p,g,l)=>(d(g,l,p.counts,p.options.suppressErrors),null),r=(p,g,l)=>(d(g,l,p.paths,p.options.suppressErrors),null),t=(p,g,l)=>(d(g,l,p.paths.slice(0,p.options.maxFiles),p.options.suppressErrors),null),s=(p,g,l)=>(d(g,l,p.groups,p.options.suppressErrors),null);function d(p,g,l,S){g(p&&!S?p:null,l)}function m(p,g){const{onlyCounts:l,group:S,maxFiles:A}=p;return l?g?e:h:S?g?n:s:A?g?i:t:g?a:r}return st.build=m,st}var je={},Tr;function ji(){if(Tr)return je;Tr=1;var e=je&&je.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(je,"__esModule",{value:!0}),je.build=void 0;const n=e(Be),a={withFileTypes:!0},i=(t,s,d,m,p)=>{if(m<0)return t.queue.dequeue(null,t);t.visited.push(s),t.counts.directories++,t.queue.enqueue(),n.default.readdir(s||".",a,(g,l=[])=>{p(l,d,m),t.queue.dequeue(t.options.suppressErrors?null:g,t)})},h=(t,s,d,m,p)=>{if(m<0)return;t.visited.push(s),t.counts.directories++;let g=[];try{g=n.default.readdirSync(s||".",a)}catch(l){if(!t.options.suppressErrors)throw l}p(g,d,m)};function r(t){return t?h:i}return je.build=r,je}var ot={},Nr;function ki(){if(Nr)return ot;Nr=1,Object.defineProperty(ot,"__esModule",{value:!0}),ot.Queue=void 0;class e{onQueueEmpty;count=0;constructor(a){this.onQueueEmpty=a}enqueue(){this.count++}dequeue(a,i){(--this.count<=0||a)&&this.onQueueEmpty(a,i)}}return ot.Queue=e,ot}var it={},Lr;function Fi(){if(Lr)return it;Lr=1,Object.defineProperty(it,"__esModule",{value:!0}),it.Counter=void 0;class e{_files=0;_directories=0;set files(a){this._files=a}get files(){return this._files}set directories(a){this._directories=a}get directories(){return this._directories}get dirs(){return this._directories}}return it.Counter=e,it}var $r;function Dr(){if($r)return me;$r=1;var e=me&&me.__createBinding||(Object.create?function(v,_,R,P){P===void 0&&(P=R);var f=Object.getOwnPropertyDescriptor(_,R);(!f||("get"in f?!_.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return _[R]}}),Object.defineProperty(v,P,f)}:function(v,_,R,P){P===void 0&&(P=R),v[P]=_[R]}),n=me&&me.__setModuleDefault||(Object.create?function(v,_){Object.defineProperty(v,"default",{enumerable:!0,value:_})}:function(v,_){v.default=_}),a=me&&me.__importStar||function(v){if(v&&v.__esModule)return v;var _={};if(v!=null)for(var R in v)R!=="default"&&Object.prototype.hasOwnProperty.call(v,R)&&e(_,v,R);return n(_,v),_};Object.defineProperty(me,"__esModule",{value:!0}),me.Walker=void 0;const i=de,h=Ar(),r=a(Ni()),t=a(Li()),s=a($i()),d=a(Di()),m=a(Ki()),p=a(qi()),g=a(Hi()),l=a(ji()),S=ki(),A=Fi();class j{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(_,R,P){this.isSynchronous=!P,this.callbackInvoker=g.build(R,this.isSynchronous),this.root=(0,h.normalizePath)(_,R),this.state={root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new A.Counter,options:R,queue:new S.Queue((f,y)=>this.callbackInvoker(y,f,P)),symlinks:new Map,visited:[""].slice(0,0)},this.joinPath=r.build(this.root,R),this.pushDirectory=t.build(this.root,R),this.pushFile=s.build(R),this.getArray=d.build(R),this.groupFiles=m.build(R),this.resolveSymlink=p.build(R,this.isSynchronous),this.walkDirectory=l.build(this.isSynchronous)}start(){return this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(_,R,P)=>{const{paths:f,options:{filters:y,resolveSymlinks:c,excludeSymlinks:q,exclude:D,maxFiles:$,signal:H,useRealPaths:E,pathSeparator:I}}=this.state;if(H&&H.aborted||$&&f.length>$)return;this.pushDirectory(R,f,y);const k=this.getArray(this.state.paths);for(let u=0;u<_.length;++u){const N=_[u];if(N.isFile()||N.isSymbolicLink()&&!c&&!q){const b=this.joinPath(N.name,R);this.pushFile(b,k,this.state.counts,y)}else if(N.isDirectory()){let b=r.joinDirectoryPath(N.name,R,this.state.options.pathSeparator);if(D&&D(N.name,b))continue;this.walkDirectory(this.state,b,b,P-1,this.walk)}else if(N.isSymbolicLink()&&this.resolveSymlink){let b=r.joinPathWithBasePath(N.name,R);this.resolveSymlink(b,this.state,(B,T)=>{if(B.isDirectory()){if(T=(0,h.normalizePath)(T,this.state.options),D&&D(N.name,E?T:b+I))return;this.walkDirectory(this.state,T,E?T:b+I,P-1,this.walk)}else{T=E?T:b;const L=(0,i.basename)(T),o=(0,h.normalizePath)((0,i.dirname)(T),this.state.options);T=this.joinPath(L,o),this.pushFile(T,k,this.state.counts,y)}})}}this.groupFiles(this.state.groups,R,k)}}return me.Walker=j,me}var Kr;function Mi(){if(Kr)return qe;Kr=1,Object.defineProperty(qe,"__esModule",{value:!0}),qe.callback=qe.promise=void 0;const e=Dr();function n(i,h){return new Promise((r,t)=>{a(i,h,(s,d)=>{if(s)return t(s);r(d)})})}qe.promise=n;function a(i,h,r){new e.Walker(i,h,r).start()}return qe.callback=a,qe}var ct={},qr;function Vi(){if(qr)return ct;qr=1,Object.defineProperty(ct,"__esModule",{value:!0}),ct.sync=void 0;const e=Dr();function n(a,i){return new e.Walker(a,i).start()}return ct.sync=n,ct}var Hr;function Ui(){if(Hr)return Je;Hr=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.APIBuilder=void 0;const e=Mi(),n=Vi();class a{root;options;constructor(h,r){this.root=h,this.options=r}withPromise(){return(0,e.promise)(this.root,this.options)}withCallback(h){(0,e.callback)(this.root,this.options,h)}sync(){return(0,n.sync)(this.root,this.options)}}return Je.APIBuilder=a,Je}var Rt={},Bt,jr;function vt(){if(jr)return Bt;jr=1;const e="\\\\/",n=`[^${e}]`,a="\\.",i="\\+",h="\\?",r="\\/",t="(?=.)",s="[^/]",d=`(?:${r}|$)`,m=`(?:^|${r})`,p=`${a}{1,2}${d}`,g=`(?!${a})`,l=`(?!${m}${p})`,S=`(?!${a}{0,1}${d})`,A=`(?!${p})`,j=`[^.${r}]`,v=`${s}*?`,R={DOT_LITERAL:a,PLUS_LITERAL:i,QMARK_LITERAL:h,SLASH_LITERAL:r,ONE_CHAR:t,QMARK:s,END_ANCHOR:d,DOTS_SLASH:p,NO_DOT:g,NO_DOTS:l,NO_DOT_SLASH:S,NO_DOTS_SLASH:A,QMARK_NO_DOT:j,STAR:v,START_ANCHOR:m,SEP:"/"},P={...R,SLASH_LITERAL:`[${e}]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`${a}{1,2}(?:[${e}]|$)`,NO_DOT:`(?!${a})`,NO_DOTS:`(?!(?:^|[${e}])${a}{1,2}(?:[${e}]|$))`,NO_DOT_SLASH:`(?!${a}{0,1}(?:[${e}]|$))`,NO_DOTS_SLASH:`(?!${a}{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:{"***":"*","**/**":"**","**/**/**":"**"},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(y){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${y.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(y){return y===!0?P:R}},Bt}var kr;function gt(){return kr||(kr=1,function(e){const{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:a,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:h}=vt();e.isObject=r=>r!==null&&typeof r=="object"&&!Array.isArray(r),e.hasRegexChars=r=>i.test(r),e.isRegexChar=r=>r.length===1&&e.hasRegexChars(r),e.escapeRegex=r=>r.replace(h,"\\$1"),e.toPosixSlashes=r=>r.replace(n,"/"),e.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const r=navigator.platform.toLowerCase();return r==="win32"||r==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1},e.removeBackslashes=r=>r.replace(a,t=>t==="\\"?"":t),e.escapeLast=(r,t,s)=>{const d=r.lastIndexOf(t,s);return d===-1?r:r[d-1]==="\\"?e.escapeLast(r,t,d-1):`${r.slice(0,d)}\\${r.slice(d)}`},e.removePrefix=(r,t={})=>{let s=r;return s.startsWith("./")&&(s=s.slice(2),t.prefix="./"),s},e.wrapOutput=(r,t={},s={})=>{const d=s.contains?"":"^",m=s.contains?"":"$";let p=`${d}(?:${r})${m}`;return t.negated===!0&&(p=`(?:^(?!${p}).*$)`),p},e.basename=(r,{windows:t}={})=>{const s=r.split(t?/[\\/]/:"/"),d=s[s.length-1];return d===""?s[s.length-2]:d}}(Rt)),Rt}var It,Fr;function Gi(){if(Fr)return It;Fr=1;const e=gt(),{CHAR_ASTERISK:n,CHAR_AT:a,CHAR_BACKWARD_SLASH:i,CHAR_COMMA:h,CHAR_DOT:r,CHAR_EXCLAMATION_MARK:t,CHAR_FORWARD_SLASH:s,CHAR_LEFT_CURLY_BRACE:d,CHAR_LEFT_PARENTHESES:m,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_PLUS:g,CHAR_QUESTION_MARK:l,CHAR_RIGHT_CURLY_BRACE:S,CHAR_RIGHT_PARENTHESES:A,CHAR_RIGHT_SQUARE_BRACKET:j}=vt(),v=P=>P===s||P===i,_=P=>{P.isPrefix!==!0&&(P.depth=P.isGlobstar?1/0:1)};return It=(P,f)=>{const y=f||{},c=P.length-1,q=y.parts===!0||y.scanToEnd===!0,D=[],$=[],H=[];let E=P,I=-1,k=0,u=0,N=!1,b=!1,B=!1,T=!1,L=!1,o=!1,w=!1,C=!1,G=!1,x=!1,K=0,te,M,O={value:"",depth:0,isGlob:!1};const F=()=>I>=c,Z=()=>E.charCodeAt(I+1),W=()=>(te=M,E.charCodeAt(++I));for(;I<c;){M=W();let z;if(M===i){w=O.backslashes=!0,M=W(),M===d&&(o=!0);continue}if(o===!0||M===d){for(K++;F()!==!0&&(M=W());){if(M===i){w=O.backslashes=!0,W();continue}if(M===d){K++;continue}if(o!==!0&&M===r&&(M=W())===r){if(N=O.isBrace=!0,B=O.isGlob=!0,x=!0,q===!0)continue;break}if(o!==!0&&M===h){if(N=O.isBrace=!0,B=O.isGlob=!0,x=!0,q===!0)continue;break}if(M===S&&(K--,K===0)){o=!1,N=O.isBrace=!0,x=!0;break}}if(q===!0)continue;break}if(M===s){if(D.push(I),$.push(O),O={value:"",depth:0,isGlob:!1},x===!0)continue;if(te===r&&I===k+1){k+=2;continue}u=I+1;continue}if(y.noext!==!0&&(M===g||M===a||M===n||M===l||M===t)===!0&&Z()===m){if(B=O.isGlob=!0,T=O.isExtglob=!0,x=!0,M===t&&I===k&&(G=!0),q===!0){for(;F()!==!0&&(M=W());){if(M===i){w=O.backslashes=!0,M=W();continue}if(M===A){B=O.isGlob=!0,x=!0;break}}continue}break}if(M===n){if(te===n&&(L=O.isGlobstar=!0),B=O.isGlob=!0,x=!0,q===!0)continue;break}if(M===l){if(B=O.isGlob=!0,x=!0,q===!0)continue;break}if(M===p){for(;F()!==!0&&(z=W());){if(z===i){w=O.backslashes=!0,W();continue}if(z===j){b=O.isBracket=!0,B=O.isGlob=!0,x=!0;break}}if(q===!0)continue;break}if(y.nonegate!==!0&&M===t&&I===k){C=O.negated=!0,k++;continue}if(y.noparen!==!0&&M===m){if(B=O.isGlob=!0,q===!0){for(;F()!==!0&&(M=W());){if(M===m){w=O.backslashes=!0,M=W();continue}if(M===A){x=!0;break}}continue}break}if(B===!0){if(x=!0,q===!0)continue;break}}y.noext===!0&&(T=!1,B=!1);let J=E,Q="",V="";k>0&&(Q=E.slice(0,k),E=E.slice(k),u-=k),J&&B===!0&&u>0?(J=E.slice(0,u),V=E.slice(u)):B===!0?(J="",V=E):J=E,J&&J!==""&&J!=="/"&&J!==E&&v(J.charCodeAt(J.length-1))&&(J=J.slice(0,-1)),y.unescape===!0&&(V&&(V=e.removeBackslashes(V)),J&&w===!0&&(J=e.removeBackslashes(J)));const U={prefix:Q,input:P,start:k,base:J,glob:V,isBrace:N,isBracket:b,isGlob:B,isExtglob:T,isGlobstar:L,negated:C,negatedExtglob:G};if(y.tokens===!0&&(U.maxDepth=0,v(M)||$.push(O),U.tokens=$),y.parts===!0||y.tokens===!0){let z;for(let ee=0;ee<D.length;ee++){const Y=z?z+1:k,re=D[ee],X=P.slice(Y,re);y.tokens&&(ee===0&&k!==0?($[ee].isPrefix=!0,$[ee].value=Q):$[ee].value=X,_($[ee]),U.maxDepth+=$[ee].depth),(ee!==0||X!=="")&&H.push(X),z=re}if(z&&z+1<P.length){const ee=P.slice(z+1);H.push(ee),y.tokens&&($[$.length-1].value=ee,_($[$.length-1]),U.maxDepth+=$[$.length-1].depth)}U.slashes=D,U.parts=H}return U},It}var Ot,Mr;function Yi(){if(Mr)return Ot;Mr=1;const e=vt(),n=gt(),{MAX_LENGTH:a,POSIX_REGEX_SOURCE:i,REGEX_NON_SPECIAL_CHARS:h,REGEX_SPECIAL_CHARS_BACKREF:r,REPLACEMENTS:t}=e,s=(p,g)=>{if(typeof g.expandRange=="function")return g.expandRange(...p,g);p.sort();const l=`[${p.join("-")}]`;try{new RegExp(l)}catch{return p.map(A=>n.escapeRegex(A)).join("..")}return l},d=(p,g)=>`Missing ${p}: "${g}" - use "\\\\${g}" to match literal characters`,m=(p,g)=>{if(typeof p!="string")throw new TypeError("Expected a string");p=t[p]||p;const l={...g},S=typeof l.maxLength=="number"?Math.min(a,l.maxLength):a;let A=p.length;if(A>S)throw new SyntaxError(`Input length: ${A}, exceeds maximum allowed length: ${S}`);const j={type:"bos",value:"",output:l.prepend||""},v=[j],_=l.capture?"":"?:",R=e.globChars(l.windows),P=e.extglobChars(R),{DOT_LITERAL:f,PLUS_LITERAL:y,SLASH_LITERAL:c,ONE_CHAR:q,DOTS_SLASH:D,NO_DOT:$,NO_DOT_SLASH:H,NO_DOTS_SLASH:E,QMARK:I,QMARK_NO_DOT:k,STAR:u,START_ANCHOR:N}=R,b=Y=>`(${_}(?:(?!${N}${Y.dot?D:f}).)*?)`,B=l.dot?"":$,T=l.dot?I:k;let L=l.bash===!0?b(l):u;l.capture&&(L=`(${L})`),typeof l.noext=="boolean"&&(l.noextglob=l.noext);const o={input:p,index:-1,start:0,dot:l.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:v};p=n.removePrefix(p,o),A=p.length;const w=[],C=[],G=[];let x=j,K;const te=()=>o.index===A-1,M=o.peek=(Y=1)=>p[o.index+Y],O=o.advance=()=>p[++o.index]||"",F=()=>p.slice(o.index+1),Z=(Y="",re=0)=>{o.consumed+=Y,o.index+=re},W=Y=>{o.output+=Y.output!=null?Y.output:Y.value,Z(Y.value)},J=()=>{let Y=1;for(;M()==="!"&&(M(2)!=="("||M(3)==="?");)O(),o.start++,Y++;return Y%2===0?!1:(o.negated=!0,o.start++,!0)},Q=Y=>{o[Y]++,G.push(Y)},V=Y=>{o[Y]--,G.pop()},U=Y=>{if(x.type==="globstar"){const re=o.braces>0&&(Y.type==="comma"||Y.type==="brace"),X=Y.extglob===!0||w.length&&(Y.type==="pipe"||Y.type==="paren");Y.type!=="slash"&&Y.type!=="paren"&&!re&&!X&&(o.output=o.output.slice(0,-x.output.length),x.type="star",x.value="*",x.output=L,o.output+=x.output)}if(w.length&&Y.type!=="paren"&&(w[w.length-1].inner+=Y.value),(Y.value||Y.output)&&W(Y),x&&x.type==="text"&&Y.type==="text"){x.output=(x.output||x.value)+Y.value,x.value+=Y.value;return}Y.prev=x,v.push(Y),x=Y},z=(Y,re)=>{const X={...P[re],conditions:1,inner:""};X.prev=x,X.parens=o.parens,X.output=o.output;const ne=(l.capture?"(":"")+X.open;Q("parens"),U({type:Y,value:re,output:o.output?"":q}),U({type:"paren",extglob:!0,value:O(),output:ne}),w.push(X)},ee=Y=>{let re=Y.close+(l.capture?")":""),X;if(Y.type==="negate"){let ne=L;if(Y.inner&&Y.inner.length>1&&Y.inner.includes("/")&&(ne=b(l)),(ne!==L||te()||/^\)+$/.test(F()))&&(re=Y.close=`)$))${ne}`),Y.inner.includes("*")&&(X=F())&&/^\.[^\\/.]+$/.test(X)){const se=m(X,{...g,fastpaths:!1}).output;re=Y.close=`)${se})${ne})`}Y.prev.type==="bos"&&(o.negatedExtglob=!0)}U({type:"paren",extglob:!0,value:K,output:re}),V("parens")};if(l.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(p)){let Y=!1,re=p.replace(r,(X,ne,se,oe,ie,fe)=>oe==="\\"?(Y=!0,X):oe==="?"?ne?ne+oe+(ie?I.repeat(ie.length):""):fe===0?T+(ie?I.repeat(ie.length):""):I.repeat(se.length):oe==="."?f.repeat(se.length):oe==="*"?ne?ne+oe+(ie?L:""):L:ne?X:`\\${X}`);return Y===!0&&(l.unescape===!0?re=re.replace(/\\/g,""):re=re.replace(/\\+/g,X=>X.length%2===0?"\\\\":X?"\\":"")),re===p&&l.contains===!0?(o.output=p,o):(o.output=n.wrapOutput(re,o,g),o)}for(;!te();){if(K=O(),K==="\0")continue;if(K==="\\"){const X=M();if(X==="/"&&l.bash!==!0||X==="."||X===";")continue;if(!X){K+="\\",U({type:"text",value:K});continue}const ne=/^\\+/.exec(F());let se=0;if(ne&&ne[0].length>2&&(se=ne[0].length,o.index+=se,se%2!==0&&(K+="\\")),l.unescape===!0?K=O():K+=O(),o.brackets===0){U({type:"text",value:K});continue}}if(o.brackets>0&&(K!=="]"||x.value==="["||x.value==="[^")){if(l.posix!==!1&&K===":"){const X=x.value.slice(1);if(X.includes("[")&&(x.posix=!0,X.includes(":"))){const ne=x.value.lastIndexOf("["),se=x.value.slice(0,ne),oe=x.value.slice(ne+2),ie=i[oe];if(ie){x.value=se+ie,o.backtrack=!0,O(),!j.output&&v.indexOf(x)===1&&(j.output=q);continue}}}(K==="["&&M()!==":"||K==="-"&&M()==="]")&&(K=`\\${K}`),K==="]"&&(x.value==="["||x.value==="[^")&&(K=`\\${K}`),l.posix===!0&&K==="!"&&x.value==="["&&(K="^"),x.value+=K,W({value:K});continue}if(o.quotes===1&&K!=='"'){K=n.escapeRegex(K),x.value+=K,W({value:K});continue}if(K==='"'){o.quotes=o.quotes===1?0:1,l.keepQuotes===!0&&U({type:"text",value:K});continue}if(K==="("){Q("parens"),U({type:"paren",value:K});continue}if(K===")"){if(o.parens===0&&l.strictBrackets===!0)throw new SyntaxError(d("opening","("));const X=w[w.length-1];if(X&&o.parens===X.parens+1){ee(w.pop());continue}U({type:"paren",value:K,output:o.parens?")":"\\)"}),V("parens");continue}if(K==="["){if(l.nobracket===!0||!F().includes("]")){if(l.nobracket!==!0&&l.strictBrackets===!0)throw new SyntaxError(d("closing","]"));K=`\\${K}`}else Q("brackets");U({type:"bracket",value:K});continue}if(K==="]"){if(l.nobracket===!0||x&&x.type==="bracket"&&x.value.length===1){U({type:"text",value:K,output:`\\${K}`});continue}if(o.brackets===0){if(l.strictBrackets===!0)throw new SyntaxError(d("opening","["));U({type:"text",value:K,output:`\\${K}`});continue}V("brackets");const X=x.value.slice(1);if(x.posix!==!0&&X[0]==="^"&&!X.includes("/")&&(K=`/${K}`),x.value+=K,W({value:K}),l.literalBrackets===!1||n.hasRegexChars(X))continue;const ne=n.escapeRegex(x.value);if(o.output=o.output.slice(0,-x.value.length),l.literalBrackets===!0){o.output+=ne,x.value=ne;continue}x.value=`(${_}${ne}|${x.value})`,o.output+=x.value;continue}if(K==="{"&&l.nobrace!==!0){Q("braces");const X={type:"brace",value:K,output:"(",outputIndex:o.output.length,tokensIndex:o.tokens.length};C.push(X),U(X);continue}if(K==="}"){const X=C[C.length-1];if(l.nobrace===!0||!X){U({type:"text",value:K,output:K});continue}let ne=")";if(X.dots===!0){const se=v.slice(),oe=[];for(let ie=se.length-1;ie>=0&&(v.pop(),se[ie].type!=="brace");ie--)se[ie].type!=="dots"&&oe.unshift(se[ie].value);ne=s(oe,l),o.backtrack=!0}if(X.comma!==!0&&X.dots!==!0){const se=o.output.slice(0,X.outputIndex),oe=o.tokens.slice(X.tokensIndex);X.value=X.output="\\{",K=ne="\\}",o.output=se;for(const ie of oe)o.output+=ie.output||ie.value}U({type:"brace",value:K,output:ne}),V("braces"),C.pop();continue}if(K==="|"){w.length>0&&w[w.length-1].conditions++,U({type:"text",value:K});continue}if(K===","){let X=K;const ne=C[C.length-1];ne&&G[G.length-1]==="braces"&&(ne.comma=!0,X="|"),U({type:"comma",value:K,output:X});continue}if(K==="/"){if(x.type==="dot"&&o.index===o.start+1){o.start=o.index+1,o.consumed="",o.output="",v.pop(),x=j;continue}U({type:"slash",value:K,output:c});continue}if(K==="."){if(o.braces>0&&x.type==="dot"){x.value==="."&&(x.output=f);const X=C[C.length-1];x.type="dots",x.output+=K,x.value+=K,X.dots=!0;continue}if(o.braces+o.parens===0&&x.type!=="bos"&&x.type!=="slash"){U({type:"text",value:K,output:f});continue}U({type:"dot",value:K,output:f});continue}if(K==="?"){if(!(x&&x.value==="(")&&l.noextglob!==!0&&M()==="("&&M(2)!=="?"){z("qmark",K);continue}if(x&&x.type==="paren"){const ne=M();let se=K;(x.value==="("&&!/[!=<:]/.test(ne)||ne==="<"&&!/<([!=]|\w+>)/.test(F()))&&(se=`\\${K}`),U({type:"text",value:K,output:se});continue}if(l.dot!==!0&&(x.type==="slash"||x.type==="bos")){U({type:"qmark",value:K,output:k});continue}U({type:"qmark",value:K,output:I});continue}if(K==="!"){if(l.noextglob!==!0&&M()==="("&&(M(2)!=="?"||!/[!=<:]/.test(M(3)))){z("negate",K);continue}if(l.nonegate!==!0&&o.index===0){J();continue}}if(K==="+"){if(l.noextglob!==!0&&M()==="("&&M(2)!=="?"){z("plus",K);continue}if(x&&x.value==="("||l.regex===!1){U({type:"plus",value:K,output:y});continue}if(x&&(x.type==="bracket"||x.type==="paren"||x.type==="brace")||o.parens>0){U({type:"plus",value:K});continue}U({type:"plus",value:y});continue}if(K==="@"){if(l.noextglob!==!0&&M()==="("&&M(2)!=="?"){U({type:"at",extglob:!0,value:K,output:""});continue}U({type:"text",value:K});continue}if(K!=="*"){(K==="$"||K==="^")&&(K=`\\${K}`);const X=h.exec(F());X&&(K+=X[0],o.index+=X[0].length),U({type:"text",value:K});continue}if(x&&(x.type==="globstar"||x.star===!0)){x.type="star",x.star=!0,x.value+=K,x.output=L,o.backtrack=!0,o.globstar=!0,Z(K);continue}let Y=F();if(l.noextglob!==!0&&/^\([^?]/.test(Y)){z("star",K);continue}if(x.type==="star"){if(l.noglobstar===!0){Z(K);continue}const X=x.prev,ne=X.prev,se=X.type==="slash"||X.type==="bos",oe=ne&&(ne.type==="star"||ne.type==="globstar");if(l.bash===!0&&(!se||Y[0]&&Y[0]!=="/")){U({type:"star",value:K,output:""});continue}const ie=o.braces>0&&(X.type==="comma"||X.type==="brace"),fe=w.length&&(X.type==="pipe"||X.type==="paren");if(!se&&X.type!=="paren"&&!ie&&!fe){U({type:"star",value:K,output:""});continue}for(;Y.slice(0,3)==="/**";){const le=p[o.index+4];if(le&&le!=="/")break;Y=Y.slice(3),Z("/**",3)}if(X.type==="bos"&&te()){x.type="globstar",x.value+=K,x.output=b(l),o.output=x.output,o.globstar=!0,Z(K);continue}if(X.type==="slash"&&X.prev.type!=="bos"&&!oe&&te()){o.output=o.output.slice(0,-(X.output+x.output).length),X.output=`(?:${X.output}`,x.type="globstar",x.output=b(l)+(l.strictSlashes?")":"|$)"),x.value+=K,o.globstar=!0,o.output+=X.output+x.output,Z(K);continue}if(X.type==="slash"&&X.prev.type!=="bos"&&Y[0]==="/"){const le=Y[1]!==void 0?"|$":"";o.output=o.output.slice(0,-(X.output+x.output).length),X.output=`(?:${X.output}`,x.type="globstar",x.output=`${b(l)}${c}|${c}${le})`,x.value+=K,o.output+=X.output+x.output,o.globstar=!0,Z(K+O()),U({type:"slash",value:"/",output:""});continue}if(X.type==="bos"&&Y[0]==="/"){x.type="globstar",x.value+=K,x.output=`(?:^|${c}|${b(l)}${c})`,o.output=x.output,o.globstar=!0,Z(K+O()),U({type:"slash",value:"/",output:""});continue}o.output=o.output.slice(0,-x.output.length),x.type="globstar",x.output=b(l),x.value+=K,o.output+=x.output,o.globstar=!0,Z(K);continue}const re={type:"star",value:K,output:L};if(l.bash===!0){re.output=".*?",(x.type==="bos"||x.type==="slash")&&(re.output=B+re.output),U(re);continue}if(x&&(x.type==="bracket"||x.type==="paren")&&l.regex===!0){re.output=K,U(re);continue}(o.index===o.start||x.type==="slash"||x.type==="dot")&&(x.type==="dot"?(o.output+=H,x.output+=H):l.dot===!0?(o.output+=E,x.output+=E):(o.output+=B,x.output+=B),M()!=="*"&&(o.output+=q,x.output+=q)),U(re)}for(;o.brackets>0;){if(l.strictBrackets===!0)throw new SyntaxError(d("closing","]"));o.output=n.escapeLast(o.output,"["),V("brackets")}for(;o.parens>0;){if(l.strictBrackets===!0)throw new SyntaxError(d("closing",")"));o.output=n.escapeLast(o.output,"("),V("parens")}for(;o.braces>0;){if(l.strictBrackets===!0)throw new SyntaxError(d("closing","}"));o.output=n.escapeLast(o.output,"{"),V("braces")}if(l.strictSlashes!==!0&&(x.type==="star"||x.type==="bracket")&&U({type:"maybe_slash",value:"",output:`${c}?`}),o.backtrack===!0){o.output="";for(const Y of o.tokens)o.output+=Y.output!=null?Y.output:Y.value,Y.suffix&&(o.output+=Y.suffix)}return o};return m.fastpaths=(p,g)=>{const l={...g},S=typeof l.maxLength=="number"?Math.min(a,l.maxLength):a,A=p.length;if(A>S)throw new SyntaxError(`Input length: ${A}, exceeds maximum allowed length: ${S}`);p=t[p]||p;const{DOT_LITERAL:j,SLASH_LITERAL:v,ONE_CHAR:_,DOTS_SLASH:R,NO_DOT:P,NO_DOTS:f,NO_DOTS_SLASH:y,STAR:c,START_ANCHOR:q}=e.globChars(l.windows),D=l.dot?f:P,$=l.dot?y:P,H=l.capture?"":"?:",E={negated:!1,prefix:""};let I=l.bash===!0?".*?":c;l.capture&&(I=`(${I})`);const k=B=>B.noglobstar===!0?I:`(${H}(?:(?!${q}${B.dot?R:j}).)*?)`,u=B=>{switch(B){case"*":return`${D}${_}${I}`;case".*":return`${j}${_}${I}`;case"*.*":return`${D}${I}${j}${_}${I}`;case"*/*":return`${D}${I}${v}${_}${$}${I}`;case"**":return D+k(l);case"**/*":return`(?:${D}${k(l)}${v})?${$}${_}${I}`;case"**/*.*":return`(?:${D}${k(l)}${v})?${$}${I}${j}${_}${I}`;case"**/.*":return`(?:${D}${k(l)}${v})?${j}${_}${I}`;default:{const T=/^(.*?)\.(\w+)$/.exec(B);if(!T)return;const L=u(T[1]);return L?L+j+T[2]:void 0}}},N=n.removePrefix(p,E);let b=u(N);return b&&l.strictSlashes!==!0&&(b+=`${v}?`),b},Ot=m,Ot}var Ct,Vr;function Wi(){if(Vr)return Ct;Vr=1;const e=Gi(),n=Yi(),a=gt(),i=vt(),h=t=>t&&typeof t=="object"&&!Array.isArray(t),r=(t,s,d=!1)=>{if(Array.isArray(t)){const v=t.map(R=>r(R,s,d));return R=>{for(const P of v){const f=P(R);if(f)return f}return!1}}const m=h(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!m)throw new TypeError("Expected pattern to be a non-empty string");const p=s||{},g=p.windows,l=m?r.compileRe(t,s):r.makeRe(t,s,!1,!0),S=l.state;delete l.state;let A=()=>!1;if(p.ignore){const v={...s,ignore:null,onMatch:null,onResult:null};A=r(p.ignore,v,d)}const j=(v,_=!1)=>{const{isMatch:R,match:P,output:f}=r.test(v,l,s,{glob:t,posix:g}),y={glob:t,state:S,regex:l,posix:g,input:v,output:f,match:P,isMatch:R};return typeof p.onResult=="function"&&p.onResult(y),R===!1?(y.isMatch=!1,_?y:!1):A(v)?(typeof p.onIgnore=="function"&&p.onIgnore(y),y.isMatch=!1,_?y:!1):(typeof p.onMatch=="function"&&p.onMatch(y),_?y:!0)};return d&&(j.state=S),j};return r.test=(t,s,d,{glob:m,posix:p}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};const g=d||{},l=g.format||(p?a.toPosixSlashes:null);let S=t===m,A=S&&l?l(t):t;return S===!1&&(A=l?l(t):t,S=A===m),(S===!1||g.capture===!0)&&(g.matchBase===!0||g.basename===!0?S=r.matchBase(t,s,d,p):S=s.exec(A)),{isMatch:!!S,match:S,output:A}},r.matchBase=(t,s,d)=>(s instanceof RegExp?s:r.makeRe(s,d)).test(a.basename(t)),r.isMatch=(t,s,d)=>r(s,d)(t),r.parse=(t,s)=>Array.isArray(t)?t.map(d=>r.parse(d,s)):n(t,{...s,fastpaths:!1}),r.scan=(t,s)=>e(t,s),r.compileRe=(t,s,d=!1,m=!1)=>{if(d===!0)return t.output;const p=s||{},g=p.contains?"":"^",l=p.contains?"":"$";let S=`${g}(?:${t.output})${l}`;t&&t.negated===!0&&(S=`^(?!${S}).*$`);const A=r.toRegex(S,s);return m===!0&&(A.state=t),A},r.makeRe=(t,s={},d=!1,m=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let p={negated:!1,fastpaths:!0};return s.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(p.output=n.fastpaths(t,s)),p.output||(p=n(t,s)),r.compileRe(p,s,d,m)},r.toRegex=(t,s)=>{try{const d=s||{};return new RegExp(t,d.flags||(d.nocase?"i":""))}catch(d){if(s&&s.debug===!0)throw d;return/$^/}},r.constants=i,Ct=r,Ct}var Pt,Ur;function Gr(){if(Ur)return Pt;Ur=1;const e=Wi(),n=gt();function a(i,h,r=!1){return h&&(h.windows===null||h.windows===void 0)&&(h={...h,windows:n.isWindows()}),e(i,h,r)}return Object.assign(a,e),Pt=a,Pt}var Yr;function Zi(){if(Yr)return Qe;Yr=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.Builder=void 0;const e=de,n=Ui();var a=null;try{require.resolve("picomatch"),a=Gr()}catch{}class i{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:e.sep,filters:[]};globFunction;constructor(r){this.options={...this.options,...r},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(r){return this.options.pathSeparator=r,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(r){return this.options.maxDepth=r,this}withMaxFiles(r){return this.options.maxFiles=r,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:r=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=r,this.withFullPaths()}withAbortSignal(r){return this.options.signal=r,this}normalize(){return this.options.normalizePath=!0,this}filter(r){return this.options.filters.push(r),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(r){return this.options.exclude=r,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(r){return new n.APIBuilder(r||".",this.options)}withGlobFunction(r){return this.globFunction=r,this}crawlWithOptions(r,t){return this.options={...this.options,...t},new n.APIBuilder(r||".",this.options)}glob(...r){return this.globFunction?this.globWithOptions(r):this.globWithOptions(r,{dot:!0})}globWithOptions(r,...t){const s=this.globFunction||a;if(!s)throw new Error("Please specify a glob function to use glob matching.");var d=this.globCache[r.join("\0")];return d||(d=s(r,...t),this.globCache[r.join("\0")]=d),this.options.filters.push(m=>d(m)),this}}return Qe.Builder=i,Qe}var Tt={},Wr;function zi(){return Wr||(Wr=1,Object.defineProperty(Tt,"__esModule",{value:!0})),Tt}var Zr;function Xi(){return Zr||(Zr=1,function(e){var n=Ke&&Ke.__createBinding||(Object.create?function(h,r,t,s){s===void 0&&(s=t);var d=Object.getOwnPropertyDescriptor(r,t);(!d||("get"in d?!r.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(h,s,d)}:function(h,r,t,s){s===void 0&&(s=t),h[s]=r[t]}),a=Ke&&Ke.__exportStar||function(h,r){for(var t in h)t!=="default"&&!Object.prototype.hasOwnProperty.call(r,t)&&n(r,h,t)};Object.defineProperty(e,"__esModule",{value:!0}),e.fdir=void 0;const i=Zi();Object.defineProperty(e,"fdir",{enumerable:!0,get:function(){return i.Builder}}),a(zi(),e)}(Ke)),Ke}var Nt,zr;function Qi(){if(zr)return Nt;zr=1;const{fdir:e}=Xi(),n=de,a=Gr();class i{constructor(r="./",t=[".env*"],s=[]){this.ignore=["node_modules/**",".git/**"],this.cwd=n.resolve(r),this.envFile=t,this.excludeEnvFile=s}run(){return this._filepaths()}_filepaths(){const r=a(this._exclude()),t=a(this._patterns(),{ignore:this._exclude()});return new e().withRelativePaths().exclude((s,d)=>r(d)).filter(s=>t(s)).crawl(this.cwd).sync()}_patterns(){return Array.isArray(this.envFile)?this.envFile.map(r=>`**/${r}`):[`**/${this.envFile}`]}_excludePatterns(){return Array.isArray(this.excludeEnvFile)?this.excludeEnvFile.map(r=>`**/${r}`):[`**/${this.excludeEnvFile}`]}_exclude(){return this._excludePatterns().length>0?this.ignore.concat(this._excludePatterns()):this.ignore}}return Nt=i,Nt}var Lt,Xr;function Te(){if(Xr)return Lt;Xr=1;const e=Be,n="utf8";function a(r,t=null){return t||(t=n),e.readFileSync(r,t)}function i(r,t){return e.writeFileSync(r,t,n)}return Lt={chmodSync:e.chmodSync,existsSync:e.existsSync,readdirSync:e.readdirSync,readFileSync:e.readFileSync,writeFileSync:e.writeFileSync,appendFileSync:e.appendFileSync,readFileX:a,writeFileX:i},Lt}var we={exports:{}};const Qr="dotenv",Jr="16.4.7",es="Loads environment variables from .env file",ts="lib/main.js",ns="lib/main.d.ts",rs={".":{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"},ss={"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},os={type:"git",url:"git://github.com/motdotla/dotenv.git"},is="https://dotenvx.com",cs=["dotenv","env",".env","environment","variables","config","settings"],as="README.md",us="BSD-2-Clause",ls={"@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"},fs={node:">=12"},ds={fs:!1},Ji={name:Qr,version:Jr,description:es,main:ts,types:ns,exports:rs,scripts:ss,repository:os,funding:is,keywords:cs,readmeFilename:as,license:us,devDependencies:ls,engines:fs,browser:ds},ec={__proto__:null,browser:ds,default:Ji,description:es,devDependencies:ls,engines:fs,exports:rs,funding:is,keywords:cs,license:us,main:ts,name:Qr,readmeFilename:as,repository:os,scripts:ss,types:ns,version:Jr},tc=Xn(ec);var hs;function nc(){if(hs)return we.exports;hs=1;const e=Be,n=de,a=Zn,i=Ei,r=tc.version,t=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function s(c){const q={};let D=c.toString();D=D.replace(/\r\n?/mg,`
3
+ `);let $;for(;($=t.exec(D))!=null;){const H=$[1];let E=$[2]||"";E=E.trim();const I=E[0];E=E.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),I==='"'&&(E=E.replace(/\\n/g,`
4
+ `),E=E.replace(/\\r/g,"\r")),q[H]=E}return q}function d(c){const q=A(c),D=y.configDotenv({path:q});if(!D.parsed){const I=new Error(`MISSING_DATA: Cannot parse ${q} for an unknown reason`);throw I.code="MISSING_DATA",I}const $=l(c).split(","),H=$.length;let E;for(let I=0;I<H;I++)try{const k=$[I].trim(),u=S(D,k);E=y.decrypt(u.ciphertext,u.key);break}catch(k){if(I+1>=H)throw k}return y.parse(E)}function m(c){console.log(`[dotenv@${r}][INFO] ${c}`)}function p(c){console.log(`[dotenv@${r}][WARN] ${c}`)}function g(c){console.log(`[dotenv@${r}][DEBUG] ${c}`)}function l(c){return c&&c.DOTENV_KEY&&c.DOTENV_KEY.length>0?c.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function S(c,q){let D;try{D=new URL(q)}catch(k){if(k.code==="ERR_INVALID_URL"){const u=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 u.code="INVALID_DOTENV_KEY",u}throw k}const $=D.password;if(!$){const k=new Error("INVALID_DOTENV_KEY: Missing key part");throw k.code="INVALID_DOTENV_KEY",k}const H=D.searchParams.get("environment");if(!H){const k=new Error("INVALID_DOTENV_KEY: Missing environment part");throw k.code="INVALID_DOTENV_KEY",k}const E=`DOTENV_VAULT_${H.toUpperCase()}`,I=c.parsed[E];if(!I){const k=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${E} in your .env.vault file.`);throw k.code="NOT_FOUND_DOTENV_ENVIRONMENT",k}return{ciphertext:I,key:$}}function A(c){let q=null;if(c&&c.path&&c.path.length>0)if(Array.isArray(c.path))for(const D of c.path)e.existsSync(D)&&(q=D.endsWith(".vault")?D:`${D}.vault`);else q=c.path.endsWith(".vault")?c.path:`${c.path}.vault`;else q=n.resolve(process.cwd(),".env.vault");return e.existsSync(q)?q:null}function j(c){return c[0]==="~"?n.join(a.homedir(),c.slice(1)):c}function v(c){m("Loading env from encrypted .env.vault");const q=y._parseVault(c);let D=process.env;return c&&c.processEnv!=null&&(D=c.processEnv),y.populate(D,q,c),{parsed:q}}function _(c){const q=n.resolve(process.cwd(),".env");let D="utf8";const $=!!(c&&c.debug);c&&c.encoding?D=c.encoding:$&&g("No encoding is specified. UTF-8 is used by default");let H=[q];if(c&&c.path)if(!Array.isArray(c.path))H=[j(c.path)];else{H=[];for(const u of c.path)H.push(j(u))}let E;const I={};for(const u of H)try{const N=y.parse(e.readFileSync(u,{encoding:D}));y.populate(I,N,c)}catch(N){$&&g(`Failed to load ${u} ${N.message}`),E=N}let k=process.env;return c&&c.processEnv!=null&&(k=c.processEnv),y.populate(k,I,c),E?{parsed:I,error:E}:{parsed:I}}function R(c){if(l(c).length===0)return y.configDotenv(c);const q=A(c);return q?y._configVault(c):(p(`You set DOTENV_KEY but you are missing a .env.vault file at ${q}. Did you forget to build it?`),y.configDotenv(c))}function P(c,q){const D=Buffer.from(q.slice(-64),"hex");let $=Buffer.from(c,"base64");const H=$.subarray(0,12),E=$.subarray(-16);$=$.subarray(12,-16);try{const I=i.createDecipheriv("aes-256-gcm",D,H);return I.setAuthTag(E),`${I.update($)}${I.final()}`}catch(I){const k=I instanceof RangeError,u=I.message==="Invalid key length",N=I.message==="Unsupported state or unable to authenticate data";if(k||u){const b=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw b.code="INVALID_DOTENV_KEY",b}else if(N){const b=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw b.code="DECRYPTION_FAILED",b}else throw I}}function f(c,q,D={}){const $=!!(D&&D.debug),H=!!(D&&D.override);if(typeof q!="object"){const E=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw E.code="OBJECT_REQUIRED",E}for(const E of Object.keys(q))Object.prototype.hasOwnProperty.call(c,E)?(H===!0&&(c[E]=q[E]),$&&g(H===!0?`"${E}" is already defined and WAS overwritten`:`"${E}" is already defined and was NOT overwritten`)):c[E]=q[E]}const y={configDotenv:_,_configVault:v,_parseVault:d,config:R,decrypt:P,parse:s,populate:f};return we.exports.configDotenv=y.configDotenv,we.exports._configVault=y._configVault,we.exports._parseVault=y._parseVault,we.exports.config=y.config,we.exports.decrypt=y.decrypt,we.exports.parse=y.parse,we.exports.populate=y.populate,we.exports=y,we.exports}var $t,ps;function rc(){if(ps)return $t;ps=1;function e(n){let a;try{a=new URL(n)}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=a.password;if(!i)throw new Error("INVALID_DOTENV_KEY: Missing key part");return Buffer.from(i.slice(-64),"hex")}return $t=e,$t}var Dt,ys;function sc(){if(ys)return Dt;ys=1;const e=nc(),n=rc();function a(i,h){const r=n(h);try{return e.decrypt(i,r)}catch(t){if(t.code==="DECRYPTION_FAILED"){const s=new Error("[DECRYPTION_FAILED] Unable to decrypt .env.vault with DOTENV_KEY.");throw s.code="DECRYPTION_FAILED",s.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.",s.debug=`[DECRYPTION_FAILED] DOTENV_KEY is ${h}`,s}if(t.code==="ERR_CRYPTO_INVALID_AUTH_TAG"){const s=new Error("[INVALID_CIPHERTEXT] Unable to decrypt what appears to be invalid ciphertext.");throw s.code="INVALID_CIPHERTEXT",s.help="[INVALID_CIPHERTEXT] Run with debug flag [dotenvx run --debug -- yourcommand] or manually check .env.vault.",s.debug=`[INVALID_CIPHERTEXT] ciphertext is '${i}'`,s}throw t}}return Dt=a,Dt}var Kt={},qt={},xe={},vs;function gs(){if(vs)return xe;vs=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.abool=t,xe.abytes=a,xe.aexists=h,xe.ahash=i,xe.anumber=e,xe.aoutput=r,xe.isBytes=n;function e(s){if(!Number.isSafeInteger(s)||s<0)throw new Error("positive integer expected, got "+s)}function n(s){return s instanceof Uint8Array||ArrayBuffer.isView(s)&&s.constructor.name==="Uint8Array"}function a(s,...d){if(!n(s))throw new Error("Uint8Array expected");if(d.length>0&&!d.includes(s.length))throw new Error("Uint8Array expected of length "+d+", got length="+s.length)}function i(s){if(typeof s!="function"||typeof s.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");e(s.outputLen),e(s.blockLen)}function h(s,d=!0){if(s.destroyed)throw new Error("Hash instance has been destroyed");if(d&&s.finished)throw new Error("Hash#digest() has already been called")}function r(s,d){a(s);const m=d.outputLen;if(s.length<m)throw new Error("digestInto() expects output buffer of length at least "+m)}function t(s){if(typeof s!="boolean")throw new Error(`boolean expected, not ${s}`)}return xe}var ms;function Ce(){return ms||(ms=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.wrapCipher=e.Hash=e.nextTick=e.isLE=e.createView=e.u32=e.u8=void 0,e.bytesToHex=t,e.hexToBytes=m,e.hexToNumber=p,e.bytesToNumberBE=g,e.numberToBytesBE=l,e.utf8ToBytes=A,e.bytesToUtf8=j,e.toBytes=v,e.overlapBytes=_,e.complexOverlapBytes=R,e.concatBytes=P,e.checkOpts=f,e.equalBytes=y,e.getOutput=D,e.setBigUint64=$,e.u64Lengths=H,e.isAligned32=E,e.copyBytes=I,e.clean=k;/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */const n=gs(),a=u=>new Uint8Array(u.buffer,u.byteOffset,u.byteLength);e.u8=a;const i=u=>new Uint32Array(u.buffer,u.byteOffset,Math.floor(u.byteLength/4));e.u32=i;const h=u=>new DataView(u.buffer,u.byteOffset,u.byteLength);if(e.createView=h,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!e.isLE)throw new Error("Non little-endian hardware is not supported");const r=Array.from({length:256},(u,N)=>N.toString(16).padStart(2,"0"));function t(u){(0,n.abytes)(u);let N="";for(let b=0;b<u.length;b++)N+=r[u[b]];return N}const s={_0:48,_9:57,A:65,F:70,a:97,f:102};function d(u){if(u>=s._0&&u<=s._9)return u-s._0;if(u>=s.A&&u<=s.F)return u-(s.A-10);if(u>=s.a&&u<=s.f)return u-(s.a-10)}function m(u){if(typeof u!="string")throw new Error("hex string expected, got "+typeof u);const N=u.length,b=N/2;if(N%2)throw new Error("hex string expected, got unpadded hex of length "+N);const B=new Uint8Array(b);for(let T=0,L=0;T<b;T++,L+=2){const o=d(u.charCodeAt(L)),w=d(u.charCodeAt(L+1));if(o===void 0||w===void 0){const C=u[L]+u[L+1];throw new Error('hex string expected, got non-hex character "'+C+'" at index '+L)}B[T]=o*16+w}return B}function p(u){if(typeof u!="string")throw new Error("hex string expected, got "+typeof u);return BigInt(u===""?"0":"0x"+u)}function g(u){return p(t(u))}function l(u,N){return m(u.toString(16).padStart(N*2,"0"))}const S=async()=>{};e.nextTick=S;function A(u){if(typeof u!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(u))}function j(u){return new TextDecoder().decode(u)}function v(u){if(typeof u=="string")u=A(u);else if((0,n.isBytes)(u))u=I(u);else throw new Error("Uint8Array expected, got "+typeof u);return u}function _(u,N){return u.buffer===N.buffer&&u.byteOffset<N.byteOffset+N.byteLength&&N.byteOffset<u.byteOffset+u.byteLength}function R(u,N){if(_(u,N)&&u.byteOffset<N.byteOffset)throw new Error("complex overlap of input and output is not supported")}function P(...u){let N=0;for(let B=0;B<u.length;B++){const T=u[B];(0,n.abytes)(T),N+=T.length}const b=new Uint8Array(N);for(let B=0,T=0;B<u.length;B++){const L=u[B];b.set(L,T),T+=L.length}return b}function f(u,N){if(N==null||typeof N!="object")throw new Error("options must be defined");return Object.assign(u,N)}function y(u,N){if(u.length!==N.length)return!1;let b=0;for(let B=0;B<u.length;B++)b|=u[B]^N[B];return b===0}class c{}e.Hash=c;const q=(u,N)=>{function b(B,...T){if((0,n.abytes)(B),u.nonceLength!==void 0){const x=T[0];if(!x)throw new Error("nonce / iv required");u.varSizeNonce?(0,n.abytes)(x):(0,n.abytes)(x,u.nonceLength)}const L=u.tagLength;L&&T[1]!==void 0&&(0,n.abytes)(T[1]);const o=N(B,...T),w=(x,K)=>{if(K!==void 0){if(x!==2)throw new Error("cipher output not supported");(0,n.abytes)(K)}};let C=!1;return{encrypt(x,K){if(C)throw new Error("cannot encrypt() twice with same key + nonce");return C=!0,(0,n.abytes)(x),w(o.encrypt.length,K),o.encrypt(x,K)},decrypt(x,K){if((0,n.abytes)(x),L&&x.length<L)throw new Error("invalid ciphertext length: smaller than tagLength="+L);return w(o.decrypt.length,K),o.decrypt(x,K)}}}return Object.assign(b,u),b};e.wrapCipher=q;function D(u,N,b=!0){if(N===void 0)return new Uint8Array(u);if(N.length!==u)throw new Error("invalid output length, expected "+u+", got: "+N.length);if(b&&!E(N))throw new Error("invalid output, must be aligned");return N}function $(u,N,b,B){if(typeof u.setBigUint64=="function")return u.setBigUint64(N,b,B);const T=BigInt(32),L=BigInt(4294967295),o=Number(b>>T&L),w=Number(b&L),C=B?4:0,G=B?0:4;u.setUint32(N+C,o,B),u.setUint32(N+G,w,B)}function H(u,N){const b=new Uint8Array(16),B=(0,e.createView)(b);return $(B,0,BigInt(N?N.length:0),!0),$(B,8,BigInt(u.length),!0),b}function E(u){return u.byteOffset%4===0}function I(u){return Uint8Array.from(u)}function k(...u){for(let N=0;N<u.length;N++)u[N].fill(0)}}(qt)),qt}var Ht={},pe={},bs;function jt(){return bs||(bs=1,Object.defineProperty(pe,"__esModule",{value:!0}),pe.AEAD_TAG_LENGTH=pe.XCHACHA20_NONCE_LENGTH=pe.CURVE25519_PUBLIC_KEY_SIZE=pe.ETH_PUBLIC_KEY_SIZE=pe.UNCOMPRESSED_PUBLIC_KEY_SIZE=pe.COMPRESSED_PUBLIC_KEY_SIZE=pe.SECRET_KEY_LENGTH=void 0,pe.SECRET_KEY_LENGTH=32,pe.COMPRESSED_PUBLIC_KEY_SIZE=33,pe.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,pe.ETH_PUBLIC_KEY_SIZE=64,pe.CURVE25519_PUBLIC_KEY_SIZE=32,pe.XCHACHA20_NONCE_LENGTH=24,pe.AEAD_TAG_LENGTH=16),pe}var Es;function mt(){return Es||(Es=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 n=jt(),a=function(){function m(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16}return m}();e.ECIES_CONFIG=new a;var i=function(){return e.ECIES_CONFIG.ellipticCurve};e.ellipticCurve=i;var h=function(){return e.ECIES_CONFIG.isEphemeralKeyCompressed};e.isEphemeralKeyCompressed=h;var r=function(){return e.ECIES_CONFIG.isHkdfKeyCompressed};e.isHkdfKeyCompressed=r;var t=function(){return e.ECIES_CONFIG.symmetricAlgorithm};e.symmetricAlgorithm=t;var s=function(){return e.ECIES_CONFIG.symmetricNonceLength};e.symmetricNonceLength=s;var d=function(){var m={secp256k1:e.ECIES_CONFIG.isEphemeralKeyCompressed?n.COMPRESSED_PUBLIC_KEY_SIZE:n.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:n.CURVE25519_PUBLIC_KEY_SIZE,ed25519:n.CURVE25519_PUBLIC_KEY_SIZE};if(e.ECIES_CONFIG.ellipticCurve in m)return m[e.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")};e.ephemeralKeySize=d}(Ht)),Ht}var kt={},at={},ke={},Ft={},Mt={},ut={},_s;function oc(){return _s||(_s=1,Object.defineProperty(ut,"__esModule",{value:!0}),ut.crypto=void 0,ut.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),ut}var ws;function xs(){return ws||(ws=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.gcm=e.ctr=e.cbc=e.utils=void 0,e.randomBytes=h,e.getWebcryptoSubtle=r,e.managedNonce=t;const n=oc(),a=gs(),i=Ce();function h(p=32){if(n.crypto&&typeof n.crypto.getRandomValues=="function")return n.crypto.getRandomValues(new Uint8Array(p));if(n.crypto&&typeof n.crypto.randomBytes=="function")return n.crypto.randomBytes(p);throw new Error("crypto.getRandomValues must be defined")}function r(){if(n.crypto&&typeof n.crypto.subtle=="object"&&n.crypto.subtle!=null)return n.crypto.subtle;throw new Error("crypto.subtle must be defined")}function t(p){const{nonceLength:g}=p;return(0,a.anumber)(g),(l,...S)=>({encrypt(A,...j){const v=h(g),_=p(l,v,...S).encrypt(A,...j),R=(0,i.concatBytes)(v,_);return _.fill(0),R},decrypt(A,...j){const v=A.subarray(0,g),_=A.subarray(g);return p(l,v,...S).decrypt(_,...j)}})}e.utils={async encrypt(p,g,l,S){const A=r(),j=await A.importKey("raw",p,g,!0,["encrypt"]),v=await A.encrypt(l,j,S);return new Uint8Array(v)},async decrypt(p,g,l,S){const A=r(),j=await A.importKey("raw",p,g,!0,["decrypt"]),v=await A.decrypt(l,j,S);return new Uint8Array(v)}};const s={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function d(p,g,l){if(p===s.CBC)return{name:s.CBC,iv:g};if(p===s.CTR)return{name:s.CTR,counter:g,length:64};if(p===s.GCM)return l?{name:s.GCM,iv:g,additionalData:l}:{name:s.GCM,iv:g};throw new Error("unknown aes block mode")}function m(p){return(g,l,S)=>{(0,a.abytes)(g),(0,a.abytes)(l);const A={name:p,length:g.length*8},j=d(p,l,S);let v=!1;return{encrypt(_){if((0,a.abytes)(_),v)throw new Error("Cannot encrypt() twice with same key / nonce");return v=!0,e.utils.encrypt(g,A,j,_)},decrypt(_){return(0,a.abytes)(_),e.utils.decrypt(g,A,j,_)}}}}e.cbc=m(s.CBC),e.ctr=m(s.CTR),e.gcm=m(s.GCM)}(Mt)),Mt}var Vt={},he={},Ne={},Le={},As;function bt(){if(As)return Le;As=1,Object.defineProperty(Le,"__esModule",{value:!0}),Le.anumber=e,Le.abytes=a,Le.ahash=i,Le.aexists=h,Le.aoutput=r;function e(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function n(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function a(t,...s){if(!n(t))throw new Error("Uint8Array expected");if(s.length>0&&!s.includes(t.length))throw new Error("Uint8Array expected of length "+s+", got length="+t.length)}function i(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");e(t.outputLen),e(t.blockLen)}function h(t,s=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(s&&t.finished)throw new Error("Hash#digest() has already been called")}function r(t,s){a(t);const d=s.outputLen;if(t.length<d)throw new Error("digestInto() expects output buffer of length at least "+d)}return Le}var Ut={},lt={},Ss;function ic(){return Ss||(Ss=1,Object.defineProperty(lt,"__esModule",{value:!0}),lt.crypto=void 0,lt.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),lt}var Rs;function $e(){return Rs||(Rs=1,function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.nextTick=e.byteSwapIfBE=e.isLE=void 0,e.isBytes=i,e.u8=h,e.u32=r,e.createView=t,e.rotr=s,e.rotl=d,e.byteSwap=m,e.byteSwap32=p,e.bytesToHex=l,e.hexToBytes=j,e.asyncLoop=_,e.utf8ToBytes=R,e.toBytes=P,e.concatBytes=f,e.checkOpts=c,e.wrapConstructor=q,e.wrapConstructorWithOpts=D,e.wrapXOFConstructorWithOpts=$,e.randomBytes=H;const n=ic(),a=bt();function i(E){return E instanceof Uint8Array||ArrayBuffer.isView(E)&&E.constructor.name==="Uint8Array"}function h(E){return new Uint8Array(E.buffer,E.byteOffset,E.byteLength)}function r(E){return new Uint32Array(E.buffer,E.byteOffset,Math.floor(E.byteLength/4))}function t(E){return new DataView(E.buffer,E.byteOffset,E.byteLength)}function s(E,I){return E<<32-I|E>>>I}function d(E,I){return E<<I|E>>>32-I>>>0}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function m(E){return E<<24&4278190080|E<<8&16711680|E>>>8&65280|E>>>24&255}e.byteSwapIfBE=e.isLE?E=>E:E=>m(E);function p(E){for(let I=0;I<E.length;I++)E[I]=m(E[I])}const g=Array.from({length:256},(E,I)=>I.toString(16).padStart(2,"0"));function l(E){(0,a.abytes)(E);let I="";for(let k=0;k<E.length;k++)I+=g[E[k]];return I}const S={_0:48,_9:57,A:65,F:70,a:97,f:102};function A(E){if(E>=S._0&&E<=S._9)return E-S._0;if(E>=S.A&&E<=S.F)return E-(S.A-10);if(E>=S.a&&E<=S.f)return E-(S.a-10)}function j(E){if(typeof E!="string")throw new Error("hex string expected, got "+typeof E);const I=E.length,k=I/2;if(I%2)throw new Error("hex string expected, got unpadded hex of length "+I);const u=new Uint8Array(k);for(let N=0,b=0;N<k;N++,b+=2){const B=A(E.charCodeAt(b)),T=A(E.charCodeAt(b+1));if(B===void 0||T===void 0){const L=E[b]+E[b+1];throw new Error('hex string expected, got non-hex character "'+L+'" at index '+b)}u[N]=B*16+T}return u}const v=async()=>{};e.nextTick=v;async function _(E,I,k){let u=Date.now();for(let N=0;N<E;N++){k(N);const b=Date.now()-u;b>=0&&b<I||(await(0,e.nextTick)(),u+=b)}}function R(E){if(typeof E!="string")throw new Error("utf8ToBytes expected string, got "+typeof E);return new Uint8Array(new TextEncoder().encode(E))}function P(E){return typeof E=="string"&&(E=R(E)),(0,a.abytes)(E),E}function f(...E){let I=0;for(let u=0;u<E.length;u++){const N=E[u];(0,a.abytes)(N),I+=N.length}const k=new Uint8Array(I);for(let u=0,N=0;u<E.length;u++){const b=E[u];k.set(b,N),N+=b.length}return k}class y{clone(){return this._cloneInto()}}e.Hash=y;function c(E,I){if(I!==void 0&&{}.toString.call(I)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(E,I)}function q(E){const I=u=>E().update(P(u)).digest(),k=E();return I.outputLen=k.outputLen,I.blockLen=k.blockLen,I.create=()=>E(),I}function D(E){const I=(u,N)=>E(N).update(P(u)).digest(),k=E({});return I.outputLen=k.outputLen,I.blockLen=k.blockLen,I.create=u=>E(u),I}function $(E){const I=(u,N)=>E(N).update(P(u)).digest(),k=E({});return I.outputLen=k.outputLen,I.blockLen=k.blockLen,I.create=u=>E(u),I}function H(E=32){if(n.crypto&&typeof n.crypto.getRandomValues=="function")return n.crypto.getRandomValues(new Uint8Array(E));if(n.crypto&&typeof n.crypto.randomBytes=="function")return n.crypto.randomBytes(E);throw new Error("crypto.getRandomValues must be defined")}}(Ut)),Ut}var Bs;function Is(){if(Bs)return Ne;Bs=1,Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.HashMD=void 0,Ne.setBigUint64=a,Ne.Chi=i,Ne.Maj=h;const e=bt(),n=$e();function a(t,s,d,m){if(typeof t.setBigUint64=="function")return t.setBigUint64(s,d,m);const p=BigInt(32),g=BigInt(4294967295),l=Number(d>>p&g),S=Number(d&g),A=m?4:0,j=m?0:4;t.setUint32(s+A,l,m),t.setUint32(s+j,S,m)}function i(t,s,d){return t&s^~t&d}function h(t,s,d){return t&s^t&d^s&d}class r extends n.Hash{constructor(s,d,m,p){super(),this.blockLen=s,this.outputLen=d,this.padOffset=m,this.isLE=p,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(s),this.view=(0,n.createView)(this.buffer)}update(s){(0,e.aexists)(this);const{view:d,buffer:m,blockLen:p}=this;s=(0,n.toBytes)(s);const g=s.length;for(let l=0;l<g;){const S=Math.min(p-this.pos,g-l);if(S===p){const A=(0,n.createView)(s);for(;p<=g-l;l+=p)this.process(A,l);continue}m.set(s.subarray(l,l+S),this.pos),this.pos+=S,l+=S,this.pos===p&&(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:m,blockLen:p,isLE:g}=this;let{pos:l}=this;d[l++]=128,this.buffer.subarray(l).fill(0),this.padOffset>p-l&&(this.process(m,0),l=0);for(let _=l;_<p;_++)d[_]=0;a(m,p-8,BigInt(this.length*8),g),this.process(m,0);const S=(0,n.createView)(s),A=this.outputLen;if(A%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const j=A/4,v=this.get();if(j>v.length)throw new Error("_sha2: outputLen bigger than state");for(let _=0;_<j;_++)S.setUint32(4*_,v[_],g)}digest(){const{buffer:s,outputLen:d}=this;this.digestInto(s);const m=s.slice(0,d);return this.destroy(),m}_cloneInto(s){s||(s=new this.constructor),s.set(...this.get());const{blockLen:d,buffer:m,length:p,finished:g,destroyed:l,pos:S}=this;return s.length=p,s.pos=S,s.finished=g,s.destroyed=l,p%d&&s.buffer.set(m),s}}return Ne.HashMD=r,Ne}var ce={},Os;function cc(){if(Os)return ce;Os=1,Object.defineProperty(ce,"__esModule",{value:!0}),ce.add5L=ce.add5H=ce.add4H=ce.add4L=ce.add3H=ce.add3L=ce.rotlBL=ce.rotlBH=ce.rotlSL=ce.rotlSH=ce.rotr32L=ce.rotr32H=ce.rotrBL=ce.rotrBH=ce.rotrSL=ce.rotrSH=ce.shrSL=ce.shrSH=ce.toBig=void 0,ce.fromBig=a,ce.split=i,ce.add=_;const e=BigInt(2**32-1),n=BigInt(32);function a($,H=!1){return H?{h:Number($&e),l:Number($>>n&e)}:{h:Number($>>n&e)|0,l:Number($&e)|0}}function i($,H=!1){let E=new Uint32Array($.length),I=new Uint32Array($.length);for(let k=0;k<$.length;k++){const{h:u,l:N}=a($[k],H);[E[k],I[k]]=[u,N]}return[E,I]}const h=($,H)=>BigInt($>>>0)<<n|BigInt(H>>>0);ce.toBig=h;const r=($,H,E)=>$>>>E;ce.shrSH=r;const t=($,H,E)=>$<<32-E|H>>>E;ce.shrSL=t;const s=($,H,E)=>$>>>E|H<<32-E;ce.rotrSH=s;const d=($,H,E)=>$<<32-E|H>>>E;ce.rotrSL=d;const m=($,H,E)=>$<<64-E|H>>>E-32;ce.rotrBH=m;const p=($,H,E)=>$>>>E-32|H<<64-E;ce.rotrBL=p;const g=($,H)=>H;ce.rotr32H=g;const l=($,H)=>$;ce.rotr32L=l;const S=($,H,E)=>$<<E|H>>>32-E;ce.rotlSH=S;const A=($,H,E)=>H<<E|$>>>32-E;ce.rotlSL=A;const j=($,H,E)=>H<<E-32|$>>>64-E;ce.rotlBH=j;const v=($,H,E)=>$<<E-32|H>>>64-E;ce.rotlBL=v;function _($,H,E,I){const k=(H>>>0)+(I>>>0);return{h:$+E+(k/2**32|0)|0,l:k|0}}const R=($,H,E)=>($>>>0)+(H>>>0)+(E>>>0);ce.add3L=R;const P=($,H,E,I)=>H+E+I+($/2**32|0)|0;ce.add3H=P;const f=($,H,E,I)=>($>>>0)+(H>>>0)+(E>>>0)+(I>>>0);ce.add4L=f;const y=($,H,E,I,k)=>H+E+I+k+($/2**32|0)|0;ce.add4H=y;const c=($,H,E,I,k)=>($>>>0)+(H>>>0)+(E>>>0)+(I>>>0)+(k>>>0);ce.add5L=c;const q=($,H,E,I,k,u)=>H+E+I+k+u+($/2**32|0)|0;ce.add5H=q;const D={fromBig:a,split:i,toBig:h,shrSH:r,shrSL:t,rotrSH:s,rotrSL:d,rotrBH:m,rotrBL:p,rotr32H:g,rotr32L:l,rotlSH:S,rotlSL:A,rotlBH:j,rotlBL:v,add:_,add3L:R,add3H:P,add4L:f,add4H:y,add5H:q,add5L:c};return ce.default=D,ce}var Cs;function ac(){if(Cs)return he;Cs=1,Object.defineProperty(he,"__esModule",{value:!0}),he.sha384=he.sha512_256=he.sha512_224=he.sha512=he.SHA384=he.SHA512_256=he.SHA512_224=he.SHA512=void 0;const e=Is(),n=cc(),a=$e(),[i,h]=n.default.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(g=>BigInt(g))),r=new Uint32Array(80),t=new Uint32Array(80);class s extends e.HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:l,Al:S,Bh:A,Bl:j,Ch:v,Cl:_,Dh:R,Dl:P,Eh:f,El:y,Fh:c,Fl:q,Gh:D,Gl:$,Hh:H,Hl:E}=this;return[l,S,A,j,v,_,R,P,f,y,c,q,D,$,H,E]}set(l,S,A,j,v,_,R,P,f,y,c,q,D,$,H,E){this.Ah=l|0,this.Al=S|0,this.Bh=A|0,this.Bl=j|0,this.Ch=v|0,this.Cl=_|0,this.Dh=R|0,this.Dl=P|0,this.Eh=f|0,this.El=y|0,this.Fh=c|0,this.Fl=q|0,this.Gh=D|0,this.Gl=$|0,this.Hh=H|0,this.Hl=E|0}process(l,S){for(let u=0;u<16;u++,S+=4)r[u]=l.getUint32(S),t[u]=l.getUint32(S+=4);for(let u=16;u<80;u++){const N=r[u-15]|0,b=t[u-15]|0,B=n.default.rotrSH(N,b,1)^n.default.rotrSH(N,b,8)^n.default.shrSH(N,b,7),T=n.default.rotrSL(N,b,1)^n.default.rotrSL(N,b,8)^n.default.shrSL(N,b,7),L=r[u-2]|0,o=t[u-2]|0,w=n.default.rotrSH(L,o,19)^n.default.rotrBH(L,o,61)^n.default.shrSH(L,o,6),C=n.default.rotrSL(L,o,19)^n.default.rotrBL(L,o,61)^n.default.shrSL(L,o,6),G=n.default.add4L(T,C,t[u-7],t[u-16]),x=n.default.add4H(G,B,w,r[u-7],r[u-16]);r[u]=x|0,t[u]=G|0}let{Ah:A,Al:j,Bh:v,Bl:_,Ch:R,Cl:P,Dh:f,Dl:y,Eh:c,El:q,Fh:D,Fl:$,Gh:H,Gl:E,Hh:I,Hl:k}=this;for(let u=0;u<80;u++){const N=n.default.rotrSH(c,q,14)^n.default.rotrSH(c,q,18)^n.default.rotrBH(c,q,41),b=n.default.rotrSL(c,q,14)^n.default.rotrSL(c,q,18)^n.default.rotrBL(c,q,41),B=c&D^~c&H,T=q&$^~q&E,L=n.default.add5L(k,b,T,h[u],t[u]),o=n.default.add5H(L,I,N,B,i[u],r[u]),w=L|0,C=n.default.rotrSH(A,j,28)^n.default.rotrBH(A,j,34)^n.default.rotrBH(A,j,39),G=n.default.rotrSL(A,j,28)^n.default.rotrBL(A,j,34)^n.default.rotrBL(A,j,39),x=A&v^A&R^v&R,K=j&_^j&P^_&P;I=H|0,k=E|0,H=D|0,E=$|0,D=c|0,$=q|0,{h:c,l:q}=n.default.add(f|0,y|0,o|0,w|0),f=R|0,y=P|0,R=v|0,P=_|0,v=A|0,_=j|0;const te=n.default.add3L(w,G,K);A=n.default.add3H(te,o,C,x),j=te|0}({h:A,l:j}=n.default.add(this.Ah|0,this.Al|0,A|0,j|0)),{h:v,l:_}=n.default.add(this.Bh|0,this.Bl|0,v|0,_|0),{h:R,l:P}=n.default.add(this.Ch|0,this.Cl|0,R|0,P|0),{h:f,l:y}=n.default.add(this.Dh|0,this.Dl|0,f|0,y|0),{h:c,l:q}=n.default.add(this.Eh|0,this.El|0,c|0,q|0),{h:D,l:$}=n.default.add(this.Fh|0,this.Fl|0,D|0,$|0),{h:H,l:E}=n.default.add(this.Gh|0,this.Gl|0,H|0,E|0),{h:I,l:k}=n.default.add(this.Hh|0,this.Hl|0,I|0,k|0),this.set(A,j,v,_,R,P,f,y,c,q,D,$,H,E,I,k)}roundClean(){r.fill(0),t.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}he.SHA512=s;class d extends s{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}he.SHA512_224=d;class m extends s{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}he.SHA512_256=m;class p extends s{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}return he.SHA384=p,he.sha512=(0,a.wrapConstructor)(()=>new s),he.sha512_224=(0,a.wrapConstructor)(()=>new d),he.sha512_256=(0,a.wrapConstructor)(()=>new m),he.sha384=(0,a.wrapConstructor)(()=>new p),he}var Fe={},ue={},ae={},Ps;function Ae(){if(Ps)return ae;Ps=1;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(ae,"__esModule",{value:!0}),ae.notImplemented=ae.bitMask=void 0,ae.isBytes=i,ae.abytes=h,ae.abool=r,ae.bytesToHex=s,ae.numberToHexUnpadded=d,ae.hexToNumber=m,ae.hexToBytes=l,ae.bytesToNumberBE=S,ae.bytesToNumberLE=A,ae.numberToBytesBE=j,ae.numberToBytesLE=v,ae.numberToVarBytesBE=_,ae.ensureBytes=R,ae.concatBytes=P,ae.equalBytes=f,ae.utf8ToBytes=y,ae.inRange=q,ae.aInRange=D,ae.bitLen=$,ae.bitGet=H,ae.bitSet=E,ae.createHmacDrbg=N,ae.validateObject=B,ae.memoized=L;const e=BigInt(0),n=BigInt(1),a=BigInt(2);function i(o){return o instanceof Uint8Array||ArrayBuffer.isView(o)&&o.constructor.name==="Uint8Array"}function h(o){if(!i(o))throw new Error("Uint8Array expected")}function r(o,w){if(typeof w!="boolean")throw new Error(o+" boolean expected, got "+w)}const t=Array.from({length:256},(o,w)=>w.toString(16).padStart(2,"0"));function s(o){h(o);let w="";for(let C=0;C<o.length;C++)w+=t[o[C]];return w}function d(o){const w=o.toString(16);return w.length&1?"0"+w:w}function m(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);return o===""?e:BigInt("0x"+o)}const p={_0:48,_9:57,A:65,F:70,a:97,f:102};function g(o){if(o>=p._0&&o<=p._9)return o-p._0;if(o>=p.A&&o<=p.F)return o-(p.A-10);if(o>=p.a&&o<=p.f)return o-(p.a-10)}function l(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);const w=o.length,C=w/2;if(w%2)throw new Error("hex string expected, got unpadded hex of length "+w);const G=new Uint8Array(C);for(let x=0,K=0;x<C;x++,K+=2){const te=g(o.charCodeAt(K)),M=g(o.charCodeAt(K+1));if(te===void 0||M===void 0){const O=o[K]+o[K+1];throw new Error('hex string expected, got non-hex character "'+O+'" at index '+K)}G[x]=te*16+M}return G}function S(o){return m(s(o))}function A(o){return h(o),m(s(Uint8Array.from(o).reverse()))}function j(o,w){return l(o.toString(16).padStart(w*2,"0"))}function v(o,w){return j(o,w).reverse()}function _(o){return l(d(o))}function R(o,w,C){let G;if(typeof w=="string")try{G=l(w)}catch(K){throw new Error(o+" must be hex string or Uint8Array, cause: "+K)}else if(i(w))G=Uint8Array.from(w);else throw new Error(o+" must be hex string or Uint8Array");const x=G.length;if(typeof C=="number"&&x!==C)throw new Error(o+" of length "+C+" expected, got "+x);return G}function P(...o){let w=0;for(let G=0;G<o.length;G++){const x=o[G];h(x),w+=x.length}const C=new Uint8Array(w);for(let G=0,x=0;G<o.length;G++){const K=o[G];C.set(K,x),x+=K.length}return C}function f(o,w){if(o.length!==w.length)return!1;let C=0;for(let G=0;G<o.length;G++)C|=o[G]^w[G];return C===0}function y(o){if(typeof o!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(o))}const c=o=>typeof o=="bigint"&&e<=o;function q(o,w,C){return c(o)&&c(w)&&c(C)&&w<=o&&o<C}function D(o,w,C,G){if(!q(w,C,G))throw new Error("expected valid "+o+": "+C+" <= n < "+G+", got "+w)}function $(o){let w;for(w=0;o>e;o>>=n,w+=1);return w}function H(o,w){return o>>BigInt(w)&n}function E(o,w,C){return o|(C?n:e)<<BigInt(w)}const I=o=>(a<<BigInt(o-1))-n;ae.bitMask=I;const k=o=>new Uint8Array(o),u=o=>Uint8Array.from(o);function N(o,w,C){if(typeof o!="number"||o<2)throw new Error("hashLen must be a number");if(typeof w!="number"||w<2)throw new Error("qByteLen must be a number");if(typeof C!="function")throw new Error("hmacFn must be a function");let G=k(o),x=k(o),K=0;const te=()=>{G.fill(1),x.fill(0),K=0},M=(...W)=>C(x,G,...W),O=(W=k())=>{x=M(u([0]),W),G=M(),W.length!==0&&(x=M(u([1]),W),G=M())},F=()=>{if(K++>=1e3)throw new Error("drbg: tried 1000 values");let W=0;const J=[];for(;W<w;){G=M();const Q=G.slice();J.push(Q),W+=G.length}return P(...J)};return(W,J)=>{te(),O(W);let Q;for(;!(Q=J(F()));)O();return te(),Q}}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"||i(o),isSafeInteger:o=>Number.isSafeInteger(o),array:o=>Array.isArray(o),field:(o,w)=>w.Fp.isValid(o),hash:o=>typeof o=="function"&&Number.isSafeInteger(o.outputLen)};function B(o,w,C={}){const G=(x,K,te)=>{const M=b[K];if(typeof M!="function")throw new Error("invalid validator function");const O=o[x];if(!(te&&O===void 0)&&!M(O,o))throw new Error("param "+String(x)+" is invalid. Expected "+K+", got "+O)};for(const[x,K]of Object.entries(w))G(x,K,!1);for(const[x,K]of Object.entries(C))G(x,K,!0);return o}const T=()=>{throw new Error("not implemented")};ae.notImplemented=T;function L(o){const w=new WeakMap;return(C,...G)=>{const x=w.get(C);if(x!==void 0)return x;const K=o(C,...G);return w.set(C,K),K}}return ae}var Ts;function Me(){if(Ts)return ue;Ts=1,Object.defineProperty(ue,"__esModule",{value:!0}),ue.isNegativeLE=void 0,ue.mod=d,ue.pow=m,ue.pow2=p,ue.invert=g,ue.tonelliShanks=l,ue.FpSqrt=S,ue.validateField=v,ue.FpPow=_,ue.FpInvertBatch=R,ue.FpDiv=P,ue.FpLegendre=f,ue.FpIsSquare=y,ue.nLength=c,ue.Field=q,ue.FpSqrtOdd=D,ue.FpSqrtEven=$,ue.hashToPrivateScalar=H,ue.getFieldBytesLength=E,ue.getMinHashLength=I,ue.mapHashToField=k;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=Ae(),n=BigInt(0),a=BigInt(1),i=BigInt(2),h=BigInt(3),r=BigInt(4),t=BigInt(5),s=BigInt(8);function d(u,N){const b=u%N;return b>=n?b:N+b}function m(u,N,b){if(N<n)throw new Error("invalid exponent, negatives unsupported");if(b<=n)throw new Error("invalid modulus");if(b===a)return n;let B=a;for(;N>n;)N&a&&(B=B*u%b),u=u*u%b,N>>=a;return B}function p(u,N,b){let B=u;for(;N-- >n;)B*=B,B%=b;return B}function g(u,N){if(u===n)throw new Error("invert: expected non-zero number");if(N<=n)throw new Error("invert: expected positive modulus, got "+N);let b=d(u,N),B=N,T=n,L=a;for(;b!==n;){const w=B/b,C=B%b,G=T-L*w;B=b,b=C,T=L,L=G}if(B!==a)throw new Error("invert: does not exist");return d(T,N)}function l(u){const N=(u-a)/i;let b,B,T;for(b=u-a,B=0;b%i===n;b/=i,B++);for(T=i;T<u&&m(T,N,u)!==u-a;T++)if(T>1e3)throw new Error("Cannot find square root: likely non-prime P");if(B===1){const o=(u+a)/r;return function(C,G){const x=C.pow(G,o);if(!C.eql(C.sqr(x),G))throw new Error("Cannot find square root");return x}}const L=(b+a)/i;return function(w,C){if(w.pow(C,N)===w.neg(w.ONE))throw new Error("Cannot find square root");let G=B,x=w.pow(w.mul(w.ONE,T),b),K=w.pow(C,L),te=w.pow(C,b);for(;!w.eql(te,w.ONE);){if(w.eql(te,w.ZERO))return w.ZERO;let M=1;for(let F=w.sqr(te);M<G&&!w.eql(F,w.ONE);M++)F=w.sqr(F);const O=w.pow(x,a<<BigInt(G-M-1));x=w.sqr(O),K=w.mul(K,O),te=w.mul(te,x),G=M}return K}}function S(u){if(u%r===h){const N=(u+a)/r;return function(B,T){const L=B.pow(T,N);if(!B.eql(B.sqr(L),T))throw new Error("Cannot find square root");return L}}if(u%s===t){const N=(u-t)/s;return function(B,T){const L=B.mul(T,i),o=B.pow(L,N),w=B.mul(T,o),C=B.mul(B.mul(w,i),o),G=B.mul(w,B.sub(C,B.ONE));if(!B.eql(B.sqr(G),T))throw new Error("Cannot find square root");return G}}return l(u)}const A=(u,N)=>(d(u,N)&a)===a;ue.isNegativeLE=A;const j=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function v(u){const N={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},b=j.reduce((B,T)=>(B[T]="function",B),N);return(0,e.validateObject)(u,b)}function _(u,N,b){if(b<n)throw new Error("invalid exponent, negatives unsupported");if(b===n)return u.ONE;if(b===a)return N;let B=u.ONE,T=N;for(;b>n;)b&a&&(B=u.mul(B,T)),T=u.sqr(T),b>>=a;return B}function R(u,N){const b=new Array(N.length),B=N.reduce((L,o,w)=>u.is0(o)?L:(b[w]=L,u.mul(L,o)),u.ONE),T=u.inv(B);return N.reduceRight((L,o,w)=>u.is0(o)?L:(b[w]=u.mul(L,b[w]),u.mul(L,o)),T),b}function P(u,N,b){return u.mul(N,typeof b=="bigint"?g(b,u.ORDER):u.inv(b))}function f(u){const N=(u-a)/i;return(b,B)=>b.pow(B,N)}function y(u){const N=f(u.ORDER);return b=>{const B=N(u,b);return u.eql(B,u.ZERO)||u.eql(B,u.ONE)}}function c(u,N){const b=N!==void 0?N:u.toString(2).length,B=Math.ceil(b/8);return{nBitLength:b,nByteLength:B}}function q(u,N,b=!1,B={}){if(u<=n)throw new Error("invalid field: expected ORDER > 0, got "+u);const{nBitLength:T,nByteLength:L}=c(u,N);if(L>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const w=Object.freeze({ORDER:u,isLE:b,BITS:T,BYTES:L,MASK:(0,e.bitMask)(T),ZERO:n,ONE:a,create:C=>d(C,u),isValid:C=>{if(typeof C!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof C);return n<=C&&C<u},is0:C=>C===n,isOdd:C=>(C&a)===a,neg:C=>d(-C,u),eql:(C,G)=>C===G,sqr:C=>d(C*C,u),add:(C,G)=>d(C+G,u),sub:(C,G)=>d(C-G,u),mul:(C,G)=>d(C*G,u),pow:(C,G)=>_(w,C,G),div:(C,G)=>d(C*g(G,u),u),sqrN:C=>C*C,addN:(C,G)=>C+G,subN:(C,G)=>C-G,mulN:(C,G)=>C*G,inv:C=>g(C,u),sqrt:B.sqrt||(C=>(o||(o=S(u)),o(w,C))),invertBatch:C=>R(w,C),cmov:(C,G,x)=>x?G:C,toBytes:C=>b?(0,e.numberToBytesLE)(C,L):(0,e.numberToBytesBE)(C,L),fromBytes:C=>{if(C.length!==L)throw new Error("Field.fromBytes: expected "+L+" bytes, got "+C.length);return b?(0,e.bytesToNumberLE)(C):(0,e.bytesToNumberBE)(C)}});return Object.freeze(w)}function D(u,N){if(!u.isOdd)throw new Error("Field doesn't have isOdd");const b=u.sqrt(N);return u.isOdd(b)?b:u.neg(b)}function $(u,N){if(!u.isOdd)throw new Error("Field doesn't have isOdd");const b=u.sqrt(N);return u.isOdd(b)?u.neg(b):b}function H(u,N,b=!1){u=(0,e.ensureBytes)("privateHash",u);const B=u.length,T=c(N).nByteLength+8;if(T<24||B<T||B>1024)throw new Error("hashToPrivateScalar: expected "+T+"-1024 bytes of input, got "+B);const L=b?(0,e.bytesToNumberLE)(u):(0,e.bytesToNumberBE)(u);return d(L,N-a)+a}function E(u){if(typeof u!="bigint")throw new Error("field order must be bigint");const N=u.toString(2).length;return Math.ceil(N/8)}function I(u){const N=E(u);return N+Math.ceil(N/2)}function k(u,N,b=!1){const B=u.length,T=E(N),L=I(N);if(B<16||B<L||B>1024)throw new Error("expected "+L+"-1024 bytes of input, got "+B);const o=b?(0,e.bytesToNumberLE)(u):(0,e.bytesToNumberBE)(u),w=d(o,N-a)+a;return b?(0,e.numberToBytesLE)(w,T):(0,e.numberToBytesBE)(w,T)}return ue}var Ns;function Gt(){if(Ns)return Fe;Ns=1,Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.wNAF=l,Fe.pippenger=S,Fe.precomputeMSMUnsafe=A,Fe.validateBasic=j;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=Me(),n=Ae(),a=BigInt(0),i=BigInt(1);function h(v,_){const R=_.negate();return v?R:_}function r(v,_){if(!Number.isSafeInteger(v)||v<=0||v>_)throw new Error("invalid window size, expected [1.."+_+"], got W="+v)}function t(v,_){r(v,_);const R=Math.ceil(_/v)+1,P=2**(v-1);return{windows:R,windowSize:P}}function s(v,_){if(!Array.isArray(v))throw new Error("array expected");v.forEach((R,P)=>{if(!(R instanceof _))throw new Error("invalid point at index "+P)})}function d(v,_){if(!Array.isArray(v))throw new Error("array of scalars expected");v.forEach((R,P)=>{if(!_.isValid(R))throw new Error("invalid scalar at index "+P)})}const m=new WeakMap,p=new WeakMap;function g(v){return p.get(v)||1}function l(v,_){return{constTimeNegate:h,hasPrecomputes(R){return g(R)!==1},unsafeLadder(R,P,f=v.ZERO){let y=R;for(;P>a;)P&i&&(f=f.add(y)),y=y.double(),P>>=i;return f},precomputeWindow(R,P){const{windows:f,windowSize:y}=t(P,_),c=[];let q=R,D=q;for(let $=0;$<f;$++){D=q,c.push(D);for(let H=1;H<y;H++)D=D.add(q),c.push(D);q=D.double()}return c},wNAF(R,P,f){const{windows:y,windowSize:c}=t(R,_);let q=v.ZERO,D=v.BASE;const $=BigInt(2**R-1),H=2**R,E=BigInt(R);for(let I=0;I<y;I++){const k=I*c;let u=Number(f&$);f>>=E,u>c&&(u-=H,f+=i);const N=k,b=k+Math.abs(u)-1,B=I%2!==0,T=u<0;u===0?D=D.add(h(B,P[N])):q=q.add(h(T,P[b]))}return{p:q,f:D}},wNAFUnsafe(R,P,f,y=v.ZERO){const{windows:c,windowSize:q}=t(R,_),D=BigInt(2**R-1),$=2**R,H=BigInt(R);for(let E=0;E<c;E++){const I=E*q;if(f===a)break;let k=Number(f&D);if(f>>=H,k>q&&(k-=$,f+=i),k===0)continue;let u=P[I+Math.abs(k)-1];k<0&&(u=u.negate()),y=y.add(u)}return y},getPrecomputes(R,P,f){let y=m.get(P);return y||(y=this.precomputeWindow(P,R),R!==1&&m.set(P,f(y))),y},wNAFCached(R,P,f){const y=g(R);return this.wNAF(y,this.getPrecomputes(y,R,f),P)},wNAFCachedUnsafe(R,P,f,y){const c=g(R);return c===1?this.unsafeLadder(R,P,y):this.wNAFUnsafe(c,this.getPrecomputes(c,R,f),P,y)},setWindowSize(R,P){r(P,_),p.set(R,P),m.delete(R)}}}function S(v,_,R,P){if(s(R,v),d(P,_),R.length!==P.length)throw new Error("arrays of points and scalars must have equal length");const f=v.ZERO,y=(0,n.bitLen)(BigInt(R.length)),c=y>12?y-3:y>4?y-2:y?2:1,q=(1<<c)-1,D=new Array(q+1).fill(f),$=Math.floor((_.BITS-1)/c)*c;let H=f;for(let E=$;E>=0;E-=c){D.fill(f);for(let k=0;k<P.length;k++){const u=P[k],N=Number(u>>BigInt(E)&BigInt(q));D[N]=D[N].add(R[k])}let I=f;for(let k=D.length-1,u=f;k>0;k--)u=u.add(D[k]),I=I.add(u);if(H=H.add(I),E!==0)for(let k=0;k<c;k++)H=H.double()}return H}function A(v,_,R,P){r(P,_.BITS),s(R,v);const f=v.ZERO,y=2**P-1,c=Math.ceil(_.BITS/P),q=BigInt((1<<P)-1),D=R.map($=>{const H=[];for(let E=0,I=$;E<y;E++)H.push(I),I=I.add($);return H});return $=>{if(d($,_),$.length>R.length)throw new Error("array of scalars must be smaller than array of points");let H=f;for(let E=0;E<c;E++){if(H!==f)for(let k=0;k<P;k++)H=H.double();const I=BigInt(c*P-(E+1)*P);for(let k=0;k<$.length;k++){const u=$[k],N=Number(u>>I&q);N&&(H=H.add(D[k][N-1]))}}return H}}function j(v){return(0,e.validateField)(v.Fp),(0,n.validateObject)(v,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,e.nLength)(v.n,v.nBitLength),...v,p:v.Fp.ORDER})}return Fe}var Et={},Ls;function uc(){if(Ls)return Et;Ls=1,Object.defineProperty(Et,"__esModule",{value:!0}),Et.twistedEdwards=p;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=Gt(),n=Me(),a=Ae(),i=Ae(),h=BigInt(0),r=BigInt(1),t=BigInt(2),s=BigInt(8),d={zip215:!0};function m(g){const l=(0,e.validateBasic)(g);return a.validateObject(g,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...l})}function p(g){const l=m(g),{Fp:S,n:A,prehash:j,hash:v,randomBytes:_,nByteLength:R,h:P}=l,f=t<<BigInt(R*8)-r,y=S.create,c=(0,n.Field)(l.n,l.nBitLength),q=l.uvRatio||((M,O)=>{try{return{isValid:!0,value:S.sqrt(M*S.inv(O))}}catch{return{isValid:!1,value:h}}}),D=l.adjustScalarBytes||(M=>M),$=l.domain||((M,O,F)=>{if((0,i.abool)("phflag",F),O.length||F)throw new Error("Contexts/pre-hash are not supported");return M});function H(M,O){a.aInRange("coordinate "+M,O,h,f)}function E(M){if(!(M instanceof u))throw new Error("ExtendedPoint expected")}const I=(0,i.memoized)((M,O)=>{const{ex:F,ey:Z,ez:W}=M,J=M.is0();O==null&&(O=J?s:S.inv(W));const Q=y(F*O),V=y(Z*O),U=y(W*O);if(J)return{x:h,y:r};if(U!==r)throw new Error("invZ was invalid");return{x:Q,y:V}}),k=(0,i.memoized)(M=>{const{a:O,d:F}=l;if(M.is0())throw new Error("bad point: ZERO");const{ex:Z,ey:W,ez:J,et:Q}=M,V=y(Z*Z),U=y(W*W),z=y(J*J),ee=y(z*z),Y=y(V*O),re=y(z*y(Y+U)),X=y(ee+y(F*y(V*U)));if(re!==X)throw new Error("bad point: equation left != right (1)");const ne=y(Z*W),se=y(J*Q);if(ne!==se)throw new Error("bad point: equation left != right (2)");return!0});class u{constructor(O,F,Z,W){this.ex=O,this.ey=F,this.ez=Z,this.et=W,H("x",O),H("y",F),H("z",Z),H("t",W),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(O){if(O instanceof u)throw new Error("extended point not allowed");const{x:F,y:Z}=O||{};return H("x",F),H("y",Z),new u(F,Z,r,y(F*Z))}static normalizeZ(O){const F=S.invertBatch(O.map(Z=>Z.ez));return O.map((Z,W)=>Z.toAffine(F[W])).map(u.fromAffine)}static msm(O,F){return(0,e.pippenger)(u,c,O,F)}_setWindowSize(O){B.setWindowSize(this,O)}assertValidity(){k(this)}equals(O){E(O);const{ex:F,ey:Z,ez:W}=this,{ex:J,ey:Q,ez:V}=O,U=y(F*V),z=y(J*W),ee=y(Z*V),Y=y(Q*W);return U===z&&ee===Y}is0(){return this.equals(u.ZERO)}negate(){return new u(y(-this.ex),this.ey,this.ez,y(-this.et))}double(){const{a:O}=l,{ex:F,ey:Z,ez:W}=this,J=y(F*F),Q=y(Z*Z),V=y(t*y(W*W)),U=y(O*J),z=F+Z,ee=y(y(z*z)-J-Q),Y=U+Q,re=Y-V,X=U-Q,ne=y(ee*re),se=y(Y*X),oe=y(ee*X),ie=y(re*Y);return new u(ne,se,ie,oe)}add(O){E(O);const{a:F,d:Z}=l,{ex:W,ey:J,ez:Q,et:V}=this,{ex:U,ey:z,ez:ee,et:Y}=O;if(F===BigInt(-1)){const Ee=y((J-W)*(z+U)),_e=y((J+W)*(z-U)),Se=y(_e-Ee);if(Se===h)return this.double();const Re=y(Q*t*Y),Xe=y(V*t*ee),Gn=Xe+Re,Yn=_e+Ee,Wn=Xe-Re,hi=y(Gn*Se),pi=y(Yn*Wn),yi=y(Gn*Wn),vi=y(Se*Yn);return new u(hi,pi,vi,yi)}const re=y(W*U),X=y(J*z),ne=y(V*Z*Y),se=y(Q*ee),oe=y((W+J)*(U+z)-re-X),ie=se-ne,fe=se+ne,le=y(X-F*re),ve=y(oe*ie),ye=y(fe*le),be=y(oe*le),ge=y(ie*fe);return new u(ve,ye,ge,be)}subtract(O){return this.add(O.negate())}wNAF(O){return B.wNAFCached(this,O,u.normalizeZ)}multiply(O){const F=O;a.aInRange("scalar",F,r,A);const{p:Z,f:W}=this.wNAF(F);return u.normalizeZ([Z,W])[0]}multiplyUnsafe(O,F=u.ZERO){const Z=O;return a.aInRange("scalar",Z,h,A),Z===h?b:this.is0()||Z===r?this:B.wNAFCachedUnsafe(this,Z,u.normalizeZ,F)}isSmallOrder(){return this.multiplyUnsafe(P).is0()}isTorsionFree(){return B.unsafeLadder(this,A).is0()}toAffine(O){return I(this,O)}clearCofactor(){const{h:O}=l;return O===r?this:this.multiplyUnsafe(O)}static fromHex(O,F=!1){const{d:Z,a:W}=l,J=S.BYTES;O=(0,i.ensureBytes)("pointHex",O,J),(0,i.abool)("zip215",F);const Q=O.slice(),V=O[J-1];Q[J-1]=V&-129;const U=a.bytesToNumberLE(Q),z=F?f:S.ORDER;a.aInRange("pointHex.y",U,h,z);const ee=y(U*U),Y=y(ee-r),re=y(Z*ee-W);let{isValid:X,value:ne}=q(Y,re);if(!X)throw new Error("Point.fromHex: invalid y coordinate");const se=(ne&r)===r,oe=(V&128)!==0;if(!F&&ne===h&&oe)throw new Error("Point.fromHex: x=0 and x_0=1");return oe!==se&&(ne=y(-ne)),u.fromAffine({x:ne,y:U})}static fromPrivateKey(O){return o(O).point}toRawBytes(){const{x:O,y:F}=this.toAffine(),Z=a.numberToBytesLE(F,S.BYTES);return Z[Z.length-1]|=O&r?128:0,Z}toHex(){return a.bytesToHex(this.toRawBytes())}}u.BASE=new u(l.Gx,l.Gy,r,y(l.Gx*l.Gy)),u.ZERO=new u(h,r,r,h);const{BASE:N,ZERO:b}=u,B=(0,e.wNAF)(u,R*8);function T(M){return(0,n.mod)(M,A)}function L(M){return T(a.bytesToNumberLE(M))}function o(M){const O=S.BYTES;M=(0,i.ensureBytes)("private key",M,O);const F=(0,i.ensureBytes)("hashed private key",v(M),2*O),Z=D(F.slice(0,O)),W=F.slice(O,2*O),J=L(Z),Q=N.multiply(J),V=Q.toRawBytes();return{head:Z,prefix:W,scalar:J,point:Q,pointBytes:V}}function w(M){return o(M).pointBytes}function C(M=new Uint8Array,...O){const F=a.concatBytes(...O);return L(v($(F,(0,i.ensureBytes)("context",M),!!j)))}function G(M,O,F={}){M=(0,i.ensureBytes)("message",M),j&&(M=j(M));const{prefix:Z,scalar:W,pointBytes:J}=o(O),Q=C(F.context,Z,M),V=N.multiply(Q).toRawBytes(),U=C(F.context,V,J,M),z=T(Q+U*W);a.aInRange("signature.s",z,h,A);const ee=a.concatBytes(V,a.numberToBytesLE(z,S.BYTES));return(0,i.ensureBytes)("result",ee,S.BYTES*2)}const x=d;function K(M,O,F,Z=x){const{context:W,zip215:J}=Z,Q=S.BYTES;M=(0,i.ensureBytes)("signature",M,2*Q),O=(0,i.ensureBytes)("message",O),F=(0,i.ensureBytes)("publicKey",F,Q),J!==void 0&&(0,i.abool)("zip215",J),j&&(O=j(O));const V=a.bytesToNumberLE(M.slice(Q,2*Q));let U,z,ee;try{U=u.fromHex(F,J),z=u.fromHex(M.slice(0,Q),J),ee=N.multiplyUnsafe(V)}catch{return!1}if(!J&&U.isSmallOrder())return!1;const Y=C(W,z.toRawBytes(),U.toRawBytes(),O);return z.add(U.multiplyUnsafe(Y)).subtract(ee).clearCofactor().equals(u.ZERO)}return N._setWindowSize(8),{CURVE:l,getPublicKey:w,sign:G,verify:K,ExtendedPoint:u,utils:{getExtendedPublicKey:o,randomPrivateKey:()=>_(S.BYTES),precompute(M=8,O=u.BASE){return O._setWindowSize(M),O.multiply(BigInt(3)),O}}}}return Et}var De={},$s;function Ds(){if($s)return De;$s=1,Object.defineProperty(De,"__esModule",{value:!0}),De.expand_message_xmd=t,De.expand_message_xof=s,De.hash_to_field=d,De.isogenyMap=m,De.createHasher=p;const e=Me(),n=Ae(),a=n.bytesToNumberBE;function i(g,l){if(r(g),r(l),g<0||g>=1<<8*l)throw new Error("invalid I2OSP input: "+g);const S=Array.from({length:l}).fill(0);for(let A=l-1;A>=0;A--)S[A]=g&255,g>>>=8;return new Uint8Array(S)}function h(g,l){const S=new Uint8Array(g.length);for(let A=0;A<g.length;A++)S[A]=g[A]^l[A];return S}function r(g){if(!Number.isSafeInteger(g))throw new Error("number expected")}function t(g,l,S,A){(0,n.abytes)(g),(0,n.abytes)(l),r(S),l.length>255&&(l=A((0,n.concatBytes)((0,n.utf8ToBytes)("H2C-OVERSIZE-DST-"),l)));const{outputLen:j,blockLen:v}=A,_=Math.ceil(S/j);if(S>65535||_>255)throw new Error("expand_message_xmd: invalid lenInBytes");const R=(0,n.concatBytes)(l,i(l.length,1)),P=i(0,v),f=i(S,2),y=new Array(_),c=A((0,n.concatBytes)(P,g,f,i(0,1),R));y[0]=A((0,n.concatBytes)(c,i(1,1),R));for(let D=1;D<=_;D++){const $=[h(c,y[D-1]),i(D+1,1),R];y[D]=A((0,n.concatBytes)(...$))}return(0,n.concatBytes)(...y).slice(0,S)}function s(g,l,S,A,j){if((0,n.abytes)(g),(0,n.abytes)(l),r(S),l.length>255){const v=Math.ceil(2*A/8);l=j.create({dkLen:v}).update((0,n.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(l).digest()}if(S>65535||l.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return j.create({dkLen:S}).update(g).update(i(S,2)).update(l).update(i(l.length,1)).digest()}function d(g,l,S){(0,n.validateObject)(S,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:A,k:j,m:v,hash:_,expand:R,DST:P}=S;(0,n.abytes)(g),r(l);const f=typeof P=="string"?(0,n.utf8ToBytes)(P):P,y=A.toString(2).length,c=Math.ceil((y+j)/8),q=l*v*c;let D;if(R==="xmd")D=t(g,f,q,_);else if(R==="xof")D=s(g,f,q,j,_);else if(R==="_internal_pass")D=g;else throw new Error('expand must be "xmd" or "xof"');const $=new Array(l);for(let H=0;H<l;H++){const E=new Array(v);for(let I=0;I<v;I++){const k=c*(I+H*v),u=D.subarray(k,k+c);E[I]=(0,e.mod)(a(u),A)}$[H]=E}return $}function m(g,l){const S=l.map(A=>Array.from(A).reverse());return(A,j)=>{const[v,_,R,P]=S.map(f=>f.reduce((y,c)=>g.add(g.mul(y,A),c)));return A=g.div(v,_),j=g.mul(j,g.div(R,P)),{x:A,y:j}}}function p(g,l,S){if(typeof l!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(A,j){const v=d(A,2,{...S,DST:S.DST,...j}),_=g.fromAffine(l(v[0])),R=g.fromAffine(l(v[1])),P=_.add(R).clearCofactor();return P.assertValidity(),P},encodeToCurve(A,j){const v=d(A,1,{...S,DST:S.encodeDST,...j}),_=g.fromAffine(l(v[0])).clearCofactor();return _.assertValidity(),_},mapToCurve(A){if(!Array.isArray(A))throw new Error("mapToCurve: expected array of bigints");for(const v of A)if(typeof v!="bigint")throw new Error("mapToCurve: expected array of bigints");const j=g.fromAffine(l(A)).clearCofactor();return j.assertValidity(),j}}}return De}var _t={},Ks;function lc(){if(Ks)return _t;Ks=1,Object.defineProperty(_t,"__esModule",{value:!0}),_t.montgomery=r;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=Me(),n=Ae(),a=BigInt(0),i=BigInt(1);function h(t){return(0,n.validateObject)(t,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...t})}function r(t){const s=h(t),{P:d}=s,m=D=>(0,e.mod)(D,d),p=s.montgomeryBits,g=Math.ceil(p/8),l=s.nByteLength,S=s.adjustScalarBytes||(D=>D),A=s.powPminus2||(D=>(0,e.pow)(D,d-BigInt(2),d));function j(D,$,H){const E=m(D*($-H));return $=m($-E),H=m(H+E),[$,H]}const v=(s.a-BigInt(2))/BigInt(4);function _(D,$){(0,n.aInRange)("u",D,a,d),(0,n.aInRange)("scalar",$,a,d);const H=$,E=D;let I=i,k=a,u=D,N=i,b=a,B;for(let L=BigInt(p-1);L>=a;L--){const o=H>>L&i;b^=o,B=j(b,I,u),I=B[0],u=B[1],B=j(b,k,N),k=B[0],N=B[1],b=o;const w=I+k,C=m(w*w),G=I-k,x=m(G*G),K=C-x,te=u+N,M=u-N,O=m(M*w),F=m(te*G),Z=O+F,W=O-F;u=m(Z*Z),N=m(E*m(W*W)),I=m(C*x),k=m(K*(C+m(v*K)))}B=j(b,I,u),I=B[0],u=B[1],B=j(b,k,N),k=B[0],N=B[1];const T=A(k);return m(I*T)}function R(D){return(0,n.numberToBytesLE)(m(D),g)}function P(D){const $=(0,n.ensureBytes)("u coordinate",D,g);return l===32&&($[31]&=127),(0,n.bytesToNumberLE)($)}function f(D){const $=(0,n.ensureBytes)("scalar",D),H=$.length;if(H!==g&&H!==l){let E=""+g+" or "+l;throw new Error("invalid scalar, expected "+E+" bytes, got "+H)}return(0,n.bytesToNumberLE)(S($))}function y(D,$){const H=P($),E=f(D),I=_(H,E);if(I===a)throw new Error("invalid private or public key received");return R(I)}const c=R(s.Gu);function q(D){return y(D,c)}return{scalarMult:y,scalarMultBase:q,getSharedSecret:(D,$)=>y(D,$),getPublicKey:D=>q(D),utils:{randomPrivateKey:()=>s.randomBytes(s.nByteLength)},GuBytes:c}}return _t}var qs;function fc(){return qs||(qs=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hash_to_ristretto255=e.hashToRistretto255=e.RistrettoPoint=e.encodeToCurve=e.hashToCurve=e.edwardsToMontgomery=e.x25519=e.ed25519ph=e.ed25519ctx=e.ed25519=e.ED25519_TORSION_SUBGROUP=void 0,e.edwardsToMontgomeryPub=q,e.edwardsToMontgomeryPriv=D;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const n=ac(),a=$e(),i=Gt(),h=uc(),r=Ds(),t=Me(),s=lc(),d=Ae(),m=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),p=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),g=BigInt(0),l=BigInt(1),S=BigInt(2),A=BigInt(3),j=BigInt(5),v=BigInt(8);function _(O){const F=BigInt(10),Z=BigInt(20),W=BigInt(40),J=BigInt(80),Q=m,U=O*O%Q*O%Q,z=(0,t.pow2)(U,S,Q)*U%Q,ee=(0,t.pow2)(z,l,Q)*O%Q,Y=(0,t.pow2)(ee,j,Q)*ee%Q,re=(0,t.pow2)(Y,F,Q)*Y%Q,X=(0,t.pow2)(re,Z,Q)*re%Q,ne=(0,t.pow2)(X,W,Q)*X%Q,se=(0,t.pow2)(ne,J,Q)*ne%Q,oe=(0,t.pow2)(se,J,Q)*ne%Q,ie=(0,t.pow2)(oe,F,Q)*Y%Q;return{pow_p_5_8:(0,t.pow2)(ie,S,Q)*O%Q,b2:U}}function R(O){return O[0]&=248,O[31]&=127,O[31]|=64,O}function P(O,F){const Z=m,W=(0,t.mod)(F*F*F,Z),J=(0,t.mod)(W*W*F,Z),Q=_(O*J).pow_p_5_8;let V=(0,t.mod)(O*W*Q,Z);const U=(0,t.mod)(F*V*V,Z),z=V,ee=(0,t.mod)(V*p,Z),Y=U===O,re=U===(0,t.mod)(-O,Z),X=U===(0,t.mod)(-O*p,Z);return Y&&(V=z),(re||X)&&(V=ee),(0,t.isNegativeLE)(V,Z)&&(V=(0,t.mod)(-V,Z)),{isValid:Y||re,value:V}}e.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];const f=(0,t.Field)(m,void 0,!0),y={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:f,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:v,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:n.sha512,randomBytes:a.randomBytes,adjustScalarBytes:R,uvRatio:P};e.ed25519=(0,h.twistedEdwards)(y);function c(O,F,Z){if(F.length>255)throw new Error("Context is too big");return(0,a.concatBytes)((0,a.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([Z?1:0,F.length]),F,O)}e.ed25519ctx=(0,h.twistedEdwards)({...y,domain:c}),e.ed25519ph=(0,h.twistedEdwards)(Object.assign({},y,{domain:c,prehash:n.sha512})),e.x25519=(0,s.montgomery)({P:m,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:O=>{const F=m,{pow_p_5_8:Z,b2:W}=_(O);return(0,t.mod)((0,t.pow2)(Z,A,F)*W,F)},adjustScalarBytes:R,randomBytes:a.randomBytes});function q(O){const{y:F}=e.ed25519.ExtendedPoint.fromHex(O),Z=BigInt(1);return f.toBytes(f.create((Z+F)*f.inv(Z-F)))}e.edwardsToMontgomery=q;function D(O){const F=y.hash(O.subarray(0,32));return y.adjustScalarBytes(F).subarray(0,32)}const $=(f.ORDER+A)/v,H=f.pow(S,$),E=f.sqrt(f.neg(f.ONE));function I(O){const F=(f.ORDER-j)/v,Z=BigInt(486662);let W=f.sqr(O);W=f.mul(W,S);let J=f.add(W,f.ONE),Q=f.neg(Z),V=f.sqr(J),U=f.mul(V,J),z=f.mul(W,Z);z=f.mul(z,Q),z=f.add(z,V),z=f.mul(z,Q);let ee=f.sqr(U);V=f.sqr(ee),ee=f.mul(ee,U),ee=f.mul(ee,z),V=f.mul(V,ee);let Y=f.pow(V,F);Y=f.mul(Y,ee);let re=f.mul(Y,E);V=f.sqr(Y),V=f.mul(V,U);let X=f.eql(V,z),ne=f.cmov(re,Y,X),se=f.mul(Q,W),oe=f.mul(Y,O);oe=f.mul(oe,H);let ie=f.mul(oe,E),fe=f.mul(z,W);V=f.sqr(oe),V=f.mul(V,U);let le=f.eql(V,fe),ve=f.cmov(ie,oe,le);V=f.sqr(ne),V=f.mul(V,U);let ye=f.eql(V,z),be=f.cmov(se,Q,ye),ge=f.cmov(ve,ne,ye),Ee=f.isOdd(ge);return ge=f.cmov(ge,f.neg(ge),ye!==Ee),{xMn:be,xMd:J,yMn:ge,yMd:l}}const k=(0,t.FpSqrtEven)(f,f.neg(BigInt(486664)));function u(O){const{xMn:F,xMd:Z,yMn:W,yMd:J}=I(O);let Q=f.mul(F,J);Q=f.mul(Q,k);let V=f.mul(Z,W),U=f.sub(F,Z),z=f.add(F,Z),ee=f.mul(V,z),Y=f.eql(ee,f.ZERO);Q=f.cmov(Q,f.ZERO,Y),V=f.cmov(V,f.ONE,Y),U=f.cmov(U,f.ONE,Y),z=f.cmov(z,f.ONE,Y);const re=f.invertBatch([V,z]);return{x:f.mul(Q,re[0]),y:f.mul(U,re[1])}}const N=(0,r.createHasher)(e.ed25519.ExtendedPoint,O=>u(O[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:f.ORDER,m:1,k:128,expand:"xmd",hash:n.sha512});e.hashToCurve=N.hashToCurve,e.encodeToCurve=N.encodeToCurve;function b(O){if(!(O instanceof te))throw new Error("RistrettoPoint expected")}const B=p,T=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),L=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),o=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),w=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),C=O=>P(l,O),G=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),x=O=>e.ed25519.CURVE.Fp.create((0,d.bytesToNumberLE)(O)&G);function K(O){const{d:F}=e.ed25519.CURVE,Z=e.ed25519.CURVE.Fp.ORDER,W=e.ed25519.CURVE.Fp.create,J=W(B*O*O),Q=W((J+l)*o);let V=BigInt(-1);const U=W((V-F*J)*W(J+F));let{isValid:z,value:ee}=P(Q,U),Y=W(ee*O);(0,t.isNegativeLE)(Y,Z)||(Y=W(-Y)),z||(ee=Y),z||(V=J);const re=W(V*(J-l)*w-U),X=ee*ee,ne=W((ee+ee)*U),se=W(re*T),oe=W(l-X),ie=W(l+X);return new e.ed25519.ExtendedPoint(W(ne*ie),W(oe*se),W(se*ie),W(ne*oe))}class te{constructor(F){this.ep=F}static fromAffine(F){return new te(e.ed25519.ExtendedPoint.fromAffine(F))}static hashToCurve(F){F=(0,d.ensureBytes)("ristrettoHash",F,64);const Z=x(F.slice(0,32)),W=K(Z),J=x(F.slice(32,64)),Q=K(J);return new te(W.add(Q))}static fromHex(F){F=(0,d.ensureBytes)("ristrettoHex",F,32);const{a:Z,d:W}=e.ed25519.CURVE,J=e.ed25519.CURVE.Fp.ORDER,Q=e.ed25519.CURVE.Fp.create,V="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",U=x(F);if(!(0,d.equalBytes)((0,d.numberToBytesLE)(U,32),F)||(0,t.isNegativeLE)(U,J))throw new Error(V);const z=Q(U*U),ee=Q(l+Z*z),Y=Q(l-Z*z),re=Q(ee*ee),X=Q(Y*Y),ne=Q(Z*W*re-X),{isValid:se,value:oe}=C(Q(ne*X)),ie=Q(oe*Y),fe=Q(oe*ie*ne);let le=Q((U+U)*ie);(0,t.isNegativeLE)(le,J)&&(le=Q(-le));const ve=Q(ee*fe),ye=Q(le*ve);if(!se||(0,t.isNegativeLE)(ye,J)||ve===g)throw new Error(V);return new te(new e.ed25519.ExtendedPoint(le,ve,l,ye))}static msm(F,Z){const W=(0,t.Field)(e.ed25519.CURVE.n,e.ed25519.CURVE.nBitLength);return(0,i.pippenger)(te,W,F,Z)}toRawBytes(){let{ex:F,ey:Z,ez:W,et:J}=this.ep;const Q=e.ed25519.CURVE.Fp.ORDER,V=e.ed25519.CURVE.Fp.create,U=V(V(W+Z)*V(W-Z)),z=V(F*Z),ee=V(z*z),{value:Y}=C(V(U*ee)),re=V(Y*U),X=V(Y*z),ne=V(re*X*J);let se;if((0,t.isNegativeLE)(J*ne,Q)){let ie=V(Z*B),fe=V(F*B);F=ie,Z=fe,se=V(re*L)}else se=X;(0,t.isNegativeLE)(F*ne,Q)&&(Z=V(-Z));let oe=V((W-Z)*se);return(0,t.isNegativeLE)(oe,Q)&&(oe=V(-oe)),(0,d.numberToBytesLE)(oe,32)}toHex(){return(0,d.bytesToHex)(this.toRawBytes())}toString(){return this.toHex()}equals(F){b(F);const{ex:Z,ey:W}=this.ep,{ex:J,ey:Q}=F.ep,V=e.ed25519.CURVE.Fp.create,U=V(Z*Q)===V(W*J),z=V(W*Q)===V(Z*J);return U||z}add(F){return b(F),new te(this.ep.add(F.ep))}subtract(F){return b(F),new te(this.ep.subtract(F.ep))}multiply(F){return new te(this.ep.multiply(F))}multiplyUnsafe(F){return new te(this.ep.multiplyUnsafe(F))}double(){return new te(this.ep.double())}negate(){return new te(this.ep.negate())}}e.RistrettoPoint=(te.BASE||(te.BASE=new te(e.ed25519.ExtendedPoint.BASE)),te.ZERO||(te.ZERO=new te(e.ed25519.ExtendedPoint.ZERO)),te);const M=(O,F)=>{const Z=F.DST,W=typeof Z=="string"?(0,a.utf8ToBytes)(Z):Z,J=(0,r.expand_message_xmd)(O,W,64,n.sha512);return te.hashToCurve(J)};e.hashToRistretto255=M,e.hash_to_ristretto255=e.hashToRistretto255}(Vt)),Vt}var Yt={},Pe={},Hs;function js(){if(Hs)return Pe;Hs=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.sha224=Pe.sha256=Pe.SHA256=void 0;const e=Is(),n=$e(),a=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),i=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),h=new Uint32Array(64);class r extends e.HashMD{constructor(){super(64,32,8,!1),this.A=i[0]|0,this.B=i[1]|0,this.C=i[2]|0,this.D=i[3]|0,this.E=i[4]|0,this.F=i[5]|0,this.G=i[6]|0,this.H=i[7]|0}get(){const{A:d,B:m,C:p,D:g,E:l,F:S,G:A,H:j}=this;return[d,m,p,g,l,S,A,j]}set(d,m,p,g,l,S,A,j){this.A=d|0,this.B=m|0,this.C=p|0,this.D=g|0,this.E=l|0,this.F=S|0,this.G=A|0,this.H=j|0}process(d,m){for(let R=0;R<16;R++,m+=4)h[R]=d.getUint32(m,!1);for(let R=16;R<64;R++){const P=h[R-15],f=h[R-2],y=(0,n.rotr)(P,7)^(0,n.rotr)(P,18)^P>>>3,c=(0,n.rotr)(f,17)^(0,n.rotr)(f,19)^f>>>10;h[R]=c+h[R-7]+y+h[R-16]|0}let{A:p,B:g,C:l,D:S,E:A,F:j,G:v,H:_}=this;for(let R=0;R<64;R++){const P=(0,n.rotr)(A,6)^(0,n.rotr)(A,11)^(0,n.rotr)(A,25),f=_+P+(0,e.Chi)(A,j,v)+a[R]+h[R]|0,c=((0,n.rotr)(p,2)^(0,n.rotr)(p,13)^(0,n.rotr)(p,22))+(0,e.Maj)(p,g,l)|0;_=v,v=j,j=A,A=S+f|0,S=l,l=g,g=p,p=f+c|0}p=p+this.A|0,g=g+this.B|0,l=l+this.C|0,S=S+this.D|0,A=A+this.E|0,j=j+this.F|0,v=v+this.G|0,_=_+this.H|0,this.set(p,g,l,S,A,j,v,_)}roundClean(){h.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}Pe.SHA256=r;class t extends r{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}return Pe.sha256=(0,n.wrapConstructor)(()=>new r),Pe.sha224=(0,n.wrapConstructor)(()=>new t),Pe}var ft={},Wt={},ks;function Fs(){return ks||(ks=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const n=bt(),a=$e();class i extends a.Hash{constructor(t,s){super(),this.finished=!1,this.destroyed=!1,(0,n.ahash)(t);const d=(0,a.toBytes)(s);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const m=this.blockLen,p=new Uint8Array(m);p.set(d.length>m?t.create().update(d).digest():d);for(let g=0;g<p.length;g++)p[g]^=54;this.iHash.update(p),this.oHash=t.create();for(let g=0;g<p.length;g++)p[g]^=106;this.oHash.update(p),p.fill(0)}update(t){return(0,n.aexists)(this),this.iHash.update(t),this}digestInto(t){(0,n.aexists)(this),(0,n.abytes)(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:s,iHash:d,finished:m,destroyed:p,blockLen:g,outputLen:l}=this;return t=t,t.finished=m,t.destroyed=p,t.blockLen=g,t.outputLen=l,t.oHash=s._cloneInto(t.oHash),t.iHash=d._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=i;const h=(r,t,s)=>new i(r,t).update(s).digest();e.hmac=h,e.hmac.create=(r,t)=>new i(r,t)}(Wt)),Wt}var Zt={},Ms;function Vs(){return Ms||(Ms=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=e.DERErr=void 0,e.weierstrassPoints=j,e.weierstrass=_,e.SWUFpSqrtRatio=R,e.mapToCurveSimpleSWU=P;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const n=Gt(),a=Me(),i=Ae(),h=Ae();function r(f){f.lowS!==void 0&&(0,h.abool)("lowS",f.lowS),f.prehash!==void 0&&(0,h.abool)("prehash",f.prehash)}function t(f){const y=(0,n.validateBasic)(f);i.validateObject(y,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:c,Fp:q,a:D}=y;if(c){if(!q.eql(D,q.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof c!="object"||typeof c.beta!="bigint"||typeof c.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...y})}const{bytesToNumberBE:s,hexToBytes:d}=i;class m extends Error{constructor(y=""){super(y)}}e.DERErr=m,e.DER={Err:m,_tlv:{encode:(f,y)=>{const{Err:c}=e.DER;if(f<0||f>256)throw new c("tlv.encode: wrong tag");if(y.length&1)throw new c("tlv.encode: unpadded data");const q=y.length/2,D=i.numberToHexUnpadded(q);if(D.length/2&128)throw new c("tlv.encode: long form length too big");const $=q>127?i.numberToHexUnpadded(D.length/2|128):"";return i.numberToHexUnpadded(f)+$+D+y},decode(f,y){const{Err:c}=e.DER;let q=0;if(f<0||f>256)throw new c("tlv.encode: wrong tag");if(y.length<2||y[q++]!==f)throw new c("tlv.decode: wrong tlv");const D=y[q++],$=!!(D&128);let H=0;if(!$)H=D;else{const I=D&127;if(!I)throw new c("tlv.decode(long): indefinite length not supported");if(I>4)throw new c("tlv.decode(long): byte length is too big");const k=y.subarray(q,q+I);if(k.length!==I)throw new c("tlv.decode: length bytes not complete");if(k[0]===0)throw new c("tlv.decode(long): zero leftmost byte");for(const u of k)H=H<<8|u;if(q+=I,H<128)throw new c("tlv.decode(long): not minimal encoding")}const E=y.subarray(q,q+H);if(E.length!==H)throw new c("tlv.decode: wrong value length");return{v:E,l:y.subarray(q+H)}}},_int:{encode(f){const{Err:y}=e.DER;if(f<p)throw new y("integer: negative integers are not allowed");let c=i.numberToHexUnpadded(f);if(Number.parseInt(c[0],16)&8&&(c="00"+c),c.length&1)throw new y("unexpected DER parsing assertion: unpadded hex");return c},decode(f){const{Err:y}=e.DER;if(f[0]&128)throw new y("invalid signature integer: negative");if(f[0]===0&&!(f[1]&128))throw new y("invalid signature integer: unnecessary leading zero");return s(f)}},toSig(f){const{Err:y,_int:c,_tlv:q}=e.DER,D=typeof f=="string"?d(f):f;i.abytes(D);const{v:$,l:H}=q.decode(48,D);if(H.length)throw new y("invalid signature: left bytes after parsing");const{v:E,l:I}=q.decode(2,$),{v:k,l:u}=q.decode(2,I);if(u.length)throw new y("invalid signature: left bytes after parsing");return{r:c.decode(E),s:c.decode(k)}},hexFromSig(f){const{_tlv:y,_int:c}=e.DER,q=y.encode(2,c.encode(f.r)),D=y.encode(2,c.encode(f.s)),$=q+D;return y.encode(48,$)}};const p=BigInt(0),g=BigInt(1),l=BigInt(2),S=BigInt(3),A=BigInt(4);function j(f){const y=t(f),{Fp:c}=y,q=(0,a.Field)(y.n,y.nBitLength),D=y.toBytes||((L,o,w)=>{const C=o.toAffine();return i.concatBytes(Uint8Array.from([4]),c.toBytes(C.x),c.toBytes(C.y))}),$=y.fromBytes||(L=>{const o=L.subarray(1),w=c.fromBytes(o.subarray(0,c.BYTES)),C=c.fromBytes(o.subarray(c.BYTES,2*c.BYTES));return{x:w,y:C}});function H(L){const{a:o,b:w}=y,C=c.sqr(L),G=c.mul(C,L);return c.add(c.add(G,c.mul(L,o)),w)}if(!c.eql(c.sqr(y.Gy),H(y.Gx)))throw new Error("bad generator point: equation left != right");function E(L){return i.inRange(L,g,y.n)}function I(L){const{allowedPrivateKeyLengths:o,nByteLength:w,wrapPrivateKey:C,n:G}=y;if(o&&typeof L!="bigint"){if(i.isBytes(L)&&(L=i.bytesToHex(L)),typeof L!="string"||!o.includes(L.length))throw new Error("invalid private key");L=L.padStart(w*2,"0")}let x;try{x=typeof L=="bigint"?L:i.bytesToNumberBE((0,h.ensureBytes)("private key",L,w))}catch{throw new Error("invalid private key, expected hex or "+w+" bytes, got "+typeof L)}return C&&(x=(0,a.mod)(x,G)),i.aInRange("private key",x,g,G),x}function k(L){if(!(L instanceof b))throw new Error("ProjectivePoint expected")}const u=(0,h.memoized)((L,o)=>{const{px:w,py:C,pz:G}=L;if(c.eql(G,c.ONE))return{x:w,y:C};const x=L.is0();o==null&&(o=x?c.ONE:c.inv(G));const K=c.mul(w,o),te=c.mul(C,o),M=c.mul(G,o);if(x)return{x:c.ZERO,y:c.ZERO};if(!c.eql(M,c.ONE))throw new Error("invZ was invalid");return{x:K,y:te}}),N=(0,h.memoized)(L=>{if(L.is0()){if(y.allowInfinityPoint&&!c.is0(L.py))return;throw new Error("bad point: ZERO")}const{x:o,y:w}=L.toAffine();if(!c.isValid(o)||!c.isValid(w))throw new Error("bad point: x or y not FE");const C=c.sqr(w),G=H(o);if(!c.eql(C,G))throw new Error("bad point: equation left != right");if(!L.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class b{constructor(o,w,C){if(this.px=o,this.py=w,this.pz=C,o==null||!c.isValid(o))throw new Error("x required");if(w==null||!c.isValid(w))throw new Error("y required");if(C==null||!c.isValid(C))throw new Error("z required");Object.freeze(this)}static fromAffine(o){const{x:w,y:C}=o||{};if(!o||!c.isValid(w)||!c.isValid(C))throw new Error("invalid affine point");if(o instanceof b)throw new Error("projective point not allowed");const G=x=>c.eql(x,c.ZERO);return G(w)&&G(C)?b.ZERO:new b(w,C,c.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(o){const w=c.invertBatch(o.map(C=>C.pz));return o.map((C,G)=>C.toAffine(w[G])).map(b.fromAffine)}static fromHex(o){const w=b.fromAffine($((0,h.ensureBytes)("pointHex",o)));return w.assertValidity(),w}static fromPrivateKey(o){return b.BASE.multiply(I(o))}static msm(o,w){return(0,n.pippenger)(b,q,o,w)}_setWindowSize(o){T.setWindowSize(this,o)}assertValidity(){N(this)}hasEvenY(){const{y:o}=this.toAffine();if(c.isOdd)return!c.isOdd(o);throw new Error("Field doesn't support isOdd")}equals(o){k(o);const{px:w,py:C,pz:G}=this,{px:x,py:K,pz:te}=o,M=c.eql(c.mul(w,te),c.mul(x,G)),O=c.eql(c.mul(C,te),c.mul(K,G));return M&&O}negate(){return new b(this.px,c.neg(this.py),this.pz)}double(){const{a:o,b:w}=y,C=c.mul(w,S),{px:G,py:x,pz:K}=this;let te=c.ZERO,M=c.ZERO,O=c.ZERO,F=c.mul(G,G),Z=c.mul(x,x),W=c.mul(K,K),J=c.mul(G,x);return J=c.add(J,J),O=c.mul(G,K),O=c.add(O,O),te=c.mul(o,O),M=c.mul(C,W),M=c.add(te,M),te=c.sub(Z,M),M=c.add(Z,M),M=c.mul(te,M),te=c.mul(J,te),O=c.mul(C,O),W=c.mul(o,W),J=c.sub(F,W),J=c.mul(o,J),J=c.add(J,O),O=c.add(F,F),F=c.add(O,F),F=c.add(F,W),F=c.mul(F,J),M=c.add(M,F),W=c.mul(x,K),W=c.add(W,W),F=c.mul(W,J),te=c.sub(te,F),O=c.mul(W,Z),O=c.add(O,O),O=c.add(O,O),new b(te,M,O)}add(o){k(o);const{px:w,py:C,pz:G}=this,{px:x,py:K,pz:te}=o;let M=c.ZERO,O=c.ZERO,F=c.ZERO;const Z=y.a,W=c.mul(y.b,S);let J=c.mul(w,x),Q=c.mul(C,K),V=c.mul(G,te),U=c.add(w,C),z=c.add(x,K);U=c.mul(U,z),z=c.add(J,Q),U=c.sub(U,z),z=c.add(w,G);let ee=c.add(x,te);return z=c.mul(z,ee),ee=c.add(J,V),z=c.sub(z,ee),ee=c.add(C,G),M=c.add(K,te),ee=c.mul(ee,M),M=c.add(Q,V),ee=c.sub(ee,M),F=c.mul(Z,z),M=c.mul(W,V),F=c.add(M,F),M=c.sub(Q,F),F=c.add(Q,F),O=c.mul(M,F),Q=c.add(J,J),Q=c.add(Q,J),V=c.mul(Z,V),z=c.mul(W,z),Q=c.add(Q,V),V=c.sub(J,V),V=c.mul(Z,V),z=c.add(z,V),J=c.mul(Q,z),O=c.add(O,J),J=c.mul(ee,z),M=c.mul(U,M),M=c.sub(M,J),J=c.mul(U,Q),F=c.mul(ee,F),F=c.add(F,J),new b(M,O,F)}subtract(o){return this.add(o.negate())}is0(){return this.equals(b.ZERO)}wNAF(o){return T.wNAFCached(this,o,b.normalizeZ)}multiplyUnsafe(o){const{endo:w,n:C}=y;i.aInRange("scalar",o,p,C);const G=b.ZERO;if(o===p)return G;if(this.is0()||o===g)return this;if(!w||T.hasPrecomputes(this))return T.wNAFCachedUnsafe(this,o,b.normalizeZ);let{k1neg:x,k1:K,k2neg:te,k2:M}=w.splitScalar(o),O=G,F=G,Z=this;for(;K>p||M>p;)K&g&&(O=O.add(Z)),M&g&&(F=F.add(Z)),Z=Z.double(),K>>=g,M>>=g;return x&&(O=O.negate()),te&&(F=F.negate()),F=new b(c.mul(F.px,w.beta),F.py,F.pz),O.add(F)}multiply(o){const{endo:w,n:C}=y;i.aInRange("scalar",o,g,C);let G,x;if(w){const{k1neg:K,k1:te,k2neg:M,k2:O}=w.splitScalar(o);let{p:F,f:Z}=this.wNAF(te),{p:W,f:J}=this.wNAF(O);F=T.constTimeNegate(K,F),W=T.constTimeNegate(M,W),W=new b(c.mul(W.px,w.beta),W.py,W.pz),G=F.add(W),x=Z.add(J)}else{const{p:K,f:te}=this.wNAF(o);G=K,x=te}return b.normalizeZ([G,x])[0]}multiplyAndAddUnsafe(o,w,C){const G=b.BASE,x=(te,M)=>M===p||M===g||!te.equals(G)?te.multiplyUnsafe(M):te.multiply(M),K=x(this,w).add(x(o,C));return K.is0()?void 0:K}toAffine(o){return u(this,o)}isTorsionFree(){const{h:o,isTorsionFree:w}=y;if(o===g)return!0;if(w)return w(b,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:o,clearCofactor:w}=y;return o===g?this:w?w(b,this):this.multiplyUnsafe(y.h)}toRawBytes(o=!0){return(0,h.abool)("isCompressed",o),this.assertValidity(),D(b,this,o)}toHex(o=!0){return(0,h.abool)("isCompressed",o),i.bytesToHex(this.toRawBytes(o))}}b.BASE=new b(y.Gx,y.Gy,c.ONE),b.ZERO=new b(c.ZERO,c.ONE,c.ZERO);const B=y.nBitLength,T=(0,n.wNAF)(b,y.endo?Math.ceil(B/2):B);return{CURVE:y,ProjectivePoint:b,normPrivateKeyToScalar:I,weierstrassEquation:H,isWithinCurveOrder:E}}function v(f){const y=(0,n.validateBasic)(f);return i.validateObject(y,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...y})}function _(f){const y=v(f),{Fp:c,n:q}=y,D=c.BYTES+1,$=2*c.BYTES+1;function H(V){return(0,a.mod)(V,q)}function E(V){return(0,a.invert)(V,q)}const{ProjectivePoint:I,normPrivateKeyToScalar:k,weierstrassEquation:u,isWithinCurveOrder:N}=j({...y,toBytes(V,U,z){const ee=U.toAffine(),Y=c.toBytes(ee.x),re=i.concatBytes;return(0,h.abool)("isCompressed",z),z?re(Uint8Array.from([U.hasEvenY()?2:3]),Y):re(Uint8Array.from([4]),Y,c.toBytes(ee.y))},fromBytes(V){const U=V.length,z=V[0],ee=V.subarray(1);if(U===D&&(z===2||z===3)){const Y=i.bytesToNumberBE(ee);if(!i.inRange(Y,g,c.ORDER))throw new Error("Point is not on curve");const re=u(Y);let X;try{X=c.sqrt(re)}catch(oe){const ie=oe instanceof Error?": "+oe.message:"";throw new Error("Point is not on curve"+ie)}const ne=(X&g)===g;return(z&1)===1!==ne&&(X=c.neg(X)),{x:Y,y:X}}else if(U===$&&z===4){const Y=c.fromBytes(ee.subarray(0,c.BYTES)),re=c.fromBytes(ee.subarray(c.BYTES,2*c.BYTES));return{x:Y,y:re}}else{const Y=D,re=$;throw new Error("invalid Point, expected length of "+Y+", or uncompressed "+re+", got "+U)}}}),b=V=>i.bytesToHex(i.numberToBytesBE(V,y.nByteLength));function B(V){const U=q>>g;return V>U}function T(V){return B(V)?H(-V):V}const L=(V,U,z)=>i.bytesToNumberBE(V.slice(U,z));class o{constructor(U,z,ee){this.r=U,this.s=z,this.recovery=ee,this.assertValidity()}static fromCompact(U){const z=y.nByteLength;return U=(0,h.ensureBytes)("compactSignature",U,z*2),new o(L(U,0,z),L(U,z,2*z))}static fromDER(U){const{r:z,s:ee}=e.DER.toSig((0,h.ensureBytes)("DER",U));return new o(z,ee)}assertValidity(){i.aInRange("r",this.r,g,q),i.aInRange("s",this.s,g,q)}addRecoveryBit(U){return new o(this.r,this.s,U)}recoverPublicKey(U){const{r:z,s:ee,recovery:Y}=this,re=te((0,h.ensureBytes)("msgHash",U));if(Y==null||![0,1,2,3].includes(Y))throw new Error("recovery id invalid");const X=Y===2||Y===3?z+y.n:z;if(X>=c.ORDER)throw new Error("recovery id 2 or 3 invalid");const ne=(Y&1)===0?"02":"03",se=I.fromHex(ne+b(X)),oe=E(X),ie=H(-re*oe),fe=H(ee*oe),le=I.BASE.multiplyAndAddUnsafe(se,ie,fe);if(!le)throw new Error("point at infinify");return le.assertValidity(),le}hasHighS(){return B(this.s)}normalizeS(){return this.hasHighS()?new o(this.r,H(-this.s),this.recovery):this}toDERRawBytes(){return i.hexToBytes(this.toDERHex())}toDERHex(){return e.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return i.hexToBytes(this.toCompactHex())}toCompactHex(){return b(this.r)+b(this.s)}}const w={isValidPrivateKey(V){try{return k(V),!0}catch{return!1}},normPrivateKeyToScalar:k,randomPrivateKey:()=>{const V=(0,a.getMinHashLength)(y.n);return(0,a.mapHashToField)(y.randomBytes(V),y.n)},precompute(V=8,U=I.BASE){return U._setWindowSize(V),U.multiply(BigInt(3)),U}};function C(V,U=!0){return I.fromPrivateKey(V).toRawBytes(U)}function G(V){const U=i.isBytes(V),z=typeof V=="string",ee=(U||z)&&V.length;return U?ee===D||ee===$:z?ee===2*D||ee===2*$:V instanceof I}function x(V,U,z=!0){if(G(V))throw new Error("first arg must be private key");if(!G(U))throw new Error("second arg must be public key");return I.fromHex(U).multiply(k(V)).toRawBytes(z)}const K=y.bits2int||function(V){if(V.length>8192)throw new Error("input is too large");const U=i.bytesToNumberBE(V),z=V.length*8-y.nBitLength;return z>0?U>>BigInt(z):U},te=y.bits2int_modN||function(V){return H(K(V))},M=i.bitMask(y.nBitLength);function O(V){return i.aInRange("num < 2^"+y.nBitLength,V,p,M),i.numberToBytesBE(V,y.nByteLength)}function F(V,U,z=Z){if(["recovered","canonical"].some(ye=>ye in z))throw new Error("sign() legacy options not supported");const{hash:ee,randomBytes:Y}=y;let{lowS:re,prehash:X,extraEntropy:ne}=z;re==null&&(re=!0),V=(0,h.ensureBytes)("msgHash",V),r(z),X&&(V=(0,h.ensureBytes)("prehashed msgHash",ee(V)));const se=te(V),oe=k(U),ie=[O(oe),O(se)];if(ne!=null&&ne!==!1){const ye=ne===!0?Y(c.BYTES):ne;ie.push((0,h.ensureBytes)("extraEntropy",ye))}const fe=i.concatBytes(...ie),le=se;function ve(ye){const be=K(ye);if(!N(be))return;const ge=E(be),Ee=I.BASE.multiply(be).toAffine(),_e=H(Ee.x);if(_e===p)return;const Se=H(ge*H(le+_e*oe));if(Se===p)return;let Re=(Ee.x===_e?0:2)|Number(Ee.y&g),Xe=Se;return re&&B(Se)&&(Xe=T(Se),Re^=1),new o(_e,Xe,Re)}return{seed:fe,k2sig:ve}}const Z={lowS:y.lowS,prehash:!1},W={lowS:y.lowS,prehash:!1};function J(V,U,z=Z){const{seed:ee,k2sig:Y}=F(V,U,z),re=y;return i.createHmacDrbg(re.hash.outputLen,re.nByteLength,re.hmac)(ee,Y)}I.BASE._setWindowSize(8);function Q(V,U,z,ee=W){const Y=V;U=(0,h.ensureBytes)("msgHash",U),z=(0,h.ensureBytes)("publicKey",z);const{lowS:re,prehash:X,format:ne}=ee;if(r(ee),"strict"in ee)throw new Error("options.strict was renamed to lowS");if(ne!==void 0&&ne!=="compact"&&ne!=="der")throw new Error("format must be compact or der");const se=typeof Y=="string"||i.isBytes(Y),oe=!se&&!ne&&typeof Y=="object"&&Y!==null&&typeof Y.r=="bigint"&&typeof Y.s=="bigint";if(!se&&!oe)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let ie,fe;try{if(oe&&(ie=new o(Y.r,Y.s)),se){try{ne!=="compact"&&(ie=o.fromDER(Y))}catch(Re){if(!(Re instanceof e.DER.Err))throw Re}!ie&&ne!=="der"&&(ie=o.fromCompact(Y))}fe=I.fromHex(z)}catch{return!1}if(!ie||re&&ie.hasHighS())return!1;X&&(U=y.hash(U));const{r:le,s:ve}=ie,ye=te(U),be=E(ve),ge=H(ye*be),Ee=H(le*be),_e=I.BASE.multiplyAndAddUnsafe(fe,ge,Ee)?.toAffine();return _e?H(_e.x)===le:!1}return{CURVE:y,getPublicKey:C,getSharedSecret:x,sign:J,verify:Q,ProjectivePoint:I,Signature:o,utils:w}}function R(f,y){const c=f.ORDER;let q=p;for(let T=c-g;T%l===p;T/=l)q+=g;const D=q,$=l<<D-g-g,H=$*l,E=(c-g)/H,I=(E-g)/l,k=H-g,u=$,N=f.pow(y,E),b=f.pow(y,(E+g)/l);let B=(T,L)=>{let o=N,w=f.pow(L,k),C=f.sqr(w);C=f.mul(C,L);let G=f.mul(T,C);G=f.pow(G,I),G=f.mul(G,w),w=f.mul(G,L),C=f.mul(G,T);let x=f.mul(C,w);G=f.pow(x,u);let K=f.eql(G,f.ONE);w=f.mul(C,b),G=f.mul(x,o),C=f.cmov(w,C,K),x=f.cmov(G,x,K);for(let te=D;te>g;te--){let M=te-l;M=l<<M-g;let O=f.pow(x,M);const F=f.eql(O,f.ONE);w=f.mul(C,o),o=f.mul(o,o),O=f.mul(x,o),C=f.cmov(w,C,F),x=f.cmov(O,x,F)}return{isValid:K,value:C}};if(f.ORDER%A===S){const T=(f.ORDER-S)/A,L=f.sqrt(f.neg(y));B=(o,w)=>{let C=f.sqr(w);const G=f.mul(o,w);C=f.mul(C,G);let x=f.pow(C,T);x=f.mul(x,G);const K=f.mul(x,L),te=f.mul(f.sqr(x),w),M=f.eql(te,o);let O=f.cmov(K,x,M);return{isValid:M,value:O}}}return B}function P(f,y){if((0,a.validateField)(f),!f.isValid(y.A)||!f.isValid(y.B)||!f.isValid(y.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const c=R(f,y.Z);if(!f.isOdd)throw new Error("Fp.isOdd is not implemented!");return q=>{let D,$,H,E,I,k,u,N;D=f.sqr(q),D=f.mul(D,y.Z),$=f.sqr(D),$=f.add($,D),H=f.add($,f.ONE),H=f.mul(H,y.B),E=f.cmov(y.Z,f.neg($),!f.eql($,f.ZERO)),E=f.mul(E,y.A),$=f.sqr(H),k=f.sqr(E),I=f.mul(k,y.A),$=f.add($,I),$=f.mul($,H),k=f.mul(k,E),I=f.mul(k,y.B),$=f.add($,I),u=f.mul(D,H);const{isValid:b,value:B}=c($,k);N=f.mul(D,q),N=f.mul(N,B),u=f.cmov(u,H,b),N=f.cmov(N,B,b);const T=f.isOdd(q)===f.isOdd(N);return N=f.cmov(f.neg(N),N,T),u=f.div(u,E),{x:u,y:N}}}}(Zt)),Zt}var Us;function dc(){if(Us)return ft;Us=1,Object.defineProperty(ft,"__esModule",{value:!0}),ft.getHash=i,ft.createCurve=h;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=Fs(),n=$e(),a=Vs();function i(r){return{hash:r,hmac:(t,...s)=>(0,e.hmac)(r,t,(0,n.concatBytes)(...s)),randomBytes:n.randomBytes}}function h(r,t){const s=d=>(0,a.weierstrass)({...r,...i(d)});return{...s(t),create:s}}return ft}var Gs;function hc(){return Gs||(Gs=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.schnorr=e.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const n=js(),a=$e(),i=dc(),h=Ds(),r=Me(),t=Ae(),s=Vs(),d=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),m=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),p=BigInt(1),g=BigInt(2),l=(T,L)=>(T+L/g)/L;function S(T){const L=d,o=BigInt(3),w=BigInt(6),C=BigInt(11),G=BigInt(22),x=BigInt(23),K=BigInt(44),te=BigInt(88),M=T*T*T%L,O=M*M*T%L,F=(0,r.pow2)(O,o,L)*O%L,Z=(0,r.pow2)(F,o,L)*O%L,W=(0,r.pow2)(Z,g,L)*M%L,J=(0,r.pow2)(W,C,L)*W%L,Q=(0,r.pow2)(J,G,L)*J%L,V=(0,r.pow2)(Q,K,L)*Q%L,U=(0,r.pow2)(V,te,L)*V%L,z=(0,r.pow2)(U,K,L)*Q%L,ee=(0,r.pow2)(z,o,L)*O%L,Y=(0,r.pow2)(ee,x,L)*J%L,re=(0,r.pow2)(Y,w,L)*M%L,X=(0,r.pow2)(re,g,L);if(!A.eql(A.sqr(X),T))throw new Error("Cannot find square root");return X}const A=(0,r.Field)(d,void 0,void 0,{sqrt:S});e.secp256k1=(0,i.createCurve)({a:BigInt(0),b:BigInt(7),Fp:A,n:m,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:T=>{const L=m,o=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),w=-p*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),C=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),G=o,x=BigInt("0x100000000000000000000000000000000"),K=l(G*T,L),te=l(-w*T,L);let M=(0,r.mod)(T-K*o-te*C,L),O=(0,r.mod)(-K*w-te*G,L);const F=M>x,Z=O>x;if(F&&(M=L-M),Z&&(O=L-O),M>x||O>x)throw new Error("splitScalar: Endomorphism failed, k="+T);return{k1neg:F,k1:M,k2neg:Z,k2:O}}}},n.sha256);const j=BigInt(0),v={};function _(T,...L){let o=v[T];if(o===void 0){const w=(0,n.sha256)(Uint8Array.from(T,C=>C.charCodeAt(0)));o=(0,t.concatBytes)(w,w),v[T]=o}return(0,n.sha256)((0,t.concatBytes)(o,...L))}const R=T=>T.toRawBytes(!0).slice(1),P=T=>(0,t.numberToBytesBE)(T,32),f=T=>(0,r.mod)(T,d),y=T=>(0,r.mod)(T,m),c=e.secp256k1.ProjectivePoint,q=(T,L,o)=>c.BASE.multiplyAndAddUnsafe(T,L,o);function D(T){let L=e.secp256k1.utils.normPrivateKeyToScalar(T),o=c.fromPrivateKey(L);return{scalar:o.hasEvenY()?L:y(-L),bytes:R(o)}}function $(T){(0,t.aInRange)("x",T,p,d);const L=f(T*T),o=f(L*T+BigInt(7));let w=S(o);w%g!==j&&(w=f(-w));const C=new c(T,w,p);return C.assertValidity(),C}const H=t.bytesToNumberBE;function E(...T){return y(H(_("BIP0340/challenge",...T)))}function I(T){return D(T).bytes}function k(T,L,o=(0,a.randomBytes)(32)){const w=(0,t.ensureBytes)("message",T),{bytes:C,scalar:G}=D(L),x=(0,t.ensureBytes)("auxRand",o,32),K=P(G^H(_("BIP0340/aux",x))),te=_("BIP0340/nonce",K,C,w),M=y(H(te));if(M===j)throw new Error("sign failed: k is zero");const{bytes:O,scalar:F}=D(M),Z=E(O,C,w),W=new Uint8Array(64);if(W.set(O,0),W.set(P(y(F+Z*G)),32),!u(W,w,C))throw new Error("sign: Invalid signature produced");return W}function u(T,L,o){const w=(0,t.ensureBytes)("signature",T,64),C=(0,t.ensureBytes)("message",L),G=(0,t.ensureBytes)("publicKey",o,32);try{const x=$(H(G)),K=H(w.subarray(0,32));if(!(0,t.inRange)(K,p,d))return!1;const te=H(w.subarray(32,64));if(!(0,t.inRange)(te,p,m))return!1;const M=E(P(K),R(x),C),O=q(x,te,y(-M));return!(!O||!O.hasEvenY()||O.toAffine().x!==K)}catch{return!1}}e.schnorr={getPublicKey:I,sign:k,verify:u,utils:{randomPrivateKey:e.secp256k1.utils.randomPrivateKey,lift_x:$,pointToBytes:R,numberToBytesBE:t.numberToBytesBE,bytesToNumberBE:t.bytesToNumberBE,taggedHash:_,mod:r.mod}};const N=(0,h.isogenyMap)(A,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(T=>T.map(L=>BigInt(L)))),b=(0,s.mapToCurveSimpleSWU)(A,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:A.create(BigInt("-11"))}),B=(0,h.createHasher)(e.secp256k1.ProjectivePoint,T=>{const{x:L,y:o}=b(A.create(T[0]));return N(L,o)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:A.ORDER,m:1,k:128,expand:"xmd",hash:n.sha256});e.hashToCurve=B.hashToCurve,e.encodeToCurve=B.encodeToCurve}(Yt)),Yt}var zt={},Ys;function Ws(){return Ys||(Ys=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeHex=e.remove0x=void 0;var n=Ce(),a=function(h){return h.startsWith("0x")||h.startsWith("0X")?h.slice(2):h};e.remove0x=a;var i=function(h){return(0,n.hexToBytes)((0,e.remove0x)(h))};e.decodeHex=i}(zt)),zt}var Zs;function pc(){return Zs||(Zs=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hexToPublicKey=e.convertPublicKeyFormat=e.getSharedPoint=e.getPublicKey=e.isValidPrivateKey=e.getValidSecret=void 0;var n=xs(),a=fc(),i=hc(),h=mt(),r=jt(),t=Ws(),s=function(){var v;do v=(0,n.randomBytes)(r.SECRET_KEY_LENGTH);while(!(0,e.isValidPrivateKey)(v));return v};e.getValidSecret=s;var d=function(v){return S((0,h.ellipticCurve)(),function(_){return _.utils.isValidPrivateKey(v)},function(){return!0},function(){return!0})};e.isValidPrivateKey=d;var m=function(v){return S((0,h.ellipticCurve)(),function(_){return _.getPublicKey(v)},function(_){return _.getPublicKey(v)},function(_){return _.getPublicKey(v)})};e.getPublicKey=m;var p=function(v,_,R){return S((0,h.ellipticCurve)(),function(P){return P.getSharedSecret(v,_,R)},function(P){return P.getSharedSecret(v,_)},function(P){return j(P,v,_)})};e.getSharedPoint=p;var g=function(v,_){return S((0,h.ellipticCurve)(),function(R){return R.getSharedSecret(BigInt(1),v,_)},function(){return v},function(){return v})};e.convertPublicKeyFormat=g;var l=function(v){var _=(0,t.decodeHex)(v);return S((0,h.ellipticCurve)(),function(){return A(_)},function(){return _},function(){return _})};e.hexToPublicKey=l;function S(v,_,R,P){if(v==="secp256k1")return _(i.secp256k1);if(v==="x25519")return R(a.x25519);if(v==="ed25519")return P(a.ed25519);throw new Error("Not implemented")}var A=function(v){if(v.length===r.ETH_PUBLIC_KEY_SIZE){var _=new Uint8Array(1+v.length);return _.set([4]),_.set(v,1),_}return v},j=function(v,_,R){var P=v.utils.getExtendedPublicKey(_).scalar,f=v.ExtendedPoint.fromHex(R).multiply(P);return f.toRawBytes()}}(Ft)),Ft}var Xt={},Ve={},zs;function yc(){if(zs)return Ve;zs=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.hkdf=void 0,Ve.extract=i,Ve.expand=t;const e=bt(),n=Fs(),a=$e();function i(d,m,p){return(0,e.ahash)(d),p===void 0&&(p=new Uint8Array(d.outputLen)),(0,n.hmac)(d,(0,a.toBytes)(p),(0,a.toBytes)(m))}const h=new Uint8Array([0]),r=new Uint8Array;function t(d,m,p,g=32){if((0,e.ahash)(d),(0,e.anumber)(g),g>255*d.outputLen)throw new Error("Length should be <= 255*HashLen");const l=Math.ceil(g/d.outputLen);p===void 0&&(p=r);const S=new Uint8Array(l*d.outputLen),A=n.hmac.create(d,m),j=A._cloneInto(),v=new Uint8Array(A.outputLen);for(let _=0;_<l;_++)h[0]=_+1,j.update(_===0?r:v).update(p).update(h).digestInto(v),S.set(v,d.outputLen*_),A._cloneInto(j);return A.destroy(),j.destroy(),v.fill(0),h.fill(0),S.slice(0,g)}const s=(d,m,p,g,l)=>t(d,i(d,m,p),g,l);return Ve.hkdf=s,Ve}var Xs;function vc(){return Xs||(Xs=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSharedKey=e.deriveKey=void 0;var n=Ce(),a=yc(),i=js(),h=function(t,s,d){return(0,a.hkdf)(i.sha256,t,s,d,32)};e.deriveKey=h;var r=function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];return(0,e.deriveKey)(n.concatBytes.apply(void 0,t))};e.getSharedKey=r}(Xt)),Xt}var Qt={},Ue={},dt={},Qs;function Js(){if(Qs)return dt;Qs=1,Object.defineProperty(dt,"__esModule",{value:!0}),dt._compat=void 0;var e=Ce(),n=_i,a=16,i=globalThis.Deno!==void 0,h=function(r,t,s,d){var m=r==="aes-256-gcm"||r==="chacha20-poly1305",p=m?a:0,g=m?{authTagLength:p}:void 0,l=function(A){var j=(0,n.createCipheriv)(r,t,s,g);m&&d!==void 0&&j.setAAD(d);var v=j.update(A),_=j.final(),R=m?j.getAuthTag():new Uint8Array(0);return(0,e.concatBytes)(v,_,R)},S=function(A){var j=A.subarray(0,A.length-p),v=A.subarray(A.length-p),_=(0,n.createDecipheriv)(r,t,s,g);m&&(d!==void 0&&_.setAAD(d),_.setAuthTag(v)),!m&&i&&_.setAutoPadding(!1);var R=_.update(j),P=_.final();return(0,e.concatBytes)(R,P)};return{encrypt:l,decrypt:S}};return dt._compat=h,dt}var eo;function gc(){if(eo)return Ue;eo=1,Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.aes256cbc=Ue.aes256gcm=void 0;var e=Js(),n=function(i,h,r){return(0,e._compat)("aes-256-gcm",i,h,r)};Ue.aes256gcm=n;var a=function(i,h,r){return(0,e._compat)("aes-256-cbc",i,h)};return Ue.aes256cbc=a,Ue}var Ge={},ht={},to;function mc(){if(to)return ht;to=1,Object.defineProperty(ht,"__esModule",{value:!0}),ht._hchacha20=void 0;var e=function(a,i,h,r){for(var t=a[0],s=a[1],d=a[2],m=a[3],p=i[0],g=i[1],l=i[2],S=i[3],A=i[4],j=i[5],v=i[6],_=i[7],R=h[0],P=h[1],f=h[2],y=h[3],c=0;c<20;c+=2)t=t+p|0,R=n(R^t,16),A=A+R|0,p=n(p^A,12),t=t+p|0,R=n(R^t,8),A=A+R|0,p=n(p^A,7),s=s+g|0,P=n(P^s,16),j=j+P|0,g=n(g^j,12),s=s+g|0,P=n(P^s,8),j=j+P|0,g=n(g^j,7),d=d+l|0,f=n(f^d,16),v=v+f|0,l=n(l^v,12),d=d+l|0,f=n(f^d,8),v=v+f|0,l=n(l^v,7),m=m+S|0,y=n(y^m,16),_=_+y|0,S=n(S^_,12),m=m+S|0,y=n(y^m,8),_=_+y|0,S=n(S^_,7),t=t+g|0,y=n(y^t,16),v=v+y|0,g=n(g^v,12),t=t+g|0,y=n(y^t,8),v=v+y|0,g=n(g^v,7),s=s+l|0,R=n(R^s,16),_=_+R|0,l=n(l^_,12),s=s+l|0,R=n(R^s,8),_=_+R|0,l=n(l^_,7),d=d+S|0,P=n(P^d,16),A=A+P|0,S=n(S^A,12),d=d+S|0,P=n(P^d,8),A=A+P|0,S=n(S^A,7),m=m+p|0,f=n(f^m,16),j=j+f|0,p=n(p^j,12),m=m+p|0,f=n(f^m,8),j=j+f|0,p=n(p^j,7);var q=0;r[q++]=t,r[q++]=s,r[q++]=d,r[q++]=m,r[q++]=R,r[q++]=P,r[q++]=f,r[q++]=y};ht._hchacha20=e;var n=function(a,i){return a<<i|a>>>32-i};return ht}var no;function bc(){if(no)return Ge;no=1,Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.chacha20=Ge.xchacha20=void 0;var e=Ce(),n=Js(),a=mc(),i=function(r,t,s){if(t.length!==24)throw new Error("xchacha20's nonce must be 24 bytes");var d=new Uint32Array([1634760805,857760878,2036477234,1797285236]),m=new Uint32Array(8);(0,a._hchacha20)(d,(0,e.u32)(r),(0,e.u32)(t.subarray(0,16)),m);var p=new Uint8Array(12);return p.set([0,0,0,0]),p.set(t.subarray(16),4),(0,n._compat)("chacha20-poly1305",(0,e.u8)(m),p,s)};Ge.xchacha20=i;var h=function(r,t,s){if(t.length!==12)throw new Error("chacha20's nonce must be 12 bytes");return(0,n._compat)("chacha20-poly1305",r,t,s)};return Ge.chacha20=h,Ge}var ro;function Ec(){return ro||(ro=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.aesDecrypt=e.aesEncrypt=e.symDecrypt=e.symEncrypt=void 0;var n=Ce(),a=xs(),i=gc(),h=bc(),r=mt(),t=jt(),s=function(l,S,A){return m(p,l,S,A)};e.symEncrypt=s;var d=function(l,S,A){return m(g,l,S,A)};e.symDecrypt=d,e.aesEncrypt=e.symEncrypt,e.aesDecrypt=e.symDecrypt;function m(l,S,A,j){var v=(0,r.symmetricAlgorithm)();if(v==="aes-256-gcm")return l(i.aes256gcm,S,A,(0,r.symmetricNonceLength)(),t.AEAD_TAG_LENGTH,j);if(v==="xchacha20")return l(h.xchacha20,S,A,t.XCHACHA20_NONCE_LENGTH,t.AEAD_TAG_LENGTH,j);if(v==="aes-256-cbc")return l(i.aes256cbc,S,A,16,0);throw new Error("Not implemented")}function p(l,S,A,j,v,_){var R=(0,a.randomBytes)(j),P=l(S,R,_),f=P.encrypt(A);if(v===0)return(0,n.concatBytes)(R,f);var y=f.length-v,c=f.subarray(0,y),q=f.subarray(y);return(0,n.concatBytes)(R,q,c)}function g(l,S,A,j,v,_){var R=A.subarray(0,j),P=l(S,Uint8Array.from(R),_),f=A.subarray(j);if(v===0)return P.decrypt(f);var y=f.subarray(0,v),c=f.subarray(v);return P.decrypt((0,n.concatBytes)(c,y))}}(Qt)),Qt}var so;function Jt(){return so||(so=1,function(e){var n=ke&&ke.__createBinding||(Object.create?function(i,h,r,t){t===void 0&&(t=r);var s=Object.getOwnPropertyDescriptor(h,r);(!s||("get"in s?!h.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return h[r]}}),Object.defineProperty(i,t,s)}:function(i,h,r,t){t===void 0&&(t=r),i[t]=h[r]}),a=ke&&ke.__exportStar||function(i,h){for(var r in i)r!=="default"&&!Object.prototype.hasOwnProperty.call(h,r)&&n(h,i,r)};Object.defineProperty(e,"__esModule",{value:!0}),a(pc(),e),a(vc(),e),a(Ws(),e),a(Ec(),e)}(ke)),ke}var pt={},oo;function io(){if(oo)return pt;oo=1,Object.defineProperty(pt,"__esModule",{value:!0}),pt.PublicKey=void 0;var e=Ce(),n=Jt(),a=function(){function i(h){var r=(0,n.convertPublicKeyFormat)(h,!0),t=(0,n.convertPublicKeyFormat)(h,!1);this.data=r,this.dataUncompressed=r.length!==t.length?t:null}return i.fromHex=function(h){return new i((0,n.hexToPublicKey)(h))},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(h){return h===void 0&&(h=!0),h?this.data:this._uncompressed},i.prototype.toHex=function(h){return h===void 0&&(h=!0),(0,e.bytesToHex)(this.toBytes(h))},i.prototype.decapsulate=function(h,r){r===void 0&&(r=!1);var t=this.toBytes(r),s=h.multiply(this,r);return(0,n.getSharedKey)(t,s)},i.prototype.equals=function(h){return(0,e.equalBytes)(this.data,h.data)},i}();return pt.PublicKey=a,pt}var co;function _c(){if(co)return at;co=1,Object.defineProperty(at,"__esModule",{value:!0}),at.PrivateKey=void 0;var e=Ce(),n=Jt(),a=io(),i=function(){function h(r){if(r===void 0)this.data=(0,n.getValidSecret)();else if((0,n.isValidPrivateKey)(r))this.data=r;else throw new Error("Invalid private key");this.publicKey=new a.PublicKey((0,n.getPublicKey)(this.data))}return h.fromHex=function(r){return new h((0,n.decodeHex)(r))},Object.defineProperty(h.prototype,"secret",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),h.prototype.toHex=function(){return(0,e.bytesToHex)(this.data)},h.prototype.encapsulate=function(r,t){t===void 0&&(t=!1);var s=this.publicKey.toBytes(t),d=this.multiply(r,t);return(0,n.getSharedKey)(s,d)},h.prototype.multiply=function(r,t){return t===void 0&&(t=!1),(0,n.getSharedPoint)(this.data,r.toBytes(!0),t)},h.prototype.equals=function(r){return(0,e.equalBytes)(this.data,r.data)},h}();return at.PrivateKey=i,at}var ao;function uo(){return ao||(ao=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.PrivateKey=void 0;var n=_c();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return n.PrivateKey}});var a=io();Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return a.PublicKey}})}(kt)),kt}var lo;function en(){return lo||(lo=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.PublicKey=e.PrivateKey=e.ECIES_CONFIG=void 0,e.encrypt=r,e.decrypt=s;var n=Ce(),a=mt(),i=uo(),h=Jt();function r(g,l){return Buffer.from(t(g,l))}function t(g,l){var S=new i.PrivateKey,A=g instanceof Uint8Array?new i.PublicKey(g):i.PublicKey.fromHex(g),j=S.encapsulate(A,(0,a.isHkdfKeyCompressed)()),v=S.publicKey.toBytes((0,a.isEphemeralKeyCompressed)()),_=(0,h.symEncrypt)(j,l);return(0,n.concatBytes)(v,_)}function s(g,l){return Buffer.from(d(g,l))}function d(g,l){var S=g instanceof Uint8Array?new i.PrivateKey(g):i.PrivateKey.fromHex(g),A=(0,a.ephemeralKeySize)(),j=new i.PublicKey(l.subarray(0,A)),v=l.subarray(A),_=j.decapsulate(S,(0,a.isHkdfKeyCompressed)());return(0,h.symDecrypt)(_,v)}var m=mt();Object.defineProperty(e,"ECIES_CONFIG",{enumerable:!0,get:function(){return m.ECIES_CONFIG}});var p=uo();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return p.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return p.PublicKey}}),e.utils={aesEncrypt:h.aesEncrypt,aesDecrypt:h.aesDecrypt,symEncrypt:h.symEncrypt,symDecrypt:h.symDecrypt,decodeHex:h.decodeHex,getValidSecret:h.getValidSecret,remove0x:h.remove0x}}(Kt)),Kt}var tn,fo;function ho(){if(fo)return tn;fo=1;function e(n,a=7){return n&&n.length>0?n.slice(0,a)+"\u2026":""}return tn=e,tn}var nn,po;function We(){if(po)return nn;po=1;const e=ho();class n{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",h=`[${i}] missing ${this.envFilepath} file (${this.filepath})`,r=`[${i}] https://github.com/dotenvx/dotenvx/issues/484`,t=new Error(h);return t.code=i,t.help=r,t}missingKey(){const i="MISSING_KEY",h=`[${i}] missing ${this.key} key`,r=new Error(h);return r.code=i,r}missingPrivateKey(){const i="MISSING_PRIVATE_KEY",h=`[${i}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,r=`[${i}] https://github.com/dotenvx/dotenvx/issues/464`,t=new Error(h);return t.code=i,t.help=r,t}invalidPrivateKey(){const i="INVALID_PRIVATE_KEY",h=`[${i}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,r=`[${i}] https://github.com/dotenvx/dotenvx/issues/465`,t=new Error(h);return t.code=i,t.help=r,t}looksWrongPrivateKey(){const i="WRONG_PRIVATE_KEY",h=`[${i}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,r=`[${i}] https://github.com/dotenvx/dotenvx/issues/466`,t=new Error(h);return t.code=i,t.help=r,t}malformedEncryptedData(){const i="MALFORMED_ENCRYPTED_DATA",h=`[${i}] could not decrypt ${this.key} because encrypted data appears malformed`,r=`[${i}] https://github.com/dotenvx/dotenvx/issues/467`,t=new Error(h);return t.code=i,t.help=r,t}decryptionFailed(){const i="DECRYPTION_FAILED",h=this.message,r=new Error(h);return r.code=i,r}commandSubstitutionFailed(){const i="COMMAND_SUBSTITUTION_FAILED",h=`[${i}] could not eval ${this.key} containing command '${this.command}': ${this.message}`,r=`[${i}] https://github.com/dotenvx/dotenvx/issues/532`,t=new Error(h);return t.code=i,t.help=r,t}}return nn=n,nn}var rn,yo;function vo(){if(yo)return rn;yo=1;const{decrypt:e}=en(),n=We(),a="encrypted:";function i(h,r,t,s){let d,m;if(!r.startsWith(a))return r;if(s=s||"",s.length<=0)m=new n({key:h,privateKeyName:t,privateKey:s}).missingPrivateKey();else{const p=s.split(",");for(const g of p){const l=Buffer.from(g,"hex"),S=r.substring(a.length),A=Buffer.from(S,"base64");try{d=e(l,A).toString(),m=null;break}catch(j){j.message==="Invalid private key"?m=new n({key:h,privateKeyName:t,privateKey:s}).invalidPrivateKey():j.message==="Unsupported state or unable to authenticate data"?m=new n({key:h,privateKeyName:t,privateKey:s}).looksWrongPrivateKey():j.message==="Point of length 65 was invalid. Expected 33 compressed bytes or 65 uncompressed bytes"?m=new n({key:h,privateKeyName:t,privateKey:s}).malformedEncryptedData():m=new n({key:h,privateKeyName:t,privateKey:s,message:j.message}).decryptionFailed()}}}if(m)throw m;return d}return rn=i,rn}var sn,go;function wc(){if(go)return sn;go=1;function e(n){return n.replace(/[\r\n]+$/,"")}return sn=e,sn}var on,mo;function xc(){if(mo)return on;mo=1;const{execSync:e}=zn,n=wc(),a=We();function i(h,r,t,s){return(r.match(/\$\(([^)]+(?:\)[^(]*)*)\)/g)||[]).reduce((m,p)=>{const g=p.slice(2,-1);let l;try{l=e(g,{env:{...t,...s}}).toString()}catch(S){throw new a({key:h,command:g,message:S.message.trim()}).commandSubstitutionFailed()}return l=n(l),m.replace(p,l)},r)}return on=i,on}var cn,bo;function Ac(){if(bo)return cn;bo=1;function e(n){return n.replace(/\\\$/g,"$")}return cn=e,cn}var an,Eo;function _o(){if(Eo)return an;Eo=1;const e=vo(),n=xc(),a=Ac();class i{static LINE=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;constructor(r,t=null,s=process.env,d=!1,m=null){this.src=r,this.privateKey=t,this.privateKeyName=m,this.processEnv=s,this.overload=d,this.parsed={},this.preExisted={},this.injected={},this.errors=[],this.runningParsed={},this.literals={}}run(){const r=this.getLines();let t;for(;(t=i.LINE.exec(r))!==null;){const s=t[1],d=t[2],m=this.quote(d);this.parsed[s]=this.clean(d,m),!this.overload&&this.inProcessEnv(s)&&(this.parsed[s]=this.processEnv[s]);try{this.parsed[s]=this.decrypt(s,this.parsed[s])}catch(g){this.errors.push(g)}let p=!1;if(m!=="'"&&(!this.inProcessEnv(s)||this.processEnv[s]===this.parsed[s])){const g=this.parsed[s];try{this.parsed[s]=this.eval(s,g)}catch(l){this.errors.push(l)}g!==this.parsed[s]&&(p=!0)}!p&&m!=="'"&&(!this.processEnv[s]||this.overload)&&(this.parsed[s]=a(this.expand(this.parsed[s]))),m==="'"&&(this.literals[s]=this.parsed[s]),this.runningParsed[s]=this.parsed[s],Object.prototype.hasOwnProperty.call(this.processEnv,s)&&!this.overload?this.preExisted[s]=this.processEnv[s]:this.injected[s]=this.parsed[s]}return{parsed:this.parsed,processEnv:this.processEnv,injected:this.injected,preExisted:this.preExisted,errors:this.errors}}trimmer(r){return(r||"").trim()}quote(r){const s=this.trimmer(r)[0];let d="";switch(s){case"'":d="'";break;case'"':d='"';break;case"`":d="`";break;default:d=""}return d}clean(r,t){let s=this.trimmer(r);return s=s.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),t==='"'&&(s=s.replace(/\\n/g,`
5
+ `),s=s.replace(/\\r/g,"\r"),s=s.replace(/\\t/g," ")),s}decrypt(r,t){return e(r,t,this.privateKeyName,this.privateKey)}eval(r,t){return n(r,t,this.processEnv,this.runningParsed)}expand(r){let t={...this.runningParsed,...this.processEnv};this.overload&&(t={...this.processEnv,...this.runningParsed});const s=/(?<!\\)\${([^{}]+)}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g;let d=r,m;for(;(m=s.exec(d))!==null;){const[p,g,l]=m,S=g||l,A=/(:\+|\+|:-|-)/,j=S.match(A),v=j?j[0]:null,_=S.split(v);let R,P;const f=_.shift();if([":+","+"].includes(v)?(R=t[f]?_.join(v):"",P=null):(R=_.join(v),P=t[f]),P?d=d.replace(p,P):d=d.replace(p,R),d===t[f]||this.literals[f])break;s.lastIndex=0}return d}inProcessEnv(r){return Object.prototype.hasOwnProperty.call(this.processEnv,r)}getLines(){return(this.src||"").toString().replace(/\r\n?/mg,`
6
6
  `)}}return an=i,an}var un,wo;function Ze(){if(wo)return un;wo=1;const e=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function n(a,i=!1,h=!1){const r={};let t=a.toString();h||(t=t.replace(/\r\n?/mg,`
7
7
  `));let s;for(;(s=e.exec(t))!=null;){const d=s[1];let m=s[2]||"";m=m.trim();const p=m[0];m=m.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),p==='"'&&!i&&(m=m.replace(/\\n/g,`
8
- `),m=m.replace(/\\r/g,"\r"),m=m.replace(/\\t/g," ")),r[d]=m}return r}return un=n,un}var ln,xo;function Sc(){if(xo)return ln;xo=1;function e(n){let a;try{a=new URL(n)}catch(h){throw new Error(`INVALID_DOTENV_KEY: ${h.message}`)}const i=a.searchParams.get("environment");if(!i)throw new Error("INVALID_DOTENV_KEY: Missing environment part");return i}return ln=e,ln}var fn,Ao;function So(){if(Ao)return fn;Ao=1;const e=Be;function n(a){const i=e.readFileSync(a);return i.length>=2&&i[0]===255&&i[1]===254?"utf16le":(i.length>=3&&i[0]===239&&i[1]===187&&i[2]===191,"utf8")}return fn=n,fn}var dn,Ro;function Bo(){if(Ro)return dn;Ro=1;const e=de;function n(a){const i=e.basename(a),r=[...i.split(".").slice(2)];return r.length===0?i.replace(".env","development"):r.length===1?r[0]:r.length===2?r.join("_"):r.slice(0,2).join("_")}return dn=n,dn}var hn,Oo;function ze(){if(Oo)return hn;Oo=1;const e=de,n=Bo();function a(i){const h=e.basename(i).toLowerCase();return h===".env"?"DOTENV_PRIVATE_KEY":`DOTENV_PRIVATE_KEY_${n(h).toUpperCase()}`}return hn=a,hn}function Rc(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var pn,Io;function yt(){if(Io)return pn;Io=1;const e=de,n=Bo();function a(i){const h=e.basename(i).toLowerCase();return h===".env"?"DOTENV_PUBLIC_KEY":`DOTENV_PUBLIC_KEY_${n(h).toUpperCase()}`}return pn=a,pn}var yn,Co;function Po(){if(Co)return yn;Co=1;const e=de,n=zn,a=ze(),i=yt();class h{constructor(t){this.envFilepath=t}run(){let t={};try{const s=e.resolve(process.cwd()),d=require.resolve("@dotenvx/dotenvx-pro",{paths:[s]}),{keypair:m}=Rc(d);t=m(this.envFilepath)}catch{try{const d=n.execSync(`dotenvx-pro keypair -f ${this.envFilepath}`,{stdio:["pipe","pipe","ignore"]}).toString().trim();t=JSON.parse(d)}catch{const m=a(this.envFilepath),p=i(this.envFilepath);t[m]=null,t[p]=null}}return t}}return yn=h,yn}var vn,To;function Bc(){if(To)return vn;To=1;const e=Te(),n=Ze(),a=yt();function i(t){if(process.env[t]&&process.env[t].length>0)return process.env[t]}function h(t,s){if(e.existsSync(s)){const d=e.readFileX(s),m=n(d);if(m[t]&&m[t].length>0)return m[t]}}function r(t){let s=null;const d=a(t);return s=i(d),s||(s=h(d,t),s)?s:null}return vn=r,vn}var gn,No;function Oc(){if(No)return gn;No=1;const e=Te(),n=de,a="DOTENV_PUBLIC_KEY",i="DOTENV_PRIVATE_KEY",h=Ze(),r=ze();function t(p){if(process.env[p]&&process.env[p].length>0)return process.env[p]}function s(p,g,l=null){let S=n.resolve(n.dirname(g),".env.keys");if(l&&(S=n.resolve(l)),e.existsSync(S)){const A=e.readFileX(S),k=h(A);if(k[p]&&k[p].length>0)return k[p]}}function d(p){if(!e.existsSync(p))return null;const g=e.readFileX(p),l=h(g);let S;for(const A of Object.keys(l))(A===a||A.startsWith(a))&&(S=A);return S?S.replace(a,i):null}function m(p,g=null){let l=null,S=r(p);return l=t(S),l||(l=s(S,p,g),l)||(S=d(p),S&&(l=t(S),l||(l=s(S,p,g),l)))?l:null}return gn=m,gn}var mn,Lo;function bn(){if(Lo)return mn;Lo=1;const e=yt(),n=Bc(),a=ze(),i=Oc();class h{constructor(t=".env",s=null){this.envFile=t,this.envKeysFilepath=s}run(){const t={},s=this._envFilepaths();for(const d of s){const m=e(d),p=n(d);t[m]=p;const g=a(d),l=i(d,this.envKeysFilepath);t[g]=l}return t}_envFilepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return mn=h,mn}var En,$o;function Do(){if($o)return En;$o=1;const e=ze(),n=Po(),a=bn();function i(h,r=null){const t=e(h),s=new n(h).run(),d=new a(h,r).run();return s[t]||d[t]}return En=i,En}var _n,Ko;function Ic(){if(Ko)return _n;Ko=1;const e="DOTENV_PRIVATE_KEY";function n(a){return Object.keys(a).filter(i=>i.startsWith(e))}return _n=n,_n}var wn,qo;function Cc(){if(qo)return wn;qo=1;const e="DOTENV_PRIVATE_KEY";function n(a){return a===e?".env":`.env.${a.substring(`${e}_`.length).split("_").join(".").toLowerCase()}`}return wn=n,wn}var xn,Ho;function ko(){if(Ho)return xn;Ho=1;const e=Ic(),n=Cc(),a="envFile",i="envVaultFile",h=[{type:a,value:".env"}],r=[{type:i,value:".env.vault"}];function t(d){const m=[];for(const p of d){const g=n(p);m.push({type:a,value:g})}return m}function s(d=[],m,p=""){const g=e(m);if(!d||d.length<=0)return g.length>0?t(g):p.length>0?r:h;{let l=!1;for(const S of d)p.length>0&&S.type===i&&(l=!0),p.length<=0&&S.type===a&&(l=!0);return l?d:p.length>0?[...r,...d]:[...h,...d]}}return xn=s,xn}var An,jo;function Fo(){if(jo)return An;jo=1;const e=Te(),n=de,a="env",i="envFile",h="envVaultFile",r=sc(),t=_o(),s=We(),d=Ze(),m=Sc(),p=So(),g=Do(),l=ze(),S=ko();class A{constructor(v=[],_=!1,R="",P=process.env,f=null){this.envs=S(v,P,R),this.overload=_,this.DOTENV_KEY=R,this.processEnv=P,this.envKeysFilepath=f,this.processedEnvs=[],this.readableFilepaths=new Set,this.readableStrings=new Set,this.uniqueInjectedKeys=new Set}run(){for(const v of this.envs)v.type===h?this._injectEnvVaultFile(v.value):v.type===i?this._injectEnvFile(v.value):v.type===a&&this._injectEnv(v.value);return{processedEnvs:this.processedEnvs,readableStrings:[...this.readableStrings],readableFilepaths:[...this.readableFilepaths],uniqueInjectedKeys:[...this.uniqueInjectedKeys]}}_injectEnv(v){const _={};_.type=a,_.string=v;try{const{parsed:R,errors:P,injected:f,preExisted:y}=new t(v,null,this.processEnv,this.overload).run();_.parsed=R,_.errors=P,_.injected=f,_.preExisted=y,this.inject(_.parsed),this.readableStrings.add(v);for(const c of Object.keys(f))this.uniqueInjectedKeys.add(c)}catch(R){_.errors=[R]}this.processedEnvs.push(_)}_injectEnvFile(v){const _={};_.type=i,_.filepath=v;const R=n.resolve(v);try{const P=p(R),f=e.readFileX(R,{encoding:P});this.readableFilepaths.add(v);const y=g(v,this.envKeysFilepath),c=l(v),{parsed:q,errors:D,injected:$,preExisted:H}=new t(f,y,this.processEnv,this.overload,c).run();_.parsed=q,_.errors=D,_.injected=$,_.preExisted=H,this.inject(_.parsed);for(const E of Object.keys($))this.uniqueInjectedKeys.add(E)}catch(P){P.code==="ENOENT"||P.code==="EISDIR"?_.errors=[new s({envFilepath:v,filepath:R}).missingEnvFile()]:_.errors=[P]}this.processedEnvs.push(_)}_injectEnvVaultFile(v){const _={};_.type=h,_.filepath=v;const R=n.resolve(v);if(this.readableFilepaths.add(v),!e.existsSync(R)){const c="MISSING_ENV_VAULT_FILE",q=`you set DOTENV_KEY but your .env.vault file is missing: ${R}`,D=new Error(q);throw D.code=c,D}if(this.DOTENV_KEY.length<1){const c="MISSING_DOTENV_KEY",q=`your DOTENV_KEY appears to be blank: '${this.DOTENV_KEY}'`,D=new Error(q);throw D.code=c,D}let P;const f=this._dotenvKeys(),y=this._parsedVault(R);for(let c=0;c<f.length;c++)try{const q=f[c].trim();P=this._decrypted(q,y);break}catch(q){if(c+1>=f.length)throw q}try{const{parsed:c,errors:q,injected:D,preExisted:$}=new t(P,null,this.processEnv,this.overload).run();_.parsed=c,_.errors=q,_.injected=D,_.preExisted=$,this.inject(_.parsed);for(const H of Object.keys(D))this.uniqueInjectedKeys.add(H)}catch(c){_.errors=[c]}this.processedEnvs.push(_)}inject(v){for(const _ of Object.keys(v))this.processEnv[_]=v[_]}_dotenvKeys(){return this.DOTENV_KEY.split(",")}_parsedVault(v){const _=e.readFileX(v);return d(_)}_decrypted(v,_){const P=`DOTENV_VAULT_${m(v).toUpperCase()}`,f=_[P];if(!f){const y=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: cannot locate environment ${P} in your .env.vault file`);throw y.code="NOT_FOUND_DOTENV_ENVIRONMENT",y}return r(f,v)}}return An=A,An}var Sn,Mo;function Pc(){if(Mo)return Sn;Mo=1;const{encrypt:e}=en(),n="encrypted:";function a(i,h){const r=e(h,Buffer.from(i)),t=Buffer.from(r,"hex").toString("base64");return`${n}${t}`}return Sn=a,Sn}var Rn,Vo;function Tc(){if(Vo)return Rn;Vo=1;const e=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function n(a){const i={};let h=a.toString();h=h.replace(/\r\n?/mg,`
9
- `);let r;for(;(r=e.exec(h))!=null;){const t=r[1];let s=r[2]||"";s=s.trim();const d=s[0];s=s.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),d===s[0]?i[t]="":i[t]=d}return i}return Rn=n,Rn}var Bn,Uo;function Nc(){if(Uo)return Bn;Uo=1;function e(n){return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}return Bn=e,Bn}var On,Go;function Lc(){if(Go)return On;Go=1;function e(n){return n.replace(/\$/g,"$$$$")}return On=e,On}var In,Yo;function Wo(){if(Yo)return In;Yo=1;const e=Tc(),n=Ze(),a=Nc(),i=Lc();function h(r,t,s){let d,m="";const p=n(r,!0,!0),g=e(r);if(Object.prototype.hasOwnProperty.call(p,t)){const l=g[t];m+=`${t}=${l}${s}${l}`;const S=p[t],A=a(S);let k="";if(A===""){k="$";const R=r.match(new RegExp(`${t}\\s*=\\s*
8
+ `),m=m.replace(/\\r/g,"\r"),m=m.replace(/\\t/g," ")),r[d]=m}return r}return un=n,un}var ln,xo;function Sc(){if(xo)return ln;xo=1;function e(n){let a;try{a=new URL(n)}catch(h){throw new Error(`INVALID_DOTENV_KEY: ${h.message}`)}const i=a.searchParams.get("environment");if(!i)throw new Error("INVALID_DOTENV_KEY: Missing environment part");return i}return ln=e,ln}var fn,Ao;function So(){if(Ao)return fn;Ao=1;const e=Be;function n(a){const i=e.readFileSync(a);return i.length>=2&&i[0]===255&&i[1]===254?"utf16le":(i.length>=3&&i[0]===239&&i[1]===187&&i[2]===191,"utf8")}return fn=n,fn}var dn,Ro;function Bo(){if(Ro)return dn;Ro=1;const e=de;function n(a){const i=e.basename(a),r=[...i.split(".").slice(2)];return r.length===0?i.replace(".env","development"):r.length===1?r[0]:r.length===2?r.join("_"):r.slice(0,2).join("_")}return dn=n,dn}var hn,Io;function ze(){if(Io)return hn;Io=1;const e=de,n=Bo();function a(i){const h=e.basename(i).toLowerCase();return h===".env"?"DOTENV_PRIVATE_KEY":`DOTENV_PRIVATE_KEY_${n(h).toUpperCase()}`}return hn=a,hn}function Rc(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var pn,Oo;function yt(){if(Oo)return pn;Oo=1;const e=de,n=Bo();function a(i){const h=e.basename(i).toLowerCase();return h===".env"?"DOTENV_PUBLIC_KEY":`DOTENV_PUBLIC_KEY_${n(h).toUpperCase()}`}return pn=a,pn}var yn,Co;function Po(){if(Co)return yn;Co=1;const e=de,n=zn,a=ze(),i=yt();class h{constructor(t){this.envFilepath=t}run(){let t={};try{const s=e.resolve(process.cwd()),d=require.resolve("@dotenvx/dotenvx-pro",{paths:[s]}),{keypair:m}=Rc(d);t=m(this.envFilepath)}catch{try{const d=n.execSync(`dotenvx-pro keypair -f ${this.envFilepath}`,{stdio:["pipe","pipe","ignore"]}).toString().trim();t=JSON.parse(d)}catch{const m=a(this.envFilepath),p=i(this.envFilepath);t[m]=null,t[p]=null}}return t}}return yn=h,yn}var vn,To;function Bc(){if(To)return vn;To=1;const e=Te(),n=Ze(),a=yt();function i(t){if(process.env[t]&&process.env[t].length>0)return process.env[t]}function h(t,s){if(e.existsSync(s)){const d=e.readFileX(s),m=n(d);if(m[t]&&m[t].length>0)return m[t]}}function r(t){let s=null;const d=a(t);return s=i(d),s||(s=h(d,t),s)?s:null}return vn=r,vn}var gn,No;function Ic(){if(No)return gn;No=1;const e=Te(),n=de,a="DOTENV_PUBLIC_KEY",i="DOTENV_PRIVATE_KEY",h=Ze(),r=ze();function t(p){if(process.env[p]&&process.env[p].length>0)return process.env[p]}function s(p,g,l=null){let S=n.resolve(n.dirname(g),".env.keys");if(l&&(S=n.resolve(l)),e.existsSync(S)){const A=e.readFileX(S),j=h(A);if(j[p]&&j[p].length>0)return j[p]}}function d(p){if(!e.existsSync(p))return null;const g=e.readFileX(p),l=h(g);let S;for(const A of Object.keys(l))(A===a||A.startsWith(a))&&(S=A);return S?S.replace(a,i):null}function m(p,g=null){let l=null,S=r(p);return l=t(S),l||(l=s(S,p,g),l)||(S=d(p),S&&(l=t(S),l||(l=s(S,p,g),l)))?l:null}return gn=m,gn}var mn,Lo;function bn(){if(Lo)return mn;Lo=1;const e=yt(),n=Bc(),a=ze(),i=Ic();class h{constructor(t=".env",s=null){this.envFile=t,this.envKeysFilepath=s}run(){const t={},s=this._envFilepaths();for(const d of s){const m=e(d),p=n(d);t[m]=p;const g=a(d),l=i(d,this.envKeysFilepath);t[g]=l}return t}_envFilepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return mn=h,mn}var En,$o;function Do(){if($o)return En;$o=1;const e=ze(),n=Po(),a=bn();function i(h,r=null){const t=e(h),s=new n(h).run(),d=new a(h,r).run();return s[t]||d[t]}return En=i,En}var _n,Ko;function Oc(){if(Ko)return _n;Ko=1;const e="DOTENV_PRIVATE_KEY";function n(a){return Object.keys(a).filter(i=>i.startsWith(e))}return _n=n,_n}var wn,qo;function Cc(){if(qo)return wn;qo=1;const e="DOTENV_PRIVATE_KEY";function n(a){return a===e?".env":`.env.${a.substring(`${e}_`.length).split("_").join(".").toLowerCase()}`}return wn=n,wn}var xn,Ho;function jo(){if(Ho)return xn;Ho=1;const e=Oc(),n=Cc(),a="envFile",i="envVaultFile",h=[{type:a,value:".env"}],r=[{type:i,value:".env.vault"}];function t(d){const m=[];for(const p of d){const g=n(p);m.push({type:a,value:g})}return m}function s(d=[],m,p=""){const g=e(m);if(!d||d.length<=0)return g.length>0?t(g):p.length>0?r:h;{let l=!1;for(const S of d)p.length>0&&S.type===i&&(l=!0),p.length<=0&&S.type===a&&(l=!0);return l?d:p.length>0?[...r,...d]:[...h,...d]}}return xn=s,xn}var An,ko;function Fo(){if(ko)return An;ko=1;const e=Te(),n=de,a="env",i="envFile",h="envVaultFile",r=sc(),t=_o(),s=We(),d=Ze(),m=Sc(),p=So(),g=Do(),l=ze(),S=jo();class A{constructor(v=[],_=!1,R="",P=process.env,f=null){this.envs=S(v,P,R),this.overload=_,this.DOTENV_KEY=R,this.processEnv=P,this.envKeysFilepath=f,this.processedEnvs=[],this.readableFilepaths=new Set,this.readableStrings=new Set,this.uniqueInjectedKeys=new Set}run(){for(const v of this.envs)v.type===h?this._injectEnvVaultFile(v.value):v.type===i?this._injectEnvFile(v.value):v.type===a&&this._injectEnv(v.value);return{processedEnvs:this.processedEnvs,readableStrings:[...this.readableStrings],readableFilepaths:[...this.readableFilepaths],uniqueInjectedKeys:[...this.uniqueInjectedKeys]}}_injectEnv(v){const _={};_.type=a,_.string=v;try{const{parsed:R,errors:P,injected:f,preExisted:y}=new t(v,null,this.processEnv,this.overload).run();_.parsed=R,_.errors=P,_.injected=f,_.preExisted=y,this.inject(_.parsed),this.readableStrings.add(v);for(const c of Object.keys(f))this.uniqueInjectedKeys.add(c)}catch(R){_.errors=[R]}this.processedEnvs.push(_)}_injectEnvFile(v){const _={};_.type=i,_.filepath=v;const R=n.resolve(v);try{const P=p(R),f=e.readFileX(R,{encoding:P});this.readableFilepaths.add(v);const y=g(v,this.envKeysFilepath),c=l(v),{parsed:q,errors:D,injected:$,preExisted:H}=new t(f,y,this.processEnv,this.overload,c).run();_.parsed=q,_.errors=D,_.injected=$,_.preExisted=H,this.inject(_.parsed);for(const E of Object.keys($))this.uniqueInjectedKeys.add(E)}catch(P){P.code==="ENOENT"||P.code==="EISDIR"?_.errors=[new s({envFilepath:v,filepath:R}).missingEnvFile()]:_.errors=[P]}this.processedEnvs.push(_)}_injectEnvVaultFile(v){const _={};_.type=h,_.filepath=v;const R=n.resolve(v);if(this.readableFilepaths.add(v),!e.existsSync(R)){const c="MISSING_ENV_VAULT_FILE",q=`you set DOTENV_KEY but your .env.vault file is missing: ${R}`,D=new Error(q);throw D.code=c,D}if(this.DOTENV_KEY.length<1){const c="MISSING_DOTENV_KEY",q=`your DOTENV_KEY appears to be blank: '${this.DOTENV_KEY}'`,D=new Error(q);throw D.code=c,D}let P;const f=this._dotenvKeys(),y=this._parsedVault(R);for(let c=0;c<f.length;c++)try{const q=f[c].trim();P=this._decrypted(q,y);break}catch(q){if(c+1>=f.length)throw q}try{const{parsed:c,errors:q,injected:D,preExisted:$}=new t(P,null,this.processEnv,this.overload).run();_.parsed=c,_.errors=q,_.injected=D,_.preExisted=$,this.inject(_.parsed);for(const H of Object.keys(D))this.uniqueInjectedKeys.add(H)}catch(c){_.errors=[c]}this.processedEnvs.push(_)}inject(v){for(const _ of Object.keys(v))this.processEnv[_]=v[_]}_dotenvKeys(){return this.DOTENV_KEY.split(",")}_parsedVault(v){const _=e.readFileX(v);return d(_)}_decrypted(v,_){const P=`DOTENV_VAULT_${m(v).toUpperCase()}`,f=_[P];if(!f){const y=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: cannot locate environment ${P} in your .env.vault file`);throw y.code="NOT_FOUND_DOTENV_ENVIRONMENT",y}return r(f,v)}}return An=A,An}var Sn,Mo;function Pc(){if(Mo)return Sn;Mo=1;const{encrypt:e}=en(),n="encrypted:";function a(i,h){const r=e(h,Buffer.from(i)),t=Buffer.from(r,"hex").toString("base64");return`${n}${t}`}return Sn=a,Sn}var Rn,Vo;function Tc(){if(Vo)return Rn;Vo=1;const e=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function n(a){const i={};let h=a.toString();h=h.replace(/\r\n?/mg,`
9
+ `);let r;for(;(r=e.exec(h))!=null;){const t=r[1];let s=r[2]||"";s=s.trim();const d=s[0];s=s.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),d===s[0]?i[t]="":i[t]=d}return i}return Rn=n,Rn}var Bn,Uo;function Nc(){if(Uo)return Bn;Uo=1;function e(n){return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}return Bn=e,Bn}var In,Go;function Lc(){if(Go)return In;Go=1;function e(n){return n.replace(/\$/g,"$$$$")}return In=e,In}var On,Yo;function Wo(){if(Yo)return On;Yo=1;const e=Tc(),n=Ze(),a=Nc(),i=Lc();function h(r,t,s){let d,m="";const p=n(r,!0,!0),g=e(r);if(Object.prototype.hasOwnProperty.call(p,t)){const l=g[t];m+=`${t}=${l}${s}${l}`;const S=p[t],A=a(S);let j="";if(A===""){j="$";const R=r.match(new RegExp(`${t}\\s*=\\s*
10
10
 
11
11
  `,"m"));if(l===""&&R){const P=R[0].match(/\n/g).length-1;for(let f=0;f<P;f++)m+=`
12
- `}}const v=new RegExp("^(\\s*)?(export\\s+)?"+t+"\\s*=\\s*[\"'`]?"+A+"[\"'`]?"+k,"gm"),_=i(m);d=r.replace(v,`$1$2${_}`)}else m+=`${t}="${s}"`,r.endsWith(`
12
+ `}}const v=new RegExp("^(\\s*)?(export\\s+)?"+t+"\\s*=\\s*[\"'`]?"+A+"[\"'`]?"+j,"gm"),_=i(m);d=r.replace(v,`$1$2${_}`)}else m+=`${t}="${s}"`,r.endsWith(`
13
13
  `)?m=m+`
14
14
  `:m=`
15
- `+m,d=r+m;return d}return In=h,In}var Cn,Zo;function $c(){if(Zo)return Cn;Zo=1;const e=yt(),n=Po(),a=bn();function i(h){const r=e(h),t=new n(h).run(),s=new a(h).run();return t[r]||s[r]}return Cn=i,Cn}var Pn,zo;function Dc(){if(zo)return Pn;zo=1;const{PrivateKey:e}=en();function n(a){let i;a?i=new e(Buffer.from(a,"hex")):i=new e;const h=i.publicKey.toHex(),r=i.secret.toString("hex");return{publicKey:h,privateKey:r}}return Pn=n,Pn}var Tn,Xo;function Kc(){if(Xo)return Tn;Xo=1;const e=/^encrypted:.+/;function n(a){return e.test(a)}return Tn=n,Tn}var Nn,Qo;function qc(){if(Qo)return Nn;Qo=1;const e=Te(),n=de,a="envFile",i=We(),h=ze(),r=yt(),t=Pc(),s=vo(),d=Wo(),m=Ze(),p=So(),g=ko(),l=Do(),S=$c(),A=Dc(),k=ho(),v=Kc();class _{constructor(P,f,y=[],c=!0,q=null){this.envs=g(y,process.env),this.key=P,this.value=f,this.encrypt=c,this.envKeysFilepath=q,this.processedEnvs=[],this.changedFilepaths=new Set,this.unchangedFilepaths=new Set,this.readableFilepaths=new Set}run(){for(const P of this.envs)P.type===a&&this._setEnvFile(P.value);return{processedEnvs:this.processedEnvs,changedFilepaths:[...this.changedFilepaths],unchangedFilepaths:[...this.unchangedFilepaths]}}_setEnvFile(P){const f={};f.key=this.key||null,f.value=this.value||null,f.type=a;const y=n.basename(P),c=n.resolve(P);f.filepath=c,f.envFilepath=P,f.changed=!1;try{const q=this._detectEncoding(c);let D=e.readFileX(c,{encoding:q});const $=m(D);f.originalValue=$[f.key]||null;const H=!v(f.originalValue);if(this.readableFilepaths.add(P),this.encrypt){let j,u;const N=r(P),b=h(P),B=l(P,this.envKeysFilepath),T=S(P);let L=n.join(n.dirname(c),".env.keys");this.envKeysFilepath&&(L=n.resolve(this.envKeysFilepath));const o=n.relative(n.dirname(c),L);if(B){const w=A(B);if(j=w.publicKey,u=w.privateKey,f.originalValue&&(f.originalValue=s(f.key,f.originalValue,b,u)),T&&T!==j){const C=new Error(`derived public key (${k(j)}) does not match the existing public key (${k(T)})`);throw C.code="INVALID_DOTENV_PRIVATE_KEY",C.help=`debug info: ${b}=${k(B)} (derived ${N}=${k(j)} vs existing ${N}=${k(T)})`,C}if(!T){const C=this._preserveShebang(D),G=C.firstLinePreserved;D=C.envSrc;const x=this._prependPublicKey(N,j,y,o);D=`${G}${x}
16
- ${D}`}}else if(T)j=T;else{let w="";e.existsSync(L)&&(w=e.readFileX(L));const C=this._preserveShebang(D),G=C.firstLinePreserved;D=C.envSrc;const x=A();j=x.publicKey,u=x.privateKey;const K=this._prependPublicKey(N,j,y,o),te=["#/------------------!DOTENV_PRIVATE_KEYS!-------------------/","#/ private decryption keys. DO NOT commit to source control /","#/ [how it works](https://dotenvx.com/encryption) /","#/----------------------------------------------------------/"].join(`
15
+ `+m,d=r+m;return d}return On=h,On}var Cn,Zo;function $c(){if(Zo)return Cn;Zo=1;const e=yt(),n=Po(),a=bn();function i(h){const r=e(h),t=new n(h).run(),s=new a(h).run();return t[r]||s[r]}return Cn=i,Cn}var Pn,zo;function Dc(){if(zo)return Pn;zo=1;const{PrivateKey:e}=en();function n(a){let i;a?i=new e(Buffer.from(a,"hex")):i=new e;const h=i.publicKey.toHex(),r=i.secret.toString("hex");return{publicKey:h,privateKey:r}}return Pn=n,Pn}var Tn,Xo;function Kc(){if(Xo)return Tn;Xo=1;const e=/^encrypted:.+/;function n(a){return e.test(a)}return Tn=n,Tn}var Nn,Qo;function qc(){if(Qo)return Nn;Qo=1;const e=Te(),n=de,a="envFile",i=We(),h=ze(),r=yt(),t=Pc(),s=vo(),d=Wo(),m=Ze(),p=So(),g=jo(),l=Do(),S=$c(),A=Dc(),j=ho(),v=Kc();class _{constructor(P,f,y=[],c=!0,q=null){this.envs=g(y,process.env),this.key=P,this.value=f,this.encrypt=c,this.envKeysFilepath=q,this.processedEnvs=[],this.changedFilepaths=new Set,this.unchangedFilepaths=new Set,this.readableFilepaths=new Set}run(){for(const P of this.envs)P.type===a&&this._setEnvFile(P.value);return{processedEnvs:this.processedEnvs,changedFilepaths:[...this.changedFilepaths],unchangedFilepaths:[...this.unchangedFilepaths]}}_setEnvFile(P){const f={};f.key=this.key||null,f.value=this.value||null,f.type=a;const y=n.basename(P),c=n.resolve(P);f.filepath=c,f.envFilepath=P,f.changed=!1;try{const q=this._detectEncoding(c);let D=e.readFileX(c,{encoding:q});const $=m(D);f.originalValue=$[f.key]||null;const H=!v(f.originalValue);if(this.readableFilepaths.add(P),this.encrypt){let k,u;const N=r(P),b=h(P),B=l(P,this.envKeysFilepath),T=S(P);let L=n.join(n.dirname(c),".env.keys");this.envKeysFilepath&&(L=n.resolve(this.envKeysFilepath));const o=n.relative(n.dirname(c),L);if(B){const w=A(B);if(k=w.publicKey,u=w.privateKey,f.originalValue&&(f.originalValue=s(f.key,f.originalValue,b,u)),T&&T!==k){const C=new Error(`derived public key (${j(k)}) does not match the existing public key (${j(T)})`);throw C.code="INVALID_DOTENV_PRIVATE_KEY",C.help=`debug info: ${b}=${j(B)} (derived ${N}=${j(k)} vs existing ${N}=${j(T)})`,C}if(!T){const C=this._preserveShebang(D),G=C.firstLinePreserved;D=C.envSrc;const x=this._prependPublicKey(N,k,y,o);D=`${G}${x}
16
+ ${D}`}}else if(T)k=T;else{let w="";e.existsSync(L)&&(w=e.readFileX(L));const C=this._preserveShebang(D),G=C.firstLinePreserved;D=C.envSrc;const x=A();k=x.publicKey,u=x.privateKey;const K=this._prependPublicKey(N,k,y,o),te=["#/------------------!DOTENV_PRIVATE_KEYS!-------------------/","#/ private decryption keys. DO NOT commit to source control /","#/ [how it works](https://dotenvx.com/encryption) /","#/----------------------------------------------------------/"].join(`
17
17
  `),M=[`# ${y}`,`${b}=${u}`,""].join(`
18
18
  `);D=`${G}${K}
19
19
  ${D}`,w=w.length>1?w:`${te}
20
20
  `,w=`${w}
21
- ${M}`,e.writeFileX(L,w),f.privateKeyAdded=!0,f.envKeysFilepath=this.envKeysFilepath||n.join(n.dirname(P),n.basename(L))}f.publicKey=j,f.privateKey=u,f.encryptedValue=t(this.value,j),f.privateKeyName=b}const E=H&&this.encrypt,O=this.value!==f.originalValue;E||O?(f.envSrc=d(D,this.key,f.encryptedValue||this.value),this.changedFilepaths.add(P),f.changed=!0):(f.envSrc=D,this.unchangedFilepaths.add(P),f.changed=!1)}catch(q){q.code==="ENOENT"?f.error=new i({envFilepath:P,filepath:c}).missingEnvFile():f.error=q}this.processedEnvs.push(f)}_detectEncoding(P){return p(P)}_prependPublicKey(P,f,y,c=".env.keys"){const q=c===".env.keys"?"":` # -fk ${c}`;return["#/-------------------[DOTENV_PUBLIC_KEY]--------------------/","#/ public-key encryption for .env files /","#/ [how it works](https://dotenvx.com/encryption) /","#/----------------------------------------------------------/",`${P}="${f}"${q}`,"",`# ${y}`].join(`
21
+ ${M}`,e.writeFileX(L,w),f.privateKeyAdded=!0,f.envKeysFilepath=this.envKeysFilepath||n.join(n.dirname(P),n.basename(L))}f.publicKey=k,f.privateKey=u,f.encryptedValue=t(this.value,k),f.privateKeyName=b}const E=H&&this.encrypt,I=this.value!==f.originalValue;E||I?(f.envSrc=d(D,this.key,f.encryptedValue||this.value),this.changedFilepaths.add(P),f.changed=!0):(f.envSrc=D,this.unchangedFilepaths.add(P),f.changed=!1)}catch(q){q.code==="ENOENT"?f.error=new i({envFilepath:P,filepath:c}).missingEnvFile():f.error=q}this.processedEnvs.push(f)}_detectEncoding(P){return p(P)}_prependPublicKey(P,f,y,c=".env.keys"){const q=c===".env.keys"?"":` # -fk ${c}`;return["#/-------------------[DOTENV_PUBLIC_KEY]--------------------/","#/ public-key encryption for .env files /","#/ [how it works](https://dotenvx.com/encryption) /","#/----------------------------------------------------------/",`${P}="${f}"${q}`,"",`# ${y}`].join(`
22
22
  `)}_preserveShebang(P){const[f,...y]=P.split(`
23
23
  `);let c="";return f.startsWith("#!")&&(c=f+`
24
24
  `,P=y.join(`
25
- `)),{firstLinePreserved:c,envSrc:P}}}return Nn=_,Nn}var Ln,Jo;function Hc(){if(Jo)return Ln;Jo=1;const e=Fo(),n=We();class a{constructor(h,r=[],t=!1,s="",d=!1,m=null){this.key=h,this.envs=r,this.overload=t,this.DOTENV_KEY=s,this.all=d,this.envKeysFilepath=m}run(){const h={...process.env},{processedEnvs:r}=new e(this.envs,this.overload,this.DOTENV_KEY,h,this.envKeysFilepath).run(),t=[];for(const s of r)for(const d of s.errors)t.push(d);if(this.key){const s={},d=h[this.key];return s[this.key]=d,d===void 0&&t.push(new n({key:this.key}).missingKey()),{parsed:s,errors:t}}else{if(this.all)return{parsed:h,errors:t};const s={};for(const d of r)if(d.parsed)for(const m of Object.keys(d.parsed))s[m]=h[m];return{parsed:s,errors:t}}}}return Ln=a,Ln}var $n,ei;function kc(){if(ei)return $n;ei=1;const e=Te(),n=[".env.vault",".env.project",".env.keys",".env.me",".env.x",".env.example"];function a(i){try{return e.readdirSync(i).filter(t=>t.startsWith(".env")&&!t.endsWith(".previous")&&!n.includes(t))}catch(h){if(h.code==="ENOENT"){const r=new Error(`missing directory (${i})`);throw r.code="MISSING_DIRECTORY",r}else throw h}}return $n=a,$n}var Dn,ti;function jc(){if(ti)return Dn;ti=1;const e=Te(),n=de,a=We(),i=kc(),h=Wo(),r=Ze();class t{constructor(d=".",m){this.directory=d,this.envFile=m||i(d),this.exampleFilename=".env.example",this.exampleFilepath=n.resolve(this.directory,this.exampleFilename)}run(){if(this.envFile.length<1){const A="MISSING_ENV_FILES",k="no .env* files found",v='? add one with [echo "HELLO=World" > .env] and then run [dotenvx genexample]',_=new Error(k);throw _.code=A,_.help=v,_}const d=new Set,m=new Set,p=this._envFilepaths(),g={},l={};let S=`# ${this.exampleFilename} - generated with dotenvx
26
- `;for(const A of p){const k=n.resolve(this.directory,A);if(!e.existsSync(k)){const R=new a({envFilepath:A,filepath:k}).missingEnvFile();throw R.help=`? add it with [echo "HELLO=World" > ${A}] and then run [dotenvx genexample]`,R}let v=e.readFileX(k);const _=r(v);for(const R in _)d.add(R),v=h(v,R,"");S+=`
27
- ${v}`}if(e.existsSync(this.exampleFilepath)){S=e.readFileX(this.exampleFilepath);const A=r(S);for(const k of[...d])k in A?l[k]=A[k]:(S+=`${k}=''
28
- `,m.add(k),g[k]="")}else for(const A of[...d])m.add(A),g[A]="";return{envExampleFile:S,envFile:this.envFile,exampleFilepath:this.exampleFilepath,addedKeys:[...m],injected:g,preExisted:l}}_envFilepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return Dn=t,Dn}var Kn,ni;function Fc(){if(ni)return Kn;ni=1;function e(n){if(n==="nextjs"){const a=process.env.NODE_ENV||"development",i=["development","test","production"].includes(a)&&a;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 throw new Error(`INVALID_CONVENTION: '${n}'. permitted conventions: ['nextjs']`)}return Kn=e,Kn}var qn,ri;function Mc(){if(ri)return qn;ri=1;const e=Zn,n=de;function a(i){return i[0]==="~"?n.join(e.homedir(),i.slice(1)):i}return qn=a,qn}var Hn,si;function Vc(){if(si)return Hn;si=1;const e=Mc();function n(a){let i=[];if(a&&a.path)if(!Array.isArray(a.path))i=[e(a.path)];else{i=[];for(const h of a.path)i.push(e(h))}return i}return Hn=n,Hn}var kn,oi;function Uc(){if(oi)return kn;oi=1;const{logger:e}=wr();class n{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 kn=n,kn}var jn,ii;function Gc(){if(ii)return jn;ii=1;const e=de,n=Fc(),a=Vc(),i=Uc();function h(r,t=void 0){const s=a(r);let d=[];r.convention&&(d=n(r.convention).concat(d)),new i({DOTENV_KEY:t}).dotenvKey();for(const m of s)t?d.push({type:"envVaultFile",value:e.join(e.dirname(m),".env.vault")}):d.push({type:"envFile",value:m});return d}return jn=h,jn}var Fn,ci;function Yc(){if(ci)return Fn;ci=1;function e(b){return Array.isArray(b)?b:[b]}const n="",a=" ",i="\\",h=/^\s+$/,r=/(?:[^\\]|^)\\$/,t=/^\\!/,s=/^\\#/,d=/\r?\n/g,m=/^\.*\/|^\.+$/,p="/";let g="node-ignore";typeof Symbol<"u"&&(g=Symbol.for("node-ignore"));const l=g,S=(b,B,T)=>Object.defineProperty(b,B,{value:T}),A=/([0-z])-([0-z])/g,k=()=>!1,v=b=>b.replace(A,(B,T,L)=>T.charCodeAt(0)<=L.charCodeAt(0)?B:n),_=b=>{const{length:B}=b;return b.slice(0,B-B%2)},R=[[/^\uFEFF/,()=>n],[/((?:\\\\)*?)(\\?\s+)$/,(b,B,T)=>B+(T.indexOf("\\")===0?a:n)],[/(\\+?)\s/g,(b,B)=>{const{length:T}=B;return B.slice(0,T-T%2)+a}],[/[\\$.|*+(){^]/g,b=>`\\${b}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(b,B,T)=>B+6<T.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(b,B,T)=>{const L=T.replace(/\\\*/g,"[^\\/]*");return B+L}],[/\\\\\\(?=[$.|*+(){^])/g,()=>i],[/\\\\/g,()=>i],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(b,B,T,L,o)=>B===i?`\\[${T}${_(L)}${o}`:o==="]"&&L.length%2===0?`[${v(T)}${L}]`:"[]"],[/(?:[^*])$/,b=>/\/$/.test(b)?`${b}$`:`${b}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(b,B)=>`${B?`${B}[^/]+`:"[^/]*"}(?=$|\\/$)`]],P=Object.create(null),f=(b,B)=>{let T=P[b];return T||(T=R.reduce((L,[o,w])=>L.replace(o,w.bind(b)),b),P[b]=T),B?new RegExp(T,"i"):new RegExp(T)},y=b=>typeof b=="string",c=b=>b&&y(b)&&!h.test(b)&&!r.test(b)&&b.indexOf("#")!==0,q=b=>b.split(d);class D{constructor(B,T,L,o){this.origin=B,this.pattern=T,this.negative=L,this.regex=o}}const $=(b,B)=>{const T=b;let L=!1;b.indexOf("!")===0&&(L=!0,b=b.substr(1)),b=b.replace(t,"!").replace(s,"#");const o=f(b,B);return new D(T,b,L,o)},H=(b,B)=>{throw new B(b)},E=(b,B,T)=>y(b)?b?E.isNotRelative(b)?T(`path should be a \`path.relative()\`d string, but got "${B}"`,RangeError):!0:T("path must not be empty",TypeError):T(`path must be a string, but got \`${B}\``,TypeError),O=b=>m.test(b);E.isNotRelative=O,E.convert=b=>b;class j{constructor({ignorecase:B=!0,ignoreCase:T=B,allowRelativePaths:L=!1}={}){S(this,l,!0),this._rules=[],this._ignoreCase=T,this._allowRelativePaths=L,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(B){if(B&&B[l]){this._rules=this._rules.concat(B._rules),this._added=!0;return}if(c(B)){const T=$(B,this._ignoreCase);this._added=!0,this._rules.push(T)}}add(B){return this._added=!1,e(y(B)?q(B):B).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(B){return this.add(B)}_testOne(B,T){let L=!1,o=!1;return this._rules.forEach(w=>{const{negative:C}=w;if(o===C&&L!==o||C&&!L&&!o&&!T)return;w.regex.test(B)&&(L=!C,o=C)}),{ignored:L,unignored:o}}_test(B,T,L,o){const w=B&&E.convert(B);return E(w,B,this._allowRelativePaths?k:H),this._t(w,T,L,o)}_t(B,T,L,o){if(B in T)return T[B];if(o||(o=B.split(p)),o.pop(),!o.length)return T[B]=this._testOne(B,L);const w=this._t(o.join(p)+p,T,L,o);return T[B]=w.ignored?w:this._testOne(B,L)}ignores(B){return this._test(B,this._ignoreCache,!1).ignored}createFilter(){return B=>!this.ignores(B)}filter(B){return e(B).filter(this.createFilter())}test(B){return this._test(B,this._testCache,!0)}}const u=b=>new j(b),N=b=>E(b&&E.convert(b),b,k);if(u.isPathValid=N,u.default=u,Fn=u,typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){const b=T=>/^\\\\\?\\/.test(T)||/["<>|\u0000-\u001F]+/u.test(T)?T:T.replace(/\\/g,"/");E.convert=b;const B=/^[a-z]:\//i;E.isNotRelative=T=>B.test(T)||O(T)}return Fn}var Mn,ai;function Wc(){if(ai)return Mn;ai=1;const e=Te(),n=Yc();function a(){if(!e.existsSync(".gitignore"))return!1;const i=e.readFileX(".gitignore");return!!n(i).add(i).ignores(".env.keys")}return Mn=a,Mn}var Vn,ui;function Zc(){if(ui)return Vn;ui=1;const e=de,{setLogLevel:n,logger:a}=wr(),{getColor:i,bold:h}=Er(),r=Qi(),t=Fo(),s=qc(),d=Hc(),m=bn(),p=jc(),g=Gc(),l=_o(),S=Te(),A=Wc();return Vn={config:function(c={}){let q=process.env;c&&c.processEnv!=null&&(q=c.processEnv);const D=c.overload||c.override,$=c.ignore||[],H=c.strict,E=c.envKeysFile;let O=process.env.DOTENV_KEY;c&&c.DOTENV_KEY&&(O=c.DOTENV_KEY),c&&n(c);try{const j=g(c,O),{processedEnvs:u,readableFilepaths:N,uniqueInjectedKeys:b}=new t(j,D,O,q,E).run();let B;const T={};for(const o of u){o.type==="envVaultFile"&&(a.verbose(`loading env from encrypted ${o.filepath} (${e.resolve(o.filepath)})`),a.debug(`decrypting encrypted env from ${o.filepath} (${e.resolve(o.filepath)})`)),o.type==="envFile"&&a.verbose(`loading env from ${o.filepath} (${e.resolve(o.filepath)})`);for(const w of o.errors||[]){if($.includes(w.code)){a.verbose(`ignored: ${w.message}`);continue}if(H)throw w;B=w,w.code==="MISSING_ENV_FILE"&&c.convention||(console.error(w.message),w.help&&console.error(w.help))}Object.assign(T,o.injected||{}),Object.assign(T,o.preExisted||{}),a.debug(o.parsed);for(const[w,C]of Object.entries(o.injected||{}))a.verbose(`${w} set`),a.debug(`${w} set to ${C}`);for(const[w,C]of Object.entries(o.preExisted||{}))a.verbose(`${w} pre-exists (protip: use --overload to override)`),a.debug(`${w} pre-exists as ${C} (protip: use --overload to override)`)}let L=`injecting env (${b.length})`;return N.length>0&&(L+=` from ${N.join(", ")}`),a.successv(L),B?{parsed:T,error:B}:{parsed:T}}catch(j){if(H)throw j;return a.error(j.message),j.help&&a.help(j.help),{parsed:{},error:j}}},parse:function(c,q={}){let D=process.env;q&&q.processEnv!=null&&(D=q.processEnv);const $=q.privateKey||null,H=q.overload||q.override,{parsed:E,errors:O}=new l(c,$,D,H).run();for(const j of O)console.error(j.message),j.help&&console.error(j.help);return E},set:function(c,q,D={}){let $=!0;(D.plain||D.encrypt===!1)&&($=!1);const H=g(D),E=D.envKeysFile,{processedEnvs:O,changedFilepaths:j,unchangedFilepaths:u}=new s(c,q,H,$,E).run();let N="";$&&(N=" with encryption");for(const b of O)a.verbose(`setting for ${b.envFilepath}`),b.error?b.error.code==="MISSING_ENV_FILE"?(a.warn(b.error.message),a.help(`? add one with [echo "HELLO=World" > ${b.envFilepath}] and re-run [dotenvx set]`)):(a.warn(b.error.message),b.error.help&&a.help(b.error.help)):(S.writeFileX(b.filepath,b.envSrc),a.verbose(`${b.key} set${N} (${b.envFilepath})`),a.debug(`${b.key} set${N} to ${b.value} (${b.envFilepath})`));j.length>0?a.success(`\u2714 set ${c}${N} (${j.join(",")})`):u.length>0&&a.info(`no changes (${u})`);for(const b of O)b.privateKeyAdded&&(a.success(`\u2714 key added to ${b.envKeysFilepath} (${b.privateKeyName})`),A()||a.help("\u2B95 next run [dotenvx ext gitignore --pattern .env.keys] to gitignore .env.keys"),a.help(`\u2B95 next run [${b.privateKeyName}='${b.privateKey}' dotenvx get ${c}] to test decryption locally`));return{processedEnvs:O,changedFilepaths:j,unchangedFilepaths:u}},get:function(c,q={}){const D=g(q),$=q.ignore||[],{parsed:H,errors:E}=new d(c,D,q.overload,process.env.DOTENV_KEY,q.all,q.envKeysFile).run();for(const O of E||[])if(!$.includes(O.code)){if(q.strict)throw O;console.error(O.message),O.help&&console.error(O.help)}if(c){const O=H[c];return O===void 0?void 0:O}else if(q.format==="eval"){let O="";for(const[j,u]of Object.entries(H))O+=`${j}=${escape(u)}
29
- `;return O=O.trim(),O}else if(q.format==="shell"){let O="";for(const[j,u]of Object.entries(H))O+=`${j}=${u} `;return O=O.trim(),O}else return H},ls:function(c,q,D){return new r(c,q,D).run()},keypair:function(c,q,D=null){const $=new m(c,D).run();return q?$[q]:$},genexample:function(c,q){return new p(c,q).run()},setLogLevel:n,logger:a,getColor:i,bold:h},Vn}var li;function zc(){return li||(li=1,Zc().config()),Qn}zc();const Xc={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 Ye{static instance;envVars;constructor(){this.envVars={},Object.values(Xc).forEach(n=>{const a=process.env[n];if(a==null)throw new Error(`Missing required environment variable: ${n}`);this.envVars[n]=a})}static getInstance(){return Ye.instance||(Ye.instance=new Ye),Ye.instance}getConfig(n){return this.envVars[n]}}function fi(e){return typeof e=="object"&&e!==null&&"objectID"in e&&typeof e.objectID=="string"}function Qc(e){const n=Object.keys(e).sort(),a={objectID:e.objectID};for(const i of n)i!=="objectID"&&(a[i]=e[i]);return a}function di(e){return e.map(Qc).sort((n,a)=>n.objectID.localeCompare(a.objectID))}class Jc{client;indexName;constructor(n){this.client=n.getClient(),this.indexName=n.getIndexName()}async uploadObjects(n){if(n.length===0){console.error("No items are included in the target JSON file. More than 1 item is necessary.");return}let a=await this.getAllObjects();a=di(a);const i=di(n),h=this.determineOperations(a,i);if(h.update.length===0&&h.add.length===0){console.log("No updates needed. All objects are up to date.");return}if(h.update.length>0){const r=await this.client.partialUpdateObjects({indexName:this.indexName,objects:h.update,createIfNotExists:!0});console.log(`Updated ${r.length} objects`)}if(h.add.length>0){const r=await this.client.saveObjects({indexName:this.indexName,objects:h.add});console.log(`Added ${r.length} objects`)}if(h.delete.length>0){const r=h.delete.map(s=>s.objectID),t=await this.client.deleteObjects({indexName:this.indexName,objectIDs:r});console.log(`Deleted ${t.length} objects`)}}async getAllObjects(){const n=[];return await this.client.browseObjects({indexName:this.indexName,aggregator:a=>{Array.isArray(a.hits)&&a.hits.forEach(i=>{fi(i)&&n.push(i)})}}),n}determineOperations(n,a){const i=new Map(n.map(t=>[t.objectID,t])),h=new Map(a.map(t=>[t.objectID,t])),r={update:[],add:[],delete:[]};for(const t of a){const s=i.get(t.objectID);s==null?r.add.push(t):wi(s,t)||r.update.push(t)}for(const t of n)h.has(t.objectID)||r.delete.push(t);return r}}class Un{static instance;client;indexName;constructor(n,a){this.client=a(n.getConfig("ALGOLIA_APP_ID"),n.getConfig("ALGOLIA_ADMIN_API_KEY")),this.indexName=n.getConfig("ALGOLIA_INDEX_NAME")}static getInstance(){if(!this.instance){const n=Ye.getInstance();this.instance=new Un(n,xi)}return this.instance}getClient(){return this.client}getIndexName(){return this.indexName}}const ea=gi({meta:{name:Ai,version:Si,description:Ri},args:{},async run({args:e}){try{let n=Ye.getInstance().getConfig("DATA_DIR");n=de.join(process.cwd(),n),Be.existsSync(n)&&Be.statSync(n).isDirectory()||(console.error(`Error: provided directory does not exist - ${n}`),process.exit(1));const a=Bi(n)[0];a.every(h=>fi(h))||(console.error(`The content of the provided json file is incompatible. Check the file: ${n}`),process.exit(1));const i=Un.getInstance();await new Jc(i).uploadObjects(a)}catch(n){console.error("Some errors occured: ",n),process.exit(1)}}});mi(ea);
25
+ `)),{firstLinePreserved:c,envSrc:P}}}return Nn=_,Nn}var Ln,Jo;function Hc(){if(Jo)return Ln;Jo=1;const e=Fo(),n=We();class a{constructor(h,r=[],t=!1,s="",d=!1,m=null){this.key=h,this.envs=r,this.overload=t,this.DOTENV_KEY=s,this.all=d,this.envKeysFilepath=m}run(){const h={...process.env},{processedEnvs:r}=new e(this.envs,this.overload,this.DOTENV_KEY,h,this.envKeysFilepath).run(),t=[];for(const s of r)for(const d of s.errors)t.push(d);if(this.key){const s={},d=h[this.key];return s[this.key]=d,d===void 0&&t.push(new n({key:this.key}).missingKey()),{parsed:s,errors:t}}else{if(this.all)return{parsed:h,errors:t};const s={};for(const d of r)if(d.parsed)for(const m of Object.keys(d.parsed))s[m]=h[m];return{parsed:s,errors:t}}}}return Ln=a,Ln}var $n,ei;function jc(){if(ei)return $n;ei=1;const e=Te(),n=[".env.vault",".env.project",".env.keys",".env.me",".env.x",".env.example"];function a(i){try{return e.readdirSync(i).filter(t=>t.startsWith(".env")&&!t.endsWith(".previous")&&!n.includes(t))}catch(h){if(h.code==="ENOENT"){const r=new Error(`missing directory (${i})`);throw r.code="MISSING_DIRECTORY",r}else throw h}}return $n=a,$n}var Dn,ti;function kc(){if(ti)return Dn;ti=1;const e=Te(),n=de,a=We(),i=jc(),h=Wo(),r=Ze();class t{constructor(d=".",m){this.directory=d,this.envFile=m||i(d),this.exampleFilename=".env.example",this.exampleFilepath=n.resolve(this.directory,this.exampleFilename)}run(){if(this.envFile.length<1){const A="MISSING_ENV_FILES",j="no .env* files found",v='? add one with [echo "HELLO=World" > .env] and then run [dotenvx genexample]',_=new Error(j);throw _.code=A,_.help=v,_}const d=new Set,m=new Set,p=this._envFilepaths(),g={},l={};let S=`# ${this.exampleFilename} - generated with dotenvx
26
+ `;for(const A of p){const j=n.resolve(this.directory,A);if(!e.existsSync(j)){const R=new a({envFilepath:A,filepath:j}).missingEnvFile();throw R.help=`? add it with [echo "HELLO=World" > ${A}] and then run [dotenvx genexample]`,R}let v=e.readFileX(j);const _=r(v);for(const R in _)d.add(R),v=h(v,R,"");S+=`
27
+ ${v}`}if(e.existsSync(this.exampleFilepath)){S=e.readFileX(this.exampleFilepath);const A=r(S);for(const j of[...d])j in A?l[j]=A[j]:(S+=`${j}=''
28
+ `,m.add(j),g[j]="")}else for(const A of[...d])m.add(A),g[A]="";return{envExampleFile:S,envFile:this.envFile,exampleFilepath:this.exampleFilepath,addedKeys:[...m],injected:g,preExisted:l}}_envFilepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return Dn=t,Dn}var Kn,ni;function Fc(){if(ni)return Kn;ni=1;function e(n){if(n==="nextjs"){const a=process.env.NODE_ENV||"development",i=["development","test","production"].includes(a)&&a;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 throw new Error(`INVALID_CONVENTION: '${n}'. permitted conventions: ['nextjs']`)}return Kn=e,Kn}var qn,ri;function Mc(){if(ri)return qn;ri=1;const e=Zn,n=de;function a(i){return i[0]==="~"?n.join(e.homedir(),i.slice(1)):i}return qn=a,qn}var Hn,si;function Vc(){if(si)return Hn;si=1;const e=Mc();function n(a){let i=[];if(a&&a.path)if(!Array.isArray(a.path))i=[e(a.path)];else{i=[];for(const h of a.path)i.push(e(h))}return i}return Hn=n,Hn}var jn,oi;function Uc(){if(oi)return jn;oi=1;const{logger:e}=wr();class n{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 jn=n,jn}var kn,ii;function Gc(){if(ii)return kn;ii=1;const e=de,n=Fc(),a=Vc(),i=Uc();function h(r,t=void 0){const s=a(r);let d=[];r.convention&&(d=n(r.convention).concat(d)),new i({DOTENV_KEY:t}).dotenvKey();for(const m of s)t?d.push({type:"envVaultFile",value:e.join(e.dirname(m),".env.vault")}):d.push({type:"envFile",value:m});return d}return kn=h,kn}var Fn,ci;function Yc(){if(ci)return Fn;ci=1;function e(b){return Array.isArray(b)?b:[b]}const n="",a=" ",i="\\",h=/^\s+$/,r=/(?:[^\\]|^)\\$/,t=/^\\!/,s=/^\\#/,d=/\r?\n/g,m=/^\.*\/|^\.+$/,p="/";let g="node-ignore";typeof Symbol<"u"&&(g=Symbol.for("node-ignore"));const l=g,S=(b,B,T)=>Object.defineProperty(b,B,{value:T}),A=/([0-z])-([0-z])/g,j=()=>!1,v=b=>b.replace(A,(B,T,L)=>T.charCodeAt(0)<=L.charCodeAt(0)?B:n),_=b=>{const{length:B}=b;return b.slice(0,B-B%2)},R=[[/^\uFEFF/,()=>n],[/((?:\\\\)*?)(\\?\s+)$/,(b,B,T)=>B+(T.indexOf("\\")===0?a:n)],[/(\\+?)\s/g,(b,B)=>{const{length:T}=B;return B.slice(0,T-T%2)+a}],[/[\\$.|*+(){^]/g,b=>`\\${b}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(b,B,T)=>B+6<T.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(b,B,T)=>{const L=T.replace(/\\\*/g,"[^\\/]*");return B+L}],[/\\\\\\(?=[$.|*+(){^])/g,()=>i],[/\\\\/g,()=>i],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(b,B,T,L,o)=>B===i?`\\[${T}${_(L)}${o}`:o==="]"&&L.length%2===0?`[${v(T)}${L}]`:"[]"],[/(?:[^*])$/,b=>/\/$/.test(b)?`${b}$`:`${b}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(b,B)=>`${B?`${B}[^/]+`:"[^/]*"}(?=$|\\/$)`]],P=Object.create(null),f=(b,B)=>{let T=P[b];return T||(T=R.reduce((L,[o,w])=>L.replace(o,w.bind(b)),b),P[b]=T),B?new RegExp(T,"i"):new RegExp(T)},y=b=>typeof b=="string",c=b=>b&&y(b)&&!h.test(b)&&!r.test(b)&&b.indexOf("#")!==0,q=b=>b.split(d);class D{constructor(B,T,L,o){this.origin=B,this.pattern=T,this.negative=L,this.regex=o}}const $=(b,B)=>{const T=b;let L=!1;b.indexOf("!")===0&&(L=!0,b=b.substr(1)),b=b.replace(t,"!").replace(s,"#");const o=f(b,B);return new D(T,b,L,o)},H=(b,B)=>{throw new B(b)},E=(b,B,T)=>y(b)?b?E.isNotRelative(b)?T(`path should be a \`path.relative()\`d string, but got "${B}"`,RangeError):!0:T("path must not be empty",TypeError):T(`path must be a string, but got \`${B}\``,TypeError),I=b=>m.test(b);E.isNotRelative=I,E.convert=b=>b;class k{constructor({ignorecase:B=!0,ignoreCase:T=B,allowRelativePaths:L=!1}={}){S(this,l,!0),this._rules=[],this._ignoreCase=T,this._allowRelativePaths=L,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(B){if(B&&B[l]){this._rules=this._rules.concat(B._rules),this._added=!0;return}if(c(B)){const T=$(B,this._ignoreCase);this._added=!0,this._rules.push(T)}}add(B){return this._added=!1,e(y(B)?q(B):B).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(B){return this.add(B)}_testOne(B,T){let L=!1,o=!1;return this._rules.forEach(w=>{const{negative:C}=w;if(o===C&&L!==o||C&&!L&&!o&&!T)return;w.regex.test(B)&&(L=!C,o=C)}),{ignored:L,unignored:o}}_test(B,T,L,o){const w=B&&E.convert(B);return E(w,B,this._allowRelativePaths?j:H),this._t(w,T,L,o)}_t(B,T,L,o){if(B in T)return T[B];if(o||(o=B.split(p)),o.pop(),!o.length)return T[B]=this._testOne(B,L);const w=this._t(o.join(p)+p,T,L,o);return T[B]=w.ignored?w:this._testOne(B,L)}ignores(B){return this._test(B,this._ignoreCache,!1).ignored}createFilter(){return B=>!this.ignores(B)}filter(B){return e(B).filter(this.createFilter())}test(B){return this._test(B,this._testCache,!0)}}const u=b=>new k(b),N=b=>E(b&&E.convert(b),b,j);if(u.isPathValid=N,u.default=u,Fn=u,typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){const b=T=>/^\\\\\?\\/.test(T)||/["<>|\u0000-\u001F]+/u.test(T)?T:T.replace(/\\/g,"/");E.convert=b;const B=/^[a-z]:\//i;E.isNotRelative=T=>B.test(T)||I(T)}return Fn}var Mn,ai;function Wc(){if(ai)return Mn;ai=1;const e=Te(),n=Yc();function a(){if(!e.existsSync(".gitignore"))return!1;const i=e.readFileX(".gitignore");return!!n(i).add(i).ignores(".env.keys")}return Mn=a,Mn}var Vn,ui;function Zc(){if(ui)return Vn;ui=1;const e=de,{setLogLevel:n,logger:a}=wr(),{getColor:i,bold:h}=Er(),r=Qi(),t=Fo(),s=qc(),d=Hc(),m=bn(),p=kc(),g=Gc(),l=_o(),S=Te(),A=Wc();return Vn={config:function(c={}){let q=process.env;c&&c.processEnv!=null&&(q=c.processEnv);const D=c.overload||c.override,$=c.ignore||[],H=c.strict,E=c.envKeysFile;let I=process.env.DOTENV_KEY;c&&c.DOTENV_KEY&&(I=c.DOTENV_KEY),c&&n(c);try{const k=g(c,I),{processedEnvs:u,readableFilepaths:N,uniqueInjectedKeys:b}=new t(k,D,I,q,E).run();let B;const T={};for(const o of u){o.type==="envVaultFile"&&(a.verbose(`loading env from encrypted ${o.filepath} (${e.resolve(o.filepath)})`),a.debug(`decrypting encrypted env from ${o.filepath} (${e.resolve(o.filepath)})`)),o.type==="envFile"&&a.verbose(`loading env from ${o.filepath} (${e.resolve(o.filepath)})`);for(const w of o.errors||[]){if($.includes(w.code)){a.verbose(`ignored: ${w.message}`);continue}if(H)throw w;B=w,w.code==="MISSING_ENV_FILE"&&c.convention||(console.error(w.message),w.help&&console.error(w.help))}Object.assign(T,o.injected||{}),Object.assign(T,o.preExisted||{}),a.debug(o.parsed);for(const[w,C]of Object.entries(o.injected||{}))a.verbose(`${w} set`),a.debug(`${w} set to ${C}`);for(const[w,C]of Object.entries(o.preExisted||{}))a.verbose(`${w} pre-exists (protip: use --overload to override)`),a.debug(`${w} pre-exists as ${C} (protip: use --overload to override)`)}let L=`injecting env (${b.length})`;return N.length>0&&(L+=` from ${N.join(", ")}`),a.successv(L),B?{parsed:T,error:B}:{parsed:T}}catch(k){if(H)throw k;return a.error(k.message),k.help&&a.help(k.help),{parsed:{},error:k}}},parse:function(c,q={}){let D=process.env;q&&q.processEnv!=null&&(D=q.processEnv);const $=q.privateKey||null,H=q.overload||q.override,{parsed:E,errors:I}=new l(c,$,D,H).run();for(const k of I)console.error(k.message),k.help&&console.error(k.help);return E},set:function(c,q,D={}){let $=!0;(D.plain||D.encrypt===!1)&&($=!1);const H=g(D),E=D.envKeysFile,{processedEnvs:I,changedFilepaths:k,unchangedFilepaths:u}=new s(c,q,H,$,E).run();let N="";$&&(N=" with encryption");for(const b of I)a.verbose(`setting for ${b.envFilepath}`),b.error?b.error.code==="MISSING_ENV_FILE"?(a.warn(b.error.message),a.help(`? add one with [echo "HELLO=World" > ${b.envFilepath}] and re-run [dotenvx set]`)):(a.warn(b.error.message),b.error.help&&a.help(b.error.help)):(S.writeFileX(b.filepath,b.envSrc),a.verbose(`${b.key} set${N} (${b.envFilepath})`),a.debug(`${b.key} set${N} to ${b.value} (${b.envFilepath})`));k.length>0?a.success(`\u2714 set ${c}${N} (${k.join(",")})`):u.length>0&&a.info(`no changes (${u})`);for(const b of I)b.privateKeyAdded&&(a.success(`\u2714 key added to ${b.envKeysFilepath} (${b.privateKeyName})`),A()||a.help("\u2B95 next run [dotenvx ext gitignore --pattern .env.keys] to gitignore .env.keys"),a.help(`\u2B95 next run [${b.privateKeyName}='${b.privateKey}' dotenvx get ${c}] to test decryption locally`));return{processedEnvs:I,changedFilepaths:k,unchangedFilepaths:u}},get:function(c,q={}){const D=g(q),$=q.ignore||[],{parsed:H,errors:E}=new d(c,D,q.overload,process.env.DOTENV_KEY,q.all,q.envKeysFile).run();for(const I of E||[])if(!$.includes(I.code)){if(q.strict)throw I;console.error(I.message),I.help&&console.error(I.help)}if(c){const I=H[c];return I===void 0?void 0:I}else if(q.format==="eval"){let I="";for(const[k,u]of Object.entries(H))I+=`${k}=${escape(u)}
29
+ `;return I=I.trim(),I}else if(q.format==="shell"){let I="";for(const[k,u]of Object.entries(H))I+=`${k}=${u} `;return I=I.trim(),I}else return H},ls:function(c,q,D){return new r(c,q,D).run()},keypair:function(c,q,D=null){const $=new m(c,D).run();return q?$[q]:$},genexample:function(c,q){return new p(c,q).run()},setLogLevel:n,logger:a,getColor:i,bold:h},Vn}var li;function zc(){return li||(li=1,Zc().config()),Qn}zc();const Xc={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 Ye{static instance;envVars;constructor(){this.envVars={},Object.values(Xc).forEach(n=>{const a=process.env[n];if(a==null)throw new Error(`Missing required environment variable: ${n}`);this.envVars[n]=a})}static getInstance(){return Ye.instance||(Ye.instance=new Ye),Ye.instance}getConfig(n){return this.envVars[n]}}function fi(e){return typeof e=="object"&&e!==null&&"objectID"in e&&typeof e.objectID=="string"}function Qc(e){const n=Object.keys(e).sort(),a={objectID:e.objectID};for(const i of n)i!=="objectID"&&(a[i]=e[i]);return a}function di(e){return e.map(Qc).sort((n,a)=>n.objectID.localeCompare(a.objectID))}class Jc{client;indexName;constructor(n){this.client=n.getClient(),this.indexName=n.getIndexName()}async uploadObjects(n){if(n.length===0){console.error("No items are included in the target JSON file. More than 1 item is necessary.");return}let a=await this.getAllObjects();a=di(a);const i=di(n),h=this.determineOperations(a,i);if(h.update.length===0&&h.add.length===0&&h.delete.length===0){console.log("No updates needed. All objects are up to date.");return}if(h.update.length>0){const r=await this.client.partialUpdateObjects({indexName:this.indexName,objects:h.update,createIfNotExists:!0});console.log(`Updated ${r[0].objectIDs.length} objects`)}if(h.add.length>0){const r=await this.client.saveObjects({indexName:this.indexName,objects:h.add});console.log(`Added ${r[0].objectIDs.length} objects`)}if(h.delete.length>0){const r=h.delete.map(s=>s.objectID),t=await this.client.deleteObjects({indexName:this.indexName,objectIDs:r});console.log(`Deleted ${t[0].objectIDs.length} objects`)}}async getAllObjects(){const n=[];return await this.client.browseObjects({indexName:this.indexName,aggregator:a=>{Array.isArray(a.hits)&&a.hits.forEach(i=>{fi(i)&&n.push(i)})}}),n}determineOperations(n,a){const i=new Map(n.map(t=>[t.objectID,t])),h=new Map(a.map(t=>[t.objectID,t])),r={update:[],add:[],delete:[]};for(const t of a){const s=i.get(t.objectID);s==null?r.add.push(t):wi(s,t)||r.update.push(t)}for(const t of n)h.has(t.objectID)||r.delete.push(t);return r}}class Un{static instance;client;indexName;constructor(n,a){this.client=a(n.getConfig("ALGOLIA_APP_ID"),n.getConfig("ALGOLIA_ADMIN_API_KEY")),this.indexName=n.getConfig("ALGOLIA_INDEX_NAME")}static getInstance(){if(!this.instance){const n=Ye.getInstance();this.instance=new Un(n,xi)}return this.instance}getClient(){return this.client}getIndexName(){return this.indexName}}const ea=gi({meta:{name:Ai,version:Si,description:Ri},args:{},async run({args:e}){try{let n=Ye.getInstance().getConfig("DATA_DIR");n=de.join(process.cwd(),n),Be.existsSync(n)&&Be.statSync(n).isDirectory()||(console.error(`Error: provided directory does not exist - ${n}`),process.exit(1));const a=Bi(n)[0];a.every(h=>fi(h))||(console.error(`The content of the provided json file is incompatible. Check the file: ${n}`),process.exit(1));const i=Un.getInstance();await new Jc(i).uploadObjects(a)}catch(n){console.error("Some errors occured: ",n),process.exit(1)}}});mi(ea);