@aventurevc/aventure-cli 0.8.236 → 0.8.237

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.
Files changed (127) hide show
  1. package/dist/aventure-cli/index.js +1 -1
  2. package/dist/aventure-cli/unified-operations.json +1 -1
  3. package/dist/chunks/allowance-type-COW05L2h.js +1 -0
  4. package/dist/chunks/{api-key-bearer-credential-BDpScO9J.js → api-key-bearer-credential-118TVP67.js} +1 -1
  5. package/dist/chunks/api-key-bearer-credential-DDrDgtmD.js +1 -0
  6. package/dist/chunks/api-key-credential-CTYGmo4i.js +3 -0
  7. package/dist/chunks/api-key-credential-DqWZhM1S.js +1 -0
  8. package/dist/chunks/api-key-credential-verification-C-hPkWdf.js +1 -0
  9. package/dist/chunks/api-key-credential-verification-DmezO3gR.js +1 -0
  10. package/dist/chunks/api-key-login-C0CGjCDi.js +7 -0
  11. package/dist/chunks/auth-BNDyLTqp-GYAzJXBe.js +1 -0
  12. package/dist/chunks/auth-resolver-JikQ_vOz.js +1 -0
  13. package/dist/chunks/auth-resolver-p3AsKEaj.js +1 -0
  14. package/dist/chunks/auth-status-render-BkdU5KWp.js +2 -0
  15. package/dist/chunks/aventure-cli-Dmebgsw9.js +11 -0
  16. package/dist/chunks/batch-io-3UNbuV96.js +1 -0
  17. package/dist/chunks/builtin-auth-5ePYfzlb.js +17 -0
  18. package/dist/chunks/builtin-research-run-wait-DjOCdEOB.js +1 -0
  19. package/dist/chunks/builtin-update-mXZgyreW.js +3 -0
  20. package/dist/chunks/{cli-help-policy-CEyg0zEz.js → cli-help-policy-CEZPZEOQ.js} +1 -1
  21. package/dist/chunks/client-BwCSrdti.js +1 -0
  22. package/dist/chunks/{completion-CoE0a605.js → completion-Bs-t-EGB.js} +1 -1
  23. package/dist/chunks/contract-DuaB1_Ib.js +1 -0
  24. package/dist/chunks/contract-parameter-zkhCaKUz.js +1 -0
  25. package/dist/chunks/credential-redaction-Fd-q1M6s.js +1 -0
  26. package/dist/chunks/credential-store-DLz1bMPQ.js +2 -0
  27. package/dist/chunks/detail-Nzc6IsFj.js +1 -0
  28. package/dist/chunks/detail-xQRiBbkt.js +1 -0
  29. package/dist/chunks/dist-DL7QmxmX.js +8 -0
  30. package/dist/chunks/dist-DaW7WEqw.js +1 -0
  31. package/dist/chunks/dist-tIPA3BCL.js +1 -0
  32. package/dist/chunks/entity-Cg2n2mP0.js +1 -0
  33. package/dist/chunks/env-CpA6E7ay.js +1 -0
  34. package/dist/chunks/esm-lPyPa01D.js +1 -0
  35. package/dist/chunks/{generated-option-order-CZUJFgSS.js → generated-option-order-uCio4nh5.js} +1 -1
  36. package/dist/chunks/help-catalog-TLFLfBit.js +2 -0
  37. package/dist/chunks/help-intent-mWukB1eR.js +1 -0
  38. package/dist/chunks/http-credentials-BUPEQD7v.js +1 -0
  39. package/dist/chunks/internal-DaW7WEqw.js +1 -0
  40. package/dist/chunks/iso-l1vOidnb.js +56 -0
  41. package/dist/chunks/logging-BHp-5JwI.js +1 -0
  42. package/dist/chunks/logging-CgYAFXRk.js +1 -0
  43. package/dist/chunks/logout-BbrPf30h.js +1 -0
  44. package/dist/chunks/logout-Bdp97kEK.js +1 -0
  45. package/dist/chunks/mcp-generation-contract-BqIIjhgK.js +1 -0
  46. package/dist/chunks/{mcp-generation-contract-XdtSQ9XZ.js → mcp-generation-contract-DXSh-cPo.js} +1 -1
  47. package/dist/chunks/oauth-bearer-credential-CnBSeRRR.js +1 -0
  48. package/dist/chunks/oauth-bearer-credential-DUB8cIkw.js +1 -0
  49. package/dist/chunks/oauth-credential-CsMU443S.js +1 -0
  50. package/dist/chunks/oauth-credential-DgtNj00w.js +1 -0
  51. package/dist/chunks/oauth-login-Cy08UOVd.js +1 -0
  52. package/dist/chunks/oauth-login-DeqYDEv5.js +6 -0
  53. package/dist/chunks/openapi-call-B9zrl6Yl.js +96 -0
  54. package/dist/chunks/openapi-call-D20qhSmV.js +1 -0
  55. package/dist/chunks/openapi-commands-Bf1VrfFs.js +1 -0
  56. package/dist/chunks/{openapi-commands-BlMzQV8z.js → openapi-commands-H8nPBWJ_.js} +1 -1
  57. package/dist/chunks/openapi-composites-B9JPhVYN.js +1 -0
  58. package/dist/chunks/openapi-snapshot-BZ96PbpK.js +1 -0
  59. package/dist/chunks/{operations-uVpQkO2z.js → operations-bzE6xyA_.js} +2 -2
  60. package/dist/chunks/{operations-catalog-BiO8B33R.js → operations-catalog-DI6ryevT.js} +3 -3
  61. package/dist/chunks/operations-catalog-P7nOC15H.js +1 -0
  62. package/dist/chunks/operations-metadata-CsR2YIYJ.js +2 -0
  63. package/dist/chunks/{output-CtsN3oh3.js → output-BSANHETF.js} +1 -1
  64. package/dist/chunks/{output-BCOtzmsw.js → output-DmSQkWKL.js} +3 -3
  65. package/dist/chunks/{output-mode-DYvJUCAE.js → output-mode-COLMloqB.js} +1 -1
  66. package/dist/chunks/output-mode-Z-SqZGR4.js +1 -0
  67. package/dist/chunks/{output-spill-DBSmywMi.js → output-spill-CQ-IUOQG.js} +1 -1
  68. package/dist/chunks/parse-error-hint-C5ow4RG4.js +6 -0
  69. package/dist/chunks/payload-operand-guard-B5t_1_uQ.js +1 -0
  70. package/dist/chunks/person-owner-BRGa5Dee.js +1 -0
  71. package/dist/chunks/private-live-identity-AuYLZJvL.js +1 -0
  72. package/dist/chunks/private-live-identity-w8v84cKs.js +1 -0
  73. package/dist/chunks/private-telemetry-credential-FZxTymON.js +1 -0
  74. package/dist/chunks/provider-catalog-k5VPfOoO.js +1 -0
  75. package/dist/chunks/request-replay-B983xJ-7.js +1 -0
  76. package/dist/chunks/request-replay-BkF-apRY.js +1 -0
  77. package/dist/chunks/research-run-spend-D9aXcq6b.js +1 -0
  78. package/dist/chunks/response-problem-C1c4ogJm.js +1 -0
  79. package/dist/chunks/response-problem-D7yaxq6L.js +1 -0
  80. package/dist/chunks/result-envelope-DXFbrrkt.js +1 -0
  81. package/dist/chunks/rolldown-runtime-B09viugM.js +1 -0
  82. package/dist/chunks/run-detail-TzF_MGxB.js +1 -0
  83. package/dist/chunks/startup-auth-BU65BytV.js +1 -0
  84. package/dist/chunks/{startup-auth-DobaZEW6.js → startup-auth-BdSD5ehM.js} +1 -1
  85. package/dist/chunks/system-build-z_cn0X5C.js +1 -0
  86. package/dist/chunks/text-response-D44lxcy3.js +15 -0
  87. package/dist/chunks/tool-policy-C37kGt8n.js +1 -0
  88. package/dist/chunks/type-C0VR7LD-.js +1 -0
  89. package/dist/chunks/webapi-B2JTupyg.js +4 -0
  90. package/dist/chunks/webapi-WYeLOETY.js +1 -0
  91. package/package.json +3 -3
  92. package/dist/chunks/api-key-bearer-credential-CyFG5_Cm.js +0 -4
  93. package/dist/chunks/aventure-cli-uxhwf3qk.js +0 -11
  94. package/dist/chunks/builtin-auth-DzCjM2rV.js +0 -24
  95. package/dist/chunks/builtin-research-run-wait-BF06g2eh.js +0 -1
  96. package/dist/chunks/builtin-update-5IL6qRqK.js +0 -3
  97. package/dist/chunks/builtin-update-Dx_i2YGF.js +0 -1
  98. package/dist/chunks/contract-BztWeCTz.js +0 -1
  99. package/dist/chunks/detail-BTjlqGmV.js +0 -1
  100. package/dist/chunks/detail-D8sJIA5S.js +0 -1
  101. package/dist/chunks/dist-CGgP_Pxz.js +0 -1
  102. package/dist/chunks/esm-BVGNzX-8.js +0 -1
  103. package/dist/chunks/help-intent-kPjXtxOf.js +0 -1
  104. package/dist/chunks/logging-Bk8_GcPH.js +0 -1
  105. package/dist/chunks/logging-DchmkRaS.js +0 -1
  106. package/dist/chunks/mcp-generation-contract-D0mlhvEk.js +0 -1
  107. package/dist/chunks/oauth-bearer-credential-CMDf5sF6.js +0 -8
  108. package/dist/chunks/oauth-bearer-credential-flA02CPH.js +0 -1
  109. package/dist/chunks/oauth-login-Cj6xqtM3.js +0 -6
  110. package/dist/chunks/oauth-login-DHyn5cGQ.js +0 -1
  111. package/dist/chunks/openapi-call-CCpc56ir.js +0 -1
  112. package/dist/chunks/openapi-call-Cu_IqRxU.js +0 -96
  113. package/dist/chunks/openapi-commands-CKb-tN3f.js +0 -1
  114. package/dist/chunks/openapi-snapshot-C2TJ4vNL.js +0 -1
  115. package/dist/chunks/operation-invocation-C29yUZSq.js +0 -2
  116. package/dist/chunks/operations-catalog-CtACMf18.js +0 -1
  117. package/dist/chunks/operations-metadata-r3glpbEg.js +0 -2
  118. package/dist/chunks/output-mode-_ENfBi2N.js +0 -1
  119. package/dist/chunks/parse-error-hint-BNJ09L05.js +0 -6
  120. package/dist/chunks/payload-operand-guard-BVp_alVX.js +0 -1
  121. package/dist/chunks/person-owner-C0YuWKvY.js +0 -56
  122. package/dist/chunks/provider-catalog-Dy5L5Zvr.js +0 -1
  123. package/dist/chunks/reference-recovery-FRzF750i.js +0 -15
  124. package/dist/chunks/response-problem-BGEYFwd5.js +0 -1
  125. package/dist/chunks/result-envelope-5R2VEWAg.js +0 -1
  126. package/dist/chunks/startup-auth-CnOyg9R-.js +0 -1
  127. package/dist/chunks/tool-policy-BPefkvzQ.js +0 -1
