@npayload/sdk 0.0.0-stage → 5.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +160 -2
- package/dist/chunk-26BFOUGE.mjs +1 -0
- package/dist/chunk-2XQXDEXA.mjs +1 -0
- package/dist/chunk-455C67EN.mjs +1 -0
- package/dist/chunk-4NWQCPI4.mjs +1 -0
- package/dist/chunk-5KFQTEH3.mjs +1 -0
- package/dist/chunk-5SMWYS7Z.mjs +1 -0
- package/dist/chunk-5WGVEULS.mjs +3 -0
- package/dist/chunk-6BBB7BRP.mjs +1 -0
- package/dist/chunk-6HF3N3NR.mjs +1 -0
- package/dist/chunk-6ITUDSL7.mjs +17 -0
- package/dist/chunk-A7HA64P6.mjs +1 -0
- package/dist/chunk-APBVAT7F.mjs +1 -0
- package/dist/chunk-BBHWYMQA.mjs +1 -0
- package/dist/chunk-CJDCY2NH.mjs +1 -0
- package/dist/chunk-CNAIHF3M.mjs +1 -0
- package/dist/chunk-CWBN2DOO.mjs +1 -0
- package/dist/chunk-EXNCOEHS.mjs +1 -0
- package/dist/chunk-FAO3QJC5.mjs +1 -0
- package/dist/chunk-GEJT7NMK.mjs +1 -0
- package/dist/chunk-GGXNXM73.mjs +1 -0
- package/dist/chunk-HTQLUO4J.mjs +1 -0
- package/dist/chunk-I3UZ2FRE.mjs +1 -0
- package/dist/chunk-I7YPDC7V.mjs +2 -0
- package/dist/chunk-IK32U5FV.mjs +1 -0
- package/dist/chunk-JNYV4RW3.mjs +1 -0
- package/dist/chunk-JUXYOKI2.mjs +64 -0
- package/dist/chunk-K3SNPW2B.mjs +9 -0
- package/dist/chunk-KUJJYP3K.mjs +22 -0
- package/dist/chunk-LJNU5QHZ.mjs +1 -0
- package/dist/chunk-LVVHOJLW.mjs +5 -0
- package/dist/chunk-MDW42OG6.mjs +8 -0
- package/dist/chunk-MPYL6HQR.mjs +1 -0
- package/dist/chunk-MW4TLR2T.mjs +1 -0
- package/dist/chunk-O7HHWVMT.mjs +1 -0
- package/dist/chunk-OA73YMB6.mjs +6 -0
- package/dist/chunk-P5GCOROB.mjs +1 -0
- package/dist/chunk-PKG2R6XN.mjs +1 -0
- package/dist/chunk-PYLSDRRO.mjs +20 -0
- package/dist/chunk-QGH4LHSH.mjs +4 -0
- package/dist/chunk-QHGF2GC6.mjs +1 -0
- package/dist/chunk-SRQQNHSX.mjs +5 -0
- package/dist/chunk-TQFAYJEP.mjs +4 -0
- package/dist/chunk-UJP3Q23X.mjs +1 -0
- package/dist/chunk-UNDT7J2V.mjs +1 -0
- package/dist/chunk-X3VVI7V3.mjs +1 -0
- package/dist/chunk-XLK55DEY.mjs +1 -0
- package/dist/cli/index.d.mts +54 -0
- package/dist/cli/index.d.ts +54 -0
- package/dist/cli/index.js +854 -0
- package/dist/cli/index.mjs +698 -0
- package/dist/events/index.d.mts +10 -0
- package/dist/events/index.d.ts +10 -0
- package/dist/events/index.js +1 -0
- package/dist/events/index.mjs +1 -0
- package/dist/index.d.mts +49687 -0
- package/dist/index.d.ts +49687 -0
- package/dist/index.js +2 -0
- package/dist/index.mjs +2 -0
- package/package.json +120 -4
|
@@ -0,0 +1,854 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";var aC=Object.create;var fs=Object.defineProperty;var cC=Object.getOwnPropertyDescriptor;var lC=Object.getOwnPropertyNames;var dC=Object.getPrototypeOf,uC=Object.prototype.hasOwnProperty;var s=(e,t)=>fs(e,"name",{value:t,configurable:!0});var P=(e,t)=>()=>(e&&(t=e(e=0)),t);var pC=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),me=(e,t)=>{for(var r in t)fs(e,r,{get:t[r],enumerable:!0})},wS=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of lC(t))!uC.call(e,n)&&n!==r&&fs(e,n,{get:()=>t[n],enumerable:!(o=cC(t,n))||o.enumerable});return e};var K=(e,t,r)=>(r=e!=null?aC(dC(e)):{},wS(t||!e||!e.__esModule?fs(r,"default",{value:e,enumerable:!0}):r,e)),mC=e=>wS(fs({},"__esModule",{value:!0}),e);var kS=P(()=>{"use strict"});var ES=P(()=>{"use strict"});function Oc(e){return e instanceof gs}var SS,Em,gs,$c=P(()=>{"use strict";SS=require("util"),Em="[REDACTED_DPOP_PRIVATE_JWK]",gs=class{static{s(this,"DpopPrivateJwk")}#e;constructor(t){if(!t||typeof t!="object")throw new TypeError("DpopPrivateJwk requires a JsonWebKey");if(t.kty!=="EC"||t.crv!=="P-256")throw new TypeError(`DpopPrivateJwk requires kty=EC, crv=P-256 (got kty=${t.kty}, crv=${t.crv})`);if(typeof t.d!="string"||t.d.length===0)throw new TypeError("DpopPrivateJwk requires the private `d` field");this.#e=t}get publicJwk(){let{d:t,...r}=this.#e;return r}get crv(){return this.#e.crv}unsafeUse(t){return t(this.#e)}toJSON(){return Em}[SS.inspect.custom](){return Em}toString(){return Em}};s(Oc,"isDpopPrivateJwk")});function Cc(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),r="";for(let o=0;o<t.length;o++)r+=String.fromCharCode(t[o]);return Buffer.from(r,"binary").toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function PS(e){return Buffer.from(e,"utf8").toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function fC(e){let t=await ln.webcrypto.subtle.digest("SHA-256",Sm.encode(e));return Cc(t)}async function Do(){let e=await ln.webcrypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!0,["sign","verify"]),t=await ln.webcrypto.subtle.exportKey("jwk",e.publicKey),r=await ln.webcrypto.subtle.exportKey("jwk",e.privateKey);return{publicJwk:t,privateJwk:r}}function gC(e){let t={EC:["kty","crv","x","y"],RSA:["kty","n","e"],OKP:["kty","crv","x"]},r=e,o=typeof e.kty=="string"?t[e.kty]:void 0;if(o){let u={};for(let m of o)r[m]!==void 0&&(u[m]=r[m]);return u}let{d:n,key_ops:i,ext:a,use:c,alg:l,...d}=r;return d}async function Nc(e){let t=e,r={EC:["crv","kty","x","y"],RSA:["e","kty","n"],OKP:["crv","kty","x"]},o=typeof t.kty=="string"?t.kty:"",n=r[o];if(!n)throw new TypeError(`jwkThumbprint: unsupported key type ${JSON.stringify(t.kty)}`);let i={};for(let c of n){if(typeof t[c]!="string"||t[c].length===0)throw new TypeError(`jwkThumbprint: the ${o} key carries no "${c}" member`);i[c]=t[c]}let a=await ln.webcrypto.subtle.digest("SHA-256",Sm.encode(JSON.stringify(i)));return Cc(a)}function hC(e){if(e)return e();let t=ln.webcrypto.getRandomValues(new Uint8Array(16));return Cc(t)}function yC(e){try{let t=new URL(e);return t.hash="",t.search="",t.toString()}catch{return e}}async function Pm(e,t){let r=t.now?Math.floor(t.now()/1e3):Math.floor(Date.now()/1e3),o={typ:"dpop+jwt",alg:"ES256",jwk:gC(e.publicJwk)},n={htm:t.method.toUpperCase(),htu:yC(t.url),iat:r,jti:hC(t.randomJti)};t.accessToken&&(n.ath=await fC(t.accessToken)),t.nonce&&(n.nonce=t.nonce);let i=PS(JSON.stringify(o)),a=PS(JSON.stringify(n)),c=`${i}.${a}`,l=await vC(e.privateJwk),d=await ln.webcrypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},l,Sm.encode(c));return`${c}.${Cc(d)}`}async function vC(e){if(Oc(e)){let t=IS.get(e);if(t)return t;let r=await e.unsafeUse(o=>ln.webcrypto.subtle.importKey("jwk",o,{name:"ECDSA",namedCurve:"P-256"},!1,["sign"]));return IS.set(e,r),r}return ln.webcrypto.subtle.importKey("jwk",e,{name:"ECDSA",namedCurve:"P-256"},!1,["sign"])}var ln,Sm,IS,Im=P(()=>{"use strict";ln=require("crypto");$c();Sm=new TextEncoder;s(Cc,"b64url");s(PS,"b64urlFromString");s(fC,"sha256B64Url");s(Do,"generateDpopKeyPair");s(gC,"publicHalf");s(Nc,"jwkThumbprint");s(hC,"newJti");s(yC,"canonicalHtu");s(Pm,"signDpopProof");IS=new WeakMap;s(vC,"resolveSigningKey")});function Fr(e){return typeof e=="string"&&bC.includes(e.toLowerCase())}function zr(e){return typeof e=="string"&&wC.includes(e.toLowerCase())}function or(e){if(e===null||typeof e!="object")return;let t=e,r=t.error!==null&&typeof t.error=="object"?t.error:void 0;for(let o of[r?.code,t.code,typeof t.error=="string"?t.error:void 0,t.reason])if(Fr(o)||zr(o))return o}var le,ze,rr,hs,dn,Go,Lc,Uo,Bt,Nn,Dc,bC,wC,Et,rt,TS,xS,_S,jo,Gc,St=P(()=>{"use strict";le=class extends Error{static{s(this,"NPayloadError")}code;requestId;status;constructor(t,r){super(t),this.name=this.constructor.name,this.code=r.code,this.requestId=r.requestId,this.status=r.status}isRetryable(){return this.status==null?!1:this.status===408||this.status===429?!0:this.status>=500&&this.status<600}},ze=class extends le{static{s(this,"AuthError")}},rr=class extends le{static{s(this,"AuthScopeError")}isRetryable(){return!1}},hs=class extends le{static{s(this,"NotFoundError")}isRetryable(){return!1}},dn=class extends le{static{s(this,"ValidationError")}details;constructor(t,r){super(t,r),this.details=r.details}isRetryable(){return!1}},Go=class extends le{static{s(this,"RateLimitedError")}retryAfterMs;constructor(t,r){super(t,r),this.retryAfterMs=r.retryAfterMs}isRetryable(){return!0}},Lc=class extends le{static{s(this,"ConflictError")}isRetryable(){return!1}},Uo=class extends le{static{s(this,"ServerError")}isRetryable(){return!0}},Bt=class extends le{static{s(this,"NetworkError")}isRetryable(){return!0}},Nn=class extends le{static{s(this,"TimeoutError")}isRetryable(){return!0}},Dc=class extends le{static{s(this,"PlanRequiredError")}product;upgradeUrl;constructor(t,r){super(t,{code:r.code,status:402,...r.requestId!==void 0?{requestId:r.requestId}:{}}),this.product=r.product,this.upgradeUrl=r.upgradeUrl}isRetryable(){return!1}},bC=["source_network_not_allowed","source_network_not_declared"],wC=["thumbprint_not_bound"];s(Fr,"isSourceNotAllowedCode");s(zr,"isFingerprintNotEnrolledCode");s(or,"networkRuleCodeOf");Et=class extends le{static{s(this,"SourceNotAllowedError")}reason;constructor(t,r){super(t,{code:r.code,status:r.status??403,...r.requestId!==void 0?{requestId:r.requestId}:{}}),this.reason=r.code.toLowerCase()==="source_network_not_declared"?"not_declared":"not_allowed"}isRetryable(){return!1}},rt=class extends le{static{s(this,"FingerprintNotEnrolledError")}fingerprint;constructor(t,r){super(t,{code:r.code,status:r.status??403,...r.requestId!==void 0?{requestId:r.requestId}:{}}),this.fingerprint=r.fingerprint}isRetryable(){return!1}},TS="npayload refused this call: it came from a network this app environment does not allow. An administrator can add the network in the dashboard under Settings > Security > Networks.",xS="npayload refused this call: this app environment has no network yet, so its keys cannot be used. An administrator can add one in the dashboard under Settings > Security > Networks.",_S="npayload refused this call: this instance's key fingerprint is not enrolled for this API key. An administrator can open the key's enrollment window in the dashboard under Developers > API keys, then start this instance again.",jo=class extends le{static{s(this,"CircuitOpenError")}isRetryable(){return!1}},Gc=class extends le{static{s(this,"ClockDriftError")}driftMs;maxDriftMs;constructor(t,r){let o=Math.round(Math.abs(t)/1e3);super(`local clock is ${o} s ${t>0?"behind":"ahead of"} the server (allowed skew ${Math.round(r/1e3)} s) \u2014 authenticated requests are refused until the clock is corrected`,{code:"clock_drift"}),this.driftMs=t,this.maxDriftMs=r}}});function Uc(e){let{status:t,body:r,headers:o}=e,n=o.get("x-request-id")??o.get("x-npayload-request-id")??EC(r)??void 0,i=typeof r=="object"&&r!==null?r:null,a=Mo(kC(i)??SC(t)),c=Mo(_m(i)??PC(t)),l={code:a,status:t,...n!==void 0?{requestId:n}:{}};if(t===402||a==="PLAN_REQUIRED"){let u=Tm(i),m=xm(u?.product),p=xm(u?.upgradePath)??xm(u?.upgradeUrl);return new Dc(c,{code:a,...n!==void 0?{requestId:n}:{},...m!==void 0?{product:m}:{},...p!==void 0?{upgradeUrl:p}:{}})}let d=Fr(a)||zr(a)?a:or(i);if(d!==void 0&&Fr(d)){let u=d.toLowerCase()==="source_network_not_declared";return new Et(Mo(_m(i)??(u?xS:TS)),{code:d,status:t,...n!==void 0?{requestId:n}:{}})}if(d!==void 0&&zr(d))return new rt(Mo(_m(i)??_S),{code:d,status:t,...n!==void 0?{requestId:n}:{}});switch(t){case 400:case 422:{let u=Tm(i);return new dn(c,{...l,...u!==void 0?{details:u}:{}})}case 401:return new ze(c,l);case 403:{let u=Tm(i)?.reason;return a.toLowerCase().includes("scope")||typeof u=="string"&&u.toLowerCase().includes("scope")?new rr(c,l):new ze(c,l)}case 404:return new hs(c,l);case 409:return new Lc(c,l);case 429:{let u=IC(o,i);return new Go(c,{...l,...u!==void 0?{retryAfterMs:u}:{}})}default:return t>=500&&t<600?new Uo(c,l):new le(c,l)}}function RS(e){if(e instanceof le)return e;if(e instanceof Error){let t=e.name;return t==="AbortError"?new Nn("Request aborted (timeout)",{code:"request_timeout"}):t==="TimeoutError"?new Nn("Request timed out",{code:"request_timeout"}):t==="TypeError"?new Bt(`Network error: ${Mo(e.message)}`,{code:"network_error"}):new Bt(Mo(e.message),{code:"network_error"})}return new Bt("Unknown network error",{code:"network_error"})}function ys(e){return e&&typeof e.error=="object"&&e.error!==null?e.error:void 0}function kC(e){if(!e)return null;let t=ys(e);return t?.code?t.code:e.code?e.code:null}function Tm(e){if(!e)return;let t=ys(e)?.details;if(t&&typeof t=="object")return t;if(e.details&&typeof e.details=="object")return e.details}function xm(e){return typeof e=="string"&&e.length>0?e:void 0}function _m(e){if(!e)return null;let t=ys(e);return t?.message?t.message:e.message?e.message:e.error_description?e.error_description:null}function EC(e){if(typeof e!="object"||e===null)return;let t=ys(e);return t?.request_id??t?.requestId??e.request_id??e.requestId}function SC(e){switch(e){case 400:case 422:return"validation_error";case 401:return"unauthorized";case 402:return"payment_required";case 403:return"forbidden";case 404:return"not_found";case 409:return"conflict";case 429:return"rate_limited";default:return e>=500?"server_error":"request_failed"}}function PC(e){return`Request failed with status ${e}`}function IC(e,t){let r=e.get("retry-after");if(r){let i=Number(r);if(!Number.isNaN(i)&&i>=0)return Math.round(i*1e3);let a=Date.parse(r);if(!Number.isNaN(a)){let c=a-Date.now();if(c>0)return c}}let o=ys(t),n=o?.retry_after_ms??o?.retryAfterMs??void 0;return typeof n=="number"&&n>=0?n:void 0}function Mo(e){return e.replace(/\bBearer\s+[A-Za-z0-9._-]+/gi,"Bearer [REDACTED]").replace(/\bDPoP\s+[A-Za-z0-9._-]+/gi,"DPoP [REDACTED]").replace(/\bBasic\s+[A-Za-z0-9+/=._-]+/gi,"Basic [REDACTED]").replace(/\b[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}\b/g,"[JWT_REDACTED]").replace(/(\b(?:Set-)?Cookie:\s*)[^;\r\n]+/gi,"$1[REDACTED]").replace(/("d"\s*:\s*")[^"]+(")/g,"$1[REDACTED]$2").replace(/(["']?(?:hmac|secret|token|api[_-]?key|auth[_-]?token|private[_-]?key|key)["']?\s*[:=]\s*["'])[^"']+(["'])/gi,"$1[REDACTED]$2").replace(/\b([A-Z][A-Z0-9_]*(?:TOKEN|KEY|SECRET|PASSWORD|PWD)[A-Z0-9_]*)=\S+/g,"$1=[REDACTED]")}var jc=P(()=>{"use strict";St();s(Uc,"errorFromResponse");s(RS,"errorFromException");s(ys,"nestedError");s(kC,"envelopeCode");s(Tm,"envelopeDetails");s(xm,"nonEmptyString");s(_m,"envelopeMessage");s(EC,"extractRequestId");s(SC,"defaultCodeForStatus");s(PC,"defaultMessageForStatus");s(IC,"parseRetryAfterMs");s(Mo,"redactSecretLike")});function AC(){let e={};for(let[t,r]of Object.entries(Mc)){let o=t.replace(/^org:/,"");e[o]=r}return e}function NC(e){return $C[e]}function LC(e){let t=new Set,r=new Map,o=[];for(let i of e.ops){let a=NC(i.op);if(e.status!=="not-built"){if(i.phase==="mount"||i.gatesMount===!0)for(let c of a)t.add(c);if(i.phase==="action"){let c=i.action;if(c===void 0)throw new Error(`componentSource: action op "${i.op}" has no \`action\` key`);let l=r.get(c)??new Set;for(let d of a)l.add(d);r.set(c,l)}o.push(`${i.op} \u2192 ${a.join(", ")}`+(i.phase==="action"?` (action: ${i.action}${i.gatesMount?", gates mount":""})`:" (mount)")+(i.unwired?" (not offered by the component)":""))}}let n=Object.fromEntries([...r.entries()].map(([i,a])=>[i,AS(a)]));return{label:e.label,requiredScopes:AS(t),...e.composedOf?{composedOf:e.composedOf}:{},...Object.keys(n).length>0?{actionScopes:n}:{},modeFloor:e.modeFloor,status:e.status,...e.rung!==void 0?{rung:e.rung}:{},...e.aspirationalScope!==void 0?{aspirationalScope:e.aspirationalScope}:{},evidence:o}}function OS(e){let t=new Set,r=[],o=s(n=>{if(t.has(n))return;t.add(n);let i=vs[n];if(i){if(i.composedOf){for(let a of i.composedOf)o(a);return}i.status==="live"&&r.push(i)}},"visit");for(let n of e)o(n);return r}function $S(e){let t=new Set;for(let r of OS(e))for(let o of r.requiredScopes)t.add(o);return[...t].sort()}function CS(e){let t=new Set;for(let r of OS(e))for(let o of Object.values(r.actionScopes??{}))for(let n of o)t.add(n);return[...t].sort()}function ir(e){return e.replace(/^org:/,"")}function Om(e,t){return e.includes(t)}function $m(e){return typeof e!="string"||e.length===0||e==="*"||e.endsWith(":*")?!1:jC.has(ir(e))}function MC(e,t){let r=e.length,o=t.length,n=Array.from({length:o+1},(i,a)=>a);for(let i=1;i<=r;i++){let a=n[0];n[0]=i;for(let c=1;c<=o;c++){let l=n[c];n[c]=e[i-1]===t[c-1]?a:1+Math.min(a,n[c],n[c-1]),a=l}}return n[o]}function NS(e){let t=ir(e),r=null,o=1/0;for(let n of Am){let i=MC(t,n);i<o&&(o=i,r=n)}return r!==null&&o<=Math.max(2,Math.floor(t.length/2))?r:null}function LS(e,t){let r=ir(t),o=e.map(ir);if(Om(o,r))return!0;let[n,i]=r.split(":");return!(n==="events"||DC.has(n))||!i?!1:!!(o.includes("events:admin")||i==="read"&&o.includes("events:read")||i==="write"&&o.includes("events:write")||(i==="read"||i==="write")&&o.includes(`${n}:admin`))}function DS(e,t){let r=ir(t),o=e.map(ir);if(Om(o,r))return!0;let[n,i]=r.split(":");return!GC.has(n)||!i?!1:!!(i!=="execute"&&o.includes("pipes:admin")||n==="credentials"&&o.includes("credentials:admin"))}function GS(e,t){let r=ir(t),o=e.map(ir);if(Om(o,r))return!0;let[n,i]=r.split(":");return!(n==="connect"||UC.has(n))||!i?!1:!!(o.includes("connect:admin")||i==="read"&&o.includes("connect:read")||i==="write"&&o.includes("connect:write")||(i==="read"||i==="write")&&o.includes(`${n}:admin`))}function bs(e){let t=e.trim().toLowerCase();if(t==="authorization"||t==="proxy-authorization"||t==="auth"||t==="x-api-key"||t==="api-key"||t==="apikey"||t==="cookie"||t==="password"||t==="signature"||t.endsWith("-token")||t.endsWith("-secret")||t.endsWith("-api-key")||t.endsWith("-auth")||t.endsWith("-password")||t.endsWith("-secret-key")||t.endsWith("-access-key")||t.endsWith("-signing-key")||t.endsWith("-private-key"))return!0;let r=t.split("-");return r.includes("secret")||r.includes("token")?!0:/-signature(-[a-z0-9]+)?$/.test(t)}var Mc,qc,TC,xC,_C,RC,Rm,Am,Gq,Uq,OC,jq,Mq,qq,Fq,$C,CC,AS,vs,DC,GC,UC,zq,jC,qo=P(()=>{"use strict";Mc={"org:apps:admin":{description:"Administer all apps in the org (bypass app-level RLS)",category:"security",tier:"admin"},"org:account:read":{description:"Read account surfaces for the bound app (environments, app metadata)",category:"security",tier:"developer"},"org:account:write":{description:"Manage account resources for the bound app (create environments, clone)",category:"security",tier:"developer"},"org:events:read":{description:"Read all Events resources (roll-up over every events:*:read scope)",category:"events",tier:"developer"},"org:events:write":{description:"Create/update/publish across all Events resources (roll-up over every events:*:write scope)",category:"events",tier:"developer"},"org:events:admin":{description:"Administer all Events resources (roll-up \u2014 satisfies every Events scope: read, write, and destructive)",category:"events",tier:"admin"},"org:channels:read":{description:"List and view channels",category:"events",tier:"developer"},"org:channels:write":{description:"Create and update channels",category:"events",tier:"developer"},"org:channels:admin":{description:"Delete and archive channels",category:"events",tier:"admin"},"org:messages:read":{description:"Read message history",category:"events",tier:"developer"},"org:messages:write":{description:"Publish messages",category:"events",tier:"developer"},"org:messages:admin":{description:"Delete and purge messages; manage message retention",category:"events",tier:"admin"},"org:subscriptions:read":{description:"List and view subscriptions",category:"events",tier:"developer"},"org:subscriptions:write":{description:"Create and update subscriptions",category:"events",tier:"developer"},"org:subscriptions:admin":{description:"Delete subscriptions and manage delivery tokens",category:"events",tier:"admin"},"org:dlq:read":{description:"View dead-letter queue entries",category:"events",tier:"developer"},"org:dlq:write":{description:"Reprocess and retry DLQ entries",category:"events",tier:"developer"},"org:dlq:admin":{description:"Purge and discard DLQ entries",category:"events",tier:"admin"},"org:consumer_groups:read":{description:"List and view consumer groups",category:"events",tier:"developer"},"org:consumer_groups:write":{description:"Create and update consumer groups",category:"events",tier:"developer"},"org:consumer_groups:admin":{description:"Delete consumer groups and reset offsets",category:"events",tier:"admin"},"org:streams:read":{description:"Read streams and consumer offsets",category:"events",tier:"developer"},"org:streams:write":{description:"Create streams and commit offsets",category:"events",tier:"developer"},"org:streams:admin":{description:"Delete streams and truncate offsets",category:"events",tier:"admin"},"org:snapshots:read":{description:"View subscription snapshots",category:"events",tier:"developer"},"org:snapshots:write":{description:"Create subscription snapshots",category:"events",tier:"developer"},"org:snapshots:admin":{description:"Delete subscription snapshots",category:"events",tier:"admin"},"org:scheduled:read":{description:"View scheduled messages",category:"events",tier:"developer"},"org:scheduled:write":{description:"Schedule messages for future delivery",category:"events",tier:"developer"},"org:scheduled:admin":{description:"Cancel scheduled messages",category:"events",tier:"admin"},"org:kv:read":{description:"Read compacted (key-value) channel state",category:"events",tier:"developer"},"org:kv:write":{description:"Write compacted (key-value) channel state",category:"events",tier:"developer"},"org:kv:admin":{description:"Delete compacted keys and purge KV state",category:"events",tier:"admin"},"org:cross_channels:read":{description:"View cross-channel (cross-cell) routing and remotes",category:"events",tier:"developer"},"org:cross_channels:write":{description:"Configure cross-channel routing and remote definitions",category:"events",tier:"developer"},"org:cross_channels:admin":{description:"Delete cross-channel routes and manage replication",category:"events",tier:"admin"},"org:archive:read":{description:"View archived (cold-tier) messages",category:"events",tier:"developer"},"org:archive:write":{description:"Archive live messages; restore and replay archived messages into channels",category:"events",tier:"developer"},"org:archive:admin":{description:"Restore and purge archived messages",category:"events",tier:"admin"},"org:time_travel:read":{description:"Query historical channel state (time travel)",category:"events",tier:"developer"},"org:time_travel:write":{description:"Create and update time-travel checkpoints and replays",category:"events",tier:"developer"},"org:time_travel:admin":{description:"Delete time-travel checkpoints and purge historical state",category:"events",tier:"admin"},"org:storage_policies:read":{description:"View storage tier policies",category:"events",tier:"developer"},"org:storage_policies:write":{description:"Create and update storage tier policies",category:"events",tier:"developer"},"org:storage_policies:admin":{description:"Delete storage tier policies (admin roll-up: satisfies read + write)",category:"events",tier:"admin"},"org:catalogue:read":{description:"View event catalogue (schema registry) entries",category:"events",tier:"developer"},"org:catalogue:write":{description:"Register and version event types in the catalogue",category:"events",tier:"developer"},"org:catalogue:admin":{description:"Deprecate and delete event catalogue entries",category:"events",tier:"admin"},"org:exchanges:read":{description:"List and view exchanges",category:"events",tier:"developer"},"org:exchanges:write":{description:"Create exchanges and bind channels",category:"events",tier:"developer"},"org:exchanges:admin":{description:"Delete exchanges and remove bindings",category:"events",tier:"admin"},"org:deliveries:read":{description:"View delivery status and history",category:"messaging",tier:"developer"},"org:deliveries:write":{description:"Retry and reprocess failed deliveries",category:"messaging",tier:"admin"},"org:webhooks:read":{description:"View inbound webhook configurations",category:"events",tier:"developer"},"org:webhooks:write":{description:"Create, update, and pause inbound webhooks",category:"events",tier:"developer"},"org:webhooks:admin":{description:"Rotate and reveal inbound webhook signing secrets; revoke webhooks",category:"events",tier:"admin"},"org:notify:read":{description:"Read Notifications resources (dispatches, inbox, preferences, templates, suppression, push tokens)",category:"notifications",tier:"developer"},"org:notify:write":{description:"Send and manage Notifications (dispatch, cancel, inbox, preferences, push tokens)",category:"notifications",tier:"developer"},"org:notify:admin":{description:"Administer Notifications (templates, suppression list, provider webhooks)",category:"notifications",tier:"admin"},"org:adapters:read":{description:"View adapter configurations",category:"adapters",tier:"developer"},"org:adapters:write":{description:"Create, update, and delete adapters",category:"adapters",tier:"admin"},"org:observability:read":{description:"View connector status",category:"adapters",tier:"developer"},"org:observability:write":{description:"Configure connectors (Datadog, SIEM, etc.)",category:"adapters",tier:"admin"},"org:tools:read":{description:"View tool definitions",category:"ai",tier:"developer"},"org:tools:execute":{description:"Execute tools via ASP",category:"ai",tier:"developer"},"org:asp:read":{description:"View ASP sessions",category:"ai",tier:"developer"},"org:asp:write":{description:"Create and update ASP sessions",category:"ai",tier:"developer"},"org:feed:read":{description:"Read all Feed resources (browse listings, view own subscriptions; roll-up over every feed:*:read scope)",category:"feed",tier:"developer"},"org:feed:write":{description:"Manage Feed subscriptions (subscribe, cancel, pause, resume, convert trial\u2192paid; roll-up over every feed:*:write scope)",category:"feed",tier:"developer"},"org:feed:admin":{description:"Administer all Feed resources (roll-up \u2014 satisfies every Feed permission: read, write, and destructive)",category:"feed",tier:"admin"},"org:publishers:read":{description:"View publisher profile",category:"feed",tier:"developer"},"org:publishers:write":{description:"Create and update publisher profile",category:"feed",tier:"admin"},"org:listings:read":{description:"View own listings",category:"feed",tier:"developer"},"org:listings:write":{description:"Create, publish, and depublish listings",category:"feed",tier:"admin"},"org:oauth_clients:read":{description:"View OAuth clients",category:"platform",tier:"developer"},"org:oauth_clients:write":{description:"Create, rotate, and revoke OAuth clients",category:"platform",tier:"developer"},"org:oauth_clients:admin":{description:"Assign admin-tier scopes to OAuth clients",category:"platform",tier:"admin"},"org:settings:read":{description:"View organization settings",category:"platform",tier:"developer"},"org:settings:write":{description:"Update organization settings",category:"platform",tier:"admin"},"org:members:read":{description:"View organization members",category:"platform",tier:"developer"},"org:members:admin":{description:"Invite, remove, and change member roles",category:"platform",tier:"admin"},"org:billing:read":{description:"View plans, invoices, usage",category:"billing",tier:"developer"},"org:billing:write":{description:"Add and update payment methods; create subscriptions",category:"billing",tier:"developer"},"org:billing:admin":{description:"Change plans; manage payouts, refunds, and credits",category:"billing",tier:"owner"},"org:analytics:read":{description:"View analytics (rollups, summaries, event tail, sketches)",category:"analytics",tier:"developer"},"org:audit:read":{description:"View audit logs",category:"security",tier:"developer"},"org:federation:read":{description:"View federation consents",category:"security",tier:"developer"},"org:federation:admin":{description:"Request, approve, and revoke federation",category:"security",tier:"owner"},"org:platform:read":{description:"View platform partner surfaces (apps, tenants, consents)",category:"platform",tier:"developer"},"org:connect:read":{description:"All Connect read surfaces (roll-up over every Connect resource)",category:"connect",tier:"developer"},"org:connect:write":{description:"All Connect write surfaces (roll-up over every Connect resource)",category:"connect",tier:"admin"},"org:connect:admin":{description:"Administer Connect \u2014 satisfies every Connect permission (roll-up)",category:"connect",tier:"owner"},"org:grants:read":{description:"View cross-org access grants, trust scores, usage",category:"connect",tier:"developer"},"org:grants:write":{description:"Request and resume access grants",category:"connect",tier:"admin"},"org:grants:admin":{description:"Approve, reject, and revoke cross-org access grants",category:"connect",tier:"admin"},"org:bridges:read":{description:"View identity bridges and bridge metrics",category:"connect",tier:"developer"},"org:bridges:write":{description:"Create, confirm, resync, suspend, consent identity bridges",category:"connect",tier:"admin"},"org:bridges:admin":{description:"Archive identity bridges (destructive tier)",category:"connect",tier:"owner"},"org:tenant_approvals:read":{description:"View tenant approvals and per-platform tenants",category:"connect",tier:"developer"},"org:tenant_approvals:write":{description:"Initiate and request tenant approvals",category:"connect",tier:"admin"},"org:tenant_approvals:admin":{description:"Approve, revoke, transfer tenant approvals; policy overrides",category:"connect",tier:"admin"},"org:consents:read":{description:"View platform-connect consents and consent challenges",category:"connect",tier:"developer"},"org:consents:write":{description:"Initiate, verify, revoke platform-connect consents",category:"connect",tier:"developer"},"org:profile:read":{description:"View the app's Connect profile and validation preview",category:"connect",tier:"developer"},"org:profile:write":{description:"Update the app's Connect profile (visibility, metadata)",category:"connect",tier:"developer"},"org:explore:read":{description:"Browse and search Connect Explore (read-only surface)",category:"connect",tier:"developer"},"org:partner:read":{description:"View partner governance: audit feed, governed apps, approvals",category:"connect",tier:"developer"},"org:partner:admin":{description:"Partner governance: freeze, reinstate, delist apps (no write tier \u2014 governance, not CRUD)",category:"connect",tier:"owner"},"org:alert_rules:read":{description:"View Connect alert rules",category:"connect",tier:"developer"},"org:alert_rules:write":{description:"Create and update Connect alert rules",category:"connect",tier:"developer"},"org:infrastructure:read":{description:"View cell assignments and health",category:"security",tier:"developer"},"org:infrastructure:admin":{description:"Request provisioning and manage cells",category:"security",tier:"owner"},"org:metrics:read":{description:"View analytics dashboards",category:"security",tier:"developer"},"org:embed:read":{description:"Read embed origin registry",category:"connect",tier:"developer"},"org:embed:write":{description:"Mint/revoke embed sessions and manage embed origins",category:"connect",tier:"developer"},"org:agents:read":{description:"List and view AI agents",category:"primus",tier:"developer"},"org:agents:execute":{description:"Run agent executions (chat, goal)",category:"primus",tier:"developer"},"org:conversations:read":{description:"View agent conversations",category:"primus",tier:"developer"},"org:memory:read":{description:"Search and view agent memories",category:"primus",tier:"developer"},"org:skills:read":{description:"View skill definitions",category:"primus",tier:"developer"},"org:executions:read":{description:"View execution history and status",category:"primus",tier:"developer"},"org:triggers:read":{description:"View agent triggers",category:"primus",tier:"developer"},"org:approvals:read":{description:"View approval queue",category:"primus",tier:"developer"},"org:guardrails:read":{description:"View kill switch and defense config",category:"primus",tier:"developer"},"org:brain:read":{description:"View LLM provider configuration",category:"primus",tier:"developer"},"org:tenants:read":{description:"List and view tenants",category:"primus",tier:"developer"},"org:discovery:read":{description:"View ASP discovery settings",category:"primus",tier:"developer"},"org:discovery:write":{description:"Enable or disable agent discovery",category:"primus",tier:"admin"},"org:compute:read":{description:"View skill runner environments",category:"primus",tier:"developer"},"org:compute:write":{description:"Provision compute environments",category:"primus",tier:"developer"},"org:compute:admin":{description:"Decommission compute environments",category:"primus",tier:"admin"},"org:learning:read":{description:"View learning patterns and feedback",category:"primus",tier:"developer"},"org:teams:read":{description:"View team hierarchy",category:"primus",tier:"developer"},"org:npp:read":{description:"View NPP wire security (per-app DPoP keys + hardware attestation status)",category:"security",tier:"developer"},"org:npp:write":{description:"Self-enroll the app's own NPP DPoP key",category:"security",tier:"developer"},"org:npp:admin":{description:"Rotate NPP DPoP keys + enroll/manage hardware attestation",category:"security",tier:"admin"},"org:keys:write":{description:"Register the app's own NPP DPoP/Ed25519 signing key (connect-time self-enrollment)",category:"security",tier:"developer"},"org:pipes:read":{description:"View workflows, executions, connectors, credential metadata",category:"pipes",tier:"developer"},"org:pipes:write":{description:"Create, update, pause, activate, archive, delete workflows",category:"pipes",tier:"developer"},"org:pipes:execute":{description:"Trigger and cancel workflow executions",category:"pipes",tier:"developer"},"org:pipes:admin":{description:"Full Pipes control \u2014 workflow governance + every pipes/credentials op (admin roll-up)",category:"pipes",tier:"admin"},"org:credentials:read":{description:"List connector credentials (metadata only \u2014 never the secret)",category:"pipes",tier:"developer"},"org:credentials:write":{description:"Store, update, rotate, revoke, delete, test connector credentials",category:"pipes",tier:"developer"},"org:credentials:admin":{description:"Full connector-credential control (admin roll-up \u2014 satisfies credentials read + write)",category:"pipes",tier:"admin"},"org:agents:write":{description:"Create, update, pause, activate, invoke/run agents; assign/unassign skills (product-level write tier)",category:"primus",tier:"developer"},"org:agents:admin":{description:"Destructive agent governance \u2014 archive and remove agents (product-level admin tier)",category:"primus",tier:"admin"},"org:conversations:write":{description:"Create, update, send, and archive conversations",category:"primus",tier:"developer"},"org:conversations:admin":{description:"Remove conversations (destructive)",category:"primus",tier:"admin"},"org:memory:write":{description:"Store, update, and quarantine agent memories",category:"primus",tier:"developer"},"org:memory:admin":{description:"Bulk-delete and purge memories (destructive)",category:"primus",tier:"admin"},"org:skills:write":{description:"Create, update, enable, and synthesize skills",category:"primus",tier:"developer"},"org:skills:admin":{description:"Remove skills and runner environments (destructive)",category:"primus",tier:"admin"},"org:tools:write":{description:"Register, update, and connect tools and MCP servers",category:"primus",tier:"developer"},"org:tools:admin":{description:"Remove tools and disconnect MCP servers (destructive)",category:"primus",tier:"admin"},"org:executions:execute":{description:"Start and run agent executions",category:"primus",tier:"developer"},"org:executions:admin":{description:"Cancel and remove executions (destructive)",category:"primus",tier:"admin"},"org:triggers:write":{description:"Create, update, and enable triggers",category:"primus",tier:"developer"},"org:triggers:admin":{description:"Remove and archive triggers (destructive)",category:"primus",tier:"admin"},"org:approvals:write":{description:"Create approval requests",category:"primus",tier:"developer"},"org:approvals:admin":{description:"Approve or reject agent actions (governance)",category:"primus",tier:"admin"},"org:guardrails:write":{description:"Update guardrail configuration",category:"primus",tier:"developer"},"org:guardrails:admin":{description:"Activate the kill switch and set thresholds (governance)",category:"primus",tier:"admin"},"org:brain:write":{description:"Configure LLM providers and store provider keys",category:"primus",tier:"developer"},"org:brain:admin":{description:"Delete brain configuration (destructive)",category:"primus",tier:"admin"},"org:teams:write":{description:"Create teams and assign specialists",category:"primus",tier:"developer"},"org:teams:admin":{description:"Remove and restructure teams (destructive)",category:"primus",tier:"admin"},"org:tenants:write":{description:"Create and update tenants",category:"primus",tier:"developer"},"org:tenants:admin":{description:"Suspend and archive tenants (destructive)",category:"primus",tier:"admin"},"org:connections:read":{description:"View third-party connections",category:"primus",tier:"developer"},"org:connections:write":{description:"Create, connect, and reconnect connections",category:"primus",tier:"developer"},"org:connections:admin":{description:"Revoke and remove connections (destructive)",category:"primus",tier:"admin"},"org:learning:write":{description:"Submit feedback and manage learning patterns",category:"primus",tier:"developer"},"org:learning:admin":{description:"Purge learning data (destructive)",category:"primus",tier:"admin"},"org:agent_webhooks:read":{description:"List the agent-event webhook endpoints (never the signing secret)",category:"primus",tier:"developer"},"org:agent_webhooks:write":{description:"Create and remove agent-event webhook endpoints (the signing secret is answered once, on create)",category:"primus",tier:"developer"},"org:audit:admin":{description:"Audit governance (retention, config)",category:"primus",tier:"admin"},"org:connectors:read":{description:"View Primus flow workflows and their executions",category:"primus",tier:"developer"},"org:connectors:write":{description:"Create, update, activate, pause, and delete Primus flow workflows; cancel flow executions",category:"primus",tier:"developer"}},qc=Object.keys(Mc),TC=["agents","conversations","memory","skills","tools","executions","triggers","brain","teams","tenants","connections","approvals","guardrails","learning","agent_webhooks","audit"],xC=["channels","messages","subscriptions","dlq","consumer_groups","streams","snapshots","scheduled","kv","cross_channels","archive","time_travel","storage_policies","catalogue","exchanges","webhooks"],_C=["grants","bridges","tenant_approvals","consents","profile","explore","partner","alert_rules"],RC=["pipes","credentials"];s(AC,"buildScopes");Rm=AC(),Am=Object.keys(Mc).map(e=>e.replace(/^org:/,"")),Gq={developer:Object.entries(Rm).filter(([,e])=>e.tier==="developer").map(([e])=>e),admin:Object.entries(Rm).filter(([,e])=>e.tier==="admin").map(([e])=>e),owner:Object.entries(Rm).filter(([,e])=>e.tier==="owner").map(([e])=>e)},Uq={"publish-only":{label:"Publish Only",description:"Least-privilege publisher: publish messages only \u2014 no channel, subscription, or DLQ access",scopes:["messages:write"],recommended:!0},"read-only":{label:"Read Only",description:"View data without modifications",scopes:["events:read","deliveries:read","npp:read"],recommended:!0},standard:{label:"Standard",description:"Typical SDK usage for publishing and reading events",scopes:["events:read","events:write","deliveries:read"],recommended:!0},pipes:{label:"Pipes (Automation)",description:"Build + run automation workflows: manage workflows, executions, and connector credentials",scopes:["pipes:read","pipes:write","pipes:execute","credentials:read","credentials:write"],recommended:!1},"pipes-readonly":{label:"Pipes \u2014 Read Only",description:"Observe automation: view workflows, executions, governance, and credential metadata \u2014 no changes",scopes:["pipes:read","credentials:read"],recommended:!0},"pipes-operator":{label:"Pipes \u2014 Operator",description:"Author and run workflows (read + write + execute) WITHOUT connector-credential management \u2014 separation of duties",scopes:["pipes:read","pipes:write","pipes:execute"],recommended:!1},"credentials-manager":{label:"Connector Credentials Manager",description:"Manage connector credentials only (read + write) \u2014 store/rotate/revoke secrets without workflow access",scopes:["credentials:read","credentials:write"],recommended:!1},"full-messaging":{label:"Full Events",description:"All Events operations including DLQ/ops, plus delivery + webhook management",scopes:["events:read","events:write","events:admin","deliveries:read","deliveries:write","webhooks:read","webhooks:write"],recommended:!1},"npp-wire":{label:"NPP Wire",description:"Per-app NPP DPoP key + hardware-attestation management",scopes:["npp:read","npp:admin"],recommended:!1},admin:{label:"Admin",description:"Full access: every concrete catalog scope enumerated (incl. the 4 execute scopes). Assign sparingly.",scopes:[...Am],recommended:!1,dangerous:!0}},OC=qc.filter(e=>e.endsWith(":read")),jq=[...OC,"org:metrics:read"],Mq=qc.filter(e=>Mc[e].tier==="developer"),qq=qc.filter(e=>e!=="org:billing:write"&&e!=="org:billing:admin"&&e!=="org:federation:admin"&&e!=="org:infrastructure:admin"&&e!=="org:apps:admin"&&e!=="org:feed:admin"&&e!==""&&e!==""),Fq=[...qc],$C={"DELETE /v1/primus/agents/:agentId":["agents:admin"],"DELETE /v1/primus/brain/config":["brain:admin"],"DELETE /v1/primus/conversations/:conversationId":["conversations:admin"],"DELETE /v1/primus/memory/:memoryId":["memory:admin"],"DELETE /v1/primus/skills/:skillId":["skills:admin"],"DELETE /v1/primus/teams/:teamId":["teams:admin"],"DELETE /v1/primus/tools/:toolId":["tools:admin"],"DELETE /v1/primus/triggers/:triggerId":["triggers:admin"],"DELETE /v1/primus/webhooks/:webhookId":["agent_webhooks:write"],"GET /v1/primus/agent-goals":["agents:read"],"GET /v1/primus/agent-goals/:goalId":["agents:read"],"GET /v1/primus/agents":["agents:read"],"GET /v1/primus/agents/:agentId":["agents:read"],"GET /v1/primus/approvals":["approvals:read"],"GET /v1/primus/approvals/:approvalId":["approvals:read"],"GET /v1/primus/approvals/by-agent":["approvals:read"],"GET /v1/primus/approvals/pending":["approvals:read"],"GET /v1/primus/approvals/pending/count":["approvals:read"],"GET /v1/primus/approvals/pending/summary":["approvals:read"],"GET /v1/primus/brain/config":["brain:read"],"GET /v1/primus/brain/llm-dashboard":["brain:read"],"GET /v1/primus/brain/models":["brain:read"],"GET /v1/primus/brain/usage-dashboard":["brain:read"],"GET /v1/primus/config/export":["agents:admin"],"GET /v1/primus/conversations":["conversations:read"],"GET /v1/primus/conversations/:conversationId":["conversations:read"],"GET /v1/primus/conversations/:conversationId/messages":["conversations:read"],"GET /v1/primus/conversations/by-agent":["conversations:read"],"GET /v1/primus/conversations/stats":["conversations:read"],"GET /v1/primus/delegations/by-delegate":["agents:read"],"GET /v1/primus/delegations/by-delegator":["agents:read"],"GET /v1/primus/delegations/by-team":["agents:read"],"GET /v1/primus/entitlements":["agents:read"],"GET /v1/primus/executions":["executions:read"],"GET /v1/primus/executions/:executionId":["executions:read"],"GET /v1/primus/executions/:executionId/details":["executions:read"],"GET /v1/primus/executions/:executionId/events":["executions:read"],"GET /v1/primus/executions/:executionId/traces":["executions:read"],"GET /v1/primus/executions/by-agent":["executions:read"],"GET /v1/primus/executions/by-conversation":["executions:read"],"GET /v1/primus/executions/pending-approvals":["executions:read"],"GET /v1/primus/executions/stats":["executions:read"],"GET /v1/primus/integrations":["connections:read"],"GET /v1/primus/integrations/:connectionId":["connections:read"],"GET /v1/primus/kill-switch":["guardrails:read"],"GET /v1/primus/kill-switch/:killSwitchId":["guardrails:read"],"GET /v1/primus/kill-switch/active":["guardrails:read"],"GET /v1/primus/kill-switch/check":["guardrails:read"],"GET /v1/primus/kill-switch/status":["guardrails:read"],"GET /v1/primus/learning/feedback":["agents:read"],"GET /v1/primus/learning/feedback/by-agent":["agents:read"],"GET /v1/primus/learning/patterns":["agents:read"],"GET /v1/primus/learning/patterns/by-agent":["agents:read"],"GET /v1/primus/learning/predictions":["agents:read"],"GET /v1/primus/learning/proactive-actions":["agents:read"],"GET /v1/primus/learning/stats":["agents:read"],"GET /v1/primus/mcp-connections":["connections:read"],"GET /v1/primus/mcp-servers":["tools:read"],"GET /v1/primus/mcp-servers/:mcpServerId":["tools:read"],"GET /v1/primus/memories/:memoryId/encryption":["memory:read"],"GET /v1/primus/memory":["memory:read"],"GET /v1/primus/memory/:memoryId":["memory:read"],"GET /v1/primus/memory/by-agent":["memory:read"],"GET /v1/primus/memory/by-conversation":["memory:read"],"GET /v1/primus/memory/quarantined":["memory:read"],"GET /v1/primus/memory/recall":["memory:read"],"GET /v1/primus/memory/store/:memoryId/lineage":["memory:read"],"GET /v1/primus/memory/store/:memoryId/retrieval-history":["memory:read"],"GET /v1/primus/memory/store/by-team":["memory:read"],"GET /v1/primus/memory/store/list":["memory:read"],"GET /v1/primus/memory/store/quarantine-summary":["memory:read"],"GET /v1/primus/memory/store/quarantined":["memory:read"],"GET /v1/primus/metrics":["agents:read"],"GET /v1/primus/metrics/aggregate":["agents:read"],"GET /v1/primus/metrics/system":["agents:read"],"GET /v1/primus/observability/alerts":["agents:read"],"GET /v1/primus/observability/errors":["agents:read"],"GET /v1/primus/observability/errors/by-agent":["agents:read"],"GET /v1/primus/observability/errors/by-execution":["agents:read"],"GET /v1/primus/observability/errors/distribution":["agents:read"],"GET /v1/primus/observability/traces/:traceId":["agents:read"],"GET /v1/primus/overview/active-triggers":["agents:read"],"GET /v1/primus/overview/memory-health":["agents:read"],"GET /v1/primus/overview/metrics-summary":["agents:read"],"GET /v1/primus/overview/stats":["agents:read"],"GET /v1/primus/overview/top-agents":["agents:read"],"GET /v1/primus/self-knowledge":["agents:read"],"GET /v1/primus/self-knowledge/:knowledgeId":["agents:read"],"GET /v1/primus/skill-synthesis":["agents:read"],"GET /v1/primus/skill-synthesis/:skillId":["agents:read"],"GET /v1/primus/skill-synthesis/for-tool":["agents:read"],"GET /v1/primus/skills":["skills:read"],"GET /v1/primus/skills/:skillId":["skills:read"],"GET /v1/primus/skills/:skillId/executions":["skills:read"],"GET /v1/primus/skills/:skillId/stats":["skills:read"],"GET /v1/primus/skills/built-in":["skills:read"],"GET /v1/primus/skills/by-category":["skills:read"],"GET /v1/primus/teams":["teams:read"],"GET /v1/primus/teams/:teamId":["teams:read"],"GET /v1/primus/tenants":["tenants:read"],"GET /v1/primus/tenants/:tenantId":["tenants:read"],"GET /v1/primus/tenants/by-external-id":["tenants:read"],"GET /v1/primus/tools":["tools:read"],"GET /v1/primus/tools/:toolId":["tools:read"],"GET /v1/primus/tools/by-name":["tools:read"],"GET /v1/primus/tools/stats":["tools:read"],"GET /v1/primus/triggers":["triggers:read"],"GET /v1/primus/triggers/:triggerId":["triggers:read"],"GET /v1/primus/triggers/:triggerId/executions":["triggers:read"],"GET /v1/primus/triggers/by-agent":["triggers:read"],"GET /v1/primus/usage/by-tenant":["billing:read"],"GET /v1/primus/usage/history":["billing:read"],"GET /v1/primus/usage/limits":["billing:read"],"GET /v1/primus/usage/summary":["billing:read"],"GET /v1/primus/webhooks":["agent_webhooks:read"],"GET /v1/tools":["tools:read"],"PATCH /v1/primus/agent-goals/:goalId":["agents:write"],"PATCH /v1/primus/agents/:agentId":["agents:write"],"PATCH /v1/primus/conversations/:conversationId":["conversations:write"],"PATCH /v1/primus/memory/:memoryId":["memory:write"],"PATCH /v1/primus/skills/:skillId":["skills:write"],"PATCH /v1/primus/teams/:teamId":["teams:write"],"PATCH /v1/primus/tenants/:tenantId":["tenants:write"],"PATCH /v1/primus/tools/:toolId":["tools:write"],"PATCH /v1/primus/triggers/:triggerId":["triggers:write"],"POST /v1/primus/agent-goals":["agents:write"],"POST /v1/primus/agent-goals/:goalId/progress":["agents:write"],"POST /v1/primus/agent-goals/:goalId/status":["agents:write"],"POST /v1/primus/agents":["agents:write"],"POST /v1/primus/agents/:agentId/activate":["agents:write"],"POST /v1/primus/agents/:agentId/archive":["agents:admin"],"POST /v1/primus/agents/:agentId/invoke":["agents:execute"],"POST /v1/primus/agents/:agentId/pause":["agents:write"],"POST /v1/primus/agents/:agentId/run":["agents:execute"],"POST /v1/primus/agents/:agentId/skills/assign":["agents:write"],"POST /v1/primus/agents/:agentId/skills/unassign":["agents:write"],"POST /v1/primus/approvals":["approvals:write"],"POST /v1/primus/approvals/:approvalId/approve":["approvals:write"],"POST /v1/primus/approvals/:approvalId/reject":["approvals:write"],"POST /v1/primus/brain/models/refresh":["brain:write"],"POST /v1/primus/brain/provider-keys":["brain:write"],"POST /v1/primus/brain/provider-models":["brain:read"],"POST /v1/primus/chat/stream-pipeline":["executions:execute"],"POST /v1/primus/config/apply":["agents:admin"],"POST /v1/primus/conversations":["conversations:write"],"POST /v1/primus/conversations/:conversationId/archive":["conversations:admin"],"POST /v1/primus/conversations/:conversationId/send":["conversations:write"],"POST /v1/primus/executions":["executions:execute"],"POST /v1/primus/executions/:executionId/approve":["executions:admin"],"POST /v1/primus/executions/:executionId/cancel":["executions:execute"],"POST /v1/primus/executions/:executionId/reject":["executions:admin"],"POST /v1/primus/executions/batch":["executions:execute"],"POST /v1/primus/integrations/:connectionId/disconnect":["connections:write"],"POST /v1/primus/integrations/:connectionId/refresh":["connections:write"],"POST /v1/primus/integrations/connect":["connections:write"],"POST /v1/primus/kill-switch/activate":["guardrails:admin"],"POST /v1/primus/kill-switch/deactivate":["guardrails:admin"],"POST /v1/primus/learning/feedback":["agents:write"],"POST /v1/primus/learning/patterns/set-active":["agents:write"],"POST /v1/primus/learning/proactive-actions/decide":["agents:write"],"POST /v1/primus/mcp-connections/:credentialId/revoke":["connections:write"],"POST /v1/primus/mcp-servers":["tools:write"],"POST /v1/primus/mcp-servers/:mcpServerId/connect/begin":["connections:write"],"POST /v1/primus/mcp-servers/:mcpServerId/disconnect":["tools:admin"],"POST /v1/primus/mcp-servers/:mcpServerId/oauth/begin":["tools:write"],"POST /v1/primus/mcp-servers/:mcpServerId/oauth/client":["tools:admin"],"POST /v1/primus/mcp-servers/:mcpServerId/reconnect":["tools:write"],"POST /v1/primus/mcp-servers/:mcpServerId/rename":["tools:write"],"POST /v1/primus/mcp-servers/:mcpServerId/rotate-auth":["tools:admin"],"POST /v1/primus/mcp-servers/test":["tools:write"],"POST /v1/primus/memories/:memoryId/decrypt":["memory:read"],"POST /v1/primus/memories/:memoryId/reencrypt":["memory:write"],"POST /v1/primus/memory":["memory:write"],"POST /v1/primus/memory/:memoryId/quarantine":["memory:write"],"POST /v1/primus/memory/:memoryId/unquarantine":["memory:write"],"POST /v1/primus/memory/search":["memory:read"],"POST /v1/primus/memory/search/explain":["memory:read"],"POST /v1/primus/memory/store":["memory:write"],"POST /v1/primus/observability/alerts/acknowledge":["agents:write"],"POST /v1/primus/observability/alerts/resolve":["agents:write"],"POST /v1/primus/observability/errors/resolve":["agents:write"],"POST /v1/primus/self-knowledge":["agents:write"],"POST /v1/primus/self-knowledge/:knowledgeId/active":["agents:write"],"POST /v1/primus/self-knowledge/:knowledgeId/validate":["agents:write"],"POST /v1/primus/skill-synthesis/:skillId/promote":["agents:write"],"POST /v1/primus/skill-synthesis/run-pipeline":["agents:execute"],"POST /v1/primus/skills":["skills:write"],"POST /v1/primus/skills/:skillId/disable":["skills:write"],"POST /v1/primus/skills/:skillId/enable":["skills:write"],"POST /v1/primus/teams":["teams:write"],"POST /v1/primus/teams/assign":["teams:write"],"POST /v1/primus/teams/delegate":["teams:write"],"POST /v1/primus/teams/members":["teams:write"],"POST /v1/primus/teams/remove-member":["teams:admin"],"POST /v1/primus/teams/unassign":["teams:write"],"POST /v1/primus/teams/with-specialists":["teams:write"],"POST /v1/primus/tenants":["tenants:write"],"POST /v1/primus/tenants/:tenantId/archive":["tenants:admin"],"POST /v1/primus/tenants/:tenantId/suspend":["tenants:write"],"POST /v1/primus/tools":["tools:write"],"POST /v1/primus/tools/:toolId/disable":["tools:admin"],"POST /v1/primus/tools/:toolId/enable":["tools:write"],"POST /v1/primus/tools/:toolId/test":["tools:write"],"POST /v1/primus/tools/import":["tools:write"],"POST /v1/primus/triggers":["triggers:write"],"POST /v1/primus/triggers/:triggerId/disable":["triggers:write"],"POST /v1/primus/triggers/:triggerId/enable":["triggers:write"],"POST /v1/primus/triggers/:triggerId/test-fire":["triggers:write"],"POST /v1/primus/webhooks":["agent_webhooks:write"],"PUT /v1/primus/brain/config":["brain:write"]},CC={"agent-list":{label:"AgentList",ops:[{op:"GET /v1/primus/agents",phase:"mount"}],modeFloor:"custom",status:"live"},"agent-configurator":{label:"AgentConfigurator",ops:[{op:"POST /v1/primus/agents",phase:"action",action:"create",gatesMount:!0},{op:"PATCH /v1/primus/agents/:agentId",phase:"action",action:"update",gatesMount:!0}],modeFloor:"custom",status:"live"},chat:{label:"AgentChat",ops:[{op:"GET /v1/primus/conversations/by-agent",phase:"mount"},{op:"GET /v1/primus/conversations/:conversationId/messages",phase:"mount"},{op:"POST /v1/primus/conversations/:conversationId/send",phase:"action",action:"send",gatesMount:!0},{op:"POST /v1/primus/chat/stream-pipeline",phase:"action",action:"send",gatesMount:!0}],modeFloor:"custom",status:"live"},"run-timeline":{label:"RunTimeline",ops:[{op:"GET /v1/primus/executions",phase:"mount"},{op:"GET /v1/primus/executions/by-agent",phase:"mount"},{op:"GET /v1/primus/executions/by-conversation",phase:"mount"},{op:"GET /v1/primus/executions/:executionId/events",phase:"mount"},{op:"GET /v1/primus/executions/:executionId/traces",phase:"mount"}],modeFloor:"custom",status:"live"},"memory-browser":{label:"MemoryBrowser",ops:[{op:"GET /v1/primus/memory",phase:"mount"},{op:"GET /v1/primus/memory/by-agent",phase:"mount"},{op:"GET /v1/primus/memory/by-conversation",phase:"mount"}],modeFloor:"custom",status:"live"},"guardrails-panel":{label:"GuardrailsPanel",ops:[{op:"GET /v1/primus/kill-switch",phase:"mount"},{op:"GET /v1/primus/kill-switch/status",phase:"mount"},{op:"POST /v1/primus/kill-switch/activate",phase:"action",action:"decide",unwired:!0},{op:"POST /v1/primus/kill-switch/deactivate",phase:"action",action:"decide",unwired:!0}],modeFloor:"custom",status:"not-embeddable"},"approval-inbox":{label:"ApprovalInbox",ops:[{op:"GET /v1/primus/approvals/pending",phase:"mount"},{op:"GET /v1/primus/approvals/pending/summary",phase:"mount"},{op:"POST /v1/primus/approvals/:approvalId/approve",phase:"action",action:"decide"},{op:"POST /v1/primus/approvals/:approvalId/reject",phase:"action",action:"decide"}],modeFloor:"custom",status:"live"},skills:{label:"SkillsTab",ops:[{op:"GET /v1/primus/skills",phase:"mount"},{op:"GET /v1/primus/tools",phase:"mount"},{op:"POST /v1/primus/skills",phase:"action",action:"create"},{op:"POST /v1/primus/agents/:agentId/skills/assign",phase:"action",action:"create"},{op:"POST /v1/primus/agents/:agentId/skills/assign",phase:"action",action:"assign"},{op:"POST /v1/primus/agents/:agentId/skills/unassign",phase:"action",action:"unassign"}],modeFloor:"custom",status:"live"},connect:{label:"Connect",ops:[{op:"GET /v1/primus/mcp-connections",phase:"mount"},{op:"POST /v1/primus/mcp-servers/:mcpServerId/connect/begin",phase:"action",action:"connect"},{op:"POST /v1/primus/mcp-connections/:credentialId/revoke",phase:"action",action:"disconnect"}],modeFloor:"custom",status:"live"},primus:{label:"Primus",ops:[],composedOf:["agent-list","agent-configurator","chat","run-timeline","memory-browser","approval-inbox","skills"],modeFloor:"custom",status:"live"},"tenants.credentials":{label:"tenants.credentials",ops:[],modeFloor:"isolated",status:"not-built",rung:4,aspirationalScope:"tenants.credentials:admin",plannedScopes:[]}};s(NC,"scopesOf");AS=s(e=>[...new Set(e)].sort(),"sorted");s(LC,"derive");vs=Object.freeze(Object.fromEntries(Object.entries(CC).map(([e,t])=>[e,LC(t)])));s(OS,"expandLive");s($S,"unionRequiredScopes");s(CS,"unionActionScopes");DC=new Set(xC),GC=new Set(RC),UC=new Set(_C),zq=new Set(TC);s(ir,"toScopeForm");s(Om,"hasScope");jC=new Set(Am);s($m,"isValidMachineScope");s(MC,"editDistance");s(NS,"suggestMachineScope");s(LS,"eventsScopeSatisfies");s(DS,"pipesScopeSatisfies");s(GS,"connectScopeSatisfies");s(bs,"isSecretHeaderName")});function Cm(e){return{token:e.token,tokenType:"DPoP",expiresAt:e.expiresAt,scopes:e.scopes}}function Nm(e,t){return e.includes("*")?!0:t.every(r=>LS(e,r)||GS(e,r)||DS(e,r))}function qC(e){try{return new URL(e).origin}catch{return null}}function FC(e){return[...e].sort().join(" ")}var US,Fc,Lm=P(()=>{"use strict";St();jc();qo();Im();US=3e4,Fc=class{static{s(this,"KernelAuthState")}config;fetchImpl;now;cache=null;inflight=new Map;nonces=new Map;fingerprintPromise;constructor(t){this.config=t,this.fetchImpl=t.fetch??globalThis.fetch,this.now=t.now??Date.now}async getAccessToken(t){let r=this.config.refreshMarginMs??US,o=this.cache;if(o&&o.expiresAt-this.now()>r&&Nm(o.scopes,t))return Cm(o);let n=FC(t),i=this.inflight.get(n);if(i)return Cm(await i);let a=this.fetchToken(t);this.inflight.set(n,a);try{let c=await a;return Cm(c)}finally{this.inflight.get(n)===a&&this.inflight.delete(n)}}async signDpopProof(t){let r=qC(t.url),o=r?this.nonces.get(r):void 0,n={method:t.method,url:t.url,...t.accessToken?{accessToken:t.accessToken}:{},...o?{nonce:o}:{},now:this.now};return Pm(this.config.keys,n)}async requireScope(t){let r=await this.getAccessToken([t]);if(!Nm(r.scopes,[t]))throw new rr(`Missing required scope: ${t}. Granted: ${r.scopes.join(",")}`,{code:"insufficient_scope",status:403})}cacheNonce(t,r){this.nonces.set(t,r)}peekCache(){return this.cache}invalidate(){this.cache=null}fingerprint(){return this.fingerprintPromise||(this.fingerprintPromise=Nc(this.config.keys.publicJwk).catch(t=>{throw this.fingerprintPromise=void 0,t})),this.fingerprintPromise}async fetchToken(t){let r=this.config.authServerUrl,o=await Pm(this.config.keys,{method:"POST",url:r,now:this.now}),n=new URLSearchParams({grant_type:"client_credentials",client_id:this.config.clientId,scope:t.join(" ")});this.config.appId&&n.set("app_id",this.config.appId),this.config.env&&n.set("env_id",this.config.env),this.config.clientSecret&&n.set("client_secret",this.config.clientSecret);let i=await this.fetchImpl(r,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",DPoP:o},body:n.toString()});if(!i.ok){let g={};try{g=await i.json()}catch{}let h=typeof g.error=="object"&&g.error!==null?g.error:void 0,y=typeof g.error=="string"?g.error:void 0;if(or(g)!==void 0){let v=Uc({status:i.status,body:g,headers:i.headers??new Headers});if(v instanceof rt){let S=await this.fingerprint().catch(()=>{});throw new rt(v.message,{code:v.code,...v.status!==void 0?{status:v.status}:{},...v.requestId!==void 0?{requestId:v.requestId}:{},...S!==void 0?{fingerprint:S}:{}})}if(v instanceof Et)throw v}throw new ze(g.error_description??y??h?.message??`OAuth token request failed (${i.status})`,{code:y??h?.code??"oauth_failed",status:i.status})}let a=await i.json();if(!a.access_token)throw new ze("OAuth token response missing access_token",{code:"oauth_missing_token"});if(a.token_type&&a.token_type.toLowerCase()!=="dpop")throw new le(`Refusing non-DPoP token (got ${a.token_type})`,{code:"non_dpop_token"});let c=this.now()+(a.expires_in??600)*1e3,l=a.scope?a.scope.split(/\s+/).filter(Boolean):Array.from(t),d={token:a.access_token,expiresAt:c,scopes:l},u=this.cache,m=this.config.refreshMarginMs??US;return u&&u.expiresAt-this.now()>m&&!Nm(d.scopes,u.scopes)||(this.cache=d),d}};s(Cm,"toAccessToken");s(Nm,"hasAllScopes");s(qC,"safeOrigin");s(FC,"scopeKey")});function MS(e=globalThis.process?.env){if(!e||e.VITEST!=="true")return;let t=e[zC];if(t===void 0||t==="")return;let r=Number(t);return Number.isFinite(r)&&r>=0?r:void 0}function jS(e,t,r){let o=0;for(let n=0;n<t;n++){let i=Math.min(n,8);o+=zc(Math.round(e*2**i*.8),0,r)}return o}function qS(e,t,r=3e4){let o=Math.max(0,e-1);if(o===0||t<=0)return 200;let n=Math.ceil(r/.8);if(jS(n,o,r)<t)return n;let i=1,a=n;for(;i<a;){let c=Math.floor((i+a)/2);jS(c,o,r)>=t?a=c:i=c+1}return i}function Bc(e){let t=e.maxAttempts??5,r=e.attempt,o=e.status,n=e.jitter??Math.random,i=e.now??Date.now;if(r>=t)return{retryable:!1,delayMs:0,attempt:r,reason:`max attempts reached (${t})`};if(o!==void 0&&!FS.has(o)&&!(o>=500&&o<600))return{retryable:!1,delayMs:0,attempt:r,reason:`non-retryable status ${o}`};let a=BC(e.retryAfterHeader,i);if(a!==void 0)return{retryable:!0,delayMs:zc(a,0,3e4),attempt:r,reason:"retry-after header"};if(e.retryAfterMs!==void 0&&e.retryAfterMs>=0)return{retryable:!0,delayMs:zc(e.retryAfterMs,0,3e4),attempt:r,reason:"retry-after envelope"};let l=(e.restartWindowMs!==void 0?qS(t,e.restartWindowMs):200)*2**Math.min(r-1,8),d=1+(n()*.4-.2),u=zc(Math.round(l*d),0,3e4),m=o!==void 0?`status ${o}`:"transport error";return{retryable:!0,delayMs:u,attempt:r,reason:`${m} (backoff)`}}function BC(e,t){if(!e)return;let r=Number(e);if(!Number.isNaN(r)&&r>=0)return Math.round(r*1e3);let o=Date.parse(e);if(!Number.isNaN(o)){let n=o-t();return n>0?n:0}}function zc(e,t,r){return Math.max(t,Math.min(r,e))}function Dm(e){return FS.has(e)||e>=500&&e<600}var zC,FS,Gm=P(()=>{"use strict";zC="NPAYLOAD_TEST_RESTART_WINDOW_MS";s(MS,"harnessRestartWindowMs");s(jS,"lowestScheduleSum");s(qS,"baseDelayForWindow");FS=new Set([408,425,429,500,502,503,504]);s(Bc,"defaultRetryPolicy");s(BC,"parseRetryAfter");s(zc,"clamp");s(Dm,"isRetryableStatus")});var KC,QC,Br,Kc=P(()=>{"use strict";St();KC=5,QC=3e4,Br=class{static{s(this,"KernelCircuitBreaker")}hosts=new Map;threshold;probeAfterMs;now;openHandlers=new Set;closeHandlers=new Set;deferUntil=new Map;constructor(t={}){this.threshold=t.failureThreshold??KC,this.probeAfterMs=t.probeAfterMs??QC,this.now=t.now??Date.now}shouldAllow(t){let r=this.get(t);if(r.state==="closed")return!0;if(r.state==="open"){let o=r.openedAt??this.now();return this.now()-o>=this.probeAfterMs?(r.state="half-open",r.probeInFlight=!0,!0):!1}return r.probeInFlight?!1:(r.probeInFlight=!0,!0)}onOpen(t){return this.openHandlers.add(t),()=>{this.openHandlers.delete(t)}}onClose(t){return this.closeHandlers.add(t),()=>{this.closeHandlers.delete(t)}}noteRateLimit(t,r){this.deferUntil.set(t,r)}rateLimitedUntil(t){let r=this.deferUntil.get(t);if(r!==void 0){if(r<=this.now()){this.deferUntil.delete(t);return}return r}}fire(t,r){for(let o of t)try{o(r)}catch{}}recordSuccess(t){let r=this.get(t),o=r.state!=="closed";r.state="closed",r.failures=0,delete r.openedAt,delete r.lastFailureAt,r.probeInFlight=!1,o&&this.fire(this.closeHandlers,t)}recordFailure(t,r){let o=this.get(t);if(o.probeInFlight=!1,r===void 0||r>=500){if(o.lastFailureAt=this.now(),o.state==="half-open"){o.state="open",o.openedAt=this.now(),this.fire(this.openHandlers,t);return}o.failures+=1,o.failures>=this.threshold&&(o.state="open",o.openedAt=this.now(),this.fire(this.openHandlers,t))}}state(t){let r=this.get(t),o={state:r.state,failures:r.failures};return r.openedAt!==void 0&&r.lastFailureAt!==void 0?{...o,openedAt:r.openedAt,lastFailureAt:r.lastFailureAt}:r.openedAt!==void 0?{...o,openedAt:r.openedAt}:r.lastFailureAt!==void 0?{...o,lastFailureAt:r.lastFailureAt}:o}guard(t){if(!this.shouldAllow(t))throw new jo(`Circuit open for ${t}`,{code:"circuit_open"})}get(t){let r=this.hosts.get(t);return r||(r={state:"closed",failures:0,probeInFlight:!1},this.hosts.set(t,r)),r}}});function Kr(e=Date.now){let r=BigInt(e()).toString(16).padStart(12,"0"),o=(0,zS.randomBytes)(10),n=(o[0]&15|112).toString(16).padStart(2,"0")+o[1].toString(16).padStart(2,"0"),i=(o[2]&63|128).toString(16).padStart(2,"0")+o[3].toString(16).padStart(2,"0")+o[4].toString(16).padStart(2,"0")+o[5].toString(16).padStart(2,"0")+o[6].toString(16).padStart(2,"0")+o[7].toString(16).padStart(2,"0")+o[8].toString(16).padStart(2,"0")+o[9].toString(16).padStart(2,"0");return[r.slice(0,8),r.slice(8,12),n,i.slice(0,4),i.slice(4,16)].join("-")}var zS,Qr=P(()=>{"use strict";zS=require("crypto");s(Kr,"newIdempotencyKey")});function HC(e,t){let r=t.toLowerCase();return Object.keys(e).some(o=>o.toLowerCase()===r)}function WC(e,t){if(!e)return{};if(!t)return{...e};let r=t.toLowerCase();return Object.fromEntries(Object.entries(e).filter(([o])=>o.toLowerCase()!==r))}function JC(e,t){if(!e)return;let r=t.toLowerCase();for(let[o,n]of Object.entries(e))if(o.toLowerCase()===r&&typeof n=="string"&&n!=="")return n}function ZC(e){return new Promise(t=>setTimeout(t,e))}async function YC(e,t){if(t?.aborted)throw t.reason??new DOMException("Aborted","AbortError");return t?new Promise((r,o)=>{let n=setTimeout(()=>{t.removeEventListener("abort",i),r()},e),i=s(()=>{clearTimeout(n),o(t.reason??new DOMException("Aborted","AbortError"))},"onAbort");t.addEventListener("abort",i,{once:!0})}):ZC(e)}function XC(e){try{return new URL(e).host}catch{return e}}function e1(e){try{return new URL(e).origin}catch{return e}}function BS(e){if(!e)return null;let t=/\bnonce="([^"]+)"/.exec(e);return t?t[1]:null}async function Um(e){try{if((e.headers.get("content-type")??"").includes("application/json"))return await e.json();let r=await e.text();if(!r)return null;try{return JSON.parse(r)}catch{return r}}catch{return null}}function t1(e,t=Date.now){let r={},o=e.get("x-ratelimit-remaining");o!==null&&o.trim()!==""&&!Number.isNaN(Number(o))&&(r.remaining=Number(o));let n=e.get("x-ratelimit-reset");if(n!==null&&n.trim()!==""&&!Number.isNaN(Number(n))){let a=Number(n);r.resetAt=a>1e12?a:a*1e3}let i=e.get("retry-after");if(i!==null&&i.trim()!==""){let a=Number(i);if(!Number.isNaN(a))r.retryAfterMs=Math.max(0,a*1e3);else{let c=Date.parse(i);Number.isNaN(c)||(r.retryAfterMs=Math.max(0,c-t()))}}return r}function n1(e){return e.get("x-request-id")??e.get("x-npayload-request-id")}async function jm(e,t){let r=e.fetchImpl??globalThis.fetch,o=e.circuit??new Br,n=e.sleep??((S,k)=>YC(S,k)),i=e.now??Date.now,a=e.httpClient,c=a?async(S,k)=>a.fetch({method:k.method,url:S,headers:k.headers,body:k.body,...k.signal?{signal:k.signal}:{}}):async(S,k)=>r(S,e.dispatcher?{...k,dispatcher:e.dispatcher}:k),l=XC(t.url),d=t.method.toUpperCase(),m=VC.has(d)?t.idempotencyKey??JC(t.headers,"Idempotency-Key")??Kr():null;t.scope&&await e.auth.requireScope(t.scope);let p=0,f=!0,g=!0,h=!0;o.guard(l);let y=t.restartWindowMs??MS()??6e4,v=null;try{for(;;){p+=1;let S=o.rateLimitedUntil(l);if(S!==void 0){let q=S-i();q>0&&await n(q,t.signal)}e.clockDrift?.check();let k=await e.auth.getAccessToken(t.scope?[t.scope]:[]),R=await e.auth.signDpopProof({method:d,url:t.url,accessToken:k.token}),I={...WC(t.headers,m?"Idempotency-Key":void 0),Authorization:`DPoP ${k.token}`,DPoP:R,Accept:"application/json"};if(m&&(I["Idempotency-Key"]=m),t.traceparent&&(I.traceparent=t.traceparent),t.tracestate&&(I.tracestate=t.tracestate),t.body!=null&&!HC(I,"content-type")&&(I["Content-Type"]="application/json"),t.signal?.aborted)throw t.signal.reason??new DOMException("Aborted","AbortError");let x=t.timeoutMs!=null&&t.timeoutMs>0?AbortSignal.timeout(t.timeoutMs):void 0,_=[t.signal,x].filter(q=>q!=null),U=_.length>1?AbortSignal.any(_):_[0],A;try{A=await c(t.url,{method:d,headers:I,body:t.body??null,...U?{signal:U}:{}})}catch(q){if(q instanceof Error&&q.name==="AbortError")throw q;let H=q instanceof Error&&q.name==="TimeoutError",ne=Bc({attempt:p,...t.maxAttempts!==void 0?{maxAttempts:t.maxAttempts}:{},restartWindowMs:y});if(v={},ne.retryable){e.onRetry?.({attempt:p,reason:ne.reason,nextDelayMs:ne.delayMs}),await n(ne.delayMs,t.signal);continue}throw H?new Nn(`Request timed out after ${t.timeoutMs}ms`,{code:"timeout"}):RS(q)}if(A.status===401&&f){let q=A.headers.get("www-authenticate"),H=BS(q);if(H){e.auth.cacheNonce(e1(t.url),H),f=!1,p-=1;continue}}let D;if(A.status===401&&g&&!BS(A.headers.get("www-authenticate"))&&(D={body:await Um(A)},or(D.body)===void 0)){g=!1,e.auth.invalidate();continue}e.clockDrift?.observe(A.headers.get("date"),i());let M=t1(A.headers,i);M.remaining===0&&(M.resetAt!==void 0?o.noteRateLimit(l,M.resetAt):M.retryAfterMs!==void 0&&o.noteRateLimit(l,i()+M.retryAfterMs),e.onRateLimit?.(M));let V=n1(A.headers);if(A.status>=200&&A.status<300)return o.recordSuccess(l),{data:await Um(A),response:A,idempotencyKey:m,requestId:V,rateLimit:M};let w=D!==void 0?D.body:await Um(A),T=Uc({status:A.status,body:w,headers:A.headers,url:t.url});if(v={status:A.status},T instanceof Et&&h){h=!1,e.auth.peekCache()?.token===k.token&&e.auth.invalidate();continue}if(T instanceof rt&&T.fingerprint===void 0){let q=await e.auth.fingerprint().catch(()=>{});T=new rt(T.message,{code:T.code,...T.status!==void 0?{status:T.status}:{},...T.requestId!==void 0?{requestId:T.requestId}:{},...q!==void 0?{fingerprint:q}:{}})}if(Dm(A.status)){let q=Bc({attempt:p,status:A.status,retryAfterHeader:A.headers.get("retry-after"),...t.maxAttempts!==void 0?{maxAttempts:t.maxAttempts}:{},restartWindowMs:y});if(q.retryable){e.onRetry?.({attempt:p,reason:q.reason,nextDelayMs:q.delayMs}),await n(q.delayMs,t.signal);continue}}throw T instanceof le?T:new le(String(T),{code:"unknown"})}}catch(S){throw v&&o.recordFailure(l,v.status),S}}var VC,Mm=P(()=>{"use strict";jc();St();Gm();Kc();Qr();VC=new Set(["POST","PUT","PATCH","DELETE"]);s(HC,"hasHeader");s(WC,"withoutHeader");s(JC,"headerValue");s(ZC,"defaultSleep");s(YC,"abortableSleep");s(XC,"hostOf");s(e1,"originOf");s(BS,"readNonceFromHeader");s(Um,"readResponseBody");s(t1,"parseRateLimit");s(n1,"requestIdOf");s(jm,"kernelSend")});function WS(e,t,r){if(!r)return!1;let o=e.toLowerCase();for(let n of r.split(/[\s,]+/)){let i=n.trim().toLowerCase();if(!i)continue;if(i==="*")return!0;let[a,c]=i.startsWith("[")?[i.slice(0,i.indexOf("]")+1),i.slice(i.indexOf("]")+2)]:i.split(":"),l=a.startsWith(".")?a.slice(1):a;if((o===l||o.endsWith(`.${l}`))&&!(c&&c!==t))return!0}return!1}function qm(e,...t){for(let r of t){let o=e[r];if(o&&o.trim())return o.trim()}}function JS(e,t){let r=e.port||(e.protocol==="https:"?"443":"80");if(WS(e.hostname,r,qm(t,"NO_PROXY","no_proxy")))return;let o=e.protocol==="https:"?qm(t,"HTTPS_PROXY","https_proxy","ALL_PROXY","all_proxy"):qm(t,"HTTP_PROXY","http_proxy","ALL_PROXY","all_proxy");if(o)try{return new URL(o).origin}catch{return}}function r1(e){return typeof e=="string"?new URL(e):e}function o1(){let e=Bm;return typeof e.getCACertificates=="function"?e.getCACertificates("default"):Bm.rootCertificates}var zm,Bm,sr,QS,VS,HS,Fm,ZS,ws,Qc=P(()=>{"use strict";zm=require("dns"),Bm=K(require("tls"),1),sr=require("undici"),QS=20,VS=3e4,HS=1e4;s(WS,"noProxyMatches");s(qm,"pick");s(JS,"proxyFor");s(r1,"originUrl");ZS=s(async e=>{Fm??=new zm.promises.Resolver({timeout:2e3,tries:2});let[t,r]=await Promise.allSettled([Fm.resolve4(e,{ttl:!0}),Fm.resolve6(e,{ttl:!0})]),o=[];if(t.status==="fulfilled")for(let i of t.value)o.push({address:i.address,family:4,ttlMs:i.ttl*1e3});if(r.status==="fulfilled")for(let i of r.value)o.push({address:i.address,family:6,ttlMs:i.ttl*1e3});return o.length>0?o:(await zm.promises.lookup(e,{all:!0})).map(i=>({address:i.address,family:i.family===6?6:4,ttlMs:0}))},"resolveWithServerTtl");s(o1,"defaultTrustStore");ws=class extends sr.Dispatcher{static{s(this,"KernelDispatcher")}pool;tunnels=new Map;env;connections;tlsMin;ca;allowH2;constructor(t={}){super(),this.connections=t.connections??QS,this.tlsMin=t.tlsMin??"TLSv1.3",this.ca=t.ca,this.allowH2=t.allowH2??!0,this.env=t.env??process.env;let r=t.dns?.lookup??ZS,o=sr.interceptors.dns({maxTTL:t.dns?.maxTtlMs??HS,dualStack:!0,lookup:s((n,i,a)=>{r(n.hostname).then(c=>a(null,c.map(l=>({address:l.address,family:l.family,ttl:l.ttlMs}))),c=>a(c instanceof Error?c:new Error(String(c)),[]))},"lookup")});this.pool=new sr.Agent({connections:this.connections,pipelining:1,keepAliveTimeout:t.keepAliveTimeoutMs??VS,allowH2:this.allowH2,connect:this.tlsOptions()}).compose(o)}tlsOptions(){return this.ca!==void 0?{minVersion:this.tlsMin,ca:[...o1(),...this.ca]}:{minVersion:this.tlsMin}}dispatch(t,r){if(t.origin===void 0)return this.pool.dispatch(t,r);let o=r1(t.origin),n=JS(o,this.env);if(!n)return this.pool.dispatch(t,r);if(o.protocol==="http:")return this.pool.dispatch({...t,origin:n,path:`${o.origin}${t.path}`},r);let i=this.tunnels.get(n);return i||(i=new sr.ProxyAgent({uri:n,connections:this.connections,allowH2:this.allowH2,proxyTls:{minVersion:this.tlsMin},requestTls:this.tlsOptions()}),this.tunnels.set(n,i)),i.dispatch(t,r)}everyDispatcher(){return[this.pool,...this.tunnels.values()]}close(t){let r=Promise.all(this.everyDispatcher().map(o=>o.close())).then(()=>{this.tunnels.clear()});if(t){r.then(t,t);return}return r}destroy(t,r){let o=typeof t=="function"?null:t??null,n=typeof t=="function"?t:r,i=Promise.all(this.everyDispatcher().map(a=>a.destroy(o))).then(()=>{this.tunnels.clear()});if(n){i.then(n,n);return}return i}}});var YS,ks,Km=P(()=>{"use strict";St();YS=6e4,ks=class{static{s(this,"ClockDriftGuard")}maxDriftMs;drift;constructor(t=YS){this.maxDriftMs=t}get driftMs(){return this.drift}observe(t,r){if(!t)return;let o=Date.parse(t);Number.isNaN(o)||(this.drift=o-r)}check(){if(this.drift!==void 0&&Math.abs(this.drift)>this.maxDriftMs)throw new Gc(this.drift,this.maxDriftMs)}}});var XS=P(()=>{"use strict";Gm();Kc();Mm();Qc();Qc();Qr();Km()});var Ln,Qm=P(()=>{"use strict";Ln="1.9.1"});function i1(e){let t=new Set([e]),r=new Set,o=e.match(eP);if(!o)return()=>!1;let n={major:+o[1],minor:+o[2],patch:+o[3],prerelease:o[4]};if(n.prerelease!=null)return s(function(l){return l===e},"isExactmatch");function i(c){return r.add(c),!1}s(i,"_reject");function a(c){return t.add(c),!0}return s(a,"_accept"),s(function(l){if(t.has(l))return!0;if(r.has(l))return!1;let d=l.match(eP);if(!d)return i(l);let u={major:+d[1],minor:+d[2],patch:+d[3],prerelease:d[4]};return u.prerelease!=null||n.major!==u.major?i(l):n.major===0?n.minor===u.minor&&n.patch<=u.patch?a(l):i(l):n.minor<=u.minor?a(l):i(l)},"isCompatible")}var eP,tP,nP=P(()=>{"use strict";Qm();eP=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;s(i1,"_makeCompatibilityCheck");tP=i1(Ln)});function Fo(e,t,r,o=!1){var n;let i=Ss[Es]=(n=Ss[Es])!==null&&n!==void 0?n:{version:Ln};if(!o&&i[e]){let a=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(a.stack||a.message),!1}if(i.version!==Ln){let a=new Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${Ln}`);return r.error(a.stack||a.message),!1}return i[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${Ln}.`),!0}function Dn(e){var t,r;let o=(t=Ss[Es])===null||t===void 0?void 0:t.version;if(!(!o||!tP(o)))return(r=Ss[Es])===null||r===void 0?void 0:r[e]}function zo(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${Ln}.`);let r=Ss[Es];r&&delete r[e]}var s1,Es,Ss,Ps=P(()=>{"use strict";Qm();nP();s1=Ln.split(".")[0],Es=Symbol.for(`opentelemetry.js.api.${s1}`),Ss=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{};s(Fo,"registerGlobal");s(Dn,"getGlobal");s(zo,"unregisterGlobal")});function Is(e,t,r){let o=Dn("diag");if(o)return o[e](t,...r)}var Vc,rP=P(()=>{"use strict";Ps();Vc=class{static{s(this,"DiagComponentLogger")}constructor(t){this._namespace=t.namespace||"DiagComponentLogger"}debug(...t){return Is("debug",this._namespace,t)}error(...t){return Is("error",this._namespace,t)}info(...t){return Is("info",this._namespace,t)}warn(...t){return Is("warn",this._namespace,t)}verbose(...t){return Is("verbose",this._namespace,t)}};s(Is,"logProxy")});var Ze,Vm=P(()=>{"use strict";(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"})(Ze||(Ze={}))});function oP(e,t){e<Ze.NONE?e=Ze.NONE:e>Ze.ALL&&(e=Ze.ALL),t=t||{};function r(o,n){let i=t[o];return typeof i=="function"&&e>=n?i.bind(t):function(){}}return s(r,"_filterFunc"),{error:r("error",Ze.ERROR),warn:r("warn",Ze.WARN),info:r("info",Ze.INFO),debug:r("debug",Ze.DEBUG),verbose:r("verbose",Ze.VERBOSE)}}var iP=P(()=>{"use strict";Vm();s(oP,"createLogLevelDiagLogger")});var a1,ar,Hm=P(()=>{"use strict";rP();iP();Vm();Ps();a1="diag",ar=class e{static{s(this,"DiagAPI")}static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function t(n){return function(...i){let a=Dn("diag");if(a)return a[n](...i)}}s(t,"_logProxy");let r=this,o=s((n,i={logLevel:Ze.INFO})=>{var a,c,l;if(n===r){let m=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((a=m.stack)!==null&&a!==void 0?a:m.message),!1}typeof i=="number"&&(i={logLevel:i});let d=Dn("diag"),u=oP((c=i.logLevel)!==null&&c!==void 0?c:Ze.INFO,n);if(d&&!i.suppressOverrideMessage){let m=(l=new Error().stack)!==null&&l!==void 0?l:"<failed to generate stacktrace>";d.warn(`Current logger will be overwritten from ${m}`),u.warn(`Current logger will overwrite one already registered from ${m}`)}return Fo("diag",u,r,!0)},"setLogger");r.setLogger=o,r.disable=()=>{zo(a1,r)},r.createComponentLogger=n=>new Vc(n),r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}}});function Jm(e){return Symbol.for(e)}var Wm,Ts,Hc=P(()=>{"use strict";s(Jm,"createContextKey");Wm=class e{static{s(this,"BaseContext")}constructor(t){let r=this;r._currentContext=t?new Map(t):new Map,r.getValue=o=>r._currentContext.get(o),r.setValue=(o,n)=>{let i=new e(r._currentContext);return i._currentContext.set(o,n),i},r.deleteValue=o=>{let n=new e(r._currentContext);return n._currentContext.delete(o),n}}},Ts=new Wm});var Wc,sP=P(()=>{"use strict";Hc();Wc=class{static{s(this,"NoopContextManager")}active(){return Ts}with(t,r,o,...n){return r.call(o,...n)}bind(t,r){return r}enable(){return this}disable(){return this}}});var Zm,c1,cr,Jc=P(()=>{"use strict";sP();Ps();Hm();Zm="context",c1=new Wc,cr=class e{static{s(this,"ContextAPI")}constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(t){return Fo(Zm,t,ar.instance())}active(){return this._getContextManager().active()}with(t,r,o,...n){return this._getContextManager().with(t,r,o,...n)}bind(t,r){return this._getContextManager().bind(t,r)}_getContextManager(){return Dn(Zm)||c1}disable(){this._getContextManager().disable(),zo(Zm,ar.instance())}}});var Zc,aP=P(()=>{"use strict";(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(Zc||(Zc={}))});var Ym,Xm,cP,ef=P(()=>{"use strict";aP();Ym="0000000000000000",Xm="00000000000000000000000000000000",cP={traceId:Xm,spanId:Ym,traceFlags:Zc.NONE}});var un,Yc=P(()=>{"use strict";ef();un=class{static{s(this,"NonRecordingSpan")}constructor(t=cP){this._spanContext=t}spanContext(){return this._spanContext}setAttribute(t,r){return this}setAttributes(t){return this}addEvent(t,r){return this}addLink(t){return this}addLinks(t){return this}setStatus(t){return this}updateName(t){return this}end(t){}isRecording(){return!1}recordException(t,r){}}});function Xc(e){return e.getValue(tf)||void 0}function lP(){return Xc(cr.getInstance().active())}function xs(e,t){return e.setValue(tf,t)}function dP(e){return e.deleteValue(tf)}function uP(e,t){return xs(e,new un(t))}function el(e){var t;return(t=Xc(e))===null||t===void 0?void 0:t.spanContext()}var tf,nf=P(()=>{"use strict";Hc();Yc();Jc();tf=Jm("OpenTelemetry Context Key SPAN");s(Xc,"getSpan");s(lP,"getActiveSpan");s(xs,"setSpan");s(dP,"deleteSpan");s(uP,"setSpanContext");s(el,"getSpanContext")});function pP(e,t){if(typeof e!="string"||e.length!==t)return!1;let r=0;for(let o=0;o<e.length;o+=4)r+=(tl[e.charCodeAt(o)]|0)+(tl[e.charCodeAt(o+1)]|0)+(tl[e.charCodeAt(o+2)]|0)+(tl[e.charCodeAt(o+3)]|0);return r===t}function l1(e){return pP(e,32)&&e!==Xm}function d1(e){return pP(e,16)&&e!==Ym}function nl(e){return l1(e.traceId)&&d1(e.spanId)}function mP(e){return new un(e)}var tl,rf=P(()=>{"use strict";ef();Yc();tl=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]);s(pP,"isValidHex");s(l1,"isValidTraceId");s(d1,"isValidSpanId");s(nl,"isSpanContextValid");s(mP,"wrapSpanContext")});function u1(e){return e!==null&&typeof e=="object"&&"spanId"in e&&typeof e.spanId=="string"&&"traceId"in e&&typeof e.traceId=="string"&&"traceFlags"in e&&typeof e.traceFlags=="number"}var of,Bo,sf=P(()=>{"use strict";Jc();nf();Yc();rf();of=cr.getInstance(),Bo=class{static{s(this,"NoopTracer")}startSpan(t,r,o=of.active()){if(!!r?.root)return new un;let i=o&&el(o);return u1(i)&&nl(i)?new un(i):new un}startActiveSpan(t,r,o,n){let i,a,c;if(arguments.length<2)return;arguments.length===2?c=r:arguments.length===3?(i=r,c=o):(i=r,a=o,c=n);let l=a??of.active(),d=this.startSpan(t,i,l),u=xs(l,d);return of.with(u,c,void 0,d)}};s(u1,"isSpanContext")});var p1,rl,fP=P(()=>{"use strict";sf();p1=new Bo,rl=class{static{s(this,"ProxyTracer")}constructor(t,r,o,n){this._provider=t,this.name=r,this.version=o,this.options=n}startSpan(t,r,o){return this._getTracer().startSpan(t,r,o)}startActiveSpan(t,r,o,n){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):p1}}});var ol,gP=P(()=>{"use strict";sf();ol=class{static{s(this,"NoopTracerProvider")}getTracer(t,r,o){return new Bo}}});var m1,_s,hP=P(()=>{"use strict";fP();gP();m1=new ol,_s=class{static{s(this,"ProxyTracerProvider")}getTracer(t,r,o){var n;return(n=this.getDelegateTracer(t,r,o))!==null&&n!==void 0?n:new rl(this,t,r,o)}getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:m1}setDelegate(t){this._delegate=t}getDelegateTracer(t,r,o){var n;return(n=this._delegate)===null||n===void 0?void 0:n.getTracer(t,r,o)}}});var Rs,yP=P(()=>{"use strict";(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"})(Rs||(Rs={}))});var Ko,vP=P(()=>{"use strict";(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(Ko||(Ko={}))});var il,bP=P(()=>{"use strict";Jc();il=cr.getInstance()});var af,sl,wP=P(()=>{"use strict";Ps();hP();rf();nf();Hm();af="trace",sl=class e{static{s(this,"TraceAPI")}constructor(){this._proxyTracerProvider=new _s,this.wrapSpanContext=mP,this.isSpanContextValid=nl,this.deleteSpan=dP,this.getSpan=Xc,this.getActiveSpan=lP,this.getSpanContext=el,this.setSpan=xs,this.setSpanContext=uP}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(t){let r=Fo(af,this._proxyTracerProvider,ar.instance());return r&&this._proxyTracerProvider.setDelegate(t),r}getTracerProvider(){return Dn(af)||this._proxyTracerProvider}getTracer(t,r){return this.getTracerProvider().getTracer(t,r)}disable(){zo(af,ar.instance()),this._proxyTracerProvider=new _s}}});var al,kP=P(()=>{"use strict";wP();al=sl.getInstance()});var EP=P(()=>{"use strict";Hc();yP();vP();bP();kP()});function f1(){let e=al.getTracerProvider(),r=(typeof e.getDelegate=="function"?e.getDelegate():e)?.constructor?.name??"";return r!==""&&r!=="NoopTracerProvider"}function g1(){SP||f1()&&(SP=!0,il.setGlobalContextManager(new cf))}function lf(e){g1();let t=al.getTracer(IP,e.kernelVersion),r="";try{r=new URL(e.url).host}catch{}let o=t.startSpan("http.client",{kind:Rs.CLIENT,attributes:{"http.request.method":e.method,"url.full":e.url,"server.address":r,"npayload.sdk":"node-kernel","npayload.kernel_version":e.kernelVersion,"npayload.client_id":e.clientId,"npayload.path":e.path,"npayload.traceparent":e.traceparent,...e.env!==void 0?{"npayload.env":e.env}:{}}},il.active());return{span:o,end(n){n.status!==void 0&&o.setAttribute("http.response.status_code",n.status),n.requestId&&o.setAttribute("npayload.request_id",n.requestId),n.error!==void 0?(o.setStatus({code:Ko.ERROR,message:n.error instanceof Error?n.error.message:String(n.error)}),n.error instanceof Error&&o.recordException(n.error)):o.setStatus({code:Ko.OK}),o.end()}}}var PP,IP,cf,SP,df=P(()=>{"use strict";PP=require("async_hooks");EP();IP="@npayload/sdk",cf=class{static{s(this,"AsyncLocalStorageContextManager")}storage=new PP.AsyncLocalStorage;active(){return this.storage.getStore()??Ts}with(t,r,o,...n){return this.storage.run(t,()=>r.call(o,...n))}bind(t,r){if(typeof r!="function")return r;let o=this,n=r;return function(...i){return o.with(t,()=>n.apply(this,i))}}enable(){return this}disable(){return this.storage.disable(),this}},SP=!1;s(f1,"hostHasTracerProvider");s(g1,"ensureContextManager");s(lf,"startHttpClientSpan")});function uf(e){return(0,TP.randomBytes)(e).toString("hex")}function xP(){return`00-${uf(16)}-${uf(8)}-01`}function _P(e){if(!e||!h1.test(e))return xP();let r=e.split("-")[1],o=uf(8);return`00-${r}-${o}-01`}var TP,h1,As,pf=P(()=>{"use strict";TP=require("crypto"),h1=/^00-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$/i;s(uf,"hex");s(xP,"generateTraceparent");s(_P,"propagateTraceparent");As=class{static{s(this,"KernelObserver")}handlers=new Map;on(t,r){let o=this.handlers.get(t);return o||(o=new Set,this.handlers.set(t,o)),o.add(r),()=>{this.handlers.get(t)?.delete(r)}}traceparent(t){return _P(t)}emit(t){let r=this.handlers.get(t.type);if(r)for(let o of r)try{o(t)}catch{}}}});var RP=P(()=>{"use strict";df();pf()});var AP=P(()=>{"use strict";St()});function mf(e){let t,r="message",o=[],n;for(let c of e.split(/\r?\n/)){if(c===""||c.startsWith(":"))continue;let l=c.indexOf(":"),d=l===-1?c:c.slice(0,l),u=l===-1?"":c.slice(l+1);switch(u.startsWith(" ")&&(u=u.slice(1)),d){case"id":t=u;break;case"event":r=u;break;case"data":o.push(u);break;case"retry":{let m=Number(u);!Number.isNaN(m)&&m>=0&&(n=m);break}default:break}}if(o.length===0)return null;let i=o.join(`
|
|
3
|
+
`),a;try{a=JSON.parse(i)}catch{a=i}return t!==void 0?n!==void 0?{id:t,event:r,data:a,raw:i,retryAfterMs:n}:{id:t,event:r,data:a,raw:i}:n!==void 0?{event:r,data:a,raw:i,retryAfterMs:n}:{event:r,data:a,raw:i}}async function*ff(e){let t=e.getReader(),r=new TextDecoder("utf-8"),o="";try{for(;;){let{done:n,value:i}=await t.read();i&&(o+=r.decode(i,{stream:!0}));let a=o.split(/\r?\n\r?\n/);o=a.pop()??"";for(let c of a){let l=mf(c);l&&(yield l)}if(n){if(o.trim().length>0){let c=mf(o);c&&(yield c)}return}}}finally{t.releaseLock()}}var OP=P(()=>{"use strict";Qr();s(mf,"parseSseBlock");s(ff,"parseEventStream")});var $P=P(()=>{"use strict";AP();OP()});var CP,NP=P(()=>{"use strict";CP=require("crypto");St()});var LP=P(()=>{"use strict"});var DP=P(()=>{"use strict"});var GP,UP=P(()=>{"use strict";GP=require("fs");St()});var jP=P(()=>{"use strict";St();Qr()});var MP=P(()=>{"use strict";DP();UP();jP()});function y1(e){return`${(e.authUrl??e.baseUrl??FP).replace(/\/+$/,"")}/oauth/token`}function k1(e){for(let t of w1)if(t in e)throw new Error(`KernelConfig MUST NOT include "${t}". The npayload kernel uses DPoP-bound OAuth tokens \u2014 never an API key, secret, or org id.`)}function E1(e,t){let r=t.path;if(t.pathParams)for(let[n,i]of Object.entries(t.pathParams))r=r.replace(`{${n}}`,encodeURIComponent(i));let o=e.replace(/\/+$/,"")+r;if(t.query&&Object.keys(t.query).length>0){let n=new URLSearchParams;for(let[i,a]of Object.entries(t.query))n.set(i,String(a));o+=`?${n.toString()}`}return o}function S1(e){if(typeof e=="string")return e;try{return JSON.stringify(e)}catch(t){let r=t instanceof Error?t.message:String(t);throw new dn(`Failed to serialise request body: ${r}`,{code:"body_serialisation_failed"})}}function qP(e){return e&&typeof e=="object"&&"code"in e?String(e.code):"unknown"}function I1(e){let t=[];for(let r of[e.headers,e.query])if(r)for(let o of Object.keys(r))P1.has(o.toLowerCase())&&t.push(o);if(t.length>0)throw new dn(`Org-shaped request fields are never sent by the kernel (the org is the credential's): ${t.join(", ")}`,{code:"org_context_forbidden"})}function T1(e){let t=e?.status;return typeof t=="number"?t:void 0}var cl,FP,v1,b1,ll,w1,P1,Pt=P(()=>{"use strict";kS();ES();Im();Lm();$c();XS();St();jc();RP();$P();NP();LP();Qr();MP();Qr();Mm();Kc();Qc();Km();pf();Lm();$c();St();df();cl="0.2.0",FP="https://api.npayload.com";s(y1,"tokenEndpointOf");v1="X-NPayload-Env",b1=/^00-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$/i,ll=class{static{s(this,"Kernel")}config;auth;observer;circuit;dispatcher;clockDrift;clockNow;methods=new Set;constructor(t){let r=t.config;k1(r);let o=Oc(r.dpopPrivateJwk)?r.dpopPrivateJwk:new gs(r.dpopPrivateJwk),n=r.tlsMin??"TLSv1.3";if(n!=="TLSv1.3"&&n!=="TLSv1.2")throw new dn(`tlsMin must be "TLSv1.3" or "TLSv1.2" (TLS 1.2 is the floor); got ${String(n)}`,{code:"tls_min_below_floor"});let i={...r,tlsMin:n,dpopPrivateJwk:o};this.config=i,this.observer=new As;let a=r.testClock!==void 0?()=>r.testClock.now():void 0;this.circuit=new Br(a!==void 0?{now:a}:{}),this.clockDrift=new ks(r.maxClockDriftMs),this.clockNow=a,this.dispatcher=new ws({tlsMin:n,...r.tlsCa!==void 0?{ca:r.tlsCa}:{},...r.dns!==void 0?{dns:r.dns}:{}}),this.auth=new Fc({clientId:r.clientId,keys:{publicJwk:o.publicJwk,privateJwk:o},authServerUrl:y1(r),...r.appId!==void 0?{appId:r.appId}:{},...r.clientSecret!==void 0?{clientSecret:r.clientSecret}:{},...r.env!==void 0?{env:r.env}:{},...a!==void 0?{now:a}:{}})}async send(t){if(this.config.mockMode)throw new Error("Kernel.send called in mockMode \u2014 use the resource-layer mock helpers");I1(t);let r=E1(this.config.baseUrl??FP,t),o=t.traceparent!==void 0&&b1.test(t.traceparent)?t.traceparent:this.observer.traceparent(void 0),n=Date.now();this.observer.emit({type:"request",method:t.method,path:t.path,traceparent:o,...t.idempotencyKey!==void 0?{idempotencyKey:t.idempotencyKey}:{}});let a={...this.config.env?{[v1]:this.config.env}:{},...t.headers??{}},c=this.config.telemetry===!1?void 0:lf({method:t.method,url:r,path:t.path,clientId:this.config.clientId,kernelVersion:cl,traceparent:o,...this.config.env!==void 0?{env:this.config.env}:{}});try{let l=await jm({auth:this.auth,circuit:this.circuit,clockDrift:this.clockDrift,...this.clockNow!==void 0?{now:this.clockNow}:{},...this.config.httpClient!==void 0?{httpClient:this.config.httpClient}:{dispatcher:this.dispatcher},onRetry:s(f=>this.observer.emit({type:"retry",...f}),"onRetry"),onRateLimit:s(f=>{for(let g of this.rateLimitHandlers)try{g(f.remaining??0,f.resetAt??0)}catch{}},"onRateLimit")},{method:t.method,url:r,...Object.keys(a).length>0?{headers:a}:{},...t.body!==void 0?{body:S1(t.body)}:{},...t.idempotencyKey!==void 0?{idempotencyKey:t.idempotencyKey}:{},...t.maxAttempts!==void 0?{maxAttempts:t.maxAttempts}:{},...t.restartWindowMs!==void 0?{restartWindowMs:t.restartWindowMs}:{},...t.timeoutMs!==void 0?{timeoutMs:t.timeoutMs}:{},traceparent:o,...t.tracestate!==void 0?{tracestate:t.tracestate}:{},...t.signal!==void 0?{signal:t.signal}:{},...t.scope!==void 0?{scope:t.scope}:{}}),d=l.response,u=d.status??200,m=d.headers?.get("content-length"),p=m&&Number.parseInt(m,10)||0;return this.observer.emit({type:"response",status:u,durationMs:Date.now()-n,...l.requestId!==null?{requestId:l.requestId}:{},bytes:p}),c?.end({status:u,requestId:l.requestId}),l.data}catch(l){this.observer.emit({type:"error",code:qP(l),durationMs:Date.now()-n});let d=T1(l);throw c?.end({error:l,...d!==void 0?{status:d}:{}}),l}}newIdempotencyKey(){return Kr()}rateLimitHandlers=new Set;onCircuitOpen(t){return this.circuit.onOpen(t)}onCircuitClose(t){return this.circuit.onClose(t)}onRateLimited(t){return this.rateLimitHandlers.add(t),()=>{this.rateLimitHandlers.delete(t)}}registerMethod(t){this.methods.add(t)}listMethods(){return Array.from(this.methods).sort()}async health(){if(this.config.mockMode)return{ok:!0,serverVersion:"mock",sdkVersion:cl};try{let t=await this.send({method:"GET",path:"/v1/_health"});return{ok:t.ok,serverVersion:t.version??"unknown",sdkVersion:cl}}catch(t){return{ok:!1,serverVersion:"unknown",sdkVersion:cl,error:qP(t)}}}},w1=["apiKey","api_key","orgId","org_id","tenantId","tenant_id","ownerId","hmacSecret","hmac_secret","secret","bearer"];s(k1,"rejectForbiddenFields");s(E1,"composeUrl");s(S1,"serialiseBody");s(qP,"getCode");P1=new Set(["orgid","org_id","organizationid","organization_id","tenantid","tenant_id","ownerid","owner_id","x-org-id","x-tenant-id","x-owner-id","x-organization-id"]);s(I1,"rejectOrgShapedRequestFields");s(T1,"getStatus")});var ye,Vr=P(()=>{"use strict";ye={contentHash:"f4d5410c733e4c4a28858907bb7addc6d1fd34280961bdfb74cf0ac7a0a8419b",generatedAt:"contract-f4d5410c733e4c4a28858907bb7addc6d1fd34280961bdfb74cf0ac7a0a8419b",commands:[{key:"connect.connectAccess.getGrant",commandPath:["connect","connectAccess","getGrant"],opId:"GET /v1/connect/grants/:grantId",method:"GET",pattern:"/v1/connect/grants/:grantId",pathParams:[{name:"grantGid",key:"grantId"}],flags:[],scopes:["grants:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single access grant (caller must be a party)."},{key:"connect.connectAccess.getGrantRates",commandPath:["connect","connectAccess","getGrantRates"],opId:"GET /v1/connect/grants/:grantId/rates",method:"GET",pattern:"/v1/connect/grants/:grantId/rates",pathParams:[{name:"grantGid",key:"grantId"}],flags:[],scopes:["grants:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a grant's rates from the rollup: events per second now, the peak per 30 s over the last hour, today's count against the day limit, dropped today, the per-second limit and asOf (either party)."},{key:"connect.connectAccess.getGrantTrustScore",commandPath:["connect","connectAccess","getGrantTrustScore"],opId:"GET /v1/connect/grants/:grantId/trust-score",method:"GET",pattern:"/v1/connect/grants/:grantId/trust-score",pathParams:[{name:"grantGid",key:"grantId"}],flags:[],scopes:["grants:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a grant's trust score, cold-start, and red-flag status (caller must be a party)."},{key:"connect.connectAccess.getGrantUsage",commandPath:["connect","connectAccess","getGrantUsage"],opId:"GET /v1/connect/grants/:grantId/usage",method:"GET",pattern:"/v1/connect/grants/:grantId/usage",pathParams:[{name:"grantGid",key:"grantId"}],flags:[{name:"period",coerce:null,optional:!0,choices:["7d","30d","custom"]},{name:"windowStartMs",coerce:"number",optional:!0},{name:"windowEndMs",coerce:"number",optional:!0}],scopes:["grants:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a grant's usage over 7d / 30d / a custom window (publisher: full metrics + daily series; subscriber: aggregate only)."},{key:"connect.connectAccess.listMyGrants",commandPath:["connect","connectAccess","listMyGrants"],opId:"GET /v1/connect/grants",method:"GET",pattern:"/v1/connect/grants",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["pending","active","rejected","revoked","expired","suspended"]},{name:"direction",coerce:null,optional:!0,choices:["sent","received"]},{name:"app",coerce:null,optional:!0},{name:"envKind",coerce:null,optional:!0,choices:["sandbox","production"]},{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["grants:read"],idempotent:!1,isQuery:!0,summary:"List access grants for the caller's org (optionally filtered by direction and status)."},{key:"connect.connectAccess.pauseGrant",commandPath:["connect","connectAccess","pauseGrant"],opId:"POST /v1/connect/grants/:grantId/pause",method:"POST",pattern:"/v1/connect/grants/:grantId/pause",pathParams:[{name:"grantGid",key:"grantId"}],flags:[],scopes:["grants:write"],idempotent:!0,isQuery:!1,summary:"Pause one grant the caller's org shares through: it stops crossing until resumed (publisher only)."},{key:"connect.connectAccess.replayDroppedForGrant",commandPath:["connect","connectAccess","replayDroppedForGrant"],opId:"POST /v1/connect/grants/:grantId/replay-dropped",method:"POST",pattern:"/v1/connect/grants/:grantId/replay-dropped",pathParams:[{name:"grantGid",key:"grantId"}],flags:[{name:"dryRun",coerce:"boolean",optional:!0}],scopes:["grants:write"],idempotent:!0,isQuery:!1,summary:"Replay the events a grant dropped: re-run its curable dead letters (over the limit, paused) through the full gate chain of the hop, in bounded pages (publisher only)."},{key:"connect.connectAccess.resumeAllGrantsForOrg",commandPath:["connect","connectAccess","resumeAllGrantsForOrg"],opId:"POST /v1/connect/grants/resume-all",method:"POST",pattern:"/v1/connect/grants/resume-all",pathParams:[],flags:[],scopes:["grants:admin"],idempotent:!1,isQuery:!1,summary:"Resume all sharing: return to active exactly the grants the caller's org's last pause of all sharing moved that are still paused and unexpired."},{key:"connect.connectAccess.resumeGrant",commandPath:["connect","connectAccess","resumeGrant"],opId:"POST /v1/connect/grants/:grantId/resume",method:"POST",pattern:"/v1/connect/grants/:grantId/resume",pathParams:[{name:"grantGid",key:"grantId"}],flags:[],scopes:["grants:write"],idempotent:!0,isQuery:!1,summary:"Resume one paused grant the caller's org shares through (publisher only); the events refused while it was paused stay dead letters."},{key:"connect.connectAccess.suspendAllGrantsForOrg",commandPath:["connect","connectAccess","suspendAllGrantsForOrg"],opId:"POST /v1/connect/grants/suspend-all",method:"POST",pattern:"/v1/connect/grants/suspend-all",pathParams:[],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["grants:admin"],idempotent:!1,isQuery:!1,summary:"Pause all sharing: suspend every active grant the caller's org has issued, in one call (the org kill switch; resume-all returns them)."},{key:"connect.connectBridges.listBridges",commandPath:["connect","connectBridges","listBridges"],opId:"GET /v1/connect/bridges",method:"GET",pattern:"/v1/connect/bridges",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["pending","active","suspended","archived"]},{name:"sourceOrgId",coerce:null,optional:!0},{name:"targetOrgId",coerce:null,optional:!0},{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["bridges:read"],idempotent:!1,isQuery:!0,summary:"List identity bridges for the caller's org."},{key:"connect.connectBridges.retrieveBridge",commandPath:["connect","connectBridges","retrieveBridge"],opId:"GET /v1/connect/bridges/:bridgeGid",method:"GET",pattern:"/v1/connect/bridges/:bridgeGid",pathParams:[{name:"bridgeGid",key:"bridgeGid"}],flags:[],scopes:["bridges:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single identity bridge."},{key:"connect.connectExplore.getExploreApp",commandPath:["connect","connectExplore","getExploreApp"],opId:"GET /v1/connect/explore/:appId",method:"GET",pattern:"/v1/connect/explore/:appId",pathParams:[{name:"appId",key:"appId"}],flags:[],scopes:["explore:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single discoverable Connect app."},{key:"connect.connectExplore.listExploreApps",commandPath:["connect","connectExplore","listExploreApps"],opId:"GET /v1/connect/explore",method:"GET",pattern:"/v1/connect/explore",pathParams:[],flags:[{name:"platformSlug",coerce:null,optional:!0},{name:"search",coerce:null,optional:!0},{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["explore:read"],idempotent:!1,isQuery:!0,summary:"List discoverable Connect apps (marketplace catalogue)."},{key:"connect.connectExplore.searchExploreApps",commandPath:["connect","connectExplore","searchExploreApps"],opId:"GET /v1/connect/explore/search",method:"GET",pattern:"/v1/connect/explore/search",pathParams:[],flags:[{name:"query",coerce:null,optional:!1},{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["explore:read"],idempotent:!1,isQuery:!0,summary:"Search discoverable Connect apps by query."},{key:"connect.connectInsights.getEcosystemGraph",commandPath:["connect","connectInsights","getEcosystemGraph"],opId:"GET /v1/connect/graph",method:"GET",pattern:"/v1/connect/graph",pathParams:[],flags:[{name:"partnerSlug",coerce:null,optional:!0},{name:"envKind",coerce:null,optional:!0,choices:["sandbox","production"]},{name:"direction",coerce:null,optional:!0,choices:["given","received"]},{name:"status",coerce:null,optional:!0,choices:["pending","active","rejected","revoked","expired","suspended"]},{name:"include",coerce:null,optional:!0}],scopes:["grants:read"],idempotent:!1,isQuery:!0,summary:"Retrieve the Connect graph of the caller's organization: org and app nodes, one edge per grant with its direction and its rates from the rollup, optionally the Feeds lens."},{key:"connect.connectInsights.getPublisherCompliance",commandPath:["connect","connectInsights","getPublisherCompliance"],opId:"GET /v1/connect/explore/:appId/compliance",method:"GET",pattern:"/v1/connect/explore/:appId/compliance",pathParams:[{name:"appId",key:"appId"}],flags:[{name:"publisherOrgId",coerce:null,optional:!0}],scopes:["explore:read"],idempotent:!1,isQuery:!0,summary:"Retrieve the compliance summary of the organization that owns a Connect-visible app (each figure measured or null)."},{key:"connect.connectPartner.getPartnerAuditFeed",commandPath:["connect","connectPartner","getPartnerAuditFeed"],opId:"GET /v1/connect/partner/audit",method:"GET",pattern:"/v1/connect/partner/audit",pathParams:[],flags:[{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0},{name:"action",coerce:null,optional:!0}],scopes:["partner:read"],idempotent:!1,isQuery:!0,summary:"Read the partner governance audit feed (platform operator)."},{key:"connect.connectProfile.getAppProfile",commandPath:["connect","connectProfile","getAppProfile"],opId:"GET /v1/connect/profile",method:"GET",pattern:"/v1/connect/profile",pathParams:[],flags:[],scopes:["profile:read"],idempotent:!1,isQuery:!0,summary:"Retrieve the caller org's own app connect profile."},{key:"connect.connectTenantApproval.getTenantApproval",commandPath:["connect","connectTenantApproval","getTenantApproval"],opId:"GET /v1/connect/tenant-approvals/:approvalGid",method:"GET",pattern:"/v1/connect/tenant-approvals/:approvalGid",pathParams:[{name:"approvalGid",key:"approvalGid"}],flags:[],scopes:["tenant_approvals:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single tenant approval."},{key:"connect.connectTenantApproval.listConsents",commandPath:["connect","connectTenantApproval","listConsents"],opId:"GET /v1/connect/consents",method:"GET",pattern:"/v1/connect/consents",pathParams:[],flags:[{name:"grantGid",coerce:null,optional:!0},{name:"status",coerce:null,optional:!0,choices:["active","revoked","frozen","delisted","expired"]},{name:"app",coerce:null,optional:!0},{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["tenant_approvals:read"],idempotent:!1,isQuery:!0,summary:"List the store consents (tenant approvals) of every grant the caller's org is party to, each with the receipt that approved it."},{key:"connect.connectTenantApproval.listPartnerTenantApprovals",commandPath:["connect","connectTenantApproval","listPartnerTenantApprovals"],opId:"GET /v1/connect/partner/tenant-approvals",method:"GET",pattern:"/v1/connect/partner/tenant-approvals",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["active","revoked","frozen","delisted","expired"]},{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["tenant_approvals:read"],idempotent:!1,isQuery:!0,summary:"List the tenant approvals the calling platform partner manages \u2014 every approval under a grant it publishes."},{key:"connect.connectTenantApproval.listPlatformConnectApprovals",commandPath:["connect","connectTenantApproval","listPlatformConnectApprovals"],opId:"GET /v1/connect/platform-connects/:connectGid/approvals",method:"GET",pattern:"/v1/connect/platform-connects/:connectGid/approvals",pathParams:[{name:"connectGid",key:"connectGid"}],flags:[{name:"status",coerce:null,optional:!0,choices:["active","revoked","frozen","delisted","expired"]},{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["tenant_approvals:read"],idempotent:!1,isQuery:!0,summary:"List the tenant approvals under one platform connect (the access grant named by connectGid); party-only."},{key:"connect.connectTenantApproval.listTenantApprovals",commandPath:["connect","connectTenantApproval","listTenantApprovals"],opId:"GET /v1/connect/tenant-approvals",method:"GET",pattern:"/v1/connect/tenant-approvals",pathParams:[],flags:[{name:"grantGid",coerce:null,optional:!1},{name:"status",coerce:null,optional:!0,choices:["active","revoked","frozen","delisted","expired"]},{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["tenant_approvals:read"],idempotent:!1,isQuery:!0,summary:"List tenant approvals for the caller's org."},{key:"connect.consentReceipts.listReceiptsByGrant",commandPath:["connect","consentReceipts","listReceiptsByGrant"],opId:"GET /v1/connect/grants/:grantId/consents",method:"GET",pattern:"/v1/connect/grants/:grantId/consents",pathParams:[{name:"grantGid",key:"grantId"}],flags:[{name:"status",coerce:null,optional:!0,choices:["active","revoked","frozen","delisted","expired"]},{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["tenant_approvals:read"],idempotent:!1,isQuery:!0,summary:"List the store consents of one grant, each with the receipt that approved it (either party)."},{key:"connect.entityNat.resolveEntity",commandPath:["connect","entityNat","resolveEntity"],opId:"GET /v1/entity-nat/resolve",method:"GET",pattern:"/v1/entity-nat/resolve",pathParams:[],flags:[{name:"entityTypeSlug",coerce:null,optional:!1},{name:"localEntityId",coerce:null,optional:!1}],scopes:["bridges:read"],idempotent:!0,isQuery:!0,summary:"Resolve a local entity to its universal entity token (SNAT read) for the caller's org."},{key:"connect.entityNat.reverseResolve",commandPath:["connect","entityNat","reverseResolve"],opId:"GET /v1/entity-nat/reverse-resolve",method:"GET",pattern:"/v1/entity-nat/reverse-resolve",pathParams:[],flags:[{name:"universalEntityToken",coerce:null,optional:!1}],scopes:["bridges:read"],idempotent:!0,isQuery:!0,summary:"Reverse-resolve a universal entity token to the caller's own local identifier (DNAT read)."},{key:"events.adapters.createAdapter",commandPath:["events","adapters","createAdapter"],opId:"POST /v1/adapters",method:"POST",pattern:"/v1/adapters",pathParams:[],flags:[{name:"name",coerce:null,optional:!1},{name:"type",coerce:null,optional:!1},{name:"config",coerce:"json",optional:!1},{name:"credentialId",coerce:null,optional:!0},{name:"credentials",coerce:"json",optional:!0},{name:"orgAdapterRegistryId",coerce:null,optional:!0}],scopes:["adapters:write"],idempotent:!1,isQuery:!1,summary:"Create an adapter for the organization; the config is validated against the provider type's schema and any inline credential is stored encrypted."},{key:"events.adapters.deleteAdapter",commandPath:["events","adapters","deleteAdapter"],opId:"DELETE /v1/adapters/:adapterGid",method:"DELETE",pattern:"/v1/adapters/:adapterGid",pathParams:[{name:"adapterGid",key:"adapterGid"}],flags:[],scopes:["adapters:write"],idempotent:!1,isQuery:!1,summary:"Remove an adapter: the row leaves the organization's list, its health checks stop and the credential stored for it is deactivated; a gid the organization does not hold is 403."},{key:"events.adapters.getAdapter",commandPath:["events","adapters","getAdapter"],opId:"GET /v1/adapters/:adapterGid",method:"GET",pattern:"/v1/adapters/:adapterGid",pathParams:[{name:"adapterGid",key:"adapterGid"}],flags:[],scopes:["adapters:read"],idempotent:!1,isQuery:!0,summary:"Retrieve one adapter by GID with its health verdict and circuit-breaker state; a cross-org GID is 403, never 404."},{key:"events.adapters.listAdapters",commandPath:["events","adapters","listAdapters"],opId:"GET /v1/adapters",method:"GET",pattern:"/v1/adapters",pathParams:[],flags:[],scopes:["adapters:read"],idempotent:!1,isQuery:!0,summary:"List the organization's adapters with their health verdict and circuit-breaker state."},{key:"events.adapters.updateAdapter",commandPath:["events","adapters","updateAdapter"],opId:"PATCH /v1/adapters/:adapterGid",method:"PATCH",pattern:"/v1/adapters/:adapterGid",pathParams:[{name:"adapterGid",key:"adapterGid"}],flags:[{name:"config",coerce:"json",optional:!0},{name:"enabled",coerce:"boolean",optional:!0}],scopes:["adapters:write"],idempotent:!1,isQuery:!1,summary:"Update an adapter's config or enabled state; a config change re-validates against the provider type's schema and increments the immutable version."},{key:"events.appDpopKeys.listKeys",commandPath:["events","appDpopKeys","listKeys"],opId:"GET /v1/apps/dpop-keys",method:"GET",pattern:"/v1/apps/dpop-keys",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["active","revoked"]},{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["keys:write"],idempotent:!1,isQuery:!0,summary:"List the app's own NPP DPoP signing keys (active and revoked) as a page of wire rows \u2014 the inventory the release door works from."},{key:"events.appDpopKeys.register",commandPath:["events","appDpopKeys","register"],opId:"POST /v1/apps/dpop-keys",method:"POST",pattern:"/v1/apps/dpop-keys",pathParams:[],flags:[{name:"publicKeyJwk",coerce:"json",optional:!1},{name:"algorithm",coerce:null,optional:!1,choices:["ES256","ES384","ES512","RS256","RS384","RS512","EdDSA"]},{name:"expiresAt",coerce:"number",optional:!0}],scopes:["keys:write"],idempotent:!0,isQuery:!1,summary:"Register an app's public DPoP/Ed25519 signing key for the NPP wire protocol."},{key:"events.appDpopKeys.revokeByThumbprint",commandPath:["events","appDpopKeys","revokeByThumbprint"],opId:"DELETE /v1/apps/dpop-keys/:thumbprint",method:"DELETE",pattern:"/v1/apps/dpop-keys/:thumbprint",pathParams:[{name:"jwkThumbprint",key:"thumbprint"}],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["keys:write"],idempotent:!0,isQuery:!1,summary:"Release (revoke) the app's own NPP DPoP signing key by its RFC 7638 thumbprint \u2014 the key leaves the JWKS anchor within one cache TTL; idempotent on a released key."},{key:"events.archiveReplay.archiveChannel",commandPath:["events","archiveReplay","archiveChannel"],opId:"POST /v1/channels/:channelId/messages/archive",method:"POST",pattern:"/v1/channels/:channelId/messages/archive",pathParams:[{name:"channelGid",key:"channelId"}],flags:[],scopes:["archive:write"],idempotent:!0,isQuery:!1,summary:"Archive a channel (prevents new publishes; idempotent)."},{key:"events.archiveReplay.getArchiveStatus",commandPath:["events","archiveReplay","getArchiveStatus"],opId:"GET /v1/channels/:channelId/archive-status",method:"GET",pattern:"/v1/channels/:channelId/archive-status",pathParams:[{name:"channelGid",key:"channelId"}],flags:[],scopes:["archive:read"],idempotent:!1,isQuery:!0,summary:"Get archive status + history stats for a channel."},{key:"events.archiveReplay.replayMessages",commandPath:["events","archiveReplay","replayMessages"],opId:"POST /v1/channels/:targetChannelGid/replay",method:"POST",pattern:"/v1/channels/:targetChannelGid/replay",pathParams:[{name:"targetChannelGid",key:"targetChannelGid"}],flags:[{name:"channelGid",coerce:null,optional:!1},{name:"fromTimestamp",coerce:"number",optional:!0},{name:"toTimestamp",coerce:"number",optional:!0}],scopes:["archive:replay"],idempotent:!1,isQuery:!1,summary:"Replay historical messages from a source channel to a target channel in publish-time order."},{key:"events.archiveReplay.replayMessagesWithGrant",commandPath:["events","archiveReplay","replayMessagesWithGrant"],opId:"POST /v1/channels/:targetChannelGid/replay-with-grant",method:"POST",pattern:"/v1/channels/:targetChannelGid/replay-with-grant",pathParams:[{name:"targetChannelGid",key:"targetChannelGid"}],flags:[{name:"channelGid",coerce:null,optional:!1},{name:"publisherAppId",coerce:null,optional:!1},{name:"subscriberOrgId",coerce:null,optional:!1},{name:"historicalEventTypes",coerce:"json",optional:!1},{name:"fromTimestamp",coerce:"number",optional:!0},{name:"toTimestamp",coerce:"number",optional:!0}],scopes:["archive:replay"],idempotent:!1,isQuery:!1,summary:"Replay archived messages with Connect grant re-evaluation at replay time."},{key:"events.archiveReplay.restoreChannel",commandPath:["events","archiveReplay","restoreChannel"],opId:"POST /v1/channels/:channelId/restore",method:"POST",pattern:"/v1/channels/:channelId/restore",pathParams:[{name:"channelGid",key:"channelId"}],flags:[],scopes:["archive:write"],idempotent:!1,isQuery:!1,summary:"Restore (un-archive) a channel back to active status."},{key:"events.catalogue.activateEventType",commandPath:["events","catalogue","activateEventType"],opId:"POST /v1/events/types/:eventTypeGid/activate",method:"POST",pattern:"/v1/events/types/:eventTypeGid/activate",pathParams:[{name:"eventTypeGid",key:"eventTypeGid"}],flags:[],scopes:["catalogue:write"],idempotent:!1,isQuery:!1,summary:"Activate an event type (draft \u2192 active lifecycle transition)."},{key:"events.catalogue.checkCompatibility",commandPath:["events","catalogue","checkCompatibility"],opId:"POST /v1/events/types/:eventTypeGid/compatibility",method:"POST",pattern:"/v1/events/types/:eventTypeGid/compatibility",pathParams:[{name:"eventTypeGid",key:"eventTypeGid"}],flags:[{name:"schemaDefinition",coerce:null,optional:!1},{name:"mode",coerce:null,optional:!1,choices:["backward","forward","full","none"]}],scopes:["catalogue:read"],idempotent:!1,isQuery:!0,summary:"Check a candidate schema definition against an event type's versions."},{key:"events.catalogue.deprecateEventType",commandPath:["events","catalogue","deprecateEventType"],opId:"POST /v1/events/types/:eventTypeGid/deprecate",method:"POST",pattern:"/v1/events/types/:eventTypeGid/deprecate",pathParams:[{name:"eventTypeGid",key:"eventTypeGid"}],flags:[{name:"message",coerce:null,optional:!1},{name:"sunsetDate",coerce:"number",optional:!0}],scopes:["catalogue:admin"],idempotent:!1,isQuery:!1,summary:"Deprecate an event type with a message and optional sunset date."},{key:"events.catalogue.getConsumers",commandPath:["events","catalogue","getConsumers"],opId:"GET /v1/events/types/:eventTypeGid/consumers",method:"GET",pattern:"/v1/events/types/:eventTypeGid/consumers",pathParams:[{name:"eventTypeGid",key:"eventTypeGid"}],flags:[],scopes:["catalogue:read"],idempotent:!1,isQuery:!0,summary:"List registered consumers for an event type."},{key:"events.catalogue.getEventTypeByGid",commandPath:["events","catalogue","getEventTypeByGid"],opId:"GET /v1/events/types/:eventTypeGid",method:"GET",pattern:"/v1/events/types/:eventTypeGid",pathParams:[{name:"eventTypeGid",key:"eventTypeGid"}],flags:[],scopes:["catalogue:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single event type by GID; a gid the caller cannot resolve answers 404 EVENTTYPE_NOT_FOUND."},{key:"events.catalogue.getEventTypeByName",commandPath:["events","catalogue","getEventTypeByName"],opId:"GET /v1/events/types/by-name/:name",method:"GET",pattern:"/v1/events/types/by-name/:name",pathParams:[{name:"name",key:"name"}],flags:[],scopes:["catalogue:read"],idempotent:!1,isQuery:!0,summary:"Look up an event type by name; an unresolvable name answers 404 NOT_FOUND."},{key:"events.catalogue.getImpactAnalysis",commandPath:["events","catalogue","getImpactAnalysis"],opId:"GET /v1/events/types/:eventTypeGid/impact",method:"GET",pattern:"/v1/events/types/:eventTypeGid/impact",pathParams:[{name:"eventTypeGid",key:"eventTypeGid"}],flags:[],scopes:["catalogue:read"],idempotent:!1,isQuery:!0,summary:"Get downstream impact analysis for an event type."},{key:"events.catalogue.getVersions",commandPath:["events","catalogue","getVersions"],opId:"GET /v1/events/types/:eventTypeGid/versions",method:"GET",pattern:"/v1/events/types/:eventTypeGid/versions",pathParams:[{name:"eventTypeGid",key:"eventTypeGid"}],flags:[],scopes:["catalogue:read"],idempotent:!1,isQuery:!0,summary:"List schema versions for an event type."},{key:"events.catalogue.listDeprecated",commandPath:["events","catalogue","listDeprecated"],opId:"GET /v1/apps/events/types/deprecated",method:"GET",pattern:"/v1/apps/events/types/deprecated",pathParams:[],flags:[],scopes:["catalogue:read"],idempotent:!1,isQuery:!0,summary:"List deprecated event types for an app."},{key:"events.catalogue.listEventTypes",commandPath:["events","catalogue","listEventTypes"],opId:"GET /v1/apps/events/types",method:"GET",pattern:"/v1/apps/events/types",pathParams:[],flags:[{name:"domain",coerce:null,optional:!0},{name:"status",coerce:null,optional:!0},{name:"tag",coerce:null,optional:!0}],scopes:["catalogue:read"],idempotent:!1,isQuery:!0,summary:"List event types for an app (filter by domain/status/tag)."},{key:"events.catalogue.registerEventType",commandPath:["events","catalogue","registerEventType"],opId:"POST /v1/apps/events/types",method:"POST",pattern:"/v1/apps/events/types",pathParams:[],flags:[{name:"name",coerce:null,optional:!1},{name:"displayName",coerce:null,optional:!1},{name:"description",coerce:null,optional:!1},{name:"domain",coerce:null,optional:!1},{name:"entity",coerce:null,optional:!1},{name:"action",coerce:null,optional:!1},{name:"ownership",coerce:"json",optional:!1},{name:"channels",coerce:"json",optional:!0},{name:"tags",coerce:"json",optional:!0},{name:"schema",coerce:"json",optional:!0}],scopes:["catalogue:write"],idempotent:!0,isQuery:!1,summary:"Register a new event type under an app."},{key:"events.catalogue.registerVersion",commandPath:["events","catalogue","registerVersion"],opId:"POST /v1/events/types/:eventTypeGid/versions",method:"POST",pattern:"/v1/events/types/:eventTypeGid/versions",pathParams:[{name:"eventTypeGid",key:"eventTypeGid"}],flags:[{name:"version",coerce:"number",optional:!1},{name:"schema",coerce:"json",optional:!1},{name:"compatibility",coerce:"json",optional:!0},{name:"changelog",coerce:null,optional:!1},{name:"publishedBy",coerce:null,optional:!1}],scopes:["catalogue:write"],idempotent:!0,isQuery:!1,summary:"Register a new schema version for an event type."},{key:"events.catalogue.updateEventType",commandPath:["events","catalogue","updateEventType"],opId:"PATCH /v1/events/types/:eventTypeGid",method:"PATCH",pattern:"/v1/events/types/:eventTypeGid",pathParams:[{name:"eventTypeGid",key:"eventTypeGid"}],flags:[{name:"displayName",coerce:null,optional:!0},{name:"description",coerce:null,optional:!0},{name:"ownership",coerce:"json",optional:!0},{name:"channels",coerce:"json",optional:!0},{name:"tags",coerce:"json",optional:!0},{name:"schema",coerce:"json",optional:!0}],scopes:["catalogue:write"],idempotent:!1,isQuery:!1,summary:"Update event type metadata (displayName, description, ownership, channels, tags) \u2014 schema changes go through versions."},{key:"events.channelDetail.getChannelDetail",commandPath:["events","channelDetail","getChannelDetail"],opId:"GET /v1/channels/:channelId/detail",method:"GET",pattern:"/v1/channels/:channelId/detail",pathParams:[{name:"channelGid",key:"channelId"}],flags:[],scopes:["channels:read"],idempotent:!1,isQuery:!0,summary:"Retrieve aggregated channel detail (channel, stats, subscribers, recent messages) by GID, or 404."},{key:"events.channels.archive",commandPath:["events","channels","archive"],opId:"POST /v1/channels/:channelId/archive",method:"POST",pattern:"/v1/channels/:channelId/archive",pathParams:[{name:"channelGid",key:"channelId"}],flags:[],scopes:["channels:admin"],idempotent:!1,isQuery:!1,summary:"Archive a channel (soft-delete + cascade)."},{key:"events.channels.create",commandPath:["events","channels","create"],opId:"POST /v1/apps/channels",method:"POST",pattern:"/v1/apps/channels",pathParams:[],flags:[{name:"name",coerce:null,optional:!1},{name:"slug",coerce:null,optional:!1},{name:"idempotencyKey",coerce:null,optional:!0},{name:"description",coerce:null,optional:!0},{name:"type",coerce:null,optional:!0,choices:["topic","queue","stream"]},{name:"schema",coerce:"json",optional:!0},{name:"settings",coerce:"json",optional:!0},{name:"metadata",coerce:"json",optional:!0},{name:"retentionMode",coerce:null,optional:!0,choices:["standard","compacted","compacted_with_log"]},{name:"compactionConfig",coerce:"json",optional:!0},{name:"nppMinQos",coerce:"number",optional:!0},{name:"rateLimit",coerce:"json",optional:!0},{name:"complianceClass",coerce:null,optional:!0,choices:["NONE","SOC2","GDPR","HIPAA","PCI","FEDRAMP_MOD","FEDRAMP_HIGH","IL5","ITAR"]},{name:"privacy",coerce:"json",optional:!0},{name:"privacyMode",coerce:null,optional:!0,choices:["standard","hybrid","e2e"]},{name:"pii",coerce:null,optional:!0,choices:["strip","allow","block"]}],scopes:["channels:write"],idempotent:!0,isQuery:!1,summary:"Create a channel under an app."},{key:"events.channels.get",commandPath:["events","channels","get"],opId:"GET /v1/channels/:channelId",method:"GET",pattern:"/v1/channels/:channelId",pathParams:[{name:"channelGid",key:"channelId"}],flags:[],scopes:["channels:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single channel by GID, or 404."},{key:"events.channels.getBySlug",commandPath:["events","channels","getBySlug"],opId:"GET /v1/apps/channels/by-slug/:slug",method:"GET",pattern:"/v1/apps/channels/by-slug/:slug",pathParams:[{name:"slug",key:"slug"}],flags:[],scopes:["channels:read"],idempotent:!1,isQuery:!0,summary:"Get a single channel by app + slug."},{key:"events.channels.list",commandPath:["events","channels","list"],opId:"GET /v1/apps/channels",method:"GET",pattern:"/v1/apps/channels",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["active","paused","archived"]},{name:"excludeFeedReceiving",coerce:"boolean",optional:!0},{name:"includeArchived",coerce:"boolean",optional:!0}],scopes:["channels:read"],idempotent:!1,isQuery:!0,summary:"List channels for an app."},{key:"events.channels.listAppIds",commandPath:["events","channels","listAppIds"],opId:"GET /v1/apps",method:"GET",pattern:"/v1/apps",pathParams:[],flags:[{name:"includeArchived",coerce:"boolean",optional:!0}],scopes:["channels:read"],idempotent:!1,isQuery:!0,summary:"List all distinct app ids that have channels for the caller's org."},{key:"events.channels.listPaginated",commandPath:["events","channels","listPaginated"],opId:"GET /v1/apps/channels/paginated",method:"GET",pattern:"/v1/apps/channels/paginated",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["active","paused","archived"]},{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0},{name:"includeArchived",coerce:"boolean",optional:!0},{name:"fields",coerce:null,optional:!0}],scopes:["channels:read"],idempotent:!1,isQuery:!0,summary:"List channels for an app with cursor-based pagination."},{key:"events.channels.listWithStats",commandPath:["events","channels","listWithStats"],opId:"GET /v1/apps/channels/stats",method:"GET",pattern:"/v1/apps/channels/stats",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["active","paused","archived"]},{name:"includeArchived",coerce:"boolean",optional:!0}],scopes:["channels:read"],idempotent:!1,isQuery:!0,summary:"List channels for an app with joined sub/group/binding/message/dlq stats."},{key:"events.channels.pause",commandPath:["events","channels","pause"],opId:"POST /v1/channels/:channelId/pause",method:"POST",pattern:"/v1/channels/:channelId/pause",pathParams:[{name:"channelGid",key:"channelId"}],flags:[],scopes:["channels:write"],idempotent:!1,isQuery:!1,summary:"Pause a channel (suspend deliveries)."},{key:"events.channels.remove",commandPath:["events","channels","remove"],opId:"DELETE /v1/channels/:channelId",method:"DELETE",pattern:"/v1/channels/:channelId",pathParams:[{name:"channelGid",key:"channelId"}],flags:[],scopes:["channels:admin"],idempotent:!0,isQuery:!1,summary:"Delete a channel \u2014 soft-delete: archive it and cascade-suspend its subscriptions (admin scope)."},{key:"events.channels.resume",commandPath:["events","channels","resume"],opId:"POST /v1/channels/:channelId/resume",method:"POST",pattern:"/v1/channels/:channelId/resume",pathParams:[{name:"channelGid",key:"channelId"}],flags:[],scopes:["channels:write"],idempotent:!1,isQuery:!1,summary:"Resume a paused channel."},{key:"events.channels.update",commandPath:["events","channels","update"],opId:"PATCH /v1/channels/:channelId",method:"PATCH",pattern:"/v1/channels/:channelId",pathParams:[{name:"channelGid",key:"channelId"}],flags:[{name:"complianceClass",coerce:null,optional:!0,choices:["NONE","SOC2","GDPR","HIPAA","PCI","FEDRAMP_MOD","FEDRAMP_HIGH","IL5","ITAR"]},{name:"nppMinQos",coerce:"number",optional:!0},{name:"rateLimit",coerce:"json",optional:!0},{name:"name",coerce:null,optional:!0},{name:"slug",coerce:null,optional:!0},{name:"description",coerce:null,optional:!0},{name:"status",coerce:null,optional:!0,choices:["active","paused","archived"]},{name:"schema",coerce:"json",optional:!0},{name:"settings",coerce:"json",optional:!0},{name:"privacy",coerce:"json",optional:!0},{name:"replication",coerce:"json",optional:!0},{name:"compactionConfig",coerce:"json",optional:!0},{name:"schemaValidation",coerce:"json",optional:!0},{name:"platformConnectEnforcement",coerce:"json",optional:!0},{name:"metadata",coerce:"json",optional:!0},{name:"pii",coerce:null,optional:!0,choices:["strip","allow","block"]}],scopes:["channels:write"],idempotent:!1,isQuery:!1,summary:"Update channel metadata/settings (partial)."},{key:"events.consume.ack",commandPath:["events","consume","ack"],opId:"POST /v1/subscriptions/:subscriptionId/ack",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/ack",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[{name:"records",coerce:"json",optional:!0},{name:"frameB64",coerce:null,optional:!0},{name:"visibilityExtensionSeconds",coerce:"number",optional:!0}],scopes:["subscriptions:read"],idempotent:!1,isQuery:!1,summary:"Acknowledge delivered records on a subscription (ack / reject / extend / dead-letter)."},{key:"events.consume.flowCredit",commandPath:["events","consume","flowCredit"],opId:"POST /v1/subscriptions/:subscriptionId/flow-credit",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/flow-credit",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[{name:"credit",coerce:null,optional:!1},{name:"partitionFilter",coerce:"number",optional:!0}],scopes:["subscriptions:read"],idempotent:!1,isQuery:!1,summary:"Grant a subscription receive-window flow credit; in pull mode this drives a credit-bounded DELIVER_BATCH."},{key:"events.consume.seek",commandPath:["events","consume","seek"],opId:"POST /v1/channels/:channelId/seek",method:"POST",pattern:"/v1/channels/:channelId/seek",pathParams:[{name:"channelGid",key:"channelId"}],flags:[{name:"consumerId",coerce:null,optional:!1},{name:"mode",coerce:"number",optional:!1},{name:"target",coerce:null,optional:!1}],scopes:["subscriptions:read"],idempotent:!1,isQuery:!1,summary:"Move a consumer's read position in the channel (offset / timestamp / beginning / end)."},{key:"events.consumerGroups.createGroup",commandPath:["events","consumerGroups","createGroup"],opId:"POST /v1/channels/:channelGid/consumer-groups",method:"POST",pattern:"/v1/channels/:channelGid/consumer-groups",pathParams:[{name:"channelGid",key:"channelGid"}],flags:[{name:"name",coerce:null,optional:!1},{name:"strategy",coerce:null,optional:!1,choices:["competing","sticky","broadcast"]},{name:"maxConcurrency",coerce:"number",optional:!0}],scopes:["consumer_groups:write"],idempotent:!0,isQuery:!1,summary:"Create a consumer group on a channel with a start-from policy."},{key:"events.consumerGroups.deleteGroup",commandPath:["events","consumerGroups","deleteGroup"],opId:"DELETE /v1/consumer-groups/:consumerGroupGid",method:"DELETE",pattern:"/v1/consumer-groups/:consumerGroupGid",pathParams:[{name:"groupGid",key:"consumerGroupGid"}],flags:[],scopes:["consumer_groups:admin"],idempotent:!1,isQuery:!1,summary:"Delete a consumer group and release its members' shares of the channel (members and per-member offsets go; the member subscriptions survive)."},{key:"events.consumerGroups.getGroup",commandPath:["events","consumerGroups","getGroup"],opId:"GET /v1/consumer-groups/:consumerGroupGid",method:"GET",pattern:"/v1/consumer-groups/:consumerGroupGid",pathParams:[{name:"groupGid",key:"consumerGroupGid"}],flags:[],scopes:["consumer_groups:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single consumer group with its members, or 404."},{key:"events.consumerGroups.joinGroup",commandPath:["events","consumerGroups","joinGroup"],opId:"POST /v1/consumer-groups/:consumerGroupGid/members",method:"POST",pattern:"/v1/consumer-groups/:consumerGroupGid/members",pathParams:[{name:"groupGid",key:"consumerGroupGid"}],flags:[{name:"subscriptionGid",coerce:null,optional:!1}],scopes:["consumer_groups:write"],idempotent:!1,isQuery:!1,summary:"Join a consumer group as a subscription member."},{key:"events.consumerGroups.leaveGroup",commandPath:["events","consumerGroups","leaveGroup"],opId:"DELETE /v1/consumer-groups/:consumerGroupGid/members/:subscriptionGid",method:"DELETE",pattern:"/v1/consumer-groups/:consumerGroupGid/members/:subscriptionGid",pathParams:[{name:"groupGid",key:"consumerGroupGid"},{name:"subscriptionGid",key:"subscriptionGid"}],flags:[],scopes:["consumer_groups:write"],idempotent:!1,isQuery:!1,summary:"Leave a consumer group (the member's share of the channel returns to the group)."},{key:"events.consumerGroups.listGroups",commandPath:["events","consumerGroups","listGroups"],opId:"GET /v1/channels/:channelGid/consumer-groups",method:"GET",pattern:"/v1/channels/:channelGid/consumer-groups",pathParams:[{name:"channelGid",key:"channelGid"}],flags:[],scopes:["consumer_groups:read"],idempotent:!1,isQuery:!0,summary:"List consumer groups for a channel."},{key:"events.consumerGroups.pauseGroup",commandPath:["events","consumerGroups","pauseGroup"],opId:"POST /v1/consumer-groups/:consumerGroupGid/pause",method:"POST",pattern:"/v1/consumer-groups/:consumerGroupGid/pause",pathParams:[{name:"groupGid",key:"consumerGroupGid"}],flags:[],scopes:["consumer_groups:write"],idempotent:!1,isQuery:!1,summary:"Pause a consumer group (suspend dispatch to members)."},{key:"events.consumerGroups.receive",commandPath:["events","consumerGroups","receive"],opId:"POST /v1/consumer-groups/:consumerGroupGid/members/:subscriptionGid/receive",method:"POST",pattern:"/v1/consumer-groups/:consumerGroupGid/members/:subscriptionGid/receive",pathParams:[{name:"groupGid",key:"consumerGroupGid"},{name:"subscriptionGid",key:"subscriptionGid"}],flags:[{name:"maxMessages",coerce:"number",optional:!0},{name:"waitTimeSeconds",coerce:"number",optional:!0}],scopes:["consumer_groups:read"],idempotent:!1,isQuery:!1,summary:"Pull a credit-bounded batch for a consumer-group member; each message goes to exactly one member."},{key:"events.consumerGroups.resumeGroup",commandPath:["events","consumerGroups","resumeGroup"],opId:"POST /v1/consumer-groups/:consumerGroupGid/resume",method:"POST",pattern:"/v1/consumer-groups/:consumerGroupGid/resume",pathParams:[{name:"groupGid",key:"consumerGroupGid"}],flags:[],scopes:["consumer_groups:write"],idempotent:!1,isQuery:!1,summary:"Resume a paused consumer group."},{key:"events.consumerGroups.updateGroup",commandPath:["events","consumerGroups","updateGroup"],opId:"PATCH /v1/consumer-groups/:consumerGroupGid",method:"PATCH",pattern:"/v1/consumer-groups/:consumerGroupGid",pathParams:[{name:"groupGid",key:"consumerGroupGid"}],flags:[{name:"strategy",coerce:null,optional:!0,choices:["competing","sticky","broadcast"]},{name:"maxConcurrency",coerce:"number",optional:!0}],scopes:["consumer_groups:write"],idempotent:!1,isQuery:!1,summary:"Update a consumer group's mutable fields (strategy, maxConcurrency)."},{key:"events.deliveries.cancel",commandPath:["events","deliveries","cancel"],opId:"POST /v1/deliveries/:deliveryGid/cancel",method:"POST",pattern:"/v1/deliveries/:deliveryGid/cancel",pathParams:[{name:"deliveryGid",key:"deliveryGid"}],flags:[],scopes:["deliveries:write"],idempotent:!1,isQuery:!1,summary:"Cancel a pending, inflight, or retrying delivery (halted as skipped; terminal deliveries refuse)."},{key:"events.deliveries.get",commandPath:["events","deliveries","get"],opId:"GET /v1/deliveries/:deliveryGid",method:"GET",pattern:"/v1/deliveries/:deliveryGid",pathParams:[{name:"deliveryGid",key:"deliveryGid"}],flags:[],scopes:["messages:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single delivery by GID, or 404."},{key:"events.deliveries.listByApp",commandPath:["events","deliveries","listByApp"],opId:"GET /v1/apps/deliveries",method:"GET",pattern:"/v1/apps/deliveries",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["pending","inflight","delivered","retrying","failed","dead_lettered","skipped"]},{name:"limit",coerce:"number",optional:!0}],scopes:["subscriptions:read"],idempotent:!1,isQuery:!0,summary:"List deliveries across every channel owned by an app."},{key:"events.deliveries.listByMessage",commandPath:["events","deliveries","listByMessage"],opId:"GET /v1/messages/:messageGid/deliveries",method:"GET",pattern:"/v1/messages/:messageGid/deliveries",pathParams:[{name:"messageGid",key:"messageGid"}],flags:[],scopes:["messages:read"],idempotent:!1,isQuery:!0,summary:"List delivery attempts for a message."},{key:"events.deliveries.listBySubscription",commandPath:["events","deliveries","listBySubscription"],opId:"GET /v1/subscriptions/:subscriptionGid/deliveries",method:"GET",pattern:"/v1/subscriptions/:subscriptionGid/deliveries",pathParams:[{name:"subscriptionGid",key:"subscriptionGid"}],flags:[{name:"status",coerce:null,optional:!0,choices:["pending","inflight","delivered","retrying","failed","dead_lettered","skipped"]},{name:"limit",coerce:"number",optional:!0}],scopes:["subscriptions:read"],idempotent:!1,isQuery:!0,summary:"List delivery history for a subscription with optional status filter."},{key:"events.deliveries.retry",commandPath:["events","deliveries","retry"],opId:"POST /v1/deliveries/:deliveryGid/retry",method:"POST",pattern:"/v1/deliveries/:deliveryGid/retry",pathParams:[{name:"deliveryGid",key:"deliveryGid"}],flags:[],scopes:["deliveries:write"],idempotent:!1,isQuery:!1,summary:"Retry a failed or dead-lettered delivery (one fresh attempt through the real delivery pipeline)."},{key:"events.deliveryReceipts.confirm",commandPath:["events","deliveryReceipts","confirm"],opId:"POST /v1/delivery-receipts/:deliveryId/confirm",method:"POST",pattern:"/v1/delivery-receipts/:deliveryId/confirm",pathParams:[{name:"deliveryGid",key:"deliveryId"}],flags:[{name:"status",coerce:null,optional:!1,choices:["acknowledged","processed","rejected","deferred"]},{name:"responseCode",coerce:null,optional:!0},{name:"reason",coerce:null,optional:!0},{name:"processingTimeMs",coerce:"number",optional:!0},{name:"deferUntil",coerce:"number",optional:!0}],scopes:["subscriptions:write"],idempotent:!0,isQuery:!1,summary:"Confirm a delivery receipt (acknowledged/processed/rejected/deferred)."},{key:"events.deliveryReceipts.getByDelivery",commandPath:["events","deliveryReceipts","getByDelivery"],opId:"GET /v1/delivery-receipts/:deliveryId",method:"GET",pattern:"/v1/delivery-receipts/:deliveryId",pathParams:[{name:"deliveryGid",key:"deliveryId"}],flags:[],scopes:["messages:read"],idempotent:!1,isQuery:!0,summary:"Retrieve the delivery receipt for a delivery GID, or null."},{key:"events.deliveryReceipts.getHealth",commandPath:["events","deliveryReceipts","getHealth"],opId:"GET /v1/subscriptions/:subscriptionId/webhook-health",method:"GET",pattern:"/v1/subscriptions/:subscriptionId/webhook-health",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[],scopes:["subscriptions:read"],idempotent:!1,isQuery:!0,summary:"Get webhook endpoint health state for a subscription (healthy/degraded/unhealthy)."},{key:"events.deliveryReceipts.listBySubscription",commandPath:["events","deliveryReceipts","listBySubscription"],opId:"GET /v1/subscriptions/:subscriptionId/delivery-receipts",method:"GET",pattern:"/v1/subscriptions/:subscriptionId/delivery-receipts",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[{name:"limit",coerce:"number",optional:!0}],scopes:["subscriptions:read"],idempotent:!1,isQuery:!0,summary:"List delivery receipts for a subscription."},{key:"events.deliveryReceipts.listDegraded",commandPath:["events","deliveryReceipts","listDegraded"],opId:"GET /v1/webhook-health/degraded",method:"GET",pattern:"/v1/webhook-health/degraded",pathParams:[],flags:[],scopes:["subscriptions:read"],idempotent:!1,isQuery:!0,summary:"List degraded/unhealthy webhook endpoints for the caller's org."},{key:"events.dlq.bulkDiscard",commandPath:["events","dlq","bulkDiscard"],opId:"POST /v1/dlq/discard",method:"POST",pattern:"/v1/dlq/discard",pathParams:[],flags:[{name:"dlqEntryGids",coerce:"json",optional:!1},{name:"reason",coerce:null,optional:!0}],scopes:["dlq:admin"],idempotent:!1,isQuery:!1,summary:"Discard multiple DLQ entries (bulk); answers the work it did."},{key:"events.dlq.bulkReprocess",commandPath:["events","dlq","bulkReprocess"],opId:"POST /v1/dlq/retry",method:"POST",pattern:"/v1/dlq/retry",pathParams:[],flags:[{name:"dlqEntryGids",coerce:"json",optional:!1}],scopes:["dlq:write"],idempotent:!1,isQuery:!1,summary:"Re-enqueue multiple DLQ entries with fresh attempt counts (bulk)."},{key:"events.dlq.discard",commandPath:["events","dlq","discard"],opId:"POST /v1/dlq/:dlqEntryId/discard",method:"POST",pattern:"/v1/dlq/:dlqEntryId/discard",pathParams:[{name:"dlqEntryGid",key:"dlqEntryId"}],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["dlq:admin"],idempotent:!1,isQuery:!1,summary:"Discard a single DLQ entry so it is not reprocessed."},{key:"events.dlq.get",commandPath:["events","dlq","get"],opId:"GET /v1/dlq/:dlqEntryId",method:"GET",pattern:"/v1/dlq/:dlqEntryId",pathParams:[{name:"dlqEntryGid",key:"dlqEntryId"}],flags:[],scopes:["dlq:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single DLQ entry by GID with its immutable audit trail."},{key:"events.dlq.getStats",commandPath:["events","dlq","getStats"],opId:"GET /v1/subscriptions/:subscriptionId/dlq/stats",method:"GET",pattern:"/v1/subscriptions/:subscriptionId/dlq/stats",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[],scopes:["dlq:read"],idempotent:!1,isQuery:!0,summary:"Return DLQ status counts and oldest/newest pending timestamps for a subscription."},{key:"events.dlq.getTrend",commandPath:["events","dlq","getTrend"],opId:"GET /v1/subscriptions/:subscriptionId/dlq/trend",method:"GET",pattern:"/v1/subscriptions/:subscriptionId/dlq/trend",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[{name:"hours",coerce:"number",optional:!0}],scopes:["dlq:read"],idempotent:!1,isQuery:!0,summary:"Return hourly-bucketed DLQ creation counts over a time window for a subscription."},{key:"events.dlq.listByApp",commandPath:["events","dlq","listByApp"],opId:"GET /v1/apps/dlq",method:"GET",pattern:"/v1/apps/dlq",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["pending","reprocessing","reprocessed","discarded"]},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["dlq:read"],idempotent:!1,isQuery:!0,summary:"List DLQ entries across every channel owned by an app."},{key:"events.dlq.listBySubscription",commandPath:["events","dlq","listBySubscription"],opId:"GET /v1/subscriptions/:subscriptionId/dlq",method:"GET",pattern:"/v1/subscriptions/:subscriptionId/dlq",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[{name:"status",coerce:null,optional:!0,choices:["pending","reprocessing","reprocessed","discarded"]},{name:"limit",coerce:"number",optional:!0}],scopes:["dlq:read"],idempotent:!1,isQuery:!0,summary:"List DLQ entries for a subscription."},{key:"events.dlq.reprocess",commandPath:["events","dlq","reprocess"],opId:"POST /v1/dlq/:dlqEntryId/reprocess",method:"POST",pattern:"/v1/dlq/:dlqEntryId/reprocess",pathParams:[{name:"dlqEntryGid",key:"dlqEntryId"}],flags:[],scopes:["dlq:write"],idempotent:!1,isQuery:!1,summary:"Re-enqueue a single DLQ entry with a fresh attempt count."},{key:"events.dlq.reprocessAllPending",commandPath:["events","dlq","reprocessAllPending"],opId:"POST /v1/subscriptions/:subscriptionId/dlq/reprocess",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/dlq/reprocess",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[{name:"limit",coerce:"number",optional:!0}],scopes:["dlq:write"],idempotent:!1,isQuery:!1,summary:"Re-enqueue all pending DLQ entries for a subscription with fresh attempt counts."},{key:"events.dlq.reprocessWithFilter",commandPath:["events","dlq","reprocessWithFilter"],opId:"POST /v1/dlq/reprocess",method:"POST",pattern:"/v1/dlq/reprocess",pathParams:[],flags:[{name:"subscriptionGid",coerce:null,optional:!0},{name:"since",coerce:"number",optional:!0},{name:"until",coerce:"number",optional:!0},{name:"failureReason",coerce:null,optional:!0},{name:"routingKey",coerce:null,optional:!0},{name:"dryRun",coerce:"boolean",optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["dlq:write"],idempotent:!1,isQuery:!1,summary:"Time-bounded and filter-bounded DLQ replay with dryRun support."},{key:"events.exactlyOnce.confirmDelivery",commandPath:["events","exactlyOnce","confirmDelivery"],opId:"POST /v1/exactly-once/tokens/:token/confirm",method:"POST",pattern:"/v1/exactly-once/tokens/:token/confirm",pathParams:[{name:"token",key:"token"}],flags:[{name:"subscriptionGid",coerce:null,optional:!0},{name:"messageGid",coerce:null,optional:!0}],scopes:["messages:write"],idempotent:!1,isQuery:!1,summary:"Confirm delivery via its token so a retry MUST NOT redeliver the same message; presenting the (subscription, message) pair answers any token other than the pair's issued one REJECTED_DUPLICATE."},{key:"events.exactlyOnce.generateDeliveryToken",commandPath:["events","exactlyOnce","generateDeliveryToken"],opId:"POST /v1/exactly-once/tokens",method:"POST",pattern:"/v1/exactly-once/tokens",pathParams:[],flags:[{name:"subscriptionGid",coerce:null,optional:!1},{name:"messageGid",coerce:null,optional:!1},{name:"ttlMs",coerce:"number",optional:!0}],scopes:["messages:write"],idempotent:!0,isQuery:!1,summary:"Generate (or return existing) a unique delivery token bound to a (subscription, message) pair."},{key:"events.exactlyOnce.isDelivered",commandPath:["events","exactlyOnce","isDelivered"],opId:"GET /v1/exactly-once/delivered",method:"GET",pattern:"/v1/exactly-once/delivered",pathParams:[],flags:[{name:"subscriptionGid",coerce:null,optional:!1},{name:"messageGid",coerce:null,optional:!1}],scopes:["messages:read"],idempotent:!1,isQuery:!0,summary:"Check whether a message was already delivered to a subscription (exactly-once lookup)."},{key:"events.exchanges.create",commandPath:["events","exchanges","create"],opId:"POST /v1/exchanges",method:"POST",pattern:"/v1/exchanges",pathParams:[],flags:[{name:"name",coerce:null,optional:!1},{name:"type",coerce:null,optional:!1,choices:["direct","fanout","topic","headers"]},{name:"config",coerce:"json",optional:!0}],scopes:["exchanges:write"],idempotent:!0,isQuery:!1,summary:"Create an AMQP-style exchange (direct/fanout/topic/headers)."},{key:"events.exchanges.createBinding",commandPath:["events","exchanges","createBinding"],opId:"POST /v1/exchanges/:exchange_gid/bindings",method:"POST",pattern:"/v1/exchanges/:exchange_gid/bindings",pathParams:[{name:"exchangeGid",key:"exchange_gid"}],flags:[{name:"channelGid",coerce:null,optional:!1},{name:"routingKey",coerce:null,optional:!0},{name:"headerRules",coerce:"json",optional:!0}],scopes:["exchanges:write"],idempotent:!0,isQuery:!1,summary:"Bind a channel to an exchange with optional routing key/header rules."},{key:"events.exchanges.disable",commandPath:["events","exchanges","disable"],opId:"POST /v1/exchanges/:exchange_gid/disable",method:"POST",pattern:"/v1/exchanges/:exchange_gid/disable",pathParams:[{name:"exchangeGid",key:"exchange_gid"}],flags:[],scopes:["exchanges:write"],idempotent:!1,isQuery:!1,summary:"Disable an exchange (suspend routing)."},{key:"events.exchanges.dryRun",commandPath:["events","exchanges","dryRun"],opId:"POST /v1/exchanges/:exchange_gid/dry-run",method:"POST",pattern:"/v1/exchanges/:exchange_gid/dry-run",pathParams:[{name:"exchangeGid",key:"exchange_gid"}],flags:[{name:"routingKey",coerce:null,optional:!0},{name:"headers",coerce:"json",optional:!0}],scopes:["exchanges:read"],idempotent:!1,isQuery:!0,summary:"Resolve target channels for a routing key/headers without publishing."},{key:"events.exchanges.enable",commandPath:["events","exchanges","enable"],opId:"POST /v1/exchanges/:exchange_gid/enable",method:"POST",pattern:"/v1/exchanges/:exchange_gid/enable",pathParams:[{name:"exchangeGid",key:"exchange_gid"}],flags:[],scopes:["exchanges:write"],idempotent:!1,isQuery:!1,summary:"Re-enable a disabled exchange."},{key:"events.exchanges.get",commandPath:["events","exchanges","get"],opId:"GET /v1/exchanges/:exchange_gid",method:"GET",pattern:"/v1/exchanges/:exchange_gid",pathParams:[{name:"exchangeGid",key:"exchange_gid"}],flags:[],scopes:["exchanges:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single exchange by GID, or 404."},{key:"events.exchanges.getByGid",commandPath:["events","exchanges","getByGid"],opId:"GET /v1/exchanges/:exchange_gid/raw",method:"GET",pattern:"/v1/exchanges/:exchange_gid/raw",pathParams:[{name:"gid",key:"exchange_gid"}],flags:[],scopes:["exchanges:read"],idempotent:!1,isQuery:!0,summary:"Fetch the raw exchange row by GID."},{key:"events.exchanges.list",commandPath:["events","exchanges","list"],opId:"GET /v1/exchanges",method:"GET",pattern:"/v1/exchanges",pathParams:[],flags:[],scopes:["exchanges:read"],idempotent:!1,isQuery:!0,summary:"List AMQP-style exchanges for an app."},{key:"events.exchanges.listBindings",commandPath:["events","exchanges","listBindings"],opId:"GET /v1/exchanges/:exchange_gid/bindings",method:"GET",pattern:"/v1/exchanges/:exchange_gid/bindings",pathParams:[{name:"exchangeGid",key:"exchange_gid"}],flags:[],scopes:["exchanges:read"],idempotent:!1,isQuery:!0,summary:"List bindings for an exchange."},{key:"events.exchanges.listWithStats",commandPath:["events","exchanges","listWithStats"],opId:"GET /v1/exchanges/stats",method:"GET",pattern:"/v1/exchanges/stats",pathParams:[],flags:[],scopes:["exchanges:read"],idempotent:!1,isQuery:!0,summary:"List exchanges for an app with a joined bindingsCount per exchange."},{key:"events.exchanges.publishToExchange",commandPath:["events","exchanges","publishToExchange"],opId:"POST /v1/exchanges/:exchange_gid/publish",method:"POST",pattern:"/v1/exchanges/:exchange_gid/publish",pathParams:[{name:"exchangeGid",key:"exchange_gid"}],flags:[{name:"payload",coerce:"json",optional:!1},{name:"routingKey",coerce:null,optional:!0},{name:"headers",coerce:"json",optional:!0},{name:"partitionKey",coerce:null,optional:!0},{name:"idempotencyKey",coerce:null,optional:!0},{name:"priority",coerce:"number",optional:!0},{name:"metadata",coerce:"json",optional:!0},{name:"federationEntityId",coerce:null,optional:!0},{name:"entityRef",coerce:"json",optional:!0}],scopes:["exchanges:write"],idempotent:!0,isQuery:!1,summary:"Publish a message through an exchange; routes to channels per exchange type."},{key:"events.exchanges.remove",commandPath:["events","exchanges","remove"],opId:"DELETE /v1/exchanges/:exchange_gid",method:"DELETE",pattern:"/v1/exchanges/:exchange_gid",pathParams:[{name:"exchangeGid",key:"exchange_gid"}],flags:[],scopes:["exchanges:admin"],idempotent:!1,isQuery:!1,summary:"Delete an exchange and its bindings atomically (admin scope)."},{key:"events.exchanges.removeBinding",commandPath:["events","exchanges","removeBinding"],opId:"DELETE /v1/exchange-bindings/:binding_gid",method:"DELETE",pattern:"/v1/exchange-bindings/:binding_gid",pathParams:[{name:"bindingGid",key:"binding_gid"}],flags:[],scopes:["exchanges:write"],idempotent:!1,isQuery:!1,summary:"Remove an exchange binding by GID."},{key:"events.exchanges.update",commandPath:["events","exchanges","update"],opId:"PATCH /v1/exchanges/:exchange_gid",method:"PATCH",pattern:"/v1/exchanges/:exchange_gid",pathParams:[{name:"exchangeGid",key:"exchange_gid"}],flags:[{name:"name",coerce:null,optional:!0},{name:"config",coerce:"json",optional:!0}],scopes:["exchanges:write"],idempotent:!1,isQuery:!1,summary:"Update exchange metadata/config (partial)."},{key:"events.kvStore.deleteEntry",commandPath:["events","kvStore","deleteEntry"],opId:"DELETE /v1/kv/:channelGid/:key",method:"DELETE",pattern:"/v1/kv/:channelGid/:key",pathParams:[{name:"channelGid",key:"channelGid"},{name:"key",key:"key"}],flags:[],scopes:["kv:write"],idempotent:!1,isQuery:!1,summary:"Delete (tombstone) a key on a compacted channel."},{key:"events.kvStore.getEntry",commandPath:["events","kvStore","getEntry"],opId:"GET /v1/kv/:channelGid/:key",method:"GET",pattern:"/v1/kv/:channelGid/:key",pathParams:[{name:"channelGid",key:"channelGid"},{name:"key",key:"key"}],flags:[],scopes:["kv:read"],idempotent:!1,isQuery:!0,summary:"Get the latest value for a key on a compacted channel."},{key:"events.kvStore.getHistory",commandPath:["events","kvStore","getHistory"],opId:"GET /v1/kv/:channelGid/:key/history",method:"GET",pattern:"/v1/kv/:channelGid/:key/history",pathParams:[{name:"channelGid",key:"channelGid"},{name:"key",key:"key"}],flags:[{name:"limit",coerce:"number",optional:!0}],scopes:["kv:read"],idempotent:!1,isQuery:!0,summary:"Get the recent message history for a key on a compacted channel."},{key:"events.kvStore.listKeys",commandPath:["events","kvStore","listKeys"],opId:"GET /v1/kv/:channelGid/keys",method:"GET",pattern:"/v1/kv/:channelGid/keys",pathParams:[{name:"channelGid",key:"channelGid"}],flags:[{name:"limit",coerce:"number",optional:!0}],scopes:["kv:read"],idempotent:!1,isQuery:!0,summary:"List all non-deleted keys for a compacted channel."},{key:"events.kvStore.setEntry",commandPath:["events","kvStore","setEntry"],opId:"PUT /v1/kv/:channelGid/:key",method:"PUT",pattern:"/v1/kv/:channelGid/:key",pathParams:[{name:"channelGid",key:"channelGid"},{name:"key",key:"key"}],flags:[{name:"value",coerce:"json",optional:!1},{name:"expectedRevision",coerce:"number",optional:!0}],scopes:["kv:write"],idempotent:!0,isQuery:!1,summary:"Set the latest value for a key on a compacted channel (latest-value-wins). Pass expectedRevision for optimistic concurrency control (stale revision -> 409 CONFLICT)."},{key:"events.messages.get",commandPath:["events","messages","get"],opId:"GET /v1/messages/:messageId",method:"GET",pattern:"/v1/messages/:messageId",pathParams:[{name:"messageGid",key:"messageId"}],flags:[],scopes:["messages:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a message by GID; 404 absent, 410 MESSAGE_EXPIRED."},{key:"events.messages.list",commandPath:["events","messages","list"],opId:"GET /v1/channels/:channelId/messages",method:"GET",pattern:"/v1/channels/:channelId/messages",pathParams:[{name:"channelGid",key:"channelId"}],flags:[{name:"limit",coerce:"number",optional:!0},{name:"afterTimestamp",coerce:"number",optional:!0}],scopes:["messages:read"],idempotent:!1,isQuery:!0,summary:"List messages for a channel (cursor-paginated)."},{key:"events.messages.listByApp",commandPath:["events","messages","listByApp"],opId:"GET /v1/apps/messages",method:"GET",pattern:"/v1/apps/messages",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0}],scopes:["messages:read"],idempotent:!1,isQuery:!0,summary:"List messages across every channel owned by an app, newest-first."},{key:"events.messages.listByPartition",commandPath:["events","messages","listByPartition"],opId:"GET /v1/channels/:channelId/messages/partition/:partitionKey",method:"GET",pattern:"/v1/channels/:channelId/messages/partition/:partitionKey",pathParams:[{name:"channelGid",key:"channelId"},{name:"partitionKey",key:"partitionKey"}],flags:[{name:"limit",coerce:"number",optional:!0}],scopes:["messages:read"],idempotent:!1,isQuery:!0,summary:"List messages for a channel by partition key (ordered)."},{key:"events.messages.publish",commandPath:["events","messages","publish"],opId:"POST /v1/channels/:channelId/messages",method:"POST",pattern:"/v1/channels/:channelId/messages",pathParams:[{name:"channelGid",key:"channelId"}],flags:[{name:"channelSlug",coerce:null,optional:!0},{name:"payload",coerce:"json",optional:!1},{name:"routingKey",coerce:null,optional:!0},{name:"partitionKey",coerce:null,optional:!0},{name:"idempotencyKey",coerce:null,optional:!0},{name:"metadata",coerce:"json",optional:!0},{name:"priority",coerce:"number",optional:!0},{name:"federationEntityId",coerce:null,optional:!0},{name:"entityRef",coerce:"json",optional:!0},{name:"npp",coerce:"json",optional:!0},{name:"attributes",coerce:"json",optional:!0},{name:"ttl",coerce:"number",optional:!0},{name:"zkProof",coerce:"json",optional:!0}],scopes:["messages:write"],idempotent:!0,isQuery:!1,summary:"Publish a single message to a channel."},{key:"events.messages.publishBatch",commandPath:["events","messages","publishBatch"],opId:"POST /v1/channels/:channelId/messages/batch",method:"POST",pattern:"/v1/channels/:channelId/messages/batch",pathParams:[{name:"channelGid",key:"channelId"}],flags:[{name:"messages",coerce:"json",optional:!1},{name:"idempotencyKey",coerce:null,optional:!0}],scopes:["messages:write"],idempotent:!0,isQuery:!1,summary:"Batch publish messages to a channel (all-or-nothing, up to 500)."},{key:"events.messages.publishBatchNpp",commandPath:["events","messages","publishBatchNpp"],opId:"POST /v1/channels/:channelId/messages/batch-npp",method:"POST",pattern:"/v1/channels/:channelId/messages/batch-npp",pathParams:[{name:"channelGid",key:"channelId"}],flags:[{name:"channelSlug",coerce:null,optional:!0},{name:"frameBytesB64",coerce:null,optional:!1},{name:"sessionId",coerce:"number",optional:!1},{name:"maxInFlight",coerce:"number",optional:!0},{name:"projectedLagMs",coerce:"number",optional:!0},{name:"records",coerce:"json",optional:!1}],scopes:["messages:write"],idempotent:!0,isQuery:!1,summary:"Publish a batch of NPP PUBLISH_BATCH records; returns a per-record BULK_ACK."},{key:"events.messages.publishGroup",commandPath:["events","messages","publishGroup"],opId:"POST /v1/channels/:channelId/messages/group",method:"POST",pattern:"/v1/channels/:channelId/messages/group",pathParams:[{name:"channelGid",key:"channelId"}],flags:[{name:"messages",coerce:"json",optional:!1},{name:"priority",coerce:"number",optional:!0}],scopes:["messages:write"],idempotent:!1,isQuery:!1,summary:"Publish a group of related messages atomically (ordered as a unit)."},{key:"events.observability.getChannelDeliveryOverview",commandPath:["events","observability","getChannelDeliveryOverview"],opId:"GET /v1/channels/:channelId/delivery-overview",method:"GET",pattern:"/v1/channels/:channelId/delivery-overview",pathParams:[{name:"channelGid",key:"channelId"}],flags:[],scopes:["channels:read"],idempotent:!1,isQuery:!0,summary:"Get a 24h delivery overview (publish + delivery stats, per-subscription health) for a channel."},{key:"events.observability.getChannelSubscriptionHealth",commandPath:["events","observability","getChannelSubscriptionHealth"],opId:"GET /v1/channels/:channelId/subscriptions/health",method:"GET",pattern:"/v1/channels/:channelId/subscriptions/health",pathParams:[{name:"channelGid",key:"channelId"}],flags:[],scopes:["channels:read"],idempotent:!1,isQuery:!0,summary:"Get health (success rate, latency, issues) for every subscription on a channel."},{key:"events.observability.getDeliveryTimeline",commandPath:["events","observability","getDeliveryTimeline"],opId:"GET /v1/deliveries/:deliveryId/timeline",method:"GET",pattern:"/v1/deliveries/:deliveryId/timeline",pathParams:[{name:"deliveryGid",key:"deliveryId"}],flags:[],scopes:["messages:read"],idempotent:!1,isQuery:!0,summary:"Get the attempt-by-attempt timeline for a single delivery."},{key:"events.observability.getMessageDeliveryStatus",commandPath:["events","observability","getMessageDeliveryStatus"],opId:"GET /v1/messages/:messageId/delivery-status",method:"GET",pattern:"/v1/messages/:messageId/delivery-status",pathParams:[{name:"messageGid",key:"messageId"}],flags:[],scopes:["messages:read"],idempotent:!1,isQuery:!0,summary:"Get aggregated delivery status for a message across all subscriptions."},{key:"events.observability.searchMessages",commandPath:["events","observability","searchMessages"],opId:"GET /v1/messages/search",method:"GET",pattern:"/v1/messages/search",pathParams:[],flags:[{name:"channelGid",coerce:null,optional:!0},{name:"routingKey",coerce:null,optional:!0},{name:"status",coerce:null,optional:!0,choices:["pending","processing","delivered","failed"]},{name:"fromDate",coerce:"number",optional:!0},{name:"toDate",coerce:"number",optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["messages:read"],idempotent:!1,isQuery:!0,summary:"Search messages with delivery stats by channel, routing key, status, and date range."},{key:"events.queueAdmin.purgeQueue",commandPath:["events","queueAdmin","purgeQueue"],opId:"POST /v1/subscriptions/:subscriptionId/queue/purge",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/queue/purge",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[],scopes:["subscriptions:admin"],idempotent:!1,isQuery:!1,summary:"Purge all available and in-flight messages from a queue subscription's pull buffer."},{key:"events.queueAdmin.updateQueueConfig",commandPath:["events","queueAdmin","updateQueueConfig"],opId:"PATCH /v1/subscriptions/:subscriptionId/queue/config",method:"PATCH",pattern:"/v1/subscriptions/:subscriptionId/queue/config",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[{name:"config",coerce:"json",optional:!1}],scopes:["subscriptions:write"],idempotent:!1,isQuery:!1,summary:"Update queue subscription configuration (visibility timeout, retention, long-poll wait, DLQ redrive)."},{key:"events.queueBatch.changeMessageVisibilityBatch",commandPath:["events","queueBatch","changeMessageVisibilityBatch"],opId:"POST /v1/subscriptions/:subscriptionId/messages/batch-visibility",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/messages/batch-visibility",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[{name:"entries",coerce:"json",optional:!1}],scopes:["subscriptions:write"],idempotent:!1,isQuery:!1,summary:"Change the visibility timeout of up to 10 received queue messages in one batch."},{key:"events.queueBatch.deleteMessageBatch",commandPath:["events","queueBatch","deleteMessageBatch"],opId:"POST /v1/subscriptions/:subscriptionId/messages/batch-delete",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/messages/batch-delete",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[{name:"receiptHandles",coerce:"json",optional:!1}],scopes:["subscriptions:write"],idempotent:!1,isQuery:!1,summary:"Delete (acknowledge) up to 10 received queue messages by receipt handle in one batch."},{key:"events.queueQueries.getQueueInfo",commandPath:["events","queueQueries","getQueueInfo"],opId:"GET /v1/subscriptions/:subscriptionId/queue",method:"GET",pattern:"/v1/subscriptions/:subscriptionId/queue",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[],scopes:["subscriptions:read"],idempotent:!1,isQuery:!0,summary:"Get queue info and available/in-flight stats for a queue subscription."},{key:"events.queueQueries.listMessages",commandPath:["events","queueQueries","listMessages"],opId:"GET /v1/subscriptions/:subscriptionId/queue/messages",method:"GET",pattern:"/v1/subscriptions/:subscriptionId/queue/messages",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[{name:"limit",coerce:"number",optional:!0}],scopes:["subscriptions:read"],idempotent:!1,isQuery:!0,summary:"List messages accumulated in a queue subscription's pull buffer (browse, no claim)."},{key:"events.queues.changeMessageVisibility",commandPath:["events","queues","changeMessageVisibility"],opId:"POST /v1/subscriptions/:subscriptionId/messages/:receiptHandle/visibility",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/messages/:receiptHandle/visibility",pathParams:[{name:"subscriptionGid",key:"subscriptionId"},{name:"receiptHandle",key:"receiptHandle"}],flags:[{name:"visibilityTimeoutSeconds",coerce:"number",optional:!1}],scopes:["subscriptions:write"],idempotent:!1,isQuery:!1,summary:"Change the visibility timeout of a received queue message."},{key:"events.queues.deleteMessage",commandPath:["events","queues","deleteMessage"],opId:"DELETE /v1/subscriptions/:subscriptionId/messages/:receiptHandle",method:"DELETE",pattern:"/v1/subscriptions/:subscriptionId/messages/:receiptHandle",pathParams:[{name:"subscriptionGid",key:"subscriptionId"},{name:"receiptHandle",key:"receiptHandle"}],flags:[],scopes:["subscriptions:write"],idempotent:!1,isQuery:!1,summary:"Delete (acknowledge) a received queue message by its receipt handle."},{key:"events.queues.receiveMessages",commandPath:["events","queues","receiveMessages"],opId:"POST /v1/subscriptions/:subscriptionId/messages/receive",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/messages/receive",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[{name:"maxMessages",coerce:"number",optional:!0},{name:"visibilityTimeoutSeconds",coerce:"number",optional:!0},{name:"waitTimeSeconds",coerce:"number",optional:!0}],scopes:["subscriptions:read"],idempotent:!1,isQuery:!1,summary:"Receive up to N messages from a queue subscription, long-polling up to waitTimeSeconds (max 60) for the buffer to fill, with a visibility timeout."},{key:"events.receipts.acknowledge",commandPath:["events","receipts","acknowledge"],opId:"POST /v1/receipts/:receiptId/acknowledge",method:"POST",pattern:"/v1/receipts/:receiptId/acknowledge",pathParams:[{name:"receiptGid",key:"receiptId"}],flags:[{name:"acknowledgedAt",coerce:"number",optional:!0},{name:"metadata",coerce:"json",optional:!0}],scopes:["subscriptions:write"],idempotent:!1,isQuery:!1,summary:"Subscriber confirms receipt of a delivery, transitioning it from delivered to acknowledged."},{key:"events.receipts.get",commandPath:["events","receipts","get"],opId:"GET /v1/receipts/:receiptId",method:"GET",pattern:"/v1/receipts/:receiptId",pathParams:[{name:"gid",key:"receiptId"}],flags:[],scopes:["messages:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single delivery receipt (report message) by GID, or null."},{key:"events.receipts.getByDelivery",commandPath:["events","receipts","getByDelivery"],opId:"GET /v1/deliveries/:deliveryId/receipt",method:"GET",pattern:"/v1/deliveries/:deliveryId/receipt",pathParams:[{name:"deliveryGid",key:"deliveryId"}],flags:[],scopes:["messages:read"],idempotent:!1,isQuery:!0,summary:"Retrieve the delivery receipt for a delivery by delivery GID."},{key:"events.receipts.getStats",commandPath:["events","receipts","getStats"],opId:"GET /v1/subscriptions/:subscriptionId/receipts/stats",method:"GET",pattern:"/v1/subscriptions/:subscriptionId/receipts/stats",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[{name:"startTime",coerce:"number",optional:!0},{name:"endTime",coerce:"number",optional:!0}],scopes:["messages:read"],idempotent:!1,isQuery:!0,summary:"Return receipt status counts and delivery-latency percentiles for a subscription over a window."},{key:"events.receipts.listByChannel",commandPath:["events","receipts","listByChannel"],opId:"GET /v1/channels/:channelId/receipts",method:"GET",pattern:"/v1/channels/:channelId/receipts",pathParams:[{name:"channelGid",key:"channelId"}],flags:[{name:"status",coerce:null,optional:!0,choices:["delivered","acknowledged","processed","rejected","expired"]},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:"number",optional:!0}],scopes:["channels:read"],idempotent:!1,isQuery:!0,summary:"List delivery receipts for a channel filtered by status, cursor-paginated."},{key:"events.receipts.listByMessage",commandPath:["events","receipts","listByMessage"],opId:"GET /v1/messages/:messageId/receipts",method:"GET",pattern:"/v1/messages/:messageId/receipts",pathParams:[{name:"messageGid",key:"messageId"}],flags:[{name:"limit",coerce:"number",optional:!0}],scopes:["messages:read"],idempotent:!1,isQuery:!0,summary:"List delivery receipts (report messages) for a message."},{key:"events.receipts.listBySubscription",commandPath:["events","receipts","listBySubscription"],opId:"GET /v1/subscriptions/:subscriptionId/receipts",method:"GET",pattern:"/v1/subscriptions/:subscriptionId/receipts",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:"number",optional:!0}],scopes:["subscriptions:read"],idempotent:!1,isQuery:!0,summary:"List delivery receipts for a subscription, cursor-paginated."},{key:"events.scheduling.cancelScheduled",commandPath:["events","scheduling","cancelScheduled"],opId:"POST /v1/scheduled-messages/:scheduledMessageGid/cancel",method:"POST",pattern:"/v1/scheduled-messages/:scheduledMessageGid/cancel",pathParams:[{name:"scheduledMessageGid",key:"scheduledMessageGid"}],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["scheduled:write"],idempotent:!1,isQuery:!1,summary:"Cancel a scheduled message before its deliver time."},{key:"events.scheduling.getScheduledStatus",commandPath:["events","scheduling","getScheduledStatus"],opId:"GET /v1/scheduled-messages/:scheduledMessageGid",method:"GET",pattern:"/v1/scheduled-messages/:scheduledMessageGid",pathParams:[{name:"scheduledMessageGid",key:"scheduledMessageGid"}],flags:[],scopes:["scheduled:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a scheduled message by GID, or 404."},{key:"events.scheduling.listScheduled",commandPath:["events","scheduling","listScheduled"],opId:"GET /v1/channels/:channelGid/scheduled-messages",method:"GET",pattern:"/v1/channels/:channelGid/scheduled-messages",pathParams:[{name:"channelGid",key:"channelGid"}],flags:[],scopes:["scheduled:read"],idempotent:!1,isQuery:!0,summary:"List scheduled messages for a channel."},{key:"events.scheduling.scheduleDelay",commandPath:["events","scheduling","scheduleDelay"],opId:"POST /v1/channels/:channelGid/schedule/delay",method:"POST",pattern:"/v1/channels/:channelGid/schedule/delay",pathParams:[{name:"channelGid",key:"channelGid"}],flags:[{name:"payload",coerce:"json",optional:!1},{name:"delayMs",coerce:"number",optional:!1},{name:"routingKey",coerce:null,optional:!0},{name:"partitionKey",coerce:null,optional:!0},{name:"idempotencyKey",coerce:null,optional:!0},{name:"priority",coerce:"number",optional:!0},{name:"metadata",coerce:"json",optional:!0}],scopes:["scheduled:write"],idempotent:!0,isQuery:!1,summary:"Schedule a message for delivery after a relative delay (ms)."},{key:"events.scheduling.scheduleMessage",commandPath:["events","scheduling","scheduleMessage"],opId:"POST /v1/channels/:channelGid/schedule",method:"POST",pattern:"/v1/channels/:channelGid/schedule",pathParams:[{name:"channelGid",key:"channelGid"}],flags:[{name:"payload",coerce:"json",optional:!1},{name:"deliverAt",coerce:"number",optional:!1},{name:"routingKey",coerce:null,optional:!0},{name:"partitionKey",coerce:null,optional:!0},{name:"idempotencyKey",coerce:null,optional:!0},{name:"priority",coerce:"number",optional:!0},{name:"metadata",coerce:"json",optional:!0}],scopes:["scheduled:write"],idempotent:!0,isQuery:!1,summary:"Schedule a message for delivery at an absolute timestamp."},{key:"events.scheduling.updateScheduled",commandPath:["events","scheduling","updateScheduled"],opId:"PATCH /v1/scheduled-messages/:scheduledMessageGid",method:"PATCH",pattern:"/v1/scheduled-messages/:scheduledMessageGid",pathParams:[{name:"scheduledMessageGid",key:"scheduledMessageGid"}],flags:[{name:"deliverAt",coerce:"number",optional:!0},{name:"payload",coerce:"json",optional:!0}],scopes:["scheduled:write"],idempotent:!1,isQuery:!1,summary:"Update a scheduled message's deliver time or payload."},{key:"events.security.scanChannelSample",commandPath:["events","security","scanChannelSample"],opId:"GET /v1/channels/:channelId/security/scan-sample",method:"GET",pattern:"/v1/channels/:channelId/security/scan-sample",pathParams:[{name:"channelGid",key:"channelId"}],flags:[{name:"limit",coerce:"number",optional:!0}],scopes:["messages:read"],idempotent:!0,isQuery:!0,summary:"Scan a channel's most recent messages (default 20, cap 50) with the threat scanner, the PII pattern library and event-catalogue conformance; answers per-check verdicts and per-message findings (category, severity, JSON path \u2014 never bytes)."},{key:"events.snapshots.createSnapshot",commandPath:["events","snapshots","createSnapshot"],opId:"POST /v1/subscriptions/:subscriptionGid/snapshots",method:"POST",pattern:"/v1/subscriptions/:subscriptionGid/snapshots",pathParams:[{name:"subscriptionGid",key:"subscriptionGid"}],flags:[{name:"name",coerce:null,optional:!0},{name:"metadata",coerce:"json",optional:!0}],scopes:["snapshots:write"],idempotent:!0,isQuery:!1,summary:"Create a snapshot capturing a subscription's read position."},{key:"events.snapshots.listSnapshots",commandPath:["events","snapshots","listSnapshots"],opId:"GET /v1/subscriptions/:subscriptionGid/snapshots",method:"GET",pattern:"/v1/subscriptions/:subscriptionGid/snapshots",pathParams:[{name:"subscriptionGid",key:"subscriptionGid"}],flags:[],scopes:["snapshots:read"],idempotent:!1,isQuery:!0,summary:"List snapshots for a subscription."},{key:"events.snapshots.seekToSnapshot",commandPath:["events","snapshots","seekToSnapshot"],opId:"POST /v1/snapshots/:snapshotGid/seek",method:"POST",pattern:"/v1/snapshots/:snapshotGid/seek",pathParams:[{name:"snapshotGid",key:"snapshotGid"}],flags:[],scopes:["snapshots:write"],idempotent:!1,isQuery:!1,summary:"Seek a subscription's read position to a committed snapshot offset."},{key:"events.snapshots.seekToTimestamp",commandPath:["events","snapshots","seekToTimestamp"],opId:"POST /v1/channels/:channelGid/seek-to-timestamp",method:"POST",pattern:"/v1/channels/:channelGid/seek-to-timestamp",pathParams:[{name:"channelGid",key:"channelGid"}],flags:[{name:"timestamp",coerce:"number",optional:!1}],scopes:["snapshots:write"],idempotent:!1,isQuery:!1,summary:"Seek a channel's read position to a point-in-time and redeliver."},{key:"events.sources.getSource",commandPath:["events","sources","getSource"],opId:"GET /v1/sources/:sourceGid",method:"GET",pattern:"/v1/sources/:sourceGid",pathParams:[{name:"sourceGid",key:"sourceGid"}],flags:[],scopes:["observability:read"],idempotent:!1,isQuery:!0,summary:"Retrieve one WebSocket source binding by GID with its current status; a cross-org GID is 403."},{key:"events.sources.listSources",commandPath:["events","sources","listSources"],opId:"GET /v1/sources",method:"GET",pattern:"/v1/sources",pathParams:[],flags:[],scopes:["observability:read"],idempotent:!1,isQuery:!0,summary:"List the organization's WebSocket source bindings with their current status."},{key:"events.sources.pauseSource",commandPath:["events","sources","pauseSource"],opId:"POST /v1/sources/:sourceGid/pause",method:"POST",pattern:"/v1/sources/:sourceGid/pause",pathParams:[{name:"sourceGid",key:"sourceGid"}],flags:[],scopes:["observability:write"],idempotent:!1,isQuery:!1,summary:"Pause a WebSocket source: ingestion stops and the binding is retained. Idempotent."},{key:"events.sources.removeSource",commandPath:["events","sources","removeSource"],opId:"DELETE /v1/sources/:sourceGid",method:"DELETE",pattern:"/v1/sources/:sourceGid",pathParams:[{name:"sourceGid",key:"sourceGid"}],flags:[],scopes:["observability:write"],idempotent:!1,isQuery:!1,summary:"Remove a WebSocket source binding: it leaves the organization's list and its read door; a cross-org GID is 403."},{key:"events.sources.resumeSource",commandPath:["events","sources","resumeSource"],opId:"POST /v1/sources/:sourceGid/resume",method:"POST",pattern:"/v1/sources/:sourceGid/resume",pathParams:[{name:"sourceGid",key:"sourceGid"}],flags:[],scopes:["observability:write"],idempotent:!1,isQuery:!1,summary:"Resume a paused WebSocket source: ingestion restarts on the SAME binding and config. Idempotent."},{key:"events.stats.retrieve",commandPath:["events","stats","retrieve"],opId:"GET /v1/events/stats",method:"GET",pattern:"/v1/events/stats",pathParams:[],flags:[],scopes:["channels:read"],idempotent:!1,isQuery:!0,summary:"Org stat tiles \u2014 operational channel and subscription totals and messages published, from bounded per-org counters."},{key:"events.streams.commitOffset",commandPath:["events","streams","commitOffset"],opId:"POST /v1/channels/:channelId/streams/offset",method:"POST",pattern:"/v1/channels/:channelId/streams/offset",pathParams:[{name:"channelGid",key:"channelId"}],flags:[{name:"consumerId",coerce:null,optional:!1},{name:"offset",coerce:"number",optional:!1}],scopes:["streams:write"],idempotent:!1,isQuery:!1,summary:"Commit a consumer's stream offset (advance read position)."},{key:"events.streams.getOffset",commandPath:["events","streams","getOffset"],opId:"GET /v1/channels/:channelId/streams/offset",method:"GET",pattern:"/v1/channels/:channelId/streams/offset",pathParams:[{name:"channelGid",key:"channelId"}],flags:[{name:"consumerId",coerce:null,optional:!1}],scopes:["streams:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a consumer's current committed stream offset."},{key:"events.streams.listOffsets",commandPath:["events","streams","listOffsets"],opId:"GET /v1/channels/:channelId/streams/offsets",method:"GET",pattern:"/v1/channels/:channelId/streams/offsets",pathParams:[{name:"channelGid",key:"channelId"}],flags:[],scopes:["streams:read"],idempotent:!1,isQuery:!0,summary:"List all committed consumer offsets for a stream channel."},{key:"events.streams.openCrossOrgStream",commandPath:["events","streams","openCrossOrgStream"],opId:"GET /v1/channels/:channelId/streams/cross-org",method:"GET",pattern:"/v1/channels/:channelId/streams/cross-org",pathParams:[{name:"channelGid",key:"channelId"}],flags:[{name:"publisherAppId",coerce:null,optional:!1},{name:"subscriberOrgId",coerce:null,optional:!1}],scopes:["streams:read"],idempotent:!1,isQuery:!0,summary:"Open a cross-org stream reader and capture the grant scope snapshot."},{key:"events.streams.readFromOffset",commandPath:["events","streams","readFromOffset"],opId:"GET /v1/channels/:channelId/streams/read",method:"GET",pattern:"/v1/channels/:channelId/streams/read",pathParams:[{name:"channelGid",key:"channelId"}],flags:[{name:"offset",coerce:"number",optional:!1},{name:"limit",coerce:"number",optional:!0},{name:"subscriptionGid",coerce:null,optional:!0}],scopes:["streams:read"],idempotent:!1,isQuery:!1,summary:"Read a bounded stream window anchored at an offset (replay)."},{key:"events.streams.readFromOffsetWithGrant",commandPath:["events","streams","readFromOffsetWithGrant"],opId:"POST /v1/channels/:channelId/streams/cross-org/read",method:"POST",pattern:"/v1/channels/:channelId/streams/cross-org/read",pathParams:[{name:"channelGid",key:"channelId"}],flags:[{name:"offset",coerce:"number",optional:!1},{name:"limit",coerce:"number",optional:!0},{name:"publisherAppId",coerce:null,optional:!1},{name:"subscriberOrgId",coerce:null,optional:!1},{name:"snapshot",coerce:"json",optional:!1}],scopes:["streams:read"],idempotent:!1,isQuery:!1,summary:"Read a cross-org stream window with grant-scope enforcement."},{key:"events.streams.seekToTimestamp",commandPath:["events","streams","seekToTimestamp"],opId:"POST /v1/channels/:channelId/streams/seek",method:"POST",pattern:"/v1/channels/:channelId/streams/seek",pathParams:[{name:"channelGid",key:"channelId"}],flags:[{name:"consumerId",coerce:null,optional:!1},{name:"timestamp",coerce:"number",optional:!1}],scopes:["streams:write"],idempotent:!1,isQuery:!1,summary:"Seek a consumer's stream position to a target timestamp (replay)."},{key:"events.subscriptions.archive",commandPath:["events","subscriptions","archive"],opId:"POST /v1/subscriptions/:subscriptionId/archive",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/archive",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[],scopes:["subscriptions:write"],idempotent:!1,isQuery:!1,summary:"Archive a subscription (soft-delete; cancels pending deliveries)."},{key:"events.subscriptions.create",commandPath:["events","subscriptions","create"],opId:"POST /v1/channels/:channelId/subscriptions",method:"POST",pattern:"/v1/channels/:channelId/subscriptions",pathParams:[{name:"channelGid",key:"channelId"}],flags:[{name:"subscribesTo",coerce:null,optional:!0,choices:["messages","failures"]},{name:"idempotencyKey",coerce:null,optional:!0},{name:"consumerAppId",coerce:null,optional:!0},{name:"name",coerce:null,optional:!1},{name:"description",coerce:null,optional:!0},{name:"type",coerce:null,optional:!1,choices:["webhook","queue","adapter"]},{name:"filter",coerce:"json",optional:!0},{name:"subjectFilter",coerce:null,optional:!0},{name:"endpoint",coerce:"json",optional:!1},{name:"delivery",coerce:"json",optional:!0},{name:"dlq",coerce:"json",optional:!0},{name:"deliveryConfig",coerce:"json",optional:!0},{name:"metadata",coerce:"json",optional:!0},{name:"transformPipeId",coerce:null,optional:!0},{name:"transformTimeout",coerce:"number",optional:!0},{name:"transformOnFailure",coerce:null,optional:!0,choices:["deliver_raw","drop_to_dlq"]}],scopes:["subscriptions:write"],idempotent:!0,isQuery:!1,summary:"Create a subscription on a channel (respects Idempotency-Key)."},{key:"events.subscriptions.get",commandPath:["events","subscriptions","get"],opId:"GET /v1/subscriptions/:subscriptionId",method:"GET",pattern:"/v1/subscriptions/:subscriptionId",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[],scopes:["subscriptions:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single subscription by GID, or 404."},{key:"events.subscriptions.list",commandPath:["events","subscriptions","list"],opId:"GET /v1/channels/:channelId/subscriptions",method:"GET",pattern:"/v1/channels/:channelId/subscriptions",pathParams:[{name:"channelGid",key:"channelId"}],flags:[{name:"status",coerce:null,optional:!0,choices:["active","paused","disabled","archived"]}],scopes:["subscriptions:read"],idempotent:!1,isQuery:!0,summary:"List subscriptions for a channel (optional status filter)."},{key:"events.subscriptions.listByApp",commandPath:["events","subscriptions","listByApp"],opId:"GET /v1/apps/subscriptions",method:"GET",pattern:"/v1/apps/subscriptions",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["active","paused","disabled","archived"]}],scopes:["subscriptions:read"],idempotent:!1,isQuery:!0,summary:"List subscriptions whose channel is owned by an app."},{key:"events.subscriptions.pause",commandPath:["events","subscriptions","pause"],opId:"POST /v1/subscriptions/:subscriptionId/pause",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/pause",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[],scopes:["subscriptions:write"],idempotent:!1,isQuery:!1,summary:"Pause a subscription (skip fan-out to it; remains visible)."},{key:"events.subscriptions.remove",commandPath:["events","subscriptions","remove"],opId:"DELETE /v1/subscriptions/:subscriptionId",method:"DELETE",pattern:"/v1/subscriptions/:subscriptionId",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[],scopes:["subscriptions:admin"],idempotent:!0,isQuery:!1,summary:"Delete a subscription \u2014 soft-delete: archive it and cancel pending deliveries (admin scope)."},{key:"events.subscriptions.resume",commandPath:["events","subscriptions","resume"],opId:"POST /v1/subscriptions/:subscriptionId/resume",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/resume",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[],scopes:["subscriptions:write"],idempotent:!1,isQuery:!1,summary:"Resume a paused subscription (no replay of skipped publishes)."},{key:"events.subscriptions.revealSecret",commandPath:["events","subscriptions","revealSecret"],opId:"POST /v1/subscriptions/:subscriptionId/secret/reveal",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/secret/reveal",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[],scopes:["subscriptions:admin"],idempotent:!0,isQuery:!1,summary:"Reveal a webhook subscription's signing secret \u2014 dedicated, audited, admin-only."},{key:"events.subscriptions.rotateSecret",commandPath:["events","subscriptions","rotateSecret"],opId:"POST /v1/subscriptions/:subscriptionId/rotate",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/rotate",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[{name:"rotationGraceMs",coerce:"number",optional:!0}],scopes:["subscriptions:write"],idempotent:!1,isQuery:!1,summary:"Rotate the webhook signing secret (rolling rotation grace window)."},{key:"events.subscriptions.subscribe",commandPath:["events","subscriptions","subscribe"],opId:"POST /v1/channels/:channelId/subscribe",method:"POST",pattern:"/v1/channels/:channelId/subscribe",pathParams:[{name:"channelGid",key:"channelId"}],flags:[{name:"channelSlug",coerce:null,optional:!0},{name:"mode",coerce:null,optional:!1,choices:["log","queue","tail"]},{name:"deliveryPreference",coerce:null,optional:!1,choices:["push","pull","hybrid"]},{name:"cursor",coerce:null,optional:!1},{name:"consumerId",coerce:null,optional:!1},{name:"consumerThumbprint",coerce:null,optional:!0},{name:"qosCapabilities",coerce:"number",optional:!0},{name:"filters",coerce:"json",optional:!0}],scopes:["subscriptions:read"],idempotent:!1,isQuery:!1,summary:"Open a subscription on a channel and set where it starts reading."},{key:"events.subscriptions.unsubscribe",commandPath:["events","subscriptions","unsubscribe"],opId:"POST /v1/subscriptions/:subscriptionId/unsubscribe",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/unsubscribe",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[],scopes:["subscriptions:read"],idempotent:!1,isQuery:!1,summary:"Unsubscribe a pull consumer: release in-flight messages, move its read position to the newest message, keep the subscription."},{key:"events.subscriptions.update",commandPath:["events","subscriptions","update"],opId:"PATCH /v1/subscriptions/:subscriptionId",method:"PATCH",pattern:"/v1/subscriptions/:subscriptionId",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[{name:"name",coerce:null,optional:!0},{name:"description",coerce:null,optional:!0},{name:"status",coerce:null,optional:!0,choices:["active","paused","disabled","archived"]},{name:"filter",coerce:"json",optional:!0},{name:"endpoint",coerce:"json",optional:!0},{name:"delivery",coerce:"json",optional:!0},{name:"dlq",coerce:"json",optional:!0},{name:"metadata",coerce:"json",optional:!0},{name:"deliveryConfig",coerce:"json",optional:!0},{name:"transformPipeId",coerce:null,optional:!0},{name:"transformTimeout",coerce:"number",optional:!0},{name:"transformOnFailure",coerce:null,optional:!0,choices:["deliver_raw","drop_to_dlq"]}],scopes:["subscriptions:write"],idempotent:!1,isQuery:!1,summary:"Update subscription name/status/endpoint/filter (partial)."},{key:"events.systemEvents.listCatalog",commandPath:["events","systemEvents","listCatalog"],opId:"GET /v1/system-events/catalog",method:"GET",pattern:"/v1/system-events/catalog",pathParams:[],flags:[],scopes:["events:read"],idempotent:!1,isQuery:!0,summary:"List the subscribable SYSTEM-event catalog for the caller's org."},{key:"events.systemEvents.listDeliveries",commandPath:["events","systemEvents","listDeliveries"],opId:"GET /v1/system-events/subscriptions/:subscriptionId/deliveries",method:"GET",pattern:"/v1/system-events/subscriptions/:subscriptionId/deliveries",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[{name:"limit",coerce:"number",optional:!0}],scopes:["events:read"],idempotent:!1,isQuery:!0,summary:"List recent delivery attempts for an external SYSTEM-event subscription (metadata only)."},{key:"events.systemEvents.rotateSecret",commandPath:["events","systemEvents","rotateSecret"],opId:"POST /v1/system-events/subscriptions/:subscriptionId/rotate",method:"POST",pattern:"/v1/system-events/subscriptions/:subscriptionId/rotate",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[],scopes:["events:write"],idempotent:!1,isQuery:!1,summary:"Rotate an external SYSTEM-event subscription's HMAC secret (returned once)."},{key:"events.systemEvents.subscribe",commandPath:["events","systemEvents","subscribe"],opId:"POST /v1/system-events/subscriptions",method:"POST",pattern:"/v1/system-events/subscriptions",pathParams:[],flags:[{name:"slug",coerce:null,optional:!1},{name:"name",coerce:null,optional:!0},{name:"endpoint",coerce:"json",optional:!1},{name:"auth",coerce:null,optional:!0}],scopes:["events:write"],idempotent:!1,isQuery:!1,summary:"Subscribe an external endpoint to a reserved SYSTEM channel (sanitized delivery; one-time HMAC secret)."},{key:"events.systemEvents.unsubscribe",commandPath:["events","systemEvents","unsubscribe"],opId:"DELETE /v1/system-events/subscriptions/:subscriptionId",method:"DELETE",pattern:"/v1/system-events/subscriptions/:subscriptionId",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[],scopes:["events:write"],idempotent:!1,isQuery:!1,summary:"Unsubscribe an external SYSTEM-event subscription (archive + revoke credential)."},{key:"events.tieredStorage.getColdTierReplay",commandPath:["events","tieredStorage","getColdTierReplay"],opId:"POST /v1/channels/:channelGid/cold-tier/replay",method:"POST",pattern:"/v1/channels/:channelGid/cold-tier/replay",pathParams:[{name:"channelGid",key:"channelGid"}],flags:[{name:"fromTime",coerce:"number",optional:!1},{name:"toTime",coerce:"number",optional:!1},{name:"limit",coerce:"number",optional:!0}],scopes:["storage_policies:read"],idempotent:!1,isQuery:!0,summary:"Deprecated (the per-channel tier policy is retired): replay a channel's archived records published in a time range, within the plan's cold depth, as metadata only (timestamp, size, checksum)."},{key:"events.timeTravel.diffChannelBetween",commandPath:["events","timeTravel","diffChannelBetween"],opId:"POST /v1/channels/:channelGid/time-travel/diff",method:"POST",pattern:"/v1/channels/:channelGid/time-travel/diff",pathParams:[{name:"channelGid",key:"channelGid"}],flags:[{name:"fromTime",coerce:"number",optional:!1},{name:"toTime",coerce:"number",optional:!1},{name:"limit",coerce:"number",optional:!0}],scopes:["time_travel:read"],idempotent:!1,isQuery:!0,summary:"Return messages added to a channel between two timestamps (append-only diff)."},{key:"events.timeTravel.getChannelSnapshotAtTime",commandPath:["events","timeTravel","getChannelSnapshotAtTime"],opId:"POST /v1/channels/:channelGid/time-travel/snapshot",method:"POST",pattern:"/v1/channels/:channelGid/time-travel/snapshot",pathParams:[{name:"channelGid",key:"channelGid"}],flags:[{name:"asOf",coerce:"number",optional:!1},{name:"limit",coerce:"number",optional:!0}],scopes:["time_travel:read"],idempotent:!1,isQuery:!0,summary:"Return all messages in a channel as of a timestamp (point-in-time snapshot)."},{key:"events.timeTravel.getChannelSnapshotAtTimeWithGrantApi",commandPath:["events","timeTravel","getChannelSnapshotAtTimeWithGrantApi"],opId:"POST /v1/channels/:channelGid/time-travel/snapshot/grant",method:"POST",pattern:"/v1/channels/:channelGid/time-travel/snapshot/grant",pathParams:[{name:"channelGid",key:"channelGid"}],flags:[{name:"asOf",coerce:"number",optional:!1},{name:"publisherAppId",coerce:null,optional:!1},{name:"subscriberOrgId",coerce:null,optional:!1},{name:"historicalEventTypes",coerce:"json",optional:!1},{name:"limit",coerce:"number",optional:!0}],scopes:["time_travel:read"],idempotent:!1,isQuery:!1,summary:"Cross-org point-in-time channel snapshot; grant scope resolved at QUERY time, not at asOf."},{key:"events.timeTravel.getMessageAtTime",commandPath:["events","timeTravel","getMessageAtTime"],opId:"POST /v1/messages/:messageGid/time-travel",method:"POST",pattern:"/v1/messages/:messageGid/time-travel",pathParams:[{name:"messageGid",key:"messageGid"}],flags:[{name:"asOf",coerce:"number",optional:!1}],scopes:["time_travel:read"],idempotent:!1,isQuery:!0,summary:"Get a message as it existed at a point in time (append-only: the messages published at or before asOf)."},{key:"events.transactional.consumeAndPublish",commandPath:["events","transactional","consumeAndPublish"],opId:"POST /v1/messages/transactional",method:"POST",pattern:"/v1/messages/transactional",pathParams:[],flags:[{name:"sourceMessageGid",coerce:null,optional:!1},{name:"targetChannelGid",coerce:null,optional:!1},{name:"transformedPayload",coerce:"json",optional:!1},{name:"routingKey",coerce:null,optional:!0},{name:"partitionKey",coerce:null,optional:!0}],scopes:["messages:write"],idempotent:!0,isQuery:!1,summary:"Atomically consume a source message and publish a transformed message to a target channel."},{key:"events.transactional.consumeAndPublishMulti",commandPath:["events","transactional","consumeAndPublishMulti"],opId:"POST /v1/messages/transactional/multi",method:"POST",pattern:"/v1/messages/transactional/multi",pathParams:[],flags:[{name:"sourceMessageGid",coerce:null,optional:!1},{name:"targets",coerce:"json",optional:!1}],scopes:["messages:write"],idempotent:!0,isQuery:!1,summary:"Atomically consume a source message and publish transformed messages to multiple target channels (all-or-none)."},{key:"events.transactional.listDeliveriesByGroupGrantFifo",commandPath:["events","transactional","listDeliveriesByGroupGrantFifo"],opId:"GET /v1/groups/:groupId/grants/:grantId/deliveries",method:"GET",pattern:"/v1/groups/:groupId/grants/:grantId/deliveries",pathParams:[{name:"groupId",key:"groupId"},{name:"grantId",key:"grantId"}],flags:[],scopes:["messages:read"],idempotent:!1,isQuery:!0,summary:"List per-(group, grant) FIFO-ordered deliveries by publish order."},{key:"feed.customers.list",commandPath:["feed","customers","list"],opId:"GET /v1/feeds/customers",method:"GET",pattern:"/v1/feeds/customers",pathParams:[],flags:[{name:"listingGid",coerce:null,optional:!0},{name:"status",coerce:null,optional:!0,choices:["pending","active","paused","cancelled","expired"]},{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["feed:read"],idempotent:!1,isQuery:!0,summary:"List your feed customers, newest first: each buyer's relationship, its binding count and the events per second arriving to it."},{key:"feed.customers.retrieve",commandPath:["feed","customers","retrieve"],opId:"GET /v1/feeds/customers/:subscriptionId",method:"GET",pattern:"/v1/feeds/customers/:subscriptionId",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[],scopes:["feed:read"],idempotent:!1,isQuery:!0,summary:"Retrieve one of your feed customers with its arrivals: each 30-second bucket of the last hour and today."},{key:"feed.feedDeliveryBindings.listBindings",commandPath:["feed","feedDeliveryBindings","listBindings"],opId:"GET /v1/feeds/subscriptions/:subscriptionId/bindings",method:"GET",pattern:"/v1/feeds/subscriptions/:subscriptionId/bindings",pathParams:[{name:"feedSubscriptionGid",key:"subscriptionId"}],flags:[],scopes:["feed:read"],idempotent:!1,isQuery:!0,summary:"List the delivery bindings of a feed subscription \u2014 one row per target app."},{key:"feed.listings.declarePromise",commandPath:["feed","listings","declarePromise"],opId:"PUT /v1/feeds/listings/:listingId/promise",method:"PUT",pattern:"/v1/feeds/listings/:listingId/promise",pathParams:[{name:"listingGid",key:"listingId"}],flags:[{name:"retentionDays",coerce:"number",optional:!1},{name:"region",coerce:null,optional:!1},{name:"resaleAllowed",coerce:"boolean",optional:!1},{name:"afterRevoke",coerce:null,optional:!1}],scopes:["listings:write"],idempotent:!1,isQuery:!1,summary:"Declare or change your listing's promise; each change is signed as a new declaration and the previous one stays readable by its date."},{key:"feed.listings.enrichment",commandPath:["feed","listings","enrichment"],opId:"GET /v1/feeds/enrichment/listings",method:"GET",pattern:"/v1/feeds/enrichment/listings",pathParams:[],flags:[],scopes:["listings:read"],idempotent:!1,isQuery:!0,summary:"Per-listing customer counts and arrivals per second for every listing you publish, counted by npayload."},{key:"feed.listings.get",commandPath:["feed","listings","get"],opId:"GET /v1/feeds/mirror/listings/:listingId",method:"GET",pattern:"/v1/feeds/mirror/listings/:listingId",pathParams:[{name:"listingGid",key:"listingId"}],flags:[],scopes:["listings:read"],idempotent:!1,isQuery:!0,summary:"Read the Cell's mirrored copy of a feed listing (Admin is canonical) with its sync bookkeeping."},{key:"feed.listings.promise",commandPath:["feed","listings","promise"],opId:"GET /v1/feeds/listings/:listingId/promise",method:"GET",pattern:"/v1/feeds/listings/:listingId/promise",pathParams:[{name:"listingGid",key:"listingId"}],flags:[{name:"at",coerce:"number",optional:!0}],scopes:["feed:read"],idempotent:!1,isQuery:!0,summary:"Read a listing's promise: how long records are kept, where they stay, whether they may be passed on and what happens after a revoke, as the publisher signed it."},{key:"feed.publisherReputation.getOwnReputation",commandPath:["feed","publisherReputation","getOwnReputation"],opId:"GET /v1/feeds/reputation/me",method:"GET",pattern:"/v1/feeds/reputation/me",pathParams:[],flags:[],scopes:["publishers:read"],idempotent:!1,isQuery:!0,summary:"Read your own publisher's reputation score and standing (owner-only; read-only)."},{key:"feed.publishers.get",commandPath:["feed","publishers","get"],opId:"GET /v1/feeds/mirror/publishers/:publisherId",method:"GET",pattern:"/v1/feeds/mirror/publishers/:publisherId",pathParams:[{name:"publisherGid",key:"publisherId"}],flags:[],scopes:["publishers:read"],idempotent:!1,isQuery:!0,summary:"Read the Cell's mirrored copy of a feed publisher (Admin is canonical): the Publisher Shape for every reader, plus sync bookkeeping and Connect state for the owning org."},{key:"feed.reviews.create",commandPath:["feed","reviews","create"],opId:"POST /v1/feeds/subscriptions/:subscriptionId/reviews",method:"POST",pattern:"/v1/feeds/subscriptions/:subscriptionId/reviews",pathParams:[{name:"feedSubscriptionGid",key:"subscriptionId"}],flags:[{name:"rating",coerce:"number",optional:!1},{name:"title",coerce:null,optional:!0},{name:"body",coerce:null,optional:!0}],scopes:["feed:write"],idempotent:!0,isQuery:!1,summary:"Leave a review (1\u20135 stars + text) on the listing of one of your active feed subscriptions."},{key:"feed.reviews.flagReview",commandPath:["feed","reviews","flagReview"],opId:"POST /v1/feeds/reviews/:reviewId/flag",method:"POST",pattern:"/v1/feeds/reviews/:reviewId/flag",pathParams:[{name:"reviewGid",key:"reviewId"}],flags:[{name:"reason",coerce:null,optional:!1}],scopes:["feed:write"],idempotent:!0,isQuery:!1,summary:"Flag a review for moderation (status \u2192 flagged) with a reason."},{key:"feed.reviews.get",commandPath:["feed","reviews","get"],opId:"GET /v1/feeds/reviews/:reviewId",method:"GET",pattern:"/v1/feeds/reviews/:reviewId",pathParams:[{name:"reviewGid",key:"reviewId"}],flags:[],scopes:["feed:read"],idempotent:!1,isQuery:!0,summary:"Read one feed review by gid (a hidden review is visible only to its author)."},{key:"feed.reviews.getListingStatsBatch",commandPath:["feed","reviews","getListingStatsBatch"],opId:"POST /v1/feeds/listings/review-stats",method:"POST",pattern:"/v1/feeds/listings/review-stats",pathParams:[],flags:[{name:"listingGids",coerce:"json",optional:!1}],scopes:["feed:read"],idempotent:!1,isQuery:!0,summary:"Review count and average rating for several feed listings in one read (hidden reviews never counted; unknown gids omitted)."},{key:"feed.reviews.listByListing",commandPath:["feed","reviews","listByListing"],opId:"GET /v1/feeds/listings/:listingId/reviews",method:"GET",pattern:"/v1/feeds/listings/:listingId/reviews",pathParams:[{name:"listingGid",key:"listingId"}],flags:[{name:"limit",coerce:"number",optional:!0}],scopes:["feed:read"],idempotent:!1,isQuery:!0,summary:"List the published reviews of a feed listing (hidden reviews excluded)."},{key:"feed.reviews.respondToReview",commandPath:["feed","reviews","respondToReview"],opId:"POST /v1/feeds/reviews/:reviewId/respond",method:"POST",pattern:"/v1/feeds/reviews/:reviewId/respond",pathParams:[{name:"reviewGid",key:"reviewId"}],flags:[{name:"response",coerce:null,optional:!1}],scopes:["feed:write"],idempotent:!0,isQuery:!1,summary:"Post the publisher's one response to a review of its listing (exactly one per review)."},{key:"feed.subscriptions.getEnrichmentForSubscriber",commandPath:["feed","subscriptions","getEnrichmentForSubscriber"],opId:"GET /v1/feeds/enrichment/subscriptions",method:"GET",pattern:"/v1/feeds/enrichment/subscriptions",pathParams:[],flags:[{name:"subscriberOrgId",coerce:null,optional:!0}],scopes:["feed:read"],idempotent:!1,isQuery:!0,summary:"One org-pinned read: current-period usage and active delivery-binding count for every feed subscription of the calling org."},{key:"feed.subscriptions.getTrialStatus",commandPath:["feed","subscriptions","getTrialStatus"],opId:"GET /v1/feeds/subscriptions/:subscriptionId/trial",method:"GET",pattern:"/v1/feeds/subscriptions/:subscriptionId/trial",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[],scopes:["feed:read"],idempotent:!1,isQuery:!0,summary:"Read a feed subscription's sandbox-trial state: isTrial, deliveryState, quota, quotaRemaining, trialDaysRemaining."},{key:"pipes.agentExecutions.getAgentExecution",commandPath:["pipes","agentExecutions","getAgentExecution"],opId:"GET /v1/pipes/agent-executions/:agentExecutionGid",method:"GET",pattern:"/v1/pipes/agent-executions/:agentExecutionGid",pathParams:[{name:"agentExecutionGid",key:"agentExecutionGid"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single agent-driven workflow execution by GID."},{key:"pipes.agentExecutions.listAgentExecutions",commandPath:["pipes","agentExecutions","listAgentExecutions"],opId:"GET /v1/pipes/agent-executions",method:"GET",pattern:"/v1/pipes/agent-executions",pathParams:[],flags:[{name:"workflowGid",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List agent-driven workflow executions (optional workflow filter)."},{key:"pipes.analyses.getAnalysis",commandPath:["pipes","analyses","getAnalysis"],opId:"GET /v1/pipes/analyses/:analysisGid",method:"GET",pattern:"/v1/pipes/analyses/:analysisGid",pathParams:[{name:"analysisGid",key:"analysisGid"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single Analyze-stage analysis by GID."},{key:"pipes.analyses.listAnalyses",commandPath:["pipes","analyses","listAnalyses"],opId:"GET /v1/pipes/analyses",method:"GET",pattern:"/v1/pipes/analyses",pathParams:[],flags:[{name:"workflowGid",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List Analyze-stage analyses (optional workflow filter)."},{key:"pipes.connectors.deleteCredential",commandPath:["pipes","connectors","deleteCredential"],opId:"DELETE /v1/pipes/credentials/:credentialId",method:"DELETE",pattern:"/v1/pipes/credentials/:credentialId",pathParams:[{name:"credentialGid",key:"credentialId"}],flags:[],scopes:["credentials:admin"],idempotent:!0,isQuery:!1,summary:"Delete a connector credential. DESTRUCTIVE: requires the admin verb."},{key:"pipes.connectors.listCredentials",commandPath:["pipes","connectors","listCredentials"],opId:"GET /v1/pipes/credentials",method:"GET",pattern:"/v1/pipes/credentials",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["credentials:read"],idempotent:!1,isQuery:!0,summary:"List stored credentials (metadata only \u2014 never the secret)."},{key:"pipes.connectors.revokeCredential",commandPath:["pipes","connectors","revokeCredential"],opId:"POST /v1/pipes/credentials/:credentialId/revoke",method:"POST",pattern:"/v1/pipes/credentials/:credentialId/revoke",pathParams:[{name:"credentialGid",key:"credentialId"}],flags:[],scopes:["credentials:admin"],idempotent:!0,isQuery:!1,summary:"Revoke a credential (Zapier-style: unusable, secret unretrievable). DESTRUCTIVE: requires the admin verb."},{key:"pipes.connectors.rotateCredential",commandPath:["pipes","connectors","rotateCredential"],opId:"POST /v1/pipes/credentials/:credentialId/rotate",method:"POST",pattern:"/v1/pipes/credentials/:credentialId/rotate",pathParams:[{name:"credentialGid",key:"credentialId"}],flags:[{name:"newSecret",coerce:null,optional:!1}],scopes:["credentials:write"],idempotent:!0,isQuery:!1,summary:"Rotate a credential's secret (re-encrypted)."},{key:"pipes.connectors.storeCredential",commandPath:["pipes","connectors","storeCredential"],opId:"POST /v1/pipes/credentials",method:"POST",pattern:"/v1/pipes/credentials",pathParams:[],flags:[{name:"connectorId",coerce:null,optional:!1},{name:"name",coerce:null,optional:!1},{name:"auth",coerce:"json",optional:!1},{name:"secret",coerce:null,optional:!0}],scopes:["credentials:write"],idempotent:!0,isQuery:!1,summary:"Store a connector credential (stored encrypted)."},{key:"pipes.connectors.testCredentialPublic",commandPath:["pipes","connectors","testCredentialPublic"],opId:"POST /v1/pipes/credentials/test",method:"POST",pattern:"/v1/pipes/credentials/test",pathParams:[],flags:[{name:"connectorId",coerce:null,optional:!1},{name:"apiKey",coerce:null,optional:!1}],scopes:["credentials:write"],idempotent:!1,isQuery:!1,summary:"Test a connector credential (connectorId + apiKey in body)."},{key:"pipes.connectors.updateCredential",commandPath:["pipes","connectors","updateCredential"],opId:"PATCH /v1/pipes/credentials/:credentialId",method:"PATCH",pattern:"/v1/pipes/credentials/:credentialId",pathParams:[{name:"credentialGid",key:"credentialId"}],flags:[{name:"name",coerce:null,optional:!0},{name:"auth",coerce:"json",optional:!0}],scopes:["credentials:write"],idempotent:!1,isQuery:!1,summary:"Update credential metadata/auth (no secret rotation here)."},{key:"pipes.decisions.approveDecision",commandPath:["pipes","decisions","approveDecision"],opId:"POST /v1/pipes/decisions/:decisionGid/approve",method:"POST",pattern:"/v1/pipes/decisions/:decisionGid/approve",pathParams:[{name:"decisionGid",key:"decisionGid"}],flags:[{name:"rationale",coerce:null,optional:!0}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Approve a pending AI decision (idempotent \u2014 first actor preserved)."},{key:"pipes.decisions.getDecision",commandPath:["pipes","decisions","getDecision"],opId:"GET /v1/pipes/decisions/:decisionGid",method:"GET",pattern:"/v1/pipes/decisions/:decisionGid",pathParams:[{name:"decisionGid",key:"decisionGid"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single AI decision checkpoint by GID."},{key:"pipes.decisions.listDecisions",commandPath:["pipes","decisions","listDecisions"],opId:"GET /v1/pipes/decisions",method:"GET",pattern:"/v1/pipes/decisions",pathParams:[],flags:[{name:"gateState",coerce:null,optional:!0,choices:["auto-approved","pending-human-approval","approved","rejected","expired"]},{name:"workflowGid",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List AI decision checkpoints (optional gateState/workflow filter)."},{key:"pipes.decisions.rejectDecision",commandPath:["pipes","decisions","rejectDecision"],opId:"POST /v1/pipes/decisions/:decisionGid/reject",method:"POST",pattern:"/v1/pipes/decisions/:decisionGid/reject",pathParams:[{name:"decisionGid",key:"decisionGid"}],flags:[{name:"rationale",coerce:null,optional:!0}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Reject a pending AI decision (idempotent)."},{key:"pipes.dlq.discardDlqEntry",commandPath:["pipes","dlq","discardDlqEntry"],opId:"POST /v1/pipes/dlq/:dlqEntryId/discard",method:"POST",pattern:"/v1/pipes/dlq/:dlqEntryId/discard",pathParams:[{name:"dlqEntryId",key:"dlqEntryId"}],flags:[],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Discard an execution DLQ entry (idempotent \u2014 already-discarded is a no-op)."},{key:"pipes.dlq.getDlqEntry",commandPath:["pipes","dlq","getDlqEntry"],opId:"GET /v1/pipes/dlq/:dlqEntryId",method:"GET",pattern:"/v1/pipes/dlq/:dlqEntryId",pathParams:[{name:"dlqEntryId",key:"dlqEntryId"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single execution DLQ entry by id, or 404."},{key:"pipes.dlq.getDlqStats",commandPath:["pipes","dlq","getDlqStats"],opId:"GET /v1/pipes/dlq/stats",method:"GET",pattern:"/v1/pipes/dlq/stats",pathParams:[],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Aggregate execution DLQ stats (counts by status) for the caller's app."},{key:"pipes.dlq.listDlqEntries",commandPath:["pipes","dlq","listDlqEntries"],opId:"GET /v1/pipes/dlq",method:"GET",pattern:"/v1/pipes/dlq",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["pending","retrying","resolved","discarded","exhausted"]},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List execution DLQ entries for the caller's app (optional status filter)."},{key:"pipes.executions.cancelExecution",commandPath:["pipes","executions","cancelExecution"],opId:"POST /v1/pipes/executions/:executionId/cancel",method:"POST",pattern:"/v1/pipes/executions/:executionId/cancel",pathParams:[{name:"executionGid",key:"executionId"}],flags:[],scopes:["pipes:execute"],idempotent:!0,isQuery:!1,summary:"Cancel a running execution."},{key:"pipes.executions.executeNode",commandPath:["pipes","executions","executeNode"],opId:"POST /v1/pipes/workflows/:workflowId/nodes/:nodeId/execute",method:"POST",pattern:"/v1/pipes/workflows/:workflowId/nodes/:nodeId/execute",pathParams:[{name:"workflowGid",key:"workflowId"},{name:"nodeId",key:"nodeId"}],flags:[{name:"triggerData",coerce:"json",optional:!0},{name:"upstreamOutputs",coerce:"json",optional:!0},{name:"variables",coerce:"json",optional:!0},{name:"idempotencyKey",coerce:null,optional:!0}],scopes:["pipes:execute"],idempotent:!1,isQuery:!1,summary:"Execute a single workflow node in isolation (editor test-node)."},{key:"pipes.executions.getExecution",commandPath:["pipes","executions","getExecution"],opId:"GET /v1/pipes/executions/:executionId",method:"GET",pattern:"/v1/pipes/executions/:executionId",pathParams:[{name:"executionGid",key:"executionId"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single execution by GID, or 404."},{key:"pipes.executions.getExecutionStatus",commandPath:["pipes","executions","getExecutionStatus"],opId:"GET /v1/pipes/executions/:executionId/status",method:"GET",pattern:"/v1/pipes/executions/:executionId/status",pathParams:[{name:"executionGid",key:"executionId"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve an execution's status + per-node progress."},{key:"pipes.executions.listExecutions",commandPath:["pipes","executions","listExecutions"],opId:"GET /v1/pipes/workflows/:workflowId/executions",method:"GET",pattern:"/v1/pipes/workflows/:workflowId/executions",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[{name:"status",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List executions for a workflow (run history)."},{key:"pipes.executions.triggerExecution",commandPath:["pipes","executions","triggerExecution"],opId:"POST /v1/pipes/workflows/:workflowId/trigger",method:"POST",pattern:"/v1/pipes/workflows/:workflowId/trigger",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[{name:"triggeredBy",coerce:null,optional:!0},{name:"triggerData",coerce:"json",optional:!0},{name:"idempotencyKey",coerce:null,optional:!0}],scopes:["pipes:execute"],idempotent:!0,isQuery:!1,summary:"Trigger a workflow execution (manual run)."},{key:"pipes.governance.addToAllowlist",commandPath:["pipes","governance","addToAllowlist"],opId:"POST /v1/pipes/governance/allowlist",method:"POST",pattern:"/v1/pipes/governance/allowlist",pathParams:[],flags:[{name:"connectorIds",coerce:"json",optional:!1}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Add connector ids to the governance allowlist."},{key:"pipes.governance.addToBlocklist",commandPath:["pipes","governance","addToBlocklist"],opId:"POST /v1/pipes/governance/blocklist",method:"POST",pattern:"/v1/pipes/governance/blocklist",pathParams:[],flags:[{name:"connectorIds",coerce:"json",optional:!1}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Add connector ids to the governance blocklist."},{key:"pipes.governance.approveConnectorRequest",commandPath:["pipes","governance","approveConnectorRequest"],opId:"POST /v1/pipes/governance/approvals/:requestId/approve",method:"POST",pattern:"/v1/pipes/governance/approvals/:requestId/approve",pathParams:[{name:"requestId",key:"requestId"}],flags:[{name:"notes",coerce:null,optional:!0}],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Approve a connector approval request."},{key:"pipes.governance.getGovernanceSettings",commandPath:["pipes","governance","getGovernanceSettings"],opId:"GET /v1/pipes/governance",method:"GET",pattern:"/v1/pipes/governance",pathParams:[],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Get connector governance settings (mode, allow/block lists, restrictions)."},{key:"pipes.governance.listApprovalRequests",commandPath:["pipes","governance","listApprovalRequests"],opId:"GET /v1/pipes/governance/approvals",method:"GET",pattern:"/v1/pipes/governance/approvals",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["pending","approved","rejected","revoked"]},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List connector approval requests (optional status filter)."},{key:"pipes.governance.listGovernanceAuditLogs",commandPath:["pipes","governance","listGovernanceAuditLogs"],opId:"GET /v1/pipes/governance/audit",method:"GET",pattern:"/v1/pipes/governance/audit",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0},{name:"eventType",coerce:null,optional:!0},{name:"targetType",coerce:null,optional:!0},{name:"targetId",coerce:null,optional:!0},{name:"actorId",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List governance audit logs (optional filters)."},{key:"pipes.governance.listPendingApprovals",commandPath:["pipes","governance","listPendingApprovals"],opId:"GET /v1/pipes/governance/approvals/pending",method:"GET",pattern:"/v1/pipes/governance/approvals/pending",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List pending connector approval requests."},{key:"pipes.governance.rejectConnectorRequest",commandPath:["pipes","governance","rejectConnectorRequest"],opId:"POST /v1/pipes/governance/approvals/:requestId/reject",method:"POST",pattern:"/v1/pipes/governance/approvals/:requestId/reject",pathParams:[{name:"requestId",key:"requestId"}],flags:[{name:"notes",coerce:null,optional:!0}],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Reject a connector approval request."},{key:"pipes.governance.removeFromAllowlist",commandPath:["pipes","governance","removeFromAllowlist"],opId:"DELETE /v1/pipes/governance/allowlist",method:"DELETE",pattern:"/v1/pipes/governance/allowlist",pathParams:[],flags:[{name:"connectorIds",coerce:"json",optional:!1}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Remove connector ids from the governance allowlist."},{key:"pipes.governance.removeFromBlocklist",commandPath:["pipes","governance","removeFromBlocklist"],opId:"DELETE /v1/pipes/governance/blocklist",method:"DELETE",pattern:"/v1/pipes/governance/blocklist",pathParams:[],flags:[{name:"connectorIds",coerce:"json",optional:!1}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Remove connector ids from the governance blocklist."},{key:"pipes.governance.requestConnectorApproval",commandPath:["pipes","governance","requestConnectorApproval"],opId:"POST /v1/pipes/governance/approvals",method:"POST",pattern:"/v1/pipes/governance/approvals",pathParams:[],flags:[{name:"connectorGid",coerce:null,optional:!1},{name:"reason",coerce:null,optional:!0}],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Request approval to use a connector."},{key:"pipes.governance.revokeConnectorApproval",commandPath:["pipes","governance","revokeConnectorApproval"],opId:"POST /v1/pipes/governance/connectors/:connectorGid/revoke",method:"POST",pattern:"/v1/pipes/governance/connectors/:connectorGid/revoke",pathParams:[{name:"connectorGid",key:"connectorGid"}],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Revoke a previously approved connector."},{key:"pipes.governance.updateGovernanceSettings",commandPath:["pipes","governance","updateGovernanceSettings"],opId:"PATCH /v1/pipes/governance",method:"PATCH",pattern:"/v1/pipes/governance",pathParams:[],flags:[{name:"mode",coerce:null,optional:!0,choices:["open","allowlist","approval_required"]},{name:"allowedConnectors",coerce:"json",optional:!0},{name:"blockedConnectors",coerce:"json",optional:!0},{name:"allowedTiers",coerce:"json",optional:!0},{name:"allowedCategories",coerce:"json",optional:!0},{name:"requireFirstUseApproval",coerce:"boolean",optional:!0},{name:"autoApproveInternalConnectors",coerce:"boolean",optional:!0},{name:"maxCredentialsPerConnector",coerce:"number",optional:!0},{name:"auditConfig",coerce:"json",optional:!0}],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Update connector governance settings (mode, restrictions, audit config)."},{key:"pipes.recordDlq.discardRecordDlqEntry",commandPath:["pipes","recordDlq","discardRecordDlqEntry"],opId:"POST /v1/pipes/record-dlq/:entryGid/discard",method:"POST",pattern:"/v1/pipes/record-dlq/:entryGid/discard",pathParams:[{name:"entryGid",key:"entryGid"}],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Discard a record-DLQ entry (idempotent \u2014 preserves first discardedBy/discardedAt)."},{key:"pipes.recordDlq.getRecordDlqEntry",commandPath:["pipes","recordDlq","getRecordDlqEntry"],opId:"GET /v1/pipes/record-dlq/:entryGid",method:"GET",pattern:"/v1/pipes/record-dlq/:entryGid",pathParams:[{name:"entryGid",key:"entryGid"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single record-DLQ entry by GID, or 404."},{key:"pipes.recordDlq.getRecordDlqStats",commandPath:["pipes","recordDlq","getRecordDlqStats"],opId:"GET /v1/pipes/record-dlq/stats",method:"GET",pattern:"/v1/pipes/record-dlq/stats",pathParams:[],flags:[{name:"workflowGid",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Aggregate record-DLQ stats (counts by status) for the caller's app."},{key:"pipes.recordDlq.listRecordDlq",commandPath:["pipes","recordDlq","listRecordDlq"],opId:"GET /v1/pipes/record-dlq",method:"GET",pattern:"/v1/pipes/record-dlq",pathParams:[],flags:[{name:"workflowGid",coerce:null,optional:!0},{name:"status",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List record-level DLQ entries for the caller's app (optional workflow/status filter)."},{key:"pipes.recordDlq.replayRecordDlqEntry",commandPath:["pipes","recordDlq","replayRecordDlqEntry"],opId:"POST /v1/pipes/record-dlq/:entryGid/replay",method:"POST",pattern:"/v1/pipes/record-dlq/:entryGid/replay",pathParams:[{name:"entryGid",key:"entryGid"}],flags:[],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Replay a record-DLQ entry (re-run the failed record)."},{key:"pipes.tools.getTool",commandPath:["pipes","tools","getTool"],opId:"GET /v1/pipes/tools/:toolName",method:"GET",pattern:"/v1/pipes/tools/:toolName",pathParams:[{name:"toolName",key:"toolName"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single Tool Registry entry by tool name."},{key:"pipes.tools.listTools",commandPath:["pipes","tools","listTools"],opId:"GET /v1/pipes/tools",method:"GET",pattern:"/v1/pipes/tools",pathParams:[],flags:[{name:"stage",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List Tool Registry entries (optional stage filter)."},{key:"pipes.watermarks.getWatermark",commandPath:["pipes","watermarks","getWatermark"],opId:"GET /v1/pipes/watermarks/:sourceId",method:"GET",pattern:"/v1/pipes/watermarks/:sourceId",pathParams:[{name:"sourceId",key:"sourceId"}],flags:[{name:"workflowGid",coerce:null,optional:!1}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve the incremental-extract watermark for a source."},{key:"pipes.watermarks.listWatermarks",commandPath:["pipes","watermarks","listWatermarks"],opId:"GET /v1/pipes/watermarks",method:"GET",pattern:"/v1/pipes/watermarks",pathParams:[],flags:[{name:"workflowGid",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List watermarks (optional workflow filter)."},{key:"pipes.watermarks.resetWatermark",commandPath:["pipes","watermarks","resetWatermark"],opId:"POST /v1/pipes/watermarks/:watermarkGid/reset",method:"POST",pattern:"/v1/pipes/watermarks/:watermarkGid/reset",pathParams:[{name:"watermarkGid",key:"watermarkGid"}],flags:[{name:"newValue",coerce:null,optional:!0},{name:"reason",coerce:null,optional:!0}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Reset a watermark (idempotent \u2014 prior audit chain preserved)."},{key:"pipes.webhooks.getTriggerUrl",commandPath:["pipes","webhooks","getTriggerUrl"],opId:"GET /v1/pipes/webhook-triggers/:workflowId",method:"GET",pattern:"/v1/pipes/webhook-triggers/:workflowId",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Get the trigger URL, HMAC secret, and config for a webhook workflow."},{key:"pipes.webhooks.listWebhookWorkflows",commandPath:["pipes","webhooks","listWebhookWorkflows"],opId:"GET /v1/pipes/webhook-triggers",method:"GET",pattern:"/v1/pipes/webhook-triggers",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List webhook-triggered workflows for the caller's app."},{key:"pipes.webhooks.rotateWebhookSecret",commandPath:["pipes","webhooks","rotateWebhookSecret"],opId:"POST /v1/pipes/webhook-triggers/:workflowId/rotate-secret",method:"POST",pattern:"/v1/pipes/webhook-triggers/:workflowId/rotate-secret",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Rotate a webhook workflow's HMAC secret (returns the new secret)."},{key:"pipes.workflows.activateWorkflow",commandPath:["pipes","workflows","activateWorkflow"],opId:"POST /v1/pipes/workflows/:workflowId/activate",method:"POST",pattern:"/v1/pipes/workflows/:workflowId/activate",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Activate a paused or draft workflow."},{key:"pipes.workflows.archiveWorkflow",commandPath:["pipes","workflows","archiveWorkflow"],opId:"POST /v1/pipes/workflows/:workflowId/archive",method:"POST",pattern:"/v1/pipes/workflows/:workflowId/archive",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Archive a workflow (pause-then-archive if active)."},{key:"pipes.workflows.createWorkflow",commandPath:["pipes","workflows","createWorkflow"],opId:"POST /v1/pipes/workflows",method:"POST",pattern:"/v1/pipes/workflows",pathParams:[],flags:[{name:"name",coerce:null,optional:!1},{name:"description",coerce:null,optional:!0},{name:"definition",coerce:"json",optional:!1},{name:"triggerConfig",coerce:"json",optional:!1},{name:"maxDurationMs",coerce:"number",optional:!0}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Create a Pipes workflow in an app."},{key:"pipes.workflows.deleteWorkflow",commandPath:["pipes","workflows","deleteWorkflow"],opId:"DELETE /v1/pipes/workflows/:workflowId",method:"DELETE",pattern:"/v1/pipes/workflows/:workflowId",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[],scopes:["pipes:admin"],idempotent:!0,isQuery:!1,summary:"Delete a workflow. DESTRUCTIVE: requires the admin verb."},{key:"pipes.workflows.getWorkflow",commandPath:["pipes","workflows","getWorkflow"],opId:"GET /v1/pipes/workflows/:workflowId",method:"GET",pattern:"/v1/pipes/workflows/:workflowId",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single workflow by GID, or 404."},{key:"pipes.workflows.listConnectors",commandPath:["pipes","workflows","listConnectors"],opId:"GET /v1/pipes/connectors",method:"GET",pattern:"/v1/pipes/connectors",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List the connectors available to the caller's app (v1 allowlist)."},{key:"pipes.workflows.listWorkflows",commandPath:["pipes","workflows","listWorkflows"],opId:"GET /v1/pipes/workflows",method:"GET",pattern:"/v1/pipes/workflows",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List workflows for the caller's app."},{key:"pipes.workflows.pauseWorkflow",commandPath:["pipes","workflows","pauseWorkflow"],opId:"POST /v1/pipes/workflows/:workflowId/pause",method:"POST",pattern:"/v1/pipes/workflows/:workflowId/pause",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Pause an active workflow."},{key:"pipes.workflows.updateWorkflow",commandPath:["pipes","workflows","updateWorkflow"],opId:"PATCH /v1/pipes/workflows/:workflowId",method:"PATCH",pattern:"/v1/pipes/workflows/:workflowId",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[{name:"definition",coerce:"json",optional:!1}],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Update a workflow definition (nodes/edges); bumps the version."},{key:"pipes.workflows.updateWorkflowMeta",commandPath:["pipes","workflows","updateWorkflowMeta"],opId:"PATCH /v1/pipes/workflows/:workflowId/meta",method:"PATCH",pattern:"/v1/pipes/workflows/:workflowId/meta",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[{name:"name",coerce:null,optional:!0},{name:"description",coerce:null,optional:!0}],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Update workflow metadata only (name, description)."},{key:"pipes.workflows.updateWorkflowTriggerConfig",commandPath:["pipes","workflows","updateWorkflowTriggerConfig"],opId:"PATCH /v1/pipes/workflows/:workflowId/trigger-config",method:"PATCH",pattern:"/v1/pipes/workflows/:workflowId/trigger-config",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[{name:"triggerConfig",coerce:"json",optional:!1}],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Update a workflow's trigger configuration."},{key:"webhooks.webhooks.create",commandPath:["webhooks","webhooks","create"],opId:"POST /v1/webhooks",method:"POST",pattern:"/v1/webhooks",pathParams:[],flags:[{name:"channelGid",coerce:null,optional:!1},{name:"name",coerce:null,optional:!1},{name:"description",coerce:null,optional:!0},{name:"responseMode",coerce:null,optional:!0,choices:["immediate","wait"]},{name:"allowedIps",coerce:"json",optional:!0},{name:"rateLimit",coerce:"json",optional:!0},{name:"payload",coerce:"json",optional:!0},{name:"metadata",coerce:"json",optional:!0},{name:"idempotencyKey",coerce:null,optional:!0}],scopes:["webhooks:write"],idempotent:!0,isQuery:!1,summary:"Create an inbound webhook config on a channel (requires channels:read on the target channel); returns the signing secret exactly once (honours Idempotency-Key)."},{key:"webhooks.webhooks.get",commandPath:["webhooks","webhooks","get"],opId:"GET /v1/webhooks/:webhookId",method:"GET",pattern:"/v1/webhooks/:webhookId",pathParams:[{name:"webhookGid",key:"webhookId"}],flags:[],scopes:["webhooks:read"],idempotent:!1,isQuery:!0,summary:"Retrieve one inbound webhook by GID (secret-free)."},{key:"webhooks.webhooks.list",commandPath:["webhooks","webhooks","list"],opId:"GET /v1/webhooks",method:"GET",pattern:"/v1/webhooks",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["active","paused","revoked"]},{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["webhooks:read"],idempotent:!1,isQuery:!0,summary:"List inbound webhooks for the caller's app (cursor-paginated; revoked excluded unless status filter asks)."},{key:"webhooks.webhooks.revealSecret",commandPath:["webhooks","webhooks","revealSecret"],opId:"POST /v1/webhooks/:webhookId/reveal-secret",method:"POST",pattern:"/v1/webhooks/:webhookId/reveal-secret",pathParams:[{name:"webhookGid",key:"webhookId"}],flags:[],scopes:["webhooks:admin"],idempotent:!0,isQuery:!1,summary:"Reveal the current inbound signing secret \u2014 dedicated, audited, admin-only."},{key:"webhooks.webhooks.revoke",commandPath:["webhooks","webhooks","revoke"],opId:"DELETE /v1/webhooks/:webhookId",method:"DELETE",pattern:"/v1/webhooks/:webhookId",pathParams:[{name:"webhookGid",key:"webhookId"}],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["webhooks:admin"],idempotent:!0,isQuery:!1,summary:"Revoke an inbound webhook \u2014 terminal, idempotent; purges its signing keys."},{key:"webhooks.webhooks.rotateSecret",commandPath:["webhooks","webhooks","rotateSecret"],opId:"POST /v1/webhooks/:webhookId/rotate-secret",method:"POST",pattern:"/v1/webhooks/:webhookId/rotate-secret",pathParams:[{name:"webhookGid",key:"webhookId"}],flags:[{name:"rotationGraceMs",coerce:"number",optional:!0}],scopes:["webhooks:admin"],idempotent:!1,isQuery:!1,summary:"Rotate the inbound signing secret; the previous secret keeps verifying for the grace window (24 h default, 1 h..7 d)."},{key:"webhooks.webhooks.update",commandPath:["webhooks","webhooks","update"],opId:"PATCH /v1/webhooks/:webhookId",method:"PATCH",pattern:"/v1/webhooks/:webhookId",pathParams:[{name:"webhookGid",key:"webhookId"}],flags:[{name:"name",coerce:null,optional:!0},{name:"status",coerce:null,optional:!0,choices:["active","paused"]},{name:"description",coerce:null,optional:!0},{name:"responseMode",coerce:null,optional:!0,choices:["immediate","wait"]},{name:"allowedIps",coerce:"json",optional:!0},{name:"rateLimit",coerce:"json",optional:!0},{name:"payload",coerce:"json",optional:!0},{name:"metadata",coerce:"json",optional:!0}],scopes:["webhooks:write"],idempotent:!1,isQuery:!1,summary:"Update an inbound webhook's name, description, status (active|paused), IP allowlist, rate limit or payload limits \u2014 never its channel."}]}});var vf={};me(vf,{MASKED_SECRET_HEADER:()=>QP,assertNoRawSecretHeaders:()=>O1,findRawSecretHeaders:()=>ul,isSecretHeaderName:()=>bs,isSecretRef:()=>Qo,loadSecretEnv:()=>R1,maskSecretHeaderValues:()=>yf,parseDotenv:()=>Vo,parseSecretRef:()=>KP,redactSecretHeaders:()=>hf,resolveSecretRefs:()=>A1,secretRefFor:()=>zP});function gf(e){return e.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function x1(e){return e.trim().toLowerCase()==="authorization"?"AUTH":gf(e)}function zP(e,t){return`{{ secrets.${[e.app?gf(e.app):"",gf(e.channel),x1(t)].filter(o=>o.length>0).join("_")} }}`}function Qo(e){return typeof e=="string"&&BP.test(e)}function KP(e){if(typeof e!="string")return null;let t=BP.exec(e);return t?t[1]:null}function hf(e,t){let r={};for(let[o,n]of Object.entries(e))bs(o)&&!Qo(n)?r[o]=zP(t,o):r[o]=n;return r}function Vo(e){let t={};for(let r of e.split(/\r?\n/)){let o=r.trim();if(!o||o.startsWith("#"))continue;let n=_1.exec(o);n&&(t[n[1]]=n[2].trim().replace(/^(["'])(.*)\1$/,"$2"))}return t}function R1(e,t=process.env){let r=(0,Gn.isAbsolute)(e)?e:(0,Gn.resolve)(process.cwd(),e),o=(0,Gn.dirname)(r),n=[(0,Gn.join)(o,".env"),(0,Gn.join)(o,"npayload",".env")],i={};for(let a of[...n].reverse())if((0,dl.existsSync)(a))try{Object.assign(i,Vo((0,dl.readFileSync)(a,"utf8")))}catch{}for(let[a,c]of Object.entries(t))c!==void 0&&c!==""&&(i[a]=c);return{env:i,searched:n}}function A1(e,t=process.env,r=[]){let o=[],n=s(a=>{if(typeof a=="string"){let c=KP(a);if(c===null)return a;let l=t[c];return l===void 0||l===""?(o.push(c),a):l}if(Array.isArray(a))return a.map(n);if(a&&typeof a=="object"){let c={};for(let[l,d]of Object.entries(a))c[l]=n(d);return c}return a},"walk"),i=n(e);if(o.length>0)throw new Error(`unresolved secret reference(s): ${[...new Set(o)].sort().join(", ")} \u2014 set them in your environment (process env, project .env, npayload/.env) before pushing`+(r.length>0?`; files searched: ${r.join(", ")}`:""));return i}function ul(e){let t=[],r=s((o,n)=>{if(Array.isArray(o)){o.forEach((i,a)=>r(i,`${n}/${a}`));return}if(!(!o||typeof o!="object"))for(let[i,a]of Object.entries(o)){let c=`${n}/${i}`;if(i==="headers"&&a&&typeof a=="object"&&!Array.isArray(a))for(let[l,d]of Object.entries(a))bs(l)&&typeof d=="string"&&!Qo(d)&&t.push({path:`${c}/${l}`,header:l});r(a,c)}},"walk");return r(e,""),t}function O1(e){let t=ul(e);if(t.length!==0)throw new Error("raw secret header value(s) in config \u2014 replace each with a {{ secrets.NAME }} reference (npayload pull writes them; npayload validate lists them): "+t.map(r=>`${r.header} at ${r.path}`).join("; "))}function yf(e){let t=s((r,o)=>{if(Array.isArray(r))return r.map(n=>t(n,!1));if(r&&typeof r=="object"){let n={};for(let[i,a]of Object.entries(r))o&&bs(i)&&typeof a=="string"&&!Qo(a)?n[i]=QP:n[i]=t(a,i==="headers");return n}return r},"walk");return t(e,!1)}var dl,Gn,BP,_1,QP,Un=P(()=>{"use strict";dl=require("fs"),Gn=require("path");qo();s(gf,"sanitize");s(x1,"headerSuffix");s(zP,"secretRefFor");BP=/^\s*\{\{\s*secrets\.([A-Za-z_][A-Za-z0-9_]*)\s*\}\}\s*$/;s(Qo,"isSecretRef");s(KP,"parseSecretRef");s(hf,"redactSecretHeaders");_1=/^(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)(?:\s*=|:\s)(.*)$/;s(Vo,"parseDotenv");s(R1,"loadSecretEnv");s(A1,"resolveSecretRefs");s(ul,"findRawSecretHeaders");s(O1,"assertNoRawSecretHeaders");QP="[redacted \u2014 secret header]";s(yf,"maskSecretHeaderValues")});function $1(e,t,r){switch(t){case"number":{let o=Number(e);if(Number.isNaN(o))throw new Y(`--${r} expects a number, got "${e}"`);return o}case"boolean":{if(e==="true"||e==="")return!0;if(e==="false")return!1;throw new Y(`--${r} expects true|false, got "${e}"`)}case"json":try{return JSON.parse(e)}catch{throw new Y(`--${r} expects JSON, got "${e}"`)}default:return e}}function bf(e){return e!=="GET"&&e!=="HEAD"}function wf(e){return e.replace(/:([A-Za-z0-9_]+)/g,"{$1}")}function pn(e){let{row:t,positionals:r}=e,{["idempotency-key"]:o,...n}=e.flags;if(r.length!==t.pathParams.length)throw new Y(`${t.commandPath.join(" ")} expects ${t.pathParams.length} argument(s) (${t.pathParams.map(p=>`<${p.key}>`).join(" ")}), got ${r.length}`);let i={};t.pathParams.forEach((p,f)=>{i[p.key]=r[f]});let a=t.flags.filter(p=>!p.optional&&!(p.name in n)).map(p=>`--${p.name}`);if(a.length>0)throw new Y(`${t.commandPath.join(" ")} missing required flag(s): ${a.join(", ")}`);let c=new Map(t.flags.map(p=>[p.name,p])),l={};for(let[p,f]of Object.entries(n)){let g=c.get(p);if(!g)throw new Y(`${t.commandPath.join(" ")} has no flag --${p}`);l[p]=$1(f,g.coerce,p)}let d=wf(t.pattern),u=t.method!=="GET"&&t.method!=="HEAD",m={method:t.method==="HEAD"?"GET":t.method,path:d,...Object.keys(i).length>0?{pathParams:i}:{},...t.scopes.length>0?{scope:t.scopes.join(" ")}:{}};if(u)Object.keys(l).length>0&&(m.body=l);else if(Object.keys(l).length>0){let p={};for(let[f,g]of Object.entries(l))p[f]=typeof g=="object"?JSON.stringify(g):g;m.query=p}return t.idempotent&&bf(t.method)&&(m.idempotencyKey=o!==void 0?o:e.newIdempotencyKey(),o!==void 0&&(m.idempotencyKeySupplied=!0)),m}var Y,mn=P(()=>{"use strict";Y=class extends Error{static{s(this,"CliUsageError")}exitCode=1;constructor(t){super(t),this.name="CliUsageError"}};s($1,"coerceFlagValue");s(bf,"isMutatingMethod");s(wf,"kernelPathOf");s(pn,"buildKernelRequest")});function N1(e){return(e&Os.PQ_HYBRID)!==0?C1:jn}function Sf(e){if(e.headerLen<be)throw new RangeError(`headerLen must be \u2265 ${be}, got ${e.headerLen}`);if(e.frameType<0||e.frameType>255)throw new RangeError(`frameType out of range: ${e.frameType}`);if(e.flags<0||e.flags>255)throw new RangeError(`flags out of range: ${e.flags}`);if(e.headerLen>65535)throw new RangeError(`headerLen exceeds u16: ${e.headerLen}`);if(e.sessionId<0||e.sessionId>4294967295)throw new RangeError(`sessionId out of range: ${e.sessionId}`);if(e.payloadLen<0||e.payloadLen>4294967295)throw new RangeError(`payloadLen out of range: ${e.payloadLen}`);let t=new Uint8Array(be);t.set(lr,0),t[4]=e.frameType,t[5]=e.flags;let r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.setUint16(6,e.headerLen,!1),r.setUint32(8,e.sessionId,!1),r.setUint32(12,e.payloadLen,!1),t}function Jo(e){if(e.byteLength<be)throw new RangeError(`frame too short for common header: ${e.byteLength} < ${be}`);for(let c=0;c<4;c+=1)if(e[c]!==lr[c])throw new Error("npp: bad magic \u2014 not an NPP frame");let t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=e[4],o=e[5],n=t.getUint16(6,!1),i=t.getUint32(8,!1),a=t.getUint32(12,!1);if(n<be)throw new RangeError(`headerLen below minimum: ${n} < ${be}`);return{frameType:r,flags:o,headerLen:n,sessionId:i,payloadLen:a}}function Pf(e){if(e.byteLength<80)throw new RangeError(`envelope bytes too short for signing input: ${e.byteLength}`);return e.slice(8,80)}function YP(e){let t=Jo(e);if(t.frameType!==Me.BULK_ACK)throw new Error(`decodeBulkAck: expected frameType=BULK_ACK (0x04), got 0x${t.frameType.toString(16).padStart(2,"0")}`);let r=U1,o=be+t.payloadLen;if(e.byteLength<o)throw new RangeError(`BULK_ACK truncated: have ${e.byteLength}, need ${o}`);if(t.payloadLen%r!==0)throw new RangeError(`BULK_ACK payloadLen not a multiple of ${r}: ${t.payloadLen}`);let n=new DataView(e.buffer,e.byteOffset,e.byteLength),i=t.payloadLen/r,a=[];for(let l=0;l<i;l+=1){let d=be+l*r;a.push({seq:n.getBigUint64(d,!1),status:n.getUint16(d+8,!1)})}let c;return(t.flags&Os.EXTENDED_HEADER)!==0&&e.byteLength>=o+jn&&(c=e.slice(o,o+jn)),{header:t,records:a,serverSignature:c}}function XP(e,t){return e===It.TOPIC&&(t===Hr.PULL||t===Hr.HYBRID)?"TOPIC mode is push-only (no cursor)":e===It.TAIL&&(t===Hr.PULL||t===Hr.HYBRID)?"TAIL mode is push-only (subscribe-from-now)":j1(e)&&t!==Hr.PUSH?"a view mode (OUTCOMES, DEAD_LETTERS, TABLE_HEAD, WINDOW, COUNTERS, UNIT_HEAD) is push-only":null}function ml(e){let t=e.envelope;if(t.mode<0||t.mode>255)throw new RangeError(`mode out of range: ${t.mode}`);if(t.deliveryPreference<0||t.deliveryPreference>255)throw new RangeError(`deliveryPreference out of range: ${t.deliveryPreference}`);let r=XP(t.mode,t.deliveryPreference);if(r)throw new RangeError(`SUBSCRIBE compat: ${r}`);if(t.qosCapabilities<0||t.qosCapabilities>65535)throw new RangeError(`qosCapabilities out of range: ${t.qosCapabilities}`);if(t.partitionFilter<0||t.partitionFilter>4294967295)throw new RangeError(`partitionFilter out of range: ${t.partitionFilter}`);if(t.filters.length>255)throw new RangeError(`too many filters (filterCount is u8): ${t.filters.length}`);let o=0;for(let u of t.filters){if(u.value.byteLength>65535)throw new RangeError(`filter value too large: ${u.value.byteLength}`);o+=3+u.value.byteLength}let n=e.consumerSignature??new Uint8Array(0);if(n.byteLength>65535)throw new RangeError(`consumerSignature too large: ${n.byteLength}`);let a=Ho-be+o+n.byteLength,c=new Uint8Array(be+a);c.set(Sf({frameType:Me.SUBSCRIBE,flags:0,headerLen:be,sessionId:e.sessionId,payloadLen:a}),0);let l=new DataView(c.buffer,c.byteOffset,c.byteLength);l.setUint32(16,t.channelId,!1),l.setUint32(20,t.partitionFilter,!1),c[24]=t.mode,c[25]=t.deliveryPreference,l.setUint16(26,t.qosCapabilities,!1),l.setBigUint64(28,t.startCursor,!1),l.setBigUint64(36,t.startHlc,!1),c[44]=t.filters.length;let d=Ho;for(let u of t.filters)c[d]=u.type&255,l.setUint16(d+1,u.value.byteLength,!1),c.set(u.value,d+3),d+=3+u.value.byteLength;return c.set(n,d),c}function If(e){if(e.byteLength<Ho)throw new RangeError(`envelope too short for SUBSCRIBE signing input: ${e.byteLength}`);let t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=Math.min(e.byteLength,be+t.getUint32(12,!1)),o=Ho;for(let n=0;n<e[44];n+=1){if(o+3>r)throw new RangeError(`SUBSCRIBE filter ${n} header truncated: no signing input`);if(o+=3+t.getUint16(o+1,!1),o>r)throw new RangeError(`SUBSCRIBE filter ${n} value truncated: no signing input`)}return e.slice(8,o)}function j1(e){return Number.isInteger(e)&&e>=It.OUTCOMES&&e<=It.UNIT_HEAD}function kf(e){for(let[t,r]of Object.entries(Zo))if(r===e)return t}function fl(e){for(let[t,r]of Object.entries(Wo))if(r===e)return t}function Yo(e,t){let r=Jo(e);if(r.frameType!==Me.ERROR)throw new Error(`decodeErrorSideband: expected frameType=ERROR (0x11), got 0x${r.frameType.toString(16).padStart(2,"0")}`);if(r.payloadLen<2)throw new RangeError(`ERROR sideband payload too small: ${r.payloadLen}`);let o=r.headerLen,n=o+r.payloadLen;if(e.byteLength<n)throw new RangeError("ERROR sideband truncated");let i=new DataView(e.buffer,e.byteOffset,e.byteLength),a=new TextDecoder("utf-8",{fatal:!1});if(t!==void 0&&r.payloadLen>=WP&&i.getBigUint64(o,!1)===t){let d=i.getUint16(o+8,!1);return{header:r,layout:"seq-linked",seq:t,code:d,name:kf(d)??fl(d),reason:a.decode(e.subarray(o+WP,n))}}let c=i.getUint16(o,!1),l=a.decode(e.subarray(o+2,n));return{header:r,layout:"sideband",code:c,name:kf(c),reason:l}}function F1(e,t){if(e.byteLength-t<be)return;for(let l=0;l<lr.length;l+=1)if(e[t+l]!==lr[l])return;let r=new DataView(e.buffer,e.byteOffset+t,e.byteLength-t),o=e[t+4],n=e[t+5],i=r.getUint16(6,!1),a=r.getUint32(12,!1);if(i<be)return;let c=i+a;if((n&Os.EXTENDED_HEADER)!==0&&(c+=N1(n),o===Me.HELLO_ACK&&(c+=D1)),o===Me.HELLO_ACK&&(n&Os.SESSION_PARAMS)!==0&&(c+=8+ZP),!(t+c>e.byteLength))return c}function gl(e){let t=[],r=0;for(;r<e.byteLength;){let o=F1(e,r);if(o===void 0)return t.push(e.subarray(r)),t;t.push(e.subarray(r,r+o)),r+=o}return t.length>0?t:[e]}function tI(e,t=15){let r=new Uint16Array(t+1);for(let i of e)r[i]+=1;r[0]=0;let o=new Uint16Array(t+2);for(let i=1;i<=t;i+=1)o[i+1]=o[i]+r[i];let n=new Uint16Array(e.length);for(let i=0;i<e.length;i+=1)e[i]!==0&&(n[o[e[i]]]=i,o[e[i]]+=1);return{counts:r,symbols:n}}var be,$s,jn,C1,Ef,T2,lr,Me,L1,x2,Os,Wo,JP,D1,ZP,_2,G1,R2,U1,Ho,It,Hr,pl,A2,O2,eI,Tt,M1,q1,$2,C2,N2,WP,Zo,L2,D2,G2,U2,j2,Cs=P(()=>{"use strict";be=16,$s=144,jn=64,C1=128;s(N1,"publishSignatureLen");Ef=32,T2=new Uint8Array([78,80,80,1]),lr=new Uint8Array([78,80,80,1]),Me={HELLO:0,HELLO_ACK:1,PUBLISH:2,PUBLISH_BATCH:3,BULK_ACK:4,SUBSCRIBE:5,DELIVER:6,DELIVER_BATCH:7,ACK:8,SEEK:9,FLOW_CREDIT:13,PING:14,PONG:15,GOODBYE:16,ERROR:17,SYS_EVENT:18,REKEY:19},L1={AT_MOST_ONCE:0,AT_LEAST_ONCE:1,EXACTLY_ONCE:2},x2=L1.EXACTLY_ONCE,Os={COMPRESSED:1,ENCRYPTED:2,BATCH:4,URGENT:8,RESERVED_V2:16,EXTENDED_HEADER:32,PQ_HYBRID:64,SESSION_PARAMS:128},Wo={ACCEPTED:0,ACCEPTED_DUPLICATE:1,REJECTED_GAP:16,REJECTED_DUPLICATE:17,REJECTED_SIGNATURE:32,REJECTED_AUTH:33,REJECTED_SCHEMA:48,REJECTED_PAYLOAD:49,REJECTED_INVALID_FILTER:50,REJECTED_QUOTA:64,REJECTED_GRANT:65,DEFERRED_RETRY:80,REJECTED_OTHER:255},JP={REJECTED_HW_ATTESTATION:144};s(Sf,"encodeCommonHeader");s(Jo,"decodeCommonHeader");D1=32,ZP=32,_2=8+ZP,G1=8,R2=4+G1;s(Pf,"canonicalPublishSigningInput");U1=10;s(YP,"decodeBulkAck");Ho=48,It={LOG:0,QUEUE:1,TOPIC:2,TAIL:3,OUTCOMES:4,DEAD_LETTERS:5,TABLE_HEAD:6,WINDOW:7,COUNTERS:8,UNIT_HEAD:9},Hr={PUSH:0,PULL:1,HYBRID:2},pl={NONE:0,JSONPATH:1,CEL:2,ROUTING_KEY_PREFIX:3},A2=new Set([pl.NONE,pl.JSONPATH,pl.CEL,pl.ROUTING_KEY_PREFIX]);s(XP,"validateSubscribeModeCompat");s(ml,"encodeSubscribeFrame");s(If,"canonicalSubscribeSigningInput");O2=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}),eI=new TextEncoder;s(j1,"isViewMode");Tt={RECORD:0,OUTCOME:1,DEAD_LETTER:2,TABLE_HEAD:3,WINDOW:4,COUNTERS:5,UNIT_HEAD:6},M1="npk_view",q1={[Tt.OUTCOME]:"outcome",[Tt.DEAD_LETTER]:"dead_letter",[Tt.TABLE_HEAD]:"table_head",[Tt.WINDOW]:"window",[Tt.COUNTERS]:"counters",[Tt.UNIT_HEAD]:"unit_head"},$2=eI.encode(M1),C2=[Tt.OUTCOME,Tt.DEAD_LETTER,Tt.TABLE_HEAD,Tt.WINDOW,Tt.COUNTERS,Tt.UNIT_HEAD].map(e=>[e,eI.encode(q1[e])]),N2={[It.OUTCOMES]:"kernel:outcomes:",[It.DEAD_LETTERS]:"kernel:dead_letters:",[It.TABLE_HEAD]:"kernel:head:",[It.WINDOW]:"kernel:window:",[It.COUNTERS]:"kernel:counters:",[It.UNIT_HEAD]:"kernel:unit_head:"},WP=10,Zo={FRAME_MALFORMED:498,PROTOCOL_VIOLATION:499,UPSTREAM_REFUSED:500};s(kf,"nppErrorCodeName");s(fl,"bulkAckStatusName");s(Yo,"decodeErrorSideband");s(F1,"frameByteLengthAt");s(gl,"splitFrames");L2=$s-be,D2=64*1024;s(tI,"buildHuffTable");G2=(()=>{let e=new Uint8Array(288);for(let t=0;t<=143;t+=1)e[t]=8;for(let t=144;t<=255;t+=1)e[t]=9;for(let t=256;t<=279;t+=1)e[t]=7;for(let t=280;t<=287;t+=1)e[t]=8;return tI(e)})(),U2=(()=>{let e=new Uint8Array(30).fill(5);return tI(e)})(),j2=1024*1024});function Ns(e){return`${e.thumbprint}\0${e.channelGid}`}async function hl(e,t,r){return e.exclusive(t,async o=>{let n=await o.load();for(let i=!1;;i=!0){let a=n.lastAccepted+1n,c=n.inFlight===a;await o.save({lastAccepted:n.lastAccepted,inFlight:a});let l=await r(a);switch(l.status){case z1:case K1:case Q1:return await o.save({lastAccepted:a}),{answer:l,sequence:a,verdict:{kind:"stored"}};case B1:return await o.save({lastAccepted:a}),c||l.retried===!0?{answer:l,sequence:a,verdict:{kind:"stored"}}:{answer:l,sequence:a,verdict:{kind:"conflict",reason:W1}};case H1:if(await o.save({lastAccepted:a}),c&&!i){n={lastAccepted:a};continue}return{answer:l,sequence:a,verdict:{kind:"conflict",reason:J1}};case V1:return await o.save({lastAccepted:0n}),{answer:l,sequence:a,verdict:{kind:"rewound",reason:Z1}};default:return{answer:l,sequence:a,verdict:{kind:"unsettled"}}}}})}function Rf(e){return fl(e)??Y1[e]}function Ds(e){if(e.byteLength<Kt)throw new RangeError("frame shorter than the common header");let r=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint16(6,!1);if(r<Kt||r>e.byteLength)throw new RangeError(`bad headerLen ${r}`);let o=[],n=Kt;for(;n<r;){if(n+2>r)throw new RangeError("TLV region does not fill headerLen exactly");let a=e[n],c=e[n+1];if(n+2+c>r)throw new RangeError("TLV region does not fill headerLen exactly");o.push({type:a,value:e.slice(n+2,n+2+c)}),n+=2+c}if(r===Kt)return{canonical:e,tlvs:o};let i=new Uint8Array(e.byteLength-(r-Kt));return i.set(e.subarray(0,Kt),0),i.set(e.subarray(r),Kt),new DataView(i.buffer).setUint16(6,Kt,!1),{canonical:i,tlvs:o}}function nI(e,t){return e.find(r=>r.type===t)?.value}function Af(e,t){let r=nI(t,_f.ACK_STRIDE);if(!r||r[0]!==Tf)return YP(e).records.map(a=>({seq:a.seq,status:a.status}));let o=Jo(e);if(o.payloadLen%Tf!==0||Kt+o.payloadLen>e.byteLength)throw new RangeError("positioned BULK_ACK records do not fill payloadLen");let n=new DataView(e.buffer,e.byteOffset,e.byteLength),i=[];for(let a=Kt;a<Kt+o.payloadLen;a+=Tf)i.push({seq:n.getBigUint64(a,!1),status:n.getUint16(a+8,!1),position:{partition:n.getUint32(a+10,!1),offset:n.getBigUint64(a+14,!1)}});return i}function Of(e){let t=nI(e,_f.MESSAGE_GID);return t&&t.byteLength>0?eN.decode(t):void 0}function X1(e){let t=s(r=>r!==null&&typeof r=="object"&&!Array.isArray(r),"isDoc");return t(e)?[e,e.channel,e.data].filter(t):[]}async function $f(e,t={}){let r=t.waitMs??rI,o=t.pollMs??oI,n=Date.now()+r;for(;;){let i;try{i=await e()}catch(l){return{refused:"read",detail:`the read of its answer was refused (${l instanceof Error?l.message:String(l)})`}}let a=X1(i);if(a.map(l=>l.engine).find(l=>typeof l=="string")==="convex")return{refused:"convex",detail:"its answer names the engine convex, which has no kernel table"};let c=a.map(l=>l.kernelTableId).find(l=>typeof l=="number"&&Number.isInteger(l)&&l>=0&&l<=4294967295);if(c!==void 0)return{table:c};if(Date.now()+o>n)return{refused:"pending",detail:`its answer named no kernelTableId within ${r} ms (the compile still pending)`};await new Promise(l=>setTimeout(l,o))}}var iB,sB,Ls,Xo,z1,B1,K1,Q1,V1,H1,W1,J1,Z1,xf,_f,Y1,Kt,Tf,rI,oI,aB,cB,eN,iI=P(()=>{"use strict";Cs();Cs();iB=new Uint8Array([78,80,80,1]),sB=new Uint8Array([78,80,80,84]);s(Ns,"nppSequenceKeyId");Ls=class{static{s(this,"InMemoryNppSequenceStore")}states=new Map;tails=new Map;async exclusive(e,t){let r=Ns(e),o=this.tails.get(r)??Promise.resolve(),n,i=new Promise(c=>{n=c}),a=o.then(()=>i);this.tails.set(r,a),await o;try{return await t({load:s(async()=>({...this.states.get(r)??{lastAccepted:0n}}),"load"),save:s(async c=>{this.states.set(r,{...c})},"save")})}finally{n(),this.tails.get(r)===a&&this.tails.delete(r)}}},Xo=new Ls,z1=0,B1=1,K1=2,Q1=3,V1=16,H1=17,W1="another process signing with this credential's key already stored this sequence on the channel with an identical payload; this publish was NOT stored as a new message. The producer moved past it \u2014 publish again to store it.",J1="another process signing with this credential's key already used this sequence on the channel (a different HOME, container or host holding the same credential); this publish was NOT stored. The producer moved past it.",Z1="the broker's last accepted sequence for this producer on the channel is lower than this producer recorded; the producer rewound, and the next publish restarts the sequence.";s(hl,"publishAtNextSequence");xf=8,_f={ACK_CLASS:1,PRODUCER_EPOCH:2,BYTE_CREDIT:4,SUBSCRIPTION_HANDLE:5,POSITION:6,PARTITION:7,ROUTE_EPOCH:8,ENGINE_INFO:9,ACK_STRIDE:11,RECORD_KEY:16,TENANT_SELECT:17,CURSOR_ID:18,NACK_DELAY_MS:19,INITIAL_CREDIT:20,LINK_ORIGIN:21,MESSAGE_GID:22},Y1={2:"ACCEPTED_LOCAL",3:"ACCEPTED_GEO",81:"DEFERRED_UNDER_REPLICATED",82:"REJECTED_ROUTE_EPOCH",83:"REJECTED_CLASS_UNAVAILABLE",84:"REJECTED_WRONG_PARTITION",85:"REJECTED_NOT_PRIMARY",105:"REJECTED_PRODUCER_EPOCH"};s(Rf,"kernelStatusName");Kt=16,Tf=22;s(Ds,"stripKernelTlvs");s(nI,"findTlv");s(Af,"readKernelBulkAck");s(Of,"readKernelMessageGid");rI=3e4,oI=250;s(X1,"channelAnswerDocs");s($f,"resolveKernelTableId");aB=Uint8Array.from([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32]),cB=new TextEncoder,eN=new TextDecoder});var Gs=P(()=>{"use strict";iI()});function Cf(e){let t=new Uint8Array(e.byteLength);return t.set(e),t}async function sI(e){let t=globalThis.crypto.subtle,r=new TextEncoder().encode(JSON.stringify(e.payload)),o=await t.digest("SHA-256",Cf(r)),n=new Uint8Array(o);if(n.byteLength!==Ef)throw new Error(`payloadHash must be ${Ef} bytes, got ${n.byteLength}`);let i=new Uint8Array($s);i.set(Sf({frameType:tN,flags:0,headerLen:be,sessionId:e.sessionId,payloadLen:r.byteLength}),0);let a=new DataView(i.buffer,i.byteOffset,i.byteLength);a.setUint32(16,e.channelId??1,!1),a.setUint32(20,e.partitionId??0,!1),a.setBigUint64(24,e.sequence,!1),a.setBigUint64(32,0n,!1),a.setUint32(40,0,!1),i[44]=e.qosLevel??1,i[45]=0,a.setUint16(46,0,!1),i.set(n,48);let c=Pf(i),l=await t.sign("Ed25519",e.ed25519PrivateKey,Cf(c)),d=new Uint8Array(l);if(d.byteLength!==jn)throw new Error(`ed25519 signature must be ${jn} bytes, got ${d.byteLength}`);i.set(d,80);let u=new Uint8Array($s+r.byteLength);return u.set(i,0),u.set(r,$s),u}async function aI(e){let t=ml({sessionId:e.sessionId,envelope:{channelId:1,mode:e.mode,deliveryPreference:e.deliveryPreference,qosCapabilities:0,partitionFilter:0,startCursor:e.startCursor??0n,startHlc:e.startHlc??0n,filters:[]},consumerSignature:new Uint8Array(jn)}),r=await globalThis.crypto.subtle.sign("Ed25519",e.ed25519PrivateKey,Cf(If(t))),o=new Uint8Array(r);if(o.byteLength!==jn)throw new Error(`ed25519 sig must be ${jn} bytes`);return t.set(o,nN),t}function cI(e){if(e.byteLength<be+10)throw new Error(`BULK_ACK too short: ${e.byteLength}`);let{canonical:t,tlvs:r}=Ds(e),o=Af(t,r),n=o[0];if(!n)throw new RangeError("BULK_ACK carries no record");let i=o.length===1?Of(r):void 0;return{sessionId:Jo(t).sessionId,seq:n.seq,status:n.status,...n.position?{position:n.position}:{},...i!==void 0?{messageGid:i}:{}}}var tN,zB,nN,Nf=P(()=>{"use strict";Cs();Gs();tN=Me.PUBLISH,zB=Me.BULK_ACK,nN=48;s(Cf,"copyToArrayBuffer");s(sI,"buildSignedPublishFrame");s(aI,"buildSignedSubscribeFrame");s(cI,"decodeBulkAck")});function Be(e){return typeof e=="string"&&e.length>0?e:void 0}function Wr(e){let t=e.split(".");if(t.length<2)return{};try{let r=t[1].replace(/-/g,"+").replace(/_/g,"/"),o=r.length%4===0?"":"=".repeat(4-r.length%4),n=typeof Buffer<"u"?Buffer.from(r+o,"base64").toString("utf8"):atob(r+o);return JSON.parse(n)}catch{return{}}}function Lf(e){return Be(e["npayload/orgId"])??Be(e.orgId)??Be(e.org)??Be(e.org_id)??Be(e.sub)}async function lI(e){if(e!==void 0)return Lf(Wr(typeof e=="function"?await e():e))}var yl=P(()=>{"use strict";s(Be,"str");s(Wr,"decodeJwtClaims");s(Lf,"orgOfClaims");s(lI,"orgOfCredential")});function oN(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}function iN(e){return rN.test(e)?e:`${e.toLowerCase().replace(/[^a-z0-9._-]/g,"-").replace(/^[^a-z0-9]+/,"").slice(0,110)||"x"}-h${oN(e)}`}function dI(e,t){return iN(`${e}.${t}`)}function uI(e){let t=s(r=>r!==null&&typeof r=="object"&&!Array.isArray(r),"isDoc");return t(e)?[e,e.channel,e.data].filter(t):[]}function Df(e){let t=uI(e);return t.some(r=>r.engine==="convex")?!1:t.some(r=>r.engine==="kernel"||typeof r.kernelTable=="string"&&r.kernelTable!==""||typeof r.kernelTableId=="number"&&Number.isInteger(r.kernelTableId))}function pI(e){for(let t of uI(e)){let r=Be(t.appId),o=Be(t.envId);if(r!==void 0&&o!==void 0)return dI(r,o)}}function mI(e){let t=Wr(e),r=Be(t["npayload/appId"])??Be(t.app),o=Be(t["npayload/envId"]);return r!==void 0&&o!==void 0?dI(r,o):void 0}var rN,vl=P(()=>{"use strict";yl();rN=/^[a-z0-9][a-z0-9._-]{0,127}$/;s(oN,"fnv1aHex");s(iN,"kernelSafeName");s(dI,"kernelUnitFor");s(uI,"answerDocs");s(Df,"channelAnswerNamesKernelTable");s(pI,"channelAnswerUnit");s(mI,"tokenUnit")});function ei(e){return Rf(e)??(e===JP.REJECTED_HW_ATTESTATION?"REJECTED_HW_ATTESTATION":void 0)}function bl(e){return sN[e]??ei(e)}function wl(e){return e===void 0?"protocol":aN.has(e)?"auth":cN.has(e)?"deferred":lN.has(e)?"protocol":"admission"}var sN,aN,cN,lN,kl=P(()=>{"use strict";Cs();Gs();sN={1:"REJECTED_VERSION",2:"REJECTED_QOS",[Zo.FRAME_MALFORMED]:"FRAME_MALFORMED",[Zo.PROTOCOL_VIOLATION]:"PROTOCOL_VIOLATION",[Zo.UPSTREAM_REFUSED]:"UPSTREAM_REFUSED",501:"UNSUPPORTED",502:"SESSION_EXPIRED"};s(ei,"nppStatusName");s(bl,"nppErrorName");aN=new Set(["REJECTED_AUTH","SESSION_EXPIRED","REJECTED_SIGNATURE","REJECTED_GRANT"]),cN=new Set(["DEFERRED_RETRY","DEFERRED_UNDER_REPLICATED","REJECTED_QUOTA"]),lN=new Set(["FRAME_MALFORMED","PROTOCOL_VIOLATION","UNSUPPORTED","REJECTED_VERSION","REJECTED_QOS"]);s(wl,"nppRefusalClass")});var El=P(()=>{"use strict";Gs()});function pN(e){return e===fI||e.endsWith(`.${fI}`)}function mN(e){let t;try{t=new URL(e).hostname}catch{return}try{t=decodeURIComponent(t)}catch{}return t.toLowerCase().replace(/\.+$/,"")}function Pl(e){let t=e?.trim();return t||void 0}function ti(e){let t=Pl(e);if(t===void 0)return;let r=mN(t);if(!(r===void 0||!pN(r)))return uN.get(r)??"host"}function ni(e){let t=[];for(let[o,n]of e){let i=Pl(n);i!==void 0&&t.push({source:o,url:i})}let r=t.find(o=>ti(o.url)===void 0);return r===void 0?{named:t}:{named:t,other:r}}function Us(e,t=r=>r){return fN.map(r=>[t(r),e[r]])}function gI(e){try{let t=new URL(e).origin;return t&&t!=="null"?t:e}catch{return e}}function Jr(e,t){if(e.other===void 0)return;let r=ti(t);if(r!==void 0)return`this run names another estate (${e.other.source} ${e.other.url}), so it sends no request to npayload's production ${r} (${gI(t)}): npayload's production hosts serve its production estate alone`}function hI(e,t){if(e.other===void 0)return;let r=ti(t);if(r!==void 0)return`this run names another estate (${e.other.source} ${e.other.url}), so it opens no page on npayload's production ${r} (${gI(t)}): npayload's production hosts serve its production estate alone`}function yI(e){if(e.other!==void 0)return`this run names another estate (${e.other.source} ${e.other.url}) and no edge of it: npayload's production edge ${Sl} is the default of its production estate alone`}function vI(e){let t={},r=e.replace(/\r\n?/g,`
|
|
4
|
+
`),o=/^\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\n]+)?\s*(?:#.*)?$/gm;for(let n=o.exec(r);n!==null;n=o.exec(r)){let i=(n[2]??"").trim(),a=i[0];i=i.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),a==='"'&&(i=i.replace(/\\n/g,`
|
|
5
|
+
`).replace(/\\r/g,"\r")),t[n[1]]=i}return t}var dr,dN,Sl,fI,uN,fN,ri=P(()=>{"use strict";dr="https://api.npayload.com",dN="https://auth.npayload.com",Sl="https://npp.npayload.com",fI="npayload.com",uN=new Map([[new URL(dr).hostname,"API"],[new URL(dN).hostname,"auth host"],[new URL(Sl).hostname,"edge"]]);s(pN,"isProductionHost");s(mN,"hostOf");s(Pl,"named");s(ti,"productionRole");s(ni,"estateOf");fN=["NPAYLOAD_API_URL","NPAYLOAD_AUTH_URL","NPAYLOAD_EDGE_URL","NPAYLOAD_PRIMUS_API_URL","NPAYLOAD_ACCOUNT_API_URL","NPAYLOAD_ADMIN_API_URL","KERNEL_DOOR_URL"];s(Us,"environmentSources");s(gI,"shown");s(Jr,"dialRefusal");s(hI,"pageRefusal");s(yI,"noEdgeRefusal");s(vI,"readDotenvText")});function wI(e,t){if(e===void 0)return;let r=s(o=>t.includes(o.toLowerCase()),"dropped");if(e instanceof Headers){let o=new Headers(e);for(let n of t)o.delete(n);return o}return Array.isArray(e)?e.filter(([o])=>!r(o)):Object.fromEntries(Object.entries(e).filter(([o])=>!r(o)))}function vN(e){return typeof e=="string"?e:e instanceof URL?e.href:e.url}function Il(e){try{let t=new URL(e).origin;return t&&t!=="null"?t:e}catch{return e}}async function Gf(e){try{await e.body?.cancel()}catch{}}function oi(e,t,r){return async(o,n)=>{let i=vN(o),a=e(i);if(a!==void 0)throw t(a,i);let c=r??globalThis.fetch,l={...n??{},redirect:"manual"},d=i;for(let u=0;;u+=1){let m=await c(u===0?o:d,l),p=gN.has(m.status)?m.headers.get("location"):null;if(p===null)return m;let f=new URL(p,d).href,g=e(f);if(g!==void 0)throw await Gf(m),t(`the redirect from ${Il(d)} to ${Il(f)} is not followed: ${g}`,f);if(u===bI)throw await Gf(m),new TypeError(`fetch failed: more than ${bI} redirects from ${i}`);let h=(l.method??"GET").toUpperCase(),y=m.status===303&&h!=="HEAD"||(m.status===301||m.status===302)&&h==="POST",v=l.headers;y&&(v=wI(v,yN)),Il(f)!==Il(d)&&(v=wI(v,hN)),l={...l,...y?{method:"GET",body:null}:{},...v!==void 0?{headers:v}:{}},await Gf(m),d=f}}}var gN,bI,hN,yN,Tl=P(()=>{"use strict";gN=new Set([301,302,303,307,308]),bI=20,hN=["authorization","proxy-authorization","cookie","dpop"],yN=["content-type","content-length","content-encoding","content-language","content-location"];s(wI,"withoutHeaders");s(vN,"urlOf");s(Il,"originOf");s(Gf,"discard");s(oi,"dialFetch")});function kN(e){let t=e.producerEpoch;if(typeof t!="number"||!Number.isInteger(t)||t<0||t>wN)throw new Zr("KERNEL_CONFIG",`producerEpoch must be an integer from 0 to 0x7FFF_FFFF (the node's implicit epochs start at 0x8000_0000), got ${String(t)}; nothing was sent.`);if(typeof e.readChannel!="function")throw new Zr("KERNEL_CONFIG","the kernel door needs `readChannel`, the client's read of a channel's answer; nothing was sent.");let r=e.credential;if(r!==void 0&&(typeof r.accessToken!="function"||typeof r.proof!="function"))throw new Zr("KERNEL_CONFIG","the kernel door's `credential` needs `accessToken` and `proof`; nothing was sent.")}function TN(){let e=globalThis.process?.env;if(!e||e.VITEST!=="true")return;let t=e[IN];if(t===void 0||t==="")return;let r=Number(t);return Number.isFinite(r)&&r>=0?r:void 0}function xN(e){return e!==void 0&&Number.isFinite(e)&&e>=0?e:TN()??EN}function _N(e){let t=e.get("Retry-After");if(t===null||t.trim()==="")return;let r=Number(t.trim());if(Number.isFinite(r)&&r>=0)return Math.round(r*1e3);let o=Date.parse(t);return Number.isNaN(o)?void 0:Math.max(0,o-Date.now())}function SI(e,t,r,o){if(e>=t)return;let n=r-Date.now();if(n<=0||o!==void 0&&o>n)return;let i=Math.min(PN,SN*2**Math.min(e-1,16))*(.8+Math.random()*.4);return Math.min(Math.max(o??0,Math.round(i)),n)}function xI(e){let t=jf(e.statusCode),r=e.statusName??ei(e.statusCode)??"UNREGISTERED_STATUS";if(e.sequenceConflict)return`NPP publish not stored: the broker answered ${r} (BULK_ACK ${t}, HTTP ${e.httpStatus}) for producer sequence ${e.sequenceConflict.sequence} \u2014 ${e.sequenceConflict.reason}`;let o=`NPP publish rejected by the edge: ${r} (BULK_ACK ${t}, HTTP ${e.httpStatus})`;if(e.error){let n=`0x${e.error.code.toString(16).padStart(4,"0")}`,i=e.error.name??n;o+=` \u2014 ${i}${e.error.name?` (${n})`:""}${e.error.reason?`: ${e.error.reason}`:""}`}return e.upstream&&(e.upstream.component||e.upstream.status!==void 0)&&(o+=` [upstream ${e.upstream.component??"unknown"}${e.upstream.status!==void 0?` ${e.upstream.status}`:""}]`),o}function RN(e,t){for(let r of e.slice(1)){if(r.byteLength<be||r[4]!==Me.ERROR)continue;let o=Yo(r,t);return{code:o.code,name:bl(o.code),reason:o.reason}}}function AN(e){let t=e.get("X-NPayload-Upstream-Component")??void 0,r=e.get("X-NPayload-Upstream-Status"),o=r!==null&&/^\d+$/.test(r.trim())?Number(r.trim()):void 0;if(!(t===void 0&&o===void 0))return{...t!==void 0?{component:t}:{},...o!==void 0?{status:o}:{}}}function $N(e){if(e.byteLength<be)return!1;for(let t=0;t<lr.length;t+=1)if(e[t]!==lr[t])return!1;return!0}function CN(e){let t;try{t=JSON.parse(new TextDecoder().decode(e.subarray(0,ON)))}catch{return{}}if(!t||typeof t!="object")return{};let r=t,o=r.error&&typeof r.error=="object"?r.error:void 0,n=or(t)??o?.code??r.code??(typeof r.error=="string"?r.error:void 0),i=o?.message??r.message;return{...typeof n=="string"&&n?{upstreamCode:n}:{},...typeof i=="string"&&i?{upstreamMessage:i}:{}}}function NN(e,t,r,o){let n=e.headers.get("content-type")??void 0,{upstreamCode:i,upstreamMessage:a}=CN(t),c={status:e.status,url:r,...n?{contentType:n}:{},...i?{upstreamCode:i}:{},...a?{upstreamMessage:a}:{}},l=`answered HTTP ${e.status}`+(n?` (${n})`:"")+(i?` with code ${i}`:"")+(a?`: ${a}`:"")+", which is not an NPP frame";return TI.has(e.status)?new Z(`npp: the frame door ${r} ${l}, on every one of ${o} attempt(s) across the restart window; the NPP transport is unavailable and the operation was not downgraded to HTTP/JSON.`,"npp",c):new Uf(`npp: the frame door ${r} ${l}; the operation was refused, not retried, and not downgraded to HTTP/JSON.`,c)}function jf(e){return`0x${e.toString(16).padStart(4,"0")}`}function LN(e){for(let[t,r]of Object.entries(Me))if(r===e)return t;return`0x${e.toString(16).padStart(2,"0")}`}function DN(e,t){return`${e.name??"UNREGISTERED_CODE"} (ERROR ${jf(e.code)}, HTTP ${t})${e.reason?`: ${e.reason}`:""}`}function GN(e,t){try{let{canonical:r}=Ds(e),o=t!==void 0&&t!==0n?[t,0n]:[0n];for(let i of o){let a=Yo(r,i);if(a.layout==="seq-linked")return{code:a.code,name:bl(a.code),reason:a.reason}}let n=Yo(r);return{code:n.code,name:bl(n.code),reason:n.reason}}catch{return}}function UN(e,t,r,o,n){let i=e.headers.get("content-type")??void 0,a={status:e.status,url:r,...i?{contentType:i}:{}},c=o>1?` on every one of ${o} attempts across the restart window`:"",l=t[4];if(l===Me.ERROR){let u=GN(t,n);if(u)return new js(`npp: the frame door ${r} refused the frame${c}: ${DN(u,e.status)}`,u,a)}let d=l===Me.ERROR?"an ERROR frame too short or too malformed to carry its code":`a ${LN(l)} frame (type 0x${l.toString(16).padStart(2,"0")})`;return new Xr(`npp: the frame door ${r} answered HTTP ${e.status} with ${d}${c}, where the answer to a frame is a BULK_ACK or an ERROR; the answer breaks the NPP protocol, so the operation failed and was not downgraded to HTTP/JSON.`,l,a)}function MN(e){return e[_I]}function AI(e,t){Object.defineProperty(e,RI,{value:t,configurable:!0})}function PI(e,t){let r=e[RI];if(r!==void 0)return r(t);let o=typeof process<"u"?process.env:{},n=ni([["the transport's edgeUrl",MN(e)],...Us(o)]),i=Jr(n,t);return i===void 0?void 0:`${i}. Build the transport with the edge of that estate, or name no other estate in the environment.`}function II(e){return new Promise(t=>setTimeout(t,e))}var kI,Yr,EI,Z,Uf,Zr,js,Xr,TI,bN,wN,EN,SN,PN,IN,ON,jN,_I,RI,Ms,Ke=P(()=>{"use strict";Nf();Gs();Pt();yl();vl();kl();El();ri();Tl();kI=Symbol.for("npayload.error.nppTransport"),Yr=class e extends Error{static{s(this,"NppTransportError")}code;status;upstreamCode;details;constructor(t,r,o){super(t),this.name="NppTransportError",this.code=r,this.details=o,this.status=o.status,this.upstreamCode=o.upstreamCode,Object.defineProperty(this,kI,{value:!0})}static[Symbol.hasInstance](t){return this!==e?Function.prototype[Symbol.hasInstance].call(this,t):typeof t=="object"&&t!==null&&t[kI]===!0}},EI=Symbol.for("npayload.error.transportUnavailable"),Z=class e extends Yr{static{s(this,"TransportUnavailableError")}constructor(t,r="npp",o={}){super(t,"TRANSPORT_UNAVAILABLE",{failedTransport:r,...o}),this.name="TransportUnavailableError",Object.defineProperty(this,EI,{value:!0})}static[Symbol.hasInstance](t){return this!==e?Function.prototype[Symbol.hasInstance].call(this,t):typeof t=="object"&&t!==null&&t[EI]===!0}},Uf=class extends Yr{static{s(this,"TransportRefusedError")}constructor(t,r){super(t,"TRANSPORT_REFUSED",{failedTransport:"npp",...r}),this.name="TransportRefusedError"}},Zr=class extends Yr{static{s(this,"NppKernelDoorError")}constructor(t,r,o={}){super(`${t}: ${r}`,t,{failedTransport:"npp",...o}),this.name="NppKernelDoorError"}},js=class extends Yr{static{s(this,"NppRefusedError")}refusal;constructor(t,r,o){super(t,"NPP_REFUSED",{failedTransport:"npp",...o,upstreamCode:r.name??jf(r.code),...r.reason?{upstreamMessage:r.reason}:{}}),this.name="NppRefusedError",this.refusal=r}},Xr=class extends Yr{static{s(this,"NppProtocolError")}frameType;constructor(t,r,o){super(t,"NPP_PROTOCOL",{failedTransport:"npp",...o}),this.name="NppProtocolError",this.frameType=r}},TI=new Set([429,500,502,503,504]),bN=`0x${xf.toString(16).padStart(4,"0")}`,wN=2147483647;s(kN,"assertKernelDoorOptions");EN=6e4,SN=50,PN=5e3,IN="NPAYLOAD_TEST_RESTART_WINDOW_MS";s(TN,"harnessRestartWindowMs");s(xN,"restartWindowFor");s(_N,"retryAfterMs");s(SI,"nextRepostWaitMs");s(xI,"describeNppRejection");s(RN,"linkedErrorSideband");s(AN,"upstreamFromHeaders");ON=8*1024;s($N,"isNppFrame");s(CN,"readUpstream");s(NN,"nonFrameAnswer");s(jf,"hex16");s(LN,"frameTypeWord");s(DN,"describeNppRefusal");s(GN,"readFrameDoorError");s(UN,"frameDoorRefusal");jN=Symbol.for("npayload.transport.npp"),_I=Symbol.for("npayload.transport.npp.edge"),RI=Symbol.for("npayload.transport.npp.frameGuard");s(MN,"nppTransportEdge");s(AI,"guardFrames");s(PI,"frameRefusal");Ms=class{static{s(this,"NppTransport")}kind="npp";cfg;fetchImpl;sessionId;credentialOrg;sequenceStore;kernelTableIds=new Map;kernelAnswers=new Map;kernelUnits=new Map;constructor(t,r){if(!t||typeof t.edgeUrl!="string"||t.edgeUrl.length===0)throw new Error("NppTransport requires edgeUrl");t.kernel&&kN(t.kernel),this.cfg=t,Object.defineProperty(this,jN,{value:!0}),Object.defineProperty(this,_I,{value:t.edgeUrl}),this.sequenceStore=t.sequenceStore??Xo,this.fetchImpl=t.fetchImpl??globalThis.fetch.bind(globalThis),this.sessionId=r!==void 0?r>>>0:globalThis.crypto.getRandomValues(new Uint32Array(1))[0]>>>0}async subscribe(t,r){let o=await aI({sessionId:this.sessionId,ed25519PrivateKey:this.cfg.ed25519PrivateKey,mode:r.mode??0,deliveryPreference:r.deliveryPreference??0,...r.startCursor!==void 0?{startCursor:r.startCursor}:{}}),n=await this.postFrame(o,{"X-NPP-Channel-Gid":t,"X-NPP-Consumer-Id":r.consumerId});return{accepted:n.accepted,statusCode:n.statusCode,transport:"npp"}}async postFrame(t,r,o={},n){let i=`${this.cfg.edgeUrl.replace(/\/+$/,"")}/v1/npp/frame`,a=PI(this,i);if(a!==void 0)throw new Z(`npp: ${a}`,"npp",{url:i});this.credentialOrg??=await lI(this.cfg.accessToken);let c=this.credentialOrg,l={"Content-Type":"application/octet-stream",...c?{"X-NPP-Org-Id":c}:{},"X-NPP-App-Id":this.cfg.appId,"X-NPP-Jkt":this.cfg.jwkThumbprint,"X-NPP-Client-Id":this.cfg.clientId,...r},d=o.maxRetries!==void 0?Math.max(1,o.maxRetries):Number.POSITIVE_INFINITY,u=Date.now()+xN(o.restartWindowMs??this.cfg.restartWindowMs),m=this.cfg.kernel?.credential,p=oi(f=>PI(this,f),(f,g)=>new Z(`npp: ${f}`,"npp",{url:g}),this.fetchImpl);for(let f=1;;f+=1){let g=l;if(m){let A=await m.accessToken();g={...l,Authorization:`DPoP ${A}`,DPoP:await m.proof(i,A)}}let h,y;try{h=await p(i,{method:"POST",headers:g,body:t}),y=new Uint8Array(await h.arrayBuffer())}catch(A){if(A instanceof Z)throw A;let D=SI(f,d,u,void 0);if(D!==void 0){await II(D);continue}let M=A instanceof Error?A.message:String(A),V=new Z(`npp: the frame door ${i} gave no answer (${M}) on every one of ${f} attempt(s) across the restart window; the NPP transport is unavailable and the operation was not downgraded to HTTP/JSON.`,"npp",{url:i});throw V.cause=A,V}let S=$N(y)?gl(y):[],k=S[0],R=k!==void 0&&k[4]===Me.BULK_ACK?cI(k):void 0;if(TI.has(h.status)||R?.status===Wo.DEFERRED_RETRY){let A=SI(f,d,u,_N(h.headers));if(A!==void 0){await II(A);continue}}if(k===void 0)throw NN(h,y,i,f);if(!R)throw UN(h,k,i,f,n);let x=R.messageGid??h.headers.get("X-NPP-Message-Gid")??void 0,_=RN(S,R.seq),U=AN(h.headers);return{accepted:R.status===Wo.ACCEPTED||R.status===Wo.ACCEPTED_DUPLICATE,statusCode:R.status,statusName:ei(R.status),httpStatus:h.status,sequence:R.seq.toString(),...x?{gid:x}:{},...R.position?{position:R.position}:{},..._?{error:_}:{},...U?{upstream:U}:{},attempts:f}}}async publish(t,r,o){let n=this.cfg.kernel,i=n?await this.kernelTableIdOf(t,n):void 0,a=n?.credential?await this.kernelUnitOf(t,n):void 0,c={"X-NPP-Channel-Gid":t,...o?.routingKey?{"X-NPP-Routing-Key":o.routingKey}:{},...n?{"X-NPP-Capabilities":bN,"X-NPP-Producer-Epoch":String(n.producerEpoch)}:{},...a!==void 0?{"X-NPP-Unit":a}:{}},{answer:l,sequence:d,verdict:u}=await hl(this.sequenceStore,{thumbprint:this.cfg.jwkThumbprint,channelGid:t},async p=>{let f=await sI({sessionId:this.sessionId,sequence:p,payload:r,ed25519PrivateKey:this.cfg.ed25519PrivateKey,...o?.qosLevel!==void 0?{qosLevel:o.qosLevel}:{},...i!==void 0?{channelId:i}:{}}),g=await this.postFrame(f,c,{...o?.maxRetries!==void 0?{maxRetries:o.maxRetries}:{},...o?.restartWindowMs!==void 0?{restartWindowMs:o.restartWindowMs}:{}},p);return{...g,status:g.statusCode,retried:g.attempts>1}}),m=u.kind==="stored";return{accepted:m,statusCode:l.statusCode,statusName:l.statusName,httpStatus:l.httpStatus,sequence:l.sequence,transport:"npp",...l.gid&&m?{gid:l.gid}:{},...l.position?{position:l.position}:{},...l.error?{error:l.error}:{},...l.upstream?{upstream:l.upstream}:{},...u.kind==="conflict"||u.kind==="rewound"?{sequenceConflict:{sequence:d.toString(),reason:u.reason}}:{}}}async kernelTableIdOf(t,r){let o=this.kernelTableIds.get(t);if(o!==void 0)return o;let n=await $f(async()=>{let i=await r.readChannel(t);return this.kernelAnswers.set(t,i),i},{...r.tableIdWaitMs!==void 0?{waitMs:r.tableIdWaitMs}:{},...r.tableIdPollMs!==void 0?{pollMs:r.tableIdPollMs}:{}});if("refused"in n)throw new Zr("KERNEL_TABLE_ID_UNRESOLVED",`channel ${t}: ${n.detail}. A PUBLISH to the kernel's door carries the kernelTableId its channel's answer names; no frame was sent.`,{channel:t});return this.kernelTableIds.set(t,n.table),n.table}async kernelUnitOf(t,r){let o=this.kernelUnits.get(t);if(o!==void 0)return o;let n=(r.unit!==void 0&&r.unit!==""?r.unit:void 0)??pI(this.kernelAnswers.get(t))??await r.credential?.unit?.();if(n===void 0||n==="")throw new Zr("KERNEL_UNIT_UNRESOLVED",`channel ${t}: no unit was given, its answer names no appId and envId, and the credential names no app and environment, so the unit its frames name cannot be read; no frame was sent.`,{channel:t});return this.kernelUnits.set(t,n),n}};s(II,"sleep")});function DI(e){return`${BN}/${e}`}var NI,LI,BN,qf=P(()=>{"use strict";NI="https://docs.npayload.com",LI=`${NI}/docs/cli`,BN=`${NI}/errors`;s(DI,"errorCatalogEntryUrl")});var MI={};me(MI,{CliError:()=>G,failWith:()=>we,failureReceiptLines:()=>UI,failureText:()=>ie,isNetworkFailure:()=>jI,renderError:()=>xl,unreachableText:()=>zf,withFailureReceipt:()=>Ce});function xl(e){if(e instanceof G){let r=[ii.default.red(`\u2716 ${e.message}`)+ii.default.dim(` [${e.code}]`)];return e.hint&&r.push(" "+ii.default.yellow("\u2192")+" "+e.hint),e.docs&&r.push(" "+ii.default.dim(e.docs)),r.join(`
|
|
6
|
+
`)}let t=e instanceof Error?e.message:String(e);return ii.default.red(`\u2716 ${t}`)}function UI(e){if(e===null||typeof e!="object")return[];let t=Ff(e.code),r=e.cause,o=r!==null&&typeof r=="object"?r:void 0,n=Ff(e.requestId)??Ff(o?.requestId),i=GI(e.status)??GI(o?.status),a=[];return t!==void 0&&a.push(`Code: ${t}`),i!==void 0&&a.push(`HTTP status: ${i}`),t!==void 0&&a.push(`Docs: ${DI(t)}`),n!==void 0&&a.push(`Request id: ${n}`),a}function Ce(e,t){return[e,...UI(t)].join(`
|
|
7
|
+
`)}function Ff(e){return typeof e=="string"&&e!==""?e:void 0}function GI(e){return typeof e=="number"&&Number.isInteger(e)&&e>=100&&e<=599?e:void 0}function ie(e,t){return t instanceof Z?Ce(e,t):e}function jI(e){if(e instanceof Bt||(e!==null&&typeof e=="object"?e.code:void 0)==="network_error")return!0;let r=e instanceof Error?e.message:"";return/fetch failed|ECONNREFUSED|ECONNRESET|ENOTFOUND|EAI_AGAIN|ETIMEDOUT/i.test(r)}function zf(e,t,r){let o=e instanceof Error?e.message:String(e);if(!jI(e))return o;let n=t!==void 0&&t!==""?` at ${t}`:"";return`${o} \u2014 the API${n} did not answer; check ${r}, then run \`npayload doctor\``}function we(e){console.error(`
|
|
8
|
+
`+Ce(xl(e),e)+`
|
|
9
|
+
`),process.exit(1)}var ii,G,re=P(()=>{"use strict";ii=K(require("chalk"));Pt();Ke();qf();G=class extends Error{static{s(this,"CliError")}code;hint;docs;constructor(t,r){super(t),this.name="CliError",this.code=r.code,this.hint=r.hint,this.docs=r.docs,r.cause!==void 0&&(this.cause=r.cause)}};s(xl,"renderError");s(UI,"failureReceiptLines");s(Ce,"withFailureReceipt");s(Ff,"nonEmptyString");s(GI,"httpStatus");s(ie,"failureText");s(jI,"isNetworkFailure");s(zf,"unreachableText");s(we,"failWith")});function ot(e,t){return oi(r=>e.refusal(r),r=>new Z(Bf(r)),t)}function QN(e){let t=new Error(e.message);return t.name="AbortError",t[FI]=e,t}function VN(e){return e instanceof Error?e[FI]:void 0}function Bf(e){return e.charAt(0).toUpperCase()+e.slice(1)}function qn(e){return Rl.get(e)?.guard}function zI(e){return Rl.get(e)?.tokenUrl}function eo(e){return Rl.get(e)?.apiUrl}function Kf(e){return`${(e.authUrl??e.baseUrl??dr).replace(/\/+$/,"")}/oauth/token`}function HN(e,t){let r=t.path;for(let[o,n]of Object.entries(t.pathParams??{}))r=r.replace(`{${o}}`,encodeURIComponent(n));return e.replace(/\/+$/,"")+r}function si(e,t){let r=ot(t),o,n={fetch:s(async d=>{try{return await r(d.url,{method:d.method,headers:d.headers,body:d.body??null,...d.signal!==void 0?{signal:d.signal}:{},...o!==void 0?{dispatcher:o}:{}})}catch(u){throw u instanceof Z?QN(u):WN(u)}},"fetch")},i=new ll({config:{...e,httpClient:n}});o=i.dispatcher;let a=Kf(e),c=e.baseUrl??dr;Rl.set(i,{guard:t,tokenUrl:a,apiUrl:c});let l=i.auth;if(l!==void 0&&typeof l.getAccessToken=="function"){let d=l;typeof d.fetchImpl=="function"&&(d.fetchImpl=ot(t,d.fetchImpl));let u=l.getAccessToken.bind(l);l.getAccessToken=async m=>(t.check(a),u(m))}if(typeof i.send=="function"){let d=i.send.bind(i);i.send=(async u=>{t.check(a,HN(c,u));try{return await d(u)}catch(m){throw VN(m)??m}})}return i}function WN(e){if(!(e instanceof TypeError))return e;let t=e.cause,r=t instanceof Error?t.message:typeof t=="string"?t:void 0;return r===void 0||r===""||e.message.includes(r)?e:new TypeError(`${e.message}: ${r}`,{cause:t})}function F(e){if(e instanceof Z)throw e}function Qf(e,t){AI(e,r=>t.refusal(r))}var _l,FI,Rl,se=P(()=>{"use strict";Pt();ri();Tl();Ke();_l=class e{constructor(t,r){this.estate=t;this.cureFor=r}static{s(this,"DialGuard")}get production(){return this.estate.other===void 0}refusal(t){let r=Jr(this.estate,t);return r===void 0?void 0:`${r}. ${this.cureFor(ti(t))}`}noEdge(){let t=yI(this.estate);return t===void 0?void 0:`${t}. ${this.cureFor("edge")}`}checkPages(...t){for(let r of t){let o=hI(this.estate,r);if(o!==void 0)throw new Z(Bf(`${o}. ${this.cureFor(ti(r))}`))}}check(...t){for(let r of t){let o=this.refusal(r);if(o!==void 0)throw new Z(Bf(o))}}with(t){return new e(ni([...this.estate.named.map(r=>[r.source,r.url]),...t]),this.cureFor)}};s(ot,"guardedFetch");FI=Symbol("npayload.dial.refusal");s(QN,"carried");s(VN,"refusalCarriedBy");s(Bf,"capitalised");Rl=new WeakMap;s(qn,"guardOf");s(zI,"tokenUrlOf");s(eo,"apiUrlOf");s(Kf,"tokenEndpointOf");s(HN,"requestUrl");s(si,"dialKernel");s(WN,"withDialReason");s(F,"rethrowRefusal");s(Qf,"guardTransport")});function no(e){return new Vt(e).start()}var tT,Vt,ro=P(()=>{"use strict";tT=K(require("ora")),Vt=class{static{s(this,"Spinner")}instance;constructor(t){this.instance=(0,tT.default)({text:t,isSilent:!process.stderr.isTTY})}start(t){return t&&(this.instance.text=t),this.instance.start(),this}succeed(t){this.instance.succeed(t)}fail(t){this.instance.fail(t)}warn(t){this.instance.warn(t)}info(t){this.instance.info(t)}stop(){this.instance.stop()}set text(t){this.instance.text=t}};s(no,"spin")});function Ul(e){return Object.prototype.hasOwnProperty.call(vs,e)}function rT(e){let t=[];for(let r of e)(typeof r!="string"||r.trim()===""||!Ul(r))&&t.push(String(r));if(t.length>0)throw new tg(t)}function oT(e){return e.filter(t=>Ul(t)&&vs[t].status!=="live")}var ng,tg,Bs=P(()=>{"use strict";qo();ng=Object.keys(vs).sort(),tg=class extends Error{static{s(this,"EmbedComponentError")}unknown;constructor(t){super(`npayload.toml [embed]: unknown component id(s) [${t.join(", ")}] \u2014 valid ids: [${ng.join(", ")}]`),this.name="EmbedComponentError",this.unknown=t}};s(Ul,"isKnownComponentId");s(rT,"validateMountedComponents");s(oT,"nonLiveComponents")});var sT,ai,Ks=P(()=>{"use strict";sT="f4d5410c733e4c4a28858907bb7addc6d1fd34280961bdfb74cf0ac7a0a8419b",ai={channels:{identity:"slug",deps:[],refs:{},ops:{archive:{convexFn:"",method:"POST",pattern:"/v1/channels/:channelId/archive",scopes:["channels:admin"],pathParams:{channelId:"channelGid"}},create:{convexFn:"",method:"POST",pattern:"/v1/apps/channels",scopes:["channels:write"]},list:{convexFn:"",method:"GET",pattern:"/v1/apps/channels",scopes:["channels:read"]},pause:{convexFn:"",method:"POST",pattern:"/v1/channels/:channelId/pause",scopes:["channels:write"],pathParams:{channelId:"channelGid"}},remove:{convexFn:"",method:"DELETE",pattern:"/v1/channels/:channelId",scopes:["channels:admin"],pathParams:{channelId:"channelGid"}},resume:{convexFn:"",method:"POST",pattern:"/v1/channels/:channelId/resume",scopes:["channels:write"],pathParams:{channelId:"channelGid"}},update:{convexFn:"",method:"PATCH",pattern:"/v1/channels/:channelId",scopes:["channels:write"],pathParams:{channelId:"channelGid"},updatable:["complianceClass","nppMinQos","rateLimit","name","description","status","schema","settings","privacy","replication","compactionConfig","schemaValidation","platformConnectEnforcement","metadata","pii"]}}},consumerGroups:{identity:"name",deps:["channels"],refs:{channelGid:{parent:"channels",product:"events",wire:"gid",identity:"slug",array:!1,publicField:"channelGid"}},ops:{create:{convexFn:"",method:"POST",pattern:"/v1/channels/:channelGid/consumer-groups",scopes:["consumer_groups:write"],pathParams:{channelGid:"channelGid"}},join:{convexFn:"",method:"POST",pattern:"/v1/consumer-groups/:consumerGroupGid/members",scopes:["consumer_groups:write"],pathParams:{consumerGroupGid:"groupGid"},updatable:["subscriptionGid"]},leave:{convexFn:"",method:"DELETE",pattern:"/v1/consumer-groups/:consumerGroupGid/members/:subscriptionGid",scopes:["consumer_groups:write"],pathParams:{consumerGroupGid:"groupGid",subscriptionGid:"subscriptionGid"}},list:{convexFn:"",method:"GET",pattern:"/v1/channels/:channelGid/consumer-groups",scopes:["consumer_groups:read"],pathParams:{channelGid:"channelGid"}},pause:{convexFn:"",method:"POST",pattern:"/v1/consumer-groups/:consumerGroupGid/pause",scopes:["consumer_groups:write"],pathParams:{consumerGroupGid:"groupGid"}},resume:{convexFn:"",method:"POST",pattern:"/v1/consumer-groups/:consumerGroupGid/resume",scopes:["consumer_groups:write"],pathParams:{consumerGroupGid:"groupGid"}},update:{convexFn:"",method:"PATCH",pattern:"/v1/consumer-groups/:consumerGroupGid",scopes:["consumer_groups:write"],pathParams:{consumerGroupGid:"groupGid"},updatable:["strategy","maxConcurrency"]}}},eventTypes:{identity:"name",deps:["channels"],refs:{channels:{parent:"channels",product:"events",wire:"gid",identity:"slug",array:!0,publicField:"channels"}},ops:{activate:{convexFn:"",method:"POST",pattern:"/v1/events/types/:eventTypeGid/activate",scopes:["catalogue:write"],pathParams:{eventTypeGid:"eventTypeGid"}},deprecate:{convexFn:"",method:"POST",pattern:"/v1/events/types/:eventTypeGid/deprecate",scopes:["catalogue:admin"],pathParams:{eventTypeGid:"eventTypeGid"},updatable:["message","sunsetDate"]},list:{convexFn:"",method:"GET",pattern:"/v1/apps/events/types",scopes:["catalogue:read"]},create:{convexFn:"",method:"POST",pattern:"/v1/apps/events/types",scopes:["catalogue:write"]},registerVersion:{convexFn:"",method:"POST",pattern:"/v1/events/types/:eventTypeGid/versions",scopes:["catalogue:write"],pathParams:{eventTypeGid:"eventTypeGid"},updatable:["version","schema","compatibility","changelog","publishedBy"]},update:{convexFn:"",method:"PATCH",pattern:"/v1/events/types/:eventTypeGid",scopes:["catalogue:write"],pathParams:{eventTypeGid:"eventTypeGid"},updatable:["displayName","description","ownership","channels","tags","schema"]}}},exchanges:{identity:"name",deps:[],refs:{},ops:{create:{convexFn:"",method:"POST",pattern:"/v1/exchanges",scopes:["exchanges:write"]},createBinding:{convexFn:"",method:"POST",pattern:"/v1/exchanges/:exchange_gid/bindings",scopes:["exchanges:write"],pathParams:{exchange_gid:"exchangeGid"},updatable:["channelGid","routingKey","headerRules"]},pause:{convexFn:"",method:"POST",pattern:"/v1/exchanges/:exchange_gid/disable",scopes:["exchanges:write"],pathParams:{exchange_gid:"exchangeGid"}},resume:{convexFn:"",method:"POST",pattern:"/v1/exchanges/:exchange_gid/enable",scopes:["exchanges:write"],pathParams:{exchange_gid:"exchangeGid"}},list:{convexFn:"",method:"GET",pattern:"/v1/exchanges",scopes:["exchanges:read"]},remove:{convexFn:"",method:"DELETE",pattern:"/v1/exchanges/:exchange_gid",scopes:["exchanges:admin"],pathParams:{exchange_gid:"exchangeGid"}},removeBinding:{convexFn:"",method:"DELETE",pattern:"/v1/exchange-bindings/:binding_gid",scopes:["exchanges:write"],pathParams:{binding_gid:"bindingGid"}},update:{convexFn:"",method:"PATCH",pattern:"/v1/exchanges/:exchange_gid",scopes:["exchanges:write"],pathParams:{exchange_gid:"exchangeGid"},updatable:["config"]}}},subscriptions:{identity:"name",deps:["channels"],refs:{channelGid:{parent:"channels",product:"events",wire:"gid",identity:"slug",array:!1,publicField:"channelGid"}},ops:{archive:{convexFn:"",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/archive",scopes:["subscriptions:write"],pathParams:{subscriptionId:"subscriptionGid"}},create:{convexFn:"",method:"POST",pattern:"/v1/channels/:channelId/subscriptions",scopes:["subscriptions:write"],pathParams:{channelId:"channelGid"}},list:{convexFn:"",method:"GET",pattern:"/v1/channels/:channelId/subscriptions",scopes:["subscriptions:read"],pathParams:{channelId:"channelGid"}},pause:{convexFn:"",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/pause",scopes:["subscriptions:write"],pathParams:{subscriptionId:"subscriptionGid"}},remove:{convexFn:"",method:"DELETE",pattern:"/v1/subscriptions/:subscriptionId",scopes:["subscriptions:admin"],pathParams:{subscriptionId:"subscriptionGid"}},resume:{convexFn:"",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/resume",scopes:["subscriptions:write"],pathParams:{subscriptionId:"subscriptionGid"}},update:{convexFn:"",method:"PATCH",pattern:"/v1/subscriptions/:subscriptionId",scopes:["subscriptions:write"],pathParams:{subscriptionId:"subscriptionGid"},updatable:["description","status","filter","endpoint","delivery","dlq","metadata","deliveryConfig","transformPipeId","transformTimeout","transformOnFailure"]}}}}});var cT,aT=P(()=>{cT="5.0.5"});var Qs,yL,xQ,ag=P(()=>{"use strict";aT();Qs=cT,yL="npayload",xQ=`${yL}/${Qs}`});function jl(){try{let e=(0,Hs.dirname)((0,dT.fileURLToPath)(vL.url));for(let t=0;t<6;t++){try{let o=JSON.parse((0,lT.readFileSync)((0,Hs.join)(e,"package.json"),"utf8"));if(o.name===fn&&o.version)return o.version}catch{}let r=(0,Hs.dirname)(e);if(r===e)break;e=r}}catch{}return null}function zn(){return jl()??Qs}function Ml(){let e=jl();return e?`${fn}@${e}`:fn}var lT,Hs,dT,vL,fn,cg,oo=P(()=>{"use strict";lT=require("fs"),Hs=require("path"),dT=require("url");ag();vL={},fn="@npayload/sdk",cg=["@npayload/npayload"];s(jl,"resolveRuntimeVersion");s(zn,"cliVersion");s(Ml,"installPinSpec")});function gn(e){if(e==null)return!0;let t=e.trim();return t.length===0?!0:t.startsWith("__set_by_npayload_login__")}var uT,pT,mT,Ws=P(()=>{"use strict";uT="__set_by_npayload_login__",pT="__set_by_npayload_login__",mT="__set_by_npayload_login__";s(gn,"isPlaceholderCredential")});function pg(e,t,r){return Math.round(e+(t-e)*r)}function wT(e){let t=Math.min(1,Math.max(0,e)),r=Math.min(Js.length-2,Math.floor(t*(Js.length-1))),o=t*(Js.length-1)-r,[n,i,a]=Js[r],[c,l,d]=Js[r+1];return[pg(n,c,o),pg(i,l,o),pg(a,d,o)]}function ci(e,t=!0){let r=[...e],o=Math.max(1,r.length-1);return r.map((n,i)=>{let[a,c,l]=wT(i/o),d=hn.default.rgb(a,c,l);return t?d.bold(n):d(n)}).join("")}function mg(){let e=["\u2588","\u2593","\u2592","\u2591"];return e.map((t,r)=>{let[o,n,i]=wT(r/(e.length-1));return hn.default.rgb(o,n,i)(t)}).join("")}function kT(e="communication infrastructure for autonomous systems"){return["",` ${mg()} ${ci("npayload")}`,` ${hn.default.dim(e)}`,""].join(`
|
|
10
|
+
`)}function ET(e,t){let r=t.filter(Boolean).join(hn.default.dim(" \xB7 "));return` ${ci("npayload",!1)} ${hn.default.bold(e)}${r?hn.default.dim(" \xB7 ")+r:""}
|
|
11
|
+
`}function ST(e,t){let r=t!==void 0?hn.default.dim(` in ${((Date.now()-t)/1e3).toFixed(1)}s`):"";return`
|
|
12
|
+
${hn.default.green("\u2713")} ${hn.default.bold(e)}${r}
|
|
13
|
+
`}var hn,Js,zl=P(()=>{"use strict";hn=K(require("chalk")),Js=[[99,102,241],[139,92,246],[168,85,247],[217,70,239],[236,72,153]];s(pg,"lerp");s(wT,"rampAt");s(ci,"grad");s(mg,"pulse");s(kT,"banner");s(ET,"header");s(ST,"done")});function PT(e){let t=Pl(e.edge),r=t!==void 0,o=t??(e.npp&&e.guard.production?Sl:void 0);if(o===void 0&&!e.npp)return{named:!1};for(let i of e.provisioning??[]){let a=e.guard.refusal(i);if(a!==void 0)return{named:r,refusal:a}}if(o===void 0){let i=e.guard.noEdge();return i===void 0?{named:!1}:{named:!1,refusal:i}}let n=e.guard.refusal(o);return n===void 0?{edgeUrl:o,named:r}:{named:r,refusal:n}}var IT=P(()=>{"use strict";ri();s(PT,"resolveEdge")});function te(e,t,r){return e||r}function TT(e,t,r=[]){return PT({edge:te(e,"edgeUrl"),npp:!0,guard:t,provisioning:r})}function xT(){return"production"}var gt=P(()=>{"use strict";IT();s(te,"resolveEndpoint");s(TT,"resolveEdgeUrl");s(xT,"resolveTargetEnv")});function _T(e){if(!(0,io.existsSync)(e))return{};try{return vI((0,io.readFileSync)(e,"utf8"))}catch{return{}}}function RT(e){try{return(0,io.existsSync)(e)?(0,io.readFileSync)(e,"utf8"):void 0}catch{return}}function SL(e=process.cwd()){let t=(0,xt.resolve)(e);for(let r=0;r<5;r+=1){if((0,io.existsSync)((0,xt.join)(t,".npayload.json")))return t;let o=(0,xt.join)(t,"..");if(o===t)break;t=o}return(0,xt.resolve)(e)}function fg(e){if(e!==void 0)return _T((0,xt.join)(e,".env"));let t=(0,xt.resolve)(process.cwd()),r=SL(t);if(r!==t&&!AT){let o=RT((0,xt.join)(t,".env"));o!==void 0&&o!==RT((0,xt.join)(r,".env"))&&(AT=!0,process.stderr.write(`npayload: reading the project's .env (${(0,xt.join)(r,".env")}), the one beside its .npayload.json, for this run's estate; the .env in ${t} differs and is not read.
|
|
14
|
+
`))}return _T((0,xt.join)(r,".env"))}function PL(e=[],t){return ni([...Us(process.env),...Us(fg(t),r=>`${r} in the project's .env`),...e])}function IL(e){return`${e==="auth host"?"Name that estate's auth host with NPAYLOAD_AUTH_URL, or name none so the CLI mints at that estate's API":e==="edge"?"Set NPAYLOAD_EDGE_URL to the edge of that estate":"Name that estate's API with NPAYLOAD_API_URL (the CLI dials no address the project's .env names: export it)"}, or name nothing outside npayload's production hosts to use its production estate.`}function Ie(e=[],t){return new _l(PL(e,t),IL)}function so(e){let t=Ie(e!==void 0?[["the lane gateway",e]]:[]),r=e??te(process.env.NPAYLOAD_API_URL,"apiUrl",dr),n=te(process.env.NPAYLOAD_AUTH_URL,"authUrl")??(t.production?dr:r);return{apiUrl:r,authUrl:n,guard:t}}function Bl(e){let t=e??te(process.env.NPAYLOAD_AUTH_URL,"authUrl"),r=te(process.env.NPAYLOAD_API_URL,"apiUrl");return{base:(t??(Ie().production?void 0:r)??dr).replace(/\/+$/,"")}}var io,xt,AT,Wt=P(()=>{"use strict";io=require("fs"),xt=require("path");ri();se();gt();s(_T,"dotenvAt");s(RT,"textAt");s(SL,"projectRoot");AT=!1;s(fg,"projectDotenv");s(PL,"cliEstate");s(IL,"cliCure");s(Ie,"cliGuard");s(so,"cliEndpoints");s(Bl,"cliSessionBase")});async function OT(){let{publicKey:e,privateKey:t}=await(0,ao.generateKeyPair)("ES256",{extractable:!0}),r=await(0,ao.exportJWK)(e),o=await(0,ao.exportJWK)(t);return{kid:(await(0,ao.calculateJwkThumbprint)(r,"sha256")).slice(0,12),alg:"ES256",publicJwk:r,privateJwk:o,createdAt:Date.now()}}var ao,$T=P(()=>{"use strict";ao=require("jose");s(OT,"generateDpopKeypair")});function gg(e){return(e instanceof Error?e.message:String(e)).toLowerCase().includes("no matching entry")}async function _L(){let e=await import("@napi-rs/keyring"),t=e.default??e;if(typeof t.AsyncEntry!="function")throw new Error("@napi-rs/keyring did not load an Entry class");return t}function RL(e){return{async getPassword(t,r){try{return await new e.AsyncEntry(t,r).getPassword()??null}catch(o){if(gg(o))return null;throw new yn(o)}},async setPassword(t,r,o){try{await new e.AsyncEntry(t,r).setPassword(o)}catch(n){throw new yn(n)}},async deletePassword(t,r){try{return await new e.AsyncEntry(t,r).deleteCredential()}catch(o){if(gg(o))return!1;throw new yn(o)}},async findCredentials(t){try{return await e.findCredentialsAsync(t)}catch(r){if(gg(r))return[];throw new yn(r)}}}}async function Ys(){if(Ql)return Ql;let e;try{e=CT?await CT():await _L()}catch(t){throw t instanceof yn?t:new yn(t)}return Ql=RL(e),Ql}async function LT(){try{return await(await Ys()).getPassword(Zs,"__probe__"),!0}catch{return!1}}async function Vl(e=TL){let r=await(await Ys()).getPassword(Zs,e);if(!r)return null;try{return JSON.parse(r)}catch{return null}}async function vg(e){await(await Ys()).setPassword(Zs,yg,JSON.stringify({...e,storedAt:e.storedAt||Date.now()}))}async function Hl(){let t=await(await Ys()).getPassword(Zs,yg);if(!t)return null;try{return JSON.parse(t)}catch{return null}}async function bg(){await(await Ys()).deletePassword(Zs,yg)}var NT,hg,Zs,TL,xL,DV,yn,Ql,CT,yg,Xs=P(()=>{"use strict";NT=require("os"),hg=require("path"),Zs="npayload",TL="default",xL=process.env.NPAYLOAD_AUTH_HOME??(0,hg.join)((0,NT.homedir)(),".npayload"),DV=(0,hg.join)(xL,"credentials.json"),yn=class extends Error{static{s(this,"KeychainUnavailableError")}cause;constructor(t){super(`The npayload CLI stores credentials in the OS keychain (macOS Keychain / Windows Credential Manager / Linux Secret Service), and it is not reachable here.
|
|
15
|
+
\u2022 On a desktop session: install/start a Secret Service (e.g. \`gnome-keyring\` or KWallet on Linux).
|
|
16
|
+
\u2022 Headless / CI / container: authenticate without a keychain by exporting machine credentials \u2014
|
|
17
|
+
export NPAYLOAD_CLIENT_ID=... NPAYLOAD_CLIENT_SECRET=... (or NPAYLOAD_TOKEN=<short-lived token>)
|
|
18
|
+
\u2022 Run \`npayload doctor\` to see exactly what is available on this host.
|
|
19
|
+
Plaintext credential files are intentionally NOT supported.`),this.name="KeychainUnavailableError",this.cause=t}};s(gg,"isNoEntryError");Ql=null,CT=null;s(_L,"loadRealKeyring");s(RL,"adaptKeyring");s(Ys,"loadKeytar");s(LT,"keychainAvailable");s(Vl,"getStoredCredentials");yg="__management__";s(vg,"saveManagementSession");s(Hl,"getManagementSession");s(bg,"clearManagementSession")});function DT(e){if(e instanceof Jt)return!0;let t=(e instanceof Error?e.message:String(e)).toLowerCase();return/fetch failed|econnrefused|etimedout|enotfound|eai_again|network|socket hang up|aborted|timed? ?out|and_error|dns/.test(t)?!1:/revoked|invalid_grant|unauthorized|session[_ ]?revoked|\b401\b/.test(t)}function vn(e={}){let t=e.write??(o=>void process.stderr.write(o)),r=e.exit??(o=>process.exit(o));t(`
|
|
20
|
+
`+wg.default.red("\u2716 Your npayload CLI session was revoked.")+`
|
|
21
|
+
`),t(" "+wg.default.yellow("\u2192")+" Run `npayload login` to re-authenticate.\n\n"),r(1)}var wg,Jt,mr=P(()=>{"use strict";wg=K(require("chalk")),Jt=class extends Error{static{s(this,"RevokedSessionError")}constructor(t="Your npayload CLI session was revoked."){super(t),this.name="RevokedSessionError"}};s(DT,"isRevokedError");s(vn,"exitRevoked")});var di={};me(di,{CliSession:()=>ea,appCreateRefusalMessage:()=>jT,deviceLogin:()=>Eg,restoreSession:()=>ht,verificationPage:()=>kg});function UT(e){return Bl(e).base}function li(e,t){return ot(Ie())(e,t)}function AL(){try{let e=(0,GT.hostname)();return e?e.slice(0,80):void 0}catch{return}}function OL(){let e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}function $L(e){let t="";for(let r of e)t+=String.fromCharCode(r);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function CL(e){let t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e));return $L(new Uint8Array(t))}async function Wl(e,t,r,o){let n=await(0,Jl.importJWK)(e.privateJwk,"ES256"),i=new URL(r),a={htm:t.toUpperCase(),htu:`${i.origin}${i.pathname}`,jti:OL()};return o&&(a.ath=await CL(o)),new Jl.SignJWT(a).setProtectedHeader({alg:"ES256",typ:"dpop+jwt",jwk:e.publicJwk}).setIssuedAt().sign(n)}async function ht(e){let t=await Hl();return t?new ea(t.accessToken,t.refreshToken,t.dpopKeypair,UT(e)):null}function NL(e){if(Array.isArray(e))return"a JSON array";if(e===null)return"JSON null";if(typeof e!="string")return`a JSON ${typeof e}, not a string`;if(e==="")return"an empty string";let t=/^([A-Za-z][A-Za-z0-9+.-]*):/.exec(e)?.[1];return t===void 0?"a string with no scheme":/^https?$/i.test(t)?`an address under the ${t.toLowerCase()}: scheme with no // after it, or with no host`:`an address under the ${t.toLowerCase()}: scheme`}function kg(e,t){if(t!==void 0){if(typeof t=="string"&&/^https?:\/\//i.test(t))try{let r=new URL(t);if((r.protocol==="http:"||r.protocol==="https:")&&r.hostname!=="")return r.href}catch{}throw new Z(`The device sign-in's answer names its ${e} as ${NL(t)}, not an absolute http(s) URL: the sign-in ends here, before anything is printed or opened.`)}}async function Eg(e){let t=UT(e.authUrl);Ie().check(`${t}/oauth/cli/code`),e.onStart?.(t);let r=await OT(),o;try{o=await li(`${t}/oauth/cli/code`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dpop_jwk:r.publicJwk,hostname:AL(),os:process.platform,cli_version:zn()}),signal:AbortSignal.timeout(15e3)})}catch(p){if(p instanceof Z)throw p;let f=p instanceof Error?p.message:String(p);throw new Error(`Could not reach the npayload auth service at ${t} (${f}). Check your network connection, or set NPAYLOAD_AUTH_URL if your account uses another sign-in endpoint, then retry.`)}if(o.status===429)throw new Error("Too many sign-in attempts from this network. Please wait a minute and try again.");if(!o.ok)throw new Error(`Could not start login (${o.status}). Is the auth service reachable at ${t}?`);let n=await o.json(),i=kg("verification_uri_complete",n.verification_uri_complete),a=kg("verification_uri",n.verification_uri);if(i===void 0&&a===void 0)throw new Z("The device sign-in's answer names no verification page, so there is nothing to print or open: the sign-in ends here.");Ie().checkPages(...[i,a].filter(p=>p!==void 0)),e.onPrompt({userCode:n.user_code,verificationUri:a??"",verificationUriComplete:i??"",expiresIn:n.expires_in});let c=(n.interval||5)*1e3,l=Date.now()+n.expires_in*1e3,d=!1,u=null,m=s(()=>{d=!0,u?.()},"onSigint");process.once("SIGINT",m);try{for(;Date.now()<l;){if(d||e.signal?.aborted)throw new Error("Login cancelled.");e.onPoll?.();let p=null;try{p=await li(`${t}/oauth/cli/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:n.device_code,dpop_jwk:r.publicJwk}),signal:AbortSignal.timeout(15e3)})}catch(f){if(f instanceof Z)throw f;p=null}if(p){let f=await p.json().catch(()=>({}));if(p.ok&&f.access_token&&f.refresh_token)return await vg({accessToken:f.access_token,refreshToken:f.refresh_token,dpopKeypair:r,storedAt:Date.now()}),new ea(f.access_token,f.refresh_token,r,t);switch(f.error){case"authorization_pending":break;case"slow_down":c=(f.interval??c/1e3+5)*1e3;break;case"access_denied":throw new Error("Login was denied in the browser.");case"expired_token":throw new Error("The login code expired. Please run the command again.");default:if(!p.ok&&p.status>=500)throw new Error("The auth service returned an error. Please try again.")}}await new Promise(f=>{let g=setTimeout(()=>{u=null,f()},c);u=s(()=>{clearTimeout(g),u=null,f()},"wakeSleep")})}throw new Error("Login timed out. Please run the command again.")}finally{process.removeListener("SIGINT",m)}}function jT(e,t){switch(e){case"slug_taken":return"That slug is already taken.";case"reserved_slug":return"That slug is reserved. Choose another slug.";case"invalid_slug":return"That slug is not valid \u2014 lowercase alphanumeric with hyphens, no leading/trailing hyphens.";case"missing_tenancy_mode":return"The control plane requires a tenancy mode (none | tenanted) and this CLI did not send one \u2014 update npayload to the latest version.";case"invalid_tenancyMode":return'Tenancy mode must be exactly "none" or "tenanted".';case"feed_cannot_be_tenanted":return'A feed app cannot be tenanted \u2014 create it with tenancy "none".';case"invalid_appType":return"App type must be internal, connect, or feed.";case"invalid_subtype":return"Connect subtype must be device, mobile, or platform.";case"invalid_platform":return"Platform slug is not valid for this connect app.";case"missing_args":return"App name and slug are both required.";case"missing_tenancy_mode_flip_blocked":case"insufficient_scope":return`Your credential lacks the scope to create apps here (${e}).`;default:return`Could not create app (${e??"no reason given"}, HTTP ${t}).`}}var GT,Jl,ea,_t=P(()=>{"use strict";GT=require("os"),Jl=require("jose");Wt();se();Ke();oo();$T();Xs();mr();s(UT,"authBase");s(li,"dial");s(AL,"safeHostname");s(OL,"randomJti");s($L,"base64url");s(CL,"accessTokenHash");s(Wl,"signDpopProof");ea=class{constructor(t,r,o,n){this.accessToken=t;this.refreshToken=r;this.keypair=o;this.base=n}static{s(this,"CliSession")}async call(t,r,o,n=!0,i=15e3){let a=`${this.base}/oauth/cli/${r}`,c=await Wl(this.keypair,t,a,this.accessToken),l=await li(a,{method:t,headers:{Authorization:`DPoP ${this.accessToken}`,DPoP:c,...o!==void 0?{"Content-Type":"application/json"}:{}},body:o!==void 0?JSON.stringify(o):void 0,signal:AbortSignal.timeout(i)});return l.status===401&&n&&await this.refresh()?this.call(t,r,o,!1,i):l}async refresh(){let t=`${this.base}/oauth/cli/refresh`,r=await Wl(this.keypair,"POST",t,this.refreshToken),o=await li(t,{method:"POST",headers:{Authorization:`DPoP ${this.refreshToken}`,DPoP:r},signal:AbortSignal.timeout(15e3)});if(!o.ok)return!1;let n=await o.json();return n.accessToken?(this.accessToken=n.accessToken,await vg({accessToken:this.accessToken,refreshToken:this.refreshToken,dpopKeypair:this.keypair,storedAt:Date.now()}),!0):!1}async listOrgs(){let t=await this.call("GET","orgs");if(!t.ok)throw new Error(`Could not list organizations (${t.status}).`);return(await t.json()).orgs}async listApps(t){let r=await this.call("GET",`apps?orgId=${encodeURIComponent(t)}`);if(!r.ok)throw new Error(`Could not list apps (${r.status}).`);return(await r.json()).apps}async createApp(t,r){let o=await this.call("POST","apps",{orgId:t,...r});if(!o.ok){let n=await o.json().catch(()=>({}));throw new Error(jT(n.error,o.status))}return await o.json()}async provisionOac(t,r,o=!1,n){let i=await this.call("POST","oac",{...t?{orgId:t}:{},appGid:r,rotate:o,...n&&n.length>0?{requestedScopes:n}:{}});if(!i.ok)throw new Error(`Could not provision credentials (${i.status}).`);return await i.json()}async getOacGrant(t){let r;try{r=await this.call("GET",`oac?appGid=${encodeURIComponent(t)}`)}catch(n){return F(n),null}if(!r.ok)return null;let o=await r.json().catch(()=>({}));return{scopes:o.allowedScopes??[],configDrift:o.configDrift===!0}}async post(t,r,o=6e4){let n=await this.call("POST",t,r,!0,o);if(!n.ok){let i=await n.json().catch(()=>({}));throw new Error(i.message??i.error??`Request failed (${n.status}).`)}return await n.json()}async logout(){let t;try{let r=`${this.base}/oauth/cli/revoke`,o=await Wl(this.keypair,"POST",r,this.refreshToken);await li(r,{method:"POST",headers:{Authorization:`DPoP ${this.refreshToken}`,DPoP:o},signal:AbortSignal.timeout(8e3)})}catch(r){r instanceof Z&&(t=r)}if(await bg(),t!==void 0)throw t}async logoutAll(){let t;try{let r=`${this.base}/oauth/cli/revoke`,o=await Wl(this.keypair,"POST",r,this.refreshToken);await li(r,{method:"POST",headers:{Authorization:`DPoP ${this.refreshToken}`,DPoP:o,"Content-Type":"application/json"},body:JSON.stringify({all:!0}),signal:AbortSignal.timeout(8e3)})}catch(r){r instanceof Z&&(t=r)}if(await bg(),t!==void 0)throw t}sessionId(){try{let t=this.accessToken.split(".")[1];if(!t)return null;let r=JSON.parse(Buffer.from(t,"base64url").toString("utf8"));return typeof r.sid=="string"?r.sid:null}catch{return null}}orgId(){try{let t=this.accessToken.split(".")[1];if(!t)return null;let r=JSON.parse(Buffer.from(t,"base64url").toString("utf8")),o=r["npayload/orgId"]??r.orgId??r.org??r.org_id;return typeof o=="string"&&o.length>0?o:null}catch{return null}}async heartbeat(t){let r=await this.call("POST","heartbeat",{verb:t});if(r.status===401)throw new Jt;if(!r.ok)throw new Error(`heartbeat failed (${r.status})`)}async whoami(){let t=await this.call("GET","whoami");if(t.status===401)throw new Jt;if(!t.ok)throw new Error(`whoami failed (${t.status})`);let r=await t.json().catch(()=>({}));return{sid:typeof r.sid=="string"?r.sid:this.sessionId(),label:typeof r.label=="string"?r.label:null}}};s(ht,"restoreSession");s(NL,"pageForm");s(kg,"verificationPage");s(Eg,"deviceLogin");s(jT,"appCreateRefusalMessage")});var zT,BT=P(()=>{"use strict";zT={contentHash:"d6f97f724c494689c7307f26fa9081b55303f9d0c6f4b7b9523b2f4a26172cb3",generatedAt:"contract-d6f97f724c494689c7307f26fa9081b55303f9d0c6f4b7b9523b2f4a26172cb3",commands:[{key:"account.environments.clone",commandPath:["account","environments","clone"],opId:"POST /v1/account/environments/:slug/clone",method:"POST",pattern:"/v1/account/environments/:slug/clone",pathParams:[{name:"slug",key:"slug"}],flags:[{name:"targetSlug",coerce:null,optional:!1},{name:"targetName",coerce:null,optional:!0},{name:"mode",coerce:null,optional:!0,choices:["config","config_and_data"]},{name:"confirmation",coerce:null,optional:!0}],scopes:["account:write"],idempotent:!1,isQuery:!1,summary:"Clone an environment into a new development environment (background job)."},{key:"account.environments.create",commandPath:["account","environments","create"],opId:"POST /v1/account/environments",method:"POST",pattern:"/v1/account/environments",pathParams:[],flags:[{name:"appId",coerce:null,optional:!0},{name:"name",coerce:null,optional:!1},{name:"slug",coerce:null,optional:!1},{name:"kind",coerce:null,optional:!1,choices:["development","production"]}],scopes:["account:write"],idempotent:!1,isQuery:!1,summary:"Create a logical environment (N development; production is a singleton)."},{key:"account.environments.list",commandPath:["account","environments","list"],opId:"GET /v1/account/environments",method:"GET",pattern:"/v1/account/environments",pathParams:[],flags:[],scopes:["account:read"],idempotent:!0,isQuery:!0,summary:"List the bound app's logical environments."},{key:"account.environments.show",commandPath:["account","environments","show"],opId:"GET /v1/account/environments/:slug",method:"GET",pattern:"/v1/account/environments/:slug",pathParams:[{name:"slug",key:"slug"}],flags:[],scopes:["account:read"],idempotent:!0,isQuery:!0,summary:"Show one of the bound app's environments by slug."},{key:"analytics.events.tail",commandPath:["analytics","events","tail"],opId:"GET /v1/analytics/events/tail",method:"GET",pattern:"/v1/analytics/events/tail",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"eventName",coerce:null,optional:!1},{name:"fromTs",coerce:"number",optional:!0},{name:"toTs",coerce:"number",optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["analytics:read"],idempotent:!0,isQuery:!1,summary:"Tail recent raw analytics events for the calling org (RLS-scoped)."},{key:"analytics.rollups.list",commandPath:["analytics","rollups","list"],opId:"GET /v1/analytics/rollups",method:"GET",pattern:"/v1/analytics/rollups",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"eventName",coerce:null,optional:!0},{name:"envId",coerce:null,optional:!0},{name:"granularity",coerce:null,optional:!0,choices:["minute","hour","day"]},{name:"start",coerce:"number",optional:!1},{name:"end",coerce:"number",optional:!1},{name:"pageSize",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["analytics:read"],idempotent:!0,isQuery:!1,summary:"List the calling org's analytics rollups (paginated, RLS-scoped)."},{key:"analytics.sketches.percentile",commandPath:["analytics","sketches","percentile"],opId:"GET /v1/analytics/sketches/percentile",method:"GET",pattern:"/v1/analytics/sketches/percentile",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"envId",coerce:null,optional:!1},{name:"eventName",coerce:null,optional:!1},{name:"granularity",coerce:null,optional:!1,choices:["minute","hour","day"]},{name:"bucketStart",coerce:"number",optional:!1},{name:"dimensionName",coerce:null,optional:!1},{name:"quantile",coerce:"number",optional:!1}],scopes:["analytics:read"],idempotent:!0,isQuery:!1,summary:"Compute a t-digest percentile over a sketch bucket (RLS-scoped)."},{key:"analytics.sketches.topK",commandPath:["analytics","sketches","topK"],opId:"GET /v1/analytics/sketches/topk",method:"GET",pattern:"/v1/analytics/sketches/topk",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"envId",coerce:null,optional:!1},{name:"eventName",coerce:null,optional:!1},{name:"granularity",coerce:null,optional:!1,choices:["minute","hour","day"]},{name:"bucketStart",coerce:"number",optional:!1},{name:"dimensionName",coerce:null,optional:!1},{name:"n",coerce:"number",optional:!1}],scopes:["analytics:read"],idempotent:!0,isQuery:!1,summary:"Top-K dimension values over a sketch bucket (RLS-scoped)."},{key:"analytics.summary.snapshot",commandPath:["analytics","summary","snapshot"],opId:"GET /v1/analytics/summary",method:"GET",pattern:"/v1/analytics/summary",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"eventName",coerce:null,optional:!0},{name:"envId",coerce:null,optional:!0},{name:"start",coerce:"number",optional:!1},{name:"end",coerce:"number",optional:!1},{name:"granularity",coerce:null,optional:!0,choices:["minute","hour","day"]}],scopes:["analytics:read"],idempotent:!0,isQuery:!1,summary:"App overview over a window (server-summed series + per-event totals)."},{key:"audit.chain.verifyStatus",commandPath:["audit","chain","verifyStatus"],opId:"GET /v1/audit/chain/status",method:"GET",pattern:"/v1/audit/chain/status",pathParams:[],flags:[],scopes:["audit:read"],idempotent:!0,isQuery:!1,summary:"Hash-chain verification posture: newest signed chain-head anchor per source deployment."},{key:"audit.events.get",commandPath:["audit","events","get"],opId:"GET /v1/audit/events/get",method:"GET",pattern:"/v1/audit/events/get",pathParams:[],flags:[{name:"gid",coerce:null,optional:!1}],scopes:["audit:read"],idempotent:!0,isQuery:!1,summary:"Retrieve one of the calling org's federated hash-chained audit events by gid."},{key:"audit.events.list",commandPath:["audit","events","list"],opId:"GET /v1/audit/events/list",method:"GET",pattern:"/v1/audit/events/list",pathParams:[],flags:[{name:"appId",coerce:null,optional:!0},{name:"envId",coerce:null,optional:!0},{name:"action",coerce:null,optional:!0},{name:"rowActor",coerce:null,optional:!0},{name:"tenantId",coerce:null,optional:!0},{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0},{name:"start",coerce:"number",optional:!0},{name:"end",coerce:"number",optional:!0}],scopes:["audit:read"],idempotent:!0,isQuery:!1,summary:"List the calling org's federated hash-chained audit events (paged, RLS-scoped)."},{key:"audit.events.stats",commandPath:["audit","events","stats"],opId:"GET /v1/audit/events/stats",method:"GET",pattern:"/v1/audit/events/stats",pathParams:[],flags:[{name:"appId",coerce:null,optional:!0},{name:"envId",coerce:null,optional:!0},{name:"start",coerce:"number",optional:!0},{name:"end",coerce:"number",optional:!0}],scopes:["audit:read"],idempotent:!0,isQuery:!1,summary:"Aggregate audit stat tiles for the calling org's window."},{key:"billing.connectAccounts.createAccountSession",commandPath:["billing","connectAccounts","createAccountSession"],opId:"POST /v1/billing/connect-accounts/session",method:"POST",pattern:"/v1/billing/connect-accounts/session",pathParams:[],flags:[{name:"components",coerce:"json",optional:!1}],scopes:["billing:write"],idempotent:!1,isQuery:!1,summary:"Create a Stripe Connect account session client secret for embedded components."},{key:"billing.connectAccounts.ensureConnectAccount",commandPath:["billing","connectAccounts","ensureConnectAccount"],opId:"POST /v1/billing/connect-accounts/ensure",method:"POST",pattern:"/v1/billing/connect-accounts/ensure",pathParams:[],flags:[{name:"country",coerce:null,optional:!0},{name:"email",coerce:null,optional:!0},{name:"name",coerce:null,optional:!0},{name:"businessType",coerce:null,optional:!0,choices:["individual","company","non_profit","government_entity"]}],scopes:["billing:write"],idempotent:!1,isQuery:!1,summary:"Ensure the calling org has a Stripe Connect account (create if missing)."},{key:"billing.credits.listCredits",commandPath:["billing","credits","listCredits"],opId:"GET /v1/billing/credits",method:"GET",pattern:"/v1/billing/credits",pathParams:[],flags:[{name:"sinceMs",coerce:"number",optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"List credit memos for the authenticated org."},{key:"billing.disputes.listDisputes",commandPath:["billing","disputes","listDisputes"],opId:"GET /v1/billing/disputes",method:"GET",pattern:"/v1/billing/disputes",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0},{name:"status",coerce:null,optional:!0}],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"List the calling org's payment disputes (RLS-scoped)."},{key:"billing.disputes.retrieveDispute",commandPath:["billing","disputes","retrieveDispute"],opId:"GET /v1/billing/disputes/:disputeId",method:"GET",pattern:"/v1/billing/disputes/:disputeId",pathParams:[{name:"disputeId",key:"disputeId"}],flags:[],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"Retrieve one dispute by id (RLS-scoped to the calling org)."},{key:"billing.dunning.getRecoveryStatus",commandPath:["billing","dunning","getRecoveryStatus"],opId:"GET /v1/billing/dunning/recovery-status",method:"GET",pattern:"/v1/billing/dunning/recovery-status",pathParams:[],flags:[],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"Get the calling org's dunning recovery status."},{key:"billing.dunning.listDelinquencies",commandPath:["billing","dunning","listDelinquencies"],opId:"GET /v1/billing/dunning",method:"GET",pattern:"/v1/billing/dunning",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0},{name:"state",coerce:null,optional:!0}],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"List the calling org's delinquency (dunning) records."},{key:"billing.feedListings.canSubscribeToListing",commandPath:["billing","feedListings","canSubscribeToListing"],opId:"GET /v1/billing/feed-listings/can-subscribe",method:"GET",pattern:"/v1/billing/feed-listings/can-subscribe",pathParams:[],flags:[{name:"listingGid",coerce:null,optional:!0}],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"Feed listing checkout."},{key:"billing.feedListings.getDefaultPaymentMethodPreview",commandPath:["billing","feedListings","getDefaultPaymentMethodPreview"],opId:"GET /v1/billing/feed-listings/default-payment-method-preview",method:"GET",pattern:"/v1/billing/feed-listings/default-payment-method-preview",pathParams:[],flags:[],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"Feed listing checkout."},{key:"billing.feedListings.subscribeToListing",commandPath:["billing","feedListings","subscribeToListing"],opId:"POST /v1/billing/feed-listings/subscribe",method:"POST",pattern:"/v1/billing/feed-listings/subscribe",pathParams:[],flags:[{name:"listingGid",coerce:null,optional:!1},{name:"listingName",coerce:null,optional:!1},{name:"publisherName",coerce:null,optional:!1},{name:"pricingModel",coerce:null,optional:!1},{name:"priceInCents",coerce:"number",optional:!1},{name:"trialDays",coerce:"number",optional:!0},{name:"tierName",coerce:null,optional:!0},{name:"billingCycle",coerce:null,optional:!0,choices:["monthly","yearly"]},{name:"revenueSplitBps",coerce:"number",optional:!0},{name:"buyerCountry",coerce:null,optional:!0},{name:"attemptKey",coerce:null,optional:!0},{name:"acceptedSubscriberAgreementVersion",coerce:null,optional:!0},{name:"acceptedListingLicenceVersion",coerce:null,optional:!0}],scopes:["billing:write"],idempotent:!1,isQuery:!1,summary:"Feed listing checkout."},{key:"billing.feedListings.subscribeToListingWithSavedCard",commandPath:["billing","feedListings","subscribeToListingWithSavedCard"],opId:"POST /v1/billing/feed-listings/subscribe-with-saved-card",method:"POST",pattern:"/v1/billing/feed-listings/subscribe-with-saved-card",pathParams:[],flags:[{name:"listingGid",coerce:null,optional:!1},{name:"listingName",coerce:null,optional:!1},{name:"publisherName",coerce:null,optional:!1},{name:"priceInCents",coerce:"number",optional:!1},{name:"billingCycle",coerce:null,optional:!0,choices:["monthly","yearly"]},{name:"tierName",coerce:null,optional:!0},{name:"revenueSplitBps",coerce:"number",optional:!0},{name:"trialDays",coerce:"number",optional:!0},{name:"buyerCountry",coerce:null,optional:!0},{name:"acceptedSubscriberAgreementVersion",coerce:null,optional:!0},{name:"acceptedListingLicenceVersion",coerce:null,optional:!0}],scopes:["billing:write"],idempotent:!1,isQuery:!1,summary:"Feed listing checkout."},{key:"billing.functions.listPlanCatalogue",commandPath:["billing","functions","listPlanCatalogue"],opId:"GET /v1/billing/plans/catalogue",method:"GET",pattern:"/v1/billing/plans/catalogue",pathParams:[],flags:[],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"List the plan catalogue (all tiers + pricing)."},{key:"billing.functions.listTierChangesForOrg",commandPath:["billing","functions","listTierChangesForOrg"],opId:"GET /v1/billing/plans/tier-changes",method:"GET",pattern:"/v1/billing/plans/tier-changes",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0}],scopes:["billing:read"],idempotent:!0,isQuery:!0,summary:"Recent tier changes for the calling org, newest first (limit \u2264 200, default 50)."},{key:"billing.functions.setBillingAddress",commandPath:["billing","functions","setBillingAddress"],opId:"PATCH /v1/billing/account/address",method:"PATCH",pattern:"/v1/billing/account/address",pathParams:[],flags:[{name:"line1",coerce:null,optional:!1},{name:"line2",coerce:null,optional:!0},{name:"city",coerce:null,optional:!1},{name:"region",coerce:null,optional:!1},{name:"postalCode",coerce:null,optional:!1},{name:"country",coerce:null,optional:!1}],scopes:["billing:write"],idempotent:!0,isQuery:!1,summary:"Set the calling org's billing address (Stripe Tax jurisdiction)."},{key:"billing.functions.updateBillingEmail",commandPath:["billing","functions","updateBillingEmail"],opId:"PATCH /v1/billing/account/email",method:"PATCH",pattern:"/v1/billing/account/email",pathParams:[],flags:[{name:"billingEmail",coerce:null,optional:!1}],scopes:["billing:write"],idempotent:!0,isQuery:!1,summary:"Update the calling org's billing email."},{key:"billing.invoices.getInvoicePdfUrl",commandPath:["billing","invoices","getInvoicePdfUrl"],opId:"GET /v1/billing/invoices/:invoiceId/pdf",method:"GET",pattern:"/v1/billing/invoices/:invoiceId/pdf",pathParams:[{name:"invoiceId",key:"invoiceId"}],flags:[],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"Get a short-lived PDF download URL for one invoice."},{key:"billing.invoices.listInvoices",commandPath:["billing","invoices","listInvoices"],opId:"GET /v1/billing/invoices",method:"GET",pattern:"/v1/billing/invoices",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0},{name:"startingAfter",coerce:null,optional:!0},{name:"createdAfter",coerce:"number",optional:!0},{name:"createdBefore",coerce:"number",optional:!0},{name:"status",coerce:null,optional:!0,choices:["paid","open","past_due","uncollectible","void","draft"]}],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"List the calling org's invoices (RLS-scoped)."},{key:"billing.invoices.retrieveInvoice",commandPath:["billing","invoices","retrieveInvoice"],opId:"GET /v1/billing/invoices/:invoiceId",method:"GET",pattern:"/v1/billing/invoices/:invoiceId",pathParams:[{name:"invoiceId",key:"invoiceId"}],flags:[],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"Retrieve one invoice by id (RLS-scoped to the calling org)."},{key:"billing.paymentMethods.attachPaymentMethod",commandPath:["billing","paymentMethods","attachPaymentMethod"],opId:"POST /v1/billing/payment-methods/attach",method:"POST",pattern:"/v1/billing/payment-methods/attach",pathParams:[],flags:[{name:"paymentMethodId",coerce:null,optional:!1},{name:"setAsDefault",coerce:"boolean",optional:!0}],scopes:["billing:write"],idempotent:!1,isQuery:!1,summary:"Attach a payment method to the calling org's customer."},{key:"billing.paymentMethods.detachPaymentMethod",commandPath:["billing","paymentMethods","detachPaymentMethod"],opId:"POST /v1/billing/payment-methods/detach",method:"POST",pattern:"/v1/billing/payment-methods/detach",pathParams:[],flags:[{name:"paymentMethodId",coerce:null,optional:!1},{name:"moveDefaultTo",coerce:null,optional:!0}],scopes:["billing:write"],idempotent:!1,isQuery:!1,summary:"Detach a payment method from the calling org's customer."},{key:"billing.paymentMethods.listPaymentMethods",commandPath:["billing","paymentMethods","listPaymentMethods"],opId:"GET /v1/billing/payment-methods",method:"GET",pattern:"/v1/billing/payment-methods",pathParams:[],flags:[],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"List the calling org's saved payment methods."},{key:"billing.paymentMethods.setDefaultPaymentMethod",commandPath:["billing","paymentMethods","setDefaultPaymentMethod"],opId:"POST /v1/billing/payment-methods/set-default",method:"POST",pattern:"/v1/billing/payment-methods/set-default",pathParams:[],flags:[{name:"paymentMethodId",coerce:null,optional:!1}],scopes:["billing:write"],idempotent:!1,isQuery:!1,summary:"Set the calling org's default payment method."},{key:"billing.payouts.getEarningsSummary",commandPath:["billing","payouts","getEarningsSummary"],opId:"GET /v1/billing/earnings/summary",method:"GET",pattern:"/v1/billing/earnings/summary",pathParams:[],flags:[{name:"sinceMs",coerce:"number",optional:!0}],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"Rollup over the publisher's payouts (sums + per-period breakdown)."},{key:"billing.payouts.getRevenueSummary",commandPath:["billing","payouts","getRevenueSummary"],opId:"GET /v1/billing/revenue/summary",method:"GET",pattern:"/v1/billing/revenue/summary",pathParams:[],flags:[{name:"sinceMs",coerce:"number",optional:!0}],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"Publisher revenue from the destination charges of its paid listings."},{key:"billing.payouts.list",commandPath:["billing","payouts","list"],opId:"GET /v1/feeds/payouts",method:"GET",pattern:"/v1/feeds/payouts",pathParams:[],flags:[{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"Your released payouts, newest first, and your balance as the billing service reads it: available, held back by the 14-day hold, and open debts beside them."},{key:"billing.payouts.listPayouts",commandPath:["billing","payouts","listPayouts"],opId:"GET /v1/billing/payouts",method:"GET",pattern:"/v1/billing/payouts",pathParams:[],flags:[{name:"sinceMs",coerce:"number",optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"List the calling publisher org's payout history (RLS-scoped)."},{key:"billing.revenue.customer",commandPath:["billing","revenue","customer"],opId:"GET /v1/feeds/revenue/customers/:subscriptionId",method:"GET",pattern:"/v1/feeds/revenue/customers/:subscriptionId",pathParams:[{name:"subscriptionGid",key:"subscriptionId"}],flags:[{name:"sinceMs",coerce:"number",optional:!0}],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"Revenue from one of your customers on its listing, summed from the payment ledger; failed and pending payments are never counted."},{key:"billing.revenue.listings",commandPath:["billing","revenue","listings"],opId:"GET /v1/feeds/revenue/listings",method:"GET",pattern:"/v1/feeds/revenue/listings",pathParams:[],flags:[{name:"sinceMs",coerce:"number",optional:!0}],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"Revenue per listing you publish, summed from the payment ledger; failed and pending payments are never counted."},{key:"billing.subscriptions.accountStatus",commandPath:["billing","subscriptions","accountStatus"],opId:"GET /v1/billing/account-status",method:"GET",pattern:"/v1/billing/account-status",pathParams:[],flags:[],scopes:["billing:read"],idempotent:!0,isQuery:!0,summary:"The calling org's plan/trial standing: tier, days left, and the upgrade pointer."},{key:"billing.subscriptions.applyTierChange",commandPath:["billing","subscriptions","applyTierChange"],opId:"POST /v1/billing/subscriptions/tier-change",method:"POST",pattern:"/v1/billing/subscriptions/tier-change",pathParams:[],flags:[{name:"newTier",coerce:null,optional:!1,choices:["signal","relay","mesh"]},{name:"newInterval",coerce:null,optional:!0,choices:["monthly","annual"]}],scopes:["billing:write"],idempotent:!1,isQuery:!1,summary:"Apply a tier/interval change to the calling org's subscription."},{key:"billing.subscriptions.cancelSubscription",commandPath:["billing","subscriptions","cancelSubscription"],opId:"POST /v1/billing/subscriptions/cancel",method:"POST",pattern:"/v1/billing/subscriptions/cancel",pathParams:[],flags:[{name:"immediate",coerce:"boolean",optional:!0}],scopes:["billing:write"],idempotent:!1,isQuery:!1,summary:"Cancel the calling org's subscription (at period end)."},{key:"billing.subscriptions.confirmSubscriptionPayment",commandPath:["billing","subscriptions","confirmSubscriptionPayment"],opId:"POST /v1/billing/subscriptions/confirm-payment",method:"POST",pattern:"/v1/billing/subscriptions/confirm-payment",pathParams:[],flags:[{name:"subscriptionId",coerce:null,optional:!1}],scopes:["billing:write"],idempotent:!0,isQuery:!1,summary:"Confirm the latest invoice payment after SCA / 3DS."},{key:"billing.subscriptions.createSetupIntent",commandPath:["billing","subscriptions","createSetupIntent"],opId:"POST /v1/billing/payment-methods/setup-intent",method:"POST",pattern:"/v1/billing/payment-methods/setup-intent",pathParams:[],flags:[],scopes:["billing:write"],idempotent:!1,isQuery:!1,summary:"Create a Stripe SetupIntent to collect a payment method."},{key:"billing.subscriptions.createSubscription",commandPath:["billing","subscriptions","createSubscription"],opId:"POST /v1/billing/subscriptions",method:"POST",pattern:"/v1/billing/subscriptions",pathParams:[],flags:[{name:"tier",coerce:null,optional:!1,choices:["signal","relay","mesh"]},{name:"interval",coerce:null,optional:!1,choices:["monthly","annual"]},{name:"paymentMethodId",coerce:null,optional:!0},{name:"trialDays",coerce:"number",optional:!0}],scopes:["billing:write"],idempotent:!1,isQuery:!1,summary:"Subscribe the calling org to a tier (default_incomplete)."},{key:"billing.subscriptions.listSubscriptions",commandPath:["billing","subscriptions","listSubscriptions"],opId:"GET /v1/billing/subscriptions",method:"GET",pattern:"/v1/billing/subscriptions",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0},{name:"status",coerce:null,optional:!0}],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"List the calling org's subscriptions (RLS-scoped)."},{key:"billing.subscriptions.previewTierChange",commandPath:["billing","subscriptions","previewTierChange"],opId:"POST /v1/billing/subscriptions/preview",method:"POST",pattern:"/v1/billing/subscriptions/preview",pathParams:[],flags:[{name:"newTier",coerce:null,optional:!1,choices:["signal","relay","mesh"]},{name:"newInterval",coerce:null,optional:!0,choices:["monthly","annual"]}],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"Preview proration for a tier/interval change."},{key:"billing.subscriptions.reactivateSubscription",commandPath:["billing","subscriptions","reactivateSubscription"],opId:"POST /v1/billing/subscriptions/reactivate",method:"POST",pattern:"/v1/billing/subscriptions/reactivate",pathParams:[],flags:[],scopes:["billing:write"],idempotent:!1,isQuery:!1,summary:"Reactivate a subscription scheduled to cancel at period end."},{key:"billing.subscriptions.retrieveSubscription",commandPath:["billing","subscriptions","retrieveSubscription"],opId:"GET /v1/billing/subscriptions/:subscriptionId",method:"GET",pattern:"/v1/billing/subscriptions/:subscriptionId",pathParams:[{name:"subscriptionId",key:"subscriptionId"}],flags:[],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"Retrieve one subscription by id (RLS-scoped to the calling org)."},{key:"billing.tax.previewTax",commandPath:["billing","tax","previewTax"],opId:"POST /v1/billing/tax/preview",method:"POST",pattern:"/v1/billing/tax/preview",pathParams:[],flags:[{name:"amountCents",coerce:"number",optional:!1},{name:"customer",coerce:"json",optional:!1},{name:"customerTaxIds",coerce:"json",optional:!0},{name:"tierReference",coerce:null,optional:!0}],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"Preview the tax Stripe Tax computes on an amount for a customer's location and tax ids."},{key:"billing.taxIds.addTaxId",commandPath:["billing","taxIds","addTaxId"],opId:"POST /v1/billing/tax-ids",method:"POST",pattern:"/v1/billing/tax-ids",pathParams:[],flags:[{name:"type",coerce:null,optional:!1},{name:"value",coerce:null,optional:!1}],scopes:["billing:write"],idempotent:!1,isQuery:!1,summary:"Add a tax ID to the calling org."},{key:"billing.taxIds.listTaxIds",commandPath:["billing","taxIds","listTaxIds"],opId:"GET /v1/billing/tax-ids",method:"GET",pattern:"/v1/billing/tax-ids",pathParams:[],flags:[],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"List the calling org's tax IDs (RLS-scoped)."},{key:"billing.taxIds.removeTaxId",commandPath:["billing","taxIds","removeTaxId"],opId:"DELETE /v1/billing/tax-ids/:taxIdId",method:"DELETE",pattern:"/v1/billing/tax-ids/:taxIdId",pathParams:[{name:"taxIdId",key:"taxIdId"}],flags:[],scopes:["billing:write"],idempotent:!1,isQuery:!1,summary:"Remove a tax ID from the calling org by id."},{key:"billing.testClocks.advanceTestClock",commandPath:["billing","testClocks","advanceTestClock"],opId:"POST /v1/billing/test-clock/advance",method:"POST",pattern:"/v1/billing/test-clock/advance",pathParams:[],flags:[{name:"frozenTime",coerce:"number",optional:!1}],scopes:["billing:write"],idempotent:!1,isQuery:!1,summary:"Advance the calling org's Stripe TEST clock to frozenTime (test environments only; refused in production)."},{key:"billing.usage.getQuotas",commandPath:["billing","usage","getQuotas"],opId:"GET /v1/billing/usage/quotas",method:"GET",pattern:"/v1/billing/usage/quotas",pathParams:[],flags:[],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"Per-tier snapshot quotas (limit / current / remaining) for the calling org."},{key:"billing.usage.getUsageSummary",commandPath:["billing","usage","getUsageSummary"],opId:"GET /v1/billing/usage/summary",method:"GET",pattern:"/v1/billing/usage/summary",pathParams:[],flags:[{name:"periodStart",coerce:"number",optional:!0},{name:"periodEnd",coerce:"number",optional:!0}],scopes:["billing:read"],idempotent:!0,isQuery:!1,summary:"Current-cycle usage summary for the calling org."},{key:"connect.connect.approveAccess",commandPath:["connect","connect","approveAccess"],opId:"POST /v1/connect/grants/:grantId/approve",method:"POST",pattern:"/v1/connect/grants/:grantId/approve",pathParams:[{name:"grantId",key:"grantId"}],flags:[{name:"rateLimit",coerce:"json",optional:!0},{name:"expiresAt",coerce:"number",optional:!0}],scopes:["grants:write"],idempotent:!1,isQuery:!1,summary:"Approve a pending access grant (publisher only)."},{key:"connect.connect.confirmBridge",commandPath:["connect","connect","confirmBridge"],opId:"POST /v1/connect/bridges/:bridgeGid/confirm",method:"POST",pattern:"/v1/connect/bridges/:bridgeGid/confirm",pathParams:[{name:"gid",key:"bridgeGid"}],flags:[],scopes:["bridges:write"],idempotent:!1,isQuery:!1,summary:"Confirm a pending identity bridge (target party)."},{key:"connect.connect.createBridge",commandPath:["connect","connect","createBridge"],opId:"POST /v1/connect/bridges",method:"POST",pattern:"/v1/connect/bridges",pathParams:[],flags:[{name:"targetOrgGID",coerce:null,optional:!1},{name:"entityTypeSlug",coerce:null,optional:!1}],scopes:["bridges:write"],idempotent:!1,isQuery:!1,summary:"Create an identity bridge (admin-first; caller org becomes source)."},{key:"connect.connect.initiateTenantApproval",commandPath:["connect","connect","initiateTenantApproval"],opId:"POST /v1/connect/tenant-approvals",method:"POST",pattern:"/v1/connect/tenant-approvals",pathParams:[],flags:[{name:"grantId",coerce:null,optional:!1},{name:"tenantId",coerce:null,optional:!1},{name:"tenantDisplayName",coerce:null,optional:!0},{name:"redirectUri",coerce:null,optional:!0},{name:"originFingerprint",coerce:null,optional:!0}],scopes:["tenant_approvals:write"],idempotent:!1,isQuery:!1,summary:"Initiate a tenant consent challenge (admin-first; PUBLISHER org, platform app only)."},{key:"connect.connect.listPartnerAppTenantApprovals",commandPath:["connect","connect","listPartnerAppTenantApprovals"],opId:"GET /v1/connect/partner/apps/:appId/tenant-approvals",method:"GET",pattern:"/v1/connect/partner/apps/:appId/tenant-approvals",pathParams:[{name:"targetAppId",key:"appId"}],flags:[{name:"status",coerce:null,optional:!0,choices:["active","revoked","frozen","delisted","expired"]},{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["partner:read"],idempotent:!0,isQuery:!0,summary:"List a partner-governed app's tenant approvals (read side)."},{key:"connect.connect.listPartnerGovernedApps",commandPath:["connect","connect","listPartnerGovernedApps"],opId:"GET /v1/connect/partner/apps",method:"GET",pattern:"/v1/connect/partner/apps",pathParams:[],flags:[{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["partner:read"],idempotent:!0,isQuery:!0,summary:"List the apps a Connect partner governs (read side of partner governance)."},{key:"connect.connect.listRevocationAudit",commandPath:["connect","connect","listRevocationAudit"],opId:"GET /v1/connect/grants/:grantId/audit",method:"GET",pattern:"/v1/connect/grants/:grantId/audit",pathParams:[{name:"grantId",key:"grantId"}],flags:[],scopes:["grants:read"],idempotent:!0,isQuery:!0,summary:"A grant's revocation audit entries \u2014 its own and its tenant approvals' \u2014 for either party (audit right, transparency right)."},{key:"connect.connect.partnerDelistApp",commandPath:["connect","connect","partnerDelistApp"],opId:"POST /v1/connect/partner/apps/:appId/delist",method:"POST",pattern:"/v1/connect/partner/apps/:appId/delist",pathParams:[{name:"targetAppId",key:"appId"}],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["partner:admin"],idempotent:!1,isQuery:!1,summary:"Delist a partner-governed app from the marketplace (platform operator)."},{key:"connect.connect.partnerFreezeApp",commandPath:["connect","connect","partnerFreezeApp"],opId:"POST /v1/connect/partner/apps/:appId/freeze",method:"POST",pattern:"/v1/connect/partner/apps/:appId/freeze",pathParams:[{name:"targetAppId",key:"appId"}],flags:[{name:"reason",coerce:null,optional:!1}],scopes:["partner:admin"],idempotent:!1,isQuery:!1,summary:"Freeze a partner-governed app (platform operator)."},{key:"connect.connect.partnerOverrideTenantApproval",commandPath:["connect","connect","partnerOverrideTenantApproval"],opId:"POST /v1/connect/partner/tenant-approvals/:approvalGid/override",method:"POST",pattern:"/v1/connect/partner/tenant-approvals/:approvalGid/override",pathParams:[{name:"targetTenantApprovalGid",key:"approvalGid"}],flags:[{name:"action",coerce:null,optional:!1,choices:["approve","revoke"]},{name:"reason",coerce:null,optional:!1}],scopes:["partner:admin"],idempotent:!1,isQuery:!1,summary:"Override a tenant approval decision (platform operator)."},{key:"connect.connect.partnerReinstateApp",commandPath:["connect","connect","partnerReinstateApp"],opId:"POST /v1/connect/partner/apps/:appId/reinstate",method:"POST",pattern:"/v1/connect/partner/apps/:appId/reinstate",pathParams:[{name:"targetAppId",key:"appId"}],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["partner:admin"],idempotent:!0,isQuery:!1,summary:"Reinstate a frozen partner-governed app (platform operator)."},{key:"connect.connect.rejectAccess",commandPath:["connect","connect","rejectAccess"],opId:"POST /v1/connect/grants/:grantId/reject",method:"POST",pattern:"/v1/connect/grants/:grantId/reject",pathParams:[{name:"grantId",key:"grantId"}],flags:[{name:"reason",coerce:null,optional:!1}],scopes:["grants:write"],idempotent:!1,isQuery:!1,summary:"Reject a pending access grant (publisher only)."},{key:"connect.connect.requestAccess",commandPath:["connect","connect","requestAccess"],opId:"POST /v1/connect/grants",method:"POST",pattern:"/v1/connect/grants",pathParams:[],flags:[{name:"publisherAppId",coerce:null,optional:!1},{name:"publisherOrgId",coerce:null,optional:!0},{name:"eventTypes",coerce:"json",optional:!1},{name:"purpose",coerce:null,optional:!0},{name:"estimatedVolume",coerce:null,optional:!0},{name:"subscriberAppId",coerce:null,optional:!1},{name:"rateLimit",coerce:"json",optional:!0},{name:"scope",coerce:"json",optional:!0}],scopes:["grants:write"],idempotent:!1,isQuery:!1,summary:"Request access to a publisher app's events (creates a pending grant)."},{key:"connect.connect.revokeGrant",commandPath:["connect","connect","revokeGrant"],opId:"POST /v1/connect/grants/:grantId/revoke",method:"POST",pattern:"/v1/connect/grants/:grantId/revoke",pathParams:[{name:"grantId",key:"grantId"}],flags:[{name:"reasonText",coerce:null,optional:!0},{name:"source",coerce:null,optional:!0,choices:["dashboard","api","webhook"]},{name:"requestContext",coerce:"json",optional:!0}],scopes:["grants:write"],idempotent:!1,isQuery:!1,summary:"Revoke an active or pending access grant (either party)."},{key:"connect.connect.revokeTenantApproval",commandPath:["connect","connect","revokeTenantApproval"],opId:"POST /v1/connect/tenant-approvals/:approvalGid/revoke",method:"POST",pattern:"/v1/connect/tenant-approvals/:approvalGid/revoke",pathParams:[{name:"approvalId",key:"approvalGid"}],flags:[{name:"reasonText",coerce:null,optional:!0},{name:"source",coerce:null,optional:!0,choices:["dashboard","api","webhook"]},{name:"requestContext",coerce:"json",optional:!0}],scopes:["tenant_approvals:write"],idempotent:!1,isQuery:!1,summary:"Revoke an active tenant approval (admin-first)."},{key:"connect.connect.updateAppProfile",commandPath:["connect","connect","updateAppProfile"],opId:"PATCH /v1/connect/profile/:appId",method:"PATCH",pattern:"/v1/connect/profile/:appId",pathParams:[{name:"appId",key:"appId"}],flags:[{name:"connectVisibility",coerce:null,optional:!0,choices:["public","listed","unlisted","private"]},{name:"connectDescription",coerce:null,optional:!0},{name:"publishedEventTypes",coerce:"json",optional:!0},{name:"platformSlug",coerce:null,optional:!0},{name:"complianceBadges",coerce:"json",optional:!0},{name:"supportContact",coerce:"json",optional:!0}],scopes:["profile:write"],idempotent:!1,isQuery:!1,summary:"Update the caller org's own app connect profile (admin-first)."},{key:"connect.identityBridges.archiveBridge",commandPath:["connect","identityBridges","archiveBridge"],opId:"POST /v1/connect/bridges/:bridgeGid/archive",method:"POST",pattern:"/v1/connect/bridges/:bridgeGid/archive",pathParams:[{name:"gid",key:"bridgeGid"}],flags:[],scopes:["connect:write"],idempotent:!1,isQuery:!1,summary:"Archive an identity bridge (irreversible; revokes derived consent + grant)."},{key:"connect.identityBridges.suspendBridge",commandPath:["connect","identityBridges","suspendBridge"],opId:"POST /v1/connect/bridges/:bridgeGid/suspend",method:"POST",pattern:"/v1/connect/bridges/:bridgeGid/suspend",pathParams:[{name:"gid",key:"bridgeGid"}],flags:[],scopes:["bridges:write"],idempotent:!1,isQuery:!1,summary:"Suspend an active identity bridge (temporary pause)."},{key:"connect.publishGrants.create",commandPath:["connect","publishGrants","create"],opId:"POST /v1/connect/publish-grants",method:"POST",pattern:"/v1/connect/publish-grants",pathParams:[],flags:[{name:"channelId",coerce:null,optional:!1},{name:"producerAppId",coerce:null,optional:!1},{name:"expiresAt",coerce:"number",optional:!0}],scopes:["connect:write"],idempotent:!0,isQuery:!1,summary:"Grant one producer app of another organization the right to publish to one of your channels."},{key:"connect.publishGrants.list",commandPath:["connect","publishGrants","list"],opId:"GET /v1/connect/publish-grants",method:"GET",pattern:"/v1/connect/publish-grants",pathParams:[],flags:[{name:"direction",coerce:null,optional:!1,choices:["granted","held"]},{name:"status",coerce:null,optional:!0},{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["connect:read"],idempotent:!0,isQuery:!0,summary:"List the publish grants your organization granted or holds."},{key:"connect.publishGrants.pause",commandPath:["connect","publishGrants","pause"],opId:"POST /v1/connect/publish-grants/:id/pause",method:"POST",pattern:"/v1/connect/publish-grants/:id/pause",pathParams:[{name:"id",key:"id"}],flags:[],scopes:["connect:write"],idempotent:!1,isQuery:!1,summary:"Pause a publish grant you issued (reversible)."},{key:"connect.publishGrants.resume",commandPath:["connect","publishGrants","resume"],opId:"POST /v1/connect/publish-grants/:id/resume",method:"POST",pattern:"/v1/connect/publish-grants/:id/resume",pathParams:[{name:"id",key:"id"}],flags:[],scopes:["connect:write"],idempotent:!1,isQuery:!1,summary:"Resume a paused publish grant you issued."},{key:"connect.publishGrants.retrieve",commandPath:["connect","publishGrants","retrieve"],opId:"GET /v1/connect/publish-grants/:id",method:"GET",pattern:"/v1/connect/publish-grants/:id",pathParams:[{name:"id",key:"id"}],flags:[],scopes:["connect:read"],idempotent:!0,isQuery:!0,summary:"Retrieve one publish grant you are a party of."},{key:"connect.publishGrants.revoke",commandPath:["connect","publishGrants","revoke"],opId:"POST /v1/connect/publish-grants/:id/revoke",method:"POST",pattern:"/v1/connect/publish-grants/:id/revoke",pathParams:[{name:"id",key:"id"}],flags:[],scopes:["connect:write"],idempotent:!1,isQuery:!1,summary:"Revoke a publish grant (terminal) \u2014 the channel owner revokes, the producer renounces."},{key:"embed.origins.list",commandPath:["embed","origins","list"],opId:"GET /v1/embed/origins",method:"GET",pattern:"/v1/embed/origins",pathParams:[],flags:[{name:"appGID",coerce:null,optional:!1},{name:"envId",coerce:null,optional:!1}],scopes:["embed:read"],idempotent:!0,isQuery:!0,summary:"List an app/env's registered embed origins."},{key:"embed.origins.set",commandPath:["embed","origins","set"],opId:"PUT /v1/embed/origins",method:"PUT",pattern:"/v1/embed/origins",pathParams:[],flags:[{name:"appGID",coerce:null,optional:!1},{name:"envId",coerce:null,optional:!1},{name:"allowedOrigins",coerce:"json",optional:!1}],scopes:["embed:write"],idempotent:!0,isQuery:!1,summary:"Replace an app/env's embed origin allowlist (owner-scoped)."},{key:"embed.sessions.create",commandPath:["embed","sessions","create"],opId:"POST /v1/embed/sessions",method:"POST",pattern:"/v1/embed/sessions",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"envId",coerce:null,optional:!0},{name:"tenantId",coerce:null,optional:!1},{name:"features",coerce:"json",optional:!0},{name:"components",coerce:"json",optional:!0},{name:"mode",coerce:null,optional:!0,choices:["custom","isolated"]},{name:"permissions",coerce:"json",optional:!0},{name:"expiresInSeconds",coerce:"number",optional:!0},{name:"returnUrl",coerce:null,optional:!0},{name:"attestedSubject",coerce:null,optional:!0}],scopes:["embed:write"],idempotent:!1,isQuery:!1,summary:"Mint an embed session for a browser component (tenant-attenuated)."},{key:"embed.sessions.revoke",commandPath:["embed","sessions","revoke"],opId:"POST /v1/embed/sessions/:sessionGid/revoke",method:"POST",pattern:"/v1/embed/sessions/:sessionGid/revoke",pathParams:[{name:"sessionGid",key:"sessionGid"}],flags:[],scopes:["embed:write"],idempotent:!0,isQuery:!1,summary:"Revoke an embed session \u2014 a subsequent edge exchange fails closed."},{key:"feed.listings.archive",commandPath:["feed","listings","archive"],opId:"DELETE /v1/feeds/listings/:listingId",method:"DELETE",pattern:"/v1/feeds/listings/:listingId",pathParams:[{name:"listingGid",key:"listingId"}],flags:[],scopes:["listings:write"],idempotent:!0,isQuery:!1,summary:"Archive a listing and cancel its subscriptions at once."},{key:"feed.listings.canCreateListing",commandPath:["feed","listings","canCreateListing"],opId:"GET /v1/feeds/publisher-eligibility",method:"GET",pattern:"/v1/feeds/publisher-eligibility",pathParams:[],flags:[],scopes:["listings:read"],idempotent:!0,isQuery:!0,summary:"Check whether the calling org may create listings (production-app gate)."},{key:"feed.listings.create",commandPath:["feed","listings","create"],opId:"POST /v1/feeds/listings",method:"POST",pattern:"/v1/feeds/listings",pathParams:[],flags:[{name:"publisherGid",coerce:null,optional:!1},{name:"channelGid",coerce:null,optional:!1},{name:"cellId",coerce:null,optional:!1},{name:"name",coerce:null,optional:!1},{name:"slug",coerce:null,optional:!1},{name:"description",coerce:null,optional:!1},{name:"shortDescription",coerce:null,optional:!0},{name:"iconStorageId",coerce:null,optional:!0},{name:"bannerStorageId",coerce:null,optional:!0},{name:"documentationUrl",coerce:null,optional:!0},{name:"samplePayload",coerce:null,optional:!0},{name:"category",coerce:null,optional:!1},{name:"tags",coerce:"json",optional:!1},{name:"pricing",coerce:"json",optional:!1},{name:"visibility",coerce:null,optional:!0,choices:["public","unlisted","private"]},{name:"environment",coerce:null,optional:!0,choices:["sandbox","production"]},{name:"licence",coerce:"json",optional:!0}],scopes:["listings:write"],idempotent:!1,isQuery:!1,summary:"Create a draft listing in the canonical catalog."},{key:"feed.listings.generateUploadUrl",commandPath:["feed","listings","generateUploadUrl"],opId:"POST /v1/feeds/listings/upload-url",method:"POST",pattern:"/v1/feeds/listings/upload-url",pathParams:[],flags:[],scopes:["listings:write"],idempotent:!1,isQuery:!1,summary:"Mint a single-use upload URL for a listing icon or banner."},{key:"feed.listings.getByGid",commandPath:["feed","listings","getByGid"],opId:"GET /v1/feeds/listings/:listingId",method:"GET",pattern:"/v1/feeds/listings/:listingId",pathParams:[{name:"gid",key:"listingId"}],flags:[],scopes:["listings:read"],idempotent:!0,isQuery:!0,summary:"Get a single listing by its global id."},{key:"feed.listings.getBySlug",commandPath:["feed","listings","getBySlug"],opId:"GET /v1/feeds/publishers/:publisherSlug/listings/:listingSlug",method:"GET",pattern:"/v1/feeds/publishers/:publisherSlug/listings/:listingSlug",pathParams:[{name:"publisherSlug",key:"publisherSlug"},{name:"listingSlug",key:"listingSlug"}],flags:[],scopes:["listings:read"],idempotent:!0,isQuery:!0,summary:"Get a single listing by its publisher-namespaced slug."},{key:"feed.listings.listByPublisherWire",commandPath:["feed","listings","listByPublisherWire"],opId:"GET /v1/feeds/publishers/:publisherId/listings",method:"GET",pattern:"/v1/feeds/publishers/:publisherId/listings",pathParams:[{name:"publisherGid",key:"publisherId"}],flags:[{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["listings:read"],idempotent:!0,isQuery:!0,summary:"List a publisher's own listings (any status) as a bounded page \u2014 { page, isDone, continueCursor }; limit (default 50, cap 200) + cursor. RLS-scoped to the caller org."},{key:"feed.listings.listEligibleListingChannelApps",commandPath:["feed","listings","listEligibleListingChannelApps"],opId:"GET /v1/feeds/listing-eligible-apps",method:"GET",pattern:"/v1/feeds/listing-eligible-apps",pathParams:[],flags:[],scopes:["listings:read"],idempotent:!0,isQuery:!0,summary:"App GIDs eligible to back a feed listing (have both sandbox + production envs)."},{key:"feed.listings.listPublished",commandPath:["feed","listings","listPublished"],opId:"GET /v1/feeds/listings",method:"GET",pattern:"/v1/feeds/listings",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0},{name:"domain",coerce:null,optional:!0},{name:"category",coerce:null,optional:!0},{name:"priceTier",coerce:null,optional:!0,choices:["free","flat_rate","usage_based","tiered"]},{name:"query",coerce:null,optional:!0},{name:"environment",coerce:null,optional:!0,choices:["sandbox","production"]}],scopes:["listings:read"],idempotent:!0,isQuery:!0,summary:"List published, public listings in the global catalog."},{key:"feed.listings.publish",commandPath:["feed","listings","publish"],opId:"POST /v1/feeds/listings/:listingId/publish",method:"POST",pattern:"/v1/feeds/listings/:listingId/publish",pathParams:[{name:"listingGid",key:"listingId"}],flags:[],scopes:["listings:write"],idempotent:!0,isQuery:!1,summary:"Publish an approved listing to the marketplace."},{key:"feed.listings.resolveByRef",commandPath:["feed","listings","resolveByRef"],opId:"GET /v1/feeds/resolve/:publisherSlug/:listingSlug",method:"GET",pattern:"/v1/feeds/resolve/:publisherSlug/:listingSlug",pathParams:[{name:"publisherSlug",key:"publisherSlug"},{name:"listingSlug",key:"listingSlug"}],flags:[],scopes:["listings:read"],idempotent:!0,isQuery:!0,summary:"Resolve a feed listing by its reference <publisherSlug>/<listingSlug> \u2014 gid, store facts, pricing and the two acceptance versions in one read."},{key:"feed.listings.submitForReview",commandPath:["feed","listings","submitForReview"],opId:"POST /v1/feeds/listings/:listingId/submit",method:"POST",pattern:"/v1/feeds/listings/:listingId/submit",pathParams:[{name:"listingGid",key:"listingId"}],flags:[{name:"acceptedOwnershipDeclarationVersion",coerce:null,optional:!0}],scopes:["listings:write"],idempotent:!0,isQuery:!1,summary:"Submit a draft listing for marketplace review."},{key:"feed.listings.unpublish",commandPath:["feed","listings","unpublish"],opId:"POST /v1/feeds/listings/:listingId/unpublish",method:"POST",pattern:"/v1/feeds/listings/:listingId/unpublish",pathParams:[{name:"listingGid",key:"listingId"}],flags:[],scopes:["listings:write"],idempotent:!0,isQuery:!1,summary:"Take a live listing off the marketplace back to draft."},{key:"feed.listings.update",commandPath:["feed","listings","update"],opId:"POST /v1/feeds/listings/:listingId",method:"POST",pattern:"/v1/feeds/listings/:listingId",pathParams:[{name:"listingGid",key:"listingId"}],flags:[{name:"name",coerce:null,optional:!0},{name:"description",coerce:null,optional:!0},{name:"shortDescription",coerce:null,optional:!0},{name:"iconStorageId",coerce:null,optional:!0},{name:"bannerStorageId",coerce:null,optional:!0},{name:"documentationUrl",coerce:null,optional:!0},{name:"samplePayload",coerce:null,optional:!0},{name:"sla",coerce:"json",optional:!0},{name:"category",coerce:null,optional:!0},{name:"tags",coerce:"json",optional:!0},{name:"visibility",coerce:null,optional:!0,choices:["public","unlisted","private"]},{name:"licence",coerce:"json",optional:!0}],scopes:["listings:write"],idempotent:!1,isQuery:!1,summary:"Update mutable fields of a draft or published listing."},{key:"feed.listings.updatePricing",commandPath:["feed","listings","updatePricing"],opId:"POST /v1/feeds/listings/:listingId/pricing",method:"POST",pattern:"/v1/feeds/listings/:listingId/pricing",pathParams:[{name:"listingGid",key:"listingId"}],flags:[{name:"pricing",coerce:"json",optional:!1}],scopes:["listings:write"],idempotent:!1,isQuery:!1,summary:"Update the pricing of a draft listing."},{key:"feed.listings.withdrawSubmission",commandPath:["feed","listings","withdrawSubmission"],opId:"POST /v1/feeds/listings/:listingId/withdraw",method:"POST",pattern:"/v1/feeds/listings/:listingId/withdraw",pathParams:[{name:"listingGid",key:"listingId"}],flags:[],scopes:["listings:write"],idempotent:!0,isQuery:!1,summary:"Withdraw a listing from review back to draft."},{key:"feed.publishers.getByGid",commandPath:["feed","publishers","getByGid"],opId:"GET /v1/feeds/publishers/:publisherId",method:"GET",pattern:"/v1/feeds/publishers/:publisherId",pathParams:[{name:"gid",key:"publisherId"}],flags:[],scopes:["publishers:read"],idempotent:!0,isQuery:!0,summary:"Get a publisher by its global id."},{key:"feed.publishers.getBySlug",commandPath:["feed","publishers","getBySlug"],opId:"GET /v1/feeds/publishers/by-slug/:slug",method:"GET",pattern:"/v1/feeds/publishers/by-slug/:slug",pathParams:[{name:"slug",key:"slug"}],flags:[],scopes:["publishers:read"],idempotent:!0,isQuery:!0,summary:"Get a publisher by its slug."},{key:"feed.publishers.getMine",commandPath:["feed","publishers","getMine"],opId:"GET /v1/feeds/publishers/me",method:"GET",pattern:"/v1/feeds/publishers/me",pathParams:[],flags:[],scopes:["publishers:read"],idempotent:!0,isQuery:!0,summary:"Resolve the publisher row for the calling org."},{key:"feed.publishers.listVerified",commandPath:["feed","publishers","listVerified"],opId:"GET /v1/feeds/publishers",method:"GET",pattern:"/v1/feeds/publishers",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0}],scopes:["publishers:read"],idempotent:!0,isQuery:!0,summary:"List all verified publishers in the catalog."},{key:"feed.publishers.register",commandPath:["feed","publishers","register"],opId:"POST /v1/feeds/publishers",method:"POST",pattern:"/v1/feeds/publishers",pathParams:[],flags:[{name:"name",coerce:null,optional:!1},{name:"slug",coerce:null,optional:!1},{name:"description",coerce:null,optional:!0},{name:"websiteUrl",coerce:null,optional:!0},{name:"supportEmail",coerce:null,optional:!0},{name:"supportUrl",coerce:null,optional:!0},{name:"logoUrl",coerce:null,optional:!0},{name:"acceptedAgreementVersion",coerce:null,optional:!0}],scopes:["publishers:write"],idempotent:!1,isQuery:!1,summary:"Register a publisher for the calling org."},{key:"feed.publishers.revokePublisher",commandPath:["feed","publishers","revokePublisher"],opId:"POST /v1/feeds/publishers/:publisherId/revoke",method:"POST",pattern:"/v1/feeds/publishers/:publisherId/revoke",pathParams:[{name:"publisherGid",key:"publisherId"}],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["publishers:write"],idempotent:!0,isQuery:!1,summary:"Owner-initiated revoke of a publisher and its listings."},{key:"feed.publishers.update",commandPath:["feed","publishers","update"],opId:"POST /v1/feeds/publishers/:publisherId",method:"POST",pattern:"/v1/feeds/publishers/:publisherId",pathParams:[{name:"publisherGid",key:"publisherId"}],flags:[{name:"name",coerce:null,optional:!0},{name:"description",coerce:null,optional:!0},{name:"websiteUrl",coerce:null,optional:!0},{name:"supportEmail",coerce:null,optional:!0},{name:"supportUrl",coerce:null,optional:!0},{name:"logoUrl",coerce:null,optional:!0},{name:"defaultRevenueSplit",coerce:"number",optional:!0},{name:"payoutDestination",coerce:null,optional:!0},{name:"taxProfile",coerce:"json",optional:!0},{name:"notificationPreferences",coerce:"json",optional:!0}],scopes:["publishers:write"],idempotent:!1,isQuery:!1,summary:"Update a publisher's mutable identity fields (owner-only)."},{key:"feed.subscriptions.cancel",commandPath:["feed","subscriptions","cancel"],opId:"DELETE /v1/feeds/subscriptions/:subscriptionId",method:"DELETE",pattern:"/v1/feeds/subscriptions/:subscriptionId",pathParams:[{name:"gid",key:"subscriptionId"}],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["feed:write"],idempotent:!0,isQuery:!1,summary:"Cancel a feed subscription."},{key:"feed.subscriptions.convertTrialToPaid",commandPath:["feed","subscriptions","convertTrialToPaid"],opId:"POST /v1/feeds/subscriptions/:subscriptionId/convert-to-paid",method:"POST",pattern:"/v1/feeds/subscriptions/:subscriptionId/convert-to-paid",pathParams:[{name:"gid",key:"subscriptionId"}],flags:[{name:"productionEnvGid",coerce:null,optional:!0}],scopes:["feed:write"],idempotent:!0,isQuery:!1,summary:"Convert a $0 trial subscription to a paid production subscription."},{key:"feed.subscriptions.countByPublisher",commandPath:["feed","subscriptions","countByPublisher"],opId:"GET /v1/feeds/publishers/:publisherId/subscriber-count",method:"GET",pattern:"/v1/feeds/publishers/:publisherId/subscriber-count",pathParams:[{name:"publisherGid",key:"publisherId"}],flags:[],scopes:["feed:read"],idempotent:!0,isQuery:!0,summary:"Count active/total subscribers for a publisher (RLS-scoped)."},{key:"feed.subscriptions.getByGid",commandPath:["feed","subscriptions","getByGid"],opId:"GET /v1/feeds/subscriptions/:subscriptionId",method:"GET",pattern:"/v1/feeds/subscriptions/:subscriptionId",pathParams:[{name:"gid",key:"subscriptionId"}],flags:[],scopes:["feed:read"],idempotent:!0,isQuery:!0,summary:"Fetch one feed subscription by id (RLS-scoped to the caller org)."},{key:"feed.subscriptions.listBySubscriber",commandPath:["feed","subscriptions","listBySubscriber"],opId:"GET /v1/feeds/subscriptions",method:"GET",pattern:"/v1/feeds/subscriptions",pathParams:[],flags:[{name:"status",coerce:null,optional:!0}],scopes:["feed:read"],idempotent:!0,isQuery:!0,summary:"List the calling org's feed subscriptions."},{key:"feed.subscriptions.listBySubscriberEnriched",commandPath:["feed","subscriptions","listBySubscriberEnriched"],opId:"GET /v1/feeds/subscriptions/enriched",method:"GET",pattern:"/v1/feeds/subscriptions/enriched",pathParams:[],flags:[],scopes:["feed:read"],idempotent:!0,isQuery:!0,summary:"List the calling org's feed subscriptions with listing + publisher enrichment joined (single aggregate)."},{key:"feed.subscriptions.pause",commandPath:["feed","subscriptions","pause"],opId:"POST /v1/feeds/subscriptions/:subscriptionId/pause",method:"POST",pattern:"/v1/feeds/subscriptions/:subscriptionId/pause",pathParams:[{name:"gid",key:"subscriptionId"}],flags:[],scopes:["feed:write"],idempotent:!0,isQuery:!1,summary:"Pause an active feed subscription."},{key:"feed.subscriptions.resume",commandPath:["feed","subscriptions","resume"],opId:"POST /v1/feeds/subscriptions/:subscriptionId/resume",method:"POST",pattern:"/v1/feeds/subscriptions/:subscriptionId/resume",pathParams:[{name:"gid",key:"subscriptionId"}],flags:[],scopes:["feed:write"],idempotent:!0,isQuery:!1,summary:"Resume a paused feed subscription."},{key:"feed.subscriptions.subscribe",commandPath:["feed","subscriptions","subscribe"],opId:"POST /v1/feeds/listings/:listingId/subscribe",method:"POST",pattern:"/v1/feeds/listings/:listingId/subscribe",pathParams:[{name:"listingGid",key:"listingId"}],flags:[{name:"targetAppGids",coerce:"json",optional:!1},{name:"billingCycle",coerce:null,optional:!0,choices:["monthly","yearly"]},{name:"tierName",coerce:null,optional:!0},{name:"acceptedSubscriberAgreementVersion",coerce:null,optional:!0},{name:"acceptedListingLicenceVersion",coerce:null,optional:!0}],scopes:["feed:write"],idempotent:!1,isQuery:!1,summary:"Subscribe the calling org to a published listing."},{key:"notify.dispatches.list",commandPath:["notify","dispatches","list"],opId:"GET /v1/notifications/dispatches",method:"GET",pattern:"/v1/notifications/dispatches",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"status",coerce:null,optional:!0,choices:["queued","sending","sent","failed","dlq"]},{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["notify:read"],idempotent:!0,isQuery:!1,summary:"List the calling org's notification dispatch history (RLS-scoped)."},{key:"notify.inbox.archive",commandPath:["notify","inbox","archive"],opId:"POST /v1/notifications/inbox/:gid/archive",method:"POST",pattern:"/v1/notifications/inbox/:gid/archive",pathParams:[{name:"gid",key:"gid"}],flags:[{name:"appId",coerce:null,optional:!1},{name:"user",coerce:null,optional:!1}],scopes:["notify:write"],idempotent:!0,isQuery:!1,summary:"Archive one inbox notification (dashboard parity write)."},{key:"notify.inbox.list",commandPath:["notify","inbox","list"],opId:"GET /v1/notifications/inbox",method:"GET",pattern:"/v1/notifications/inbox",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"user",coerce:null,optional:!1},{name:"status",coerce:null,optional:!0,choices:["unread","read","archived"]},{name:"cursor",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["notify:read"],idempotent:!0,isQuery:!1,summary:"List the calling org's notification inbox (paginated, RLS-scoped)."},{key:"notify.inbox.markAllRead",commandPath:["notify","inbox","markAllRead"],opId:"POST /v1/notifications/inbox/mark-all-read",method:"POST",pattern:"/v1/notifications/inbox/mark-all-read",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"user",coerce:null,optional:!1}],scopes:["notify:write"],idempotent:!0,isQuery:!1,summary:"Mark ALL unread inbox notifications read for one recipient (dashboard parity write)."},{key:"notify.inbox.markRead",commandPath:["notify","inbox","markRead"],opId:"POST /v1/notifications/inbox/:gid/mark-read",method:"POST",pattern:"/v1/notifications/inbox/:gid/mark-read",pathParams:[{name:"gid",key:"gid"}],flags:[{name:"appId",coerce:null,optional:!1},{name:"user",coerce:null,optional:!1}],scopes:["notify:write"],idempotent:!0,isQuery:!1,summary:"Mark one inbox notification read (dashboard bell/inbox parity write)."},{key:"notify.preferences.clear",commandPath:["notify","preferences","clear"],opId:"DELETE /v1/notifications/preferences",method:"DELETE",pattern:"/v1/notifications/preferences",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"user",coerce:null,optional:!1},{name:"typeSlug",coerce:null,optional:!0},{name:"channel",coerce:null,optional:!0,choices:["email","sms","push","inapp","slack"]}],scopes:["notify:write"],idempotent:!0,isQuery:!1,summary:"Clear one notification preference row back to defaults."},{key:"notify.preferences.list",commandPath:["notify","preferences","list"],opId:"GET /v1/notifications/preferences",method:"GET",pattern:"/v1/notifications/preferences",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"user",coerce:null,optional:!1}],scopes:["notify:read"],idempotent:!0,isQuery:!1,summary:"List the calling org's notification preferences (RLS-scoped)."},{key:"notify.preferences.setDigestCadence",commandPath:["notify","preferences","setDigestCadence"],opId:"PUT /v1/notifications/preferences/digest",method:"PUT",pattern:"/v1/notifications/preferences/digest",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"user",coerce:null,optional:!1},{name:"channel",coerce:null,optional:!1,choices:["email","sms","push","inapp","slack"]},{name:"cadence",coerce:null,optional:!0,choices:["hourly","daily"]}],scopes:["notify:write"],idempotent:!0,isQuery:!1,summary:"Set (or clear, by omitting cadence) the per-channel digest cadence."},{key:"notify.preferences.setGlobalMute",commandPath:["notify","preferences","setGlobalMute"],opId:"PUT /v1/notifications/preferences/global-mute",method:"PUT",pattern:"/v1/notifications/preferences/global-mute",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"user",coerce:null,optional:!1},{name:"globalMute",coerce:"boolean",optional:!1}],scopes:["notify:write"],idempotent:!0,isQuery:!1,summary:"Set the recipient's global mute (the dashboard's master enable/disable + unsubscribe-all)."},{key:"notify.preferences.setQuietHours",commandPath:["notify","preferences","setQuietHours"],opId:"PUT /v1/notifications/preferences/quiet-hours",method:"PUT",pattern:"/v1/notifications/preferences/quiet-hours",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"user",coerce:null,optional:!1},{name:"startHour",coerce:"number",optional:!0},{name:"endHour",coerce:"number",optional:!0}],scopes:["notify:write"],idempotent:!0,isQuery:!1,summary:"Set (or clear, by omitting both hours) the recipient's quiet-hours window."},{key:"notify.preferences.upsert",commandPath:["notify","preferences","upsert"],opId:"PUT /v1/notifications/preferences",method:"PUT",pattern:"/v1/notifications/preferences",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"user",coerce:null,optional:!1},{name:"typeSlug",coerce:null,optional:!0},{name:"channel",coerce:null,optional:!0,choices:["email","sms","push","inapp","slack"]},{name:"optIn",coerce:"boolean",optional:!1}],scopes:["notify:write"],idempotent:!0,isQuery:!1,summary:"Upsert one notification preference row (per-type / per-channel opt-in)."},{key:"notify.summary.get",commandPath:["notify","summary","get"],opId:"GET /v1/notifications/summary",method:"GET",pattern:"/v1/notifications/summary",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"user",coerce:null,optional:!1}],scopes:["notify:read"],idempotent:!0,isQuery:!1,summary:"Get the calling org's unread notification count (RLS-scoped)."},{key:"notify.templates.create",commandPath:["notify","templates","create"],opId:"POST /v1/notifications/templates",method:"POST",pattern:"/v1/notifications/templates",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"typeSlug",coerce:null,optional:!1},{name:"locale",coerce:null,optional:!1},{name:"channel",coerce:null,optional:!1,choices:["email","sms","push","inapp","slack"]},{name:"version",coerce:"number",optional:!1},{name:"subject",coerce:null,optional:!0},{name:"previewText",coerce:null,optional:!0},{name:"bodyMarkdown",coerce:null,optional:!1}],scopes:["notify:write"],idempotent:!0,isQuery:!1,summary:"Create a notification template for the org/app (wording only: subject, preview text, markdown body)."},{key:"notify.templates.get",commandPath:["notify","templates","get"],opId:"GET /v1/notifications/templates/:gid",method:"GET",pattern:"/v1/notifications/templates/:gid",pathParams:[{name:"gid",key:"gid"}],flags:[{name:"appId",coerce:null,optional:!1}],scopes:["notify:read"],idempotent:!0,isQuery:!1,summary:"Get one notification template by gid (RLS-scoped)."},{key:"notify.templates.list",commandPath:["notify","templates","list"],opId:"GET /v1/notifications/templates",method:"GET",pattern:"/v1/notifications/templates",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"typeSlug",coerce:null,optional:!0},{name:"includeRetired",coerce:"boolean",optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["notify:read"],idempotent:!0,isQuery:!1,summary:"List the calling org/app's notification templates (RLS-scoped)."},{key:"notify.templates.preview",commandPath:["notify","templates","preview"],opId:"POST /v1/notifications/templates/preview",method:"POST",pattern:"/v1/notifications/templates/preview",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"typeSlug",coerce:null,optional:!1},{name:"channel",coerce:null,optional:!1,choices:["email","sms","push","inapp","slack"]},{name:"locale",coerce:null,optional:!0},{name:"vars",coerce:"json",optional:!1},{name:"catalogDefaultLocale",coerce:null,optional:!0}],scopes:["notify:read"],idempotent:!0,isQuery:!1,summary:"Render the template the dispatcher would pick for a type/channel/locale, without sending."},{key:"notify.templates.retire",commandPath:["notify","templates","retire"],opId:"POST /v1/notifications/templates/:gid/retire",method:"POST",pattern:"/v1/notifications/templates/:gid/retire",pathParams:[{name:"gid",key:"gid"}],flags:[{name:"appId",coerce:null,optional:!1}],scopes:["notify:write"],idempotent:!0,isQuery:!1,summary:"Retire (archive) one notification template."},{key:"notify.templates.sendTest",commandPath:["notify","templates","sendTest"],opId:"POST /v1/notifications/templates/:gid/test-send",method:"POST",pattern:"/v1/notifications/templates/:gid/test-send",pathParams:[{name:"gid",key:"gid"}],flags:[{name:"appId",coerce:null,optional:!1},{name:"channel",coerce:null,optional:!0}],scopes:["notify:read","notify:write"],idempotent:!0,isQuery:!1,summary:"Send a test of one notification template to the calling principal: one in-app inbox row and one dispatch record, both tagged test (real render, never the resolver)."},{key:"notify.templates.update",commandPath:["notify","templates","update"],opId:"PATCH /v1/notifications/templates/:gid",method:"PATCH",pattern:"/v1/notifications/templates/:gid",pathParams:[{name:"gid",key:"gid"}],flags:[{name:"appId",coerce:null,optional:!1},{name:"subject",coerce:null,optional:!0},{name:"previewText",coerce:null,optional:!0},{name:"bodyMarkdown",coerce:null,optional:!0}],scopes:["notify:write"],idempotent:!0,isQuery:!1,summary:"Update one notification template's wording (subject, preview text, markdown body)."},{key:"notify.types.get",commandPath:["notify","types","get"],opId:"GET /v1/notifications/types/:typeSlug",method:"GET",pattern:"/v1/notifications/types/:typeSlug",pathParams:[{name:"typeSlug",key:"typeSlug"}],flags:[{name:"appId",coerce:null,optional:!1},{name:"version",coerce:"number",optional:!0}],scopes:["notify:read"],idempotent:!0,isQuery:!1,summary:"Get one notification type by slug (latest active, or an exact version)."},{key:"notify.types.list",commandPath:["notify","types","list"],opId:"GET /v1/notifications/types",method:"GET",pattern:"/v1/notifications/types",pathParams:[],flags:[{name:"appId",coerce:null,optional:!1},{name:"limit",coerce:"number",optional:!0}],scopes:["notify:read"],idempotent:!0,isQuery:!1,summary:"List the calling org's notification type catalog (RLS-scoped)."},{key:"tenants.actAs.actAs",commandPath:["tenants","actAs","actAs"],opId:"POST /v1/tenants/act-as",method:"POST",pattern:"/v1/tenants/act-as",pathParams:[],flags:[{name:"externalId",coerce:null,optional:!1},{name:"scopes",coerce:"json",optional:!0}],scopes:["tenants:write"],idempotent:!1,isQuery:!1,summary:"Exchange the caller's credential for a short-lived, DPoP-bound, tenant-pinned token."},{key:"tenants.tenants.activate",commandPath:["tenants","tenants","activate"],opId:"POST /v1/tenants/:tenantId/activate",method:"POST",pattern:"/v1/tenants/:tenantId/activate",pathParams:[{name:"tenantId",key:"tenantId"}],flags:[],scopes:["tenants:write"],idempotent:!0,isQuery:!1,summary:"Activate a tenant \u2014 promotes pending/suspended to active (mint-eligible)."},{key:"tenants.tenants.close",commandPath:["tenants","tenants","close"],opId:"POST /v1/tenants/:tenantId/close",method:"POST",pattern:"/v1/tenants/:tenantId/close",pathParams:[{name:"tenantId",key:"tenantId"}],flags:[],scopes:["tenants:admin"],idempotent:!0,isQuery:!1,summary:"Close a tenant (terminal), revoke every live embed session, and answer only once every Primus engine that may serve its tokens holds the close."},{key:"tenants.tenants.list",commandPath:["tenants","tenants","list"],opId:"GET /v1/tenants",method:"GET",pattern:"/v1/tenants",pathParams:[],flags:[{name:"platformId",coerce:null,optional:!0},{name:"status",coerce:null,optional:!0,choices:["pending","active","suspended","closed","inactive"]}],scopes:["tenants:read"],idempotent:!0,isQuery:!0,summary:"List the calling org's platform tenants (optionally by platform/status)."},{key:"tenants.tenants.suspend",commandPath:["tenants","tenants","suspend"],opId:"POST /v1/tenants/:tenantId/suspend",method:"POST",pattern:"/v1/tenants/:tenantId/suspend",pathParams:[{name:"tenantId",key:"tenantId"}],flags:[],scopes:["tenants:write"],idempotent:!0,isQuery:!1,summary:"Suspend a tenant \u2014 revokes its Primus/embed minting and every live embed session."},{key:"tenants.tenants.upsert",commandPath:["tenants","tenants","upsert"],opId:"POST /v1/tenants",method:"POST",pattern:"/v1/tenants",pathParams:[],flags:[{name:"externalId",coerce:null,optional:!1},{name:"displayName",coerce:null,optional:!0},{name:"metadata",coerce:"json",optional:!0}],scopes:["tenants:write"],idempotent:!0,isQuery:!1,summary:"Create or update (idempotent) a platform tenant on the natural key; the platform is the caller's own (derived from the app binding), never an input."}]}});var KT,QT=P(()=>{"use strict";KT={contentHash:"dd2a9247fa0edc80d2fdf343b2be91752bdf95c3d183cb5cb5a15c1b0702b40d",generatedAt:"contract-dd2a9247fa0edc80d2fdf343b2be91752bdf95c3d183cb5cb5a15c1b0702b40d",commands:[{key:"pipes.agentExecutions.getAgentExecution",commandPath:["pipes","agentExecutions","getAgentExecution"],opId:"GET /v1/pipes/agent-executions/:agentExecutionGid",method:"GET",pattern:"/v1/pipes/agent-executions/:agentExecutionGid",pathParams:[{name:"agentExecutionGid",key:"agentExecutionGid"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single agent-driven workflow execution by GID."},{key:"pipes.agentExecutions.listAgentExecutions",commandPath:["pipes","agentExecutions","listAgentExecutions"],opId:"GET /v1/pipes/agent-executions",method:"GET",pattern:"/v1/pipes/agent-executions",pathParams:[],flags:[{name:"workflowGid",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List agent-driven workflow executions (optional workflow filter)."},{key:"pipes.analyses.getAnalysis",commandPath:["pipes","analyses","getAnalysis"],opId:"GET /v1/pipes/analyses/:analysisGid",method:"GET",pattern:"/v1/pipes/analyses/:analysisGid",pathParams:[{name:"analysisGid",key:"analysisGid"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single Analyze-stage analysis by GID."},{key:"pipes.analyses.listAnalyses",commandPath:["pipes","analyses","listAnalyses"],opId:"GET /v1/pipes/analyses",method:"GET",pattern:"/v1/pipes/analyses",pathParams:[],flags:[{name:"workflowGid",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List Analyze-stage analyses (optional workflow filter)."},{key:"pipes.connectors.deleteCredential",commandPath:["pipes","connectors","deleteCredential"],opId:"DELETE /v1/pipes/credentials/:credentialId",method:"DELETE",pattern:"/v1/pipes/credentials/:credentialId",pathParams:[{name:"credentialGid",key:"credentialId"}],flags:[],scopes:["credentials:admin"],idempotent:!0,isQuery:!1,summary:"Delete a connector credential. DESTRUCTIVE: requires the admin verb."},{key:"pipes.connectors.listCredentials",commandPath:["pipes","connectors","listCredentials"],opId:"GET /v1/pipes/credentials",method:"GET",pattern:"/v1/pipes/credentials",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["credentials:read"],idempotent:!1,isQuery:!0,summary:"List stored credentials (metadata only \u2014 never the secret)."},{key:"pipes.connectors.revokeCredential",commandPath:["pipes","connectors","revokeCredential"],opId:"POST /v1/pipes/credentials/:credentialId/revoke",method:"POST",pattern:"/v1/pipes/credentials/:credentialId/revoke",pathParams:[{name:"credentialGid",key:"credentialId"}],flags:[],scopes:["credentials:admin"],idempotent:!0,isQuery:!1,summary:"Revoke a credential (Zapier-style: unusable, secret unretrievable). DESTRUCTIVE: requires the admin verb."},{key:"pipes.connectors.rotateCredential",commandPath:["pipes","connectors","rotateCredential"],opId:"POST /v1/pipes/credentials/:credentialId/rotate",method:"POST",pattern:"/v1/pipes/credentials/:credentialId/rotate",pathParams:[{name:"credentialGid",key:"credentialId"}],flags:[{name:"newSecret",coerce:null,optional:!1}],scopes:["credentials:write"],idempotent:!0,isQuery:!1,summary:"Rotate a credential's secret (vault re-encrypt)."},{key:"pipes.connectors.storeCredential",commandPath:["pipes","connectors","storeCredential"],opId:"POST /v1/pipes/credentials",method:"POST",pattern:"/v1/pipes/credentials",pathParams:[],flags:[{name:"connectorId",coerce:null,optional:!1},{name:"name",coerce:null,optional:!1},{name:"auth",coerce:"json",optional:!1},{name:"secret",coerce:null,optional:!0}],scopes:["credentials:write"],idempotent:!0,isQuery:!1,summary:"Store a connector credential (vault-encrypted secret)."},{key:"pipes.connectors.testCredentialPublic",commandPath:["pipes","connectors","testCredentialPublic"],opId:"POST /v1/pipes/credentials/test",method:"POST",pattern:"/v1/pipes/credentials/test",pathParams:[],flags:[{name:"connectorId",coerce:null,optional:!1},{name:"apiKey",coerce:null,optional:!1}],scopes:["credentials:write"],idempotent:!1,isQuery:!1,summary:"Test a connector credential (connectorId + apiKey in body)."},{key:"pipes.connectors.updateCredential",commandPath:["pipes","connectors","updateCredential"],opId:"PATCH /v1/pipes/credentials/:credentialId",method:"PATCH",pattern:"/v1/pipes/credentials/:credentialId",pathParams:[{name:"credentialGid",key:"credentialId"}],flags:[{name:"name",coerce:null,optional:!0},{name:"auth",coerce:"json",optional:!0}],scopes:["credentials:write"],idempotent:!1,isQuery:!1,summary:"Update credential metadata/auth (no secret rotation here)."},{key:"pipes.decisions.approveDecision",commandPath:["pipes","decisions","approveDecision"],opId:"POST /v1/pipes/decisions/:decisionGid/approve",method:"POST",pattern:"/v1/pipes/decisions/:decisionGid/approve",pathParams:[{name:"decisionGid",key:"decisionGid"}],flags:[{name:"rationale",coerce:null,optional:!0}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Approve a pending AI decision (idempotent \u2014 first actor preserved)."},{key:"pipes.decisions.getDecision",commandPath:["pipes","decisions","getDecision"],opId:"GET /v1/pipes/decisions/:decisionGid",method:"GET",pattern:"/v1/pipes/decisions/:decisionGid",pathParams:[{name:"decisionGid",key:"decisionGid"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single AI decision checkpoint by GID."},{key:"pipes.decisions.listDecisions",commandPath:["pipes","decisions","listDecisions"],opId:"GET /v1/pipes/decisions",method:"GET",pattern:"/v1/pipes/decisions",pathParams:[],flags:[{name:"gateState",coerce:null,optional:!0,choices:["auto-approved","pending-human-approval","approved","rejected","expired"]},{name:"workflowGid",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List AI decision checkpoints (optional gateState/workflow filter)."},{key:"pipes.decisions.rejectDecision",commandPath:["pipes","decisions","rejectDecision"],opId:"POST /v1/pipes/decisions/:decisionGid/reject",method:"POST",pattern:"/v1/pipes/decisions/:decisionGid/reject",pathParams:[{name:"decisionGid",key:"decisionGid"}],flags:[{name:"rationale",coerce:null,optional:!0}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Reject a pending AI decision (idempotent)."},{key:"pipes.dlq.discardDlqEntry",commandPath:["pipes","dlq","discardDlqEntry"],opId:"POST /v1/pipes/dlq/:dlqEntryId/discard",method:"POST",pattern:"/v1/pipes/dlq/:dlqEntryId/discard",pathParams:[{name:"dlqEntryId",key:"dlqEntryId"}],flags:[],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Discard an execution DLQ entry (idempotent \u2014 already-discarded is a no-op)."},{key:"pipes.dlq.getDlqEntry",commandPath:["pipes","dlq","getDlqEntry"],opId:"GET /v1/pipes/dlq/:dlqEntryId",method:"GET",pattern:"/v1/pipes/dlq/:dlqEntryId",pathParams:[{name:"dlqEntryId",key:"dlqEntryId"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single execution DLQ entry by id (RLS-scoped), or 404."},{key:"pipes.dlq.getDlqStats",commandPath:["pipes","dlq","getDlqStats"],opId:"GET /v1/pipes/dlq/stats",method:"GET",pattern:"/v1/pipes/dlq/stats",pathParams:[],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Aggregate execution DLQ stats (counts by status) for the caller's app."},{key:"pipes.dlq.listDlqEntries",commandPath:["pipes","dlq","listDlqEntries"],opId:"GET /v1/pipes/dlq",method:"GET",pattern:"/v1/pipes/dlq",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["pending","retrying","resolved","discarded","exhausted"]},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List execution DLQ entries for the caller's app (optional status filter)."},{key:"pipes.executions.cancelExecution",commandPath:["pipes","executions","cancelExecution"],opId:"POST /v1/pipes/executions/:executionId/cancel",method:"POST",pattern:"/v1/pipes/executions/:executionId/cancel",pathParams:[{name:"executionGid",key:"executionId"}],flags:[],scopes:["pipes:execute"],idempotent:!0,isQuery:!1,summary:"Cancel a running execution."},{key:"pipes.executions.executeNode",commandPath:["pipes","executions","executeNode"],opId:"POST /v1/pipes/workflows/:workflowId/nodes/:nodeId/execute",method:"POST",pattern:"/v1/pipes/workflows/:workflowId/nodes/:nodeId/execute",pathParams:[{name:"workflowGid",key:"workflowId"},{name:"nodeId",key:"nodeId"}],flags:[{name:"triggerData",coerce:"json",optional:!0},{name:"upstreamOutputs",coerce:"json",optional:!0},{name:"variables",coerce:"json",optional:!0},{name:"idempotencyKey",coerce:null,optional:!0}],scopes:["pipes:execute"],idempotent:!1,isQuery:!1,summary:"Execute a single workflow node in isolation (editor test-node)."},{key:"pipes.executions.getExecution",commandPath:["pipes","executions","getExecution"],opId:"GET /v1/pipes/executions/:executionId",method:"GET",pattern:"/v1/pipes/executions/:executionId",pathParams:[{name:"executionGid",key:"executionId"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single execution by GID (RLS-scoped), or 404."},{key:"pipes.executions.getExecutionRate",commandPath:["pipes","executions","getExecutionRate"],opId:"GET /v1/pipes/executions/rate",method:"GET",pattern:"/v1/pipes/executions/rate",pathParams:[],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Runs per second over the last 24 hours for the caller's app and environment, with one point per hour."},{key:"pipes.executions.getExecutionStatus",commandPath:["pipes","executions","getExecutionStatus"],opId:"GET /v1/pipes/executions/:executionId/status",method:"GET",pattern:"/v1/pipes/executions/:executionId/status",pathParams:[{name:"executionGid",key:"executionId"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve an execution's status + per-node progress."},{key:"pipes.executions.listExecutions",commandPath:["pipes","executions","listExecutions"],opId:"GET /v1/pipes/workflows/:workflowId/executions",method:"GET",pattern:"/v1/pipes/workflows/:workflowId/executions",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[{name:"status",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List executions for a workflow (RLS-scoped run history)."},{key:"pipes.executions.triggerExecution",commandPath:["pipes","executions","triggerExecution"],opId:"POST /v1/pipes/workflows/:workflowId/trigger",method:"POST",pattern:"/v1/pipes/workflows/:workflowId/trigger",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[{name:"triggeredBy",coerce:null,optional:!0},{name:"triggerData",coerce:"json",optional:!0},{name:"idempotencyKey",coerce:null,optional:!0}],scopes:["pipes:execute"],idempotent:!0,isQuery:!1,summary:"Trigger a workflow execution (manual run)."},{key:"pipes.governance.addToAllowlist",commandPath:["pipes","governance","addToAllowlist"],opId:"POST /v1/pipes/governance/allowlist",method:"POST",pattern:"/v1/pipes/governance/allowlist",pathParams:[],flags:[{name:"connectorIds",coerce:"json",optional:!1}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Add connector ids to the governance allowlist."},{key:"pipes.governance.addToBlocklist",commandPath:["pipes","governance","addToBlocklist"],opId:"POST /v1/pipes/governance/blocklist",method:"POST",pattern:"/v1/pipes/governance/blocklist",pathParams:[],flags:[{name:"connectorIds",coerce:"json",optional:!1}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Add connector ids to the governance blocklist."},{key:"pipes.governance.approveConnectorRequest",commandPath:["pipes","governance","approveConnectorRequest"],opId:"POST /v1/pipes/governance/approvals/:requestId/approve",method:"POST",pattern:"/v1/pipes/governance/approvals/:requestId/approve",pathParams:[{name:"requestId",key:"requestId"}],flags:[{name:"notes",coerce:null,optional:!0}],scopes:["pipes:admin"],idempotent:!1,isQuery:!1,summary:"Approve a connector approval request."},{key:"pipes.governance.getAgentReviewRules",commandPath:["pipes","governance","getAgentReviewRules"],opId:"GET /v1/pipes/governance/agent-review",method:"GET",pattern:"/v1/pipes/governance/agent-review",pathParams:[],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Get the scopes in which a person must review the pipes agents make (none by default)."},{key:"pipes.governance.getGovernanceSettings",commandPath:["pipes","governance","getGovernanceSettings"],opId:"GET /v1/pipes/governance",method:"GET",pattern:"/v1/pipes/governance",pathParams:[],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Get connector governance settings (mode, allow/block lists, restrictions)."},{key:"pipes.governance.listApprovalRequests",commandPath:["pipes","governance","listApprovalRequests"],opId:"GET /v1/pipes/governance/approvals",method:"GET",pattern:"/v1/pipes/governance/approvals",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["pending","approved","rejected","revoked"]},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List connector approval requests (optional status filter)."},{key:"pipes.governance.listGovernanceAuditLogs",commandPath:["pipes","governance","listGovernanceAuditLogs"],opId:"GET /v1/pipes/governance/audit",method:"GET",pattern:"/v1/pipes/governance/audit",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0},{name:"eventType",coerce:null,optional:!0},{name:"targetType",coerce:null,optional:!0},{name:"targetId",coerce:null,optional:!0},{name:"actorId",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List governance audit logs (optional filters)."},{key:"pipes.governance.listPendingApprovals",commandPath:["pipes","governance","listPendingApprovals"],opId:"GET /v1/pipes/governance/approvals/pending",method:"GET",pattern:"/v1/pipes/governance/approvals/pending",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List pending connector approval requests."},{key:"pipes.governance.rejectConnectorRequest",commandPath:["pipes","governance","rejectConnectorRequest"],opId:"POST /v1/pipes/governance/approvals/:requestId/reject",method:"POST",pattern:"/v1/pipes/governance/approvals/:requestId/reject",pathParams:[{name:"requestId",key:"requestId"}],flags:[{name:"notes",coerce:null,optional:!0}],scopes:["pipes:admin"],idempotent:!1,isQuery:!1,summary:"Reject a connector approval request."},{key:"pipes.governance.removeFromAllowlist",commandPath:["pipes","governance","removeFromAllowlist"],opId:"DELETE /v1/pipes/governance/allowlist",method:"DELETE",pattern:"/v1/pipes/governance/allowlist",pathParams:[],flags:[{name:"connectorIds",coerce:"json",optional:!1}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Remove connector ids from the governance allowlist."},{key:"pipes.governance.removeFromBlocklist",commandPath:["pipes","governance","removeFromBlocklist"],opId:"DELETE /v1/pipes/governance/blocklist",method:"DELETE",pattern:"/v1/pipes/governance/blocklist",pathParams:[],flags:[{name:"connectorIds",coerce:"json",optional:!1}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Remove connector ids from the governance blocklist."},{key:"pipes.governance.requestConnectorApproval",commandPath:["pipes","governance","requestConnectorApproval"],opId:"POST /v1/pipes/governance/approvals",method:"POST",pattern:"/v1/pipes/governance/approvals",pathParams:[],flags:[{name:"connectorGid",coerce:null,optional:!1},{name:"reason",coerce:null,optional:!0}],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Request approval to use a connector."},{key:"pipes.governance.revokeConnectorApproval",commandPath:["pipes","governance","revokeConnectorApproval"],opId:"POST /v1/pipes/governance/connectors/:connectorGid/revoke",method:"POST",pattern:"/v1/pipes/governance/connectors/:connectorGid/revoke",pathParams:[{name:"connectorGid",key:"connectorGid"}],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["pipes:admin"],idempotent:!0,isQuery:!1,summary:"Revoke a previously approved connector."},{key:"pipes.governance.setAgentReviewRules",commandPath:["pipes","governance","setAgentReviewRules"],opId:"PUT /v1/pipes/governance/agent-review",method:"PUT",pattern:"/v1/pipes/governance/agent-review",pathParams:[],flags:[{name:"rules",coerce:"json",optional:!1}],scopes:["pipes:admin"],idempotent:!0,isQuery:!1,summary:"Set the scopes in which a person must review the pipes agents make (organization admin)."},{key:"pipes.governance.updateGovernanceSettings",commandPath:["pipes","governance","updateGovernanceSettings"],opId:"PATCH /v1/pipes/governance",method:"PATCH",pattern:"/v1/pipes/governance",pathParams:[],flags:[{name:"mode",coerce:null,optional:!0,choices:["open","allowlist","approval_required"]},{name:"allowedConnectors",coerce:"json",optional:!0},{name:"blockedConnectors",coerce:"json",optional:!0},{name:"allowedTiers",coerce:"json",optional:!0},{name:"allowedCategories",coerce:"json",optional:!0},{name:"requireFirstUseApproval",coerce:"boolean",optional:!0},{name:"autoApproveInternalConnectors",coerce:"boolean",optional:!0},{name:"maxCredentialsPerConnector",coerce:"number",optional:!0},{name:"auditConfig",coerce:"json",optional:!0}],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Update connector governance settings (mode, restrictions, audit config)."},{key:"pipes.recordDlq.discardRecordDlqEntry",commandPath:["pipes","recordDlq","discardRecordDlqEntry"],opId:"POST /v1/pipes/record-dlq/:entryGid/discard",method:"POST",pattern:"/v1/pipes/record-dlq/:entryGid/discard",pathParams:[{name:"entryGid",key:"entryGid"}],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Discard a record-DLQ entry (idempotent \u2014 preserves first discardedBy/discardedAt)."},{key:"pipes.recordDlq.getRecordDlqEntry",commandPath:["pipes","recordDlq","getRecordDlqEntry"],opId:"GET /v1/pipes/record-dlq/:entryGid",method:"GET",pattern:"/v1/pipes/record-dlq/:entryGid",pathParams:[{name:"entryGid",key:"entryGid"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single record-DLQ entry by GID (RLS-scoped), or 404."},{key:"pipes.recordDlq.getRecordDlqStats",commandPath:["pipes","recordDlq","getRecordDlqStats"],opId:"GET /v1/pipes/record-dlq/stats",method:"GET",pattern:"/v1/pipes/record-dlq/stats",pathParams:[],flags:[{name:"workflowGid",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Aggregate record-DLQ stats (counts by status) for the caller's app."},{key:"pipes.recordDlq.listRecordDlq",commandPath:["pipes","recordDlq","listRecordDlq"],opId:"GET /v1/pipes/record-dlq",method:"GET",pattern:"/v1/pipes/record-dlq",pathParams:[],flags:[{name:"workflowGid",coerce:null,optional:!0},{name:"status",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List record-level DLQ entries for the caller's app (optional workflow/status filter)."},{key:"pipes.recordDlq.replayRecordDlqEntry",commandPath:["pipes","recordDlq","replayRecordDlqEntry"],opId:"POST /v1/pipes/record-dlq/:entryGid/replay",method:"POST",pattern:"/v1/pipes/record-dlq/:entryGid/replay",pathParams:[{name:"entryGid",key:"entryGid"}],flags:[],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Replay a record-DLQ entry (re-run the failed record)."},{key:"pipes.tools.getTool",commandPath:["pipes","tools","getTool"],opId:"GET /v1/pipes/tools/:toolName",method:"GET",pattern:"/v1/pipes/tools/:toolName",pathParams:[{name:"toolName",key:"toolName"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single Tool Registry entry by tool name."},{key:"pipes.tools.listTools",commandPath:["pipes","tools","listTools"],opId:"GET /v1/pipes/tools",method:"GET",pattern:"/v1/pipes/tools",pathParams:[],flags:[{name:"stage",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List Tool Registry entries (optional stage filter)."},{key:"pipes.watermarks.getWatermark",commandPath:["pipes","watermarks","getWatermark"],opId:"GET /v1/pipes/watermarks/:sourceId",method:"GET",pattern:"/v1/pipes/watermarks/:sourceId",pathParams:[{name:"sourceId",key:"sourceId"}],flags:[{name:"workflowGid",coerce:null,optional:!1}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve the incremental-extract watermark cursor for a source."},{key:"pipes.watermarks.listWatermarks",commandPath:["pipes","watermarks","listWatermarks"],opId:"GET /v1/pipes/watermarks",method:"GET",pattern:"/v1/pipes/watermarks",pathParams:[],flags:[{name:"workflowGid",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List watermark cursors (optional workflow filter)."},{key:"pipes.watermarks.resetWatermark",commandPath:["pipes","watermarks","resetWatermark"],opId:"POST /v1/pipes/watermarks/:watermarkGid/reset",method:"POST",pattern:"/v1/pipes/watermarks/:watermarkGid/reset",pathParams:[{name:"watermarkGid",key:"watermarkGid"}],flags:[{name:"newValue",coerce:null,optional:!0},{name:"reason",coerce:null,optional:!0}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Reset a watermark cursor (idempotent \u2014 prior audit chain preserved)."},{key:"pipes.webhooks.getTriggerUrl",commandPath:["pipes","webhooks","getTriggerUrl"],opId:"GET /v1/pipes/webhook-triggers/:workflowId",method:"GET",pattern:"/v1/pipes/webhook-triggers/:workflowId",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Get the trigger URL, HMAC secret, and config for a webhook workflow."},{key:"pipes.webhooks.listWebhookWorkflows",commandPath:["pipes","webhooks","listWebhookWorkflows"],opId:"GET /v1/pipes/webhook-triggers",method:"GET",pattern:"/v1/pipes/webhook-triggers",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List webhook-triggered workflows for the caller's app."},{key:"pipes.webhooks.rotateWebhookSecret",commandPath:["pipes","webhooks","rotateWebhookSecret"],opId:"POST /v1/pipes/webhook-triggers/:workflowId/rotate-secret",method:"POST",pattern:"/v1/pipes/webhook-triggers/:workflowId/rotate-secret",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Rotate a webhook workflow's HMAC secret (returns the new secret)."},{key:"pipes.workflows.activateWorkflow",commandPath:["pipes","workflows","activateWorkflow"],opId:"POST /v1/pipes/workflows/:workflowId/activate",method:"POST",pattern:"/v1/pipes/workflows/:workflowId/activate",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Activate a paused or draft workflow."},{key:"pipes.workflows.archiveWorkflow",commandPath:["pipes","workflows","archiveWorkflow"],opId:"POST /v1/pipes/workflows/:workflowId/archive",method:"POST",pattern:"/v1/pipes/workflows/:workflowId/archive",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Archive a workflow (pause-then-archive if active)."},{key:"pipes.workflows.createWorkflow",commandPath:["pipes","workflows","createWorkflow"],opId:"POST /v1/pipes/workflows",method:"POST",pattern:"/v1/pipes/workflows",pathParams:[],flags:[{name:"name",coerce:null,optional:!1},{name:"description",coerce:null,optional:!0},{name:"definition",coerce:null,optional:!1},{name:"triggerConfig",coerce:null,optional:!1},{name:"requestReview",coerce:"boolean",optional:!0}],scopes:["pipes:write"],idempotent:!0,isQuery:!1,summary:"Create a Pipes workflow in an app."},{key:"pipes.workflows.deleteWorkflow",commandPath:["pipes","workflows","deleteWorkflow"],opId:"DELETE /v1/pipes/workflows/:workflowId",method:"DELETE",pattern:"/v1/pipes/workflows/:workflowId",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[],scopes:["pipes:admin"],idempotent:!0,isQuery:!1,summary:"Delete a workflow (RLS-scoped). DESTRUCTIVE: requires the admin verb."},{key:"pipes.workflows.getWorkflow",commandPath:["pipes","workflows","getWorkflow"],opId:"GET /v1/pipes/workflows/:workflowId",method:"GET",pattern:"/v1/pipes/workflows/:workflowId",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a single workflow by GID (RLS-scoped), or 404."},{key:"pipes.workflows.getWorkflowDefinitionSchema",commandPath:["pipes","workflows","getWorkflowDefinitionSchema"],opId:"GET /v1/pipes/workflow-definitions/schema",method:"GET",pattern:"/v1/pipes/workflow-definitions/schema",pathParams:[],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Get the pipe-definition JSON Schema every create and update is validated against."},{key:"pipes.workflows.getWorkflowTriggerConfig",commandPath:["pipes","workflows","getWorkflowTriggerConfig"],opId:"GET /v1/pipes/workflows/:workflowId/trigger-config",method:"GET",pattern:"/v1/pipes/workflows/:workflowId/trigger-config",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a workflow's trigger configuration ({ type, config }) as the workflow's read answers it (RLS-scoped), or 404."},{key:"pipes.workflows.listConnectors",commandPath:["pipes","workflows","listConnectors"],opId:"GET /v1/pipes/connectors",method:"GET",pattern:"/v1/pipes/connectors",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List the connectors available to the caller's app (v1 allowlist)."},{key:"pipes.workflows.listWorkflows",commandPath:["pipes","workflows","listWorkflows"],opId:"GET /v1/pipes/workflows",method:"GET",pattern:"/v1/pipes/workflows",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"List workflows for the caller's app (RLS-scoped)."},{key:"pipes.workflows.pauseWorkflow",commandPath:["pipes","workflows","pauseWorkflow"],opId:"POST /v1/pipes/workflows/:workflowId/pause",method:"POST",pattern:"/v1/pipes/workflows/:workflowId/pause",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Pause an active workflow."},{key:"pipes.workflows.updateWorkflow",commandPath:["pipes","workflows","updateWorkflow"],opId:"PATCH /v1/pipes/workflows/:workflowId",method:"PATCH",pattern:"/v1/pipes/workflows/:workflowId",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[{name:"definition",coerce:null,optional:!1}],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Update a workflow definition (nodes/edges); bumps the version."},{key:"pipes.workflows.updateWorkflowMeta",commandPath:["pipes","workflows","updateWorkflowMeta"],opId:"PATCH /v1/pipes/workflows/:workflowId/meta",method:"PATCH",pattern:"/v1/pipes/workflows/:workflowId/meta",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[{name:"name",coerce:null,optional:!0},{name:"description",coerce:null,optional:!0}],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Update workflow metadata only (name, description)."},{key:"pipes.workflows.updateWorkflowTriggerConfig",commandPath:["pipes","workflows","updateWorkflowTriggerConfig"],opId:"PATCH /v1/pipes/workflows/:workflowId/trigger-config",method:"PATCH",pattern:"/v1/pipes/workflows/:workflowId/trigger-config",pathParams:[{name:"workflowGid",key:"workflowId"}],flags:[{name:"triggerConfig",coerce:null,optional:!1}],scopes:["pipes:write"],idempotent:!1,isQuery:!1,summary:"Update a workflow's trigger configuration."},{key:"pipes.workflows.validateWorkflowDefinition",commandPath:["pipes","workflows","validateWorkflowDefinition"],opId:"POST /v1/pipes/workflows/validate",method:"POST",pattern:"/v1/pipes/workflows/validate",pathParams:[],flags:[{name:"definition",coerce:null,optional:!1},{name:"triggerConfig",coerce:null,optional:!0}],scopes:["pipes:read"],idempotent:!1,isQuery:!0,summary:"Validate a pipe definition and trigger config without saving anything; an invalid one answers 400 PIPE_DEFINITION_INVALID with every reason."}]}});var VT=pC(Yl=>{"use strict";Object.defineProperty(Yl,"__esModule",{value:!0});Yl.CLI_COMMANDS=void 0;Yl.CLI_COMMANDS={contentHash:"ecf3a148496a6e2d270fbbfea654a04cc5e5b0024ba7654387d6526157dc78d1",generatedAt:"contract-ecf3a148496a6e2d270fbbfea654a04cc5e5b0024ba7654387d6526157dc78d1",commands:[{key:"primus.actions.send",commandPath:["primus","actions","send"],opId:"POST /v1/primus/conversations/:conversationId/send",method:"POST",pattern:"/v1/primus/conversations/:conversationId/send",pathParams:[{name:"conversationGid",key:"conversationId"}],flags:[{name:"content",coerce:null,optional:!1}],scopes:["conversations:write"],idempotent:!0,isQuery:!1,summary:"Send a user message into a conversation over the customer edge."},{key:"primus.actions.testFire",commandPath:["primus","actions","testFire"],opId:"POST /v1/primus/triggers/:triggerId/test-fire",method:"POST",pattern:"/v1/primus/triggers/:triggerId/test-fire",pathParams:[{name:"triggerGid",key:"triggerId"}],flags:[],scopes:["triggers:write"],idempotent:!0,isQuery:!1,summary:"Test-fire a trigger over the customer edge."},{key:"primus.agentGoals.create",commandPath:["primus","agentGoals","create"],opId:"POST /v1/primus/agent-goals",method:"POST",pattern:"/v1/primus/agent-goals",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"name",coerce:null,optional:!1},{name:"description",coerce:null,optional:!1},{name:"priority",coerce:null,optional:!1,choices:["critical","high","medium","low"]},{name:"type",coerce:null,optional:!1,choices:["standing","milestone","recurring"]},{name:"schedule",coerce:null,optional:!0},{name:"milestones",coerce:"json",optional:!0},{name:"constraints",coerce:"json",optional:!0},{name:"boundaries",coerce:"json",optional:!0}],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Create an agent goal over the customer edge."},{key:"primus.agentGoals.list",commandPath:["primus","agentGoals","list"],opId:"GET /v1/primus/agent-goals",method:"GET",pattern:"/v1/primus/agent-goals",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"status",coerce:null,optional:!0,choices:["active","completed","paused","abandoned"]},{name:"limit",coerce:"number",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"List agent goals over the customer edge."},{key:"primus.agentGoals.recordProgress",commandPath:["primus","agentGoals","recordProgress"],opId:"POST /v1/primus/agent-goals/:goalId/progress",method:"POST",pattern:"/v1/primus/agent-goals/:goalId/progress",pathParams:[{name:"goalGid",key:"goalId"}],flags:[{name:"progress",coerce:"number",optional:!1},{name:"milestoneCompleted",coerce:"number",optional:!0}],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Record goal progress over the customer edge."},{key:"primus.agentGoals.retrieve",commandPath:["primus","agentGoals","retrieve"],opId:"GET /v1/primus/agent-goals/:goalId",method:"GET",pattern:"/v1/primus/agent-goals/:goalId",pathParams:[{name:"goalGid",key:"goalId"}],flags:[],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"Retrieve an agent goal over the customer edge."},{key:"primus.agentGoals.setStatus",commandPath:["primus","agentGoals","setStatus"],opId:"POST /v1/primus/agent-goals/:goalId/status",method:"POST",pattern:"/v1/primus/agent-goals/:goalId/status",pathParams:[{name:"goalGid",key:"goalId"}],flags:[{name:"status",coerce:null,optional:!1,choices:["active","paused","completed","abandoned"]}],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Set goal status over the customer edge."},{key:"primus.agentGoals.update",commandPath:["primus","agentGoals","update"],opId:"PATCH /v1/primus/agent-goals/:goalId",method:"PATCH",pattern:"/v1/primus/agent-goals/:goalId",pathParams:[{name:"goalGid",key:"goalId"}],flags:[{name:"name",coerce:null,optional:!0},{name:"description",coerce:null,optional:!0},{name:"priority",coerce:null,optional:!0,choices:["critical","high","medium","low"]},{name:"schedule",coerce:null,optional:!0},{name:"boundaries",coerce:"json",optional:!0}],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Update an agent goal over the customer edge."},{key:"primus.agents.activate",commandPath:["primus","agents","activate"],opId:"POST /v1/primus/agents/:agentId/activate",method:"POST",pattern:"/v1/primus/agents/:agentId/activate",pathParams:[{name:"agentGid",key:"agentId"}],flags:[],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Activate an agent over the customer edge."},{key:"primus.agents.archive",commandPath:["primus","agents","archive"],opId:"POST /v1/primus/agents/:agentId/archive",method:"POST",pattern:"/v1/primus/agents/:agentId/archive",pathParams:[{name:"agentGid",key:"agentId"}],flags:[],scopes:["agents:admin"],idempotent:!0,isQuery:!1,summary:"Archive an agent over the customer edge."},{key:"primus.agents.assignSkill",commandPath:["primus","agents","assignSkill"],opId:"POST /v1/primus/agents/:agentId/skills/assign",method:"POST",pattern:"/v1/primus/agents/:agentId/skills/assign",pathParams:[{name:"agentGid",key:"agentId"}],flags:[{name:"skillGid",coerce:null,optional:!1}],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Assign a skill to an agent over the customer edge."},{key:"primus.agents.create",commandPath:["primus","agents","create"],opId:"POST /v1/primus/agents",method:"POST",pattern:"/v1/primus/agents",pathParams:[],flags:[{name:"name",coerce:null,optional:!1},{name:"description",coerce:null,optional:!0},{name:"systemPrompt",coerce:null,optional:!1},{name:"personality",coerce:null,optional:!0},{name:"language",coerce:null,optional:!0},{name:"skills",coerce:"json",optional:!0},{name:"slug",coerce:null,optional:!0},{name:"isDiscoverable",coerce:"boolean",optional:!0},{name:"trustLevel",coerce:null,optional:!0,choices:["restricted","standard","elevated","admin"]},{name:"defaultModel",coerce:null,optional:!0},{name:"maxTurns",coerce:"number",optional:!0}],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Create an agent over the customer edge."},{key:"primus.agents.invoke",commandPath:["primus","agents","invoke"],opId:"POST /v1/primus/agents/:agentId/invoke",method:"POST",pattern:"/v1/primus/agents/:agentId/invoke",pathParams:[{name:"agentGid",key:"agentId"}],flags:[{name:"input",coerce:null,optional:!1},{name:"conversationId",coerce:null,optional:!0},{name:"stream",coerce:"boolean",optional:!0},{name:"traceparent",coerce:null,optional:!0}],scopes:["agents:execute"],idempotent:!0,isQuery:!1,summary:"Invoke an agent over the customer edge (action dispatch)."},{key:"primus.agents.list",commandPath:["primus","agents","list"],opId:"GET /v1/primus/agents",method:"GET",pattern:"/v1/primus/agents",pathParams:[],flags:[{name:"activeOnly",coerce:"boolean",optional:!0},{name:"status",coerce:null,optional:!0,choices:["active","paused","archived","all"]},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"List agents over the customer edge \u2014 newest first, one page per call (limit \u2264 200, default 200; cursor = the previous page's last gid). With no status filter the listing returns every row that is NOT archived \u2014 paused rows included; status is an exact filter: active | paused | archived, plus all for every row."},{key:"primus.agents.pause",commandPath:["primus","agents","pause"],opId:"POST /v1/primus/agents/:agentId/pause",method:"POST",pattern:"/v1/primus/agents/:agentId/pause",pathParams:[{name:"agentGid",key:"agentId"}],flags:[],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Pause an agent over the customer edge."},{key:"primus.agents.remove",commandPath:["primus","agents","remove"],opId:"DELETE /v1/primus/agents/:agentId",method:"DELETE",pattern:"/v1/primus/agents/:agentId",pathParams:[{name:"agentGid",key:"agentId"}],flags:[],scopes:["agents:admin"],idempotent:!0,isQuery:!1,summary:"Soft-delete an agent over the customer edge."},{key:"primus.agents.retrieve",commandPath:["primus","agents","retrieve"],opId:"GET /v1/primus/agents/:agentId",method:"GET",pattern:"/v1/primus/agents/:agentId",pathParams:[{name:"agentGid",key:"agentId"}],flags:[],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"Retrieve an agent over the customer edge."},{key:"primus.agents.run",commandPath:["primus","agents","run"],opId:"POST /v1/primus/agents/:agentId/run",method:"POST",pattern:"/v1/primus/agents/:agentId/run",pathParams:[{name:"agentGid",key:"agentId"}],flags:[{name:"input",coerce:null,optional:!1},{name:"conversationId",coerce:null,optional:!0},{name:"traceparent",coerce:null,optional:!0}],scopes:["agents:execute"],idempotent:!0,isQuery:!1,summary:"Run an agent (action dispatch) over the customer edge."},{key:"primus.agents.unassignSkill",commandPath:["primus","agents","unassignSkill"],opId:"POST /v1/primus/agents/:agentId/skills/unassign",method:"POST",pattern:"/v1/primus/agents/:agentId/skills/unassign",pathParams:[{name:"agentGid",key:"agentId"}],flags:[{name:"skillGid",coerce:null,optional:!1}],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Unassign a skill from an agent over the customer edge."},{key:"primus.agents.update",commandPath:["primus","agents","update"],opId:"PATCH /v1/primus/agents/:agentId",method:"PATCH",pattern:"/v1/primus/agents/:agentId",pathParams:[{name:"agentGid",key:"agentId"}],flags:[{name:"name",coerce:null,optional:!0},{name:"description",coerce:null,optional:!0},{name:"systemPrompt",coerce:null,optional:!0},{name:"personality",coerce:null,optional:!0},{name:"language",coerce:null,optional:!0},{name:"skills",coerce:"json",optional:!0},{name:"enabledIntegrations",coerce:"json",optional:!0},{name:"trustLevel",coerce:null,optional:!0,choices:["restricted","standard","elevated","admin"]},{name:"defaultModel",coerce:null,optional:!0},{name:"maxTurns",coerce:"number",optional:!0},{name:"config",coerce:"json",optional:!0},{name:"isDiscoverable",coerce:"boolean",optional:!0}],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Update an agent over the customer edge."},{key:"primus.approvals.approve",commandPath:["primus","approvals","approve"],opId:"POST /v1/primus/approvals/:approvalId/approve",method:"POST",pattern:"/v1/primus/approvals/:approvalId/approve",pathParams:[{name:"approvalGid",key:"approvalId"}],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["approvals:write"],idempotent:!0,isQuery:!1,summary:"Approve a pending approval over the customer edge."},{key:"primus.approvals.create",commandPath:["primus","approvals","create"],opId:"POST /v1/primus/approvals",method:"POST",pattern:"/v1/primus/approvals",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"conversationId",coerce:null,optional:!0},{name:"actionType",coerce:null,optional:!1},{name:"requiredApprover",coerce:null,optional:!1,choices:["member","manager","admin"]},{name:"actionDescription",coerce:null,optional:!1},{name:"actionPayload",coerce:"json",optional:!1},{name:"riskFactors",coerce:"json",optional:!0},{name:"expiresInMs",coerce:"number",optional:!0}],scopes:["approvals:write"],idempotent:!0,isQuery:!1,summary:"Create an approval request over the customer edge."},{key:"primus.approvals.getPendingSummary",commandPath:["primus","approvals","getPendingSummary"],opId:"GET /v1/primus/approvals/pending/summary",method:"GET",pattern:"/v1/primus/approvals/pending/summary",pathParams:[],flags:[],scopes:["approvals:read"],idempotent:!1,isQuery:!0,summary:"Pending approval summary over the customer edge."},{key:"primus.approvals.list",commandPath:["primus","approvals","list"],opId:"GET /v1/primus/approvals",method:"GET",pattern:"/v1/primus/approvals",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["pending","approved","rejected","expired","auto_approved"]}],scopes:["approvals:read"],idempotent:!1,isQuery:!0,summary:"List approvals over the customer edge."},{key:"primus.approvals.listByAgent",commandPath:["primus","approvals","listByAgent"],opId:"GET /v1/primus/approvals/by-agent",method:"GET",pattern:"/v1/primus/approvals/by-agent",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"pendingOnly",coerce:"boolean",optional:!0}],scopes:["approvals:read"],idempotent:!1,isQuery:!0,summary:"List an agent approvals over the customer edge."},{key:"primus.approvals.listPending",commandPath:["primus","approvals","listPending"],opId:"GET /v1/primus/approvals/pending",method:"GET",pattern:"/v1/primus/approvals/pending",pathParams:[],flags:[],scopes:["approvals:read"],idempotent:!1,isQuery:!0,summary:"List pending approvals over the customer edge."},{key:"primus.approvals.pendingCount",commandPath:["primus","approvals","pendingCount"],opId:"GET /v1/primus/approvals/pending/count",method:"GET",pattern:"/v1/primus/approvals/pending/count",pathParams:[],flags:[],scopes:["approvals:read"],idempotent:!1,isQuery:!0,summary:"Pending approval count over the customer edge."},{key:"primus.approvals.reject",commandPath:["primus","approvals","reject"],opId:"POST /v1/primus/approvals/:approvalId/reject",method:"POST",pattern:"/v1/primus/approvals/:approvalId/reject",pathParams:[{name:"approvalGid",key:"approvalId"}],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["approvals:write"],idempotent:!0,isQuery:!1,summary:"Reject a pending approval over the customer edge."},{key:"primus.approvals.retrieve",commandPath:["primus","approvals","retrieve"],opId:"GET /v1/primus/approvals/:approvalId",method:"GET",pattern:"/v1/primus/approvals/:approvalId",pathParams:[{name:"approvalGid",key:"approvalId"}],flags:[],scopes:["approvals:read"],idempotent:!1,isQuery:!0,summary:"Retrieve an approval over the customer edge."},{key:"primus.brainConfig.configure",commandPath:["primus","brainConfig","configure"],opId:"PUT /v1/primus/brain/config",method:"PUT",pattern:"/v1/primus/brain/config",pathParams:[],flags:[{name:"mode",coerce:null,optional:!1,choices:["managed","byok"]},{name:"providers",coerce:"json",optional:!1},{name:"routing",coerce:null,optional:!1,choices:["cost-optimized","latency-optimized","quality-optimized","compliance"]},{name:"defaultProvider",coerce:null,optional:!0},{name:"defaultModel",coerce:null,optional:!0},{name:"tokenBudget",coerce:"json",optional:!0}],scopes:["brain:write"],idempotent:!0,isQuery:!1,summary:"Configure the brain over the customer edge."},{key:"primus.brainConfig.deleteConfig",commandPath:["primus","brainConfig","deleteConfig"],opId:"DELETE /v1/primus/brain/config",method:"DELETE",pattern:"/v1/primus/brain/config",pathParams:[],flags:[],scopes:["brain:admin"],idempotent:!0,isQuery:!1,summary:"Delete brain config over the customer edge."},{key:"primus.brainConfig.getConfig",commandPath:["primus","brainConfig","getConfig"],opId:"GET /v1/primus/brain/config",method:"GET",pattern:"/v1/primus/brain/config",pathParams:[],flags:[],scopes:["brain:read"],idempotent:!1,isQuery:!0,summary:"Get brain config over the customer edge."},{key:"primus.brainConfig.getLlmDashboard",commandPath:["primus","brainConfig","getLlmDashboard"],opId:"GET /v1/primus/brain/llm-dashboard",method:"GET",pattern:"/v1/primus/brain/llm-dashboard",pathParams:[],flags:[],scopes:["brain:read"],idempotent:!1,isQuery:!0,summary:"LLM dashboard over the customer edge."},{key:"primus.brainConfig.getUsageDashboard",commandPath:["primus","brainConfig","getUsageDashboard"],opId:"GET /v1/primus/brain/usage-dashboard",method:"GET",pattern:"/v1/primus/brain/usage-dashboard",pathParams:[],flags:[{name:"range",coerce:null,optional:!0,choices:["7d","30d","90d"]}],scopes:["brain:read"],idempotent:!1,isQuery:!0,summary:"Brain usage dashboard over the customer edge."},{key:"primus.brainConfig.listProviderModels",commandPath:["primus","brainConfig","listProviderModels"],opId:"POST /v1/primus/brain/provider-models",method:"POST",pattern:"/v1/primus/brain/provider-models",pathParams:[],flags:[{name:"provider",coerce:null,optional:!1}],scopes:["brain:read"],idempotent:!1,isQuery:!1,summary:"List a provider's callable models (live) over the customer edge."},{key:"primus.brainConfig.storeProviderKey",commandPath:["primus","brainConfig","storeProviderKey"],opId:"POST /v1/primus/brain/provider-keys",method:"POST",pattern:"/v1/primus/brain/provider-keys",pathParams:[],flags:[{name:"provider",coerce:null,optional:!1},{name:"apiKey",coerce:null,optional:!1}],scopes:["brain:write"],idempotent:!0,isQuery:!1,summary:"Store an LLM provider key (action) over the customer edge."},{key:"primus.brainModels.list",commandPath:["primus","brainModels","list"],opId:"GET /v1/primus/brain/models",method:"GET",pattern:"/v1/primus/brain/models",pathParams:[],flags:[{name:"provider",coerce:null,optional:!0}],scopes:["brain:read"],idempotent:!0,isQuery:!0,summary:"List the tenant's persisted provider-models catalog with per-provider sync state (no live provider call)."},{key:"primus.brainModels.refresh",commandPath:["primus","brainModels","refresh"],opId:"POST /v1/primus/brain/models/refresh",method:"POST",pattern:"/v1/primus/brain/models/refresh",pathParams:[],flags:[{name:"provider",coerce:null,optional:!0}],scopes:["brain:write"],idempotent:!1,isQuery:!1,summary:"Durably re-sync the persisted models catalog from the providers' live APIs (retrier-backed; outcome lands on the catalog state)."},{key:"primus.configPromotion.applyConfigBundle",commandPath:["primus","configPromotion","applyConfigBundle"],opId:"POST /v1/primus/config/apply",method:"POST",pattern:"/v1/primus/config/apply",pathParams:[],flags:[{name:"data",coerce:"json",optional:!1}],scopes:["agents:admin"],idempotent:!1,isQuery:!1,summary:"Apply a promotion bundle onto the caller's (app, environment) \u2014 idempotent on natural keys, fail-closed on missing parents."},{key:"primus.configPromotion.exportConfig",commandPath:["primus","configPromotion","exportConfig"],opId:"GET /v1/primus/config/export",method:"GET",pattern:"/v1/primus/config/export",pathParams:[],flags:[],scopes:["agents:admin"],idempotent:!1,isQuery:!0,summary:"Export the (app, environment) config snapshot for promotion \u2014 every secret-bearing field stripped."},{key:"primus.conversations.archive",commandPath:["primus","conversations","archive"],opId:"POST /v1/primus/conversations/:conversationId/archive",method:"POST",pattern:"/v1/primus/conversations/:conversationId/archive",pathParams:[{name:"conversationGid",key:"conversationId"}],flags:[],scopes:["conversations:admin"],idempotent:!0,isQuery:!1,summary:"Archive a conversation over the customer edge."},{key:"primus.conversations.create",commandPath:["primus","conversations","create"],opId:"POST /v1/primus/conversations",method:"POST",pattern:"/v1/primus/conversations",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"title",coerce:null,optional:!0}],scopes:["conversations:write"],idempotent:!0,isQuery:!1,summary:"Create a conversation over the customer edge."},{key:"primus.conversations.getWithMessages",commandPath:["primus","conversations","getWithMessages"],opId:"GET /v1/primus/conversations/:conversationId/messages",method:"GET",pattern:"/v1/primus/conversations/:conversationId/messages",pathParams:[{name:"conversationGid",key:"conversationId"}],flags:[{name:"messageLimit",coerce:"number",optional:!0}],scopes:["conversations:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a conversation with messages over the customer edge."},{key:"primus.conversations.list",commandPath:["primus","conversations","list"],opId:"GET /v1/primus/conversations",method:"GET",pattern:"/v1/primus/conversations",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["active","archived","deleted"]},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["conversations:read"],idempotent:!1,isQuery:!0,summary:"List conversations over the customer edge."},{key:"primus.conversations.listByAgent",commandPath:["primus","conversations","listByAgent"],opId:"GET /v1/primus/conversations/by-agent",method:"GET",pattern:"/v1/primus/conversations/by-agent",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"includeArchived",coerce:"boolean",optional:!0}],scopes:["conversations:read"],idempotent:!1,isQuery:!0,summary:"List an agent's conversations over the customer edge."},{key:"primus.conversations.listWithStats",commandPath:["primus","conversations","listWithStats"],opId:"GET /v1/primus/conversations/stats",method:"GET",pattern:"/v1/primus/conversations/stats",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["active","archived","deleted"]},{name:"limit",coerce:"number",optional:!0}],scopes:["conversations:read"],idempotent:!1,isQuery:!0,summary:"List conversations with stats over the customer edge."},{key:"primus.conversations.remove",commandPath:["primus","conversations","remove"],opId:"DELETE /v1/primus/conversations/:conversationId",method:"DELETE",pattern:"/v1/primus/conversations/:conversationId",pathParams:[{name:"conversationGid",key:"conversationId"}],flags:[],scopes:["conversations:admin"],idempotent:!0,isQuery:!1,summary:"Delete a conversation over the customer edge."},{key:"primus.conversations.retrieve",commandPath:["primus","conversations","retrieve"],opId:"GET /v1/primus/conversations/:conversationId",method:"GET",pattern:"/v1/primus/conversations/:conversationId",pathParams:[{name:"conversationGid",key:"conversationId"}],flags:[],scopes:["conversations:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a conversation over the customer edge."},{key:"primus.conversations.update",commandPath:["primus","conversations","update"],opId:"PATCH /v1/primus/conversations/:conversationId",method:"PATCH",pattern:"/v1/primus/conversations/:conversationId",pathParams:[{name:"conversationGid",key:"conversationId"}],flags:[{name:"title",coerce:null,optional:!0},{name:"summary",coerce:null,optional:!0}],scopes:["conversations:write"],idempotent:!0,isQuery:!1,summary:"Update a conversation over the customer edge."},{key:"primus.delegations.listByDelegate",commandPath:["primus","delegations","listByDelegate"],opId:"GET /v1/primus/delegations/by-delegate",method:"GET",pattern:"/v1/primus/delegations/by-delegate",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"limit",coerce:"number",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"List delegations by delegate over the customer edge."},{key:"primus.delegations.listByDelegator",commandPath:["primus","delegations","listByDelegator"],opId:"GET /v1/primus/delegations/by-delegator",method:"GET",pattern:"/v1/primus/delegations/by-delegator",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"limit",coerce:"number",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"List delegations by delegator over the customer edge."},{key:"primus.delegations.listByTeam",commandPath:["primus","delegations","listByTeam"],opId:"GET /v1/primus/delegations/by-team",method:"GET",pattern:"/v1/primus/delegations/by-team",pathParams:[],flags:[{name:"teamGid",coerce:null,optional:!1},{name:"limit",coerce:"number",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"List delegations by team over the customer edge."},{key:"primus.entitlements.retrieve",commandPath:["primus","entitlements","retrieve"],opId:"GET /v1/primus/entitlements",method:"GET",pattern:"/v1/primus/entitlements",pathParams:[],flags:[],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"The caller's plan tier, capabilities, and limits+usage."},{key:"primus.execution.approve",commandPath:["primus","execution","approve"],opId:"POST /v1/primus/executions/:executionId/approve",method:"POST",pattern:"/v1/primus/executions/:executionId/approve",pathParams:[{name:"executionGid",key:"executionId"}],flags:[],scopes:["executions:admin"],idempotent:!0,isQuery:!1,summary:"Approve a pending execution over the customer edge."},{key:"primus.execution.cancel",commandPath:["primus","execution","cancel"],opId:"POST /v1/primus/executions/:executionId/cancel",method:"POST",pattern:"/v1/primus/executions/:executionId/cancel",pathParams:[{name:"executionGid",key:"executionId"}],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["executions:execute"],idempotent:!0,isQuery:!1,summary:"Cancel an execution over the customer edge."},{key:"primus.execution.create",commandPath:["primus","execution","create"],opId:"POST /v1/primus/executions",method:"POST",pattern:"/v1/primus/executions",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"conversationGid",coerce:null,optional:!0},{name:"toolName",coerce:null,optional:!1},{name:"arguments",coerce:"json",optional:!1},{name:"priority",coerce:null,optional:!0,choices:["low","normal","high","urgent"]},{name:"parentExecutionGid",coerce:null,optional:!0},{name:"triggerType",coerce:null,optional:!0,choices:["user","agent","trigger","proactive"]},{name:"triggerSource",coerce:null,optional:!0}],scopes:["executions:execute"],idempotent:!0,isQuery:!1,summary:"Create an execution over the customer edge."},{key:"primus.execution.createBatch",commandPath:["primus","execution","createBatch"],opId:"POST /v1/primus/executions/batch",method:"POST",pattern:"/v1/primus/executions/batch",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"conversationGid",coerce:null,optional:!0},{name:"executions",coerce:"json",optional:!1},{name:"parallel",coerce:"boolean",optional:!0}],scopes:["executions:execute"],idempotent:!0,isQuery:!1,summary:"Create an execution batch over the customer edge."},{key:"primus.execution.getDetails",commandPath:["primus","execution","getDetails"],opId:"GET /v1/primus/executions/:executionId/details",method:"GET",pattern:"/v1/primus/executions/:executionId/details",pathParams:[{name:"executionGid",key:"executionId"}],flags:[],scopes:["executions:read"],idempotent:!1,isQuery:!0,summary:"Execution details over the customer edge."},{key:"primus.execution.getPendingApprovals",commandPath:["primus","execution","getPendingApprovals"],opId:"GET /v1/primus/executions/pending-approvals",method:"GET",pattern:"/v1/primus/executions/pending-approvals",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!0}],scopes:["executions:read"],idempotent:!1,isQuery:!0,summary:"Pending approvals over the customer edge."},{key:"primus.execution.getStats",commandPath:["primus","execution","getStats"],opId:"GET /v1/primus/executions/stats",method:"GET",pattern:"/v1/primus/executions/stats",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!0},{name:"timeRange",coerce:"number",optional:!0}],scopes:["executions:read"],idempotent:!1,isQuery:!0,summary:"Execution stats over the customer edge."},{key:"primus.execution.list",commandPath:["primus","execution","list"],opId:"GET /v1/primus/executions",method:"GET",pattern:"/v1/primus/executions",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!0},{name:"status",coerce:null,optional:!0},{name:"includeLeadRuns",coerce:"boolean",optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["executions:read"],idempotent:!1,isQuery:!0,summary:"List executions over the customer edge."},{key:"primus.execution.listByAgent",commandPath:["primus","execution","listByAgent"],opId:"GET /v1/primus/executions/by-agent",method:"GET",pattern:"/v1/primus/executions/by-agent",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"status",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["executions:read"],idempotent:!1,isQuery:!0,summary:"List an agent executions over the customer edge."},{key:"primus.execution.listByConversation",commandPath:["primus","execution","listByConversation"],opId:"GET /v1/primus/executions/by-conversation",method:"GET",pattern:"/v1/primus/executions/by-conversation",pathParams:[],flags:[{name:"conversationGid",coerce:null,optional:!1},{name:"limit",coerce:"number",optional:!0}],scopes:["executions:read"],idempotent:!1,isQuery:!0,summary:"List a conversation executions over the customer edge."},{key:"primus.execution.reject",commandPath:["primus","execution","reject"],opId:"POST /v1/primus/executions/:executionId/reject",method:"POST",pattern:"/v1/primus/executions/:executionId/reject",pathParams:[{name:"executionGid",key:"executionId"}],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["executions:admin"],idempotent:!0,isQuery:!1,summary:"Reject a pending execution over the customer edge."},{key:"primus.execution.retrieve",commandPath:["primus","execution","retrieve"],opId:"GET /v1/primus/executions/:executionId",method:"GET",pattern:"/v1/primus/executions/:executionId",pathParams:[{name:"executionGid",key:"executionId"}],flags:[],scopes:["executions:read"],idempotent:!1,isQuery:!0,summary:"Retrieve an execution over the customer edge."},{key:"primus.execution.streamEvents",commandPath:["primus","execution","streamEvents"],opId:"GET /v1/primus/executions/:executionId/events",method:"GET",pattern:"/v1/primus/executions/:executionId/events",pathParams:[{name:"executionGid",key:"executionId"}],flags:[{name:"afterSequence",coerce:"number",optional:!0}],scopes:["executions:read"],idempotent:!1,isQuery:!0,summary:"Execution stream events over the customer edge."},{key:"primus.execution.traces",commandPath:["primus","execution","traces"],opId:"GET /v1/primus/executions/:executionId/traces",method:"GET",pattern:"/v1/primus/executions/:executionId/traces",pathParams:[{name:"executionGid",key:"executionId"}],flags:[],scopes:["executions:read"],idempotent:!1,isQuery:!0,summary:"Execution traces over the customer edge."},{key:"primus.guardrailOutcomes.list",commandPath:["primus","guardrailOutcomes","list"],opId:"GET /v1/primus/guardrails/outcomes",method:"GET",pattern:"/v1/primus/guardrails/outcomes",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["guardrails:read"],idempotent:!1,isQuery:!0,summary:"List what your guardrails blocked or stopped, newest first."},{key:"primus.guardrailOutcomes.retrieve",commandPath:["primus","guardrailOutcomes","retrieve"],opId:"GET /v1/primus/guardrails/outcomes/:outcomeId",method:"GET",pattern:"/v1/primus/guardrails/outcomes/:outcomeId",pathParams:[{name:"outcomeGid",key:"outcomeId"}],flags:[],scopes:["guardrails:read"],idempotent:!1,isQuery:!0,summary:"Retrieve one guardrail outcome by its reference."},{key:"primus.integrations.connect",commandPath:["primus","integrations","connect"],opId:"POST /v1/primus/integrations/connect",method:"POST",pattern:"/v1/primus/integrations/connect",pathParams:[],flags:[{name:"provider",coerce:null,optional:!1,choices:["google","microsoft","slack","github","npayload","custom"]},{name:"authCode",coerce:null,optional:!1},{name:"redirectUri",coerce:null,optional:!1},{name:"scopes",coerce:"json",optional:!1},{name:"name",coerce:null,optional:!0}],scopes:["connections:write"],idempotent:!1,isQuery:!1,summary:"Connect a third-party integration for the caller's app + environment (OAuth code exchange completes asynchronously; tokens land in the vault only)."},{key:"primus.integrations.disconnect",commandPath:["primus","integrations","disconnect"],opId:"POST /v1/primus/integrations/:connectionId/disconnect",method:"POST",pattern:"/v1/primus/integrations/:connectionId/disconnect",pathParams:[{name:"connectionGid",key:"connectionId"}],flags:[],scopes:["connections:write"],idempotent:!1,isQuery:!1,summary:"Disconnect one integration connection (revoked; its stored credentials are deleted)."},{key:"primus.integrations.list",commandPath:["primus","integrations","list"],opId:"GET /v1/primus/integrations",method:"GET",pattern:"/v1/primus/integrations",pathParams:[],flags:[{name:"status",coerce:null,optional:!0,choices:["active","expired","revoked"]},{name:"activeOnly",coerce:"boolean",optional:!0}],scopes:["connections:read"],idempotent:!1,isQuery:!0,summary:"List the caller's integration connections (no token material)."},{key:"primus.integrations.refresh",commandPath:["primus","integrations","refresh"],opId:"POST /v1/primus/integrations/:connectionId/refresh",method:"POST",pattern:"/v1/primus/integrations/:connectionId/refresh",pathParams:[{name:"connectionGid",key:"connectionId"}],flags:[],scopes:["connections:write"],idempotent:!1,isQuery:!1,summary:"Schedule a token refresh for one connection \u2014 honours the provider's rotation, retries transient failures."},{key:"primus.integrations.retrieve",commandPath:["primus","integrations","retrieve"],opId:"GET /v1/primus/integrations/:connectionId",method:"GET",pattern:"/v1/primus/integrations/:connectionId",pathParams:[{name:"connectionGid",key:"connectionId"}],flags:[],scopes:["connections:read"],idempotent:!1,isQuery:!0,summary:"Retrieve one integration connection by gid (no token material)."},{key:"primus.killSwitch.activate",commandPath:["primus","killSwitch","activate"],opId:"POST /v1/primus/kill-switch/activate",method:"POST",pattern:"/v1/primus/kill-switch/activate",pathParams:[],flags:[{name:"level",coerce:null,optional:!1,choices:["owner","agent"]},{name:"targetAgentGid",coerce:null,optional:!0},{name:"reason",coerce:null,optional:!1},{name:"threatLevel",coerce:null,optional:!1,choices:["low","medium","high","critical"]},{name:"autoResumeAt",coerce:"number",optional:!0}],scopes:["guardrails:admin"],idempotent:!0,isQuery:!1,summary:"Turn on a kill switch for your organization (level owner) or one agent (level agent)."},{key:"primus.killSwitch.checkBlocking",commandPath:["primus","killSwitch","checkBlocking"],opId:"GET /v1/primus/kill-switch/check",method:"GET",pattern:"/v1/primus/kill-switch/check",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1}],scopes:["guardrails:read"],idempotent:!1,isQuery:!0,summary:"Kill-switch blocking check over the customer edge."},{key:"primus.killSwitch.deactivate",commandPath:["primus","killSwitch","deactivate"],opId:"POST /v1/primus/kill-switch/deactivate",method:"POST",pattern:"/v1/primus/kill-switch/deactivate",pathParams:[],flags:[{name:"killSwitchGid",coerce:null,optional:!1},{name:"resolutionNotes",coerce:null,optional:!0}],scopes:["guardrails:admin"],idempotent:!0,isQuery:!1,summary:"Deactivate a kill switch over the customer edge."},{key:"primus.killSwitch.list",commandPath:["primus","killSwitch","list"],opId:"GET /v1/primus/kill-switch",method:"GET",pattern:"/v1/primus/kill-switch",pathParams:[],flags:[{name:"level",coerce:null,optional:!0},{name:"agentGid",coerce:null,optional:!0}],scopes:["guardrails:read"],idempotent:!1,isQuery:!0,summary:"List kill switches over the customer edge."},{key:"primus.killSwitch.listActive",commandPath:["primus","killSwitch","listActive"],opId:"GET /v1/primus/kill-switch/active",method:"GET",pattern:"/v1/primus/kill-switch/active",pathParams:[],flags:[],scopes:["guardrails:read"],idempotent:!1,isQuery:!0,summary:"Active kill switches over the customer edge."},{key:"primus.killSwitch.retrieve",commandPath:["primus","killSwitch","retrieve"],opId:"GET /v1/primus/kill-switch/:killSwitchId",method:"GET",pattern:"/v1/primus/kill-switch/:killSwitchId",pathParams:[{name:"killSwitchGid",key:"killSwitchId"}],flags:[],scopes:["guardrails:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a kill switch over the customer edge."},{key:"primus.killSwitch.status",commandPath:["primus","killSwitch","status"],opId:"GET /v1/primus/kill-switch/status",method:"GET",pattern:"/v1/primus/kill-switch/status",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!0}],scopes:["guardrails:read"],idempotent:!1,isQuery:!0,summary:"Kill-switch status over the customer edge."},{key:"primus.learning.decideProactiveAction",commandPath:["primus","learning","decideProactiveAction"],opId:"POST /v1/primus/learning/proactive-actions/decide",method:"POST",pattern:"/v1/primus/learning/proactive-actions/decide",pathParams:[],flags:[{name:"actionGid",coerce:null,optional:!1},{name:"decision",coerce:null,optional:!1,choices:["approve","reject","modify"]},{name:"modification",coerce:null,optional:!0}],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Decide a proactive action over the customer edge."},{key:"primus.learning.listFeedback",commandPath:["primus","learning","listFeedback"],opId:"GET /v1/primus/learning/feedback",method:"GET",pattern:"/v1/primus/learning/feedback",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"List feedback over the customer edge."},{key:"primus.learning.listFeedbackByAgent",commandPath:["primus","learning","listFeedbackByAgent"],opId:"GET /v1/primus/learning/feedback/by-agent",method:"GET",pattern:"/v1/primus/learning/feedback/by-agent",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"timeRange",coerce:"number",optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"List an agent feedback over the customer edge."},{key:"primus.learning.listPatterns",commandPath:["primus","learning","listPatterns"],opId:"GET /v1/primus/learning/patterns",method:"GET",pattern:"/v1/primus/learning/patterns",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!0},{name:"type",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"List learning patterns over the customer edge."},{key:"primus.learning.listPatternsByAgent",commandPath:["primus","learning","listPatternsByAgent"],opId:"GET /v1/primus/learning/patterns/by-agent",method:"GET",pattern:"/v1/primus/learning/patterns/by-agent",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"timeRange",coerce:"number",optional:!0},{name:"type",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"List an agent patterns over the customer edge."},{key:"primus.learning.listPredictions",commandPath:["primus","learning","listPredictions"],opId:"GET /v1/primus/learning/predictions",method:"GET",pattern:"/v1/primus/learning/predictions",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"status",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"List predictions over the customer edge."},{key:"primus.learning.listProactiveActions",commandPath:["primus","learning","listProactiveActions"],opId:"GET /v1/primus/learning/proactive-actions",method:"GET",pattern:"/v1/primus/learning/proactive-actions",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"status",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"List proactive actions over the customer edge."},{key:"primus.learning.setPatternActive",commandPath:["primus","learning","setPatternActive"],opId:"POST /v1/primus/learning/patterns/set-active",method:"POST",pattern:"/v1/primus/learning/patterns/set-active",pathParams:[],flags:[{name:"patternGid",coerce:null,optional:!1},{name:"isActive",coerce:"boolean",optional:!1}],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Set a pattern active over the customer edge."},{key:"primus.learning.submitFeedback",commandPath:["primus","learning","submitFeedback"],opId:"POST /v1/primus/learning/feedback",method:"POST",pattern:"/v1/primus/learning/feedback",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"type",coerce:null,optional:!1,choices:["explicit","implicit","correction"]},{name:"sentiment",coerce:null,optional:!1,choices:["positive","negative","neutral"]},{name:"rating",coerce:"number",optional:!0},{name:"comment",coerce:null,optional:!0},{name:"correction",coerce:null,optional:!0},{name:"conversationGid",coerce:null,optional:!0},{name:"executionGid",coerce:null,optional:!0},{name:"messageGid",coerce:null,optional:!0},{name:"metadata",coerce:"json",optional:!0}],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Submit feedback over the customer edge."},{key:"primus.mcpConnect.beginConnect",commandPath:["primus","mcpConnect","beginConnect"],opId:"POST /v1/primus/mcp-servers/:mcpServerId/connect/begin",method:"POST",pattern:"/v1/primus/mcp-servers/:mcpServerId/connect/begin",pathParams:[{name:"mcpServerGid",key:"mcpServerId"}],flags:[],scopes:["connections:write"],idempotent:!1,isQuery:!1,summary:"Begin an end-user MCP connection \u2014 returns the authorize URL the component opens."},{key:"primus.mcpConnect.listConnections",commandPath:["primus","mcpConnect","listConnections"],opId:"GET /v1/primus/mcp-connections",method:"GET",pattern:"/v1/primus/mcp-connections",pathParams:[],flags:[],scopes:["connections:read"],idempotent:!1,isQuery:!0,summary:"List the calling end user's own MCP connections."},{key:"primus.mcpConnect.revokeConnection",commandPath:["primus","mcpConnect","revokeConnection"],opId:"POST /v1/primus/mcp-connections/:credentialId/revoke",method:"POST",pattern:"/v1/primus/mcp-connections/:credentialId/revoke",pathParams:[{name:"credentialGid",key:"credentialId"}],flags:[],scopes:["connections:write"],idempotent:!0,isQuery:!1,summary:"Revoke the calling end user's own MCP connection."},{key:"primus.mcpOauth.beginOauth",commandPath:["primus","mcpOauth","beginOauth"],opId:"POST /v1/primus/mcp-servers/:mcpServerId/oauth/begin",method:"POST",pattern:"/v1/primus/mcp-servers/:mcpServerId/oauth/begin",pathParams:[{name:"mcpServerGid",key:"mcpServerId"}],flags:[],scopes:["tools:write"],idempotent:!1,isQuery:!1,summary:"Begin connector OAuth for an outbound MCP server \u2014 returns the authorize URL the browser opens."},{key:"primus.mcpOauth.setPreregisteredClient",commandPath:["primus","mcpOauth","setPreregisteredClient"],opId:"POST /v1/primus/mcp-servers/:mcpServerId/oauth/client",method:"POST",pattern:"/v1/primus/mcp-servers/:mcpServerId/oauth/client",pathParams:[{name:"mcpServerGid",key:"mcpServerId"}],flags:[{name:"clientId",coerce:null,optional:!1},{name:"clientSecret",coerce:null,optional:!0}],scopes:["tools:admin"],idempotent:!0,isQuery:!1,summary:"Register an out-of-band OAuth client for an outbound MCP server (operator-supplied client_id + optional secret)."},{key:"primus.mcpServers.connect",commandPath:["primus","mcpServers","connect"],opId:"POST /v1/primus/mcp-servers",method:"POST",pattern:"/v1/primus/mcp-servers",pathParams:[],flags:[{name:"serverUrl",coerce:null,optional:!1},{name:"name",coerce:null,optional:!1},{name:"description",coerce:null,optional:!0},{name:"authMethod",coerce:null,optional:!1,choices:["none","bearer","oauth"]},{name:"authToken",coerce:null,optional:!0},{name:"credentialScope",coerce:null,optional:!0,choices:["shared","per_tenant"]}],scopes:["tools:write"],idempotent:!0,isQuery:!1,summary:"Connect an MCP server (action) over the customer edge."},{key:"primus.mcpServers.disconnect",commandPath:["primus","mcpServers","disconnect"],opId:"POST /v1/primus/mcp-servers/:mcpServerId/disconnect",method:"POST",pattern:"/v1/primus/mcp-servers/:mcpServerId/disconnect",pathParams:[{name:"mcpServerGid",key:"mcpServerId"}],flags:[],scopes:["tools:admin"],idempotent:!0,isQuery:!1,summary:"Disconnect an MCP server (action) over the customer edge."},{key:"primus.mcpServers.list",commandPath:["primus","mcpServers","list"],opId:"GET /v1/primus/mcp-servers",method:"GET",pattern:"/v1/primus/mcp-servers",pathParams:[],flags:[],scopes:["tools:read"],idempotent:!1,isQuery:!0,summary:"List MCP servers over the customer edge."},{key:"primus.mcpServers.reconnect",commandPath:["primus","mcpServers","reconnect"],opId:"POST /v1/primus/mcp-servers/:mcpServerId/reconnect",method:"POST",pattern:"/v1/primus/mcp-servers/:mcpServerId/reconnect",pathParams:[{name:"mcpServerGid",key:"mcpServerId"}],flags:[],scopes:["tools:write"],idempotent:!0,isQuery:!1,summary:"Reconnect an MCP server (action) over the customer edge."},{key:"primus.mcpServers.rename",commandPath:["primus","mcpServers","rename"],opId:"POST /v1/primus/mcp-servers/:mcpServerId/rename",method:"POST",pattern:"/v1/primus/mcp-servers/:mcpServerId/rename",pathParams:[{name:"mcpServerGid",key:"mcpServerId"}],flags:[{name:"name",coerce:null,optional:!1}],scopes:["tools:write"],idempotent:!0,isQuery:!1,summary:"Rename an MCP server (action) over the customer edge."},{key:"primus.mcpServers.retrieve",commandPath:["primus","mcpServers","retrieve"],opId:"GET /v1/primus/mcp-servers/:mcpServerId",method:"GET",pattern:"/v1/primus/mcp-servers/:mcpServerId",pathParams:[{name:"mcpServerGid",key:"mcpServerId"}],flags:[],scopes:["tools:read"],idempotent:!1,isQuery:!0,summary:"Retrieve an MCP server over the customer edge."},{key:"primus.mcpServers.rotateAuth",commandPath:["primus","mcpServers","rotateAuth"],opId:"POST /v1/primus/mcp-servers/:mcpServerId/rotate-auth",method:"POST",pattern:"/v1/primus/mcp-servers/:mcpServerId/rotate-auth",pathParams:[{name:"mcpServerGid",key:"mcpServerId"}],flags:[{name:"authToken",coerce:null,optional:!1}],scopes:["tools:admin"],idempotent:!0,isQuery:!1,summary:"Rotate MCP server auth (action) over the customer edge."},{key:"primus.mcpServers.test",commandPath:["primus","mcpServers","test"],opId:"POST /v1/primus/mcp-servers/test",method:"POST",pattern:"/v1/primus/mcp-servers/test",pathParams:[],flags:[{name:"serverUrl",coerce:null,optional:!1},{name:"authMethod",coerce:null,optional:!1,choices:["none","bearer","oauth"]},{name:"authToken",coerce:null,optional:!0}],scopes:["tools:write"],idempotent:!0,isQuery:!1,summary:"Test an MCP server (action) over the customer edge."},{key:"primus.memories.create",commandPath:["primus","memories","create"],opId:"POST /v1/primus/memory",method:"POST",pattern:"/v1/primus/memory",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"conversationGid",coerce:null,optional:!0},{name:"type",coerce:null,optional:!1,choices:["working","session","long_term","shared"]},{name:"key",coerce:null,optional:!1},{name:"content",coerce:null,optional:!1},{name:"embedding",coerce:"json",optional:!0},{name:"importance",coerce:"number",optional:!0},{name:"isEncrypted",coerce:"boolean",optional:!0},{name:"vaultSecretId",coerce:null,optional:!0},{name:"expiresAt",coerce:"number",optional:!0},{name:"scope",coerce:null,optional:!1},{name:"teamId",coerce:null,optional:!0}],scopes:["memory:write"],idempotent:!0,isQuery:!1,summary:"Create a memory over the customer edge."},{key:"primus.memories.list",commandPath:["primus","memories","list"],opId:"GET /v1/primus/memory",method:"GET",pattern:"/v1/primus/memory",pathParams:[],flags:[{name:"type",coerce:null,optional:!0,choices:["working","session","long_term","shared"]},{name:"limit",coerce:"number",optional:!0}],scopes:["memory:read"],idempotent:!1,isQuery:!0,summary:"List memories over the customer edge."},{key:"primus.memories.listByAgent",commandPath:["primus","memories","listByAgent"],opId:"GET /v1/primus/memory/by-agent",method:"GET",pattern:"/v1/primus/memory/by-agent",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"type",coerce:null,optional:!0,choices:["working","session","long_term","shared"]},{name:"limit",coerce:"number",optional:!0}],scopes:["memory:read"],idempotent:!1,isQuery:!0,summary:"List an agent memories over the customer edge."},{key:"primus.memories.listByConversation",commandPath:["primus","memories","listByConversation"],opId:"GET /v1/primus/memory/by-conversation",method:"GET",pattern:"/v1/primus/memory/by-conversation",pathParams:[],flags:[{name:"conversationGid",coerce:null,optional:!1}],scopes:["memory:read"],idempotent:!1,isQuery:!0,summary:"List a conversation memories over the customer edge."},{key:"primus.memories.listQuarantined",commandPath:["primus","memories","listQuarantined"],opId:"GET /v1/primus/memory/quarantined",method:"GET",pattern:"/v1/primus/memory/quarantined",pathParams:[],flags:[],scopes:["memory:read"],idempotent:!1,isQuery:!0,summary:"List quarantined memories over the customer edge."},{key:"primus.memories.quarantine",commandPath:["primus","memories","quarantine"],opId:"POST /v1/primus/memory/:memoryId/quarantine",method:"POST",pattern:"/v1/primus/memory/:memoryId/quarantine",pathParams:[{name:"memoryGid",key:"memoryId"}],flags:[{name:"reason",coerce:null,optional:!1}],scopes:["memory:write"],idempotent:!0,isQuery:!1,summary:"Quarantine a memory over the customer edge."},{key:"primus.memories.remove",commandPath:["primus","memories","remove"],opId:"DELETE /v1/primus/memory/:memoryId",method:"DELETE",pattern:"/v1/primus/memory/:memoryId",pathParams:[{name:"memoryGid",key:"memoryId"}],flags:[],scopes:["memory:admin"],idempotent:!0,isQuery:!1,summary:"Delete a memory over the customer edge."},{key:"primus.memories.retrieve",commandPath:["primus","memories","retrieve"],opId:"GET /v1/primus/memory/:memoryId",method:"GET",pattern:"/v1/primus/memory/:memoryId",pathParams:[{name:"memoryGid",key:"memoryId"}],flags:[],scopes:["memory:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a memory over the customer edge."},{key:"primus.memories.unquarantine",commandPath:["primus","memories","unquarantine"],opId:"POST /v1/primus/memory/:memoryId/unquarantine",method:"POST",pattern:"/v1/primus/memory/:memoryId/unquarantine",pathParams:[{name:"memoryGid",key:"memoryId"}],flags:[],scopes:["memory:write"],idempotent:!0,isQuery:!1,summary:"Unquarantine a memory over the customer edge."},{key:"primus.memories.update",commandPath:["primus","memories","update"],opId:"PATCH /v1/primus/memory/:memoryId",method:"PATCH",pattern:"/v1/primus/memory/:memoryId",pathParams:[{name:"memoryGid",key:"memoryId"}],flags:[{name:"content",coerce:null,optional:!0},{name:"embedding",coerce:"json",optional:!0},{name:"importance",coerce:"number",optional:!0},{name:"expiresAt",coerce:"number",optional:!0}],scopes:["memory:write"],idempotent:!0,isQuery:!1,summary:"Update a memory over the customer edge."},{key:"primus.memoriesEncrypted.decryptMemory",commandPath:["primus","memoriesEncrypted","decryptMemory"],opId:"POST /v1/primus/memories/:memoryId/decrypt",method:"POST",pattern:"/v1/primus/memories/:memoryId/decrypt",pathParams:[{name:"memoryGid",key:"memoryId"}],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["memory:read"],idempotent:!1,isQuery:!1,summary:"Decrypt one memory's content for its owner (deliberate, audited read)."},{key:"primus.memoriesEncrypted.getEncryption",commandPath:["primus","memoriesEncrypted","getEncryption"],opId:"GET /v1/primus/memories/:memoryId/encryption",method:"GET",pattern:"/v1/primus/memories/:memoryId/encryption",pathParams:[{name:"memoryGid",key:"memoryId"}],flags:[{name:"revealNonce",coerce:"boolean",optional:!0}],scopes:["memory:read"],idempotent:!1,isQuery:!1,summary:"Read a memory's encryption metadata (algorithm, key version, vault secret, masked nonce, size, time) \u2014 never the ciphertext."},{key:"primus.memoriesEncrypted.reencrypt",commandPath:["primus","memoriesEncrypted","reencrypt"],opId:"POST /v1/primus/memories/:memoryId/reencrypt",method:"POST",pattern:"/v1/primus/memories/:memoryId/reencrypt",pathParams:[{name:"memoryGid",key:"memoryId"}],flags:[],scopes:["memory:write"],idempotent:!1,isQuery:!1,summary:"Re-encrypt a memory under the current tenant key version (audited roll-forward)."},{key:"primus.memory.getLineage",commandPath:["primus","memory","getLineage"],opId:"GET /v1/primus/memory/store/:memoryId/lineage",method:"GET",pattern:"/v1/primus/memory/store/:memoryId/lineage",pathParams:[{name:"memoryGid",key:"memoryId"}],flags:[],scopes:["memory:read"],idempotent:!1,isQuery:!0,summary:"Memory lineage over the customer edge."},{key:"primus.memory.getQuarantineSummary",commandPath:["primus","memory","getQuarantineSummary"],opId:"GET /v1/primus/memory/store/quarantine-summary",method:"GET",pattern:"/v1/primus/memory/store/quarantine-summary",pathParams:[],flags:[],scopes:["memory:read"],idempotent:!1,isQuery:!0,summary:"Quarantine summary over the customer edge."},{key:"primus.memory.getRetrievalHistory",commandPath:["primus","memory","getRetrievalHistory"],opId:"GET /v1/primus/memory/store/:memoryId/retrieval-history",method:"GET",pattern:"/v1/primus/memory/store/:memoryId/retrieval-history",pathParams:[{name:"memoryGid",key:"memoryId"}],flags:[{name:"days",coerce:"number",optional:!0}],scopes:["memory:read"],idempotent:!1,isQuery:!0,summary:"Memory retrieval history over the customer edge."},{key:"primus.memory.list",commandPath:["primus","memory","list"],opId:"GET /v1/primus/memory/store/list",method:"GET",pattern:"/v1/primus/memory/store/list",pathParams:[],flags:[{name:"type",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["memory:read"],idempotent:!1,isQuery:!0,summary:"List stored memories over the customer edge."},{key:"primus.memory.listByTeam",commandPath:["primus","memory","listByTeam"],opId:"GET /v1/primus/memory/store/by-team",method:"GET",pattern:"/v1/primus/memory/store/by-team",pathParams:[],flags:[{name:"teamGid",coerce:null,optional:!1},{name:"limit",coerce:"number",optional:!0}],scopes:["memory:read"],idempotent:!1,isQuery:!0,summary:"List team memories over the customer edge."},{key:"primus.memory.listQuarantined",commandPath:["primus","memory","listQuarantined"],opId:"GET /v1/primus/memory/store/quarantined",method:"GET",pattern:"/v1/primus/memory/store/quarantined",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0}],scopes:["memory:read"],idempotent:!1,isQuery:!0,summary:"List quarantined stored memories over the customer edge."},{key:"primus.memory.recall",commandPath:["primus","memory","recall"],opId:"GET /v1/primus/memory/recall",method:"GET",pattern:"/v1/primus/memory/recall",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"query",coerce:null,optional:!0},{name:"type",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0},{name:"cursor",coerce:null,optional:!0}],scopes:["memory:read"],idempotent:!1,isQuery:!1,summary:"Recall agent memory over the customer edge."},{key:"primus.memory.store",commandPath:["primus","memory","store"],opId:"POST /v1/primus/memory/store",method:"POST",pattern:"/v1/primus/memory/store",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"type",coerce:null,optional:!1},{name:"content",coerce:null,optional:!1},{name:"source",coerce:null,optional:!0},{name:"sourceId",coerce:null,optional:!0},{name:"tags",coerce:"json",optional:!0},{name:"metadata",coerce:"json",optional:!0},{name:"expiresAt",coerce:"number",optional:!0},{name:"importance",coerce:"number",optional:!0},{name:"scope",coerce:null,optional:!1,choices:["private","team","tenant"]},{name:"teamId",coerce:null,optional:!0}],scopes:["memory:write"],idempotent:!0,isQuery:!1,summary:"Encrypted memory store (action) over the customer edge."},{key:"primus.observability.acknowledgeAlert",commandPath:["primus","observability","acknowledgeAlert"],opId:"POST /v1/primus/observability/alerts/acknowledge",method:"POST",pattern:"/v1/primus/observability/alerts/acknowledge",pathParams:[],flags:[{name:"alertGid",coerce:null,optional:!1},{name:"acknowledgedBy",coerce:null,optional:!0}],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Acknowledge an alert over the customer edge."},{key:"primus.observability.aggregateMetrics",commandPath:["primus","observability","aggregateMetrics"],opId:"GET /v1/primus/metrics/aggregate",method:"GET",pattern:"/v1/primus/metrics/aggregate",pathParams:[],flags:[{name:"name",coerce:null,optional:!1},{name:"startTime",coerce:"number",optional:!1},{name:"endTime",coerce:"number",optional:!0},{name:"aggregation",coerce:null,optional:!1,choices:["sum","avg","min","max","count","p50","p95","p99"]},{name:"groupBy",coerce:null,optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"Aggregate metrics over the customer edge."},{key:"primus.observability.getActiveAlerts",commandPath:["primus","observability","getActiveAlerts"],opId:"GET /v1/primus/observability/alerts",method:"GET",pattern:"/v1/primus/observability/alerts",pathParams:[],flags:[{name:"severity",coerce:null,optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"Active alerts over the customer edge."},{key:"primus.observability.getErrorDistribution",commandPath:["primus","observability","getErrorDistribution"],opId:"GET /v1/primus/observability/errors/distribution",method:"GET",pattern:"/v1/primus/observability/errors/distribution",pathParams:[],flags:[{name:"startTime",coerce:"number",optional:!1},{name:"endTime",coerce:"number",optional:!0},{name:"byField",coerce:null,optional:!0,choices:["type","source","fingerprint","status"]},{name:"limit",coerce:"number",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"Error distribution over the customer edge."},{key:"primus.observability.getErrors",commandPath:["primus","observability","getErrors"],opId:"GET /v1/primus/observability/errors",method:"GET",pattern:"/v1/primus/observability/errors",pathParams:[],flags:[{name:"status",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"List errors over the customer edge."},{key:"primus.observability.getMetrics",commandPath:["primus","observability","getMetrics"],opId:"GET /v1/primus/metrics",method:"GET",pattern:"/v1/primus/metrics",pathParams:[],flags:[{name:"name",coerce:null,optional:!1},{name:"startTime",coerce:"number",optional:!1},{name:"endTime",coerce:"number",optional:!0},{name:"agentGid",coerce:null,optional:!0},{name:"labels",coerce:"json",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"Query metrics over the customer edge."},{key:"primus.observability.getSystemMetrics",commandPath:["primus","observability","getSystemMetrics"],opId:"GET /v1/primus/metrics/system",method:"GET",pattern:"/v1/primus/metrics/system",pathParams:[],flags:[],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"System metrics over the customer edge."},{key:"primus.observability.getTrace",commandPath:["primus","observability","getTrace"],opId:"GET /v1/primus/observability/traces/:traceId",method:"GET",pattern:"/v1/primus/observability/traces/:traceId",pathParams:[{name:"traceId",key:"traceId"}],flags:[],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a trace over the customer edge."},{key:"primus.observability.listErrorsByAgent",commandPath:["primus","observability","listErrorsByAgent"],opId:"GET /v1/primus/observability/errors/by-agent",method:"GET",pattern:"/v1/primus/observability/errors/by-agent",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"status",coerce:null,optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"Errors by agent over the customer edge."},{key:"primus.observability.listErrorsByExecution",commandPath:["primus","observability","listErrorsByExecution"],opId:"GET /v1/primus/observability/errors/by-execution",method:"GET",pattern:"/v1/primus/observability/errors/by-execution",pathParams:[],flags:[{name:"executionGid",coerce:null,optional:!1},{name:"limit",coerce:"number",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"Errors by execution over the customer edge."},{key:"primus.observability.resolveAlert",commandPath:["primus","observability","resolveAlert"],opId:"POST /v1/primus/observability/alerts/resolve",method:"POST",pattern:"/v1/primus/observability/alerts/resolve",pathParams:[],flags:[{name:"alertGid",coerce:null,optional:!1},{name:"resolvedBy",coerce:null,optional:!0},{name:"resolution",coerce:null,optional:!0}],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Resolve an alert over the customer edge."},{key:"primus.observability.resolveError",commandPath:["primus","observability","resolveError"],opId:"POST /v1/primus/observability/errors/resolve",method:"POST",pattern:"/v1/primus/observability/errors/resolve",pathParams:[],flags:[{name:"errorGid",coerce:null,optional:!1}],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Resolve an error over the customer edge."},{key:"primus.overview.getActiveTriggers",commandPath:["primus","overview","getActiveTriggers"],opId:"GET /v1/primus/overview/active-triggers",method:"GET",pattern:"/v1/primus/overview/active-triggers",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"Active triggers over the customer edge."},{key:"primus.overview.getMemoryHealth",commandPath:["primus","overview","getMemoryHealth"],opId:"GET /v1/primus/overview/memory-health",method:"GET",pattern:"/v1/primus/overview/memory-health",pathParams:[],flags:[],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"Memory health over the customer edge."},{key:"primus.overview.getMetricsSummary",commandPath:["primus","overview","getMetricsSummary"],opId:"GET /v1/primus/overview/metrics-summary",method:"GET",pattern:"/v1/primus/overview/metrics-summary",pathParams:[],flags:[],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"Overview metrics summary over the customer edge."},{key:"primus.overview.getStats",commandPath:["primus","overview","getStats"],opId:"GET /v1/primus/overview/stats",method:"GET",pattern:"/v1/primus/overview/stats",pathParams:[],flags:[],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"Overview stats over the customer edge."},{key:"primus.overview.getTopAgents",commandPath:["primus","overview","getTopAgents"],opId:"GET /v1/primus/overview/top-agents",method:"GET",pattern:"/v1/primus/overview/top-agents",pathParams:[],flags:[{name:"limit",coerce:"number",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"Top agents over the customer edge."},{key:"primus.rag.searchDualAuth",commandPath:["primus","rag","searchDualAuth"],opId:"POST /v1/primus/memory/search",method:"POST",pattern:"/v1/primus/memory/search",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"query",coerce:null,optional:!1},{name:"topK",coerce:"number",optional:!0},{name:"tags",coerce:"json",optional:!0},{name:"memoryTypes",coerce:"json",optional:!0},{name:"excludeQuarantined",coerce:"boolean",optional:!0},{name:"rerank",coerce:null,optional:!0,choices:["rrf","mmr"]},{name:"diversityFactor",coerce:"number",optional:!0}],scopes:["memory:read"],idempotent:!1,isQuery:!1,summary:"Hybrid memory search (vector + keyword, RRF-merged) over the customer edge."},{key:"primus.rag.searchExplainDualAuth",commandPath:["primus","rag","searchExplainDualAuth"],opId:"POST /v1/primus/memory/search/explain",method:"POST",pattern:"/v1/primus/memory/search/explain",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"query",coerce:null,optional:!1},{name:"topK",coerce:"number",optional:!0},{name:"hybridWeight",coerce:"number",optional:!0}],scopes:["memory:read"],idempotent:!1,isQuery:!1,summary:"Hybrid memory search with the per-result score breakdown over the customer edge."},{key:"primus.selfKnowledge.list",commandPath:["primus","selfKnowledge","list"],opId:"GET /v1/primus/self-knowledge",method:"GET",pattern:"/v1/primus/self-knowledge",pathParams:[],flags:[{name:"category",coerce:null,optional:!0,choices:["strength","weakness","failure_pattern","improvement"]},{name:"activeOnly",coerce:"boolean",optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"List self-knowledge over the customer edge."},{key:"primus.selfKnowledge.record",commandPath:["primus","selfKnowledge","record"],opId:"POST /v1/primus/self-knowledge",method:"POST",pattern:"/v1/primus/self-knowledge",pathParams:[],flags:[{name:"category",coerce:null,optional:!1,choices:["strength","weakness","failure_pattern","improvement"]},{name:"description",coerce:null,optional:!1},{name:"key",coerce:null,optional:!0},{name:"value",coerce:"json",optional:!0},{name:"source",coerce:null,optional:!0},{name:"evidence",coerce:"json",optional:!0},{name:"confidence",coerce:"number",optional:!1}],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Record self-knowledge over the customer edge."},{key:"primus.selfKnowledge.retrieve",commandPath:["primus","selfKnowledge","retrieve"],opId:"GET /v1/primus/self-knowledge/:knowledgeId",method:"GET",pattern:"/v1/primus/self-knowledge/:knowledgeId",pathParams:[{name:"knowledgeGid",key:"knowledgeId"}],flags:[],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"Retrieve self-knowledge over the customer edge."},{key:"primus.selfKnowledge.setActive",commandPath:["primus","selfKnowledge","setActive"],opId:"POST /v1/primus/self-knowledge/:knowledgeId/active",method:"POST",pattern:"/v1/primus/self-knowledge/:knowledgeId/active",pathParams:[{name:"knowledgeGid",key:"knowledgeId"}],flags:[{name:"isActive",coerce:"boolean",optional:!1}],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Set self-knowledge active over the customer edge."},{key:"primus.selfKnowledge.validate",commandPath:["primus","selfKnowledge","validate"],opId:"POST /v1/primus/self-knowledge/:knowledgeId/validate",method:"POST",pattern:"/v1/primus/self-knowledge/:knowledgeId/validate",pathParams:[{name:"knowledgeGid",key:"knowledgeId"}],flags:[],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Validate self-knowledge over the customer edge."},{key:"primus.skills.create",commandPath:["primus","skills","create"],opId:"POST /v1/primus/skills",method:"POST",pattern:"/v1/primus/skills",pathParams:[],flags:[{name:"name",coerce:null,optional:!1},{name:"description",coerce:null,optional:!1},{name:"category",coerce:null,optional:!0},{name:"icon",coerce:null,optional:!0},{name:"slug",coerce:null,optional:!0},{name:"executor",coerce:null,optional:!1,choices:["inline","webhook","dynamic_worker","container","gpu","openshell","cloud_run","fly_machines","k8s_jobs"]},{name:"definition",coerce:"json",optional:!1},{name:"limits",coerce:"json",optional:!0},{name:"enabled",coerce:"boolean",optional:!0}],scopes:["skills:write"],idempotent:!0,isQuery:!1,summary:"Create a skill over the customer edge."},{key:"primus.skills.disable",commandPath:["primus","skills","disable"],opId:"POST /v1/primus/skills/:skillId/disable",method:"POST",pattern:"/v1/primus/skills/:skillId/disable",pathParams:[{name:"skillGid",key:"skillId"}],flags:[],scopes:["skills:write"],idempotent:!0,isQuery:!1,summary:"Disable a skill over the customer edge."},{key:"primus.skills.enable",commandPath:["primus","skills","enable"],opId:"POST /v1/primus/skills/:skillId/enable",method:"POST",pattern:"/v1/primus/skills/:skillId/enable",pathParams:[{name:"skillGid",key:"skillId"}],flags:[],scopes:["skills:write"],idempotent:!0,isQuery:!1,summary:"Enable a skill over the customer edge."},{key:"primus.skills.getStats",commandPath:["primus","skills","getStats"],opId:"GET /v1/primus/skills/:skillId/stats",method:"GET",pattern:"/v1/primus/skills/:skillId/stats",pathParams:[{name:"skillGid",key:"skillId"}],flags:[{name:"limit",coerce:"number",optional:!0},{name:"startTime",coerce:"number",optional:!0},{name:"endTime",coerce:"number",optional:!0}],scopes:["skills:read"],idempotent:!1,isQuery:!0,summary:"Skill stats over the customer edge."},{key:"primus.skills.getWithExecutions",commandPath:["primus","skills","getWithExecutions"],opId:"GET /v1/primus/skills/:skillId/executions",method:"GET",pattern:"/v1/primus/skills/:skillId/executions",pathParams:[{name:"skillGid",key:"skillId"}],flags:[{name:"executionLimit",coerce:"number",optional:!0}],scopes:["skills:read"],idempotent:!1,isQuery:!0,summary:"Skill with executions over the customer edge."},{key:"primus.skills.list",commandPath:["primus","skills","list"],opId:"GET /v1/primus/skills",method:"GET",pattern:"/v1/primus/skills",pathParams:[],flags:[{name:"category",coerce:null,optional:!0},{name:"enabledOnly",coerce:"boolean",optional:!0},{name:"includeBuiltIn",coerce:"boolean",optional:!0}],scopes:["skills:read"],idempotent:!1,isQuery:!0,summary:"List skills over the customer edge."},{key:"primus.skills.listBuiltIn",commandPath:["primus","skills","listBuiltIn"],opId:"GET /v1/primus/skills/built-in",method:"GET",pattern:"/v1/primus/skills/built-in",pathParams:[],flags:[{name:"category",coerce:null,optional:!0}],scopes:["skills:read"],idempotent:!1,isQuery:!0,summary:"List built-in skills over the customer edge."},{key:"primus.skills.listByCategory",commandPath:["primus","skills","listByCategory"],opId:"GET /v1/primus/skills/by-category",method:"GET",pattern:"/v1/primus/skills/by-category",pathParams:[],flags:[{name:"category",coerce:null,optional:!1}],scopes:["skills:read"],idempotent:!1,isQuery:!0,summary:"List skills by category over the customer edge."},{key:"primus.skills.remove",commandPath:["primus","skills","remove"],opId:"DELETE /v1/primus/skills/:skillId",method:"DELETE",pattern:"/v1/primus/skills/:skillId",pathParams:[{name:"skillGid",key:"skillId"}],flags:[],scopes:["skills:admin"],idempotent:!0,isQuery:!1,summary:"Delete a skill over the customer edge."},{key:"primus.skills.retrieve",commandPath:["primus","skills","retrieve"],opId:"GET /v1/primus/skills/:skillId",method:"GET",pattern:"/v1/primus/skills/:skillId",pathParams:[{name:"skillGid",key:"skillId"}],flags:[],scopes:["skills:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a skill over the customer edge."},{key:"primus.skills.update",commandPath:["primus","skills","update"],opId:"PATCH /v1/primus/skills/:skillId",method:"PATCH",pattern:"/v1/primus/skills/:skillId",pathParams:[{name:"skillGid",key:"skillId"}],flags:[{name:"name",coerce:null,optional:!0},{name:"description",coerce:null,optional:!0},{name:"category",coerce:null,optional:!0},{name:"icon",coerce:null,optional:!0},{name:"executor",coerce:null,optional:!0,choices:["inline","webhook","dynamic_worker","container","gpu","openshell","cloud_run","fly_machines","k8s_jobs"]},{name:"enabled",coerce:"boolean",optional:!0},{name:"definition",coerce:"json",optional:!0},{name:"limits",coerce:"json",optional:!0}],scopes:["skills:write"],idempotent:!0,isQuery:!1,summary:"Update a skill over the customer edge."},{key:"primus.skillSynthesis.getForTool",commandPath:["primus","skillSynthesis","getForTool"],opId:"GET /v1/primus/skill-synthesis/for-tool",method:"GET",pattern:"/v1/primus/skill-synthesis/for-tool",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"Synthesis candidates for a tool over the customer edge."},{key:"primus.skillSynthesis.list",commandPath:["primus","skillSynthesis","list"],opId:"GET /v1/primus/skill-synthesis",method:"GET",pattern:"/v1/primus/skill-synthesis",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"status",coerce:null,optional:!0},{name:"category",coerce:null,optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"List synthesized skills over the customer edge."},{key:"primus.skillSynthesis.promote",commandPath:["primus","skillSynthesis","promote"],opId:"POST /v1/primus/skill-synthesis/:skillId/promote",method:"POST",pattern:"/v1/primus/skill-synthesis/:skillId/promote",pathParams:[{name:"skillGid",key:"skillId"}],flags:[{name:"status",coerce:null,optional:!1,choices:["approved","rejected"]},{name:"reviewNotes",coerce:null,optional:!0}],scopes:["agents:write"],idempotent:!0,isQuery:!1,summary:"Promote a synthesized skill over the customer edge."},{key:"primus.skillSynthesis.retrieve",commandPath:["primus","skillSynthesis","retrieve"],opId:"GET /v1/primus/skill-synthesis/:skillId",method:"GET",pattern:"/v1/primus/skill-synthesis/:skillId",pathParams:[{name:"skillGid",key:"skillId"}],flags:[],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a synthesized skill over the customer edge."},{key:"primus.skillSynthesis.runPipeline",commandPath:["primus","skillSynthesis","runPipeline"],opId:"POST /v1/primus/skill-synthesis/run-pipeline",method:"POST",pattern:"/v1/primus/skill-synthesis/run-pipeline",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!0},{name:"stages",coerce:"json",optional:!0},{name:"minConfidence",coerce:"number",optional:!0},{name:"minFrequency",coerce:"number",optional:!0}],scopes:["agents:execute"],idempotent:!0,isQuery:!1,summary:"Run the synthesis pipeline (action) over the customer edge."},{key:"primus.spendCap.retrieve",commandPath:["primus","spendCap","retrieve"],opId:"GET /v1/primus/spend-cap",method:"GET",pattern:"/v1/primus/spend-cap",pathParams:[],flags:[],scopes:["brain:read"],idempotent:!1,isQuery:!0,summary:"Your organization's monthly spend cap, this month's spend and when the month resets."},{key:"primus.spendCap.update",commandPath:["primus","spendCap","update"],opId:"PUT /v1/primus/spend-cap",method:"PUT",pattern:"/v1/primus/spend-cap",pathParams:[],flags:[{name:"capCents",coerce:null,optional:!1}],scopes:["brain:write"],idempotent:!0,isQuery:!1,summary:"Set or remove your organization's monthly spend cap (a person in the organization only)."},{key:"primus.stats.retrieve",commandPath:["primus","stats","retrieve"],opId:"GET /v1/primus/learning/stats",method:"GET",pattern:"/v1/primus/learning/stats",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"timeRange",coerce:"number",optional:!0}],scopes:["agents:read"],idempotent:!1,isQuery:!0,summary:"Learning stats over the customer edge."},{key:"primus.teams.addMember",commandPath:["primus","teams","addMember"],opId:"POST /v1/primus/teams/members",method:"POST",pattern:"/v1/primus/teams/members",pathParams:[],flags:[{name:"name",coerce:null,optional:!1},{name:"role",coerce:null,optional:!1},{name:"memberRole",coerce:null,optional:!0,choices:["lead","specialist","system"]},{name:"systemPrompt",coerce:null,optional:!1},{name:"skills",coerce:"json",optional:!0},{name:"makeSubLead",coerce:"boolean",optional:!0}],scopes:["teams:write"],idempotent:!0,isQuery:!1,summary:"Add a team member (action) over the customer edge."},{key:"primus.teams.assignAgent",commandPath:["primus","teams","assignAgent"],opId:"POST /v1/primus/teams/assign",method:"POST",pattern:"/v1/primus/teams/assign",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"makeSubLead",coerce:"boolean",optional:!0}],scopes:["teams:write"],idempotent:!0,isQuery:!1,summary:"Assign an agent to the team over the customer edge."},{key:"primus.teams.create",commandPath:["primus","teams","create"],opId:"POST /v1/primus/teams",method:"POST",pattern:"/v1/primus/teams",pathParams:[],flags:[{name:"name",coerce:null,optional:!0},{name:"businessContext",coerce:null,optional:!0}],scopes:["teams:write"],idempotent:!0,isQuery:!1,summary:"Create a team over the customer edge."},{key:"primus.teams.createWithSpecialists",commandPath:["primus","teams","createWithSpecialists"],opId:"POST /v1/primus/teams/with-specialists",method:"POST",pattern:"/v1/primus/teams/with-specialists",pathParams:[],flags:[{name:"name",coerce:null,optional:!0},{name:"businessContext",coerce:null,optional:!0},{name:"specialists",coerce:"json",optional:!0}],scopes:["teams:write"],idempotent:!0,isQuery:!1,summary:"Create a team with specialists (action) over the customer edge."},{key:"primus.teams.delegateByTag",commandPath:["primus","teams","delegateByTag"],opId:"POST /v1/primus/teams/delegate",method:"POST",pattern:"/v1/primus/teams/delegate",pathParams:[],flags:[{name:"taskTag",coerce:null,optional:!1},{name:"task",coerce:null,optional:!1},{name:"teamGid",coerce:null,optional:!0},{name:"priority",coerce:null,optional:!0}],scopes:["teams:write"],idempotent:!0,isQuery:!1,summary:"Delegate a task by tag (action) over the customer edge."},{key:"primus.teams.list",commandPath:["primus","teams","list"],opId:"GET /v1/primus/teams",method:"GET",pattern:"/v1/primus/teams",pathParams:[],flags:[{name:"status",coerce:null,optional:!0}],scopes:["teams:read"],idempotent:!1,isQuery:!0,summary:"List teams over the customer edge."},{key:"primus.teams.remove",commandPath:["primus","teams","remove"],opId:"DELETE /v1/primus/teams/:teamId",method:"DELETE",pattern:"/v1/primus/teams/:teamId",pathParams:[{name:"teamGid",key:"teamId"}],flags:[{name:"reason",coerce:null,optional:!0}],scopes:["teams:admin"],idempotent:!0,isQuery:!1,summary:"Remove (soft-delete) a team over the customer edge: the lead and every specialist are archived; a repeat is a visible no-op."},{key:"primus.teams.removeMember",commandPath:["primus","teams","removeMember"],opId:"POST /v1/primus/teams/remove-member",method:"POST",pattern:"/v1/primus/teams/remove-member",pathParams:[],flags:[{name:"specialistGid",coerce:null,optional:!1},{name:"reason",coerce:null,optional:!0}],scopes:["teams:admin"],idempotent:!0,isQuery:!1,summary:"Remove a team member over the customer edge."},{key:"primus.teams.retrieve",commandPath:["primus","teams","retrieve"],opId:"GET /v1/primus/teams/:teamId",method:"GET",pattern:"/v1/primus/teams/:teamId",pathParams:[{name:"teamGid",key:"teamId"}],flags:[],scopes:["teams:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a team over the customer edge."},{key:"primus.teams.unassignAgent",commandPath:["primus","teams","unassignAgent"],opId:"POST /v1/primus/teams/unassign",method:"POST",pattern:"/v1/primus/teams/unassign",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1}],scopes:["teams:write"],idempotent:!0,isQuery:!1,summary:"Unassign an agent from the team over the customer edge."},{key:"primus.teams.update",commandPath:["primus","teams","update"],opId:"PATCH /v1/primus/teams/:teamId",method:"PATCH",pattern:"/v1/primus/teams/:teamId",pathParams:[{name:"teamGid",key:"teamId"}],flags:[{name:"name",coerce:null,optional:!0},{name:"description",coerce:null,optional:!0},{name:"systemPrompt",coerce:null,optional:!0}],scopes:["teams:write"],idempotent:!0,isQuery:!1,summary:"Update a team over the customer edge."},{key:"primus.tenants.archive",commandPath:["primus","tenants","archive"],opId:"POST /v1/primus/tenants/:tenantId/archive",method:"POST",pattern:"/v1/primus/tenants/:tenantId/archive",pathParams:[{name:"tenantGid",key:"tenantId"}],flags:[],scopes:["tenants:admin"],idempotent:!0,isQuery:!1,summary:"Archive a tenant over the customer edge."},{key:"primus.tenants.create",commandPath:["primus","tenants","create"],opId:"POST /v1/primus/tenants",method:"POST",pattern:"/v1/primus/tenants",pathParams:[],flags:[{name:"externalId",coerce:null,optional:!1},{name:"name",coerce:null,optional:!1},{name:"metadata",coerce:"json",optional:!0}],scopes:["tenants:write"],idempotent:!0,isQuery:!1,summary:"Create a tenant over the customer edge."},{key:"primus.tenants.getByExternalId",commandPath:["primus","tenants","getByExternalId"],opId:"GET /v1/primus/tenants/by-external-id",method:"GET",pattern:"/v1/primus/tenants/by-external-id",pathParams:[],flags:[{name:"externalId",coerce:null,optional:!1}],scopes:["tenants:read"],idempotent:!1,isQuery:!0,summary:"Tenant by external id over the customer edge."},{key:"primus.tenants.list",commandPath:["primus","tenants","list"],opId:"GET /v1/primus/tenants",method:"GET",pattern:"/v1/primus/tenants",pathParams:[],flags:[],scopes:["tenants:read"],idempotent:!1,isQuery:!0,summary:"List tenants over the customer edge."},{key:"primus.tenants.retrieve",commandPath:["primus","tenants","retrieve"],opId:"GET /v1/primus/tenants/:tenantId",method:"GET",pattern:"/v1/primus/tenants/:tenantId",pathParams:[{name:"tenantGid",key:"tenantId"}],flags:[],scopes:["tenants:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a tenant over the customer edge."},{key:"primus.tenants.suspend",commandPath:["primus","tenants","suspend"],opId:"POST /v1/primus/tenants/:tenantId/suspend",method:"POST",pattern:"/v1/primus/tenants/:tenantId/suspend",pathParams:[{name:"tenantGid",key:"tenantId"}],flags:[],scopes:["tenants:write"],idempotent:!0,isQuery:!1,summary:"Suspend a tenant over the customer edge."},{key:"primus.tenants.update",commandPath:["primus","tenants","update"],opId:"PATCH /v1/primus/tenants/:tenantId",method:"PATCH",pattern:"/v1/primus/tenants/:tenantId",pathParams:[{name:"tenantGid",key:"tenantId"}],flags:[{name:"name",coerce:null,optional:!0},{name:"metadata",coerce:"json",optional:!0}],scopes:["tenants:write"],idempotent:!0,isQuery:!1,summary:"Update a tenant over the customer edge."},{key:"primus.tools.create",commandPath:["primus","tools","create"],opId:"POST /v1/primus/tools",method:"POST",pattern:"/v1/primus/tools",pathParams:[],flags:[{name:"name",coerce:null,optional:!1},{name:"description",coerce:null,optional:!1},{name:"parameters",coerce:"json",optional:!0},{name:"outputSchema",coerce:"json",optional:!0},{name:"riskLevel",coerce:null,optional:!1,choices:["safe","moderate","dangerous"]},{name:"requiresApproval",coerce:"boolean",optional:!0},{name:"endpoint",coerce:null,optional:!0},{name:"uri",coerce:null,optional:!0},{name:"authType",coerce:null,optional:!0,choices:["none","bearer","apiKey","basic","oauth","hmac"]},{name:"scopes",coerce:"json",optional:!0},{name:"executor",coerce:null,optional:!0,choices:["webhook","inline","dynamic_worker","container","gpu","openshell"]},{name:"timeout",coerce:"number",optional:!0},{name:"category",coerce:null,optional:!0},{name:"headers",coerce:"json",optional:!0},{name:"slug",coerce:null,optional:!0}],scopes:["tools:write"],idempotent:!0,isQuery:!1,summary:"Create a tool (action) over the customer edge."},{key:"primus.tools.disable",commandPath:["primus","tools","disable"],opId:"POST /v1/primus/tools/:toolId/disable",method:"POST",pattern:"/v1/primus/tools/:toolId/disable",pathParams:[{name:"toolGid",key:"toolId"}],flags:[],scopes:["tools:admin"],idempotent:!0,isQuery:!1,summary:"Disable a tool over the customer edge."},{key:"primus.tools.discover",commandPath:["primus","tools","discover"],opId:"GET /v1/tools",method:"GET",pattern:"/v1/tools",pathParams:[],flags:[{name:"source",coerce:null,optional:!0,choices:["builtin","skill","mcp","integration"]},{name:"enabledOnly",coerce:"boolean",optional:!0}],scopes:["tools:read"],idempotent:!1,isQuery:!0,summary:"Discover registered tools over the customer edge \u2014 the external-agent discovery door (/v1/tools)."},{key:"primus.tools.enable",commandPath:["primus","tools","enable"],opId:"POST /v1/primus/tools/:toolId/enable",method:"POST",pattern:"/v1/primus/tools/:toolId/enable",pathParams:[{name:"toolGid",key:"toolId"}],flags:[],scopes:["tools:write"],idempotent:!0,isQuery:!1,summary:"Enable a tool over the customer edge."},{key:"primus.tools.getByName",commandPath:["primus","tools","getByName"],opId:"GET /v1/primus/tools/by-name",method:"GET",pattern:"/v1/primus/tools/by-name",pathParams:[],flags:[{name:"name",coerce:null,optional:!1}],scopes:["tools:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a tool by name over the customer edge."},{key:"primus.tools.getStats",commandPath:["primus","tools","getStats"],opId:"GET /v1/primus/tools/stats",method:"GET",pattern:"/v1/primus/tools/stats",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!0},{name:"toolName",coerce:null,optional:!0},{name:"startTime",coerce:"number",optional:!0},{name:"endTime",coerce:"number",optional:!0},{name:"limit",coerce:"number",optional:!0}],scopes:["tools:read"],idempotent:!1,isQuery:!0,summary:"Tool usage stats over the customer edge."},{key:"primus.tools.importFromOpenApi",commandPath:["primus","tools","importFromOpenApi"],opId:"POST /v1/primus/tools/import",method:"POST",pattern:"/v1/primus/tools/import",pathParams:[],flags:[{name:"uri",coerce:null,optional:!0},{name:"specJson",coerce:null,optional:!0},{name:"authType",coerce:null,optional:!0,choices:["bearer","apiKey","basic","none"]},{name:"authTokenFrom",coerce:null,optional:!0},{name:"authHeaderName",coerce:null,optional:!0},{name:"authIn",coerce:null,optional:!0,choices:["header","query"]},{name:"include",coerce:"json",optional:!0},{name:"exclude",coerce:"json",optional:!0}],scopes:["tools:write"],idempotent:!0,isQuery:!1,summary:"Import tools from OpenAPI (action) over the customer edge."},{key:"primus.tools.list",commandPath:["primus","tools","list"],opId:"GET /v1/primus/tools",method:"GET",pattern:"/v1/primus/tools",pathParams:[],flags:[{name:"source",coerce:null,optional:!0,choices:["builtin","skill","mcp","integration"]},{name:"enabledOnly",coerce:"boolean",optional:!0}],scopes:["tools:read"],idempotent:!1,isQuery:!0,summary:"List tools over the customer edge."},{key:"primus.tools.remove",commandPath:["primus","tools","remove"],opId:"DELETE /v1/primus/tools/:toolId",method:"DELETE",pattern:"/v1/primus/tools/:toolId",pathParams:[{name:"toolGid",key:"toolId"}],flags:[],scopes:["tools:admin"],idempotent:!0,isQuery:!1,summary:"Delete a tool over the customer edge."},{key:"primus.tools.retrieve",commandPath:["primus","tools","retrieve"],opId:"GET /v1/primus/tools/:toolId",method:"GET",pattern:"/v1/primus/tools/:toolId",pathParams:[{name:"toolGid",key:"toolId"}],flags:[],scopes:["tools:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a tool over the customer edge."},{key:"primus.tools.testCall",commandPath:["primus","tools","testCall"],opId:"POST /v1/primus/tools/:toolId/test",method:"POST",pattern:"/v1/primus/tools/:toolId/test",pathParams:[{name:"toolGid",key:"toolId"}],flags:[{name:"inputs",coerce:"json",optional:!1}],scopes:["tools:write"],idempotent:!0,isQuery:!1,summary:"Test-call a tool (action) over the customer edge."},{key:"primus.tools.update",commandPath:["primus","tools","update"],opId:"PATCH /v1/primus/tools/:toolId",method:"PATCH",pattern:"/v1/primus/tools/:toolId",pathParams:[{name:"toolGid",key:"toolId"}],flags:[{name:"description",coerce:null,optional:!0},{name:"parameters",coerce:"json",optional:!0},{name:"outputSchema",coerce:"json",optional:!0},{name:"riskLevel",coerce:null,optional:!0,choices:["safe","moderate","dangerous"]},{name:"requiresApproval",coerce:"boolean",optional:!0},{name:"endpoint",coerce:null,optional:!0},{name:"executor",coerce:null,optional:!0,choices:["webhook","inline","dynamic_worker","container","gpu","openshell"]},{name:"timeout",coerce:"number",optional:!0},{name:"category",coerce:null,optional:!0},{name:"secretRef",coerce:null,optional:!0},{name:"headers",coerce:"json",optional:!0}],scopes:["tools:write"],idempotent:!0,isQuery:!1,summary:"Update a tool over the customer edge."},{key:"primus.triggers.create",commandPath:["primus","triggers","create"],opId:"POST /v1/primus/triggers",method:"POST",pattern:"/v1/primus/triggers",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"name",coerce:null,optional:!1},{name:"slug",coerce:null,optional:!0},{name:"description",coerce:null,optional:!0},{name:"type",coerce:null,optional:!1},{name:"config",coerce:"json",optional:!1},{name:"action",coerce:"json",optional:!1},{name:"conditions",coerce:"json",optional:!0},{name:"enabled",coerce:"boolean",optional:!0}],scopes:["triggers:write"],idempotent:!0,isQuery:!1,summary:"Create a trigger over the customer edge (type: cron, event, webhook or message)."},{key:"primus.triggers.disable",commandPath:["primus","triggers","disable"],opId:"POST /v1/primus/triggers/:triggerId/disable",method:"POST",pattern:"/v1/primus/triggers/:triggerId/disable",pathParams:[{name:"triggerGid",key:"triggerId"}],flags:[],scopes:["triggers:write"],idempotent:!0,isQuery:!1,summary:"Disable a trigger over the customer edge."},{key:"primus.triggers.enable",commandPath:["primus","triggers","enable"],opId:"POST /v1/primus/triggers/:triggerId/enable",method:"POST",pattern:"/v1/primus/triggers/:triggerId/enable",pathParams:[{name:"triggerGid",key:"triggerId"}],flags:[],scopes:["triggers:write"],idempotent:!0,isQuery:!1,summary:"Enable a trigger over the customer edge."},{key:"primus.triggers.getWithExecutions",commandPath:["primus","triggers","getWithExecutions"],opId:"GET /v1/primus/triggers/:triggerId/executions",method:"GET",pattern:"/v1/primus/triggers/:triggerId/executions",pathParams:[{name:"triggerGid",key:"triggerId"}],flags:[{name:"executionLimit",coerce:"number",optional:!0}],scopes:["triggers:read"],idempotent:!1,isQuery:!0,summary:"Trigger with executions over the customer edge."},{key:"primus.triggers.list",commandPath:["primus","triggers","list"],opId:"GET /v1/primus/triggers",method:"GET",pattern:"/v1/primus/triggers",pathParams:[],flags:[{name:"type",coerce:null,optional:!0,choices:["cron","event","webhook","message"]},{name:"enabled",coerce:"boolean",optional:!0}],scopes:["triggers:read"],idempotent:!1,isQuery:!0,summary:"List triggers over the customer edge."},{key:"primus.triggers.listByAgent",commandPath:["primus","triggers","listByAgent"],opId:"GET /v1/primus/triggers/by-agent",method:"GET",pattern:"/v1/primus/triggers/by-agent",pathParams:[],flags:[{name:"agentGid",coerce:null,optional:!1},{name:"enabledOnly",coerce:"boolean",optional:!0}],scopes:["triggers:read"],idempotent:!1,isQuery:!0,summary:"List an agent triggers over the customer edge."},{key:"primus.triggers.remove",commandPath:["primus","triggers","remove"],opId:"DELETE /v1/primus/triggers/:triggerId",method:"DELETE",pattern:"/v1/primus/triggers/:triggerId",pathParams:[{name:"triggerGid",key:"triggerId"}],flags:[],scopes:["triggers:admin"],idempotent:!0,isQuery:!1,summary:"Delete a trigger over the customer edge."},{key:"primus.triggers.retrieve",commandPath:["primus","triggers","retrieve"],opId:"GET /v1/primus/triggers/:triggerId",method:"GET",pattern:"/v1/primus/triggers/:triggerId",pathParams:[{name:"triggerGid",key:"triggerId"}],flags:[],scopes:["triggers:read"],idempotent:!1,isQuery:!0,summary:"Retrieve a trigger over the customer edge."},{key:"primus.triggers.rotateSecret",commandPath:["primus","triggers","rotateSecret"],opId:"POST /v1/primus/triggers/:triggerId/rotate-secret",method:"POST",pattern:"/v1/primus/triggers/:triggerId/rotate-secret",pathParams:[{name:"triggerGid",key:"triggerId"}],flags:[],scopes:["triggers:write"],idempotent:!1,isQuery:!1,summary:"Rotate a webhook trigger's signing secret over the customer edge (the new secret is returned once)."},{key:"primus.triggers.update",commandPath:["primus","triggers","update"],opId:"PATCH /v1/primus/triggers/:triggerId",method:"PATCH",pattern:"/v1/primus/triggers/:triggerId",pathParams:[{name:"triggerGid",key:"triggerId"}],flags:[{name:"name",coerce:null,optional:!0},{name:"description",coerce:null,optional:!0},{name:"config",coerce:"json",optional:!0},{name:"action",coerce:"json",optional:!0},{name:"conditions",coerce:"json",optional:!0},{name:"enabled",coerce:"boolean",optional:!0}],scopes:["triggers:write"],idempotent:!0,isQuery:!1,summary:"Update a trigger over the customer edge."},{key:"primus.usage.byTenant",commandPath:["primus","usage","byTenant"],opId:"GET /v1/primus/usage/by-tenant",method:"GET",pattern:"/v1/primus/usage/by-tenant",pathParams:[],flags:[{name:"tenantId",coerce:null,optional:!1},{name:"dayUtcMs",coerce:"number",optional:!1}],scopes:["billing:read"],idempotent:!1,isQuery:!0,summary:"Usage by tenant over the customer edge."},{key:"primus.usage.checkLimits",commandPath:["primus","usage","checkLimits"],opId:"GET /v1/primus/usage/limits",method:"GET",pattern:"/v1/primus/usage/limits",pathParams:[],flags:[],scopes:["billing:read"],idempotent:!1,isQuery:!0,summary:"Usage limits over the customer edge."},{key:"primus.usage.getHistory",commandPath:["primus","usage","getHistory"],opId:"GET /v1/primus/usage/history",method:"GET",pattern:"/v1/primus/usage/history",pathParams:[],flags:[{name:"startMs",coerce:"number",optional:!1},{name:"endMs",coerce:"number",optional:!1},{name:"granularity",coerce:null,optional:!0,choices:["hour","day","week"]}],scopes:["billing:read"],idempotent:!1,isQuery:!0,summary:"Usage history over the customer edge."},{key:"primus.usage.getSummary",commandPath:["primus","usage","getSummary"],opId:"GET /v1/primus/usage/summary",method:"GET",pattern:"/v1/primus/usage/summary",pathParams:[],flags:[{name:"tenantId",coerce:null,optional:!0}],scopes:["billing:read"],idempotent:!1,isQuery:!0,summary:"Usage summary over the customer edge."},{key:"primus.webhooks.create",commandPath:["primus","webhooks","create"],opId:"POST /v1/primus/webhooks",method:"POST",pattern:"/v1/primus/webhooks",pathParams:[],flags:[{name:"url",coerce:null,optional:!1},{name:"events",coerce:"json",optional:!0}],scopes:["agent_webhooks:write"],idempotent:!1,isQuery:!1,summary:"Register an agent-event webhook endpoint for the caller's app + environment; the signing secret is answered exactly once."},{key:"primus.webhooks.list",commandPath:["primus","webhooks","list"],opId:"GET /v1/primus/webhooks",method:"GET",pattern:"/v1/primus/webhooks",pathParams:[],flags:[],scopes:["agent_webhooks:read"],idempotent:!1,isQuery:!0,summary:"List the caller's agent-event webhook endpoints (never the signing secret)."},{key:"primus.webhooks.remove",commandPath:["primus","webhooks","remove"],opId:"DELETE /v1/primus/webhooks/:webhookId",method:"DELETE",pattern:"/v1/primus/webhooks/:webhookId",pathParams:[{name:"webhookId",key:"webhookId"}],flags:[],scopes:["agent_webhooks:write"],idempotent:!0,isQuery:!1,summary:"Remove an agent-event webhook endpoint by gid (idempotent)."}]}});function HT(e,t){return!1}var WT=P(()=>{"use strict";s(HT,"isOperatorDoor")});var ZT={};me(ZT,{adminExtraCommands:()=>Xl,loadExtraCommandRows:()=>Pg,loadPrimusCliCommands:()=>ui,pipesExtraCommands:()=>ed});function Sg(e){return!HT(e.method,e.pattern)}async function ui(){let e=JT.CLI_COMMANDS;return{...e,commands:e.commands.filter(Sg)}}function Xl(){let e=new Set(ye.commands.map(t=>t.key));return zT.commands.filter(t=>!e.has(t.key)&&Sg(t))}function ed(){let e=new Set(ye.commands.map(r=>r.key));return KT.commands.filter(r=>!e.has(r.key)&&Sg(r))}async function Pg(){let e=await ui(),t=new Set(ye.commands.map(r=>r.key));return[...e.commands,...Xl(),...ed()].filter(r=>!t.has(r.key))}var JT,td=P(()=>{"use strict";Vr();BT();QT();JT=K(VT());WT();s(Sg,"customerRow");s(ui,"loadPrimusCliCommands");s(Xl,"adminExtraCommands");s(ed,"pipesExtraCommands");s(Pg,"loadExtraCommandRows")});function VL(e){return QL.test(e)?!0:XT.test(e)&&$m(e)}function Ig(e){for(let t of e){if(typeof t!="string"||t.trim()==="")throw new co(String(t),"every scope MUST be a non-empty string");if(t==="*")throw new co(t,"the literal wildcard `*` is forbidden (zero-wildcard invariant)");if(t.includes("*"))throw new co(t,"wildcard / `<namespace>:*` roll-up forms are forbidden (zero-wildcard invariant); declare each concrete <resource>:<action>");if(!VL(t))throw new co(t,"must be a concrete `<resource>:<action>` scope where <action> is one of read|write|execute|admin, or a catalog-listed exception (none exist while audit:export is retired)")}}function pi(e){return XT.test(e)&&$m(e)}function HL(e){return NS(e)}function lo(e){Ig(e);for(let t of e)if(!pi(t)){let r=HL(t);throw new co(t,"is not in the npayload permission catalog"+(r?` \u2014 did you mean "${r}"?`:""))}}var QL,XT,co,mi=P(()=>{"use strict";qo();QL=/^[a-z][a-z0-9_-]*:(read|write|execute|admin)$/,XT=/^[a-z][a-z0-9_-]*:[a-z][a-z0-9_-]*$/,co=class extends Error{static{s(this,"AccessScopeError")}scope;constructor(t,r){super(`npayload.toml [access_scopes]: ${r} \u2014 offending scope "${t}"`),this.name="AccessScopeError",this.scope=t}};s(VL,"isConcreteScope");s(Ig,"validateAccessScopes");s(pi,"isCatalogScope");s(HL,"suggestCatalogScope");s(lo,"validateAccessScopesCatalog")});function na(e,t,r){for(let o of Object.keys(e))if(!t.has(o)){let n=r===""?o:`${r}.${o}`;throw new At(`unknown key \`${n}\` \u2014 the manifest schema is strict (allowed here: ${[...t].join(", ")}); remove it or fix the typo`,r===""?o:r)}}function ra(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function tD(e,t,r){let o=e[t];if(typeof o!="string"||o.trim()==="")throw new At(`missing required string \`${t}\``,r);return o}function Tg(e,t){let r=e[t];return typeof r=="string"&&r.trim()!==""?r:void 0}function _g(e){return typeof e=="string"&&tx.includes(e)}function Rg(e){let t=(0,ex.parse)(e);na(t,JL,"");let r=ra(t.app);if(!r)throw new At("missing required table","app");na(r,ZL,"app");let o={slug:tD(r,"slug","app")},n=Tg(r,"name");n!==void 0&&(o.name=n);let i=ra(t.env);if(!i||Object.keys(i).length===0)throw new At('at least one `[env.<slug>]` section is required (e.g. `[env.sandbox]` with `kind = "development"`)',"env");let a=[];for(let[p,f]of Object.entries(i)){let g=`env.${p}`;if(!WL.test(p))throw new At(`invalid environment slug \`${p}\` \u2014 use 2-31 chars, lowercase letter first, then lowercase letters, digits, or dashes`,g);let h=ra(f);if(!h)throw new At("must be a table (`[env.<slug>]` section)",g);na(h,YL,g);let y=h.kind;if(!_g(y))throw new At(`\`kind\` MUST be one of ${tx.join(" | ")}, got ${JSON.stringify(y)} (env slug "${p}")`,g);let v={name:Tg(h,"name")??p,slug:p,kind:y},S=Tg(h,"deploy_branch");S!==void 0&&(v.deployBranch=S),a.push(v)}let c=ra(t.access_scopes);if(!c)throw new At("missing required table","access_scopes");na(c,XL,"access_scopes");let l=c.scopes;if(l!==void 0&&!Array.isArray(l))throw new At("`scopes` must be an array of strings","access_scopes");let d=(l??[]).map(p=>String(p));Ig(d);let u=ra(t.embed),m=[];if(u){na(u,eD,"embed");let p=u.components;if(p!==void 0&&!Array.isArray(p))throw new At("`components` must be an array of component ids","embed");m=(p??[]).map(f=>String(f)),rT(m)}return{app:o,environments:a,accessScopes:d,embedComponents:m}}function Ne(e=process.cwd()){let t=fi(e);if(!t)return null;let r=Rg((0,nd.readFileSync)(t,"utf8"));return r.path=t,r}function fi(e=process.cwd()){let t=(0,uo.isAbsolute)(e)?e:(0,uo.resolve)(process.cwd(),e);for(let r=0;r<6;r++){let o=(0,uo.join)(t,xg);if((0,nd.existsSync)(o))return o;let n=(0,uo.join)(t,"..");if(n===t)break;t=n}return null}var nd,uo,ex,tx,WL,At,xg,JL,ZL,YL,XL,eD,Zt=P(()=>{"use strict";nd=require("fs"),uo=require("path"),ex=require("smol-toml");mi();Bs();tx=["development","production"],WL=/^[a-z][a-z0-9-]{1,30}$/,At=class extends Error{static{s(this,"ManifestError")}block;constructor(t,r){super(`npayload.toml [${r}]: ${t}`),this.name="ManifestError",this.block=r}},xg="npayload.toml",JL=new Set(["app","env","access_scopes","embed"]),ZL=new Set(["slug","name"]),YL=new Set(["name","kind","deploy_branch"]),XL=new Set(["scopes"]),eD=new Set(["components"]);s(na,"rejectUnknownKeys");s(ra,"asTable");s(tD,"reqString");s(Tg,"optString");s(_g,"isEnvironmentKind");s(Rg,"parseManifest");s(Ne,"loadManifest");s(fi,"findManifest")});var yi,ld=P(()=>{"use strict";yi={agents:{identity:"slug",deps:["skills"],refs:{skills:{parent:"skills",product:"primus",wire:"gid",identity:"name",array:!0,publicField:"skills"}},ops:{create:{convexFn:"",method:"POST",pattern:"/v1/primus/agents",scopes:["agents:write"]},list:{convexFn:"",method:"GET",pattern:"/v1/primus/agents",scopes:["agents:read"]},update:{convexFn:"",method:"PATCH",pattern:"/v1/primus/agents/:agentId",scopes:["agents:write"],pathParams:{agentId:"agentGid"},updatable:["name","description","systemPrompt","personality","language","skills","enabledIntegrations","trustLevel","defaultModel","maxTurns","config"]}}},skills:{identity:"slug",deps:[],refs:{},ops:{create:{convexFn:"",method:"POST",pattern:"/v1/primus/skills",scopes:["skills:write"]},list:{convexFn:"",method:"GET",pattern:"/v1/primus/skills",scopes:["skills:read"]},update:{convexFn:"",method:"PATCH",pattern:"/v1/primus/skills/:skillId",scopes:["skills:write"],pathParams:{skillId:"skillGid"},updatable:["name","description","category","icon","executor","enabled","definition","limits"]}}},tools:{identity:"slug",deps:[],refs:{},ops:{create:{convexFn:"",method:"POST",pattern:"/v1/primus/tools",scopes:["tools:write"]},list:{convexFn:"",method:"GET",pattern:"/v1/primus/tools",scopes:["tools:read"]},update:{convexFn:"",method:"PATCH",pattern:"/v1/primus/tools/:toolId",scopes:["tools:write"],pathParams:{toolId:"toolGid"},updatable:["description","parameters","outputSchema","riskLevel","requiresApproval","endpoint","executor","timeout","category","secretRef","headers"]}}},triggers:{identity:"slug",deps:["agents"],refs:{agentGid:{parent:"agents",product:"primus",wire:"gid",identity:"slug",array:!1,publicField:"agentGid"}},ops:{create:{convexFn:"",method:"POST",pattern:"/v1/primus/triggers",scopes:["triggers:write"]},update:{convexFn:"",method:"PATCH",pattern:"/v1/primus/triggers/:triggerId",scopes:["triggers:write"],pathParams:{triggerId:"triggerGid"},updatable:["name","description","config","action","conditions","enabled"]},list:{convexFn:"",method:"GET",pattern:"/v1/primus/triggers",scopes:["triggers:read"]}}}}});var bx,wx=P(()=>{"use strict";bx={bridges:{identity:"targetOrgGID",deps:[],refs:{},ops:{create:{convexFn:"",method:"POST",pattern:"/v1/connect/bridges",scopes:["bridges:write"]}}}}});var dd,Cg=P(()=>{"use strict";dd={credentials:{identity:"name",deps:[],refs:{},ops:{list:{convexFn:"",method:"GET",pattern:"/v1/pipes/credentials",scopes:["credentials:read"]},create:{convexFn:"",method:"POST",pattern:"/v1/pipes/credentials",scopes:["credentials:write"]}}},governance:{identity:"app",deps:[],refs:{},ops:{list:{convexFn:"",method:"GET",pattern:"/v1/pipes/governance",scopes:["pipes:read"]},create:{convexFn:"",method:"PATCH",pattern:"/v1/pipes/governance",scopes:["pipes:write"]}},singleton:!0},workflows:{identity:"name",deps:[],refs:{},ops:{create:{convexFn:"",method:"POST",pattern:"/v1/pipes/workflows",scopes:["pipes:write"]},remove:{convexFn:"",method:"DELETE",pattern:"/v1/pipes/workflows/:workflowId",scopes:["pipes:admin"],pathParams:{workflowId:"workflowGid"}},list:{convexFn:"",method:"GET",pattern:"/v1/pipes/workflows",scopes:["pipes:read"]},update:{convexFn:"",method:"PATCH",pattern:"/v1/pipes/workflows/:workflowId/meta",scopes:["pipes:write"],pathParams:{workflowId:"workflowGid"},updatable:["description"]}}}}});var Ex={};me(Ex,{AuthError:()=>fr,findProjectCredentials:()=>pd,resolveCredentials:()=>Bn,tryResolveCredentials:()=>pD});function pd(){let e=process.cwd(),t=e;for(let r=0;r<5;r++){let o=(0,Ng.join)(t,".npayload.json");if((0,ud.existsSync)(o))try{let i=JSON.parse((0,ud.readFileSync)(o,"utf8"));return t!==e&&process.stderr.write(`npayload: using app credentials from a parent directory (${o}). Run from the project root, or set NPAYLOAD_CLIENT_ID/NPAYLOAD_TOKEN, if this is not the app you intend.
|
|
22
|
+
`),i}catch{return null}let n=(0,Ng.join)(t,"..");if(n===t)break;t=n}return null}async function Bn(){let e=process.env.NPAYLOAD_TOKEN?.trim()||void 0,t=process.env.NPAYLOAD_CLIENT_ID?.trim()||void 0,r=(process.env.NPAYLOAD_CLIENT_SECRET??process.env.NPAYLOAD_HMAC_SECRET)?.trim()||void 0;if(e)return{clientId:t??"",hmacSecret:r??"",accessToken:e,source:"env_token"};if(t&&r)return{clientId:t,hmacSecret:r,source:"env"};let o=pd();if(o?.clientId&&o?.hmacSecret)return{clientId:o.clientId,hmacSecret:o.hmacSecret,source:"project",...o.dpopPrivateJwk!==void 0?{dpopPrivateJwk:o.dpopPrivateJwk}:{}};try{let n=await Vl();if(n?.clientId&&n?.hmacSecret)return{clientId:n.clientId,hmacSecret:n.hmacSecret,source:"keychain",...n.dpopPrivateJwk!==void 0?{dpopPrivateJwk:n.dpopPrivateJwk}:{}}}catch(n){throw n instanceof yn?new fr(`${n.message}
|
|
23
|
+
|
|
24
|
+
${kx}`):n}throw new fr(kx)}async function pD(){try{return await Bn()}catch{return null}}var ud,Ng,fr,kx,vi=P(()=>{"use strict";ud=require("fs"),Ng=require("path");Xs();fr=class extends Error{static{s(this,"AuthError")}constructor(t){super(t),this.name="AuthError"}},kx="Not authenticated. Run `npayload login` (interactive, stores in the OS keychain), or for CI / headless set NPAYLOAD_CLIENT_ID + NPAYLOAD_CLIENT_SECRET (or NPAYLOAD_TOKEN for a short-lived token). Run `npayload doctor` to check this host.";s(pd,"findProjectCredentials");s(Bn,"resolveCredentials");s(pD,"tryResolveCredentials")});function Dg(e){if(e===null||typeof e!="object")return!1;let t=e;return t.kty==="EC"&&t.crv==="P-256"&&["d","x","y"].every(r=>typeof t[r]=="string"&&t[r].length>0)}function Sx(e){let t=e[Lg]?.trim();if(!t)return;let r;try{r=JSON.parse(t)}catch{throw new TypeError(`${Lg} is set but is not a JSON Web Key. Set it to the key \`npx @npayload/sdk init\` wrote, or unset it.`)}if(!Dg(r))throw new TypeError(`${Lg} is set but is not an ES256 (P-256) private key. Set it to the key \`npx @npayload/sdk init\` wrote, or unset it.`);return r}var Lg,Px=P(()=>{"use strict";Lg="NPAYLOAD_DPOP_PRIVATE_JWK";s(Dg,"isSigningDpopJwk");s(Sx,"persistedDpopKey")});function bi(e){let t=e.env.NPAYLOAD_DPOP_JWK?.trim();if(t)try{return JSON.parse(t)}catch{throw new TypeError("NPAYLOAD_DPOP_JWK is set but is not a JSON Web Key. Set it to an ES256 private key, or unset it.")}let r=Sx(e.env);return r!==void 0?r:Dg(e.credentialKey)?e.credentialKey:void 0}var md=P(()=>{"use strict";Px();s(bi,"resolveCliDpopKey")});function sa(){return Object.keys(Ix)}function Kn(e){return Ix[e]??[]}function Qn(e,t){let r=e;for(let o of t.split(".")){if(r==null||typeof r!="object")return;r=r[o]}return r}function Gg(e,t,r){let o=t.split("."),n=e;for(let i=0;i<o.length-1;i++){let a=o[i],c=n[a];(c==null||typeof c!="object"||Array.isArray(c))&&(n[a]={}),n=n[a]}n[o[o.length-1]]=r}function po(e){return e==null?null:typeof e=="string"?[e]:Array.isArray(e)&&e.every(t=>typeof t=="string")?e:null}function fd(e,t){if(e.length!==t.length)return!1;let r=new Set(e);return t.every(o=>r.has(o))}function Tx(e,t){let r=new Map,o=e.get(t);if(o)for(let[n,i]of o)r.set(i,n);return r}function xx(e,t,r){if(t.wire==="name")return{resolved:[...e],unresolved:null};let o=r.get(t.parent),n=[];for(let i of e){if(Ug(i))return{resolved:n,unresolved:i};let a=o?.get(i);if(!a)return{resolved:n,unresolved:i};n.push(a)}return{resolved:n,unresolved:null}}function Ug(e){return e.split("_").length===2&&/^[a-z]{2,4}_[A-Za-z0-9]*[0-9][A-Za-z0-9]*$/.test(e)}var Ix,aa=P(()=>{"use strict";Ix={agents:[{path:"skills",publicField:"skillGids",parent:"skills",wire:"gid",array:!0,label:"skills"}],skills:[{path:"definition.tools",publicField:"definition.tools",parent:"tools",wire:"name",array:!0,label:"tools"}],triggers:[{path:"agentGid",publicField:"agentGid",parent:"agents",wire:"gid",array:!1,label:"agent"},{path:"action.skillIds",publicField:"action.skillGids",parent:"skills",wire:"gid",array:!0,label:"skills"}]};s(sa,"relationResources");s(Kn,"refSpecsForResource");s(Qn,"getAtPath");s(Gg,"setAtPath");s(po,"refNames");s(fd,"sameNameSet");s(Tx,"gidToNameFor");s(xx,"resolveRefNames");s(Ug,"isGid")});function gd(e=process.cwd()){let t=(0,gr.isAbsolute)(e)?e:(0,gr.resolve)(process.cwd(),e);return(0,gr.join)(t,mD)}function _x(e=process.cwd()){return(0,gr.join)(gd(e),fD)}function Rx(e=process.cwd()){return(0,gr.join)(gd(e),gD)}function ca(e=process.cwd()){let t=_x(e);if((0,$t.existsSync)(t))try{let r=JSON.parse((0,$t.readFileSync)(t,"utf8"));return typeof r.slug=="string"&&r.slug.trim()!==""?r.slug:void 0}catch{return}}function Ax(e,t=process.cwd()){let r=gd(t);(0,$t.mkdirSync)(r,{recursive:!0}),(0,$t.writeFileSync)(_x(t),JSON.stringify({slug:e},null,2)+`
|
|
25
|
+
`,{mode:384})}function Ox(e=process.cwd()){let t=Rx(e);if(!(0,$t.existsSync)(t))return[];try{let r=JSON.parse((0,$t.readFileSync)(t,"utf8"));return Array.isArray(r.environments)?r.environments:[]}catch{return[]}}function $x(e,t=process.cwd()){let r=gd(t);(0,$t.mkdirSync)(r,{recursive:!0}),(0,$t.writeFileSync)(Rx(t),JSON.stringify({environments:e},null,2)+`
|
|
26
|
+
`,{mode:384})}var $t,gr,mD,fD,gD,la=P(()=>{"use strict";$t=require("fs"),gr=require("path"),mD=".npayload",fD="active-env.json",gD="environments.json";s(gd,"stateDir");s(_x,"activeEnvPath");s(Rx,"knownEnvsPath");s(ca,"getActiveEnv");s(Ax,"setActiveEnv");s(Ox,"getKnownEnvs");s($x,"saveKnownEnvs")});function hD(e){let t=e.explicitSlug??e.activeSlug;if(!t)throw new wi("No target environment. Pass `--env <slug>` or set an active environment with `np env use <slug>`.");let r=e.environments.filter(o=>o.slug===t);if(r.length===0){let o=e.environments.map(n=>n.slug).join(", ")||"(none declared)";throw new wi(`Unknown environment "${t}". Declared environments: ${o}.`)}if(r.length>1)throw new wi(`Environment slug "${t}" is ambiguous \u2014 it matches ${r.length} environments. Fix the duplicate slug in npayload.toml.`);return r[0]}function hr(e={}){let t=e.explicitSlug?.trim();if(t)return t;let r=e.manifest!==void 0?e.manifest:Ne(e.cwd),o=e.activeSlug!==void 0?e.activeSlug??void 0:ca(e.cwd),n=r?r.environments.map(c=>({slug:c.slug,kind:c.kind})):[],i=o?.trim();if(i)return r&&hD({activeSlug:i,environments:n}),i;if(!r)return;let a=r.environments.filter(c=>c.kind==="development");if(a.length===1)return a[0].slug;throw new wi(r.environments.length===0?"npayload.toml declares no environments \u2014 add an [env.<slug>] section, or pass --env <slug> / set one with `np env use <slug>`.":`Cannot resolve a single target environment from npayload.toml (declared: ${r.environments.map(c=>c.slug).join(", ")}). Pass --env <slug> or set one with \`np env use <slug>\`.`)}var wi,da=P(()=>{"use strict";Zt();la();wi=class extends Error{static{s(this,"EnvResolutionError")}constructor(t){super(t),this.name="EnvResolutionError"}};s(hD,"resolveTargetEnv");s(hr,"resolveCliEnvSlug")});function hd(e){return typeof e=="string"&&e.length>0?e:void 0}function yD(e){let t=e.split(".");if(t.length<2)return{};try{let r=Buffer.from(t[1].replace(/-/g,"+").replace(/_/g,"/"),"base64").toString("utf8");return JSON.parse(r)}catch{return{}}}function vD(e){return hd(e["npayload/appId"])??hd(e.appId)??hd(e.app)??hd(e.app_id)}function Cx(e=process.cwd()){for(let t=e,r=0;r<5;r++){let o=(0,jg.join)(t,".npayload.json");if((0,vd.existsSync)(o))try{let i=JSON.parse((0,vd.readFileSync)(o,"utf8"));if(typeof i.appId=="string"&&i.appId.startsWith("app_"))return i.appId}catch{}let n=(0,jg.join)(t,"..");if(n===t)break;t=n}}async function Mg(e,t){if(t.app)return t.app;let r=process.env.NPAYLOAD_APP_ID?.trim()||void 0;if(yd(r))return r;let o;try{let{token:n}=await e.auth.getAccessToken([]);o=vD(yD(n))}catch(n){F(n),o=void 0}return o||(yd(r)?r:Cx()??r)}function bD(e={}){if(yd(e.app)||e.app)return e.app;let t=process.env.NPAYLOAD_APP_ID?.trim()||void 0;return yd(t)?t:Cx(e.cwd)??t}function qg(e,t={}){let r=null;try{r=hr({...t.explicitEnv?{explicitSlug:t.explicitEnv}:{},...t.cwd?{cwd:t.cwd}:{}})??null}catch{r=null}return{org:e?.orgId?.()??null,app:bD(t.cwd?{cwd:t.cwd}:{})??null,env:r}}var vd,jg,yd,Fg=P(()=>{"use strict";vd=require("fs"),jg=require("path");da();se();s(hd,"str");s(yD,"decodeJwtClaims");s(vD,"appIdFromClaims");s(Cx,"appIdFromProjectFile");yd=s(e=>!!e&&e.startsWith("app_"),"isAppGid");s(Mg,"resolveAppId");s(bD,"resolveAppIdLocal");s(qg,"resolveWhoamiContext")});function Nx(e={}){let t=e.cwd,r=e.manifest!==void 0?e.manifest:Ne(t);if(!r||r.environments.length===0){if(e.explicitSlug)throw new Error(`--env ${e.explicitSlug} requires a npayload.toml declaring [env.${e.explicitSlug}]. Run \`npayload init\` to scaffold one.`);return null}let o=r.environments.filter(c=>c.kind==="production");if(o.length===0)throw new Error('npayload.toml declares no production environment \u2014 add `[env.production]` with `kind = "production"`. `np deploy` targets production only.');if(o.length>1)throw new Error(`npayload.toml declares ${o.length} production environments (${o.map(c=>c.slug).join(", ")}) \u2014 exactly one is permitted.`);let n=o[0];if(e.explicitSlug&&e.explicitSlug!==n.slug)throw new Error(`np deploy targets the production environment ("${n.slug}") only \u2014 "${e.explicitSlug}" is not it. For development environments use \`np env use ${e.explicitSlug}\` + \`np push\`.`);let a=(e.knownEnvs!==void 0?e.knownEnvs:Ox(t)).find(c=>c.slug===n.slug);return{slug:n.slug,kind:n.kind,...n.deployBranch?{deployBranch:n.deployBranch}:{},...a?.envId?{envId:a.envId}:{}}}var Lx=P(()=>{"use strict";Zt();la();s(Nx,"resolveDeployEnv")});function mo(e,t){let r=wD[e],o={method:r.method,path:r.path,scope:r.scope,envless:!0};if(e==="create"){let n=t;if(!n)throw new Y("env create requires --name, --slug and --kind");if(!_g(n.kind))throw new Y(`env create: --kind MUST be one of development | production, got "${String(n.kind)}"`);o.body={name:n.name,slug:n.slug,kind:n.kind,...n.deployBranch?{deployBranch:n.deployBranch}:{}}}else if(e==="show"){let n=t;if(!n?.slug)throw new Y("env show requires a <slug>");o.path=r.path.replace("{slug}",encodeURIComponent(n.slug))}else if(e==="clone"){let n=t;if(!n?.slug||!n.targetSlug)throw new Y("env clone requires <source-slug> and <target-slug>");o.path=r.path.replace("{slug}",encodeURIComponent(n.slug)),o.body={targetSlug:n.targetSlug,...n.targetName?{targetName:n.targetName}:{},...n.withData?{mode:"config_and_data"}:{},...n.confirmation?{confirmation:n.confirmation}:{}}}else if(e==="bind"){let n=t;if(!n?.slug)throw new Y("np deploy needs the production environment's slug");o.path=r.path.replace("{slug}",encodeURIComponent(n.slug))}return o}var wD,zg=P(()=>{"use strict";Zt();mn();wD={list:{method:"GET",path:"/v1/account/environments",scope:"account:read",idempotent:!0},create:{method:"POST",path:"/v1/account/environments",scope:"account:write",idempotent:!1},show:{method:"GET",path:"/v1/account/environments/{slug}",scope:"account:read",idempotent:!0},clone:{method:"POST",path:"/v1/account/environments/{slug}/clone",scope:"account:write",idempotent:!1},bind:{method:"POST",path:"/v1/account/environments/{slug}/bind",scope:"account:write",idempotent:!1}};s(mo,"buildEnvRequest")});function kD(e){if(e&&typeof e=="object"&&!Array.isArray(e)){let t=e,r=t.data;return r&&typeof r=="object"&&!Array.isArray(r)&&"bound"in r?r:t}return{}}async function Dx(e){let t=e.print??(()=>{}),r=kD(await e.send(mo("bind",{slug:e.slug}))),o={bound:r.bound===!0,created:r.created===!0,...typeof r.pool=="string"?{pool:r.pool}:{},...typeof r.cellId=="string"?{cellId:r.cellId}:{}};if(!o.bound)throw new Error(`production environment "${e.slug}" is not bound: nothing was deployed`);let n=o.cellId??"(cell id not returned)",i=o.pool?` (pool: ${o.pool})`:"";return t(o.created?`\u2192 production environment "${e.slug}" provisioned and bound to cell ${n}${i}`:`\u2192 production environment "${e.slug}" already bound to cell ${n}${i}`),o}var Gx=P(()=>{"use strict";zg();s(kD,"asRecord");s(Dx,"bindProductionBeforeDeploy")});function ED(e){return e.deployBranch?[e.deployBranch]:["main","master"]}function SD(e,t){let r=ED(e),o=t??"(detached or not a git repository)";return t&&r.includes(t)?{ok:!0}:{ok:!1,expected:r,current:o}}async function jx(e){let t=e.currentBranch!==void 0?e.currentBranch:PD(e.cwd),r=SD(e.env,t);if(r.ok)return;if(e.allowBranch!==void 0){if(t&&e.allowBranch===t)return;throw new bd(e.env.slug,r.expected,r.current)}if((e.isTTY??!!process.stdin.isTTY)&&e.confirm){let n=`You are on branch "${r.current}" but environment "${e.env.slug}" deploys from "${r.expected.join('" or "')}". Deploy from "${r.current}" anyway?`;if(await e.confirm(n))return}throw new bd(e.env.slug,r.expected,r.current)}function PD(e=process.cwd()){try{let t=(0,Ux.execFileSync)("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return t==="HEAD"||t===""?void 0:t}catch{return}}var Ux,bd,Mx=P(()=>{"use strict";Ux=require("child_process"),bd=class extends Error{static{s(this,"DeployBranchError")}expected;current;constructor(t,r,o){let n=r.join('" or "');super(`Refusing to deploy to environment "${t}" from branch "${o}". This environment deploys only from "${n}". Switch to "${n}" (or open a PR), or pass --allow-branch ${o} to deploy from this branch deliberately (CI).`),this.name="DeployBranchError",this.expected=r,this.current=o}};s(ED,"expectedDeployBranches");s(SD,"checkDeployBranch");s(jx,"enforceDeployBranchGuard");s(PD,"getCurrentBranch")});function Bg(e,t=0){if(!e||t>12)return"unknown";if(Array.isArray(e.enum)&&e.enum.length>0)return e.enum.map(o=>JSON.stringify(o)).join(" | ");switch(Array.isArray(e.type)?e.type[0]:e.type){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";case"array":return`Array<${Bg(e.items,t+1)}>`;case"object":{let o=e.properties??{},n=new Set(e.required??[]),i=Object.keys(o).sort();return i.length===0?"Record<string, unknown>":`{
|
|
27
|
+
${i.map(c=>{let l=n.has(c)?"":"?";return` ${JSON.stringify(c)}${l}: ${Bg(o[c],t+1)};`}).join(`
|
|
28
|
+
`)}
|
|
29
|
+
}`}default:return"unknown"}}function ID(e){return e.split(/[^a-zA-Z0-9]+/).filter(Boolean).map(t=>t[0].toUpperCase()+t.slice(1)).join("")}function Kg(e){let t=Object.keys(e).sort(),r=[],o=[];for(let a of t){let c=e[a];if(!c?.schema?.definition||(c.schema.format??"json_schema")!=="json_schema")continue;let l;try{l=JSON.parse(c.schema.definition)}catch{continue}let d=ID(a);r.push(`/** Payload of \`${a}\` (from events.config.ts). */
|
|
30
|
+
export type ${d} = ${Bg(l)};`),o.push(` ${JSON.stringify(a)}: ${d};`)}let n=r.join(`
|
|
31
|
+
|
|
32
|
+
`);return`/**
|
|
33
|
+
* GENERATED by \`npayload push\` / \`npayload deploy\` \u2014 DO NOT EDIT BY HAND.
|
|
34
|
+
*
|
|
35
|
+
* Typed event payloads projected from the schemas declared on eventTypes in
|
|
36
|
+
* events.config.ts. Use them to type your publishes and consumers:
|
|
37
|
+
*
|
|
38
|
+
* import type { EventPayloads } from "./npayload/_generated/events";
|
|
39
|
+
* const tick: EventPayloads["market.price.tick"] = { symbol: "BTC-USD", price: 64000 };
|
|
40
|
+
* await np.events.publish("prices", tick, { routingKey: "market.price.tick" });
|
|
41
|
+
*
|
|
42
|
+
* Change a schema in events.config.ts and re-run \`npayload push\` to
|
|
43
|
+
* regenerate (a schema change registers a NEW catalogue version \u2014 versions are
|
|
44
|
+
* append-only, existing consumers keep their pinned version).
|
|
45
|
+
*/
|
|
46
|
+
/* eslint-disable */
|
|
47
|
+
// contentHash: ${(0,qx.createHash)("sha256").update(n).digest("hex")}
|
|
48
|
+
|
|
49
|
+
${n}
|
|
50
|
+
|
|
51
|
+
/** Every declared event name \u2192 its payload type. */
|
|
52
|
+
export interface EventPayloads {
|
|
53
|
+
${o.join(`
|
|
54
|
+
`)}
|
|
55
|
+
}
|
|
56
|
+
`}function zx(e,t){if(!e)return 0;let r=Object.values(e).filter(o=>o?.schema?.definition).length;return r===0?0:((0,Fx.writeFileSync)(t,Kg(e),"utf8"),r)}var qx,Fx,Qg=P(()=>{"use strict";qx=require("crypto"),Fx=require("fs");s(Bg,"tsTypeFromJsonSchema");s(ID,"typeNameForEvent");s(Kg,"renderEventsDts");s(zx,"writeEventsDts")});var Hg={};me(Hg,{computePushGrant:()=>Ei,reconcileOpScopes:()=>Bx,syncCredentialScopes:()=>Vg,syncExactGrant:()=>TD});function Bx(){let e=new Set;for(let t of[ai,dd,yi])for(let r of Object.values(t))for(let o of Object.values(r.ops))for(let n of o.scopes??[])e.add(n);return e.add("account:read"),e.add("account:write"),[...e].sort()}function Ei(e){return[...new Set([...e,...Bx()])].sort()}async function Vg(e,t,r){if(!t){r(ki.default.dim(` (credential scopes not synced \u2014 no app id on this run)
|
|
57
|
+
`));return}try{let{restoreSession:o}=await Promise.resolve().then(()=>(_t(),di)),n=await o();if(!n){r(ki.default.dim(" (credential scopes not synced \u2014 run `npayload login` once to let push manage them)\n"));return}let i=Ei(e),c=(await n.provisionOac(null,t,!1,i)).allowedScopes?.length??i.length;r(ki.default.dim(` credential scopes \u2014 synced to the config (${c} per-object scope(s))
|
|
58
|
+
`))}catch(o){F(o);let n=o instanceof Error?o.message:String(o);r(ki.default.yellow(` (credential scopes not synced: ${n} \u2014 config is applied; re-run \`npayload push\` after \`npayload login\`)
|
|
59
|
+
`))}}async function TD(e,t,r=()=>{}){let o=[...new Set(e)].sort(),{restoreSession:n}=await Promise.resolve().then(()=>(_t(),di)),i=await n();if(!i)throw new Error("declared [access_scopes] sync needs the human management session \u2014 run `npayload login` (a machine credential can never widen its own grant).");let a=await i.provisionOac(null,t,!1,o),c=a.allowedScopes?.length??o.length;return r(ki.default.dim(` credential scopes \u2014 grant set-equal to the manifest (${c} scope(s))
|
|
60
|
+
`)),{allowedScopes:a.allowedScopes??o}}var ki,ua=P(()=>{"use strict";ki=K(require("chalk"));se();Ks();Cg();ld();s(Bx,"reconcileOpScopes");s(Ei,"computePushGrant");s(Vg,"syncCredentialScopes");s(TD,"syncExactGrant")});var Kx={};me(Kx,{projectPermissions:()=>pa,projectPipesPermissions:()=>Wg,projectPrimusPermissions:()=>Jg});function Ct(e){return!!e&&Object.keys(e).length>0}function xD(){let e={};for(let t of ye.commands)if(t.key.split(".")[0]==="events")for(let r of t.scopes??[]){let[o,n]=r.split(":");!o||!n||o!=="events"&&(e[o]??=new Set).add(n)}return e}function yr(e,t){for(let r of _D[t]??[])e.add(`${t}:${r}`)}function pa(e){let t=new Set,r=e.channels??{},o=e.subscriptions??{};if(Ct(r)){for(let n of["channels","messages","scheduled","snapshots","consumer_groups","dlq","archive","time_travel","storage_policies"])yr(t,n);for(let n of Object.values(r))n&&(n.type==="stream"&&yr(t,"streams"),(n.retentionMode==="compacted"||n.retentionMode==="compacted_with_log")&&yr(t,"kv"))}if(Ct(o))for(let n of["subscriptions","dlq","snapshots"])yr(t,n);return Ct(e.eventTypes)&&yr(t,"catalogue"),Ct(e.exchanges)&&yr(t,"exchanges"),Ct(e.crossChannels)&&yr(t,"cross_channels"),t.size>0&&yr(t,"keys"),[...t].sort()}function Wg(e){let t=new Set;return Ct(e.workflows)&&(t.add("pipes:read"),t.add("pipes:write"),t.add("pipes:execute")),Ct(e.credentials)&&(t.add("credentials:read"),t.add("credentials:write")),[...t].sort()}function Jg(e){let t=new Set;if(Ct(e.agents))for(let r of["agents:read","agents:write","executions:read","executions:execute","conversations:read","conversations:write","memory:read","memory:write"])t.add(r);return Ct(e.skills)&&(t.add("skills:read"),t.add("skills:write")),Ct(e.tools)&&(t.add("tools:read"),t.add("tools:write")),Ct(e.triggers)&&(t.add("triggers:read"),t.add("triggers:write")),Ct(e.teams)&&(t.add("teams:read"),t.add("teams:write"),t.add("agents:read")),[...t].sort()}var _D,wd=P(()=>{"use strict";Vr();s(Ct,"nonEmpty");s(xD,"enforcedVerbsByResource");_D=xD();s(yr,"grantAll");s(pa,"projectPermissions");s(Wg,"projectPipesPermissions");s(Jg,"projectPrimusPermissions")});var Yg={};me(Yg,{projectAllPermissions:()=>Zg});async function Zg(){let e=new Set;for(let[t,r]of Object.entries(RD)){let o=at(t);if(!o)continue;let n=await pe(o);for(let i of r(n))e.add(i)}return[...e].sort()}var RD,kd=P(()=>{"use strict";qe();wd();RD={events:pa,pipes:Wg,primus:Jg};s(Zg,"projectAllPermissions")});function Qx(e){let t=e.filter(Ul);return t.length===0?[]:[...new Set([...$S(t),...CS(t),...AD])].sort()}var AD,Vx=P(()=>{"use strict";qo();Bs();AD=["embed:read","embed:write","tenants:read","tenants:write"];s(Qx,"projectEmbedScopes")});var Hx={};me(Hx,{computeFloor:()=>Si,coversFloor:()=>OD,floorGap:()=>vr});async function Si(e={}){let t=e.components??Ne(e.cwd)?.embedComponents??[],r=[...Ei(await Zg()),...Qx(t)];return[...new Set(r)].filter(pi).sort()}function vr(e,t){let r=new Set(e);return[...new Set(t)].filter(o=>!r.has(o)).sort()}function OD(e,t){return vr(e,t).length===0}var ma=P(()=>{"use strict";ua();kd();Vx();mi();Zt();s(Si,"computeFloor");s(vr,"floorGap");s(OD,"coversFloor")});function Nt(e){return[...new Set(e)].sort()}function $D(e,t){let r=Nt(e),o=Nt(t);return r.length===o.length&&r.every((n,i)=>n===o[i])}function CD(e,t,r){let o=new Set(e),n=new Set(t),i=new Set(r);return{base:Nt(e),manifest:Nt(t),remote:Nt(r),localAdded:Nt(t.filter(a=>!o.has(a))),localRemoved:Nt(e.filter(a=>!n.has(a))),remoteAdded:Nt(r.filter(a=>!o.has(a))),remoteRemoved:Nt(e.filter(a=>!i.has(a)))}}function Ed(e){let t=Nt(e.declared),r=e.resolution??"none",o=vr(t,e.floor);if(o.length>0)return{kind:"floor-gap",gap:o};let n=Nt(e.remote.scopes),i=Nt(e.pullBase??e.remote.scopes);return e.remote.configDrift&&!$D(t,n)?r==="accept-remote"?{kind:"accept-remote",grant:n,manifest:n}:r==="overwrite-remote"?{kind:"sync",grant:t}:{kind:"conflict",diff:CD(i,t,n)}:{kind:"sync",grant:t}}var Xg=P(()=>{"use strict";ma();s(Nt,"normalizeScopes");s($D,"scopesEqual");s(CD,"diffAgainstBase");s(Ed,"reconcileScopes")});var Pd={};me(Pd,{ScopeDriftError:()=>Sd,ScopeFloorError:()=>fa,assertScopesGate:()=>ND,runDeclaredGrantSync:()=>LD});async function ND(e){let t=e.manifest!==void 0?e.manifest:Ne(e.cwd);if(!t)return null;if(lo(t.accessScopes),!e.check){let r=e.floor??await Si({...e.cwd!==void 0?{cwd:e.cwd}:{},components:t.embedComponents}),o=vr(t.accessScopes,r);if(o.length>0)throw new fa(o)}return t}async function LD(e){let t=await e.readRemoteGrant(e.appGid)??{scopes:[],configDrift:!1},r=Ed({declared:e.declared,floor:e.floor,remote:t,...e.resolution?{resolution:e.resolution}:{}});switch(r.kind){case"floor-gap":throw new fa(r.gap);case"conflict":throw new Sd(r.diff);case"accept-remote":return e.writeManifestScopes?.(r.manifest),await e.syncGrant(e.appGid,r.grant),r;case"sync":return await e.syncGrant(e.appGid,r.grant),r}}var fa,Sd,Id=P(()=>{"use strict";Zt();mi();ma();Xg();fa=class extends Error{static{s(this,"ScopeFloorError")}gap;constructor(t){super(`npayload.toml [access_scopes] does not cover the required scope floor \u2014 ${t.length} scope(s) missing:
|
|
61
|
+
${t.join(`
|
|
62
|
+
`)}
|
|
63
|
+
Run \`npayload scopes fix\` to append exactly these to the manifest.`),this.name="ScopeFloorError",this.gap=t}},Sd=class extends Error{static{s(this,"ScopeDriftError")}diff;constructor(t){super(`The remote grant has drifted from the manifest \u2014 refusing to overwrite it silently.
|
|
64
|
+
manifest declares : ${t.manifest.join(", ")||"(none)"}
|
|
65
|
+
remote grant now : ${t.remote.join(", ")||"(none)"}
|
|
66
|
+
`+(t.remoteAdded.length?` remote added : ${t.remoteAdded.join(", ")}
|
|
67
|
+
`:"")+(t.remoteRemoved.length?` remote removed : ${t.remoteRemoved.join(", ")}
|
|
68
|
+
`:"")+"Re-run with --accept-remote (pull the remote change into the manifest) or --overwrite-remote (replace the remote with the manifest)."),this.name="ScopeDriftError",this.diff=t}};s(ND,"assertScopesGate");s(LD,"runDeclaredGrantSync")});var xd={};me(xd,{checkPermissionsDrift:()=>GD,checkScopesDrift:()=>jD,permissionsContentHash:()=>Td,renderPermissionsModule:()=>eh,scopesFromConfig:()=>Pi,writePermissionsModule:()=>DD,writeScopesModule:()=>UD});function Td(e){return(0,Wx.createHash)("sha256").update(e.join(`
|
|
69
|
+
`)).digest("hex")}function eh(e){let t=Td(e),r=e.map(o=>` "${o}",`).join(`
|
|
70
|
+
`);return`/**
|
|
71
|
+
* GENERATED by \`npayload push\` (or \`npayload deploy\`) \u2014 DO NOT EDIT BY HAND.
|
|
72
|
+
*
|
|
73
|
+
* The tightest per-object OAuth scope set your app needs, projected from
|
|
74
|
+
* events.config.ts (channels/eventTypes/subscriptions \u2192 the objects they touch).
|
|
75
|
+
* This is the SSOT for your machine credential's authorization: the token
|
|
76
|
+
* request carries exactly these scopes, the edge fail-fasts on them, and the
|
|
77
|
+
* cell re-verifies. Change your topology in events.config.ts, then re-run
|
|
78
|
+
* \`npayload push\` to regenerate \u2014 never edit this file.
|
|
79
|
+
*/
|
|
80
|
+
export const permissionsContentHash = "${t}";
|
|
81
|
+
|
|
82
|
+
export const permissions = {
|
|
83
|
+
scopes: [
|
|
84
|
+
${r}
|
|
85
|
+
] as const,
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export type GeneratedScope = (typeof permissions.scopes)[number];
|
|
89
|
+
`}function Pi(e){return pa(e)}function DD(e,t){let r=Pi(e);return(0,Vn.writeFileSync)(t,eh(r),"utf8"),r}function GD(e,t){let r=Pi(e);if(!(0,Vn.existsSync)(t))return{ok:!1,expected:r,reason:"permissions.generated.ts is missing \u2014 run `npayload push` (it is generated with the sandbox sync)"};let o=(0,Vn.readFileSync)(t,"utf8"),n=Td(r);return o.includes(n)?{ok:!0,expected:r}:{ok:!1,expected:r,reason:"permissions.generated.ts is stale or hand-edited \u2014 run `npayload push` to regenerate"}}function UD(e,t){let r=[...new Set(e)].sort();return(0,Vn.writeFileSync)(t,eh(r),"utf8"),r}function jD(e,t){let r=[...new Set(e)].sort();return(0,Vn.existsSync)(t)?(0,Vn.readFileSync)(t,"utf8").includes(Td(r))?{ok:!0,expected:r}:{ok:!1,expected:r,reason:"permissions.generated.ts is stale or hand-edited \u2014 run `npayload push` to regenerate"}:{ok:!1,expected:r,reason:"permissions.generated.ts is missing \u2014 run `npayload push` (it is generated with the sandbox sync)"}}var Wx,Vn,ga=P(()=>{"use strict";Wx=require("crypto"),Vn=require("fs");wd();s(Td,"permissionsContentHash");s(eh,"renderPermissionsModule");s(Pi,"scopesFromConfig");s(DD,"writePermissionsModule");s(GD,"checkPermissionsDrift");s(UD,"writeScopesModule");s(jD,"checkScopesDrift")});var Yx={};me(Yx,{appendAccessScopes:()=>nh,renderScopesArray:()=>Zx,setAccessScopes:()=>_d});function Zx(e){return e.length===0?"scopes = []":`scopes = [
|
|
90
|
+
${e.map(r=>` "${r}",`).join(`
|
|
91
|
+
`)}
|
|
92
|
+
]`}function th(e){let t=!1;for(let r=0;r<e.length;r++){let o=e[r];if(t){if(o==="\\"&&t==='"'){r++;continue}o===t&&(t=!1);continue}if(o==='"'||o==="'")t=o;else if(o==="#")return e.slice(0,r).trim()}return e.trim()}function Jx(e){let t=0,r=!1;for(let o=0;o<e.length;o++){let n=e[o];if(r){if(n==="\\"&&r==='"'){o++;continue}n===r&&(r=!1);continue}if(n==='"'||n==="'")r=n;else{if(n==="#")break;n==="["?t++:n==="]"&&t--}}return t}function MD(e){return e.startsWith("[")}function _d(e,t){let r=e.includes(`\r
|
|
93
|
+
`)?`\r
|
|
94
|
+
`:`
|
|
95
|
+
`,o=e.split(/\r?\n/),n=Zx(t).split(`
|
|
96
|
+
`),i=-1;for(let m=0;m<o.length;m++)if(th(o[m])==="[access_scopes]"){i=m;break}if(i===-1){let m=[...o];for(;m.length>0&&m[m.length-1].trim()==="";)m.pop();return m.push("","[access_scopes]",...n),m.join(r)+r}let a=o.length;for(let m=i+1;m<o.length;m++)if(MD(th(o[m]))){a=m;break}let c=-1;for(let m=i+1;m<a;m++){let p=th(o[m]),f=p.indexOf("=");if(f>0&&p.slice(0,f).trim()==="scopes"){c=m;break}}if(c===-1)return[...o.slice(0,i+1),...n,...o.slice(i+1)].join(r);let l=c,d=Jx(o[c].slice(o[c].indexOf("=")+1));for(;d>0&&l+1<a;)l++,d+=Jx(o[l]);return[...o.slice(0,c),...n,...o.slice(l+1)].join(r)}function nh(e,t,r){let o=[...new Set([...t,...r])].sort();return _d(e,o)}var rh=P(()=>{"use strict";s(Zx,"renderScopesArray");s(th,"codePart");s(Jx,"bracketDelta");s(MD,"isHeaderLine");s(_d,"setAccessScopes");s(nh,"appendAccessScopes")});var ba={};me(ba,{READ_ONLY_SEND_BUDGET:()=>r_,assertPlanHasNoFailures:()=>dh,assertPushHasNoRawSecretHeaders:()=>f_,buildKernel:()=>vt,canonicalEntryOrder:()=>s_,canonicalPlan:()=>a_,changedFields:()=>ih,envFromCommandLine:()=>Lt,failedRows:()=>$d,findConfig:()=>lt,findConfigForProduct:()=>at,immutableDrift:()=>u_,isAlreadyExistsError:()=>p_,loadEventsConfig:()=>pe,planCreatePathParams:()=>o_,planThenApply:()=>i_,registerDeploy:()=>ph,resolveAppIdPublic:()=>ch,resolveExistingByIdentity:()=>m_,runDeploy:()=>Te,syncExitCode:()=>Cd,yesFromCommandLine:()=>va});function n_(e){for(let t of e.files){let r=(0,Le.resolve)(process.cwd(),t);if((0,Ye.existsSync)(r))return r}return null}function at(e){let t=Rd.find(r=>r.name===e);return t?n_(t):null}function qD(e){return Object.values(wr).some(t=>t.parent===e)}async function pe(e){let t=(0,Le.isAbsolute)(e)?e:(0,Le.resolve)(process.cwd(),e);if(!(0,Ye.existsSync)(t))throw new Error(`events config not found at ${t}. Pass --config <path> or run from a project with events.config.ts.`);let r;try{r=await FD(t,null)}catch(n){if(n instanceof Od){let i=(0,e_.createHash)("sha1").update((0,Ye.readFileSync)(t)).digest("hex").slice(0,16);r=await import(`${(0,Ad.pathToFileURL)(t).href}?v=${i}`)}else throw n}let o=r.default??r.config??r.events;if(!o||typeof o!="object")throw new Error(`${t} must export a default Events config object (e.g. \`export default defineEventsConfig({...})\`).`);return o}async function FD(e,t){let r=t instanceof Error?t.message:String(t??"esbuild-first load"),o;try{let c=(0,Xx.createRequire)(ZD.url),l=await import((0,Ad.pathToFileURL)(c.resolve("esbuild")).href);o="build"in l?l:l.default}catch{throw new Od(`Could not load ${e} (${r}) and esbuild (the TS-config loader) is unavailable.
|
|
97
|
+
Reinstall @npayload/sdk (esbuild ships with it), run under a TS-aware runtime (e.g. \`tsx\`), or \`npm i -D esbuild\`.`)}let n={name:"npayload-config-stub",setup(c){c.onResolve({filter:/(^(?:@npayload\/(?:sdk|npayload)|npayload)$)|(_generated[/\\]config-schema)/},()=>({path:"npayload-config-stub",namespace:"npayload-config-stub"})),c.onLoad({filter:/.*/,namespace:"npayload-config-stub"},()=>({contents:`export const defineEventsConfig = (c) => c;
|
|
98
|
+
export const definePrimusConfig = (c) => c;
|
|
99
|
+
export const definePipesConfig = (c) => c;
|
|
100
|
+
export const defineConnectConfig = (c) => c;
|
|
101
|
+
export default defineEventsConfig;
|
|
102
|
+
`,loader:"js"}))}},i=(0,Ye.mkdtempSync)((0,Le.join)((0,t_.tmpdir)(),"npayload-deploy-")),a=(0,Le.join)(i,"events.config.mjs");try{return await o.build({entryPoints:[e],bundle:!0,format:"esm",platform:"node",outfile:a,logLevel:"silent",plugins:[n]}),await import((0,Ad.pathToFileURL)(a).href)}finally{(0,Ye.rmSync)(i,{recursive:!0,force:!0})}}async function vt(e,t,r={}){let o=process.env.NPAYLOAD_CLIENT_ID?.trim()||void 0,n=(process.env.NPAYLOAD_CLIENT_SECRET??process.env.NPAYLOAD_HMAC_SECRET)?.trim()||void 0,i;if(!o){let m=await Bn();o=m.clientId,n=n??m.hmacSecret,i=m.dpopPrivateJwk}if(!o)throw new Error("Not authenticated. Run `npayload init`/`npayload login`, or export NPAYLOAD_CLIENT_ID + NPAYLOAD_CLIENT_SECRET.");let{apiUrl:a,authUrl:c,guard:l}=so(e),d=bi({env:process.env,credentialKey:i})??(await Do()).privateJwk,u=si({clientId:o,dpopPrivateJwk:d,baseUrl:a,...n!==void 0?{clientSecret:n}:{},...c!==void 0?{authUrl:c}:{},...t?{env:t}:{}},l);if(r.readOnly){let m=u.send.bind(u);u.send=(p=>m({...r_,...p}))}return u}async function ch(e,t){return Mg(e,t?{app:t}:{})}function zD(e,t){let r=Object.keys(e).filter(a=>t[a]&&e[a]&&Object.keys(e[a]).length>0),o=[],n=new Set,i=s((a,c)=>{if(!n.has(a)){if(c.has(a))throw new Error(`cyclic resource dependency at "${a}"`);c.add(a);for(let l of t[a]?.deps??[])r.includes(l)&&i(l,c);c.delete(a),n.add(a),o.push(a)}},"visit");for(let a of r)i(a,new Set);return o}function Yt(e){return(e.match(/:([A-Za-z0-9_]+)/g)??[]).map(t=>t.slice(1))}function br(e){return e.replace(/:([A-Za-z0-9_]+)/g,"{$1}")}function lh(e,t,r,o){let n=e.pathParams?.[t]??t;if(t==="appId"||n==="appId")return o.appId??null;let i=wr[t];if(i){let a=r[n];if(typeof a!="string")return null;let c=o.registry.get(i.parent)?.get(a);return c||(o.check&&o.declaredParents.get(i.parent)?.has(a)?Nd:null)}return null}function ha(e){return Yt(e.pattern).map(t=>e.pathParams?.[t]??t)}function o_(e,t,r,o,n){let i={},a=!1;for(let c of Yt(e.pattern)){let l=lh(e,c,o,n);if(!l){let d=e.pathParams?.[c]??c,u=o[d],m=wr[c]?.parent,p=typeof u=="string"?`"${d}: ${u}" names no ${m?`live or declared ${m} entry`:"resolvable value"}`:`declare "${d}" on ${t}/${r}`;return{ok:!1,row:{resource:t,identity:r,action:"failed",reason:`unresolved reference :${c} on ${t}/${r} \u2014 ${p} (run \`npayload wire\` or fix the name)`}}}l===Nd&&(a=!0),i[c]=l}return{ok:!0,pathParams:i,pending:a}}function $d(e){return e.filter(t=>t.action==="failed")}function dh(e){let t=$d(e);if(t.length!==0)throw new Error(`plan failed: ${t.length} unresolved reference(s): ${t.map(r=>`${r.resource}/${r.identity} (${r.reason??"unresolved reference"})`).join("; ")}`)}async function i_(e){let t=await e.plan();dh(t);let r=await e.apply(t);return{plan:t,applied:r}}function s_(e){return Object.entries(e).sort(([t],[r])=>t<r?-1:t>r?1:0)}function a_(e){let t=[];for(let o of e)t.includes(o.resource)||t.push(o.resource);let r=s((o,n)=>{let i=t.indexOf(o.resource)-t.indexOf(n.resource);if(i!==0)return i;if(o.identity!==n.identity)return o.identity<n.identity?-1:1;if(o.action!==n.action)return o.action<n.action?-1:1;let a=o.reason??"",c=n.reason??"";return a<c?-1:a>c?1:0},"cmp");return[...e].sort(r)}function va(e,t){return e.yes===!0?!0:t?.optsWithGlobals().yes===!0}function Lt(e,t){let r=typeof e.env=="string"?e.env.trim():"";if(r!=="")return r;let o=t?.optsWithGlobals().env;return typeof o=="string"&&o.trim()!==""?o.trim():void 0}function Cd(e,t){return $d(t).length>0?1:e==="push"?0:t.some(r=>r.action==="create"||r.action==="update"||r.action==="delete"||r.action==="immutable")?2:0}function c_(e){return typeof e=="object"&&e!==null}function l_(e,t){if(!c_(e))return;let r=e[t];return typeof r=="string"?r:void 0}function Ii(e){if(typeof e=="string")return e.length>0?e:void 0;if(c_(e))for(let t of["gid","channelGid","subscriptionGid","agentGid","skillGid","toolGid","id","_id"]){let r=e[t];if(typeof r=="string")return r}}function d_(e){return e.status==="archived"}function uh(e){if(Array.isArray(e))return e;if(e&&typeof e=="object")for(let t of["data","items","channels","subscriptions","results"]){let r=e[t];if(Array.isArray(r))return r}return[]}function ya(e,t){if(e===t)return!0;if(Qo(e))return t!=null&&t!=="";if(e===null||t===null||e===void 0||t===void 0)return e===t;if(typeof e!=typeof t||typeof e!="object")return!1;let r=Array.isArray(e);if(r!==Array.isArray(t))return!1;if(r){let a=t;return e.length!==a.length?!1:e.every((c,l)=>ya(c,a[l]))}let o=e,n=t,i=Object.keys(o);return i.length!==Object.keys(n).length?!1:i.every(a=>Object.prototype.hasOwnProperty.call(n,a)&&ya(o[a],n[a]))}function ih(e,t,r,o,n){let i=new Set([r,...o?ha(o):[],...n?ha(n):[],...Object.keys(ah)]),a=o?.updatable?new Set(o.updatable):void 0,c={};for(let[l,d]of Object.entries(e))i.has(l)||a&&!a.has(l)||ya(d,t[l])||(c[l]=d);return c}function u_(e,t,r,o,n){let i=new Set([r,...o?ha(o):[],...n?ha(n):[],...Object.keys(ah)]),a=o?o.updatable?new Set(o.updatable):null:new Set,c=[];for(let[l,d]of Object.entries(e))i.has(l)||a===null||a.has(l)||l in t&&(ya(d,t[l])||c.push(l));return c.sort()}function BD(e,t,r,o,n){let i={},a=[];for(let c of Kn(e)){if(c.wire!=="gid"||c.path.includes("."))continue;let l=po(Qn(r,c.path))??[],d=Qn(o,c.publicField),u=c.array?Array.isArray(d)?d.filter(h=>typeof h=="string"):[]:typeof d=="string"?[d]:[],m=Tx(n.registry,c.parent);if(u.some(h=>!m.has(h)))continue;let p=u.map(h=>m.get(h));if(fd(l,p))continue;let{resolved:f,unresolved:g}=xx(l,c,n.registry);if(g!==null){a.push(`${e} "${t}": ${c.label} "${g}" not found \u2014 run \`npayload wire\` (or fix the name).`);continue}i[c.path]=c.array?f:f[0]}return{fields:i,notes:a}}function KD(e){return e.status===429||typeof e.status=="number"&&e.status>=500?!0:e.status===void 0}async function ct(e,t,r){let n=t.method!=="GET"?{"Idempotency-Key":globalThis.crypto.randomUUID()}:{},i=e,a=!1,c={};for(let p=0;p<=3;p++)try{return await i.send({...t,headers:{...n}})}catch(f){if(F(f),c=f,!KD(c)||p===3)break;if(c.status===void 0&&!a&&sh){a=!0;try{i=await sh()}catch{}}let g=150*2**p+Math.floor(Math.random()*100);await new Promise(h=>setTimeout(h,g))}let l=[c.status,c.code].filter(Boolean).join(" "),d=c.status===401||c.status===403||c.code==="invalid_client"||c.code==="invalid_token",u=c.status===void 0?" \u2014 the API endpoint is unreachable; check your network, then run `npayload doctor`":d?" \u2014 your credentials were rejected; run `npayload doctor` to see which source is in use, then `npayload login` to re-provision":c.status===429||c.status>=500?" \u2014 transient upstream failure persisted after 3 retries":"",m=new Error(`${r} [${t.method} ${t.path}]${l?` ${l}`:""}: ${c.message??"request failed"}${u}`);throw m.status=c.status,m.code=c.code,m}function p_(e){let t=e;return t?t.status===409||t.code==="ALREADY_EXISTS"||t.code==="RESOURCE_ALREADY_EXISTS"?!0:/\b409\b|ALREADY_EXISTS/.test(t.message??""):!1}async function m_(e,t,r,o,n,i,a){let c=r.ops.list;if(!c)return null;let l={};for(let u of Yt(c.pattern))if(u==="appId"){if(!a.appId)return null;l.appId=a.appId}else if(wr[u]){let m=lh(c,u,i,a);if(!m||m===Nd)return null;l[u]=m}else return null;let d=await ct(e,{method:c.method,path:br(c.pattern),...Object.keys(l).length?{pathParams:l}:{}},`${t}.list`);for(let u of uh(d))if(!d_(u)&&l_(u,o)===n)return u;return null}async function QD(e,t,r,o,n){let{identity:i}=r,a=r.ops.list,c=r.ops.create,l=[],d=0,u=new Map,p=(c?Yt(c.pattern):[]).find(f=>wr[f]);if(a){let f=Yt(a.pattern),g=new Set;if(f.some(h=>wr[h]))for(let h of Object.values(o)){let y=f.find(S=>wr[S]),v=lh(a,y,h,n);v&&v!==Nd&&g.add(v)}else g.add("__single__");for(let h of g){let y={},v=!0;for(let k of f)if(k==="appId"){if(!n.appId){v=!1;break}y.appId=n.appId}else if(wr[k])y[k]=h;else{v=!1;break}if(!v)continue;let S=await ct(e,{method:a.method,path:br(a.pattern),...Object.keys(y).length?{pathParams:y}:{}},`${t}.list`);for(let k of uh(S)){let R=l_(k,i),I=Ii(k);R&&(d_(k)||(u.set(R,k),I&&oh(n.registry,t,R,I)))}}}for(let[f,g]of s_(o)){let h=u.get(f);if(h){let I=r.ops.update,x=ih(g,h,i,I,c),_=BD(t,f,g,h,n);for(let[V,J]of Object.entries(_.fields))x[V]=J;for(let V of _.notes)l.push({resource:t,identity:f,action:"noop",reason:V});let U=u_(g,h,i,I,c);if(U.length>0&&l.push({resource:t,identity:f,action:"immutable",reason:`immutable (requires recreate): ${U.join(", ")}`}),!I||Object.keys(x).length===0){U.length===0&&l.push({resource:t,identity:f,action:"noop",reason:I?"in sync":"no update binding"});continue}let A=Ii(h),D={},M=!!A;for(let V of Yt(I.pattern))if(V==="appId"){if(!n.appId){M=!1;break}D.appId=n.appId}else{if(!A){M=!1;break}D[V]=A}if(!M){l.push({resource:t,identity:f,action:"noop",reason:"unresolved update target"});continue}l.push({resource:t,identity:f,action:"update"}),n.check||(await ct(e,{method:I.method,path:br(I.pattern),...Object.keys(D).length?{pathParams:D}:{},body:x},`${t}.update`),d++);continue}if(!c){l.push({resource:t,identity:f,action:"noop",reason:"no create binding"});continue}let y=o_(c,t,f,g,n);if(!y.ok){l.push(y.row);continue}let v=y.pathParams,S=y.pending,k={[i]:f,...g};for(let I of ha(c))delete k[I];let R=!0;for(let[I,x]of Object.entries(ah)){let _=k[I],U=typeof _=="string"?[_]:Array.isArray(_)?_:null;if(!U||!U.every(M=>typeof M=="string"))continue;let A=[],D=null;for(let M of U){let V=n.registry.get(x.parent)?.get(M);if(V){A.push(V);continue}if(n.check&&n.declaredParents.get(x.parent)?.has(M)){S=!0,A.push(M);continue}D=M;break}if(D!==null){R=!1,l.push({resource:t,identity:f,action:"noop",reason:`${I} ref "${D}" not found \u2014 run \`npayload wire\` (or fix the name)`});break}k[I]=typeof _=="string"?A[0]:A}if(R&&(l.push({resource:t,identity:f,action:"create",...S?{reason:"after parent"}:{}}),!n.check&&!S)){let I;try{I=await ct(e,{method:c.method,path:br(c.pattern),...Object.keys(v).length?{pathParams:v}:{},body:k},`${t}.create`)}catch(_){if(F(_),!p_(_))throw _;let U=l[l.length-1],A=await m_(e,t,r,i,f,g,n);if(A){let D=Ii(A);D&&oh(n.registry,t,f,D);let M=r.ops.update,V=M?ih(g,A,i,M,c):{};if(M&&D&&Object.keys(V).length>0){let J={},w=!0;for(let T of Yt(M.pattern))if(T==="appId"){if(!n.appId){w=!1;break}J.appId=n.appId}else if(J[T]=D??"",!D){w=!1;break}if(w){await ct(e,{method:M.method,path:br(M.pattern),...Object.keys(J).length?{pathParams:J}:{},body:V},`${t}.update`),U&&(U.action="update",U.reason="already existed \u2014 adopted + reconciled"),d++;continue}}U&&(U.action="noop",U.reason="already exists (adopted)");continue}U&&(U.action="noop",U.reason="already exists (409) \u2014 will reconcile next run");continue}let x=Ii(I);if(x)oh(n.registry,t,f,x);else if(qD(t))throw new Error(`${t}/${f} was created but npayload returned no id for it (an empty answer). A child resource binds to this ${t}'s id, so this deploy cannot continue. Run \`npayload deploy\` again: the next run adopts the existing ${t} and binds its children. If it keeps happening, contact support.`);d++}}for(let[f,g]of u){if(o[f])continue;let h=Ii(g);if(n.prune&&r.ops.remove&&h){if(l.push({resource:t,identity:f,action:"delete",reason:"prune"}),!n.check){let y=r.ops.remove,v=Yt(y.pattern)[0];await ct(e,{method:y.method,path:br(y.pattern),...v?{pathParams:{[v]:h}}:{}},`${t}.remove`),d++}}else l.push({resource:t,identity:f,action:"orphan",reason:r.ops.remove?"live but not declared \u2014 pass --prune to delete":"live but not declared (no remove op)"})}return{plan:l,applied:d}}function oh(e,t,r,o){e.has(t)||e.set(t,new Map),e.get(t).set(r,o)}function ph(e,t={}){e.command("deploy").description("Deploy your config to PRODUCTION \u2014 the single, code-is-source-of-truth path to prod (no sandbox clone)").option("--config <path>","path to a single config (default: every *.config.ts)").option("--app <appGid>","app GID for :appId-scoped resources (default: NPAYLOAD_APP_ID)").option("--env <slug>","must name the production environment \u2014 np deploy targets production only (use np push for dev envs)").option("--allow-branch <name>","deploy from a non-main branch deliberately (CI path); must equal the CURRENT branch").option("--check","print the plan and apply nothing (dry run)").option("--prune","delete prod resources not declared in the config (confirmed; --yes for CI)").option("--yes","skip the prune confirmation (CI) \u2014 does NOT bypass the branch guard").option("--accept-remote","on scope drift: pull the remote grant change into npayload.toml").option("--overwrite-remote","on scope drift: replace the remote grant with the manifest declaration").action(async(r,o)=>{let n=Lt(r,o),i={...r,...va(r,o)?{yes:!0}:{},...n!==void 0?{env:n}:{}};try{let a=Nx(i.env?{explicitSlug:i.env}:{}),c=a??{slug:"production",kind:"production"};await jx({env:c,...i.allowBranch!==void 0?{allowBranch:i.allowBranch}:{},confirm:s(async l=>{let{createInterface:d}=await import("readline/promises"),u=d({input:process.stdin,output:process.stderr});try{let m=await u.question(`${l} [y/N] `);return/^y(es)?$/i.test(m.trim())}finally{u.close()}},"confirm")}),i.check||await Dx({slug:c.slug,send:t.sendAccount??(async l=>(await vt(void 0,c.slug)).send(l)),print:s(l=>process.stdout.write(ve.default.dim(`${l}
|
|
103
|
+
`)),"print")}),a?(process.stdout.write(ve.default.bold.cyan(`\u2192 Deploying to ${a.slug} (${a.kind})
|
|
104
|
+
`)),await Te({...i,env:a.slug,resolvedEnv:a})):(process.stdout.write(ve.default.bold.cyan(`\u2192 Deploying to PRODUCTION
|
|
105
|
+
`)),await Te({...i,env:"production"})),process.exit(0)}catch(a){let c=a instanceof Error?a.message:String(a);process.stderr.write(ve.default.red(`${ie(`deploy failed: ${c}`,a)}
|
|
106
|
+
`)),process.exit(1)}})}async function VD(e,t,r,o,n){let i=[],a=0,c=r.ops.list,l=r.ops.create;if(!c||!l)return i.push({resource:t,identity:"(singleton)",action:"noop",reason:"no list/upsert binding"}),{plan:i,applied:a};if(Yt(c.pattern).includes("appId")&&!n.appId)return i.push({resource:t,identity:"(singleton)",action:"noop",reason:"unresolved appId"}),{plan:i,applied:a};let d={};for(let g of Yt(c.pattern))g==="appId"&&n.appId&&(d.appId=n.appId);let u=await ct(e,{method:c.method,path:br(c.pattern),...Object.keys(d).length?{pathParams:d}:{}},`${t}.get`);if(u&&typeof u=="object")for(let g of["data","settings",t]){let h=u[g];if(h&&typeof h=="object"&&!Array.isArray(h)){u=h;break}}let m={};for(let[g,h]of Object.entries(o))(!u||!ya(u[g],h))&&(m[g]=h);if(Object.keys(m).length===0)return i.push({resource:t,identity:"(singleton)",action:"noop",reason:"in sync"}),{plan:i,applied:a};let p=u?"update":"create";if(n.check)return i.push({resource:t,identity:"(singleton)",action:p}),{plan:i,applied:a};let f={};for(let g of Yt(l.pattern))g==="appId"&&n.appId&&(f.appId=n.appId);try{await ct(e,{method:l.method,path:br(l.pattern),...Object.keys(f).length?{pathParams:f}:{},body:m},`${t}.upsert`),i.push({resource:t,identity:"(singleton)",action:p}),a++}catch(g){F(g);let h=g.message??String(g);if(/\b403\b|forbidden/i.test(h))i.push({resource:t,identity:"(singleton)",action:"noop",reason:"requires org-admin credential (admin-gated \u2014 manage via dashboard, or deploy with admin auth)"});else throw g}return{plan:i,applied:a}}async function HD(e,t,r){let o=[],n=[],i=0,a=Object.keys(t);if(a.length===0)return{plans:o,applied:i,notes:n};a.length>1&&n.push(`teams: one team per environment is supported \u2014 reconciling "${a[0]}", skipping ${a.slice(1).join(", ")}.`);let c=a[0],l=t[c],d=po(l.members)??[],u=typeof l.description=="string"?l.description:void 0,m=await ct(e,{method:"GET",path:"/v1/primus/teams"},"teams.get"),p=m?.lead?.gid,f=(m?.specialists??[]).filter(v=>!!(v.gid&&v.name)),g=new Map;try{let v=await ct(e,{method:"GET",path:"/v1/primus/agents"},"agents.list");for(let S of uh(v?.data??v)){let k=typeof S.name=="string"?S.name:void 0,R=Ii(S);k&&R&&g.set(k,R)}}catch(v){F(v)}if(p){let v=(m?.lead?.name??"")!==c,S=u!==void 0&&(m?.lead?.description??void 0)!==u;v||S?r.check?o.push({resource:"teams",identity:c,action:"update"}):(await ct(e,{method:"PATCH",path:"/v1/primus/teams/{teamId}",pathParams:{teamId:p},body:{...v?{name:c}:{},...S?{description:u}:{}}},"teams.update"),o.push({resource:"teams",identity:c,action:"update"}),i++):o.push({resource:"teams",identity:c,action:"noop",reason:"in sync"})}else if(r.check)o.push({resource:"teams",identity:c,action:"create"});else{let v=await ct(e,{method:"POST",path:"/v1/primus/teams",body:{name:c,...u?{businessContext:u}:{}}},"teams.create");p=v?.gid??v?.lead?.gid,o.push({resource:"teams",identity:c,action:"create"}),i++}let h=new Set(f.map(v=>v.name));for(let v of d){if(h.has(v))continue;let S=g.get(v);if(!S){n.push(`teams "${c}": member "${v}" not found among agents \u2014 declare it in agents{} (or fix the name).`);continue}if(r.check){o.push({resource:"teams.member",identity:v,action:"create"});continue}try{await ct(e,{method:"POST",path:"/v1/primus/teams/assign",body:{agentGid:S}},"teams.assignAgent"),o.push({resource:"teams.member",identity:v,action:"create"}),i++}catch(k){F(k),n.push(`teams "${c}": could not assign "${v}" (${k.message??"error"}).`)}}let y=new Set(d);for(let v of f)if(!y.has(v.name)){if(!r.prune){n.push(`teams "${c}": "${v.name}" is on the team but not declared \u2014 run with --prune to unassign it.`);continue}if(r.check){o.push({resource:"teams.member",identity:v.name,action:"delete"});continue}try{await ct(e,{method:"POST",path:"/v1/primus/teams/unassign",body:{agentGid:v.gid}},"teams.unassignAgent"),o.push({resource:"teams.member",identity:v.name,action:"delete"}),i++}catch(S){F(S),n.push(`teams "${c}": could not unassign "${v.name}" (${S.message??"error"}).`)}}return{plans:o,applied:i,notes:n}}async function WD(e,t,r,o,n,i){let a=await pe(r);if(!e.check){await f_(a);let{resolveSecretRefs:h,loadSecretEnv:y}=await Promise.resolve().then(()=>(Un(),vf)),v=y(r);a=h(a,v.env,v.searched)}let c=zD(a,t.resources),l=t.name==="primus"?a.teams:void 0,d=!!l&&Object.keys(l).length>0;if(c.length===0&&!d){let h=`[${t.name}] no declared resources in ${r}`;return i(ve.default.dim(h+`
|
|
107
|
+
`)),{plans:[],applied:0,note:h}}let u=[...c,...d?["teams"]:[]];i(ve.default.bold(`[${t.name}] ${e.check?"Plan":"Deploy"} \u2014 ${u.length} resource type(s): ${u.join(", ")}
|
|
108
|
+
`));let m=new Map;for(let h of c)m.set(h,new Set(Object.keys(a[h]??{})));let p=new Map,f=[],g=0;for(let h of c){let y=t.resources[h];if(y?.singleton){let k=await VD(o,h,y,a[h],{...n!==void 0?{appId:n}:{},registry:p,check:e.check??!1,prune:e.prune??!1,declaredParents:m});f.push(...k.plan),g+=k.applied;continue}let v=a[h],S=await QD(o,h,y,v,{...n!==void 0?{appId:n}:{},registry:p,check:e.check??!1,prune:e.prune??!1,declaredParents:m});f.push(...S.plan),g+=S.applied}if(d&&l){let h=await HD(o,l,{check:e.check??!1,prune:e.prune??!1});f.push(...h.plans),g+=h.applied;for(let y of h.notes)i(ve.default.yellow(` \u26A0 ${y}
|
|
109
|
+
`))}return{plans:f,applied:g}}async function Te(e){let t=e.json?x=>{}:e.sink??(x=>void process.stdout.write(x));if(e.prune&&!e.check&&!e.yes){let x="--prune will DELETE every live resource not declared in the config.";if(!process.stdin.isTTY)throw new Error(`${x} Refusing without a TTY; pass --yes to proceed.`);let{createInterface:_}=await import("readline/promises"),U=_({input:process.stdin,output:process.stderr});try{let A=await U.question(`${x} Continue? [y/N] `);if(!/^y(es)?$/i.test(A.trim()))throw new Error("prune aborted by user")}finally{U.close()}}let r=e.resolvedEnv?.slug??(e.env?.trim()||"sandbox"),o=Date.now(),n=e.resolvedEnv?e.resolvedEnv.kind==="production":r==="production",i=r;t(ET(e.check?"plan":n?"deploy":"push",[i]));let a=[];if(e.config){let x=(0,Le.isAbsolute)(e.config)?e.config:(0,Le.resolve)(process.cwd(),e.config),_=Rd.find(U=>x.includes(`${U.name}.config`))??Rd[0];a.push({product:_,configPath:x})}else for(let x of Rd){let _=n_(x);_&&a.push({product:x,configPath:_})}if(a.length===0)return t(ve.default.yellow("No <product>.config.ts found (events.config.ts / primus.config.ts). Run `npayload init`.\n")),{plan:[],applied:0,output:"No product config found."};let{assertScopesGate:c}=await Promise.resolve().then(()=>(Id(),Pd)),l=await c({check:e.check??!1}),d={readOnly:e.check===!0},u=await vt(void 0,r,d),m=te(process.env.NPAYLOAD_PRIMUS_API_URL,"primusApiUrl"),p=m?await vt(m,r,d):u,f=await Mg(u,e);if(!f)throw new Error("Could not resolve your app. Your credentials may be invalid or missing. Run `npayload doctor` to see which credential source is in use, then `npayload login` to re-provision (or set NPAYLOAD_APP_ID).");if(sh=void 0,!e.check&&a.length>0){let x=[];try{let{projectPermissions:_,projectPipesPermissions:U,projectPrimusPermissions:A}=await Promise.resolve().then(()=>(wd(),Kx)),{writeScopesModule:D}=await Promise.resolve().then(()=>(ga(),xd)),M=new Set;for(let{product:J,configPath:w}of a){let T=await pe(w),q=J.name==="events"?_(T):J.name==="pipes"?U(T):J.name==="primus"?A(T):[];for(let H of q)M.add(H)}let V=(0,Le.join)((0,Le.dirname)(a[0].configPath),"permissions.generated.ts");x=D([...M],V),t(ve.default.dim(` permissions.generated.ts \u2014 ${x.length} per-object scope(s) across ${a.length} product(s)
|
|
110
|
+
`))}catch(_){t(ve.default.yellow(` (permissions codegen skipped: ${_ instanceof Error?_.message:String(_)})
|
|
111
|
+
`))}if(l)try{let{runDeclaredGrantSync:_}=await Promise.resolve().then(()=>(Id(),Pd)),{computeFloor:U}=await Promise.resolve().then(()=>(ma(),Hx)),{syncExactGrant:A}=await Promise.resolve().then(()=>(ua(),Hg)),{setAccessScopes:D}=await Promise.resolve().then(()=>(rh(),Yx)),M=await U({components:l.embedComponents}),V=e.acceptRemote?"accept-remote":e.overwriteRemote?"overwrite-remote":"none";await _({declared:l.accessScopes,floor:M,appGid:f,resolution:V,readRemoteGrant:s(async J=>{let{restoreSession:w}=await Promise.resolve().then(()=>(_t(),di)),T=await w();return T?T.getOacGrant(J):null},"readRemoteGrant"),syncGrant:s(async(J,w)=>{await A(w,J,t)},"syncGrant"),writeManifestScopes:s(J=>{l.path&&(0,Ye.writeFileSync)(l.path,D((0,Ye.readFileSync)(l.path,"utf8"),J),"utf8")},"writeManifestScopes"),log:t})}catch(_){F(_);let{ScopeDriftError:U,ScopeFloorError:A}=await Promise.resolve().then(()=>(Id(),Pd));if(_ instanceof U||_ instanceof A)throw _;t(ve.default.yellow(` (declared-scope sync deferred: ${_ instanceof Error?_.message:String(_)} \u2014 re-run after \`npayload login\`)
|
|
112
|
+
`))}else{let{syncCredentialScopes:_}=await Promise.resolve().then(()=>(ua(),Hg));await _(x,f,t)}}let g=s(async(x,_)=>{let U=[],A=[],D=0;for(let{product:M,configPath:V}of a){let J=M.name==="primus"?p:u,w=await WD(x,M,V,J,f,_);if(U.push(...w.plans),w.note&&A.push(w.note),D+=w.applied,M.name==="events"&&!x.check)try{let T=await pe(V),q=(0,Le.join)((0,Le.dirname)(V),"_generated");(0,Ye.mkdirSync)(q,{recursive:!0});let H=zx(T.eventTypes,(0,Le.join)(q,"events.d.ts"));H>0&&_(ve.default.dim(` _generated/events.d.ts \u2014 ${H} typed event payload(s)
|
|
113
|
+
`))}catch(T){_(ve.default.yellow(` (typed-events codegen skipped: ${T instanceof Error?T.message:String(T)})
|
|
114
|
+
`))}}return{plans:U,notes:A,applied:D}},"reconcileAll"),h,y=await i_({plan:s(async()=>(h=await g({...e,check:!0},e.check?t:()=>{}),h.plans),"plan"),apply:s(async()=>e.check?h:await g(e,t),"apply")}),v=y.applied.plans,S=y.applied.notes,k=y.applied.applied;JD(v,e.check??!1,t);let R;if(e.check){let x=v.filter(D=>D.action==="create").length,_=v.filter(D=>D.action==="update").length,U=v.filter(D=>D.action==="delete").length,A=$d(v).length;R=`Plan: ${x} to create, ${_} to update, ${U} to delete, ${v.length-x-_-U-A} unchanged${A?`, ${A} FAILED`:""}.`,t(ve.default.bold(`
|
|
115
|
+
${R}
|
|
116
|
+
`))}else R=`Applied ${k} change(s) across ${a.length} product(s).`,t(ST(k===0?"Everything in sync":R,o));let I=`${e.check?"Plan":"Deploy"} \u2014 ${a.map(x=>x.product.name).join(", ")}
|
|
117
|
+
`+(S.length?S.map(x=>` ${x}`).join(`
|
|
118
|
+
`)+`
|
|
119
|
+
`:"")+v.map(x=>` ${x.action} ${x.resource}/${x.identity}${x.reason?` (${x.reason})`:""}`).join(`
|
|
120
|
+
`)+`
|
|
121
|
+
${R}`;return e.json&&process.stdout.write(JSON.stringify({check:e.check??!1,env:r,plan:a_(v),applied:k,hasChanges:v.some(x=>x.action==="create"||x.action==="update"||x.action==="delete"||x.action==="immutable")},null,2)+`
|
|
122
|
+
`),dh(v),{plan:v,applied:k,output:I}}function lt(){for(let e of["npayload/events.config.ts","npayload/events.config.mjs","npayload/events.config.js","events.config.ts","events.config.mjs","events.config.js"]){let t=(0,Le.resolve)(process.cwd(),e);if((0,Ye.existsSync)(t))return t}return(0,Le.resolve)(process.cwd(),"events.config.ts")}function JD(e,t,r=o=>void process.stdout.write(o)){let o={create:ve.default.green("+ create"),update:ve.default.yellow("~ update"),delete:ve.default.red("- delete"),orphan:ve.default.magenta("! orphan"),noop:ve.default.dim(" no-op "),failed:ve.default.bgRed.white("\u2717 failed"),immutable:ve.default.yellow("! immutable")};for(let n of e){let i=n.reason?ve.default.dim(` (${n.reason})`):"";r(` ${o[n.action]} ${n.resource}/${n.identity}${i}
|
|
123
|
+
`)}}async function f_(e){let{assertNoRawSecretHeaders:t}=await Promise.resolve().then(()=>(Un(),vf));t(e)}var Ad,Xx,Le,Ye,e_,t_,ve,ZD,Rd,wr,ah,Od,r_,Nd,sh,qe=P(()=>{"use strict";Pt();Ad=require("url"),Xx=require("module"),Le=require("path"),Ye=require("fs"),e_=require("crypto"),t_=require("os"),ve=K(require("chalk"));Ks();ld();wx();Cg();vi();md();aa();gt();Wt();se();re();Fg();Lx();Gx();Mx();Qg();zl();Un();ZD={},Rd=[{name:"events",resources:ai,files:["npayload/events.config.ts","npayload/events.config.mjs","npayload/events.config.js","events.config.ts","events.config.mjs","events.config.js"]},{name:"primus",resources:yi,files:["npayload/primus.config.ts","npayload/primus.config.mjs","npayload/primus.config.js","primus.config.ts","primus.config.mjs","primus.config.js"]},{name:"connect",resources:bx,files:["connect.config.ts","connect.config.mjs","connect.config.js","npayload/connect.config.ts","npayload/connect.config.mjs","npayload/connect.config.js"]},{name:"pipes",resources:dd,files:["npayload/pipes.config.ts","npayload/pipes.config.mjs","npayload/pipes.config.js","pipes.config.ts","pipes.config.mjs","pipes.config.js"]}];s(n_,"findProductConfig");s(at,"findConfigForProduct");wr={channelId:{parent:"channels"},channelGid:{parent:"channels"}};s(qD,"isParentResource");ah={agentGid:{parent:"agents"},channels:{parent:"channels"},skills:{parent:"skills"}};s(pe,"loadEventsConfig");Od=class extends Error{static{s(this,"EsbuildUnavailableError")}};s(FD,"loadViaEsbuild");r_={maxAttempts:2,restartWindowMs:0};s(vt,"buildKernel");s(ch,"resolveAppIdPublic");s(zD,"orderResources");s(Yt,"paramsOf");s(br,"toTemplate");s(lh,"resolveParam");s(ha,"argNamesOf");s(o_,"planCreatePathParams");s($d,"failedRows");s(dh,"assertPlanHasNoFailures");s(i_,"planThenApply");s(s_,"canonicalEntryOrder");s(a_,"canonicalPlan");s(va,"yesFromCommandLine");s(Lt,"envFromCommandLine");s(Cd,"syncExitCode");s(c_,"isRecord");s(l_,"identityOf");s(Ii,"gidOf");s(d_,"isArchived");s(uh,"asRows");s(ya,"deepEqual");s(ih,"changedFields");s(u_,"immutableDrift");s(BD,"relationUpdateFields");Nd="__planned__";s(KD,"isTransient");s(ct,"kSend");s(p_,"isAlreadyExistsError");s(m_,"resolveExistingByIdentity");s(QD,"reconcileResource");s(oh,"registerGid");s(ph,"registerDeploy");s(VD,"reconcileSingleton");s(HD,"reconcileTeams");s(WD,"reconcileProduct");s(Te,"runDeploy");s(lt,"findConfig");s(JD,"printPlan");s(f_,"assertPushHasNoRawSecretHeaders")});function Xt(e){if(e===void 0)return"human";let t=e.toLowerCase();if(!t0.has(t))throw new Error(`Unknown --output "${e}". Use one of: human, table, json, yaml, ndjson.`);return t}function Ti(e){return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function gh(e){return e===null?"":String(e)}function fh(e){if(e==null)return"null";if(typeof e=="number"||typeof e=="boolean")return String(e);let t=String(e);return t===""||/[:#\-?,[\]{}&*!|>'"%@`]/.test(t)||/^\s|\s$/.test(t)||/^(true|false|null|~|\d)/i.test(t)?`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:t}function wa(e,t=0){let r=" ".repeat(t);if(Ti(e)||e===void 0)return`${r}${fh(e)}`;if(Array.isArray(e))return e.length===0?`${r}[]`:e.map(n=>{if(Ti(n)||n===void 0)return`${r}- ${fh(n)}`;let i=wa(n,t+1).replace(/^ {2}/,"");return`${r}- ${i.replace(/^\s+/,"")}
|
|
124
|
+
${wa(n,t+1).split(`
|
|
125
|
+
`).slice(1).join(`
|
|
126
|
+
`)}`.trimEnd()}).join(`
|
|
127
|
+
`);let o=Object.entries(e);return o.length===0?`${r}{}`:o.map(([n,i])=>Ti(i)||i===void 0?`${r}${n}: ${fh(i)}`:Array.isArray(i)&&i.length===0?`${r}${n}: []`:!Array.isArray(i)&&Object.keys(i).length===0?`${r}${n}: {}`:`${r}${n}:
|
|
128
|
+
${wa(i,t+1)}`).join(`
|
|
129
|
+
`)}function n0(e){if(e.length===0)return"(no rows)";let t=[];for(let l of e)for(let d of Object.keys(l))t.includes(d)||t.push(d);let r=s(l=>l==null?"":Ti(l)?gh(l):JSON.stringify(l),"cell"),o=t.map(l=>Math.max(l.length,...e.map(d=>r(d[l]).length))),n=s(l=>l.map((d,u)=>d.padEnd(o[u])).join(" ").trimEnd(),"fmtRow"),i=n(t),a=o.map(l=>"-".repeat(l)).join(" "),c=e.map(l=>n(t.map(d=>r(l[d]))));return[i,a,...c].join(`
|
|
130
|
+
`)}function Ld(e,t){switch(t){case"json":return JSON.stringify(e,null,2);case"ndjson":return(Array.isArray(e)?e:[e]).map(r=>JSON.stringify(r)).join(`
|
|
131
|
+
`);case"yaml":return wa(e);case"table":{let r=Array.isArray(e)?e:[e];return r.every(n=>n!==null&&typeof n=="object"&&!Array.isArray(n))?n0(r):wa(e)}case"human":default:return hh(e)}}function hh(e,t=0){let r=" ".repeat(t);if(Ti(e)||e===void 0)return`${r}${e===void 0?"":gh(e)}`;if(Array.isArray(e))return e.length===0?`${r}${bn.default.dim("(none)")}`:e.map((i,a)=>`${r}${bn.default.dim(`[${a}]`)}
|
|
132
|
+
${hh(i,t+1)}`).join(`
|
|
133
|
+
`);let o=Object.entries(e);if(o.length===0)return`${r}${bn.default.dim("(empty)")}`;let n=Math.max(...o.map(([i])=>i.length));return o.map(([i,a])=>{let c=bn.default.cyan(i.padEnd(n));return Ti(a)||a===void 0?`${r}${c} ${a===void 0?"":gh(a)}`:`${r}${c}
|
|
134
|
+
${hh(a,t+1)}`}).join(`
|
|
135
|
+
`)}function r0(e){switch(e){case"succeeded":return bn.default.green("\u2713");case"failed":return bn.default.red("\u2716");case"skipped":return bn.default.yellow("\u293F");default:return bn.default.cyan("\u25C9")}}var bn,t0,ka,yh=P(()=>{"use strict";bn=K(require("chalk"));ro();t0=new Set(["human","table","json","yaml","ndjson"]);s(Xt,"resolveOutputFormat");s(Ti,"isScalar");s(gh,"scalarToString");s(fh,"yamlScalar");s(wa,"toYaml");s(n0,"toTable");s(Ld,"renderResult");s(hh,"renderHuman");ka=class{constructor(t){this.format=t;this.tty=t==="human"&&!!process.stderr.isTTY}static{s(this,"StepLog")}tty;spinner=null;lines=[];start(t){this.tty&&(this.spinner=new Vt(`\u25C9 ${t}`).start())}finish(t){if(this.lines.push(t),!this.tty)return;let r=t.message?bn.default.dim(` (${t.message})`):"",o=`${t.label}${r}`;this.spinner?(t.status==="succeeded"?this.spinner.succeed(`\u2713 ${o}`):t.status==="failed"?this.spinner.fail(`\u2716 ${o}`):t.status==="skipped"?this.spinner.warn(`\u293F ${o}`):this.spinner.info(o),this.spinner=null):process.stderr.write(`${r0(t.status)} ${o}
|
|
136
|
+
`)}all(){return this.lines}hasFailure(){return this.lines.some(t=>t.status==="failed")}};s(r0,"glyph")});var ko,Ri,Ai=P(()=>{"use strict";ko="f4d5410c733e4c4a28858907bb7addc6d1fd34280961bdfb74cf0ac7a0a8419b",Ri={$schema:"http://json-schema.org/draft-07/schema#",title:"EventsConfig",type:"object",additionalProperties:!1,properties:{channels:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{name:{type:"string",maxLength:4096},idempotencyKey:{type:"string",maxLength:4096},description:{type:"string",maxLength:4096},type:{type:"string",enum:["topic","queue","stream"]},schema:{type:"object",properties:{type:{type:"string",enum:["json","avro","protobuf"]},definition:{type:"string",maxLength:4096},strict:{type:"boolean"}},required:["type"],additionalProperties:!1},settings:{type:"object",properties:{retentionMs:{type:"number"},maxMessageSize:{type:"number"},maxSubscriptions:{type:"number"},idempotencyWindowMs:{type:"number"}},additionalProperties:!1},metadata:{type:"object",additionalProperties:{oneOf:[{type:"string",maxLength:4096},{type:"number"},{type:"boolean"},{type:"null"}]},propertyNames:{maxLength:256,not:{enum:["__proto__","constructor","prototype"]}}},retentionMode:{type:"string",enum:["standard","compacted","compacted_with_log"]},compactionConfig:{type:"object",properties:{minAge:{type:"number"},deletePolicy:{type:"string",enum:["compact","delete","compact_and_delete"]}},additionalProperties:!1},nppMinQos:{type:"number"},rateLimit:{type:"object",properties:{ratePerSec:{type:"number"},burst:{type:"number"}},required:["ratePerSec","burst"],additionalProperties:!1},complianceClass:{type:"string",enum:["NONE","SOC2","GDPR","HIPAA","PCI","FEDRAMP_MOD","FEDRAMP_HIGH","IL5","ITAR"]},privacy:{type:"object",properties:{mode:{type:"string",enum:["standard","e2e","hybrid"]},encryptionProvider:{type:"string",enum:["none","publisher","platform"]}},required:["mode","encryptionProvider"],additionalProperties:!1},privacyMode:{type:"string",enum:["standard","hybrid","e2e"]},pii:{type:"string",enum:["strip","allow","block"]}},required:["name"]}},consumerGroups:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{channelGid:{type:"string",maxLength:4096},strategy:{type:"string",enum:["competing","sticky","broadcast"]},maxConcurrency:{type:"number"}},required:["strategy"]}},eventTypes:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{displayName:{type:"string",maxLength:4096},description:{type:"string",maxLength:4096},domain:{type:"string",maxLength:4096},entity:{type:"string",maxLength:4096},action:{type:"string",maxLength:4096},ownership:{type:"object",properties:{team:{type:"string",maxLength:4096},contact:{type:"string",maxLength:4096},slackChannel:{type:"string",maxLength:4096}},required:["team","contact"],additionalProperties:!1},channels:{type:"array",items:{type:"string",maxLength:4096}},tags:{type:"array",items:{type:"string",maxLength:4096}},schema:{type:"object",properties:{format:{type:"string",enum:["json_schema","avro","protobuf"]},definition:{type:"string",maxLength:4096}},required:["format","definition"],additionalProperties:!1}},required:["displayName","description","ownership"]}},exchanges:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{type:{type:"string",enum:["direct","fanout","topic","headers"]},config:{type:"object",properties:{headersMatchMode:{}},additionalProperties:!1}}}},subscriptions:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{channelGid:{type:"string",maxLength:4096},subscribesTo:{type:"string",enum:["messages","failures"]},idempotencyKey:{type:"string",maxLength:4096},consumerAppId:{type:"string",maxLength:4096},description:{type:"string",maxLength:4096},type:{type:"string",enum:["webhook","queue","adapter"]},filter:{type:"object",properties:{where:{type:"object",additionalProperties:{oneOf:[{type:"string",maxLength:4096},{type:"number"},{type:"boolean"}]},propertyNames:{maxLength:256,not:{enum:["__proto__","constructor","prototype"]}}},routingKey:{type:"string",maxLength:4096},subject:{type:"string",maxLength:4096}},additionalProperties:!1},subjectFilter:{type:"string",maxLength:4096},endpoint:{type:"object",properties:{url:{type:"string",format:"npayload-safe-url",maxLength:4096},method:{type:"string",enum:["POST","PUT"]},headers:{type:"object",additionalProperties:{type:"string",pattern:"^[^\\r\\n]*$",maxLength:4096},propertyNames:{pattern:"^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,128}$"}},queueName:{type:"string",maxLength:4096}},additionalProperties:!1},delivery:{type:"object",properties:{timeoutMs:{type:"number"},retryPolicy:{type:"object",properties:{maxAttempts:{type:"number"},backoffStrategy:{type:"string",enum:["exponential","linear","constant"]},initialDelayMs:{type:"number"},maxDelayMs:{type:"number"},backoffMultiplier:{type:"number"}},additionalProperties:!1},batchSize:{type:"number"},batchWindowMs:{type:"number"}},additionalProperties:!1},dlq:{type:"object",properties:{enabled:{type:"boolean"},maxAge:{type:"number"}},required:["enabled"],additionalProperties:!1},deliveryConfig:{type:"object",properties:{maxPerMinute:{type:"number"}},additionalProperties:!1},metadata:{type:"object",additionalProperties:{oneOf:[{type:"string",maxLength:4096},{type:"number"},{type:"boolean"},{type:"null"}]},propertyNames:{maxLength:256,not:{enum:["__proto__","constructor","prototype"]}}},transformPipeId:{type:"string",maxLength:4096},transformTimeout:{type:"number"},transformOnFailure:{type:"string",enum:["deliver_raw","drop_to_dlq"]}},required:["endpoint"]}}}}});var OO={};me(OO,{buildReport:()=>AO,registerDoctor:()=>jE});async function _O(e,t){try{let r=new URL("/health",e);return await ot(Ie())(r,{signal:AbortSignal.timeout(2500)}),"reachable"}catch(r){return r instanceof Z?(t.push(r),"refused"):"unreachable"}}function TM(){let e=process.env.npm_config_user_agent??"";return e.startsWith("bun")?"bun":e.startsWith("pnpm")?"pnpm":e.startsWith("yarn")?"yarn":e.startsWith("npm")?"npm":process.env.BUN_INSTALL?"bun":"unknown"}function xM(){switch(process.platform){case"darwin":return"macOS Keychain";case"win32":return"Windows Credential Manager";case"linux":return"Linux Secret Service (libsecret)";default:return`${process.platform} (unsupported)`}}async function AO(){let e=await LT(),t=!1;if(e)try{let R=await Vl();t=!!(R?.clientId&&R?.hmacSecret)}catch{t=!1}let r=!!process.env.NPAYLOAD_TOKEN,o=!!(process.env.NPAYLOAD_CLIENT_ID&&(process.env.NPAYLOAD_CLIENT_SECRET||process.env.NPAYLOAD_HMAC_SECRET)),n=pd(),i=!!(n?.clientId&&n?.hmacSecret&&!gn(n.clientId)&&!gn(n.hmacSecret)),a=t||r||o||i,c=[];(process.env.NPAYLOAD_CLIENT_SECRET||process.env.NPAYLOAD_HMAC_SECRET)&&c.push("A client secret is set in the environment. Prefer a short-lived NPAYLOAD_TOKEN, source it from a secret manager, and never commit it to a .env file.");let l=[];a||(e||l.push(process.platform==="linux"?"No OS keychain: install and start a Secret Service (e.g. `gnome-keyring` or KWallet).":"OS keychain is not reachable on this host."),l.push("In a project: run `npx @npayload/sdk init` (provisions machine credentials into .npayload.json).","Interactive: run `npayload login` (stores the session in the OS keychain).","Headless / CI: export NPAYLOAD_CLIENT_ID + NPAYLOAD_CLIENT_SECRET (or NPAYLOAD_TOKEN)."));let d=!1,u=te(process.env.NPAYLOAD_API_URL,"apiUrl")??"https://api.npayload.com",m=te(process.env.NPAYLOAD_AUTH_URL,"authUrl")??null,p=[],f=await _O(u,p),g=m?await _O(m,p):null,h=f==="reachable",y=g===null?null:g==="reachable";for(let R of p)l.push(ie(`Not probed: ${R.message}`,R));f==="unreachable"&&l.push(`API endpoint ${u} is unreachable \u2014 check your network / status page.`),m&&g==="unreachable"&&l.push(`Auth endpoint ${m} is unreachable \u2014 token minting will fail until it is back.`);let v="n/a",S=(0,UE.join)(process.cwd(),"npayload","_generated","contract.lock");if((0,Sc.existsSync)(S)){try{v=JSON.parse((0,Sc.readFileSync)(S,"utf8")).hash===ko?"ok":"stale"}catch{v="stale"}v==="stale"&&l.push("npayload/_generated/contract.lock disagrees with the installed npayload contract \u2014 this project was authored against a different version; re-run `npayload validate` after upgrading (or reinstall the pinned version).")}let k="n/a";try{let R=lt(),I=(0,UE.join)(R,"..","permissions.generated.ts"),{projectAllPermissions:x}=await Promise.resolve().then(()=>(kd(),Yg)),{checkScopesDrift:_}=await Promise.resolve().then(()=>(ga(),xd)),U=_(await x(),I);k=U.ok?"ok":(0,Sc.existsSync)(I)?"stale":"missing",!U.ok&&U.reason&&l.push(U.reason)}catch{k="n/a"}return{os:process.platform,arch:process.arch,node:process.version,packageManager:TM(),keychain:{reachable:e,backend:xM()},credentials:{envToken:r,envClient:o,project:i,keychain:t},authReady:a,stack:{apiUrl:u,apiReachable:h,apiProbe:f,authUrl:m,authReachable:y,authProbe:g,contractLock:v,permissions:k},warnings:c,remediation:l}}function RO(e){return e==="reachable"?Ee.default.green("reachable"):e==="refused"?Ee.default.yellow("refused by this run's estate (TRANSPORT_UNAVAILABLE)"):Ee.default.red("unreachable")}function er(e){return e?Ee.default.green("\u2713"):Ee.default.dim("\u25CB")}function _M(e){let t=["",Ee.default.bold(" npayload doctor"),""];t.push(` ${Ee.default.dim("platform")} ${e.os} ${e.arch} \xB7 node ${e.node} \xB7 pm ${e.packageManager}`),t.push(` ${er(e.keychain.reachable)} ${Ee.default.dim("keychain")} ${e.keychain.backend} \u2014 ${e.keychain.reachable?Ee.default.green("reachable"):Ee.default.yellow("not reachable")}`),t.push(""),t.push(` ${Ee.default.bold("credentials")}`),t.push(` ${er(e.credentials.project)} project credentials (.npayload.json)`),t.push(` ${er(e.credentials.keychain)} login session in OS keychain`),t.push(` ${er(e.credentials.envClient)} NPAYLOAD_CLIENT_ID + NPAYLOAD_CLIENT_SECRET (env)`),t.push(` ${er(e.credentials.envToken)} NPAYLOAD_TOKEN (env, short-lived)`),t.push(""),t.push(` ${Ee.default.bold("stack")}`),t.push(` ${er(e.stack.apiReachable)} API ${Ee.default.dim(e.stack.apiUrl)} \u2014 ${RO(e.stack.apiProbe)}`),e.stack.authUrl&&e.stack.authProbe!==null&&t.push(` ${er(e.stack.authReachable===!0)} auth ${Ee.default.dim(e.stack.authUrl)} \u2014 ${RO(e.stack.authProbe)}`),e.stack.contractLock!=="n/a"&&t.push(` ${er(e.stack.contractLock==="ok")} contract.lock \u2014 ${e.stack.contractLock}`),e.stack.permissions!=="n/a"&&t.push(` ${er(e.stack.permissions==="ok")} permissions.generated.ts \u2014 ${e.stack.permissions}`),t.push("");let r=!e.stack.apiReachable||e.stack.authReachable===!1,o=e.stack.apiProbe==="refused"||e.stack.authProbe==="refused";e.authReady?o?t.push(` ${Ee.default.yellow("! credentials present, but this run's estate refused a probe \u2014 see next")}`):r?t.push(` ${Ee.default.yellow("! credentials present, but the stack is unreachable \u2014 see next")}`):t.push(` ${Ee.default.green("\u2713 ready \u2014 credentials present and the stack is reachable")}`):t.push(` ${Ee.default.red("\u2716 no credential source available")}`);for(let n of e.warnings)t.push(Ee.default.yellow(` ! ${n}`));if(e.remediation.length){t.push(""),t.push(` ${Ee.default.bold("next")}`);for(let n of e.remediation)t.push(Ee.default.dim(` \u2022 ${n}`))}return t.push(""),t.join(`
|
|
137
|
+
`)}function jE(e){e.command("doctor").description("diagnose OS / package manager / keychain reachability + which credential source is available").option("--output <fmt>","human | table | json | yaml | ndjson").action(async t=>{try{let r=Xt(t.output),o=await AO();r==="human"?process.stdout.write(_M(o)+`
|
|
138
|
+
`):process.stdout.write(`${Ld(o,r)}
|
|
139
|
+
`);let n=o.stack.authReachable===!1;(!o.authReady||!o.stack.apiReachable||n)&&(process.exitCode=1)}catch(r){we(r)}})}var Sc,UE,Ee,ME=P(()=>{"use strict";Sc=require("fs"),UE=require("path"),Ee=K(require("chalk"));re();yh();Xs();vi();Ws();gt();Wt();se();Ke();Ai();qe();s(_O,"reachable");s(TM,"detectPackageManager");s(xM,"keychainBackend");s(AO,"buildReport");s(RO,"probeWords");s(er,"mark");s(_M,"renderHuman");s(jE,"registerDoctor")});function QE(e){if(e){let r=(0,tr.resolve)(process.cwd(),e);return(0,Cn.existsSync)(r)?[r]:[]}let t=[];for(let r of["events","primus","pipes"])for(let o of[(0,tr.join)("npayload",`${r}.config.ts`),`${r}.config.ts`]){let n=(0,tr.join)(process.cwd(),o);(0,Cn.existsSync)(n)&&t.push(n)}return t}function DM(e,t){if((0,Cn.existsSync)(e))try{for(let r of(0,Cn.readFileSync)(e,"utf8").split(`
|
|
140
|
+
`)){let o=r.trim();if(!o||o.startsWith("#"))continue;let n=o.indexOf("=");if(!(n===-1||o.slice(0,n).trim()!==t))return o.slice(n+1).trim().replace(/^["']|["']$/g,"")}}catch{}}function jr(e){if(e)return e;let t=process.env.NPAYLOAD_APP_ID?.trim();if(t)return t;for(let r of[(0,tr.join)(process.cwd(),".env"),(0,tr.join)(process.cwd(),"npayload",".env")]){let o=DM(r,"NPAYLOAD_APP_ID");if(o)return o}for(let r=process.cwd(),o=0;o<5;o++){let n=(0,tr.join)(r,".npayload.json");if((0,Cn.existsSync)(n))try{let a=JSON.parse((0,Cn.readFileSync)(n,"utf8"));if(typeof a.appId=="string"&&a.appId.trim())return a.appId.trim()}catch{}let i=(0,tr.join)(r,"..");if(i===r)break;r=i}}function VE(e,t,r=300,o){let n=null,i=s(()=>{n&&clearTimeout(n),n=setTimeout(()=>void t("change"),r)},"bump"),a=e.map(l=>(0,Cn.watch)(l,i)),c=new Promise(l=>{process.on("SIGINT",()=>l())});return o===void 0?c:Promise.race([c,o.ended]).catch(l=>{n&&clearTimeout(n);for(let d of a)d.close();throw l})}var Cn,tr,HE=P(()=>{"use strict";Cn=require("fs"),tr=require("path");s(QE,"findAllConfigs");s(DM,"readEnvVar");s(jr,"resolveAppGid");s(VE,"watchConfigs")});var KO={};me(KO,{pullScopesIntoManifest:()=>GM,registerScopes:()=>WE,runScopesDiff:()=>BO,runScopesFix:()=>zO});function qO(e,t){return{...e!==void 0?{cwd:e}:{},components:t}}function FO(e,t){let r=oT(e);r.length!==0&&t?.(Ve.default.dim(` (declared component(s) not embeddable \u2014 they contribute no scope: ${r.join(", ")})
|
|
141
|
+
`))}async function zO(e={}){let t=Ne(e.cwd),r=t?.path??fi(e.cwd);if(!t||!r)throw new Error("no npayload.toml found \u2014 `np scopes fix` needs a manifest with an [access_scopes] block.");lo(t.accessScopes);let o=e.floor??await Si(qO(e.cwd,t.embedComponents));FO(t.embedComponents,e.log);let n=vr(t.accessScopes,o),i=n.filter(d=>pi(d)),a=n.filter(d=>!pi(d));if(a.length>0&&e.log?.(Ve.default.dim(` (skipped ${a.length} non-catalog projection scope(s) \u2014 not declarable in [access_scopes]: ${a.join(", ")})
|
|
142
|
+
`)),i.length===0)return e.log?.(Ve.default.dim(` [access_scopes] already covers the projected floor \u2014 nothing to add.
|
|
143
|
+
`)),{appended:[],path:r,covered:!0};let c=(0,ls.readFileSync)(r,"utf8"),l=nh(c,t.accessScopes,i);return(0,ls.writeFileSync)(r,l,"utf8"),e.log?.(Ve.default.green(`\u2713 appended ${i.length} floor scope(s) to [access_scopes]:
|
|
144
|
+
${i.join(`
|
|
145
|
+
`)}
|
|
146
|
+
`)),{appended:i,path:r,covered:!0}}async function BO(e={}){let t=Ne(e.cwd);if(!t)throw new Error("no npayload.toml found \u2014 `np scopes diff` needs a manifest with an [access_scopes] block.");lo(t.accessScopes);let r=e.floor??await Si(qO(e.cwd,t.embedComponents)),o=e.appGid??jr(),n=null;e.readRemoteGrant&&o&&(n=await e.readRemoteGrant(o));let i=Ed({declared:t.accessScopes,floor:r,remote:n??{scopes:[],configDrift:!1}}),a=e.log??(c=>process.stdout.write(c));switch(FO(t.embedComponents,a),i.kind){case"floor-gap":a(Ve.default.yellow(`\u2717 [access_scopes] is missing ${i.gap.length} floor scope(s):
|
|
147
|
+
${i.gap.join(`
|
|
148
|
+
`)}
|
|
149
|
+
`)),a(Ve.default.dim(" run `npayload scopes fix` to add them.\n"));break;case"conflict":a(Ve.default.yellow(`\u2717 remote grant has drifted from the manifest:
|
|
150
|
+
`)),a(Ve.default.dim(` manifest : ${i.diff.manifest.join(", ")||"(none)"}
|
|
151
|
+
`)),a(Ve.default.dim(` remote : ${i.diff.remote.join(", ")||"(none)"}
|
|
152
|
+
`)),a(Ve.default.dim(` resolve on push with --accept-remote or --overwrite-remote.
|
|
153
|
+
`));break;case"sync":a(Ve.default.green(`\u2713 [access_scopes] covers the floor and matches the remote grant (${i.grant.length} scope(s)).
|
|
154
|
+
`));break;case"accept-remote":a(Ve.default.green(`\u2713 resolvable via --accept-remote.
|
|
155
|
+
`));break}return i}async function GM(e){let t=Ne(e.cwd),r=t?.path??fi(e.cwd);if(!t||!r)return null;let o=e.appGid??jr();if(!o)return null;let n=await e.readRemoteGrant(o);if(!n)return null;let i=[...new Set(n.scopes)].sort(),a=_d((0,ls.readFileSync)(r,"utf8"),i);return(0,ls.writeFileSync)(r,a,"utf8"),e.log?.(Ve.default.green(`\u2713 pulled ${i.length} scope(s) from the remote grant into [access_scopes].
|
|
156
|
+
`)),{written:i,path:r}}async function UM(e){let{restoreSession:t}=await Promise.resolve().then(()=>(_t(),di)),r=await t();return r?r.getOacGrant(e):null}function WE(e){let t=e.command("scopes").description("Scopes-as-code: inspect and reconcile the manifest's [access_scopes] against the floor + the remote grant");t.command("diff").description("Show the floor gap + manifest\u21C4remote drift for [access_scopes]. Exit 0 in sync, 2 with a gap/conflict, 1 on error.").action(async()=>{try{let r=await BO({readRemoteGrant:UM});process.exit(r.kind==="sync"||r.kind==="accept-remote"?0:2)}catch(r){process.stderr.write(Ve.default.red(`${ie(`scopes diff failed: ${r instanceof Error?r.message:String(r)}`,r)}
|
|
157
|
+
`)),process.exit(1)}}),t.command("fix").description("Append exactly the projected-floor gap to the manifest's [access_scopes] (idempotent)").action(async()=>{try{await zO({log:s(r=>process.stdout.write(r),"log")}),process.exit(0)}catch(r){process.stderr.write(Ve.default.red(`scopes fix failed: ${r instanceof Error?r.message:String(r)}
|
|
158
|
+
`)),process.exit(1)}})}var ls,Ve,JE=P(()=>{"use strict";ls=require("fs"),Ve=K(require("chalk"));Zt();mi();Bs();rh();ma();Xg();HE();re();s(qO,"floorOptions");s(FO,"reportInertComponents");s(zO,"runScopesFix");s(BO,"runScopesDiff");s(GM,"pullScopesIntoManifest");s(UM,"sessionGrantReader");s(WE,"registerScopes")});var Pq={};me(Pq,{buildProgram:()=>sC});module.exports=mC(Pq);var rC=require("commander"),oC=require("fs"),iC=require("url");Pt();Vr();Un();mn();var VP={"POST /v1/subscriptions/:subscriptionId/queue/purge":{confirm:"Purge ALL buffered messages in this queue? This cannot be undone."},"POST /v1/dlq/:dlqEntryId/discard":{confirm:"Discard this DLQ entry? The message will not be redelivered."},"POST /v1/dlq/discard":{confirm:"Bulk-discard DLQ entries? Discarded messages will not be redelivered."}};function HP(e){return VP[e]}s(HP,"getOverride");var S2=Object.keys(VP);Pt();mn();Ke();kl();var $e={OK:0,USER_ERROR:1,AUTH_ERROR:2,SERVER_ERROR:3,NETWORK_ERROR:4,PROTOCOL_ERROR:5},qN={auth:$e.AUTH_ERROR,deferred:$e.SERVER_ERROR,admission:$e.USER_ERROR,protocol:$e.PROTOCOL_ERROR},CI=`
|
|
159
|
+
Exit codes
|
|
160
|
+
0 ok
|
|
161
|
+
1 user error (bad args, missing file, a 4xx refusal of the request as issued)
|
|
162
|
+
2 auth error (no token, expired, scope missing \u2014 401 / 403)
|
|
163
|
+
3 server error (5xx, 429/408 after the kernel's retries)
|
|
164
|
+
4 network error (DNS, connection refused, TLS, timeout)
|
|
165
|
+
5 protocol error (an NPP answer that breaks the protocol: a malformed frame, an unsupported version or QoS, a code no registry holds)
|
|
166
|
+
`,OI=new Set(["ECONNREFUSED","ECONNRESET","ENOTFOUND","EAI_AGAIN","ETIMEDOUT","EHOSTUNREACH","ENETUNREACH","EPIPE","UND_ERR_CONNECT_TIMEOUT","UND_ERR_SOCKET","UND_ERR_HEADERS_TIMEOUT"]),FN=new Set(["AuthError","AuthenticationError","InsufficientScopeError","AuthScopeError"]),zN=/^(?:UNAUTHENTICATED|UNAUTHORIZED|FORBIDDEN|FORBIDDEN_SCOPE|INSUFFICIENT_SCOPE|TOKEN_EXPIRED|INVALID_TOKEN|MISSING_TOKEN|DPOP_[A-Z_]+|AUTHENTICATION_ERROR|SCOPE_[A-Z_]+)$/i,$I=s(e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,"asNumber"),Mf=s(e=>typeof e=="string"?e:void 0,"asString");function ur(e){if(e instanceof Y)return $e.USER_ERROR;if(e instanceof Xr)return $e.PROTOCOL_ERROR;if(e instanceof js)return qN[wl(e.refusal.name)];if(e instanceof Bt||e instanceof Nn||e instanceof jo)return $e.NETWORK_ERROR;if(e instanceof ze||e instanceof rr||e instanceof Et||e instanceof rt)return $e.AUTH_ERROR;if(e instanceof le)return e.isRetryable()?$e.SERVER_ERROR:$e.USER_ERROR;let t=e??{},r=Mf(t.code),o=Mf(t.cause?.code);if(r&&OI.has(r)||o&&OI.has(o))return $e.NETWORK_ERROR;let n=Mf(t.name);if(n&&FN.has(n))return $e.AUTH_ERROR;let i=$I(t.status)??$I(t.statusCode);return i!==void 0?i===401||i===403?$e.AUTH_ERROR:i>=500&&i<600?$e.SERVER_ERROR:$e.USER_ERROR:r&&zN.test(r)?$e.AUTH_ERROR:$e.USER_ERROR}s(ur,"exitCodeFor");re();re();var KN=new Set(["TRIAL_EXPIRED","QUOTA_EXCEEDED","PAYMENT_METHOD_REQUIRED","PLAN_REQUIRED"]),Mn=s(e=>typeof e=="string"&&e.length>0?e:void 0,"nonEmpty");function qI(e){let t=new Set,r=[e];for(;r.length>0;){let o=r.shift();if(o===null||typeof o!="object"||t.has(o))continue;t.add(o);let n=o;if(typeof n.code=="string"&&KN.has(n.code)){let i=n.details!==null&&typeof n.details=="object"?n.details:void 0,a=Mn(n.upgradePath)??Mn(n.upgradeUrl)??Mn(i?.upgradePath)??Mn(i?.upgradeUrl);if(a!==void 0){let c=Mn(n.reason)??Mn(i?.reason)??Mn(n.message),l=Mn(n.product)??Mn(i?.product);return{code:n.code,reason:c,upgradeUrl:a,...l!==void 0?{product:l}:{}}}}for(let i of["details","body","error","data","raw"])n[i]!==void 0&&r.push(n[i])}return null}s(qI,"extractUpgradeRefusal");Pt();se();re();var BI="Settings > Security > Networks",JN="Developers > API keys";function Al(e,t){if(e===null||typeof e!="object")return;let r=e;if(t(r.code))return r.code;if(t(r.upstreamCode))return r.upstreamCode}s(Al,"ruleCodeOf");function Vf(e){return e instanceof Et?!0:Al(e,Fr)!==void 0}s(Vf,"isSourceRefusal");function Hf(e){return e instanceof rt?!0:Al(e,zr)!==void 0}s(Hf,"isFingerprintRefusal");async function KI(e,t,r=3e3,o){let n;try{n=new URL("/cdn-cgi/trace",e).toString()}catch{return}try{let a=await ot(t,o)(n,{method:"GET",signal:AbortSignal.timeout(r)});if(!a.ok)return;let c=await a.text();for(let l of c.split(/\r?\n/)){if(!l.startsWith("ip="))continue;let d=l.slice(3).trim();return ZN(d)?d:void 0}return}catch{return}}s(KI,"addressThisMachineReachesNpayloadFrom");function ZN(e){return/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/.test(e)?!0:/^[0-9a-f:]+$/i.test(e)&&e.includes(":")&&e.length<=39}s(ZN,"isAddress");function YN(e){return e.includes(":")?`${e}/128`:`${e}/32`}s(YN,"hostNetworkOf");function Wf(e,t){let r=Al(e,Fr)??"source_network_not_allowed",o=r.toLowerCase()==="source_network_not_declared",n=t!==void 0?`this machine reaches npayload from ${t}, which`:"the network this call came from",i=o?`npayload refused this request: this app environment has no network yet, so its keys cannot be used${t!==void 0?` (this machine reaches npayload from ${t})`:""}.`:`npayload refused this request: ${n} is not a network of this app environment.`,a=t!==void 0?`Add ${YN(t)} in the dashboard under ${BI}, then run the command again.`:`Add the network this machine uses in the dashboard under ${BI}, then run the command again. Open the API host's /cdn-cgi/trace page on this machine to see the address npayload sees.`;return new G(i,{code:r,hint:a,cause:e})}s(Wf,"sourceRefusalCliError");function Jf(e){let t=Al(e,zr)??"thumbprint_not_bound",r=e.fingerprint,o=typeof r=="string"&&r.length>0?` (${r})`:"";return new G(`npayload refused this request: the key fingerprint this machine presents${o} is not enrolled for this API key.`,{code:t,hint:`Open the API key's enrollment window in the dashboard under ${JN}, then run the command again from a network of this app environment.`,cause:e})}s(Jf,"fingerprintRefusalCliError");async function QI(e,t){if(Vf(e)){let r=t!==void 0?await t().catch(()=>{}):void 0;return Wf(e,r)}if(Hf(e))return Jf(e)}s(QI,"callerRefusalCliError");var Zf={LIMIT_EXCEEDED:{message:"You've reached your plan's limit for this resource.",hint:"Upgrade your plan in the dashboard (Settings \u2192 Billing) to raise the limit."},TIER_LIMIT_EXCEEDED:{message:"You've reached your plan's limit for this resource.",hint:"Archive an unused one to free a slot, or upgrade your plan in the dashboard (Settings \u2192 Billing) to raise the limit."},PER_RUN_LIMIT_EXCEEDED:{message:"This request is too large for a single run.",hint:"Shorten the message, or split the task into smaller steps."},CAPABILITY_REQUIRED:{message:"This feature isn't included in your current plan.",hint:"Upgrade your plan in the dashboard (Settings \u2192 Billing) to unlock it."},BILLING_LIMIT:{message:"You've used your plan's monthly allowance.",hint:"Upgrade your plan, or wait for the next billing cycle."},BUDGET_EXCEEDED:{message:"Your AI budget for this period has been used.",hint:"Raise the budget in the dashboard, or upgrade your plan."},BUDGET_CAP_EXCEEDED:{message:"Your organization's daily AI spending cap has been reached.",hint:"Try again tomorrow, or raise the cap in the dashboard."},RATE_LIMITED:{message:"Too many requests right now.",hint:"Wait a moment and try again."},SECURITY_BLOCKED:{message:"This input was blocked by safety checks.",hint:"Rephrase the request and try again."},NOT_FOUND:{message:"We couldn't find that. It may have been moved or removed."},FORBIDDEN:{message:"You don't have permission to do that.",hint:"Ask an organization admin to grant access if you think you should have it."},PERMISSION_DENIED:{message:"You don't have permission to do that.",hint:"Ask an organization admin to grant access if you think you should have it."},INSUFFICIENT_SCOPE:{message:"This credential doesn't have the scope needed for that.",hint:"Re-provision the credential with the required scope."},UNAUTHORIZED:{message:"You're not signed in.",hint:"Run: np login"},UNAUTHENTICATED:{message:"Your session has expired.",hint:"Run: np login"},INVALID_ARGUMENT:{message:"Some of the provided values weren't valid. Check the flags and try again."},VALIDATION_ERROR:{message:"Some of the provided values weren't valid. Check the flags and try again."},INVALID_STATE:{message:"That action isn't possible right now \u2014 the item may have changed. Re-fetch and try again."},CONFLICT:{message:"That change conflicts with the current state. Re-fetch and try again."},EXPIRED:{message:"This item or link has expired. Request a new one and try again."},RUN_START_TIMEOUT:{message:"The agent didn't start in time.",hint:"Try again \u2014 if this keeps happening, contact support."},INTERNAL:{message:"Something went wrong on our side. Please try again \u2014 the error has been logged."},INTERNAL_ERROR:{message:"Something went wrong on our side. Please try again \u2014 the error has been logged."}};function Ol(e){if(e instanceof G)return e;if(Vf(e))return Wf(e,void 0);if(Hf(e))return Jf(e);let t=qI(e);if(t)return new G(t.reason??"This request was refused by your plan's current state.",{code:t.code,hint:"Upgrade your plan to continue",docs:t.upgradeUrl,cause:e});let r=e?.code;if(typeof r=="string"){let o=Zf[r]??Zf[r.toUpperCase()];if(o)return new G(o.message,{code:r,hint:o.hint,docs:o.docs,cause:e})}return e}s(Ol,"toFriendlyCliError");function VI(e){let t=e.kind??e.code,r=t?Zf[t]:void 0;return r||{message:e.message??"The agent run failed. Please try again."}}s(VI,"friendlyStreamErrorLine");function Yf(e,t){let r=e.commands;if(Array.isArray(r))return r.find(o=>{let n=typeof o.name=="function"?o.name():void 0;if(n!==void 0&&t.has(n))return!0;let i=typeof o.aliases=="function"?o.aliases():void 0;return Array.isArray(i)&&i.some(a=>t.has(a))})}s(Yf,"findChild");var XN=/token|secret|password|passphrase|apikey|api_key|credential|privatekey/i;function HI(e){return XN.test(e)}s(HI,"isSecretFlag");async function eL(e,t,r){let o=e.flags.filter(i=>i.name!=="idempotencyKey"&&t[i.name]===void 0),n=[...o.filter(i=>!i.optional),...o.filter(i=>i.optional)];for(let i of n){let a=`--${$l(i.name)}`,c=i.optional?" (optional, blank to skip)":"",l=i.coerce==="json"?" [JSON]":"",d;if(i.choices&&i.choices.length>0){let u=i.choices.map(m=>({name:m,value:m}));i.optional&&u.push({name:"(skip)",value:""}),d=await r.select(`${a}${l}`,u)}else HI(i.name)?d=await r.secret(`${a}${c}`,{optional:i.optional}):d=await r.text(`${a}${l}${c}`,{optional:i.optional});d!==""&&(t[i.name]=d)}}s(eL,"fillFlagsInteractively");function tL(e,t){if(t.size===0)return e;let r=s(o=>{if(typeof o=="string")return t.has(o)?"[redacted \u2014 same value you supplied]":o;if(Array.isArray(o))return o.map(r);if(o&&typeof o=="object"){let n={};for(let[i,a]of Object.entries(o))n[i]=r(a);return n}return o},"walk");return r(e)}s(tL,"redactEchoedSecrets");var nL={channels:["events","channels"],messages:["events","messages"],subscriptions:["events","subscriptions"],dlq:["events","dlq"],streams:["events","streams"]};function $l(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}s($l,"kebab");var rL={connectAccess:"grants",connectBridges:"bridges",connectExplore:"explore",connectProfile:"profile",connectPartner:"partner",connectTenantApproval:"approvals"},oL={"connect.connect.requestAccess":{group:["connect","grants"],leaf:"request"},"connect.connect.approveAccess":{group:["connect","grants"],leaf:"approve"},"connect.connect.rejectAccess":{group:["connect","grants"],leaf:"reject",aliases:["decline"]},"connect.connect.revokeGrant":{group:["connect","grants"],leaf:"revoke"},"connect.connectAccess.listMyGrants":{group:["connect","grants"],leaf:"list"},"connect.connectAccess.getGrant":{group:["connect","grants"],leaf:"get"}};function WI(e){return`--${$l(e.name)} <value>`}s(WI,"optionSpec");function iL(e){let t=e.choices!==void 0&&e.choices.length>0?`, one of: ${e.choices.join(", ")}`:"";return`${e.coerce??"string"}${t}${e.optional?"":" (required)"}`}s(iL,"optionHelp");function sL(e,t){let r=[`np ${t}`,...e.pathParams.map(i=>`<${i.key}>`)];for(let i of e.flags)i.name==="idempotencyKey"||i.optional||r.push(WI(i));let o=[],n="";for(let i of r)n===""?n=i:`${n} ${i}`.length>78?(o.push(`${n} \\`),n=` ${i}`):n=`${n} ${i}`;return o.push(n),o}s(sL,"exampleLines");var aL="wickfeed/lit",cL="wickfeed.lit",lL=s(e=>e.split("/").filter(t=>t.length>0),"pathSegments"),dL=s(e=>e.startsWith(":")||e.startsWith("{")&&e.endsWith("}"),"isPathParam");function uL(e){let t=lL(e.pattern);if(!t.some(o=>o==="feeds"||o==="feed-listings"))return;let r=t[t.length-1]??"";if(e.method==="POST"&&(r==="subscribe"||r.startsWith("subscribe-")))return"subscribe";if(e.method==="DELETE"&&t[t.length-2]==="subscriptions"&&dL(r)||r==="unsubscribe")return"unsubscribe"}s(uL,"feedRefVerb");function pL(e,t){let r=t==="subscribe"?"Subscribe":"Unsubscribe",o=`${aL} (or its alias ${cL})`;return Yf(e,new Set([t]))!==void 0?`${r} by ref: np ${t} ${o}`:`${r} by the ref form, ${o}, never a gid`}s(pL,"feedRefLine");function JI(e,t,r){let o=new Map,n=s(c=>{let l=e,d="";for(let u of c){let m=$l(u),p=rL[u]??m;d=d?`${d} ${p}`:p;let f=new Set;u!==p&&f.add(u),m!==p&&f.add(m);let g=o.get(d);if(g){l=g.node;let h=l.alias;if(typeof h=="function")for(let y of f)g.aliases.has(y)||(h.call(l,y),g.aliases.add(y))}else{let h=Yf(l,new Set([p,...f]));if(h){let y=new Set(typeof h.aliases=="function"?h.aliases():[]),v=h.alias;if(typeof v=="function")for(let S of f)y.has(S)||(v.call(h,S),y.add(S));o.set(d,{node:h,aliases:y}),l=h}else{let y=l.command(p),v=y.alias,S=new Set;if(typeof v=="function")for(let k of f)v.call(y,k),S.add(k);o.set(d,{node:y,aliases:S}),l=y}}}return{node:l,path:d}},"groupNode"),i=new Map,a=s((c,l,d)=>{let u=c.commandPath[c.commandPath.length-1],{node:m,path:p}=n(l),f=d?.leaf??$l(u),g=p?`${p} ${f}`:f,h=i.get(g);if(h!==void 0)throw new Error(`CLI command table conflict: rows '${h}' and '${c.key}' both map to 'np ${g}'. This release of @npayload/sdk spells two commands alike; it is a defect of the package, not of your project. Upgrade @npayload/sdk, or contact support if the newest release fails the same way.`);if(i.set(g,c.key),Yf(m,new Set([f])))return;let y=c.pathParams.map(k=>`<${k.key}>`).join(" "),v=m.command(y?`${f} ${y}`:f),S=v.alias;if(typeof S=="function")for(let k of d?.aliases??[])S.call(v,k);v.description(c.summary);for(let k of c.flags)k.name!=="idempotencyKey"&&v.option(WI(k),iL(k));if(bf(c.method)&&(c.idempotent||c.flags.some(k=>k.name==="idempotencyKey"))&&v.option("--idempotency-key <key>","Idempotency key (UUIDv7 auto-generated when omitted)"),c.flags.some(k=>k.name!=="idempotencyKey")&&v.option("-i, --interactive","prompt step-by-step for any flag not passed on the command line"),typeof v.addHelpText=="function"){let k=uL(c);v.addHelpText("after",k===void 0?`
|
|
167
|
+
Example:
|
|
168
|
+
${sL(c,g).join(`
|
|
169
|
+
`)}`:`
|
|
170
|
+
${pL(e,k)}`)}v.action(async(...k)=>{let R,I=k.slice(0,c.pathParams.length),x=k[c.pathParams.length],_=x&&typeof x=="object"?x:{},U=_.interactive===!0,A={};for(let[D,M]of Object.entries(_))M===void 0||typeof M=="function"||D!=="interactive"&&(D==="idempotencyKey"?A["idempotency-key"]=String(M):A[D]=String(M));try{if(U){if(!r.prompt)throw new Y("--interactive is not available in this environment");if(r.isInteractive&&!r.isInteractive())throw new Y("--interactive requires a TTY; pass the values as flags instead (see --help for the full list)");await eL(c,A,r.prompt)}let D=HP(c.opId);if(D?.confirm&&r.confirm&&!await r.confirm(D.confirm)){r.printError("aborted"),r.exit(1);return}let M=pn({row:c,positionals:I,flags:A,newIdempotencyKey:r.newIdempotencyKey});R=M;let V=await r.send(M),J=new Set(Object.entries(A).filter(([T,q])=>HI(T)&&q!=="").map(([,T])=>T)),w=yf(tL(V,J));D?.render?r.print(D.render(w)):r.print(w),r.exit(0)}catch(D){if(D instanceof Y){r.printError(D.message),r.exit(D.exitCode);return}let M=r.whereAmI,V=await QI(D,M!==void 0?()=>M(R):void 0)??Ol(D),J=V instanceof G?V:D,w=V instanceof G?xl(V):D instanceof Error?D.message:String(D);r.printError(Ce(w,J)),r.exit(ur(D))}})},"registerRow");for(let c of t){a(c,c.commandPath.slice(0,-1));let l=gL(c.commandPath);l&&a(c,l);let d=oL[c.key];d&&a(c,d.group,d)}}s(JI,"registerGeneratedCommands");function Xf(e){for(let t of e.commands??[])Xf(t),(t.commands??[]).length!==0&&mL(t)===""&&t.description(fL(t))}s(Xf,"describeUndescribedGroups");function mL(e){let t=e.description,r=typeof t=="function"?t.call(e):void 0;return typeof r=="string"?r:""}s(mL,"currentDescription");function ZI(e){let t=e.commands??[];return t.length===0?1:t.reduce((r,o)=>r+ZI(o),0)}s(ZI,"leafCount");function fL(e){let t=(e.commands??[]).map((i,a)=>({name:typeof i.name=="function"?i.name():"",n:ZI(i),i:a})).filter(i=>i.name!=="").sort((i,a)=>a.n-i.n||i.i-a.i),r=t.reduce((i,a)=>i+a.n,0),o=t.slice(0,5).map(i=>i.name),n=t.length-o.length;return`${o.join(", ")}${n>0?` and ${n} more`:""} (${r} ${r===1?"command":"commands"})`}s(fL,"groupSummary");function gL(e){for(let[t,r]of Object.entries(nL))if(e.length>=3&&e[0]===r[0]&&e[1]===r[1])return[t,...e.slice(2,-1)];return null}s(gL,"rootAliasPath");var Fn=require("@inquirer/prompts"),to=K(require("chalk"));var eg=class extends Error{static{s(this,"NonInteractiveError")}constructor(){super("Interactive mode required. Use --skip-auth and set NPAYLOAD_CLIENT_ID + NPAYLOAD_HMAC_SECRET env vars for non-interactive environments."),this.name="NonInteractiveError"}};function ft(){return!!(process.stdin.isTTY&&process.stdout.isTTY)}s(ft,"isInteractive");function Cl(){if(!ft())throw new eg}s(Cl,"ensureTTY");async function qs(e,t){return Cl(),(0,Fn.input)({message:e,default:t?.default,validate:t?.validate})}s(qs,"askText");async function Qt(e,t){return Cl(),(0,Fn.select)({message:e,choices:t})}s(Qt,"askSelect");async function XI(e,t=!1){return Cl(),(0,Fn.confirm)({message:e,default:t})}s(XI,"askConfirm");async function eT(e,t){return Cl(),(0,Fn.checkbox)({message:e,choices:t,loop:!1,pageSize:15})}s(eT,"askCheckbox");function Fs(e){console.log(),console.log(to.default.bold(e)),console.log(to.default.dim("\u2500".repeat(60)))}s(Fs,"sectionHeader");function YI(e){return e.replace(/\x1b\[[0-9;]*m/g,"").length}s(YI,"visibleWidth");function Nl(e){let t=Math.max(...e.map(o=>YI(o))),r="\u2500".repeat(t+4);console.log(),console.log(to.default.dim(`\u250C${r}\u2510`));for(let o of e){let n=" ".repeat(Math.max(0,t-YI(o)));console.log(to.default.dim("\u2502 ")+o+n+to.default.dim(" \u2502"))}console.log(to.default.dim(`\u2514${r}\u2518`)),console.log()}s(Nl,"printBox");var B=K(require("chalk")),ia=require("fs"),$g=require("path");ro();var Ae=require("fs"),pr=require("path");var Ll=require("crypto"),Dl=require("fs"),nT=require("path");function Gl(){let{publicKey:e,privateKey:t}=(0,Ll.generateKeyPairSync)("ec",{namedCurve:"P-256"}),r=t.export({format:"jwk"}),o=e.export({format:"jwk"}),n=JSON.stringify({crv:o.crv,kty:o.kty,x:o.x,y:o.y});return{kid:(0,Ll.createHash)("sha256").update(n).digest("base64url").slice(0,12),alg:"ES256",publicJwk:o,privateJwk:r,createdAt:Date.now()}}s(Gl,"provisionDpopKeypair");function zs(e){let t=(0,nT.join)(e,".npayload.json");if(!(0,Dl.existsSync)(t))return null;try{let r=JSON.parse((0,Dl.readFileSync)(t,"utf8"));if(r.dpopKid&&r.dpopPrivateJwk&&r.dpopPublicJwk)return{kid:r.dpopKid,alg:"ES256",privateJwk:r.dpopPrivateJwk,publicJwk:r.dpopPublicJwk,createdAt:Date.now()}}catch{}return null}s(zs,"readExistingDpop");Bs();function iT(e,t){return["# managed by npayload \u2014 environments + access scopes as code","# docs: https://npayload.com/docs/manifest","","[app]",`slug = "${e.appSlug}"`,...e.appName&&e.appName!==e.appSlug?[`name = "${e.appName}"`]:[],"",`# Development environments (N per app). \`np env use ${t}\` targets it;`,"# add more with `np env create` (each maps onto the shared sandbox pool).",`[env.${t}]`,'kind = "development"',"","# The production environment (exactly ONE per app \u2014 the production","# singleton). Only `np deploy` writes here; the branch guard requires","# main/master (or this env's deploy_branch).","[env.production]",'kind = "production"',"","# Scopes-as-code: the concrete <resource>:<action>","# grants this app's machine credential holds. `np scopes fix` fills the","# projected floor from your config; wildcards are rejected.","[access_scopes]","scopes = []","","# Embedded components. Name the components you","# MOUNT \u2014 never their scopes. `np scopes fix` derives the scopes those","# components need, plus the embed/tenant scopes your own backend needs to","# mint a session, from the component map. Adding an id here is the ONLY","# edit required; an unknown id fails the parse.",'# e.g. components = ["primus", "connect"]',`# valid ids: ${ng.join(", ")}`,"[embed]","components = []",""].join(`
|
|
171
|
+
`)}s(iT,"renderManifest");function rg(e){return`import { defineEventsConfig } from "@npayload/sdk";
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Declare your Events topology here, then:
|
|
175
|
+
* npayload validate check it against the contract
|
|
176
|
+
* npayload deploy reconcile it to npayload (idempotent)
|
|
177
|
+
*
|
|
178
|
+
* Tip: ask your coding agent \u2014 "set up npayload Events for this app" \u2014 and it
|
|
179
|
+
* will fill this in from your schema using the npayload MCP server. Resources are
|
|
180
|
+
* keyed by their natural identity (a channel by its slug, a subscription by its
|
|
181
|
+
* name). Publish from your code with: np.events.publish("<channel-slug>", payload).
|
|
182
|
+
*/
|
|
183
|
+
export default defineEventsConfig({
|
|
184
|
+
channels: {
|
|
185
|
+
// orders: { name: "Orders", type: "queue" },
|
|
186
|
+
},
|
|
187
|
+
// eventTypes: { ... },
|
|
188
|
+
// subscriptions: { ... },
|
|
189
|
+
});
|
|
190
|
+
`}s(rg,"renderEventsConfig");function og(e){return`import { definePrimusConfig } from "@npayload/sdk";
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Declare your Primus (AI) topology here, then:
|
|
194
|
+
* npayload dev watch + sync this (and events.config.ts) live
|
|
195
|
+
* npayload deploy reconcile to npayload (idempotent: create + update)
|
|
196
|
+
*
|
|
197
|
+
* Tip: ask your coding agent \u2014 "set up npayload Primus for this app" \u2014 and it
|
|
198
|
+
* will fill this in using the npayload MCP server. Secrets (LLM keys) NEVER go
|
|
199
|
+
* in this file \u2014 store them as credentials from the dashboard and reference them.
|
|
200
|
+
*/
|
|
201
|
+
export default definePrimusConfig({
|
|
202
|
+
// \u2500\u2500 Agents \u2014 your autonomous workers (keyed by slug) \u2500\u2500
|
|
203
|
+
agents: {
|
|
204
|
+
// support_bot: { // \u2190 the slug (stable identity)
|
|
205
|
+
// name: "Support Bot", // \u2190 display name (rename freely)
|
|
206
|
+
// description: "Answers customer questions from the docs.",
|
|
207
|
+
// systemPrompt: "You are a helpful support agent. Be concise and cite sources.",
|
|
208
|
+
// personality: "friendly",
|
|
209
|
+
// language: "en",
|
|
210
|
+
// skills: ["summarize"], // skill SLUGS declared below (reconciled)
|
|
211
|
+
// },
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
// \u2500\u2500 Skills \u2014 reusable capabilities an agent can call (keyed by slug) \u2500\u2500
|
|
215
|
+
// Slugs must match /^[a-z][a-z0-9_]*$/ (lowercase, digits, underscore \u2014 no hyphens).
|
|
216
|
+
skills: {
|
|
217
|
+
// summarize: { // \u2190 the slug
|
|
218
|
+
// name: "Summarize", // \u2190 display name
|
|
219
|
+
// description: "Summarize a block of text into 3 bullet points.",
|
|
220
|
+
// category: "text",
|
|
221
|
+
// executor: "inline", // "inline" | "cloud_run" | "fly_machines"
|
|
222
|
+
// definition: {
|
|
223
|
+
// systemPrompt: "Summarize the input into exactly 3 concise bullet points.",
|
|
224
|
+
// tools: ["fetch_url"], // tool SLUGS this skill may use
|
|
225
|
+
// },
|
|
226
|
+
// },
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
// \u2500\u2500 Tools \u2014 actions agents/skills can invoke (keyed by slug) \u2500\u2500
|
|
230
|
+
// Slugs must match /^[a-z][a-z0-9_]*$/ (no hyphens). riskLevel is REQUIRED and
|
|
231
|
+
// must be "safe" | "moderate" | "dangerous". An "inline" tool needs no endpoint;
|
|
232
|
+
// a "webhook" tool requires an HTTPS \`endpoint\`.
|
|
233
|
+
tools: {
|
|
234
|
+
// fetch_url: { // \u2190 the slug
|
|
235
|
+
// name: "Fetch URL", // \u2190 display name
|
|
236
|
+
// description: "Fetch a URL and return the response body.",
|
|
237
|
+
// riskLevel: "safe", // "safe" | "moderate" | "dangerous"
|
|
238
|
+
// executor: "inline", // omit endpoint for inline tools
|
|
239
|
+
// timeout: 10000,
|
|
240
|
+
// },
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
// \u2500\u2500 Triggers \u2014 fire an agent on an event/schedule (keyed by slug) \u2500\u2500
|
|
244
|
+
// Requires the \`triggers:read\`/\`triggers:write\` scopes on your OAuth client.
|
|
245
|
+
// triggers: {
|
|
246
|
+
// on_new_order: { // \u2190 the slug
|
|
247
|
+
// name: "On New Order", // \u2190 display name
|
|
248
|
+
// description: "Run support-bot when an order is created.",
|
|
249
|
+
// agentGid: "support_bot", // an agent SLUG above (resolved to its gid)
|
|
250
|
+
// type: "event", // "cron" | "event" | "webhook" | "message"
|
|
251
|
+
// config: { eventType: "orders.created" },
|
|
252
|
+
// action: { goal: "Summarize the new order and notify the team." },
|
|
253
|
+
// },
|
|
254
|
+
// },
|
|
255
|
+
});
|
|
256
|
+
`}s(og,"renderPrimusConfig");function ig(e){return`import { definePipesConfig } from "@npayload/sdk";
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Declare your Pipes (automation) topology here, then:
|
|
260
|
+
* npayload dev watch + sync this (and events/primus) live
|
|
261
|
+
* npayload deploy reconcile to npayload (idempotent: create + update)
|
|
262
|
+
*
|
|
263
|
+
* Tip: ask your coding agent \u2014 "set up a npayload workflow for this app" \u2014 and it
|
|
264
|
+
* will fill this in using the npayload MCP server (call \`pipes_contract\` for the
|
|
265
|
+
* schema). Secrets (connector API keys) NEVER go in this file \u2014 store them as
|
|
266
|
+
* credentials from the dashboard and point the connector at the stored credential.
|
|
267
|
+
*/
|
|
268
|
+
export default definePipesConfig({
|
|
269
|
+
// \u2500\u2500 Workflows \u2014 your automations (keyed by name) \u2500\u2500
|
|
270
|
+
// A workflow is a node graph (nodes reference connectors) + a trigger.
|
|
271
|
+
// Config \`update\` changes name/description only; edit the node graph in the editor.
|
|
272
|
+
workflows: {
|
|
273
|
+
// "daily-digest": {
|
|
274
|
+
// description: "Summarize yesterday's orders and post to the team.",
|
|
275
|
+
// definition: {
|
|
276
|
+
// nodes: [
|
|
277
|
+
// { id: "start", type: "trigger", position: { x: 0, y: 0 }, data: {} },
|
|
278
|
+
// ],
|
|
279
|
+
// edges: [],
|
|
280
|
+
// },
|
|
281
|
+
// // type: "event" | "schedule" | "webhook" | "manual" | "form"
|
|
282
|
+
// triggerConfig: { type: "schedule", config: { cron: "0 9 * * *" } },
|
|
283
|
+
// },
|
|
284
|
+
},
|
|
285
|
+
|
|
286
|
+
// \u2500\u2500 Credentials \u2014 connector auth (keyed by name) \u2500\u2500
|
|
287
|
+
// NEVER put a plaintext key here. Store it as a credential from the dashboard
|
|
288
|
+
// in the vault (AES-256-GCM), then reference it via auth.vaultSecretId.
|
|
289
|
+
credentials: {
|
|
290
|
+
// "openai-key": {
|
|
291
|
+
// connectorId: "openai",
|
|
292
|
+
// auth: { type: "api_key", vaultSecretId: "<the stored credential's id>" },
|
|
293
|
+
// },
|
|
294
|
+
},
|
|
295
|
+
});
|
|
296
|
+
`}s(ig,"renderPipesConfig");function sg(e){return`import { defineConnectConfig } from "@npayload/sdk";
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Declare cross-org identity BRIDGES here, then:
|
|
300
|
+
* npayload validate check it against the Connect contract
|
|
301
|
+
* npayload deploy reconcile it to npayload (admin is the source of truth)
|
|
302
|
+
*
|
|
303
|
+
* A bridge maps the same real entity across two orgs that use different ids
|
|
304
|
+
* (e.g. a customer that is "customer_123" in your org and "contact_XYZ" in the
|
|
305
|
+
* other). Each entry is keyed by the TARGET org's GID. Declaring a bridge is an
|
|
306
|
+
* OFFER: it stays pending until the TARGET org confirms it in its own config.
|
|
307
|
+
*
|
|
308
|
+
* Everything else in Connect (profile, access grants, tenant approvals) is
|
|
309
|
+
* imperative \u2014 ask your coding agent and call connect_usage for the np.connect.*
|
|
310
|
+
* snippets.
|
|
311
|
+
*/
|
|
312
|
+
export default defineConnectConfig({
|
|
313
|
+
bridges: {
|
|
314
|
+
// "<target-org-gid>": { entityTypeSlug: "customer" },
|
|
315
|
+
},
|
|
316
|
+
});
|
|
317
|
+
`}s(sg,"renderConnectConfig");Ks();ag();function Vs(e){return JSON.stringify({version:Qs,hash:sT,note:"Pinned npayload contract. Bump by installing a newer npayload version."},null,2)+`
|
|
318
|
+
`}s(Vs,"renderContractLock");oo();function lg(e){return JSON.stringify({mcpServers:{npayload:{command:"npx",args:[Ml(),"mcp","serve"]}}},null,2)+`
|
|
319
|
+
`}s(lg,"renderMcpConfig");Ws();function ql(e,t={}){let r=e.apiUrl?`
|
|
320
|
+
# API URL
|
|
321
|
+
NPAYLOAD_API_URL=${e.apiUrl}
|
|
322
|
+
`:"",o=`
|
|
323
|
+
# NPAYLOAD_AUTH_URL=<token host> (optional; with none named, the token is minted at the API's own /oauth/token)
|
|
324
|
+
`,n=e.transport??"npp",i=e.edgeUrl?`NPAYLOAD_EDGE_URL=${e.edgeUrl}
|
|
325
|
+
`:t.namesEdge?"":`# NPAYLOAD_EDGE_URL=<edge URL> (optional on npayload's production API, whose edge is the default; required for any other API)
|
|
326
|
+
`,a=e.dpop?`
|
|
327
|
+
# Signing key for the secure transport (provisioned by \`npayload init\`).
|
|
328
|
+
NPAYLOAD_DPOP_KID=${e.dpop.kid}
|
|
329
|
+
NPAYLOAD_DPOP_PRIVATE_JWK=${JSON.stringify(e.dpop.privateJwk)}
|
|
330
|
+
`:"",c=n==="http"?`
|
|
331
|
+
# Transport: HTTP/JSON (opted in via --http). Re-run \`npayload init\` for the default secure transport.
|
|
332
|
+
NPAYLOAD_TRANSPORT=http
|
|
333
|
+
`:`
|
|
334
|
+
# Transport: the default secure binary wire. The SDK provisions and registers a
|
|
335
|
+
# signing key automatically on first use \u2014 nothing for you to manage.
|
|
336
|
+
NPAYLOAD_TRANSPORT=npp
|
|
337
|
+
${i}`;return`# npayload credentials
|
|
338
|
+
# Created by: npayload init
|
|
339
|
+
${gn(e.clientId)?`# Not connected yet. These are PLACEHOLDERS \u2014 run \`npayload login\` to fill in
|
|
340
|
+
# your real app credentials. The project is safe to import; only the first
|
|
341
|
+
# network call needs real credentials.
|
|
342
|
+
`:""}
|
|
343
|
+
NPAYLOAD_CLIENT_ID=${e.clientId}
|
|
344
|
+
NPAYLOAD_HMAC_SECRET=${e.hmacSecret}
|
|
345
|
+
NPAYLOAD_APP_ID=${e.appId}
|
|
346
|
+
${r}${o}${c}${a}`}s(ql,"renderEnvFile");var Fl=["","# npayload \u2014 credentials (never commit)",".env",".npayload.json","# npayload \u2014 local machine state (regenerated; like .next/)",".npayload/"],dg=["npayload/_generated/","npayload/_generated"];var fT=[{step:1,do:"Check the project state: credentials, endpoint reachability, generated artifacts.",mcpTool:"npayload_status",cli:"npayload doctor",expect:"ok:true with a credential source present. If not, stop and show the user the remediation lines."},{step:2,do:"Fetch the config contract for the product you are wiring \u2014 Events (channels/eventTypes/subscriptions), Pipes (workflows/credentials), or Primus AI agents (agents/skills/tools/triggers). Each returns JSON Schema + capability catalog + guidance: the ONLY source for what that config may contain \u2014 never guess fields.",mcpTool:"events_contract / pipes_contract / primus_contract",cli:null,expect:"The schema you will author npayload/<product>.config.ts against."},{step:3,do:"Study the app's own data model (its schema/models/types) and design the topology in the product config(s): npayload/events.config.ts (channels, typed eventTypes, subscriptions), npayload/pipes.config.ts (workflows, vault-referenced credentials), npayload/primus.config.ts (agents, skills, tools, triggers).",mcpTool:null,cli:null,expect:"One default-exported define<Product>Config({...}) per product the app uses, reflecting its real domain."},{step:4,do:"Validate each config offline against its contract.",mcpTool:"events_validate / pipes_validate / primus_validate",cli:"npayload validate",expect:"ok:true per product. Fix every issue it returns before going further."},{step:5,do:"Preview the plan \u2014 nothing is applied.",mcpTool:"events_deploy / pipes_deploy / primus_deploy (check:true)",cli:"npayload diff",expect:"A plan of creates/updates/no-ops (and orphans). Review it; surprises here mean the config is wrong."},{step:6,do:"Apply to the sandbox. This also regenerates npayload/permissions.generated.ts (the per-object scope union across EVERY product config present) and npayload/_generated/events.d.ts (typed payloads).",mcpTool:"events_deploy / pipes_deploy / primus_deploy",cli:"npayload push",expect:"Resources reconciled; generated files updated. A second run is all no-ops (idempotent)."},{step:7,do:'Wire the app code: np.events.publish("<channel-slug>", payload) \u2014 payloads are typed by _generated/events.d.ts after the push; np.pipes.* / np.primus.* for the other products. Use events_usage for copy-ready runtime recipes; one-off operations on ANY product go through npayload_catalog \u2192 npayload_invoke.',mcpTool:"events_usage",cli:null,expect:"App code compiles against the generated payload types."},{step:8,do:"Prove it end to end: publish one real event from the app, watch it arrive.",mcpTool:null,cli:"npayload tail <channel-slug>",expect:"The published event printed live in the terminal."}],gT=["Never guess config fields or operations. The config schema comes from the product's contract tool (`events_contract` / `pipes_contract` / `primus_contract`, or `npayload validate`); the full operation surface comes from `npayload_catalog`. If it is not there, it does not exist.","Never edit anything under npayload/_generated/ or npayload/permissions.generated.ts \u2014 they are generated on push and committed; hand edits are overwritten and fail drift checks.","Never read, print, or edit .env or .npayload.json \u2014 credentials are already wired; tools and the CLI resolve them automatically.","Config references take the NATURAL identity, never an id: channel refs take the channel's SLUG (subscriptions[].channelGid, eventTypes[].channels, consumerGroups[].channelGid); a Primus trigger's agentGid and an agent's skills[] take the NAMES declared in the same config \u2014 all resolved to ids at push. Do not invent ids.","Event payload schemas (eventTypes[].schema) are append-only: changing one registers a NEW catalogue version on push; it never mutates the old version.","Primus naming rule: skill and tool names are lowercase + digits + underscores \u2014 a hyphenated name is rejected by the platform. Agent and trigger names may use hyphens.","Pipes lifecycle: a config-declared workflow is created as a DRAFT; activation is deliberate (dashboard, CLI, or pipes_create's activate flag for imperative builds). NEVER put a plaintext secret in pipes.config.ts \u2014 credentials carry a vault REFERENCE only.","`npayload push` / the *_deploy tools target the SANDBOX. Production is only `npayload deploy`, run deliberately by a human \u2014 never call it as an agent.","The .npayload/ directory (dot-prefixed) is local machine state written by `npayload pull`; its absence is normal. The committed workspace is npayload/ (no dot).","If a call fails, run npayload_status / `npayload doctor` first and act on its remediation \u2014 do not retry blindly or invent workarounds."],hT=[{path:"npayload/events.config.ts",what:"Events topology you author: channels, typed eventTypes, subscriptions. Committed."},{path:"npayload/pipes.config.ts",what:"Pipes topology you author: workflows + vault-referenced credentials. Committed."},{path:"npayload/primus.config.ts",what:"Primus (AI agents) topology you author: agents, skills, tools, triggers. Committed."},{path:"npayload/permissions.generated.ts",what:"Per-object permission model \u2014 the union across every product config present, generated on push. Committed, never hand-edited."},{path:"npayload/_generated/",what:"contract.lock + events.d.ts (typed payloads), generated on push. Committed, never hand-edited."},{path:"npayload/AGENTS.md",what:"This guide. Regenerated by `npx @npayload/sdk init`."},{path:".npayload/",what:"Local machine state (pull snapshots). Gitignored; absent until `npayload pull` runs."},{path:".env + .npayload.json",what:"Credentials. Gitignored; never read or edit them."},{path:".mcp.json",what:"Connects your editor's agent to the npayload MCP server."}];function yT(e){let t=["# npayload \u2014 guide for coding agents","",`<!-- Generated by \`npx @npayload/sdk init\` (@npayload/sdk@${e}). Re-run init to refresh. -->`,"","npayload is communication infrastructure for autonomous systems, and it is","configuration-driven: you author the product configs under `npayload/`","(`events.config.ts`, `pipes.config.ts`, `primus.config.ts`), validate them,","push them, and the platform reconciles everything else. There is nothing to","reverse-engineer \u2014 follow the loop below exactly. The npayload MCP server","(already wired via `.mcp.json`) serves the same loop as tools; start with","the `npayload_overview` tool when connected.","","## The workspace","","| Path | What it is |","|------|------------|",...hT.map(r=>`| \`${r.path}\` | ${r.what} |`),"","## The loop \u2014 do these steps in order",""];for(let r of fT){let o=[r.mcpTool?`MCP \`${r.mcpTool}\``:null,r.cli?`CLI \`${r.cli}\``:null].filter(Boolean).join(" \xB7 ");t.push(`${r.step}. ${r.do}${o?` (${o})`:""}`),t.push(` Expect: ${r.expect}`)}return t.push("","## Hard rules","",...gT.map(r=>`- ${r}`),"","## Where facts come from (never from memory)","","- Config schema + capabilities: the product's contract tool \u2014 `events_contract` / `pipes_contract` / `primus_contract` \u2014 or `npayload validate` offline.","- Full operation surface (every product, incl. AI `primus.*` ops): `npayload_catalog` tool (invoke via `npayload_invoke`).","- Runtime code recipes: `events_usage` tool; imperative workflow building: `pipes_catalog` \u2192 `pipes_build` \u2192 `pipes_create` \u2192 `pipes_run` \u2192 `pipes_get_execution`.","- Project/stack health: `npayload_status` tool, or `npayload doctor`.",""),t.join(`
|
|
347
|
+
`)}s(yT,"renderAgentsMd");function vT(){return{workflow:fT,rules:gT,workspace:hT}}s(vT,"overviewRails");oo();var bL=K(require("fs"));function Ht(e,t,r={}){let o=r.fs??bL;if(o.existsSync(e)){try{o.chmodSync(e,384)}catch{}r.append?o.appendFileSync(e,t,"utf8"):o.writeFileSync(e,t,"utf8");return}o.writeFileSync(e,t,{encoding:"utf8",mode:384})}s(Ht,"writeSecretFile");Un();function bT(e,t,r={}){let o=(0,pr.join)(e,"npayload"),n=[],i=[],a=[],c=[];t.dpop||(t.dpop=zs(e)??Gl());let l=[o,(0,pr.join)(o,"_generated")];for(let m of l)r.dryRun||(0,Ae.mkdirSync)(m,{recursive:!0}),c.push(m.replace(e+"/",""));let d=[["npayload.toml",iT(t,r.firstEnv??"sandbox")],["npayload/events.config.ts",rg(t)],["npayload/primus.config.ts",og(t)],["npayload/pipes.config.ts",ig(t)],["npayload/connect.config.ts",sg(t)],["npayload/_generated/contract.lock",Vs(t)],["npayload/AGENTS.md",yT(zn())],[".mcp.json",lg(t)]],u=new Set(["npayload/AGENTS.md"]);for(let[m,p]of d){let f=(0,pr.join)(e,m);if(n.push(m),(0,Ae.existsSync)(f)&&!r.force&&!u.has(m)){a.push(m);continue}r.dryRun||(0,Ae.writeFileSync)(f,p,"utf8"),i.push(m)}return n.push(".env",".npayload.json"),r.dryRun?n.push():(wL(e,t,r.force)?i.push(".env"):a.push(".env"),kL(e,t,r.force)?i.push(".npayload.json"):a.push(".npayload.json"),EL(e)&&i.push("package.json"),ug(e)),{files:n,written:i,skipped:a,directories:c}}s(bT,"scaffold");function wL(e,t,r){let o=(0,pr.join)(e,".env");if((0,Ae.existsSync)(o)){let n=(0,Ae.readFileSync)(o,"utf8");if(n.includes("NPAYLOAD_CLIENT_ID")&&!r||n.includes("NPAYLOAD_CLIENT_ID")&&r)return!1;let i=Vo(n),a=ql(t,{namesEdge:!!i.NPAYLOAD_EDGE_URL?.trim()});return Ht(o,`
|
|
348
|
+
`+a,{append:!0}),!0}return Ht(o,ql(t)),!0}s(wL,"writeEnvFile");function kL(e,t,r){let o=(0,pr.join)(e,".npayload.json");if((0,Ae.existsSync)(o)&&!r)return!1;let n={clientId:t.clientId,hmacSecret:t.hmacSecret,...t.targetEnv?{targetEnv:t.targetEnv}:{}};return t.dpop&&(n.dpopKid=t.dpop.kid,n.dpopPrivateJwk=t.dpop.privateJwk,n.dpopPublicJwk=t.dpop.publicJwk),Ht(o,JSON.stringify(n,null,2)+`
|
|
349
|
+
`),!0}s(kL,"writeProjectCredentials");function EL(e){let t=(0,pr.join)(e,"package.json");if(!(0,Ae.existsSync)(t))return!1;let r=jl();if(!r)return!1;let o=(0,Ae.readFileSync)(t,"utf8"),n;try{n=JSON.parse(o)}catch{return!1}let i=!1;for(let c of["dependencies","devDependencies"]){let l=n[c];if(!l||typeof l!="object")continue;let d=l;if(cg.some(u=>typeof d[u]=="string")){let u={};for(let[m,p]of Object.entries(d))cg.includes(m)&&typeof p=="string"?!(fn in u)&&!(fn in d)&&(u[fn]=r):u[m]=p;n[c]=d=u,i=!0}typeof d[fn]=="string"&&d[fn]!==r&&(d[fn]=r,i=!0)}if(!i)return!1;let a=/^(\s+)"/m.exec(o)?.[1]??" ";return(0,Ae.writeFileSync)(t,JSON.stringify(n,null,a)+(o.endsWith(`
|
|
350
|
+
`)?`
|
|
351
|
+
`:""),"utf8"),!0}s(EL,"healPackageJsonPin");function ug(e){let t=(0,pr.join)(e,".gitignore");if(!(0,Ae.existsSync)(t)){(0,Ae.writeFileSync)(t,Fl.join(`
|
|
352
|
+
`)+`
|
|
353
|
+
`,"utf8");return}let r=(0,Ae.readFileSync)(t,"utf8"),o=new Set,n=r.split(/\r?\n/).filter(a=>{let c=a.trim();if(dg.includes(c))return!1;if(c.startsWith("# npayload")){if(o.has(c))return!1;o.add(c)}return!0}).join(`
|
|
354
|
+
`);n!==r&&(r=n.endsWith(`
|
|
355
|
+
`)?n:n+`
|
|
356
|
+
`,(0,Ae.writeFileSync)(t,r,"utf8"));let i=[];for(let a of Fl)a&&!r.includes(a)&&i.push(a);if(i.length>0){let a=r.endsWith(`
|
|
357
|
+
`)?"":`
|
|
358
|
+
`;(0,Ae.appendFileSync)(t,a+`
|
|
359
|
+
# npayload
|
|
360
|
+
`+i.join(`
|
|
361
|
+
`)+`
|
|
362
|
+
`,"utf8")}}s(ug,"updateGitignore");zl();var it=require("fs");ri();Ke();Wt();function Kl(e,t,r){let o=Ie([["the edge this run names",t.edgeUrl]],e);if(o.production)return;let n=fg(e).NPAYLOAD_EDGE_URL,i=t.edgeUrl?.trim()?t.edgeUrl:n,a=i===void 0?void 0:Jr(o.estate,i);if(a!==void 0){let l=t.edgeUrl?.trim()?"":" (the production edge is the one this project's .env names)";throw new Z(`This run mixes two estates${l}: ${a}. ${r.edge}`)}let c=t.signIn===void 0?void 0:Jr(o.estate,t.signIn);if(c!==void 0)throw new Z(`This run's sign-in would mix two estates: ${c}. ${r.signIn}`)}s(Kl,"refuseMixedEstate");Wt();var hi=require("path"),Og=K(require("chalk"));var Rt=K(require("chalk")),MT=require("child_process");re();ro();_t();se();function LL(e,t){return e==="darwin"?["open",[t]]:e==="win32"?["rundll32",["url.dll,FileProtocolHandler",t]]:["xdg-open",[t]]}s(LL,"browserLauncher");function DL(e){try{let[t,r]=LL(process.platform,e),o=(0,MT.spawn)(t,r,{stdio:"ignore",detached:!0});o.on("error",()=>{}),o.unref()}catch{}}s(DL,"openBrowser");async function qT(e={}){Fs("Sign in");let t=await ht(e.authServerUrl);if(t)try{return await t.listOrgs(),console.log(Rt.default.green("\u2713")+" Already signed in"),t}catch(i){F(i),console.log(Rt.default.dim(" Your session expired. Signing in again."))}if(!ft()&&!process.env.NPAYLOAD_AUTH_URL)throw new G("Cannot sign in: this is a non-interactive terminal.",{code:"NO_TTY",hint:"For CI, provision an app in the dashboard and pass NPAYLOAD_CLIENT_ID + NPAYLOAD_HMAC_SECRET with --skip-auth.",docs:"https://docs.npayload.com/docs/start/initialize"});console.log(Rt.default.dim(" Sign in to npayload to continue."));let r=e.authServerUrl??"",o=null,n=0;try{let i=await Eg({authUrl:e.authServerUrl,onStart:s(a=>{r=a,console.log(" "+Rt.default.cyan("\u2192")+" requesting a device code from "+Rt.default.dim(a)+" \u2026")},"onStart"),onPrompt:s(a=>{let c=a.verificationUriComplete||a.verificationUri;console.log(),console.log(" "+Rt.default.cyan("\u2197")+" Opening your browser to approve this device\u2026"),console.log(" "+Rt.default.dim(c)),DL(c),console.log(" Verification code: "+Rt.default.bold(a.userCode)+Rt.default.dim(" (already filled in)")),console.log(Rt.default.dim(" Didn't open? Paste the URL above.")),n=Date.now(),o=no("Waiting for browser approval\u2026")},"onPrompt"),onPoll:s(()=>{if(!o)return;let a=Math.round((Date.now()-n)/1e3);o.text=`Waiting for browser approval\u2026 (${a}s)`},"onPoll")});return o?o.succeed("Signed in"):console.log(Rt.default.green("\u2713")+" Signed in"),i}catch(i){o&&o.fail("Sign in failed"),F(i);let a=i instanceof Error?i.message:"Please run the command again.";throw new G("Sign in failed.",{code:"AUTH_FAILED",hint:r&&!a.includes(r)?`${a} (endpoint: ${r})`:a,docs:"https://docs.npayload.com/docs/start/initialize",cause:i})}}s(qT,"authFlow");var yt=K(require("chalk"));Wt();function Zl(){let e=process.env.NPAYLOAD_PORTAL_URL?.trim();return e&&e.length>0?e.replace(/\/+$/,""):Ie().production?"https://admin.npayload.com":void 0}s(Zl,"portalHost");ro();Vr();var GL=["events","pipes","ai","primus","credentials","keys","feed"];function UL(e){return/^[a-z][a-z0-9_]{0,40}:[a-z][a-z0-9_]{0,40}$/.test(e)&&!e.includes("*")}s(UL,"isWellFormedScope");function FT(e=[]){let t=new Set;for(let r of[...ye.commands,...e]){let o=r.key.split(".")[0];if(GL.includes(o))for(let n of r.scopes??[])UL(n)&&t.add(n)}return[...t].sort()}s(FT,"projectedCeiling");re();se();async function ta(e,t,r){let o=no(e);try{let n=await t();return o.succeed(r?r(n):e),n}catch(n){throw o.fail(`${e} \u2014 failed`),n}}s(ta,"withSpin");var jL=[{name:"No tenants \u2014 my own services publish and consume",value:"none",description:"Every event belongs to your org directly. No customers-of-customers."},{name:"Tenanted \u2014 my customers' tenants are first-class",value:"tenanted",description:"Every event row carries a tenantId (org > app > env > tenant). Pick this when you serve your customers' customers."}],ML=[{name:"Internal \u2014 events within your org",value:"internal",description:"Private event bus for your own services. The ESB replacement."},{name:"Connect \u2014 share events with other orgs",value:"connect",description:"Cross-org event sharing. Discoverable in Explore. You'll pick a subtype next (platform / device / mobile) \u2014 at parity with the dashboard."},{name:"Feed \u2014 sell event data",value:"feed",description:"Commercial data distribution with Stripe billing."}],qL=[{name:"None \u2014 standard connect app",value:"none",description:"Cross-org sharing without platform/device/mobile specialization."},{name:"Platform \u2014 multi-tenant platform (Shopify, HubSpot, \u2026)",value:"platform",description:"Per-tenant events, tenant approvals, Entity NAT, identity bridges. Needs a platform slug."},{name:"Device \u2014 a device-class connect app",value:"device",description:"For a physical / edge device integration."},{name:"Mobile \u2014 a mobile-class connect app",value:"mobile",description:"For a mobile app integration."}];function FL(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}s(FL,"slugify");async function YT(e,t={}){let r=await zL(e,t.org),o=await BL(e,r,t.app),{loadExtraCommandRows:n}=await Promise.resolve().then(()=>(td(),ZT)),i=FT(await n()),a=await ta("Provisioning credentials\u2026",()=>e.provisionOac(r,o.appId,t.rotate,i));if(a.alreadyProvisioned&&!a.hmacSecret&&t.needSecret&&!t.rotate)throw new G(`This app already has CLI credentials (${a.clientId}) and this project holds none saved; the existing secret was left untouched.`,{code:"CREDENTIALS_EXIST",hint:"Copy the team's .env and .npayload.json into this project, or pass --rotate to issue a fresh secret (the previous one stops working immediately)."});return a.alreadyProvisioned&&!a.hmacSecret?(console.log(yt.default.green("\u2713")+` Using existing credentials (${yt.default.dim(a.clientId)}). Your previous secret is kept.`),console.log(yt.default.dim(" Lost the secret? Re-run with --rotate to issue a new one (this invalidates the old)."))):a.hmacSecret&&console.log(yt.default.green("\u2713")+` Credentials ${t.rotate?"rotated":"provisioned"} (${yt.default.dim(a.clientId)})`),{orgId:r,...o,clientId:a.clientId,hmacSecret:a.hmacSecret}}s(YT,"selectTarget");async function zL(e,t){Fs("Organization");let r=await ta("Loading your organizations\u2026",()=>e.listOrgs(),o=>o.length===1?o[0].name:`${o.length} organizations`);if(t!==void 0&&t.trim()!==""){let o=t.trim().toLowerCase(),n=r.find(i=>i.orgId.toLowerCase()===o||i.slug.toLowerCase()===o||i.name.toLowerCase()===o);if(!n){let i=r.length>0?r.map(a=>a.slug).join(", "):"(none \u2014 the session can access no organizations)";throw new Error(`No organization matching "${t}" is accessible to this session. Available: ${i}.`)}return console.log(yt.default.green("\u2713")+` ${n.name} (${n.slug})`),n.orgId}for(;r.length===0;){console.log(yt.default.yellow(" You're not in any organization yet."));let o=Zl();console.log(o!==void 0?" Create one at "+yt.default.cyan(`${o}/organization-list`)+", then press Enter.":" Create one in your npayload dashboard, then press Enter."),await qs(" Press Enter when your organization is ready",{default:""}),r=await ta("Checking for your organization\u2026",()=>e.listOrgs(),n=>`${n.length} found`)}if(r.length===1)return r[0].orgId;if(!ft())throw new Error(`This session can access ${r.length} organizations; a non-interactive login must choose one. Pass --org <slug|gid> (or set NPAYLOAD_ORG). Available: ${r.map(o=>o.slug).join(", ")}.`);return Qt("Select an organization",r.map(o=>({name:`${o.name} (${o.slug})`,value:o.orgId})))}s(zL,"selectOrg");async function BL(e,t,r){Fs("App");let o=await ta("Loading your apps\u2026",()=>e.listApps(t),a=>a.length?`${a.length} app${a.length===1?"":"s"}`:"no apps yet"),n="__create__";if(r!==void 0&&r.trim()!==""){let a=r.trim().toLowerCase(),c=o.find(l=>l.gid.toLowerCase()===a||l.slug.toLowerCase()===a||l.name.toLowerCase()===a);if(!c){let l=o.length>0?o.map(d=>d.slug).join(", "):"(none \u2014 create one in the dashboard or run `np login` interactively)";throw new Error(`No app matching "${r}" exists in this organization. Available: ${l}.`)}return console.log(yt.default.green("\u2713")+` ${c.name} (${c.slug})`),{appId:c.gid,appName:c.name,appSlug:c.slug,appType:c.appType,subtype:c.subtype,platformSlug:c.platformSlug}}if(!ft()){let a=o.length>0?`Pass --app <slug|gid> (or set NPAYLOAD_APP). Available: ${o.map(c=>c.slug).join(", ")}.`:"This organization has no apps yet; create one in the dashboard, then pass --app <slug|gid>.";throw new Error(`A non-interactive login must choose an existing app. ${a}`)}let i=n;if(o.length>0&&(i=await Qt("Select an app or create a new one",[...o.map(a=>({name:`${a.name} (${a.slug}) \u2014 ${a.appType}`,value:a.gid})),{name:yt.default.green("\uFF0B")+" Create a new app",value:n}])),i!==n){let a=o.find(c=>c.gid===i);return console.log(yt.default.green("\u2713")+` ${a.name}`),{appId:a.gid,appName:a.name,appSlug:a.slug,appType:a.appType,subtype:a.subtype,platformSlug:a.platformSlug}}return KL(e,t)}s(BL,"selectOrCreateApp");async function KL(e,t){let o=await qs("App name:",{validate:s(l=>l.trim().length>0?!0:"App name is required","validate")}),n=await Qt("What kind of app?",ML),i=n==="feed"?void 0:await Qt("Who does this app serve?",jL),a,c;if(n==="connect"){let l=await Qt("What kind of connect app?",qL);l!=="none"&&(a=l),a==="platform"&&(c=(await qs("Platform slug (e.g. shopify, hubspot):",{validate:s(d=>/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(d.trim())?!0:"Platform slug must be lowercase alphanumeric with hyphens","validate")})).trim())}for(let l=0;l<5;l++){let d=await qs("Slug:",{default:l===0?FL(o):"",validate:s(u=>u.trim()?/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(u.trim())?!0:"Slug must be lowercase alphanumeric with hyphens, no leading/trailing hyphens":"Slug is required","validate")});try{let u=await ta(`Creating app ${o.trim()}\u2026`,()=>e.createApp(t,{name:o.trim(),slug:d.trim(),appType:n,...i!==void 0?{tenancyMode:i}:{},subtype:a,platformSlug:c}),()=>`App created: ${o.trim()}`);return{appId:u.gid,appName:o.trim(),appSlug:u.slug,appType:n,subtype:a,platformSlug:c}}catch(u){F(u);let m=u instanceof Error?u.message:"";if(m.toLowerCase().includes("slug")||m.toLowerCase().includes("taken")){console.log(yt.default.red(` ${m} Choose another.`));continue}throw u}}throw new Error("Could not create the app after several attempts.")}s(KL,"createApp");Ws();var gi=require("fs"),rx=require("path");Zt();function rd(e){let t=!1;for(let r=0;r<e.length;r++){let o=e[r];if(t){if(o==="\\"&&t==='"'){r++;continue}o===t&&(t=!1);continue}if(o==='"'||o==="'")t=o;else if(o==="#")return e.slice(0,r).trim()}return e.trim()}s(rd,"codePart");function nD(e){return e.startsWith("[")}s(nD,"isHeaderLine");function oa(e,t){for(let r=0;r<e.length;r++)if(rd(e[r])===t)return r;return-1}s(oa,"findHeader");function ox(e,t){for(let r=t+1;r<e.length;r++)if(nD(rd(e[r])))return r;return e.length}s(ox,"sectionEnd");function nx(e,t,r,o){let n=ox(e,t),i=`${r} = "${o}"`;for(let a=t+1;a<n;a++){let c=rd(e[a]);if(c.startsWith(`${r} =`)||c.startsWith(`${r}=`)){if(c===i)return;e[a]=i;return}}e.splice(t+1,0,i)}s(nx,"setKeyInSection");function rD(e,t){let r=e.includes(`\r
|
|
363
|
+
`)?`\r
|
|
364
|
+
`:`
|
|
365
|
+
`,o=e.split(/\r?\n/),n=oa(o,"[app]");if(n===-1){let i=0;for(;i<o.length;){if(rd(o[i])===""||o[i].trim().startsWith("#")){i++;continue}break}o.splice(i,0,"[app]",`slug = "${t.slug}"`,""),n=i}else nx(o,n,"slug",t.slug);return t.name&&t.name!==t.slug&&nx(o,n,"name",t.name),o.join(r)}s(rD,"setAppIdentity");function oD(e,t){let r=e.includes(`\r
|
|
366
|
+
`)?`\r
|
|
367
|
+
`:`
|
|
368
|
+
`,o=e.split(/\r?\n/);for(let n of t){if(oa(o,`[env.${n.slug}]`)!==-1)continue;let i=[`[env.${n.slug}]`,`kind = "${n.kind}"`,...n.name&&n.name!==n.slug?[`name = "${n.name}"`]:[],""],a=oa(o,"[access_scopes]");if(a!==-1){let c=a;for(;c>0;){let l=o[c-1].trim();if(l===""||l.startsWith("#"))c--;else break}o.splice(c,0,...i)}else o.length>0&&o[o.length-1].trim()!==""&&o.push(""),o=[...o,...i]}return o.join(r)}s(oD,"ensureEnvSections");var Ag={changed:!1,addedEnvSections:[],appUpdated:!1};function od(e,t){let r=(0,rx.join)(e,xg);if(!(0,gi.existsSync)(r))return Ag;let o=(0,gi.readFileSync)(r,"utf8"),n=o;t.app&&(n=rD(n,t.app));let i=[];if(t.envs&&t.envs.length>0){for(let c of t.envs)oa(n.split(/\r?\n/),`[env.${c.slug}]`)!==-1||i.push(c.slug);n=oD(n,t.envs)}if(n===o)return Ag;try{Rg(n)}catch{return Ag}let a=s(c=>{let l=c.split(/\r?\n/),d=oa(l,"[app]");return d===-1?"":l.slice(d,ox(l,d)).join(`
|
|
369
|
+
`)},"appSection");return(0,gi.writeFileSync)(r,n,"utf8"),{changed:!0,addedEnvSections:i,appUpdated:t.app!==void 0&&a(o)!==a(n)}}s(od,"reconcileManifestFile");function ix(e,t,r){try{od(e,{app:{slug:t,name:r}}).appUpdated&&console.log(Og.default.green("\u2713")+` npayload.toml updated (app ${Og.default.bold(t)})`)}catch{}}s(ix,"reconcileManifestIdentity");async function id(e,t={}){let{base:r}=Bl(t.authUrl);Kl(e,{edgeUrl:t.edgeUrl,signIn:`${r}/oauth/cli/code`},{edge:"Name the edge of that estate with NPAYLOAD_EDGE_URL, or name nothing outside npayload's production hosts to use its production estate.",signIn:"Name that estate's auth host with NPAYLOAD_AUTH_URL or its API with NPAYLOAD_API_URL (export what the project's .env names), so the sign-in goes there, or name nothing outside npayload's production hosts."});let o=iD(e),n=await qT({authServerUrl:r,debug:t.debug}),i=await YT(n,{rotate:t.rotate,needSecret:!o,...t.org?{org:t.org}:{},...t.app?{app:t.app}:{}}),a=i.hmacSecret;if(o&&(a===void 0||a===""))return t.env&&sx(e,t.env),ix(e,i.appSlug,i.appName),{appName:i.appName,appSlug:i.appSlug,appId:i.appId,appType:i.appType,subtype:i.subtype,platformSlug:i.platformSlug,clientId:i.clientId,dpopKid:zs(e)?.kid??"",filled:!1};let c=zs(e)??Gl();return ug(e),aD(e,{clientId:i.clientId,hmacSecret:a??"",appId:i.appId,apiUrl:t.apiUrl,edgeUrl:t.edgeUrl,dpop:c}),cD(e,{clientId:i.clientId,hmacSecret:a??"",appId:i.appId,appSlug:i.appSlug,dpop:c}),t.env&&sx(e,t.env),ix(e,i.appSlug,i.appName),{appName:i.appName,appSlug:i.appSlug,appId:i.appId,appType:i.appType,subtype:i.subtype,platformSlug:i.platformSlug,clientId:i.clientId,dpopKid:c.kid,filled:!0}}s(id,"connectProject");function sd(e){return[`App: ${e.appName} (${e.appSlug})`,`Client: ${e.clientId}`,`DPoP key: ${e.dpopKid||"(none registered)"}`,e.filled?"Real credentials written to .env + .npayload.json.":"Credentials already present \u2014 reconciled to the same state."]}s(sd,"connectedSummaryLines");function sx(e,t){let r=t.trim();if(!r)return;let o=(0,hi.join)(e,".npayload.json"),n={};if((0,it.existsSync)(o))try{n=JSON.parse((0,it.readFileSync)(o,"utf8"))}catch{n={}}n.targetEnv!==r&&(0,it.writeFileSync)(o,JSON.stringify({...n,targetEnv:r},null,2)+`
|
|
370
|
+
`,{encoding:"utf8",mode:384})}s(sx,"persistTargetEnv");function iD(e){let t=(0,hi.join)(e,".npayload.json");if((0,it.existsSync)(t))try{let o=JSON.parse((0,it.readFileSync)(t,"utf8"));if(!gn(o.clientId)&&!gn(o.hmacSecret))return!0}catch{}let r=(0,hi.join)(e,".env");if((0,it.existsSync)(r)){let o=sD((0,it.readFileSync)(r,"utf8"));if(!gn(o.NPAYLOAD_CLIENT_ID)&&!gn(o.NPAYLOAD_HMAC_SECRET))return!0}return!1}s(iD,"projectHasRealCredentials");function sD(e){let t={};for(let r of e.split(`
|
|
371
|
+
`)){let o=r.trim();if(!o||o.startsWith("#"))continue;let n=o.indexOf("=");n<=0||(t[o.slice(0,n).trim()]=o.slice(n+1))}return t}s(sD,"readEnvVars");function aD(e,t){let r=(0,hi.join)(e,".env"),o=(0,it.existsSync)(r)?(0,it.readFileSync)(r,"utf8"):void 0,n={NPAYLOAD_CLIENT_ID:t.clientId,NPAYLOAD_HMAC_SECRET:t.hmacSecret,NPAYLOAD_APP_ID:t.appId,NPAYLOAD_DPOP_KID:t.dpop.kid,NPAYLOAD_DPOP_PRIVATE_JWK:JSON.stringify(t.dpop.privateJwk)};if(t.apiUrl&&(n.NPAYLOAD_API_URL=t.apiUrl),t.edgeUrl&&(n.NPAYLOAD_EDGE_URL=t.edgeUrl),o===void 0){let u=Object.entries(n).map(([m,p])=>`${m}=${p}`).join(`
|
|
372
|
+
`);Ht(r,u+`
|
|
373
|
+
`);return}let i=o.split(`
|
|
374
|
+
`),a=new Set,c=i.map(u=>{let m=u.indexOf("=");if(m<=0||u.trim().startsWith("#"))return u;let p=u.slice(0,m).trim();return p in n?(a.add(p),`${p}=${n[p]}`):u}),l=Object.entries(n).filter(([u])=>!a.has(u)),d=c.join(`
|
|
375
|
+
`);l.length>0&&(d.endsWith(`
|
|
376
|
+
`)||(d+=`
|
|
377
|
+
`),d+=l.map(([u,m])=>`${u}=${m}`).join(`
|
|
378
|
+
`)+`
|
|
379
|
+
`),Ht(r,d)}s(aD,"fillEnv");function cD(e,t){let r=(0,hi.join)(e,".npayload.json"),o={};if((0,it.existsSync)(r))try{o=JSON.parse((0,it.readFileSync)(r,"utf8"))}catch{o={}}let n={...o,clientId:t.clientId,hmacSecret:t.hmacSecret,...t.appId?{appId:t.appId}:{},...t.appSlug?{appSlug:t.appSlug}:{},dpopKid:t.dpop.kid,dpopPrivateJwk:t.dpop.privateJwk,dpopPublicJwk:t.dpop.publicJwk};Ht(r,JSON.stringify(n,null,2)+`
|
|
380
|
+
`)}s(cD,"fillProjectCredentials");var st=require("fs"),Ot=require("path");function ax(e=process.cwd()){let t=(0,Ot.join)(e,"package.json");if(!(0,st.existsSync)(t))return"node";let r={};try{let o=JSON.parse((0,st.readFileSync)(t,"utf8"));r={...o.dependencies,...o.devDependencies}}catch{return"node"}return r.next?"nextjs":r["@remix-run/react"]||r["@remix-run/node"]||r["@remix-run/server-runtime"]?"remix":r.hono?"hono":r.express?"express":r.react?"react":"node"}s(ax,"detectFramework");function cx(e=process.cwd()){let t=process.env.npm_config_user_agent??"";return t.startsWith("bun")?"bun":t.startsWith("pnpm")?"pnpm":t.startsWith("yarn")?"yarn":(0,st.existsSync)((0,Ot.join)(e,"bun.lock"))||(0,st.existsSync)((0,Ot.join)(e,"bun.lockb"))?"bun":(0,st.existsSync)((0,Ot.join)(e,"pnpm-lock.yaml"))?"pnpm":(0,st.existsSync)((0,Ot.join)(e,"yarn.lock"))?"yarn":"npm"}s(cx,"detectPackageManager");function lx(e=process.cwd()){return(0,st.existsSync)((0,Ot.join)(e,"package.json"))}s(lx,"hasPackageJson");function ad(e=process.cwd()){return{hasNpayloadDir:(0,st.existsSync)((0,Ot.join)(e,"npayload")),hasConfig:(0,st.existsSync)((0,Ot.join)(e,"npayload.config.ts"))||(0,st.existsSync)((0,Ot.join)(e,"npayload.config.js")),hasProjectCreds:(0,st.existsSync)((0,Ot.join)(e,".npayload.json")),hasEnv:(0,st.existsSync)((0,Ot.join)(e,".env"))}}s(ad,"detectExistingSetup");function dx(e,t){switch(e){case"bun":return`bun add ${t}`;case"pnpm":return`pnpm add ${t}`;case"yarn":return`yarn add ${t}`;default:return`npm install ${t} --no-audit --no-fund --loglevel=error`}}s(dx,"getInstallCommand");gt();var ux=require("child_process"),cd=require("fs"),px=require("path");var lD={"npayload:listen":"npayload listen","npayload:promote":"npayload promote create"};async function mx(e,t,r,o,n){let i=dx(e,t.join(" ")),a={...process.env};if(o)for(let c of Object.keys(a))/^npm_config_.*registry$/i.test(c)&&delete a[c];await new Promise((c,l)=>{let d=(0,ux.spawn)(i,{cwd:r,env:a,shell:!0,stdio:["ignore","pipe","pipe"]}),u=s(m=>{if(n)for(let p of m.toString().split(/\r?\n/)){let f=p.trim();f&&n(f)}},"feed");d.stdout?.on("data",u),d.stderr?.on("data",u),d.on("error",l),d.on("close",m=>m===0?c():l(new Error(`${e} install exited with code ${m}`)))})}s(mx,"installDependencies");function fx(e){let t=(0,px.join)(e,"package.json"),r=(0,cd.readFileSync)(t,"utf8"),o=JSON.parse(r),n=o.scripts??{},i=[];for(let[c,l]of Object.entries(lD))c in n||(n[c]=l,i.push(c));o.scripts=n,o.type===void 0&&(o.type="module",i.push('type: "module"'));let a=r.startsWith(`{
|
|
381
|
+
`)?2:r.startsWith(`{
|
|
382
|
+
`)?" ":2;return(0,cd.writeFileSync)(t,JSON.stringify(o,null,a)+`
|
|
383
|
+
`,"utf8"),i}s(fx,"addScripts");oo();re();Ws();function dD(e){try{let t=(0,$g.join)(e,"node_modules");if(!(0,ia.existsSync)(t))return 0;let r=0;for(let o of(0,ia.readdirSync)(t))if(!o.startsWith("."))if(o.startsWith("@"))try{r+=(0,ia.readdirSync)((0,$g.join)(t,o)).filter(n=>!n.startsWith(".")).length}catch{}else r++;return r}catch{return 0}}s(dD,"countInstalledPackages");async function gx(e){let t=process.cwd();if(console.log(kT()),!lx(t))throw new G("No package.json found in this directory.",{code:"NO_PACKAGE_JSON",hint:"Run `npm init -y` first, then re-run `npx @npayload/sdk init` from your project root.",docs:"https://docs.npayload.com/docs/start/initialize"});e.http||Kl(t,{edgeUrl:e.edgeUrl},{edge:"Name the edge of that estate with --edge-url or NPAYLOAD_EDGE_URL, or name nothing outside npayload's production hosts to use its production estate.",signIn:""});let r=ad(t);(r.hasNpayloadDir||r.hasConfig)&&!e.dryRun&&(e.force?console.log(B.default.yellow(" npayload already set up \u2014 overwriting existing files (--force).")):(console.log(B.default.dim(" npayload already set up \u2014 adding missing files, existing files are preserved.")),console.log(B.default.dim(" Re-run with --force to overwrite, or --dry-run to preview."))));let o=ax(t),n=xT(),i=void 0,a={appName:process.env.NPAYLOAD_APP_NAME??"my-app",appSlug:process.env.NPAYLOAD_APP_SLUG??"my-app",appId:mT,appType:process.env.NPAYLOAD_APP_TYPE??"internal",subtype:process.env.NPAYLOAD_APP_SUBTYPE,platformSlug:process.env.NPAYLOAD_PLATFORM_SLUG,framework:o,clientId:uT,hmacSecret:pT,apiUrl:e.apiUrl,targetEnv:n,transport:e.http?"http":"npp",edgeUrl:e.edgeUrl},c=(process.env.NPAYLOAD_FIRST_ENV??"").trim()||"sandbox",l=no(e.dryRun?"Previewing scaffold (dry run)...":"Scaffolding npayload/..."),d=bT(t,a,{force:e.force,dryRun:e.dryRun,firstEnv:c});l.succeed(e.dryRun?`Dry run: ${d.written.length} to write, ${d.skipped.length} preserved`:`Scaffolded ${d.written.length} files`+(d.skipped.length?`, ${d.skipped.length} preserved`:"")),console.log();for(let v of d.written)console.log(B.default.dim(` ${B.default.green("+")} ${v}`));for(let v of d.skipped)console.log(B.default.dim(` ${B.default.yellow("=")} ${v} ${B.default.dim("(exists, preserved)")}`));if(e.dryRun){console.log(),console.log(B.default.bold(" Dry run complete \u2014 no files were written.")),console.log(B.default.dim(" Re-run without --dry-run to apply, or with --force to overwrite existing files."));return}let u=a.appName,m=a.appSlug,p=a.appType,f=!1,g=[];if(e.skipAuth)console.log(),console.log(B.default.dim(" Auth skipped (--skip-auth). Credentials left as placeholders.")),console.log(B.default.dim(" Run `npayload login` to connect this project."));else{console.log();try{let v=await id(t,{authUrl:e.authUrl,apiUrl:e.apiUrl,edgeUrl:e.edgeUrl,rotate:e.rotate,debug:e.debug});u=v.appName,m=v.appSlug,p=v.appType,f=!0,g=sd(v)}catch(v){let S=v instanceof Error?v.message:String(v);console.log(B.default.yellow(" Could not connect this project right now.")),console.log(B.default.dim(` ${ie(S,v)}`)),console.log(),console.log(" "+B.default.bold("Run `npayload login` to connect this project.")+B.default.dim(" (your files are already scaffolded)"))}}if(e.skipInstall)console.log(B.default.dim(`
|
|
384
|
+
Install skipped (--skip-install)`));else{console.log();let v=e.packageManager??cx(t),S=void 0,k=S?.pkgs??[Ml()];k.push("dotenv");let R=S?.label??"npayload",I=no(`Installing ${R} (${v})\u2026`),x=Date.now(),_="",U=setInterval(()=>{let A=Math.round((Date.now()-x)/1e3);I.text=`Installing ${R} (${v})\u2026 ${A}s`+(_?` \u2014 ${_}`:"")},500);try{await mx(v,k,t,i,D=>{/added|packages|resolv|reify|fetch|download|link|progress/i.test(D)&&(_=D.length>48?D.slice(0,47)+"\u2026":D)}),clearInterval(U);let A=dD(t);I.succeed(A>0?`${R} + dotenv installed (${A} packages)`:`${R} + dotenv installed`)}catch{clearInterval(U),I.warn(`Failed to install packages. Run manually: ${v} install ${k.join(" ")}`)}try{let A=fx(t);A.length>0&&console.log(B.default.dim(` Added scripts: ${A.join(", ")}`))}catch{console.log(B.default.dim(" Could not update package.json scripts."))}}let h={internal:"Internal",connect:"Connect",platform:"Platform",feed:"Feed"},y={nextjs:"Next.js",remix:"Remix",express:"Express",hono:"Hono",react:"React",node:"Node.js"};if(f){let v=s(k=>` ${B.default.dim("\u2500\u2500")} ${B.default.bold(k)} ${B.default.dim("\u2500".repeat(Math.max(2,56-k.length)))}`,"rule"),S=s((k,R)=>` ${B.default.green(k.padEnd(24))}${B.default.dim(R)}`,"cmd");console.log(["",` ${mg()} ${ci("Connected.")}`,"",` ${B.default.dim("app")} ${B.default.cyan(u)} ${B.default.dim(`(${m}) \xB7 ${h[p]} \xB7 ${y[o]}`)}`,` ${B.default.dim("credential")} ${B.default.dim("machine identity with generated per-object permissions \u2014 no keys to manage")}`,...g.map(k=>` ${B.default.dim(k)}`),` ${B.default.dim("workspace")} ${B.default.cyan("npayload/")} ${B.default.dim("config + generated types (commit it) \xB7 secrets stay in .env")}`,"",v("The loop"),"",S("npayload validate","check your config against the contract (offline)"),S("npayload diff","see exactly what would change \u2014 nothing applied"),S("npayload push","apply to your sandbox + regenerate typed payloads"),S("npayload tail <channel>","watch events arrive, live, in this terminal"),S("npayload doctor","one-line diagnosis when anything feels off"),S("npayload deploy","the one deliberate path to production"),"",v("Hand it to your AI agent"),"",` ${B.default.dim("Your editor's agent is already wired to npayload (.mcp.json). Paste this:")}`,"",` ${B.default.cyan('"Set up npayload Events for this app end to end: study my data model,')}`,` ${B.default.cyan(" design the channels and typed event schemas in npayload/events.config.ts,")}`,` ${B.default.cyan(" validate, push, wire my code to publish, then prove it \u2014 publish a")}`,` ${B.default.cyan(' test event and tail the channel."')}`,"",` ${B.default.dim("Publish from code:")} ${B.default.white('np.events.publish("<channel>", payload)')} ${B.default.dim("\u2014 typed after your first push")}`,""].join(`
|
|
385
|
+
`))}else Nl([B.default.bold("npayload scaffolded."),"",`Framework: ${B.default.cyan(y[o])}`,"Dir: npayload/",`Target: ${n}`,"",B.default.yellow("Not connected yet \u2014 credentials are placeholders."),"",B.default.bold("Connect, then let your agent build it:"),"",` ${B.default.green("npayload login")} sign in + provision + fill credentials`,"",B.default.dim(' Then ask your coding agent: "set up npayload Events for this app" \u2014 it uses the'),B.default.dim(" npayload MCP (start with the npayload_overview tool).")])}s(gx,"runInit");re();gt();function uD(e){if(e.transport&&e.transport!=="http"&&e.transport!=="npp")throw new G(`Unknown transport "${e.transport}". Use npp (default) or http.`,{code:"INVALID_TRANSPORT",hint:"Run `npx @npayload/sdk init` for the default NPP wire, or `--transport http` for HTTP/JSON."});return e.http===!0||e.transport==="http"?"http":"npp"}s(uD,"resolveInitTransport");function hx(e){e.command("init").description("set up npayload in your project (device-flow auth + scaffold)").option("--skip-install","skip dependency installation").option("--skip-auth","skip authentication (use existing credentials)").option("--package-manager <pm>","force package manager: npm | pnpm | yarn | bun").option("--force","overwrite existing scaffold files (default: preserve them)").option("--rotate","issue a fresh app secret on re-run (invalidates the previous one)").option("--dry-run","preview what init would do without writing any files").option("--http","scaffold the HTTP/JSON transport instead of the NPP default").option("--transport <npp|http>","wire transport to scaffold (default: npp) \u2014 `--transport http` is the long form of `--http`").option("--edge-url <url>","override the edge the secure (NPP) transport connects to (default for the production API: https://npp.npayload.com), written into .env as NPAYLOAD_EDGE_URL").action(async r=>{try{let o=uD({http:r.http,transport:r.transport})==="http";await gx({skipInstall:r.skipInstall??!1,skipAuth:r.skipAuth??!1,packageManager:r.packageManager,force:r.force??!1,rotate:r.rotate??!1,dryRun:r.dryRun??!1,apiUrl:te(process.env.NPAYLOAD_API_URL,"apiUrl"),authUrl:te(process.env.NPAYLOAD_AUTH_URL,"authUrl"),debug:process.env.NPAYLOAD_DEBUG==="1",http:o,edgeUrl:te(r.edgeUrl??process.env.NPAYLOAD_EDGE_URL,"edgeUrl")})}catch(o){we(o)}})}s(hx,"registerInit");var yx={org:"NPAYLOAD_ORG",app:"NPAYLOAD_APP",env:"NPAYLOAD_TARGET_ENV"};function vx(e,t=process.env){let r={};for(let o of Object.keys(yx)){let i=e[o]?.trim()||t[yx[o]]?.trim();i&&(r[o]=i)}return r}s(vx,"resolveLoginTargets");var fo=K(require("chalk"));re();gt();qe();function g_(e){let t=s(async(o,n)=>{try{let i=process.cwd(),a=ad(i);if(!a.hasNpayloadDir&&!a.hasConfig&&!a.hasEnv)throw new G("No npayload project found in this directory.",{code:"NO_SCAFFOLD",hint:"Run `npx @npayload/sdk init` first to scaffold the project, then `npayload login` to connect it.",docs:"https://docs.npayload.com/docs/start/initialize"});console.log(),console.log(fo.default.bold(" npayload login")+fo.default.dim(" \u2014 connect this project."));let{org:c,app:l,env:d}=vx({org:o.org,app:o.app,env:Lt({env:o.env},n)}),u=await id(i,{authUrl:te(process.env.NPAYLOAD_AUTH_URL,"authUrl"),apiUrl:te(process.env.NPAYLOAD_API_URL,"apiUrl"),edgeUrl:te(process.env.NPAYLOAD_EDGE_URL,"edgeUrl"),rotate:o.rotate??!1,debug:process.env.NPAYLOAD_DEBUG==="1",...c?{org:c}:{},...l?{app:l}:{},...d?{env:d}:{}}),m=Zl();Nl([fo.default.bold(u.filled?"Connected!":"Already connected."),"",...sd(u).map(p=>fo.default.dim(p)),...m!==void 0?[`Dashboard: ${fo.default.cyan(`${m}/apps/${u.appSlug}/sandbox`)}`]:[],"",` ${fo.default.green("npx tsx npayload/events/publish.ts")} publish your first signal`])}catch(i){we(i)}},"handler"),r=s(o=>o.description("connect an already-scaffolded project (device-flow auth + provision + fill credentials)").option("--rotate","issue a fresh app secret (invalidates the previous one)").option("--org <slug|gid>","select this organization without prompting (env: NPAYLOAD_ORG)").option("--app <slug|gid>","select this existing app without prompting (env: NPAYLOAD_APP)").option("--env <slug>","record this logical environment as the project target (env: NPAYLOAD_TARGET_ENV)").action(t),"defineLogin");r(e.command("login")),r(mh(e).command("login"))}s(g_,"registerLogin");function mh(e){return e.commands.find(t=>t.name()==="auth")??e.command("auth").description("The credential the CLI signs in with (login, status)")}s(mh,"authGroup");var y_=require("child_process");var go={stderr:s(e=>{process.stderr.write(e)},"stderr"),forward:s(e=>new Promise(t=>{let r=(0,y_.spawn)(process.argv[0]??"node",[process.argv[1]??"",...e],{stdio:"inherit",env:process.env});r.on("close",o=>t(o??0)),r.on("error",o=>{process.stderr.write(`Forward failed: ${o.message}
|
|
386
|
+
`),t(1)})}),"forward"),exit:s(e=>{process.exitCode=e},"exit")},YD=new Set(["grants","consents"]),h_="Migration: use `np connect grants` for every grant and consent command.";function XD(e){let t=[...e],r=[];t.length>0&&YD.has(t[0])&&r.push(t.shift());let o=t[0];return o===void 0||o.startsWith("-")?{unknown:`[deprecated] 'np federation${r.length?` ${r.join(" ")}`:""}' names no verb; the surface moved to 'np connect grants' \u2014 run 'np connect grants --help' for the supported verbs.
|
|
387
|
+
`}:(r.push(o),{v2Args:["connect","grants",o,...t.slice(1)],invoked:`np federation ${r.join(" ")}`,target:`np connect grants ${o}`})}s(XD,"federationForward");function e0(){let e=(process.env.NPAYLOAD_FEDERATION_HARD_FAIL??"").trim().toLowerCase();return e==="1"||e==="true"||e==="yes"}s(e0,"isHardFailMode");function v_(e){e.command("federation",{hidden:!0}).description("DEPRECATED \u2014 use 'np connect grants' (V1 federation retired)").argument("[tokens...]","the V1 verb and its arguments").allowUnknownOption(!0).allowExcessArguments(!0).action(async(t,r,o)=>{let n=XD(o.args);if("unknown"in n){go.stderr(n.unknown),go.exit(2);return}if(e0()){go.stderr(`[deprecated] '${n.invoked}' has been retired: run '${n.target}' instead. ${h_}
|
|
388
|
+
`),go.exit(2);return}go.stderr(`[deprecated] '${n.invoked}' is deprecated. Forwarding to '${n.target}'.
|
|
389
|
+
After 6 months post-GA this command exits non-zero; set NPAYLOAD_FEDERATION_HARD_FAIL=1 to opt in early. ${h_}
|
|
390
|
+
`),go.exit(await go.forward(n.v2Args))})}s(v_,"registerFederation");re();yh();var dt="1.36.1";var wn=[],Dt=[],o0=Uint8Array,vh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ho=0,b_=vh.length;ho<b_;++ho)wn[ho]=vh[ho],Dt[vh.charCodeAt(ho)]=ho;var ho,b_;Dt[45]=62;Dt[95]=63;function i0(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var o=r===t?0:4-r%4;return[r,o]}s(i0,"getLens");function s0(e,t,r){return(t+r)*3/4-r}s(s0,"_byteLength");function Ea(e){var t,r=i0(e),o=r[0],n=r[1],i=new o0(s0(e,o,n)),a=0,c=n>0?o-4:o,l;for(l=0;l<c;l+=4)t=Dt[e.charCodeAt(l)]<<18|Dt[e.charCodeAt(l+1)]<<12|Dt[e.charCodeAt(l+2)]<<6|Dt[e.charCodeAt(l+3)],i[a++]=t>>16&255,i[a++]=t>>8&255,i[a++]=t&255;return n===2&&(t=Dt[e.charCodeAt(l)]<<2|Dt[e.charCodeAt(l+1)]>>4,i[a++]=t&255),n===1&&(t=Dt[e.charCodeAt(l)]<<10|Dt[e.charCodeAt(l+1)]<<4|Dt[e.charCodeAt(l+2)]>>2,i[a++]=t>>8&255,i[a++]=t&255),i}s(Ea,"toByteArray");function a0(e){return wn[e>>18&63]+wn[e>>12&63]+wn[e>>6&63]+wn[e&63]}s(a0,"tripletToBase64");function c0(e,t,r){for(var o,n=[],i=t;i<r;i+=3)o=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(e[i+2]&255),n.push(a0(o));return n.join("")}s(c0,"encodeChunk");function Sa(e){for(var t,r=e.length,o=r%3,n=[],i=16383,a=0,c=r-o;a<c;a+=i)n.push(c0(e,a,a+i>c?c:a+i));return o===1?(t=e[r-1],n.push(wn[t>>2]+wn[t<<4&63]+"==")):o===2&&(t=(e[r-2]<<8)+e[r-1],n.push(wn[t>>10]+wn[t>>4&63]+wn[t<<2&63]+"=")),n.join("")}s(Sa,"fromByteArray");function Gt(e){if(e===void 0)return{};if(!Dd(e))throw new Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}s(Gt,"parseArgs");function xi(e){if(typeof e>"u")throw new Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof e!="string")throw new Error(`Invalid deployment address: found ${e}".`);if(!(e.startsWith("http:")||e.startsWith("https:")))throw new Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);try{new URL(e)}catch{throw new Error(`Invalid deployment address: "${e}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(e.endsWith(".convex.site"))throw new Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}s(xi,"validateDeploymentUrl");function Dd(e){let t=typeof e=="object",r=Object.getPrototypeOf(e),o=r===null||r===Object.prototype||r?.constructor?.name==="Object";return t&&o}s(Dd,"isSimpleObject");var E_=!0,_i=BigInt("-9223372036854775808"),Sh=BigInt("9223372036854775807"),kh=BigInt("0"),l0=BigInt("8"),d0=BigInt("256");function S_(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}s(S_,"isSpecial");function u0(e){e<kh&&(e-=_i+_i);let t=e.toString(16);t.length%2===1&&(t="0"+t);let r=new Uint8Array(new ArrayBuffer(8)),o=0;for(let n of t.match(/.{2}/g).reverse())r.set([parseInt(n,16)],o++),e>>=l0;return Sa(r)}s(u0,"slowBigIntToBase64");function p0(e){let t=Ea(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let r=kh,o=kh;for(let n of t)r+=BigInt(n)*d0**o,o++;return r>Sh&&(r+=_i+_i),r}s(p0,"slowBase64ToBigInt");function m0(e){if(e<_i||Sh<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);let t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),Sa(new Uint8Array(t))}s(m0,"modernBigIntToBase64");function f0(e){let t=Ea(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);return new DataView(t.buffer).getBigInt64(0,!0)}s(f0,"modernBase64ToBigInt");var g0=DataView.prototype.setBigInt64?m0:u0,h0=DataView.prototype.getBigInt64?f0:p0,w_=1024;function Eh(e){if(e.length>w_)throw new Error(`Field name ${e} exceeds maximum field name length ${w_}.`);if(e.startsWith("$"))throw new Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r<32||r>=127)throw new Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}s(Eh,"validateObjectField");function De(e){if(e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(Array.isArray(e))return e.map(o=>De(o));if(typeof e!="object")throw new Error(`Unexpected type of ${e}`);let t=Object.entries(e);if(t.length===1){let o=t[0][0];if(o==="$bytes"){if(typeof e.$bytes!="string")throw new Error(`Malformed $bytes field on ${e}`);return Ea(e.$bytes).buffer}if(o==="$integer"){if(typeof e.$integer!="string")throw new Error(`Malformed $integer field on ${e}`);return h0(e.$integer)}if(o==="$float"){if(typeof e.$float!="string")throw new Error(`Malformed $float field on ${e}`);let n=Ea(e.$float);if(n.byteLength!==8)throw new Error(`Received ${n.byteLength} bytes, expected 8 for $float`);let a=new DataView(n.buffer).getFloat64(0,E_);if(!S_(a))throw new Error(`Float ${a} should be encoded as a number`);return a}if(o==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(o==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}let r={};for(let[o,n]of Object.entries(e))Eh(o),r[o]=De(n);return r}s(De,"jsonToConvex");var k_=16384;function yo(e){let t=JSON.stringify(e,(r,o)=>o===void 0?"undefined":typeof o=="bigint"?`${o.toString()}n`:o);if(t.length>k_){let r="[...truncated]",o=k_-r.length,n=t.codePointAt(o-1);return n!==void 0&&n>65535&&(o-=1),t.substring(0,o)+r}return t}s(yo,"stringifyValueForError");function Gd(e,t,r,o){if(e===void 0){let a=r&&` (present at path ${r} in original object ${yo(t)})`;throw new Error(`undefined is not a valid Convex value${a}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e=="bigint"){if(e<_i||Sh<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:g0(e)}}if(typeof e=="number")if(S_(e)){let a=new ArrayBuffer(8);return new DataView(a).setFloat64(0,e,E_),{$float:Sa(new Uint8Array(a))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:Sa(new Uint8Array(e))};if(Array.isArray(e))return e.map((a,c)=>Gd(a,t,r+`[${c}]`,!1));if(e instanceof Set)throw new Error(wh(r,"Set",[...e],t));if(e instanceof Map)throw new Error(wh(r,"Map",[...e],t));if(!Dd(e)){let a=e?.constructor?.name,c=a?`${a} `:"";throw new Error(wh(r,c,e,t))}let n={},i=Object.entries(e);i.sort(([a,c],[l,d])=>a===l?0:a<l?-1:1);for(let[a,c]of i)c!==void 0?(Eh(a),n[a]=Gd(c,t,r+`.${a}`,!1)):o&&(Eh(a),n[a]=y0(c,t,r+`.${a}`));return n}s(Gd,"convexToJsonInternal");function wh(e,t,r,o){return e?`${t}${yo(r)} is not a supported Convex type (present at path ${e} in original object ${yo(o)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${yo(r)} is not a supported Convex type.`}s(wh,"errorMessageForUnsupportedType");function y0(e,t,r){if(e===void 0)return{$undefined:null};if(t===void 0)throw new Error(`Programming error. Current value is ${yo(e)} but original value is undefined`);return Gd(e,t,r,!1)}s(y0,"convexOrUndefinedToJsonInternal");function Ge(e){return Gd(e,e,"",!1)}s(Ge,"convexToJson");var v0=Object.defineProperty,b0=s((e,t,r)=>t in e?v0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,"__defNormalProp"),ge=s((e,t,r)=>b0(e,typeof t!="symbol"?t+"":t,r),"__publicField"),w0="https://docs.convex.dev/error#undefined-validator";function Pa(e,t){let r=t!==void 0?` for field "${t}"`:"";throw new Error(`A validator is undefined${r} in ${e}. This is often caused by circular imports. See ${w0} for details.`)}s(Pa,"throwUndefinedValidatorError");var Xe=class{static{s(this,"BaseValidator")}constructor({isOptional:t}){ge(this,"type"),ge(this,"fieldPaths"),ge(this,"isOptional"),ge(this,"isConvexValidator"),this.isOptional=t,this.isConvexValidator=!0}},Ud=class e extends Xe{static{s(this,"VId")}constructor({isOptional:t,tableName:r}){if(super({isOptional:t}),ge(this,"tableName"),ge(this,"kind","id"),typeof r!="string")throw new Error("v.id(tableName) requires a string");this.tableName=r}get json(){return{type:"id",tableName:this.tableName}}asOptional(){return new e({isOptional:"optional",tableName:this.tableName})}},Ia=class e extends Xe{static{s(this,"VFloat64")}constructor(){super(...arguments),ge(this,"kind","float64")}get json(){return{type:"number"}}asOptional(){return new e({isOptional:"optional"})}},Ta=class e extends Xe{static{s(this,"VInt64")}constructor(){super(...arguments),ge(this,"kind","int64")}get json(){return{type:"bigint"}}asOptional(){return new e({isOptional:"optional"})}},jd=class e extends Xe{static{s(this,"VBoolean")}constructor(){super(...arguments),ge(this,"kind","boolean")}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:"optional"})}},Md=class e extends Xe{static{s(this,"VBytes")}constructor(){super(...arguments),ge(this,"kind","bytes")}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:"optional"})}},qd=class e extends Xe{static{s(this,"VString")}constructor(){super(...arguments),ge(this,"kind","string")}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:"optional"})}},Fd=class e extends Xe{static{s(this,"VNull")}constructor(){super(...arguments),ge(this,"kind","null")}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:"optional"})}},zd=class e extends Xe{static{s(this,"VAny")}constructor(){super(...arguments),ge(this,"kind","any")}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:"optional"})}},Bd=class e extends Xe{static{s(this,"VObject")}constructor({isOptional:t,fields:r}){super({isOptional:t}),ge(this,"fields"),ge(this,"kind","object"),globalThis.Object.entries(r).forEach(([o,n])=>{if(n===void 0&&Pa("v.object()",o),!n.isConvexValidator)throw new Error("v.object() entries must be validators")}),this.fields=r}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([t,r])=>[t,{fieldType:r.json,optional:r.isOptional==="optional"}]))}}asOptional(){return new e({isOptional:"optional",fields:this.fields})}omit(...t){let r={...this.fields};for(let o of t)delete r[o];return new e({isOptional:this.isOptional,fields:r})}pick(...t){let r={};for(let o of t)r[o]=this.fields[o];return new e({isOptional:this.isOptional,fields:r})}partial(){let t={};for(let[r,o]of globalThis.Object.entries(this.fields))t[r]=o.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},Kd=class e extends Xe{static{s(this,"VLiteral")}constructor({isOptional:t,value:r}){if(super({isOptional:t}),ge(this,"value"),ge(this,"kind","literal"),typeof r!="string"&&typeof r!="boolean"&&typeof r!="number"&&typeof r!="bigint")throw new Error("v.literal(value) must be a string, number, or boolean");this.value=r}get json(){return{type:this.kind,value:Ge(this.value)}}asOptional(){return new e({isOptional:"optional",value:this.value})}},Qd=class e extends Xe{static{s(this,"VArray")}constructor({isOptional:t,element:r}){super({isOptional:t}),ge(this,"element"),ge(this,"kind","array"),r===void 0&&Pa("v.array()"),this.element=r}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:"optional",element:this.element})}},Vd=class e extends Xe{static{s(this,"VRecord")}constructor({isOptional:t,key:r,value:o}){if(super({isOptional:t}),ge(this,"key"),ge(this,"value"),ge(this,"kind","record"),r===void 0&&Pa("v.record()","key"),o===void 0&&Pa("v.record()","value"),r.isOptional==="optional")throw new Error("Record validator cannot have optional keys");if(o.isOptional==="optional")throw new Error("Record validator cannot have optional values");if(!r.isConvexValidator||!o.isConvexValidator)throw new Error("Key and value of v.record() but be validators");this.key=r,this.value=o}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new e({isOptional:"optional",key:this.key,value:this.value})}},Hd=class e extends Xe{static{s(this,"VUnion")}constructor({isOptional:t,members:r}){super({isOptional:t}),ge(this,"members"),ge(this,"kind","union"),r.forEach((o,n)=>{if(o===void 0&&Pa("v.union()",`member at index ${n}`),!o.isConvexValidator)throw new Error("All members of v.union() must be validators")}),this.members=r}get json(){return{type:this.kind,value:this.members.map(t=>t.json)}}asOptional(){return new e({isOptional:"optional",members:this.members})}};function P_(e){return!!e.isConvexValidator}s(P_,"isValidator");var W={id:s(e=>new Ud({isOptional:"required",tableName:e}),"id"),null:s(()=>new Fd({isOptional:"required"}),"null"),number:s(()=>new Ia({isOptional:"required"}),"number"),float64:s(()=>new Ia({isOptional:"required"}),"float64"),bigint:s(()=>new Ta({isOptional:"required"}),"bigint"),int64:s(()=>new Ta({isOptional:"required"}),"int64"),boolean:s(()=>new jd({isOptional:"required"}),"boolean"),string:s(()=>new qd({isOptional:"required"}),"string"),bytes:s(()=>new Md({isOptional:"required"}),"bytes"),literal:s(e=>new Kd({isOptional:"required",value:e}),"literal"),array:s(e=>new Qd({isOptional:"required",element:e}),"array"),object:s(e=>new Bd({isOptional:"required",fields:e}),"object"),record:s((e,t)=>new Vd({isOptional:"required",key:e,value:t}),"record"),union:s((...e)=>new Hd({isOptional:"required",members:e}),"union"),any:s(()=>new zd({isOptional:"required"}),"any"),optional:s(e=>e.asOptional(),"optional"),nullable:s(e=>W.union(e,W.null()),"nullable")};var k0=Object.defineProperty,E0=s((e,t,r)=>t in e?k0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,"__defNormalProp"),Ph=s((e,t,r)=>E0(e,typeof t!="symbol"?t+"":t,r),"__publicField"),I_,T_,S0=Symbol.for("ConvexError"),kn=class extends(T_=Error,I_=S0,T_){static{s(this,"ConvexError")}constructor(t){super(typeof t=="string"?t:yo(t)),Ph(this,"name","ConvexError"),Ph(this,"data"),Ph(this,I_,!0),this.data=t}};var x_=s(()=>Array.from({length:4},()=>0),"arr"),M5=x_(),q5=x_();var I0=Object.defineProperty,T0=s((e,t,r)=>t in e?I0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,"__defNormalProp"),__=s((e,t,r)=>T0(e,typeof t!="symbol"?t+"":t,r),"__publicField"),x0="color:rgb(0, 145, 255)";function _0(e){switch(e){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}s(_0,"prefix_for_source");var Wd=class{static{s(this,"DefaultLogger")}constructor(t){__(this,"_onLogLineFuncs"),__(this,"_verbose"),this._onLogLineFuncs={},this._verbose=t.verbose}addLogLineListener(t){let r=Math.random().toString(36).substring(2,15);for(let o=0;o<10&&this._onLogLineFuncs[r]!==void 0;o++)r=Math.random().toString(36).substring(2,15);return this._onLogLineFuncs[r]=t,()=>{delete this._onLogLineFuncs[r]}}logVerbose(...t){if(this._verbose)for(let r of Object.values(this._onLogLineFuncs))r("debug",`${new Date().toISOString()}`,...t)}log(...t){for(let r of Object.values(this._onLogLineFuncs))r("info",...t)}warn(...t){for(let r of Object.values(this._onLogLineFuncs))r("warn",...t)}error(...t){for(let r of Object.values(this._onLogLineFuncs))r("error",...t)}};function Ih(e){let t=new Wd(e);return t.addLogLineListener((r,...o)=>{switch(r){case"debug":console.debug(...o);break;case"info":console.log(...o);break;case"warn":console.warn(...o);break;case"error":console.error(...o);break;default:console.log(...o)}}),t}s(Ih,"instantiateDefaultLogger");function Th(e){return new Wd(e)}s(Th,"instantiateNoopLogger");function vo(e,t,r,o,n){let i=_0(r);if(typeof n=="object"&&(n=`ConvexError ${JSON.stringify(n.errorData,null,2)}`),t==="info"){let a=n.match(/^\[.*?\] /);if(a===null){e.error(`[CONVEX ${i}(${o})] Could not parse console.log`);return}let c=n.slice(1,a[0].length-2),l=n.slice(a[0].length);e.log(`%c[CONVEX ${i}(${o})] [${c}]`,x0,l)}else e.error(`[CONVEX ${i}(${o})] ${n}`)}s(vo,"logForFunction");var bo=Symbol.for("functionName");var O_=Symbol.for("toReferencePath");function R0(e){return e[O_]??null}s(R0,"extractReferencePath");function A0(e){return e.startsWith("function://")}s(A0,"isFunctionHandle");function kr(e){let t;if(typeof e=="string")A0(e)?t={functionHandle:e}:t={name:e};else if(e[bo])t={name:e[bo]};else{let r=R0(e);if(!r)throw new Error(`${e} is not a functionReference`);t={reference:r}}return t}s(kr,"getFunctionAddress");function En(e){let t=kr(e);if(t.name===void 0)throw t.functionHandle!==void 0?new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${t.functionHandle}`):t.reference!==void 0?new Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${t.reference}`):new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(t)}`);if(typeof e=="string")return e;let r=e[bo];if(!r)throw new Error(`${e} is not a functionReference`);return r}s(En,"getFunctionName");function xa(e){return{[bo]:e}}s(xa,"makeFunctionReference");function $_(e=[]){let t={get(r,o){if(typeof o=="string"){let n=[...e,o];return $_(n)}else if(o===bo){if(e.length<2){let a=["api",...e].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${a}\``)}let n=e.slice(0,-1).join("/"),i=e[e.length-1];return i==="default"?n:n+":"+i}else return o===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},t)}s($_,"createApi");var O0=$_();var N0=Object.defineProperty,L0=s((e,t,r)=>t in e?N0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,"__defNormalProp"),xh=s((e,t,r)=>L0(e,typeof t!="symbol"?t+"":t,r),"__publicField"),wo=class e{static{s(this,"Long")}constructor(t,r){xh(this,"low"),xh(this,"high"),xh(this,"__isUnsignedLong__"),this.low=t|0,this.high=r|0,this.__isUnsignedLong__=!0}static isLong(t){return(t&&t.__isUnsignedLong__)===!0}static fromBytesLE(t){return new e(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24)}toBytesLE(){let t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]}static fromNumber(t){return isNaN(t)||t<0?C_:t>=D0?G0:new e(t%_a|0,t/_a|0)}toString(){return(BigInt(this.high)*BigInt(_a)+BigInt(this.low)).toString()}equals(t){return e.isLong(t)||(t=e.fromValue(t)),this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low}notEquals(t){return!this.equals(t)}comp(t){return e.isLong(t)||(t=e.fromValue(t)),this.equals(t)?0:t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1}lessThanOrEqual(t){return this.comp(t)<=0}static fromValue(t){return typeof t=="number"?e.fromNumber(t):new e(t.low,t.high)}},C_=new wo(0,0),N_=65536,_a=N_*N_,D0=_a*_a,G0=new wo(-1,-1);var _h=class extends Error{static{s(this,"InvalidTokenError")}};_h.prototype.name="InvalidTokenError";var tZ=480*60*60*1e3;var M0=Object.defineProperty,q0=s((e,t,r)=>t in e?M0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,"__defNormalProp"),Sn=s((e,t,r)=>q0(e,typeof t!="symbol"?t+"":t,r),"__publicField");var Jd=560,Ra;var Aa=class{static{s(this,"ConvexHttpClient")}constructor(t,r){if(Sn(this,"address"),Sn(this,"auth"),Sn(this,"adminAuth"),Sn(this,"encodedTsPromise"),Sn(this,"debug"),Sn(this,"fetchOptions"),Sn(this,"fetch"),Sn(this,"logger"),Sn(this,"mutationQueue",[]),Sn(this,"isProcessingQueue",!1),typeof r=="boolean")throw new Error("skipConvexDeploymentUrlCheck as the second argument is no longer supported. Please pass an options object, `{ skipConvexDeploymentUrlCheck: true }`.");(r??{}).skipConvexDeploymentUrlCheck!==!0&&xi(t),this.logger=r?.logger===!1?Th({verbose:!1}):r?.logger!==!0&&r?.logger?r.logger:Ih({verbose:!1}),this.address=t,this.debug=!0,this.auth=void 0,this.adminAuth=void 0,this.fetch=r?.fetch,r?.auth&&this.setAuth(r.auth)}backendUrl(){return`${this.address}/api`}get url(){return this.address}setAuth(t){this.clearAuth(),this.auth=t}setAdminAuth(t,r){if(this.clearAuth(),r!==void 0){let o=new TextEncoder().encode(JSON.stringify(r)),n=btoa(String.fromCodePoint(...o));this.adminAuth=`${t}:${n}`}else this.adminAuth=t}clearAuth(){this.auth=void 0,this.adminAuth=void 0}setDebug(t){this.debug=t}setFetchOptions(t){this.fetchOptions=t}async consistentQuery(t,...r){let o=Gt(r[0]),n=this.getTimestamp();return await this.queryInner(t,o,{timestampPromise:n})}async getTimestamp(){return this.encodedTsPromise?this.encodedTsPromise:this.encodedTsPromise=this.getTimestampInner()}async getTimestampInner(){let t=this.fetch||Ra||fetch,r={"Content-Type":"application/json","Convex-Client":`npm-${dt}`},o=await t(`${this.address}/api/query_ts`,{...this.fetchOptions,method:"POST",headers:r});if(!o.ok)throw new Error(await o.text());let{ts:n}=await o.json();return n}async query(t,...r){let o=Gt(r[0]);return await this.queryInner(t,o,{})}async queryInner(t,r,o){let n=En(t),i=[Ge(r)],a={"Content-Type":"application/json","Convex-Client":`npm-${dt}`};this.adminAuth?a.Authorization=`Convex ${this.adminAuth}`:this.auth&&(a.Authorization=`Bearer ${this.auth}`);let c=this.fetch||Ra||fetch,l=o.timestampPromise?await o.timestampPromise:void 0,d=JSON.stringify({path:n,format:"convex_encoded_json",args:i,...l?{ts:l}:{}}),u=l?`${this.address}/api/query_at_ts`:`${this.address}/api/query`,m=await c(u,{...this.fetchOptions,body:d,method:"POST",headers:a});if(!m.ok&&m.status!==Jd)throw new Error(await m.text());let p=await m.json();if(this.debug)for(let f of p.logLines??[])vo(this.logger,"info","query",n,f);switch(p.status){case"success":return De(p.value);case"error":throw p.errorData!==void 0?Zd(p.errorData,new kn(p.errorMessage)):new Error(p.errorMessage);default:throw new Error(`Invalid response: ${JSON.stringify(p)}`)}}async mutationInner(t,r){let o=En(t),n=JSON.stringify({path:o,format:"convex_encoded_json",args:[Ge(r)]}),i={"Content-Type":"application/json","Convex-Client":`npm-${dt}`};this.adminAuth?i.Authorization=`Convex ${this.adminAuth}`:this.auth&&(i.Authorization=`Bearer ${this.auth}`);let c=await(this.fetch||Ra||fetch)(`${this.address}/api/mutation`,{...this.fetchOptions,body:n,method:"POST",headers:i});if(!c.ok&&c.status!==Jd)throw new Error(await c.text());let l=await c.json();if(this.debug)for(let d of l.logLines??[])vo(this.logger,"info","mutation",o,d);switch(l.status){case"success":return De(l.value);case"error":throw l.errorData!==void 0?Zd(l.errorData,new kn(l.errorMessage)):new Error(l.errorMessage);default:throw new Error(`Invalid response: ${JSON.stringify(l)}`)}}async processMutationQueue(){if(!this.isProcessingQueue){for(this.isProcessingQueue=!0;this.mutationQueue.length>0;){let{mutation:t,args:r,resolve:o,reject:n}=this.mutationQueue.shift();try{let i=await this.mutationInner(t,r);o(i)}catch(i){n(i)}}this.isProcessingQueue=!1}}enqueueMutation(t,r){return new Promise((o,n)=>{this.mutationQueue.push({mutation:t,args:r,resolve:o,reject:n}),this.processMutationQueue()})}async mutation(t,...r){let[o,n]=r,i=Gt(o);return n?.skipQueue?await this.mutationInner(t,i):await this.enqueueMutation(t,i)}async action(t,...r){let o=Gt(r[0]),n=En(t),i=JSON.stringify({path:n,format:"convex_encoded_json",args:[Ge(o)]}),a={"Content-Type":"application/json","Convex-Client":`npm-${dt}`};this.adminAuth?a.Authorization=`Convex ${this.adminAuth}`:this.auth&&(a.Authorization=`Bearer ${this.auth}`);let l=await(this.fetch||Ra||fetch)(`${this.address}/api/action`,{...this.fetchOptions,body:i,method:"POST",headers:a});if(!l.ok&&l.status!==Jd)throw new Error(await l.text());let d=await l.json();if(this.debug)for(let u of d.logLines??[])vo(this.logger,"info","action",n,u);switch(d.status){case"success":return De(d.value);case"error":throw d.errorData!==void 0?Zd(d.errorData,new kn(d.errorMessage)):new Error(d.errorMessage);default:throw new Error(`Invalid response: ${JSON.stringify(d)}`)}}async function(t,r,...o){let n=Gt(o[0]),i=typeof t=="string"?t:En(t),a=JSON.stringify({componentPath:r,path:i,format:"convex_encoded_json",args:Ge(n)}),c={"Content-Type":"application/json","Convex-Client":`npm-${dt}`};this.adminAuth?c.Authorization=`Convex ${this.adminAuth}`:this.auth&&(c.Authorization=`Bearer ${this.auth}`);let d=await(this.fetch||Ra||fetch)(`${this.address}/api/function`,{...this.fetchOptions,body:a,method:"POST",headers:c});if(!d.ok&&d.status!==Jd)throw new Error(await d.text());let u=await d.json();if(this.debug)for(let m of u.logLines??[])vo(this.logger,"info","any",i,m);switch(u.status){case"success":return De(u.value);case"error":throw u.errorData!==void 0?Zd(u.errorData,new kn(u.errorMessage)):new Error(u.errorMessage);default:throw new Error(`Invalid response: ${JSON.stringify(u)}`)}}};function Zd(e,t){return t.data=De(e),t}s(Zd,"forwardErrorData");var SY=W.object({numItems:W.number(),cursor:W.union(W.string(),W.null()),endCursor:W.optional(W.union(W.string(),W.null())),id:W.optional(W.number()),maximumRowsRead:W.optional(W.number()),maximumBytesRead:W.optional(W.number())});var K0=Object.defineProperty,Q0=s((e,t,r)=>t in e?K0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,"__defNormalProp"),Pn=s((e,t,r)=>Q0(e,typeof t!="symbol"?t+"":t,r),"__publicField"),Yd=class{static{s(this,"TableDefinition")}constructor(t){Pn(this,"indexes"),Pn(this,"stagedDbIndexes"),Pn(this,"searchIndexes"),Pn(this,"stagedSearchIndexes"),Pn(this,"vectorIndexes"),Pn(this,"stagedVectorIndexes"),Pn(this,"validator"),this.indexes=[],this.stagedDbIndexes=[],this.searchIndexes=[],this.stagedSearchIndexes=[],this.vectorIndexes=[],this.stagedVectorIndexes=[],this.validator=t}" indexes"(){return this.indexes}index(t,r){return Array.isArray(r)?this.indexes.push({indexDescriptor:t,fields:r}):r.staged?this.stagedDbIndexes.push({indexDescriptor:t,fields:r.fields}):this.indexes.push({indexDescriptor:t,fields:r.fields}),this}searchIndex(t,r){return r.staged?this.stagedSearchIndexes.push({indexDescriptor:t,searchField:r.searchField,filterFields:r.filterFields||[]}):this.searchIndexes.push({indexDescriptor:t,searchField:r.searchField,filterFields:r.filterFields||[]}),this}vectorIndex(t,r){return r.staged?this.stagedVectorIndexes.push({indexDescriptor:t,vectorField:r.vectorField,dimensions:r.dimensions,filterFields:r.filterFields||[]}):this.vectorIndexes.push({indexDescriptor:t,vectorField:r.vectorField,dimensions:r.dimensions,filterFields:r.filterFields||[]}),this}self(){return this}export(){let t=this.validator.json;if(typeof t!="object")throw new Error("Invalid validator: please make sure that the parameter of `defineTable` is valid (see https://docs.convex.dev/database/schemas)");return{indexes:this.indexes,stagedDbIndexes:this.stagedDbIndexes,searchIndexes:this.searchIndexes,stagedSearchIndexes:this.stagedSearchIndexes,vectorIndexes:this.vectorIndexes,stagedVectorIndexes:this.stagedVectorIndexes,documentType:t}}};function Ah(e){return P_(e)?new Yd(e):new Yd(W.object(e))}s(Ah,"defineTable");var Oh=class{static{s(this,"SchemaDefinition")}constructor(t,r){Pn(this,"tables"),Pn(this,"strictTableNameTypes"),Pn(this,"schemaValidation"),this.tables=t,this.schemaValidation=r?.schemaValidation===void 0?!0:r.schemaValidation}export(){return JSON.stringify({tables:Object.entries(this.tables).map(([t,r])=>{let{indexes:o,stagedDbIndexes:n,searchIndexes:i,stagedSearchIndexes:a,vectorIndexes:c,stagedVectorIndexes:l,documentType:d}=r.export();return{tableName:t,indexes:o,stagedDbIndexes:n,searchIndexes:i,stagedSearchIndexes:a,vectorIndexes:c,stagedVectorIndexes:l,documentType:d}}),schemaValidation:this.schemaValidation})}};function L_(e,t){return new Oh(e,t)}s(L_,"defineSchema");var zY=L_({_scheduled_functions:Ah({name:W.string(),args:W.array(W.any()),scheduledTime:W.float64(),completedTime:W.optional(W.float64()),state:W.union(W.object({kind:W.literal("pending")}),W.object({kind:W.literal("inProgress")}),W.object({kind:W.literal("success")}),W.object({kind:W.literal("failed"),error:W.string()}),W.object({kind:W.literal("canceled")}))}),_storage:Ah({sha256:W.string(),size:W.float64(),contentType:W.optional(W.string())})});async function D_(e,...t){let[r,o]=t;return $h(o??{}).query(e,r||{})}s(D_,"fetchQuery");async function G_(e,...t){let[r,o]=t;return $h(o??{}).mutation(e,r||{})}s(G_,"fetchMutation");async function U_(e,...t){let[r,o]=t;return $h(o??{}).action(e,r||{})}s(U_,"fetchAction");function $h(e){"url"in e&&e.url===void 0&&console.error("deploymentUrl is undefined, are your environment variables set? In the future explicitly passing undefined will cause an error. To explicitly use the default, pass `process.env.NEXT_PUBLIC_CONVEX_URL`.");let t=new Aa(V0(e.url,e.skipConvexDeploymentUrlCheck??!1));return e.token!==void 0&&t.setAuth(e.token),e.adminToken!==void 0&&t.setAdminAuth(e.adminToken),t.setFetchOptions({cache:"no-store"}),t}s($h,"setupClient");function V0(e,t){let r=e??process.env.NEXT_PUBLIC_CONVEX_URL,o=e===void 0;if(typeof r!="string")throw new Error(o?"Environment variable NEXT_PUBLIC_CONVEX_URL is not set.":"Convex function called with invalid deployment address.");return t||xi(r),r}s(V0,"getConvexUrl");Xs();Wt();se();Ke();re();var Er={create:"",validate:"",drift:"",approve:"",execute:"",rollback:"",list:"",getJobWithSteps:""};async function H0(e){let t=globalThis.fetch,r=[],o=ot(Ie(),t),n=s((async(i,a)=>{try{return await o(i,a)}catch(c){throw c instanceof Z&&r.push(c),c}}),"held");globalThis.fetch=n;try{return await e()}catch(i){throw r[0]??i}finally{globalThis.fetch===n&&(globalThis.fetch=t)}}s(H0,"underTheRunsFetch");function W0(){throw new G("`np promote` is no longer available: promotion to production was removed.",{code:"PROMOTION_UNAVAILABLE",hint:"Run `np deploy` from your pipeline to put your configuration in production."})}s(W0,"resolveAdminUrl");var en=class e{constructor(t,r){this.url=t;this.token=r}static{s(this,"PromoteAdmin")}static async fromSession(){let t=W0(),r=await Hl();if(!r?.accessToken)throw new G("You are not signed in to the npayload Control Plane.",{code:"NOT_AUTHENTICATED",hint:"Run `npx @npayload/sdk init` or `np auth login` to sign in, then retry."});return Ie().check(t),new e(t,r.accessToken)}async call(t){try{return await H0(()=>t({url:this.url,token:this.token}))}catch(r){throw F(r),J0(r)}}query(t,r){return this.call(o=>D_(xa(t),r,o))}mutation(t,r){return this.call(o=>G_(xa(t),r,o))}action(t,r){return this.call(o=>U_(xa(t),r,o))}create(t){return this.mutation(Er.create,{...t})}validate(t){return this.mutation(Er.validate,{promotionId:t})}drift(t){return this.action(Er.drift,{appId:t})}approve(t){return this.mutation(Er.approve,{promotionId:t})}execute(t){return this.mutation(Er.execute,{promotionId:t})}rollback(t){return this.mutation(Er.rollback,{promotionId:t})}list(t){return this.query(Er.list,t?{appId:t}:{})}getJobWithSteps(t){return this.query(Er.getJobWithSteps,{promotionId:t})}};function J0(e){let t=e?.data;if(t!==null&&typeof t=="object"&&typeof t.kind=="string"){let r=t,o=typeof r.message=="string"&&r.message.length>0?r.message:e instanceof Error?e.message:r.kind;return new G(o,{code:r.kind,cause:e})}return e}s(J0,"adminRefusal");function In(e,t){process.stdout.write(`${Ld(e,t)}
|
|
391
|
+
`)}s(In,"emit");function Ch(e){let t=String(e.status??"").toLowerCase(),r=t==="succeeded"||t==="success"||t==="completed"?"succeeded":t==="failed"||t==="error"?"failed":t==="skipped"?"skipped":"running",o=e.resourceGid??e.resource??e.label??"resource";return{label:`${e.plane?`${String(e.plane)}: `:""}${String(o)}`,status:r,message:e.message?String(e.message):void 0}}s(Ch,"toStepLine");async function j_(e,t,r,o={}){let n=o.intervalMs??1e3,i=Date.now()+(o.timeoutMs??600*1e3),a=0,c=null,l=new Set(["completed","failed","rolled_back","rolledback","cancelled"]);for(;;){c=await e.getJobWithSteps(t);let d=c?.steps??[];for(let m=a;m<d.length;m++){let p=Ch(d[m]);r.start(p.label),r.finish(p)}a=d.length;let u=String(c?.promotion?.status??"").toLowerCase();if(l.has(u))break;if(Date.now()>i)throw new G("Timed out waiting for the promotion to finish.",{code:"PROMOTE_TIMEOUT",hint:`Check status with: np promote status ${t}`});await new Promise(m=>setTimeout(m,n))}return c}s(j_,"streamSteps");function M_(e){let t=e.command("promote").description("[DEPRECATED \u2014 use `np deploy`] promote a tested app's config sandbox\u2192production (snapshot \u2192 diff \u2192 approve \u2192 execute \u2192 rollback)");t.hook("preAction",()=>{process.stderr.write("\u26A0\uFE0F `np promote` is deprecated and the sandbox\u2192production clone is disabled. Use `np deploy` to push config to production (code is the source of truth).\n")}),t.command("create").description("snapshot the sandbox's configuration and open a promotion").requiredOption("--app <slug>","app slug or GID to promote").option("--from <env>","source environment","sandbox").option("--to <env>","target environment","production").option("--mode <clone|fresh>","snapshot mode","clone").option("--output <fmt>","human | table | json | yaml | ndjson").action(async r=>{try{let o=Xt(r.output),n=r.mode==="fresh"?"fresh":"clone",a=await(await en.fromSession()).create({appId:r.app,fromEnv:r.from,toEnv:r.to,mode:n});In(a,o)}catch(o){we(o)}}),t.command("run").description("one-shot promotion: create \u2192 validate \u2192 approve \u2192 execute, streaming the live step log. Requires --yes.").requiredOption("--app <slug>","app slug or GID to promote").option("--from <env>","source environment","sandbox").option("--to <env>","target environment","production").option("--mode <clone|fresh>","snapshot mode","clone").option("--yes","confirm non-interactive auto-approval of the full pipeline").option("--output <fmt>","human | table | json | yaml | ndjson").option("--no-follow","do not stream the live step log; return immediately").action(async r=>{try{let o=Xt(r.output);if(!r.yes)throw new G("`np promote run` auto-approves and executes the promotion. Re-run with --yes to confirm.",{code:"CONFIRMATION_REQUIRED",hint:"Or use the step-by-step flow: create \u2192 diff \u2192 approve \u2192 execute."});let n=r.mode==="fresh"?"fresh":"clone",i=await en.fromSession(),a=new ka(o),l=(await i.create({appId:r.app,fromEnv:r.from,toEnv:r.to,mode:n})).promotionId;await i.validate(l),await i.approve(l);let d=await i.execute(l),u=null;if(r.follow!==!1)u=await j_(i,l,a);else{u=await i.getJobWithSteps(l);for(let h of u?.steps??[]){let y=Ch(h);a.start(y.label),a.finish(y)}}let m=String(u?.promotion?.status??"").toLowerCase(),{cellRegistryId:p,...f}=d,g={promotionId:l,...f,status:u?.promotion?.status??null,steps:a.all()};In(o==="human"?{promotionId:l,status:g.status}:g,o),(a.hasFailure()||m==="failed")&&(process.exitCode=1)}catch(o){we(o)}}),t.command("diff").description("run the validation pipeline and show the field-level diff vs production (read-only)").argument("<promotion-id>","promotion id (prm_\u2026)").option("--output <fmt>","human | table | json | yaml | ndjson").action(async(r,o)=>{try{let n=Xt(o.output),i=await en.fromSession();await i.validate(r);let a=await i.getJobWithSteps(r);if(!a)throw new G(`Promotion ${r} not found.`,{code:"PROMOTION_NOT_FOUND"});In(a.promotion,n)}catch(n){we(n)}}),t.command("approve").description("record approval (production requires a second approver \u2014 4-eyes \u2014 on mesh+)").argument("<promotion-id>","promotion id (prm_\u2026)").option("--output <fmt>","human | table | json | yaml | ndjson").action(async(r,o)=>{try{let n=Xt(o.output),a=await(await en.fromSession()).approve(r);In({promotionId:r,...a},n)}catch(n){we(n)}}),t.command("execute").description("apply the promotion and stream a live step log").argument("<promotion-id>","promotion id (prm_\u2026)").option("--output <fmt>","human | table | json | yaml | ndjson").option("--no-follow","do not stream the live step log; return immediately").action(async(r,o)=>{try{let n=Xt(o.output),i=await en.fromSession(),a=new ka(n),c=await i.execute(r),l=null;if(o.follow!==!1)l=await j_(i,r,a);else{l=await i.getJobWithSteps(r);for(let f of l?.steps??[]){let g=Ch(f);a.start(g.label),a.finish(g)}}let d=String(l?.promotion?.status??"").toLowerCase(),{cellRegistryId:u,...m}=c,p={promotionId:r,...m,status:l?.promotion?.status??null,steps:a.all()};In(n==="human"?{promotionId:r,status:p.status}:p,n),(a.hasFailure()||d==="failed")&&(process.exitCode=1)}catch(n){we(n)}}),t.command("rollback").description("restore the prior production snapshot within the rollback window (default 30m)").argument("<promotion-id>","promotion id (prm_\u2026)").option("--output <fmt>","human | table | json | yaml | ndjson").action(async(r,o)=>{try{let n=Xt(o.output),a=await(await en.fromSession()).rollback(r);In({promotionId:r,...a},n)}catch(n){we(n)}}),t.command("list").description("promotion history").option("--app <slug>","filter to one app slug or GID").option("--output <fmt>","human | table | json | yaml | ndjson").action(async r=>{try{let o=Xt(r.output),i=await(await en.fromSession()).list(r.app);In(i,o)}catch(o){we(o)}}),t.command("status").description("current job state + live steps").argument("<promotion-id>","promotion id (prm_\u2026)").option("--output <fmt>","human | table | json | yaml | ndjson").action(async(r,o)=>{try{let n=Xt(o.output),a=await(await en.fromSession()).getJobWithSteps(r);if(!a)throw new G(`Promotion ${r} not found.`,{code:"PROMOTION_NOT_FOUND"});In(a,n)}catch(n){we(n)}})}s(M_,"registerPromote");Pt();var q_=require("http"),de=K(require("chalk"));re();vi();md();Wt();se();Ke();ro();_t();mr();Ke();var Z0=12e4,Y0=["dev","listen","sync","tail"];function X0(e){return Y0.includes(e)}s(X0,"isLongRunningVerb");function Sr(){let e,t=s(()=>{},"reject"),r=new Promise((o,n)=>{t=n});return r.catch(()=>{}),{onRefused:s(o=>{e??=o,t(o)},"onRefused"),ended:r,refusal:s(()=>e,"refusal")}}s(Sr,"heartbeatEnd");function eG(e,t,r={}){let o=r.intervalMs??Z0,n=!1,i=!1,a=s(()=>{n||(n=!0,clearInterval(l))},"stop"),c=s(async()=>{if(!(n||i)){i=!0;try{await t.heartbeat(e)}catch(d){d instanceof Z?(a(),r.onRefused?.(d)):DT(d)?(a(),r.onRevoked?.(d instanceof Jt?d:new Jt)):r.onTransientError?.(d)}finally{i=!1}}},"tick"),l=setInterval(()=>void c(),o);return l.unref?.(),c(),a}s(eG,"startHeartbeat");function Pr(e,t,r={}){return!t||!X0(e)?()=>{}:eG(e,t,r)}s(Pr,"maybeStartHeartbeat");mr();async function Nh(){let e=process.env.NPAYLOAD_CLIENT_ID,t=(process.env.NPAYLOAD_CLIENT_SECRET??process.env.NPAYLOAD_HMAC_SECRET)?.trim()||void 0,r;if(!e)try{let l=await Bn();e=l.clientId,t=t??l.hmacSecret,r=l.dpopPrivateJwk}catch{}if(!e)throw new G("Not authenticated.",{code:"NOT_AUTHENTICATED",hint:"Run `npx @npayload/sdk init` (device flow), or export NPAYLOAD_CLIENT_ID + NPAYLOAD_HMAC_SECRET."});let{apiUrl:o,authUrl:n,guard:i}=so(),a=bi({env:process.env,credentialKey:r})??(await Do()).privateJwk,c=process.env.NPAYLOAD_APP_ID;return si({clientId:e,dpopPrivateJwk:a,baseUrl:o,...t!==void 0?{clientSecret:t}:{},...n!==void 0?{authUrl:n}:{},...c!==void 0?{appId:c}:{}},i)}s(Nh,"resolveKernel");function tG(e){return/^(ch|chn)_/.test(e)}s(tG,"isChannelGid");async function Lh(e,t,r){if(tG(t))return t;if(!r)throw new G(`Cannot resolve channel slug "${t}" without an app.`,{code:"NO_APP_FOR_SLUG",hint:"Pass --app <app_\u2026> (or set NPAYLOAD_APP_ID), or pass a channel GID directly as --channel ch_\u2026"});let o=await e.send({method:"GET",path:`/v1/apps/channels/by-slug/${encodeURIComponent(t)}`,scope:"events:read"}),n=o.gid??o.channelId??o.id??o._id;if(!n)throw new G(`Channel "${t}" not found in app ${r}.`,{code:"CHANNEL_NOT_FOUND",hint:"Create it first (publish/subscribe in the scaffold), or pass a channel GID with --channel ch_\u2026"});return n}s(Lh,"resolveChannelGid");function nG(e){return e.publicUrl?{url:e.publicUrl,note:"using --public-url"}:{url:`http://localhost:${e.port}/`,note:"localhost is not reachable from npayload's delivery: pass --public-url with a tunnel's address"}}s(nG,"deliveryEndpointUrl");async function rG(e,t){let r=t.events&&t.events.length===1?t.events[0]:void 0,o={name:t.name,type:"webhook",endpoint:{url:t.endpointUrl}};r&&(o.subjectFilter=r);try{let n=await e.send({method:"POST",path:`/v1/channels/${encodeURIComponent(t.channelGid)}/subscriptions`,body:o,scope:"events:write"}),i=n.gid??n.subscriptionId??n.id??n._id;if(!i)throw new G("Subscription created but no id was returned.",{code:"SUBSCRIPTION_NO_ID",hint:"Cannot guarantee cleanup without an id \u2014 aborting. Check the cell create response."});return i}catch(n){F(n);let i=n instanceof Error?n.message:String(n);if(/already.?exists|ALREADY_EXISTS/i.test(i)){let a=await oG(e,t.channelGid,t.name);if(a)return a}throw n}}s(rG,"registerTempSubscription");async function oG(e,t,r){let o=await e.send({method:"GET",path:`/v1/channels/${encodeURIComponent(t)}/subscriptions`,scope:"events:read"}),i=(o.subscriptions??o.items??[]).find(c=>c.name===r);if(!i)return;let a=i.gid??i.subscriptionId??i.id??i._id;return typeof a=="string"?a:void 0}s(oG,"findSubscriptionByName");async function iG(e,t){await e.send({method:"DELETE",path:`/v1/subscriptions/${encodeURIComponent(t)}`,scope:"events:write"})}s(iG,"deleteSubscription");async function sG(e){let t=[];for await(let r of e)t.push(r);return Buffer.concat(t).toString("utf8")}s(sG,"readBody");async function aG(e,t,r){let o={"content-type":"application/json"};for(let i of["x-npayload-signature","x-webhook-signature","x-npayload-timestamp","x-npayload-event-type","x-npayload-delivery-id"]){let a=r[i];typeof a=="string"&&(o[i]=a)}return(await ot(Ie())(e,{method:"POST",headers:o,body:t})).status}s(aG,"forwardDelivery");function cG(e){let t=e.log??(r=>void process.stderr.write(`${r}
|
|
392
|
+
`));return(0,q_.createServer)((r,o)=>{(async()=>{if(r.method==="GET"&&(r.url==="/health"||r.url==="/")){o.writeHead(200,{"content-type":"application/json"}),o.end(JSON.stringify({status:"ok"}));return}if(r.method!=="POST"){o.writeHead(404),o.end();return}let n=await sG(r),i=new Date().toISOString().slice(11,19);if(t(`${de.default.dim(i)} ${de.default.green("\u2190")} ${lG(n)}`),!e.printOnly)try{let a=await aG(e.forwardTo,n,r.headers),c=a>=200&&a<300?de.default.green("\u2192"):de.default.red("\u2192");t(` ${c} forwarded to ${de.default.dim(e.forwardTo)} ${de.default.dim(`[${a}]`)}`)}catch(a){let c=a instanceof Error?a.message:String(a);t(` ${de.default.red("\u2192")} forward failed: ${de.default.dim(ie(c,a))}`)}o.writeHead(200,{"content-type":"application/json"}),o.end(JSON.stringify({received:!0}))})()})}s(cG,"createListenServer");function lG(e){try{let t=JSON.parse(e),r=t.eventType??t.type??"event",o=t.messageGid??t.id??t.deliveryId??"";return`${de.default.cyan(String(r))}${o?de.default.dim(` ${String(o)}`):""}`}catch{return de.default.dim(`${e.length} bytes (non-JSON)`)}}s(lG,"summarize");function F_(e){e.command("listen").description("forward npayload webhooks to a local URL (registers a temporary subscription, cleans up on exit)").option("--channel <slug|gid>","channel to listen on (slug needs --app, or pass a ch_\u2026 GID)","signals").option("--forward-to <url>","local URL to forward each event to","http://localhost:3001/hooks/signals").option("--forward <url>","alias of --forward-to").option("--events <types>","comma-separated event-type allowlist (a single type is applied as a subject filter)",t=>t.split(",").map(r=>r.trim()).filter(Boolean)).option("--print","log received events only; do not forward to --forward-to").option("--public-url <url>","explicit public/tunnel URL npayload should deliver to (e.g. an ngrok URL); required against production").option("--app <app_\u2026>","app GID to scope channel resolution + subscription (default NPAYLOAD_APP_ID)").option("--port <port>","local receiver port (default: ephemeral)",t=>Number(t)).action(async t=>{let r={channel:t.channel??"signals",forwardTo:t.forward??t.forwardTo??"http://localhost:3001/hooks/signals",events:t.events,printOnly:t.print===!0,publicUrl:t.publicUrl,appId:t.app??process.env.NPAYLOAD_APP_ID,port:typeof t.port=="number"&&!Number.isNaN(t.port)?t.port:0};try{await dG(r)}catch(o){we(o)}})}s(F_,"registerListen");async function dG(e){e.printOnly||Ie().check(e.forwardTo);let r=await Nh(),o=new Vt("Resolving channel\u2026").start(),n;try{n=await Lh(r,e.channel,e.appId)}catch(k){throw o.fail("Could not resolve the channel."),k}o.succeed(`Channel ${de.default.cyan(e.channel)} \u2192 ${de.default.dim(n)}`);let i=null,a=!1,c=cG({forwardTo:e.forwardTo,printOnly:e.printOnly});await new Promise((k,R)=>{c.once("error",R),c.listen(e.port,"0.0.0.0",()=>k())});let l=c.address().port,{url:d,note:u}=nG({publicUrl:e.publicUrl,port:l}),m=`np-listen-${l}`,p=new Vt("Registering temporary subscription\u2026").start();try{i=await rG(r,{channelGid:n,endpointUrl:d,name:m,events:e.events})}catch(k){throw p.fail("Could not register the subscription."),c.close(),k}p.succeed(`Subscription ${de.default.dim(i)} \u2192 ${de.default.cyan(d)}`);let f=await ht().catch(()=>null),g=Sr(),h=Pr("listen",f,{onRevoked:s(()=>vn(),"onRevoked"),onRefused:g.onRefused}),y=!1,v=s(async()=>{if(a)return;a=!0,h(),process.stderr.write(`
|
|
393
|
+
`);let k=new Vt("Cleaning up the temporary subscription\u2026").start();try{i&&await iG(r,i),k.succeed("Temporary subscription removed.")}catch(R){let I=R instanceof Error?R.message:String(R);R instanceof Z?(y=!0,k.stop(),process.stderr.write(`${de.default.yellow("\u26A0")} ${ie(`Could not delete subscription ${i??"?"}: ${I}`,R)}
|
|
394
|
+
`)):k.warn(`Could not delete subscription ${i??"?"}: ${I}`)}finally{c.close()}},"cleanup"),S=s(()=>{v().then(()=>process.exit(y?1:0))},"onSignal");process.on("SIGINT",S),process.on("SIGTERM",S),process.stderr.write(["",de.default.bold("Listening for npayload events\u2026"),` ${de.default.dim("channel")} ${e.channel} ${de.default.dim(`(${n})`)}`,` ${de.default.dim("endpoint")} ${d} ${de.default.dim(`(${u})`)}`,e.printOnly?` ${de.default.dim("mode")} print-only (not forwarding)`:` ${de.default.dim("forward to")} ${e.forwardTo}`,e.events?` ${de.default.dim("events")} ${e.events.join(", ")}`:"","",de.default.dim(" Publish one with: npx tsx npayload/events/publish.ts"),de.default.dim(" Press Ctrl-C to stop and remove the temporary subscription."),""].filter(k=>k!=="").join(`
|
|
395
|
+
`)+`
|
|
396
|
+
`);try{await g.ended}catch(k){throw a=!0,process.removeListener("SIGINT",S),process.removeListener("SIGTERM",S),c.close(),k}}s(dG,"runListen");var z_=require("fs/promises"),$a=K(require("chalk"));re();se();async function uG(e,t,r){if(r){let o;try{o=await(0,z_.readFile)(r,"utf8")}catch(n){throw new G(`Cannot read --payload-file ${r}.`,{code:"PAYLOAD_FILE_UNREADABLE",hint:"Pass a readable JSON file, e.g. --payload-file ./sample.json",cause:n})}try{return{payload:JSON.parse(o),source:"payload-file"}}catch(n){throw new G(`--payload-file ${r} is not valid JSON.`,{code:"PAYLOAD_FILE_INVALID_JSON",hint:"The sample payload must be a JSON document.",cause:n})}}try{let o=await e.send({method:"GET",path:"/v1/event-catalogue",scope:"events:read"}),i=(Array.isArray(o)?o:o.items??o.entries??[]).find(a=>a.eventType===t||a.name===t);if(i&&i.example!==void 0)return{payload:i.example,source:"catalogue-example"}}catch(o){F(o)}return{payload:{sample:!0,eventType:t,note:"generated by `np trigger` \u2014 register a catalogue example for a realistic payload"},source:"generated-sample"}}s(uG,"resolveTriggerPayload");async function pG(e,t){let r=await e.send({method:"POST",path:`/v1/channels/${encodeURIComponent(t.channelGid)}/messages`,body:{payload:t.payload,routingKey:t.eventType,metadata:{source:"np-trigger"}},scope:"messages:write"});return{messageGid:r.gid??r.messageGid??r.id}}s(pG,"fireTrigger");function B_(e,t){e.command("trigger").argument("<event-type>","event type to fire, e.g. order.confirmed").description("Fire a sample event of the given type for webhook-handler testing (pairs with `np listen`)").option("--channel <channel>","channel slug or GID to publish into","events").option("--app <appId>","app the channel slug resolves under (or NPAYLOAD_APP_ID)").option("--payload-file <path>","JSON file overriding the sample payload").action(async(r,o)=>{let n=await t.resolveKernel(),i=o.app??process.env.NPAYLOAD_APP_ID,a=await t.resolveChannelGid(n,o.channel,i),{payload:c,source:l}=await uG(n,r,o.payloadFile),{messageGid:d}=await pG(n,{channelGid:a,eventType:r,payload:c});console.log(`${$a.default.green("\u2714")} fired ${$a.default.bold(r)} on ${o.channel} ${$a.default.dim(`(payload: ${l}${d?`, message ${d}`:""})`)}`),console.log($a.default.dim(" Watching for it? `np listen --forward http://localhost:PORT/webhook`"))})}s(B_,"registerTrigger");qe();var ru=require("fs"),Uh=require("path"),bt=K(require("chalk"));qe();var H_=K(require("ajv"));Ai();var Dh="d6f97f724c494689c7307f26fa9081b55303f9d0c6f4b7b9523b2f4a26172cb3",Xd={$schema:"http://json-schema.org/draft-07/schema#",title:"ConnectConfig",type:"object",additionalProperties:!1,properties:{bridges:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{entityTypeSlug:{type:"string",maxLength:4096}}}}}};var K_="f4d5410c733e4c4a28858907bb7addc6d1fd34280961bdfb74cf0ac7a0a8419b",eu={$schema:"http://json-schema.org/draft-07/schema#",title:"PipesConfig",type:"object",additionalProperties:!1,properties:{credentials:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{connectorId:{type:"string",maxLength:4096},auth:{type:"object",properties:{type:{type:"string",maxLength:4096},nangoConnectionId:{type:"string",maxLength:4096},vaultSecretId:{type:"string",maxLength:4096},expiresAt:{type:"number"}},required:["type"],additionalProperties:!1}}}},governance:{type:"object",additionalProperties:!1,properties:{mode:{type:"string",enum:["open","allowlist","approval_required"]},allowedConnectors:{type:"array",items:{type:"string",maxLength:4096}},blockedConnectors:{type:"array",items:{type:"string",maxLength:4096}},allowedTiers:{type:"array",items:{type:"number"}},allowedCategories:{type:"array",items:{type:"string",maxLength:4096}},requireFirstUseApproval:{type:"boolean"},autoApproveInternalConnectors:{type:"boolean"},maxCredentialsPerConnector:{type:"number"},auditConfig:{type:"object",properties:{logAllActions:{type:"boolean"},logCredentialAccess:{type:"boolean"},retentionDays:{type:"number"}},required:["logAllActions","logCredentialAccess","retentionDays"],additionalProperties:!1}}},workflows:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{description:{type:"string",maxLength:4096},definition:{type:"object",properties:{nodes:{type:"array",items:{type:"object",properties:{id:{type:"string",maxLength:4096},type:{type:"string",maxLength:4096},position:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},required:["x","y"],additionalProperties:!1},data:{}},required:["id","type","position","data"],additionalProperties:!1}},edges:{type:"array",items:{type:"object",properties:{id:{type:"string",maxLength:4096},source:{type:"string",maxLength:4096},target:{type:"string",maxLength:4096},sourceHandle:{type:"string",maxLength:4096},targetHandle:{type:"string",maxLength:4096}},required:["id","source","target"],additionalProperties:!1}},viewport:{}},required:["nodes","edges"],additionalProperties:!1},triggerConfig:{type:"object",properties:{type:{type:"string",maxLength:4096},config:{type:"object",additionalProperties:{},propertyNames:{maxLength:256,not:{enum:["__proto__","constructor","prototype"]}}}},required:["type","config"],additionalProperties:!1},maxDurationMs:{type:"number"}}}}}};var Q_="41cca5221cf2d3f14ebe43426ffadbc50816dfa8db8d6325205687a732db66dc",Wn={$schema:"http://json-schema.org/draft-07/schema#",title:"PrimusConfig",type:"object",additionalProperties:!1,properties:{agents:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{name:{type:"string",maxLength:4096},description:{type:"string",maxLength:4096},systemPrompt:{type:"string",maxLength:4096},personality:{type:"string",maxLength:4096},language:{type:"string",maxLength:4096},skills:{type:"array",items:{type:"string",maxLength:4096}},isDiscoverable:{type:"boolean"},trustLevel:{type:"string",enum:["restricted","standard","elevated","admin"]},defaultModel:{type:"string",maxLength:4096},maxTurns:{type:"number"}},required:["name","systemPrompt"]}},skills:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{name:{type:"string",maxLength:4096},description:{type:"string",maxLength:4096},category:{type:"string",maxLength:4096},icon:{type:"string",maxLength:4096},executor:{type:"string",enum:["inline","webhook","dynamic_worker","container","gpu","openshell","cloud_run","fly_machines","k8s_jobs"]},definition:{type:"object",properties:{systemPrompt:{type:"string",maxLength:4096},tools:{type:"array",items:{type:"string",maxLength:4096}},examples:{type:"array",items:{type:"object",properties:{input:{type:"string",maxLength:4096},output:{type:"string",maxLength:4096}},required:["input","output"],additionalProperties:!1}},endpoint:{type:"string",maxLength:4096},containerImage:{type:"string",maxLength:4096}},additionalProperties:!1},limits:{type:"object",properties:{maxExecutionTime:{type:"number"},maxMemory:{type:"number"},maxCost:{type:"number"}},additionalProperties:!1},enabled:{type:"boolean"}},required:["name","description","executor","definition"]}},tools:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{name:{type:"string",maxLength:4096},description:{type:"string",maxLength:4096},parameters:{type:"object",additionalProperties:{},propertyNames:{maxLength:256,not:{enum:["__proto__","constructor","prototype"]}}},outputSchema:{type:"object",additionalProperties:{},propertyNames:{maxLength:256,not:{enum:["__proto__","constructor","prototype"]}}},riskLevel:{type:"string",enum:["safe","moderate","dangerous"]},requiresApproval:{type:"boolean"},endpoint:{type:"string",maxLength:4096},uri:{type:"string",maxLength:4096},authType:{type:"string",enum:["none","bearer","apiKey","basic","oauth","hmac"]},scopes:{type:"array",items:{type:"string",maxLength:4096}},executor:{type:"string",enum:["webhook","inline","dynamic_worker","container","gpu","openshell"]},timeout:{type:"number"},category:{type:"string",maxLength:4096},headers:{type:"object",additionalProperties:{type:"string",pattern:"^[^\\r\\n]*$",maxLength:4096},propertyNames:{pattern:"^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,128}$"}}},required:["description","riskLevel"]}},triggers:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{agentGid:{type:"string",maxLength:4096},name:{type:"string",maxLength:4096},description:{type:"string",maxLength:4096},type:{type:"string",maxLength:4096},config:{type:"object",properties:{cronExpression:{type:"string",maxLength:4096},eventType:{type:"string",maxLength:4096},webhookId:{type:"string",maxLength:4096},channel:{type:"string",maxLength:4096}},additionalProperties:!1},action:{type:"object",properties:{goal:{type:"string",maxLength:4096},skillIds:{type:"array",items:{type:"string",description:"skills id",maxLength:4096}},maxTurns:{type:"number"}},required:["goal"],additionalProperties:!1},conditions:{type:"array",items:{type:"object",properties:{field:{type:"string",maxLength:4096},operator:{type:"string",maxLength:4096},value:{oneOf:[{type:"string",maxLength:4096},{type:"number"},{type:"boolean"},{type:"null"}]}},required:["field","operator","value"],additionalProperties:!1}},enabled:{type:"boolean"}},required:["name","config","action"]}}}};aa();gt();function W_(e){let t=e.replace(/^\[|\]$/g,"").toLowerCase();if(t==="localhost"||t.endsWith(".localhost")||t.endsWith(".internal")||t.endsWith(".local")||t==="::1"||t==="::"||t.startsWith("fc")||t.startsWith("fd")||t.startsWith("fe8")||t.startsWith("fe9")||t.startsWith("fea")||t.startsWith("feb"))return!0;let r=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(t);if(!r)return!1;let[o,n]=[Number(r[1]),Number(r[2])];return o===10||o===127||o===0||o===169&&n===254||o===192&&n===168||o===172&&n>=16&&n<=31||o===100&&n>=64&&n<=127}s(W_,"isReservedHost");function mG(e,t={}){let r;try{r=new URL(e)}catch{return!1}return r.username||r.password?!1:t.allowInternal?r.protocol==="http:"||r.protocol==="https:":!(r.protocol!=="https:"||W_(r.hostname))}s(mG,"isSafeWebhookUrl");function fG(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol!=="https:"||W_(t.hostname)}s(fG,"isPlainOrReservedDoor");function tu(e={},t=process.env){if(e.strict===!0)return!1;if(e.allowInternalUrls===!0||t.NPAYLOAD_ALLOW_INTERNAL_URLS==="1")return!0;let r=te(t.NPAYLOAD_API_URL,"apiUrl");return r!==void 0&&fG(r)}s(tu,"resolveUrlPosture");function nu(e,t,r={}){let o=new H_.default({allErrors:!0,strict:!1});o.addFormat("npayload-safe-url",c=>mG(c,{allowInternal:r.allowInternalUrls??!1}));let n=o.compile(e);return n(t)?{ok:!0,issues:[]}:{ok:!1,issues:(n.errors??[]).map(c=>{let l=c.params??{},d=Object.keys(l).length?` (${JSON.stringify(l)})`:"";return{path:c.instancePath||"(root)",message:`${c.message??"invalid"}${d}`,..."allowedValues"in l?{allowed:l.allowedValues}:{}}})}}s(nu,"validateConfig");function Ca(e,t={}){return nu(Ri,e,t)}s(Ca,"validateEventsConfig");function Na(e,t={}){return nu(eu,e,t)}s(Na,"validatePipesConfig");function Gh(e,t={}){return nu(Xd,e,t)}s(Gh,"validateConnectConfig");var V_=/^[a-z][a-z0-9_]*$/;function La(e,t={}){let o=[...nu(Wn,e,t).issues],n=e??{};for(let a of["skills","tools"])for(let c of Object.keys(n[a]??{}))V_.test(c)||o.push({path:`/${a}/${c}`,message:`invalid ${a.slice(0,-1)} name "${c}" \u2014 must match ${String(V_)} (lowercase + digits + underscores; hyphens are rejected by the platform)`});let i=e??{};for(let a of sa()){let c=i[a];if(c)for(let[l,d]of Object.entries(c))for(let u of Kn(a)){let m=new Set(Object.keys(i[u.parent]??{})),p=po(Qn(d,u.path))??[];for(let f of p)m.has(f)||Ug(f)||o.push({path:`/${a}/${l}/${u.path}`,message:`${a} "${l}" references ${u.parent.slice(0,-1)} "${f}", which is not declared in this config's ${u.parent} map. If it exists live (created in the dashboard/CLI), run \`npayload wire\` to confirm it; otherwise declare it or fix the name.`})}}return{ok:o.length===0,issues:o}}s(La,"validatePrimusConfig");Ai();Un();Zt();mi();function J_(e){return ul(e).map(t=>({path:t.path,message:`raw secret-classified header "${t.header}" present in config \u2014 replace the literal value with a secret reference "{{ secrets.NAME }}"; \`np pull\` writes references, \`np push\` resolves them`}))}s(J_,"secretHeaderIssues");function Z_(e){e.command("validate").description("Validate a config against the contract (structure + security + relationships)").option("--config <path>","path to the config (default: the product's config)").option("--product <product>","which config to validate: events | primus | pipes","events").option("--allow-internal-urls","allow localhost / private webhook URLs (to test against your own receiver; never in production)").option("--strict","force the production security posture (reject internal/loopback URLs even on a dev machine)").action(async t=>{try{let r=t.product??"events",o=Ne();o&&lo(o.accessScopes);let n=tu({allowInternalUrls:t.allowInternalUrls,strict:t.strict});if(r==="primus"||r==="pipes"){let u=t.config??at(r);u||(process.stderr.write(bt.default.red(`no ${r}.config.ts found (pass --config).
|
|
397
|
+
`)),process.exit(1));let m=await pe(u),p=r==="primus"?La(m,{allowInternalUrls:n}):Na(m,{allowInternalUrls:n}),f=J_(m);p.ok&&f.length===0&&(process.stdout.write(bt.default.green.bold(`\u2713 ${r}.config is valid.
|
|
398
|
+
`)),process.exit(0));let g=[...p.issues,...f];process.stderr.write(bt.default.red.bold(`\u2717 ${r}.config has ${g.length} problem(s):
|
|
399
|
+
`));for(let h of g)process.stderr.write(` ${bt.default.yellow(h.path)} ${h.message}
|
|
400
|
+
`);process.exit(1)}let i=t.config??lt(),a=await pe(i),l=Ca(a,{allowInternalUrls:n}),d=J_(a);if(d.length>0&&(l.ok=!1,l.issues.push(...d)),l.ok){process.stdout.write(bt.default.green.bold(`\u2713 events.config is valid.
|
|
401
|
+
`));let u=(0,Uh.join)(process.cwd(),"npayload","_generated","contract.lock");if((0,ru.existsSync)(u))try{JSON.parse((0,ru.readFileSync)(u,"utf8")).hash!==ko&&process.stdout.write(bt.default.yellow(`! contract.lock was pinned against a different npayload contract \u2014 re-validate after upgrading.
|
|
402
|
+
`))}catch{process.stdout.write(bt.default.yellow("! contract.lock is unreadable \u2014 regenerate via `npayload init`.\n"))}let m=(0,Uh.join)(i,"..","permissions.generated.ts"),{projectAllPermissions:p}=await Promise.resolve().then(()=>(kd(),Yg)),{checkScopesDrift:f}=await Promise.resolve().then(()=>(ga(),xd)),g=f(await p(),m);!g.ok&&g.reason&&process.stdout.write(bt.default.yellow(`! ${g.reason}
|
|
403
|
+
`)),process.exit(0)}process.stderr.write(bt.default.red.bold(`\u2717 events.config has ${l.issues.length} problem(s):
|
|
404
|
+
`));for(let u of l.issues){let m=u.allowed?bt.default.dim(` allowed: ${JSON.stringify(u.allowed)}`):"";process.stderr.write(` ${bt.default.yellow(u.path)} ${u.message}${m}
|
|
405
|
+
`)}process.exit(1)}catch(r){let o=r instanceof Error?r.message:String(r);process.stderr.write(bt.default.red(`validate failed: ${o}
|
|
406
|
+
`)),process.exit(1)}})}s(Z_,"registerValidate");var Tn=require("fs"),Eo=require("path");Un();mn();var Y_=/^[A-Za-z_][A-Za-z0-9_]*$/;function Mh(e){return(0,Eo.join)(e,"npayload",".env")}s(Mh,"secretEnvPath");function gG(e,t,r){let o=`${t}="${r}"`,n=e.length>0?e.replace(/\r?\n$/,"").split(/\r?\n/):[],i=s(l=>{let d=l.trim().replace(/^export\s+/,""),u=d.indexOf("=");return u>0&&d.slice(0,u).trim()===t},"isName"),a=[],c=!1;for(let l of n){if(i(l)){c||a.push(o),c=!0;continue}a.push(l)}return c||a.push(o),{text:a.join(`
|
|
407
|
+
`)+`
|
|
408
|
+
`,replaced:c}}s(gG,"upsertDotenv");function ou(e){if(!Y_.test(e))throw new Y(`invalid secret name "${e}" \u2014 a name must match ${Y_.source} so a config can reference it as {{ secrets.NAME }}`)}s(ou,"assertSecretName");function hG(e,t,r){if(ou(t),r==="")throw new Y(`refusing to set ${t} to an empty value`);if(/[\r\n]/.test(r))throw new Y(`the value for ${t} spans several lines \u2014 a secret must be one line`);let o=Mh(e);(0,Tn.mkdirSync)((0,Eo.join)(e,"npayload"),{recursive:!0});let n=(0,Tn.existsSync)(o)?(0,Tn.readFileSync)(o,"utf8"):"",{text:i,replaced:a}=gG(n,t,r);return Ht(o,i),{path:o,replaced:a}}s(hG,"mintSecret");var jh="npayload/.env";function yG(e){let t=Mh(e);return(0,Tn.existsSync)(t)?Object.keys(Vo((0,Tn.readFileSync)(t,"utf8"))).sort():[]}s(yG,"listSecretNames");function vG(e,t){if(e.length===0)return{text:e,removed:!1};let r=/\r?\n$/.test(e),o=e.replace(/\r?\n$/,"").split(/\r?\n/),n=o.filter(i=>{let a=i.trim().replace(/^export\s+/,""),c=a.indexOf("=");return!(c>0&&a.slice(0,c).trim()===t)});return n.length===o.length?{text:e,removed:!1}:{text:n.length===0?"":n.join(`
|
|
409
|
+
`)+(r?`
|
|
410
|
+
`:""),removed:!0}}s(vG,"removeDotenvKey");function bG(e,t){ou(t);let r=Mh(e),o=(0,Tn.existsSync)(r)?(0,Tn.readFileSync)(r,"utf8"):"",{text:n,removed:i}=vG(o,t);if(!i)throw new Y(`no secret named ${t} \u2014 searched ${r}; \`np secret list\` shows the names it holds`);return Ht(r,n),{path:r}}s(bG,"deleteSecret");async function wG(e){if(!process.stdin.isTTY){let r=[];for await(let o of process.stdin)r.push(Buffer.isBuffer(o)?o:Buffer.from(String(o)));return Buffer.concat(r).toString("utf8").replace(/\r?\n$/,"")}let{password:t}=await import("@inquirer/prompts");return t({message:`Value for ${e}`,mask:!0})}s(wG,"readSecretValue");function X_(e,t){let r=e.command("secret").description("Manage local secret values referenced as {{ secrets.NAME }} in your config");r.command("set").argument("<NAME>","secret name, referenced in config as {{ secrets.NAME }}").description("Mint NAME into the git-ignored npayload/.env (value from stdin, or a masked prompt) so {{ secrets.NAME }} resolves on push / deploy").option("--project <dir>","project root (default: the current directory)").action(async(o,n)=>{try{let i=(0,Eo.resolve)(n.project??process.cwd());ou(o);let a=await(t.readSecret??wG)(o),{replaced:c}=hG(i,o,a);t.print({secret:o,file:"npayload/.env",action:c?"replaced":"set",reference:`{{ secrets.${o} }}`})}catch(i){t.printError(i instanceof Error?i.message:String(i)),process.exitCode=1}}),r.command("list").description("List the secrets in the git-ignored npayload/.env by name, each with its {{ secrets.NAME }} reference (values are never shown)").option("--project <dir>","project root (default: the current directory)").action(o=>{try{let n=(0,Eo.resolve)(o.project??process.cwd());t.print({file:jh,secrets:yG(n).map(i=>({name:i,reference:`{{ secrets.${i} }}`}))})}catch(n){t.printError(n instanceof Error?n.message:String(n)),process.exitCode=1}}),r.command("delete").argument("<NAME>","secret name to remove from npayload/.env").description("Delete NAME from the git-ignored npayload/.env; {{ secrets.NAME }} stops resolving from that file").option("--project <dir>","project root (default: the current directory)").option("--yes","delete without asking for confirmation").action(async(o,n)=>{try{let i=(0,Eo.resolve)(n.project??process.cwd());if(ou(o),!n.yes&&!await(t.confirm??(async()=>!1))(`Delete the secret ${o} from ${jh}? Its value cannot be recovered.`)){t.printError(`kept ${o}: nothing was deleted (pass --yes to delete without asking)`),process.exitCode=1;return}bG(i,o),t.print({secret:o,file:jh,action:"deleted"})}catch(i){t.printError(i instanceof Error?i.message:String(i)),process.exitCode=1}})}s(X_,"registerSecret");re();var kG={env:"the NPAYLOAD_CLIENT_ID environment variable",env_token:"the NPAYLOAD_TOKEN environment variable",project:"this project's .npayload.json",keychain:"np login (your OS keychain)"};async function EG(e){let{clientId:t,source:r}=await e.credential(),o=await e.token();return{clientId:t,signedInWith:kG[r],scopes:[...o.scopes].sort(),expiresAt:new Date(o.expiresAt).toISOString()}}s(EG,"readAuthStatus");function eR(e,t){mh(e).command("status").description("Show the client the CLI signs in as, where it was found, its scopes and when its token expires (no secret, token or key is ever shown)").action(async()=>{try{t.print(await EG(t))}catch(r){t.printError(Ce(r instanceof Error?r.message:String(r),r)),process.exitCode=ur(r)}})}s(eR,"registerAuth");var jt=require("fs"),Ut=require("path"),Jn=K(require("chalk"));Qg();qe();var nR=["contract.lock","events.d.ts"];function SG(){return{appName:"",appSlug:"",appId:"",appType:"internal",framework:"none",clientId:"",hmacSecret:""}}s(SG,"stubContext");async function rR(e){let t=(0,Ut.resolve)(e),o=(await pe(t)).eventTypes,n=o?Object.values(o).filter(i=>i?.schema?.definition).length:0;return{dir:(0,Ut.join)((0,Ut.dirname)(t),"_generated"),files:{"contract.lock":Vs(SG()),"events.d.ts":n>0&&o?Kg(o):null}}}s(rR,"renderGeneratedLayer");async function PG(e){let{dir:t,files:r}=await rR(e);(0,jt.mkdirSync)(t,{recursive:!0});let o=[],n=[];for(let i of nR){let a=(0,Ut.join)(t,i),c=r[i];if(c===null){(0,jt.existsSync)(a)&&((0,jt.rmSync)(a),n.push(i));continue}(0,jt.writeFileSync)(a,c,"utf8"),o.push(i)}return{dir:t,written:o,removed:n}}s(PG,"runGenerate");async function IG(e){let{dir:t,files:r}=await rR(e),o=[];for(let n of nR){let i=(0,Ut.join)(t,n),a=r[n],c=(0,jt.existsSync)(i);if(a===null){c&&o.push({file:n,why:"present, but the pin produces no such file"});continue}c?(0,jt.readFileSync)(i,"utf8")!==a&&o.push({file:n,why:"differs from the pinned projection"}):o.push({file:n,why:"missing"})}return{dir:t,drifted:o}}s(IG,"runCheck");function tR(e){let t=e?(0,Ut.resolve)(e):lt();if(!(0,jt.existsSync)(t))throw new Error(`no events config found at ${t} \u2014 run \`npayload init\` first, or pass --config <path>.`);return t}s(tR,"resolveConfig");function oR(e,t){e.command("generate").description("Regenerate _generated/ (contract.lock + events.d.ts) from the pinned contract (strict, never hand-edited)").option("--config <path>","path to events.config.ts (default: npayload/events.config.ts)").action(async r=>{try{let{dir:o,written:n,removed:i}=await PG(tR(r.config)),a=[...n.map(c=>` ${Jn.default.green("regenerated")} ${(0,Ut.join)(o,c)}`),...i.map(c=>` ${Jn.default.yellow("removed")} ${(0,Ut.join)(o,c)} (the pin produces no such file)`)];t.print(`${a.join(`
|
|
411
|
+
`)}
|
|
412
|
+
${Jn.default.green.bold("\u2713 _generated/ regenerated from the pinned contract.")}`)}catch(o){t.printError(Jn.default.red(o instanceof Error?o.message:String(o))),process.exitCode=1}}),e.command("check").description("Fail if the committed _generated/ differs from what the pinned contract would produce (drift gate)").option("--config <path>","path to events.config.ts (default: npayload/events.config.ts)").action(async r=>{try{let{dir:o,drifted:n}=await IG(tR(r.config));if(n.length>0){t.printError(Jn.default.red(`\u2717 _generated/ drifted from the pin (${n.length}):
|
|
413
|
+
`)+n.map(i=>` - ${(0,Ut.join)(o,i.file)}: ${i.why}`).join(`
|
|
414
|
+
`)+Jn.default.dim("\n\nRun `npayload generate` to restore the pinned projection, then commit.")),process.exitCode=1;return}t.print(Jn.default.green.bold("\u2713 _generated/ matches the pinned contract \u2014 no drift."))}catch(o){t.printError(Jn.default.red(o instanceof Error?o.message:String(o))),process.exitCode=1}})}s(oR,"registerGenerate");var zE=require("fs"),NO=require("path");var C={};me(C,{$brand:()=>iu,$input:()=>Yb,$output:()=>Zb,NEVER:()=>qh,TimePrecision:()=>nw,ZodAny:()=>Kk,ZodArray:()=>Wk,ZodBase64:()=>Rp,ZodBase64URL:()=>Ap,ZodBigInt:()=>ss,ZodBigIntFormat:()=>Cp,ZodBoolean:()=>is,ZodCIDRv4:()=>xp,ZodCIDRv6:()=>_p,ZodCUID:()=>wp,ZodCUID2:()=>kp,ZodCatch:()=>yE,ZodCodec:()=>qp,ZodCustom:()=>hc,ZodCustomStringFormat:()=>rs,ZodDate:()=>uc,ZodDefault:()=>uE,ZodDiscriminatedUnion:()=>Zk,ZodE164:()=>Op,ZodEmail:()=>yp,ZodEmoji:()=>vp,ZodEnum:()=>ts,ZodError:()=>Xj,ZodExactOptional:()=>cE,ZodFile:()=>sE,ZodFirstPartyTypeKind:()=>RE,ZodFunction:()=>TE,ZodGUID:()=>sc,ZodIPv4:()=>Ip,ZodIPv6:()=>Tp,ZodISODate:()=>up,ZodISODateTime:()=>dp,ZodISODuration:()=>mp,ZodISOTime:()=>pp,ZodIntersection:()=>Yk,ZodIssueCode:()=>tM,ZodJWT:()=>$p,ZodKSUID:()=>Pp,ZodLazy:()=>SE,ZodLiteral:()=>iE,ZodMAC:()=>Uk,ZodMap:()=>rE,ZodNaN:()=>bE,ZodNanoID:()=>bp,ZodNever:()=>Vk,ZodNonOptional:()=>jp,ZodNull:()=>zk,ZodNullable:()=>dE,ZodNumber:()=>os,ZodNumberFormat:()=>Ao,ZodObject:()=>mc,ZodOptional:()=>Up,ZodPipe:()=>Mp,ZodPrefault:()=>mE,ZodPromise:()=>IE,ZodReadonly:()=>wE,ZodRealError:()=>mt,ZodRecord:()=>gc,ZodSet:()=>oE,ZodString:()=>ns,ZodStringFormat:()=>ce,ZodSuccess:()=>hE,ZodSymbol:()=>qk,ZodTemplateLiteral:()=>EE,ZodTransform:()=>aE,ZodTuple:()=>eE,ZodType:()=>X,ZodULID:()=>Ep,ZodURL:()=>dc,ZodUUID:()=>An,ZodUndefined:()=>Fk,ZodUnion:()=>fc,ZodUnknown:()=>Qk,ZodVoid:()=>Hk,ZodXID:()=>Sp,ZodXor:()=>Jk,_ZodString:()=>hp,_default:()=>pE,_function:()=>KA,any:()=>SA,array:()=>pc,base64:()=>sA,base64url:()=>aA,bigint:()=>vA,boolean:()=>Mk,catch:()=>vE,check:()=>QA,cidrv4:()=>oA,cidrv6:()=>iA,clone:()=>et,codec:()=>FA,coerce:()=>AE,config:()=>ke,core:()=>Xn,cuid:()=>JR,cuid2:()=>ZR,custom:()=>VA,date:()=>IA,decode:()=>Ok,decodeAsync:()=>Ck,describe:()=>HA,discriminatedUnion:()=>OA,e164:()=>cA,email:()=>MR,emoji:()=>HR,encode:()=>Ak,encodeAsync:()=>$k,endsWith:()=>Ki,enum:()=>Dp,exactOptional:()=>lE,file:()=>UA,flattenError:()=>Ba,float32:()=>fA,float64:()=>gA,formatError:()=>Ka,fromJSONSchema:()=>tO,function:()=>KA,getErrorMap:()=>rM,globalRegistry:()=>Fe,gt:()=>_n,gte:()=>tt,guid:()=>qR,hash:()=>mA,hex:()=>pA,hostname:()=>uA,httpUrl:()=>VR,includes:()=>zi,instanceof:()=>JA,int:()=>gp,int32:()=>hA,int64:()=>bA,intersection:()=>Xk,ipv4:()=>tA,ipv6:()=>rA,iso:()=>es,json:()=>YA,jwt:()=>lA,keyof:()=>TA,ksuid:()=>eA,lazy:()=>PE,length:()=>_o,literal:()=>GA,locales:()=>nc,looseObject:()=>RA,looseRecord:()=>CA,lowercase:()=>qi,lt:()=>xn,lte:()=>kt,mac:()=>nA,map:()=>NA,maxLength:()=>xo,maxSize:()=>Or,meta:()=>WA,mime:()=>Qi,minLength:()=>Yn,minSize:()=>Rn,multipleOf:()=>Ar,nan:()=>qA,nanoid:()=>WR,nativeEnum:()=>DA,negative:()=>ep,never:()=>Np,nonnegative:()=>np,nonoptional:()=>gE,nonpositive:()=>tp,normalize:()=>Vi,null:()=>Bk,nullable:()=>cc,nullish:()=>jA,number:()=>jk,object:()=>xA,optional:()=>ac,overwrite:()=>nn,parse:()=>Tk,parseAsync:()=>xk,partialRecord:()=>$A,pipe:()=>lc,positive:()=>Xu,prefault:()=>fE,preprocess:()=>XA,prettifyError:()=>Xh,promise:()=>BA,property:()=>rp,readonly:()=>kE,record:()=>nE,refine:()=>xE,regex:()=>Mi,regexes:()=>qt,registry:()=>$u,safeDecode:()=>Lk,safeDecodeAsync:()=>Gk,safeEncode:()=>Nk,safeEncodeAsync:()=>Dk,safeParse:()=>_k,safeParseAsync:()=>Rk,set:()=>LA,setErrorMap:()=>nM,size:()=>To,slugify:()=>Zi,startsWith:()=>Bi,strictObject:()=>_A,string:()=>fp,stringFormat:()=>dA,stringbool:()=>ZA,success:()=>MA,superRefine:()=>_E,symbol:()=>kA,templateLiteral:()=>zA,toJSONSchema:()=>ap,toLowerCase:()=>Wi,toUpperCase:()=>Ji,transform:()=>Gp,treeifyError:()=>Yh,trim:()=>Hi,tuple:()=>tE,uint32:()=>yA,uint64:()=>wA,ulid:()=>YR,undefined:()=>EA,union:()=>Lp,unknown:()=>Ro,uppercase:()=>Fi,url:()=>QR,util:()=>N,uuid:()=>FR,uuidv4:()=>zR,uuidv6:()=>BR,uuidv7:()=>KR,void:()=>PA,xid:()=>XR,xor:()=>AA});var Xn={};me(Xn,{$ZodAny:()=>xv,$ZodArray:()=>$v,$ZodAsyncError:()=>tn,$ZodBase64:()=>yv,$ZodBase64URL:()=>vv,$ZodBigInt:()=>_u,$ZodBigIntFormat:()=>Sv,$ZodBoolean:()=>Wa,$ZodCIDRv4:()=>fv,$ZodCIDRv6:()=>gv,$ZodCUID:()=>nv,$ZodCUID2:()=>rv,$ZodCatch:()=>Jv,$ZodCheck:()=>ue,$ZodCheckBigIntFormat:()=>$y,$ZodCheckEndsWith:()=>By,$ZodCheckGreaterThan:()=>ku,$ZodCheckIncludes:()=>Fy,$ZodCheckLengthEquals:()=>Uy,$ZodCheckLessThan:()=>wu,$ZodCheckLowerCase:()=>My,$ZodCheckMaxLength:()=>Dy,$ZodCheckMaxSize:()=>Cy,$ZodCheckMimeType:()=>Qy,$ZodCheckMinLength:()=>Gy,$ZodCheckMinSize:()=>Ny,$ZodCheckMultipleOf:()=>Ay,$ZodCheckNumberFormat:()=>Oy,$ZodCheckOverwrite:()=>Vy,$ZodCheckProperty:()=>Ky,$ZodCheckRegex:()=>jy,$ZodCheckSizeEquals:()=>Ly,$ZodCheckStartsWith:()=>zy,$ZodCheckStringFormat:()=>Ui,$ZodCheckUpperCase:()=>qy,$ZodCodec:()=>Za,$ZodCustom:()=>ob,$ZodCustomStringFormat:()=>kv,$ZodDate:()=>Ov,$ZodDefault:()=>Qv,$ZodDiscriminatedUnion:()=>Lv,$ZodE164:()=>bv,$ZodEmail:()=>Yy,$ZodEmoji:()=>ev,$ZodEncodeError:()=>Ir,$ZodEnum:()=>Mv,$ZodError:()=>za,$ZodExactOptional:()=>Bv,$ZodFile:()=>Fv,$ZodFunction:()=>tb,$ZodGUID:()=>Jy,$ZodIPv4:()=>uv,$ZodIPv6:()=>pv,$ZodISODate:()=>cv,$ZodISODateTime:()=>av,$ZodISODuration:()=>dv,$ZodISOTime:()=>lv,$ZodIntersection:()=>Dv,$ZodJWT:()=>wv,$ZodKSUID:()=>sv,$ZodLazy:()=>rb,$ZodLiteral:()=>qv,$ZodMAC:()=>mv,$ZodMap:()=>Uv,$ZodNaN:()=>Zv,$ZodNanoID:()=>tv,$ZodNever:()=>Rv,$ZodNonOptional:()=>Hv,$ZodNull:()=>Tv,$ZodNullable:()=>Kv,$ZodNumber:()=>xu,$ZodNumberFormat:()=>Ev,$ZodObject:()=>OR,$ZodObjectJIT:()=>Cv,$ZodOptional:()=>Au,$ZodPipe:()=>Yv,$ZodPrefault:()=>Vv,$ZodPromise:()=>nb,$ZodReadonly:()=>Xv,$ZodRealError:()=>pt,$ZodRecord:()=>Gv,$ZodRegistry:()=>Ou,$ZodSet:()=>jv,$ZodString:()=>Io,$ZodStringFormat:()=>ae,$ZodSuccess:()=>Wv,$ZodSymbol:()=>Pv,$ZodTemplateLiteral:()=>eb,$ZodTransform:()=>zv,$ZodTuple:()=>Ru,$ZodType:()=>Q,$ZodULID:()=>ov,$ZodURL:()=>Xy,$ZodUUID:()=>Zy,$ZodUndefined:()=>Iv,$ZodUnion:()=>Ja,$ZodUnknown:()=>_v,$ZodVoid:()=>Av,$ZodXID:()=>iv,$ZodXor:()=>Nv,$brand:()=>iu,$constructor:()=>b,$input:()=>Yb,$output:()=>Zb,Doc:()=>Ha,JSONSchema:()=>UR,JSONSchemaGenerator:()=>cp,NEVER:()=>qh,TimePrecision:()=>nw,_any:()=>Sw,_array:()=>Aw,_base64:()=>Wu,_base64url:()=>Ju,_bigint:()=>hw,_boolean:()=>fw,_catch:()=>Kj,_check:()=>GR,_cidrv4:()=>Vu,_cidrv6:()=>Hu,_coercedBigint:()=>yw,_coercedBoolean:()=>gw,_coercedDate:()=>_w,_coercedNumber:()=>cw,_coercedString:()=>ew,_cuid:()=>Mu,_cuid2:()=>qu,_custom:()=>$w,_date:()=>xw,_decode:()=>uu,_decodeAsync:()=>mu,_default:()=>Fj,_discriminatedUnion:()=>Aj,_e164:()=>Zu,_email:()=>Cu,_emoji:()=>Uu,_encode:()=>du,_encodeAsync:()=>pu,_endsWith:()=>Ki,_enum:()=>Dj,_file:()=>Ow,_float32:()=>dw,_float64:()=>uw,_gt:()=>_n,_gte:()=>tt,_guid:()=>rc,_includes:()=>zi,_int:()=>lw,_int32:()=>pw,_int64:()=>vw,_intersection:()=>Oj,_ipv4:()=>Ku,_ipv6:()=>Qu,_isoDate:()=>ow,_isoDateTime:()=>rw,_isoDuration:()=>sw,_isoTime:()=>iw,_jwt:()=>Yu,_ksuid:()=>Bu,_lazy:()=>Wj,_length:()=>_o,_literal:()=>Uj,_lowercase:()=>qi,_lt:()=>xn,_lte:()=>kt,_mac:()=>tw,_map:()=>Nj,_max:()=>kt,_maxLength:()=>xo,_maxSize:()=>Or,_mime:()=>Qi,_min:()=>tt,_minLength:()=>Yn,_minSize:()=>Rn,_multipleOf:()=>Ar,_nan:()=>Rw,_nanoid:()=>ju,_nativeEnum:()=>Gj,_negative:()=>ep,_never:()=>Iw,_nonnegative:()=>np,_nonoptional:()=>zj,_nonpositive:()=>tp,_normalize:()=>Vi,_null:()=>Ew,_nullable:()=>qj,_number:()=>aw,_optional:()=>Mj,_overwrite:()=>nn,_parse:()=>Ni,_parseAsync:()=>Li,_pipe:()=>Qj,_positive:()=>Xu,_promise:()=>Jj,_property:()=>rp,_readonly:()=>Vj,_record:()=>Cj,_refine:()=>Cw,_regex:()=>Mi,_safeDecode:()=>gu,_safeDecodeAsync:()=>yu,_safeEncode:()=>fu,_safeEncodeAsync:()=>hu,_safeParse:()=>Di,_safeParseAsync:()=>Gi,_set:()=>Lj,_size:()=>To,_slugify:()=>Zi,_startsWith:()=>Bi,_string:()=>Xb,_stringFormat:()=>Yi,_stringbool:()=>Gw,_success:()=>Bj,_superRefine:()=>Nw,_symbol:()=>ww,_templateLiteral:()=>Hj,_toLowerCase:()=>Wi,_toUpperCase:()=>Ji,_transform:()=>jj,_trim:()=>Hi,_tuple:()=>$j,_uint32:()=>mw,_uint64:()=>bw,_ulid:()=>Fu,_undefined:()=>kw,_union:()=>_j,_unknown:()=>Pw,_uppercase:()=>Fi,_url:()=>oc,_uuid:()=>Nu,_uuidv4:()=>Lu,_uuidv6:()=>Du,_uuidv7:()=>Gu,_void:()=>Tw,_xid:()=>zu,_xor:()=>Rj,clone:()=>et,config:()=>ke,createStandardJSONSchemaMethod:()=>Xi,createToJSONSchemaMethod:()=>Uw,decode:()=>XG,decodeAsync:()=>tU,describe:()=>Lw,encode:()=>YG,encodeAsync:()=>eU,extractDefs:()=>Cr,finalize:()=>Nr,flattenError:()=>Ba,formatError:()=>Ka,globalConfig:()=>Da,globalRegistry:()=>Fe,initializeContext:()=>$r,isValidBase64:()=>hv,isValidBase64URL:()=>xR,isValidJWT:()=>_R,locales:()=>nc,meta:()=>Dw,parse:()=>cu,parseAsync:()=>lu,prettifyError:()=>Xh,process:()=>oe,regexes:()=>qt,registry:()=>$u,safeDecode:()=>rU,safeDecodeAsync:()=>iU,safeEncode:()=>nU,safeEncodeAsync:()=>oU,safeParse:()=>ey,safeParseAsync:()=>ty,toDotPath:()=>lR,toJSONSchema:()=>ap,treeifyError:()=>Yh,util:()=>N,version:()=>Hy});var qh=Object.freeze({status:"aborted"});function b(e,t,r){function o(c,l){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:l,constr:a,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,l);let d=a.prototype,u=Object.keys(d);for(let m=0;m<u.length;m++){let p=u[m];p in c||(c[p]=d[p].bind(c))}}s(o,"init");let n=r?.Parent??Object;class i extends n{static{s(this,"Definition")}}Object.defineProperty(i,"name",{value:e});function a(c){var l;let d=r?.Parent?new i:this;o(d,c),(l=d._zod).deferred??(l.deferred=[]);for(let u of d._zod.deferred)u();return d}return s(a,"_"),Object.defineProperty(a,"init",{value:o}),Object.defineProperty(a,Symbol.hasInstance,{value:s(c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e),"value")}),Object.defineProperty(a,"name",{value:e}),a}s(b,"$constructor");var iu=Symbol("zod_brand"),tn=class extends Error{static{s(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ir=class extends Error{static{s(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},Da={};function ke(e){return e&&Object.assign(Da,e),Da}s(ke,"config");var N={};me(N,{BIGINT_FORMAT_RANGES:()=>Zh,Class:()=>zh,NUMBER_FORMAT_RANGES:()=>Jh,aborted:()=>Rr,allowsEval:()=>Qh,assert:()=>AG,assertEqual:()=>TG,assertIs:()=>_G,assertNever:()=>RG,assertNotEqual:()=>xG,assignProp:()=>xr,base64ToUint8Array:()=>sR,base64urlToUint8Array:()=>VG,cached:()=>$i,captureStackTrace:()=>au,cleanEnum:()=>QG,cleanRegex:()=>ja,clone:()=>et,cloneDef:()=>$G,createTransparentProxy:()=>UG,defineLazy:()=>ee,esc:()=>su,escapeRegex:()=>Mt,extend:()=>qG,finalizeIssue:()=>ut,floatSafeRemainder:()=>Bh,getElementAtPath:()=>CG,getEnumValues:()=>Ua,getLengthableOrigin:()=>Fa,getParsedType:()=>GG,getSizableOrigin:()=>qa,hexToUint8Array:()=>WG,isObject:()=>So,isPlainObject:()=>_r,issue:()=>Ci,joinValues:()=>E,jsonStringifyReplacer:()=>Oi,merge:()=>zG,mergeDefs:()=>Zn,normalizeParams:()=>L,nullish:()=>Tr,numKeys:()=>DG,objectClone:()=>OG,omit:()=>MG,optionalKeys:()=>Wh,parsedType:()=>$,partial:()=>BG,pick:()=>jG,prefixIssues:()=>wt,primitiveTypes:()=>Hh,promiseAllObject:()=>NG,propertyKeyTypes:()=>Ma,randomString:()=>LG,required:()=>KG,safeExtend:()=>FG,shallowClone:()=>Vh,slugify:()=>Kh,stringifyPrimitive:()=>O,uint8ArrayToBase64:()=>aR,uint8ArrayToBase64url:()=>HG,uint8ArrayToHex:()=>JG,unwrapMessage:()=>Ga});function TG(e){return e}s(TG,"assertEqual");function xG(e){return e}s(xG,"assertNotEqual");function _G(e){}s(_G,"assertIs");function RG(e){throw new Error("Unexpected value in exhaustive check")}s(RG,"assertNever");function AG(e){}s(AG,"assert");function Ua(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}s(Ua,"getEnumValues");function E(e,t="|"){return e.map(r=>O(r)).join(t)}s(E,"joinValues");function Oi(e,t){return typeof t=="bigint"?t.toString():t}s(Oi,"jsonStringifyReplacer");function $i(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}s($i,"cached");function Tr(e){return e==null}s(Tr,"nullish");function ja(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}s(ja,"cleanRegex");function Bh(e,t){let r=(e.toString().split(".")[1]||"").length,o=t.toString(),n=(o.split(".")[1]||"").length;if(n===0&&/\d?e-\d?/.test(o)){let l=o.match(/\d?e-(\d?)/);l?.[1]&&(n=Number.parseInt(l[1]))}let i=r>n?r:n,a=Number.parseInt(e.toFixed(i).replace(".","")),c=Number.parseInt(t.toFixed(i).replace(".",""));return a%c/10**i}s(Bh,"floatSafeRemainder");var iR=Symbol("evaluating");function ee(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==iR)return o===void 0&&(o=iR,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}s(ee,"defineLazy");function OG(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}s(OG,"objectClone");function xr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}s(xr,"assignProp");function Zn(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}s(Zn,"mergeDefs");function $G(e){return Zn(e._zod.def)}s($G,"cloneDef");function CG(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}s(CG,"getElementAtPath");function NG(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let i=0;i<t.length;i++)n[t[i]]=o[i];return n})}s(NG,"promiseAllObject");function LG(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}s(LG,"randomString");function su(e){return JSON.stringify(e)}s(su,"esc");function Kh(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}s(Kh,"slugify");var au="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function So(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(So,"isObject");var Qh=$i(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function _r(e){if(So(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(So(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}s(_r,"isPlainObject");function Vh(e){return _r(e)?{...e}:Array.isArray(e)?[...e]:e}s(Vh,"shallowClone");function DG(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}s(DG,"numKeys");var GG=s(e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},"getParsedType"),Ma=new Set(["string","number","symbol"]),Hh=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Mt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}s(Mt,"escapeRegex");function et(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}s(et,"clone");function L(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:s(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:s(()=>t.error,"error")}:t}s(L,"normalizeParams");function UG(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,i){return t??(t=e()),Reflect.set(t,o,n,i)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}s(UG,"createTransparentProxy");function O(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}s(O,"stringifyPrimitive");function Wh(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}s(Wh,"optionalKeys");var Jh={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Zh={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function jG(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=Zn(e._zod.def,{get shape(){let a={};for(let c in t){if(!(c in r.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&(a[c]=r.shape[c])}return xr(this,"shape",a),a},checks:[]});return et(e,i)}s(jG,"pick");function MG(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=Zn(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let c in t){if(!(c in r.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&delete a[c]}return xr(this,"shape",a),a},checks:[]});return et(e,i)}s(MG,"omit");function qG(e,t){if(!_r(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=Zn(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return xr(this,"shape",i),i}});return et(e,n)}s(qG,"extend");function FG(e,t){if(!_r(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Zn(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return xr(this,"shape",o),o}});return et(e,r)}s(FG,"safeExtend");function zG(e,t){let r=Zn(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return xr(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return et(e,r)}s(zG,"merge");function BG(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Zn(t._zod.def,{get shape(){let c=t._zod.def.shape,l={...c};if(r)for(let d in r){if(!(d in c))throw new Error(`Unrecognized key: "${d}"`);r[d]&&(l[d]=e?new e({type:"optional",innerType:c[d]}):c[d])}else for(let d in c)l[d]=e?new e({type:"optional",innerType:c[d]}):c[d];return xr(this,"shape",l),l},checks:[]});return et(t,a)}s(BG,"partial");function KG(e,t,r){let o=Zn(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:n[a]}))}else for(let a in n)i[a]=new e({type:"nonoptional",innerType:n[a]});return xr(this,"shape",i),i}});return et(t,o)}s(KG,"required");function Rr(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}s(Rr,"aborted");function wt(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}s(wt,"prefixIssues");function Ga(e){return typeof e=="string"?e:e?.message}s(Ga,"unwrapMessage");function ut(e,t,r){let o={...e,path:e.path??[]};if(!e.message){let n=Ga(e.inst?._zod.def?.error?.(e))??Ga(t?.error?.(e))??Ga(r.customError?.(e))??Ga(r.localeError?.(e))??"Invalid input";o.message=n}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}s(ut,"finalizeIssue");function qa(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}s(qa,"getSizableOrigin");function Fa(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}s(Fa,"getLengthableOrigin");function $(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}s($,"parsedType");function Ci(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}s(Ci,"issue");function QG(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}s(QG,"cleanEnum");function sR(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}s(sR,"base64ToUint8Array");function aR(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}s(aR,"uint8ArrayToBase64");function VG(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return sR(t+r)}s(VG,"base64urlToUint8Array");function HG(e){return aR(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}s(HG,"uint8ArrayToBase64url");function WG(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}s(WG,"hexToUint8Array");function JG(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}s(JG,"uint8ArrayToHex");var zh=class{static{s(this,"Class")}constructor(...t){}};var cR=s((e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Oi,2),Object.defineProperty(e,"toString",{value:s(()=>e.message,"value"),enumerable:!1})},"initializer"),za=b("$ZodError",cR),pt=b("$ZodError",cR,{Parent:Error});function Ba(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):o.push(t(n));return{formErrors:o,fieldErrors:r}}s(Ba,"flattenError");function Ka(e,t=r=>r.message){let r={_errors:[]},o=s(n=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let a=r,c=0;for(;c<i.path.length;){let l=i.path[c];c===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(t(i))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}},"processError");return o(e),r}s(Ka,"formatError");function Yh(e,t=r=>r.message){let r={errors:[]},o=s((n,i=[])=>{var a,c;for(let l of n.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(d=>o({issues:d},l.path));else if(l.code==="invalid_key")o({issues:l.issues},l.path);else if(l.code==="invalid_element")o({issues:l.issues},l.path);else{let d=[...i,...l.path];if(d.length===0){r.errors.push(t(l));continue}let u=r,m=0;for(;m<d.length;){let p=d[m],f=m===d.length-1;typeof p=="string"?(u.properties??(u.properties={}),(a=u.properties)[p]??(a[p]={errors:[]}),u=u.properties[p]):(u.items??(u.items=[]),(c=u.items)[p]??(c[p]={errors:[]}),u=u.items[p]),f&&u.errors.push(t(l)),m++}}},"processError");return o(e),r}s(Yh,"treeifyError");function lR(e){let t=[],r=e.map(o=>typeof o=="object"?o.key:o);for(let o of r)typeof o=="number"?t.push(`[${o}]`):typeof o=="symbol"?t.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?t.push(`[${JSON.stringify(o)}]`):(t.length&&t.push("."),t.push(o));return t.join("")}s(lR,"toDotPath");function Xh(e){let t=[],r=[...e.issues].sort((o,n)=>(o.path??[]).length-(n.path??[]).length);for(let o of r)t.push(`\u2716 ${o.message}`),o.path?.length&&t.push(` \u2192 at ${lR(o.path)}`);return t.join(`
|
|
415
|
+
`)}s(Xh,"prettifyError");var Ni=s(e=>(t,r,o,n)=>{let i=o?Object.assign(o,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new tn;if(a.issues.length){let c=new(n?.Err??e)(a.issues.map(l=>ut(l,i,ke())));throw au(c,n?.callee),c}return a.value},"_parse"),cu=Ni(pt),Li=s(e=>async(t,r,o,n)=>{let i=o?Object.assign(o,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(n?.Err??e)(a.issues.map(l=>ut(l,i,ke())));throw au(c,n?.callee),c}return a.value},"_parseAsync"),lu=Li(pt),Di=s(e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new tn;return i.issues.length?{success:!1,error:new(e??za)(i.issues.map(a=>ut(a,n,ke())))}:{success:!0,data:i.value}},"_safeParse"),ey=Di(pt),Gi=s(e=>async(t,r,o)=>{let n=o?Object.assign(o,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},n);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>ut(a,n,ke())))}:{success:!0,data:i.value}},"_safeParseAsync"),ty=Gi(pt),du=s(e=>(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Ni(e)(t,r,n)},"_encode"),YG=du(pt),uu=s(e=>(t,r,o)=>Ni(e)(t,r,o),"_decode"),XG=uu(pt),pu=s(e=>async(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Li(e)(t,r,n)},"_encodeAsync"),eU=pu(pt),mu=s(e=>async(t,r,o)=>Li(e)(t,r,o),"_decodeAsync"),tU=mu(pt),fu=s(e=>(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Di(e)(t,r,n)},"_safeEncode"),nU=fu(pt),gu=s(e=>(t,r,o)=>Di(e)(t,r,o),"_safeDecode"),rU=gu(pt),hu=s(e=>async(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Gi(e)(t,r,n)},"_safeEncodeAsync"),oU=hu(pt),yu=s(e=>async(t,r,o)=>Gi(e)(t,r,o),"_safeDecodeAsync"),iU=yu(pt);var qt={};me(qt,{base64:()=>yy,base64url:()=>vu,bigint:()=>Sy,boolean:()=>Iy,browserEmail:()=>mU,cidrv4:()=>gy,cidrv6:()=>hy,cuid:()=>ny,cuid2:()=>ry,date:()=>by,datetime:()=>ky,domain:()=>hU,duration:()=>cy,e164:()=>vy,email:()=>dy,emoji:()=>uy,extendedDuration:()=>sU,guid:()=>ly,hex:()=>yU,hostname:()=>gU,html5Email:()=>dU,idnEmail:()=>pU,integer:()=>Py,ipv4:()=>py,ipv6:()=>my,ksuid:()=>sy,lowercase:()=>_y,mac:()=>fy,md5_base64:()=>bU,md5_base64url:()=>wU,md5_hex:()=>vU,nanoid:()=>ay,null:()=>Ty,number:()=>bu,rfc5322Email:()=>uU,sha1_base64:()=>EU,sha1_base64url:()=>SU,sha1_hex:()=>kU,sha256_base64:()=>IU,sha256_base64url:()=>TU,sha256_hex:()=>PU,sha384_base64:()=>_U,sha384_base64url:()=>RU,sha384_hex:()=>xU,sha512_base64:()=>OU,sha512_base64url:()=>$U,sha512_hex:()=>AU,string:()=>Ey,time:()=>wy,ulid:()=>oy,undefined:()=>xy,unicodeEmail:()=>dR,uppercase:()=>Ry,uuid:()=>Po,uuid4:()=>aU,uuid6:()=>cU,uuid7:()=>lU,xid:()=>iy});var ny=/^[cC][^\s-]{8,}$/,ry=/^[0-9a-z]+$/,oy=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,iy=/^[0-9a-vA-V]{20}$/,sy=/^[A-Za-z0-9]{27}$/,ay=/^[a-zA-Z0-9_-]{21}$/,cy=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,sU=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ly=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Po=s(e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,"uuid"),aU=Po(4),cU=Po(6),lU=Po(7),dy=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,dU=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,uU=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,dR=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,pU=dR,mU=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,fU="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function uy(){return new RegExp(fU,"u")}s(uy,"emoji");var py=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,my=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,fy=s(e=>{let t=Mt(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},"mac"),gy=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,hy=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,yy=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,vu=/^[A-Za-z0-9_-]*$/,gU=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,hU=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,vy=/^\+[1-9]\d{6,14}$/,uR="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",by=new RegExp(`^${uR}$`);function pR(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}s(pR,"timeSource");function wy(e){return new RegExp(`^${pR(e)}$`)}s(wy,"time");function ky(e){let t=pR({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${uR}T(?:${o})$`)}s(ky,"datetime");var Ey=s(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),Sy=/^-?\d+n?$/,Py=/^-?\d+$/,bu=/^-?\d+(?:\.\d+)?$/,Iy=/^(?:true|false)$/i,Ty=/^null$/i;var xy=/^undefined$/i;var _y=/^[^A-Z]*$/,Ry=/^[^a-z]*$/,yU=/^[0-9a-fA-F]*$/;function Qa(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}s(Qa,"fixedBase64");function Va(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}s(Va,"fixedBase64url");var vU=/^[0-9a-fA-F]{32}$/,bU=Qa(22,"=="),wU=Va(22),kU=/^[0-9a-fA-F]{40}$/,EU=Qa(27,"="),SU=Va(27),PU=/^[0-9a-fA-F]{64}$/,IU=Qa(43,"="),TU=Va(43),xU=/^[0-9a-fA-F]{96}$/,_U=Qa(64,""),RU=Va(64),AU=/^[0-9a-fA-F]{128}$/,OU=Qa(86,"=="),$U=Va(86);var ue=b("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),fR={number:"number",bigint:"bigint",object:"date"},wu=b("$ZodCheckLessThan",(e,t)=>{ue.init(e,t);let r=fR[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ku=b("$ZodCheckGreaterThan",(e,t)=>{ue.init(e,t);let r=fR[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ay=b("$ZodCheckMultipleOf",(e,t)=>{ue.init(e,t),e._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Bh(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Oy=b("$ZodCheckNumberFormat",(e,t)=>{ue.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,i]=Jh[t.format];e._zod.onattach.push(a=>{let c=a._zod.bag;c.format=t.format,c.minimum=n,c.maximum=i,r&&(c.pattern=Py)}),e._zod.check=a=>{let c=a.value;if(r){if(!Number.isInteger(c)){a.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}c<n&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),c>i&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),$y=b("$ZodCheckBigIntFormat",(e,t)=>{ue.init(e,t);let[r,o]=Zh[t.format];e._zod.onattach.push(n=>{let i=n._zod.bag;i.format=t.format,i.minimum=r,i.maximum=o}),e._zod.check=n=>{let i=n.value;i<r&&n.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>o&&n.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Cy=b("$ZodCheckMaxSize",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Tr(n)&&n.size!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value;n.size<=t.maximum||o.issues.push({origin:qa(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Ny=b("$ZodCheckMinSize",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Tr(n)&&n.size!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value;n.size>=t.minimum||o.issues.push({origin:qa(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Ly=b("$ZodCheckSizeEquals",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Tr(n)&&n.size!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=o=>{let n=o.value,i=n.size;if(i===t.size)return;let a=i>t.size;o.issues.push({origin:qa(n),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Dy=b("$ZodCheckMaxLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Tr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value;if(n.length<=t.maximum)return;let a=Fa(n);o.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Gy=b("$ZodCheckMinLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Tr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value;if(n.length>=t.minimum)return;let a=Fa(n);o.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Uy=b("$ZodCheckLengthEquals",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Tr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=o=>{let n=o.value,i=n.length;if(i===t.length)return;let a=Fa(n),c=i>t.length;o.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Ui=b("$ZodCheckStringFormat",(e,t)=>{var r,o;ue.init(e,t),e._zod.onattach.push(n=>{let i=n._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),jy=b("$ZodCheckRegex",(e,t)=>{Ui.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),My=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=_y),Ui.init(e,t)}),qy=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ry),Ui.init(e,t)}),Fy=b("$ZodCheckIncludes",(e,t)=>{ue.init(e,t);let r=Mt(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),zy=b("$ZodCheckStartsWith",(e,t)=>{ue.init(e,t);let r=new RegExp(`^${Mt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),By=b("$ZodCheckEndsWith",(e,t)=>{ue.init(e,t);let r=new RegExp(`.*${Mt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});function mR(e,t,r){e.issues.length&&t.issues.push(...wt(r,e.issues))}s(mR,"handleCheckPropertyResult");var Ky=b("$ZodCheckProperty",(e,t)=>{ue.init(e,t),e._zod.check=r=>{let o=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then(n=>mR(n,r,t.property));mR(o,r,t.property)}}),Qy=b("$ZodCheckMimeType",(e,t)=>{ue.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(o=>{o._zod.bag.mime=t.mime}),e._zod.check=o=>{r.has(o.value.type)||o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e,continue:!t.abort})}}),Vy=b("$ZodCheckOverwrite",(e,t)=>{ue.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ha=class{static{s(this,"Doc")}constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
|
|
416
|
+
`).filter(a=>a),n=Math.min(...o.map(a=>a.length-a.trimStart().length)),i=o.map(a=>a.slice(n)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let t=Function,r=this?.args,n=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,n.join(`
|
|
417
|
+
`))}};var Hy={major:4,minor:3,patch:6};var Q=b("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Hy;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let n of o)for(let i of n._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=s((a,c,l)=>{let d=Rr(a),u;for(let m of c){if(m._zod.def.when){if(!m._zod.def.when(a))continue}else if(d)continue;let p=a.issues.length,f=m._zod.check(a);if(f instanceof Promise&&l?.async===!1)throw new tn;if(u||f instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await f,a.issues.length!==p&&(d||(d=Rr(a,p)))});else{if(a.issues.length===p)continue;d||(d=Rr(a,p))}}return u?u.then(()=>a):a},"runChecks"),i=s((a,c,l)=>{if(Rr(a))return a.aborted=!0,a;let d=n(c,o,l);if(d instanceof Promise){if(l.async===!1)throw new tn;return d.then(u=>e._zod.parse(u,l))}return e._zod.parse(d,l)},"handleCanaryResult");e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let d=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return d instanceof Promise?d.then(u=>i(u,a,c)):i(d,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new tn;return l.then(d=>n(d,o,c))}return n(l,o,c)}}ee(e,"~standard",()=>({validate:s(n=>{try{let i=ey(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return ty(e,n).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},"validate"),vendor:"zod",version:1}))}),Io=b("$ZodString",(e,t)=>{Q.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ey(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ae=b("$ZodStringFormat",(e,t)=>{Ui.init(e,t),Io.init(e,t)}),Jy=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ly),ae.init(e,t)}),Zy=b("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Po(o))}else t.pattern??(t.pattern=Po());ae.init(e,t)}),Yy=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=dy),ae.init(e,t)}),Xy=b("$ZodURL",(e,t)=>{ae.init(e,t),e._zod.check=r=>{try{let o=r.value.trim(),n=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ev=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=uy()),ae.init(e,t)}),tv=b("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ay),ae.init(e,t)}),nv=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ny),ae.init(e,t)}),rv=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ry),ae.init(e,t)}),ov=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=oy),ae.init(e,t)}),iv=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=iy),ae.init(e,t)}),sv=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=sy),ae.init(e,t)}),av=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=ky(t)),ae.init(e,t)}),cv=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=by),ae.init(e,t)}),lv=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=wy(t)),ae.init(e,t)}),dv=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=cy),ae.init(e,t)}),uv=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=py),ae.init(e,t),e._zod.bag.format="ipv4"}),pv=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=my),ae.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),mv=b("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=fy(t.delimiter)),ae.init(e,t),e._zod.bag.format="mac"}),fv=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=gy),ae.init(e,t)}),gv=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=hy),ae.init(e,t),e._zod.check=r=>{let o=r.value.split("/");try{if(o.length!==2)throw new Error;let[n,i]=o;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function hv(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}s(hv,"isValidBase64");var yv=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=yy),ae.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{hv(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function xR(e){if(!vu.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return hv(r)}s(xR,"isValidBase64URL");var vv=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=vu),ae.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{xR(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),bv=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=vy),ae.init(e,t)});function _R(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}s(_R,"isValidJWT");var wv=b("$ZodJWT",(e,t)=>{ae.init(e,t),e._zod.check=r=>{_R(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),kv=b("$ZodCustomStringFormat",(e,t)=>{ae.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),xu=b("$ZodNumber",(e,t)=>{Q.init(e,t),e._zod.pattern=e._zod.bag.pattern??bu,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let i=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),r}}),Ev=b("$ZodNumberFormat",(e,t)=>{Oy.init(e,t),xu.init(e,t)}),Wa=b("$ZodBoolean",(e,t)=>{Q.init(e,t),e._zod.pattern=Iy,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),_u=b("$ZodBigInt",(e,t)=>{Q.init(e,t),e._zod.pattern=Sy,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Sv=b("$ZodBigIntFormat",(e,t)=>{$y.init(e,t),_u.init(e,t)}),Pv=b("$ZodSymbol",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),Iv=b("$ZodUndefined",(e,t)=>{Q.init(e,t),e._zod.pattern=xy,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,o)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),Tv=b("$ZodNull",(e,t)=>{Q.init(e,t),e._zod.pattern=Ty,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),xv=b("$ZodAny",(e,t)=>{Q.init(e,t),e._zod.parse=r=>r}),_v=b("$ZodUnknown",(e,t)=>{Q.init(e,t),e._zod.parse=r=>r}),Rv=b("$ZodNever",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Av=b("$ZodVoid",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),Ov=b("$ZodDate",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,i=n instanceof Date;return i&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...i?{received:"Invalid Date"}:{},inst:e}),r}});function hR(e,t,r){e.issues.length&&t.issues.push(...wt(r,e.issues)),t.value[r]=e.value}s(hR,"handleArrayResult");var $v=b("$ZodArray",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let i=[];for(let a=0;a<n.length;a++){let c=n[a],l=t.element._zod.run({value:c,issues:[]},o);l instanceof Promise?i.push(l.then(d=>hR(d,r,a))):hR(l,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function Tu(e,t,r,o,n){if(e.issues.length){if(n&&!(r in o))return;t.issues.push(...wt(r,e.issues))}e.value===void 0?r in o&&(t.value[r]=void 0):t.value[r]=e.value}s(Tu,"handlePropertyResult");function RR(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=Wh(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}s(RR,"normalizeDef");function AR(e,t,r,o,n,i){let a=[],c=n.keySet,l=n.catchall._zod,d=l.def.type,u=l.optout==="optional";for(let m in t){if(c.has(m))continue;if(d==="never"){a.push(m);continue}let p=l.run({value:t[m],issues:[]},o);p instanceof Promise?e.push(p.then(f=>Tu(f,r,m,t,u))):Tu(p,r,m,t,u)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}s(AR,"handleCatchall");var OR=b("$ZodObject",(e,t)=>{if(Q.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:s(()=>{let l={...c};return Object.defineProperty(t,"shape",{value:l}),l},"get")})}let o=$i(()=>RR(t));ee(e._zod,"propValues",()=>{let c=t.shape,l={};for(let d in c){let u=c[d]._zod;if(u.values){l[d]??(l[d]=new Set);for(let m of u.values)l[d].add(m)}}return l});let n=So,i=t.catchall,a;e._zod.parse=(c,l)=>{a??(a=o.value);let d=c.value;if(!n(d))return c.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),c;c.value={};let u=[],m=a.shape;for(let p of a.keys){let f=m[p],g=f._zod.optout==="optional",h=f._zod.run({value:d[p],issues:[]},l);h instanceof Promise?u.push(h.then(y=>Tu(y,c,p,d,g))):Tu(h,c,p,d,g)}return i?AR(u,d,c,l,o.value,e):u.length?Promise.all(u).then(()=>c):c}}),Cv=b("$ZodObjectJIT",(e,t)=>{OR.init(e,t);let r=e._zod.parse,o=$i(()=>RR(t)),n=s(p=>{let f=new Ha(["shape","payload","ctx"]),g=o.value,h=s(k=>{let R=su(k);return`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`},"parseStr");f.write("const input = payload.value;");let y=Object.create(null),v=0;for(let k of g.keys)y[k]=`key_${v++}`;f.write("const newResult = {};");for(let k of g.keys){let R=y[k],I=su(k),_=p[k]?._zod?.optout==="optional";f.write(`const ${R} = ${h(k)};`),_?f.write(`
|
|
418
|
+
if (${R}.issues.length) {
|
|
419
|
+
if (${I} in input) {
|
|
420
|
+
payload.issues = payload.issues.concat(${R}.issues.map(iss => ({
|
|
421
|
+
...iss,
|
|
422
|
+
path: iss.path ? [${I}, ...iss.path] : [${I}]
|
|
423
|
+
})));
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
if (${R}.value === undefined) {
|
|
428
|
+
if (${I} in input) {
|
|
429
|
+
newResult[${I}] = undefined;
|
|
430
|
+
}
|
|
431
|
+
} else {
|
|
432
|
+
newResult[${I}] = ${R}.value;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
`):f.write(`
|
|
436
|
+
if (${R}.issues.length) {
|
|
437
|
+
payload.issues = payload.issues.concat(${R}.issues.map(iss => ({
|
|
438
|
+
...iss,
|
|
439
|
+
path: iss.path ? [${I}, ...iss.path] : [${I}]
|
|
440
|
+
})));
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
if (${R}.value === undefined) {
|
|
444
|
+
if (${I} in input) {
|
|
445
|
+
newResult[${I}] = undefined;
|
|
446
|
+
}
|
|
447
|
+
} else {
|
|
448
|
+
newResult[${I}] = ${R}.value;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
`)}f.write("payload.value = newResult;"),f.write("return payload;");let S=f.compile();return(k,R)=>S(p,k,R)},"generateFastpass"),i,a=So,c=!Da.jitless,d=c&&Qh.value,u=t.catchall,m;e._zod.parse=(p,f)=>{m??(m=o.value);let g=p.value;return a(g)?c&&d&&f?.async===!1&&f.jitless!==!0?(i||(i=n(t.shape)),p=i(p,f),u?AR([],g,p,f,m,e):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),p)}});function yR(e,t,r,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let n=e.filter(i=>!Rr(i));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>ut(a,o,ke())))}),t)}s(yR,"handleUnionResults");var Ja=b("$ZodUnion",(e,t)=>{Q.init(e,t),ee(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),ee(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),ee(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),ee(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){let n=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${n.map(i=>ja(i.source)).join("|")})$`)}});let r=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(n,i)=>{if(r)return o(n,i);let a=!1,c=[];for(let l of t.options){let d=l._zod.run({value:n.value,issues:[]},i);if(d instanceof Promise)c.push(d),a=!0;else{if(d.issues.length===0)return d;c.push(d)}}return a?Promise.all(c).then(l=>yR(l,n,e,i)):yR(c,n,e,i)}});function vR(e,t,r,o){let n=e.filter(i=>i.issues.length===0);return n.length===1?(t.value=n[0].value,t):(n.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>ut(a,o,ke())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}s(vR,"handleExclusiveUnionResults");var Nv=b("$ZodXor",(e,t)=>{Ja.init(e,t),t.inclusive=!1;let r=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(n,i)=>{if(r)return o(n,i);let a=!1,c=[];for(let l of t.options){let d=l._zod.run({value:n.value,issues:[]},i);d instanceof Promise?(c.push(d),a=!0):c.push(d)}return a?Promise.all(c).then(l=>vR(l,n,e,i)):vR(c,n,e,i)}}),Lv=b("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ja.init(e,t);let r=e._zod.parse;ee(e._zod,"propValues",()=>{let n={};for(let i of t.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[c,l]of Object.entries(a)){n[c]||(n[c]=new Set);for(let d of l)n[c].add(d)}}return n});let o=$i(()=>{let n=t.options,i=new Map;for(let a of n){let c=a._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let l of c){if(i.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);i.set(l,a)}}return i});e._zod.parse=(n,i)=>{let a=n.value;if(!So(a))return n.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),n;let c=o.value.get(a?.[t.discriminator]);return c?c._zod.run(n,i):t.unionFallback?r(n,i):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),n)}}),Dv=b("$ZodIntersection",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),a=t.right._zod.run({value:n,issues:[]},o);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([l,d])=>bR(r,l,d)):bR(r,i,a)}});function Wy(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(_r(e)&&_r(t)){let r=Object.keys(t),o=Object.keys(e).filter(i=>r.indexOf(i)!==-1),n={...e,...t};for(let i of o){let a=Wy(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n[i]=a.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],i=t[o],a=Wy(n,i);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}s(Wy,"mergeValues");function bR(e,t,r){let o=new Map,n;for(let c of t.issues)if(c.code==="unrecognized_keys"){n??(n=c);for(let l of c.keys)o.has(l)||o.set(l,{}),o.get(l).l=!0}else e.issues.push(c);for(let c of r.issues)if(c.code==="unrecognized_keys")for(let l of c.keys)o.has(l)||o.set(l,{}),o.get(l).r=!0;else e.issues.push(c);let i=[...o].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(i.length&&n&&e.issues.push({...n,keys:i}),Rr(e))return e;let a=Wy(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}s(bR,"handleIntersectionResults");var Ru=b("$ZodTuple",(e,t)=>{Q.init(e,t);let r=t.items;e._zod.parse=(o,n)=>{let i=o.value;if(!Array.isArray(i))return o.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=[];let a=[],c=[...r].reverse().findIndex(u=>u._zod.optin!=="optional"),l=c===-1?0:r.length-c;if(!t.rest){let u=i.length>r.length,m=i.length<l-1;if(u||m)return o.issues.push({...u?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:i,inst:e,origin:"array"}),o}let d=-1;for(let u of r){if(d++,d>=i.length&&d>=l)continue;let m=u._zod.run({value:i[d],issues:[]},n);m instanceof Promise?a.push(m.then(p=>Eu(p,o,d))):Eu(m,o,d)}if(t.rest){let u=i.slice(r.length);for(let m of u){d++;let p=t.rest._zod.run({value:m,issues:[]},n);p instanceof Promise?a.push(p.then(f=>Eu(f,o,d))):Eu(p,o,d)}}return a.length?Promise.all(a).then(()=>o):o}});function Eu(e,t,r){e.issues.length&&t.issues.push(...wt(r,e.issues)),t.value[r]=e.value}s(Eu,"handleTupleResult");var Gv=b("$ZodRecord",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!_r(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let i=[],a=t.keyType._zod.values;if(a){r.value={};let c=new Set;for(let d of a)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){c.add(typeof d=="number"?d.toString():d);let u=t.valueType._zod.run({value:n[d],issues:[]},o);u instanceof Promise?i.push(u.then(m=>{m.issues.length&&r.issues.push(...wt(d,m.issues)),r.value[d]=m.value})):(u.issues.length&&r.issues.push(...wt(d,u.issues)),r.value[d]=u.value)}let l;for(let d in n)c.has(d)||(l=l??[],l.push(d));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:l})}else{r.value={};for(let c of Reflect.ownKeys(n)){if(c==="__proto__")continue;let l=t.keyType._zod.run({value:c,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&bu.test(c)&&l.issues.length){let m=t.keyType._zod.run({value:Number(c),issues:[]},o);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(l=m)}if(l.issues.length){t.mode==="loose"?r.value[c]=n[c]:r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(m=>ut(m,o,ke())),input:c,path:[c],inst:e});continue}let u=t.valueType._zod.run({value:n[c],issues:[]},o);u instanceof Promise?i.push(u.then(m=>{m.issues.length&&r.issues.push(...wt(c,m.issues)),r.value[l.value]=m.value})):(u.issues.length&&r.issues.push(...wt(c,u.issues)),r.value[l.value]=u.value)}}return i.length?Promise.all(i).then(()=>r):r}}),Uv=b("$ZodMap",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:e}),r;let i=[];r.value=new Map;for(let[a,c]of n){let l=t.keyType._zod.run({value:a,issues:[]},o),d=t.valueType._zod.run({value:c,issues:[]},o);l instanceof Promise||d instanceof Promise?i.push(Promise.all([l,d]).then(([u,m])=>{wR(u,m,r,a,n,e,o)})):wR(l,d,r,a,n,e,o)}return i.length?Promise.all(i).then(()=>r):r}});function wR(e,t,r,o,n,i,a){e.issues.length&&(Ma.has(typeof o)?r.issues.push(...wt(o,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:n,inst:i,issues:e.issues.map(c=>ut(c,a,ke()))})),t.issues.length&&(Ma.has(typeof o)?r.issues.push(...wt(o,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:i,key:o,issues:t.issues.map(c=>ut(c,a,ke()))})),r.value.set(e.value,t.value)}s(wR,"handleMapResult");var jv=b("$ZodSet",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of n){let c=t.valueType._zod.run({value:a,issues:[]},o);c instanceof Promise?i.push(c.then(l=>kR(l,r))):kR(c,r)}return i.length?Promise.all(i).then(()=>r):r}});function kR(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}s(kR,"handleSetResult");var Mv=b("$ZodEnum",(e,t)=>{Q.init(e,t);let r=Ua(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>Ma.has(typeof n)).map(n=>typeof n=="string"?Mt(n):n.toString()).join("|")})$`),e._zod.parse=(n,i)=>{let a=n.value;return o.has(a)||n.issues.push({code:"invalid_value",values:r,input:a,inst:e}),n}}),qv=b("$ZodLiteral",(e,t)=>{if(Q.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?Mt(o):o?Mt(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}}),Fv=b("$ZodFile",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;return n instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),r}}),zv=b("$ZodTransform",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ir(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(a=>(r.value=a,r));if(n instanceof Promise)throw new tn;return r.value=n,r}});function ER(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}s(ER,"handleOptionalResult");var Au=b("$ZodOptional",(e,t)=>{Q.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ee(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ee(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${ja(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>ER(i,r.value)):ER(n,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,o)}}),Bv=b("$ZodExactOptional",(e,t)=>{Au.init(e,t),ee(e._zod,"values",()=>t.innerType._zod.values),ee(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),Kv=b("$ZodNullable",(e,t)=>{Q.init(e,t),ee(e._zod,"optin",()=>t.innerType._zod.optin),ee(e._zod,"optout",()=>t.innerType._zod.optout),ee(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${ja(r.source)}|null)$`):void 0}),ee(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),Qv=b("$ZodDefault",(e,t)=>{Q.init(e,t),e._zod.optin="optional",ee(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>SR(i,t)):SR(n,t)}});function SR(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}s(SR,"handleDefaultResult");var Vv=b("$ZodPrefault",(e,t)=>{Q.init(e,t),e._zod.optin="optional",ee(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),Hv=b("$ZodNonOptional",(e,t)=>{Q.init(e,t),ee(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>PR(i,e)):PR(n,e)}});function PR(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}s(PR,"handleNonOptionalResult");var Wv=b("$ZodSuccess",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ir("ZodSuccess");let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>(r.value=i.issues.length===0,r)):(r.value=n.issues.length===0,r)}}),Jv=b("$ZodCatch",(e,t)=>{Q.init(e,t),ee(e._zod,"optin",()=>t.innerType._zod.optin),ee(e._zod,"optout",()=>t.innerType._zod.optout),ee(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(a=>ut(a,o,ke()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(i=>ut(i,o,ke()))},input:r.value}),r.issues=[]),r)}}),Zv=b("$ZodNaN",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Yv=b("$ZodPipe",(e,t)=>{Q.init(e,t),ee(e._zod,"values",()=>t.in._zod.values),ee(e._zod,"optin",()=>t.in._zod.optin),ee(e._zod,"optout",()=>t.out._zod.optout),ee(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(r,o);return i instanceof Promise?i.then(a=>Su(a,t.in,o)):Su(i,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(i=>Su(i,t.out,o)):Su(n,t.out,o)}});function Su(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}s(Su,"handlePipeResult");var Za=b("$ZodCodec",(e,t)=>{Q.init(e,t),ee(e._zod,"values",()=>t.in._zod.values),ee(e._zod,"optin",()=>t.in._zod.optin),ee(e._zod,"optout",()=>t.out._zod.optout),ee(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if((o.direction||"forward")==="forward"){let i=t.in._zod.run(r,o);return i instanceof Promise?i.then(a=>Pu(a,t,o)):Pu(i,t,o)}else{let i=t.out._zod.run(r,o);return i instanceof Promise?i.then(a=>Pu(a,t,o)):Pu(i,t,o)}}});function Pu(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let n=t.transform(e.value,e);return n instanceof Promise?n.then(i=>Iu(e,i,t.out,r)):Iu(e,n,t.out,r)}else{let n=t.reverseTransform(e.value,e);return n instanceof Promise?n.then(i=>Iu(e,i,t.in,r)):Iu(e,n,t.in,r)}}s(Pu,"handleCodecAResult");function Iu(e,t,r,o){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},o)}s(Iu,"handleCodecTxResult");var Xv=b("$ZodReadonly",(e,t)=>{Q.init(e,t),ee(e._zod,"propValues",()=>t.innerType._zod.propValues),ee(e._zod,"values",()=>t.innerType._zod.values),ee(e._zod,"optin",()=>t.innerType?._zod?.optin),ee(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(IR):IR(n)}});function IR(e){return e.value=Object.freeze(e.value),e}s(IR,"handleReadonlyResult");var eb=b("$ZodTemplateLiteral",(e,t)=>{Q.init(e,t);let r=[];for(let o of t.parts)if(typeof o=="object"&&o!==null){if(!o._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);let n=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!n)throw new Error(`Invalid template literal part: ${o._zod.traits}`);let i=n.startsWith("^")?1:0,a=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(i,a))}else if(o===null||Hh.has(typeof o))r.push(Mt(`${o}`));else throw new Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(o,n)=>typeof o.value!="string"?(o.issues.push({input:o.value,inst:e,expected:"string",code:"invalid_type"}),o):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(o.value)||o.issues.push({input:o.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),o)}),tb=b("$ZodFunction",(e,t)=>(Q.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...o){let n=e._def.input?cu(e._def.input,o):o,i=Reflect.apply(r,this,n);return e._def.output?cu(e._def.output,i):i}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...o){let n=e._def.input?await lu(e._def.input,o):o,i=await Reflect.apply(r,this,n);return e._def.output?await lu(e._def.output,i):i}},e._zod.parse=(r,o)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let o=e.constructor;return Array.isArray(r[0])?new o({type:"function",input:new Ru({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new o({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let o=e.constructor;return new o({type:"function",input:e._def.input,output:r})},e)),nb=b("$ZodPromise",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>Promise.resolve(r.value).then(n=>t.innerType._zod.run({value:n,issues:[]},o))}),rb=b("$ZodLazy",(e,t)=>{Q.init(e,t),ee(e._zod,"innerType",()=>t.getter()),ee(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),ee(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),ee(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),ee(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),ob=b("$ZodCustom",(e,t)=>{ue.init(e,t),Q.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(i=>TR(i,r,o,e));TR(n,r,o,e)}});function TR(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(Ci(n))}}s(TR,"handleRefineResult");var nc={};me(nc,{ar:()=>ib,az:()=>sb,be:()=>ab,bg:()=>cb,ca:()=>lb,cs:()=>db,da:()=>ub,de:()=>pb,en:()=>Ya,eo:()=>mb,es:()=>fb,fa:()=>gb,fi:()=>hb,fr:()=>yb,frCA:()=>vb,he:()=>bb,hu:()=>wb,hy:()=>kb,id:()=>Eb,is:()=>Sb,it:()=>Pb,ja:()=>Ib,ka:()=>Tb,kh:()=>xb,km:()=>Xa,ko:()=>_b,lt:()=>Rb,mk:()=>Ab,ms:()=>Ob,nl:()=>$b,no:()=>Cb,ota:()=>Nb,pl:()=>Db,ps:()=>Lb,pt:()=>Gb,ru:()=>Ub,sl:()=>jb,sv:()=>Mb,ta:()=>qb,th:()=>Fb,tr:()=>zb,ua:()=>Bb,uk:()=>tc,ur:()=>Kb,uz:()=>Qb,vi:()=>Vb,yo:()=>Jb,zhCN:()=>Hb,zhTW:()=>Wb});var NU=s(()=>{let e={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${n.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${c}`:`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${i}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${c}`}case"invalid_value":return n.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${O(n.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${n.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${n.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${n.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${n.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${n.minimum.toString()} ${a.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${n.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${n.prefix}"`:i.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${i.suffix}"`:i.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${i.includes}"`:i.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${i.pattern}`:`${r[i.format]??n.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${n.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${n.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${n.keys.length>1?"\u0629":""}: ${E(n.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${n.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${n.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}},"error");function ib(){return{localeError:NU()}}s(ib,"default");var LU=s(()=>{let e={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${n.expected}, daxil olan ${c}`:`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${i}, daxil olan ${c}`}case"invalid_value":return n.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${O(n.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${i}${n.maximum.toString()} ${a.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${i}${n.minimum.toString()} ${a.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${i.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:i.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${i.suffix}" il\u0259 bitm\u0259lidir`:i.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${i.includes}" daxil olmal\u0131d\u0131r`:i.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${i.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${r[i.format]??n.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${n.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${n.keys.length>1?"lar":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${n.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}},"error");function sb(){return{localeError:LU()}}s(sb,"default");function $R(e,t,r,o){let n=Math.abs(e),i=n%10,a=n%100;return a>=11&&a<=19?o:i===1?t:i>=2&&i<=4?r:o}s($R,"getBelarusianPlural");var DU=s(()=>{let e={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},o={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${n.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${c}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${i}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${c}`}case"invalid_value":return n.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${O(n.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a){let c=Number(n.maximum),l=$R(c,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${i}${n.maximum.toString()} ${l}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a){let c=Number(n.minimum),l=$R(c,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${i}${n.minimum.toString()} ${l}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${n.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${E(n.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${n.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${n.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}},"error");function ab(){return{localeError:DU()}}s(ab,"default");var GU=s(()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${c}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${i}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${c}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${O(n.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${i}${n.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${i}${n.minimum.toString()} ${a.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${i.prefix}"`;if(i.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${i.suffix}"`;if(i.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${i.includes}"`;if(i.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${i.pattern}`;let a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return i.format==="emoji"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="datetime"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="date"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),i.format==="time"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="duration"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${a} ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${n.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u043E\u0432\u0435":""}: ${E(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}},"error");function cb(){return{localeError:GU()}}s(cb,"default");var UU=s(()=>{let e={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Tipus inv\xE0lid: s'esperava instanceof ${n.expected}, s'ha rebut ${c}`:`Tipus inv\xE0lid: s'esperava ${i}, s'ha rebut ${c}`}case"invalid_value":return n.values.length===1?`Valor inv\xE0lid: s'esperava ${O(n.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${E(n.values," o ")}`;case"too_big":{let i=n.inclusive?"com a m\xE0xim":"menys de",a=t(n.origin);return a?`Massa gran: s'esperava que ${n.origin??"el valor"} contingu\xE9s ${i} ${n.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"com a m\xEDnim":"m\xE9s de",a=t(n.origin);return a?`Massa petit: s'esperava que ${n.origin} contingu\xE9s ${i} ${n.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${n.origin} fos ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${i.prefix}"`:i.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${i.suffix}"`:i.format==="includes"?`Format inv\xE0lid: ha d'incloure "${i.includes}"`:i.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${i.pattern}`:`Format inv\xE0lid per a ${r[i.format]??n.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${n.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${n.origin}`;default:return"Entrada inv\xE0lida"}}},"error");function lb(){return{localeError:UU()}}s(lb,"default");var jU=s(()=>{let e={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"},o={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${n.expected}, obdr\u017Eeno ${c}`:`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${i}, obdr\u017Eeno ${c}`}case"invalid_value":return n.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${O(n.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${i}${n.maximum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${i}${n.minimum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${i.prefix}"`:i.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${i.suffix}"`:i.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${i.includes}"`:i.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${i.pattern}`:`Neplatn\xFD form\xE1t ${r[i.format]??n.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${n.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${E(n.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${n.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${n.origin}`;default:return"Neplatn\xFD vstup"}}},"error");function db(){return{localeError:jU()}}s(db,"default");var MU=s(()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},o={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ugyldigt input: forventede instanceof ${n.expected}, fik ${c}`:`Ugyldigt input: forventede ${i}, fik ${c}`}case"invalid_value":return n.values.length===1?`Ugyldig v\xE6rdi: forventede ${O(n.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin),c=o[n.origin]??n.origin;return a?`For stor: forventede ${c??"value"} ${a.verb} ${i} ${n.maximum.toString()} ${a.unit??"elementer"}`:`For stor: forventede ${c??"value"} havde ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin),c=o[n.origin]??n.origin;return a?`For lille: forventede ${c} ${a.verb} ${i} ${n.minimum.toString()} ${a.unit}`:`For lille: forventede ${c} havde ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ugyldig streng: skal starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: skal ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: skal indeholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${r[i.format]??n.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${E(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${n.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${n.origin}`;default:return"Ugyldigt input"}}},"error");function ub(){return{localeError:MU()}}s(ub,"default");var qU=s(()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},o={nan:"NaN",number:"Zahl",array:"Array"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ung\xFCltige Eingabe: erwartet instanceof ${n.expected}, erhalten ${c}`:`Ung\xFCltige Eingabe: erwartet ${i}, erhalten ${c}`}case"invalid_value":return n.values.length===1?`Ung\xFCltige Eingabe: erwartet ${O(n.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ist`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ist`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ung\xFCltiger String: muss mit "${i.prefix}" beginnen`:i.format==="ends_with"?`Ung\xFCltiger String: muss mit "${i.suffix}" enden`:i.format==="includes"?`Ung\xFCltiger String: muss "${i.includes}" enthalten`:i.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${i.pattern} entsprechen`:`Ung\xFCltig: ${r[i.format]??n.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${E(n.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${n.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${n.origin}`;default:return"Ung\xFCltige Eingabe"}}},"error");function pb(){return{localeError:qU()}}s(pb,"default");var FU=s(()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${O(n.values[0])}`:`Invalid option: expected one of ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${a.unit}`:`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}},"error");function Ya(){return{localeError:FU()}}s(Ya,"default");var zU=s(()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},o={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Nevalida enigo: atendi\u011Dis instanceof ${n.expected}, ricevi\u011Dis ${c}`:`Nevalida enigo: atendi\u011Dis ${i}, ricevi\u011Dis ${c}`}case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${O(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()} ${a.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${i}${n.minimum.toString()} ${a.unit}`:`Tro malgranda: atendi\u011Dis ke ${n.origin} estu ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${i.prefix}"`:i.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${i.suffix}"`:i.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${i.includes}"`:i.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${i.pattern}`:`Nevalida ${r[i.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} \u015Dlosilo${n.keys.length>1?"j":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}},"error");function mb(){return{localeError:zU()}}s(mb,"default");var BU=s(()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Entrada inv\xE1lida: se esperaba instanceof ${n.expected}, recibido ${c}`:`Entrada inv\xE1lida: se esperaba ${i}, recibido ${c}`}case"invalid_value":return n.values.length===1?`Entrada inv\xE1lida: se esperaba ${O(n.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin),c=o[n.origin]??n.origin;return a?`Demasiado grande: se esperaba que ${c??"valor"} tuviera ${i}${n.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${c??"valor"} fuera ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin),c=o[n.origin]??n.origin;return a?`Demasiado peque\xF1o: se esperaba que ${c} tuviera ${i}${n.minimum.toString()} ${a.unit}`:`Demasiado peque\xF1o: se esperaba que ${c} fuera ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${i.prefix}"`:i.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${i.suffix}"`:i.format==="includes"?`Cadena inv\xE1lida: debe incluir "${i.includes}"`:i.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${i.pattern}`:`Inv\xE1lido ${r[i.format]??n.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${o[n.origin]??n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${o[n.origin]??n.origin}`;default:return"Entrada inv\xE1lida"}}},"error");function fb(){return{localeError:BU()}}s(fb,"default");var KU=s(()=>{let e={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},o={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${n.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${c} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`:`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${i} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${c} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":return n.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${O(n.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${E(n.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} ${a.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:i.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:i.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${i.includes}" \u0628\u0627\u0634\u062F`:i.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${i.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${r[i.format]??n.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${n.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${n.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${E(n.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${n.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${n.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}},"error");function gb(){return{localeError:KU()}}s(gb,"default");var QU=s(()=>{let e={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Virheellinen tyyppi: odotettiin instanceof ${n.expected}, oli ${c}`:`Virheellinen tyyppi: odotettiin ${i}, oli ${c}`}case"invalid_value":return n.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${O(n.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Liian suuri: ${a.subject} t\xE4ytyy olla ${i}${n.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Liian pieni: ${a.subject} t\xE4ytyy olla ${i}${n.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${i.prefix}"`:i.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${i.suffix}"`:i.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${i.includes}"`:i.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${i.pattern}`:`Virheellinen ${r[i.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${E(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}},"error");function hb(){return{localeError:QU()}}s(hb,"default");var VU=s(()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},o={nan:"NaN",number:"nombre",array:"tableau"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Entr\xE9e invalide : instanceof ${n.expected} attendu, ${c} re\xE7u`:`Entr\xE9e invalide : ${i} attendu, ${c} re\xE7u`}case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : ${O(n.values[0])} attendu`:`Option invalide : une valeur parmi ${E(n.values,"|")} attendue`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Trop grand : ${n.origin??"valeur"} doit ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${n.origin??"valeur"} doit \xEAtre ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Trop petit : ${n.origin} doit ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`Trop petit : ${n.origin} doit \xEAtre ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${i.pattern}`:`${r[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xE9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${E(n.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${n.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entr\xE9e invalide"}}},"error");function yb(){return{localeError:VU()}}s(yb,"default");var HU=s(()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Entr\xE9e invalide : attendu instanceof ${n.expected}, re\xE7u ${c}`:`Entr\xE9e invalide : attendu ${i}, re\xE7u ${c}`}case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : attendu ${O(n.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"\u2264":"<",a=t(n.origin);return a?`Trop grand : attendu que ${n.origin??"la valeur"} ait ${i}${n.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${n.origin??"la valeur"} soit ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"\u2265":">",a=t(n.origin);return a?`Trop petit : attendu que ${n.origin} ait ${i}${n.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${n.origin} soit ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${i.pattern}`:`${r[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xE9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${E(n.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${n.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entr\xE9e invalide"}}},"error");function vb(){return{localeError:HU()}}s(vb,"default");var WU=s(()=>{let e={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},t={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},r=s(d=>d?e[d]:void 0,"typeEntry"),o=s(d=>{let u=r(d);return u?u.label:d??e.unknown.label},"typeLabel"),n=s(d=>`\u05D4${o(d)}`,"withDefinite"),i=s(d=>(r(d)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA","verbFor"),a=s(d=>d?t[d]??null:null,"getSizing"),c={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},l={nan:"NaN"};return d=>{switch(d.code){case"invalid_type":{let u=d.expected,m=l[u??""]??o(u),p=$(d.input),f=l[p]??e[p]?.label??p;return/^[A-Z]/.test(d.expected)?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${d.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${f}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}, \u05D4\u05EA\u05E7\u05D1\u05DC ${f}`}case"invalid_value":{if(d.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${O(d.values[0])}`;let u=d.values.map(f=>O(f));if(d.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${u[0]} \u05D0\u05D5 ${u[1]}`;let m=u[u.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${u.slice(0,-1).join(", ")} \u05D0\u05D5 ${m}`}case"too_big":{let u=a(d.origin),m=n(d.origin??"value");if(d.origin==="string")return`${u?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${m} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${d.maximum.toString()} ${u?.unit??""} ${d.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(d.origin==="number"){let g=d.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${d.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${d.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${m} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${g}`}if(d.origin==="array"||d.origin==="set"){let g=d.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",h=d.inclusive?`${d.maximum} ${u?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${d.maximum} ${u?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${m} ${g} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let p=d.inclusive?"<=":"<",f=i(d.origin??"value");return u?.unit?`${u.longLabel} \u05DE\u05D3\u05D9: ${m} ${f} ${p}${d.maximum.toString()} ${u.unit}`:`${u?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${m} ${f} ${p}${d.maximum.toString()}`}case"too_small":{let u=a(d.origin),m=n(d.origin??"value");if(d.origin==="string")return`${u?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${m} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${d.minimum.toString()} ${u?.unit??""} ${d.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(d.origin==="number"){let g=d.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${d.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${d.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${m} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${g}`}if(d.origin==="array"||d.origin==="set"){let g=d.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(d.minimum===1&&d.inclusive){let y=(d.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${m} ${g} \u05DC\u05D4\u05DB\u05D9\u05DC ${y}`}let h=d.inclusive?`${d.minimum} ${u?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${d.minimum} ${u?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${m} ${g} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let p=d.inclusive?">=":">",f=i(d.origin??"value");return u?.unit?`${u.shortLabel} \u05DE\u05D3\u05D9: ${m} ${f} ${p}${d.minimum.toString()} ${u.unit}`:`${u?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${m} ${f} ${p}${d.minimum.toString()}`}case"invalid_format":{let u=d;if(u.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${u.prefix}"`;if(u.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${u.suffix}"`;if(u.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${u.includes}"`;if(u.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${u.pattern}`;let m=c[u.format],p=m?.label??u.format,g=(m?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${p} \u05DC\u05D0 ${g}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${d.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${d.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${d.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${E(d.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${n(d.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}},"error");function bb(){return{localeError:WU()}}s(bb,"default");var JU=s(()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"},o={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${n.expected}, a kapott \xE9rt\xE9k ${c}`:`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${i}, a kapott \xE9rt\xE9k ${c}`}case"invalid_value":return n.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${O(n.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`T\xFAl nagy: ${n.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${i}${n.maximum.toString()} ${a.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${n.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} m\xE9rete t\xFAl kicsi ${i}${n.minimum.toString()} ${a.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} t\xFAl kicsi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\xC9rv\xE9nytelen string: "${i.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:i.format==="ends_with"?`\xC9rv\xE9nytelen string: "${i.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:i.format==="includes"?`\xC9rv\xE9nytelen string: "${i.includes}" \xE9rt\xE9ket kell tartalmaznia`:i.format==="regex"?`\xC9rv\xE9nytelen string: ${i.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${r[i.format]??n.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${n.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${n.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${n.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}},"error");function wb(){return{localeError:JU()}}s(wb,"default");function CR(e,t,r){return Math.abs(e)===1?t:r}s(CR,"getArmenianPlural");function ji(e){if(!e)return"";let t=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],r=e[e.length-1];return e+(t.includes(r)?"\u0576":"\u0568")}s(ji,"withDefiniteArticle");var ZU=s(()=>{let e={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},o={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${n.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${c}`:`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${i}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${c}`}case"invalid_value":return n.values.length===1?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${O(n.values[1])}`:`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a){let c=Number(n.maximum),l=CR(c,a.unit.one,a.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${ji(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${i}${n.maximum.toString()} ${l}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${ji(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a){let c=Number(n.minimum),l=CR(c,a.unit.one,a.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${ji(n.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${i}${n.minimum.toString()} ${l}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${ji(n.origin)} \u056C\u056B\u0576\u056B ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${i.prefix}"-\u0578\u057E`:i.format==="ends_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${i.suffix}"-\u0578\u057E`:i.format==="includes"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${i.includes}"`:i.format==="regex"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${i.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`:`\u054D\u056D\u0561\u056C ${r[i.format]??n.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${n.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${n.keys.length>1?"\u0576\u0565\u0580":""}. ${E(n.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${ji(n.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${ji(n.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}},"error");function kb(){return{localeError:ZU()}}s(kb,"default");var YU=s(()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Input tidak valid: diharapkan instanceof ${n.expected}, diterima ${c}`:`Input tidak valid: diharapkan ${i}, diterima ${c}`}case"invalid_value":return n.values.length===1?`Input tidak valid: diharapkan ${O(n.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${i}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Terlalu kecil: diharapkan ${n.origin} memiliki ${i}${n.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${n.origin} menjadi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`String tidak valid: harus dimulai dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak valid: harus berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak valid: harus menyertakan "${i.includes}"`:i.format==="regex"?`String tidak valid: harus sesuai pola ${i.pattern}`:`${r[i.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}},"error");function Eb(){return{localeError:YU()}}s(Eb,"default");var XU=s(()=>{let e={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"},o={nan:"NaN",number:"n\xFAmer",array:"fylki"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Rangt gildi: \xDE\xFA sl\xF3st inn ${c} \xFEar sem \xE1 a\xF0 vera instanceof ${n.expected}`:`Rangt gildi: \xDE\xFA sl\xF3st inn ${c} \xFEar sem \xE1 a\xF0 vera ${i}`}case"invalid_value":return n.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${O(n.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} hafi ${i}${n.maximum.toString()} ${a.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} s\xE9 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} hafi ${i}${n.minimum.toString()} ${a.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} s\xE9 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${i.prefix}"`:i.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${i.suffix}"`:i.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${i.includes}"`:i.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${i.pattern}`:`Rangt ${r[i.format]??n.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${E(n.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${n.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${n.origin}`;default:return"Rangt gildi"}}},"error");function Sb(){return{localeError:XU()}}s(Sb,"default");var ej=s(()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"numero",array:"vettore"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Input non valido: atteso instanceof ${n.expected}, ricevuto ${c}`:`Input non valido: atteso ${i}, ricevuto ${c}`}case"invalid_value":return n.values.length===1?`Input non valido: atteso ${O(n.values[0])}`:`Opzione non valida: atteso uno tra ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Troppo grande: ${n.origin??"valore"} deve avere ${i}${n.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${n.origin??"valore"} deve essere ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Troppo piccolo: ${n.origin} deve avere ${i}${n.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${n.origin} deve essere ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Stringa non valida: deve iniziare con "${i.prefix}"`:i.format==="ends_with"?`Stringa non valida: deve terminare con "${i.suffix}"`:i.format==="includes"?`Stringa non valida: deve includere "${i.includes}"`:i.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${E(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}},"error");function Pb(){return{localeError:ej()}}s(Pb,"default");var tj=s(()=>{let e={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},o={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u7121\u52B9\u306A\u5165\u529B: instanceof ${n.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${c}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u5165\u529B: ${i}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${c}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":return n.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${O(n.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${E(n.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let i=n.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",a=t(n.origin);return a?`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${a.unit??"\u8981\u7D20"}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let i=n.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",a=t(n.origin);return a?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${a.unit}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${i.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${r[i.format]??n.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${n.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${n.keys.length>1?"\u7FA4":""}: ${E(n.keys,"\u3001")}`;case"invalid_key":return`${n.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${n.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}},"error");function Ib(){return{localeError:tj()}}s(Ib,"default");var nj=s(()=>{let e={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",json_string:"JSON \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},o={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${n.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${c}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${c}`}case"invalid_value":return n.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${O(n.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${E(n.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} \u10D8\u10E7\u10DD\u10E1 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${i.prefix}"-\u10D8\u10D7`:i.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${i.suffix}"-\u10D8\u10D7`:i.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${i.includes}"-\u10E1`:i.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${i.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${n.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${n.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${E(n.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${n.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${n.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}},"error");function Tb(){return{localeError:nj()}}s(Tb,"default");var rj=s(()=>{let e={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},o={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${n.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${c}`:`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${c}`}case"invalid_value":return n.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${O(n.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${n.maximum.toString()} ${a.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${i} ${n.minimum.toString()} ${a.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${i.prefix}"`:i.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${i.suffix}"`:i.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${i.includes}"`:i.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${i.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${n.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${E(n.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${n.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${n.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}},"error");function Xa(){return{localeError:rj()}}s(Xa,"default");function xb(){return Xa()}s(xb,"default");var oj=s(()=>{let e={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${n.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${c}\uC785\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${i}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${c}\uC785\uB2C8\uB2E4`}case"invalid_value":return n.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${O(n.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${E(n.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let i=n.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",a=i==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",c=t(n.origin),l=c?.unit??"\uC694\uC18C";return c?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()}${l} ${i}${a}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()} ${i}${a}`}case"too_small":{let i=n.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",a=i==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",c=t(n.origin),l=c?.unit??"\uC694\uC18C";return c?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()}${l} ${i}${a}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()} ${i}${a}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:i.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${i.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${r[i.format]??n.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${n.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${E(n.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${n.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${n.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}},"error");function _b(){return{localeError:oj()}}s(_b,"default");var ec=s(e=>e.charAt(0).toUpperCase()+e.slice(1),"capitalizeFirstCharacter");function NR(e){let t=Math.abs(e),r=t%10,o=t%100;return o>=11&&o<=19||r===0?"many":r===1?"one":"few"}s(NR,"getUnitTypeFromNumber");var ij=s(()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function t(n,i,a,c){let l=e[n]??null;return l===null?l:{unit:l.unit[i],verb:l.verb[c][a?"inclusive":"notInclusive"]}}s(t,"getSizing");let r={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"},o={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Gautas tipas ${c}, o tik\u0117tasi - instanceof ${n.expected}`:`Gautas tipas ${c}, o tik\u0117tasi - ${i}`}case"invalid_value":return n.values.length===1?`Privalo b\u016Bti ${O(n.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${E(n.values,"|")} pasirinkim\u0173`;case"too_big":{let i=o[n.origin]??n.origin,a=t(n.origin,NR(Number(n.maximum)),n.inclusive??!1,"smaller");if(a?.verb)return`${ec(i??n.origin??"reik\u0161m\u0117")} ${a.verb} ${n.maximum.toString()} ${a.unit??"element\u0173"}`;let c=n.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${ec(i??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${c} ${n.maximum.toString()} ${a?.unit}`}case"too_small":{let i=o[n.origin]??n.origin,a=t(n.origin,NR(Number(n.minimum)),n.inclusive??!1,"bigger");if(a?.verb)return`${ec(i??n.origin??"reik\u0161m\u0117")} ${a.verb} ${n.minimum.toString()} ${a.unit??"element\u0173"}`;let c=n.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${ec(i??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${c} ${n.minimum.toString()} ${a?.unit}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${i.prefix}"`:i.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${i.suffix}"`:i.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${i.includes}"`:i.format==="regex"?`Eilut\u0117 privalo atitikti ${i.pattern}`:`Neteisingas ${r[i.format]??n.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${n.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${n.keys.length>1?"i":"as"} rakt${n.keys.length>1?"ai":"as"}: ${E(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let i=o[n.origin]??n.origin;return`${ec(i??n.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}},"error");function Rb(){return{localeError:ij()}}s(Rb,"default");var sj=s(()=>{let e={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},o={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${n.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${c}`:`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${c}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${O(n.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${i}${n.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin} \u0434\u0430 \u0438\u043C\u0430 ${i}${n.minimum.toString()} ${a.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${E(n.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${n.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${n.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}},"error");function Ab(){return{localeError:sj()}}s(Ab,"default");var aj=s(()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"nombor"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Input tidak sah: dijangka instanceof ${n.expected}, diterima ${c}`:`Input tidak sah: dijangka ${i}, diterima ${c}`}case"invalid_value":return n.values.length===1?`Input tidak sah: dijangka ${O(n.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Terlalu besar: dijangka ${n.origin??"nilai"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Terlalu kecil: dijangka ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${n.origin} adalah ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`String tidak sah: mesti bermula dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak sah: mesti mengandungi "${i.includes}"`:i.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${i.pattern}`:`${r[i.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${E(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}},"error");function Ob(){return{localeError:aj()}}s(Ob,"default");var cj=s(()=>{let e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},o={nan:"NaN",number:"getal"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ongeldige invoer: verwacht instanceof ${n.expected}, ontving ${c}`:`Ongeldige invoer: verwacht ${i}, ontving ${c}`}case"invalid_value":return n.values.length===1?`Ongeldige invoer: verwacht ${O(n.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin),c=n.origin==="date"?"laat":n.origin==="string"?"lang":"groot";return a?`Te ${c}: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} ${a.unit??"elementen"} ${a.verb}`:`Te ${c}: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} is`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin),c=n.origin==="date"?"vroeg":n.origin==="string"?"kort":"klein";return a?`Te ${c}: verwacht dat ${n.origin} ${i}${n.minimum.toString()} ${a.unit} ${a.verb}`:`Te ${c}: verwacht dat ${n.origin} ${i}${n.minimum.toString()} is`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ongeldige tekst: moet met "${i.prefix}" beginnen`:i.format==="ends_with"?`Ongeldige tekst: moet op "${i.suffix}" eindigen`:i.format==="includes"?`Ongeldige tekst: moet "${i.includes}" bevatten`:i.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`:`Ongeldig: ${r[i.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}},"error");function $b(){return{localeError:cj()}}s($b,"default");var lj=s(()=>{let e={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"tall",array:"liste"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ugyldig input: forventet instanceof ${n.expected}, fikk ${c}`:`Ugyldig input: forventet ${i}, fikk ${c}`}case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventet ${O(n.values[0])}`:`Ugyldig valg: forventet en av ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${i}${n.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`For lite(n): forventet ${n.origin} til \xE5 ha ${i}${n.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${n.origin} til \xE5 ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${r[i.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${E(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}},"error");function Cb(){return{localeError:lj()}}s(Cb,"default");var dj=s(()=>{let e={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},o={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`F\xE2sit giren: umulan instanceof ${n.expected}, al\u0131nan ${c}`:`F\xE2sit giren: umulan ${i}, al\u0131nan ${c}`}case"invalid_value":return n.values.length===1?`F\xE2sit giren: umulan ${O(n.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${i}${n.maximum.toString()} ${a.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${i}${n.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${i}${n.minimum.toString()} ${a.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${i}${n.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let i=n;return i.format==="starts_with"?`F\xE2sit metin: "${i.prefix}" ile ba\u015Flamal\u0131.`:i.format==="ends_with"?`F\xE2sit metin: "${i.suffix}" ile bitmeli.`:i.format==="includes"?`F\xE2sit metin: "${i.includes}" ihtiv\xE2 etmeli.`:i.format==="regex"?`F\xE2sit metin: ${i.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${r[i.format]??n.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${n.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${n.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}},"error");function Nb(){return{localeError:dj()}}s(Nb,"default");var uj=s(()=>{let e={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},o={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${n.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${c} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`:`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${i} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${c} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":return n.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${O(n.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${E(n.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} \u0648\u064A`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} ${a.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} \u0648\u064A`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:i.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:i.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${i.includes}" \u0648\u0644\u0631\u064A`:i.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${i.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${r[i.format]??n.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${n.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${n.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${E(n.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${n.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${n.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}},"error");function Lb(){return{localeError:uj()}}s(Lb,"default");var pj=s(()=>{let e={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"},o={nan:"NaN",number:"liczba",array:"tablica"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${n.expected}, otrzymano ${c}`:`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${i}, otrzymano ${c}`}case"invalid_value":return n.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${O(n.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${n.maximum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${n.minimum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${i.prefix}"`:i.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${i.suffix}"`:i.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${i.includes}"`:i.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${i.pattern}`:`Nieprawid\u0142ow(y/a/e) ${r[i.format]??n.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${n.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${n.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}},"error");function Db(){return{localeError:pj()}}s(Db,"default");var mj=s(()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",number:"n\xFAmero",null:"nulo"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Tipo inv\xE1lido: esperado instanceof ${n.expected}, recebido ${c}`:`Tipo inv\xE1lido: esperado ${i}, recebido ${c}`}case"invalid_value":return n.values.length===1?`Entrada inv\xE1lida: esperado ${O(n.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Muito grande: esperado que ${n.origin??"valor"} tivesse ${i}${n.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${n.origin??"valor"} fosse ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Muito pequeno: esperado que ${n.origin} tivesse ${i}${n.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${n.origin} fosse ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${i.prefix}"`:i.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${i.suffix}"`:i.format==="includes"?`Texto inv\xE1lido: deve incluir "${i.includes}"`:i.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${i.pattern}`:`${r[i.format]??n.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${n.origin}`;default:return"Campo inv\xE1lido"}}},"error");function Gb(){return{localeError:mj()}}s(Gb,"default");function LR(e,t,r,o){let n=Math.abs(e),i=n%10,a=n%100;return a>=11&&a<=19?o:i===1?t:i>=2&&i<=4?r:o}s(LR,"getRussianPlural");var fj=s(()=>{let e={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${c}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${i}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${c}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${O(n.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a){let c=Number(n.maximum),l=LR(c,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${n.maximum.toString()} ${l}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a){let c=Number(n.minimum),l=LR(c,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${n.minimum.toString()} ${l}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin} \u0431\u0443\u0434\u0435\u0442 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${n.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u0438":""}: ${E(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}},"error");function Ub(){return{localeError:fj()}}s(Ub,"default");var gj=s(()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},o={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Neveljaven vnos: pri\u010Dakovano instanceof ${n.expected}, prejeto ${c}`:`Neveljaven vnos: pri\u010Dakovano ${i}, prejeto ${c}`}case"invalid_value":return n.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${O(n.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} imelo ${i}${n.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Premajhno: pri\u010Dakovano, da bo ${n.origin} imelo ${i}${n.minimum.toString()} ${a.unit}`:`Premajhno: pri\u010Dakovano, da bo ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${i.prefix}"`:i.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${i.suffix}"`:i.format==="includes"?`Neveljaven niz: mora vsebovati "${i.includes}"`:i.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`:`Neveljaven ${r[i.format]??n.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${E(n.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}},"error");function jb(){return{localeError:gj()}}s(jb,"default");var hj=s(()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},o={nan:"NaN",number:"antal",array:"lista"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${n.expected}, fick ${c}`:`Ogiltig inmatning: f\xF6rv\xE4ntat ${i}, fick ${c}`}case"invalid_value":return n.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${O(n.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`F\xF6r stor(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.maximum.toString()} ${a.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${n.origin??"v\xE4rdet"} att ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.minimum.toString()} ${a.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${i.prefix}"`:i.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${i.suffix}"`:i.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${i.includes}"`:i.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${i.pattern}"`:`Ogiltig(t) ${r[i.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${E(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${n.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}},"error");function Mb(){return{localeError:hj()}}s(Mb,"default");var yj=s(()=>{let e={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${n.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${c}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${c}`}case"invalid_value":return n.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${O(n.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${E(n.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${n.maximum.toString()} ${a.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${n.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin} ${i}${n.minimum.toString()} ${a.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin} ${i}${n.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${i.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${n.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${n.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${n.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}},"error");function qb(){return{localeError:yj()}}s(qb,"default");var vj=s(()=>{let e={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},o={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${n.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${c}`:`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${i} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${c}`}case"invalid_value":return n.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${O(n.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",a=t(n.origin);return a?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.maximum.toString()} ${a.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",a=t(n.origin);return a?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.minimum.toString()} ${a.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${i.prefix}"`:i.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${i.suffix}"`:i.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${i.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:i.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${i.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${n.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${E(n.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${n.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${n.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}},"error");function Fb(){return{localeError:vj()}}s(Fb,"default");var bj=s(()=>{let e={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${n.expected}, al\u0131nan ${c}`:`Ge\xE7ersiz de\u011Fer: beklenen ${i}, al\u0131nan ${c}`}case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${O(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${i}${n.maximum.toString()} ${a.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${i}${n.minimum.toString()} ${a.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ge\xE7ersiz metin: "${i.prefix}" ile ba\u015Flamal\u0131`:i.format==="ends_with"?`Ge\xE7ersiz metin: "${i.suffix}" ile bitmeli`:i.format==="includes"?`Ge\xE7ersiz metin: "${i.includes}" i\xE7ermeli`:i.format==="regex"?`Ge\xE7ersiz metin: ${i.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[i.format]??n.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${n.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${n.keys.length>1?"lar":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${n.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}},"error");function zb(){return{localeError:bj()}}s(zb,"default");var wj=s(()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${n.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${c}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${i}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${c}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${O(n.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin} \u0431\u0443\u0434\u0435 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${n.keys.length>1?"\u0456":""}: ${E(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${n.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}},"error");function tc(){return{localeError:wj()}}s(tc,"default");function Bb(){return tc()}s(Bb,"default");var kj=s(()=>{let e={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},o={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${n.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${c} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`:`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${i} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${c} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":return n.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${O(n.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${E(n.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${i}${n.maximum.toString()} ${a.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${i}${n.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u06D2 ${i}${n.minimum.toString()} ${a.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u0627 ${i}${n.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${i.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${n.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${n.keys.length>1?"\u0632":""}: ${E(n.keys,"\u060C ")}`;case"invalid_key":return`${n.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${n.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}},"error");function Kb(){return{localeError:kj()}}s(Kb,"default");var Ej=s(()=>{let e={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},o={nan:"NaN",number:"raqam",array:"massiv"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${n.expected}, qabul qilingan ${c}`:`Noto\u2018g\u2018ri kirish: kutilgan ${i}, qabul qilingan ${c}`}case"invalid_value":return n.values.length===1?`Noto\u2018g\u2018ri kirish: kutilgan ${O(n.values[0])}`:`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Juda katta: kutilgan ${n.origin??"qiymat"} ${i}${n.maximum.toString()} ${a.unit} ${a.verb}`:`Juda katta: kutilgan ${n.origin??"qiymat"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Juda kichik: kutilgan ${n.origin} ${i}${n.minimum.toString()} ${a.unit} ${a.verb}`:`Juda kichik: kutilgan ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Noto\u2018g\u2018ri satr: "${i.prefix}" bilan boshlanishi kerak`:i.format==="ends_with"?`Noto\u2018g\u2018ri satr: "${i.suffix}" bilan tugashi kerak`:i.format==="includes"?`Noto\u2018g\u2018ri satr: "${i.includes}" ni o\u2018z ichiga olishi kerak`:i.format==="regex"?`Noto\u2018g\u2018ri satr: ${i.pattern} shabloniga mos kelishi kerak`:`Noto\u2018g\u2018ri ${r[i.format]??n.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${n.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${n.keys.length>1?"lar":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${n.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}},"error");function Qb(){return{localeError:Ej()}}s(Qb,"default");var Sj=s(()=>{let e={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},o={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${n.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${c}`:`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${i}, nh\u1EADn \u0111\u01B0\u1EE3c ${c}`}case"invalid_value":return n.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${O(n.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${i.prefix}"`:i.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${i.suffix}"`:i.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${i.includes}"`:i.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${i.pattern}`:`${r[i.format]??n.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${n.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${E(n.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${n.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${n.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}},"error");function Vb(){return{localeError:Sj()}}s(Vb,"default");var Pj=s(()=>{let e={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"},o={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${n.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${c}`:`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${i}\uFF0C\u5B9E\u9645\u63A5\u6536 ${c}`}case"invalid_value":return n.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${O(n.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${i}${n.maximum.toString()} ${a.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${i}${n.minimum.toString()} ${a.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.prefix}" \u5F00\u5934`:i.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.suffix}" \u7ED3\u5C3E`:i.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${i.pattern}`:`\u65E0\u6548${r[i.format]??n.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${n.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${n.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}},"error");function Hb(){return{localeError:Pj()}}s(Hb,"default");var Ij=s(()=>{let e={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${n.expected}\uFF0C\u4F46\u6536\u5230 ${c}`:`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${i}\uFF0C\u4F46\u6536\u5230 ${c}`}case"invalid_value":return n.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${O(n.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${i}${n.maximum.toString()} ${a.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${i}${n.minimum.toString()} ${a.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.prefix}" \u958B\u982D`:i.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.suffix}" \u7D50\u5C3E`:i.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${i.pattern}`:`\u7121\u6548\u7684 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${n.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${n.keys.length>1?"\u5011":""}\uFF1A${E(n.keys,"\u3001")}`;case"invalid_key":return`${n.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${n.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}},"error");function Wb(){return{localeError:Ij()}}s(Wb,"default");var Tj=s(()=>{let e={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function t(n){return e[n]??null}s(t,"getSizing");let r={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},o={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=$(n.input),c=o[a]??a;return/^[A-Z]/.test(n.expected)?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${n.expected}, \xE0m\u1ECD\u0300 a r\xED ${c}`:`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${i}, \xE0m\u1ECD\u0300 a r\xED ${c}`}case"invalid_value":return n.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${O(n.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin??"iye"} ${a.verb} ${i}${n.maximum} ${a.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${n.maximum}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin} ${a.verb} ${i}${n.minimum} ${a.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${n.minimum}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${i.prefix}"`:i.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${i.suffix}"`:i.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${i.includes}"`:i.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${i.pattern}`:`A\u1E63\xEC\u1E63e: ${r[i.format]??n.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${n.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${E(n.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${n.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${n.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}},"error");function Jb(){return{localeError:Tj()}}s(Jb,"default");var DR,Zb=Symbol("ZodOutput"),Yb=Symbol("ZodInput"),Ou=class{static{s(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function $u(){return new Ou}s($u,"registry");(DR=globalThis).__zod_globalRegistry??(DR.__zod_globalRegistry=$u());var Fe=globalThis.__zod_globalRegistry;function Xb(e,t){return new e({type:"string",...L(t)})}s(Xb,"_string");function ew(e,t){return new e({type:"string",coerce:!0,...L(t)})}s(ew,"_coercedString");function Cu(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...L(t)})}s(Cu,"_email");function rc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...L(t)})}s(rc,"_guid");function Nu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...L(t)})}s(Nu,"_uuid");function Lu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...L(t)})}s(Lu,"_uuidv4");function Du(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...L(t)})}s(Du,"_uuidv6");function Gu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...L(t)})}s(Gu,"_uuidv7");function oc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...L(t)})}s(oc,"_url");function Uu(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...L(t)})}s(Uu,"_emoji");function ju(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...L(t)})}s(ju,"_nanoid");function Mu(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...L(t)})}s(Mu,"_cuid");function qu(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...L(t)})}s(qu,"_cuid2");function Fu(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...L(t)})}s(Fu,"_ulid");function zu(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...L(t)})}s(zu,"_xid");function Bu(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...L(t)})}s(Bu,"_ksuid");function Ku(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...L(t)})}s(Ku,"_ipv4");function Qu(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...L(t)})}s(Qu,"_ipv6");function tw(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...L(t)})}s(tw,"_mac");function Vu(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...L(t)})}s(Vu,"_cidrv4");function Hu(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...L(t)})}s(Hu,"_cidrv6");function Wu(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...L(t)})}s(Wu,"_base64");function Ju(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...L(t)})}s(Ju,"_base64url");function Zu(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...L(t)})}s(Zu,"_e164");function Yu(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...L(t)})}s(Yu,"_jwt");var nw={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function rw(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...L(t)})}s(rw,"_isoDateTime");function ow(e,t){return new e({type:"string",format:"date",check:"string_format",...L(t)})}s(ow,"_isoDate");function iw(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...L(t)})}s(iw,"_isoTime");function sw(e,t){return new e({type:"string",format:"duration",check:"string_format",...L(t)})}s(sw,"_isoDuration");function aw(e,t){return new e({type:"number",checks:[],...L(t)})}s(aw,"_number");function cw(e,t){return new e({type:"number",coerce:!0,checks:[],...L(t)})}s(cw,"_coercedNumber");function lw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...L(t)})}s(lw,"_int");function dw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...L(t)})}s(dw,"_float32");function uw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...L(t)})}s(uw,"_float64");function pw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...L(t)})}s(pw,"_int32");function mw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...L(t)})}s(mw,"_uint32");function fw(e,t){return new e({type:"boolean",...L(t)})}s(fw,"_boolean");function gw(e,t){return new e({type:"boolean",coerce:!0,...L(t)})}s(gw,"_coercedBoolean");function hw(e,t){return new e({type:"bigint",...L(t)})}s(hw,"_bigint");function yw(e,t){return new e({type:"bigint",coerce:!0,...L(t)})}s(yw,"_coercedBigint");function vw(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...L(t)})}s(vw,"_int64");function bw(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...L(t)})}s(bw,"_uint64");function ww(e,t){return new e({type:"symbol",...L(t)})}s(ww,"_symbol");function kw(e,t){return new e({type:"undefined",...L(t)})}s(kw,"_undefined");function Ew(e,t){return new e({type:"null",...L(t)})}s(Ew,"_null");function Sw(e){return new e({type:"any"})}s(Sw,"_any");function Pw(e){return new e({type:"unknown"})}s(Pw,"_unknown");function Iw(e,t){return new e({type:"never",...L(t)})}s(Iw,"_never");function Tw(e,t){return new e({type:"void",...L(t)})}s(Tw,"_void");function xw(e,t){return new e({type:"date",...L(t)})}s(xw,"_date");function _w(e,t){return new e({type:"date",coerce:!0,...L(t)})}s(_w,"_coercedDate");function Rw(e,t){return new e({type:"nan",...L(t)})}s(Rw,"_nan");function xn(e,t){return new wu({check:"less_than",...L(t),value:e,inclusive:!1})}s(xn,"_lt");function kt(e,t){return new wu({check:"less_than",...L(t),value:e,inclusive:!0})}s(kt,"_lte");function _n(e,t){return new ku({check:"greater_than",...L(t),value:e,inclusive:!1})}s(_n,"_gt");function tt(e,t){return new ku({check:"greater_than",...L(t),value:e,inclusive:!0})}s(tt,"_gte");function Xu(e){return _n(0,e)}s(Xu,"_positive");function ep(e){return xn(0,e)}s(ep,"_negative");function tp(e){return kt(0,e)}s(tp,"_nonpositive");function np(e){return tt(0,e)}s(np,"_nonnegative");function Ar(e,t){return new Ay({check:"multiple_of",...L(t),value:e})}s(Ar,"_multipleOf");function Or(e,t){return new Cy({check:"max_size",...L(t),maximum:e})}s(Or,"_maxSize");function Rn(e,t){return new Ny({check:"min_size",...L(t),minimum:e})}s(Rn,"_minSize");function To(e,t){return new Ly({check:"size_equals",...L(t),size:e})}s(To,"_size");function xo(e,t){return new Dy({check:"max_length",...L(t),maximum:e})}s(xo,"_maxLength");function Yn(e,t){return new Gy({check:"min_length",...L(t),minimum:e})}s(Yn,"_minLength");function _o(e,t){return new Uy({check:"length_equals",...L(t),length:e})}s(_o,"_length");function Mi(e,t){return new jy({check:"string_format",format:"regex",...L(t),pattern:e})}s(Mi,"_regex");function qi(e){return new My({check:"string_format",format:"lowercase",...L(e)})}s(qi,"_lowercase");function Fi(e){return new qy({check:"string_format",format:"uppercase",...L(e)})}s(Fi,"_uppercase");function zi(e,t){return new Fy({check:"string_format",format:"includes",...L(t),includes:e})}s(zi,"_includes");function Bi(e,t){return new zy({check:"string_format",format:"starts_with",...L(t),prefix:e})}s(Bi,"_startsWith");function Ki(e,t){return new By({check:"string_format",format:"ends_with",...L(t),suffix:e})}s(Ki,"_endsWith");function rp(e,t,r){return new Ky({check:"property",property:e,schema:t,...L(r)})}s(rp,"_property");function Qi(e,t){return new Qy({check:"mime_type",mime:e,...L(t)})}s(Qi,"_mime");function nn(e){return new Vy({check:"overwrite",tx:e})}s(nn,"_overwrite");function Vi(e){return nn(t=>t.normalize(e))}s(Vi,"_normalize");function Hi(){return nn(e=>e.trim())}s(Hi,"_trim");function Wi(){return nn(e=>e.toLowerCase())}s(Wi,"_toLowerCase");function Ji(){return nn(e=>e.toUpperCase())}s(Ji,"_toUpperCase");function Zi(){return nn(e=>Kh(e))}s(Zi,"_slugify");function Aw(e,t,r){return new e({type:"array",element:t,...L(r)})}s(Aw,"_array");function _j(e,t,r){return new e({type:"union",options:t,...L(r)})}s(_j,"_union");function Rj(e,t,r){return new e({type:"union",options:t,inclusive:!1,...L(r)})}s(Rj,"_xor");function Aj(e,t,r,o){return new e({type:"union",options:r,discriminator:t,...L(o)})}s(Aj,"_discriminatedUnion");function Oj(e,t,r){return new e({type:"intersection",left:t,right:r})}s(Oj,"_intersection");function $j(e,t,r,o){let n=r instanceof Q,i=n?o:r,a=n?r:null;return new e({type:"tuple",items:t,rest:a,...L(i)})}s($j,"_tuple");function Cj(e,t,r,o){return new e({type:"record",keyType:t,valueType:r,...L(o)})}s(Cj,"_record");function Nj(e,t,r,o){return new e({type:"map",keyType:t,valueType:r,...L(o)})}s(Nj,"_map");function Lj(e,t,r){return new e({type:"set",valueType:t,...L(r)})}s(Lj,"_set");function Dj(e,t,r){let o=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new e({type:"enum",entries:o,...L(r)})}s(Dj,"_enum");function Gj(e,t,r){return new e({type:"enum",entries:t,...L(r)})}s(Gj,"_nativeEnum");function Uj(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...L(r)})}s(Uj,"_literal");function Ow(e,t){return new e({type:"file",...L(t)})}s(Ow,"_file");function jj(e,t){return new e({type:"transform",transform:t})}s(jj,"_transform");function Mj(e,t){return new e({type:"optional",innerType:t})}s(Mj,"_optional");function qj(e,t){return new e({type:"nullable",innerType:t})}s(qj,"_nullable");function Fj(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Vh(r)}})}s(Fj,"_default");function zj(e,t,r){return new e({type:"nonoptional",innerType:t,...L(r)})}s(zj,"_nonoptional");function Bj(e,t){return new e({type:"success",innerType:t})}s(Bj,"_success");function Kj(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:()=>r})}s(Kj,"_catch");function Qj(e,t,r){return new e({type:"pipe",in:t,out:r})}s(Qj,"_pipe");function Vj(e,t){return new e({type:"readonly",innerType:t})}s(Vj,"_readonly");function Hj(e,t,r){return new e({type:"template_literal",parts:t,...L(r)})}s(Hj,"_templateLiteral");function Wj(e,t){return new e({type:"lazy",getter:t})}s(Wj,"_lazy");function Jj(e,t){return new e({type:"promise",innerType:t})}s(Jj,"_promise");function $w(e,t,r){let o=L(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}s($w,"_custom");function Cw(e,t,r){return new e({type:"custom",check:"custom",fn:t,...L(r)})}s(Cw,"_refine");function Nw(e){let t=GR(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Ci(o,r.value,t._zod.def));else{let n=o;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(Ci(n))}},e(r.value,r)));return t}s(Nw,"_superRefine");function GR(e,t){let r=new ue({check:"custom",...L(t)});return r._zod.check=e,r}s(GR,"_check");function Lw(e){let t=new ue({check:"describe"});return t._zod.onattach=[r=>{let o=Fe.get(r)??{};Fe.add(r,{...o,description:e})}],t._zod.check=()=>{},t}s(Lw,"describe");function Dw(e){let t=new ue({check:"meta"});return t._zod.onattach=[r=>{let o=Fe.get(r)??{};Fe.add(r,{...o,...e})}],t._zod.check=()=>{},t}s(Dw,"meta");function Gw(e,t){let r=L(t),o=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(o=o.map(f=>typeof f=="string"?f.toLowerCase():f),n=n.map(f=>typeof f=="string"?f.toLowerCase():f));let i=new Set(o),a=new Set(n),c=e.Codec??Za,l=e.Boolean??Wa,d=e.String??Io,u=new d({type:"string",error:r.error}),m=new l({type:"boolean",error:r.error}),p=new c({type:"pipe",in:u,out:m,transform:s(((f,g)=>{let h=f;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:a.has(h)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:g.value,inst:p,continue:!1}),{})}),"transform"),reverseTransform:s(((f,g)=>f===!0?o[0]||"true":n[0]||"false"),"reverseTransform"),error:r.error});return p}s(Gw,"_stringbool");function Yi(e,t,r,o={}){let n=L(o),i={...L(o),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:c=>r.test(c),...n};return r instanceof RegExp&&(i.pattern=r),new e(i)}s(Yi,"_stringFormat");function $r(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Fe,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}s($r,"initializeContext");function oe(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let u={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,u);else{let p=a.schema,f=t.processors[n.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(e,t,p,u)}let m=e._zod.parent;m&&(a.ref||(a.ref=m),oe(m,t,u),t.seen.get(m).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),t.io==="input"&&nt(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((o=a.schema).default??(o.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}s(oe,"process");function Cr(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let a of e.seen.entries()){let c=e.metadataRegistry.get(a[0])?.id;if(c){let l=o.get(c);if(l&&l!==a[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(c,a[0])}}let n=s(a=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let m=e.external.registry.get(a[0])?.id,p=e.external.uri??(g=>g);if(m)return{ref:p(m)};let f=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=f,{defId:f,ref:`${p("__shared")}#/${c}/${f}`}}if(a[1]===r)return{ref:"#"};let d=`#/${c}/`,u=a[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:d+u}},"makeURI"),i=s(a=>{if(a[1].schema.$ref)return;let c=a[1],{ref:l,defId:d}=n(a);c.def={...c.schema},d&&(c.defId=d);let u=c.schema;for(let m in u)delete u[m];u.$ref=l},"extractToDef");if(e.cycles==="throw")for(let a of e.seen.entries()){let c=a[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
452
|
+
|
|
453
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let c=a[1];if(t===a[0]){i(a);continue}if(e.external){let d=e.external.registry.get(a[0])?.id;if(t!==a[0]&&d){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(c.cycle){i(a);continue}if(c.count>1&&e.reused==="ref"){i(a);continue}}}s(Cr,"extractDefs");function Nr(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=s(a=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,d={...l},u=c.ref;if(c.ref=null,u){o(u);let p=e.seen.get(u),f=p.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(f)):Object.assign(l,f),Object.assign(l,d),a._zod.parent===u)for(let h in l)h==="$ref"||h==="allOf"||h in d||delete l[h];if(f.$ref&&p.def)for(let h in l)h==="$ref"||h==="allOf"||h in p.def&&JSON.stringify(l[h])===JSON.stringify(p.def[h])&&delete l[h]}let m=a._zod.parent;if(m&&m!==u){o(m);let p=e.seen.get(m);if(p?.schema.$ref&&(l.$ref=p.schema.$ref,p.def))for(let f in l)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(l[f])===JSON.stringify(p.def[f])&&delete l[f]}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})},"flattenRef");for(let a of[...e.seen.entries()].reverse())o(a[0]);let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}Object.assign(n,r.def??r.schema);let i=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Xi(t,"input",e.processors),output:Xi(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}s(Nr,"finalize");function nt(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return nt(o.element,r);if(o.type==="set")return nt(o.valueType,r);if(o.type==="lazy")return nt(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return nt(o.innerType,r);if(o.type==="intersection")return nt(o.left,r)||nt(o.right,r);if(o.type==="record"||o.type==="map")return nt(o.keyType,r)||nt(o.valueType,r);if(o.type==="pipe")return nt(o.in,r)||nt(o.out,r);if(o.type==="object"){for(let n in o.shape)if(nt(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(nt(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(nt(n,r))return!0;return!!(o.rest&&nt(o.rest,r))}return!1}s(nt,"isTransforming");var Uw=s((e,t={})=>r=>{let o=$r({...r,processors:t});return oe(e,o),Cr(o,e),Nr(o,e)},"createToJSONSchemaMethod"),Xi=s((e,t,r={})=>o=>{let{libraryOptions:n,target:i}=o??{},a=$r({...n??{},target:i,io:t,processors:r});return oe(e,a),Cr(a,e),Nr(a,e)},"createStandardJSONSchemaMethod");var Zj={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},jw=s((e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:a,format:c,patterns:l,contentEncoding:d}=e._zod.bag;if(typeof i=="number"&&(n.minLength=i),typeof a=="number"&&(n.maxLength=a),c&&(n.format=Zj[c]??c,n.format===""&&delete n.format,c==="time"&&delete n.format),d&&(n.contentEncoding=d),l&&l.size>0){let u=[...l];u.length===1?n.pattern=u[0].source:u.length>1&&(n.allOf=[...u.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},"stringProcessor"),Mw=s((e,t,r,o)=>{let n=r,{minimum:i,maximum:a,format:c,multipleOf:l,exclusiveMaximum:d,exclusiveMinimum:u}=e._zod.bag;typeof c=="string"&&c.includes("int")?n.type="integer":n.type="number",typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(n.minimum=u,n.exclusiveMinimum=!0):n.exclusiveMinimum=u),typeof i=="number"&&(n.minimum=i,typeof u=="number"&&t.target!=="draft-04"&&(u>=i?delete n.minimum:delete n.exclusiveMinimum)),typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(n.maximum=d,n.exclusiveMaximum=!0):n.exclusiveMaximum=d),typeof a=="number"&&(n.maximum=a,typeof d=="number"&&t.target!=="draft-04"&&(d<=a?delete n.maximum:delete n.exclusiveMaximum)),typeof l=="number"&&(n.multipleOf=l)},"numberProcessor"),qw=s((e,t,r,o)=>{r.type="boolean"},"booleanProcessor"),Fw=s((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},"bigintProcessor"),zw=s((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},"symbolProcessor"),Bw=s((e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},"nullProcessor"),Kw=s((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},"undefinedProcessor"),Qw=s((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},"voidProcessor"),Vw=s((e,t,r,o)=>{r.not={}},"neverProcessor"),Hw=s((e,t,r,o)=>{},"anyProcessor"),Ww=s((e,t,r,o)=>{},"unknownProcessor"),Jw=s((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},"dateProcessor"),Zw=s((e,t,r,o)=>{let n=e._zod.def,i=Ua(n.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},"enumProcessor"),Yw=s((e,t,r,o)=>{let n=e._zod.def,i=[];for(let a of n.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},"literalProcessor"),Xw=s((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},"nanProcessor"),ek=s((e,t,r,o)=>{let n=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},"templateLiteralProcessor"),tk=s((e,t,r,o)=>{let n=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:c,mime:l}=e._zod.bag;a!==void 0&&(i.minLength=a),c!==void 0&&(i.maxLength=c),l?l.length===1?(i.contentMediaType=l[0],Object.assign(n,i)):(Object.assign(n,i),n.anyOf=l.map(d=>({contentMediaType:d}))):Object.assign(n,i)},"fileProcessor"),nk=s((e,t,r,o)=>{r.type="boolean"},"successProcessor"),rk=s((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},"customProcessor"),ok=s((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},"functionProcessor"),ik=s((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},"transformProcessor"),sk=s((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},"mapProcessor"),ak=s((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},"setProcessor"),ck=s((e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:a,maximum:c}=e._zod.bag;typeof a=="number"&&(n.minItems=a),typeof c=="number"&&(n.maxItems=c),n.type="array",n.items=oe(i.element,t,{...o,path:[...o.path,"items"]})},"arrayProcessor"),lk=s((e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object",n.properties={};let a=i.shape;for(let d in a)n.properties[d]=oe(a[d],t,{...o,path:[...o.path,"properties",d]});let c=new Set(Object.keys(a)),l=new Set([...c].filter(d=>{let u=i.shape[d]._zod;return t.io==="input"?u.optin===void 0:u.optout===void 0}));l.size>0&&(n.required=Array.from(l)),i.catchall?._zod.def.type==="never"?n.additionalProperties=!1:i.catchall?i.catchall&&(n.additionalProperties=oe(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},"objectProcessor"),ip=s((e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,a=n.options.map((c,l)=>oe(c,t,{...o,path:[...o.path,i?"oneOf":"anyOf",l]}));i?r.oneOf=a:r.anyOf=a},"unionProcessor"),dk=s((e,t,r,o)=>{let n=e._zod.def,i=oe(n.left,t,{...o,path:[...o.path,"allOf",0]}),a=oe(n.right,t,{...o,path:[...o.path,"allOf",1]}),c=s(d=>"allOf"in d&&Object.keys(d).length===1,"isSimpleIntersection"),l=[...c(i)?i.allOf:[i],...c(a)?a.allOf:[a]];r.allOf=l},"intersectionProcessor"),uk=s((e,t,r,o)=>{let n=r,i=e._zod.def;n.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",l=i.items.map((p,f)=>oe(p,t,{...o,path:[...o.path,a,f]})),d=i.rest?oe(i.rest,t,{...o,path:[...o.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(n.prefixItems=l,d&&(n.items=d)):t.target==="openapi-3.0"?(n.items={anyOf:l},d&&n.items.anyOf.push(d),n.minItems=l.length,d||(n.maxItems=l.length)):(n.items=l,d&&(n.additionalItems=d));let{minimum:u,maximum:m}=e._zod.bag;typeof u=="number"&&(n.minItems=u),typeof m=="number"&&(n.maxItems=m)},"tupleProcessor"),pk=s((e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object";let a=i.keyType,l=a._zod.bag?.patterns;if(i.mode==="loose"&&l&&l.size>0){let u=oe(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let m of l)n.patternProperties[m.source]=u}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=oe(i.keyType,t,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=oe(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]});let d=a._zod.values;if(d){let u=[...d].filter(m=>typeof m=="string"||typeof m=="number");u.length>0&&(n.required=u)}},"recordProcessor"),mk=s((e,t,r,o)=>{let n=e._zod.def,i=oe(n.innerType,t,o),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=n.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},"nullableProcessor"),fk=s((e,t,r,o)=>{let n=e._zod.def;oe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},"nonoptionalProcessor"),gk=s((e,t,r,o)=>{let n=e._zod.def;oe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},"defaultProcessor"),hk=s((e,t,r,o)=>{let n=e._zod.def;oe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},"prefaultProcessor"),yk=s((e,t,r,o)=>{let n=e._zod.def;oe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let a;try{a=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},"catchProcessor"),vk=s((e,t,r,o)=>{let n=e._zod.def,i=t.io==="input"?n.in._zod.def.type==="transform"?n.out:n.in:n.out;oe(i,t,o);let a=t.seen.get(e);a.ref=i},"pipeProcessor"),bk=s((e,t,r,o)=>{let n=e._zod.def;oe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0},"readonlyProcessor"),wk=s((e,t,r,o)=>{let n=e._zod.def;oe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},"promiseProcessor"),sp=s((e,t,r,o)=>{let n=e._zod.def;oe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},"optionalProcessor"),kk=s((e,t,r,o)=>{let n=e._zod.innerType;oe(n,t,o);let i=t.seen.get(e);i.ref=n},"lazyProcessor"),op={string:jw,number:Mw,boolean:qw,bigint:Fw,symbol:zw,null:Bw,undefined:Kw,void:Qw,never:Vw,any:Hw,unknown:Ww,date:Jw,enum:Zw,literal:Yw,nan:Xw,template_literal:ek,file:tk,success:nk,custom:rk,function:ok,transform:ik,map:sk,set:ak,array:ck,object:lk,union:ip,intersection:dk,tuple:uk,record:pk,nullable:mk,nonoptional:fk,default:gk,prefault:hk,catch:yk,pipe:vk,readonly:bk,promise:wk,optional:sp,lazy:kk};function ap(e,t){if("_idmap"in e){let o=e,n=$r({...t,processors:op}),i={};for(let l of o._idmap.entries()){let[d,u]=l;oe(u,n)}let a={},c={registry:o,uri:t?.uri,defs:i};n.external=c;for(let l of o._idmap.entries()){let[d,u]=l;Cr(n,u),a[d]=Nr(n,u)}if(Object.keys(i).length>0){let l=n.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[l]:i}}return{schemas:a}}let r=$r({...t,processors:op});return oe(e,r),Cr(r,e),Nr(r,e)}s(ap,"toJSONSchema");var cp=class{static{s(this,"JSONSchemaGenerator")}get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=$r({processors:op,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return oe(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),Cr(this.ctx,t);let o=Nr(this.ctx,t),{"~standard":n,...i}=o;return i}};var UR={};var ic={};me(ic,{ZodAny:()=>Kk,ZodArray:()=>Wk,ZodBase64:()=>Rp,ZodBase64URL:()=>Ap,ZodBigInt:()=>ss,ZodBigIntFormat:()=>Cp,ZodBoolean:()=>is,ZodCIDRv4:()=>xp,ZodCIDRv6:()=>_p,ZodCUID:()=>wp,ZodCUID2:()=>kp,ZodCatch:()=>yE,ZodCodec:()=>qp,ZodCustom:()=>hc,ZodCustomStringFormat:()=>rs,ZodDate:()=>uc,ZodDefault:()=>uE,ZodDiscriminatedUnion:()=>Zk,ZodE164:()=>Op,ZodEmail:()=>yp,ZodEmoji:()=>vp,ZodEnum:()=>ts,ZodExactOptional:()=>cE,ZodFile:()=>sE,ZodFunction:()=>TE,ZodGUID:()=>sc,ZodIPv4:()=>Ip,ZodIPv6:()=>Tp,ZodIntersection:()=>Yk,ZodJWT:()=>$p,ZodKSUID:()=>Pp,ZodLazy:()=>SE,ZodLiteral:()=>iE,ZodMAC:()=>Uk,ZodMap:()=>rE,ZodNaN:()=>bE,ZodNanoID:()=>bp,ZodNever:()=>Vk,ZodNonOptional:()=>jp,ZodNull:()=>zk,ZodNullable:()=>dE,ZodNumber:()=>os,ZodNumberFormat:()=>Ao,ZodObject:()=>mc,ZodOptional:()=>Up,ZodPipe:()=>Mp,ZodPrefault:()=>mE,ZodPromise:()=>IE,ZodReadonly:()=>wE,ZodRecord:()=>gc,ZodSet:()=>oE,ZodString:()=>ns,ZodStringFormat:()=>ce,ZodSuccess:()=>hE,ZodSymbol:()=>qk,ZodTemplateLiteral:()=>EE,ZodTransform:()=>aE,ZodTuple:()=>eE,ZodType:()=>X,ZodULID:()=>Ep,ZodURL:()=>dc,ZodUUID:()=>An,ZodUndefined:()=>Fk,ZodUnion:()=>fc,ZodUnknown:()=>Qk,ZodVoid:()=>Hk,ZodXID:()=>Sp,ZodXor:()=>Jk,_ZodString:()=>hp,_default:()=>pE,_function:()=>KA,any:()=>SA,array:()=>pc,base64:()=>sA,base64url:()=>aA,bigint:()=>vA,boolean:()=>Mk,catch:()=>vE,check:()=>QA,cidrv4:()=>oA,cidrv6:()=>iA,codec:()=>FA,cuid:()=>JR,cuid2:()=>ZR,custom:()=>VA,date:()=>IA,describe:()=>HA,discriminatedUnion:()=>OA,e164:()=>cA,email:()=>MR,emoji:()=>HR,enum:()=>Dp,exactOptional:()=>lE,file:()=>UA,float32:()=>fA,float64:()=>gA,function:()=>KA,guid:()=>qR,hash:()=>mA,hex:()=>pA,hostname:()=>uA,httpUrl:()=>VR,instanceof:()=>JA,int:()=>gp,int32:()=>hA,int64:()=>bA,intersection:()=>Xk,ipv4:()=>tA,ipv6:()=>rA,json:()=>YA,jwt:()=>lA,keyof:()=>TA,ksuid:()=>eA,lazy:()=>PE,literal:()=>GA,looseObject:()=>RA,looseRecord:()=>CA,mac:()=>nA,map:()=>NA,meta:()=>WA,nan:()=>qA,nanoid:()=>WR,nativeEnum:()=>DA,never:()=>Np,nonoptional:()=>gE,null:()=>Bk,nullable:()=>cc,nullish:()=>jA,number:()=>jk,object:()=>xA,optional:()=>ac,partialRecord:()=>$A,pipe:()=>lc,prefault:()=>fE,preprocess:()=>XA,promise:()=>BA,readonly:()=>kE,record:()=>nE,refine:()=>xE,set:()=>LA,strictObject:()=>_A,string:()=>fp,stringFormat:()=>dA,stringbool:()=>ZA,success:()=>MA,superRefine:()=>_E,symbol:()=>kA,templateLiteral:()=>zA,transform:()=>Gp,tuple:()=>tE,uint32:()=>yA,uint64:()=>wA,ulid:()=>YR,undefined:()=>EA,union:()=>Lp,unknown:()=>Ro,url:()=>QR,uuid:()=>FR,uuidv4:()=>zR,uuidv6:()=>BR,uuidv7:()=>KR,void:()=>PA,xid:()=>XR,xor:()=>AA});var lp={};me(lp,{endsWith:()=>Ki,gt:()=>_n,gte:()=>tt,includes:()=>zi,length:()=>_o,lowercase:()=>qi,lt:()=>xn,lte:()=>kt,maxLength:()=>xo,maxSize:()=>Or,mime:()=>Qi,minLength:()=>Yn,minSize:()=>Rn,multipleOf:()=>Ar,negative:()=>ep,nonnegative:()=>np,nonpositive:()=>tp,normalize:()=>Vi,overwrite:()=>nn,positive:()=>Xu,property:()=>rp,regex:()=>Mi,size:()=>To,slugify:()=>Zi,startsWith:()=>Bi,toLowerCase:()=>Wi,toUpperCase:()=>Ji,trim:()=>Hi,uppercase:()=>Fi});var es={};me(es,{ZodISODate:()=>up,ZodISODateTime:()=>dp,ZodISODuration:()=>mp,ZodISOTime:()=>pp,date:()=>Sk,datetime:()=>Ek,duration:()=>Ik,time:()=>Pk});var dp=b("ZodISODateTime",(e,t)=>{av.init(e,t),ce.init(e,t)});function Ek(e){return rw(dp,e)}s(Ek,"datetime");var up=b("ZodISODate",(e,t)=>{cv.init(e,t),ce.init(e,t)});function Sk(e){return ow(up,e)}s(Sk,"date");var pp=b("ZodISOTime",(e,t)=>{lv.init(e,t),ce.init(e,t)});function Pk(e){return iw(pp,e)}s(Pk,"time");var mp=b("ZodISODuration",(e,t)=>{dv.init(e,t),ce.init(e,t)});function Ik(e){return sw(mp,e)}s(Ik,"duration");var jR=s((e,t)=>{za.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:s(r=>Ka(e,r),"value")},flatten:{value:s(r=>Ba(e,r),"value")},addIssue:{value:s(r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Oi,2)},"value")},addIssues:{value:s(r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Oi,2)},"value")},isEmpty:{get(){return e.issues.length===0}}})},"initializer"),Xj=b("ZodError",jR),mt=b("ZodError",jR,{Parent:Error});var Tk=Ni(mt),xk=Li(mt),_k=Di(mt),Rk=Gi(mt),Ak=du(mt),Ok=uu(mt),$k=pu(mt),Ck=mu(mt),Nk=fu(mt),Lk=gu(mt),Dk=hu(mt),Gk=yu(mt);var X=b("ZodType",(e,t)=>(Q.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Xi(e,"input"),output:Xi(e,"output")}}),e.toJSONSchema=Uw(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(N.mergeDefs(t,{checks:[...t.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0}),e.with=e.check,e.clone=(r,o)=>et(e,r,o),e.brand=()=>e,e.register=((r,o)=>(r.add(e,o),e)),e.parse=(r,o)=>Tk(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>_k(e,r,o),e.parseAsync=async(r,o)=>xk(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Rk(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>Ak(e,r,o),e.decode=(r,o)=>Ok(e,r,o),e.encodeAsync=async(r,o)=>$k(e,r,o),e.decodeAsync=async(r,o)=>Ck(e,r,o),e.safeEncode=(r,o)=>Nk(e,r,o),e.safeDecode=(r,o)=>Lk(e,r,o),e.safeEncodeAsync=async(r,o)=>Dk(e,r,o),e.safeDecodeAsync=async(r,o)=>Gk(e,r,o),e.refine=(r,o)=>e.check(xE(r,o)),e.superRefine=r=>e.check(_E(r)),e.overwrite=r=>e.check(nn(r)),e.optional=()=>ac(e),e.exactOptional=()=>lE(e),e.nullable=()=>cc(e),e.nullish=()=>ac(cc(e)),e.nonoptional=r=>gE(e,r),e.array=()=>pc(e),e.or=r=>Lp([e,r]),e.and=r=>Xk(e,r),e.transform=r=>lc(e,Gp(r)),e.default=r=>pE(e,r),e.prefault=r=>fE(e,r),e.catch=r=>vE(e,r),e.pipe=r=>lc(e,r),e.readonly=()=>kE(e),e.describe=r=>{let o=e.clone();return Fe.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return Fe.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Fe.get(e);let o=e.clone();return Fe.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),hp=b("_ZodString",(e,t)=>{Io.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,n,i)=>jw(e,o,n,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...o)=>e.check(Mi(...o)),e.includes=(...o)=>e.check(zi(...o)),e.startsWith=(...o)=>e.check(Bi(...o)),e.endsWith=(...o)=>e.check(Ki(...o)),e.min=(...o)=>e.check(Yn(...o)),e.max=(...o)=>e.check(xo(...o)),e.length=(...o)=>e.check(_o(...o)),e.nonempty=(...o)=>e.check(Yn(1,...o)),e.lowercase=o=>e.check(qi(o)),e.uppercase=o=>e.check(Fi(o)),e.trim=()=>e.check(Hi()),e.normalize=(...o)=>e.check(Vi(...o)),e.toLowerCase=()=>e.check(Wi()),e.toUpperCase=()=>e.check(Ji()),e.slugify=()=>e.check(Zi())}),ns=b("ZodString",(e,t)=>{Io.init(e,t),hp.init(e,t),e.email=r=>e.check(Cu(yp,r)),e.url=r=>e.check(oc(dc,r)),e.jwt=r=>e.check(Yu($p,r)),e.emoji=r=>e.check(Uu(vp,r)),e.guid=r=>e.check(rc(sc,r)),e.uuid=r=>e.check(Nu(An,r)),e.uuidv4=r=>e.check(Lu(An,r)),e.uuidv6=r=>e.check(Du(An,r)),e.uuidv7=r=>e.check(Gu(An,r)),e.nanoid=r=>e.check(ju(bp,r)),e.guid=r=>e.check(rc(sc,r)),e.cuid=r=>e.check(Mu(wp,r)),e.cuid2=r=>e.check(qu(kp,r)),e.ulid=r=>e.check(Fu(Ep,r)),e.base64=r=>e.check(Wu(Rp,r)),e.base64url=r=>e.check(Ju(Ap,r)),e.xid=r=>e.check(zu(Sp,r)),e.ksuid=r=>e.check(Bu(Pp,r)),e.ipv4=r=>e.check(Ku(Ip,r)),e.ipv6=r=>e.check(Qu(Tp,r)),e.cidrv4=r=>e.check(Vu(xp,r)),e.cidrv6=r=>e.check(Hu(_p,r)),e.e164=r=>e.check(Zu(Op,r)),e.datetime=r=>e.check(Ek(r)),e.date=r=>e.check(Sk(r)),e.time=r=>e.check(Pk(r)),e.duration=r=>e.check(Ik(r))});function fp(e){return Xb(ns,e)}s(fp,"string");var ce=b("ZodStringFormat",(e,t)=>{ae.init(e,t),hp.init(e,t)}),yp=b("ZodEmail",(e,t)=>{Yy.init(e,t),ce.init(e,t)});function MR(e){return Cu(yp,e)}s(MR,"email");var sc=b("ZodGUID",(e,t)=>{Jy.init(e,t),ce.init(e,t)});function qR(e){return rc(sc,e)}s(qR,"guid");var An=b("ZodUUID",(e,t)=>{Zy.init(e,t),ce.init(e,t)});function FR(e){return Nu(An,e)}s(FR,"uuid");function zR(e){return Lu(An,e)}s(zR,"uuidv4");function BR(e){return Du(An,e)}s(BR,"uuidv6");function KR(e){return Gu(An,e)}s(KR,"uuidv7");var dc=b("ZodURL",(e,t)=>{Xy.init(e,t),ce.init(e,t)});function QR(e){return oc(dc,e)}s(QR,"url");function VR(e){return oc(dc,{protocol:/^https?$/,hostname:qt.domain,...N.normalizeParams(e)})}s(VR,"httpUrl");var vp=b("ZodEmoji",(e,t)=>{ev.init(e,t),ce.init(e,t)});function HR(e){return Uu(vp,e)}s(HR,"emoji");var bp=b("ZodNanoID",(e,t)=>{tv.init(e,t),ce.init(e,t)});function WR(e){return ju(bp,e)}s(WR,"nanoid");var wp=b("ZodCUID",(e,t)=>{nv.init(e,t),ce.init(e,t)});function JR(e){return Mu(wp,e)}s(JR,"cuid");var kp=b("ZodCUID2",(e,t)=>{rv.init(e,t),ce.init(e,t)});function ZR(e){return qu(kp,e)}s(ZR,"cuid2");var Ep=b("ZodULID",(e,t)=>{ov.init(e,t),ce.init(e,t)});function YR(e){return Fu(Ep,e)}s(YR,"ulid");var Sp=b("ZodXID",(e,t)=>{iv.init(e,t),ce.init(e,t)});function XR(e){return zu(Sp,e)}s(XR,"xid");var Pp=b("ZodKSUID",(e,t)=>{sv.init(e,t),ce.init(e,t)});function eA(e){return Bu(Pp,e)}s(eA,"ksuid");var Ip=b("ZodIPv4",(e,t)=>{uv.init(e,t),ce.init(e,t)});function tA(e){return Ku(Ip,e)}s(tA,"ipv4");var Uk=b("ZodMAC",(e,t)=>{mv.init(e,t),ce.init(e,t)});function nA(e){return tw(Uk,e)}s(nA,"mac");var Tp=b("ZodIPv6",(e,t)=>{pv.init(e,t),ce.init(e,t)});function rA(e){return Qu(Tp,e)}s(rA,"ipv6");var xp=b("ZodCIDRv4",(e,t)=>{fv.init(e,t),ce.init(e,t)});function oA(e){return Vu(xp,e)}s(oA,"cidrv4");var _p=b("ZodCIDRv6",(e,t)=>{gv.init(e,t),ce.init(e,t)});function iA(e){return Hu(_p,e)}s(iA,"cidrv6");var Rp=b("ZodBase64",(e,t)=>{yv.init(e,t),ce.init(e,t)});function sA(e){return Wu(Rp,e)}s(sA,"base64");var Ap=b("ZodBase64URL",(e,t)=>{vv.init(e,t),ce.init(e,t)});function aA(e){return Ju(Ap,e)}s(aA,"base64url");var Op=b("ZodE164",(e,t)=>{bv.init(e,t),ce.init(e,t)});function cA(e){return Zu(Op,e)}s(cA,"e164");var $p=b("ZodJWT",(e,t)=>{wv.init(e,t),ce.init(e,t)});function lA(e){return Yu($p,e)}s(lA,"jwt");var rs=b("ZodCustomStringFormat",(e,t)=>{kv.init(e,t),ce.init(e,t)});function dA(e,t,r={}){return Yi(rs,e,t,r)}s(dA,"stringFormat");function uA(e){return Yi(rs,"hostname",qt.hostname,e)}s(uA,"hostname");function pA(e){return Yi(rs,"hex",qt.hex,e)}s(pA,"hex");function mA(e,t){let r=t?.enc??"hex",o=`${e}_${r}`,n=qt[o];if(!n)throw new Error(`Unrecognized hash format: ${o}`);return Yi(rs,o,n,t)}s(mA,"hash");var os=b("ZodNumber",(e,t)=>{xu.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Mw(e,o,n,i),e.gt=(o,n)=>e.check(_n(o,n)),e.gte=(o,n)=>e.check(tt(o,n)),e.min=(o,n)=>e.check(tt(o,n)),e.lt=(o,n)=>e.check(xn(o,n)),e.lte=(o,n)=>e.check(kt(o,n)),e.max=(o,n)=>e.check(kt(o,n)),e.int=o=>e.check(gp(o)),e.safe=o=>e.check(gp(o)),e.positive=o=>e.check(_n(0,o)),e.nonnegative=o=>e.check(tt(0,o)),e.negative=o=>e.check(xn(0,o)),e.nonpositive=o=>e.check(kt(0,o)),e.multipleOf=(o,n)=>e.check(Ar(o,n)),e.step=(o,n)=>e.check(Ar(o,n)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function jk(e){return aw(os,e)}s(jk,"number");var Ao=b("ZodNumberFormat",(e,t)=>{Ev.init(e,t),os.init(e,t)});function gp(e){return lw(Ao,e)}s(gp,"int");function fA(e){return dw(Ao,e)}s(fA,"float32");function gA(e){return uw(Ao,e)}s(gA,"float64");function hA(e){return pw(Ao,e)}s(hA,"int32");function yA(e){return mw(Ao,e)}s(yA,"uint32");var is=b("ZodBoolean",(e,t)=>{Wa.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qw(e,r,o,n)});function Mk(e){return fw(is,e)}s(Mk,"boolean");var ss=b("ZodBigInt",(e,t)=>{_u.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Fw(e,o,n,i),e.gte=(o,n)=>e.check(tt(o,n)),e.min=(o,n)=>e.check(tt(o,n)),e.gt=(o,n)=>e.check(_n(o,n)),e.gte=(o,n)=>e.check(tt(o,n)),e.min=(o,n)=>e.check(tt(o,n)),e.lt=(o,n)=>e.check(xn(o,n)),e.lte=(o,n)=>e.check(kt(o,n)),e.max=(o,n)=>e.check(kt(o,n)),e.positive=o=>e.check(_n(BigInt(0),o)),e.negative=o=>e.check(xn(BigInt(0),o)),e.nonpositive=o=>e.check(kt(BigInt(0),o)),e.nonnegative=o=>e.check(tt(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(Ar(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function vA(e){return hw(ss,e)}s(vA,"bigint");var Cp=b("ZodBigIntFormat",(e,t)=>{Sv.init(e,t),ss.init(e,t)});function bA(e){return vw(Cp,e)}s(bA,"int64");function wA(e){return bw(Cp,e)}s(wA,"uint64");var qk=b("ZodSymbol",(e,t)=>{Pv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>zw(e,r,o,n)});function kA(e){return ww(qk,e)}s(kA,"symbol");var Fk=b("ZodUndefined",(e,t)=>{Iv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Kw(e,r,o,n)});function EA(e){return kw(Fk,e)}s(EA,"_undefined");var zk=b("ZodNull",(e,t)=>{Tv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Bw(e,r,o,n)});function Bk(e){return Ew(zk,e)}s(Bk,"_null");var Kk=b("ZodAny",(e,t)=>{xv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Hw(e,r,o,n)});function SA(){return Sw(Kk)}s(SA,"any");var Qk=b("ZodUnknown",(e,t)=>{_v.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ww(e,r,o,n)});function Ro(){return Pw(Qk)}s(Ro,"unknown");var Vk=b("ZodNever",(e,t)=>{Rv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Vw(e,r,o,n)});function Np(e){return Iw(Vk,e)}s(Np,"never");var Hk=b("ZodVoid",(e,t)=>{Av.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Qw(e,r,o,n)});function PA(e){return Tw(Hk,e)}s(PA,"_void");var uc=b("ZodDate",(e,t)=>{Ov.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Jw(e,o,n,i),e.min=(o,n)=>e.check(tt(o,n)),e.max=(o,n)=>e.check(kt(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function IA(e){return xw(uc,e)}s(IA,"date");var Wk=b("ZodArray",(e,t)=>{$v.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ck(e,r,o,n),e.element=t.element,e.min=(r,o)=>e.check(Yn(r,o)),e.nonempty=r=>e.check(Yn(1,r)),e.max=(r,o)=>e.check(xo(r,o)),e.length=(r,o)=>e.check(_o(r,o)),e.unwrap=()=>e.element});function pc(e,t){return Aw(Wk,e,t)}s(pc,"array");function TA(e){let t=e._zod.def.shape;return Dp(Object.keys(t))}s(TA,"keyof");var mc=b("ZodObject",(e,t)=>{Cv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>lk(e,r,o,n),N.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Dp(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ro()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ro()}),e.strict=()=>e.clone({...e._zod.def,catchall:Np()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>N.extend(e,r),e.safeExtend=r=>N.safeExtend(e,r),e.merge=r=>N.merge(e,r),e.pick=r=>N.pick(e,r),e.omit=r=>N.omit(e,r),e.partial=(...r)=>N.partial(Up,e,r[0]),e.required=(...r)=>N.required(jp,e,r[0])});function xA(e,t){let r={type:"object",shape:e??{},...N.normalizeParams(t)};return new mc(r)}s(xA,"object");function _A(e,t){return new mc({type:"object",shape:e,catchall:Np(),...N.normalizeParams(t)})}s(_A,"strictObject");function RA(e,t){return new mc({type:"object",shape:e,catchall:Ro(),...N.normalizeParams(t)})}s(RA,"looseObject");var fc=b("ZodUnion",(e,t)=>{Ja.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ip(e,r,o,n),e.options=t.options});function Lp(e,t){return new fc({type:"union",options:e,...N.normalizeParams(t)})}s(Lp,"union");var Jk=b("ZodXor",(e,t)=>{fc.init(e,t),Nv.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ip(e,r,o,n),e.options=t.options});function AA(e,t){return new Jk({type:"union",options:e,inclusive:!1,...N.normalizeParams(t)})}s(AA,"xor");var Zk=b("ZodDiscriminatedUnion",(e,t)=>{fc.init(e,t),Lv.init(e,t)});function OA(e,t,r){return new Zk({type:"union",options:t,discriminator:e,...N.normalizeParams(r)})}s(OA,"discriminatedUnion");var Yk=b("ZodIntersection",(e,t)=>{Dv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>dk(e,r,o,n)});function Xk(e,t){return new Yk({type:"intersection",left:e,right:t})}s(Xk,"intersection");var eE=b("ZodTuple",(e,t)=>{Ru.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>uk(e,r,o,n),e.rest=r=>e.clone({...e._zod.def,rest:r})});function tE(e,t,r){let o=t instanceof Q,n=o?r:t,i=o?t:null;return new eE({type:"tuple",items:e,rest:i,...N.normalizeParams(n)})}s(tE,"tuple");var gc=b("ZodRecord",(e,t)=>{Gv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>pk(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function nE(e,t,r){return new gc({type:"record",keyType:e,valueType:t,...N.normalizeParams(r)})}s(nE,"record");function $A(e,t,r){let o=et(e);return o._zod.values=void 0,new gc({type:"record",keyType:o,valueType:t,...N.normalizeParams(r)})}s($A,"partialRecord");function CA(e,t,r){return new gc({type:"record",keyType:e,valueType:t,mode:"loose",...N.normalizeParams(r)})}s(CA,"looseRecord");var rE=b("ZodMap",(e,t)=>{Uv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sk(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Rn(...r)),e.nonempty=r=>e.check(Rn(1,r)),e.max=(...r)=>e.check(Or(...r)),e.size=(...r)=>e.check(To(...r))});function NA(e,t,r){return new rE({type:"map",keyType:e,valueType:t,...N.normalizeParams(r)})}s(NA,"map");var oE=b("ZodSet",(e,t)=>{jv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ak(e,r,o,n),e.min=(...r)=>e.check(Rn(...r)),e.nonempty=r=>e.check(Rn(1,r)),e.max=(...r)=>e.check(Or(...r)),e.size=(...r)=>e.check(To(...r))});function LA(e,t){return new oE({type:"set",valueType:e,...N.normalizeParams(t)})}s(LA,"set");var ts=b("ZodEnum",(e,t)=>{Mv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Zw(e,o,n,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let a of o)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ts({...t,checks:[],...N.normalizeParams(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let a of o)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new ts({...t,checks:[],...N.normalizeParams(n),entries:i})}});function Dp(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new ts({type:"enum",entries:r,...N.normalizeParams(t)})}s(Dp,"_enum");function DA(e,t){return new ts({type:"enum",entries:e,...N.normalizeParams(t)})}s(DA,"nativeEnum");var iE=b("ZodLiteral",(e,t)=>{qv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yw(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function GA(e,t){return new iE({type:"literal",values:Array.isArray(e)?e:[e],...N.normalizeParams(t)})}s(GA,"literal");var sE=b("ZodFile",(e,t)=>{Fv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>tk(e,r,o,n),e.min=(r,o)=>e.check(Rn(r,o)),e.max=(r,o)=>e.check(Or(r,o)),e.mime=(r,o)=>e.check(Qi(Array.isArray(r)?r:[r],o))});function UA(e){return Ow(sE,e)}s(UA,"file");var aE=b("ZodTransform",(e,t)=>{zv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ik(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ir(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(N.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(N.issue(a))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(i=>(r.value=i,r)):(r.value=n,r)}});function Gp(e){return new aE({type:"transform",transform:e})}s(Gp,"transform");var Up=b("ZodOptional",(e,t)=>{Au.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ac(e){return new Up({type:"optional",innerType:e})}s(ac,"optional");var cE=b("ZodExactOptional",(e,t)=>{Bv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function lE(e){return new cE({type:"optional",innerType:e})}s(lE,"exactOptional");var dE=b("ZodNullable",(e,t)=>{Kv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function cc(e){return new dE({type:"nullable",innerType:e})}s(cc,"nullable");function jA(e){return ac(cc(e))}s(jA,"nullish");var uE=b("ZodDefault",(e,t)=>{Qv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pE(e,t){return new uE({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():N.shallowClone(t)}})}s(pE,"_default");var mE=b("ZodPrefault",(e,t)=>{Vv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>hk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function fE(e,t){return new mE({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():N.shallowClone(t)}})}s(fE,"prefault");var jp=b("ZodNonOptional",(e,t)=>{Hv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>fk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function gE(e,t){return new jp({type:"nonoptional",innerType:e,...N.normalizeParams(t)})}s(gE,"nonoptional");var hE=b("ZodSuccess",(e,t)=>{Wv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>nk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function MA(e){return new hE({type:"success",innerType:e})}s(MA,"success");var yE=b("ZodCatch",(e,t)=>{Jv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function vE(e,t){return new yE({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}s(vE,"_catch");var bE=b("ZodNaN",(e,t)=>{Zv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Xw(e,r,o,n)});function qA(e){return Rw(bE,e)}s(qA,"nan");var Mp=b("ZodPipe",(e,t)=>{Yv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vk(e,r,o,n),e.in=t.in,e.out=t.out});function lc(e,t){return new Mp({type:"pipe",in:e,out:t})}s(lc,"pipe");var qp=b("ZodCodec",(e,t)=>{Mp.init(e,t),Za.init(e,t)});function FA(e,t,r){return new qp({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}s(FA,"codec");var wE=b("ZodReadonly",(e,t)=>{Xv.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function kE(e){return new wE({type:"readonly",innerType:e})}s(kE,"readonly");var EE=b("ZodTemplateLiteral",(e,t)=>{eb.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ek(e,r,o,n)});function zA(e,t){return new EE({type:"template_literal",parts:e,...N.normalizeParams(t)})}s(zA,"templateLiteral");var SE=b("ZodLazy",(e,t)=>{rb.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>kk(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function PE(e){return new SE({type:"lazy",getter:e})}s(PE,"lazy");var IE=b("ZodPromise",(e,t)=>{nb.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function BA(e){return new IE({type:"promise",innerType:e})}s(BA,"promise");var TE=b("ZodFunction",(e,t)=>{tb.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ok(e,r,o,n)});function KA(e){return new TE({type:"function",input:Array.isArray(e?.input)?tE(e?.input):e?.input??pc(Ro()),output:e?.output??Ro()})}s(KA,"_function");var hc=b("ZodCustom",(e,t)=>{ob.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,o,n)=>rk(e,r,o,n)});function QA(e){let t=new ue({check:"custom"});return t._zod.check=e,t}s(QA,"check");function VA(e,t){return $w(hc,e??(()=>!0),t)}s(VA,"custom");function xE(e,t={}){return Cw(hc,e,t)}s(xE,"refine");function _E(e){return Nw(e)}s(_E,"superRefine");var HA=Lw,WA=Dw;function JA(e,t={}){let r=new hc({type:"custom",check:"custom",fn:s(o=>o instanceof e,"fn"),abort:!0,...N.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=o=>{o.value instanceof e||o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:r,path:[...r._zod.def.path??[]]})},r}s(JA,"_instanceof");var ZA=s((...e)=>Gw({Codec:qp,Boolean:is,String:ns},...e),"stringbool");function YA(e){let t=PE(()=>Lp([fp(e),jk(),Mk(),Bk(),pc(t),nE(fp(),t)]));return t}s(YA,"json");function XA(e,t){return lc(Gp(e),t)}s(XA,"preprocess");var tM={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"};function nM(e){ke({customError:e})}s(nM,"setErrorMap");function rM(){return ke().customError}s(rM,"getErrorMap");var RE;RE||(RE={});var j={...ic,...lp,iso:es},oM=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function iM(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}s(iM,"detectVersion");function sM(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let o=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===o){let n=r[1];if(!n||!t.defs[n])throw new Error(`Reference not found: ${e}`);return t.defs[n]}throw new Error(`Reference not found: ${e}`)}s(sM,"resolveRef");function eO(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return j.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return j.lazy(()=>{if(!t.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let i=sM(n,t),a=Qe(i,t);return t.refs.set(n,a),t.processing.delete(n),a}if(e.enum!==void 0){let n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return j.null();if(n.length===0)return j.never();if(n.length===1)return j.literal(n[0]);if(n.every(a=>typeof a=="string"))return j.enum(n);let i=n.map(a=>j.literal(a));return i.length<2?i[0]:j.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return j.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map(i=>{let a={...e,type:i};return eO(a,t)});return n.length===0?j.never():n.length===1?n[0]:j.union(n)}if(!r)return j.any();let o;switch(r){case"string":{let n=j.string();if(e.format){let i=e.format;i==="email"?n=n.check(j.email()):i==="uri"||i==="uri-reference"?n=n.check(j.url()):i==="uuid"||i==="guid"?n=n.check(j.uuid()):i==="date-time"?n=n.check(j.iso.datetime()):i==="date"?n=n.check(j.iso.date()):i==="time"?n=n.check(j.iso.time()):i==="duration"?n=n.check(j.iso.duration()):i==="ipv4"?n=n.check(j.ipv4()):i==="ipv6"?n=n.check(j.ipv6()):i==="mac"?n=n.check(j.mac()):i==="cidr"?n=n.check(j.cidrv4()):i==="cidr-v6"?n=n.check(j.cidrv6()):i==="base64"?n=n.check(j.base64()):i==="base64url"?n=n.check(j.base64url()):i==="e164"?n=n.check(j.e164()):i==="jwt"?n=n.check(j.jwt()):i==="emoji"?n=n.check(j.emoji()):i==="nanoid"?n=n.check(j.nanoid()):i==="cuid"?n=n.check(j.cuid()):i==="cuid2"?n=n.check(j.cuid2()):i==="ulid"?n=n.check(j.ulid()):i==="xid"?n=n.check(j.xid()):i==="ksuid"&&(n=n.check(j.ksuid()))}typeof e.minLength=="number"&&(n=n.min(e.minLength)),typeof e.maxLength=="number"&&(n=n.max(e.maxLength)),e.pattern&&(n=n.regex(new RegExp(e.pattern))),o=n;break}case"number":case"integer":{let n=r==="integer"?j.number().int():j.number();typeof e.minimum=="number"&&(n=n.min(e.minimum)),typeof e.maximum=="number"&&(n=n.max(e.maximum)),typeof e.exclusiveMinimum=="number"?n=n.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(n=n.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?n=n.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(n=n.lt(e.maximum)),typeof e.multipleOf=="number"&&(n=n.multipleOf(e.multipleOf)),o=n;break}case"boolean":{o=j.boolean();break}case"null":{o=j.null();break}case"object":{let n={},i=e.properties||{},a=new Set(e.required||[]);for(let[l,d]of Object.entries(i)){let u=Qe(d,t);n[l]=a.has(l)?u:u.optional()}if(e.propertyNames){let l=Qe(e.propertyNames,t),d=e.additionalProperties&&typeof e.additionalProperties=="object"?Qe(e.additionalProperties,t):j.any();if(Object.keys(n).length===0){o=j.record(l,d);break}let u=j.object(n).passthrough(),m=j.looseRecord(l,d);o=j.intersection(u,m);break}if(e.patternProperties){let l=e.patternProperties,d=Object.keys(l),u=[];for(let p of d){let f=Qe(l[p],t),g=j.string().regex(new RegExp(p));u.push(j.looseRecord(g,f))}let m=[];if(Object.keys(n).length>0&&m.push(j.object(n).passthrough()),m.push(...u),m.length===0)o=j.object({}).passthrough();else if(m.length===1)o=m[0];else{let p=j.intersection(m[0],m[1]);for(let f=2;f<m.length;f++)p=j.intersection(p,m[f]);o=p}break}let c=j.object(n);e.additionalProperties===!1?o=c.strict():typeof e.additionalProperties=="object"?o=c.catchall(Qe(e.additionalProperties,t)):o=c.passthrough();break}case"array":{let n=e.prefixItems,i=e.items;if(n&&Array.isArray(n)){let a=n.map(l=>Qe(l,t)),c=i&&typeof i=="object"&&!Array.isArray(i)?Qe(i,t):void 0;c?o=j.tuple(a).rest(c):o=j.tuple(a),typeof e.minItems=="number"&&(o=o.check(j.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(j.maxLength(e.maxItems)))}else if(Array.isArray(i)){let a=i.map(l=>Qe(l,t)),c=e.additionalItems&&typeof e.additionalItems=="object"?Qe(e.additionalItems,t):void 0;c?o=j.tuple(a).rest(c):o=j.tuple(a),typeof e.minItems=="number"&&(o=o.check(j.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(j.maxLength(e.maxItems)))}else if(i!==void 0){let a=Qe(i,t),c=j.array(a);typeof e.minItems=="number"&&(c=c.min(e.minItems)),typeof e.maxItems=="number"&&(c=c.max(e.maxItems)),o=c}else o=j.array(j.any());break}default:throw new Error(`Unsupported type: ${r}`)}return e.description&&(o=o.describe(e.description)),e.default!==void 0&&(o=o.default(e.default)),o}s(eO,"convertBaseSchema");function Qe(e,t){if(typeof e=="boolean")return e?j.any():j.never();let r=eO(e,t),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let c=e.anyOf.map(d=>Qe(d,t)),l=j.union(c);r=o?j.intersection(r,l):l}if(e.oneOf&&Array.isArray(e.oneOf)){let c=e.oneOf.map(d=>Qe(d,t)),l=j.xor(c);r=o?j.intersection(r,l):l}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=o?r:j.any();else{let c=o?r:Qe(e.allOf[0],t),l=o?0:1;for(let d=l;d<e.allOf.length;d++)c=j.intersection(c,Qe(e.allOf[d],t));r=c}e.nullable===!0&&t.version==="openapi-3.0"&&(r=j.nullable(r)),e.readOnly===!0&&(r=j.readonly(r));let n={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let c of i)c in e&&(n[c]=e[c]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let c of a)c in e&&(n[c]=e[c]);for(let c of Object.keys(e))oM.has(c)||(n[c]=e[c]);return Object.keys(n).length>0&&t.registry.add(r,n),r}s(Qe,"convertSchema");function tO(e,t){if(typeof e=="boolean")return e?j.any():j.never();let r=iM(e,t?.defaultTarget),o=e.$defs||e.definitions||{},n={version:r,defs:o,refs:new Map,processing:new Set,rootSchema:e,registry:t?.registry??Fe};return Qe(e,n)}s(tO,"fromJSONSchema");var AE={};me(AE,{bigint:()=>dM,boolean:()=>lM,date:()=>uM,number:()=>cM,string:()=>aM});function aM(e){return ew(ns,e)}s(aM,"string");function cM(e){return cw(os,e)}s(cM,"number");function lM(e){return gw(is,e)}s(lM,"boolean");function dM(e){return yw(ss,e)}s(dM,"bigint");function uM(e){return _w(uc,e)}s(uM,"date");ke(Ya());var LO=K(require("ajv")),DO=require("@modelcontextprotocol/sdk/server/mcp.js"),GO=require("@modelcontextprotocol/sdk/server/stdio.js");Ai();qe();var FE=require("path");gt();oo();var Fp={skills:Wn.properties.skills.additionalProperties.properties.executor.enum,tools:Wn.properties.tools.additionalProperties.properties.executor.enum},nO=s(e=>e.map(t=>`"${t}"`).join(" | "),"quoted"),yc={publish:{feature:"Publish (single, by channel slug)",whenToUse:"Emit a domain event as a side effect of a business operation, after the state is durably stored.",snippet:`// after the order is saved to your DB:
|
|
454
|
+
await np.events.publish("orders", { id: order.id, symbol: order.symbol, qty: order.qty }, {
|
|
455
|
+
routingKey: "trade.order.placed",
|
|
456
|
+
});`,notes:"The facade resolves the channel slug to its id. Publish is server side; never publish from a browser."},idempotentPublish:{feature:"Idempotent publish",whenToUse:"Avoid duplicates when a publish may be retried (network retries, at-least-once upstream).",snippet:`const channelGid = (await np.events.channels.getBySlug({ slug: "orders" })).gid;
|
|
457
|
+
const r = await np.events.messages.publish({ channelGid, payload, idempotencyKey: order.id });
|
|
458
|
+
// re-publishing with the same idempotencyKey returns the same message id (no duplicate).`},batchPublish:{feature:"Batch publish (all-or-nothing)",whenToUse:"Publish many events in one call (e.g. a burst of ticks). Either all are accepted or none.",snippet:`const channelGid = (await np.events.channels.getBySlug({ slug: "prices" })).gid;
|
|
459
|
+
const { messageIds } = await np.events.messages.publishBatch({
|
|
460
|
+
channelGid,
|
|
461
|
+
messages: ticks.map((t) => ({ payload: t, idempotencyKey: t.id })),
|
|
462
|
+
});`,notes:"Returns messageIds in request order. An oversized batch is rejected whole."},orderedGroups:{feature:"Ordered groups (FIFO within a key)",whenToUse:"Guarantee in-order processing for a partition (per account, per symbol) while allowing cross-key parallelism.",snippet:`await np.events.messages.publishGroup({
|
|
463
|
+
channelGid,
|
|
464
|
+
messages: updates.map((u) => ({ partitionKey: u.account, payload: u })),
|
|
465
|
+
});`},priority:{feature:"Priority",whenToUse:"Process urgent events (alerts, liquidations) ahead of routine ones in a subscription's delivery queue.",snippet:"await np.events.messages.publish({ channelGid, payload, priority: 9 }); // 0..9, default 5"},scheduled:{feature:"Scheduled publish",whenToUse:"Defer an event to a future time (a delayed warning, a market-close action).",snippet:`const scheduledId = await np.events.scheduling.scheduleMessage({
|
|
466
|
+
channelGid, payload, deliverAt: Date.now() + 60_000,
|
|
467
|
+
});
|
|
468
|
+
// cancel before delivery:
|
|
469
|
+
await np.events.scheduling.cancelScheduled({ scheduledMessageGid: scheduledId });`,notes:"scheduleMessage returns the scheduled-message id; pass it to cancelScheduled."},ttlAndAttributes:{feature:"TTL + attributes",whenToUse:"Expire transient events (ttl seconds) and carry routing/compliance metadata (attributes).",snippet:'await np.events.messages.publish({ channelGid, payload, ttl: 60, attributes: { venue: "NYSE", region: "us-east" } });'},queueConsume:{feature:"Queue consume (the outbox / work queue)",whenToUse:"Process each message exactly once across many workers; survive restarts. Publish to a `queue` channel with a `queue` subscription, then pull.",snippet:`// resolve your queue subscription's id once (by its declared name on the channel).
|
|
470
|
+
for (;;) {
|
|
471
|
+
const { messages } = await np.events.queues.receiveMessages({
|
|
472
|
+
subscriptionGid, maxMessages: 25, waitTimeSeconds: 2, visibilityTimeoutSeconds: 30,
|
|
473
|
+
});
|
|
474
|
+
for (const m of messages) {
|
|
475
|
+
const ok = await handleIdempotently(m.body); // your work, safe to repeat
|
|
476
|
+
if (ok) await np.events.queues.deleteMessage({ subscriptionGid, receiptHandle: m.receiptHandle });
|
|
477
|
+
// do NOT delete on failure \u2014 the message reappears after the visibility window for retry.
|
|
478
|
+
}
|
|
479
|
+
}`,notes:"Each message is { receiptHandle, body }. Delete (ack) only after success. Use changeMessageVisibility({ subscriptionGid, receiptHandle, visibilityTimeoutSeconds }) to extend while still working."},stream:{feature:"Stream read + offset commit",whenToUse:"Replay an ordered log (analytics, P&L rebuild, backtest) and resume from where you left off.",snippet:`const messages = await np.events.streams.readFromOffset({ channelGid, offset: 0, limit: 100 }); // the messages themselves, an array
|
|
480
|
+
// after processing up to N:
|
|
481
|
+
await np.events.streams.commitOffset({ channelGid, consumerId: "analytics", offset: N });
|
|
482
|
+
const resumeAt = await np.events.streams.getOffset({ channelGid, consumerId: "analytics" }); // a number`},compactedKv:{feature:"Compacted channel as key/value (latest wins)",whenToUse:'Keep the latest value per key (a live price book, current config). Declare the channel retentionMode: "compacted".',snippet:`await np.events.kvStore.setEntry({ channelGid, key: symbol, value: { price } });
|
|
483
|
+
const latest = await np.events.kvStore.getEntry({ channelGid, key: symbol }); // { value }
|
|
484
|
+
const history = await np.events.kvStore.getHistory({ channelGid, key: symbol });`},webhookVerify:{feature:"Verify an inbound webhook (the receiver)",whenToUse:"ALWAYS, before acting on a delivered event. Never trust an unsigned or tampered delivery.",snippet:`import { WebhookHandler } from "@npayload/sdk";
|
|
485
|
+
const wh = new WebhookHandler();
|
|
486
|
+
// hand it the delivery headers (req.headers, request.headers or the request itself):
|
|
487
|
+
// it verifies X-NPayload-Signature (the hex HMAC-SHA256 of "<X-NPayload-Timestamp>.<raw body>", or "t=<ts>,v1=<hmac>[,kid=...]")
|
|
488
|
+
const event = await wh.constructEvent(rawBody, req.headers, signingSecret); // throws if invalid
|
|
489
|
+
// event.data = the body exactly as published (no envelope, never unwrapped);
|
|
490
|
+
// event.id = X-NPayload-Message-Id, plus event.deliveryId, event.channelGid, event.publishedAt, event.metadata.`,notes:"Get the signing secret once via np.events.subscriptions.rotateSecret({ subscriptionGid }) \u2192 { webhookSecret } and store it in your server env (a real secret manager in prod)."},catalogue:{feature:"Event catalogue + schema versioning",whenToUse:"Govern the events you publish: register a typed event, publish a versioned schema, check compatibility before promoting.",snippet:`const eventTypeGid = await np.events.catalogue.registerEventType({
|
|
491
|
+
name: "trade.order.filled", displayName: "Order filled", description: "...",
|
|
492
|
+
domain: "trade", entity: "order", action: "filled", ownership: { team: "trading", contact: "trading@x.com" },
|
|
493
|
+
});
|
|
494
|
+
await np.events.catalogue.registerVersion({ eventTypeGid, version: 1, schema: { format: "json_schema", definition }, changelog: "v1", publishedBy: appId });
|
|
495
|
+
const { compatible } = await np.events.catalogue.checkCompatibility({ eventTypeGid, schemaDefinition, mode: "backward" });`},exchanges:{feature:"Exchanges (route one publish to many channels)",whenToUse:"Fan a single publish out to several channels (direct/topic/fanout/headers routing).",snippet:`const exchangeGid = (await np.events.exchanges.create({ name: "executions", type: "fanout" })).gid;
|
|
496
|
+
await np.events.exchanges.createBinding({ exchangeGid, channelGid });
|
|
497
|
+
await np.events.exchanges.publishToExchange({ exchangeGid, payload });
|
|
498
|
+
// preview routing without publishing:
|
|
499
|
+
const routes = await np.events.exchanges.dryRun({ exchangeGid, routingKey: "trade.execution" }); // [{ channelGid, bindingGid }]`},consumerGroups:{feature:"Consumer groups (scale a stream across workers)",whenToUse:"Load-balance a stream across competing workers; members join and leave dynamically.",snippet:`// createGroup answers the new group's gid itself (a string), never an object:
|
|
500
|
+
const groupGid = await np.events.consumerGroups.createGroup({ channelGid, name: "analytics", strategy: "competing" });
|
|
501
|
+
await np.events.consumerGroups.joinGroup({ groupGid, subscriptionGid });
|
|
502
|
+
// later:
|
|
503
|
+
await np.events.consumerGroups.leaveGroup({ groupGid, subscriptionGid });`,notes:"createGroup resolves to the group's gid (cg_\u2026), so join and leave address the group by that value. To read the group back (members, strategy, status), call getGroup({ groupGid })."},dlq:{feature:"Dead letter queue",whenToUse:"Inspect + recover deliveries that failed past their retry budget instead of losing them.",snippet:`const stats = await np.events.dlq.getStats({ subscriptionGid });
|
|
504
|
+
const entries = await np.events.dlq.listBySubscription({ subscriptionGid });
|
|
505
|
+
await np.events.dlq.reprocess({ dlqEntryGid: entries[0].gid }); // once the endpoint recovers`},snapshots:{feature:"Snapshots (checkpoint + restore a consumer)",whenToUse:"Let a new worker restore to a known point instead of replaying from the start.",snippet:`// createSnapshot records the subscription's current position itself and answers the snapshot's gid (a string):
|
|
506
|
+
const snapshotGid = await np.events.snapshots.createSnapshot({ subscriptionGid, name: "checkpoint" });
|
|
507
|
+
await np.events.snapshots.seekToSnapshot({ snapshotGid });`,notes:"The request takes the subscription's gid, a name and optional metadata \u2014 never a position: the platform records the offset, the acknowledged mark and the pending count at the moment of the call. seekToSnapshot takes the gid createSnapshot answers."},privacy:{feature:"End to end / hybrid privacy",whenToUse:'Share private payloads the platform must not read. Declare the channel privacyMode "e2e" (payload opaque) or "hybrid" (metadata visible, payload encrypted).',snippet:`// the app encrypts before publishing; npayload relays the ciphertext and never reads it.
|
|
508
|
+
await np.events.publish("positions", { ciphertext: encrypt(position) });`,notes:"Server-side transforms (pipe filters) are not available on e2e channels \u2014 the platform cannot see the payload."},nppTransport:{feature:"NPP transport (the default binary data plane)",whenToUse:"Lower-latency publish/consume over signed binary frames. The default; opt into HTTP only if you need it.",snippet:`const np = await NPayload.connect({ clientId, appId, baseUrl, transport: "npp", edgeUrl });
|
|
509
|
+
await np.events.publish("orders", payload); // rides the NPP wire; lands in the same store as HTTP`,notes:"Management operations (create/list/rotate) always ride the HTTP API; NPP carries the event data itself (publish/consume)."},transportChoice:{feature:"Choosing a transport (NPP vs HTTP) \u2014 the decision tree",whenToUse:"Decide ONCE per service, at connect(). Both transports publish to and consume from the SAME channels \u2014 the choice is about latency and environment, never about features.",snippet:`// 1. High-throughput / latency-sensitive event flow (trading, telemetry,
|
|
510
|
+
// realtime pipelines) \u2192 NPP. Signed binary frames, fastest acks.
|
|
511
|
+
const fast = await NPayload.connect({ clientId, appId, baseUrl, transport: "npp", edgeUrl });
|
|
512
|
+
|
|
513
|
+
// 2. Ordinary backend services, serverless functions, restricted networks
|
|
514
|
+
// (plain HTTPS only) \u2192 HTTP. Zero extra setup, universal reach.
|
|
515
|
+
const simple = await NPayload.connect({ clientId, appId, baseUrl, transport: "http" });
|
|
516
|
+
|
|
517
|
+
// Either way the SAME code runs: publish/consume/manage are identical.
|
|
518
|
+
await fast.events.publish("orders", payload);`,notes:"Everything works on both: a client connected with transport 'npp' still performs every management operation transparently (they ride HTTPS under the hood), so switching transports never changes your code. Signing keys and credentials are provisioned automatically at connect() \u2014 never configure them by hand. Rule of thumb: start with HTTP; move a hot publisher/consumer to NPP when publish latency matters."},typedEvents:{feature:"Typed event payloads (schema in config \u2192 generated TypeScript types)",whenToUse:"Declare a JSON Schema on an eventType in events.config.ts and every publish/consume of that event becomes compile-time typed. Schema changes create NEW versions (append-only) \u2014 existing consumers keep their pinned version.",snippet:`// events.config.ts
|
|
519
|
+
eventTypes: {
|
|
520
|
+
"market.price.tick": {
|
|
521
|
+
displayName: "Price tick", description: "New market price", domain: "market", entity: "price", action: "tick",
|
|
522
|
+
ownership: { team: "market-data", contact: "md@example.com" },
|
|
523
|
+
schema: { format: "json_schema", definition: JSON.stringify({
|
|
524
|
+
type: "object", properties: { symbol: { type: "string" }, price: { type: "number" } }, required: ["symbol", "price"],
|
|
525
|
+
}) },
|
|
526
|
+
},
|
|
527
|
+
},
|
|
528
|
+
|
|
529
|
+
// then: npayload push \u2192 registers the schema version + regenerates npayload/_generated/events.d.ts
|
|
530
|
+
import type { EventPayloads } from "./npayload/_generated/events";
|
|
531
|
+
const tick: EventPayloads["market.price.tick"] = { symbol: "BTC-USD", price: 64000 };
|
|
532
|
+
await np.events.publish("prices", tick, { routingKey: "market.price.tick" });`,notes:"The generated file is stamped and regenerated on every push \u2014 never edit it by hand. A changed schema registers the NEXT catalogue version; an identical schema is a no-op."},permissionsAsCode:{feature:"Generated permissions (permissions.generated.ts)",whenToUse:"Understand what your app's credential can do. Every push regenerates npayload/permissions.generated.ts \u2014 the exact, least-privilege scope set projected from your declared topology.",snippet:`// npayload/permissions.generated.ts (GENERATED \u2014 never edit)
|
|
533
|
+
export const permissions = { scopes: ["channels:read", "channels:write", "messages:read", "messages:write", /* \u2026 */] };`,notes:"Scopes are per-object (channels:write, messages:read, \u2026) \u2014 never a blanket grant. To widen access, declare the feature in events.config.ts and push; the file (and the credential's authorization) follows the topology. If an operation fails with a scope error, check this file first, then `npayload validate` for drift."}},rO={decisionGuide:{channelType:"topic = fan-out to all subscribers (order lifecycle, alerts). queue = each message handled once across workers, with ack/retry (settlement, jobs, the outbox). stream = ordered, replayable log (the trade tape, analytics, event sourcing). compacted (retentionMode) = latest value per key wins (a live price book, current config) \u2014 also usable as a key/value store.",delivery:"Push delivery = a webhook subscription (the platform POSTs signed events to your URL). Pull delivery = a queue subscription (your worker pulls with receiveMessages, the outbox pattern). Choose push for low-latency reactions, pull for controlled throughput + at-least-once with explicit ack.",privacy:"standard = platform can read the payload (default; enables server-side transforms). hybrid = metadata visible, payload encrypted. e2e = payload opaque to the platform (you encrypt before publishing)."},core:["publish (single, batch, groups-FIFO, priority, scheduled, idempotency, TTL, attributes)","channels (topic, queue, stream, compacted)","queue consume / outbox (receive, delete/ack, visibility)","subscriptions (webhook + HMAC, filter, pause/resume, secret rotation, retry, DLQ)","streams (read from offset, commit/resume, replay)","consumer groups (competing/sticky/broadcast, join/leave)","dead letter queue (stats, list, reprocess)","event catalogue (register type, version, compatibility)","exchanges (direct/topic/fanout/headers, bindings, dry run)","key/value (compacted set/get/history)","snapshots (checkpoint, restore)","privacy modes (standard / hybrid / e2e)","transports (NPP default + HTTP)"],notDeclarable:["external connectors / adapters (Kafka, SQS, EventBridge, SNS, Azure, GCP)","cross-workspace channels + geo-replication","bring-your-own-key (BYOK) encryption"]},oO=`npayload Pipes config-as-code. Write npayload/pipes.config.ts that default-exports
|
|
534
|
+
definePipesConfig({...}). Resources are keyed by name (the map key):
|
|
535
|
+
|
|
536
|
+
- workflows: an automation. Provide a "definition" (React-Flow "nodes" + "edges";
|
|
537
|
+
nodes reference connectors) and a "triggerConfig" { type: "event" | "schedule" |
|
|
538
|
+
"webhook" | "manual" | "form", config }. Config "update" changes name/description
|
|
539
|
+
only \u2014 the node graph is versioned and edited in the editor, not via config.
|
|
540
|
+
A config-declared workflow is created as a DRAFT (activate it in the dashboard,
|
|
541
|
+
via the CLI, or with pipes_create's activate flag for imperative builds); a
|
|
542
|
+
workflow the config no longer declares is deleted only by deploy --prune.
|
|
543
|
+
- credentials: a connector credential. name + connectorId + auth. NEVER put a
|
|
544
|
+
plaintext secret in the config \u2014 declare it by reference (auth.vaultSecretId,
|
|
545
|
+
the id of a credential stored from the dashboard); the platform stores the
|
|
546
|
+
secret in the vault (AES-256-GCM) and the config carries only the reference.
|
|
547
|
+
- governance: a SINGLETON (one object, NOT a keyed map) \u2014 connector "mode"
|
|
548
|
+
("open" | "allowlist" | "approval_required") + allowedConnectors / blockedConnectors.
|
|
549
|
+
ADMIN-GATED: an org admin applies it; a machine credential gets a clear "needs
|
|
550
|
+
admin" note (manage it in the dashboard).
|
|
551
|
+
|
|
552
|
+
Loop: write pipes.config.ts, call pipes_validate (omit the arg to validate the file
|
|
553
|
+
on disk), then pipes_deploy (use check:true first to preview). Reconciles over the
|
|
554
|
+
same edge=>admin=>cell path as Events, keyed by name (idempotent: re-deploy = no-op).`,iO={decisionGuide:{workflow:"A workflow is a node graph + a trigger. triggerConfig.type: event (an Events channel/event), schedule (cron), webhook (inbound HTTP), manual (run on demand), form (user-submitted).",credentials:"Connectors need auth. Declare a credential by NAME with its connectorId and an auth object whose secret is a vault reference (vaultSecretId) \u2014 never a plaintext key; store the secret from the dashboard and reference its id."},core:["workflows (create/list, update name+description, activate/pause/archive)","credentials (vault-backed; secret declared by reference, never plaintext)","connectors (200+ built-in; referenced by workflow nodes, not declared)","governance (mode + allow/block lists; a SINGLETON object, ADMIN-GATED \u2014 an org admin applies it; a machine credential gets a clear 'needs admin' note)"],notDeclarable:["workflow definition (node-graph) edits via config \u2014 use the editor; config update is name/description only","executions / runs / logs / DLQ \u2014 runtime state, not declarable"]},sO=`npayload Primus (AI agents) config-as-code. Write npayload/primus.config.ts that
|
|
555
|
+
default-exports definePrimusConfig({...}). Resources are keyed by name (the map key):
|
|
556
|
+
|
|
557
|
+
- agents: an autonomous worker. "systemPrompt" is required; description/personality/
|
|
558
|
+
language optional. "skills" takes the NAMES of skills declared in this config \u2014
|
|
559
|
+
resolved to their ids at deploy (skills reconcile first). The binding is applied
|
|
560
|
+
at CREATE; re-wire an existing agent imperatively (\`np primus agents assign-skill\`).
|
|
561
|
+
- skills: a reusable capability. description + "executor" (${nO(Fp.skills)})
|
|
562
|
+
+ a "definition" { systemPrompt }.
|
|
563
|
+
- tools: an action an agent/skill can call. description + "riskLevel" ("safe" |
|
|
564
|
+
"moderate" | "dangerous") + "executor" (${nO(Fp.tools)}).
|
|
565
|
+
An "inline" executor needs no endpoint; a "webhook" executor requires an https endpoint.
|
|
566
|
+
Tool/skill names: lowercase + underscores, NO hyphens.
|
|
567
|
+
- triggers: fire an agent. "agentGid" is an AGENT's name from above (resolved to its id),
|
|
568
|
+
"type" ("event" | "cron" | "webhook" | "message"), "config" (e.g. { eventType }), "action" { goal }.
|
|
569
|
+
|
|
570
|
+
Loop: write primus.config.ts, call primus_validate, then primus_deploy (check:true first).
|
|
571
|
+
Same edge=>admin=>primus path, keyed by name (idempotent).`,aO={decisionGuide:{executor:`inline = runs in the agent process (simple transforms/lookups); webhook = your own https endpoint; every other executor (${Fp.skills.filter(e=>e!=="inline"&&e!=="webhook").join(", ")}) = a sandboxed runtime npayload manages \u2014 the schema primus_contract serves lists the exact set.`,risk:"tools.riskLevel: safe (no approval) | moderate | dangerous (approval-gated). Tool/skill names are lowercase + underscores."},core:["agents (create/list/update, name-keyed)",`skills (create/list/update; executors: ${Fp.skills.join("/")})`,"tools (create/list/update; vault-backed webhook secrets)","triggers (event/cron/webhook/message; parent agent referenced by name via agentGid)"],notDeclarable:["conversations / executions / memories / approvals / kill-switch / audit \u2014 runtime, not declarable","teams / brainConfig (LLM provider): not declarable in config"]};var vc={updateProfile:{feature:"Set the app's Connect profile (visibility + what it offers)",whenToUse:"Make an app discoverable in Explore and declare which event types it offers cross-org. The profile is the app's one declarative Connect setting.",snippet:`await np.connect.connect.updateAppProfile({
|
|
572
|
+
appId,
|
|
573
|
+
connectVisibility: "listed", // public | listed | unlisted | private
|
|
574
|
+
connectDescription: "Real-time trade signals",
|
|
575
|
+
publishedEventTypes: ["signal.generated", "alert.risk_breach"],
|
|
576
|
+
});`,notes:"INTERNAL-type apps are refused (they are org-private). publishedEventTypes reference eventTypes you declared in events.config.ts. The write lands in the admin registry and propagates to cells."},exploreApps:{feature:"Discover apps to subscribe to (Explore)",whenToUse:"Find publishers in other orgs that expose event types you want to consume.",snippet:`const { items } = await np.connect.connectExplore.searchExploreApps({ query: "trading" }); // { items, nextCursor?, hasMore }
|
|
577
|
+
// or list/page: np.connect.connectExplore.listExploreApps({})
|
|
578
|
+
// or one app: np.connect.connectExplore.getExploreApp({ appId: publisherAppId })`,notes:"Only public/listed apps in OTHER orgs appear; your own org's apps and INTERNAL apps are excluded."},requestAccess:{feature:"Request cross-org access (subscriber side)",whenToUse:"Ask a publisher app in another org for access to specific event types. Opens a pending grant the publisher must approve.",snippet:`const grant = await np.connect.connect.requestAccess({
|
|
579
|
+
subscriberAppId: appId, // your app asking for access
|
|
580
|
+
publisherAppId, // the app you found in Explore
|
|
581
|
+
eventTypes: ["signal.generated"], // what you want to consume
|
|
582
|
+
purpose: "Mirror signals into our risk desk",
|
|
583
|
+
});`,notes:"Both apps must be CONNECT-type (not INTERNAL). Returns the pending grant; nothing flows until the publisher approves."},approveAccess:{feature:"Approve / reject an access request (publisher side)",whenToUse:"As the publisher, accept (optionally rate-limited / time-boxed) or decline an inbound request.",snippet:`await np.connect.connect.approveAccess({
|
|
584
|
+
grantId,
|
|
585
|
+
rateLimit: { perSecond: 50, perDay: 100000 }, // optional
|
|
586
|
+
expiresAt: Date.now() + 30 * 864e5, // optional (ms epoch)
|
|
587
|
+
});
|
|
588
|
+
// or decline: np.connect.connect.rejectAccess({ grantId, reason })`,notes:"Only the publisher org can approve/reject. After approval, fan-out to the subscriber is authorized by the grant."},listGrants:{feature:"List / inspect your grants",whenToUse:"See inbound and outbound grants, their status, and usage; revoke when no longer needed.",snippet:`const { items } = await np.connect.connectAccess.listMyGrants({}); // { items, nextCursor?, hasMore }
|
|
589
|
+
// one grant: np.connect.connectAccess.getGrant({ grantGid })
|
|
590
|
+
// revoke: np.connect.connect.revokeGrant({ grantId })`,notes:"Reads are projected from the cell's synced copy; revoke is the admin-first write."},createBridge:{feature:"Identity Bridge (cross-platform entity mapping)",whenToUse:"When two orgs name the same real entity differently (Shopify customer_123 vs HubSpot contact_XYZ). A bilateral, consent-based bridge lets events translate IDs across the boundary.",snippet:`const { gid } = await np.connect.connect.createBridge({
|
|
591
|
+
targetOrgGID, // the other business's org GID
|
|
592
|
+
entityTypeSlug: "customer",
|
|
593
|
+
});
|
|
594
|
+
// the TARGET org confirms to activate (bilateral):
|
|
595
|
+
await np.connect.connect.confirmBridge({ gid });`,notes:"Starts pending (confirmedBySource only); becomes active when BOTH sides confirm. List via np.connect.connectBridges.listBridges. Suspend/archive via np.connect.identityBridges.suspendBridge({ gid }) / np.connect.identityBridges.archiveBridge({ gid })."},tenantApproval:{feature:"Tenant consent (platform apps)",whenToUse:"A multi-tenant platform app proving a specific tenant (store/business) consented to a cross-org connection on an active grant.",snippet:`const challenge = await np.connect.connect.initiateTenantApproval({
|
|
596
|
+
grantId,
|
|
597
|
+
tenantId: "store_42",
|
|
598
|
+
tenantDisplayName: "Acme Store",
|
|
599
|
+
redirectUri: "https://app.example.com/connect/done", // optional
|
|
600
|
+
});
|
|
601
|
+
// challenge carries the consent URL + expiry; revoke later:
|
|
602
|
+
// np.connect.connect.revokeTenantApproval({ approvalId })`,notes:"Caller must be the SUBSCRIBER org on an ACTIVE grant; an existing active approval is a CONFLICT. Read state via np.connect.connectTenantApproval.listTenantApprovals({ grantGid })."}},cO={decisionGuide:{visibility:"public = listed + profile visible to all. listed = appears in Explore. unlisted = reachable by direct link only. private = not discoverable (default). INTERNAL-type apps can never be made discoverable \u2014 they are org-private by design.",accessVsBridge:"Access GRANT = subscribe to another org's event types (the core cross-org handshake: request -> approve). Identity BRIDGE = translate entity IDs across two orgs that name the same entity differently (needed only for cross-platform ID mapping). Most integrations need only a grant; add a bridge when the two sides use different IDs for the same customer/order.",tenantConsent:"Plain grant = org-to-org. Tenant approval = a platform app proving an individual tenant (store/business) consented \u2014 required before per-tenant events may flow on that grant."},core:["profile (connectVisibility, connectDescription, publishedEventTypes, platformSlug)","explore (search / list / get discoverable apps in other orgs)","access grants (request -> approve/reject, rate-limit, expiry, list, revoke)","identity bridges (create -> bilateral confirm, suspend, archive, list)","tenant approvals (initiate consent challenge, revoke, list)","partner governance (freeze / reinstate / delist apps on your platformSlug) \u2014 connect:admin"],notDeclarable:["the profile (managed through the np.connect.* SDK calls, not declared in connect.config.ts)","exchanges / AMQP routing across orgs"]};var bc="1.0.1",lO="https://api.npayload.com/schemas/pipes/pipe-definition.schema.json";var dO="execution_output",uO="execution_input",pO={condition:["true","false"],loop:["loop-body","done"],"error-handler":["success","error"],retry:["success","exhausted"],parallel:["branch-1","branch-2","branch-3"]},mO="switch",as="default",OE=["manual","schedule","event"],wc=[{type:"manual",requiredAnyOf:[[]],keys:["inputData"],summary:"A manual trigger needs no key is needed."},{type:"schedule",requiredAnyOf:[["cron"]],keys:["cron","timezone"],summary:'A schedule trigger needs `cron` (a cron expression such as "0 9 * * 1").'},{type:"event",requiredAnyOf:[["channel"],["eventType"]],keys:["channel","eventType"],summary:'A event trigger needs `channel` (the channel it listens on, a slug or a gid) and `eventType` (the event type it fires on, such as "order.created").'}];var fO=["condition","switch","loop","filter","merge","setVariable","delay","transform","http","log","ai","classify","generate","extract","summarize","agent"],gO="condition: Routes on a true/false test (handles: true, false). switch: Routes to one of its cases (handles: each case, default). loop: Runs its body for each item (handles: loop-body, done). filter: Keeps the items that pass a test. merge: Joins the outputs of several branches. setVariable: Sets a pipe variable. delay: Waits before the next step. transform: Reshapes data (config.input, config.mapping). http: Calls an HTTP endpoint (config.url, config.method). log: Writes a line to the run log (config.message). ai: An AI step (config.prompt). classify: An AI classification step (config.prompt). generate: An AI generation step (config.prompt). extract: An AI extraction step (config.prompt). summarize: An AI summary step (config.prompt). agent: An AI agent step.",hO="connector",zp="{ actionId, params }";var yO="npayload://pipes/authoring-flow",$E="npayload://pipes/definition-schema",vO="pipes_author";var kc=`npayload Pipes: how to author a pipe (pipe definition schema 1.0.1, https://api.npayload.com/schemas/pipes/pipe-definition.schema.json).
|
|
603
|
+
|
|
604
|
+
Follow these steps in this order. Every fact below is generated from the pipe definition schema and its v1 connector catalogue; the schema itself is the MCP resource npayload://pipes/definition-schema.
|
|
605
|
+
|
|
606
|
+
1. Discover the connectors. Call pipes_catalog. It returns your organization's live connector catalogue: every connector, every action, and each action's inputSchema and outputSchema. The v1 catalogue: condition (evaluate); delay (wait, waitUntil); error-handler (its own settings in config, no action); events (publish, get); http (request, get, post); log (log, inspect, passthrough); loop (its own settings in config, no action); noop (passthrough); parallel (fork, join, map, race); primus-agent (execute_agent, search_memory, store_memory, list_skills, check_approval); retry (its own settings in config, no action); switch (evaluate); transform (map, filter, reduce, merge, pick, omit, parse, format, flatten, group, sort). Never write a connector id or an action id from memory.
|
|
607
|
+
|
|
608
|
+
2. Read their input schemas. For each connector step you plan, read that action's inputSchema in the pipes_catalog result. Its params go in data.config.params, typed by that inputSchema, and only there; a param value may be a template such as {{trigger.amount}}, resolved at run time.
|
|
609
|
+
|
|
610
|
+
3. Draft the definition. Call pipes_build with a spec of nodes and edges; it writes node.type, the handles and the layout for you and returns { definition, triggerConfig }.
|
|
611
|
+
- Exactly one trigger node, the entry (no edge leads into it). Its type and config become the trigger config:
|
|
612
|
+
- manual: A manual trigger needs no key is needed.
|
|
613
|
+
- schedule: A schedule trigger needs \`cron\` (a cron expression such as "0 9 * * 1").
|
|
614
|
+
- event: A event trigger needs \`channel\` (the channel it listens on, a slug or a gid) and \`eventType\` (the event type it fires on, such as "order.created").
|
|
615
|
+
- A built-in step: nodeType one of condition, switch, loop, filter, merge, setVariable, delay, transform, http, log, ai, classify, generate, extract, summarize, agent; its settings are read flat from config.
|
|
616
|
+
- A connector step: nodeType "connector", connectorId from the catalogue, config { actionId, params }, and credentials { <connectorId>: <credential gid> } when the connector signs in.
|
|
617
|
+
- A step with branches is left by a named branch: condition true|false \xB7 loop loop-body|done \xB7 error-handler success|error \xB7 retry success|exhausted \xB7 parallel branch-1|branch-2|branch-3 \xB7 switch <each case>|default. Any other step is left by execution_output.
|
|
618
|
+
|
|
619
|
+
4. Validate it. Call pipes_validate_definition with the definition and the trigger config. It applies every check the create door applies and writes nothing: { valid: true } or every reason the door would refuse.
|
|
620
|
+
|
|
621
|
+
5. Create the pipe. Call pipes_create with the same spec. The door validates again before it writes anything. Pass activate: true to publish it at once; where your organization's Pipes settings ask for a review, activation answers REVIEW_REQUIRED and a person publishes it.
|
|
622
|
+
|
|
623
|
+
6. Run it. Call pipes_run with the workflow id (the pipe must be active). It returns the execution id.
|
|
624
|
+
|
|
625
|
+
7. Inspect the run. Call pipes_get_execution with the execution id until its status is completed, failed or cancelled; each step's run carries its status, its output and its error.
|
|
626
|
+
|
|
627
|
+
8. Iterate on the reasons returned. A refused definition answers PIPE_DEFINITION_INVALID with every reason: its path, what was expected there, what was got, and didYouMean when an id is mistyped. Fix each reason at its path and go back to step 4; a failed run's step errors send you back to step 2 or 3.`,bO={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://api.npayload.com/schemas/pipes/pipe-definition.schema.json",title:"npayload pipe definition",description:"A pipe as the Pipes engine runs it: the definition (nodes and edges) and the trigger config. Each node is typed by data.nodeType, the type the engine runs; a connector node names its connector (data.connectorId), its action (data.config.actionId) and its params (data.config.params), typed by the action's input schema. A params value may be a template such as {{trigger.amount}}, resolved at run time.","x-schema-version":"1.0.1","x-generated-from":"the Pipes v1 node contract and connector catalogue (condition, delay, error-handler, events, http, log, loop, noop, parallel, primus-agent, retry, switch, transform)","x-linear-handle":"execution_output","x-target-handle":"execution_input","x-branch-handles":{condition:["true","false"],loop:["loop-body","done"],"error-handler":["success","error"],retry:["success","exhausted"],parallel:["branch-1","branch-2","branch-3"],switch:["<each case: its branch, name or id>","default"]},type:"object",required:["definition","triggerConfig"],properties:{name:{type:"string",description:"The pipe's name."},description:{type:"string"},definition:{type:"object",required:["nodes","edges"],additionalProperties:!1,properties:{nodes:{type:"array",items:{type:"object",required:["id","type","position","data"],properties:{id:{type:"string",minLength:1},type:{type:"string",description:"The canvas category the dashboard draws the node as: trigger, logic or action. The engine runs data.nodeType."},position:{type:"object",required:["x","y"],properties:{x:{type:"number"},y:{type:"number"}},description:"Where the node sits on the dashboard canvas."},data:{oneOf:[{type:"object",title:"trigger node",required:["nodeType"],properties:{nodeType:{enum:["trigger","manual","schedule","event"]},label:{type:"string",description:"The name the dashboard shows on the node."},config:{type:"object"}},description:"The pipe's entry. At most one per pipe; no edge leads into it."},{type:"object",title:"built-in node",required:["nodeType"],not:{required:["connectorId"]},properties:{nodeType:{enum:["condition","switch","loop","filter","merge","setVariable","delay","transform","http","log","ai","classify","generate","extract","summarize","agent"]},label:{type:"string",description:"The name the dashboard shows on the node."},config:{type:"object",description:"The node's settings, read flat from data.config (e.g. log reads config.message)."}},description:"condition: Routes on a true/false test (handles: true, false). switch: Routes to one of its cases (handles: each case, default). loop: Runs its body for each item (handles: loop-body, done). filter: Keeps the items that pass a test. merge: Joins the outputs of several branches. setVariable: Sets a pipe variable. delay: Waits before the next step. transform: Reshapes data (config.input, config.mapping). http: Calls an HTTP endpoint (config.url, config.method). log: Writes a line to the run log (config.message). ai: An AI step (config.prompt). classify: An AI classification step (config.prompt). generate: An AI generation step (config.prompt). extract: An AI extraction step (config.prompt). summarize: An AI summary step (config.prompt). agent: An AI agent step."},{type:"object",title:"connector condition",description:"Evaluate conditions and branch workflow execution",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"condition"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this condition node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",required:["params"],additionalProperties:!1,properties:{actionId:{const:"evaluate",description:"Evaluate Condition"},params:{type:"object",properties:{condition:{oneOf:[{type:"object",properties:{field:{type:"string",description:"Field to evaluate"},operator:{type:"string",enum:["equals","notEquals","greaterThan","greaterThanOrEquals","lessThan","lessThanOrEquals","contains","notContains","startsWith","endsWith","matches","isEmpty","isNotEmpty","isNull","isNotNull","isTrue","isFalse"],description:"Comparison operator"},value:{description:"Value to compare against"}},required:["field","operator"]},{type:"object",properties:{logic:{type:"string",enum:["and","or"]},conditions:{type:"array",items:{type:"object"}}},required:["logic","conditions"]}]},data:{type:"object",description:"Data object to evaluate conditions against"}},required:["condition"]}},description:"Evaluate a condition or group of conditions"}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector delay",description:"Wait for a specified duration or until a specific time",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"delay"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this delay node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",required:["actionId"],additionalProperties:!1,properties:{actionId:{const:"wait",description:"Wait"},params:{type:"object",properties:{duration:{type:"number",description:"Duration to wait in milliseconds",minimum:0,maximum:3e5},durationSeconds:{type:"number",description:"Duration to wait in seconds",minimum:0,maximum:300},durationMinutes:{type:"number",description:"Duration to wait in minutes",minimum:0,maximum:5}}}},description:"Wait for a specified duration"},{type:"object",required:["actionId"],additionalProperties:!1,properties:{actionId:{const:"waitUntil",description:"Wait Until"},params:{type:"object",properties:{timestamp:{type:"number",description:"Unix timestamp (milliseconds) to wait until"},datetime:{type:"string",description:"ISO 8601 datetime string to wait until",format:"date-time"},maxWait:{type:"number",description:"Maximum wait time in milliseconds (default: 300000 = 5 min)",default:3e5}}}},description:"Wait until a specific time"}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector error-handler",description:"Try/catch/finally error handling for workflows",required:["nodeType","connectorId"],properties:{nodeType:{const:"connector"},connectorId:{const:"error-handler"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{type:"object",description:"The error-handler node's own settings; the engine's runner reads them itself (no action)."},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector events",description:"Read or publish npayload Events messages \u2014 the pipe's SENSE (events.get) and ACT (events.publish). Org-scoped: you can only touch your own channels and messages.",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"events"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this events node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"publish",description:"Publish to channel"},params:{type:"object",properties:{channel:{type:"string",description:`Target channel \u2014 its slug (e.g. "fulfillment") or gid. MUST belong to your org; the cell rejects any other tenant's channel.`},payload:{type:"object",description:"The message body to publish. Omit to forward the trigger event's data unchanged (republish).",additionalProperties:!0},eventType:{type:"string",description:'Optional event type label recorded on the message metadata (e.g. "order.fulfilled").'},idempotencyKey:{type:"string",description:"Optional idempotency key \u2014 a duplicate publish collapses to the first message."}},required:["channel"],additionalProperties:!1}},description:"Publish a message to one of your Events channels (by slug or gid). Fans out to subscribers and can re-trigger other pipes via event triggers \u2014 closing the autonomy loop."},{type:"object",required:["actionId"],additionalProperties:!1,properties:{actionId:{const:"get",description:"Get message"},params:{type:"object",properties:{messageGid:{type:"string",description:"The message gid to read. Defaults to the trigger event's messageGid, so an event-triggered pipe can omit it to load the event that fired it."}},additionalProperties:!1}},description:"Read an Events message by gid (the pipe's SENSE). An event-triggered pipe omits messageGid to load the very event that fired it \u2014 fan-out passes only the gid, so this is how a pipe gets the payload to ETL."}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector http",description:"Make HTTP requests to any REST API endpoint",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"http"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this http node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"request",description:"HTTP Request"},params:{type:"object",properties:{method:{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],description:"HTTP method",default:"GET"},url:{type:"string",description:"Request URL (must be HTTPS)",format:"uri"},headers:{type:"object",description:"Request headers",additionalProperties:{type:"string"}},queryParams:{type:"object",description:"Query parameters to append to URL",additionalProperties:{type:"string"}},body:{description:"Request body (for POST, PUT, PATCH)"},contentType:{type:"string",enum:["application/json","application/x-www-form-urlencoded","text/plain"],description:"Content type for request body",default:"application/json"},timeout:{type:"number",description:"Request timeout in milliseconds",default:3e4,minimum:1e3,maximum:6e4},followRedirects:{type:"boolean",description:"Whether to follow redirects",default:!0},validateStatus:{type:"boolean",description:"Throw error for non-2xx status codes",default:!0}},required:["url"]}},description:"Make a custom HTTP request"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"get",description:"GET Request"},params:{type:"object",properties:{url:{type:"string",description:"Request URL",format:"uri"},headers:{type:"object",description:"Request headers",additionalProperties:{type:"string"}},queryParams:{type:"object",description:"Query parameters",additionalProperties:{type:"string"}}},required:["url"]}},description:"Make a GET request"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"post",description:"POST Request"},params:{type:"object",properties:{url:{type:"string",description:"Request URL",format:"uri"},headers:{type:"object",description:"Request headers",additionalProperties:{type:"string"}},body:{type:"object",description:"Request body"}},required:["url"]}},description:"Make a POST request with JSON body"}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector log",description:"Log data for debugging workflows",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"log"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this log node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"log",description:"Log Message"},params:{type:"object",properties:{message:{type:"string",description:"Log message"},level:{type:"string",enum:["debug","info","warn","error"],description:"Log level",default:"info"},data:{description:"Optional data to include in log"}},required:["message"]}},description:"Log a message with optional data"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"inspect",description:"Inspect Data"},params:{type:"object",properties:{data:{description:"Data to inspect"},label:{type:"string",description:"Optional label for the inspection"},maxDepth:{type:"number",description:"Maximum depth to inspect",default:3,minimum:1,maximum:10}},required:["data"]}},description:"Inspect and return data structure information"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"passthrough",description:"Passthrough"},params:{type:"object",properties:{data:{description:"Data to pass through"},log:{type:"boolean",description:"Whether to also log the data",default:!1}},required:["data"]}},description:"Pass data through unchanged (useful for debugging flow)"}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector loop",description:"Iterate over arrays and ranges in workflows",required:["nodeType","connectorId"],properties:{nodeType:{const:"connector"},connectorId:{const:"loop"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{type:"object",description:"The loop node's own settings; the engine's runner reads them itself (no action)."},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector noop",description:"Built-in passthrough connector. Returns input as output verbatim \u2014 Pass-state equivalent.",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"noop"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this noop node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",additionalProperties:!1,properties:{actionId:{const:"passthrough",description:"Passthrough"},params:{type:"object",description:"Arbitrary JSON object. The action returns this value verbatim.",additionalProperties:!0}},description:"Return the input unchanged."}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector parallel",description:"Execute multiple branches in parallel",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"parallel"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this parallel node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"fork",description:"Fork"},params:{type:"object",properties:{branches:{type:"array",description:"Names of branches to execute in parallel",items:{type:"string"},minItems:1},maxConcurrency:{type:"number",description:"Maximum branches to run concurrently (default: unlimited)",minimum:1},timeout:{type:"number",description:"Timeout for all branches in milliseconds",minimum:0},continueOnError:{type:"boolean",description:"Continue executing other branches if one fails",default:!1}},required:["branches"]}},description:"Start parallel execution of multiple branches"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"join",description:"Join"},params:{type:"object",properties:{results:{type:"object",description:"Results from parallel branches (branch name -> result)",additionalProperties:{}},waitFor:{type:"string",enum:["all","any","first"],description:"Wait strategy: all, any success, or first to complete",default:"all"},requiredBranches:{type:"array",description:"Branches that must succeed (optional)",items:{type:"string"}}},required:["results"]}},description:"Wait for and aggregate results from parallel branches"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"map",description:"Parallel Map"},params:{type:"object",properties:{items:{type:"array",description:"Items to process in parallel",items:{}},maxConcurrency:{type:"number",description:"Maximum parallel executions",minimum:1,default:10},continueOnError:{type:"boolean",description:"Continue processing other items if one fails",default:!0}},required:["items"]}},description:"Process array items in parallel (returns items for iteration)"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"race",description:"Race"},params:{type:"object",properties:{branches:{type:"array",description:"Names of branches to execute in parallel",items:{type:"string"},minItems:1},maxConcurrency:{type:"number",description:"Maximum branches to run concurrently (default: unlimited)",minimum:1},timeout:{type:"number",description:"Timeout for all branches in milliseconds",minimum:0},continueOnError:{type:"boolean",description:"Continue executing other branches if one fails",default:!1}},required:["branches"]}},description:"Execute branches and return first result"}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector primus-agent",description:"Execute npayload Primus AI agents",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"primus-agent"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this primus-agent node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"execute_agent",description:"Execute Agent"},params:{type:"object",properties:{agentId:{type:"string",description:"Primus agent ID"},goal:{type:"string",description:"What the agent should accomplish (mapped to Primus 'message' field)"},context:{type:"object",description:"Additional context \u2014 merged into Primus 'config'"},maxExecutionTime:{type:"number",description:"Max execution time in ms",default:3e4},testMode:{type:"boolean",description:"When true, sends X-Primus-Test-Mode: 1 so Primus returns an echo fixture instead of invoking the real LLM. Not for production.",default:!1}},required:["agentId","goal"]}},description:"Run a Primus agent with a goal and optional context"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"search_memory",description:"Search Memory"},params:{type:"object",properties:{agentId:{type:"string",description:"Primus agent ID"},query:{type:"string",description:"Search query"},topK:{type:"number",default:5,description:"Number of results"}},required:["agentId","query"]}},description:"Search an agent's memory using hybrid RAG. Not available yet."},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"store_memory",description:"Store Memory"},params:{type:"object",properties:{agentId:{type:"string",description:"Primus agent ID"},content:{type:"string",description:"Content to store"},type:{type:"string",enum:["episodic","semantic","procedural"],default:"semantic",description:"Memory type"},metadata:{type:"object",description:"Additional metadata"}},required:["agentId","content"]}},description:"Store content in an agent's memory. Not available yet."},{type:"object",required:["actionId"],additionalProperties:!1,properties:{actionId:{const:"list_skills",description:"List Skills"},params:{type:"object",properties:{agentId:{type:"string",description:"Primus agent ID"},category:{type:"string",description:"Filter by category"}}}},description:"List available skills for an agent. Not available yet."},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"check_approval",description:"Check Approval"},params:{type:"object",properties:{approvalId:{type:"string",description:"Approval request ID"}},required:["approvalId"]}},description:"Check the status of a pending approval request. Not available yet."}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector retry",description:"Retry operations with exponential backoff",required:["nodeType","connectorId"],properties:{nodeType:{const:"connector"},connectorId:{const:"retry"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{type:"object",description:"The retry node's own settings; the engine's runner reads them itself (no action)."},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector switch",description:"Multi-way branching based on value matching",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"switch"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this switch node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",required:["params"],additionalProperties:!1,properties:{actionId:{const:"evaluate",description:"Evaluate Switch"},params:{type:"object",properties:{value:{description:"Value to switch on"},cases:{type:"array",description:"Case definitions",items:{type:"object",properties:{match:{description:"Value(s) to match",oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array",items:{}}]},name:{type:"string",description:"Branch name for this case"},output:{description:"Optional output data for this case"}},required:["match","name"]}},default:{type:"object",description:"Default case if no match",properties:{name:{type:"string"},output:{}}},strict:{type:"boolean",description:"Use strict equality (===) for comparison",default:!0}},required:["value","cases"]}},description:"Match value against cases and determine branch"}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector transform",description:"Data transformation and manipulation",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"transform"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this transform node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"map",description:"Map"},params:{type:"object",properties:{input:{description:"Input data to transform"},mapping:{type:"object",description:"Mapping of output field -> input path or expression",additionalProperties:{type:"string"}}},required:["input","mapping"]}},description:"Map/transform data using field mappings"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"filter",description:"Filter"},params:{type:"object",properties:{items:{type:"array",description:"Array to filter",items:{}},condition:{type:"object",description:"Filter condition",properties:{field:{type:"string"},operator:{type:"string"},value:{}},required:["field","operator"]}},required:["items","condition"]}},description:"Filter array items based on condition"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"reduce",description:"Reduce"},params:{type:"object",properties:{items:{type:"array",description:"Array to reduce",items:{}},operation:{type:"string",enum:["sum","count","min","max","avg","first","last","concat","unique"],description:"Reduction operation"},field:{type:"string",description:"Field to operate on (for objects)"},initialValue:{description:"Initial value for reduction"}},required:["items","operation"]}},description:"Reduce array to single value"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"merge",description:"Merge"},params:{type:"object",properties:{objects:{type:"array",description:"Objects to merge",items:{type:"object"}},strategy:{type:"string",enum:["shallow","deep","replace"],description:"Merge strategy",default:"shallow"}},required:["objects"]}},description:"Merge multiple objects into one"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"pick",description:"Pick"},params:{type:"object",properties:{input:{type:"object"},fields:{type:"array",items:{type:"string"}}},required:["input","fields"]}},description:"Pick specific fields from object"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"omit",description:"Omit"},params:{type:"object",properties:{input:{type:"object"},fields:{type:"array",items:{type:"string"}}},required:["input","fields"]}},description:"Omit specific fields from object"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"parse",description:"Parse"},params:{type:"object",properties:{input:{type:"string",description:"String to parse"},format:{type:"string",enum:["json","csv","querystring","number","boolean","date"],description:"Format to parse"},options:{type:"object",description:"Format-specific options"}},required:["input","format"]}},description:"Parse string into structured data"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"format",description:"Format"},params:{type:"object",properties:{input:{description:"Data to format"},format:{type:"string",enum:["json","csv","querystring","string","number","date"],description:"Output format"},options:{type:"object",description:"Format-specific options"}},required:["input","format"]}},description:"Format data into string"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"flatten",description:"Flatten"},params:{type:"object",properties:{input:{},depth:{type:"number",default:1},separator:{type:"string",default:"."}},required:["input"]}},description:"Flatten nested object or array"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"group",description:"Group"},params:{type:"object",properties:{items:{type:"array",items:{type:"object"}},by:{type:"string",description:"Field to group by"}},required:["items","by"]}},description:"Group array items by field"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"sort",description:"Sort"},params:{type:"object",properties:{items:{type:"array"},by:{type:"string",description:"Field to sort by"},direction:{type:"string",enum:["asc","desc"],default:"asc"}},required:["items"]}},description:"Sort array items"}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"node typed by node.type",not:{required:["nodeType"]},properties:{label:{type:"string",description:"The name the dashboard shows on the node."},config:{type:"object"}},description:"No data.nodeType: the engine dispatches on node.type, which must then be a built-in node type."}]}},if:{properties:{data:{not:{required:["nodeType"]}}}},then:{properties:{type:{enum:["trigger","manual","schedule","event","condition","switch","loop","filter","merge","setVariable","delay","transform","http","log","ai","classify","generate","extract","summarize","agent"]}}}}},edges:{type:"array",items:{type:"object",required:["id","source","target"],additionalProperties:!1,properties:{id:{type:"string",minLength:1},source:{type:"string",description:"The id of the node the edge leaves."},target:{type:"string",description:"The id of the node the edge enters (never the trigger)."},sourceHandle:{type:"string",description:`The branch the edge leaves by: "execution_output" for a step without branches, or one of the node's branches (x-branch-handles: condition true|false, switch each case|default, loop loop-body|done, error-handler success|error, retry success|exhausted, parallel branch-1|branch-2|branch-3).`},targetHandle:{enum:["execution_input"]}}}},viewport:{type:"object",required:["x","y","zoom"],properties:{x:{type:"number"},y:{type:"number"},zoom:{type:"number"}}},maxDurationMs:{type:"integer",minimum:1,maximum:864e5,description:"The pipe's run time limit, in milliseconds. A run still going when its next step would start after this limit stops, failed with the error code TIMEOUT. From 1 to 86400000 (24 hours); 1 hour when absent."}}},triggerConfig:{description:"When the pipe runs. One of the v1 trigger types, with the config keys it needs.",oneOf:[{type:"object",title:"manual trigger",required:["type","config"],additionalProperties:!1,properties:{type:{const:"manual"},config:{type:"object",properties:{inputData:{type:"object"}},description:"A manual trigger needs no key is needed."}}},{type:"object",title:"schedule trigger",required:["type","config"],additionalProperties:!1,properties:{type:{const:"schedule"},config:{type:"object",properties:{cron:{type:"string",minLength:1},timezone:{type:"string",minLength:1}},description:'A schedule trigger needs `cron` (a cron expression such as "0 9 * * 1").',required:["cron"]}}},{type:"object",title:"event trigger",required:["type","config"],additionalProperties:!1,properties:{type:{const:"event"},config:{type:"object",properties:{channel:{type:"string",minLength:1},eventType:{type:"string",minLength:1}},description:'A event trigger needs `channel` (the channel it listens on, a slug or a gid) and `eventType` (the event type it fires on, such as "order.created").',anyOf:[{required:["channel"]},{required:["eventType"]}]}}}]}}};var pM=dO,mM=uO,Lr=Object.fromEntries(Object.entries(pO).map(([e,t])=>[e,[...t]])),Dr=mO,Ec=OE,On=hO,fM=new Set(["condition","switch","loop","filter","merge","setVariable","delay"]),Gr=Object.fromEntries([...OE.map(e=>[e,"trigger"]),...fO.map(e=>[e,fM.has(e)?"logic":"action"])]),wO=kc;function gM(e){return e.nodeType===On?"action":Gr[e.nodeType]??"action"}s(gM,"backendTypeOf");function kO(e){return e.nodeType===On?e.connectorId??On:e.nodeType}s(kO,"brancherKey");function hM(e,t,r){let o=kO(e),n=o===Dr||o in Lr;if(!t){if(n){let a=o===Dr?[...r,as]:Lr[o];throw new Error(`Node "${e.id}" (${o}) is a brancher \u2014 connect FROM one of its branches (${a.join(", ")||"define cases first"}) via { branch }, not a linear edge.`)}return pM}if(o===Dr){let a=[...r,as];if(!a.includes(t))throw new Error(`switch branch "${t}" is not a configured case. Allowed: ${a.join(", ")} (cases come from config.cases, or config.params.cases on a switch connector step).`);return t}if(!n)throw new Error(`Node "${e.id}" (${o}) has no branches \u2014 use a linear edge (omit "branch").`);let i=Lr[o];if(!i.includes(t))throw new Error(`Branch "${t}" is invalid for "${o}". Allowed: ${i.join(", ")}.`);return t}s(hM,"resolveSourceHandle");function yM(e,t){let r=new Map;e.forEach(u=>r.set(u,0)),t.forEach(u=>r.set(u.to,(r.get(u.to)??0)+1));let o=new Map,n=e.filter(u=>(r.get(u)??0)===0);n.length===0&&e.length&&(n=[e[0]]),n.forEach(u=>o.set(u,0));let i=new Map;t.forEach(u=>i.set(u.from,[...i.get(u.from)??[],u.to]));let a=[...n],c=0;for(;a.length&&c++<1e4;){let u=a.shift(),m=o.get(u)??0;for(let p of i.get(u)??[]){let f=Math.max(o.get(p)??0,m+1);o.get(p)!==f&&(o.set(p,f),a.push(p))}}e.forEach(u=>{o.has(u)||o.set(u,0)});let l=new Map;e.forEach(u=>{let m=o.get(u);l.set(m,[...l.get(m)??[],u])});let d={};for(let[u,m]of l)m.forEach((p,f)=>{d[p]={x:80+u*320,y:120+f*180}});return d}s(yM,"layout");function CE(e){if(!e?.nodes?.length)throw new Error("A pipe needs at least one node.");let t=new Set;for(let l of e.nodes){if(!l.id)throw new Error("Every node needs an id.");if(!l.nodeType)throw new Error(`Node "${l.id}" needs a nodeType (a built-in like "condition"/"log", or "connector" with a connectorId \u2014 see pipes_catalog).`);if(l.nodeType===On&&!l.connectorId)throw new Error(`Node "${l.id}" has nodeType "connector" but no connectorId \u2014 set connectorId to a connector from pipes_catalog (e.g. "events").`);if(l.nodeType!==On&&l.connectorId)throw new Error(`Node "${l.id}" sets connectorId "${l.connectorId}" but nodeType is "${l.nodeType}" \u2014 a connector node MUST use nodeType "connector". For a built-in node, drop connectorId.`);if(l.nodeType!==On&&!(l.nodeType in Gr))throw new Error(`Node "${l.id}" has nodeType "${l.nodeType}", which is not authorable in v1. Use a built-in (${Object.keys(Gr).join(", ")}) or nodeType "connector" with a connectorId from pipes_catalog.`);if(t.has(l.id))throw new Error(`Duplicate node id "${l.id}".`);t.add(l.id)}let r=e.edges??[];for(let l of r){if(!t.has(l.from))throw new Error(`Edge.from "${l.from}" is not a node id.`);if(!t.has(l.to))throw new Error(`Edge.to "${l.to}" is not a node id.`)}let o=yM(e.nodes.map(l=>l.id),r),n=new Map(e.nodes.map(l=>[l.id,l])),i=new Map;for(let l of e.nodes)kO(l)===Dr&&i.set(l.id,bM(l));let a=e.nodes.map(l=>({id:l.id,type:gM(l),position:o[l.id]??{x:80,y:120},data:{nodeType:l.nodeType,label:l.label??l.id,config:l.config??{},...l.connectorId?{connectorId:l.connectorId}:{},...l.credentials&&Object.keys(l.credentials).length?{credentials:l.credentials}:{}}})),c=r.map(l=>{let d=n.get(l.from),u=hM(d,l.branch,i.get(l.from)??[]);return{id:`edge-${l.from}-${l.to}-${u}`,source:l.from,target:l.to,sourceHandle:u,targetHandle:mM}});return{nodes:a,edges:c}}s(CE,"buildPipeDefinition");function vM(e){return e.nodes.find(t=>Ec.includes(t.nodeType))}s(vM,"triggerNodeOf");function NE(e,t){let r=vM(e);return r?{type:r.nodeType,config:r.config??{}}:{type:t?.type??"manual",config:t?.config??{}}}s(NE,"triggerConfigOf");function bM(e){let t=e.config??{},r=t.params&&typeof t.params=="object"?t.params:{},o=Array.isArray(r.cases)?r.cases:Array.isArray(t.cases)?t.cases:[],n=[];for(let i of o){if(!i||typeof i!="object")continue;let a=i,c=[a.branch,a.name,a.id].find(l=>typeof l=="string"&&l.length>0);c&&n.push(c)}return n}s(bM,"switchCaseNames");function EO(e){let t=new Map;for(let r of e){let o=String(r.id??r.connectorId??r._id??"");if(!o)continue;let n=new Map;for(let a of r.actions??[]){let c=String(a.id??a.actionId??"");c&&n.set(c,{actionId:c,inputSchema:a.inputSchema??void 0})}let i=r.auth?.type;t.set(o,{actions:n,needsCredential:!!i&&i!=="none"})}return{connectors:t}}s(EO,"indexConnectorCatalog");function wM(e,t){let r=e.length,o=t.length;if(Math.abs(r-o)>3)return 99;let n=Array.from({length:r+1},(i,a)=>[a,...new Array(o).fill(0)]);for(let i=0;i<=o;i++)n[0][i]=i;for(let i=1;i<=r;i++)for(let a=1;a<=o;a++)n[i][a]=Math.min(n[i-1][a]+1,n[i][a-1]+1,n[i-1][a-1]+(e[i-1]===t[a-1]?0:1));return n[r][o]}s(wM,"editDistance");function Bp(e,t){let r=e.toLowerCase();return t.map(n=>{let i=n.toLowerCase(),a=i.includes(r)||r.includes(i)?0:wM(r,i);return{c:n,score:a}}).filter(n=>n.score<=3).sort((n,i)=>n.score-i.score).slice(0,3).map(n=>n.c)}s(Bp,"suggestIds");function LE(e,t,r){let o=[],n=[],i=Object.keys(Gr);for(let[l,d]of(e.nodes??[]).entries())if(d.nodeType===On){let u=d.config??{},m=Object.keys(u).filter(g=>g!=="actionId"&&g!=="params");if(("actionId"in u||"params"in u||(t?.connectors.get(d.connectorId??"")?.actions.size??0)>0)&&m.length&&o.push(`Node "${d.id}" (connector "${d.connectorId}"): its params go under config.params (definition.nodes[${l}].data.config.params, where the engine reads them), but ${m.map(g=>`"${g}"`).join(", ")} sit flat in config. Write config ${zp}: { actionId: "${String(u.actionId??"<action>")}", params: { ${m.join(", ")} } }.`),!t)continue;let f=d.connectorId?t.connectors.get(d.connectorId):void 0;if(!f){let g=[...t.connectors.keys()],h=d.connectorId?Bp(d.connectorId,g):[];o.push(`Node "${d.id}": connector "${d.connectorId}" does NOT exist in this deployment`+(h.length?` \u2014 did you mean ${h.map(y=>`"${y}"`).join(" / ")}?`:"")+` Call pipes_catalog for the ${g.length} available connectors; never guess a connectorId.`);continue}if(f.actions.size>0){let g=d.config?.actionId;if(!g)o.push(`Node "${d.id}" (connector "${d.connectorId}"): config.actionId is required (definition.nodes[${l}].data.config.actionId) \u2014 one of: ${[...f.actions.keys()].join(", ")}.`);else if(f.actions.has(g)){if(r){let h=f.actions.get(g).inputSchema;if(h&&typeof h=="object"){let y=u.params??{},v=r(h,y);for(let S of v)o.push(`Node "${d.id}" (${d.connectorId}.${g}): params ${S} (definition.nodes[${l}].data.config.params) \u2014 the schema is in pipes_catalog under this action's inputSchema.`)}}}else{let h=Bp(g,[...f.actions.keys()]);o.push(`Node "${d.id}": action "${g}" does not exist on connector "${d.connectorId}"`+(h.length?` \u2014 did you mean ${h.map(y=>`"${y}"`).join(" / ")}?`:"")+` Valid actions: ${[...f.actions.keys()].join(", ")}.`)}}f.needsCredential&&n.push(`Node "${d.id}" (connector "${d.connectorId}") requires a CREDENTIAL \u2014 configure one for this connector (dashboard \u2192 Pipes \u2192 Credentials) or the node fails at run time with an auth error.`)}else if(!i.includes(d.nodeType)){let u=Bp(d.nodeType,i),m=t?Bp(d.nodeType,[...t.connectors.keys()]):[];o.push(`Node "${d.id}": "${d.nodeType}" is not a built-in node type`+(u.length?` \u2014 did you mean ${u.map(p=>`"${p}"`).join(" / ")}?`:"")+(m.length?` If you meant the "${m[0]}" integration, use nodeType "connector" with connectorId "${m[0]}".`:' For an integration, use nodeType "connector" + a connectorId from pipes_catalog.')+` Built-ins: ${i.join(", ")}.`)}let a=(e.nodes??[]).filter(l=>Ec.includes(l.nodeType)),c=e.edges??[];if(a.length===0)n.push("No trigger node \u2014 the workflow gets triggerType 'manual' by default. Add ONE trigger node (manual|schedule|event) as the entry for an explicit trigger.");else if(a.length>1)o.push(`${a.length} trigger nodes (${a.map(l=>`"${l.id}"`).join(", ")}) \u2014 a workflow has exactly ONE trigger. Keep one; downstream steps hang off it.`);else{let l=a[0];if(c.some(d=>d.to===l.id)&&o.push(`Trigger node "${l.id}" has an INCOMING edge \u2014 the trigger is the entry; nothing routes into it.`),e.nodes.length>1){let d=new Set([l.id]),u=!0;for(;u;){u=!1;for(let p of c)d.has(p.from)&&!d.has(p.to)&&(d.add(p.to),u=!0)}let m=e.nodes.filter(p=>!d.has(p.id));m.length&&o.push(`Node(s) ${m.map(p=>`"${p.id}"`).join(", ")} are not reachable from the trigger "${l.id}" \u2014 they will never execute and render disconnected. Wire them with edges (or remove them).`)}}return{ok:o.length===0,issues:o,warnings:n}}s(LE,"validateSpecAgainstCatalog");Vr();mn();function Kp(e){return e.key.split(".")[0]??"other"}s(Kp,"productOf");var DE=[];function SO(e){let t=new Set(ye.commands.map(o=>o.key)),r=new Set;DE=e.filter(o=>t.has(o.key)||r.has(o.key)?!1:(r.add(o.key),!0))}s(SO,"setCatalogExtraRows");function Qp(){return DE.length===0?[...ye.commands]:[...ye.commands,...DE]}s(Qp,"catalogRows");function kM(e){return{key:e.key,method:e.method,path:e.pattern,summary:e.summary,isQuery:e.isQuery,idempotent:e.idempotent,scopes:e.scopes,pathParams:e.pathParams.map(t=>({name:t.name,segment:t.key})),args:e.flags.map(t=>({name:t.name,type:t.coerce??"string",required:!t.optional}))}}s(kM,"toCatalogOp");var EM=["events.appDpopKeys.","keys.appDpopKeys."],SM=["credentials.connectors.","pipes.connectors.","pipes.connectorCredentials."],PM=new Set(["events.adapters.createAdapter","events.subscriptions.create","events.subscriptions.revealSecret","events.subscriptions.rotateSecret","events.subscriptions.subscribe","events.subscriptions.update","events.systemEvents.rotateSecret","events.systemEvents.subscribe","events.systemEvents.unsubscribe","webhooks.webhooks.create","webhooks.webhooks.revealSecret","webhooks.webhooks.revoke","webhooks.webhooks.rotateSecret","pipes.webhooks.rotateWebhookSecret","pipes.workflows.updateWorkflow","pipes.governance.revokeConnectorApproval","primus.brainConfig.storeProviderKey","primus.brainConfig.deleteConfig","primus.brainConfig.configure","primus.integrations.connect","primus.integrations.disconnect","primus.integrations.refresh","primus.mcpConnect.beginConnect","primus.mcpConnect.revokeConnection","primus.mcpOauth.beginOauth","primus.mcpOauth.setPreregisteredClient","primus.mcpServers.connect","primus.mcpServers.rotateAuth","primus.mcpServers.test","primus.tenants.suspend","primus.tenants.archive","primus.tools.create","primus.tools.update","primus.tools.importFromOpenApi","primus.triggers.create","primus.triggers.rotateSecret","primus.webhooks.create","primus.configPromotion.applyConfigBundle","billing.connectAccounts.createAccountSession","billing.feedListings.subscribeToListing","billing.feedListings.subscribeToListingWithSavedCard","billing.subscriptions.confirmSubscriptionPayment","billing.subscriptions.createSetupIntent","billing.subscriptions.createSubscription","embed.sessions.create","embed.sessions.revoke","tenants.actAs.actAs","tenants.tenants.close","tenants.tenants.suspend","account.environments.clone","connect.connect.revokeGrant","connect.connect.revokeTenantApproval","connect.publishGrants.revoke","feed.publishers.revokePublisher","connect.connect.partnerOverrideTenantApproval","connect.identityBridges.archiveBridge","connect.connect.partnerDelistApp"]);function IM(e){return e.isQuery?!1:PM.has(e.key)||SM.some(t=>e.key.startsWith(t))}s(IM,"requiresConfirmation");function GE(e){return EM.some(t=>e.startsWith(t))}s(GE,"catalogDenied");function PO(e){let t=e?.trim().toLowerCase()||void 0,r=new Map;for(let n of Qp()){if(GE(n.key))continue;let i=Kp(n);if(t&&i!==t)continue;r.has(i)||r.set(i,[]);let a=kM(n);IM(n)&&(a.summary=`${a.summary} [CREDENTIAL OP \u2014 always confirm with the user before invoking]`),r.get(i).push(a)}let o=[...r.entries()].map(([n,i])=>({product:n,ops:i.sort((a,c)=>a.key.localeCompare(c.key))})).sort((n,i)=>n.product.localeCompare(i.product));return{contentHash:ye.contentHash,generatedAt:ye.generatedAt,products:o,totalOps:o.reduce((n,i)=>n+i.ops.length,0)}}s(PO,"buildCatalog");function Vp(){return[...new Set(Qp().filter(e=>!GE(e.key)).map(e=>Kp(e)))].sort()}s(Vp,"listProducts");function IO(e){return Qp().find(t=>t.key===e)}s(IO,"findOp");var Oo=class extends Error{static{s(this,"UnknownOpError")}suggestions;constructor(t,r){super(`unknown op key "${t}". Call npayload_catalog to discover valid keys`+(r.length?`. Did you mean: ${r.join(", ")}?`:".")),this.name="UnknownOpError",this.suggestions=r}};function TO(e,t=5){let r=e.split(".");return Qp().map(o=>{let n=o.key.split("."),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return{key:o.key,shared:i}}).filter(o=>o.shared>0).sort((o,n)=>n.shared-o.shared||o.key.localeCompare(n.key)).slice(0,t).map(o=>o.key)}s(TO,"suggestKeys");function $n(e){let t=IO(e);if(!t)throw new Oo(e,TO(e));return{method:t.method==="HEAD"?"GET":t.method,path:wf(t.pattern)}}s($n,"contractRouteFor");async function xO(e,t,r){if(GE(e))throw new Oo(e,[]);let o=IO(e);if(!o)throw new Oo(e,TO(e));let n={...t??{}},i=[];for(let l of o.pathParams){let d=n[l.name];if(delete n[l.name],(d==null||d==="")&&l.name==="appId"){let u=await r.resolveAppId();if(!u)throw new Y(`${e} needs a path param "${l.name}" and it could not be resolved from the token \u2014 pass { "${l.name}": "app_\u2026" }.`);d=u}if(d==null||d==="")throw new Y(`${e} requires path param "${l.name}" (URL segment :${l.key}).`);i.push(typeof d=="object"?JSON.stringify(d):String(d))}let a={};for(let[l,d]of Object.entries(n))if(d!=null){if(l==="idempotencyKey"||l==="idempotency-key"){a["idempotency-key"]=String(d);continue}a[l]=typeof d=="object"?JSON.stringify(d):String(d)}let c=pn({row:o,positionals:i,flags:a,newIdempotencyKey:r.newIdempotencyKey});return{row:o,request:c}}s(xO,"composeInvoke");td();se();async function $O(e,t){if(t)return t;let{token:r}=await e.auth.getAccessToken([]),o=JSON.parse(Buffer.from(r.split(".")[1]??"","base64url").toString("utf8"));return o["npayload/appId"]??o.appId??o.app}s($O,"resolveAppIdFromToken");var RM=`npayload Events config-as-code. Write a npayload/events.config.ts that default-exports
|
|
628
|
+
defineEventsConfig({...}). Resources are keyed by their natural identity (the map key):
|
|
629
|
+
|
|
630
|
+
- channels: keyed by slug (lowercase, a-z 0-9 and hyphens). Choose "type":
|
|
631
|
+
"topic" \u2014 fan-out to all subscribers (notifications, broadcasts).
|
|
632
|
+
"queue" \u2014 work distributed across consumers, each message handled once (jobs).
|
|
633
|
+
"stream" \u2014 ordered, replayable log (event sourcing, analytics).
|
|
634
|
+
- eventTypes (catalogue): keyed by event name, conventionally "domain.entity.action"
|
|
635
|
+
(e.g. "commerce.order.created"). Declares ownership + meaning; one per meaningful event.
|
|
636
|
+
The optional "channels" array binds the type to channels BY SLUG (resolved at push).
|
|
637
|
+
- subscriptions: keyed by name. type "webhook" with endpoint.url (https; the URL must be
|
|
638
|
+
publicly reachable). Reference its channel via the "channelGid" field \u2014 the field
|
|
639
|
+
TAKES THE CHANNEL'S SLUG from your config (it is resolved to the id at push);
|
|
640
|
+
never invent ids.
|
|
641
|
+
|
|
642
|
+
Loop: write events.config.ts, then call events_validate (pass the config object, or
|
|
643
|
+
omit it to validate the file you wrote on disk; fix any issues it returns), then
|
|
644
|
+
events_deploy (use check:true first to preview). Then the app publishes with
|
|
645
|
+
np.events.publish("<channel-slug>", payload). Payload typing is the developer's:
|
|
646
|
+
the agent generates the payload shape from the app's schema. NPP transport, signing
|
|
647
|
+
keys, and credentials are handled automatically \u2014 never put them in the config.`,AM=`npayload Connect = cross-org event sharing. An app in one org consumes the event
|
|
648
|
+
types published by an app in ANOTHER org, gated by an explicit access grant.
|
|
649
|
+
|
|
650
|
+
Core flow (subscriber S in org A wants publisher P's events in org B):
|
|
651
|
+
1. P makes itself discoverable + declares what it offers:
|
|
652
|
+
np.connect.connect.updateAppProfile({ appId, connectVisibility, publishedEventTypes }).
|
|
653
|
+
2. S finds P: np.connect.connectExplore.searchExploreApps({ query }).
|
|
654
|
+
3. S requests access: np.connect.connect.requestAccess({ subscriberAppId, publisherAppId, eventTypes }).
|
|
655
|
+
4. P approves: np.connect.connect.approveAccess({ grantId }) \u2014 now P's matching events fan out to S.
|
|
656
|
+
|
|
657
|
+
Add an Identity Bridge ONLY when the two orgs use different ids for the same entity
|
|
658
|
+
(np.connect.connect.createBridge -> the other side confirmBridge). For multi-tenant
|
|
659
|
+
platform apps, prove per-tenant consent with np.connect.connect.initiateTenantApproval
|
|
660
|
+
before per-tenant events flow.
|
|
661
|
+
|
|
662
|
+
Both apps MUST be CONNECT-type \u2014 INTERNAL apps are org-private and refused. The ONLY resource
|
|
663
|
+
you declare in connect.config.ts is identity BRIDGES \u2014 declare them and run connect_deploy
|
|
664
|
+
(reconciled against ADMIN, the source of truth \u2014 admin syncs to cells). Everything else (profile,
|
|
665
|
+
access grants, tenant approvals) is managed through the np.connect.* SDK calls above \u2014 use
|
|
666
|
+
connect_usage for copy-ready snippets. The cross-org HANDSHAKE stays imperative regardless: a
|
|
667
|
+
bridge/grant you declare is an OFFER (pending) until the other org confirms in ITS own config \u2014
|
|
668
|
+
declarative intent, never auto-consent.`;function Ur(){return tu()}s(Ur,"allowInternalUrls");function z(e){return{content:[{type:"text",text:typeof e=="string"?e:JSON.stringify(e,null,2)}]}}s(z,"text");function Se(e,t={}){let r=e?.code;return{...z({ok:!1,...typeof r=="string"?{code:r}:{},type:e instanceof Error?e.name:typeof e,error:e instanceof Error?e.message:String(e),...t}),isError:!0}}s(Se,"toolFailure");function CO(e){let t=e,r=t?.details?.errors;if(!(!t||!Array.isArray(r))&&!(t.code!=="PIPE_DEFINITION_INVALID"&&t.status!==400))return{ok:!1,code:typeof t.code=="string"?t.code:"PIPE_DEFINITION_INVALID",message:typeof t.message=="string"?t.message:"The pipe definition is not valid.",errors:r,schemaVersion:bc,retry:!0,next:"Fix each reason at its path, then call pipes_validate_definition (or pipes_create) again.",...typeof t.requestId=="string"?{requestId:t.requestId}:{}}}s(CO,"pipeDefinitionRefusal");function qE(){for(let e of["connect.config.ts","connect.config.mjs","connect.config.js","npayload/connect.config.ts","npayload/connect.config.mjs","npayload/connect.config.js"]){let t=(0,FE.resolve)(process.cwd(),e);if((0,zE.existsSync)(t))return t}return(0,FE.resolve)(process.cwd(),"connect.config.ts")}s(qE,"findConnectConfig");function OM(){let e=new DO.McpServer({name:"npayload",version:zn()});e.tool("npayload_overview","Call this FIRST, before anything else. Returns the complete deterministic map for working on this npayload project: current project state (config found, credential source, generated artifacts), the exact ordered end-to-end workflow (each step names the MCP tool AND the CLI command), and the hard rules. Follow it step by step \u2014 never guess, never reverse-engineer.",async()=>{let p=null;try{p=lt()}catch{p=null}let f=s(h=>(0,zE.existsSync)((0,NO.join)(process.cwd(),h)),"gen"),g=null;try{let{resolveCredentials:h}=await Promise.resolve().then(()=>(vi(),Ex));g=(await h()).source}catch{g=null}return z({version:zn(),state:{eventsConfig:p,credentialSource:g,generated:{contractLock:f("npayload/_generated/contract.lock"),typedEventPayloads:f("npayload/_generated/events.d.ts"),permissions:f("npayload/permissions.generated.ts")},note:g===null?"No credential source \u2014 run `npx @npayload/sdk init` in this project (or `npayload doctor` for diagnosis) before any deploy/status call.":"Credentials resolve automatically; never read or edit .env / .npayload.json."},...vT()})}),e.tool("events_contract","Return the npayload Events config schema (JSON Schema) + the capability catalog + decision guide + guidance. Call this BEFORE writing or editing events.config.ts \u2014 the schema returned here is the only valid source of config fields (after npayload_overview).",async()=>z({version:ko,guidance:RM,capabilities:rO,schema:Ri})),e.tool("events_usage","Return server-side, copy-ready RUNTIME recipes for using Events from app code (publish variants, queue/outbox consume, streams, KV, webhook verification, catalogue, exchanges, consumer groups, DLQ, snapshots, privacy, NPP). Call this when writing the app code (not just the topology). Optionally pass a feature key to get one recipe.",{feature:C.string().optional().describe('a recipe key (e.g. "queueConsume", "webhookVerify"); omit to get all recipes')},async({feature:p})=>p&&yc[p]?z(yc[p]):z(p?{error:`unknown feature "${p}"`,available:Object.keys(yc)}:{version:ko,recipes:yc})),e.tool("events_validate","Validate an Events config against the contract (structure + security). Pass the config object, OR omit it to validate the project's events.config.ts on disk. Returns { ok, issues } with precise, fixable problems.",{config:C.union([C.record(C.string(),C.unknown()),C.string()]).optional().describe("the EventsConfig object (or a JSON string) to validate; omit to validate events.config.ts on disk"),configPath:C.string().optional().describe("path to events.config.ts (used when `config` is omitted)")},async({config:p,configPath:f})=>{let g=p;if(typeof g=="string")try{g=JSON.parse(g)}catch{}g==null&&(g=await pe(f??lt()));let h=Ca(g,{allowInternalUrls:Ur()});return{...z(h),isError:!h.ok}}),e.tool("events_deploy","Reconcile the project's events.config.ts to your deployment (idempotent). Validates first; pass check:true for a dry-run plan. Mutating: confirm before applying.",{check:C.boolean().optional().describe("dry run: print the plan, apply nothing"),configPath:C.string().optional().describe("path to events.config.ts (default: ./events.config.ts or ./npayload/events.config.ts)")},async({check:p,configPath:f})=>{let g=f??lt(),h=await pe(g),y=Ca(h,{allowInternalUrls:Ur()});if(!y.ok)return{...z({error:"config invalid \u2014 fix before deploy",issues:y.issues}),isError:!0};try{let v=await Te({config:g,check:p??!1,sink:s(()=>{},"sink")});return z(v.output)}catch(v){return Se(v)}}),e.tool("events_status","Show the current sync state between events.config.ts and your deployment (a dry-run plan: what exists, what would change).",{configPath:C.string().optional()},async({configPath:p})=>{let f=p??lt();try{let g=await Te({config:f,check:!0,sink:s(()=>{},"sink")});return z(g.output)}catch(g){return Se(g)}}),e.tool("connect_contract","Return what npayload Connect can do (cross-org event sharing): the connect.config.ts schema (JSON Schema) + the capability catalog + decision guide + guidance. Call FIRST to learn how to write connect.config.ts and drive the np.connect.* SDK.",async()=>z({version:Dh,guidance:AM,capabilities:cO,schema:Xd})),e.tool("pipes_contract","Return the npayload Pipes config schema (JSON Schema) + the capability catalog + decision guide + guidance. Call this BEFORE writing or editing pipes.config.ts \u2014 the schema returned here is the only valid source of config fields.",async()=>z({version:K_,guidance:oO,capabilities:iO,schema:eu})),e.tool("connect_usage","Return server-side, copy-ready RUNTIME recipes for driving Connect from app code (set profile, explore, request/approve access grants, identity bridges, tenant approvals). Call this when writing the cross-org integration. Optionally pass a feature key to get one recipe.",{feature:C.string().optional().describe('a recipe key (e.g. "requestAccess", "createBridge"); omit to get all recipes')},async({feature:p})=>p&&vc[p]?z(vc[p]):z(p?{error:`unknown feature "${p}"`,available:Object.keys(vc)}:{version:Dh,recipes:vc})),e.tool("connect_validate","Validate a connect.config.ts against the contract (structure + security). Pass the config object, OR omit it to validate the project's connect.config.ts on disk. Returns { ok, issues } with precise, fixable problems.",{config:C.union([C.record(C.string(),C.unknown()),C.string()]).optional().describe("the ConnectConfig object (or a JSON string) to validate; omit to validate connect.config.ts on disk"),configPath:C.string().optional().describe("path to connect.config.ts (used when `config` is omitted)")},async({config:p,configPath:f})=>{let g=p;if(typeof g=="string")try{g=JSON.parse(g)}catch{}g==null&&(g=await pe(f??qE()));let h=Gh(g,{allowInternalUrls:Ur()});return{...z(h),isError:!h.ok}}),e.tool("pipes_validate","Validate a Pipes config against the contract (structure + security). Pass the config object, OR omit it to validate the project's pipes.config.ts on disk. Returns { ok, issues } with precise, fixable problems.",{config:C.union([C.record(C.string(),C.unknown()),C.string()]).optional().describe("the PipesConfig object (or a JSON string) to validate; omit to validate pipes.config.ts on disk"),configPath:C.string().optional().describe("path to pipes.config.ts (used when `config` is omitted)")},async({config:p,configPath:f})=>{let g=p;if(typeof g=="string")try{g=JSON.parse(g)}catch{}if(g==null){let y=f??at("pipes");if(!y)return{...z({ok:!1,error:"no pipes.config.ts found \u2014 write npayload/pipes.config.ts first (see pipes_contract)"}),isError:!0};g=await pe(y)}let h=Na(g,{allowInternalUrls:Ur()});return{...z(h),isError:!h.ok}}),e.tool("pipes_deploy","Reconcile the project's pipes.config.ts to your deployment (idempotent, keyed by name). Validates first; pass check:true for a dry-run plan. Mutating: confirm before applying. Governance is admin-gated \u2014 a machine credential gets a clear 'needs admin' note, not a failure.",{check:C.boolean().optional().describe("dry run: print the plan, apply nothing"),configPath:C.string().optional().describe("path to pipes.config.ts (default: ./npayload/pipes.config.ts)")},async({check:p,configPath:f})=>{let g=f??at("pipes");if(!g)return{...z({ok:!1,error:"no pipes.config.ts found \u2014 write npayload/pipes.config.ts first (see pipes_contract)"}),isError:!0};let h=await pe(g),y=Na(h,{allowInternalUrls:Ur()});if(!y.ok)return{...z({error:"config invalid \u2014 fix before deploy",issues:y.issues}),isError:!0};try{let v=await Te({config:g,check:p??!1,sink:s(()=>{},"sink")});return z(v.output)}catch(v){return Se(v)}}),e.tool("pipes_status","Show the current sync state between pipes.config.ts and your deployment (a dry-run plan: what exists, what would change).",{configPath:C.string().optional()},async({configPath:p})=>{let f=p??at("pipes");if(!f)return{...z({ok:!1,error:"no pipes.config.ts found"}),isError:!0};try{let g=await Te({config:f,check:!0,sink:s(()=>{},"sink")});return z(g.output)}catch(g){return Se(g)}});let t=s(async p=>{let{buildKernel:f}=await Promise.resolve().then(()=>(qe(),ba)),g=await f(),h=await $O(g,p);if(!h)throw new Error("could not resolve appId from token; pass appId (app_\u2026)");return{kernel:g,appId:h}},"kernelAndApp"),r=s(p=>{let f=p;return f?.gid??f?.workflowGid??f?.data?.gid},"wfId"),o=6e4,n=new Map,i=s(async(p,f)=>{let g=n.get(f);if(g&&Date.now()-g.at<o)return g;let h=await p.send($n("pipes.workflows.listConnectors")),y=h?.data??h??[],v={at:Date.now(),rows:y,index:EO(y)};return n.set(f,v),v},"fetchConnectorCatalog"),a=s((p,f)=>{try{let h=new LO.default({allErrors:!0,strict:!1}).compile(p);return h(f)?[]:(h.errors??[]).map(y=>`${y.instancePath||"(root)"} ${y.message??"invalid"}${y.params?` ${JSON.stringify(y.params)}`:""}`)}catch{return[]}},"ajvValidator"),c=s(async(p,f)=>{try{let{kernel:g,appId:h}=await t(f),{index:y}=await i(g,h);return{...LE(p,y,a),catalogReachable:!0}}catch(g){F(g);let h=LE(p,void 0);return{...h,warnings:[...h.warnings,"deployment unreachable \u2014 connector ids, actionIds, and params were NOT verified against the live catalog; pipes_create will verify them"],catalogReachable:!1}}},"validateAgainstLive");e.tool("pipes_catalog","Return the Pipes authoring guide + the LIVE connector catalog from your deployment: every connector, every action, and each action's FULL JSON-Schema (all params, types, enums, required) \u2014 plus the branch-handle map and the valid trigger types. Call FIRST so you author with the real, current params (no guessing).",{appId:C.string().optional().describe("app GID (app_\u2026); defaults to the token's app claim")},async({appId:p})=>{try{let{kernel:f,appId:g}=await t(p),{rows:h}=await i(f,g);return z({guidance:wO,definitionSchema:{id:lO,version:bc,resource:$E},triggerTypes:Ec,triggers:wc,branchHandles:Lr,builtinNodeTypes:Object.entries(Gr).map(([y,v])=>({nodeType:y,backendType:v,isBrancher:y===Dr||y in Lr})),connectors:h.map(y=>({connectorId:y.id??y.connectorId??y._id,category:y.category,description:y.description,tier:y.tier,needsCredential:y.auth?.type&&y.auth.type!=="none",branchHandles:Lr[y.id??y.connectorId]??((y.id??y.connectorId)===Dr?["<case name>",as]:void 0),actions:(y.actions??[]).map(v=>({actionId:v.id,name:v.name,description:v.description,inputSchema:v.inputSchema,outputSchema:v.outputSchema}))}))})}catch(f){return Se(f)}});let l=wc.map(p=>p.type).join("|"),d=[...Object.entries(Lr).map(([p,f])=>`${p} ${f.join("/")}`),`${Dr} <case>/${as}`].join(", "),u=C.object({id:C.string().describe("unique node id"),nodeType:C.string().describe(`the type the engine runs (data.nodeType): a trigger (${l}), a built-in (${Object.keys(Gr).filter(p=>Gr[p]!=="trigger").join("|")}), or "${On}" for a catalogue connector (then set connectorId from pipes_catalog; it is checked against the live catalogue). Built-ins: ${gO}`),connectorId:C.string().optional().describe(`REQUIRED when nodeType is "${On}": the connector id from pipes_catalog`),config:C.record(C.string(),C.unknown()).optional().describe(`data.config. A trigger: its trigger config keys (${wc.map(p=>`${p.type}: ${p.summary}`).join(" ")}). A built-in: its settings, flat. A connector step: ${zp} \u2014 the action id from pipes_catalog and its params, typed by that action's inputSchema, under params (data.config.params, the only place the engine reads them).`),credentials:C.record(C.string(),C.string()).optional().describe("a connector step's credentials: { <connectorId>: <credential gid> } (data.credentials)"),label:C.string().optional()}),m=C.object({from:C.string(),to:C.string(),branch:C.string().optional().describe(`the branch a brancher is left by (${d}); omit for a step without branches`)});return e.tool("pipes_build","Compile a HIGH-LEVEL pipe spec into a CORRECT workflow definition (connector-schema nodes + explicit edge handles + branch resolution + auto-layout) AND validate it against the LIVE deployment catalog: every connectorId must exist, every actionId must be one of that connector's actions, and connector params are checked against the action's real inputSchema \u2014 so a guessed name fails HERE with a did-you-mean, not at run time. NEVER hand-write node/edge JSON \u2014 use this. Returns { definition, warnings }.",{nodes:C.array(u).describe("the steps"),edges:C.array(m).optional().describe("how steps connect"),appId:C.string().optional().describe("app GID (app_\u2026); defaults to the token's app claim \u2014 used to fetch the live connector catalog for validation")},async({appId:p,...f})=>{try{let g=CE(f),h=await c(f,p);if(!h.ok)return{...z({ok:!1,stage:"catalog-validation",issues:h.issues,warnings:h.warnings}),isError:!0};let y=NE(f);return z({ok:!0,definition:g,triggerConfig:y,...h.warnings.length?{warnings:h.warnings}:{}})}catch(g){return Se(g)}}),e.tool("pipes_create",`Create a pipe in your deployment from a high-level spec (the same spec as pipes_build) and optionally activate it. Mutating; confirm first. Include exactly ONE trigger node (nodeType ${l}) as the ENTRY node (no incoming edge) wired to the first step; the trigger config is derived from it (or omit the trigger node and pass triggerType + triggerConfig). The door validates the whole definition before it writes anything; a refusal returns PIPE_DEFINITION_INVALID with every reason (path, expected, got) and retry: true.`,{name:C.string(),description:C.string().optional(),nodes:C.array(u),edges:C.array(m).optional(),triggerType:C.enum(Ec).optional().describe("the single workflow trigger (default manual)"),triggerConfig:C.record(C.string(),C.unknown()).optional().describe(`the trigger's config when the spec has no trigger node (${wc.map(p=>`${p.type}: ${p.summary}`).join(" ")})`),activate:C.boolean().optional(),appId:C.string().optional()},async p=>{try{let f;try{f=CE({nodes:p.nodes,edges:p.edges})}catch(k){return Se(k,{stage:"build"})}let g=await c({nodes:p.nodes,edges:p.edges},p.appId);if(!g.catalogReachable)return{...z({ok:!1,stage:"catalog-validation",error:"could not fetch the connector catalog from your deployment \u2014 pipes_create refuses to create unverified workflows",warnings:g.warnings}),isError:!0};if(!g.ok)return{...z({ok:!1,stage:"catalog-validation",issues:g.issues,warnings:g.warnings}),isError:!0};let h=NE({nodes:p.nodes,edges:p.edges},{type:p.triggerType,config:p.triggerConfig}),{kernel:y}=await t(p.appId),v;try{v=await y.send({...$n("pipes.workflows.createWorkflow"),body:{name:p.name,description:p.description??"",definition:f,triggerConfig:h}})}catch(k){let R=CO(k);if(R)return{...z({...R,stage:"door"}),isError:!0};throw k}let S=r(v);return p.activate&&S&&await y.send({...$n("pipes.workflows.activateWorkflow"),pathParams:{workflowId:S},body:{}}),z({ok:!0,workflowId:S,activated:!!(p.activate&&S),nodes:f.nodes.length,edges:f.edges.length,...g.warnings.length?{warnings:g.warnings}:{}})}catch(f){return Se(f)}}),e.tool("pipes_validate_definition","Validate a pipe definition and trigger config against your deployment WITHOUT saving anything: the door applies every check it applies on create (the one pipe definition schema, your live connector catalogue, params against each action's inputSchema, credentials, branches, one reachable trigger). Pass the { definition, triggerConfig } pipes_build returned. Answers { valid: true } or PIPE_DEFINITION_INVALID with every reason (path, expected, got, didYouMean) and retry: true.",{definition:C.record(C.string(),C.unknown()).describe("the pipe definition { nodes, edges } (pipes_build's definition)"),triggerConfig:C.record(C.string(),C.unknown()).optional().describe("the trigger config { type, config } (pipes_build's triggerConfig)"),appId:C.string().optional()},async({definition:p,triggerConfig:f,appId:g})=>{try{let{kernel:h}=await t(g),y;try{y=await h.send({...$n("pipes.workflows.validateWorkflowDefinition"),body:{definition:p,...f?{triggerConfig:f}:{}}})}catch(S){let k=CO(S);if(k)return{...z({...k,stage:"door",valid:!1}),isError:!0};throw S}let v=y?.data??y;return z({ok:!0,valid:v?.valid??!0,errors:v?.errors??[],schemaVersion:bc})}catch(h){return Se(h)}}),e.resource("pipes-authoring-flow",yO,{description:"How to author a pipe, step by step: discover the connectors, read their input schemas, draft, validate, create, run, inspect, iterate.",mimeType:"text/plain"},async p=>({contents:[{uri:p.href,mimeType:"text/plain",text:kc}]})),e.resource("pipes-definition-schema",$E,{description:`The pipe definition JSON Schema ${bc} every pipes tool is generated from and the door validates against.`,mimeType:"application/schema+json"},async p=>({contents:[{uri:p.href,mimeType:"application/schema+json",text:JSON.stringify(bO,null,2)}]})),e.prompt(vO,"Author an npayload pipe with the pipes tools, following the pipe-authoring flow.",{goal:C.string().optional().describe("what the pipe should do, in your words")},({goal:p})=>({messages:[{role:"user",content:{type:"text",text:`${p?`Build an npayload pipe that does this: ${p}
|
|
669
|
+
|
|
670
|
+
`:""}${kc}`}}]})),e.tool("pipes_list","List the workflows in your deployment (gid, name, status).",{appId:C.string().optional()},async({appId:p})=>{try{let{kernel:f}=await t(p),g=await f.send($n("pipes.workflows.listWorkflows")),h=g?.data??g??[];return z(h.map(y=>({workflowId:y.gid??y.workflowGid??y._id,name:y.name,status:y.status})))}catch(f){return Se(f)}}),e.tool("pipes_get","Get one workflow incl. its full definition (nodes + edges) \u2014 useful to inspect or modify an existing pipe.",{workflowId:C.string(),appId:C.string().optional()},async({workflowId:p,appId:f})=>{try{let{kernel:g}=await t(f),h=await g.send({...$n("pipes.workflows.getWorkflow"),pathParams:{workflowId:p}});return z(h)}catch(g){return Se(g)}}),e.tool("pipes_run","Trigger one execution of a workflow (must be active). Returns the execution id + status; poll pipes_get_execution.",{workflowId:C.string(),triggerData:C.record(C.string(),C.unknown()).optional(),appId:C.string().optional()},async({workflowId:p,triggerData:f,appId:g})=>{try{let{kernel:h}=await t(g),y=await h.send({...$n("pipes.executions.triggerExecution"),pathParams:{workflowId:p},body:{triggerData:f??{}}});return z({executionId:y?.gid??y?.executionGid??y?.executionId,status:y?.status})}catch(h){return Se(h)}}),e.tool("pipes_get_execution","Get one execution's live state: overall status (running|completed|failed|cancelled) plus per-node runs with each node's status, output and error. Poll this after pipes_run until the status is terminal. The definition was already checked at create (PIPE_DEFINITION_INVALID); what fails here is the run itself (a remote call, a resolved template, a credential).",{executionId:C.string().describe("the execution id returned by pipes_run"),appId:C.string().optional()},async({executionId:p,appId:f})=>{try{let{kernel:g}=await t(f),h=await g.send({...$n("pipes.executions.getExecution"),pathParams:{executionId:p}});return z(h?.data??h)}catch(g){return Se(g)}}),e.tool("pipes_delete","Delete a workflow (works from ANY state \u2014 draft, paused, archived, active). Mutating \u2014 confirm first.",{workflowId:C.string(),appId:C.string().optional()},async({workflowId:p,appId:f})=>{try{let{kernel:g}=await t(f);return await g.send({...$n("pipes.workflows.deleteWorkflow"),pathParams:{workflowId:p}}),z({ok:!0,deleted:p})}catch(g){return Se(g)}}),e.tool("primus_contract","Return the npayload Primus (AI agents) config schema (JSON Schema) + the capability catalog + decision guide + guidance. Call this BEFORE writing or editing primus.config.ts \u2014 the schema returned here is the only valid source of config fields. Naming rule: skill/tool names are lowercase + underscores (hyphens are rejected).",async()=>z({version:Q_,guidance:sO,capabilities:aO,schema:Wn})),e.tool("primus_validate","Validate a Primus config against the contract PLUS the platform preflight the schema can't express: skill/tool naming rule (lowercase + underscores, NO hyphens \u2014 the platform hard-rejects them) and trigger\u2192agent parent references. Pass the config object, OR omit it to validate the project's primus.config.ts on disk. Returns { ok, issues }.",{config:C.union([C.record(C.string(),C.unknown()),C.string()]).optional().describe("the PrimusConfig object (or a JSON string) to validate; omit to validate primus.config.ts on disk"),configPath:C.string().optional().describe("path to primus.config.ts (used when `config` is omitted)")},async({config:p,configPath:f})=>{let g=p;if(typeof g=="string")try{g=JSON.parse(g)}catch{}if(g==null){let y=f??at("primus");if(!y)return{...z({ok:!1,error:"no primus.config.ts found \u2014 write npayload/primus.config.ts first (see primus_contract)"}),isError:!0};g=await pe(y)}let h=La(g,{allowInternalUrls:Ur()});return{...z(h),isError:!h.ok}}),e.tool("primus_deploy","Reconcile the project's primus.config.ts (agents / skills / tools / triggers) to your AI deployment \u2014 idempotent, keyed by name; triggers attach to their agent by NAME (resolved at deploy). Validates first; pass check:true for a dry-run plan. Mutating: confirm before applying.",{check:C.boolean().optional().describe("dry run: print the plan, apply nothing"),configPath:C.string().optional().describe("path to primus.config.ts (default: ./npayload/primus.config.ts)")},async({check:p,configPath:f})=>{let g=f??at("primus");if(!g)return{...z({ok:!1,error:"no primus.config.ts found \u2014 write npayload/primus.config.ts first (see primus_contract)"}),isError:!0};let h=await pe(g),y=La(h,{allowInternalUrls:Ur()});if(!y.ok)return{...z({error:"config invalid \u2014 fix before deploy",issues:y.issues}),isError:!0};try{let v=await Te({config:g,check:p??!1,sink:s(()=>{},"sink")});return z(v.output)}catch(v){return Se(v)}}),e.tool("primus_status","Show the current sync state between primus.config.ts and your AI deployment (a dry-run plan: what exists, what would change).",{configPath:C.string().optional()},async({configPath:p})=>{let f=p??at("primus");if(!f)return{...z({ok:!1,error:"no primus.config.ts found"}),isError:!0};try{let g=await Te({config:f,check:!0,sink:s(()=>{},"sink")});return z(g.output)}catch(g){return Se(g)}}),e.tool("npayload_status","Diagnose the npayload environment: API + auth endpoint reachability, which credential source is available, and whether this project's pinned contract and generated permissions are in sync \u2014 each failure with a one-line remediation. Call this FIRST whenever another tool returns a connection or authorization error.",async()=>{try{let{buildReport:p}=await Promise.resolve().then(()=>(ME(),OO)),f=await p(),g={code:"TRANSPORT_UNAVAILABLE",type:"TransportUnavailableError"};return z({ok:f.authReady&&f.stack.apiReachable,endpoints:{api:{url:f.stack.apiUrl,reachable:f.stack.apiReachable,probe:f.stack.apiProbe,...f.stack.apiProbe==="refused"?g:{}},auth:f.stack.authUrl?{url:f.stack.authUrl,reachable:f.stack.authReachable,probe:f.stack.authProbe,...f.stack.authProbe==="refused"?g:{}}:void 0},credentials:f.credentials,project:{contractPin:f.stack.contractLock,generatedPermissions:f.stack.permissions},remediation:f.remediation})}catch(p){return Se(p)}}),e.tool("npayload_catalog",`Discover the FULL npayload op surface across ALL products (events, pipes, connect, feed, primus, account, \u2026). Returns every op grouped by product, each with { key, method, path, summary, isQuery, idempotent, scopes, pathParams, args }. The "key" is what you pass to npayload_invoke. Call this FIRST to learn what you can do, then npayload_invoke to do it. Pass a "product" to filter (products: ${Vp().join(", ")}).`,{product:C.string().optional().describe(`filter to one product, e.g. ${Vp().slice(0,4).join(", ")}; omit for the full catalog`)},async({product:p})=>{try{let f=PO(p);return p&&f.products.length===0?{...z({ok:!1,error:`no product "${p}"`,products:Vp()}),isError:!0}:z(f)}catch(f){return Se(f)}}),e.tool("connect_deploy","Reconcile the project's connect.config.ts to the ADMIN control plane (idempotent; admin is the source of truth and syncs to cells). Validates first; pass check:true for a dry-run plan. Mutating: confirm before applying. Declaring a bridge/grant is an OFFER (pending) \u2014 the other org confirms in its own config.",{check:C.boolean().optional().describe("dry run: print the plan, apply nothing"),configPath:C.string().optional().describe("path to connect.config.ts (default: ./connect.config.ts or ./npayload/connect.config.ts)")},async({check:p,configPath:f})=>{let g=f??qE(),h=await pe(g),y=Gh(h,{allowInternalUrls:Ur()});if(!y.ok)return{...z({error:"config invalid \u2014 fix before deploy",issues:y.issues}),isError:!0};try{let v=await Te({config:g,check:p??!1,sink:s(()=>{},"sink")});return z(v.output)}catch(v){return Se(v)}}),e.tool("connect_status","Show the current sync state between connect.config.ts and the admin control plane (a dry-run plan: what exists, what would change).",{configPath:C.string().optional()},async({configPath:p})=>{let f=p??qE();try{let g=await Te({config:f,check:!0,sink:s(()=>{},"sink")});return z(g.output)}catch(g){return Se(g)}}),e.tool("npayload_invoke",`Invoke ANY npayload op by its catalog "key" (from npayload_catalog), e.g. "events.channels.list", "connect.connectAccess.listMyGrants", "feed.listings.create", "primus.agents.create", "account.environments.create". Pass "args" keyed by the op's arg names \u2014 path params and body/query fields together; this tool splits them per the op's contract. Path params named "appId" are auto-resolved from your token when omitted. Dispatches as your authenticated client (bounded by your own token scopes \u2014 no escalation). WARNING: ops where isQuery is false MUTATE state; ALWAYS confirm with the user before invoking a mutating op (create/update/delete/publish/trigger/\u2026).`,{key:C.string().describe('the op key from npayload_catalog, e.g. "events.channels.create"'),args:C.record(C.string(),C.unknown()).optional().describe("op args keyed by arg name (path params + body/query); see the op's pathParams/args in npayload_catalog")},async({key:p,args:f})=>{try{let{buildKernel:g}=await Promise.resolve().then(()=>(qe(),ba)),h=Kp({key:p})==="primus"?te(process.env.NPAYLOAD_PRIMUS_API_URL,"primusApiUrl"):void 0,y=await g(h||void 0),{row:v,request:S}=await xO(p,f,{resolveAppId:s(()=>$O(y),"resolveAppId"),newIdempotencyKey:s(()=>globalThis.crypto.randomUUID(),"newIdempotencyKey")}),k=await y.send(S);return z({ok:!0,key:p,method:v.method,path:S.path,mutating:!v.isQuery,result:k})}catch(g){return g instanceof Oo?Se(g,{suggestions:g.suggestions}):Se(g)}}),e}s(OM,"buildServer");function UO(e){e.command("mcp").description("npayload MCP server for your coding agent (local stdio)").command("serve",{isDefault:!0}).description("Run the MCP server on stdio (Claude / Cursor / Codex connect to this)").action(async()=>{SO(await Pg());let r=OM(),o=new GO.StdioServerTransport;await r.connect(o)})}s(UO,"registerMcp");var Mr=require("fs"),$o=require("path"),nr=K(require("chalk"));qe();var Pe=K(require("chalk")),YO=require("crypto"),XO=require("fs");qe();var je=require("fs"),He=require("path"),Ue=K(require("chalk"));qe();da();gt();Ks();Vr();Ai();ld();function Hp(e,t){return Wp(e)===Wp(t)}s(Hp,"deepEqual");function Wp(e){if(e===null||typeof e!="object")return JSON.stringify(e)??"null";if(Array.isArray(e))return`[${e.map(Wp).join(",")}]`;let t=e;return`{${Object.keys(t).sort().map(o=>`${JSON.stringify(o)}:${Wp(t[o])}`).join(",")}}`}s(Wp,"stableStringify");var $M=s(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isObj");function MO(e,t,r){let o={},n=[],i=[],a=[],c=jO(t,r);for(let l of c){let d=t[l]??{},u=r[l]??{},m=e[l]??{},p={};for(let f of jO(d,u)){let g=d[f],h=u[f],y=m[f];if(g&&!h){p[f]=rn(g),a.push({resource:l,key:f});continue}if(!g&&h){p[f]=rn(h),n.push({resource:l,key:f,kind:"add-entry",value:rn(h)});continue}if(!g||!h)continue;let v={};for(let S of CM(y,g,h)){let k=y?S in y:!1,R=S in g,I=S in h,x=y?.[S],_=g[S],U=h[S];if(R&&I)Hp(_,U)?v[S]=rn(_):k&&Hp(_,x)?(v[S]=rn(U),n.push({resource:l,key:f,field:S,kind:"update-field",value:rn(U)})):k&&Hp(U,x)?v[S]=rn(_):(v[S]=rn(_),i.push({resource:l,key:f,field:S,base:x,local:_,remote:U}));else if(R&&!I)v[S]=rn(_);else if(!R&&I){if(k&&Hp(U,x))continue;v[S]=rn(U),n.push({resource:l,key:f,field:S,kind:"add-field",value:rn(U)})}}p[f]=v}Object.keys(p).length&&(o[l]=p)}return{merged:o,changes:n,conflicts:i,localOnly:a}}s(MO,"threeWayMergeConfig");function jO(e,t){return Array.from(new Set([...Object.keys(e),...Object.keys(t)]))}s(jO,"unionKeys");function CM(...e){let t=new Set;for(let r of e)if($M(r))for(let o of Object.keys(r))t.add(o);return Array.from(t)}s(CM,"unionFieldKeys");function rn(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}s(rn,"clone");var Pc;async function NM(){if(Pc!==void 0)return Pc;try{Pc=(await import("typescript")).default??await import("typescript")}catch{Pc=null}return Pc}s(NM,"loadTs");function cs(e,t=0){let r=" ".repeat(t),o=" ".repeat(t+1);if(e===null)return"null";if(e===void 0)return"undefined";if(typeof e=="string")return JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.length===0?"[]":`[
|
|
671
|
+
${e.map(i=>`${o}${cs(i,t+1)}`).join(`,
|
|
672
|
+
`)},
|
|
673
|
+
${r}]`;if(typeof e=="object"){let n=e,i=Object.keys(n);return i.length===0?"{}":`{
|
|
674
|
+
${i.map(c=>`${o}${Zp(c)}: ${cs(n[c],t+1)}`).join(`,
|
|
675
|
+
`)},
|
|
676
|
+
${r}}`}return JSON.stringify(e)??"null"}s(cs,"toTsLiteral");function Zp(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?e:JSON.stringify(e)}s(Zp,"tsKey");async function Yp(e,t){if(t.changes.length+t.conflicts.length===0)return{ok:!0,text:e,applied:0};let o=await NM();if(!o)return{ok:!1,applied:0,reason:"typescript not available"};let n=o.createSourceFile("config.ts",e,o.ScriptTarget.Latest,!0),i,a=s(y=>{if(!i){if(o.isCallExpression(y)){let v=y.expression.getText(n);if(/define\w*Config$/.test(v)&&y.arguments.length>=1){let S=y.arguments[0];o.isObjectLiteralExpression(S)&&(i=S)}}o.forEachChild(y,a)}},"visit");if(a(n),!i)return{ok:!1,applied:0,reason:"define*Config({...}) object not found"};let c=[],l=s((y,v)=>y.properties.find(S=>o.isPropertyAssignment(S)&&LM(o,n,S)===v),"propByName"),d=s(y=>{let v=e.lastIndexOf(`
|
|
677
|
+
`,y-1)+1,S=/^[ \t]*/.exec(e.slice(v,y));return S?S[0]:""},"indentOf"),u=0,m=s(y=>({ok:!1,applied:0,reason:y}),"fail"),p=new Map;for(let y of t.changes){if(y.kind!=="add-entry"||l(i,y.resource))continue;let v=p.get(y.resource)??{};v[y.key]=y.value,p.set(y.resource,v)}for(let y of t.changes){let v=l(i,y.resource)?.initializer;if(y.kind==="add-entry"){if(!v){if(p.has(y.resource)){u++;continue}return m(`resource "${y.resource}" not found for add-entry`)}if(!o.isObjectLiteralExpression(v))return m(`resource "${y.resource}" is not an object literal (add-entry)`);let A=d(v.getStart(n))+" ",D=`${Zp(y.key)}: ${cs(y.value,Jp(A))}`;c.push(BE(o,n,v,D,A)),u++;continue}if(!v||!o.isObjectLiteralExpression(v))return m(`resource "${y.resource}" not found`);let S=l(v,y.key)?.initializer;if(!S||!o.isObjectLiteralExpression(S))return m(`entry "${y.resource}.${y.key}" not found`);let k=(y.field??"").split("."),R=S,I=!0;for(let A=0;A<k.length-1;A++){let D=l(R,k[A])?.initializer;if(!D||!o.isObjectLiteralExpression(D)){I=!1;break}R=D}if(!I)return m(`nested path "${y.resource}.${y.key}.${y.field}" not found`);let x=k[k.length-1],_=y.trailingComment?` ${y.trailingComment}`:"",U=l(R,x);if(y.kind==="add-field"||!U){let A=d(R.getStart(n))+" ",D=`${Zp(x)}: ${cs(y.value,Jp(A))}${_}`;c.push(BE(o,n,R,D,A)),u++}else if(y.kind==="update-field"){let A=U.initializer,D=cs(y.value,Jp(d(U.getStart(n))));if(_){let M=e.indexOf(`
|
|
678
|
+
`,A.getEnd());c.push({start:A.getStart(n),end:M===-1?A.getEnd():M,text:`${D},${_}`})}else c.push({start:A.getStart(n),end:A.getEnd(),text:D});u++}}if(p.size>0){let y=d(i.getStart(n))+" ",v=Array.from(p,([S,k])=>`${Zp(S)}: ${cs(k,Jp(y))}`).join(`,
|
|
679
|
+
${y}`);c.push(BE(o,n,i,v,y))}for(let y of t.conflicts){let v=l(i,y.resource)?.initializer;if(!v||!o.isObjectLiteralExpression(v))continue;let S=l(v,y.key)?.initializer;if(!S||!o.isObjectLiteralExpression(S))continue;let k=l(S,y.field);if(!k)continue;let R=d(k.getStart(n)),I=`/* CONFLICT (np pull): live=${KE(y.remote)} ; keeping local ${KE(y.local)} (was ${KE(y.base)}). Resolve, then re-pull. */
|
|
680
|
+
${R}`;c.push({start:k.getStart(n),end:k.getStart(n),text:I}),u++}c.sort((y,v)=>v.start-y.start);let f=e;for(let y of c)f=f.slice(0,y.start)+y.text+f.slice(y.end);return(o.createSourceFile("check.ts",f,o.ScriptTarget.Latest,!0).parseDiagnostics??[]).length>0?m("merged output failed re-parse (kept original)"):{ok:!0,text:f,applied:u}}s(Yp,"applyThreeWayMerge");function LM(e,t,r){let o=r.name;return e.isIdentifier(o)||e.isStringLiteral(o)?o.text:o.getText(t)}s(LM,"propName");function BE(e,t,r,o,n){let i=r.getEnd()-1,a=r.properties.length>0,c="";if(a){let d=r.properties[r.properties.length-1],u=t.text.slice(d.getEnd(),i);!/,\s*$/.test(t.text.slice(d.getEnd()-1,d.getEnd()))&&!u.includes(",")&&(c=",")}let l=n.slice(2);return{start:i,end:i,text:`${c}
|
|
681
|
+
${n}${o},
|
|
682
|
+
${l}`}}s(BE,"insertIntoObject");function Jp(e){return Math.floor(e.replace(/\t/g," ").length/2)}s(Jp,"indentLevel");function KE(e){let t=JSON.stringify(e);return t&&t.length>80?t.slice(0,77)+"...":t??"undefined"}s(KE,"jsonInline");aa();Un();se();re();var jM=[{name:"events",define:"defineEventsConfig",resources:ai,files:["npayload/events.config.ts","npayload/events.config.mjs","npayload/events.config.js","events.config.ts","events.config.mjs","events.config.js"],plane:"cell",schema:Ri},{name:"primus",define:"definePrimusConfig",resources:yi,files:["npayload/primus.config.ts","npayload/primus.config.mjs","npayload/primus.config.js","primus.config.ts","primus.config.mjs","primus.config.js"],plane:"primus",schema:Wn}],MM=new Set(["gid","_id","_creationTime","id","createdAt","updatedAt","ownerId","ownerType","orgId","appId","status","subscriptionGid","exchangeGid","consumerGroupGid","messageCount","lastMessageAt","createdBy","version","brainAgentId","environmentId","tenantId"]),qM=new Set(["connect_receiving","feed_receiving"]);function Xp(e){return typeof e=="string"?e.length>0:e!=null&&e!==!1}s(Xp,"present");function FM(e){if(e.isSystemChannel===!0)return!0;let t=typeof e.slug=="string"?e.slug:"";return t.startsWith("_system.")||t==="_system"?!0:(t.split(".")[0]??"").toLowerCase()==="system"}s(FM,"isAutoCreatedSystemRow");function zM(e){let t=e.metadata,r=t!==null&&typeof t=="object"?t:void 0;return Xp(r?.connectGrantGid)||Xp(r?.feedBindingGid)||Xp(e.connectGrantGid)||Xp(e.feedBindingGid)||typeof e.origin=="string"&&qM.has(e.origin)}s(zM,"isSystemManagedRow");function BM(e,t){if((0,je.existsSync)(e))try{for(let r of(0,je.readFileSync)(e,"utf8").split(`
|
|
683
|
+
`)){let o=r.trim();if(!o||o.startsWith("#"))continue;let n=o.indexOf("=");if(!(n===-1||o.slice(0,n).trim()!==t))return o.slice(n+1).trim().replace(/^["']|["']$/g,"")}}catch{}}s(BM,"readEnvVar");function KM(e){if(e)return e;let t=process.env.NPAYLOAD_APP_ID?.trim();if(t)return t;for(let r of[(0,He.join)(process.cwd(),".env"),(0,He.join)(process.cwd(),"npayload",".env")]){let o=BM(r,"NPAYLOAD_APP_ID");if(o)return o}}s(KM,"resolveAppGid");function QO(e){return/^[a-z]{2,6}_[A-Za-z0-9]{4,}$/.test(e)}s(QO,"looksLikeGid");function ZE(e){if(Array.isArray(e))return e;if(e&&typeof e=="object")for(let t of["data","items","channels","subscriptions","agents","skills","tools","results"]){let r=e[t];if(Array.isArray(r))return r}return[]}s(ZE,"asRows");function QM(e){return(e.match(/:([A-Za-z0-9_]+)/g)??[]).map(t=>t.slice(1))}s(QM,"paramsOf");function VM(e){return e.replace(/:([A-Za-z0-9_]+)/g,"{$1}")}s(VM,"toTemplate");function VO(e,t){let n=e.properties?.[t]?.additionalProperties;return n&&typeof n=="object"?n:null}s(VO,"entrySchemaOf");function HM(e,t){for(let[r,o]of Object.entries(t?.properties??{})){let n=o.enum,i=e[r];if(Array.isArray(n)&&typeof i=="string"&&!n.includes(i))return r}}s(HM,"undeclarableField");function YE(e,t,r={}){if(!e||t===null||t===void 0)return e?t??void 0:void 0;if(e.properties&&typeof t=="object"&&!Array.isArray(t)){let o={};for(let[n,i]of Object.entries(e.properties)){let a=YE(i,t[n],{fieldName:n,secret:r.secret});a!==void 0&&(o[n]=a)}return Object.keys(o).length?o:void 0}return e.additionalProperties&&typeof t=="object"&&!Array.isArray(t)?r.fieldName==="headers"&&r.secret?hf(t,r.secret):t:e.items&&Array.isArray(t)?t.map(o=>YE(e.items,o,r)).filter(o=>o!==void 0):typeof t=="object"&&!Array.isArray(t)?void 0:t}s(YE,"projectToSchema");function WM(e,t,r,o){let n={},i=typeof e[t]=="string"?{...o?{app:o}:{},channel:String(e[t])}:void 0;for(let[a,c]of Object.entries(e))if(!(a===t||MM.has(a))&&c!=null)if(r){let l=r.properties?.[a];if(!l)continue;let d=YE(l,c,{fieldName:a,...i?{secret:i}:{}});d!==void 0&&(n[a]=d)}else n[a]=c;return n}s(WM,"projectRow");var JM=new Set(ye.commands.filter(e=>(e.flags??[]).some(t=>t.name==="appId")).map(e=>`${e.method} ${e.pattern}`));function ZM(e){let t=te(process.env.NPAYLOAD_PRIMUS_API_URL,"primusApiUrl"),r=eo(e);return t!==void 0&&r!==void 0&&t.replace(/\/+$/,"")===r.replace(/\/+$/,"")?"NPAYLOAD_PRIMUS_API_URL":"NPAYLOAD_API_URL"}s(ZM,"endpointVarOf");async function YM(e,t,r,o,n,i,a=JM){let c=s((g,h,y,v)=>e.send({method:g,path:VM(h),...Object.keys(y).length?{pathParams:y}:{},...v&&Object.keys(v).length?{query:v}:{}}),"send"),l={},d=new Map,u=new Map,m=["agentGid","channelGid","channels"],p={channels:0,tools:0,skills:1,agents:2,triggers:3},f=Object.keys(t).sort((g,h)=>(p[g]??99)-(p[h]??99));for(let g of f){let h=t[g],y=h.ops?.list;if(!y)continue;let v=QM(y.pattern),S=v.some(I=>I==="channelId"||I==="channelGid"),k=[];try{if(S)for(let[,I]of d){let x={...o?{appId:o}:{}};for(let _ of v)(_==="channelId"||_==="channelGid")&&(x[_]=I);k.push(...ZE(await c(y.method,y.pattern,x)))}else if(v.length===0){let I=o&&a.has(`${y.method} ${y.pattern}`);k.push(...ZE(await c(y.method,y.pattern,{},I?{appId:o}:void 0)))}else if(v.every(I=>I==="appId"))k.push(...ZE(await c(y.method,y.pattern,{appId:o})));else{n(` \u2022 skipped ${g} (list needs ${v.join(",")}, which pull does not support)`),i&&i.count++;continue}}catch(I){F(I),n(` \u2022 ${g}: list failed (${zf(I,eo(e),ZM(e))})`),i&&i.count++;continue}if(k.length===0)continue;let R={};for(let I of k){let x=I[h.identity];if(typeof x!="string"||zM(I)||FM(I))continue;if(HM(I,VO(r,g))!==void 0){n(` \u2022 skipped ${g}/${x}: npayload creates and manages it for you, so your config does not declare it`);continue}let _=I.gid??I.channelGid??I.id;g==="channels"&&_&&d.set(x,_),_&&u.set(_,x);let U=WM(I,h.identity,VO(r,g),o),A;for(let D of m){let M=U[D];if(typeof M=="string"){if(u.has(M))U[D]=u.get(M);else if(QO(M)){A=`${D} ${M}`;break}}if(Array.isArray(M)){let V=[];for(let J of M)typeof J=="string"&&u.has(J)?V.push(u.get(J)):typeof J=="string"&&QO(J)?n(` \u2022 ${g}/${x}: dropped ${D} entry ${J} \u2014 its parent is not exported (archived, system-managed or not listed); a pulled config must push back as no-ops`):V.push(J);U[D]=V}}if(A!==void 0){n(` \u2022 skipped ${g}/${x}: its ${A} is not exported (archived, system-managed or not listed) \u2014 a pulled config must push back as no-ops`);continue}for(let D of Kn(g)){if(D.wire==="name")continue;let M=Qn(I,D.publicField);if(D.array){if(!Array.isArray(M))continue;let V=M.map(J=>typeof J=="string"&&u.has(J)?u.get(J):J);Gg(U,D.path,V)}else typeof M=="string"&&Gg(U,D.path,u.get(M)??M)}R[x]=U}Object.keys(R).length&&(l[g]=R)}return l}s(YM,"fetchLive");function XM(e){for(let t of e){let r=(0,He.resolve)(process.cwd(),t);if((0,je.existsSync)(r))return r}return null}s(XM,"firstConfig");function Ic(e,t){let r=(0,je.existsSync)((0,He.join)(process.cwd(),"npayload"))?(0,He.join)(process.cwd(),"npayload",".npayload"):(0,He.join)(process.cwd(),".npayload");return(0,He.join)(r,`${e.name}.${t}.pull-base.json`)}s(Ic,"basePath");function e4(e){try{return(0,je.existsSync)(e)?JSON.parse((0,je.readFileSync)(e,"utf8")):{}}catch{return{}}}s(e4,"readBase");function em(e,t){try{(0,je.mkdirSync)((0,He.dirname)(e),{recursive:!0}),(0,je.writeFileSync)(e,JSON.stringify(t,null,2),"utf8")}catch{}}s(em,"saveBase");function HO(e,t,r,o){return`/**
|
|
684
|
+
* Pulled from the live ${t} topology by \`npayload pull\`.
|
|
685
|
+
`+(o?` *
|
|
686
|
+
${o}
|
|
687
|
+
`:"")+` * Review + merge into your config \u2014 do not blindly overwrite.
|
|
688
|
+
*/
|
|
689
|
+
import { ${e} } from "@npayload/sdk";
|
|
690
|
+
|
|
691
|
+
export default ${e}(${JSON.stringify(r,null,2)});
|
|
692
|
+
`}s(HO,"renderModule");async function XE(e,t=r=>process.stdout.write(r)){let r=e.env??"sandbox",o=e.check===!0,n=KM(e.app);if(!n)throw new Error("No app GID. Pass --app or set NPAYLOAD_APP_ID (or run from a project with .env).");let i=await vt(void 0,e.env,{readOnly:!0}),a=te(process.env.NPAYLOAD_PRIMUS_API_URL,"primusApiUrl"),c=a?await vt(a,e.env,{readOnly:!0}):null,l=s(m=>process.stderr.write(Ue.default.yellow(`${m}
|
|
693
|
+
`)),"warn"),d={count:0},u=0;for(let m of jM){let p=m.plane==="primus"?c:i;if(!p)continue;let f=XM(m.files),g;try{g=await YM(p,m.resources,m.schema,n,l,d)}catch(I){F(I),l(` \u2022 ${m.name}: ${I instanceof Error?I.message:String(I)}`);continue}let h=Object.values(g).reduce((I,x)=>I+Object.keys(x).length,0);if(!f||e.out||e.force){if(!f&&h===0)continue;let I;if(e.out?I=(0,He.resolve)(process.cwd(),e.out):e.force&&f?I=f:I=(0,je.existsSync)((0,He.join)(process.cwd(),"npayload"))?(0,He.join)(process.cwd(),"npayload",`${m.name}.config.ts`):(0,He.join)(process.cwd(),`${m.name}.config.ts`),o){t(Ue.default.cyan(`~ ${m.name}: would write ${h} resource(s) \u2192 ${I}
|
|
694
|
+
`)),u++;continue}try{(0,je.mkdirSync)((0,He.dirname)(I),{recursive:!0}),(0,je.writeFileSync)(I,HO(m.define,r,g),"utf8")}catch(x){l(` \u2022 ${m.name}: could not write ${I} (${x instanceof Error?x.message:String(x)})`);continue}em(Ic(m,r),g),t(Ue.default.green(`\u2713 ${m.name}: wrote ${h} resource(s) \u2192 ${I}
|
|
695
|
+
`)),u++;continue}let y,v;try{y=(0,je.readFileSync)(f,"utf8"),v=await pe(f)}catch(I){l(` \u2022 ${m.name}: could not read ${f} (${I instanceof Error?I.message:String(I)})`);continue}let S=e4(Ic(m,r)),k=MO(S,v,g);if(k.changes.length===0&&k.conflicts.length===0){o||em(Ic(m,r),g),t(Ue.default.dim(` \u2022 ${m.name}: up to date (${f})
|
|
696
|
+
`));continue}if(o){let I=k.changes.filter(_=>_.kind!=="update-field").length,x=k.changes.filter(_=>_.kind==="update-field").length;t(Ue.default.cyan(`~ ${m.name}: would merge into ${f} `)+Ue.default.dim(`(${x} updated, ${I} added`)+(k.conflicts.length?Ue.default.yellow(`, ${k.conflicts.length} CONFLICT`):"")+Ue.default.dim(`)
|
|
697
|
+
`));for(let _ of k.conflicts)t(Ue.default.yellow(` conflict: ${String(_.path??JSON.stringify(_))}
|
|
698
|
+
`));u++;continue}let R=await Yp(y,k);if(R.ok&&R.text!==void 0){(0,je.writeFileSync)(f,R.text,"utf8"),em(Ic(m,r),g);let I=k.changes.filter(_=>_.kind!=="update-field").length,x=k.changes.filter(_=>_.kind==="update-field").length;t(Ue.default.green(`\u2713 ${m.name}: merged into ${f} `)+Ue.default.dim(`(${x} updated, ${I} added`)+(k.conflicts.length?Ue.default.yellow(`, ${k.conflicts.length} CONFLICT \u2014 resolve inline`):"")+Ue.default.dim(`)
|
|
699
|
+
`)),u++}else{let I=f.replace(/\.config\.(ts|mjs|js)$/,".config.pulled.$1"),x=` * \u26A0 ${k.conflicts.length} conflict(s); in-place merge unavailable (${R.reason??"n/a"}).
|
|
700
|
+
* This is the MERGED result \u2014 diff it against ${f}, then keep.`;(0,je.writeFileSync)(I,HO(m.define,r,k.merged,x),"utf8"),em(Ic(m,r),g),t(Ue.default.yellow(`! ${m.name}: in-place merge unavailable (${R.reason??"n/a"}) \u2014 wrote sidecar ${I}
|
|
701
|
+
`)),u++}}return u===0&&d.count===0&&t(Ue.default.dim(`Nothing to pull.
|
|
702
|
+
`)),d.count>0&&process.stderr.write(Ue.default.yellow(`\u26A0 ${d.count} resource type(s) unreadable \u2014 this preview/sync is PARTIAL.
|
|
703
|
+
`)),{touched:u,listFailures:d.count}}s(XE,"runPullOnce");function WO(e){e.command("pull").description("Pull your live Events and Primus setup into *.config.ts (three-way backward sync)").option("--app <appGid>","app GID (default: NPAYLOAD_APP_ID or the project .env)").option("--out <path>","force-write the resolved config to this path (skips merge)").option("--force","overwrite the resolved config in place (skips merge)").option("--env <slug>","environment to pull from (default: the active environment, `np env use`)").option("--check","preview the merge (adopted fields, additions, conflicts) \u2014 write NOTHING").action(async(t,r)=>{try{let o=Lt(t,r),n=hr(o!==void 0?{explicitSlug:o}:{}),i=await XE({...t,env:n});try{let{pullScopesIntoManifest:a}=await Promise.resolve().then(()=>(JE(),KO));await a({...t.app?{appId:t.app}:{},readRemoteGrant:s(async c=>{let{restoreSession:l}=await Promise.resolve().then(()=>(_t(),di)),d=await l();return d?d.getOacGrant(c):null},"readRemoteGrant"),log:s(c=>process.stdout.write(c),"log")})}catch(a){F(a)}process.exit(i.listFailures>0?1:0)}catch(o){process.stderr.write(Ue.default.red(`${ie(o instanceof Error?o.message:String(o),o)}
|
|
704
|
+
`)),process.exit(1)}})}s(WO,"registerPull");ga();ua();HE();_t();mr();Ke();se();re();la();Zt();var om=class extends Error{static{s(this,"PushTargetsProductionError")}constructor(t,r="active"){super((r==="--env"?`Refusing: \`--env ${t}\` names the PRODUCTION environment. `:`Refusing: the active environment "${t}" is the PRODUCTION environment. `)+"`np push`/`diff`/`watch`/`sync` target development environments only \u2014 production changes ship through `np deploy`. "+(r==="--env"?"Pass a development environment's slug.":"Switch with `np env use <dev-slug>` first.")),this.name="PushTargetsProductionError"}};function ds(e,t){let r=t?.trim()?t.trim():void 0,o=r!==void 0?"--env":"active",n=r??ca(e)??"sandbox";if(n==="production"||n==="prod")throw new om(n,o);if(Ne(e)?.environments.find(c=>c.slug===n)?.kind==="production")throw new om(n,o);return n}s(ds,"resolveActivePushEnv");function tm(e,t){let r=jr(e.app);return{...e.config?{config:e.config}:{},...r?{app:r}:{},env:ds(void 0,e.env),check:t,...e.prune?{prune:!0}:{},...e.yes?{yes:!0}:{},...e.acceptRemote?{acceptRemote:!0}:{},...e.overwriteRemote?{overwriteRemote:!0}:{}}}s(tm,"sandboxOpts");function nm(e){return Lt({},e)}s(nm,"typedEnv");function rm(e){process.stderr.write(Pe.default.red(`${ie(`failed: ${e instanceof Error?e.message:String(e)}`,e)}
|
|
705
|
+
`)),process.exit(1)}s(rm,"fail");function JO(e){try{return(0,YO.createHash)("sha256").update((0,XO.readFileSync)(e)).digest("hex")}catch{return}}s(JO,"fileDigest");var im=class{static{s(this,"AdoptedWrites")}digests=new Map;record(t){for(let r of t){let o=JO(r);o!==void 0&&this.digests.set(r,o)}}isOnlyTheAdoption(t){return t.length===0||this.digests.size===0?!1:t.every(r=>this.digests.get(r)!==void 0&&this.digests.get(r)===JO(r))}clear(){this.digests.clear()}};function ZO(e,t,r,o){let n=Math.max(5,e.pollSeconds)*1e3,i=!1,a=s(async()=>{if(!(i||t.flag)){t.flag=!0;try{try{let m=await pe(lt()),p=Ei(Pi(m)),f=await vt(void 0,void 0,{readOnly:!0}),{token:g}=await f.auth.getAccessToken([]),y=(JSON.parse(Buffer.from(g.split(".")[1]??"","base64url").toString("utf8")).scope??"").split(" ").filter(Boolean).sort();y.length>0&&JSON.stringify(y)!==JSON.stringify(p)&&!i&&(process.stdout.write(Pe.default.cyan(`\u2193 scope drift: credential carries ${y.length} scope(s), config projects ${p.length} \u2014 resyncing to the config\u2026
|
|
706
|
+
`)),await Vg(Pi(m),jr(e.app),v=>process.stdout.write(v)))}catch(m){F(m)}if(i)return;let l=ds(void 0,e.env),u=(await Te({...e.config?{config:e.config}:{},...jr(e.app)?{app:jr(e.app)}:{},env:l,check:!0,sink:s(()=>{},"sink")})).plan.filter(m=>m.action!=="noop");u.length>0&&!i&&(process.stdout.write(Pe.default.cyan(`
|
|
707
|
+
\u2193 drift: ${u.length} live change(s) not in your config \u2014 adopting (pull merge)\u2026
|
|
708
|
+
`)),await XE({...e.app?{app:e.app}:{},env:l}),r.record(o))}catch(l){if(l instanceof Z){i=!0,clearInterval(c),process.stderr.write(Pe.default.red(`${ie(`drift poll stopped: ${l.message}`,l)}
|
|
709
|
+
`));return}process.stderr.write(Pe.default.yellow(`drift poll failed (${l instanceof Error?l.message:String(l)}) \u2014 still watching
|
|
710
|
+
`))}finally{t.flag=!1}}},"tick"),c=setInterval(()=>void a(),n);return()=>{i=!0,clearInterval(c)}}s(ZO,"startDriftLane");function e$(e){e.command("diff").alias("status").description("Show the plan (create / update / orphan / no-op) without applying \u2014 your code vs the sandbox. Exit 0 in sync, 2 with changes, 1 on error.").option("--config <path>","a single config file (default: every *.config.ts)").option("--app <appGid>","app GID (default: NPAYLOAD_APP_ID or the project .env)").option("--json","machine-readable plan on stdout (no ANSI)").action(async(t,r)=>{try{let o=await Te({...tm({...t,env:nm(r)},!0),...t.json?{json:!0}:{}});process.exit(Cd("diff",o.plan))}catch(o){rm(o)}}),e.command("push").description("Apply your config to the sandbox (create + update changed fields; --prune deletes undeclared resources after confirmation)").option("--config <path>","a single config file (default: every *.config.ts)").option("--app <appGid>","app GID (default: NPAYLOAD_APP_ID or the project .env)").option("--prune","delete live resources not declared in the config (confirmed; --yes for CI)").option("--yes","skip the prune confirmation (CI)").option("--accept-remote","on scope drift: pull the remote grant change into npayload.toml").option("--overwrite-remote","on scope drift: replace the remote grant with the manifest declaration").option("--json","machine-readable plan + apply results on stdout (no ANSI)").action(async(t,r)=>{try{let o=await Te({...tm({...t,yes:va(t,r),env:nm(r)},!1),...t.json?{json:!0}:{}});process.exit(Cd("push",o.plan))}catch(o){rm(o)}}),e.command("watch").description("Watch your configs and push to the sandbox on every change; poll for backend drift and adopt it into your files (Ctrl-C to stop)").option("--config <path>","a single config file (default: every *.config.ts)").option("--app <appGid>","app GID (default: NPAYLOAD_APP_ID or the project .env)").option("--poll <seconds>","backend drift poll interval","20").option("--no-poll","disable the poll for the server's drift (file-change pushes only)").action(async(t,r)=>{let o=nm(r);try{ds(void 0,o)}catch(d){rm(d);return}let n=QE(t.config);n.length===0&&(process.stderr.write(Pe.default.red("No product config found. Run `npayload init` first.\n")),process.exit(1));let i=t.poll!==!1;process.stdout.write(Pe.default.bold(`\u{1F440} watching ${n.length} config(s) \u2192 sandbox`)+Pe.default.dim(i?` \xB7 drift poll every ${t.poll}s`:" \xB7 drift poll off")+Pe.default.bold(` \xB7 Ctrl-C to stop
|
|
711
|
+
`));let a={flag:!1},c=new im,l=i?ZO({...t.config?{config:t.config}:{},...t.app?{app:t.app}:{},...o!==void 0?{env:o}:{},pollSeconds:Number(t.poll)||20},a,c,n):()=>{};await VE(n,async()=>{if(c.isOnlyTheAdoption(n)){process.stdout.write(Pe.default.dim(`\u2193 config updated by the drift poll \u2014 nothing pushed (the poll never pushes topology)
|
|
712
|
+
`));return}c.clear(),a.flag=!0;try{await Te(tm({...t,env:o},!1))}catch(d){process.stderr.write(Pe.default.red(`${ie(`reconcile failed: ${d instanceof Error?d.message:String(d)}`,d)}
|
|
713
|
+
`))}finally{a.flag=!1}}),l(),process.stdout.write(Pe.default.dim(`
|
|
714
|
+
stopped.
|
|
715
|
+
`)),process.exit(0)}),e.command("sync").description("Continuously sync your config to the sandbox: push now, then on every save; poll for backend drift and adopt it (= `np dev`)").option("--config <path>","a single config file (default: every *.config.ts)").option("--app <appGid>","app GID (default: NPAYLOAD_APP_ID or the project .env)").option("--prune","delete live resources not declared in the config (requires --yes in the loop)").option("--yes","skip the prune confirmation (CI / the sync loop)").option("--poll <seconds>","backend drift poll interval","20").option("--no-poll","disable the poll for the server's drift (file-change pushes only)").action(async(t,r)=>{let o=va(t,r),n=nm(r);try{ds(void 0,n)}catch(g){rm(g);return}let i=QE(t.config);i.length===0&&(process.stderr.write(Pe.default.red("No product config found. Run `npayload init` first.\n")),process.exit(1));let a={flag:!1},c=s(async g=>{a.flag=!0,process.stdout.write(Pe.default.dim(`
|
|
716
|
+
[${g}] syncing ${i.length} config(s) \u2192 sandbox\u2026
|
|
717
|
+
`));try{await Te(tm({...t,yes:o,env:n},!1))}catch(h){process.stderr.write(Pe.default.red(`${ie(`reconcile failed: ${h instanceof Error?h.message:String(h)}`,h)}
|
|
718
|
+
`))}finally{a.flag=!1}},"run");await c("start");let l=await ht().catch(()=>null),d=Sr(),u=Pr("sync",l,{onRevoked:s(()=>vn(),"onRevoked"),onRefused:d.onRefused}),m=t.poll!==!1;process.stdout.write(Pe.default.bold(`
|
|
719
|
+
\u{1F440} watching ${i.map(g=>g.replace(process.cwd()+"/","")).join(", ")}`)+Pe.default.dim(m?` \xB7 drift poll every ${t.poll}s`:" \xB7 drift poll off")+Pe.default.bold(` \xB7 Ctrl-C to stop
|
|
720
|
+
`));let p=new im,f=m?ZO({...t.config?{config:t.config}:{},...t.app?{app:t.app}:{},...n!==void 0?{env:n}:{},pollSeconds:Number(t.poll)||20},a,p,i):()=>{};try{await VE(i,async g=>{if(p.isOnlyTheAdoption(i)){process.stdout.write(Pe.default.dim(`\u2193 config updated by the drift poll \u2014 nothing pushed (the poll never pushes topology)
|
|
721
|
+
`));return}p.clear(),await c(g)},300,d)}catch(g){u(),f(),process.stderr.write(Pe.default.red(`${ie(`sync stopped: ${g instanceof Error?g.message:String(g)}`,g)}
|
|
722
|
+
`)),process.exit(1);return}u(),f(),process.stdout.write(Pe.default.dim(`
|
|
723
|
+
stopped.
|
|
724
|
+
`)),process.exit(0)})}s(e$,"registerSyncCommands");_t();mr();re();function t4(e){if(e){let r=(0,$o.resolve)(process.cwd(),e);return(0,Mr.existsSync)(r)?[r]:[]}let t=[];for(let r of["events","primus","pipes"])for(let o of[`${r}.config.ts`,(0,$o.join)("npayload",`${r}.config.ts`)]){let n=(0,$o.join)(process.cwd(),o);(0,Mr.existsSync)(n)&&t.push(n)}return t}s(t4,"findAllConfigs");function n4(e,t){if((0,Mr.existsSync)(e))try{for(let r of(0,Mr.readFileSync)(e,"utf8").split(`
|
|
725
|
+
`)){let o=r.trim();if(!o||o.startsWith("#"))continue;let n=o.indexOf("=");if(!(n===-1||o.slice(0,n).trim()!==t))return o.slice(n+1).trim().replace(/^["']|["']$/g,"")}}catch{}}s(n4,"readEnvVar");function r4(e){if(e)return e;let t=process.env.NPAYLOAD_APP_ID?.trim();if(t)return t;for(let r of[(0,$o.join)(process.cwd(),".env"),(0,$o.join)(process.cwd(),"npayload",".env")]){let o=n4(r,"NPAYLOAD_APP_ID");if(o)return o}}s(r4,"resolveAppGid");function t$(e){e.command("dev").description("Watch your product configs and reconcile ALL of them to npayload on every change").option("--config <path>","watch/sync a single config file (default: every *.config.ts)").option("--app <appGid>","app GID (default: NPAYLOAD_APP_ID or the project .env)").option("--env <slug>","target development environment (default: the active environment, `np env use`; else sandbox)").action(async(t,r)=>{let o;try{o=ds(void 0,Lt(t,r))}catch(g){process.stderr.write(nr.default.red(`failed: ${g instanceof Error?g.message:String(g)}
|
|
726
|
+
`)),process.exit(1);return}let n=t4(t.config);n.length===0&&(process.stderr.write(nr.default.red("No product config found (events.config.ts / primus.config.ts). Run `npayload init` first.\n")),process.exit(1));let i=r4(t.app),a={...t.config?{config:t.config}:{},...i?{app:i}:{},env:o},c=s(async g=>{process.stdout.write(nr.default.dim(`
|
|
727
|
+
[${g}] reconciling ${n.length} config(s)\u2026
|
|
728
|
+
`));try{await Te(a)}catch(h){process.stderr.write(nr.default.red(`${ie(`reconcile failed: ${h instanceof Error?h.message:String(h)}`,h)}
|
|
729
|
+
`))}},"reconcile");await c("start"),process.stdout.write(nr.default.bold(`
|
|
730
|
+
\u{1F440} watching ${n.map(g=>g.replace(process.cwd()+"/","")).join(", ")}
|
|
731
|
+
`)+nr.default.dim(" edit any to re-reconcile (creates + updates, never deletes) \xB7 run `npayload listen` for a live stream \xB7 Ctrl-C to stop\n"));let l=await ht().catch(()=>null),d=Sr(),u=Pr("dev",l,{onRevoked:s(()=>vn(),"onRevoked"),onRefused:d.onRefused}),m=null,p=s(()=>{m&&clearTimeout(m),m=setTimeout(()=>void c("change"),300)},"bump"),f=n.map(g=>(0,Mr.watch)(g,p));try{await Promise.race([new Promise(g=>{process.on("SIGINT",()=>{u(),process.stdout.write(nr.default.dim(`
|
|
732
|
+
stopped.
|
|
733
|
+
`)),g()})}),d.ended])}catch(g){m&&clearTimeout(m);for(let h of f)h.close();process.stderr.write(nr.default.red(`${ie(`dev stopped: ${g instanceof Error?g.message:String(g)}`,g)}
|
|
734
|
+
`)),process.exit(1);return}process.exit(0)})}s(t$,"registerDev");mn();se();var us=class extends Error{static{s(this,"IncomingWebhookRefusal")}code;constructor(t,r){super(r),this.name="IncomingWebhookRefusal",this.code=t}};function sm(e){if(e.startsWith("whk_"))return"channel";if(e.startsWith("trg_"))return"agent";throw new us("NOT_AN_INCOMING_WEBHOOK",`"${e}" names no incoming webhook: a channel's webhook id starts with whk_, an agent's webhook trigger id with trg_`)}s(sm,"ownerOf");var xe=s(e=>typeof e=="string"?e:"","str"),eS=s(e=>{if(Array.isArray(e))return e;let t=e;return Array.isArray(t?.items)?t.items:Array.isArray(t?.data)?t.data:[]},"rowsOf"),n$=s(e=>typeof e=="number"&&Number.isFinite(e)?new Date(e).toISOString():null,"iso");async function r$(e){let[t,r]=await Promise.all([e.listChannelWebhooks(),e.listAgentWebhookTriggers()]),o=eS(t),n=eS(r).filter(d=>d.type==="webhook"),i=[...new Set(o.map(d=>xe(d.channelGid)).filter(Boolean))],a=new Map;await Promise.all(i.map(async d=>{try{let u=await e.channel(d);a.set(d,xe(u?.name)||null)}catch(u){F(u),a.set(d,null)}}));let c=new Map;if(n.length>0)try{for(let d of eS(await e.listAgents()))c.set(xe(d.gid),xe(d.name))}catch(d){F(d)}return[...o.map(d=>({id:xe(d.gid),name:xe(d.name),deliversTo:{kind:"channel",id:xe(d.channelGid),name:a.get(xe(d.channelGid))??null},signingSecret:d.hasSigningSecret===!0?"set":"not set",lastDelivery:null,status:xe(d.status)})),...n.map(d=>{let u=d.config??{};return{id:xe(d.gid),name:xe(d.name),deliversTo:{kind:"agent",id:xe(d.agentGid),name:c.get(xe(d.agentGid))||null},signingSecret:xe(u.webhookSecret)!==""?"set":"not set",lastDelivery:n$(d.lastTriggeredAt),status:d.enabled===!1?"paused":"active"}})].sort((d,u)=>d.name.localeCompare(u.name)||d.id.localeCompare(u.id))}s(r$,"listIncomingWebhooks");async function tS(e,t){if("channel"in t){let o=await e.createChannelWebhook({channelGid:t.channel,name:t.name,...t.description!==void 0?{description:t.description}:{}});return{id:xe(o.gid),name:xe(o.name)||t.name,deliversTo:{kind:"channel",id:t.channel},signingSecret:xe(o.signingSecret)}}let r=await e.createAgentWebhookTrigger({agentGid:t.agent,name:t.name,...t.description!==void 0?{description:t.description}:{},type:"webhook",config:{},action:{goal:t.goal}});return{id:xe(r.gid),name:t.name,deliversTo:{kind:"agent",id:t.agent},signingSecret:xe(r.webhookSecret)}}s(tS,"addIncomingWebhook");async function o$(e,t){if(sm(t)==="agent")throw new us("ROTATION_NOT_AVAILABLE",`the signing secret of an agent's webhook trigger (${t}) cannot be rotated yet: revoke it and add a new one`);let r=await e.rotateChannelWebhookSecret(t),o=n$(r.previousExpiresAt);return{id:t,signingSecret:xe(r.signingSecret),...o?{previousSecretValidUntil:o}:{}}}s(o$,"rotateIncomingWebhookSecret");async function i$(e,t){return sm(t)==="channel"?await e.revokeChannelWebhook(t):await e.removeAgentTrigger(t),{id:t,revoked:!0}}s(i$,"revokeIncomingWebhook");re();var s$="Save the signing secret now: it is shown this once.";function o4(e,t){let r=s((n,i,a={})=>e.send(pn({row:n,positionals:i,flags:a,newIdempotencyKey:e.newIdempotencyKey})),"call"),o=s((n,i)=>i===void 0?{}:{[n]:i},"optional");return{listChannelWebhooks:s(()=>r(t.list,[]),"listChannelWebhooks"),listAgentWebhookTriggers:s(()=>r(t.triggersList,[],{type:"webhook"}),"listAgentWebhookTriggers"),channel:s(n=>r(t.channelGet,[n]),"channel"),listAgents:s(()=>r(t.agentsList,[]),"listAgents"),createChannelWebhook:s(n=>r(t.create,[],{channelGid:n.channelGid,name:n.name,...o("description",n.description)}),"createChannelWebhook"),createAgentWebhookTrigger:s(n=>r(t.triggersCreate,[],{agentGid:n.agentGid,name:n.name,type:n.type,config:JSON.stringify(n.config),action:JSON.stringify(n.action),...o("description",n.description)}),"createAgentWebhookTrigger"),rotateChannelWebhookSecret:s(n=>r(t.rotateSecret,[n]),"rotateChannelWebhookSecret"),revokeChannelWebhook:s(n=>r(t.revoke,[n]),"revokeChannelWebhook"),removeAgentTrigger:s(n=>r(t.triggersRemove,[n]),"removeAgentTrigger")}}s(o4,"kernelWebhookDoors");async function am(e,t){try{await t(o4(e,await e.rows()))}catch(r){e.printError(Ce(r instanceof Error?r.message:String(r),r)),process.exitCode=r instanceof us||r instanceof Y?1:ur(r)}}s(am,"run");function a$(e,t){let r=e.commands.find(o=>o.name()==="webhooks")??e.command("webhooks").description("Your incoming webhooks: the channels' and the agents'");r.command("list").description("List your incoming webhooks in one list \u2014 the webhooks that publish into a channel and the webhook triggers that start an agent \u2014 with what each delivers to, its signing secret's state, its last delivery and its status").action(()=>am(t,async o=>t.print({webhooks:await r$(o)}))),r.command("add").description("Add an incoming webhook to a channel (--channel) or to an agent (--agent with --goal); its signing secret is shown once").requiredOption("--name <name>","the webhook's name").option("--channel <channelId>","the channel it publishes into").option("--agent <agentId>","the agent it starts").option("--goal <text>","what the agent does when the webhook fires (with --agent)").option("--description <text>","a description").action(o=>am(t,async n=>{if(o.channel===void 0==(o.agent===void 0))throw new Y("name exactly one of --channel <channelId> or --agent <agentId>");if(o.agent!==void 0&&(o.goal===void 0||o.goal.trim()===""))throw new Y("--agent needs --goal: what the agent does when the webhook fires");let i=o.description!==void 0?{description:o.description}:{},a=o.channel!==void 0?await tS(n,{channel:o.channel,name:o.name,...i}):await tS(n,{agent:o.agent,name:o.name,goal:o.goal,...i});t.print(a),t.printError(s$)})),r.command("rotate-secret").argument("<webhookId>","the incoming webhook (whk_\u2026)").description("Rotate an incoming webhook's signing secret; the new one is shown once and the previous one keeps verifying for a grace window").action(o=>am(t,async n=>{t.print(await o$(n,o)),t.printError(s$)})),r.command("revoke").argument("<webhookId>","the incoming webhook (whk_\u2026 for a channel's, trg_\u2026 for an agent's)").description("Revoke an incoming webhook: requests sent to it stop being accepted (asks first; --yes skips the question)").action(o=>am(t,async n=>{if(sm(o),!await t.confirm(`Revoke the incoming webhook ${o}? Requests sent to it stop being accepted.`)){t.printError(`kept ${o}: nothing was revoked (pass --yes to revoke without asking)`),process.exitCode=1;return}t.print(await i$(n,o))}))}s(a$,"registerIncomingWebhooks");JE();ME();var on=K(require("chalk"));qe();zl();_t();mr();se();re();function i4(e){if(Array.isArray(e))return e;let t=e;return t?.data??t?.messages??t?.page??[]}s(i4,"rowsOf");async function nS(e,t,r={}){let o=new Set,n=!0,i=Math.max(500,r.intervalMs??1500);for(;;){let a=r.end?.refusal();if(a!==void 0)throw a;try{let c=await e.send({method:"GET",path:"/v1/channels/{channelId}/messages",pathParams:{channelId:t},query:{limit:25}}),d=i4(c).filter(u=>u.gid&&!o.has(u.gid)).reverse();for(let u of d)if(o.add(u.gid),r.json)process.stdout.write(JSON.stringify({gid:u.gid,routingKey:u.routingKey,payload:u.payload})+`
|
|
735
|
+
`);else{let m=new Date(u.publishedAt??u.createdAt??Date.now()).toLocaleTimeString(),p=`${on.default.dim(m)} ${on.default.cyan(u.routingKey??"event")} ${JSON.stringify(u.payload).slice(0,160)}`;process.stdout.write(n?on.default.dim(p)+`
|
|
736
|
+
`:p+`
|
|
737
|
+
`)}n=!1}catch(c){F(c),process.stderr.write(on.default.yellow(`tail: ${c instanceof Error?c.message:String(c)} \u2014 retrying
|
|
738
|
+
`))}await new Promise(c=>setTimeout(c,i))}}s(nS,"followChannel");function c$(e){e.command("tail").argument("<channel>","channel slug to watch").description("Watch events arrive on a channel, live (Ctrl-C to stop)").option("--app <appGid>","app GID (default: NPAYLOAD_APP_ID or the project .env)").option("--interval <ms>","poll interval in ms","1500").option("--json","one JSON object per event (NDJSON) \u2014 no decoration").action(async(t,r)=>{try{let o=await vt(),n=await ch(o,r.app);n||(process.stderr.write(on.default.red(`No app GID. Pass --app or set NPAYLOAD_APP_ID.
|
|
739
|
+
`)),process.exit(1));let i=await o.send({method:"GET",path:"/v1/apps/channels/by-slug/{slug}",pathParams:{slug:t}});i?.gid||(process.stderr.write(on.default.red(`Channel "${t}" not found under app ${n}.
|
|
740
|
+
`)),process.exit(1)),r.json||process.stdout.write(`
|
|
741
|
+
${ci("npayload",!1)} ${on.default.bold("tail")} ${on.default.cyan(t)} ${on.default.dim(`(${i.gid}) \xB7 Ctrl-C to stop`)}
|
|
742
|
+
|
|
743
|
+
`);let a=await ht().catch(()=>null),c=Sr(),l=Pr("tail",a,{onRevoked:s(()=>vn(),"onRevoked"),onRefused:c.onRefused});process.on("SIGINT",()=>{l(),process.exit(0)}),await nS(o,i.gid,{intervalMs:Number(r.interval)||1500,...r.json?{json:!0}:{},end:c})}catch(o){process.stderr.write(on.default.red(`${ie(`tail failed: ${o instanceof Error?o.message:String(o)}`,o)}
|
|
744
|
+
`)),process.exit(1)}})}s(c$,"registerTail");var Oe=K(require("chalk"));re();se();var s4="2026-09-15.v1",a4="2026-09-15.v1",c4="template",l4="Fees are non-refundable, except when the feed did not deliver, the platform failed, or the charge was wrong.",d4="POST /v1/billing/feed-listings/subscribe-with-saved-card",u4="/settings/billing",l$=/^[a-z0-9-]+$/,p4="Use <publisher-slug>/<listing-slug> (or the alias <publisher-slug>.<listing-slug>), each slug lowercase letters, digits and hyphens [a-z0-9-] \u2014 e.g. `npayload subscribe wickfeed/lit`.";function oS(e){let t=(e??"").trim(),r=t.split("/").length-1,o=t.split(".").length-1;if(r+o===1){let n=r===1?"/":".",i=t.indexOf(n),a=t.slice(0,i),c=t.slice(i+1);if(l$.test(a)&&l$.test(c))return{publisherSlug:a,listingSlug:c,ref:`${a}/${c}`,dotted:n==="."}}throw new G(`"${t}" is not a listing reference.`,{code:"INVALID_LISTING_REF",hint:p4})}s(oS,"parseListingRef");function iS(e,t,r){t.dotted&&e.print(` ${Oe.default.dim(`Using ${t.ref} \u2014 the canonical form of ${r.trim()}.`)}`)}s(iS,"printAliasHint");function rS(e){return e instanceof Error?e.message:String(e)}s(rS,"messageOf");function m4(e){if(!/ACCEPTANCE_REQUIRED/.test(e))return null;let t=s(i=>new RegExp(`${i}:\\s*([^\\s,;)]+)`).exec(e)?.[1],"field"),r=t("subscriberAgreementVersion"),o=t("listingLicenceVersion"),n=/\(version\s*([^)\s]+)\)/.exec(e)?.[1]??t("currentVersion");if(n){let i=/listing_licence/i.test(e)||/licence|license/i.test(e),a=/subscriber_agreement/i.test(e)||/subscriber agreement/i.test(e);i&&!o?o=n:a&&!r&&(r=n)}return!r&&!o?null:{...r?{subscriberAgreementVersion:r}:{},...o?{listingLicenceVersion:o}:{}}}s(m4,"parseStaleAcceptance");function f4(e){if(!/SPEND_CAP_EXCEEDED/.test(e))return null;let t=/approvalRequestId:\s*([^\s,;]+)/.exec(e),r=/expiresAt:\s*([^\s,;]+)/.exec(e);return{...t?{approvalRequestId:t[1]}:{},...r?{expiresAt:r[1]}:{}}}s(f4,"parseSpendCapRefusal");function p$(e){let t=/^([A-Z][A-Z0-9_]{3,})\b/.exec(e.trim());return t?t[1]:null}s(p$,"typedCodeOf");function g4(e,t){let r=p$(e)??t;return new G(e,{code:r})}s(g4,"doorError");function cm(e,t){if(e instanceof G)return e;let r=rS(e),o=e?.code,n=p$(r)??(typeof o=="string"&&/^[A-Z][A-Z0-9_]{3,}$/.test(o)?o:null)??t;return new G(r,{code:n,...e!==void 0?{cause:e}:{}})}s(cm,"typedDoorError");function sS(e){let t=(e.env??e.envGid)?.trim();if(t)return{wanted:t,explicit:!0};let r=e.mintedEnvSlug?.trim();if(r)return{wanted:r,explicit:!1};throw new G("No environment. Pass --env <slug>, or select one with `np env use <slug>`.",{code:"ENV_REQUIRED",hint:"List them with `np env list`, then pass --env <slug> or run `np env use <slug>`."})}s(sS,"requireEnvChoice");async function aS(e,t){let r;try{r=await e.send({method:"GET",path:"/v1/feeds/resolve/{publisherSlug}/{listingSlug}",pathParams:{publisherSlug:t.publisherSlug,listingSlug:t.listingSlug},scope:"listings:read"})}catch(o){throw F(o),cm(o,"RESOLVE_FAILED")}if(!r?.gid)throw new G(`The resolver answered no listing for ${t.ref}.`,{code:"RESOLVE_FAILED",hint:"Try again; if it persists, the catalogue door is not answering."});return r}s(aS,"resolveListingRef");async function cS(e,t,r){let o=await e.send({method:"GET",path:"/v1/account/environments",scope:"account:read"}),i=(Array.isArray(o)?o:o?.environments??[]).find(a=>a.slug===t.wanted||a.gid===t.wanted);if(!i?.gid)throw new G(`No environment "${t.wanted}" on this account.`,{code:"ENV_NOT_FOUND",hint:"List them with `np env list` and pass one of those slugs to --env."});if(t.explicit&&r&&i.slug&&r!==i.slug)throw new G(`This session is authenticated for the "${r}" environment, but --env names "${i.slug}" (${i.gid}).`,{code:"ENV_MINT_MISMATCH",hint:`Run \`np env use ${i.slug}\` (or pass the global --env ${i.slug}) and try again.`});return i}s(cS,"resolveTargetEnvironment");var h4=new Set(["cancelled","expired"]);async function lS(e,t,r){let o;try{o=await e.send({method:"GET",path:"/v1/feeds/subscriptions",scope:"feed:read"})}catch(i){throw F(i),cm(i,"SUBSCRIPTIONS_UNREADABLE")}return(Array.isArray(o)?o:o?.data??[]).filter(i=>typeof i.gid=="string"&&i.listingGid===t&&!h4.has(i.status??"")&&(i.targetAppGids??[]).includes(r))}s(lS,"liveSubscriptionsIn");async function dS(e,t,r){try{let o=await e.send({method:"GET",path:"/v1/feeds/subscriptions/{subscriptionId}/bindings",pathParams:{subscriptionId:t},scope:"feed:read"}),n=Array.isArray(o)?o:o?.data??[];return(n.find(a=>a.targetAppGid===r)??n[0])?.receivingChannelGid??null}catch(o){return F(o),null}}s(dS,"receivingChannelOf");function y4(e){let t=e.licence;return t?.version&&t.type?{...t,type:t.type,version:t.version}:{type:c4,version:a4}}s(y4,"resolveListingLicence");function v4(e){return`$${(e/100).toFixed(2)}`}s(v4,"money");function b4(e,t,r){let o=e.pricing,n=o?.model;if(n==="free"||n===void 0)return 0;if(n==="flat_rate"){let i=o?.flatRate;if(!i)throw new G(`The catalogue does not publish a price for ${e.name??e.slug??"this listing"}, so it cannot be shown before you subscribe.`,{code:"LISTING_PRICE_UNAVAILABLE",hint:"Subscribe from the dashboard, which reads the price from the listing itself."});let a=t==="yearly"?i.yearlyPriceCents:i.monthlyPriceCents;if(typeof a!="number")throw new G(`${e.name??e.slug??"This listing"} has no ${t} price.`,{code:"BILLING_CYCLE_UNAVAILABLE",hint:"Run the command again with --billing-cycle monthly."});return a}if(n==="tiered"){if(t==="yearly")throw new G(`${e.name??e.slug??"This listing"} is tiered: tiers carry a monthly price only, so yearly billing is not available.`,{code:"BILLING_CYCLE_UNAVAILABLE",hint:"Run the command again with --billing-cycle monthly."});let i=o?.tiered?.tiers??[],a=(r?i.find(c=>c.name===r):void 0)??i[0];if(!a||typeof a.monthlyPriceCents!="number")throw new G(`${e.name??e.slug??"This listing"} has no tier${r?` named "${r}"`:""}.`,{code:"TIER_NOT_FOUND",hint:"Pass --tier <name> with a tier the listing offers."});return a.monthlyPriceCents}throw new G(`${e.name??e.slug??"This listing"} is priced per message, which this command cannot subscribe to yet.`,{code:"PRICING_MODEL_UNAVAILABLE",hint:"Subscribe to a free, flat-rate or tiered listing, or use the dashboard."})}s(b4,"resolvePrice");function d$(e,t){let r=`${t.listing.name??t.listing.slug??"listing"} (${t.listing.slug??""})`,o=`${t.environment?.name??t.envGid} (${t.envGid})`;e.print(""),e.print(` ${Oe.default.bold("Publisher")} ${t.listing.publisherSlug??""}`),e.print(` ${Oe.default.bold("Listing")} ${r}`),t.listing.description&&e.print(` ${Oe.default.bold("About")} ${t.listing.description}`),w4(e,t.listing.samplePayload),e.print(` ${Oe.default.bold("Price")} ${t.priceInCents>0?`${v4(t.priceInCents)} ${t.billingCycle}`:"free"}`),e.print(` ${Oe.default.bold("Delivers to")} ${o}`),t.sandboxOnly?e.print(` ${Oe.default.dim("This target is a sandbox app: the subscription is free, no card is charged, and delivery pauses at the trial limit until you add a production app.")}`):t.chargeable&&e.print(` ${Oe.default.dim("This target is a production app, so this subscription is a paid one.")}`),e.print(` ${Oe.default.bold("Agreement")} Subscriber Agreement ${t.agreementVersion}`),e.print(` ${Oe.default.bold("Licence")} ${t.licence.type} licence ${t.licence.version}`),e.print(` ${Oe.default.dim(l4)}`),e.print("")}s(d$,"printTerms");function w4(e,t){let r=t?.trim();if(!r){e.print(` ${Oe.default.bold("Sample")} no sample provided by the publisher`);return}let o;try{o=JSON.stringify(JSON.parse(r),null,2).split(`
|
|
745
|
+
`)}catch{o=r.split(`
|
|
746
|
+
`)}e.print(` ${Oe.default.bold("Sample")}`);for(let n of o)e.print(` ${n}`)}s(w4,"printSample");async function u$(e,t){if(t)return;if(!e.isTty)throw new G("Subscribing needs an explicit confirmation, and this session is not interactive.",{code:"CONFIRMATION_REQUIRED",hint:"Run the command again with --yes to accept the terms printed above."});if(!await e.confirm())throw new G("Not subscribed.",{code:"SUBSCRIBE_DECLINED",hint:"Nothing was charged and no subscription was created."})}s(u$,"takeConsent");async function k4(e,t,r){let o=sS(t),n=oS(t.ref);iS(r,n,t.ref);let i=t.billingCycle??"monthly",a=await aS(e,n),c=await cS(e,o,t.mintedEnvSlug),l=c.gid,d=(await lS(e,a.gid,l))[0];if(d){let T=await dS(e,d.gid,l),q=c.slug??l;throw new G(`Already subscribed to ${n.ref} in ${q} (${d.gid}), delivering to ${T??"a receiving channel not yet bound"}.`,{code:"ALREADY_SUBSCRIBED",hint:"Nothing was sent. "+(T?`Watch it with \`npayload tail ${T}\`, or cancel`:"Cancel")+` it with \`npayload unsubscribe ${n.ref} --env ${q}\`.`})}let u=c.pool==="production"||c.kind==="production",m=b4(a,i,t.tierName),p=y4(a),f=!!a.licence?.version,g=m>0&&u,h=m>0&&!u,y=a.subscriberAgreementVersion??s4,v=p.version,S=f;d$(r,{listing:a,environment:c,envGid:l,priceInCents:m,billingCycle:i,agreementVersion:y,licence:p,chargeable:g,sandboxOnly:h});let k=!1;if(g)throw new G(`${a.name??n.listingSlug} is a paid listing and ${c.name??l} is a production app, so this subscribe has to be charged. The one door that charges and subscribes in a single transaction (${d4}) is not live yet, so the CLI will not charge you: it never runs a charge and a subscribe as two separate calls.`,{code:"PAID_PATH_UNAVAILABLE",hint:`Subscribe to this listing from the dashboard, or with this command point --env at a sandbox app (nothing is charged), or subscribe to a free listing. See ${u4} for your cards.`});await u$(r,t.yes);let R=4,I=null;for(let T=0;;T+=1)try{I=await e.send({method:"POST",path:"/v1/feeds/listings/{listingId}/subscribe",pathParams:{listingId:a.gid},scope:"feed:write",body:{targetAppGids:[l],billingCycle:i,...t.tierName?{tierName:t.tierName}:{},...S?{acceptedSubscriberAgreementVersion:y,acceptedListingLicenceVersion:v}:{}}});break}catch(q){F(q);let H=rS(q),ne=f4(H);if(ne)throw r.print(""),r.print(` ${Oe.default.yellow("!")} This subscribe is over your organization's agent spend cap.`),ne.approvalRequestId&&r.print(` Approval request ${ne.approvalRequestId}`),ne.expiresAt&&r.print(` Expires ${ne.expiresAt}`),r.print(" A billing admin of your organization was emailed to approve it."),new G("Refused by the agent spend cap.",{code:"SPEND_CAP_EXCEEDED",hint:"Run the same command again once a billing admin has approved the request."});let fe=m4(H);if(!fe||T+1>=R)throw g4(H,"SUBSCRIBE_FAILED");y=fe.subscriberAgreementVersion??y,v=fe.listingLicenceVersion??v,S=!0,r.print(` ${Oe.default.yellow("!")} The terms this listing is sold under are not the ones shown above. Here they are again.`),d$(r,{listing:a,environment:c,envGid:l,priceInCents:m,billingCycle:i,agreementVersion:y,licence:{...p,version:v},chargeable:g,sandboxOnly:h}),await u$(r,t.yes)}let x=I?.gid;if(!x)throw new G("The subscribe door answered without a subscription gid.",{code:"SUBSCRIBE_FAILED"});let _=s((T,q)=>new G(`Subscribed (${x}), but the receiving channel could not be read: ${T}.`,{code:"RECEIVING_CHANNEL_UNRESOLVED",hint:`The subscription exists \u2014 do not subscribe again. Read it with \`np feed subscriptions get ${x}\`.`,...q!==void 0?{cause:q}:{}}),"bindingFailure"),U;try{U=await e.send({method:"GET",path:"/v1/feeds/subscriptions/{subscriptionId}/bindings",pathParams:{subscriptionId:x},scope:"feed:read"})}catch(T){throw F(T),_("the bindings door refused",T)}let A=Array.isArray(U)?U:U?.data??[],M=(A.find(T=>T.targetAppGid===l)??A[0])?.receivingChannelGid;if(!M)throw _("no delivery binding carries a receiving channel yet");let V;try{V=await e.send({method:"GET",path:"/v1/channels/{channelId}",pathParams:{channelId:M},scope:"channels:read"})}catch(T){throw F(T),_(`channel ${M} could not be read`,T)}let J=V?.name;if(!J)throw _(`channel ${M} answered without a name`);let w;try{w=await e.send({method:"GET",path:"/v1/feeds/subscriptions/{subscriptionId}",pathParams:{subscriptionId:x},scope:"feed:read"})}catch(T){throw F(T),new G(`Subscribed (${x}), but the subscription could not be read back: ${rS(T)}.`,{code:"ENTITLEMENT_UNREADABLE",hint:`The subscription exists \u2014 do not subscribe again. Read it with \`np feed subscriptions get ${x}\`.`,cause:T})}return r.print(` ${Oe.default.green("\u2714")} Subscribed. ${Oe.default.dim(x)}`),r.print(` Receiving channel ${J} (${M})`),r.print(` Entitlement ${w?.environment??"unknown"} \xB7 ${w?.mode??"unknown"} \xB7 ${w?.status??"unknown"}`),r.print(` ${Oe.default.dim(`Watch it: npayload tail ${J}`)}`),t.tail&&r.tail&&await r.tail(M),{subscriptionGid:x,receivingChannelGid:M,receivingChannelName:J,charged:k,listingGid:a.gid,priceInCents:m,billingCycle:i,acceptedSubscriberAgreementVersion:y,acceptedListingLicenceVersion:v,entitlement:{...w?.environment?{environment:w.environment}:{},...w?.mode?{mode:w.mode}:{},...w?.status?{status:w.status}:{}}}}s(k4,"runSubscribe");function m$(e,t={}){e.command("subscribe").argument("<listing>","listing reference: <publisher-slug>/<listing-slug> (or <publisher-slug>.<listing-slug>), e.g. wickfeed/lit").description("Subscribe this organization to a feed listing by its name and print the channel it arrives on").option("--env <slug>","environment that receives the feed, by slug (a gid is also accepted); defaults to the active environment").option("--billing-cycle <cycle>","monthly | yearly","monthly").option("--tier <name>","tier name, for a tiered listing").option("--yes","accept the printed terms without a prompt").option("--tail","after subscribing, follow the receiving channel until interrupted").action(async(r,o)=>{let n=t.resolveKernel;if(!n)throw new G("No credentials resolver is wired for `subscribe`.",{code:"NOT_AUTHENTICATED",hint:"Run `np login` and try again."});let i=await n(),a=t.tail,c=t.confirm,l={print:s(u=>process.stdout.write(`${u}
|
|
747
|
+
`),"print"),confirm:s(async()=>c?c("Accept these terms and subscribe?"):!1,"confirm"),isTty:!!(process.stdin.isTTY&&process.stdout.isTTY),...a?{tail:s(u=>a(i,u),"tail")}:{}},d=t.mintedEnvSlug?t.mintedEnvSlug():void 0;await k4(i,{ref:r,...o.env?{env:o.env}:{},...d?{mintedEnvSlug:d}:{},yes:o.yes??(t.yes?t.yes():!1),...o.tail?{tail:!0}:{},...o.billingCycle?{billingCycle:o.billingCycle}:{},...o.tier?{tierName:o.tier}:{}},l)})}s(m$,"registerSubscribe");var lm=K(require("chalk"));re();se();async function E4(e,t,r){let o=sS(t),n=oS(t.ref);iS(r,n,t.ref);let i=await aS(e,n),a=await cS(e,o,t.mintedEnvSlug),c=a.slug??a.gid,l=await lS(e,i.gid,a.gid);if(l.length===0)throw new G(`No live subscription to ${n.ref} in ${c}.`,{code:"NOT_SUBSCRIBED",hint:"Nothing was cancelled. Check the listing reference and --env."});if(l.length>1){let u=await Promise.all(l.map(async m=>{let p=await dS(e,m.gid,a.gid);return`${m.gid} \u2192 ${p??"no receiving channel bound"}`}));r.print(` ${lm.default.yellow("!")} ${l.length} live subscriptions to ${n.ref} in ${c}:`);for(let m of u)r.print(` ${m}`);throw new G(`${l.length} live subscriptions to ${n.ref} in ${c} (${u.join("; ")}); none was cancelled.`,{code:"MULTIPLE_SUBSCRIPTIONS",hint:"Cancel the one you mean from the dashboard (Feed \u2192 Subscriptions)."})}let d=l[0];try{await e.send({method:"DELETE",path:"/v1/feeds/subscriptions/{subscriptionId}",pathParams:{subscriptionId:d.gid},scope:"feed:write"})}catch(u){throw F(u),cm(u,"UNSUBSCRIBE_FAILED")}return r.print(` ${lm.default.green("\u2714")} Unsubscribed ${n.ref} in ${c}. ${lm.default.dim(d.gid)}`),{ref:n.ref,environment:c,subscriptionGid:d.gid}}s(E4,"runUnsubscribe");function f$(e,t={}){e.command("unsubscribe").argument("<listing>","listing reference: <publisher-slug>/<listing-slug> (or <publisher-slug>.<listing-slug>), e.g. wickfeed/lit").description("Cancel this organization's subscription to a feed listing, by its name").option("--env <slug>","environment whose subscription to cancel, by slug (a gid is also accepted); defaults to the active environment").action(async(r,o)=>{let n=t.resolveKernel;if(!n)throw new G("No credentials resolver is wired for `unsubscribe`.",{code:"NOT_AUTHENTICATED",hint:"Run `np login` and try again."});let i=await n(),a=t.mintedEnvSlug?t.mintedEnvSlug():void 0;await E4(i,{ref:r,...o.env?{env:o.env}:{},...a?{mintedEnvSlug:a}:{}},{print:s(c=>process.stdout.write(`${c}
|
|
748
|
+
`),"print")})})}s(f$,"registerUnsubscribe");var We=K(require("chalk"));_t();var Co=K(require("chalk"));function g$(e){return typeof e=="object"&&e!==null&&typeof e.tier=="string"}s(g$,"isAccountStatus");function h$(e){let t=[],r=Co.default.bold(e.tier);if(e.trialExpired)r+=" "+Co.default.red("trial expired");else if(e.inTrial){let n=typeof e.trialDaysLeft=="number"?`${e.trialDaysLeft} day${e.trialDaysLeft===1?"":"s"} left`:"active";r+=" "+Co.default.yellow(`trial \u2014 ${n}`)}return t.push(`${Co.default.dim("Plan")} ${r}`),(e.trialExpired||e.inTrial===!0||e.converted===!1)&&typeof e.upgradeUrl=="string"&&e.upgradeUrl.length>0&&t.push(`${Co.default.dim("Upgrade")} ${Co.default.cyan(e.upgradeUrl)}`),t}s(h$,"renderPlanLines");mr();Fg();se();function y$(e={}){return{write:e.write??(t=>void process.stdout.write(t)),error:e.error??(t=>void process.stderr.write(t)),exit:e.exit??(t=>process.exit(t))}}s(y$,"ioOf");async function S4(e){let t=y$(e.io),r=await e.resolveSession();if(!r){t.error(We.default.red("Not signed in.")+" Run `npayload login` to authenticate.\n"),t.exit(1);return}let o,n;try{({sid:o,label:n}=await r.whoami())}catch(c){if(c instanceof Jt){vn({write:t.error,exit:t.exit});return}F(c),o=r.sessionId(),n=null}t.write(`${We.default.dim("Session")} ${o?We.default.cyan(o):We.default.dim("(unknown)")}
|
|
749
|
+
`),t.write(`${We.default.dim("Device")} ${n?We.default.bold(n):We.default.dim("(unavailable \u2014 could not reach npayload)")}
|
|
750
|
+
`);let i=e.resolveContext?await e.resolveContext(r):qg(r),a=s(c=>c?We.default.bold(c):We.default.dim("(none)"),"show");if(t.write(`${We.default.dim("Org")} ${a(i.org)}
|
|
751
|
+
`),t.write(`${We.default.dim("App")} ${a(i.app)}
|
|
752
|
+
`),t.write(`${We.default.dim("Env")} ${a(i.env)}
|
|
753
|
+
`),e.fetchAccountStatus){let c=await e.fetchAccountStatus().catch(l=>(F(l),null));if(c&&g$(c))for(let l of h$(c))t.write(l+`
|
|
754
|
+
`)}t.exit(0)}s(S4,"runWhoami");async function P4(e,t){let r=y$(t.io),o=await t.resolveSession();if(!o){r.write(We.default.dim(`Already signed out.
|
|
755
|
+
`)),r.exit(0);return}e.all?(await o.logoutAll(),r.write(We.default.green("\u2713")+` Signed out of ALL your npayload CLI sessions.
|
|
756
|
+
`)):(await o.logout(),r.write(We.default.green("\u2713")+` Signed out of this npayload CLI session.
|
|
757
|
+
`)),r.exit(0)}s(P4,"runLogout");function v$(e,t){let r={...t,resolveSession:s(()=>ht(),"resolveSession"),resolveContext:s(o=>{let n=e.opts().env;return qg(o,typeof n=="string"&&n.trim()!==""?{explicitEnv:n}:{})},"resolveContext")};e.command("whoami").description("Show the current CLI session id, device label, and active org / app / env context").action(async()=>{await S4(r)}),e.command("logout").description("Sign out this CLI session (revoke it server-side and clear local credentials)").option("--all","revoke ALL of your CLI sessions across every device, not just this one").action(async o=>{await P4({all:o.all===!0},r)})}s(v$,"registerSessionCommands");var _$=K(require("chalk"));re();Ke();gt();function sn(e){return typeof e=="object"&&e!==null?e:{}}s(sn,"rec");function Je(e){return typeof e=="string"&&e.length>0?e:void 0}s(Je,"asString");var an={accepted:s(e=>({conversationId:Je(sn(e).conversationId)}),"accepted"),phaseChange:s(e=>{let t=sn(e);return{from:Je(t.from),to:Je(t.to),reason:Je(t.reason)}},"phaseChange"),toolStart:s(e=>{let t=sn(e);return{toolCallId:Je(t.toolCallId),toolName:Je(t.toolName),arguments:t.arguments}},"toolStart"),toolEnd:s(e=>{let t=sn(e);return{toolCallId:Je(t.toolCallId),success:t.success===!0,result:t.result,durationMs:typeof t.durationMs=="number"?t.durationMs:void 0}},"toolEnd"),turnComplete:s(e=>{let t=sn(e);return{turnNumber:typeof t.turnNumber=="number"?t.turnNumber:void 0,tokensUsed:typeof t.tokensUsed=="number"?t.tokensUsed:void 0}},"turnComplete"),contentDelta:s(e=>({content:Je(sn(e).content)}),"contentDelta"),executionComplete:s(e=>{let t=sn(e),r=sn(t.usage);return{text:Je(t.text),usage:{promptTokens:typeof r.promptTokens=="number"?r.promptTokens:void 0,completionTokens:typeof r.completionTokens=="number"?r.completionTokens:void 0,totalTokens:typeof r.totalTokens=="number"?r.totalTokens:void 0}}},"executionComplete"),response:s(e=>({text:Je(sn(e).text)}),"response"),done:s(e=>{let t=sn(e);return{conversationId:Je(t.conversationId),executionId:Je(t.executionId),status:Je(t.status)}},"done"),error:s(e=>{let t=sn(e);return{message:Je(t.message),code:Je(t.code),kind:Je(t.kind)}},"error")};function uS(e,t=60){if(e==null)return"";let r;if(typeof e=="string")r=e;else try{r=JSON.stringify(e)}catch{r=String(e)}return r=r.replace(/\s+/g," ").trim(),r.length>t&&(r=`${r.slice(0,Math.max(0,t-1))}\u2026`),r}s(uS,"previewOneLine");function pS(e){return typeof e!="number"||!Number.isFinite(e)||e<0?"":e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}s(pS,"formatDuration");function dm(e){return{rendered:"",openTools:new Map,done:!1,startedAt:e}}s(dm,"initialTurnState");function I4(e,t){return t===e?null:t.startsWith(e)?t.slice(e.length):e.startsWith(t)?null:`
|
|
758
|
+
${t}`}s(I4,"contentSuffix");function um(e,t,r=e.startedAt){let o={...e,openTools:new Map(e.openTools)},n=[];switch(t.event){case"accepted":{let i=an.accepted(t.data);i.conversationId&&(o.conversationId=i.conversationId),n.push({kind:"spinner",text:"thinking\u2026"});break}case"phase_change":{let i=an.phaseChange(t.data);i.to&&(o.phase=i.to,n.push({kind:"phase",text:i.reason?`\u203A ${i.to} \u2014 ${i.reason}`:`\u203A ${i.to}`}),n.push({kind:"spinner",text:`${i.to}\u2026`}));break}case"tool_call_start":{let i=an.toolStart(t.data),a=i.toolCallId??`tool-${o.openTools.size}`,c=i.toolName??"tool";o.openTools.set(a,{name:c});let l=uS(i.arguments,48);n.push({kind:"tool_start",id:a,text:l?`${c} ${l}`:c}),n.push({kind:"spinner",text:`running ${c}\u2026`});break}case"tool_call_end":{let i=an.toolEnd(t.data),a=i.toolCallId??"",c=(a&&o.openTools.get(a)?.name)??"tool";a&&o.openTools.delete(a);let l=pS(i.durationMs),d=!i.success&&i.result!==void 0?` ${uS(i.result,60)}`:"";n.push({kind:"tool_end",id:a,ok:i.success===!0,text:`${c}${l?` (${l})`:""}${d}`}),n.push({kind:"spinner",text:`${o.phase??"working"}\u2026`});break}case"turn_complete":{let i=an.turnComplete(t.data);if(i.turnNumber!==void 0){let a=i.tokensUsed!==void 0?` \xB7 ${i.tokensUsed} tokens`:"";n.push({kind:"phase",text:`\u203A turn ${i.turnNumber}${a}`})}break}case"content_delta":{let i=an.contentDelta(t.data);if(i.content!==void 0){let a=I4(o.rendered,i.content);a!==null&&a.length>0&&(o.rendered=i.content,n.push({kind:"content",text:a}))}break}case"execution_complete":{let i=an.executionComplete(t.data);i.usage&&(o.usage=i.usage),i.text&&o.rendered===""&&(o.rendered=i.text,n.push({kind:"content",text:i.text}));break}case"response":{let i=an.response(t.data);i.text&&o.rendered===""&&(o.rendered=i.text,n.push({kind:"content",text:i.text}));break}case"done":{let i=an.done(t.data);i.conversationId&&(o.conversationId=i.conversationId),i.executionId&&(o.executionId=i.executionId),o.status=i.status??"completed",o.done=!0;let a=[o.status];if(o.usage?.totalTokens!==void 0){let l=o.usage.promptTokens!==void 0&&o.usage.completionTokens!==void 0?` (${o.usage.promptTokens}+${o.usage.completionTokens})`:"";a.push(`${o.usage.totalTokens} tokens${l}`)}let c=r-o.startedAt;c>0&&a.push(pS(c)),o.status!=="completed"&&o.status!=="cancelled"&&n.push({kind:"error",text:`run ${o.status}`}),n.push({kind:"meta",text:`\u23FA ${a.filter(Boolean).join(" \xB7 ")}`}),n.push({kind:"end"});break}case"error":{let i=an.error(t.data);o.status="failed",o.done=!0;let a=VI(i);n.push({kind:"error",text:a.message,code:i.kind??i.code}),a.hint&&n.push({kind:"meta",text:`\u2192 ${a.hint}`}),n.push({kind:"end"});break}default:break}return{state:o,actions:n}}s(um,"reduceChatEvent");var Ft=K(require("chalk"));ro();var b$={out:s(e=>process.stdout.write(e),"out"),err:s(e=>process.stderr.write(e),"err")},ps=class{static{s(this,"ChatRenderer")}spinner=null;spinnerRetired=!1;contentOpen=!1;sinks;interactive;constructor(t){this.sinks=t?.sinks??b$,this.interactive=t?.interactive??process.stderr.isTTY===!0}beginTurn(){this.spinnerRetired=!1,this.contentOpen=!1}spin(t){!this.interactive||this.spinnerRetired||(this.spinner?this.spinner.text=t:this.spinner=new Vt(t).start())}pauseSpinner(){this.spinner?.stop()}resumeSpinner(){!this.spinnerRetired&&this.interactive&&this.spinner?.start()}retireSpinner(){this.spinner?.stop(),this.spinner=null,this.spinnerRetired=!0}stepLine(t){this.pauseSpinner(),this.contentOpen&&(this.sinks.out(`
|
|
759
|
+
`),this.contentOpen=!1),this.sinks.err(`${t}
|
|
760
|
+
`),this.resumeSpinner()}apply(t){switch(t.kind){case"spinner":this.spin(Ft.default.dim(t.text));break;case"phase":this.stepLine(Ft.default.dim(t.text));break;case"tool_start":this.stepLine(Ft.default.dim(` \u2699 ${t.text}`));break;case"tool_end":this.stepLine(t.ok?Ft.default.dim(` ${Ft.default.green("\u2713")} ${t.text}`):` ${Ft.default.red("\u2717")} ${Ft.default.dim(t.text)}`);break;case"content":this.retireSpinner(),this.sinks.out(t.text),this.contentOpen=!t.text.endsWith(`
|
|
761
|
+
`);break;case"meta":this.retireSpinner(),this.contentOpen&&(this.sinks.out(`
|
|
762
|
+
`),this.contentOpen=!1),this.sinks.err(`${Ft.default.dim(t.text)}
|
|
763
|
+
`);break;case"error":this.retireSpinner(),this.contentOpen&&(this.sinks.out(`
|
|
764
|
+
`),this.contentOpen=!1),this.sinks.err(`${Ft.default.red(`\u2717 ${t.text}`)}${t.code?Ft.default.dim(` [${t.code}]`):""}
|
|
765
|
+
`);break;case"end":this.retireSpinner(),this.contentOpen&&(this.sinks.out(`
|
|
766
|
+
`),this.contentOpen=!1);break}}interrupt(t){this.retireSpinner(),this.contentOpen&&(this.sinks.out(`
|
|
767
|
+
`),this.contentOpen=!1),this.sinks.err(`${Ft.default.dim(t)}
|
|
768
|
+
`)}},pm=class{constructor(t=b$){this.sinks=t}static{s(this,"NdjsonRenderer")}onEvent(t){this.sinks.out(`${JSON.stringify({event:t.event,data:t.data})}
|
|
769
|
+
`)}};Pt();re();se();Wt();function T4(e){return e?/nonce="([^"]+)"/.exec(e)?.[1]:void 0}s(T4,"parseDpopNonce");var x4="executions:execute";async function*Tc(e,t,r,o,n){let i=ot(qn(e)??Ie(),n?.fetchImpl),a=`${t.replace(/\/+$/,"")}/v1/primus/chat/stream-pipeline`,c=JSON.stringify({agentGid:r.agentGid,input:r.input,...r.conversationGid?{conversationGid:r.conversationGid}:{}}),l=s(async()=>{qn(e)?.check(a);let u=await e.auth.getAccessToken([x4]),m=await e.auth.signDpopProof({method:"POST",url:a,accessToken:u.token});return i(a,{method:"POST",headers:{Authorization:`DPoP ${u.token}`,DPoP:m,Accept:"text/event-stream","content-type":"application/json"},body:c,signal:o})},"doFetch"),d=await l();if(d.status===401){let u=T4(d.headers.get("www-authenticate"));u&&(e.auth.cacheNonce(new URL(a).origin,u),d=await l())}if(!d.ok){let u="";try{u=(await d.text()).slice(0,300)}catch{}throw new G(`chat stream request failed (${d.status})${u?`: ${u}`:""}`,{code:d.status===401||d.status===403?"CHAT_AUTH":d.status===404?"PRIMUS_UNREACHABLE":"CHAT_STREAM_FAILED",hint:d.status===403?"your credential is missing the executions:execute scope \u2014 re-run `npayload push` (permissions sync) or grant it in the dashboard":d.status===404?"the chat route was not found at this endpoint \u2014 check NPAYLOAD_PRIMUS_API_URL (or --api-url) names your AI endpoint":void 0})}if(!d.body)throw new G("chat stream returned no body",{code:"CHAT_STREAM_FAILED"});for await(let u of ff(d.body))yield{event:u.event??"message",data:u.data}}s(Tc,"streamChatTurn");re();se();function mm(e){let t=e;return(Array.isArray(t)?t:Array.isArray(t?.data)?t.data:[]).filter(o=>typeof o=="object"&&o!==null)}s(mm,"rowsOf");var cn=s(e=>typeof e=="string"&&e?e:void 0,"str");async function xc(e){let t=await e.send({method:"GET",path:"/v1/primus/agents",query:{activeOnly:!0},scope:"agents:read"});return mm(t).map(r=>({gid:cn(r.gid)??"",name:cn(r.name)??"(unnamed)",description:cn(r.description),status:cn(r.status)})).filter(r=>r.gid&&(r.status===void 0||r.status==="active"))}s(xc,"listActiveAgents");function fm(e,t){let r=e.find(i=>i.gid===t);if(r)return r;let o=t.toLowerCase(),n=e.filter(i=>i.name.toLowerCase()===o);if(n.length===1)return n[0];throw n.length>1?new G(`agent name "${t}" is ambiguous (${n.length} matches)`,{code:"AGENT_AMBIGUOUS",hint:`use the gid: ${n.map(i=>i.gid).join(" | ")}`}):new G(`no active agent matches "${t}"`,{code:"AGENT_NOT_FOUND",hint:e.length?`available: ${e.slice(0,8).map(i=>i.name).join(", ")}`:"no active agents in this app \u2014 create one first (np primus agents create / dashboard)"})}s(fm,"resolveAgent");async function w$(e,t){let r=await e.send({method:"GET",path:"/v1/primus/conversations/by-agent",query:{agentGid:t},scope:"conversations:read"});return mm(r).map(o=>({id:cn(o.gid)??"",title:cn(o.title),updatedAt:typeof o.updatedAt=="number"?o.updatedAt:typeof o.lastMessageAt=="number"?o.lastMessageAt:void 0})).filter(o=>o.id)}s(w$,"listConversationsByAgent");async function k$(e,t,r=10){let o=await e.send({method:"GET",path:"/v1/primus/conversations/{conversationId}/messages",pathParams:{conversationId:t},query:{messageLimit:r},scope:"conversations:read"}),n=o??{};return(Array.isArray(n.messages)?n.messages:mm(o)).filter(a=>typeof a=="object"&&a!==null).map(a=>({role:cn(a.role)??"message",content:cn(a.content)??JSON.stringify(a.content??"").slice(0,200)})).slice(-r)}s(k$,"getConversationMessages");async function E$(e,t){try{let r=await e.send({method:"GET",path:"/v1/primus/executions/by-conversation",query:{conversationGid:t,limit:5},scope:"executions:read"}),o=mm(r).find(i=>cn(i.status)==="running"||cn(i.status)==="pending"),n=o?cn(o.gid):void 0;return n?(await e.send({method:"POST",path:"/v1/primus/executions/{executionId}/cancel",pathParams:{executionId:n},body:{reason:"interrupted from np primus chat"},scope:"executions:execute"}),!0):!1}catch(r){return F(r),!1}}s(E$,"cancelRunningExecution");var T$=require("readline/promises");se();re();var _e=K(require("chalk"));function S$(e){let t=e.trim();if(!t.startsWith("/"))return null;let[r,...o]=t.slice(1).split(/\s+/),n=o.join(" ").trim()||void 0;switch((r??"").toLowerCase()){case"help":case"h":case"?":return{kind:"help"};case"exit":case"quit":case"q":return{kind:"exit"};case"new":return{kind:"new"};case"resume":return{kind:"resume"};case"info":return{kind:"info"};case"agent":return{kind:"agent",ref:n};default:return{kind:"unknown",raw:t}}}s(S$,"parseSlashCommand");var P$=["commands:"," /agent [name|gid] switch agent (picker when no argument; resets the conversation)"," /new start a fresh conversation with the current agent"," /resume pick one of this agent's conversations to continue"," /info show current agent, conversation, and endpoint"," /help this help"," /exit leave the chat","","Ctrl-C during a reply interrupts the run (best-effort server cancel);","at the prompt it exits. Messages are single-line in this version."].join(`
|
|
770
|
+
`);var zt=s(e=>{process.stderr.write(e)},"err");async function mS(e,t,r={}){let o=await xc(e);if(o.length===0){let{CliError:n}=await Promise.resolve().then(()=>(re(),MI));throw new n("no active agents in this app",{code:"NO_AGENTS",hint:"create one first: np primus agents create --name \u2026 (or use the dashboard), then re-run np primus chat"})}return o.length===1?o[0]:(r.select??Qt)("Pick an agent",o.map(n=>({name:n.gid===t?.gid?`${n.name} (current)`:n.name,value:n,description:n.description})))}s(mS,"pickAgent");async function I$(e,t,r={}){let o=r.err??zt,n=await w$(e,t.gid);if(n.length===0){o(_e.default.dim(`no previous conversations with ${t.name} \u2014 starting fresh
|
|
771
|
+
`));return}let i=await(r.select??Qt)(`Resume a conversation with ${t.name}`,n.slice(0,20).map(a=>({name:a.title??a.id,value:a.id,description:a.updatedAt?new Date(a.updatedAt).toLocaleString():void 0})));try{let a=await k$(e,i,10);if(a.length){o(_e.default.dim("\u2500".repeat(40)+`
|
|
772
|
+
`));for(let c of a){let l=c.role==="user"?"you":c.role;o(_e.default.dim(`${l}: ${c.content.split(`
|
|
773
|
+
`)[0].slice(0,120)}
|
|
774
|
+
`))}o(_e.default.dim("\u2500".repeat(40)+`
|
|
775
|
+
`))}}catch(a){F(a)}return i}s(I$,"pickConversation");async function _4(e,t,r,o,n,i,a={}){let c=dm(Date.now());n.beginTurn();let l=Tc(e,t,{agentGid:r.agent.gid,input:o,conversationGid:r.conversationId},i,a.fetchImpl?{fetchImpl:a.fetchImpl}:void 0);for await(let d of l){let u=um(c,d,Date.now());c=u.state;for(let m of u.actions)n.apply(m);if(c.conversationId&&(r.conversationId=c.conversationId),c.done)break}return c}s(_4,"runTurn");async function R4(e,t,r,o,n,i,a={}){let c=a.err??zt;try{return await _4(e,t,r,o,n,i.signal,a),c(`
|
|
776
|
+
`),{interrupted:!1,cancelled:!1}}catch(l){if(!i.signal.aborted)throw l;n.interrupt("\u23F9 interrupted");let d=!1;if(r.conversationId){let u;d=await Promise.race([E$(e,r.conversationId),new Promise(m=>{u=setTimeout(()=>m(!1),a.cancelTimeoutMs??2e3)})]),u&&clearTimeout(u),c(_e.default.dim(d?`\xB7 run cancelled server-side
|
|
777
|
+
|
|
778
|
+
`:`\xB7 could not confirm server-side cancel \u2014 the run may finish anyway
|
|
779
|
+
|
|
780
|
+
`))}else c(_e.default.dim(`\xB7 no conversation yet \u2014 nothing to cancel server-side
|
|
781
|
+
|
|
782
|
+
`));return{interrupted:!0,cancelled:d}}}s(R4,"runInterruptibleTurn");async function x$(e,t,r,o){o.resume&&(r.conversationId=await I$(e,r.agent));let n=(0,T$.createInterface)({input:process.stdin,output:process.stderr}),i=new ps,a=!1,c=null,l=!1;for(n.on("SIGINT",()=>{if(a&&c){c.abort();return}l=!0,n.close()}),zt(_e.default.dim(`chatting with ${_e.default.bold(r.agent.name)} \xB7 ${r.conversationId?`resuming ${r.conversationId}`:"new conversation"} \xB7 /help for commands \xB7 Ctrl-C to leave
|
|
783
|
+
|
|
784
|
+
`));!l;){let d;try{d=await n.question(_e.default.cyan("\u276F "))}catch{break}let u=d.trim();if(!u)continue;let m=S$(u);if(m){switch(m.kind){case"help":zt(`${_e.default.dim(P$)}
|
|
785
|
+
`);break;case"exit":l=!0;break;case"new":r.conversationId=void 0,zt(_e.default.dim(`started a new conversation
|
|
786
|
+
`));break;case"resume":try{let p=await I$(e,r.agent);p&&(r.conversationId=p)}catch(p){zt(_e.default.red(`${ie(p instanceof Error?p.message:String(p),p)}
|
|
787
|
+
`))}break;case"agent":try{let p=m.ref?fm(await xc(e),m.ref):await mS(e,r.agent);p.gid!==r.agent.gid&&(r.agent=p,r.conversationId=void 0,zt(_e.default.dim(`switched to ${p.name} (new conversation)
|
|
788
|
+
`)))}catch(p){zt(_e.default.red(`${ie(p instanceof Error?p.message:String(p),p)}
|
|
789
|
+
`))}break;case"info":zt(_e.default.dim([`agent ${r.agent.name} (${r.agent.gid})`,`conversation ${r.conversationId??"(new \u2014 created on first message)"}`,`endpoint ${t}`].join(`
|
|
790
|
+
`)+`
|
|
791
|
+
`));break;case"unknown":zt(_e.default.dim(`unknown command ${m.raw} \u2014 /help
|
|
792
|
+
`));break}continue}a=!0,c=new AbortController;try{await R4(e,t,r,u,i,c)}catch(p){let f=Ol(p),g=f instanceof Error?f.message:String(f),h=f?.hint;zt(_e.default.red(`\u2717 ${ie(g,p)}
|
|
793
|
+
`)+(h?_e.default.dim(` ${h}
|
|
794
|
+
`):"")+`
|
|
795
|
+
`)}finally{a=!1,c=null}}n.close(),zt(_e.default.dim(`bye
|
|
796
|
+
`))}s(x$,"runChatRepl");function A4(e,t){if(e.json&&!e.message)throw new G("--json requires --message (NDJSON output is one-shot only)",{code:"JSON_REQUIRES_MESSAGE",hint:'np primus chat --agent <ref> --message "\u2026" --json'});if(e.message){if(!e.agent&&!t)throw new G("--message without a TTY also needs --agent",{code:"AGENT_REQUIRED",hint:'np primus chat --agent <gid|name> --message "\u2026"'});return"oneshot"}if(!t)throw new G("interactive chat needs a TTY",{code:"NO_TTY",hint:'for scripts/CI use one-shot mode: np primus chat --agent <ref> --message "\u2026" [--json]'});return"repl"}s(A4,"assertChatInvocation");async function O4(e){let{buildKernel:t}=await Promise.resolve().then(()=>(qe(),ba)),r=e??te(process.env.NPAYLOAD_PRIMUS_API_URL,"primusApiUrl"),o=await t(r),n=r??te(process.env.NPAYLOAD_API_URL,"apiUrl","https://api.npayload.com");return{kernel:o,baseUrl:n}}s(O4,"resolveChatKernel");async function $4(e,t,r,o,n,i={}){let a=i.fetchImpl?{fetchImpl:i.fetchImpl}:void 0,c=new AbortController,l=s(()=>c.abort(),"onSignal");process.on("SIGINT",l);try{let d;if(n){let m=new pm(i.sinks);for await(let p of Tc(e,t,{agentGid:r.gid,input:o},c.signal,a)){if(m.onEvent(p),p.event==="done"){d=(p.data??{}).status;break}if(p.event==="error"){d="failed";break}}}else{let m=new ps(i.sinks?{sinks:i.sinks}:void 0);m.beginTurn();let p=dm(Date.now()),f=Tc(e,t,{agentGid:r.gid,input:o},c.signal,a);for await(let g of f){let h=um(p,g,Date.now());p=h.state;for(let y of h.actions)m.apply(y);if(p.done)break}d=p.status}let u=d==="completed"?0:1;return process.exitCode=u,u}finally{process.off("SIGINT",l)}}s($4,"runOneShot");function R$(e){e.command("chat").description("chat with an agent \u2014 streams the run's steps (phases, tool calls) and the reply live").option("--agent <ref>","agent gid or name (picker on a TTY when omitted)").option("--resume","pick one of the agent's conversations to continue").option("--message <text>","one-shot: send one message, print the reply, exit").option("--json","one-shot only: emit the raw stream as NDJSON").option("--api-url <url>","override the AI endpoint (defaults to npayload's own)").action(async t=>{try{let r=A4(t,ft()),{kernel:o,baseUrl:n}=await O4(t.apiUrl),i;try{i=await xc(o)}catch(l){let d=l?.status;throw d===404?new G("the AI endpoint is not reachable at this base URL",{code:"PRIMUS_UNREACHABLE",hint:"check NPAYLOAD_PRIMUS_API_URL (or --api-url) names your AI endpoint",cause:l}):d===403?new G("your credential is missing the agents:read scope",{code:"CHAT_AUTH",hint:"re-run `npayload push` (permissions sync) or grant the ai scopes in the dashboard",cause:l}):l}let a=t.agent?fm(i,t.agent):r==="oneshot"?(()=>{if(i.length===1)return i[0];throw new G("--message needs --agent when more than one agent exists",{code:"AGENT_REQUIRED",hint:`available: ${i.slice(0,8).map(l=>l.name).join(", ")}`})})():await mS(o);if(r==="oneshot"){await $4(o,n,a,t.message,t.json===!0);return}await x$(o,n,{agent:a},{resume:t.resume===!0})}catch(r){(r instanceof G||r instanceof Z)&&we(r),process.stderr.write(_$.default.red(`\u2717 ${r instanceof Error?r.message:String(r)}
|
|
797
|
+
`)),process.exitCode=1}})}s(R$,"registerChat");var Re=K(require("chalk")),_c=require("fs"),A$=require("path");qe();da();gt();aa();re();se();function O$(e,t){let r=[];for(let o of sa()){let n=e[o];if(n)for(let[i,a]of Object.entries(n))for(let c of Kn(o)){let l=po(Qn(a,c.path))??[],d=new Map;for(let f of Object.keys(e[c.parent]??{}))d.set(f,{name:f,source:"config"});for(let f of t[c.parent]??[]){let g=d.get(f.name);d.set(f.name,{name:f.name,source:g?.source??"live",gid:f.gid??g?.gid})}let u=[...d.values()].sort((f,g)=>f.name.localeCompare(g.name)),m=new Set(u.map(f=>f.name)),p=l.filter(f=>!m.has(f));r.push({resource:o,key:i,spec:c,current:l,candidates:u,dangling:p})}}return r}s(O$,"computeWiringSlots");function C4(e,t,r){if(fd(e.current,t))return null;let o=e.spec.array?t:t[0]??null,n=t.map(a=>e.candidates.find(c=>c.name===a)?.gid).filter(a=>!!a),i=n.length?`// ${r}: ${n.join(", ")}`:void 0;return{resource:e.resource,key:e.key,field:e.spec.path,kind:"update-field",value:o,...i?{trailingComment:i}:{}}}s(C4,"slotToChange");function N4(e){let t=e.current.length?e.current.join(", "):Re.default.dim("(none)"),r=e.dangling.length?Re.default.red(` \u26A0 not found: ${e.dangling.join(", ")}`):"";return`${e.resource} "${e.key}" \u2192 ${e.spec.label}: ${t}${r}`}s(N4,"describeSlot");var L4={agents:"/v1/primus/agents",skills:"/v1/primus/skills",tools:"/v1/primus/tools"};async function D4(e,t){let r={},o=te(process.env.NPAYLOAD_PRIMUS_API_URL,"primusApiUrl"),n;try{n=await vt(o,t)}catch(a){return e(Re.default.yellow(` \u2022 live topology unavailable (${a instanceof Error?a.message:String(a)}) \u2014 using config-declared candidates only
|
|
798
|
+
`)),r}let i=new Set;for(let a of sa())for(let c of Kn(a))i.add(c.parent);for(let a of i){let c=L4[a];if(c)try{let l=await n.send({method:"GET",path:c}),d=G4(l);r[a]=d.map(u=>({name:typeof u.name=="string"?u.name:"",gid:typeof u.gid=="string"?u.gid:void 0})).filter(u=>u.name)}catch(l){F(l),e(Re.default.yellow(` \u2022 could not list ${a} (${l instanceof Error?l.message:String(l)})
|
|
799
|
+
`))}}return r}s(D4,"fetchLive");function G4(e){let t=e;return(Array.isArray(t)?t:Array.isArray(t.data)?t.data:[]).filter(o=>typeof o=="object"&&o!==null)}s(G4,"extractRows");async function U4(e){let t=e.sink??(l=>void process.stdout.write(l)),r={checkbox:eT,select:Qt,confirm:XI,...e.prompts},o=O$(e.config,e.live);t(Re.default.bold(`
|
|
800
|
+
Wiring relationships (env: ${e.env}) \u2014 Enter to keep a slot unchanged
|
|
801
|
+
|
|
802
|
+
`));let n=[];for(let l of o){if(l.candidates.length===0){t(Re.default.dim(` ${l.resource} "${l.key}" \u2192 ${l.spec.label}: no candidates yet (declare some ${l.spec.parent} first)
|
|
803
|
+
`));continue}let d=l.candidates.map(p=>({name:p.source==="live"&&!Object.keys(e.config[l.spec.parent]??{}).includes(p.name)?`${p.name} ${Re.default.dim("(live)")}`:p.name,value:p.name,checked:l.current.includes(p.name)})),u;if(l.spec.array)u=await r.checkbox(`${l.resource} "${l.key}" \u2192 ${l.spec.label}`,d);else{let p=await r.select(`${l.resource} "${l.key}" \u2192 ${l.spec.label}`,[{name:Re.default.dim("(none)"),value:""},...d.map(f=>({name:f.name,value:f.value}))]);u=p?[p]:[]}let m=C4(l,u,e.env);m&&n.push(m)}if(n.length===0)return t(Re.default.green(`
|
|
804
|
+
\u2713 Everything already wired \u2014 no changes.
|
|
805
|
+
`)),{changes:n};t(Re.default.bold(`
|
|
806
|
+
Changes to write:
|
|
807
|
+
`));for(let l of n){let d=Array.isArray(l.value)?`[${l.value.join(", ")}]`:String(l.value);t(` ${l.resource} "${l.key}".${l.field} = ${d}${l.trailingComment?Re.default.dim(` ${l.trailingComment}`):""}
|
|
808
|
+
`)}if(!await r.confirm(`
|
|
809
|
+
Write these to the config?`,!0))return t(Re.default.dim(`Aborted \u2014 nothing written.
|
|
810
|
+
`)),{changes:n,aborted:!0};let a={merged:{},changes:n,conflicts:[],localOnly:[]},c=await Yp(e.sourceText,a);return!c.ok||c.text===void 0?{changes:n,reason:c.reason??"unknown"}:{changes:n,text:c.text}}s(U4,"runWireWizard");function $$(e){e.command("wire").description("Interactively wire primus relationships (agents\u2194skills\u2194tools\u2194triggers) by NAME \u2014 no gids").option("--config <path>","path to primus.config.ts (default: ./npayload/primus.config.ts)").option("--check","print the wiring report and change nothing").option("--env <slug>","environment to read live gids from and name in the gid pin comment (default: the active environment)").action(async(t,r)=>{try{let o=Lt(t,r),n=hr(o!==void 0?{explicitSlug:o}:{}),i=n??"sandbox",a=t.config?(0,A$.resolve)(process.cwd(),t.config):at("primus");if(!a)throw new Error("no primus.config.ts found \u2014 run from a project with npayload/primus.config.ts (or pass --config).");let c=await pe(a),l=s(f=>process.stdout.write(f),"sink"),d=await D4(l,n),u=O$(c,d);if(u.length===0){l(Re.default.dim(`No relationship slots in this config (declare agents/skills/tools/triggers first).
|
|
811
|
+
`));return}if(t.check||!ft()){l(Re.default.bold(`
|
|
812
|
+
Wiring report
|
|
813
|
+
`));for(let g of u)l(` ${N4(g)}
|
|
814
|
+
`);let f=u.filter(g=>g.dangling.length);f.length&&l(Re.default.yellow(`
|
|
815
|
+
${f.length} slot(s) reference a name that doesn't exist \u2014 fix the name or declare the parent, then run \`npayload wire\`.
|
|
816
|
+
`)),!t.check&&!ft()&&l(Re.default.dim(`
|
|
817
|
+
(non-interactive: showing the report only; run in a TTY to wire)
|
|
818
|
+
`));return}let m=(0,_c.readFileSync)(a,"utf8"),p=await U4({config:c,live:d,env:i,sourceText:m,sink:l});if(p.changes.length===0||p.aborted)return;if(p.text===void 0){let f=`${a}.wire-suggested.txt`;(0,_c.writeFileSync)(f,`Could not apply wiring automatically (${p.reason??"unknown"}). Apply manually:
|
|
819
|
+
|
|
820
|
+
`+p.changes.map(g=>` ${g.resource}.${g.key}.${g.field} = ${JSON.stringify(g.value)}${g.trailingComment?" "+g.trailingComment:""}`).join(`
|
|
821
|
+
`)+`
|
|
822
|
+
`),l(Re.default.yellow(`
|
|
823
|
+
\u26A0 Could not edit the config safely \u2014 wrote suggestions to ${f} (config untouched).
|
|
824
|
+
`));return}(0,_c.writeFileSync)(a,p.text),l(Re.default.green(`
|
|
825
|
+
\u2713 Wired ${p.changes.length} relationship(s) into ${a}.
|
|
826
|
+
`)),l(Re.default.dim("Run `npayload push` to reconcile the new wiring to your deployment.\n"))}catch(o){we(o)}})}s($$,"registerWire");var N$=require("path");mn();zg();la();Zt();re();function j4(e){if(!e||typeof e!="object")return null;let t=e,r=typeof t.slug=="string"?t.slug:void 0,o=t.kind==="production"||t.kind==="development"?t.kind:void 0;if(!r||!o)return null;let n={slug:r,kind:o},i=typeof t.gid=="string"?t.gid:typeof t.envId=="string"?t.envId:void 0;i&&(n.envId=i);let a=typeof t.deployBranch=="string"?t.deployBranch:void 0;return a&&(n.deployBranch=a),n}s(j4,"toTargetEnv");function C$(e){if(Array.isArray(e))return e;if(e&&typeof e=="object")for(let t of["environments","data","items"]){let r=e[t];if(Array.isArray(r))return r}return[]}s(C$,"rowsOf");function M4(e){let t=[];for(let r of e){if(!r||typeof r!="object")continue;let o=r,n=typeof o.slug=="string"?o.slug:void 0,i=o.kind==="production"||o.kind==="development"?o.kind:void 0;if(!n||!i)continue;let a=typeof o.name=="string"?o.name:void 0;t.push({slug:n,kind:i,...a?{name:a}:{}})}return t}s(M4,"toReconcileEnvs");function L$(e,t){if(t.length!==0)try{let r=fi(e??process.cwd());if(!r)return;let o=od((0,N$.dirname)(r),{envs:t});o.addedEnvSections.length>0&&process.stderr.write(`npayload.toml updated: added [env.${o.addedEnvSections.join("], [env.")}]
|
|
827
|
+
`)}catch{}}s(L$,"reconcileEnvSections");async function q4(e){try{let t=await e.send(mo("list")),r=C$(t).map(j4).filter(o=>o!==null);r.length>0&&$x(r,e.cwd),L$(e.cwd,M4(C$(t))),e.print(t),e.exit(0)}catch(t){e.printError(Ce(t instanceof Error?t.message:String(t),t)),e.exit(2)}}s(q4,"runEnvList");async function F4(e,t){let r;try{r=mo("create",e)}catch(o){if(o instanceof Y){t.printError(o.message),t.exit(o.exitCode);return}throw o}try{let o=await t.send(r);L$(t.cwd,[{slug:e.slug,kind:e.kind,...e.name?{name:e.name}:{}}]),t.print(o),t.exit(0)}catch(o){t.printError(Ce(o instanceof Error?o.message:String(o),o)),t.exit(2)}}s(F4,"runEnvCreate");async function z4(e,t){let r;try{r=mo("show",{slug:e})}catch(o){if(o instanceof Y){t.printError(o.message),t.exit(o.exitCode);return}throw o}try{let o=await t.send(r);t.print(o),t.exit(0)}catch(o){t.printError(Ce(o instanceof Error?o.message:String(o),o)),t.exit(2)}}s(z4,"runEnvShow");async function B4(e,t){let r;try{r=mo("clone",{slug:e.source,targetSlug:e.target,...e.name?{targetName:e.name}:{},...e.withData?{withData:!0}:{},...e.confirm?{confirmation:e.confirm}:{}})}catch(o){if(o instanceof Y){t.printError(o.message),t.exit(o.exitCode);return}throw o}try{let o=await t.send(r);t.print(o),t.exit(0)}catch(o){t.printError(Ce(o instanceof Error?o.message:String(o),o)),t.exit(2)}}s(B4,"runEnvClone");function K4(e,t){let r=Ne(t.cwd);if(r){let o=r.environments.map(n=>n.slug);if(!o.includes(e)){t.printError(`Unknown environment "${e}". Declared in npayload.toml: ${o.join(", ")||"(none)"}.`),t.exit(1);return}}Ax(e,t.cwd),t.print({activeEnvironment:e}),t.exit(0)}s(K4,"runEnvUse");function Q4(e){let t={name:String(e.name??""),slug:String(e.slug??""),kind:String(e.kind??"")};return typeof e.deployBranch=="string"&&e.deployBranch!==""&&(t.deployBranch=e.deployBranch),t}s(Q4,"createArgsFromOptions");function D$(e,t){let r=s((a,c)=>{a.command("list").description(c?"List the app's logical environments":"List the app's logical environments (alias of `np account environments list`)").action(async()=>{await q4(t())}),a.command("create").description("Create a logical environment (--kind development|production)").requiredOption("--name <name>","human-readable environment name").requiredOption("--slug <slug>","environment slug (stable identifier)").requiredOption("--kind <kind>","development | production").option("--deploy-branch <branch>","git branch `np deploy` requires for this env").action(async d=>{await F4(Q4(d),t())}),a.command("show <slug>").description("Show one of the app's logical environments by slug").action(async d=>{await z4(d,t())}),a.command("clone <source> <target>").description("Clone an environment into a NEW development environment (runs as a background job)").option("--name <name>","display name for the target env (defaults to the target slug)").option("--with-data","also copy the data tables (config_and_data mode)").option("--confirm <source-slug>","typed confirmation, required when copying DATA out of a production source").action(async(d,u,m)=>{await B4({source:d,target:u,...typeof m.name=="string"&&m.name!==""?{name:m.name}:{},...m.withData?{withData:!0}:{},...typeof m.confirm=="string"&&m.confirm!==""?{confirm:m.confirm}:{}},t())}),a.command("use <slug>").description("Record the active logical environment for subsequent env-scoped commands").action(d=>{K4(d,t())})},"wire"),o=e.command("env").description("Logical environments \u2014 list/create/show/clone/use (alias of `np account environments`). NOTE: distinct from `np envs`, the local auth-profile switcher.");r(o,!1);let n=e.commands.find(a=>a.name()==="account")??e.command("account");n.description("Account & identity management \u2014 org, apps, environments, oauth-clients, keys");let i=n.command("environments").description("The app's logical environments (canonical form of `np env`)");r(i,!0)}s(D$,"registerEnv");vi();gt();Wt();se();md();oo();qf();mn();td();mn();re();se();var gm=["events","primus","pipes"],V4={events:"Events",primus:"Primus",pipes:"Pipes"},H4="The log of the requests made with your keys is coming; until it exists, np logs lists your agents' and tools' errors and your failed pipe runs.",W4=200,J4=20,G$=5,U$=50,j$=s(e=>new Date(typeof e=="number"&&Number.isFinite(e)?e:0).toISOString(),"iso"),hm=s(e=>typeof e=="string"?e:"","str"),fS=s(e=>{if(Array.isArray(e))return e;let t=e?.data;return Array.isArray(t)?t:[]},"items");async function Z4(e,t,r){let o=await e.send(pn({row:t.primusErrors,positionals:[],flags:{limit:String(r)},newIdempotencyKey:e.newIdempotencyKey}));return fS(o).map(n=>({product:"Primus",status:n.status==="resolved"?"resolved":"active",message:hm(n.message),source:hm(n.source),at:j$(n.lastOccurrence??n.firstOccurrence??n.createdAt)}))}s(Z4,"primusProblems");function Y4(e){let t=e.error;if(typeof t?.message=="string"&&t.message!=="")return t.message;let o=(Array.isArray(e.nodeRuns)?e.nodeRuns:[]).find(n=>n.status==="error"&&typeof n.error=="string"&&n.error!=="");return o?String(o.error):"The run failed."}s(Y4,"runMessage");async function X4(e,t){let r=fS(await e.send(pn({row:t.pipesList,positionals:[],flags:{limit:String(W4)},newIdempotencyKey:e.newIdempotencyKey}))),o=[];for(let n=0;n<r.length;n+=G$){let i=r.slice(n,n+G$),a=await Promise.all(i.map(c=>e.send(pn({row:t.pipeRuns,positionals:[hm(c.gid)],flags:{status:"failed",limit:String(J4)},newIdempotencyKey:e.newIdempotencyKey}))));i.forEach((c,l)=>{for(let d of fS(a[l])){if(d.status!=="failed")continue;let u=d.timing;o.push({product:"Pipes",status:"failed",message:Y4(d),source:hm(c.name),at:j$(u?.startedAt)})}})}return o}s(X4,"pipesProblems");async function eq(e,t,r){let o=t?[t]:[...gm],n=o.filter(u=>u!=="events"),i=n.length>0?await e.rows():void 0,a=await Promise.all(n.map(async u=>{try{let m=u==="primus"?await Z4(e,i,r):await X4(e,i);return{product:u,rows:m}}catch(m){return F(m),{product:u,error:m}}})),c=a.filter(u=>"error"in u);if(c.length>0&&c.length===a.length&&!o.includes("events"))throw c[0].error;let d={logs:a.flatMap(u=>"rows"in u?u.rows:[]).sort((u,m)=>Date.parse(m.at)-Date.parse(u.at)).slice(0,r),requests:H4};return c.length>0&&(d.unavailable=c.map(u=>({product:V4[u.product],reason:u.error instanceof Error?u.error.message:String(u.error)}))),d}s(eq,"readLogs");function M$(e,t){e.command("logs").argument("[topic]",`one product's problems: ${gm.join(", ")} (default: all)`).description("List the environment's problems in one list \u2014 your agents' and tools' errors and your failed pipe runs \u2014 newest first, each with its product and status").option("--limit <n>",`how many problems to list (default ${U$})`).action(async(r,o)=>{try{if(r!==void 0&&!gm.includes(r))throw new Y(`no product "${r}" \u2014 np logs lists ${gm.join(", ")} (or all of them)`);let n=o.limit===void 0?U$:Number(o.limit);if(!Number.isInteger(n)||n<1)throw new Y(`--limit must be a whole number above 0, got "${o.limit}"`);t.print(await eq(t,r,n))}catch(n){t.printError(Ce(n instanceof Error?n.message:String(n),n)),process.exitCode=n instanceof Y?n.exitCode:ur(n)}})}s(M$,"registerLogs");da();function tq(e,t){return JSON.stringify([e,t??""])}s(tq,"cacheKey");function q$(e){let t=new Map;return{getKernelFor(r){let{lane:o,url:n}=e.laneOf(r),i=r.envless?void 0:e.resolveEnvSlug(),a=tq(o,i),c=t.get(a);return c||(c=e.build(n,i),t.set(a,c)),c}}}s(q$,"makeEnvKeyedKernelCache");Ke();kl();Nf();function gS(e){let t=e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{},o={gid:typeof t.gid=="string"?t.gid:typeof t.messageGid=="string"?t.messageGid:void 0},n={};for(let[i,a]of Object.entries(t))i==="gid"||i==="_extra"||(n[i]=a);return Object.defineProperty(o,"_extra",{value:Object.freeze(n),enumerable:!1,configurable:!0,writable:!1}),o}s(gS,"toPublishReceipt");Pt();yl();Pt();Tl();vl();Ke();var ym=new TextEncoder;function Rc(e){let t="";for(let o=0;o<e.length;o+=1)t+=String.fromCharCode(e[o]);return(typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}s(Rc,"b64url");async function nq(e){return Rc(new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",ym.encode(e))))}s(nq,"sha256B64url");async function F$(e,t){let o={typ:"dpop+jwt",alg:"EdDSA",jwk:{kty:"OKP",crv:"Ed25519",x:e.publicKeyJwk.x}},n={jti:Rc(globalThis.crypto.getRandomValues(new Uint8Array(16))),htm:t.htm,htu:t.htu,iat:Math.floor((t.nowMs??Date.now())/1e3)};t.accessToken!==void 0&&(n.ath=await nq(t.accessToken));let i=`${Rc(ym.encode(JSON.stringify(o)))}.${Rc(ym.encode(JSON.stringify(n)))}`,a=new Uint8Array(await globalThis.crypto.subtle.sign({name:"Ed25519"},e.privateKey,ym.encode(i)));return`${i}.${Rc(a)}`}s(F$,"eddsaDpopProof");var rq=3e4,vm=class{static{s(this,"KernelFrameDoorCredential")}opts;fetchImpl;minted;inflight;constructor(t){this.opts=t,this.fetchImpl=t.fetchImpl??globalThis.fetch.bind(globalThis)}async accessToken(){let t=this.opts.refreshMarginMs??rq;return this.minted&&this.minted.expiresAt-Date.now()>t?this.minted.token:(this.inflight??=this.mint().finally(()=>{this.inflight=void 0}),this.minted=await this.inflight,this.minted.token)}proof(t,r){return F$(this.opts.key,{htm:"POST",htu:t,accessToken:r})}async unit(){return mI(await this.accessToken())}async mint(){let{tokenUrl:t,clientId:r}=this.opts,o=await F$(this.opts.key,{htm:"POST",htu:t}),n=new URLSearchParams({grant_type:"client_credentials",client_id:r,scope:""});this.opts.appId&&n.set("app_id",this.opts.appId),this.opts.env&&n.set("env_id",this.opts.env),this.opts.clientSecret&&n.set("client_secret",this.opts.clientSecret);let a=await oi(this.opts.refusal??(()=>{}),d=>new Z(d.charAt(0).toUpperCase()+d.slice(1)),this.fetchImpl)(t,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",DPoP:o},body:n.toString()}),c=await a.json().catch(()=>({}));if(!a.ok){let d=typeof c.error=="string"&&c.error!==""?c.error:"oauth_failed",u=typeof c.error_description=="string"&&c.error_description!==""?c.error_description:d;throw new ze(`the token endpoint ${t} refused the kernel frame door's token (HTTP ${a.status}, ${d}): ${u}; no frame was posted.`,{code:d,status:a.status})}if(typeof c.access_token!="string"||c.access_token==="")throw new ze(`the token endpoint ${t} answered no access_token for the kernel frame door; no frame was posted.`,{code:"oauth_missing_token",status:a.status});if(typeof c.token_type=="string"&&c.token_type.toLowerCase()!=="dpop")throw new ze(`the token endpoint ${t} answered a ${c.token_type} token where the kernel frame door needs a DPoP-bound one; no frame was posted.`,{code:"non_dpop_token",status:a.status});let l=typeof c.expires_in=="number"&&c.expires_in>0?c.expires_in:600;return{token:c.access_token,expiresAt:Date.now()+l*1e3}}};Ke();El();se();function z$(e,t){let r=e?.trim();return r!==void 0&&/^app_[a-z0-9]+$/i.test(r)?r:Be(t["npayload/appId"])??Be(t.appId)??Be(t.app)??Be(t.app_id)}s(z$,"resolveProducerAppId");var oq="npayload/npp/app-signing-key/v1",hS=[48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32];async function iq(e){let t=globalThis.crypto.subtle,r=new TextEncoder,o=await t.importKey("raw",r.encode(e.clientSecret),"HKDF",!1,["deriveBits"]),n=new Uint8Array(await t.deriveBits({name:"HKDF",hash:"SHA-256",salt:r.encode(oq),info:r.encode(e.clientId)},o,256)),i=new Uint8Array(hS.length+n.byteLength);i.set(hS,0),i.set(n,hS.length),n.fill(0);try{let a=await t.importKey("pkcs8",i,{name:"Ed25519"},!0,["sign"]),c=await t.exportKey("jwk",a);return{privateKey:await t.importKey("jwk",c,{name:"Ed25519"},!1,["sign"]),publicKeyJwk:{kty:c.kty,crv:c.crv,x:c.x}}}finally{i.fill(0)}}s(iq,"deriveAppNppSigningKey");async function sq(){let e=globalThis.crypto.subtle,t=await e.generateKey({name:"Ed25519"},!0,["sign","verify"]);return{privateKey:t.privateKey,publicKeyJwk:await e.exportKey("jwk",t.publicKey)}}s(sq,"generateNppSigningKey");function B$(e){let{clientId:t,clientSecret:r}=e.config;return t&&r?iq({clientId:t,clientSecret:r}):sq()}s(B$,"appNppSigningKeyFor");async function K$(e,t){let{privateKey:r,publicKeyJwk:o}=await B$(e),n=(await e.auth.getAccessToken([])).token,i=Wr(n),a=z$(t.appId,i),c=Lf(i);if(!a||!c)throw new Error(`Could not resolve appId/orgId from the access token for NPP provisioning. Claims present: ${Object.keys(i).join(", ")}`);let l=await Q$(e,t,o),d=globalThis.crypto.getRandomValues(new Uint32Array(1))[0],u=new Ms({edgeUrl:t.edgeUrl,accessToken:n,appId:a,clientId:t.clientId,jwkThumbprint:l,ed25519PrivateKey:r,...t.sequenceStore?{sequenceStore:t.sequenceStore}:{}},d),m=qn(e);return m!==void 0&&Qf(u,m),u}s(K$,"provisionNppPublisher");async function Q$(e,t,r){let o;try{o=(await e.send({method:"POST",path:t.kernelHasNoBaseUrl?`${t.baseUrl.replace(/\/+$/,"")}/v1/apps/dpop-keys`:"/v1/apps/dpop-keys",body:{publicKeyJwk:r,algorithm:"EdDSA"}})).jwkThumbprint}catch(n){F(n);let i=n instanceof Error?n.message:String(n);if(/already.?registered|already.?exists|ALREADY_EXISTS/i.test(i))o=await aq(r);else throw n}return o}s(Q$,"registerAppNppKey");async function V$(e,t){let r=await B$(e),o=e.config,n=qn(e),i=new vm({tokenUrl:Kf(o),clientId:o.clientId,...o.clientSecret!==void 0?{clientSecret:o.clientSecret}:{},...o.appId!==void 0?{appId:o.appId}:{},...o.env!==void 0?{env:o.env}:{},key:r,...n!==void 0?{refusal:s(p=>n.refusal(p),"refusal")}:{}}),a=await i.accessToken(),c=z$(t.appId,Wr(a));if(!c)throw new Error(`Could not resolve appId from the kernel frame door's access token. Claims present: ${Object.keys(Wr(a)).join(", ")}`);let l=await Q$(e,t,r.publicKeyJwk),d=typeof t.producerEpoch=="function"?await t.producerEpoch(l):t.producerEpoch,u=globalThis.crypto.getRandomValues(new Uint32Array(1))[0],m=new Ms({edgeUrl:t.frameDoorUrl,accessToken:s(()=>i.accessToken(),"accessToken"),appId:c,clientId:t.clientId,jwkThumbprint:l,ed25519PrivateKey:r.privateKey,sequenceStore:t.sequenceStore??new Ls,...t.fetchImpl?{fetchImpl:t.fetchImpl}:{},kernel:{readChannel:t.readChannel,producerEpoch:d,credential:i}},u);return n!==void 0&&Qf(m,n),m}s(V$,"provisionKernelDoorPublisher");var Yae=Date.UTC(2025,0,1);async function aq(e){return Nc(e)}s(aq,"rfc7638Thumbprint");vl();var Lo=require("crypto"),he=require("fs"),vS=require("os"),No=require("path");El();function cq(){return(0,No.join)(process.env.NPAYLOAD_AUTH_HOME??(0,No.join)((0,vS.homedir)(),".npayload"),"npp","producer-sequence")}s(cq,"cliNppSequenceDir");var H$=3e4,lq=10*6e4,dq=1e4,Z$=new Set(["EACCES","EPERM","EROFS","ENOTDIR"]),W$=!1,wm=class{constructor(t=cq()){this.dir=t}static{s(this,"FileNppSequenceStore")}async exclusive(t,r){let o=(0,No.join)(this.dir,(0,Lo.createHash)("sha256").update(Ns(t)).digest("hex")),n=`${o}.json`,i;try{(0,he.mkdirSync)(this.dir,{recursive:!0,mode:448}),i=await Y$(`${o}.lock`)}catch(a){if(!Z$.has(ms(a)??""))throw a;return W$||(W$=!0,process.stderr.write(`np: cannot write the NPP producer-sequence store at ${this.dir} (${ms(a)}); the producer sequence is kept for this process only, so a later np process on this credential may be refused REJECTED_DUPLICATE on the same channel. Set NPAYLOAD_AUTH_HOME to a writable directory.
|
|
828
|
+
`)),Xo.exclusive(t,r)}try{return await r({load:s(async()=>uq(n),"load"),save:s(async a=>pq(n,t.channelGid,a),"save")})}finally{i()}}};function ms(e){return e&&typeof e=="object"&&"code"in e?String(e.code):void 0}s(ms,"errCode");function uq(e){let t;try{t=(0,he.readFileSync)(e,"utf8")}catch(r){if(ms(r)==="ENOENT")return{lastAccepted:0n};throw r}try{let r=JSON.parse(t);if(r.v===1&&typeof r.lastAccepted=="string"&&/^\d+$/.test(r.lastAccepted)){let o=BigInt(r.lastAccepted),n=typeof r.inFlight=="string"&&/^\d+$/.test(r.inFlight)?BigInt(r.inFlight):void 0;return n===o+1n?{lastAccepted:o,inFlight:n}:{lastAccepted:o}}}catch{}return{lastAccepted:0n}}s(uq,"readState");function pq(e,t,r){let o={v:1,channelGid:t,lastAccepted:r.lastAccepted.toString(),...r.inFlight!==void 0?{inFlight:r.inFlight.toString()}:{}},n=`${e}.${process.pid}.${(0,Lo.randomBytes)(4).toString("hex")}.tmp`;(0,he.writeFileSync)(n,`${JSON.stringify(o)}
|
|
829
|
+
`,{mode:384}),(0,he.renameSync)(n,e)}s(pq,"writeState");function bm(e){try{let t=JSON.parse((0,he.readFileSync)(e,"utf8"));return typeof t.pid=="number"&&typeof t.token=="string"&&typeof t.at=="number"?{pid:t.pid,token:t.token,at:t.at}:void 0}catch{return}}s(bm,"readHolder");function mq(e){try{return process.kill(e,0),!0}catch(t){return ms(t)==="EPERM"}}s(mq,"processAlive");function fq(e){let t=bm(e);if(t)return{stale:!mq(t.pid)||Date.now()-t.at>lq,token:t.token};try{return{stale:Date.now()-(0,he.statSync)(e).mtimeMs>dq,token:void 0}}catch{return{stale:!1,token:void 0}}}s(fq,"staleHold");async function Y$(e){let t=`${process.pid}.${(0,Lo.randomBytes)(8).toString("hex")}`,r=Date.now()+H$;for(;;){try{let n=(0,he.openSync)(e,"wx",384);try{(0,he.writeSync)(n,JSON.stringify({pid:process.pid,token:t,at:Date.now()}))}finally{(0,he.closeSync)(n)}return()=>{try{bm(e)?.token===t&&(0,he.unlinkSync)(e)}catch{}}}catch(n){if(ms(n)!=="EEXIST")throw n}let o=fq(e);if(o.stale){try{bm(e)?.token===o.token&&(0,he.unlinkSync)(e)}catch{}continue}if(Date.now()>r){let n=bm(e);throw new Error(`np: another npayload process${n?` (pid ${n.pid})`:""} has held this channel's NPP producer sequence for over ${H$/1e3} s (${e}); retry when it finishes.`)}await new Promise(n=>setTimeout(n,5+Math.floor(Math.random()*20)))}}s(Y$,"acquireHold");function gq(){return(0,No.join)(process.env.NPAYLOAD_AUTH_HOME??(0,No.join)((0,vS.homedir)(),".npayload"),"npp","producer-epoch")}s(gq,"cliNppEpochDir");var hq=Date.UTC(2025,0,1),J$=2147483647,yS=new Map;function yq(e){try{let t=JSON.parse((0,he.readFileSync)(e,"utf8"));return t.v===1&&typeof t.lastDrawn=="number"&&Number.isInteger(t.lastDrawn)&&t.lastDrawn>=0?t.lastDrawn:-1}catch{return-1}}s(yq,"readEpoch");function vq(e,t){let r=`${e}.${process.pid}.${(0,Lo.randomBytes)(4).toString("hex")}.tmp`;(0,he.writeFileSync)(r,`${JSON.stringify({v:1,lastDrawn:t})}
|
|
830
|
+
`,{mode:384}),(0,he.renameSync)(r,e)}s(vq,"writeEpoch");async function X$(e,t={}){let r=Math.floor(((t.nowMs??Date.now())-hq)/1e3),o=Math.max(r,(yS.get(e)??-1)+1),n=t.dir??gq(),i=(0,No.join)(n,(0,Lo.createHash)("sha256").update(e).digest("hex")),a;try{(0,he.mkdirSync)(n,{recursive:!0,mode:448}),a=await Y$(`${i}.lock`)}catch(c){if(!Z$.has(ms(c)??""))throw c;let l=Math.min(J$,Math.max(0,o));return yS.set(e,l),l}try{let c=Math.min(J$,Math.max(0,o,yq(`${i}.json`)+1));return vq(`${i}.json`,c),yS.set(e,c),c}finally{a()}}s(X$,"drawCliProducerEpoch");var oce=require("fs"),bq=K(require("tls")),eC=require("undici");Ke();function tC(e){return!1}s(tC,"twinNamesKernelFrameDoor");function nC(e,t){if(!t.edgeUrl)throw new Z("NPP transport selected but not configured: no NPP door is named"+(t.refusal?`: ${t.refusal}`:". Set NPAYLOAD_EDGE_URL.")+" Or opt into HTTP/JSON explicitly with --transport http or NPAYLOAD_TRANSPORT=http.");let r=t.named?"NPAYLOAD_EDGE_URL":"the production edge";return{url:t.edgeUrl,source:r}}s(nC,"resolveCliKernelFrameDoor");re();var Iq={};async function km(e){let t=process.env.NPAYLOAD_CLIENT_ID,r=(process.env.NPAYLOAD_CLIENT_SECRET??process.env.NPAYLOAD_HMAC_SECRET)?.trim()||void 0,o;if(!t)try{let l=await Bn();t=l.clientId,r=r??l.hmacSecret,o=l.dpopPrivateJwk}catch(l){if(l instanceof fr)throw l}if(!t)throw new fr("Not authenticated. Run `np login` (alias `npayload login`; device flow, stores the session in the OS keychain), or export NPAYLOAD_CLIENT_ID + NPAYLOAD_HMAC_SECRET.");let{apiUrl:n,authUrl:i,guard:a}=so(),c=bi({env:process.env,credentialKey:o})??(await Do()).privateJwk;return si({clientId:t,dpopPrivateJwk:c,baseUrl:n,...r!==void 0?{clientSecret:r}:{},...i!==void 0?{authUrl:i}:{},...e?{env:e}:{}},a)}s(km,"resolveKernel");var wq={async text(e,t){let{input:r}=await import("@inquirer/prompts");return(await r({message:e,validate:s(o=>t.optional||o.trim()!==""||"required \u2014 enter a value","validate")})).trim()},async secret(e,t){let{password:r}=await import("@inquirer/prompts");return(await r({message:e,mask:!0,validate:s(o=>t.optional||o.trim()!==""||"required \u2014 enter a value","validate")})).trim()},async select(e,t){let{select:r}=await import("@inquirer/prompts");return r({message:e,choices:t})}};async function bS(e){if(!process.stdin.isTTY)return process.stderr.write(`${e}
|
|
831
|
+
Refusing a destructive op without a TTY; pass --yes to proceed.
|
|
832
|
+
`),!1;let{createInterface:t}=await import("readline/promises"),r=t({input:process.stdin,output:process.stderr});try{let o=await r.question(`${e} [y/N] `);return/^y(es)?$/i.test(o.trim())}finally{r.close()}}s(bS,"ttyConfirm");function kq(e){let t=xI(e),r={code:"NPP_PUBLISH_REJECTED",status:e.httpStatus};switch(wl(e.statusName??ei(e.statusCode))){case"auth":return new ze(t,r);case"deferred":return e.httpStatus===429?new Go(t,r):new Uo(t,r);case"protocol":return new Xr(t,Me.BULK_ACK,{status:e.httpStatus});default:return new dn(t,r)}}s(kq,"nppRejectionError");async function sC(e={}){let t=new rC.Command;t.name("np").description("npayload CLI \u2014 contract-generated Events surface"),t.addHelpText("after",`
|
|
833
|
+
np --version print the npayload package version
|
|
834
|
+
np --build print the contract build hash
|
|
835
|
+
`+CI+`
|
|
836
|
+
Docs: ${LI}
|
|
837
|
+
`);let r=s(w=>{let T=(w??process.argv)[2];return T==="--version"||T==="--build"?T:void 0},"rootOnlyFlag"),o=t.parseAsync.bind(t);t.parseAsync=(async(w,T)=>{let q=r(w);return q==="--version"?(process.stdout.write(`${zn()}
|
|
838
|
+
`),t):q==="--build"?(process.stdout.write(`${ye.contentHash.slice(0,12)}
|
|
839
|
+
`),t):o(w,T)}),t.option("-y, --yes","skip confirmation prompts for destructive operations"),t.option("--transport <transport>",'transport for data-plane publish/subscribe: "npp" (default) or "http"'),t.option("--env <slug>","target logical environment for env-scoped commands (overrides `np env use`)"),hx(t),g_(t),v_(t),M_(t),F_(t),B_(t,{resolveKernel:Nh,resolveChannelGid:s((w,T,q)=>Lh(w,T,q),"resolveChannelGid")}),ph(t,{sendAccount:s(async w=>(await c(w)).send(w),"sendAccount")}),Z_(t),oR(t,{print:e.print??(w=>void process.stdout.write(`${String(w)}
|
|
840
|
+
`)),printError:e.printError??(w=>void process.stderr.write(`${w}
|
|
841
|
+
`))}),X_(t,{print:e.print??(w=>{process.stdout.write(`${JSON.stringify(w,null,2)}
|
|
842
|
+
`)}),printError:e.printError??(w=>{process.stderr.write(`${w}
|
|
843
|
+
`)}),...e.readSecret?{readSecret:e.readSecret}:{},confirm:e.confirm??bS}),UO(t),t$(t),e$(t),WO(t),WE(t),jE(t),c$(t),$$(t),v$(t,{fetchAccountStatus:s(async()=>{try{let w={method:"GET",path:"/v1/billing/account-status",scope:"billing:read"},q=await(await c(w)).send(w);return q&&typeof q.tier=="string"?q:null}catch(w){return F(w),null}},"fetchAccountStatus")});let n=s(w=>{if(w.path.startsWith("/v1/primus/")){let T=te(process.env.NPAYLOAD_PRIMUS_API_URL,"primusApiUrl");if(T)return{lane:"primus",url:T}}if(w.path.startsWith("/v1/account/")){let T=te(process.env.NPAYLOAD_ACCOUNT_API_URL,"accountApiUrl");if(T)return{lane:"account",url:T}}if(w.path.startsWith("/v1/analytics/")){let T=te(process.env.NPAYLOAD_ADMIN_API_URL,"adminApiUrl");if(T)return{lane:"analytics",url:T}}return{lane:"cell"}},"laneOf"),i=s(()=>{let w=t.opts().env;return hr(typeof w=="string"&&w.trim()!==""?{explicitSlug:w}:{})},"resolveDispatchEnvSlug"),a=q$({laneOf:n,resolveEnvSlug:i,build:s(async(w,T)=>{if(w){let{buildKernel:q}=await Promise.resolve().then(()=>(qe(),ba));return q(w,T)}return km(T)},"build")}),c=s(w=>a.getKernelFor(w),"getKernelFor");eR(t,{print:e.print??(w=>{process.stdout.write(`${JSON.stringify(w,null,2)}
|
|
844
|
+
`)}),printError:e.printError??(w=>{process.stderr.write(`${w}
|
|
845
|
+
`)}),credential:s(async()=>{let w=process.env.NPAYLOAD_CLIENT_ID;if(w)return{clientId:w,source:"env"};let T=await Bn();return{clientId:T.clientId,source:T.source}},"credential"),token:s(async()=>(await km(i())).auth.getAccessToken([]),"token")}),m$(t,{resolveKernel:s(async()=>km(i()),"resolveKernel"),mintedEnvSlug:s(()=>i(),"mintedEnvSlug"),yes:s(()=>t.opts().yes===!0,"yes"),tail:s(async(w,T)=>nS(w,T),"tail"),confirm:s(async w=>e.confirm?e.confirm(w):bS(w),"confirm")}),f$(t,{resolveKernel:s(async()=>km(i()),"resolveKernel"),mintedEnvSlug:s(()=>i(),"mintedEnvSlug")});let l=s(()=>{let w=t.opts().transport;if(w==="http"||w==="npp")return w;if(w!==void 0)throw new Y(`--transport must be "npp" or "http", got "${w}"`);return process.env.NPAYLOAD_TRANSPORT==="http"?"http":"npp"},"resolveCliTransport"),d=/^\/v1\/channels\/\{channelId\}\/messages$/,u=/^\/v1\/channels\/\{channelId\}\/subscribe$/,m=new Set(["payload","qosLevel"]),p=new WeakMap,f=s(w=>{let T=eo(w);return TT(process.env.NPAYLOAD_EDGE_URL,qn(w),[zI(w),`${T.replace(/\/+$/,"")}/v1/apps/dpop-keys`])},"nppEdgeOf"),g=s(w=>new Z("NPP transport selected but not configured"+(w?`: ${w}`:". Set NPAYLOAD_EDGE_URL.")+" Or opt into HTTP/JSON explicitly with --transport http or NPAYLOAD_TRANSPORT=http."),"nppNotConfigured"),h=s(w=>{let{edgeUrl:T,refusal:q}=f(w);if(!T)throw g(q);let H=eo(w),ne=p.get(w);return ne||(ne=K$(w,{baseUrl:H,edgeUrl:T,clientId:process.env.NPAYLOAD_CLIENT_ID??"",appId:process.env.NPAYLOAD_APP_ID,sequenceStore:new wm}),p.set(w,ne)),ne},"getNppPublisher"),y=new Map,v=s((w,T)=>w.send({method:"GET",path:"/v1/channels/{channelId}",pathParams:{channelId:T}}),"readChannelAnswer"),S=new Map,k=new WeakMap,R=s(()=>te(process.env.NPAYLOAD_API_URL,"apiUrl","https://api.npayload.com"),"cliApiUrl"),I=s((w,T)=>{let q=k.get(w);if(!q){let H=R(),ne=nC(H,T);q=V$(w,{baseUrl:H,frameDoorUrl:ne.url,clientId:process.env.NPAYLOAD_CLIENT_ID??"",appId:process.env.NPAYLOAD_APP_ID,readChannel:s(async fe=>{if(S.has(fe)){let Ac=S.get(fe);return S.delete(fe),Ac}return v(w,fe)},"readChannel"),producerEpoch:s(fe=>X$(fe),"producerEpoch"),...ne.fetchImpl?{fetchImpl:ne.fetchImpl}:{}}),k.set(w,q)}return q},"getKernelDoorPublisher"),x=s(async(w,T,q)=>{let H=y.get(T);if(!H){H=v(w,T).catch(()=>{}),y.set(T,H);let ne=await H;Df(ne)&&S.set(T,ne)}if(Df(await H))return I(w,q)},"kernelDoorPublisherFor"),_=s(async w=>{let T=await c(w);if(l()==="npp"){let H=w.body??{};if(w.method==="POST"&&d.test(w.path)){if("payload"in H&&w.idempotencyKeySupplied!==!0&&Object.keys(H).every(fe=>m.has(fe)||H[fe]===void 0)){let fe=f(T);if(!fe.edgeUrl&&!tC(R()))throw g(fe.refusal);let qr=await(await x(T,w.pathParams.channelId,fe)??await h(T)).publish(w.pathParams.channelId,H.payload,{...H.qosLevel!==void 0?{qosLevel:H.qosLevel}:{}});if(!qr.accepted)throw kq(qr);return gS({gid:qr.gid,status:"accepted",statusCode:qr.statusCode,statusName:qr.statusName,sequence:qr.sequence,httpStatus:qr.httpStatus,transport:"npp"})}}else if(w.method==="POST"&&u.test(w.path)){let ne=await h(T),fe=typeof H.consumerId=="string"&&H.consumerId||`consumer-${w.pathParams.channelId}`;return ne.subscribe(w.pathParams.channelId,{consumerId:fe,...typeof H.mode=="number"?{mode:H.mode}:{},...typeof H.deliveryPreference=="number"?{deliveryPreference:H.deliveryPreference}:{}})}}let q=await T.send(w);return w.method==="POST"&&d.test(w.path)?gS(q):q},"sendViaTransport");M$(t,{send:_,newIdempotencyKey:s(()=>globalThis.crypto.randomUUID(),"newIdempotencyKey"),print:e.print??(w=>{process.stdout.write(`${JSON.stringify(w,null,2)}
|
|
846
|
+
`)}),printError:e.printError??(w=>{process.stderr.write(`${w}
|
|
847
|
+
`)}),rows:s(async()=>{let w=s((q,H)=>{let ne=q.find(fe=>fe.key===H);if(!ne)throw new Error(`np logs: the command table carries no ${H}`);return ne},"row"),T=(await ui()).commands;return{primusErrors:w(T,"primus.observability.getErrors"),pipesList:w(ye.commands,"pipes.workflows.listWorkflows"),pipeRuns:w(ye.commands,"pipes.executions.listExecutions")}},"rows")}),D$(t,()=>({send:s(async w=>(await c(w)).send(w),"send"),print:e.print??(w=>{process.stdout.write(`${JSON.stringify(w,null,2)}
|
|
848
|
+
`)}),printError:e.printError??(w=>{process.stderr.write(`${w}
|
|
849
|
+
`)}),exit:s(w=>{process.exitCode=w},"exit")}));let U=await ui(),A=new Set(ye.commands.map(w=>w.commandPath[0])),D=[...new Set(U.commands.map(w=>w.commandPath[0]))].filter(w=>A.has(w));if(D.length>0)throw new Error(`CLI namespace collision between cell and primus command tables: ${D.join(", ")}`);let M=[...ye.commands,...U.commands,...Xl(),...ed()],V=s(async w=>t.opts().yes===!0?!0:e.confirm?e.confirm(w):bS(w),"confirmDestructive");JI(t,M,{send:_,newIdempotencyKey:s(()=>globalThis.crypto.randomUUID(),"newIdempotencyKey"),print:e.print??(w=>{process.stdout.write(`${JSON.stringify(w,null,2)}
|
|
850
|
+
`)}),printError:e.printError??(w=>{process.stderr.write(`${w}
|
|
851
|
+
`)}),exit:s(w=>{process.exitCode=w},"exit"),prompt:e.prompt??wq,...e.prompt?{}:{isInteractive:ft},confirm:V,whereAmI:s(async w=>{let T=w!==void 0?await c(w).catch(()=>{}):void 0,q=so(),H=(T!==void 0?eo(T):void 0)??q.apiUrl,ne=(T!==void 0?qn(T):void 0)??q.guard;return KI(H,ne)},"whereAmI")}),a$(t,{send:_,newIdempotencyKey:s(()=>globalThis.crypto.randomUUID(),"newIdempotencyKey"),print:e.print??(w=>{process.stdout.write(`${JSON.stringify(w,null,2)}
|
|
852
|
+
`)}),printError:e.printError??(w=>{process.stderr.write(`${w}
|
|
853
|
+
`)}),confirm:V,rows:s(async()=>{let w=s((H,ne)=>{let fe=H.find(Ac=>Ac.key===ne);if(!fe)throw new Error(`np webhooks: the command table carries no ${ne}`);return fe},"row"),T=(await ui()).commands,q=ye.commands;return{list:w(q,"webhooks.webhooks.list"),create:w(q,"webhooks.webhooks.create"),rotateSecret:w(q,"webhooks.webhooks.rotateSecret"),revoke:w(q,"webhooks.webhooks.revoke"),channelGet:w(q,"events.channels.get"),triggersList:w(T,"primus.triggers.list"),triggersCreate:w(T,"primus.triggers.create"),triggersRemove:w(T,"primus.triggers.remove"),agentsList:w(T,"primus.agents.list")}},"rows")});let J=t.commands.find(w=>w.name()==="primus")??t.command("primus");return R$(J),Xf(t),t}s(sC,"buildProgram");async function Eq(){await(await sC()).parseAsync(process.argv)}s(Eq,"main");function Sq(){let e=process.argv[1];if(!e)return!1;try{return Iq.url===(0,iC.pathToFileURL)((0,oC.realpathSync)(e)).href}catch{return!1}}s(Sq,"invokedAsBinary");Sq()&&Eq().catch(e=>{process.stderr.write(`${Ce(e instanceof Error?e.message:String(e),e)}
|
|
854
|
+
`),process.exitCode=1});0&&(module.exports={buildProgram});
|