algolia-uploader 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+ "use strict";const citty=require("citty"),require$$0$1=require("fs"),require$$0$2=require("path"),require$$0$3=require("tty"),node_module=require("node:module"),require$$0$4=require("child_process"),require$$2=require("util"),require$$0$5=require("os"),esToolkit=require("es-toolkit"),algoliasearch=require("algoliasearch");var _documentCurrentScript=typeof document<"u"?document.currentScript:null;function _interopDefaultCompat(e){return e&&typeof e=="object"&&"default"in e?e.default:e}const require$$0__default=_interopDefaultCompat(require$$0$1),require$$0__default$1=_interopDefaultCompat(require$$0$2),require$$0__default$2=_interopDefaultCompat(require$$0$3),require$$0__default$3=_interopDefaultCompat(require$$0$4),require$$2__default=_interopDefaultCompat(require$$2),require$$0__default$4=_interopDefaultCompat(require$$0$5),name$1="algolia-uploader",version$1="0.0.14",description$1="command-line util to upload Algolia source";function readAllJsonFiles(e){return require$$0__default.readdirSync(e).filter(s=>s.endsWith(".json")).map(s=>{const d=require$$0__default.readFileSync(require$$0__default$1.join(e,s),"utf8");return JSON.parse(d)})}function getAugmentedNamespace(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var s=e.default;if(typeof s=="function"){var d=function a(){var i=!1;try{i=this instanceof a}catch{}return i?Reflect.construct(s,arguments,this.constructor):s.apply(this,arguments)};d.prototype=s.prototype}else d={};return Object.defineProperty(d,"__esModule",{value:!0}),Object.keys(e).forEach(function(a){var i=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(d,a,i.get?i:{enumerable:!0,get:function(){return e[a]}})}),d}var config$1={};const version="1.61.1",name="@dotenvx/dotenvx",description="secrets for agents\u2013from 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$1="src/lib/main.js",types="src/lib/main.d.ts",exports$1={".":{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},_package={version,name,description,author,keywords,homepage,repository,license,files,main:main$1,types,exports:exports$1,bin,scripts,funding,dependencies,devDependencies,publishConfig},_package$1={__proto__:null,author,bin,default:_package,dependencies,description,devDependencies,exports:exports$1,files,funding,homepage,keywords,license,main:main$1,name,publishConfig,repository,scripts,types,version},require$$0=getAugmentedNamespace(_package$1);var packageJson,hasRequiredPackageJson;function requirePackageJson(){if(hasRequiredPackageJson)return packageJson;hasRequiredPackageJson=1;const{name:e,version:s,description:d}=require$$0;return packageJson={name:e,version:s,description:d},packageJson}var truncate_1,hasRequiredTruncate;function requireTruncate(){if(hasRequiredTruncate)return truncate_1;hasRequiredTruncate=1;function e(s,d=7){return s&&s.length>0?s.slice(0,d)+"\u2026":""}return truncate_1=e,truncate_1}var errors,hasRequiredErrors;function requireErrors(){if(hasRequiredErrors)return errors;hasRequiredErrors=1;const e=requireTruncate(),s={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 d{constructor(i={}){this.filepath=i.filepath,this.envFilepath=i.envFilepath,this.envKeysFilepath=i.envKeysFilepath,this.key=i.key,this.privateKey=i.privateKey,this.privateKeyName=i.privateKeyName,this.publicKeyName=i.publicKeyName,this.publicKey=i.publicKey,this.publicKeyExisting=i.publicKeyExisting,this.command=i.command,this.message=i.message,this.code=i.code,this.help=i.help,this.debug=i.debug,this.convention=i.convention,this.directory=i.directory,this.exitCode=i.exitCode,this.level=i.level,this.color=i.color,this.error=i.error}custom(){const i=new Error(this.message);return this.code&&(i.code=this.code),this.help&&(i.help=this.help),this.code&&!i.help&&(i.help=`fix: [${s[this.code]}]`),i.messageWithHelp=`${i.message}. ${i.help}`,this.debug&&(i.debug=this.debug),i}commandExitedWithCode(){const i="COMMAND_EXITED_WITH_CODE",o=`[${i}] Command exited with exit code ${this.exitCode}`,r=`fix: [${s[i]}]`,c=new Error(o);return c.code=i,c.help=r,c.messageWithHelp=`${o}. ${r}`,c}commandSubstitutionFailed(){const i="COMMAND_SUBSTITUTION_FAILED",o=`[${i}] could not eval ${this.key} containing command '${this.command}': ${this.message}`,r=`fix: [${s[i]}]`,c=new Error(o);return c.code=i,c.help=r,c.messageWithHelp=`${o}. ${r}`,c}decryptionFailed(){const i="DECRYPTION_FAILED",o=`[${i}] ${this.message}`,r=`fix: [${s[i]}]`,c=new Error(o);return c.code=i,c.help=r,c.messageWithHelp=`${o}. ${r}`,c}dangerousDependencyHoist(){const i="DANGEROUS_DEPENDENCY_HOIST",o=`[${i}] your environment has hoisted an incompatible version of a dotenvx dependency: ${this.message}`,r=`fix: [${s[i]}]`,c=new Error(o);return c.code=i,c.help=r,c.messageWithHelp=`${o}. ${r}`,c}invalidColor(){const i="INVALID_COLOR",o=`[${i}] Invalid color ${this.color}`,r=`fix: [${s[i]}]`,c=new Error(o);return c.code=i,c.help=r,c.messageWithHelp=`${o}. ${r}`,c}invalidConvention(){const i="INVALID_CONVENTION",o=`[${i}] invalid convention (${this.convention})`,r=`fix: [${s[i]}]`,c=new Error(o);return c.code=i,c.help=r,c.messageWithHelp=`${o}. ${r}`,c}invalidPrivateKey(){const i="INVALID_PRIVATE_KEY",o=`[${i}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,r=`fix: [${s[i]}]`,c=new Error(o);return c.code=i,c.help=r,c.messageWithHelp=`${o}. ${r}`,c}invalidPublicKey(){const i="INVALID_PUBLIC_KEY",o=`[${i}] could not encrypt using public key '${this.publicKeyName}=${e(this.publicKey)}'`,r=`fix: [${s[i]}]`,c=new Error(o);return c.code=i,c.help=r,c.messageWithHelp=`${o}. ${r}`,c}malformedEncryptedData(){const i="MALFORMED_ENCRYPTED_DATA",o=`[${i}] could not decrypt ${this.key} because encrypted data appears malformed`,r=`fix: [${s[i]}]`,c=new Error(o);return c.code=i,c.help=r,c.messageWithHelp=`${o}. ${r}`,c}mispairedPrivateKey(){const i="MISPAIRED_PRIVATE_KEY",o=`[${i}] private key's derived public key (${e(this.publicKey)}) does not match the existing public key (${e(this.publicKeyExisting)})`,r=`fix: [${s[i]}]`,c=new Error(o);return c.code=i,c.help=r,c.messageWithHelp=`${o}. ${r}`,c}missingDirectory(){const i="MISSING_DIRECTORY",o=`[${i}] missing directory (${this.directory})`,r=`fix: [${s[i]}]`,c=new Error(o);return c.code=i,c.help=r,c.messageWithHelp=`${o}. ${r}`,c}missingEnvFile(){const i="MISSING_ENV_FILE",o=this.envFilepath||".env",r=`[${i}] missing file (${o})`,c=`fix: [${s[i]}]`,g=new Error(r);return g.code=i,g.help=c,g.messageWithHelp=`${r}. ${c}`,g}missingEnvKeysFile(){const i="MISSING_ENV_KEYS_FILE",o=this.envKeysFilepath||".env.keys",r=`[${i}] missing file (${o})`,c=`fix: [${s[i]}]`,g=new Error(r);return g.code=i,g.help=c,g.messageWithHelp=`${r}. ${c}`,g}missingEnvFiles(){const i="MISSING_ENV_FILES",o=`[${i}] no .env* files found`,r=`fix: [${s[i]}]`,c=new Error(o);return c.code=i,c.help=r,c.messageWithHelp=`${o}. ${r}`,c}missingKey(){const i="MISSING_KEY",o=`[${i}] missing key (${this.key})`,r=`fix: [${s[i]}]`,c=new Error(o);return c.code=i,c.help=r,c.messageWithHelp=`${o}. ${r}`,c}missingLogLevel(){const i="MISSING_LOG_LEVEL",o=`[${i}] missing log level '${this.level}'. implement in logger`,r=`fix: [${s[i]}]`,c=new Error(o);return c.code=i,c.help=r,c.messageWithHelp=`${o}. ${r}`,c}missingPrivateKey(){const i="MISSING_PRIVATE_KEY",o=`[${i}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,r=`fix: [${s[i]}]`,c=new Error(o);return c.code=i,c.help=r,c.messageWithHelp=`${o}. ${r}`,c}precommitHookModifyFailed(){const i="PRECOMMIT_HOOK_MODIFY_FAILED",o=`[${i}] failed to modify pre-commit hook: ${this.error.message}`,r=`fix: [${s[i]}]`,c=new Error(o);return c.code=i,c.help=r,c.messageWithHelp=`${o}. ${r}`,c}wrongPrivateKey(){const i="WRONG_PRIVATE_KEY",o=`[${i}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,r=`fix: [${s[i]}]`,c=new Error(o);return c.code=i,c.help=r,c.messageWithHelp=`${o}. ${r}`,c}}return d.ISSUE_BY_CODE=s,errors=d,errors}var colorDepth,hasRequiredColorDepth;function requireColorDepth(){if(hasRequiredColorDepth)return colorDepth;hasRequiredColorDepth=1;const{WriteStream:e}=require$$0__default$2;return colorDepth={getColorDepth:()=>{try{return e.prototype.getColorDepth()}catch{const a=process.env.TERM;return a&&(a.includes("256color")||a.includes("xterm"))?8:4}}},colorDepth}var colors,hasRequiredColors;function requireColors(){if(hasRequiredColors)return colors;hasRequiredColors=1;const e=requireColorDepth(),s=requireErrors(),d=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]]),i=new Map([["amber",[236,213,63]],["orangered",[138,90,43]],["red",[140,35,50]]]);function o(c){const g=e.getColorDepth();if(!a.has(c))throw new s({color:c}).invalidColor();if(g>=24&&i.has(c)){const[S,C,q]=i.get(c);return V=>`\x1B[38;2;${S};${C};${q}m${V}\x1B[39m`}if(g>=8){const S=a.get(c);return C=>`\x1B[38;5;${S}m${C}\x1B[39m`}if(g>=4){const S=d.get(c);return C=>`\x1B[${S}m${C}\x1B[39m`}return S=>S}function r(c){return e.getColorDepth()>=4?`\x1B[1m${c}\x1B[22m`:c}return colors={getColor:o,bold:r},colors}var logger_1,hasRequiredLogger;function requireLogger(){if(hasRequiredLogger)return logger_1;hasRequiredLogger=1;const e=requirePackageJson(),s=requireErrors(),{getColor:d,bold:a}=requireColors(),i={error:0,warn:1,success:2,successv:2,info:2,help:2,verbose:4,debug:5,silly:6},o=E=>a(d("red")(`\u2620 ${E}`)),r=E=>d("orangered")(`\u26A0 ${E}`),c=d("amber"),g=E=>d("amber")(`\u27D0 ${E}`),S=d("gray"),C=d("dodgerblue"),q=E=>d("plum")(`\u2506 ${E}`),V=E=>d("plum")(`\u2506 ${E}`);let D=i.info,p="dotenvx",b=e.version;function B(E,M){const O=L(E,M);console.error(O)}function k(E,M){if(i[E]===void 0)throw new s({level:E}).missingLogLevel();if(i[E]<=D){const O=L(E,M);console.log(O)}}function L(E,M){const O=typeof M=="object"?JSON.stringify(M):M;switch(E.toLowerCase()){case"error":return o(O);case"warn":return r(O);case"success":return c(O);case"successv":return g(`${O} \xB7 ${p}@${b}`);case"info":return S(O);case"help":return C(O);case"verbose":return q(O);case"debug":return V(O)}}const P={level:"info",error:E=>B("error",E),warn:E=>k("warn",E),success:E=>k("success",E),successv:E=>k("successv",E),info:E=>k("info",E),help:E=>k("help",E),verbose:E=>k("verbose",E),debug:E=>k("debug",E),setLevel:E=>{i[E]!==void 0&&(D=i[E],P.level=E)},setName:E=>{p=E,P.name=E},setVersion:E=>{b=E,P.version=E}};function w(E){const M=E.debug?"debug":E.verbose?"verbose":E.quiet?"error":E.logLevel;M&&(P.setLevel(M),(!E.quiet||E.quiet&&M!=="error")&&P.debug(`setting log level to: ${M}`))}function y(E){const M=E.logName;M&&P.setName(M)}function R(E){const M=E.logVersion;M&&P.setVersion(M)}return logger_1={logger:P,getColor:d,setLogLevel:w,setLogName:y,setLogVersion:R,levels:i},logger_1}var dist$1={},utils$4={},constants,hasRequiredConstants;function requireConstants(){if(hasRequiredConstants)return constants;hasRequiredConstants=1;const e="\\\\/",s=`[^${e}]`,d=0,a="\\.",i="\\+",o="\\?",r="\\/",c="(?=.)",g="[^/]",S=`(?:${r}|$)`,C=`(?:^|${r})`,q=`${a}{1,2}${S}`,V=`(?!${a})`,D=`(?!${C}${q})`,p=`(?!${a}{0,1}${S})`,b=`(?!${q})`,B=`[^.${r}]`,k=`${g}*?`,P={DOT_LITERAL:a,PLUS_LITERAL:i,QMARK_LITERAL:o,SLASH_LITERAL:r,ONE_CHAR:c,QMARK:g,END_ANCHOR:S,DOTS_SLASH:q,NO_DOT:V,NO_DOTS:D,NO_DOT_SLASH:p,NO_DOTS_SLASH:b,QMARK_NO_DOT:B,STAR:k,START_ANCHOR:C,SEP:"/"},w={...P,SLASH_LITERAL:`[${e}]`,QMARK:s,STAR:`${s}*?`,DOTS_SLASH:`${a}{1,2}(?:[${e}]|$)`,NO_DOT:`(?!${a})`,NO_DOTS:`(?!(?:^|[${e}])${a}{1,2}(?:[${e}]|$))`,NO_DOT_SLASH:`(?!${a}{0,1}(?:[${e}]|$))`,NO_DOTS_SLASH:`(?!${a}{1,2}(?:[${e}]|$))`,QMARK_NO_DOT:`[^.${e}]`,START_ANCHOR:`(?:^|[${e}])`,END_ANCHOR:`(?:[${e}]|$)`,SEP:"\\"},y={__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 constants={DEFAULT_MAX_EXTGLOB_RECURSION:d,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:y,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(R){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${R.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(R){return R===!0?w:P}},constants}var hasRequiredUtils$4;function requireUtils$4(){return hasRequiredUtils$4||(hasRequiredUtils$4=1,(function(e){const{REGEX_BACKSLASH:s,REGEX_REMOVE_BACKSLASH:d,REGEX_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_GLOBAL:i}=requireConstants();e.isObject=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),e.hasRegexChars=o=>a.test(o),e.isRegexChar=o=>o.length===1&&e.hasRegexChars(o),e.escapeRegex=o=>o.replace(i,"\\$1"),e.toPosixSlashes=o=>o.replace(s,"/"),e.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const o=navigator.platform.toLowerCase();return o==="win32"||o==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1},e.removeBackslashes=o=>o.replace(d,r=>r==="\\"?"":r),e.escapeLast=(o,r,c)=>{const g=o.lastIndexOf(r,c);return g===-1?o:o[g-1]==="\\"?e.escapeLast(o,r,g-1):`${o.slice(0,g)}\\${o.slice(g)}`},e.removePrefix=(o,r={})=>{let c=o;return c.startsWith("./")&&(c=c.slice(2),r.prefix="./"),c},e.wrapOutput=(o,r={},c={})=>{const g=c.contains?"":"^",S=c.contains?"":"$";let C=`${g}(?:${o})${S}`;return r.negated===!0&&(C=`(?:^(?!${C}).*$)`),C},e.basename=(o,{windows:r}={})=>{const c=o.split(r?/[\\/]/:"/"),g=c[c.length-1];return g===""?c[c.length-2]:g}})(utils$4)),utils$4}var scan_1,hasRequiredScan;function requireScan(){if(hasRequiredScan)return scan_1;hasRequiredScan=1;const e=requireUtils$4(),{CHAR_ASTERISK:s,CHAR_AT:d,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:i,CHAR_DOT:o,CHAR_EXCLAMATION_MARK:r,CHAR_FORWARD_SLASH:c,CHAR_LEFT_CURLY_BRACE:g,CHAR_LEFT_PARENTHESES:S,CHAR_LEFT_SQUARE_BRACKET:C,CHAR_PLUS:q,CHAR_QUESTION_MARK:V,CHAR_RIGHT_CURLY_BRACE:D,CHAR_RIGHT_PARENTHESES:p,CHAR_RIGHT_SQUARE_BRACKET:b}=requireConstants(),B=P=>P===c||P===a,k=P=>{P.isPrefix!==!0&&(P.depth=P.isGlobstar?1/0:1)};return scan_1=(P,w)=>{const y=w||{},R=P.length-1,E=y.parts===!0||y.scanToEnd===!0,M=[],O=[],j=[];let $=P,W=-1,Y=0,Z=0,u=!1,T=!1,f=!1,l=!1,v=!1,H=!1,t=!1,m=!1,x=!1,A=!1,F=0,te,Q,h={value:"",depth:0,isGlob:!1};const G=()=>W>=R,J=()=>$.charCodeAt(W+1),ne=()=>(te=Q,$.charCodeAt(++W));for(;W<R;){Q=ne();let fe;if(Q===a){t=h.backslashes=!0,Q=ne(),Q===g&&(H=!0);continue}if(H===!0||Q===g){for(F++;G()!==!0&&(Q=ne());){if(Q===a){t=h.backslashes=!0,ne();continue}if(Q===g){F++;continue}if(H!==!0&&Q===o&&(Q=ne())===o){if(u=h.isBrace=!0,f=h.isGlob=!0,A=!0,E===!0)continue;break}if(H!==!0&&Q===i){if(u=h.isBrace=!0,f=h.isGlob=!0,A=!0,E===!0)continue;break}if(Q===D&&(F--,F===0)){H=!1,u=h.isBrace=!0,A=!0;break}}if(E===!0)continue;break}if(Q===c){if(M.push(W),O.push(h),h={value:"",depth:0,isGlob:!1},A===!0)continue;if(te===o&&W===Y+1){Y+=2;continue}Z=W+1;continue}if(y.noext!==!0&&(Q===q||Q===d||Q===s||Q===V||Q===r)===!0&&J()===S){if(f=h.isGlob=!0,l=h.isExtglob=!0,A=!0,Q===r&&W===Y&&(x=!0),E===!0){for(;G()!==!0&&(Q=ne());){if(Q===a){t=h.backslashes=!0,Q=ne();continue}if(Q===p){f=h.isGlob=!0,A=!0;break}}continue}break}if(Q===s){if(te===s&&(v=h.isGlobstar=!0),f=h.isGlob=!0,A=!0,E===!0)continue;break}if(Q===V){if(f=h.isGlob=!0,A=!0,E===!0)continue;break}if(Q===C){for(;G()!==!0&&(fe=ne());){if(fe===a){t=h.backslashes=!0,ne();continue}if(fe===b){T=h.isBracket=!0,f=h.isGlob=!0,A=!0;break}}if(E===!0)continue;break}if(y.nonegate!==!0&&Q===r&&W===Y){m=h.negated=!0,Y++;continue}if(y.noparen!==!0&&Q===S){if(f=h.isGlob=!0,E===!0){for(;G()!==!0&&(Q=ne());){if(Q===S){t=h.backslashes=!0,Q=ne();continue}if(Q===p){A=!0;break}}continue}break}if(f===!0){if(A=!0,E===!0)continue;break}}y.noext===!0&&(l=!1,f=!1);let N=$,_="",z="";Y>0&&(_=$.slice(0,Y),$=$.slice(Y),Z-=Y),N&&f===!0&&Z>0?(N=$.slice(0,Z),z=$.slice(Z)):f===!0?(N="",z=$):N=$,N&&N!==""&&N!=="/"&&N!==$&&B(N.charCodeAt(N.length-1))&&(N=N.slice(0,-1)),y.unescape===!0&&(z&&(z=e.removeBackslashes(z)),N&&t===!0&&(N=e.removeBackslashes(N)));const oe={prefix:_,input:P,start:Y,base:N,glob:z,isBrace:u,isBracket:T,isGlob:f,isExtglob:l,isGlobstar:v,negated:m,negatedExtglob:x};if(y.tokens===!0&&(oe.maxDepth=0,B(Q)||O.push(h),oe.tokens=O),y.parts===!0||y.tokens===!0){let fe;for(let pe=0;pe<M.length;pe++){const me=fe?fe+1:Y,be=M[pe],ve=P.slice(me,be);y.tokens&&(pe===0&&Y!==0?(O[pe].isPrefix=!0,O[pe].value=_):O[pe].value=ve,k(O[pe]),oe.maxDepth+=O[pe].depth),(pe!==0||ve!=="")&&j.push(ve),fe=be}if(fe&&fe+1<P.length){const pe=P.slice(fe+1);j.push(pe),y.tokens&&(O[O.length-1].value=pe,k(O[O.length-1]),oe.maxDepth+=O[O.length-1].depth)}oe.slashes=M,oe.parts=j}return oe},scan_1}var parse_1,hasRequiredParse$1;function requireParse$1(){if(hasRequiredParse$1)return parse_1;hasRequiredParse$1=1;const e=requireConstants(),s=requireUtils$4(),{MAX_LENGTH:d,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_BACKREF:o,REPLACEMENTS:r}=e,c=(L,P)=>{if(typeof P.expandRange=="function")return P.expandRange(...L,P);L.sort();const w=`[${L.join("-")}]`;try{new RegExp(w)}catch{return L.map(R=>s.escapeRegex(R)).join("..")}return w},g=(L,P)=>`Missing ${L}: "${P}" - use "\\\\${P}" to match literal characters`,S=L=>{const P=[];let w=0,y=0,R=0,E="",M=!1;for(const O of L){if(M===!0){E+=O,M=!1;continue}if(O==="\\"){E+=O,M=!0;continue}if(O==='"'){R=R===1?0:1,E+=O;continue}if(R===0){if(O==="[")w++;else if(O==="]"&&w>0)w--;else if(w===0){if(O==="(")y++;else if(O===")"&&y>0)y--;else if(O==="|"&&y===0){P.push(E),E="";continue}}}E+=O}return P.push(E),P},C=L=>{let P=!1;for(const w of L){if(P===!0){P=!1;continue}if(w==="\\"){P=!0;continue}if(/[?*+@!()[\]{}]/.test(w))return!1}return!0},q=L=>{let P=L.trim(),w=!0;for(;w===!0;)w=!1,/^@\([^\\()[\]{}|]+\)$/.test(P)&&(P=P.slice(2,-1),w=!0);if(C(P))return P.replace(/\\(.)/g,"$1")},V=L=>{const P=L.map(q).filter(Boolean);for(let w=0;w<P.length;w++)for(let y=w+1;y<P.length;y++){const R=P[w],E=P[y],M=R[0];if(!(!M||R!==M.repeat(R.length)||E!==M.repeat(E.length))&&(R===E||R.startsWith(E)||E.startsWith(R)))return!0}return!1},D=(L,P=!0)=>{if(L[0]!=="+"&&L[0]!=="*"||L[1]!=="(")return;let w=0,y=0,R=0,E=!1;for(let M=1;M<L.length;M++){const O=L[M];if(E===!0){E=!1;continue}if(O==="\\"){E=!0;continue}if(O==='"'){R=R===1?0:1;continue}if(R!==1){if(O==="["){w++;continue}if(O==="]"&&w>0){w--;continue}if(!(w>0)){if(O==="("){y++;continue}if(O===")"&&(y--,y===0))return P===!0&&M!==L.length-1?void 0:{type:L[0],body:L.slice(2,M),end:M}}}}},p=L=>{let P=0;const w=[];for(;P<L.length;){const R=D(L.slice(P),!1);if(!R||R.type!=="*")return;const E=S(R.body).map(O=>O.trim());if(E.length!==1)return;const M=q(E[0]);if(!M||M.length!==1)return;w.push(M),P+=R.end+1}return w.length<1?void 0:`${w.length===1?s.escapeRegex(w[0]):`[${w.map(R=>s.escapeRegex(R)).join("")}]`}*`},b=L=>{let P=0,w=L.trim(),y=D(w);for(;y;)P++,w=y.body.trim(),y=D(w);return P},B=(L,P)=>{if(P.maxExtglobRecursion===!1)return{risky:!1};const w=typeof P.maxExtglobRecursion=="number"?P.maxExtglobRecursion:e.DEFAULT_MAX_EXTGLOB_RECURSION,y=S(L).map(R=>R.trim());if(y.length>1&&(y.some(R=>R==="")||y.some(R=>/^[*?]+$/.test(R))||V(y)))return{risky:!0};for(const R of y){const E=p(R);if(E)return{risky:!0,safeOutput:E};if(b(R)>w)return{risky:!0}}return{risky:!1}},k=(L,P)=>{if(typeof L!="string")throw new TypeError("Expected a string");L=r[L]||L;const w={...P},y=typeof w.maxLength=="number"?Math.min(d,w.maxLength):d;let R=L.length;if(R>y)throw new SyntaxError(`Input length: ${R}, exceeds maximum allowed length: ${y}`);const E={type:"bos",value:"",output:w.prepend||""},M=[E],O=w.capture?"":"?:",j=e.globChars(w.windows),$=e.extglobChars(j),{DOT_LITERAL:W,PLUS_LITERAL:Y,SLASH_LITERAL:Z,ONE_CHAR:u,DOTS_SLASH:T,NO_DOT:f,NO_DOT_SLASH:l,NO_DOTS_SLASH:v,QMARK:H,QMARK_NO_DOT:t,STAR:m,START_ANCHOR:x}=j,A=U=>`(${O}(?:(?!${x}${U.dot?T:W}).)*?)`,F=w.dot?"":f,te=w.dot?H:t;let Q=w.bash===!0?A(w):m;w.capture&&(Q=`(${Q})`),typeof w.noext=="boolean"&&(w.noextglob=w.noext);const h={input:L,index:-1,start:0,dot:w.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:M};L=s.removePrefix(L,h),R=L.length;const G=[],J=[],ne=[];let N=E,_;const z=()=>h.index===R-1,oe=h.peek=(U=1)=>L[h.index+U],fe=h.advance=()=>L[++h.index]||"",pe=()=>L.slice(h.index+1),me=(U="",ce=0)=>{h.consumed+=U,h.index+=ce},be=U=>{h.output+=U.output!=null?U.output:U.value,me(U.value)},ve=()=>{let U=1;for(;oe()==="!"&&(oe(2)!=="("||oe(3)==="?");)fe(),h.start++,U++;return U%2===0?!1:(h.negated=!0,h.start++,!0)},xe=U=>{h[U]++,ne.push(U)},we=U=>{h[U]--,ne.pop()},le=U=>{if(N.type==="globstar"){const ce=h.braces>0&&(U.type==="comma"||U.type==="brace"),ee=U.extglob===!0||G.length&&(U.type==="pipe"||U.type==="paren");U.type!=="slash"&&U.type!=="paren"&&!ce&&!ee&&(h.output=h.output.slice(0,-N.output.length),N.type="star",N.value="*",N.output=Q,h.output+=N.output)}if(G.length&&U.type!=="paren"&&(G[G.length-1].inner+=U.value),(U.value||U.output)&&be(U),N&&N.type==="text"&&U.type==="text"){N.output=(N.output||N.value)+U.value,N.value+=U.value;return}U.prev=N,M.push(U),N=U},se=(U,ce)=>{const ee={...$[ce],conditions:1,inner:""};ee.prev=N,ee.parens=h.parens,ee.output=h.output,ee.startIndex=h.index,ee.tokensIndex=M.length;const ue=(w.capture?"(":"")+ee.open;xe("parens"),le({type:U,value:ce,output:h.output?"":u}),le({type:"paren",extglob:!0,value:fe(),output:ue}),G.push(ee)},re=U=>{const ce=L.slice(U.startIndex,h.index+1),ee=L.slice(U.startIndex+2,h.index),ue=B(ee,w);if((U.type==="plus"||U.type==="star")&&ue.risky){const K=ue.safeOutput?(U.output?"":u)+(w.capture?`(${ue.safeOutput})`:ue.safeOutput):void 0,X=M[U.tokensIndex];X.type="text",X.value=ce,X.output=K||s.escapeRegex(ce);for(let ie=U.tokensIndex+1;ie<M.length;ie++)M[ie].value="",M[ie].output="",delete M[ie].suffix;h.output=U.output+X.output,h.backtrack=!0,le({type:"paren",extglob:!0,value:_,output:""}),we("parens");return}let de=U.close+(w.capture?")":""),ye;if(U.type==="negate"){let K=Q;if(U.inner&&U.inner.length>1&&U.inner.includes("/")&&(K=A(w)),(K!==Q||z()||/^\)+$/.test(pe()))&&(de=U.close=`)$))${K}`),U.inner.includes("*")&&(ye=pe())&&/^\.[^\\/.]+$/.test(ye)){const X=k(ye,{...P,fastpaths:!1}).output;de=U.close=`)${X})${K})`}U.prev.type==="bos"&&(h.negatedExtglob=!0)}le({type:"paren",extglob:!0,value:_,output:de}),we("parens")};if(w.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(L)){let U=!1,ce=L.replace(o,(ee,ue,de,ye,K,X)=>ye==="\\"?(U=!0,ee):ye==="?"?ue?ue+ye+(K?H.repeat(K.length):""):X===0?te+(K?H.repeat(K.length):""):H.repeat(de.length):ye==="."?W.repeat(de.length):ye==="*"?ue?ue+ye+(K?Q:""):Q:ue?ee:`\\${ee}`);return U===!0&&(w.unescape===!0?ce=ce.replace(/\\/g,""):ce=ce.replace(/\\+/g,ee=>ee.length%2===0?"\\\\":ee?"\\":"")),ce===L&&w.contains===!0?(h.output=L,h):(h.output=s.wrapOutput(ce,h,P),h)}for(;!z();){if(_=fe(),_==="\0")continue;if(_==="\\"){const ee=oe();if(ee==="/"&&w.bash!==!0||ee==="."||ee===";")continue;if(!ee){_+="\\",le({type:"text",value:_});continue}const ue=/^\\+/.exec(pe());let de=0;if(ue&&ue[0].length>2&&(de=ue[0].length,h.index+=de,de%2!==0&&(_+="\\")),w.unescape===!0?_=fe():_+=fe(),h.brackets===0){le({type:"text",value:_});continue}}if(h.brackets>0&&(_!=="]"||N.value==="["||N.value==="[^")){if(w.posix!==!1&&_===":"){const ee=N.value.slice(1);if(ee.includes("[")&&(N.posix=!0,ee.includes(":"))){const ue=N.value.lastIndexOf("["),de=N.value.slice(0,ue),ye=N.value.slice(ue+2),K=a[ye];if(K){N.value=de+K,h.backtrack=!0,fe(),!E.output&&M.indexOf(N)===1&&(E.output=u);continue}}}(_==="["&&oe()!==":"||_==="-"&&oe()==="]")&&(_=`\\${_}`),_==="]"&&(N.value==="["||N.value==="[^")&&(_=`\\${_}`),w.posix===!0&&_==="!"&&N.value==="["&&(_="^"),N.value+=_,be({value:_});continue}if(h.quotes===1&&_!=='"'){_=s.escapeRegex(_),N.value+=_,be({value:_});continue}if(_==='"'){h.quotes=h.quotes===1?0:1,w.keepQuotes===!0&&le({type:"text",value:_});continue}if(_==="("){xe("parens"),le({type:"paren",value:_});continue}if(_===")"){if(h.parens===0&&w.strictBrackets===!0)throw new SyntaxError(g("opening","("));const ee=G[G.length-1];if(ee&&h.parens===ee.parens+1){re(G.pop());continue}le({type:"paren",value:_,output:h.parens?")":"\\)"}),we("parens");continue}if(_==="["){if(w.nobracket===!0||!pe().includes("]")){if(w.nobracket!==!0&&w.strictBrackets===!0)throw new SyntaxError(g("closing","]"));_=`\\${_}`}else xe("brackets");le({type:"bracket",value:_});continue}if(_==="]"){if(w.nobracket===!0||N&&N.type==="bracket"&&N.value.length===1){le({type:"text",value:_,output:`\\${_}`});continue}if(h.brackets===0){if(w.strictBrackets===!0)throw new SyntaxError(g("opening","["));le({type:"text",value:_,output:`\\${_}`});continue}we("brackets");const ee=N.value.slice(1);if(N.posix!==!0&&ee[0]==="^"&&!ee.includes("/")&&(_=`/${_}`),N.value+=_,be({value:_}),w.literalBrackets===!1||s.hasRegexChars(ee))continue;const ue=s.escapeRegex(N.value);if(h.output=h.output.slice(0,-N.value.length),w.literalBrackets===!0){h.output+=ue,N.value=ue;continue}N.value=`(${O}${ue}|${N.value})`,h.output+=N.value;continue}if(_==="{"&&w.nobrace!==!0){xe("braces");const ee={type:"brace",value:_,output:"(",outputIndex:h.output.length,tokensIndex:h.tokens.length};J.push(ee),le(ee);continue}if(_==="}"){const ee=J[J.length-1];if(w.nobrace===!0||!ee){le({type:"text",value:_,output:_});continue}let ue=")";if(ee.dots===!0){const de=M.slice(),ye=[];for(let K=de.length-1;K>=0&&(M.pop(),de[K].type!=="brace");K--)de[K].type!=="dots"&&ye.unshift(de[K].value);ue=c(ye,w),h.backtrack=!0}if(ee.comma!==!0&&ee.dots!==!0){const de=h.output.slice(0,ee.outputIndex),ye=h.tokens.slice(ee.tokensIndex);ee.value=ee.output="\\{",_=ue="\\}",h.output=de;for(const K of ye)h.output+=K.output||K.value}le({type:"brace",value:_,output:ue}),we("braces"),J.pop();continue}if(_==="|"){G.length>0&&G[G.length-1].conditions++,le({type:"text",value:_});continue}if(_===","){let ee=_;const ue=J[J.length-1];ue&&ne[ne.length-1]==="braces"&&(ue.comma=!0,ee="|"),le({type:"comma",value:_,output:ee});continue}if(_==="/"){if(N.type==="dot"&&h.index===h.start+1){h.start=h.index+1,h.consumed="",h.output="",M.pop(),N=E;continue}le({type:"slash",value:_,output:Z});continue}if(_==="."){if(h.braces>0&&N.type==="dot"){N.value==="."&&(N.output=W);const ee=J[J.length-1];N.type="dots",N.output+=_,N.value+=_,ee.dots=!0;continue}if(h.braces+h.parens===0&&N.type!=="bos"&&N.type!=="slash"){le({type:"text",value:_,output:W});continue}le({type:"dot",value:_,output:W});continue}if(_==="?"){if(!(N&&N.value==="(")&&w.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){se("qmark",_);continue}if(N&&N.type==="paren"){const ue=oe();let de=_;(N.value==="("&&!/[!=<:]/.test(ue)||ue==="<"&&!/<([!=]|\w+>)/.test(pe()))&&(de=`\\${_}`),le({type:"text",value:_,output:de});continue}if(w.dot!==!0&&(N.type==="slash"||N.type==="bos")){le({type:"qmark",value:_,output:t});continue}le({type:"qmark",value:_,output:H});continue}if(_==="!"){if(w.noextglob!==!0&&oe()==="("&&(oe(2)!=="?"||!/[!=<:]/.test(oe(3)))){se("negate",_);continue}if(w.nonegate!==!0&&h.index===0){ve();continue}}if(_==="+"){if(w.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){se("plus",_);continue}if(N&&N.value==="("||w.regex===!1){le({type:"plus",value:_,output:Y});continue}if(N&&(N.type==="bracket"||N.type==="paren"||N.type==="brace")||h.parens>0){le({type:"plus",value:_});continue}le({type:"plus",value:Y});continue}if(_==="@"){if(w.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){le({type:"at",extglob:!0,value:_,output:""});continue}le({type:"text",value:_});continue}if(_!=="*"){(_==="$"||_==="^")&&(_=`\\${_}`);const ee=i.exec(pe());ee&&(_+=ee[0],h.index+=ee[0].length),le({type:"text",value:_});continue}if(N&&(N.type==="globstar"||N.star===!0)){N.type="star",N.star=!0,N.value+=_,N.output=Q,h.backtrack=!0,h.globstar=!0,me(_);continue}let U=pe();if(w.noextglob!==!0&&/^\([^?]/.test(U)){se("star",_);continue}if(N.type==="star"){if(w.noglobstar===!0){me(_);continue}const ee=N.prev,ue=ee.prev,de=ee.type==="slash"||ee.type==="bos",ye=ue&&(ue.type==="star"||ue.type==="globstar");if(w.bash===!0&&(!de||U[0]&&U[0]!=="/")){le({type:"star",value:_,output:""});continue}const K=h.braces>0&&(ee.type==="comma"||ee.type==="brace"),X=G.length&&(ee.type==="pipe"||ee.type==="paren");if(!de&&ee.type!=="paren"&&!K&&!X){le({type:"star",value:_,output:""});continue}for(;U.slice(0,3)==="/**";){const ie=L[h.index+4];if(ie&&ie!=="/")break;U=U.slice(3),me("/**",3)}if(ee.type==="bos"&&z()){N.type="globstar",N.value+=_,N.output=A(w),h.output=N.output,h.globstar=!0,me(_);continue}if(ee.type==="slash"&&ee.prev.type!=="bos"&&!ye&&z()){h.output=h.output.slice(0,-(ee.output+N.output).length),ee.output=`(?:${ee.output}`,N.type="globstar",N.output=A(w)+(w.strictSlashes?")":"|$)"),N.value+=_,h.globstar=!0,h.output+=ee.output+N.output,me(_);continue}if(ee.type==="slash"&&ee.prev.type!=="bos"&&U[0]==="/"){const ie=U[1]!==void 0?"|$":"";h.output=h.output.slice(0,-(ee.output+N.output).length),ee.output=`(?:${ee.output}`,N.type="globstar",N.output=`${A(w)}${Z}|${Z}${ie})`,N.value+=_,h.output+=ee.output+N.output,h.globstar=!0,me(_+fe()),le({type:"slash",value:"/",output:""});continue}if(ee.type==="bos"&&U[0]==="/"){N.type="globstar",N.value+=_,N.output=`(?:^|${Z}|${A(w)}${Z})`,h.output=N.output,h.globstar=!0,me(_+fe()),le({type:"slash",value:"/",output:""});continue}h.output=h.output.slice(0,-N.output.length),N.type="globstar",N.output=A(w),N.value+=_,h.output+=N.output,h.globstar=!0,me(_);continue}const ce={type:"star",value:_,output:Q};if(w.bash===!0){ce.output=".*?",(N.type==="bos"||N.type==="slash")&&(ce.output=F+ce.output),le(ce);continue}if(N&&(N.type==="bracket"||N.type==="paren")&&w.regex===!0){ce.output=_,le(ce);continue}(h.index===h.start||N.type==="slash"||N.type==="dot")&&(N.type==="dot"?(h.output+=l,N.output+=l):w.dot===!0?(h.output+=v,N.output+=v):(h.output+=F,N.output+=F),oe()!=="*"&&(h.output+=u,N.output+=u)),le(ce)}for(;h.brackets>0;){if(w.strictBrackets===!0)throw new SyntaxError(g("closing","]"));h.output=s.escapeLast(h.output,"["),we("brackets")}for(;h.parens>0;){if(w.strictBrackets===!0)throw new SyntaxError(g("closing",")"));h.output=s.escapeLast(h.output,"("),we("parens")}for(;h.braces>0;){if(w.strictBrackets===!0)throw new SyntaxError(g("closing","}"));h.output=s.escapeLast(h.output,"{"),we("braces")}if(w.strictSlashes!==!0&&(N.type==="star"||N.type==="bracket")&&le({type:"maybe_slash",value:"",output:`${Z}?`}),h.backtrack===!0){h.output="";for(const U of h.tokens)h.output+=U.output!=null?U.output:U.value,U.suffix&&(h.output+=U.suffix)}return h};return k.fastpaths=(L,P)=>{const w={...P},y=typeof w.maxLength=="number"?Math.min(d,w.maxLength):d,R=L.length;if(R>y)throw new SyntaxError(`Input length: ${R}, exceeds maximum allowed length: ${y}`);L=r[L]||L;const{DOT_LITERAL:E,SLASH_LITERAL:M,ONE_CHAR:O,DOTS_SLASH:j,NO_DOT:$,NO_DOTS:W,NO_DOTS_SLASH:Y,STAR:Z,START_ANCHOR:u}=e.globChars(w.windows),T=w.dot?W:$,f=w.dot?Y:$,l=w.capture?"":"?:",v={negated:!1,prefix:""};let H=w.bash===!0?".*?":Z;w.capture&&(H=`(${H})`);const t=F=>F.noglobstar===!0?H:`(${l}(?:(?!${u}${F.dot?j:E}).)*?)`,m=F=>{switch(F){case"*":return`${T}${O}${H}`;case".*":return`${E}${O}${H}`;case"*.*":return`${T}${H}${E}${O}${H}`;case"*/*":return`${T}${H}${M}${O}${f}${H}`;case"**":return T+t(w);case"**/*":return`(?:${T}${t(w)}${M})?${f}${O}${H}`;case"**/*.*":return`(?:${T}${t(w)}${M})?${f}${H}${E}${O}${H}`;case"**/.*":return`(?:${T}${t(w)}${M})?${E}${O}${H}`;default:{const te=/^(.*?)\.(\w+)$/.exec(F);if(!te)return;const Q=m(te[1]);return Q?Q+E+te[2]:void 0}}},x=s.removePrefix(L,v);let A=m(x);return A&&w.strictSlashes!==!0&&(A+=`${M}?`),A},parse_1=k,parse_1}var picomatch_1$1,hasRequiredPicomatch$1;function requirePicomatch$1(){if(hasRequiredPicomatch$1)return picomatch_1$1;hasRequiredPicomatch$1=1;const e=requireScan(),s=requireParse$1(),d=requireUtils$4(),a=requireConstants(),i=r=>r&&typeof r=="object"&&!Array.isArray(r),o=(r,c,g=!1)=>{if(Array.isArray(r)){const B=r.map(L=>o(L,c,g));return L=>{for(const P of B){const w=P(L);if(w)return w}return!1}}const S=i(r)&&r.tokens&&r.input;if(r===""||typeof r!="string"&&!S)throw new TypeError("Expected pattern to be a non-empty string");const C=c||{},q=C.windows,V=S?o.compileRe(r,c):o.makeRe(r,c,!1,!0),D=V.state;delete V.state;let p=()=>!1;if(C.ignore){const B={...c,ignore:null,onMatch:null,onResult:null};p=o(C.ignore,B,g)}const b=(B,k=!1)=>{const{isMatch:L,match:P,output:w}=o.test(B,V,c,{glob:r,posix:q}),y={glob:r,state:D,regex:V,posix:q,input:B,output:w,match:P,isMatch:L};return typeof C.onResult=="function"&&C.onResult(y),L===!1?(y.isMatch=!1,k?y:!1):p(B)?(typeof C.onIgnore=="function"&&C.onIgnore(y),y.isMatch=!1,k?y:!1):(typeof C.onMatch=="function"&&C.onMatch(y),k?y:!0)};return g&&(b.state=D),b};return o.test=(r,c,g,{glob:S,posix:C}={})=>{if(typeof r!="string")throw new TypeError("Expected input to be a string");if(r==="")return{isMatch:!1,output:""};const q=g||{},V=q.format||(C?d.toPosixSlashes:null);let D=r===S,p=D&&V?V(r):r;return D===!1&&(p=V?V(r):r,D=p===S),(D===!1||q.capture===!0)&&(q.matchBase===!0||q.basename===!0?D=o.matchBase(r,c,g,C):D=c.exec(p)),{isMatch:!!D,match:D,output:p}},o.matchBase=(r,c,g)=>(c instanceof RegExp?c:o.makeRe(c,g)).test(d.basename(r)),o.isMatch=(r,c,g)=>o(c,g)(r),o.parse=(r,c)=>Array.isArray(r)?r.map(g=>o.parse(g,c)):s(r,{...c,fastpaths:!1}),o.scan=(r,c)=>e(r,c),o.compileRe=(r,c,g=!1,S=!1)=>{if(g===!0)return r.output;const C=c||{},q=C.contains?"":"^",V=C.contains?"":"$";let D=`${q}(?:${r.output})${V}`;r&&r.negated===!0&&(D=`^(?!${D}).*$`);const p=o.toRegex(D,c);return S===!0&&(p.state=r),p},o.makeRe=(r,c={},g=!1,S=!1)=>{if(!r||typeof r!="string")throw new TypeError("Expected a non-empty string");let C={negated:!1,fastpaths:!0};return c.fastpaths!==!1&&(r[0]==="."||r[0]==="*")&&(C.output=s.fastpaths(r,c)),C.output||(C=s(r,c)),o.compileRe(C,c,g,S)},o.toRegex=(r,c)=>{try{const g=c||{};return new RegExp(r,g.flags||(g.nocase?"i":""))}catch(g){if(c&&c.debug===!0)throw g;return/$^/}},o.constants=a,picomatch_1$1=o,picomatch_1$1}var picomatch_1,hasRequiredPicomatch;function requirePicomatch(){if(hasRequiredPicomatch)return picomatch_1;hasRequiredPicomatch=1;const e=requirePicomatch$1(),s=requireUtils$4();function d(a,i,o=!1){return i&&(i.windows===null||i.windows===void 0)&&(i={...i,windows:s.isWindows()}),e(a,i,o)}return Object.assign(d,e),picomatch_1=d,picomatch_1}var hasRequiredDist$1;function requireDist$1(){if(hasRequiredDist$1)return dist$1;hasRequiredDist$1=1;var e=Object.create,s=Object.defineProperty,d=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,i=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,r=(K,X,ie,ae)=>{if(X&&typeof X=="object"||typeof X=="function")for(var he=a(X),ge=0,_e=he.length,Ee;ge<_e;ge++)Ee=he[ge],!o.call(K,Ee)&&Ee!==ie&&s(K,Ee,{get:(Se=>X[Se]).bind(null,Ee),enumerable:!(ae=d(X,Ee))||ae.enumerable});return K},c=(K,X,ie)=>(ie=K!=null?e(i(K)):{},r(!K||!K.__esModule?s(ie,"default",{value:K,enumerable:!0}):ie,K));const g=c(require$$0__default$1),S=c(require$$0__default);function C(K){let X=(0,g.normalize)(K);return X.length>1&&X[X.length-1]===g.sep&&(X=X.substring(0,X.length-1)),X}const q=/[\\/]/g;function V(K,X){return K.replace(q,X)}const D=/^[a-z]:[\\/]$/i;function p(K){return K==="/"||D.test(K)}function b(K,X){const{resolvePaths:ie,normalizePath:ae,pathSeparator:he}=X,ge=process.platform==="win32"&&K.includes("/")||K.startsWith(".");if(ie&&(K=(0,g.resolve)(K)),(ae||ge)&&(K=C(K)),K===".")return"";const _e=K[K.length-1]!==he;return V(_e?K+he:K,he)}function B(K,X){return X+K}function k(K,X){return function(ie,ae){return ae.startsWith(K)?ae.slice(K.length)+ie:V((0,g.relative)(K,ae),X.pathSeparator)+X.pathSeparator+ie}}function L(K){return K}function P(K,X,ie){return X+K+ie}function w(K,X){const{relativePaths:ie,includeBasePath:ae}=X;return ie&&K?k(K,X):ae?B:L}function y(K){return function(X,ie){ie.push(X.substring(K.length)||".")}}function R(K){return function(X,ie,ae){const he=X.substring(K.length)||".";ae.every(ge=>ge(he,!0))&&ie.push(he)}}const E=(K,X)=>{X.push(K||".")},M=(K,X,ie)=>{const ae=K||".";ie.every(he=>he(ae,!0))&&X.push(ae)},O=()=>{};function j(K,X){const{includeDirs:ie,filters:ae,relativePaths:he}=X;return ie?he?ae&&ae.length?R(K):y(K):ae&&ae.length?M:E:O}const $=(K,X,ie,ae)=>{ae.every(he=>he(K,!1))&&ie.files++},W=(K,X,ie,ae)=>{ae.every(he=>he(K,!1))&&X.push(K)},Y=(K,X,ie,ae)=>{ie.files++},Z=(K,X)=>{X.push(K)},u=()=>{};function T(K){const{excludeFiles:X,filters:ie,onlyCounts:ae}=K;return X?u:ie&&ie.length?ae?$:W:ae?Y:Z}const f=K=>K,l=()=>[""].slice(0,0);function v(K){return K.group?l:f}const H=(K,X,ie)=>{K.push({directory:X,files:ie,dir:X})},t=()=>{};function m(K){return K.group?H:t}const x=function(K,X,ie){const{queue:ae,fs:he,options:{suppressErrors:ge}}=X;ae.enqueue(),he.realpath(K,(_e,Ee)=>{if(_e)return ae.dequeue(ge?null:_e,X);he.stat(Ee,(Se,Ae)=>{if(Se)return ae.dequeue(ge?null:Se,X);if(Ae.isDirectory()&&te(K,Ee,X))return ae.dequeue(null,X);ie(Ae,Ee),ae.dequeue(null,X)})})},A=function(K,X,ie){const{queue:ae,fs:he,options:{suppressErrors:ge}}=X;ae.enqueue();try{const _e=he.realpathSync(K),Ee=he.statSync(_e);if(Ee.isDirectory()&&te(K,_e,X))return;ie(Ee,_e)}catch(_e){if(!ge)throw _e}};function F(K,X){return!K.resolveSymlinks||K.excludeSymlinks?null:X?A:x}function te(K,X,ie){if(ie.options.useRealPaths)return Q(X,ie);let ae=(0,g.dirname)(K),he=1;for(;ae!==ie.root&&he<2;){const ge=ie.symlinks.get(ae);!!ge&&(ge===X||ge.startsWith(X)||X.startsWith(ge))?he++:ae=(0,g.dirname)(ae)}return ie.symlinks.set(K,X),he>1}function Q(K,X){return X.visited.includes(K+X.options.pathSeparator)}const h=K=>K.counts,G=K=>K.groups,J=K=>K.paths,ne=K=>K.paths.slice(0,K.options.maxFiles),N=(K,X,ie)=>(fe(X,ie,K.counts,K.options.suppressErrors),null),_=(K,X,ie)=>(fe(X,ie,K.paths,K.options.suppressErrors),null),z=(K,X,ie)=>(fe(X,ie,K.paths.slice(0,K.options.maxFiles),K.options.suppressErrors),null),oe=(K,X,ie)=>(fe(X,ie,K.groups,K.options.suppressErrors),null);function fe(K,X,ie,ae){X(K&&!ae?K:null,ie)}function pe(K,X){const{onlyCounts:ie,group:ae,maxFiles:he}=K;return ie?X?h:N:ae?X?G:oe:he?X?ne:z:X?J:_}const me={withFileTypes:!0},be=(K,X,ie,ae,he)=>{if(K.queue.enqueue(),ae<0)return K.queue.dequeue(null,K);const{fs:ge}=K;K.visited.push(X),K.counts.directories++,ge.readdir(X||".",me,(_e,Ee=[])=>{he(Ee,ie,ae),K.queue.dequeue(K.options.suppressErrors?null:_e,K)})},ve=(K,X,ie,ae,he)=>{const{fs:ge}=K;if(ae<0)return;K.visited.push(X),K.counts.directories++;let _e=[];try{_e=ge.readdirSync(X||".",me)}catch(Ee){if(!K.options.suppressErrors)throw Ee}he(_e,ie,ae)};function xe(K){return K?ve:be}var we=class{count=0;constructor(K){this.onQueueEmpty=K}enqueue(){return this.count++,this.count}dequeue(K,X){this.onQueueEmpty&&(--this.count<=0||K)&&(this.onQueueEmpty(K,X),K&&(X.controller.abort(),this.onQueueEmpty=void 0))}},le=class{_files=0;_directories=0;set files(K){this._files=K}get files(){return this._files}set directories(K){this._directories=K}get directories(){return this._directories}get dirs(){return this._directories}},se=class{aborted=!1;abort(){this.aborted=!0}},re=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(K,X,ie){this.isSynchronous=!ie,this.callbackInvoker=pe(X,this.isSynchronous),this.root=b(K,X),this.state={root:p(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new le,options:X,queue:new we((ae,he)=>this.callbackInvoker(he,ae,ie)),symlinks:new Map,visited:[""].slice(0,0),controller:new se,fs:X.fs||S},this.joinPath=w(this.root,X),this.pushDirectory=j(this.root,X),this.pushFile=T(X),this.getArray=v(X),this.groupFiles=m(X),this.resolveSymlink=F(X,this.isSynchronous),this.walkDirectory=xe(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=(K,X,ie)=>{const{paths:ae,options:{filters:he,resolveSymlinks:ge,excludeSymlinks:_e,exclude:Ee,maxFiles:Se,signal:Ae,useRealPaths:Oe,pathSeparator:Ke},controller:Ce}=this.state;if(Ce.aborted||Ae&&Ae.aborted||Se&&ae.length>Se)return;const He=this.getArray(this.state.paths);for(let Pe=0;Pe<K.length;++Pe){const Ie=K[Pe];if(Ie.isFile()||Ie.isSymbolicLink()&&!ge&&!_e){const Be=this.joinPath(Ie.name,X);this.pushFile(Be,He,this.state.counts,he)}else if(Ie.isDirectory()){let Be=P(Ie.name,X,this.state.options.pathSeparator);if(Ee&&Ee(Ie.name,Be))continue;this.pushDirectory(Be,ae,he),this.walkDirectory(this.state,Be,Be,ie-1,this.walk)}else if(this.resolveSymlink&&Ie.isSymbolicLink()){let Be=B(Ie.name,X);this.resolveSymlink(Be,this.state,(Te,Re)=>{if(Te.isDirectory()){if(Re=b(Re,this.state.options),Ee&&Ee(Ie.name,Oe?Re:Be+Ke))return;this.walkDirectory(this.state,Re,Oe?Re:Be+Ke,ie-1,this.walk)}else{Re=Oe?Re:Be;const Ne=(0,g.basename)(Re),Le=b((0,g.dirname)(Re),this.state.options);Re=this.joinPath(Ne,Le),this.pushFile(Re,He,this.state.counts,he)}})}}this.groupFiles(this.state.groups,X,He)}};function U(K,X){return new Promise((ie,ae)=>{ce(K,X,(he,ge)=>{if(he)return ae(he);ie(ge)})})}function ce(K,X,ie){new re(K,X,ie).start()}function ee(K,X){return new re(K,X).start()}var ue=class{constructor(K,X){this.root=K,this.options=X}withPromise(){return U(this.root,this.options)}withCallback(K){ce(this.root,this.options,K)}sync(){return ee(this.root,this.options)}};let de=null;try{require.resolve("picomatch"),de=requirePicomatch()}catch{}var ye=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:g.sep,filters:[]};globFunction;constructor(K){this.options={...this.options,...K},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(K){return this.options.pathSeparator=K,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(K){return this.options.maxDepth=K,this}withMaxFiles(K){return this.options.maxFiles=K,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:K=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=K,this.withFullPaths()}withAbortSignal(K){return this.options.signal=K,this}normalize(){return this.options.normalizePath=!0,this}filter(K){return this.options.filters.push(K),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(K){return this.options.exclude=K,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(K){return new ue(K||".",this.options)}withGlobFunction(K){return this.globFunction=K,this}crawlWithOptions(K,X){return this.options={...this.options,...X},new ue(K||".",this.options)}glob(...K){return this.globFunction?this.globWithOptions(K):this.globWithOptions(K,{dot:!0})}globWithOptions(K,...X){const ie=this.globFunction||de;if(!ie)throw new Error("Please specify a glob function to use glob matching.");var ae=this.globCache[K.join("\0")];return ae||(ae=ie(K,...X),this.globCache[K.join("\0")]=ae),this.options.filters.push(he=>ae(he)),this}};return dist$1.fdir=ye,dist$1}var ls,hasRequiredLs;function requireLs(){if(hasRequiredLs)return ls;hasRequiredLs=1;const{fdir:e}=requireDist$1(),s=require$$0__default$1,d=requirePicomatch();class a{constructor(o="./",r=[".env*"],c=[]){this.ignore=["node_modules/**",".git/**"],this.cwd=s.resolve(o),this.envFile=r,this.excludeEnvFile=c}run(){return this._filepaths()}_filepaths(){const o=d(this._exclude()),r=d(this._patterns(),{ignore:this._exclude()});return new e().withRelativePaths().exclude((c,g)=>o(g)).filter(c=>r(c)).crawl(this.cwd).sync()}_patterns(){return Array.isArray(this.envFile)?this.envFile.map(o=>`**/${o}`):[`**/${this.envFile}`]}_excludePatterns(){return Array.isArray(this.excludeEnvFile)?this.excludeEnvFile.map(o=>`**/${o}`):[`**/${this.excludeEnvFile}`]}_exclude(){return this._excludePatterns().length>0?this.ignore.concat(this._excludePatterns()):this.ignore}}return ls=a,ls}var fsx_1,hasRequiredFsx;function requireFsx(){if(hasRequiredFsx)return fsx_1;hasRequiredFsx=1;const e=require$$0__default,s="utf8";async function d(g,S=null){return S||(S=s),e.promises.readFile(g,S)}function a(g,S=null){return S||(S=s),e.readFileSync(g,S)}function i(g,S){return e.writeFileSync(g,S,s)}async function o(g,S){return e.promises.writeFile(g,S,s)}async function r(g){try{return await e.promises.access(g),!0}catch{return!1}}return fsx_1={chmodSync:e.chmodSync,exists:r,existsSync:e.existsSync,readdirSync:e.readdirSync,readFileSync:e.readFileSync,writeFileSync:e.writeFileSync,appendFileSync:e.appendFileSync,readFileX:d,readFileXSync:a,writeFileX:o,writeFileXSync:i},fsx_1}var dist={},utils$3={},hasRequiredUtils$3;function requireUtils$3(){return hasRequiredUtils$3||(hasRequiredUtils$3=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=s,e.abool=d,e.anumber=a,e.abytes=i,e.ahash=o,e.aexists=r,e.aoutput=c,e.u8=g,e.u32=S,e.clean=C,e.createView=q,e.bytesToHex=p,e.hexToBytes=k,e.hexToNumber=L,e.bytesToNumberBE=P,e.numberToBytesBE=w,e.utf8ToBytes=R,e.bytesToUtf8=E,e.toBytes=M,e.overlapBytes=O,e.complexOverlapBytes=j,e.concatBytes=$,e.checkOpts=W,e.equalBytes=Y,e.getOutput=T,e.setBigUint64=f,e.u64Lengths=l,e.isAligned32=v,e.copyBytes=H;function s(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function d(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function a(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function i(t,...m){if(!s(t))throw new Error("Uint8Array expected");if(m.length>0&&!m.includes(t.length))throw new Error("Uint8Array expected of length "+m+", got length="+t.length)}function o(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");a(t.outputLen),a(t.blockLen)}function r(t,m=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(m&&t.finished)throw new Error("Hash#digest() has already been called")}function c(t,m){i(t);const x=m.outputLen;if(t.length<x)throw new Error("digestInto() expects output buffer of length at least "+x)}function g(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function S(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function C(...t){for(let m=0;m<t.length;m++)t[m].fill(0)}function q(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const V=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",D=Array.from({length:256},(t,m)=>m.toString(16).padStart(2,"0"));function p(t){if(i(t),V)return t.toHex();let m="";for(let x=0;x<t.length;x++)m+=D[t[x]];return m}const b={_0:48,_9:57,A:65,F:70,a:97,f:102};function B(t){if(t>=b._0&&t<=b._9)return t-b._0;if(t>=b.A&&t<=b.F)return t-(b.A-10);if(t>=b.a&&t<=b.f)return t-(b.a-10)}function k(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(V)return Uint8Array.fromHex(t);const m=t.length,x=m/2;if(m%2)throw new Error("hex string expected, got unpadded hex of length "+m);const A=new Uint8Array(x);for(let F=0,te=0;F<x;F++,te+=2){const Q=B(t.charCodeAt(te)),h=B(t.charCodeAt(te+1));if(Q===void 0||h===void 0){const G=t[te]+t[te+1];throw new Error('hex string expected, got non-hex character "'+G+'" at index '+te)}A[F]=Q*16+h}return A}function L(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":"0x"+t)}function P(t){return L(p(t))}function w(t,m){return k(t.toString(16).padStart(m*2,"0"))}const y=async()=>{};e.nextTick=y;function R(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 M(t){if(typeof t=="string")t=R(t);else if(s(t))t=H(t);else throw new Error("Uint8Array expected, got "+typeof t);return t}function O(t,m){return t.buffer===m.buffer&&t.byteOffset<m.byteOffset+m.byteLength&&m.byteOffset<t.byteOffset+t.byteLength}function j(t,m){if(O(t,m)&&t.byteOffset<m.byteOffset)throw new Error("complex overlap of input and output is not supported")}function $(...t){let m=0;for(let A=0;A<t.length;A++){const F=t[A];i(F),m+=F.length}const x=new Uint8Array(m);for(let A=0,F=0;A<t.length;A++){const te=t[A];x.set(te,F),F+=te.length}return x}function W(t,m){if(m==null||typeof m!="object")throw new Error("options must be defined");return Object.assign(t,m)}function Y(t,m){if(t.length!==m.length)return!1;let x=0;for(let A=0;A<t.length;A++)x|=t[A]^m[A];return x===0}class Z{}e.Hash=Z;const u=(t,m)=>{function x(A,...F){if(i(A),!e.isLE)throw new Error("Non little-endian hardware is not yet supported");if(t.nonceLength!==void 0){const ne=F[0];if(!ne)throw new Error("nonce / iv required");t.varSizeNonce?i(ne):i(ne,t.nonceLength)}const te=t.tagLength;te&&F[1]!==void 0&&i(F[1]);const Q=m(A,...F),h=(ne,N)=>{if(N!==void 0){if(ne!==2)throw new Error("cipher output not supported");i(N)}};let G=!1;return{encrypt(ne,N){if(G)throw new Error("cannot encrypt() twice with same key + nonce");return G=!0,i(ne),h(Q.encrypt.length,N),Q.encrypt(ne,N)},decrypt(ne,N){if(i(ne),te&&ne.length<te)throw new Error("invalid ciphertext length: smaller than tagLength="+te);return h(Q.decrypt.length,N),Q.decrypt(ne,N)}}}return Object.assign(x,t),x};e.wrapCipher=u;function T(t,m,x=!0){if(m===void 0)return new Uint8Array(t);if(m.length!==t)throw new Error("invalid output length, expected "+t+", got: "+m.length);if(x&&!v(m))throw new Error("invalid output, must be aligned");return m}function f(t,m,x,A){if(typeof t.setBigUint64=="function")return t.setBigUint64(m,x,A);const F=BigInt(32),te=BigInt(4294967295),Q=Number(x>>F&te),h=Number(x&te),G=A?4:0,J=A?0:4;t.setUint32(m+G,Q,A),t.setUint32(m+J,h,A)}function l(t,m,x){d(x);const A=new Uint8Array(16),F=q(A);return f(F,0,BigInt(m),x),f(F,8,BigInt(t),x),A}function v(t){return t.byteOffset%4===0}function H(t){return Uint8Array.from(t)}})(utils$3)),utils$3}var config={},consts={},hasRequiredConsts;function requireConsts(){return hasRequiredConsts||(hasRequiredConsts=1,Object.defineProperty(consts,"__esModule",{value:!0}),consts.AEAD_TAG_LENGTH=consts.XCHACHA20_NONCE_LENGTH=consts.CURVE25519_PUBLIC_KEY_SIZE=consts.ETH_PUBLIC_KEY_SIZE=consts.UNCOMPRESSED_PUBLIC_KEY_SIZE=consts.COMPRESSED_PUBLIC_KEY_SIZE=consts.SECRET_KEY_LENGTH=void 0,consts.SECRET_KEY_LENGTH=32,consts.COMPRESSED_PUBLIC_KEY_SIZE=33,consts.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,consts.ETH_PUBLIC_KEY_SIZE=64,consts.CURVE25519_PUBLIC_KEY_SIZE=32,consts.XCHACHA20_NONCE_LENGTH=24,consts.AEAD_TAG_LENGTH=16),consts}var hasRequiredConfig$1;function requireConfig$1(){return hasRequiredConfig$1||(hasRequiredConfig$1=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 s=requireConsts(),d=(function(){function S(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16}return S})();e.ECIES_CONFIG=new d;var a=function(){return e.ECIES_CONFIG.ellipticCurve};e.ellipticCurve=a;var i=function(){return e.ECIES_CONFIG.isEphemeralKeyCompressed};e.isEphemeralKeyCompressed=i;var o=function(){return e.ECIES_CONFIG.isHkdfKeyCompressed};e.isHkdfKeyCompressed=o;var r=function(){return e.ECIES_CONFIG.symmetricAlgorithm};e.symmetricAlgorithm=r;var c=function(){return e.ECIES_CONFIG.symmetricNonceLength};e.symmetricNonceLength=c;var g=function(){var S={secp256k1:e.ECIES_CONFIG.isEphemeralKeyCompressed?s.COMPRESSED_PUBLIC_KEY_SIZE:s.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:s.CURVE25519_PUBLIC_KEY_SIZE,ed25519:s.CURVE25519_PUBLIC_KEY_SIZE};if(e.ECIES_CONFIG.ellipticCurve in S)return S[e.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")};e.ephemeralKeySize=g})(config)),config}var keys={},PrivateKey={},utils$2={},elliptic={},webcrypto={},crypto$1={},hasRequiredCrypto$1;function requireCrypto$1(){return hasRequiredCrypto$1||(hasRequiredCrypto$1=1,Object.defineProperty(crypto$1,"__esModule",{value:!0}),crypto$1.crypto=void 0,crypto$1.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),crypto$1}var hasRequiredWebcrypto;function requireWebcrypto(){return hasRequiredWebcrypto||(hasRequiredWebcrypto=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.gcm=e.ctr=e.cbc=e.utils=void 0,e.randomBytes=a,e.getWebcryptoSubtle=i,e.managedNonce=o;const s=requireCrypto$1(),d=requireUtils$3();function a(S=32){if(s.crypto&&typeof s.crypto.getRandomValues=="function")return s.crypto.getRandomValues(new Uint8Array(S));if(s.crypto&&typeof s.crypto.randomBytes=="function")return Uint8Array.from(s.crypto.randomBytes(S));throw new Error("crypto.getRandomValues must be defined")}function i(){if(s.crypto&&typeof s.crypto.subtle=="object"&&s.crypto.subtle!=null)return s.crypto.subtle;throw new Error("crypto.subtle must be defined")}function o(S){const{nonceLength:C}=S;return(0,d.anumber)(C),((q,...V)=>({encrypt(D,...p){const b=a(C),B=S(q,b,...V).encrypt(D,...p),k=(0,d.concatBytes)(b,B);return B.fill(0),k},decrypt(D,...p){const b=D.subarray(0,C),B=D.subarray(C);return S(q,b,...V).decrypt(B,...p)}}))}e.utils={async encrypt(S,C,q,V){const D=i(),p=await D.importKey("raw",S,C,!0,["encrypt"]),b=await D.encrypt(q,p,V);return new Uint8Array(b)},async decrypt(S,C,q,V){const D=i(),p=await D.importKey("raw",S,C,!0,["decrypt"]),b=await D.decrypt(q,p,V);return new Uint8Array(b)}};const r={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function c(S,C,q){if(S===r.CBC)return{name:r.CBC,iv:C};if(S===r.CTR)return{name:r.CTR,counter:C,length:64};if(S===r.GCM)return q?{name:r.GCM,iv:C,additionalData:q}:{name:r.GCM,iv:C};throw new Error("unknown aes block mode")}function g(S){return(C,q,V)=>{(0,d.abytes)(C),(0,d.abytes)(q);const D={name:S,length:C.length*8},p=c(S,q,V);let b=!1;return{encrypt(B){if((0,d.abytes)(B),b)throw new Error("Cannot encrypt() twice with same key / nonce");return b=!0,e.utils.encrypt(C,D,p,B)},decrypt(B){return(0,d.abytes)(B),e.utils.decrypt(C,D,p,B)}}}}e.cbc=g(r.CBC),e.ctr=g(r.CTR),e.gcm=g(r.GCM)})(webcrypto)),webcrypto}var ed25519={},sha2={},_md={},utils$1={},crypto={},hasRequiredCrypto;function requireCrypto(){return hasRequiredCrypto||(hasRequiredCrypto=1,Object.defineProperty(crypto,"__esModule",{value:!0}),crypto.crypto=void 0,crypto.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),crypto}var hasRequiredUtils$2;function requireUtils$2(){return hasRequiredUtils$2||(hasRequiredUtils$2=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=d,e.anumber=a,e.abytes=i,e.ahash=o,e.aexists=r,e.aoutput=c,e.u8=g,e.u32=S,e.clean=C,e.createView=q,e.rotr=V,e.rotl=D,e.byteSwap=p,e.byteSwap32=b,e.bytesToHex=L,e.hexToBytes=y,e.asyncLoop=E,e.utf8ToBytes=M,e.bytesToUtf8=O,e.toBytes=j,e.kdfInputToBytes=$,e.concatBytes=W,e.checkOpts=Y,e.createHasher=u,e.createOptHasher=T,e.createXOFer=f,e.randomBytes=l;const s=requireCrypto();function d(v){return v instanceof Uint8Array||ArrayBuffer.isView(v)&&v.constructor.name==="Uint8Array"}function a(v){if(!Number.isSafeInteger(v)||v<0)throw new Error("positive integer expected, got "+v)}function i(v,...H){if(!d(v))throw new Error("Uint8Array expected");if(H.length>0&&!H.includes(v.length))throw new Error("Uint8Array expected of length "+H+", got length="+v.length)}function o(v){if(typeof v!="function"||typeof v.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");a(v.outputLen),a(v.blockLen)}function r(v,H=!0){if(v.destroyed)throw new Error("Hash instance has been destroyed");if(H&&v.finished)throw new Error("Hash#digest() has already been called")}function c(v,H){i(v);const t=H.outputLen;if(v.length<t)throw new Error("digestInto() expects output buffer of length at least "+t)}function g(v){return new Uint8Array(v.buffer,v.byteOffset,v.byteLength)}function S(v){return new Uint32Array(v.buffer,v.byteOffset,Math.floor(v.byteLength/4))}function C(...v){for(let H=0;H<v.length;H++)v[H].fill(0)}function q(v){return new DataView(v.buffer,v.byteOffset,v.byteLength)}function V(v,H){return v<<32-H|v>>>H}function D(v,H){return v<<H|v>>>32-H>>>0}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function p(v){return v<<24&4278190080|v<<8&16711680|v>>>8&65280|v>>>24&255}e.swap8IfBE=e.isLE?v=>v:v=>p(v),e.byteSwapIfBE=e.swap8IfBE;function b(v){for(let H=0;H<v.length;H++)v[H]=p(v[H]);return v}e.swap32IfBE=e.isLE?v=>v:b;const B=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",k=Array.from({length:256},(v,H)=>H.toString(16).padStart(2,"0"));function L(v){if(i(v),B)return v.toHex();let H="";for(let t=0;t<v.length;t++)H+=k[v[t]];return H}const P={_0:48,_9:57,A:65,F:70,a:97,f:102};function w(v){if(v>=P._0&&v<=P._9)return v-P._0;if(v>=P.A&&v<=P.F)return v-(P.A-10);if(v>=P.a&&v<=P.f)return v-(P.a-10)}function y(v){if(typeof v!="string")throw new Error("hex string expected, got "+typeof v);if(B)return Uint8Array.fromHex(v);const H=v.length,t=H/2;if(H%2)throw new Error("hex string expected, got unpadded hex of length "+H);const m=new Uint8Array(t);for(let x=0,A=0;x<t;x++,A+=2){const F=w(v.charCodeAt(A)),te=w(v.charCodeAt(A+1));if(F===void 0||te===void 0){const Q=v[A]+v[A+1];throw new Error('hex string expected, got non-hex character "'+Q+'" at index '+A)}m[x]=F*16+te}return m}const R=async()=>{};e.nextTick=R;async function E(v,H,t){let m=Date.now();for(let x=0;x<v;x++){t(x);const A=Date.now()-m;A>=0&&A<H||(await(0,e.nextTick)(),m+=A)}}function M(v){if(typeof v!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(v))}function O(v){return new TextDecoder().decode(v)}function j(v){return typeof v=="string"&&(v=M(v)),i(v),v}function $(v){return typeof v=="string"&&(v=M(v)),i(v),v}function W(...v){let H=0;for(let m=0;m<v.length;m++){const x=v[m];i(x),H+=x.length}const t=new Uint8Array(H);for(let m=0,x=0;m<v.length;m++){const A=v[m];t.set(A,x),x+=A.length}return t}function Y(v,H){if(H!==void 0&&{}.toString.call(H)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(v,H)}class Z{}e.Hash=Z;function u(v){const H=m=>v().update(j(m)).digest(),t=v();return H.outputLen=t.outputLen,H.blockLen=t.blockLen,H.create=()=>v(),H}function T(v){const H=(m,x)=>v(x).update(j(m)).digest(),t=v({});return H.outputLen=t.outputLen,H.blockLen=t.blockLen,H.create=m=>v(m),H}function f(v){const H=(m,x)=>v(x).update(j(m)).digest(),t=v({});return H.outputLen=t.outputLen,H.blockLen=t.blockLen,H.create=m=>v(m),H}e.wrapConstructor=u,e.wrapConstructorWithOpts=T,e.wrapXOFConstructorWithOpts=f;function l(v=32){if(s.crypto&&typeof s.crypto.getRandomValues=="function")return s.crypto.getRandomValues(new Uint8Array(v));if(s.crypto&&typeof s.crypto.randomBytes=="function")return Uint8Array.from(s.crypto.randomBytes(v));throw new Error("crypto.getRandomValues must be defined")}})(utils$1)),utils$1}var hasRequired_md;function require_md(){if(hasRequired_md)return _md;hasRequired_md=1,Object.defineProperty(_md,"__esModule",{value:!0}),_md.SHA512_IV=_md.SHA384_IV=_md.SHA224_IV=_md.SHA256_IV=_md.HashMD=void 0,_md.setBigUint64=s,_md.Chi=d,_md.Maj=a;const e=requireUtils$2();function s(o,r,c,g){if(typeof o.setBigUint64=="function")return o.setBigUint64(r,c,g);const S=BigInt(32),C=BigInt(4294967295),q=Number(c>>S&C),V=Number(c&C),D=g?4:0,p=g?0:4;o.setUint32(r+D,q,g),o.setUint32(r+p,V,g)}function d(o,r,c){return o&r^~o&c}function a(o,r,c){return o&r^o&c^r&c}class i extends e.Hash{constructor(r,c,g,S){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=r,this.outputLen=c,this.padOffset=g,this.isLE=S,this.buffer=new Uint8Array(r),this.view=(0,e.createView)(this.buffer)}update(r){(0,e.aexists)(this),r=(0,e.toBytes)(r),(0,e.abytes)(r);const{view:c,buffer:g,blockLen:S}=this,C=r.length;for(let q=0;q<C;){const V=Math.min(S-this.pos,C-q);if(V===S){const D=(0,e.createView)(r);for(;S<=C-q;q+=S)this.process(D,q);continue}g.set(r.subarray(q,q+V),this.pos),this.pos+=V,q+=V,this.pos===S&&(this.process(c,0),this.pos=0)}return this.length+=r.length,this.roundClean(),this}digestInto(r){(0,e.aexists)(this),(0,e.aoutput)(r,this),this.finished=!0;const{buffer:c,view:g,blockLen:S,isLE:C}=this;let{pos:q}=this;c[q++]=128,(0,e.clean)(this.buffer.subarray(q)),this.padOffset>S-q&&(this.process(g,0),q=0);for(let B=q;B<S;B++)c[B]=0;s(g,S-8,BigInt(this.length*8),C),this.process(g,0);const V=(0,e.createView)(r),D=this.outputLen;if(D%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const p=D/4,b=this.get();if(p>b.length)throw new Error("_sha2: outputLen bigger than state");for(let B=0;B<p;B++)V.setUint32(4*B,b[B],C)}digest(){const{buffer:r,outputLen:c}=this;this.digestInto(r);const g=r.slice(0,c);return this.destroy(),g}_cloneInto(r){r||(r=new this.constructor),r.set(...this.get());const{blockLen:c,buffer:g,length:S,finished:C,destroyed:q,pos:V}=this;return r.destroyed=q,r.finished=C,r.length=S,r.pos=V,S%c&&r.buffer.set(g),r}clone(){return this._cloneInto()}}return _md.HashMD=i,_md.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),_md.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),_md.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),_md.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),_md}var _u64={},hasRequired_u64;function require_u64(){if(hasRequired_u64)return _u64;hasRequired_u64=1,Object.defineProperty(_u64,"__esModule",{value:!0}),_u64.toBig=_u64.shrSL=_u64.shrSH=_u64.rotrSL=_u64.rotrSH=_u64.rotrBL=_u64.rotrBH=_u64.rotr32L=_u64.rotr32H=_u64.rotlSL=_u64.rotlSH=_u64.rotlBL=_u64.rotlBH=_u64.add5L=_u64.add5H=_u64.add4L=_u64.add4H=_u64.add3L=_u64.add3H=void 0,_u64.add=k,_u64.fromBig=d,_u64.split=a;const e=BigInt(2**32-1),s=BigInt(32);function d(O,j=!1){return j?{h:Number(O&e),l:Number(O>>s&e)}:{h:Number(O>>s&e)|0,l:Number(O&e)|0}}function a(O,j=!1){const $=O.length;let W=new Uint32Array($),Y=new Uint32Array($);for(let Z=0;Z<$;Z++){const{h:u,l:T}=d(O[Z],j);[W[Z],Y[Z]]=[u,T]}return[W,Y]}const i=(O,j)=>BigInt(O>>>0)<<s|BigInt(j>>>0);_u64.toBig=i;const o=(O,j,$)=>O>>>$;_u64.shrSH=o;const r=(O,j,$)=>O<<32-$|j>>>$;_u64.shrSL=r;const c=(O,j,$)=>O>>>$|j<<32-$;_u64.rotrSH=c;const g=(O,j,$)=>O<<32-$|j>>>$;_u64.rotrSL=g;const S=(O,j,$)=>O<<64-$|j>>>$-32;_u64.rotrBH=S;const C=(O,j,$)=>O>>>$-32|j<<64-$;_u64.rotrBL=C;const q=(O,j)=>j;_u64.rotr32H=q;const V=(O,j)=>O;_u64.rotr32L=V;const D=(O,j,$)=>O<<$|j>>>32-$;_u64.rotlSH=D;const p=(O,j,$)=>j<<$|O>>>32-$;_u64.rotlSL=p;const b=(O,j,$)=>j<<$-32|O>>>64-$;_u64.rotlBH=b;const B=(O,j,$)=>O<<$-32|j>>>64-$;_u64.rotlBL=B;function k(O,j,$,W){const Y=(j>>>0)+(W>>>0);return{h:O+$+(Y/2**32|0)|0,l:Y|0}}const L=(O,j,$)=>(O>>>0)+(j>>>0)+($>>>0);_u64.add3L=L;const P=(O,j,$,W)=>j+$+W+(O/2**32|0)|0;_u64.add3H=P;const w=(O,j,$,W)=>(O>>>0)+(j>>>0)+($>>>0)+(W>>>0);_u64.add4L=w;const y=(O,j,$,W,Y)=>j+$+W+Y+(O/2**32|0)|0;_u64.add4H=y;const R=(O,j,$,W,Y)=>(O>>>0)+(j>>>0)+($>>>0)+(W>>>0)+(Y>>>0);_u64.add5L=R;const E=(O,j,$,W,Y,Z)=>j+$+W+Y+Z+(O/2**32|0)|0;_u64.add5H=E;const M={fromBig:d,split:a,toBig:i,shrSH:o,shrSL:r,rotrSH:c,rotrSL:g,rotrBH:S,rotrBL:C,rotr32H:q,rotr32L:V,rotlSH:D,rotlSL:p,rotlBH:b,rotlBL:B,add:k,add3L:L,add3H:P,add4L:w,add4H:y,add5H:E,add5L:R};return _u64.default=M,_u64}var hasRequiredSha2;function requireSha2(){if(hasRequiredSha2)return sha2;hasRequiredSha2=1,Object.defineProperty(sha2,"__esModule",{value:!0}),sha2.sha512_224=sha2.sha512_256=sha2.sha384=sha2.sha512=sha2.sha224=sha2.sha256=sha2.SHA512_256=sha2.SHA512_224=sha2.SHA384=sha2.SHA512=sha2.SHA224=sha2.SHA256=void 0;const e=require_md(),s=require_u64(),d=requireUtils$2(),a=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]),i=new Uint32Array(64);class o extends e.HashMD{constructor(P=32){super(64,P,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:P,B:w,C:y,D:R,E,F:M,G:O,H:j}=this;return[P,w,y,R,E,M,O,j]}set(P,w,y,R,E,M,O,j){this.A=P|0,this.B=w|0,this.C=y|0,this.D=R|0,this.E=E|0,this.F=M|0,this.G=O|0,this.H=j|0}process(P,w){for(let Y=0;Y<16;Y++,w+=4)i[Y]=P.getUint32(w,!1);for(let Y=16;Y<64;Y++){const Z=i[Y-15],u=i[Y-2],T=(0,d.rotr)(Z,7)^(0,d.rotr)(Z,18)^Z>>>3,f=(0,d.rotr)(u,17)^(0,d.rotr)(u,19)^u>>>10;i[Y]=f+i[Y-7]+T+i[Y-16]|0}let{A:y,B:R,C:E,D:M,E:O,F:j,G:$,H:W}=this;for(let Y=0;Y<64;Y++){const Z=(0,d.rotr)(O,6)^(0,d.rotr)(O,11)^(0,d.rotr)(O,25),u=W+Z+(0,e.Chi)(O,j,$)+a[Y]+i[Y]|0,f=((0,d.rotr)(y,2)^(0,d.rotr)(y,13)^(0,d.rotr)(y,22))+(0,e.Maj)(y,R,E)|0;W=$,$=j,j=O,O=M+u|0,M=E,E=R,R=y,y=u+f|0}y=y+this.A|0,R=R+this.B|0,E=E+this.C|0,M=M+this.D|0,O=O+this.E|0,j=j+this.F|0,$=$+this.G|0,W=W+this.H|0,this.set(y,R,E,M,O,j,$,W)}roundClean(){(0,d.clean)(i)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,d.clean)(this.buffer)}}sha2.SHA256=o;class r extends o{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}}sha2.SHA224=r;const c=s.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(L=>BigInt(L))),g=c[0],S=c[1],C=new Uint32Array(80),q=new Uint32Array(80);class V extends e.HashMD{constructor(P=64){super(128,P,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:P,Al:w,Bh:y,Bl:R,Ch:E,Cl:M,Dh:O,Dl:j,Eh:$,El:W,Fh:Y,Fl:Z,Gh:u,Gl:T,Hh:f,Hl:l}=this;return[P,w,y,R,E,M,O,j,$,W,Y,Z,u,T,f,l]}set(P,w,y,R,E,M,O,j,$,W,Y,Z,u,T,f,l){this.Ah=P|0,this.Al=w|0,this.Bh=y|0,this.Bl=R|0,this.Ch=E|0,this.Cl=M|0,this.Dh=O|0,this.Dl=j|0,this.Eh=$|0,this.El=W|0,this.Fh=Y|0,this.Fl=Z|0,this.Gh=u|0,this.Gl=T|0,this.Hh=f|0,this.Hl=l|0}process(P,w){for(let t=0;t<16;t++,w+=4)C[t]=P.getUint32(w),q[t]=P.getUint32(w+=4);for(let t=16;t<80;t++){const m=C[t-15]|0,x=q[t-15]|0,A=s.rotrSH(m,x,1)^s.rotrSH(m,x,8)^s.shrSH(m,x,7),F=s.rotrSL(m,x,1)^s.rotrSL(m,x,8)^s.shrSL(m,x,7),te=C[t-2]|0,Q=q[t-2]|0,h=s.rotrSH(te,Q,19)^s.rotrBH(te,Q,61)^s.shrSH(te,Q,6),G=s.rotrSL(te,Q,19)^s.rotrBL(te,Q,61)^s.shrSL(te,Q,6),J=s.add4L(F,G,q[t-7],q[t-16]),ne=s.add4H(J,A,h,C[t-7],C[t-16]);C[t]=ne|0,q[t]=J|0}let{Ah:y,Al:R,Bh:E,Bl:M,Ch:O,Cl:j,Dh:$,Dl:W,Eh:Y,El:Z,Fh:u,Fl:T,Gh:f,Gl:l,Hh:v,Hl:H}=this;for(let t=0;t<80;t++){const m=s.rotrSH(Y,Z,14)^s.rotrSH(Y,Z,18)^s.rotrBH(Y,Z,41),x=s.rotrSL(Y,Z,14)^s.rotrSL(Y,Z,18)^s.rotrBL(Y,Z,41),A=Y&u^~Y&f,F=Z&T^~Z&l,te=s.add5L(H,x,F,S[t],q[t]),Q=s.add5H(te,v,m,A,g[t],C[t]),h=te|0,G=s.rotrSH(y,R,28)^s.rotrBH(y,R,34)^s.rotrBH(y,R,39),J=s.rotrSL(y,R,28)^s.rotrBL(y,R,34)^s.rotrBL(y,R,39),ne=y&E^y&O^E&O,N=R&M^R&j^M&j;v=f|0,H=l|0,f=u|0,l=T|0,u=Y|0,T=Z|0,{h:Y,l:Z}=s.add($|0,W|0,Q|0,h|0),$=O|0,W=j|0,O=E|0,j=M|0,E=y|0,M=R|0;const _=s.add3L(h,J,N);y=s.add3H(_,Q,G,ne),R=_|0}({h:y,l:R}=s.add(this.Ah|0,this.Al|0,y|0,R|0)),{h:E,l:M}=s.add(this.Bh|0,this.Bl|0,E|0,M|0),{h:O,l:j}=s.add(this.Ch|0,this.Cl|0,O|0,j|0),{h:$,l:W}=s.add(this.Dh|0,this.Dl|0,$|0,W|0),{h:Y,l:Z}=s.add(this.Eh|0,this.El|0,Y|0,Z|0),{h:u,l:T}=s.add(this.Fh|0,this.Fl|0,u|0,T|0),{h:f,l}=s.add(this.Gh|0,this.Gl|0,f|0,l|0),{h:v,l:H}=s.add(this.Hh|0,this.Hl|0,v|0,H|0),this.set(y,R,E,M,O,j,$,W,Y,Z,u,T,f,l,v,H)}roundClean(){(0,d.clean)(C,q)}destroy(){(0,d.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}sha2.SHA512=V;class D extends V{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}}sha2.SHA384=D;const p=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),b=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class B extends V{constructor(){super(28),this.Ah=p[0]|0,this.Al=p[1]|0,this.Bh=p[2]|0,this.Bl=p[3]|0,this.Ch=p[4]|0,this.Cl=p[5]|0,this.Dh=p[6]|0,this.Dl=p[7]|0,this.Eh=p[8]|0,this.El=p[9]|0,this.Fh=p[10]|0,this.Fl=p[11]|0,this.Gh=p[12]|0,this.Gl=p[13]|0,this.Hh=p[14]|0,this.Hl=p[15]|0}}sha2.SHA512_224=B;class k extends V{constructor(){super(32),this.Ah=b[0]|0,this.Al=b[1]|0,this.Bh=b[2]|0,this.Bl=b[3]|0,this.Ch=b[4]|0,this.Cl=b[5]|0,this.Dh=b[6]|0,this.Dl=b[7]|0,this.Eh=b[8]|0,this.El=b[9]|0,this.Fh=b[10]|0,this.Fl=b[11]|0,this.Gh=b[12]|0,this.Gl=b[13]|0,this.Hh=b[14]|0,this.Hl=b[15]|0}}return sha2.SHA512_256=k,sha2.sha256=(0,d.createHasher)(()=>new o),sha2.sha224=(0,d.createHasher)(()=>new r),sha2.sha512=(0,d.createHasher)(()=>new V),sha2.sha384=(0,d.createHasher)(()=>new D),sha2.sha512_256=(0,d.createHasher)(()=>new k),sha2.sha512_224=(0,d.createHasher)(()=>new B),sha2}var curve={},utils={},hasRequiredUtils$1;function requireUtils$1(){return hasRequiredUtils$1||(hasRequiredUtils$1=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=o,e._abool2=r,e._abytes2=c,e.numberToHexUnpadded=g,e.hexToNumber=S,e.bytesToNumberBE=C,e.bytesToNumberLE=q,e.numberToBytesBE=V,e.numberToBytesLE=D,e.numberToVarBytesBE=p,e.ensureBytes=b,e.equalBytes=B,e.copyBytes=k,e.asciiToBytes=L,e.inRange=w,e.aInRange=y,e.bitLen=R,e.bitGet=E,e.bitSet=M,e.createHmacDrbg=j,e.validateObject=W,e.isHash=Y,e._validateObject=Z,e.memoized=T;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const s=requireUtils$2();var d=requireUtils$2();Object.defineProperty(e,"abytes",{enumerable:!0,get:function(){return d.abytes}}),Object.defineProperty(e,"anumber",{enumerable:!0,get:function(){return d.anumber}}),Object.defineProperty(e,"bytesToHex",{enumerable:!0,get:function(){return d.bytesToHex}}),Object.defineProperty(e,"bytesToUtf8",{enumerable:!0,get:function(){return d.bytesToUtf8}}),Object.defineProperty(e,"concatBytes",{enumerable:!0,get:function(){return d.concatBytes}}),Object.defineProperty(e,"hexToBytes",{enumerable:!0,get:function(){return d.hexToBytes}}),Object.defineProperty(e,"isBytes",{enumerable:!0,get:function(){return d.isBytes}}),Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return d.randomBytes}}),Object.defineProperty(e,"utf8ToBytes",{enumerable:!0,get:function(){return d.utf8ToBytes}});const a=BigInt(0),i=BigInt(1);function o(f,l){if(typeof l!="boolean")throw new Error(f+" boolean expected, got "+l)}function r(f,l=""){if(typeof f!="boolean"){const v=l&&`"${l}"`;throw new Error(v+"expected boolean, got type="+typeof f)}return f}function c(f,l,v=""){const H=(0,s.isBytes)(f),t=f?.length,m=l!==void 0;if(!H||m&&t!==l){const x=v&&`"${v}" `,A=m?` of length ${l}`:"",F=H?`length=${t}`:`type=${typeof f}`;throw new Error(x+"expected Uint8Array"+A+", got "+F)}return f}function g(f){const l=f.toString(16);return l.length&1?"0"+l:l}function S(f){if(typeof f!="string")throw new Error("hex string expected, got "+typeof f);return f===""?a:BigInt("0x"+f)}function C(f){return S((0,s.bytesToHex)(f))}function q(f){return(0,s.abytes)(f),S((0,s.bytesToHex)(Uint8Array.from(f).reverse()))}function V(f,l){return(0,s.hexToBytes)(f.toString(16).padStart(l*2,"0"))}function D(f,l){return V(f,l).reverse()}function p(f){return(0,s.hexToBytes)(g(f))}function b(f,l,v){let H;if(typeof l=="string")try{H=(0,s.hexToBytes)(l)}catch(m){throw new Error(f+" must be hex string or Uint8Array, cause: "+m)}else if((0,s.isBytes)(l))H=Uint8Array.from(l);else throw new Error(f+" must be hex string or Uint8Array");const t=H.length;if(typeof v=="number"&&t!==v)throw new Error(f+" of length "+v+" expected, got "+t);return H}function B(f,l){if(f.length!==l.length)return!1;let v=0;for(let H=0;H<f.length;H++)v|=f[H]^l[H];return v===0}function k(f){return Uint8Array.from(f)}function L(f){return Uint8Array.from(f,(l,v)=>{const H=l.charCodeAt(0);if(l.length!==1||H>127)throw new Error(`string contains non-ASCII character "${f[v]}" with code ${H} at position ${v}`);return H})}const P=f=>typeof f=="bigint"&&a<=f;function w(f,l,v){return P(f)&&P(l)&&P(v)&&l<=f&&f<v}function y(f,l,v,H){if(!w(l,v,H))throw new Error("expected valid "+f+": "+v+" <= n < "+H+", got "+l)}function R(f){let l;for(l=0;f>a;f>>=i,l+=1);return l}function E(f,l){return f>>BigInt(l)&i}function M(f,l,v){return f|(v?i:a)<<BigInt(l)}const O=f=>(i<<BigInt(f))-i;e.bitMask=O;function j(f,l,v){if(typeof f!="number"||f<2)throw new Error("hashLen must be a number");if(typeof l!="number"||l<2)throw new Error("qByteLen must be a number");if(typeof v!="function")throw new Error("hmacFn must be a function");const H=J=>new Uint8Array(J),t=J=>Uint8Array.of(J);let m=H(f),x=H(f),A=0;const F=()=>{m.fill(1),x.fill(0),A=0},te=(...J)=>v(x,m,...J),Q=(J=H(0))=>{x=te(t(0),J),m=te(),J.length!==0&&(x=te(t(1),J),m=te())},h=()=>{if(A++>=1e3)throw new Error("drbg: tried 1000 values");let J=0;const ne=[];for(;J<l;){m=te();const N=m.slice();ne.push(N),J+=m.length}return(0,s.concatBytes)(...ne)};return(J,ne)=>{F(),Q(J);let N;for(;!(N=ne(h()));)Q();return F(),N}}const $={bigint:f=>typeof f=="bigint",function:f=>typeof f=="function",boolean:f=>typeof f=="boolean",string:f=>typeof f=="string",stringOrUint8Array:f=>typeof f=="string"||(0,s.isBytes)(f),isSafeInteger:f=>Number.isSafeInteger(f),array:f=>Array.isArray(f),field:(f,l)=>l.Fp.isValid(f),hash:f=>typeof f=="function"&&Number.isSafeInteger(f.outputLen)};function W(f,l,v={}){const H=(t,m,x)=>{const A=$[m];if(typeof A!="function")throw new Error("invalid validator function");const F=f[t];if(!(x&&F===void 0)&&!A(F,f))throw new Error("param "+String(t)+" is invalid. Expected "+m+", got "+F)};for(const[t,m]of Object.entries(l))H(t,m,!1);for(const[t,m]of Object.entries(v))H(t,m,!0);return f}function Y(f){return typeof f=="function"&&Number.isSafeInteger(f.outputLen)}function Z(f,l,v={}){if(!f||typeof f!="object")throw new Error("expected valid options object");function H(t,m,x){const A=f[t];if(x&&A===void 0)return;const F=typeof A;if(F!==m||A===null)throw new Error(`param "${t}" is invalid: expected ${m}, got ${F}`)}Object.entries(l).forEach(([t,m])=>H(t,m,!1)),Object.entries(v).forEach(([t,m])=>H(t,m,!0))}const u=()=>{throw new Error("not implemented")};e.notImplemented=u;function T(f){const l=new WeakMap;return(v,...H)=>{const t=l.get(v);if(t!==void 0)return t;const m=f(v,...H);return l.set(v,m),m}}})(utils)),utils}var modular={},hasRequiredModular;function requireModular(){if(hasRequiredModular)return modular;hasRequiredModular=1,Object.defineProperty(modular,"__esModule",{value:!0}),modular.isNegativeLE=void 0,modular.mod=q,modular.pow=V,modular.pow2=D,modular.invert=p,modular.tonelliShanks=P,modular.FpSqrt=w,modular.validateField=E,modular.FpPow=M,modular.FpInvertBatch=O,modular.FpDiv=j,modular.FpLegendre=$,modular.FpIsSquare=W,modular.nLength=Y,modular.Field=Z,modular.FpSqrtOdd=u,modular.FpSqrtEven=T,modular.hashToPrivateScalar=f,modular.getFieldBytesLength=l,modular.getMinHashLength=v,modular.mapHashToField=H;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireUtils$1(),s=BigInt(0),d=BigInt(1),a=BigInt(2),i=BigInt(3),o=BigInt(4),r=BigInt(5),c=BigInt(7),g=BigInt(8),S=BigInt(9),C=BigInt(16);function q(t,m){const x=t%m;return x>=s?x:m+x}function V(t,m,x){return M(Z(x),t,m)}function D(t,m,x){let A=t;for(;m-- >s;)A*=A,A%=x;return A}function p(t,m){if(t===s)throw new Error("invert: expected non-zero number");if(m<=s)throw new Error("invert: expected positive modulus, got "+m);let x=q(t,m),A=m,F=s,te=d;for(;x!==s;){const h=A/x,G=A%x,J=F-te*h;A=x,x=G,F=te,te=J}if(A!==d)throw new Error("invert: does not exist");return q(F,m)}function b(t,m,x){if(!t.eql(t.sqr(m),x))throw new Error("Cannot find square root")}function B(t,m){const x=(t.ORDER+d)/o,A=t.pow(m,x);return b(t,A,m),A}function k(t,m){const x=(t.ORDER-r)/g,A=t.mul(m,a),F=t.pow(A,x),te=t.mul(m,F),Q=t.mul(t.mul(te,a),F),h=t.mul(te,t.sub(Q,t.ONE));return b(t,h,m),h}function L(t){const m=Z(t),x=P(t),A=x(m,m.neg(m.ONE)),F=x(m,A),te=x(m,m.neg(A)),Q=(t+c)/C;return(h,G)=>{let J=h.pow(G,Q),ne=h.mul(J,A);const N=h.mul(J,F),_=h.mul(J,te),z=h.eql(h.sqr(ne),G),oe=h.eql(h.sqr(N),G);J=h.cmov(J,ne,z),ne=h.cmov(_,N,oe);const fe=h.eql(h.sqr(ne),G),pe=h.cmov(J,ne,fe);return b(h,pe,G),pe}}function P(t){if(t<i)throw new Error("sqrt is not defined for small field");let m=t-d,x=0;for(;m%a===s;)m/=a,x++;let A=a;const F=Z(t);for(;$(F,A)===1;)if(A++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(x===1)return B;let te=F.pow(A,m);const Q=(m+d)/a;return function(G,J){if(G.is0(J))return J;if($(G,J)!==1)throw new Error("Cannot find square root");let ne=x,N=G.mul(G.ONE,te),_=G.pow(J,m),z=G.pow(J,Q);for(;!G.eql(_,G.ONE);){if(G.is0(_))return G.ZERO;let oe=1,fe=G.sqr(_);for(;!G.eql(fe,G.ONE);)if(oe++,fe=G.sqr(fe),oe===ne)throw new Error("Cannot find square root");const pe=d<<BigInt(ne-oe-1),me=G.pow(N,pe);ne=oe,N=G.sqr(me),_=G.mul(_,N),z=G.mul(z,me)}return z}}function w(t){return t%o===i?B:t%g===r?k:t%C===S?L(t):P(t)}const y=(t,m)=>(q(t,m)&d)===d;modular.isNegativeLE=y;const R=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function E(t){const m={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},x=R.reduce((A,F)=>(A[F]="function",A),m);return(0,e._validateObject)(t,x),t}function M(t,m,x){if(x<s)throw new Error("invalid exponent, negatives unsupported");if(x===s)return t.ONE;if(x===d)return m;let A=t.ONE,F=m;for(;x>s;)x&d&&(A=t.mul(A,F)),F=t.sqr(F),x>>=d;return A}function O(t,m,x=!1){const A=new Array(m.length).fill(x?t.ZERO:void 0),F=m.reduce((Q,h,G)=>t.is0(h)?Q:(A[G]=Q,t.mul(Q,h)),t.ONE),te=t.inv(F);return m.reduceRight((Q,h,G)=>t.is0(h)?Q:(A[G]=t.mul(Q,A[G]),t.mul(Q,h)),te),A}function j(t,m,x){return t.mul(m,typeof x=="bigint"?p(x,t.ORDER):t.inv(x))}function $(t,m){const x=(t.ORDER-d)/a,A=t.pow(m,x),F=t.eql(A,t.ONE),te=t.eql(A,t.ZERO),Q=t.eql(A,t.neg(t.ONE));if(!F&&!te&&!Q)throw new Error("invalid Legendre symbol result");return F?1:te?0:-1}function W(t,m){return $(t,m)===1}function Y(t,m){m!==void 0&&(0,e.anumber)(m);const x=m!==void 0?m:t.toString(2).length,A=Math.ceil(x/8);return{nBitLength:x,nByteLength:A}}function Z(t,m,x=!1,A={}){if(t<=s)throw new Error("invalid field: expected ORDER > 0, got "+t);let F,te,Q=!1,h;if(typeof m=="object"&&m!=null){if(A.sqrt||x)throw new Error("cannot specify opts in two arguments");const _=m;_.BITS&&(F=_.BITS),_.sqrt&&(te=_.sqrt),typeof _.isLE=="boolean"&&(x=_.isLE),typeof _.modFromBytes=="boolean"&&(Q=_.modFromBytes),h=_.allowedLengths}else typeof m=="number"&&(F=m),A.sqrt&&(te=A.sqrt);const{nBitLength:G,nByteLength:J}=Y(t,F);if(J>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let ne;const N=Object.freeze({ORDER:t,isLE:x,BITS:G,BYTES:J,MASK:(0,e.bitMask)(G),ZERO:s,ONE:d,allowedLengths:h,create:_=>q(_,t),isValid:_=>{if(typeof _!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof _);return s<=_&&_<t},is0:_=>_===s,isValidNot0:_=>!N.is0(_)&&N.isValid(_),isOdd:_=>(_&d)===d,neg:_=>q(-_,t),eql:(_,z)=>_===z,sqr:_=>q(_*_,t),add:(_,z)=>q(_+z,t),sub:(_,z)=>q(_-z,t),mul:(_,z)=>q(_*z,t),pow:(_,z)=>M(N,_,z),div:(_,z)=>q(_*p(z,t),t),sqrN:_=>_*_,addN:(_,z)=>_+z,subN:(_,z)=>_-z,mulN:(_,z)=>_*z,inv:_=>p(_,t),sqrt:te||(_=>(ne||(ne=w(t)),ne(N,_))),toBytes:_=>x?(0,e.numberToBytesLE)(_,J):(0,e.numberToBytesBE)(_,J),fromBytes:(_,z=!0)=>{if(h){if(!h.includes(_.length)||_.length>J)throw new Error("Field.fromBytes: expected "+h+" bytes, got "+_.length);const fe=new Uint8Array(J);fe.set(_,x?0:fe.length-_.length),_=fe}if(_.length!==J)throw new Error("Field.fromBytes: expected "+J+" bytes, got "+_.length);let oe=x?(0,e.bytesToNumberLE)(_):(0,e.bytesToNumberBE)(_);if(Q&&(oe=q(oe,t)),!z&&!N.isValid(oe))throw new Error("invalid field element: outside of range 0..ORDER");return oe},invertBatch:_=>O(N,_),cmov:(_,z,oe)=>oe?z:_});return Object.freeze(N)}function u(t,m){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const x=t.sqrt(m);return t.isOdd(x)?x:t.neg(x)}function T(t,m){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const x=t.sqrt(m);return t.isOdd(x)?t.neg(x):x}function f(t,m,x=!1){t=(0,e.ensureBytes)("privateHash",t);const A=t.length,F=Y(m).nByteLength+8;if(F<24||A<F||A>1024)throw new Error("hashToPrivateScalar: expected "+F+"-1024 bytes of input, got "+A);const te=x?(0,e.bytesToNumberLE)(t):(0,e.bytesToNumberBE)(t);return q(te,m-d)+d}function l(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const m=t.toString(2).length;return Math.ceil(m/8)}function v(t){const m=l(t);return m+Math.ceil(m/2)}function H(t,m,x=!1){const A=t.length,F=l(m),te=v(m);if(A<16||A<te||A>1024)throw new Error("expected "+te+"-1024 bytes of input, got "+A);const Q=x?(0,e.bytesToNumberLE)(t):(0,e.bytesToNumberBE)(t),h=q(Q,m-d)+d;return x?(0,e.numberToBytesLE)(h,F):(0,e.numberToBytesBE)(h,F)}return modular}var hasRequiredCurve;function requireCurve(){if(hasRequiredCurve)return curve;hasRequiredCurve=1,Object.defineProperty(curve,"__esModule",{value:!0}),curve.wNAF=void 0,curve.negateCt=i,curve.normalizeZ=o,curve.mulEndoUnsafe=B,curve.pippenger=k,curve.precomputeMSMUnsafe=L,curve.validateBasic=P,curve._createCurveFields=y;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireUtils$1(),s=requireModular(),d=BigInt(0),a=BigInt(1);function i(R,E){const M=E.negate();return R?M:E}function o(R,E){const M=(0,s.FpInvertBatch)(R.Fp,E.map(O=>O.Z));return E.map((O,j)=>R.fromAffine(O.toAffine(M[j])))}function r(R,E){if(!Number.isSafeInteger(R)||R<=0||R>E)throw new Error("invalid window size, expected [1.."+E+"], got W="+R)}function c(R,E){r(R,E);const M=Math.ceil(E/R)+1,O=2**(R-1),j=2**R,$=(0,e.bitMask)(R),W=BigInt(R);return{windows:M,windowSize:O,mask:$,maxNumber:j,shiftBy:W}}function g(R,E,M){const{windowSize:O,mask:j,maxNumber:$,shiftBy:W}=M;let Y=Number(R&j),Z=R>>W;Y>O&&(Y-=$,Z+=a);const u=E*O,T=u+Math.abs(Y)-1,f=Y===0,l=Y<0,v=E%2!==0;return{nextN:Z,offset:T,isZero:f,isNeg:l,isNegF:v,offsetF:u}}function S(R,E){if(!Array.isArray(R))throw new Error("array expected");R.forEach((M,O)=>{if(!(M instanceof E))throw new Error("invalid point at index "+O)})}function C(R,E){if(!Array.isArray(R))throw new Error("array of scalars expected");R.forEach((M,O)=>{if(!E.isValid(M))throw new Error("invalid scalar at index "+O)})}const q=new WeakMap,V=new WeakMap;function D(R){return V.get(R)||1}function p(R){if(R!==d)throw new Error("invalid wNAF")}class b{constructor(E,M){this.BASE=E.BASE,this.ZERO=E.ZERO,this.Fn=E.Fn,this.bits=M}_unsafeLadder(E,M,O=this.ZERO){let j=E;for(;M>d;)M&a&&(O=O.add(j)),j=j.double(),M>>=a;return O}precomputeWindow(E,M){const{windows:O,windowSize:j}=c(M,this.bits),$=[];let W=E,Y=W;for(let Z=0;Z<O;Z++){Y=W,$.push(Y);for(let u=1;u<j;u++)Y=Y.add(W),$.push(Y);W=Y.double()}return $}wNAF(E,M,O){if(!this.Fn.isValid(O))throw new Error("invalid scalar");let j=this.ZERO,$=this.BASE;const W=c(E,this.bits);for(let Y=0;Y<W.windows;Y++){const{nextN:Z,offset:u,isZero:T,isNeg:f,isNegF:l,offsetF:v}=g(O,Y,W);O=Z,T?$=$.add(i(l,M[v])):j=j.add(i(f,M[u]))}return p(O),{p:j,f:$}}wNAFUnsafe(E,M,O,j=this.ZERO){const $=c(E,this.bits);for(let W=0;W<$.windows&&O!==d;W++){const{nextN:Y,offset:Z,isZero:u,isNeg:T}=g(O,W,$);if(O=Y,!u){const f=M[Z];j=j.add(T?f.negate():f)}}return p(O),j}getPrecomputes(E,M,O){let j=q.get(M);return j||(j=this.precomputeWindow(M,E),E!==1&&(typeof O=="function"&&(j=O(j)),q.set(M,j))),j}cached(E,M,O){const j=D(E);return this.wNAF(j,this.getPrecomputes(j,E,O),M)}unsafe(E,M,O,j){const $=D(E);return $===1?this._unsafeLadder(E,M,j):this.wNAFUnsafe($,this.getPrecomputes($,E,O),M,j)}createCache(E,M){r(M,this.bits),V.set(E,M),q.delete(E)}hasCache(E){return D(E)!==1}}curve.wNAF=b;function B(R,E,M,O){let j=E,$=R.ZERO,W=R.ZERO;for(;M>d||O>d;)M&a&&($=$.add(j)),O&a&&(W=W.add(j)),j=j.double(),M>>=a,O>>=a;return{p1:$,p2:W}}function k(R,E,M,O){S(M,R),C(O,E);const j=M.length,$=O.length;if(j!==$)throw new Error("arrays of points and scalars must have equal length");const W=R.ZERO,Y=(0,e.bitLen)(BigInt(j));let Z=1;Y>12?Z=Y-3:Y>4?Z=Y-2:Y>0&&(Z=2);const u=(0,e.bitMask)(Z),T=new Array(Number(u)+1).fill(W),f=Math.floor((E.BITS-1)/Z)*Z;let l=W;for(let v=f;v>=0;v-=Z){T.fill(W);for(let t=0;t<$;t++){const m=O[t],x=Number(m>>BigInt(v)&u);T[x]=T[x].add(M[t])}let H=W;for(let t=T.length-1,m=W;t>0;t--)m=m.add(T[t]),H=H.add(m);if(l=l.add(H),v!==0)for(let t=0;t<Z;t++)l=l.double()}return l}function L(R,E,M,O){r(O,E.BITS),S(M,R);const j=R.ZERO,$=2**O-1,W=Math.ceil(E.BITS/O),Y=(0,e.bitMask)(O),Z=M.map(u=>{const T=[];for(let f=0,l=u;f<$;f++)T.push(l),l=l.add(u);return T});return u=>{if(C(u,E),u.length>M.length)throw new Error("array of scalars must be smaller than array of points");let T=j;for(let f=0;f<W;f++){if(T!==j)for(let v=0;v<O;v++)T=T.double();const l=BigInt(W*O-(f+1)*O);for(let v=0;v<u.length;v++){const H=u[v],t=Number(H>>l&Y);t&&(T=T.add(Z[v][t-1]))}}return T}}function P(R){return(0,s.validateField)(R.Fp),(0,e.validateObject)(R,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,s.nLength)(R.n,R.nBitLength),...R,p:R.Fp.ORDER})}function w(R,E,M){if(E){if(E.ORDER!==R)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return(0,s.validateField)(E),E}else return(0,s.Field)(R,{isLE:M})}function y(R,E,M={},O){if(O===void 0&&(O=R==="edwards"),!E||typeof E!="object")throw new Error(`expected valid ${R} CURVE object`);for(const Z of["p","n","h"]){const u=E[Z];if(!(typeof u=="bigint"&&u>d))throw new Error(`CURVE.${Z} must be positive bigint`)}const j=w(E.p,M.Fp,O),$=w(E.n,M.Fn,O),Y=["Gx","Gy","a",R==="weierstrass"?"b":"d"];for(const Z of Y)if(!j.isValid(E[Z]))throw new Error(`CURVE.${Z} must be valid field element of CURVE.Fp`);return E=Object.freeze(Object.assign({},E)),{CURVE:E,Fp:j,Fn:$}}return curve}var edwards={},hasRequiredEdwards;function requireEdwards(){if(hasRequiredEdwards)return edwards;hasRequiredEdwards=1,Object.defineProperty(edwards,"__esModule",{value:!0}),edwards.PrimeEdwardsPoint=void 0,edwards.edwards=g,edwards.eddsa=C,edwards.twistedEdwards=D;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireUtils$1(),s=requireCurve(),d=requireModular(),a=BigInt(0),i=BigInt(1),o=BigInt(2),r=BigInt(8);function c(p,b,B,k){const L=p.sqr(B),P=p.sqr(k),w=p.add(p.mul(b.a,L),P),y=p.add(p.ONE,p.mul(b.d,p.mul(L,P)));return p.eql(w,y)}function g(p,b={}){const B=(0,s._createCurveFields)("edwards",p,b,b.FpFnLE),{Fp:k,Fn:L}=B;let P=B.CURVE;const{h:w}=P;(0,e._validateObject)(b,{},{uvRatio:"function"});const y=o<<BigInt(L.BYTES*8)-i,R=Z=>k.create(Z),E=b.uvRatio||((Z,u)=>{try{return{isValid:!0,value:k.sqrt(k.div(Z,u))}}catch{return{isValid:!1,value:a}}});if(!c(k,P,P.Gx,P.Gy))throw new Error("bad curve params: generator point");function M(Z,u,T=!1){const f=T?i:a;return(0,e.aInRange)("coordinate "+Z,u,f,y),u}function O(Z){if(!(Z instanceof W))throw new Error("ExtendedPoint expected")}const j=(0,e.memoized)((Z,u)=>{const{X:T,Y:f,Z:l}=Z,v=Z.is0();u==null&&(u=v?r:k.inv(l));const H=R(T*u),t=R(f*u),m=k.mul(l,u);if(v)return{x:a,y:i};if(m!==i)throw new Error("invZ was invalid");return{x:H,y:t}}),$=(0,e.memoized)(Z=>{const{a:u,d:T}=P;if(Z.is0())throw new Error("bad point: ZERO");const{X:f,Y:l,Z:v,T:H}=Z,t=R(f*f),m=R(l*l),x=R(v*v),A=R(x*x),F=R(t*u),te=R(x*R(F+m)),Q=R(A+R(T*R(t*m)));if(te!==Q)throw new Error("bad point: equation left != right (1)");const h=R(f*l),G=R(v*H);if(h!==G)throw new Error("bad point: equation left != right (2)");return!0});class W{constructor(u,T,f,l){this.X=M("x",u),this.Y=M("y",T),this.Z=M("z",f,!0),this.T=M("t",l),Object.freeze(this)}static CURVE(){return P}static fromAffine(u){if(u instanceof W)throw new Error("extended point not allowed");const{x:T,y:f}=u||{};return M("x",T),M("y",f),new W(T,f,i,R(T*f))}static fromBytes(u,T=!1){const f=k.BYTES,{a:l,d:v}=P;u=(0,e.copyBytes)((0,e._abytes2)(u,f,"point")),(0,e._abool2)(T,"zip215");const H=(0,e.copyBytes)(u),t=u[f-1];H[f-1]=t&-129;const m=(0,e.bytesToNumberLE)(H),x=T?y:k.ORDER;(0,e.aInRange)("point.y",m,a,x);const A=R(m*m),F=R(A-i),te=R(v*A-l);let{isValid:Q,value:h}=E(F,te);if(!Q)throw new Error("bad point: invalid y coordinate");const G=(h&i)===i,J=(t&128)!==0;if(!T&&h===a&&J)throw new Error("bad point: x=0 and x_0=1");return J!==G&&(h=R(-h)),W.fromAffine({x:h,y:m})}static fromHex(u,T=!1){return W.fromBytes((0,e.ensureBytes)("point",u),T)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(u=8,T=!0){return Y.createCache(this,u),T||this.multiply(o),this}assertValidity(){$(this)}equals(u){O(u);const{X:T,Y:f,Z:l}=this,{X:v,Y:H,Z:t}=u,m=R(T*t),x=R(v*l),A=R(f*t),F=R(H*l);return m===x&&A===F}is0(){return this.equals(W.ZERO)}negate(){return new W(R(-this.X),this.Y,this.Z,R(-this.T))}double(){const{a:u}=P,{X:T,Y:f,Z:l}=this,v=R(T*T),H=R(f*f),t=R(o*R(l*l)),m=R(u*v),x=T+f,A=R(R(x*x)-v-H),F=m+H,te=F-t,Q=m-H,h=R(A*te),G=R(F*Q),J=R(A*Q),ne=R(te*F);return new W(h,G,ne,J)}add(u){O(u);const{a:T,d:f}=P,{X:l,Y:v,Z:H,T:t}=this,{X:m,Y:x,Z:A,T:F}=u,te=R(l*m),Q=R(v*x),h=R(t*f*F),G=R(H*A),J=R((l+v)*(m+x)-te-Q),ne=G-h,N=G+h,_=R(Q-T*te),z=R(J*ne),oe=R(N*_),fe=R(J*_),pe=R(ne*N);return new W(z,oe,pe,fe)}subtract(u){return this.add(u.negate())}multiply(u){if(!L.isValidNot0(u))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:T,f}=Y.cached(this,u,l=>(0,s.normalizeZ)(W,l));return(0,s.normalizeZ)(W,[T,f])[0]}multiplyUnsafe(u,T=W.ZERO){if(!L.isValid(u))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return u===a?W.ZERO:this.is0()||u===i?this:Y.unsafe(this,u,f=>(0,s.normalizeZ)(W,f),T)}isSmallOrder(){return this.multiplyUnsafe(w).is0()}isTorsionFree(){return Y.unsafe(this,P.n).is0()}toAffine(u){return j(this,u)}clearCofactor(){return w===i?this:this.multiplyUnsafe(w)}toBytes(){const{x:u,y:T}=this.toAffine(),f=k.toBytes(T);return f[f.length-1]|=u&i?128:0,f}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(u){return(0,s.normalizeZ)(W,u)}static msm(u,T){return(0,s.pippenger)(W,L,u,T)}_setWindowSize(u){this.precompute(u)}toRawBytes(){return this.toBytes()}}W.BASE=new W(P.Gx,P.Gy,i,R(P.Gx*P.Gy)),W.ZERO=new W(a,i,i,a),W.Fp=k,W.Fn=L;const Y=new s.wNAF(W,L.BITS);return W.BASE.precompute(8),W}class S{constructor(b){this.ep=b}static fromBytes(b){(0,e.notImplemented)()}static fromHex(b){(0,e.notImplemented)()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(b){return this.ep.toAffine(b)}toHex(){return(0,e.bytesToHex)(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(b){return this.assertSame(b),this.init(this.ep.add(b.ep))}subtract(b){return this.assertSame(b),this.init(this.ep.subtract(b.ep))}multiply(b){return this.init(this.ep.multiply(b))}multiplyUnsafe(b){return this.init(this.ep.multiplyUnsafe(b))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(b,B){return this.init(this.ep.precompute(b,B))}toRawBytes(){return this.toBytes()}}edwards.PrimeEdwardsPoint=S;function C(p,b,B={}){if(typeof b!="function")throw new Error('"hash" function param is required');(0,e._validateObject)(B,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:k}=B,{BASE:L,Fp:P,Fn:w}=p,y=B.randomBytes||e.randomBytes,R=B.adjustScalarBytes||(x=>x),E=B.domain||((x,A,F)=>{if((0,e._abool2)(F,"phflag"),A.length||F)throw new Error("Contexts/pre-hash are not supported");return x});function M(x){return w.create((0,e.bytesToNumberLE)(x))}function O(x){const A=f.secretKey;x=(0,e.ensureBytes)("private key",x,A);const F=(0,e.ensureBytes)("hashed private key",b(x),2*A),te=R(F.slice(0,A)),Q=F.slice(A,2*A),h=M(te);return{head:te,prefix:Q,scalar:h}}function j(x){const{head:A,prefix:F,scalar:te}=O(x),Q=L.multiply(te),h=Q.toBytes();return{head:A,prefix:F,scalar:te,point:Q,pointBytes:h}}function $(x){return j(x).pointBytes}function W(x=Uint8Array.of(),...A){const F=(0,e.concatBytes)(...A);return M(b(E(F,(0,e.ensureBytes)("context",x),!!k)))}function Y(x,A,F={}){x=(0,e.ensureBytes)("message",x),k&&(x=k(x));const{prefix:te,scalar:Q,pointBytes:h}=j(A),G=W(F.context,te,x),J=L.multiply(G).toBytes(),ne=W(F.context,J,h,x),N=w.create(G+ne*Q);if(!w.isValid(N))throw new Error("sign failed: invalid s");const _=(0,e.concatBytes)(J,w.toBytes(N));return(0,e._abytes2)(_,f.signature,"result")}const Z={zip215:!0};function u(x,A,F,te=Z){const{context:Q,zip215:h}=te,G=f.signature;x=(0,e.ensureBytes)("signature",x,G),A=(0,e.ensureBytes)("message",A),F=(0,e.ensureBytes)("publicKey",F,f.publicKey),h!==void 0&&(0,e._abool2)(h,"zip215"),k&&(A=k(A));const J=G/2,ne=x.subarray(0,J),N=(0,e.bytesToNumberLE)(x.subarray(J,G));let _,z,oe;try{_=p.fromBytes(F,h),z=p.fromBytes(ne,h),oe=L.multiplyUnsafe(N)}catch{return!1}if(!h&&_.isSmallOrder())return!1;const fe=W(Q,z.toBytes(),_.toBytes(),A);return z.add(_.multiplyUnsafe(fe)).subtract(oe).clearCofactor().is0()}const T=P.BYTES,f={secretKey:T,publicKey:T,signature:2*T,seed:T};function l(x=y(f.seed)){return(0,e._abytes2)(x,f.seed,"seed")}function v(x){const A=m.randomSecretKey(x);return{secretKey:A,publicKey:$(A)}}function H(x){return(0,e.isBytes)(x)&&x.length===w.BYTES}function t(x,A){try{return!!p.fromBytes(x,A)}catch{return!1}}const m={getExtendedPublicKey:j,randomSecretKey:l,isValidSecretKey:H,isValidPublicKey:t,toMontgomery(x){const{y:A}=p.fromBytes(x),F=f.publicKey,te=F===32;if(!te&&F!==57)throw new Error("only defined for 25519 and 448");const Q=te?P.div(i+A,i-A):P.div(A-i,A+i);return P.toBytes(Q)},toMontgomerySecret(x){const A=f.secretKey;(0,e._abytes2)(x,A);const F=b(x.subarray(0,A));return R(F).subarray(0,A)},randomPrivateKey:l,precompute(x=8,A=p.BASE){return A.precompute(x,!1)}};return Object.freeze({keygen:v,getPublicKey:$,sign:Y,verify:u,utils:m,Point:p,lengths:f})}function q(p){const b={a:p.a,d:p.d,p:p.Fp.ORDER,n:p.n,h:p.h,Gx:p.Gx,Gy:p.Gy},B=p.Fp,k=(0,d.Field)(b.n,p.nBitLength,!0),L={Fp:B,Fn:k,uvRatio:p.uvRatio},P={randomBytes:p.randomBytes,adjustScalarBytes:p.adjustScalarBytes,domain:p.domain,prehash:p.prehash,mapToCurve:p.mapToCurve};return{CURVE:b,curveOpts:L,hash:p.hash,eddsaOpts:P}}function V(p,b){const B=b.Point;return Object.assign({},b,{ExtendedPoint:B,CURVE:p,nBitLength:B.Fn.BITS,nByteLength:B.Fn.BYTES})}function D(p){const{CURVE:b,curveOpts:B,hash:k,eddsaOpts:L}=q(p),P=g(b,B),w=C(P,k,L);return V(p,w)}return edwards}var hashToCurve={},hasRequiredHashToCurve;function requireHashToCurve(){return hasRequiredHashToCurve||(hasRequiredHashToCurve=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._DST_scalar=void 0,e.expand_message_xmd=g,e.expand_message_xof=S,e.hash_to_field=C,e.isogenyMap=q,e.createHasher=V;const s=requireUtils$1(),d=requireModular(),a=s.bytesToNumberBE;function i(D,p){if(r(D),r(p),D<0||D>=1<<8*p)throw new Error("invalid I2OSP input: "+D);const b=Array.from({length:p}).fill(0);for(let B=p-1;B>=0;B--)b[B]=D&255,D>>>=8;return new Uint8Array(b)}function o(D,p){const b=new Uint8Array(D.length);for(let B=0;B<D.length;B++)b[B]=D[B]^p[B];return b}function r(D){if(!Number.isSafeInteger(D))throw new Error("number expected")}function c(D){if(!(0,s.isBytes)(D)&&typeof D!="string")throw new Error("DST must be Uint8Array or string");return typeof D=="string"?(0,s.utf8ToBytes)(D):D}function g(D,p,b,B){(0,s.abytes)(D),r(b),p=c(p),p.length>255&&(p=B((0,s.concatBytes)((0,s.utf8ToBytes)("H2C-OVERSIZE-DST-"),p)));const{outputLen:k,blockLen:L}=B,P=Math.ceil(b/k);if(b>65535||P>255)throw new Error("expand_message_xmd: invalid lenInBytes");const w=(0,s.concatBytes)(p,i(p.length,1)),y=i(0,L),R=i(b,2),E=new Array(P),M=B((0,s.concatBytes)(y,D,R,i(0,1),w));E[0]=B((0,s.concatBytes)(M,i(1,1),w));for(let j=1;j<=P;j++){const $=[o(M,E[j-1]),i(j+1,1),w];E[j]=B((0,s.concatBytes)(...$))}return(0,s.concatBytes)(...E).slice(0,b)}function S(D,p,b,B,k){if((0,s.abytes)(D),r(b),p=c(p),p.length>255){const L=Math.ceil(2*B/8);p=k.create({dkLen:L}).update((0,s.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(p).digest()}if(b>65535||p.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return k.create({dkLen:b}).update(D).update(i(b,2)).update(p).update(i(p.length,1)).digest()}function C(D,p,b){(0,s._validateObject)(b,{p:"bigint",m:"number",k:"number",hash:"function"});const{p:B,k,m:L,hash:P,expand:w,DST:y}=b;if(!(0,s.isHash)(b.hash))throw new Error("expected valid hash");(0,s.abytes)(D),r(p);const R=B.toString(2).length,E=Math.ceil((R+k)/8),M=p*L*E;let O;if(w==="xmd")O=g(D,y,M,P);else if(w==="xof")O=S(D,y,M,k,P);else if(w==="_internal_pass")O=D;else throw new Error('expand must be "xmd" or "xof"');const j=new Array(p);for(let $=0;$<p;$++){const W=new Array(L);for(let Y=0;Y<L;Y++){const Z=E*(Y+$*L),u=O.subarray(Z,Z+E);W[Y]=(0,d.mod)(a(u),B)}j[$]=W}return j}function q(D,p){const b=p.map(B=>Array.from(B).reverse());return(B,k)=>{const[L,P,w,y]=b.map(M=>M.reduce((O,j)=>D.add(D.mul(O,B),j))),[R,E]=(0,d.FpInvertBatch)(D,[P,y],!0);return B=D.mul(L,R),k=D.mul(k,D.mul(w,E)),{x:B,y:k}}}e._DST_scalar=(0,s.utf8ToBytes)("HashToScalar-");function V(D,p,b){if(typeof p!="function")throw new Error("mapToCurve() must be defined");function B(L){return D.fromAffine(p(L))}function k(L){const P=L.clearCofactor();return P.equals(D.ZERO)?D.ZERO:(P.assertValidity(),P)}return{defaults:b,hashToCurve(L,P){const w=Object.assign({},b,P),y=C(L,2,w),R=B(y[0]),E=B(y[1]);return k(R.add(E))},encodeToCurve(L,P){const w=b.encodeDST?{DST:b.encodeDST}:{},y=Object.assign({},b,w,P),R=C(L,1,y),E=B(R[0]);return k(E)},mapToCurve(L){if(!Array.isArray(L))throw new Error("expected array of bigints");for(const P of L)if(typeof P!="bigint")throw new Error("expected array of bigints");return k(B(L))},hashToScalar(L,P){const w=D.Fn.ORDER,y=Object.assign({},b,{p:w,m:1,DST:e._DST_scalar},P);return C(L,1,y)[0][0]}}}})(hashToCurve)),hashToCurve}var montgomery={},hasRequiredMontgomery;function requireMontgomery(){if(hasRequiredMontgomery)return montgomery;hasRequiredMontgomery=1,Object.defineProperty(montgomery,"__esModule",{value:!0}),montgomery.montgomery=r;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireUtils$1(),s=requireModular(),d=BigInt(0),a=BigInt(1),i=BigInt(2);function o(c){return(0,e._validateObject)(c,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...c})}function r(c){const g=o(c),{P:S,type:C,adjustScalarBytes:q,powPminus2:V,randomBytes:D}=g,p=C==="x25519";if(!p&&C!=="x448")throw new Error("invalid type");const b=D||e.randomBytes,B=p?255:448,k=p?32:56,L=BigInt(p?9:5),P=BigInt(p?121665:39081),w=p?i**BigInt(254):i**BigInt(447),y=p?BigInt(8)*i**BigInt(251)-a:BigInt(4)*i**BigInt(445)-a,R=w+y+a,E=H=>(0,s.mod)(H,S),M=O(L);function O(H){return(0,e.numberToBytesLE)(E(H),k)}function j(H){const t=(0,e.ensureBytes)("u coordinate",H,k);return p&&(t[31]&=127),E((0,e.bytesToNumberLE)(t))}function $(H){return(0,e.bytesToNumberLE)(q((0,e.ensureBytes)("scalar",H,k)))}function W(H,t){const m=u(j(t),$(H));if(m===d)throw new Error("invalid private or public key received");return O(m)}function Y(H){return W(H,M)}function Z(H,t,m){const x=E(H*(t-m));return t=E(t-x),m=E(m+x),{x_2:t,x_3:m}}function u(H,t){(0,e.aInRange)("u",H,d,S),(0,e.aInRange)("scalar",t,w,R);const m=t,x=H;let A=a,F=d,te=H,Q=a,h=d;for(let J=BigInt(B-1);J>=d;J--){const ne=m>>J&a;h^=ne,{x_2:A,x_3:te}=Z(h,A,te),{x_2:F,x_3:Q}=Z(h,F,Q),h=ne;const N=A+F,_=E(N*N),z=A-F,oe=E(z*z),fe=_-oe,pe=te+Q,me=te-Q,be=E(me*N),ve=E(pe*z),xe=be+ve,we=be-ve;te=E(xe*xe),Q=E(x*E(we*we)),A=E(_*oe),F=E(fe*(_+E(P*fe)))}({x_2:A,x_3:te}=Z(h,A,te)),{x_2:F,x_3:Q}=Z(h,F,Q);const G=V(F);return E(A*G)}const T={secretKey:k,publicKey:k,seed:k},f=(H=b(k))=>((0,e.abytes)(H,T.seed),H);function l(H){const t=f(H);return{secretKey:t,publicKey:Y(t)}}return{keygen:l,getSharedSecret:(H,t)=>W(H,t),getPublicKey:H=>Y(H),scalarMult:W,scalarMultBase:Y,utils:{randomSecretKey:f,randomPrivateKey:f},GuBytes:M.slice(),lengths:T}}return montgomery}var hasRequiredEd25519;function requireEd25519(){return hasRequiredEd25519||(hasRequiredEd25519=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=te,e.edwardsToMontgomeryPriv=Q;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const s=requireSha2(),d=requireUtils$2(),a=requireCurve(),i=requireEdwards(),o=requireHashToCurve(),r=requireModular(),c=requireMontgomery(),g=requireUtils$1(),S=BigInt(0),C=BigInt(1),q=BigInt(2),V=BigInt(3),D=BigInt(5),p=BigInt(8),b=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),B={p:b,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:p,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function k(h){const G=BigInt(10),J=BigInt(20),ne=BigInt(40),N=BigInt(80),_=b,oe=h*h%_*h%_,fe=(0,r.pow2)(oe,q,_)*oe%_,pe=(0,r.pow2)(fe,C,_)*h%_,me=(0,r.pow2)(pe,D,_)*pe%_,be=(0,r.pow2)(me,G,_)*me%_,ve=(0,r.pow2)(be,J,_)*be%_,xe=(0,r.pow2)(ve,ne,_)*ve%_,we=(0,r.pow2)(xe,N,_)*xe%_,le=(0,r.pow2)(we,N,_)*xe%_,se=(0,r.pow2)(le,G,_)*me%_;return{pow_p_5_8:(0,r.pow2)(se,q,_)*h%_,b2:oe}}function L(h){return h[0]&=248,h[31]&=127,h[31]|=64,h}const P=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function w(h,G){const J=b,ne=(0,r.mod)(G*G*G,J),N=(0,r.mod)(ne*ne*G,J),_=k(h*N).pow_p_5_8;let z=(0,r.mod)(h*ne*_,J);const oe=(0,r.mod)(G*z*z,J),fe=z,pe=(0,r.mod)(z*P,J),me=oe===h,be=oe===(0,r.mod)(-h,J),ve=oe===(0,r.mod)(-h*P,J);return me&&(z=fe),(be||ve)&&(z=pe),(0,r.isNegativeLE)(z,J)&&(z=(0,r.mod)(-z,J)),{isValid:me||be,value:z}}const y=(0,r.Field)(B.p,{isLE:!0}),R=(0,r.Field)(B.n,{isLE:!0}),E={...B,Fp:y,hash:s.sha512,adjustScalarBytes:L,uvRatio:w};e.ed25519=(0,i.twistedEdwards)(E);function M(h,G,J){if(G.length>255)throw new Error("Context is too big");return(0,d.concatBytes)((0,d.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([J?1:0,G.length]),G,h)}e.ed25519ctx=(0,i.twistedEdwards)({...E,domain:M}),e.ed25519ph=(0,i.twistedEdwards)(Object.assign({},E,{domain:M,prehash:s.sha512})),e.x25519=(()=>{const h=y.ORDER;return(0,c.montgomery)({P:h,type:"x25519",powPminus2:G=>{const{pow_p_5_8:J,b2:ne}=k(G);return(0,r.mod)((0,r.pow2)(J,V,h)*ne,h)},adjustScalarBytes:L})})();const O=(b+V)/p,j=y.pow(q,O),$=y.sqrt(y.neg(y.ONE));function W(h){const G=(b-D)/p,J=BigInt(486662);let ne=y.sqr(h);ne=y.mul(ne,q);let N=y.add(ne,y.ONE),_=y.neg(J),z=y.sqr(N),oe=y.mul(z,N),fe=y.mul(ne,J);fe=y.mul(fe,_),fe=y.add(fe,z),fe=y.mul(fe,_);let pe=y.sqr(oe);z=y.sqr(pe),pe=y.mul(pe,oe),pe=y.mul(pe,fe),z=y.mul(z,pe);let me=y.pow(z,G);me=y.mul(me,pe);let be=y.mul(me,$);z=y.sqr(me),z=y.mul(z,oe);let ve=y.eql(z,fe),xe=y.cmov(be,me,ve),we=y.mul(_,ne),le=y.mul(me,h);le=y.mul(le,j);let se=y.mul(le,$),re=y.mul(fe,ne);z=y.sqr(le),z=y.mul(z,oe);let U=y.eql(z,re),ce=y.cmov(se,le,U);z=y.sqr(xe),z=y.mul(z,oe);let ee=y.eql(z,fe),ue=y.cmov(we,_,ee),de=y.cmov(ce,xe,ee),ye=y.isOdd(de);return de=y.cmov(de,y.neg(de),ee!==ye),{xMn:ue,xMd:N,yMn:de,yMd:C}}const Y=(0,r.FpSqrtEven)(y,y.neg(BigInt(486664)));function Z(h){const{xMn:G,xMd:J,yMn:ne,yMd:N}=W(h);let _=y.mul(G,N);_=y.mul(_,Y);let z=y.mul(J,ne),oe=y.sub(G,J),fe=y.add(G,J),pe=y.mul(z,fe),me=y.eql(pe,y.ZERO);_=y.cmov(_,y.ZERO,me),z=y.cmov(z,y.ONE,me),oe=y.cmov(oe,y.ONE,me),fe=y.cmov(fe,y.ONE,me);const[be,ve]=(0,r.FpInvertBatch)(y,[z,fe],!0);return{x:y.mul(_,be),y:y.mul(oe,ve)}}e.ed25519_hasher=(0,o.createHasher)(e.ed25519.Point,h=>Z(h[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:b,m:1,k:128,expand:"xmd",hash:s.sha512});const u=P,T=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),f=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),l=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),v=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),H=h=>w(C,h),t=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),m=h=>e.ed25519.Point.Fp.create((0,g.bytesToNumberLE)(h)&t);function x(h){const{d:G}=B,J=b,ne=re=>y.create(re),N=ne(u*h*h),_=ne((N+C)*l);let z=BigInt(-1);const oe=ne((z-G*N)*ne(N+G));let{isValid:fe,value:pe}=w(_,oe),me=ne(pe*h);(0,r.isNegativeLE)(me,J)||(me=ne(-me)),fe||(pe=me),fe||(z=N);const be=ne(z*(N-C)*v-oe),ve=pe*pe,xe=ne((pe+pe)*oe),we=ne(be*T),le=ne(C-ve),se=ne(C+ve);return new e.ed25519.Point(ne(xe*se),ne(le*we),ne(we*se),ne(xe*le))}function A(h){(0,d.abytes)(h,64);const G=m(h.subarray(0,32)),J=x(G),ne=m(h.subarray(32,64)),N=x(ne);return new F(J.add(N))}class F extends i.PrimeEdwardsPoint{constructor(G){super(G)}static fromAffine(G){return new F(e.ed25519.Point.fromAffine(G))}assertSame(G){if(!(G instanceof F))throw new Error("RistrettoPoint expected")}init(G){return new F(G)}static hashToCurve(G){return A((0,g.ensureBytes)("ristrettoHash",G,64))}static fromBytes(G){(0,d.abytes)(G,32);const{a:J,d:ne}=B,N=b,_=ee=>y.create(ee),z=m(G);if(!(0,g.equalBytes)(y.toBytes(z),G)||(0,r.isNegativeLE)(z,N))throw new Error("invalid ristretto255 encoding 1");const oe=_(z*z),fe=_(C+J*oe),pe=_(C-J*oe),me=_(fe*fe),be=_(pe*pe),ve=_(J*ne*me-be),{isValid:xe,value:we}=H(_(ve*be)),le=_(we*pe),se=_(we*le*ve);let re=_((z+z)*le);(0,r.isNegativeLE)(re,N)&&(re=_(-re));const U=_(fe*se),ce=_(re*U);if(!xe||(0,r.isNegativeLE)(ce,N)||U===S)throw new Error("invalid ristretto255 encoding 2");return new F(new e.ed25519.Point(re,U,C,ce))}static fromHex(G){return F.fromBytes((0,g.ensureBytes)("ristrettoHex",G,32))}static msm(G,J){return(0,a.pippenger)(F,e.ed25519.Point.Fn,G,J)}toBytes(){let{X:G,Y:J,Z:ne,T:N}=this.ep;const _=b,z=se=>y.create(se),oe=z(z(ne+J)*z(ne-J)),fe=z(G*J),pe=z(fe*fe),{value:me}=H(z(oe*pe)),be=z(me*oe),ve=z(me*fe),xe=z(be*ve*N);let we;if((0,r.isNegativeLE)(N*xe,_)){let se=z(J*u),re=z(G*u);G=se,J=re,we=z(be*f)}else we=ve;(0,r.isNegativeLE)(G*xe,_)&&(J=z(-J));let le=z((ne-J)*we);return(0,r.isNegativeLE)(le,_)&&(le=z(-le)),y.toBytes(le)}equals(G){this.assertSame(G);const{X:J,Y:ne}=this.ep,{X:N,Y:_}=G.ep,z=pe=>y.create(pe),oe=z(J*_)===z(ne*N),fe=z(ne*_)===z(J*N);return oe||fe}is0(){return this.equals(F.ZERO)}}F.BASE=new F(e.ed25519.Point.BASE),F.ZERO=new F(e.ed25519.Point.ZERO),F.Fp=y,F.Fn=R,e.ristretto255={Point:F},e.ristretto255_hasher={hashToCurve(h,G){const J=G?.DST||"ristretto255_XMD:SHA-512_R255MAP_RO_",ne=(0,o.expand_message_xmd)(h,J,64,s.sha512);return A(ne)},hashToScalar(h,G={DST:o._DST_scalar}){const J=(0,o.expand_message_xmd)(h,G.DST,64,s.sha512);return R.create((0,g.bytesToNumberLE)(J))}},e.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];function te(h){return e.ed25519.utils.toMontgomery((0,g.ensureBytes)("pub",h))}e.edwardsToMontgomery=te;function Q(h){return e.ed25519.utils.toMontgomerySecret((0,g.ensureBytes)("pub",h))}e.RistrettoPoint=F,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})(ed25519)),ed25519}var secp256k1={},_shortw_utils={},weierstrass={},hmac={},hasRequiredHmac;function requireHmac(){return hasRequiredHmac||(hasRequiredHmac=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const s=requireUtils$2();class d extends s.Hash{constructor(o,r){super(),this.finished=!1,this.destroyed=!1,(0,s.ahash)(o);const c=(0,s.toBytes)(r);if(this.iHash=o.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 g=this.blockLen,S=new Uint8Array(g);S.set(c.length>g?o.create().update(c).digest():c);for(let C=0;C<S.length;C++)S[C]^=54;this.iHash.update(S),this.oHash=o.create();for(let C=0;C<S.length;C++)S[C]^=106;this.oHash.update(S),(0,s.clean)(S)}update(o){return(0,s.aexists)(this),this.iHash.update(o),this}digestInto(o){(0,s.aexists)(this),(0,s.abytes)(o,this.outputLen),this.finished=!0,this.iHash.digestInto(o),this.oHash.update(o),this.oHash.digestInto(o),this.destroy()}digest(){const o=new Uint8Array(this.oHash.outputLen);return this.digestInto(o),o}_cloneInto(o){o||(o=Object.create(Object.getPrototypeOf(this),{}));const{oHash:r,iHash:c,finished:g,destroyed:S,blockLen:C,outputLen:q}=this;return o=o,o.finished=g,o.destroyed=S,o.blockLen=C,o.outputLen=q,o.oHash=r._cloneInto(o.oHash),o.iHash=c._cloneInto(o.iHash),o}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=d;const a=(i,o,r)=>new d(i,o).update(r).digest();e.hmac=a,e.hmac.create=(i,o)=>new d(i,o)})(hmac)),hmac}var hasRequiredWeierstrass;function requireWeierstrass(){return hasRequiredWeierstrass||(hasRequiredWeierstrass=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=e.DERErr=void 0,e._splitEndoScalar=c,e._normFnElement=B,e.weierstrassN=k,e.SWUFpSqrtRatio=P,e.mapToCurveSimpleSWU=w,e.ecdh=R,e.ecdsa=E,e.weierstrassPoints=M,e._legacyHelperEquat=$,e.weierstrass=Z;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const s=requireHmac(),d=requireUtils$2(),a=requireUtils$1(),i=requireCurve(),o=requireModular(),r=(u,T)=>(u+(u>=0?T:-T)/D)/T;function c(u,T,f){const[[l,v],[H,t]]=T,m=r(t*u,f),x=r(-v*u,f);let A=u-m*l-x*H,F=-m*v-x*t;const te=A<q,Q=F<q;te&&(A=-A),Q&&(F=-F);const h=(0,a.bitMask)(Math.ceil((0,a.bitLen)(f)/2))+V;if(A<q||A>=h||F<q||F>=h)throw new Error("splitScalar (endomorphism): failed, k="+u);return{k1neg:te,k1:A,k2neg:Q,k2:F}}function g(u){if(!["compact","recovered","der"].includes(u))throw new Error('Signature format must be "compact", "recovered", or "der"');return u}function S(u,T){const f={};for(let l of Object.keys(T))f[l]=u[l]===void 0?T[l]:u[l];return(0,a._abool2)(f.lowS,"lowS"),(0,a._abool2)(f.prehash,"prehash"),f.format!==void 0&&g(f.format),f}class C extends Error{constructor(T=""){super(T)}}e.DERErr=C,e.DER={Err:C,_tlv:{encode:(u,T)=>{const{Err:f}=e.DER;if(u<0||u>256)throw new f("tlv.encode: wrong tag");if(T.length&1)throw new f("tlv.encode: unpadded data");const l=T.length/2,v=(0,a.numberToHexUnpadded)(l);if(v.length/2&128)throw new f("tlv.encode: long form length too big");const H=l>127?(0,a.numberToHexUnpadded)(v.length/2|128):"";return(0,a.numberToHexUnpadded)(u)+H+v+T},decode(u,T){const{Err:f}=e.DER;let l=0;if(u<0||u>256)throw new f("tlv.encode: wrong tag");if(T.length<2||T[l++]!==u)throw new f("tlv.decode: wrong tlv");const v=T[l++],H=!!(v&128);let t=0;if(!H)t=v;else{const x=v&127;if(!x)throw new f("tlv.decode(long): indefinite length not supported");if(x>4)throw new f("tlv.decode(long): byte length is too big");const A=T.subarray(l,l+x);if(A.length!==x)throw new f("tlv.decode: length bytes not complete");if(A[0]===0)throw new f("tlv.decode(long): zero leftmost byte");for(const F of A)t=t<<8|F;if(l+=x,t<128)throw new f("tlv.decode(long): not minimal encoding")}const m=T.subarray(l,l+t);if(m.length!==t)throw new f("tlv.decode: wrong value length");return{v:m,l:T.subarray(l+t)}}},_int:{encode(u){const{Err:T}=e.DER;if(u<q)throw new T("integer: negative integers are not allowed");let f=(0,a.numberToHexUnpadded)(u);if(Number.parseInt(f[0],16)&8&&(f="00"+f),f.length&1)throw new T("unexpected DER parsing assertion: unpadded hex");return f},decode(u){const{Err:T}=e.DER;if(u[0]&128)throw new T("invalid signature integer: negative");if(u[0]===0&&!(u[1]&128))throw new T("invalid signature integer: unnecessary leading zero");return(0,a.bytesToNumberBE)(u)}},toSig(u){const{Err:T,_int:f,_tlv:l}=e.DER,v=(0,a.ensureBytes)("signature",u),{v:H,l:t}=l.decode(48,v);if(t.length)throw new T("invalid signature: left bytes after parsing");const{v:m,l:x}=l.decode(2,H),{v:A,l:F}=l.decode(2,x);if(F.length)throw new T("invalid signature: left bytes after parsing");return{r:f.decode(m),s:f.decode(A)}},hexFromSig(u){const{_tlv:T,_int:f}=e.DER,l=T.encode(2,f.encode(u.r)),v=T.encode(2,f.encode(u.s)),H=l+v;return T.encode(48,H)}};const q=BigInt(0),V=BigInt(1),D=BigInt(2),p=BigInt(3),b=BigInt(4);function B(u,T){const{BYTES:f}=u;let l;if(typeof T=="bigint")l=T;else{let v=(0,a.ensureBytes)("private key",T);try{l=u.fromBytes(v)}catch{throw new Error(`invalid private key: expected ui8a of size ${f}, got ${typeof T}`)}}if(!u.isValidNot0(l))throw new Error("invalid private key: out of range [1..N-1]");return l}function k(u,T={}){const f=(0,i._createCurveFields)("weierstrass",u,T),{Fp:l,Fn:v}=f;let H=f.CURVE;const{h:t,n:m}=H;(0,a._validateObject)(T,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:x}=T;if(x&&(!l.is0(H.a)||typeof x.beta!="bigint"||!Array.isArray(x.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const A=y(l,v);function F(){if(!l.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function te(le,se,re){const{x:U,y:ce}=se.toAffine(),ee=l.toBytes(U);if((0,a._abool2)(re,"isCompressed"),re){F();const ue=!l.isOdd(ce);return(0,a.concatBytes)(L(ue),ee)}else return(0,a.concatBytes)(Uint8Array.of(4),ee,l.toBytes(ce))}function Q(le){(0,a._abytes2)(le,void 0,"Point");const{publicKey:se,publicKeyUncompressed:re}=A,U=le.length,ce=le[0],ee=le.subarray(1);if(U===se&&(ce===2||ce===3)){const ue=l.fromBytes(ee);if(!l.isValid(ue))throw new Error("bad point: is not on curve, wrong x");const de=J(ue);let ye;try{ye=l.sqrt(de)}catch(ie){const ae=ie instanceof Error?": "+ie.message:"";throw new Error("bad point: is not on curve, sqrt error"+ae)}F();const K=l.isOdd(ye);return(ce&1)===1!==K&&(ye=l.neg(ye)),{x:ue,y:ye}}else if(U===re&&ce===4){const ue=l.BYTES,de=l.fromBytes(ee.subarray(0,ue)),ye=l.fromBytes(ee.subarray(ue,ue*2));if(!ne(de,ye))throw new Error("bad point: is not on curve");return{x:de,y:ye}}else throw new Error(`bad point: got length ${U}, expected compressed=${se} or uncompressed=${re}`)}const h=T.toBytes||te,G=T.fromBytes||Q;function J(le){const se=l.sqr(le),re=l.mul(se,le);return l.add(l.add(re,l.mul(le,H.a)),H.b)}function ne(le,se){const re=l.sqr(se),U=J(le);return l.eql(re,U)}if(!ne(H.Gx,H.Gy))throw new Error("bad curve params: generator point");const N=l.mul(l.pow(H.a,p),b),_=l.mul(l.sqr(H.b),BigInt(27));if(l.is0(l.add(N,_)))throw new Error("bad curve params: a or b");function z(le,se,re=!1){if(!l.isValid(se)||re&&l.is0(se))throw new Error(`bad point coordinate ${le}`);return se}function oe(le){if(!(le instanceof ve))throw new Error("ProjectivePoint expected")}function fe(le){if(!x||!x.basises)throw new Error("no endo");return c(le,x.basises,v.ORDER)}const pe=(0,a.memoized)((le,se)=>{const{X:re,Y:U,Z:ce}=le;if(l.eql(ce,l.ONE))return{x:re,y:U};const ee=le.is0();se==null&&(se=ee?l.ONE:l.inv(ce));const ue=l.mul(re,se),de=l.mul(U,se),ye=l.mul(ce,se);if(ee)return{x:l.ZERO,y:l.ZERO};if(!l.eql(ye,l.ONE))throw new Error("invZ was invalid");return{x:ue,y:de}}),me=(0,a.memoized)(le=>{if(le.is0()){if(T.allowInfinityPoint&&!l.is0(le.Y))return;throw new Error("bad point: ZERO")}const{x:se,y:re}=le.toAffine();if(!l.isValid(se)||!l.isValid(re))throw new Error("bad point: x or y not field elements");if(!ne(se,re))throw new Error("bad point: equation left != right");if(!le.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function be(le,se,re,U,ce){return re=new ve(l.mul(re.X,le),re.Y,re.Z),se=(0,i.negateCt)(U,se),re=(0,i.negateCt)(ce,re),se.add(re)}class ve{constructor(se,re,U){this.X=z("x",se),this.Y=z("y",re,!0),this.Z=z("z",U),Object.freeze(this)}static CURVE(){return H}static fromAffine(se){const{x:re,y:U}=se||{};if(!se||!l.isValid(re)||!l.isValid(U))throw new Error("invalid affine point");if(se instanceof ve)throw new Error("projective point not allowed");return l.is0(re)&&l.is0(U)?ve.ZERO:new ve(re,U,l.ONE)}static fromBytes(se){const re=ve.fromAffine(G((0,a._abytes2)(se,void 0,"point")));return re.assertValidity(),re}static fromHex(se){return ve.fromBytes((0,a.ensureBytes)("pointHex",se))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(se=8,re=!0){return we.createCache(this,se),re||this.multiply(p),this}assertValidity(){me(this)}hasEvenY(){const{y:se}=this.toAffine();if(!l.isOdd)throw new Error("Field doesn't support isOdd");return!l.isOdd(se)}equals(se){oe(se);const{X:re,Y:U,Z:ce}=this,{X:ee,Y:ue,Z:de}=se,ye=l.eql(l.mul(re,de),l.mul(ee,ce)),K=l.eql(l.mul(U,de),l.mul(ue,ce));return ye&&K}negate(){return new ve(this.X,l.neg(this.Y),this.Z)}double(){const{a:se,b:re}=H,U=l.mul(re,p),{X:ce,Y:ee,Z:ue}=this;let de=l.ZERO,ye=l.ZERO,K=l.ZERO,X=l.mul(ce,ce),ie=l.mul(ee,ee),ae=l.mul(ue,ue),he=l.mul(ce,ee);return he=l.add(he,he),K=l.mul(ce,ue),K=l.add(K,K),de=l.mul(se,K),ye=l.mul(U,ae),ye=l.add(de,ye),de=l.sub(ie,ye),ye=l.add(ie,ye),ye=l.mul(de,ye),de=l.mul(he,de),K=l.mul(U,K),ae=l.mul(se,ae),he=l.sub(X,ae),he=l.mul(se,he),he=l.add(he,K),K=l.add(X,X),X=l.add(K,X),X=l.add(X,ae),X=l.mul(X,he),ye=l.add(ye,X),ae=l.mul(ee,ue),ae=l.add(ae,ae),X=l.mul(ae,he),de=l.sub(de,X),K=l.mul(ae,ie),K=l.add(K,K),K=l.add(K,K),new ve(de,ye,K)}add(se){oe(se);const{X:re,Y:U,Z:ce}=this,{X:ee,Y:ue,Z:de}=se;let ye=l.ZERO,K=l.ZERO,X=l.ZERO;const ie=H.a,ae=l.mul(H.b,p);let he=l.mul(re,ee),ge=l.mul(U,ue),_e=l.mul(ce,de),Ee=l.add(re,U),Se=l.add(ee,ue);Ee=l.mul(Ee,Se),Se=l.add(he,ge),Ee=l.sub(Ee,Se),Se=l.add(re,ce);let Ae=l.add(ee,de);return Se=l.mul(Se,Ae),Ae=l.add(he,_e),Se=l.sub(Se,Ae),Ae=l.add(U,ce),ye=l.add(ue,de),Ae=l.mul(Ae,ye),ye=l.add(ge,_e),Ae=l.sub(Ae,ye),X=l.mul(ie,Se),ye=l.mul(ae,_e),X=l.add(ye,X),ye=l.sub(ge,X),X=l.add(ge,X),K=l.mul(ye,X),ge=l.add(he,he),ge=l.add(ge,he),_e=l.mul(ie,_e),Se=l.mul(ae,Se),ge=l.add(ge,_e),_e=l.sub(he,_e),_e=l.mul(ie,_e),Se=l.add(Se,_e),he=l.mul(ge,Se),K=l.add(K,he),he=l.mul(Ae,Se),ye=l.mul(Ee,ye),ye=l.sub(ye,he),he=l.mul(Ee,ge),X=l.mul(Ae,X),X=l.add(X,he),new ve(ye,K,X)}subtract(se){return this.add(se.negate())}is0(){return this.equals(ve.ZERO)}multiply(se){const{endo:re}=T;if(!v.isValidNot0(se))throw new Error("invalid scalar: out of range");let U,ce;const ee=ue=>we.cached(this,ue,de=>(0,i.normalizeZ)(ve,de));if(re){const{k1neg:ue,k1:de,k2neg:ye,k2:K}=fe(se),{p:X,f:ie}=ee(de),{p:ae,f:he}=ee(K);ce=ie.add(he),U=be(re.beta,X,ae,ue,ye)}else{const{p:ue,f:de}=ee(se);U=ue,ce=de}return(0,i.normalizeZ)(ve,[U,ce])[0]}multiplyUnsafe(se){const{endo:re}=T,U=this;if(!v.isValid(se))throw new Error("invalid scalar: out of range");if(se===q||U.is0())return ve.ZERO;if(se===V)return U;if(we.hasCache(this))return this.multiply(se);if(re){const{k1neg:ce,k1:ee,k2neg:ue,k2:de}=fe(se),{p1:ye,p2:K}=(0,i.mulEndoUnsafe)(ve,U,ee,de);return be(re.beta,ye,K,ce,ue)}else return we.unsafe(U,se)}multiplyAndAddUnsafe(se,re,U){const ce=this.multiplyUnsafe(re).add(se.multiplyUnsafe(U));return ce.is0()?void 0:ce}toAffine(se){return pe(this,se)}isTorsionFree(){const{isTorsionFree:se}=T;return t===V?!0:se?se(ve,this):we.unsafe(this,m).is0()}clearCofactor(){const{clearCofactor:se}=T;return t===V?this:se?se(ve,this):this.multiplyUnsafe(t)}isSmallOrder(){return this.multiplyUnsafe(t).is0()}toBytes(se=!0){return(0,a._abool2)(se,"isCompressed"),this.assertValidity(),h(ve,this,se)}toHex(se=!0){return(0,a.bytesToHex)(this.toBytes(se))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(se=!0){return this.toBytes(se)}_setWindowSize(se){this.precompute(se)}static normalizeZ(se){return(0,i.normalizeZ)(ve,se)}static msm(se,re){return(0,i.pippenger)(ve,v,se,re)}static fromPrivateKey(se){return ve.BASE.multiply(B(v,se))}}ve.BASE=new ve(H.Gx,H.Gy,l.ONE),ve.ZERO=new ve(l.ZERO,l.ONE,l.ZERO),ve.Fp=l,ve.Fn=v;const xe=v.BITS,we=new i.wNAF(ve,T.endo?Math.ceil(xe/2):xe);return ve.BASE.precompute(8),ve}function L(u){return Uint8Array.of(u?2:3)}function P(u,T){const f=u.ORDER;let l=q;for(let G=f-V;G%D===q;G/=D)l+=V;const v=l,H=D<<v-V-V,t=H*D,m=(f-V)/t,x=(m-V)/D,A=t-V,F=H,te=u.pow(T,m),Q=u.pow(T,(m+V)/D);let h=(G,J)=>{let ne=te,N=u.pow(J,A),_=u.sqr(N);_=u.mul(_,J);let z=u.mul(G,_);z=u.pow(z,x),z=u.mul(z,N),N=u.mul(z,J),_=u.mul(z,G);let oe=u.mul(_,N);z=u.pow(oe,F);let fe=u.eql(z,u.ONE);N=u.mul(_,Q),z=u.mul(oe,ne),_=u.cmov(N,_,fe),oe=u.cmov(z,oe,fe);for(let pe=v;pe>V;pe--){let me=pe-D;me=D<<me-V;let be=u.pow(oe,me);const ve=u.eql(be,u.ONE);N=u.mul(_,ne),ne=u.mul(ne,ne),be=u.mul(oe,ne),_=u.cmov(N,_,ve),oe=u.cmov(be,oe,ve)}return{isValid:fe,value:_}};if(u.ORDER%b===p){const G=(u.ORDER-p)/b,J=u.sqrt(u.neg(T));h=(ne,N)=>{let _=u.sqr(N);const z=u.mul(ne,N);_=u.mul(_,z);let oe=u.pow(_,G);oe=u.mul(oe,z);const fe=u.mul(oe,J),pe=u.mul(u.sqr(oe),N),me=u.eql(pe,ne);let be=u.cmov(fe,oe,me);return{isValid:me,value:be}}}return h}function w(u,T){(0,o.validateField)(u);const{A:f,B:l,Z:v}=T;if(!u.isValid(f)||!u.isValid(l)||!u.isValid(v))throw new Error("mapToCurveSimpleSWU: invalid opts");const H=P(u,v);if(!u.isOdd)throw new Error("Field does not have .isOdd()");return t=>{let m,x,A,F,te,Q,h,G;m=u.sqr(t),m=u.mul(m,v),x=u.sqr(m),x=u.add(x,m),A=u.add(x,u.ONE),A=u.mul(A,l),F=u.cmov(v,u.neg(x),!u.eql(x,u.ZERO)),F=u.mul(F,f),x=u.sqr(A),Q=u.sqr(F),te=u.mul(Q,f),x=u.add(x,te),x=u.mul(x,A),Q=u.mul(Q,F),te=u.mul(Q,l),x=u.add(x,te),h=u.mul(m,A);const{isValid:J,value:ne}=H(x,Q);G=u.mul(m,t),G=u.mul(G,ne),h=u.cmov(h,A,J),G=u.cmov(G,ne,J);const N=u.isOdd(t)===u.isOdd(G);G=u.cmov(u.neg(G),G,N);const _=(0,o.FpInvertBatch)(u,[F],!0)[0];return h=u.mul(h,_),{x:h,y:G}}}function y(u,T){return{secretKey:T.BYTES,publicKey:1+u.BYTES,publicKeyUncompressed:1+2*u.BYTES,publicKeyHasPrefix:!0,signature:2*T.BYTES}}function R(u,T={}){const{Fn:f}=u,l=T.randomBytes||a.randomBytes,v=Object.assign(y(u.Fp,f),{seed:(0,o.getMinHashLength)(f.ORDER)});function H(h){try{return!!B(f,h)}catch{return!1}}function t(h,G){const{publicKey:J,publicKeyUncompressed:ne}=v;try{const N=h.length;return G===!0&&N!==J||G===!1&&N!==ne?!1:!!u.fromBytes(h)}catch{return!1}}function m(h=l(v.seed)){return(0,o.mapHashToField)((0,a._abytes2)(h,v.seed,"seed"),f.ORDER)}function x(h,G=!0){return u.BASE.multiply(B(f,h)).toBytes(G)}function A(h){const G=m(h);return{secretKey:G,publicKey:x(G)}}function F(h){if(typeof h=="bigint")return!1;if(h instanceof u)return!0;const{secretKey:G,publicKey:J,publicKeyUncompressed:ne}=v;if(f.allowedLengths||G===J)return;const N=(0,a.ensureBytes)("key",h).length;return N===J||N===ne}function te(h,G,J=!0){if(F(h)===!0)throw new Error("first arg must be private key");if(F(G)===!1)throw new Error("second arg must be public key");const ne=B(f,h);return u.fromHex(G).multiply(ne).toBytes(J)}return Object.freeze({getPublicKey:x,getSharedSecret:te,keygen:A,Point:u,utils:{isValidSecretKey:H,isValidPublicKey:t,randomSecretKey:m,isValidPrivateKey:H,randomPrivateKey:m,normPrivateKeyToScalar:h=>B(f,h),precompute(h=8,G=u.BASE){return G.precompute(h,!1)}},lengths:v})}function E(u,T,f={}){(0,d.ahash)(T),(0,a._validateObject)(f,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const l=f.randomBytes||a.randomBytes,v=f.hmac||((re,...U)=>(0,s.hmac)(T,re,(0,a.concatBytes)(...U))),{Fp:H,Fn:t}=u,{ORDER:m,BITS:x}=t,{keygen:A,getPublicKey:F,getSharedSecret:te,utils:Q,lengths:h}=R(u,f),G={prehash:!1,lowS:typeof f.lowS=="boolean"?f.lowS:!1,format:void 0,extraEntropy:!1},J="compact";function ne(re){const U=m>>V;return re>U}function N(re,U){if(!t.isValidNot0(U))throw new Error(`invalid signature ${re}: out of range 1..Point.Fn.ORDER`);return U}function _(re,U){g(U);const ce=h.signature,ee=U==="compact"?ce:U==="recovered"?ce+1:void 0;return(0,a._abytes2)(re,ee,`${U} signature`)}class z{constructor(U,ce,ee){this.r=N("r",U),this.s=N("s",ce),ee!=null&&(this.recovery=ee),Object.freeze(this)}static fromBytes(U,ce=J){_(U,ce);let ee;if(ce==="der"){const{r:K,s:X}=e.DER.toSig((0,a._abytes2)(U));return new z(K,X)}ce==="recovered"&&(ee=U[0],ce="compact",U=U.subarray(1));const ue=t.BYTES,de=U.subarray(0,ue),ye=U.subarray(ue,ue*2);return new z(t.fromBytes(de),t.fromBytes(ye),ee)}static fromHex(U,ce){return this.fromBytes((0,a.hexToBytes)(U),ce)}addRecoveryBit(U){return new z(this.r,this.s,U)}recoverPublicKey(U){const ce=H.ORDER,{r:ee,s:ue,recovery:de}=this;if(de==null||![0,1,2,3].includes(de))throw new Error("recovery id invalid");if(m*D<ce&&de>1)throw new Error("recovery id is ambiguous for h>1 curve");const K=de===2||de===3?ee+m:ee;if(!H.isValid(K))throw new Error("recovery id 2 or 3 invalid");const X=H.toBytes(K),ie=u.fromBytes((0,a.concatBytes)(L((de&1)===0),X)),ae=t.inv(K),he=fe((0,a.ensureBytes)("msgHash",U)),ge=t.create(-he*ae),_e=t.create(ue*ae),Ee=u.BASE.multiplyUnsafe(ge).add(ie.multiplyUnsafe(_e));if(Ee.is0())throw new Error("point at infinify");return Ee.assertValidity(),Ee}hasHighS(){return ne(this.s)}toBytes(U=J){if(g(U),U==="der")return(0,a.hexToBytes)(e.DER.hexFromSig(this));const ce=t.toBytes(this.r),ee=t.toBytes(this.s);if(U==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return(0,a.concatBytes)(Uint8Array.of(this.recovery),ce,ee)}return(0,a.concatBytes)(ce,ee)}toHex(U){return(0,a.bytesToHex)(this.toBytes(U))}assertValidity(){}static fromCompact(U){return z.fromBytes((0,a.ensureBytes)("sig",U),"compact")}static fromDER(U){return z.fromBytes((0,a.ensureBytes)("sig",U),"der")}normalizeS(){return this.hasHighS()?new z(this.r,t.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return(0,a.bytesToHex)(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return(0,a.bytesToHex)(this.toBytes("compact"))}}const oe=f.bits2int||function(U){if(U.length>8192)throw new Error("input is too large");const ce=(0,a.bytesToNumberBE)(U),ee=U.length*8-x;return ee>0?ce>>BigInt(ee):ce},fe=f.bits2int_modN||function(U){return t.create(oe(U))},pe=(0,a.bitMask)(x);function me(re){return(0,a.aInRange)("num < 2^"+x,re,q,pe),t.toBytes(re)}function be(re,U){return(0,a._abytes2)(re,void 0,"message"),U?(0,a._abytes2)(T(re),void 0,"prehashed message"):re}function ve(re,U,ce){if(["recovered","canonical"].some(ge=>ge in ce))throw new Error("sign() legacy options not supported");const{lowS:ee,prehash:ue,extraEntropy:de}=S(ce,G);re=be(re,ue);const ye=fe(re),K=B(t,U),X=[me(K),me(ye)];if(de!=null&&de!==!1){const ge=de===!0?l(h.secretKey):de;X.push((0,a.ensureBytes)("extraEntropy",ge))}const ie=(0,a.concatBytes)(...X),ae=ye;function he(ge){const _e=oe(ge);if(!t.isValidNot0(_e))return;const Ee=t.inv(_e),Se=u.BASE.multiply(_e).toAffine(),Ae=t.create(Se.x);if(Ae===q)return;const Oe=t.create(Ee*t.create(ae+Ae*K));if(Oe===q)return;let Ke=(Se.x===Ae?0:2)|Number(Se.y&V),Ce=Oe;return ee&&ne(Oe)&&(Ce=t.neg(Oe),Ke^=1),new z(Ae,Ce,Ke)}return{seed:ie,k2sig:he}}function xe(re,U,ce={}){re=(0,a.ensureBytes)("message",re);const{seed:ee,k2sig:ue}=ve(re,U,ce);return(0,a.createHmacDrbg)(T.outputLen,t.BYTES,v)(ee,ue)}function we(re){let U;const ce=typeof re=="string"||(0,a.isBytes)(re),ee=!ce&&re!==null&&typeof re=="object"&&typeof re.r=="bigint"&&typeof re.s=="bigint";if(!ce&&!ee)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(ee)U=new z(re.r,re.s);else if(ce){try{U=z.fromBytes((0,a.ensureBytes)("sig",re),"der")}catch(ue){if(!(ue instanceof e.DER.Err))throw ue}if(!U)try{U=z.fromBytes((0,a.ensureBytes)("sig",re),"compact")}catch{return!1}}return U||!1}function le(re,U,ce,ee={}){const{lowS:ue,prehash:de,format:ye}=S(ee,G);if(ce=(0,a.ensureBytes)("publicKey",ce),U=be((0,a.ensureBytes)("message",U),de),"strict"in ee)throw new Error("options.strict was renamed to lowS");const K=ye===void 0?we(re):z.fromBytes((0,a.ensureBytes)("sig",re),ye);if(K===!1)return!1;try{const X=u.fromBytes(ce);if(ue&&K.hasHighS())return!1;const{r:ie,s:ae}=K,he=fe(U),ge=t.inv(ae),_e=t.create(he*ge),Ee=t.create(ie*ge),Se=u.BASE.multiplyUnsafe(_e).add(X.multiplyUnsafe(Ee));return Se.is0()?!1:t.create(Se.x)===ie}catch{return!1}}function se(re,U,ce={}){const{prehash:ee}=S(ce,G);return U=be(U,ee),z.fromBytes(re,"recovered").recoverPublicKey(U).toBytes()}return Object.freeze({keygen:A,getPublicKey:F,getSharedSecret:te,utils:Q,lengths:h,Point:u,sign:xe,verify:le,recoverPublicKey:se,Signature:z,hash:T})}function M(u){const{CURVE:T,curveOpts:f}=O(u),l=k(T,f);return W(u,l)}function O(u){const T={a:u.a,b:u.b,p:u.Fp.ORDER,n:u.n,h:u.h,Gx:u.Gx,Gy:u.Gy},f=u.Fp;let l=u.allowedPrivateKeyLengths?Array.from(new Set(u.allowedPrivateKeyLengths.map(t=>Math.ceil(t/2)))):void 0;const v=(0,o.Field)(T.n,{BITS:u.nBitLength,allowedLengths:l,modFromBytes:u.wrapPrivateKey}),H={Fp:f,Fn:v,allowInfinityPoint:u.allowInfinityPoint,endo:u.endo,isTorsionFree:u.isTorsionFree,clearCofactor:u.clearCofactor,fromBytes:u.fromBytes,toBytes:u.toBytes};return{CURVE:T,curveOpts:H}}function j(u){const{CURVE:T,curveOpts:f}=O(u),l={hmac:u.hmac,randomBytes:u.randomBytes,lowS:u.lowS,bits2int:u.bits2int,bits2int_modN:u.bits2int_modN};return{CURVE:T,curveOpts:f,hash:u.hash,ecdsaOpts:l}}function $(u,T,f){function l(v){const H=u.sqr(v),t=u.mul(H,v);return u.add(u.add(t,u.mul(v,T)),f)}return l}function W(u,T){const{Fp:f,Fn:l}=T;function v(t){return(0,a.inRange)(t,V,l.ORDER)}const H=$(f,u.a,u.b);return Object.assign({},{CURVE:u,Point:T,ProjectivePoint:T,normPrivateKeyToScalar:t=>B(l,t),weierstrassEquation:H,isWithinCurveOrder:v})}function Y(u,T){const f=T.Point;return Object.assign({},T,{ProjectivePoint:f,CURVE:Object.assign({},u,(0,o.nLength)(f.Fn.ORDER,f.Fn.BITS))})}function Z(u){const{CURVE:T,curveOpts:f,hash:l,ecdsaOpts:v}=j(u),H=k(T,f),t=E(H,l,v);return Y(u,t)}})(weierstrass)),weierstrass}var hasRequired_shortw_utils;function require_shortw_utils(){if(hasRequired_shortw_utils)return _shortw_utils;hasRequired_shortw_utils=1,Object.defineProperty(_shortw_utils,"__esModule",{value:!0}),_shortw_utils.getHash=s,_shortw_utils.createCurve=d;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=requireWeierstrass();function s(a){return{hash:a}}function d(a,i){const o=r=>(0,e.weierstrass)({...a,hash:r});return{...o(i),create:o}}return _shortw_utils}var hasRequiredSecp256k1;function requireSecp256k1(){return hasRequiredSecp256k1||(hasRequiredSecp256k1=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 s=requireSha2(),d=requireUtils$2(),a=require_shortw_utils(),i=requireHashToCurve(),o=requireModular(),r=requireWeierstrass(),c=requireUtils$1(),g={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},S={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},C=BigInt(0),q=BigInt(1),V=BigInt(2);function D(Y){const Z=g.p,u=BigInt(3),T=BigInt(6),f=BigInt(11),l=BigInt(22),v=BigInt(23),H=BigInt(44),t=BigInt(88),m=Y*Y*Y%Z,x=m*m*Y%Z,A=(0,o.pow2)(x,u,Z)*x%Z,F=(0,o.pow2)(A,u,Z)*x%Z,te=(0,o.pow2)(F,V,Z)*m%Z,Q=(0,o.pow2)(te,f,Z)*te%Z,h=(0,o.pow2)(Q,l,Z)*Q%Z,G=(0,o.pow2)(h,H,Z)*h%Z,J=(0,o.pow2)(G,t,Z)*G%Z,ne=(0,o.pow2)(J,H,Z)*h%Z,N=(0,o.pow2)(ne,u,Z)*x%Z,_=(0,o.pow2)(N,v,Z)*Q%Z,z=(0,o.pow2)(_,T,Z)*m%Z,oe=(0,o.pow2)(z,V,Z);if(!p.eql(p.sqr(oe),Y))throw new Error("Cannot find square root");return oe}const p=(0,o.Field)(g.p,{sqrt:D});e.secp256k1=(0,a.createCurve)({...g,Fp:p,lowS:!0,endo:S},s.sha256);const b={};function B(Y,...Z){let u=b[Y];if(u===void 0){const T=(0,s.sha256)((0,c.utf8ToBytes)(Y));u=(0,c.concatBytes)(T,T),b[Y]=u}return(0,s.sha256)((0,c.concatBytes)(u,...Z))}const k=Y=>Y.toBytes(!0).slice(1),L=e.secp256k1.Point,P=Y=>Y%V===C;function w(Y){const{Fn:Z,BASE:u}=L,T=(0,r._normFnElement)(Z,Y),f=u.multiply(T);return{scalar:P(f.y)?T:Z.neg(T),bytes:k(f)}}function y(Y){const Z=p;if(!Z.isValidNot0(Y))throw new Error("invalid x: Fail if x \u2265 p");const u=Z.create(Y*Y),T=Z.create(u*Y+BigInt(7));let f=Z.sqrt(T);P(f)||(f=Z.neg(f));const l=L.fromAffine({x:Y,y:f});return l.assertValidity(),l}const R=c.bytesToNumberBE;function E(...Y){return L.Fn.create(R(B("BIP0340/challenge",...Y)))}function M(Y){return w(Y).bytes}function O(Y,Z,u=(0,d.randomBytes)(32)){const{Fn:T}=L,f=(0,c.ensureBytes)("message",Y),{bytes:l,scalar:v}=w(Z),H=(0,c.ensureBytes)("auxRand",u,32),t=T.toBytes(v^R(B("BIP0340/aux",H))),m=B("BIP0340/nonce",t,l,f),{bytes:x,scalar:A}=w(m),F=E(x,l,f),te=new Uint8Array(64);if(te.set(x,0),te.set(T.toBytes(T.create(A+F*v)),32),!j(te,f,l))throw new Error("sign: Invalid signature produced");return te}function j(Y,Z,u){const{Fn:T,BASE:f}=L,l=(0,c.ensureBytes)("signature",Y,64),v=(0,c.ensureBytes)("message",Z),H=(0,c.ensureBytes)("publicKey",u,32);try{const t=y(R(H)),m=R(l.subarray(0,32));if(!(0,c.inRange)(m,q,g.p))return!1;const x=R(l.subarray(32,64));if(!(0,c.inRange)(x,q,g.n))return!1;const A=E(T.toBytes(m),k(t),v),F=f.multiplyUnsafe(x).add(t.multiplyUnsafe(T.neg(A))),{x:te,y:Q}=F.toAffine();return!(F.is0()||!P(Q)||te!==m)}catch{return!1}}e.schnorr=(()=>{const u=(f=(0,d.randomBytes)(48))=>(0,o.mapHashToField)(f,g.n);e.secp256k1.utils.randomSecretKey;function T(f){const l=u(f);return{secretKey:l,publicKey:M(l)}}return{keygen:T,getPublicKey:M,sign:O,verify:j,Point:L,utils:{randomSecretKey:u,randomPrivateKey:u,taggedHash:B,lift_x:y,pointToBytes:k,numberToBytesBE:c.numberToBytesBE,bytesToNumberBE:c.bytesToNumberBE,mod:o.mod},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:64,seed:48}}})();const $=(0,i.isogenyMap)(p,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(Y=>Y.map(Z=>BigInt(Z)))),W=(0,r.mapToCurveSimpleSWU)(p,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:p.create(BigInt("-11"))});e.secp256k1_hasher=(0,i.createHasher)(e.secp256k1.Point,Y=>{const{x:Z,y:u}=W(p.create(Y[0]));return $(Z,u)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:p.ORDER,m:1,k:128,expand:"xmd",hash:s.sha256}),e.hashToCurve=e.secp256k1_hasher.hashToCurve,e.encodeToCurve=e.secp256k1_hasher.encodeToCurve})(secp256k1)),secp256k1}var hex={},hasRequiredHex;function requireHex(){return hasRequiredHex||(hasRequiredHex=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeHex=e.remove0x=void 0;var s=requireUtils$3(),d=function(i){return i.startsWith("0x")||i.startsWith("0X")?i.slice(2):i};e.remove0x=d;var a=function(i){return(0,s.hexToBytes)((0,e.remove0x)(i))};e.decodeHex=a})(hex)),hex}var hasRequiredElliptic;function requireElliptic(){return hasRequiredElliptic||(hasRequiredElliptic=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hexToPublicKey=e.convertPublicKeyFormat=e.getSharedPoint=e.getPublicKey=e.isValidPrivateKey=e.getValidSecret=void 0;var s=requireWebcrypto(),d=requireEd25519(),a=requireSecp256k1(),i=requireConfig$1(),o=requireConsts(),r=requireHex(),c=function(B){var k;do k=(0,s.randomBytes)(o.SECRET_KEY_LENGTH);while(!(0,e.isValidPrivateKey)(k,B));return k};e.getValidSecret=c;var g=function(B,k){return D(k,function(L){return L.utils.isValidSecretKey(B)},function(){return!0},function(){return!0})};e.isValidPrivateKey=g;var S=function(B,k){return D(k,function(L){return L.getPublicKey(B)},function(L){return L.getPublicKey(B)},function(L){return L.getPublicKey(B)})};e.getPublicKey=S;var C=function(B,k,L,P){return D(P,function(w){return w.getSharedSecret(B,k,L)},function(w){return w.getSharedSecret(B,k)},function(w){return b(w,B,k)})};e.getSharedPoint=C;var q=function(B,k,L){return D(L,function(P){return P.getSharedSecret(Uint8Array.from(Array(31).fill(0).concat([1])),B,k)},function(){return B},function(){return B})};e.convertPublicKeyFormat=q;var V=function(B,k){var L=(0,r.decodeHex)(B);return D(k,function(){return p(L)},function(){return L},function(){return L})};e.hexToPublicKey=V;function D(B,k,L,P){var w=B||(0,i.ellipticCurve)();if(w==="secp256k1")return k(a.secp256k1);if(w==="x25519")return L(d.x25519);if(w==="ed25519")return P(d.ed25519);throw new Error("Not implemented")}var p=function(B){if(B.length===o.ETH_PUBLIC_KEY_SIZE){var k=new Uint8Array(1+B.length);return k.set([4]),k.set(B,1),k}return B},b=function(B,k,L){var P=B.utils.getExtendedPublicKey(k).scalar,w=B.Point.fromBytes(L).multiply(P);return w.toBytes()}})(elliptic)),elliptic}var hash={},hkdf={},hasRequiredHkdf;function requireHkdf(){if(hasRequiredHkdf)return hkdf;hasRequiredHkdf=1,Object.defineProperty(hkdf,"__esModule",{value:!0}),hkdf.hkdf=void 0,hkdf.extract=d,hkdf.expand=o;const e=requireHmac(),s=requireUtils$2();function d(c,g,S){return(0,s.ahash)(c),S===void 0&&(S=new Uint8Array(c.outputLen)),(0,e.hmac)(c,(0,s.toBytes)(S),(0,s.toBytes)(g))}const a=Uint8Array.from([0]),i=Uint8Array.of();function o(c,g,S,C=32){(0,s.ahash)(c),(0,s.anumber)(C);const q=c.outputLen;if(C>255*q)throw new Error("Length should be <= 255*HashLen");const V=Math.ceil(C/q);S===void 0&&(S=i);const D=new Uint8Array(V*q),p=e.hmac.create(c,g),b=p._cloneInto(),B=new Uint8Array(p.outputLen);for(let k=0;k<V;k++)a[0]=k+1,b.update(k===0?i:B).update(S).update(a).digestInto(B),D.set(B,q*k),p._cloneInto(b);return p.destroy(),b.destroy(),(0,s.clean)(B,a),D.slice(0,C)}const r=(c,g,S,C,q)=>o(c,d(c,g,S),C,q);return hkdf.hkdf=r,hkdf}var hasRequiredHash;function requireHash(){return hasRequiredHash||(hasRequiredHash=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSharedKey=e.deriveKey=void 0;var s=requireUtils$3(),d=requireHkdf(),a=requireSha2(),i=function(r,c,g){return(0,d.hkdf)(a.sha256,r,c,g,32)};e.deriveKey=i;var o=function(){for(var r=[],c=0;c<arguments.length;c++)r[c]=arguments[c];return(0,e.deriveKey)(s.concatBytes.apply(void 0,r))};e.getSharedKey=o})(hash)),hash}var symmetric={},node$1={},compat={};const require$1=node_module.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&_documentCurrentScript.tagName.toUpperCase()==="SCRIPT"&&_documentCurrentScript.src||new URL("index.cjs",document.baseURI).href);function __require(){return require$1("node:crypto")}var hasRequiredCompat;function requireCompat(){if(hasRequiredCompat)return compat;hasRequiredCompat=1,Object.defineProperty(compat,"__esModule",{value:!0}),compat._compat=void 0;var e=requireUtils$3(),s=__require(),d=16,a=globalThis.Deno!==void 0,i=function(o,r,c,g){var S=o==="aes-256-gcm"||o==="chacha20-poly1305",C=S?d:0,q=S?{authTagLength:C}:void 0,V=function(p){var b=(0,s.createCipheriv)(o,r,c,q);S&&g!==void 0&&b.setAAD(g);var B=b.update(p),k=b.final(),L=S?b.getAuthTag():new Uint8Array(0);return(0,e.concatBytes)(B,k,L)},D=function(p){var b=p.subarray(0,p.length-C),B=p.subarray(p.length-C),k=(0,s.createDecipheriv)(o,r,c,q);S&&(g!==void 0&&k.setAAD(g),k.setAuthTag(B)),!S&&a&&k.setAutoPadding(!1);var L=k.update(b),P=k.final();return(0,e.concatBytes)(L,P)};return{encrypt:V,decrypt:D}};return compat._compat=i,compat}var hasRequiredNode$1;function requireNode$1(){if(hasRequiredNode$1)return node$1;hasRequiredNode$1=1,Object.defineProperty(node$1,"__esModule",{value:!0}),node$1.aes256cbc=node$1.aes256gcm=void 0;var e=requireCompat(),s=function(a,i,o){return(0,e._compat)("aes-256-gcm",a,i,o)};node$1.aes256gcm=s;var d=function(a,i,o){return(0,e._compat)("aes-256-cbc",a,i)};return node$1.aes256cbc=d,node$1}var node={},hchacha={},hasRequiredHchacha;function requireHchacha(){if(hasRequiredHchacha)return hchacha;hasRequiredHchacha=1,Object.defineProperty(hchacha,"__esModule",{value:!0}),hchacha._hchacha20=void 0;var e=function(d,a,i,o){for(var r=d[0],c=d[1],g=d[2],S=d[3],C=a[0],q=a[1],V=a[2],D=a[3],p=a[4],b=a[5],B=a[6],k=a[7],L=i[0],P=i[1],w=i[2],y=i[3],R=0;R<20;R+=2)r=r+C|0,L=s(L^r,16),p=p+L|0,C=s(C^p,12),r=r+C|0,L=s(L^r,8),p=p+L|0,C=s(C^p,7),c=c+q|0,P=s(P^c,16),b=b+P|0,q=s(q^b,12),c=c+q|0,P=s(P^c,8),b=b+P|0,q=s(q^b,7),g=g+V|0,w=s(w^g,16),B=B+w|0,V=s(V^B,12),g=g+V|0,w=s(w^g,8),B=B+w|0,V=s(V^B,7),S=S+D|0,y=s(y^S,16),k=k+y|0,D=s(D^k,12),S=S+D|0,y=s(y^S,8),k=k+y|0,D=s(D^k,7),r=r+q|0,y=s(y^r,16),B=B+y|0,q=s(q^B,12),r=r+q|0,y=s(y^r,8),B=B+y|0,q=s(q^B,7),c=c+V|0,L=s(L^c,16),k=k+L|0,V=s(V^k,12),c=c+V|0,L=s(L^c,8),k=k+L|0,V=s(V^k,7),g=g+D|0,P=s(P^g,16),p=p+P|0,D=s(D^p,12),g=g+D|0,P=s(P^g,8),p=p+P|0,D=s(D^p,7),S=S+C|0,w=s(w^S,16),b=b+w|0,C=s(C^b,12),S=S+C|0,w=s(w^S,8),b=b+w|0,C=s(C^b,7);var E=0;o[E++]=r,o[E++]=c,o[E++]=g,o[E++]=S,o[E++]=L,o[E++]=P,o[E++]=w,o[E++]=y};hchacha._hchacha20=e;var s=function(d,a){return d<<a|d>>>32-a};return hchacha}var hasRequiredNode;function requireNode(){if(hasRequiredNode)return node;hasRequiredNode=1,Object.defineProperty(node,"__esModule",{value:!0}),node.chacha20=node.xchacha20=void 0;var e=requireUtils$3(),s=requireCompat(),d=requireHchacha(),a=function(o,r,c){if(r.length!==24)throw new Error("xchacha20's nonce must be 24 bytes");var g=new Uint32Array([1634760805,857760878,2036477234,1797285236]),S=new Uint32Array(8);(0,d._hchacha20)(g,(0,e.u32)(o),(0,e.u32)(r.subarray(0,16)),S);var C=new Uint8Array(12);return C.set([0,0,0,0]),C.set(r.subarray(16),4),(0,s._compat)("chacha20-poly1305",(0,e.u8)(S),C,c)};node.xchacha20=a;var i=function(o,r,c){if(r.length!==12)throw new Error("chacha20's nonce must be 12 bytes");return(0,s._compat)("chacha20-poly1305",o,r,c)};return node.chacha20=i,node}var hasRequiredSymmetric;function requireSymmetric(){return hasRequiredSymmetric||(hasRequiredSymmetric=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.aesDecrypt=e.aesEncrypt=e.symDecrypt=e.symEncrypt=void 0;var s=requireNode$1(),d=requireNode(),a=requireUtils$3(),i=requireWebcrypto(),o=requireConfig$1(),r=requireConsts(),c=function(V,D,p){return S(C,V,D,p)};e.symEncrypt=c;var g=function(V,D,p){return S(q,V,D,p)};e.symDecrypt=g,e.aesEncrypt=e.symEncrypt,e.aesDecrypt=e.symDecrypt;function S(V,D,p,b){var B=(0,o.symmetricAlgorithm)();if(B==="aes-256-gcm")return V(s.aes256gcm,D,p,(0,o.symmetricNonceLength)(),r.AEAD_TAG_LENGTH,b);if(B==="xchacha20")return V(d.xchacha20,D,p,r.XCHACHA20_NONCE_LENGTH,r.AEAD_TAG_LENGTH,b);if(B==="aes-256-cbc")return V(s.aes256cbc,D,p,16,0);throw new Error("Not implemented")}function C(V,D,p,b,B,k){var L=(0,i.randomBytes)(b),P=V(D,L,k),w=P.encrypt(p);if(B===0)return(0,a.concatBytes)(L,w);var y=w.length-B,R=w.subarray(0,y),E=w.subarray(y);return(0,a.concatBytes)(L,E,R)}function q(V,D,p,b,B,k){var L=p.subarray(0,b),P=V(D,Uint8Array.from(L),k),w=p.subarray(b);if(B===0)return P.decrypt(w);var y=w.subarray(0,B),R=w.subarray(B);return P.decrypt((0,a.concatBytes)(R,y))}})(symmetric)),symmetric}var hasRequiredUtils;function requireUtils(){return hasRequiredUtils||(hasRequiredUtils=1,(function(e){var s=utils$2&&utils$2.__createBinding||(Object.create?(function(a,i,o,r){r===void 0&&(r=o);var c=Object.getOwnPropertyDescriptor(i,o);(!c||("get"in c?!i.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(a,r,c)}):(function(a,i,o,r){r===void 0&&(r=o),a[r]=i[o]})),d=utils$2&&utils$2.__exportStar||function(a,i){for(var o in a)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&s(i,a,o)};Object.defineProperty(e,"__esModule",{value:!0}),d(requireElliptic(),e),d(requireHash(),e),d(requireHex(),e),d(requireSymmetric(),e)})(utils$2)),utils$2}var PublicKey={},hasRequiredPublicKey;function requirePublicKey(){if(hasRequiredPublicKey)return PublicKey;hasRequiredPublicKey=1,Object.defineProperty(PublicKey,"__esModule",{value:!0}),PublicKey.PublicKey=void 0;var e=requireUtils$3(),s=requireUtils(),d=(function(){function a(i,o){var r=(0,s.convertPublicKeyFormat)(i,!0,o),c=(0,s.convertPublicKeyFormat)(i,!1,o);this.data=r,this.dataUncompressed=r.length!==c.length?c:null}return a.fromHex=function(i,o){return new a((0,s.hexToPublicKey)(i,o),o)},Object.defineProperty(a.prototype,"_uncompressed",{get:function(){return this.dataUncompressed!==null?this.dataUncompressed:this.data},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"uncompressed",{get:function(){return Buffer.from(this._uncompressed)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"compressed",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),a.prototype.toBytes=function(i){return i===void 0&&(i=!0),i?this.data:this._uncompressed},a.prototype.toHex=function(i){return i===void 0&&(i=!0),(0,e.bytesToHex)(this.toBytes(i))},a.prototype.decapsulate=function(i,o){o===void 0&&(o=!1);var r=this.toBytes(o),c=i.multiply(this,o);return(0,s.getSharedKey)(r,c)},a.prototype.equals=function(i){return(0,e.equalBytes)(this.data,i.data)},a})();return PublicKey.PublicKey=d,PublicKey}var hasRequiredPrivateKey;function requirePrivateKey(){if(hasRequiredPrivateKey)return PrivateKey;hasRequiredPrivateKey=1,Object.defineProperty(PrivateKey,"__esModule",{value:!0}),PrivateKey.PrivateKey=void 0;var e=requireUtils$3(),s=requireUtils(),d=requirePublicKey(),a=(function(){function i(o,r){if(this.curve=r,o===void 0)this.data=(0,s.getValidSecret)(r);else if((0,s.isValidPrivateKey)(o,r))this.data=o;else throw new Error("Invalid private key");this.publicKey=new d.PublicKey((0,s.getPublicKey)(this.data,r),r)}return i.fromHex=function(o,r){return new i((0,s.decodeHex)(o),r)},Object.defineProperty(i.prototype,"secret",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),i.prototype.toHex=function(){return(0,e.bytesToHex)(this.data)},i.prototype.encapsulate=function(o,r){r===void 0&&(r=!1);var c=this.publicKey.toBytes(r),g=this.multiply(o,r);return(0,s.getSharedKey)(c,g)},i.prototype.multiply=function(o,r){return r===void 0&&(r=!1),(0,s.getSharedPoint)(this.data,o.toBytes(!0),r,this.curve)},i.prototype.equals=function(o){return(0,e.equalBytes)(this.data,o.data)},i})();return PrivateKey.PrivateKey=a,PrivateKey}var hasRequiredKeys;function requireKeys(){return hasRequiredKeys||(hasRequiredKeys=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.PrivateKey=void 0;var s=requirePrivateKey();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return s.PrivateKey}});var d=requirePublicKey();Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return d.PublicKey}})})(keys)),keys}var hasRequiredDist;function requireDist(){return hasRequiredDist||(hasRequiredDist=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.PublicKey=e.PrivateKey=e.ECIES_CONFIG=void 0,e.encrypt=o,e.decrypt=c;var s=requireUtils$3(),d=requireConfig$1(),a=requireKeys(),i=requireUtils();function o(q,V){return Buffer.from(r(q,V))}function r(q,V){var D=(0,d.ellipticCurve)(),p=new a.PrivateKey(void 0,D),b=q instanceof Uint8Array?new a.PublicKey(q,D):a.PublicKey.fromHex(q,D),B=p.encapsulate(b,(0,d.isHkdfKeyCompressed)()),k=p.publicKey.toBytes((0,d.isEphemeralKeyCompressed)()),L=(0,i.symEncrypt)(B,V);return(0,s.concatBytes)(k,L)}function c(q,V){return Buffer.from(g(q,V))}function g(q,V){var D=(0,d.ellipticCurve)(),p=q instanceof Uint8Array?new a.PrivateKey(q,D):a.PrivateKey.fromHex(q,D),b=(0,d.ephemeralKeySize)(),B=new a.PublicKey(V.subarray(0,b),D),k=V.subarray(b),L=B.decapsulate(p,(0,d.isHkdfKeyCompressed)());return(0,i.symDecrypt)(L,k)}var S=requireConfig$1();Object.defineProperty(e,"ECIES_CONFIG",{enumerable:!0,get:function(){return S.ECIES_CONFIG}});var C=requireKeys();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return C.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return C.PublicKey}}),e.utils={aesEncrypt:i.aesEncrypt,aesDecrypt:i.aesDecrypt,symEncrypt:i.symEncrypt,symDecrypt:i.symDecrypt,decodeHex:i.decodeHex,getValidSecret:i.getValidSecret,remove0x:i.remove0x}})(dist)),dist}var decryptKeyValue_1,hasRequiredDecryptKeyValue;function requireDecryptKeyValue(){if(hasRequiredDecryptKeyValue)return decryptKeyValue_1;hasRequiredDecryptKeyValue=1;const{decrypt:e}=requireDist(),s=requireErrors(),d="encrypted:";function a(i,o,r,c){let g,S;if(!o.startsWith(d))return o;if(c=c||"",c.length<=0)S=new s({key:i,privateKeyName:r,privateKey:c}).missingPrivateKey();else{const C=c.split(",");for(const q of C){const V=Buffer.from(q,"hex"),D=o.substring(d.length),p=Buffer.from(D,"base64");try{g=e(V,p).toString(),S=null;break}catch(b){b.message==="Invalid private key"?S=new s({key:i,privateKeyName:r,privateKey:c}).invalidPrivateKey():b.message==="Unsupported state or unable to authenticate data"?S=new s({key:i,privateKeyName:r,privateKey:c}).wrongPrivateKey():b.message==="Point of length 65 was invalid. Expected 33 compressed bytes or 65 uncompressed bytes"?S=new s({key:i,privateKeyName:r,privateKey:c}).malformedEncryptedData():S=new s({key:i,privateKeyName:r,privateKey:c,message:b.message}).decryptionFailed()}}}if(S)throw S;return g}return decryptKeyValue_1=a,decryptKeyValue_1}var chomp_1,hasRequiredChomp;function requireChomp(){if(hasRequiredChomp)return chomp_1;hasRequiredChomp=1;function e(s){return s.replace(/[\r\n]+$/,"")}return chomp_1=e,chomp_1}var evalKeyValue_1,hasRequiredEvalKeyValue;function requireEvalKeyValue(){if(hasRequiredEvalKeyValue)return evalKeyValue_1;hasRequiredEvalKeyValue=1;const{execSync:e}=require$$0__default$3,s=requireChomp(),d=requireErrors();function a(i,o,r,c){return(o.match(/\$\(([^)]+(?:\)[^(]*)*)\)/g)||[]).reduce((S,C)=>{const q=C.slice(2,-1);let V;try{V=e(q,{env:{...r,...c}}).toString()}catch(D){throw new d({key:i,command:q,message:D.message.trim()}).commandSubstitutionFailed()}return V=s(V),S.replace(C,V)},o)}return evalKeyValue_1=a,evalKeyValue_1}var resolveEscapeSequences_1,hasRequiredResolveEscapeSequences;function requireResolveEscapeSequences(){if(hasRequiredResolveEscapeSequences)return resolveEscapeSequences_1;hasRequiredResolveEscapeSequences=1;function e(s){return s.replace(/\\\$/g,"$")}return resolveEscapeSequences_1=e,resolveEscapeSequences_1}var parse,hasRequiredParse;function requireParse(){if(hasRequiredParse)return parse;hasRequiredParse=1;const e=requireDecryptKeyValue(),s=requireEvalKeyValue(),d=requireResolveEscapeSequences();class a{static LINE=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;constructor(o,r=null,c=process.env,g=!1,S=null){this.src=o,this.privateKey=r,this.privateKeyName=S,this.processEnv=c,this.overload=g,this.parsed={},this.preExisted={},this.injected={},this.errors=[],this.runningParsed={},this.literals={}}run(){const o=this.getLines();let r;for(;(r=a.LINE.exec(o))!==null;){const c=r[1],g=r[2],S=this.quote(g);this.parsed[c]=this.clean(g,S),!this.overload&&this.inProcessEnv(c)&&(this.parsed[c]=this.processEnv[c]);try{this.parsed[c]=this.decrypt(c,this.parsed[c])}catch(q){this.errors.push(q)}let C=!1;if(S!=="'"&&(!this.inProcessEnv(c)||this.processEnv[c]===this.parsed[c])){const q=this.parsed[c];try{this.parsed[c]=this.eval(c,q)}catch(V){this.errors.push(V)}q!==this.parsed[c]&&(C=!0)}!C&&S!=="'"&&(!this.processEnv[c]||this.overload)&&(this.parsed[c]=d(this.expand(this.parsed[c]))),S==="'"&&(this.literals[c]=this.parsed[c]),this.runningParsed[c]=this.parsed[c],Object.prototype.hasOwnProperty.call(this.processEnv,c)&&!this.overload?this.preExisted[c]=this.processEnv[c]:this.injected[c]=this.parsed[c]}return{parsed:this.parsed,processEnv:this.processEnv,injected:this.injected,preExisted:this.preExisted,errors:this.errors}}trimmer(o){return(o||"").trim()}quote(o){const c=this.trimmer(o)[0];let g="";switch(c){case"'":g="'";break;case'"':g='"';break;case"`":g="`";break;default:g=""}return g}clean(o,r){let c=this.trimmer(o);return c=c.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),r==='"'&&(c=c.replace(/\\n/g,`
3
+ `),c=c.replace(/\\r/g,"\r"),c=c.replace(/\\t/g," ")),c}decrypt(o,r){return e(o,r,this.privateKeyName,this.privateKey)}eval(o,r){return s(o,r,this.processEnv,this.runningParsed)}expand(o){let r={...this.runningParsed,...this.processEnv};this.overload&&(r={...this.processEnv,...this.runningParsed});const c=/(?<!\\)\${([^{}]+)}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g;let g=o,S;for(;(S=c.exec(g))!==null;){const[C,q,V]=S,D=q||V,p=/(:\+|\+|:-|-)/,b=D.match(p),B=b?b[0]:null,k=D.split(B);let L,P;const w=k.shift();if([":+","+"].includes(B)?(L=r[w]?k.join(B):"",P=null):(L=k.join(B),P=r[w]),P?g=g.replace(C,P):g=g.replace(C,L),g===r[w]||this.literals[w]&&/\$\{[^}]+\}|\$[A-Za-z_][A-Za-z0-9_]*/.test(this.literals[w]))break;c.lastIndex=0}return g}inProcessEnv(o){return Object.prototype.hasOwnProperty.call(this.processEnv,o)}getLines(){return(this.src||"").toString().replace(/\r\n?/mg,`
4
+ `)}}return parse=a,parse}var detectEncoding_1,hasRequiredDetectEncoding;function requireDetectEncoding(){if(hasRequiredDetectEncoding)return detectEncoding_1;hasRequiredDetectEncoding=1;const e=require$$0__default;async function s(d){const a=await e.promises.readFile(d);return a.length>=2&&a[0]===255&&a[1]===254?"utf16le":(a.length>=3&&a[0]===239&&a[1]===187&&a[2]===191,"utf8")}return detectEncoding_1=s,detectEncoding_1}var detectEncodingSync_1,hasRequiredDetectEncodingSync;function requireDetectEncodingSync(){if(hasRequiredDetectEncodingSync)return detectEncodingSync_1;hasRequiredDetectEncodingSync=1;const e=require$$0__default;function s(d){const a=e.readFileSync(d);return a.length>=2&&a[0]===255&&a[1]===254?"utf16le":(a.length>=3&&a[0]===239&&a[1]===187&&a[2]===191,"utf8")}return detectEncodingSync_1=s,detectEncodingSync_1}var environment_1,hasRequiredEnvironment;function requireEnvironment(){if(hasRequiredEnvironment)return environment_1;hasRequiredEnvironment=1;const e=require$$0__default$1;function s(d){const a=e.basename(d).toLowerCase(),o=[...a.split(".").slice(2)];return o.length===0?a.replace(".env","development"):o.length===1?o[0]:o.length===2?o.join("_"):o.slice(0,2).join("_")}return environment_1=s,environment_1}var keyNames_1,hasRequiredKeyNames;function requireKeyNames(){if(hasRequiredKeyNames)return keyNames_1;hasRequiredKeyNames=1;const e=require$$0__default$1,s=requireEnvironment();function d(a){const i=e.basename(a).toLowerCase();if(i===".env")return{publicKeyName:"DOTENV_PUBLIC_KEY",privateKeyName:"DOTENV_PRIVATE_KEY"};const o=s(i).toUpperCase();return{publicKeyName:`DOTENV_PUBLIC_KEY_${o}`,privateKeyName:`DOTENV_PRIVATE_KEY_${o}`}}return keyNames_1=d,keyNames_1}var dotenvParse_1,hasRequiredDotenvParse;function requireDotenvParse(){if(hasRequiredDotenvParse)return dotenvParse_1;hasRequiredDotenvParse=1;const e=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function s(d,a=!1,i=!1,o=!1){const r={};let c=d.toString();i||(c=c.replace(/\r\n?/mg,`
5
+ `));let g;for(;(g=e.exec(c))!=null;){const S=g[1];let C=g[2]||"";C=C.trim();const q=C[0];C=C.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),q==='"'&&!a&&(C=C.replace(/\\n/g,`
6
+ `),C=C.replace(/\\r/g,"\r"),C=C.replace(/\\t/g," ")),o?(r[S]=r[S]||[],r[S].push(C)):r[S]=C}return r}return dotenvParse_1=s,dotenvParse_1}var readProcessKey_1,hasRequiredReadProcessKey;function requireReadProcessKey(){if(hasRequiredReadProcessKey)return readProcessKey_1;hasRequiredReadProcessKey=1;function e(s){if(process.env[s]&&process.env[s].length>0)return process.env[s]}return readProcessKey_1=e,readProcessKey_1}var readFileKey_1,hasRequiredReadFileKey;function requireReadFileKey(){if(hasRequiredReadFileKey)return readFileKey_1;hasRequiredReadFileKey=1;const e=requireFsx(),s=requireDotenvParse();async function d(a,i){if(!await e.exists(i))return;const o=await e.readFileX(i),r=s(o);if(r[a]&&r[a].length>0)return r[a]}return readFileKey_1=d,readFileKey_1}var ops,hasRequiredOps;function requireOps(){if(hasRequiredOps)return ops;hasRequiredOps=1;const e=require$$0__default$1,s=require$$0__default$3,a=require$$2__default.promisify(s.execFile);class i{async status(){if(this._isForcedOff())return"off";const r=await this._resolveBinary();if(!r)return"off";try{return await this._exec(r,["status"])}catch{return"off"}}statusSync(){if(this._isForcedOff())return"off";const r=this._resolveBinarySync();if(!r)return"off";try{return this._execSync(r,["status"])}catch{return"off"}}async keypair(r){if(this._isForcedOff())return{};const c=await this._resolveBinary();if(!c)return{};const g=["keypair"];r&&g.push(r);try{return JSON.parse(await this._exec(c,g))}catch{return{}}}keypairSync(r){if(this._isForcedOff())return{};const c=this._resolveBinarySync();if(!c)return{};const g=["keypair"];r&&g.push(r);try{return JSON.parse(this._execSync(c,g))}catch{return{}}}observe(r){if(this._isForcedOff())return;const c=this._resolveBinarySync();if(!c)return;let g="off";try{g=this._execSync(c,["status"])}catch{return}if(g==="off")return;const S=Buffer.from(JSON.stringify(r)).toString("base64");try{s.spawn(c,["observe",S],{stdio:"ignore",detached:!0}).unref()}catch{}}async _exec(r,c){const{stdout:g}=await a(r,c);return g.toString().trim()}_execSync(r,c){return s.execFileSync(r,c).toString().trim()}async _resolveBinary(){return this._binaryPromise?this._binaryPromise:(this._binaryPromise=(async()=>{const r=e.resolve(process.cwd(),"node_modules/.bin/dotenvx-ops");try{return await this._exec(r,["--version"]),r}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 r=e.resolve(process.cwd(),"node_modules/.bin/dotenvx-ops");try{return this._execSync(r,["--version"]),this._binarySync=r,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 ops=i,ops}var opsKeypair_1,hasRequiredOpsKeypair;function requireOpsKeypair(){if(hasRequiredOpsKeypair)return opsKeypair_1;hasRequiredOpsKeypair=1;const e=requireOps();async function s(d){const a=await new e().keypair(d),i=a.public_key,o=a.private_key;return{publicKey:i,privateKey:o}}return opsKeypair_1=s,opsKeypair_1}var keyValues_1,hasRequiredKeyValues;function requireKeyValues(){if(hasRequiredKeyValues)return keyValues_1;hasRequiredKeyValues=1;const e=require$$0__default$1,s=requireFsx(),d=requireDotenvParse(),a=requireKeyNames(),i=requireReadProcessKey(),o=requireReadFileKey(),r=requireOpsKeypair();async function c(S){const C="DOTENV_PUBLIC_KEY",q="DOTENV_PRIVATE_KEY";if(!await s.exists(S))return null;const V=await s.readFileX(S),D=d(V);let p;for(const b of Object.keys(D))(b===C||b.startsWith(C))&&(p=b);return p?p.replace(C,q):null}async function g(S,C={}){let q=C.keysFilepath||null;const V=C.noOps===!0,D=a(S),p=D.publicKeyName;let b=D.privateKeyName,B=null,k=null;return B=i(p),B||(B=await o(p,S)||null),k=i(b),k||(q?q=e.resolve(q):q=e.resolve(e.dirname(S),".env.keys"),k=await o(b,q)),k||(b=await c(S),b&&(k=i(b),k||(k=await o(b,q)))),!V&&!k&&B&&B.length>0&&(k=(await r(B)).privateKey),{publicKeyValue:B||null,privateKeyValue:k||null}}return keyValues_1=g,keyValues_1}var readFileKeySync_1,hasRequiredReadFileKeySync;function requireReadFileKeySync(){if(hasRequiredReadFileKeySync)return readFileKeySync_1;hasRequiredReadFileKeySync=1;const e=requireFsx(),s=requireDotenvParse();function d(a,i){if(e.existsSync(i)){const o=e.readFileXSync(i),r=s(o);if(r[a]&&r[a].length>0)return r[a]}}return readFileKeySync_1=d,readFileKeySync_1}var opsKeypairSync_1,hasRequiredOpsKeypairSync;function requireOpsKeypairSync(){if(hasRequiredOpsKeypairSync)return opsKeypairSync_1;hasRequiredOpsKeypairSync=1;const e=requireOps();function s(d){const a=new e().keypairSync(d),i=a.public_key,o=a.private_key;return{publicKey:i,privateKey:o}}return opsKeypairSync_1=s,opsKeypairSync_1}var keyValuesSync_1,hasRequiredKeyValuesSync;function requireKeyValuesSync(){if(hasRequiredKeyValuesSync)return keyValuesSync_1;hasRequiredKeyValuesSync=1;const e=require$$0__default$1,s=requireFsx(),d=requireDotenvParse(),a=requireKeyNames(),i=requireReadProcessKey(),o=requireReadFileKeySync(),r=requireOpsKeypairSync();function c(S){const C="DOTENV_PUBLIC_KEY",q="DOTENV_PRIVATE_KEY";if(!s.existsSync(S))return null;const V=s.readFileXSync(S),D=d(V);let p;for(const b of Object.keys(D))(b===C||b.startsWith(C))&&(p=b);return p?p.replace(C,q):null}function g(S,C={}){let q=C.keysFilepath||null;const V=C.noOps===!0,D=a(S),p=D.publicKeyName;let b=D.privateKeyName,B=null,k=null;return B=i(p),B||(B=o(p,S)||null),k=i(b),k||(q?q=e.resolve(q):q=e.resolve(e.dirname(S),".env.keys"),k=o(b,q)),k||(b=c(S),b&&(k=i(b),k||(k=o(b,q)))),!V&&!k&&B&&B.length>0&&(k=r(B).privateKey),{publicKeyValue:B||null,privateKeyValue:k||null}}return keyValuesSync_1=g,keyValuesSync_1}var guessPrivateKeyFilename_1,hasRequiredGuessPrivateKeyFilename;function requireGuessPrivateKeyFilename(){if(hasRequiredGuessPrivateKeyFilename)return guessPrivateKeyFilename_1;hasRequiredGuessPrivateKeyFilename=1;const e="DOTENV_PRIVATE_KEY";function s(d){return d===e?".env":`.env.${d.substring(`${e}_`.length).split("_").join(".").toLowerCase()}`}return guessPrivateKeyFilename_1=s,guessPrivateKeyFilename_1}var dotenvPrivateKeyNames_1,hasRequiredDotenvPrivateKeyNames;function requireDotenvPrivateKeyNames(){if(hasRequiredDotenvPrivateKeyNames)return dotenvPrivateKeyNames_1;hasRequiredDotenvPrivateKeyNames=1;const e="DOTENV_PRIVATE_KEY";function s(d){return Object.keys(d).filter(a=>a.startsWith(e))}return dotenvPrivateKeyNames_1=s,dotenvPrivateKeyNames_1}var keyResolution,hasRequiredKeyResolution;function requireKeyResolution(){return hasRequiredKeyResolution||(hasRequiredKeyResolution=1,keyResolution={keyNames:requireKeyNames(),keyValues:requireKeyValues(),keyValuesSync:requireKeyValuesSync(),readProcessKey:requireReadProcessKey(),readFileKey:requireReadFileKey(),readFileKeySync:requireReadFileKeySync(),guessPrivateKeyFilename:requireGuessPrivateKeyFilename(),dotenvPrivateKeyNames:requireDotenvPrivateKeyNames()}),keyResolution}var conventions_1,hasRequiredConventions;function requireConventions(){if(hasRequiredConventions)return conventions_1;hasRequiredConventions=1;const e=requireErrors();function s(d){const a=process.env.DOTENV_ENV||process.env.NODE_ENV||"development";if(d==="nextjs"){const i=["development","test","production"].includes(a)&&a;return[i&&{type:"envFile",value:`.env.${i}.local`},i!=="test"&&{type:"envFile",value:".env.local"},i&&{type:"envFile",value:`.env.${i}`},{type:"envFile",value:".env"}].filter(Boolean)}else{if(d==="flow")return[{type:"envFile",value:`.env.${a}.local`},{type:"envFile",value:`.env.${a}`},{type:"envFile",value:".env.local"},{type:"envFile",value:".env"},{type:"envFile",value:".env.defaults"}];throw new e({convention:d}).invalidConvention()}}return conventions_1=s,conventions_1}var resolveHome_1,hasRequiredResolveHome;function requireResolveHome(){if(hasRequiredResolveHome)return resolveHome_1;hasRequiredResolveHome=1;const e=require$$0__default$4,s=require$$0__default$1;function d(a){return a[0]==="~"?s.join(e.homedir(),a.slice(1)):a}return resolveHome_1=d,resolveHome_1}var dotenvOptionPaths_1,hasRequiredDotenvOptionPaths;function requireDotenvOptionPaths(){if(hasRequiredDotenvOptionPaths)return dotenvOptionPaths_1;hasRequiredDotenvOptionPaths=1;const e=requireResolveHome();function s(d){let a=[];if(d&&d.path)if(!Array.isArray(d.path))a=[e(d.path)];else{a=[];for(const i of d.path)a.push(e(i))}return a}return dotenvOptionPaths_1=s,dotenvOptionPaths_1}var buildEnvs_1,hasRequiredBuildEnvs;function requireBuildEnvs(){if(hasRequiredBuildEnvs)return buildEnvs_1;hasRequiredBuildEnvs=1;const e=requireConventions(),s=requireDotenvOptionPaths();function d(a){const i=s(a);let o=[];a.convention&&(o=e(a.convention).concat(o));for(const r of i)o.push({type:"envFile",value:r});return o}return buildEnvs_1=d,buildEnvs_1}var determine_1,hasRequiredDetermine;function requireDetermine(){if(hasRequiredDetermine)return determine_1;hasRequiredDetermine=1;const e=requireDotenvPrivateKeyNames(),s=requireGuessPrivateKeyFilename(),d="envFile",a=[{type:d,value:".env"}];function i(r){const c=[];for(const g of r){const S=s(g);c.push({type:d,value:S})}return c}function o(r=[],c){const g=e(c);if(!r||r.length<=0)return g.length>0?i(g):a;{let S=!1;for(const C of r)C.type===d&&(S=!0);return S?r:[...a,...r]}}return determine_1=o,determine_1}var findEnvFiles_1,hasRequiredFindEnvFiles;function requireFindEnvFiles(){if(hasRequiredFindEnvFiles)return findEnvFiles_1;hasRequiredFindEnvFiles=1;const e=requireFsx(),s=requireErrors(),d=[".env.project",".env.keys",".env.me",".env.x",".env.example"];function a(i){try{return e.readdirSync(i).filter(c=>c.startsWith(".env")&&!c.endsWith(".previous")&&!d.includes(c))}catch(o){throw o.code==="ENOENT"?new s({directory:i}).missingDirectory():o}}return findEnvFiles_1=a,findEnvFiles_1}var envResolution,hasRequiredEnvResolution;function requireEnvResolution(){return hasRequiredEnvResolution||(hasRequiredEnvResolution=1,envResolution={buildEnvs:requireBuildEnvs(),determine:requireDetermine(),findEnvFiles:requireFindEnvFiles(),dotenvOptionPaths:requireDotenvOptionPaths(),environment:requireEnvironment(),conventions:requireConventions()}),envResolution}var run,hasRequiredRun;function requireRun(){if(hasRequiredRun)return run;hasRequiredRun=1;const e=requireFsx(),s=require$$0__default$1,d="env",a="envFile",i=requireParse(),o=requireErrors(),r=requireDetectEncoding(),c=requireDetectEncodingSync(),{keyNames:g,keyValues:S,keyValuesSync:C}=requireKeyResolution(),{determine:q}=requireEnvResolution();class V{constructor(p=[],b=!1,B=process.env,k=null,L=!1){this.envs=q(p,B),this.overload=b,this.processEnv=B,this.envKeysFilepath=k,this.noOps=L,this.processedEnvs=[],this.readableFilepaths=new Set,this.readableStrings=new Set,this.uniqueInjectedKeys=new Set,this.beforeEnv={...this.processEnv}}runSync(){for(const p of this.envs)p.type===a?this._injectEnvFileSync(p.value):p.type===d&&this._injectEnv(p.value);return{processedEnvs:this.processedEnvs,readableStrings:[...this.readableStrings],readableFilepaths:[...this.readableFilepaths],uniqueInjectedKeys:[...this.uniqueInjectedKeys],beforeEnv:this.beforeEnv,afterEnv:{...this.processEnv}}}async run(){for(const p of this.envs)p.type===a?await this._injectEnvFile(p.value):p.type===d&&this._injectEnv(p.value);return{processedEnvs:this.processedEnvs,readableStrings:[...this.readableStrings],readableFilepaths:[...this.readableFilepaths],uniqueInjectedKeys:[...this.uniqueInjectedKeys],beforeEnv:this.beforeEnv,afterEnv:{...this.processEnv}}}_injectEnv(p){const b={};b.type=d,b.string=p;try{const{parsed:B,errors:k,injected:L,preExisted:P}=new i(p,null,this.processEnv,this.overload).run();b.parsed=B,b.errors=k,b.injected=L,b.preExisted=P,this.inject(b.parsed),this.readableStrings.add(p);for(const w of Object.keys(L))this.uniqueInjectedKeys.add(w)}catch(B){b.errors=[B]}this.processedEnvs.push(b)}_injectEnvFileSync(p){const b={};b.type=a,b.filepath=p;const B=s.resolve(p);try{const k=c(B),L=e.readFileXSync(B,{encoding:k});this.readableFilepaths.add(p);const{privateKeyName:P}=g(B),{privateKeyValue:w}=C(B,{keysFilepath:this.envKeysFilepath,noOps:this.noOps}),{parsed:y,errors:R,injected:E,preExisted:M}=new i(L,w,this.processEnv,this.overload,P).run();b.privateKeyName=P,b.privateKey=w,b.src=L,b.parsed=y,b.errors=R,b.injected=E,b.preExisted=M,this.inject(b.parsed);for(const O of Object.keys(E))this.uniqueInjectedKeys.add(O)}catch(k){k.code==="ENOENT"||k.code==="EISDIR"?b.errors=[new o({envFilepath:p,filepath:B}).missingEnvFile()]:b.errors=[k]}this.processedEnvs.push(b)}async _injectEnvFile(p){const b={};b.type=a,b.filepath=p;const B=s.resolve(p);try{const k=await r(B),L=await e.readFileX(B,{encoding:k});this.readableFilepaths.add(p);const{privateKeyName:P}=g(B),{privateKeyValue:w}=await S(B,{keysFilepath:this.envKeysFilepath,noOps:this.noOps}),{parsed:y,errors:R,injected:E,preExisted:M}=new i(L,w,this.processEnv,this.overload,P).run();b.privateKeyName=P,b.privateKey=w,b.src=L,b.parsed=y,b.errors=R,b.injected=E,b.preExisted=M,this.inject(b.parsed);for(const O of Object.keys(E))this.uniqueInjectedKeys.add(O)}catch(k){k.code==="ENOENT"||k.code==="EISDIR"?b.errors=[new o({envFilepath:p,filepath:B}).missingEnvFile()]:b.errors=[k]}this.processedEnvs.push(b)}inject(p){for(const b of Object.keys(p))this.processEnv[b]=p[b]}}return run=V,run}var localKeypair_1,hasRequiredLocalKeypair;function requireLocalKeypair(){if(hasRequiredLocalKeypair)return localKeypair_1;hasRequiredLocalKeypair=1;const{PrivateKey:e}=requireDist();function s(d){let a;d?a=new e(Buffer.from(d,"hex")):a=new e;const i=a.publicKey.toHex(),o=a.secret.toString("hex");return{publicKey:i,privateKey:o}}return localKeypair_1=s,localKeypair_1}var encryptValue_1,hasRequiredEncryptValue;function requireEncryptValue(){if(hasRequiredEncryptValue)return encryptValue_1;hasRequiredEncryptValue=1;const{encrypt:e}=requireDist(),s="encrypted:";function d(a,i){const o=e(i,Buffer.from(a)),r=Buffer.from(o,"hex").toString("base64");return`${s}${r}`}return encryptValue_1=d,encryptValue_1}var isEncrypted_1,hasRequiredIsEncrypted;function requireIsEncrypted(){if(hasRequiredIsEncrypted)return isEncrypted_1;hasRequiredIsEncrypted=1;const e=/^encrypted:.+/;function s(d){return e.test(d)}return isEncrypted_1=s,isEncrypted_1}var isPublicKey_1,hasRequiredIsPublicKey;function requireIsPublicKey(){if(hasRequiredIsPublicKey)return isPublicKey_1;hasRequiredIsPublicKey=1;const e=/^DOTENV_PUBLIC_KEY/;function s(d){return e.test(d)}return isPublicKey_1=s,isPublicKey_1}var mutateKeysSrc_1,hasRequiredMutateKeysSrc;function requireMutateKeysSrc(){if(hasRequiredMutateKeysSrc)return mutateKeysSrc_1;hasRequiredMutateKeysSrc=1;const e=["#/------------------!DOTENV_PRIVATE_KEYS!-------------------/","#/ private decryption keys. DO NOT commit to source control /","#/ [how it works](https://dotenvx.com/encryption) /","#/----------------------------------------------------------/"].join(`
7
+ `),s=require$$0__default$1,d=requireFsx();async function a({envFilepath:i,keysFilepath:o,privateKeyName:r,privateKeyValue:c}){const g=s.basename(i),S=s.resolve(i);let C=s.join(s.dirname(S),".env.keys");o&&(C=s.resolve(o));const q=[`# ${g}`,`${r}=${c}`,""].join(`
8
+ `);let V="";await d.exists(C)&&(V=await d.readFileX(C)),V=V.length>1?V:`${e}
9
+ `,V=`${V}
10
+ ${q}`,await d.writeFileX(C,V);const D=o||s.join(s.dirname(i),s.basename(C));return{keysSrc:V,envKeysFilepath:D}}return mutateKeysSrc_1=a,mutateKeysSrc_1}var mutateKeysSrcSync_1,hasRequiredMutateKeysSrcSync;function requireMutateKeysSrcSync(){if(hasRequiredMutateKeysSrcSync)return mutateKeysSrcSync_1;hasRequiredMutateKeysSrcSync=1;const e=["#/------------------!DOTENV_PRIVATE_KEYS!-------------------/","#/ private decryption keys. DO NOT commit to source control /","#/ [how it works](https://dotenvx.com/encryption) /","#/----------------------------------------------------------/"].join(`
11
+ `),s=require$$0__default$1,d=requireFsx();function a({envFilepath:i,keysFilepath:o,privateKeyName:r,privateKeyValue:c}){const g=s.basename(i),S=s.resolve(i);let C=s.join(s.dirname(S),".env.keys");o&&(C=s.resolve(o));const q=[`# ${g}`,`${r}=${c}`,""].join(`
12
+ `);let V="";d.existsSync(C)&&(V=d.readFileXSync(C)),V=V.length>1?V:`${e}
13
+ `,V=`${V}
14
+ ${q}`,d.writeFileXSync(C,V);const D=o||s.join(s.dirname(i),s.basename(C));return{keysSrc:V,envKeysFilepath:D}}return mutateKeysSrcSync_1=a,mutateKeysSrcSync_1}var preserveShebang_1,hasRequiredPreserveShebang;function requirePreserveShebang(){if(hasRequiredPreserveShebang)return preserveShebang_1;hasRequiredPreserveShebang=1;function e(s){const[d,...a]=s.split(`
15
+ `);let i="";return d.startsWith("#!")&&(i=d+`
16
+ `,s=a.join(`
17
+ `)),{firstLinePreserved:i,envSrc:s}}return preserveShebang_1=e,preserveShebang_1}var prependPublicKey_1,hasRequiredPrependPublicKey;function requirePrependPublicKey(){if(hasRequiredPrependPublicKey)return prependPublicKey_1;hasRequiredPrependPublicKey=1;function e(s,d,a,i=".env.keys"){const o=i===".env.keys"?"":` # -fk ${i}`;return["#/-------------------[DOTENV_PUBLIC_KEY]--------------------/","#/ public-key encryption for .env files /","#/ [how it works](https://dotenvx.com/encryption) /","#/----------------------------------------------------------/",`${s}="${d}"${o}`,"",`# ${a}`].join(`
18
+ `)}return prependPublicKey_1=e,prependPublicKey_1}var mutateSrc_1,hasRequiredMutateSrc;function requireMutateSrc(){if(hasRequiredMutateSrc)return mutateSrc_1;hasRequiredMutateSrc=1;const e=require$$0__default$1,s=requirePreserveShebang(),d=requirePrependPublicKey();function a({envSrc:i,envFilepath:o,keysFilepath:r,publicKeyName:c,publicKeyValue:g}){const S=e.basename(o),C=e.resolve(o);let q=e.join(e.dirname(C),".env.keys");r&&(q=e.resolve(r));const V=e.relative(e.dirname(C),q),D=s(i),p=d(c,g,S,V);return i=`${D.firstLinePreserved}${p}
19
+ ${D.envSrc}`,{envSrc:i}}return mutateSrc_1=a,mutateSrc_1}var provision_1,hasRequiredProvision;function requireProvision(){if(hasRequiredProvision)return provision_1;hasRequiredProvision=1;const e=requireMutateSrc(),s=requireMutateKeysSrc(),d=requireOpsKeypair(),a=requireLocalKeypair(),{keyNames:i}=requireKeyResolution();async function o({envSrc:r,envFilepath:c,keysFilepath:g,noOps:S}){S=S!==!1;const{publicKeyName:C,privateKeyName:q}=i(c);let V,D,p,b,B=!1,k=!1;if(S){const P=a();V=P.publicKey,D=P.privateKey}else{const P=await d();V=P.publicKey,D=P.privateKey}if(r=e({envSrc:r,envFilepath:c,keysFilepath:g,publicKeyName:C,publicKeyValue:V}).envSrc,S){const P=await s({envFilepath:c,keysFilepath:g,privateKeyName:q,privateKeyValue:D});p=P.keysSrc,b=P.envKeysFilepath,B=!0}else k=!0;return{envSrc:r,keysSrc:p,publicKey:V,privateKey:D,envKeysFilepath:b,localPrivateKeyAdded:B,remotePrivateKeyAdded:k}}return provision_1=o,provision_1}var provisionSync_1,hasRequiredProvisionSync;function requireProvisionSync(){if(hasRequiredProvisionSync)return provisionSync_1;hasRequiredProvisionSync=1;const e=requireMutateSrc(),s=requireMutateKeysSrcSync(),d=requireOpsKeypairSync(),a=requireLocalKeypair(),{keyNames:i}=requireKeyResolution();function o({envSrc:r,envFilepath:c,keysFilepath:g,noOps:S}){S=S!==!1;const{publicKeyName:C,privateKeyName:q}=i(c);let V,D,p,b,B=!1,k=!1;if(S){const P=a();V=P.publicKey,D=P.privateKey}else{const P=d();V=P.publicKey,D=P.privateKey}if(r=e({envSrc:r,envFilepath:c,keysFilepath:g,publicKeyName:C,publicKeyValue:V}).envSrc,S){const P=s({envFilepath:c,keysFilepath:g,privateKeyName:q,privateKeyValue:D});p=P.keysSrc,b=P.envKeysFilepath,B=!0}else k=!0;return{envSrc:r,keysSrc:p,publicKey:V,privateKey:D,envKeysFilepath:b,localPrivateKeyAdded:B,remotePrivateKeyAdded:k}}return provisionSync_1=o,provisionSync_1}var provisionWithPrivateKey_1,hasRequiredProvisionWithPrivateKey;function requireProvisionWithPrivateKey(){if(hasRequiredProvisionWithPrivateKey)return provisionWithPrivateKey_1;hasRequiredProvisionWithPrivateKey=1;const e=requireErrors(),s=requireMutateSrc(),d=requireLocalKeypair();function a({envSrc:i,envFilepath:o,keysFilepath:r,privateKeyValue:c,publicKeyValue:g,publicKeyName:S}){const{publicKey:C,privateKey:q}=d(c);if(g&&g!==C)throw new e({publicKey:C,publicKeyExisting:g}).mispairedPrivateKey();return g||(i=s({envSrc:i,envFilepath:o,keysFilepath:r,publicKeyName:S,publicKeyValue:C}).envSrc),{envSrc:i,publicKey:C,privateKey:q}}return provisionWithPrivateKey_1=a,provisionWithPrivateKey_1}var isFullyEncrypted_1,hasRequiredIsFullyEncrypted;function requireIsFullyEncrypted(){if(hasRequiredIsFullyEncrypted)return isFullyEncrypted_1;hasRequiredIsFullyEncrypted=1;const e=requireDotenvParse(),s=requireIsEncrypted(),d=requireIsPublicKey();function a(i){const o=e(i,!1,!1,!0);for(const[r,c]of Object.entries(o))for(const g of c)if(!(s(g)||d(r)))return!1;return!0}return isFullyEncrypted_1=a,isFullyEncrypted_1}var cryptography,hasRequiredCryptography;function requireCryptography(){return hasRequiredCryptography||(hasRequiredCryptography=1,cryptography={opsKeypair:requireOpsKeypair(),opsKeypairSync:requireOpsKeypairSync(),localKeypair:requireLocalKeypair(),encryptValue:requireEncryptValue(),decryptKeyValue:requireDecryptKeyValue(),isEncrypted:requireIsEncrypted(),isPublicKey:requireIsPublicKey(),mutateKeysSrc:requireMutateKeysSrc(),mutateKeysSrcSync:requireMutateKeysSrcSync(),provision:requireProvision(),provisionSync:requireProvisionSync(),provisionWithPrivateKey:requireProvisionWithPrivateKey(),mutateSrc:requireMutateSrc(),isFullyEncrypted:requireIsFullyEncrypted()}),cryptography}var quotes_1,hasRequiredQuotes;function requireQuotes(){if(hasRequiredQuotes)return quotes_1;hasRequiredQuotes=1;const e=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function s(d){const a={};let i=d.toString();i=i.replace(/\r\n?/mg,`
20
+ `);let o;for(;(o=e.exec(i))!=null;){const r=o[1];let c=o[2]||"";c=c.trim();const g=c[0];c=c.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),g===c[0]?a[r]="":a[r]=g}return a}return quotes_1=s,quotes_1}var escapeForRegex_1,hasRequiredEscapeForRegex;function requireEscapeForRegex(){if(hasRequiredEscapeForRegex)return escapeForRegex_1;hasRequiredEscapeForRegex=1;function e(s){return s.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}return escapeForRegex_1=e,escapeForRegex_1}var escapeDollarSigns_1,hasRequiredEscapeDollarSigns;function requireEscapeDollarSigns(){if(hasRequiredEscapeDollarSigns)return escapeDollarSigns_1;hasRequiredEscapeDollarSigns=1;function e(s){return s.replace(/\$/g,"$$$$")}return escapeDollarSigns_1=e,escapeDollarSigns_1}var replace_1,hasRequiredReplace;function requireReplace(){if(hasRequiredReplace)return replace_1;hasRequiredReplace=1;const e=requireQuotes(),s=requireDotenvParse(),d=requireEscapeForRegex(),a=requireEscapeDollarSigns();function i(o,r,c){let g,S="";const C=s(o,!0,!0),q=e(o);if(Object.prototype.hasOwnProperty.call(C,r)){const V=q[r];S+=`${r}=${V}${c}${V}`;const D=C[r],p=d(D);let b="";if(p===""){b="$";const L=o.match(new RegExp(`${r}\\s*=\\s*
21
+
22
+ `,"m"));if(V===""&&L){const P=L[0].match(/\n/g).length-1;for(let w=0;w<P;w++)S+=`
23
+ `}}const B=new RegExp("^(\\s*)?(export\\s+)?"+r+"\\s*=\\s*[\"'`]?"+p+"[\"'`]?"+b,"gm"),k=a(S);g=o.replace(B,`$1$2${k}`)}else S+=`${r}="${c}"`,o.endsWith(`
24
+ `)?S=S+`
25
+ `:S=`
26
+ `+S,g=o+S;return g}return replace_1=i,replace_1}var sets,hasRequiredSets;function requireSets(){if(hasRequiredSets)return sets;hasRequiredSets=1;const e=requireFsx(),s=require$$0__default$1,d="envFile",a=requireErrors(),{determine:i}=requireEnvResolution(),{keyNames:o,keyValues:r,keyValuesSync:c}=requireKeyResolution(),{encryptValue:g,decryptKeyValue:S,isEncrypted:C,provision:q,provisionSync:V,provisionWithPrivateKey:D}=requireCryptography(),p=requireReplace(),b=requireDotenvParse(),B=requireDetectEncoding(),k=requireDetectEncodingSync();class L{constructor(w,y,R=[],E=!0,M=null,O=!1,j=!1){this.envs=i(R,process.env),this.key=w,this.value=y,this.encrypt=E,this.envKeysFilepath=M,this.noOps=O,this.noCreate=j,this.processedEnvs=[],this.changedFilepaths=new Set,this.unchangedFilepaths=new Set,this.readableFilepaths=new Set}runSync(){for(const w of this.envs)w.type===d&&this._setEnvFileSync(w.value);return{processedEnvs:this.processedEnvs,changedFilepaths:[...this.changedFilepaths],unchangedFilepaths:[...this.unchangedFilepaths]}}async run(){for(const w of this.envs)w.type===d&&await this._setEnvFile(w.value);return{processedEnvs:this.processedEnvs,changedFilepaths:[...this.changedFilepaths],unchangedFilepaths:[...this.unchangedFilepaths]}}_setEnvFileSync(w){const y={};y.key=this.key||null,y.value=this.value||null,y.type=d;const R=s.resolve(w);y.filepath=R,y.envFilepath=w,y.changed=!1;try{let E=!1;e.existsSync(R)||(this.noCreate?k(R):e.writeFileXSync(R,""));const M=k(R);let O=e.readFileXSync(R,{encoding:M});y.key&&O.trim().length===0&&(O=`${y.key}="${this.value}"
27
+ `,E=!0);const j=b(O);y.originalValue=j[y.key]||null,E&&(y.originalValue=null);const $=!C(y.originalValue);if(this.readableFilepaths.add(w),this.encrypt){let u,T;const{publicKeyName:f,privateKeyName:l}=o(R),{publicKeyValue:v,privateKeyValue:H}=c(R,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});if(!H&&!v){const t=V({envSrc:O,envFilepath:w,keysFilepath:this.envKeysFilepath,noOps:this.noOps});O=t.envSrc,u=t.publicKey,T=t.privateKey,y.envKeysFilepath=t.envKeysFilepath,y.localPrivateKeyAdded=t.localPrivateKeyAdded,y.remotePrivateKeyAdded=t.remotePrivateKeyAdded}else if(H){const t=D({envSrc:O,envFilepath:w,keysFilepath:this.envKeysFilepath,privateKeyValue:H,publicKeyValue:v,publicKeyName:f});u=t.publicKey,T=t.privateKey,O=t.envSrc,y.originalValue&&(y.originalValue=S(y.key,y.originalValue,l,T))}else v&&(u=v);y.publicKey=u,y.privateKey=T;try{y.encryptedValue=g(this.value,u)}catch{throw new a({publicKeyName:f,publicKey:u}).invalidPublicKey()}y.privateKeyName=l}const W=$&&this.encrypt,Y=this.value!==y.originalValue;E&&!this.encrypt?(y.envSrc=O,this.changedFilepaths.add(w),y.changed=!0):W||Y?(y.envSrc=p(O,this.key,y.encryptedValue||this.value),this.changedFilepaths.add(w),y.changed=!0):(y.envSrc=O,this.unchangedFilepaths.add(w),y.changed=!1)}catch(E){E.code==="ENOENT"?y.error=new a({envFilepath:w,filepath:R}).missingEnvFile():y.error=E}this.processedEnvs.push(y)}async _setEnvFile(w){const y={};y.key=this.key||null,y.value=this.value||null,y.type=d;const R=s.resolve(w);y.filepath=R,y.envFilepath=w,y.changed=!1;try{let E=!1;await e.exists(R)||(this.noCreate?await B(R):await e.writeFileX(R,""));const M=await B(R);let O=await e.readFileX(R,{encoding:M});y.key&&O.trim().length===0&&(O=`${y.key}="${this.value}"
28
+ `,E=!0);const j=b(O);y.originalValue=j[y.key]||null,E&&(y.originalValue=null);const $=!C(y.originalValue);if(this.readableFilepaths.add(w),this.encrypt){let u,T;const{publicKeyName:f,privateKeyName:l}=o(R),{publicKeyValue:v,privateKeyValue:H}=await r(R,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});if(!H&&!v){const t=await q({envSrc:O,envFilepath:w,keysFilepath:this.envKeysFilepath,noOps:this.noOps});O=t.envSrc,u=t.publicKey,T=t.privateKey,y.envKeysFilepath=t.envKeysFilepath,y.localPrivateKeyAdded=t.localPrivateKeyAdded,y.remotePrivateKeyAdded=t.remotePrivateKeyAdded}else if(H){const t=D({envSrc:O,envFilepath:w,keysFilepath:this.envKeysFilepath,privateKeyValue:H,publicKeyValue:v,publicKeyName:f});u=t.publicKey,T=t.privateKey,O=t.envSrc,y.originalValue&&(y.originalValue=S(y.key,y.originalValue,l,T))}else v&&(u=v);y.publicKey=u,y.privateKey=T;try{y.encryptedValue=g(this.value,u)}catch{throw new a({publicKeyName:f,publicKey:u}).invalidPublicKey()}y.privateKeyName=l}const W=$&&this.encrypt,Y=this.value!==y.originalValue;E&&!this.encrypt?(y.envSrc=O,this.changedFilepaths.add(w),y.changed=!0):W||Y?(y.envSrc=p(O,this.key,y.encryptedValue||this.value),this.changedFilepaths.add(w),y.changed=!0):(y.envSrc=O,this.unchangedFilepaths.add(w),y.changed=!1)}catch(E){E.code==="ENOENT"?y.error=new a({envFilepath:w,filepath:R}).missingEnvFile():y.error=E}this.processedEnvs.push(y)}}return sets=L,sets}var get,hasRequiredGet;function requireGet(){if(hasRequiredGet)return get;hasRequiredGet=1;const e=requireRun(),s=requireErrors();class d{constructor(i,o=[],r=!1,c=!1,g=null,S=!1){this.key=i,this.envs=o,this.overload=r,this.all=c,this.envKeysFilepath=g,this.noOps=S}runSync(){const i={...process.env},{processedEnvs:o}=new e(this.envs,this.overload,i,this.envKeysFilepath,this.noOps).runSync();return this._result(o,i)}async run(){const i={...process.env},{processedEnvs:o}=await new e(this.envs,this.overload,i,this.envKeysFilepath,this.noOps).run();return this._result(o,i)}_result(i,o){const r=[];for(const g of i)for(const S of g.errors)r.push(S);if(this.key){const g={},S=o[this.key];return g[this.key]=S,S===void 0&&r.push(new s({key:this.key}).missingKey()),{parsed:g,errors:r}}if(this.all)return{parsed:o,errors:r};const c={};for(const g of i)if(g.parsed)for(const S of Object.keys(g.parsed))c[S]=o[S];return{parsed:c,errors:r}}}return get=d,get}var keypair,hasRequiredKeypair;function requireKeypair(){if(hasRequiredKeypair)return keypair;hasRequiredKeypair=1;const{keyNames:e,keyValues:s,keyValuesSync:d}=requireKeyResolution();class a{constructor(o=".env",r=null,c=!1){this.envFile=o,this.envKeysFilepath=r,this.noOps=c}runSync(){const o={},r=this._filepaths();for(const c of r){const{publicKeyName:g,privateKeyName:S}=e(c),{publicKeyValue:C,privateKeyValue:q}=d(c,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});o[g]=C,o[S]=q}return o}async run(){const o={},r=this._filepaths();for(const c of r){const{publicKeyName:g,privateKeyName:S}=e(c),{publicKeyValue:C,privateKeyValue:q}=await s(c,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});o[g]=C,o[S]=q}return o}_filepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return keypair=a,keypair}var genexample,hasRequiredGenexample;function requireGenexample(){if(hasRequiredGenexample)return genexample;hasRequiredGenexample=1;const e=requireFsx(),s=require$$0__default$1,d=requireErrors(),a=requireFindEnvFiles(),i=requireReplace(),o=requireDotenvParse();class r{constructor(g=".",S){this.directory=g,this.envFile=S||a(g),this.exampleFilename=".env.example",this.exampleFilepath=s.resolve(this.directory,this.exampleFilename)}run(){if(this.envFile.length<1)throw new d().missingEnvFiles();const g=new Set,S=new Set,C=this._envFilepaths(),q={},V={};let D=`# ${this.exampleFilename} - generated with dotenvx
29
+ `;for(const p of C){const b=s.resolve(this.directory,p);if(!e.existsSync(b)){const L=new d({envFilepath:p,filepath:b}).missingEnvFile();throw L.help=`? add it with [echo "HELLO=World" > ${p}] and then run [dotenvx genexample]`,L}let B=e.readFileXSync(b);const k=o(B);for(const L in k)g.add(L),B=i(B,L,"");D+=`
30
+ ${B}`}if(e.existsSync(this.exampleFilepath)){D=e.readFileXSync(this.exampleFilepath);const p=o(D);for(const b of[...g])b in p?V[b]=p[b]:(D+=`${b}=''
31
+ `,S.add(b),q[b]="")}else for(const p of[...g])S.add(p),q[p]="";return{envExampleFile:D,envFile:this.envFile,exampleFilepath:this.exampleFilepath,addedKeys:[...S],injected:q,preExisted:V}}_envFilepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return genexample=r,genexample}var session,hasRequiredSession;function requireSession(){if(hasRequiredSession)return session;hasRequiredSession=1;const e=requireOps(),{logger:s}=requireLogger();class d{constructor(){this.ops=new e}async noOps(){const i=await this.ops.status();return s.debug(`ops: ${i}`),i==="off"}noOpsSync(){const i=this.ops.statusSync();return s.debug(`ops: ${i}`),i==="off"}}return session=d,session}var localDisplayPath_1,hasRequiredLocalDisplayPath;function requireLocalDisplayPath(){if(hasRequiredLocalDisplayPath)return localDisplayPath_1;hasRequiredLocalDisplayPath=1;const e=require$$0__default$1;function s(d){return d?e.isAbsolute(d)?e.relative(process.cwd(),d)||e.basename(d):d:".env.keys"}return localDisplayPath_1=s,localDisplayPath_1}var main,hasRequiredMain;function requireMain(){if(hasRequiredMain)return main;hasRequiredMain=1;const e=require$$0__default$1,{setLogLevel:s,setLogName:d,setLogVersion:a,logger:i}=requireLogger(),{getColor:o,bold:r}=requireColors(),c=requireLs(),g=requireRun(),S=requireSets(),C=requireGet(),q=requireKeypair(),V=requireGenexample(),D=requireSession(),p=requireBuildEnvs(),b=requireParse(),B=requireFsx(),k=requireLocalDisplayPath(),L=function(j={}){let $=process.env;j&&j.processEnv!=null&&($=j.processEnv);const W=j.overload||j.override,Y=j.ignore||[],Z=j.strict,u=j.envKeysFile;j&&(s(j),d(j),a(j));const T=O(j);try{const f=p(j),{processedEnvs:l,readableFilepaths:v,uniqueInjectedKeys:H}=new g(f,W,$,u,T).runSync();let t;const m={};for(const A of l){A.type==="envFile"&&i.verbose(`loading env from ${A.filepath} (${e.resolve(A.filepath)})`);for(const F of A.errors||[]){if(Y.includes(F.code)){i.verbose(`ignored: ${F.message}`);continue}if(Z)throw F;t=F,F.code==="MISSING_ENV_FILE"&&j.convention||i.error(F.messageWithHelp)}Object.assign(m,A.injected||{}),Object.assign(m,A.preExisted||{}),i.debug(A.parsed);for(const[F,te]of Object.entries(A.injected||{}))i.verbose(`${F} set`),i.debug(`${F} set to ${te}`);for(const[F,te]of Object.entries(A.preExisted||{}))i.verbose(`${F} pre-exists (protip: use --overload to override)`),i.debug(`${F} pre-exists as ${te} (protip: use --overload to override)`)}let x=`injecting env (${H.length})`;return v.length>0&&(x+=` from ${v.join(", ")}`),i.successv(x),t?{parsed:m,error:t}:{parsed:m}}catch(f){if(Z)throw f;return i.error(f.messageWithHelp),{parsed:{},error:f}}},P=function(j,$={}){let W=process.env;$&&$.processEnv!=null&&(W=$.processEnv);const Y=$.privateKey||null,Z=$.overload||$.override,{parsed:u,errors:T}=new b(j,Y,W,Z).run();for(const f of T)i.error(f.messageWithHelp);return u},w=function(j,$,W={}){let Y=!0;(W.plain||W.encrypt===!1)&&(Y=!1),W&&(s(W),d(W),a(W));const Z=p(W),u=W.envKeysFile,T=O(W),{processedEnvs:f,changedFilepaths:l,unchangedFilepaths:v}=new S(j,$,Z,Y,u,T).runSync();let H="";Y&&(H=" with encryption");for(const A of f)if(i.verbose(`setting for ${A.envFilepath}`),A.error){const F=A.error,te=F.messageWithHelp||(F.help?`${F.message}. ${F.help}`:F.message);i.warn(te)}else B.writeFileXSync(A.filepath,A.envSrc),i.verbose(`${A.key} set${H} (${A.envFilepath})`),i.debug(`${A.key} set${H} to ${A.value} (${A.envFilepath})`);let t="";const m=f.find(A=>A.localPrivateKeyAdded),x=f.find(A=>A.remotePrivateKeyAdded);if(m&&(t=` + local key (${k(m.envKeysFilepath)})`),x&&(t=" + armored key \u26E8"),l.length>0)Y?i.success(`\u25C8 encrypted ${j} (${l.join(",")})${t}`):i.success(`\u25C7 set ${j} (${l.join(",")})`);else if(Y&&m){const A=m.envFilepath||l[0]||".env";i.success(`\u25C8 encrypted ${j} (${A})${t}`)}else v.length>0&&i.info(`\u25CB no change (${v})`);return{processedEnvs:f,changedFilepaths:l,unchangedFilepaths:v}},y=function(j,$={}){const W=p($),Y=O($),Z=$.ignore||[],{parsed:u,errors:T}=new C(j,W,$.overload,$.all,$.envKeysFile,Y).runSync();for(const f of T||[])if(!Z.includes(f.code)){if($.strict)throw f;i.error(f.messageWithHelp)}if(j){const f=u[j];return f===void 0?void 0:f}else if($.format==="eval"){let f="";for(const[l,v]of Object.entries(u))f+=`${l}=${escape(v)}
32
+ `;return f=f.trim(),f}else if($.format==="shell"){let f="";for(const[l,v]of Object.entries(u))f+=`${l}=${v} `;return f=f.trim(),f}else return u},R=function(j,$,W){return new c(j,$,W).run()},E=function(j,$){return new V(j,$).run()},M=function(j,$,W=null,Y=!1){const Z=new q(j,W,Y).runSync();return $?Z[$]:Z};function O(j={}){const $=new D;return j.noOps===!0||j.opsOff===!0||$.noOpsSync()}return main={config:L,parse:P,set:w,get:y,ls:R,keypair:M,genexample:E,setLogLevel:s,logger:i,getColor:o,bold:r},main}var hasRequiredConfig;function requireConfig(){return hasRequiredConfig||(hasRequiredConfig=1,requireMain().config()),config$1}requireConfig();const n={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 ConfigProvider{static instance;envVars;constructor(){this.envVars={},Object.values(n).forEach(s=>{const d=process.env[s];if(d==null)throw new Error(`Missing required environment variable: ${s}`);this.envVars[s]=d})}static getInstance(){return ConfigProvider.instance||(ConfigProvider.instance=new ConfigProvider),ConfigProvider.instance}getConfig(s){return this.envVars[s]}}function isIndexedItem(e){return typeof e=="object"&&e!==null&&"objectID"in e&&typeof e.objectID=="string"}function I$1(e){const s=Object.keys(e).sort(),d={objectID:e.objectID};for(const a of s)a!=="objectID"&&(d[a]=e[a]);return d}function normalizeIndexedItemArray(e){return e.map(I$1).sort((s,d)=>s.objectID.localeCompare(d.objectID))}class Uploader{client;indexName;constructor(s){this.client=s.getClient(),this.indexName=s.getIndexName()}async uploadObjects(s){if(s.length===0){console.error("No items are included in the target JSON file. More than 1 item is necessary.");return}let d=await this.getAllObjects();d=normalizeIndexedItemArray(d);const a=normalizeIndexedItemArray(s),i=this.determineOperations(d,a);if(i.update.length===0&&i.add.length===0&&i.delete.length===0){console.log("No updates needed. All objects are up to date.");return}if(i.update.length>0){const o=await this.client.partialUpdateObjects({indexName:this.indexName,objects:i.update,createIfNotExists:!0});console.log(`Updated ${o[0].objectIDs.length} objects`)}if(i.add.length>0){const o=await this.client.saveObjects({indexName:this.indexName,objects:i.add});console.log(`Added ${o[0].objectIDs.length} objects`)}if(i.delete.length>0){const o=i.delete.map(c=>c.objectID),r=await this.client.deleteObjects({indexName:this.indexName,objectIDs:o});console.log(`Deleted ${r[0].objectIDs.length} objects`)}}async getAllObjects(){const s=[];return await this.client.browseObjects({indexName:this.indexName,aggregator:d=>{Array.isArray(d.hits)&&d.hits.forEach(a=>{isIndexedItem(a)&&s.push(a)})}}),s}determineOperations(s,d){const a=new Map(s.map(r=>[r.objectID,r])),i=new Map(d.map(r=>[r.objectID,r])),o={update:[],add:[],delete:[]};for(const r of d){const c=a.get(r.objectID);c==null?o.add.push(r):esToolkit.isEqual(c,r)||o.update.push(r)}for(const r of s)i.has(r.objectID)||o.delete.push(r);return o}}class AlgoliaClientProvider{static instance;client;indexName;constructor(s,d){this.client=d(s.getConfig("ALGOLIA_APP_ID"),s.getConfig("ALGOLIA_ADMIN_API_KEY")),this.indexName=s.getConfig("ALGOLIA_INDEX_NAME")}static getInstance(){if(!this.instance){const s=ConfigProvider.getInstance();this.instance=new AlgoliaClientProvider(s,algoliasearch.algoliasearch)}return this.instance}getClient(){return this.client}getIndexName(){return this.indexName}}const I=citty.defineCommand({meta:{name:name$1,version:version$1,description:description$1},args:{},async run({args:e}){try{let s=ConfigProvider.getInstance().getConfig("DATA_DIR");s=require$$0__default$1.join(process.cwd(),s),require$$0__default.existsSync(s)&&require$$0__default.statSync(s).isDirectory()||(console.error(`Error: provided directory does not exist - ${s}`),process.exit(1));const d=readAllJsonFiles(s)[0];d.every(i=>isIndexedItem(i))||(console.error(`The content of the provided json file is incompatible. Check the file: ${s}`),process.exit(1));const a=AlgoliaClientProvider.getInstance();await new Uploader(a).uploadObjects(d)}catch(s){console.error("Some errors occured: ",s),process.exit(1)}}});citty.runMain(I);
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
package/dist/index.mjs ADDED
@@ -0,0 +1,32 @@
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "algolia-uploader",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "command-line util to upload Algolia source",
5
5
  "repository": {
6
6
  "type": "git",