@@ -0,0 +1,4 @@
1
+ import{r as e}from"./rolldown-runtime-B09viugM.js";var t=new TextEncoder,n=new TextDecoder,r=new TextDecoder(`utf-8`,{fatal:!0}),i=2**32;function a(...e){let t=e.reduce((e,{length:t})=>e+t,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function o(e,t,n){if(t<0||t>=i)throw RangeError(`value must be >= 0 and <= ${i-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,t&255],n)}function s(e){let t=Math.floor(e/i),n=e%i,r=new Uint8Array(8);return o(r,t,0),o(r,n,4),r}function c(e){let t=new Uint8Array(4);return o(t,e),t}var l=/[^\x00-\x7f]/;function u(e){if(typeof e==`string`&&e.length>=128){if(l.test(e))throw TypeError(`non-ASCII string encountered in encode()`);return t.encode(e)}let n=new Uint8Array(e.length);for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>127)throw TypeError(`non-ASCII string encountered in encode()`);n[t]=r}return n}function d(e,t=!1){if(Uint8Array.prototype.toBase64)return e.toBase64({alphabet:t?`base64url`:`base64`,omitPadding:t});let n=32768,r=[];for(let t=0;t<e.length;t+=n)r.push(String.fromCharCode.apply(null,e.subarray(t,t+n)));let i=btoa(r.join(``));return t?i.replace(/=/g,``).replace(/\+/g,`-`).replace(/\//g,`_`):i}function f(e,t=!1){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e,{alphabet:t?`base64url`:`base64`});if(t){if(e.includes(`+`)||e.includes(`/`))throw TypeError(`Invalid base64url`);e=e.replace(/-/g,`+`).replace(/_/g,`/`)}let n=atob(e),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r}async function p(e,t){let n=`SHA-${e.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(n,t))}var m=e({JOSEAlgNotAllowed:()=>v,JOSEError:()=>h,JOSENotSupported:()=>y,JWEDecryptionFailed:()=>b,JWEInvalid:()=>x,JWKInvalid:()=>w,JWKSInvalid:()=>T,JWKSMultipleMatchingKeys:()=>D,JWKSNoMatchingKey:()=>E,JWKSTimeout:()=>O,JWSInvalid:()=>S,JWSSignatureVerificationFailed:()=>k,JWTClaimValidationFailed:()=>g,JWTExpired:()=>_,JWTInvalid:()=>C}),h=class extends Error{static code=`ERR_JOSE_GENERIC`;code=`ERR_JOSE_GENERIC`;constructor(e,t){super(e,t),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}},g=class extends h{static code=`ERR_JWT_CLAIM_VALIDATION_FAILED`;code=`ERR_JWT_CLAIM_VALIDATION_FAILED`;claim;reason;payload;constructor(e,t,n=`unspecified`,r=`unspecified`){super(e,{cause:{claim:n,reason:r,payload:t}}),this.claim=n,this.reason=r,this.payload=t}},_=class extends h{static code=`ERR_JWT_EXPIRED`;code=`ERR_JWT_EXPIRED`;claim;reason;payload;constructor(e,t,n=`unspecified`,r=`unspecified`){super(e,{cause:{claim:n,reason:r,payload:t}}),this.claim=n,this.reason=r,this.payload=t}},v=class extends h{static code=`ERR_JOSE_ALG_NOT_ALLOWED`;code=`ERR_JOSE_ALG_NOT_ALLOWED`},y=class extends h{static code=`ERR_JOSE_NOT_SUPPORTED`;code=`ERR_JOSE_NOT_SUPPORTED`},b=class extends h{static code=`ERR_JWE_DECRYPTION_FAILED`;code=`ERR_JWE_DECRYPTION_FAILED`;constructor(e=`decryption operation failed`,t){super(e,t)}},x=class extends h{static code=`ERR_JWE_INVALID`;code=`ERR_JWE_INVALID`},S=class extends h{static code=`ERR_JWS_INVALID`;code=`ERR_JWS_INVALID`},C=class extends h{static code=`ERR_JWT_INVALID`;code=`ERR_JWT_INVALID`},w=class extends h{static code=`ERR_JWK_INVALID`;code=`ERR_JWK_INVALID`},T=class extends h{static code=`ERR_JWKS_INVALID`;code=`ERR_JWKS_INVALID`},E=class extends h{static code=`ERR_JWKS_NO_MATCHING_KEY`;code=`ERR_JWKS_NO_MATCHING_KEY`;constructor(e=`no applicable key found in the JSON Web Key Set`,t){super(e,t)}},D=class extends h{[Symbol.asyncIterator]=async function*(){};static code=`ERR_JWKS_MULTIPLE_MATCHING_KEYS`;code=`ERR_JWKS_MULTIPLE_MATCHING_KEYS`;constructor(e=`multiple matching keys found in the JSON Web Key Set`,t){super(e,t)}},O=class extends h{static code=`ERR_JWKS_TIMEOUT`;code=`ERR_JWKS_TIMEOUT`;constructor(e=`request timed out`,t){super(e,t)}},k=class extends h{static code=`ERR_JWS_SIGNATURE_VERIFICATION_FAILED`;code=`ERR_JWS_SIGNATURE_VERIFICATION_FAILED`;constructor(e=`signature verification failed`,t){super(e,t)}},A=e({decode:()=>M,encode:()=>N}),j=`The input to be decoded is not correctly encoded.`;function M(e){try{return f(typeof e==`string`?e:n.decode(e),!0)}catch(e){throw TypeError(j,{cause:e})}}function N(e){return d(typeof e==`string`?t.encode(e):e,!0)}function P(e,t){if(!(e instanceof Uint8Array))throw TypeError(`${t} must be an instance of Uint8Array`)}function F(e){if(typeof e!=`object`||!e||Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function ee(e){return F(e)&&Array.isArray(e.keys)&&Array.from(e.keys).every(F)}function te(...e){let t=new Set;for(let n of e)if(n)for(let e of Object.keys(n)){if(t.has(e))return!1;t.add(e)}return!0}function I(e,t){if(e!==void 0)throw TypeError(`${t} can only be called once`)}function L(e,t,n){try{return M(e)}catch{throw new n(`Failed to base64url decode the ${t}`)}}function ne(e,t,n){try{return u(e)}catch{throw new n(`The ${t} is not a valid base64url string`)}}function re(e,t,n){let i;try{i=JSON.parse(r.decode(M(e)))}catch{throw new t(n)}if(!F(i))throw new t(n);return i}var ie={__proto__:null,b64:!0},ae={__proto__:null};function oe(e,t){if(t!==void 0&&(!Array.isArray(t)||t.some(e=>typeof e!=`string`)))throw TypeError(`"${e}" option must be an array of strings`);return t===void 0?void 0:new Set(t)}function se(e,t){let{crit:n}=t??{};if(Array.isArray(n)&&new Set(n).size!==n.length)throw new e(`"crit" (Critical) Header Parameter MUST NOT contain duplicate values`)}function ce(e,t,n,r,i){if(i.crit!==void 0&&r?.crit===void 0)throw new e(`"crit" (Critical) Header Parameter MUST be integrity protected`);if(!r||r.crit===void 0)return[];if(!Array.isArray(r.crit)||r.crit.length===0||r.crit.some(e=>typeof e!=`string`||e.length===0))throw new e(`"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present`);let a=n===void 0?t:{__proto__:null,...n,...t};for(let t of r.crit){if(!(t in a))throw new y(`Extension Header Parameter "${t}" is not recognized`);if(!Object.hasOwn(i,t)||i[t]===void 0)throw new e(`Extension Header Parameter "${t}" is missing`);if(a[t]&&(!Object.hasOwn(r,t)||r[t]===void 0))throw new e(`Extension Header Parameter "${t}" MUST be integrity protected`)}return r.crit}function le(e,t){if(t.includes(`b64`)){let t=e.b64;if(typeof t!=`boolean`)throw new S(`The "b64" (base64url-encode payload) Header Parameter must be a boolean`);return t}return!0}function ue(e,t){let n,r;try{n=JSON.stringify(t),r=JSON.parse(n)}catch(t){throw new e(`JOSE Header is not valid JSON`,{cause:t})}if(!F(r))throw new e(`JOSE Header is not a JSON object`);return[r,n]}var de=e=>e[Symbol.toStringTag],fe=(e,t,n)=>{let{alg:r}=e;if(t.use!==void 0){let e=n===`sign`||n===`verify`?`sig`:`enc`;if(t.use!==e)throw TypeError(`Invalid key for this operation, its "use" must be "${e}" when present`)}if(t.alg!==void 0&&t.alg!==r)throw TypeError(`Invalid key for this operation, its "alg" must be "${r}" when present`);if(Array.isArray(t.key_ops)){let r=n===`encrypt`||n===`decrypt`?e.ops?.[n===`encrypt`?0:1]:n;if(r&&!t.key_ops.includes(r))throw TypeError(`Invalid key for this operation, its "key_ops" must include "${r}" when present`)}};async function R(e,t,n){let{alg:r,secret:i}=e,a=n===`decrypt`||n===`sign`;if(i&&t instanceof Uint8Array)return t;let o,s;if(F(t)){if(o=Te(t),typeof o.kty!=`string`)throw ye(r,t,i);if(!(i?o.kty===`oct`&&typeof o.k==`string`:o.kty!==`oct`&&(a?o.kty===`AKP`&&typeof o.priv==`string`||typeof o.d==`string`:o.d===void 0&&o.priv===void 0)))throw TypeError(i?`JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present`:`JSON Web Key for this operation must be a ${a?`private`:`public`} JWK`);if(fe(e,o,n),o.kty===`oct`)return M(o.k);if(!Object.isFrozen(t)){let{key_ops:e}=t;Array.isArray(e)&&Object.freeze(e),Object.freeze(t)}}else{if(!_e(t))throw ye(r,t,i);let e=i?`secret`:a?`private`:`public`;if(t.type!==e&&(i||[`secret`,`public`,`private`].includes(t.type)))throw TypeError(`${de(t)} instances must be of type "${e}" for the ${r} algorithm`);if(z(t))return t;if(s=t,s.type===`secret`)return s.export()}pe||=new WeakMap;let c=t,l=pe.get(c);if(l?.[r])return l[r];if(l||pe.set(c,l={}),s&&typeof s.toCryptoKey==`function`){let t=s.type===`public`,n=me[s.asymmetricKeyDetails?.namedCurve],i=e.resolve?.({crv:n,asymmetricKeyType:s.asymmetricKeyType})??e.subtle;return l[r]=s.toCryptoKey(i,t,e.usages[+!t])}return o??=s.export({format:`jwk`}),o.alg=r,l[r]=await V(e,o)}var pe,me={__proto__:null,prime256v1:`P-256`,secp384r1:`P-384`,secp521r1:`P-521`};function he(e){if(!z(e))throw Error(`CryptoKey instance expected`)}var z=e=>{if(e?.[Symbol.toStringTag]===`CryptoKey`)return!0;try{return e instanceof CryptoKey}catch{return!1}},ge=e=>e?.[Symbol.toStringTag]===`KeyObject`,_e=e=>z(e)||ge(e);function ve(e,t,...n){if(n.length>2){let t=n.pop();e+=`one of type ${n.join(`, `)}, or ${t}.`}else n.length===2?e+=`one of type ${n[0]} or ${n[1]}.`:e+=`of type ${n[0]}.`;return t==null?e+=` Received ${t}`:typeof t==`function`&&t.name?e+=` Received function ${t.name}`:typeof t==`object`&&t&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}var B=(e,...t)=>ve(`Key must be `,e,...t);function ye(e,t,n){let r=[`CryptoKey`,`KeyObject`,`JSON Web Key`];return n&&r.push(`Uint8Array`),TypeError(ve(`Key for the ${e} algorithm must be `,t,...r))}var be=(e,t=`algorithm.name`)=>TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);function xe(e,t){if(t&&!e.usages.includes(t))throw TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}function Se(e,t){let{modulusLength:n}=t.algorithm;if(typeof n!=`number`||n<2048)throw TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}function Ce(e,t,n){let r=e.algorithm;if(r.name!==t.name)throw be(t.name);if(t.hash&&r.hash?.name!==t.hash)throw be(t.hash,`algorithm.hash`);if(t.namedCurve&&r.namedCurve!==t.namedCurve)throw be(t.namedCurve,`algorithm.namedCurve`);if(t.length!==void 0&&r.length!==t.length)throw be(t.length,`algorithm.length`);xe(e,n)}function we(e){return{__proto__:null,...e}}function Te(e){let t=we(e);if(t.ext!==void 0&&typeof t.ext!=`boolean`)throw TypeError(`"ext" (Extractable) Parameter must be a boolean`);if(t.key_ops!==void 0){let e=t.key_ops,n=Array.isArray(e)?[...e]:void 0;if(!n||n.some(e=>typeof e!=`string`)||new Set(n).size!==n.length)throw TypeError(`"key_ops" (Key Operations) Parameter must be an array of unique strings`);t.key_ops=n}return t}function Ee(e){if(e!==void 0&&typeof e!=`boolean`)throw TypeError(`"extractable" option must be a boolean`);return e}async function V(e,t,n){if(!e.kty.includes(t.kty))throw new y(`Invalid or unsupported JWK "alg" (Algorithm) Parameter value`);let r=e.resolve?.({kty:t.kty,crv:t.crv})??e.subtle,i=!!(t.d||t.priv),a={...t,ext:n??t.ext};return a.kty!==`AKP`&&delete a.alg,delete a.use,crypto.subtle.importKey(`jwk`,a,r,a.ext??!i,t.key_ops??e.usages[+!!i])}async function H(e,t,n,r=!1){return e instanceof Uint8Array&&(e=await crypto.subtle.importKey(`raw`,e,t,r,[n])),Ce(e,t,n),e}var De=e=>crypto.getRandomValues(new Uint8Array(e.cekBits>>3));function Oe(e,t){let n=e.byteLength<<3;if(n!==t)throw new x(`Invalid Content Encryption Key length. Expected ${t} bits, got ${n} bits`)}var ke=e=>crypto.getRandomValues(new Uint8Array(e.ivBits>>3));function Ae(e,t){if(t.length<<3!==e.ivBits)throw new x(`Invalid Initialization Vector length`)}async function je(e,t,n){if(!(t instanceof Uint8Array))throw TypeError(B(t,`Uint8Array`));let r=e.cekBits>>1;return[await crypto.subtle.importKey(`raw`,t.subarray(r>>3),`AES-CBC`,!1,[n]),await crypto.subtle.importKey(`raw`,t.subarray(0,r>>3),{hash:`SHA-${r<<1}`,name:`HMAC`},!1,[`sign`]),r]}async function Me(e,t,n){return new Uint8Array((await crypto.subtle.sign(`HMAC`,e,t)).slice(0,n>>3))}async function Ne(e,t,n,r,i){let[o,c,l]=await je(e,n,`encrypt`),u=new Uint8Array(await crypto.subtle.encrypt({iv:r,name:`AES-CBC`},o,t));return{ciphertext:u,tag:await Me(c,a(i,r,u,s(i.length*8)),l),iv:r}}async function Pe(e,t){let n={name:`HMAC`,hash:`SHA-256`},r=await crypto.subtle.generateKey(n,!1,[`sign`,`verify`]),i=await crypto.subtle.sign(n,r,e);return crypto.subtle.verify(n,r,i,t)}async function Fe(e,t,n,r,i,o){let[c,l,u]=await je(e,t,`decrypt`),d=await Me(l,a(o,r,n,s(o.length*8)),u);try{if(await Pe(i,d))return new Uint8Array(await crypto.subtle.decrypt({iv:r,name:`AES-CBC`},c,n))}catch{}throw new b}async function Ie(e,t,n,r,i){if(!z(n)&&!(n instanceof Uint8Array))throw TypeError(B(n,`CryptoKey`,`KeyObject`,`Uint8Array`,`JSON Web Key`));if(r?Ae(e,r):r=ke(e),n instanceof Uint8Array&&Oe(n,e.cekBits),e.cbc)return Ne(e,t,n,r,i);let a=await H(n,e.subtle,`encrypt`),o=new Uint8Array(await crypto.subtle.encrypt({additionalData:i,iv:r,name:`AES-GCM`,tagLength:128},a,t));return{ciphertext:o.subarray(0,-16),tag:o.subarray(-16),iv:r}}async function Le(e,t,n,r,i,o){if(!z(t)&&!(t instanceof Uint8Array))throw TypeError(B(t,`CryptoKey`,`KeyObject`,`Uint8Array`,`JSON Web Key`));if(!r)throw new x(`JWE Initialization Vector missing`);if(!i)throw new x(`JWE Authentication Tag missing`);if(!e.cbc&&i.length!==16)throw new x(`Invalid Authentication Tag length`);if(Ae(e,r),t instanceof Uint8Array&&Oe(t,e.cekBits),e.cbc)return Fe(e,t,n,r,i,o);let s=await H(t,e.subtle,`decrypt`);try{return new Uint8Array(await crypto.subtle.decrypt({additionalData:o,iv:r,name:`AES-GCM`,tagLength:128},s,a(n,i)))}catch{throw new b}}function Re(e){let t={__proto__:null};for(let n in e)t[n]={...e[n],alg:n};return t}var ze=[[`encrypt`,`wrapKey`],[`decrypt`,`unwrapKey`]],Be=[[],[`deriveBits`]],Ve=[[],[]];function He(e){return{kty:[`RSA`],mode:`key-encryption`,subtle:{name:`RSA-OAEP`,hash:`SHA-${e}`},usages:ze,ops:[`wrapKey`,`unwrapKey`]}}function Ue(e){return{kty:[`EC`,`OKP`],mode:e,subtle:{name:`ECDH`},resolve:({kty:e,crv:t,asymmetricKeyType:n})=>{if(t===`X25519`||n===`x25519`)return{name:`X25519`};if(e===`OKP`)throw new y(`Invalid or unsupported JWK "alg" (Algorithm) Parameter value`);return{name:`ECDH`,namedCurve:t}},usages:Be,ops:[void 0,`deriveBits`]}}function U(e,t=!1){return{kty:[`oct`],mode:`key-wrapping`,secret:!0,subtle:{name:t?`AES-GCM`:`AES-KW`,length:e},usages:Ve,ops:t?[`encrypt`,`decrypt`]:[`wrapKey`,`unwrapKey`]}}function We(){return{kty:[`oct`],mode:`key-wrapping`,secret:!0,subtle:{name:`PBKDF2`},usages:Ve,ops:[`deriveBits`,`deriveBits`]}}var Ge=Re({dir:{kty:[`oct`],mode:`direct-encryption`,secret:!0,subtle:{name:`AES-GCM`},usages:Ve,ops:[`encrypt`,`decrypt`]},"RSA-OAEP":He(1),"RSA-OAEP-256":He(256),"RSA-OAEP-384":He(384),"RSA-OAEP-512":He(512),"ECDH-ES":Ue(`direct-key-agreement`),"ECDH-ES+A128KW":Ue(`key-agreement-with-key-wrapping`),"ECDH-ES+A192KW":Ue(`key-agreement-with-key-wrapping`),"ECDH-ES+A256KW":Ue(`key-agreement-with-key-wrapping`),A128KW:U(128),A192KW:U(192),A256KW:U(256),A128GCMKW:U(128,!0),A192GCMKW:U(192,!0),A256GCMKW:U(256,!0),"PBES2-HS256+A128KW":We(),"PBES2-HS384+A192KW":We(),"PBES2-HS512+A256KW":We()}),Ke=[`encrypt`,`decrypt`];function W(e,t=!1){return{kty:[`oct`],secret:!0,subtle:{name:t?`AES-CBC`:`AES-GCM`,length:e},usages:Ve,ops:Ke,cekBits:e,ivBits:t?128:96,cbc:t}}var qe=Re({A128GCM:W(128),A192GCM:W(192),A256GCM:W(256),"A128CBC-HS256":W(256,!0),"A192CBC-HS384":W(384,!0),"A256CBC-HS512":W(512,!0)});function Je(e,t){throw new y(`Invalid or unsupported "${e}" (JWE ${t}) header value`)}function G(e){return(typeof e==`string`?Ge[e]:void 0)??Je(`alg`,`Algorithm`)}function K(e){return e.mode===`key-wrapping`||e.mode===`key-encryption`||e.mode===`key-agreement-with-key-wrapping`}function Ye(e){return(typeof e==`string`?qe[e]:void 0)??Je(`enc`,`Encryption Algorithm`)}function Xe(e,t){if(e.algorithm.name!==`ECDH`&&e.algorithm.name!==`X25519`)throw TypeError(`CryptoKey does not support this operation, its algorithm.name must be ECDH or X25519`);xe(e,t)}async function Ze(e,t,n){let r=await H(t,G(e).subtle,`wrapKey`,!0),i=await crypto.subtle.importKey(`raw`,n,{hash:`SHA-256`,name:`HMAC`},!0,[`sign`]);return new Uint8Array(await crypto.subtle.wrapKey(`raw`,i,r,`AES-KW`))}async function Qe(e,t,n){let r=await H(t,G(e).subtle,`unwrapKey`,!0),i=await crypto.subtle.unwrapKey(`raw`,n,r,`AES-KW`,{hash:`SHA-256`,name:`HMAC`},!0,[`sign`]);return new Uint8Array(await crypto.subtle.exportKey(`raw`,i))}function $e(e,t,n){Ce(t,G(e).subtle,n),Se(e,t)}async function et(e,t,n,r){if(!(e instanceof Uint8Array)||e.length<8)throw new x(`PBES2 Salt Input must be 8 or more octets`);if(!Number.isSafeInteger(n)||Math.sign(n)!==1)throw new x(`PBES2 Count Input must be a positive integer`);let i=a(u(t),Uint8Array.of(0),e),o=parseInt(t.slice(13,16),10),s={hash:`SHA-${t.slice(8,11)}`,iterations:n,name:`PBKDF2`,salt:i},c=await H(r,G(t).subtle,`deriveBits`);return new Uint8Array(await crypto.subtle.deriveBits(s,c,o))}function tt(e){return a(c(e.length),e)}async function nt(e,t,n){let r=t>>3,i=Math.ceil(r/32),o=new Uint8Array(i*32);for(let t=1;t<=i;t++){let r=await p(`sha256`,a(c(t),e,n));o.set(r,(t-1)*32)}return o.slice(0,r)}async function rt(e,t,n,r,i=new Uint8Array,o=new Uint8Array){Xe(e),Xe(t,`deriveBits`);let s=a(tt(u(n)),tt(i),tt(o),c(r));return nt(new Uint8Array(await crypto.subtle.deriveBits({name:e.algorithm.name,public:e},t,e.algorithm.name===`X25519`?256:Math.ceil(parseInt(e.algorithm.namedCurve.slice(-3),10)/8)<<3)),r,s)}function it(e){he(e);let t=e.algorithm.namedCurve;if(t!==`P-256`&&t!==`P-384`&&t!==`P-521`&&e.algorithm.name!==`X25519`)throw new y(`ECDH with the provided key is not allowed or not supported by your javascript runtime`)}function at(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`string`)throw new x(`JOSE Header "${t}" (Agreement Party${t===`apu`?`U`:`V`}Info) invalid`);return L(n,t,x)}}function ot(e,t){if(e!==void 0&&t!==void 0&&e.byteLength===t.byteLength){for(let n=0;n<e.byteLength;n++)if(e[n]!==t[n])return;throw new x(`JOSE Header "apu" and "apv" values must be distinct`)}}function st(e){if(e===void 0)throw new x(`JWE Encrypted Key missing`)}function ct(e){if(e!==void 0)throw new x(`Encountered unexpected JWE Encrypted Key`)}function lt(e){if(e!==void 0&&e!==1/0&&(!Number.isSafeInteger(e)||e<1))throw TypeError(`maxPBES2Count must be a positive safe integer or Infinity`)}async function ut(e,t,n,r,i,a){let{alg:o}=e,s=e.mode;if(s===`direct-encryption`)return ct(r),n;let c=s===`direct-key-agreement`;switch(c?ct(r):st(r),e.subtle.name){case`ECDH`:{let{epk:r}=i;if(!F(r)||[`d`,`k`,`p`,`q`,`dp`,`dq`,`qi`,`oth`,`priv`].some(e=>Object.hasOwn(r,e)))throw new x(`JOSE Header "epk" (Ephemeral Public Key) missing or invalid`);it(n);let a=await V(e,r),s=at(i,`apu`),l=at(i,`apv`);ot(s,l);let u=await rt(a,n,c?t.alg:o,c?t.cekBits:parseInt(o.slice(-5,-2),10),s,l);if(c)return u;n=u;break}case`RSA-OAEP`:return he(n),$e(o,n,`decrypt`),new Uint8Array(await crypto.subtle.decrypt(`RSA-OAEP`,n,r));case`PBKDF2`:{if(typeof i.p2c!=`number`)throw new x(`JOSE Header "p2c" (PBES2 Count) missing or invalid`);lt(a);let e=a??1e4;if(i.p2c>e)throw new x(`JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds`);if(typeof i.p2s!=`string`)throw new x(`JOSE Header "p2s" (PBES2 Salt) missing or invalid`);n=await et(L(i.p2s,`p2s`,x),o,i.p2c,n);break}case`AES-GCM`:{if(typeof i.iv!=`string`)throw new x(`JOSE Header "iv" (Initialization Vector) missing or invalid`);if(typeof i.tag!=`string`)throw new x(`JOSE Header "tag" (Authentication Tag) missing or invalid`);let e=L(i.iv,`iv`,x),t=L(i.tag,`tag`,x);if(e.byteLength!==12)throw new x(`Invalid Initialization Vector length`);if(t.byteLength!==16)throw new x(`Invalid Authentication Tag length`);return Le(Ye(o.slice(0,-2)),n,r,e,t,new Uint8Array)}}return Qe(o.slice(-6),n,r)}async function dt(e,t,n,r,i,a={}){let{alg:o,mode:s}=e,c=K(e);if(i!==void 0&&!c)throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${o}`);let l=await R(s===`direct-encryption`?t:e,n,`encrypt`);if(s===`direct-encryption`)return[l,void 0,void 0];let u=c?i??De(t):void 0;u&&Oe(u,t.cekBits);let d,f;switch(e.subtle.name){case`ECDH`:{it(l);let{apu:n,apv:i}=a;n!==void 0&&P(n,`"apu"`),i!==void 0&&P(i,`"apv"`);let c=n??at(r,`apu`),u=i??at(r,`apv`);ot(c,u);let d;d=a.epk===void 0?(await crypto.subtle.generateKey(l.algorithm,!0,[`deriveBits`])).privateKey:await R(e,a.epk,`decrypt`);let p=crypto.subtle,m=d;if(!m.extractable){if(typeof p.getPublicKey!=`function`)throw TypeError(`CryptoKey for "epk" must be extractable`);m=await p.getPublicKey(d,[])}let{x:h,y:g,crv:_,kty:v}=await p.exportKey(`jwk`,m),y=s===`direct-key-agreement`,b=await rt(l,d,y?t.alg:o,y?t.cekBits:parseInt(o.slice(-5,-2),10),c,u),x={x:h,crv:_,kty:v};if(v===`EC`&&(x.y=g),f={epk:x},n!==void 0&&(f.apu=N(n)),i!==void 0&&(f.apv=N(i)),y)return[b,void 0,f];l=b;break}case`RSA-OAEP`:he(l),$e(o,l,`encrypt`),d=new Uint8Array(await crypto.subtle.encrypt(`RSA-OAEP`,l,u));break;case`PBKDF2`:{let{p2c:e=2048,p2s:t=crypto.getRandomValues(new Uint8Array(16))}=a;l=await et(t,o,e,l),f={p2c:e,p2s:N(t)};break}case`AES-GCM`:{let e=a.iv===void 0?crypto.getRandomValues(new Uint8Array(12)):a.iv;if(!(e instanceof Uint8Array))throw TypeError(`"iv" must be an instance of Uint8Array`);let t=await Ie(Ye(o.slice(0,-2)),u,l,e,new Uint8Array);d=t.ciphertext,f={iv:N(t.iv),tag:N(t.tag)}}}if(d??=await Ze(o.slice(-6),l,u),!(d instanceof Uint8Array)||!d.byteLength)throw TypeError(`JWE key management algorithm did not produce an Encrypted Key`);return[u,d,f]}function ft(e,t){if(e.zip!==void 0&&e.zip!==`DEF`)throw new y(`Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.`);if(e.zip!==void 0&&!t?.zip)throw new x(`JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.`)}function pt(e){if(typeof globalThis[e]>`u`)throw new y(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${e} API.`)}async function mt(e,t,n=1/0){let r=e.writable.getWriter();r.write(t).catch(()=>{}),r.close().catch(()=>{});let i=[],o=0,s=e.readable.getReader();for(;;){let{value:e,done:t}=await s.read();if(t)break;if(i.push(e),o+=e.byteLength,n!==1/0&&o>n)throw new x(`Decompressed plaintext exceeded the configured limit`)}return a(...i)}async function ht(e){return pt(`CompressionStream`),mt(new CompressionStream(`deflate-raw`),e)}async function gt(e,t){return pt(`DecompressionStream`),mt(new DecompressionStream(`deflate-raw`),e,t)}function _t(e){let{aad:t,ciphertext:n,iv:r,protected:i,tag:a,unprotected:o}=e;if(r!==void 0&&(typeof r!=`string`||!r))throw new x(`JWE Initialization Vector incorrect type`);if(typeof n!=`string`)throw new x(`JWE Ciphertext missing or incorrect type`);if(a!==void 0&&(typeof a!=`string`||!a))throw new x(`JWE Authentication Tag incorrect type`);if(i!==void 0&&typeof i!=`string`)throw new x(`JWE Protected Header incorrect type`);if(t!==void 0&&(typeof t!=`string`||!t))throw new x(`JWE AAD incorrect type`);if(o!==void 0&&!F(o))throw new x(`JWE Shared Unprotected Header incorrect type`);return{aad:t,ciphertext:n,iv:r,protected:i,tag:a,unprotected:o===void 0?void 0:{...o}}}function vt(e){let t,n;try{let{header:r}=e;if(F(r)){n=r.alg;let e=Object.keys(r);e.includes(`alg`)||(n=void 0),t=Object.fromEntries(e.map(e=>[e,e===`alg`?n:r[e]]))}else t=r;let{encrypted_key:i}=e;return[{encrypted_key:i,header:t},n]}catch(e){return[void 0,n,e]}}function yt(e){let{encrypted_key:t,header:n}=e;if(t!==void 0&&typeof t!=`string`)throw new x(`JWE Encrypted Key incorrect type`);if(n!==void 0&&!F(n))throw new x(`JWE Per-Recipient Unprotected Header incorrect type`);if(e.protected===void 0&&n===void 0&&e.unprotected===void 0)throw new x(`JOSE Header missing`)}function bt(e){let{protected:t,ciphertext:n,iv:r,tag:i,aad:a}=e,o;return t!==void 0&&(o=re(t,x,`JWE Protected Header is invalid`)),[o,L(n,`ciphertext`,x),r===void 0?void 0:L(r,`iv`,x),i===void 0?void 0:L(i,`tag`,x),ne((t??``)+(a===void 0?``:`.${a}`),`aad`,x)]}function xt(e){return[e&&oe(`keyManagementAlgorithms`,e.keyManagementAlgorithms),e&&oe(`contentEncryptionAlgorithms`,e.contentEncryptionAlgorithms),e?.crit,e?.maxPBES2Count,e?.maxDecompressedLength]}async function St(e,t,n,r=bt(e)){let[i,a,o,s,c]=r,{header:l,unprotected:u,aad:d}=e,f;if(l!==void 0||u!==void 0){if(!te(i,l,u))throw new x(`JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint`);f={...i,...l,...u}}else f=i??{};let[p,m,h,g,_]=t,{encrypted_key:b}=e;ce(x,ae,h,i,f),ft(f,i);let{alg:S,enc:C}=f;if(typeof S!=`string`||!S)throw new x(`missing JWE Algorithm (alg) in JWE Header`);let w=Ge[S];if(b===``&&(!w||!K(w)))throw new x(`JWE Encrypted Key incorrect type`);let T=w?.mode===`integrated-encryption`;if(!T&&(typeof C!=`string`||!C))throw new x(`missing JWE Encryption Algorithm (enc) in JWE Header`);if(p&&!p.has(S)||!p&&S.startsWith(`PBES2`))throw new v(`"alg" (Algorithm) Header Parameter value not allowed`);let E;if(T){if(C!==void 0)throw new x(`JWE "enc" (Encryption Algorithm) Header Parameter must not be present for integrated encryption`);if(o?.byteLength)throw new x(`JWE Initialization Vector must be empty for integrated encryption`);if(s?.byteLength)throw new x(`JWE Authentication Tag must be empty for integrated encryption`)}else{if(m&&!m.has(C))throw new v(`"enc" (Encryption Algorithm) Header Parameter value not allowed`);E=Ye(C)}let D;if(b!==void 0)try{D=L(b,`encrypted_key`,x)}catch(e){if(!w||!K(w))throw e;D=new Uint8Array}let O=!1;typeof n==`function`&&(n=await n(i,e),O=!0);let k=w??G(S);K(k)&&D===void 0&&(D=new Uint8Array);let A=await R(k.mode===`direct-encryption`?E:k,n,`decrypt`),j;if(k.mode===`integrated-encryption`)j=await k.decrypt(A,D,a,c,i,f);else{let e=E,t;try{t=await ut(k,e,A,D,f,g),K(k)&&t instanceof Uint8Array&&t.byteLength<<3!==e.cekBits&&(t=De(e))}catch(n){if(n instanceof TypeError||n instanceof x||n instanceof y)throw n;t=De(e)}j=await Le(e,t,a,o,s,c)}if(f.zip===`DEF`){let e=_??25e4;if(e===0)throw new y(`JWE "zip" (Compression Algorithm) Header Parameter is not supported.`);if(e!==1/0&&(!Number.isSafeInteger(e)||e<1))throw TypeError(`maxDecompressedLength must be 0, a positive safe integer, or Infinity`);j=await gt(j,e).catch(e=>{throw e instanceof x?e:new x(`Failed to decompress plaintext`,{cause:e})})}return{plaintext:j,...i&&{protectedHeader:i},...d!==void 0&&{additionalAuthenticatedData:L(d,`aad`,x)},...u&&{sharedUnprotectedHeader:u},...l&&{unprotectedHeader:l},...O&&{key:A}}}async function Ct(e,t,r){if(e instanceof Uint8Array&&(e=n.decode(e)),typeof e!=`string`)throw new x(`Compact JWE must be a string or Uint8Array`);let{0:i,1:a,2:o,3:s,4:c,length:l}=e.split(`.`);if(l!==5)throw new x(`Invalid Compact JWE`);return St({ciphertext:s,iv:o||void 0,protected:i,tag:c||void 0,encrypted_key:a||void 0},t,r)}async function wt(e,t,n){return Ct(e,xt(n),t)}async function Tt(e,t,n){if(!F(e))throw new x(`Flattened JWE must be an object`);let r=_t(e),[i,,a]=vt(e);if(!i)throw a;let o={...r,...i};return yt(o),St(o,xt(n),t)}async function Et(e,t,n){if(!F(e))throw new x(`General JWE must be an object`);let r=e.recipients;if(!Array.isArray(r))throw new x(`JWE Recipients missing or incorrect type`);let i=Array.from(r);if(!i.every(F))throw new x(`JWE Recipients missing or incorrect type`);if(!i.length)throw new x(`JWE Recipients has no members`);let a,o,s;try{a=xt(n),o=_t(e),s=bt(o)}catch{throw new b}let c=i.map(e=>vt(e));if(i.length>1)for(let[,e]of c){let t=s[0]?.alg??e??o.unprotected?.alg,n=typeof t==`string`?Ge[t]:void 0;if(n&&!K(n))throw new x(`"${t}" alg may only have a single recipient`)}for(let[e]of c)if(e)try{let n={...o,...e};return yt(n),await St(n,a,t,s)}catch{}throw new b}function Dt(e,t,n){if(!te(e,t,n))throw new x(`JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint`)}function Ot(e,t,n=!1){if(!e[1]&&!e[2]&&!e[3])throw new x(`either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()`);t!==void 0&&(e[8]=t?.crit);let[,r,i,a,o,s,c,l,u]=e;if(o!==void 0&&P(o,`JWE Additional Authenticated Data`),s!==void 0&&P(s,`JWE Content Encryption Key`),c!==void 0&&P(c,`JWE Initialization Vector`),!n&&r!==void 0&&(r=ue(x,r)[0],e[1]=r),i!==void 0&&(i=ue(x,i)[0],e[2]=i),!n&&a!==void 0&&(a=ue(x,a)[0],e[3]=a),l!==void 0&&!F(l))throw TypeError(`JWE Key Management Parameters must be an object`);Dt(r,i,a);let d={...r,...i,...a};se(x,r),ce(x,ae,u,r,d),ft(d,r);let{alg:f,enc:p}=d;if(typeof f!=`string`||!f)throw new x(`JWE "alg" (Algorithm) Header Parameter missing or invalid`);let m=Ge[f];if(m?.mode===`integrated-encryption`){if(p!==void 0)throw new x(`JWE "enc" (Encryption Algorithm) Header Parameter must not be present for integrated encryption`);if(s!==void 0)throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${f}`);if(c!==void 0)throw TypeError(`setInitializationVector cannot be called with JWE "alg" (Algorithm) Header ${f}`);return[d,void 0,m]}if(typeof p!=`string`||!p)throw new x(`JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid`);return[d,Ye(p),m]}async function kt(e,t,n){let[r,i,a]=t,[o,s,c,l,d,f,p,m,,h]=e,g=s,_=c,v=a??G(r.alg),y,b,S;v.mode===`integrated-encryption`?S=await R(v,n,`encrypt`):[S,y,b]=await dt(v,i,n,r,f,m),b&&(h?_=_?{..._,...b}:b:g=g?{...g,...b}:b,Dt(g,_,l));let C=g?N(JSON.stringify(g)):``,w=d?.byteLength?N(d):void 0,T=u(w?`${C}.${w}`:C),E=o;r.zip===`DEF`&&(E=await ht(E).catch(e=>{throw new x(`Failed to compress plaintext`,{cause:e})}));let D,O,k;v.mode===`integrated-encryption`?[y,D]=await v.encrypt(S,E,T,g,r,m):{ciphertext:D,tag:O,iv:k}=await Ie(i,E,S,p,T);let A={ciphertext:N(D)};return k&&(A.iv=N(k)),O&&(A.tag=N(O)),y?.byteLength&&(A.encrypted_key=N(y)),w&&(A.aad=w),g&&(A.protected=C),l&&(A.unprotected=l),_&&(A.header=_),A}async function At(e,t,n){return kt(e,Ot(e,n),t)}function jt(e){return[e.protected,e.encrypted_key,e.iv,e.ciphertext,e.tag].join(`.`)}var Mt=class{#e;state;constructor(e,t,n){this.#e=e,this.state=[void 0,void 0,t,n]}setUnprotectedHeader(e){return I(this.state[0],`setUnprotectedHeader`),this.state[0]=e,this}setKeyManagementParameters(e){return I(this.state[1],`setKeyManagementParameters`),this.state[1]=e,this}addRecipient(...e){return this.#e.addRecipient(...e)}encrypt(...e){return this.#e.encrypt(...e)}done(){return this.#e}},Nt=class{#e;#t=[];#n;#r;#i;constructor(e){this.#e=e}addRecipient(e,t){let n=new Mt(this,e,t?.crit);return this.#t.push(n),n}setProtectedHeader(e){return I(this.#n,`setProtectedHeader`),this.#n=e,this}setSharedUnprotectedHeader(e){return I(this.#r,`setSharedUnprotectedHeader`),this.#r=e,this}setAdditionalAuthenticatedData(e){return this.#i=e,this}async encrypt(){if(!this.#t.length)throw new x(`at least one recipient must be added`);P(this.#e,`plaintext`);let e=this.#t.length>1,t,n=this.#n,r=this.#r,i=[];for(let a of this.#t){let[o,s,c,l]=a.state,u=[this.#e,n,o,r,this.#i,void 0,void 0,s,l,e],d=Ot(u,void 0,i.length>0);i.length||(n=u[1],r=u[3]),i.push([u,d,c]);let[{alg:f,enc:p},,m]=d;if(e&&m&&!K(m))throw new x(`"${f}" alg may only have a single recipient`);if(!t)t=p;else if(t!==p)throw new x(`JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients`)}for(let[,e]of i)e[2]??=G(e[0].alg);let[a,o,s]=i[0],c=e?De(o[1]):void 0;a[5]=c;let{encrypted_key:l,header:u,...d}=await kt(a,o,s),f={...d,recipients:[{}]};l&&(f.recipients[0].encrypted_key=l),u&&(f.recipients[0].header=u);for(let e=1;e<i.length;e++){let[t,[n,r,a],o]=i[e],s=t[2],[,l,u]=await dt(a,r,o,n,c,t[7]),d={encrypted_key:N(l)};if(s||u){let e={...s,...u};u&&Dt(t[1],e,t[3]),d.header=e}f.recipients.push(d)}return f}},Pt=[[`verify`],[`sign`]];function Ft(e){let t={name:`HMAC`,hash:`SHA-${e}`};return{kty:[`oct`],secret:!0,subtle:t,signing:t,usages:Pt}}function q(e,t){let n={name:t?`RSA-PSS`:`RSASSA-PKCS1-v1_5`,hash:`SHA-${e}`};return{kty:[`RSA`],subtle:n,signing:t?{...n,saltLength:t}:n,usages:Pt,minRsaBits:2048}}function It(e,t){return{kty:[`EC`],crv:e,subtle:{name:`ECDSA`,namedCurve:e},signing:{name:`ECDSA`,hash:`SHA-${t}`},usages:Pt}}function Lt(){let e={name:`Ed25519`};return{kty:[`OKP`],crv:`Ed25519`,subtle:e,signing:e,usages:Pt}}function Rt(e){let t={name:`ML-DSA-${e}`};return{kty:[`AKP`],subtle:t,signing:t,usages:Pt}}var zt=Re({HS256:Ft(256),HS384:Ft(384),HS512:Ft(512),RS256:q(256),RS384:q(384),RS512:q(512),PS256:q(256,32),PS384:q(384,48),PS512:q(512,64),ES256:It(`P-256`,256),ES384:It(`P-384`,384),ES512:It(`P-521`,512),EdDSA:Lt(),Ed25519:Lt(),"ML-DSA-44":Rt(44),"ML-DSA-65":Rt(65),"ML-DSA-87":Rt(87)});function Bt(e){let t=typeof e==`string`?zt[e]:void 0;if(!t)throw new y(`alg ${e} is not supported either by JOSE or your javascript runtime`);return t}function Vt(e,t){let n=e.protected,r=e.header,i=F(r)?{...r}:r,a=t?t[0]:e.payload;!t&&a instanceof Uint8Array&&(a=new Uint8Array(a));let o=e.signature,s={payload:a,signature:o};if(n!==void 0&&(s.protected=n),r!==void 0&&(s.header=i),n===void 0&&i===void 0)throw new S(`Flattened JWS must have either of the "protected" or "header" members`);if(n!==void 0&&typeof n!=`string`)throw new S(`JWS Protected Header incorrect type`);if(a===void 0)throw new S(`JWS Payload missing`);if(typeof o!=`string`)throw new S(`JWS Signature missing or incorrect type`);if(i!==void 0&&!F(i))throw new S(`JWS Unprotected Header incorrect type`);return s}function Ht(e){return[e&&oe(`algorithms`,e.algorithms),e?.crit]}function Ut(e){return e===void 0?{}:re(e,S,`JWS Protected Header is invalid`)}function Wt(e){let n=/[\p{Cs}\p{Cn}]/u.exec(e)?.[0];if(n!==void 0)throw new S(/\p{Cs}/u.test(n)?`JWS Payload must be a well-formed Unicode string`:`JWS Payload must not contain unassigned Unicode code points`);return t.encode(e)}function Gt(e){try{return u(e)}catch{throw new S(`JWS Compact Serialization payload must use only ASCII characters`)}}async function Kt(e,t,n,r,i){let{protected:o,header:s,payload:c}=e,l=i??Ut(o);if(!te(l,s))throw new S(`JWS Protected and JWS Unprotected Header Parameter names must be disjoint`);let d={...l,...s},f=le(l,ce(S,ie,t[1],l,d)),{alg:p}=d;if(typeof p!=`string`||!p)throw new S(`JWS "alg" (Algorithm) Header Parameter missing or invalid`);if(t[0]&&!t[0].has(p))throw new v(`"alg" (Algorithm) Header Parameter value not allowed`);if(f){if(typeof c!=`string`)throw new S(`JWS Payload must be a string`)}else if(typeof c!=`string`&&!(c instanceof Uint8Array))throw new S(`JWS Payload must be a string or an Uint8Array instance`);let m=f||typeof c!=`string`?c:r(c),h=!1;typeof n==`function`&&(n=await n(l,e),h=!0);let g=Bt(p),_=a(o===void 0?new Uint8Array:u(o),u(`.`),typeof m==`string`?t[2]??=ne(m,`payload`,S):m),y=L(e.signature,`signature`,S),b=await R(g,n,`verify`),x=await H(b,g.subtle,`verify`);g.minRsaBits&&Se(g.alg,x);let C=!1;try{C=await crypto.subtle.verify(g.signing,x,y,_)}catch{}if(!C)throw new k;let w={payload:typeof m==`string`?L(m,`payload`,S):m};return o!==void 0&&(w.protectedHeader=l),s!==void 0&&(w.unprotectedHeader=s),h?[{...w,key:b},f]:[w,f]}async function qt(e,t,r){if(e instanceof Uint8Array&&(e=n.decode(e)),typeof e!=`string`)throw new S(`Compact JWS must be a string or Uint8Array`);let{0:i,1:a,2:o,length:s}=e.split(`.`);if(s!==3)throw new S(`Invalid Compact JWS`);return Kt({payload:a,protected:i,signature:o},t,r,Gt)}async function Jt(e,t,n){let[r]=await qt(e,Ht(n),t);return r}async function Yt(e,t,n){if(!F(e))throw new S(`Flattened JWS must be an object`);let[r]=await Kt(Vt(e),Ht(n),t,Wt);return r}function Xt(e,t){try{let n=Vt(e,[t]),r=Ut(n.protected),{b64:i,crit:a}=r;return[n,r,Array.isArray(a)&&a.includes(`b64`)?typeof i==`boolean`?i?1:2:0:1]}catch{return}}async function Zt(e,t,n){if(!F(e))throw new S(`General JWS must be an object`);let{signatures:r,payload:i}=e;if(!Array.isArray(r))throw new S(`JWS Signatures missing or incorrect type`);let a=Array.from(r);if(!a.every(F))throw new S(`JWS Signatures missing or incorrect type`);let o;try{if(i===void 0)throw Error();o=Ht(n)}catch{throw new k}let s=i instanceof Uint8Array?new Uint8Array(i):i,c=a.map(e=>Xt(e,s)).filter(e=>e!==void 0),l=0;for(let[,,e]of c)if(l|=e,l===3)throw new S(`inconsistent use of JWS Unencoded Payload (RFC7797)`);for(let e of c)try{let[n]=await Kt(e[0],o,t,Wt,e[1]);return n}catch{}throw new k}var Qt=e=>Math.floor(e.getTime()/1e3),$t={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},en=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,J=`check_failed`;function tn(){throw TypeError(`Invalid time period format`)}function nn(e){typeof e!=`string`&&tn();let t=en.exec(e);(!t||t[4]&&t[1])&&tn();let n=parseFloat(t[2]),r=Math.round(n*$t[t[3][0].toLowerCase()]);return Number.isFinite(r)||tn(),t[1]===`-`||t[4]===`ago`?-r:r}function Y(e,t){if(!Number.isFinite(t))throw TypeError(`Invalid ${e} input`);return t}function rn(e,t){if(typeof t!=`string`)throw TypeError(`"${e}" claim must be a string`)}function an(e){if(typeof e!=`string`&&(!Array.isArray(e)||Array.from(e).some(e=>typeof e!=`string`)))throw TypeError(`"aud" claim must be a string or an array of strings`)}function on(e,t){return typeof e==`number`?Y(t,e):e instanceof Date?Y(t,Qt(e)):Qt(new Date)+nn(e)}var sn=e=>{let t=e.toLowerCase();return e.includes(`/`)?t:`application/${t}`},cn=(e,t)=>typeof e==`string`?t.includes(e):Array.isArray(e)?t.some(t=>e.includes(t)):!1;function ln(e,t,n=!1){let r=e[t];if(r!==void 0||n){if(typeof r!=`number`)throw new g(`"${t}" claim must be a number`,e,t,`invalid`);return r}}function un(e,t){throw new g(`unexpected "${t}" claim value`,e,t,J)}function dn(e,t,n={}){let i;try{i=JSON.parse(r.decode(t))}catch{}if(!F(i))throw new C(`JWT Claims Set must be a top-level JSON object`);let{typ:a}=n;if(a!==void 0&&(typeof e.typ!=`string`||sn(e.typ)!==sn(a)))throw new g(`unexpected "typ" JWT header value`,i,`typ`,J);let{requiredClaims:o=[],issuer:s,subject:c,audience:l,maxTokenAge:u}=n,d=[...o];u!==void 0&&d.push(`iat`),l!==void 0&&d.push(`aud`),c!==void 0&&d.push(`sub`),s!==void 0&&d.push(`iss`);for(let e of new Set(d.reverse()))if(!Object.hasOwn(i,e))throw new g(`missing required "${e}" claim`,i,e,`missing`);s!==void 0&&!(Array.isArray(s)?s:[s]).includes(i.iss)&&un(i,`iss`),c!==void 0&&i.sub!==c&&un(i,`sub`),l!==void 0&&!cn(i.aud,typeof l==`string`?[l]:l)&&un(i,`aud`);let{clockTolerance:f}=n,p=0;if(typeof f==`string`)p=nn(f);else if(f!==void 0){if(typeof f!=`number`)throw TypeError(`Invalid clockTolerance option type`);p=f}Y(`clockTolerance option`,p);let{currentDate:m}=n,h=Y(`currentDate option`,Qt(m===void 0?new Date:m)),v=ln(i,`iat`,u!==void 0),y=ln(i,`nbf`);if(y!==void 0&&y>h+p)throw new g(`"nbf" claim timestamp check failed`,i,`nbf`,J);let b=ln(i,`exp`);if(b!==void 0&&b<=h-p)throw new _(`"exp" claim timestamp check failed`,i,`exp`,J);if(u!==void 0){let e=h-v,t=Y(`maxTokenAge option`,typeof u==`number`?u:nn(u));if(e-p>t)throw new _(`"iat" claim timestamp check failed (too far in the past)`,i,`iat`,J);if(e<-p)throw new g(`"iat" claim timestamp check failed (it should be in the past)`,i,`iat`,J)}return i}var fn;function X(e){return fn.get(e)}function pn(e){let n=X(e);for(let e of[`iat`,`nbf`,`exp`]){let t=n[e];if(typeof t==`number`&&!Number.isFinite(t))throw TypeError(`"${e}" claim must be a finite number`)}return t.encode(JSON.stringify(n))}function mn(e,t){return X(e)[t]}var hn=class{constructor(e={}){if(!F(e))throw TypeError(`JWT Claims Set MUST be an object`);(fn||=new WeakMap).set(this,structuredClone(e))}setIssuer(e){return rn(`iss`,e),X(this).iss=e,this}setSubject(e){return rn(`sub`,e),X(this).sub=e,this}setAudience(e){return an(e),X(this).aud=e,this}setJti(e){return rn(`jti`,e),X(this).jti=e,this}setNotBefore(e){return X(this).nbf=on(e,`setNotBefore`),this}setExpirationTime(e){return X(this).exp=on(e,`setExpirationTime`),this}setIssuedAt(e){let t=X(this);return t.iat=e===void 0?Qt(new Date):typeof e==`string`?Y(`setIssuedAt`,Qt(new Date)+nn(e)):on(e,`setIssuedAt`),this}};async function gn(e,t,n){let[r,i]=await qt(e,Ht(n),t);if(!i)throw new C(`JWTs MUST NOT use unencoded payload`);let a=dn(r.protectedHeader,r.payload,n);return{...r,payload:a}}async function _n(e,t,n){let{plaintext:r,...i}=await Ct(e,xt(n),t),{protectedHeader:a}=i,o=dn(a,r,n);for(let e of[`iss`,`sub`,`aud`])if(a[e]!==void 0&&(e===`aud`?JSON.stringify(a.aud)!==JSON.stringify(o.aud):a[e]!==o[e]))throw new g(`replicated "${e}" claim header parameter mismatch`,o,e,`mismatch`);return{payload:o,...i}}var vn=class{#e;constructor(e){P(e,`plaintext`),this.#e=[e]}setContentEncryptionKey(e){return I(this.#e[5],`setContentEncryptionKey`),this.#e[5]=e,this}setInitializationVector(e){return I(this.#e[6],`setInitializationVector`),this.#e[6]=e,this}setProtectedHeader(e){return I(this.#e[1],`setProtectedHeader`),this.#e[1]=e,this}setKeyManagementParameters(e){return I(this.#e[7],`setKeyManagementParameters`),this.#e[7]=e,this}async encrypt(e,t){return jt(await At([...this.#e],e,t))}},yn=class{#e;constructor(e){P(e,`plaintext`),this.#e=[e]}setKeyManagementParameters(e){return I(this.#e[7],`setKeyManagementParameters`),this.#e[7]=e,this}setProtectedHeader(e){return I(this.#e[1],`setProtectedHeader`),this.#e[1]=e,this}setSharedUnprotectedHeader(e){return I(this.#e[3],`setSharedUnprotectedHeader`),this.#e[3]=e,this}setUnprotectedHeader(e){return I(this.#e[2],`setUnprotectedHeader`),this.#e[2]=e,this}setAdditionalAuthenticatedData(e){return this.#e[4]=e,this}setContentEncryptionKey(e){return I(this.#e[5],`setContentEncryptionKey`),this.#e[5]=e,this}setInitializationVector(e){return I(this.#e[6],`setInitializationVector`),this.#e[6]=e,this}async encrypt(e,t){return At([...this.#e],e,t)}};async function bn(e,n,r){let[i,o,s,c]=e,l=``;if(o!==void 0){let e=ue(S,o);o=e[0],l=N(e[1])}if(s!==void 0&&(s=ue(S,s)[0]),!o&&!s)throw new S(`either setProtectedHeader or setUnprotectedHeader must be called before #sign()`);if(!te(o,s))throw new S(`JWS Protected and JWS Unprotected Header Parameter names must be disjoint`);let d={...o,...s};se(S,o);let f=le(o,ce(S,ie,c,o,d));f||r?.();let{alg:p}=d;if(typeof p!=`string`||!p)throw new S(`JWS "alg" (Algorithm) Header Parameter missing or invalid`);let m=Bt(p),h=``,g=i,_;if(f){let n=e[4];n?(h=n[0]??=N(i),g=n[1]??=u(h)):(h=N(i),_=t.encode(`${l}.${h}`))}_??=a(u(l),u(`.`),g);let v=await H(await R(m,n,`sign`),m.subtle,`sign`);m.minRsaBits&&Se(m.alg,v);let y={signature:N(new Uint8Array(await crypto.subtle.sign(m.signing,v,_))),payload:h};return o&&(y.protected=l),s&&(y.header=s),[y,f]}async function xn(e,t,n,r,i){let[a]=await bn([e,t,void 0,n],r,i);return`${a.protected}.${a.payload}.${a.signature}`}var Sn=class{#e;#t;constructor(e){P(e,`payload`),this.#e=e}setProtectedHeader(e){return I(this.#t,`setProtectedHeader`),this.#t=e,this}async sign(e,t){return xn(this.#e,this.#t,t?.crit,e,()=>{throw TypeError(`use the flattened module for creating JWS with b64: false`)})}},Cn=class{#e;constructor(e){P(e,`payload`),this.#e=[e]}setProtectedHeader(e){return I(this.#e[1],`setProtectedHeader`),this.#e[1]=e,this}setUnprotectedHeader(e){return I(this.#e[2],`setUnprotectedHeader`),this.#e[2]=e,this}async sign(e,t){let n=[...this.#e];n[3]=t?.crit;let[r]=await bn(n,e);return r}},wn=class{#e;state;constructor(e,t,n){this.#e=e,this.state=[void 0,void 0,t,n?.crit]}setProtectedHeader(e){return I(this.state[0],`setProtectedHeader`),this.state[0]=e,this}setUnprotectedHeader(e){return I(this.state[1],`setUnprotectedHeader`),this.state[1]=e,this}addSignature(...e){return this.#e.addSignature(...e)}sign(...e){return this.#e.sign(...e)}done(){return this.#e}},Tn=class{#e;#t=[];constructor(e){this.#e=e}addSignature(e,t){let n=new wn(this,e,t);return this.#t.push(n),n}async sign(){if(!this.#t.length)throw new S(`at least one signature must be added`);P(this.#e,`payload`);let e={signatures:[],payload:``},t=[],n;for(let r of this.#t){let[i,a,o,s]=r.state,[{payload:c,...l},u]=await bn([this.#e,i,a,s,t],o);if(n===void 0)n=u,e.payload=c;else if(n!==u)throw new S(`inconsistent use of JWS Unencoded Payload (RFC7797)`);e.signatures.push(l)}return e}},En=hn,Dn=class extends En{#e;setProtectedHeader(e){return I(this.#e,`setProtectedHeader`),this.#e=e,this}async sign(e,t){return xn(pn(this),this.#e,t?.crit,e,()=>{throw new C(`JWTs MUST NOT use unencoded payload`)})}},On=hn,kn=class extends On{#e=[void 0];#t;#n;#r;setProtectedHeader(e){return I(this.#e[1],`setProtectedHeader`),this.#e[1]=e,this}setKeyManagementParameters(e){return I(this.#e[7],`setKeyManagementParameters`),this.#e[7]=e,this}setContentEncryptionKey(e){return I(this.#e[5],`setContentEncryptionKey`),this.#e[5]=e,this}setInitializationVector(e){return I(this.#e[6],`setInitializationVector`),this.#e[6]=e,this}replicateIssuerAsHeader(){return this.#t=!0,this}replicateSubjectAsHeader(){return this.#n=!0,this}replicateAudienceAsHeader(){return this.#r=!0,this}async encrypt(e,t){let n=pn(this);this.#e[1]&&(this.#t||this.#n||this.#r)&&(this.#e[1]={...this.#e[1],iss:this.#t?mn(this,`iss`):void 0,sub:this.#n?mn(this,`sub`):void 0,aud:this.#r?mn(this,`aud`):void 0});let r=[...this.#e];return r[0]=n,jt(await At(r,e,t))}},An=`"alg" (Algorithm)`;function jn(e=`JWK "alg" (Algorithm) Parameter`){throw new y(`Invalid or unsupported ${e} value`)}function Mn(e,t){return(typeof e==`string`?zt[e]??Ge[e]:void 0)??jn(t)}var Nn=(e,t)=>`-----BEGIN ${t}-----
2
+ ${(e.match(/.{1,64}/g)||[]).join(`
3
+ `)}
4
+ -----END ${t}-----`,Pn=async(e,t,n)=>{if(ge(n)){if(n.type!==e)throw TypeError(`key is not a ${e} key`);return n.export({format:`pem`,type:t})}if(!z(n))throw TypeError(B(n,`CryptoKey`,`KeyObject`));if(!n.extractable)throw TypeError(`CryptoKey is not extractable`);if(n.type!==e)throw TypeError(`key is not a ${e} key`);return Nn(d(new Uint8Array(await crypto.subtle.exportKey(t,n))),`${e.toUpperCase()} KEY`)},Fn=e=>Pn(`public`,`spki`,e),In=e=>Pn(`private`,`pkcs8`,e),Ln=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let n=0;n<e.byteLength;n++)if(e[n]!==t[n])return!1;return!0},Rn=e=>({data:e,pos:0}),zn=e=>{let t=e.data[e.pos++];if(t===void 0)throw Error(`Unexpected end of ASN.1 input`);return t},Z=e=>{let t=zn(e);if(t&128){let n=t&127,r=0;for(let t=0;t<n;t++)r=r<<8|zn(e);return r}return t},Bn=(e,t=1)=>{for(;t-->0;){e.pos++;let t=Z(e);e.pos+=t}},Q=(e,t,n)=>{if(zn(e)!==t)throw Error(n)},Vn=(e,t)=>{if(t<0||e.pos+t>e.data.length)throw Error(`Unexpected end of ASN.1 input`);let n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},Hn=e=>(Q(e,6,`Expected algorithm OID`),Vn(e,Z(e)));function Un(e,t){if(Q(e,48,`Invalid ${t===`spki`?`SPKI`:`PKCS#8`} structure`),Z(e),t===`pkcs8`){Q(e,2,`Expected version field`);let t=Z(e);e.pos+=t}Q(e,48,`Expected algorithm identifier`),Z(e)}var Wn=e=>{let t=Hn(e);if(Ln(t,[43,101,110]))return`X25519`;if(!Ln(t,[42,134,72,206,61,2,1]))throw Error(`Unsupported key algorithm`);Q(e,6,`Expected curve OID`);let n=Vn(e,Z(e));if(Ln(n,[42,134,72,206,61,3,1,7]))return`P-256`;if(Ln(n,[43,129,4,0,34]))return`P-384`;if(Ln(n,[43,129,4,0,35]))return`P-521`;throw Error(`Unsupported named curve`)},Gn=async(e,t,n,r)=>{let i=Ee(r?.extractable),a=Mn(n,An);a.secret&&jn(`"alg" (Algorithm)`);let o=e===`spki`,s;if(a.resolve)try{let n=Rn(t);Un(n,e),s=a.resolve({crv:Wn(n)})}catch{throw new y(`Invalid or unsupported key format`)}else s=a.subtle;return crypto.subtle.importKey(e,t,s,i??o,a.usages[+!o])},Kn=(e,t)=>f(e.replace(t,``)),qn=(e,t,n)=>Gn(`pkcs8`,Kn(e,/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g),t,n),Jn=(e,t,n)=>Gn(`spki`,Kn(e,/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g),t,n);function Yn(e){let t=Rn(e);Q(t,48,`Invalid certificate structure`);let n=Z(t);if(n<0||t.pos+n>t.data.length)throw Error(`Unexpected end of ASN.1 input`);Q(t,48,`Invalid tbsCertificate structure`),Z(t),e[t.pos]===160?Bn(t,6):Bn(t,5);let r=t.pos;Q(t,48,`Invalid SPKI structure`);let i=Z(t);return e.subarray(r,r+i+(t.pos-r))}var Xn=(e,t,n)=>{let r;try{r=Yn(Kn(e,/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g))}catch(e){throw TypeError(`Failed to parse the X.509 certificate`,{cause:e})}return Gn(`spki`,r,t,n)};function Zn(e){return Fn(e)}function Qn(e){return In(e)}async function $n(e){if(ge(e)){if(e.type===`secret`)e=e.export();else return e.export({format:`jwk`})}if(e instanceof Uint8Array)return{kty:`oct`,k:N(e)};if(!z(e))throw TypeError(B(e,`CryptoKey`,`KeyObject`,`Uint8Array`));if(!e.extractable)throw TypeError(`non-extractable CryptoKey cannot be exported as a JWK`);let t=await crypto.subtle.exportKey(`jwk`,e);delete t.ext,delete t.key_ops,delete t.use,t.kty!==`AKP`&&delete t.alg;for(let e of Object.keys(t))t[e]===void 0&&delete t[e];return t}var $=(e,t)=>{if(typeof e!=`string`||!e)throw new w(`${t} missing or invalid`)};async function er(e,t){let n;if(F(e)){if(n=we(e),typeof n.kty!=`string`)throw TypeError(B(e,`CryptoKey`,`KeyObject`,`JSON Web Key`))}else if(_e(e))n=we(await $n(e));else throw TypeError(B(e,`CryptoKey`,`KeyObject`,`JSON Web Key`));if(t??=`sha256`,t!==`sha256`&&t!==`sha384`&&t!==`sha512`)throw TypeError(`digestAlgorithm must one of "sha256", "sha384", or "sha512"`);let r;switch(n.kty){case`AKP`:$(n.alg,`"alg" (Algorithm) Parameter`),$(n.pub,`"pub" (Public key) Parameter`),r={alg:n.alg,kty:n.kty,pub:n.pub};break;case`EC`:$(n.crv,`"crv" (Curve) Parameter`),$(n.x,`"x" (X Coordinate) Parameter`),$(n.y,`"y" (Y Coordinate) Parameter`),r={crv:n.crv,kty:n.kty,x:n.x,y:n.y};break;case`OKP`:$(n.crv,`"crv" (Subtype of Key Pair) Parameter`),$(n.x,`"x" (Public Key) Parameter`),r={crv:n.crv,kty:n.kty,x:n.x};break;case`RSA`:$(n.e,`"e" (Exponent) Parameter`),$(n.n,`"n" (Modulus) Parameter`),r={e:n.e,kty:n.kty,n:n.n};break;case`oct`:if(typeof n.k!=`string`)throw new w(`"k" (Key Value) Parameter missing or invalid`);r={k:n.k,kty:n.kty};break;default:throw new y(`"kty" (Key Type) Parameter missing or unsupported`)}let i=u(JSON.stringify(r));return N(await p(t,i))}async function tr(e,t){t??=`sha256`;let n=await er(e,t);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${t.slice(-3)}:${n}`}async function nr(e,t){let n={...e,...t?.header};if(!F(n.jwk))throw new S(`"jwk" (JSON Web Key) Header Parameter must be a JSON object`);let r;try{r=Te(n.jwk)}catch(e){throw new S(`Invalid Embedded JWK`,{cause:e})}let i=Bt(n.alg);if(r.use!==void 0&&r.use!==`sig`)throw new S(`Invalid Embedded JWK, its "use" must be "sig" when present`);if(r.alg!==void 0&&r.alg!==i.alg)throw new S(`Invalid Embedded JWK, its "alg" must be "${i.alg}" when present`);let a=await V(i,r,!0);if(a.type!==`public`)throw new S(`"jwk" (JSON Web Key) Header Parameter must be a public key`);return a}function rr(e,t,n,r){let{kty:i,key_ops:a,ext:o,kid:s,alg:c,use:l,crv:u}=e;return(o===void 0||typeof o==`boolean`)&&(a===void 0||Array.isArray(a)&&a.every((e,t)=>typeof e==`string`&&a.indexOf(e)===t)&&a.includes(`verify`))&&t.kty.includes(i)&&(r===void 0||typeof r==`string`&&r===s)&&(c===void 0?i!==`AKP`:n===c)&&(l===void 0||l===`sig`)&&(!t.crv||u===t.crv)}async function ir(e,t,n){let r=e.get(t)||e.set(t,{}).get(t),{alg:i}=n;if(r[i]===void 0){let e=V(n,t,!0).then(e=>{if(e.type!==`public`)throw new T(`JSON Web Key Set members must be public keys`);return r[i]=e,e}).catch(t=>{throw r[i]===e&&delete r[i],t});r[i]=e}return r[i]}function ar(e){let t;try{t=structuredClone(e)}catch{}if(!ee(t))throw new T(`JSON Web Key Set malformed`);let n=t.keys.map(e=>{let t=we(e);return Array.isArray(t.key_ops)&&(t.key_ops=[...t.key_ops]),t}),r=new WeakMap;return Object.defineProperty(async(e,i)=>{let{alg:a,kid:o}={...e,...i?.header},s=typeof a==`string`?zt[a]:void 0;if(!s||s.secret)throw new y(`Unsupported "alg" value for a JSON Web Key Set`);let c=t.keys.filter((e,t)=>rr(n[t],s,a,o)),{0:l,length:u}=c;if(!u)throw new E;if(u!==1){let e=new D;throw e[Symbol.asyncIterator]=async function*(){for(let e of c)try{yield await ir(r,e,s)}catch{}},e}return ir(r,l,s)},"jwks",{value:()=>structuredClone(t)})}function or(){return typeof WebSocketPair<`u`||typeof navigator<`u`&&navigator.userAgent===`Cloudflare-Workers`||typeof EdgeRuntime<`u`&&EdgeRuntime===`vercel`}var sr;typeof navigator<`u`&&navigator.userAgent?.startsWith?.(`Mozilla/5.0 `)||(sr=`jose/v6.2.12`);var cr=Symbol();async function lr(e,t,n,r=fetch){let i=await r(e,{method:`GET`,signal:n,redirect:`manual`,headers:t}).catch(e=>{throw e.name===`TimeoutError`?new O:e});if(i.status!==200)throw new h(`Expected 200 OK from the JSON Web Key Set HTTP response`);try{return await i.json()}catch{throw new h(`Failed to parse the JSON Web Key Set HTTP response as JSON`)}}var ur=Symbol();function dr(e,t){return Number.isFinite(e)&&Date.now()<e+t}function fr(e,t,n){if(Number.isNaN(e))throw TypeError(`"${n}" option must not be NaN`);return typeof e==`number`?e:t}function pr(e,t){if(!(e instanceof URL))throw TypeError(`url must be an instance of URL`);let n=new URL(e.href).href,r=t??{},i=r.timeoutDuration;if(typeof i==`number`&&(!Number.isInteger(i)||i<0))throw TypeError(`"timeoutDuration" option must be a non-negative integer`);let a=typeof i==`number`?i:5e3,o=fr(r.cooldownDuration,3e4,`cooldownDuration`),s=fr(r.cacheMaxAge,6e5,`cacheMaxAge`),c=new Headers(r.headers);sr&&!c.has(`User-Agent`)&&c.set(`User-Agent`,sr),c.has(`accept`)||c.set(`accept`,`application/json, application/jwk-set+json`);let l=r[cr],u=r[ur],d,f,p=0,m=0,h;if(u&&typeof u==`object`){let{uat:e,jwks:t}=u;dr(e,s)&&ee(t)&&(d=e,h=ar(t))}let g=async()=>{if(f&&or()&&(f=void 0),!f){let e=++p,t=f=lr(n,c,AbortSignal.timeout(a),l).then(t=>{let n=ar(t);if(e<=m)return;h=n;let r=Date.now();u&&(u.uat=r,u.jwks=t),d=r,m=e}).finally(()=>{f===t&&(f=void 0)})}await f};return Object.defineProperties(async(e,t)=>{h&&dr(d,s)||await g();try{return await h(e,t)}catch(n){if(n instanceof E&&!dr(d,o))return await g(),h(e,t);throw n}},{coolingDown:{get:()=>dr(d,o),enumerable:!0},fresh:{get:()=>dr(d,s),enumerable:!0},reload:{value:g,enumerable:!0},reloading:{get:()=>!!f,enumerable:!0},jwks:{value:()=>h?.jwks(),enumerable:!0}})}var mr=hn,hr=class extends mr{encode(){return`${N(JSON.stringify({alg:`none`}))}.${N(pn(this))}.`}static decode(e,t){if(typeof e!=`string`)throw new C(`Unsecured JWT must be a string`);let{0:n,1:r,2:i,length:a}=e.split(`.`);if(a!==3||i!==``)throw new C(`Invalid Unsecured JWT`);let o,s;try{o=re(n,S,`JWS Protected Header is invalid`);let e=ce(S,ie,void 0,o,o);s=le(o,e)}catch(e){throw e instanceof S?new C(`Invalid Unsecured JWT`,{cause:e}):e}if(o.alg!==`none`)throw new C(`Invalid Unsecured JWT`);if(!s)throw new C(`JWTs MUST NOT use unencoded payload`);return{payload:dn(o,L(r,`payload`,C),t),header:o}}};async function gr(e,t,n){if(typeof e!=`string`||e.indexOf(`-----BEGIN PUBLIC KEY-----`)!==0)throw TypeError(`"spki" must be SPKI formatted string`);return Jn(e,t,n)}async function _r(e,t,n){if(typeof e!=`string`||e.indexOf(`-----BEGIN CERTIFICATE-----`)!==0)throw TypeError(`"x509" must be X.509 formatted string`);return Xn(e,t,n)}async function vr(e,t,n){if(typeof e!=`string`||e.indexOf(`-----BEGIN PRIVATE KEY-----`)!==0)throw TypeError(`"pkcs8" must be PKCS#8 formatted string`);return qn(e,t,n)}async function yr(e,t,n){if(!F(e))throw TypeError(`JWK must be an object`);let r=Te(e),i=Ee(n?.extractable),{alg:a}=r;if(t??=a,r.kty!==`oct`&&!t)throw TypeError(`"alg" argument is required when "jwk.alg" is not present`);switch(r.kty){case`oct`:if(typeof r.k!=`string`)throw TypeError(`missing "k" (Key Value) Parameter value`);return M(r.k);case`AKP`:if(typeof a!=`string`||!a)throw TypeError(`missing "alg" (Algorithm) Parameter value`);if(t!==a)throw TypeError(`JWK alg and alg option value mismatch`);return V(Mn(t),r,i);case`RSA`:case`EC`:case`OKP`:return V(Mn(t),r,i);default:throw new y(`Unsupported "kty" (Key Type) Parameter value`)}}function br(e){let t;if(typeof e==`string`){let n=e.split(`.`);(n.length===3||n.length===5)&&([t]=n)}else if(typeof e==`object`&&e){if(`protected`in e)t=e.protected;else throw TypeError(`Token does not contain a Protected Header`)}let n=`Invalid Token or Protected Header formatting`;if(typeof t!=`string`||!t)throw TypeError(n);return re(t,TypeError,n)}function xr(e){if(typeof e!=`string`)throw new C(`JWTs must use Compact JWS serialization, JWT must be a string`);let{1:t,length:n}=e.split(`.`);if(n===5)throw new C(`Only JWTs using Compact JWS serialization can be decoded`);if(n!==3)throw new C(`Invalid JWT`);if(!t)throw new C(`JWTs must contain a payload`);let i;try{i=M(t)}catch{throw new C(`Failed to base64url decode the payload`)}let a;try{a=JSON.parse(r.decode(i))}catch{throw new C(`Failed to parse the decoded payload as JSON`)}if(!F(a))throw new C(`Invalid JWT Claims Set`);return a}function Sr(e){let t=e?.modulusLength??2048;if(typeof t!=`number`||!Number.isInteger(t)||t<2048)throw new y(`Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used`);return t}async function Cr(e,t){let n=Ee(t?.extractable),r=Mn(e,An);r.secret&&jn(`"alg" (Algorithm)`);let i;if(r.resolve){let e=t?.crv??`P-256`;if(![`P-256`,`P-384`,`P-521`,`X25519`].includes(e))throw new y(`Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, and X25519`);i=r.resolve({crv:e})}else{if(r.crv!==void 0&&t?.crv!==void 0&&t.crv!==r.crv)throw new y(`Invalid or unsupported crv option provided, the only supported value for ${e} is ${r.crv}`);i=r.kty[0]===`RSA`?{...r.subtle,publicExponent:Uint8Array.of(1,0,1),modulusLength:Sr(t)}:r.subtle}return crypto.subtle.generateKey(i,n??!1,[...r.usages[1],...r.usages[0]])}async function wr(e,t){let n=Ee(t?.extractable),r,i,a;switch(e){case`HS256`:case`HS384`:case`HS512`:r=+e.slice(-3),i={name:`HMAC`,hash:`SHA-${r}`,length:r},a=[`sign`,`verify`];break;case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:return crypto.getRandomValues(new Uint8Array(e.slice(-3)>>3));case`A128KW`:case`A192KW`:case`A256KW`:r=+e.slice(1,4),i={name:`AES-KW`,length:r},a=[`wrapKey`,`unwrapKey`];break;case`A128GCMKW`:case`A192GCMKW`:case`A256GCMKW`:case`A128GCM`:case`A192GCM`:case`A256GCM`:r=+e.slice(1,4),i={name:`AES-GCM`,length:r},a=[`encrypt`,`decrypt`];break;default:jn(An)}return crypto.subtle.generateKey(i,n??!1,a)}var Tr=`WebCryptoAPI`;export{Zt as A,Tn as C,vn as D,yn as E,Tt as F,wt as I,A as L,Jt as M,Nt as N,_n as O,Et as P,C as R,Dn as S,Sn as T,tr as _,br as a,Zn as b,gr as c,pr as d,cr as f,er as g,nr as h,xr as i,Yt as j,gn as k,_r as l,ar as m,wr as n,yr as o,ur as p,Cr as r,vr as s,Tr as t,hr as u,$n as v,Cn as w,kn as x,Qn as y,m as z};
@@ -0,0 +1 @@
1
+ export{D as CompactEncrypt,T as CompactSign,h as EmbeddedJWK,x as EncryptJWT,E as FlattenedEncrypt,w as FlattenedSign,N as GeneralEncrypt,C as GeneralSign,S as SignJWT,u as UnsecuredJWT,L as base64url,g as calculateJwkThumbprint,_ as calculateJwkThumbprintUri,I as compactDecrypt,M as compactVerify,m as createLocalJWKSet,d as createRemoteJWKSet,t as cryptoRuntime,f as customFetch,i as decodeJwt,a as decodeProtectedHeader,z as errors,v as exportJWK,y as exportPKCS8,b as exportSPKI,F as flattenedDecrypt,j as flattenedVerify,P as generalDecrypt,A as generalVerify,r as generateKeyPair,n as generateSecret,o as importJWK,s as importPKCS8,c as importSPKI,l as importX509,p as jwksCache,O as jwtDecrypt,k as jwtVerify}from"./webapi-B2JTupyg.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aventurevc/aventure-cli",
3
- "version": "0.8.236",
3
+ "version": "0.8.237",
4
4
  "private": false,
5
5
  "description": "Command-line access to aVenture research data on companies, people, funding, and news.",
6
6
  "homepage": "https://docs.aventure.vc/cli",
@@ -33,9 +33,9 @@
33
33
  },
34
34
  "aventurePublicApi": {
35
35
  "repository": "aventurevc/aventure-docs",
36
- "commit": "fe4ee16693b35653b951cc2766d3ecc32e7ba77c",
36
+ "commit": "26c800876cf9a9d76315042f61811441eb67b3ec",
37
37
  "openapiPath": "openapi/openapi.json",
38
- "openapiSha256": "b9ef29533f841006a55c3b378485ee0ecb2574cb5369fd23cd927114cfa914e2"
38
+ "openapiSha256": "888943d126d15b66f57c146fb7db027889a490d8bfdac53ffbcf3c4dee477d28"
39
39
  },
40
40
  "scripts": {}
41
41
  }
