algolia-uploader 0.0.14 → 0.0.15-beta.2

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,32 +1,40 @@
1
1
  #!/usr/bin/env node
2
- import{defineCommand as to,runMain as no}from"citty";import Fe from"fs";import Re from"path";import ro from"tty";import{createRequire as so}from"node:module";import nr from"child_process";import io from"util";import oo from"os";import{isEqual as co}from"es-toolkit";import{algoliasearch as ao}from"algoliasearch";const uo="algolia-uploader",lo="0.0.14",fo="command-line util to upload Algolia source";function ho(e){return Fe.readdirSync(e).filter(r=>r.endsWith(".json")).map(r=>{const f=Fe.readFileSync(Re.join(e,r),"utf8");return JSON.parse(f)})}function yo(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var r=e.default;if(typeof r=="function"){var f=function c(){var s=!1;try{s=this instanceof c}catch{}return s?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};f.prototype=r.prototype}else f={};return Object.defineProperty(f,"__esModule",{value:!0}),Object.keys(e).forEach(function(c){var s=Object.getOwnPropertyDescriptor(e,c);Object.defineProperty(f,c,s.get?s:{enumerable:!0,get:function(){return e[c]}})}),f}var rr={};const sr="1.61.1",ir="@dotenvx/dotenvx",or="secrets for agents\u2013from the creator of `dotenv`",cr="@motdotla",ar=["dotenv","env"],ur="https://github.com/dotenvx/dotenvx",lr={type:"git",url:"git+https://github.com/dotenvx/dotenvx.git"},fr="BSD-3-Clause",dr=["src/**/*","CHANGELOG.md"],hr="src/lib/main.js",yr="src/lib/main.d.ts",pr={".":{types:"./src/lib/main.d.ts",require:"./src/lib/main.js",default:"./src/lib/main.js"},"./config":"./src/lib/config.js","./config.js":"./src/lib/config.js","./package.json":"./package.json"},vr={dotenvx:"./src/cli/dotenvx.js"},mr={standard:"standard","standard:fix":"standard --fix",test:"tap run --test-env=DOTENVX_NO_OPS=true --allow-empty-coverage --disable-coverage --timeout=60000","test-coverage":"tap run --test-env=DOTENVX_NO_OPS=true --show-full-coverage --timeout=60000",testshell:"bash shellspec",prerelease:"npm test && npm run testshell",release:"standard-version"},gr="https://dotenvx.com",br={commander:"^11.1.0",dotenv:"^17.2.1",eciesjs:"^0.4.10",execa:"^5.1.1",fdir:"^6.2.0",ignore:"^5.3.0","object-treeify":"1.1.33",picomatch:"^4.0.4",which:"^4.0.0","yocto-spinner":"^1.1.0"},Er={"@yao-pkg/pkg":"^6.14.2","capture-console":"^1.0.2",esbuild:"^0.25.8",proxyquire:"^2.1.3",sinon:"^14.0.1",standard:"^17.1.0","standard-version":"^9.5.0",tap:"^21.0.1"},_r={access:"public",provenance:!0},po={version:sr,name:ir,description:or,author:cr,keywords:ar,homepage:ur,repository:lr,license:fr,files:dr,main:hr,types:yr,exports:pr,bin:vr,scripts:mr,funding:gr,dependencies:br,devDependencies:Er,publishConfig:_r},vo={__proto__:null,author:cr,bin:vr,default:po,dependencies:br,description:or,devDependencies:Er,exports:pr,files:dr,funding:gr,homepage:ur,keywords:ar,license:fr,main:hr,name:ir,publishConfig:_r,repository:lr,scripts:mr,types:yr,version:sr},mo=yo(vo);var ht,wr;function go(){if(wr)return ht;wr=1;const{name:e,version:r,description:f}=mo;return ht={name:e,version:r,description:f},ht}var yt,Sr;function bo(){if(Sr)return yt;Sr=1;function e(r,f=7){return r&&r.length>0?r.slice(0,f)+"\u2026":""}return yt=e,yt}var pt,xr;function Pe(){if(xr)return pt;xr=1;const e=bo(),r={COMMAND_EXITED_WITH_CODE:"https://github.com/dotenvx/dotenvx/issues/new",COMMAND_SUBSTITUTION_FAILED:"https://github.com/dotenvx/dotenvx/issues/532",DECRYPTION_FAILED:"https://github.com/dotenvx/dotenvx/issues/757",DANGEROUS_DEPENDENCY_HOIST:"https://github.com/dotenvx/dotenvx/issues/622",INVALID_COLOR:"must be 256 colors",INVALID_CONVENTION:"https://github.com/dotenvx/dotenvx/issues/761",INVALID_PRIVATE_KEY:"https://github.com/dotenvx/dotenvx/issues/465",INVALID_PUBLIC_KEY:"https://github.com/dotenvx/dotenvx/issues/756",MALFORMED_ENCRYPTED_DATA:"https://github.com/dotenvx/dotenvx/issues/467",MISPAIRED_PRIVATE_KEY:"https://github.com/dotenvx/dotenvx/issues/752",MISSING_DIRECTORY:"https://github.com/dotenvx/dotenvx/issues/758",MISSING_ENV_FILE:"https://github.com/dotenvx/dotenvx/issues/484",MISSING_ENV_KEYS_FILE:"https://github.com/dotenvx/dotenvx/issues/775",MISSING_ENV_FILES:"https://github.com/dotenvx/dotenvx/issues/760",MISSING_KEY:"https://github.com/dotenvx/dotenvx/issues/759",MISSING_LOG_LEVEL:"must be valid log level",MISSING_PRIVATE_KEY:"https://github.com/dotenvx/dotenvx/issues/464",PRECOMMIT_HOOK_MODIFY_FAILED:"try again or report error",WRONG_PRIVATE_KEY:"https://github.com/dotenvx/dotenvx/issues/466"};class f{constructor(s={}){this.filepath=s.filepath,this.envFilepath=s.envFilepath,this.envKeysFilepath=s.envKeysFilepath,this.key=s.key,this.privateKey=s.privateKey,this.privateKeyName=s.privateKeyName,this.publicKeyName=s.publicKeyName,this.publicKey=s.publicKey,this.publicKeyExisting=s.publicKeyExisting,this.command=s.command,this.message=s.message,this.code=s.code,this.help=s.help,this.debug=s.debug,this.convention=s.convention,this.directory=s.directory,this.exitCode=s.exitCode,this.level=s.level,this.color=s.color,this.error=s.error}custom(){const s=new Error(this.message);return this.code&&(s.code=this.code),this.help&&(s.help=this.help),this.code&&!s.help&&(s.help=`fix: [${r[this.code]}]`),s.messageWithHelp=`${s.message}. ${s.help}`,this.debug&&(s.debug=this.debug),s}commandExitedWithCode(){const s="COMMAND_EXITED_WITH_CODE",i=`[${s}] Command exited with exit code ${this.exitCode}`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}commandSubstitutionFailed(){const s="COMMAND_SUBSTITUTION_FAILED",i=`[${s}] could not eval ${this.key} containing command '${this.command}': ${this.message}`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}decryptionFailed(){const s="DECRYPTION_FAILED",i=`[${s}] ${this.message}`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}dangerousDependencyHoist(){const s="DANGEROUS_DEPENDENCY_HOIST",i=`[${s}] your environment has hoisted an incompatible version of a dotenvx dependency: ${this.message}`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}invalidColor(){const s="INVALID_COLOR",i=`[${s}] Invalid color ${this.color}`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}invalidConvention(){const s="INVALID_CONVENTION",i=`[${s}] invalid convention (${this.convention})`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}invalidPrivateKey(){const s="INVALID_PRIVATE_KEY",i=`[${s}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}invalidPublicKey(){const s="INVALID_PUBLIC_KEY",i=`[${s}] could not encrypt using public key '${this.publicKeyName}=${e(this.publicKey)}'`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}malformedEncryptedData(){const s="MALFORMED_ENCRYPTED_DATA",i=`[${s}] could not decrypt ${this.key} because encrypted data appears malformed`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}mispairedPrivateKey(){const s="MISPAIRED_PRIVATE_KEY",i=`[${s}] private key's derived public key (${e(this.publicKey)}) does not match the existing public key (${e(this.publicKeyExisting)})`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}missingDirectory(){const s="MISSING_DIRECTORY",i=`[${s}] missing directory (${this.directory})`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}missingEnvFile(){const s="MISSING_ENV_FILE",i=this.envFilepath||".env",n=`[${s}] missing file (${i})`,o=`fix: [${r[s]}]`,m=new Error(n);return m.code=s,m.help=o,m.messageWithHelp=`${n}. ${o}`,m}missingEnvKeysFile(){const s="MISSING_ENV_KEYS_FILE",i=this.envKeysFilepath||".env.keys",n=`[${s}] missing file (${i})`,o=`fix: [${r[s]}]`,m=new Error(n);return m.code=s,m.help=o,m.messageWithHelp=`${n}. ${o}`,m}missingEnvFiles(){const s="MISSING_ENV_FILES",i=`[${s}] no .env* files found`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}missingKey(){const s="MISSING_KEY",i=`[${s}] missing key (${this.key})`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}missingLogLevel(){const s="MISSING_LOG_LEVEL",i=`[${s}] missing log level '${this.level}'. implement in logger`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}missingPrivateKey(){const s="MISSING_PRIVATE_KEY",i=`[${s}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}precommitHookModifyFailed(){const s="PRECOMMIT_HOOK_MODIFY_FAILED",i=`[${s}] failed to modify pre-commit hook: ${this.error.message}`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}wrongPrivateKey(){const s="WRONG_PRIVATE_KEY",i=`[${s}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}}return f.ISSUE_BY_CODE=r,pt=f,pt}var vt,Ar;function Eo(){if(Ar)return vt;Ar=1;const{WriteStream:e}=ro;return vt={getColorDepth:()=>{try{return e.prototype.getColorDepth()}catch{const c=process.env.TERM;return c&&(c.includes("256color")||c.includes("xterm"))?8:4}}},vt}var mt,Br;function Rr(){if(Br)return mt;Br=1;const e=Eo(),r=Pe(),f=new Map([["amber",33],["blue",34],["gray",37],["green",32],["olive",33],["orangered",33],["plum",35],["red",31],["electricblue",36],["dodgerblue",36]]),c=new Map([["amber",136],["blue",21],["gray",244],["green",34],["olive",142],["orangered",130],["plum",182],["red",124],["electricblue",45],["dodgerblue",33]]),s=new Map([["amber",[236,213,63]],["orangered",[138,90,43]],["red",[140,35,50]]]);function i(o){const m=e.getColorDepth();if(!c.has(o))throw new r({color:o}).invalidColor();if(m>=24&&s.has(o)){const[w,O,N]=s.get(o);return F=>`\x1B[38;2;${w};${O};${N}m${F}\x1B[39m`}if(m>=8){const w=c.get(o);return O=>`\x1B[38;5;${w}m${O}\x1B[39m`}if(m>=4){const w=f.get(o);return O=>`\x1B[${w}m${O}\x1B[39m`}return w=>w}function n(o){return e.getColorDepth()>=4?`\x1B[1m${o}\x1B[22m`:o}return mt={getColor:i,bold:n},mt}var gt,Ir;function Or(){if(Ir)return gt;Ir=1;const e=go(),r=Pe(),{getColor:f,bold:c}=Rr(),s={error:0,warn:1,success:2,successv:2,info:2,help:2,verbose:4,debug:5,silly:6},i=E=>c(f("red")(`\u2620 ${E}`)),n=E=>f("orangered")(`\u26A0 ${E}`),o=f("amber"),m=E=>f("amber")(`\u27D0 ${E}`),w=f("gray"),O=f("dodgerblue"),N=E=>f("plum")(`\u2506 ${E}`),F=E=>f("plum")(`\u2506 ${E}`);let L=s.info,y="dotenvx",g=e.version;function A(E,V){const R=T(E,V);console.error(R)}function q(E,V){if(s[E]===void 0)throw new r({level:E}).missingLogLevel();if(s[E]<=L){const R=T(E,V);console.log(R)}}function T(E,V){const R=typeof V=="object"?JSON.stringify(V):V;switch(E.toLowerCase()){case"error":return i(R);case"warn":return n(R);case"success":return o(R);case"successv":return m(`${R} \xB7 ${y}@${g}`);case"info":return w(R);case"help":return O(R);case"verbose":return N(R);case"debug":return F(R)}}const C={level:"info",error:E=>A("error",E),warn:E=>q("warn",E),success:E=>q("success",E),successv:E=>q("successv",E),info:E=>q("info",E),help:E=>q("help",E),verbose:E=>q("verbose",E),debug:E=>q("debug",E),setLevel:E=>{s[E]!==void 0&&(L=s[E],C.level=E)},setName:E=>{y=E,C.name=E},setVersion:E=>{g=E,C.version=E}};function _(E){const V=E.debug?"debug":E.verbose?"verbose":E.quiet?"error":E.logLevel;V&&(C.setLevel(V),(!E.quiet||E.quiet&&V!=="error")&&C.debug(`setting log level to: ${V}`))}function h(E){const V=E.logName;V&&C.setName(V)}function B(E){const V=E.logVersion;V&&C.setVersion(V)}return gt={logger:C,getColor:f,setLogLevel:_,setLogName:h,setLogVersion:B,levels:s},gt}var bt={},Et={},_t,Kr;function it(){if(Kr)return _t;Kr=1;const e="\\\\/",r=`[^${e}]`,f=0,c="\\.",s="\\+",i="\\?",n="\\/",o="(?=.)",m="[^/]",w=`(?:${n}|$)`,O=`(?:^|${n})`,N=`${c}{1,2}${w}`,F=`(?!${c})`,L=`(?!${O}${N})`,y=`(?!${c}{0,1}${w})`,g=`(?!${N})`,A=`[^.${n}]`,q=`${m}*?`,C={DOT_LITERAL:c,PLUS_LITERAL:s,QMARK_LITERAL:i,SLASH_LITERAL:n,ONE_CHAR:o,QMARK:m,END_ANCHOR:w,DOTS_SLASH:N,NO_DOT:F,NO_DOTS:L,NO_DOT_SLASH:y,NO_DOTS_SLASH:g,QMARK_NO_DOT:A,STAR:q,START_ANCHOR:O,SEP:"/"},_={...C,SLASH_LITERAL:`[${e}]`,QMARK:r,STAR:`${r}*?`,DOTS_SLASH:`${c}{1,2}(?:[${e}]|$)`,NO_DOT:`(?!${c})`,NO_DOTS:`(?!(?:^|[${e}])${c}{1,2}(?:[${e}]|$))`,NO_DOT_SLASH:`(?!${c}{0,1}(?:[${e}]|$))`,NO_DOTS_SLASH:`(?!${c}{1,2}(?:[${e}]|$))`,QMARK_NO_DOT:`[^.${e}]`,START_ANCHOR:`(?:^|[${e}])`,END_ANCHOR:`(?:[${e}]|$)`,SEP:"\\"},h={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return _t={DEFAULT_MAX_EXTGLOB_RECURSION:f,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:h,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(B){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${B.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(B){return B===!0?_:C}},_t}var Cr;function ot(){return Cr||(Cr=1,(function(e){const{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:f,REGEX_SPECIAL_CHARS:c,REGEX_SPECIAL_CHARS_GLOBAL:s}=it();e.isObject=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),e.hasRegexChars=i=>c.test(i),e.isRegexChar=i=>i.length===1&&e.hasRegexChars(i),e.escapeRegex=i=>i.replace(s,"\\$1"),e.toPosixSlashes=i=>i.replace(r,"/"),e.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const i=navigator.platform.toLowerCase();return i==="win32"||i==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1},e.removeBackslashes=i=>i.replace(f,n=>n==="\\"?"":n),e.escapeLast=(i,n,o)=>{const m=i.lastIndexOf(n,o);return m===-1?i:i[m-1]==="\\"?e.escapeLast(i,n,m-1):`${i.slice(0,m)}\\${i.slice(m)}`},e.removePrefix=(i,n={})=>{let o=i;return o.startsWith("./")&&(o=o.slice(2),n.prefix="./"),o},e.wrapOutput=(i,n={},o={})=>{const m=o.contains?"":"^",w=o.contains?"":"$";let O=`${m}(?:${i})${w}`;return n.negated===!0&&(O=`(?:^(?!${O}).*$)`),O},e.basename=(i,{windows:n}={})=>{const o=i.split(n?/[\\/]/:"/"),m=o[o.length-1];return m===""?o[o.length-2]:m}})(Et)),Et}var wt,Hr;function _o(){if(Hr)return wt;Hr=1;const e=ot(),{CHAR_ASTERISK:r,CHAR_AT:f,CHAR_BACKWARD_SLASH:c,CHAR_COMMA:s,CHAR_DOT:i,CHAR_EXCLAMATION_MARK:n,CHAR_FORWARD_SLASH:o,CHAR_LEFT_CURLY_BRACE:m,CHAR_LEFT_PARENTHESES:w,CHAR_LEFT_SQUARE_BRACKET:O,CHAR_PLUS:N,CHAR_QUESTION_MARK:F,CHAR_RIGHT_CURLY_BRACE:L,CHAR_RIGHT_PARENTHESES:y,CHAR_RIGHT_SQUARE_BRACKET:g}=it(),A=C=>C===o||C===c,q=C=>{C.isPrefix!==!0&&(C.depth=C.isGlobstar?1/0:1)};return wt=(C,_)=>{const h=_||{},B=C.length-1,E=h.parts===!0||h.scanToEnd===!0,V=[],R=[],k=[];let U=C,Z=-1,G=0,$=0,a=!1,H=!1,l=!1,u=!1,p=!1,K=!1,t=!1,v=!1,S=!1,x=!1,D=0,J,W,d={value:"",depth:0,isGlob:!1};const M=()=>Z>=B,z=()=>U.charCodeAt(Z+1),ee=()=>(J=W,U.charCodeAt(++Z));for(;Z<B;){W=ee();let ue;if(W===c){t=d.backslashes=!0,W=ee(),W===m&&(K=!0);continue}if(K===!0||W===m){for(D++;M()!==!0&&(W=ee());){if(W===c){t=d.backslashes=!0,ee();continue}if(W===m){D++;continue}if(K!==!0&&W===i&&(W=ee())===i){if(a=d.isBrace=!0,l=d.isGlob=!0,x=!0,E===!0)continue;break}if(K!==!0&&W===s){if(a=d.isBrace=!0,l=d.isGlob=!0,x=!0,E===!0)continue;break}if(W===L&&(D--,D===0)){K=!1,a=d.isBrace=!0,x=!0;break}}if(E===!0)continue;break}if(W===o){if(V.push(Z),R.push(d),d={value:"",depth:0,isGlob:!1},x===!0)continue;if(J===i&&Z===G+1){G+=2;continue}$=Z+1;continue}if(h.noext!==!0&&(W===N||W===f||W===r||W===F||W===n)===!0&&z()===w){if(l=d.isGlob=!0,u=d.isExtglob=!0,x=!0,W===n&&Z===G&&(S=!0),E===!0){for(;M()!==!0&&(W=ee());){if(W===c){t=d.backslashes=!0,W=ee();continue}if(W===y){l=d.isGlob=!0,x=!0;break}}continue}break}if(W===r){if(J===r&&(p=d.isGlobstar=!0),l=d.isGlob=!0,x=!0,E===!0)continue;break}if(W===F){if(l=d.isGlob=!0,x=!0,E===!0)continue;break}if(W===O){for(;M()!==!0&&(ue=ee());){if(ue===c){t=d.backslashes=!0,ee();continue}if(ue===g){H=d.isBracket=!0,l=d.isGlob=!0,x=!0;break}}if(E===!0)continue;break}if(h.nonegate!==!0&&W===n&&Z===G){v=d.negated=!0,G++;continue}if(h.noparen!==!0&&W===w){if(l=d.isGlob=!0,E===!0){for(;M()!==!0&&(W=ee());){if(W===w){t=d.backslashes=!0,W=ee();continue}if(W===y){x=!0;break}}continue}break}if(l===!0){if(x=!0,E===!0)continue;break}}h.noext===!0&&(u=!1,l=!1);let P=U,b="",X="";G>0&&(b=U.slice(0,G),U=U.slice(G),$-=G),P&&l===!0&&$>0?(P=U.slice(0,$),X=U.slice($)):l===!0?(P="",X=U):P=U,P&&P!==""&&P!=="/"&&P!==U&&A(P.charCodeAt(P.length-1))&&(P=P.slice(0,-1)),h.unescape===!0&&(X&&(X=e.removeBackslashes(X)),P&&t===!0&&(P=e.removeBackslashes(P)));const se={prefix:b,input:C,start:G,base:P,glob:X,isBrace:a,isBracket:H,isGlob:l,isExtglob:u,isGlobstar:p,negated:v,negatedExtglob:S};if(h.tokens===!0&&(se.maxDepth=0,A(W)||R.push(d),se.tokens=R),h.parts===!0||h.tokens===!0){let ue;for(let he=0;he<V.length;he++){const pe=ue?ue+1:G,ge=V[he],ye=C.slice(pe,ge);h.tokens&&(he===0&&G!==0?(R[he].isPrefix=!0,R[he].value=b):R[he].value=ye,q(R[he]),se.maxDepth+=R[he].depth),(he!==0||ye!=="")&&k.push(ye),ue=ge}if(ue&&ue+1<C.length){const he=C.slice(ue+1);k.push(he),h.tokens&&(R[R.length-1].value=he,q(R[R.length-1]),se.maxDepth+=R[R.length-1].depth)}se.slashes=V,se.parts=k}return se},wt}var St,Pr;function wo(){if(Pr)return St;Pr=1;const e=it(),r=ot(),{MAX_LENGTH:f,POSIX_REGEX_SOURCE:c,REGEX_NON_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_BACKREF:i,REPLACEMENTS:n}=e,o=(T,C)=>{if(typeof C.expandRange=="function")return C.expandRange(...T,C);T.sort();const _=`[${T.join("-")}]`;try{new RegExp(_)}catch{return T.map(B=>r.escapeRegex(B)).join("..")}return _},m=(T,C)=>`Missing ${T}: "${C}" - use "\\\\${C}" to match literal characters`,w=T=>{const C=[];let _=0,h=0,B=0,E="",V=!1;for(const R of T){if(V===!0){E+=R,V=!1;continue}if(R==="\\"){E+=R,V=!0;continue}if(R==='"'){B=B===1?0:1,E+=R;continue}if(B===0){if(R==="[")_++;else if(R==="]"&&_>0)_--;else if(_===0){if(R==="(")h++;else if(R===")"&&h>0)h--;else if(R==="|"&&h===0){C.push(E),E="";continue}}}E+=R}return C.push(E),C},O=T=>{let C=!1;for(const _ of T){if(C===!0){C=!1;continue}if(_==="\\"){C=!0;continue}if(/[?*+@!()[\]{}]/.test(_))return!1}return!0},N=T=>{let C=T.trim(),_=!0;for(;_===!0;)_=!1,/^@\([^\\()[\]{}|]+\)$/.test(C)&&(C=C.slice(2,-1),_=!0);if(O(C))return C.replace(/\\(.)/g,"$1")},F=T=>{const C=T.map(N).filter(Boolean);for(let _=0;_<C.length;_++)for(let h=_+1;h<C.length;h++){const B=C[_],E=C[h],V=B[0];if(!(!V||B!==V.repeat(B.length)||E!==V.repeat(E.length))&&(B===E||B.startsWith(E)||E.startsWith(B)))return!0}return!1},L=(T,C=!0)=>{if(T[0]!=="+"&&T[0]!=="*"||T[1]!=="(")return;let _=0,h=0,B=0,E=!1;for(let V=1;V<T.length;V++){const R=T[V];if(E===!0){E=!1;continue}if(R==="\\"){E=!0;continue}if(R==='"'){B=B===1?0:1;continue}if(B!==1){if(R==="["){_++;continue}if(R==="]"&&_>0){_--;continue}if(!(_>0)){if(R==="("){h++;continue}if(R===")"&&(h--,h===0))return C===!0&&V!==T.length-1?void 0:{type:T[0],body:T.slice(2,V),end:V}}}}},y=T=>{let C=0;const _=[];for(;C<T.length;){const B=L(T.slice(C),!1);if(!B||B.type!=="*")return;const E=w(B.body).map(R=>R.trim());if(E.length!==1)return;const V=N(E[0]);if(!V||V.length!==1)return;_.push(V),C+=B.end+1}return _.length<1?void 0:`${_.length===1?r.escapeRegex(_[0]):`[${_.map(B=>r.escapeRegex(B)).join("")}]`}*`},g=T=>{let C=0,_=T.trim(),h=L(_);for(;h;)C++,_=h.body.trim(),h=L(_);return C},A=(T,C)=>{if(C.maxExtglobRecursion===!1)return{risky:!1};const _=typeof C.maxExtglobRecursion=="number"?C.maxExtglobRecursion:e.DEFAULT_MAX_EXTGLOB_RECURSION,h=w(T).map(B=>B.trim());if(h.length>1&&(h.some(B=>B==="")||h.some(B=>/^[*?]+$/.test(B))||F(h)))return{risky:!0};for(const B of h){const E=y(B);if(E)return{risky:!0,safeOutput:E};if(g(B)>_)return{risky:!0}}return{risky:!1}},q=(T,C)=>{if(typeof T!="string")throw new TypeError("Expected a string");T=n[T]||T;const _={...C},h=typeof _.maxLength=="number"?Math.min(f,_.maxLength):f;let B=T.length;if(B>h)throw new SyntaxError(`Input length: ${B}, exceeds maximum allowed length: ${h}`);const E={type:"bos",value:"",output:_.prepend||""},V=[E],R=_.capture?"":"?:",k=e.globChars(_.windows),U=e.extglobChars(k),{DOT_LITERAL:Z,PLUS_LITERAL:G,SLASH_LITERAL:$,ONE_CHAR:a,DOTS_SLASH:H,NO_DOT:l,NO_DOT_SLASH:u,NO_DOTS_SLASH:p,QMARK:K,QMARK_NO_DOT:t,STAR:v,START_ANCHOR:S}=k,x=j=>`(${R}(?:(?!${S}${j.dot?H:Z}).)*?)`,D=_.dot?"":l,J=_.dot?K:t;let W=_.bash===!0?x(_):v;_.capture&&(W=`(${W})`),typeof _.noext=="boolean"&&(_.noextglob=_.noext);const d={input:T,index:-1,start:0,dot:_.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:V};T=r.removePrefix(T,d),B=T.length;const M=[],z=[],ee=[];let P=E,b;const X=()=>d.index===B-1,se=d.peek=(j=1)=>T[d.index+j],ue=d.advance=()=>T[++d.index]||"",he=()=>T.slice(d.index+1),pe=(j="",ie=0)=>{d.consumed+=j,d.index+=ie},ge=j=>{d.output+=j.output!=null?j.output:j.value,pe(j.value)},ye=()=>{let j=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)ue(),d.start++,j++;return j%2===0?!1:(d.negated=!0,d.start++,!0)},Se=j=>{d[j]++,ee.push(j)},_e=j=>{d[j]--,ee.pop()},ae=j=>{if(P.type==="globstar"){const ie=d.braces>0&&(j.type==="comma"||j.type==="brace"),Q=j.extglob===!0||M.length&&(j.type==="pipe"||j.type==="paren");j.type!=="slash"&&j.type!=="paren"&&!ie&&!Q&&(d.output=d.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=W,d.output+=P.output)}if(M.length&&j.type!=="paren"&&(M[M.length-1].inner+=j.value),(j.value||j.output)&&ge(j),P&&P.type==="text"&&j.type==="text"){P.output=(P.output||P.value)+j.value,P.value+=j.value;return}j.prev=P,V.push(j),P=j},ne=(j,ie)=>{const Q={...U[ie],conditions:1,inner:""};Q.prev=P,Q.parens=d.parens,Q.output=d.output,Q.startIndex=d.index,Q.tokensIndex=V.length;const ce=(_.capture?"(":"")+Q.open;Se("parens"),ae({type:j,value:ie,output:d.output?"":a}),ae({type:"paren",extglob:!0,value:ue(),output:ce}),M.push(Q)},te=j=>{const ie=T.slice(j.startIndex,d.index+1),Q=T.slice(j.startIndex+2,d.index),ce=A(Q,_);if((j.type==="plus"||j.type==="star")&&ce.risky){const I=ce.safeOutput?(j.output?"":a)+(_.capture?`(${ce.safeOutput})`:ce.safeOutput):void 0,Y=V[j.tokensIndex];Y.type="text",Y.value=ie,Y.output=I||r.escapeRegex(ie);for(let re=j.tokensIndex+1;re<V.length;re++)V[re].value="",V[re].output="",delete V[re].suffix;d.output=j.output+Y.output,d.backtrack=!0,ae({type:"paren",extglob:!0,value:b,output:""}),_e("parens");return}let le=j.close+(_.capture?")":""),de;if(j.type==="negate"){let I=W;if(j.inner&&j.inner.length>1&&j.inner.includes("/")&&(I=x(_)),(I!==W||X()||/^\)+$/.test(he()))&&(le=j.close=`)$))${I}`),j.inner.includes("*")&&(de=he())&&/^\.[^\\/.]+$/.test(de)){const Y=q(de,{...C,fastpaths:!1}).output;le=j.close=`)${Y})${I})`}j.prev.type==="bos"&&(d.negatedExtglob=!0)}ae({type:"paren",extglob:!0,value:b,output:le}),_e("parens")};if(_.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(T)){let j=!1,ie=T.replace(i,(Q,ce,le,de,I,Y)=>de==="\\"?(j=!0,Q):de==="?"?ce?ce+de+(I?K.repeat(I.length):""):Y===0?J+(I?K.repeat(I.length):""):K.repeat(le.length):de==="."?Z.repeat(le.length):de==="*"?ce?ce+de+(I?W:""):W:ce?Q:`\\${Q}`);return j===!0&&(_.unescape===!0?ie=ie.replace(/\\/g,""):ie=ie.replace(/\\+/g,Q=>Q.length%2===0?"\\\\":Q?"\\":"")),ie===T&&_.contains===!0?(d.output=T,d):(d.output=r.wrapOutput(ie,d,C),d)}for(;!X();){if(b=ue(),b==="\0")continue;if(b==="\\"){const Q=se();if(Q==="/"&&_.bash!==!0||Q==="."||Q===";")continue;if(!Q){b+="\\",ae({type:"text",value:b});continue}const ce=/^\\+/.exec(he());let le=0;if(ce&&ce[0].length>2&&(le=ce[0].length,d.index+=le,le%2!==0&&(b+="\\")),_.unescape===!0?b=ue():b+=ue(),d.brackets===0){ae({type:"text",value:b});continue}}if(d.brackets>0&&(b!=="]"||P.value==="["||P.value==="[^")){if(_.posix!==!1&&b===":"){const Q=P.value.slice(1);if(Q.includes("[")&&(P.posix=!0,Q.includes(":"))){const ce=P.value.lastIndexOf("["),le=P.value.slice(0,ce),de=P.value.slice(ce+2),I=c[de];if(I){P.value=le+I,d.backtrack=!0,ue(),!E.output&&V.indexOf(P)===1&&(E.output=a);continue}}}(b==="["&&se()!==":"||b==="-"&&se()==="]")&&(b=`\\${b}`),b==="]"&&(P.value==="["||P.value==="[^")&&(b=`\\${b}`),_.posix===!0&&b==="!"&&P.value==="["&&(b="^"),P.value+=b,ge({value:b});continue}if(d.quotes===1&&b!=='"'){b=r.escapeRegex(b),P.value+=b,ge({value:b});continue}if(b==='"'){d.quotes=d.quotes===1?0:1,_.keepQuotes===!0&&ae({type:"text",value:b});continue}if(b==="("){Se("parens"),ae({type:"paren",value:b});continue}if(b===")"){if(d.parens===0&&_.strictBrackets===!0)throw new SyntaxError(m("opening","("));const Q=M[M.length-1];if(Q&&d.parens===Q.parens+1){te(M.pop());continue}ae({type:"paren",value:b,output:d.parens?")":"\\)"}),_e("parens");continue}if(b==="["){if(_.nobracket===!0||!he().includes("]")){if(_.nobracket!==!0&&_.strictBrackets===!0)throw new SyntaxError(m("closing","]"));b=`\\${b}`}else Se("brackets");ae({type:"bracket",value:b});continue}if(b==="]"){if(_.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){ae({type:"text",value:b,output:`\\${b}`});continue}if(d.brackets===0){if(_.strictBrackets===!0)throw new SyntaxError(m("opening","["));ae({type:"text",value:b,output:`\\${b}`});continue}_e("brackets");const Q=P.value.slice(1);if(P.posix!==!0&&Q[0]==="^"&&!Q.includes("/")&&(b=`/${b}`),P.value+=b,ge({value:b}),_.literalBrackets===!1||r.hasRegexChars(Q))continue;const ce=r.escapeRegex(P.value);if(d.output=d.output.slice(0,-P.value.length),_.literalBrackets===!0){d.output+=ce,P.value=ce;continue}P.value=`(${R}${ce}|${P.value})`,d.output+=P.value;continue}if(b==="{"&&_.nobrace!==!0){Se("braces");const Q={type:"brace",value:b,output:"(",outputIndex:d.output.length,tokensIndex:d.tokens.length};z.push(Q),ae(Q);continue}if(b==="}"){const Q=z[z.length-1];if(_.nobrace===!0||!Q){ae({type:"text",value:b,output:b});continue}let ce=")";if(Q.dots===!0){const le=V.slice(),de=[];for(let I=le.length-1;I>=0&&(V.pop(),le[I].type!=="brace");I--)le[I].type!=="dots"&&de.unshift(le[I].value);ce=o(de,_),d.backtrack=!0}if(Q.comma!==!0&&Q.dots!==!0){const le=d.output.slice(0,Q.outputIndex),de=d.tokens.slice(Q.tokensIndex);Q.value=Q.output="\\{",b=ce="\\}",d.output=le;for(const I of de)d.output+=I.output||I.value}ae({type:"brace",value:b,output:ce}),_e("braces"),z.pop();continue}if(b==="|"){M.length>0&&M[M.length-1].conditions++,ae({type:"text",value:b});continue}if(b===","){let Q=b;const ce=z[z.length-1];ce&&ee[ee.length-1]==="braces"&&(ce.comma=!0,Q="|"),ae({type:"comma",value:b,output:Q});continue}if(b==="/"){if(P.type==="dot"&&d.index===d.start+1){d.start=d.index+1,d.consumed="",d.output="",V.pop(),P=E;continue}ae({type:"slash",value:b,output:$});continue}if(b==="."){if(d.braces>0&&P.type==="dot"){P.value==="."&&(P.output=Z);const Q=z[z.length-1];P.type="dots",P.output+=b,P.value+=b,Q.dots=!0;continue}if(d.braces+d.parens===0&&P.type!=="bos"&&P.type!=="slash"){ae({type:"text",value:b,output:Z});continue}ae({type:"dot",value:b,output:Z});continue}if(b==="?"){if(!(P&&P.value==="(")&&_.noextglob!==!0&&se()==="("&&se(2)!=="?"){ne("qmark",b);continue}if(P&&P.type==="paren"){const ce=se();let le=b;(P.value==="("&&!/[!=<:]/.test(ce)||ce==="<"&&!/<([!=]|\w+>)/.test(he()))&&(le=`\\${b}`),ae({type:"text",value:b,output:le});continue}if(_.dot!==!0&&(P.type==="slash"||P.type==="bos")){ae({type:"qmark",value:b,output:t});continue}ae({type:"qmark",value:b,output:K});continue}if(b==="!"){if(_.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){ne("negate",b);continue}if(_.nonegate!==!0&&d.index===0){ye();continue}}if(b==="+"){if(_.noextglob!==!0&&se()==="("&&se(2)!=="?"){ne("plus",b);continue}if(P&&P.value==="("||_.regex===!1){ae({type:"plus",value:b,output:G});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||d.parens>0){ae({type:"plus",value:b});continue}ae({type:"plus",value:G});continue}if(b==="@"){if(_.noextglob!==!0&&se()==="("&&se(2)!=="?"){ae({type:"at",extglob:!0,value:b,output:""});continue}ae({type:"text",value:b});continue}if(b!=="*"){(b==="$"||b==="^")&&(b=`\\${b}`);const Q=s.exec(he());Q&&(b+=Q[0],d.index+=Q[0].length),ae({type:"text",value:b});continue}if(P&&(P.type==="globstar"||P.star===!0)){P.type="star",P.star=!0,P.value+=b,P.output=W,d.backtrack=!0,d.globstar=!0,pe(b);continue}let j=he();if(_.noextglob!==!0&&/^\([^?]/.test(j)){ne("star",b);continue}if(P.type==="star"){if(_.noglobstar===!0){pe(b);continue}const Q=P.prev,ce=Q.prev,le=Q.type==="slash"||Q.type==="bos",de=ce&&(ce.type==="star"||ce.type==="globstar");if(_.bash===!0&&(!le||j[0]&&j[0]!=="/")){ae({type:"star",value:b,output:""});continue}const I=d.braces>0&&(Q.type==="comma"||Q.type==="brace"),Y=M.length&&(Q.type==="pipe"||Q.type==="paren");if(!le&&Q.type!=="paren"&&!I&&!Y){ae({type:"star",value:b,output:""});continue}for(;j.slice(0,3)==="/**";){const re=T[d.index+4];if(re&&re!=="/")break;j=j.slice(3),pe("/**",3)}if(Q.type==="bos"&&X()){P.type="globstar",P.value+=b,P.output=x(_),d.output=P.output,d.globstar=!0,pe(b);continue}if(Q.type==="slash"&&Q.prev.type!=="bos"&&!de&&X()){d.output=d.output.slice(0,-(Q.output+P.output).length),Q.output=`(?:${Q.output}`,P.type="globstar",P.output=x(_)+(_.strictSlashes?")":"|$)"),P.value+=b,d.globstar=!0,d.output+=Q.output+P.output,pe(b);continue}if(Q.type==="slash"&&Q.prev.type!=="bos"&&j[0]==="/"){const re=j[1]!==void 0?"|$":"";d.output=d.output.slice(0,-(Q.output+P.output).length),Q.output=`(?:${Q.output}`,P.type="globstar",P.output=`${x(_)}${$}|${$}${re})`,P.value+=b,d.output+=Q.output+P.output,d.globstar=!0,pe(b+ue()),ae({type:"slash",value:"/",output:""});continue}if(Q.type==="bos"&&j[0]==="/"){P.type="globstar",P.value+=b,P.output=`(?:^|${$}|${x(_)}${$})`,d.output=P.output,d.globstar=!0,pe(b+ue()),ae({type:"slash",value:"/",output:""});continue}d.output=d.output.slice(0,-P.output.length),P.type="globstar",P.output=x(_),P.value+=b,d.output+=P.output,d.globstar=!0,pe(b);continue}const ie={type:"star",value:b,output:W};if(_.bash===!0){ie.output=".*?",(P.type==="bos"||P.type==="slash")&&(ie.output=D+ie.output),ae(ie);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&_.regex===!0){ie.output=b,ae(ie);continue}(d.index===d.start||P.type==="slash"||P.type==="dot")&&(P.type==="dot"?(d.output+=u,P.output+=u):_.dot===!0?(d.output+=p,P.output+=p):(d.output+=D,P.output+=D),se()!=="*"&&(d.output+=a,P.output+=a)),ae(ie)}for(;d.brackets>0;){if(_.strictBrackets===!0)throw new SyntaxError(m("closing","]"));d.output=r.escapeLast(d.output,"["),_e("brackets")}for(;d.parens>0;){if(_.strictBrackets===!0)throw new SyntaxError(m("closing",")"));d.output=r.escapeLast(d.output,"("),_e("parens")}for(;d.braces>0;){if(_.strictBrackets===!0)throw new SyntaxError(m("closing","}"));d.output=r.escapeLast(d.output,"{"),_e("braces")}if(_.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&ae({type:"maybe_slash",value:"",output:`${$}?`}),d.backtrack===!0){d.output="";for(const j of d.tokens)d.output+=j.output!=null?j.output:j.value,j.suffix&&(d.output+=j.suffix)}return d};return q.fastpaths=(T,C)=>{const _={...C},h=typeof _.maxLength=="number"?Math.min(f,_.maxLength):f,B=T.length;if(B>h)throw new SyntaxError(`Input length: ${B}, exceeds maximum allowed length: ${h}`);T=n[T]||T;const{DOT_LITERAL:E,SLASH_LITERAL:V,ONE_CHAR:R,DOTS_SLASH:k,NO_DOT:U,NO_DOTS:Z,NO_DOTS_SLASH:G,STAR:$,START_ANCHOR:a}=e.globChars(_.windows),H=_.dot?Z:U,l=_.dot?G:U,u=_.capture?"":"?:",p={negated:!1,prefix:""};let K=_.bash===!0?".*?":$;_.capture&&(K=`(${K})`);const t=D=>D.noglobstar===!0?K:`(${u}(?:(?!${a}${D.dot?k:E}).)*?)`,v=D=>{switch(D){case"*":return`${H}${R}${K}`;case".*":return`${E}${R}${K}`;case"*.*":return`${H}${K}${E}${R}${K}`;case"*/*":return`${H}${K}${V}${R}${l}${K}`;case"**":return H+t(_);case"**/*":return`(?:${H}${t(_)}${V})?${l}${R}${K}`;case"**/*.*":return`(?:${H}${t(_)}${V})?${l}${K}${E}${R}${K}`;case"**/.*":return`(?:${H}${t(_)}${V})?${E}${R}${K}`;default:{const J=/^(.*?)\.(\w+)$/.exec(D);if(!J)return;const W=v(J[1]);return W?W+E+J[2]:void 0}}},S=r.removePrefix(T,p);let x=v(S);return x&&_.strictSlashes!==!0&&(x+=`${V}?`),x},St=q,St}var xt,Tr;function So(){if(Tr)return xt;Tr=1;const e=_o(),r=wo(),f=ot(),c=it(),s=n=>n&&typeof n=="object"&&!Array.isArray(n),i=(n,o,m=!1)=>{if(Array.isArray(n)){const A=n.map(T=>i(T,o,m));return T=>{for(const C of A){const _=C(T);if(_)return _}return!1}}const w=s(n)&&n.tokens&&n.input;if(n===""||typeof n!="string"&&!w)throw new TypeError("Expected pattern to be a non-empty string");const O=o||{},N=O.windows,F=w?i.compileRe(n,o):i.makeRe(n,o,!1,!0),L=F.state;delete F.state;let y=()=>!1;if(O.ignore){const A={...o,ignore:null,onMatch:null,onResult:null};y=i(O.ignore,A,m)}const g=(A,q=!1)=>{const{isMatch:T,match:C,output:_}=i.test(A,F,o,{glob:n,posix:N}),h={glob:n,state:L,regex:F,posix:N,input:A,output:_,match:C,isMatch:T};return typeof O.onResult=="function"&&O.onResult(h),T===!1?(h.isMatch=!1,q?h:!1):y(A)?(typeof O.onIgnore=="function"&&O.onIgnore(h),h.isMatch=!1,q?h:!1):(typeof O.onMatch=="function"&&O.onMatch(h),q?h:!0)};return m&&(g.state=L),g};return i.test=(n,o,m,{glob:w,posix:O}={})=>{if(typeof n!="string")throw new TypeError("Expected input to be a string");if(n==="")return{isMatch:!1,output:""};const N=m||{},F=N.format||(O?f.toPosixSlashes:null);let L=n===w,y=L&&F?F(n):n;return L===!1&&(y=F?F(n):n,L=y===w),(L===!1||N.capture===!0)&&(N.matchBase===!0||N.basename===!0?L=i.matchBase(n,o,m,O):L=o.exec(y)),{isMatch:!!L,match:L,output:y}},i.matchBase=(n,o,m)=>(o instanceof RegExp?o:i.makeRe(o,m)).test(f.basename(n)),i.isMatch=(n,o,m)=>i(o,m)(n),i.parse=(n,o)=>Array.isArray(n)?n.map(m=>i.parse(m,o)):r(n,{...o,fastpaths:!1}),i.scan=(n,o)=>e(n,o),i.compileRe=(n,o,m=!1,w=!1)=>{if(m===!0)return n.output;const O=o||{},N=O.contains?"":"^",F=O.contains?"":"$";let L=`${N}(?:${n.output})${F}`;n&&n.negated===!0&&(L=`^(?!${L}).*$`);const y=i.toRegex(L,o);return w===!0&&(y.state=n),y},i.makeRe=(n,o={},m=!1,w=!1)=>{if(!n||typeof n!="string")throw new TypeError("Expected a non-empty string");let O={negated:!1,fastpaths:!0};return o.fastpaths!==!1&&(n[0]==="."||n[0]==="*")&&(O.output=r.fastpaths(n,o)),O.output||(O=r(n,o)),i.compileRe(O,o,m,w)},i.toRegex=(n,o)=>{try{const m=o||{};return new RegExp(n,m.flags||(m.nocase?"i":""))}catch(m){if(o&&o.debug===!0)throw m;return/$^/}},i.constants=c,xt=i,xt}var At,Nr;function Lr(){if(Nr)return At;Nr=1;const e=So(),r=ot();function f(c,s,i=!1){return s&&(s.windows===null||s.windows===void 0)&&(s={...s,windows:r.isWindows()}),e(c,s,i)}return Object.assign(f,e),At=f,At}var qr;function xo(){if(qr)return bt;qr=1;var e=Object.create,r=Object.defineProperty,f=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,s=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,n=(I,Y,re,oe)=>{if(Y&&typeof Y=="object"||typeof Y=="function")for(var fe=c(Y),ve=0,be=fe.length,Ee;ve<be;ve++)Ee=fe[ve],!i.call(I,Ee)&&Ee!==re&&r(I,Ee,{get:(we=>Y[we]).bind(null,Ee),enumerable:!(oe=f(Y,Ee))||oe.enumerable});return I},o=(I,Y,re)=>(re=I!=null?e(s(I)):{},n(!I||!I.__esModule?r(re,"default",{value:I,enumerable:!0}):re,I));const m=o(Re),w=o(Fe);function O(I){let Y=(0,m.normalize)(I);return Y.length>1&&Y[Y.length-1]===m.sep&&(Y=Y.substring(0,Y.length-1)),Y}const N=/[\\/]/g;function F(I,Y){return I.replace(N,Y)}const L=/^[a-z]:[\\/]$/i;function y(I){return I==="/"||L.test(I)}function g(I,Y){const{resolvePaths:re,normalizePath:oe,pathSeparator:fe}=Y,ve=process.platform==="win32"&&I.includes("/")||I.startsWith(".");if(re&&(I=(0,m.resolve)(I)),(oe||ve)&&(I=O(I)),I===".")return"";const be=I[I.length-1]!==fe;return F(be?I+fe:I,fe)}function A(I,Y){return Y+I}function q(I,Y){return function(re,oe){return oe.startsWith(I)?oe.slice(I.length)+re:F((0,m.relative)(I,oe),Y.pathSeparator)+Y.pathSeparator+re}}function T(I){return I}function C(I,Y,re){return Y+I+re}function _(I,Y){const{relativePaths:re,includeBasePath:oe}=Y;return re&&I?q(I,Y):oe?A:T}function h(I){return function(Y,re){re.push(Y.substring(I.length)||".")}}function B(I){return function(Y,re,oe){const fe=Y.substring(I.length)||".";oe.every(ve=>ve(fe,!0))&&re.push(fe)}}const E=(I,Y)=>{Y.push(I||".")},V=(I,Y,re)=>{const oe=I||".";re.every(fe=>fe(oe,!0))&&Y.push(oe)},R=()=>{};function k(I,Y){const{includeDirs:re,filters:oe,relativePaths:fe}=Y;return re?fe?oe&&oe.length?B(I):h(I):oe&&oe.length?V:E:R}const U=(I,Y,re,oe)=>{oe.every(fe=>fe(I,!1))&&re.files++},Z=(I,Y,re,oe)=>{oe.every(fe=>fe(I,!1))&&Y.push(I)},G=(I,Y,re,oe)=>{re.files++},$=(I,Y)=>{Y.push(I)},a=()=>{};function H(I){const{excludeFiles:Y,filters:re,onlyCounts:oe}=I;return Y?a:re&&re.length?oe?U:Z:oe?G:$}const l=I=>I,u=()=>[""].slice(0,0);function p(I){return I.group?u:l}const K=(I,Y,re)=>{I.push({directory:Y,files:re,dir:Y})},t=()=>{};function v(I){return I.group?K:t}const S=function(I,Y,re){const{queue:oe,fs:fe,options:{suppressErrors:ve}}=Y;oe.enqueue(),fe.realpath(I,(be,Ee)=>{if(be)return oe.dequeue(ve?null:be,Y);fe.stat(Ee,(we,Be)=>{if(we)return oe.dequeue(ve?null:we,Y);if(Be.isDirectory()&&J(I,Ee,Y))return oe.dequeue(null,Y);re(Be,Ee),oe.dequeue(null,Y)})})},x=function(I,Y,re){const{queue:oe,fs:fe,options:{suppressErrors:ve}}=Y;oe.enqueue();try{const be=fe.realpathSync(I),Ee=fe.statSync(be);if(Ee.isDirectory()&&J(I,be,Y))return;re(Ee,be)}catch(be){if(!ve)throw be}};function D(I,Y){return!I.resolveSymlinks||I.excludeSymlinks?null:Y?x:S}function J(I,Y,re){if(re.options.useRealPaths)return W(Y,re);let oe=(0,m.dirname)(I),fe=1;for(;oe!==re.root&&fe<2;){const ve=re.symlinks.get(oe);!!ve&&(ve===Y||ve.startsWith(Y)||Y.startsWith(ve))?fe++:oe=(0,m.dirname)(oe)}return re.symlinks.set(I,Y),fe>1}function W(I,Y){return Y.visited.includes(I+Y.options.pathSeparator)}const d=I=>I.counts,M=I=>I.groups,z=I=>I.paths,ee=I=>I.paths.slice(0,I.options.maxFiles),P=(I,Y,re)=>(ue(Y,re,I.counts,I.options.suppressErrors),null),b=(I,Y,re)=>(ue(Y,re,I.paths,I.options.suppressErrors),null),X=(I,Y,re)=>(ue(Y,re,I.paths.slice(0,I.options.maxFiles),I.options.suppressErrors),null),se=(I,Y,re)=>(ue(Y,re,I.groups,I.options.suppressErrors),null);function ue(I,Y,re,oe){Y(I&&!oe?I:null,re)}function he(I,Y){const{onlyCounts:re,group:oe,maxFiles:fe}=I;return re?Y?d:P:oe?Y?M:se:fe?Y?ee:X:Y?z:b}const pe={withFileTypes:!0},ge=(I,Y,re,oe,fe)=>{if(I.queue.enqueue(),oe<0)return I.queue.dequeue(null,I);const{fs:ve}=I;I.visited.push(Y),I.counts.directories++,ve.readdir(Y||".",pe,(be,Ee=[])=>{fe(Ee,re,oe),I.queue.dequeue(I.options.suppressErrors?null:be,I)})},ye=(I,Y,re,oe,fe)=>{const{fs:ve}=I;if(oe<0)return;I.visited.push(Y),I.counts.directories++;let be=[];try{be=ve.readdirSync(Y||".",pe)}catch(Ee){if(!I.options.suppressErrors)throw Ee}fe(be,re,oe)};function Se(I){return I?ye:ge}var _e=class{count=0;constructor(I){this.onQueueEmpty=I}enqueue(){return this.count++,this.count}dequeue(I,Y){this.onQueueEmpty&&(--this.count<=0||I)&&(this.onQueueEmpty(I,Y),I&&(Y.controller.abort(),this.onQueueEmpty=void 0))}},ae=class{_files=0;_directories=0;set files(I){this._files=I}get files(){return this._files}set directories(I){this._directories=I}get directories(){return this._directories}get dirs(){return this._directories}},ne=class{aborted=!1;abort(){this.aborted=!0}},te=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(I,Y,re){this.isSynchronous=!re,this.callbackInvoker=he(Y,this.isSynchronous),this.root=g(I,Y),this.state={root:y(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new ae,options:Y,queue:new _e((oe,fe)=>this.callbackInvoker(fe,oe,re)),symlinks:new Map,visited:[""].slice(0,0),controller:new ne,fs:Y.fs||w},this.joinPath=_(this.root,Y),this.pushDirectory=k(this.root,Y),this.pushFile=H(Y),this.getArray=p(Y),this.groupFiles=v(Y),this.resolveSymlink=D(Y,this.isSynchronous),this.walkDirectory=Se(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(I,Y,re)=>{const{paths:oe,options:{filters:fe,resolveSymlinks:ve,excludeSymlinks:be,exclude:Ee,maxFiles:we,signal:Be,useRealPaths:De,pathSeparator:Xe},controller:st}=this.state;if(st.aborted||Be&&Be.aborted||we&&oe.length>we)return;const ft=this.getArray(this.state.paths);for(let dt=0;dt<I.length;++dt){const Ne=I[dt];if(Ne.isFile()||Ne.isSymbolicLink()&&!ve&&!be){const Ce=this.joinPath(Ne.name,Y);this.pushFile(Ce,ft,this.state.counts,fe)}else if(Ne.isDirectory()){let Ce=C(Ne.name,Y,this.state.options.pathSeparator);if(Ee&&Ee(Ne.name,Ce))continue;this.pushDirectory(Ce,oe,fe),this.walkDirectory(this.state,Ce,Ce,re-1,this.walk)}else if(this.resolveSymlink&&Ne.isSymbolicLink()){let Ce=A(Ne.name,Y);this.resolveSymlink(Ce,this.state,(Qi,He)=>{if(Qi.isDirectory()){if(He=g(He,this.state.options),Ee&&Ee(Ne.name,De?He:Ce+Xe))return;this.walkDirectory(this.state,He,De?He:Ce+Xe,re-1,this.walk)}else{He=De?He:Ce;const Ji=(0,m.basename)(He),eo=g((0,m.dirname)(He),this.state.options);He=this.joinPath(Ji,eo),this.pushFile(He,ft,this.state.counts,fe)}})}}this.groupFiles(this.state.groups,Y,ft)}};function j(I,Y){return new Promise((re,oe)=>{ie(I,Y,(fe,ve)=>{if(fe)return oe(fe);re(ve)})})}function ie(I,Y,re){new te(I,Y,re).start()}function Q(I,Y){return new te(I,Y).start()}var ce=class{constructor(I,Y){this.root=I,this.options=Y}withPromise(){return j(this.root,this.options)}withCallback(I){ie(this.root,this.options,I)}sync(){return Q(this.root,this.options)}};let le=null;try{require.resolve("picomatch"),le=Lr()}catch{}var de=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:m.sep,filters:[]};globFunction;constructor(I){this.options={...this.options,...I},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(I){return this.options.pathSeparator=I,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(I){return this.options.maxDepth=I,this}withMaxFiles(I){return this.options.maxFiles=I,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:I=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=I,this.withFullPaths()}withAbortSignal(I){return this.options.signal=I,this}normalize(){return this.options.normalizePath=!0,this}filter(I){return this.options.filters.push(I),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(I){return this.options.exclude=I,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(I){return new ce(I||".",this.options)}withGlobFunction(I){return this.globFunction=I,this}crawlWithOptions(I,Y){return this.options={...this.options,...Y},new ce(I||".",this.options)}glob(...I){return this.globFunction?this.globWithOptions(I):this.globWithOptions(I,{dot:!0})}globWithOptions(I,...Y){const re=this.globFunction||le;if(!re)throw new Error("Please specify a glob function to use glob matching.");var oe=this.globCache[I.join("\0")];return oe||(oe=re(I,...Y),this.globCache[I.join("\0")]=oe),this.options.filters.push(fe=>oe(fe)),this}};return bt.fdir=de,bt}var Bt,Dr;function Ao(){if(Dr)return Bt;Dr=1;const{fdir:e}=xo(),r=Re,f=Lr();class c{constructor(i="./",n=[".env*"],o=[]){this.ignore=["node_modules/**",".git/**"],this.cwd=r.resolve(i),this.envFile=n,this.excludeEnvFile=o}run(){return this._filepaths()}_filepaths(){const i=f(this._exclude()),n=f(this._patterns(),{ignore:this._exclude()});return new e().withRelativePaths().exclude((o,m)=>i(m)).filter(o=>n(o)).crawl(this.cwd).sync()}_patterns(){return Array.isArray(this.envFile)?this.envFile.map(i=>`**/${i}`):[`**/${this.envFile}`]}_excludePatterns(){return Array.isArray(this.excludeEnvFile)?this.excludeEnvFile.map(i=>`**/${i}`):[`**/${this.excludeEnvFile}`]}_exclude(){return this._excludePatterns().length>0?this.ignore.concat(this._excludePatterns()):this.ignore}}return Bt=c,Bt}var Rt,Fr;function Te(){if(Fr)return Rt;Fr=1;const e=Fe,r="utf8";async function f(m,w=null){return w||(w=r),e.promises.readFile(m,w)}function c(m,w=null){return w||(w=r),e.readFileSync(m,w)}function s(m,w){return e.writeFileSync(m,w,r)}async function i(m,w){return e.promises.writeFile(m,w,r)}async function n(m){try{return await e.promises.access(m),!0}catch{return!1}}return Rt={chmodSync:e.chmodSync,exists:n,existsSync:e.existsSync,readdirSync:e.readdirSync,readFileSync:e.readFileSync,writeFileSync:e.writeFileSync,appendFileSync:e.appendFileSync,readFileX:f,readFileXSync:c,writeFileX:i,writeFileXSync:s},Rt}var It={},Ot={},kr;function Le(){return kr||(kr=1,(function(e){/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.wrapCipher=e.Hash=e.nextTick=e.isLE=void 0,e.isBytes=r,e.abool=f,e.anumber=c,e.abytes=s,e.ahash=i,e.aexists=n,e.aoutput=o,e.u8=m,e.u32=w,e.clean=O,e.createView=N,e.bytesToHex=y,e.hexToBytes=q,e.hexToNumber=T,e.bytesToNumberBE=C,e.numberToBytesBE=_,e.utf8ToBytes=B,e.bytesToUtf8=E,e.toBytes=V,e.overlapBytes=R,e.complexOverlapBytes=k,e.concatBytes=U,e.checkOpts=Z,e.equalBytes=G,e.getOutput=H,e.setBigUint64=l,e.u64Lengths=u,e.isAligned32=p,e.copyBytes=K;function r(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function f(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function c(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function s(t,...v){if(!r(t))throw new Error("Uint8Array expected");if(v.length>0&&!v.includes(t.length))throw new Error("Uint8Array expected of length "+v+", got length="+t.length)}function i(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");c(t.outputLen),c(t.blockLen)}function n(t,v=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(v&&t.finished)throw new Error("Hash#digest() has already been called")}function o(t,v){s(t);const S=v.outputLen;if(t.length<S)throw new Error("digestInto() expects output buffer of length at least "+S)}function m(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function w(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function O(...t){for(let v=0;v<t.length;v++)t[v].fill(0)}function N(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const F=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",L=Array.from({length:256},(t,v)=>v.toString(16).padStart(2,"0"));function y(t){if(s(t),F)return t.toHex();let v="";for(let S=0;S<t.length;S++)v+=L[t[S]];return v}const g={_0:48,_9:57,A:65,F:70,a:97,f:102};function A(t){if(t>=g._0&&t<=g._9)return t-g._0;if(t>=g.A&&t<=g.F)return t-(g.A-10);if(t>=g.a&&t<=g.f)return t-(g.a-10)}function q(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(F)return Uint8Array.fromHex(t);const v=t.length,S=v/2;if(v%2)throw new Error("hex string expected, got unpadded hex of length "+v);const x=new Uint8Array(S);for(let D=0,J=0;D<S;D++,J+=2){const W=A(t.charCodeAt(J)),d=A(t.charCodeAt(J+1));if(W===void 0||d===void 0){const M=t[J]+t[J+1];throw new Error('hex string expected, got non-hex character "'+M+'" at index '+J)}x[D]=W*16+d}return x}function T(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":"0x"+t)}function C(t){return T(y(t))}function _(t,v){return q(t.toString(16).padStart(v*2,"0"))}const h=async()=>{};e.nextTick=h;function B(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function E(t){return new TextDecoder().decode(t)}function V(t){if(typeof t=="string")t=B(t);else if(r(t))t=K(t);else throw new Error("Uint8Array expected, got "+typeof t);return t}function R(t,v){return t.buffer===v.buffer&&t.byteOffset<v.byteOffset+v.byteLength&&v.byteOffset<t.byteOffset+t.byteLength}function k(t,v){if(R(t,v)&&t.byteOffset<v.byteOffset)throw new Error("complex overlap of input and output is not supported")}function U(...t){let v=0;for(let x=0;x<t.length;x++){const D=t[x];s(D),v+=D.length}const S=new Uint8Array(v);for(let x=0,D=0;x<t.length;x++){const J=t[x];S.set(J,D),D+=J.length}return S}function Z(t,v){if(v==null||typeof v!="object")throw new Error("options must be defined");return Object.assign(t,v)}function G(t,v){if(t.length!==v.length)return!1;let S=0;for(let x=0;x<t.length;x++)S|=t[x]^v[x];return S===0}class ${}e.Hash=$;const a=(t,v)=>{function S(x,...D){if(s(x),!e.isLE)throw new Error("Non little-endian hardware is not yet supported");if(t.nonceLength!==void 0){const ee=D[0];if(!ee)throw new Error("nonce / iv required");t.varSizeNonce?s(ee):s(ee,t.nonceLength)}const J=t.tagLength;J&&D[1]!==void 0&&s(D[1]);const W=v(x,...D),d=(ee,P)=>{if(P!==void 0){if(ee!==2)throw new Error("cipher output not supported");s(P)}};let M=!1;return{encrypt(ee,P){if(M)throw new Error("cannot encrypt() twice with same key + nonce");return M=!0,s(ee),d(W.encrypt.length,P),W.encrypt(ee,P)},decrypt(ee,P){if(s(ee),J&&ee.length<J)throw new Error("invalid ciphertext length: smaller than tagLength="+J);return d(W.decrypt.length,P),W.decrypt(ee,P)}}}return Object.assign(S,t),S};e.wrapCipher=a;function H(t,v,S=!0){if(v===void 0)return new Uint8Array(t);if(v.length!==t)throw new Error("invalid output length, expected "+t+", got: "+v.length);if(S&&!p(v))throw new Error("invalid output, must be aligned");return v}function l(t,v,S,x){if(typeof t.setBigUint64=="function")return t.setBigUint64(v,S,x);const D=BigInt(32),J=BigInt(4294967295),W=Number(S>>D&J),d=Number(S&J),M=x?4:0,z=x?0:4;t.setUint32(v+M,W,x),t.setUint32(v+z,d,x)}function u(t,v,S){f(S);const x=new Uint8Array(16),D=N(x);return l(D,0,BigInt(v),S),l(D,8,BigInt(t),S),x}function p(t){return t.byteOffset%4===0}function K(t){return Uint8Array.from(t)}})(Ot)),Ot}var Kt={},Ie={},Vr;function Ct(){return Vr||(Vr=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.AEAD_TAG_LENGTH=Ie.XCHACHA20_NONCE_LENGTH=Ie.CURVE25519_PUBLIC_KEY_SIZE=Ie.ETH_PUBLIC_KEY_SIZE=Ie.UNCOMPRESSED_PUBLIC_KEY_SIZE=Ie.COMPRESSED_PUBLIC_KEY_SIZE=Ie.SECRET_KEY_LENGTH=void 0,Ie.SECRET_KEY_LENGTH=32,Ie.COMPRESSED_PUBLIC_KEY_SIZE=33,Ie.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,Ie.ETH_PUBLIC_KEY_SIZE=64,Ie.CURVE25519_PUBLIC_KEY_SIZE=32,Ie.XCHACHA20_NONCE_LENGTH=24,Ie.AEAD_TAG_LENGTH=16),Ie}var jr;function ct(){return jr||(jr=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ephemeralKeySize=e.symmetricNonceLength=e.symmetricAlgorithm=e.isHkdfKeyCompressed=e.isEphemeralKeyCompressed=e.ellipticCurve=e.ECIES_CONFIG=void 0;var r=Ct(),f=(function(){function w(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16}return w})();e.ECIES_CONFIG=new f;var c=function(){return e.ECIES_CONFIG.ellipticCurve};e.ellipticCurve=c;var s=function(){return e.ECIES_CONFIG.isEphemeralKeyCompressed};e.isEphemeralKeyCompressed=s;var i=function(){return e.ECIES_CONFIG.isHkdfKeyCompressed};e.isHkdfKeyCompressed=i;var n=function(){return e.ECIES_CONFIG.symmetricAlgorithm};e.symmetricAlgorithm=n;var o=function(){return e.ECIES_CONFIG.symmetricNonceLength};e.symmetricNonceLength=o;var m=function(){var w={secp256k1:e.ECIES_CONFIG.isEphemeralKeyCompressed?r.COMPRESSED_PUBLIC_KEY_SIZE:r.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:r.CURVE25519_PUBLIC_KEY_SIZE,ed25519:r.CURVE25519_PUBLIC_KEY_SIZE};if(e.ECIES_CONFIG.ellipticCurve in w)return w[e.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")};e.ephemeralKeySize=m})(Kt)),Kt}var Ht={},We={},Me={},Pt={},Tt={},ze={},Mr;function Bo(){return Mr||(Mr=1,Object.defineProperty(ze,"__esModule",{value:!0}),ze.crypto=void 0,ze.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),ze}var Ur;function Gr(){return Ur||(Ur=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.gcm=e.ctr=e.cbc=e.utils=void 0,e.randomBytes=c,e.getWebcryptoSubtle=s,e.managedNonce=i;const r=Bo(),f=Le();function c(w=32){if(r.crypto&&typeof r.crypto.getRandomValues=="function")return r.crypto.getRandomValues(new Uint8Array(w));if(r.crypto&&typeof r.crypto.randomBytes=="function")return Uint8Array.from(r.crypto.randomBytes(w));throw new Error("crypto.getRandomValues must be defined")}function s(){if(r.crypto&&typeof r.crypto.subtle=="object"&&r.crypto.subtle!=null)return r.crypto.subtle;throw new Error("crypto.subtle must be defined")}function i(w){const{nonceLength:O}=w;return(0,f.anumber)(O),((N,...F)=>({encrypt(L,...y){const g=c(O),A=w(N,g,...F).encrypt(L,...y),q=(0,f.concatBytes)(g,A);return A.fill(0),q},decrypt(L,...y){const g=L.subarray(0,O),A=L.subarray(O);return w(N,g,...F).decrypt(A,...y)}}))}e.utils={async encrypt(w,O,N,F){const L=s(),y=await L.importKey("raw",w,O,!0,["encrypt"]),g=await L.encrypt(N,y,F);return new Uint8Array(g)},async decrypt(w,O,N,F){const L=s(),y=await L.importKey("raw",w,O,!0,["decrypt"]),g=await L.decrypt(N,y,F);return new Uint8Array(g)}};const n={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function o(w,O,N){if(w===n.CBC)return{name:n.CBC,iv:O};if(w===n.CTR)return{name:n.CTR,counter:O,length:64};if(w===n.GCM)return N?{name:n.GCM,iv:O,additionalData:N}:{name:n.GCM,iv:O};throw new Error("unknown aes block mode")}function m(w){return(O,N,F)=>{(0,f.abytes)(O),(0,f.abytes)(N);const L={name:w,length:O.length*8},y=o(w,N,F);let g=!1;return{encrypt(A){if((0,f.abytes)(A),g)throw new Error("Cannot encrypt() twice with same key / nonce");return g=!0,e.utils.encrypt(O,L,y,A)},decrypt(A){return(0,f.abytes)(A),e.utils.decrypt(O,L,y,A)}}}}e.cbc=m(n.CBC),e.ctr=m(n.CTR),e.gcm=m(n.GCM)})(Tt)),Tt}var Nt={},xe={},Oe={},Lt={},Qe={},$r;function Ro(){return $r||($r=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.crypto=void 0,Qe.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),Qe}var Yr;function qe(){return Yr||(Yr=1,(function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.Hash=e.nextTick=e.swap32IfBE=e.byteSwapIfBE=e.swap8IfBE=e.isLE=void 0,e.isBytes=f,e.anumber=c,e.abytes=s,e.ahash=i,e.aexists=n,e.aoutput=o,e.u8=m,e.u32=w,e.clean=O,e.createView=N,e.rotr=F,e.rotl=L,e.byteSwap=y,e.byteSwap32=g,e.bytesToHex=T,e.hexToBytes=h,e.asyncLoop=E,e.utf8ToBytes=V,e.bytesToUtf8=R,e.toBytes=k,e.kdfInputToBytes=U,e.concatBytes=Z,e.checkOpts=G,e.createHasher=a,e.createOptHasher=H,e.createXOFer=l,e.randomBytes=u;const r=Ro();function f(p){return p instanceof Uint8Array||ArrayBuffer.isView(p)&&p.constructor.name==="Uint8Array"}function c(p){if(!Number.isSafeInteger(p)||p<0)throw new Error("positive integer expected, got "+p)}function s(p,...K){if(!f(p))throw new Error("Uint8Array expected");if(K.length>0&&!K.includes(p.length))throw new Error("Uint8Array expected of length "+K+", got length="+p.length)}function i(p){if(typeof p!="function"||typeof p.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");c(p.outputLen),c(p.blockLen)}function n(p,K=!0){if(p.destroyed)throw new Error("Hash instance has been destroyed");if(K&&p.finished)throw new Error("Hash#digest() has already been called")}function o(p,K){s(p);const t=K.outputLen;if(p.length<t)throw new Error("digestInto() expects output buffer of length at least "+t)}function m(p){return new Uint8Array(p.buffer,p.byteOffset,p.byteLength)}function w(p){return new Uint32Array(p.buffer,p.byteOffset,Math.floor(p.byteLength/4))}function O(...p){for(let K=0;K<p.length;K++)p[K].fill(0)}function N(p){return new DataView(p.buffer,p.byteOffset,p.byteLength)}function F(p,K){return p<<32-K|p>>>K}function L(p,K){return p<<K|p>>>32-K>>>0}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function y(p){return p<<24&4278190080|p<<8&16711680|p>>>8&65280|p>>>24&255}e.swap8IfBE=e.isLE?p=>p:p=>y(p),e.byteSwapIfBE=e.swap8IfBE;function g(p){for(let K=0;K<p.length;K++)p[K]=y(p[K]);return p}e.swap32IfBE=e.isLE?p=>p:g;const A=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",q=Array.from({length:256},(p,K)=>K.toString(16).padStart(2,"0"));function T(p){if(s(p),A)return p.toHex();let K="";for(let t=0;t<p.length;t++)K+=q[p[t]];return K}const C={_0:48,_9:57,A:65,F:70,a:97,f:102};function _(p){if(p>=C._0&&p<=C._9)return p-C._0;if(p>=C.A&&p<=C.F)return p-(C.A-10);if(p>=C.a&&p<=C.f)return p-(C.a-10)}function h(p){if(typeof p!="string")throw new Error("hex string expected, got "+typeof p);if(A)return Uint8Array.fromHex(p);const K=p.length,t=K/2;if(K%2)throw new Error("hex string expected, got unpadded hex of length "+K);const v=new Uint8Array(t);for(let S=0,x=0;S<t;S++,x+=2){const D=_(p.charCodeAt(x)),J=_(p.charCodeAt(x+1));if(D===void 0||J===void 0){const W=p[x]+p[x+1];throw new Error('hex string expected, got non-hex character "'+W+'" at index '+x)}v[S]=D*16+J}return v}const B=async()=>{};e.nextTick=B;async function E(p,K,t){let v=Date.now();for(let S=0;S<p;S++){t(S);const x=Date.now()-v;x>=0&&x<K||(await(0,e.nextTick)(),v+=x)}}function V(p){if(typeof p!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(p))}function R(p){return new TextDecoder().decode(p)}function k(p){return typeof p=="string"&&(p=V(p)),s(p),p}function U(p){return typeof p=="string"&&(p=V(p)),s(p),p}function Z(...p){let K=0;for(let v=0;v<p.length;v++){const S=p[v];s(S),K+=S.length}const t=new Uint8Array(K);for(let v=0,S=0;v<p.length;v++){const x=p[v];t.set(x,S),S+=x.length}return t}function G(p,K){if(K!==void 0&&{}.toString.call(K)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(p,K)}class ${}e.Hash=$;function a(p){const K=v=>p().update(k(v)).digest(),t=p();return K.outputLen=t.outputLen,K.blockLen=t.blockLen,K.create=()=>p(),K}function H(p){const K=(v,S)=>p(S).update(k(v)).digest(),t=p({});return K.outputLen=t.outputLen,K.blockLen=t.blockLen,K.create=v=>p(v),K}function l(p){const K=(v,S)=>p(S).update(k(v)).digest(),t=p({});return K.outputLen=t.outputLen,K.blockLen=t.blockLen,K.create=v=>p(v),K}e.wrapConstructor=a,e.wrapConstructorWithOpts=H,e.wrapXOFConstructorWithOpts=l;function u(p=32){if(r.crypto&&typeof r.crypto.getRandomValues=="function")return r.crypto.getRandomValues(new Uint8Array(p));if(r.crypto&&typeof r.crypto.randomBytes=="function")return Uint8Array.from(r.crypto.randomBytes(p));throw new Error("crypto.getRandomValues must be defined")}})(Lt)),Lt}var Zr;function Io(){if(Zr)return Oe;Zr=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.SHA512_IV=Oe.SHA384_IV=Oe.SHA224_IV=Oe.SHA256_IV=Oe.HashMD=void 0,Oe.setBigUint64=r,Oe.Chi=f,Oe.Maj=c;const e=qe();function r(i,n,o,m){if(typeof i.setBigUint64=="function")return i.setBigUint64(n,o,m);const w=BigInt(32),O=BigInt(4294967295),N=Number(o>>w&O),F=Number(o&O),L=m?4:0,y=m?0:4;i.setUint32(n+L,N,m),i.setUint32(n+y,F,m)}function f(i,n,o){return i&n^~i&o}function c(i,n,o){return i&n^i&o^n&o}class s extends e.Hash{constructor(n,o,m,w){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=n,this.outputLen=o,this.padOffset=m,this.isLE=w,this.buffer=new Uint8Array(n),this.view=(0,e.createView)(this.buffer)}update(n){(0,e.aexists)(this),n=(0,e.toBytes)(n),(0,e.abytes)(n);const{view:o,buffer:m,blockLen:w}=this,O=n.length;for(let N=0;N<O;){const F=Math.min(w-this.pos,O-N);if(F===w){const L=(0,e.createView)(n);for(;w<=O-N;N+=w)this.process(L,N);continue}m.set(n.subarray(N,N+F),this.pos),this.pos+=F,N+=F,this.pos===w&&(this.process(o,0),this.pos=0)}return this.length+=n.length,this.roundClean(),this}digestInto(n){(0,e.aexists)(this),(0,e.aoutput)(n,this),this.finished=!0;const{buffer:o,view:m,blockLen:w,isLE:O}=this;let{pos:N}=this;o[N++]=128,(0,e.clean)(this.buffer.subarray(N)),this.padOffset>w-N&&(this.process(m,0),N=0);for(let A=N;A<w;A++)o[A]=0;r(m,w-8,BigInt(this.length*8),O),this.process(m,0);const F=(0,e.createView)(n),L=this.outputLen;if(L%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const y=L/4,g=this.get();if(y>g.length)throw new Error("_sha2: outputLen bigger than state");for(let A=0;A<y;A++)F.setUint32(4*A,g[A],O)}digest(){const{buffer:n,outputLen:o}=this;this.digestInto(n);const m=n.slice(0,o);return this.destroy(),m}_cloneInto(n){n||(n=new this.constructor),n.set(...this.get());const{blockLen:o,buffer:m,length:w,finished:O,destroyed:N,pos:F}=this;return n.destroyed=N,n.finished=O,n.length=w,n.pos=F,w%o&&n.buffer.set(m),n}clone(){return this._cloneInto()}}return Oe.HashMD=s,Oe.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Oe.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),Oe.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Oe.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),Oe}var me={},Xr;function Oo(){if(Xr)return me;Xr=1,Object.defineProperty(me,"__esModule",{value:!0}),me.toBig=me.shrSL=me.shrSH=me.rotrSL=me.rotrSH=me.rotrBL=me.rotrBH=me.rotr32L=me.rotr32H=me.rotlSL=me.rotlSH=me.rotlBL=me.rotlBH=me.add5L=me.add5H=me.add4L=me.add4H=me.add3L=me.add3H=void 0,me.add=q,me.fromBig=f,me.split=c;const e=BigInt(2**32-1),r=BigInt(32);function f(R,k=!1){return k?{h:Number(R&e),l:Number(R>>r&e)}:{h:Number(R>>r&e)|0,l:Number(R&e)|0}}function c(R,k=!1){const U=R.length;let Z=new Uint32Array(U),G=new Uint32Array(U);for(let $=0;$<U;$++){const{h:a,l:H}=f(R[$],k);[Z[$],G[$]]=[a,H]}return[Z,G]}const s=(R,k)=>BigInt(R>>>0)<<r|BigInt(k>>>0);me.toBig=s;const i=(R,k,U)=>R>>>U;me.shrSH=i;const n=(R,k,U)=>R<<32-U|k>>>U;me.shrSL=n;const o=(R,k,U)=>R>>>U|k<<32-U;me.rotrSH=o;const m=(R,k,U)=>R<<32-U|k>>>U;me.rotrSL=m;const w=(R,k,U)=>R<<64-U|k>>>U-32;me.rotrBH=w;const O=(R,k,U)=>R>>>U-32|k<<64-U;me.rotrBL=O;const N=(R,k)=>k;me.rotr32H=N;const F=(R,k)=>R;me.rotr32L=F;const L=(R,k,U)=>R<<U|k>>>32-U;me.rotlSH=L;const y=(R,k,U)=>k<<U|R>>>32-U;me.rotlSL=y;const g=(R,k,U)=>k<<U-32|R>>>64-U;me.rotlBH=g;const A=(R,k,U)=>R<<U-32|k>>>64-U;me.rotlBL=A;function q(R,k,U,Z){const G=(k>>>0)+(Z>>>0);return{h:R+U+(G/2**32|0)|0,l:G|0}}const T=(R,k,U)=>(R>>>0)+(k>>>0)+(U>>>0);me.add3L=T;const C=(R,k,U,Z)=>k+U+Z+(R/2**32|0)|0;me.add3H=C;const _=(R,k,U,Z)=>(R>>>0)+(k>>>0)+(U>>>0)+(Z>>>0);me.add4L=_;const h=(R,k,U,Z,G)=>k+U+Z+G+(R/2**32|0)|0;me.add4H=h;const B=(R,k,U,Z,G)=>(R>>>0)+(k>>>0)+(U>>>0)+(Z>>>0)+(G>>>0);me.add5L=B;const E=(R,k,U,Z,G,$)=>k+U+Z+G+$+(R/2**32|0)|0;me.add5H=E;const V={fromBig:f,split:c,toBig:s,shrSH:i,shrSL:n,rotrSH:o,rotrSL:m,rotrBH:w,rotrBL:O,rotr32H:N,rotr32L:F,rotlSH:L,rotlSL:y,rotlBH:g,rotlBL:A,add:q,add3L:T,add3H:C,add4L:_,add4H:h,add5H:E,add5L:B};return me.default=V,me}var Wr;function qt(){if(Wr)return xe;Wr=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.sha512_224=xe.sha512_256=xe.sha384=xe.sha512=xe.sha224=xe.sha256=xe.SHA512_256=xe.SHA512_224=xe.SHA384=xe.SHA512=xe.SHA224=xe.SHA256=void 0;const e=Io(),r=Oo(),f=qe(),c=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),s=new Uint32Array(64);class i extends e.HashMD{constructor(C=32){super(64,C,8,!1),this.A=e.SHA256_IV[0]|0,this.B=e.SHA256_IV[1]|0,this.C=e.SHA256_IV[2]|0,this.D=e.SHA256_IV[3]|0,this.E=e.SHA256_IV[4]|0,this.F=e.SHA256_IV[5]|0,this.G=e.SHA256_IV[6]|0,this.H=e.SHA256_IV[7]|0}get(){const{A:C,B:_,C:h,D:B,E,F:V,G:R,H:k}=this;return[C,_,h,B,E,V,R,k]}set(C,_,h,B,E,V,R,k){this.A=C|0,this.B=_|0,this.C=h|0,this.D=B|0,this.E=E|0,this.F=V|0,this.G=R|0,this.H=k|0}process(C,_){for(let G=0;G<16;G++,_+=4)s[G]=C.getUint32(_,!1);for(let G=16;G<64;G++){const $=s[G-15],a=s[G-2],H=(0,f.rotr)($,7)^(0,f.rotr)($,18)^$>>>3,l=(0,f.rotr)(a,17)^(0,f.rotr)(a,19)^a>>>10;s[G]=l+s[G-7]+H+s[G-16]|0}let{A:h,B,C:E,D:V,E:R,F:k,G:U,H:Z}=this;for(let G=0;G<64;G++){const $=(0,f.rotr)(R,6)^(0,f.rotr)(R,11)^(0,f.rotr)(R,25),a=Z+$+(0,e.Chi)(R,k,U)+c[G]+s[G]|0,l=((0,f.rotr)(h,2)^(0,f.rotr)(h,13)^(0,f.rotr)(h,22))+(0,e.Maj)(h,B,E)|0;Z=U,U=k,k=R,R=V+a|0,V=E,E=B,B=h,h=a+l|0}h=h+this.A|0,B=B+this.B|0,E=E+this.C|0,V=V+this.D|0,R=R+this.E|0,k=k+this.F|0,U=U+this.G|0,Z=Z+this.H|0,this.set(h,B,E,V,R,k,U,Z)}roundClean(){(0,f.clean)(s)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,f.clean)(this.buffer)}}xe.SHA256=i;class n extends i{constructor(){super(28),this.A=e.SHA224_IV[0]|0,this.B=e.SHA224_IV[1]|0,this.C=e.SHA224_IV[2]|0,this.D=e.SHA224_IV[3]|0,this.E=e.SHA224_IV[4]|0,this.F=e.SHA224_IV[5]|0,this.G=e.SHA224_IV[6]|0,this.H=e.SHA224_IV[7]|0}}xe.SHA224=n;const o=r.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(T=>BigInt(T))),m=o[0],w=o[1],O=new Uint32Array(80),N=new Uint32Array(80);class F extends e.HashMD{constructor(C=64){super(128,C,16,!1),this.Ah=e.SHA512_IV[0]|0,this.Al=e.SHA512_IV[1]|0,this.Bh=e.SHA512_IV[2]|0,this.Bl=e.SHA512_IV[3]|0,this.Ch=e.SHA512_IV[4]|0,this.Cl=e.SHA512_IV[5]|0,this.Dh=e.SHA512_IV[6]|0,this.Dl=e.SHA512_IV[7]|0,this.Eh=e.SHA512_IV[8]|0,this.El=e.SHA512_IV[9]|0,this.Fh=e.SHA512_IV[10]|0,this.Fl=e.SHA512_IV[11]|0,this.Gh=e.SHA512_IV[12]|0,this.Gl=e.SHA512_IV[13]|0,this.Hh=e.SHA512_IV[14]|0,this.Hl=e.SHA512_IV[15]|0}get(){const{Ah:C,Al:_,Bh:h,Bl:B,Ch:E,Cl:V,Dh:R,Dl:k,Eh:U,El:Z,Fh:G,Fl:$,Gh:a,Gl:H,Hh:l,Hl:u}=this;return[C,_,h,B,E,V,R,k,U,Z,G,$,a,H,l,u]}set(C,_,h,B,E,V,R,k,U,Z,G,$,a,H,l,u){this.Ah=C|0,this.Al=_|0,this.Bh=h|0,this.Bl=B|0,this.Ch=E|0,this.Cl=V|0,this.Dh=R|0,this.Dl=k|0,this.Eh=U|0,this.El=Z|0,this.Fh=G|0,this.Fl=$|0,this.Gh=a|0,this.Gl=H|0,this.Hh=l|0,this.Hl=u|0}process(C,_){for(let t=0;t<16;t++,_+=4)O[t]=C.getUint32(_),N[t]=C.getUint32(_+=4);for(let t=16;t<80;t++){const v=O[t-15]|0,S=N[t-15]|0,x=r.rotrSH(v,S,1)^r.rotrSH(v,S,8)^r.shrSH(v,S,7),D=r.rotrSL(v,S,1)^r.rotrSL(v,S,8)^r.shrSL(v,S,7),J=O[t-2]|0,W=N[t-2]|0,d=r.rotrSH(J,W,19)^r.rotrBH(J,W,61)^r.shrSH(J,W,6),M=r.rotrSL(J,W,19)^r.rotrBL(J,W,61)^r.shrSL(J,W,6),z=r.add4L(D,M,N[t-7],N[t-16]),ee=r.add4H(z,x,d,O[t-7],O[t-16]);O[t]=ee|0,N[t]=z|0}let{Ah:h,Al:B,Bh:E,Bl:V,Ch:R,Cl:k,Dh:U,Dl:Z,Eh:G,El:$,Fh:a,Fl:H,Gh:l,Gl:u,Hh:p,Hl:K}=this;for(let t=0;t<80;t++){const v=r.rotrSH(G,$,14)^r.rotrSH(G,$,18)^r.rotrBH(G,$,41),S=r.rotrSL(G,$,14)^r.rotrSL(G,$,18)^r.rotrBL(G,$,41),x=G&a^~G&l,D=$&H^~$&u,J=r.add5L(K,S,D,w[t],N[t]),W=r.add5H(J,p,v,x,m[t],O[t]),d=J|0,M=r.rotrSH(h,B,28)^r.rotrBH(h,B,34)^r.rotrBH(h,B,39),z=r.rotrSL(h,B,28)^r.rotrBL(h,B,34)^r.rotrBL(h,B,39),ee=h&E^h&R^E&R,P=B&V^B&k^V&k;p=l|0,K=u|0,l=a|0,u=H|0,a=G|0,H=$|0,{h:G,l:$}=r.add(U|0,Z|0,W|0,d|0),U=R|0,Z=k|0,R=E|0,k=V|0,E=h|0,V=B|0;const b=r.add3L(d,z,P);h=r.add3H(b,W,M,ee),B=b|0}({h,l:B}=r.add(this.Ah|0,this.Al|0,h|0,B|0)),{h:E,l:V}=r.add(this.Bh|0,this.Bl|0,E|0,V|0),{h:R,l:k}=r.add(this.Ch|0,this.Cl|0,R|0,k|0),{h:U,l:Z}=r.add(this.Dh|0,this.Dl|0,U|0,Z|0),{h:G,l:$}=r.add(this.Eh|0,this.El|0,G|0,$|0),{h:a,l:H}=r.add(this.Fh|0,this.Fl|0,a|0,H|0),{h:l,l:u}=r.add(this.Gh|0,this.Gl|0,l|0,u|0),{h:p,l:K}=r.add(this.Hh|0,this.Hl|0,p|0,K|0),this.set(h,B,E,V,R,k,U,Z,G,$,a,H,l,u,p,K)}roundClean(){(0,f.clean)(O,N)}destroy(){(0,f.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}xe.SHA512=F;class L extends F{constructor(){super(48),this.Ah=e.SHA384_IV[0]|0,this.Al=e.SHA384_IV[1]|0,this.Bh=e.SHA384_IV[2]|0,this.Bl=e.SHA384_IV[3]|0,this.Ch=e.SHA384_IV[4]|0,this.Cl=e.SHA384_IV[5]|0,this.Dh=e.SHA384_IV[6]|0,this.Dl=e.SHA384_IV[7]|0,this.Eh=e.SHA384_IV[8]|0,this.El=e.SHA384_IV[9]|0,this.Fh=e.SHA384_IV[10]|0,this.Fl=e.SHA384_IV[11]|0,this.Gh=e.SHA384_IV[12]|0,this.Gl=e.SHA384_IV[13]|0,this.Hh=e.SHA384_IV[14]|0,this.Hl=e.SHA384_IV[15]|0}}xe.SHA384=L;const y=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),g=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class A extends F{constructor(){super(28),this.Ah=y[0]|0,this.Al=y[1]|0,this.Bh=y[2]|0,this.Bl=y[3]|0,this.Ch=y[4]|0,this.Cl=y[5]|0,this.Dh=y[6]|0,this.Dl=y[7]|0,this.Eh=y[8]|0,this.El=y[9]|0,this.Fh=y[10]|0,this.Fl=y[11]|0,this.Gh=y[12]|0,this.Gl=y[13]|0,this.Hh=y[14]|0,this.Hl=y[15]|0}}xe.SHA512_224=A;class q extends F{constructor(){super(32),this.Ah=g[0]|0,this.Al=g[1]|0,this.Bh=g[2]|0,this.Bl=g[3]|0,this.Ch=g[4]|0,this.Cl=g[5]|0,this.Dh=g[6]|0,this.Dl=g[7]|0,this.Eh=g[8]|0,this.El=g[9]|0,this.Fh=g[10]|0,this.Fl=g[11]|0,this.Gh=g[12]|0,this.Gl=g[13]|0,this.Hh=g[14]|0,this.Hl=g[15]|0}}return xe.SHA512_256=q,xe.sha256=(0,f.createHasher)(()=>new i),xe.sha224=(0,f.createHasher)(()=>new n),xe.sha512=(0,f.createHasher)(()=>new F),xe.sha384=(0,f.createHasher)(()=>new L),xe.sha512_256=(0,f.createHasher)(()=>new q),xe.sha512_224=(0,f.createHasher)(()=>new A),xe}var Ke={},Dt={},zr;function ke(){return zr||(zr=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.notImplemented=e.bitMask=e.utf8ToBytes=e.randomBytes=e.isBytes=e.hexToBytes=e.concatBytes=e.bytesToUtf8=e.bytesToHex=e.anumber=e.abytes=void 0,e.abool=i,e._abool2=n,e._abytes2=o,e.numberToHexUnpadded=m,e.hexToNumber=w,e.bytesToNumberBE=O,e.bytesToNumberLE=N,e.numberToBytesBE=F,e.numberToBytesLE=L,e.numberToVarBytesBE=y,e.ensureBytes=g,e.equalBytes=A,e.copyBytes=q,e.asciiToBytes=T,e.inRange=_,e.aInRange=h,e.bitLen=B,e.bitGet=E,e.bitSet=V,e.createHmacDrbg=k,e.validateObject=Z,e.isHash=G,e._validateObject=$,e.memoized=H;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=qe();var f=qe();Object.defineProperty(e,"abytes",{enumerable:!0,get:function(){return f.abytes}}),Object.defineProperty(e,"anumber",{enumerable:!0,get:function(){return f.anumber}}),Object.defineProperty(e,"bytesToHex",{enumerable:!0,get:function(){return f.bytesToHex}}),Object.defineProperty(e,"bytesToUtf8",{enumerable:!0,get:function(){return f.bytesToUtf8}}),Object.defineProperty(e,"concatBytes",{enumerable:!0,get:function(){return f.concatBytes}}),Object.defineProperty(e,"hexToBytes",{enumerable:!0,get:function(){return f.hexToBytes}}),Object.defineProperty(e,"isBytes",{enumerable:!0,get:function(){return f.isBytes}}),Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return f.randomBytes}}),Object.defineProperty(e,"utf8ToBytes",{enumerable:!0,get:function(){return f.utf8ToBytes}});const c=BigInt(0),s=BigInt(1);function i(l,u){if(typeof u!="boolean")throw new Error(l+" boolean expected, got "+u)}function n(l,u=""){if(typeof l!="boolean"){const p=u&&`"${u}"`;throw new Error(p+"expected boolean, got type="+typeof l)}return l}function o(l,u,p=""){const K=(0,r.isBytes)(l),t=l?.length,v=u!==void 0;if(!K||v&&t!==u){const S=p&&`"${p}" `,x=v?` of length ${u}`:"",D=K?`length=${t}`:`type=${typeof l}`;throw new Error(S+"expected Uint8Array"+x+", got "+D)}return l}function m(l){const u=l.toString(16);return u.length&1?"0"+u:u}function w(l){if(typeof l!="string")throw new Error("hex string expected, got "+typeof l);return l===""?c:BigInt("0x"+l)}function O(l){return w((0,r.bytesToHex)(l))}function N(l){return(0,r.abytes)(l),w((0,r.bytesToHex)(Uint8Array.from(l).reverse()))}function F(l,u){return(0,r.hexToBytes)(l.toString(16).padStart(u*2,"0"))}function L(l,u){return F(l,u).reverse()}function y(l){return(0,r.hexToBytes)(m(l))}function g(l,u,p){let K;if(typeof u=="string")try{K=(0,r.hexToBytes)(u)}catch(v){throw new Error(l+" must be hex string or Uint8Array, cause: "+v)}else if((0,r.isBytes)(u))K=Uint8Array.from(u);else throw new Error(l+" must be hex string or Uint8Array");const t=K.length;if(typeof p=="number"&&t!==p)throw new Error(l+" of length "+p+" expected, got "+t);return K}function A(l,u){if(l.length!==u.length)return!1;let p=0;for(let K=0;K<l.length;K++)p|=l[K]^u[K];return p===0}function q(l){return Uint8Array.from(l)}function T(l){return Uint8Array.from(l,(u,p)=>{const K=u.charCodeAt(0);if(u.length!==1||K>127)throw new Error(`string contains non-ASCII character "${l[p]}" with code ${K} at position ${p}`);return K})}const C=l=>typeof l=="bigint"&&c<=l;function _(l,u,p){return C(l)&&C(u)&&C(p)&&u<=l&&l<p}function h(l,u,p,K){if(!_(u,p,K))throw new Error("expected valid "+l+": "+p+" <= n < "+K+", got "+u)}function B(l){let u;for(u=0;l>c;l>>=s,u+=1);return u}function E(l,u){return l>>BigInt(u)&s}function V(l,u,p){return l|(p?s:c)<<BigInt(u)}const R=l=>(s<<BigInt(l))-s;e.bitMask=R;function k(l,u,p){if(typeof l!="number"||l<2)throw new Error("hashLen must be a number");if(typeof u!="number"||u<2)throw new Error("qByteLen must be a number");if(typeof p!="function")throw new Error("hmacFn must be a function");const K=z=>new Uint8Array(z),t=z=>Uint8Array.of(z);let v=K(l),S=K(l),x=0;const D=()=>{v.fill(1),S.fill(0),x=0},J=(...z)=>p(S,v,...z),W=(z=K(0))=>{S=J(t(0),z),v=J(),z.length!==0&&(S=J(t(1),z),v=J())},d=()=>{if(x++>=1e3)throw new Error("drbg: tried 1000 values");let z=0;const ee=[];for(;z<u;){v=J();const P=v.slice();ee.push(P),z+=v.length}return(0,r.concatBytes)(...ee)};return(z,ee)=>{D(),W(z);let P;for(;!(P=ee(d()));)W();return D(),P}}const U={bigint:l=>typeof l=="bigint",function:l=>typeof l=="function",boolean:l=>typeof l=="boolean",string:l=>typeof l=="string",stringOrUint8Array:l=>typeof l=="string"||(0,r.isBytes)(l),isSafeInteger:l=>Number.isSafeInteger(l),array:l=>Array.isArray(l),field:(l,u)=>u.Fp.isValid(l),hash:l=>typeof l=="function"&&Number.isSafeInteger(l.outputLen)};function Z(l,u,p={}){const K=(t,v,S)=>{const x=U[v];if(typeof x!="function")throw new Error("invalid validator function");const D=l[t];if(!(S&&D===void 0)&&!x(D,l))throw new Error("param "+String(t)+" is invalid. Expected "+v+", got "+D)};for(const[t,v]of Object.entries(u))K(t,v,!1);for(const[t,v]of Object.entries(p))K(t,v,!0);return l}function G(l){return typeof l=="function"&&Number.isSafeInteger(l.outputLen)}function $(l,u,p={}){if(!l||typeof l!="object")throw new Error("expected valid options object");function K(t,v,S){const x=l[t];if(S&&x===void 0)return;const D=typeof x;if(D!==v||x===null)throw new Error(`param "${t}" is invalid: expected ${v}, got ${D}`)}Object.entries(u).forEach(([t,v])=>K(t,v,!1)),Object.entries(p).forEach(([t,v])=>K(t,v,!0))}const a=()=>{throw new Error("not implemented")};e.notImplemented=a;function H(l){const u=new WeakMap;return(p,...K)=>{const t=u.get(p);if(t!==void 0)return t;const v=l(p,...K);return u.set(p,v),v}}})(Dt)),Dt}var Ae={},Qr;function Ue(){if(Qr)return Ae;Qr=1,Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.isNegativeLE=void 0,Ae.mod=N,Ae.pow=F,Ae.pow2=L,Ae.invert=y,Ae.tonelliShanks=C,Ae.FpSqrt=_,Ae.validateField=E,Ae.FpPow=V,Ae.FpInvertBatch=R,Ae.FpDiv=k,Ae.FpLegendre=U,Ae.FpIsSquare=Z,Ae.nLength=G,Ae.Field=$,Ae.FpSqrtOdd=a,Ae.FpSqrtEven=H,Ae.hashToPrivateScalar=l,Ae.getFieldBytesLength=u,Ae.getMinHashLength=p,Ae.mapHashToField=K;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=ke(),r=BigInt(0),f=BigInt(1),c=BigInt(2),s=BigInt(3),i=BigInt(4),n=BigInt(5),o=BigInt(7),m=BigInt(8),w=BigInt(9),O=BigInt(16);function N(t,v){const S=t%v;return S>=r?S:v+S}function F(t,v,S){return V($(S),t,v)}function L(t,v,S){let x=t;for(;v-- >r;)x*=x,x%=S;return x}function y(t,v){if(t===r)throw new Error("invert: expected non-zero number");if(v<=r)throw new Error("invert: expected positive modulus, got "+v);let S=N(t,v),x=v,D=r,J=f;for(;S!==r;){const d=x/S,M=x%S,z=D-J*d;x=S,S=M,D=J,J=z}if(x!==f)throw new Error("invert: does not exist");return N(D,v)}function g(t,v,S){if(!t.eql(t.sqr(v),S))throw new Error("Cannot find square root")}function A(t,v){const S=(t.ORDER+f)/i,x=t.pow(v,S);return g(t,x,v),x}function q(t,v){const S=(t.ORDER-n)/m,x=t.mul(v,c),D=t.pow(x,S),J=t.mul(v,D),W=t.mul(t.mul(J,c),D),d=t.mul(J,t.sub(W,t.ONE));return g(t,d,v),d}function T(t){const v=$(t),S=C(t),x=S(v,v.neg(v.ONE)),D=S(v,x),J=S(v,v.neg(x)),W=(t+o)/O;return(d,M)=>{let z=d.pow(M,W),ee=d.mul(z,x);const P=d.mul(z,D),b=d.mul(z,J),X=d.eql(d.sqr(ee),M),se=d.eql(d.sqr(P),M);z=d.cmov(z,ee,X),ee=d.cmov(b,P,se);const ue=d.eql(d.sqr(ee),M),he=d.cmov(z,ee,ue);return g(d,he,M),he}}function C(t){if(t<s)throw new Error("sqrt is not defined for small field");let v=t-f,S=0;for(;v%c===r;)v/=c,S++;let x=c;const D=$(t);for(;U(D,x)===1;)if(x++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(S===1)return A;let J=D.pow(x,v);const W=(v+f)/c;return function(M,z){if(M.is0(z))return z;if(U(M,z)!==1)throw new Error("Cannot find square root");let ee=S,P=M.mul(M.ONE,J),b=M.pow(z,v),X=M.pow(z,W);for(;!M.eql(b,M.ONE);){if(M.is0(b))return M.ZERO;let se=1,ue=M.sqr(b);for(;!M.eql(ue,M.ONE);)if(se++,ue=M.sqr(ue),se===ee)throw new Error("Cannot find square root");const he=f<<BigInt(ee-se-1),pe=M.pow(P,he);ee=se,P=M.sqr(pe),b=M.mul(b,P),X=M.mul(X,pe)}return X}}function _(t){return t%i===s?A:t%m===n?q:t%O===w?T(t):C(t)}const h=(t,v)=>(N(t,v)&f)===f;Ae.isNegativeLE=h;const B=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function E(t){const v={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},S=B.reduce((x,D)=>(x[D]="function",x),v);return(0,e._validateObject)(t,S),t}function V(t,v,S){if(S<r)throw new Error("invalid exponent, negatives unsupported");if(S===r)return t.ONE;if(S===f)return v;let x=t.ONE,D=v;for(;S>r;)S&f&&(x=t.mul(x,D)),D=t.sqr(D),S>>=f;return x}function R(t,v,S=!1){const x=new Array(v.length).fill(S?t.ZERO:void 0),D=v.reduce((W,d,M)=>t.is0(d)?W:(x[M]=W,t.mul(W,d)),t.ONE),J=t.inv(D);return v.reduceRight((W,d,M)=>t.is0(d)?W:(x[M]=t.mul(W,x[M]),t.mul(W,d)),J),x}function k(t,v,S){return t.mul(v,typeof S=="bigint"?y(S,t.ORDER):t.inv(S))}function U(t,v){const S=(t.ORDER-f)/c,x=t.pow(v,S),D=t.eql(x,t.ONE),J=t.eql(x,t.ZERO),W=t.eql(x,t.neg(t.ONE));if(!D&&!J&&!W)throw new Error("invalid Legendre symbol result");return D?1:J?0:-1}function Z(t,v){return U(t,v)===1}function G(t,v){v!==void 0&&(0,e.anumber)(v);const S=v!==void 0?v:t.toString(2).length,x=Math.ceil(S/8);return{nBitLength:S,nByteLength:x}}function $(t,v,S=!1,x={}){if(t<=r)throw new Error("invalid field: expected ORDER > 0, got "+t);let D,J,W=!1,d;if(typeof v=="object"&&v!=null){if(x.sqrt||S)throw new Error("cannot specify opts in two arguments");const b=v;b.BITS&&(D=b.BITS),b.sqrt&&(J=b.sqrt),typeof b.isLE=="boolean"&&(S=b.isLE),typeof b.modFromBytes=="boolean"&&(W=b.modFromBytes),d=b.allowedLengths}else typeof v=="number"&&(D=v),x.sqrt&&(J=x.sqrt);const{nBitLength:M,nByteLength:z}=G(t,D);if(z>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let ee;const P=Object.freeze({ORDER:t,isLE:S,BITS:M,BYTES:z,MASK:(0,e.bitMask)(M),ZERO:r,ONE:f,allowedLengths:d,create:b=>N(b,t),isValid:b=>{if(typeof b!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof b);return r<=b&&b<t},is0:b=>b===r,isValidNot0:b=>!P.is0(b)&&P.isValid(b),isOdd:b=>(b&f)===f,neg:b=>N(-b,t),eql:(b,X)=>b===X,sqr:b=>N(b*b,t),add:(b,X)=>N(b+X,t),sub:(b,X)=>N(b-X,t),mul:(b,X)=>N(b*X,t),pow:(b,X)=>V(P,b,X),div:(b,X)=>N(b*y(X,t),t),sqrN:b=>b*b,addN:(b,X)=>b+X,subN:(b,X)=>b-X,mulN:(b,X)=>b*X,inv:b=>y(b,t),sqrt:J||(b=>(ee||(ee=_(t)),ee(P,b))),toBytes:b=>S?(0,e.numberToBytesLE)(b,z):(0,e.numberToBytesBE)(b,z),fromBytes:(b,X=!0)=>{if(d){if(!d.includes(b.length)||b.length>z)throw new Error("Field.fromBytes: expected "+d+" bytes, got "+b.length);const ue=new Uint8Array(z);ue.set(b,S?0:ue.length-b.length),b=ue}if(b.length!==z)throw new Error("Field.fromBytes: expected "+z+" bytes, got "+b.length);let se=S?(0,e.bytesToNumberLE)(b):(0,e.bytesToNumberBE)(b);if(W&&(se=N(se,t)),!X&&!P.isValid(se))throw new Error("invalid field element: outside of range 0..ORDER");return se},invertBatch:b=>R(P,b),cmov:(b,X,se)=>se?X:b});return Object.freeze(P)}function a(t,v){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const S=t.sqrt(v);return t.isOdd(S)?S:t.neg(S)}function H(t,v){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const S=t.sqrt(v);return t.isOdd(S)?t.neg(S):S}function l(t,v,S=!1){t=(0,e.ensureBytes)("privateHash",t);const x=t.length,D=G(v).nByteLength+8;if(D<24||x<D||x>1024)throw new Error("hashToPrivateScalar: expected "+D+"-1024 bytes of input, got "+x);const J=S?(0,e.bytesToNumberLE)(t):(0,e.bytesToNumberBE)(t);return N(J,v-f)+f}function u(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const v=t.toString(2).length;return Math.ceil(v/8)}function p(t){const v=u(t);return v+Math.ceil(v/2)}function K(t,v,S=!1){const x=t.length,D=u(v),J=p(v);if(x<16||x<J||x>1024)throw new Error("expected "+J+"-1024 bytes of input, got "+x);const W=S?(0,e.bytesToNumberLE)(t):(0,e.bytesToNumberBE)(t),d=N(W,v-f)+f;return S?(0,e.numberToBytesLE)(d,D):(0,e.numberToBytesBE)(d,D)}return Ae}var Jr;function Ft(){if(Jr)return Ke;Jr=1,Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.wNAF=void 0,Ke.negateCt=s,Ke.normalizeZ=i,Ke.mulEndoUnsafe=A,Ke.pippenger=q,Ke.precomputeMSMUnsafe=T,Ke.validateBasic=C,Ke._createCurveFields=h;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=ke(),r=Ue(),f=BigInt(0),c=BigInt(1);function s(B,E){const V=E.negate();return B?V:E}function i(B,E){const V=(0,r.FpInvertBatch)(B.Fp,E.map(R=>R.Z));return E.map((R,k)=>B.fromAffine(R.toAffine(V[k])))}function n(B,E){if(!Number.isSafeInteger(B)||B<=0||B>E)throw new Error("invalid window size, expected [1.."+E+"], got W="+B)}function o(B,E){n(B,E);const V=Math.ceil(E/B)+1,R=2**(B-1),k=2**B,U=(0,e.bitMask)(B),Z=BigInt(B);return{windows:V,windowSize:R,mask:U,maxNumber:k,shiftBy:Z}}function m(B,E,V){const{windowSize:R,mask:k,maxNumber:U,shiftBy:Z}=V;let G=Number(B&k),$=B>>Z;G>R&&(G-=U,$+=c);const a=E*R,H=a+Math.abs(G)-1,l=G===0,u=G<0,p=E%2!==0;return{nextN:$,offset:H,isZero:l,isNeg:u,isNegF:p,offsetF:a}}function w(B,E){if(!Array.isArray(B))throw new Error("array expected");B.forEach((V,R)=>{if(!(V instanceof E))throw new Error("invalid point at index "+R)})}function O(B,E){if(!Array.isArray(B))throw new Error("array of scalars expected");B.forEach((V,R)=>{if(!E.isValid(V))throw new Error("invalid scalar at index "+R)})}const N=new WeakMap,F=new WeakMap;function L(B){return F.get(B)||1}function y(B){if(B!==f)throw new Error("invalid wNAF")}class g{constructor(E,V){this.BASE=E.BASE,this.ZERO=E.ZERO,this.Fn=E.Fn,this.bits=V}_unsafeLadder(E,V,R=this.ZERO){let k=E;for(;V>f;)V&c&&(R=R.add(k)),k=k.double(),V>>=c;return R}precomputeWindow(E,V){const{windows:R,windowSize:k}=o(V,this.bits),U=[];let Z=E,G=Z;for(let $=0;$<R;$++){G=Z,U.push(G);for(let a=1;a<k;a++)G=G.add(Z),U.push(G);Z=G.double()}return U}wNAF(E,V,R){if(!this.Fn.isValid(R))throw new Error("invalid scalar");let k=this.ZERO,U=this.BASE;const Z=o(E,this.bits);for(let G=0;G<Z.windows;G++){const{nextN:$,offset:a,isZero:H,isNeg:l,isNegF:u,offsetF:p}=m(R,G,Z);R=$,H?U=U.add(s(u,V[p])):k=k.add(s(l,V[a]))}return y(R),{p:k,f:U}}wNAFUnsafe(E,V,R,k=this.ZERO){const U=o(E,this.bits);for(let Z=0;Z<U.windows&&R!==f;Z++){const{nextN:G,offset:$,isZero:a,isNeg:H}=m(R,Z,U);if(R=G,!a){const l=V[$];k=k.add(H?l.negate():l)}}return y(R),k}getPrecomputes(E,V,R){let k=N.get(V);return k||(k=this.precomputeWindow(V,E),E!==1&&(typeof R=="function"&&(k=R(k)),N.set(V,k))),k}cached(E,V,R){const k=L(E);return this.wNAF(k,this.getPrecomputes(k,E,R),V)}unsafe(E,V,R,k){const U=L(E);return U===1?this._unsafeLadder(E,V,k):this.wNAFUnsafe(U,this.getPrecomputes(U,E,R),V,k)}createCache(E,V){n(V,this.bits),F.set(E,V),N.delete(E)}hasCache(E){return L(E)!==1}}Ke.wNAF=g;function A(B,E,V,R){let k=E,U=B.ZERO,Z=B.ZERO;for(;V>f||R>f;)V&c&&(U=U.add(k)),R&c&&(Z=Z.add(k)),k=k.double(),V>>=c,R>>=c;return{p1:U,p2:Z}}function q(B,E,V,R){w(V,B),O(R,E);const k=V.length,U=R.length;if(k!==U)throw new Error("arrays of points and scalars must have equal length");const Z=B.ZERO,G=(0,e.bitLen)(BigInt(k));let $=1;G>12?$=G-3:G>4?$=G-2:G>0&&($=2);const a=(0,e.bitMask)($),H=new Array(Number(a)+1).fill(Z),l=Math.floor((E.BITS-1)/$)*$;let u=Z;for(let p=l;p>=0;p-=$){H.fill(Z);for(let t=0;t<U;t++){const v=R[t],S=Number(v>>BigInt(p)&a);H[S]=H[S].add(V[t])}let K=Z;for(let t=H.length-1,v=Z;t>0;t--)v=v.add(H[t]),K=K.add(v);if(u=u.add(K),p!==0)for(let t=0;t<$;t++)u=u.double()}return u}function T(B,E,V,R){n(R,E.BITS),w(V,B);const k=B.ZERO,U=2**R-1,Z=Math.ceil(E.BITS/R),G=(0,e.bitMask)(R),$=V.map(a=>{const H=[];for(let l=0,u=a;l<U;l++)H.push(u),u=u.add(a);return H});return a=>{if(O(a,E),a.length>V.length)throw new Error("array of scalars must be smaller than array of points");let H=k;for(let l=0;l<Z;l++){if(H!==k)for(let p=0;p<R;p++)H=H.double();const u=BigInt(Z*R-(l+1)*R);for(let p=0;p<a.length;p++){const K=a[p],t=Number(K>>u&G);t&&(H=H.add($[p][t-1]))}}return H}}function C(B){return(0,r.validateField)(B.Fp),(0,e.validateObject)(B,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,r.nLength)(B.n,B.nBitLength),...B,p:B.Fp.ORDER})}function _(B,E,V){if(E){if(E.ORDER!==B)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return(0,r.validateField)(E),E}else return(0,r.Field)(B,{isLE:V})}function h(B,E,V={},R){if(R===void 0&&(R=B==="edwards"),!E||typeof E!="object")throw new Error(`expected valid ${B} CURVE object`);for(const $ of["p","n","h"]){const a=E[$];if(!(typeof a=="bigint"&&a>f))throw new Error(`CURVE.${$} must be positive bigint`)}const k=_(E.p,V.Fp,R),U=_(E.n,V.Fn,R),G=["Gx","Gy","a",B==="weierstrass"?"b":"d"];for(const $ of G)if(!k.isValid(E[$]))throw new Error(`CURVE.${$} must be valid field element of CURVE.Fp`);return E=Object.freeze(Object.assign({},E)),{CURVE:E,Fp:k,Fn:U}}return Ke}var Ve={},es;function Ko(){if(es)return Ve;es=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.PrimeEdwardsPoint=void 0,Ve.edwards=m,Ve.eddsa=O,Ve.twistedEdwards=L;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=ke(),r=Ft(),f=Ue(),c=BigInt(0),s=BigInt(1),i=BigInt(2),n=BigInt(8);function o(y,g,A,q){const T=y.sqr(A),C=y.sqr(q),_=y.add(y.mul(g.a,T),C),h=y.add(y.ONE,y.mul(g.d,y.mul(T,C)));return y.eql(_,h)}function m(y,g={}){const A=(0,r._createCurveFields)("edwards",y,g,g.FpFnLE),{Fp:q,Fn:T}=A;let C=A.CURVE;const{h:_}=C;(0,e._validateObject)(g,{},{uvRatio:"function"});const h=i<<BigInt(T.BYTES*8)-s,B=$=>q.create($),E=g.uvRatio||(($,a)=>{try{return{isValid:!0,value:q.sqrt(q.div($,a))}}catch{return{isValid:!1,value:c}}});if(!o(q,C,C.Gx,C.Gy))throw new Error("bad curve params: generator point");function V($,a,H=!1){const l=H?s:c;return(0,e.aInRange)("coordinate "+$,a,l,h),a}function R($){if(!($ instanceof Z))throw new Error("ExtendedPoint expected")}const k=(0,e.memoized)(($,a)=>{const{X:H,Y:l,Z:u}=$,p=$.is0();a==null&&(a=p?n:q.inv(u));const K=B(H*a),t=B(l*a),v=q.mul(u,a);if(p)return{x:c,y:s};if(v!==s)throw new Error("invZ was invalid");return{x:K,y:t}}),U=(0,e.memoized)($=>{const{a,d:H}=C;if($.is0())throw new Error("bad point: ZERO");const{X:l,Y:u,Z:p,T:K}=$,t=B(l*l),v=B(u*u),S=B(p*p),x=B(S*S),D=B(t*a),J=B(S*B(D+v)),W=B(x+B(H*B(t*v)));if(J!==W)throw new Error("bad point: equation left != right (1)");const d=B(l*u),M=B(p*K);if(d!==M)throw new Error("bad point: equation left != right (2)");return!0});class Z{constructor(a,H,l,u){this.X=V("x",a),this.Y=V("y",H),this.Z=V("z",l,!0),this.T=V("t",u),Object.freeze(this)}static CURVE(){return C}static fromAffine(a){if(a instanceof Z)throw new Error("extended point not allowed");const{x:H,y:l}=a||{};return V("x",H),V("y",l),new Z(H,l,s,B(H*l))}static fromBytes(a,H=!1){const l=q.BYTES,{a:u,d:p}=C;a=(0,e.copyBytes)((0,e._abytes2)(a,l,"point")),(0,e._abool2)(H,"zip215");const K=(0,e.copyBytes)(a),t=a[l-1];K[l-1]=t&-129;const v=(0,e.bytesToNumberLE)(K),S=H?h:q.ORDER;(0,e.aInRange)("point.y",v,c,S);const x=B(v*v),D=B(x-s),J=B(p*x-u);let{isValid:W,value:d}=E(D,J);if(!W)throw new Error("bad point: invalid y coordinate");const M=(d&s)===s,z=(t&128)!==0;if(!H&&d===c&&z)throw new Error("bad point: x=0 and x_0=1");return z!==M&&(d=B(-d)),Z.fromAffine({x:d,y:v})}static fromHex(a,H=!1){return Z.fromBytes((0,e.ensureBytes)("point",a),H)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(a=8,H=!0){return G.createCache(this,a),H||this.multiply(i),this}assertValidity(){U(this)}equals(a){R(a);const{X:H,Y:l,Z:u}=this,{X:p,Y:K,Z:t}=a,v=B(H*t),S=B(p*u),x=B(l*t),D=B(K*u);return v===S&&x===D}is0(){return this.equals(Z.ZERO)}negate(){return new Z(B(-this.X),this.Y,this.Z,B(-this.T))}double(){const{a}=C,{X:H,Y:l,Z:u}=this,p=B(H*H),K=B(l*l),t=B(i*B(u*u)),v=B(a*p),S=H+l,x=B(B(S*S)-p-K),D=v+K,J=D-t,W=v-K,d=B(x*J),M=B(D*W),z=B(x*W),ee=B(J*D);return new Z(d,M,ee,z)}add(a){R(a);const{a:H,d:l}=C,{X:u,Y:p,Z:K,T:t}=this,{X:v,Y:S,Z:x,T:D}=a,J=B(u*v),W=B(p*S),d=B(t*l*D),M=B(K*x),z=B((u+p)*(v+S)-J-W),ee=M-d,P=M+d,b=B(W-H*J),X=B(z*ee),se=B(P*b),ue=B(z*b),he=B(ee*P);return new Z(X,se,he,ue)}subtract(a){return this.add(a.negate())}multiply(a){if(!T.isValidNot0(a))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:H,f:l}=G.cached(this,a,u=>(0,r.normalizeZ)(Z,u));return(0,r.normalizeZ)(Z,[H,l])[0]}multiplyUnsafe(a,H=Z.ZERO){if(!T.isValid(a))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return a===c?Z.ZERO:this.is0()||a===s?this:G.unsafe(this,a,l=>(0,r.normalizeZ)(Z,l),H)}isSmallOrder(){return this.multiplyUnsafe(_).is0()}isTorsionFree(){return G.unsafe(this,C.n).is0()}toAffine(a){return k(this,a)}clearCofactor(){return _===s?this:this.multiplyUnsafe(_)}toBytes(){const{x:a,y:H}=this.toAffine(),l=q.toBytes(H);return l[l.length-1]|=a&s?128:0,l}toHex(){return(0,e.bytesToHex)(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(a){return(0,r.normalizeZ)(Z,a)}static msm(a,H){return(0,r.pippenger)(Z,T,a,H)}_setWindowSize(a){this.precompute(a)}toRawBytes(){return this.toBytes()}}Z.BASE=new Z(C.Gx,C.Gy,s,B(C.Gx*C.Gy)),Z.ZERO=new Z(c,s,s,c),Z.Fp=q,Z.Fn=T;const G=new r.wNAF(Z,T.BITS);return Z.BASE.precompute(8),Z}class w{constructor(g){this.ep=g}static fromBytes(g){(0,e.notImplemented)()}static fromHex(g){(0,e.notImplemented)()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(g){return this.ep.toAffine(g)}toHex(){return(0,e.bytesToHex)(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(g){return this.assertSame(g),this.init(this.ep.add(g.ep))}subtract(g){return this.assertSame(g),this.init(this.ep.subtract(g.ep))}multiply(g){return this.init(this.ep.multiply(g))}multiplyUnsafe(g){return this.init(this.ep.multiplyUnsafe(g))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(g,A){return this.init(this.ep.precompute(g,A))}toRawBytes(){return this.toBytes()}}Ve.PrimeEdwardsPoint=w;function O(y,g,A={}){if(typeof g!="function")throw new Error('"hash" function param is required');(0,e._validateObject)(A,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:q}=A,{BASE:T,Fp:C,Fn:_}=y,h=A.randomBytes||e.randomBytes,B=A.adjustScalarBytes||(S=>S),E=A.domain||((S,x,D)=>{if((0,e._abool2)(D,"phflag"),x.length||D)throw new Error("Contexts/pre-hash are not supported");return S});function V(S){return _.create((0,e.bytesToNumberLE)(S))}function R(S){const x=l.secretKey;S=(0,e.ensureBytes)("private key",S,x);const D=(0,e.ensureBytes)("hashed private key",g(S),2*x),J=B(D.slice(0,x)),W=D.slice(x,2*x),d=V(J);return{head:J,prefix:W,scalar:d}}function k(S){const{head:x,prefix:D,scalar:J}=R(S),W=T.multiply(J),d=W.toBytes();return{head:x,prefix:D,scalar:J,point:W,pointBytes:d}}function U(S){return k(S).pointBytes}function Z(S=Uint8Array.of(),...x){const D=(0,e.concatBytes)(...x);return V(g(E(D,(0,e.ensureBytes)("context",S),!!q)))}function G(S,x,D={}){S=(0,e.ensureBytes)("message",S),q&&(S=q(S));const{prefix:J,scalar:W,pointBytes:d}=k(x),M=Z(D.context,J,S),z=T.multiply(M).toBytes(),ee=Z(D.context,z,d,S),P=_.create(M+ee*W);if(!_.isValid(P))throw new Error("sign failed: invalid s");const b=(0,e.concatBytes)(z,_.toBytes(P));return(0,e._abytes2)(b,l.signature,"result")}const $={zip215:!0};function a(S,x,D,J=$){const{context:W,zip215:d}=J,M=l.signature;S=(0,e.ensureBytes)("signature",S,M),x=(0,e.ensureBytes)("message",x),D=(0,e.ensureBytes)("publicKey",D,l.publicKey),d!==void 0&&(0,e._abool2)(d,"zip215"),q&&(x=q(x));const z=M/2,ee=S.subarray(0,z),P=(0,e.bytesToNumberLE)(S.subarray(z,M));let b,X,se;try{b=y.fromBytes(D,d),X=y.fromBytes(ee,d),se=T.multiplyUnsafe(P)}catch{return!1}if(!d&&b.isSmallOrder())return!1;const ue=Z(W,X.toBytes(),b.toBytes(),x);return X.add(b.multiplyUnsafe(ue)).subtract(se).clearCofactor().is0()}const H=C.BYTES,l={secretKey:H,publicKey:H,signature:2*H,seed:H};function u(S=h(l.seed)){return(0,e._abytes2)(S,l.seed,"seed")}function p(S){const x=v.randomSecretKey(S);return{secretKey:x,publicKey:U(x)}}function K(S){return(0,e.isBytes)(S)&&S.length===_.BYTES}function t(S,x){try{return!!y.fromBytes(S,x)}catch{return!1}}const v={getExtendedPublicKey:k,randomSecretKey:u,isValidSecretKey:K,isValidPublicKey:t,toMontgomery(S){const{y:x}=y.fromBytes(S),D=l.publicKey,J=D===32;if(!J&&D!==57)throw new Error("only defined for 25519 and 448");const W=J?C.div(s+x,s-x):C.div(x-s,x+s);return C.toBytes(W)},toMontgomerySecret(S){const x=l.secretKey;(0,e._abytes2)(S,x);const D=g(S.subarray(0,x));return B(D).subarray(0,x)},randomPrivateKey:u,precompute(S=8,x=y.BASE){return x.precompute(S,!1)}};return Object.freeze({keygen:p,getPublicKey:U,sign:G,verify:a,utils:v,Point:y,lengths:l})}function N(y){const g={a:y.a,d:y.d,p:y.Fp.ORDER,n:y.n,h:y.h,Gx:y.Gx,Gy:y.Gy},A=y.Fp,q=(0,f.Field)(g.n,y.nBitLength,!0),T={Fp:A,Fn:q,uvRatio:y.uvRatio},C={randomBytes:y.randomBytes,adjustScalarBytes:y.adjustScalarBytes,domain:y.domain,prehash:y.prehash,mapToCurve:y.mapToCurve};return{CURVE:g,curveOpts:T,hash:y.hash,eddsaOpts:C}}function F(y,g){const A=g.Point;return Object.assign({},g,{ExtendedPoint:A,CURVE:y,nBitLength:A.Fn.BITS,nByteLength:A.Fn.BYTES})}function L(y){const{CURVE:g,curveOpts:A,hash:q,eddsaOpts:T}=N(y),C=m(g,A),_=O(C,q,T);return F(y,_)}return Ve}var kt={},ts;function ns(){return ts||(ts=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._DST_scalar=void 0,e.expand_message_xmd=m,e.expand_message_xof=w,e.hash_to_field=O,e.isogenyMap=N,e.createHasher=F;const r=ke(),f=Ue(),c=r.bytesToNumberBE;function s(L,y){if(n(L),n(y),L<0||L>=1<<8*y)throw new Error("invalid I2OSP input: "+L);const g=Array.from({length:y}).fill(0);for(let A=y-1;A>=0;A--)g[A]=L&255,L>>>=8;return new Uint8Array(g)}function i(L,y){const g=new Uint8Array(L.length);for(let A=0;A<L.length;A++)g[A]=L[A]^y[A];return g}function n(L){if(!Number.isSafeInteger(L))throw new Error("number expected")}function o(L){if(!(0,r.isBytes)(L)&&typeof L!="string")throw new Error("DST must be Uint8Array or string");return typeof L=="string"?(0,r.utf8ToBytes)(L):L}function m(L,y,g,A){(0,r.abytes)(L),n(g),y=o(y),y.length>255&&(y=A((0,r.concatBytes)((0,r.utf8ToBytes)("H2C-OVERSIZE-DST-"),y)));const{outputLen:q,blockLen:T}=A,C=Math.ceil(g/q);if(g>65535||C>255)throw new Error("expand_message_xmd: invalid lenInBytes");const _=(0,r.concatBytes)(y,s(y.length,1)),h=s(0,T),B=s(g,2),E=new Array(C),V=A((0,r.concatBytes)(h,L,B,s(0,1),_));E[0]=A((0,r.concatBytes)(V,s(1,1),_));for(let k=1;k<=C;k++){const U=[i(V,E[k-1]),s(k+1,1),_];E[k]=A((0,r.concatBytes)(...U))}return(0,r.concatBytes)(...E).slice(0,g)}function w(L,y,g,A,q){if((0,r.abytes)(L),n(g),y=o(y),y.length>255){const T=Math.ceil(2*A/8);y=q.create({dkLen:T}).update((0,r.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(y).digest()}if(g>65535||y.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return q.create({dkLen:g}).update(L).update(s(g,2)).update(y).update(s(y.length,1)).digest()}function O(L,y,g){(0,r._validateObject)(g,{p:"bigint",m:"number",k:"number",hash:"function"});const{p:A,k:q,m:T,hash:C,expand:_,DST:h}=g;if(!(0,r.isHash)(g.hash))throw new Error("expected valid hash");(0,r.abytes)(L),n(y);const B=A.toString(2).length,E=Math.ceil((B+q)/8),V=y*T*E;let R;if(_==="xmd")R=m(L,h,V,C);else if(_==="xof")R=w(L,h,V,q,C);else if(_==="_internal_pass")R=L;else throw new Error('expand must be "xmd" or "xof"');const k=new Array(y);for(let U=0;U<y;U++){const Z=new Array(T);for(let G=0;G<T;G++){const $=E*(G+U*T),a=R.subarray($,$+E);Z[G]=(0,f.mod)(c(a),A)}k[U]=Z}return k}function N(L,y){const g=y.map(A=>Array.from(A).reverse());return(A,q)=>{const[T,C,_,h]=g.map(V=>V.reduce((R,k)=>L.add(L.mul(R,A),k))),[B,E]=(0,f.FpInvertBatch)(L,[C,h],!0);return A=L.mul(T,B),q=L.mul(q,L.mul(_,E)),{x:A,y:q}}}e._DST_scalar=(0,r.utf8ToBytes)("HashToScalar-");function F(L,y,g){if(typeof y!="function")throw new Error("mapToCurve() must be defined");function A(T){return L.fromAffine(y(T))}function q(T){const C=T.clearCofactor();return C.equals(L.ZERO)?L.ZERO:(C.assertValidity(),C)}return{defaults:g,hashToCurve(T,C){const _=Object.assign({},g,C),h=O(T,2,_),B=A(h[0]),E=A(h[1]);return q(B.add(E))},encodeToCurve(T,C){const _=g.encodeDST?{DST:g.encodeDST}:{},h=Object.assign({},g,_,C),B=O(T,1,h),E=A(B[0]);return q(E)},mapToCurve(T){if(!Array.isArray(T))throw new Error("expected array of bigints");for(const C of T)if(typeof C!="bigint")throw new Error("expected array of bigints");return q(A(T))},hashToScalar(T,C){const _=L.Fn.ORDER,h=Object.assign({},g,{p:_,m:1,DST:e._DST_scalar},C);return O(T,1,h)[0][0]}}}})(kt)),kt}var at={},rs;function Co(){if(rs)return at;rs=1,Object.defineProperty(at,"__esModule",{value:!0}),at.montgomery=n;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=ke(),r=Ue(),f=BigInt(0),c=BigInt(1),s=BigInt(2);function i(o){return(0,e._validateObject)(o,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...o})}function n(o){const m=i(o),{P:w,type:O,adjustScalarBytes:N,powPminus2:F,randomBytes:L}=m,y=O==="x25519";if(!y&&O!=="x448")throw new Error("invalid type");const g=L||e.randomBytes,A=y?255:448,q=y?32:56,T=BigInt(y?9:5),C=BigInt(y?121665:39081),_=y?s**BigInt(254):s**BigInt(447),h=y?BigInt(8)*s**BigInt(251)-c:BigInt(4)*s**BigInt(445)-c,B=_+h+c,E=K=>(0,r.mod)(K,w),V=R(T);function R(K){return(0,e.numberToBytesLE)(E(K),q)}function k(K){const t=(0,e.ensureBytes)("u coordinate",K,q);return y&&(t[31]&=127),E((0,e.bytesToNumberLE)(t))}function U(K){return(0,e.bytesToNumberLE)(N((0,e.ensureBytes)("scalar",K,q)))}function Z(K,t){const v=a(k(t),U(K));if(v===f)throw new Error("invalid private or public key received");return R(v)}function G(K){return Z(K,V)}function $(K,t,v){const S=E(K*(t-v));return t=E(t-S),v=E(v+S),{x_2:t,x_3:v}}function a(K,t){(0,e.aInRange)("u",K,f,w),(0,e.aInRange)("scalar",t,_,B);const v=t,S=K;let x=c,D=f,J=K,W=c,d=f;for(let z=BigInt(A-1);z>=f;z--){const ee=v>>z&c;d^=ee,{x_2:x,x_3:J}=$(d,x,J),{x_2:D,x_3:W}=$(d,D,W),d=ee;const P=x+D,b=E(P*P),X=x-D,se=E(X*X),ue=b-se,he=J+W,pe=J-W,ge=E(pe*P),ye=E(he*X),Se=ge+ye,_e=ge-ye;J=E(Se*Se),W=E(S*E(_e*_e)),x=E(b*se),D=E(ue*(b+E(C*ue)))}({x_2:x,x_3:J}=$(d,x,J)),{x_2:D,x_3:W}=$(d,D,W);const M=F(D);return E(x*M)}const H={secretKey:q,publicKey:q,seed:q},l=(K=g(q))=>((0,e.abytes)(K,H.seed),K);function u(K){const t=l(K);return{secretKey:t,publicKey:G(t)}}return{keygen:u,getSharedSecret:(K,t)=>Z(K,t),getPublicKey:K=>G(K),scalarMult:Z,scalarMultBase:G,utils:{randomSecretKey:l,randomPrivateKey:l},GuBytes:V.slice(),lengths:H}}return at}var ss;function Ho(){return ss||(ss=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hash_to_ristretto255=e.hashToRistretto255=e.encodeToCurve=e.hashToCurve=e.RistrettoPoint=e.edwardsToMontgomery=e.ED25519_TORSION_SUBGROUP=e.ristretto255_hasher=e.ristretto255=e.ed25519_hasher=e.x25519=e.ed25519ph=e.ed25519ctx=e.ed25519=void 0,e.edwardsToMontgomeryPub=J,e.edwardsToMontgomeryPriv=W;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=qt(),f=qe(),c=Ft(),s=Ko(),i=ns(),n=Ue(),o=Co(),m=ke(),w=BigInt(0),O=BigInt(1),N=BigInt(2),F=BigInt(3),L=BigInt(5),y=BigInt(8),g=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),A={p:g,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:y,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function q(d){const M=BigInt(10),z=BigInt(20),ee=BigInt(40),P=BigInt(80),b=g,se=d*d%b*d%b,ue=(0,n.pow2)(se,N,b)*se%b,he=(0,n.pow2)(ue,O,b)*d%b,pe=(0,n.pow2)(he,L,b)*he%b,ge=(0,n.pow2)(pe,M,b)*pe%b,ye=(0,n.pow2)(ge,z,b)*ge%b,Se=(0,n.pow2)(ye,ee,b)*ye%b,_e=(0,n.pow2)(Se,P,b)*Se%b,ae=(0,n.pow2)(_e,P,b)*Se%b,ne=(0,n.pow2)(ae,M,b)*pe%b;return{pow_p_5_8:(0,n.pow2)(ne,N,b)*d%b,b2:se}}function T(d){return d[0]&=248,d[31]&=127,d[31]|=64,d}const C=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function _(d,M){const z=g,ee=(0,n.mod)(M*M*M,z),P=(0,n.mod)(ee*ee*M,z),b=q(d*P).pow_p_5_8;let X=(0,n.mod)(d*ee*b,z);const se=(0,n.mod)(M*X*X,z),ue=X,he=(0,n.mod)(X*C,z),pe=se===d,ge=se===(0,n.mod)(-d,z),ye=se===(0,n.mod)(-d*C,z);return pe&&(X=ue),(ge||ye)&&(X=he),(0,n.isNegativeLE)(X,z)&&(X=(0,n.mod)(-X,z)),{isValid:pe||ge,value:X}}const h=(0,n.Field)(A.p,{isLE:!0}),B=(0,n.Field)(A.n,{isLE:!0}),E={...A,Fp:h,hash:r.sha512,adjustScalarBytes:T,uvRatio:_};e.ed25519=(0,s.twistedEdwards)(E);function V(d,M,z){if(M.length>255)throw new Error("Context is too big");return(0,f.concatBytes)((0,f.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([z?1:0,M.length]),M,d)}e.ed25519ctx=(0,s.twistedEdwards)({...E,domain:V}),e.ed25519ph=(0,s.twistedEdwards)(Object.assign({},E,{domain:V,prehash:r.sha512})),e.x25519=(()=>{const d=h.ORDER;return(0,o.montgomery)({P:d,type:"x25519",powPminus2:M=>{const{pow_p_5_8:z,b2:ee}=q(M);return(0,n.mod)((0,n.pow2)(z,F,d)*ee,d)},adjustScalarBytes:T})})();const R=(g+F)/y,k=h.pow(N,R),U=h.sqrt(h.neg(h.ONE));function Z(d){const M=(g-L)/y,z=BigInt(486662);let ee=h.sqr(d);ee=h.mul(ee,N);let P=h.add(ee,h.ONE),b=h.neg(z),X=h.sqr(P),se=h.mul(X,P),ue=h.mul(ee,z);ue=h.mul(ue,b),ue=h.add(ue,X),ue=h.mul(ue,b);let he=h.sqr(se);X=h.sqr(he),he=h.mul(he,se),he=h.mul(he,ue),X=h.mul(X,he);let pe=h.pow(X,M);pe=h.mul(pe,he);let ge=h.mul(pe,U);X=h.sqr(pe),X=h.mul(X,se);let ye=h.eql(X,ue),Se=h.cmov(ge,pe,ye),_e=h.mul(b,ee),ae=h.mul(pe,d);ae=h.mul(ae,k);let ne=h.mul(ae,U),te=h.mul(ue,ee);X=h.sqr(ae),X=h.mul(X,se);let j=h.eql(X,te),ie=h.cmov(ne,ae,j);X=h.sqr(Se),X=h.mul(X,se);let Q=h.eql(X,ue),ce=h.cmov(_e,b,Q),le=h.cmov(ie,Se,Q),de=h.isOdd(le);return le=h.cmov(le,h.neg(le),Q!==de),{xMn:ce,xMd:P,yMn:le,yMd:O}}const G=(0,n.FpSqrtEven)(h,h.neg(BigInt(486664)));function $(d){const{xMn:M,xMd:z,yMn:ee,yMd:P}=Z(d);let b=h.mul(M,P);b=h.mul(b,G);let X=h.mul(z,ee),se=h.sub(M,z),ue=h.add(M,z),he=h.mul(X,ue),pe=h.eql(he,h.ZERO);b=h.cmov(b,h.ZERO,pe),X=h.cmov(X,h.ONE,pe),se=h.cmov(se,h.ONE,pe),ue=h.cmov(ue,h.ONE,pe);const[ge,ye]=(0,n.FpInvertBatch)(h,[X,ue],!0);return{x:h.mul(b,ge),y:h.mul(se,ye)}}e.ed25519_hasher=(0,i.createHasher)(e.ed25519.Point,d=>$(d[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:g,m:1,k:128,expand:"xmd",hash:r.sha512});const a=C,H=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),l=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),u=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),p=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),K=d=>_(O,d),t=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),v=d=>e.ed25519.Point.Fp.create((0,m.bytesToNumberLE)(d)&t);function S(d){const{d:M}=A,z=g,ee=te=>h.create(te),P=ee(a*d*d),b=ee((P+O)*u);let X=BigInt(-1);const se=ee((X-M*P)*ee(P+M));let{isValid:ue,value:he}=_(b,se),pe=ee(he*d);(0,n.isNegativeLE)(pe,z)||(pe=ee(-pe)),ue||(he=pe),ue||(X=P);const ge=ee(X*(P-O)*p-se),ye=he*he,Se=ee((he+he)*se),_e=ee(ge*H),ae=ee(O-ye),ne=ee(O+ye);return new e.ed25519.Point(ee(Se*ne),ee(ae*_e),ee(_e*ne),ee(Se*ae))}function x(d){(0,f.abytes)(d,64);const M=v(d.subarray(0,32)),z=S(M),ee=v(d.subarray(32,64)),P=S(ee);return new D(z.add(P))}class D extends s.PrimeEdwardsPoint{constructor(M){super(M)}static fromAffine(M){return new D(e.ed25519.Point.fromAffine(M))}assertSame(M){if(!(M instanceof D))throw new Error("RistrettoPoint expected")}init(M){return new D(M)}static hashToCurve(M){return x((0,m.ensureBytes)("ristrettoHash",M,64))}static fromBytes(M){(0,f.abytes)(M,32);const{a:z,d:ee}=A,P=g,b=Q=>h.create(Q),X=v(M);if(!(0,m.equalBytes)(h.toBytes(X),M)||(0,n.isNegativeLE)(X,P))throw new Error("invalid ristretto255 encoding 1");const se=b(X*X),ue=b(O+z*se),he=b(O-z*se),pe=b(ue*ue),ge=b(he*he),ye=b(z*ee*pe-ge),{isValid:Se,value:_e}=K(b(ye*ge)),ae=b(_e*he),ne=b(_e*ae*ye);let te=b((X+X)*ae);(0,n.isNegativeLE)(te,P)&&(te=b(-te));const j=b(ue*ne),ie=b(te*j);if(!Se||(0,n.isNegativeLE)(ie,P)||j===w)throw new Error("invalid ristretto255 encoding 2");return new D(new e.ed25519.Point(te,j,O,ie))}static fromHex(M){return D.fromBytes((0,m.ensureBytes)("ristrettoHex",M,32))}static msm(M,z){return(0,c.pippenger)(D,e.ed25519.Point.Fn,M,z)}toBytes(){let{X:M,Y:z,Z:ee,T:P}=this.ep;const b=g,X=ne=>h.create(ne),se=X(X(ee+z)*X(ee-z)),ue=X(M*z),he=X(ue*ue),{value:pe}=K(X(se*he)),ge=X(pe*se),ye=X(pe*ue),Se=X(ge*ye*P);let _e;if((0,n.isNegativeLE)(P*Se,b)){let ne=X(z*a),te=X(M*a);M=ne,z=te,_e=X(ge*l)}else _e=ye;(0,n.isNegativeLE)(M*Se,b)&&(z=X(-z));let ae=X((ee-z)*_e);return(0,n.isNegativeLE)(ae,b)&&(ae=X(-ae)),h.toBytes(ae)}equals(M){this.assertSame(M);const{X:z,Y:ee}=this.ep,{X:P,Y:b}=M.ep,X=he=>h.create(he),se=X(z*b)===X(ee*P),ue=X(ee*b)===X(z*P);return se||ue}is0(){return this.equals(D.ZERO)}}D.BASE=new D(e.ed25519.Point.BASE),D.ZERO=new D(e.ed25519.Point.ZERO),D.Fp=h,D.Fn=B,e.ristretto255={Point:D},e.ristretto255_hasher={hashToCurve(d,M){const z=M?.DST||"ristretto255_XMD:SHA-512_R255MAP_RO_",ee=(0,i.expand_message_xmd)(d,z,64,r.sha512);return x(ee)},hashToScalar(d,M={DST:i._DST_scalar}){const z=(0,i.expand_message_xmd)(d,M.DST,64,r.sha512);return B.create((0,m.bytesToNumberLE)(z))}},e.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];function J(d){return e.ed25519.utils.toMontgomery((0,m.ensureBytes)("pub",d))}e.edwardsToMontgomery=J;function W(d){return e.ed25519.utils.toMontgomerySecret((0,m.ensureBytes)("pub",d))}e.RistrettoPoint=D,e.hashToCurve=e.ed25519_hasher.hashToCurve,e.encodeToCurve=e.ed25519_hasher.encodeToCurve,e.hashToRistretto255=e.ristretto255_hasher.hashToCurve,e.hash_to_ristretto255=e.ristretto255_hasher.hashToCurve})(Nt)),Nt}var Vt={},Je={},jt={},Mt={},is;function os(){return is||(is=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const r=qe();class f extends r.Hash{constructor(i,n){super(),this.finished=!1,this.destroyed=!1,(0,r.ahash)(i);const o=(0,r.toBytes)(n);if(this.iHash=i.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const m=this.blockLen,w=new Uint8Array(m);w.set(o.length>m?i.create().update(o).digest():o);for(let O=0;O<w.length;O++)w[O]^=54;this.iHash.update(w),this.oHash=i.create();for(let O=0;O<w.length;O++)w[O]^=106;this.oHash.update(w),(0,r.clean)(w)}update(i){return(0,r.aexists)(this),this.iHash.update(i),this}digestInto(i){(0,r.aexists)(this),(0,r.abytes)(i,this.outputLen),this.finished=!0,this.iHash.digestInto(i),this.oHash.update(i),this.oHash.digestInto(i),this.destroy()}digest(){const i=new Uint8Array(this.oHash.outputLen);return this.digestInto(i),i}_cloneInto(i){i||(i=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:o,finished:m,destroyed:w,blockLen:O,outputLen:N}=this;return i=i,i.finished=m,i.destroyed=w,i.blockLen=O,i.outputLen=N,i.oHash=n._cloneInto(i.oHash),i.iHash=o._cloneInto(i.iHash),i}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=f;const c=(s,i,n)=>new f(s,i).update(n).digest();e.hmac=c,e.hmac.create=(s,i)=>new f(s,i)})(Mt)),Mt}var cs;function as(){return cs||(cs=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=e.DERErr=void 0,e._splitEndoScalar=o,e._normFnElement=A,e.weierstrassN=q,e.SWUFpSqrtRatio=C,e.mapToCurveSimpleSWU=_,e.ecdh=B,e.ecdsa=E,e.weierstrassPoints=V,e._legacyHelperEquat=U,e.weierstrass=$;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=os(),f=qe(),c=ke(),s=Ft(),i=Ue(),n=(a,H)=>(a+(a>=0?H:-H)/L)/H;function o(a,H,l){const[[u,p],[K,t]]=H,v=n(t*a,l),S=n(-p*a,l);let x=a-v*u-S*K,D=-v*p-S*t;const J=x<N,W=D<N;J&&(x=-x),W&&(D=-D);const d=(0,c.bitMask)(Math.ceil((0,c.bitLen)(l)/2))+F;if(x<N||x>=d||D<N||D>=d)throw new Error("splitScalar (endomorphism): failed, k="+a);return{k1neg:J,k1:x,k2neg:W,k2:D}}function m(a){if(!["compact","recovered","der"].includes(a))throw new Error('Signature format must be "compact", "recovered", or "der"');return a}function w(a,H){const l={};for(let u of Object.keys(H))l[u]=a[u]===void 0?H[u]:a[u];return(0,c._abool2)(l.lowS,"lowS"),(0,c._abool2)(l.prehash,"prehash"),l.format!==void 0&&m(l.format),l}class O extends Error{constructor(H=""){super(H)}}e.DERErr=O,e.DER={Err:O,_tlv:{encode:(a,H)=>{const{Err:l}=e.DER;if(a<0||a>256)throw new l("tlv.encode: wrong tag");if(H.length&1)throw new l("tlv.encode: unpadded data");const u=H.length/2,p=(0,c.numberToHexUnpadded)(u);if(p.length/2&128)throw new l("tlv.encode: long form length too big");const K=u>127?(0,c.numberToHexUnpadded)(p.length/2|128):"";return(0,c.numberToHexUnpadded)(a)+K+p+H},decode(a,H){const{Err:l}=e.DER;let u=0;if(a<0||a>256)throw new l("tlv.encode: wrong tag");if(H.length<2||H[u++]!==a)throw new l("tlv.decode: wrong tlv");const p=H[u++],K=!!(p&128);let t=0;if(!K)t=p;else{const S=p&127;if(!S)throw new l("tlv.decode(long): indefinite length not supported");if(S>4)throw new l("tlv.decode(long): byte length is too big");const x=H.subarray(u,u+S);if(x.length!==S)throw new l("tlv.decode: length bytes not complete");if(x[0]===0)throw new l("tlv.decode(long): zero leftmost byte");for(const D of x)t=t<<8|D;if(u+=S,t<128)throw new l("tlv.decode(long): not minimal encoding")}const v=H.subarray(u,u+t);if(v.length!==t)throw new l("tlv.decode: wrong value length");return{v,l:H.subarray(u+t)}}},_int:{encode(a){const{Err:H}=e.DER;if(a<N)throw new H("integer: negative integers are not allowed");let l=(0,c.numberToHexUnpadded)(a);if(Number.parseInt(l[0],16)&8&&(l="00"+l),l.length&1)throw new H("unexpected DER parsing assertion: unpadded hex");return l},decode(a){const{Err:H}=e.DER;if(a[0]&128)throw new H("invalid signature integer: negative");if(a[0]===0&&!(a[1]&128))throw new H("invalid signature integer: unnecessary leading zero");return(0,c.bytesToNumberBE)(a)}},toSig(a){const{Err:H,_int:l,_tlv:u}=e.DER,p=(0,c.ensureBytes)("signature",a),{v:K,l:t}=u.decode(48,p);if(t.length)throw new H("invalid signature: left bytes after parsing");const{v,l:S}=u.decode(2,K),{v:x,l:D}=u.decode(2,S);if(D.length)throw new H("invalid signature: left bytes after parsing");return{r:l.decode(v),s:l.decode(x)}},hexFromSig(a){const{_tlv:H,_int:l}=e.DER,u=H.encode(2,l.encode(a.r)),p=H.encode(2,l.encode(a.s)),K=u+p;return H.encode(48,K)}};const N=BigInt(0),F=BigInt(1),L=BigInt(2),y=BigInt(3),g=BigInt(4);function A(a,H){const{BYTES:l}=a;let u;if(typeof H=="bigint")u=H;else{let p=(0,c.ensureBytes)("private key",H);try{u=a.fromBytes(p)}catch{throw new Error(`invalid private key: expected ui8a of size ${l}, got ${typeof H}`)}}if(!a.isValidNot0(u))throw new Error("invalid private key: out of range [1..N-1]");return u}function q(a,H={}){const l=(0,s._createCurveFields)("weierstrass",a,H),{Fp:u,Fn:p}=l;let K=l.CURVE;const{h:t,n:v}=K;(0,c._validateObject)(H,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:S}=H;if(S&&(!u.is0(K.a)||typeof S.beta!="bigint"||!Array.isArray(S.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const x=h(u,p);function D(){if(!u.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function J(ae,ne,te){const{x:j,y:ie}=ne.toAffine(),Q=u.toBytes(j);if((0,c._abool2)(te,"isCompressed"),te){D();const ce=!u.isOdd(ie);return(0,c.concatBytes)(T(ce),Q)}else return(0,c.concatBytes)(Uint8Array.of(4),Q,u.toBytes(ie))}function W(ae){(0,c._abytes2)(ae,void 0,"Point");const{publicKey:ne,publicKeyUncompressed:te}=x,j=ae.length,ie=ae[0],Q=ae.subarray(1);if(j===ne&&(ie===2||ie===3)){const ce=u.fromBytes(Q);if(!u.isValid(ce))throw new Error("bad point: is not on curve, wrong x");const le=z(ce);let de;try{de=u.sqrt(le)}catch(re){const oe=re instanceof Error?": "+re.message:"";throw new Error("bad point: is not on curve, sqrt error"+oe)}D();const I=u.isOdd(de);return(ie&1)===1!==I&&(de=u.neg(de)),{x:ce,y:de}}else if(j===te&&ie===4){const ce=u.BYTES,le=u.fromBytes(Q.subarray(0,ce)),de=u.fromBytes(Q.subarray(ce,ce*2));if(!ee(le,de))throw new Error("bad point: is not on curve");return{x:le,y:de}}else throw new Error(`bad point: got length ${j}, expected compressed=${ne} or uncompressed=${te}`)}const d=H.toBytes||J,M=H.fromBytes||W;function z(ae){const ne=u.sqr(ae),te=u.mul(ne,ae);return u.add(u.add(te,u.mul(ae,K.a)),K.b)}function ee(ae,ne){const te=u.sqr(ne),j=z(ae);return u.eql(te,j)}if(!ee(K.Gx,K.Gy))throw new Error("bad curve params: generator point");const P=u.mul(u.pow(K.a,y),g),b=u.mul(u.sqr(K.b),BigInt(27));if(u.is0(u.add(P,b)))throw new Error("bad curve params: a or b");function X(ae,ne,te=!1){if(!u.isValid(ne)||te&&u.is0(ne))throw new Error(`bad point coordinate ${ae}`);return ne}function se(ae){if(!(ae instanceof ye))throw new Error("ProjectivePoint expected")}function ue(ae){if(!S||!S.basises)throw new Error("no endo");return o(ae,S.basises,p.ORDER)}const he=(0,c.memoized)((ae,ne)=>{const{X:te,Y:j,Z:ie}=ae;if(u.eql(ie,u.ONE))return{x:te,y:j};const Q=ae.is0();ne==null&&(ne=Q?u.ONE:u.inv(ie));const ce=u.mul(te,ne),le=u.mul(j,ne),de=u.mul(ie,ne);if(Q)return{x:u.ZERO,y:u.ZERO};if(!u.eql(de,u.ONE))throw new Error("invZ was invalid");return{x:ce,y:le}}),pe=(0,c.memoized)(ae=>{if(ae.is0()){if(H.allowInfinityPoint&&!u.is0(ae.Y))return;throw new Error("bad point: ZERO")}const{x:ne,y:te}=ae.toAffine();if(!u.isValid(ne)||!u.isValid(te))throw new Error("bad point: x or y not field elements");if(!ee(ne,te))throw new Error("bad point: equation left != right");if(!ae.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function ge(ae,ne,te,j,ie){return te=new ye(u.mul(te.X,ae),te.Y,te.Z),ne=(0,s.negateCt)(j,ne),te=(0,s.negateCt)(ie,te),ne.add(te)}class ye{constructor(ne,te,j){this.X=X("x",ne),this.Y=X("y",te,!0),this.Z=X("z",j),Object.freeze(this)}static CURVE(){return K}static fromAffine(ne){const{x:te,y:j}=ne||{};if(!ne||!u.isValid(te)||!u.isValid(j))throw new Error("invalid affine point");if(ne instanceof ye)throw new Error("projective point not allowed");return u.is0(te)&&u.is0(j)?ye.ZERO:new ye(te,j,u.ONE)}static fromBytes(ne){const te=ye.fromAffine(M((0,c._abytes2)(ne,void 0,"point")));return te.assertValidity(),te}static fromHex(ne){return ye.fromBytes((0,c.ensureBytes)("pointHex",ne))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(ne=8,te=!0){return _e.createCache(this,ne),te||this.multiply(y),this}assertValidity(){pe(this)}hasEvenY(){const{y:ne}=this.toAffine();if(!u.isOdd)throw new Error("Field doesn't support isOdd");return!u.isOdd(ne)}equals(ne){se(ne);const{X:te,Y:j,Z:ie}=this,{X:Q,Y:ce,Z:le}=ne,de=u.eql(u.mul(te,le),u.mul(Q,ie)),I=u.eql(u.mul(j,le),u.mul(ce,ie));return de&&I}negate(){return new ye(this.X,u.neg(this.Y),this.Z)}double(){const{a:ne,b:te}=K,j=u.mul(te,y),{X:ie,Y:Q,Z:ce}=this;let le=u.ZERO,de=u.ZERO,I=u.ZERO,Y=u.mul(ie,ie),re=u.mul(Q,Q),oe=u.mul(ce,ce),fe=u.mul(ie,Q);return fe=u.add(fe,fe),I=u.mul(ie,ce),I=u.add(I,I),le=u.mul(ne,I),de=u.mul(j,oe),de=u.add(le,de),le=u.sub(re,de),de=u.add(re,de),de=u.mul(le,de),le=u.mul(fe,le),I=u.mul(j,I),oe=u.mul(ne,oe),fe=u.sub(Y,oe),fe=u.mul(ne,fe),fe=u.add(fe,I),I=u.add(Y,Y),Y=u.add(I,Y),Y=u.add(Y,oe),Y=u.mul(Y,fe),de=u.add(de,Y),oe=u.mul(Q,ce),oe=u.add(oe,oe),Y=u.mul(oe,fe),le=u.sub(le,Y),I=u.mul(oe,re),I=u.add(I,I),I=u.add(I,I),new ye(le,de,I)}add(ne){se(ne);const{X:te,Y:j,Z:ie}=this,{X:Q,Y:ce,Z:le}=ne;let de=u.ZERO,I=u.ZERO,Y=u.ZERO;const re=K.a,oe=u.mul(K.b,y);let fe=u.mul(te,Q),ve=u.mul(j,ce),be=u.mul(ie,le),Ee=u.add(te,j),we=u.add(Q,ce);Ee=u.mul(Ee,we),we=u.add(fe,ve),Ee=u.sub(Ee,we),we=u.add(te,ie);let Be=u.add(Q,le);return we=u.mul(we,Be),Be=u.add(fe,be),we=u.sub(we,Be),Be=u.add(j,ie),de=u.add(ce,le),Be=u.mul(Be,de),de=u.add(ve,be),Be=u.sub(Be,de),Y=u.mul(re,we),de=u.mul(oe,be),Y=u.add(de,Y),de=u.sub(ve,Y),Y=u.add(ve,Y),I=u.mul(de,Y),ve=u.add(fe,fe),ve=u.add(ve,fe),be=u.mul(re,be),we=u.mul(oe,we),ve=u.add(ve,be),be=u.sub(fe,be),be=u.mul(re,be),we=u.add(we,be),fe=u.mul(ve,we),I=u.add(I,fe),fe=u.mul(Be,we),de=u.mul(Ee,de),de=u.sub(de,fe),fe=u.mul(Ee,ve),Y=u.mul(Be,Y),Y=u.add(Y,fe),new ye(de,I,Y)}subtract(ne){return this.add(ne.negate())}is0(){return this.equals(ye.ZERO)}multiply(ne){const{endo:te}=H;if(!p.isValidNot0(ne))throw new Error("invalid scalar: out of range");let j,ie;const Q=ce=>_e.cached(this,ce,le=>(0,s.normalizeZ)(ye,le));if(te){const{k1neg:ce,k1:le,k2neg:de,k2:I}=ue(ne),{p:Y,f:re}=Q(le),{p:oe,f:fe}=Q(I);ie=re.add(fe),j=ge(te.beta,Y,oe,ce,de)}else{const{p:ce,f:le}=Q(ne);j=ce,ie=le}return(0,s.normalizeZ)(ye,[j,ie])[0]}multiplyUnsafe(ne){const{endo:te}=H,j=this;if(!p.isValid(ne))throw new Error("invalid scalar: out of range");if(ne===N||j.is0())return ye.ZERO;if(ne===F)return j;if(_e.hasCache(this))return this.multiply(ne);if(te){const{k1neg:ie,k1:Q,k2neg:ce,k2:le}=ue(ne),{p1:de,p2:I}=(0,s.mulEndoUnsafe)(ye,j,Q,le);return ge(te.beta,de,I,ie,ce)}else return _e.unsafe(j,ne)}multiplyAndAddUnsafe(ne,te,j){const ie=this.multiplyUnsafe(te).add(ne.multiplyUnsafe(j));return ie.is0()?void 0:ie}toAffine(ne){return he(this,ne)}isTorsionFree(){const{isTorsionFree:ne}=H;return t===F?!0:ne?ne(ye,this):_e.unsafe(this,v).is0()}clearCofactor(){const{clearCofactor:ne}=H;return t===F?this:ne?ne(ye,this):this.multiplyUnsafe(t)}isSmallOrder(){return this.multiplyUnsafe(t).is0()}toBytes(ne=!0){return(0,c._abool2)(ne,"isCompressed"),this.assertValidity(),d(ye,this,ne)}toHex(ne=!0){return(0,c.bytesToHex)(this.toBytes(ne))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(ne=!0){return this.toBytes(ne)}_setWindowSize(ne){this.precompute(ne)}static normalizeZ(ne){return(0,s.normalizeZ)(ye,ne)}static msm(ne,te){return(0,s.pippenger)(ye,p,ne,te)}static fromPrivateKey(ne){return ye.BASE.multiply(A(p,ne))}}ye.BASE=new ye(K.Gx,K.Gy,u.ONE),ye.ZERO=new ye(u.ZERO,u.ONE,u.ZERO),ye.Fp=u,ye.Fn=p;const Se=p.BITS,_e=new s.wNAF(ye,H.endo?Math.ceil(Se/2):Se);return ye.BASE.precompute(8),ye}function T(a){return Uint8Array.of(a?2:3)}function C(a,H){const l=a.ORDER;let u=N;for(let M=l-F;M%L===N;M/=L)u+=F;const p=u,K=L<<p-F-F,t=K*L,v=(l-F)/t,S=(v-F)/L,x=t-F,D=K,J=a.pow(H,v),W=a.pow(H,(v+F)/L);let d=(M,z)=>{let ee=J,P=a.pow(z,x),b=a.sqr(P);b=a.mul(b,z);let X=a.mul(M,b);X=a.pow(X,S),X=a.mul(X,P),P=a.mul(X,z),b=a.mul(X,M);let se=a.mul(b,P);X=a.pow(se,D);let ue=a.eql(X,a.ONE);P=a.mul(b,W),X=a.mul(se,ee),b=a.cmov(P,b,ue),se=a.cmov(X,se,ue);for(let he=p;he>F;he--){let pe=he-L;pe=L<<pe-F;let ge=a.pow(se,pe);const ye=a.eql(ge,a.ONE);P=a.mul(b,ee),ee=a.mul(ee,ee),ge=a.mul(se,ee),b=a.cmov(P,b,ye),se=a.cmov(ge,se,ye)}return{isValid:ue,value:b}};if(a.ORDER%g===y){const M=(a.ORDER-y)/g,z=a.sqrt(a.neg(H));d=(ee,P)=>{let b=a.sqr(P);const X=a.mul(ee,P);b=a.mul(b,X);let se=a.pow(b,M);se=a.mul(se,X);const ue=a.mul(se,z),he=a.mul(a.sqr(se),P),pe=a.eql(he,ee);let ge=a.cmov(ue,se,pe);return{isValid:pe,value:ge}}}return d}function _(a,H){(0,i.validateField)(a);const{A:l,B:u,Z:p}=H;if(!a.isValid(l)||!a.isValid(u)||!a.isValid(p))throw new Error("mapToCurveSimpleSWU: invalid opts");const K=C(a,p);if(!a.isOdd)throw new Error("Field does not have .isOdd()");return t=>{let v,S,x,D,J,W,d,M;v=a.sqr(t),v=a.mul(v,p),S=a.sqr(v),S=a.add(S,v),x=a.add(S,a.ONE),x=a.mul(x,u),D=a.cmov(p,a.neg(S),!a.eql(S,a.ZERO)),D=a.mul(D,l),S=a.sqr(x),W=a.sqr(D),J=a.mul(W,l),S=a.add(S,J),S=a.mul(S,x),W=a.mul(W,D),J=a.mul(W,u),S=a.add(S,J),d=a.mul(v,x);const{isValid:z,value:ee}=K(S,W);M=a.mul(v,t),M=a.mul(M,ee),d=a.cmov(d,x,z),M=a.cmov(M,ee,z);const P=a.isOdd(t)===a.isOdd(M);M=a.cmov(a.neg(M),M,P);const b=(0,i.FpInvertBatch)(a,[D],!0)[0];return d=a.mul(d,b),{x:d,y:M}}}function h(a,H){return{secretKey:H.BYTES,publicKey:1+a.BYTES,publicKeyUncompressed:1+2*a.BYTES,publicKeyHasPrefix:!0,signature:2*H.BYTES}}function B(a,H={}){const{Fn:l}=a,u=H.randomBytes||c.randomBytes,p=Object.assign(h(a.Fp,l),{seed:(0,i.getMinHashLength)(l.ORDER)});function K(d){try{return!!A(l,d)}catch{return!1}}function t(d,M){const{publicKey:z,publicKeyUncompressed:ee}=p;try{const P=d.length;return M===!0&&P!==z||M===!1&&P!==ee?!1:!!a.fromBytes(d)}catch{return!1}}function v(d=u(p.seed)){return(0,i.mapHashToField)((0,c._abytes2)(d,p.seed,"seed"),l.ORDER)}function S(d,M=!0){return a.BASE.multiply(A(l,d)).toBytes(M)}function x(d){const M=v(d);return{secretKey:M,publicKey:S(M)}}function D(d){if(typeof d=="bigint")return!1;if(d instanceof a)return!0;const{secretKey:M,publicKey:z,publicKeyUncompressed:ee}=p;if(l.allowedLengths||M===z)return;const P=(0,c.ensureBytes)("key",d).length;return P===z||P===ee}function J(d,M,z=!0){if(D(d)===!0)throw new Error("first arg must be private key");if(D(M)===!1)throw new Error("second arg must be public key");const ee=A(l,d);return a.fromHex(M).multiply(ee).toBytes(z)}return Object.freeze({getPublicKey:S,getSharedSecret:J,keygen:x,Point:a,utils:{isValidSecretKey:K,isValidPublicKey:t,randomSecretKey:v,isValidPrivateKey:K,randomPrivateKey:v,normPrivateKeyToScalar:d=>A(l,d),precompute(d=8,M=a.BASE){return M.precompute(d,!1)}},lengths:p})}function E(a,H,l={}){(0,f.ahash)(H),(0,c._validateObject)(l,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const u=l.randomBytes||c.randomBytes,p=l.hmac||((te,...j)=>(0,r.hmac)(H,te,(0,c.concatBytes)(...j))),{Fp:K,Fn:t}=a,{ORDER:v,BITS:S}=t,{keygen:x,getPublicKey:D,getSharedSecret:J,utils:W,lengths:d}=B(a,l),M={prehash:!1,lowS:typeof l.lowS=="boolean"?l.lowS:!1,format:void 0,extraEntropy:!1},z="compact";function ee(te){const j=v>>F;return te>j}function P(te,j){if(!t.isValidNot0(j))throw new Error(`invalid signature ${te}: out of range 1..Point.Fn.ORDER`);return j}function b(te,j){m(j);const ie=d.signature,Q=j==="compact"?ie:j==="recovered"?ie+1:void 0;return(0,c._abytes2)(te,Q,`${j} signature`)}class X{constructor(j,ie,Q){this.r=P("r",j),this.s=P("s",ie),Q!=null&&(this.recovery=Q),Object.freeze(this)}static fromBytes(j,ie=z){b(j,ie);let Q;if(ie==="der"){const{r:I,s:Y}=e.DER.toSig((0,c._abytes2)(j));return new X(I,Y)}ie==="recovered"&&(Q=j[0],ie="compact",j=j.subarray(1));const ce=t.BYTES,le=j.subarray(0,ce),de=j.subarray(ce,ce*2);return new X(t.fromBytes(le),t.fromBytes(de),Q)}static fromHex(j,ie){return this.fromBytes((0,c.hexToBytes)(j),ie)}addRecoveryBit(j){return new X(this.r,this.s,j)}recoverPublicKey(j){const ie=K.ORDER,{r:Q,s:ce,recovery:le}=this;if(le==null||![0,1,2,3].includes(le))throw new Error("recovery id invalid");if(v*L<ie&&le>1)throw new Error("recovery id is ambiguous for h>1 curve");const I=le===2||le===3?Q+v:Q;if(!K.isValid(I))throw new Error("recovery id 2 or 3 invalid");const Y=K.toBytes(I),re=a.fromBytes((0,c.concatBytes)(T((le&1)===0),Y)),oe=t.inv(I),fe=ue((0,c.ensureBytes)("msgHash",j)),ve=t.create(-fe*oe),be=t.create(ce*oe),Ee=a.BASE.multiplyUnsafe(ve).add(re.multiplyUnsafe(be));if(Ee.is0())throw new Error("point at infinify");return Ee.assertValidity(),Ee}hasHighS(){return ee(this.s)}toBytes(j=z){if(m(j),j==="der")return(0,c.hexToBytes)(e.DER.hexFromSig(this));const ie=t.toBytes(this.r),Q=t.toBytes(this.s);if(j==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return(0,c.concatBytes)(Uint8Array.of(this.recovery),ie,Q)}return(0,c.concatBytes)(ie,Q)}toHex(j){return(0,c.bytesToHex)(this.toBytes(j))}assertValidity(){}static fromCompact(j){return X.fromBytes((0,c.ensureBytes)("sig",j),"compact")}static fromDER(j){return X.fromBytes((0,c.ensureBytes)("sig",j),"der")}normalizeS(){return this.hasHighS()?new X(this.r,t.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return(0,c.bytesToHex)(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return(0,c.bytesToHex)(this.toBytes("compact"))}}const se=l.bits2int||function(j){if(j.length>8192)throw new Error("input is too large");const ie=(0,c.bytesToNumberBE)(j),Q=j.length*8-S;return Q>0?ie>>BigInt(Q):ie},ue=l.bits2int_modN||function(j){return t.create(se(j))},he=(0,c.bitMask)(S);function pe(te){return(0,c.aInRange)("num < 2^"+S,te,N,he),t.toBytes(te)}function ge(te,j){return(0,c._abytes2)(te,void 0,"message"),j?(0,c._abytes2)(H(te),void 0,"prehashed message"):te}function ye(te,j,ie){if(["recovered","canonical"].some(ve=>ve in ie))throw new Error("sign() legacy options not supported");const{lowS:Q,prehash:ce,extraEntropy:le}=w(ie,M);te=ge(te,ce);const de=ue(te),I=A(t,j),Y=[pe(I),pe(de)];if(le!=null&&le!==!1){const ve=le===!0?u(d.secretKey):le;Y.push((0,c.ensureBytes)("extraEntropy",ve))}const re=(0,c.concatBytes)(...Y),oe=de;function fe(ve){const be=se(ve);if(!t.isValidNot0(be))return;const Ee=t.inv(be),we=a.BASE.multiply(be).toAffine(),Be=t.create(we.x);if(Be===N)return;const De=t.create(Ee*t.create(oe+Be*I));if(De===N)return;let Xe=(we.x===Be?0:2)|Number(we.y&F),st=De;return Q&&ee(De)&&(st=t.neg(De),Xe^=1),new X(Be,st,Xe)}return{seed:re,k2sig:fe}}function Se(te,j,ie={}){te=(0,c.ensureBytes)("message",te);const{seed:Q,k2sig:ce}=ye(te,j,ie);return(0,c.createHmacDrbg)(H.outputLen,t.BYTES,p)(Q,ce)}function _e(te){let j;const ie=typeof te=="string"||(0,c.isBytes)(te),Q=!ie&&te!==null&&typeof te=="object"&&typeof te.r=="bigint"&&typeof te.s=="bigint";if(!ie&&!Q)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(Q)j=new X(te.r,te.s);else if(ie){try{j=X.fromBytes((0,c.ensureBytes)("sig",te),"der")}catch(ce){if(!(ce instanceof e.DER.Err))throw ce}if(!j)try{j=X.fromBytes((0,c.ensureBytes)("sig",te),"compact")}catch{return!1}}return j||!1}function ae(te,j,ie,Q={}){const{lowS:ce,prehash:le,format:de}=w(Q,M);if(ie=(0,c.ensureBytes)("publicKey",ie),j=ge((0,c.ensureBytes)("message",j),le),"strict"in Q)throw new Error("options.strict was renamed to lowS");const I=de===void 0?_e(te):X.fromBytes((0,c.ensureBytes)("sig",te),de);if(I===!1)return!1;try{const Y=a.fromBytes(ie);if(ce&&I.hasHighS())return!1;const{r:re,s:oe}=I,fe=ue(j),ve=t.inv(oe),be=t.create(fe*ve),Ee=t.create(re*ve),we=a.BASE.multiplyUnsafe(be).add(Y.multiplyUnsafe(Ee));return we.is0()?!1:t.create(we.x)===re}catch{return!1}}function ne(te,j,ie={}){const{prehash:Q}=w(ie,M);return j=ge(j,Q),X.fromBytes(te,"recovered").recoverPublicKey(j).toBytes()}return Object.freeze({keygen:x,getPublicKey:D,getSharedSecret:J,utils:W,lengths:d,Point:a,sign:Se,verify:ae,recoverPublicKey:ne,Signature:X,hash:H})}function V(a){const{CURVE:H,curveOpts:l}=R(a),u=q(H,l);return Z(a,u)}function R(a){const H={a:a.a,b:a.b,p:a.Fp.ORDER,n:a.n,h:a.h,Gx:a.Gx,Gy:a.Gy},l=a.Fp;let u=a.allowedPrivateKeyLengths?Array.from(new Set(a.allowedPrivateKeyLengths.map(t=>Math.ceil(t/2)))):void 0;const p=(0,i.Field)(H.n,{BITS:a.nBitLength,allowedLengths:u,modFromBytes:a.wrapPrivateKey}),K={Fp:l,Fn:p,allowInfinityPoint:a.allowInfinityPoint,endo:a.endo,isTorsionFree:a.isTorsionFree,clearCofactor:a.clearCofactor,fromBytes:a.fromBytes,toBytes:a.toBytes};return{CURVE:H,curveOpts:K}}function k(a){const{CURVE:H,curveOpts:l}=R(a),u={hmac:a.hmac,randomBytes:a.randomBytes,lowS:a.lowS,bits2int:a.bits2int,bits2int_modN:a.bits2int_modN};return{CURVE:H,curveOpts:l,hash:a.hash,ecdsaOpts:u}}function U(a,H,l){function u(p){const K=a.sqr(p),t=a.mul(K,p);return a.add(a.add(t,a.mul(p,H)),l)}return u}function Z(a,H){const{Fp:l,Fn:u}=H;function p(t){return(0,c.inRange)(t,F,u.ORDER)}const K=U(l,a.a,a.b);return Object.assign({},{CURVE:a,Point:H,ProjectivePoint:H,normPrivateKeyToScalar:t=>A(u,t),weierstrassEquation:K,isWithinCurveOrder:p})}function G(a,H){const l=H.Point;return Object.assign({},H,{ProjectivePoint:l,CURVE:Object.assign({},a,(0,i.nLength)(l.Fn.ORDER,l.Fn.BITS))})}function $(a){const{CURVE:H,curveOpts:l,hash:u,ecdsaOpts:p}=k(a),K=q(H,l),t=E(K,u,p);return G(a,t)}})(jt)),jt}var us;function Po(){if(us)return Je;us=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.getHash=r,Je.createCurve=f;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=as();function r(c){return{hash:c}}function f(c,s){const i=n=>(0,e.weierstrass)({...c,hash:n});return{...i(s),create:i}}return Je}var ls;function To(){return ls||(ls=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.secp256k1_hasher=e.schnorr=e.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=qt(),f=qe(),c=Po(),s=ns(),i=Ue(),n=as(),o=ke(),m={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},w={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},O=BigInt(0),N=BigInt(1),F=BigInt(2);function L(G){const $=m.p,a=BigInt(3),H=BigInt(6),l=BigInt(11),u=BigInt(22),p=BigInt(23),K=BigInt(44),t=BigInt(88),v=G*G*G%$,S=v*v*G%$,x=(0,i.pow2)(S,a,$)*S%$,D=(0,i.pow2)(x,a,$)*S%$,J=(0,i.pow2)(D,F,$)*v%$,W=(0,i.pow2)(J,l,$)*J%$,d=(0,i.pow2)(W,u,$)*W%$,M=(0,i.pow2)(d,K,$)*d%$,z=(0,i.pow2)(M,t,$)*M%$,ee=(0,i.pow2)(z,K,$)*d%$,P=(0,i.pow2)(ee,a,$)*S%$,b=(0,i.pow2)(P,p,$)*W%$,X=(0,i.pow2)(b,H,$)*v%$,se=(0,i.pow2)(X,F,$);if(!y.eql(y.sqr(se),G))throw new Error("Cannot find square root");return se}const y=(0,i.Field)(m.p,{sqrt:L});e.secp256k1=(0,c.createCurve)({...m,Fp:y,lowS:!0,endo:w},r.sha256);const g={};function A(G,...$){let a=g[G];if(a===void 0){const H=(0,r.sha256)((0,o.utf8ToBytes)(G));a=(0,o.concatBytes)(H,H),g[G]=a}return(0,r.sha256)((0,o.concatBytes)(a,...$))}const q=G=>G.toBytes(!0).slice(1),T=e.secp256k1.Point,C=G=>G%F===O;function _(G){const{Fn:$,BASE:a}=T,H=(0,n._normFnElement)($,G),l=a.multiply(H);return{scalar:C(l.y)?H:$.neg(H),bytes:q(l)}}function h(G){const $=y;if(!$.isValidNot0(G))throw new Error("invalid x: Fail if x \u2265 p");const a=$.create(G*G),H=$.create(a*G+BigInt(7));let l=$.sqrt(H);C(l)||(l=$.neg(l));const u=T.fromAffine({x:G,y:l});return u.assertValidity(),u}const B=o.bytesToNumberBE;function E(...G){return T.Fn.create(B(A("BIP0340/challenge",...G)))}function V(G){return _(G).bytes}function R(G,$,a=(0,f.randomBytes)(32)){const{Fn:H}=T,l=(0,o.ensureBytes)("message",G),{bytes:u,scalar:p}=_($),K=(0,o.ensureBytes)("auxRand",a,32),t=H.toBytes(p^B(A("BIP0340/aux",K))),v=A("BIP0340/nonce",t,u,l),{bytes:S,scalar:x}=_(v),D=E(S,u,l),J=new Uint8Array(64);if(J.set(S,0),J.set(H.toBytes(H.create(x+D*p)),32),!k(J,l,u))throw new Error("sign: Invalid signature produced");return J}function k(G,$,a){const{Fn:H,BASE:l}=T,u=(0,o.ensureBytes)("signature",G,64),p=(0,o.ensureBytes)("message",$),K=(0,o.ensureBytes)("publicKey",a,32);try{const t=h(B(K)),v=B(u.subarray(0,32));if(!(0,o.inRange)(v,N,m.p))return!1;const S=B(u.subarray(32,64));if(!(0,o.inRange)(S,N,m.n))return!1;const x=E(H.toBytes(v),q(t),p),D=l.multiplyUnsafe(S).add(t.multiplyUnsafe(H.neg(x))),{x:J,y:W}=D.toAffine();return!(D.is0()||!C(W)||J!==v)}catch{return!1}}e.schnorr=(()=>{const a=(l=(0,f.randomBytes)(48))=>(0,i.mapHashToField)(l,m.n);e.secp256k1.utils.randomSecretKey;function H(l){const u=a(l);return{secretKey:u,publicKey:V(u)}}return{keygen:H,getPublicKey:V,sign:R,verify:k,Point:T,utils:{randomSecretKey:a,randomPrivateKey:a,taggedHash:A,lift_x:h,pointToBytes:q,numberToBytesBE:o.numberToBytesBE,bytesToNumberBE:o.bytesToNumberBE,mod:i.mod},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:64,seed:48}}})();const U=(0,s.isogenyMap)(y,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(G=>G.map($=>BigInt($)))),Z=(0,n.mapToCurveSimpleSWU)(y,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:y.create(BigInt("-11"))});e.secp256k1_hasher=(0,s.createHasher)(e.secp256k1.Point,G=>{const{x:$,y:a}=Z(y.create(G[0]));return U($,a)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:y.ORDER,m:1,k:128,expand:"xmd",hash:r.sha256}),e.hashToCurve=e.secp256k1_hasher.hashToCurve,e.encodeToCurve=e.secp256k1_hasher.encodeToCurve})(Vt)),Vt}var Ut={},fs;function ds(){return fs||(fs=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeHex=e.remove0x=void 0;var r=Le(),f=function(s){return s.startsWith("0x")||s.startsWith("0X")?s.slice(2):s};e.remove0x=f;var c=function(s){return(0,r.hexToBytes)((0,e.remove0x)(s))};e.decodeHex=c})(Ut)),Ut}var hs;function No(){return hs||(hs=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hexToPublicKey=e.convertPublicKeyFormat=e.getSharedPoint=e.getPublicKey=e.isValidPrivateKey=e.getValidSecret=void 0;var r=Gr(),f=Ho(),c=To(),s=ct(),i=Ct(),n=ds(),o=function(A){var q;do q=(0,r.randomBytes)(i.SECRET_KEY_LENGTH);while(!(0,e.isValidPrivateKey)(q,A));return q};e.getValidSecret=o;var m=function(A,q){return L(q,function(T){return T.utils.isValidSecretKey(A)},function(){return!0},function(){return!0})};e.isValidPrivateKey=m;var w=function(A,q){return L(q,function(T){return T.getPublicKey(A)},function(T){return T.getPublicKey(A)},function(T){return T.getPublicKey(A)})};e.getPublicKey=w;var O=function(A,q,T,C){return L(C,function(_){return _.getSharedSecret(A,q,T)},function(_){return _.getSharedSecret(A,q)},function(_){return g(_,A,q)})};e.getSharedPoint=O;var N=function(A,q,T){return L(T,function(C){return C.getSharedSecret(Uint8Array.from(Array(31).fill(0).concat([1])),A,q)},function(){return A},function(){return A})};e.convertPublicKeyFormat=N;var F=function(A,q){var T=(0,n.decodeHex)(A);return L(q,function(){return y(T)},function(){return T},function(){return T})};e.hexToPublicKey=F;function L(A,q,T,C){var _=A||(0,s.ellipticCurve)();if(_==="secp256k1")return q(c.secp256k1);if(_==="x25519")return T(f.x25519);if(_==="ed25519")return C(f.ed25519);throw new Error("Not implemented")}var y=function(A){if(A.length===i.ETH_PUBLIC_KEY_SIZE){var q=new Uint8Array(1+A.length);return q.set([4]),q.set(A,1),q}return A},g=function(A,q,T){var C=A.utils.getExtendedPublicKey(q).scalar,_=A.Point.fromBytes(T).multiply(C);return _.toBytes()}})(Pt)),Pt}var Gt={},Ge={},ys;function Lo(){if(ys)return Ge;ys=1,Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.hkdf=void 0,Ge.extract=f,Ge.expand=i;const e=os(),r=qe();function f(o,m,w){return(0,r.ahash)(o),w===void 0&&(w=new Uint8Array(o.outputLen)),(0,e.hmac)(o,(0,r.toBytes)(w),(0,r.toBytes)(m))}const c=Uint8Array.from([0]),s=Uint8Array.of();function i(o,m,w,O=32){(0,r.ahash)(o),(0,r.anumber)(O);const N=o.outputLen;if(O>255*N)throw new Error("Length should be <= 255*HashLen");const F=Math.ceil(O/N);w===void 0&&(w=s);const L=new Uint8Array(F*N),y=e.hmac.create(o,m),g=y._cloneInto(),A=new Uint8Array(y.outputLen);for(let q=0;q<F;q++)c[0]=q+1,g.update(q===0?s:A).update(w).update(c).digestInto(A),L.set(A,N*q),y._cloneInto(g);return y.destroy(),g.destroy(),(0,r.clean)(A,c),L.slice(0,O)}const n=(o,m,w,O,N)=>i(o,f(o,m,w),O,N);return Ge.hkdf=n,Ge}var ps;function qo(){return ps||(ps=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSharedKey=e.deriveKey=void 0;var r=Le(),f=Lo(),c=qt(),s=function(n,o,m){return(0,f.hkdf)(c.sha256,n,o,m,32)};e.deriveKey=s;var i=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return(0,e.deriveKey)(r.concatBytes.apply(void 0,n))};e.getSharedKey=i})(Gt)),Gt}var $t={},$e={},et={};const Do=so(import.meta.url);function Fo(){return Do("node:crypto")}var vs;function ms(){if(vs)return et;vs=1,Object.defineProperty(et,"__esModule",{value:!0}),et._compat=void 0;var e=Le(),r=Fo(),f=16,c=globalThis.Deno!==void 0,s=function(i,n,o,m){var w=i==="aes-256-gcm"||i==="chacha20-poly1305",O=w?f:0,N=w?{authTagLength:O}:void 0,F=function(y){var g=(0,r.createCipheriv)(i,n,o,N);w&&m!==void 0&&g.setAAD(m);var A=g.update(y),q=g.final(),T=w?g.getAuthTag():new Uint8Array(0);return(0,e.concatBytes)(A,q,T)},L=function(y){var g=y.subarray(0,y.length-O),A=y.subarray(y.length-O),q=(0,r.createDecipheriv)(i,n,o,N);w&&(m!==void 0&&q.setAAD(m),q.setAuthTag(A)),!w&&c&&q.setAutoPadding(!1);var T=q.update(g),C=q.final();return(0,e.concatBytes)(T,C)};return{encrypt:F,decrypt:L}};return et._compat=s,et}var gs;function ko(){if(gs)return $e;gs=1,Object.defineProperty($e,"__esModule",{value:!0}),$e.aes256cbc=$e.aes256gcm=void 0;var e=ms(),r=function(c,s,i){return(0,e._compat)("aes-256-gcm",c,s,i)};$e.aes256gcm=r;var f=function(c,s,i){return(0,e._compat)("aes-256-cbc",c,s)};return $e.aes256cbc=f,$e}var Ye={},tt={},bs;function Vo(){if(bs)return tt;bs=1,Object.defineProperty(tt,"__esModule",{value:!0}),tt._hchacha20=void 0;var e=function(f,c,s,i){for(var n=f[0],o=f[1],m=f[2],w=f[3],O=c[0],N=c[1],F=c[2],L=c[3],y=c[4],g=c[5],A=c[6],q=c[7],T=s[0],C=s[1],_=s[2],h=s[3],B=0;B<20;B+=2)n=n+O|0,T=r(T^n,16),y=y+T|0,O=r(O^y,12),n=n+O|0,T=r(T^n,8),y=y+T|0,O=r(O^y,7),o=o+N|0,C=r(C^o,16),g=g+C|0,N=r(N^g,12),o=o+N|0,C=r(C^o,8),g=g+C|0,N=r(N^g,7),m=m+F|0,_=r(_^m,16),A=A+_|0,F=r(F^A,12),m=m+F|0,_=r(_^m,8),A=A+_|0,F=r(F^A,7),w=w+L|0,h=r(h^w,16),q=q+h|0,L=r(L^q,12),w=w+L|0,h=r(h^w,8),q=q+h|0,L=r(L^q,7),n=n+N|0,h=r(h^n,16),A=A+h|0,N=r(N^A,12),n=n+N|0,h=r(h^n,8),A=A+h|0,N=r(N^A,7),o=o+F|0,T=r(T^o,16),q=q+T|0,F=r(F^q,12),o=o+F|0,T=r(T^o,8),q=q+T|0,F=r(F^q,7),m=m+L|0,C=r(C^m,16),y=y+C|0,L=r(L^y,12),m=m+L|0,C=r(C^m,8),y=y+C|0,L=r(L^y,7),w=w+O|0,_=r(_^w,16),g=g+_|0,O=r(O^g,12),w=w+O|0,_=r(_^w,8),g=g+_|0,O=r(O^g,7);var E=0;i[E++]=n,i[E++]=o,i[E++]=m,i[E++]=w,i[E++]=T,i[E++]=C,i[E++]=_,i[E++]=h};tt._hchacha20=e;var r=function(f,c){return f<<c|f>>>32-c};return tt}var Es;function jo(){if(Es)return Ye;Es=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.chacha20=Ye.xchacha20=void 0;var e=Le(),r=ms(),f=Vo(),c=function(i,n,o){if(n.length!==24)throw new Error("xchacha20's nonce must be 24 bytes");var m=new Uint32Array([1634760805,857760878,2036477234,1797285236]),w=new Uint32Array(8);(0,f._hchacha20)(m,(0,e.u32)(i),(0,e.u32)(n.subarray(0,16)),w);var O=new Uint8Array(12);return O.set([0,0,0,0]),O.set(n.subarray(16),4),(0,r._compat)("chacha20-poly1305",(0,e.u8)(w),O,o)};Ye.xchacha20=c;var s=function(i,n,o){if(n.length!==12)throw new Error("chacha20's nonce must be 12 bytes");return(0,r._compat)("chacha20-poly1305",i,n,o)};return Ye.chacha20=s,Ye}var _s;function Mo(){return _s||(_s=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.aesDecrypt=e.aesEncrypt=e.symDecrypt=e.symEncrypt=void 0;var r=ko(),f=jo(),c=Le(),s=Gr(),i=ct(),n=Ct(),o=function(F,L,y){return w(O,F,L,y)};e.symEncrypt=o;var m=function(F,L,y){return w(N,F,L,y)};e.symDecrypt=m,e.aesEncrypt=e.symEncrypt,e.aesDecrypt=e.symDecrypt;function w(F,L,y,g){var A=(0,i.symmetricAlgorithm)();if(A==="aes-256-gcm")return F(r.aes256gcm,L,y,(0,i.symmetricNonceLength)(),n.AEAD_TAG_LENGTH,g);if(A==="xchacha20")return F(f.xchacha20,L,y,n.XCHACHA20_NONCE_LENGTH,n.AEAD_TAG_LENGTH,g);if(A==="aes-256-cbc")return F(r.aes256cbc,L,y,16,0);throw new Error("Not implemented")}function O(F,L,y,g,A,q){var T=(0,s.randomBytes)(g),C=F(L,T,q),_=C.encrypt(y);if(A===0)return(0,c.concatBytes)(T,_);var h=_.length-A,B=_.subarray(0,h),E=_.subarray(h);return(0,c.concatBytes)(T,E,B)}function N(F,L,y,g,A,q){var T=y.subarray(0,g),C=F(L,Uint8Array.from(T),q),_=y.subarray(g);if(A===0)return C.decrypt(_);var h=_.subarray(0,A),B=_.subarray(A);return C.decrypt((0,c.concatBytes)(B,h))}})($t)),$t}var ws;function Yt(){return ws||(ws=1,(function(e){var r=Me&&Me.__createBinding||(Object.create?(function(c,s,i,n){n===void 0&&(n=i);var o=Object.getOwnPropertyDescriptor(s,i);(!o||("get"in o?!s.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(c,n,o)}):(function(c,s,i,n){n===void 0&&(n=i),c[n]=s[i]})),f=Me&&Me.__exportStar||function(c,s){for(var i in c)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&r(s,c,i)};Object.defineProperty(e,"__esModule",{value:!0}),f(No(),e),f(qo(),e),f(ds(),e),f(Mo(),e)})(Me)),Me}var nt={},Ss;function xs(){if(Ss)return nt;Ss=1,Object.defineProperty(nt,"__esModule",{value:!0}),nt.PublicKey=void 0;var e=Le(),r=Yt(),f=(function(){function c(s,i){var n=(0,r.convertPublicKeyFormat)(s,!0,i),o=(0,r.convertPublicKeyFormat)(s,!1,i);this.data=n,this.dataUncompressed=n.length!==o.length?o:null}return c.fromHex=function(s,i){return new c((0,r.hexToPublicKey)(s,i),i)},Object.defineProperty(c.prototype,"_uncompressed",{get:function(){return this.dataUncompressed!==null?this.dataUncompressed:this.data},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"uncompressed",{get:function(){return Buffer.from(this._uncompressed)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"compressed",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),c.prototype.toBytes=function(s){return s===void 0&&(s=!0),s?this.data:this._uncompressed},c.prototype.toHex=function(s){return s===void 0&&(s=!0),(0,e.bytesToHex)(this.toBytes(s))},c.prototype.decapsulate=function(s,i){i===void 0&&(i=!1);var n=this.toBytes(i),o=s.multiply(this,i);return(0,r.getSharedKey)(n,o)},c.prototype.equals=function(s){return(0,e.equalBytes)(this.data,s.data)},c})();return nt.PublicKey=f,nt}var As;function Uo(){if(As)return We;As=1,Object.defineProperty(We,"__esModule",{value:!0}),We.PrivateKey=void 0;var e=Le(),r=Yt(),f=xs(),c=(function(){function s(i,n){if(this.curve=n,i===void 0)this.data=(0,r.getValidSecret)(n);else if((0,r.isValidPrivateKey)(i,n))this.data=i;else throw new Error("Invalid private key");this.publicKey=new f.PublicKey((0,r.getPublicKey)(this.data,n),n)}return s.fromHex=function(i,n){return new s((0,r.decodeHex)(i),n)},Object.defineProperty(s.prototype,"secret",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),s.prototype.toHex=function(){return(0,e.bytesToHex)(this.data)},s.prototype.encapsulate=function(i,n){n===void 0&&(n=!1);var o=this.publicKey.toBytes(n),m=this.multiply(i,n);return(0,r.getSharedKey)(o,m)},s.prototype.multiply=function(i,n){return n===void 0&&(n=!1),(0,r.getSharedPoint)(this.data,i.toBytes(!0),n,this.curve)},s.prototype.equals=function(i){return(0,e.equalBytes)(this.data,i.data)},s})();return We.PrivateKey=c,We}var Bs;function Rs(){return Bs||(Bs=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.PrivateKey=void 0;var r=Uo();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return r.PrivateKey}});var f=xs();Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return f.PublicKey}})})(Ht)),Ht}var Is;function Zt(){return Is||(Is=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.PublicKey=e.PrivateKey=e.ECIES_CONFIG=void 0,e.encrypt=i,e.decrypt=o;var r=Le(),f=ct(),c=Rs(),s=Yt();function i(N,F){return Buffer.from(n(N,F))}function n(N,F){var L=(0,f.ellipticCurve)(),y=new c.PrivateKey(void 0,L),g=N instanceof Uint8Array?new c.PublicKey(N,L):c.PublicKey.fromHex(N,L),A=y.encapsulate(g,(0,f.isHkdfKeyCompressed)()),q=y.publicKey.toBytes((0,f.isEphemeralKeyCompressed)()),T=(0,s.symEncrypt)(A,F);return(0,r.concatBytes)(q,T)}function o(N,F){return Buffer.from(m(N,F))}function m(N,F){var L=(0,f.ellipticCurve)(),y=N instanceof Uint8Array?new c.PrivateKey(N,L):c.PrivateKey.fromHex(N,L),g=(0,f.ephemeralKeySize)(),A=new c.PublicKey(F.subarray(0,g),L),q=F.subarray(g),T=A.decapsulate(y,(0,f.isHkdfKeyCompressed)());return(0,s.symDecrypt)(T,q)}var w=ct();Object.defineProperty(e,"ECIES_CONFIG",{enumerable:!0,get:function(){return w.ECIES_CONFIG}});var O=Rs();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return O.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return O.PublicKey}}),e.utils={aesEncrypt:s.aesEncrypt,aesDecrypt:s.aesDecrypt,symEncrypt:s.symEncrypt,symDecrypt:s.symDecrypt,decodeHex:s.decodeHex,getValidSecret:s.getValidSecret,remove0x:s.remove0x}})(It)),It}var Xt,Os;function Ks(){if(Os)return Xt;Os=1;const{decrypt:e}=Zt(),r=Pe(),f="encrypted:";function c(s,i,n,o){let m,w;if(!i.startsWith(f))return i;if(o=o||"",o.length<=0)w=new r({key:s,privateKeyName:n,privateKey:o}).missingPrivateKey();else{const O=o.split(",");for(const N of O){const F=Buffer.from(N,"hex"),L=i.substring(f.length),y=Buffer.from(L,"base64");try{m=e(F,y).toString(),w=null;break}catch(g){g.message==="Invalid private key"?w=new r({key:s,privateKeyName:n,privateKey:o}).invalidPrivateKey():g.message==="Unsupported state or unable to authenticate data"?w=new r({key:s,privateKeyName:n,privateKey:o}).wrongPrivateKey():g.message==="Point of length 65 was invalid. Expected 33 compressed bytes or 65 uncompressed bytes"?w=new r({key:s,privateKeyName:n,privateKey:o}).malformedEncryptedData():w=new r({key:s,privateKeyName:n,privateKey:o,message:g.message}).decryptionFailed()}}}if(w)throw w;return m}return Xt=c,Xt}var Wt,Cs;function Go(){if(Cs)return Wt;Cs=1;function e(r){return r.replace(/[\r\n]+$/,"")}return Wt=e,Wt}var zt,Hs;function $o(){if(Hs)return zt;Hs=1;const{execSync:e}=nr,r=Go(),f=Pe();function c(s,i,n,o){return(i.match(/\$\(([^)]+(?:\)[^(]*)*)\)/g)||[]).reduce((w,O)=>{const N=O.slice(2,-1);let F;try{F=e(N,{env:{...n,...o}}).toString()}catch(L){throw new f({key:s,command:N,message:L.message.trim()}).commandSubstitutionFailed()}return F=r(F),w.replace(O,F)},i)}return zt=c,zt}var Qt,Ps;function Yo(){if(Ps)return Qt;Ps=1;function e(r){return r.replace(/\\\$/g,"$")}return Qt=e,Qt}var Jt,Ts;function Ns(){if(Ts)return Jt;Ts=1;const e=Ks(),r=$o(),f=Yo();class c{static LINE=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;constructor(i,n=null,o=process.env,m=!1,w=null){this.src=i,this.privateKey=n,this.privateKeyName=w,this.processEnv=o,this.overload=m,this.parsed={},this.preExisted={},this.injected={},this.errors=[],this.runningParsed={},this.literals={}}run(){const i=this.getLines();let n;for(;(n=c.LINE.exec(i))!==null;){const o=n[1],m=n[2],w=this.quote(m);this.parsed[o]=this.clean(m,w),!this.overload&&this.inProcessEnv(o)&&(this.parsed[o]=this.processEnv[o]);try{this.parsed[o]=this.decrypt(o,this.parsed[o])}catch(N){this.errors.push(N)}let O=!1;if(w!=="'"&&(!this.inProcessEnv(o)||this.processEnv[o]===this.parsed[o])){const N=this.parsed[o];try{this.parsed[o]=this.eval(o,N)}catch(F){this.errors.push(F)}N!==this.parsed[o]&&(O=!0)}!O&&w!=="'"&&(!this.processEnv[o]||this.overload)&&(this.parsed[o]=f(this.expand(this.parsed[o]))),w==="'"&&(this.literals[o]=this.parsed[o]),this.runningParsed[o]=this.parsed[o],Object.prototype.hasOwnProperty.call(this.processEnv,o)&&!this.overload?this.preExisted[o]=this.processEnv[o]:this.injected[o]=this.parsed[o]}return{parsed:this.parsed,processEnv:this.processEnv,injected:this.injected,preExisted:this.preExisted,errors:this.errors}}trimmer(i){return(i||"").trim()}quote(i){const o=this.trimmer(i)[0];let m="";switch(o){case"'":m="'";break;case'"':m='"';break;case"`":m="`";break;default:m=""}return m}clean(i,n){let o=this.trimmer(i);return o=o.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),n==='"'&&(o=o.replace(/\\n/g,`
3
- `),o=o.replace(/\\r/g,"\r"),o=o.replace(/\\t/g," ")),o}decrypt(i,n){return e(i,n,this.privateKeyName,this.privateKey)}eval(i,n){return r(i,n,this.processEnv,this.runningParsed)}expand(i){let n={...this.runningParsed,...this.processEnv};this.overload&&(n={...this.processEnv,...this.runningParsed});const o=/(?<!\\)\${([^{}]+)}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g;let m=i,w;for(;(w=o.exec(m))!==null;){const[O,N,F]=w,L=N||F,y=/(:\+|\+|:-|-)/,g=L.match(y),A=g?g[0]:null,q=L.split(A);let T,C;const _=q.shift();if([":+","+"].includes(A)?(T=n[_]?q.join(A):"",C=null):(T=q.join(A),C=n[_]),C?m=m.replace(O,C):m=m.replace(O,T),m===n[_]||this.literals[_]&&/\$\{[^}]+\}|\$[A-Za-z_][A-Za-z0-9_]*/.test(this.literals[_]))break;o.lastIndex=0}return m}inProcessEnv(i){return Object.prototype.hasOwnProperty.call(this.processEnv,i)}getLines(){return(this.src||"").toString().replace(/\r\n?/mg,`
4
- `)}}return Jt=c,Jt}var en,Ls;function qs(){if(Ls)return en;Ls=1;const e=Fe;async function r(f){const c=await e.promises.readFile(f);return c.length>=2&&c[0]===255&&c[1]===254?"utf16le":(c.length>=3&&c[0]===239&&c[1]===187&&c[2]===191,"utf8")}return en=r,en}var tn,Ds;function Fs(){if(Ds)return tn;Ds=1;const e=Fe;function r(f){const c=e.readFileSync(f);return c.length>=2&&c[0]===255&&c[1]===254?"utf16le":(c.length>=3&&c[0]===239&&c[1]===187&&c[2]===191,"utf8")}return tn=r,tn}var nn,ks;function Vs(){if(ks)return nn;ks=1;const e=Re;function r(f){const c=e.basename(f).toLowerCase(),i=[...c.split(".").slice(2)];return i.length===0?c.replace(".env","development"):i.length===1?i[0]:i.length===2?i.join("_"):i.slice(0,2).join("_")}return nn=r,nn}var rn,js;function sn(){if(js)return rn;js=1;const e=Re,r=Vs();function f(c){const s=e.basename(c).toLowerCase();if(s===".env")return{publicKeyName:"DOTENV_PUBLIC_KEY",privateKeyName:"DOTENV_PRIVATE_KEY"};const i=r(s).toUpperCase();return{publicKeyName:`DOTENV_PUBLIC_KEY_${i}`,privateKeyName:`DOTENV_PRIVATE_KEY_${i}`}}return rn=f,rn}var on,Ms;function je(){if(Ms)return on;Ms=1;const e=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function r(f,c=!1,s=!1,i=!1){const n={};let o=f.toString();s||(o=o.replace(/\r\n?/mg,`
5
- `));let m;for(;(m=e.exec(o))!=null;){const w=m[1];let O=m[2]||"";O=O.trim();const N=O[0];O=O.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),N==='"'&&!c&&(O=O.replace(/\\n/g,`
6
- `),O=O.replace(/\\r/g,"\r"),O=O.replace(/\\t/g," ")),i?(n[w]=n[w]||[],n[w].push(O)):n[w]=O}return n}return on=r,on}var cn,Us;function an(){if(Us)return cn;Us=1;function e(r){if(process.env[r]&&process.env[r].length>0)return process.env[r]}return cn=e,cn}var un,Gs;function $s(){if(Gs)return un;Gs=1;const e=Te(),r=je();async function f(c,s){if(!await e.exists(s))return;const i=await e.readFileX(s),n=r(i);if(n[c]&&n[c].length>0)return n[c]}return un=f,un}var ln,Ys;function fn(){if(Ys)return ln;Ys=1;const e=Re,r=nr,c=io.promisify(r.execFile);class s{async status(){if(this._isForcedOff())return"off";const n=await this._resolveBinary();if(!n)return"off";try{return await this._exec(n,["status"])}catch{return"off"}}statusSync(){if(this._isForcedOff())return"off";const n=this._resolveBinarySync();if(!n)return"off";try{return this._execSync(n,["status"])}catch{return"off"}}async keypair(n){if(this._isForcedOff())return{};const o=await this._resolveBinary();if(!o)return{};const m=["keypair"];n&&m.push(n);try{return JSON.parse(await this._exec(o,m))}catch{return{}}}keypairSync(n){if(this._isForcedOff())return{};const o=this._resolveBinarySync();if(!o)return{};const m=["keypair"];n&&m.push(n);try{return JSON.parse(this._execSync(o,m))}catch{return{}}}observe(n){if(this._isForcedOff())return;const o=this._resolveBinarySync();if(!o)return;let m="off";try{m=this._execSync(o,["status"])}catch{return}if(m==="off")return;const w=Buffer.from(JSON.stringify(n)).toString("base64");try{r.spawn(o,["observe",w],{stdio:"ignore",detached:!0}).unref()}catch{}}async _exec(n,o){const{stdout:m}=await c(n,o);return m.toString().trim()}_execSync(n,o){return r.execFileSync(n,o).toString().trim()}async _resolveBinary(){return this._binaryPromise?this._binaryPromise:(this._binaryPromise=(async()=>{const n=e.resolve(process.cwd(),"node_modules/.bin/dotenvx-ops");try{return await this._exec(n,["--version"]),n}catch{}try{return await this._exec("dotenvx-ops",["--version"]),"dotenvx-ops"}catch{}return null})(),this._binaryPromise)}_resolveBinarySync(){if(this._binarySync!==void 0)return this._binarySync;const n=e.resolve(process.cwd(),"node_modules/.bin/dotenvx-ops");try{return this._execSync(n,["--version"]),this._binarySync=n,this._binarySync}catch{}try{return this._execSync("dotenvx-ops",["--version"]),this._binarySync="dotenvx-ops",this._binarySync}catch{}return this._binarySync=null,null}_isForcedOff(){return process.env.DOTENVX_NO_OPS==="true"}}return ln=s,ln}var dn,Zs;function hn(){if(Zs)return dn;Zs=1;const e=fn();async function r(f){const c=await new e().keypair(f),s=c.public_key,i=c.private_key;return{publicKey:s,privateKey:i}}return dn=r,dn}var yn,Xs;function Zo(){if(Xs)return yn;Xs=1;const e=Re,r=Te(),f=je(),c=sn(),s=an(),i=$s(),n=hn();async function o(w){const O="DOTENV_PUBLIC_KEY",N="DOTENV_PRIVATE_KEY";if(!await r.exists(w))return null;const F=await r.readFileX(w),L=f(F);let y;for(const g of Object.keys(L))(g===O||g.startsWith(O))&&(y=g);return y?y.replace(O,N):null}async function m(w,O={}){let N=O.keysFilepath||null;const F=O.noOps===!0,L=c(w),y=L.publicKeyName;let g=L.privateKeyName,A=null,q=null;return A=s(y),A||(A=await i(y,w)||null),q=s(g),q||(N?N=e.resolve(N):N=e.resolve(e.dirname(w),".env.keys"),q=await i(g,N)),q||(g=await o(w),g&&(q=s(g),q||(q=await i(g,N)))),!F&&!q&&A&&A.length>0&&(q=(await n(A)).privateKey),{publicKeyValue:A||null,privateKeyValue:q||null}}return yn=m,yn}var pn,Ws;function zs(){if(Ws)return pn;Ws=1;const e=Te(),r=je();function f(c,s){if(e.existsSync(s)){const i=e.readFileXSync(s),n=r(i);if(n[c]&&n[c].length>0)return n[c]}}return pn=f,pn}var vn,Qs;function mn(){if(Qs)return vn;Qs=1;const e=fn();function r(f){const c=new e().keypairSync(f),s=c.public_key,i=c.private_key;return{publicKey:s,privateKey:i}}return vn=r,vn}var gn,Js;function Xo(){if(Js)return gn;Js=1;const e=Re,r=Te(),f=je(),c=sn(),s=an(),i=zs(),n=mn();function o(w){const O="DOTENV_PUBLIC_KEY",N="DOTENV_PRIVATE_KEY";if(!r.existsSync(w))return null;const F=r.readFileXSync(w),L=f(F);let y;for(const g of Object.keys(L))(g===O||g.startsWith(O))&&(y=g);return y?y.replace(O,N):null}function m(w,O={}){let N=O.keysFilepath||null;const F=O.noOps===!0,L=c(w),y=L.publicKeyName;let g=L.privateKeyName,A=null,q=null;return A=s(y),A||(A=i(y,w)||null),q=s(g),q||(N?N=e.resolve(N):N=e.resolve(e.dirname(w),".env.keys"),q=i(g,N)),q||(g=o(w),g&&(q=s(g),q||(q=i(g,N)))),!F&&!q&&A&&A.length>0&&(q=n(A).privateKey),{publicKeyValue:A||null,privateKeyValue:q||null}}return gn=m,gn}var bn,ei;function ti(){if(ei)return bn;ei=1;const e="DOTENV_PRIVATE_KEY";function r(f){return f===e?".env":`.env.${f.substring(`${e}_`.length).split("_").join(".").toLowerCase()}`}return bn=r,bn}var En,ni;function ri(){if(ni)return En;ni=1;const e="DOTENV_PRIVATE_KEY";function r(f){return Object.keys(f).filter(c=>c.startsWith(e))}return En=r,En}var _n,si;function rt(){return si||(si=1,_n={keyNames:sn(),keyValues:Zo(),keyValuesSync:Xo(),readProcessKey:an(),readFileKey:$s(),readFileKeySync:zs(),guessPrivateKeyFilename:ti(),dotenvPrivateKeyNames:ri()}),_n}var wn,ii;function oi(){if(ii)return wn;ii=1;const e=Pe();function r(f){const c=process.env.DOTENV_ENV||process.env.NODE_ENV||"development";if(f==="nextjs"){const s=["development","test","production"].includes(c)&&c;return[s&&{type:"envFile",value:`.env.${s}.local`},s!=="test"&&{type:"envFile",value:".env.local"},s&&{type:"envFile",value:`.env.${s}`},{type:"envFile",value:".env"}].filter(Boolean)}else{if(f==="flow")return[{type:"envFile",value:`.env.${c}.local`},{type:"envFile",value:`.env.${c}`},{type:"envFile",value:".env.local"},{type:"envFile",value:".env"},{type:"envFile",value:".env.defaults"}];throw new e({convention:f}).invalidConvention()}}return wn=r,wn}var Sn,ci;function Wo(){if(ci)return Sn;ci=1;const e=oo,r=Re;function f(c){return c[0]==="~"?r.join(e.homedir(),c.slice(1)):c}return Sn=f,Sn}var xn,ai;function ui(){if(ai)return xn;ai=1;const e=Wo();function r(f){let c=[];if(f&&f.path)if(!Array.isArray(f.path))c=[e(f.path)];else{c=[];for(const s of f.path)c.push(e(s))}return c}return xn=r,xn}var An,li;function fi(){if(li)return An;li=1;const e=oi(),r=ui();function f(c){const s=r(c);let i=[];c.convention&&(i=e(c.convention).concat(i));for(const n of s)i.push({type:"envFile",value:n});return i}return An=f,An}var Bn,di;function zo(){if(di)return Bn;di=1;const e=ri(),r=ti(),f="envFile",c=[{type:f,value:".env"}];function s(n){const o=[];for(const m of n){const w=r(m);o.push({type:f,value:w})}return o}function i(n=[],o){const m=e(o);if(!n||n.length<=0)return m.length>0?s(m):c;{let w=!1;for(const O of n)O.type===f&&(w=!0);return w?n:[...c,...n]}}return Bn=i,Bn}var Rn,hi;function yi(){if(hi)return Rn;hi=1;const e=Te(),r=Pe(),f=[".env.project",".env.keys",".env.me",".env.x",".env.example"];function c(s){try{return e.readdirSync(s).filter(o=>o.startsWith(".env")&&!o.endsWith(".previous")&&!f.includes(o))}catch(i){throw i.code==="ENOENT"?new r({directory:s}).missingDirectory():i}}return Rn=c,Rn}var In,pi;function vi(){return pi||(pi=1,In={buildEnvs:fi(),determine:zo(),findEnvFiles:yi(),dotenvOptionPaths:ui(),environment:Vs(),conventions:oi()}),In}var On,mi;function gi(){if(mi)return On;mi=1;const e=Te(),r=Re,f="env",c="envFile",s=Ns(),i=Pe(),n=qs(),o=Fs(),{keyNames:m,keyValues:w,keyValuesSync:O}=rt(),{determine:N}=vi();class F{constructor(y=[],g=!1,A=process.env,q=null,T=!1){this.envs=N(y,A),this.overload=g,this.processEnv=A,this.envKeysFilepath=q,this.noOps=T,this.processedEnvs=[],this.readableFilepaths=new Set,this.readableStrings=new Set,this.uniqueInjectedKeys=new Set,this.beforeEnv={...this.processEnv}}runSync(){for(const y of this.envs)y.type===c?this._injectEnvFileSync(y.value):y.type===f&&this._injectEnv(y.value);return{processedEnvs:this.processedEnvs,readableStrings:[...this.readableStrings],readableFilepaths:[...this.readableFilepaths],uniqueInjectedKeys:[...this.uniqueInjectedKeys],beforeEnv:this.beforeEnv,afterEnv:{...this.processEnv}}}async run(){for(const y of this.envs)y.type===c?await this._injectEnvFile(y.value):y.type===f&&this._injectEnv(y.value);return{processedEnvs:this.processedEnvs,readableStrings:[...this.readableStrings],readableFilepaths:[...this.readableFilepaths],uniqueInjectedKeys:[...this.uniqueInjectedKeys],beforeEnv:this.beforeEnv,afterEnv:{...this.processEnv}}}_injectEnv(y){const g={};g.type=f,g.string=y;try{const{parsed:A,errors:q,injected:T,preExisted:C}=new s(y,null,this.processEnv,this.overload).run();g.parsed=A,g.errors=q,g.injected=T,g.preExisted=C,this.inject(g.parsed),this.readableStrings.add(y);for(const _ of Object.keys(T))this.uniqueInjectedKeys.add(_)}catch(A){g.errors=[A]}this.processedEnvs.push(g)}_injectEnvFileSync(y){const g={};g.type=c,g.filepath=y;const A=r.resolve(y);try{const q=o(A),T=e.readFileXSync(A,{encoding:q});this.readableFilepaths.add(y);const{privateKeyName:C}=m(A),{privateKeyValue:_}=O(A,{keysFilepath:this.envKeysFilepath,noOps:this.noOps}),{parsed:h,errors:B,injected:E,preExisted:V}=new s(T,_,this.processEnv,this.overload,C).run();g.privateKeyName=C,g.privateKey=_,g.src=T,g.parsed=h,g.errors=B,g.injected=E,g.preExisted=V,this.inject(g.parsed);for(const R of Object.keys(E))this.uniqueInjectedKeys.add(R)}catch(q){q.code==="ENOENT"||q.code==="EISDIR"?g.errors=[new i({envFilepath:y,filepath:A}).missingEnvFile()]:g.errors=[q]}this.processedEnvs.push(g)}async _injectEnvFile(y){const g={};g.type=c,g.filepath=y;const A=r.resolve(y);try{const q=await n(A),T=await e.readFileX(A,{encoding:q});this.readableFilepaths.add(y);const{privateKeyName:C}=m(A),{privateKeyValue:_}=await w(A,{keysFilepath:this.envKeysFilepath,noOps:this.noOps}),{parsed:h,errors:B,injected:E,preExisted:V}=new s(T,_,this.processEnv,this.overload,C).run();g.privateKeyName=C,g.privateKey=_,g.src=T,g.parsed=h,g.errors=B,g.injected=E,g.preExisted=V,this.inject(g.parsed);for(const R of Object.keys(E))this.uniqueInjectedKeys.add(R)}catch(q){q.code==="ENOENT"||q.code==="EISDIR"?g.errors=[new i({envFilepath:y,filepath:A}).missingEnvFile()]:g.errors=[q]}this.processedEnvs.push(g)}inject(y){for(const g of Object.keys(y))this.processEnv[g]=y[g]}}return On=F,On}var Kn,bi;function ut(){if(bi)return Kn;bi=1;const{PrivateKey:e}=Zt();function r(f){let c;f?c=new e(Buffer.from(f,"hex")):c=new e;const s=c.publicKey.toHex(),i=c.secret.toString("hex");return{publicKey:s,privateKey:i}}return Kn=r,Kn}var Cn,Ei;function Qo(){if(Ei)return Cn;Ei=1;const{encrypt:e}=Zt(),r="encrypted:";function f(c,s){const i=e(s,Buffer.from(c)),n=Buffer.from(i,"hex").toString("base64");return`${r}${n}`}return Cn=f,Cn}var Hn,_i;function wi(){if(_i)return Hn;_i=1;const e=/^encrypted:.+/;function r(f){return e.test(f)}return Hn=r,Hn}var Pn,Si;function xi(){if(Si)return Pn;Si=1;const e=/^DOTENV_PUBLIC_KEY/;function r(f){return e.test(f)}return Pn=r,Pn}var Tn,Ai;function Bi(){if(Ai)return Tn;Ai=1;const e=["#/------------------!DOTENV_PRIVATE_KEYS!-------------------/","#/ private decryption keys. DO NOT commit to source control /","#/ [how it works](https://dotenvx.com/encryption) /","#/----------------------------------------------------------/"].join(`
7
- `),r=Re,f=Te();async function c({envFilepath:s,keysFilepath:i,privateKeyName:n,privateKeyValue:o}){const m=r.basename(s),w=r.resolve(s);let O=r.join(r.dirname(w),".env.keys");i&&(O=r.resolve(i));const N=[`# ${m}`,`${n}=${o}`,""].join(`
8
- `);let F="";await f.exists(O)&&(F=await f.readFileX(O)),F=F.length>1?F:`${e}
9
- `,F=`${F}
10
- ${N}`,await f.writeFileX(O,F);const L=i||r.join(r.dirname(s),r.basename(O));return{keysSrc:F,envKeysFilepath:L}}return Tn=c,Tn}var Nn,Ri;function Ii(){if(Ri)return Nn;Ri=1;const e=["#/------------------!DOTENV_PRIVATE_KEYS!-------------------/","#/ private decryption keys. DO NOT commit to source control /","#/ [how it works](https://dotenvx.com/encryption) /","#/----------------------------------------------------------/"].join(`
11
- `),r=Re,f=Te();function c({envFilepath:s,keysFilepath:i,privateKeyName:n,privateKeyValue:o}){const m=r.basename(s),w=r.resolve(s);let O=r.join(r.dirname(w),".env.keys");i&&(O=r.resolve(i));const N=[`# ${m}`,`${n}=${o}`,""].join(`
12
- `);let F="";f.existsSync(O)&&(F=f.readFileXSync(O)),F=F.length>1?F:`${e}
13
- `,F=`${F}
14
- ${N}`,f.writeFileXSync(O,F);const L=i||r.join(r.dirname(s),r.basename(O));return{keysSrc:F,envKeysFilepath:L}}return Nn=c,Nn}var Ln,Oi;function Jo(){if(Oi)return Ln;Oi=1;function e(r){const[f,...c]=r.split(`
15
- `);let s="";return f.startsWith("#!")&&(s=f+`
16
- `,r=c.join(`
17
- `)),{firstLinePreserved:s,envSrc:r}}return Ln=e,Ln}var qn,Ki;function ec(){if(Ki)return qn;Ki=1;function e(r,f,c,s=".env.keys"){const i=s===".env.keys"?"":` # -fk ${s}`;return["#/-------------------[DOTENV_PUBLIC_KEY]--------------------/","#/ public-key encryption for .env files /","#/ [how it works](https://dotenvx.com/encryption) /","#/----------------------------------------------------------/",`${r}="${f}"${i}`,"",`# ${c}`].join(`
18
- `)}return qn=e,qn}var Dn,Ci;function lt(){if(Ci)return Dn;Ci=1;const e=Re,r=Jo(),f=ec();function c({envSrc:s,envFilepath:i,keysFilepath:n,publicKeyName:o,publicKeyValue:m}){const w=e.basename(i),O=e.resolve(i);let N=e.join(e.dirname(O),".env.keys");n&&(N=e.resolve(n));const F=e.relative(e.dirname(O),N),L=r(s),y=f(o,m,w,F);return s=`${L.firstLinePreserved}${y}
19
- ${L.envSrc}`,{envSrc:s}}return Dn=c,Dn}var Fn,Hi;function tc(){if(Hi)return Fn;Hi=1;const e=lt(),r=Bi(),f=hn(),c=ut(),{keyNames:s}=rt();async function i({envSrc:n,envFilepath:o,keysFilepath:m,noOps:w}){w=w!==!1;const{publicKeyName:O,privateKeyName:N}=s(o);let F,L,y,g,A=!1,q=!1;if(w){const C=c();F=C.publicKey,L=C.privateKey}else{const C=await f();F=C.publicKey,L=C.privateKey}if(n=e({envSrc:n,envFilepath:o,keysFilepath:m,publicKeyName:O,publicKeyValue:F}).envSrc,w){const C=await r({envFilepath:o,keysFilepath:m,privateKeyName:N,privateKeyValue:L});y=C.keysSrc,g=C.envKeysFilepath,A=!0}else q=!0;return{envSrc:n,keysSrc:y,publicKey:F,privateKey:L,envKeysFilepath:g,localPrivateKeyAdded:A,remotePrivateKeyAdded:q}}return Fn=i,Fn}var kn,Pi;function nc(){if(Pi)return kn;Pi=1;const e=lt(),r=Ii(),f=mn(),c=ut(),{keyNames:s}=rt();function i({envSrc:n,envFilepath:o,keysFilepath:m,noOps:w}){w=w!==!1;const{publicKeyName:O,privateKeyName:N}=s(o);let F,L,y,g,A=!1,q=!1;if(w){const C=c();F=C.publicKey,L=C.privateKey}else{const C=f();F=C.publicKey,L=C.privateKey}if(n=e({envSrc:n,envFilepath:o,keysFilepath:m,publicKeyName:O,publicKeyValue:F}).envSrc,w){const C=r({envFilepath:o,keysFilepath:m,privateKeyName:N,privateKeyValue:L});y=C.keysSrc,g=C.envKeysFilepath,A=!0}else q=!0;return{envSrc:n,keysSrc:y,publicKey:F,privateKey:L,envKeysFilepath:g,localPrivateKeyAdded:A,remotePrivateKeyAdded:q}}return kn=i,kn}var Vn,Ti;function rc(){if(Ti)return Vn;Ti=1;const e=Pe(),r=lt(),f=ut();function c({envSrc:s,envFilepath:i,keysFilepath:n,privateKeyValue:o,publicKeyValue:m,publicKeyName:w}){const{publicKey:O,privateKey:N}=f(o);if(m&&m!==O)throw new e({publicKey:O,publicKeyExisting:m}).mispairedPrivateKey();return m||(s=r({envSrc:s,envFilepath:i,keysFilepath:n,publicKeyName:w,publicKeyValue:O}).envSrc),{envSrc:s,publicKey:O,privateKey:N}}return Vn=c,Vn}var jn,Ni;function sc(){if(Ni)return jn;Ni=1;const e=je(),r=wi(),f=xi();function c(s){const i=e(s,!1,!1,!0);for(const[n,o]of Object.entries(i))for(const m of o)if(!(r(m)||f(n)))return!1;return!0}return jn=c,jn}var Mn,Li;function ic(){return Li||(Li=1,Mn={opsKeypair:hn(),opsKeypairSync:mn(),localKeypair:ut(),encryptValue:Qo(),decryptKeyValue:Ks(),isEncrypted:wi(),isPublicKey:xi(),mutateKeysSrc:Bi(),mutateKeysSrcSync:Ii(),provision:tc(),provisionSync:nc(),provisionWithPrivateKey:rc(),mutateSrc:lt(),isFullyEncrypted:sc()}),Mn}var Un,qi;function oc(){if(qi)return Un;qi=1;const e=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function r(f){const c={};let s=f.toString();s=s.replace(/\r\n?/mg,`
20
- `);let i;for(;(i=e.exec(s))!=null;){const n=i[1];let o=i[2]||"";o=o.trim();const m=o[0];o=o.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),m===o[0]?c[n]="":c[n]=m}return c}return Un=r,Un}var Gn,Di;function cc(){if(Di)return Gn;Di=1;function e(r){return r.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}return Gn=e,Gn}var $n,Fi;function ac(){if(Fi)return $n;Fi=1;function e(r){return r.replace(/\$/g,"$$$$")}return $n=e,$n}var Yn,ki;function Vi(){if(ki)return Yn;ki=1;const e=oc(),r=je(),f=cc(),c=ac();function s(i,n,o){let m,w="";const O=r(i,!0,!0),N=e(i);if(Object.prototype.hasOwnProperty.call(O,n)){const F=N[n];w+=`${n}=${F}${o}${F}`;const L=O[n],y=f(L);let g="";if(y===""){g="$";const T=i.match(new RegExp(`${n}\\s*=\\s*
21
-
22
- `,"m"));if(F===""&&T){const C=T[0].match(/\n/g).length-1;for(let _=0;_<C;_++)w+=`
23
- `}}const A=new RegExp("^(\\s*)?(export\\s+)?"+n+"\\s*=\\s*[\"'`]?"+y+"[\"'`]?"+g,"gm"),q=c(w);m=i.replace(A,`$1$2${q}`)}else w+=`${n}="${o}"`,i.endsWith(`
24
- `)?w=w+`
25
- `:w=`
26
- `+w,m=i+w;return m}return Yn=s,Yn}var Zn,ji;function uc(){if(ji)return Zn;ji=1;const e=Te(),r=Re,f="envFile",c=Pe(),{determine:s}=vi(),{keyNames:i,keyValues:n,keyValuesSync:o}=rt(),{encryptValue:m,decryptKeyValue:w,isEncrypted:O,provision:N,provisionSync:F,provisionWithPrivateKey:L}=ic(),y=Vi(),g=je(),A=qs(),q=Fs();class T{constructor(_,h,B=[],E=!0,V=null,R=!1,k=!1){this.envs=s(B,process.env),this.key=_,this.value=h,this.encrypt=E,this.envKeysFilepath=V,this.noOps=R,this.noCreate=k,this.processedEnvs=[],this.changedFilepaths=new Set,this.unchangedFilepaths=new Set,this.readableFilepaths=new Set}runSync(){for(const _ of this.envs)_.type===f&&this._setEnvFileSync(_.value);return{processedEnvs:this.processedEnvs,changedFilepaths:[...this.changedFilepaths],unchangedFilepaths:[...this.unchangedFilepaths]}}async run(){for(const _ of this.envs)_.type===f&&await this._setEnvFile(_.value);return{processedEnvs:this.processedEnvs,changedFilepaths:[...this.changedFilepaths],unchangedFilepaths:[...this.unchangedFilepaths]}}_setEnvFileSync(_){const h={};h.key=this.key||null,h.value=this.value||null,h.type=f;const B=r.resolve(_);h.filepath=B,h.envFilepath=_,h.changed=!1;try{let E=!1;e.existsSync(B)||(this.noCreate?q(B):e.writeFileXSync(B,""));const V=q(B);let R=e.readFileXSync(B,{encoding:V});h.key&&R.trim().length===0&&(R=`${h.key}="${this.value}"
27
- `,E=!0);const k=g(R);h.originalValue=k[h.key]||null,E&&(h.originalValue=null);const U=!O(h.originalValue);if(this.readableFilepaths.add(_),this.encrypt){let a,H;const{publicKeyName:l,privateKeyName:u}=i(B),{publicKeyValue:p,privateKeyValue:K}=o(B,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});if(!K&&!p){const t=F({envSrc:R,envFilepath:_,keysFilepath:this.envKeysFilepath,noOps:this.noOps});R=t.envSrc,a=t.publicKey,H=t.privateKey,h.envKeysFilepath=t.envKeysFilepath,h.localPrivateKeyAdded=t.localPrivateKeyAdded,h.remotePrivateKeyAdded=t.remotePrivateKeyAdded}else if(K){const t=L({envSrc:R,envFilepath:_,keysFilepath:this.envKeysFilepath,privateKeyValue:K,publicKeyValue:p,publicKeyName:l});a=t.publicKey,H=t.privateKey,R=t.envSrc,h.originalValue&&(h.originalValue=w(h.key,h.originalValue,u,H))}else p&&(a=p);h.publicKey=a,h.privateKey=H;try{h.encryptedValue=m(this.value,a)}catch{throw new c({publicKeyName:l,publicKey:a}).invalidPublicKey()}h.privateKeyName=u}const Z=U&&this.encrypt,G=this.value!==h.originalValue;E&&!this.encrypt?(h.envSrc=R,this.changedFilepaths.add(_),h.changed=!0):Z||G?(h.envSrc=y(R,this.key,h.encryptedValue||this.value),this.changedFilepaths.add(_),h.changed=!0):(h.envSrc=R,this.unchangedFilepaths.add(_),h.changed=!1)}catch(E){E.code==="ENOENT"?h.error=new c({envFilepath:_,filepath:B}).missingEnvFile():h.error=E}this.processedEnvs.push(h)}async _setEnvFile(_){const h={};h.key=this.key||null,h.value=this.value||null,h.type=f;const B=r.resolve(_);h.filepath=B,h.envFilepath=_,h.changed=!1;try{let E=!1;await e.exists(B)||(this.noCreate?await A(B):await e.writeFileX(B,""));const V=await A(B);let R=await e.readFileX(B,{encoding:V});h.key&&R.trim().length===0&&(R=`${h.key}="${this.value}"
28
- `,E=!0);const k=g(R);h.originalValue=k[h.key]||null,E&&(h.originalValue=null);const U=!O(h.originalValue);if(this.readableFilepaths.add(_),this.encrypt){let a,H;const{publicKeyName:l,privateKeyName:u}=i(B),{publicKeyValue:p,privateKeyValue:K}=await n(B,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});if(!K&&!p){const t=await N({envSrc:R,envFilepath:_,keysFilepath:this.envKeysFilepath,noOps:this.noOps});R=t.envSrc,a=t.publicKey,H=t.privateKey,h.envKeysFilepath=t.envKeysFilepath,h.localPrivateKeyAdded=t.localPrivateKeyAdded,h.remotePrivateKeyAdded=t.remotePrivateKeyAdded}else if(K){const t=L({envSrc:R,envFilepath:_,keysFilepath:this.envKeysFilepath,privateKeyValue:K,publicKeyValue:p,publicKeyName:l});a=t.publicKey,H=t.privateKey,R=t.envSrc,h.originalValue&&(h.originalValue=w(h.key,h.originalValue,u,H))}else p&&(a=p);h.publicKey=a,h.privateKey=H;try{h.encryptedValue=m(this.value,a)}catch{throw new c({publicKeyName:l,publicKey:a}).invalidPublicKey()}h.privateKeyName=u}const Z=U&&this.encrypt,G=this.value!==h.originalValue;E&&!this.encrypt?(h.envSrc=R,this.changedFilepaths.add(_),h.changed=!0):Z||G?(h.envSrc=y(R,this.key,h.encryptedValue||this.value),this.changedFilepaths.add(_),h.changed=!0):(h.envSrc=R,this.unchangedFilepaths.add(_),h.changed=!1)}catch(E){E.code==="ENOENT"?h.error=new c({envFilepath:_,filepath:B}).missingEnvFile():h.error=E}this.processedEnvs.push(h)}}return Zn=T,Zn}var Xn,Mi;function lc(){if(Mi)return Xn;Mi=1;const e=gi(),r=Pe();class f{constructor(s,i=[],n=!1,o=!1,m=null,w=!1){this.key=s,this.envs=i,this.overload=n,this.all=o,this.envKeysFilepath=m,this.noOps=w}runSync(){const s={...process.env},{processedEnvs:i}=new e(this.envs,this.overload,s,this.envKeysFilepath,this.noOps).runSync();return this._result(i,s)}async run(){const s={...process.env},{processedEnvs:i}=await new e(this.envs,this.overload,s,this.envKeysFilepath,this.noOps).run();return this._result(i,s)}_result(s,i){const n=[];for(const m of s)for(const w of m.errors)n.push(w);if(this.key){const m={},w=i[this.key];return m[this.key]=w,w===void 0&&n.push(new r({key:this.key}).missingKey()),{parsed:m,errors:n}}if(this.all)return{parsed:i,errors:n};const o={};for(const m of s)if(m.parsed)for(const w of Object.keys(m.parsed))o[w]=i[w];return{parsed:o,errors:n}}}return Xn=f,Xn}var Wn,Ui;function fc(){if(Ui)return Wn;Ui=1;const{keyNames:e,keyValues:r,keyValuesSync:f}=rt();class c{constructor(i=".env",n=null,o=!1){this.envFile=i,this.envKeysFilepath=n,this.noOps=o}runSync(){const i={},n=this._filepaths();for(const o of n){const{publicKeyName:m,privateKeyName:w}=e(o),{publicKeyValue:O,privateKeyValue:N}=f(o,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});i[m]=O,i[w]=N}return i}async run(){const i={},n=this._filepaths();for(const o of n){const{publicKeyName:m,privateKeyName:w}=e(o),{publicKeyValue:O,privateKeyValue:N}=await r(o,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});i[m]=O,i[w]=N}return i}_filepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return Wn=c,Wn}var zn,Gi;function dc(){if(Gi)return zn;Gi=1;const e=Te(),r=Re,f=Pe(),c=yi(),s=Vi(),i=je();class n{constructor(m=".",w){this.directory=m,this.envFile=w||c(m),this.exampleFilename=".env.example",this.exampleFilepath=r.resolve(this.directory,this.exampleFilename)}run(){if(this.envFile.length<1)throw new f().missingEnvFiles();const m=new Set,w=new Set,O=this._envFilepaths(),N={},F={};let L=`# ${this.exampleFilename} - generated with dotenvx
29
- `;for(const y of O){const g=r.resolve(this.directory,y);if(!e.existsSync(g)){const T=new f({envFilepath:y,filepath:g}).missingEnvFile();throw T.help=`? add it with [echo "HELLO=World" > ${y}] and then run [dotenvx genexample]`,T}let A=e.readFileXSync(g);const q=i(A);for(const T in q)m.add(T),A=s(A,T,"");L+=`
30
- ${A}`}if(e.existsSync(this.exampleFilepath)){L=e.readFileXSync(this.exampleFilepath);const y=i(L);for(const g of[...m])g in y?F[g]=y[g]:(L+=`${g}=''
31
- `,w.add(g),N[g]="")}else for(const y of[...m])w.add(y),N[y]="";return{envExampleFile:L,envFile:this.envFile,exampleFilepath:this.exampleFilepath,addedKeys:[...w],injected:N,preExisted:F}}_envFilepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return zn=n,zn}var Qn,$i;function hc(){if($i)return Qn;$i=1;const e=fn(),{logger:r}=Or();class f{constructor(){this.ops=new e}async noOps(){const s=await this.ops.status();return r.debug(`ops: ${s}`),s==="off"}noOpsSync(){const s=this.ops.statusSync();return r.debug(`ops: ${s}`),s==="off"}}return Qn=f,Qn}var Jn,Yi;function yc(){if(Yi)return Jn;Yi=1;const e=Re;function r(f){return f?e.isAbsolute(f)?e.relative(process.cwd(),f)||e.basename(f):f:".env.keys"}return Jn=r,Jn}var er,Zi;function pc(){if(Zi)return er;Zi=1;const e=Re,{setLogLevel:r,setLogName:f,setLogVersion:c,logger:s}=Or(),{getColor:i,bold:n}=Rr(),o=Ao(),m=gi(),w=uc(),O=lc(),N=fc(),F=dc(),L=hc(),y=fi(),g=Ns(),A=Te(),q=yc(),T=function(k={}){let U=process.env;k&&k.processEnv!=null&&(U=k.processEnv);const Z=k.overload||k.override,G=k.ignore||[],$=k.strict,a=k.envKeysFile;k&&(r(k),f(k),c(k));const H=R(k);try{const l=y(k),{processedEnvs:u,readableFilepaths:p,uniqueInjectedKeys:K}=new m(l,Z,U,a,H).runSync();let t;const v={};for(const x of u){x.type==="envFile"&&s.verbose(`loading env from ${x.filepath} (${e.resolve(x.filepath)})`);for(const D of x.errors||[]){if(G.includes(D.code)){s.verbose(`ignored: ${D.message}`);continue}if($)throw D;t=D,D.code==="MISSING_ENV_FILE"&&k.convention||s.error(D.messageWithHelp)}Object.assign(v,x.injected||{}),Object.assign(v,x.preExisted||{}),s.debug(x.parsed);for(const[D,J]of Object.entries(x.injected||{}))s.verbose(`${D} set`),s.debug(`${D} set to ${J}`);for(const[D,J]of Object.entries(x.preExisted||{}))s.verbose(`${D} pre-exists (protip: use --overload to override)`),s.debug(`${D} pre-exists as ${J} (protip: use --overload to override)`)}let S=`injecting env (${K.length})`;return p.length>0&&(S+=` from ${p.join(", ")}`),s.successv(S),t?{parsed:v,error:t}:{parsed:v}}catch(l){if($)throw l;return s.error(l.messageWithHelp),{parsed:{},error:l}}},C=function(k,U={}){let Z=process.env;U&&U.processEnv!=null&&(Z=U.processEnv);const G=U.privateKey||null,$=U.overload||U.override,{parsed:a,errors:H}=new g(k,G,Z,$).run();for(const l of H)s.error(l.messageWithHelp);return a},_=function(k,U,Z={}){let G=!0;(Z.plain||Z.encrypt===!1)&&(G=!1),Z&&(r(Z),f(Z),c(Z));const $=y(Z),a=Z.envKeysFile,H=R(Z),{processedEnvs:l,changedFilepaths:u,unchangedFilepaths:p}=new w(k,U,$,G,a,H).runSync();let K="";G&&(K=" with encryption");for(const x of l)if(s.verbose(`setting for ${x.envFilepath}`),x.error){const D=x.error,J=D.messageWithHelp||(D.help?`${D.message}. ${D.help}`:D.message);s.warn(J)}else A.writeFileXSync(x.filepath,x.envSrc),s.verbose(`${x.key} set${K} (${x.envFilepath})`),s.debug(`${x.key} set${K} to ${x.value} (${x.envFilepath})`);let t="";const v=l.find(x=>x.localPrivateKeyAdded),S=l.find(x=>x.remotePrivateKeyAdded);if(v&&(t=` + local key (${q(v.envKeysFilepath)})`),S&&(t=" + armored key \u26E8"),u.length>0)G?s.success(`\u25C8 encrypted ${k} (${u.join(",")})${t}`):s.success(`\u25C7 set ${k} (${u.join(",")})`);else if(G&&v){const x=v.envFilepath||u[0]||".env";s.success(`\u25C8 encrypted ${k} (${x})${t}`)}else p.length>0&&s.info(`\u25CB no change (${p})`);return{processedEnvs:l,changedFilepaths:u,unchangedFilepaths:p}},h=function(k,U={}){const Z=y(U),G=R(U),$=U.ignore||[],{parsed:a,errors:H}=new O(k,Z,U.overload,U.all,U.envKeysFile,G).runSync();for(const l of H||[])if(!$.includes(l.code)){if(U.strict)throw l;s.error(l.messageWithHelp)}if(k){const l=a[k];return l===void 0?void 0:l}else if(U.format==="eval"){let l="";for(const[u,p]of Object.entries(a))l+=`${u}=${escape(p)}
32
- `;return l=l.trim(),l}else if(U.format==="shell"){let l="";for(const[u,p]of Object.entries(a))l+=`${u}=${p} `;return l=l.trim(),l}else return a},B=function(k,U,Z){return new o(k,U,Z).run()},E=function(k,U){return new F(k,U).run()},V=function(k,U,Z=null,G=!1){const $=new N(k,Z,G).runSync();return U?$[U]:$};function R(k={}){const U=new L;return k.noOps===!0||k.opsOff===!0||U.noOpsSync()}return er={config:T,parse:C,set:_,get:h,ls:B,keypair:V,genexample:E,setLogLevel:r,logger:s,getColor:i,bold:n},er}var Xi;function vc(){return Xi||(Xi=1,pc().config()),rr}vc();const mc={ALGOLIA_APP_ID:"ALGOLIA_APP_ID",ALGOLIA_ADMIN_API_KEY:"ALGOLIA_ADMIN_API_KEY",ALGOLIA_INDEX_NAME:"ALGOLIA_INDEX_NAME",DATA_DIR:"DATA_DIR"};class Ze{static instance;envVars;constructor(){this.envVars={},Object.values(mc).forEach(r=>{const f=process.env[r];if(f==null)throw new Error(`Missing required environment variable: ${r}`);this.envVars[r]=f})}static getInstance(){return Ze.instance||(Ze.instance=new Ze),Ze.instance}getConfig(r){return this.envVars[r]}}function Wi(e){return typeof e=="object"&&e!==null&&"objectID"in e&&typeof e.objectID=="string"}function gc(e){const r=Object.keys(e).sort(),f={objectID:e.objectID};for(const c of r)c!=="objectID"&&(f[c]=e[c]);return f}function zi(e){return e.map(gc).sort((r,f)=>r.objectID.localeCompare(f.objectID))}class bc{client;indexName;constructor(r){this.client=r.getClient(),this.indexName=r.getIndexName()}async uploadObjects(r){if(r.length===0){console.error("No items are included in the target JSON file. More than 1 item is necessary.");return}let f=await this.getAllObjects();f=zi(f);const c=zi(r),s=this.determineOperations(f,c);if(s.update.length===0&&s.add.length===0&&s.delete.length===0){console.log("No updates needed. All objects are up to date.");return}if(s.update.length>0){const i=await this.client.partialUpdateObjects({indexName:this.indexName,objects:s.update,createIfNotExists:!0});console.log(`Updated ${i[0].objectIDs.length} objects`)}if(s.add.length>0){const i=await this.client.saveObjects({indexName:this.indexName,objects:s.add});console.log(`Added ${i[0].objectIDs.length} objects`)}if(s.delete.length>0){const i=s.delete.map(o=>o.objectID),n=await this.client.deleteObjects({indexName:this.indexName,objectIDs:i});console.log(`Deleted ${n[0].objectIDs.length} objects`)}}async getAllObjects(){const r=[];return await this.client.browseObjects({indexName:this.indexName,aggregator:f=>{Array.isArray(f.hits)&&f.hits.forEach(c=>{Wi(c)&&r.push(c)})}}),r}determineOperations(r,f){const c=new Map(r.map(n=>[n.objectID,n])),s=new Map(f.map(n=>[n.objectID,n])),i={update:[],add:[],delete:[]};for(const n of f){const o=c.get(n.objectID);o==null?i.add.push(n):co(o,n)||i.update.push(n)}for(const n of r)s.has(n.objectID)||i.delete.push(n);return i}}class tr{static instance;client;indexName;constructor(r,f){this.client=f(r.getConfig("ALGOLIA_APP_ID"),r.getConfig("ALGOLIA_ADMIN_API_KEY")),this.indexName=r.getConfig("ALGOLIA_INDEX_NAME")}static getInstance(){if(!this.instance){const r=Ze.getInstance();this.instance=new tr(r,ao)}return this.instance}getClient(){return this.client}getIndexName(){return this.indexName}}const Ec=to({meta:{name:uo,version:lo,description:fo},args:{},async run({args:e}){try{let r=Ze.getInstance().getConfig("DATA_DIR");r=Re.join(process.cwd(),r),Fe.existsSync(r)&&Fe.statSync(r).isDirectory()||(console.error(`Error: provided directory does not exist - ${r}`),process.exit(1));const f=ho(r)[0];f.every(s=>Wi(s))||(console.error(`The content of the provided json file is incompatible. Check the file: ${r}`),process.exit(1));const c=tr.getInstance();await new bc(c).uploadObjects(f)}catch(r){console.error("Some errors occured: ",r),process.exit(1)}}});no(Ec);
2
+ import{createRequire as e}from"node:module";import t from"node:fs";import n from"node:path";import{defineCommand as r,runMain as i}from"citty";import{algoliasearch as a}from"algoliasearch";import{isEqual as o}from"es-toolkit";var s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=e(import.meta.url),l=`algolia-uploader`,u=`0.0.15-beta.2`,d=`command-line util to upload Algolia source`;function f(e){return typeof e==`object`&&!!e&&`objectID`in e&&typeof e.objectID==`string`}function p(e){let t=Object.keys(e).sort(),n={objectID:e.objectID};for(let r of t)r!==`objectID`&&(n[r]=e[r]);return n}function m(e){return e.map(p).sort((e,t)=>e.objectID.localeCompare(t.objectID))}var h=s(((e,t)=>{t.exports={version:`1.66.0`,name:`@dotenvx/dotenvx`,description:"secrets for agents–from the creator of `dotenv`",author:`@motdotla`,keywords:[`dotenv`,`env`],homepage:`https://github.com/dotenvx/dotenvx`,repository:{type:`git`,url:`git+https://github.com/dotenvx/dotenvx.git`},license:`BSD-3-Clause`,files:[`src/**/*`,`CHANGELOG.md`],main:`src/lib/main.js`,types:`src/lib/main.d.ts`,exports:{".":{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`},bin:{dotenvx:`./src/cli/dotenvx.js`},scripts:{standard:`standard`,"standard:fix":`standard --fix`,test:`tap run --test-env=DOTENVX_NO_OPS=true --allow-empty-coverage --disable-coverage --timeout=60000`,"test-coverage":`tap run --test-env=DOTENVX_NO_OPS=true --show-full-coverage --timeout=60000`,testshell:`bash shellspec`,prerelease:`npm test && npm run testshell`,release:`standard-version`},funding:`https://dotenvx.com`,dependencies:{commander:`^11.1.0`,dotenv:`^17.2.1`,eciesjs:`^0.4.10`,execa:`^5.1.1`,fdir:`^6.2.0`,ignore:`^5.3.0`,"object-treeify":`1.1.33`,picomatch:`^4.0.4`,which:`^4.0.0`,"yocto-spinner":`^1.1.0`},devDependencies:{"@yao-pkg/pkg":`^6.14.2`,"capture-console":`^1.0.2`,esbuild:`^0.25.8`,proxyquire:`^2.1.3`,sinon:`^14.0.1`,standard:`^17.1.0`,"standard-version":`^9.5.0`,tap:`^21.0.1`},publishConfig:{access:`public`,provenance:!0}}})),g=s(((e,t)=>{let{name:n,version:r,description:i}=h();t.exports={name:n,version:r,description:i}})),_=s(((e,t)=>{function n(e,t=7){return e&&e.length>0?e.slice(0,t)+`…`:``}t.exports=n})),v=s(((e,t)=>{let n=_(),r={COMMAND_EXITED_WITH_CODE:`https://github.com/dotenvx/dotenvx/issues/new`,COMMAND_SUBSTITUTION_FAILED:`https://github.com/dotenvx/dotenvx/issues/532`,DECRYPTION_FAILED:`https://github.com/dotenvx/dotenvx/issues/757`,DANGEROUS_DEPENDENCY_HOIST:`https://github.com/dotenvx/dotenvx/issues/622`,INVALID_COLOR:`must be 256 colors`,INVALID_CONVENTION:`https://github.com/dotenvx/dotenvx/issues/761`,INVALID_PRIVATE_KEY:`https://github.com/dotenvx/dotenvx/issues/465`,INVALID_PUBLIC_KEY:`https://github.com/dotenvx/dotenvx/issues/756`,MALFORMED_ENCRYPTED_DATA:`https://github.com/dotenvx/dotenvx/issues/467`,MISPAIRED_PRIVATE_KEY:`https://github.com/dotenvx/dotenvx/issues/752`,MISSING_DIRECTORY:`https://github.com/dotenvx/dotenvx/issues/758`,MISSING_ENV_FILE:`https://github.com/dotenvx/dotenvx/issues/484`,MISSING_ENV_KEYS_FILE:`https://github.com/dotenvx/dotenvx/issues/775`,MISSING_ENV_FILES:`https://github.com/dotenvx/dotenvx/issues/760`,MISSING_KEY:`https://github.com/dotenvx/dotenvx/issues/759`,MISSING_LOG_LEVEL:`must be valid log level`,MISSING_PRIVATE_KEY:`https://github.com/dotenvx/dotenvx/issues/464`,PRECOMMIT_HOOK_MODIFY_FAILED:`try again or report error`,WRONG_PRIVATE_KEY:`https://github.com/dotenvx/dotenvx/issues/466`};var i=class{constructor(e={}){this.filepath=e.filepath,this.envFilepath=e.envFilepath,this.envKeysFilepath=e.envKeysFilepath,this.key=e.key,this.privateKey=e.privateKey,this.privateKeyName=e.privateKeyName,this.publicKeyName=e.publicKeyName,this.publicKey=e.publicKey,this.publicKeyExisting=e.publicKeyExisting,this.command=e.command,this.message=e.message,this.code=e.code,this.help=e.help,this.debug=e.debug,this.convention=e.convention,this.directory=e.directory,this.exitCode=e.exitCode,this.level=e.level,this.color=e.color,this.error=e.error}custom(){let e=Error(this.message);return this.code&&(e.code=this.code),this.help&&(e.help=this.help),this.code&&!e.help&&(e.help=`fix: [${r[this.code]}]`),e.messageWithHelp=`${e.message}. ${e.help}`,this.debug&&(e.debug=this.debug),e}commandExitedWithCode(){let e=`COMMAND_EXITED_WITH_CODE`,t=`[${e}] Command exited with exit code ${this.exitCode}`,n=`fix: [${r[e]}]`,i=Error(t);return i.code=e,i.help=n,i.messageWithHelp=`${t}. ${n}`,i}commandSubstitutionFailed(){let e=`COMMAND_SUBSTITUTION_FAILED`,t=`[${e}] could not eval ${this.key} containing command '${this.command}': ${this.message}`,n=`fix: [${r[e]}]`,i=Error(t);return i.code=e,i.help=n,i.messageWithHelp=`${t}. ${n}`,i}decryptionFailed(){let e=`DECRYPTION_FAILED`,t=`[${e}] ${this.message}`,n=`fix: [${r[e]}]`,i=Error(t);return i.code=e,i.help=n,i.messageWithHelp=`${t}. ${n}`,i}dangerousDependencyHoist(){let e=`DANGEROUS_DEPENDENCY_HOIST`,t=`[${e}] your environment has hoisted an incompatible version of a dotenvx dependency: ${this.message}`,n=`fix: [${r[e]}]`,i=Error(t);return i.code=e,i.help=n,i.messageWithHelp=`${t}. ${n}`,i}invalidColor(){let e=`INVALID_COLOR`,t=`[${e}] Invalid color ${this.color}`,n=`fix: [${r[e]}]`,i=Error(t);return i.code=e,i.help=n,i.messageWithHelp=`${t}. ${n}`,i}invalidConvention(){let e=`INVALID_CONVENTION`,t=`[${e}] invalid convention (${this.convention})`,n=`fix: [${r[e]}]`,i=Error(t);return i.code=e,i.help=n,i.messageWithHelp=`${t}. ${n}`,i}invalidPrivateKey(){let e=`INVALID_PRIVATE_KEY`,t=`[${e}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${n(this.privateKey)}'`,i=`fix: [${r[e]}]`,a=Error(t);return a.code=e,a.help=i,a.messageWithHelp=`${t}. ${i}`,a}invalidPublicKey(){let e=`INVALID_PUBLIC_KEY`,t=`[${e}] could not encrypt using public key '${this.publicKeyName}=${n(this.publicKey)}'`,i=`fix: [${r[e]}]`,a=Error(t);return a.code=e,a.help=i,a.messageWithHelp=`${t}. ${i}`,a}malformedEncryptedData(){let e=`MALFORMED_ENCRYPTED_DATA`,t=`[${e}] could not decrypt ${this.key} because encrypted data appears malformed`,n=`fix: [${r[e]}]`,i=Error(t);return i.code=e,i.help=n,i.messageWithHelp=`${t}. ${n}`,i}mispairedPrivateKey(){let e=`MISPAIRED_PRIVATE_KEY`,t=`[${e}] private key's derived public key (${n(this.publicKey)}) does not match the existing public key (${n(this.publicKeyExisting)})`,i=`fix: [${r[e]}]`,a=Error(t);return a.code=e,a.help=i,a.messageWithHelp=`${t}. ${i}`,a}missingDirectory(){let e=`MISSING_DIRECTORY`,t=`[${e}] missing directory (${this.directory})`,n=`fix: [${r[e]}]`,i=Error(t);return i.code=e,i.help=n,i.messageWithHelp=`${t}. ${n}`,i}missingEnvFile(){let e=`MISSING_ENV_FILE`,t=`[${e}] missing file (${this.envFilepath||`.env`})`,n=`fix: [${r[e]}]`,i=Error(t);return i.code=e,i.help=n,i.messageWithHelp=`${t}. ${n}`,i}missingEnvKeysFile(){let e=`MISSING_ENV_KEYS_FILE`,t=`[${e}] missing file (${this.envKeysFilepath||`.env.keys`})`,n=`fix: [${r[e]}]`,i=Error(t);return i.code=e,i.help=n,i.messageWithHelp=`${t}. ${n}`,i}missingEnvFiles(){let e=`MISSING_ENV_FILES`,t=`[${e}] no .env* files found`,n=`fix: [${r[e]}]`,i=Error(t);return i.code=e,i.help=n,i.messageWithHelp=`${t}. ${n}`,i}missingKey(){let e=`MISSING_KEY`,t=`[${e}] missing key (${this.key})`,n=`fix: [${r[e]}]`,i=Error(t);return i.code=e,i.help=n,i.messageWithHelp=`${t}. ${n}`,i}missingLogLevel(){let e=`MISSING_LOG_LEVEL`,t=`[${e}] missing log level '${this.level}'. implement in logger`,n=`fix: [${r[e]}]`,i=Error(t);return i.code=e,i.help=n,i.messageWithHelp=`${t}. ${n}`,i}missingPrivateKey(){let e=`MISSING_PRIVATE_KEY`,t=`[${e}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${n(this.privateKey)}'`,i=`fix: [${r[e]}]`,a=Error(t);return a.code=e,a.help=i,a.messageWithHelp=`${t}. ${i}`,a}precommitHookModifyFailed(){let e=`PRECOMMIT_HOOK_MODIFY_FAILED`,t=`[${e}] failed to modify pre-commit hook: ${this.error.message}`,n=`fix: [${r[e]}]`,i=Error(t);return i.code=e,i.help=n,i.messageWithHelp=`${t}. ${n}`,i}wrongPrivateKey(){let e=`WRONG_PRIVATE_KEY`,t=`[${e}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${n(this.privateKey)}'`,i=`fix: [${r[e]}]`,a=Error(t);return a.code=e,a.help=i,a.messageWithHelp=`${t}. ${i}`,a}};i.ISSUE_BY_CODE=r,t.exports=i})),y=s(((e,t)=>{let{WriteStream:n}=c(`tty`);t.exports={getColorDepth:()=>{try{return n.prototype.getColorDepth()}catch{let e=process.env.TERM;return e&&(e.includes(`256color`)||e.includes(`xterm`))?8:4}}}})),b=s(((e,t)=>{let n=y(),r=v(),i=new Map([[`amber`,33],[`blue`,34],[`gray`,37],[`green`,32],[`olive`,33],[`orangered`,33],[`plum`,35],[`red`,31],[`electricblue`,36],[`dodgerblue`,36]]),a=new Map([[`amber`,136],[`blue`,21],[`gray`,244],[`green`,34],[`olive`,142],[`orangered`,130],[`plum`,182],[`red`,124],[`electricblue`,45],[`dodgerblue`,33]]),o=new Map([[`amber`,[236,213,63]],[`orangered`,[138,90,43]],[`red`,[140,35,50]]]);function s(e){let t=n.getColorDepth();if(!a.has(e))throw new r({color:e}).invalidColor();if(t>=24&&o.has(e)){let[t,n,r]=o.get(e);return e=>`\x1b[38;2;${t};${n};${r}m${e}\x1b[39m`}if(t>=8){let t=a.get(e);return e=>`\x1b[38;5;${t}m${e}\x1b[39m`}if(t>=4){let t=i.get(e);return e=>`\x1b[${t}m${e}\x1b[39m`}return e=>e}function c(e){return n.getColorDepth()>=4?`\x1b[1m${e}\x1b[22m`:e}t.exports={getColor:s,bold:c}})),x=s(((e,t)=>{let n=g(),r=v(),{getColor:i,bold:a}=b(),o={error:0,warn:1,success:2,successv:2,info:2,help:2,verbose:4,debug:5,silly:6},s=e=>a(i(`red`)(`☠ ${e}`)),c=e=>i(`orangered`)(`⚠ ${e}`),l=i(`amber`),u=e=>i(`amber`)(`⟐ ${e}`),d=i(`gray`),f=i(`dodgerblue`),p=e=>i(`plum`)(`┆ ${e}`),m=e=>i(`plum`)(`┆ ${e}`),h=o.info,_=`dotenvx`,y=n.version;function x(e,t){let n=C(e,t);console.error(n)}function S(e,t){if(o[e]===void 0)throw new r({level:e}).missingLogLevel();if(o[e]<=h){let n=C(e,t);console.log(n)}}function C(e,t){let n=typeof t==`object`?JSON.stringify(t):t;switch(e.toLowerCase()){case`error`:return s(n);case`warn`:return c(n);case`success`:return l(n);case`successv`:return u(`${n} · ${_}@${y}`);case`info`:return d(n);case`help`:return f(n);case`verbose`:return p(n);case`debug`:return m(n)}}let w={level:`info`,error:e=>x(`error`,e),warn:e=>S(`warn`,e),success:e=>S(`success`,e),successv:e=>S(`successv`,e),info:e=>S(`info`,e),help:e=>S(`help`,e),verbose:e=>S(`verbose`,e),debug:e=>S(`debug`,e),setLevel:e=>{o[e]!==void 0&&(h=o[e],w.level=e)},setName:e=>{_=e,w.name=e},setVersion:e=>{y=e,w.version=e}};function T(e){let t=e.debug?`debug`:e.verbose?`verbose`:e.quiet?`error`:e.logLevel;t&&(w.setLevel(t),(!e.quiet||e.quiet&&t!==`error`)&&w.debug(`setting log level to: ${t}`))}function E(e){let t=e.logName;t&&w.setName(t)}function D(e){let t=e.logVersion;t&&w.setVersion(t)}t.exports={logger:w,getColor:i,setLogLevel:T,setLogName:E,setLogVersion:D,levels:o}})),S=s(((e,t)=>{let n=`[^\\\\/]`,r=`[^/]`,i=`(?:\\/|$)`,a=`(?:^|\\/)`,o=`\\.{1,2}${i}`,s={DOT_LITERAL:`\\.`,PLUS_LITERAL:`\\+`,QMARK_LITERAL:`\\?`,SLASH_LITERAL:`\\/`,ONE_CHAR:`(?=.)`,QMARK:r,END_ANCHOR:i,DOTS_SLASH:o,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!${a}${o})`,NO_DOT_SLASH:`(?!\\.{0,1}${i})`,NO_DOTS_SLASH:`(?!${o})`,QMARK_NO_DOT:`[^.\\/]`,STAR:`${r}*?`,START_ANCHOR:a,SEP:`/`},c={...s,SLASH_LITERAL:`[\\\\/]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`\\.{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!\\.{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!\\.{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:`[^.\\\\/]`,START_ANCHOR:`(?:^|[\\\\/])`,END_ANCHOR:`(?:[\\\\/]|$)`,SEP:`\\`};t.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:{__proto__:null,alnum:`a-zA-Z0-9`,alpha:`a-zA-Z`,ascii:`\\x00-\\x7F`,blank:` \\t`,cntrl:`\\x00-\\x1F\\x7F`,digit:`0-9`,graph:`\\x21-\\x7E`,lower:`a-z`,print:`\\x20-\\x7E `,punct:`\\-!"#$%&'()\\*+,./:;<=>?@[\\]^_\`{|}~`,space:` \\t\\r\\n\\v\\f`,upper:`A-Z`,word:`A-Za-z0-9_`,xdigit:`A-Fa-f0-9`},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":`*`,"**/**":`**`,"**/**/**":`**`},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(e){return{"!":{type:`negate`,open:`(?:(?!(?:`,close:`))${e.STAR})`},"?":{type:`qmark`,open:`(?:`,close:`)?`},"+":{type:`plus`,open:`(?:`,close:`)+`},"*":{type:`star`,open:`(?:`,close:`)*`},"@":{type:`at`,open:`(?:`,close:`)`}}},globChars(e){return e===!0?c:s}}})),C=s((e=>{let{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=S();e.isObject=e=>typeof e==`object`&&!!e&&!Array.isArray(e),e.hasRegexChars=e=>r.test(e),e.isRegexChar=t=>t.length===1&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(i,`\\$1`),e.toPosixSlashes=e=>e.replace(t,`/`),e.isWindows=()=>{if(typeof navigator<`u`&&navigator.platform){let e=navigator.platform.toLowerCase();return e===`win32`||e===`windows`}return typeof process<`u`&&process.platform?process.platform===`win32`:!1},e.removeBackslashes=e=>e.replace(n,e=>e===`\\`?``:e),e.escapeLast=(t,n,r)=>{let i=t.lastIndexOf(n,r);return i===-1?t:t[i-1]===`\\`?e.escapeLast(t,n,i-1):`${t.slice(0,i)}\\${t.slice(i)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith(`./`)&&(n=n.slice(2),t.prefix=`./`),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?``:`^`}(?:${e})${n.contains?``:`$`}`;return t.negated===!0&&(r=`(?:^(?!${r}).*$)`),r},e.basename=(e,{windows:t}={})=>{let n=e.split(t?/[\\/]/:`/`),r=n[n.length-1];return r===``?n[n.length-2]:r}})),w=s(((e,t)=>{let n=C(),{CHAR_ASTERISK:r,CHAR_AT:i,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:c,CHAR_FORWARD_SLASH:l,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:d,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_PLUS:p,CHAR_QUESTION_MARK:m,CHAR_RIGHT_CURLY_BRACE:h,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:_}=S(),v=e=>e===l||e===a,y=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let b=t||{},x=e.length-1,S=b.parts===!0||b.scanToEnd===!0,C=[],w=[],T=[],E=e,D=-1,O=0,k=0,A=!1,j=!1,M=!1,N=!1,P=!1,F=!1,I=!1,L=!1,R=!1,z=!1,B=0,V,H,U={value:``,depth:0,isGlob:!1},W=()=>D>=x,G=()=>E.charCodeAt(D+1),K=()=>(V=H,E.charCodeAt(++D));for(;D<x;){H=K();let e;if(H===a){I=U.backslashes=!0,H=K(),H===u&&(F=!0);continue}if(F===!0||H===u){for(B++;W()!==!0&&(H=K());){if(H===a){I=U.backslashes=!0,K();continue}if(H===u){B++;continue}if(F!==!0&&H===s&&(H=K())===s){if(A=U.isBrace=!0,M=U.isGlob=!0,z=!0,S===!0)continue;break}if(F!==!0&&H===o){if(A=U.isBrace=!0,M=U.isGlob=!0,z=!0,S===!0)continue;break}if(H===h&&(B--,B===0)){F=!1,A=U.isBrace=!0,z=!0;break}}if(S===!0)continue;break}if(H===l){if(C.push(D),w.push(U),U={value:``,depth:0,isGlob:!1},z===!0)continue;if(V===s&&D===O+1){O+=2;continue}k=D+1;continue}if(b.noext!==!0&&(H===p||H===i||H===r||H===m||H===c)&&G()===d){if(M=U.isGlob=!0,N=U.isExtglob=!0,z=!0,H===c&&D===O&&(R=!0),S===!0){for(;W()!==!0&&(H=K());){if(H===a){I=U.backslashes=!0,H=K();continue}if(H===g){M=U.isGlob=!0,z=!0;break}}continue}break}if(H===r){if(V===r&&(P=U.isGlobstar=!0),M=U.isGlob=!0,z=!0,S===!0)continue;break}if(H===m){if(M=U.isGlob=!0,z=!0,S===!0)continue;break}if(H===f){for(;W()!==!0&&(e=K());){if(e===a){I=U.backslashes=!0,K();continue}if(e===_){j=U.isBracket=!0,M=U.isGlob=!0,z=!0;break}}if(S===!0)continue;break}if(b.nonegate!==!0&&H===c&&D===O){L=U.negated=!0,O++;continue}if(b.noparen!==!0&&H===d){if(M=U.isGlob=!0,S===!0){for(;W()!==!0&&(H=K());){if(H===d){I=U.backslashes=!0,H=K();continue}if(H===g){z=!0;break}}continue}break}if(M===!0){if(z=!0,S===!0)continue;break}}b.noext===!0&&(N=!1,M=!1);let q=E,J=``,Y=``;O>0&&(J=E.slice(0,O),E=E.slice(O),k-=O),q&&M===!0&&k>0?(q=E.slice(0,k),Y=E.slice(k)):M===!0?(q=``,Y=E):q=E,q&&q!==``&&q!==`/`&&q!==E&&v(q.charCodeAt(q.length-1))&&(q=q.slice(0,-1)),b.unescape===!0&&(Y&&=n.removeBackslashes(Y),q&&I===!0&&(q=n.removeBackslashes(q)));let X={prefix:J,input:e,start:O,base:q,glob:Y,isBrace:A,isBracket:j,isGlob:M,isExtglob:N,isGlobstar:P,negated:L,negatedExtglob:R};if(b.tokens===!0&&(X.maxDepth=0,v(H)||w.push(U),X.tokens=w),b.parts===!0||b.tokens===!0){let t;for(let n=0;n<C.length;n++){let r=t?t+1:O,i=C[n],a=e.slice(r,i);b.tokens&&(n===0&&O!==0?(w[n].isPrefix=!0,w[n].value=J):w[n].value=a,y(w[n]),X.maxDepth+=w[n].depth),(n!==0||a!==``)&&T.push(a),t=i}if(t&&t+1<e.length){let n=e.slice(t+1);T.push(n),b.tokens&&(w[w.length-1].value=n,y(w[w.length-1]),X.maxDepth+=w[w.length-1].depth)}X.slashes=C,X.parts=T}return X}})),T=s(((e,t)=>{let n=S(),r=C(),{MAX_LENGTH:i,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:c}=n,l=(e,t)=>{if(typeof t.expandRange==`function`)return t.expandRange(...e,t);e.sort();let n=`[${e.join(`-`)}]`;try{new RegExp(n)}catch{return e.map(e=>r.escapeRegex(e)).join(`..`)}return n},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,d=e=>{let t=[],n=0,r=0,i=0,a=``,o=!1;for(let s of e){if(o===!0){a+=s,o=!1;continue}if(s===`\\`){a+=s,o=!0;continue}if(s===`"`){i=i===1?0:1,a+=s;continue}if(i===0){if(s===`[`)n++;else if(s===`]`&&n>0)n--;else if(n===0){if(s===`(`)r++;else if(s===`)`&&r>0)r--;else if(s===`|`&&r===0){t.push(a),a=``;continue}}}a+=s}return t.push(a),t},f=e=>{let t=!1;for(let n of e){if(t===!0){t=!1;continue}if(n===`\\`){t=!0;continue}if(/[?*+@!()[\]{}]/.test(n))return!1}return!0},p=e=>{let t=e.trim(),n=!0;for(;n===!0;)n=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),n=!0);if(f(t))return t.replace(/\\(.)/g,`$1`)},m=e=>{let t=e.map(p).filter(Boolean);for(let e=0;e<t.length;e++)for(let n=e+1;n<t.length;n++){let r=t[e],i=t[n],a=r[0];if(!(!a||r!==a.repeat(r.length)||i!==a.repeat(i.length))&&(r===i||r.startsWith(i)||i.startsWith(r)))return!0}return!1},h=(e,t=!0)=>{if(e[0]!==`+`&&e[0]!==`*`||e[1]!==`(`)return;let n=0,r=0,i=0,a=!1;for(let o=1;o<e.length;o++){let s=e[o];if(a===!0){a=!1;continue}if(s===`\\`){a=!0;continue}if(s===`"`){i=i===1?0:1;continue}if(i!==1){if(s===`[`){n++;continue}if(s===`]`&&n>0){n--;continue}if(!(n>0)){if(s===`(`){r++;continue}if(s===`)`&&(r--,r===0))return t===!0&&o!==e.length-1?void 0:{type:e[0],body:e.slice(2,o),end:o}}}}},g=e=>{let t=0,n=[];for(;t<e.length;){let r=h(e.slice(t),!1);if(!r||r.type!==`*`)return;let i=d(r.body).map(e=>e.trim());if(i.length!==1)return;let a=p(i[0]);if(!a||a.length!==1)return;n.push(a),t+=r.end+1}if(!(n.length<1))return`${n.length===1?r.escapeRegex(n[0]):`[${n.map(e=>r.escapeRegex(e)).join(``)}]`}*`},_=e=>{let t=0,n=e.trim(),r=h(n);for(;r;)t++,n=r.body.trim(),r=h(n);return t},v=(e,t)=>{if(t.maxExtglobRecursion===!1)return{risky:!1};let r=typeof t.maxExtglobRecursion==`number`?t.maxExtglobRecursion:n.DEFAULT_MAX_EXTGLOB_RECURSION,i=d(e).map(e=>e.trim());if(i.length>1&&(i.some(e=>e===``)||i.some(e=>/^[*?]+$/.test(e))||m(i)))return{risky:!0};for(let e of i){let t=g(e);if(t)return{risky:!0,safeOutput:t};if(_(e)>r)return{risky:!0}}return{risky:!1}},y=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);e=c[e]||e;let d={...t},f=typeof d.maxLength==`number`?Math.min(i,d.maxLength):i,p=e.length;if(p>f)throw SyntaxError(`Input length: ${p}, exceeds maximum allowed length: ${f}`);let m={type:`bos`,value:``,output:d.prepend||``},h=[m],g=d.capture?``:`?:`,_=n.globChars(d.windows),b=n.extglobChars(_),{DOT_LITERAL:x,PLUS_LITERAL:S,SLASH_LITERAL:C,ONE_CHAR:w,DOTS_SLASH:T,NO_DOT:E,NO_DOT_SLASH:D,NO_DOTS_SLASH:O,QMARK:k,QMARK_NO_DOT:A,STAR:j,START_ANCHOR:M}=_,N=e=>`(${g}(?:(?!${M}${e.dot?T:x}).)*?)`,P=d.dot?``:E,F=d.dot?k:A,I=d.bash===!0?N(d):j;d.capture&&(I=`(${I})`),typeof d.noext==`boolean`&&(d.noextglob=d.noext);let L={input:e,index:-1,start:0,dot:d.dot===!0,consumed:``,output:``,prefix:``,backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:h};e=r.removePrefix(e,L),p=e.length;let R=[],z=[],B=[],V=m,H,U=()=>L.index===p-1,W=L.peek=(t=1)=>e[L.index+t],G=L.advance=()=>e[++L.index]||``,K=()=>e.slice(L.index+1),q=(e=``,t=0)=>{L.consumed+=e,L.index+=t},J=e=>{L.output+=e.output==null?e.value:e.output,q(e.value)},Y=()=>{let e=1;for(;W()===`!`&&(W(2)!==`(`||W(3)===`?`);)G(),L.start++,e++;return e%2==0?!1:(L.negated=!0,L.start++,!0)},X=e=>{L[e]++,B.push(e)},Z=e=>{L[e]--,B.pop()},Q=e=>{if(V.type===`globstar`){let t=L.braces>0&&(e.type===`comma`||e.type===`brace`),n=e.extglob===!0||R.length&&(e.type===`pipe`||e.type===`paren`);e.type!==`slash`&&e.type!==`paren`&&!t&&!n&&(L.output=L.output.slice(0,-V.output.length),V.type=`star`,V.value=`*`,V.output=I,L.output+=V.output)}if(R.length&&e.type!==`paren`&&(R[R.length-1].inner+=e.value),(e.value||e.output)&&J(e),V&&V.type===`text`&&e.type===`text`){V.output=(V.output||V.value)+e.value,V.value+=e.value;return}e.prev=V,h.push(e),V=e},ee=(e,t)=>{let n={...b[t],conditions:1,inner:``};n.prev=V,n.parens=L.parens,n.output=L.output,n.startIndex=L.index,n.tokensIndex=h.length;let r=(d.capture?`(`:``)+n.open;X(`parens`),Q({type:e,value:t,output:L.output?``:w}),Q({type:`paren`,extglob:!0,value:G(),output:r}),R.push(n)},te=n=>{let i=e.slice(n.startIndex,L.index+1),a=v(e.slice(n.startIndex+2,L.index),d);if((n.type===`plus`||n.type===`star`)&&a.risky){let e=a.safeOutput?(n.output?``:w)+(d.capture?`(${a.safeOutput})`:a.safeOutput):void 0,t=h[n.tokensIndex];t.type=`text`,t.value=i,t.output=e||r.escapeRegex(i);for(let e=n.tokensIndex+1;e<h.length;e++)h[e].value=``,h[e].output=``,delete h[e].suffix;L.output=n.output+t.output,L.backtrack=!0,Q({type:`paren`,extglob:!0,value:H,output:``}),Z(`parens`);return}let o=n.close+(d.capture?`)`:``),s;if(n.type===`negate`){let e=I;n.inner&&n.inner.length>1&&n.inner.includes(`/`)&&(e=N(d)),(e!==I||U()||/^\)+$/.test(K()))&&(o=n.close=`)$))${e}`),n.inner.includes(`*`)&&(s=K())&&/^\.[^\\/.]+$/.test(s)&&(o=n.close=`)${y(s,{...t,fastpaths:!1}).output})${e})`),n.prev.type===`bos`&&(L.negatedExtglob=!0)}Q({type:`paren`,extglob:!0,value:H,output:o}),Z(`parens`)};if(d.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let n=!1,i=e.replace(s,(e,t,r,i,a,o)=>i===`\\`?(n=!0,e):i===`?`?t?t+i+(a?k.repeat(a.length):``):o===0?F+(a?k.repeat(a.length):``):k.repeat(r.length):i===`.`?x.repeat(r.length):i===`*`?t?t+i+(a?I:``):I:t?e:`\\${e}`);return n===!0&&(i=d.unescape===!0?i.replace(/\\/g,``):i.replace(/\\+/g,e=>e.length%2==0?`\\\\`:e?`\\`:``)),i===e&&d.contains===!0?(L.output=e,L):(L.output=r.wrapOutput(i,L,t),L)}for(;!U();){if(H=G(),H===`\0`)continue;if(H===`\\`){let e=W();if(e===`/`&&d.bash!==!0||e===`.`||e===`;`)continue;if(!e){H+=`\\`,Q({type:`text`,value:H});continue}let t=/^\\+/.exec(K()),n=0;if(t&&t[0].length>2&&(n=t[0].length,L.index+=n,n%2!=0&&(H+=`\\`)),d.unescape===!0?H=G():H+=G(),L.brackets===0){Q({type:`text`,value:H});continue}}if(L.brackets>0&&(H!==`]`||V.value===`[`||V.value===`[^`)){if(d.posix!==!1&&H===`:`){let e=V.value.slice(1);if(e.includes(`[`)&&(V.posix=!0,e.includes(`:`))){let e=V.value.lastIndexOf(`[`),t=V.value.slice(0,e),n=a[V.value.slice(e+2)];if(n){V.value=t+n,L.backtrack=!0,G(),!m.output&&h.indexOf(V)===1&&(m.output=w);continue}}}(H===`[`&&W()!==`:`||H===`-`&&W()===`]`)&&(H=`\\${H}`),H===`]`&&(V.value===`[`||V.value===`[^`)&&(H=`\\${H}`),d.posix===!0&&H===`!`&&V.value===`[`&&(H=`^`),V.value+=H,J({value:H});continue}if(L.quotes===1&&H!==`"`){H=r.escapeRegex(H),V.value+=H,J({value:H});continue}if(H===`"`){L.quotes=L.quotes===1?0:1,d.keepQuotes===!0&&Q({type:`text`,value:H});continue}if(H===`(`){X(`parens`),Q({type:`paren`,value:H});continue}if(H===`)`){if(L.parens===0&&d.strictBrackets===!0)throw SyntaxError(u(`opening`,`(`));let e=R[R.length-1];if(e&&L.parens===e.parens+1){te(R.pop());continue}Q({type:`paren`,value:H,output:L.parens?`)`:`\\)`}),Z(`parens`);continue}if(H===`[`){if(d.nobracket===!0||!K().includes(`]`)){if(d.nobracket!==!0&&d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));H=`\\${H}`}else X(`brackets`);Q({type:`bracket`,value:H});continue}if(H===`]`){if(d.nobracket===!0||V&&V.type===`bracket`&&V.value.length===1){Q({type:`text`,value:H,output:`\\${H}`});continue}if(L.brackets===0){if(d.strictBrackets===!0)throw SyntaxError(u(`opening`,`[`));Q({type:`text`,value:H,output:`\\${H}`});continue}Z(`brackets`);let e=V.value.slice(1);if(V.posix!==!0&&e[0]===`^`&&!e.includes(`/`)&&(H=`/${H}`),V.value+=H,J({value:H}),d.literalBrackets===!1||r.hasRegexChars(e))continue;let t=r.escapeRegex(V.value);if(L.output=L.output.slice(0,-V.value.length),d.literalBrackets===!0){L.output+=t,V.value=t;continue}V.value=`(${g}${t}|${V.value})`,L.output+=V.value;continue}if(H===`{`&&d.nobrace!==!0){X(`braces`);let e={type:`brace`,value:H,output:`(`,outputIndex:L.output.length,tokensIndex:L.tokens.length};z.push(e),Q(e);continue}if(H===`}`){let e=z[z.length-1];if(d.nobrace===!0||!e){Q({type:`text`,value:H,output:H});continue}let t=`)`;if(e.dots===!0){let e=h.slice(),n=[];for(let t=e.length-1;t>=0&&(h.pop(),e[t].type!==`brace`);t--)e[t].type!==`dots`&&n.unshift(e[t].value);t=l(n,d),L.backtrack=!0}if(e.comma!==!0&&e.dots!==!0){let n=L.output.slice(0,e.outputIndex),r=L.tokens.slice(e.tokensIndex);e.value=e.output=`\\{`,H=t=`\\}`,L.output=n;for(let e of r)L.output+=e.output||e.value}Q({type:`brace`,value:H,output:t}),Z(`braces`),z.pop();continue}if(H===`|`){R.length>0&&R[R.length-1].conditions++,Q({type:`text`,value:H});continue}if(H===`,`){let e=H,t=z[z.length-1];t&&B[B.length-1]===`braces`&&(t.comma=!0,e=`|`),Q({type:`comma`,value:H,output:e});continue}if(H===`/`){if(V.type===`dot`&&L.index===L.start+1){L.start=L.index+1,L.consumed=``,L.output=``,h.pop(),V=m;continue}Q({type:`slash`,value:H,output:C});continue}if(H===`.`){if(L.braces>0&&V.type===`dot`){V.value===`.`&&(V.output=x);let e=z[z.length-1];V.type=`dots`,V.output+=H,V.value+=H,e.dots=!0;continue}if(L.braces+L.parens===0&&V.type!==`bos`&&V.type!==`slash`){Q({type:`text`,value:H,output:x});continue}Q({type:`dot`,value:H,output:x});continue}if(H===`?`){if(!(V&&V.value===`(`)&&d.noextglob!==!0&&W()===`(`&&W(2)!==`?`){ee(`qmark`,H);continue}if(V&&V.type===`paren`){let e=W(),t=H;(V.value===`(`&&!/[!=<:]/.test(e)||e===`<`&&!/<([!=]|\w+>)/.test(K()))&&(t=`\\${H}`),Q({type:`text`,value:H,output:t});continue}if(d.dot!==!0&&(V.type===`slash`||V.type===`bos`)){Q({type:`qmark`,value:H,output:A});continue}Q({type:`qmark`,value:H,output:k});continue}if(H===`!`){if(d.noextglob!==!0&&W()===`(`&&(W(2)!==`?`||!/[!=<:]/.test(W(3)))){ee(`negate`,H);continue}if(d.nonegate!==!0&&L.index===0){Y();continue}}if(H===`+`){if(d.noextglob!==!0&&W()===`(`&&W(2)!==`?`){ee(`plus`,H);continue}if(V&&V.value===`(`||d.regex===!1){Q({type:`plus`,value:H,output:S});continue}if(V&&(V.type===`bracket`||V.type===`paren`||V.type===`brace`)||L.parens>0){Q({type:`plus`,value:H});continue}Q({type:`plus`,value:S});continue}if(H===`@`){if(d.noextglob!==!0&&W()===`(`&&W(2)!==`?`){Q({type:`at`,extglob:!0,value:H,output:``});continue}Q({type:`text`,value:H});continue}if(H!==`*`){(H===`$`||H===`^`)&&(H=`\\${H}`);let e=o.exec(K());e&&(H+=e[0],L.index+=e[0].length),Q({type:`text`,value:H});continue}if(V&&(V.type===`globstar`||V.star===!0)){V.type=`star`,V.star=!0,V.value+=H,V.output=I,L.backtrack=!0,L.globstar=!0,q(H);continue}let t=K();if(d.noextglob!==!0&&/^\([^?]/.test(t)){ee(`star`,H);continue}if(V.type===`star`){if(d.noglobstar===!0){q(H);continue}let n=V.prev,r=n.prev,i=n.type===`slash`||n.type===`bos`,a=r&&(r.type===`star`||r.type===`globstar`);if(d.bash===!0&&(!i||t[0]&&t[0]!==`/`)){Q({type:`star`,value:H,output:``});continue}let o=L.braces>0&&(n.type===`comma`||n.type===`brace`),s=R.length&&(n.type===`pipe`||n.type===`paren`);if(!i&&n.type!==`paren`&&!o&&!s){Q({type:`star`,value:H,output:``});continue}for(;t.slice(0,3)===`/**`;){let n=e[L.index+4];if(n&&n!==`/`)break;t=t.slice(3),q(`/**`,3)}if(n.type===`bos`&&U()){V.type=`globstar`,V.value+=H,V.output=N(d),L.output=V.output,L.globstar=!0,q(H);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&!a&&U()){L.output=L.output.slice(0,-(n.output+V.output).length),n.output=`(?:${n.output}`,V.type=`globstar`,V.output=N(d)+(d.strictSlashes?`)`:`|$)`),V.value+=H,L.globstar=!0,L.output+=n.output+V.output,q(H);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&t[0]===`/`){let e=t[1]===void 0?``:`|$`;L.output=L.output.slice(0,-(n.output+V.output).length),n.output=`(?:${n.output}`,V.type=`globstar`,V.output=`${N(d)}${C}|${C}${e})`,V.value+=H,L.output+=n.output+V.output,L.globstar=!0,q(H+G()),Q({type:`slash`,value:`/`,output:``});continue}if(n.type===`bos`&&t[0]===`/`){V.type=`globstar`,V.value+=H,V.output=`(?:^|${C}|${N(d)}${C})`,L.output=V.output,L.globstar=!0,q(H+G()),Q({type:`slash`,value:`/`,output:``});continue}L.output=L.output.slice(0,-V.output.length),V.type=`globstar`,V.output=N(d),V.value+=H,L.output+=V.output,L.globstar=!0,q(H);continue}let n={type:`star`,value:H,output:I};if(d.bash===!0){n.output=`.*?`,(V.type===`bos`||V.type===`slash`)&&(n.output=P+n.output),Q(n);continue}if(V&&(V.type===`bracket`||V.type===`paren`)&&d.regex===!0){n.output=H,Q(n);continue}(L.index===L.start||V.type===`slash`||V.type===`dot`)&&(V.type===`dot`?(L.output+=D,V.output+=D):d.dot===!0?(L.output+=O,V.output+=O):(L.output+=P,V.output+=P),W()!==`*`&&(L.output+=w,V.output+=w)),Q(n)}for(;L.brackets>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));L.output=r.escapeLast(L.output,`[`),Z(`brackets`)}for(;L.parens>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`)`));L.output=r.escapeLast(L.output,`(`),Z(`parens`)}for(;L.braces>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`}`));L.output=r.escapeLast(L.output,`{`),Z(`braces`)}if(d.strictSlashes!==!0&&(V.type===`star`||V.type===`bracket`)&&Q({type:`maybe_slash`,value:``,output:`${C}?`}),L.backtrack===!0){L.output=``;for(let e of L.tokens)L.output+=e.output==null?e.value:e.output,e.suffix&&(L.output+=e.suffix)}return L};y.fastpaths=(e,t)=>{let a={...t},o=typeof a.maxLength==`number`?Math.min(i,a.maxLength):i,s=e.length;if(s>o)throw SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${o}`);e=c[e]||e;let{DOT_LITERAL:l,SLASH_LITERAL:u,ONE_CHAR:d,DOTS_SLASH:f,NO_DOT:p,NO_DOTS:m,NO_DOTS_SLASH:h,STAR:g,START_ANCHOR:_}=n.globChars(a.windows),v=a.dot?m:p,y=a.dot?h:p,b=a.capture?``:`?:`,x={negated:!1,prefix:``},S=a.bash===!0?`.*?`:g;a.capture&&(S=`(${S})`);let C=e=>e.noglobstar===!0?S:`(${b}(?:(?!${_}${e.dot?f:l}).)*?)`,w=e=>{switch(e){case`*`:return`${v}${d}${S}`;case`.*`:return`${l}${d}${S}`;case`*.*`:return`${v}${S}${l}${d}${S}`;case`*/*`:return`${v}${S}${u}${d}${y}${S}`;case`**`:return v+C(a);case`**/*`:return`(?:${v}${C(a)}${u})?${y}${d}${S}`;case`**/*.*`:return`(?:${v}${C(a)}${u})?${y}${S}${l}${d}${S}`;case`**/.*`:return`(?:${v}${C(a)}${u})?${l}${d}${S}`;default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=w(t[1]);return n?n+l+t[2]:void 0}}},T=w(r.removePrefix(e,x));return T&&a.strictSlashes!==!0&&(T+=`${u}?`),T},t.exports=y})),E=s(((e,t)=>{let n=w(),r=T(),i=C(),a=S(),o=e=>e&&typeof e==`object`&&!Array.isArray(e),s=(e,t,n=!1)=>{if(Array.isArray(e)){let r=e.map(e=>s(e,t,n));return e=>{for(let t of r){let n=t(e);if(n)return n}return!1}}let r=o(e)&&e.tokens&&e.input;if(e===``||typeof e!=`string`&&!r)throw TypeError(`Expected pattern to be a non-empty string`);let i=t||{},a=i.windows,c=r?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=c.state;delete c.state;let u=()=>!1;if(i.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};u=s(i.ignore,e,n)}let d=(n,r=!1)=>{let{isMatch:o,match:d,output:f}=s.test(n,c,t,{glob:e,posix:a}),p={glob:e,state:l,regex:c,posix:a,input:n,output:f,match:d,isMatch:o};return typeof i.onResult==`function`&&i.onResult(p),o===!1?(p.isMatch=!1,r?p:!1):u(n)?(typeof i.onIgnore==`function`&&i.onIgnore(p),p.isMatch=!1,r?p:!1):(typeof i.onMatch==`function`&&i.onMatch(p),r?p:!0)};return n&&(d.state=l),d};s.test=(e,t,n,{glob:r,posix:a}={})=>{if(typeof e!=`string`)throw TypeError(`Expected input to be a string`);if(e===``)return{isMatch:!1,output:``};let o=n||{},c=o.format||(a?i.toPosixSlashes:null),l=e===r,u=l&&c?c(e):e;return l===!1&&(u=c?c(e):e,l=u===r),(l===!1||o.capture===!0)&&(l=o.matchBase===!0||o.basename===!0?s.matchBase(e,t,n,a):t.exec(u)),{isMatch:!!l,match:l,output:u}},s.matchBase=(e,t,n)=>(t instanceof RegExp?t:s.makeRe(t,n)).test(i.basename(e)),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map(e=>s.parse(e,t)):r(e,{...t,fastpaths:!1}),s.scan=(e,t)=>n(e,t),s.compileRe=(e,t,n=!1,r=!1)=>{if(n===!0)return e.output;let i=t||{},a=i.contains?``:`^`,o=i.contains?``:`$`,c=`${a}(?:${e.output})${o}`;e&&e.negated===!0&&(c=`^(?!${c}).*$`);let l=s.toRegex(c,t);return r===!0&&(l.state=e),l},s.makeRe=(e,t={},n=!1,i=!1)=>{if(!e||typeof e!=`string`)throw TypeError(`Expected a non-empty string`);let a={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]===`.`||e[0]===`*`)&&(a.output=r.fastpaths(e,t)),a.output||(a=r(e,t)),s.compileRe(a,t,n,i)},s.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?`i`:``))}catch(e){if(t&&t.debug===!0)throw e;return/$^/}},s.constants=a,t.exports=s})),D=s(((e,t)=>{let n=E(),r=C();function i(e,t,i=!1){return t&&(t.windows===null||t.windows===void 0)&&(t={...t,windows:r.isWindows()}),n(e,t,i)}Object.assign(i,n),t.exports=i})),O=s((e=>{var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},l=(e,r,i)=>(i=e==null?{}:t(a(e)),s(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e));let u=l(c(`path`)),d=l(c(`fs`));function f(e){let t=(0,u.normalize)(e);return t.length>1&&t[t.length-1]===u.sep&&(t=t.substring(0,t.length-1)),t}let p=/[\\/]/g;function m(e,t){return e.replace(p,t)}let h=/^[a-z]:[\\/]$/i;function g(e){return e===`/`||h.test(e)}function _(e,t){let{resolvePaths:n,normalizePath:r,pathSeparator:i}=t,a=process.platform===`win32`&&e.includes(`/`)||e.startsWith(`.`);return n&&(e=(0,u.resolve)(e)),(r||a)&&(e=f(e)),e===`.`?``:m(e[e.length-1]===i?e:e+i,i)}function v(e,t){return t+e}function y(e,t){return function(n,r){return r.startsWith(e)?r.slice(e.length)+n:m((0,u.relative)(e,r),t.pathSeparator)+t.pathSeparator+n}}function b(e){return e}function x(e,t,n){return t+e+n}function S(e,t){let{relativePaths:n,includeBasePath:r}=t;return n&&e?y(e,t):r?v:b}function C(e){return function(t,n){n.push(t.substring(e.length)||`.`)}}function w(e){return function(t,n,r){let i=t.substring(e.length)||`.`;r.every(e=>e(i,!0))&&n.push(i)}}let T=(e,t)=>{t.push(e||`.`)},E=(e,t,n)=>{let r=e||`.`;n.every(e=>e(r,!0))&&t.push(r)},O=()=>{};function k(e,t){let{includeDirs:n,filters:r,relativePaths:i}=t;return n?i?r&&r.length?w(e):C(e):r&&r.length?E:T:O}let A=(e,t,n,r)=>{r.every(t=>t(e,!1))&&n.files++},j=(e,t,n,r)=>{r.every(t=>t(e,!1))&&t.push(e)},M=(e,t,n,r)=>{n.files++},N=(e,t)=>{t.push(e)},P=()=>{};function F(e){let{excludeFiles:t,filters:n,onlyCounts:r}=e;return t?P:n&&n.length?r?A:j:r?M:N}let I=e=>e,L=()=>[``].slice(0,0);function R(e){return e.group?L:I}let z=(e,t,n)=>{e.push({directory:t,files:n,dir:t})},B=()=>{};function V(e){return e.group?z:B}let H=function(e,t,n){let{queue:r,fs:i,options:{suppressErrors:a}}=t;r.enqueue(),i.realpath(e,(o,s)=>{if(o)return r.dequeue(a?null:o,t);i.stat(s,(i,o)=>{if(i)return r.dequeue(a?null:i,t);if(o.isDirectory()&&G(e,s,t))return r.dequeue(null,t);n(o,s),r.dequeue(null,t)})})},U=function(e,t,n){let{queue:r,fs:i,options:{suppressErrors:a}}=t;r.enqueue();try{let r=i.realpathSync(e),a=i.statSync(r);if(a.isDirectory()&&G(e,r,t))return;n(a,r)}catch(e){if(!a)throw e}};function W(e,t){return!e.resolveSymlinks||e.excludeSymlinks?null:t?U:H}function G(e,t,n){if(n.options.useRealPaths)return K(t,n);let r=(0,u.dirname)(e),i=1;for(;r!==n.root&&i<2;){let e=n.symlinks.get(r);e&&(e===t||e.startsWith(t)||t.startsWith(e))?i++:r=(0,u.dirname)(r)}return n.symlinks.set(e,t),i>1}function K(e,t){return t.visited.includes(e+t.options.pathSeparator)}let q=e=>e.counts,J=e=>e.groups,Y=e=>e.paths,X=e=>e.paths.slice(0,e.options.maxFiles),Z=(e,t,n)=>(ne(t,n,e.counts,e.options.suppressErrors),null),Q=(e,t,n)=>(ne(t,n,e.paths,e.options.suppressErrors),null),ee=(e,t,n)=>(ne(t,n,e.paths.slice(0,e.options.maxFiles),e.options.suppressErrors),null),te=(e,t,n)=>(ne(t,n,e.groups,e.options.suppressErrors),null);function ne(e,t,n,r){t(e&&!r?e:null,n)}function re(e,t){let{onlyCounts:n,group:r,maxFiles:i}=e;return n?t?q:Z:r?t?J:te:i?t?X:ee:t?Y:Q}let ie={withFileTypes:!0},ae=(e,t,n,r,i)=>{if(e.queue.enqueue(),r<0)return e.queue.dequeue(null,e);let{fs:a}=e;e.visited.push(t),e.counts.directories++,a.readdir(t||`.`,ie,(t,a=[])=>{i(a,n,r),e.queue.dequeue(e.options.suppressErrors?null:t,e)})},oe=(e,t,n,r,i)=>{let{fs:a}=e;if(r<0)return;e.visited.push(t),e.counts.directories++;let o=[];try{o=a.readdirSync(t||`.`,ie)}catch(t){if(!e.options.suppressErrors)throw t}i(o,n,r)};function se(e){return e?oe:ae}var ce=class{count=0;constructor(e){this.onQueueEmpty=e}enqueue(){return this.count++,this.count}dequeue(e,t){this.onQueueEmpty&&(--this.count<=0||e)&&(this.onQueueEmpty(e,t),e&&(t.controller.abort(),this.onQueueEmpty=void 0))}},le=class{_files=0;_directories=0;set files(e){this._files=e}get files(){return this._files}set directories(e){this._directories=e}get directories(){return this._directories}get dirs(){return this._directories}},ue=class{aborted=!1;abort(){this.aborted=!0}},de=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(e,t,n){this.isSynchronous=!n,this.callbackInvoker=re(t,this.isSynchronous),this.root=_(e,t),this.state={root:g(this.root)?this.root:this.root.slice(0,-1),paths:[``].slice(0,0),groups:[],counts:new le,options:t,queue:new ce((e,t)=>this.callbackInvoker(t,e,n)),symlinks:new Map,visited:[``].slice(0,0),controller:new ue,fs:t.fs||d},this.joinPath=S(this.root,t),this.pushDirectory=k(this.root,t),this.pushFile=F(t),this.getArray=R(t),this.groupFiles=V(t),this.resolveSymlink=W(t,this.isSynchronous),this.walkDirectory=se(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(e,t,n)=>{let{paths:r,options:{filters:i,resolveSymlinks:a,excludeSymlinks:o,exclude:s,maxFiles:c,signal:l,useRealPaths:d,pathSeparator:f},controller:p}=this.state;if(p.aborted||l&&l.aborted||c&&r.length>c)return;let m=this.getArray(this.state.paths);for(let c=0;c<e.length;++c){let l=e[c];if(l.isFile()||l.isSymbolicLink()&&!a&&!o){let e=this.joinPath(l.name,t);this.pushFile(e,m,this.state.counts,i)}else if(l.isDirectory()){let e=x(l.name,t,this.state.options.pathSeparator);if(s&&s(l.name,e))continue;this.pushDirectory(e,r,i),this.walkDirectory(this.state,e,e,n-1,this.walk)}else if(this.resolveSymlink&&l.isSymbolicLink()){let e=v(l.name,t);this.resolveSymlink(e,this.state,(t,r)=>{if(t.isDirectory()){if(r=_(r,this.state.options),s&&s(l.name,d?r:e+f))return;this.walkDirectory(this.state,r,d?r:e+f,n-1,this.walk)}else{r=d?r:e;let t=(0,u.basename)(r),n=_((0,u.dirname)(r),this.state.options);r=this.joinPath(t,n),this.pushFile(r,m,this.state.counts,i)}})}}this.groupFiles(this.state.groups,t,m)}};function fe(e,t){return new Promise((n,r)=>{pe(e,t,(e,t)=>{if(e)return r(e);n(t)})})}function pe(e,t,n){new de(e,t,n).start()}function me(e,t){return new de(e,t).start()}var he=class{constructor(e,t){this.root=e,this.options=t}withPromise(){return fe(this.root,this.options)}withCallback(e){pe(this.root,this.options,e)}sync(){return me(this.root,this.options)}};let ge=null;try{c.resolve(`picomatch`),ge=D()}catch{}e.fdir=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:u.sep,filters:[]};globFunction;constructor(e){this.options={...this.options,...e},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(e){return this.options.pathSeparator=e,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(e){return this.options.maxDepth=e,this}withMaxFiles(e){return this.options.maxFiles=e,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:e=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=e,this.withFullPaths()}withAbortSignal(e){return this.options.signal=e,this}normalize(){return this.options.normalizePath=!0,this}filter(e){return this.options.filters.push(e),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(e){return this.options.exclude=e,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(e){return new he(e||`.`,this.options)}withGlobFunction(e){return this.globFunction=e,this}crawlWithOptions(e,t){return this.options={...this.options,...t},new he(e||`.`,this.options)}glob(...e){return this.globFunction?this.globWithOptions(e):this.globWithOptions(e,{dot:!0})}globWithOptions(e,...t){let n=this.globFunction||ge;if(!n)throw Error(`Please specify a glob function to use glob matching.`);var r=this.globCache[e.join(`\0`)];return r||(r=n(e,...t),this.globCache[e.join(`\0`)]=r),this.options.filters.push(e=>r(e)),this}}})),k=s(((e,t)=>{let{fdir:n}=O(),r=c(`path`),i=D();t.exports=class{constructor(e=`./`,t=[`.env*`],n=[]){this.ignore=[`node_modules/**`,`.git/**`],this.cwd=r.resolve(e),this.envFile=t,this.excludeEnvFile=n}run(){return this._filepaths()}_filepaths(){let e=i(this._exclude()),t=i(this._patterns(),{ignore:this._exclude()});return new n().withRelativePaths().exclude((t,n)=>e(n)).filter(e=>t(e)).crawl(this.cwd).sync()}_patterns(){return Array.isArray(this.envFile)?this.envFile.map(e=>`**/${e}`):[`**/${this.envFile}`]}_excludePatterns(){return Array.isArray(this.excludeEnvFile)?this.excludeEnvFile.map(e=>`**/${e}`):[`**/${this.excludeEnvFile}`]}_exclude(){return this._excludePatterns().length>0?this.ignore.concat(this._excludePatterns()):this.ignore}}})),A=s(((e,t)=>{let n=c(`fs`),r=`utf8`;async function i(e,t=null){return t||=r,n.promises.readFile(e,t)}function a(e,t=null){return t||=r,n.readFileSync(e,t)}function o(e,t){return n.writeFileSync(e,t,r)}async function s(e,t){return n.promises.writeFile(e,t,r)}async function l(e){try{return await n.promises.access(e),!0}catch{return!1}}t.exports={chmodSync:n.chmodSync,exists:l,existsSync:n.existsSync,readdirSync:n.readdirSync,readFileSync:n.readFileSync,writeFileSync:n.writeFileSync,appendFileSync:n.appendFileSync,readFileX:i,readFileXSync:a,writeFileX:s,writeFileXSync:o}})),j=s(((e,t)=>{let{fdir:n}=O(),r=c(`path`),i=D(),a=A(),o=[{lang:`Python`,file:/\.py$/,match:/load_dotenv\s*\([^)]*\)/,msg:`found python-dotenv load call`},{lang:`Python`,file:/\.py$/,match:/dotenv_values\s*\([^)]*\)/,msg:`found python-dotenv values call`},{lang:`Node`,file:/\.(js|cjs|mjs|ts)$/,match:/require\(['"]dotenv['"]\)\.config\s*\([^)]*\)/,msg:`found dotenv config require call`},{lang:`Node`,file:/\.(js|cjs|mjs|ts)$/,match:/import\s+['"]dotenv\/config['"]/,msg:`found dotenv/config import`},{lang:`Node`,file:/\.(js|cjs|mjs|ts)$/,match:/dotenv\.config\s*\([^)]*\)/,msg:`found dotenv config call`},{lang:`Ruby`,file:/\.rb$/,match:/Dotenv\.(load|overload)\s*\([^)]*\)/,msg:`found ruby dotenv load call`},{lang:`Go`,file:/\.go$/,match:/godotenv\.(Load|Overload)\s*\([^)]*\)/,msg:`found godotenv load call`},{lang:`PHP`,file:/\.php$/,match:/Dotenv\\Dotenv::create\w*\s*\([^)]*\)/,msg:`found vlucas/phpdotenv loader`},{lang:`Rust`,file:/\.rs$/,match:/dotenvy?::dotenv\s*\([^)]*\)/,msg:`found Rust dotenv load call`},{lang:`Java`,file:/\.java$/,match:/Dotenv\.(load|configure)\s*\([^)]*\)/,msg:`found java-dotenv load call`},{lang:`Kotlin`,file:/\.kt$/,match:/Dotenv\.(load|configure)\s*\([^)]*\)/,msg:`found java-dotenv load call`},{lang:`.NET`,file:/\.(cs|fs|vb)$/,match:/(?:DotNetEnv\.)?Env\.Load\s*\([^)]*\)/,msg:`found DotNetEnv load call`}];var s=class{constructor(e=`./`){this.cwd=r.resolve(e),this.ignore=[`**/node_modules/**`,`**/.git/**`,`**/vendor/**`,`**/dist/**`,`**/build/**`,`**/coverage/**`,`**/.next/**`],this.exclude=i(this.ignore)}run(){let e=[];for(let t of this._filepaths())e.push(...this._scanFile(t));return e}_filepaths(){return new n().withRelativePaths().exclude((e,t)=>this._ignored(t)).filter(e=>this._patternsFor(e).length>0).crawl(this.cwd).sync().sort()}_scanFile(e){let t=a.readFileXSync(r.join(this.cwd,e)).split(/\r?\n/),n=[];return t.forEach((t,r)=>{for(let i of this._patternsFor(e))if(i.match.test(t)){let a=t.match(i.match);n.push({lang:i.lang,filepath:e,line:r+1,code:a[0].trim(),msg:i.msg})}}),n}_patternsFor(e){return o.filter(t=>t.file.test(e))}_ignored(e){return this.exclude(e)}};s.patterns=o,t.exports=s})),M=s((e=>{
3
+ /*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
4
+ Object.defineProperty(e,`__esModule`,{value:!0}),e.wrapCipher=e.Hash=e.nextTick=e.isLE=void 0,e.isBytes=t,e.abool=n,e.anumber=r,e.abytes=i,e.ahash=a,e.aexists=o,e.aoutput=s,e.u8=c,e.u32=l,e.clean=u,e.createView=d,e.bytesToHex=m,e.hexToBytes=_,e.hexToNumber=v,e.bytesToNumberBE=y,e.numberToBytesBE=b,e.utf8ToBytes=x,e.bytesToUtf8=S,e.toBytes=C,e.overlapBytes=w,e.complexOverlapBytes=T,e.concatBytes=E,e.checkOpts=D,e.equalBytes=O,e.getOutput=k,e.setBigUint64=A,e.u64Lengths=j,e.isAligned32=M,e.copyBytes=N;function t(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function n(e){if(typeof e!=`boolean`)throw Error(`boolean expected, not ${e}`)}function r(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got `+e)}function i(e,...n){if(!t(e))throw Error(`Uint8Array expected`);if(n.length>0&&!n.includes(e.length))throw Error(`Uint8Array expected of length `+n+`, got length=`+e.length)}function a(e){if(typeof e!=`function`||typeof e.create!=`function`)throw Error(`Hash should be wrapped by utils.createHasher`);r(e.outputLen),r(e.blockLen)}function o(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function s(e,t){i(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function c(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function l(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function u(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function d(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;let f=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,p=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function m(e){if(i(e),f)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=p[e[n]];return t}let h={_0:48,_9:57,A:65,F:70,a:97,f:102};function g(e){if(e>=h._0&&e<=h._9)return e-h._0;if(e>=h.A&&e<=h.F)return e-(h.A-10);if(e>=h.a&&e<=h.f)return e-(h.a-10)}function _(e){if(typeof e!=`string`)throw Error(`hex string expected, got `+typeof e);if(f)return Uint8Array.fromHex(e);let t=e.length,n=t/2;if(t%2)throw Error(`hex string expected, got unpadded hex of length `+t);let r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){let n=g(e.charCodeAt(i)),a=g(e.charCodeAt(i+1));if(n===void 0||a===void 0){let t=e[i]+e[i+1];throw Error(`hex string expected, got non-hex character "`+t+`" at index `+i)}r[t]=n*16+a}return r}function v(e){if(typeof e!=`string`)throw Error(`hex string expected, got `+typeof e);return BigInt(e===``?`0`:`0x`+e)}function y(e){return v(m(e))}function b(e,t){return _(e.toString(16).padStart(t*2,`0`))}e.nextTick=async()=>{};function x(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function S(e){return new TextDecoder().decode(e)}function C(e){if(typeof e==`string`)e=x(e);else if(t(e))e=N(e);else throw Error(`Uint8Array expected, got `+typeof e);return e}function w(e,t){return e.buffer===t.buffer&&e.byteOffset<t.byteOffset+t.byteLength&&t.byteOffset<e.byteOffset+e.byteLength}function T(e,t){if(w(e,t)&&e.byteOffset<t.byteOffset)throw Error(`complex overlap of input and output is not supported`)}function E(...e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];i(r),t+=r.length}let n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){let i=e[t];n.set(i,r),r+=i.length}return n}function D(e,t){if(typeof t!=`object`||!t)throw Error(`options must be defined`);return Object.assign(e,t)}function O(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}e.Hash=class{},e.wrapCipher=(t,n)=>{function r(r,...a){if(i(r),!e.isLE)throw Error(`Non little-endian hardware is not yet supported`);if(t.nonceLength!==void 0){let e=a[0];if(!e)throw Error(`nonce / iv required`);t.varSizeNonce?i(e):i(e,t.nonceLength)}let o=t.tagLength;o&&a[1]!==void 0&&i(a[1]);let s=n(r,...a),c=(e,t)=>{if(t!==void 0){if(e!==2)throw Error(`cipher output not supported`);i(t)}},l=!1;return{encrypt(e,t){if(l)throw Error(`cannot encrypt() twice with same key + nonce`);return l=!0,i(e),c(s.encrypt.length,t),s.encrypt(e,t)},decrypt(e,t){if(i(e),o&&e.length<o)throw Error(`invalid ciphertext length: smaller than tagLength=`+o);return c(s.decrypt.length,t),s.decrypt(e,t)}}}return Object.assign(r,t),r};function k(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(t.length!==e)throw Error(`invalid output length, expected `+e+`, got: `+t.length);if(n&&!M(t))throw Error(`invalid output, must be aligned`);return t}function A(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}function j(e,t,r){n(r);let i=new Uint8Array(16),a=d(i);return A(a,0,BigInt(t),r),A(a,8,BigInt(e),r),i}function M(e){return e.byteOffset%4==0}function N(e){return Uint8Array.from(e)}})),N=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AEAD_TAG_LENGTH=e.XCHACHA20_NONCE_LENGTH=e.CURVE25519_PUBLIC_KEY_SIZE=e.ETH_PUBLIC_KEY_SIZE=e.UNCOMPRESSED_PUBLIC_KEY_SIZE=e.COMPRESSED_PUBLIC_KEY_SIZE=e.SECRET_KEY_LENGTH=void 0,e.SECRET_KEY_LENGTH=32,e.COMPRESSED_PUBLIC_KEY_SIZE=33,e.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,e.ETH_PUBLIC_KEY_SIZE=64,e.CURVE25519_PUBLIC_KEY_SIZE=32,e.XCHACHA20_NONCE_LENGTH=24,e.AEAD_TAG_LENGTH=16})),P=s((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 t=N();e.ECIES_CONFIG=new(function(){function e(){this.ellipticCurve=`secp256k1`,this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm=`aes-256-gcm`,this.symmetricNonceLength=16}return e}()),e.ellipticCurve=function(){return e.ECIES_CONFIG.ellipticCurve},e.isEphemeralKeyCompressed=function(){return e.ECIES_CONFIG.isEphemeralKeyCompressed},e.isHkdfKeyCompressed=function(){return e.ECIES_CONFIG.isHkdfKeyCompressed},e.symmetricAlgorithm=function(){return e.ECIES_CONFIG.symmetricAlgorithm},e.symmetricNonceLength=function(){return e.ECIES_CONFIG.symmetricNonceLength},e.ephemeralKeySize=function(){var n={secp256k1:e.ECIES_CONFIG.isEphemeralKeyCompressed?t.COMPRESSED_PUBLIC_KEY_SIZE:t.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:t.CURVE25519_PUBLIC_KEY_SIZE,ed25519:t.CURVE25519_PUBLIC_KEY_SIZE};if(e.ECIES_CONFIG.ellipticCurve in n)return n[e.ECIES_CONFIG.ellipticCurve];throw Error(`Not implemented`)}})),F=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.crypto=void 0;let t=c(`node:crypto`);e.crypto=t&&typeof t==`object`&&`webcrypto`in t?t.webcrypto:t&&typeof t==`object`&&`randomBytes`in t?t:void 0})),I=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.gcm=e.ctr=e.cbc=e.utils=void 0,e.randomBytes=r,e.getWebcryptoSubtle=i,e.managedNonce=a;let t=F(),n=M();function r(e=32){if(t.crypto&&typeof t.crypto.getRandomValues==`function`)return t.crypto.getRandomValues(new Uint8Array(e));if(t.crypto&&typeof t.crypto.randomBytes==`function`)return Uint8Array.from(t.crypto.randomBytes(e));throw Error(`crypto.getRandomValues must be defined`)}function i(){if(t.crypto&&typeof t.crypto.subtle==`object`&&t.crypto.subtle!=null)return t.crypto.subtle;throw Error(`crypto.subtle must be defined`)}function a(e){let{nonceLength:t}=e;return(0,n.anumber)(t),((i,...a)=>({encrypt(o,...s){let c=r(t),l=e(i,c,...a).encrypt(o,...s),u=(0,n.concatBytes)(c,l);return l.fill(0),u},decrypt(n,...r){let o=n.subarray(0,t),s=n.subarray(t);return e(i,o,...a).decrypt(s,...r)}}))}e.utils={async encrypt(e,t,n,r){let a=i(),o=await a.importKey(`raw`,e,t,!0,[`encrypt`]),s=await a.encrypt(n,o,r);return new Uint8Array(s)},async decrypt(e,t,n,r){let a=i(),o=await a.importKey(`raw`,e,t,!0,[`decrypt`]),s=await a.decrypt(n,o,r);return new Uint8Array(s)}};let o={CBC:`AES-CBC`,CTR:`AES-CTR`,GCM:`AES-GCM`};function s(e,t,n){if(e===o.CBC)return{name:o.CBC,iv:t};if(e===o.CTR)return{name:o.CTR,counter:t,length:64};if(e===o.GCM)return n?{name:o.GCM,iv:t,additionalData:n}:{name:o.GCM,iv:t};throw Error(`unknown aes block mode`)}function c(t){return(r,i,a)=>{(0,n.abytes)(r),(0,n.abytes)(i);let o={name:t,length:r.length*8},c=s(t,i,a),l=!1;return{encrypt(t){if((0,n.abytes)(t),l)throw Error(`Cannot encrypt() twice with same key / nonce`);return l=!0,e.utils.encrypt(r,o,c,t)},decrypt(t){return(0,n.abytes)(t),e.utils.decrypt(r,o,c,t)}}}}e.cbc=c(o.CBC),e.ctr=c(o.CTR),e.gcm=c(o.GCM)})),L=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.crypto=void 0;let t=c(`node:crypto`);e.crypto=t&&typeof t==`object`&&`webcrypto`in t?t.webcrypto:t&&typeof t==`object`&&`randomBytes`in t?t:void 0})),R=s((e=>{
5
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
6
+ Object.defineProperty(e,`__esModule`,{value:!0}),e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.Hash=e.nextTick=e.swap32IfBE=e.byteSwapIfBE=e.swap8IfBE=e.isLE=void 0,e.isBytes=n,e.anumber=r,e.abytes=i,e.ahash=a,e.aexists=o,e.aoutput=s,e.u8=c,e.u32=l,e.clean=u,e.createView=d,e.rotr=f,e.rotl=p,e.byteSwap=m,e.byteSwap32=h,e.bytesToHex=v,e.hexToBytes=x,e.asyncLoop=S,e.utf8ToBytes=C,e.bytesToUtf8=w,e.toBytes=T,e.kdfInputToBytes=E,e.concatBytes=D,e.checkOpts=O,e.createHasher=k,e.createOptHasher=A,e.createXOFer=j,e.randomBytes=M;let t=L();function n(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function r(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got `+e)}function i(e,...t){if(!n(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function a(e){if(typeof e!=`function`||typeof e.create!=`function`)throw Error(`Hash should be wrapped by utils.createHasher`);r(e.outputLen),r(e.blockLen)}function o(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function s(e,t){i(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function c(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function l(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function u(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function d(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function f(e,t){return e<<32-t|e>>>t}function p(e,t){return e<<t|e>>>32-t>>>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.swap8IfBE=e.isLE?e=>e:e=>m(e),e.byteSwapIfBE=e.swap8IfBE;function h(e){for(let t=0;t<e.length;t++)e[t]=m(e[t]);return e}e.swap32IfBE=e.isLE?e=>e:h;let g=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,_=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function v(e){if(i(e),g)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=_[e[n]];return t}let y={_0:48,_9:57,A:65,F:70,a:97,f:102};function b(e){if(e>=y._0&&e<=y._9)return e-y._0;if(e>=y.A&&e<=y.F)return e-(y.A-10);if(e>=y.a&&e<=y.f)return e-(y.a-10)}function x(e){if(typeof e!=`string`)throw Error(`hex string expected, got `+typeof e);if(g)return Uint8Array.fromHex(e);let t=e.length,n=t/2;if(t%2)throw Error(`hex string expected, got unpadded hex of length `+t);let r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){let n=b(e.charCodeAt(i)),a=b(e.charCodeAt(i+1));if(n===void 0||a===void 0){let t=e[i]+e[i+1];throw Error(`hex string expected, got non-hex character "`+t+`" at index `+i)}r[t]=n*16+a}return r}e.nextTick=async()=>{};async function S(t,n,r){let i=Date.now();for(let a=0;a<t;a++){r(a);let t=Date.now()-i;t>=0&&t<n||(await(0,e.nextTick)(),i+=t)}}function C(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function w(e){return new TextDecoder().decode(e)}function T(e){return typeof e==`string`&&(e=C(e)),i(e),e}function E(e){return typeof e==`string`&&(e=C(e)),i(e),e}function D(...e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];i(r),t+=r.length}let n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){let i=e[t];n.set(i,r),r+=i.length}return n}function O(e,t){if(t!==void 0&&{}.toString.call(t)!==`[object Object]`)throw Error(`options should be object or undefined`);return Object.assign(e,t)}e.Hash=class{};function k(e){let t=t=>e().update(T(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function A(e){let t=(t,n)=>e(n).update(T(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}function j(e){let t=(t,n)=>e(n).update(T(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}e.wrapConstructor=k,e.wrapConstructorWithOpts=A,e.wrapXOFConstructorWithOpts=j;function M(e=32){if(t.crypto&&typeof t.crypto.getRandomValues==`function`)return t.crypto.getRandomValues(new Uint8Array(e));if(t.crypto&&typeof t.crypto.randomBytes==`function`)return Uint8Array.from(t.crypto.randomBytes(e));throw Error(`crypto.getRandomValues must be defined`)}})),z=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SHA512_IV=e.SHA384_IV=e.SHA224_IV=e.SHA256_IV=e.HashMD=void 0,e.setBigUint64=n,e.Chi=r,e.Maj=i;let t=R();function n(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}function r(e,t,n){return e&t^~e&n}function i(e,t,n){return e&t^e&n^t&n}e.HashMD=class extends t.Hash{constructor(e,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(e),this.view=(0,t.createView)(this.buffer)}update(e){(0,t.aexists)(this),e=(0,t.toBytes)(e),(0,t.abytes)(e);let{view:n,buffer:r,blockLen:i}=this,a=e.length;for(let o=0;o<a;){let s=Math.min(i-this.pos,a-o);if(s===i){let n=(0,t.createView)(e);for(;i<=a-o;o+=i)this.process(n,o);continue}r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,t.aexists)(this),(0,t.aoutput)(e,this),this.finished=!0;let{buffer:r,view:i,blockLen:a,isLE:o}=this,{pos:s}=this;r[s++]=128,(0,t.clean)(this.buffer.subarray(s)),this.padOffset>a-s&&(this.process(i,0),s=0);for(let e=s;e<a;e++)r[e]=0;n(i,a-8,BigInt(this.length*8),o),this.process(i,0);let c=(0,t.createView)(e),l=this.outputLen;if(l%4)throw Error(`_sha2: outputLen should be aligned to 32bit`);let u=l/4,d=this.get();if(u>d.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<u;e++)c.setUint32(4*e,d[e],o)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=r,e.pos=o,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}},e.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),e.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),e.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),e.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])})),B=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.toBig=e.shrSL=e.shrSH=e.rotrSL=e.rotrSH=e.rotrBL=e.rotrBH=e.rotr32L=e.rotr32H=e.rotlSL=e.rotlSH=e.rotlBL=e.rotlBH=e.add5L=e.add5H=e.add4L=e.add4H=e.add3L=e.add3H=void 0,e.add=v,e.fromBig=r,e.split=i;let t=BigInt(2**32-1),n=BigInt(32);function r(e,r=!1){return r?{h:Number(e&t),l:Number(e>>n&t)}:{h:Number(e>>n&t)|0,l:Number(e&t)|0}}function i(e,t=!1){let n=e.length,i=new Uint32Array(n),a=new Uint32Array(n);for(let o=0;o<n;o++){let{h:n,l:s}=r(e[o],t);[i[o],a[o]]=[n,s]}return[i,a]}let a=(e,t)=>BigInt(e>>>0)<<n|BigInt(t>>>0);e.toBig=a;let o=(e,t,n)=>e>>>n;e.shrSH=o;let s=(e,t,n)=>e<<32-n|t>>>n;e.shrSL=s;let c=(e,t,n)=>e>>>n|t<<32-n;e.rotrSH=c;let l=(e,t,n)=>e<<32-n|t>>>n;e.rotrSL=l;let u=(e,t,n)=>e<<64-n|t>>>n-32;e.rotrBH=u;let d=(e,t,n)=>e>>>n-32|t<<64-n;e.rotrBL=d;let f=(e,t)=>t;e.rotr32H=f;let p=(e,t)=>e;e.rotr32L=p;let m=(e,t,n)=>e<<n|t>>>32-n;e.rotlSH=m;let h=(e,t,n)=>t<<n|e>>>32-n;e.rotlSL=h;let g=(e,t,n)=>t<<n-32|e>>>64-n;e.rotlBH=g;let _=(e,t,n)=>e<<n-32|t>>>64-n;e.rotlBL=_;function v(e,t,n,r){let i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}let y=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0);e.add3L=y;let b=(e,t,n,r)=>t+n+r+(e/2**32|0)|0;e.add3H=b;let x=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0);e.add4L=x;let S=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0;e.add4H=S;let C=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0);e.add5L=C;let w=(e,t,n,r,i,a)=>t+n+r+i+a+(e/2**32|0)|0;e.add5H=w,e.default={fromBig:r,split:i,toBig:a,shrSH:o,shrSL:s,rotrSH:c,rotrSL:l,rotrBH:u,rotrBL:d,rotr32H:f,rotr32L:p,rotlSH:m,rotlSL:h,rotlBH:g,rotlBL:_,add:v,add3L:y,add3H:b,add4L:x,add4H:S,add5H:w,add5L:C}})),V=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.sha512_224=e.sha512_256=e.sha384=e.sha512=e.sha224=e.sha256=e.SHA512_256=e.SHA512_224=e.SHA384=e.SHA512=e.SHA224=e.SHA256=void 0;let t=z(),n=B(),r=R(),i=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),a=new Uint32Array(64);var o=class extends t.HashMD{constructor(e=32){super(64,e,8,!1),this.A=t.SHA256_IV[0]|0,this.B=t.SHA256_IV[1]|0,this.C=t.SHA256_IV[2]|0,this.D=t.SHA256_IV[3]|0,this.E=t.SHA256_IV[4]|0,this.F=t.SHA256_IV[5]|0,this.G=t.SHA256_IV[6]|0,this.H=t.SHA256_IV[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,n){for(let t=0;t<16;t++,n+=4)a[t]=e.getUint32(n,!1);for(let e=16;e<64;e++){let t=a[e-15],n=a[e-2],i=(0,r.rotr)(t,7)^(0,r.rotr)(t,18)^t>>>3;a[e]=((0,r.rotr)(n,17)^(0,r.rotr)(n,19)^n>>>10)+a[e-7]+i+a[e-16]|0}let{A:o,B:s,C:c,D:l,E:u,F:d,G:f,H:p}=this;for(let e=0;e<64;e++){let n=(0,r.rotr)(u,6)^(0,r.rotr)(u,11)^(0,r.rotr)(u,25),m=p+n+(0,t.Chi)(u,d,f)+i[e]+a[e]|0,h=((0,r.rotr)(o,2)^(0,r.rotr)(o,13)^(0,r.rotr)(o,22))+(0,t.Maj)(o,s,c)|0;p=f,f=d,d=u,u=l+m|0,l=c,c=s,s=o,o=m+h|0}o=o+this.A|0,s=s+this.B|0,c=c+this.C|0,l=l+this.D|0,u=u+this.E|0,d=d+this.F|0,f=f+this.G|0,p=p+this.H|0,this.set(o,s,c,l,u,d,f,p)}roundClean(){(0,r.clean)(a)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,r.clean)(this.buffer)}};e.SHA256=o;var s=class extends o{constructor(){super(28),this.A=t.SHA224_IV[0]|0,this.B=t.SHA224_IV[1]|0,this.C=t.SHA224_IV[2]|0,this.D=t.SHA224_IV[3]|0,this.E=t.SHA224_IV[4]|0,this.F=t.SHA224_IV[5]|0,this.G=t.SHA224_IV[6]|0,this.H=t.SHA224_IV[7]|0}};e.SHA224=s;let c=n.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`.split(`.`).map(e=>BigInt(e))),l=c[0],u=c[1],d=new Uint32Array(80),f=new Uint32Array(80);var p=class extends t.HashMD{constructor(e=64){super(128,e,16,!1),this.Ah=t.SHA512_IV[0]|0,this.Al=t.SHA512_IV[1]|0,this.Bh=t.SHA512_IV[2]|0,this.Bl=t.SHA512_IV[3]|0,this.Ch=t.SHA512_IV[4]|0,this.Cl=t.SHA512_IV[5]|0,this.Dh=t.SHA512_IV[6]|0,this.Dl=t.SHA512_IV[7]|0,this.Eh=t.SHA512_IV[8]|0,this.El=t.SHA512_IV[9]|0,this.Fh=t.SHA512_IV[10]|0,this.Fl=t.SHA512_IV[11]|0,this.Gh=t.SHA512_IV[12]|0,this.Gl=t.SHA512_IV[13]|0,this.Hh=t.SHA512_IV[14]|0,this.Hl=t.SHA512_IV[15]|0}get(){let{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:a,Dh:o,Dl:s,Eh:c,El:l,Fh:u,Fl:d,Gh:f,Gl:p,Hh:m,Hl:h}=this;return[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=r|0,this.Ch=i|0,this.Cl=a|0,this.Dh=o|0,this.Dl=s|0,this.Eh=c|0,this.El=l|0,this.Fh=u|0,this.Fl=d|0,this.Gh=f|0,this.Gl=p|0,this.Hh=m|0,this.Hl=h|0}process(e,t){for(let n=0;n<16;n++,t+=4)d[n]=e.getUint32(t),f[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=d[e-15]|0,r=f[e-15]|0,i=n.rotrSH(t,r,1)^n.rotrSH(t,r,8)^n.shrSH(t,r,7),a=n.rotrSL(t,r,1)^n.rotrSL(t,r,8)^n.shrSL(t,r,7),o=d[e-2]|0,s=f[e-2]|0,c=n.rotrSH(o,s,19)^n.rotrBH(o,s,61)^n.shrSH(o,s,6),l=n.rotrSL(o,s,19)^n.rotrBL(o,s,61)^n.shrSL(o,s,6),u=n.add4L(a,l,f[e-7],f[e-16]);d[e]=n.add4H(u,i,c,d[e-7],d[e-16])|0,f[e]=u|0}let{Ah:r,Al:i,Bh:a,Bl:o,Ch:s,Cl:c,Dh:p,Dl:m,Eh:h,El:g,Fh:_,Fl:v,Gh:y,Gl:b,Hh:x,Hl:S}=this;for(let e=0;e<80;e++){let t=n.rotrSH(h,g,14)^n.rotrSH(h,g,18)^n.rotrBH(h,g,41),C=n.rotrSL(h,g,14)^n.rotrSL(h,g,18)^n.rotrBL(h,g,41),w=h&_^~h&y,T=g&v^~g&b,E=n.add5L(S,C,T,u[e],f[e]),D=n.add5H(E,x,t,w,l[e],d[e]),O=E|0,k=n.rotrSH(r,i,28)^n.rotrBH(r,i,34)^n.rotrBH(r,i,39),A=n.rotrSL(r,i,28)^n.rotrBL(r,i,34)^n.rotrBL(r,i,39),j=r&a^r&s^a&s,M=i&o^i&c^o&c;x=y|0,S=b|0,y=_|0,b=v|0,_=h|0,v=g|0,{h,l:g}=n.add(p|0,m|0,D|0,O|0),p=s|0,m=c|0,s=a|0,c=o|0,a=r|0,o=i|0;let N=n.add3L(O,A,M);r=n.add3H(N,D,k,j),i=N|0}({h:r,l:i}=n.add(this.Ah|0,this.Al|0,r|0,i|0)),{h:a,l:o}=n.add(this.Bh|0,this.Bl|0,a|0,o|0),{h:s,l:c}=n.add(this.Ch|0,this.Cl|0,s|0,c|0),{h:p,l:m}=n.add(this.Dh|0,this.Dl|0,p|0,m|0),{h,l:g}=n.add(this.Eh|0,this.El|0,h|0,g|0),{h:_,l:v}=n.add(this.Fh|0,this.Fl|0,_|0,v|0),{h:y,l:b}=n.add(this.Gh|0,this.Gl|0,y|0,b|0),{h:x,l:S}=n.add(this.Hh|0,this.Hl|0,x|0,S|0),this.set(r,i,a,o,s,c,p,m,h,g,_,v,y,b,x,S)}roundClean(){(0,r.clean)(d,f)}destroy(){(0,r.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};e.SHA512=p;var m=class extends p{constructor(){super(48),this.Ah=t.SHA384_IV[0]|0,this.Al=t.SHA384_IV[1]|0,this.Bh=t.SHA384_IV[2]|0,this.Bl=t.SHA384_IV[3]|0,this.Ch=t.SHA384_IV[4]|0,this.Cl=t.SHA384_IV[5]|0,this.Dh=t.SHA384_IV[6]|0,this.Dl=t.SHA384_IV[7]|0,this.Eh=t.SHA384_IV[8]|0,this.El=t.SHA384_IV[9]|0,this.Fh=t.SHA384_IV[10]|0,this.Fl=t.SHA384_IV[11]|0,this.Gh=t.SHA384_IV[12]|0,this.Gl=t.SHA384_IV[13]|0,this.Hh=t.SHA384_IV[14]|0,this.Hl=t.SHA384_IV[15]|0}};e.SHA384=m;let h=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),g=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);var _=class extends p{constructor(){super(28),this.Ah=h[0]|0,this.Al=h[1]|0,this.Bh=h[2]|0,this.Bl=h[3]|0,this.Ch=h[4]|0,this.Cl=h[5]|0,this.Dh=h[6]|0,this.Dl=h[7]|0,this.Eh=h[8]|0,this.El=h[9]|0,this.Fh=h[10]|0,this.Fl=h[11]|0,this.Gh=h[12]|0,this.Gl=h[13]|0,this.Hh=h[14]|0,this.Hl=h[15]|0}};e.SHA512_224=_;var v=class extends p{constructor(){super(32),this.Ah=g[0]|0,this.Al=g[1]|0,this.Bh=g[2]|0,this.Bl=g[3]|0,this.Ch=g[4]|0,this.Cl=g[5]|0,this.Dh=g[6]|0,this.Dl=g[7]|0,this.Eh=g[8]|0,this.El=g[9]|0,this.Fh=g[10]|0,this.Fl=g[11]|0,this.Gh=g[12]|0,this.Gl=g[13]|0,this.Hh=g[14]|0,this.Hl=g[15]|0}};e.SHA512_256=v,e.sha256=(0,r.createHasher)(()=>new o),e.sha224=(0,r.createHasher)(()=>new s),e.sha512=(0,r.createHasher)(()=>new p),e.sha384=(0,r.createHasher)(()=>new m),e.sha512_256=(0,r.createHasher)(()=>new v),e.sha512_224=(0,r.createHasher)(()=>new _)})),H=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.notImplemented=e.bitMask=e.utf8ToBytes=e.randomBytes=e.isBytes=e.hexToBytes=e.concatBytes=e.bytesToUtf8=e.bytesToHex=e.anumber=e.abytes=void 0,e.abool=a,e._abool2=o,e._abytes2=s,e.numberToHexUnpadded=c,e.hexToNumber=l,e.bytesToNumberBE=u,e.bytesToNumberLE=d,e.numberToBytesBE=f,e.numberToBytesLE=p,e.numberToVarBytesBE=m,e.ensureBytes=h,e.equalBytes=g,e.copyBytes=_,e.asciiToBytes=v,e.inRange=b,e.aInRange=x,e.bitLen=S,e.bitGet=C,e.bitSet=w,e.createHmacDrbg=T,e.validateObject=D,e.isHash=O,e._validateObject=k,e.memoized=A;
7
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
8
+ let t=R();var n=R();Object.defineProperty(e,`abytes`,{enumerable:!0,get:function(){return n.abytes}}),Object.defineProperty(e,`anumber`,{enumerable:!0,get:function(){return n.anumber}}),Object.defineProperty(e,`bytesToHex`,{enumerable:!0,get:function(){return n.bytesToHex}}),Object.defineProperty(e,`bytesToUtf8`,{enumerable:!0,get:function(){return n.bytesToUtf8}}),Object.defineProperty(e,`concatBytes`,{enumerable:!0,get:function(){return n.concatBytes}}),Object.defineProperty(e,`hexToBytes`,{enumerable:!0,get:function(){return n.hexToBytes}}),Object.defineProperty(e,`isBytes`,{enumerable:!0,get:function(){return n.isBytes}}),Object.defineProperty(e,`randomBytes`,{enumerable:!0,get:function(){return n.randomBytes}}),Object.defineProperty(e,`utf8ToBytes`,{enumerable:!0,get:function(){return n.utf8ToBytes}});let r=BigInt(0),i=BigInt(1);function a(e,t){if(typeof t!=`boolean`)throw Error(e+` boolean expected, got `+t)}function o(e,t=``){if(typeof e!=`boolean`){let n=t&&`"${t}"`;throw Error(n+`expected boolean, got type=`+typeof e)}return e}function s(e,n,r=``){let i=(0,t.isBytes)(e),a=e?.length,o=n!==void 0;if(!i||o&&a!==n){let t=r&&`"${r}" `,s=o?` of length ${n}`:``,c=i?`length=${a}`:`type=${typeof e}`;throw Error(t+`expected Uint8Array`+s+`, got `+c)}return e}function c(e){let t=e.toString(16);return t.length&1?`0`+t:t}function l(e){if(typeof e!=`string`)throw Error(`hex string expected, got `+typeof e);return e===``?r:BigInt(`0x`+e)}function u(e){return l((0,t.bytesToHex)(e))}function d(e){return(0,t.abytes)(e),l((0,t.bytesToHex)(Uint8Array.from(e).reverse()))}function f(e,n){return(0,t.hexToBytes)(e.toString(16).padStart(n*2,`0`))}function p(e,t){return f(e,t).reverse()}function m(e){return(0,t.hexToBytes)(c(e))}function h(e,n,r){let i;if(typeof n==`string`)try{i=(0,t.hexToBytes)(n)}catch(t){throw Error(e+` must be hex string or Uint8Array, cause: `+t)}else if((0,t.isBytes)(n))i=Uint8Array.from(n);else throw Error(e+` must be hex string or Uint8Array`);let a=i.length;if(typeof r==`number`&&a!==r)throw Error(e+` of length `+r+` expected, got `+a);return i}function g(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function _(e){return Uint8Array.from(e)}function v(e){return Uint8Array.from(e,(t,n)=>{let r=t.charCodeAt(0);if(t.length!==1||r>127)throw Error(`string contains non-ASCII character "${e[n]}" with code ${r} at position ${n}`);return r})}let y=e=>typeof e==`bigint`&&r<=e;function b(e,t,n){return y(e)&&y(t)&&y(n)&&t<=e&&e<n}function x(e,t,n,r){if(!b(t,n,r))throw Error(`expected valid `+e+`: `+n+` <= n < `+r+`, got `+t)}function S(e){let t;for(t=0;e>r;e>>=i,t+=1);return t}function C(e,t){return e>>BigInt(t)&i}function w(e,t,n){return e|(n?i:r)<<BigInt(t)}e.bitMask=e=>(i<<BigInt(e))-i;function T(e,n,r){if(typeof e!=`number`||e<2)throw Error(`hashLen must be a number`);if(typeof n!=`number`||n<2)throw Error(`qByteLen must be a number`);if(typeof r!=`function`)throw Error(`hmacFn must be a function`);let i=e=>new Uint8Array(e),a=e=>Uint8Array.of(e),o=i(e),s=i(e),c=0,l=()=>{o.fill(1),s.fill(0),c=0},u=(...e)=>r(s,o,...e),d=(e=i(0))=>{s=u(a(0),e),o=u(),e.length!==0&&(s=u(a(1),e),o=u())},f=()=>{if(c++>=1e3)throw Error(`drbg: tried 1000 values`);let e=0,r=[];for(;e<n;){o=u();let t=o.slice();r.push(t),e+=o.length}return(0,t.concatBytes)(...r)};return(e,t)=>{l(),d(e);let n;for(;!(n=t(f()));)d();return l(),n}}let E={bigint:e=>typeof e==`bigint`,function:e=>typeof e==`function`,boolean:e=>typeof e==`boolean`,string:e=>typeof e==`string`,stringOrUint8Array:e=>typeof e==`string`||(0,t.isBytes)(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e==`function`&&Number.isSafeInteger(e.outputLen)};function D(e,t,n={}){let r=(t,n,r)=>{let i=E[n];if(typeof i!=`function`)throw Error(`invalid validator function`);let a=e[t];if(!(r&&a===void 0)&&!i(a,e))throw Error(`param `+String(t)+` is invalid. Expected `+n+`, got `+a)};for(let[e,n]of Object.entries(t))r(e,n,!1);for(let[e,t]of Object.entries(n))r(e,t,!0);return e}function O(e){return typeof e==`function`&&Number.isSafeInteger(e.outputLen)}function k(e,t,n={}){if(!e||typeof e!=`object`)throw Error(`expected valid options object`);function r(t,n,r){let i=e[t];if(r&&i===void 0)return;let a=typeof i;if(a!==n||i===null)throw Error(`param "${t}" is invalid: expected ${n}, got ${a}`)}Object.entries(t).forEach(([e,t])=>r(e,t,!1)),Object.entries(n).forEach(([e,t])=>r(e,t,!0))}e.notImplemented=()=>{throw Error(`not implemented`)};function A(e){let t=new WeakMap;return(n,...r)=>{let i=t.get(n);if(i!==void 0)return i;let a=e(n,...r);return t.set(n,a),a}}})),U=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isNegativeLE=void 0,e.mod=f,e.pow=p,e.pow2=m,e.invert=h,e.tonelliShanks=b,e.FpSqrt=x,e.validateField=C,e.FpPow=w,e.FpInvertBatch=T,e.FpDiv=E,e.FpLegendre=D,e.FpIsSquare=O,e.nLength=k,e.Field=A,e.FpSqrtOdd=j,e.FpSqrtEven=M,e.hashToPrivateScalar=N,e.getFieldBytesLength=P,e.getMinHashLength=F,e.mapHashToField=I;
9
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
10
+ let t=H(),n=BigInt(0),r=BigInt(1),i=BigInt(2),a=BigInt(3),o=BigInt(4),s=BigInt(5),c=BigInt(7),l=BigInt(8),u=BigInt(9),d=BigInt(16);function f(e,t){let r=e%t;return r>=n?r:t+r}function p(e,t,n){return w(A(n),e,t)}function m(e,t,r){let i=e;for(;t-- >n;)i*=i,i%=r;return i}function h(e,t){if(e===n)throw Error(`invert: expected non-zero number`);if(t<=n)throw Error(`invert: expected positive modulus, got `+t);let i=f(e,t),a=t,o=n,s=r,c=r,l=n;for(;i!==n;){let e=a/i,t=a%i,n=o-c*e,r=s-l*e;a=i,i=t,o=c,s=l,c=n,l=r}if(a!==r)throw Error(`invert: does not exist`);return f(o,t)}function g(e,t,n){if(!e.eql(e.sqr(t),n))throw Error(`Cannot find square root`)}function _(e,t){let n=(e.ORDER+r)/o,i=e.pow(t,n);return g(e,i,t),i}function v(e,t){let n=(e.ORDER-s)/l,r=e.mul(t,i),a=e.pow(r,n),o=e.mul(t,a),c=e.mul(e.mul(o,i),a),u=e.mul(o,e.sub(c,e.ONE));return g(e,u,t),u}function y(e){let t=A(e),n=b(e),r=n(t,t.neg(t.ONE)),i=n(t,r),a=n(t,t.neg(r)),o=(e+c)/d;return(e,t)=>{let n=e.pow(t,o),s=e.mul(n,r),c=e.mul(n,i),l=e.mul(n,a),u=e.eql(e.sqr(s),t),d=e.eql(e.sqr(c),t);n=e.cmov(n,s,u),s=e.cmov(l,c,d);let f=e.eql(e.sqr(s),t),p=e.cmov(n,s,f);return g(e,p,t),p}}function b(e){if(e<a)throw Error(`sqrt is not defined for small field`);let t=e-r,o=0;for(;t%i===n;)t/=i,o++;let s=i,c=A(e);for(;D(c,s)===1;)if(s++>1e3)throw Error(`Cannot find square root: probably non-prime P`);if(o===1)return _;let l=c.pow(s,t),u=(t+r)/i;return function(e,n){if(e.is0(n))return n;if(D(e,n)!==1)throw Error(`Cannot find square root`);let i=o,a=e.mul(e.ONE,l),s=e.pow(n,t),c=e.pow(n,u);for(;!e.eql(s,e.ONE);){if(e.is0(s))return e.ZERO;let t=1,n=e.sqr(s);for(;!e.eql(n,e.ONE);)if(t++,n=e.sqr(n),t===i)throw Error(`Cannot find square root`);let o=r<<BigInt(i-t-1),l=e.pow(a,o);i=t,a=e.sqr(l),s=e.mul(s,a),c=e.mul(c,l)}return c}}function x(e){return e%o===a?_:e%l===s?v:e%d===u?y(e):b(e)}e.isNegativeLE=(e,t)=>(f(e,t)&r)===r;let S=[`create`,`isValid`,`is0`,`neg`,`inv`,`sqrt`,`sqr`,`eql`,`add`,`sub`,`mul`,`pow`,`div`,`addN`,`subN`,`mulN`,`sqrN`];function C(e){let n=S.reduce((e,t)=>(e[t]=`function`,e),{ORDER:`bigint`,MASK:`bigint`,BYTES:`number`,BITS:`number`});return(0,t._validateObject)(e,n),e}function w(e,t,i){if(i<n)throw Error(`invalid exponent, negatives unsupported`);if(i===n)return e.ONE;if(i===r)return t;let a=e.ONE,o=t;for(;i>n;)i&r&&(a=e.mul(a,o)),o=e.sqr(o),i>>=r;return a}function T(e,t,n=!1){let r=Array(t.length).fill(n?e.ZERO:void 0),i=t.reduce((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n)),e.ONE),a=e.inv(i);return t.reduceRight((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n)),a),r}function E(e,t,n){return e.mul(t,typeof n==`bigint`?h(n,e.ORDER):e.inv(n))}function D(e,t){let n=(e.ORDER-r)/i,a=e.pow(t,n),o=e.eql(a,e.ONE),s=e.eql(a,e.ZERO),c=e.eql(a,e.neg(e.ONE));if(!o&&!s&&!c)throw Error(`invalid Legendre symbol result`);return o?1:s?0:-1}function O(e,t){return D(e,t)===1}function k(e,n){n!==void 0&&(0,t.anumber)(n);let r=n===void 0?e.toString(2).length:n;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function A(e,i,a=!1,o={}){if(e<=n)throw Error(`invalid field: expected ORDER > 0, got `+e);let s,c,l=!1,u;if(typeof i==`object`&&i){if(o.sqrt||a)throw Error(`cannot specify opts in two arguments`);let e=i;e.BITS&&(s=e.BITS),e.sqrt&&(c=e.sqrt),typeof e.isLE==`boolean`&&(a=e.isLE),typeof e.modFromBytes==`boolean`&&(l=e.modFromBytes),u=e.allowedLengths}else typeof i==`number`&&(s=i),o.sqrt&&(c=o.sqrt);let{nBitLength:d,nByteLength:p}=k(e,s);if(p>2048)throw Error(`invalid field: expected ORDER of <= 2048 bytes`);let m,g=Object.freeze({ORDER:e,isLE:a,BITS:d,BYTES:p,MASK:(0,t.bitMask)(d),ZERO:n,ONE:r,allowedLengths:u,create:t=>f(t,e),isValid:t=>{if(typeof t!=`bigint`)throw Error(`invalid field element: expected bigint, got `+typeof t);return n<=t&&t<e},is0:e=>e===n,isValidNot0:e=>!g.is0(e)&&g.isValid(e),isOdd:e=>(e&r)===r,neg:t=>f(-t,e),eql:(e,t)=>e===t,sqr:t=>f(t*t,e),add:(t,n)=>f(t+n,e),sub:(t,n)=>f(t-n,e),mul:(t,n)=>f(t*n,e),pow:(e,t)=>w(g,e,t),div:(t,n)=>f(t*h(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>h(t,e),sqrt:c||(t=>(m||=x(e),m(g,t))),toBytes:e=>a?(0,t.numberToBytesLE)(e,p):(0,t.numberToBytesBE)(e,p),fromBytes:(n,r=!0)=>{if(u){if(!u.includes(n.length)||n.length>p)throw Error(`Field.fromBytes: expected `+u+` bytes, got `+n.length);let e=new Uint8Array(p);e.set(n,a?0:e.length-n.length),n=e}if(n.length!==p)throw Error(`Field.fromBytes: expected `+p+` bytes, got `+n.length);let i=a?(0,t.bytesToNumberLE)(n):(0,t.bytesToNumberBE)(n);if(l&&(i=f(i,e)),!r&&!g.isValid(i))throw Error(`invalid field element: outside of range 0..ORDER`);return i},invertBatch:e=>T(g,e),cmov:(e,t,n)=>n?t:e});return Object.freeze(g)}function j(e,t){if(!e.isOdd)throw Error(`Field doesn't have isOdd`);let n=e.sqrt(t);return e.isOdd(n)?n:e.neg(n)}function M(e,t){if(!e.isOdd)throw Error(`Field doesn't have isOdd`);let n=e.sqrt(t);return e.isOdd(n)?e.neg(n):n}function N(e,n,i=!1){e=(0,t.ensureBytes)(`privateHash`,e);let a=e.length,o=k(n).nByteLength+8;if(o<24||a<o||a>1024)throw Error(`hashToPrivateScalar: expected `+o+`-1024 bytes of input, got `+a);return f(i?(0,t.bytesToNumberLE)(e):(0,t.bytesToNumberBE)(e),n-r)+r}function P(e){if(typeof e!=`bigint`)throw Error(`field order must be bigint`);let t=e.toString(2).length;return Math.ceil(t/8)}function F(e){let t=P(e);return t+Math.ceil(t/2)}function I(e,n,i=!1){let a=e.length,o=P(n),s=F(n);if(a<16||a<s||a>1024)throw Error(`expected `+s+`-1024 bytes of input, got `+a);let c=f(i?(0,t.bytesToNumberLE)(e):(0,t.bytesToNumberBE)(e),n-r)+r;return i?(0,t.numberToBytesLE)(c,o):(0,t.numberToBytesBE)(c,o)}})),W=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.wNAF=void 0,e.negateCt=a,e.normalizeZ=o,e.mulEndoUnsafe=g,e.pippenger=_,e.precomputeMSMUnsafe=v,e.validateBasic=y,e._createCurveFields=x;
11
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
12
+ let t=H(),n=U(),r=BigInt(0),i=BigInt(1);function a(e,t){let n=t.negate();return e?n:t}function o(e,t){let r=(0,n.FpInvertBatch)(e.Fp,t.map(e=>e.Z));return t.map((t,n)=>e.fromAffine(t.toAffine(r[n])))}function s(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error(`invalid window size, expected [1..`+t+`], got W=`+e)}function c(e,n){s(e,n);let r=Math.ceil(n/e)+1,i=2**(e-1),a=2**e;return{windows:r,windowSize:i,mask:(0,t.bitMask)(e),maxNumber:a,shiftBy:BigInt(e)}}function l(e,t,n){let{windowSize:r,mask:a,maxNumber:o,shiftBy:s}=n,c=Number(e&a),l=e>>s;c>r&&(c-=o,l+=i);let u=t*r,d=u+Math.abs(c)-1,f=c===0,p=c<0,m=t%2!=0;return{nextN:l,offset:d,isZero:f,isNeg:p,isNegF:m,offsetF:u}}function u(e,t){if(!Array.isArray(e))throw Error(`array expected`);e.forEach((e,n)=>{if(!(e instanceof t))throw Error(`invalid point at index `+n)})}function d(e,t){if(!Array.isArray(e))throw Error(`array of scalars expected`);e.forEach((e,n)=>{if(!t.isValid(e))throw Error(`invalid scalar at index `+n)})}let f=new WeakMap,p=new WeakMap;function m(e){return p.get(e)||1}function h(e){if(e!==r)throw Error(`invalid wNAF`)}e.wNAF=class{constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,n=this.ZERO){let a=e;for(;t>r;)t&i&&(n=n.add(a)),a=a.double(),t>>=i;return n}precomputeWindow(e,t){let{windows:n,windowSize:r}=c(t,this.bits),i=[],a=e,o=a;for(let e=0;e<n;e++){o=a,i.push(o);for(let e=1;e<r;e++)o=o.add(a),i.push(o);a=o.double()}return i}wNAF(e,t,n){if(!this.Fn.isValid(n))throw Error(`invalid scalar`);let r=this.ZERO,i=this.BASE,o=c(e,this.bits);for(let e=0;e<o.windows;e++){let{nextN:s,offset:c,isZero:u,isNeg:d,isNegF:f,offsetF:p}=l(n,e,o);n=s,u?i=i.add(a(f,t[p])):r=r.add(a(d,t[c]))}return h(n),{p:r,f:i}}wNAFUnsafe(e,t,n,i=this.ZERO){let a=c(e,this.bits);for(let e=0;e<a.windows&&n!==r;e++){let{nextN:r,offset:o,isZero:s,isNeg:c}=l(n,e,a);if(n=r,!s){let e=t[o];i=i.add(c?e.negate():e)}}return h(n),i}getPrecomputes(e,t,n){let r=f.get(t);return r||(r=this.precomputeWindow(t,e),e!==1&&(typeof n==`function`&&(r=n(r)),f.set(t,r))),r}cached(e,t,n){let r=m(e);return this.wNAF(r,this.getPrecomputes(r,e,n),t)}unsafe(e,t,n,r){let i=m(e);return i===1?this._unsafeLadder(e,t,r):this.wNAFUnsafe(i,this.getPrecomputes(i,e,n),t,r)}createCache(e,t){s(t,this.bits),p.set(e,t),f.delete(e)}hasCache(e){return m(e)!==1}};function g(e,t,n,a){let o=t,s=e.ZERO,c=e.ZERO;for(;n>r||a>r;)n&i&&(s=s.add(o)),a&i&&(c=c.add(o)),o=o.double(),n>>=i,a>>=i;return{p1:s,p2:c}}function _(e,n,r,i){u(r,e),d(i,n);let a=r.length,o=i.length;if(a!==o)throw Error(`arrays of points and scalars must have equal length`);let s=e.ZERO,c=(0,t.bitLen)(BigInt(a)),l=1;c>12?l=c-3:c>4?l=c-2:c>0&&(l=2);let f=(0,t.bitMask)(l),p=Array(Number(f)+1).fill(s),m=Math.floor((n.BITS-1)/l)*l,h=s;for(let e=m;e>=0;e-=l){p.fill(s);for(let t=0;t<o;t++){let n=i[t],a=Number(n>>BigInt(e)&f);p[a]=p[a].add(r[t])}let t=s;for(let e=p.length-1,n=s;e>0;e--)n=n.add(p[e]),t=t.add(n);if(h=h.add(t),e!==0)for(let e=0;e<l;e++)h=h.double()}return h}function v(e,n,r,i){s(i,n.BITS),u(r,e);let a=e.ZERO,o=2**i-1,c=Math.ceil(n.BITS/i),l=(0,t.bitMask)(i),f=r.map(e=>{let t=[];for(let n=0,r=e;n<o;n++)t.push(r),r=r.add(e);return t});return e=>{if(d(e,n),e.length>r.length)throw Error(`array of scalars must be smaller than array of points`);let t=a;for(let n=0;n<c;n++){if(t!==a)for(let e=0;e<i;e++)t=t.double();let r=BigInt(c*i-(n+1)*i);for(let n=0;n<e.length;n++){let i=e[n],a=Number(i>>r&l);a&&(t=t.add(f[n][a-1]))}}return t}}function y(e){return(0,n.validateField)(e.Fp),(0,t.validateObject)(e,{n:`bigint`,h:`bigint`,Gx:`field`,Gy:`field`},{nBitLength:`isSafeInteger`,nByteLength:`isSafeInteger`}),Object.freeze({...(0,n.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function b(e,t,r){if(t){if(t.ORDER!==e)throw Error(`Field.ORDER must match order: Fp == p, Fn == n`);return(0,n.validateField)(t),t}else return(0,n.Field)(e,{isLE:r})}function x(e,t,n={},i){if(i===void 0&&(i=e===`edwards`),!t||typeof t!=`object`)throw Error(`expected valid ${e} CURVE object`);for(let e of[`p`,`n`,`h`]){let n=t[e];if(!(typeof n==`bigint`&&n>r))throw Error(`CURVE.${e} must be positive bigint`)}let a=b(t.p,n.Fp,i),o=b(t.n,n.Fn,i),s=[`Gx`,`Gy`,`a`,e===`weierstrass`?`b`:`d`];for(let e of s)if(!a.isValid(t[e]))throw Error(`CURVE.${e} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:a,Fn:o}}})),G=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PrimeEdwardsPoint=void 0,e.edwards=l,e.eddsa=u,e.twistedEdwards=p;
13
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
14
+ let t=H(),n=W(),r=U(),i=BigInt(0),a=BigInt(1),o=BigInt(2),s=BigInt(8);function c(e,t,n,r){let i=e.sqr(n),a=e.sqr(r),o=e.add(e.mul(t.a,i),a),s=e.add(e.ONE,e.mul(t.d,e.mul(i,a)));return e.eql(o,s)}function l(e,r={}){let l=(0,n._createCurveFields)(`edwards`,e,r,r.FpFnLE),{Fp:u,Fn:d}=l,f=l.CURVE,{h:p}=f;(0,t._validateObject)(r,{},{uvRatio:`function`});let m=o<<BigInt(d.BYTES*8)-a,h=e=>u.create(e),g=r.uvRatio||((e,t)=>{try{return{isValid:!0,value:u.sqrt(u.div(e,t))}}catch{return{isValid:!1,value:i}}});if(!c(u,f,f.Gx,f.Gy))throw Error(`bad curve params: generator point`);function _(e,n,r=!1){let o=r?a:i;return(0,t.aInRange)(`coordinate `+e,n,o,m),n}function v(e){if(!(e instanceof x))throw Error(`ExtendedPoint expected`)}let y=(0,t.memoized)((e,t)=>{let{X:n,Y:r,Z:o}=e,c=e.is0();t??=c?s:u.inv(o);let l=h(n*t),d=h(r*t),f=u.mul(o,t);if(c)return{x:i,y:a};if(f!==a)throw Error(`invZ was invalid`);return{x:l,y:d}}),b=(0,t.memoized)(e=>{let{a:t,d:n}=f;if(e.is0())throw Error(`bad point: ZERO`);let{X:r,Y:i,Z:a,T:o}=e,s=h(r*r),c=h(i*i),l=h(a*a),u=h(l*l);if(h(l*h(h(s*t)+c))!==h(u+h(n*h(s*c))))throw Error(`bad point: equation left != right (1)`);if(h(r*i)!==h(a*o))throw Error(`bad point: equation left != right (2)`);return!0});class x{constructor(e,t,n,r){this.X=_(`x`,e),this.Y=_(`y`,t),this.Z=_(`z`,n,!0),this.T=_(`t`,r),Object.freeze(this)}static CURVE(){return f}static fromAffine(e){if(e instanceof x)throw Error(`extended point not allowed`);let{x:t,y:n}=e||{};return _(`x`,t),_(`y`,n),new x(t,n,a,h(t*n))}static fromBytes(e,n=!1){let r=u.BYTES,{a:o,d:s}=f;e=(0,t.copyBytes)((0,t._abytes2)(e,r,`point`)),(0,t._abool2)(n,`zip215`);let c=(0,t.copyBytes)(e),l=e[r-1];c[r-1]=l&-129;let d=(0,t.bytesToNumberLE)(c),p=n?m:u.ORDER;(0,t.aInRange)(`point.y`,d,i,p);let _=h(d*d),{isValid:v,value:y}=g(h(_-a),h(s*_-o));if(!v)throw Error(`bad point: invalid y coordinate`);let b=(y&a)===a,S=(l&128)!=0;if(!n&&y===i&&S)throw Error(`bad point: x=0 and x_0=1`);return S!==b&&(y=h(-y)),x.fromAffine({x:y,y:d})}static fromHex(e,n=!1){return x.fromBytes((0,t.ensureBytes)(`point`,e),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return S.createCache(this,e),t||this.multiply(o),this}assertValidity(){b(this)}equals(e){v(e);let{X:t,Y:n,Z:r}=this,{X:i,Y:a,Z:o}=e,s=h(t*o),c=h(i*r),l=h(n*o),u=h(a*r);return s===c&&l===u}is0(){return this.equals(x.ZERO)}negate(){return new x(h(-this.X),this.Y,this.Z,h(-this.T))}double(){let{a:e}=f,{X:t,Y:n,Z:r}=this,i=h(t*t),a=h(n*n),s=h(o*h(r*r)),c=h(e*i),l=t+n,u=h(h(l*l)-i-a),d=c+a,p=d-s,m=c-a,g=h(u*p),_=h(d*m),v=h(u*m);return new x(g,_,h(p*d),v)}add(e){v(e);let{a:t,d:n}=f,{X:r,Y:i,Z:a,T:o}=this,{X:s,Y:c,Z:l,T:u}=e,d=h(r*s),p=h(i*c),m=h(o*n*u),g=h(a*l),_=h((r+i)*(s+c)-d-p),y=g-m,b=g+m,S=h(p-t*d),C=h(_*y),w=h(b*S),T=h(_*S);return new x(C,w,h(y*b),T)}subtract(e){return this.add(e.negate())}multiply(e){if(!d.isValidNot0(e))throw Error(`invalid scalar: expected 1 <= sc < curve.n`);let{p:t,f:r}=S.cached(this,e,e=>(0,n.normalizeZ)(x,e));return(0,n.normalizeZ)(x,[t,r])[0]}multiplyUnsafe(e,t=x.ZERO){if(!d.isValid(e))throw Error(`invalid scalar: expected 0 <= sc < curve.n`);return e===i?x.ZERO:this.is0()||e===a?this:S.unsafe(this,e,e=>(0,n.normalizeZ)(x,e),t)}isSmallOrder(){return this.multiplyUnsafe(p).is0()}isTorsionFree(){return S.unsafe(this,f.n).is0()}toAffine(e){return y(this,e)}clearCofactor(){return p===a?this:this.multiplyUnsafe(p)}toBytes(){let{x:e,y:t}=this.toAffine(),n=u.toBytes(t);return n[n.length-1]|=e&a?128:0,n}toHex(){return(0,t.bytesToHex)(this.toBytes())}toString(){return`<Point ${this.is0()?`ZERO`:this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(e){return(0,n.normalizeZ)(x,e)}static msm(e,t){return(0,n.pippenger)(x,d,e,t)}_setWindowSize(e){this.precompute(e)}toRawBytes(){return this.toBytes()}}x.BASE=new x(f.Gx,f.Gy,a,h(f.Gx*f.Gy)),x.ZERO=new x(i,a,a,i),x.Fp=u,x.Fn=d;let S=new n.wNAF(x,d.BITS);return x.BASE.precompute(8),x}e.PrimeEdwardsPoint=class{constructor(e){this.ep=e}static fromBytes(e){(0,t.notImplemented)()}static fromHex(e){(0,t.notImplemented)()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(e){return this.ep.toAffine(e)}toHex(){return(0,t.bytesToHex)(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(e){return this.assertSame(e),this.init(this.ep.add(e.ep))}subtract(e){return this.assertSame(e),this.init(this.ep.subtract(e.ep))}multiply(e){return this.init(this.ep.multiply(e))}multiplyUnsafe(e){return this.init(this.ep.multiplyUnsafe(e))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(e,t){return this.init(this.ep.precompute(e,t))}toRawBytes(){return this.toBytes()}};function u(e,n,r={}){if(typeof n!=`function`)throw Error(`"hash" function param is required`);(0,t._validateObject)(r,{},{adjustScalarBytes:`function`,randomBytes:`function`,domain:`function`,prehash:`function`,mapToCurve:`function`});let{prehash:i}=r,{BASE:o,Fp:s,Fn:c}=e,l=r.randomBytes||t.randomBytes,u=r.adjustScalarBytes||(e=>e),d=r.domain||((e,n,r)=>{if((0,t._abool2)(r,`phflag`),n.length||r)throw Error(`Contexts/pre-hash are not supported`);return e});function f(e){return c.create((0,t.bytesToNumberLE)(e))}function p(e){let r=x.secretKey;e=(0,t.ensureBytes)(`private key`,e,r);let i=(0,t.ensureBytes)(`hashed private key`,n(e),2*r),a=u(i.slice(0,r));return{head:a,prefix:i.slice(r,2*r),scalar:f(a)}}function m(e){let{head:t,prefix:n,scalar:r}=p(e),i=o.multiply(r);return{head:t,prefix:n,scalar:r,point:i,pointBytes:i.toBytes()}}function h(e){return m(e).pointBytes}function g(e=Uint8Array.of(),...r){return f(n(d((0,t.concatBytes)(...r),(0,t.ensureBytes)(`context`,e),!!i)))}function _(e,n,r={}){e=(0,t.ensureBytes)(`message`,e),i&&(e=i(e));let{prefix:a,scalar:s,pointBytes:l}=m(n),u=g(r.context,a,e),d=o.multiply(u).toBytes(),f=g(r.context,d,l,e),p=c.create(u+f*s);if(!c.isValid(p))throw Error(`sign failed: invalid s`);let h=(0,t.concatBytes)(d,c.toBytes(p));return(0,t._abytes2)(h,x.signature,`result`)}let v={zip215:!0};function y(n,r,a,s=v){let{context:c,zip215:l}=s,u=x.signature;n=(0,t.ensureBytes)(`signature`,n,u),r=(0,t.ensureBytes)(`message`,r),a=(0,t.ensureBytes)(`publicKey`,a,x.publicKey),l!==void 0&&(0,t._abool2)(l,`zip215`),i&&(r=i(r));let d=u/2,f=n.subarray(0,d),p=(0,t.bytesToNumberLE)(n.subarray(d,u)),m,h,_;try{m=e.fromBytes(a,l),h=e.fromBytes(f,l),_=o.multiplyUnsafe(p)}catch{return!1}if(!l&&m.isSmallOrder())return!1;let y=g(c,h.toBytes(),m.toBytes(),r);return h.add(m.multiplyUnsafe(y)).subtract(_).clearCofactor().is0()}let b=s.BYTES,x={secretKey:b,publicKey:b,signature:2*b,seed:b};function S(e=l(x.seed)){return(0,t._abytes2)(e,x.seed,`seed`)}function C(e){let t=E.randomSecretKey(e);return{secretKey:t,publicKey:h(t)}}function w(e){return(0,t.isBytes)(e)&&e.length===c.BYTES}function T(t,n){try{return!!e.fromBytes(t,n)}catch{return!1}}let E={getExtendedPublicKey:m,randomSecretKey:S,isValidSecretKey:w,isValidPublicKey:T,toMontgomery(t){let{y:n}=e.fromBytes(t),r=x.publicKey,i=r===32;if(!i&&r!==57)throw Error(`only defined for 25519 and 448`);let o=i?s.div(a+n,a-n):s.div(n-a,n+a);return s.toBytes(o)},toMontgomerySecret(e){let r=x.secretKey;return(0,t._abytes2)(e,r),u(n(e.subarray(0,r))).subarray(0,r)},randomPrivateKey:S,precompute(t=8,n=e.BASE){return n.precompute(t,!1)}};return Object.freeze({keygen:C,getPublicKey:h,sign:_,verify:y,utils:E,Point:e,lengths:x})}function d(e){let t={a:e.a,d:e.d,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n={Fp:e.Fp,Fn:(0,r.Field)(t.n,e.nBitLength,!0),uvRatio:e.uvRatio},i={randomBytes:e.randomBytes,adjustScalarBytes:e.adjustScalarBytes,domain:e.domain,prehash:e.prehash,mapToCurve:e.mapToCurve};return{CURVE:t,curveOpts:n,hash:e.hash,eddsaOpts:i}}function f(e,t){let n=t.Point;return Object.assign({},t,{ExtendedPoint:n,CURVE:e,nBitLength:n.Fn.BITS,nByteLength:n.Fn.BYTES})}function p(e){let{CURVE:t,curveOpts:n,hash:r,eddsaOpts:i}=d(e);return f(e,u(l(t,n),r,i))}})),K=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e._DST_scalar=void 0,e.expand_message_xmd=c,e.expand_message_xof=l,e.hash_to_field=u,e.isogenyMap=d,e.createHasher=f;let t=H(),n=U(),r=t.bytesToNumberBE;function i(e,t){if(o(e),o(t),e<0||e>=1<<8*t)throw Error(`invalid I2OSP input: `+e);let n=Array.from({length:t}).fill(0);for(let r=t-1;r>=0;r--)n[r]=e&255,e>>>=8;return new Uint8Array(n)}function a(e,t){let n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e[r]^t[r];return n}function o(e){if(!Number.isSafeInteger(e))throw Error(`number expected`)}function s(e){if(!(0,t.isBytes)(e)&&typeof e!=`string`)throw Error(`DST must be Uint8Array or string`);return typeof e==`string`?(0,t.utf8ToBytes)(e):e}function c(e,n,r,c){(0,t.abytes)(e),o(r),n=s(n),n.length>255&&(n=c((0,t.concatBytes)((0,t.utf8ToBytes)(`H2C-OVERSIZE-DST-`),n)));let{outputLen:l,blockLen:u}=c,d=Math.ceil(r/l);if(r>65535||d>255)throw Error(`expand_message_xmd: invalid lenInBytes`);let f=(0,t.concatBytes)(n,i(n.length,1)),p=i(0,u),m=i(r,2),h=Array(d),g=c((0,t.concatBytes)(p,e,m,i(0,1),f));h[0]=c((0,t.concatBytes)(g,i(1,1),f));for(let e=1;e<=d;e++){let n=[a(g,h[e-1]),i(e+1,1),f];h[e]=c((0,t.concatBytes)(...n))}return(0,t.concatBytes)(...h).slice(0,r)}function l(e,n,r,a,c){if((0,t.abytes)(e),o(r),n=s(n),n.length>255){let e=Math.ceil(2*a/8);n=c.create({dkLen:e}).update((0,t.utf8ToBytes)(`H2C-OVERSIZE-DST-`)).update(n).digest()}if(r>65535||n.length>255)throw Error(`expand_message_xof: invalid lenInBytes`);return c.create({dkLen:r}).update(e).update(i(r,2)).update(n).update(i(n.length,1)).digest()}function u(e,i,a){(0,t._validateObject)(a,{p:`bigint`,m:`number`,k:`number`,hash:`function`});let{p:s,k:u,m:d,hash:f,expand:p,DST:m}=a;if(!(0,t.isHash)(a.hash))throw Error(`expected valid hash`);(0,t.abytes)(e),o(i);let h=s.toString(2).length,g=Math.ceil((h+u)/8),_=i*d*g,v;if(p===`xmd`)v=c(e,m,_,f);else if(p===`xof`)v=l(e,m,_,u,f);else if(p===`_internal_pass`)v=e;else throw Error(`expand must be "xmd" or "xof"`);let y=Array(i);for(let e=0;e<i;e++){let t=Array(d);for(let i=0;i<d;i++){let a=g*(i+e*d),o=v.subarray(a,a+g);t[i]=(0,n.mod)(r(o),s)}y[e]=t}return y}function d(e,t){let r=t.map(e=>Array.from(e).reverse());return(t,i)=>{let[a,o,s,c]=r.map(n=>n.reduce((n,r)=>e.add(e.mul(n,t),r))),[l,u]=(0,n.FpInvertBatch)(e,[o,c],!0);return t=e.mul(a,l),i=e.mul(i,e.mul(s,u)),{x:t,y:i}}}e._DST_scalar=(0,t.utf8ToBytes)(`HashToScalar-`);function f(t,n,r){if(typeof n!=`function`)throw Error(`mapToCurve() must be defined`);function i(e){return t.fromAffine(n(e))}function a(e){let n=e.clearCofactor();return n.equals(t.ZERO)?t.ZERO:(n.assertValidity(),n)}return{defaults:r,hashToCurve(e,t){let n=u(e,2,Object.assign({},r,t)),o=i(n[0]),s=i(n[1]);return a(o.add(s))},encodeToCurve(e,t){let n=r.encodeDST?{DST:r.encodeDST}:{};return a(i(u(e,1,Object.assign({},r,n,t))[0]))},mapToCurve(e){if(!Array.isArray(e))throw Error(`expected array of bigints`);for(let t of e)if(typeof t!=`bigint`)throw Error(`expected array of bigints`);return a(i(e))},hashToScalar(n,i){let a=t.Fn.ORDER;return u(n,1,Object.assign({},r,{p:a,m:1,DST:e._DST_scalar},i))[0][0]}}}})),q=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.montgomery=s;
15
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
16
+ let t=H(),n=U(),r=BigInt(0),i=BigInt(1),a=BigInt(2);function o(e){return(0,t._validateObject)(e,{adjustScalarBytes:`function`,powPminus2:`function`}),Object.freeze({...e})}function s(e){let{P:s,type:c,adjustScalarBytes:l,powPminus2:u,randomBytes:d}=o(e),f=c===`x25519`;if(!f&&c!==`x448`)throw Error(`invalid type`);let p=d||t.randomBytes,m=f?255:448,h=f?32:56,g=BigInt(f?9:5),_=BigInt(f?121665:39081),v=f?a**BigInt(254):a**BigInt(447),y=v+(f?BigInt(8)*a**BigInt(251)-i:BigInt(4)*a**BigInt(445)-i)+i,b=e=>(0,n.mod)(e,s),x=S(g);function S(e){return(0,t.numberToBytesLE)(b(e),h)}function C(e){let n=(0,t.ensureBytes)(`u coordinate`,e,h);return f&&(n[31]&=127),b((0,t.bytesToNumberLE)(n))}function w(e){return(0,t.bytesToNumberLE)(l((0,t.ensureBytes)(`scalar`,e,h)))}function T(e,t){let n=O(C(t),w(e));if(n===r)throw Error(`invalid private or public key received`);return S(n)}function E(e){return T(e,x)}function D(e,t,n){let r=b(e*(t-n));return t=b(t-r),n=b(n+r),{x_2:t,x_3:n}}function O(e,n){(0,t.aInRange)(`u`,e,r,s),(0,t.aInRange)(`scalar`,n,v,y);let a=n,o=e,c=i,l=r,d=e,f=i,p=r;for(let e=BigInt(m-1);e>=r;e--){let t=a>>e&i;p^=t,{x_2:c,x_3:d}=D(p,c,d),{x_2:l,x_3:f}=D(p,l,f),p=t;let n=c+l,r=b(n*n),s=c-l,u=b(s*s),m=r-u,h=d+f,g=b((d-f)*n),v=b(h*s),y=g+v,x=g-v;d=b(y*y),f=b(o*b(x*x)),c=b(r*u),l=b(m*(r+b(_*m)))}({x_2:c,x_3:d}=D(p,c,d)),{x_2:l,x_3:f}=D(p,l,f);let h=u(l);return b(c*h)}let k={secretKey:h,publicKey:h,seed:h},A=(e=p(h))=>((0,t.abytes)(e,k.seed),e);function j(e){let t=A(e);return{secretKey:t,publicKey:E(t)}}return{keygen:j,getSharedSecret:(e,t)=>T(e,t),getPublicKey:e=>E(e),scalarMult:T,scalarMultBase:E,utils:{randomSecretKey:A,randomPrivateKey:A},GuBytes:x.slice(),lengths:k}}})),J=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hash_to_ristretto255=e.hashToRistretto255=e.encodeToCurve=e.hashToCurve=e.RistrettoPoint=e.edwardsToMontgomery=e.ED25519_TORSION_SUBGROUP=e.ristretto255_hasher=e.ristretto255=e.ed25519_hasher=e.x25519=e.ed25519ph=e.ed25519ctx=e.ed25519=void 0,e.edwardsToMontgomeryPub=X,e.edwardsToMontgomeryPriv=Z;
17
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
18
+ let t=V(),n=R(),r=W(),i=G(),a=K(),o=U(),s=q(),c=H(),l=BigInt(0),u=BigInt(1),d=BigInt(2),f=BigInt(3),p=BigInt(5),m=BigInt(8),h=BigInt(`0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed`),g={p:h,n:BigInt(`0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed`),h:m,a:BigInt(`0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec`),d:BigInt(`0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3`),Gx:BigInt(`0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a`),Gy:BigInt(`0x6666666666666666666666666666666666666666666666666666666666666658`)};function _(e){let t=BigInt(10),n=BigInt(20),r=BigInt(40),i=BigInt(80),a=h,s=e*e%a*e%a,c=(0,o.pow2)(s,d,a)*s%a,l=(0,o.pow2)(c,u,a)*e%a,f=(0,o.pow2)(l,p,a)*l%a,m=(0,o.pow2)(f,t,a)*f%a,g=(0,o.pow2)(m,n,a)*m%a,_=(0,o.pow2)(g,r,a)*g%a,v=(0,o.pow2)(_,i,a)*_%a,y=(0,o.pow2)(v,i,a)*_%a,b=(0,o.pow2)(y,t,a)*f%a;return{pow_p_5_8:(0,o.pow2)(b,d,a)*e%a,b2:s}}function v(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}let y=BigInt(`19681161376707505956807079304988542015446066515923890162744021073123829784752`);function b(e,t){let n=h,r=(0,o.mod)(t*t*t,n),i=_(e*(0,o.mod)(r*r*t,n)).pow_p_5_8,a=(0,o.mod)(e*r*i,n),s=(0,o.mod)(t*a*a,n),c=a,l=(0,o.mod)(a*y,n),u=s===e,d=s===(0,o.mod)(-e,n),f=s===(0,o.mod)(-e*y,n);return u&&(a=c),(d||f)&&(a=l),(0,o.isNegativeLE)(a,n)&&(a=(0,o.mod)(-a,n)),{isValid:u||d,value:a}}let x=(0,o.Field)(g.p,{isLE:!0}),S=(0,o.Field)(g.n,{isLE:!0}),C={...g,Fp:x,hash:t.sha512,adjustScalarBytes:v,uvRatio:b};e.ed25519=(0,i.twistedEdwards)(C);function w(e,t,r){if(t.length>255)throw Error(`Context is too big`);return(0,n.concatBytes)((0,n.utf8ToBytes)(`SigEd25519 no Ed25519 collisions`),new Uint8Array([+!!r,t.length]),t,e)}e.ed25519ctx=(0,i.twistedEdwards)({...C,domain:w}),e.ed25519ph=(0,i.twistedEdwards)(Object.assign({},C,{domain:w,prehash:t.sha512})),e.x25519=(()=>{let e=x.ORDER;return(0,s.montgomery)({P:e,type:`x25519`,powPminus2:t=>{let{pow_p_5_8:n,b2:r}=_(t);return(0,o.mod)((0,o.pow2)(n,f,e)*r,e)},adjustScalarBytes:v})})();let T=(h+f)/m,E=x.pow(d,T),D=x.sqrt(x.neg(x.ONE));function O(e){let t=(h-p)/m,n=BigInt(486662),r=x.sqr(e);r=x.mul(r,d);let i=x.add(r,x.ONE),a=x.neg(n),o=x.sqr(i),s=x.mul(o,i),c=x.mul(r,n);c=x.mul(c,a),c=x.add(c,o),c=x.mul(c,a);let l=x.sqr(s);o=x.sqr(l),l=x.mul(l,s),l=x.mul(l,c),o=x.mul(o,l);let f=x.pow(o,t);f=x.mul(f,l);let g=x.mul(f,D);o=x.sqr(f),o=x.mul(o,s);let _=x.eql(o,c),v=x.cmov(g,f,_),y=x.mul(a,r),b=x.mul(f,e);b=x.mul(b,E);let S=x.mul(b,D),C=x.mul(c,r);o=x.sqr(b),o=x.mul(o,s);let w=x.eql(o,C),T=x.cmov(S,b,w);o=x.sqr(v),o=x.mul(o,s);let O=x.eql(o,c),k=x.cmov(y,a,O),A=x.cmov(T,v,O),j=x.isOdd(A);return A=x.cmov(A,x.neg(A),O!==j),{xMn:k,xMd:i,yMn:A,yMd:u}}let k=(0,o.FpSqrtEven)(x,x.neg(BigInt(486664)));function A(e){let{xMn:t,xMd:n,yMn:r,yMd:i}=O(e),a=x.mul(t,i);a=x.mul(a,k);let s=x.mul(n,r),c=x.sub(t,n),l=x.add(t,n),u=x.mul(s,l),d=x.eql(u,x.ZERO);a=x.cmov(a,x.ZERO,d),s=x.cmov(s,x.ONE,d),c=x.cmov(c,x.ONE,d),l=x.cmov(l,x.ONE,d);let[f,p]=(0,o.FpInvertBatch)(x,[s,l],!0);return{x:x.mul(a,f),y:x.mul(c,p)}}e.ed25519_hasher=(0,a.createHasher)(e.ed25519.Point,e=>A(e[0]),{DST:`edwards25519_XMD:SHA-512_ELL2_RO_`,encodeDST:`edwards25519_XMD:SHA-512_ELL2_NU_`,p:h,m:1,k:128,expand:`xmd`,hash:t.sha512});let j=y,M=BigInt(`25063068953384623474111414158702152701244531502492656460079210482610430750235`),N=BigInt(`54469307008909316920995813868745141605393597292927456921205312896311721017578`),P=BigInt(`1159843021668779879193775521855586647937357759715417654439879720876111806838`),F=BigInt(`40440834346308536858101042469323190826248399146238708352240133220865137265952`),I=e=>b(u,e),L=BigInt(`0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`),z=t=>e.ed25519.Point.Fp.create((0,c.bytesToNumberLE)(t)&L);function B(t){let{d:n}=g,r=h,i=e=>x.create(e),a=i(j*t*t),s=i((a+u)*P),c=BigInt(-1),l=i((c-n*a)*i(a+n)),{isValid:d,value:f}=b(s,l),p=i(f*t);(0,o.isNegativeLE)(p,r)||(p=i(-p)),d||(f=p),d||(c=a);let m=i(c*(a-u)*F-l),_=f*f,v=i((f+f)*l),y=i(m*M),S=i(u-_),C=i(u+_);return new e.ed25519.Point(i(v*C),i(S*y),i(y*C),i(v*S))}function J(e){(0,n.abytes)(e,64);let t=B(z(e.subarray(0,32))),r=B(z(e.subarray(32,64)));return new Y(t.add(r))}var Y=class t extends i.PrimeEdwardsPoint{constructor(e){super(e)}static fromAffine(n){return new t(e.ed25519.Point.fromAffine(n))}assertSame(e){if(!(e instanceof t))throw Error(`RistrettoPoint expected`)}init(e){return new t(e)}static hashToCurve(e){return J((0,c.ensureBytes)(`ristrettoHash`,e,64))}static fromBytes(r){(0,n.abytes)(r,32);let{a:i,d:a}=g,s=h,d=e=>x.create(e),f=z(r);if(!(0,c.equalBytes)(x.toBytes(f),r)||(0,o.isNegativeLE)(f,s))throw Error(`invalid ristretto255 encoding 1`);let p=d(f*f),m=d(u+i*p),_=d(u-i*p),v=d(m*m),y=d(_*_),b=d(i*a*v-y),{isValid:S,value:C}=I(d(b*y)),w=d(C*_),T=d(C*w*b),E=d((f+f)*w);(0,o.isNegativeLE)(E,s)&&(E=d(-E));let D=d(m*T),O=d(E*D);if(!S||(0,o.isNegativeLE)(O,s)||D===l)throw Error(`invalid ristretto255 encoding 2`);return new t(new e.ed25519.Point(E,D,u,O))}static fromHex(e){return t.fromBytes((0,c.ensureBytes)(`ristrettoHex`,e,32))}static msm(n,i){return(0,r.pippenger)(t,e.ed25519.Point.Fn,n,i)}toBytes(){let{X:e,Y:t,Z:n,T:r}=this.ep,i=h,a=e=>x.create(e),s=a(a(n+t)*a(n-t)),c=a(e*t),{value:l}=I(a(s*a(c*c))),u=a(l*s),d=a(l*c),f=a(u*d*r),p;if((0,o.isNegativeLE)(r*f,i)){let n=a(t*j),r=a(e*j);e=n,t=r,p=a(u*N)}else p=d;(0,o.isNegativeLE)(e*f,i)&&(t=a(-t));let m=a((n-t)*p);return(0,o.isNegativeLE)(m,i)&&(m=a(-m)),x.toBytes(m)}equals(e){this.assertSame(e);let{X:t,Y:n}=this.ep,{X:r,Y:i}=e.ep,a=e=>x.create(e),o=a(t*i)===a(n*r),s=a(n*i)===a(t*r);return o||s}is0(){return this.equals(t.ZERO)}};Y.BASE=new Y(e.ed25519.Point.BASE),Y.ZERO=new Y(e.ed25519.Point.ZERO),Y.Fp=x,Y.Fn=S,e.ristretto255={Point:Y},e.ristretto255_hasher={hashToCurve(e,n){let r=n?.DST||`ristretto255_XMD:SHA-512_R255MAP_RO_`;return J((0,a.expand_message_xmd)(e,r,64,t.sha512))},hashToScalar(e,n={DST:a._DST_scalar}){let r=(0,a.expand_message_xmd)(e,n.DST,64,t.sha512);return S.create((0,c.bytesToNumberLE)(r))}},e.ED25519_TORSION_SUBGROUP=[`0100000000000000000000000000000000000000000000000000000000000000`,`c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a`,`0000000000000000000000000000000000000000000000000000000000000080`,`26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05`,`ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f`,`26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85`,`0000000000000000000000000000000000000000000000000000000000000000`,`c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa`];function X(t){return e.ed25519.utils.toMontgomery((0,c.ensureBytes)(`pub`,t))}e.edwardsToMontgomery=X;function Z(t){return e.ed25519.utils.toMontgomerySecret((0,c.ensureBytes)(`pub`,t))}e.RistrettoPoint=Y,e.hashToCurve=e.ed25519_hasher.hashToCurve,e.encodeToCurve=e.ed25519_hasher.encodeToCurve,e.hashToRistretto255=e.ristretto255_hasher.hashToCurve,e.hash_to_ristretto255=e.ristretto255_hasher.hashToCurve})),Y=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hmac=e.HMAC=void 0;let t=R();var n=class extends t.Hash{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,(0,t.ahash)(e);let r=(0,t.toBytes)(n);if(this.iHash=e.create(),typeof this.iHash.update!=`function`)throw Error(`Expected instance of class which extends utils.Hash`);this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,a=new Uint8Array(i);a.set(r.length>i?e.create().update(r).digest():r);for(let e=0;e<a.length;e++)a[e]^=54;this.iHash.update(a),this.oHash=e.create();for(let e=0;e<a.length;e++)a[e]^=106;this.oHash.update(a),(0,t.clean)(a)}update(e){return(0,t.aexists)(this),this.iHash.update(e),this}digestInto(e){(0,t.aexists)(this),(0,t.abytes)(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:a,outputLen:o}=this;return e=e,e.finished=r,e.destroyed=i,e.blockLen=a,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};e.HMAC=n,e.hmac=(e,t,r)=>new n(e,t).update(r).digest(),e.hmac.create=(e,t)=>new n(e,t)})),X=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DER=e.DERErr=void 0,e._splitEndoScalar=s,e._normFnElement=g,e.weierstrassN=_,e.SWUFpSqrtRatio=y,e.mapToCurveSimpleSWU=b,e.ecdh=S,e.ecdsa=C,e.weierstrassPoints=w,e._legacyHelperEquat=D,e.weierstrass=A;
19
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
20
+ let t=Y(),n=R(),r=H(),i=W(),a=U(),o=(e,t)=>(e+(e>=0?t:-t)/p)/t;function s(e,t,n){let[[i,a],[s,c]]=t,l=o(c*e,n),u=o(-a*e,n),p=e-l*i-u*s,m=-l*a-u*c,h=p<d,g=m<d;h&&(p=-p),g&&(m=-m);let _=(0,r.bitMask)(Math.ceil((0,r.bitLen)(n)/2))+f;if(p<d||p>=_||m<d||m>=_)throw Error(`splitScalar (endomorphism): failed, k=`+e);return{k1neg:h,k1:p,k2neg:g,k2:m}}function c(e){if(![`compact`,`recovered`,`der`].includes(e))throw Error(`Signature format must be "compact", "recovered", or "der"`);return e}function l(e,t){let n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return(0,r._abool2)(n.lowS,`lowS`),(0,r._abool2)(n.prehash,`prehash`),n.format!==void 0&&c(n.format),n}var u=class extends Error{constructor(e=``){super(e)}};e.DERErr=u,e.DER={Err:u,_tlv:{encode:(t,n)=>{let{Err:i}=e.DER;if(t<0||t>256)throw new i(`tlv.encode: wrong tag`);if(n.length&1)throw new i(`tlv.encode: unpadded data`);let a=n.length/2,o=(0,r.numberToHexUnpadded)(a);if(o.length/2&128)throw new i(`tlv.encode: long form length too big`);let s=a>127?(0,r.numberToHexUnpadded)(o.length/2|128):``;return(0,r.numberToHexUnpadded)(t)+s+o+n},decode(t,n){let{Err:r}=e.DER,i=0;if(t<0||t>256)throw new r(`tlv.encode: wrong tag`);if(n.length<2||n[i++]!==t)throw new r(`tlv.decode: wrong tlv`);let a=n[i++],o=!!(a&128),s=0;if(!o)s=a;else{let e=a&127;if(!e)throw new r(`tlv.decode(long): indefinite length not supported`);if(e>4)throw new r(`tlv.decode(long): byte length is too big`);let t=n.subarray(i,i+e);if(t.length!==e)throw new r(`tlv.decode: length bytes not complete`);if(t[0]===0)throw new r(`tlv.decode(long): zero leftmost byte`);for(let e of t)s=s<<8|e;if(i+=e,s<128)throw new r(`tlv.decode(long): not minimal encoding`)}let c=n.subarray(i,i+s);if(c.length!==s)throw new r(`tlv.decode: wrong value length`);return{v:c,l:n.subarray(i+s)}}},_int:{encode(t){let{Err:n}=e.DER;if(t<d)throw new n(`integer: negative integers are not allowed`);let i=(0,r.numberToHexUnpadded)(t);if(Number.parseInt(i[0],16)&8&&(i=`00`+i),i.length&1)throw new n(`unexpected DER parsing assertion: unpadded hex`);return i},decode(t){let{Err:n}=e.DER;if(t[0]&128)throw new n(`invalid signature integer: negative`);if(t[0]===0&&!(t[1]&128))throw new n(`invalid signature integer: unnecessary leading zero`);return(0,r.bytesToNumberBE)(t)}},toSig(t){let{Err:n,_int:i,_tlv:a}=e.DER,o=(0,r.ensureBytes)(`signature`,t),{v:s,l:c}=a.decode(48,o);if(c.length)throw new n(`invalid signature: left bytes after parsing`);let{v:l,l:u}=a.decode(2,s),{v:d,l:f}=a.decode(2,u);if(f.length)throw new n(`invalid signature: left bytes after parsing`);return{r:i.decode(l),s:i.decode(d)}},hexFromSig(t){let{_tlv:n,_int:r}=e.DER,i=n.encode(2,r.encode(t.r))+n.encode(2,r.encode(t.s));return n.encode(48,i)}};let d=BigInt(0),f=BigInt(1),p=BigInt(2),m=BigInt(3),h=BigInt(4);function g(e,t){let{BYTES:n}=e,i;if(typeof t==`bigint`)i=t;else{let a=(0,r.ensureBytes)(`private key`,t);try{i=e.fromBytes(a)}catch{throw Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(i))throw Error(`invalid private key: out of range [1..N-1]`);return i}function _(e,t={}){let n=(0,i._createCurveFields)(`weierstrass`,e,t),{Fp:a,Fn:o}=n,c=n.CURVE,{h:l,n:u}=c;(0,r._validateObject)(t,{},{allowInfinityPoint:`boolean`,clearCofactor:`function`,isTorsionFree:`function`,fromBytes:`function`,toBytes:`function`,endo:`object`,wrapPrivateKey:`boolean`});let{endo:p}=t;if(p&&(!a.is0(c.a)||typeof p.beta!=`bigint`||!Array.isArray(p.basises)))throw Error(`invalid endo: expected "beta": bigint and "basises": array`);let _=x(a,o);function y(){if(!a.isOdd)throw Error(`compression is not supported: Field does not have .isOdd()`)}function b(e,t,n){let{x:i,y:o}=t.toAffine(),s=a.toBytes(i);if((0,r._abool2)(n,`isCompressed`),n){y();let e=!a.isOdd(o);return(0,r.concatBytes)(v(e),s)}else return(0,r.concatBytes)(Uint8Array.of(4),s,a.toBytes(o))}function S(e){(0,r._abytes2)(e,void 0,`Point`);let{publicKey:t,publicKeyUncompressed:n}=_,i=e.length,o=e[0],s=e.subarray(1);if(i===t&&(o===2||o===3)){let e=a.fromBytes(s);if(!a.isValid(e))throw Error(`bad point: is not on curve, wrong x`);let t=T(e),n;try{n=a.sqrt(t)}catch(e){let t=e instanceof Error?`: `+e.message:``;throw Error(`bad point: is not on curve, sqrt error`+t)}y();let r=a.isOdd(n);return(o&1)==1!==r&&(n=a.neg(n)),{x:e,y:n}}else if(i===n&&o===4){let e=a.BYTES,t=a.fromBytes(s.subarray(0,e)),n=a.fromBytes(s.subarray(e,e*2));if(!E(t,n))throw Error(`bad point: is not on curve`);return{x:t,y:n}}else throw Error(`bad point: got length ${i}, expected compressed=${t} or uncompressed=${n}`)}let C=t.toBytes||b,w=t.fromBytes||S;function T(e){let t=a.sqr(e),n=a.mul(t,e);return a.add(a.add(n,a.mul(e,c.a)),c.b)}function E(e,t){let n=a.sqr(t),r=T(e);return a.eql(n,r)}if(!E(c.Gx,c.Gy))throw Error(`bad curve params: generator point`);let D=a.mul(a.pow(c.a,m),h),O=a.mul(a.sqr(c.b),BigInt(27));if(a.is0(a.add(D,O)))throw Error(`bad curve params: a or b`);function k(e,t,n=!1){if(!a.isValid(t)||n&&a.is0(t))throw Error(`bad point coordinate ${e}`);return t}function A(e){if(!(e instanceof F))throw Error(`ProjectivePoint expected`)}function j(e){if(!p||!p.basises)throw Error(`no endo`);return s(e,p.basises,o.ORDER)}let M=(0,r.memoized)((e,t)=>{let{X:n,Y:r,Z:i}=e;if(a.eql(i,a.ONE))return{x:n,y:r};let o=e.is0();t??=o?a.ONE:a.inv(i);let s=a.mul(n,t),c=a.mul(r,t),l=a.mul(i,t);if(o)return{x:a.ZERO,y:a.ZERO};if(!a.eql(l,a.ONE))throw Error(`invZ was invalid`);return{x:s,y:c}}),N=(0,r.memoized)(e=>{if(e.is0()){if(t.allowInfinityPoint&&!a.is0(e.Y))return;throw Error(`bad point: ZERO`)}let{x:n,y:r}=e.toAffine();if(!a.isValid(n)||!a.isValid(r))throw Error(`bad point: x or y not field elements`);if(!E(n,r))throw Error(`bad point: equation left != right`);if(!e.isTorsionFree())throw Error(`bad point: not in prime-order subgroup`);return!0});function P(e,t,n,r,o){return n=new F(a.mul(n.X,e),n.Y,n.Z),t=(0,i.negateCt)(r,t),n=(0,i.negateCt)(o,n),t.add(n)}class F{constructor(e,t,n){this.X=k(`x`,e),this.Y=k(`y`,t,!0),this.Z=k(`z`,n),Object.freeze(this)}static CURVE(){return c}static fromAffine(e){let{x:t,y:n}=e||{};if(!e||!a.isValid(t)||!a.isValid(n))throw Error(`invalid affine point`);if(e instanceof F)throw Error(`projective point not allowed`);return a.is0(t)&&a.is0(n)?F.ZERO:new F(t,n,a.ONE)}static fromBytes(e){let t=F.fromAffine(w((0,r._abytes2)(e,void 0,`point`)));return t.assertValidity(),t}static fromHex(e){return F.fromBytes((0,r.ensureBytes)(`pointHex`,e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return L.createCache(this,e),t||this.multiply(m),this}assertValidity(){N(this)}hasEvenY(){let{y:e}=this.toAffine();if(!a.isOdd)throw Error(`Field doesn't support isOdd`);return!a.isOdd(e)}equals(e){A(e);let{X:t,Y:n,Z:r}=this,{X:i,Y:o,Z:s}=e,c=a.eql(a.mul(t,s),a.mul(i,r)),l=a.eql(a.mul(n,s),a.mul(o,r));return c&&l}negate(){return new F(this.X,a.neg(this.Y),this.Z)}double(){let{a:e,b:t}=c,n=a.mul(t,m),{X:r,Y:i,Z:o}=this,s=a.ZERO,l=a.ZERO,u=a.ZERO,d=a.mul(r,r),f=a.mul(i,i),p=a.mul(o,o),h=a.mul(r,i);return h=a.add(h,h),u=a.mul(r,o),u=a.add(u,u),s=a.mul(e,u),l=a.mul(n,p),l=a.add(s,l),s=a.sub(f,l),l=a.add(f,l),l=a.mul(s,l),s=a.mul(h,s),u=a.mul(n,u),p=a.mul(e,p),h=a.sub(d,p),h=a.mul(e,h),h=a.add(h,u),u=a.add(d,d),d=a.add(u,d),d=a.add(d,p),d=a.mul(d,h),l=a.add(l,d),p=a.mul(i,o),p=a.add(p,p),d=a.mul(p,h),s=a.sub(s,d),u=a.mul(p,f),u=a.add(u,u),u=a.add(u,u),new F(s,l,u)}add(e){A(e);let{X:t,Y:n,Z:r}=this,{X:i,Y:o,Z:s}=e,l=a.ZERO,u=a.ZERO,d=a.ZERO,f=c.a,p=a.mul(c.b,m),h=a.mul(t,i),g=a.mul(n,o),_=a.mul(r,s),v=a.add(t,n),y=a.add(i,o);v=a.mul(v,y),y=a.add(h,g),v=a.sub(v,y),y=a.add(t,r);let b=a.add(i,s);return y=a.mul(y,b),b=a.add(h,_),y=a.sub(y,b),b=a.add(n,r),l=a.add(o,s),b=a.mul(b,l),l=a.add(g,_),b=a.sub(b,l),d=a.mul(f,y),l=a.mul(p,_),d=a.add(l,d),l=a.sub(g,d),d=a.add(g,d),u=a.mul(l,d),g=a.add(h,h),g=a.add(g,h),_=a.mul(f,_),y=a.mul(p,y),g=a.add(g,_),_=a.sub(h,_),_=a.mul(f,_),y=a.add(y,_),h=a.mul(g,y),u=a.add(u,h),h=a.mul(b,y),l=a.mul(v,l),l=a.sub(l,h),h=a.mul(v,g),d=a.mul(b,d),d=a.add(d,h),new F(l,u,d)}subtract(e){return this.add(e.negate())}is0(){return this.equals(F.ZERO)}multiply(e){let{endo:n}=t;if(!o.isValidNot0(e))throw Error(`invalid scalar: out of range`);let r,a,s=e=>L.cached(this,e,e=>(0,i.normalizeZ)(F,e));if(n){let{k1neg:t,k1:i,k2neg:o,k2:c}=j(e),{p:l,f:u}=s(i),{p:d,f}=s(c);a=u.add(f),r=P(n.beta,l,d,t,o)}else{let{p:t,f:n}=s(e);r=t,a=n}return(0,i.normalizeZ)(F,[r,a])[0]}multiplyUnsafe(e){let{endo:n}=t,r=this;if(!o.isValid(e))throw Error(`invalid scalar: out of range`);if(e===d||r.is0())return F.ZERO;if(e===f)return r;if(L.hasCache(this))return this.multiply(e);if(n){let{k1neg:t,k1:a,k2neg:o,k2:s}=j(e),{p1:c,p2:l}=(0,i.mulEndoUnsafe)(F,r,a,s);return P(n.beta,c,l,t,o)}else return L.unsafe(r,e)}multiplyAndAddUnsafe(e,t,n){let r=this.multiplyUnsafe(t).add(e.multiplyUnsafe(n));return r.is0()?void 0:r}toAffine(e){return M(this,e)}isTorsionFree(){let{isTorsionFree:e}=t;return l===f?!0:e?e(F,this):L.unsafe(this,u).is0()}clearCofactor(){let{clearCofactor:e}=t;return l===f?this:e?e(F,this):this.multiplyUnsafe(l)}isSmallOrder(){return this.multiplyUnsafe(l).is0()}toBytes(e=!0){return(0,r._abool2)(e,`isCompressed`),this.assertValidity(),C(F,this,e)}toHex(e=!0){return(0,r.bytesToHex)(this.toBytes(e))}toString(){return`<Point ${this.is0()?`ZERO`:this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(e=!0){return this.toBytes(e)}_setWindowSize(e){this.precompute(e)}static normalizeZ(e){return(0,i.normalizeZ)(F,e)}static msm(e,t){return(0,i.pippenger)(F,o,e,t)}static fromPrivateKey(e){return F.BASE.multiply(g(o,e))}}F.BASE=new F(c.Gx,c.Gy,a.ONE),F.ZERO=new F(a.ZERO,a.ONE,a.ZERO),F.Fp=a,F.Fn=o;let I=o.BITS,L=new i.wNAF(F,t.endo?Math.ceil(I/2):I);return F.BASE.precompute(8),F}function v(e){return Uint8Array.of(e?2:3)}function y(e,t){let n=e.ORDER,r=d;for(let e=n-f;e%p===d;e/=p)r+=f;let i=r,a=p<<i-f-f,o=a*p,s=(n-f)/o,c=(s-f)/p,l=o-f,u=a,g=e.pow(t,s),_=e.pow(t,(s+f)/p),v=(t,n)=>{let r=g,a=e.pow(n,l),o=e.sqr(a);o=e.mul(o,n);let s=e.mul(t,o);s=e.pow(s,c),s=e.mul(s,a),a=e.mul(s,n),o=e.mul(s,t);let d=e.mul(o,a);s=e.pow(d,u);let m=e.eql(s,e.ONE);a=e.mul(o,_),s=e.mul(d,r),o=e.cmov(a,o,m),d=e.cmov(s,d,m);for(let t=i;t>f;t--){let n=t-p;n=p<<n-f;let i=e.pow(d,n),s=e.eql(i,e.ONE);a=e.mul(o,r),r=e.mul(r,r),i=e.mul(d,r),o=e.cmov(a,o,s),d=e.cmov(i,d,s)}return{isValid:m,value:o}};if(e.ORDER%h===m){let n=(e.ORDER-m)/h,r=e.sqrt(e.neg(t));v=(t,i)=>{let a=e.sqr(i),o=e.mul(t,i);a=e.mul(a,o);let s=e.pow(a,n);s=e.mul(s,o);let c=e.mul(s,r),l=e.mul(e.sqr(s),i),u=e.eql(l,t);return{isValid:u,value:e.cmov(c,s,u)}}}return v}function b(e,t){(0,a.validateField)(e);let{A:n,B:r,Z:i}=t;if(!e.isValid(n)||!e.isValid(r)||!e.isValid(i))throw Error(`mapToCurveSimpleSWU: invalid opts`);let o=y(e,i);if(!e.isOdd)throw Error(`Field does not have .isOdd()`);return t=>{let s,c,l,u,d,f,p,m;s=e.sqr(t),s=e.mul(s,i),c=e.sqr(s),c=e.add(c,s),l=e.add(c,e.ONE),l=e.mul(l,r),u=e.cmov(i,e.neg(c),!e.eql(c,e.ZERO)),u=e.mul(u,n),c=e.sqr(l),f=e.sqr(u),d=e.mul(f,n),c=e.add(c,d),c=e.mul(c,l),f=e.mul(f,u),d=e.mul(f,r),c=e.add(c,d),p=e.mul(s,l);let{isValid:h,value:g}=o(c,f);m=e.mul(s,t),m=e.mul(m,g),p=e.cmov(p,l,h),m=e.cmov(m,g,h);let _=e.isOdd(t)===e.isOdd(m);m=e.cmov(e.neg(m),m,_);let v=(0,a.FpInvertBatch)(e,[u],!0)[0];return p=e.mul(p,v),{x:p,y:m}}}function x(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function S(e,t={}){let{Fn:n}=e,i=t.randomBytes||r.randomBytes,o=Object.assign(x(e.Fp,n),{seed:(0,a.getMinHashLength)(n.ORDER)});function s(e){try{return!!g(n,e)}catch{return!1}}function c(t,n){let{publicKey:r,publicKeyUncompressed:i}=o;try{let a=t.length;return n===!0&&a!==r||n===!1&&a!==i?!1:!!e.fromBytes(t)}catch{return!1}}function l(e=i(o.seed)){return(0,a.mapHashToField)((0,r._abytes2)(e,o.seed,`seed`),n.ORDER)}function u(t,r=!0){return e.BASE.multiply(g(n,t)).toBytes(r)}function d(e){let t=l(e);return{secretKey:t,publicKey:u(t)}}function f(t){if(typeof t==`bigint`)return!1;if(t instanceof e)return!0;let{secretKey:i,publicKey:a,publicKeyUncompressed:s}=o;if(n.allowedLengths||i===a)return;let c=(0,r.ensureBytes)(`key`,t).length;return c===a||c===s}function p(t,r,i=!0){if(f(t)===!0)throw Error(`first arg must be private key`);if(f(r)===!1)throw Error(`second arg must be public key`);let a=g(n,t);return e.fromHex(r).multiply(a).toBytes(i)}return Object.freeze({getPublicKey:u,getSharedSecret:p,keygen:d,Point:e,utils:{isValidSecretKey:s,isValidPublicKey:c,randomSecretKey:l,isValidPrivateKey:s,randomPrivateKey:l,normPrivateKeyToScalar:e=>g(n,e),precompute(t=8,n=e.BASE){return n.precompute(t,!1)}},lengths:o})}function C(i,a,o={}){(0,n.ahash)(a),(0,r._validateObject)(o,{},{hmac:`function`,lowS:`boolean`,randomBytes:`function`,bits2int:`function`,bits2int_modN:`function`});let s=o.randomBytes||r.randomBytes,u=o.hmac||((e,...n)=>(0,t.hmac)(a,e,(0,r.concatBytes)(...n))),{Fp:m,Fn:h}=i,{ORDER:_,BITS:y}=h,{keygen:b,getPublicKey:x,getSharedSecret:C,utils:w,lengths:T}=S(i,o),E={prehash:!1,lowS:typeof o.lowS==`boolean`?o.lowS:!1,format:void 0,extraEntropy:!1},D=`compact`;function O(e){return e>_>>f}function k(e,t){if(!h.isValidNot0(t))throw Error(`invalid signature ${e}: out of range 1..Point.Fn.ORDER`);return t}function A(e,t){c(t);let n=T.signature,i=t===`compact`?n:t===`recovered`?n+1:void 0;return(0,r._abytes2)(e,i,`${t} signature`)}class j{constructor(e,t,n){this.r=k(`r`,e),this.s=k(`s`,t),n!=null&&(this.recovery=n),Object.freeze(this)}static fromBytes(t,n=D){A(t,n);let i;if(n===`der`){let{r:n,s:i}=e.DER.toSig((0,r._abytes2)(t));return new j(n,i)}n===`recovered`&&(i=t[0],n=`compact`,t=t.subarray(1));let a=h.BYTES,o=t.subarray(0,a),s=t.subarray(a,a*2);return new j(h.fromBytes(o),h.fromBytes(s),i)}static fromHex(e,t){return this.fromBytes((0,r.hexToBytes)(e),t)}addRecoveryBit(e){return new j(this.r,this.s,e)}recoverPublicKey(e){let t=m.ORDER,{r:n,s:a,recovery:o}=this;if(o==null||![0,1,2,3].includes(o))throw Error(`recovery id invalid`);if(_*p<t&&o>1)throw Error(`recovery id is ambiguous for h>1 curve`);let s=o===2||o===3?n+_:n;if(!m.isValid(s))throw Error(`recovery id 2 or 3 invalid`);let c=m.toBytes(s),l=i.fromBytes((0,r.concatBytes)(v((o&1)==0),c)),u=h.inv(s),d=N((0,r.ensureBytes)(`msgHash`,e)),f=h.create(-d*u),g=h.create(a*u),y=i.BASE.multiplyUnsafe(f).add(l.multiplyUnsafe(g));if(y.is0())throw Error(`point at infinify`);return y.assertValidity(),y}hasHighS(){return O(this.s)}toBytes(t=D){if(c(t),t===`der`)return(0,r.hexToBytes)(e.DER.hexFromSig(this));let n=h.toBytes(this.r),i=h.toBytes(this.s);if(t===`recovered`){if(this.recovery==null)throw Error(`recovery bit must be present`);return(0,r.concatBytes)(Uint8Array.of(this.recovery),n,i)}return(0,r.concatBytes)(n,i)}toHex(e){return(0,r.bytesToHex)(this.toBytes(e))}assertValidity(){}static fromCompact(e){return j.fromBytes((0,r.ensureBytes)(`sig`,e),`compact`)}static fromDER(e){return j.fromBytes((0,r.ensureBytes)(`sig`,e),`der`)}normalizeS(){return this.hasHighS()?new j(this.r,h.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes(`der`)}toDERHex(){return(0,r.bytesToHex)(this.toBytes(`der`))}toCompactRawBytes(){return this.toBytes(`compact`)}toCompactHex(){return(0,r.bytesToHex)(this.toBytes(`compact`))}}let M=o.bits2int||function(e){if(e.length>8192)throw Error(`input is too large`);let t=(0,r.bytesToNumberBE)(e),n=e.length*8-y;return n>0?t>>BigInt(n):t},N=o.bits2int_modN||function(e){return h.create(M(e))},P=(0,r.bitMask)(y);function F(e){return(0,r.aInRange)(`num < 2^`+y,e,d,P),h.toBytes(e)}function I(e,t){return(0,r._abytes2)(e,void 0,`message`),t?(0,r._abytes2)(a(e),void 0,`prehashed message`):e}function L(e,t,n){if([`recovered`,`canonical`].some(e=>e in n))throw Error(`sign() legacy options not supported`);let{lowS:a,prehash:o,extraEntropy:c}=l(n,E);e=I(e,o);let u=N(e),p=g(h,t),m=[F(p),F(u)];if(c!=null&&c!==!1){let e=c===!0?s(T.secretKey):c;m.push((0,r.ensureBytes)(`extraEntropy`,e))}let _=(0,r.concatBytes)(...m),v=u;function y(e){let t=M(e);if(!h.isValidNot0(t))return;let n=h.inv(t),r=i.BASE.multiply(t).toAffine(),o=h.create(r.x);if(o===d)return;let s=h.create(n*h.create(v+o*p));if(s===d)return;let c=(r.x===o?0:2)|Number(r.y&f),l=s;return a&&O(s)&&(l=h.neg(s),c^=1),new j(o,l,c)}return{seed:_,k2sig:y}}function R(e,t,n={}){e=(0,r.ensureBytes)(`message`,e);let{seed:i,k2sig:o}=L(e,t,n);return(0,r.createHmacDrbg)(a.outputLen,h.BYTES,u)(i,o)}function z(t){let n,i=typeof t==`string`||(0,r.isBytes)(t),a=!i&&typeof t==`object`&&!!t&&typeof t.r==`bigint`&&typeof t.s==`bigint`;if(!i&&!a)throw Error(`invalid signature, expected Uint8Array, hex string or Signature instance`);if(a)n=new j(t.r,t.s);else if(i){try{n=j.fromBytes((0,r.ensureBytes)(`sig`,t),`der`)}catch(t){if(!(t instanceof e.DER.Err))throw t}if(!n)try{n=j.fromBytes((0,r.ensureBytes)(`sig`,t),`compact`)}catch{return!1}}return n||!1}function B(e,t,n,a={}){let{lowS:o,prehash:s,format:c}=l(a,E);if(n=(0,r.ensureBytes)(`publicKey`,n),t=I((0,r.ensureBytes)(`message`,t),s),`strict`in a)throw Error(`options.strict was renamed to lowS`);let u=c===void 0?z(e):j.fromBytes((0,r.ensureBytes)(`sig`,e),c);if(u===!1)return!1;try{let e=i.fromBytes(n);if(o&&u.hasHighS())return!1;let{r,s:a}=u,s=N(t),c=h.inv(a),l=h.create(s*c),d=h.create(r*c),f=i.BASE.multiplyUnsafe(l).add(e.multiplyUnsafe(d));return f.is0()?!1:h.create(f.x)===r}catch{return!1}}function V(e,t,n={}){let{prehash:r}=l(n,E);return t=I(t,r),j.fromBytes(e,`recovered`).recoverPublicKey(t).toBytes()}return Object.freeze({keygen:b,getPublicKey:x,getSharedSecret:C,utils:w,lengths:T,Point:i,sign:R,verify:B,recoverPublicKey:V,Signature:j,hash:a})}function w(e){let{CURVE:t,curveOpts:n}=T(e);return O(e,_(t,n))}function T(e){let t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp,r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(e=>Math.ceil(e/2)))):void 0;return{CURVE:t,curveOpts:{Fp:n,Fn:(0,a.Field)(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes}}}function E(e){let{CURVE:t,curveOpts:n}=T(e),r={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,hash:e.hash,ecdsaOpts:r}}function D(e,t,n){function r(r){let i=e.sqr(r),a=e.mul(i,r);return e.add(e.add(a,e.mul(r,t)),n)}return r}function O(e,t){let{Fp:n,Fn:i}=t;function a(e){return(0,r.inRange)(e,f,i.ORDER)}let o=D(n,e.a,e.b);return Object.assign({},{CURVE:e,Point:t,ProjectivePoint:t,normPrivateKeyToScalar:e=>g(i,e),weierstrassEquation:o,isWithinCurveOrder:a})}function k(e,t){let n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,(0,a.nLength)(n.Fn.ORDER,n.Fn.BITS))})}function A(e){let{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:i}=E(e);return k(e,C(_(t,n),r,i))}})),Z=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getHash=n,e.createCurve=r;
21
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
22
+ let t=X();function n(e){return{hash:e}}function r(e,n){let r=n=>(0,t.weierstrass)({...e,hash:n});return{...r(n),create:r}}})),Q=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.encodeToCurve=e.hashToCurve=e.secp256k1_hasher=e.schnorr=e.secp256k1=void 0;
23
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
24
+ let t=V(),n=R(),r=Z(),i=K(),a=U(),o=X(),s=H(),c={p:BigInt(`0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f`),n:BigInt(`0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141`),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt(`0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798`),Gy:BigInt(`0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8`)},l={beta:BigInt(`0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee`),basises:[[BigInt(`0x3086d221a7d46bcde86c90e49284eb15`),-BigInt(`0xe4437ed6010e88286f547fa90abfe4c3`)],[BigInt(`0x114ca50f7a8e2f3f657c1108d9d44cfd8`),BigInt(`0x3086d221a7d46bcde86c90e49284eb15`)]]},u=BigInt(0),d=BigInt(1),f=BigInt(2);function p(e){let t=c.p,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),l=BigInt(44),u=BigInt(88),d=e*e*e%t,p=d*d*e%t,h=(0,a.pow2)(p,n,t)*p%t,g=(0,a.pow2)(h,n,t)*p%t,_=(0,a.pow2)(g,f,t)*d%t,v=(0,a.pow2)(_,i,t)*_%t,y=(0,a.pow2)(v,o,t)*v%t,b=(0,a.pow2)(y,l,t)*y%t,x=(0,a.pow2)(b,u,t)*b%t,S=(0,a.pow2)(x,l,t)*y%t,C=(0,a.pow2)(S,n,t)*p%t,w=(0,a.pow2)(C,s,t)*v%t,T=(0,a.pow2)(w,r,t)*d%t,E=(0,a.pow2)(T,f,t);if(!m.eql(m.sqr(E),e))throw Error(`Cannot find square root`);return E}let m=(0,a.Field)(c.p,{sqrt:p});e.secp256k1=(0,r.createCurve)({...c,Fp:m,lowS:!0,endo:l},t.sha256);let h={};function g(e,...n){let r=h[e];if(r===void 0){let n=(0,t.sha256)((0,s.utf8ToBytes)(e));r=(0,s.concatBytes)(n,n),h[e]=r}return(0,t.sha256)((0,s.concatBytes)(r,...n))}let _=e=>e.toBytes(!0).slice(1),v=e.secp256k1.Point,y=e=>e%f===u;function b(e){let{Fn:t,BASE:n}=v,r=(0,o._normFnElement)(t,e),i=n.multiply(r);return{scalar:y(i.y)?r:t.neg(r),bytes:_(i)}}function x(e){let t=m;if(!t.isValidNot0(e))throw Error(`invalid x: Fail if x ≥ p`);let n=t.create(e*e),r=t.create(n*e+BigInt(7)),i=t.sqrt(r);y(i)||(i=t.neg(i));let a=v.fromAffine({x:e,y:i});return a.assertValidity(),a}let S=s.bytesToNumberBE;function C(...e){return v.Fn.create(S(g(`BIP0340/challenge`,...e)))}function w(e){return b(e).bytes}function T(e,t,r=(0,n.randomBytes)(32)){let{Fn:i}=v,a=(0,s.ensureBytes)(`message`,e),{bytes:o,scalar:c}=b(t),l=(0,s.ensureBytes)(`auxRand`,r,32),{bytes:u,scalar:d}=b(g(`BIP0340/nonce`,i.toBytes(c^S(g(`BIP0340/aux`,l))),o,a)),f=C(u,o,a),p=new Uint8Array(64);if(p.set(u,0),p.set(i.toBytes(i.create(d+f*c)),32),!E(p,a,o))throw Error(`sign: Invalid signature produced`);return p}function E(e,t,n){let{Fn:r,BASE:i}=v,a=(0,s.ensureBytes)(`signature`,e,64),o=(0,s.ensureBytes)(`message`,t),l=(0,s.ensureBytes)(`publicKey`,n,32);try{let e=x(S(l)),t=S(a.subarray(0,32));if(!(0,s.inRange)(t,d,c.p))return!1;let n=S(a.subarray(32,64));if(!(0,s.inRange)(n,d,c.n))return!1;let u=C(r.toBytes(t),_(e),o),f=i.multiplyUnsafe(n).add(e.multiplyUnsafe(r.neg(u))),{x:p,y:m}=f.toAffine();return!(f.is0()||!y(m)||p!==t)}catch{return!1}}e.schnorr=(()=>{let t=(e=(0,n.randomBytes)(48))=>(0,a.mapHashToField)(e,c.n);e.secp256k1.utils.randomSecretKey;function r(e){let n=t(e);return{secretKey:n,publicKey:w(n)}}return{keygen:r,getPublicKey:w,sign:T,verify:E,Point:v,utils:{randomSecretKey:t,randomPrivateKey:t,taggedHash:g,lift_x:x,pointToBytes:_,numberToBytesBE:s.numberToBytesBE,bytesToNumberBE:s.bytesToNumberBE,mod:a.mod},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:64,seed:48}}})();let D=(0,i.isogenyMap)(m,[[`0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7`,`0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581`,`0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262`,`0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c`],[`0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b`,`0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14`,`0x0000000000000000000000000000000000000000000000000000000000000001`],[`0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c`,`0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3`,`0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931`,`0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84`],[`0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b`,`0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573`,`0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f`,`0x0000000000000000000000000000000000000000000000000000000000000001`]].map(e=>e.map(e=>BigInt(e)))),O=(0,o.mapToCurveSimpleSWU)(m,{A:BigInt(`0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533`),B:BigInt(`1771`),Z:m.create(BigInt(`-11`))});e.secp256k1_hasher=(0,i.createHasher)(e.secp256k1.Point,e=>{let{x:t,y:n}=O(m.create(e[0]));return D(t,n)},{DST:`secp256k1_XMD:SHA-256_SSWU_RO_`,encodeDST:`secp256k1_XMD:SHA-256_SSWU_NU_`,p:m.ORDER,m:1,k:128,expand:`xmd`,hash:t.sha256}),e.hashToCurve=e.secp256k1_hasher.hashToCurve,e.encodeToCurve=e.secp256k1_hasher.encodeToCurve})),ee=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.decodeHex=e.remove0x=void 0;var t=M();e.remove0x=function(e){return e.startsWith(`0x`)||e.startsWith(`0X`)?e.slice(2):e},e.decodeHex=function(n){return(0,t.hexToBytes)((0,e.remove0x)(n))}})),te=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hexToPublicKey=e.convertPublicKeyFormat=e.getSharedPoint=e.getPublicKey=e.isValidPrivateKey=e.getValidSecret=void 0;var t=I(),n=J(),r=Q(),i=P(),a=N(),o=ee();e.getValidSecret=function(n){var r;do r=(0,t.randomBytes)(a.SECRET_KEY_LENGTH);while(!(0,e.isValidPrivateKey)(r,n));return r},e.isValidPrivateKey=function(e,t){return s(t,function(t){return t.utils.isValidSecretKey(e)},function(){return!0},function(){return!0})},e.getPublicKey=function(e,t){return s(t,function(t){return t.getPublicKey(e)},function(t){return t.getPublicKey(e)},function(t){return t.getPublicKey(e)})},e.getSharedPoint=function(e,t,n,r){return s(r,function(r){return r.getSharedSecret(e,t,n)},function(n){return n.getSharedSecret(e,t)},function(n){return l(n,e,t)})},e.convertPublicKeyFormat=function(e,t,n){return s(n,function(n){return n.getSharedSecret(Uint8Array.from(Array(31).fill(0).concat([1])),e,t)},function(){return e},function(){return e})},e.hexToPublicKey=function(e,t){var n=(0,o.decodeHex)(e);return s(t,function(){return c(n)},function(){return n},function(){return n})};function s(e,t,a,o){var s=e||(0,i.ellipticCurve)();if(s===`secp256k1`)return t(r.secp256k1);if(s===`x25519`)return a(n.x25519);if(s===`ed25519`)return o(n.ed25519);throw Error(`Not implemented`)}var c=function(e){if(e.length===a.ETH_PUBLIC_KEY_SIZE){var t=new Uint8Array(1+e.length);return t.set([4]),t.set(e,1),t}return e},l=function(e,t,n){var r=e.utils.getExtendedPublicKey(t).scalar;return e.Point.fromBytes(n).multiply(r).toBytes()}})),ne=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hkdf=void 0,e.extract=r,e.expand=o;let t=Y(),n=R();function r(e,r,i){return(0,n.ahash)(e),i===void 0&&(i=new Uint8Array(e.outputLen)),(0,t.hmac)(e,(0,n.toBytes)(i),(0,n.toBytes)(r))}let i=Uint8Array.from([0]),a=Uint8Array.of();function o(e,r,o,s=32){(0,n.ahash)(e),(0,n.anumber)(s);let c=e.outputLen;if(s>255*c)throw Error(`Length should be <= 255*HashLen`);let l=Math.ceil(s/c);o===void 0&&(o=a);let u=new Uint8Array(l*c),d=t.hmac.create(e,r),f=d._cloneInto(),p=new Uint8Array(d.outputLen);for(let e=0;e<l;e++)i[0]=e+1,f.update(e===0?a:p).update(o).update(i).digestInto(p),u.set(p,c*e),d._cloneInto(f);return d.destroy(),f.destroy(),(0,n.clean)(p,i),u.slice(0,s)}e.hkdf=(e,t,n,i,a)=>o(e,r(e,t,n),i,a)})),re=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getSharedKey=e.deriveKey=void 0;var t=M(),n=ne(),r=V();e.deriveKey=function(e,t,i){return(0,n.hkdf)(r.sha256,e,t,i,32)},e.getSharedKey=function(){var n=[...arguments];return(0,e.deriveKey)(t.concatBytes.apply(void 0,n))}})),ie=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e._compat=void 0;var t=M(),n=c(`node:crypto`),r=16,i=globalThis.Deno!==void 0;e._compat=function(e,a,o,s){var c=e===`aes-256-gcm`||e===`chacha20-poly1305`,l=c?r:0,u=c?{authTagLength:l}:void 0;return{encrypt:function(r){var i=(0,n.createCipheriv)(e,a,o,u);c&&s!==void 0&&i.setAAD(s);var l=i.update(r),d=i.final(),f=c?i.getAuthTag():new Uint8Array;return(0,t.concatBytes)(l,d,f)},decrypt:function(r){var d=r.subarray(0,r.length-l),f=r.subarray(r.length-l),p=(0,n.createDecipheriv)(e,a,o,u);c&&(s!==void 0&&p.setAAD(s),p.setAuthTag(f)),!c&&i&&p.setAutoPadding(!1);var m=p.update(d),h=p.final();return(0,t.concatBytes)(m,h)}}}})),ae=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.aes256cbc=e.aes256gcm=void 0;var t=ie();e.aes256gcm=function(e,n,r){return(0,t._compat)(`aes-256-gcm`,e,n,r)},e.aes256cbc=function(e,n,r){return(0,t._compat)(`aes-256-cbc`,e,n)}})),oe=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e._hchacha20=void 0,e._hchacha20=function(e,n,r,i){for(var a=e[0],o=e[1],s=e[2],c=e[3],l=n[0],u=n[1],d=n[2],f=n[3],p=n[4],m=n[5],h=n[6],g=n[7],_=r[0],v=r[1],y=r[2],b=r[3],x=0;x<20;x+=2)a=a+l|0,_=t(_^a,16),p=p+_|0,l=t(l^p,12),a=a+l|0,_=t(_^a,8),p=p+_|0,l=t(l^p,7),o=o+u|0,v=t(v^o,16),m=m+v|0,u=t(u^m,12),o=o+u|0,v=t(v^o,8),m=m+v|0,u=t(u^m,7),s=s+d|0,y=t(y^s,16),h=h+y|0,d=t(d^h,12),s=s+d|0,y=t(y^s,8),h=h+y|0,d=t(d^h,7),c=c+f|0,b=t(b^c,16),g=g+b|0,f=t(f^g,12),c=c+f|0,b=t(b^c,8),g=g+b|0,f=t(f^g,7),a=a+u|0,b=t(b^a,16),h=h+b|0,u=t(u^h,12),a=a+u|0,b=t(b^a,8),h=h+b|0,u=t(u^h,7),o=o+d|0,_=t(_^o,16),g=g+_|0,d=t(d^g,12),o=o+d|0,_=t(_^o,8),g=g+_|0,d=t(d^g,7),s=s+f|0,v=t(v^s,16),p=p+v|0,f=t(f^p,12),s=s+f|0,v=t(v^s,8),p=p+v|0,f=t(f^p,7),c=c+l|0,y=t(y^c,16),m=m+y|0,l=t(l^m,12),c=c+l|0,y=t(y^c,8),m=m+y|0,l=t(l^m,7);var S=0;i[S++]=a,i[S++]=o,i[S++]=s,i[S++]=c,i[S++]=_,i[S++]=v,i[S++]=y,i[S++]=b};var t=function(e,t){return e<<t|e>>>32-t}})),se=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.chacha20=e.xchacha20=void 0;var t=M(),n=ie(),r=oe();e.xchacha20=function(e,i,a){if(i.length!==24)throw Error(`xchacha20's nonce must be 24 bytes`);var o=new Uint32Array([1634760805,857760878,2036477234,1797285236]),s=new Uint32Array(8);(0,r._hchacha20)(o,(0,t.u32)(e),(0,t.u32)(i.subarray(0,16)),s);var c=new Uint8Array(12);return c.set([0,0,0,0]),c.set(i.subarray(16),4),(0,n._compat)(`chacha20-poly1305`,(0,t.u8)(s),c,a)},e.chacha20=function(e,t,r){if(t.length!==12)throw Error(`chacha20's nonce must be 12 bytes`);return(0,n._compat)(`chacha20-poly1305`,e,t,r)}})),ce=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.aesDecrypt=e.aesEncrypt=e.symDecrypt=e.symEncrypt=void 0;var t=ae(),n=se(),r=M(),i=I(),a=P(),o=N();e.symEncrypt=function(e,t,n){return s(c,e,t,n)},e.symDecrypt=function(e,t,n){return s(l,e,t,n)},e.aesEncrypt=e.symEncrypt,e.aesDecrypt=e.symDecrypt;function s(e,r,i,s){var c=(0,a.symmetricAlgorithm)();if(c===`aes-256-gcm`)return e(t.aes256gcm,r,i,(0,a.symmetricNonceLength)(),o.AEAD_TAG_LENGTH,s);if(c===`xchacha20`)return e(n.xchacha20,r,i,o.XCHACHA20_NONCE_LENGTH,o.AEAD_TAG_LENGTH,s);if(c===`aes-256-cbc`)return e(t.aes256cbc,r,i,16,0);throw Error(`Not implemented`)}function c(e,t,n,a,o,s){var c=(0,i.randomBytes)(a),l=e(t,c,s).encrypt(n);if(o===0)return(0,r.concatBytes)(c,l);var u=l.length-o,d=l.subarray(0,u),f=l.subarray(u);return(0,r.concatBytes)(c,f,d)}function l(e,t,n,i,a,o){var s=n.subarray(0,i),c=e(t,Uint8Array.from(s),o),l=n.subarray(i);if(a===0)return c.decrypt(l);var u=l.subarray(0,a),d=l.subarray(a);return c.decrypt((0,r.concatBytes)(d,u))}})),le=s((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(te(),e),n(re(),e),n(ee(),e),n(ce(),e)})),ue=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PublicKey=void 0;var t=M(),n=le();e.PublicKey=function(){function e(e,t){var r=(0,n.convertPublicKeyFormat)(e,!0,t),i=(0,n.convertPublicKeyFormat)(e,!1,t);this.data=r,this.dataUncompressed=r.length===i.length?null:i}return e.fromHex=function(t,r){return new e((0,n.hexToPublicKey)(t,r),r)},Object.defineProperty(e.prototype,`_uncompressed`,{get:function(){return this.dataUncompressed===null?this.data:this.dataUncompressed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`uncompressed`,{get:function(){return Buffer.from(this._uncompressed)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`compressed`,{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),e.prototype.toBytes=function(e){return e===void 0&&(e=!0),e?this.data:this._uncompressed},e.prototype.toHex=function(e){return e===void 0&&(e=!0),(0,t.bytesToHex)(this.toBytes(e))},e.prototype.decapsulate=function(e,t){t===void 0&&(t=!1);var r=this.toBytes(t),i=e.multiply(this,t);return(0,n.getSharedKey)(r,i)},e.prototype.equals=function(e){return(0,t.equalBytes)(this.data,e.data)},e}()})),de=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PrivateKey=void 0;var t=M(),n=le(),r=ue();e.PrivateKey=function(){function e(e,t){if(this.curve=t,e===void 0)this.data=(0,n.getValidSecret)(t);else if((0,n.isValidPrivateKey)(e,t))this.data=e;else throw Error(`Invalid private key`);this.publicKey=new r.PublicKey((0,n.getPublicKey)(this.data,t),t)}return e.fromHex=function(t,r){return new e((0,n.decodeHex)(t),r)},Object.defineProperty(e.prototype,`secret`,{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),e.prototype.toHex=function(){return(0,t.bytesToHex)(this.data)},e.prototype.encapsulate=function(e,t){t===void 0&&(t=!1);var r=this.publicKey.toBytes(t),i=this.multiply(e,t);return(0,n.getSharedKey)(r,i)},e.prototype.multiply=function(e,t){return t===void 0&&(t=!1),(0,n.getSharedPoint)(this.data,e.toBytes(!0),t,this.curve)},e.prototype.equals=function(e){return(0,t.equalBytes)(this.data,e.data)},e}()})),fe=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PublicKey=e.PrivateKey=void 0;var t=de();Object.defineProperty(e,`PrivateKey`,{enumerable:!0,get:function(){return t.PrivateKey}});var n=ue();Object.defineProperty(e,`PublicKey`,{enumerable:!0,get:function(){return n.PublicKey}})})),pe=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.utils=e.PublicKey=e.PrivateKey=e.ECIES_CONFIG=void 0,e.encrypt=a,e.decrypt=s;var t=M(),n=P(),r=fe(),i=le();function a(e,t){return Buffer.from(o(e,t))}function o(e,a){var o=(0,n.ellipticCurve)(),s=new r.PrivateKey(void 0,o),c=e instanceof Uint8Array?new r.PublicKey(e,o):r.PublicKey.fromHex(e,o),l=s.encapsulate(c,(0,n.isHkdfKeyCompressed)()),u=s.publicKey.toBytes((0,n.isEphemeralKeyCompressed)()),d=(0,i.symEncrypt)(l,a);return(0,t.concatBytes)(u,d)}function s(e,t){return Buffer.from(c(e,t))}function c(e,t){var a=(0,n.ellipticCurve)(),o=e instanceof Uint8Array?new r.PrivateKey(e,a):r.PrivateKey.fromHex(e,a),s=(0,n.ephemeralKeySize)(),c=new r.PublicKey(t.subarray(0,s),a),l=t.subarray(s),u=c.decapsulate(o,(0,n.isHkdfKeyCompressed)());return(0,i.symDecrypt)(u,l)}var l=P();Object.defineProperty(e,`ECIES_CONFIG`,{enumerable:!0,get:function(){return l.ECIES_CONFIG}});var u=fe();Object.defineProperty(e,`PrivateKey`,{enumerable:!0,get:function(){return u.PrivateKey}}),Object.defineProperty(e,`PublicKey`,{enumerable:!0,get:function(){return u.PublicKey}}),e.utils={aesEncrypt:i.aesEncrypt,aesDecrypt:i.aesDecrypt,symEncrypt:i.symEncrypt,symDecrypt:i.symDecrypt,decodeHex:i.decodeHex,getValidSecret:i.getValidSecret,remove0x:i.remove0x}})),me=s(((e,t)=>{let{decrypt:n}=pe(),r=v();function i(e,t,i,a){let o,s;if(!t.startsWith(`encrypted:`))return t;if(a||=``,a.length<=0)s=new r({key:e,privateKeyName:i,privateKey:a}).missingPrivateKey();else{let c=a.split(`,`);for(let l of c){let c=Buffer.from(l,`hex`),u=t.substring(10),d=Buffer.from(u,`base64`);try{o=n(c,d).toString(),s=null;break}catch(t){s=t.message===`Invalid private key`?new r({key:e,privateKeyName:i,privateKey:a}).invalidPrivateKey():t.message===`Unsupported state or unable to authenticate data`?new r({key:e,privateKeyName:i,privateKey:a}).wrongPrivateKey():t.message===`Point of length 65 was invalid. Expected 33 compressed bytes or 65 uncompressed bytes`?new r({key:e,privateKeyName:i,privateKey:a}).malformedEncryptedData():new r({key:e,privateKeyName:i,privateKey:a,message:t.message}).decryptionFailed()}}}if(s)throw s;return o}t.exports=i})),he=s(((e,t)=>{let n=/^encrypted:.+/;function r(e){return n.test(e)}t.exports=r})),ge=s(((e,t)=>{function n(e){return e.replace(/[\r\n]+$/,``)}t.exports=n})),_e=s(((e,t)=>{let{execSync:n}=c(`child_process`),r=ge(),i=v();function a(e,t,a,o){return(t.match(/\$\(([^)]+(?:\)[^(]*)*)\)/g)||[]).reduce((t,s)=>{let c=s.slice(2,-1),l;try{l=n(c,{env:{...a,...o}}).toString()}catch(t){throw new i({key:e,command:c,message:t.message.trim()}).commandSubstitutionFailed()}return l=r(l),t.replace(s,l)},t)}t.exports=a})),ve=s(((e,t)=>{function n(e){return e.replace(/\\\$/g,`$`)}t.exports=n})),ye=s(((e,t)=>{let n=me(),r=he(),i=_e(),a=ve();t.exports=class e{static LINE=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;constructor(e,t=null,n=process.env,r=!1,i=null){this.src=e,this.privateKey=t,this.privateKeyName=i,this.processEnv=n,this.overload=r,this.parsed={},this.preExisted={},this.injected={},this.errors=[],this.runningParsed={},this.literals={}}run(){let t=this.getLines(),n;for(;(n=e.LINE.exec(t))!==null;){let e=n[1],t=n[2],i=this.quote(t);this.parsed[e]=this.clean(t,i),!this.overload&&this.inProcessEnv(e)&&(this.parsed[e]=this.processEnv[e]);try{this.parsed[e]=this.decrypt(e,this.parsed[e])}catch(e){this.errors.push(e)}let o=r(this.parsed[e]),s=!1;if(!o&&i!==`'`&&(!this.inProcessEnv(e)||this.processEnv[e]===this.parsed[e])){let t=this.parsed[e];try{this.parsed[e]=this.eval(e,t)}catch(e){this.errors.push(e)}t!==this.parsed[e]&&(s=!0)}!o&&!s&&i!==`'`&&(!this.processEnv[e]||this.overload)&&(this.parsed[e]=a(this.expand(this.parsed[e]))),i===`'`&&(this.literals[e]=this.parsed[e]),this.runningParsed[e]=this.parsed[e],Object.prototype.hasOwnProperty.call(this.processEnv,e)&&!this.overload?this.preExisted[e]=this.processEnv[e]:this.injected[e]=this.parsed[e]}return{parsed:this.parsed,processEnv:this.processEnv,injected:this.injected,preExisted:this.preExisted,errors:this.errors}}trimmer(e){return(e||``).trim()}quote(e){let t=this.trimmer(e)[0],n=``;switch(t){case`'`:n=`'`;break;case`"`:n=`"`;break;case"`":n="`";break;default:n=``}return n}clean(e,t){let n=this.trimmer(e);return n=n.replace(/^(['"`])([\s\S]*)\1$/gm,`$2`),t===`"`&&(n=n.replace(/\\n/g,`
25
+ `),n=n.replace(/\\r/g,`\r`),n=n.replace(/\\t/g,` `)),n}decrypt(e,t){return n(e,t,this.privateKeyName,this.privateKey)}eval(e,t){return i(e,t,this.processEnv,this.runningParsed)}expand(e){let t={...this.runningParsed,...this.processEnv};this.overload&&(t={...this.processEnv,...this.runningParsed});let n=/(?<!\\)\${([^{}]+)}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g,r=e,i;for(;(i=n.exec(r))!==null;){let[e,a,o]=i,s=a||o,c=s.match(/(:\+|\+|:-|-)/),l=c?c[0]:null,u=s.split(l),d,f,p=u.shift();if([`:+`,`+`].includes(l)?(d=t[p]?u.join(l):``,f=null):(d=u.join(l),f=t[p]),r=f?r.replace(e,f):r.replace(e,d),r===t[p]||this.literals[p]&&/\$\{[^}]+\}|\$[A-Za-z_][A-Za-z0-9_]*/.test(this.literals[p]))break;n.lastIndex=0}return r}inProcessEnv(e){return Object.prototype.hasOwnProperty.call(this.processEnv,e)}getLines(){return(this.src||``).toString().replace(/\r\n?/gm,`
26
+ `)}}})),be=s(((e,t)=>{let n=c(`fs`);async function r(e){let t=await n.promises.readFile(e);return t.length>=2&&t[0]===255&&t[1]===254?`utf16le`:(t.length>=3&&t[0]===239&&t[1]===187&&t[2],`utf8`)}t.exports=r})),xe=s(((e,t)=>{let n=c(`fs`);function r(e){let t=n.readFileSync(e);return t.length>=2&&t[0]===255&&t[1]===254?`utf16le`:(t.length>=3&&t[0]===239&&t[1]===187&&t[2],`utf8`)}t.exports=r})),Se=s(((e,t)=>{let n=c(`path`);function r(e){let t=n.basename(e).toLowerCase();return t.startsWith(`.env`)&&t.endsWith(`.txt`)&&(t=t.slice(0,-4)),t}t.exports=r})),Ce=s(((e,t)=>{let n=Se();function r(e){let t=n(e),r=[...t.split(`.`).slice(2)];return r.length===0?t.replace(`.env`,`development`):r.length===1?r[0]:r.length===2?r.join(`_`):r.slice(0,2).join(`_`)}t.exports=r})),we=s(((e,t)=>{let n=Se(),r=Ce();function i(e){let t=n(e);if(t===`.env`)return{publicKeyName:`DOTENV_PUBLIC_KEY`,privateKeyName:`DOTENV_PRIVATE_KEY`};let i=r(t).toUpperCase();return{publicKeyName:`DOTENV_PUBLIC_KEY_${i}`,privateKeyName:`DOTENV_PRIVATE_KEY_${i}`}}t.exports=i})),$=s(((e,t)=>{let n=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function r(e,t=!1,r=!1,i=!1){let a={},o=e.toString();r||(o=o.replace(/\r\n?/gm,`
27
+ `));let s;for(;(s=n.exec(o))!=null;){let e=s[1],n=s[2]||``;n=n.trim();let r=n[0];n=n.replace(/^(['"`])([\s\S]*)\1$/gm,`$2`),r===`"`&&!t&&(n=n.replace(/\\n/g,`
28
+ `),n=n.replace(/\\r/g,`\r`),n=n.replace(/\\t/g,` `)),i?(a[e]=a[e]||[],a[e].push(n)):a[e]=n}return a}t.exports=r})),Te=s(((e,t)=>{function n(e){if(process.env[e]&&process.env[e].length>0)return process.env[e]}t.exports=n})),Ee=s(((e,t)=>{let n=A(),r=$();async function i(e,t){if(!await n.exists(t))return;let i=r(await n.readFileX(t));if(i[e]&&i[e].length>0)return i[e]}t.exports=i})),De=s(((e,t)=>{let n=c(`path`),r=c(`child_process`),i=c(`util`),{logger:a}=x(),o=i.promisify(r.execFile);t.exports=class{async status(){if(this._isForcedOff())return`off`;let e=await this._resolveBinary();if(!e)return`off`;try{return await this._exec(e,[`status`])}catch{return`off`}}statusSync(){if(this._isForcedOff())return`off`;let e=this._resolveBinarySync();if(!e)return`off`;try{return this._execSync(e,[`status`])}catch{return`off`}}async keypair(e,t={}){if(this._isForcedOff())return{};let n=await this._resolveBinary();if(!n)return{};let r=[`keypair`];t.noSpinner&&r.push(`--no-spinner`),e&&r.push(e);try{return JSON.parse(await this._execInteractive(n,r))}catch{return{}}}keypairSync(e,t={}){if(this._isForcedOff())return{};let n=this._resolveBinarySync();if(!n)return{};let r=[`keypair`];t.noSpinner&&r.push(`--no-spinner`),e&&r.push(e);try{return JSON.parse(this._execInteractiveSync(n,r))}catch{return{}}}observe(e){if(this._isForcedOff())return;let t=this._resolveBinarySync();if(!t)return;let n=`off`;try{n=this._execSync(t,[`status`])}catch{return}if(n===`off`)return;let i=Buffer.from(JSON.stringify(e)).toString(`base64`);try{r.spawn(t,[`observe`,i],{stdio:`ignore`,detached:!0}).unref()}catch{}}async _exec(e,t){let{stdout:n,stderr:r}=await o(e,t);return r&&r.length>0&&process.stderr.write(r.toString()),n.toString().trim()}_execSync(e,t){return a.debug(e),a.debug(t),r.execFileSync(e,t).toString().trim()}_execInteractive(e,t){return new Promise((n,i)=>{let a=r.spawn(e,t,{stdio:[`inherit`,`pipe`,`inherit`]}),o=``;a.stdout.on(`data`,e=>{o+=e.toString()}),a.on(`error`,i),a.on(`close`,r=>{if(r!==0){i(Error(`${e} ${t.join(` `)} exited with code ${r}`));return}n(o.trim())})})}_execInteractiveSync(e,t){return a.debug(e),a.debug(t),r.execFileSync(e,t,{stdio:[`inherit`,`pipe`,`inherit`]}).toString().trim()}async _resolveBinary(){return this._binaryPromise||=(async()=>{let e=n.resolve(process.cwd(),`node_modules/.bin/dotenvx-ops`);try{return await this._exec(e,[`--version`]),e}catch{}try{return await this._exec(`dotenvx-ops`,[`--version`]),`dotenvx-ops`}catch{}return null})(),this._binaryPromise}_resolveBinarySync(){if(this._binarySync!==void 0)return this._binarySync;let e=n.resolve(process.cwd(),`node_modules/.bin/dotenvx-ops`);try{return this._execSync(e,[`--version`]),this._binarySync=e,this._binarySync}catch(e){a.debug(e.message)}try{return this._execSync(`dotenvx-ops`,[`--version`]),this._binarySync=`dotenvx-ops`,this._binarySync}catch(e){a.debug(e.message)}return this._binarySync=null,null}_isForcedOff(){return process.env.DOTENVX_NO_OPS===`true`}}})),Oe=s(((e,t)=>{let n=De();async function r(e,t={}){t.beforeOpsKeypair&&await t.beforeOpsKeypair();let r;try{r=t.beforeOpsKeypair||t.afterOpsKeypair?await new n().keypair(e,{noSpinner:!0}):await new n().keypair(e)}finally{t.afterOpsKeypair&&await t.afterOpsKeypair()}return{publicKey:r.public_key,privateKey:r.private_key}}t.exports=r})),ke=s(((e,t)=>{let n=c(`path`),r=A(),i=$(),a=we(),o=Te(),s=Ee(),l=Oe();async function u(e){let t=`DOTENV_PUBLIC_KEY`;if(!await r.exists(e))return null;let n=i(await r.readFileX(e)),a;for(let e of Object.keys(n))(e===t||e.startsWith(t))&&(a=e);return a?a.replace(t,`DOTENV_PRIVATE_KEY`):null}async function d(e,t={}){let r=t.keysFilepath||null,i=t.noOps===!0,c=a(e),d=c.publicKeyName,f=c.privateKeyName,p=null,m=null;return p=o(d),p||=await s(d,e)||null,m=o(f),m||=(r=r?n.resolve(r):n.resolve(n.dirname(e),`.env.keys`),await s(f,r)),m||(f=await u(e),f&&(m=o(f),m||=await s(f,r))),!i&&!m&&p&&p.length>0&&(m=(await l(p,{beforeOpsKeypair:t.beforeOpsKeypair,afterOpsKeypair:t.afterOpsKeypair})).privateKey),{publicKeyValue:p||null,privateKeyValue:m||null}}t.exports=d})),Ae=s(((e,t)=>{let n=A(),r=$();function i(e,t){if(n.existsSync(t)){let i=r(n.readFileXSync(t));if(i[e]&&i[e].length>0)return i[e]}}t.exports=i})),je=s(((e,t)=>{let n=De();function r(e,t={}){let r=new n,i=Object.keys(t).length>0?r.keypairSync(e,t):r.keypairSync(e);return{publicKey:i.public_key,privateKey:i.private_key}}t.exports=r})),Me=s(((e,t)=>{let n=c(`path`),r=A(),i=$(),a=we(),o=Te(),s=Ae(),l=je();function u(e){let t=`DOTENV_PUBLIC_KEY`;if(!r.existsSync(e))return null;let n=i(r.readFileXSync(e)),a;for(let e of Object.keys(n))(e===t||e.startsWith(t))&&(a=e);return a?a.replace(t,`DOTENV_PRIVATE_KEY`):null}function d(e,t={}){let r=t.keysFilepath||null,i=t.noOps===!0,c=a(e),d=c.publicKeyName,f=c.privateKeyName,p=null,m=null;if(p=o(d),p||=s(d,e)||null,m=o(f),m||=(r=r?n.resolve(r):n.resolve(n.dirname(e),`.env.keys`),s(f,r)),m||(f=u(e),f&&(m=o(f),m||=s(f,r))),!i&&!m&&p&&p.length>0){let e={};t.noSpinner&&(e.noSpinner=!0),m=(Object.keys(e).length>0?l(p,e):l(p)).privateKey}return{publicKeyValue:p||null,privateKeyValue:m||null}}t.exports=d})),Ne=s(((e,t)=>{let n=c(`path`),r=$(),i=Ae(),a=je(),o=`DOTENV_PUBLIC_KEY`;function s(e,t){if(e[t]&&e[t].length>0)return e[t]}function l(e){for(let t of Object.keys(e))if(t===o||t.startsWith(o))return t;return null}function u(e,t=null,c={}){let u=c.keysFilepath||null,d=c.noOps===!0,f=c.processEnv||process.env,p=r(e),m=l(p),h=m&&(s(f,m)||p[m])||null;!t&&m&&(t=m.replace(o,`DOTENV_PRIVATE_KEY`));let g=null;return t&&(g=s(f,t),g||=(u=u?n.resolve(u):n.resolve(`.env.keys`),i(t,u))),!d&&!g&&h&&h.length>0&&(g=a(h).privateKey),{publicKeyValue:h||null,privateKeyValue:g||null,privateKeyName:t||null}}t.exports=u})),Pe=s(((e,t)=>{let n=`DOTENV_PRIVATE_KEY`;function r(e){return e===n?`.env`:`.env.${e.substring(`${n}_`.length).split(`_`).join(`.`).toLowerCase()}`}t.exports=r})),Fe=s(((e,t)=>{function n(e){return Object.keys(e).filter(e=>e.startsWith(`DOTENV_PRIVATE_KEY`))}t.exports=n})),Ie=s(((e,t)=>{t.exports={keyNames:we(),keyValues:ke(),keyValuesSync:Me(),keyValuesFromEnvSrc:Ne(),readProcessKey:Te(),readFileKey:Ee(),readFileKeySync:Ae(),guessPrivateKeyFilename:Pe(),dotenvPrivateKeyNames:Fe()}})),Le=s(((e,t)=>{let n=A(),r=c(`path`),i=`envFile`,a=ye(),o=v(),s=be(),l=xe(),{keyNames:u,keyValues:d,keyValuesSync:f,keyValuesFromEnvSrc:p}=Ie();t.exports=class{constructor(e=[],t=!1,n=process.env,r=null,i=!1,a={}){this.envs=e,this.overload=t,this.processEnv=n,this.envKeysFilepath=r,this.noOps=i,this.noSpinner=a.noSpinner,this.beforeOpsKeypair=a.beforeOpsKeypair,this.afterOpsKeypair=a.afterOpsKeypair,this.processedEnvs=[],this.readableFilepaths=new Set,this.readableStrings=new Set,this.uniqueInjectedKeys=new Set,this.beforeEnv={...this.processEnv}}runSync(){for(let e of this.envs)e.type===i?this._injectEnvFileSync(e.value):e.type===`env`&&this._injectEnv(e.value,e.privateKeyName);return{processedEnvs:this.processedEnvs,readableStrings:[...this.readableStrings],readableFilepaths:[...this.readableFilepaths],uniqueInjectedKeys:[...this.uniqueInjectedKeys],beforeEnv:this.beforeEnv,afterEnv:{...this.processEnv}}}async run(){for(let e of this.envs)e.type===i?await this._injectEnvFile(e.value):e.type===`env`&&this._injectEnv(e.value,e.privateKeyName);return{processedEnvs:this.processedEnvs,readableStrings:[...this.readableStrings],readableFilepaths:[...this.readableFilepaths],uniqueInjectedKeys:[...this.uniqueInjectedKeys],beforeEnv:this.beforeEnv,afterEnv:{...this.processEnv}}}_injectEnv(e,t=null){let n={};n.type=`env`,n.string=e;try{let{privateKeyName:r,privateKeyValue:i}=p(e,t,{keysFilepath:this.envKeysFilepath,noOps:this.noOps,processEnv:this.processEnv}),{parsed:o,errors:s,injected:c,preExisted:l}=new a(e,i,this.processEnv,this.overload,r).run();n.privateKeyName=r,n.privateKey=i,n.parsed=o,n.errors=s,n.injected=c,n.preExisted=l,this.inject(n.parsed),this.readableStrings.add(e);for(let e of Object.keys(c))this.uniqueInjectedKeys.add(e)}catch(e){n.errors=[e]}this.processedEnvs.push(n)}_injectEnvFileSync(e){let t={};t.type=i,t.filepath=e;let s=r.resolve(e);try{let r=l(s),i=n.readFileXSync(s,{encoding:r});this.readableFilepaths.add(e);let{privateKeyName:o}=u(s),{privateKeyValue:c}=f(s,{keysFilepath:this.envKeysFilepath,noOps:this.noOps,noSpinner:this.noSpinner}),{parsed:d,errors:p,injected:m,preExisted:h}=new a(i,c,this.processEnv,this.overload,o).run();t.privateKeyName=o,t.privateKey=c,t.src=i,t.parsed=d,t.errors=p,t.injected=m,t.preExisted=h,this.inject(t.parsed);for(let e of Object.keys(m))this.uniqueInjectedKeys.add(e)}catch(n){n.code===`ENOENT`||n.code===`EISDIR`?t.errors=[new o({envFilepath:e,filepath:s}).missingEnvFile()]:t.errors=[n]}this.processedEnvs.push(t)}async _injectEnvFile(e){let t={};t.type=i,t.filepath=e;let c=r.resolve(e);try{let r=await s(c),i=await n.readFileX(c,{encoding:r});this.readableFilepaths.add(e);let{privateKeyName:o}=u(c),{privateKeyValue:l}=await d(c,{keysFilepath:this.envKeysFilepath,noOps:this.noOps,beforeOpsKeypair:this.beforeOpsKeypair,afterOpsKeypair:this.afterOpsKeypair}),{parsed:f,errors:p,injected:m,preExisted:h}=new a(i,l,this.processEnv,this.overload,o).run();t.privateKeyName=o,t.privateKey=l,t.src=i,t.parsed=f,t.errors=p,t.injected=m,t.preExisted=h,this.inject(t.parsed);for(let e of Object.keys(m))this.uniqueInjectedKeys.add(e)}catch(n){n.code===`ENOENT`||n.code===`EISDIR`?t.errors=[new o({envFilepath:e,filepath:c}).missingEnvFile()]:t.errors=[n]}this.processedEnvs.push(t)}inject(e){for(let t of Object.keys(e))this.processEnv[t]=e[t]}}})),Re=s(((e,t)=>{let n=v();function r(e){let t=process.env.DOTENV_ENV||process.env.NODE_ENV||`development`;if(e===`nextjs`){let e=[`development`,`test`,`production`].includes(t)&&t;return[e&&{type:`envFile`,value:`.env.${e}.local`},e!==`test`&&{type:`envFile`,value:`.env.local`},e&&{type:`envFile`,value:`.env.${e}`},{type:`envFile`,value:`.env`}].filter(Boolean)}else if(e===`flow`)return[{type:`envFile`,value:`.env.${t}.local`},{type:`envFile`,value:`.env.${t}`},{type:`envFile`,value:`.env.local`},{type:`envFile`,value:`.env`},{type:`envFile`,value:`.env.defaults`}];else throw new n({convention:e}).invalidConvention()}t.exports=r})),ze=s(((e,t)=>{let n=c(`os`),r=c(`path`);function i(e){return e[0]===`~`?r.join(n.homedir(),e.slice(1)):e}t.exports=i})),Be=s(((e,t)=>{let n=ze();function r(e){let t=[];if(e&&e.path)if(!Array.isArray(e.path))t=[n(e.path)];else{t=[];for(let r of e.path)t.push(n(r))}return t}t.exports=r})),Ve=s(((e,t)=>{let n=Re(),r=Be();function i(e){if(e.envs)return e.envs;let t=r(e),i=[];e.convention&&(i=n(e.convention).concat(i));for(let e of t)i.push({type:`envFile`,value:e});return i}t.exports=i})),He=s(((e,t)=>{let n=Fe(),r=Pe(),i=`envFile`,a=[{type:i,value:`.env`}];function o(e){let t=[];for(let n of e){let e=r(n);t.push({type:i,value:e})}return t}function s(e=[],t){let r=n(t);if(!e||e.length<=0)return r.length>0?o(r):a;{let t=!1;for(let n of e)n.type===i&&(t=!0);return t?e:[...a,...e]}}t.exports=s})),Ue=s(((e,t)=>{let n=A(),r=v(),i=[`.env.project`,`.env.keys`,`.env.me`,`.env.x`,`.env.example`];function a(e){try{return n.readdirSync(e).filter(e=>e.startsWith(`.env`)&&!e.endsWith(`.previous`)&&!i.includes(e))}catch(t){throw t.code===`ENOENT`?new r({directory:e}).missingDirectory():t}}t.exports=a})),We=s(((e,t)=>{t.exports={buildEnvs:Ve(),determine:He(),findEnvFiles:Ue(),dotenvOptionPaths:Be(),environment:Ce(),conventions:Re()}})),Ge=s(((e,t)=>{let{PrivateKey:n}=pe();function r(e){let t;return t=e?new n(Buffer.from(e,`hex`)):new n,{publicKey:t.publicKey.toHex(),privateKey:t.secret.toString(`hex`)}}t.exports=r})),Ke=s(((e,t)=>{let{encrypt:n}=pe();function r(e,t){let r=n(t,Buffer.from(e));return`encrypted:${Buffer.from(r,`hex`).toString(`base64`)}`}t.exports=r})),qe=s(((e,t)=>{let n=/^DOTENV_PUBLIC_KEY/;function r(e){return n.test(e)}t.exports=r})),Je=s(((e,t)=>{let n=[`#/------------------!DOTENV_PRIVATE_KEYS!-------------------/`,`#/ private decryption keys. DO NOT commit to source control /`,`#/ [how it works](https://dotenvx.com/encryption) /`,`#/----------------------------------------------------------/`].join(`
29
+ `),r=c(`path`),i=A();async function a({envFilepath:e,keysFilepath:t,privateKeyName:a,privateKeyValue:o}){let s=r.basename(e),c=r.resolve(e),l=r.join(r.dirname(c),`.env.keys`);t&&(l=r.resolve(t));let u=[`# ${s}`,`${a}=${o}`,``].join(`
30
+ `),d=``;await i.exists(l)&&(d=await i.readFileX(l)),d=d.length>1?d:`${n}\n`,d=`${d}\n${u}`,await i.writeFileX(l,d);let f=t||r.join(r.dirname(e),r.basename(l));return{keysSrc:d,envKeysFilepath:f}}t.exports=a})),Ye=s(((e,t)=>{let n=[`#/------------------!DOTENV_PRIVATE_KEYS!-------------------/`,`#/ private decryption keys. DO NOT commit to source control /`,`#/ [how it works](https://dotenvx.com/encryption) /`,`#/----------------------------------------------------------/`].join(`
31
+ `),r=c(`path`),i=A();function a({envFilepath:e,keysFilepath:t,privateKeyName:a,privateKeyValue:o}){let s=r.basename(e),c=r.resolve(e),l=r.join(r.dirname(c),`.env.keys`);t&&(l=r.resolve(t));let u=[`# ${s}`,`${a}=${o}`,``].join(`
32
+ `),d=``;i.existsSync(l)&&(d=i.readFileXSync(l)),d=d.length>1?d:`${n}\n`,d=`${d}\n${u}`,i.writeFileXSync(l,d);let f=t||r.join(r.dirname(e),r.basename(l));return{keysSrc:d,envKeysFilepath:f}}t.exports=a})),Xe=s(((e,t)=>{function n(e){let[t,...n]=e.split(`
33
+ `),r=``;return t.startsWith(`#!`)&&(r=t+`
34
+ `,e=n.join(`
35
+ `)),{firstLinePreserved:r,envSrc:e}}t.exports=n})),Ze=s(((e,t)=>{function n(e,t,n,r=`.env.keys`){return[`#/-------------------[DOTENV_PUBLIC_KEY]--------------------/`,`#/ public-key encryption for .env files /`,`#/ [how it works](https://dotenvx.com/encryption) /`,`#/----------------------------------------------------------/`,`${e}="${t}"${r===`.env.keys`?``:` # -fk ${r}`}`,``,`# ${n}`].join(`
36
+ `)}t.exports=n})),Qe=s(((e,t)=>{let n=c(`path`),r=Xe(),i=Ze();function a({envSrc:e,envFilepath:t,keysFilepath:a,publicKeyName:o,publicKeyValue:s}){let c=n.basename(t),l=n.resolve(t),u=n.join(n.dirname(l),`.env.keys`);a&&(u=n.resolve(a));let d=n.relative(n.dirname(l),u),f=r(e),p=i(o,s,c,d);return e=`${f.firstLinePreserved}${p}\n${f.envSrc}`,{envSrc:e}}t.exports=a})),$e=s(((e,t)=>{let n=Qe(),r=Je(),i=Oe(),a=Ge(),{keyNames:o}=Ie();async function s({envSrc:e,envFilepath:t,keysFilepath:s,noOps:c}){c=c!==!1;let{publicKeyName:l,privateKeyName:u}=o(t),d,f,p,m,h=!1,g=!1;if(c){let e=a();d=e.publicKey,f=e.privateKey}else{let e=await i();d=e.publicKey,f=e.privateKey}if(e=n({envSrc:e,envFilepath:t,keysFilepath:s,publicKeyName:l,publicKeyValue:d}).envSrc,c){let e=await r({envFilepath:t,keysFilepath:s,privateKeyName:u,privateKeyValue:f});p=e.keysSrc,m=e.envKeysFilepath,h=!0}else g=!0;return{envSrc:e,keysSrc:p,publicKey:d,privateKey:f,envKeysFilepath:m,localPrivateKeyAdded:h,remotePrivateKeyAdded:g}}t.exports=s})),et=s(((e,t)=>{let n=Qe(),r=Ye(),i=je(),a=Ge(),{keyNames:o}=Ie();function s({envSrc:e,envFilepath:t,keysFilepath:s,noOps:c}){c=c!==!1;let{publicKeyName:l,privateKeyName:u}=o(t),d,f,p,m,h=!1,g=!1;if(c){let e=a();d=e.publicKey,f=e.privateKey}else{let e=i();d=e.publicKey,f=e.privateKey}if(e=n({envSrc:e,envFilepath:t,keysFilepath:s,publicKeyName:l,publicKeyValue:d}).envSrc,c){let e=r({envFilepath:t,keysFilepath:s,privateKeyName:u,privateKeyValue:f});p=e.keysSrc,m=e.envKeysFilepath,h=!0}else g=!0;return{envSrc:e,keysSrc:p,publicKey:d,privateKey:f,envKeysFilepath:m,localPrivateKeyAdded:h,remotePrivateKeyAdded:g}}t.exports=s})),tt=s(((e,t)=>{let n=v(),r=Qe(),i=Ge();function a({envSrc:e,envFilepath:t,keysFilepath:a,privateKeyValue:o,publicKeyValue:s,publicKeyName:c}){let{publicKey:l,privateKey:u}=i(o);if(s&&s!==l)throw new n({publicKey:l,publicKeyExisting:s}).mispairedPrivateKey();return s||(e=r({envSrc:e,envFilepath:t,keysFilepath:a,publicKeyName:c,publicKeyValue:l}).envSrc),{envSrc:e,publicKey:l,privateKey:u}}t.exports=a})),nt=s(((e,t)=>{let n=$(),r=he(),i=qe();function a(e){let t=n(e,!1,!1,!0);for(let[e,n]of Object.entries(t))for(let t of n)if(!(r(t)||i(e)))return!1;return!0}t.exports=a})),rt=s(((e,t)=>{t.exports={opsKeypair:Oe(),opsKeypairSync:je(),localKeypair:Ge(),encryptValue:Ke(),decryptKeyValue:me(),isEncrypted:he(),isPublicKey:qe(),mutateKeysSrc:Je(),mutateKeysSrcSync:Ye(),provision:$e(),provisionSync:et(),provisionWithPrivateKey:tt(),mutateSrc:Qe(),isFullyEncrypted:nt()}})),it=s(((e,t)=>{function n(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}t.exports=n})),at=s(((e,t)=>{let n=$(),r=it();function i(e,t,n,i){let a=r(t),o=r(n),s=``;o===``&&(s=`$`);let c=RegExp(`^(\\s*)?(export\\s+)?`+a+`\\s*=\\s*(["'\`]?)`+o+`\\3`+s,`gm`);return e.replace(c,function(n,r=``,s=``,c=``){let l=`${t}=${c}${i}${c}`,u=e.match(RegExp(`${a}\\s*=\\s*\n\n`,`m`));if(o===``&&c===``&&u){let e=u[0].match(/\n/g).length-1;for(let t=0;t<e;t++)l+=`
37
+ `}return`${r}${s}${l}`})}function a(e,t,r){let a,o=``,s=n(e,!0,!0,!0);if(Object.prototype.hasOwnProperty.call(s,t)){let n=s[t],a=e,o=Array.isArray(r)?r:n.map(()=>r),c=new Map;n.forEach((e,t)=>{c.has(e)||c.set(e,o[t])});for(let[e,n]of c)a=i(a,t,e,n);return a}else o+=`${t}="${r}"`,e.endsWith(`
38
+ `)?o+=`
39
+ `:o=`
40
+ `+o,a=e+o;return a}t.exports=a})),ot=s(((e,t)=>{let n=A(),r=c(`path`),i=`envFile`,a=v(),{determine:o}=We(),{keyNames:s,keyValues:l,keyValuesSync:u}=Ie(),{encryptValue:d,decryptKeyValue:f,isEncrypted:p,provision:m,provisionSync:h,provisionWithPrivateKey:g}=rt(),_=at(),y=$(),b=be(),x=xe();function S(e,t){return y(e,!1,!1,!0)[t]||[]}t.exports=class{constructor(e,t,n=[],r=!0,i=null,a=!1,s=!1){this.envs=o(n,process.env),this.key=e,this.value=t,this.encrypt=r,this.envKeysFilepath=i,this.noOps=a,this.noCreate=s,this.processedEnvs=[],this.changedFilepaths=new Set,this.unchangedFilepaths=new Set,this.readableFilepaths=new Set}runSync(){for(let e of this.envs)e.type===i&&this._setEnvFileSync(e.value);return{processedEnvs:this.processedEnvs,changedFilepaths:[...this.changedFilepaths],unchangedFilepaths:[...this.unchangedFilepaths]}}async run(){for(let e of this.envs)e.type===i&&await this._setEnvFile(e.value);return{processedEnvs:this.processedEnvs,changedFilepaths:[...this.changedFilepaths],unchangedFilepaths:[...this.unchangedFilepaths]}}_setEnvFileSync(e){let t={};t.key=this.key||null,t.value=this.value||null,t.type=i;let o=r.resolve(e);t.filepath=o,t.envFilepath=e,t.changed=!1;try{let r=!1;n.existsSync(o)||(this.noCreate?x(o):n.writeFileXSync(o,``));let i=x(o),c=n.readFileXSync(o,{encoding:i});t.key&&c.trim().length===0&&(c=`${t.key}="${this.value}"\n`,r=!0),t.originalValue=y(c)[t.key]||null,r&&(t.originalValue=null);let l=!p(t.originalValue);if(this.readableFilepaths.add(e),this.encrypt){let n,r,{publicKeyName:i,privateKeyName:l}=s(o),{publicKeyValue:p,privateKeyValue:m}=u(o,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});if(!m&&!p){let i=h({envSrc:c,envFilepath:e,keysFilepath:this.envKeysFilepath,noOps:this.noOps});c=i.envSrc,n=i.publicKey,r=i.privateKey,t.envKeysFilepath=i.envKeysFilepath,t.localPrivateKeyAdded=i.localPrivateKeyAdded,t.remotePrivateKeyAdded=i.remotePrivateKeyAdded}else if(m){let a=g({envSrc:c,envFilepath:e,keysFilepath:this.envKeysFilepath,privateKeyValue:m,publicKeyValue:p,publicKeyName:i});n=a.publicKey,r=a.privateKey,c=a.envSrc,t.originalValue&&=f(t.key,t.originalValue,l,r)}else p&&(n=p);t.publicKey=n,t.privateKey=r;try{t.encryptedValue=d(this.value,n)}catch{throw new a({publicKeyName:i,publicKey:n}).invalidPublicKey()}t.privateKeyName=l}let m=l&&this.encrypt,v=this.value!==t.originalValue,b=S(c,t.key).length>1;r&&!this.encrypt?(t.envSrc=c,this.changedFilepaths.add(e),t.changed=!0):m||v||b?(t.envSrc=_(c,this.key,t.encryptedValue||this.value),this.changedFilepaths.add(e),t.changed=!0):(t.envSrc=c,this.unchangedFilepaths.add(e),t.changed=!1)}catch(n){n.code===`ENOENT`?t.error=new a({envFilepath:e,filepath:o}).missingEnvFile():t.error=n}this.processedEnvs.push(t)}async _setEnvFile(e){let t={};t.key=this.key||null,t.value=this.value||null,t.type=i;let o=r.resolve(e);t.filepath=o,t.envFilepath=e,t.changed=!1;try{let r=!1;await n.exists(o)||(this.noCreate?await b(o):await n.writeFileX(o,``));let i=await b(o),c=await n.readFileX(o,{encoding:i});t.key&&c.trim().length===0&&(c=`${t.key}="${this.value}"\n`,r=!0),t.originalValue=y(c)[t.key]||null,r&&(t.originalValue=null);let u=!p(t.originalValue);if(this.readableFilepaths.add(e),this.encrypt){let n,r,{publicKeyName:i,privateKeyName:u}=s(o),{publicKeyValue:p,privateKeyValue:h}=await l(o,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});if(!h&&!p){let i=await m({envSrc:c,envFilepath:e,keysFilepath:this.envKeysFilepath,noOps:this.noOps});c=i.envSrc,n=i.publicKey,r=i.privateKey,t.envKeysFilepath=i.envKeysFilepath,t.localPrivateKeyAdded=i.localPrivateKeyAdded,t.remotePrivateKeyAdded=i.remotePrivateKeyAdded}else if(h){let a=g({envSrc:c,envFilepath:e,keysFilepath:this.envKeysFilepath,privateKeyValue:h,publicKeyValue:p,publicKeyName:i});n=a.publicKey,r=a.privateKey,c=a.envSrc,t.originalValue&&=f(t.key,t.originalValue,u,r)}else p&&(n=p);t.publicKey=n,t.privateKey=r;try{t.encryptedValue=d(this.value,n)}catch{throw new a({publicKeyName:i,publicKey:n}).invalidPublicKey()}t.privateKeyName=u}let h=u&&this.encrypt,v=this.value!==t.originalValue,x=S(c,t.key).length>1;r&&!this.encrypt?(t.envSrc=c,this.changedFilepaths.add(e),t.changed=!0):h||v||x?(t.envSrc=_(c,this.key,t.encryptedValue||this.value),this.changedFilepaths.add(e),t.changed=!0):(t.envSrc=c,this.unchangedFilepaths.add(e),t.changed=!1)}catch(n){n.code===`ENOENT`?t.error=new a({envFilepath:e,filepath:o}).missingEnvFile():t.error=n}this.processedEnvs.push(t)}}})),st=s(((e,t)=>{let n=Le(),r=v(),{determine:i}=We();t.exports=class{constructor(e,t=[],n=!1,r=!1,i=null,a=!1){this.key=e,this.envs=t,this.overload=n,this.all=r,this.envKeysFilepath=i,this.noOps=a}runSync(){let e={...process.env},{processedEnvs:t}=new n(i(this.envs,e),this.overload,e,this.envKeysFilepath,this.noOps).runSync();return this._result(t,e)}async run(){let e={...process.env},{processedEnvs:t}=await new n(i(this.envs,e),this.overload,e,this.envKeysFilepath,this.noOps).run();return this._result(t,e)}_result(e,t){let n=[];for(let t of e)for(let e of t.errors)n.push(e);if(this.key){let e={},i=t[this.key];return e[this.key]=i,i===void 0&&n.push(new r({key:this.key}).missingKey()),{parsed:e,errors:n}}if(this.all)return{parsed:t,errors:n};let i={};for(let n of e)if(n.parsed)for(let e of Object.keys(n.parsed))i[e]=t[e];return{parsed:i,errors:n}}}})),ct=s(((e,t)=>{let{keyNames:n,keyValues:r,keyValuesSync:i}=Ie();t.exports=class{constructor(e=`.env`,t=null,n=!1){this.envFile=e,this.envKeysFilepath=t,this.noOps=n}runSync(){let e={},t=this._filepaths();for(let r of t){let{publicKeyName:t,privateKeyName:a}=n(r),{publicKeyValue:o,privateKeyValue:s}=i(r,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});e[t]=o,e[a]=s}return e}async run(){let e={},t=this._filepaths();for(let i of t){let{publicKeyName:t,privateKeyName:a}=n(i),{publicKeyValue:o,privateKeyValue:s}=await r(i,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});e[t]=o,e[a]=s}return e}_filepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}})),lt=s(((e,t)=>{let n=A(),r=c(`path`),i=v(),a=Ue(),o=at(),s=$();t.exports=class{constructor(e=`.`,t){this.directory=e,this.envFile=t||a(e),this.exampleFilename=`.env.example`,this.exampleFilepath=r.resolve(this.directory,this.exampleFilename)}run(){if(this.envFile.length<1)throw new i().missingEnvFiles();let e=new Set,t=new Set,a=this._envFilepaths(),c={},l={},u=`# ${this.exampleFilename} - generated with dotenvx\n`;for(let t of a){let a=r.resolve(this.directory,t);if(!n.existsSync(a)){let e=new i({envFilepath:t,filepath:a}).missingEnvFile();throw e.help=`? add it with [echo "HELLO=World" > ${t}] and then run [dotenvx genexample]`,e}let c=n.readFileXSync(a),l=s(c);for(let t in l)e.add(t),c=o(c,t,``);u+=`\n${c}`}if(n.existsSync(this.exampleFilepath)){u=n.readFileXSync(this.exampleFilepath);let r=s(u);for(let n of[...e])n in r?l[n]=r[n]:(u+=`${n}=''\n`,t.add(n),c[n]=``)}else for(let n of[...e])t.add(n),c[n]=``;return{envExampleFile:u,envFile:this.envFile,exampleFilepath:this.exampleFilepath,addedKeys:[...t],injected:c,preExisted:l}}_envFilepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}})),ut=s(((e,t)=>{let n=De(),{logger:r}=x();t.exports=class{constructor(){this.ops=new n}async noOps(){let e=await this.ops.status();return r.debug(`ops: ${e}`),e===`off`}noOpsSync(){let e=this.ops.statusSync();return r.debug(`ops: ${e}`),e===`off`}}})),dt=s(((e,t)=>{let n=c(`path`);function r(e){return e?n.isAbsolute(e)?n.relative(process.cwd(),e)||n.basename(e):e:`.env.keys`}t.exports=r}));s(((e,t)=>{let n=c(`path`),{setLogLevel:r,setLogName:i,setLogVersion:a,logger:o}=x(),{getColor:s,bold:l}=b(),u=k(),d=j(),f=Le(),p=ot(),m=st(),h=ct(),g=lt(),_=ut(),v=Ve(),{determine:y}=We(),S=ye(),C=A(),w=dt(),T=function(e={}){let t=process.env;e&&e.processEnv!=null&&(t=e.processEnv);let s=e.overload||e.override,c=e.ignore||[],l=e.strict,u=e.envKeysFile;e&&(r(e),i(e),a(e));let d=I(e);try{let r=v(e);e.envs||(r=y(r,t));let{processedEnvs:i,readableFilepaths:a,uniqueInjectedKeys:p}=new f(r,s,t,u,d,{noSpinner:e.noSpinner}).runSync(),m,h={};for(let t of i){t.type===`envFile`&&o.verbose(`loading env from ${t.filepath} (${n.resolve(t.filepath)})`);for(let n of t.errors||[]){if(c.includes(n.code)){o.verbose(`ignored: ${n.message}`);continue}if(l)throw n;m=n,n.code===`MISSING_ENV_FILE`&&e.convention||o.error(n.messageWithHelp)}Object.assign(h,t.injected||{}),Object.assign(h,t.preExisted||{}),o.debug(t.parsed);for(let[e,n]of Object.entries(t.injected||{}))o.verbose(`${e} set`),o.debug(`${e} set to ${n}`);for(let[e,n]of Object.entries(t.preExisted||{}))o.verbose(`${e} pre-exists (protip: use --overload to override)`),o.debug(`${e} pre-exists as ${n} (protip: use --overload to override)`)}let g=`injected env (${p.length})`;return a.length>0&&(g+=` from ${a.join(`, `)}`),o.successv(g),m?{parsed:h,error:m}:{parsed:h}}catch(e){if(l)throw e;return o.error(e.messageWithHelp),{parsed:{},error:e}}},E=function(e,t={}){let n=process.env;t&&t.processEnv!=null&&(n=t.processEnv);let r=t.privateKey||null,i=t.overload||t.override,{parsed:a,errors:s}=new S(e,r,n,i).run();for(let e of s)o.error(e.messageWithHelp);return a},D=function(e,t,n={}){let s=!0;(n.plain||n.encrypt===!1)&&(s=!1),n&&(r(n),i(n),a(n));let c=v(n),l=n.envKeysFile,u=I(n),{processedEnvs:d,changedFilepaths:f,unchangedFilepaths:m}=new p(e,t,c,s,l,u).runSync(),h=``;s&&(h=` with encryption`);for(let e of d)if(o.verbose(`setting for ${e.envFilepath}`),e.error){let t=e.error,n=t.messageWithHelp||(t.help?`${t.message}. ${t.help}`:t.message);o.warn(n)}else C.writeFileXSync(e.filepath,e.envSrc),o.verbose(`${e.key} set${h} (${e.envFilepath})`),o.debug(`${e.key} set${h} to ${e.value} (${e.envFilepath})`);let g=``,_=d.find(e=>e.localPrivateKeyAdded),y=d.find(e=>e.remotePrivateKeyAdded);if(_&&(g=` + local key (${w(_.envKeysFilepath)})`),y&&(g=` + armored key ⛨`),f.length>0)s?o.success(`◈ encrypted ${e} (${f.join(`,`)})${g}`):o.success(`◇ set ${e} (${f.join(`,`)})`);else if(s&&_){let t=_.envFilepath||f[0]||`.env`;o.success(`◈ encrypted ${e} (${t})${g}`)}else m.length>0&&o.info(`○ no change (${m})`);return{processedEnvs:d,changedFilepaths:f,unchangedFilepaths:m}},O=function(e,t={}){let n=v(t),r=I(t),i=t.ignore||[],{parsed:a,errors:s}=new m(e,n,t.overload,t.all,t.envKeysFile,r).runSync();for(let e of s||[])if(!i.includes(e.code)){if(t.strict)throw e;o.error(e.messageWithHelp)}if(e){let t=a[e];return t===void 0?void 0:t}else if(t.format===`eval`){let e=``;for(let[t,n]of Object.entries(a))e+=`${t}=${escape(n)}\n`;return e=e.trim(),e}else if(t.format===`shell`){let e=``;for(let[t,n]of Object.entries(a))e+=`${t}=${n} `;return e=e.trim(),e}else if(t.format===`colon`){let e=``;for(let[t,n]of Object.entries(a))e+=`${t}:${n} `;return e=e.trim(),e}else return a},M=function(e,t,n){return new u(e,t,n).run()},N=function(e){return new d(e).run()},P=function(e,t){return new g(e,t).run()},F=function(e,t,n=null,r=!1){let i=new h(e,n,r).runSync();return t?i[t]:i};function I(e={}){let t=new _;return e.noOps===!0||e.opsOff===!0||t.noOpsSync()}t.exports={config:T,parse:E,set:D,get:O,ls:M,doctor:N,keypair:F,genexample:P,setLogLevel:r,logger:o,getColor:s,bold:l}}))().config();const ft={ALGOLIA_APP_ID:`ALGOLIA_APP_ID`,ALGOLIA_ADMIN_API_KEY:`ALGOLIA_ADMIN_API_KEY`,ALGOLIA_INDEX_NAME:`ALGOLIA_INDEX_NAME`,DATA_DIR:`DATA_DIR`};var pt=class e{constructor(){this.envVars={},Object.values(ft).forEach(e=>{let t=process.env[e];if(t==null)throw Error(`Missing required environment variable: ${e}`);this.envVars[e]=t})}static getInstance(){return e.instance||=new e,e.instance}getConfig(e){return this.envVars[e]}},mt=class e{constructor(e,t){this.client=t(e.getConfig(`ALGOLIA_APP_ID`),e.getConfig(`ALGOLIA_ADMIN_API_KEY`)),this.indexName=e.getConfig(`ALGOLIA_INDEX_NAME`)}static getInstance(){if(!this.instance){let t=pt.getInstance();this.instance=new e(t,a)}return this.instance}getClient(){return this.client}getIndexName(){return this.indexName}};function ht(e){return t.readdirSync(e).filter(e=>e.endsWith(`.json`)).map(r=>{let i=t.readFileSync(n.join(e,r),`utf8`);return JSON.parse(i)})}var gt=class{constructor(e){this.client=e.getClient(),this.indexName=e.getIndexName()}async uploadObjects(e){if(e.length===0){console.error(`No items are included in the target JSON file. More than 1 item is necessary.`);return}let t=await this.getAllObjects();t=m(t);let n=m(e),r=this.determineOperations(t,n);if(r.update.length===0&&r.add.length===0&&r.delete.length===0){console.log(`No updates needed. All objects are up to date.`);return}if(r.update.length>0){let e=await this.client.partialUpdateObjects({indexName:this.indexName,objects:r.update,createIfNotExists:!0});console.log(`Updated ${e[0].objectIDs.length} objects`)}if(r.add.length>0){let e=await this.client.saveObjects({indexName:this.indexName,objects:r.add});console.log(`Added ${e[0].objectIDs.length} objects`)}if(r.delete.length>0){let e=r.delete.map(e=>e.objectID),t=await this.client.deleteObjects({indexName:this.indexName,objectIDs:e});console.log(`Deleted ${t[0].objectIDs.length} objects`)}}async getAllObjects(){let e=[];return await this.client.browseObjects({indexName:this.indexName,aggregator:t=>{Array.isArray(t.hits)&&t.hits.forEach(t=>{f(t)&&e.push(t)})}}),e}determineOperations(e,t){let n=new Map(e.map(e=>[e.objectID,e])),r=new Map(t.map(e=>[e.objectID,e])),i={update:[],add:[],delete:[]};for(let e of t){let t=n.get(e.objectID);t==null?i.add.push(e):o(t,e)||i.update.push(e)}for(let t of e)r.has(t.objectID)||i.delete.push(t);return i}};i(r({meta:{name:l,version:u,description:d},args:{},async run(){try{let e=pt.getInstance().getConfig(`DATA_DIR`);e=n.join(process.cwd(),e),t.existsSync(e)&&t.statSync(e).isDirectory()||(console.error(`Error: provided directory does not exist - ${e}`),process.exit(1));let r=ht(e);r.length===0&&(console.error(`Error: no .json files found in directory - ${e}`),process.exit(1));let i=r[0];Array.isArray(i)||(console.error(`The content of the provided json file is incompatible. Check the file: ${e}`),process.exit(1)),i.every(e=>f(e))||(console.error(`The content of the provided json file is incompatible. Check the file: ${e}`),process.exit(1)),await new gt(mt.getInstance()).uploadObjects(i)}catch(e){console.error(`Some errors occured: `,e),process.exit(1)}}}));export{};