@@ -1,4 +0,0 @@
1
- import{f as e,g as t,o as n,r,x as i}from"./logging-Bk8_GcPH.js";import{i as a,l as o,o as s,w as c,y as l}from"./person-owner-C0YuWKvY.js";import{a as u}from"./package-CZBWjlYb.js";import{i as d}from"./response-problem-BGEYFwd5.js";import{execFile as f}from"node:child_process";import{dirname as p,join as m}from"node:path";import{homedir as h,platform as g}from"node:os";import{setTimeout as _}from"node:timers/promises";import{randomUUID as v}from"node:crypto";import{AsyncLocalStorage as ee}from"node:async_hooks";import{chmod as te,mkdir as y,readFile as b,rename as x,rm as S,stat as ne,writeFile as C}from"node:fs/promises";function w(e){let t=e.trim();if(t.length===0)throw Error(`API host must not be blank`);let n=new URL(ae(t)?t:`${oe(t)}://${t}`),r=E(n.hostname);if(n.protocol!==`https:`&&n.protocol!==`http:`||n.username.length>0||n.password.length>0||n.pathname!==`/`&&n.pathname!==``||n.search.length>0||n.hash.length>0)throw Error(`API host must contain only an HTTP(S) host and optional port`);if(n.protocol===`http:`&&!r)throw Error(`stored credentials require HTTPS except for loopback API hosts`);return{host:n.host.toLowerCase(),origin:n.origin,isLoopback:r}}function T(e){let n=w(e);return n.isLoopback?w(t()).host:n.host}function re(e){return{...e,host:w(e.host).origin}}function ie(e){let t=w(e);if(t.isLoopback)return`http://localhost:3000`;if(t.host===`api.aventure.vc`)return`https://aventure.vc`;throw Error(`no first-party browser origin is configured for API host ${t.host}`)}function ae(e){return/^[a-z][a-z\d+.-]*:\/\//iu.test(e)}function oe(e){let t=e.split(`/`,1)[0]?.toLowerCase()??``;try{return E(new URL(`http://${t}`).hostname)?`http`:`https`}catch{return`https`}}function E(e){let t=e.toLowerCase();return t===`localhost`||t===`127.0.0.1`||t===`0.0.0.0`||t===`[::1]`}var D=l({createdAt:a({offset:!0}),description:c().nullish(),expiresAt:a({offset:!0}).nullish(),id:c().regex(/^ak_[0-9A-Fa-f]{32}$/),lastUsedAt:a({offset:!0}).nullish(),name:c(),revocationReason:c().nullish(),scopes:o(c()),status:s([`ACTIVE`,`REVOKED`,`EXPIRED`]),subject:c(),updatedAt:a({offset:!0})});function O(e,t=[]){let n=e instanceof Error?e.message:String(e);return d(n,t)}function se(e,t=[]){let n=d(e.title,t),r=d(e.detail?.trim()??``,t);return`${e.status} ${n}${r?` — ${r}`:``}`}function ce(){if(g()===`win32`){let e=process.env.APPDATA??m(h(),`AppData`,`Roaming`);return m(e,`aventure`,`config.json`)}let e=process.env.XDG_CONFIG_HOME??m(h(),`.config`);return m(e,`aventure`,`config.json`)}function le(){let t=process.env[e.authToken];return typeof t==`string`&&t.length>0?{present:!0,source:`env`}:{present:!1,source:null}}function k(e,t){return typeof e==`object`&&!!e&&`code`in e&&e.code===t}var ue=2;function de(e,t){return j(e,t).redactedUrl}async function fe(e,t,n){let r=j(e,t);return await A(new URL(r.openerUrl),n)}async function A(e,t){let n=t.environment??process.env,r=t.operatingSystem??g(),i=M(t.noBrowser,n,r);if(i!==null)return{state:`skipped`,reason:i};let a=pe(r,e.toString());if(a===null)return{state:`failed`,reason:`unsupported browser-opening platform: ${r}`};try{return await me(a.command,a.arguments),{state:`opened`,reason:null}}catch{return{state:`failed`,reason:`browser opener failed`}}}function j(e,t){let{id:n,verificationUrl:r,pollSecret:i}=e,a,o;try{a=new URL(r),o=new URL(t)}catch{throw Error(`broker returned an invalid browser verification URL`)}if(o.username.length>0||o.password.length>0||o.pathname!==`/`||o.search.length>0||o.hash.length>0)throw Error(`configured browser origin must contain only an origin`);let s=E(o.hostname);if(o.protocol!==`https:`&&!(o.protocol===`http:`&&s))throw Error(`configured browser origin must use HTTPS except for loopback development`);let c=new URLSearchParams(a.hash.slice(1)),l=[...c.keys()],u=c.getAll(`cliAuthorizationId`),d=c.getAll(`browserSecret`),f=d[0]??``;if(a.origin!==o.origin||a.protocol!==o.protocol||a.username.length>0||a.password.length>0||a.pathname!==`/settings/developer`||a.search.length>0||l.length!==ue||u.length!==1||u[0]!==n||d.length!==1||f.length===0||i.length===0||f===i)throw Error(`broker returned a browser verification URL outside the configured first-party approval flow`);let p;try{p=decodeURIComponent(r)}catch{throw Error(`broker returned a browser verification URL outside the configured first-party approval flow`)}if(r.includes(i)||p.includes(i))throw Error(`broker returned a browser verification URL outside the configured first-party approval flow`);let m=new URL(a);return m.hash=new URLSearchParams({cliAuthorizationId:n,browserSecret:`<redacted>`}).toString(),{openerUrl:r,redactedUrl:m.toString()}}function M(e,t,n){return e?`--no-browser was set`:n===`darwin`&&t.CODEX_SESSION_ID?`macOS Codex browser process boundary`:t.SSH_CONNECTION||t.SSH_CLIENT||t.SSH_TTY?`SSH/headless session detected`:(n===`linux`||n===`freebsd`)&&!t.DISPLAY&&!t.WAYLAND_DISPLAY?`no graphical display detected`:null}function pe(e,t){return e===`darwin`?{command:`open`,arguments:[t]}:e===`win32`?{command:`rundll32.exe`,arguments:[`url.dll,FileProtocolHandler`,t]}:e===`linux`||e===`freebsd`?{command:`xdg-open`,arguments:[t]}:null}function me(e,t){return new Promise((n,r)=>{f(e,[...t],{timeout:5e3,windowsHide:!0},e=>e?r(e):n())})}var he=100,N=3e4,ge=6e4,P=new ee;function F(){return m(p(ce()),`credentials.json`)}function I(e){return`OS keyring is unusable (${e}); the credential will be stored in ${F()} (mode 0600).\n`}async function L(e,t){let n=(await W())[e]?.[t];if(n!==void 0)return{record:{provider:`file`,value:n}};try{let n=await(await U(e,t)).getPassword()??void 0;return n===void 0?{}:{record:{provider:`keyring`,value:n}}}catch(e){return{keyringFailure:H(e)}}}async function R(e,t,n){if((await W())[e]?.[t]!==void 0)return await z(e,t,n,`file store holds this account`);let r;try{let i=await U(e,t);if(await i.setPassword(n),await i.getPassword()===n)return await q(e,t,void 0),`keyring`;r=`Error: keyring readback did not match`}catch(e){r=H(e,[n])}return await z(e,t,n,r)}async function z(e,t,n,r){if(await q(e,t,n),(await W())[e]?.[t]!==n)throw Error(`credential storage did not confirm a durable write (keyring: ${r}; file: readback did not match)`);return`file`}async function B(e,t){try{let n=await U(e,t),r;try{await n.deleteCredential()}catch(e){r=e}let i;try{i=await n.getPassword()??void 0}catch(e){throw Error(`OS keyring removal outcome is unknown (${H(r??e)})`,{cause:e})}if(i!==void 0)throw Error(`OS keyring did not confirm removal (${H(r)})`,r===void 0?void 0:{cause:r})}finally{await q(e,t,void 0)}}async function V(e,t){let n=`${t}:probe:${v()}`,r=`aventure-cli-credential-probe:${v()}`,i;try{let t=await U(e,n);await t.setPassword(r);let a=await(await U(e,n)).getPassword(),o=await t.deleteCredential(),s=await(await U(e,n)).getPassword()??void 0;if(a!==r)i=`Error: probe readback did not match`;else if(!o||s!==void 0)i=`Error: probe cleanup was not confirmed`;else return{provider:`keyring`}}catch(e){i=H(e,[r])}try{await K(async()=>{await q(e,n,r);let t=(await W())[e]?.[n];if(await q(e,n,void 0),t!==r)throw Error(`probe readback did not match`)})}catch(e){throw Error(`credential storage is unavailable (keyring: ${i}; file ${F()}: ${H(e,[r])})`,{cause:e})}return{provider:`file`,keyringFailure:i}}function H(e,t=[]){if(!(e instanceof Error))return`Error`;let n=e.name||`Error`,[r=``]=O(e,t).trim().split(`
2
- `,1);return r&&r!==n?`${n}: ${r}`:n}async function U(e,t){let n=g(),r=n===`linux`||n===`freebsd`?M(!1,process.env,n):null;if(r!==null)throw Error(`OS keyring unlock prompt is unreachable (${r})`);let{AsyncEntry:i}=await import(`@napi-rs/keyring`);return new i(e,t)}async function W(){let e=F(),t;try{t=await b(e,`utf8`)}catch(e){if(k(e,`ENOENT`))return{};throw e}let n;try{n=JSON.parse(t)}catch(t){return await G(e,t)}return ve(n)?n:await G(e,void 0)}async function G(e,t){let r=`${e}.corrupt-${new Date().toISOString().replace(/[:.]/gu,`-`)}`;try{await x(e,r)}catch(t){if(k(t,`ENOENT`))return{};throw Error(`${e} is not a valid credential file and could not be moved aside`,{cause:t})}return n({component:u().bin[0],event:`credential_file_quarantined`,message:`${e} is not a valid credential file; moved it to ${r} and continuing with an empty file store`,...t===void 0?{}:{error:t}}),{}}async function K(e){if(P.getStore()===!0)return await e();let t=`${F()}.lock`;await y(p(t),{recursive:!0,mode:448});let n=Date.now()+N,r=v();for(;;){try{await C(t,r,{flag:`wx`,mode:384});break}catch(e){if(!k(e,`EEXIST`))throw e}if(await ne(t).then(e=>Date.now()-e.mtimeMs,()=>0)>ge)await S(t,{force:!0});else if(Date.now()>n)throw Error(`credential store is locked by another CLI process (${t})`);else await _(he)}try{return await P.run(!0,e)}finally{await b(t,`utf8`).catch(()=>``)===r&&await S(t,{force:!0})}}async function q(e,t,n){await K(async()=>await _e(e,t,n))}async function _e(e,t,n){let r=F(),i=await W(),a={...i[e]};if(n===void 0?delete a[t]:a[t]=n,Object.keys(a).length===0?delete i[e]:i[e]=a,Object.keys(i).length===0){await S(r,{force:!0});return}await y(p(r),{recursive:!0,mode:448});let o=`${r}.${v()}.tmp`;await C(o,`${JSON.stringify(i,null,2)}\n`,{mode:384}),await te(o,384),await x(o,r)}function ve(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.values(e).every(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.values(e).every(e=>typeof e==`string`))}var J=`vc.aventure.aventure-cli`,Y=`aventure-cli-personal-v1`;async function ye(e,t,n){let r=T(e),i=Se(t,n),a;try{a=await R(J,r,i)}catch(e){throw Error(`${O(e,[i,t.secret])}; broker acknowledgment was withheld. Re-run auth status before retrying.`,{cause:e})}return{host:r,provider:a,activation:n,credential:t}}async function X(e){let t=T(e),n;try{n=await L(J,t)}catch(e){return Z(O(e))}let{record:r,keyringFailure:i}=n;return r===void 0?i===void 0?{state:`missing`}:{state:`missing`,keyringFailure:i}:{state:`found`,stored:{host:t,provider:r.provider,...Ce(r.value)}}}async function be(e){let t=await X(e);if(t.state!==`missing`)return t;try{let{keyringFailure:t}=await V(J,T(e));return t===void 0?{state:`missing`}:{state:`missing`,keyringFailure:t}}catch(e){return Z(O(e))}}async function xe(e){await B(J,T(e))}function Z(e){return{state:`unavailable`,summary:e,cause:`storage`}}function Se(e,t){return`${Y}:${t}\n${JSON.stringify(e.apiKey)}\n${e.secret}`}function Ce(e){let t=e.indexOf(`
3
- `),n=t<0?-1:e.indexOf(`
4
- `,t+1),r=t<0?e:e.slice(0,t),i=r===`${Y}:active`?`active`:`pending`;if(t<0||n<0||r!==`${Y}:pending`&&r!==`${Y}:active`)throw Error(`OS credential entry has an unsupported format`);let a=e.slice(n+1);if(a.length===0)throw Error(`OS credential entry has an empty secret`);let o;try{o=JSON.parse(e.slice(t+1,n))}catch(e){throw Error(`OS credential entry failed canonical schema validation`,{cause:e})}let s=D.safeParse(o);if(!s.success)throw Error(`OS credential entry failed canonical schema validation`,{cause:s.error});return{activation:i,credential:{apiKey:s.data,secret:a}}}async function we(t){if(Q())return;let a=T(i().host);try{let n=await X(a);if(n.state===`unavailable`){r($(`keyring`,Error(n.summary)));return}n.state===`found`&&n.stored.activation===`active`&&!Q()&&(process.env[e.authToken]=n.stored.credential.secret,t?.(`api-key`))}catch(e){n($(`parse`,e))}}function Q(){return(process.env[e.authToken]?.trim().length??0)>0}function $(e,t){return{component:u().bin[0],event:`api_key_materialization_unavailable`,message:`saved API key could not be loaded; continuing with environment auth`,fields:{source:e},error:t}}export{re as S,se as _,ye as a,w as b,V as c,R as d,A as f,O as g,le as h,X as i,L as l,de as m,xe as n,B as o,fe as p,be as r,I as s,we as t,K as u,D as v,T as x,ie as y};
@@ -1,11 +0,0 @@
1
- import{a as e,n as t,o as n,r,t as i}from"./commander-DEj7N1b9.js";import{_ as a,h as o,i as s,m as c,v as l}from"./logging-Bk8_GcPH.js";import{a as u,b as d,c as f,t as p,x as m,y as h}from"./tool-policy-BPefkvzQ.js";import{c as g,p as _,r as v}from"./result-envelope-5R2VEWAg.js";import{a as y}from"./package-CZBWjlYb.js";import{r as ee,t as te}from"./operation-invocation-C29yUZSq.js";import{i as ne,n as re,t as ie}from"./cli-help-policy-CEyg0zEz.js";import{a as ae,c as oe,d as se,f as ce,l as le,n as ue,o as b,r as de,s as x,t as fe,u as pe}from"./startup-auth-CnOyg9R-.js";import{t as S}from"./openapi-commands-CKb-tN3f.js";import{i as C,r as w,t as T}from"./output-mode-DYvJUCAE.js";import{t as me}from"./operations-metadata-r3glpbEg.js";import{S as he,_ as E,a as ge,b as D,c as _e,d as ve,f as ye,g as O,h as be,i as xe,l as Se,m as Ce,n as we,o as Te,p as Ee,r as De,s as Oe,t as ke,u as Ae,v as k,x as je,y as Me}from"./generated-option-order-CZUJFgSS.js";import{a as Ne,i as Pe,n as Fe,r as Ie}from"./payload-operand-guard-BVp_alVX.js";import{fileURLToPath as Le}from"node:url";import{readFile as Re}from"node:fs/promises";async function ze(e){let t;try{t=e===`-`?await Be():await Re(e,`utf8`)}catch(t){return v(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return g(`No input provided`,null);let e=JSON.parse(t);return g(`Input parsed`,e)}catch(e){return v(`Input is not valid JSON: ${e.message}`)}}async function Be(){if(process.stdin.isTTY)throw Error(`--from-file - requires JSON on stdin, but stdin is a TTY`);process.stdin.setEncoding(`utf8`);let e=``;for await(let t of process.stdin)e+=t;return e}var A=`--content-type`;function Ve(e,n,r){let i=e=>!r?.has(e)&&(r?.add(e),!0),a=n.requestBody??[];if(a.length>1&&i(A)){let n=a.map(({contentType:e})=>e);e.addOption(new t(`${A} <media-type>`,`Select the request body encoding, never an uploaded file's media type; omit for ${n[0]}.`).choices(n).argParser(Ue(a)))}if(I(n)&&i(`--from-file`)){let r=a[0];if(r===void 0)throw Error(`${n.operationId} has no request body`);e.addOption(new t(`--from-file <path>`,ge(r,r.requiredPath)).argParser(j(`--from-file`)))}let o=Te(a).filter(e=>i(N(e.variant[0].parameter)));for(let n of o.toSorted((e,t)=>we(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:r,parameter:i}=n.variant[0],o=new t(xe(n),a.length>1?De(n):_e(r,i));a.length===1&&i.envName!==void 0&&o.env(i.envName);let s=a.length===1?Oe(r,i.optionKey):[];s.length>0&&o.conflicts(s),a.length>1?o.argParser(He):E(i.name)||i.schemaType===`array`?o.argParser(We):o.argParser(j(i.flag)),e.addOption(o),o.envVar!==void 0&&e.on(`optionEnv:${o.name()}`,()=>{let t=e.opts()[i.optionKey];typeof t==`string`&&t.trim()&&e.setOptionValueWithSource(i.optionKey,t.trim(),`env`)})}nt(e,n,o)}function He(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Ue(e){return(t,r)=>{if(r!==void 0)throw new n(`${A} was already given; pass it once.`);let i=h(e,t);if(!i.ok)throw new n(i.summary);return t}}function We(e,t){return[...t??[],e]}function j(e){let t=e.split(/\s+/u)[0]??e;return(e,r)=>{if(r!==void 0)throw new n(`${t} was already given; pass it once.`);return e}}async function M(e,t){let n=x(e,t),r=h(e.requestBody??[],n);if(!r.ok||r.data===null)return v(r.summary,r.warnings);let i=r.data;if(i===void 0)return g(`No body`,void 0);let a=Ge(e,i,t);if(a!==null)return v(a);let o=ye(e.operationId,i,t);if(!o.ok)return v(o.summary,o.warnings);t=o.data;let s=Ke(i,t);if(s!==null)return v(s);let c=await Xe(t);if(!c.ok)return v(c.summary,c.warnings);let l=Ce(e.requestBody??[],i,c.data);if(l!==null)return v(l);let u=Ye(e.operationId,i,c.data);if(!u.ok)return u;let d=be(e.operationId,i,c.data);if(d!==null)return v(d);let f=Ze(e.operationId,i,t);if(!f.ok)return f;if(c.data===void 0&&f.data===void 0)return i.required?v(tt(e.operationId,i)):g(`No body`,void 0);let p=$e(e.operationId,i,c.data,f.data);if(!p.ok||p.data===void 0)return p;if(i.schemaType===`array`&&!Array.isArray(p.data))return v(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!k(p.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return v(`${e.operationId} requires a JSON object${t}.`)}let m=Je(i,p.data);if(m.length>0)return v(`${e.operationId} requires body option(s): ${m.join(`, `)}`);let _=p.data,y=k(_)?D(i).filter(e=>!O(_,e)):[];return y.length>0?v(qe(e.operationId,i,y)):p}function Ge(e,t,n){let r=new Set(t.parameter.map(({optionKey:e})=>e));for(let i of e.requestBody??[])if(i!==t)for(let t of i.parameter){if(r.has(t.optionKey)||n[t.optionKey]===void 0)continue;let i=(e.requestBody??[]).filter(e=>e.parameter.some(({optionKey:e})=>e===t.optionKey)).map(({contentType:e})=>e);return`${N(t)} requires ${A} ${i.join(` or `)}.`}return null}function Ke(e,t){for(let n of e.cliConflicts??[]){let e=n.filter(e=>t[e]!==void 0);if(e.length>1)return`Options ${e.join(`, `)} cannot be used together.`}return null}function qe(e,t,n){let r=`${e} requires JSON body path(s): ${n.join(`, `)}`;return t.kind===`multipart`?`${r}. ${n.includes(`body`)?`For multipart --from-file, wrap the endpoint JSON under top-level "body".`:`For multipart --from-file, put the missing nested path(s) inside top-level "body".`}`:r}function Je(e,t){return k(t)?e.parameter.filter(e=>e.required&&!O(t,e.name)).map(N):[]}function Ye(e,t,n){let r=he(t,n);if(r===null)return g(`Body file paths validated`,null);let i=r.suggestion===void 0?``:` Use ${r.suggestion}.`;return v(`${e} --from-file contains unknown JSON path ${r.path}.${i}`)}async function Xe(e){let t=typeof e.fromFile==`string`?e.fromFile:void 0;if(t===void 0)return g(`No body file`,void 0);let n=await ze(t);if(!n.ok)return v(n.summary,n.warnings);let r=_.safeParse(n.data);return r.success?g(`Input parsed`,r.data):v(`Input is not valid JSON value: ${r.error.message}`)}function Ze(e,t,n){let r={},i=!1;for(let e of t.parameter){let a=je(e,n[e.optionKey]);if(!a.ok||a.data===null)return v(a.summary,a.warnings);let o=a.data;if(o===void 0)continue;let s=Qe(t,n,r,e,o);if(!s.ok)return v(s.summary,s.warnings);i=!0}if(!i)return g(`No direct body options`,void 0);let a=Se(e,t,n,r);return a===null?g(`Direct body options parsed`,r):a}function Qe(e,t,n,r,i){let a=Me(r,i);if(a===null){let e=et(r,i);return e.ok?Ae(n,r.name,e.data,r.schemaType===`array`):v(e.summary,e.warnings)}if(a.plain.length>0)return v(`${N(r)} mixes row-form values with plain value(s): ${a.plain.join(`, `)} — prefix every value with its 0-based ${a.container}[] row index, as 0:value.`);let o=Ee(e,t,a.container);for(let e of a.rows.keys())if(!(e<o))return v(`${N(r)} names ${a.container}[] row ${e}, but these options build at most ${o} ${a.container}[] row(s) — number rows from 0, and name the row of a value that itself starts with digits and a colon, as 0:0:00 for the value 0:00.`);for(let[e,t]of a.rows){let i=[];for(let e of t){let t=F(r.name,r.itemSchemaType,e);if(!t.ok)return v(t.summary,t.warnings);i.push(t.data)}let a=ve(n,r.name,e,i);if(!a.ok)return a}return g(`Body value assigned`,null)}var N=e=>e.flag.split(` `)[0]??e.name;function $e(e,t,n,r){if(n===void 0)return g(`Direct body parsed`,r);if(r===void 0)return g(`Input parsed`,n);if(k(n)&&k(r))try{return g(`Input parsed`,P(t,n,r))}catch(t){return v(`${e} ${t instanceof Error?t.message:String(t)}`)}return v(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function P(e,t,n,r=``){let i={...t};for(let[t,a]of Object.entries(n)){let n=i[t],o=`${r}${t}`;if(k(n)&&k(a))i[t]=P(e,n,a,`${o}.`);else if(n===void 0||n===a)i[t]=a;else throw Error(`sets JSON key '${o}' both in --from-file and with ${e.parameter.find(({name:e})=>e===o)?.flag.split(` `)[0]??`body options`} — set it in one place${Array.isArray(n)?`: move the per-item fields inside the matching '${o}[]' object(s) in the file body`:te.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function et(e,t){if(typeof t==`boolean`)return g(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return F(e.name,e.schemaType,t??``);let n=[],r=E(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=F(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return g(`Body value parsed`,n)}function F(e,t,n){if(t===`boolean`)return n===`true`?g(`Body value parsed`,!0):n===`false`?g(`Body value parsed`,!1):v(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?v(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?v(`${e} must be an integer.`):g(`Body value parsed`,i)}return g(`Body value parsed`,n)}function tt(e,t){let n=t.parameter.filter(e=>e.required);if(n.length>0&&t.requiredPath.every(e=>n.some(({name:t})=>t===e||t.startsWith(`${e}.`))))return`${e} requires body option(s): ${n.map(N).join(`, `)}`;let r=D(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(N).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function nt(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:A,location:`body`}),I(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),ke(e.options,r)}function I(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function rt(e,t,n=y().bin[0]){e.helpCommand(!1);let r=e.commands.find(e=>e.name()===`help`)??e.command(`help`);r.summary(`Show full documentation for a command, or ask a question`).description("Show a command's full documentation offline. Select it by command path,\noperationId, or `<METHOD> <path>`; `<command> --help` prints only its usage.\n`help ask <question>` or `help --ask <question>` answers a platform question.").argument(`[command...]`,"command path, operationId, or METHOD and path, e.g. `help entities get`"),r.addOption(new it(r)),r.hook(`preSubcommand`,e=>{e.opts().help&&e.help()});let i=st(t);i!==void 0&&r.option(`--ask <question>`,i.summary),T(r),r.action(async function(r){let{emit:a}=await import(`./output-CtsN3oh3.js`),o=this.optsWithGlobals();if(o.help&&r.length===0){this.outputHelp();return}if(!o.help&&i!==void 0&&o.ask!==void 0){let e=C(o);if(r.length>0){a({mode:e},v(`Use either a command path or --ask, not both.`));return}a({mode:e},await lt(i,o.ask,o.environment,e));return}let s=V(e,r),c=t.find(t=>s!==void 0&&V(e,t.cliPath)===s);if(o.help||s!==void 0&&c===void 0){s===void 0&&this.error(`unknown command '${r.join(` `)}' (run \`${n} --help\` for the command tree)`),s.outputHelp();return}let l=c===void 0?await ct(r,t):g(`Resolved by command path`,{operationId:c.operationId});if(l.ok&&l.data?.command!==void 0&&this.error(`unknown command '${r.join(` `)}' (run \`${n} --help\` for the command tree)`),!l.ok||l.data===null){a({mode:C(o)},l);return}let{writeShowResult:u}=await import(`./operations-catalog-CtACMf18.js`);u({...o,...l.data},t,C(o,`text`),n)}),ot(e,t,n)}var it=class extends t{helpCommand;constructor(e){super(`-h, --help`,`display help for command`),this.helpCommand=e}is(e){if(e!==this.short&&e!==this.long)return!1;let t=this.helpCommand.parent?.args??[],n=t.findIndex(e=>e===this.helpCommand.name()||this.helpCommand.aliases().includes(e)),r=n<0?void 0:t[n+1];return r===void 0||r.startsWith(`-`)?!0:!this.helpCommand.commands.some(e=>e.name()===r||e.aliases().includes(r))}},L=2,R=6,at={formatHelp(e,t){let n=n=>r.prototype.formatHelp.call(this,e,Object.assign(Object.create(t),n));if(t.visibleCommands(e).length===0)return n({});let i=t.padWidth(e,t),a={padWidth:()=>i,visibleOptions:()=>[],showGlobalOptions:!1},o=n({...a,visibleCommands:()=>[]}),s=n({padWidth:()=>i,visibleCommands:()=>[]}).slice(o.length);return n(a)+s},visibleCommands(e){let t=r.prototype.visibleCommands.call(this,e);return e.parent===null?t.filter(e=>!re.has(e.name())):t},subcommandTerm(e){let t=r.prototype.subcommandTerm.call(this,e);return e.commands.length>0&&e.registeredArguments.length===0?`${t} <command>`:t},formatItem(e,t,n,i){let a=i.helpWidth??80,o=a-t-4;return n===``||o>=i.minWidthToWrap?r.prototype.formatItem.call(i,e,t,n,i):`${` `.repeat(L)}${e}\n${z(n,a,i)}`}};function z(e,t,n){return n.boxWrap(e,t-R).replace(/^/gmu,` `.repeat(R))}function ot(e,t,n){for(let r of t){let i=V(e,r.cliPath);i!==void 0&&i.addHelpText(`after`,()=>{let e=i.createHelp(),a=i.configureOutput().getOutHelpWidth?.();e.prepareContext(a===void 0?{}:{helpWidth:a});let o=e.helpWidth??80,s=ee(r.operationId,t,n),[c,...l]=me(r.errorResponse),u=l.map(t=>z(t.trimStart(),o,e).replace(/^ +/u,` `.repeat(L))),d=c===void 0?[]:[``,c,...u];return`\n${[...s,...d].join(`
2
- `)}\n`})}}function st(e){let[t,...n]=e.filter(e=>{let[t,n,...r]=e.cliPath;return t===`help`&&n!==void 0&&r.length===0&&H(e)!==void 0});return n.length===0?t:void 0}var B='Accepted selectors: `<METHOD> <route template or concrete path>`, an operationId, or a CLI command path such as "entities get".';async function ct(e,t){let[n=``,...r]=e.join(` `).trim().split(/\s+/u),[i,...a]=t.filter(e=>e.path===n);if(r.length===0&&i!==void 0)return a.length===0?g(`Resolved by route`,{operationId:i.operationId}):v(`${n} is served by ${[i,...a].map(({method:e})=>e).join(`, `)}; name the method, as in \`help ${i.method} ${n}\`.`,[B]);let o=d.find(e=>e===n.toLowerCase());if(o===void 0||r.length===0){let n=e.join(` `).trim();return g(`Resolved by name`,t.some(e=>e.operationId===n)?{operationId:n}:{command:n})}let s=m(o),c=r.join(``),l=t.find(e=>e.method===s&&e.path===c);if(l!==void 0)return g(`Resolved by route template`,{operationId:l.operationId});let{resolveOpenApiOperationSelector:u}=await import(`./openapi-call-CCpc56ir.js`),f=u({method:s,path:c});return!f.ok||f.data===null?v(f.summary,[...f.warnings,B]):g(`Resolved by method and path`,{operationId:f.data.operation.operationId})}function V(e,t){let n=e;for(let e of t){let t=n.commands.find(t=>t.name()===e||t.aliases().includes(e));if(t===void 0)return;n=t}return n}async function lt(e,t,n,r){let{buildOpenApiPath:i,runOpenApiCall:a}=await import(`./openapi-call-CCpc56ir.js`),o=H(e);if(o===void 0)return v(`The \`${e.cliPath.join(` `)}\` operation no longer takes a single required text body; run it directly instead of \`help --ask\`.`);n!==void 0&&(process.env.API_ENV=n);let s=await M(e,{[o.optionKey]:t});return s.ok?await a({method:e.method,path:i(e.operationId,{}),searchParams:{},body:s.data,auth:e.auth,responseFormat:w(r)?`json`:`auto`}):s}function H(e){if(e.requestBody?.length!==1||e.parameters.some(e=>e.required))return;let t=(e.requestBody[0]?.parameter??[]).filter(e=>e.required);return t.length===1&&t[0]?.schemaType===`string`?t[0]:void 0}function ut(e,t,n){if(e.cliPath[0]!==`lookup`||!dt(n))return null;let r=e.parameters.filter(e=>t[e.optionKey]!==void 0).map(e=>`${e.name}=${String(t[e.optionKey])}`),i=`no record for ${r.length===0?`the given input`:r.join(`, `)}`;return n.ok?v(i):v(i,[],{httpStatus:n.httpStatus,problem:n.problem})}function dt(e){return e.ok?Array.isArray(e.data)&&e.data.length===0:e.httpStatus===404}function ft(e,t){if(e.deprecated!==!0)return t;let n=e.description.match(/^Deprecated:[^.]*\./u)?.[0]??`Deprecated; run \`help ${e.cliPath.join(` `)}\` for its replacement.`;return{...t,warnings:[n,...t.warnings]}}function pt(t,n,r,i){let a=mt(t),o=a instanceof e?[]:a,s=o[0],c=i.bin[0],l=[{selected:s===`auth`,register:async()=>{let{registerBuiltinAuthCommands:e}=await import(`./builtin-auth-DzCjM2rV.js`);e(n,c)}},{selected:s===`agents`,register:async()=>{let{registerBuiltinAgentSetupCommand:e}=await import(`./builtin-agent-setup-B2Xvqera.js`);e(n,c)}},{selected:s===`update`,register:async()=>{let{registerBuiltinUpdateCommand:e}=await import(`./builtin-update-Dx_i2YGF.js`);e(n,i)}},{selected:s===`batch`,register:async()=>{let{registerBuiltinBatchCommand:e}=await import(`./builtin-batch-DdGyCjlR.js`);e(n,r,c)}},{selected:s===`research-runs`,register:async()=>{let{registerBuiltinResearchRunWaitCommand:e}=await import(`./builtin-research-run-wait-BF06g2eh.js`);e(n)}},{selected:s===`completion`,register:async()=>{let{registerCompletionCommand:e}=await import(`./completion-CoE0a605.js`);e(n,r,c)}},{selected:s===`command-catalog`,register:async()=>{let{registerOperationsCommand:e}=await import(`./operations-uVpQkO2z.js`);e(n,r,c)}}],u=s===void 0||s===`help`||s===`completion`||s===`command-catalog`||!l.some(e=>e.selected)&&!r.some(e=>e.cliPath[0]===s),d=1;for(;d<o.length&&r.some(e=>o.slice(0,d+1).every((t,n)=>e.cliPath[n]===t));)d++;let f=o.slice(0,d),p=u?r:r.filter(e=>f.slice(0,e.cliPath.length).every((t,n)=>e.cliPath[n]===t)),m=new Set,h=async(e=!1)=>{for(let t of l)(e||u||t.selected)&&!m.has(t)&&(await t.register(),m.add(t))};return{generated:p,fullTree:u,registerBuiltin:h,async completeTree(e){e(n,r.filter(e=>!p.includes(e))),await h(!0)}}}function mt(n){try{return new i().exitOverride().configureOutput({writeErr:()=>void 0}).addOption(new t(`--environment <environment>`)).parseOptions([...n]).operands}catch(t){if(!(t instanceof e))throw t;return t}}var ht=new Set(S.map(e=>e.cliPath.join(` `)));function U(e,t){e.showHelpAfterError(!1).exitOverride(t(e)),e.commands.length===0?e.hook(`preAction`,Fe):e.registeredArguments.length===0&&!ht.has(Ne(e).join(` `))&&e.addHelpOption(new Pe(e));for(let n of e.commands)U(n,t)}var W=y(Le(import.meta.url)),G=W.bin[0];async function K(e,t){let{BearerVerificationUnavailableError:n}=await import(`./openapi-call-CCpc56ir.js`),{emitJson:r}=await import(`./output-CtsN3oh3.js`),i=e instanceof Error?e:Error(String(e));s({component:G,event:`fatal`,message:i.message,error:i}),process.stderr.write(`${G} fatal (${t}): ${i.stack??i.message}\n`);let a=i instanceof n?{httpStatus:i.problem.status,problem:i.problem}:{};r({...v(`${G} ${t}: ${i.message}`,[i.name||`Error`],a),counts:{exitCode:1}}),process.exit(1)}function q(e){return ie[ne(e,b)??`cli`]}function J(e,t){let n=t.map(e=>{let t=e.cliPath[0]??``;return{spec:e,top:t,rank:q(t).rank}}).toSorted((e,t)=>e.rank-t.rank||e.top.localeCompare(t.top)).map(e=>e.spec),r=new Set(n.filter(e=>fe(e.cliPath[0])).map(e=>e.cliPath[0]??``)),i=new Set,a=new Set;for(let{cliPath:e,deprecated:t}of n)for(let n=1;n<e.length;n++){let r=e.slice(0,n).join(` `);i.add(r),t!==!0&&a.add(r)}for(let t of n)gt(e,t,r,a,i.has(t.cliPath.join(` `)))}function gt(e,t,n,r,i){let a=t.cliPath,o=e,s=``,c=!n.has(a[0]??``);for(let e of a.slice(0,-1)){s=s===``?e:`${s} ${e}`;let t=c&&s===e||!r.has(s);o=_t(o,e,s,t)}let l=a.at(-1)??t.operationId,d=o.commands.find(e=>e.name()===l)??o.command(l,t.deprecated===!0?{hidden:!0}:{}),m=t.requestBody?.flatMap(({parameter:e})=>e)??[];d.summary(t.summary||t.operationId).description([`${t.method} ${t.path}.`,t.summary||t.description,`Full documentation: ${G} help ${t.cliPath.join(` `)}`,t.requestBody?.[0]?.kind===`json`||[...t.parameters,...m].some(e=>u(e.schemaType,e.itemSchemaType))?p:``].filter(Boolean).join(`
3
- `));let h=se(t);for(let e of t.parameters)vt(d,e,i||e===h);Ve(d,t),f(t.intent)&&d.option(`--execute`,`Deprecated; accepted and ignored. This command executes by its verb.`,!1),T(d),d.hook(`preAction`,e=>pe(e,t)),t.explain===!0&&d.option(`--explain`,`Print the search strategy and parsed constraints before the results`),h!==void 0&&d.argument(`[text...]`,h.description||`Same as ${oe(h.flag)}.`),d.action(async function(){let{emit:e,emitSearchExplanation:n}=await import(`./output-CtsN3oh3.js`),r=this.optsWithGlobals(),i=C(r),a=r;if(h!==void 0){let t=ce(h,this.args,r);if(!t.ok||t.data===null)return e({mode:i},t);a=t.data}let o=le(t,a);if(o.length>0)return e({mode:i},v(`missing required options: ${o.join(`, `)}`));let s=await yt(t,a,i),c=ut(t,a,s);if(c!==null)return e({mode:i},c);r.explain===!0&&s.ok&&n(i,s.data),s.ok&&s.data instanceof Uint8Array?process.stdout.write(s.data):e({mode:i},s)})}function _t(e,t,n,r){let i=e.commands.find(e=>e.name()===t);if(i!==void 0)return i;let a=b[n],o=e.command(t,r?{hidden:!0}:{}).helpCommand(!1);return a!==void 0&&o.summary(a.summary).description(a.summary),o}function vt(e,n,r=!1){let i=n.description||`${n.name} ${n.location} parameter`,a=n.defaultValue===void 0?void 0:typeof n.defaultValue==`string`||typeof n.defaultValue==`boolean`?n.defaultValue:[...n.defaultValue];if(n.legacyFlag!==void 0){let o=new t(n.flag,i);a!==void 0&&o.default(a);let s=new t(n.legacyFlag,i).conflicts(n.optionKey);e.addOption(o).addOption(s),e.hook(`preAction`,e=>{let t=e.opts(),i=t[n.optionKey],a=t[s.attributeName()];a===void 0?!r&&n.required&&i===void 0&&e.error(`error: required option '${o.flags}' not specified`,{code:`commander.missingMandatoryOptionValue`}):(i===void 0||e.getOptionValueSource(n.optionKey)==="default")&&e.setOptionValueWithSource(n.optionKey,a,`cli`)})}else a===void 0?n.required&&!r?e.requiredOption(n.flag,i):e.option(n.flag,i):e.option(n.flag,i,a)}async function yt(e,t,n){let{buildOpenApiPath:r,runOpenApiCall:i}=await import(`./openapi-call-CCpc56ir.js`),{pendingResult:o}=await import(`./output-CtsN3oh3.js`);if(t.environment!==void 0){let e=l(t.environment);if(e===null)return v(`Unknown aVenture environment '${t.environment}'`,[`Use one of: ${a().join(`, `)}`]);process.env.API_ENV=e}let s=await M(e,t);if(!s.ok)return s;let c=Object.fromEntries(e.parameters.filter(e=>e.location===`path`).map(e=>{let n=t[e.optionKey];if(Array.isArray(n))return[e.name,n.at(0)??``];if(n===void 0)throw Error(`Missing required option ${e.optionKey}`);return[e.name,String(n)]})),u=Object.fromEntries(e.parameters.filter(e=>e.location===`query`).flatMap(e=>{let n=t[e.optionKey];if(n===void 0||Array.isArray(n)&&n.length===0)return[];let r=Array.isArray(n)||typeof n==`boolean`?n:String(n);return[[e.name,r]]})),d=Object.fromEntries(e.parameters.filter(e=>e.location===`header`).flatMap(e=>{let n=t[e.optionKey];return n===void 0||Array.isArray(n)&&n.length===0?[]:[[e.name,Array.isArray(n)?n.join(`,`):String(n)]]}));return ft(e,await i({method:e.method,path:r(e.operationId,c),searchParams:u,headers:d,body:s.data,contentType:x(e,t),auth:e.auth,responseFormat:w(n)?`json`:`auto`,responseBytes:e.binaryResponse===!0,pendingResult:o}))}process.on(`uncaughtException`,e=>K(e,`uncaughtException`)),process.on(`unhandledRejection`,e=>K(e,`unhandledRejection`));var Y=ue(process.argv.slice(2),S),X=Y===`required`?S:ae(S),Z=new Ie;Z.name(G).usage(`<command> [subcommand] [options]`).configureHelp(at).version(W.version).summary(`CLI for the aVenture API: companies, people, and news, with the funding, publications, and classifications attached to them`).description(`The aVenture research API from your terminal. Three records — companies,
4
- people, and news — carry everything else: funding, publications, and tags.
5
-
6
- Mutations execute directly; --execute is a deprecated no-op.
7
- The aVenture MCP server tools execute through this same CLI.`).addOption(new t(`--environment <environment>`,`route all API calls to a mapped API environment (default: API_URL host, else API_ENV, else ${c})`).choices([...a()])).showHelpAfterError(`(run \`${G} --help\` for usage)`);var Q=pt(process.argv.slice(2),Z,X,W);J(Z,Q.generated),await Q.registerBuiltin(),rt(Z,X,G);for(let e of Z.commands)e.helpGroup()||e.helpGroup(q(e.name()).heading);var $;if(U(Z,e=>t=>{throw $=(async()=>{!Q.fullTree&&![`commander.helpDisplayed`,`commander.version`].includes(t.code)&&await Q.completeTree(J);let{commandExitHandler:n}=await import(`./parse-error-hint-BNJ09L05.js`);try{n(e)(t)}catch(e){if(e!==t)throw e}})(),t}),Y===`required`){let e=[Z];for(;e.length>0;){let t=e.pop();t!==void 0&&(e.push(...t.commands),t.hook(`preAction`,async(e,t)=>{e===t&&await de(`required`)}))}}var bt=new Set(Z.commands.filter(e=>[`entities`,`people`,`news`].includes(e.name())).flatMap(e=>e.commands.map(e=>e.name())));Z.addHelpText(`after`,[``,`Record subcommands under entities, people, and news:`,...[[`search`,` search Find many of that record from a plain-English query or a filter`],[`lookup`,` lookup Find one news article; companies and people use the root lookup`],[`get`,` get Read one record`],[`list`,` list Read many records`],[`create`,` create, update, delete Write; each needs a credential that permits it`]].flatMap(([e,t])=>bt.has(e)?[t]:[]),``,`Authentication (every command that calls aVenture needs a credential):`,` Create one at ${o}/sign-up, then run: ${G} auth login`,` AUTH_TOKEN aVenture API key, for CI and other non-interactive shells`,` Check what this shell holds with: ${G} auth status\n`,`Output modes (per command):`,` --text compact lines, the terminal default; --json the full envelope`,` --data response data as JSON, the default when piped or non-TTY`,` --data-full uncapped, for bounded programs, never LLM agents`,` --all-fields --text plus the detail fields it hides by default
8
- `,`Exit codes:`,` 0 envelope.ok === true
9
- 1 envelope.ok === false
10
- `,`Examples:`,` $ ${G} auth login`,` $ ${G} lookup --name Stripe --url https://stripe.com`,` $ ${G} search "fintech companies in Austin"\n`,`Run \`${G} <command> --help\` for its subcommands and options,`,`or \`${G} help <command>\` for its full documentation.`].join(`
11
- `));try{await Z.parseAsync()}catch(t){await $,t instanceof e?process.exitCode=t.exitCode:await K(t,`parseAsync`)}export{};
@@ -1,24 +0,0 @@
1
- import{n as e}from"./commander-DEj7N1b9.js";import{f as t,h as n,x as r}from"./logging-Bk8_GcPH.js";import{S as i}from"./tool-policy-BPefkvzQ.js";import{M as a,O as o,i as s,o as c,v as l,w as u,y as d}from"./person-owner-C0YuWKvY.js";import{c as f,r as p}from"./result-envelope-5R2VEWAg.js";import{a as m}from"./package-CZBWjlYb.js";import{a as h,i as g}from"./response-problem-BGEYFwd5.js";import{a as _,d as v,f as y,r as ee,u as te}from"./openapi-call-Cu_IqRxU.js";import{n as b}from"./contract-BztWeCTz.js";import{S as x,_ as S,a as C,g as w,h as ne,i as re,m as ie,n as ae,p as oe,r as se,s as ce,t as le,v as ue,x as T,y as de}from"./api-key-bearer-credential-CyFG5_Cm.js";import{a as fe,c as E,d as pe,g as me,l as he,m as ge,o as _e,s as ve,t as ye,u as be}from"./oauth-bearer-credential-CMDf5sF6.js";import{n as xe,r as Se,t as Ce}from"./oauth-login-Cj6xqtM3.js";import{n as we,t as Te}from"./openapi-commands-CKb-tN3f.js";import{t as D}from"./output-BCOtzmsw.js";import{i as O,t as k}from"./output-mode-DYvJUCAE.js";import{n as Ee}from"./builtin-update-5IL6qRqK.js";import{stderr as A,stdin as De}from"node:process";import{TextDecoder as Oe,inspect as ke}from"node:util";import{hostname as Ae,platform as je}from"node:os";import{setTimeout as Me}from"node:timers/promises";import{webcrypto as j}from"node:crypto";var Ne=d({artifact:u().nullish(),group:u().nullish(),name:u().nullish(),revision:u().nullish(),time:s({offset:!0}).nullish(),version:u().nullish()}),Pe=d({build:Ne}),Fe=c([`MACOS`,`LINUX`,`WINDOWS`,`OTHER`]),Ie=c([`RSA_OAEP_256_A256_GCM_V1`]),Le=d({clientLabel:u().regex(/.*\S.*/).min(1).max(120).nullish(),clientPlatform:Fe.nullish(),encryptionAlgorithm:Ie.nullish(),encryptionPublicKey:u().min(344).max(12e3).nullish()}),Re=32;async function ze(){let e=await j.subtle.generateKey({name:`RSA-OAEP`,modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:`SHA-256`},!0,[`encrypt`,`decrypt`]),t=await j.subtle.exportKey(`spki`,e.publicKey);return{publicKey:Buffer.from(t).toString(`base64`),privateKey:e.privateKey}}async function Be(e,t){let{wrappedKey:n,nonce:r,ciphertext:i,authenticationTag:a}=t,o=M(n,`wrapped key`,128,1024),s=M(r,`nonce`,12,12),c=M(i,`ciphertext`,1,65536),l=M(a,`authentication tag`,16,16),u;try{u=await j.subtle.decrypt({name:`RSA-OAEP`},e,o)}catch{throw Error(`broker credential key could not be decrypted`)}let d=new Uint8Array(u);try{if(d.byteLength!==Re)throw Error(`broker credential used an invalid AES-256 key`);let e=await j.subtle.importKey(`raw`,d,{name:`AES-GCM`},!1,[`decrypt`]),t=new Uint8Array(c.byteLength+l.byteLength);t.set(c),t.set(l,c.byteLength);let n;try{n=await j.subtle.decrypt({name:`AES-GCM`,iv:s,tagLength:128},e,t)}catch{throw Error(`broker credential payload failed authentication`)}let r=new Oe(`utf-8`,{fatal:!0}).decode(n);if(r.trim().length===0)throw Error(`broker returned a blank credential`);return r}finally{d.fill(0)}}function M(e,t,n,r){let i=e.replace(/=+$/u,``),a=Uint8Array.from(Buffer.from(e,`base64`)),o=Buffer.from(a).toString(`base64`).replace(/=+$/u,``);if(i.length===0||o!==i||a.byteLength<n||a.byteLength>r)throw Error(`broker returned an invalid ${t}`);return a}var Ve=c([`PENDING`,`ISSUING`,`KEY_READY`,`REVOKING`,`CONSUMED`,`REVOKED`,`DENIED`,`EXPIRED`,`FAILED`]),He=c([`Denied by user`,`Authorization request expired`,`CLI authorization expired before acknowledgement`,`Credential issuance recovery revoked an unrecoverable key`,`Revoked by user`,`Clerk create response validation failed`,`Credential issuance failed`,`Credential issuance could not be recovered`,`API-key quota reached`,`Credential issuance lost its database claim`,`Credential delivery encryption failed`,`Credential issuance finalization was lost`]),Ue=d({approvedAt:s({offset:!0}).nullish(),clientLabel:u(),clientPlatform:Fe,comparisonCode:u(),consumedAt:s({offset:!0}).nullish(),createdAt:s({offset:!0}),expiresAt:s({offset:!0}),id:o(),intervalSeconds:l().int().min(1),keyReadyAt:s({offset:!0}).nullish(),status:Ve,terminalAt:s({offset:!0}).nullish(),terminalReason:He.nullish(),updatedAt:s({offset:!0})}),We=d({algorithm:Ie,authenticationTag:u(),ciphertext:u(),nonce:u(),wrappedKey:u()}),Ge=d({delivery:We.nullish(),expiresAt:s({offset:!0}),status:Ve,terminalReason:He.nullish()}),Ke=d({comparisonCode:u(),expiresAt:s({offset:!0}),id:o(),intervalSeconds:l().int().min(1),pollSecret:u(),verificationUrl:u()}),N=[{command:`auth login`,role:`oauth`,summary:`Sign In Through Your Browser`,description:`Sign in through your browser and save verified CLI access in the credential store. Use --no-browser for OAuth device authorization only when the issuer advertises device-grant support; otherwise use --key --no-browser for API-key approval.`,operationId:`getAuthProviderCatalog`,method:`GET`,path:`/v1/auth/providers`,bodyOption:[],localOption:[{optionKey:`browser`,flag:`--no-browser`,description:`Use OAuth device authorization only when the issuer advertises device-grant support: print a sign-in URL and code, then wait for approval. Otherwise use --key --no-browser for API-key approval.`},{optionKey:`providers`,flag:`--providers`,description:`Print the sign-in providers and CLI OAuth client, then exit without signing in.`}]},{command:`auth login`,role:`start`,summary:`Sign In With a Browser-Approved aVenture API Key`,description:`Creates a short-lived browser approval request and returns its poll credential once.`,operationId:`createCliAuthorization`,method:`POST`,path:`/v1/auth/cli-authorizations`,bodyOption:[{name:`clientLabel`,optionKey:`clientLabel`,flag:`--client-label <client-label>`,required:!1,description:`Label for this CLI installation.`}],localOption:[{optionKey:`key`,flag:`--key`,description:`Sign in with a browser-approved aVenture API key instead of OAuth; the approval URL opens on any device.`},{optionKey:`browser`,flag:`--no-browser`,description:`Print the API-key approval URL and wait for approval without opening a browser.`}]},{command:`auth login`,role:`poll`,summary:`Poll CLI Authorization`,description:`Returns pending state, a terminal state, or an encrypted one-time credential delivery.`,operationId:`pollCliAuthorization`,method:`POST`,path:`/v1/auth/cli-authorizations/{cliAuthorizationId}/poll`,bodyOption:[],localOption:[]},{command:`auth login`,role:`acknowledge`,summary:`Acknowledge CLI Credential Delivery`,description:`Confirms the CLI stored the delivered API key in its credential store and clears transient delivery material.`,operationId:`acknowledgeCliAuthorization`,method:`POST`,path:`/v1/auth/cli-authorizations/{cliAuthorizationId}/acknowledge`,bodyOption:[],localOption:[]},{command:`auth logout`,role:`revoke`,summary:`Sign Out: Revoke the API Key and Forget Stored OAuth`,description:`Revokes the aVenture API key authenticating this request and returns its metadata so the CLI can confirm revocation before deleting its saved copy.`,operationId:`revokeCurrentApiKey`,method:`DELETE`,path:`/v1/auth/api-key`,bodyOption:[],localOption:[{optionKey:`forgetLocal`,flag:`--forget-local`,description:`Delete the saved key even when revocation cannot be confirmed.`}]}],P=b(N,`start`),F=b(N,`poll`),I=b(N,`acknowledge`),L=class extends Error{httpStatus;retryAfterSeconds;retryable;constructor(e,t,n=[]){super(`CLI authorization ${e} failed: ${S(t,n)}`),this.name=`CliAuthorizationRequestError`,this.httpStatus=t.status,this.retryAfterSeconds=Qe(t.retryAfterSeconds),this.retryable=t.status>=500||t.status===429}},qe=class extends Error{constructor(e,t,n=[]){super(`CLI authorization ${e} transport failed: ${w(t,n)}`,{cause:t}),this.name=`CliAuthorizationTransportError`}};async function Je(e){let t=await y(x(r()),{method:P.method,path:i(P.path,{},P.operationId),headers:{},contentType:`application/json`,body:e},Ke);if(t.ok&&t.redirect)throw new L(`start`,R(t.status));if(!t.ok)throw new L(`start`,t.problem);return $e(t.data)}async function Ye(e,t){let n=v(F.operationId),a=await y(x(r()),{method:F.method,path:i(F.path,{cliAuthorizationId:e},F.operationId),headers:{[n]:t}},Ge);if(a.ok&&a.redirect)throw new L(`poll`,R(a.status),[t]);if(!a.ok)throw new L(`poll`,a.problem,[t]);return{authorization:a.data,retryAfterSeconds:Ze(a.headers[`retry-after`])}}async function Xe(e,t){let n=v(I.operationId),a;try{a=await y(x(r()),{method:I.method,path:i(I.path,{cliAuthorizationId:e},I.operationId),headers:{[n]:t}},Ue)}catch(e){throw new qe(`acknowledge`,e,[t])}if(a.ok&&a.redirect)throw new L(`acknowledge`,R(a.status),[t]);if(!a.ok)throw new L(`acknowledge`,a.problem,[t]);return a.data}function Ze(e){if(e===void 0)return null;let t=Number(e);return Number.isInteger(t)&&t>0?t:null}function Qe(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:null}function R(e){return{status:e,title:`Unexpected redirect`,type:`about:blank`,code:void 0,detail:`CLI authorization endpoint returned an unexpected redirect`}}function $e(e){let{verificationUrl:t,pollSecret:n,...r}=e,i={...e},a=()=>({...r,verificationUrl:`<redacted>`,pollSecret:`<redacted>`});return Object.defineProperties(i,{verificationUrl:{enumerable:!1,get:()=>t},pollSecret:{enumerable:!1,get:()=>n},toJSON:{enumerable:!1,value:a},toString:{enumerable:!1,value:()=>`CliAuthorizationStart(${JSON.stringify(a())})`},[ke.custom]:{enumerable:!1,value:a}})}async function et(e){let t=await z(e.credential.secret);if(t.state!==`verified`||e.activation!==`active`)return{stored:e,verification:t};try{return{stored:await C(e.host,{apiKey:t.apiKey,secret:e.credential.secret},`active`),verification:t}}catch(n){return{stored:e,verification:{state:`unavailable`,summary:`${t.summary}, but the cached metadata could not be updated — ${w(n,[e.credential.secret])}`}}}}async function z(e){let t=x(r()),n;try{n=await y(t,{method:`GET`,path:ee(`getCurrentApiKey`,{}),headers:{Authorization:`Bearer ${e}`}},ue)}catch(t){return{state:`unavailable`,summary:`identity verification failed before an HTTP response — ${w(t,[e])}`}}return n.ok&&n.redirect?{state:`unavailable`,summary:`identity verification returned unexpected redirect ${n.status}`}:n.ok?n.data.status===`ACTIVE`?{state:`verified`,summary:`API key verified by aVenture sign-in`,apiKey:n.data}:{state:`invalid`,summary:`API key is not active`}:{state:n.problem.status===401||n.problem.status===403?`invalid`:`unavailable`,summary:`identity verification: ${S(n.problem,[e])}`}}var B=b(N,`revoke`);async function tt(e){let t;try{t=T(r().host)}catch(e){return p(`auth logout: invalid API host — ${w(e)}`)}let n=await nt(t),i=await at(t,e),a=n.state===`failed`?[`OAuth credential could not be removed — ${n.summary}`]:n.state===`forgotten`&&!n.revoked?[`OAuth refresh token was not revoked remotely — ${n.summary??`no revocation endpoint`}`]:[],o={host:t,revoked:!1,forgotten:!1,oauth:n};return i===null?n.state===`missing`?f(`No CLI credential is stored for this API host.`,o):n.state===`failed`?{...p(`auth logout: ${a[0]}`),data:o}:f(n.revoked?`OAuth credential revoked remotely and removed locally.`:`OAuth credential removed locally.`,o,{warnings:a}):{...i,data:{...i.data??o,oauth:n},warnings:[...i.warnings,...a]}}async function nt(e){let t=await _e(e);if(t.state===`missing`)return{state:`missing`};let n=t.state===`found`?await it(t.stored):{revoked:!1};try{await fe(e)}catch(e){return{state:`failed`,summary:w(e)}}return{state:`forgotten`,...n}}async function rt(e){let t=Reflect.get(await Ce(e),`revocation_endpoint`);return typeof t==`string`?me(t,`revocation endpoint`,!0):void 0}async function it(e){let{client:t,tokens:n}=e.credential,r=n.refresh_token??n.access_token;try{let e=await rt(t);if(e===void 0)return{revoked:!1};let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({token:r,client_id:be(t)})});return n.ok?{revoked:!0}:{revoked:!1,summary:`revocation endpoint answered ${n.status}`}}catch(e){return{revoked:!1,summary:w(e,ge(n))}}}async function at(e,t){let n;try{n=await re(e)}catch(e){return p(`auth logout: stored credential could not be read — ${w(e)}`)}if(n.state===`unavailable`)return{...p(`auth logout: ${n.summary}`),data:{host:e,revoked:!1,forgotten:!1}};if(n.state===`missing`)return null;let r=n.stored,i=await ot(r),a=i.outcome===`revoked`,o=r.activation===`pending`&&i.outcome===`rejected`;if(!a&&!o&&!t.forgetLocal)return{...p(`auth logout: remote revocation was not confirmed; local credential preserved — ${i.summary}`,[`Retry when the API is available. If an earlier response was lost after revocation, the retry can be unauthorized because revoked keys cannot authenticate.`,"Use `--forget-local` only to remove local bytes while accepting that the remote key may remain active."]),data:V(r,!1,!1)};try{await ae(r.host)}catch(e){return{...p(`auth logout: local credential removal failed — ${w(e,[r.credential.secret])}`,[a?"The remote key is revoked. Re-run with `--forget-local` to retry local cleanup.":`Remote revocation was not confirmed; inspect auth status before retrying.`]),data:V(r,a,!1)}}return f(a?`API key revoked remotely and removed locally.`:o?`Stale pending CLI credential removed; its remote key can no longer authenticate and unacknowledged keys expire at the authorization deadline.`:`API key removed locally without confirmed remote revocation.`,V(r,a,!0),{ids:[r.credential.apiKey.id],warnings:a||o?[]:[`Remote revocation was not confirmed; the API key may remain active.`]})}async function ot(e){let t=x(r());try{let n=await y(t,{method:B.method,path:i(B.path,{},B.operationId),headers:{Authorization:`Bearer ${e.credential.secret}`}},ue);return n.ok&&n.redirect?{outcome:`unconfirmed`,summary:`remote key revocation returned unexpected redirect ${n.status}`}:n.ok?n.data.id!==e.credential.apiKey.id||n.data.subject!==e.credential.apiKey.subject?{outcome:`unconfirmed`,summary:`remote response did not match the stored API key identity`}:n.data.status===`REVOKED`?{outcome:`revoked`,summary:`remote key revocation confirmed`}:{outcome:`unconfirmed`,summary:`remote response did not confirm REVOKED status`}:{outcome:n.problem.status===401&&n.problem.type!==`about:blank`?`rejected`:`unconfirmed`,summary:S(n.problem,[e.credential.secret])}}catch(t){return{outcome:`unconfirmed`,summary:w(t,[e.credential.secret])}}}function V(e,t,n){return{host:e.host,apiKeyId:e.credential.apiKey.id,activation:e.activation,revoked:t,forgotten:n}}var st=`RSA_OAEP_256_A256_GCM_V1`,ct=1,lt=30,H=m().bin[0],U=`The local record remains pending and unavailable to ordinary commands. Re-run \`${H} auth login --key\`; it recovers the credential when the broker acknowledged it, and otherwise clears the stale record.`;async function ut(e){if(!De.isTTY)return p(`${H} auth login --key requires an interactive TTY on stdin`,[`For non-interactive automation, inject AUTH_TOKEN through the environment.`]);let t,n;try{let e=r().host;t=T(e),n=de(e)}catch(e){return p(`auth login --key: invalid environment configuration — ${w(e)}`)}for(;;){let e;try{e=await se(t)}catch(e){return p(`auth login --key: credential storage could not be inspected — ${w(e)}`)}if(e.state===`unavailable`)return p(`auth login --key: ${e.summary}`,[`Make the OS keyring or the CLI config directory writable, or use AUTH_TOKEN from the environment.`]);if(e.state===`missing`){e.keyringFailure!==void 0&&A.write(ce(e.keyringFailure));break}let n=await dt(e.stored);if(n!==null)return n}let i;try{i=await ze()}catch(e){return p(`auth login --key: ephemeral encryption key could not be created — ${w(e)}`)}let o=Le.safeParse({clientLabel:e.clientLabel?.trim()||(Ae().trim()||H).slice(0,120),clientPlatform:ht(),encryptionAlgorithm:st,encryptionPublicKey:i.publicKey});if(!o.success)return p(`auth login --key: ${a(o.error)}`);let s;try{s=await Je(o.data)}catch(e){return p(`auth login --key: could not start browser authorization — ${w(e)}`)}let c;try{c=ie(s,n)}catch(e){return p(`auth login --key: unsafe browser authorization URL rejected — ${w(e)}`)}if(!mt(await oe(s,n,{noBrowser:e.noBrowser}),s,c))return p(`auth login --key: browser authorization requires an interactive terminal for manual handoff`,[`Automatic browser opening did not complete, and the approval URL was withheld because stderr is not an interactive terminal. Retry from an interactive terminal.`],{references:[c]});let l;try{l=await pt(s)}catch(e){return p(`auth login --key: authorization did not complete — ${w(e)}`,[],{references:[c]})}if(l.algorithm!==st)return p(`auth login --key: broker selected an unsupported encryption algorithm`);let u;try{u=await Be(i.privateKey,l)}catch(e){return p(`auth login --key: encrypted credential could not be opened — ${w(e)}`)}let d=await z(u);if(d.state!==`verified`)return p(`auth login --key: decrypted credential was neither stored nor acknowledged — ${d.summary}`);let m;try{m=await C(t,{apiKey:d.apiKey,secret:u},`pending`)}catch(e){return p(`auth login --key: credential could not be durably stored — ${w(e)}`)}let h;try{h=await ft(s)}catch(e){return K(m,!0,`auth login --key: credential was stored and verified, but broker acknowledgment was not confirmed — ${w(e,[s.pollSecret])}`,U)}if(h.status!==`CONSUMED`)return K(m,!0,`auth login --key: broker returned ${h.status} after acknowledgment`,U);let g=await z(u);if(g.state!==`verified`||!_t(g.apiKey,m.credential.apiKey))return K(m,!0,`auth login --key: broker acknowledgment succeeded, but refreshed credential metadata could not prove the granted lifetime — ${g.summary}`,U);try{let e=await C(t,{apiKey:g.apiKey,secret:u},`active`);return f(`API key stored; authenticated identity and broker acknowledgment verified.`,G(e,!0),{ids:[e.credential.apiKey.id]})}catch(e){return K(m,!0,`auth login --key: remote acknowledgment succeeded, but local activation could not be confirmed — ${w(e)}`,U)}}async function dt(e){let t=await z(e.credential.secret);if(e.activation!==`pending`)return t.state===`verified`?f(`API key is already stored and its authenticated identity was verified.`,G(e,!0),{ids:[e.credential.apiKey.id]}):K(e,!1,`auth login --key: stored credential ${t.state} — ${t.summary}`,`Run \`${H} auth logout\` to revoke/remove it before authorizing a replacement.`);if(t.state===`verified`&&_t(t.apiKey,e.credential.apiKey))try{let n=await C(e.host,{apiKey:t.apiKey,secret:e.credential.secret},`active`);return f(`Recovered pending CLI credential: broker acknowledgment had succeeded.`,G(n,!0),{ids:[n.credential.apiKey.id]})}catch(t){return K(e,!0,`auth login --key: credential is valid but could not be promoted locally — ${w(t,[e.credential.secret])}`,`The remote key remains valid. Re-run \`${H} auth login --key\` to retry local activation; it will recover the pending credential automatically.`)}if(t.state===`unavailable`||t.state===`verified`&&!e.credential.apiKey.expiresAt)return K(e,t.state===`verified`,`auth login --key: the stored pending credential acknowledgment could not be verified — ${t.summary}`,t.state===`verified`?`The stored expiry is missing. Both records were preserved; inspect the existing key in your account before deciding how to recover it.`:`The stored record and the remote key were both preserved. Re-run \`${H} auth login --key\` when the API is reachable; it recovers an acknowledged credential and clears an unacknowledged one.`);let n=await ot(e);if(n.outcome===`unconfirmed`)return K(e,!1,`auth login --key: a prior credential is durably stored but broker acknowledgment was not confirmed`,`Remote revocation of the stale pending key was not confirmed — ${n.summary}. Retry when the API is reachable.`);try{await ae(e.host)}catch(t){return K(e,!1,`auth login --key: stale pending credential could not be removed — ${w(t,[e.credential.secret])}`)}return A.write(n.outcome===`revoked`?`Revoked and cleared a stale pending CLI credential; starting a fresh browser authorization.
2
- `:`Cleared a stale pending CLI credential whose remote key can no longer authenticate; starting a fresh browser authorization.
3
- `),null}async function ft(e){let t=new Date(e.expiresAt).getTime(),n=W(e.intervalSeconds);for(;;)try{return await Xe(e.id,e.pollSecret)}catch(e){if(e instanceof L){if(!e.retryable)throw e;n=W(e.retryAfterSeconds??n)}else if(!(e instanceof qe))throw e;if(Date.now()>=t)throw e;A.write(`Broker acknowledgment was interrupted; retrying.
4
- `),await gt(n,t)}}async function pt(e){let t=new Date(e.expiresAt).getTime(),n=W(e.intervalSeconds),r;for(A.write(`Waiting for browser approval...
5
- `);Date.now()<t;){let i;try{i=await Ye(e.id,e.pollSecret)}catch(e){if(e instanceof L){if(!e.retryable)throw e;n=W(e.retryAfterSeconds??n)}r=e,A.write(`Authorization poll was interrupted; retrying.
6
- `),await gt(n,t);continue}r=void 0;let a=i.authorization;switch(a.status){case`PENDING`:case`ISSUING`:case`REVOKING`:n=W(i.retryAfterSeconds??n),await gt(n,t);break;case`KEY_READY`:if(a.delivery===null||a.delivery===void 0)throw Error(`broker returned KEY_READY without an encrypted delivery`);return a.delivery;case`DENIED`:case`EXPIRED`:case`FAILED`:case`REVOKED`:throw Error(g(a.terminalReason?.trim()??``,[e.pollSecret])||`broker entered terminal state ${a.status}`);case`CONSUMED`:throw Error(`broker credential was already consumed; restart login`)}}throw Error(r===void 0?`browser authorization expired before approval completed`:`browser authorization expired after a retryable broker failure: ${w(r,[e.pollSecret])}`)}function mt(e,t,n){let r=e.state===`opened`;return!r&&!A.isTTY?!1:(A.write([r?`Browser approval opened for this request.`:`Browser not opened automatically (${e.reason}).`,...A.isTTY?[`Open this one-time approval URL in your browser:`,t.verificationUrl]:[`Approval reference: ${n}`],`Comparison code: ${t.comparisonCode}`,`Confirm that the browser shows the same code before approving.`,``].join(`
7
- `)),!0)}function ht(){switch(je()){case`darwin`:return`MACOS`;case`linux`:return`LINUX`;case`win32`:return`WINDOWS`;default:return`OTHER`}}function W(e){return Math.min(lt,Math.max(ct,e))}async function gt(e,t){let n=t-Date.now();n>0&&await Me(Math.min(e*1e3,n))}function G(e,t){return{host:e.host,provider:e.provider,apiKeyId:e.credential.apiKey.id,name:g(e.credential.apiKey.name,[e.credential.secret]),activation:e.activation,verified:t}}function K(e,t,n,r){return{...p(n,r===void 0?[]:[r]),data:G(e,t)}}function _t(e,t){return e.expiresAt===null||e.expiresAt===void 0||t.expiresAt===null||t.expiresAt===void 0?!1:new Date(e.expiresAt)>new Date(t.expiresAt)}async function vt(){return null}async function yt(e){let t=null,n=e=>{t=e};try{await ye(e,n),await le(n)}catch(e){return{materialized:t,failure:w(e)}}return{materialized:t,failure:null}}async function bt(e,t,n,r){if(r.failure!==null)return{scope:e,selected:null,identity:null,authorization:null,error:r.failure};let i=null,a=null,o,s=e=>{o=e,a=xt(e.credential,r.materialized)};try{let t=await _({method:`POST`,path:`/v1/auth/me/permissions`,body:{operation:[]},auth:e,requesterScope:e,responseFormat:`json`,onAuthPrepared:s});if(!t.ok)throw Error(St(t));if(a===null)throw Error(`Live permission probe did not prepare a credential`);if(i=Et(t.data),e===`read`)return{scope:e,selected:a,identity:null,authorization:i,error:null};if(o===void 0)throw Error(`Live permission probe did not retain its prepared credential`);let n=await vt(e,o);return{scope:e,selected:a,identity:n,authorization:i,error:null}}catch(r){return{scope:e,selected:a,identity:null,authorization:i,error:w(r,Ct(t,n,o))}}}function xt(e,t){if(e===null)return null;let n=t??ne().source;if(n===null)throw Error(`Prepared credential has no local provenance`);return{credential:e,source:n}}function St(e){return[e.summary,...e.warnings].join(` — `)}function Ct(e,t,n){return[r().userBearerToken,...h(n?.headers??{}),...e.state===`found`?ge(e.stored.credential.tokens):[],t.state===`found`?t.stored.credential.secret:void 0]}function wt(e,t,n=null){let r=t.state===`found`?t.stored:void 0,i=r?.credential.apiKey.expiresAt??null;return{host:e,present:r!==void 0,provider:r?.provider??null,activation:r?.activation??null,apiKeyId:r?.credential.apiKey.id??null,subject:r?.credential.apiKey.subject??null,scope:r?.credential.apiKey.scopes??[],name:r===void 0?null:g(r.credential.apiKey.name,[r.credential.secret]),status:r?.credential.apiKey.status??null,expiresAt:i,metadataSource:r===void 0?null:n?.state===`verified`?`clerk`:`store-cache`,live:n===null?null:{state:n.state,summary:n.summary},expiresInDay:kt(i),storageFailure:t.state===`unavailable`?t.summary:null,keyringFailure:t.state===`missing`?t.keyringFailure??null:null,error:t.state===`invalid`?t.summary:null}}function Tt(e,t){let n=t.state===`found`?t.stored:void 0;return{host:e,present:n!==void 0,provider:n?.provider??null,expiresAt:n?.credential.expiresAt??null,expired:n===void 0?null:E(n.credential),renewable:n===void 0?null:n.credential.tokens.refresh_token!==void 0,identity:n===void 0?null:pe(n.credential),client:n?.credential.client??null,storageFailure:t.state===`unavailable`?t.summary:null,keyringFailure:t.state===`missing`?t.keyringFailure??null:null,error:t.state===`invalid`?t.summary:null}}function Et(e){if(typeof e!=`object`||!e||e instanceof Uint8Array)throw Error(`permission probe returned no JSON response`);let t=te.safeParse(e.response);if(!t.success)throw t.error;return t.data}function Dt(e,t){let{expiresAt:n,expiresInDay:r}=wt(e,t);return n!==null&&r!==null&&new Date(n).getTime()<=Date.now()?` (cached expiry passed ${Math.abs(r)}d ago; \`auth status\` re-checks it with aVenture sign-in)`:``}var Ot=864e5;function kt(e){if(e===null)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:Math.round((t-Date.now())/Ot)}var At=7;function jt(e){return e===null?`none`:e.length<=11?e:`${e.slice(0,At)}\u2026${e.slice(-4)}`}var Mt=13,Nt=14;function Pt(e){return[``,`${e.cliName} ${e.cliVersion} \u2192 ${e.apiKey.host}`+(e.apiVersion===null?` (api build unavailable)`:` (api ${e.apiVersion})`),``,...It(e.oauth,e.cliName,e.refresh),...Rt(e.apiKey,e.oauth,e.cliName),``,q(`Providers`,Vt(e.providers)),q(`Environment`,Ht(e.resolved)),q(`Selected`,Ut(e.resolved,e.refresh,e.cliName)),...Ft(e.live)].join(`
8
- `)}function Ft(e){if(e===null)return[];let t=J(`local credential provenance was captured before verification`);if(e.error!==null)return[``,q(`Live probe`,`${e.scope} permission probe failed`),t,J(e.error)];if(e.authorization===null)return[];let n=e.authorization.permissionGrant,r=e.identity;return[``,q(`Live probe`,`${e.scope} permission probe succeeded`),t,J(`operation access ${e.authorization.operationAccess}; ${n.role.length} role; ${n.permission.length} permission`),...r===null?[J(e.scope===`read`?`identity not requested for a read-scope credential`:`identity unavailable in this build`)]:[q(`Live account`,r.nameFull??r.email??r.clerkUserId??r.id)],J(`no API operation was executed or individually authorized`)]}function q(e,t){return` ${e.padEnd(Mt)}${t}`}function J(e){return` ${``.padEnd(Mt)}${e}`}function It(e,t,n){switch(e.state){case`found`:{let{credential:r,provider:i}=e.stored,a=pe(r);return[q(`OAuth`,`${a.email??a.subject??`unknown identity`} via ${i}`),J(Lt(r,t,n))]}case`missing`:return[q(`OAuth`,`none stored`),...e.keyringFailure===void 0?[]:[J(`OS keyring unusable — login stores to file: ${e.keyringFailure}`)]];case`unavailable`:return[q(`OAuth`,`storage unavailable: ${e.summary}`)];case`invalid`:return[q(`OAuth`,`stored credential invalid: ${e.summary}`)];default:throw Error(`Unsupported OAuth credential state`)}}function Lt(e,t,n){return E(e)?e.tokens.refresh_token===void 0?`access token expired — run \`${t} auth login\``:n.failure===null?n.materialized===`api-key`?`access token expired and renewal failed; the API key is in use — \`${t} auth login\` renews OAuth`:`access token expired — not renewed while AUTH_TOKEN is set in the environment`:`access token expired — ${n.failure}`:`access token valid until ${e.expiresAt}`}function Rt(e,t,n){if(!e.present){if(t.state===`found`)return[];let r=e.storageFailure??(t.state===`unavailable`?t.summary:null);return r===null?[q(`Signed in`,`no \u2014 run \`${n} auth login\``),...e.error===null?[]:[J(`stored credential invalid: ${e.error}`)]]:[q(`Signed in`,`credential storage unavailable`),J(r)]}return[q(t.state===`found`?`API key`:`Signed in`,e.subject??`unknown subject`),J(`via ${e.provider??`unknown store`}`),q(`Key`,`${e.name??`unnamed`} ${jt(e.apiKeyId)}`),...zt(e,n),q(`Scopes`,e.scope.length===0?`none`:e.scope.join(`, `))]}function zt(e,t){let n=e.live,r=e.expiresInDay,i=e.expiresAt;if(n?.state===`invalid`)return[q(`Key state`,`rejected by aVenture sign-in \u2014 ${n.summary}`),J(`run \`${t} auth logout\`, then \`${t} auth login --key\``)];let a=n?.state===`verified`;return[q(`Key state`,a?`${e.status??`unknown`}, verified by aVenture sign-in now`:`${e.status??`unknown`} when stored`),...i===null||r===null?[J(`no expiry recorded`)]:[J(Bt(i,r,a?`expires`:`cached expiry`))],...a?[]:[J(n===null?"aVenture sign-in owns the live verdict — `auth status` re-checks it":`aVenture sign-in could not be reached \u2014 ${n.summary}`)]]}function Bt(e,t,n){let r=e.slice(0,10);return new Date(e).getTime()<=Date.now()?`${n} ${r} passed ${Math.abs(t)}d ago`:t<=Nt?`${n} ${r}, ${t}d away`:`${n} ${r}`}function Vt(e){if(e.state===`unavailable`)return`unavailable: ${e.summary}`;let t=e.catalog.oauthClient;return[e.catalog.clerkPublishableKey?`browser sign-in`:`no browser sign-in`,t?`oauth ${he(t).host} client ${t.clientId}`:`no OAuth CLI client`].join(`; `)}function Ht(e){return`${t.authToken}=${e.present?e.source??`resolved`:`unset`}`}function Ut(e,n,r){return e.present||n.materialized===`env`?`${t.authToken} from the environment`:n.materialized===`oauth`?`saved OAuth access token`:n.materialized===`api-key`?`saved API key`:`none \u2014 sign in with \`${r} auth login\``}var Wt=[{name:`cli-version`,purpose:`running CLI against the latest published release`},{name:`api-schemas`,purpose:`the installed @aventurevc/api-schemas contracts resolve`},{name:`api-host`,purpose:`the selected API host answers`},{name:`auth`,purpose:`which credential signs in, as which account and role, never secrets`},{name:`catalog`,purpose:`this CLI knows every operation the API serves`}];function Gt(e,t=m().bin[0]){k(e.command(`doctor`).summary(`One-call selftest: CLI version, schemas, API host, auth scope, command catalog`).description(["Run every environment check in one call and report `{ ok, check: [...] }`:",...Wt.map(e=>` - ${e.name}: ${e.purpose}`),``,`Exit code is 0 only when no check failed; a skipped check (no registry reachable) or a`,`warned one (the account read failed) does not fail the run. Each failing message names the command that fixes it.`,"--json always carries the report at `.data`; --data prints the report directly when",`every check passes and the result envelope when one fails, like every other command.`].join(`
9
- `))).action(async function(e){let n=this.optsWithGlobals();n.environment!==void 0&&(process.env.API_ENV=n.environment),D({mode:O(e)},await Kt(t))})}async function Kt(e){let t=qt(),n=Jt(e),[r,i]=await Promise.all([Yt(e),Xt(t,e)]),a=[n.check,r,i.check,await Qt(e),on(t,i.servedFingerprint,n.upgradeAvailable,e)],o={pass:Y(a,`pass`),warn:Y(a,`warn`),fail:Y(a,`fail`),skip:Y(a,`skip`)},s=a.filter(e=>e.status===`fail`).map(e=>e.message),c={ok:s.length===0,check:a},l=[`doctor: ${o.pass} pass, ${o.warn} warn, ${o.fail} fail, ${o.skip} skip`,...a.map(e=>` ${e.name} ${e.status} — ${e.message}`)].join(`
10
- `);return c.ok?f(l,c,{counts:o}):{...p(l,s,{counts:o}),data:c}}function Y(e,t){return e.filter(e=>e.status===t).length}function X(e,t,n){return{name:e,status:t,message:n}}function qt(){return Te.find(e=>e.intent===`status`&&e.resource===`status`)}function Jt(e){let t=m(),n=Ee(t,`check`);if(!n.ok||n.data===null)return{check:X(`cli-version`,`skip`,`Could not compare ${t.version} against the registry (${n.summary}); rerun \`${e} update\` with registry access.`),upgradeAvailable:null};let{targetPackage:r,currentVersion:i,latestVersion:a,upgradeAvailable:o}=n.data;return{check:o?X(`cli-version`,`fail`,`Upgrade ${r} from ${i} to ${a}: run \`${e} update\`.`):X(`cli-version`,`pass`,`${r} ${i} matches the latest published release.`),upgradeAvailable:o}}async function Yt(e){try{let{EntityDetailSchema:e}=await import(`./detail-D8sJIA5S.js`);if(typeof e.safeParse!=`function`)throw Error(`EntityDetailSchema does not expose a Zod parser`);return X(`api-schemas`,`pass`,`Installed @aventurevc/api-schemas contracts resolve beyond the CLI startup path.`)}catch(t){return X(`api-schemas`,`fail`,`Reinstall the CLI: run \`${e} update\` — ${w(t)}.`)}}async function Xt(e,t){let n=e??{method:`GET`,path:`/info`,auth:`none`},i;try{i=r().host}catch(e){return{check:X(`api-host`,`fail`,`Correct API_ENV or pass \`--environment <name>\` — ${w(e)}.`),servedFingerprint:null}}let a=await _({method:n.method,path:n.path,auth:n.auth,responseFormat:`json`}).catch(e=>p(w(e)));return a.ok?{check:X(`api-host`,`pass`,`${n.method} ${n.path} answered at ${i}.`),servedFingerprint:e===void 0?null:Zt(a.data)}:{check:X(`api-host`,`fail`,a.httpStatus===401?`Replace or unset the credential ${i} rejected, or run \`${t} auth login\`, then rerun \`${t} auth doctor\` — ${n.method} ${n.path} returned ${a.summary}.`:`Point the CLI at a reachable API host with \`--environment <name>\` or API_URL, then rerun \`${t} auth doctor\` — ${n.method} ${n.path} at ${i} returned ${a.summary}.`),servedFingerprint:null}}function Zt(e){if(typeof e!=`object`||!e||e instanceof Uint8Array)return null;let{response:t}=e;if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=t.operationFingerprint;return typeof n==`string`&&n.length>0?n:null}async function Qt(e){let n=ne(),[r,i]=await Promise.all([en(),tn()]);if(i.state===`unavailable`&&i.cause===`environment`)return X(`auth`,`fail`,`Fix the environment configuration first — ${i.summary}.`);let a=n.present,o=i.state===`found`&&i.stored.activation===`active`;if(!a&&r.state===`invalid`)return X(`auth`,`fail`,`Saved OAuth credential is invalid; run \`${e} auth login\` to sign in again after verification — ${r.summary}.`);if(!a&&r.state===`found`&&E(r.stored.credential)&&r.stored.credential.tokens.refresh_token===void 0)return X(`auth`,`fail`,`Saved OAuth access token is expired without a refresh token; run \`${e} auth login\` to sign in again.`);if(!a&&!o&&r.state===`unavailable`)return X(`auth`,`fail`,`Make the OS keyring or the CLI config directory usable before \`${e} auth login\`, or inject ${t.authToken} through the environment — ${r.summary}.`);if(a||r.state===`found`||o){let t=await $t(e,n);return X(`auth`,t.status,`Credential source available: ${nn(n,r,i)}; ${t.text}.`)}return i.state===`unavailable`?X(`auth`,`fail`,`Make the OS keyring or the CLI config directory usable before \`${e} auth login --key\`, or inject ${t.authToken} through the environment — ${i.summary}.`):X(`auth`,`fail`,`Run \`${e} auth login\` for OAuth or \`${e} auth login --key\` for an API key. For non-interactive use, set ${t.authToken} in the environment.`)}async function $t(e,t){let n=T(r().host),i=await yt(e),a=`credential=${t.present?t.source??`env`:i.materialized??`none`}`;try{if(i.failure!==null)throw Error(i.failure);let e=await vt(`write`);if(e===null)return{status:`pass`,text:`${a} host=${n}`};let t=e.rbacRole.length===0?`none`:e.rbacRole.join(`,`);return{status:`pass`,text:`${a} account=${e.email??e.id} role=${t} host=${n}`}}catch(t){return{status:`warn`,text:`${a} account=unread host=${n} — GET /v1/auth/me returned ${w(t,[r().userBearerToken])}; run \`${e} auth status --verify write\``}}}async function en(){let e;try{e=T(r().host)}catch(e){return{state:`unavailable`,summary:w(e)}}return await ve(e)}async function tn(){let e;try{e=T(r().host)}catch(e){return{state:`unavailable`,summary:w(e),cause:`environment`}}try{return await se(e)}catch(e){return{state:`unavailable`,summary:w(e),cause:`storage`}}}function nn(e,t,n){return[Ht(e),`oauth=${an(t)}`,`api-key=${rn(n)}`].join(` `)}function rn(e){if(e.state!==`found`)return e.state===`missing`?`unset`:`unavailable`;let t=T(r().host);return`${e.stored.activation}${Dt(t,e)}`}function an(e){switch(e.state){case`found`:return E(e.stored.credential)?`expired`:`stored`;case`missing`:return`unset`;case`invalid`:return`invalid`;case`unavailable`:return`unavailable`;default:throw Error(`Unsupported OAuth credential state`)}}function on(e,t,n,r){let i=Te.length;if(e===void 0)return X(`catalog`,`skip`,`The public catalog omits deployment-status metadata and holds ${i} operations.`);if(t===null)return X(`catalog`,`skip`,`Could not read the served operation fingerprint, so drift is unproven; this catalog holds ${i} operations at ${we}.`);if(t===`0a6436a6f0feb034`)return X(`catalog`,`pass`,`${i} generated operations match the set the API serves (${we}).`);let a=`This catalog describes a different operation set than the API serves (${we} vs ${t})`;return n===!0?X(`catalog`,`fail`,`${a}: run \`${r} update\`.`):X(`catalog`,`skip`,n===!1?`${a}, and this CLI is already the latest published release: either the deployed API is older than this CLI, or a newer CLI has not been published yet.`:`${a}, and the registry did not answer, so it is unknown whether a newer release describes it: rerun \`${r} update\` with registry access.`)}var Z=b(N,`oauth`),sn=[b(N,`start`),b(N,`poll`),b(N,`acknowledge`)],Q=b(N,`revoke`);function cn(n,r=m().bin[0]){let i=fn(n);Gt(i,r);let a=[`${Z.description} Default method: OAuth in your browser.`,`With --key: ${sn.map(({description:e})=>e).join(` `)}`].join(`
11
- `);k(dn(i,[Z,...sn],a)).action(ln),k(dn(i,[Q],Q.description)).action(un),k(i.command(`status`).summary(`Keep saved credentials current and report them`).description(`Runs the same credential materialization every command runs, then reports:
12
- - auth: whether AUTH_TOKEN was already set in this shell's environment
13
- - oauth: the saved OAuth identity and access-token expiry for the selected API host;
14
- an expired token is renewed with its refresh token and a token the sign-in service rejects is retired
15
- - api-key: the saved aVenture API key, re-verified with aVenture sign-in and its cached metadata updated
16
- - selected: the credential the next command sends
17
- - providers: GET /v1/auth/providers (browser sign-in and the CLI OAuth client)
18
- - api: running CLI package version plus GET /info build metadata
19
-
20
- Saved credentials are sent only to the selected API host and aVenture sign-in, never printed.
21
- --verify read|write additionally runs a live permission probe for that scope; it does not
22
- execute or authorize an arbitrary API operation.`).addOption(new e(`--verify <scope>`,`verify one permission-probe scope`).choices([`read`,`write`]))).action(async function(e){$(this),D({mode:O(e)},await pn(r,e.verify))}),i.command(`token`).summary(`Print the bearer token the next command sends`).description([`Runs the same credential materialization every command runs, then prints the selected`,`bearer token alone on stdout: ${t.authToken} when set, otherwise the saved OAuth`,`access token (renewed when expired) or the saved aVenture API key.`,`Use it where another client needs this CLI's sign-in, such as an MCP client's header helper.`].join(`
23
- `)).action(async function(){$(this);let e=await yt(r),n=process.env[t.authToken]?.trim();e.failure===null&&n!==void 0&&n.length>0?process.stdout.write(`${n}\n`):D({mode:`text`},e.failure===null?xn(`auth token: no credentials resolved`,null,r,{oauth:!0,apiKey:!0}):p(`auth token: ${e.failure}`))})}async function ln(e){$(this);let t=O(e);e.providers===!0?D({mode:t},await hn()):D({mode:t},e.key===!0?await ut({noBrowser:!e.browser,clientLabel:e.clientLabel}):await Se({noBrowser:!e.browser}))}async function un(e){$(this),D({mode:O(e)},await tt({forgetLocal:e.forgetLocal===!0}))}function dn(e,t,n){let[r]=t,i=e.command(r.command.slice(r.command.indexOf(` `)+1)).summary(r.summary).description(n),a=new Set;for(let e of t)for(let t of[...e.bodyOption,...e.localOption])a.has(t.flag)||(a.add(t.flag),`required`in t&&t.required?i.requiredOption(t.flag,t.description):i.option(t.flag,t.description));return i}function fn(e){return(e.commands.find(e=>e.name()===`auth`)??e.command(`auth`)).summary(`Sign in, sign out, and check credentials`).description([`\`${Z.command}\`: ${Z.summary}; \`--key\` ${sn[0].summary.toLowerCase()}.`,`\`${Q.command}\`: ${Q.summary}.`,"`auth status` reports local credential provenance, sign-in providers, and CLI/API build metadata.","`auth doctor` runs the one-call selftest and prints `{ ok, check: [...] }`.","`auth token` prints the bearer token the next command sends."].join(`
24
- `))}function $(e){let t=e.optsWithGlobals();t.environment!==void 0&&(process.env.API_ENV=t.environment)}async function pn(e,n){let i;try{i=T(r().host)}catch(e){return p(`auth status: invalid API host — ${w(e)}`)}let a=ne(),o=yt(e),[s,c]=await Promise.all([bn(`/info`,`GET /info`),gn()]),l=await o,[u,d]=await Promise.all([ve(i),mn(i)]),h=n===void 0?null:await bt(n,u,d.inspection,l),g=m().version,_=wt(i,d.inspection,d.verification),v=Pt({cliName:e,cliVersion:g,apiVersion:s.ok?vn(s.data):null,oauth:u,apiKey:_,providers:c,resolved:a,refresh:l,live:h}),y={cli:{version:g},api:s.ok?s.data??null:null,auth:{[t.authToken]:a},selected:l.materialized,oauth:Tt(i,u),apiKey:_,providers:c,live:h,...s.ok?{}:{apiError:s.summary}};return l.failure===null?!s.ok&&s.httpStatus===401?{...p(`auth status: the API rejected the selected credential (401) | ${v}`,[`Replace or unset ${t.authToken}, or run \`${e} auth login\`.`]),data:y}:h!==null&&h.error!==null?{...p(`auth status: ${h.scope} permission probe failed — ${h.error}`,[h.error]),data:y}:h!==null||a.present||u.state===`found`||d.inspection.state===`found`?f(v,y):xn(`auth status: no credentials resolved | ${v}`,y,e,{oauth:u.state===`missing`,apiKey:d.inspection.state===`missing`}):{...p(`auth status: ${l.failure} | ${v}`,[l.failure]),data:y}}async function mn(e){let t=await _n(e);if(t.state!==`found`)return{inspection:t,verification:null};let{stored:n,verification:r}=await et(t.stored);return{inspection:{state:`found`,stored:n},verification:r}}async function hn(){let e=await gn();return e.state===`found`?f(`Sign-in providers for the selected API host`,e.catalog):p(`auth login --providers: ${e.summary}`)}async function gn(){try{return{state:`found`,catalog:await xe()}}catch(e){return{state:`unavailable`,summary:w(e)}}}async function _n(e){try{return await se(e)}catch(e){return{state:`invalid`,summary:w(e)}}}function vn(e){if(!yn(e))return null;let t=Pe.safeParse(Reflect.get(e,`response`));if(!t.success)return null;let n=t.data.build.version?.trim();return n&&n.length>0?n:null}function yn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function bn(e,t){return await _({method:`GET`,path:e,auth:`none`,responseFormat:`json`}).catch(e=>p(`${t} failed: ${e instanceof Error?e.message:String(e)}`))}function xn(e,r,i,a){return{...p(e,[...a.apiKey?[`For an API key (works over SSH), run \`${i} auth login --key\`.`]:[],...a.oauth?[`For OAuth, run \`${i} auth login\`; without a browser it prints a device code.`]:[],`For non-interactive use, set ${t.authToken} to an aVenture API key (create one at ${n}/settings/api-keys).`]),data:r}}export{cn as registerBuiltinAuthCommands};
@@ -1 +0,0 @@
1
- import{O as e,i as t,l as n,o as r,p as i,u as a,w as o,y as s}from"./person-owner-C0YuWKvY.js";import{c,f as l,r as u}from"./result-envelope-5R2VEWAg.js";import"./package-CZBWjlYb.js";import{l as d}from"./response-problem-BGEYFwd5.js";import{a as f,m as p,p as m,r as h}from"./openapi-call-Cu_IqRxU.js";import{T as g}from"./detail-BTjlqGmV.js";import{t as _}from"./output-BCOtzmsw.js";import{i as v,t as y}from"./output-mode-DYvJUCAE.js";import"./operations-metadata-r3glpbEg.js";import"node:fs";import{setTimeout as b}from"node:timers/promises";import"node:crypto";var x=r([`UNTRACKED`,`PENDING`,`SETTLED`,`REJECTED`]),S=s({admission:x,hasMore:a(),runId:n(e())}),C=s({complete:a(),entitySlug:o().regex(/^[a-z0-9_-]+$/).max(255).nullable(),gateRemaining:n(o()),note:o().nullish(),whatElseRemaining:n(o()),writeThisIteration:n(o())}),w=r([`COMPREHENSIVE`,`INDIVIDUAL`]),T=r([`claude-agent-sdk`,`pi-agent-sdk`]),E=r([`anthropic`,`openai-chat`,`openai-responses`]),D=r([`unassigned`,`development`,`staging`,`production`]),O=r([`interactive`,`background`]),k=r([`queued`,`running`,`completed`,`failed`,`stopped`]),A=r([`ENRICHMENT`,`TASK`]),j=s({attempt:i(),chassis:T,chassisRouted:a(),createdAt:t({offset:!0}),entitySlug:o().nullish(),environment:D,error:o().nullish(),failureClass:o().nullish(),finishedAt:t({offset:!0}).nullish(),followUpAdmission:x.optional(),hasSourceDocument:a(),id:e(),iteration:i(),lane:O,latestStatus:o().nullish(),llmApi:E,maxIteration:i(),maxScoutConcurrent:i(),mode:w,model:o(),nextAttemptAt:t({offset:!0}).nullish(),researchAllowanceType:l.nullish(),resumeSafeUntil:t({offset:!0}).nullish(),startedAt:t({offset:!0}).nullish(),status:k,subagentModel:o(),taskPresetKey:n(o()).nullish(),type:A,updatedAt:t({offset:!0}),url:o(),userPrompt:o().nullish()}),M=s({entity:g.nullish(),followUp:S.optional(),lastEventAt:t({offset:!0}).nullish(),latestStatus:C.nullish(),provider:g.nullish(),publicUrl:o().nullish(),run:j});function N(e,t,n,r){let i=Number(t);return!Number.isInteger(i)||i<n||i>r?u(`${e} must be an integer between ${n} and ${r}, got "${t}"`):c(`${e} parsed`,i)}async function P(){return{costUsd:null}}var F=5e3,I=6e4,L=3e4,R=86400;function z(e){let t=e.commands.find(e=>e.name()===`research-runs`);if(t===void 0)return;let n=t.command(`wait`).summary(`Wait for one research run to finish, then report its outcome`).description("Polls `research-runs get` with backoff until the run is completed, failed, or stopped, then prints its status, error, failure class, spend, and last event time; a timeout reports the last event time so a stalled run shows. Exits nonzero when the run failed or stopped, or when --timeout passes first.").requiredOption(`--run-id <uuid>`,`Research run id`).option(`--timeout <seconds>`,`Total seconds to wait`,`1800`);y(n),n.action(async function(){let e=this.optsWithGlobals();_({mode:v(e)},await B(e))})}async function B(e){let t=N(`--timeout`,e.timeout,1,R);if(!t.ok||t.data===null)return u(t.summary);let n=Date.now()+t.data*1e3,r=h(`getResearchRun`,{runId:e.runId}),i=F,a=`not read yet`;for(;;){let o=0,s=await H(r,n);if(s.kind===`refused`)return s.envelope;if(s.kind===`detail`){let{run:e}=s.detail;if(e.status===`completed`||e.status===`failed`||e.status===`stopped`)return await V(s.detail);a=`${e.status}, last event ${s.detail.lastEventAt??`none`}`}else a=`unread (${s.reason})`,o=(s.retryAfterSeconds??0)*1e3;let c=n-Date.now();if(c<=0||o>=c){let n=c<=0?`after ${t.data}s`:`and the API asks for ${o/1e3}s, past the ${t.data}s --timeout`;return u(`Run ${e.runId} is still ${a} ${n}`,[`Wait longer with --timeout, or read it with \`research-runs get --run-id ${e.runId}\`.`])}let l=Math.max(o,F+Math.random()*(i-F));await b(Math.min(l,c)),i=Math.min(i*2,I)}}async function V(e){let{run:t}=e,n=await P(t.id),r={runId:t.id,status:t.status,error:t.error??null,failureClass:t.failureClass??null,publicUrl:e.publicUrl??null,finishedAt:t.finishedAt??null,lastEventAt:e.lastEventAt??null,...n.costUsd===null?{}:{costUsd:n.costUsd}},i={warnings:n.warning===void 0?[]:[n.warning]},a=n.costUsd===null?``:`; spend $${n.costUsd.toFixed(4)}`;if(t.status===`completed`)return c(`Run ${t.id} completed${a}`,r,i);let o=t.failureClass?` (${t.failureClass})`:``,s=t.error?`: ${t.error}`:``;return{...c(`Run ${t.id} ${t.status}${o}${a}${s}`,r,i),ok:!1}}async function H(e,t){let n;try{n=await f({method:`GET`,path:e,auth:`auto`,responseFormat:`json`,signal:AbortSignal.timeout(Math.max(1e3,Math.min(L,t-Date.now())))})}catch(e){if(p(e))return{kind:`transient`,reason:String(e)};throw e}if(!n.ok){let{problem:t}=n;if(t!==void 0&&m(t.status,t)){let e=d(t.retryAfterSeconds);return{kind:`transient`,reason:n.summary,...e===void 0?{}:{retryAfterSeconds:e}}}return{kind:`refused`,envelope:u(`GET ${e} failed: ${n.summary}`,n.warnings,{problem:t})}}let r=n.data,i=M.safeParse(typeof r==`object`&&r&&`response`in r?r.response:void 0);return i.success?{kind:`detail`,detail:i.data}:{kind:`refused`,envelope:u(`${e} returned an unexpected body: ${i.error.message}`)}}export{z as registerBuiltinResearchRunWaitCommand};
@@ -1,3 +0,0 @@
1
- import{c as e,r as t}from"./result-envelope-5R2VEWAg.js";import{a as n,n as r,r as i,t as a}from"./package-CZBWjlYb.js";import{t as o}from"./output-BCOtzmsw.js";import{i as s,t as c}from"./output-mode-DYvJUCAE.js";import{t as l}from"./completion-setup-CwJt88xW.js";import{spawnSync as u}from"node:child_process";import{basename as d,dirname as f,relative as p,resolve as m,sep as h}from"node:path";import{existsSync as g,lstatSync as _,mkdirSync as v,mkdtempSync as y,readdirSync as b,readlinkSync as x,realpathSync as S,renameSync as C,symlinkSync as w}from"node:fs";import{randomUUID as T}from"node:crypto";var E=new Intl.Collator(void 0,{numeric:!0}),D=2e4,O=[`lib`,`aventurevc-releases`];function k(e,t=n()){let r=t.registry===``?`Requires npm authentication for @aventurevc packages.`:`Installs from npm.`;c(e.command(`update`).summary(`Check for or install the latest release`).description([`Compare the running CLI version against the latest published`,`release and install it into the active published bin prefix.`,``,`Refuses to install when the running binary is the working-tree build`,`(rebuild that checkout instead). ${r}`,`--execute is deprecated, accepted, and ignored; update executes by its verb.`].join(`
2
- `)).option(`--execute`,`Deprecated; accepted and ignored. This command executes by its verb.`,!1).option(`--release <version>`,`Install and activate exactly this version, not the latest.`)).action(e=>o({mode:s(e)},A(void 0,`apply`,e.release)))}function A(a,o=`apply`,s){let c=a;try{c??=n(process.argv[1])}catch(e){return t(e instanceof Error?e.message:String(e),[`invalid_package_metadata`])}let l=c.name,u=c.version,f=c.registry===``?``:r,p=c.registry===``&&l===`@aventurevc/aventure-cli`,h=s;if(h===void 0){let e=j([`view`,f,`version`,`--silent`,`--global`],c,{timeout:D});if(!e.ok)return{...e,data:null};if(h=(e.data??``).trim(),h===``)return t(`npm view ${f} returned empty version`,[`empty_stdout`])}let _=s!==void 0||p||E.compare(u,h)<0,x={targetPackage:f,runningPackage:l,currentVersion:u,latestVersion:h,upgradeAvailable:_,upgradeInstalled:!1};if(o===`check`)return e(`${l}@${u} → ${f}@${h} (${_?`available`:`up to date`})`,x);if(c.workingTreeRoot!==null)return t(`Refusing to install over the working-tree build at ${c.workingTreeRoot}; rebuild via make instead`,["running CLI is npm-linked from the back-end checkout — `update` is for published bins"]);try{let t=P(c),n=m(t,...O),r=d(f),a=m(n,`${r}-current`),o=f===``?[f,``]:[f,i],l=F(t,c),p=s??[h,l?.version??u].reduce((e,t)=>E.compare(e,t)<0?t:e,u);v(n,{recursive:!0});let _=[N(c),...g(a)?[S(a)]:[],...b(n,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>m(n,e.name))],C,w=null,T=!1;for(let e of new Set(_.filter(e=>e!==t))){let t=M(e,o,p,c.registry);if(t.ok&&t.data!==null){C=e,w=t.data;break}}if(C===void 0){C=y(m(n,`${r}-${encodeURIComponent(p)}-`));let e=j([`install`,`-g`,`--prefix`,C,...o.map(e=>`${e}@${p}`)],c,{stdio:[`ignore`,`inherit`,`inherit`]});if(!e.ok)return{...e,data:null};T=!0;let t=M(C,o,p,c.registry);if(!t.ok)return{...t,data:null};w=t.data}if(w===null)throw Error(`release verification produced no package`);let D=I(C,t,a,w,s),k=R();return e(`${f} active at ${D}`,{...x,upgradeInstalled:T||s!==void 0||l?.version!==D,installPrefix:t,verifiedVersion:D,completionRefreshed:k.refreshed,completionRefreshMessage:k.message})}catch(e){return t(`${f} update failed: ${L(e)}`,[`existing releases were preserved`])}}function j(n,r,i={}){let a={...process.env};r.registry===``?a.NODE_AUTH_TOKEN??=a.GH_PACKAGES_TOKEN:delete a.GH_PACKAGES_TOKEN;let o=[...n,`--@aventurevc:registry=${r.registry}`],s=u(`npm`,o,{env:a,encoding:`utf8`,...i});if(s.error)return s.signal===`SIGTERM`&&i.timeout!==void 0?t(`npm ${n[0]??``} did not answer within ${i.timeout}ms`,[`timeout`]):t(`npm ${n[0]??``} failed to start: ${s.error.message}`,[`spawn_error`]);if(s.status!==0){let e=(s.stderr??``).trim().split(`
3
- `).slice(-3).join(` | `);return t(`npm ${n.join(` `)} exited ${s.status}`,[e||`no stderr`])}return e(`npm ok`,s.stdout??``)}function M(r,i,a,o){try{let t=i.map(e=>{let t=n(m(r,`lib`,`node_modules`,...e.split(`/`),`package.json`));if(t.name!==e||t.version!==a||t.registry!==o)throw Error(`${e} does not match ${a} from ${o}`);for(let e of t.bin)if(!S(m(r,`bin`,e)).startsWith(`${t.packageRoot}${h}`))throw Error(`${e} escapes ${t.packageRoot}`);return t});for(let e of t){let t=m(r,`bin`,e.bin[0]),n=u(process.execPath,[t,`--version`],{encoding:`utf8`,timeout:D});if(n.error)throw Error(`${e.name} verification failed: ${n.error.message}`);let i=(n.stdout??``).trim();if(n.status!==0||i!==a)throw Error(`${e.name} expected ${a} but reported ${i||`empty output`}`)}return e(`CLI and MCP release verified`,t)}catch(e){return t(`release verification failed: ${L(e)}`,[`release prefix: ${r}`])}}function N(e){let t=f(e.packageRoot),n=f(t),r=f(n);if(d(t)!==e.name.split(`/`)[0]||d(n)!==`node_modules`||d(r)!==`lib`)throw Error(`the running package is not in a verifiable global npm prefix; npm install was not run`);if(!e.entryPath.startsWith(`${e.packageRoot}${h}`))throw Error(`the running entry escapes its package root`);return f(r)}function P(e){let t=N(e),n=`${h}${O.join(h)}${h}`,r=t.lastIndexOf(n);return r<0?t:t.slice(0,r)}function F(e,t){let r=t.registry===``?d(``):a,i=m(e,`bin`,r);if(!g(i))return null;let o=n(i);if(o.registry!==t.registry)throw Error(`${i} belongs to another product`);return o}function I(e,t,r,i,a){let o=i[0];if(o===void 0)throw Error(`release contains no CLI`);let s=m(t,`bin`);v(s,{recursive:!0});let c=i.flatMap(e=>e.bin.filter((e,t)=>{let r=m(s,e);if(!g(r)||n(r).registry===o.registry)return!0;if(o.registry!==``&&t>0)return!1;throw Error(`${r} belongs to another product`)}));if(!g(r)){let t=y(m(f(r),`${d(r)}-seed-`));v(m(t,`bin`));for(let n of c){let r=m(s,n);w(S(g(r)?r:m(e,`bin`,n)),m(t,`bin`,n))}try{w(p(f(r),t),r)}catch(e){if(!(e instanceof Error&&`code`in e&&e.code===`EEXIST`))throw e}}if(!_(r).isSymbolicLink())throw Error(`${r} is not a release symlink`);for(let e of c){let t=p(s,m(r,`bin`,e)),n=m(s,`.${e}-${T()}`);w(t,n),C(n,m(s,e))}for(let e of c){let t=m(s,e);if(!_(t).isSymbolicLink()||m(s,x(t))!==m(r,`bin`,e))throw Error(`${t} does not follow the product current pointer`)}let l=F(t,o);if(a===void 0&&l!==null&&E.compare(l.version,o.version)>0)return l.version;let u=`${r}-${T()}`;return w(p(f(r),e),u),C(u,r),o.version}function L(e){return e instanceof Error?e.message:String(e)}function R(){try{return l()}catch(e){return{refreshed:!1,message:e instanceof Error?e.message:String(e)}}}export{A as n,k as t};
@@ -1 +0,0 @@
1
- export{t as registerBuiltinUpdateCommand}from"./builtin-update-5IL6qRqK.js";
@@ -1 +0,0 @@
1
- import{n as e}from"./commander-DEj7N1b9.js";import{o as t}from"./tool-policy-BPefkvzQ.js";import{C as n,w as r}from"./operation-invocation-C29yUZSq.js";import{a as i,o as a}from"./cli-help-policy-CEyg0zEz.js";function o(e){return e.toSorted((e,t)=>e.projection.cliPath.length-t.projection.cliPath.length||e.projection.cliPath.join(` `).localeCompare(t.projection.cliPath.join(` `))||e.operationId.localeCompare(t.operationId)).map(e=>{let t=e.parameter.flatMap(t=>{if(t.in!==`path`&&t.in!==`query`&&t.in!==`header`)return[];let n=t.in;return(t.in===`query`&&t.itemProperty!==void 0?t.itemProperty:[t]).map(t=>{let i=d(t,r(e,t),n);if(t.legacyName===void 0)return i;let a=d(t,r(e,t,t.legacyName),n).flag;return a===i.flag?i:Object.assign(i,{legacyFlag:a})})}),n=e.requestBody?.map(n=>{let r=l(e,t,n),i=c(n.cliConflicts,r),a=i.length===0?{}:{cliConflicts:i};return Object.assign({},n,{parameter:r},a)}),i=e.response.find(({status:e})=>e.startsWith(`2`)),a=i?.schemaName?.replace(/Schema$/,``);return{operationId:e.operationId,method:e.method,path:e.path,resource:e.resource,intent:e.intent,cliPath:e.projection.cliPath,summary:e.summary,description:e.description,binaryResponse:e.binaryResponse?!0:void 0,explain:e.explain?!0:void 0,deprecated:e.deprecated?!0:void 0,requestBody:n,mutationReadback:e.mutationReadback,scope:e.projection.scope,auth:e.projection.auth,visibility:e.projection.visibility,mutates:e.projection.mutates,errorResponse:e.errorResponse,successResponse:a,detailField:i?.detailField,parameters:t}})}function s(e,t){let[n,r]=e.filter(e=>e.role===t);if(n===void 0||r!==void 0)throw Error(`Generated composite CLI role '${t}' is incomplete`);return n}function c(e,t){let n=new Map(t.map(({name:e,optionKey:t})=>[e,t]));return(e??[]).map(e=>e.map(e=>{let t=n.get(e);if(t===void 0)throw Error(`x-aventure-cli-conflicts field '${e}' was removed from the generated CLI projection`);return t}))}function l(e,t,r){let i=new Set(t.map(e=>e.optionKey));(e.requestBody?.length??0)>1&&i.add(`contentType`);let a=new Set(t.filter(e=>e.location===`path`).map(e=>e.name));return r.parameter.toSorted((e,t)=>u(e.name)-u(t.name)).flatMap(t=>{if(!t.required&&(i.has(t.inputName)||a.has(t.name)))return[];let r=n(e,t,i);return i.add(r),[d(t,r,`body`)]})}function u(e){let t=e.split(`.`).at(-1);return t===`min`?0:t===`max`?1:2}function d(n,r,o){let s=n.itemSchemaEnum??n.schemaEnum,c=a(n.schemaType,n.itemSchemaType,n.schemaFormat,r),l=`${t(r)} ${n.schemaType===`boolean`?`[${c}]`:`<${c}>`}`;return{name:n.name,optionKey:new e(l).attributeName(),flag:l,required:n.required&&n.schemaDefault===void 0,description:i(n.description,s),schemaType:n.schemaType,schemaFormat:n.schemaFormat,itemSchemaType:n.itemSchemaType,defaultValue:f(n.schemaDefault),choices:s,...n.envName===void 0?{}:{envName:n.envName},...n.visibility&&{visibility:n.visibility},location:o}}var f=e=>Array.isArray(e)?e.map(String):typeof e==`number`?String(e):e;export{s as n,o as t};
@@ -1 +0,0 @@
1
- import{O as e,T as t,i as n,l as r,m as ee,n as i,o as a,p as o,r as s,t as c,u as l,v as u,w as d,y as f}from"./person-owner-C0YuWKvY.js";var te=a([`domicile`,`dominant`,`origin`]),ne=f({endDate:s().nullish(),id:o(),isCurrent:l(),role:te.nullish(),startDate:s().nullish()}),re=f({id:o().nullish(),name:d()}),ie=f({countryCodeChar2:d().nullish(),countryCodeChar3:d().nullish(),id:o().nullish(),name:d(),unRegion:d().nullish(),unSubregion:d().nullish()}),ae=f({id:o().nullish(),name:d(),stateAbbrev:d().nullish()}),p=f({address:o().nullish(),addressLine1:d().nullish(),addressLine2:d().nullish(),association:r(ne).optional(),city:re.nullish(),country:ie.nullish(),countryAbbrev:d().nullish(),createdAt:n({offset:!0}).nullish(),fullAddress:d().nullish(),id:o().nullish(),isCurrent:l().nullish(),isHq:l().nullish(),isPrimary:l().nullish(),latitude:u().nullish(),longitude:u().nullish(),postalCode:d().nullish(),state:ae.nullish(),stateAbbrev:d().nullish(),street:d().nullish(),updatedAt:n({offset:!0}).nullish()}),m=a([`editorial`,`standardized`]),h=Object.assign(t([m,d()]),{enum:m.enum}),oe=f({isCurrent:l().nullish(),isPrimary:l().nullish(),name:d().max(255),registry:h}),g=ee(oe,f({bucket:d().nullish(),classificationId:o().nullish(),createdAt:n({offset:!0}).nullish(),id:o(),isCurrent:l().nullish(),isPrimary:l().nullish(),name:d().max(255),slug:d().regex(/^[a-z0-9_-]+$/).max(255).nullish(),type:d(),updatedAt:n({offset:!0}).nullish()})),_=f({category:d(),classificationId:o().nullish(),code:o().nullish(),createdAt:n({offset:!0}).nullish(),id:o(),isCurrent:l().nullish(),isPrimary:l().nullish(),level:o().nullish(),name:d().max(255),registry:h,updatedAt:n({offset:!0}).nullish()}),se=f({geoLocationExposure:r(g).default([]).optional(),industry:r(g).default([]).optional(),mainProduct:r(g).default([]).optional(),standardizedClassification:r(_).default([]).optional(),tag:r(g).default([]).optional(),typeCustomer:r(g).default([]).optional(),typeModel:r(g).default([]).optional(),typeOwnership:r(g).default([]).optional(),typeRevenue:r(g).default([]).optional(),typeTechnologyUsed:r(g).default([]).optional()}),ce=a(`Angel.Pre-Seed.Seed.Series A.Series B.Series C.Series D.Series E.Series F.Series G.Series H.Series I.Series J.Series K.Series L.Series M.Series N.Series O.Series P.Series Q.Series R.Series S.Series T.Series U.Series V.Series W.Series X.Series Y.Series Z.Late Stage Private.Investment Firm.Fund.Nonprofit.Government.Public.Acquired.Acquired Subsidiary.Bankrupt`.split(`.`)),le=Object.assign(t([ce,d()]),{enum:ce.enum}),v=f({currency:d().nullish(),fundingRoundCount:o(),investorCount:o(),latestValuation:u().nullish(),mostRecentAmount:u().nullish(),mostRecentDate:s().nullish(),stage:le.nullish(),totalRaised:u(),totalRaisedUsd:u().nullish(),unconvertedRoundCount:o()}),y=f({expanded:d().nullish(),generatedDescription:d().nullish(),short:d().nullish()}),ue=a([`cloudflare`,`akamai`,`fastly`,`awsCloudfront`,`vercel`,`netlify`,`sucuri`,`incapsula`,`bunny`,`keycdn`,`cdn77`,`gcore`,`cdnetworks`,`azureCdn`,`leaseweb`,`digitalocean`,`stackpath`,`googlecloudCdn`,`none`,`unknown`]),de=a([`static`,`jsRequired`,`jsEnhanced`]),b=d(),x=f({crawlCdnProvider:ue.nullish(),crawlRenderMode:de.nullish(),createdAt:n({offset:!0}).nullish(),id:o().nullish(),isCurrent:l().nullish(),isPrimary:l().nullish(),owner:c.nullish(),sourceId:d().nullish(),status:d().nullish(),statusChecked:n({offset:!0}).nullish(),updatedAt:n({offset:!0}).nullish(),url:d(),urlType:b}),S=f({address:r(p),classification:se,fundingDetail:v.nullish(),headquartersAddressId:o().nullish(),headquartersRemoteAsOf:n({offset:!0}).nullish(),text:y,urlLink:r(x)}),C=f({isMonogram:l(),logo:d().nullish(),logoSquare:d().nullish()}),fe=a([`alternativeDba`,`relatedLegal`]),pe=f({displayable:l().nullish(),name:d(),type:fe.nullish()}),w=f({hasAcquisitions:l().default(!1).optional(),hasAnalysis:l(),hasEmployees:l(),hasFundraising:l(),hasNews:l(),productServiceSlug:r(d())}),T=f({defaultCurrency:d().nullish(),foundedYear:o().nullish(),id:e(),image:C,lastModifiedAt:n({offset:!0}).nullish(),nameAlias:r(pe),nameBrand:d(),nameLegal:d().nullish(),operatingStatus:d().nullish(),publicId:d().regex(/^e[0-9A-Za-z]{11}$/).nullish(),publicUrl:d().nullish(),sitemap:w.nullish(),slug:d().regex(/^[a-z0-9_-]+$/).max(255),typeRecord:i,updatedAt:n({offset:!0}).nullish()}),E=a([`SAFE`,`Convertible Note`,`Preferred Stock`,`Common Stock`,`Other Equity`,`Bond`,`Loan`,`Other Debt`,`Grant`,`Token`]),D=f({amountInvested:u().nullish(),createdAt:n({offset:!0}),financialInstrumentType:E.nullish(),id:e(),investor:c,investorName:d().nullish(),investorSlug:d().regex(/^[a-z0-9_-]+$/).max(255).nullish(),leadInvestor:l(),transactionId:e(),updatedAt:n({offset:!0})}),O=f({core:T,fundingDetail:v.nullish()}),k=f({lastFetchedAt:n({offset:!0}).nullish(),publishedAt:n({offset:!0}).nullish(),recordedAt:n({offset:!0}),sourceDetail:d()}),A=a([`High`,`Medium`,`Low`,`Verified`]),me=a([`direct`,`managedFund`]),j=f({round:d()}),M=f({amountInvested:u().nullish(),attributionType:me,beneficialEntityId:e().nullish(),fundManagerRelationshipId:o().nullish(),joinId:e(),leadInvestor:l(),recordedEntityId:e().nullish(),round:j.nullish(),transactionId:e()}),N=f({amountRaised:u().int().nullish(),createdAt:n({offset:!0}).nullish(),currency:d().nullish(),dataConfidence:A.nullish(),dateAnnounced:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),dateFundingComplete:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),dateInvestorExit:n({offset:!0}).nullish(),entity:O.nullish(),financialInstrumentType:E.nullish(),id:e(),investor:r(D).nullish(),investorAttribution:M.nullish(),investorCount:o().nullish(),publicSource:k.nullish(),round:d().nullish(),roundType:d().nullish(),sourceAttribution:r(M),updatedAt:n({offset:!0}).nullish(),valuationPostMoney:u().int().nullish(),valuationPreMoney:u().int().nullish()}),P=f({entity:T,headquarters:p.nullish(),relationshipType:a([`fundManagerFirm`,`productService`])}),he=f({fundingStage:le.nullish(),ownership:r(d()),pricingModel:r(d()),sellsTo:r(d()),totalRaised:u().nullish(),website:d().nullish()}),F=f({asOf:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),comparisonSignals:he.nullish(),createdAt:n({offset:!0}).nullish(),detail:d().nullish(),entity:T,id:o().nullish(),isCurrent:l().nullish(),isPrimary:l().nullish(),publicSource:k.nullish(),get relationship(){return r(F)},relationshipType:d(),sourceEntityId:e().nullish(),targetEntityId:e().nullish(),updatedAt:n({offset:!0}).nullish()}),I=F,L=f({accelerator:T,acceleratorName:d(),asOfDate:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/),batch:d().nullish(),id:d(),program:d().nullish(),status:d().nullish()}),R=a([`text`,`numeric`,`monetary`,`percentage`,`date`]),ge=a([`pastDue`,`withinThreeMonths`,`threeToSixMonths`,`sixToTwelveMonths`,`twelveToTwentyFourMonths`,`beyondTwoYears`]),_e=f({asOfDate:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/),bucket:ge,monthsFromNow:o(),targetDate:n({offset:!0})}),z=f({asOfDate:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),currentEligible:l().nullish(),derivedRange:_e.nullish(),discreteValue:u().nullish(),entityId:e(),id:o(),publicSource:k.nullish(),textValue:d().nullish(),typeResearchDetail:d(),updatedAt:n({offset:!0}).nullish(),valueResearchDetail:d().nullish(),valueType:R}),B=f({characterCount:o(),meetsRequirements:l(),violation:r(d()),wordCount:o()}),V=f({compliance:B.nullish(),entityId:e(),id:o(),publicSource:k.nullish(),text:d(),textType:d(),updatedAt:n({offset:!0}).nullish()}),ve=f({acceleratorParticipation:r(L),detail:r(z),snippet:r(V)}),H=f({author:d().nullish(),category:d().nullish(),createdAt:n({offset:!0}).nullish(),excerpt:d().nullish(),externalNewsArticle:l().nullish(),id:o(),newsImageThumbnail:d().nullish(),newsUrlOriginal:d().nullish(),publication:d().nullish(),publishedAt:n({offset:!0}).nullish(),slug:d().regex(/^[a-z0-9_-]+$/).max(255).nullish(),title:d(),updatedAt:n({offset:!0}).nullish()}),ye=a([`aventureBlog`,`personalBlog`,`employerBlog`,`linkedin`,`xTwitter`,`medium`,`substack`,`other`]),U=f({author:d().nullish(),createdAt:n({offset:!0}),externalId:d().nullish(),id:e(),isCurrent:l(),lastFetchedAt:n({offset:!0}).nullish(),mentionedEntityId:r(e()),mentionedPersonId:r(e()),owner:c,publishedAt:n({offset:!0}).nullish(),summary:d().nullish(),summaryGeneratedAt:n({offset:!0}).nullish(),title:d().nullish(),topic:d().nullish(),type:ye,updatedAt:n({offset:!0}),url:d()}),be=f({count:o(),stage:d()}),xe=f({attributedInvestmentCount:o(),averageAmountInvestedUsd:u().nullish(),currentPortfolioCount:o(),largestAmountInvestedUsd:u().nullish(),portfolioCompanyCount:o(),smallestAmountInvestedUsd:u().nullish(),topInvestmentStage:r(be),totalAmountInvestedUsd:u().nullish(),totalInvestment:o(),totalPortfolioExit:o(),totalWriteOff:o()}),Se=a([`nickname`,`maidenName`,`formerName`,`stageName`]),W=f({displayable:l().nullish(),name:d(),type:Se.nullish()}),G=f({isMonogram:l(),picture:d().nullish()}),K=f({associationId:o(),endDate:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),entityAddress:r(p),entityId:e(),entityLogo:C,entityName:d().nullish(),entityOperatingStatus:d().nullish(),entitySlug:d().regex(/^[a-z0-9_-]+$/).max(255),entityType:i.nullish(),entityUrlLink:r(x),isCurrent:l().nullish(),personAddress:r(p),personId:e(),personImage:G,personName:d(),personSlug:d().regex(/^[a-z0-9_-]+$/).max(255),personUrlLink:r(x),score:o().nullish(),startDate:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),titleFunction:d().nullish(),titleId:o().nullish(),titleLevel:d().nullish(),titleName:d().nullish()}),Ce=f({address:r(p),urlLink:r(x)}),q=a([`low`,`medium`,`high`]),we=f({asOfDate:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),currentEligible:l().nullish(),dataConfidence:q.nullish(),dateValue:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),numericValue:u().nullish(),referenceValue:d().nullish(),source:d().nullish(),textValue:d().nullish(),updatedAt:n({offset:!0}).nullish(),valueType:R}),J=f({asOfDate:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),fact:we,id:d()}),Y=f({isCurrent:l().nullish(),personId:e(),personImage:G,personName:d(),personSlug:d().regex(/^[a-z0-9_-]+$/).max(255),titleName:d().nullish()}),Te=f({entity:O,keyPerson:r(Y)}),Ee=f({colleague:r(Y),employeeCount:J.nullish(),entity:O,primaryAddress:p.nullish(),recentNews:r(H),similarEntity:r(Te)}),De=f({overlapCount:o(),person:Y,round:d().nullish(),sharedEntity:T.nullish(),transactionId:e().nullish()}),Oe=f({careerContext:r(Ee),coInvestor:r(De),computedAt:n({offset:!0}).nullish()}),ke=f({amountRaised:u().nullish(),dateAnnounced:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),id:e(),image:C,investorCount:o().nullish(),nameBrand:d(),round:d().nullish(),status:d().nullish(),valuationPostMoney:u().nullish()}),Ae=f({entity:T,headquartersCity:d().nullish(),headquartersCountry:d().nullish(),headquartersRegion:d().nullish(),industry:d().nullish()}),X=f({amount:u().nullish(),company:Ae,date:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),fundraiseTransaction:ke.nullish(),fundraiseTransactionId:e(),id:d(),investmentDate:n({offset:!0}),investorAttribution:M.nullish(),round:d().nullish()}),Z=a([`entity`,`person`,`newsArticle`,`blogPost`,`text`,`classificationTag`,`classificationCode`,`product`,`service`,`agentHelpDoc`,`researchSnippet`,`sourceDocument`]),je=Object.assign(t([Z,d()]),{enum:Z.enum}),Me=f({computedAt:n({offset:!0}),cosineDistance:u(),cosineScore:u(),modelVersion:d(),rank:o(),sourceHash:d(),sourceId:d(),sourceType:je}),Q=f({bioUpdatedAt:n({offset:!0}).nullish(),createdAt:n({offset:!0}).nullish(),gender:d().nullish(),id:e(),image:G,lastModifiedAt:n({offset:!0}).nullish(),nameAlias:r(W),nameFirst:d().nullish(),nameFull:d(),nameLast:d().nullish(),nameMiddle:d().nullish(),nickname:d().nullish(),publicId:d().regex(/^p[0-9A-Za-z]{12}$/).nullish(),semanticMatch:Me.nullish(),slug:d().regex(/^[a-z0-9_-]+$/).max(255),suffix:d().nullish(),text:y,updatedAt:n({offset:!0}).nullish()}),Ne=a([`precomputed`,`live`]),Pe=f({compositeScore:u().nullish(),cosineScore:u().nullish(),matchedSectionWeight:u().nullish(),origin:Ne,rank:o(),sharedSectionCount:o().nullish()}),Fe=f({currentRole:K.nullish(),person:Q,similarity:Pe}),Ie=f({articleCount:o().nullish(),association:r(K),blogPost:r(U).nullish(),core:Q,enrichment:Ce,graph:Oe.nullish(),investment:r(X),investorActivity:xe.nullish(),nameAlias:r(W),similar:r(Fe).nullish()}),Le=a([`ein`,`secCik`,`ticker`,`lei`,`duns`,`isin`,`cusip`,`crd`,`orcid`,`folk`]),Re=Object.assign(t([Le,d()]),{enum:Le.enum}),$=f({createdAt:n({offset:!0}),id:o(),identifier:d(),idType:Re,owner:c,source:d().nullish(),updatedAt:n({offset:!0})}),ze=f({core:T,enrichment:S,fundraiseRound:r(N),newsArticle:r(H),person:r(Ie),provider:P.nullish(),publicUrl:d().nullish(),relationship:r(I),research:ve,sitemap:w,uniqueId:r($)});export{_ as A,k as C,x as D,S as E,b as O,A as S,T,I as _,Q as a,M as b,J as c,U as d,H as f,L as g,z as h,Fe as i,g as j,v as k,q as l,B as m,$ as n,Me as o,V as p,Ie as r,X as s,ze as t,K as u,P as v,D as w,j as x,N as y};
@@ -1 +0,0 @@
1
- export{t as EntityDetailSchema}from"./detail-BTjlqGmV.js";
@@ -1 +0,0 @@
1
- import{D as e,E as t,N as ee,S as n,T as r,_ as i,a as te,b as a,c as ne,d as re,g as o,h as ie,i as ae,j as oe,l as s,m as se,o as c,s as ce,u as l,v as u,w as d,x as le,y as f}from"./person-owner-C0YuWKvY.js";var ue={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},de;de||={};function fe(e){return oe(te,e)}var pe=f({authorizationServer:d(),clientId:d(),mcpResource:d().nullish(),redirectUri:d(),resource:d(),scope:s(d())}),me=`2025-11-25`,he=`2025-03-26`,ge=[me,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],_e=`io.modelcontextprotocol/related-task`,ve=`io.modelcontextprotocol/protocolVersion`,ye=`io.modelcontextprotocol/clientInfo`,be=`io.modelcontextprotocol/serverInfo`,xe=`io.modelcontextprotocol/clientCapabilities`,Se=`io.modelcontextprotocol/subscriptionId`,Ce=`io.modelcontextprotocol/logLevel`,we=`traceparent`,p=ie(()=>r([d(),u(),l(),ce(),n(d(),p),s(p)])),m=n(d(),p),Te=s(p),h=r([d(),u().int()]),Ee=d(),De=f({ttl:u().optional()}),Oe=f({taskId:d()}),g=i({progressToken:h.optional(),[_e]:Oe.optional()}),_=f({_meta:g.optional()}),v=_.extend({task:De.optional()}),y=f({method:d(),params:_.loose().optional()}),b=f({_meta:g.optional()}),x=f({method:d(),params:b.loose().optional()}),ke=i({get[be](){return k.optional().catch(void 0)}}),S=i({_meta:ke.optional()}),C=r([d(),u().int()]),Ae=f({jsonrpc:o(`2.0`),id:C,...y.shape}).strict(),je=f({jsonrpc:o(`2.0`),...x.shape}).strict(),w=f({jsonrpc:o(`2.0`),id:C,result:S}).strict(),T=f({jsonrpc:o(`2.0`),id:C.optional(),error:f({code:u().int(),message:d(),data:t().optional()})}).strict(),Me=r([Ae,je,w,T]),Ne=r([w,T]),E=S.strict(),Pe=b.extend({requestId:C.optional(),reason:d().optional()}),Fe=x.extend({method:o(`notifications/cancelled`),params:Pe}),Ie=f({src:d(),mimeType:d().optional(),sizes:s(d()).optional(),theme:c([`light`,`dark`]).optional()}),D=f({icons:s(Ie).optional()}),O=f({name:d(),title:d().optional()}),k=O.extend({...O.shape,...D.shape,version:d(),websiteUrl:d().optional(),description:d().optional()}),Le=se(f({applyDefaults:l().optional()}),m),Re=le(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(f({form:Le.optional(),url:m.optional()}),m.optional())),ze=i({list:m.optional(),cancel:m.optional(),requests:i({sampling:i({createMessage:m.optional()}).optional(),elicitation:i({create:m.optional()}).optional()}).optional()}),Be=i({list:m.optional(),cancel:m.optional(),requests:i({tools:i({call:m.optional()}).optional()}).optional()}),Ve=f({experimental:n(d(),m).optional(),sampling:f({context:m.optional(),tools:m.optional()}).optional(),elicitation:Re.optional(),roots:f({listChanged:l().optional()}).optional(),tasks:ze.optional(),extensions:n(d(),m).optional()}),He=_.extend({protocolVersion:d(),capabilities:Ve,clientInfo:k}),Ue=y.extend({method:o(`initialize`),params:He}),A=f({experimental:n(d(),m).optional(),logging:m.optional(),completions:m.optional(),prompts:f({listChanged:l().optional()}).optional(),resources:f({subscribe:l().optional(),listChanged:l().optional()}).optional(),tools:f({listChanged:l().optional()}).optional(),tasks:Be.optional(),extensions:n(d(),m).optional()}),We=S.extend({protocolVersion:d(),capabilities:A,serverInfo:k,instructions:d().optional()}),Ge=x.extend({method:o(`notifications/initialized`),params:b.optional()}),Ke=y.extend({method:o(`server/discover`),params:_.optional()}),qe=S.extend({supportedVersions:s(d()),capabilities:A,instructions:d().optional()}),j=y.extend({method:o(`ping`),params:_.optional()}),Je=f({progress:u(),total:a(u()),message:a(d())}),Ye=f({...b.shape,...Je.shape,progressToken:h}),M=x.extend({method:o(`notifications/progress`),params:Ye}),Xe=_.extend({cursor:Ee.optional()}),N=y.extend({params:Xe.optional()}),P=S.extend({nextCursor:Ee.optional()}),F=f({uri:d(),mimeType:a(d()),_meta:n(d(),t()).optional()}),I=F.extend({text:d()}),L=d().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),R=F.extend({blob:L}),z=c([`user`,`assistant`]),B=f({audience:s(z).optional(),priority:u().min(0).max(1).optional(),lastModified:ae({offset:!0}).optional()}),V=f({...O.shape,...D.shape,uri:d(),description:a(d()),mimeType:a(d()),size:a(u()),annotations:B.optional(),_meta:a(i({}))}),Ze=f({...O.shape,...D.shape,uriTemplate:d(),description:a(d()),mimeType:a(d()),annotations:B.optional(),_meta:a(i({}))}),Qe=N.extend({method:o(`resources/list`)}),$e=P.extend({resources:s(V)}),et=N.extend({method:o(`resources/templates/list`)}),tt=P.extend({resourceTemplates:s(Ze)}),H=_.extend({uri:d()}),nt=H,rt=y.extend({method:o(`resources/read`),params:nt}),it=S.extend({contents:s(r([I,R]))}),at=x.extend({method:o(`notifications/resources/list_changed`),params:b.optional()}),ot=H,st=y.extend({method:o(`resources/subscribe`),params:ot}),ct=H,lt=y.extend({method:o(`resources/unsubscribe`),params:ct}),U=f({toolsListChanged:l().optional(),promptsListChanged:l().optional(),resourcesListChanged:l().optional(),resourceSubscriptions:s(d()).optional()}),ut=_.extend({notifications:U}),dt=y.extend({method:o(`subscriptions/listen`),params:ut}),ft=b.extend({notifications:U}),pt=x.extend({method:o(`notifications/subscriptions/acknowledged`),params:ft}),mt=ke.extend({[Se]:C}),ht=S.extend({_meta:mt}),gt=b.extend({uri:d()}),_t=x.extend({method:o(`notifications/resources/updated`),params:gt}),vt=f({name:d(),description:a(d()),required:a(l())}),yt=f({...O.shape,...D.shape,description:a(d()),arguments:a(s(vt)),_meta:a(i({}))}),bt=N.extend({method:o(`prompts/list`)}),xt=P.extend({prompts:s(yt)}),St=_.extend({name:d(),arguments:n(d(),d()).optional()}),Ct=y.extend({method:o(`prompts/get`),params:St}),W=f({type:o(`text`),text:d(),annotations:B.optional(),_meta:n(d(),t()).optional()}),G=f({type:o(`image`),data:L,mimeType:d(),annotations:B.optional(),_meta:n(d(),t()).optional()}),K=f({type:o(`audio`),data:L,mimeType:d(),annotations:B.optional(),_meta:n(d(),t()).optional()}),wt=f({type:o(`tool_use`),name:d(),id:d(),input:n(d(),t()),_meta:n(d(),t()).optional()}),Tt=f({type:o(`resource`),resource:r([I,R]),annotations:B.optional(),_meta:n(d(),t()).optional()}),Et=V.extend({type:o(`resource_link`)}),q=r([W,G,K,Et,Tt]),Dt=f({role:z,content:q}),Ot=S.extend({description:d().optional(),messages:s(Dt)}),kt=x.extend({method:o(`notifications/prompts/list_changed`),params:b.optional()}),At=f({title:d().optional(),readOnlyHint:l().optional(),destructiveHint:l().optional(),idempotentHint:l().optional(),openWorldHint:l().optional()}),jt=f({taskSupport:c([`required`,`optional`,`forbidden`]).optional()}),J=f({...O.shape,...D.shape,description:d().optional(),inputSchema:f({type:o(`object`),properties:n(d(),p).optional(),required:s(d()).optional()}).catchall(t()),outputSchema:i({$schema:d().optional()}).optional(),annotations:At.optional(),execution:jt.optional(),_meta:n(d(),t()).optional()}),Mt=N.extend({method:o(`tools/list`)}),Nt=P.extend({tools:s(J)}),Y=S.extend({content:s(q).default([]),structuredContent:t().optional(),isError:l().optional()}),Pt=Y.or(S.extend({toolResult:t()})),Ft=v.extend({name:d(),arguments:n(d(),t()).optional()}),It=y.extend({method:o(`tools/call`),params:Ft}),Lt=x.extend({method:o(`notifications/tools/list_changed`),params:b.optional()}),Rt=f({autoRefresh:l().default(!0),debounceMs:u().int().nonnegative().default(300)}),X=c([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),zt=_.extend({level:X}),Bt=y.extend({method:o(`logging/setLevel`),params:zt}),Vt=b.extend({level:X,logger:d().optional(),data:t()}),Ht=x.extend({method:o(`notifications/message`),params:Vt}),Ut=f({name:d().optional()}),Wt=f({hints:s(Ut).optional(),costPriority:u().min(0).max(1).optional(),speedPriority:u().min(0).max(1).optional(),intelligencePriority:u().min(0).max(1).optional()}),Gt=f({mode:c([`auto`,`required`,`none`]).optional()}),Kt=f({type:o(`tool_result`),toolUseId:d().describe(`The unique identifier for the corresponding tool call.`),content:s(q),structuredContent:t().optional(),isError:l().optional(),_meta:n(d(),t()).optional()}),qt=re(`type`,[W,G,K]),Z=re(`type`,[W,G,K,wt,Kt]),Jt=f({role:z,content:r([Z,s(Z)]),_meta:n(d(),t()).optional()}),Yt=v.extend({messages:s(Jt),modelPreferences:Wt.optional(),systemPrompt:d().optional(),includeContext:c([`none`,`thisServer`,`allServers`]).optional(),temperature:u().optional(),maxTokens:u().int(),stopSequences:s(d()).optional(),metadata:m.optional(),tools:s(J).optional(),toolChoice:Gt.optional()}),Xt=y.extend({method:o(`sampling/createMessage`),params:Yt}),Zt=S.extend({model:d(),stopReason:a(c([`endTurn`,`stopSequence`,`maxTokens`]).or(d())),role:z,content:qt}),Qt=S.extend({model:d(),stopReason:a(c([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(d())),role:z,content:r([Z,s(Z)])}),$t=f({type:o(`boolean`),title:d().optional(),description:d().optional(),default:l().optional()}),en=f({type:o(`string`),title:d().optional(),description:d().optional(),minLength:u().optional(),maxLength:u().optional(),format:c([`email`,`uri`,`date`,`date-time`]).optional(),default:d().optional()}),tn=f({type:c([`number`,`integer`]),title:d().optional(),description:d().optional(),minimum:u().optional(),maximum:u().optional(),default:u().optional()}),nn=f({type:o(`string`),title:d().optional(),description:d().optional(),enum:s(d()),default:d().optional()}),rn=f({type:o(`string`),title:d().optional(),description:d().optional(),oneOf:s(f({const:d(),title:d()})),default:d().optional()}),an=f({type:o(`string`),title:d().optional(),description:d().optional(),enum:s(d()),enumNames:s(d()).optional(),default:d().optional()}),on=r([nn,rn]),sn=f({type:o(`array`),title:d().optional(),description:d().optional(),minItems:u().optional(),maxItems:u().optional(),items:f({type:o(`string`),enum:s(d())}),default:s(d()).optional()}),cn=f({type:o(`array`),title:d().optional(),description:d().optional(),minItems:u().optional(),maxItems:u().optional(),items:f({anyOf:s(f({const:d(),title:d()}))}),default:s(d()).optional()}),ln=r([sn,cn]),un=r([an,on,ln]),dn=r([un,$t,en,tn]),fn=v.extend({mode:o(`form`).optional(),message:d(),requestedSchema:f({type:o(`object`),properties:n(d(),dn),required:s(d()).optional()}).catchall(t())}),pn=v.extend({mode:o(`url`),message:d(),elicitationId:d(),url:d().url()}),mn=r([fn,pn]),hn=y.extend({method:o(`elicitation/create`),params:mn}),gn=b.extend({elicitationId:d()}),_n=x.extend({method:o(`notifications/elicitation/complete`),params:gn}),vn=S.extend({action:c([`accept`,`decline`,`cancel`]),content:le(e=>e===null?void 0:e,n(d(),r([d(),u(),l(),s(d())])).optional())}),yn=f({type:o(`ref/resource`),uri:d()}),bn=f({type:o(`ref/prompt`),name:d()}),xn=_.extend({ref:r([bn,yn]),argument:f({name:d(),value:d()}),context:f({arguments:n(d(),d()).optional()}).optional()}),Sn=y.extend({method:o(`completion/complete`),params:xn}),Cn=S.extend({completion:i({values:s(d()).max(100),total:a(u().int()),hasMore:a(l())})}),wn=f({uri:d().startsWith(`file://`),name:d().optional(),_meta:n(d(),t()).optional()}),Tn=y.extend({method:o(`roots/list`),params:_.optional()}),En=S.extend({roots:s(wn)}),Dn=x.extend({method:o(`notifications/roots/list_changed`),params:b.optional()}),On=i({ttl:u().optional(),pollInterval:u().optional()}),kn=c([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Q=f({taskId:d(),status:kn,ttl:r([u(),ce()]),createdAt:d(),lastUpdatedAt:d(),pollInterval:a(u()),statusMessage:a(d())}),An=S.extend({task:Q}),jn=b.merge(Q),Mn=x.extend({method:o(`notifications/tasks/status`),params:jn}),Nn=y.extend({method:o(`tasks/get`),params:_.extend({taskId:d()})}),Pn=S.merge(Q),Fn=y.extend({method:o(`tasks/result`),params:_.extend({taskId:d()})}),In=S.loose(),Ln=N.extend({method:o(`tasks/list`)}),Rn=P.extend({tasks:s(Q)}),zn=y.extend({method:o(`tasks/cancel`),params:_.extend({taskId:d()})}),Bn=S.merge(Q),Vn=r([j,Ue,Ke,Sn,Bt,Ct,bt,Qe,et,rt,st,lt,dt,It,Mt]),Hn=r([Fe,M,Ge,Dn]),Un=r([E,Zt,Qt,vn,En]),Wn=r([j,Xt,hn,Tn]),Gn=r([Fe,M,Ht,_t,at,Lt,kt,pt,_n]),Kn=r([E,We,qe,Cn,Ot,xt,$e,tt,it,Y,Nt,ht]),$=e().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:ue.custom,message:`URL must be parseable`,fatal:!0}),ee}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),qn=i({resource:d().url(),authorization_servers:s($).optional(),jwks_uri:d().url().optional(),scopes_supported:s(d()).optional(),bearer_methods_supported:s(d()).optional(),resource_signing_alg_values_supported:s(d()).optional(),resource_name:d().optional(),resource_documentation:d().optional(),resource_policy_uri:d().url().optional(),resource_tos_uri:d().url().optional(),tls_client_certificate_bound_access_tokens:l().optional(),authorization_details_types_supported:s(d()).optional(),dpop_signing_alg_values_supported:s(d()).optional(),dpop_bound_access_tokens_required:l().optional()}),Jn=i({issuer:d(),authorization_endpoint:$,token_endpoint:$,registration_endpoint:$.optional(),scopes_supported:s(d()).optional(),response_types_supported:s(d()),response_modes_supported:s(d()).optional(),grant_types_supported:s(d()).optional(),token_endpoint_auth_methods_supported:s(d()).optional(),token_endpoint_auth_signing_alg_values_supported:s(d()).optional(),service_documentation:$.optional(),revocation_endpoint:$.optional(),revocation_endpoint_auth_methods_supported:s(d()).optional(),revocation_endpoint_auth_signing_alg_values_supported:s(d()).optional(),introspection_endpoint:d().optional(),introspection_endpoint_auth_methods_supported:s(d()).optional(),introspection_endpoint_auth_signing_alg_values_supported:s(d()).optional(),code_challenge_methods_supported:s(d()).optional(),client_id_metadata_document_supported:l().optional(),authorization_response_iss_parameter_supported:l().optional().catch(void 0),dpop_signing_alg_values_supported:s(d()).optional()}),Yn=i({issuer:d(),authorization_endpoint:$,token_endpoint:$,userinfo_endpoint:$.optional(),jwks_uri:$,registration_endpoint:$.optional(),scopes_supported:s(d()).optional(),response_types_supported:s(d()),response_modes_supported:s(d()).optional(),grant_types_supported:s(d()).optional(),acr_values_supported:s(d()).optional(),subject_types_supported:s(d()),id_token_signing_alg_values_supported:s(d()),id_token_encryption_alg_values_supported:s(d()).optional(),id_token_encryption_enc_values_supported:s(d()).optional(),userinfo_signing_alg_values_supported:s(d()).optional(),userinfo_encryption_alg_values_supported:s(d()).optional(),userinfo_encryption_enc_values_supported:s(d()).optional(),request_object_signing_alg_values_supported:s(d()).optional(),request_object_encryption_alg_values_supported:s(d()).optional(),request_object_encryption_enc_values_supported:s(d()).optional(),token_endpoint_auth_methods_supported:s(d()).optional(),token_endpoint_auth_signing_alg_values_supported:s(d()).optional(),display_values_supported:s(d()).optional(),claim_types_supported:s(d()).optional(),claims_supported:s(d()).optional(),service_documentation:d().optional(),claims_locales_supported:s(d()).optional(),ui_locales_supported:s(d()).optional(),claims_parameter_supported:l().optional(),request_parameter_supported:l().optional(),request_uri_parameter_supported:l().optional(),require_request_uri_registration:l().optional(),op_policy_uri:$.optional(),op_tos_uri:$.optional(),client_id_metadata_document_supported:l().optional(),authorization_response_iss_parameter_supported:l().optional().catch(void 0)}),Xn=f({...Yn.shape,...Jn.pick({code_challenge_methods_supported:!0}).shape}),Zn=f({access_token:d(),id_token:d().optional(),token_type:d(),expires_in:fe().optional(),scope:d().optional(),refresh_token:d().optional(),issuer:d().optional().catch(void 0)}).strip(),Qn=f({issued_token_type:o(`urn:ietf:params:oauth:token-type:id-jag`),access_token:d(),token_type:d().optional(),expires_in:u().optional(),scope:d().optional()}).strip(),$n=f({error:d(),error_description:d().optional(),error_uri:d().optional()}),er=$.optional().or(o(``).transform(()=>void 0)),tr=f({redirect_uris:s($),token_endpoint_auth_method:d().optional(),grant_types:s(d()).optional(),response_types:s(d()).optional(),application_type:d().optional(),client_name:d().optional(),client_uri:$.optional(),logo_uri:er,scope:d().optional(),contacts:s(d()).optional(),tos_uri:er,policy_uri:d().optional(),jwks_uri:$.optional(),jwks:ne().optional(),software_id:d().optional(),software_version:d().optional(),software_statement:d().optional()}).strip(),nr=f({client_id:d(),client_secret:d().optional(),client_id_issued_at:u().optional(),client_secret_expires_at:u().optional(),issuer:d().optional().catch(void 0)}).strip(),rr=tr.merge(nr),ir=f({error:d(),error_description:d().optional()}).strip(),ar=f({token:d(),token_type_hint:d().optional()}).strip(),or=`bearer `,sr=4096;function cr(e){if(e===void 0||e.length>sr||e.slice(0,7).toLowerCase()!==or)return;let t=e.slice(7).trim();return t.length>0?t:void 0}var lr=9e5;export{Pn as $,U as $n,Yn as $t,Zt as A,_t as An,Ln as At,pn as B,Z as Bn,x as Bt,Pt as C,Et as Cn,J as Cr,xt as Ct,q as D,yn as Dn,sn as Dr,$e as Dt,Cn as E,V as En,lt as Er,Qe as Et,Ke as F,Dn as Fn,Vt as Ft,E as G,Kn as Gn,tr as Gt,gn as H,A as Hn,tn as Ht,qe as I,be as In,Ht as It,Ct as J,Bt as Jn,Jn as Jt,un as K,Be as Kn,ir as Kt,fn as L,Se as Ln,Ut as Lt,An as M,S as Mn,Mt,Ee as N,z as Nn,Nt,Yt as O,Ze as On,nn as Or,Tn as Ot,he as P,wn as Pn,X as Pt,Nn as Q,st as Qn,Xn as Qt,mn as R,ge as Rn,Wt as Rt,ze as S,F as Sn,Kt as Sr,bt as St,Sn as T,H as Tn,ct as Tr,tt as Tt,_n as U,Gn as Un,rr as Ut,vn as V,Jt as Vn,b as Vt,Tt as W,Wn,nr as Wt,Fn as X,en as Xn,ar as Xt,Ot as Y,on as Yn,qn as Yt,In as Z,ot as Zn,Zn as Zt,Fe as _,it as _n,rn as _r,p as _t,O as a,dn as an,ht as ar,He as at,Vn as b,g as bn,jt as br,an as bt,$t as c,Je as cn,On as cr,Ge as ct,Ft as d,kt as dn,jn as dr,T as dt,ve as en,ft as er,Ie as et,It as f,Dt as fn,Mn as fr,Me as ft,Pe as g,rt as gn,cn as gr,w as gt,Bn as h,nt as hn,I as hr,Ne as ht,K as i,j as in,mt as ir,k as it,Qt as j,ke as jn,Rn as jt,Xt as k,gt as kn,pe as kr,En as kt,xe as l,h as ln,De as lr,Te as lt,zn as m,yt as mn,W as mr,Ae as mt,cr as n,N as nn,ut as nr,Qn as nt,_ as o,Ye as on,we as or,Ue as ot,Y as p,bn as pn,kn as pr,je as pt,St as q,zt as qn,$n as qt,B as r,P as rn,dt as rr,G as rt,R as s,M as sn,v as sr,We as st,lr as t,Xe as tn,pt as tr,D as tt,ye as u,vt as un,Q as ur,m as ut,Ve as v,Oe as vn,At as vr,me as vt,xn as w,at as wn,wt as wr,et as wt,Un as x,y as xn,Lt as xr,Rt as xt,Hn as y,C as yn,Gt as yr,Ce as yt,hn as z,qt as zn,ln as zt};
@@ -1 +0,0 @@
1
- import{createRequire as e}from"node:module";var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},c=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),l=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},ee=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,ee=c.length,u;l<ee;l++)u=c[l],!o.call(e,u)&&u!==a&&n(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(s=r(t,u))||s.enumerable});return e},u=(e,r,i)=>(i=e==null?{}:t(a(e)),ee(r||!e||!e.__esModule||!o.call(e,`default`)?n(i,`default`,{value:e,enumerable:!0}):i,e)),te=e=>o.call(e,`module.exports`)?e[`module.exports`]:ee(n({},`__esModule`,{value:!0}),e),ne=e(import.meta.url),d,re=s((()=>{d=`1.9.1`}));function ie(e){let t=new Set([e]),n=new Set,r=e.match(ae);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(ae);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var ae,oe,se=s((()=>{re(),ae=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,oe=ie(d)}));function f(e,t,n,r=!1){let i=g[h]=g[h]??{version:d};if(!r&&i[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${d}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${d}.`),!0}function p(e){let t=g[h]?.version;if(t&&oe(t))return g[h]?.[e]}function m(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${d}.`);let n=g[h];n&&delete n[e]}var ce,h,g,_=s((()=>{re(),se(),ce=d.split(`.`)[0],h=Symbol.for(`opentelemetry.js.api.${ce}`),g=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function v(e,t,n){let r=p(`diag`);if(r)return r[e](t,...n)}var le,ue=s((()=>{_(),le=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return v(`debug`,this._namespace,e)}error(...e){return v(`error`,this._namespace,e)}info(...e){return v(`info`,this._namespace,e)}warn(...e){return v(`warn`,this._namespace,e)}verbose(...e){return v(`verbose`,this._namespace,e)}}})),y,b=s((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(y||={})}));function de(e,t){e<y.NONE?e=y.NONE:e>y.ALL&&(e=y.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,y.ERROR),warn:n(`warn`,y.WARN),info:n(`info`,y.INFO),debug:n(`debug`,y.DEBUG),verbose:n(`verbose`,y.VERBOSE)}}var fe=s((()=>{b()})),pe,x,S=s((()=>{ue(),fe(),b(),_(),pe=`diag`,x=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=p(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:y.INFO})=>{if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=p(`diag`),i=de(n.logLevel??y.INFO,e);if(r&&!n.suppressOverrideMessage){let e=Error().stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return f(`diag`,i,t,!0)},t.disable=()=>{m(pe,t)},t.createComponentLogger=e=>new le(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}})),me,he=s((()=>{me=class e{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(t)return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,n){let r=new e(this._entries);return r._entries.set(t,n),r}removeEntry(t){let n=new e(this._entries);return n._entries.delete(t),n}removeEntries(...t){let n=new e(this._entries);for(let e of t)n._entries.delete(e);return n}clear(){return new e}}})),ge,_e=s((()=>{ge=Symbol(`BaggageEntryMetadata`)}));function ve(e={}){return new me(new Map(Object.entries(e)))}function ye(e){return typeof e!=`string`&&(be.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=``),{__TYPE__:ge,toString(){return e}}}var be,xe=s((()=>{S(),he(),_e(),be=x.instance()}));function C(e){return Symbol.for(e)}var Se,w,T=s((()=>{Se=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},w=new Se})),E,D,Ce,we=s((()=>{if(E=[{n:`error`,c:`error`},{n:`warn`,c:`warn`},{n:`info`,c:`info`},{n:`debug`,c:`debug`},{n:`verbose`,c:`trace`}],D={},typeof console<`u`)for(let e of[`error`,`warn`,`info`,`debug`,`trace`,`log`])typeof console[e]==`function`&&(D[e]=console[e]);Ce=class{constructor(){function e(e){return function(...t){let n=D[e];if(typeof n!=`function`&&(n=D.log),typeof n!=`function`&&console&&(n=console[e],typeof n!=`function`&&(n=console.log)),typeof n==`function`)return n.apply(console,t)}}for(let t=0;t<E.length;t++)this[E[t].n]=e(E[t].c)}}}));function Te(){return Pe}var Ee,O,De,Oe,ke,Ae,k,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He=s((()=>{Ee=class{constructor(){}createGauge(e,t){return Ie}createHistogram(e,t){return Le}createCounter(e,t){return Fe}createUpDownCounter(e,t){return Re}createObservableGauge(e,t){return Be}createObservableCounter(e,t){return ze}createObservableUpDownCounter(e,t){return Ve}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},O=class{},De=class extends O{add(e,t){}},Oe=class extends O{add(e,t){}},ke=class extends O{record(e,t){}},Ae=class extends O{record(e,t){}},k=class{addCallback(e){}removeCallback(e){}},je=class extends k{},Me=class extends k{},Ne=class extends k{},Pe=new Ee,Fe=new De,Ie=new ke,Le=new Ae,Re=new Oe,ze=new je,Be=new Me,Ve=new Ne})),A,Ue=s((()=>{(function(e){e[e.INT=0]=`INT`,e[e.DOUBLE=1]=`DOUBLE`})(A||={})})),We,Ge,Ke=s((()=>{We={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},Ge={set(e,t,n){e!=null&&(e[t]=n)}}})),qe,Je=s((()=>{T(),qe=class{active(){return w}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),j,Ye,M,N=s((()=>{Je(),_(),S(),j=`context`,Ye=new qe,M=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return f(j,e,x.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return p(j)||Ye}disable(){this._getContextManager().disable(),m(j,x.instance())}}})),P,Xe=s((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(P||={})})),Ze,Qe,F,I=s((()=>{Xe(),Ze=`0000000000000000`,Qe=`00000000000000000000000000000000`,F={traceId:Qe,spanId:Ze,traceFlags:P.NONE}})),L,$e=s((()=>{I(),L=class{constructor(e=F){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}));function et(e){return e.getValue(R)||void 0}function tt(){return et(M.getInstance().active())}function nt(e,t){return e.setValue(R,t)}function rt(e){return e.deleteValue(R)}function it(e,t){return nt(e,new L(t))}function at(e){return et(e)?.spanContext()}var R,ot=s((()=>{T(),$e(),N(),R=C(`OpenTelemetry Context Key SPAN`)}));function st(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(B[e.charCodeAt(t)]|0)+(B[e.charCodeAt(t+1)]|0)+(B[e.charCodeAt(t+2)]|0)+(B[e.charCodeAt(t+3)]|0);return n===t}function ct(e){return st(e,32)&&e!==`00000000000000000000000000000000`}function lt(e){return st(e,16)&&e!==`0000000000000000`}function z(e){return ct(e.traceId)&&lt(e.spanId)}function ut(e){return new L(e)}var B,V=s((()=>{I(),$e(),B=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])}));function dt(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var H,ft,pt=s((()=>{N(),ot(),$e(),V(),H=M.getInstance(),ft=class{startSpan(e,t,n=H.active()){if(t?.root)return new L;let r=n&&at(n);return dt(r)&&z(r)?new L(r):new L}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??H.active(),c=this.startSpan(e,i,s),l=nt(s,c);return H.with(l,o,void 0,c)}}})),mt,ht,gt=s((()=>{pt(),mt=new ft,ht=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):mt}}})),_t,vt=s((()=>{pt(),_t=class{getTracer(e,t,n){return new ft}}})),yt,U,bt=s((()=>{gt(),vt(),yt=new _t,U=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new ht(this,e,t,n)}getDelegate(){return this._delegate??yt}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}}})),xt,St=s((()=>{(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(xt||={})})),Ct,wt=s((()=>{(function(e){e[e.INTERNAL=0]=`INTERNAL`,e[e.SERVER=1]=`SERVER`,e[e.CLIENT=2]=`CLIENT`,e[e.PRODUCER=3]=`PRODUCER`,e[e.CONSUMER=4]=`CONSUMER`})(Ct||={})})),Tt,Et=s((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Tt||={})}));function Dt(e){return kt.test(e)}function Ot(e){return At.test(e)&&!jt.test(e)}var W,kt,At,jt,Mt=s((()=>{W=`[_0-9a-z-*/]`,kt=RegExp(`^(?:${`[a-z]${W}{0,255}`}|${`[a-z0-9]${W}{0,240}@[a-z]${W}{0,13}`})$`),At=/^[ -~]{0,255}[!-~]$/,jt=/,|=/})),Nt,Pt,Ft,It,Lt,Rt=s((()=>{Mt(),Nt=32,Pt=512,Ft=`,`,It=`=`,Lt=class e{constructor(e){this._internalState=new Map,e&&this._parse(e)}set(e,t){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return Array.from(this._internalState.keys()).reduceRight((e,t)=>(e.push(t+It+this.get(t)),e),[]).join(Ft)}_parse(e){e.length>Pt||(this._internalState=e.split(Ft).reduceRight((e,t)=>{let n=t.trim(),r=n.indexOf(It);if(r!==-1){let i=n.slice(0,r),a=n.slice(r+1,t.length);Dt(i)&&Ot(a)&&e.set(i,a)}return e},new Map),this._internalState.size>Nt&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,Nt))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}}}));function zt(e){return new Lt(e)}var Bt=s((()=>{Rt()})),G,Vt=s((()=>{N(),G=M.getInstance()})),K,Ht=s((()=>{S(),K=x.instance()})),Ut,Wt,Gt=s((()=>{He(),Ut=class{getMeter(e,t,n){return Pe}},Wt=new Ut})),q,Kt,qt=s((()=>{Gt(),_(),S(),q=`metrics`,Kt=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalMeterProvider(e){return f(q,e,x.instance())}getMeterProvider(){return p(q)||Wt}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){m(q,x.instance())}}})),J,Jt=s((()=>{qt(),J=Kt.getInstance()})),Yt,Xt=s((()=>{Yt=class{inject(e,t){}extract(e,t){return e}fields(){return[]}}}));function Zt(e){return e.getValue(Y)||void 0}function Qt(){return Zt(M.getInstance().active())}function $t(e,t){return e.setValue(Y,t)}function en(e){return e.deleteValue(Y)}var Y,tn=s((()=>{N(),T(),Y=C(`OpenTelemetry Baggage Key`)})),X,nn,rn,an=s((()=>{_(),Xt(),Ke(),tn(),xe(),S(),X=`propagation`,nn=new Yt,rn=class e{constructor(){this.createBaggage=ve,this.getBaggage=Zt,this.getActiveBaggage=Qt,this.setBaggage=$t,this.deleteBaggage=en}static getInstance(){return this._instance||=new e,this._instance}setGlobalPropagator(e){return f(X,e,x.instance())}inject(e,t,n=Ge){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=We){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){m(X,x.instance())}_getGlobalPropagator(){return p(X)||nn}}})),Z,on=s((()=>{an(),Z=rn.getInstance()})),Q,sn,cn=s((()=>{_(),bt(),V(),ot(),S(),Q=`trace`,sn=class e{constructor(){this._proxyTracerProvider=new U,this.wrapSpanContext=ut,this.isSpanContextValid=z,this.deleteSpan=rt,this.getSpan=et,this.getActiveSpan=tt,this.getSpanContext=at,this.setSpan=nt,this.setSpanContext=it}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=f(Q,this._proxyTracerProvider,x.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return p(Q)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){m(Q,x.instance()),this._proxyTracerProvider=new U}}})),$,ln=s((()=>{cn(),$=sn.getInstance()})),un=l({DiagConsoleLogger:()=>Ce,DiagLogLevel:()=>y,INVALID_SPANID:()=>Ze,INVALID_SPAN_CONTEXT:()=>F,INVALID_TRACEID:()=>Qe,ProxyTracer:()=>ht,ProxyTracerProvider:()=>U,ROOT_CONTEXT:()=>w,SamplingDecision:()=>xt,SpanKind:()=>Ct,SpanStatusCode:()=>Tt,TraceFlags:()=>P,ValueType:()=>A,baggageEntryMetadataFromString:()=>ye,context:()=>G,createContextKey:()=>C,createNoopMeter:()=>Te,createTraceState:()=>zt,default:()=>dn,defaultTextMapGetter:()=>We,defaultTextMapSetter:()=>Ge,diag:()=>K,isSpanContextValid:()=>z,isValidSpanId:()=>lt,isValidTraceId:()=>ct,metrics:()=>J,propagation:()=>Z,trace:()=>$}),dn,fn=s((()=>{xe(),T(),we(),b(),He(),Ue(),Ke(),gt(),bt(),St(),wt(),Et(),Xe(),Bt(),V(),I(),Vt(),Ht(),Jt(),on(),ln(),dn={context:G,diag:K,metrics:J,propagation:Z,trace:$}}));export{w as A,ne as B,I as C,Ue as D,A as E,y as F,u as H,b as I,c as L,T as M,ye as N,Te as O,xe as P,s as R,F as S,Xe as T,te as V,xt as _,on as a,z as b,J as c,G as d,Vt as f,wt as g,Ct as h,$ as i,C as j,He as k,K as l,Et as m,fn as n,Z as o,Tt as p,ln as r,Jt as s,un as t,Ht as u,St as v,P as w,ct as x,V as y,l as z};