viberoom 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/NOTICE +12 -0
  2. package/README.md +119 -96
  3. package/dist/hub.js +18 -0
  4. package/dist/launcher.js +22 -0
  5. package/dist/main.js +4 -3
  6. package/dist/persona.js +2 -2
  7. package/dist/recipes.js +37 -14
  8. package/dist/room.js +3 -2
  9. package/dist/server.js +16 -3
  10. package/package.json +8 -5
  11. package/scripts/vendor-acp.mjs +85 -0
  12. package/ui/app.css +7 -0
  13. package/ui/app.js +116 -26
  14. package/ui/index.html +2 -0
  15. package/vendor/acp/claude-agent-acp/LICENSE +191 -0
  16. package/vendor/acp/claude-agent-acp/dist/acp-agent.js +7694 -0
  17. package/vendor/acp/claude-agent-acp/dist/acp-subagents.js +13 -0
  18. package/vendor/acp/claude-agent-acp/dist/air-extension.js +63 -0
  19. package/vendor/acp/claude-agent-acp/dist/async-tasks.js +613 -0
  20. package/vendor/acp/claude-agent-acp/dist/clear-context-coordinator.js +80 -0
  21. package/vendor/acp/claude-agent-acp/dist/elicitation.js +304 -0
  22. package/vendor/acp/claude-agent-acp/dist/exit-plan.js +154 -0
  23. package/vendor/acp/claude-agent-acp/dist/file-change-audit.js +350 -0
  24. package/vendor/acp/claude-agent-acp/dist/fork-session.js +41 -0
  25. package/vendor/acp/claude-agent-acp/dist/goal-extension.js +50 -0
  26. package/vendor/acp/claude-agent-acp/dist/index.js +98 -0
  27. package/vendor/acp/claude-agent-acp/dist/lib.js +5 -0
  28. package/vendor/acp/claude-agent-acp/dist/native-subagents.js +422 -0
  29. package/vendor/acp/claude-agent-acp/dist/permissions/effects.js +166 -0
  30. package/vendor/acp/claude-agent-acp/dist/permissions/modes.js +41 -0
  31. package/vendor/acp/claude-agent-acp/dist/permissions/normalization.js +100 -0
  32. package/vendor/acp/claude-agent-acp/dist/permissions/options/filesystem.js +124 -0
  33. package/vendor/acp/claude-agent-acp/dist/permissions/options/shared.js +64 -0
  34. package/vendor/acp/claude-agent-acp/dist/permissions/options/shell.js +100 -0
  35. package/vendor/acp/claude-agent-acp/dist/permissions/options/tools.js +135 -0
  36. package/vendor/acp/claude-agent-acp/dist/permissions/options.js +60 -0
  37. package/vendor/acp/claude-agent-acp/dist/permissions/presentation.js +83 -0
  38. package/vendor/acp/claude-agent-acp/dist/permissions/response.js +19 -0
  39. package/vendor/acp/claude-agent-acp/dist/session-config-ids.js +4 -0
  40. package/vendor/acp/claude-agent-acp/dist/session-failure-extension.js +324 -0
  41. package/vendor/acp/claude-agent-acp/dist/session-mode.js +234 -0
  42. package/vendor/acp/claude-agent-acp/dist/session-titles.js +199 -0
  43. package/vendor/acp/claude-agent-acp/dist/settings.js +185 -0
  44. package/vendor/acp/claude-agent-acp/dist/tool-result-meta.js +19 -0
  45. package/vendor/acp/claude-agent-acp/dist/tools.js +1235 -0
  46. package/vendor/acp/claude-agent-acp/dist/utils.js +81 -0
  47. package/vendor/acp/claude-agent-acp/package.json +7 -0
  48. package/vendor/acp/claude-agent-sdk/LICENSE.md +1 -0
  49. package/vendor/acp/claude-agent-sdk/agentSdkTypes.d.ts +1 -0
  50. package/vendor/acp/claude-agent-sdk/bridge.d.ts +378 -0
  51. package/vendor/acp/claude-agent-sdk/bridge.mjs +221 -0
  52. package/vendor/acp/claude-agent-sdk/browser-sdk.d.ts +107 -0
  53. package/vendor/acp/claude-agent-sdk/browser-sdk.js +185 -0
  54. package/vendor/acp/claude-agent-sdk/extractFromBunfs.d.ts +1 -0
  55. package/vendor/acp/claude-agent-sdk/extractFromBunfs.js +156 -0
  56. package/vendor/acp/claude-agent-sdk/manifest.json +65 -0
  57. package/vendor/acp/claude-agent-sdk/manifest.zst.json +73 -0
  58. package/vendor/acp/claude-agent-sdk/package.json +7 -0
  59. package/vendor/acp/claude-agent-sdk/sdk-tools.d.ts +4129 -0
  60. package/vendor/acp/claude-agent-sdk/sdk.d.ts +8687 -0
  61. package/vendor/acp/claude-agent-sdk/sdk.mjs +204 -0
  62. package/vendor/acp/codex-acp/LICENSE +190 -0
  63. package/vendor/acp/codex-acp/dist/index.js +34238 -0
  64. package/vendor/acp/codex-acp/package.json +7 -0
@@ -0,0 +1,204 @@
1
+ #!/usr/bin/env node
2
+ // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
3
+
4
+ // Version: 0.3.257
5
+
6
+ // Want to see the unminified source? We're hiring!
7
+ // https://job-boards.greenhouse.io/anthropic/jobs/4816199008
8
+ import{createRequire as $ne}from"node:module";var One=Object.create;var{getPrototypeOf:Pne,defineProperty:ZE,getOwnPropertyNames:Ine}=Object;var Dne=Object.prototype.hasOwnProperty;function Lne(e){return this[e]}var Nne,Mne,Wn=(e,t,n)=>{var r=e!=null&&typeof e==="object";if(r){var o=t?Nne??=new WeakMap:Mne??=new WeakMap,s=o.get(e);if(s)return s}n=e!=null?One(Pne(e)):{};let i=t||!e||!e.__esModule?ZE(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let a of Ine(e))if(!Dne.call(i,a))ZE(i,a,{get:Lne.bind(e,a),enumerable:!0})}if(r)o.set(e,i);return i};var T=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Une=(e)=>e;function Fne(e,t){this[e]=Une.bind(null,t)}var on=(e,t)=>{for(var n in t)ZE(e,n,{get:t[n],enumerable:!0,configurable:!0,set:Fne.bind(t,n)})};var O=(e,t)=>()=>(e&&(t=e(e=0)),t);var xe=$ne(import.meta.url),zne=Symbol.dispose||Symbol.for("Symbol.dispose"),jne=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),$t=(e,t,n)=>{if(t!=null){if(typeof t!=="object"&&typeof t!=="function")throw TypeError('Object expected to be assigned to "using" declaration');var r;if(n)r=t[jne];if(r===void 0)r=t[zne];if(typeof r!=="function")throw TypeError("Object not disposable");e.push([n,r,t])}else if(n)e.push([n]);return t},zt=(e,t,n)=>{var r=typeof SuppressedError==="function"?SuppressedError:function(i,a,c,l){return l=Error(c),l.name="SuppressedError",l.error=i,l.suppressed=a,l},o=(i)=>t=n?new r(i,t,"An error was suppressed during disposal"):(n=!0,i),s=(i)=>{while(i=e.pop())try{var a=i[1]&&i[1].call(i[2]);if(i[0])return Promise.resolve(a).then(s,(c)=>(o(c),s()))}catch(c){o(c)}if(n)throw t};return s()};var oN,tx;var nx=O(()=>{oN=globalThis.process?.getBuiltinModule?.("async_hooks"),tx=oN?(e)=>oN.AsyncResource.bind(e):(e)=>e});function Oe(e){if(!e)return!1;if(typeof e==="boolean")return e;let t=String(e).toLowerCase().trim();return["1","true","yes","on"].includes(t)}function la(e){if(e===void 0)return!1;if(typeof e==="boolean")return!e;let t=String(e).toLowerCase().trim();return["0","false","no","off"].includes(t)}function Tt(){let e=new Set;return{subscribe(t){let n=tx(t);return e.add(n),()=>{e.delete(n)}},emit(...t){let n;for(let r of e)try{r(...t)}catch(o){(n??=[]).push(o)}if(n)throw n.length===1?n[0]:AggregateError(n,"Signal listener(s) threw")},clear(){e.clear()}}}var sN=O(()=>{nx()});var iN=()=>{};var Zc=O(()=>{nx();sN();iN()});function N(e,t,n,r,o){if(r==="m")throw TypeError("Private method is not writable");if(r==="a"&&!o)throw TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!o:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?o.call(e,n):o?o.value=n:t.set(e,n),n}function b(e,t,n,r){if(n==="a"&&!r)throw TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!r:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)}var qn=()=>{};var cl=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return cl=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(r)=>(+r^n()&15>>+r/4).toString(16))};function Mr(e){return typeof e==="object"&&e!==null&&(("name"in e)&&e.name==="AbortError"||("message"in e)&&String(e.message).includes("FetchRequestCanceledException"))}var ma=(e)=>{if(e instanceof Error)return e;if(typeof e==="object"&&e!==null){try{if(Object.prototype.toString.call(e)==="[object Error]"){let t=Error(e.message,e.cause?{cause:e.cause}:{});if(e.stack)t.stack=e.stack;if(e.cause&&!t.cause)t.cause=e.cause;if(e.name)t.name=e.name;return t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)};var j,Lt,mn,bs,Zd,Ig,Yd,Jd,Xd,Qd,ep,tp,np,rp;var gt=O(()=>{j=class j extends Error{};Lt=class Lt extends j{constructor(e,t,n,r,o){super(`${Lt.makeMessage(e,t,n)}`);this.status=e,this.headers=r,this.requestID=r?.get("request-id"),this.error=t,this.type=o??null}static makeMessage(e,t,n){let r=t?.message?typeof t.message==="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;if(e&&r)return`${e} ${r}`;if(e)return`${e} status code (no body)`;if(r)return r;return"(no status code or body)"}static generate(e,t,n,r){if(!e||!r)return new bs({message:n,cause:ma(t)});let o=t,s=o?.error?.type;if(e===400)return new Yd(e,o,n,r,s);if(e===401)return new Jd(e,o,n,r,s);if(e===403)return new Xd(e,o,n,r,s);if(e===404)return new Qd(e,o,n,r,s);if(e===409)return new ep(e,o,n,r,s);if(e===422)return new tp(e,o,n,r,s);if(e===429)return new np(e,o,n,r,s);if(e>=500)return new rp(e,o,n,r,s);return new Lt(e,o,n,r,s)}};mn=class mn extends Lt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}};bs=class bs extends Lt{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0);if(t)this.cause=t}};Zd=class Zd extends bs{constructor({message:e}={}){super({message:e??"Request timed out."})}};Ig=class Ig extends j{constructor(e,{cause:t}={}){super(e??"Retryable error.");if(t!==void 0)this.cause=t}};Yd=class Yd extends Lt{};Jd=class Jd extends Lt{};Xd=class Xd extends Lt{};Qd=class Qd extends Lt{};ep=class ep extends Lt{};tp=class tp extends Lt{};np=class np extends Lt{};rp=class rp extends Lt{}});function op(e){if(typeof e!=="object")return{};return e??{}}function Tv(e){if(!e)return!0;for(let t in e)return!1;return!0}function WM(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var zce,GM=(e)=>zce.test(e),wn=(e)=>(wn=Array.isArray,wn(e)),Av,VM=(e,t)=>{if(typeof t!=="number"||!Number.isInteger(t))throw new j(`${e} must be an integer`);if(t<0)throw new j(`${e} must be a positive integer`);return t},sp=(e)=>{try{return JSON.parse(e)}catch(t){return}};var io=O(()=>{gt();zce=/^[a-z][a-z0-9+.-]*:/i,Av=wn});var ao=(e,t)=>new Promise((n)=>{if(t?.aborted)return n();let r=()=>{clearTimeout(o),n()},o=setTimeout(()=>{t?.removeEventListener("abort",r),n()},e);t?.addEventListener("abort",r,{once:!0})});var Ur="0.112.1";function jce(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}function Bce(){if(typeof navigator>"u"||!navigator)return null;let e=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:t,pattern:n}of e){let r=n.exec(navigator.userAgent);if(r){let o=r[1]||0,s=r[2]||0,i=r[3]||0;return{browser:t,version:`${o}.${s}.${i}`}}}return null}var JM=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",Hce=()=>{let e=jce();if(e==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ur,"X-Stainless-OS":ZM(Deno.build.os),"X-Stainless-Arch":qM(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ur,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(e==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ur,"X-Stainless-OS":ZM(globalThis.process.platform??"unknown"),"X-Stainless-Arch":qM(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let t=Bce();if(t)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ur,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ur,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},qM=(e)=>{if(e==="x32")return"x32";if(e==="x86_64"||e==="x64")return"x64";if(e==="arm")return"arm";if(e==="aarch64"||e==="arm64")return"arm64";if(e)return`other:${e}`;return"unknown"},ZM=(e)=>{if(e=e.toLowerCase(),e.includes("ios"))return"iOS";if(e==="android")return"Android";if(e==="darwin")return"MacOS";if(e==="win32")return"Windows";if(e==="freebsd")return"FreeBSD";if(e==="openbsd")return"OpenBSD";if(e==="linux")return"Linux";if(e)return`Other:${e}`;return"Unknown"},YM,ip=()=>YM??(YM=Hce());var Dg=()=>{};function XM(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Cv(...e){let t=globalThis.ReadableStream;if(typeof t>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function Lg(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return Cv({start(){},async pull(n){let{done:r,value:o}=await t.next();if(r)n.close();else n.enqueue(o)},async cancel(){await t.return?.()}})}function ap(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let n=await t.read();if(n?.done)t.releaseLock();return n}catch(n){throw t.releaseLock(),n}},async return(){let n=t.cancel();return t.releaseLock(),await n,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function QM(e){if(e===null||typeof e!=="object")return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}var eU=({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});var kv="RFC3986",Rv=(e)=>String(e),Ov,tU="RFC1738";var Pv=O(()=>{Ov={RFC1738:(e)=>String(e).replace(/%20/g,"+"),RFC3986:Rv}});function rU(e){if(!e||typeof e!=="object")return!1;return!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function Dv(e,t){if(wn(e)){let n=[];for(let r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)}var Ng=(e,t)=>(Ng=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Ng(e,t)),Zo,Iv=1024,nU=(e,t,n,r,o)=>{if(e.length===0)return e;let s=e;if(typeof e==="symbol")s=Symbol.prototype.toString.call(e);else if(typeof e!=="string")s=String(e);if(n==="iso-8859-1")return escape(s).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let i="";for(let a=0;a<s.length;a+=Iv){let c=s.length>=Iv?s.slice(a,a+Iv):s,l=[];for(let u=0;u<c.length;++u){let p=c.charCodeAt(u);if(p===45||p===46||p===95||p===126||p>=48&&p<=57||p>=65&&p<=90||p>=97&&p<=122||o===tU&&(p===40||p===41)){l[l.length]=c.charAt(u);continue}if(p<128){l[l.length]=Zo[p];continue}if(p<2048){l[l.length]=Zo[192|p>>6]+Zo[128|p&63];continue}if(p<55296||p>=57344){l[l.length]=Zo[224|p>>12]+Zo[128|p>>6&63]+Zo[128|p&63];continue}u+=1,p=65536+((p&1023)<<10|c.charCodeAt(u)&1023),l[l.length]=Zo[240|p>>18]+Zo[128|p>>12&63]+Zo[128|p>>6&63]+Zo[128|p&63]}i+=l.join("")}return i};var oU=O(()=>{Pv();io();Zo=(()=>{let e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})()});function Wce(e){return typeof e==="string"||typeof e==="number"||typeof e==="boolean"||typeof e==="symbol"||typeof e==="bigint"}function cU(e,t,n,r,o,s,i,a,c,l,u,p,f,m,h,y,_,E){let S=e,x=E,v=0,w=!1;while((x=x.get(Lv))!==void 0&&!w){let ne=x.get(e);if(v+=1,typeof ne<"u")if(ne===v)throw RangeError("Cyclic object value");else w=!0;if(typeof x.get(Lv)>"u")v=0}if(typeof l==="function")S=l(t,S);else if(S instanceof Date)S=f?.(S);else if(n==="comma"&&wn(S))S=Dv(S,function(ne){if(ne instanceof Date)return f?.(ne);return ne});if(S===null){if(s)return c&&!y?c(t,Yt.encoder,_,"key",m):t;S=""}if(Wce(S)||rU(S)){if(c){let ne=y?t:c(t,Yt.encoder,_,"key",m);return[h?.(ne)+"="+h?.(c(S,Yt.encoder,_,"value",m))]}return[h?.(t)+"="+h?.(String(S))]}let U=[];if(typeof S>"u")return U;let L;if(n==="comma"&&wn(S)){if(y&&c)S=Dv(S,c);L=[{value:S.length>0?S.join(",")||null:void 0}]}else if(wn(l))L=l;else{let ne=Object.keys(S);L=u?ne.sort(u):ne}let F=a?String(t).replace(/\./g,"%2E"):String(t),K=r&&wn(S)&&S.length===1?F+"[]":F;if(o&&wn(S)&&S.length===0)return K+"[]";for(let ne=0;ne<L.length;++ne){let se=L[ne],X=typeof se==="object"&&typeof se.value<"u"?se.value:S[se];if(i&&X===null)continue;let re=p&&a?se.replace(/\./g,"%2E"):se,Ie=wn(S)?typeof n==="function"?n(K,re):K:K+(p?"."+re:"["+re+"]");E.set(e,v);let yt=new WeakMap;yt.set(Lv,E),aU(U,cU(X,Ie,n,r,o,s,i,a,n==="comma"&&y&&wn(S)?null:c,l,u,p,f,m,h,y,_,yt))}return U}function Vce(e=Yt){if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!=="boolean")throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!=="boolean")throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!=="function")throw TypeError("Encoder has to be a function.");let t=e.charset||Yt.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=kv;if(typeof e.format<"u"){if(!Ng(Ov,e.format))throw TypeError("Unknown format option provided.");n=e.format}let r=Ov[n],o=Yt.filter;if(typeof e.filter==="function"||wn(e.filter))o=e.filter;let s;if(e.arrayFormat&&e.arrayFormat in iU)s=e.arrayFormat;else if("indices"in e)s=e.indices?"indices":"repeat";else s=Yt.arrayFormat;if("commaRoundTrip"in e&&typeof e.commaRoundTrip!=="boolean")throw TypeError("`commaRoundTrip` must be a boolean, or absent");let i=typeof e.allowDots>"u"?!!e.encodeDotInKeys===!0?!0:Yt.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix==="boolean"?e.addQueryPrefix:Yt.addQueryPrefix,allowDots:i,allowEmptyArrays:typeof e.allowEmptyArrays==="boolean"?!!e.allowEmptyArrays:Yt.allowEmptyArrays,arrayFormat:s,charset:t,charsetSentinel:typeof e.charsetSentinel==="boolean"?e.charsetSentinel:Yt.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?Yt.delimiter:e.delimiter,encode:typeof e.encode==="boolean"?e.encode:Yt.encode,encodeDotInKeys:typeof e.encodeDotInKeys==="boolean"?e.encodeDotInKeys:Yt.encodeDotInKeys,encoder:typeof e.encoder==="function"?e.encoder:Yt.encoder,encodeValuesOnly:typeof e.encodeValuesOnly==="boolean"?e.encodeValuesOnly:Yt.encodeValuesOnly,filter:o,format:n,formatter:r,serializeDate:typeof e.serializeDate==="function"?e.serializeDate:Yt.serializeDate,skipNulls:typeof e.skipNulls==="boolean"?e.skipNulls:Yt.skipNulls,sort:typeof e.sort==="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling==="boolean"?e.strictNullHandling:Yt.strictNullHandling}}function lU(e,t={}){let n=e,r=Vce(t),o,s;if(typeof r.filter==="function")s=r.filter,n=s("",n);else if(wn(r.filter))s=r.filter,o=s;let i=[];if(typeof n!=="object"||n===null)return"";let a=iU[r.arrayFormat],c=a==="comma"&&r.commaRoundTrip;if(!o)o=Object.keys(n);if(r.sort)o.sort(r.sort);let l=new WeakMap;for(let f=0;f<o.length;++f){let m=o[f];if(r.skipNulls&&n[m]===null)continue;aU(i,cU(n[m],m,a,c,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}let u=i.join(r.delimiter),p=r.addQueryPrefix===!0?"?":"";if(r.charsetSentinel)if(r.charset==="iso-8859-1")p+="utf8=%26%2310003%3B&";else p+="utf8=%E2%9C%93&";return u.length>0?p+u:""}var iU,aU=function(e,t){Array.prototype.push.apply(e,wn(t)?t:[t])},sU,Yt,Lv;var uU=O(()=>{oU();Pv();io();iU={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,t){return String(e)+"["+t+"]"},repeat(e){return String(e)}},Yt={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:nU,encodeValuesOnly:!1,format:kv,formatter:Rv,indices:!1,serializeDate(e){return(sU??(sU=Function.prototype.call.bind(Date.prototype.toISOString)))(e)},skipNulls:!1,strictNullHandling:!1};Lv={}});function dU(e){return lU(e,{arrayFormat:"brackets"})}var Nv=O(()=>{uU()});function Ug(e){if(!e)return;let t;try{t=new URL(e)}catch(r){throw new rt(`Invalid token endpoint base URL "${e}": ${r}`)}if(t.protocol==="https:")return;let n=t.hostname.toLowerCase().replace(/^\[|\]$/g,"");if(t.protocol==="http:"&&(n==="localhost"||n==="127.0.0.1"||n==="::1"))return;throw new rt(`Refusing to send credential over non-https token endpoint "${e}"`)}async function Fg(e,t){let n=await Yce(e),r;try{r=JSON.parse(n)}catch{throw new rt(`Token endpoint returned non-JSON response (status ${e.status})`,e.status,Zn(n),t)}if(!r.access_token)throw new rt(`Token endpoint response missing access_token: ${JSON.stringify(Zn(r))}`,e.status,Zn(r),t);if(r.token_type&&r.token_type.toLowerCase()!=="bearer")throw new rt(`Token endpoint response: unsupported token_type "${r.token_type}" (want Bearer)`,e.status,Zn(r),t);return r}function Zn(e){if(e==null)return e;if(typeof e==="string"){let t;try{t=JSON.parse(e)}catch{if(e.length<=Mv)return e;return e.slice(0,Mv)+`... <${e.length-Mv} more chars>`}return JSON.stringify(Zn(t))}if(typeof e==="object"&&!Array.isArray(e)){let t={};for(let[n,r]of Object.entries(e))if(Zce.has(n))t[n]=r;return t}return null}async function $g(e,t=(n)=>console.warn(`anthropic-sdk: ${n}`)){if(typeof process>"u"||process.platform==="win32")return;let n=await import("node:fs"),r=e,o;try{r=await n.promises.realpath(e),o=await n.promises.stat(r)}catch{return}let s=o.mode&511;if(s&18)throw new rt(`Credentials file at ${r} is group/world-writable (mode 0o${s.toString(8)}); this allows other local users to plant tokens. Run \`chmod 600 ${r}\`.`);if(s&36)throw new rt(`Credentials file at ${r} is group/world-readable (mode 0o${s.toString(8)}); run \`chmod 600 ${r}\` before retrying.`);if(typeof process.getuid==="function"&&o.uid!==process.getuid())t(`credentials file at ${r} is owned by uid ${o.uid} (current process uid ${process.getuid()}); verify this is intentional.`)}async function zg(e,t){let n=await import("node:fs"),o=(await import("node:path")).dirname(e);await n.promises.mkdir(o,{recursive:!0,mode:448});let s=`${e}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{let i=await n.promises.open(s,"w",384);try{await i.writeFile(JSON.stringify(t,null,2)),await i.sync()}finally{await i.close()}await n.promises.rename(s,e)}catch(i){throw await n.promises.unlink(s).catch(()=>{}),i}try{let i=await n.promises.open(o,"r");try{await i.sync()}finally{await i.close()}}catch{}}async function Yce(e){if(!e.body)return"";let t=e.body.getReader(),n=[],r=0;for(;;){let{done:s,value:i}=await t.read();if(s)break;if(r+i.length>pU){let a=pU-r;if(a>0)n.push(i.subarray(0,a));await t.cancel();break}n.push(i),r+=i.length}let o;if(n.length===1)o=n[0];else{o=new Uint8Array(n.reduce((i,a)=>i+a.length,0));let s=0;for(let i of n)o.set(i,s),s+=i.length}return new TextDecoder("utf-8").decode(o)}var fU="urn:ietf:params:oauth:grant-type:jwt-bearer",mU="refresh_token",Mg="/v1/oauth/token",ha="oauth-2025-04-20",hU="oidc-federation-2026-04-01",gU=120,ll=30,_U=5,pU=1048576,Mv=2000,Zce,rt;var ul=O(()=>{gt();Zce=new Set(["error","error_description","error_uri"]);rt=class rt extends j{constructor(e,t=null,n=null,r=null){super(e);this.statusCode=t,this.body=n,this.requestId=r}}});function co(){return Math.floor(Date.now()/1000)}class Uv{constructor(e,t){this.cached=null,this.pendingRefresh=null,this.nextForce=!1,this.lastAdvisoryError=0,this.provider=e,this.onAdvisoryRefreshError=t}async getToken(){let e=this.nextForce;this.nextForce=!1;let t=this.cached;if(e||t==null)return(await this.refresh(e)).token;if(t.expiresAt==null)return t.token;let n=t.expiresAt-co();if(n>gU)return t.token;if(n>ll)return this.backgroundRefresh(),t.token;return(await this.refresh()).token}invalidate(){this.cached=null,this.nextForce=!0}refresh(e=!1){if(this.pendingRefresh&&!e)return this.pendingRefresh;return this.doRefresh(e)}backgroundRefresh(){if(this.pendingRefresh)return;if(co()-this.lastAdvisoryError<_U)return;this.doRefresh().catch((e)=>{this.lastAdvisoryError=co(),this.onAdvisoryRefreshError?.(e)})}doRefresh(e=!1){return this.pendingRefresh=this.provider(e?{forceRefresh:!0}:void 0).then((t)=>(this.cached=t,this.pendingRefresh=null,t),(t)=>{throw this.pendingRefresh=null,t}),this.pendingRefresh}}var yU=O(()=>{ul()});var Le=(e)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[e]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(e)?.trim()||void 0;return};function EU(e){let t=0;for(let o of e)t+=o.length;let n=new Uint8Array(t),r=0;for(let o of e)n.set(o,r),r+=o.length;return n}function dl(e){let t;return(SU??(t=new globalThis.TextEncoder,SU=t.encode.bind(t)))(e)}function Fv(e){let t;return(bU??(t=new globalThis.TextDecoder,bU=t.decode.bind(t)))(e)}var SU,bU;var xU=O(()=>{gt()});function cp(){}function jg(e,t,n){if(!t||Hg[e]>Hg[n])return cp;else return t[e].bind(t)}function zv(e,t){let n=vU.get(e);if(n&&n[0]===t)return n[1];let r={error:jg("error",e,t),warn:jg("warn",e,t),info:jg("info",e,t),debug:jg("debug",e,t)};return vU.set(e,[t,r]),r}function Ke(e){let t=e.logger,n=e.logLevel??"off";if(!t)return Jce;return zv(t,n)}function AU(){let e=Le("ANTHROPIC_LOG");if(!$v||e!==wU)wU=e,$v=zv(console,Bg(e,"process.env['ANTHROPIC_LOG']",zv(console,lp))??lp);return $v}var lp="warn",Hg,Bg=(e,t,n)=>{if(!e)return;if(WM(Hg,e))return e;n.warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Hg))}`);return},Jce,vU,wU,$v,Yo=(e)=>{if(e.options)e.options={...e.options},delete e.options.headers;if(e.headers)e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([t,n])=>[t,t.toLowerCase()==="authorization"||t.toLowerCase()==="api-key"||t.toLowerCase()==="x-api-key"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":n]));if("retryOfRequestLogID"in e){if(e.retryOfRequestLogID)e.retryOf=e.retryOfRequestLogID;delete e.retryOfRequestLogID}return e};var Jo=O(()=>{io();Hg={off:0,error:200,warn:300,info:400,debug:500};Jce={error:cp,warn:cp,info:cp,debug:cp},vU=new WeakMap});var jv=O(()=>{io();xU();Jo();Nv()});function TU(e){if(!e)throw Error("profile name is empty");if(e==="."||e==="..")throw Error(`profile name "${e}" is not allowed`);if(e.includes("/")||e.includes("\\"))throw Error(`profile name "${e}" must not contain path separators`);if(!Xce.test(e))throw Error(`profile name "${e}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`)}var Kg="1.0",Xce,CU=async(e)=>{var t,n;let r=await Hv();if(r===null)return null;let o=e??await RU();if(o===null)return null;TU(o);let s=await import("node:fs"),a=(await import("node:path")).join(r,"configs",`${o}.json`),c;try{c=await s.promises.readFile(a,"utf-8")}catch(p){if(p?.code!=="ENOENT")throw Error(`failed to read config file ${a}: ${p}`);c=null}if(c===null){let p=Le("ANTHROPIC_ORGANIZATION_ID"),f=Le("ANTHROPIC_IDENTITY_TOKEN_FILE"),m=Le("ANTHROPIC_FEDERATION_RULE_ID");if(m&&p)return{fromFile:!1,config:{organization_id:p,workspace_id:Le("ANTHROPIC_WORKSPACE_ID"),base_url:Le("ANTHROPIC_BASE_URL"),authentication:{type:"oidc_federation",federation_rule_id:m,service_account_id:Le("ANTHROPIC_SERVICE_ACCOUNT_ID"),identity_token:f?{source:"file",path:f}:void 0,scope:Le("ANTHROPIC_SCOPE")}}};return null}let l;try{l=JSON.parse(c)}catch(p){throw Error(`failed to parse config file ${a}: ${p}`)}if(!l.authentication)throw Error(`config file ${a} is missing "authentication"`);let u=l.authentication.type;if(u!=="oidc_federation"&&u!=="user_oauth")throw Error(`authentication.type "${u}" is not a known authentication type`);if(l.organization_id??(l.organization_id=Le("ANTHROPIC_ORGANIZATION_ID")),l.workspace_id??(l.workspace_id=Le("ANTHROPIC_WORKSPACE_ID")),l.base_url??(l.base_url=Le("ANTHROPIC_BASE_URL")),(t=l.authentication).scope??(t.scope=Le("ANTHROPIC_SCOPE")),l.authentication.type==="oidc_federation"){if(!l.authentication.identity_token){let p=Le("ANTHROPIC_IDENTITY_TOKEN_FILE");if(p)l.authentication.identity_token={source:"file",path:p}}if(!l.authentication.federation_rule_id)l.authentication.federation_rule_id=Le("ANTHROPIC_FEDERATION_RULE_ID")??"";(n=l.authentication).service_account_id??(n.service_account_id=Le("ANTHROPIC_SERVICE_ACCOUNT_ID"))}return{config:l,fromFile:!0}},kU=async(e,t)=>{if(e?.authentication.credentials_path)return e.authentication.credentials_path;let n=await Hv();if(!n)return null;let r=t??await RU();if(!r)return null;return TU(r),(await import("node:path")).join(n,"credentials",`${r}.json`)},Hv=async()=>{if(!Qce())return null;let e=await import("node:path"),t=Le("ANTHROPIC_CONFIG_DIR");if(t)return t;if(ip()["X-Stainless-OS"]==="Windows"){let s=Le("APPDATA");if(s)return e.join(s,"Anthropic");let i=Le("USERPROFILE");if(i)return e.join(i,"AppData","Roaming","Anthropic");return null}let r=Le("XDG_CONFIG_HOME");if(r)return e.join(r,"anthropic");let o=Le("HOME");if(o)return e.join(o,".config","anthropic");return null},Qce=()=>{let e=ip()["X-Stainless-Runtime"];return e==="node"||e==="deno"},RU=async()=>{let e=await Hv();if(!e)return null;let t=Le("ANTHROPIC_PROFILE");if(t)return t;let n=await import("node:fs"),o=(await import("node:path")).join(e,"active_config");try{return(await n.promises.readFile(o,"utf-8")).trim()||"default"}catch(s){if(s?.code!=="ENOENT")throw Error(`failed to read ${o}: ${s}`);return"default"}};var Bv=O(()=>{Dg();jv();Xce=/^[A-Za-z0-9_.-]+$/});function Kv(e){if(!e)throw new j("Identity token file path is empty");return async()=>{let t=await import("node:fs"),n;try{n=await t.promises.readFile(e,"utf-8")}catch(o){throw new j(`Failed to read identity token file at ${e}: ${o}`)}let r=n.trim();if(!r)throw new j(`Identity token file at ${e} is empty`);return r}}function OU(e){if(!e)throw new j("Identity token value is empty");return()=>e}var PU=O(()=>{gt()});function IU(e){return async()=>{Ug(e.baseURL);let t=await e.identityTokenProvider();if(t.length>16384)throw new rt(`Identity token is ${Math.ceil(t.length/1024)} KiB, exceeds the 16 KiB assertion limit`);let n={grant_type:fU,assertion:t,federation_rule_id:e.federationRuleId,organization_id:e.organizationId};if(e.serviceAccountId)n.service_account_id=e.serviceAccountId;if(e.workspaceId)n.workspace_id=e.workspaceId;let r=`${e.baseURL}${Mg}`,o;try{o=await e.fetch(r,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":`${ha},${hU}`,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${Ur} oidcFederationProvider`},body:JSON.stringify(n)})}catch(c){throw new rt(`Failed to reach token endpoint ${r}: ${c}`)}let s=o.headers.get("Request-Id");if(!o.ok){let c=await o.text().catch(()=>""),l=Zn(c),u="";if(o.status===401)u=` Ensure your federation rule matches your identity token. ${e.workspaceId?"":"If your federation rule is scoped to multiple workspaces, set the ANTHROPIC_WORKSPACE_ID environment variable, the 'workspace_id' config key, or the `workspaceId` option. "}View your authentication events in the Workload identity page of Claude Console for more details.`;throw new rt(`Token exchange failed with status ${o.status}${s?` (request-id ${s})`:""}: ${l}${u}`,o.status,l,s)}let i=await Fg(o,s),a=Number(i.expires_in);if(!Number.isFinite(a))throw new rt(`Token endpoint response missing required fields: ${JSON.stringify(Zn(i))}`,o.status,Zn(i),s);return{token:i.access_token,expiresAt:co()+a}}}var DU=O(()=>{ul()});function LU(e){return async(t)=>{let n=await import("node:fs");await $g(e.credentialsPath,e.onSafetyWarning);let r;try{r=await n.promises.readFile(e.credentialsPath,"utf-8")}catch(_){throw new rt(`Credentials file not found at ${e.credentialsPath}: ${_}`)}let o;try{o=JSON.parse(r)}catch(_){throw new rt(`Credentials file at ${e.credentialsPath} is not valid JSON: ${_}`)}let s=o.access_token;if(!s)throw new rt(`Credentials file at ${e.credentialsPath} must include 'access_token'`);let i=o.expires_at;if(!t?.forceRefresh&&(i==null||co()<i-ll))return{token:s,expiresAt:i??null};let a=o.refresh_token;if(!e.clientId||!a)throw new rt(`Access token at ${e.credentialsPath} has expired and no refresh is available (client_id ${e.clientId?"set":"empty"}, refresh_token ${a?"set":"empty"})`);Ug(e.baseURL);let c={grant_type:mU,refresh_token:a,client_id:e.clientId},l=`${e.baseURL}${Mg}`,u;try{u=await e.fetch(l,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":ha,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${Ur} userOAuthProvider`},body:JSON.stringify(c)})}catch(_){throw new rt(`User OAuth refresh failed to reach token endpoint: ${_}`)}let p=u.headers.get("Request-Id");if(!u.ok){let _=await u.text().catch(()=>"");throw new rt(`User OAuth refresh failed (HTTP ${u.status}): ${Zn(_)}`,u.status,Zn(_),p)}let f=await Fg(u,p),m=Number(f.expires_in);if(!Number.isFinite(m))throw new rt(`User OAuth refresh response missing or invalid expires_in: ${JSON.stringify(Zn(f))}`,u.status,Zn(f),p);let h=co()+m,y=f.refresh_token||a;return await zg(e.credentialsPath,{...o,version:Kg,type:"oauth_token",access_token:f.access_token,expires_at:h,refresh_token:y}),{token:f.access_token,expiresAt:h}}}var NU=O(()=>{Bv();ul()});function Gv(e,t){let n=e.authentication.credentials_path??null,r=(e.base_url||t.baseURL).replace(/\/+$/,""),o=ele(e,n,r,t),s={};if(e.workspace_id&&e.authentication.type==="user_oauth")s["anthropic-workspace-id"]=e.workspace_id;return{provider:o,extraHeaders:s,baseURL:e.base_url||void 0}}async function MU(e,t){let n=await CU(t);if(!n)return null;let{config:r,fromFile:o}=n,s=r.authentication.credentials_path||!o?r:{...r,authentication:{...r.authentication,credentials_path:await kU(r,t)??void 0}};return Gv(s,e)}function ele(e,t,n,r){switch(e.authentication.type){case"oidc_federation":{let o=e.authentication,s=tle(o);if(!s)throw new rt("oidc_federation config requires an identity token (set authentication.identity_token, ANTHROPIC_IDENTITY_TOKEN_FILE, or ANTHROPIC_IDENTITY_TOKEN)");if(!o.federation_rule_id)throw new rt("oidc_federation config requires 'federation_rule_id'. Set it in authentication.federation_rule_id in your profile, or via ANTHROPIC_FEDERATION_RULE_ID (profile takes precedence).");if(!e.organization_id)throw new rt("oidc_federation config requires organization_id (set ANTHROPIC_ORGANIZATION_ID or config.organization_id)");let i=IU({identityTokenProvider:s,federationRuleId:o.federation_rule_id,organizationId:e.organization_id,serviceAccountId:o.service_account_id,workspaceId:e.workspace_id,baseURL:n,fetch:r.fetch,userAgent:r.userAgent});if(t)return nle(i,t,r.onCacheWriteError,r.onSafetyWarning);return i}case"user_oauth":{if(!t)throw new rt("user_oauth config requires authentication.credentials_path (or load via a profile so it defaults to <config_dir>/credentials/<profile>.json)");return LU({credentialsPath:t,clientId:e.authentication.client_id,baseURL:n,fetch:r.fetch,userAgent:r.userAgent,onSafetyWarning:r.onSafetyWarning})}default:{let o=e.authentication.type;throw new rt(`authentication.type "${o}" is not a known authentication type`)}}}function tle(e){if(e.identity_token){let r=e.identity_token.source;if(r!=="file")throw new rt(`identity_token.source "${r}" is not supported by this SDK version (only "file")`);if(!e.identity_token.path)throw new rt('identity_token.source "file" requires a non-empty path');return Kv(e.identity_token.path)}let t=Le("ANTHROPIC_IDENTITY_TOKEN_FILE");if(t)return Kv(t);let n=Le("ANTHROPIC_IDENTITY_TOKEN");if(n)return OU(n);return null}function nle(e,t,n,r){return async(o)=>{let s=await import("node:fs");await $g(t,r);let i;try{let c=await s.promises.readFile(t,"utf-8");i=JSON.parse(c);let l=i?.access_token;if(l&&!o?.forceRefresh){let u=i?.expires_at;if(u==null||co()<u-ll)return{token:l,expiresAt:u??null}}}catch(c){if(c?.code!=="ENOENT"&&!(c instanceof SyntaxError))n?.(c)}let a=await e(o);try{await zg(t,{...i??{},version:Kg,type:"oauth_token",access_token:a.token,expires_at:a.expiresAt})}catch(c){n?.(c)}return a}}var UU=O(()=>{Bv();ul();PU();DU();NU()});class ii{constructor(){yr.set(this,void 0),Sr.set(this,void 0),N(this,yr,new Uint8Array,"f"),N(this,Sr,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==="string"?dl(e):e;N(this,yr,EU([b(this,yr,"f"),t]),"f");let n=[],r;while((r=rle(b(this,yr,"f"),b(this,Sr,"f")))!=null){if(r.carriage&&b(this,Sr,"f")==null){N(this,Sr,r.index,"f");continue}if(b(this,Sr,"f")!=null&&(r.index!==b(this,Sr,"f")+1||r.carriage)){n.push(Fv(b(this,yr,"f").subarray(0,b(this,Sr,"f")-1))),N(this,yr,b(this,yr,"f").subarray(b(this,Sr,"f")),"f"),N(this,Sr,null,"f");continue}let o=b(this,Sr,"f")!==null?r.preceding-1:r.preceding,s=Fv(b(this,yr,"f").subarray(0,o));n.push(s),N(this,yr,b(this,yr,"f").subarray(r.index),"f"),N(this,Sr,null,"f")}return n}flush(){if(!b(this,yr,"f").length)return[];return this.decode(`
9
+ `)}}function rle(e,t){for(let o=t??0;o<e.length;o++){if(e[o]===10)return{preceding:o,index:o+1,carriage:!1};if(e[o]===13)return{preceding:o,index:o+1,carriage:!0}}return null}function FU(e){for(let r=0;r<e.length-1;r++){if(e[r]===10&&e[r+1]===10)return r+2;if(e[r]===13&&e[r+1]===13)return r+2;if(e[r]===13&&e[r+1]===10&&r+3<e.length&&e[r+2]===13&&e[r+3]===10)return r+4}return-1}var yr,Sr;var Wv=O(()=>{qn();yr=new WeakMap,Sr=new WeakMap;ii.NEWLINE_CHARS=new Set([`
10
+ `,"\r"]);ii.NEWLINE_REGEXP=/\r\n|[\n\r]/g});async function*$U(e,t){if(!e.body){if(t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new j("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new j("Attempted to iterate over a response with no body")}let n=new zU,r=new ii,o=ap(e.body);for await(let s of ole(o))for(let i of r.decode(s)){let a=n.decode(i);if(a)yield a}for(let s of r.flush()){let i=n.decode(s);if(i)yield i}}async function*ole(e){let t=new Uint8Array;for await(let n of e){if(n==null)continue;let r=n instanceof ArrayBuffer?new Uint8Array(n):typeof n==="string"?dl(n):n,o=new Uint8Array(t.length+r.length);o.set(t),o.set(r,t.length),t=o;let s;while((s=FU(t))!==-1)yield t.slice(0,s),t=t.slice(s)}if(t.length>0)yield t}class zU{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r"))e=e.substring(0,e.length-1);if(!e){if(!this.event&&!this.data.length)return null;let o={event:this.event,data:this.data.join(`
11
+ `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],o}if(this.chunks.push(e),e.startsWith(":"))return null;let[t,n,r]=sle(e,":");if(r.startsWith(" "))r=r.substring(1);if(t==="event")this.event=r;else if(t==="data")this.data.push(r);return null}}function sle(e,t){let n=e.indexOf(t);if(n!==-1)return[e.substring(0,n),t,e.substring(n+t.length)];return[e,"",""]}var up,An;var dp=O(()=>{qn();gt();Wv();io();Jo();gt();An=class An{constructor(e,t,n){this.iterator=e,up.set(this,void 0),this.controller=t,N(this,up,n,"f")}static rawEvents(e,t=new AbortController){return $U(e,t)}static fromSSEResponse(e,t,n){let r=!1,o=n?Ke(n):console;async function*s(){if(r)throw new j("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let i=!1;try{for await(let a of $U(e,t)){if(a.event==="completion")try{yield JSON.parse(a.data)}catch(c){throw o.error("Could not parse message into JSON:",a.data),o.error("From chunk:",a.raw),c}if(a.event==="message_start"||a.event==="message_delta"||a.event==="message_stop"||a.event==="content_block_start"||a.event==="content_block_delta"||a.event==="content_block_stop"||a.event==="message"||a.event==="user.message"||a.event==="user.interrupt"||a.event==="user.tool_confirmation"||a.event==="user.custom_tool_result"||a.event==="user.tool_result"||a.event==="agent.message"||a.event==="agent.thinking"||a.event==="agent.tool_use"||a.event==="agent.tool_result"||a.event==="agent.mcp_tool_use"||a.event==="agent.mcp_tool_result"||a.event==="agent.custom_tool_use"||a.event==="agent.thread_context_compacted"||a.event==="session.status_running"||a.event==="session.status_idle"||a.event==="session.status_rescheduled"||a.event==="session.status_terminated"||a.event==="session.error"||a.event==="session.deleted"||a.event==="session.updated"||a.event==="span.model_request_start"||a.event==="span.model_request_end"||a.event==="span.outcome_evaluation_start"||a.event==="span.outcome_evaluation_ongoing"||a.event==="span.outcome_evaluation_end"||a.event==="user.define_outcome"||a.event==="agent.thread_message_received"||a.event==="agent.thread_message_sent"||a.event==="agent.session_thread_message_received"||a.event==="agent.session_thread_message_sent"||a.event==="session.thread_created"||a.event==="session.thread_status_created"||a.event==="session.thread_status_running"||a.event==="session.thread_status_idle"||a.event==="session.thread_status_rescheduled"||a.event==="session.thread_status_terminated"||a.event==="event_start"||a.event==="event_delta"||a.event==="system.message")try{yield JSON.parse(a.data)}catch(c){throw o.error("Could not parse message into JSON:",a.data),o.error("From chunk:",a.raw),c}if(a.event==="ping")continue;if(a.event==="error"){let c=sp(a.data)??a.data,l=c?.error?.type;throw new Lt(void 0,c,void 0,e.headers,l)}}i=!0}catch(a){if(Mr(a))return;throw a}finally{if(!i)t.abort()}}return new An(s,t,n)}static fromReadableStream(e,t,n){let r=!1;async function*o(){let i=new ii,a=ap(e);for await(let c of a)for(let l of i.decode(c))yield l;for(let c of i.flush())yield c}async function*s(){if(r)throw new j("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let i=!1;try{for await(let a of o()){if(i)continue;if(a)yield JSON.parse(a)}i=!0}catch(a){if(Mr(a))return;throw a}finally{if(!i)t.abort()}}return new An(s,t,n)}[(up=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],t=[],n=this.iterator(),r=(o)=>({next:()=>{if(o.length===0){let s=n.next();e.push(s),t.push(s)}return o.shift()}});return[new An(()=>r(e),this.controller,b(this,up,"f")),new An(()=>r(t),this.controller,b(this,up,"f"))]}toReadableStream(){let e=this,t;return Cv({async start(){t=e[Symbol.asyncIterator]()},async pull(n){try{let{value:r,done:o}=await t.next();if(o)return n.close();let s=dl(JSON.stringify(r)+`
12
+ `);n.enqueue(s)}catch(r){n.error(r)}},async cancel(){await t.return?.()}})}}});async function Gg(e,t){let{response:n,requestLogID:r,retryOfRequestLogID:o,startTime:s}=t,i=await(async()=>{if(t.options.stream)return Ke(e).debug("response",n.status,n.url,n.headers,n.body),An.fromSSEResponse(n,t.controller);if(n.status===204)return null;if(t.options.__binaryResponse)return n;let c=n.headers.get("content-type")?.split(";")[0]?.trim();if(c?.includes("application/json")||c?.endsWith("+json")){if(n.headers.get("content-length")==="0")return;let f=await n.json();return pp(f,n)}return await n.text()})();return Ke(e).debug(`[${r}] response parsed`,Yo({retryOfRequestLogID:o,url:n.url,status:n.status,body:i,durationMs:Date.now()-s})),i}function pp(e,t){if(!e||typeof e!=="object"||Array.isArray(e))return e;return Object.defineProperty(e,"_request_id",{value:t.headers.get("request-id"),enumerable:!1})}var Wg=O(()=>{dp();Jo()});function Vv(e){return typeof e==="object"&&e!==null&&HU.has(e)}function BU(e){let t=new Set;while(typeof e==="object"&&e!==null&&!t.has(e)){if(t.add(e),Vv(e)||Mr(e)||e instanceof bs||e instanceof Ig)return!0;e=e.cause}return!1}function qv(e,t,n,r){return async(o,s={})=>{if(t.length===0)return e.call(void 0,o,s);let i=s.headers instanceof Headers?s.headers:new Headers(s.headers),a=await ale(e,t,n,r)({...s,headers:i,url:typeof o==="string"?o:o instanceof URL?o.href:o.url});if(a.bodyUsed||a.body?.locked)throw new j("middleware consumed the response body; use response.clone() to inspect it, or return new Response(body, response) to consume and replace it");return a}}function ile(e,t){let n=new WeakMap;return{options:e,logger:t?Ke(t):AU(),parse(r){if(e?.stream&&r.ok)return jU(r,e);let o=n.get(r);if(!o)o=jU(r,e),n.set(r,o);return o}}}async function jU(e,t){if(e.bodyUsed||e.body?.locked)throw new j("cannot ctx.parse() a response whose body was already consumed; call ctx.parse() instead of reading the body, or read via response.clone()");if(t?.stream&&e.ok)return An.fromSSEResponse(e.clone(),new AbortController);if(e.status===204)return null;if(t?.__binaryResponse)return e;let r=e.headers.get("content-type")?.split(";")[0]?.trim();if(r?.includes("application/json")||r?.endsWith("+json")){if(e.headers.get("content-length")==="0")return;return pp(await e.clone().json(),e)}return await e.clone().text()}function ale(e,t,n,r){let o=async({url:i,...a})=>{try{return await e.call(void 0,i,a)}catch(c){let l=ma(c);throw HU.add(l),l}},s=ile(n,r);for(let i=t.length-1;i>=0;i--){let a=t[i],c=o;o=async(l)=>a(l,c,s)}return o}var HU;var KU=O(()=>{Wg();Jo();gt();dp();HU=new WeakSet});var fp,ga;var Vg=O(()=>{qn();Wg();ga=class ga extends Promise{constructor(e,t,n=Gg){super((r)=>{r(null)});this.responsePromise=t,this.parseResponse=n,fp.set(this,void 0),N(this,fp,e,"f")}_thenUnwrap(e){return new ga(b(this,fp,"f"),this.responsePromise,async(t,n)=>pp(e(await this.parseResponse(t,n),n),n.response))}asResponse(){return this.responsePromise.then((e)=>e.response)}async withResponse(){let[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t,request_id:t.headers.get("request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then((e)=>this.parseResponse(b(this,fp,"f"),e));return this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};fp=new WeakMap});var qg,Zg,Yg,lo,Ae,Zv;var et=O(()=>{qn();gt();Wg();Vg();io();Zg=class Zg{constructor(e,t,n,r){qg.set(this,void 0),N(this,qg,e,"f"),this.options=r,this.response=t,this.body=n}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new j("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await b(this,qg,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;yield e;while(e.hasNextPage())e=await e.getNextPage(),yield e}async*[(qg=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let t of e.getPaginatedItems())yield t}};Yg=class Yg extends ga{constructor(e,t,n){super(e,t,async(r,o)=>new n(r,o.response,await Gg(r,o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let t of e)yield t}};lo=class lo extends Zg{constructor(e,t,n,r){super(e,t,n,r);this.data=n.data||[],this.has_more=n.has_more||!1,this.first_id=n.first_id||null,this.last_id=n.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let t=this.first_id;if(!t)return null;return{...this.options,query:{...op(this.options.query),before_id:t}}}let e=this.last_id;if(!e)return null;return{...this.options,query:{...op(this.options.query),after_id:e}}}};Ae=class Ae extends Zg{constructor(e,t,n,r){super(e,t,n,r);this.data=n.data||[],this.next_page=n.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let e=this.next_page;if(!e)return null;return{...this.options,query:{...op(this.options.query),page:e}}}};Zv=class Zv extends Zg{constructor(e,t,n,r){super(e,t,n,r);this.data=n.data||[],this.next_page=n.next_page||null,this.prev_page=n.prev_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let e=this.next_page;if(!e)return null;return{...this.options,query:{...op(this.options.query),page:e}}}}});function _a(e,t,n){return Jv(),new File(e,t??"unknown_file",n)}function mp(e,t){let n=typeof e==="object"&&e!==null&&(("name"in e)&&e.name&&String(e.name)||("url"in e)&&e.url&&String(e.url)||("filename"in e)&&e.filename&&String(e.filename)||("path"in e)&&e.path&&String(e.path))||"";return t?n.split(/[\\/]/).pop()||void 0:n}function lle(e){let t=typeof e==="function"?e:e.fetch,n=GU.get(t);if(n)return n;let r=(async()=>{try{let o="Response"in t?t.Response:(await t("data:,")).constructor,s=new FormData;if(s.toString()===await new o(s).text())return!1;return!0}catch{return!0}})();return GU.set(t,r),r}var Jv=()=>{if(typeof File>"u"){let{process:e}=globalThis,t=typeof e?.versions?.node==="string"&&parseInt(e.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(t?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}},Xv=(e)=>e!=null&&typeof e==="object"&&typeof e[Symbol.asyncIterator]==="function",pl=async(e,t,n=!0)=>({...e,body:await ule(e.body,t,n)}),GU,ule=async(e,t,n=!0)=>{if(!await lle(t))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(e||{}).map(([o,s])=>Yv(r,o,s,n))),r},dle=(e)=>e instanceof Blob&&("name"in e),Yv=async(e,t,n,r)=>{if(n===void 0)return;if(n==null)throw TypeError(`Received null for "${t}"; to pass null in FormData, you must use the string 'null'`);if(typeof n==="string"||typeof n==="number"||typeof n==="boolean")e.append(t,String(n));else if(n instanceof Response){let o={},s=n.headers.get("Content-Type");if(s)o={type:s};e.append(t,_a([await n.blob()],mp(n,r),o))}else if(Xv(n))e.append(t,_a([await new Response(Lg(n)).blob()],mp(n,r)));else if(dle(n))e.append(t,_a([n],mp(n,r),{type:n.type}));else if(Array.isArray(n))await Promise.all(n.map((o)=>Yv(e,t+"[]",o,r)));else if(typeof n==="object")await Promise.all(Object.entries(n).map(([o,s])=>Yv(e,`${t}[${o}]`,s,r)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${n} instead`)};var fl=O(()=>{GU=new WeakMap});async function Jg(e,t,n){if(Jv(),e=await e,t||(t=mp(e,!0)),ple(e)){if(e instanceof File&&t==null&&n==null)return e;return _a([await e.arrayBuffer()],t??e.name,{type:e.type,lastModified:e.lastModified,...n})}if(fle(e)){let o=await e.blob();return t||(t=new URL(e.url).pathname.split(/[\\/]/).pop()),_a(await Qv(o),t,n)}let r=await Qv(e);if(!n?.type){let o=r.find((s)=>typeof s==="object"&&("type"in s)&&s.type);if(typeof o==="string")n={...n,type:o}}return _a(r,t,n)}async function Qv(e){let t=[];if(typeof e==="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(WU(e))t.push(e instanceof Blob?e:await e.arrayBuffer());else if(Xv(e))for await(let n of e)t.push(...await Qv(n));else{let n=e?.constructor?.name;throw Error(`Unexpected data type: ${typeof e}${n?`; constructor: ${n}`:""}${mle(e)}`)}return t}function mle(e){if(typeof e!=="object"||e===null)return"";return`; props: [${Object.getOwnPropertyNames(e).map((n)=>`"${n}"`).join(", ")}]`}var WU=(e)=>e!=null&&typeof e==="object"&&typeof e.size==="number"&&typeof e.type==="string"&&typeof e.text==="function"&&typeof e.slice==="function"&&typeof e.arrayBuffer==="function",ple=(e)=>e!=null&&typeof e==="object"&&typeof e.name==="string"&&typeof e.lastModified==="number"&&WU(e),fle=(e)=>e!=null&&typeof e==="object"&&typeof e.url==="string"&&typeof e.blob==="function";var VU=O(()=>{fl();fl()});var ew=O(()=>{VU()});var qU=()=>{};class oe{constructor(e){this._client=e}}function*gle(e){if(!e)return;if(ZU in e){let{values:r,nulls:o}=e;yield*r.entries();for(let s of o)yield[s,null];return}let t=!1,n;if(e instanceof Headers)n=e.entries();else if(Av(e))n=e;else t=!0,n=Object.entries(e??{});for(let r of n){let o=r[0];if(typeof o!=="string")throw TypeError("expected header name to be a string");let s=Av(r[1])?r[1]:[r[1]],i=!1;for(let a of s){if(a===void 0)continue;if(t&&!i)i=!0,yield[o,Xg];yield[o,a]}}}var ZU,Xg,_le,YU=(e,t)=>{let n=e?e.split(",").map((r)=>r.trim()).filter(Boolean):[];for(let r of t.split(",").map((o)=>o.trim()))if(r&&!n.includes(r))n.push(r);return n.join(", ")},k=(e)=>{let t=new Headers,n=new Set;for(let r of e){let o=new Set;for(let[s,i]of gle(r)){let a=s.toLowerCase();if(_le.has(a)){if(i===Xg)continue;if(i===null)t.delete(s),n.add(a);else t.set(s,YU(t.get(s),i)),n.delete(a);continue}if(i===Xg||!o.has(a)){if(t.delete(s),o.add(a),i===Xg)continue}if(i===null)t.delete(s),n.add(a);else t.append(s,i),n.delete(a)}}return{[ZU]:!0,values:t,nulls:n}};var Ne=O(()=>{io();ZU=Symbol.for("brand.privateNullableHeaders");Xg=Symbol("clear"),_le=new Set(["x-stainless-helper"])});function XU(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var JU,yle=(e=XU)=>function(n,...r){if(n.length===1)return n[0];let o=!1,s=[],i=n.reduce((u,p,f)=>{if(/[?#]/.test(p))o=!0;let m=r[f],h=(o?encodeURIComponent:e)(""+m);if(f!==r.length&&(m==null||typeof m==="object"&&m.toString===Object.getPrototypeOf(Object.getPrototypeOf(m.hasOwnProperty??JU)??JU)?.toString))h=m+"",s.push({start:u.length+p.length,length:h.length,error:`Value of type ${Object.prototype.toString.call(m).slice(8,-1)} is not a valid path parameter`});return u+p+(f===r.length?"":h)},""),a=i.split(/[?#]/,1)[0],c=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,l;while((l=c.exec(a))!==null)s.push({start:l.index,length:l[0].length,error:`Value "${l[0]}" can't be safely passed as a path parameter`});if(s.sort((u,p)=>u.start-p.start),s.length>0){let u=0,p=s.reduce((f,m)=>{let h=" ".repeat(m.start-u),y="^".repeat(m.length);return u=m.start+m.length,f+h+y},"");throw new j(`Path parameters result in path with invalid segments:
13
+ ${s.map((f)=>f.error).join(`
14
+ `)}
15
+ ${i}
16
+ ${p}`)}return i},M;var at=O(()=>{gt();JU=Object.freeze(Object.create(null)),M=yle(XU)});var hp;var tw=O(()=>{et();Ne();at();hp=class hp extends oe{retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(M`/v1/deployment_runs/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/deployment_runs?beta=true",Ae,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}}});var gp;var nw=O(()=>{et();Ne();at();gp=class gp extends oe{create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/deployments?beta=true",{body:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(M`/v1/deployments/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}update(e,t,n){let{betas:r,...o}=t;return this._client.post(M`/v1/deployments/${e}?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/deployments?beta=true",Ae,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(M`/v1/deployments/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}pause(e,t={},n){let{betas:r}=t??{};return this._client.post(M`/v1/deployments/${e}/pause?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}run(e,t={},n){let{betas:r}=t??{};return this._client.post(M`/v1/deployments/${e}/run?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}unpause(e,t={},n){let{betas:r}=t??{};return this._client.post(M`/v1/deployments/${e}/unpause?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}}});var _p;var rw=O(()=>{et();Ne();at();_p=class _p extends oe{create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/dreams?beta=true",{body:r,...t,headers:k([{"anthropic-beta":[...n??[],"dreaming-2026-04-21"].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(M`/v1/dreams/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"dreaming-2026-04-21"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/dreams?beta=true",Ae,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"dreaming-2026-04-21"].toString()},t?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(M`/v1/dreams/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"dreaming-2026-04-21"].toString()},n?.headers])})}cancel(e,t={},n){let{betas:r}=t??{};return this._client.post(M`/v1/dreams/${e}/cancel?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"dreaming-2026-04-21"].toString()},n?.headers])})}}});function bp(e){return{["x-stainless-helper"]:e}}function Qg(e){return typeof e==="object"&&e!==null&&yp in e}function ow(e,t){let n=new Set;if(e){for(let r of e)if(Qg(r))n.add(r[yp])}if(t)for(let r of t){if(Qg(r))n.add(r[yp]);let o=r.content;if(Array.isArray(o)){for(let s of o)if(Qg(s))n.add(s[yp])}}return Array.from(n)}function t_(e,t){let n=ow(e,t);if(n.length===0)return{};return{["x-stainless-helper"]:n.join(", ")}}function QU(e){if(Qg(e))return{["x-stainless-helper"]:e[yp]};return{}}var Sp="x-stainless-helper",e_="x-stainless-helper-method",yp;var Xo=O(()=>{yp=Symbol("anthropic.sdk.stainlessHelper")});var Ep;var sw=O(()=>{et();Ne();Xo();fl();at();Ep=class Ep extends oe{list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/files?beta=true",lo,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(M`/v1/files/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString()},n?.headers])})}download(e,t={},n){let{betas:r}=t??{};return this._client.get(M`/v1/files/${e}/content?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}retrieveMetadata(e,t={},n){let{betas:r}=t??{};return this._client.get(M`/v1/files/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString()},n?.headers])})}upload(e,t){let{betas:n,...r}=e;return this._client.post("/v1/files?beta=true",pl({body:r,...t,headers:k([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},QU(r.file),t?.headers])},this._client))}}});var xp;var iw=O(()=>{et();Ne();at();xp=class xp extends oe{retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(M`/v1/models/${e}?beta=true`,{...n,headers:k([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/models?beta=true",lo,{query:r,...t,headers:k([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},t?.headers])})}}});var vp;var aw=O(()=>{et();Ne();at();vp=class vp extends oe{create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/user_profiles?beta=true",{body:r,...t,headers:k([{"anthropic-beta":[...n??[],"user-profiles-2026-03-24"].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(M`/v1/user_profiles/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"user-profiles-2026-03-24"].toString()},n?.headers])})}update(e,t,n){let{betas:r,...o}=t;return this._client.post(M`/v1/user_profiles/${e}?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"user-profiles-2026-03-24"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/user_profiles?beta=true",Ae,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"user-profiles-2026-03-24"].toString()},t?.headers])})}createEnrollmentURL(e,t={},n){let{betas:r}=t??{};return this._client.post(M`/v1/user_profiles/${e}/enrollment_url?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"user-profiles-2026-03-24"].toString()},n?.headers])})}}});var rF=T(function(tF){Object.defineProperty(tF,"__esModule",{value:!0});tF.timingSafeEqual=void 0;function eF(e,t=""){if(!e)throw Error(t)}function Ale(e,t){if(e.byteLength!==t.byteLength)return!1;if(!(e instanceof DataView))e=new DataView(ArrayBuffer.isView(e)?e.buffer:e);if(!(t instanceof DataView))t=new DataView(ArrayBuffer.isView(t)?t.buffer:t);eF(e instanceof DataView),eF(t instanceof DataView);let n=e.byteLength,r=0,o=-1;while(++o<n)r|=e.getUint8(o)^t.getUint8(o);return r===0}tF.timingSafeEqual=Ale});var iF=T(function(br){var Tle=br&&br.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(o.hasOwnProperty(s))r[s]=o[s]},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(br,"__esModule",{value:!0});var Vt=256,cw=function(){function e(t){if(t===void 0)t="=";this._paddingCharacter=t}return e.prototype.encodedLength=function(t){if(!this._paddingCharacter)return(t*8+5)/6|0;return(t+2)/3*4|0},e.prototype.encode=function(t){var n="",r=0;for(;r<t.length-2;r+=3){var o=t[r]<<16|t[r+1]<<8|t[r+2];n+=this._encodeByte(o>>>18&63),n+=this._encodeByte(o>>>12&63),n+=this._encodeByte(o>>>6&63),n+=this._encodeByte(o>>>0&63)}var s=t.length-r;if(s>0){var o=t[r]<<16|(s===2?t[r+1]<<8:0);if(n+=this._encodeByte(o>>>18&63),n+=this._encodeByte(o>>>12&63),s===2)n+=this._encodeByte(o>>>6&63);else n+=this._paddingCharacter||"";n+=this._paddingCharacter||""}return n},e.prototype.maxDecodedLength=function(t){if(!this._paddingCharacter)return(t*6+7)/8|0;return t/4*3|0},e.prototype.decodedLength=function(t){return this.maxDecodedLength(t.length-this._getPaddingLength(t))},e.prototype.decode=function(t){if(t.length===0)return new Uint8Array(0);var n=this._getPaddingLength(t),r=t.length-n,o=new Uint8Array(this.maxDecodedLength(r)),s=0,i=0,a=0,c=0,l=0,u=0,p=0;for(;i<r-4;i+=4)c=this._decodeChar(t.charCodeAt(i+0)),l=this._decodeChar(t.charCodeAt(i+1)),u=this._decodeChar(t.charCodeAt(i+2)),p=this._decodeChar(t.charCodeAt(i+3)),o[s++]=c<<2|l>>>4,o[s++]=l<<4|u>>>2,o[s++]=u<<6|p,a|=c&Vt,a|=l&Vt,a|=u&Vt,a|=p&Vt;if(i<r-1)c=this._decodeChar(t.charCodeAt(i)),l=this._decodeChar(t.charCodeAt(i+1)),o[s++]=c<<2|l>>>4,a|=c&Vt,a|=l&Vt;if(i<r-2)u=this._decodeChar(t.charCodeAt(i+2)),o[s++]=l<<4|u>>>2,a|=u&Vt;if(i<r-3)p=this._decodeChar(t.charCodeAt(i+3)),o[s++]=u<<6|p,a|=p&Vt;if(a!==0)throw Error("Base64Coder: incorrect characters for decoding");return o},e.prototype._encodeByte=function(t){var n=t;return n+=65,n+=25-t>>>8&6,n+=51-t>>>8&-75,n+=61-t>>>8&-15,n+=62-t>>>8&3,String.fromCharCode(n)},e.prototype._decodeChar=function(t){var n=Vt;return n+=(42-t&t-44)>>>8&-Vt+t-43+62,n+=(46-t&t-48)>>>8&-Vt+t-47+63,n+=(47-t&t-58)>>>8&-Vt+t-48+52,n+=(64-t&t-91)>>>8&-Vt+t-65+0,n+=(96-t&t-123)>>>8&-Vt+t-97+26,n},e.prototype._getPaddingLength=function(t){var n=0;if(this._paddingCharacter){for(var r=t.length-1;r>=0;r--){if(t[r]!==this._paddingCharacter)break;n++}if(t.length<4||n>2)throw Error("Base64Coder: incorrect padding")}return n},e}();br.Coder=cw;var wp=new cw;function Cle(e){return wp.encode(e)}br.encode=Cle;function kle(e){return wp.decode(e)}br.decode=kle;var oF=function(e){Tle(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype._encodeByte=function(n){var r=n;return r+=65,r+=25-n>>>8&6,r+=51-n>>>8&-75,r+=61-n>>>8&-13,r+=62-n>>>8&49,String.fromCharCode(r)},t.prototype._decodeChar=function(n){var r=Vt;return r+=(44-n&n-46)>>>8&-Vt+n-45+62,r+=(94-n&n-96)>>>8&-Vt+n-95+63,r+=(47-n&n-58)>>>8&-Vt+n-48+52,r+=(64-n&n-91)>>>8&-Vt+n-65+0,r+=(96-n&n-123)>>>8&-Vt+n-97+26,r},t}(cw);br.URLSafeCoder=oF;var sF=new oF;function Rle(e){return sF.encode(e)}br.encodeURLSafe=Rle;function Ole(e){return sF.decode(e)}br.decodeURLSafe=Ole;br.encodedLength=function(e){return wp.encodedLength(e)};br.maxDecodedLength=function(e){return wp.maxDecodedLength(e)};br.decodedLength=function(e){return wp.decodedLength(e)}});var cF=T(function(aF,n_){(function(e,t){var n={};t(n);var r=n.default;for(var o in n)r[o]=n[o];if(typeof n_==="object"&&typeof n_.exports==="object")n_.exports=r;else if(typeof define==="function"&&define.amd)define(function(){return r});else e.sha256=r})(aF,function(e){e.__esModule=!0,e.digestLength=32,e.blockSize=64;var t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(p,f,m,h,y){var _,E,S,x,v,w,U,L,F,K,ne,se,X;while(y>=64){_=f[0],E=f[1],S=f[2],x=f[3],v=f[4],w=f[5],U=f[6],L=f[7];for(K=0;K<16;K++)ne=h+K*4,p[K]=(m[ne]&255)<<24|(m[ne+1]&255)<<16|(m[ne+2]&255)<<8|m[ne+3]&255;for(K=16;K<64;K++)F=p[K-2],se=(F>>>17|F<<15)^(F>>>19|F<<13)^F>>>10,F=p[K-15],X=(F>>>7|F<<25)^(F>>>18|F<<14)^F>>>3,p[K]=(se+p[K-7]|0)+(X+p[K-16]|0);for(K=0;K<64;K++)se=(((v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7))+(v&w^~v&U)|0)+(L+(t[K]+p[K]|0)|0)|0,X=((_>>>2|_<<30)^(_>>>13|_<<19)^(_>>>22|_<<10))+(_&E^_&S^E&S)|0,L=U,U=w,w=v,v=x+se|0,x=S,S=E,E=_,_=se+X|0;f[0]+=_,f[1]+=E,f[2]+=S,f[3]+=x,f[4]+=v,f[5]+=w,f[6]+=U,f[7]+=L,h+=64,y-=64}return h}var r=function(){function p(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return p.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},p.prototype.clean=function(){for(var f=0;f<this.buffer.length;f++)this.buffer[f]=0;for(var f=0;f<this.temp.length;f++)this.temp[f]=0;this.reset()},p.prototype.update=function(f,m){if(m===void 0)m=f.length;if(this.finished)throw Error("SHA256: can't update because hash was finished.");var h=0;if(this.bytesHashed+=m,this.bufferLength>0){while(this.bufferLength<64&&m>0)this.buffer[this.bufferLength++]=f[h++],m--;if(this.bufferLength===64)n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0}if(m>=64)h=n(this.temp,this.state,f,h,m),m%=64;while(m>0)this.buffer[this.bufferLength++]=f[h++],m--;return this},p.prototype.finish=function(f){if(!this.finished){var m=this.bytesHashed,h=this.bufferLength,y=m/536870912|0,_=m<<3,E=m%64<56?64:128;this.buffer[h]=128;for(var S=h+1;S<E-8;S++)this.buffer[S]=0;this.buffer[E-8]=y>>>24&255,this.buffer[E-7]=y>>>16&255,this.buffer[E-6]=y>>>8&255,this.buffer[E-5]=y>>>0&255,this.buffer[E-4]=_>>>24&255,this.buffer[E-3]=_>>>16&255,this.buffer[E-2]=_>>>8&255,this.buffer[E-1]=_>>>0&255,n(this.temp,this.state,this.buffer,0,E),this.finished=!0}for(var S=0;S<8;S++)f[S*4+0]=this.state[S]>>>24&255,f[S*4+1]=this.state[S]>>>16&255,f[S*4+2]=this.state[S]>>>8&255,f[S*4+3]=this.state[S]>>>0&255;return this},p.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},p.prototype._saveState=function(f){for(var m=0;m<this.state.length;m++)f[m]=this.state[m]},p.prototype._restoreState=function(f,m){for(var h=0;h<this.state.length;h++)this.state[h]=f[h];this.bytesHashed=m,this.finished=!1,this.bufferLength=0},p}();e.Hash=r;var o=function(){function p(f){this.inner=new r,this.outer=new r,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var m=new Uint8Array(this.blockSize);if(f.length>this.blockSize)new r().update(f).finish(m).clean();else for(var h=0;h<f.length;h++)m[h]=f[h];for(var h=0;h<m.length;h++)m[h]^=54;this.inner.update(m);for(var h=0;h<m.length;h++)m[h]^=106;this.outer.update(m),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var h=0;h<m.length;h++)m[h]=0}return p.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},p.prototype.clean=function(){for(var f=0;f<this.istate.length;f++)this.ostate[f]=this.istate[f]=0;this.inner.clean(),this.outer.clean()},p.prototype.update=function(f){return this.inner.update(f),this},p.prototype.finish=function(f){if(this.outer.finished)this.outer.finish(f);else this.inner.finish(f),this.outer.update(f,this.digestLength).finish(f);return this},p.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},p}();e.HMAC=o;function s(p){var f=new r().update(p),m=f.digest();return f.clean(),m}e.hash=s,e.default=s;function i(p,f){var m=new o(p).update(f),h=m.digest();return m.clean(),h}e.hmac=i;function a(p,f,m,h){var y=h[0];if(y===0)throw Error("hkdf: cannot expand more");if(f.reset(),y>1)f.update(p);if(m)f.update(m);f.update(h),f.finish(p),h[0]++}var c=new Uint8Array(e.digestLength);function l(p,f,m,h){if(f===void 0)f=c;if(h===void 0)h=32;var y=new Uint8Array([1]),_=i(f,p),E=new o(_),S=new Uint8Array(E.digestLength),x=S.length,v=new Uint8Array(h);for(var w=0;w<h;w++){if(x===S.length)a(S,E,m,y),x=0;v[w]=S[x++]}return E.clean(),S.fill(0),y.fill(0),v}e.hkdf=l;function u(p,f,m,h){var y=new o(p),_=y.digestLength,E=new Uint8Array(4),S=new Uint8Array(_),x=new Uint8Array(_),v=new Uint8Array(h);for(var w=0;w*_<h;w++){var U=w+1;E[0]=U>>>24&255,E[1]=U>>>16&255,E[2]=U>>>8&255,E[3]=U>>>0&255,y.reset(),y.update(f),y.update(E),y.finish(x);for(var L=0;L<_;L++)S[L]=x[L];for(var L=2;L<=m;L++){y.reset(),y.update(x).finish(x);for(var F=0;F<_;F++)S[F]^=x[F]}for(var L=0;L<_&&w*_+L<h;L++)v[w*_+L]=S[L]}for(var w=0;w<_;w++)S[w]=x[w]=0;for(var w=0;w<4;w++)E[w]=0;return y.clean(),v}e.pbkdf2=u})});var fF=T(function(dF){Object.defineProperty(dF,"__esModule",{value:!0});dF.Webhook=dF.WebhookVerificationError=void 0;var Ple=rF(),lF=iF(),Ile=cF(),uF=300;class lw extends Error{constructor(e){super(e);Object.setPrototypeOf(this,lw.prototype),this.name="ExtendableError",this.stack=Error(e).stack}}class ai extends lw{constructor(e){super(e);Object.setPrototypeOf(this,ai.prototype),this.name="WebhookVerificationError"}}dF.WebhookVerificationError=ai;class Ap{constructor(e,t){if(!e)throw Error("Secret can't be empty.");if((t===null||t===void 0?void 0:t.format)==="raw")if(e instanceof Uint8Array)this.key=e;else this.key=Uint8Array.from(e,(n)=>n.charCodeAt(0));else{if(typeof e!=="string")throw Error("Expected secret to be of type string");if(e.startsWith(Ap.prefix))e=e.substring(Ap.prefix.length);this.key=lF.decode(e)}}verify(e,t){let n={};for(let p of Object.keys(t))n[p.toLowerCase()]=t[p];let r=n["webhook-id"],o=n["webhook-signature"],s=n["webhook-timestamp"];if(!o||!r||!s)throw new ai("Missing required headers");let i=this.verifyTimestamp(s),c=this.sign(r,i,e).split(",")[1],l=o.split(" "),u=new globalThis.TextEncoder;for(let p of l){let[f,m]=p.split(",");if(f!=="v1")continue;if((0,Ple.timingSafeEqual)(u.encode(m),u.encode(c)))return JSON.parse(e.toString())}throw new ai("No matching signature found")}sign(e,t,n){if(typeof n==="string");else if(n.constructor.name==="Buffer")n=n.toString();else throw Error("Expected payload to be of type string or Buffer.");let r=new TextEncoder,o=Math.floor(t.getTime()/1000),s=r.encode(`${e}.${o}.${n}`);return`v1,${lF.encode(Ile.hmac(this.key,s))}`}verifyTimestamp(e){let t=Math.floor(Date.now()/1000),n=parseInt(e,10);if(isNaN(n))throw new ai("Invalid Signature Headers");if(t-n>uF)throw new ai("Message timestamp too old");if(n>t+uF)throw new ai("Message timestamp too new");return new Date(n*1000)}}dF.Webhook=Ap;Ap.prefix="whsec_"});var mF,Tp;var uw=O(()=>{mF=Wn(fF(),1);Tp=class Tp extends oe{unwrap(e,{headers:t,key:n}){if(t!==void 0){let r=n===void 0?this._client.webhookKey:n;if(r===null)throw Error("Webhook key must not be null in order to unwrap");new mF.Webhook(r).verify(e,t)}return JSON.parse(e)}}});var Cp;var dw=O(()=>{et();Ne();at();Cp=class Cp extends oe{list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(M`/v1/agents/${e}/versions?beta=true`,Ae,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}}});var ml;var pw=O(()=>{dw();dw();et();Ne();at();ml=class ml extends oe{constructor(){super(...arguments);this.versions=new Cp(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/agents?beta=true",{body:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r,...o}=t??{};return this._client.get(M`/v1/agents/${e}?beta=true`,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}update(e,t,n){let{betas:r,...o}=t;return this._client.post(M`/v1/agents/${e}?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/agents?beta=true",Ae,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(M`/v1/agents/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}};ml.Versions=Cp});function ya(e,t){if(!e)return()=>{};if(e.aborted)return t.abort(),()=>{};let n=()=>t.abort();return e.addEventListener("abort",n),()=>e.removeEventListener("abort",n)}function ci(e,t){return e instanceof Lt&&e.status===t}function hF(e){return e instanceof Lt&&typeof e.status==="number"&&e.status>=400&&e.status<500}function li(e){return hF(e)&&!ci(e,408)&&!ci(e,409)&&!ci(e,429)}function gF(e,t,n){return Math.min(t*2**e,n)}function fw(e,t){return e+Math.random()*(t-e)}function _F(e){return e*(1-Math.random()*0.25)}var kp=O(()=>{gt()});function r_(e,{authToken:t,helper:n}){if(!t)throw new j(`copyClientForHelper: expected a non-empty authToken but received ${JSON.stringify(t)}`);let r=e,o=r._options.defaultHeaders,s=r._authState?.extraHeaders,i=s?Object.fromEntries(Object.entries(s).filter(([c])=>{let l=c.toLowerCase();return l!=="authorization"&&l!=="x-api-key"})):void 0,a=k([i,o,{[Sp]:n}]);return e.withOptions({apiKey:null,authToken:t,baseURL:e.baseURL,credentials:void 0,defaultHeaders:a})}var mw=O(()=>{gt();Ne();Xo()});function zle(e){return gF(e,Fle,$le)}function jle(){let t=globalThis.process?.env?.HOSTNAME;return t?`${t}-${cl()}`:cl()}var hl,o_,Fr,s_,i_,a_,Rp,Op,gl,Ule=999,Fle=1000,$le=60000,Sa;var c_=O(()=>{qn();gt();Jo();Ne();kp();mw();kp();Sa=class Sa{constructor(e){hl.set(this,void 0),o_.set(this,!1),Fr.set(this,void 0),s_.set(this,void 0),i_.set(this,void 0),a_.set(this,void 0),Rp.set(this,void 0),Op.set(this,void 0),gl.set(this,void 0),this.client=e.client,this.environmentId=e.environmentId,this.environmentKey=e.environmentKey,this.workerId=e.workerId??jle(),N(this,hl,r_(e.client,{authToken:e.environmentKey,helper:"environments-work-poller"}),"f"),N(this,i_,e.autoStop??!0,"f"),N(this,a_,e.drain??!1,"f"),N(this,Rp,e.blockMs===void 0?Ule:e.blockMs,"f"),N(this,Op,e.reclaimOlderThanMs??null,"f"),N(this,gl,e.requestOptions,"f"),N(this,Fr,new AbortController,"f"),N(this,s_,ya(e.signal,b(this,Fr,"f")),"f")}get signal(){return b(this,Fr,"f").signal}abort(){b(this,Fr,"f").abort()}async*[(hl=new WeakMap,o_=new WeakMap,Fr=new WeakMap,s_=new WeakMap,i_=new WeakMap,a_=new WeakMap,Rp=new WeakMap,Op=new WeakMap,gl=new WeakMap,Symbol.asyncIterator)](){if(b(this,o_,"f"))throw new j("Cannot iterate over a consumed WorkPoller");N(this,o_,!0,"f");let e=Ke(this.client);e.info("poller starting",{component:"work-poller",environment_id:this.environmentId});try{let t=0;while(!b(this,Fr,"f").signal.aborted){let n;try{n=await b(this,hl,"f").beta.environments.work.poll(this.environmentId,{"Anthropic-Worker-ID":this.workerId,...b(this,Rp,"f")!==null?{block_ms:b(this,Rp,"f")}:{},...b(this,Op,"f")!==null?{reclaim_older_than_ms:b(this,Op,"f")}:{}},{headers:k([b(this,gl,"f")?.headers]),signal:b(this,Fr,"f").signal})}catch(r){if(b(this,Fr,"f").signal.aborted)return;if(li(r))throw e.error("poll failed permanently, stopping poller",{error:String(r)}),r;let o=_F(zle(t));e.warn("poll failed, backing off",{error:String(r),backoff_ms:o}),t++,await ao(o,b(this,Fr,"f").signal);continue}if(t=0,n==null){if(b(this,a_,"f"))return;await ao(fw(1000,3000),b(this,Fr,"f").signal);continue}e.info("claimed work",{component:"work-poller",environment_id:this.environmentId,work_id:n.id,work_type:n.data.type});try{await b(this,hl,"f").beta.environments.work.ack(n.id,{environment_id:n.environment_id},{headers:k([b(this,gl,"f")?.headers]),signal:b(this,Fr,"f").signal})}catch(r){e.error("ack failed",{work_id:n.id,error:String(r)});continue}try{yield n}finally{if(b(this,i_,"f"))try{await b(this,hl,"f").beta.environments.work.stop(n.id,{environment_id:n.environment_id},{headers:k([b(this,gl,"f")?.headers])})}catch(r){if(!ci(r,409))e.warn("stop failed",{work_id:n.id,error:String(r)})}}}}finally{b(this,s_,"f").call(this)}}}});class hw{constructor(){_l.set(this,[]),ui.set(this,[]),yl.set(this,!1)}push(e){if(b(this,yl,"f"))return!1;let t=b(this,ui,"f").shift();if(t)t({done:!1,value:e});else b(this,_l,"f").push(e);return!0}close(){if(b(this,yl,"f"))return;N(this,yl,!0,"f");while(b(this,ui,"f").length>0)b(this,ui,"f").shift()({done:!0,value:void 0})}next(e){if(b(this,_l,"f").length>0)return Promise.resolve({done:!1,value:b(this,_l,"f").shift()});if(b(this,yl,"f")||e?.aborted)return Promise.resolve({done:!0,value:void 0});return new Promise((t)=>{let n=(o)=>{e?.removeEventListener("abort",r),t(o)},r=()=>{let o=b(this,ui,"f").indexOf(n);if(o>=0)b(this,ui,"f").splice(o,1);t({done:!0,value:void 0})};b(this,ui,"f").push(n),e?.addEventListener("abort",r,{once:!0})})}tryShift(){return b(this,_l,"f").shift()}}var _l,ui,yl;var yF=O(()=>{qn();_l=new WeakMap,ui=new WeakMap,yl=new WeakMap});var ve;var ba=O(()=>{ve=class ve extends Error{constructor(e){let t=typeof e==="string"?e:e.map((n)=>{if(n.type==="text")return n.text;return`[${n.type}]`}).join(" ");super(t);this.name="ToolError",this.content=e}}});function gw(e){return"name"in e?e.name:e.mcp_server_name}function Hle(e){return e instanceof ve?e.content:`Error: ${e instanceof Error?e.message:String(e)}`}async function SF(e,t,n){try{let r=e.parse?e.parse(t):t;return{content:await e.run(r,n),isError:!1}}catch(r){return{content:Hle(r),isError:!0}}}var bF=O(()=>{ba()});function OF(e){return e.type==="session.status_idle"&&e.stop_reason?.type==="end_turn"}class PF{constructor(e,t){Pp.set(this,void 0),m_.set(this,void 0),Sl.set(this,new Set),Ea.set(this,!1),uo.set(this,void 0),N(this,Pp,e,"f"),N(this,m_,t,"f")}noteEvent(e){if(e.type==="user.tool_confirmation")return;if(OF(e))this.arm();else this.disarm()}block(e){if(b(this,Sl,"f").add(e),b(this,uo,"f")!==void 0)N(this,Ea,!0,"f"),clearTimeout(b(this,uo,"f")),N(this,uo,void 0,"f")}unblock(e){if(b(this,Sl,"f").delete(e),b(this,Sl,"f").size===0&&b(this,Ea,"f"))this.arm()}arm(){if(b(this,Pp,"f")<=0)return;if(b(this,Sl,"f").size>0){N(this,Ea,!0,"f");return}if(N(this,Ea,!1,"f"),b(this,uo,"f")!==void 0)clearTimeout(b(this,uo,"f"));N(this,uo,setTimeout(b(this,m_,"f"),b(this,Pp,"f")),"f")}disarm(){if(N(this,Ea,!1,"f"),b(this,uo,"f")!==void 0)clearTimeout(b(this,uo,"f")),N(this,uo,void 0,"f")}}function Vle(e,t,n){if(e.type==="agent.custom_tool_use")return{type:"user.custom_tool_result",custom_tool_use_id:e.id,is_error:t,content:n};return{type:"user.tool_result",tool_use_id:e.id,is_error:t,content:n}}function qle(e){if(typeof e==="string")return[{type:"text",text:e||"(no output)"}];let t=e.map((n)=>{if(n.type==="text")return{type:"text",text:n.text||"(no output)"};if(n.type==="image"||n.type==="document")return n;if(n.type==="search_result")return{type:"search_result",source:n.source,title:n.title,content:n.content.map((r)=>({type:"text",text:r.text})),citations:{enabled:n.citations?.enabled??!1}};return{type:"text",text:JSON.stringify(n)}});return t.length>0?t:[{type:"text",text:"(no output)"}]}var Pp,m_,Sl,Ea,uo,Nt,l_,hn,u_,Ip,h_,Jt,El,Er,xl,di,bl,Es,Dp,$r,d_,kF,EF,xF,vF,_w,wF,p_,f_,yw,AF,RF,TF=500,Ble=1e4,Kle=120000,Gle=30000,CF=3,Wle=60000,xa;var g_=O(()=>{qn();gt();Jo();kp();yF();Ne();Xo();bF();Pp=new WeakMap,m_=new WeakMap,Sl=new WeakMap,Ea=new WeakMap,uo=new WeakMap;xa=class xa{constructor(e,t){Nt.add(this),l_.set(this,!1),hn.set(this,void 0),u_.set(this,void 0),Ip.set(this,void 0),h_.set(this,void 0),Jt.set(this,void 0),El.set(this,new Set),Er.set(this,new Set),xl.set(this,new Map),di.set(this,new Map),bl.set(this,new hw),Es.set(this,0),Dp.set(this,null),$r.set(this,void 0),this.client=t.client,this.sessionId=e,this.tools=t.tools,this.maxIdleMs=t.maxIdleMs??Wle,N(this,Jt,Ke(t.client),"f"),N(this,h_,new Map(t.tools.map((n)=>[gw(n),n])),"f"),N(this,hn,new AbortController,"f"),N(this,u_,ya(t.signal,b(this,hn,"f")),"f"),N(this,Ip,t.requestOptions,"f"),N(this,$r,new PF(this.maxIdleMs,()=>{b(this,Jt,"f").info("session idle after end_turn; stopping",{component:"session-tool-runner",session_id:this.sessionId,max_idle_ms:this.maxIdleMs}),b(this,hn,"f").abort()}),"f")}get signal(){return b(this,hn,"f").signal}abort(){b(this,hn,"f").abort()}async*[(l_=new WeakMap,hn=new WeakMap,u_=new WeakMap,Ip=new WeakMap,h_=new WeakMap,Jt=new WeakMap,El=new WeakMap,Er=new WeakMap,xl=new WeakMap,di=new WeakMap,bl=new WeakMap,Es=new WeakMap,Dp=new WeakMap,$r=new WeakMap,Nt=new WeakSet,Symbol.asyncIterator)](){if(b(this,l_,"f"))throw new j("Cannot iterate over a consumed SessionToolRunner");N(this,l_,!0,"f"),b(this,Jt,"f").info("session tool runner starting",{component:"session-tool-runner",session_id:this.sessionId});let e=b(this,Nt,"m",kF).call(this).catch((t)=>{if(!b(this,hn,"f").signal.aborted)b(this,Jt,"f").error("stream loop failed",{error:String(t)});b(this,hn,"f").abort()});try{while(!0){let n=await b(this,bl,"f").next(b(this,hn,"f").signal);if(n.done)break;yield n.value}await e;let t;while((t=b(this,bl,"f").tryShift())!==void 0)yield t}finally{b(this,hn,"f").abort(),b(this,$r,"f").disarm(),await e;try{await b(this,Nt,"m",RF).call(this)}catch(t){b(this,Jt,"f").warn("drain failed",{error:String(t)})}b(this,bl,"f").close();for(let t of this.tools)try{await t.close?.()}catch(n){b(this,Jt,"f").warn("tool.close failed",{tool:gw(t),error:String(n)})}b(this,u_,"f").call(this)}}};d_=function(){return{...b(this,Ip,"f"),headers:k([bp("session-tool-runner"),b(this,Ip,"f")?.headers]),signal:b(this,hn,"f").signal}},kF=async function(){let t=b(this,hn,"f"),n=TF;while(!t.signal.aborted){try{let r=await this.client.beta.sessions.events.stream(this.sessionId,{},b(this,Nt,"m",d_).call(this));await b(this,Nt,"m",EF).call(this);for await(let o of r)if(n=TF,await b(this,Nt,"m",vF).call(this,o))return}catch(r){if(t.signal.throwIfAborted(),li(r))throw b(this,Jt,"f").error("permanent stream failure, shutting down",{error:String(r)}),t.abort(),r;b(this,Jt,"f").warn("stream disconnected, reconnecting",{error:String(r),backoff_ms:n})}t.signal.throwIfAborted(),await ao(n,t.signal),n=Math.min(n*2,Ble)}},EF=async function(){let t=b(this,hn,"f"),n=[],r=!1;try{for await(let i of this.client.beta.sessions.events.list(this.sessionId,{limit:1000},b(this,Nt,"m",d_).call(this)))b(this,Nt,"m",xF).call(this,i,n),r=OF(i)}catch(i){t.signal.throwIfAborted(),b(this,Jt,"f").warn("reconcile list failed",{error:String(i)});for(let a of n)b(this,El,"f").delete(a.id);return}let o=n.filter((i)=>!b(this,Er,"f").has(i.id));b(this,$r,"f").disarm();for(let i of o)await b(this,Nt,"m",_w).call(this,i);for(let i of[...b(this,di,"f").values()]){let a=b(this,xl,"f").get(i.id);if(a!==void 0)await b(this,Nt,"m",p_).call(this,i,a)}let s=o.filter((i)=>!b(this,Er,"f").has(i.id)&&!b(this,di,"f").has(i.id));if(r&&s.length===0)b(this,$r,"f").arm();else b(this,$r,"f").disarm()},xF=function(t,n){if(t.type==="agent.tool_use"||t.type==="agent.custom_tool_use"){if(b(this,El,"f").add(t.id),!b(this,Er,"f").has(t.id))n.push(t)}else if(t.type==="user.tool_result")b(this,Er,"f").add(t.tool_use_id);else if(t.type==="user.custom_tool_result")b(this,Er,"f").add(t.custom_tool_use_id);else if(t.type==="user.tool_confirmation"){if(!b(this,Er,"f").has(t.tool_use_id))b(this,xl,"f").set(t.tool_use_id,t.result)}},vF=async function(t){switch(b(this,$r,"f").noteEvent(t),t.type){case"agent.tool_use":case"agent.custom_tool_use":if(!b(this,El,"f").has(t.id))b(this,El,"f").add(t.id),await b(this,Nt,"m",_w).call(this,t);return!1;case"user.tool_confirmation":return await b(this,Nt,"m",wF).call(this,t),!1;case"user.tool_result":return b(this,Er,"f").add(t.tool_use_id),!1;case"user.custom_tool_result":return b(this,Er,"f").add(t.custom_tool_use_id),!1;case"session.status_terminated":case"session.deleted":return b(this,Jt,"f").info("session terminated",{component:"session-tool-runner",session_id:this.sessionId}),b(this,hn,"f").abort(),!0;default:return!1}},_w=async function(t){let n=t.evaluated_permission,r=n==="deny"?"deny":b(this,xl,"f").get(t.id);if(r===void 0){if(n===void 0||n==="allow")await b(this,Nt,"m",yw).call(this,t,void 0);else if(!b(this,di,"f").has(t.id))b(this,Jt,"f").info("tool call awaiting confirmation; holding",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),b(this,di,"f").set(t.id,t),b(this,$r,"f").block(t.id);return}await b(this,Nt,"m",p_).call(this,t,r)},wF=async function(t){b(this,xl,"f").set(t.tool_use_id,t.result);let n=b(this,di,"f").get(t.tool_use_id);if(n===void 0)return;await b(this,Nt,"m",p_).call(this,n,t.result)},p_=async function(t,n){let r=b(this,di,"f").delete(t.id);if(n==="allow"){if(b(this,Jt,"f").info("tool call confirmed",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),!r)b(this,$r,"f").block(t.id);try{await b(this,Nt,"m",yw).call(this,t,"allow")}finally{b(this,$r,"f").unblock(t.id)}return}if(r)b(this,$r,"f").unblock(t.id);b(this,Er,"f").add(t.id),b(this,Jt,"f").info("tool call denied; not executing",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),b(this,Nt,"m",f_).call(this,{event:t,toolUseId:t.id,name:t.name,isError:!1,posted:!1,confirmation:"deny"})},f_=function(t){b(this,bl,"f").push(t)},yw=async function(t,n){var r,o;if(b(this,Er,"f").has(t.id))return;b(this,Jt,"f").info("executing tool",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),N(this,Es,(r=b(this,Es,"f"),r++,r),"f");try{let s=b(this,h_,"f").get(t.name);if(!s){b(this,Jt,"f").info("tool not owned by this runner; leaving the tool_use_id pending for its owner",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),b(this,Nt,"m",f_).call(this,{event:t,toolUseId:t.id,name:t.name,isError:!1,posted:!1,confirmation:n});return}let i,a,c=new AbortController,l=ya(b(this,hn,"f").signal,c),u=setTimeout(()=>c.abort(),Kle);try{let m=await SF(s,t.input,{toolUse:t,toolUseBlock:t,signal:c.signal});i=m.content,a=m.isError}finally{clearTimeout(u),l()}let p=Vle(t,a,qle(i)),f=await b(this,Nt,"m",AF).call(this,p,t.id);b(this,Nt,"m",f_).call(this,{event:t,result:p,toolUseId:t.id,name:t.name,isError:a,posted:f,confirmation:n})}finally{if(N(this,Es,(o=b(this,Es,"f"),o--,o),"f"),b(this,Es,"f")===0)b(this,Dp,"f")?.call(this)}},AF=async function(t,n){let r=b(this,hn,"f"),o;for(let s=0;s<CF;s++){r.signal.throwIfAborted();try{return await this.client.beta.sessions.events.send(this.sessionId,{events:[t]},b(this,Nt,"m",d_).call(this)),b(this,Er,"f").add(n),!0}catch(i){if(o=i,li(i))break;if(s<CF-1)await ao((s+1)*1000,r.signal)}}return b(this,Jt,"f").error("failed to send tool result",{tool_use_id:n,error:String(o)}),!1},RF=async function(){if(b(this,Es,"f")===0)return;if(await Promise.race([new Promise((t)=>N(this,Dp,t,"f")),ao(Gle)]),N(this,Dp,null,"f"),b(this,Es,"f")>0)b(this,Jt,"f").warn("drain timeout exceeded")}});var IF=O(()=>{jv()});function va(e){if(e.inputSchema.type!=="object")throw Error(`JSON schema for tool "${e.name}" must be an object, but got ${e.inputSchema.type}`);return{type:"custom",name:e.name,input_schema:e.inputSchema,description:e.description,run:e.run,parse:(t)=>t,...e.close?{close:e.close}:{}}}var DF=O(()=>{Sw();IF()});function vl(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}import*as xr from"node:fs/promises";import*as Dn from"node:path";import{randomUUID as Zle}from"node:crypto";async function Jle(e){try{return await xr.realpath(e)}catch{return e}}async function Xle(e){let t=[],n=e,r=0;for(;;){let o;try{o=await xr.realpath(n)}catch{let s=!1;try{s=(await xr.lstat(n)).isSymbolicLink()}catch{}if(s){if(++r>40)throw new ve(`path ${JSON.stringify(e)} has too many levels of symbolic links`);n=Dn.resolve(Dn.dirname(n),await xr.readlink(n));continue}let i=Dn.dirname(n);if(i===n)return e;t.push(Dn.basename(n)),n=i;continue}return t.length?Dn.join(o,...t.reverse()):o}}async function LF(e,t,n){let r=n?.allowOutside??!1,o=await Jle(Dn.resolve(e)),s=Dn.resolve(o,t);if(r)return s;let i=await Xle(s);if(i!==o&&!i.startsWith(o+Dn.sep))throw new ve(`path ${JSON.stringify(t)} escapes workdir`);return i}async function bw(e,t){let n=Dn.dirname(e),r=Dn.join(n,`.tmp-${process.pid}-${Zle()}`),o;try{o=await xr.open(r,"wx",Yle),await o.writeFile(t,"utf-8"),await o.sync(),await o.close(),o=void 0,await xr.rename(r,e)}catch(s){if(o)await o.close().catch(()=>{});throw await xr.unlink(r).catch(()=>{}),s}}function Np(e,t){switch(e?.code){case"ENOENT":return`${t}: no such file or directory`;case"EACCES":case"EPERM":return`${t}: permission denied`;case"ENOTDIR":return`${t}: not a directory`;case"EISDIR":return`${t}: is a directory`;case"ELOOP":return`${t}: too many levels of symbolic links`;case"ENAMETOOLONG":return`${t}: file name too long`;case"ENOSPC":return`${t}: no space left on device`;case"EMFILE":case"ENFILE":return`${t}: too many open files`;default:return`${t}: ${e instanceof Error?e.message:String(e)}`}}var Lp=493,Yle=420;var Ew=O(()=>{ba()});import*as Yn from"node:fs/promises";import*as NF from"node:fs";import*as gn from"node:path";import{execFile as Qle}from"node:child_process";import{promisify as eue}from"node:util";import{Readable as tue}from"node:stream";import{pipeline as nue}from"node:stream/promises";async function MF(e){let{client:t,sessionId:n}=e;if(!t||!n)return async()=>{};let r=Ke(t),o=await t.beta.sessions.retrieve(n),s=gn.resolve(e.workdir,"skills"),i=[];for(let a of o.agent.skills)try{let c=await vw(t,a.skill_id,a.version),l=await t.beta.skills.versions.retrieve(c,{skill_id:a.skill_id}),u=gn.basename(l.name.trim());if(u===""||u==="."||u==="..")u=a.skill_id;let p=gn.resolve(s,u);if(p!==s&&!p.startsWith(s+gn.sep)){r.warn("skill name escapes the skills dir; skipping",{component:"agent-tool-context",name:l.name});continue}let f=await t.beta.skills.versions.download(c,{skill_id:a.skill_id});await Yn.rm(p,{recursive:!0,force:!0}),await Yn.mkdir(p,{recursive:!0,mode:Lp}),i.push(p),await ww(f,p),r.info("downloaded skill",{component:"agent-tool-context",skill_id:a.skill_id,version:c,dest:p})}catch(c){r.warn("failed to download skill",{component:"agent-tool-context",skill_id:a.skill_id,error:String(c)})}return async()=>{for(let a of i)await Yn.rm(a,{recursive:!0,force:!0}).catch((c)=>{r.warn("failed to clean up skill",{component:"agent-tool-context",dest:a,error:String(c)})})}}async function vw(e,t,n){if(/^\d+$/.test(n))return n;let r;for await(let o of e.beta.skills.versions.list(t))if(/^\d+$/.test(o.version)&&(r===void 0||BigInt(o.version)>BigInt(r)))r=o.version;if(r===void 0)throw new j(`skill ${JSON.stringify(t)} has no concrete version to resolve ${JSON.stringify(n)} against`);return r}function oue(e){for(let t of e.split(`
17
+ `)){let n=t.trim();if(!n)continue;if(gn.isAbsolute(n)||n.split(/[\\/]/).includes(".."))throw new j(`refusing to extract unsafe archive member: ${n}`)}}function sue(e){for(let t of e.split(`
18
+ `)){let n=t.trimStart()[0];if(n==="l"||n==="h"||n==="b"||n==="c"||n==="p"||n==="s")throw new j("refusing to extract archive with symlink/hardlink/device member")}}async function xw(e,t){try{let{stdout:n}=await rue(e,t);return n}catch(n){if(n!=null&&typeof n==="object"&&n.code==="ENOENT")throw new j(`skill extraction requires the \`${e}\` command, but it was not found on PATH`);throw n}}function iue(e){let t,n=!1;for(let r of e.split(`
19
+ `)){let o=r.trim().split("/").filter((i)=>i!==""&&i!==".");if(o.length===0)continue;let s=o[0];if(t===void 0)t=s;else if(s!==t)return"";if(o.length>1)n=!0}return t!==void 0&&n?t:""}async function ww(e,t){let n=gn.join(t,`.skill-archive-${process.pid}-${Date.now()}`);if(!e.body)throw new j("skill download response had no body");await nue(tue.fromWeb(e.body),NF.createWriteStream(n));let r=gn.join(gn.dirname(t),`.skill-stage-${process.pid}-${Date.now()}`);try{let o=await aue(n,4),s=o.length>=4&&o[0]===80&&o[1]===75&&o[2]===3&&o[3]===4,i=s?"unzip":"tar",a=await xw(i,s?["-Z1",n]:["-tf",n]);oue(a),sue(await xw(i,s?["-Z",n]:["-tvf",n]));let c=iue(a);await Yn.mkdir(r,{recursive:!0,mode:Lp}),await xw(i,s?["-oq",n,"-d",r]:["-xf",n,"-C",r]);let l=c?gn.join(r,c):r;for(let u of await Yn.readdir(l))await Yn.rename(gn.join(l,u),gn.join(t,u))}finally{await Yn.rm(n,{force:!0}),await Yn.rm(r,{recursive:!0,force:!0})}}async function aue(e,t){let n=await Yn.open(e,"r");try{let r=Buffer.alloc(t),{bytesRead:o}=await n.read(r,0,t,0);return r.subarray(0,o)}finally{await n.close()}}var rue;var UF=O(()=>{gt();Jo();Ew();rue=eue(Qle)});var YF={};on(YF,{BashSession:()=>Cw,betaAgentToolset20260401:()=>fue,betaBashTool:()=>KF,betaEditTool:()=>VF,betaGlobTool:()=>qF,betaGrepTool:()=>ZF,betaReadTool:()=>GF,betaWriteTool:()=>WF,extractSkillArchive:()=>ww,resolvePath:()=>wl,resolveSkillVersion:()=>vw,setupSkills:()=>MF});import*as Xt from"node:fs/promises";import*as y_ from"node:fs";import*as kt from"node:path";import*as Tw from"node:child_process";import*as zF from"node:crypto";import*as jF from"node:readline";function BF(e){return e===void 0?cue:e}function fue(e){return[KF(e),GF(e),WF(e),VF(e),qF(e),ZF(e)]}function wl(e,t){return LF(e.workdir,t,{allowOutside:e.unrestrictedPaths??!1})}function mue(){let e={};for(let[t,n]of Object.entries(process.env)){if(t.startsWith("ANTHROPIC_"))continue;e[t]=n}return e}class Cw{constructor(e,t=mue()){__.add(this),Ln.set(this,void 0),Jn.set(this,""),Mp.set(this,!1),wa.set(this,!1),zr.set(this,null),N(this,Ln,Tw.spawn("/bin/bash",["--noprofile","--norc"],{cwd:e,env:{...t,PS1:"",PS2:"",TERM:"dumb"},stdio:["pipe","pipe","pipe"],detached:!0}),"f"),b(this,Ln,"f").stdout.setEncoding("utf8"),b(this,Ln,"f").stderr.setEncoding("utf8"),b(this,Ln,"f").stdout.on("data",(n)=>b(this,__,"m",Aw).call(this,n)),b(this,Ln,"f").stderr.on("data",(n)=>b(this,__,"m",Aw).call(this,n)),b(this,Ln,"f").once("close",()=>{N(this,wa,!0,"f");let n=b(this,zr,"f");N(this,zr,null,"f"),n?.resolve()})}get closed(){return b(this,wa,"f")}async exec(e,t={}){if(b(this,wa,"f"))throw new j("bash session terminated");let n=t.timeoutMs??HF,r=t.signal;if(r?.aborted)throw new j("bash command aborted");N(this,Jn,"","f"),N(this,Mp,!1,"f");let o=`__ANT_CMD_${zF.randomUUID()}_DONE__`,s=`${o.slice(0,8)}''${o.slice(8)}`,i=`{ ${e}
20
+ } </dev/null 2>&1; printf '\\n${s}%d\\n' $?
21
+ `;if(b(this,Ln,"f").stdin.write(i),b(this,Jn,"f").indexOf(o)<0){let{promise:f,resolve:m}=vl();N(this,zr,{sentinel:o,resolve:m},"f");let h,y;try{await Promise.race([f,new Promise((_,E)=>{h=setTimeout(()=>E(new j(`bash command timed out after ${n}ms`)),n)}),new Promise((_,E)=>{if(!r)return;y=()=>E(new j("bash command aborted")),r.addEventListener("abort",y,{once:!0})})])}finally{if(h)clearTimeout(h);if(y&&r)r.removeEventListener("abort",y);N(this,zr,null,"f")}}let a=b(this,Jn,"f").indexOf(o);if(a<0)throw new j("bash session terminated");let l=b(this,Jn,"f").slice(a+o.length).match(/^(-?\d+)/),u=l?parseInt(l[1],10):-1,p=b(this,Jn,"f").slice(0,a).replace(due,"").replace(/\n+$/,"");if(b(this,Mp,"f"))p=`[output truncated]
22
+ ${p}`;return{output:p,exitCode:u}}close(){if(b(this,wa,"f"))return;N(this,wa,!0,"f");let e=b(this,zr,"f");N(this,zr,null,"f"),e?.resolve(),b(this,Ln,"f").stdout.destroy(),b(this,Ln,"f").stderr.destroy(),b(this,Ln,"f").stdin.destroy();try{process.kill(-b(this,Ln,"f").pid,"SIGKILL")}catch{b(this,Ln,"f").kill("SIGKILL")}b(this,Ln,"f").unref()}}function KF(e){let t,n=Promise.resolve();return va({name:"bash",description:"Run a bash command in a persistent shell. State (cwd, env vars) persists across calls.",inputSchema:{type:"object",properties:{command:{type:"string",description:"The command to run"},restart:{type:"boolean",description:"Restart the persistent shell before running"},timeout_ms:{type:"integer",description:"Per-call timeout in milliseconds"}}},run:async({command:r,restart:o,timeout_ms:s},i)=>{let a=n,c=vl();n=c.promise;try{await a}catch{}try{if(o)t?.close(),t=void 0;if(!r){if(o)return"bash session restarted";throw new ve("bash: command is required")}t??(t=new Cw(e.workdir,e.env));try{let{output:l,exitCode:u}=await t.exec(r,{timeoutMs:s??HF,signal:i?.signal});if(u!==0)throw new ve(l||`exit ${u}`);return l}catch(l){if(l instanceof ve)throw l;throw t.close(),t=void 0,new ve(`bash: ${l instanceof Error?l.message:String(l)}`)}}finally{c.resolve()}},close:()=>{t?.close(),t=void 0}})}function GF(e){return va({name:"read",description:"Read a UTF-8 text file relative to the workdir.",inputSchema:{type:"object",properties:{file_path:{type:"string"},view_range:{type:"array",items:{type:"integer"},description:"[start_line, end_line] 1-indexed inclusive"}},required:["file_path"]},run:async({file_path:t,view_range:n})=>{if(!t)throw new ve("read: file_path is required");let r=await wl(e,t),o;try{let u=await Xt.stat(r);if(!u.isFile())throw new ve(`read: ${t} is not a regular file`);let p=BF(e.maxFileBytes);if(p!==null&&u.size>p)throw new ve(`read: ${t} is ${u.size} bytes, exceeds ${p}-byte limit. Use bash (head/tail/sed) to read a slice.`);o=await Xt.readFile(r,"utf8")}catch(u){if(u instanceof ve)throw u;throw new ve(`read: ${Np(u,t)}`)}if(!n)return o;if(n.length!==2)throw new ve("read: view_range must be [start_line, end_line]");let[s,i]=n,a=o.split(`
23
+ `),c=Math.max(0,s-1),l=i>0?i:a.length;return a.slice(c,l).join(`
24
+ `)}})}function WF(e){return va({name:"write",description:"Write a UTF-8 text file relative to the workdir, creating parent directories as needed.",inputSchema:{type:"object",properties:{file_path:{type:"string"},content:{type:"string"}},required:["file_path","content"]},run:async({file_path:t,content:n})=>{if(!t)throw new ve("write: file_path is required");let r=await wl(e,t);try{await Xt.mkdir(kt.dirname(r),{recursive:!0,mode:Lp}),await bw(r,n??"")}catch(o){throw new ve(`write: ${Np(o,t)}`)}return`wrote ${Buffer.byteLength(n??"")} bytes to ${t}`}})}function VF(e){return va({name:"edit",description:"Replace old_string with new_string in a file. old_string must be unique unless replace_all.",inputSchema:{type:"object",properties:{file_path:{type:"string"},old_string:{type:"string"},new_string:{type:"string"},replace_all:{type:"boolean"}},required:["file_path","old_string","new_string"]},run:async({file_path:t,old_string:n,new_string:r,replace_all:o})=>{if(!t)throw new ve("edit: file_path is required");if(!n)throw new ve("edit: old_string is required");let s=await wl(e,t),i;try{let l=await Xt.stat(s);if(!l.isFile())throw new ve(`edit: ${t} is not a regular file`);let u=BF(e.maxFileBytes);if(u!==null&&l.size>u)throw new ve(`edit: ${t} is ${l.size} bytes, exceeds ${u}-byte limit. Use bash (sed/awk) to edit a large file.`);i=await Xt.readFile(s,"utf8")}catch(l){if(l instanceof ve)throw l;throw new ve(`edit: ${Np(l,t)}`)}let a=i.split(n).length-1;if(a===0)throw new ve(`edit: old_string not found in ${t}`);let c;if(o)c=i.split(n).join(r);else{if(a>1)throw new ve(`edit: old_string appears ${a} times in ${t} (must be unique)`);c=i.replace(n,()=>r)}try{await bw(s,c)}catch(l){throw new ve(`edit: write: ${Np(l,t)}`)}return`edited ${t} (${o?a:1} replacement(s))`}})}function qF(e){return va({name:"glob",description:"Match files under the workdir against a glob pattern. Results are mtime-sorted, newest first.",inputSchema:{type:"object",properties:{pattern:{type:"string"},path:{type:"string",description:"Directory to search in. Defaults to the workdir."}},required:["pattern"]},run:async({pattern:t,path:n})=>{if(!t)throw new ve("glob: pattern is required");let r=kt.resolve(e.workdir),o=t;if(kt.isAbsolute(t)){if(!e.unrestrictedPaths)throw new ve("glob: absolute pattern not permitted");r=kt.parse(t).root,o=kt.relative(r,t)}else if(n)r=await wl(e,n);if(!e.unrestrictedPaths&&o.split(/[\\/]/).includes(".."))throw new ve('glob: ".." is not permitted in the pattern');let s=e.unrestrictedPaths?r:await Xt.realpath(r).catch(()=>r),i=[];try{for await(let a of pue(o,{cwd:r,withFileTypes:!0,exclude:(c)=>c.name===".git"||c.name==="node_modules"})){if(!a.isFile())continue;let c=kt.join(a.parentPath,a.name);if(!e.unrestrictedPaths){let u;try{u=await Xt.realpath(c)}catch{continue}if(!_ue(s,u))continue}let l=0;try{l=(await Xt.stat(c)).mtimeMs}catch{}i.push({path:c,mtime:l})}}catch(a){throw new ve(`glob: ${a instanceof Error?a.message:String(a)}`)}if(i.length===0)return"no matches";return i.sort((a,c)=>c.mtime-a.mtime),i.slice(0,uue).map((a)=>a.path).join(`
25
+ `)}})}function ZF(e){return va({name:"grep",description:"Search file contents for a regex. Uses ripgrep if available, otherwise a built-in walker.",inputSchema:{type:"object",properties:{pattern:{type:"string"},path:{type:"string"}},required:["pattern"]},run:async({pattern:t,path:n},r)=>{if(!t)throw new ve("grep: pattern is required");let o=kt.resolve(e.workdir);if(n)o=await wl(e,n);let s=await Eue();return s?hue(s,t,o,r?.signal):gue(t,o,r?.signal)}})}function hue(e,t,n,r){return new Promise((o,s)=>{let i=Tw.spawn(e,["-n","--no-heading","-e",t,"--",n],{...r?{signal:r}:{}}),a="",c="",l=!1;i.stdout.on("data",(u)=>{if(l)return;if(a+=u,a.length>Up)l=!0,a=a.slice(0,Up),i.kill("SIGKILL")}),i.stderr.on("data",(u)=>c+=u),i.on("close",(u)=>{if(r?.aborted)return s(new ve("grep: aborted"));if(l)return o(a+`
26
+ [output truncated at ${Up} bytes]`);if(u===0)return o(a);if(u===1)return o("no matches");s(new ve(`grep: rg failed: ${c||`exit ${u}`}`))}),i.on("error",(u)=>{if(r?.aborted)return s(new ve("grep: aborted"));s(new ve(`grep: rg failed: ${u.message}`))})})}async function gue(e,t,n){let r;try{r=new RegExp(e)}catch(c){throw new ve(`grep: invalid regex: ${c instanceof Error?c.message:String(c)}`)}let o=[],s=Up,i=(c)=>{if(s-=c.length+1,s<0)return o.push(`[output truncated at ${Up} bytes]`),!1;return o.push(c),!0};if((await Xt.stat(t).catch(()=>null))?.isFile())await $F(t,r,i);else await bue(t,"",(c)=>$F(kt.join(t,c),r,i),n);if(n?.aborted)throw new ve("grep: aborted");if(o.length===0)return"no matches";return o.join(`
27
+ `)}async function $F(e,t,n){let r=y_.createReadStream(e,{encoding:"utf8"}),o=jF.createInterface({input:r,crlfDelay:1/0}),s=0;try{for await(let i of o){if(s++,i.length>lue)continue;if(t.test(i)&&!n(`${e}:${s}:${i}`))return!1}}catch{}finally{r.destroy()}return!0}function _ue(e,t){let n=kt.relative(e,t);return n===""||!n.startsWith(".."+kt.sep)&&n!==".."&&!kt.isAbsolute(n)}async function bue(e,t,n,r){let o=Sue;async function s(i,a){if(a>yue)return!0;if(r?.aborted)return!1;let c;try{c=await Xt.readdir(kt.join(e,i),{withFileTypes:!0})}catch{return!0}for(let l of c){if(l.name===".git"||l.name==="node_modules")continue;if(o--<=0)return!1;if(r?.aborted)return!1;let u=i?kt.join(i,l.name):l.name;if(l.isDirectory()){if(!await s(u,a+1))return!1}else if(l.isFile()){if(await n(u)===!1)return!1}}return!0}await s(t,0)}async function Eue(){let e=(process.env.PATH??"").split(kt.delimiter);for(let t of e){let n=kt.join(t,"rg");try{return await Xt.access(n,y_.constants.X_OK),n}catch{}}return null}var __,Ln,Jn,Mp,wa,zr,Aw,FF=102400,HF=120000,cue=262144,Up=102400,lue=2000,uue=200,due,pue,yue=40,Sue=50000;var JF=O(()=>{qn();gt();ba();DF();Ew();UF();due=/\x1b\[[0-9;?]*[ -/]*[@-~]/g,pue=Xt.glob;Ln=new WeakMap,Jn=new WeakMap,Mp=new WeakMap,wa=new WeakMap,zr=new WeakMap,__=new WeakSet,Aw=function(t){if(N(this,Jn,b(this,Jn,"f")+t,"f"),b(this,Jn,"f").length>FF)N(this,Jn,b(this,Jn,"f").slice(b(this,Jn,"f").length-FF),"f"),N(this,Mp,!0,"f");if(b(this,zr,"f")&&b(this,Jn,"f").indexOf(b(this,zr,"f").sentinel)>=0){let n=b(this,zr,"f");N(this,zr,null,"f"),n.resolve()}}});class $p{constructor(e){S_.add(this),Fp.set(this,void 0),this.client=e.client,this.environmentId=e.environmentId,this.environmentKey=e.environmentKey,this.tools=e.tools,this.workdir=e.workdir??process.cwd(),this.unrestrictedPaths=e.unrestrictedPaths,this.maxFileBytes=e.maxFileBytes,this.maxIdleMs=e.maxIdleMs,this.workerId=e.workerId,this.requestOptions=e.requestOptions,N(this,Fp,e.signal,"f")}async run(e){let{environmentId:t,environmentKey:n}=this;if(t===void 0||n===void 0)throw new j("EnvironmentWorker.run: environmentId and environmentKey are required to poll for work");let r=e??b(this,Fp,"f"),o=new Sa({client:this.client,environmentId:t,environmentKey:n,...this.workerId!==void 0?{workerId:this.workerId}:{},...r?{signal:r}:{},...this.requestOptions!==void 0?{requestOptions:this.requestOptions}:{},autoStop:!1});for await(let s of o)await b(this,S_,"m",kw).call(this,s,n,o.signal)}async handleItem(e){let t=e?.workId??Le("ANTHROPIC_WORK_ID"),n=e?.environmentId??Le("ANTHROPIC_ENVIRONMENT_ID"),r=e?.sessionId??Le("ANTHROPIC_SESSION_ID"),o=e?.environmentKey??this.environmentKey??Le("ANTHROPIC_ENVIRONMENT_KEY");if(!t)throw new j("handleItem: workId is required — pass it or set ANTHROPIC_WORK_ID");if(!n)throw new j("handleItem: environmentId is required — pass it or set ANTHROPIC_ENVIRONMENT_ID");if(!r)throw new j("handleItem: sessionId is required — pass it or set ANTHROPIC_SESSION_ID");if(!o)throw new j("handleItem: environmentKey is required — pass it, construct the worker with it, or set ANTHROPIC_ENVIRONMENT_KEY");let s={id:t,environment_id:n,data:{type:"session",id:r}};await b(this,S_,"m",kw).call(this,s,o,e?.signal??b(this,Fp,"f"))}}async function vue(e,t,n,r){try{await e.beta.environments.work.stop(t.id,{environment_id:t.environment_id,force:!0},{...r,headers:k([r?.headers])})}catch(o){if(!ci(o,409))n.error("force-stop on exit failed",{work_id:t.id,error:String(o)})}}async function wue(e,t,n,r,o){let s=XF,i=xue,a=async()=>{try{let c=await e.beta.environments.work.heartbeat(t.id,{environment_id:t.environment_id,expected_last_heartbeat:i},{...o,headers:k([o?.headers]),signal:n.signal});if(i=c.last_heartbeat,c.ttl_seconds>0)s=Math.max(1000,Math.min(c.ttl_seconds*1000/2,XF));if(c.state==="stopping"||c.state==="stopped")r.info("heartbeat signals shutdown",{work_id:t.id,state:c.state}),n.abort();if(!c.lease_extended)r.warn("lease not extended, shutting down",{work_id:t.id}),n.abort()}catch(c){if(n.signal.throwIfAborted(),li(c))throw r.error("permanent heartbeat failure",{work_id:t.id,error:String(c)}),n.abort(),c;r.warn("transient heartbeat failure",{work_id:t.id,error:String(c)})}};await a();while(!n.signal.aborted)await ao(s,n.signal),n.signal.throwIfAborted(),await a()}var S_,Fp,kw,XF=30000,xue="NO_HEARTBEAT";var Rw=O(()=>{qn();gt();Jo();kp();Ne();g_();c_();mw();Fp=new WeakMap,S_=new WeakSet,kw=async function(t,n,r){let o=Ke(this.client),s=r_(this.client,{authToken:n,helper:"environments-worker"}),i=t.data.id,a={workdir:this.workdir,client:this.client,sessionId:i,...this.unrestrictedPaths!==void 0?{unrestrictedPaths:this.unrestrictedPaths}:{},...this.maxFileBytes!==void 0?{maxFileBytes:this.maxFileBytes}:{}},c=await Promise.resolve().then(() => (JF(),YF)),l=async()=>{};try{l=await c.setupSkills(a)}catch(h){o.warn("skill setup failed",{session_id:i,work_id:t.id,error:String(h)})}let u=typeof this.tools==="function"?this.tools(a):this.tools??c.betaAgentToolset20260401(a),p=new AbortController,f=ya(r,p),m=wue(s,t,p,o,this.requestOptions).catch((h)=>{if(!p.signal.aborted)o.error("heartbeat loop failed",{work_id:t.id,error:String(h)});p.abort()});try{let h=new xa(i,{client:s,tools:u,...this.maxIdleMs!==void 0?{maxIdleMs:this.maxIdleMs}:{},...this.requestOptions!==void 0?{requestOptions:this.requestOptions}:{},signal:p.signal});for await(let y of h);}finally{p.abort(),f(),await m,await l().catch((h)=>{o.warn("skill cleanup failed",{session_id:i,work_id:t.id,error:String(h)})}),await vue(s,t,o,this.requestOptions)}}});var Aa;var Ow=O(()=>{et();Ne();at();c_();Rw();c_();Rw();Aa=class Aa extends oe{retrieve(e,t,n){let{environment_id:r,betas:o}=t;return this._client.get(M`/v1/environments/${r}/work/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}update(e,t,n){let{environment_id:r,betas:o,...s}=t;return this._client.post(M`/v1/environments/${r}/work/${e}?beta=true`,{body:s,...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(M`/v1/environments/${e}/work?beta=true`,Ae,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}ack(e,t,n){let{environment_id:r,betas:o}=t;return this._client.post(M`/v1/environments/${r}/work/${e}/ack?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}heartbeat(e,t,n){let{environment_id:r,desired_ttl_seconds:o,expected_last_heartbeat:s,betas:i}=t;return this._client.post(M`/v1/environments/${r}/work/${e}/heartbeat?beta=true`,{query:{desired_ttl_seconds:o,expected_last_heartbeat:s},...n,headers:k([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}poll(e,t={},n){let{betas:r,"Anthropic-Worker-ID":o,...s}=t??{};return this._client.get(M`/v1/environments/${e}/work/poll?beta=true`,{query:s,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...o!=null?{"Anthropic-Worker-ID":o}:void 0},n?.headers])})}stats(e,t={},n){let{betas:r}=t??{};return this._client.get(M`/v1/environments/${e}/work/stats?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}stop(e,t,n){let{environment_id:r,betas:o,...s}=t;return this._client.post(M`/v1/environments/${r}/work/${e}/stop?beta=true`,{body:s,...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}poller(e){return new Sa({...e,client:this._client})}worker(e){return new $p({...e,client:this._client})}};Aa.WorkPoller=Sa;Aa.EnvironmentWorker=$p});var Al;var Pw=O(()=>{Ow();Ow();et();Ne();at();Al=class Al extends oe{constructor(){super(...arguments);this.work=new Aa(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/environments?beta=true",{body:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(M`/v1/environments/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}update(e,t,n){let{betas:r,...o}=t;return this._client.post(M`/v1/environments/${e}?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/environments?beta=true",Ae,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(M`/v1/environments/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(M`/v1/environments/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}};Al.Work=Aa});var zp;var Iw=O(()=>{et();Ne();at();zp=class zp extends oe{create(e,t,n){let{view:r,betas:o,...s}=t;return this._client.post(M`/v1/memory_stores/${e}/memories?beta=true`,{query:{view:r},body:s,...n,headers:k([{"anthropic-beta":[...o??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}retrieve(e,t,n){let{memory_store_id:r,betas:o,...s}=t;return this._client.get(M`/v1/memory_stores/${r}/memories/${e}?beta=true`,{query:s,...n,headers:k([{"anthropic-beta":[...o??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}update(e,t,n){let{memory_store_id:r,view:o,betas:s,...i}=t;return this._client.post(M`/v1/memory_stores/${r}/memories/${e}?beta=true`,{query:{view:o},body:i,...n,headers:k([{"anthropic-beta":[...s??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(M`/v1/memory_stores/${e}/memories?beta=true`,Ae,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}delete(e,t,n){let{memory_store_id:r,expected_content_sha256:o,betas:s}=t;return this._client.delete(M`/v1/memory_stores/${r}/memories/${e}?beta=true`,{query:{expected_content_sha256:o},...n,headers:k([{"anthropic-beta":[...s??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}}});var jp;var Dw=O(()=>{et();Ne();at();jp=class jp extends oe{retrieve(e,t,n){let{memory_store_id:r,betas:o,...s}=t;return this._client.get(M`/v1/memory_stores/${r}/memory_versions/${e}?beta=true`,{query:s,...n,headers:k([{"anthropic-beta":[...o??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(M`/v1/memory_stores/${e}/memory_versions?beta=true`,Ae,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}redact(e,t,n){let{memory_store_id:r,betas:o}=t;return this._client.post(M`/v1/memory_stores/${r}/memory_versions/${e}/redact?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}}});var Ta;var Lw=O(()=>{Iw();Iw();Dw();Dw();et();Ne();at();Ta=class Ta extends oe{constructor(){super(...arguments);this.memories=new zp(this._client),this.memoryVersions=new jp(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/memory_stores?beta=true",{body:r,...t,headers:k([{"anthropic-beta":[...n??[],"agent-memory-2026-07-22"].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(M`/v1/memory_stores/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}update(e,t,n){let{betas:r,...o}=t;return this._client.post(M`/v1/memory_stores/${e}?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/memory_stores?beta=true",Ae,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"agent-memory-2026-07-22"].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(M`/v1/memory_stores/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(M`/v1/memory_stores/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}};Ta.Memories=zp;Ta.MemoryVersions=jp});var Tl=O(()=>{gt()});var Cl;var Nw=O(()=>{gt();Wv();Cl=class Cl{constructor(e,t){this.iterator=e,this.controller=t}async*decoder(){let e=new ii;for await(let t of this.iterator)for(let n of e.decode(t))yield JSON.parse(n);for(let t of e.flush())yield JSON.parse(t)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(e,t){if(!e.body){if(t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new j("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new j("Attempted to iterate over a response with no body")}return new Cl(ap(e.body),t)}}});var Hp;var Mw=O(()=>{et();Ne();Nw();Tl();at();Hp=class Hp extends oe{create(e,t){let{betas:n,user_profile_id:r,...o}=e;return this._client.post("/v1/messages/batches?beta=true",{body:o,...t,headers:k([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString(),...r!=null?{"anthropic-user-profile-id":r}:void 0},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(M`/v1/messages/batches/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/messages/batches?beta=true",lo,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(M`/v1/messages/batches/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},n?.headers])})}cancel(e,t={},n){let{betas:r}=t??{};return this._client.post(M`/v1/messages/batches/${e}/cancel?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},n?.headers])})}async results(e,t={},n){let r=await this.retrieve(e);if(!r.results_url)throw new j(`No batch \`results_url\`; Has it finished processing? ${r.processing_status} - ${r.id}`);let{betas:o}=t??{};return this._client.get(r.results_url,{...n,headers:k([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},n?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((s,i)=>Cl.fromResponse(i.response,i.controller))}}});var b_;var Uw=O(()=>{b_={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192}});function QF(e){return e?.output_format??e?.output_config?.format}function Fw(e,t,n){let r=QF(t);if(!t||!("parse"in(r??{})))return{...e,content:e.content.map((o)=>{if(o.type==="text"){let s=Object.defineProperty({...o},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(s,"parsed",{get(){return n.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return o}),parsed_output:null};return $w(e,t,n)}function $w(e,t,n){let r=null,o=e.content.map((s)=>{if(s.type==="text"){let i=Pue(t,s.text);if(r===null)r=i;let a=Object.defineProperty({...s},"parsed_output",{value:i,enumerable:!1});return Object.defineProperty(a,"parsed",{get(){return n.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),i},enumerable:!1})}return s});return{...e,content:o,parsed_output:r}}function Pue(e,t){let n=QF(e);if(n?.type!=="json_schema")return null;try{if("parse"in n)return n.parse(t);return JSON.parse(t)}catch(r){throw new j(`Failed to parse structured output: ${r}`)}}var zw=O(()=>{gt()});var jw=O(()=>{dp()});var Iue=(e)=>{let t=0,n=[];while(t<e.length){let r=e[t];if(r==="\\"){t++;continue}if(r==="{"){n.push({type:"brace",value:"{"}),t++;continue}if(r==="}"){n.push({type:"brace",value:"}"}),t++;continue}if(r==="["){n.push({type:"paren",value:"["}),t++;continue}if(r==="]"){n.push({type:"paren",value:"]"}),t++;continue}if(r===":"){n.push({type:"separator",value:":"}),t++;continue}if(r===","){n.push({type:"delimiter",value:","}),t++;continue}if(r==='"'){let a="",c=!1;r=e[++t];while(r!=='"'){if(t===e.length){c=!0;break}if(r==="\\"){if(t++,t===e.length){c=!0;break}a+=r+e[t],r=e[++t]}else a+=r,r=e[++t]}if(r=e[++t],!c)n.push({type:"string",value:a});continue}if(r&&/\s/.test(r)){t++;continue}let s=/[0-9]/;if(r&&s.test(r)||r==="-"||r==="."){let a="";if(r==="-")a+=r,r=e[++t];while(r&&(s.test(r)||r==="."||r==="e"||r==="E"||(r==="-"||r==="+")&&(a[a.length-1]==="e"||a[a.length-1]==="E")))a+=r,r=e[++t];n.push({type:"number",value:a});continue}let i=/[a-z]/i;if(r&&i.test(r)){let a="";while(r&&i.test(r)){if(t===e.length)break;a+=r,r=e[++t]}if(a=="true"||a=="false"||a==="null")n.push({type:"name",value:a});else{t++;continue}continue}t++}return n},kl=(e)=>{if(e.length===0)return e;let t=e[e.length-1];switch(t.type){case"separator":return e=e.slice(0,e.length-1),kl(e);break;case"number":let n=t.value[t.value.length-1];if(n==="."||n==="-"||n==="+"||n==="e"||n==="E")return e=e.slice(0,e.length-1),kl(e);case"string":let r=e[e.length-2];if(r?.type==="delimiter")return e=e.slice(0,e.length-1),kl(e);else if(r?.type==="brace"&&r.value==="{")return e=e.slice(0,e.length-1),kl(e);break;case"delimiter":return e=e.slice(0,e.length-1),kl(e);break}return e},Due=(e)=>{let t=[];if(e.map((n)=>{if(n.type==="brace")if(n.value==="{")t.push("}");else t.splice(t.lastIndexOf("}"),1);if(n.type==="paren")if(n.value==="[")t.push("]");else t.splice(t.lastIndexOf("]"),1)}),t.length>0)t.reverse().map((n)=>{if(n==="}")e.push({type:"brace",value:"}"});else if(n==="]")e.push({type:"paren",value:"]"})});return e},Lue=(e)=>{let t="";return e.map((n)=>{switch(n.type){case"string":t+='"'+n.value+'"';break;default:t+=n.value;break}}),t},e$=(e)=>JSON.parse(Lue(Due(kl(Iue(e)))));var t$=()=>{};function E_(e,t){let n={};for(let s of Object.keys(e))if(s!=="input")n[s]=e[s];Object.defineProperty(n,pi,{value:t,enumerable:!1,writable:!0});let r,o=!1;return Object.defineProperty(n,"input",{enumerable:!0,configurable:!0,get(){if(!o)r=t?e$(t):{},o=!0;return r}}),n}var pi="__json_buf";var Hw=O(()=>{t$()});function qw(e){return e.type==="tool_use"||e.type==="server_tool_use"||e.type==="mcp_tool_use"}function o$(e){}var Xn,fi,Rl,Bp,x_,Kp,Gp,v_,Wp,Qo,Vp,w_,A_,Ca,T_,C_,qp,Bw,n$,Zp,Kw,Gw,Ww,r$,Vw,Yp;var s$=O(()=>{qn();Xo();Tl();jw();zw();Hw();Yp=class Yp{constructor(e,t){Xn.add(this),this.messages=[],this.receivedMessages=[],fi.set(this,void 0),Rl.set(this,null),this.controller=new AbortController,Bp.set(this,void 0),x_.set(this,()=>{}),Kp.set(this,()=>{}),Gp.set(this,void 0),v_.set(this,()=>{}),Wp.set(this,()=>{}),Qo.set(this,{}),Vp.set(this,!1),w_.set(this,!1),A_.set(this,!1),Ca.set(this,!1),T_.set(this,void 0),C_.set(this,void 0),qp.set(this,void 0),Zp.set(this,(n)=>{if(N(this,w_,!0,"f"),Mr(n))n=new mn;if(n instanceof mn)return N(this,A_,!0,"f"),this._emit("abort",n);if(n instanceof j)return this._emit("error",n);if(n instanceof Error){let r=new j(n.message);return r.cause=n,this._emit("error",r)}return this._emit("error",new j(String(n)))}),N(this,Bp,new Promise((n,r)=>{N(this,x_,n,"f"),N(this,Kp,r,"f")}),"f"),N(this,Gp,new Promise((n,r)=>{N(this,v_,n,"f"),N(this,Wp,r,"f")}),"f"),b(this,Bp,"f").catch(()=>{}),b(this,Gp,"f").catch(()=>{}),N(this,Rl,e,"f"),N(this,qp,t?.logger??console,"f")}get response(){return b(this,T_,"f")}get request_id(){return b(this,C_,"f")}async withResponse(){N(this,Ca,!0,"f");let e=await b(this,Bp,"f");if(!e)throw Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let t=new Yp(null);return t._run(()=>t._fromReadableStream(e)),t}static createMessage(e,t,n,{logger:r}={}){let o=new Yp(t,{logger:r});for(let s of t.messages)o._addMessageParam(s);return N(o,Rl,{...t,stream:!0},"f"),o._run(()=>o._createMessage(e,{...t,stream:!0},{...n,headers:{...n?.headers,[e_]:"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},b(this,Zp,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){if(this.receivedMessages.push(e),t)this._emit("message",e)}async _createMessage(e,t,n){let r=n?.signal,o;if(r){if(r.aborted)this.controller.abort();o=this.controller.abort.bind(this.controller),r.addEventListener("abort",o)}try{b(this,Xn,"m",Kw).call(this);let{response:s,data:i}=await e.create({...t,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(s);for await(let a of i)b(this,Xn,"m",Gw).call(this,a);if(i.controller.signal?.aborted)throw new mn;b(this,Xn,"m",Ww).call(this)}finally{if(r&&o)r.removeEventListener("abort",o)}}_connected(e){if(this.ended)return;N(this,T_,e,"f"),N(this,C_,e?.headers.get("request-id"),"f"),b(this,x_,"f").call(this,e),this._emit("connect")}get ended(){return b(this,Vp,"f")}get errored(){return b(this,w_,"f")}get aborted(){return b(this,A_,"f")}abort(){this.controller.abort()}on(e,t){return(b(this,Qo,"f")[e]||(b(this,Qo,"f")[e]=[])).push({listener:t}),this}off(e,t){let n=b(this,Qo,"f")[e];if(!n)return this;let r=n.findIndex((o)=>o.listener===t);if(r>=0)n.splice(r,1);return this}once(e,t){return(b(this,Qo,"f")[e]||(b(this,Qo,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,n)=>{if(N(this,Ca,!0,"f"),e!=="error")this.once("error",n);this.once(e,t)})}async done(){N(this,Ca,!0,"f"),await b(this,Gp,"f")}get currentMessage(){return b(this,fi,"f")}async finalMessage(){return await this.done(),b(this,Xn,"m",Bw).call(this)}async finalText(){return await this.done(),b(this,Xn,"m",n$).call(this)}_emit(e,...t){if(b(this,Vp,"f"))return;if(e==="end")N(this,Vp,!0,"f"),b(this,v_,"f").call(this);let n=b(this,Qo,"f")[e];if(n)b(this,Qo,"f")[e]=n.filter((r)=>!r.once),n.forEach(({listener:r})=>r(...t));if(e==="abort"){let r=t[0];if(!b(this,Ca,"f")&&!n?.length)Promise.reject(r);b(this,Kp,"f").call(this,r),b(this,Wp,"f").call(this,r),this._emit("end");return}if(e==="error"){let r=t[0];if(!b(this,Ca,"f")&&!n?.length)Promise.reject(r);b(this,Kp,"f").call(this,r),b(this,Wp,"f").call(this,r),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",b(this,Xn,"m",Bw).call(this))}async _fromReadableStream(e,t){let n=t?.signal,r;if(n){if(n.aborted)this.controller.abort();r=this.controller.abort.bind(this.controller),n.addEventListener("abort",r)}try{b(this,Xn,"m",Kw).call(this),this._connected(null);let o=An.fromReadableStream(e,this.controller);for await(let s of o)b(this,Xn,"m",Gw).call(this,s);if(o.controller.signal?.aborted)throw new mn;b(this,Xn,"m",Ww).call(this)}finally{if(n&&r)n.removeEventListener("abort",r)}}[(fi=new WeakMap,Rl=new WeakMap,Bp=new WeakMap,x_=new WeakMap,Kp=new WeakMap,Gp=new WeakMap,v_=new WeakMap,Wp=new WeakMap,Qo=new WeakMap,Vp=new WeakMap,w_=new WeakMap,A_=new WeakMap,Ca=new WeakMap,T_=new WeakMap,C_=new WeakMap,qp=new WeakMap,Zp=new WeakMap,Xn=new WeakSet,Bw=function(){if(this.receivedMessages.length===0)throw new j("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},n$=function(){if(this.receivedMessages.length===0)throw new j("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter((n)=>n.type==="text").map((n)=>n.text);if(t.length===0)throw new j("stream ended without producing a content block with type=text");return t.join(" ")},Kw=function(){if(this.ended)return;N(this,fi,void 0,"f")},Gw=function(t){if(this.ended)return;let n=b(this,Xn,"m",r$).call(this,t);switch(this._emit("streamEvent",t,n),t.type){case"content_block_delta":{let r=n.content.at(-1);switch(t.delta.type){case"text_delta":{if(r.type==="text")this._emit("text",t.delta.text,r.text||"");break}case"citations_delta":{if(r.type==="text")this._emit("citation",t.delta.citation,r.citations??[]);break}case"input_json_delta":{if(qw(r)&&b(this,Qo,"f").inputJson?.length){let o;try{o=r.input}catch(s){b(this,Zp,"f").call(this,b(this,Xn,"m",Vw).call(this,r,s));break}this._emit("inputJson",t.delta.partial_json,o)}break}case"thinking_delta":{if(r.type==="thinking")this._emit("thinking",t.delta.thinking,r.thinking);break}case"signature_delta":{if(r.type==="thinking")this._emit("signature",r.signature);break}case"compaction_delta":{if(r.type==="compaction"&&r.content)this._emit("compaction",r.content);break}default:o$(t.delta)}break}case"message_stop":{this._addMessageParam(n),this._addMessage(Fw(n,b(this,Rl,"f"),{logger:b(this,qp,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{N(this,fi,n,"f");break}case"content_block_start":case"message_delta":break}},Ww=function(){if(this.ended)throw new j("stream has ended, this shouldn't happen");let t=b(this,fi,"f");if(!t)throw new j("request ended without sending any chunks");return N(this,fi,void 0,"f"),Fw(t,b(this,Rl,"f"),{logger:b(this,qp,"f")})},r$=function(t){let n=b(this,fi,"f");if(t.type==="message_start"){if(n)throw new j(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!n)throw new j(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return n;case"message_delta":if(n.container=t.delta.container,n.stop_reason=t.delta.stop_reason,n.stop_sequence=t.delta.stop_sequence,t.delta.stop_details!=null)n.stop_details=t.delta.stop_details;if(n.usage.output_tokens=t.usage.output_tokens,n.context_management=t.context_management,t.usage.input_tokens!=null)n.usage.input_tokens=t.usage.input_tokens;if(t.usage.cache_creation_input_tokens!=null)n.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens;if(t.usage.cache_read_input_tokens!=null)n.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens;if(t.usage.server_tool_use!=null)n.usage.server_tool_use=t.usage.server_tool_use;if(t.usage.iterations!=null)n.usage.iterations=t.usage.iterations;return n;case"content_block_start":if(n.content.push(t.content_block),t.content_block.type==="fallback")n.model=t.content_block.to.model;return n;case"content_block_delta":{let r=n.content.at(t.index);switch(t.delta.type){case"text_delta":{if(r?.type==="text")n.content[t.index]={...r,text:(r.text||"")+t.delta.text};break}case"citations_delta":{if(r?.type==="text")n.content[t.index]={...r,citations:[...r.citations??[],t.delta.citation]};break}case"input_json_delta":{if(r&&qw(r)){let o=(r[pi]||"")+t.delta.partial_json;n.content[t.index]=E_(r,o)}break}case"thinking_delta":{if(r?.type==="thinking")n.content[t.index]={...r,thinking:r.thinking+t.delta.thinking};break}case"signature_delta":{if(r?.type==="thinking")n.content[t.index]={...r,signature:t.delta.signature};break}case"compaction_delta":{if(r?.type==="compaction")n.content[t.index]={...r,content:(r.content||"")+t.delta.content,encrypted_content:t.delta.encrypted_content};break}default:o$(t.delta)}return n}case"content_block_stop":{let r=n.content.at(t.index);if(r&&qw(r)&&pi in r){let o;try{o=r.input}catch(s){o={},b(this,Zp,"f").call(this,b(this,Xn,"m",Vw).call(this,r,s))}Object.defineProperty(r,"input",{value:o,enumerable:!0,configurable:!0,writable:!0})}return n}}},Vw=function(t,n){let r=t[pi];return new j(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${n}. JSON: ${r}`)},Symbol.asyncIterator)](){let e=[],t=[],n=!1;return this.on("streamEvent",(r)=>{let o=t.shift();if(o)o.resolve(r);else e.push(r)}),this.on("end",()=>{n=!0;for(let r of t)r.resolve(void 0);t.length=0}),this.on("abort",(r)=>{n=!0;for(let o of t)o.reject(r);t.length=0}),this.on("error",(r)=>{n=!0;for(let o of t)o.reject(r);t.length=0}),{next:async()=>{if(!e.length){if(n)return{value:void 0,done:!0};return new Promise((o,s)=>t.push({resolve:o,reject:s})).then((o)=>o?{value:o,done:!1}:{value:void 0,done:!0})}return{value:e.shift(),done:!1}},return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new An(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var i$=1e5,a$=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
28
+ 1. Task Overview
29
+ The user's core request and success criteria
30
+ Any clarifications or constraints they specified
31
+ 2. Current State
32
+ What has been completed so far
33
+ Files created, modified, or analyzed (with paths if relevant)
34
+ Key outputs or artifacts produced
35
+ 3. Important Discoveries
36
+ Technical constraints or requirements uncovered
37
+ Decisions made and their rationale
38
+ Errors encountered and how they were resolved
39
+ What approaches were tried that didn't work (and why)
40
+ 4. Next Steps
41
+ Specific actions needed to complete the task
42
+ Any blockers or open questions to resolve
43
+ Priority order if multiple steps remain
44
+ 5. Context to Preserve
45
+ User preferences or style requirements
46
+ Domain-specific details that aren't obvious
47
+ Any promises made to the user
48
+ Be concise but complete—err on the side of including information that would prevent duplicate work or repeated mistakes. Write in a way that enables immediate resumption of the task.
49
+ Wrap your summary in <summary></summary> tags.`;async function Nue(e,t=e.messages.at(-1),n){if(!t||t.role!=="assistant"||!t.content||typeof t.content==="string")return null;let r=t.content.filter((s)=>s.type==="tool_use");if(r.length===0)return null;return{role:"user",content:await Promise.all(r.map(async(s)=>{let i=e.tools.find((a)=>("name"in a?a.name:a.mcp_server_name)===s.name);if(!i||!("run"in i))return{type:"tool_result",tool_use_id:s.id,content:`Error: Tool '${s.name}' not found`,is_error:!0};try{let a=s.input;if("parse"in i&&i.parse)a=i.parse(a);let c=await i.run(a,{toolUse:s,toolUseBlock:s,signal:n?.signal});return{type:"tool_result",tool_use_id:s.id,content:c}}catch(a){return{type:"tool_result",tool_use_id:s.id,content:a instanceof ve?a.content:`Error: ${a instanceof Error?a.message:String(a)}`,is_error:!0}}}))}}var Jp,Ol,ka,Qt,Qn,vr,xs,mi,Xp,c$,Zw,Qp;var Yw=O(()=>{qn();ba();gt();Ne();Xo();Qp=class Qp{constructor(e,t,n){Jp.add(this),this.client=e,Ol.set(this,!1),ka.set(this,!1),Qt.set(this,void 0),Qn.set(this,void 0),vr.set(this,void 0),xs.set(this,void 0),mi.set(this,void 0),Xp.set(this,0),N(this,Qt,{params:{...t,messages:structuredClone(t.messages)}},"f");let r=ow(t.tools,t.messages);if(N(this,Qn,{...n,headers:k([bp("BetaToolRunner"),r.length?{[Sp]:r.join(", ")}:void 0,n?.headers])},"f"),N(this,mi,vl(),"f"),t.compactionControl?.enabled)console.warn('Anthropic: The `compactionControl` parameter is deprecated and will be removed in a future version. Use server-side compaction instead by passing `edits: [{ type: "compact_20260112" }]` in the params passed to `toolRunner()`. See https://platform.claude.com/docs/en/build-with-claude/compaction')}async*[(Ol=new WeakMap,ka=new WeakMap,Qt=new WeakMap,Qn=new WeakMap,vr=new WeakMap,xs=new WeakMap,mi=new WeakMap,Xp=new WeakMap,Jp=new WeakSet,c$=async function(){let t=b(this,Qt,"f").params.compactionControl;if(!t||!t.enabled)return!1;let n=0;if(b(this,vr,"f")!==void 0)try{let c=await b(this,vr,"f");n=c.usage.input_tokens+(c.usage.cache_creation_input_tokens??0)+(c.usage.cache_read_input_tokens??0)+c.usage.output_tokens}catch{return!1}let r=t.contextTokenThreshold??i$;if(n<r)return!1;let o=t.model??b(this,Qt,"f").params.model,s=t.summaryPrompt??a$,i=b(this,Qt,"f").params.messages;if(i[i.length-1].role==="assistant"){let c=i[i.length-1];if(Array.isArray(c.content)){let l=c.content.filter((u)=>u.type!=="tool_use");if(l.length===0)i.pop();else c.content=l}}let a=await this.client.beta.messages.create({model:o,messages:[...i,{role:"user",content:[{type:"text",text:s}]}],max_tokens:b(this,Qt,"f").params.max_tokens},{signal:b(this,Qn,"f").signal,headers:k([b(this,Qn,"f").headers,bp("compaction")])});if(a.content[0]?.type!=="text")throw new j("Expected text response for compaction");return b(this,Qt,"f").params.messages=[{role:"user",content:a.content}],!0},Symbol.asyncIterator)](){var e;if(b(this,Ol,"f"))throw new j("Cannot iterate over a consumed stream");N(this,Ol,!0,"f"),N(this,ka,!0,"f"),N(this,xs,void 0,"f");try{while(!0){let t;try{if(b(this,Qt,"f").params.max_iterations&&b(this,Xp,"f")>=b(this,Qt,"f").params.max_iterations)break;N(this,ka,!1,"f"),N(this,xs,void 0,"f"),N(this,Xp,(e=b(this,Xp,"f"),e++,e),"f"),N(this,vr,void 0,"f");let{max_iterations:n,compactionControl:r,...o}=b(this,Qt,"f").params;if(o.stream)t=this.client.beta.messages.stream({...o},b(this,Qn,"f")),N(this,vr,t.finalMessage(),"f"),b(this,vr,"f").catch(()=>{}),yield t;else N(this,vr,this.client.beta.messages.create({...o,stream:!1},b(this,Qn,"f")),"f"),yield b(this,vr,"f");if(!await b(this,Jp,"m",c$).call(this)){if(!b(this,ka,"f")){let a=await b(this,vr,"f");if(b(this,Qt,"f").params.messages.push({role:a.role,content:a.content}),a.stop_reason==="refusal")break}let i=await b(this,Jp,"m",Zw).call(this,b(this,Qt,"f").params.messages.at(-1));if(i)b(this,Qt,"f").params.messages.push(i);else if(!b(this,ka,"f"))break}}finally{if(t)t.abort()}}if(!b(this,vr,"f"))throw new j("ToolRunner concluded without a message from the server");b(this,mi,"f").resolve(await b(this,vr,"f"))}catch(t){throw N(this,Ol,!1,"f"),b(this,mi,"f").promise.catch(()=>{}),b(this,mi,"f").reject(t),N(this,mi,vl(),"f"),t}}setMessagesParams(e){if(typeof e==="function")b(this,Qt,"f").params=e(b(this,Qt,"f").params);else b(this,Qt,"f").params=e;N(this,ka,!0,"f"),N(this,xs,void 0,"f")}setRequestOptions(e){if(typeof e==="function")N(this,Qn,e(b(this,Qn,"f")),"f");else N(this,Qn,{...b(this,Qn,"f"),...e},"f")}async generateToolResponse(e=b(this,Qn,"f").signal){let t=await b(this,vr,"f")??this.params.messages.at(-1);if(!t)return null;return b(this,Jp,"m",Zw).call(this,t,e)}done(){return b(this,mi,"f").promise}async runUntilDone(){if(!b(this,Ol,"f"))for await(let e of this);return this.done()}get params(){return b(this,Qt,"f").params}pushMessages(...e){this.setMessagesParams((t)=>({...t,messages:[...t.messages,...e]}))}then(e,t){return this.runUntilDone().then(e,t)}};Zw=async function(t,n=b(this,Qn,"f").signal){if(b(this,xs,"f")!==void 0)return b(this,xs,"f");return N(this,xs,Nue(b(this,Qt,"f").params,t,{...b(this,Qn,"f"),signal:n}),"f"),b(this,xs,"f")}});function u$(e){if(!e.output_format)return e;if(e.output_config?.format)throw new j("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:t,...n}=e;return{...n,output_config:{...e.output_config,format:t}}}var l$,Mue,hi;var Jw=O(()=>{Tl();Mw();Uw();Ne();Xo();zw();s$();Yw();ba();Mw();Yw();ba();l$={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","claude-3-5-haiku-latest":"February 19th, 2026","claude-3-5-haiku-20241022":"February 19th, 2026","claude-opus-4-0":"June 15th, 2026","claude-opus-4-20250514":"June 15th, 2026","claude-sonnet-4-0":"June 15th, 2026","claude-sonnet-4-20250514":"June 15th, 2026","claude-opus-4-1":"August 5th, 2026","claude-opus-4-1-20250805":"August 5th, 2026","claude-mythos-preview":"June 30th, 2026"},Mue=["claude-mythos-preview","claude-opus-4-6"];hi=class hi extends oe{constructor(){super(...arguments);this.batches=new Hp(this._client)}create(e,t){let n=u$(e),{betas:r,user_profile_id:o,...s}=n;if(s.model in l$)console.warn(`The model '${s.model}' is deprecated and will reach end-of-life on ${l$[s.model]}
50
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(Mue.includes(s.model)&&s.thinking&&s.thinking.type==="enabled")console.warn(`Using Claude with ${s.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let i=this._client._options.timeout;if(!s.stream&&i==null){let c=b_[s.model]??void 0;i=this._client.calculateNonstreamingTimeout(s.max_tokens,c)}let a=t_(s.tools,s.messages);return this._client.post("/v1/messages?beta=true",{body:s,timeout:i??600000,...t,headers:k([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0,...o!=null?{"anthropic-user-profile-id":o}:void 0},a,t?.headers]),stream:n.stream??!1})}parse(e,t){return t={...t,headers:k([{"anthropic-beta":[...e.betas??[],"structured-outputs-2025-12-15"].toString()},t?.headers])},this.create(e,t).then((n)=>$w(n,e,{logger:this._client.logger??console}))}stream(e,t){return Yp.createMessage(this,e,t)}countTokens(e,t){let n=u$(e),{betas:r,user_profile_id:o,...s}=n;return this._client.post("/v1/messages/count_tokens?beta=true",{body:s,...t,headers:k([{"anthropic-beta":[...r??[],"token-counting-2024-11-01"].toString(),...o!=null?{"anthropic-user-profile-id":o}:void 0},t?.headers])})}toolRunner(e,t){return new Qp(this._client,e,t)}};hi.Batches=Hp;hi.BetaToolRunner=Qp;hi.ToolError=ve});var Pl;var Xw=O(()=>{et();Ne();at();g_();g_();Pl=class Pl extends oe{list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(M`/v1/sessions/${e}/events?beta=true`,Ae,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}send(e,t,n){let{betas:r,...o}=t;return this._client.post(M`/v1/sessions/${e}/events?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}stream(e,t={},n){let{betas:r,...o}=t??{};return this._client.get(M`/v1/sessions/${e}/events/stream?beta=true`,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers]),stream:!0})}toolRunner(e,t){return new xa(e,{...t,client:this._client})}};Pl.SessionToolRunner=xa});var ef;var Qw=O(()=>{et();Ne();at();ef=class ef extends oe{retrieve(e,t,n){let{session_id:r,betas:o}=t;return this._client.get(M`/v1/sessions/${r}/resources/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}update(e,t,n){let{session_id:r,betas:o,...s}=t;return this._client.post(M`/v1/sessions/${r}/resources/${e}?beta=true`,{body:s,...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(M`/v1/sessions/${e}/resources?beta=true`,Ae,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}delete(e,t,n){let{session_id:r,betas:o}=t;return this._client.delete(M`/v1/sessions/${r}/resources/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}add(e,t,n){let{betas:r,...o}=t;return this._client.post(M`/v1/sessions/${e}/resources?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}}});var tf;var eA=O(()=>{et();Ne();at();tf=class tf extends oe{list(e,t,n){let{session_id:r,betas:o,...s}=t;return this._client.getAPIList(M`/v1/sessions/${r}/threads/${e}/events?beta=true`,Ae,{query:s,...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}stream(e,t,n){let{session_id:r,betas:o}=t;return this._client.get(M`/v1/sessions/${r}/threads/${e}/stream?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers]),stream:!0})}}});var Il;var tA=O(()=>{eA();eA();et();Ne();at();Il=class Il extends oe{constructor(){super(...arguments);this.events=new tf(this._client)}retrieve(e,t,n){let{session_id:r,betas:o}=t;return this._client.get(M`/v1/sessions/${r}/threads/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(M`/v1/sessions/${e}/threads?beta=true`,Ae,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}archive(e,t,n){let{session_id:r,betas:o}=t;return this._client.post(M`/v1/sessions/${r}/threads/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}};Il.Events=tf});var gi;var nA=O(()=>{Xw();Xw();Qw();Qw();tA();tA();et();Ne();at();gi=class gi extends oe{constructor(){super(...arguments);this.events=new Pl(this._client),this.resources=new ef(this._client),this.threads=new Il(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/sessions?beta=true",{body:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(M`/v1/sessions/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}update(e,t,n){let{betas:r,...o}=t;return this._client.post(M`/v1/sessions/${e}?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/sessions?beta=true",Zv,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(M`/v1/sessions/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(M`/v1/sessions/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}};gi.Events=Pl;gi.Resources=ef;gi.Threads=Il});var nf;var rA=O(()=>{et();Ne();fl();at();nf=class nf extends oe{create(e,t,n){let{betas:r,...o}=t;return this._client.post(M`/v1/skills/${e}/versions?beta=true`,pl({body:o,...n,headers:k([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},n?.headers])},this._client,!1))}retrieve(e,t,n){let{skill_id:r,betas:o}=t;return this._client.get(M`/v1/skills/${r}/versions/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(M`/v1/skills/${e}/versions?beta=true`,Ae,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},n?.headers])})}delete(e,t,n){let{skill_id:r,betas:o}=t;return this._client.delete(M`/v1/skills/${r}/versions/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},n?.headers])})}download(e,t,n){let{skill_id:r,betas:o}=t;return this._client.get(M`/v1/skills/${r}/versions/${e}/content?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString(),Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}}});var Dl;var oA=O(()=>{rA();rA();et();Ne();fl();at();Dl=class Dl extends oe{constructor(){super(...arguments);this.versions=new nf(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/skills?beta=true",pl({body:r,...t,headers:k([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},t?.headers])},this._client,!1))}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(M`/v1/skills/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/skills?beta=true",Ae,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(M`/v1/skills/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},n?.headers])})}};Dl.Versions=nf});var rf;var sA=O(()=>{et();Ne();at();rf=class rf extends oe{create(e,t,n){let{betas:r,...o}=t;return this._client.post(M`/v1/tunnels/${e}/certificates?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"mcp-tunnels-2026-06-22"].toString()},n?.headers])})}retrieve(e,t,n){let{tunnel_id:r,betas:o}=t;return this._client.get(M`/v1/tunnels/${r}/certificates/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"mcp-tunnels-2026-06-22"].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(M`/v1/tunnels/${e}/certificates?beta=true`,Ae,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"mcp-tunnels-2026-06-22"].toString()},n?.headers])})}archive(e,t,n){let{tunnel_id:r,betas:o}=t;return this._client.post(M`/v1/tunnels/${r}/certificates/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"mcp-tunnels-2026-06-22"].toString()},n?.headers])})}}});var Ll;var iA=O(()=>{sA();sA();et();Ne();at();Ll=class Ll extends oe{constructor(){super(...arguments);this.certificates=new rf(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/tunnels?beta=true",{body:r,...t,headers:k([{"anthropic-beta":[...n??[],"mcp-tunnels-2026-06-22"].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(M`/v1/tunnels/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"mcp-tunnels-2026-06-22"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/tunnels?beta=true",Ae,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"mcp-tunnels-2026-06-22"].toString()},t?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(M`/v1/tunnels/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"mcp-tunnels-2026-06-22"].toString()},n?.headers])})}revealToken(e,t={},n){let{betas:r}=t??{};return this._client.post(M`/v1/tunnels/${e}/reveal_token?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"mcp-tunnels-2026-06-22"].toString()},n?.headers])})}rotateToken(e,t,n){let{betas:r,...o}=t;return this._client.post(M`/v1/tunnels/${e}/rotate_token?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"mcp-tunnels-2026-06-22"].toString()},n?.headers])})}};Ll.Certificates=rf});var of;var aA=O(()=>{et();Ne();at();of=class of extends oe{create(e,t,n){let{betas:r,...o}=t;return this._client.post(M`/v1/vaults/${e}/credentials?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}retrieve(e,t,n){let{vault_id:r,betas:o}=t;return this._client.get(M`/v1/vaults/${r}/credentials/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}update(e,t,n){let{vault_id:r,betas:o,...s}=t;return this._client.post(M`/v1/vaults/${r}/credentials/${e}?beta=true`,{body:s,...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(M`/v1/vaults/${e}/credentials?beta=true`,Ae,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}delete(e,t,n){let{vault_id:r,betas:o}=t;return this._client.delete(M`/v1/vaults/${r}/credentials/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}archive(e,t,n){let{vault_id:r,betas:o}=t;return this._client.post(M`/v1/vaults/${r}/credentials/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}mcpOAuthValidate(e,t,n){let{vault_id:r,betas:o}=t;return this._client.post(M`/v1/vaults/${r}/credentials/${e}/mcp_oauth_validate?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}}});var Nl;var cA=O(()=>{aA();aA();et();Ne();at();Nl=class Nl extends oe{constructor(){super(...arguments);this.credentials=new of(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/vaults?beta=true",{body:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(M`/v1/vaults/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}update(e,t,n){let{betas:r,...o}=t;return this._client.post(M`/v1/vaults/${e}?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/vaults?beta=true",Ae,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(M`/v1/vaults/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(M`/v1/vaults/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}};Nl.Credentials=of});var Ht;var lA=O(()=>{tw();tw();nw();nw();rw();rw();sw();sw();iw();iw();aw();aw();uw();uw();pw();pw();Pw();Pw();Lw();Lw();Jw();Jw();nA();nA();oA();oA();iA();iA();cA();cA();Ht=class Ht extends oe{constructor(){super(...arguments);this.models=new xp(this._client),this.messages=new hi(this._client),this.agents=new ml(this._client),this.environments=new Al(this._client),this.sessions=new gi(this._client),this.deployments=new gp(this._client),this.deploymentRuns=new hp(this._client),this.vaults=new Nl(this._client),this.memoryStores=new Ta(this._client),this.files=new Ep(this._client),this.skills=new Dl(this._client),this.webhooks=new Tp(this._client),this.userProfiles=new vp(this._client),this.dreams=new _p(this._client),this.tunnels=new Ll(this._client)}};Ht.Models=xp;Ht.Messages=hi;Ht.Agents=ml;Ht.Environments=Al;Ht.Sessions=gi;Ht.Deployments=gp;Ht.DeploymentRuns=hp;Ht.Vaults=Nl;Ht.MemoryStores=Ta;Ht.Files=Ep;Ht.Skills=Dl;Ht.Webhooks=Tp;Ht.UserProfiles=vp;Ht.Dreams=_p;Ht.Tunnels=Ll});var Ml;var uA=O(()=>{Ne();Ml=class Ml extends oe{create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/complete",{body:r,timeout:this._client._options.timeout??600000,...t,headers:k([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},t?.headers]),stream:e.stream??!1})}}});function d$(e){return e?.output_config?.format}function dA(e,t,n){let r=d$(t);if(!t||!("parse"in(r??{})))return{...e,content:e.content.map((o)=>{if(o.type==="text")return Object.defineProperty({...o},"parsed_output",{value:null,enumerable:!1});return o}),parsed_output:null};return pA(e,t,n)}function pA(e,t,n){let r=null,o=e.content.map((s)=>{if(s.type==="text"){let i=Zue(t,s.text);if(r===null)r=i;return Object.defineProperty({...s},"parsed_output",{value:i,enumerable:!1})}return s});return{...e,content:o,parsed_output:r}}function Zue(e,t){let n=d$(e);if(n?.type!=="json_schema")return null;try{if("parse"in n)return n.parse(t);return JSON.parse(t)}catch(r){throw new j(`Failed to parse structured output: ${r}`)}}var fA=O(()=>{gt()});function SA(e){return e.type==="tool_use"||e.type==="server_tool_use"}function m$(e){}var jr,_i,Ul,sf,k_,af,cf,R_,lf,es,uf,O_,P_,Ra,I_,D_,df,mA,p$,hA,gA,_A,yA,f$,pf;var h$=O(()=>{qn();Xo();Tl();jw();fA();Hw();pf=class pf{constructor(e,t){jr.add(this),this.messages=[],this.receivedMessages=[],_i.set(this,void 0),Ul.set(this,null),this.controller=new AbortController,sf.set(this,void 0),k_.set(this,()=>{}),af.set(this,()=>{}),cf.set(this,void 0),R_.set(this,()=>{}),lf.set(this,()=>{}),es.set(this,{}),uf.set(this,!1),O_.set(this,!1),P_.set(this,!1),Ra.set(this,!1),I_.set(this,void 0),D_.set(this,void 0),df.set(this,void 0),hA.set(this,(n)=>{if(N(this,O_,!0,"f"),Mr(n))n=new mn;if(n instanceof mn)return N(this,P_,!0,"f"),this._emit("abort",n);if(n instanceof j)return this._emit("error",n);if(n instanceof Error){let r=new j(n.message);return r.cause=n,this._emit("error",r)}return this._emit("error",new j(String(n)))}),N(this,sf,new Promise((n,r)=>{N(this,k_,n,"f"),N(this,af,r,"f")}),"f"),N(this,cf,new Promise((n,r)=>{N(this,R_,n,"f"),N(this,lf,r,"f")}),"f"),b(this,sf,"f").catch(()=>{}),b(this,cf,"f").catch(()=>{}),N(this,Ul,e,"f"),N(this,df,t?.logger??console,"f")}get response(){return b(this,I_,"f")}get request_id(){return b(this,D_,"f")}async withResponse(){N(this,Ra,!0,"f");let e=await b(this,sf,"f");if(!e)throw Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let t=new pf(null);return t._run(()=>t._fromReadableStream(e)),t}static createMessage(e,t,n,{logger:r}={}){let o=new pf(t,{logger:r});for(let s of t.messages)o._addMessageParam(s);return N(o,Ul,{...t,stream:!0},"f"),o._run(()=>o._createMessage(e,{...t,stream:!0},{...n,headers:{...n?.headers,[e_]:"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},b(this,hA,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){if(this.receivedMessages.push(e),t)this._emit("message",e)}async _createMessage(e,t,n){let r=n?.signal,o;if(r){if(r.aborted)this.controller.abort();o=this.controller.abort.bind(this.controller),r.addEventListener("abort",o)}try{b(this,jr,"m",gA).call(this);let{response:s,data:i}=await e.create({...t,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(s);for await(let a of i)b(this,jr,"m",_A).call(this,a);if(i.controller.signal?.aborted)throw new mn;b(this,jr,"m",yA).call(this)}finally{if(r&&o)r.removeEventListener("abort",o)}}_connected(e){if(this.ended)return;N(this,I_,e,"f"),N(this,D_,e?.headers.get("request-id"),"f"),b(this,k_,"f").call(this,e),this._emit("connect")}get ended(){return b(this,uf,"f")}get errored(){return b(this,O_,"f")}get aborted(){return b(this,P_,"f")}abort(){this.controller.abort()}on(e,t){return(b(this,es,"f")[e]||(b(this,es,"f")[e]=[])).push({listener:t}),this}off(e,t){let n=b(this,es,"f")[e];if(!n)return this;let r=n.findIndex((o)=>o.listener===t);if(r>=0)n.splice(r,1);return this}once(e,t){return(b(this,es,"f")[e]||(b(this,es,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,n)=>{if(N(this,Ra,!0,"f"),e!=="error")this.once("error",n);this.once(e,t)})}async done(){N(this,Ra,!0,"f"),await b(this,cf,"f")}get currentMessage(){return b(this,_i,"f")}async finalMessage(){return await this.done(),b(this,jr,"m",mA).call(this)}async finalText(){return await this.done(),b(this,jr,"m",p$).call(this)}_emit(e,...t){if(b(this,uf,"f"))return;if(e==="end")N(this,uf,!0,"f"),b(this,R_,"f").call(this);let n=b(this,es,"f")[e];if(n)b(this,es,"f")[e]=n.filter((r)=>!r.once),n.forEach(({listener:r})=>r(...t));if(e==="abort"){let r=t[0];if(!b(this,Ra,"f")&&!n?.length)Promise.reject(r);b(this,af,"f").call(this,r),b(this,lf,"f").call(this,r),this._emit("end");return}if(e==="error"){let r=t[0];if(!b(this,Ra,"f")&&!n?.length)Promise.reject(r);b(this,af,"f").call(this,r),b(this,lf,"f").call(this,r),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",b(this,jr,"m",mA).call(this))}async _fromReadableStream(e,t){let n=t?.signal,r;if(n){if(n.aborted)this.controller.abort();r=this.controller.abort.bind(this.controller),n.addEventListener("abort",r)}try{b(this,jr,"m",gA).call(this),this._connected(null);let o=An.fromReadableStream(e,this.controller);for await(let s of o)b(this,jr,"m",_A).call(this,s);if(o.controller.signal?.aborted)throw new mn;b(this,jr,"m",yA).call(this)}finally{if(n&&r)n.removeEventListener("abort",r)}}[(_i=new WeakMap,Ul=new WeakMap,sf=new WeakMap,k_=new WeakMap,af=new WeakMap,cf=new WeakMap,R_=new WeakMap,lf=new WeakMap,es=new WeakMap,uf=new WeakMap,O_=new WeakMap,P_=new WeakMap,Ra=new WeakMap,I_=new WeakMap,D_=new WeakMap,df=new WeakMap,hA=new WeakMap,jr=new WeakSet,mA=function(){if(this.receivedMessages.length===0)throw new j("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},p$=function(){if(this.receivedMessages.length===0)throw new j("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter((n)=>n.type==="text").map((n)=>n.text);if(t.length===0)throw new j("stream ended without producing a content block with type=text");return t.join(" ")},gA=function(){if(this.ended)return;N(this,_i,void 0,"f")},_A=function(t){if(this.ended)return;let n=b(this,jr,"m",f$).call(this,t);switch(this._emit("streamEvent",t,n),t.type){case"content_block_delta":{let r=n.content.at(-1);switch(t.delta.type){case"text_delta":{if(r.type==="text")this._emit("text",t.delta.text,r.text||"");break}case"citations_delta":{if(r.type==="text")this._emit("citation",t.delta.citation,r.citations??[]);break}case"input_json_delta":{if(SA(r)&&b(this,es,"f").inputJson?.length)this._emit("inputJson",t.delta.partial_json,r.input);break}case"thinking_delta":{if(r.type==="thinking")this._emit("thinking",t.delta.thinking,r.thinking);break}case"signature_delta":{if(r.type==="thinking")this._emit("signature",r.signature);break}default:m$(t.delta)}break}case"message_stop":{this._addMessageParam(n),this._addMessage(dA(n,b(this,Ul,"f"),{logger:b(this,df,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{N(this,_i,n,"f");break}case"content_block_start":case"message_delta":break}},yA=function(){if(this.ended)throw new j("stream has ended, this shouldn't happen");let t=b(this,_i,"f");if(!t)throw new j("request ended without sending any chunks");return N(this,_i,void 0,"f"),dA(t,b(this,Ul,"f"),{logger:b(this,df,"f")})},f$=function(t){let n=b(this,_i,"f");if(t.type==="message_start"){if(n)throw new j(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!n)throw new j(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return n;case"message_delta":if(n.stop_reason=t.delta.stop_reason,n.stop_sequence=t.delta.stop_sequence,t.delta.stop_details!=null)n.stop_details=t.delta.stop_details;if(n.usage.output_tokens=t.usage.output_tokens,t.usage.input_tokens!=null)n.usage.input_tokens=t.usage.input_tokens;if(t.usage.cache_creation_input_tokens!=null)n.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens;if(t.usage.cache_read_input_tokens!=null)n.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens;if(t.usage.server_tool_use!=null)n.usage.server_tool_use=t.usage.server_tool_use;return n;case"content_block_start":return n.content.push({...t.content_block}),n;case"content_block_delta":{let r=n.content.at(t.index);switch(t.delta.type){case"text_delta":{if(r?.type==="text")n.content[t.index]={...r,text:(r.text||"")+t.delta.text};break}case"citations_delta":{if(r?.type==="text")n.content[t.index]={...r,citations:[...r.citations??[],t.delta.citation]};break}case"input_json_delta":{if(r&&SA(r)){let o=(r[pi]||"")+t.delta.partial_json;n.content[t.index]=E_(r,o)}break}case"thinking_delta":{if(r?.type==="thinking")n.content[t.index]={...r,thinking:r.thinking+t.delta.thinking};break}case"signature_delta":{if(r?.type==="thinking")n.content[t.index]={...r,signature:t.delta.signature};break}default:m$(t.delta)}return n}case"content_block_stop":{let r=n.content.at(t.index);if(r&&SA(r)&&pi in r)Object.defineProperty(r,"input",{value:r.input,enumerable:!0,configurable:!0,writable:!0});return n}}},Symbol.asyncIterator)](){let e=[],t=[],n=!1;return this.on("streamEvent",(r)=>{let o=t.shift();if(o)o.resolve(r);else e.push(r)}),this.on("end",()=>{n=!0;for(let r of t)r.resolve(void 0);t.length=0}),this.on("abort",(r)=>{n=!0;for(let o of t)o.reject(r);t.length=0}),this.on("error",(r)=>{n=!0;for(let o of t)o.reject(r);t.length=0}),{next:async()=>{if(!e.length){if(n)return{value:void 0,done:!0};return new Promise((o,s)=>t.push({resolve:o,reject:s})).then((o)=>o?{value:o,done:!1}:{value:void 0,done:!0})}return{value:e.shift(),done:!1}},return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new An(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var ff;var bA=O(()=>{et();Ne();Nw();Tl();at();ff=class ff extends oe{create(e,t){let{user_profile_id:n,...r}=e;return this._client.post("/v1/messages/batches",{body:r,...t,headers:k([{...n!=null?{"anthropic-user-profile-id":n}:void 0},t?.headers])})}retrieve(e,t){return this._client.get(M`/v1/messages/batches/${e}`,t)}list(e={},t){return this._client.getAPIList("/v1/messages/batches",lo,{query:e,...t})}delete(e,t){return this._client.delete(M`/v1/messages/batches/${e}`,t)}cancel(e,t){return this._client.post(M`/v1/messages/batches/${e}/cancel`,t)}async results(e,t){let n=await this.retrieve(e);if(!n.results_url)throw new j(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);return this._client.get(n.results_url,{...t,headers:k([{Accept:"application/binary"},t?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((r,o)=>Cl.fromResponse(o.response,o.controller))}}});var Oa,g$,Jue;var EA=O(()=>{Ne();Xo();h$();fA();bA();bA();Uw();Oa=class Oa extends oe{constructor(){super(...arguments);this.batches=new ff(this._client)}create(e,t){let{user_profile_id:n,...r}=e;if(r.model in g$)console.warn(`The model '${r.model}' is deprecated and will reach end-of-life on ${g$[r.model]}
51
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(Jue.includes(r.model)&&r.thinking&&r.thinking.type==="enabled")console.warn(`Using Claude with ${r.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let o=this._client._options.timeout;if(!r.stream&&o==null){let i=b_[r.model]??void 0;o=this._client.calculateNonstreamingTimeout(r.max_tokens,i)}let s=t_(r.tools,r.messages);return this._client.post("/v1/messages",{body:r,timeout:o??600000,...t,headers:k([{...n!=null?{"anthropic-user-profile-id":n}:void 0},s,t?.headers]),stream:e.stream??!1})}parse(e,t){return this.create(e,t).then((n)=>pA(n,e,{logger:this._client.logger??console}))}stream(e,t){return pf.createMessage(this,e,t,{logger:this._client.logger??console})}countTokens(e,t){let{user_profile_id:n,...r}=e;return this._client.post("/v1/messages/count_tokens",{body:r,...t,headers:k([{...n!=null?{"anthropic-user-profile-id":n}:void 0},t?.headers])})}};g$={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","claude-3-5-haiku-latest":"February 19th, 2026","claude-3-5-haiku-20241022":"February 19th, 2026","claude-opus-4-0":"June 15th, 2026","claude-opus-4-20250514":"June 15th, 2026","claude-sonnet-4-0":"June 15th, 2026","claude-sonnet-4-20250514":"June 15th, 2026","claude-opus-4-1":"August 5th, 2026","claude-opus-4-1-20250805":"August 5th, 2026","claude-mythos-preview":"June 30th, 2026"},Jue=["claude-mythos-preview","claude-opus-4-6"];Oa.Batches=ff});var Fl;var xA=O(()=>{et();Ne();at();Fl=class Fl extends oe{retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(M`/v1/models/${e}`,{...n,headers:k([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/models",lo,{query:r,...t,headers:k([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},t?.headers])})}}});var _$=O(()=>{lA();uA();EA();xA();qU()});class Mt{get credentials(){return this._authState.provider}constructor({baseURL:e=Le("ANTHROPIC_BASE_URL"),apiKey:t,authToken:n,webhookKey:r=Le("ANTHROPIC_WEBHOOK_SIGNING_KEY")??null,...o}={}){if(vA.add(this),this._requestAuthFlags=new WeakMap,L_.set(this,void 0),t===void 0)t=o.profile!=null?null:Le("ANTHROPIC_API_KEY")??null;if(n===void 0)n=o.profile!=null?null:Le("ANTHROPIC_AUTH_TOKEN")??null;if(o.profile!=null&&(o.credentials!=null||o.config!=null))throw TypeError("Pass at most one of `profile`, `credentials`, or `config`.");let s={apiKey:t,authToken:n,webhookKey:r,...o,baseURL:e||"https://api.anthropic.com"};if(!s.dangerouslyAllowBrowser&&JM())throw new j(`It looks like you're running in a browser-like environment.
52
+
53
+ This is disabled by default, as it risks exposing your secret API credentials to attackers.
54
+ If you understand the risks and have appropriate mitigations in place,
55
+ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
56
+
57
+ new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
58
+ `);this.baseURL=s.baseURL,this._baseURLIsExplicit=o.__baseURLIsExplicit??!!e,this.timeout=s.timeout??wA.DEFAULT_TIMEOUT,this.logger=s.logger??console,this.logLevel=lp,this.logLevel=Bg(s.logLevel,"ClientOptions.logLevel",Ke(this))??Bg(Le("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",Ke(this))??lp,this.fetchOptions=s.fetchOptions,this.maxRetries=s.maxRetries??2,this.fetch=s.fetch??XM(),N(this,L_,eU,"f"),this.middleware=[...s.middleware??[]];let i=Le("ANTHROPIC_CUSTOM_HEADERS");if(i){let c={};for(let l of i.split(`
59
+ `)){let u=l.indexOf(":");if(u>=0)c[l.substring(0,u).trim()]=l.substring(u+1).trim()}s.defaultHeaders={...c,...s.defaultHeaders}}let a=o.__auth;if(delete s.__auth,delete s.__baseURLIsExplicit,this._options=s,this.apiKey=typeof t==="string"?t:null,this.authToken=n,this.webhookKey=r,a){if(this._authState=a,!this._baseURLIsExplicit&&a.baseURL)this.baseURL=a.baseURL}else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let c=s.credentials??null;if(c)this._authState.provider=c,this._authState.tokenCache=this._makeTokenCache(c);else if(s.config!=null){let l=Gv(s.config,this._credentialResolverOptions());this._authState.provider=l.provider,this._authState.tokenCache=this._makeTokenCache(l.provider),this._authState.extraHeaders=l.extraHeaders,this._applyCredentialBaseURL(l.baseURL)}else if(s.profile!=null)this._authState.resolution=this._resolveDefaultCredentials(s.profile);else this._authState.resolution=this._resolveDefaultCredentials()}}_applyCredentialBaseURL(e){if(!e)return;let t=e.replace(/\/+$/,"");if(this._authState.baseURL=t,!this._baseURLIsExplicit)this.baseURL=t}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this._credentialsFetch(),userAgent:this.getUserAgent(),onCacheWriteError:(e)=>{Ke(this).debug("credential cache write failed (best-effort)",e)},onSafetyWarning:(e)=>{Ke(this).warn(e)}}}_credentialsFetch(){return qv(this.fetch,this.middleware,void 0,this)}_makeTokenCache(e){return new Uv(e,(t)=>{Ke(this).debug("advisory token refresh failed; serving cached token",t)})}withOptions(e){let t="credentials"in e||"config"in e||"profile"in e,n="apiKey"in e||"authToken"in e||t,r={...this._options,...this._baseURLIsExplicit?{baseURL:this.baseURL}:{},maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,middleware:this.middleware,apiKey:this.apiKey,authToken:this.authToken,webhookKey:this.webhookKey,credentials:this.credentials,...t?{credentials:void 0,config:void 0,profile:void 0}:{},...e,__auth:n?void 0:this._authState,__baseURLIsExplicit:"baseURL"in e?!0:this._baseURLIsExplicit};return new this.constructor(r)}async _resolveDefaultCredentials(e){try{let t=await MU(this._credentialResolverOptions(),e);if(t)this._authState.provider=t.provider,this._authState.tokenCache=this._makeTokenCache(t.provider),this._authState.extraHeaders=t.extraHeaders,this._applyCredentialBaseURL(t.baseURL);else if(e!=null)throw new j(`Profile "${e}" could not be resolved (no <config_dir>/configs/${e}.json found).`)}catch(t){this._authState.error=t}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(e.get("x-api-key")||e.get("authorization"))return;if(this._authState.error)throw this._authState.error;if(this._authState.tokenCache||this._authState.resolution)return;if(this.apiKey&&e.get("x-api-key"))return;if(t.has("x-api-key"))return;if(this.authToken&&e.get("authorization"))return;if(t.has("authorization"))return;throw Error('Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}_authFlags(e){let t=this._requestAuthFlags.get(e);if(!t)t={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(e,t);return t}async authHeaders(e){if(this._authState.resolution)await this._authState.resolution;if(this._authState.error)return;if(this._authState.tokenCache&&this.apiKey==null){let t=await this._authState.tokenCache.getToken();return this._authFlags(e).usedTokenCache=!0,k([{Authorization:`Bearer ${t}`}])}return k([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey==null)return;return k([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken==null)return;return k([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return dU(e)}getUserAgent(){return`${this.constructor.name}/JS ${Ur}`}defaultIdempotencyKey(){return`stainless-node-retry-${cl()}`}makeStatusError(e,t,n,r){return Lt.generate(e,t,n,r)}buildURL(e,t,n){let r=!b(this,vA,"m",y$).call(this)&&n||this.baseURL,o=GM(e)?new URL(e):new URL(r+(r.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),s=this.defaultQuery(),i=Object.fromEntries(o.searchParams);if(!Tv(s)||!Tv(i))t={...i,...s,...t};if(typeof t==="object"&&t&&!Array.isArray(t))o.search=this.stringifyQuery(t);return o.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128000>600)throw new j("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions(e){}async prepareRequest(e,{url:t,options:n}){if(this._authState.tokenCache&&this.apiKey==null){let r=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[s,i]of Object.entries(this._authState.extraHeaders))if(!r.has(s))r.set(s,i);if(!r.get("anthropic-beta")?.split(",").map((s)=>s.trim())?.includes(ha))r.append("anthropic-beta",ha);e.headers=r}}backendMiddleware(){return[]}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,n){return this.request(Promise.resolve(n).then((r)=>({method:e,path:t,...r})))}request(e,t=null){return new ga(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,n){let r=await e,o=r.maxRetries??this.maxRetries;if(t==null)t=o,this._requestAuthFlags.delete(r);await this.prepareOptions(r);let{req:s,url:i,timeout:a}=await this.buildRequest(r,{retryCount:o-t}),c="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),l=n===void 0?"":`, retryOf: ${n}`,u=Date.now();if(r.signal?.aborted)throw new mn;let p=new AbortController,f=await this.fetchWithTimeout(i,s,a,p,r,{requestLogID:c,retryOfRequestLogID:n}).catch(ma),m=Date.now();if(f instanceof globalThis.Error){let _=`retrying, ${t} attempts remaining`;if(r.signal?.aborted)throw new mn;let E=Mr(f)||/timed? ?out/i.test(String(f)+("cause"in f?String(f.cause):"")),S=this.middleware.length>0||!!r.middleware?.length||this.backendMiddleware().length>0;if(S&&!E&&!BU(f))throw Ke(this).info(`[${c}] middleware error (not retryable)`),Ke(this).debug(`[${c}] middleware error (not retryable)`,Yo({retryOfRequestLogID:n,url:i,durationMs:m-u,message:f.message})),f;if(t)return Ke(this).info(`[${c}] connection ${E?"timed out":"failed"} - ${_}`),Ke(this).debug(`[${c}] connection ${E?"timed out":"failed"} (${_})`,Yo({retryOfRequestLogID:n,url:i,durationMs:m-u,message:f.message})),this.retryRequest(r,t,n??c);if(Ke(this).info(`[${c}] connection ${E?"timed out":"failed"} - error; no more retries left`),Ke(this).debug(`[${c}] connection ${E?"timed out":"failed"} (error; no more retries left)`,Yo({retryOfRequestLogID:n,url:i,durationMs:m-u,message:f.message})),E)throw new Zd;if(S&&!Vv(f))throw f;throw new bs({cause:f})}let h=[...f.headers.entries()].filter(([_])=>_==="request-id").map(([_,E])=>", "+_+": "+JSON.stringify(E)).join(""),y=`[${c}${l}${h}] ${s.method} ${i} ${f.ok?"succeeded":"failed"} with status ${f.status} in ${m-u}ms`;if(!f.ok){let _=await this.shouldRetry(f,r);if(t&&_){let U=`retrying, ${t} attempts remaining`;return await QM(f.body),Ke(this).info(`${y} - ${U}`),Ke(this).debug(`[${c}] response error (${U})`,Yo({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,durationMs:m-u})),this.retryRequest(r,t,n??c,f.headers)}let E=_?"error; no more retries left":"error; not retryable";Ke(this).info(`${y} - ${E}`);let S=await f.text().catch((U)=>ma(U).message),x=sp(S),v=x?void 0:S;throw Ke(this).debug(`[${c}] response error (${E})`,Yo({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,message:v,durationMs:Date.now()-u})),this.makeStatusError(f.status,x,v,f.headers)}return Ke(this).info(y),Ke(this).debug(`[${c}] response start`,Yo({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,durationMs:m-u})),{response:f,options:r,controller:p,requestLogID:c,retryOfRequestLogID:n,startTime:u}}getAPIList(e,t,n){return this.requestAPIList(t,n&&"then"in n?n.then((r)=>({method:"get",path:e,...r})):{method:"get",path:e,...n})}requestAPIList(e,t){let n=this.makeRequest(t,null,void 0);return new Yg(this,n,e)}async fetchWithTimeout(e,t,n,r,o,s){let{signal:i,method:a,...c}=t||{},l=this._makeAbort(r);if(i)i.addEventListener("abort",l,{once:!0});let u=globalThis.ReadableStream&&c.body instanceof globalThis.ReadableStream||typeof c.body==="object"&&c.body!==null&&Symbol.asyncIterator in c.body,p={signal:r.signal,...u?{duplex:"half"}:{},method:"GET",...c};if(a)p.method=a.toUpperCase();let f=this.fetch,m=async(S,x)=>{let v=setTimeout(l,n);try{return await f.call(void 0,S,x)}finally{clearTimeout(v)}},h=o===void 0?m:async(S,x={})=>{let v=typeof S==="string"?S:S instanceof URL?S.href:S.url;if(x.headers=x.headers instanceof Headers?x.headers:new Headers(x.headers),await this.prepareRequest(x,{url:v,options:o}),s)Ke(this).debug(`[${s.requestLogID}] sending request`,Yo({retryOfRequestLogID:s.retryOfRequestLogID,method:x.method,url:v,options:o,headers:x.headers}));return m(S,x)},y=o?.middleware,_=this.backendMiddleware(),E=y?.length||_.length?[...this.middleware,...y??[],..._]:this.middleware;return await qv(h,E,o,this)(e,p)}async shouldRetry(e,t){let n=this._authFlags(t);if(e.status===401&&this._authState.tokenCache&&n.usedTokenCache&&!n.didRefreshFor401)return n.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let r=e.headers.get("x-should-retry");if(r==="true")return!0;if(r==="false")return!1;if(e.status===408)return!0;if(e.status===409)return!0;if(e.status===429)return!0;if(e.status>=500)return!0;return!1}async retryRequest(e,t,n,r){let o,s=r?.get("retry-after-ms");if(s){let a=parseFloat(s);if(!Number.isNaN(a))o=a}let i=r?.get("retry-after");if(i&&!o){let a=parseFloat(i);if(!Number.isNaN(a))o=a*1000;else o=Date.parse(i)-Date.now()}if(o===void 0){let a=e.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(t,a)}return await ao(o),this.makeRequest(e,t-1,n)}calculateDefaultRetryTimeoutMillis(e,t){let o=t-e,s=Math.min(0.5*Math.pow(2,o),8),i=1-Math.random()*0.25;return s*i*1000}calculateNonstreamingTimeout(e,t){if(3600000*e/128000>600000||t!=null&&e>t)throw new j("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest(e,{retryCount:t=0}={}){let n={...e},{method:r,path:o,query:s,defaultBaseURL:i}=n;if(this._authState.resolution)await this._authState.resolution;if(!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL)this.baseURL=this._authState.baseURL;let a=this.buildURL(o,s,i);if("timeout"in n)VM("timeout",n.timeout);n.timeout=n.timeout??this.timeout;let{bodyHeaders:c,body:l}=this.buildBody({options:n}),u=await this.buildHeaders({options:e,method:r,bodyHeaders:c,retryCount:t});return{req:{method:r,headers:u,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:"half"},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:a,timeout:n.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:n,retryCount:r}){let o={};if(this.idempotencyHeader&&t!=="get"){if(!e.idempotencyKey)e.idempotencyKey=this.defaultIdempotencyKey();o[this.idempotencyHeader]=e.idempotencyKey}let s=k([o,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1000))}:{},...ip(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(s),s.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=k([t]);if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==="string"&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:e};else if(typeof e==="object"&&((Symbol.asyncIterator in e)||(Symbol.iterator in e)&&("next"in e)&&typeof e.next==="function"))return{bodyHeaders:void 0,body:Lg(e)};else if(typeof e==="object"&&n.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e)};else return b(this,L_,"f").call(this,{body:e,headers:n})}}var vA,wA,L_,y$,S$="\\n\\nHuman:",b$="\\n\\nAssistant:",Pa;var AA=O(()=>{qn();io();Dg();Nv();gt();ul();yU();UU();KU();et();ew();_$();Vg();uA();xA();lA();EA();Dg();Ne();Jo();io();wA=Mt,L_=new WeakMap,vA=new WeakSet,y$=function(){return this.baseURL!=="https://api.anthropic.com"};Mt.Anthropic=wA;Mt.HUMAN_PROMPT=S$;Mt.AI_PROMPT=b$;Mt.DEFAULT_TIMEOUT=600000;Mt.AnthropicError=j;Mt.APIError=Lt;Mt.APIConnectionError=bs;Mt.APIConnectionTimeoutError=Zd;Mt.APIUserAbortError=mn;Mt.NotFoundError=Qd;Mt.ConflictError=ep;Mt.RateLimitError=np;Mt.BadRequestError=Yd;Mt.AuthenticationError=Jd;Mt.InternalServerError=rp;Mt.PermissionDeniedError=Xd;Mt.UnprocessableEntityError=tp;Mt.toFile=Jg;Pa=class Pa extends Mt{constructor(){super(...arguments);this.completions=new Ml(this),this.messages=new Oa(this),this.models=new Fl(this),this.beta=new Ht(this)}};Pa.Completions=Ml;Pa.Messages=Oa;Pa.Models=Fl;Pa.Beta=Ht});var E$=O(()=>{gt();dp();Ne();Xo();io()});var Sw=O(()=>{AA();ew();Vg();E$();AA();et();gt()});function wf(e,t){return function(){return e.apply(t,arguments)}}function Af(e){return e!==null&&!ou(e)&&e.constructor!==null&&!ou(e.constructor)&&tr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}function Vge(e){let t;if(typeof ArrayBuffer<"u"&&ArrayBuffer.isView)t=ArrayBuffer.isView(e);else t=e&&e.buffer&&rj(e.buffer);return t}function o_e(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;return{}}function Cf(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,o;if(typeof e!=="object")e=[e];if(su(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(Af(e))return;let s=n?Object.getOwnPropertyNames(e):Object.keys(e),i=s.length,a;for(r=0;r<i;r++)a=s[r],t.call(null,e[a],a,e)}}function sj(e,t){if(Af(e))return null;t=t.toLowerCase();let n=Object.keys(e),r=n.length,o;while(r-- >0)if(o=n[r],t===o.toLowerCase())return o;return null}function sT(){let{caseless:e,skipUndefined:t}=ij(this)&&this||{},n={},r=(o,s)=>{if(s==="__proto__"||s==="constructor"||s==="prototype")return;let i=e&&sj(n,s)||s;if(W_(n[i])&&W_(o))n[i]=sT(n[i],o);else if(W_(o))n[i]=sT({},o);else if(su(o))n[i]=o.slice();else if(!t||!ou(o))n[i]=o};for(let o=0,s=arguments.length;o<s;o++)arguments[o]&&Cf(arguments[o],r);return n}function k_e(e){return!!(e&&tr(e.append)&&e[nj]==="FormData"&&e[q_])}var Wge,V_,q_,nj,Z_,So=(e)=>(e=e.toLowerCase(),(t)=>Z_(t)===e),Y_=(e)=>(t)=>typeof t===e,su,ou,rj,qge,tr,oj,Tf=(e)=>e!==null&&typeof e==="object",Zge=(e)=>e===!0||e===!1,W_=(e)=>{if(Z_(e)!=="object")return!1;let t=V_(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(nj in e)&&!(q_ in e)},Yge=(e)=>{if(!Tf(e)||Af(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},Jge,Xge,Qge=(e)=>!!(e&&typeof e.uri<"u"),e_e=(e)=>e&&typeof e.getParts<"u",t_e,n_e,r_e=(e)=>Tf(e)&&tr(e.pipe),Qz,ej,s_e=(e)=>{if(!e)return!1;if(ej&&e instanceof ej)return!0;let t=V_(e);if(!t||t===Object.prototype)return!1;if(!tr(e.append))return!1;let n=Z_(e);return n==="formdata"||n==="object"&&tr(e.toString)&&e.toString()==="[object FormData]"},i_e,a_e,c_e,l_e,u_e,d_e=(e)=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),Ua,ij=(e)=>!ou(e)&&e!==Ua,p_e=(e,t,n,{allOwnKeys:r}={})=>(Cf(t,(o,s)=>{if(n&&tr(o))Object.defineProperty(e,s,{value:wf(o,n),writable:!0,enumerable:!0,configurable:!0});else Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),f_e=(e)=>{if(e.charCodeAt(0)===65279)e=e.slice(1);return e},m_e=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},h_e=(e,t,n,r)=>{let o,s,i,a={};if(t=t||{},e==null)return t;do{o=Object.getOwnPropertyNames(e),s=o.length;while(s-- >0)if(i=o[s],(!r||r(i,e,t))&&!a[i])t[i]=e[i],a[i]=!0;e=n!==!1&&V_(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},g_e=(e,t,n)=>{if(e=String(e),n===void 0||n>e.length)n=e.length;n-=t.length;let r=e.indexOf(t,n);return r!==-1&&r===n},__e=(e)=>{if(!e)return null;if(su(e))return e;let t=e.length;if(!oj(t))return null;let n=Array(t);while(t-- >0)n[t]=e[t];return n},y_e,S_e=(e,t)=>{let r=(e&&e[q_]).call(e),o;while((o=r.next())&&!o.done){let s=o.value;t.call(e,s[0],s[1])}},b_e=(e,t)=>{let n,r=[];while((n=e.exec(t))!==null)r.push(n);return r},E_e,x_e=(e)=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,o){return r.toUpperCase()+o}),tj,v_e,aj=(e,t)=>{let n=Object.getOwnPropertyDescriptors(e),r={};Cf(n,(o,s)=>{let i;if((i=t(o,s,e))!==!1)r[s]=i||o}),Object.defineProperties(e,r)},w_e=(e)=>{aj(e,(t,n)=>{if(tr(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;let r=e[n];if(!tr(r))return;if(t.enumerable=!1,"writable"in t){t.writable=!1;return}if(!t.set)t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}})},A_e=(e,t)=>{let n={},r=(o)=>{o.forEach((s)=>{n[s]=!0})};return su(e)?r(e):r(String(e).split(t)),n},T_e=()=>{},C_e=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,R_e=(e)=>{let t=[,,,,,,,,,,],n=(r,o)=>{if(Tf(r)){if(t.indexOf(r)>=0)return;if(Af(r))return r;if(!("toJSON"in r)){t[o]=r;let s=su(r)?[]:{};return Cf(r,(i,a)=>{let c=n(i,o+1);!ou(c)&&(s[a]=c)}),t[o]=void 0,s}}return r};return n(e,0)},O_e,P_e=(e)=>e&&(Tf(e)||tr(e))&&tr(e.then)&&tr(e.catch),cj,I_e,D_e=(e)=>e!=null&&tr(e[q_]),A;var pt=O(()=>{({toString:Wge}=Object.prototype),{getPrototypeOf:V_}=Object,{iterator:q_,toStringTag:nj}=Symbol,Z_=((e)=>(t)=>{let n=Wge.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),{isArray:su}=Array,ou=Y_("undefined");rj=So("ArrayBuffer");qge=Y_("string"),tr=Y_("function"),oj=Y_("number"),Jge=So("Date"),Xge=So("File"),t_e=So("Blob"),n_e=So("FileList");Qz=o_e(),ej=typeof Qz.FormData<"u"?Qz.FormData:void 0,i_e=So("URLSearchParams"),[a_e,c_e,l_e,u_e]=["ReadableStream","Request","Response","Headers"].map(So);Ua=(()=>{if(typeof globalThis<"u")return globalThis;return typeof self<"u"?self:typeof window<"u"?window:global})();y_e=((e)=>(t)=>e&&t instanceof e)(typeof Uint8Array<"u"&&V_(Uint8Array)),E_e=So("HTMLFormElement"),tj=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),v_e=So("RegExp");O_e=So("AsyncFunction"),cj=((e,t)=>{if(e)return setImmediate;return t?((n,r)=>(Ua.addEventListener("message",({source:o,data:s})=>{if(o===Ua&&s===n)r.length&&r.shift()()},!1),(o)=>{r.push(o),Ua.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):(n)=>setTimeout(n)})(typeof setImmediate==="function",tr(Ua.postMessage)),I_e=typeof queueMicrotask<"u"?queueMicrotask.bind(Ua):typeof process<"u"&&process.nextTick||cj,A={isArray:su,isArrayBuffer:rj,isBuffer:Af,isFormData:s_e,isArrayBufferView:Vge,isString:qge,isNumber:oj,isBoolean:Zge,isObject:Tf,isPlainObject:W_,isEmptyObject:Yge,isReadableStream:a_e,isRequest:c_e,isResponse:l_e,isHeaders:u_e,isUndefined:ou,isDate:Jge,isFile:Xge,isReactNativeBlob:Qge,isReactNative:e_e,isBlob:t_e,isRegExp:v_e,isFunction:tr,isStream:r_e,isURLSearchParams:i_e,isTypedArray:y_e,isFileList:n_e,forEach:Cf,merge:sT,extend:p_e,trim:d_e,stripBOM:f_e,inherits:m_e,toFlatObject:h_e,kindOf:Z_,kindOfTest:So,endsWith:g_e,toArray:__e,forEachEntry:S_e,matchAll:b_e,isHTMLForm:E_e,hasOwnProperty:tj,hasOwnProp:tj,reduceDescriptors:aj,freezeMethods:w_e,toObjectSet:A_e,toCamelCase:x_e,noop:T_e,toFiniteNumber:C_e,findKey:sj,global:Ua,isContextDefined:ij,isSpecCompliantForm:k_e,toJSONObject:R_e,isAsyncFn:O_e,isThenable:P_e,setImmediate:cj,asap:I_e,isIterable:D_e}});var On,G;var Cr=O(()=>{pt();On=class On extends Error{static from(e,t,n,r,o,s){let i=new On(e.message,t||e.code,n,r,o);if(i.cause=e,i.name=e.name,e.status!=null&&i.status==null)i.status=e.status;return s&&Object.assign(i,s),i}constructor(e,t,n,r,o){super(e);if(Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o)this.response=o,this.status=o.status}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:A.toJSONObject(this.config),code:this.code,status:this.status}}};On.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";On.ERR_BAD_OPTION="ERR_BAD_OPTION";On.ECONNABORTED="ECONNABORTED";On.ETIMEDOUT="ETIMEDOUT";On.ERR_NETWORK="ERR_NETWORK";On.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";On.ERR_DEPRECATED="ERR_DEPRECATED";On.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";On.ERR_BAD_REQUEST="ERR_BAD_REQUEST";On.ERR_CANCELED="ERR_CANCELED";On.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";On.ERR_INVALID_URL="ERR_INVALID_URL";On.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";G=On});var dj=T(function(pwt,uj){var lj=xe("stream").Stream,L_e=xe("util");uj.exports=bo;function bo(){this.source=null,this.dataSize=0,this.maxDataSize=1048576,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}L_e.inherits(bo,lj);bo.create=function(e,t){var n=new this;t=t||{};for(var r in t)n[r]=t[r];n.source=e;var o=e.emit;if(e.emit=function(){return n._handleEmit(arguments),o.apply(e,arguments)},e.on("error",function(){}),n.pauseStream)e.pause();return n};Object.defineProperty(bo.prototype,"readable",{configurable:!0,enumerable:!0,get:function(){return this.source.readable}});bo.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};bo.prototype.resume=function(){if(!this._released)this.release();this.source.resume()};bo.prototype.pause=function(){this.source.pause()};bo.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]};bo.prototype.pipe=function(){var e=lj.prototype.pipe.apply(this,arguments);return this.resume(),e};bo.prototype._handleEmit=function(e){if(this._released){this.emit.apply(this,e);return}if(e[0]==="data")this.dataSize+=e[1].length,this._checkIfMaxDataSizeExceeded();this._bufferedEvents.push(e)};bo.prototype._checkIfMaxDataSizeExceeded=function(){if(this._maxDataSizeExceeded)return;if(this.dataSize<=this.maxDataSize)return;this._maxDataSizeExceeded=!0;var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",Error(e))}});var hj=T(function(fwt,mj){var N_e=xe("util"),fj=xe("stream").Stream,pj=dj();mj.exports=Ut;function Ut(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2097152,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}N_e.inherits(Ut,fj);Ut.create=function(e){var t=new this;e=e||{};for(var n in e)t[n]=e[n];return t};Ut.isStreamLike=function(e){return typeof e!=="function"&&typeof e!=="string"&&typeof e!=="boolean"&&typeof e!=="number"&&!Buffer.isBuffer(e)};Ut.prototype.append=function(e){var t=Ut.isStreamLike(e);if(t){if(!(e instanceof pj)){var n=pj.create(e,{maxDataSize:1/0,pauseStream:this.pauseStreams});e.on("data",this._checkDataSize.bind(this)),e=n}if(this._handleErrors(e),this.pauseStreams)e.pause()}return this._streams.push(e),this};Ut.prototype.pipe=function(e,t){return fj.prototype.pipe.call(this,e,t),this.resume(),e};Ut.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop){this._pendingNext=!0;return}this._insideLoop=!0;try{do this._pendingNext=!1,this._realGetNext();while(this._pendingNext)}finally{this._insideLoop=!1}};Ut.prototype._realGetNext=function(){var e=this._streams.shift();if(typeof e>"u"){this.end();return}if(typeof e!=="function"){this._pipeNext(e);return}var t=e;t(function(n){var r=Ut.isStreamLike(n);if(r)n.on("data",this._checkDataSize.bind(this)),this._handleErrors(n);this._pipeNext(n)}.bind(this))};Ut.prototype._pipeNext=function(e){this._currentStream=e;var t=Ut.isStreamLike(e);if(t){e.on("end",this._getNext.bind(this)),e.pipe(this,{end:!1});return}var n=e;this.write(n),this._getNext()};Ut.prototype._handleErrors=function(e){var t=this;e.on("error",function(n){t._emitError(n)})};Ut.prototype.write=function(e){this.emit("data",e)};Ut.prototype.pause=function(){if(!this.pauseStreams)return;if(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function")this._currentStream.pause();this.emit("pause")};Ut.prototype.resume=function(){if(!this._released)this._released=!0,this.writable=!0,this._getNext();if(this.pauseStreams&&this._currentStream&&typeof this._currentStream.resume=="function")this._currentStream.resume();this.emit("resume")};Ut.prototype.end=function(){this._reset(),this.emit("end")};Ut.prototype.destroy=function(){this._reset(),this.emit("close")};Ut.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null};Ut.prototype._checkDataSize=function(){if(this._updateDataSize(),this.dataSize<=this.maxDataSize)return;var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(Error(e))};Ut.prototype._updateDataSize=function(){this.dataSize=0;var e=this;if(this._streams.forEach(function(t){if(!t.dataSize)return;e.dataSize+=t.dataSize}),this._currentStream&&this._currentStream.dataSize)this.dataSize+=this._currentStream.dataSize};Ut.prototype._emitError=function(e){this._reset(),this.emit("error",e)}});var gj=T(function(mwt,M_e){M_e.exports={"application/1d-interleaved-parityfec":{source:"iana"},"application/3gpdash-qoe-report+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/3gpp-ims+xml":{source:"iana",compressible:!0},"application/3gpphal+json":{source:"iana",compressible:!0},"application/3gpphalforms+json":{source:"iana",compressible:!0},"application/a2l":{source:"iana"},"application/ace+cbor":{source:"iana"},"application/activemessage":{source:"iana"},"application/activity+json":{source:"iana",compressible:!0},"application/alto-costmap+json":{source:"iana",compressible:!0},"application/alto-costmapfilter+json":{source:"iana",compressible:!0},"application/alto-directory+json":{source:"iana",compressible:!0},"application/alto-endpointcost+json":{source:"iana",compressible:!0},"application/alto-endpointcostparams+json":{source:"iana",compressible:!0},"application/alto-endpointprop+json":{source:"iana",compressible:!0},"application/alto-endpointpropparams+json":{source:"iana",compressible:!0},"application/alto-error+json":{source:"iana",compressible:!0},"application/alto-networkmap+json":{source:"iana",compressible:!0},"application/alto-networkmapfilter+json":{source:"iana",compressible:!0},"application/alto-updatestreamcontrol+json":{source:"iana",compressible:!0},"application/alto-updatestreamparams+json":{source:"iana",compressible:!0},"application/aml":{source:"iana"},"application/andrew-inset":{source:"iana",extensions:["ez"]},"application/applefile":{source:"iana"},"application/applixware":{source:"apache",extensions:["aw"]},"application/at+jwt":{source:"iana"},"application/atf":{source:"iana"},"application/atfx":{source:"iana"},"application/atom+xml":{source:"iana",compressible:!0,extensions:["atom"]},"application/atomcat+xml":{source:"iana",compressible:!0,extensions:["atomcat"]},"application/atomdeleted+xml":{source:"iana",compressible:!0,extensions:["atomdeleted"]},"application/atomicmail":{source:"iana"},"application/atomsvc+xml":{source:"iana",compressible:!0,extensions:["atomsvc"]},"application/atsc-dwd+xml":{source:"iana",compressible:!0,extensions:["dwd"]},"application/atsc-dynamic-event-message":{source:"iana"},"application/atsc-held+xml":{source:"iana",compressible:!0,extensions:["held"]},"application/atsc-rdt+json":{source:"iana",compressible:!0},"application/atsc-rsat+xml":{source:"iana",compressible:!0,extensions:["rsat"]},"application/atxml":{source:"iana"},"application/auth-policy+xml":{source:"iana",compressible:!0},"application/bacnet-xdd+zip":{source:"iana",compressible:!1},"application/batch-smtp":{source:"iana"},"application/bdoc":{compressible:!1,extensions:["bdoc"]},"application/beep+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/calendar+json":{source:"iana",compressible:!0},"application/calendar+xml":{source:"iana",compressible:!0,extensions:["xcs"]},"application/call-completion":{source:"iana"},"application/cals-1840":{source:"iana"},"application/captive+json":{source:"iana",compressible:!0},"application/cbor":{source:"iana"},"application/cbor-seq":{source:"iana"},"application/cccex":{source:"iana"},"application/ccmp+xml":{source:"iana",compressible:!0},"application/ccxml+xml":{source:"iana",compressible:!0,extensions:["ccxml"]},"application/cdfx+xml":{source:"iana",compressible:!0,extensions:["cdfx"]},"application/cdmi-capability":{source:"iana",extensions:["cdmia"]},"application/cdmi-container":{source:"iana",extensions:["cdmic"]},"application/cdmi-domain":{source:"iana",extensions:["cdmid"]},"application/cdmi-object":{source:"iana",extensions:["cdmio"]},"application/cdmi-queue":{source:"iana",extensions:["cdmiq"]},"application/cdni":{source:"iana"},"application/cea":{source:"iana"},"application/cea-2018+xml":{source:"iana",compressible:!0},"application/cellml+xml":{source:"iana",compressible:!0},"application/cfw":{source:"iana"},"application/city+json":{source:"iana",compressible:!0},"application/clr":{source:"iana"},"application/clue+xml":{source:"iana",compressible:!0},"application/clue_info+xml":{source:"iana",compressible:!0},"application/cms":{source:"iana"},"application/cnrp+xml":{source:"iana",compressible:!0},"application/coap-group+json":{source:"iana",compressible:!0},"application/coap-payload":{source:"iana"},"application/commonground":{source:"iana"},"application/conference-info+xml":{source:"iana",compressible:!0},"application/cose":{source:"iana"},"application/cose-key":{source:"iana"},"application/cose-key-set":{source:"iana"},"application/cpl+xml":{source:"iana",compressible:!0,extensions:["cpl"]},"application/csrattrs":{source:"iana"},"application/csta+xml":{source:"iana",compressible:!0},"application/cstadata+xml":{source:"iana",compressible:!0},"application/csvm+json":{source:"iana",compressible:!0},"application/cu-seeme":{source:"apache",extensions:["cu"]},"application/cwt":{source:"iana"},"application/cybercash":{source:"iana"},"application/dart":{compressible:!0},"application/dash+xml":{source:"iana",compressible:!0,extensions:["mpd"]},"application/dash-patch+xml":{source:"iana",compressible:!0,extensions:["mpp"]},"application/dashdelta":{source:"iana"},"application/davmount+xml":{source:"iana",compressible:!0,extensions:["davmount"]},"application/dca-rft":{source:"iana"},"application/dcd":{source:"iana"},"application/dec-dx":{source:"iana"},"application/dialog-info+xml":{source:"iana",compressible:!0},"application/dicom":{source:"iana"},"application/dicom+json":{source:"iana",compressible:!0},"application/dicom+xml":{source:"iana",compressible:!0},"application/dii":{source:"iana"},"application/dit":{source:"iana"},"application/dns":{source:"iana"},"application/dns+json":{source:"iana",compressible:!0},"application/dns-message":{source:"iana"},"application/docbook+xml":{source:"apache",compressible:!0,extensions:["dbk"]},"application/dots+cbor":{source:"iana"},"application/dskpp+xml":{source:"iana",compressible:!0},"application/dssc+der":{source:"iana",extensions:["dssc"]},"application/dssc+xml":{source:"iana",compressible:!0,extensions:["xdssc"]},"application/dvcs":{source:"iana"},"application/ecmascript":{source:"iana",compressible:!0,extensions:["es","ecma"]},"application/edi-consent":{source:"iana"},"application/edi-x12":{source:"iana",compressible:!1},"application/edifact":{source:"iana",compressible:!1},"application/efi":{source:"iana"},"application/elm+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/elm+xml":{source:"iana",compressible:!0},"application/emergencycalldata.cap+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/emergencycalldata.comment+xml":{source:"iana",compressible:!0},"application/emergencycalldata.control+xml":{source:"iana",compressible:!0},"application/emergencycalldata.deviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.ecall.msd":{source:"iana"},"application/emergencycalldata.providerinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.serviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.subscriberinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.veds+xml":{source:"iana",compressible:!0},"application/emma+xml":{source:"iana",compressible:!0,extensions:["emma"]},"application/emotionml+xml":{source:"iana",compressible:!0,extensions:["emotionml"]},"application/encaprtp":{source:"iana"},"application/epp+xml":{source:"iana",compressible:!0},"application/epub+zip":{source:"iana",compressible:!1,extensions:["epub"]},"application/eshop":{source:"iana"},"application/exi":{source:"iana",extensions:["exi"]},"application/expect-ct-report+json":{source:"iana",compressible:!0},"application/express":{source:"iana",extensions:["exp"]},"application/fastinfoset":{source:"iana"},"application/fastsoap":{source:"iana"},"application/fdt+xml":{source:"iana",compressible:!0,extensions:["fdt"]},"application/fhir+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/fhir+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/fido.trusted-apps+json":{compressible:!0},"application/fits":{source:"iana"},"application/flexfec":{source:"iana"},"application/font-sfnt":{source:"iana"},"application/font-tdpfr":{source:"iana",extensions:["pfr"]},"application/font-woff":{source:"iana",compressible:!1},"application/framework-attributes+xml":{source:"iana",compressible:!0},"application/geo+json":{source:"iana",compressible:!0,extensions:["geojson"]},"application/geo+json-seq":{source:"iana"},"application/geopackage+sqlite3":{source:"iana"},"application/geoxacml+xml":{source:"iana",compressible:!0},"application/gltf-buffer":{source:"iana"},"application/gml+xml":{source:"iana",compressible:!0,extensions:["gml"]},"application/gpx+xml":{source:"apache",compressible:!0,extensions:["gpx"]},"application/gxf":{source:"apache",extensions:["gxf"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/h224":{source:"iana"},"application/held+xml":{source:"iana",compressible:!0},"application/hjson":{extensions:["hjson"]},"application/http":{source:"iana"},"application/hyperstudio":{source:"iana",extensions:["stk"]},"application/ibe-key-request+xml":{source:"iana",compressible:!0},"application/ibe-pkg-reply+xml":{source:"iana",compressible:!0},"application/ibe-pp-data":{source:"iana"},"application/iges":{source:"iana"},"application/im-iscomposing+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/index":{source:"iana"},"application/index.cmd":{source:"iana"},"application/index.obj":{source:"iana"},"application/index.response":{source:"iana"},"application/index.vnd":{source:"iana"},"application/inkml+xml":{source:"iana",compressible:!0,extensions:["ink","inkml"]},"application/iotp":{source:"iana"},"application/ipfix":{source:"iana",extensions:["ipfix"]},"application/ipp":{source:"iana"},"application/isup":{source:"iana"},"application/its+xml":{source:"iana",compressible:!0,extensions:["its"]},"application/java-archive":{source:"apache",compressible:!1,extensions:["jar","war","ear"]},"application/java-serialized-object":{source:"apache",compressible:!1,extensions:["ser"]},"application/java-vm":{source:"apache",compressible:!1,extensions:["class"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/jf2feed+json":{source:"iana",compressible:!0},"application/jose":{source:"iana"},"application/jose+json":{source:"iana",compressible:!0},"application/jrd+json":{source:"iana",compressible:!0},"application/jscalendar+json":{source:"iana",compressible:!0},"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/json-patch+json":{source:"iana",compressible:!0},"application/json-seq":{source:"iana"},"application/json5":{extensions:["json5"]},"application/jsonml+json":{source:"apache",compressible:!0,extensions:["jsonml"]},"application/jwk+json":{source:"iana",compressible:!0},"application/jwk-set+json":{source:"iana",compressible:!0},"application/jwt":{source:"iana"},"application/kpml-request+xml":{source:"iana",compressible:!0},"application/kpml-response+xml":{source:"iana",compressible:!0},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/lgr+xml":{source:"iana",compressible:!0,extensions:["lgr"]},"application/link-format":{source:"iana"},"application/load-control+xml":{source:"iana",compressible:!0},"application/lost+xml":{source:"iana",compressible:!0,extensions:["lostxml"]},"application/lostsync+xml":{source:"iana",compressible:!0},"application/lpf+zip":{source:"iana",compressible:!1},"application/lxf":{source:"iana"},"application/mac-binhex40":{source:"iana",extensions:["hqx"]},"application/mac-compactpro":{source:"apache",extensions:["cpt"]},"application/macwriteii":{source:"iana"},"application/mads+xml":{source:"iana",compressible:!0,extensions:["mads"]},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/marc":{source:"iana",extensions:["mrc"]},"application/marcxml+xml":{source:"iana",compressible:!0,extensions:["mrcx"]},"application/mathematica":{source:"iana",extensions:["ma","nb","mb"]},"application/mathml+xml":{source:"iana",compressible:!0,extensions:["mathml"]},"application/mathml-content+xml":{source:"iana",compressible:!0},"application/mathml-presentation+xml":{source:"iana",compressible:!0},"application/mbms-associated-procedure-description+xml":{source:"iana",compressible:!0},"application/mbms-deregister+xml":{source:"iana",compressible:!0},"application/mbms-envelope+xml":{source:"iana",compressible:!0},"application/mbms-msk+xml":{source:"iana",compressible:!0},"application/mbms-msk-response+xml":{source:"iana",compressible:!0},"application/mbms-protection-description+xml":{source:"iana",compressible:!0},"application/mbms-reception-report+xml":{source:"iana",compressible:!0},"application/mbms-register+xml":{source:"iana",compressible:!0},"application/mbms-register-response+xml":{source:"iana",compressible:!0},"application/mbms-schedule+xml":{source:"iana",compressible:!0},"application/mbms-user-service-description+xml":{source:"iana",compressible:!0},"application/mbox":{source:"iana",extensions:["mbox"]},"application/media-policy-dataset+xml":{source:"iana",compressible:!0,extensions:["mpf"]},"application/media_control+xml":{source:"iana",compressible:!0},"application/mediaservercontrol+xml":{source:"iana",compressible:!0,extensions:["mscml"]},"application/merge-patch+json":{source:"iana",compressible:!0},"application/metalink+xml":{source:"apache",compressible:!0,extensions:["metalink"]},"application/metalink4+xml":{source:"iana",compressible:!0,extensions:["meta4"]},"application/mets+xml":{source:"iana",compressible:!0,extensions:["mets"]},"application/mf4":{source:"iana"},"application/mikey":{source:"iana"},"application/mipc":{source:"iana"},"application/missing-blocks+cbor-seq":{source:"iana"},"application/mmt-aei+xml":{source:"iana",compressible:!0,extensions:["maei"]},"application/mmt-usd+xml":{source:"iana",compressible:!0,extensions:["musd"]},"application/mods+xml":{source:"iana",compressible:!0,extensions:["mods"]},"application/moss-keys":{source:"iana"},"application/moss-signature":{source:"iana"},"application/mosskey-data":{source:"iana"},"application/mosskey-request":{source:"iana"},"application/mp21":{source:"iana",extensions:["m21","mp21"]},"application/mp4":{source:"iana",extensions:["mp4s","m4p"]},"application/mpeg4-generic":{source:"iana"},"application/mpeg4-iod":{source:"iana"},"application/mpeg4-iod-xmt":{source:"iana"},"application/mrb-consumer+xml":{source:"iana",compressible:!0},"application/mrb-publish+xml":{source:"iana",compressible:!0},"application/msc-ivr+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msc-mixer+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msword":{source:"iana",compressible:!1,extensions:["doc","dot"]},"application/mud+json":{source:"iana",compressible:!0},"application/multipart-core":{source:"iana"},"application/mxf":{source:"iana",extensions:["mxf"]},"application/n-quads":{source:"iana",extensions:["nq"]},"application/n-triples":{source:"iana",extensions:["nt"]},"application/nasdata":{source:"iana"},"application/news-checkgroups":{source:"iana",charset:"US-ASCII"},"application/news-groupinfo":{source:"iana",charset:"US-ASCII"},"application/news-transmission":{source:"iana"},"application/nlsml+xml":{source:"iana",compressible:!0},"application/node":{source:"iana",extensions:["cjs"]},"application/nss":{source:"iana"},"application/oauth-authz-req+jwt":{source:"iana"},"application/oblivious-dns-message":{source:"iana"},"application/ocsp-request":{source:"iana"},"application/ocsp-response":{source:"iana"},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{source:"iana",extensions:["oda"]},"application/odm+xml":{source:"iana",compressible:!0},"application/odx":{source:"iana"},"application/oebps-package+xml":{source:"iana",compressible:!0,extensions:["opf"]},"application/ogg":{source:"iana",compressible:!1,extensions:["ogx"]},"application/omdoc+xml":{source:"apache",compressible:!0,extensions:["omdoc"]},"application/onenote":{source:"apache",extensions:["onetoc","onetoc2","onetmp","onepkg"]},"application/opc-nodeset+xml":{source:"iana",compressible:!0},"application/oscore":{source:"iana"},"application/oxps":{source:"iana",extensions:["oxps"]},"application/p21":{source:"iana"},"application/p21+zip":{source:"iana",compressible:!1},"application/p2p-overlay+xml":{source:"iana",compressible:!0,extensions:["relo"]},"application/parityfec":{source:"iana"},"application/passport":{source:"iana"},"application/patch-ops-error+xml":{source:"iana",compressible:!0,extensions:["xer"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/pdx":{source:"iana"},"application/pem-certificate-chain":{source:"iana"},"application/pgp-encrypted":{source:"iana",compressible:!1,extensions:["pgp"]},"application/pgp-keys":{source:"iana",extensions:["asc"]},"application/pgp-signature":{source:"iana",extensions:["asc","sig"]},"application/pics-rules":{source:"apache",extensions:["prf"]},"application/pidf+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pidf-diff+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pkcs10":{source:"iana",extensions:["p10"]},"application/pkcs12":{source:"iana"},"application/pkcs7-mime":{source:"iana",extensions:["p7m","p7c"]},"application/pkcs7-signature":{source:"iana",extensions:["p7s"]},"application/pkcs8":{source:"iana",extensions:["p8"]},"application/pkcs8-encrypted":{source:"iana"},"application/pkix-attr-cert":{source:"iana",extensions:["ac"]},"application/pkix-cert":{source:"iana",extensions:["cer"]},"application/pkix-crl":{source:"iana",extensions:["crl"]},"application/pkix-pkipath":{source:"iana",extensions:["pkipath"]},"application/pkixcmp":{source:"iana",extensions:["pki"]},"application/pls+xml":{source:"iana",compressible:!0,extensions:["pls"]},"application/poc-settings+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/postscript":{source:"iana",compressible:!0,extensions:["ai","eps","ps"]},"application/ppsp-tracker+json":{source:"iana",compressible:!0},"application/problem+json":{source:"iana",compressible:!0},"application/problem+xml":{source:"iana",compressible:!0},"application/provenance+xml":{source:"iana",compressible:!0,extensions:["provx"]},"application/prs.alvestrand.titrax-sheet":{source:"iana"},"application/prs.cww":{source:"iana",extensions:["cww"]},"application/prs.cyn":{source:"iana",charset:"7-BIT"},"application/prs.hpub+zip":{source:"iana",compressible:!1},"application/prs.nprend":{source:"iana"},"application/prs.plucker":{source:"iana"},"application/prs.rdf-xml-crypt":{source:"iana"},"application/prs.xsf+xml":{source:"iana",compressible:!0},"application/pskc+xml":{source:"iana",compressible:!0,extensions:["pskcxml"]},"application/pvd+json":{source:"iana",compressible:!0},"application/qsig":{source:"iana"},"application/raml+yaml":{compressible:!0,extensions:["raml"]},"application/raptorfec":{source:"iana"},"application/rdap+json":{source:"iana",compressible:!0},"application/rdf+xml":{source:"iana",compressible:!0,extensions:["rdf","owl"]},"application/reginfo+xml":{source:"iana",compressible:!0,extensions:["rif"]},"application/relax-ng-compact-syntax":{source:"iana",extensions:["rnc"]},"application/remote-printing":{source:"iana"},"application/reputon+json":{source:"iana",compressible:!0},"application/resource-lists+xml":{source:"iana",compressible:!0,extensions:["rl"]},"application/resource-lists-diff+xml":{source:"iana",compressible:!0,extensions:["rld"]},"application/rfc+xml":{source:"iana",compressible:!0},"application/riscos":{source:"iana"},"application/rlmi+xml":{source:"iana",compressible:!0},"application/rls-services+xml":{source:"iana",compressible:!0,extensions:["rs"]},"application/route-apd+xml":{source:"iana",compressible:!0,extensions:["rapd"]},"application/route-s-tsid+xml":{source:"iana",compressible:!0,extensions:["sls"]},"application/route-usd+xml":{source:"iana",compressible:!0,extensions:["rusd"]},"application/rpki-ghostbusters":{source:"iana",extensions:["gbr"]},"application/rpki-manifest":{source:"iana",extensions:["mft"]},"application/rpki-publication":{source:"iana"},"application/rpki-roa":{source:"iana",extensions:["roa"]},"application/rpki-updown":{source:"iana"},"application/rsd+xml":{source:"apache",compressible:!0,extensions:["rsd"]},"application/rss+xml":{source:"apache",compressible:!0,extensions:["rss"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/rtploopback":{source:"iana"},"application/rtx":{source:"iana"},"application/samlassertion+xml":{source:"iana",compressible:!0},"application/samlmetadata+xml":{source:"iana",compressible:!0},"application/sarif+json":{source:"iana",compressible:!0},"application/sarif-external-properties+json":{source:"iana",compressible:!0},"application/sbe":{source:"iana"},"application/sbml+xml":{source:"iana",compressible:!0,extensions:["sbml"]},"application/scaip+xml":{source:"iana",compressible:!0},"application/scim+json":{source:"iana",compressible:!0},"application/scvp-cv-request":{source:"iana",extensions:["scq"]},"application/scvp-cv-response":{source:"iana",extensions:["scs"]},"application/scvp-vp-request":{source:"iana",extensions:["spq"]},"application/scvp-vp-response":{source:"iana",extensions:["spp"]},"application/sdp":{source:"iana",extensions:["sdp"]},"application/secevent+jwt":{source:"iana"},"application/senml+cbor":{source:"iana"},"application/senml+json":{source:"iana",compressible:!0},"application/senml+xml":{source:"iana",compressible:!0,extensions:["senmlx"]},"application/senml-etch+cbor":{source:"iana"},"application/senml-etch+json":{source:"iana",compressible:!0},"application/senml-exi":{source:"iana"},"application/sensml+cbor":{source:"iana"},"application/sensml+json":{source:"iana",compressible:!0},"application/sensml+xml":{source:"iana",compressible:!0,extensions:["sensmlx"]},"application/sensml-exi":{source:"iana"},"application/sep+xml":{source:"iana",compressible:!0},"application/sep-exi":{source:"iana"},"application/session-info":{source:"iana"},"application/set-payment":{source:"iana"},"application/set-payment-initiation":{source:"iana",extensions:["setpay"]},"application/set-registration":{source:"iana"},"application/set-registration-initiation":{source:"iana",extensions:["setreg"]},"application/sgml":{source:"iana"},"application/sgml-open-catalog":{source:"iana"},"application/shf+xml":{source:"iana",compressible:!0,extensions:["shf"]},"application/sieve":{source:"iana",extensions:["siv","sieve"]},"application/simple-filter+xml":{source:"iana",compressible:!0},"application/simple-message-summary":{source:"iana"},"application/simplesymbolcontainer":{source:"iana"},"application/sipc":{source:"iana"},"application/slate":{source:"iana"},"application/smil":{source:"iana"},"application/smil+xml":{source:"iana",compressible:!0,extensions:["smi","smil"]},"application/smpte336m":{source:"iana"},"application/soap+fastinfoset":{source:"iana"},"application/soap+xml":{source:"iana",compressible:!0},"application/sparql-query":{source:"iana",extensions:["rq"]},"application/sparql-results+xml":{source:"iana",compressible:!0,extensions:["srx"]},"application/spdx+json":{source:"iana",compressible:!0},"application/spirits-event+xml":{source:"iana",compressible:!0},"application/sql":{source:"iana"},"application/srgs":{source:"iana",extensions:["gram"]},"application/srgs+xml":{source:"iana",compressible:!0,extensions:["grxml"]},"application/sru+xml":{source:"iana",compressible:!0,extensions:["sru"]},"application/ssdl+xml":{source:"apache",compressible:!0,extensions:["ssdl"]},"application/ssml+xml":{source:"iana",compressible:!0,extensions:["ssml"]},"application/stix+json":{source:"iana",compressible:!0},"application/swid+xml":{source:"iana",compressible:!0,extensions:["swidtag"]},"application/tamp-apex-update":{source:"iana"},"application/tamp-apex-update-confirm":{source:"iana"},"application/tamp-community-update":{source:"iana"},"application/tamp-community-update-confirm":{source:"iana"},"application/tamp-error":{source:"iana"},"application/tamp-sequence-adjust":{source:"iana"},"application/tamp-sequence-adjust-confirm":{source:"iana"},"application/tamp-status-query":{source:"iana"},"application/tamp-status-response":{source:"iana"},"application/tamp-update":{source:"iana"},"application/tamp-update-confirm":{source:"iana"},"application/tar":{compressible:!0},"application/taxii+json":{source:"iana",compressible:!0},"application/td+json":{source:"iana",compressible:!0},"application/tei+xml":{source:"iana",compressible:!0,extensions:["tei","teicorpus"]},"application/tetra_isi":{source:"iana"},"application/thraud+xml":{source:"iana",compressible:!0,extensions:["tfi"]},"application/timestamp-query":{source:"iana"},"application/timestamp-reply":{source:"iana"},"application/timestamped-data":{source:"iana",extensions:["tsd"]},"application/tlsrpt+gzip":{source:"iana"},"application/tlsrpt+json":{source:"iana",compressible:!0},"application/tnauthlist":{source:"iana"},"application/token-introspection+jwt":{source:"iana"},"application/toml":{compressible:!0,extensions:["toml"]},"application/trickle-ice-sdpfrag":{source:"iana"},"application/trig":{source:"iana",extensions:["trig"]},"application/ttml+xml":{source:"iana",compressible:!0,extensions:["ttml"]},"application/tve-trigger":{source:"iana"},"application/tzif":{source:"iana"},"application/tzif-leap":{source:"iana"},"application/ubjson":{compressible:!1,extensions:["ubj"]},"application/ulpfec":{source:"iana"},"application/urc-grpsheet+xml":{source:"iana",compressible:!0},"application/urc-ressheet+xml":{source:"iana",compressible:!0,extensions:["rsheet"]},"application/urc-targetdesc+xml":{source:"iana",compressible:!0,extensions:["td"]},"application/urc-uisocketdesc+xml":{source:"iana",compressible:!0},"application/vcard+json":{source:"iana",compressible:!0},"application/vcard+xml":{source:"iana",compressible:!0},"application/vemmi":{source:"iana"},"application/vividence.scriptfile":{source:"apache"},"application/vnd.1000minds.decision-model+xml":{source:"iana",compressible:!0,extensions:["1km"]},"application/vnd.3gpp-prose+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-prose-pc3ch+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-v2x-local-service-information":{source:"iana"},"application/vnd.3gpp.5gnas":{source:"iana"},"application/vnd.3gpp.access-transfer-events+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.bsf+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gmop+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gtpc":{source:"iana"},"application/vnd.3gpp.interworking-data":{source:"iana"},"application/vnd.3gpp.lpp":{source:"iana"},"application/vnd.3gpp.mc-signalling-ear":{source:"iana"},"application/vnd.3gpp.mcdata-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-payload":{source:"iana"},"application/vnd.3gpp.mcdata-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-signalling":{source:"iana"},"application/vnd.3gpp.mcdata-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-floor-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-signed+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-init-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-transmission-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mid-call+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ngap":{source:"iana"},"application/vnd.3gpp.pfcp":{source:"iana"},"application/vnd.3gpp.pic-bw-large":{source:"iana",extensions:["plb"]},"application/vnd.3gpp.pic-bw-small":{source:"iana",extensions:["psb"]},"application/vnd.3gpp.pic-bw-var":{source:"iana",extensions:["pvb"]},"application/vnd.3gpp.s1ap":{source:"iana"},"application/vnd.3gpp.sms":{source:"iana"},"application/vnd.3gpp.sms+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-ext+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.state-and-event-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ussd+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.bcmcsinfo+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.sms":{source:"iana"},"application/vnd.3gpp2.tcap":{source:"iana",extensions:["tcap"]},"application/vnd.3lightssoftware.imagescal":{source:"iana"},"application/vnd.3m.post-it-notes":{source:"iana",extensions:["pwn"]},"application/vnd.accpac.simply.aso":{source:"iana",extensions:["aso"]},"application/vnd.accpac.simply.imp":{source:"iana",extensions:["imp"]},"application/vnd.acucobol":{source:"iana",extensions:["acu"]},"application/vnd.acucorp":{source:"iana",extensions:["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{source:"apache",compressible:!1,extensions:["air"]},"application/vnd.adobe.flash.movie":{source:"iana"},"application/vnd.adobe.formscentral.fcdt":{source:"iana",extensions:["fcdt"]},"application/vnd.adobe.fxp":{source:"iana",extensions:["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{source:"iana"},"application/vnd.adobe.xdp+xml":{source:"iana",compressible:!0,extensions:["xdp"]},"application/vnd.adobe.xfdf":{source:"iana",extensions:["xfdf"]},"application/vnd.aether.imp":{source:"iana"},"application/vnd.afpc.afplinedata":{source:"iana"},"application/vnd.afpc.afplinedata-pagedef":{source:"iana"},"application/vnd.afpc.cmoca-cmresource":{source:"iana"},"application/vnd.afpc.foca-charset":{source:"iana"},"application/vnd.afpc.foca-codedfont":{source:"iana"},"application/vnd.afpc.foca-codepage":{source:"iana"},"application/vnd.afpc.modca":{source:"iana"},"application/vnd.afpc.modca-cmtable":{source:"iana"},"application/vnd.afpc.modca-formdef":{source:"iana"},"application/vnd.afpc.modca-mediummap":{source:"iana"},"application/vnd.afpc.modca-objectcontainer":{source:"iana"},"application/vnd.afpc.modca-overlay":{source:"iana"},"application/vnd.afpc.modca-pagesegment":{source:"iana"},"application/vnd.age":{source:"iana",extensions:["age"]},"application/vnd.ah-barcode":{source:"iana"},"application/vnd.ahead.space":{source:"iana",extensions:["ahead"]},"application/vnd.airzip.filesecure.azf":{source:"iana",extensions:["azf"]},"application/vnd.airzip.filesecure.azs":{source:"iana",extensions:["azs"]},"application/vnd.amadeus+json":{source:"iana",compressible:!0},"application/vnd.amazon.ebook":{source:"apache",extensions:["azw"]},"application/vnd.amazon.mobi8-ebook":{source:"iana"},"application/vnd.americandynamics.acc":{source:"iana",extensions:["acc"]},"application/vnd.amiga.ami":{source:"iana",extensions:["ami"]},"application/vnd.amundsen.maze+xml":{source:"iana",compressible:!0},"application/vnd.android.ota":{source:"iana"},"application/vnd.android.package-archive":{source:"apache",compressible:!1,extensions:["apk"]},"application/vnd.anki":{source:"iana"},"application/vnd.anser-web-certificate-issue-initiation":{source:"iana",extensions:["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{source:"apache",extensions:["fti"]},"application/vnd.antix.game-component":{source:"iana",extensions:["atx"]},"application/vnd.apache.arrow.file":{source:"iana"},"application/vnd.apache.arrow.stream":{source:"iana"},"application/vnd.apache.thrift.binary":{source:"iana"},"application/vnd.apache.thrift.compact":{source:"iana"},"application/vnd.apache.thrift.json":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/vnd.aplextor.warrp+json":{source:"iana",compressible:!0},"application/vnd.apothekende.reservation+json":{source:"iana",compressible:!0},"application/vnd.apple.installer+xml":{source:"iana",compressible:!0,extensions:["mpkg"]},"application/vnd.apple.keynote":{source:"iana",extensions:["key"]},"application/vnd.apple.mpegurl":{source:"iana",extensions:["m3u8"]},"application/vnd.apple.numbers":{source:"iana",extensions:["numbers"]},"application/vnd.apple.pages":{source:"iana",extensions:["pages"]},"application/vnd.apple.pkpass":{compressible:!1,extensions:["pkpass"]},"application/vnd.arastra.swi":{source:"iana"},"application/vnd.aristanetworks.swi":{source:"iana",extensions:["swi"]},"application/vnd.artisan+json":{source:"iana",compressible:!0},"application/vnd.artsquare":{source:"iana"},"application/vnd.astraea-software.iota":{source:"iana",extensions:["iota"]},"application/vnd.audiograph":{source:"iana",extensions:["aep"]},"application/vnd.autopackage":{source:"iana"},"application/vnd.avalon+json":{source:"iana",compressible:!0},"application/vnd.avistar+xml":{source:"iana",compressible:!0},"application/vnd.balsamiq.bmml+xml":{source:"iana",compressible:!0,extensions:["bmml"]},"application/vnd.balsamiq.bmpr":{source:"iana"},"application/vnd.banana-accounting":{source:"iana"},"application/vnd.bbf.usp.error":{source:"iana"},"application/vnd.bbf.usp.msg":{source:"iana"},"application/vnd.bbf.usp.msg+json":{source:"iana",compressible:!0},"application/vnd.bekitzur-stech+json":{source:"iana",compressible:!0},"application/vnd.bint.med-content":{source:"iana"},"application/vnd.biopax.rdf+xml":{source:"iana",compressible:!0},"application/vnd.blink-idb-value-wrapper":{source:"iana"},"application/vnd.blueice.multipass":{source:"iana",extensions:["mpm"]},"application/vnd.bluetooth.ep.oob":{source:"iana"},"application/vnd.bluetooth.le.oob":{source:"iana"},"application/vnd.bmi":{source:"iana",extensions:["bmi"]},"application/vnd.bpf":{source:"iana"},"application/vnd.bpf3":{source:"iana"},"application/vnd.businessobjects":{source:"iana",extensions:["rep"]},"application/vnd.byu.uapi+json":{source:"iana",compressible:!0},"application/vnd.cab-jscript":{source:"iana"},"application/vnd.canon-cpdl":{source:"iana"},"application/vnd.canon-lips":{source:"iana"},"application/vnd.capasystems-pg+json":{source:"iana",compressible:!0},"application/vnd.cendio.thinlinc.clientconf":{source:"iana"},"application/vnd.century-systems.tcp_stream":{source:"iana"},"application/vnd.chemdraw+xml":{source:"iana",compressible:!0,extensions:["cdxml"]},"application/vnd.chess-pgn":{source:"iana"},"application/vnd.chipnuts.karaoke-mmd":{source:"iana",extensions:["mmd"]},"application/vnd.ciedi":{source:"iana"},"application/vnd.cinderella":{source:"iana",extensions:["cdy"]},"application/vnd.cirpack.isdn-ext":{source:"iana"},"application/vnd.citationstyles.style+xml":{source:"iana",compressible:!0,extensions:["csl"]},"application/vnd.claymore":{source:"iana",extensions:["cla"]},"application/vnd.cloanto.rp9":{source:"iana",extensions:["rp9"]},"application/vnd.clonk.c4group":{source:"iana",extensions:["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{source:"iana",extensions:["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{source:"iana",extensions:["c11amz"]},"application/vnd.coffeescript":{source:"iana"},"application/vnd.collabio.xodocuments.document":{source:"iana"},"application/vnd.collabio.xodocuments.document-template":{source:"iana"},"application/vnd.collabio.xodocuments.presentation":{source:"iana"},"application/vnd.collabio.xodocuments.presentation-template":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{source:"iana"},"application/vnd.collection+json":{source:"iana",compressible:!0},"application/vnd.collection.doc+json":{source:"iana",compressible:!0},"application/vnd.collection.next+json":{source:"iana",compressible:!0},"application/vnd.comicbook+zip":{source:"iana",compressible:!1},"application/vnd.comicbook-rar":{source:"iana"},"application/vnd.commerce-battelle":{source:"iana"},"application/vnd.commonspace":{source:"iana",extensions:["csp"]},"application/vnd.contact.cmsg":{source:"iana",extensions:["cdbcmsg"]},"application/vnd.coreos.ignition+json":{source:"iana",compressible:!0},"application/vnd.cosmocaller":{source:"iana",extensions:["cmc"]},"application/vnd.crick.clicker":{source:"iana",extensions:["clkx"]},"application/vnd.crick.clicker.keyboard":{source:"iana",extensions:["clkk"]},"application/vnd.crick.clicker.palette":{source:"iana",extensions:["clkp"]},"application/vnd.crick.clicker.template":{source:"iana",extensions:["clkt"]},"application/vnd.crick.clicker.wordbank":{source:"iana",extensions:["clkw"]},"application/vnd.criticaltools.wbs+xml":{source:"iana",compressible:!0,extensions:["wbs"]},"application/vnd.cryptii.pipe+json":{source:"iana",compressible:!0},"application/vnd.crypto-shade-file":{source:"iana"},"application/vnd.cryptomator.encrypted":{source:"iana"},"application/vnd.cryptomator.vault":{source:"iana"},"application/vnd.ctc-posml":{source:"iana",extensions:["pml"]},"application/vnd.ctct.ws+xml":{source:"iana",compressible:!0},"application/vnd.cups-pdf":{source:"iana"},"application/vnd.cups-postscript":{source:"iana"},"application/vnd.cups-ppd":{source:"iana",extensions:["ppd"]},"application/vnd.cups-raster":{source:"iana"},"application/vnd.cups-raw":{source:"iana"},"application/vnd.curl":{source:"iana"},"application/vnd.curl.car":{source:"apache",extensions:["car"]},"application/vnd.curl.pcurl":{source:"apache",extensions:["pcurl"]},"application/vnd.cyan.dean.root+xml":{source:"iana",compressible:!0},"application/vnd.cybank":{source:"iana"},"application/vnd.cyclonedx+json":{source:"iana",compressible:!0},"application/vnd.cyclonedx+xml":{source:"iana",compressible:!0},"application/vnd.d2l.coursepackage1p0+zip":{source:"iana",compressible:!1},"application/vnd.d3m-dataset":{source:"iana"},"application/vnd.d3m-problem":{source:"iana"},"application/vnd.dart":{source:"iana",compressible:!0,extensions:["dart"]},"application/vnd.data-vision.rdz":{source:"iana",extensions:["rdz"]},"application/vnd.datapackage+json":{source:"iana",compressible:!0},"application/vnd.dataresource+json":{source:"iana",compressible:!0},"application/vnd.dbf":{source:"iana",extensions:["dbf"]},"application/vnd.debian.binary-package":{source:"iana"},"application/vnd.dece.data":{source:"iana",extensions:["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{source:"iana",compressible:!0,extensions:["uvt","uvvt"]},"application/vnd.dece.unspecified":{source:"iana",extensions:["uvx","uvvx"]},"application/vnd.dece.zip":{source:"iana",extensions:["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{source:"iana",extensions:["fe_launch"]},"application/vnd.desmume.movie":{source:"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{source:"iana"},"application/vnd.dm.delegation+xml":{source:"iana",compressible:!0},"application/vnd.dna":{source:"iana",extensions:["dna"]},"application/vnd.document+json":{source:"iana",compressible:!0},"application/vnd.dolby.mlp":{source:"apache",extensions:["mlp"]},"application/vnd.dolby.mobile.1":{source:"iana"},"application/vnd.dolby.mobile.2":{source:"iana"},"application/vnd.doremir.scorecloud-binary-document":{source:"iana"},"application/vnd.dpgraph":{source:"iana",extensions:["dpg"]},"application/vnd.dreamfactory":{source:"iana",extensions:["dfac"]},"application/vnd.drive+json":{source:"iana",compressible:!0},"application/vnd.ds-keypoint":{source:"apache",extensions:["kpxx"]},"application/vnd.dtg.local":{source:"iana"},"application/vnd.dtg.local.flash":{source:"iana"},"application/vnd.dtg.local.html":{source:"iana"},"application/vnd.dvb.ait":{source:"iana",extensions:["ait"]},"application/vnd.dvb.dvbisl+xml":{source:"iana",compressible:!0},"application/vnd.dvb.dvbj":{source:"iana"},"application/vnd.dvb.esgcontainer":{source:"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess2":{source:"iana"},"application/vnd.dvb.ipdcesgpdd":{source:"iana"},"application/vnd.dvb.ipdcroaming":{source:"iana"},"application/vnd.dvb.iptv.alfec-base":{source:"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{source:"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-container+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-generic+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-msglist+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-request+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-response+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-init+xml":{source:"iana",compressible:!0},"application/vnd.dvb.pfr":{source:"iana"},"application/vnd.dvb.service":{source:"iana",extensions:["svc"]},"application/vnd.dxr":{source:"iana"},"application/vnd.dynageo":{source:"iana",extensions:["geo"]},"application/vnd.dzr":{source:"iana"},"application/vnd.easykaraoke.cdgdownload":{source:"iana"},"application/vnd.ecdis-update":{source:"iana"},"application/vnd.ecip.rlp":{source:"iana"},"application/vnd.eclipse.ditto+json":{source:"iana",compressible:!0},"application/vnd.ecowin.chart":{source:"iana",extensions:["mag"]},"application/vnd.ecowin.filerequest":{source:"iana"},"application/vnd.ecowin.fileupdate":{source:"iana"},"application/vnd.ecowin.series":{source:"iana"},"application/vnd.ecowin.seriesrequest":{source:"iana"},"application/vnd.ecowin.seriesupdate":{source:"iana"},"application/vnd.efi.img":{source:"iana"},"application/vnd.efi.iso":{source:"iana"},"application/vnd.emclient.accessrequest+xml":{source:"iana",compressible:!0},"application/vnd.enliven":{source:"iana",extensions:["nml"]},"application/vnd.enphase.envoy":{source:"iana"},"application/vnd.eprints.data+xml":{source:"iana",compressible:!0},"application/vnd.epson.esf":{source:"iana",extensions:["esf"]},"application/vnd.epson.msf":{source:"iana",extensions:["msf"]},"application/vnd.epson.quickanime":{source:"iana",extensions:["qam"]},"application/vnd.epson.salt":{source:"iana",extensions:["slt"]},"application/vnd.epson.ssf":{source:"iana",extensions:["ssf"]},"application/vnd.ericsson.quickcall":{source:"iana"},"application/vnd.espass-espass+zip":{source:"iana",compressible:!1},"application/vnd.eszigno3+xml":{source:"iana",compressible:!0,extensions:["es3","et3"]},"application/vnd.etsi.aoc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.asic-e+zip":{source:"iana",compressible:!1},"application/vnd.etsi.asic-s+zip":{source:"iana",compressible:!1},"application/vnd.etsi.cug+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvcommand+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-bc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-cod+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-npvr+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvservice+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsync+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvueprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mcid+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mheg5":{source:"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{source:"iana",compressible:!0},"application/vnd.etsi.pstn+xml":{source:"iana",compressible:!0},"application/vnd.etsi.sci+xml":{source:"iana",compressible:!0},"application/vnd.etsi.simservs+xml":{source:"iana",compressible:!0},"application/vnd.etsi.timestamp-token":{source:"iana"},"application/vnd.etsi.tsl+xml":{source:"iana",compressible:!0},"application/vnd.etsi.tsl.der":{source:"iana"},"application/vnd.eu.kasparian.car+json":{source:"iana",compressible:!0},"application/vnd.eudora.data":{source:"iana"},"application/vnd.evolv.ecig.profile":{source:"iana"},"application/vnd.evolv.ecig.settings":{source:"iana"},"application/vnd.evolv.ecig.theme":{source:"iana"},"application/vnd.exstream-empower+zip":{source:"iana",compressible:!1},"application/vnd.exstream-package":{source:"iana"},"application/vnd.ezpix-album":{source:"iana",extensions:["ez2"]},"application/vnd.ezpix-package":{source:"iana",extensions:["ez3"]},"application/vnd.f-secure.mobile":{source:"iana"},"application/vnd.familysearch.gedcom+zip":{source:"iana",compressible:!1},"application/vnd.fastcopy-disk-image":{source:"iana"},"application/vnd.fdf":{source:"iana",extensions:["fdf"]},"application/vnd.fdsn.mseed":{source:"iana",extensions:["mseed"]},"application/vnd.fdsn.seed":{source:"iana",extensions:["seed","dataless"]},"application/vnd.ffsns":{source:"iana"},"application/vnd.ficlab.flb+zip":{source:"iana",compressible:!1},"application/vnd.filmit.zfc":{source:"iana"},"application/vnd.fints":{source:"iana"},"application/vnd.firemonkeys.cloudcell":{source:"iana"},"application/vnd.flographit":{source:"iana",extensions:["gph"]},"application/vnd.fluxtime.clip":{source:"iana",extensions:["ftc"]},"application/vnd.font-fontforge-sfd":{source:"iana"},"application/vnd.framemaker":{source:"iana",extensions:["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{source:"iana",extensions:["fnc"]},"application/vnd.frogans.ltf":{source:"iana",extensions:["ltf"]},"application/vnd.fsc.weblaunch":{source:"iana",extensions:["fsc"]},"application/vnd.fujifilm.fb.docuworks":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.binder":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.container":{source:"iana"},"application/vnd.fujifilm.fb.jfi+xml":{source:"iana",compressible:!0},"application/vnd.fujitsu.oasys":{source:"iana",extensions:["oas"]},"application/vnd.fujitsu.oasys2":{source:"iana",extensions:["oa2"]},"application/vnd.fujitsu.oasys3":{source:"iana",extensions:["oa3"]},"application/vnd.fujitsu.oasysgp":{source:"iana",extensions:["fg5"]},"application/vnd.fujitsu.oasysprs":{source:"iana",extensions:["bh2"]},"application/vnd.fujixerox.art-ex":{source:"iana"},"application/vnd.fujixerox.art4":{source:"iana"},"application/vnd.fujixerox.ddd":{source:"iana",extensions:["ddd"]},"application/vnd.fujixerox.docuworks":{source:"iana",extensions:["xdw"]},"application/vnd.fujixerox.docuworks.binder":{source:"iana",extensions:["xbd"]},"application/vnd.fujixerox.docuworks.container":{source:"iana"},"application/vnd.fujixerox.hbpl":{source:"iana"},"application/vnd.fut-misnet":{source:"iana"},"application/vnd.futoin+cbor":{source:"iana"},"application/vnd.futoin+json":{source:"iana",compressible:!0},"application/vnd.fuzzysheet":{source:"iana",extensions:["fzs"]},"application/vnd.genomatix.tuxedo":{source:"iana",extensions:["txd"]},"application/vnd.gentics.grd+json":{source:"iana",compressible:!0},"application/vnd.geo+json":{source:"iana",compressible:!0},"application/vnd.geocube+xml":{source:"iana",compressible:!0},"application/vnd.geogebra.file":{source:"iana",extensions:["ggb"]},"application/vnd.geogebra.slides":{source:"iana"},"application/vnd.geogebra.tool":{source:"iana",extensions:["ggt"]},"application/vnd.geometry-explorer":{source:"iana",extensions:["gex","gre"]},"application/vnd.geonext":{source:"iana",extensions:["gxt"]},"application/vnd.geoplan":{source:"iana",extensions:["g2w"]},"application/vnd.geospace":{source:"iana",extensions:["g3w"]},"application/vnd.gerber":{source:"iana"},"application/vnd.globalplatform.card-content-mgt":{source:"iana"},"application/vnd.globalplatform.card-content-mgt-response":{source:"iana"},"application/vnd.gmx":{source:"iana",extensions:["gmx"]},"application/vnd.google-apps.document":{compressible:!1,extensions:["gdoc"]},"application/vnd.google-apps.presentation":{compressible:!1,extensions:["gslides"]},"application/vnd.google-apps.spreadsheet":{compressible:!1,extensions:["gsheet"]},"application/vnd.google-earth.kml+xml":{source:"iana",compressible:!0,extensions:["kml"]},"application/vnd.google-earth.kmz":{source:"iana",compressible:!1,extensions:["kmz"]},"application/vnd.gov.sk.e-form+xml":{source:"iana",compressible:!0},"application/vnd.gov.sk.e-form+zip":{source:"iana",compressible:!1},"application/vnd.gov.sk.xmldatacontainer+xml":{source:"iana",compressible:!0},"application/vnd.grafeq":{source:"iana",extensions:["gqf","gqs"]},"application/vnd.gridmp":{source:"iana"},"application/vnd.groove-account":{source:"iana",extensions:["gac"]},"application/vnd.groove-help":{source:"iana",extensions:["ghf"]},"application/vnd.groove-identity-message":{source:"iana",extensions:["gim"]},"application/vnd.groove-injector":{source:"iana",extensions:["grv"]},"application/vnd.groove-tool-message":{source:"iana",extensions:["gtm"]},"application/vnd.groove-tool-template":{source:"iana",extensions:["tpl"]},"application/vnd.groove-vcard":{source:"iana",extensions:["vcg"]},"application/vnd.hal+json":{source:"iana",compressible:!0},"application/vnd.hal+xml":{source:"iana",compressible:!0,extensions:["hal"]},"application/vnd.handheld-entertainment+xml":{source:"iana",compressible:!0,extensions:["zmm"]},"application/vnd.hbci":{source:"iana",extensions:["hbci"]},"application/vnd.hc+json":{source:"iana",compressible:!0},"application/vnd.hcl-bireports":{source:"iana"},"application/vnd.hdt":{source:"iana"},"application/vnd.heroku+json":{source:"iana",compressible:!0},"application/vnd.hhe.lesson-player":{source:"iana",extensions:["les"]},"application/vnd.hl7cda+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hl7v2+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hp-hpgl":{source:"iana",extensions:["hpgl"]},"application/vnd.hp-hpid":{source:"iana",extensions:["hpid"]},"application/vnd.hp-hps":{source:"iana",extensions:["hps"]},"application/vnd.hp-jlyt":{source:"iana",extensions:["jlt"]},"application/vnd.hp-pcl":{source:"iana",extensions:["pcl"]},"application/vnd.hp-pclxl":{source:"iana",extensions:["pclxl"]},"application/vnd.httphone":{source:"iana"},"application/vnd.hydrostatix.sof-data":{source:"iana",extensions:["sfd-hdstx"]},"application/vnd.hyper+json":{source:"iana",compressible:!0},"application/vnd.hyper-item+json":{source:"iana",compressible:!0},"application/vnd.hyperdrive+json":{source:"iana",compressible:!0},"application/vnd.hzn-3d-crossword":{source:"iana"},"application/vnd.ibm.afplinedata":{source:"iana"},"application/vnd.ibm.electronic-media":{source:"iana"},"application/vnd.ibm.minipay":{source:"iana",extensions:["mpy"]},"application/vnd.ibm.modcap":{source:"iana",extensions:["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{source:"iana",extensions:["irm"]},"application/vnd.ibm.secure-container":{source:"iana",extensions:["sc"]},"application/vnd.iccprofile":{source:"iana",extensions:["icc","icm"]},"application/vnd.ieee.1905":{source:"iana"},"application/vnd.igloader":{source:"iana",extensions:["igl"]},"application/vnd.imagemeter.folder+zip":{source:"iana",compressible:!1},"application/vnd.imagemeter.image+zip":{source:"iana",compressible:!1},"application/vnd.immervision-ivp":{source:"iana",extensions:["ivp"]},"application/vnd.immervision-ivu":{source:"iana",extensions:["ivu"]},"application/vnd.ims.imsccv1p1":{source:"iana"},"application/vnd.ims.imsccv1p2":{source:"iana"},"application/vnd.ims.imsccv1p3":{source:"iana"},"application/vnd.ims.lis.v2.result+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy.id+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings.simple+json":{source:"iana",compressible:!0},"application/vnd.informedcontrol.rms+xml":{source:"iana",compressible:!0},"application/vnd.informix-visionary":{source:"iana"},"application/vnd.infotech.project":{source:"iana"},"application/vnd.infotech.project+xml":{source:"iana",compressible:!0},"application/vnd.innopath.wamp.notification":{source:"iana"},"application/vnd.insors.igm":{source:"iana",extensions:["igm"]},"application/vnd.intercon.formnet":{source:"iana",extensions:["xpw","xpx"]},"application/vnd.intergeo":{source:"iana",extensions:["i2g"]},"application/vnd.intertrust.digibox":{source:"iana"},"application/vnd.intertrust.nncp":{source:"iana"},"application/vnd.intu.qbo":{source:"iana",extensions:["qbo"]},"application/vnd.intu.qfx":{source:"iana",extensions:["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.conceptitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.knowledgeitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsmessage+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.packageitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.planningitem+xml":{source:"iana",compressible:!0},"application/vnd.ipunplugged.rcprofile":{source:"iana",extensions:["rcprofile"]},"application/vnd.irepository.package+xml":{source:"iana",compressible:!0,extensions:["irp"]},"application/vnd.is-xpr":{source:"iana",extensions:["xpr"]},"application/vnd.isac.fcs":{source:"iana",extensions:["fcs"]},"application/vnd.iso11783-10+zip":{source:"iana",compressible:!1},"application/vnd.jam":{source:"iana",extensions:["jam"]},"application/vnd.japannet-directory-service":{source:"iana"},"application/vnd.japannet-jpnstore-wakeup":{source:"iana"},"application/vnd.japannet-payment-wakeup":{source:"iana"},"application/vnd.japannet-registration":{source:"iana"},"application/vnd.japannet-registration-wakeup":{source:"iana"},"application/vnd.japannet-setstore-wakeup":{source:"iana"},"application/vnd.japannet-verification":{source:"iana"},"application/vnd.japannet-verification-wakeup":{source:"iana"},"application/vnd.jcp.javame.midlet-rms":{source:"iana",extensions:["rms"]},"application/vnd.jisp":{source:"iana",extensions:["jisp"]},"application/vnd.joost.joda-archive":{source:"iana",extensions:["joda"]},"application/vnd.jsk.isdn-ngn":{source:"iana"},"application/vnd.kahootz":{source:"iana",extensions:["ktz","ktr"]},"application/vnd.kde.karbon":{source:"iana",extensions:["karbon"]},"application/vnd.kde.kchart":{source:"iana",extensions:["chrt"]},"application/vnd.kde.kformula":{source:"iana",extensions:["kfo"]},"application/vnd.kde.kivio":{source:"iana",extensions:["flw"]},"application/vnd.kde.kontour":{source:"iana",extensions:["kon"]},"application/vnd.kde.kpresenter":{source:"iana",extensions:["kpr","kpt"]},"application/vnd.kde.kspread":{source:"iana",extensions:["ksp"]},"application/vnd.kde.kword":{source:"iana",extensions:["kwd","kwt"]},"application/vnd.kenameaapp":{source:"iana",extensions:["htke"]},"application/vnd.kidspiration":{source:"iana",extensions:["kia"]},"application/vnd.kinar":{source:"iana",extensions:["kne","knp"]},"application/vnd.koan":{source:"iana",extensions:["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{source:"iana",extensions:["sse"]},"application/vnd.las":{source:"iana"},"application/vnd.las.las+json":{source:"iana",compressible:!0},"application/vnd.las.las+xml":{source:"iana",compressible:!0,extensions:["lasxml"]},"application/vnd.laszip":{source:"iana"},"application/vnd.leap+json":{source:"iana",compressible:!0},"application/vnd.liberty-request+xml":{source:"iana",compressible:!0},"application/vnd.llamagraphics.life-balance.desktop":{source:"iana",extensions:["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{source:"iana",compressible:!0,extensions:["lbe"]},"application/vnd.logipipe.circuit+zip":{source:"iana",compressible:!1},"application/vnd.loom":{source:"iana"},"application/vnd.lotus-1-2-3":{source:"iana",extensions:["123"]},"application/vnd.lotus-approach":{source:"iana",extensions:["apr"]},"application/vnd.lotus-freelance":{source:"iana",extensions:["pre"]},"application/vnd.lotus-notes":{source:"iana",extensions:["nsf"]},"application/vnd.lotus-organizer":{source:"iana",extensions:["org"]},"application/vnd.lotus-screencam":{source:"iana",extensions:["scm"]},"application/vnd.lotus-wordpro":{source:"iana",extensions:["lwp"]},"application/vnd.macports.portpkg":{source:"iana",extensions:["portpkg"]},"application/vnd.mapbox-vector-tile":{source:"iana",extensions:["mvt"]},"application/vnd.marlin.drm.actiontoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.conftoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.license+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.mdcf":{source:"iana"},"application/vnd.mason+json":{source:"iana",compressible:!0},"application/vnd.maxar.archive.3tz+zip":{source:"iana",compressible:!1},"application/vnd.maxmind.maxmind-db":{source:"iana"},"application/vnd.mcd":{source:"iana",extensions:["mcd"]},"application/vnd.medcalcdata":{source:"iana",extensions:["mc1"]},"application/vnd.mediastation.cdkey":{source:"iana",extensions:["cdkey"]},"application/vnd.meridian-slingshot":{source:"iana"},"application/vnd.mfer":{source:"iana",extensions:["mwf"]},"application/vnd.mfmp":{source:"iana",extensions:["mfm"]},"application/vnd.micro+json":{source:"iana",compressible:!0},"application/vnd.micrografx.flo":{source:"iana",extensions:["flo"]},"application/vnd.micrografx.igx":{source:"iana",extensions:["igx"]},"application/vnd.microsoft.portable-executable":{source:"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{source:"iana"},"application/vnd.miele+json":{source:"iana",compressible:!0},"application/vnd.mif":{source:"iana",extensions:["mif"]},"application/vnd.minisoft-hp3000-save":{source:"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{source:"iana"},"application/vnd.mobius.daf":{source:"iana",extensions:["daf"]},"application/vnd.mobius.dis":{source:"iana",extensions:["dis"]},"application/vnd.mobius.mbk":{source:"iana",extensions:["mbk"]},"application/vnd.mobius.mqy":{source:"iana",extensions:["mqy"]},"application/vnd.mobius.msl":{source:"iana",extensions:["msl"]},"application/vnd.mobius.plc":{source:"iana",extensions:["plc"]},"application/vnd.mobius.txf":{source:"iana",extensions:["txf"]},"application/vnd.mophun.application":{source:"iana",extensions:["mpn"]},"application/vnd.mophun.certificate":{source:"iana",extensions:["mpc"]},"application/vnd.motorola.flexsuite":{source:"iana"},"application/vnd.motorola.flexsuite.adsi":{source:"iana"},"application/vnd.motorola.flexsuite.fis":{source:"iana"},"application/vnd.motorola.flexsuite.gotap":{source:"iana"},"application/vnd.motorola.flexsuite.kmr":{source:"iana"},"application/vnd.motorola.flexsuite.ttc":{source:"iana"},"application/vnd.motorola.flexsuite.wem":{source:"iana"},"application/vnd.motorola.iprm":{source:"iana"},"application/vnd.mozilla.xul+xml":{source:"iana",compressible:!0,extensions:["xul"]},"application/vnd.ms-3mfdocument":{source:"iana"},"application/vnd.ms-artgalry":{source:"iana",extensions:["cil"]},"application/vnd.ms-asf":{source:"iana"},"application/vnd.ms-cab-compressed":{source:"iana",extensions:["cab"]},"application/vnd.ms-color.iccprofile":{source:"apache"},"application/vnd.ms-excel":{source:"iana",compressible:!1,extensions:["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{source:"iana",extensions:["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{source:"iana",extensions:["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{source:"iana",extensions:["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{source:"iana",extensions:["xltm"]},"application/vnd.ms-fontobject":{source:"iana",compressible:!0,extensions:["eot"]},"application/vnd.ms-htmlhelp":{source:"iana",extensions:["chm"]},"application/vnd.ms-ims":{source:"iana",extensions:["ims"]},"application/vnd.ms-lrm":{source:"iana",extensions:["lrm"]},"application/vnd.ms-office.activex+xml":{source:"iana",compressible:!0},"application/vnd.ms-officetheme":{source:"iana",extensions:["thmx"]},"application/vnd.ms-opentype":{source:"apache",compressible:!0},"application/vnd.ms-outlook":{compressible:!1,extensions:["msg"]},"application/vnd.ms-package.obfuscated-opentype":{source:"apache"},"application/vnd.ms-pki.seccat":{source:"apache",extensions:["cat"]},"application/vnd.ms-pki.stl":{source:"apache",extensions:["stl"]},"application/vnd.ms-playready.initiator+xml":{source:"iana",compressible:!0},"application/vnd.ms-powerpoint":{source:"iana",compressible:!1,extensions:["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{source:"iana",extensions:["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{source:"iana",extensions:["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{source:"iana",extensions:["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{source:"iana",extensions:["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{source:"iana",extensions:["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{source:"iana",compressible:!0},"application/vnd.ms-printing.printticket+xml":{source:"apache",compressible:!0},"application/vnd.ms-printschematicket+xml":{source:"iana",compressible:!0},"application/vnd.ms-project":{source:"iana",extensions:["mpp","mpt"]},"application/vnd.ms-tnef":{source:"iana"},"application/vnd.ms-windows.devicepairing":{source:"iana"},"application/vnd.ms-windows.nwprinting.oob":{source:"iana"},"application/vnd.ms-windows.printerpairing":{source:"iana"},"application/vnd.ms-windows.wsd.oob":{source:"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.lic-resp":{source:"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.meter-resp":{source:"iana"},"application/vnd.ms-word.document.macroenabled.12":{source:"iana",extensions:["docm"]},"application/vnd.ms-word.template.macroenabled.12":{source:"iana",extensions:["dotm"]},"application/vnd.ms-works":{source:"iana",extensions:["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{source:"iana",extensions:["wpl"]},"application/vnd.ms-xpsdocument":{source:"iana",compressible:!1,extensions:["xps"]},"application/vnd.msa-disk-image":{source:"iana"},"application/vnd.mseq":{source:"iana",extensions:["mseq"]},"application/vnd.msign":{source:"iana"},"application/vnd.multiad.creator":{source:"iana"},"application/vnd.multiad.creator.cif":{source:"iana"},"application/vnd.music-niff":{source:"iana"},"application/vnd.musician":{source:"iana",extensions:["mus"]},"application/vnd.muvee.style":{source:"iana",extensions:["msty"]},"application/vnd.mynfc":{source:"iana",extensions:["taglet"]},"application/vnd.nacamar.ybrid+json":{source:"iana",compressible:!0},"application/vnd.ncd.control":{source:"iana"},"application/vnd.ncd.reference":{source:"iana"},"application/vnd.nearst.inv+json":{source:"iana",compressible:!0},"application/vnd.nebumind.line":{source:"iana"},"application/vnd.nervana":{source:"iana"},"application/vnd.netfpx":{source:"iana"},"application/vnd.neurolanguage.nlu":{source:"iana",extensions:["nlu"]},"application/vnd.nimn":{source:"iana"},"application/vnd.nintendo.nitro.rom":{source:"iana"},"application/vnd.nintendo.snes.rom":{source:"iana"},"application/vnd.nitf":{source:"iana",extensions:["ntf","nitf"]},"application/vnd.noblenet-directory":{source:"iana",extensions:["nnd"]},"application/vnd.noblenet-sealer":{source:"iana",extensions:["nns"]},"application/vnd.noblenet-web":{source:"iana",extensions:["nnw"]},"application/vnd.nokia.catalogs":{source:"iana"},"application/vnd.nokia.conml+wbxml":{source:"iana"},"application/vnd.nokia.conml+xml":{source:"iana",compressible:!0},"application/vnd.nokia.iptv.config+xml":{source:"iana",compressible:!0},"application/vnd.nokia.isds-radio-presets":{source:"iana"},"application/vnd.nokia.landmark+wbxml":{source:"iana"},"application/vnd.nokia.landmark+xml":{source:"iana",compressible:!0},"application/vnd.nokia.landmarkcollection+xml":{source:"iana",compressible:!0},"application/vnd.nokia.n-gage.ac+xml":{source:"iana",compressible:!0,extensions:["ac"]},"application/vnd.nokia.n-gage.data":{source:"iana",extensions:["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{source:"iana",extensions:["n-gage"]},"application/vnd.nokia.ncd":{source:"iana"},"application/vnd.nokia.pcd+wbxml":{source:"iana"},"application/vnd.nokia.pcd+xml":{source:"iana",compressible:!0},"application/vnd.nokia.radio-preset":{source:"iana",extensions:["rpst"]},"application/vnd.nokia.radio-presets":{source:"iana",extensions:["rpss"]},"application/vnd.novadigm.edm":{source:"iana",extensions:["edm"]},"application/vnd.novadigm.edx":{source:"iana",extensions:["edx"]},"application/vnd.novadigm.ext":{source:"iana",extensions:["ext"]},"application/vnd.ntt-local.content-share":{source:"iana"},"application/vnd.ntt-local.file-transfer":{source:"iana"},"application/vnd.ntt-local.ogw_remote-access":{source:"iana"},"application/vnd.ntt-local.sip-ta_remote":{source:"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{source:"iana"},"application/vnd.oasis.opendocument.chart":{source:"iana",extensions:["odc"]},"application/vnd.oasis.opendocument.chart-template":{source:"iana",extensions:["otc"]},"application/vnd.oasis.opendocument.database":{source:"iana",extensions:["odb"]},"application/vnd.oasis.opendocument.formula":{source:"iana",extensions:["odf"]},"application/vnd.oasis.opendocument.formula-template":{source:"iana",extensions:["odft"]},"application/vnd.oasis.opendocument.graphics":{source:"iana",compressible:!1,extensions:["odg"]},"application/vnd.oasis.opendocument.graphics-template":{source:"iana",extensions:["otg"]},"application/vnd.oasis.opendocument.image":{source:"iana",extensions:["odi"]},"application/vnd.oasis.opendocument.image-template":{source:"iana",extensions:["oti"]},"application/vnd.oasis.opendocument.presentation":{source:"iana",compressible:!1,extensions:["odp"]},"application/vnd.oasis.opendocument.presentation-template":{source:"iana",extensions:["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{source:"iana",compressible:!1,extensions:["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{source:"iana",extensions:["ots"]},"application/vnd.oasis.opendocument.text":{source:"iana",compressible:!1,extensions:["odt"]},"application/vnd.oasis.opendocument.text-master":{source:"iana",extensions:["odm"]},"application/vnd.oasis.opendocument.text-template":{source:"iana",extensions:["ott"]},"application/vnd.oasis.opendocument.text-web":{source:"iana",extensions:["oth"]},"application/vnd.obn":{source:"iana"},"application/vnd.ocf+cbor":{source:"iana"},"application/vnd.oci.image.manifest.v1+json":{source:"iana",compressible:!0},"application/vnd.oftn.l10n+json":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessdownload+xml":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessstreaming+xml":{source:"iana",compressible:!0},"application/vnd.oipf.cspg-hexbinary":{source:"iana"},"application/vnd.oipf.dae.svg+xml":{source:"iana",compressible:!0},"application/vnd.oipf.dae.xhtml+xml":{source:"iana",compressible:!0},"application/vnd.oipf.mippvcontrolmessage+xml":{source:"iana",compressible:!0},"application/vnd.oipf.pae.gem":{source:"iana"},"application/vnd.oipf.spdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.oipf.spdlist+xml":{source:"iana",compressible:!0},"application/vnd.oipf.ueprofile+xml":{source:"iana",compressible:!0},"application/vnd.oipf.userprofile+xml":{source:"iana",compressible:!0},"application/vnd.olpc-sugar":{source:"iana",extensions:["xo"]},"application/vnd.oma-scws-config":{source:"iana"},"application/vnd.oma-scws-http-request":{source:"iana"},"application/vnd.oma-scws-http-response":{source:"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.drm-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.imd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.ltkm":{source:"iana"},"application/vnd.oma.bcast.notification+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.provisioningtrigger":{source:"iana"},"application/vnd.oma.bcast.sgboot":{source:"iana"},"application/vnd.oma.bcast.sgdd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sgdu":{source:"iana"},"application/vnd.oma.bcast.simple-symbol-container":{source:"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sprov+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.stkm":{source:"iana"},"application/vnd.oma.cab-address-book+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-feature-handler+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-pcc+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-subs-invite+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-user-prefs+xml":{source:"iana",compressible:!0},"application/vnd.oma.dcd":{source:"iana"},"application/vnd.oma.dcdc":{source:"iana"},"application/vnd.oma.dd2+xml":{source:"iana",compressible:!0,extensions:["dd2"]},"application/vnd.oma.drm.risd+xml":{source:"iana",compressible:!0},"application/vnd.oma.group-usage-list+xml":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+cbor":{source:"iana"},"application/vnd.oma.lwm2m+json":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+tlv":{source:"iana"},"application/vnd.oma.pal+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.detailed-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.final-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.groups+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.invocation-descriptor+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.optimized-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.push":{source:"iana"},"application/vnd.oma.scidm.messages+xml":{source:"iana",compressible:!0},"application/vnd.oma.xcap-directory+xml":{source:"iana",compressible:!0},"application/vnd.omads-email+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-file+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-folder+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omaloc-supl-init":{source:"iana"},"application/vnd.onepager":{source:"iana"},"application/vnd.onepagertamp":{source:"iana"},"application/vnd.onepagertamx":{source:"iana"},"application/vnd.onepagertat":{source:"iana"},"application/vnd.onepagertatp":{source:"iana"},"application/vnd.onepagertatx":{source:"iana"},"application/vnd.openblox.game+xml":{source:"iana",compressible:!0,extensions:["obgx"]},"application/vnd.openblox.game-binary":{source:"iana"},"application/vnd.openeye.oeb":{source:"iana"},"application/vnd.openofficeorg.extension":{source:"apache",extensions:["oxt"]},"application/vnd.openstreetmap.data+xml":{source:"iana",compressible:!0,extensions:["osm"]},"application/vnd.opentimestamps.ots":{source:"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawing+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",compressible:!1,extensions:["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slide":{source:"iana",extensions:["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{source:"iana",extensions:["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.template":{source:"iana",extensions:["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",compressible:!1,extensions:["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{source:"iana",extensions:["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.theme+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.vmldrawing":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",compressible:!1,extensions:["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{source:"iana",extensions:["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.core-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.relationships+xml":{source:"iana",compressible:!0},"application/vnd.oracle.resource+json":{source:"iana",compressible:!0},"application/vnd.orange.indata":{source:"iana"},"application/vnd.osa.netdeploy":{source:"iana"},"application/vnd.osgeo.mapguide.package":{source:"iana",extensions:["mgp"]},"application/vnd.osgi.bundle":{source:"iana"},"application/vnd.osgi.dp":{source:"iana",extensions:["dp"]},"application/vnd.osgi.subsystem":{source:"iana",extensions:["esa"]},"application/vnd.otps.ct-kip+xml":{source:"iana",compressible:!0},"application/vnd.oxli.countgraph":{source:"iana"},"application/vnd.pagerduty+json":{source:"iana",compressible:!0},"application/vnd.palm":{source:"iana",extensions:["pdb","pqa","oprc"]},"application/vnd.panoply":{source:"iana"},"application/vnd.paos.xml":{source:"iana"},"application/vnd.patentdive":{source:"iana"},"application/vnd.patientecommsdoc":{source:"iana"},"application/vnd.pawaafile":{source:"iana",extensions:["paw"]},"application/vnd.pcos":{source:"iana"},"application/vnd.pg.format":{source:"iana",extensions:["str"]},"application/vnd.pg.osasli":{source:"iana",extensions:["ei6"]},"application/vnd.piaccess.application-licence":{source:"iana"},"application/vnd.picsel":{source:"iana",extensions:["efif"]},"application/vnd.pmi.widget":{source:"iana",extensions:["wg"]},"application/vnd.poc.group-advertisement+xml":{source:"iana",compressible:!0},"application/vnd.pocketlearn":{source:"iana",extensions:["plf"]},"application/vnd.powerbuilder6":{source:"iana",extensions:["pbd"]},"application/vnd.powerbuilder6-s":{source:"iana"},"application/vnd.powerbuilder7":{source:"iana"},"application/vnd.powerbuilder7-s":{source:"iana"},"application/vnd.powerbuilder75":{source:"iana"},"application/vnd.powerbuilder75-s":{source:"iana"},"application/vnd.preminet":{source:"iana"},"application/vnd.previewsystems.box":{source:"iana",extensions:["box"]},"application/vnd.proteus.magazine":{source:"iana",extensions:["mgz"]},"application/vnd.psfs":{source:"iana"},"application/vnd.publishare-delta-tree":{source:"iana",extensions:["qps"]},"application/vnd.pvi.ptid1":{source:"iana",extensions:["ptid"]},"application/vnd.pwg-multiplexed":{source:"iana"},"application/vnd.pwg-xhtml-print+xml":{source:"iana",compressible:!0},"application/vnd.qualcomm.brew-app-res":{source:"iana"},"application/vnd.quarantainenet":{source:"iana"},"application/vnd.quark.quarkxpress":{source:"iana",extensions:["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{source:"iana"},"application/vnd.radisys.moml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conn+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-stream+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-base+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-detect+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-group+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-speech+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-transform+xml":{source:"iana",compressible:!0},"application/vnd.rainstor.data":{source:"iana"},"application/vnd.rapid":{source:"iana"},"application/vnd.rar":{source:"iana",extensions:["rar"]},"application/vnd.realvnc.bed":{source:"iana",extensions:["bed"]},"application/vnd.recordare.musicxml":{source:"iana",extensions:["mxl"]},"application/vnd.recordare.musicxml+xml":{source:"iana",compressible:!0,extensions:["musicxml"]},"application/vnd.renlearn.rlprint":{source:"iana"},"application/vnd.resilient.logic":{source:"iana"},"application/vnd.restful+json":{source:"iana",compressible:!0},"application/vnd.rig.cryptonote":{source:"iana",extensions:["cryptonote"]},"application/vnd.rim.cod":{source:"apache",extensions:["cod"]},"application/vnd.rn-realmedia":{source:"apache",extensions:["rm"]},"application/vnd.rn-realmedia-vbr":{source:"apache",extensions:["rmvb"]},"application/vnd.route66.link66+xml":{source:"iana",compressible:!0,extensions:["link66"]},"application/vnd.rs-274x":{source:"iana"},"application/vnd.ruckus.download":{source:"iana"},"application/vnd.s3sms":{source:"iana"},"application/vnd.sailingtracker.track":{source:"iana",extensions:["st"]},"application/vnd.sar":{source:"iana"},"application/vnd.sbm.cid":{source:"iana"},"application/vnd.sbm.mid2":{source:"iana"},"application/vnd.scribus":{source:"iana"},"application/vnd.sealed.3df":{source:"iana"},"application/vnd.sealed.csf":{source:"iana"},"application/vnd.sealed.doc":{source:"iana"},"application/vnd.sealed.eml":{source:"iana"},"application/vnd.sealed.mht":{source:"iana"},"application/vnd.sealed.net":{source:"iana"},"application/vnd.sealed.ppt":{source:"iana"},"application/vnd.sealed.tiff":{source:"iana"},"application/vnd.sealed.xls":{source:"iana"},"application/vnd.sealedmedia.softseal.html":{source:"iana"},"application/vnd.sealedmedia.softseal.pdf":{source:"iana"},"application/vnd.seemail":{source:"iana",extensions:["see"]},"application/vnd.seis+json":{source:"iana",compressible:!0},"application/vnd.sema":{source:"iana",extensions:["sema"]},"application/vnd.semd":{source:"iana",extensions:["semd"]},"application/vnd.semf":{source:"iana",extensions:["semf"]},"application/vnd.shade-save-file":{source:"iana"},"application/vnd.shana.informed.formdata":{source:"iana",extensions:["ifm"]},"application/vnd.shana.informed.formtemplate":{source:"iana",extensions:["itp"]},"application/vnd.shana.informed.interchange":{source:"iana",extensions:["iif"]},"application/vnd.shana.informed.package":{source:"iana",extensions:["ipk"]},"application/vnd.shootproof+json":{source:"iana",compressible:!0},"application/vnd.shopkick+json":{source:"iana",compressible:!0},"application/vnd.shp":{source:"iana"},"application/vnd.shx":{source:"iana"},"application/vnd.sigrok.session":{source:"iana"},"application/vnd.simtech-mindmapper":{source:"iana",extensions:["twd","twds"]},"application/vnd.siren+json":{source:"iana",compressible:!0},"application/vnd.smaf":{source:"iana",extensions:["mmf"]},"application/vnd.smart.notebook":{source:"iana"},"application/vnd.smart.teacher":{source:"iana",extensions:["teacher"]},"application/vnd.snesdev-page-table":{source:"iana"},"application/vnd.software602.filler.form+xml":{source:"iana",compressible:!0,extensions:["fo"]},"application/vnd.software602.filler.form-xml-zip":{source:"iana"},"application/vnd.solent.sdkm+xml":{source:"iana",compressible:!0,extensions:["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{source:"iana",extensions:["dxp"]},"application/vnd.spotfire.sfs":{source:"iana",extensions:["sfs"]},"application/vnd.sqlite3":{source:"iana"},"application/vnd.sss-cod":{source:"iana"},"application/vnd.sss-dtf":{source:"iana"},"application/vnd.sss-ntf":{source:"iana"},"application/vnd.stardivision.calc":{source:"apache",extensions:["sdc"]},"application/vnd.stardivision.draw":{source:"apache",extensions:["sda"]},"application/vnd.stardivision.impress":{source:"apache",extensions:["sdd"]},"application/vnd.stardivision.math":{source:"apache",extensions:["smf"]},"application/vnd.stardivision.writer":{source:"apache",extensions:["sdw","vor"]},"application/vnd.stardivision.writer-global":{source:"apache",extensions:["sgl"]},"application/vnd.stepmania.package":{source:"iana",extensions:["smzip"]},"application/vnd.stepmania.stepchart":{source:"iana",extensions:["sm"]},"application/vnd.street-stream":{source:"iana"},"application/vnd.sun.wadl+xml":{source:"iana",compressible:!0,extensions:["wadl"]},"application/vnd.sun.xml.calc":{source:"apache",extensions:["sxc"]},"application/vnd.sun.xml.calc.template":{source:"apache",extensions:["stc"]},"application/vnd.sun.xml.draw":{source:"apache",extensions:["sxd"]},"application/vnd.sun.xml.draw.template":{source:"apache",extensions:["std"]},"application/vnd.sun.xml.impress":{source:"apache",extensions:["sxi"]},"application/vnd.sun.xml.impress.template":{source:"apache",extensions:["sti"]},"application/vnd.sun.xml.math":{source:"apache",extensions:["sxm"]},"application/vnd.sun.xml.writer":{source:"apache",extensions:["sxw"]},"application/vnd.sun.xml.writer.global":{source:"apache",extensions:["sxg"]},"application/vnd.sun.xml.writer.template":{source:"apache",extensions:["stw"]},"application/vnd.sus-calendar":{source:"iana",extensions:["sus","susp"]},"application/vnd.svd":{source:"iana",extensions:["svd"]},"application/vnd.swiftview-ics":{source:"iana"},"application/vnd.sycle+xml":{source:"iana",compressible:!0},"application/vnd.syft+json":{source:"iana",compressible:!0},"application/vnd.symbian.install":{source:"apache",extensions:["sis","sisx"]},"application/vnd.syncml+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xsm"]},"application/vnd.syncml.dm+wbxml":{source:"iana",charset:"UTF-8",extensions:["bdm"]},"application/vnd.syncml.dm+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xdm"]},"application/vnd.syncml.dm.notification":{source:"iana"},"application/vnd.syncml.dmddf+wbxml":{source:"iana"},"application/vnd.syncml.dmddf+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["ddf"]},"application/vnd.syncml.dmtnds+wbxml":{source:"iana"},"application/vnd.syncml.dmtnds+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.syncml.ds.notification":{source:"iana"},"application/vnd.tableschema+json":{source:"iana",compressible:!0},"application/vnd.tao.intent-module-archive":{source:"iana",extensions:["tao"]},"application/vnd.tcpdump.pcap":{source:"iana",extensions:["pcap","cap","dmp"]},"application/vnd.think-cell.ppttc+json":{source:"iana",compressible:!0},"application/vnd.tmd.mediaflex.api+xml":{source:"iana",compressible:!0},"application/vnd.tml":{source:"iana"},"application/vnd.tmobile-livetv":{source:"iana",extensions:["tmo"]},"application/vnd.tri.onesource":{source:"iana"},"application/vnd.trid.tpt":{source:"iana",extensions:["tpt"]},"application/vnd.triscape.mxs":{source:"iana",extensions:["mxs"]},"application/vnd.trueapp":{source:"iana",extensions:["tra"]},"application/vnd.truedoc":{source:"iana"},"application/vnd.ubisoft.webplayer":{source:"iana"},"application/vnd.ufdl":{source:"iana",extensions:["ufd","ufdl"]},"application/vnd.uiq.theme":{source:"iana",extensions:["utz"]},"application/vnd.umajin":{source:"iana",extensions:["umj"]},"application/vnd.unity":{source:"iana",extensions:["unityweb"]},"application/vnd.uoml+xml":{source:"iana",compressible:!0,extensions:["uoml"]},"application/vnd.uplanet.alert":{source:"iana"},"application/vnd.uplanet.alert-wbxml":{source:"iana"},"application/vnd.uplanet.bearer-choice":{source:"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{source:"iana"},"application/vnd.uplanet.cacheop":{source:"iana"},"application/vnd.uplanet.cacheop-wbxml":{source:"iana"},"application/vnd.uplanet.channel":{source:"iana"},"application/vnd.uplanet.channel-wbxml":{source:"iana"},"application/vnd.uplanet.list":{source:"iana"},"application/vnd.uplanet.list-wbxml":{source:"iana"},"application/vnd.uplanet.listcmd":{source:"iana"},"application/vnd.uplanet.listcmd-wbxml":{source:"iana"},"application/vnd.uplanet.signal":{source:"iana"},"application/vnd.uri-map":{source:"iana"},"application/vnd.valve.source.material":{source:"iana"},"application/vnd.vcx":{source:"iana",extensions:["vcx"]},"application/vnd.vd-study":{source:"iana"},"application/vnd.vectorworks":{source:"iana"},"application/vnd.vel+json":{source:"iana",compressible:!0},"application/vnd.verimatrix.vcas":{source:"iana"},"application/vnd.veritone.aion+json":{source:"iana",compressible:!0},"application/vnd.veryant.thin":{source:"iana"},"application/vnd.ves.encrypted":{source:"iana"},"application/vnd.vidsoft.vidconference":{source:"iana"},"application/vnd.visio":{source:"iana",extensions:["vsd","vst","vss","vsw"]},"application/vnd.visionary":{source:"iana",extensions:["vis"]},"application/vnd.vividence.scriptfile":{source:"iana"},"application/vnd.vsf":{source:"iana",extensions:["vsf"]},"application/vnd.wap.sic":{source:"iana"},"application/vnd.wap.slc":{source:"iana"},"application/vnd.wap.wbxml":{source:"iana",charset:"UTF-8",extensions:["wbxml"]},"application/vnd.wap.wmlc":{source:"iana",extensions:["wmlc"]},"application/vnd.wap.wmlscriptc":{source:"iana",extensions:["wmlsc"]},"application/vnd.webturbo":{source:"iana",extensions:["wtb"]},"application/vnd.wfa.dpp":{source:"iana"},"application/vnd.wfa.p2p":{source:"iana"},"application/vnd.wfa.wsc":{source:"iana"},"application/vnd.windows.devicepairing":{source:"iana"},"application/vnd.wmc":{source:"iana"},"application/vnd.wmf.bootstrap":{source:"iana"},"application/vnd.wolfram.mathematica":{source:"iana"},"application/vnd.wolfram.mathematica.package":{source:"iana"},"application/vnd.wolfram.player":{source:"iana",extensions:["nbp"]},"application/vnd.wordperfect":{source:"iana",extensions:["wpd"]},"application/vnd.wqd":{source:"iana",extensions:["wqd"]},"application/vnd.wrq-hp3000-labelled":{source:"iana"},"application/vnd.wt.stf":{source:"iana",extensions:["stf"]},"application/vnd.wv.csp+wbxml":{source:"iana"},"application/vnd.wv.csp+xml":{source:"iana",compressible:!0},"application/vnd.wv.ssp+xml":{source:"iana",compressible:!0},"application/vnd.xacml+json":{source:"iana",compressible:!0},"application/vnd.xara":{source:"iana",extensions:["xar"]},"application/vnd.xfdl":{source:"iana",extensions:["xfdl"]},"application/vnd.xfdl.webform":{source:"iana"},"application/vnd.xmi+xml":{source:"iana",compressible:!0},"application/vnd.xmpie.cpkg":{source:"iana"},"application/vnd.xmpie.dpkg":{source:"iana"},"application/vnd.xmpie.plan":{source:"iana"},"application/vnd.xmpie.ppkg":{source:"iana"},"application/vnd.xmpie.xlim":{source:"iana"},"application/vnd.yamaha.hv-dic":{source:"iana",extensions:["hvd"]},"application/vnd.yamaha.hv-script":{source:"iana",extensions:["hvs"]},"application/vnd.yamaha.hv-voice":{source:"iana",extensions:["hvp"]},"application/vnd.yamaha.openscoreformat":{source:"iana",extensions:["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{source:"iana",compressible:!0,extensions:["osfpvg"]},"application/vnd.yamaha.remote-setup":{source:"iana"},"application/vnd.yamaha.smaf-audio":{source:"iana",extensions:["saf"]},"application/vnd.yamaha.smaf-phrase":{source:"iana",extensions:["spf"]},"application/vnd.yamaha.through-ngn":{source:"iana"},"application/vnd.yamaha.tunnel-udpencap":{source:"iana"},"application/vnd.yaoweme":{source:"iana"},"application/vnd.yellowriver-custom-menu":{source:"iana",extensions:["cmp"]},"application/vnd.youtube.yt":{source:"iana"},"application/vnd.zul":{source:"iana",extensions:["zir","zirz"]},"application/vnd.zzazz.deck+xml":{source:"iana",compressible:!0,extensions:["zaz"]},"application/voicexml+xml":{source:"iana",compressible:!0,extensions:["vxml"]},"application/voucher-cms+json":{source:"iana",compressible:!0},"application/vq-rtcpxr":{source:"iana"},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"application/watcherinfo+xml":{source:"iana",compressible:!0,extensions:["wif"]},"application/webpush-options+json":{source:"iana",compressible:!0},"application/whoispp-query":{source:"iana"},"application/whoispp-response":{source:"iana"},"application/widget":{source:"iana",extensions:["wgt"]},"application/winhlp":{source:"apache",extensions:["hlp"]},"application/wita":{source:"iana"},"application/wordperfect5.1":{source:"iana"},"application/wsdl+xml":{source:"iana",compressible:!0,extensions:["wsdl"]},"application/wspolicy+xml":{source:"iana",compressible:!0,extensions:["wspolicy"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/x-abiword":{source:"apache",extensions:["abw"]},"application/x-ace-compressed":{source:"apache",extensions:["ace"]},"application/x-amf":{source:"apache"},"application/x-apple-diskimage":{source:"apache",extensions:["dmg"]},"application/x-arj":{compressible:!1,extensions:["arj"]},"application/x-authorware-bin":{source:"apache",extensions:["aab","x32","u32","vox"]},"application/x-authorware-map":{source:"apache",extensions:["aam"]},"application/x-authorware-seg":{source:"apache",extensions:["aas"]},"application/x-bcpio":{source:"apache",extensions:["bcpio"]},"application/x-bdoc":{compressible:!1,extensions:["bdoc"]},"application/x-bittorrent":{source:"apache",extensions:["torrent"]},"application/x-blorb":{source:"apache",extensions:["blb","blorb"]},"application/x-bzip":{source:"apache",compressible:!1,extensions:["bz"]},"application/x-bzip2":{source:"apache",compressible:!1,extensions:["bz2","boz"]},"application/x-cbr":{source:"apache",extensions:["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{source:"apache",extensions:["vcd"]},"application/x-cfs-compressed":{source:"apache",extensions:["cfs"]},"application/x-chat":{source:"apache",extensions:["chat"]},"application/x-chess-pgn":{source:"apache",extensions:["pgn"]},"application/x-chrome-extension":{extensions:["crx"]},"application/x-cocoa":{source:"nginx",extensions:["cco"]},"application/x-compress":{source:"apache"},"application/x-conference":{source:"apache",extensions:["nsc"]},"application/x-cpio":{source:"apache",extensions:["cpio"]},"application/x-csh":{source:"apache",extensions:["csh"]},"application/x-deb":{compressible:!1},"application/x-debian-package":{source:"apache",extensions:["deb","udeb"]},"application/x-dgc-compressed":{source:"apache",extensions:["dgc"]},"application/x-director":{source:"apache",extensions:["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{source:"apache",extensions:["wad"]},"application/x-dtbncx+xml":{source:"apache",compressible:!0,extensions:["ncx"]},"application/x-dtbook+xml":{source:"apache",compressible:!0,extensions:["dtb"]},"application/x-dtbresource+xml":{source:"apache",compressible:!0,extensions:["res"]},"application/x-dvi":{source:"apache",compressible:!1,extensions:["dvi"]},"application/x-envoy":{source:"apache",extensions:["evy"]},"application/x-eva":{source:"apache",extensions:["eva"]},"application/x-font-bdf":{source:"apache",extensions:["bdf"]},"application/x-font-dos":{source:"apache"},"application/x-font-framemaker":{source:"apache"},"application/x-font-ghostscript":{source:"apache",extensions:["gsf"]},"application/x-font-libgrx":{source:"apache"},"application/x-font-linux-psf":{source:"apache",extensions:["psf"]},"application/x-font-pcf":{source:"apache",extensions:["pcf"]},"application/x-font-snf":{source:"apache",extensions:["snf"]},"application/x-font-speedo":{source:"apache"},"application/x-font-sunos-news":{source:"apache"},"application/x-font-type1":{source:"apache",extensions:["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{source:"apache"},"application/x-freearc":{source:"apache",extensions:["arc"]},"application/x-futuresplash":{source:"apache",extensions:["spl"]},"application/x-gca-compressed":{source:"apache",extensions:["gca"]},"application/x-glulx":{source:"apache",extensions:["ulx"]},"application/x-gnumeric":{source:"apache",extensions:["gnumeric"]},"application/x-gramps-xml":{source:"apache",extensions:["gramps"]},"application/x-gtar":{source:"apache",extensions:["gtar"]},"application/x-gzip":{source:"apache"},"application/x-hdf":{source:"apache",extensions:["hdf"]},"application/x-httpd-php":{compressible:!0,extensions:["php"]},"application/x-install-instructions":{source:"apache",extensions:["install"]},"application/x-iso9660-image":{source:"apache",extensions:["iso"]},"application/x-iwork-keynote-sffkey":{extensions:["key"]},"application/x-iwork-numbers-sffnumbers":{extensions:["numbers"]},"application/x-iwork-pages-sffpages":{extensions:["pages"]},"application/x-java-archive-diff":{source:"nginx",extensions:["jardiff"]},"application/x-java-jnlp-file":{source:"apache",compressible:!1,extensions:["jnlp"]},"application/x-javascript":{compressible:!0},"application/x-keepass2":{extensions:["kdbx"]},"application/x-latex":{source:"apache",compressible:!1,extensions:["latex"]},"application/x-lua-bytecode":{extensions:["luac"]},"application/x-lzh-compressed":{source:"apache",extensions:["lzh","lha"]},"application/x-makeself":{source:"nginx",extensions:["run"]},"application/x-mie":{source:"apache",extensions:["mie"]},"application/x-mobipocket-ebook":{source:"apache",extensions:["prc","mobi"]},"application/x-mpegurl":{compressible:!1},"application/x-ms-application":{source:"apache",extensions:["application"]},"application/x-ms-shortcut":{source:"apache",extensions:["lnk"]},"application/x-ms-wmd":{source:"apache",extensions:["wmd"]},"application/x-ms-wmz":{source:"apache",extensions:["wmz"]},"application/x-ms-xbap":{source:"apache",extensions:["xbap"]},"application/x-msaccess":{source:"apache",extensions:["mdb"]},"application/x-msbinder":{source:"apache",extensions:["obd"]},"application/x-mscardfile":{source:"apache",extensions:["crd"]},"application/x-msclip":{source:"apache",extensions:["clp"]},"application/x-msdos-program":{extensions:["exe"]},"application/x-msdownload":{source:"apache",extensions:["exe","dll","com","bat","msi"]},"application/x-msmediaview":{source:"apache",extensions:["mvb","m13","m14"]},"application/x-msmetafile":{source:"apache",extensions:["wmf","wmz","emf","emz"]},"application/x-msmoney":{source:"apache",extensions:["mny"]},"application/x-mspublisher":{source:"apache",extensions:["pub"]},"application/x-msschedule":{source:"apache",extensions:["scd"]},"application/x-msterminal":{source:"apache",extensions:["trm"]},"application/x-mswrite":{source:"apache",extensions:["wri"]},"application/x-netcdf":{source:"apache",extensions:["nc","cdf"]},"application/x-ns-proxy-autoconfig":{compressible:!0,extensions:["pac"]},"application/x-nzb":{source:"apache",extensions:["nzb"]},"application/x-perl":{source:"nginx",extensions:["pl","pm"]},"application/x-pilot":{source:"nginx",extensions:["prc","pdb"]},"application/x-pkcs12":{source:"apache",compressible:!1,extensions:["p12","pfx"]},"application/x-pkcs7-certificates":{source:"apache",extensions:["p7b","spc"]},"application/x-pkcs7-certreqresp":{source:"apache",extensions:["p7r"]},"application/x-pki-message":{source:"iana"},"application/x-rar-compressed":{source:"apache",compressible:!1,extensions:["rar"]},"application/x-redhat-package-manager":{source:"nginx",extensions:["rpm"]},"application/x-research-info-systems":{source:"apache",extensions:["ris"]},"application/x-sea":{source:"nginx",extensions:["sea"]},"application/x-sh":{source:"apache",compressible:!0,extensions:["sh"]},"application/x-shar":{source:"apache",extensions:["shar"]},"application/x-shockwave-flash":{source:"apache",compressible:!1,extensions:["swf"]},"application/x-silverlight-app":{source:"apache",extensions:["xap"]},"application/x-sql":{source:"apache",extensions:["sql"]},"application/x-stuffit":{source:"apache",compressible:!1,extensions:["sit"]},"application/x-stuffitx":{source:"apache",extensions:["sitx"]},"application/x-subrip":{source:"apache",extensions:["srt"]},"application/x-sv4cpio":{source:"apache",extensions:["sv4cpio"]},"application/x-sv4crc":{source:"apache",extensions:["sv4crc"]},"application/x-t3vm-image":{source:"apache",extensions:["t3"]},"application/x-tads":{source:"apache",extensions:["gam"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-tcl":{source:"apache",extensions:["tcl","tk"]},"application/x-tex":{source:"apache",extensions:["tex"]},"application/x-tex-tfm":{source:"apache",extensions:["tfm"]},"application/x-texinfo":{source:"apache",extensions:["texinfo","texi"]},"application/x-tgif":{source:"apache",extensions:["obj"]},"application/x-ustar":{source:"apache",extensions:["ustar"]},"application/x-virtualbox-hdd":{compressible:!0,extensions:["hdd"]},"application/x-virtualbox-ova":{compressible:!0,extensions:["ova"]},"application/x-virtualbox-ovf":{compressible:!0,extensions:["ovf"]},"application/x-virtualbox-vbox":{compressible:!0,extensions:["vbox"]},"application/x-virtualbox-vbox-extpack":{compressible:!1,extensions:["vbox-extpack"]},"application/x-virtualbox-vdi":{compressible:!0,extensions:["vdi"]},"application/x-virtualbox-vhd":{compressible:!0,extensions:["vhd"]},"application/x-virtualbox-vmdk":{compressible:!0,extensions:["vmdk"]},"application/x-wais-source":{source:"apache",extensions:["src"]},"application/x-web-app-manifest+json":{compressible:!0,extensions:["webapp"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"application/x-x509-ca-cert":{source:"iana",extensions:["der","crt","pem"]},"application/x-x509-ca-ra-cert":{source:"iana"},"application/x-x509-next-ca-cert":{source:"iana"},"application/x-xfig":{source:"apache",extensions:["fig"]},"application/x-xliff+xml":{source:"apache",compressible:!0,extensions:["xlf"]},"application/x-xpinstall":{source:"apache",compressible:!1,extensions:["xpi"]},"application/x-xz":{source:"apache",extensions:["xz"]},"application/x-zmachine":{source:"apache",extensions:["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{source:"iana"},"application/xacml+xml":{source:"iana",compressible:!0},"application/xaml+xml":{source:"apache",compressible:!0,extensions:["xaml"]},"application/xcap-att+xml":{source:"iana",compressible:!0,extensions:["xav"]},"application/xcap-caps+xml":{source:"iana",compressible:!0,extensions:["xca"]},"application/xcap-diff+xml":{source:"iana",compressible:!0,extensions:["xdf"]},"application/xcap-el+xml":{source:"iana",compressible:!0,extensions:["xel"]},"application/xcap-error+xml":{source:"iana",compressible:!0},"application/xcap-ns+xml":{source:"iana",compressible:!0,extensions:["xns"]},"application/xcon-conference-info+xml":{source:"iana",compressible:!0},"application/xcon-conference-info-diff+xml":{source:"iana",compressible:!0},"application/xenc+xml":{source:"iana",compressible:!0,extensions:["xenc"]},"application/xhtml+xml":{source:"iana",compressible:!0,extensions:["xhtml","xht"]},"application/xhtml-voice+xml":{source:"apache",compressible:!0},"application/xliff+xml":{source:"iana",compressible:!0,extensions:["xlf"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml","xsl","xsd","rng"]},"application/xml-dtd":{source:"iana",compressible:!0,extensions:["dtd"]},"application/xml-external-parsed-entity":{source:"iana"},"application/xml-patch+xml":{source:"iana",compressible:!0},"application/xmpp+xml":{source:"iana",compressible:!0},"application/xop+xml":{source:"iana",compressible:!0,extensions:["xop"]},"application/xproc+xml":{source:"apache",compressible:!0,extensions:["xpl"]},"application/xslt+xml":{source:"iana",compressible:!0,extensions:["xsl","xslt"]},"application/xspf+xml":{source:"apache",compressible:!0,extensions:["xspf"]},"application/xv+xml":{source:"iana",compressible:!0,extensions:["mxml","xhvml","xvml","xvm"]},"application/yang":{source:"iana",extensions:["yang"]},"application/yang-data+json":{source:"iana",compressible:!0},"application/yang-data+xml":{source:"iana",compressible:!0},"application/yang-patch+json":{source:"iana",compressible:!0},"application/yang-patch+xml":{source:"iana",compressible:!0},"application/yin+xml":{source:"iana",compressible:!0,extensions:["yin"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/zlib":{source:"iana"},"application/zstd":{source:"iana"},"audio/1d-interleaved-parityfec":{source:"iana"},"audio/32kadpcm":{source:"iana"},"audio/3gpp":{source:"iana",compressible:!1,extensions:["3gpp"]},"audio/3gpp2":{source:"iana"},"audio/aac":{source:"iana"},"audio/ac3":{source:"iana"},"audio/adpcm":{source:"apache",extensions:["adp"]},"audio/amr":{source:"iana",extensions:["amr"]},"audio/amr-wb":{source:"iana"},"audio/amr-wb+":{source:"iana"},"audio/aptx":{source:"iana"},"audio/asc":{source:"iana"},"audio/atrac-advanced-lossless":{source:"iana"},"audio/atrac-x":{source:"iana"},"audio/atrac3":{source:"iana"},"audio/basic":{source:"iana",compressible:!1,extensions:["au","snd"]},"audio/bv16":{source:"iana"},"audio/bv32":{source:"iana"},"audio/clearmode":{source:"iana"},"audio/cn":{source:"iana"},"audio/dat12":{source:"iana"},"audio/dls":{source:"iana"},"audio/dsr-es201108":{source:"iana"},"audio/dsr-es202050":{source:"iana"},"audio/dsr-es202211":{source:"iana"},"audio/dsr-es202212":{source:"iana"},"audio/dv":{source:"iana"},"audio/dvi4":{source:"iana"},"audio/eac3":{source:"iana"},"audio/encaprtp":{source:"iana"},"audio/evrc":{source:"iana"},"audio/evrc-qcp":{source:"iana"},"audio/evrc0":{source:"iana"},"audio/evrc1":{source:"iana"},"audio/evrcb":{source:"iana"},"audio/evrcb0":{source:"iana"},"audio/evrcb1":{source:"iana"},"audio/evrcnw":{source:"iana"},"audio/evrcnw0":{source:"iana"},"audio/evrcnw1":{source:"iana"},"audio/evrcwb":{source:"iana"},"audio/evrcwb0":{source:"iana"},"audio/evrcwb1":{source:"iana"},"audio/evs":{source:"iana"},"audio/flexfec":{source:"iana"},"audio/fwdred":{source:"iana"},"audio/g711-0":{source:"iana"},"audio/g719":{source:"iana"},"audio/g722":{source:"iana"},"audio/g7221":{source:"iana"},"audio/g723":{source:"iana"},"audio/g726-16":{source:"iana"},"audio/g726-24":{source:"iana"},"audio/g726-32":{source:"iana"},"audio/g726-40":{source:"iana"},"audio/g728":{source:"iana"},"audio/g729":{source:"iana"},"audio/g7291":{source:"iana"},"audio/g729d":{source:"iana"},"audio/g729e":{source:"iana"},"audio/gsm":{source:"iana"},"audio/gsm-efr":{source:"iana"},"audio/gsm-hr-08":{source:"iana"},"audio/ilbc":{source:"iana"},"audio/ip-mr_v2.5":{source:"iana"},"audio/isac":{source:"apache"},"audio/l16":{source:"iana"},"audio/l20":{source:"iana"},"audio/l24":{source:"iana",compressible:!1},"audio/l8":{source:"iana"},"audio/lpc":{source:"iana"},"audio/melp":{source:"iana"},"audio/melp1200":{source:"iana"},"audio/melp2400":{source:"iana"},"audio/melp600":{source:"iana"},"audio/mhas":{source:"iana"},"audio/midi":{source:"apache",extensions:["mid","midi","kar","rmi"]},"audio/mobile-xmf":{source:"iana",extensions:["mxmf"]},"audio/mp3":{compressible:!1,extensions:["mp3"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a","mp4a"]},"audio/mp4a-latm":{source:"iana"},"audio/mpa":{source:"iana"},"audio/mpa-robust":{source:"iana"},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{source:"iana"},"audio/musepack":{source:"apache"},"audio/ogg":{source:"iana",compressible:!1,extensions:["oga","ogg","spx","opus"]},"audio/opus":{source:"iana"},"audio/parityfec":{source:"iana"},"audio/pcma":{source:"iana"},"audio/pcma-wb":{source:"iana"},"audio/pcmu":{source:"iana"},"audio/pcmu-wb":{source:"iana"},"audio/prs.sid":{source:"iana"},"audio/qcelp":{source:"iana"},"audio/raptorfec":{source:"iana"},"audio/red":{source:"iana"},"audio/rtp-enc-aescm128":{source:"iana"},"audio/rtp-midi":{source:"iana"},"audio/rtploopback":{source:"iana"},"audio/rtx":{source:"iana"},"audio/s3m":{source:"apache",extensions:["s3m"]},"audio/scip":{source:"iana"},"audio/silk":{source:"apache",extensions:["sil"]},"audio/smv":{source:"iana"},"audio/smv-qcp":{source:"iana"},"audio/smv0":{source:"iana"},"audio/sofa":{source:"iana"},"audio/sp-midi":{source:"iana"},"audio/speex":{source:"iana"},"audio/t140c":{source:"iana"},"audio/t38":{source:"iana"},"audio/telephone-event":{source:"iana"},"audio/tetra_acelp":{source:"iana"},"audio/tetra_acelp_bb":{source:"iana"},"audio/tone":{source:"iana"},"audio/tsvcis":{source:"iana"},"audio/uemclip":{source:"iana"},"audio/ulpfec":{source:"iana"},"audio/usac":{source:"iana"},"audio/vdvi":{source:"iana"},"audio/vmr-wb":{source:"iana"},"audio/vnd.3gpp.iufp":{source:"iana"},"audio/vnd.4sb":{source:"iana"},"audio/vnd.audiokoz":{source:"iana"},"audio/vnd.celp":{source:"iana"},"audio/vnd.cisco.nse":{source:"iana"},"audio/vnd.cmles.radio-events":{source:"iana"},"audio/vnd.cns.anp1":{source:"iana"},"audio/vnd.cns.inf1":{source:"iana"},"audio/vnd.dece.audio":{source:"iana",extensions:["uva","uvva"]},"audio/vnd.digital-winds":{source:"iana",extensions:["eol"]},"audio/vnd.dlna.adts":{source:"iana"},"audio/vnd.dolby.heaac.1":{source:"iana"},"audio/vnd.dolby.heaac.2":{source:"iana"},"audio/vnd.dolby.mlp":{source:"iana"},"audio/vnd.dolby.mps":{source:"iana"},"audio/vnd.dolby.pl2":{source:"iana"},"audio/vnd.dolby.pl2x":{source:"iana"},"audio/vnd.dolby.pl2z":{source:"iana"},"audio/vnd.dolby.pulse.1":{source:"iana"},"audio/vnd.dra":{source:"iana",extensions:["dra"]},"audio/vnd.dts":{source:"iana",extensions:["dts"]},"audio/vnd.dts.hd":{source:"iana",extensions:["dtshd"]},"audio/vnd.dts.uhd":{source:"iana"},"audio/vnd.dvb.file":{source:"iana"},"audio/vnd.everad.plj":{source:"iana"},"audio/vnd.hns.audio":{source:"iana"},"audio/vnd.lucent.voice":{source:"iana",extensions:["lvp"]},"audio/vnd.ms-playready.media.pya":{source:"iana",extensions:["pya"]},"audio/vnd.nokia.mobile-xmf":{source:"iana"},"audio/vnd.nortel.vbk":{source:"iana"},"audio/vnd.nuera.ecelp4800":{source:"iana",extensions:["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{source:"iana",extensions:["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{source:"iana",extensions:["ecelp9600"]},"audio/vnd.octel.sbc":{source:"iana"},"audio/vnd.presonus.multitrack":{source:"iana"},"audio/vnd.qcelp":{source:"iana"},"audio/vnd.rhetorex.32kadpcm":{source:"iana"},"audio/vnd.rip":{source:"iana",extensions:["rip"]},"audio/vnd.rn-realaudio":{compressible:!1},"audio/vnd.sealedmedia.softseal.mpeg":{source:"iana"},"audio/vnd.vmx.cvsd":{source:"iana"},"audio/vnd.wave":{compressible:!1},"audio/vorbis":{source:"iana",compressible:!1},"audio/vorbis-config":{source:"iana"},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/wave":{compressible:!1,extensions:["wav"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/x-aac":{source:"apache",compressible:!1,extensions:["aac"]},"audio/x-aiff":{source:"apache",extensions:["aif","aiff","aifc"]},"audio/x-caf":{source:"apache",compressible:!1,extensions:["caf"]},"audio/x-flac":{source:"apache",extensions:["flac"]},"audio/x-m4a":{source:"nginx",extensions:["m4a"]},"audio/x-matroska":{source:"apache",extensions:["mka"]},"audio/x-mpegurl":{source:"apache",extensions:["m3u"]},"audio/x-ms-wax":{source:"apache",extensions:["wax"]},"audio/x-ms-wma":{source:"apache",extensions:["wma"]},"audio/x-pn-realaudio":{source:"apache",extensions:["ram","ra"]},"audio/x-pn-realaudio-plugin":{source:"apache",extensions:["rmp"]},"audio/x-realaudio":{source:"nginx",extensions:["ra"]},"audio/x-tta":{source:"apache"},"audio/x-wav":{source:"apache",extensions:["wav"]},"audio/xm":{source:"apache",extensions:["xm"]},"chemical/x-cdx":{source:"apache",extensions:["cdx"]},"chemical/x-cif":{source:"apache",extensions:["cif"]},"chemical/x-cmdf":{source:"apache",extensions:["cmdf"]},"chemical/x-cml":{source:"apache",extensions:["cml"]},"chemical/x-csml":{source:"apache",extensions:["csml"]},"chemical/x-pdb":{source:"apache"},"chemical/x-xyz":{source:"apache",extensions:["xyz"]},"font/collection":{source:"iana",extensions:["ttc"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"font/sfnt":{source:"iana"},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/woff":{source:"iana",extensions:["woff"]},"font/woff2":{source:"iana",extensions:["woff2"]},"image/aces":{source:"iana",extensions:["exr"]},"image/apng":{compressible:!1,extensions:["apng"]},"image/avci":{source:"iana",extensions:["avci"]},"image/avcs":{source:"iana",extensions:["avcs"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/cgm":{source:"iana",extensions:["cgm"]},"image/dicom-rle":{source:"iana",extensions:["drle"]},"image/emf":{source:"iana",extensions:["emf"]},"image/fits":{source:"iana",extensions:["fits"]},"image/g3fax":{source:"iana",extensions:["g3"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/heic":{source:"iana",extensions:["heic"]},"image/heic-sequence":{source:"iana",extensions:["heics"]},"image/heif":{source:"iana",extensions:["heif"]},"image/heif-sequence":{source:"iana",extensions:["heifs"]},"image/hej2k":{source:"iana",extensions:["hej2"]},"image/hsj2":{source:"iana",extensions:["hsj2"]},"image/ief":{source:"iana",extensions:["ief"]},"image/jls":{source:"iana",extensions:["jls"]},"image/jp2":{source:"iana",compressible:!1,extensions:["jp2","jpg2"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/jph":{source:"iana",extensions:["jph"]},"image/jphc":{source:"iana",extensions:["jhc"]},"image/jpm":{source:"iana",compressible:!1,extensions:["jpm"]},"image/jpx":{source:"iana",compressible:!1,extensions:["jpx","jpf"]},"image/jxr":{source:"iana",extensions:["jxr"]},"image/jxra":{source:"iana",extensions:["jxra"]},"image/jxrs":{source:"iana",extensions:["jxrs"]},"image/jxs":{source:"iana",extensions:["jxs"]},"image/jxsc":{source:"iana",extensions:["jxsc"]},"image/jxsi":{source:"iana",extensions:["jxsi"]},"image/jxss":{source:"iana",extensions:["jxss"]},"image/ktx":{source:"iana",extensions:["ktx"]},"image/ktx2":{source:"iana",extensions:["ktx2"]},"image/naplps":{source:"iana"},"image/pjpeg":{compressible:!1},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/prs.btif":{source:"iana",extensions:["btif"]},"image/prs.pti":{source:"iana",extensions:["pti"]},"image/pwg-raster":{source:"iana"},"image/sgi":{source:"apache",extensions:["sgi"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/t38":{source:"iana",extensions:["t38"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tif","tiff"]},"image/tiff-fx":{source:"iana",extensions:["tfx"]},"image/vnd.adobe.photoshop":{source:"iana",compressible:!0,extensions:["psd"]},"image/vnd.airzip.accelerator.azv":{source:"iana",extensions:["azv"]},"image/vnd.cns.inf2":{source:"iana"},"image/vnd.dece.graphic":{source:"iana",extensions:["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{source:"iana",extensions:["djvu","djv"]},"image/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"image/vnd.dwg":{source:"iana",extensions:["dwg"]},"image/vnd.dxf":{source:"iana",extensions:["dxf"]},"image/vnd.fastbidsheet":{source:"iana",extensions:["fbs"]},"image/vnd.fpx":{source:"iana",extensions:["fpx"]},"image/vnd.fst":{source:"iana",extensions:["fst"]},"image/vnd.fujixerox.edmics-mmr":{source:"iana",extensions:["mmr"]},"image/vnd.fujixerox.edmics-rlc":{source:"iana",extensions:["rlc"]},"image/vnd.globalgraphics.pgb":{source:"iana"},"image/vnd.microsoft.icon":{source:"iana",compressible:!0,extensions:["ico"]},"image/vnd.mix":{source:"iana"},"image/vnd.mozilla.apng":{source:"iana"},"image/vnd.ms-dds":{compressible:!0,extensions:["dds"]},"image/vnd.ms-modi":{source:"iana",extensions:["mdi"]},"image/vnd.ms-photo":{source:"apache",extensions:["wdp"]},"image/vnd.net-fpx":{source:"iana",extensions:["npx"]},"image/vnd.pco.b16":{source:"iana",extensions:["b16"]},"image/vnd.radiance":{source:"iana"},"image/vnd.sealed.png":{source:"iana"},"image/vnd.sealedmedia.softseal.gif":{source:"iana"},"image/vnd.sealedmedia.softseal.jpg":{source:"iana"},"image/vnd.svf":{source:"iana"},"image/vnd.tencent.tap":{source:"iana",extensions:["tap"]},"image/vnd.valve.source.texture":{source:"iana",extensions:["vtf"]},"image/vnd.wap.wbmp":{source:"iana",extensions:["wbmp"]},"image/vnd.xiff":{source:"iana",extensions:["xif"]},"image/vnd.zbrush.pcx":{source:"iana",extensions:["pcx"]},"image/webp":{source:"apache",extensions:["webp"]},"image/wmf":{source:"iana",extensions:["wmf"]},"image/x-3ds":{source:"apache",extensions:["3ds"]},"image/x-cmu-raster":{source:"apache",extensions:["ras"]},"image/x-cmx":{source:"apache",extensions:["cmx"]},"image/x-freehand":{source:"apache",extensions:["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/x-jng":{source:"nginx",extensions:["jng"]},"image/x-mrsid-image":{source:"apache",extensions:["sid"]},"image/x-ms-bmp":{source:"nginx",compressible:!0,extensions:["bmp"]},"image/x-pcx":{source:"apache",extensions:["pcx"]},"image/x-pict":{source:"apache",extensions:["pic","pct"]},"image/x-portable-anymap":{source:"apache",extensions:["pnm"]},"image/x-portable-bitmap":{source:"apache",extensions:["pbm"]},"image/x-portable-graymap":{source:"apache",extensions:["pgm"]},"image/x-portable-pixmap":{source:"apache",extensions:["ppm"]},"image/x-rgb":{source:"apache",extensions:["rgb"]},"image/x-tga":{source:"apache",extensions:["tga"]},"image/x-xbitmap":{source:"apache",extensions:["xbm"]},"image/x-xcf":{compressible:!1},"image/x-xpixmap":{source:"apache",extensions:["xpm"]},"image/x-xwindowdump":{source:"apache",extensions:["xwd"]},"message/cpim":{source:"iana"},"message/delivery-status":{source:"iana"},"message/disposition-notification":{source:"iana",extensions:["disposition-notification"]},"message/external-body":{source:"iana"},"message/feedback-report":{source:"iana"},"message/global":{source:"iana",extensions:["u8msg"]},"message/global-delivery-status":{source:"iana",extensions:["u8dsn"]},"message/global-disposition-notification":{source:"iana",extensions:["u8mdn"]},"message/global-headers":{source:"iana",extensions:["u8hdr"]},"message/http":{source:"iana",compressible:!1},"message/imdn+xml":{source:"iana",compressible:!0},"message/news":{source:"iana"},"message/partial":{source:"iana",compressible:!1},"message/rfc822":{source:"iana",compressible:!0,extensions:["eml","mime"]},"message/s-http":{source:"iana"},"message/sip":{source:"iana"},"message/sipfrag":{source:"iana"},"message/tracking-status":{source:"iana"},"message/vnd.si.simp":{source:"iana"},"message/vnd.wfa.wsc":{source:"iana",extensions:["wsc"]},"model/3mf":{source:"iana",extensions:["3mf"]},"model/e57":{source:"iana"},"model/gltf+json":{source:"iana",compressible:!0,extensions:["gltf"]},"model/gltf-binary":{source:"iana",compressible:!0,extensions:["glb"]},"model/iges":{source:"iana",compressible:!1,extensions:["igs","iges"]},"model/mesh":{source:"iana",compressible:!1,extensions:["msh","mesh","silo"]},"model/mtl":{source:"iana",extensions:["mtl"]},"model/obj":{source:"iana",extensions:["obj"]},"model/step":{source:"iana"},"model/step+xml":{source:"iana",compressible:!0,extensions:["stpx"]},"model/step+zip":{source:"iana",compressible:!1,extensions:["stpz"]},"model/step-xml+zip":{source:"iana",compressible:!1,extensions:["stpxz"]},"model/stl":{source:"iana",extensions:["stl"]},"model/vnd.collada+xml":{source:"iana",compressible:!0,extensions:["dae"]},"model/vnd.dwf":{source:"iana",extensions:["dwf"]},"model/vnd.flatland.3dml":{source:"iana"},"model/vnd.gdl":{source:"iana",extensions:["gdl"]},"model/vnd.gs-gdl":{source:"apache"},"model/vnd.gs.gdl":{source:"iana"},"model/vnd.gtw":{source:"iana",extensions:["gtw"]},"model/vnd.moml+xml":{source:"iana",compressible:!0},"model/vnd.mts":{source:"iana",extensions:["mts"]},"model/vnd.opengex":{source:"iana",extensions:["ogex"]},"model/vnd.parasolid.transmit.binary":{source:"iana",extensions:["x_b"]},"model/vnd.parasolid.transmit.text":{source:"iana",extensions:["x_t"]},"model/vnd.pytha.pyox":{source:"iana"},"model/vnd.rosette.annotated-data-model":{source:"iana"},"model/vnd.sap.vds":{source:"iana",extensions:["vds"]},"model/vnd.usdz+zip":{source:"iana",compressible:!1,extensions:["usdz"]},"model/vnd.valve.source.compiled-map":{source:"iana",extensions:["bsp"]},"model/vnd.vtu":{source:"iana",extensions:["vtu"]},"model/vrml":{source:"iana",compressible:!1,extensions:["wrl","vrml"]},"model/x3d+binary":{source:"apache",compressible:!1,extensions:["x3db","x3dbz"]},"model/x3d+fastinfoset":{source:"iana",extensions:["x3db"]},"model/x3d+vrml":{source:"apache",compressible:!1,extensions:["x3dv","x3dvz"]},"model/x3d+xml":{source:"iana",compressible:!0,extensions:["x3d","x3dz"]},"model/x3d-vrml":{source:"iana",extensions:["x3dv"]},"multipart/alternative":{source:"iana",compressible:!1},"multipart/appledouble":{source:"iana"},"multipart/byteranges":{source:"iana"},"multipart/digest":{source:"iana"},"multipart/encrypted":{source:"iana",compressible:!1},"multipart/form-data":{source:"iana",compressible:!1},"multipart/header-set":{source:"iana"},"multipart/mixed":{source:"iana"},"multipart/multilingual":{source:"iana"},"multipart/parallel":{source:"iana"},"multipart/related":{source:"iana",compressible:!1},"multipart/report":{source:"iana"},"multipart/signed":{source:"iana",compressible:!1},"multipart/vnd.bint.med-plus":{source:"iana"},"multipart/voice-message":{source:"iana"},"multipart/x-mixed-replace":{source:"iana"},"text/1d-interleaved-parityfec":{source:"iana"},"text/cache-manifest":{source:"iana",compressible:!0,extensions:["appcache","manifest"]},"text/calendar":{source:"iana",extensions:["ics","ifb"]},"text/calender":{compressible:!0},"text/cmd":{compressible:!0},"text/coffeescript":{extensions:["coffee","litcoffee"]},"text/cql":{source:"iana"},"text/cql-expression":{source:"iana"},"text/cql-identifier":{source:"iana"},"text/css":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["css"]},"text/csv":{source:"iana",compressible:!0,extensions:["csv"]},"text/csv-schema":{source:"iana"},"text/directory":{source:"iana"},"text/dns":{source:"iana"},"text/ecmascript":{source:"iana"},"text/encaprtp":{source:"iana"},"text/enriched":{source:"iana"},"text/fhirpath":{source:"iana"},"text/flexfec":{source:"iana"},"text/fwdred":{source:"iana"},"text/gff3":{source:"iana"},"text/grammar-ref-list":{source:"iana"},"text/html":{source:"iana",compressible:!0,extensions:["html","htm","shtml"]},"text/jade":{extensions:["jade"]},"text/javascript":{source:"iana",compressible:!0},"text/jcr-cnd":{source:"iana"},"text/jsx":{compressible:!0,extensions:["jsx"]},"text/less":{compressible:!0,extensions:["less"]},"text/markdown":{source:"iana",compressible:!0,extensions:["markdown","md"]},"text/mathml":{source:"nginx",extensions:["mml"]},"text/mdx":{compressible:!0,extensions:["mdx"]},"text/mizar":{source:"iana"},"text/n3":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["n3"]},"text/parameters":{source:"iana",charset:"UTF-8"},"text/parityfec":{source:"iana"},"text/plain":{source:"iana",compressible:!0,extensions:["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{source:"iana",charset:"UTF-8"},"text/prs.fallenstein.rst":{source:"iana"},"text/prs.lines.tag":{source:"iana",extensions:["dsc"]},"text/prs.prop.logic":{source:"iana"},"text/raptorfec":{source:"iana"},"text/red":{source:"iana"},"text/rfc822-headers":{source:"iana"},"text/richtext":{source:"iana",compressible:!0,extensions:["rtx"]},"text/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"text/rtp-enc-aescm128":{source:"iana"},"text/rtploopback":{source:"iana"},"text/rtx":{source:"iana"},"text/sgml":{source:"iana",extensions:["sgml","sgm"]},"text/shaclc":{source:"iana"},"text/shex":{source:"iana",extensions:["shex"]},"text/slim":{extensions:["slim","slm"]},"text/spdx":{source:"iana",extensions:["spdx"]},"text/strings":{source:"iana"},"text/stylus":{extensions:["stylus","styl"]},"text/t140":{source:"iana"},"text/tab-separated-values":{source:"iana",compressible:!0,extensions:["tsv"]},"text/troff":{source:"iana",extensions:["t","tr","roff","man","me","ms"]},"text/turtle":{source:"iana",charset:"UTF-8",extensions:["ttl"]},"text/ulpfec":{source:"iana"},"text/uri-list":{source:"iana",compressible:!0,extensions:["uri","uris","urls"]},"text/vcard":{source:"iana",compressible:!0,extensions:["vcard"]},"text/vnd.a":{source:"iana"},"text/vnd.abc":{source:"iana"},"text/vnd.ascii-art":{source:"iana"},"text/vnd.curl":{source:"iana",extensions:["curl"]},"text/vnd.curl.dcurl":{source:"apache",extensions:["dcurl"]},"text/vnd.curl.mcurl":{source:"apache",extensions:["mcurl"]},"text/vnd.curl.scurl":{source:"apache",extensions:["scurl"]},"text/vnd.debian.copyright":{source:"iana",charset:"UTF-8"},"text/vnd.dmclientscript":{source:"iana"},"text/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"text/vnd.esmertec.theme-descriptor":{source:"iana",charset:"UTF-8"},"text/vnd.familysearch.gedcom":{source:"iana",extensions:["ged"]},"text/vnd.ficlab.flt":{source:"iana"},"text/vnd.fly":{source:"iana",extensions:["fly"]},"text/vnd.fmi.flexstor":{source:"iana",extensions:["flx"]},"text/vnd.gml":{source:"iana"},"text/vnd.graphviz":{source:"iana",extensions:["gv"]},"text/vnd.hans":{source:"iana"},"text/vnd.hgl":{source:"iana"},"text/vnd.in3d.3dml":{source:"iana",extensions:["3dml"]},"text/vnd.in3d.spot":{source:"iana",extensions:["spot"]},"text/vnd.iptc.newsml":{source:"iana"},"text/vnd.iptc.nitf":{source:"iana"},"text/vnd.latex-z":{source:"iana"},"text/vnd.motorola.reflex":{source:"iana"},"text/vnd.ms-mediapackage":{source:"iana"},"text/vnd.net2phone.commcenter.command":{source:"iana"},"text/vnd.radisys.msml-basic-layout":{source:"iana"},"text/vnd.senx.warpscript":{source:"iana"},"text/vnd.si.uricatalogue":{source:"iana"},"text/vnd.sosi":{source:"iana"},"text/vnd.sun.j2me.app-descriptor":{source:"iana",charset:"UTF-8",extensions:["jad"]},"text/vnd.trolltech.linguist":{source:"iana",charset:"UTF-8"},"text/vnd.wap.si":{source:"iana"},"text/vnd.wap.sl":{source:"iana"},"text/vnd.wap.wml":{source:"iana",extensions:["wml"]},"text/vnd.wap.wmlscript":{source:"iana",extensions:["wmls"]},"text/vtt":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["vtt"]},"text/x-asm":{source:"apache",extensions:["s","asm"]},"text/x-c":{source:"apache",extensions:["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{source:"nginx",extensions:["htc"]},"text/x-fortran":{source:"apache",extensions:["f","for","f77","f90"]},"text/x-gwt-rpc":{compressible:!0},"text/x-handlebars-template":{extensions:["hbs"]},"text/x-java-source":{source:"apache",extensions:["java"]},"text/x-jquery-tmpl":{compressible:!0},"text/x-lua":{extensions:["lua"]},"text/x-markdown":{compressible:!0,extensions:["mkd"]},"text/x-nfo":{source:"apache",extensions:["nfo"]},"text/x-opml":{source:"apache",extensions:["opml"]},"text/x-org":{compressible:!0,extensions:["org"]},"text/x-pascal":{source:"apache",extensions:["p","pas"]},"text/x-processing":{compressible:!0,extensions:["pde"]},"text/x-sass":{extensions:["sass"]},"text/x-scss":{extensions:["scss"]},"text/x-setext":{source:"apache",extensions:["etx"]},"text/x-sfv":{source:"apache",extensions:["sfv"]},"text/x-suse-ymp":{compressible:!0,extensions:["ymp"]},"text/x-uuencode":{source:"apache",extensions:["uu"]},"text/x-vcalendar":{source:"apache",extensions:["vcs"]},"text/x-vcard":{source:"apache",extensions:["vcf"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/xml-external-parsed-entity":{source:"iana"},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"video/1d-interleaved-parityfec":{source:"iana"},"video/3gpp":{source:"iana",extensions:["3gp","3gpp"]},"video/3gpp-tt":{source:"iana"},"video/3gpp2":{source:"iana",extensions:["3g2"]},"video/av1":{source:"iana"},"video/bmpeg":{source:"iana"},"video/bt656":{source:"iana"},"video/celb":{source:"iana"},"video/dv":{source:"iana"},"video/encaprtp":{source:"iana"},"video/ffv1":{source:"iana"},"video/flexfec":{source:"iana"},"video/h261":{source:"iana",extensions:["h261"]},"video/h263":{source:"iana",extensions:["h263"]},"video/h263-1998":{source:"iana"},"video/h263-2000":{source:"iana"},"video/h264":{source:"iana",extensions:["h264"]},"video/h264-rcdo":{source:"iana"},"video/h264-svc":{source:"iana"},"video/h265":{source:"iana"},"video/iso.segment":{source:"iana",extensions:["m4s"]},"video/jpeg":{source:"iana",extensions:["jpgv"]},"video/jpeg2000":{source:"iana"},"video/jpm":{source:"apache",extensions:["jpm","jpgm"]},"video/jxsv":{source:"iana"},"video/mj2":{source:"iana",extensions:["mj2","mjp2"]},"video/mp1s":{source:"iana"},"video/mp2p":{source:"iana"},"video/mp2t":{source:"iana",extensions:["ts"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","mp4v","mpg4"]},"video/mp4v-es":{source:"iana"},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{source:"iana"},"video/mpv":{source:"iana"},"video/nv":{source:"iana"},"video/ogg":{source:"iana",compressible:!1,extensions:["ogv"]},"video/parityfec":{source:"iana"},"video/pointer":{source:"iana"},"video/quicktime":{source:"iana",compressible:!1,extensions:["qt","mov"]},"video/raptorfec":{source:"iana"},"video/raw":{source:"iana"},"video/rtp-enc-aescm128":{source:"iana"},"video/rtploopback":{source:"iana"},"video/rtx":{source:"iana"},"video/scip":{source:"iana"},"video/smpte291":{source:"iana"},"video/smpte292m":{source:"iana"},"video/ulpfec":{source:"iana"},"video/vc1":{source:"iana"},"video/vc2":{source:"iana"},"video/vnd.cctv":{source:"iana"},"video/vnd.dece.hd":{source:"iana",extensions:["uvh","uvvh"]},"video/vnd.dece.mobile":{source:"iana",extensions:["uvm","uvvm"]},"video/vnd.dece.mp4":{source:"iana"},"video/vnd.dece.pd":{source:"iana",extensions:["uvp","uvvp"]},"video/vnd.dece.sd":{source:"iana",extensions:["uvs","uvvs"]},"video/vnd.dece.video":{source:"iana",extensions:["uvv","uvvv"]},"video/vnd.directv.mpeg":{source:"iana"},"video/vnd.directv.mpeg-tts":{source:"iana"},"video/vnd.dlna.mpeg-tts":{source:"iana"},"video/vnd.dvb.file":{source:"iana",extensions:["dvb"]},"video/vnd.fvt":{source:"iana",extensions:["fvt"]},"video/vnd.hns.video":{source:"iana"},"video/vnd.iptvforum.1dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.1dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.2dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.2dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.ttsavc":{source:"iana"},"video/vnd.iptvforum.ttsmpeg2":{source:"iana"},"video/vnd.motorola.video":{source:"iana"},"video/vnd.motorola.videop":{source:"iana"},"video/vnd.mpegurl":{source:"iana",extensions:["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{source:"iana",extensions:["pyv"]},"video/vnd.nokia.interleaved-multimedia":{source:"iana"},"video/vnd.nokia.mp4vr":{source:"iana"},"video/vnd.nokia.videovoip":{source:"iana"},"video/vnd.objectvideo":{source:"iana"},"video/vnd.radgamettools.bink":{source:"iana"},"video/vnd.radgamettools.smacker":{source:"iana"},"video/vnd.sealed.mpeg1":{source:"iana"},"video/vnd.sealed.mpeg4":{source:"iana"},"video/vnd.sealed.swf":{source:"iana"},"video/vnd.sealedmedia.softseal.mov":{source:"iana"},"video/vnd.uvvu.mp4":{source:"iana",extensions:["uvu","uvvu"]},"video/vnd.vivo":{source:"iana",extensions:["viv"]},"video/vnd.youtube.yt":{source:"iana"},"video/vp8":{source:"iana"},"video/vp9":{source:"iana"},"video/webm":{source:"apache",compressible:!1,extensions:["webm"]},"video/x-f4v":{source:"apache",extensions:["f4v"]},"video/x-fli":{source:"apache",extensions:["fli"]},"video/x-flv":{source:"apache",compressible:!1,extensions:["flv"]},"video/x-m4v":{source:"apache",extensions:["m4v"]},"video/x-matroska":{source:"apache",compressible:!1,extensions:["mkv","mk3d","mks"]},"video/x-mng":{source:"apache",extensions:["mng"]},"video/x-ms-asf":{source:"apache",extensions:["asf","asx"]},"video/x-ms-vob":{source:"apache",extensions:["vob"]},"video/x-ms-wm":{source:"apache",extensions:["wm"]},"video/x-ms-wmv":{source:"apache",compressible:!1,extensions:["wmv"]},"video/x-ms-wmx":{source:"apache",extensions:["wmx"]},"video/x-ms-wvx":{source:"apache",extensions:["wvx"]},"video/x-msvideo":{source:"apache",extensions:["avi"]},"video/x-sgi-movie":{source:"apache",extensions:["movie"]},"video/x-smv":{source:"apache",extensions:["smv"]},"x-conference/x-cooltalk":{source:"apache",extensions:["ice"]},"x-shader/x-fragment":{compressible:!0},"x-shader/x-vertex":{compressible:!0}}});var Ej=T(function(B_e){/*!
60
+ * mime-types
61
+ * Copyright(c) 2014 Jonathan Ong
62
+ * Copyright(c) 2015 Douglas Christopher Wilson
63
+ * MIT Licensed
64
+ */var J_=gj(),U_e=xe("path").extname,_j=/^\s*([^;\s]*)(?:;|\s|$)/,F_e=/^text\//i;B_e.charset=yj;B_e.charsets={lookup:yj};B_e.contentType=$_e;B_e.extension=z_e;B_e.extensions=Object.create(null);B_e.lookup=j_e;B_e.types=Object.create(null);H_e(B_e.extensions,B_e.types);function yj(e){if(!e||typeof e!=="string")return!1;var t=_j.exec(e),n=t&&J_[t[1].toLowerCase()];if(n&&n.charset)return n.charset;if(t&&F_e.test(t[1]))return"UTF-8";return!1}function $_e(e){if(!e||typeof e!=="string")return!1;var t=e.indexOf("/")===-1?B_e.lookup(e):e;if(!t)return!1;if(t.indexOf("charset")===-1){var n=B_e.charset(t);if(n)t+="; charset="+n.toLowerCase()}return t}function z_e(e){if(!e||typeof e!=="string")return!1;var t=_j.exec(e),n=t&&B_e.extensions[t[1].toLowerCase()];if(!n||!n.length)return!1;return n[0]}function j_e(e){if(!e||typeof e!=="string")return!1;var t=U_e("x."+e).toLowerCase().substr(1);if(!t)return!1;return B_e.types[t]||!1}function H_e(e,t){var n=["nginx","apache",void 0,"iana"];Object.keys(J_).forEach(function(o){var s=J_[o],i=s.extensions;if(!i||!i.length)return;e[o]=i;for(var a=0;a<i.length;a++){var c=i[a];if(t[c]){var l=n.indexOf(J_[t[c]].source),u=n.indexOf(s.source);if(t[c]!=="application/octet-stream"&&(l>u||l===u&&t[c].substr(0,12)==="application/"))continue}t[c]=o}})}});var vj=T(function(gwt,xj){xj.exports=V_e;function V_e(e){var t=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;if(t)t(e);else setTimeout(e,0)}});var cT=T(function(_wt,Aj){var wj=vj();Aj.exports=q_e;function q_e(e){var t=!1;return wj(function(){t=!0}),function(r,o){if(t)e(r,o);else wj(function(){e(r,o)})}}});var lT=T(function(ywt,Tj){Tj.exports=Z_e;function Z_e(e){Object.keys(e.jobs).forEach(Y_e.bind(e)),e.jobs={}}function Y_e(e){if(typeof this.jobs[e]=="function")this.jobs[e]()}});var uT=T(function(Swt,kj){var Cj=cT(),J_e=lT();kj.exports=X_e;function X_e(e,t,n,r){var o=n.keyedList?n.keyedList[n.index]:n.index;n.jobs[o]=Q_e(t,o,e[o],function(s,i){if(!(o in n.jobs))return;if(delete n.jobs[o],s)J_e(n);else n.results[o]=i;r(s,n.results)})}function Q_e(e,t,n,r){var o;if(e.length==2)o=e(n,Cj(r));else o=e(n,t,Cj(r));return o}});var dT=T(function(bwt,Rj){Rj.exports=eye;function eye(e,t){var n=!Array.isArray(e),r={index:0,keyedList:n||t?Object.keys(e):null,jobs:{},results:n?{}:[],size:n?Object.keys(e).length:e.length};if(t)r.keyedList.sort(n?t:function(o,s){return t(e[o],e[s])});return r}});var pT=T(function(Ewt,Oj){var tye=lT(),nye=cT();Oj.exports=rye;function rye(e){if(!Object.keys(this.jobs).length)return;this.index=this.size,tye(this),nye(e)(null,this.results)}});var Ij=T(function(xwt,Pj){var oye=uT(),sye=dT(),iye=pT();Pj.exports=aye;function aye(e,t,n){var r=sye(e);while(r.index<(r.keyedList||e).length)oye(e,t,r,function(o,s){if(o){n(o,s);return}if(Object.keys(r.jobs).length===0){n(null,r.results);return}}),r.index++;return iye.bind(r,n)}});var fT=T(function(vwt,X_){var Dj=uT(),cye=dT(),lye=pT();X_.exports=uye;X_.exports.ascending=Lj;X_.exports.descending=dye;function uye(e,t,n,r){var o=cye(e,n);return Dj(e,t,o,function s(i,a){if(i){r(i,a);return}if(o.index++,o.index<(o.keyedList||e).length){Dj(e,t,o,s);return}r(null,o.results)}),lye.bind(o,r)}function Lj(e,t){return e<t?-1:e>t?1:0}function dye(e,t){return-1*Lj(e,t)}});var Mj=T(function(wwt,Nj){var pye=fT();Nj.exports=fye;function fye(e,t,n){return pye(e,t,null,n)}});var Fj=T(function(Awt,Uj){Uj.exports={parallel:Ij(),serial:Mj(),serialOrdered:fT()}});var mT=T(function(Twt,$j){$j.exports=Object});var jj=T(function(Cwt,zj){zj.exports=Error});var Bj=T(function(kwt,Hj){Hj.exports=EvalError});var Gj=T(function(Rwt,Kj){Kj.exports=RangeError});var Vj=T(function(Owt,Wj){Wj.exports=ReferenceError});var Zj=T(function(Pwt,qj){qj.exports=SyntaxError});var Q_=T(function(Iwt,Yj){Yj.exports=TypeError});var Xj=T(function(Dwt,Jj){Jj.exports=URIError});var e1=T(function(Lwt,Qj){Qj.exports=Math.abs});var n1=T(function(Nwt,t1){t1.exports=Math.floor});var o1=T(function(Mwt,r1){r1.exports=Math.max});var i1=T(function(Uwt,s1){s1.exports=Math.min});var c1=T(function(Fwt,a1){a1.exports=Math.pow});var u1=T(function($wt,l1){l1.exports=Math.round});var p1=T(function(zwt,d1){d1.exports=Number.isNaN||function(t){return t!==t}});var m1=T(function(jwt,f1){var mye=p1();f1.exports=function(t){if(mye(t)||t===0)return t;return t<0?-1:1}});var g1=T(function(Hwt,h1){h1.exports=Object.getOwnPropertyDescriptor});var hT=T(function(Bwt,_1){var ey=g1();if(ey)try{ey([],"length")}catch(e){ey=null}_1.exports=ey});var S1=T(function(Kwt,y1){var ty=Object.defineProperty||!1;if(ty)try{ty({},"a",{value:1})}catch(e){ty=!1}y1.exports=ty});var gT=T(function(Gwt,b1){b1.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var t={},n=Symbol("test"),r=Object(n);if(typeof n==="string")return!1;if(Object.prototype.toString.call(n)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var o=42;t[n]=o;for(var s in t)return!1;if(typeof Object.keys==="function"&&Object.keys(t).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var i=Object.getOwnPropertySymbols(t);if(i.length!==1||i[0]!==n)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,n))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var a=Object.getOwnPropertyDescriptor(t,n);if(a.value!==o||a.enumerable!==!0)return!1}return!0}});var v1=T(function(Wwt,x1){var E1=typeof Symbol<"u"&&Symbol,hye=gT();x1.exports=function(){if(typeof E1!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof E1("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return hye()}});var _T=T(function(Vwt,w1){w1.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var yT=T(function(qwt,A1){var gye=mT();A1.exports=gye.getPrototypeOf||null});var k1=T(function(Zwt,C1){var _ye="Function.prototype.bind called on incompatible ",yye=Object.prototype.toString,Sye=Math.max,bye="[object Function]",T1=function(t,n){var r=[];for(var o=0;o<t.length;o+=1)r[o]=t[o];for(var s=0;s<n.length;s+=1)r[s+t.length]=n[s];return r},Eye=function(t,n){var r=[];for(var o=n||0,s=0;o<t.length;o+=1,s+=1)r[s]=t[o];return r},xye=function(e,t){var n="";for(var r=0;r<e.length;r+=1)if(n+=e[r],r+1<e.length)n+=t;return n};C1.exports=function(t){var n=this;if(typeof n!=="function"||yye.apply(n)!==bye)throw TypeError(_ye+n);var r=Eye(arguments,1),o,s=function(){if(this instanceof o){var u=n.apply(this,T1(r,arguments));if(Object(u)===u)return u;return this}return n.apply(t,T1(r,arguments))},i=Sye(0,n.length-r.length),a=[];for(var c=0;c<i;c++)a[c]="$"+c;if(o=Function("binder","return function ("+xye(a,",")+"){ return binder.apply(this,arguments); }")(s),n.prototype){var l=function(){};l.prototype=n.prototype,o.prototype=new l,l.prototype=null}return o}});var Fa=T(function(Ywt,R1){var vye=k1();R1.exports=Function.prototype.bind||vye});var ny=T(function(Jwt,O1){O1.exports=Function.prototype.call});var ST=T(function(Xwt,P1){P1.exports=Function.prototype.apply});var D1=T(function(Qwt,I1){I1.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var N1=T(function(eAt,L1){var wye=Fa(),Aye=ST(),Tye=ny(),Cye=D1();L1.exports=Cye||wye.call(Tye,Aye)});var U1=T(function(tAt,M1){var kye=Fa(),Rye=Q_(),Oye=ny(),Pye=N1();M1.exports=function(t){if(t.length<1||typeof t[0]!=="function")throw new Rye("a function is required");return Pye(kye,Oye,t)}});var B1=T(function(nAt,H1){var Iye=U1(),F1=hT(),z1;try{z1=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!=="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var bT=!!z1&&F1&&F1(Object.prototype,"__proto__"),j1=Object,$1=j1.getPrototypeOf;H1.exports=bT&&typeof bT.get==="function"?Iye([bT.get]):typeof $1==="function"?function(t){return $1(t==null?t:j1(t))}:!1});var q1=T(function(rAt,V1){var K1=_T(),G1=yT(),W1=B1();V1.exports=K1?function(t){return K1(t)}:G1?function(t){if(!t||typeof t!=="object"&&typeof t!=="function")throw TypeError("getProto: not an object");return G1(t)}:W1?function(t){return W1(t)}:null});var Y1=T(function(oAt,Z1){var Dye=Function.prototype.call,Lye=Object.prototype.hasOwnProperty,Nye=Fa();Z1.exports=Nye.call(Dye,Lye)});var nH=T(function(sAt,tH){var $e,Mye=mT(),Uye=jj(),Fye=Bj(),$ye=Gj(),zye=Vj(),lu=Zj(),cu=Q_(),jye=Xj(),Hye=e1(),Bye=n1(),Kye=o1(),Gye=i1(),Wye=c1(),Vye=u1(),qye=m1(),Q1=Function,ET=function(e){try{return Q1('"use strict"; return ('+e+").constructor;")()}catch(t){}},kf=hT(),Zye=S1(),xT=function(){throw new cu},Yye=kf?function(){try{return arguments.callee,xT}catch(e){try{return kf(arguments,"callee").get}catch(t){return xT}}}():xT,iu=v1()(),cn=q1(),Jye=yT(),Xye=_T(),eH=ST(),Rf=ny(),au={},Qye=typeof Uint8Array>"u"||!cn?$e:cn(Uint8Array),$a={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?$e:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?$e:ArrayBuffer,"%ArrayIteratorPrototype%":iu&&cn?cn([][Symbol.iterator]()):$e,"%AsyncFromSyncIteratorPrototype%":$e,"%AsyncFunction%":au,"%AsyncGenerator%":au,"%AsyncGeneratorFunction%":au,"%AsyncIteratorPrototype%":au,"%Atomics%":typeof Atomics>"u"?$e:Atomics,"%BigInt%":typeof BigInt>"u"?$e:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?$e:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?$e:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?$e:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Uye,"%eval%":eval,"%EvalError%":Fye,"%Float16Array%":typeof Float16Array>"u"?$e:Float16Array,"%Float32Array%":typeof Float32Array>"u"?$e:Float32Array,"%Float64Array%":typeof Float64Array>"u"?$e:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?$e:FinalizationRegistry,"%Function%":Q1,"%GeneratorFunction%":au,"%Int8Array%":typeof Int8Array>"u"?$e:Int8Array,"%Int16Array%":typeof Int16Array>"u"?$e:Int16Array,"%Int32Array%":typeof Int32Array>"u"?$e:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":iu&&cn?cn(cn([][Symbol.iterator]())):$e,"%JSON%":typeof JSON==="object"?JSON:$e,"%Map%":typeof Map>"u"?$e:Map,"%MapIteratorPrototype%":typeof Map>"u"||!iu||!cn?$e:cn(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Mye,"%Object.getOwnPropertyDescriptor%":kf,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?$e:Promise,"%Proxy%":typeof Proxy>"u"?$e:Proxy,"%RangeError%":$ye,"%ReferenceError%":zye,"%Reflect%":typeof Reflect>"u"?$e:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?$e:Set,"%SetIteratorPrototype%":typeof Set>"u"||!iu||!cn?$e:cn(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?$e:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":iu&&cn?cn(""[Symbol.iterator]()):$e,"%Symbol%":iu?Symbol:$e,"%SyntaxError%":lu,"%ThrowTypeError%":Yye,"%TypedArray%":Qye,"%TypeError%":cu,"%Uint8Array%":typeof Uint8Array>"u"?$e:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?$e:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?$e:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?$e:Uint32Array,"%URIError%":jye,"%WeakMap%":typeof WeakMap>"u"?$e:WeakMap,"%WeakRef%":typeof WeakRef>"u"?$e:WeakRef,"%WeakSet%":typeof WeakSet>"u"?$e:WeakSet,"%Function.prototype.call%":Rf,"%Function.prototype.apply%":eH,"%Object.defineProperty%":Zye,"%Object.getPrototypeOf%":Jye,"%Math.abs%":Hye,"%Math.floor%":Bye,"%Math.max%":Kye,"%Math.min%":Gye,"%Math.pow%":Wye,"%Math.round%":Vye,"%Math.sign%":qye,"%Reflect.getPrototypeOf%":Xye};if(cn)try{null.error}catch(e){vT=cn(cn(e)),$a["%Error.prototype%"]=vT}var vT,eSe=function e(t){var n;if(t==="%AsyncFunction%")n=ET("async function () {}");else if(t==="%GeneratorFunction%")n=ET("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=ET("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");if(r)n=r.prototype}else if(t==="%AsyncIteratorPrototype%"){var o=e("%AsyncGenerator%");if(o&&cn)n=cn(o.prototype)}return $a[t]=n,n},J1={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Of=Fa(),ry=Y1(),tSe=Of.call(Rf,Array.prototype.concat),nSe=Of.call(eH,Array.prototype.splice),X1=Of.call(Rf,String.prototype.replace),oy=Of.call(Rf,String.prototype.slice),rSe=Of.call(Rf,RegExp.prototype.exec),oSe=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,sSe=/\\(\\)?/g,iSe=function(t){var n=oy(t,0,1),r=oy(t,-1);if(n==="%"&&r!=="%")throw new lu("invalid intrinsic syntax, expected closing `%`");else if(r==="%"&&n!=="%")throw new lu("invalid intrinsic syntax, expected opening `%`");var o=[];return X1(t,oSe,function(s,i,a,c){o[o.length]=a?X1(c,sSe,"$1"):i||s}),o},aSe=function(t,n){var r=t,o;if(ry(J1,r))o=J1[r],r="%"+o[0]+"%";if(ry($a,r)){var s=$a[r];if(s===au)s=eSe(r);if(typeof s>"u"&&!n)throw new cu("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:o,name:r,value:s}}throw new lu("intrinsic "+t+" does not exist!")};tH.exports=function(t,n){if(typeof t!=="string"||t.length===0)throw new cu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!=="boolean")throw new cu('"allowMissing" argument must be a boolean');if(rSe(/^%?[^%]*%?$/,t)===null)throw new lu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=iSe(t),o=r.length>0?r[0]:"",s=aSe("%"+o+"%",n),{name:i,value:a}=s,c=!1,l=s.alias;if(l)o=l[0],nSe(r,tSe([0,1],l));for(var u=1,p=!0;u<r.length;u+=1){var f=r[u],m=oy(f,0,1),h=oy(f,-1);if((m==='"'||m==="'"||m==="`"||(h==='"'||h==="'"||h==="`"))&&m!==h)throw new lu("property names with quotes must have matching quotes");if(f==="constructor"||!p)c=!0;if(o+="."+f,i="%"+o+"%",ry($a,i))a=$a[i];else if(a!=null){if(!(f in a)){if(!n)throw new cu("base intrinsic for "+t+" exists, but the property is not available.");return}if(kf&&u+1>=r.length){var y=kf(a,f);if(p=!!y,p&&"get"in y&&!("originalValue"in y.get))a=y.get;else a=a[f]}else p=ry(a,f),a=a[f];if(p&&!c)$a[i]=a}}return a}});var oH=T(function(iAt,rH){var cSe=gT();rH.exports=function(){return cSe()&&!!Symbol.toStringTag}});var iH=T(function(aAt,sH){var lSe=Function.prototype.call,uSe=Object.prototype.hasOwnProperty,dSe=Fa();sH.exports=dSe.call(lSe,uSe)});var lH=T(function(cAt,cH){var pSe=nH(),aH=pSe("%Object.defineProperty%",!0),fSe=oH()(),mSe=iH(),hSe=Q_(),sy=fSe?Symbol.toStringTag:null;cH.exports=function(t,n){var r=arguments.length>2&&!!arguments[2]&&arguments[2].force,o=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof r<"u"&&typeof r!=="boolean"||typeof o<"u"&&typeof o!=="boolean")throw new hSe("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");if(sy&&(r||!mSe(t,sy)))if(aH)aH(t,sy,{configurable:!o,enumerable:!1,value:n,writable:!1});else t[sy]=n}});var dH=T(function(lAt,uH){var gSe=Function.prototype.call,_Se=Object.prototype.hasOwnProperty,ySe=Fa();uH.exports=ySe.call(gSe,_Se)});var fH=T(function(uAt,pH){pH.exports=function(e,t){return Object.keys(t).forEach(function(n){e[n]=e[n]||t[n]}),e}});var gH=T(function(dAt,hH){var CT=hj(),SSe=xe("util"),wT=xe("path"),bSe=xe("http"),ESe=xe("https"),xSe=xe("url").parse,vSe=xe("fs"),wSe=xe("stream").Stream,ASe=xe("crypto"),AT=Ej(),TSe=Fj(),CSe=lH(),Ti=dH(),TT=fH();function mH(e){return String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}function Ge(e){if(!(this instanceof Ge))return new Ge(e);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],CT.call(this),e=e||{};for(var t in e)this[t]=e[t]}SSe.inherits(Ge,CT);Ge.LINE_BREAK=`\r
65
+ `;Ge.DEFAULT_CONTENT_TYPE="application/octet-stream";Ge.prototype.append=function(e,t,n){if(n=n||{},typeof n==="string")n={filename:n};var r=CT.prototype.append.bind(this);if(typeof t==="number"||t==null)t=String(t);if(Array.isArray(t)){this._error(Error("Arrays are not supported."));return}var o=this._multiPartHeader(e,t,n),s=this._multiPartFooter();r(o),r(t),r(s),this._trackLength(o,t,n)};Ge.prototype._trackLength=function(e,t,n){var r=0;if(n.knownLength!=null)r+=Number(n.knownLength);else if(Buffer.isBuffer(t))r=t.length;else if(typeof t==="string")r=Buffer.byteLength(t);if(this._valueLength+=r,this._overheadLength+=Buffer.byteLength(e)+Ge.LINE_BREAK.length,!t||!t.path&&!(t.readable&&Ti(t,"httpVersion"))&&!(t instanceof wSe))return;if(!n.knownLength)this._valuesToMeasure.push(t)};Ge.prototype._lengthRetriever=function(e,t){if(Ti(e,"fd"))if(e.end!=null&&e.end!=1/0&&e.start!=null)t(null,e.end+1-(e.start?e.start:0));else vSe.stat(e.path,function(n,r){if(n){t(n);return}var o=r.size-(e.start?e.start:0);t(null,o)});else if(Ti(e,"httpVersion"))t(null,Number(e.headers["content-length"]));else if(Ti(e,"httpModule"))e.on("response",function(n){e.pause(),t(null,Number(n.headers["content-length"]))}),e.resume();else t("Unknown stream")};Ge.prototype._multiPartHeader=function(e,t,n){if(typeof n.header==="string")return n.header;var r=this._getContentDisposition(t,n),o=this._getContentType(t,n),s="",i={"Content-Disposition":["form-data",'name="'+mH(e)+'"'].concat(r||[]),"Content-Type":[].concat(o||[])};if(typeof n.header==="object")TT(i,n.header);var a;for(var c in i)if(Ti(i,c)){if(a=i[c],a==null)continue;if(!Array.isArray(a))a=[a];if(a.length)s+=c+": "+a.join("; ")+Ge.LINE_BREAK}return"--"+this.getBoundary()+Ge.LINE_BREAK+s+Ge.LINE_BREAK};Ge.prototype._getContentDisposition=function(e,t){var n;if(typeof t.filepath==="string")n=wT.normalize(t.filepath).replace(/\\/g,"/");else if(t.filename||e&&(e.name||e.path))n=wT.basename(t.filename||e&&(e.name||e.path));else if(e&&e.readable&&Ti(e,"httpVersion"))n=wT.basename(e.client._httpMessage.path||"");if(n)return'filename="'+mH(n)+'"'};Ge.prototype._getContentType=function(e,t){var n=t.contentType;if(!n&&e&&e.name)n=AT.lookup(e.name);if(!n&&e&&e.path)n=AT.lookup(e.path);if(!n&&e&&e.readable&&Ti(e,"httpVersion"))n=e.headers["content-type"];if(!n&&(t.filepath||t.filename))n=AT.lookup(t.filepath||t.filename);if(!n&&e&&typeof e==="object")n=Ge.DEFAULT_CONTENT_TYPE;return n};Ge.prototype._multiPartFooter=function(){return function(e){var t=Ge.LINE_BREAK,n=this._streams.length===0;if(n)t+=this._lastBoundary();e(t)}.bind(this)};Ge.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+Ge.LINE_BREAK};Ge.prototype.getHeaders=function(e){var t,n={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)if(Ti(e,t))n[t.toLowerCase()]=e[t];return n};Ge.prototype.setBoundary=function(e){if(typeof e!=="string")throw TypeError("FormData boundary must be a string");this._boundary=e};Ge.prototype.getBoundary=function(){if(!this._boundary)this._generateBoundary();return this._boundary};Ge.prototype.getBuffer=function(){var e=new Buffer.alloc(0),t=this.getBoundary();for(var n=0,r=this._streams.length;n<r;n++)if(typeof this._streams[n]!=="function"){if(Buffer.isBuffer(this._streams[n]))e=Buffer.concat([e,this._streams[n]]);else e=Buffer.concat([e,Buffer.from(this._streams[n])]);if(typeof this._streams[n]!=="string"||this._streams[n].substring(2,t.length+2)!==t)e=Buffer.concat([e,Buffer.from(Ge.LINE_BREAK)])}return Buffer.concat([e,Buffer.from(this._lastBoundary())])};Ge.prototype._generateBoundary=function(){this._boundary="--------------------------"+ASe.randomBytes(12).toString("hex")};Ge.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;if(this._streams.length)e+=this._lastBoundary().length;if(!this.hasKnownLength())this._error(Error("Cannot calculate proper length in synchronous way."));return e};Ge.prototype.hasKnownLength=function(){var e=!0;if(this._valuesToMeasure.length)e=!1;return e};Ge.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;if(this._streams.length)t+=this._lastBoundary().length;if(!this._valuesToMeasure.length){process.nextTick(e.bind(this,null,t));return}TSe.parallel(this._valuesToMeasure,this._lengthRetriever,function(n,r){if(n){e(n);return}r.forEach(function(o){t+=o}),e(null,t)})};Ge.prototype.submit=function(e,t){var n,r,o={method:"post"};if(typeof e==="string")e=xSe(e),r=TT({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},o);else if(r=TT(e,o),!r.port)r.port=r.protocol==="https:"?443:80;if(r.headers=this.getHeaders(e.headers),r.protocol==="https:")n=ESe.request(r);else n=bSe.request(r);return this.getLength(function(s,i){if(s&&s!=="Unknown stream"){this._error(s);return}if(i)n.setHeader("Content-Length",i);if(this.pipe(n),t){var a,c=function(l,u){return n.removeListener("error",c),n.removeListener("response",a),t.call(this,l,u)};a=c.bind(this,null),n.on("error",c),n.on("response",a)}}.bind(this)),n};Ge.prototype._error=function(e){if(!this.error)this.error=e,this.pause(),this.emit("error",e)};Ge.prototype.toString=function(){return"[object FormData]"};CSe(Ge.prototype,"FormData");hH.exports=Ge});var _H,iy;var kT=O(()=>{_H=Wn(gH(),1),iy=_H.default});function OT(e){return A.isPlainObject(e)||A.isArray(e)}function yH(e){return A.endsWith(e,"[]")?e.slice(0,-2):e}function RT(e,t,n){if(!e)return t;return e.concat(t).map(function(o,s){return o=yH(o),!n&&s?"["+o+"]":o}).join(n?".":"")}function kSe(e){return A.isArray(e)&&!e.some(OT)}function OSe(e,t,n){if(!A.isObject(e))throw TypeError("target must be an object");t=t||new(iy||FormData),n=A.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(_,E){return!A.isUndefined(E[_])});let r=n.metaTokens,o=n.visitor||p,{dots:s,indexes:i}=n,a=n.Blob||typeof Blob<"u"&&Blob,c=n.maxDepth===void 0?100:n.maxDepth,l=a&&A.isSpecCompliantForm(t);if(!A.isFunction(o))throw TypeError("visitor must be a function");function u(y){if(y===null)return"";if(A.isDate(y))return y.toISOString();if(A.isBoolean(y))return y.toString();if(!l&&A.isBlob(y))throw new G("Blob is not supported. Use a Buffer instead.");if(A.isArrayBuffer(y)||A.isTypedArray(y))return l&&typeof Blob==="function"?new Blob([y]):Buffer.from(y);return y}function p(y,_,E){let S=y;if(A.isReactNative(t)&&A.isReactNativeBlob(y))return t.append(RT(E,_,s),u(y)),!1;if(y&&!E&&typeof y==="object"){if(A.endsWith(_,"{}"))_=r?_:_.slice(0,-2),y=JSON.stringify(y);else if(A.isArray(y)&&kSe(y)||(A.isFileList(y)||A.endsWith(_,"[]"))&&(S=A.toArray(y)))return _=yH(_),S.forEach(function(v,w){!(A.isUndefined(v)||v===null)&&t.append(i===!0?RT([_],w,s):i===null?_:_+"[]",u(v))}),!1}if(OT(y))return!0;return t.append(RT(E,_,s),u(y)),!1}let f=[],m=Object.assign(RSe,{defaultVisitor:p,convertValue:u,isVisitable:OT});function h(y,_,E=0){if(A.isUndefined(y))return;if(E>c)throw new G("Object is too deeply nested ("+E+" levels). Max depth: "+c,G.ERR_FORM_DATA_DEPTH_EXCEEDED);if(f.indexOf(y)!==-1)throw Error("Circular reference detected in "+_.join("."));f.push(y),A.forEach(y,function(x,v){if((!(A.isUndefined(x)||x===null)&&o.call(t,x,A.isString(v)?v.trim():v,_,m))===!0)h(x,_?_.concat(v):[v],E+1)}),f.pop()}if(!A.isObject(e))throw TypeError("data must be an object");return h(e),t}var RSe,Ci;var Pf=O(()=>{pt();Cr();kT();RSe=A.toFlatObject(A,{},null,function(t){return/^is[A-Z]/.test(t)});Ci=OSe});function SH(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function bH(e,t){this._pairs=[],e&&Ci(e,this,t)}var EH,xH;var vH=O(()=>{Pf();EH=bH.prototype;EH.append=function(t,n){this._pairs.push([t,n])};EH.toString=function(t){let n=t?function(r){return t.call(this,r,SH)}:SH;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};xH=bH});function PSe(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function za(e,t,n){if(!t)return e;let r=n&&n.encode||PSe,o=A.isFunction(n)?{serialize:n}:n,s=o&&o.serialize,i;if(s)i=s(t,o);else i=A.isURLSearchParams(t)?t.toString():new xH(t,o).toString(r);if(i){let a=e.indexOf("#");if(a!==-1)e=e.slice(0,a);e+=(e.indexOf("?")===-1?"?":"&")+i}return e}var ay=O(()=>{pt();vH()});class wH{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){if(this.handlers[e])this.handlers[e]=null}clear(){if(this.handlers)this.handlers=[]}forEach(e){A.forEach(this.handlers,function(n){if(n!==null)e(n)})}}var PT;var AH=O(()=>{pt();PT=wH});var ki;var If=O(()=>{ki={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0}});import ISe from"url";var TH;var CH=O(()=>{TH=ISe.URLSearchParams});import DSe from"crypto";var IT="abcdefghijklmnopqrstuvwxyz",kH="0123456789",RH,LSe=(e=16,t=RH.ALPHA_DIGIT)=>{let n="",{length:r}=t,o=new Uint32Array(e);DSe.randomFillSync(o);for(let s=0;s<e;s++)n+=t[o[s]%r];return n},OH;var PH=O(()=>{CH();kT();RH={DIGIT:kH,ALPHA:IT,ALPHA_DIGIT:IT+IT.toUpperCase()+kH},OH={isNode:!0,classes:{URLSearchParams:TH,FormData:iy,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:RH,generateString:LSe,protocols:["http","https","file","data"]}});var NT={};on(NT,{hasBrowserEnv:()=>LT,hasStandardBrowserEnv:()=>NSe,hasStandardBrowserWebWorkerEnv:()=>MSe,navigator:()=>DT,origin:()=>USe});var LT,DT,NSe,MSe,USe;var IH=O(()=>{LT=typeof window<"u"&&typeof document<"u",DT=typeof navigator==="object"&&navigator||void 0,NSe=LT&&(!DT||["ReactNative","NativeScript","NS"].indexOf(DT.product)<0),MSe=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function")(),USe=LT&&window.location.href||"http://localhost"});var Ye;var Eo=O(()=>{PH();IH();Ye={...NT,...OH}});function MT(e,t){return Ci(e,new Ye.classes.URLSearchParams,{visitor:function(n,r,o,s){if(Ye.isNode&&A.isBuffer(n))return this.append(r,n.toString("base64")),!1;return s.defaultVisitor.apply(this,arguments)},...t})}var DH=O(()=>{pt();Pf();Eo()});function FSe(e){return A.matchAll(/\w+|\[(\w*)]/g,e).map((t)=>t[0]==="[]"?"":t[1]||t[0])}function $Se(e){let t={},n=Object.keys(e),r,o=n.length,s;for(r=0;r<o;r++)s=n[r],t[s]=e[s];return t}function zSe(e){function t(n,r,o,s){let i=n[s++];if(i==="__proto__")return!0;let a=Number.isFinite(+i),c=s>=n.length;if(i=!i&&A.isArray(o)?o.length:i,c){if(A.hasOwnProp(o,i))o[i]=A.isArray(o[i])?o[i].concat(r):[o[i],r];else o[i]=r;return!a}if(!o[i]||!A.isObject(o[i]))o[i]=[];if(t(n,r,o[i],s)&&A.isArray(o[i]))o[i]=$Se(o[i]);return!a}if(A.isFormData(e)&&A.isFunction(e.entries)){let n={};return A.forEachEntry(e,(r,o)=>{t(FSe(r),o,n,0)}),n}return null}var cy;var UT=O(()=>{pt();cy=zSe});function jSe(e,t,n){if(A.isString(e))try{return(t||JSON.parse)(e),A.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}var uu=(e,t)=>e!=null&&A.hasOwnProp(e,t)?e[t]:void 0,FT,du;var ly=O(()=>{pt();Cr();If();Pf();DH();Eo();UT();FT={transitional:ki,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){let r=n.getContentType()||"",o=r.indexOf("application/json")>-1,s=A.isObject(t);if(s&&A.isHTMLForm(t))t=new FormData(t);if(A.isFormData(t))return o?JSON.stringify(cy(t)):t;if(A.isArrayBuffer(t)||A.isBuffer(t)||A.isStream(t)||A.isFile(t)||A.isBlob(t)||A.isReadableStream(t))return t;if(A.isArrayBufferView(t))return t.buffer;if(A.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(s){let c=uu(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return MT(t,c).toString();if((a=A.isFileList(t))||r.indexOf("multipart/form-data")>-1){let l=uu(this,"env"),u=l&&l.FormData;return Ci(a?{"files[]":t}:t,u&&new u,c)}}if(s||o)return n.setContentType("application/json",!1),jSe(t);return t}],transformResponse:[function(t){let n=uu(this,"transitional")||FT.transitional,r=n&&n.forcedJSONParsing,o=uu(this,"responseType"),s=o==="json";if(A.isResponse(t)||A.isReadableStream(t))return t;if(t&&A.isString(t)&&(r&&!o||s)){let a=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,uu(this,"parseReviver"))}catch(c){if(a){if(c.name==="SyntaxError")throw G.from(c,G.ERR_BAD_RESPONSE,this,null,uu(this,"response"));throw c}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ye.classes.FormData,Blob:Ye.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};A.forEach(["delete","get","head","post","put","patch"],(e)=>{FT.headers[e]={}});du=FT});var HSe,LH=(e)=>{let t={},n,r,o;return e&&e.split(`
66
+ `).forEach(function(i){if(o=i.indexOf(":"),n=i.substring(0,o).trim().toLowerCase(),r=i.substring(o+1).trim(),!n||t[n]&&HSe[n])return;if(n==="set-cookie")if(t[n])t[n].push(r);else t[n]=[r];else t[n]=t[n]?t[n]+", "+r:r}),t};var NH=O(()=>{pt();HSe=A.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"])});function KSe(e){let t=0,n=e.length;while(t<n){let r=e.charCodeAt(t);if(r!==9&&r!==32)break;t+=1}while(n>t){let r=e.charCodeAt(n-1);if(r!==9&&r!==32)break;n-=1}return t===0&&n===e.length?e:e.slice(t,n)}function Df(e){return e&&String(e).trim().toLowerCase()}function GSe(e){return KSe(e.replace(BSe,""))}function uy(e){if(e===!1||e==null)return e;return A.isArray(e)?e.map(uy):GSe(String(e))}function WSe(e){let t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;while(r=n.exec(e))t[r[1]]=r[2];return t}function $T(e,t,n,r,o){if(A.isFunction(r))return r.call(this,t,n);if(o)t=n;if(!A.isString(t))return;if(A.isString(r))return t.indexOf(r)!==-1;if(A.isRegExp(r))return r.test(t)}function qSe(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function ZSe(e,t){let n=A.toCamelCase(" "+t);["get","set","has"].forEach((r)=>{Object.defineProperty(e,r+n,{value:function(o,s,i){return this[r].call(this,t,o,s,i)},configurable:!0})})}var MH,BSe,VSe=(e)=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()),Lf,Pt;var os=O(()=>{pt();NH();MH=Symbol("internals"),BSe=/[^\x09\x20-\x7E\x80-\xFF]/g;Lf=class Lf{constructor(e){e&&this.set(e)}set(e,t,n){let r=this;function o(i,a,c){let l=Df(a);if(!l)throw Error("header name must be a non-empty string");let u=A.findKey(r,l);if(!u||r[u]===void 0||c===!0||c===void 0&&r[u]!==!1)r[u||a]=uy(i)}let s=(i,a)=>A.forEach(i,(c,l)=>o(c,l,a));if(A.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(A.isString(e)&&(e=e.trim())&&!VSe(e))s(LH(e),t);else if(A.isObject(e)&&A.isIterable(e)){let i={},a,c;for(let l of e){if(!A.isArray(l))throw TypeError("Object iterator must return a key-value pair");i[c=l[0]]=(a=i[c])?A.isArray(a)?[...a,l[1]]:[a,l[1]]:l[1]}s(i,t)}else e!=null&&o(t,e,n);return this}get(e,t){if(e=Df(e),e){let n=A.findKey(this,e);if(n){let r=this[n];if(!t)return r;if(t===!0)return WSe(r);if(A.isFunction(t))return t.call(this,r,n);if(A.isRegExp(t))return t.exec(r);throw TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Df(e),e){let n=A.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||$T(this,this[n],n,t)))}return!1}delete(e,t){let n=this,r=!1;function o(s){if(s=Df(s),s){let i=A.findKey(n,s);if(i&&(!t||$T(n,n[i],i,t)))delete n[i],r=!0}}if(A.isArray(e))e.forEach(o);else o(e);return r}clear(e){let t=Object.keys(this),n=t.length,r=!1;while(n--){let o=t[n];if(!e||$T(this,this[o],o,e,!0))delete this[o],r=!0}return r}normalize(e){let t=this,n={};return A.forEach(this,(r,o)=>{let s=A.findKey(n,o);if(s){t[s]=uy(r),delete t[o];return}let i=e?qSe(o):String(o).trim();if(i!==o)delete t[o];t[i]=uy(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return A.forEach(this,(n,r)=>{n!=null&&n!==!1&&(t[r]=e&&A.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
67
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let n=new this(e);return t.forEach((r)=>n.set(r)),n}static accessor(e){let n=(this[MH]=this[MH]={accessors:{}}).accessors,r=this.prototype;function o(s){let i=Df(s);if(!n[i])ZSe(r,s),n[i]=!0}return A.isArray(e)?e.forEach(o):o(e),this}};Lf.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);A.reduceDescriptors(Lf.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});A.freezeMethods(Lf);Pt=Lf});function Nf(e,t){let n=this||du,r=t||n,o=Pt.from(r.headers),s=r.data;return A.forEach(e,function(a){s=a.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}var UH=O(()=>{pt();ly();os()});function Mf(e){return!!(e&&e.__CANCEL__)}var FH,kr;var ja=O(()=>{Cr();FH=class FH extends G{constructor(e,t,n){super(e==null?"canceled":e,G.ERR_CANCELED,t,n);this.name="CanceledError",this.__CANCEL__=!0}};kr=FH});function ss(e,t,n){let r=n.config.validateStatus;if(!n.status||!r||r(n.status))e(n);else t(new G("Request failed with status code "+n.status,[G.ERR_BAD_REQUEST,G.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}var dy=O(()=>{Cr()});function zT(e){if(typeof e!=="string")return!1;return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function jT(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Ha(e,t,n){let r=!zT(t);if(e&&(r||n===!1))return jT(e,t);return t}var py=()=>{};function JSe(e){try{return new URL(e)}catch{return null}}function $H(e){var t=(typeof e==="string"?JSe(e):e)||{},{protocol:n,host:r,port:o}=t;if(typeof r!=="string"||!r||typeof n!=="string")return"";if(n=n.split(":",1)[0],r=r.replace(/:\d*$/,""),o=parseInt(o)||YSe[n]||0,!XSe(r,o))return"";var s=HT(n+"_proxy")||HT("all_proxy");if(s&&s.indexOf("://")===-1)s=n+"://"+s;return s}function XSe(e,t){var n=HT("no_proxy").toLowerCase();if(!n)return!0;if(n==="*")return!1;return n.split(/[,\s]/).every(function(r){if(!r)return!0;var o=r.match(/^(.+):(\d+)$/),s=o?o[1]:r,i=o?parseInt(o[2]):0;if(i&&i!==t)return!0;if(!/^[.*]/.test(s))return e!==s;if(s.charAt(0)==="*")s=s.slice(1);return!e.endsWith(s)})}function HT(e){return process.env[e.toLowerCase()]||process.env[e.toUpperCase()]||""}var YSe;var zH=O(()=>{YSe={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443}});var HH=T(function(fTt,jH){var pu=1000,fu=pu*60,mu=fu*60,Ba=mu*24,QSe=Ba*7,ebe=Ba*365.25;jH.exports=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return tbe(e);else if(n==="number"&&isFinite(e))return t.long?rbe(e):nbe(e);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function tbe(e){if(e=String(e),e.length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*ebe;case"weeks":case"week":case"w":return n*QSe;case"days":case"day":case"d":return n*Ba;case"hours":case"hour":case"hrs":case"hr":case"h":return n*mu;case"minutes":case"minute":case"mins":case"min":case"m":return n*fu;case"seconds":case"second":case"secs":case"sec":case"s":return n*pu;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}function nbe(e){var t=Math.abs(e);if(t>=Ba)return Math.round(e/Ba)+"d";if(t>=mu)return Math.round(e/mu)+"h";if(t>=fu)return Math.round(e/fu)+"m";if(t>=pu)return Math.round(e/pu)+"s";return e+"ms"}function rbe(e){var t=Math.abs(e);if(t>=Ba)return fy(e,t,Ba,"day");if(t>=mu)return fy(e,t,mu,"hour");if(t>=fu)return fy(e,t,fu,"minute");if(t>=pu)return fy(e,t,pu,"second");return e+" ms"}function fy(e,t,n,r){var o=t>=n*1.5;return Math.round(e/n)+" "+r+(o?"s":"")}});var BT=T(function(mTt,BH){function obe(e){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=HH(),n.destroy=l,Object.keys(e).forEach((u)=>{n[u]=e[u]}),n.names=[],n.skips=[],n.formatters={};function t(u){let p=0;for(let f=0;f<u.length;f++)p=(p<<5)-p+u.charCodeAt(f),p|=0;return n.colors[Math.abs(p)%n.colors.length]}n.selectColor=t;function n(u){let p,f=null,m,h;function y(..._){if(!y.enabled)return;let E=y,S=Number(new Date),x=S-(p||S);if(E.diff=x,E.prev=p,E.curr=S,p=S,_[0]=n.coerce(_[0]),typeof _[0]!=="string")_.unshift("%O");let v=0;_[0]=_[0].replace(/%([a-zA-Z%])/g,(U,L)=>{if(U==="%%")return"%";v++;let F=n.formatters[L];if(typeof F==="function"){let K=_[v];U=F.call(E,K),_.splice(v,1),v--}return U}),n.formatArgs.call(E,_),(E.log||n.log).apply(E,_)}if(y.namespace=u,y.useColors=n.useColors(),y.color=n.selectColor(u),y.extend=r,y.destroy=n.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(f!==null)return f;if(m!==n.namespaces)m=n.namespaces,h=n.enabled(u);return h},set:(_)=>{f=_}}),typeof n.init==="function")n.init(y);return y}function r(u,p){let f=n(this.namespace+(typeof p>"u"?":":p)+u);return f.log=this.log,f}function o(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let p=(typeof u==="string"?u:"").trim().replace(" ",",").split(",").filter(Boolean);for(let f of p)if(f[0]==="-")n.skips.push(f.slice(1));else n.names.push(f)}function s(u,p){let f=0,m=0,h=-1,y=0;while(f<u.length)if(m<p.length&&(p[m]===u[f]||p[m]==="*"))if(p[m]==="*")h=m,y=f,m++;else f++,m++;else if(h!==-1)m=h+1,y++,f=y;else return!1;while(m<p.length&&p[m]==="*")m++;return m===p.length}function i(){let u=[...n.names,...n.skips.map((p)=>"-"+p)].join(",");return n.enable(""),u}function a(u){for(let p of n.skips)if(s(u,p))return!1;for(let p of n.names)if(s(u,p))return!0;return!1}function c(u){if(u instanceof Error)return u.stack||u.message;return u}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}BH.exports=obe});var GH=T(function(KH,hy){KH.formatArgs=ibe;KH.save=abe;KH.load=cbe;KH.useColors=sbe;KH.storage=lbe();KH.destroy=(()=>{let e=!1;return()=>{if(!e)e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();KH.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function sbe(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function ibe(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+hy.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let n=0,r=0;e[0].replace(/%[a-zA-Z%]/g,(o)=>{if(o==="%%")return;if(n++,o==="%c")r=n}),e.splice(r,0,t)}KH.log=console.debug||console.log||(()=>{});function abe(e){try{if(e)KH.storage.setItem("debug",e);else KH.storage.removeItem("debug")}catch(t){}}function cbe(){let e;try{e=KH.storage.getItem("debug")}catch(t){}if(!e&&typeof process<"u"&&"env"in process)e=process.env.DEBUG;return e}function lbe(){try{return localStorage}catch(e){}}hy.exports=BT()(KH);var{formatters:ube}=hy.exports;ube.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var VH=T(function(gTt,WH){WH.exports=(e,t=process.argv)=>{let n=e.startsWith("-")?"":e.length===1?"-":"--",r=t.indexOf(n+e),o=t.indexOf("--");return r!==-1&&(o===-1||r<o)}});var YH=T(function(_Tt,ZH){var ybe=xe("os"),qH=xe("tty"),Kr=VH(),{env:ln}=process,gy;if(Kr("no-color")||Kr("no-colors")||Kr("color=false")||Kr("color=never"))gy=0;else if(Kr("color")||Kr("colors")||Kr("color=true")||Kr("color=always"))gy=1;function Sbe(){if("FORCE_COLOR"in ln){if(ln.FORCE_COLOR==="true")return 1;if(ln.FORCE_COLOR==="false")return 0;return ln.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(ln.FORCE_COLOR,10),3)}}function bbe(e){if(e===0)return!1;return{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Ebe(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let r=Sbe();if(r!==void 0)gy=r;let o=n?gy:r;if(o===0)return 0;if(n){if(Kr("color=16m")||Kr("color=full")||Kr("color=truecolor"))return 3;if(Kr("color=256"))return 2}if(e&&!t&&o===void 0)return 0;let s=o||0;if(ln.TERM==="dumb")return s;if(process.platform==="win32"){let i=ybe.release().split(".");if(Number(i[0])>=10&&Number(i[2])>=10586)return Number(i[2])>=14931?3:2;return 1}if("CI"in ln){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some((i)=>(i in ln))||ln.CI_NAME==="codeship")return 1;return s}if("TEAMCITY_VERSION"in ln)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ln.TEAMCITY_VERSION)?1:0;if(ln.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in ln){let i=Number.parseInt((ln.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ln.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(ln.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ln.TERM))return 1;if("COLORTERM"in ln)return 1;return s}function KT(e,t={}){let n=Ebe(e,{streamIsTTY:e&&e.isTTY,...t});return bbe(n)}ZH.exports={supportsColor:KT,stdout:KT({isTTY:qH.isatty(1)}),stderr:KT({isTTY:qH.isatty(2)})}});var eB=T(function(XH,yy){var xbe=xe("tty"),_y=xe("util");XH.init=Rbe;XH.log=Tbe;XH.formatArgs=wbe;XH.save=Cbe;XH.load=kbe;XH.useColors=vbe;XH.destroy=_y.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");XH.colors=[6,2,3,4,5,1];try{let e=YH();if(e&&(e.stderr||e).level>=2)XH.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(e){}XH.inspectOpts=Object.keys(process.env).filter((e)=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(o,s)=>s.toUpperCase()),r=process.env[t];if(/^(yes|on|true|enabled)$/i.test(r))r=!0;else if(/^(no|off|false|disabled)$/i.test(r))r=!1;else if(r==="null")r=null;else r=Number(r);return e[n]=r,e},{});function vbe(){return"colors"in XH.inspectOpts?Boolean(XH.inspectOpts.colors):xbe.isatty(process.stderr.fd)}function wbe(e){let{namespace:t,useColors:n}=this;if(n){let r=this.color,o="\x1B[3"+(r<8?r:"8;5;"+r),s=` ${o};1m${t} \x1B[0m`;e[0]=s+e[0].split(`
68
+ `).join(`
69
+ `+s),e.push(o+"m+"+yy.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Abe()+t+" "+e[0]}function Abe(){if(XH.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function Tbe(...e){return process.stderr.write(_y.formatWithOptions(XH.inspectOpts,...e)+`
70
+ `)}function Cbe(e){if(e)process.env.DEBUG=e;else delete process.env.DEBUG}function kbe(){return process.env.DEBUG}function Rbe(e){e.inspectOpts={};let t=Object.keys(XH.inspectOpts);for(let n=0;n<t.length;n++)e.inspectOpts[t[n]]=XH.inspectOpts[t[n]]}yy.exports=BT()(XH);var{formatters:JH}=yy.exports;JH.o=function(e){return this.inspectOpts.colors=this.useColors,_y.inspect(e,this.inspectOpts).split(`
71
+ `).map((t)=>t.trim()).join(" ")};JH.O=function(e){return this.inspectOpts.colors=this.useColors,_y.inspect(e,this.inspectOpts)}});var tB=T(function(STt,GT){if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)GT.exports=GH();else GT.exports=eB()});var rB=T(function(bTt,nB){var Uf;nB.exports=function(){if(!Uf){try{Uf=tB()("follow-redirects")}catch(e){}if(typeof Uf!=="function")Uf=function(){}}Uf.apply(null,arguments)}});var cB=T(function(ETt,rC){var $f=xe("url"),Ff=$f.URL,Ube=xe("http"),Fbe=xe("https"),YT=xe("stream").Writable,JT=xe("assert"),oB=rB();(function(){var t=typeof process<"u",n=typeof window<"u"&&typeof document<"u",r=Wa(Error.captureStackTrace);if(!t&&(n||!r))console.warn("The follow-redirects package should be excluded from browser builds.")})();var XT=!1;try{JT(new Ff(""))}catch(e){XT=e.code==="ERR_INVALID_URL"}var $be=["Authorization","Proxy-Authorization","Cookie"],zbe=["auth","host","hostname","href","path","pathname","port","protocol","query","search","hash"],QT=["abort","aborted","connect","error","socket","timeout"],eC=Object.create(null);QT.forEach(function(e){eC[e]=function(t,n,r){this._redirectable.emit(e,t,n,r)}});var VT=zf("ERR_INVALID_URL","Invalid URL",TypeError),qT=zf("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),jbe=zf("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",qT),Hbe=zf("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),Bbe=zf("ERR_STREAM_WRITE_AFTER_END","write after end"),Kbe=YT.prototype.destroy||iB;function nr(e,t){if(YT.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t)this.on("response",t);var n=this;this._onNativeResponse=function(r){try{n._processResponse(r)}catch(o){n.emit("error",o instanceof qT?o:new qT({cause:o}))}},this._headerFilter=new RegExp("^(?:"+$be.concat(e.sensitiveHeaders).map(Ybe).join("|")+")$","i"),this._performRequest()}nr.prototype=Object.create(YT.prototype);nr.prototype.abort=function(){nC(this._currentRequest),this._currentRequest.abort(),this.emit("abort")};nr.prototype.destroy=function(e){return nC(this._currentRequest,e),Kbe.call(this,e),this};nr.prototype.write=function(e,t,n){if(this._ending)throw new Bbe;if(!Ga(e)&&!qbe(e))throw TypeError("data should be a string, Buffer or Uint8Array");if(Wa(t))n=t,t=null;if(e.length===0){if(n)n();return}if(this._requestBodyLength+e.length<=this._options.maxBodyLength)this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,n);else this.emit("error",new Hbe),this.abort()};nr.prototype.end=function(e,t,n){if(Wa(e))n=e,e=t=null;else if(Wa(t))n=t,t=null;if(!e)this._ended=this._ending=!0,this._currentRequest.end(null,null,n);else{var r=this,o=this._currentRequest;this.write(e,t,function(){r._ended=!0,o.end(null,null,n)}),this._ending=!0}};nr.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)};nr.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)};nr.prototype.setTimeout=function(e,t){var n=this;function r(i){i.setTimeout(e),i.removeListener("timeout",i.destroy),i.addListener("timeout",i.destroy)}function o(i){if(n._timeout)clearTimeout(n._timeout);n._timeout=setTimeout(function(){n.emit("timeout"),s()},e),r(i)}function s(){if(n._timeout)clearTimeout(n._timeout),n._timeout=null;if(n.removeListener("abort",s),n.removeListener("error",s),n.removeListener("response",s),n.removeListener("close",s),t)n.removeListener("timeout",t);if(!n.socket)n._currentRequest.removeListener("socket",o)}if(t)this.on("timeout",t);if(this.socket)o(this.socket);else this._currentRequest.once("socket",o);return this.on("socket",r),this.on("abort",s),this.on("error",s),this.on("response",s),this.on("close",s),this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(e){nr.prototype[e]=function(t,n){return this._currentRequest[e](t,n)}});["aborted","connection","socket"].forEach(function(e){Object.defineProperty(nr.prototype,e,{get:function(){return this._currentRequest[e]}})});nr.prototype._sanitizeOptions=function(e){if(!e.headers)e.headers={};if(!Vbe(e.sensitiveHeaders))e.sensitiveHeaders=[];if(e.host){if(!e.hostname)e.hostname=e.host;delete e.host}if(!e.pathname&&e.path){var t=e.path.indexOf("?");if(t<0)e.pathname=e.path;else e.pathname=e.path.substring(0,t),e.search=e.path.substring(t)}};nr.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(!t)throw TypeError("Unsupported protocol "+e);if(this._options.agents){var n=e.slice(0,-1);this._options.agent=this._options.agents[n]}var r=this._currentRequest=t.request(this._options,this._onNativeResponse);r._redirectable=this;for(var o of QT)r.on(o,eC[o]);if(this._currentUrl=/^\//.test(this._options.path)?$f.format(this._options):this._options.path,this._isRedirect){var s=0,i=this,a=this._requestBodyBuffers;(function c(l){if(r===i._currentRequest){if(l)i.emit("error",l);else if(s<a.length){var u=a[s++];if(!r.finished)r.write(u.data,u.encoding,c)}else if(i._ended)r.end()}})()}};nr.prototype._processResponse=function(e){var t=e.statusCode;if(this._options.trackRedirects)this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var n=e.headers.location;if(!n||this._options.followRedirects===!1||t<300||t>=400){e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),this._requestBodyBuffers=[];return}if(nC(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)throw new jbe;var r,o=this._options.beforeRedirect;if(o)r=Object.assign({Host:e.req.getHeader("host")},this._options.headers);var s=this._options.method;if((t===301||t===302)&&this._options.method==="POST"||t===303&&!/^(?:GET|HEAD)$/.test(this._options.method))this._options.method="GET",this._requestBodyBuffers=[],WT(/^content-/i,this._options.headers);var i=WT(/^host$/i,this._options.headers),a=tC(this._currentUrl),c=i||a.host,l=/^\w+:/.test(n)?this._currentUrl:$f.format(Object.assign(a,{host:c})),u=Gbe(n,l);if(oB("redirecting to",u.href),this._isRedirect=!0,ZT(u,this._options),u.protocol!==a.protocol&&u.protocol!=="https:"||u.host!==c&&!Wbe(u.host,c))WT(this._headerFilter,this._options.headers);if(Wa(o)){var p={headers:e.headers,statusCode:t},f={url:l,method:s,headers:r};o(this._options,p,f),this._sanitizeOptions(this._options)}this._performRequest()};function sB(e){var t={maxRedirects:21,maxBodyLength:10485760},n={};return Object.keys(e).forEach(function(r){var o=r+":",s=n[o]=e[r],i=t[r]=Object.create(s);function a(l,u,p){if(Zbe(l))l=ZT(l);else if(Ga(l))l=ZT(tC(l));else p=u,u=aB(l),l={protocol:o};if(Wa(u))p=u,u=null;if(u=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},l,u),u.nativeProtocols=n,!Ga(u.host)&&!Ga(u.hostname))u.hostname="::1";return JT.equal(u.protocol,o,"protocol mismatch"),oB("options",u),new nr(u,p)}function c(l,u,p){var f=i.request(l,u,p);return f.end(),f}Object.defineProperties(i,{request:{value:a,configurable:!0,enumerable:!0,writable:!0},get:{value:c,configurable:!0,enumerable:!0,writable:!0}})}),t}function iB(){}function tC(e){var t;if(XT)t=new Ff(e);else if(t=aB($f.parse(e)),!Ga(t.protocol))throw new VT({input:e});return t}function Gbe(e,t){return XT?new Ff(e,t):tC($f.resolve(t,e))}function aB(e){if(/^\[/.test(e.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(e.hostname))throw new VT({input:e.href||e});if(/^\[/.test(e.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(e.host))throw new VT({input:e.href||e});return e}function ZT(e,t){var n=t||{};for(var r of zbe)n[r]=e[r];if(n.hostname.startsWith("["))n.hostname=n.hostname.slice(1,-1);if(n.port!=="")n.port=Number(n.port);return n.path=n.search?n.pathname+n.search:n.pathname,n}function WT(e,t){var n;for(var r in t)if(e.test(r))n=t[r],delete t[r];return n===null||typeof n>"u"?void 0:String(n).trim()}function zf(e,t,n){function r(o){if(Wa(Error.captureStackTrace))Error.captureStackTrace(this,this.constructor);Object.assign(this,o||{}),this.code=e,this.message=this.cause?t+": "+this.cause.message:t}return r.prototype=Object.create((n||Error).prototype),Object.defineProperties(r.prototype,{constructor:{value:r,enumerable:!1},name:{value:"Error ["+e+"]",enumerable:!1}}),r}function nC(e,t){for(var n of QT)e.removeListener(n,eC[n]);e.on("error",iB),e.destroy(t)}function Wbe(e,t){JT(Ga(e)&&Ga(t));var n=e.length-t.length-1;return n>0&&e[n]==="."&&e.endsWith(t)}function Vbe(e){return e instanceof Array}function Ga(e){return typeof e==="string"||e instanceof String}function Wa(e){return typeof e==="function"}function qbe(e){return typeof e==="object"&&"length"in e}function Zbe(e){return Ff&&e instanceof Ff}function Ybe(e){return e.replace(/[\]\\/()*+?.$]/g,"\\$&")}rC.exports=sB({http:Ube,https:Fbe});rC.exports.wrap=sB});var Va="1.15.2";function jf(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function oC(e,t,n){let r=n&&n.Blob||Ye.classes.Blob,o=jf(e);if(t===void 0&&r)t=!0;if(o==="data"){e=o.length?e.slice(o.length+1):e;let s=Jbe.exec(e);if(!s)throw new G("Invalid URL",G.ERR_INVALID_URL);let i=s[1],a=s[2],c=s[3],l=Buffer.from(decodeURIComponent(c),a?"base64":"utf8");if(t){if(!r)throw new G("Blob is not supported",G.ERR_NOT_SUPPORT);return new r([l],{type:i})}return l}throw new G("Unsupported protocol "+o,G.ERR_NOT_SUPPORT)}var Jbe;var lB=O(()=>{Cr();Eo();Jbe=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/});import Xbe from"stream";var sC,uB,iC;var dB=O(()=>{pt();sC=Symbol("internals");uB=class uB extends Xbe.Transform{constructor(e){e=A.toFlatObject(e,{maxRate:0,chunkSize:65536,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(n,r)=>!A.isUndefined(r[n]));super({readableHighWaterMark:e.chunkSize});let t=this[sC]={timeWindow:e.timeWindow,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",(n)=>{if(n==="progress"){if(!t.isCaptured)t.isCaptured=!0}})}_read(e){let t=this[sC];if(t.onReadCallback)t.onReadCallback();return super._read(e)}_transform(e,t,n){let r=this[sC],o=r.maxRate,s=this.readableHighWaterMark,i=r.timeWindow,a=1000/i,c=o/a,l=r.minChunkSize!==!1?Math.max(r.minChunkSize,c*0.01):0,u=(f,m)=>{let h=Buffer.byteLength(f);if(r.bytesSeen+=h,r.bytes+=h,r.isCaptured&&this.emit("progress",r.bytesSeen),this.push(f))process.nextTick(m);else r.onReadCallback=()=>{r.onReadCallback=null,process.nextTick(m)}},p=(f,m)=>{let h=Buffer.byteLength(f),y=null,_=s,E,S=0;if(o){let x=Date.now();if(!r.ts||(S=x-r.ts)>=i)r.ts=x,E=c-r.bytes,r.bytes=E<0?-E:0,S=0;E=c-r.bytes}if(o){if(E<=0)return setTimeout(()=>{m(null,f)},i-S);if(E<_)_=E}if(_&&h>_&&h-_>l)y=f.subarray(_),f=f.subarray(0,_);u(f,y?()=>{process.nextTick(m,null,y)}:m)};p(e,function f(m,h){if(m)return n(m);if(h)p(h,f);else n(null)})}};iC=uB});var pB,Qbe=async function*(e){if(e.stream)yield*e.stream();else if(e.arrayBuffer)yield await e.arrayBuffer();else if(e[pB])yield*e[pB]();else yield e},Sy;var aC=O(()=>{({asyncIterator:pB}=Symbol),Sy=Qbe});import eEe from"util";import{Readable as tEe}from"stream";class fB{constructor(e,t){let{escapeName:n}=this.constructor,r=A.isString(t),o=`Content-Disposition: form-data; name="${n(e)}"${!r&&t.name?`; filename="${n(t.name)}"`:""}${qa}`;if(r)t=Hf.encode(String(t).replace(/\r?\n|\r\n?/g,qa));else{let s=String(t.type||"application/octet-stream").replace(/[\r\n]/g,"");o+=`Content-Type: ${s}${qa}`}this.headers=Hf.encode(o+qa),this.contentLength=r?t.byteLength:t.size,this.size=this.headers.byteLength+this.contentLength+oEe,this.name=e,this.value=t}async*encode(){yield this.headers;let{value:e}=this;if(A.isTypedArray(e))yield e;else yield*Sy(e);yield rEe}static escapeName(e){return String(e).replace(/[\r\n"]/g,(t)=>({"\r":"%0D","\n":"%0A",'"':"%22"})[t])}}var nEe,Hf,qa=`\r
72
+ `,rEe,oEe=2,sEe=(e,t,n)=>{let{tag:r="form-data-boundary",size:o=25,boundary:s=r+"-"+Ye.generateString(o,nEe)}=n||{};if(!A.isFormData(e))throw TypeError("FormData instance required");if(s.length<1||s.length>70)throw Error("boundary must be 10-70 characters long");let i=Hf.encode("--"+s+qa),a=Hf.encode("--"+s+"--"+qa),c=a.byteLength,l=Array.from(e.entries()).map(([p,f])=>{let m=new fB(p,f);return c+=m.size,m});c+=i.byteLength*l.length,c=A.toFiniteNumber(c);let u={"Content-Type":`multipart/form-data; boundary=${s}`};if(Number.isFinite(c))u["Content-Length"]=c;return t&&t(u),tEe.from(async function*(){for(let p of l)yield i,yield*p.encode();yield a}())},mB;var hB=O(()=>{pt();aC();Eo();nEe=Ye.ALPHABET.ALPHA_DIGIT+"-_",Hf=typeof TextEncoder==="function"?new TextEncoder:new eEe.TextEncoder,rEe=Hf.encode(qa);mB=sEe});import iEe from"stream";var gB,_B;var yB=O(()=>{gB=class gB extends iEe.Transform{__transform(e,t,n){this.push(e),n()}_transform(e,t,n){if(e.length!==0){if(this._transform=this.__transform,e[0]!==120){let r=Buffer.alloc(2);r[0]=120,r[1]=156,this.push(r,t)}}this.__transform(e,t,n)}};_B=gB});var aEe=(e,t)=>A.isAsyncFn(e)?function(...n){let r=n.pop();e.apply(this,n).then((o)=>{try{t?r(null,...t(o)):r(null,o)}catch(s){r(s)}},r)}:e,SB;var bB=O(()=>{pt();SB=aEe});function cC(e){let t;try{t=new URL(e)}catch(s){return!1}let n=(process.env.no_proxy||process.env.NO_PROXY||"").toLowerCase();if(!n)return!1;if(n==="*")return!0;let r=Number.parseInt(t.port,10)||uEe[t.protocol.split(":",1)[0]]||0,o=xB(t.hostname.toLowerCase());return n.split(/[\s,]+/).some((s)=>{if(!s)return!1;let[i,a]=dEe(s);if(i=xB(i),!i)return!1;if(a&&a!==r)return!1;if(i.charAt(0)==="*")i=i.slice(1);if(i.charAt(0)===".")return o.endsWith(i);return o===i||EB(o)&&EB(i)})}var cEe,vB=(e)=>{let t=e.split(".");if(t.length!==4)return!1;if(t[0]!=="127")return!1;return t.every((n)=>/^\d+$/.test(n)&&Number(n)>=0&&Number(n)<=255)},lEe=(e)=>{if(e==="::1")return!0;let t=e.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/i);if(t)return vB(t[1]);let n=e.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i);if(n){let o=parseInt(n[1],16);return o>=32512&&o<=32767}let r=e.split(":");if(r.length===8){for(let o=0;o<7;o++)if(!/^0+$/.test(r[o]))return!1;return/^0*1$/.test(r[7])}return!1},EB=(e)=>{if(!e)return!1;if(cEe.has(e))return!0;if(vB(e))return!0;return lEe(e)},uEe,dEe=(e)=>{let t=e,n=0;if(t.charAt(0)==="["){let s=t.indexOf("]");if(s!==-1){let i=t.slice(1,s),a=t.slice(s+1);if(a.charAt(0)===":"&&/^\d+$/.test(a.slice(1)))n=Number.parseInt(a.slice(1),10);return[i,n]}}let r=t.indexOf(":"),o=t.lastIndexOf(":");if(r!==-1&&r===o&&/^\d+$/.test(t.slice(o+1)))n=Number.parseInt(t.slice(o+1),10),t=t.slice(0,o);return[t,n]},xB=(e)=>{if(!e)return e;if(e.charAt(0)==="["&&e.charAt(e.length-1)==="]")e=e.slice(1,-1);return e.replace(/\.+$/,"")};var wB=O(()=>{cEe=new Set(["localhost"]),uEe={http:80,https:443,ws:80,wss:443,ftp:21}});function pEe(e,t){e=e||10;let n=Array(e),r=Array(e),o=0,s=0,i;return t=t!==void 0?t:1000,function(c){let l=Date.now(),u=r[s];if(!i)i=l;n[o]=c,r[o]=l;let p=s,f=0;while(p!==o)f+=n[p++],p=p%e;if(o=(o+1)%e,o===s)s=(s+1)%e;if(l-i<t)return;let m=u&&l-u;return m?Math.round(f*1000/m):void 0}}var AB;var TB=O(()=>{AB=pEe});function fEe(e,t){let n=0,r=1000/t,o,s,i=(l,u=Date.now())=>{if(n=u,o=null,s)clearTimeout(s),s=null;e(...l)};return[(...l)=>{let u=Date.now(),p=u-n;if(p>=r)i(l,u);else if(o=l,!s)s=setTimeout(()=>{s=null,i(o)},r-p)},()=>o&&i(o)]}var CB;var kB=O(()=>{CB=fEe});var Ts=(e,t,n=3)=>{let r=0,o=AB(50,250);return CB((s)=>{let i=s.loaded,a=s.lengthComputable?s.total:void 0,c=a!=null?Math.min(i,a):i,l=Math.max(0,c-r),u=o(l);r=Math.max(r,c);let p={loaded:c,total:a,progress:a?c/a:void 0,bytes:l,rate:u?u:void 0,estimated:u&&a?(a-c)/u:void 0,event:s,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(p)},n)},hu=(e,t)=>{let n=e!=null;return[(r)=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},gu=(e)=>(...t)=>A.asap(()=>e(...t));var by=O(()=>{TB();kB();pt()});function lC(e){if(!e||typeof e!=="string")return 0;if(!e.startsWith("data:"))return 0;let t=e.indexOf(",");if(t<0)return 0;let n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let{length:s,length:i}=r;for(let f=0;f<i;f++)if(r.charCodeAt(f)===37&&f+2<i){let m=r.charCodeAt(f+1),h=r.charCodeAt(f+2);if((m>=48&&m<=57||m>=65&&m<=70||m>=97&&m<=102)&&(h>=48&&h<=57||h>=65&&h<=70||h>=97&&h<=102))s-=2,f+=2}let a=0,c=i-1,l=(f)=>f>=2&&r.charCodeAt(f-2)===37&&r.charCodeAt(f-1)===51&&(r.charCodeAt(f)===68||r.charCodeAt(f)===100);if(c>=0){if(r.charCodeAt(c)===61)a++,c--;else if(l(c))a++,c-=3}if(a===1&&c>=0){if(r.charCodeAt(c)===61)a++;else if(l(c))a++}let p=Math.floor(s/4)*3-(a||0);return p>0?p:0}return Buffer.byteLength(r,"utf8")}import mEe from"http";import hEe from"https";import MB from"http2";import UB from"util";import{resolve as RB}from"path";import Ri from"zlib";import xo from"stream";import{EventEmitter as gEe}from"events";class $B{constructor(){this.sessions=Object.create(null)}getSession(e,t){t=Object.assign({sessionTimeout:1000},t);let n=this.sessions[e];if(n){let l=n.length;for(let u=0;u<l;u++){let[p,f]=n[u];if(!p.destroyed&&!p.closed&&UB.isDeepStrictEqual(f,t))return p}}let r=MB.connect(e,t),o,s=()=>{if(o)return;o=!0;let l=n,u=l.length,p=u;while(p--)if(l[p][0]===r){if(u===1)delete this.sessions[e];else l.splice(p,1);if(!r.closed)r.close();return}},i=r.request,{sessionTimeout:a}=t;if(a!=null){let l,u=0;r.request=function(){let p=i.apply(this,arguments);if(u++,l)clearTimeout(l),l=null;return p.once("close",()=>{if(!--u)l=setTimeout(()=>{l=null,s()},a)}),p}}r.once("close",s);let c=[r,t];return n?n.push(c):n=this.sessions[e]=[c],r}}function xEe(e,t){if(e.beforeRedirects.proxy)e.beforeRedirects.proxy(e);if(e.beforeRedirects.config)e.beforeRedirects.config(e,t)}function zB(e,t,n){let r=t;if(!r&&r!==!1){let o=$H(n);if(o){if(!cC(n))r=new URL(o)}}if(r){if(r.username)r.auth=(r.username||"")+":"+(r.password||"");if(r.auth){if(Boolean(r.auth.username||r.auth.password))r.auth=(r.auth.username||"")+":"+(r.auth.password||"");else if(typeof r.auth==="object")throw new G("Invalid proxy authorization",G.ERR_BAD_OPTION,{proxy:r});let i=Buffer.from(r.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+i}e.headers.host=e.hostname+(e.port?":"+e.port:"");let o=r.hostname||r.host;if(e.hostname=o,e.host=o,e.port=r.port,e.path=n,r.protocol)e.protocol=r.protocol.includes(":")?r.protocol:`${r.protocol}:`}e.beforeRedirects.proxy=function(s){zB(s,t,s.href)}}var FB,OB,_Ee,PB,yEe,SEe,bEe,IB,Ey,DB,LB=(e,[t,n])=>(e.on("end",n).on("error",n),t),EEe,vEe,wEe=(e)=>new Promise((t,n)=>{let r,o,s=(c,l)=>{if(o)return;o=!0,r&&r(c,l)},i=(c)=>{s(c),t(c)},a=(c)=>{s(c,!0),n(c)};e(i,a,(c)=>r=c).catch(a)}),AEe=({address:e,family:t})=>{if(!A.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},NB=(e,t)=>AEe(A.isObject(e)?e:{address:e,family:t}),TEe,jB;var HB=O(()=>{pt();dy();py();ay();zH();If();Cr();ja();Eo();lB();os();dB();hB();aC();yB();bB();wB();by();FB=Wn(cB(),1),OB={flush:Ri.constants.Z_SYNC_FLUSH,finishFlush:Ri.constants.Z_SYNC_FLUSH},_Ee={flush:Ri.constants.BROTLI_OPERATION_FLUSH,finishFlush:Ri.constants.BROTLI_OPERATION_FLUSH},PB=A.isFunction(Ri.createBrotliDecompress),{http:yEe,https:SEe}=FB.default,bEe=/https:?/,IB=Symbol("axios.http.socketListener"),Ey=Symbol("axios.http.currentReq"),DB=Ye.protocols.map((e)=>e+":");EEe=new $B;vEe=typeof process<"u"&&A.kindOf(process)==="process",TEe={request(e,t){let n=e.protocol+"//"+e.hostname+":"+(e.port||(e.protocol==="https:"?443:80)),{http2Options:r,headers:o}=e,s=EEe.getSession(n,r),{HTTP2_HEADER_SCHEME:i,HTTP2_HEADER_METHOD:a,HTTP2_HEADER_PATH:c,HTTP2_HEADER_STATUS:l}=MB.constants,u={[i]:e.protocol.replace(":",""),[a]:e.method,[c]:e.path};A.forEach(o,(f,m)=>{m.charAt(0)!==":"&&(u[m]=f)});let p=s.request(u);return p.once("response",(f)=>{let m=p;f=Object.assign({},f);let h=f[l];delete f[l],m.headers=f,m.statusCode=+h,t(m)}),p}},jB=vEe&&function(t){return wEe(async function(r,o,s){let i=(ie)=>A.hasOwnProp(t,ie)?t[ie]:void 0,a=i("data"),c=i("lookup"),l=i("family"),u=i("httpVersion");if(u===void 0)u=1;let p=i("http2Options"),f=i("responseType"),m=i("responseEncoding"),h=t.method.toUpperCase(),y,_=!1,E;if(u=+u,Number.isNaN(u))throw TypeError(`Invalid protocol version: '${t.httpVersion}' is not a number`);if(u!==1&&u!==2)throw TypeError(`Unsupported protocol version '${u}'`);let S=u===2;if(c){let ie=SB(c,(Q)=>A.isArray(Q)?Q:[Q]);c=(Q,te,Be)=>{ie(Q,te,(Te,Ft,Gn)=>{if(Te)return Be(Te);let qe=A.isArray(Ft)?Ft.map((ro)=>NB(ro)):[NB(Ft,Gn)];te.all?Be(Te,qe):Be(Te,qe[0].address,qe[0].family)})}}let x=new gEe;function v(ie){try{x.emit("abort",!ie||ie.type?new kr(null,t,E):ie)}catch(Q){console.warn("emit error",Q)}}x.once("abort",o);let w=()=>{if(t.cancelToken)t.cancelToken.unsubscribe(v);if(t.signal)t.signal.removeEventListener("abort",v);x.removeAllListeners()};if(t.cancelToken||t.signal){if(t.cancelToken&&t.cancelToken.subscribe(v),t.signal)t.signal.aborted?v():t.signal.addEventListener("abort",v)}s((ie,Q)=>{if(y=!0,Q){_=!0,w();return}let{data:te}=ie;if(te instanceof xo.Readable||te instanceof xo.Duplex){let Be=xo.finished(te,()=>{Be(),w()})}else w()});let U=Ha(t.baseURL,t.url,t.allowAbsoluteUrls),L=new URL(U,Ye.hasBrowserEnv?Ye.origin:void 0),F=L.protocol||DB[0];if(F==="data:"){if(t.maxContentLength>-1){let Q=String(t.url||U||"");if(lC(Q)>t.maxContentLength)return o(new G("maxContentLength size of "+t.maxContentLength+" exceeded",G.ERR_BAD_RESPONSE,t))}let ie;if(h!=="GET")return ss(r,o,{status:405,statusText:"method not allowed",headers:{},config:t});try{ie=oC(t.url,f==="blob",{Blob:t.env&&t.env.Blob})}catch(Q){throw G.from(Q,G.ERR_BAD_REQUEST,t)}if(f==="text"){if(ie=ie.toString(m),!m||m==="utf8")ie=A.stripBOM(ie)}else if(f==="stream")ie=xo.Readable.from(ie);return ss(r,o,{data:ie,status:200,statusText:"OK",headers:new Pt,config:t})}if(DB.indexOf(F)===-1)return o(new G("Unsupported protocol "+F,G.ERR_BAD_REQUEST,t));let K=Pt.from(t.headers).normalize();K.set("User-Agent","axios/"+Va,!1);let{onUploadProgress:ne,onDownloadProgress:se}=t,X=t.maxRate,re=void 0,Ie=void 0;if(A.isSpecCompliantForm(a)){let ie=K.getContentType(/boundary=([-_\w\d]{10,70})/i);a=mB(a,(Q)=>{K.set(Q)},{tag:`axios-${Va}-boundary`,boundary:ie&&ie[1]||void 0})}else if(A.isFormData(a)&&A.isFunction(a.getHeaders)&&a.getHeaders!==Object.prototype.getHeaders){if(K.set(a.getHeaders()),!K.hasContentLength())try{let ie=await UB.promisify(a.getLength).call(a);Number.isFinite(ie)&&ie>=0&&K.setContentLength(ie)}catch(ie){}}else if(A.isBlob(a)||A.isFile(a))a.size&&K.setContentType(a.type||"application/octet-stream"),K.setContentLength(a.size||0),a=xo.Readable.from(Sy(a));else if(a&&!A.isStream(a)){if(Buffer.isBuffer(a));else if(A.isArrayBuffer(a))a=Buffer.from(new Uint8Array(a));else if(A.isString(a))a=Buffer.from(a,"utf-8");else return o(new G("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",G.ERR_BAD_REQUEST,t));if(K.setContentLength(a.length,!1),t.maxBodyLength>-1&&a.length>t.maxBodyLength)return o(new G("Request body larger than maxBodyLength limit",G.ERR_BAD_REQUEST,t))}let yt=A.toFiniteNumber(K.getContentLength());if(A.isArray(X))re=X[0],Ie=X[1];else re=Ie=X;if(a&&(ne||re)){if(!A.isStream(a))a=xo.Readable.from(a,{objectMode:!1});a=xo.pipeline([a,new iC({maxRate:A.toFiniteNumber(re)})],A.noop),ne&&a.on("progress",LB(a,hu(yt,Ts(gu(ne),!1,3))))}let Z=void 0,Qe=i("auth");if(Qe){let ie=Qe.username||"",Q=Qe.password||"";Z=ie+":"+Q}if(!Z&&L.username){let{username:ie,password:Q}=L;Z=ie+":"+Q}Z&&K.delete("authorization");let St;try{St=za(L.pathname+L.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(ie){let Q=Error(ie.message);return Q.config=t,Q.url=t.url,Q.exists=!0,o(Q)}K.set("Accept-Encoding","gzip, compress, deflate"+(PB?", br":""),!1);let At=Object.assign(Object.create(null),{path:St,method:h,headers:K.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:Z,protocol:F,family:l,beforeRedirect:xEe,beforeRedirects:Object.create(null),http2Options:p});if(!A.isUndefined(c)&&(At.lookup=c),t.socketPath){if(typeof t.socketPath!=="string")return o(new G("socketPath must be a string",G.ERR_BAD_OPTION_VALUE,t));if(t.allowedSocketPaths!=null){let ie=Array.isArray(t.allowedSocketPaths)?t.allowedSocketPaths:[t.allowedSocketPaths],Q=RB(t.socketPath);if(!ie.some((Be)=>typeof Be==="string"&&RB(Be)===Q))return o(new G(`socketPath "${t.socketPath}" is not permitted by allowedSocketPaths`,G.ERR_BAD_OPTION_VALUE,t))}At.socketPath=t.socketPath}else At.hostname=L.hostname.startsWith("[")?L.hostname.slice(1,-1):L.hostname,At.port=L.port,zB(At,t.proxy,F+"//"+L.hostname+(L.port?":"+L.port:"")+At.path);let Kn,Dt=bEe.test(At.protocol);if(At.agent=Dt?t.httpsAgent:t.httpAgent,S)Kn=TEe;else{let ie=i("transport");if(ie)Kn=ie;else if(t.maxRedirects===0)Kn=Dt?hEe:mEe;else{if(t.maxRedirects)At.maxRedirects=t.maxRedirects;let Q=i("beforeRedirect");if(Q)At.beforeRedirects.config=Q;Kn=Dt?SEe:yEe}}if(t.maxBodyLength>-1)At.maxBodyLength=t.maxBodyLength;else At.maxBodyLength=1/0;if(At.insecureHTTPParser=Boolean(i("insecureHTTPParser")),E=Kn.request(At,function(Q){if(E.destroyed)return;let te=[Q],Be=A.toFiniteNumber(Q.headers["content-length"]);if(se||Ie){let qe=new iC({maxRate:A.toFiniteNumber(Ie)});se&&qe.on("progress",LB(qe,hu(Be,Ts(gu(se),!0,3)))),te.push(qe)}let Te=Q,Ft=Q.req||E;if(t.decompress!==!1&&Q.headers["content-encoding"]){if(h==="HEAD"||Q.statusCode===204)delete Q.headers["content-encoding"];switch((Q.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":te.push(Ri.createUnzip(OB)),delete Q.headers["content-encoding"];break;case"deflate":te.push(new _B),te.push(Ri.createUnzip(OB)),delete Q.headers["content-encoding"];break;case"br":if(PB)te.push(Ri.createBrotliDecompress(_Ee)),delete Q.headers["content-encoding"]}}Te=te.length>1?xo.pipeline(te,A.noop):te[0];let Gn={status:Q.statusCode,statusText:Q.statusMessage,headers:new Pt(Q.headers),config:t,request:Ft};if(f==="stream"){if(t.maxContentLength>-1){let qe=t.maxContentLength,ro=Te;async function*oo(){let Kt=0;for await(let Dc of ro){if(Kt+=Dc.length,Kt>qe)throw new G("maxContentLength size of "+qe+" exceeded",G.ERR_BAD_RESPONSE,t,Ft);yield Dc}}Te=xo.Readable.from(oo(),{objectMode:!1})}Gn.data=Te,ss(r,o,Gn)}else{let qe=[],ro=0;Te.on("data",function(Kt){if(qe.push(Kt),ro+=Kt.length,t.maxContentLength>-1&&ro>t.maxContentLength)_=!0,Te.destroy(),v(new G("maxContentLength size of "+t.maxContentLength+" exceeded",G.ERR_BAD_RESPONSE,t,Ft))}),Te.on("aborted",function(){if(_)return;let Kt=new G("stream has been aborted",G.ERR_BAD_RESPONSE,t,Ft);Te.destroy(Kt),o(Kt)}),Te.on("error",function(Kt){if(E.destroyed)return;o(G.from(Kt,null,t,Ft))}),Te.on("end",function(){try{let Kt=qe.length===1?qe[0]:Buffer.concat(qe);if(f!=="arraybuffer"){if(Kt=Kt.toString(m),!m||m==="utf8")Kt=A.stripBOM(Kt)}Gn.data=Kt}catch(Kt){return o(G.from(Kt,null,t,Gn.request,Gn))}ss(r,o,Gn)})}x.once("abort",(qe)=>{if(!Te.destroyed)Te.emit("error",qe),Te.destroy()})}),x.once("abort",(ie)=>{if(E.close)E.close();else E.destroy(ie)}),E.on("error",function(Q){o(G.from(Q,null,t,E))}),E.on("socket",function(Q){if(Q.setKeepAlive(!0,60000),!Q[IB])Q.on("error",function(Be){let Te=Q[Ey];if(Te&&!Te.destroyed)Te.destroy(Be)}),Q[IB]=!0;Q[Ey]=E,E.once("close",function(){if(Q[Ey]===E)Q[Ey]=null})}),t.timeout){let ie=parseInt(t.timeout,10);if(Number.isNaN(ie)){v(new G("error trying to parse `config.timeout` to int",G.ERR_BAD_OPTION_VALUE,t,E));return}E.setTimeout(ie,function(){if(y)return;let te=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",Be=t.transitional||ki;if(t.timeoutErrorMessage)te=t.timeoutErrorMessage;v(new G(te,Be.clarifyTimeoutError?G.ETIMEDOUT:G.ECONNABORTED,t,E))})}else E.setTimeout(0);if(A.isStream(a)){let ie=!1,Q=!1;a.on("end",()=>{ie=!0}),a.once("error",(Be)=>{Q=!0,E.destroy(Be)}),a.on("close",()=>{if(!ie&&!Q)v(new kr("Request stream has been aborted",t,E))});let te=a;if(t.maxBodyLength>-1&&t.maxRedirects===0){let Be=t.maxBodyLength,Te=0;te=xo.pipeline([a,new xo.Transform({transform(Ft,Gn,qe){if(Te+=Ft.length,Te>Be)return qe(new G("Request body larger than maxBodyLength limit",G.ERR_BAD_REQUEST,t,E));qe(null,Ft)}})],A.noop),te.on("error",(Ft)=>{if(!E.destroyed)E.destroy(Ft)})}te.pipe(E)}else a&&E.write(a),E.end()})}});var BB;var KB=O(()=>{Eo();BB=Ye.hasStandardBrowserEnv?((e,t)=>(n)=>(n=new URL(n,Ye.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ye.origin),Ye.navigator&&/(msie|trident)/i.test(Ye.navigator.userAgent)):()=>!0});var GB;var WB=O(()=>{pt();Eo();GB=Ye.hasStandardBrowserEnv?{write(e,t,n,r,o,s,i){if(typeof document>"u")return;let a=[`${e}=${encodeURIComponent(t)}`];if(A.isNumber(n))a.push(`expires=${new Date(n).toUTCString()}`);if(A.isString(r))a.push(`path=${r}`);if(A.isString(o))a.push(`domain=${o}`);if(s===!0)a.push("secure");if(A.isString(i))a.push(`SameSite=${i}`);document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-86400000,"/")}}:{write(){},read(){return null},remove(){}}});function vo(e,t){t=t||{};let n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(l,u,p,f){if(A.isPlainObject(l)&&A.isPlainObject(u))return A.merge.call({caseless:f},l,u);else if(A.isPlainObject(u))return A.merge({},u);else if(A.isArray(u))return u.slice();return u}function o(l,u,p,f){if(!A.isUndefined(u))return r(l,u,p,f);else if(!A.isUndefined(l))return r(void 0,l,p,f)}function s(l,u){if(!A.isUndefined(u))return r(void 0,u)}function i(l,u){if(!A.isUndefined(u))return r(void 0,u);else if(!A.isUndefined(l))return r(void 0,l)}function a(l,u,p){if(A.hasOwnProp(t,p))return r(l,u);else if(A.hasOwnProp(e,p))return r(void 0,l)}let c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,allowedSocketPaths:i,responseEncoding:i,validateStatus:a,headers:(l,u,p)=>o(VB(l),VB(u),p,!0)};return A.forEach(Object.keys({...e,...t}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;let p=A.hasOwnProp(c,u)?c[u]:o,f=A.hasOwnProp(e,u)?e[u]:void 0,m=A.hasOwnProp(t,u)?t[u]:void 0,h=p(f,m,u);A.isUndefined(h)&&p!==a||(n[u]=h)}),n}var VB=(e)=>e instanceof Pt?{...e}:e;var xy=O(()=>{pt();os()});var vy=(e)=>{let t=vo({},e),n=(f)=>A.hasOwnProp(t,f)?t[f]:void 0,r=n("data"),o=n("withXSRFToken"),s=n("xsrfHeaderName"),i=n("xsrfCookieName"),a=n("headers"),c=n("auth"),l=n("baseURL"),u=n("allowAbsoluteUrls"),p=n("url");if(t.headers=a=Pt.from(a),t.url=za(Ha(l,p,u),e.params,e.paramsSerializer),c)a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));if(A.isFormData(r)){if(Ye.hasStandardBrowserEnv||Ye.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(A.isFunction(r.getHeaders)){let f=r.getHeaders(),m=["content-type","content-length"];Object.entries(f).forEach(([h,y])=>{if(m.includes(h.toLowerCase()))a.set(h,y)})}}if(Ye.hasStandardBrowserEnv){if(A.isFunction(o))o=o(t);if(o===!0||o==null&&BB(t.url)){let m=s&&i&&GB.read(i);if(m)a.set(s,m)}}return t};var uC=O(()=>{Eo();pt();KB();WB();py();xy();os();ay()});var CEe,qB;var ZB=O(()=>{pt();dy();If();Cr();ja();Eo();os();by();uC();CEe=typeof XMLHttpRequest<"u",qB=CEe&&function(e){return new Promise(function(n,r){let o=vy(e),s=o.data,i=Pt.from(o.headers).normalize(),{responseType:a,onUploadProgress:c,onDownloadProgress:l}=o,u,p,f,m,h;function y(){m&&m(),h&&h(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let _=new XMLHttpRequest;_.open(o.method.toUpperCase(),o.url,!0),_.timeout=o.timeout;function E(){if(!_)return;let x=Pt.from("getAllResponseHeaders"in _&&_.getAllResponseHeaders()),w={data:!a||a==="text"||a==="json"?_.responseText:_.response,status:_.status,statusText:_.statusText,headers:x,config:e,request:_};ss(function(L){n(L),y()},function(L){r(L),y()},w),_=null}if("onloadend"in _)_.onloadend=E;else _.onreadystatechange=function(){if(!_||_.readyState!==4)return;if(_.status===0&&!(_.responseURL&&_.responseURL.indexOf("file:")===0))return;setTimeout(E)};if(_.onabort=function(){if(!_)return;r(new G("Request aborted",G.ECONNABORTED,e,_)),_=null},_.onerror=function(v){let w=v&&v.message?v.message:"Network Error",U=new G(w,G.ERR_NETWORK,e,_);U.event=v||null,r(U),_=null},_.ontimeout=function(){let v=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",w=o.transitional||ki;if(o.timeoutErrorMessage)v=o.timeoutErrorMessage;r(new G(v,w.clarifyTimeoutError?G.ETIMEDOUT:G.ECONNABORTED,e,_)),_=null},s===void 0&&i.setContentType(null),"setRequestHeader"in _)A.forEach(i.toJSON(),function(v,w){_.setRequestHeader(w,v)});if(!A.isUndefined(o.withCredentials))_.withCredentials=!!o.withCredentials;if(a&&a!=="json")_.responseType=o.responseType;if(l)[f,h]=Ts(l,!0),_.addEventListener("progress",f);if(c&&_.upload)[p,m]=Ts(c),_.upload.addEventListener("progress",p),_.upload.addEventListener("loadend",m);if(o.cancelToken||o.signal){if(u=(x)=>{if(!_)return;r(!x||x.type?new kr(null,e,_):x),_.abort(),_=null},o.cancelToken&&o.cancelToken.subscribe(u),o.signal)o.signal.aborted?u():o.signal.addEventListener("abort",u)}let S=jf(o.url);if(S&&Ye.protocols.indexOf(S)===-1){r(new G("Unsupported protocol "+S+":",G.ERR_BAD_REQUEST,e));return}_.send(s||null)})}});var kEe=(e,t)=>{let{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,o,s=function(l){if(!o){o=!0,a();let u=l instanceof Error?l:this.reason;r.abort(u instanceof G?u:new kr(u instanceof Error?u.message:u))}},i=t&&setTimeout(()=>{i=null,s(new G(`timeout of ${t}ms exceeded`,G.ETIMEDOUT))},t),a=()=>{if(e)i&&clearTimeout(i),i=null,e.forEach((l)=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),e=null};e.forEach((l)=>l.addEventListener("abort",s));let{signal:c}=r;return c.unsubscribe=()=>A.asap(a),c}},YB;var JB=O(()=>{ja();Cr();pt();YB=kEe});var REe=function*(e,t){let n=e.byteLength;if(!t||n<t){yield e;return}let r=0,o;while(r<n)o=r+t,yield e.slice(r,o),r=o},OEe=async function*(e,t){for await(let n of PEe(e))yield*REe(n,t)},PEe=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},dC=(e,t,n,r)=>{let o=OEe(e,t),s=0,i,a=(c)=>{if(!i)i=!0,r&&r(c)};return new ReadableStream({async pull(c){try{let{done:l,value:u}=await o.next();if(l){a(),c.close();return}let p=u.byteLength;if(n){let f=s+=p;n(f)}c.enqueue(new Uint8Array(u))}catch(l){throw a(l),l}},cancel(c){return a(c),o.return()}},{highWaterMark:2})};var XB=65536,wy,IEe,QB,e2,t2=(e,...t)=>{try{return!!e(...t)}catch(n){return!1}},DEe=(e)=>{e=A.merge.call({skipUndefined:!0},IEe,e);let{fetch:t,Request:n,Response:r}=e,o=t?wy(t):typeof fetch==="function",s=wy(n),i=wy(r);if(!o)return!1;let a=o&&wy(QB),c=o&&(typeof e2==="function"?((h)=>(y)=>h.encode(y))(new e2):async(h)=>new Uint8Array(await new n(h).arrayBuffer())),l=s&&a&&t2(()=>{let h=!1,y=new n(Ye.origin,{body:new QB,method:"POST",get duplex(){return h=!0,"half"}}),_=y.headers.has("Content-Type");if(y.body!=null)y.body.cancel();return h&&!_}),u=i&&a&&t2(()=>A.isReadableStream(new r("").body)),p={stream:u&&((h)=>h.body)};o&&(()=>{["text","arrayBuffer","blob","formData","stream"].forEach((h)=>{!p[h]&&(p[h]=(y,_)=>{let E=y&&y[h];if(E)return E.call(y);throw new G(`Response type '${h}' is not supported`,G.ERR_NOT_SUPPORT,_)})})})();let f=async(h)=>{if(h==null)return 0;if(A.isBlob(h))return h.size;if(A.isSpecCompliantForm(h))return(await new n(Ye.origin,{method:"POST",body:h}).arrayBuffer()).byteLength;if(A.isArrayBufferView(h)||A.isArrayBuffer(h))return h.byteLength;if(A.isURLSearchParams(h))h=h+"";if(A.isString(h))return(await c(h)).byteLength},m=async(h,y)=>{let _=A.toFiniteNumber(h.getContentLength());return _==null?f(y):_};return async(h)=>{let{url:y,method:_,data:E,signal:S,cancelToken:x,timeout:v,onDownloadProgress:w,onUploadProgress:U,responseType:L,headers:F,withCredentials:K="same-origin",fetchOptions:ne}=vy(h),se=t||fetch;L=L?(L+"").toLowerCase():"text";let X=YB([S,x&&x.toAbortSignal()],v),re=null,Ie=X&&X.unsubscribe&&(()=>{X.unsubscribe()}),yt;try{if(U&&l&&_!=="get"&&_!=="head"&&(yt=await m(F,E))!==0){let Dt=new n(y,{method:"POST",body:E,duplex:"half"}),ie;if(A.isFormData(E)&&(ie=Dt.headers.get("content-type")))F.setContentType(ie);if(Dt.body){let[Q,te]=hu(yt,Ts(gu(U)));E=dC(Dt.body,XB,Q,te)}}if(!A.isString(K))K=K?"include":"omit";let Z=s&&"credentials"in n.prototype;if(A.isFormData(E)){let Dt=F.getContentType();if(Dt&&/^multipart\/form-data/i.test(Dt)&&!/boundary=/i.test(Dt))F.delete("content-type")}let Qe={...ne,signal:X,method:_.toUpperCase(),headers:F.normalize().toJSON(),body:E,duplex:"half",credentials:Z?K:void 0};re=s&&new n(y,Qe);let St=await(s?se(re,ne):se(y,Qe)),At=u&&(L==="stream"||L==="response");if(u&&(w||At&&Ie)){let Dt={};["status","statusText","headers"].forEach((Be)=>{Dt[Be]=St[Be]});let ie=A.toFiniteNumber(St.headers.get("content-length")),[Q,te]=w&&hu(ie,Ts(gu(w),!0))||[];St=new r(dC(St.body,XB,Q,()=>{te&&te(),Ie&&Ie()}),Dt)}L=L||"text";let Kn=await p[A.findKey(p,L)||"text"](St,h);return!At&&Ie&&Ie(),await new Promise((Dt,ie)=>{ss(Dt,ie,{data:Kn,headers:Pt.from(St.headers),status:St.status,statusText:St.statusText,config:h,request:re})})}catch(Z){if(Ie&&Ie(),Z&&Z.name==="TypeError"&&/Load failed|fetch/i.test(Z.message))throw Object.assign(new G("Network Error",G.ERR_NETWORK,h,re,Z&&Z.response),{cause:Z.cause||Z});throw G.from(Z,Z&&Z.code,h,re,Z&&Z.response)}}},LEe,pC=(e)=>{let t=e&&e.env||{},{fetch:n,Request:r,Response:o}=t,s=[r,o,n],i=s.length,a=i,c,l,u=LEe;while(a--)c=s[a],l=u.get(c),l===void 0&&u.set(c,l=a?new Map:DEe(t)),u=l;return l},fkt;var n2=O(()=>{Eo();pt();Cr();JB();os();by();uC();dy();({isFunction:wy}=A),IEe=(({Request:e,Response:t})=>({Request:e,Response:t}))(A.global),{ReadableStream:QB,TextEncoder:e2}=A.global,LEe=new Map,fkt=pC()});function UEe(e,t){e=A.isArray(e)?e:[e];let{length:n}=e,r,o,s={};for(let i=0;i<n;i++){r=e[i];let a;if(o=r,!MEe(r)){if(o=fC[(a=String(r)).toLowerCase()],o===void 0)throw new G(`Unknown adapter '${a}'`)}if(o&&(A.isFunction(o)||(o=o.get(t))))break;s[a||"#"+i]=o}if(!o){let i=Object.entries(s).map(([c,l])=>`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build")),a=n?i.length>1?`since :
73
+ `+i.map(r2).join(`
74
+ `):" "+r2(i[0]):"as no adapter specified";throw new G("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return o}var fC,r2=(e)=>`- ${e}`,MEe=(e)=>A.isFunction(e)||e===null||e===!1,Ay;var mC=O(()=>{pt();HB();ZB();n2();Cr();fC={http:jB,xhr:qB,fetch:{get:pC}};A.forEach(fC,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(n){}Object.defineProperty(e,"adapterName",{value:t})}});Ay={getAdapter:UEe,adapters:fC}});function hC(e){if(e.cancelToken)e.cancelToken.throwIfRequested();if(e.signal&&e.signal.aborted)throw new kr(null,e)}function Ty(e){if(hC(e),e.headers=Pt.from(e.headers),e.data=Nf.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1)e.headers.setContentType("application/x-www-form-urlencoded",!1);return Ay.getAdapter(e.adapter||du.adapter,e)(e).then(function(r){return hC(e),r.data=Nf.call(e,e.transformResponse,r),r.headers=Pt.from(r.headers),r},function(r){if(!Mf(r)){if(hC(e),r&&r.response)r.response.data=Nf.call(e,e.transformResponse,r.response),r.response.headers=Pt.from(r.response.headers)}return Promise.reject(r)})}var o2=O(()=>{UH();ly();ja();os();mC()});function FEe(e,t,n){if(typeof e!=="object")throw new G("options must be an object",G.ERR_BAD_OPTION_VALUE);let r=Object.keys(e),o=r.length;while(o-- >0){let s=r[o],i=Object.prototype.hasOwnProperty.call(t,s)?t[s]:void 0;if(i){let a=e[s],c=a===void 0||i(a,s,e);if(c!==!0)throw new G("option "+s+" must be "+c,G.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new G("Unknown option "+s,G.ERR_BAD_OPTION)}}var Cy,s2,Bf;var i2=O(()=>{Cr();Cy={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Cy[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});s2={};Cy.transitional=function(t,n,r){function o(s,i){return"[Axios v"+Va+"] Transitional option '"+s+"'"+i+(r?". "+r:"")}return(s,i,a)=>{if(t===!1)throw new G(o(i," has been removed"+(n?" in "+n:"")),G.ERR_DEPRECATED);if(n&&!s2[i])s2[i]=!0,console.warn(o(i," has been deprecated since v"+n+" and will be removed in the near future"));return t?t(s,i,a):!0}};Cy.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};Bf={assertOptions:FEe,validators:Cy}});class Kf{constructor(e){this.defaults=e||{},this.interceptors={request:new PT,response:new PT}}async request(e,t){try{return await this._request(e,t)}catch(n){if(n instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=Error();let o=(()=>{if(!r.stack)return"";let s=r.stack.indexOf(`
75
+ `);return s===-1?"":r.stack.slice(s+1)})();try{if(!n.stack)n.stack=o;else if(o){let s=o.indexOf(`
76
+ `),i=s===-1?-1:o.indexOf(`
77
+ `,s+1),a=i===-1?"":o.slice(i+1);if(!String(n.stack).endsWith(a))n.stack+=`
78
+ `+o}}catch(s){}}throw n}}_request(e,t){if(typeof e==="string")t=t||{},t.url=e;else t=e||{};t=vo(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:o}=t;if(n!==void 0)Bf.assertOptions(n,{silentJSONParsing:Gr.transitional(Gr.boolean),forcedJSONParsing:Gr.transitional(Gr.boolean),clarifyTimeoutError:Gr.transitional(Gr.boolean),legacyInterceptorReqResOrdering:Gr.transitional(Gr.boolean)},!1);if(r!=null)if(A.isFunction(r))t.paramsSerializer={serialize:r};else Bf.assertOptions(r,{encode:Gr.function,serialize:Gr.function},!0);if(t.allowAbsoluteUrls!==void 0);else if(this.defaults.allowAbsoluteUrls!==void 0)t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls;else t.allowAbsoluteUrls=!0;Bf.assertOptions(t,{baseUrl:Gr.spelling("baseURL"),withXsrfToken:Gr.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&A.merge(o.common,o[t.method]);o&&A.forEach(["delete","get","head","post","put","patch","common"],(m)=>{delete o[m]}),t.headers=Pt.concat(s,o);let i=[],a=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen==="function"&&h.runWhen(t)===!1)return;a=a&&h.synchronous;let y=t.transitional||ki;if(y&&y.legacyInterceptorReqResOrdering)i.unshift(h.fulfilled,h.rejected);else i.push(h.fulfilled,h.rejected)});let c=[];this.interceptors.response.forEach(function(h){c.push(h.fulfilled,h.rejected)});let l,u=0,p;if(!a){let m=[Ty.bind(this),void 0];m.unshift(...i),m.push(...c),p=m.length,l=Promise.resolve(t);while(u<p)l=l.then(m[u++],m[u++]);return l}p=i.length;let f=t;while(u<p){let m=i[u++],h=i[u++];try{f=m(f)}catch(y){h.call(this,y);break}}try{l=Ty.call(this,f)}catch(m){return Promise.reject(m)}u=0,p=c.length;while(u<p)l=l.then(c[u++],c[u++]);return l}getUri(e){e=vo(this.defaults,e);let t=Ha(e.baseURL,e.url,e.allowAbsoluteUrls);return za(t,e.params,e.paramsSerializer)}}var Gr,Gf;var a2=O(()=>{pt();ay();AH();o2();xy();py();i2();os();If();Gr=Bf.validators;A.forEach(["delete","get","head","options"],function(t){Kf.prototype[t]=function(n,r){return this.request(vo(r||{},{method:t,url:n,data:(r||{}).data}))}});A.forEach(["post","put","patch"],function(t){function n(r){return function(s,i,a){return this.request(vo(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}Kf.prototype[t]=n(),Kf.prototype[t+"Form"]=n(!0)});Gf=Kf});class gC{constructor(e){if(typeof e!=="function")throw TypeError("executor must be a function.");let t;this.promise=new Promise(function(o){t=o});let n=this;this.promise.then((r)=>{if(!n._listeners)return;let o=n._listeners.length;while(o-- >0)n._listeners[o](r);n._listeners=null}),this.promise.then=(r)=>{let o,s=new Promise((i)=>{n.subscribe(i),o=i}).then(r);return s.cancel=function(){n.unsubscribe(o)},s},e(function(o,s,i){if(n.reason)return;n.reason=new kr(o,s,i),t(n.reason)})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}if(this._listeners)this._listeners.push(e);else this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);if(t!==-1)this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=(n)=>{e.abort(n)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new gC(function(r){e=r}),cancel:e}}}var c2;var l2=O(()=>{ja();c2=gC});function _C(e){return function(n){return e.apply(null,n)}}function yC(e){return A.isObject(e)&&e.isAxiosError===!0}var u2=O(()=>{pt()});var SC,d2;var p2=O(()=>{SC={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(SC).forEach(([e,t])=>{SC[t]=e});d2=SC});function f2(e){let t=new Gf(e),n=wf(Gf.prototype.request,t);return A.extend(n,Gf.prototype,t,{allOwnKeys:!0}),A.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return f2(vo(e,o))},n}var qt,Rr;var m2=O(()=>{pt();a2();xy();ly();UT();ja();l2();Pf();Cr();u2();os();mC();p2();qt=f2(du);qt.Axios=Gf;qt.CanceledError=kr;qt.CancelToken=c2;qt.isCancel=Mf;qt.VERSION=Va;qt.toFormData=Ci;qt.AxiosError=G;qt.Cancel=qt.CanceledError;qt.all=function(t){return Promise.all(t)};qt.spread=_C;qt.isAxiosError=yC;qt.mergeConfig=vo;qt.AxiosHeaders=Pt;qt.formToJSON=(e)=>cy(A.isHTMLForm(e)?new FormData(e):e);qt.getAdapter=Ay.getAdapter;qt.HttpStatusCode=d2;qt.default=qt;Rr=qt});var uRt,dRt,pRt,h2,fRt,mRt,hRt,gRt,ky,_Rt,yRt,SRt,bRt,ERt,xRt,vRt;var Ry=O(()=>{m2();({Axios:uRt,AxiosError:dRt,CanceledError:pRt,isCancel:h2,CancelToken:fRt,VERSION:mRt,all:hRt,Cancel:gRt,isAxiosError:ky,spread:_Rt,toFormData:yRt,AxiosHeaders:SRt,HttpStatusCode:bRt,formToJSON:ERt,getAdapter:xRt,mergeConfig:vRt}=Rr)});function zEe(e){let t,n=e.startsWith("//")?`https:${e}`:e;try{t=new URL(n).hostname}catch{t=e.match(/^[^/:]+/)?.[0]??e}return t.endsWith(".")?t.slice(0,-1):t}function g2(e){return $Ee.test(zEe(e))}var $Ee;var _2=O(()=>{$Ee=/(^|\.)(anthropic\.com|claude\.ai|claude\.com)$/i});var Cs=T(function(TRt,b2){var y2=["nodebuffer","arraybuffer","fragments"],S2=typeof Blob<"u";if(S2)y2.push("blob");b2.exports={BINARY_TYPES:y2,CLOSE_TIMEOUT:30000,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:S2,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Wf=T(function(CRt,Oy){var{EMPTY_BUFFER:jEe}=Cs(),bC=Buffer[Symbol.species];function HEe(e,t){if(e.length===0)return jEe;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),r=0;for(let o=0;o<e.length;o++){let s=e[o];n.set(s,r),r+=s.length}if(r<t)return new bC(n.buffer,n.byteOffset,r);return n}function E2(e,t,n,r,o){for(let s=0;s<o;s++)n[r+s]=e[s]^t[s&3]}function x2(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function BEe(e){if(e.length===e.buffer.byteLength)return e.buffer;return e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function EC(e){if(EC.readOnly=!0,Buffer.isBuffer(e))return e;let t;if(e instanceof ArrayBuffer)t=new bC(e);else if(ArrayBuffer.isView(e))t=new bC(e.buffer,e.byteOffset,e.byteLength);else t=Buffer.from(e),EC.readOnly=!1;return t}Oy.exports={concat:HEe,mask:E2,toArrayBuffer:BEe,toBuffer:EC,unmask:x2};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=(()=>{throw new Error("Cannot require module "+"bufferutil");})();Oy.exports.mask=function(t,n,r,o,s){if(s<48)E2(t,n,r,o,s);else e.mask(t,n,r,o,s)},Oy.exports.unmask=function(t,n){if(t.length<32)x2(t,n);else e.unmask(t,n)}}catch(e){}});var T2=T(function(kRt,A2){var v2=Symbol("kDone"),xC=Symbol("kRun");class w2{constructor(e){this[v2]=()=>{this.pending--,this[xC]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[xC]()}[xC](){if(this.pending===this.concurrency)return;if(this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[v2])}}}A2.exports=w2});var Su=T(function(RRt,P2){var Vf=xe("zlib"),C2=Wf(),KEe=T2(),{kStatusCode:k2}=Cs(),GEe=Buffer[Symbol.species],WEe=Buffer.from([0,0,255,255]),Iy=Symbol("permessage-deflate"),ks=Symbol("total-length"),_u=Symbol("callback"),Oi=Symbol("buffers"),yu=Symbol("error"),Py;class R2{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!Py){let t=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Py=new KEe(t)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};if(this._options.serverNoContextTakeover)e.server_no_context_takeover=!0;if(this._options.clientNoContextTakeover)e.client_no_context_takeover=!0;if(this._options.serverMaxWindowBits)e.server_max_window_bits=this._options.serverMaxWindowBits;if(this._options.clientMaxWindowBits)e.client_max_window_bits=this._options.clientMaxWindowBits;else if(this._options.clientMaxWindowBits==null)e.client_max_window_bits=!0;return e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate)this._inflate.close(),this._inflate=null;if(this._deflate){let e=this._deflate[_u];if(this._deflate.close(),this._deflate=null,e)e(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,n=e.find((r)=>{if(t.serverNoContextTakeover===!1&&r.server_no_context_takeover||r.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==="number"&&t.serverMaxWindowBits>r.server_max_window_bits)||typeof t.clientMaxWindowBits==="number"&&!r.client_max_window_bits)return!1;return!0});if(!n)throw Error("None of the extension offers can be accepted");if(t.serverNoContextTakeover)n.server_no_context_takeover=!0;if(t.clientNoContextTakeover)n.client_no_context_takeover=!0;if(typeof t.serverMaxWindowBits==="number")n.server_max_window_bits=t.serverMaxWindowBits;if(typeof t.clientMaxWindowBits==="number")n.client_max_window_bits=t.clientMaxWindowBits;else if(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)delete n.client_max_window_bits;return n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(!t.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number")t.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==="number"&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"');return t}normalizeParams(e){return e.forEach((t)=>{Object.keys(t).forEach((n)=>{let r=t[n];if(r.length>1)throw Error(`Parameter "${n}" must have only a single value`);if(r=r[0],n==="client_max_window_bits"){if(r!==!0){let o=+r;if(!Number.isInteger(o)||o<8||o>15)throw TypeError(`Invalid value for parameter "${n}": ${r}`);r=o}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${n}": ${r}`)}else if(n==="server_max_window_bits"){let o=+r;if(!Number.isInteger(o)||o<8||o>15)throw TypeError(`Invalid value for parameter "${n}": ${r}`);r=o}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(r!==!0)throw TypeError(`Invalid value for parameter "${n}": ${r}`)}else throw Error(`Unknown parameter "${n}"`);t[n]=r})}),e}decompress(e,t,n){Py.add((r)=>{this._decompress(e,t,(o,s)=>{r(),n(o,s)})})}compress(e,t,n){Py.add((r)=>{this._compress(e,t,(o,s)=>{r(),n(o,s)})})}_decompress(e,t,n){let r=this._isServer?"client":"server";if(!this._inflate){let o=`${r}_max_window_bits`,s=typeof this.params[o]!=="number"?Vf.Z_DEFAULT_WINDOWBITS:this.params[o];this._inflate=Vf.createInflateRaw({...this._options.zlibInflateOptions,windowBits:s}),this._inflate[Iy]=this,this._inflate[ks]=0,this._inflate[Oi]=[],this._inflate.on("error",qEe),this._inflate.on("data",O2)}if(this._inflate[_u]=n,this._inflate.write(e),t)this._inflate.write(WEe);this._inflate.flush(()=>{let o=this._inflate[yu];if(o){this._inflate.close(),this._inflate=null,n(o);return}let s=C2.concat(this._inflate[Oi],this._inflate[ks]);if(this._inflate._readableState.endEmitted)this._inflate.close(),this._inflate=null;else if(this._inflate[ks]=0,this._inflate[Oi]=[],t&&this.params[`${r}_no_context_takeover`])this._inflate.reset();n(null,s)})}_compress(e,t,n){let r=this._isServer?"server":"client";if(!this._deflate){let o=`${r}_max_window_bits`,s=typeof this.params[o]!=="number"?Vf.Z_DEFAULT_WINDOWBITS:this.params[o];this._deflate=Vf.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:s}),this._deflate[ks]=0,this._deflate[Oi]=[],this._deflate.on("data",VEe)}this._deflate[_u]=n,this._deflate.write(e),this._deflate.flush(Vf.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let o=C2.concat(this._deflate[Oi],this._deflate[ks]);if(t)o=new GEe(o.buffer,o.byteOffset,o.length-4);if(this._deflate[_u]=null,this._deflate[ks]=0,this._deflate[Oi]=[],t&&this.params[`${r}_no_context_takeover`])this._deflate.reset();n(null,o)})}}P2.exports=R2;function VEe(e){this[Oi].push(e),this[ks]+=e.length}function O2(e){if(this[ks]+=e.length,this[Iy]._maxPayload<1||this[ks]<=this[Iy]._maxPayload){this[Oi].push(e);return}this[yu]=RangeError("Max payload size exceeded"),this[yu].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[yu][k2]=1009,this.removeListener("data",O2),this.reset()}function qEe(e){if(this[Iy]._inflate=null,this[yu]){this[_u](this[yu]);return}e[k2]=1007,this[_u](e)}});var bu=T(function(ORt,Dy){var{isUtf8:I2}=xe("buffer"),{hasBlob:ZEe}=Cs(),YEe=[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,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function JEe(e){return e>=1000&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3000&&e<=4999}function vC(e){let t=e.length,n=0;while(n<t)if((e[n]&128)===0)n++;else if((e[n]&224)===192){if(n+1===t||(e[n+1]&192)!==128||(e[n]&254)===192)return!1;n+=2}else if((e[n]&240)===224){if(n+2>=t||(e[n+1]&192)!==128||(e[n+2]&192)!==128||e[n]===224&&(e[n+1]&224)===128||e[n]===237&&(e[n+1]&224)===160)return!1;n+=3}else if((e[n]&248)===240){if(n+3>=t||(e[n+1]&192)!==128||(e[n+2]&192)!==128||(e[n+3]&192)!==128||e[n]===240&&(e[n+1]&240)===128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function XEe(e){return ZEe&&typeof e==="object"&&typeof e.arrayBuffer==="function"&&typeof e.type==="string"&&typeof e.stream==="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}Dy.exports={isBlob:XEe,isValidStatusCode:JEe,isValidUTF8:vC,tokenChars:YEe};if(I2)Dy.exports.isValidUTF8=function(e){return e.length<24?vC(e):I2(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=(()=>{throw new Error("Cannot require module "+"utf-8-validate");})();Dy.exports.isValidUTF8=function(t){return t.length<32?vC(t):e(t)}}catch(e){}});var AC=T(function(PRt,U2){var{Writable:QEe}=xe("stream"),D2=Su(),{BINARY_TYPES:exe,EMPTY_BUFFER:L2,kStatusCode:txe,kWebSocket:nxe}=Cs(),{concat:wC,toArrayBuffer:rxe,unmask:oxe}=Wf(),{isValidStatusCode:sxe,isValidUTF8:N2}=bu(),Ly=Buffer[Symbol.species];class M2 extends QEe{constructor(e={}){super();this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||exe[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=e.maxBufferedChunks|0,this._maxFragments=e.maxFragments|0,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[nxe]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new Ly(n.buffer,n.byteOffset+e,n.length-e),new Ly(n.buffer,n.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;if(e>=n.length)t.set(this._buffers.shift(),r);else t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new Ly(n.buffer,n.byteOffset+e,n.length-e);e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);if(!this._errored)e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if((t[0]&48)!==0){let r=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(r);return}let n=(t[0]&64)===64;if(n&&!this._extensions[D2.extensionName]){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(r);return}if(this._fin=(t[0]&128)===128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(r);return}if(!this._fragmented){let r=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(r);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let r=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(r);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let r=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(r);return}if(n){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(r);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let r=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(r);return}}else{let r=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(r);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;if(this._masked=(t[1]&128)===128,this._isServer){if(!this._masked){let r=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(r);return}}else if(this._masked){let r=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(r);return}if(this._payloadLength===126)this._state=1;else if(this._payloadLength===127)this._state=2;else this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>Math.pow(2,21)-1){let r=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(r);return}this._payloadLength=n*Math.pow(2,32)+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8){if(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){let t=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(t);return}}if(this._masked)this._state=3;else this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=L2;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}if(t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0)oxe(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){let n=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");e(n);return}if(this._compressed){this._state=5,this.decompress(t,e);return}if(t.length)this._messageLength=this._totalPayloadLength,this._fragments.push(t);this.dataMessage(e)}decompress(e,t){this._extensions[D2.extensionName].decompress(e,this._fin,(r,o)=>{if(r)return t(r);if(o.length){if(this._messageLength+=o.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let s=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(s);return}this._fragments.push(o)}if(this.dataMessage(t),this._state===0)this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],this._opcode===2){let r;if(this._binaryType==="nodebuffer")r=wC(n,t);else if(this._binaryType==="arraybuffer")r=rxe(wC(n,t));else if(this._binaryType==="blob")r=new Blob(n);else r=n;if(this._allowSynchronousEvents)this.emit("message",r,!0),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",r,!0),this._state=0,this.startLoop(e)})}else{let r=wC(n,t);if(!this._skipUTF8Validation&&!N2(r)){let o=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(o);return}if(this._state===5||this._allowSynchronousEvents)this.emit("message",r,!1),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",r,!1),this._state=0,this.startLoop(e)})}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,L2),this.end();else{let n=e.readUInt16BE(0);if(!sxe(n)){let o=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");t(o);return}let r=new Ly(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!N2(r)){let o=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(o);return}this._loop=!1,this.emit("conclude",n,r),this.end()}this._state=0;return}if(this._allowSynchronousEvents)this.emit(this._opcode===9?"ping":"pong",e),this._state=0;else this._state=6,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=0,this.startLoop(t)})}createError(e,t,n,r,o){this._loop=!1,this._errored=!0;let s=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(s,this.createError),s.code=o,s[txe]=r,s}}U2.exports=M2});var CC=T(function(DRt,z2){var{Duplex:IRt}=xe("stream"),{randomFillSync:ixe}=xe("crypto"),{types:{isUint8Array:axe}}=xe("util"),F2=Su(),{EMPTY_BUFFER:cxe,kWebSocket:lxe,NOOP:uxe}=Cs(),{isBlob:Eu,isValidStatusCode:dxe}=bu(),{mask:$2,toBuffer:Za}=Wf(),Wr=Symbol("kByteLength"),pxe=Buffer.alloc(4),Ya,xu=8192,wo=0,fxe=1,mxe=2;class Pi{constructor(e,t,n){if(this._extensions=t||{},n)this._generateMask=n,this._maskBuffer=Buffer.alloc(4);this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=wo,this.onerror=uxe,this[lxe]=void 0}static frame(e,t){let n,r=!1,o=2,s=!1;if(t.mask){if(n=t.maskBuffer||pxe,t.generateMask)t.generateMask(n);else{if(xu===8192){if(Ya===void 0)Ya=Buffer.alloc(8192);ixe(Ya,0,8192),xu=0}n[0]=Ya[xu++],n[1]=Ya[xu++],n[2]=Ya[xu++],n[3]=Ya[xu++]}s=(n[0]|n[1]|n[2]|n[3])===0,o=6}let i;if(typeof e==="string")if((!t.mask||s)&&t[Wr]!==void 0)i=t[Wr];else e=Buffer.from(e),i=e.length;else i=e.length,r=t.mask&&t.readOnly&&!s;let a=i;if(i>=65536)o+=8,a=127;else if(i>125)o+=2,a=126;let c=Buffer.allocUnsafe(r?i+o:o);if(c[0]=t.fin?t.opcode|128:t.opcode,t.rsv1)c[0]|=64;if(c[1]=a,a===126)c.writeUInt16BE(i,2);else if(a===127)c[2]=c[3]=0,c.writeUIntBE(i,4,6);if(!t.mask)return[c,e];if(c[1]|=128,c[o-4]=n[0],c[o-3]=n[1],c[o-2]=n[2],c[o-1]=n[3],s)return[c,e];if(r)return $2(e,n,c,o,i),[c];return $2(e,n,e,0,i),[c,e]}close(e,t,n,r){let o;if(e===void 0)o=cxe;else if(typeof e!=="number"||!dxe(e))throw TypeError("First argument must be a valid error code number");else if(t===void 0||!t.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(e,0);else{let i=Buffer.byteLength(t);if(i>123)throw RangeError("The message must not be greater than 123 bytes");if(o=Buffer.allocUnsafe(2+i),o.writeUInt16BE(e,0),typeof t==="string")o.write(t,2);else if(axe(t))o.set(t,2);else throw TypeError("Second argument must be a string or a Uint8Array")}let s={[Wr]:o.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};if(this._state!==wo)this.enqueue([this.dispatch,o,!1,s,r]);else this.sendFrame(Pi.frame(o,s),r)}ping(e,t,n){let r,o;if(typeof e==="string")r=Buffer.byteLength(e),o=!1;else if(Eu(e))r=e.size,o=!1;else e=Za(e),r=e.length,o=Za.readOnly;if(r>125)throw RangeError("The data size must not be greater than 125 bytes");let s={[Wr]:r,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:o,rsv1:!1};if(Eu(e))if(this._state!==wo)this.enqueue([this.getBlobData,e,!1,s,n]);else this.getBlobData(e,!1,s,n);else if(this._state!==wo)this.enqueue([this.dispatch,e,!1,s,n]);else this.sendFrame(Pi.frame(e,s),n)}pong(e,t,n){let r,o;if(typeof e==="string")r=Buffer.byteLength(e),o=!1;else if(Eu(e))r=e.size,o=!1;else e=Za(e),r=e.length,o=Za.readOnly;if(r>125)throw RangeError("The data size must not be greater than 125 bytes");let s={[Wr]:r,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:o,rsv1:!1};if(Eu(e))if(this._state!==wo)this.enqueue([this.getBlobData,e,!1,s,n]);else this.getBlobData(e,!1,s,n);else if(this._state!==wo)this.enqueue([this.dispatch,e,!1,s,n]);else this.sendFrame(Pi.frame(e,s),n)}send(e,t,n){let r=this._extensions[F2.extensionName],o=t.binary?2:1,s=t.compress,i,a;if(typeof e==="string")i=Buffer.byteLength(e),a=!1;else if(Eu(e))i=e.size,a=!1;else e=Za(e),i=e.length,a=Za.readOnly;if(this._firstFragment){if(this._firstFragment=!1,s&&r&&r.params[r._isServer?"server_no_context_takeover":"client_no_context_takeover"])s=i>=r._threshold;this._compress=s}else s=!1,o=0;if(t.fin)this._firstFragment=!0;let c={[Wr]:i,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:o,readOnly:a,rsv1:s};if(Eu(e))if(this._state!==wo)this.enqueue([this.getBlobData,e,this._compress,c,n]);else this.getBlobData(e,this._compress,c,n);else if(this._state!==wo)this.enqueue([this.dispatch,e,this._compress,c,n]);else this.dispatch(e,this._compress,c,n)}getBlobData(e,t,n,r){this._bufferedBytes+=n[Wr],this._state=mxe,e.arrayBuffer().then((o)=>{if(this._socket.destroyed){let i=Error("The socket was closed while the blob was being read");process.nextTick(TC,this,i,r);return}this._bufferedBytes-=n[Wr];let s=Za(o);if(!t)this._state=wo,this.sendFrame(Pi.frame(s,n),r),this.dequeue();else this.dispatch(s,t,n,r)}).catch((o)=>{process.nextTick(hxe,this,o,r)})}dispatch(e,t,n,r){if(!t){this.sendFrame(Pi.frame(e,n),r);return}let o=this._extensions[F2.extensionName];this._bufferedBytes+=n[Wr],this._state=fxe,o.compress(e,n.fin,(s,i)=>{if(this._socket.destroyed){let a=Error("The socket was closed while data was being compressed");TC(this,a,r);return}this._bufferedBytes-=n[Wr],this._state=wo,n.readOnly=!1,this.sendFrame(Pi.frame(i,n),r),this.dequeue()})}dequeue(){while(this._state===wo&&this._queue.length){let e=this._queue.shift();this._bufferedBytes-=e[3][Wr],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][Wr],this._queue.push(e)}sendFrame(e,t){if(e.length===2)this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork();else this._socket.write(e[0],t)}}z2.exports=Pi;function TC(e,t,n){if(typeof n==="function")n(t);for(let r=0;r<e._queue.length;r++){let o=e._queue[r],s=o[o.length-1];if(typeof s==="function")s(t)}}function hxe(e,t,n){TC(e,t,n),e.onerror(t)}});var Z2=T(function(LRt,q2){var{kForOnEventAttribute:qf,kListener:kC}=Cs(),j2=Symbol("kCode"),H2=Symbol("kData"),B2=Symbol("kError"),K2=Symbol("kMessage"),G2=Symbol("kReason"),vu=Symbol("kTarget"),W2=Symbol("kType"),V2=Symbol("kWasClean");class Ii{constructor(e){this[vu]=null,this[W2]=e}get target(){return this[vu]}get type(){return this[W2]}}Object.defineProperty(Ii.prototype,"target",{enumerable:!0});Object.defineProperty(Ii.prototype,"type",{enumerable:!0});class wu extends Ii{constructor(e,t={}){super(e);this[j2]=t.code===void 0?0:t.code,this[G2]=t.reason===void 0?"":t.reason,this[V2]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[j2]}get reason(){return this[G2]}get wasClean(){return this[V2]}}Object.defineProperty(wu.prototype,"code",{enumerable:!0});Object.defineProperty(wu.prototype,"reason",{enumerable:!0});Object.defineProperty(wu.prototype,"wasClean",{enumerable:!0});class Zf extends Ii{constructor(e,t={}){super(e);this[B2]=t.error===void 0?null:t.error,this[K2]=t.message===void 0?"":t.message}get error(){return this[B2]}get message(){return this[K2]}}Object.defineProperty(Zf.prototype,"error",{enumerable:!0});Object.defineProperty(Zf.prototype,"message",{enumerable:!0});class My extends Ii{constructor(e,t={}){super(e);this[H2]=t.data===void 0?null:t.data}get data(){return this[H2]}}Object.defineProperty(My.prototype,"data",{enumerable:!0});var gxe={addEventListener(e,t,n={}){for(let o of this.listeners(e))if(!n[qf]&&o[kC]===t&&!o[qf])return;let r;if(e==="message")r=function(s,i){let a=new My("message",{data:i?s:s.toString()});a[vu]=this,Ny(t,this,a)};else if(e==="close")r=function(s,i){let a=new wu("close",{code:s,reason:i.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[vu]=this,Ny(t,this,a)};else if(e==="error")r=function(s){let i=new Zf("error",{error:s,message:s.message});i[vu]=this,Ny(t,this,i)};else if(e==="open")r=function(){let s=new Ii("open");s[vu]=this,Ny(t,this,s)};else return;if(r[qf]=!!n[qf],r[kC]=t,n.once)this.once(e,r);else this.on(e,r)},removeEventListener(e,t){for(let n of this.listeners(e))if(n[kC]===t&&!n[qf]){this.removeListener(e,n);break}}};q2.exports={CloseEvent:wu,ErrorEvent:Zf,Event:Ii,EventTarget:gxe,MessageEvent:My};function Ny(e,t,n){if(typeof e==="object"&&e.handleEvent)e.handleEvent.call(e,n);else e.call(t,n)}});var Uy=T(function(NRt,Y2){var{tokenChars:Yf}=bu();function is(e,t,n){if(e[t]===void 0)e[t]=[n];else e[t].push(n)}function _xe(e){let t=Object.create(null),n=Object.create(null),r=!1,o=!1,s=!1,i,a,c=-1,l=-1,u=-1,p=0;for(;p<e.length;p++)if(l=e.charCodeAt(p),i===void 0)if(u===-1&&Yf[l]===1){if(c===-1)c=p}else if(p!==0&&(l===32||l===9)){if(u===-1&&c!==-1)u=p}else if(l===59||l===44){if(c===-1)throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1)u=p;let m=e.slice(c,u);if(l===44)is(t,m,n),n=Object.create(null);else i=m;c=u=-1}else throw SyntaxError(`Unexpected character at index ${p}`);else if(a===void 0)if(u===-1&&Yf[l]===1){if(c===-1)c=p}else if(l===32||l===9){if(u===-1&&c!==-1)u=p}else if(l===59||l===44){if(c===-1)throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1)u=p;if(is(n,e.slice(c,u),!0),l===44)is(t,i,n),n=Object.create(null),i=void 0;c=u=-1}else if(l===61&&c!==-1&&u===-1)a=e.slice(c,p),c=u=-1;else throw SyntaxError(`Unexpected character at index ${p}`);else if(o){if(Yf[l]!==1)throw SyntaxError(`Unexpected character at index ${p}`);if(c===-1)c=p;else if(!r)r=!0;o=!1}else if(s)if(Yf[l]===1){if(c===-1)c=p}else if(l===34&&c!==-1)s=!1,u=p;else if(l===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`);else if(l===34&&e.charCodeAt(p-1)===61)s=!0;else if(u===-1&&Yf[l]===1){if(c===-1)c=p}else if(c!==-1&&(l===32||l===9)){if(u===-1)u=p}else if(l===59||l===44){if(c===-1)throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1)u=p;let m=e.slice(c,u);if(r)m=m.replace(/\\/g,""),r=!1;if(is(n,a,m),l===44)is(t,i,n),n=Object.create(null),i=void 0;a=void 0,c=u=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(c===-1||s||l===32||l===9)throw SyntaxError("Unexpected end of input");if(u===-1)u=p;let f=e.slice(c,u);if(i===void 0)is(t,f,n);else{if(a===void 0)is(n,f,!0);else if(r)is(n,a,f.replace(/\\/g,""));else is(n,a,f);is(t,i,n)}return t}function yxe(e){return Object.keys(e).map((t)=>{let n=e[t];if(!Array.isArray(n))n=[n];return n.map((r)=>[t].concat(Object.keys(r).map((o)=>{let s=r[o];if(!Array.isArray(s))s=[s];return s.map((i)=>i===!0?o:`${o}=${i}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Y2.exports={format:yxe,parse:_xe}});var jy=T(function(FRt,cK){var Sxe=xe("events"),bxe=xe("https"),Exe=xe("http"),Q2=xe("net"),xxe=xe("tls"),{randomBytes:vxe,createHash:wxe}=xe("crypto"),{Duplex:MRt,Readable:URt}=xe("stream"),{URL:RC}=xe("url"),Di=Su(),Axe=AC(),Txe=CC(),{isBlob:Cxe}=bu(),{BINARY_TYPES:J2,CLOSE_TIMEOUT:kxe,EMPTY_BUFFER:Fy,GUID:Rxe,kForOnEventAttribute:OC,kListener:Oxe,kStatusCode:Pxe,kWebSocket:un,NOOP:eK}=Cs(),{EventTarget:{addEventListener:Ixe,removeEventListener:Dxe}}=Z2(),{format:Lxe,parse:Nxe}=Uy(),{toBuffer:Mxe}=Wf(),tK=Symbol("kAborted"),PC=[8,13],Rs=["CONNECTING","OPEN","CLOSING","CLOSED"],Uxe=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class we extends Sxe{constructor(e,t,n){super();if(this._binaryType=J2[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Fy,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=we.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null){if(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,t===void 0)t=[];else if(!Array.isArray(t))if(typeof t==="object"&&t!==null)n=t,t=[];else t=[t];nK(this,e,t,n)}else this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){if(!J2.includes(e))return;if(this._binaryType=e,this._receiver)this._receiver._binaryType=e}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,n){let r=new Axe({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:n.maxBufferedChunks,maxFragments:n.maxFragments,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),o=new Txe(e,this._extensions,n.generateMask);if(this._receiver=r,this._sender=o,this._socket=e,r[un]=this,o[un]=this,e[un]=this,r.on("conclude",zxe),r.on("drain",jxe),r.on("error",Hxe),r.on("message",Bxe),r.on("ping",Kxe),r.on("pong",Gxe),o.onerror=Wxe,e.setTimeout)e.setTimeout(0);if(e.setNoDelay)e.setNoDelay();if(t.length>0)e.unshift(t);e.on("close",sK),e.on("data",zy),e.on("end",iK),e.on("error",aK),this._readyState=we.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=we.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[Di.extensionName])this._extensions[Di.extensionName].cleanup();this._receiver.removeAllListeners(),this._readyState=we.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState===we.CLOSED)return;if(this.readyState===we.CONNECTING){Or(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===we.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted))this._socket.end();return}this._readyState=we.CLOSING,this._sender.close(e,t,!this._isServer,(n)=>{if(n)return;if(this._closeFrameSent=!0,this._closeFrameReceived||this._receiver._writableState.errorEmitted)this._socket.end()}),oK(this)}pause(){if(this.readyState===we.CONNECTING||this.readyState===we.CLOSED)return;this._paused=!0,this._socket.pause()}ping(e,t,n){if(this.readyState===we.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e==="function")n=e,e=t=void 0;else if(typeof t==="function")n=t,t=void 0;if(typeof e==="number")e=e.toString();if(this.readyState!==we.OPEN){IC(this,e,n);return}if(t===void 0)t=!this._isServer;this._sender.ping(e||Fy,t,n)}pong(e,t,n){if(this.readyState===we.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e==="function")n=e,e=t=void 0;else if(typeof t==="function")n=t,t=void 0;if(typeof e==="number")e=e.toString();if(this.readyState!==we.OPEN){IC(this,e,n);return}if(t===void 0)t=!this._isServer;this._sender.pong(e||Fy,t,n)}resume(){if(this.readyState===we.CONNECTING||this.readyState===we.CLOSED)return;if(this._paused=!1,!this._receiver._writableState.needDrain)this._socket.resume()}send(e,t,n){if(this.readyState===we.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t==="function")n=t,t={};if(typeof e==="number")e=e.toString();if(this.readyState!==we.OPEN){IC(this,e,n);return}let r={binary:typeof e!=="string",mask:!this._isServer,compress:!0,fin:!0,...t};if(!this._extensions[Di.extensionName])r.compress=!1;this._sender.send(e||Fy,r,n)}terminate(){if(this.readyState===we.CLOSED)return;if(this.readyState===we.CONNECTING){Or(this,this._req,"WebSocket was closed before the connection was established");return}if(this._socket)this._readyState=we.CLOSING,this._socket.destroy()}}Object.defineProperty(we,"CONNECTING",{enumerable:!0,value:Rs.indexOf("CONNECTING")});Object.defineProperty(we.prototype,"CONNECTING",{enumerable:!0,value:Rs.indexOf("CONNECTING")});Object.defineProperty(we,"OPEN",{enumerable:!0,value:Rs.indexOf("OPEN")});Object.defineProperty(we.prototype,"OPEN",{enumerable:!0,value:Rs.indexOf("OPEN")});Object.defineProperty(we,"CLOSING",{enumerable:!0,value:Rs.indexOf("CLOSING")});Object.defineProperty(we.prototype,"CLOSING",{enumerable:!0,value:Rs.indexOf("CLOSING")});Object.defineProperty(we,"CLOSED",{enumerable:!0,value:Rs.indexOf("CLOSED")});Object.defineProperty(we.prototype,"CLOSED",{enumerable:!0,value:Rs.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((e)=>{Object.defineProperty(we.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach((e)=>{Object.defineProperty(we.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[OC])return t[Oxe];return null},set(t){for(let n of this.listeners(e))if(n[OC]){this.removeListener(e,n);break}if(typeof t!=="function")return;this.addEventListener(e,t,{[OC]:!0})}})});we.prototype.addEventListener=Ixe;we.prototype.removeEventListener=Dxe;cK.exports=we;function nK(e,t,n,r){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:kxe,protocolVersion:PC[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!PC.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${PC.join(", ")})`);let s;if(t instanceof RC)s=t;else try{s=new RC(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}if(s.protocol==="http:")s.protocol="ws:";else if(s.protocol==="https:")s.protocol="wss:";e._url=s.href;let i=s.protocol==="wss:",a=s.protocol==="ws+unix:",c;if(s.protocol!=="ws:"&&!i&&!a)c=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;else if(a&&!s.pathname)c="The URL's pathname is empty";else if(s.hash)c="The URL contains a fragment identifier";if(c){let y=SyntaxError(c);if(e._redirects===0)throw y;else{$y(e,y);return}}let l=i?443:80,u=vxe(16).toString("base64"),p=i?bxe.request:Exe.request,f=new Set,m;if(o.createConnection=o.createConnection||(i?$xe:Fxe),o.defaultPort=o.defaultPort||l,o.port=s.port||l,o.host=s.hostname.startsWith("[")?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":u,Connection:"Upgrade",Upgrade:"websocket"},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate)m=new Di({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=Lxe({[Di.extensionName]:m.offer()});if(n.length){for(let y of n){if(typeof y!=="string"||!Uxe.test(y)||f.has(y))throw SyntaxError("An invalid or duplicated subprotocol was specified");f.add(y)}o.headers["Sec-WebSocket-Protocol"]=n.join(",")}if(o.origin)if(o.protocolVersion<13)o.headers["Sec-WebSocket-Origin"]=o.origin;else o.headers.Origin=o.origin;if(s.username||s.password)o.auth=`${s.username}:${s.password}`;if(a){let y=o.path.split(":");o.socketPath=y[0],o.path=y[1]}let h;if(o.followRedirects){if(e._redirects===0){e._originalIpc=a,e._originalSecure=i,e._originalHostOrSocketPath=a?o.socketPath:s.host;let y=r&&r.headers;if(r={...r,headers:{}},y)for(let[_,E]of Object.entries(y))r.headers[_.toLowerCase()]=E}else if(e.listenerCount("redirect")===0){let y=a?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:s.host===e._originalHostOrSocketPath;if(!y||e._originalSecure&&!i){if(delete o.headers.authorization,delete o.headers.cookie,!y)delete o.headers.host;o.auth=void 0}}if(o.auth&&!r.headers.authorization)r.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64");if(h=e._req=p(o),e._redirects)e.emit("redirect",e.url,h)}else h=e._req=p(o);if(o.timeout)h.on("timeout",()=>{Or(e,h,"Opening handshake has timed out")});if(h.on("error",(y)=>{if(h===null||h[tK])return;h=e._req=null,$y(e,y)}),h.on("response",(y)=>{let _=y.headers.location,E=y.statusCode;if(_&&o.followRedirects&&E>=300&&E<400){if(++e._redirects>o.maxRedirects){Or(e,h,"Maximum redirects exceeded");return}h.abort();let S;try{S=new RC(_,t)}catch(x){let v=SyntaxError(`Invalid URL: ${_}`);$y(e,v);return}nK(e,S,n,r)}else if(!e.emit("unexpected-response",h,y))Or(e,h,`Unexpected server response: ${y.statusCode}`)}),h.on("upgrade",(y,_,E)=>{if(e.emit("upgrade",y),e.readyState!==we.CONNECTING)return;h=e._req=null;let S=y.headers.upgrade;if(S===void 0||S.toLowerCase()!=="websocket"){Or(e,_,"Invalid Upgrade header");return}let x=wxe("sha1").update(u+Rxe).digest("base64");if(y.headers["sec-websocket-accept"]!==x){Or(e,_,"Invalid Sec-WebSocket-Accept header");return}let v=y.headers["sec-websocket-protocol"],w;if(v!==void 0){if(!f.size)w="Server sent a subprotocol but none was requested";else if(!f.has(v))w="Server sent an invalid subprotocol"}else if(f.size)w="Server sent no subprotocol";if(w){Or(e,_,w);return}if(v)e._protocol=v;let U=y.headers["sec-websocket-extensions"];if(U!==void 0){if(!m){Or(e,_,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let L;try{L=Nxe(U)}catch(K){Or(e,_,"Invalid Sec-WebSocket-Extensions header");return}let F=Object.keys(L);if(F.length!==1||F[0]!==Di.extensionName){Or(e,_,"Server indicated an extension that was not requested");return}try{m.accept(L[Di.extensionName])}catch(K){Or(e,_,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[Di.extensionName]=m}e.setSocket(_,E,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest)o.finishRequest(h,e);else h.end()}function $y(e,t){e._readyState=we.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function Fxe(e){return e.path=e.socketPath,Q2.connect(e)}function $xe(e){if(e.path=void 0,!e.servername&&e.servername!=="")e.servername=Q2.isIP(e.host)?"":e.host;return xxe.connect(e)}function Or(e,t,n){e._readyState=we.CLOSING;let r=Error(n);if(Error.captureStackTrace(r,Or),t.setHeader){if(t[tK]=!0,t.abort(),t.socket&&!t.socket.destroyed)t.socket.destroy();process.nextTick($y,e,r)}else t.destroy(r),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e))}function IC(e,t,n){if(t){let r=Cxe(t)?t.size:Mxe(t).length;if(e._socket)e._sender._bufferedBytes+=r;else e._bufferedAmount+=r}if(n){let r=Error(`WebSocket is not open: readyState ${e.readyState} (${Rs[e.readyState]})`);process.nextTick(n,r)}}function zxe(e,t){let n=this[un];if(n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[un]===void 0)return;if(n._socket.removeListener("data",zy),process.nextTick(rK,n._socket),e===1005)n.close();else n.close(e,t)}function jxe(){let e=this[un];if(!e.isPaused)e._socket.resume()}function Hxe(e){let t=this[un];if(t._socket[un]!==void 0)t._socket.removeListener("data",zy),process.nextTick(rK,t._socket),t.close(e[Pxe]);if(!t._errorEmitted)t._errorEmitted=!0,t.emit("error",e)}function X2(){this[un].emitClose()}function Bxe(e,t){this[un].emit("message",e,t)}function Kxe(e){let t=this[un];if(t._autoPong)t.pong(e,!this._isServer,eK);t.emit("ping",e)}function Gxe(e){this[un].emit("pong",e)}function rK(e){e.resume()}function Wxe(e){let t=this[un];if(t.readyState===we.CLOSED)return;if(t.readyState===we.OPEN)t._readyState=we.CLOSING,oK(t);if(this._socket.end(),!t._errorEmitted)t._errorEmitted=!0,t.emit("error",e)}function oK(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function sK(){let e=this[un];if(this.removeListener("close",sK),this.removeListener("data",zy),this.removeListener("end",iK),e._readyState=we.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}if(e._receiver.end(),this[un]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted)e.emitClose();else e._receiver.on("error",X2),e._receiver.on("finish",X2)}function zy(e){if(!this[un]._receiver.write(e))this.pause()}function iK(){let e=this[un];e._readyState=we.CLOSING,e._receiver.end(),this.end()}function aK(){let e=this[un];if(this.removeListener("error",aK),this.on("error",eK),e)e._readyState=we.CLOSING,this.destroy()}});var pK=T(function(zRt,dK){var $Rt=jy(),{Duplex:Vxe}=xe("stream");function lK(e){e.emit("close")}function qxe(){if(!this.destroyed&&this._writableState.finished)this.destroy()}function uK(e){if(this.removeListener("error",uK),this.destroy(),this.listenerCount("error")===0)this.emit("error",e)}function Zxe(e,t){let n=!0,r=new Vxe({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(s,i){let a=!i&&r._readableState.objectMode?s.toString():s;if(!r.push(a))e.pause()}),e.once("error",function(s){if(r.destroyed)return;n=!1,r.destroy(s)}),e.once("close",function(){if(r.destroyed)return;r.push(null)}),r._destroy=function(o,s){if(e.readyState===e.CLOSED){s(o),process.nextTick(lK,r);return}let i=!1;if(e.once("error",function(c){i=!0,s(c)}),e.once("close",function(){if(!i)s(o);process.nextTick(lK,r)}),n)e.terminate()},r._final=function(o){if(e.readyState===e.CONNECTING){e.once("open",function(){r._final(o)});return}if(e._socket===null)return;if(e._socket._writableState.finished){if(o(),r._readableState.endEmitted)r.destroy()}else e._socket.once("finish",function(){o()}),e.close()},r._read=function(){if(e.isPaused)e.resume()},r._write=function(o,s,i){if(e.readyState===e.CONNECTING){e.once("open",function(){r._write(o,s,i)});return}e.send(o,i)},r.on("end",qxe),r.on("error",uK),r}dK.exports=Zxe});var DC=T(function(jRt,fK){var{tokenChars:Yxe}=bu();function Jxe(e){let t=new Set,n=-1,r=-1,o=0;for(o;o<e.length;o++){let i=e.charCodeAt(o);if(r===-1&&Yxe[i]===1){if(n===-1)n=o}else if(o!==0&&(i===32||i===9)){if(r===-1&&n!==-1)r=o}else if(i===44){if(n===-1)throw SyntaxError(`Unexpected character at index ${o}`);if(r===-1)r=o;let a=e.slice(n,r);if(t.has(a))throw SyntaxError(`The "${a}" subprotocol is duplicated`);t.add(a),n=r=-1}else throw SyntaxError(`Unexpected character at index ${o}`)}if(n===-1||r!==-1)throw SyntaxError("Unexpected end of input");let s=e.slice(n,o);if(t.has(s))throw SyntaxError(`The "${s}" subprotocol is duplicated`);return t.add(s),t}fK.exports={parse:Jxe}});var yK=T(function(BRt,_K){var Xxe=xe("events"),Hy=xe("http"),{Duplex:HRt}=xe("stream"),{createHash:Qxe}=xe("crypto"),mK=Uy(),Ja=Su(),eve=DC(),tve=jy(),{CLOSE_TIMEOUT:nve,GUID:rve,kWebSocket:ove}=Cs(),sve=/^[+/0-9A-Za-z]{22}==$/;class gK extends Xxe{constructor(e,t){super();if(e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:nve,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:tve,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null)this._server=Hy.createServer((n,r)=>{let o=Hy.STATUS_CODES[426];r.writeHead(426,{"Content-Length":o.length,"Content-Type":"text/plain"}),r.end(o)}),this._server.listen(e.port,e.host,e.backlog,t);else if(e.server)this._server=e.server;if(this._server){let n=this.emit.bind(this,"connection");this._removeListeners=ive(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(r,o,s)=>{this.handleUpgrade(r,o,s,n)}})}if(e.perMessageDeflate===!0)e.perMessageDeflate={};if(e.clientTracking)this.clients=new Set,this._shouldEmitClose=!1;this.options=e,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');if(!this._server)return null;return this._server.address()}close(e){if(this._state===2){if(e)this.once("close",()=>{e(Error("The server is not running"))});process.nextTick(Jf,this);return}if(e)this.once("close",e);if(this._state===1)return;if(this._state=1,this.options.noServer||this.options.server){if(this._server)this._removeListeners(),this._removeListeners=this._server=null;if(this.clients)if(!this.clients.size)process.nextTick(Jf,this);else this._shouldEmitClose=!0;else process.nextTick(Jf,this)}else{let t=this._server;this._removeListeners(),this._removeListeners=this._server=null,t.close(()=>{Jf(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((t!==-1?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on("error",hK);let o=e.headers["sec-websocket-key"],s=e.headers.upgrade,i=+e.headers["sec-websocket-version"];if(e.method!=="GET"){Xa(this,e,t,405,"Invalid HTTP method");return}if(s===void 0||s.toLowerCase()!=="websocket"){Xa(this,e,t,400,"Invalid Upgrade header");return}if(o===void 0||!sve.test(o)){Xa(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");return}if(i!==13&&i!==8){Xa(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Xf(t,400);return}let a=e.headers["sec-websocket-protocol"],c=new Set;if(a!==void 0)try{c=eve.parse(a)}catch(p){Xa(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let l=e.headers["sec-websocket-extensions"],u={};if(this.options.perMessageDeflate&&l!==void 0){let p=new Ja({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let f=mK.parse(l);if(f[Ja.extensionName])p.accept(f[Ja.extensionName]),u[Ja.extensionName]=p}catch(f){Xa(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let p={origin:e.headers[`${i===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(p,(f,m,h,y)=>{if(!f)return Xf(t,m||401,h,y);this.completeUpgrade(u,o,c,e,t,n,r)});return}if(!this.options.verifyClient(p))return Xf(t,401)}this.completeUpgrade(u,o,c,e,t,n,r)}completeUpgrade(e,t,n,r,o,s,i){if(!o.readable||!o.writable)return o.destroy();if(o[ove])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return Xf(o,503);let c=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Qxe("sha1").update(t+rve).digest("base64")}`],l=new this.options.WebSocket(null,void 0,this.options);if(n.size){let u=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;if(u)c.push(`Sec-WebSocket-Protocol: ${u}`),l._protocol=u}if(e[Ja.extensionName]){let u=e[Ja.extensionName].params,p=mK.format({[Ja.extensionName]:[u]});c.push(`Sec-WebSocket-Extensions: ${p}`),l._extensions=e}if(this.emit("headers",c,r),o.write(c.concat(`\r
79
+ `).join(`\r
80
+ `)),o.removeListener("error",hK),l.setSocket(o,s,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients)this.clients.add(l),l.on("close",()=>{if(this.clients.delete(l),this._shouldEmitClose&&!this.clients.size)process.nextTick(Jf,this)});i(l,r)}}_K.exports=gK;function ive(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return function(){for(let r of Object.keys(t))e.removeListener(r,t[r])}}function Jf(e){e._state=2,e.emit("close")}function hK(){this.destroy()}function Xf(e,t,n,r){n=n||Hy.STATUS_CODES[t],r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(n),...r},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${Hy.STATUS_CODES[t]}\r
81
+ `+Object.keys(r).map((o)=>`${o}: ${r[o]}`).join(`\r
82
+ `)+`\r
83
+ \r
84
+ `+n)}function Xa(e,t,n,r,o,s){if(e.listenerCount("wsClientError")){let i=Error(o);Error.captureStackTrace(i,Xa),e.emit("wsClientError",i,n,t)}else Xf(n,r,o,s)}});var ave,cve,lve,uve,dve,pve,fve,mve;var SK=O(()=>{ave=Wn(pK(),1),cve=Wn(Uy(),1),lve=Wn(Su(),1),uve=Wn(AC(),1),dve=Wn(CC(),1),pve=Wn(DC(),1),fve=Wn(jy(),1),mve=Wn(yK(),1)});function bK(e){return hve.has(e)||gve.test(e)}var hve,gve;var EK=O(()=>{hve=new Set(["localhost","::1","[::1]"]),gve=/^127(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$/});function _ve(){return Oe(process.env.CLAUDE_CODE_TEST_ALLOW_REAL_NETWORK)}function xK(e,t){return`[CLAUDE_CODE_TEST_ALLOW_REAL_NETWORK] live request from a test runtime: ${e} ${t}
85
+ `}function vK(e){let t;try{t=bK(new URL(e).hostname)}catch{t=!1}if(t)return"loopback";return _ve()?"opted-in":"refused"}function LC(e,t){return`Blocked under test: ${e} ${t} — test runtimes must not reach the network. `+"Run the file via `bun run test:file -- <path>` with this request mocked, or set CLAUDE_CODE_TEST_ALLOW_REAL_NETWORK=1 for an intentional live probe."}function wK(e){let t=Rr.getUri(e),n=(e.method??"get").toUpperCase();switch(vK(t)){case"loopback":return yve(e,n);case"opted-in":return process.stderr.write(xK(n,t)),e;case"refused":throw new NC(LC(n,t))}}function yve(e,t){let n=e.beforeRedirect;return e.beforeRedirect=(r,o)=>{let s=typeof r.href==="string"?r.href:"";switch(vK(s)){case"loopback":break;case"opted-in":process.stderr.write(xK(t,s));break;case"refused":throw process.stderr.write(`${LC(t,s)}
86
+ `),new NC(LC(t,s))}n?.(r,o)},e}function Sve(){if(!bve())Rr.interceptors.request.use(wK)}function bve(){return Rr.interceptors.request.handlers?.some((e)=>e?.fulfilled===wK)??!1}function Qa(){return}var NC,JRt;var AK=O(()=>{Zc();Ry();SK();EK();NC=class NC extends Error{name="TestEgressBlockedError";code="TestEgressBlocked"};JRt=globalThis.fetch});var TK={};on(TK,{externalHttp:()=>vve,isAxiosError:()=>ky,isCancel:()=>h2,isTransportError:()=>xve});function xve(e){return ky(e)&&e.response===void 0&&!Eve.has(e.code??"")}function Au(e,t){for(let n of[e,t?.baseURL])if(n&&g2(n))throw Error(`externalHttp: ${n} is Anthropic-operated. Use firstPartyApi from `+"src/services/http/firstParty — it enforces the 3P data-residency gate.")}var Eve,vve;var CK=O(()=>{Ry();_2();AK();Ry();Eve=new Set(["ERR_BAD_OPTION","ERR_BAD_OPTION_VALUE","ERR_BAD_REQUEST","ERR_BAD_RESPONSE","ERR_CANCELED","ERR_DEPRECATED","ERR_FORM_DATA_DEPTH_EXCEEDED","ERR_FR_MAX_BODY_LENGTH_EXCEEDED","ERR_FR_TOO_MANY_REDIRECTS","ERR_INVALID_URL","ERR_NOT_SUPPORT","ERR_STREAM_WRITE_AFTER_END"]);vve={get(e,t){return Au(e,t),Qa(),Rr.get(e,t)},head(e,t){return Au(e,t),Qa(),Rr.head(e,t)},post(e,t,n){return Au(e,n),Qa(),Rr.post(e,t,n)},put(e,t,n){return Au(e,n),Qa(),Rr.put(e,t,n)},patch(e,t,n){return Au(e,n),Qa(),Rr.patch(e,t,n)},delete(e,t){return Au(e,t),Qa(),Rr.delete(e,t)}}});var XK=T(function(YK){Object.defineProperty(YK,"__esModule",{value:!0});YK._globalThis=void 0;YK._globalThis=typeof globalThis==="object"?globalThis:global});var QK=T(function(ec){var d$e=ec&&ec.__createBinding||(Object.create?function(e,t,n,r){if(r===void 0)r=n;Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){if(r===void 0)r=n;e[r]=t[n]}),p$e=ec&&ec.__exportStar||function(e,t){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n))d$e(t,e,n)};Object.defineProperty(ec,"__esModule",{value:!0});p$e(XK(),ec)});var eG=T(function(tc){var f$e=tc&&tc.__createBinding||(Object.create?function(e,t,n,r){if(r===void 0)r=n;Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){if(r===void 0)r=n;e[r]=t[n]}),m$e=tc&&tc.__exportStar||function(e,t){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n))f$e(t,e,n)};Object.defineProperty(tc,"__esModule",{value:!0});m$e(QK(),tc)});var QC=T(function(tG){Object.defineProperty(tG,"__esModule",{value:!0});tG.VERSION=void 0;tG.VERSION="1.9.0"});var aG=T(function(sG){Object.defineProperty(sG,"__esModule",{value:!0});sG.isCompatible=sG._makeCompatibilityCheck=void 0;var h$e=QC(),rG=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function oG(e){let t=new Set([e]),n=new Set,r=e.match(rG);if(!r)return()=>!1;let o={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(o.prerelease!=null)return function(c){return c===e};function s(a){return n.add(a),!1}function i(a){return t.add(a),!0}return function(c){if(t.has(c))return!0;if(n.has(c))return!1;let l=c.match(rG);if(!l)return s(c);let u={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};if(u.prerelease!=null)return s(c);if(o.major!==u.major)return s(c);if(o.major===0){if(o.minor===u.minor&&o.patch<=u.patch)return i(c);return s(c)}if(o.minor<=u.minor)return i(c);return s(c)}}sG._makeCompatibilityCheck=oG;sG.isCompatible=oG(h$e.VERSION)});var nc=T(function(cG){Object.defineProperty(cG,"__esModule",{value:!0});cG.unregisterGlobal=cG.getGlobal=cG.registerGlobal=void 0;var _$e=eG(),Pu=QC(),y$e=aG(),S$e=Pu.VERSION.split(".")[0],om=Symbol.for(`opentelemetry.js.api.${S$e}`),sm=_$e._globalThis;function b$e(e,t,n,r=!1){var o;let s=sm[om]=(o=sm[om])!==null&&o!==void 0?o:{version:Pu.VERSION};if(!r&&s[e]){let i=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(i.stack||i.message),!1}if(s.version!==Pu.VERSION){let i=Error(`@opentelemetry/api: Registration of version v${s.version} for ${e} does not match previously registered API v${Pu.VERSION}`);return n.error(i.stack||i.message),!1}return s[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${Pu.VERSION}.`),!0}cG.registerGlobal=b$e;function E$e(e){var t,n;let r=(t=sm[om])===null||t===void 0?void 0:t.version;if(!r||!(0,y$e.isCompatible)(r))return;return(n=sm[om])===null||n===void 0?void 0:n[e]}cG.getGlobal=E$e;function x$e(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${Pu.VERSION}.`);let n=sm[om];if(n)delete n[e]}cG.unregisterGlobal=x$e});var fG=T(function(dG){Object.defineProperty(dG,"__esModule",{value:!0});dG.DiagComponentLogger=void 0;var A$e=nc();class uG{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return im("debug",this._namespace,e)}error(...e){return im("error",this._namespace,e)}info(...e){return im("info",this._namespace,e)}warn(...e){return im("warn",this._namespace,e)}verbose(...e){return im("verbose",this._namespace,e)}}dG.DiagComponentLogger=uG;function im(e,t,n){let r=(0,A$e.getGlobal)("diag");if(!r)return;return n.unshift(t),r[e](...n)}});var Vy=T(function(mG){Object.defineProperty(mG,"__esModule",{value:!0});mG.DiagLogLevel=void 0;var T$e;(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"})(T$e=mG.DiagLogLevel||(mG.DiagLogLevel={}))});var _G=T(function(hG){Object.defineProperty(hG,"__esModule",{value:!0});hG.createLogLevelDiagLogger=void 0;var Os=Vy();function C$e(e,t){if(e<Os.DiagLogLevel.NONE)e=Os.DiagLogLevel.NONE;else if(e>Os.DiagLogLevel.ALL)e=Os.DiagLogLevel.ALL;t=t||{};function n(r,o){let s=t[r];if(typeof s==="function"&&e>=o)return s.bind(t);return function(){}}return{error:n("error",Os.DiagLogLevel.ERROR),warn:n("warn",Os.DiagLogLevel.WARN),info:n("info",Os.DiagLogLevel.INFO),debug:n("debug",Os.DiagLogLevel.DEBUG),verbose:n("verbose",Os.DiagLogLevel.VERBOSE)}}hG.createLogLevelDiagLogger=C$e});var rc=T(function(SG){Object.defineProperty(SG,"__esModule",{value:!0});SG.DiagAPI=void 0;var k$e=fG(),R$e=_G(),yG=Vy(),qy=nc(),O$e="diag";class tk{constructor(){function e(r){return function(...o){let s=(0,qy.getGlobal)("diag");if(!s)return;return s[r](...o)}}let t=this,n=(r,o={logLevel:yG.DiagLogLevel.INFO})=>{var s,i,a;if(r===t){let u=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error((s=u.stack)!==null&&s!==void 0?s:u.message),!1}if(typeof o==="number")o={logLevel:o};let c=(0,qy.getGlobal)("diag"),l=(0,R$e.createLogLevelDiagLogger)((i=o.logLevel)!==null&&i!==void 0?i:yG.DiagLogLevel.INFO,r);if(c&&!o.suppressOverrideMessage){let u=(a=Error().stack)!==null&&a!==void 0?a:"<failed to generate stacktrace>";c.warn(`Current logger will be overwritten from ${u}`),l.warn(`Current logger will overwrite one already registered from ${u}`)}return(0,qy.registerGlobal)("diag",l,t,!0)};t.setLogger=n,t.disable=()=>{(0,qy.unregisterGlobal)(O$e,t)},t.createComponentLogger=(r)=>new k$e.DiagComponentLogger(r),t.verbose=e("verbose"),t.debug=e("debug"),t.info=e("info"),t.warn=e("warn"),t.error=e("error")}static instance(){if(!this._instance)this._instance=new tk;return this._instance}}SG.DiagAPI=tk});var vG=T(function(EG){Object.defineProperty(EG,"__esModule",{value:!0});EG.BaggageImpl=void 0;class Iu{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(!t)return;return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries()).map(([e,t])=>[e,t])}setEntry(e,t){let n=new Iu(this._entries);return n._entries.set(e,t),n}removeEntry(e){let t=new Iu(this._entries);return t._entries.delete(e),t}removeEntries(...e){let t=new Iu(this._entries);for(let n of e)t._entries.delete(n);return t}clear(){return new Iu}}EG.BaggageImpl=Iu});var TG=T(function(wG){Object.defineProperty(wG,"__esModule",{value:!0});wG.baggageEntryMetadataSymbol=void 0;wG.baggageEntryMetadataSymbol=Symbol("BaggageEntryMetadata")});var nk=T(function(CG){Object.defineProperty(CG,"__esModule",{value:!0});CG.baggageEntryMetadataFromString=CG.createBaggage=void 0;var P$e=rc(),I$e=vG(),D$e=TG(),L$e=P$e.DiagAPI.instance();function N$e(e={}){return new I$e.BaggageImpl(new Map(Object.entries(e)))}CG.createBaggage=N$e;function M$e(e){if(typeof e!=="string")L$e.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e="";return{__TYPE__:D$e.baggageEntryMetadataSymbol,toString(){return e}}}CG.baggageEntryMetadataFromString=M$e});var am=T(function(RG){Object.defineProperty(RG,"__esModule",{value:!0});RG.ROOT_CONTEXT=RG.createContextKey=void 0;function F$e(e){return Symbol.for(e)}RG.createContextKey=F$e;class Zy{constructor(e){let t=this;t._currentContext=e?new Map(e):new Map,t.getValue=(n)=>t._currentContext.get(n),t.setValue=(n,r)=>{let o=new Zy(t._currentContext);return o._currentContext.set(n,r),o},t.deleteValue=(n)=>{let r=new Zy(t._currentContext);return r._currentContext.delete(n),r}}}RG.ROOT_CONTEXT=new Zy});var LG=T(function(IG){Object.defineProperty(IG,"__esModule",{value:!0});IG.DiagConsoleLogger=void 0;var rk=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}];class PG{constructor(){function e(t){return function(...n){if(console){let r=console[t];if(typeof r!=="function")r=console.log;if(typeof r==="function")return r.apply(console,n)}}}for(let t=0;t<rk.length;t++)this[rk[t].n]=e(rk[t].c)}}IG.DiagConsoleLogger=PG});var pk=T(function(NG){Object.defineProperty(NG,"__esModule",{value:!0});NG.createNoopMeter=NG.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=NG.NOOP_OBSERVABLE_GAUGE_METRIC=NG.NOOP_OBSERVABLE_COUNTER_METRIC=NG.NOOP_UP_DOWN_COUNTER_METRIC=NG.NOOP_HISTOGRAM_METRIC=NG.NOOP_GAUGE_METRIC=NG.NOOP_COUNTER_METRIC=NG.NOOP_METER=NG.NoopObservableUpDownCounterMetric=NG.NoopObservableGaugeMetric=NG.NoopObservableCounterMetric=NG.NoopObservableMetric=NG.NoopHistogramMetric=NG.NoopGaugeMetric=NG.NoopUpDownCounterMetric=NG.NoopCounterMetric=NG.NoopMetric=NG.NoopMeter=void 0;class ok{constructor(){}createGauge(e,t){return NG.NOOP_GAUGE_METRIC}createHistogram(e,t){return NG.NOOP_HISTOGRAM_METRIC}createCounter(e,t){return NG.NOOP_COUNTER_METRIC}createUpDownCounter(e,t){return NG.NOOP_UP_DOWN_COUNTER_METRIC}createObservableGauge(e,t){return NG.NOOP_OBSERVABLE_GAUGE_METRIC}createObservableCounter(e,t){return NG.NOOP_OBSERVABLE_COUNTER_METRIC}createObservableUpDownCounter(e,t){return NG.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}}NG.NoopMeter=ok;class Du{}NG.NoopMetric=Du;class sk extends Du{add(e,t){}}NG.NoopCounterMetric=sk;class ik extends Du{add(e,t){}}NG.NoopUpDownCounterMetric=ik;class ak extends Du{record(e,t){}}NG.NoopGaugeMetric=ak;class ck extends Du{record(e,t){}}NG.NoopHistogramMetric=ck;class cm{addCallback(e){}removeCallback(e){}}NG.NoopObservableMetric=cm;class lk extends cm{}NG.NoopObservableCounterMetric=lk;class uk extends cm{}NG.NoopObservableGaugeMetric=uk;class dk extends cm{}NG.NoopObservableUpDownCounterMetric=dk;NG.NOOP_METER=new ok;NG.NOOP_COUNTER_METRIC=new sk;NG.NOOP_GAUGE_METRIC=new ak;NG.NOOP_HISTOGRAM_METRIC=new ck;NG.NOOP_UP_DOWN_COUNTER_METRIC=new ik;NG.NOOP_OBSERVABLE_COUNTER_METRIC=new lk;NG.NOOP_OBSERVABLE_GAUGE_METRIC=new uk;NG.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=new dk;function z$e(){return NG.NOOP_METER}NG.createNoopMeter=z$e});var WG=T(function(GG){Object.defineProperty(GG,"__esModule",{value:!0});GG.ValueType=void 0;var J$e;(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(J$e=GG.ValueType||(GG.ValueType={}))});var mk=T(function(VG){Object.defineProperty(VG,"__esModule",{value:!0});VG.defaultTextMapSetter=VG.defaultTextMapGetter=void 0;VG.defaultTextMapGetter={get(e,t){if(e==null)return;return e[t]},keys(e){if(e==null)return[];return Object.keys(e)}};VG.defaultTextMapSetter={set(e,t,n){if(e==null)return;e[t]=n}}});var XG=T(function(YG){Object.defineProperty(YG,"__esModule",{value:!0});YG.NoopContextManager=void 0;var Q$e=am();class ZG{active(){return Q$e.ROOT_CONTEXT}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}YG.NoopContextManager=ZG});var lm=T(function(eW){Object.defineProperty(eW,"__esModule",{value:!0});eW.ContextAPI=void 0;var eze=XG(),hk=nc(),QG=rc(),gk="context",tze=new eze.NoopContextManager;class _k{constructor(){}static getInstance(){if(!this._instance)this._instance=new _k;return this._instance}setGlobalContextManager(e){return(0,hk.registerGlobal)(gk,e,QG.DiagAPI.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return(0,hk.getGlobal)(gk)||tze}disable(){this._getContextManager().disable(),(0,hk.unregisterGlobal)(gk,QG.DiagAPI.instance())}}eW.ContextAPI=_k});var Sk=T(function(nW){Object.defineProperty(nW,"__esModule",{value:!0});nW.TraceFlags=void 0;var nze;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(nze=nW.TraceFlags||(nW.TraceFlags={}))});var Yy=T(function(rW){Object.defineProperty(rW,"__esModule",{value:!0});rW.INVALID_SPAN_CONTEXT=rW.INVALID_TRACEID=rW.INVALID_SPANID=void 0;var rze=Sk();rW.INVALID_SPANID="0000000000000000";rW.INVALID_TRACEID="00000000000000000000000000000000";rW.INVALID_SPAN_CONTEXT={traceId:rW.INVALID_TRACEID,spanId:rW.INVALID_SPANID,traceFlags:rze.TraceFlags.NONE}});var Jy=T(function(cW){Object.defineProperty(cW,"__esModule",{value:!0});cW.NonRecordingSpan=void 0;var oze=Yy();class aW{constructor(e=oze.INVALID_SPAN_CONTEXT){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}cW.NonRecordingSpan=aW});var xk=T(function(dW){Object.defineProperty(dW,"__esModule",{value:!0});dW.getSpanContext=dW.setSpanContext=dW.deleteSpan=dW.setSpan=dW.getActiveSpan=dW.getSpan=void 0;var sze=am(),ize=Jy(),aze=lm(),bk=(0,sze.createContextKey)("OpenTelemetry Context Key SPAN");function Ek(e){return e.getValue(bk)||void 0}dW.getSpan=Ek;function cze(){return Ek(aze.ContextAPI.getInstance().active())}dW.getActiveSpan=cze;function uW(e,t){return e.setValue(bk,t)}dW.setSpan=uW;function lze(e){return e.deleteValue(bk)}dW.deleteSpan=lze;function uze(e,t){return uW(e,new ize.NonRecordingSpan(t))}dW.setSpanContext=uze;function dze(e){var t;return(t=Ek(e))===null||t===void 0?void 0:t.spanContext()}dW.getSpanContext=dze});var Xy=T(function(gW){Object.defineProperty(gW,"__esModule",{value:!0});gW.wrapSpanContext=gW.isSpanContextValid=gW.isValidSpanId=gW.isValidTraceId=void 0;var fW=Yy(),_ze=Jy(),yze=/^([0-9a-f]{32})$/i,Sze=/^[0-9a-f]{16}$/i;function mW(e){return yze.test(e)&&e!==fW.INVALID_TRACEID}gW.isValidTraceId=mW;function hW(e){return Sze.test(e)&&e!==fW.INVALID_SPANID}gW.isValidSpanId=hW;function bze(e){return mW(e.traceId)&&hW(e.spanId)}gW.isSpanContextValid=bze;function Eze(e){return new _ze.NonRecordingSpan(e)}gW.wrapSpanContext=Eze});var Ak=T(function(bW){Object.defineProperty(bW,"__esModule",{value:!0});bW.NoopTracer=void 0;var Aze=lm(),yW=xk(),vk=Jy(),Tze=Xy(),wk=Aze.ContextAPI.getInstance();class SW{startSpan(e,t,n=wk.active()){if(Boolean(t===null||t===void 0?void 0:t.root))return new vk.NonRecordingSpan;let o=n&&(0,yW.getSpanContext)(n);if(Cze(o)&&(0,Tze.isSpanContextValid)(o))return new vk.NonRecordingSpan(o);else return new vk.NonRecordingSpan}startActiveSpan(e,t,n,r){let o,s,i;if(arguments.length<2)return;else if(arguments.length===2)i=t;else if(arguments.length===3)o=t,i=n;else o=t,s=n,i=r;let a=s!==null&&s!==void 0?s:wk.active(),c=this.startSpan(e,o,a),l=(0,yW.setSpan)(a,c);return wk.with(l,i,void 0,c)}}bW.NoopTracer=SW;function Cze(e){return typeof e==="object"&&typeof e.spanId==="string"&&typeof e.traceId==="string"&&typeof e.traceFlags==="number"}});var Tk=T(function(vW){Object.defineProperty(vW,"__esModule",{value:!0});vW.ProxyTracer=void 0;var kze=Ak(),Rze=new kze.NoopTracer;class xW{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);if(!e)return Rze;return this._delegate=e,this._delegate}}vW.ProxyTracer=xW});var kW=T(function(TW){Object.defineProperty(TW,"__esModule",{value:!0});TW.NoopTracerProvider=void 0;var Oze=Ak();class AW{getTracer(e,t,n){return new Oze.NoopTracer}}TW.NoopTracerProvider=AW});var Ck=T(function(OW){Object.defineProperty(OW,"__esModule",{value:!0});OW.ProxyTracerProvider=void 0;var Pze=Tk(),Ize=kW(),Dze=new Ize.NoopTracerProvider;class RW{getTracer(e,t,n){var r;return(r=this.getDelegateTracer(e,t,n))!==null&&r!==void 0?r:new Pze.ProxyTracer(this,e,t,n)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Dze}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){var r;return(r=this._delegate)===null||r===void 0?void 0:r.getTracer(e,t,n)}}OW.ProxyTracerProvider=RW});var DW=T(function(IW){Object.defineProperty(IW,"__esModule",{value:!0});IW.SamplingDecision=void 0;var Lze;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(Lze=IW.SamplingDecision||(IW.SamplingDecision={}))});var NW=T(function(LW){Object.defineProperty(LW,"__esModule",{value:!0});LW.SpanKind=void 0;var Nze;(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"})(Nze=LW.SpanKind||(LW.SpanKind={}))});var UW=T(function(MW){Object.defineProperty(MW,"__esModule",{value:!0});MW.SpanStatusCode=void 0;var Mze;(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(Mze=MW.SpanStatusCode||(MW.SpanStatusCode={}))});var zW=T(function(FW){Object.defineProperty(FW,"__esModule",{value:!0});FW.validateValue=FW.validateKey=void 0;var Pk="[_0-9a-z-*/]",Uze=`[a-z]${Pk}{0,255}`,Fze=`[a-z0-9]${Pk}{0,240}@[a-z]${Pk}{0,13}`,$ze=new RegExp(`^(?:${Uze}|${Fze})$`),zze=/^[ -~]{0,255}[!-~]$/,jze=/,|=/;function Hze(e){return $ze.test(e)}FW.validateKey=Hze;function Bze(e){return zze.test(e)&&!jze.test(e)}FW.validateValue=Bze});var VW=T(function(GW){Object.defineProperty(GW,"__esModule",{value:!0});GW.TraceStateImpl=void 0;var jW=zW(),HW=32,Gze=512,BW=",",KW="=";class Ik{constructor(e){if(this._internalState=new Map,e)this._parse(e)}set(e,t){let n=this._clone();if(n._internalState.has(e))n._internalState.delete(e);return n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,t)=>(e.push(t+KW+this.get(t)),e),[]).join(BW)}_parse(e){if(e.length>Gze)return;if(this._internalState=e.split(BW).reverse().reduce((t,n)=>{let r=n.trim(),o=r.indexOf(KW);if(o!==-1){let s=r.slice(0,o),i=r.slice(o+1,n.length);if((0,jW.validateKey)(s)&&(0,jW.validateValue)(i))t.set(s,i)}return t},new Map),this._internalState.size>HW)this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,HW))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new Ik;return e._internalState=new Map(this._internalState),e}}GW.TraceStateImpl=Ik});var YW=T(function(qW){Object.defineProperty(qW,"__esModule",{value:!0});qW.createTraceState=void 0;var Wze=VW();function Vze(e){return new Wze.TraceStateImpl(e)}qW.createTraceState=Vze});var QW=T(function(JW){Object.defineProperty(JW,"__esModule",{value:!0});JW.context=void 0;var qze=lm();JW.context=qze.ContextAPI.getInstance()});var nV=T(function(eV){Object.defineProperty(eV,"__esModule",{value:!0});eV.diag=void 0;var Zze=rc();eV.diag=Zze.DiagAPI.instance()});var sV=T(function(rV){Object.defineProperty(rV,"__esModule",{value:!0});rV.NOOP_METER_PROVIDER=rV.NoopMeterProvider=void 0;var Yze=pk();class Dk{getMeter(e,t,n){return Yze.NOOP_METER}}rV.NoopMeterProvider=Dk;rV.NOOP_METER_PROVIDER=new Dk});var lV=T(function(aV){Object.defineProperty(aV,"__esModule",{value:!0});aV.MetricsAPI=void 0;var Xze=sV(),Lk=nc(),iV=rc(),Nk="metrics";class Mk{constructor(){}static getInstance(){if(!this._instance)this._instance=new Mk;return this._instance}setGlobalMeterProvider(e){return(0,Lk.registerGlobal)(Nk,e,iV.DiagAPI.instance())}getMeterProvider(){return(0,Lk.getGlobal)(Nk)||Xze.NOOP_METER_PROVIDER}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){(0,Lk.unregisterGlobal)(Nk,iV.DiagAPI.instance())}}aV.MetricsAPI=Mk});var pV=T(function(uV){Object.defineProperty(uV,"__esModule",{value:!0});uV.metrics=void 0;var Qze=lV();uV.metrics=Qze.MetricsAPI.getInstance()});var gV=T(function(mV){Object.defineProperty(mV,"__esModule",{value:!0});mV.NoopTextMapPropagator=void 0;class fV{inject(e,t){}extract(e,t){return e}fields(){return[]}}mV.NoopTextMapPropagator=fV});var bV=T(function(yV){Object.defineProperty(yV,"__esModule",{value:!0});yV.deleteBaggage=yV.setBaggage=yV.getActiveBaggage=yV.getBaggage=void 0;var eje=lm(),tje=am(),Uk=(0,tje.createContextKey)("OpenTelemetry Baggage Key");function _V(e){return e.getValue(Uk)||void 0}yV.getBaggage=_V;function nje(){return _V(eje.ContextAPI.getInstance().active())}yV.getActiveBaggage=nje;function rje(e,t){return e.setValue(Uk,t)}yV.setBaggage=rje;function oje(e){return e.deleteValue(Uk)}yV.deleteBaggage=oje});var AV=T(function(vV){Object.defineProperty(vV,"__esModule",{value:!0});vV.PropagationAPI=void 0;var Fk=nc(),cje=gV(),EV=mk(),Qy=bV(),lje=nk(),xV=rc(),$k="propagation",uje=new cje.NoopTextMapPropagator;class zk{constructor(){this.createBaggage=lje.createBaggage,this.getBaggage=Qy.getBaggage,this.getActiveBaggage=Qy.getActiveBaggage,this.setBaggage=Qy.setBaggage,this.deleteBaggage=Qy.deleteBaggage}static getInstance(){if(!this._instance)this._instance=new zk;return this._instance}setGlobalPropagator(e){return(0,Fk.registerGlobal)($k,e,xV.DiagAPI.instance())}inject(e,t,n=EV.defaultTextMapSetter){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=EV.defaultTextMapGetter){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){(0,Fk.unregisterGlobal)($k,xV.DiagAPI.instance())}_getGlobalPropagator(){return(0,Fk.getGlobal)($k)||uje}}vV.PropagationAPI=zk});var kV=T(function(TV){Object.defineProperty(TV,"__esModule",{value:!0});TV.propagation=void 0;var dje=AV();TV.propagation=dje.PropagationAPI.getInstance()});var LV=T(function(IV){Object.defineProperty(IV,"__esModule",{value:!0});IV.TraceAPI=void 0;var jk=nc(),RV=Ck(),OV=Xy(),Lu=xk(),PV=rc(),Hk="trace";class Bk{constructor(){this._proxyTracerProvider=new RV.ProxyTracerProvider,this.wrapSpanContext=OV.wrapSpanContext,this.isSpanContextValid=OV.isSpanContextValid,this.deleteSpan=Lu.deleteSpan,this.getSpan=Lu.getSpan,this.getActiveSpan=Lu.getActiveSpan,this.getSpanContext=Lu.getSpanContext,this.setSpan=Lu.setSpan,this.setSpanContext=Lu.setSpanContext}static getInstance(){if(!this._instance)this._instance=new Bk;return this._instance}setGlobalTracerProvider(e){let t=(0,jk.registerGlobal)(Hk,this._proxyTracerProvider,PV.DiagAPI.instance());if(t)this._proxyTracerProvider.setDelegate(e);return t}getTracerProvider(){return(0,jk.getGlobal)(Hk)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){(0,jk.unregisterGlobal)(Hk,PV.DiagAPI.instance()),this._proxyTracerProvider=new RV.ProxyTracerProvider}}IV.TraceAPI=Bk});var UV=T(function(NV){Object.defineProperty(NV,"__esModule",{value:!0});NV.trace=void 0;var pje=LV();NV.trace=pje.TraceAPI.getInstance()});var GV=T(function(ot){Object.defineProperty(ot,"__esModule",{value:!0});ot.trace=ot.propagation=ot.metrics=ot.diag=ot.context=ot.INVALID_SPAN_CONTEXT=ot.INVALID_TRACEID=ot.INVALID_SPANID=ot.isValidSpanId=ot.isValidTraceId=ot.isSpanContextValid=ot.createTraceState=ot.TraceFlags=ot.SpanStatusCode=ot.SpanKind=ot.SamplingDecision=ot.ProxyTracerProvider=ot.ProxyTracer=ot.defaultTextMapSetter=ot.defaultTextMapGetter=ot.ValueType=ot.createNoopMeter=ot.DiagLogLevel=ot.DiagConsoleLogger=ot.ROOT_CONTEXT=ot.createContextKey=ot.baggageEntryMetadataFromString=void 0;var fje=nk();Object.defineProperty(ot,"baggageEntryMetadataFromString",{enumerable:!0,get:function(){return fje.baggageEntryMetadataFromString}});var FV=am();Object.defineProperty(ot,"createContextKey",{enumerable:!0,get:function(){return FV.createContextKey}});Object.defineProperty(ot,"ROOT_CONTEXT",{enumerable:!0,get:function(){return FV.ROOT_CONTEXT}});var mje=LG();Object.defineProperty(ot,"DiagConsoleLogger",{enumerable:!0,get:function(){return mje.DiagConsoleLogger}});var hje=Vy();Object.defineProperty(ot,"DiagLogLevel",{enumerable:!0,get:function(){return hje.DiagLogLevel}});var gje=pk();Object.defineProperty(ot,"createNoopMeter",{enumerable:!0,get:function(){return gje.createNoopMeter}});var _je=WG();Object.defineProperty(ot,"ValueType",{enumerable:!0,get:function(){return _je.ValueType}});var $V=mk();Object.defineProperty(ot,"defaultTextMapGetter",{enumerable:!0,get:function(){return $V.defaultTextMapGetter}});Object.defineProperty(ot,"defaultTextMapSetter",{enumerable:!0,get:function(){return $V.defaultTextMapSetter}});var yje=Tk();Object.defineProperty(ot,"ProxyTracer",{enumerable:!0,get:function(){return yje.ProxyTracer}});var Sje=Ck();Object.defineProperty(ot,"ProxyTracerProvider",{enumerable:!0,get:function(){return Sje.ProxyTracerProvider}});var bje=DW();Object.defineProperty(ot,"SamplingDecision",{enumerable:!0,get:function(){return bje.SamplingDecision}});var Eje=NW();Object.defineProperty(ot,"SpanKind",{enumerable:!0,get:function(){return Eje.SpanKind}});var xje=UW();Object.defineProperty(ot,"SpanStatusCode",{enumerable:!0,get:function(){return xje.SpanStatusCode}});var vje=Sk();Object.defineProperty(ot,"TraceFlags",{enumerable:!0,get:function(){return vje.TraceFlags}});var wje=YW();Object.defineProperty(ot,"createTraceState",{enumerable:!0,get:function(){return wje.createTraceState}});var Kk=Xy();Object.defineProperty(ot,"isSpanContextValid",{enumerable:!0,get:function(){return Kk.isSpanContextValid}});Object.defineProperty(ot,"isValidTraceId",{enumerable:!0,get:function(){return Kk.isValidTraceId}});Object.defineProperty(ot,"isValidSpanId",{enumerable:!0,get:function(){return Kk.isValidSpanId}});var Gk=Yy();Object.defineProperty(ot,"INVALID_SPANID",{enumerable:!0,get:function(){return Gk.INVALID_SPANID}});Object.defineProperty(ot,"INVALID_TRACEID",{enumerable:!0,get:function(){return Gk.INVALID_TRACEID}});Object.defineProperty(ot,"INVALID_SPAN_CONTEXT",{enumerable:!0,get:function(){return Gk.INVALID_SPAN_CONTEXT}});var zV=QW();Object.defineProperty(ot,"context",{enumerable:!0,get:function(){return zV.context}});var jV=nV();Object.defineProperty(ot,"diag",{enumerable:!0,get:function(){return jV.diag}});var HV=pV();Object.defineProperty(ot,"metrics",{enumerable:!0,get:function(){return HV.metrics}});var BV=kV();Object.defineProperty(ot,"propagation",{enumerable:!0,get:function(){return BV.propagation}});var KV=UV();Object.defineProperty(ot,"trace",{enumerable:!0,get:function(){return KV.trace}});ot.default={context:zV.context,diag:jV.diag,metrics:HV.metrics,propagation:BV.propagation,trace:KV.trace}});var Qm=T(function(F9){Object.defineProperty(F9,"__esModule",{value:!0});F9.regexpCode=F9.getEsmExportName=F9.getProperty=F9.safeStringify=F9.stringify=F9.strConcat=F9.addCodeArg=F9.str=F9._=F9.nil=F9._Code=F9.Name=F9.IDENTIFIER=F9._CodeOrName=void 0;class Sb{}F9._CodeOrName=Sb;F9.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class od extends Sb{constructor(e){super();if(!F9.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}F9.Name=od;class Do extends Sb{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,n)=>`${t}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,n)=>{if(n instanceof od)t[n.str]=(t[n.str]||0)+1;return t},{})}}F9._Code=Do;F9.nil=new Do("");function M9(e,...t){let n=[e[0]],r=0;while(r<t.length)bI(n,t[r]),n.push(e[++r]);return new Do(n)}F9._=M9;var SI=new Do("+");function U9(e,...t){let n=[Xm(e[0])],r=0;while(r<t.length)n.push(SI),bI(n,t[r]),n.push(SI,Xm(e[++r]));return CWe(n),new Do(n)}F9.str=U9;function bI(e,t){if(t instanceof Do)e.push(...t._items);else if(t instanceof od)e.push(t);else e.push(OWe(t))}F9.addCodeArg=bI;function CWe(e){let t=1;while(t<e.length-1){if(e[t]===SI){let n=kWe(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}function kWe(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof od||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof od))return`"${e}${t.slice(1)}`;return}function RWe(e,t){return t.emptyStr()?e:e.emptyStr()?t:U9`${e}${t}`}F9.strConcat=RWe;function OWe(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Xm(Array.isArray(e)?e.join(","):e)}function PWe(e){return new Do(Xm(e))}F9.stringify=PWe;function Xm(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}F9.safeStringify=Xm;function IWe(e){return typeof e=="string"&&F9.IDENTIFIER.test(e)?new Do(`.${e}`):M9`[${e}]`}F9.getProperty=IWe;function DWe(e){if(typeof e=="string"&&F9.IDENTIFIER.test(e))return new Do(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}F9.getEsmExportName=DWe;function LWe(e){return new Do(e.toString())}F9.regexpCode=LWe});var wI=T(function(H9){Object.defineProperty(H9,"__esModule",{value:!0});H9.ValueScope=H9.ValueScopeName=H9.Scope=H9.varKinds=H9.UsedValueState=void 0;var cr=Qm();class z9 extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Eb;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Eb||(H9.UsedValueState=Eb={}));H9.varKinds={const:new cr.Name("const"),let:new cr.Name("let"),var:new cr.Name("var")};class xI{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof cr.Name?e:this.name(e)}name(e){return new cr.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,n;if(((n=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||n===void 0?void 0:n.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}H9.Scope=xI;class vI extends cr.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=cr._`.${new cr.Name(t)}[${n}]`}}H9.ValueScopeName=vI;var VWe=cr._`\n`;class j9 extends xI{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?VWe:cr.nil}}get(){return this._scope}name(e){return new vI(e,this._newName(e))}value(e,t){var n;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let r=this.toName(e),{prefix:o}=r,s=(n=t.key)!==null&&n!==void 0?n:t.ref,i=this._values[o];if(i){let l=i.get(s);if(l)return l}else i=this._values[o]=new Map;i.set(s,r);let a=this._scope[o]||(this._scope[o]=[]),c=a.length;return a[c]=t.ref,r.setValue(t,{property:o,itemIndex:c}),r}getValue(e,t){let n=this._values[e];if(!n)return;return n.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(n)=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return cr._`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,(r)=>{if(r.value===void 0)throw Error(`CodeGen: name "${r}" has no value`);return r.value.code},t,n)}_reduceValues(e,t,n={},r){let o=cr.nil;for(let s in e){let i=e[s];if(!i)continue;let a=n[s]=n[s]||new Map;i.forEach((c)=>{if(a.has(c))return;a.set(c,Eb.Started);let l=t(c);if(l){let u=this.opts.es5?H9.varKinds.var:H9.varKinds.const;o=cr._`${o}${u} ${c} = ${l};${this.opts._n}`}else if(l=r===null||r===void 0?void 0:r(c))o=cr._`${o}${l}${this.opts._n}`;else throw new z9(c);a.set(c,Eb.Completed)})}return o}}H9.ValueScope=j9});var Pe=T(function(lr){Object.defineProperty(lr,"__esModule",{value:!0});lr.or=lr.and=lr.not=lr.CodeGen=lr.operators=lr.varKinds=lr.ValueScopeName=lr.ValueScope=lr.Scope=lr.Name=lr.regexpCode=lr.stringify=lr.getProperty=lr.nil=lr.strConcat=lr.str=lr._=void 0;var He=Qm(),Lo=wI(),Gi=Qm();Object.defineProperty(lr,"_",{enumerable:!0,get:function(){return Gi._}});Object.defineProperty(lr,"str",{enumerable:!0,get:function(){return Gi.str}});Object.defineProperty(lr,"strConcat",{enumerable:!0,get:function(){return Gi.strConcat}});Object.defineProperty(lr,"nil",{enumerable:!0,get:function(){return Gi.nil}});Object.defineProperty(lr,"getProperty",{enumerable:!0,get:function(){return Gi.getProperty}});Object.defineProperty(lr,"stringify",{enumerable:!0,get:function(){return Gi.stringify}});Object.defineProperty(lr,"regexpCode",{enumerable:!0,get:function(){return Gi.regexpCode}});Object.defineProperty(lr,"Name",{enumerable:!0,get:function(){return Gi.Name}});var Cb=wI();Object.defineProperty(lr,"Scope",{enumerable:!0,get:function(){return Cb.Scope}});Object.defineProperty(lr,"ValueScope",{enumerable:!0,get:function(){return Cb.ValueScope}});Object.defineProperty(lr,"ValueScopeName",{enumerable:!0,get:function(){return Cb.ValueScopeName}});Object.defineProperty(lr,"varKinds",{enumerable:!0,get:function(){return Cb.varKinds}});lr.operators={GT:new He._Code(">"),GTE:new He._Code(">="),LT:new He._Code("<"),LTE:new He._Code("<="),EQ:new He._Code("==="),NEQ:new He._Code("!=="),NOT:new He._Code("!"),OR:new He._Code("||"),AND:new He._Code("&&"),ADD:new He._Code("+")};class Wi{optimizeNodes(){return this}optimizeNames(e,t){return this}}class K9 extends Wi{constructor(e,t,n){super();this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let n=e?Lo.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${r};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=id(this.rhs,e,t);return this}get names(){return this.rhs instanceof He._CodeOrName?this.rhs.names:{}}}class CI extends Wi{constructor(e,t,n){super();this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof He.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=id(this.rhs,e,t),this}get names(){let e=this.lhs instanceof He.Name?{}:{...this.lhs.names};return Tb(e,this.rhs)}}class G9 extends CI{constructor(e,t,n,r){super(e,n,r);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class W9 extends Wi{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class V9 extends Wi{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class q9 extends Wi{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class Z9 extends Wi{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=id(this.code,e,t),this}get names(){return this.code instanceof He._CodeOrName?this.code.names:{}}}class kb extends Wi{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let n=e[t].optimizeNodes();if(Array.isArray(n))e.splice(t,1,...n);else if(n)e[t]=n;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;while(r--){let o=n[r];if(o.optimizeNames(e,t))continue;JWe(e,o.names),n.splice(r,1)}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>mc(e,t.names),{})}}class Vi extends kb{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class Y9 extends kb{}class eh extends Vi{}eh.kind="else";class Bs extends Vi{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let n=t.optimizeNodes();t=this.else=Array.isArray(n)?new eh(n):n}if(t){if(e===!1)return t instanceof Bs?t:t.nodes;if(this.nodes.length)return this;return new Bs(tY(e),t instanceof Bs?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=id(this.condition,e,t),this}get names(){let e=super.names;if(Tb(e,this.condition),this.else)mc(e,this.else.names);return e}}Bs.kind="if";class sd extends Vi{}sd.kind="for";class J9 extends sd{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=id(this.iteration,e,t),this}get names(){return mc(super.names,this.iteration.names)}}class X9 extends sd{constructor(e,t,n,r){super();this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?Lo.varKinds.var:this.varKind,{name:n,from:r,to:o}=this;return`for(${t} ${n}=${r}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=Tb(super.names,this.from);return Tb(e,this.to)}}class AI extends sd{constructor(e,t,n,r){super();this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=id(this.iterable,e,t),this}get names(){return mc(super.names,this.iterable.names)}}class xb extends Vi{constructor(e,t,n){super();this.name=e,this.args=t,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}xb.kind="func";class vb extends kb{render(e){return"return "+super.render(e)}}vb.kind="return";class Q9 extends Vi{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)===null||n===void 0||n.optimizeNames(e,t),(r=this.finally)===null||r===void 0||r.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)mc(e,this.catch.names);if(this.finally)mc(e,this.finally.names);return e}}class wb extends Vi{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}wb.kind="catch";class Ab extends Vi{render(e){return"finally"+super.render(e)}}Ab.kind="finally";class eY{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
87
+ `:""},this._extScope=e,this._scope=new Lo.Scope({parent:e}),this._nodes=[new Y9]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let o=this._scope.toName(t);if(n!==void 0&&r)this._constants[o.str]=n;return this._leafNode(new K9(e,o,n)),o}const(e,t,n){return this._def(Lo.varKinds.const,e,t,n)}let(e,t,n){return this._def(Lo.varKinds.let,e,t,n)}var(e,t,n){return this._def(Lo.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new CI(e,t,n))}add(e,t){return this._leafNode(new G9(e,lr.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==He.nil)this._leafNode(new Z9(e));return this}object(...e){let t=["{"];for(let[n,r]of e){if(t.length>1)t.push(",");if(t.push(n),n!==r||this.opts.es5)t.push(":"),(0,He.addCodeArg)(t,r)}return t.push("}"),new He._Code(t)}if(e,t,n){if(this._blockNode(new Bs(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Bs(e))}else(){return this._elseNode(new eh)}endIf(){return this._endBlockNode(Bs,eh)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new J9(e),t)}forRange(e,t,n,r,o=this.opts.es5?Lo.varKinds.var:Lo.varKinds.let){let s=this._scope.toName(e);return this._for(new X9(o,s,t,n),()=>r(s))}forOf(e,t,n,r=Lo.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=t instanceof He.Name?t:this.var("_arr",t);return this.forRange("_i",0,He._`${s}.length`,(i)=>{this.var(o,He._`${s}[${i}]`),n(o)})}return this._for(new AI("of",r,o,t),()=>n(o))}forIn(e,t,n,r=this.opts.es5?Lo.varKinds.var:Lo.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,He._`Object.keys(${t})`,n);let o=this._scope.toName(e);return this._for(new AI("in",r,o,t),()=>n(o))}endFor(){return this._endBlockNode(sd)}label(e){return this._leafNode(new W9(e))}break(e){return this._leafNode(new V9(e))}return(e){let t=new vb;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(vb)}try(e,t,n){if(!t&&!n)throw Error('CodeGen: "try" without "catch" and "finally"');let r=new Q9;if(this._blockNode(r),this.code(e),t){let o=this.name("e");this._currNode=r.catch=new wb(o),t(o)}if(n)this._currNode=r.finally=new Ab,this.code(n);return this._endBlockNode(wb,Ab)}throw(e){return this._leafNode(new q9(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=He.nil,n,r){if(this._blockNode(new xb(e,t,n)),r)this.code(r).endFunc();return this}endFunc(){return this._endBlockNode(xb)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof Bs))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}lr.CodeGen=eY;function mc(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function Tb(e,t){return t instanceof He._CodeOrName?mc(e,t.names):e}function id(e,t,n){if(e instanceof He.Name)return r(e);if(!o(e))return e;return new He._Code(e._items.reduce((s,i)=>{if(i instanceof He.Name)i=r(i);if(i instanceof He._Code)s.push(...i._items);else s.push(i);return s},[]));function r(s){let i=n[s.str];if(i===void 0||t[s.str]!==1)return s;return delete t[s.str],i}function o(s){return s instanceof He._Code&&s._items.some((i)=>i instanceof He.Name&&t[i.str]===1&&n[i.str]!==void 0)}}function JWe(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function tY(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:He._`!${TI(e)}`}lr.not=tY;var XWe=nY(lr.operators.AND);function QWe(...e){return e.reduce(XWe)}lr.and=QWe;var eVe=nY(lr.operators.OR);function tVe(...e){return e.reduce(eVe)}lr.or=tVe;function nY(e){return(t,n)=>t===He.nil?n:n===He.nil?t:He._`${TI(t)} ${e} ${TI(n)}`}function TI(e){return e instanceof He.Name?e:He._`(${e})`}});var We=T(function(dY){Object.defineProperty(dY,"__esModule",{value:!0});dY.checkStrictMode=dY.getErrorPath=dY.Type=dY.useFunc=dY.setEvaluated=dY.evaluatedPropsToName=dY.mergeEvaluated=dY.eachItem=dY.unescapeJsonPointer=dY.escapeJsonPointer=dY.escapeFragment=dY.unescapeFragment=dY.schemaRefOrVal=dY.schemaHasRulesButRef=dY.schemaHasRules=dY.checkUnknownRules=dY.alwaysValidSchema=dY.toHash=void 0;var dt=Pe(),sVe=Qm();function iVe(e){let t={};for(let n of e)t[n]=!0;return t}dY.toHash=iVe;function aVe(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return iY(e,t),!aY(t,e.self.RULES.all)}dY.alwaysValidSchema=aVe;function iY(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema)return;if(typeof t==="boolean")return;let o=r.RULES.keywords;for(let s in t)if(!o[s])uY(e,`unknown keyword: "${s}"`)}dY.checkUnknownRules=iY;function aY(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(t[n])return!0;return!1}dY.schemaHasRules=aY;function cVe(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(n!=="$ref"&&t.all[n])return!0;return!1}dY.schemaHasRulesButRef=cVe;function lVe({topSchemaRef:e,schemaPath:t},n,r,o){if(!o){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return dt._`${n}`}return dt._`${e}${t}${(0,dt.getProperty)(r)}`}dY.schemaRefOrVal=lVe;function uVe(e){return cY(decodeURIComponent(e))}dY.unescapeFragment=uVe;function dVe(e){return encodeURIComponent(RI(e))}dY.escapeFragment=dVe;function RI(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}dY.escapeJsonPointer=RI;function cY(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}dY.unescapeJsonPointer=cY;function pVe(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}dY.eachItem=pVe;function oY({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:r}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof dt.Name?(s instanceof dt.Name?e(o,s,i):t(o,s,i),i):s instanceof dt.Name?(t(o,i,s),s):n(s,i);return a===dt.Name&&!(c instanceof dt.Name)?r(o,c):c}}dY.mergeEvaluated={props:oY({mergeNames:(e,t,n)=>e.if(dt._`${n} !== true && ${t} !== undefined`,()=>{e.if(dt._`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,dt._`${n} || {}`).code(dt._`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if(dt._`${n} !== true`,()=>{if(t===!0)e.assign(n,!0);else e.assign(n,dt._`${n} || {}`),OI(e,n,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:lY}),items:oY({mergeNames:(e,t,n)=>e.if(dt._`${n} !== true && ${t} !== undefined`,()=>e.assign(n,dt._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if(dt._`${n} !== true`,()=>e.assign(n,t===!0?!0:dt._`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function lY(e,t){if(t===!0)return e.var("props",!0);let n=e.var("props",dt._`{}`);if(t!==void 0)OI(e,n,t);return n}dY.evaluatedPropsToName=lY;function OI(e,t,n){Object.keys(n).forEach((r)=>e.assign(dt._`${t}${(0,dt.getProperty)(r)}`,!0))}dY.setEvaluated=OI;var sY={};function fVe(e,t){return e.scopeValue("func",{ref:t,code:sY[t.code]||(sY[t.code]=new sVe._Code(t.code))})}dY.useFunc=fVe;var kI;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(kI||(dY.Type=kI={}));function mVe(e,t,n){if(e instanceof dt.Name){let r=t===kI.Num;return n?r?dt._`"[" + ${e} + "]"`:dt._`"['" + ${e} + "']"`:r?dt._`"/" + ${e}`:dt._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,dt.getProperty)(e).toString():"/"+RI(e)}dY.getErrorPath=mVe;function uY(e,t,n=e.opts.strictSchema){if(!n)return;if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}dY.checkStrictMode=uY});var Ks=T(function(fY){Object.defineProperty(fY,"__esModule",{value:!0});var Pn=Pe(),IVe={data:new Pn.Name("data"),valCxt:new Pn.Name("valCxt"),instancePath:new Pn.Name("instancePath"),parentData:new Pn.Name("parentData"),parentDataProperty:new Pn.Name("parentDataProperty"),rootData:new Pn.Name("rootData"),dynamicAnchors:new Pn.Name("dynamicAnchors"),vErrors:new Pn.Name("vErrors"),errors:new Pn.Name("errors"),this:new Pn.Name("this"),self:new Pn.Name("self"),scope:new Pn.Name("scope"),json:new Pn.Name("json"),jsonPos:new Pn.Name("jsonPos"),jsonLen:new Pn.Name("jsonLen"),jsonPart:new Pn.Name("jsonPart")};fY.default=IVe});var th=T(function(_Y){Object.defineProperty(_Y,"__esModule",{value:!0});_Y.extendErrors=_Y.resetErrorsCount=_Y.reportExtraError=_Y.reportError=_Y.keyword$DataError=_Y.keywordError=void 0;var Ve=Pe(),Ob=We(),jn=Ks();_Y.keywordError={message:({keyword:e})=>Ve.str`must pass "${e}" keyword validation`};_Y.keyword$DataError={message:({keyword:e,schemaType:t})=>t?Ve.str`"${e}" keyword must be ${t} ($data)`:Ve.str`"${e}" keyword is invalid ($data)`};function LVe(e,t=_Y.keywordError,n,r){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=gY(e,t,n);if(r!==null&&r!==void 0?r:i||a)mY(s,c);else hY(o,Ve._`[${c}]`)}_Y.reportError=LVe;function NVe(e,t=_Y.keywordError,n){let{it:r}=e,{gen:o,compositeRule:s,allErrors:i}=r,a=gY(e,t,n);if(mY(o,a),!(s||i))hY(r,jn.default.vErrors)}_Y.reportExtraError=NVe;function MVe(e,t){e.assign(jn.default.errors,t),e.if(Ve._`${jn.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(Ve._`${jn.default.vErrors}.length`,t),()=>e.assign(jn.default.vErrors,null)))}_Y.resetErrorsCount=MVe;function UVe({gen:e,keyword:t,schemaValue:n,data:r,errsCount:o,it:s}){if(o===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",o,jn.default.errors,(a)=>{if(e.const(i,Ve._`${jn.default.vErrors}[${a}]`),e.if(Ve._`${i}.instancePath === undefined`,()=>e.assign(Ve._`${i}.instancePath`,(0,Ve.strConcat)(jn.default.instancePath,s.errorPath))),e.assign(Ve._`${i}.schemaPath`,Ve.str`${s.errSchemaPath}/${t}`),s.opts.verbose)e.assign(Ve._`${i}.schema`,n),e.assign(Ve._`${i}.data`,r)})}_Y.extendErrors=UVe;function mY(e,t){let n=e.const("err",t);e.if(Ve._`${jn.default.vErrors} === null`,()=>e.assign(jn.default.vErrors,Ve._`[${n}]`),Ve._`${jn.default.vErrors}.push(${n})`),e.code(Ve._`${jn.default.errors}++`)}function hY(e,t){let{gen:n,validateName:r,schemaEnv:o}=e;if(o.$async)n.throw(Ve._`new ${e.ValidationError}(${t})`);else n.assign(Ve._`${r}.errors`,t),n.return(!1)}var hc={keyword:new Ve.Name("keyword"),schemaPath:new Ve.Name("schemaPath"),params:new Ve.Name("params"),propertyName:new Ve.Name("propertyName"),message:new Ve.Name("message"),schema:new Ve.Name("schema"),parentSchema:new Ve.Name("parentSchema")};function gY(e,t,n){let{createErrors:r}=e.it;if(r===!1)return Ve._`{}`;return FVe(e,t,n)}function FVe(e,t,n={}){let{gen:r,it:o}=e,s=[$Ve(o,n),zVe(e,n)];return jVe(e,t,s),r.object(...s)}function $Ve({errorPath:e},{instancePath:t}){let n=t?Ve.str`${e}${(0,Ob.getErrorPath)(t,Ob.Type.Str)}`:e;return[jn.default.instancePath,(0,Ve.strConcat)(jn.default.instancePath,n)]}function zVe({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:r}){let o=r?t:Ve.str`${t}/${e}`;if(n)o=Ve.str`${o}${(0,Ob.getErrorPath)(n,Ob.Type.Str)}`;return[hc.schemaPath,o]}function jVe(e,{params:t,message:n},r){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:p}=a;if(r.push([hc.keyword,o],[hc.params,typeof t=="function"?t(e):t||Ve._`{}`]),c.messages)r.push([hc.message,typeof n=="function"?n(e):n]);if(c.verbose)r.push([hc.schema,i],[hc.parentSchema,Ve._`${u}${p}`],[jn.default.data,s]);if(l)r.push([hc.propertyName,l])}});var xY=T(function(bY){Object.defineProperty(bY,"__esModule",{value:!0});bY.boolOrEmptySchema=bY.topBoolOrEmptySchema=void 0;var WVe=th(),VVe=Pe(),qVe=Ks(),ZVe={message:"boolean schema is false"};function YVe(e){let{gen:t,schema:n,validateName:r}=e;if(n===!1)SY(e,!1);else if(typeof n=="object"&&n.$async===!0)t.return(qVe.default.data);else t.assign(VVe._`${r}.errors`,null),t.return(!0)}bY.topBoolOrEmptySchema=YVe;function JVe(e,t){let{gen:n,schema:r}=e;if(r===!1)n.var(t,!1),SY(e);else n.var(t,!0)}bY.boolOrEmptySchema=JVe;function SY(e,t){let{gen:n,data:r}=e,o={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,WVe.reportError)(o,ZVe,void 0,t)}});var II=T(function(vY){Object.defineProperty(vY,"__esModule",{value:!0});vY.getRules=vY.isJSONType=void 0;var QVe=["string","number","integer","boolean","null","object","array"],eqe=new Set(QVe);function tqe(e){return typeof e=="string"&&eqe.has(e)}vY.isJSONType=tqe;function nqe(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}vY.getRules=nqe});var DI=T(function(CY){Object.defineProperty(CY,"__esModule",{value:!0});CY.shouldUseRule=CY.shouldUseGroup=CY.schemaHasRulesForType=void 0;function oqe({schema:e,self:t},n){let r=t.RULES.types[n];return r&&r!==!0&&AY(e,r)}CY.schemaHasRulesForType=oqe;function AY(e,t){return t.rules.some((n)=>TY(e,n))}CY.shouldUseGroup=AY;function TY(e,t){var n;return e[t.keyword]!==void 0||((n=t.definition.implements)===null||n===void 0?void 0:n.some((r)=>e[r]!==void 0))}CY.shouldUseRule=TY});var nh=T(function(IY){Object.defineProperty(IY,"__esModule",{value:!0});IY.reportTypeError=IY.checkDataTypes=IY.checkDataType=IY.coerceAndCheckDataType=IY.getJSONTypes=IY.getSchemaTypes=IY.DataType=void 0;var aqe=II(),cqe=DI(),lqe=th(),Re=Pe(),RY=We(),ad;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(ad||(IY.DataType=ad={}));function uqe(e){let t=OY(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}IY.getSchemaTypes=uqe;function OY(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(aqe.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}IY.getJSONTypes=OY;function dqe(e,t){let{gen:n,data:r,opts:o}=e,s=pqe(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,cqe.schemaHasRulesForType)(e,t[0]));if(i){let a=NI(t,r,o.strictNumbers,ad.Wrong);n.if(a,()=>{if(s.length)fqe(e,t,s);else MI(e)})}return i}IY.coerceAndCheckDataType=dqe;var PY=new Set(["string","number","integer","boolean","null"]);function pqe(e,t){return t?e.filter((n)=>PY.has(n)||t==="array"&&n==="array"):[]}function fqe(e,t,n){let{gen:r,data:o,opts:s}=e,i=r.let("dataType",Re._`typeof ${o}`),a=r.let("coerced",Re._`undefined`);if(s.coerceTypes==="array")r.if(Re._`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>r.assign(o,Re._`${o}[0]`).assign(i,Re._`typeof ${o}`).if(NI(t,o,s.strictNumbers),()=>r.assign(a,o)));r.if(Re._`${a} !== undefined`);for(let l of n)if(PY.has(l)||l==="array"&&s.coerceTypes==="array")c(l);r.else(),MI(e),r.endIf(),r.if(Re._`${a} !== undefined`,()=>{r.assign(o,a),mqe(e,a)});function c(l){switch(l){case"string":r.elseIf(Re._`${i} == "number" || ${i} == "boolean"`).assign(a,Re._`"" + ${o}`).elseIf(Re._`${o} === null`).assign(a,Re._`""`);return;case"number":r.elseIf(Re._`${i} == "boolean" || ${o} === null
88
+ || (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,Re._`+${o}`);return;case"integer":r.elseIf(Re._`${i} === "boolean" || ${o} === null
89
+ || (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,Re._`+${o}`);return;case"boolean":r.elseIf(Re._`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf(Re._`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":r.elseIf(Re._`${o} === "" || ${o} === 0 || ${o} === false`),r.assign(a,null);return;case"array":r.elseIf(Re._`${i} === "string" || ${i} === "number"
90
+ || ${i} === "boolean" || ${o} === null`).assign(a,Re._`[${o}]`)}}}function mqe({gen:e,parentData:t,parentDataProperty:n},r){e.if(Re._`${t} !== undefined`,()=>e.assign(Re._`${t}[${n}]`,r))}function LI(e,t,n,r=ad.Correct){let o=r===ad.Correct?Re.operators.EQ:Re.operators.NEQ,s;switch(e){case"null":return Re._`${t} ${o} null`;case"array":s=Re._`Array.isArray(${t})`;break;case"object":s=Re._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i(Re._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return Re._`typeof ${t} ${o} ${e}`}return r===ad.Correct?s:(0,Re.not)(s);function i(a=Re.nil){return(0,Re.and)(Re._`typeof ${t} == "number"`,a,n?Re._`isFinite(${t})`:Re.nil)}}IY.checkDataType=LI;function NI(e,t,n,r){if(e.length===1)return LI(e[0],t,n,r);let o,s=(0,RY.toHash)(e);if(s.array&&s.object){let i=Re._`typeof ${t} != "object"`;o=s.null?i:Re._`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=Re.nil;if(s.number)delete s.integer;for(let i in s)o=(0,Re.and)(o,LI(i,t,n,r));return o}IY.checkDataTypes=NI;var hqe={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?Re._`{type: ${e}}`:Re._`{type: ${t}}`};function MI(e){let t=gqe(e);(0,lqe.reportError)(t,hqe)}IY.reportTypeError=MI;function gqe(e){let{gen:t,data:n,schema:r}=e,o=(0,RY.schemaRefOrVal)(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:o,schemaValue:o,parentSchema:r,params:{},it:e}}});var UY=T(function(NY){Object.defineProperty(NY,"__esModule",{value:!0});NY.assignDefaults=void 0;var cd=Pe(),vqe=We();function wqe(e,t){let{properties:n,items:r}=e.schema;if(t==="object"&&n)for(let o in n)LY(e,o,n[o].default);else if(t==="array"&&Array.isArray(r))r.forEach((o,s)=>LY(e,s,o.default))}NY.assignDefaults=wqe;function LY(e,t,n){let{gen:r,compositeRule:o,data:s,opts:i}=e;if(n===void 0)return;let a=cd._`${s}${(0,cd.getProperty)(t)}`;if(o){(0,vqe.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=cd._`${a} === undefined`;if(i.useDefaults==="empty")c=cd._`${c} || ${a} === null || ${a} === ""`;r.if(c,cd._`${a} = ${(0,cd.stringify)(n)}`)}});var Xr=T(function(zY){Object.defineProperty(zY,"__esModule",{value:!0});zY.validateUnion=zY.validateArray=zY.usePattern=zY.callValidateCode=zY.schemaProperties=zY.allSchemaProperties=zY.noPropertyInData=zY.propertyInData=zY.isOwnProperty=zY.hasPropFunc=zY.reportMissingProp=zY.checkMissingProp=zY.checkReportMissingProp=void 0;var _t=Pe(),UI=We(),qi=Ks(),Aqe=We();function Tqe(e,t){let{gen:n,data:r,it:o}=e;n.if($I(n,r,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:_t._`${t}`},!0),e.error()})}zY.checkReportMissingProp=Tqe;function Cqe({gen:e,data:t,it:{opts:n}},r,o){return(0,_t.or)(...r.map((s)=>(0,_t.and)($I(e,t,s,n.ownProperties),_t._`${o} = ${s}`)))}zY.checkMissingProp=Cqe;function kqe(e,t){e.setParams({missingProperty:t},!0),e.error()}zY.reportMissingProp=kqe;function FY(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:_t._`Object.prototype.hasOwnProperty`})}zY.hasPropFunc=FY;function FI(e,t,n){return _t._`${FY(e)}.call(${t}, ${n})`}zY.isOwnProperty=FI;function Rqe(e,t,n,r){let o=_t._`${t}${(0,_t.getProperty)(n)} !== undefined`;return r?_t._`${o} && ${FI(e,t,n)}`:o}zY.propertyInData=Rqe;function $I(e,t,n,r){let o=_t._`${t}${(0,_t.getProperty)(n)} === undefined`;return r?(0,_t.or)(o,(0,_t.not)(FI(e,t,n))):o}zY.noPropertyInData=$I;function $Y(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}zY.allSchemaProperties=$Y;function Oqe(e,t){return $Y(t).filter((n)=>!(0,UI.alwaysValidSchema)(e,t[n]))}zY.schemaProperties=Oqe;function Pqe({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:o,errorPath:s},it:i},a,c,l){let u=l?_t._`${e}, ${t}, ${r}${o}`:t,p=[[qi.default.instancePath,(0,_t.strConcat)(qi.default.instancePath,s)],[qi.default.parentData,i.parentData],[qi.default.parentDataProperty,i.parentDataProperty],[qi.default.rootData,qi.default.rootData]];if(i.opts.dynamicRef)p.push([qi.default.dynamicAnchors,qi.default.dynamicAnchors]);let f=_t._`${u}, ${n.object(...p)}`;return c!==_t.nil?_t._`${a}.call(${c}, ${f})`:_t._`${a}(${f})`}zY.callValidateCode=Pqe;var Iqe=_t._`new RegExp`;function Dqe({gen:e,it:{opts:t}},n){let r=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(n,r);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:_t._`${o.code==="new RegExp"?Iqe:(0,Aqe.useFunc)(e,o)}(${n}, ${r})`})}zY.usePattern=Dqe;function Lqe(e){let{gen:t,data:n,keyword:r,it:o}=e,s=t.name("valid");if(o.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",_t._`${n}.length`);t.forRange("i",0,c,(l)=>{e.subschema({keyword:r,dataProp:l,dataPropType:UI.Type.Num},s),t.if((0,_t.not)(s),a)})}}zY.validateArray=Lqe;function Nqe(e){let{gen:t,schema:n,keyword:r,it:o}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(n.some((c)=>(0,UI.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>n.forEach((c,l)=>{let u=e.subschema({keyword:r,schemaProp:l,compositeRule:!0},a);if(t.assign(i,_t._`${i} || ${a}`),!e.mergeValidEvaluated(u,a))t.if((0,_t.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}zY.validateUnion=Nqe});var WY=T(function(KY){Object.defineProperty(KY,"__esModule",{value:!0});KY.validateKeywordUsage=KY.validSchemaType=KY.funcKeywordCode=KY.macroKeywordCode=void 0;var Hn=Pe(),gc=Ks(),qqe=Xr(),Zqe=th();function Yqe(e,t){let{gen:n,keyword:r,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=BY(n,r,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let l=n.name("valid");e.subschema({schema:a,schemaPath:Hn.nil,errSchemaPath:`${i.errSchemaPath}/${r}`,topSchemaRef:c,compositeRule:!0},l),e.pass(l,()=>e.error(!0))}KY.macroKeywordCode=Yqe;function Jqe(e,t){var n;let{gen:r,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;Qqe(c,t);let l=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,u=BY(r,o,l),p=r.let("valid");e.block$data(p,f),e.ok((n=t.valid)!==null&&n!==void 0?n:p);function f(){if(t.errors===!1){if(y(),t.modifying)HY(e);_(()=>e.error())}else{let E=t.async?m():h();if(t.modifying)HY(e);_(()=>Xqe(e,E))}}function m(){let E=r.let("ruleErrs",null);return r.try(()=>y(Hn._`await `),(S)=>r.assign(p,!1).if(Hn._`${S} instanceof ${c.ValidationError}`,()=>r.assign(E,Hn._`${S}.errors`),()=>r.throw(S))),E}function h(){let E=Hn._`${u}.errors`;return r.assign(E,null),y(Hn.nil),E}function y(E=t.async?Hn._`await `:Hn.nil){let S=c.opts.passContext?gc.default.this:gc.default.self,x=!(("compile"in t)&&!a||t.schema===!1);r.assign(p,Hn._`${E}${(0,qqe.callValidateCode)(e,u,S,x)}`,t.modifying)}function _(E){var S;r.if((0,Hn.not)((S=t.valid)!==null&&S!==void 0?S:p),E)}}KY.funcKeywordCode=Jqe;function HY(e){let{gen:t,data:n,it:r}=e;t.if(r.parentData,()=>t.assign(n,Hn._`${r.parentData}[${r.parentDataProperty}]`))}function Xqe(e,t){let{gen:n}=e;n.if(Hn._`Array.isArray(${t})`,()=>{n.assign(gc.default.vErrors,Hn._`${gc.default.vErrors} === null ? ${t} : ${gc.default.vErrors}.concat(${t})`).assign(gc.default.errors,Hn._`${gc.default.vErrors}.length`),(0,Zqe.extendErrors)(e)},()=>e.error())}function Qqe({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function BY(e,t,n){if(n===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:(0,Hn.stringify)(n)})}function e4e(e,t,n=!1){return!t.length||t.some((r)=>r==="array"?Array.isArray(e):r==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==r||n&&typeof e>"u")}KY.validSchemaType=e4e;function t4e({schema:e,opts:t,self:n,errSchemaPath:r},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw Error("ajv implementation error");let i=o.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema){if(!o.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${r}": `+n.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")n.logger.error(c);else throw Error(c)}}}KY.validateKeywordUsage=t4e});var YY=T(function(qY){Object.defineProperty(qY,"__esModule",{value:!0});qY.extendSubschemaMode=qY.extendSubschemaData=qY.getSubschema=void 0;var as=Pe(),VY=We();function s4e(e,{keyword:t,schemaProp:n,schema:r,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&r!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return n===void 0?{schema:a,schemaPath:as._`${e.schemaPath}${(0,as.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[n],schemaPath:as._`${e.schemaPath}${(0,as.getProperty)(t)}${(0,as.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,VY.escapeFragment)(n)}`}}if(r!==void 0){if(o===void 0||s===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw Error('either "keyword" or "schema" must be passed')}qY.getSubschema=s4e;function i4e(e,t,{dataProp:n,dataPropType:r,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&n!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(n!==void 0){let{errorPath:l,dataPathArr:u,opts:p}=t,f=a.let("data",as._`${t.data}${(0,as.getProperty)(n)}`,!0);c(f),e.errorPath=as.str`${l}${(0,VY.getErrorPath)(n,r,p.jsPropertySyntax)}`,e.parentDataProperty=as._`${n}`,e.dataPathArr=[...u,e.parentDataProperty]}if(o!==void 0){let l=o instanceof as.Name?o:a.let("data",o,!0);if(c(l),i!==void 0)e.propertyName=i}if(s)e.dataTypes=s;function c(l){e.data=l,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,l]}}qY.extendSubschemaData=i4e;function a4e(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:o,allErrors:s}){if(r!==void 0)e.compositeRule=r;if(o!==void 0)e.createErrors=o;if(s!==void 0)e.allErrors=s;e.jtdDiscriminator=t,e.jtdMetadata=n}qY.extendSubschemaMode=a4e});var zI=T(function(Rjt,JY){JY.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,s;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(s=Object.keys(t),r=s.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[o]))return!1;for(o=r;o--!==0;){var i=s[o];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n}});var QY=T(function(Ojt,XY){var Zi=XY.exports=function(e,t,n){if(typeof t=="function")n=t,t={};n=t.cb||n;var r=typeof n=="function"?n:n.pre||function(){},o=n.post||function(){};Pb(t,r,o,e,"",e)};Zi.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Zi.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Zi.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Zi.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Pb(e,t,n,r,o,s,i,a,c,l){if(r&&typeof r=="object"&&!Array.isArray(r)){t(r,o,s,i,a,c,l);for(var u in r){var p=r[u];if(Array.isArray(p)){if(u in Zi.arrayKeywords)for(var f=0;f<p.length;f++)Pb(e,t,n,p[f],o+"/"+u+"/"+f,s,o,u,r,f)}else if(u in Zi.propsKeywords){if(p&&typeof p=="object")for(var m in p)Pb(e,t,n,p[m],o+"/"+u+"/"+u4e(m),s,o,u,r,m)}else if(u in Zi.keywords||e.allKeys&&!(u in Zi.skipKeywords))Pb(e,t,n,p,o+"/"+u,s,o,u,r)}n(r,o,s,i,a,c,l)}}function u4e(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var rh=T(function(rJ){Object.defineProperty(rJ,"__esModule",{value:!0});rJ.getSchemaRefs=rJ.resolveUrl=rJ.normalizeId=rJ._getFullPath=rJ.getFullPath=rJ.inlineRef=void 0;var d4e=We(),p4e=zI(),f4e=QY(),m4e=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function h4e(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!jI(e);if(!t)return!1;return eJ(e)<=t}rJ.inlineRef=h4e;var g4e=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function jI(e){for(let t in e){if(g4e.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(jI))return!0;if(typeof n=="object"&&jI(n))return!0}return!1}function eJ(e){let t=0;for(let n in e){if(n==="$ref")return 1/0;if(t++,m4e.has(n))continue;if(typeof e[n]=="object")(0,d4e.eachItem)(e[n],(r)=>t+=eJ(r));if(t===1/0)return 1/0}return t}function tJ(e,t="",n){if(n!==!1)t=ld(t);let r=e.parse(t);return nJ(e,r)}rJ.getFullPath=tJ;function nJ(e,t){return e.serialize(t).split("#")[0]+"#"}rJ._getFullPath=nJ;var _4e=/#\/?$/;function ld(e){return e?e.replace(_4e,""):""}rJ.normalizeId=ld;function y4e(e,t,n){return n=ld(n),e.resolve(t,n)}rJ.resolveUrl=y4e;var S4e=/^[a-z_][-a-z0-9._]*$/i;function b4e(e,t){if(typeof e=="boolean")return{};let{schemaId:n,uriResolver:r}=this.opts,o=ld(e[n]||t),s={"":o},i=tJ(r,o,!1),a={},c=new Set;return f4e(e,{allKeys:!0},(p,f,m,h)=>{if(h===void 0)return;let y=i+f,_=s[h];if(typeof p[n]=="string")_=E.call(this,p[n]);S.call(this,p.$anchor),S.call(this,p.$dynamicAnchor),s[f]=_;function E(x){let v=this.opts.uriResolver.resolve;if(x=ld(_?v(_,x):x),c.has(x))throw u(x);c.add(x);let w=this.refs[x];if(typeof w=="string")w=this.refs[w];if(typeof w=="object")l(p,w.schema,x);else if(x!==ld(y))if(x[0]==="#")l(p,a[x],x),a[x]=p;else this.refs[x]=y;return x}function S(x){if(typeof x=="string"){if(!S4e.test(x))throw Error(`invalid anchor "${x}"`);E.call(this,`#${x}`)}}}),a;function l(p,f,m){if(f!==void 0&&!p4e(p,f))throw u(m)}function u(p){return Error(`reference "${p}" resolves to more than one schema`)}}rJ.getSchemaRefs=b4e});var ih=T(function(SJ){Object.defineProperty(SJ,"__esModule",{value:!0});SJ.getData=SJ.KeywordCxt=SJ.validateFunctionCode=void 0;var lJ=xY(),sJ=nh(),BI=DI(),Ib=nh(),T4e=UY(),sh=WY(),HI=YY(),pe=Pe(),be=Ks(),C4e=rh(),Gs=We(),oh=th();function k4e(e){if(pJ(e)){if(fJ(e),dJ(e)){P4e(e);return}}uJ(e,()=>(0,lJ.topBoolOrEmptySchema)(e))}SJ.validateFunctionCode=k4e;function uJ({gen:e,validateName:t,schema:n,schemaEnv:r,opts:o},s){if(o.code.es5)e.func(t,pe._`${be.default.data}, ${be.default.valCxt}`,r.$async,()=>{e.code(pe._`"use strict"; ${iJ(n,o)}`),O4e(e,o),e.code(s)});else e.func(t,pe._`${be.default.data}, ${R4e(o)}`,r.$async,()=>e.code(iJ(n,o)).code(s))}function R4e(e){return pe._`{${be.default.instancePath}="", ${be.default.parentData}, ${be.default.parentDataProperty}, ${be.default.rootData}=${be.default.data}${e.dynamicRef?pe._`, ${be.default.dynamicAnchors}={}`:pe.nil}}={}`}function O4e(e,t){e.if(be.default.valCxt,()=>{if(e.var(be.default.instancePath,pe._`${be.default.valCxt}.${be.default.instancePath}`),e.var(be.default.parentData,pe._`${be.default.valCxt}.${be.default.parentData}`),e.var(be.default.parentDataProperty,pe._`${be.default.valCxt}.${be.default.parentDataProperty}`),e.var(be.default.rootData,pe._`${be.default.valCxt}.${be.default.rootData}`),t.dynamicRef)e.var(be.default.dynamicAnchors,pe._`${be.default.valCxt}.${be.default.dynamicAnchors}`)},()=>{if(e.var(be.default.instancePath,pe._`""`),e.var(be.default.parentData,pe._`undefined`),e.var(be.default.parentDataProperty,pe._`undefined`),e.var(be.default.rootData,be.default.data),t.dynamicRef)e.var(be.default.dynamicAnchors,pe._`{}`)})}function P4e(e){let{schema:t,opts:n,gen:r}=e;uJ(e,()=>{if(n.$comment&&t.$comment)hJ(e);if(M4e(e),r.let(be.default.vErrors,null),r.let(be.default.errors,0),n.unevaluated)I4e(e);mJ(e),$4e(e)});return}function I4e(e){let{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",pe._`${n}.evaluated`),t.if(pe._`${e.evaluated}.dynamicProps`,()=>t.assign(pe._`${e.evaluated}.props`,pe._`undefined`)),t.if(pe._`${e.evaluated}.dynamicItems`,()=>t.assign(pe._`${e.evaluated}.items`,pe._`undefined`))}function iJ(e,t){let n=typeof e=="object"&&e[t.schemaId];return n&&(t.code.source||t.code.process)?pe._`/*# sourceURL=${n} */`:pe.nil}function D4e(e,t){if(pJ(e)){if(fJ(e),dJ(e)){L4e(e,t);return}}(0,lJ.boolOrEmptySchema)(e,t)}function dJ({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function pJ(e){return typeof e.schema!="boolean"}function L4e(e,t){let{schema:n,gen:r,opts:o}=e;if(o.$comment&&n.$comment)hJ(e);U4e(e),F4e(e);let s=r.const("_errs",be.default.errors);mJ(e,s),r.var(t,pe._`${s} === ${be.default.errors}`)}function fJ(e){(0,Gs.checkUnknownRules)(e),N4e(e)}function mJ(e,t){if(e.opts.jtd)return aJ(e,[],!1,t);let n=(0,sJ.getSchemaTypes)(e.schema),r=(0,sJ.coerceAndCheckDataType)(e,n);aJ(e,n,!r,t)}function N4e(e){let{schema:t,errSchemaPath:n,opts:r,self:o}=e;if(t.$ref&&r.ignoreKeywordsWithRef&&(0,Gs.schemaHasRulesButRef)(t,o.RULES))o.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function M4e(e){let{schema:t,opts:n}=e;if(t.default!==void 0&&n.useDefaults&&n.strictSchema)(0,Gs.checkStrictMode)(e,"default is ignored in the schema root")}function U4e(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=(0,C4e.resolveUrl)(e.opts.uriResolver,e.baseId,t)}function F4e(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function hJ({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:o}){let s=n.$comment;if(o.$comment===!0)e.code(pe._`${be.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=pe.str`${r}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(pe._`${be.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function $4e(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:o,opts:s}=e;if(n.$async)t.if(pe._`${be.default.errors} === 0`,()=>t.return(be.default.data),()=>t.throw(pe._`new ${o}(${be.default.vErrors})`));else{if(t.assign(pe._`${r}.errors`,be.default.vErrors),s.unevaluated)z4e(e);t.return(pe._`${be.default.errors} === 0`)}}function z4e({gen:e,evaluated:t,props:n,items:r}){if(n instanceof pe.Name)e.assign(pe._`${t}.props`,n);if(r instanceof pe.Name)e.assign(pe._`${t}.items`,r)}function aJ(e,t,n,r){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:l}=e,{RULES:u}=l;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,Gs.schemaHasRulesButRef)(s,u))){o.block(()=>_J(e,"$ref",u.all.$ref.definition));return}if(!c.jtd)j4e(e,t);o.block(()=>{for(let f of u.rules)p(f);p(u.post)});function p(f){if(!(0,BI.shouldUseGroup)(s,f))return;if(f.type){if(o.if((0,Ib.checkDataType)(f.type,i,c.strictNumbers)),cJ(e,f),t.length===1&&t[0]===f.type&&n)o.else(),(0,Ib.reportTypeError)(e);o.endIf()}else cJ(e,f);if(!a)o.if(pe._`${be.default.errors} === ${r||0}`)}}function cJ(e,t){let{gen:n,schema:r,opts:{useDefaults:o}}=e;if(o)(0,T4e.assignDefaults)(e,t.type);n.block(()=>{for(let s of t.rules)if((0,BI.shouldUseRule)(r,s))_J(e,s.keyword,s.definition,t.type)})}function j4e(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(H4e(e,t),!e.opts.allowUnionTypes)B4e(e,t);K4e(e,e.dataTypes)}function H4e(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((n)=>{if(!gJ(e.dataTypes,n))KI(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),W4e(e,t)}function B4e(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))KI(e,"use allowUnionTypes to allow union type keyword")}function K4e(e,t){let n=e.self.RULES.all;for(let r in n){let o=n[r];if(typeof o=="object"&&(0,BI.shouldUseRule)(e.schema,o)){let{type:s}=o.definition;if(s.length&&!s.some((i)=>G4e(t,i)))KI(e,`missing type "${s.join(",")}" for keyword "${r}"`)}}}function G4e(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function gJ(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function W4e(e,t){let n=[];for(let r of e.dataTypes)if(gJ(t,r))n.push(r);else if(t.includes("integer")&&r==="number")n.push("integer");e.dataTypes=n}function KI(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,Gs.checkStrictMode)(e,t,e.opts.strictTypes)}class GI{constructor(e,t,n){if((0,sh.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Gs.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",yJ(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,sh.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",be.default.errors)}result(e,t,n){this.failResult((0,pe.not)(e),t,n)}failResult(e,t,n){if(this.gen.if(e),n)n();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult((0,pe.not)(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(pe._`${t} !== undefined && (${(0,pe.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?oh.reportExtraError:oh.reportError)(this,this.def.error,t)}$dataError(){(0,oh.reportError)(this,this.def.$dataError||oh.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,oh.resetErrorsCount)(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,n=pe.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=pe.nil,t=pe.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:o,def:s}=this;if(n.if((0,pe.or)(pe._`${r} === undefined`,t)),e!==pe.nil)n.assign(e,!0);if(o.length||s.validateSchema){if(n.elseIf(this.invalid$data()),this.$dataError(),e!==pe.nil)n.assign(e,!1)}n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:o}=this;return(0,pe.or)(s(),i());function s(){if(n.length){if(!(t instanceof pe.Name))throw Error("ajv implementation error");let a=Array.isArray(n)?n:[n];return pe._`${(0,Ib.checkDataTypes)(a,t,o.opts.strictNumbers,Ib.DataType.Wrong)}`}return pe.nil}function i(){if(r.validateSchema){let a=e.scopeValue("validate$data",{ref:r.validateSchema});return pe._`!${a}(${t})`}return pe.nil}}subschema(e,t){let n=(0,HI.getSubschema)(this.it,e);(0,HI.extendSubschemaData)(n,this.it,e),(0,HI.extendSubschemaMode)(n,e);let r={...this.it,...n,items:void 0,props:void 0};return D4e(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;if(!n.opts.unevaluated)return;if(n.props!==!0&&e.props!==void 0)n.props=Gs.mergeEvaluated.props(r,e.props,n.props,t);if(n.items!==!0&&e.items!==void 0)n.items=Gs.mergeEvaluated.items(r,e.items,n.items,t)}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,pe.Name)),!0}}SJ.KeywordCxt=GI;function _J(e,t,n,r){let o=new GI(e,n,t);if("code"in n)n.code(o,r);else if(o.$data&&n.validate)(0,sh.funcKeywordCode)(o,n);else if("macro"in n)(0,sh.macroKeywordCode)(o,n);else if(n.compile||n.validate)(0,sh.funcKeywordCode)(o,n)}var V4e=/^\/(?:[^~]|~0|~1)*$/,q4e=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function yJ(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let o,s;if(e==="")return be.default.rootData;if(e[0]==="/"){if(!V4e.test(e))throw Error(`Invalid JSON-pointer: ${e}`);o=e,s=be.default.rootData}else{let l=q4e.exec(e);if(!l)throw Error(`Invalid JSON-pointer: ${e}`);let u=+l[1];if(o=l[2],o==="#"){if(u>=t)throw Error(c("property/index",u));return r[t-u]}if(u>t)throw Error(c("data",u));if(s=n[t-u],!o)return s}let i=s,a=o.split("/");for(let l of a)if(l)s=pe._`${s}${(0,pe.getProperty)((0,Gs.unescapeJsonPointer)(l))}`,i=pe._`${i} && ${s}`;return i;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${t}`}}SJ.getData=yJ});var Db=T(function(xJ){Object.defineProperty(xJ,"__esModule",{value:!0});class EJ extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}xJ.default=EJ});var ah=T(function(wJ){Object.defineProperty(wJ,"__esModule",{value:!0});var WI=rh();class vJ extends Error{constructor(e,t,n,r){super(r||`can't resolve reference ${n} from id ${t}`);this.missingRef=(0,WI.resolveUrl)(e,t,n),this.missingSchema=(0,WI.normalizeId)((0,WI.getFullPath)(e,this.missingRef))}}wJ.default=vJ});var Nb=T(function(CJ){Object.defineProperty(CJ,"__esModule",{value:!0});CJ.resolveSchema=CJ.getCompilingSchema=CJ.resolveRef=CJ.compileSchema=CJ.SchemaEnv=void 0;var No=Pe(),Q4e=Db(),_c=Ks(),Mo=rh(),AJ=We(),e6e=ih();class ch{constructor(e){var t;this.refs={},this.dynamicAnchors={};let n;if(typeof e.schema=="object")n=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:(0,Mo.normalizeId)(n===null||n===void 0?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n===null||n===void 0?void 0:n.$async,this.refs={}}}CJ.SchemaEnv=ch;function qI(e){let t=TJ.call(this,e);if(t)return t;let n=(0,Mo.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:r,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new No.CodeGen(this.scope,{es5:r,lines:o,ownProperties:s}),a;if(e.$async)a=i.scopeValue("Error",{ref:Q4e.default,code:No._`require("ajv/dist/runtime/validation_error").default`});let c=i.scopeName("validate");e.validateName=c;let l={gen:i,allErrors:this.opts.allErrors,data:_c.default.data,parentData:_c.default.parentData,parentDataProperty:_c.default.parentDataProperty,dataNames:[_c.default.data],dataPathArr:[No.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,No.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:No.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:No._`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),(0,e6e.validateFunctionCode)(l),i.optimize(this.opts.code.optimize);let p=i.toString();if(u=`${i.scopeRefs(_c.default.scope)}return ${p}`,this.opts.code.process)u=this.opts.code.process(u,e);let m=Function(`${_c.default.self}`,`${_c.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async)m.$async=!0;if(this.opts.code.source===!0)m.source={validateName:c,validateCode:p,scopeValues:i._values};if(this.opts.unevaluated){let{props:h,items:y}=l;if(m.evaluated={props:h instanceof No.Name?void 0:h,items:y instanceof No.Name?void 0:y,dynamicProps:h instanceof No.Name,dynamicItems:y instanceof No.Name},m.source)m.source.evaluated=(0,No.stringify)(m.evaluated)}return e.validate=m,e}catch(p){if(delete e.validate,delete e.validateName,u)this.logger.error("Error compiling schema, function code:",u);throw p}finally{this._compilations.delete(e)}}CJ.compileSchema=qI;function t6e(e,t,n){var r;n=(0,Mo.resolveUrl)(this.opts.uriResolver,t,n);let o=e.refs[n];if(o)return o;let s=o6e.call(this,e,n);if(s===void 0){let i=(r=e.localRefs)===null||r===void 0?void 0:r[n],{schemaId:a}=this.opts;if(i)s=new ch({schema:i,schemaId:a,root:e,baseId:t})}if(s===void 0)return;return e.refs[n]=n6e.call(this,s)}CJ.resolveRef=t6e;function n6e(e){if((0,Mo.inlineRef)(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:qI.call(this,e)}function TJ(e){for(let t of this._compilations)if(r6e(t,e))return t}CJ.getCompilingSchema=TJ;function r6e(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function o6e(e,t){let n;while(typeof(n=this.refs[t])=="string")t=n;return n||this.schemas[t]||Lb.call(this,e,t)}function Lb(e,t){let n=this.opts.uriResolver.parse(t),r=(0,Mo._getFullPath)(this.opts.uriResolver,n),o=(0,Mo.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===o)return VI.call(this,n,e);let s=(0,Mo.normalizeId)(r),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=Lb.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return VI.call(this,n,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)qI.call(this,i);if(s===(0,Mo.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,l=a[c];if(l)o=(0,Mo.resolveUrl)(this.opts.uriResolver,o,l);return new ch({schema:a,schemaId:c,root:e,baseId:o})}return VI.call(this,n,i)}CJ.resolveSchema=Lb;var s6e=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function VI(e,{baseId:t,schema:n,root:r}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof n==="boolean")return;let c=n[(0,AJ.unescapeFragment)(a)];if(c===void 0)return;n=c;let l=typeof n==="object"&&n[this.opts.schemaId];if(!s6e.has(a)&&l)t=(0,Mo.resolveUrl)(this.opts.uriResolver,t,l)}let s;if(typeof n!="boolean"&&n.$ref&&!(0,AJ.schemaHasRulesButRef)(n,this.RULES)){let a=(0,Mo.resolveUrl)(this.opts.uriResolver,t,n.$ref);s=Lb.call(this,r,a)}let{schemaId:i}=this.opts;if(s=s||new ch({schema:n,schemaId:i,root:r,baseId:t}),s.schema!==s.root.schema)return s;return}});var RJ=T(function(Mjt,u6e){u6e.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var JI=T(function(Ujt,NJ){var d6e=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),PJ=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),ZI=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),IJ=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),p6e=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function YI(e){let t="",n=0,r=0;for(r=0;r<e.length;r++){if(n=e[r].charCodeAt(0),n===48)continue;if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r]}return t}var f6e=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function OJ(e){return e.length=0,!0}function m6e(e,t,n){if(e.length){let r=YI(e);if(r!=="")t.push(r);else return n.error=!0,!1;e.length=0}return!0}function h6e(e){let t=0,n={error:!1,address:"",zone:""},r=[],o=[],s=!1,i=!1,a=m6e;for(let c=0;c<e.length;c++){let l=e[c];if(l==="["||l==="]")continue;if(l===":"){if(s===!0)i=!0;if(!a(o,r,n))break;if(++t>7){n.error=!0;break}if(c>0&&e[c-1]===":")s=!0;r.push(":");continue}else if(l==="%"){if(!a(o,r,n))break;a=OJ}else{o.push(l);continue}}if(o.length)if(a===OJ)n.zone=o.join("");else if(i)r.push(o.join(""));else r.push(YI(o));return n.address=r.join(""),n}function DJ(e){if(g6e(e,":")<2)return{host:e,isIPV6:!1};let t=h6e(e);if(!t.error){let{address:n,address:r}=t;if(t.zone)n+="%"+t.zone,r+="%25"+t.zone;return{host:n,isIPV6:!0,escapedHost:r}}else return{host:e,isIPV6:!1}}function g6e(e,t){let n=0;for(let r=0;r<e.length;r++)if(e[r]===t)n++;return n}function _6e(e){let t=e,n=[],r=-1,o=0;while(o=t.length){if(o===1)if(t===".")break;else if(t==="/"){n.push("/");break}else{n.push(t);break}else if(o===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){n.push("/");break}}}else if(o===3){if(t==="/.."){if(n.length!==0)n.pop();n.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),n.length!==0)n.pop();continue}}}}if((r=t.indexOf("/",1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join("")}var y6e={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},S6e=/[@/?#:]/g,b6e=/[@/?#]/g;function LJ(e,t){let n=t?b6e:S6e;return n.lastIndex=0,e.replace(n,(r)=>y6e[r])}function E6e(e,t=!1){if(e.indexOf("%")===-1)return e;let n="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(ZI(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(t&&IJ(i))n+=i;else n+="%"+s;r+=2;continue}}n+=e[r]}return n}function x6e(e){let t="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let r=e.slice(n+1,n+3);if(ZI(r)){let o=r.toUpperCase(),s=String.fromCharCode(parseInt(o,16));if(s!=="."&&IJ(s))t+=s;else t+="%"+o;n+=2;continue}}if(p6e(e[n]))t+=e[n];else t+=escape(e[n])}return t}function v6e(e){let t="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let r=e.slice(n+1,n+3);if(ZI(r)){t+="%"+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function w6e(e){let t=[];if(e.userinfo!==void 0)t.push(e.userinfo),t.push("@");if(e.host!==void 0){let n=unescape(e.host);if(!PJ(n)){let r=DJ(n);if(r.isIPV6===!0)n=`[${r.escapedHost}]`;else n=LJ(n,!1)}t.push(n)}if(typeof e.port==="number"||typeof e.port==="string")t.push(":"),t.push(String(e.port));return t.length?t.join(""):void 0}NJ.exports={nonSimpleDomain:f6e,recomposeAuthority:w6e,reescapeHostDelimiters:LJ,normalizePercentEncoding:E6e,normalizePathEncoding:x6e,escapePreservingEscapes:v6e,removeDotSegments:_6e,isIPv4:PJ,isUUID:d6e,normalizeIPv6:DJ,stringArrayToHexStripped:YI}});var zJ=T(function(Fjt,$J){var{isUUID:A6e}=JI(),T6e=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,C6e=["http","https","ws","wss","urn","urn:uuid"];function k6e(e){return C6e.indexOf(e)!==-1}function XI(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function MJ(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function UJ(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function R6e(e){return e.secure=XI(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function O6e(e){if(e.port===(XI(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let[t,n]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}function P6e(e,t){if(!e.path)return e.error="URN can not be parsed",e;let n=e.path.match(T6e);if(n){let r=t.scheme||e.scheme||"urn";e.nid=n[1].toLowerCase(),e.nss=n[2];let o=`${r}:${t.nid||e.nid}`,s=QI(o);if(e.path=void 0,s)e=s.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function I6e(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let n=t.scheme||e.scheme||"urn",r=e.nid.toLowerCase(),o=`${n}:${t.nid||r}`,s=QI(o);if(s)e=s.serialize(e,t);let i=e,a=e.nss;return i.path=`${r||t.nid}:${a}`,t.skipEscape=!0,i}function D6e(e,t){let n=e;if(n.uuid=n.nss,n.nss=void 0,!t.tolerant&&(!n.uuid||!A6e(n.uuid)))n.error=n.error||"UUID is not valid.";return n}function L6e(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var FJ={scheme:"http",domainHost:!0,parse:MJ,serialize:UJ},N6e={scheme:"https",domainHost:FJ.domainHost,parse:MJ,serialize:UJ},Mb={scheme:"ws",domainHost:!0,parse:R6e,serialize:O6e},M6e={scheme:"wss",domainHost:Mb.domainHost,parse:Mb.parse,serialize:Mb.serialize},U6e={scheme:"urn",parse:P6e,serialize:I6e,skipNormalize:!0},F6e={scheme:"urn:uuid",parse:D6e,serialize:L6e,skipNormalize:!0},Ub={http:FJ,https:N6e,ws:Mb,wss:M6e,urn:U6e,"urn:uuid":F6e};Object.setPrototypeOf(Ub,null);function QI(e){return e&&(Ub[e]||Ub[e.toLowerCase()])||void 0}$J.exports={wsIsSecure:XI,SCHEMES:Ub,isValidSchemeName:k6e,getSchemeHandler:QI}});var WJ=T(function($jt,Fb){var{normalizeIPv6:$6e,removeDotSegments:lh,recomposeAuthority:z6e,normalizePercentEncoding:j6e,normalizePathEncoding:H6e,escapePreservingEscapes:B6e,reescapeHostDelimiters:K6e,isIPv4:G6e,nonSimpleDomain:W6e}=JI(),{SCHEMES:V6e,getSchemeHandler:HJ}=zJ();function q6e(e,t){if(typeof e==="string")e=Q6e(e,t);else if(typeof e==="object")e=ud(yc(e,t),t);return e}function Z6e(e,t,n){let r=n?Object.assign({scheme:"null"},n):{scheme:"null"},o=BJ(ud(e,r),ud(t,r),r,!0);return r.skipEscape=!0,yc(o,r)}function BJ(e,t,n,r){let o={};if(!r)e=ud(yc(e,n),n),t=ud(yc(t,n),n);if(n=n||{},!n.tolerant&&t.scheme)o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=lh(t.path||""),o.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=lh(t.path||""),o.query=t.query;else{if(!t.path)if(o.path=e.path,t.query!==void 0)o.query=t.query;else o.query=e.query;else{if(t.path[0]==="/")o.path=lh(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)o.path="/"+t.path;else if(!e.path)o.path=t.path;else o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;o.path=lh(o.path)}o.query=t.query}o.userinfo=e.userinfo,o.host=e.host,o.port=e.port}o.scheme=e.scheme}return o.fragment=t.fragment,o}function Y6e(e,t,n){let r=jJ(e,n),o=jJ(t,n);return r!==void 0&&o!==void 0&&r.toLowerCase()===o.toLowerCase()}function yc(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},r=Object.assign({},t),o=[],s=HJ(r.scheme||n.scheme);if(s&&s.serialize)s.serialize(n,r);if(n.path!==void 0)if(!r.skipEscape){if(n.path=B6e(n.path),n.scheme!==void 0)n.path=n.path.split("%3A").join(":")}else n.path=j6e(n.path);if(r.reference!=="suffix"&&n.scheme)o.push(n.scheme,":");let i=z6e(n);if(i!==void 0){if(r.reference!=="suffix")o.push("//");if(o.push(i),n.path&&n.path[0]!=="/")o.push("/")}if(n.path!==void 0){let a=n.path;if(!r.absolutePath&&(!s||!s.absolutePath))a=lh(a);if(i===void 0&&a[0]==="/"&&a[1]==="/")a="/%2F"+a.slice(2);o.push(a)}if(n.query!==void 0)o.push("?",n.query);if(n.fragment!==void 0)o.push("#",n.fragment);return o.join("")}var J6e=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function X6e(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function KJ(e,t){let n=Object.assign({},t),r={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,s=!1;if(n.reference==="suffix")if(n.scheme)e=n.scheme+":"+e;else e="//"+e;let i=e.match(J6e);if(i){if(r.scheme=i[1],r.userinfo=i[3],r.host=i[4],r.port=parseInt(i[5],10),r.path=i[6]||"",r.query=i[7],r.fragment=i[8],isNaN(r.port))r.port=i[5];let a=X6e(r,i);if(a!==void 0)r.error=r.error||a,o=!0;if(r.host)if(G6e(r.host)===!1){let u=$6e(r.host);r.host=u.host.toLowerCase(),s=u.isIPV6}else s=!0;if(r.scheme===void 0&&r.userinfo===void 0&&r.host===void 0&&r.port===void 0&&r.query===void 0&&!r.path)r.reference="same-document";else if(r.scheme===void 0)r.reference="relative";else if(r.fragment===void 0)r.reference="absolute";else r.reference="uri";if(n.reference&&n.reference!=="suffix"&&n.reference!==r.reference)r.error=r.error||"URI is not a "+n.reference+" reference.";let c=HJ(n.scheme||r.scheme);if(!n.unicodeSupport&&(!c||!c.unicodeSupport)){if(r.host&&(n.domainHost||c&&c.domainHost)&&s===!1&&W6e(r.host))try{r.host=URL.domainToASCII(r.host.toLowerCase())}catch(l){r.error=r.error||"Host's domain name can not be converted to ASCII: "+l}}if(!c||c&&!c.skipNormalize){if(e.indexOf("%")!==-1){if(r.scheme!==void 0)r.scheme=unescape(r.scheme);if(r.host!==void 0)r.host=K6e(unescape(r.host),s)}if(r.path)r.path=H6e(r.path);if(r.fragment)try{r.fragment=encodeURI(decodeURIComponent(r.fragment))}catch{r.error=r.error||"URI malformed"}}if(c&&c.parse)c.parse(r,n)}else r.error=r.error||"URI can not be parsed.";return{parsed:r,malformedAuthorityOrPort:o}}function ud(e,t){return KJ(e,t).parsed}function Q6e(e,t){return GJ(e,t).normalized}function GJ(e,t){let{parsed:n,malformedAuthorityOrPort:r}=KJ(e,t);return{normalized:r?e:yc(n,t),malformedAuthorityOrPort:r}}function jJ(e,t){if(typeof e==="string"){let{normalized:n,malformedAuthorityOrPort:r}=GJ(e,t);return r?void 0:n}if(typeof e==="object")return yc(e,t)}var eD={SCHEMES:V6e,normalize:q6e,resolve:Z6e,resolveComponent:BJ,equal:Y6e,serialize:yc,parse:ud};Fb.exports=eD;Fb.exports.default=eD;Fb.exports.fastUri=eD});var ZJ=T(function(qJ){Object.defineProperty(qJ,"__esModule",{value:!0});var VJ=WJ();VJ.code='require("ajv/dist/runtime/uri").default';qJ.default=VJ});var r5=T(function(Ws){Object.defineProperty(Ws,"__esModule",{value:!0});Ws.CodeGen=Ws.Name=Ws.nil=Ws.stringify=Ws.str=Ws._=Ws.KeywordCxt=void 0;var t3e=ih();Object.defineProperty(Ws,"KeywordCxt",{enumerable:!0,get:function(){return t3e.KeywordCxt}});var dd=Pe();Object.defineProperty(Ws,"_",{enumerable:!0,get:function(){return dd._}});Object.defineProperty(Ws,"str",{enumerable:!0,get:function(){return dd.str}});Object.defineProperty(Ws,"stringify",{enumerable:!0,get:function(){return dd.stringify}});Object.defineProperty(Ws,"nil",{enumerable:!0,get:function(){return dd.nil}});Object.defineProperty(Ws,"Name",{enumerable:!0,get:function(){return dd.Name}});Object.defineProperty(Ws,"CodeGen",{enumerable:!0,get:function(){return dd.CodeGen}});var n3e=Db(),e5=ah(),r3e=II(),uh=Nb(),o3e=Pe(),dh=rh(),$b=nh(),nD=We(),YJ=RJ(),s3e=ZJ(),t5=(e,t)=>new RegExp(e,t);t5.code="new RegExp";var i3e=["removeAdditional","useDefaults","coerceTypes"],a3e=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),c3e={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},l3e={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},JJ=200;function u3e(e){var t,n,r,o,s,i,a,c,l,u,p,f,m,h,y,_,E,S,x,v,w,U,L,F,K;let ne=e.strict,se=(t=e.code)===null||t===void 0?void 0:t.optimize,X=se===!0||se===void 0?1:se||0,re=(r=(n=e.code)===null||n===void 0?void 0:n.regExp)!==null&&r!==void 0?r:t5,Ie=(o=e.uriResolver)!==null&&o!==void 0?o:s3e.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:ne)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:ne)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=e.strictTypes)!==null&&l!==void 0?l:ne)!==null&&u!==void 0?u:"log",strictTuples:(f=(p=e.strictTuples)!==null&&p!==void 0?p:ne)!==null&&f!==void 0?f:"log",strictRequired:(h=(m=e.strictRequired)!==null&&m!==void 0?m:ne)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:X,regExp:re}:{optimize:X,regExp:re},loopRequired:(y=e.loopRequired)!==null&&y!==void 0?y:JJ,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:JJ,meta:(E=e.meta)!==null&&E!==void 0?E:!0,messages:(S=e.messages)!==null&&S!==void 0?S:!0,inlineRefs:(x=e.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(v=e.schemaId)!==null&&v!==void 0?v:"$id",addUsedSchema:(w=e.addUsedSchema)!==null&&w!==void 0?w:!0,validateSchema:(U=e.validateSchema)!==null&&U!==void 0?U:!0,validateFormats:(L=e.validateFormats)!==null&&L!==void 0?L:!0,unicodeRegExp:(F=e.unicodeRegExp)!==null&&F!==void 0?F:!0,int32range:(K=e.int32range)!==null&&K!==void 0?K:!0,uriResolver:Ie}}class zb{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...u3e(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new o3e.ValueScope({scope:{},prefixes:a3e,es5:t,lines:n}),this.logger=g3e(e.logger);let r=e.validateFormats;if(e.validateFormats=!1,this.RULES=(0,r3e.getRules)(),XJ.call(this,c3e,e,"NOT SUPPORTED"),XJ.call(this,l3e,e,"DEPRECATED","warn"),this._metaOpts=m3e.call(this),e.formats)p3e.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)f3e.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);d3e.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=YJ;if(n==="id")r={...YJ},r.id=r.$id,delete r.$id;if(t&&e)this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);if(!("$async"in n))this.errors=n.errors;return r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(l,u){await o.call(this,l.$schema);let p=this._addSchema(l,u);return p.validate||s.call(this,p)}async function o(l){if(l&&!this.getSchema(l))await r.call(this,{$ref:l},!0)}async function s(l){try{return this._compileSchemaEnv(l)}catch(u){if(!(u instanceof e5.default))throw u;return i.call(this,u),await a.call(this,u.missingSchema),s.call(this,l)}}function i({missingSchema:l,missingRef:u}){if(this.refs[l])throw Error(`AnySchema ${l} is loaded but ${u} cannot be resolved`)}async function a(l){let u=await c.call(this,l);if(!this.refs[l])await o.call(this,u.$schema);if(!this.refs[l])this.addSchema(u,l,t)}async function c(l){let u=this._loading[l];if(u)return u;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,n,r);return this}let o;if(typeof e==="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw Error(`schema ${s} must be string`)}return t=(0,dh.normalizeId)(t||o),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw Error(o)}return r}getSchema(e){let t;while(typeof(t=QJ.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new uh.SchemaEnv({schema:{},schemaId:n});if(t=uh.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=QJ.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];if(n)n=(0,dh.normalizeId)(n),delete this.schemas[n],delete this.refs[n];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e=="string"){if(n=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n}else if(typeof e=="object"&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(y3e.call(this,n,t),!t)return(0,nD.eachItem)(n,(o)=>tD.call(this,o)),this;b3e.call(this,t);let r={...t,type:(0,$b.getJSONTypes)(t.type),schemaType:(0,$b.getJSONTypes)(t.schemaType)};return(0,nD.eachItem)(n,r.type.length===0?(o)=>tD.call(this,o,r):(o)=>r.type.forEach((s)=>tD.call(this,o,r,s))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let r=n.rules.findIndex((o)=>o.keyword===e);if(r>=0)n.rules.splice(r,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:n="data"}={}){if(!e||e.length===0)return"No errors";return e.map((r)=>`${n}${r.instancePath} ${r.message}`).reduce((r,o)=>r+t+o)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let o=r.split("/").slice(1),s=e;for(let i of o)s=s[i];for(let i in n){let a=n[i];if(typeof a!="object")continue;let{$data:c}=a.definition,l=s[i];if(c&&l)s[i]=n5(l)}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];if(!t||t.test(n)){if(typeof r=="string")delete e[n];else if(r&&!r.meta)this._cache.delete(r.schema),delete e[n]}}}_addSchema(e,t,n,r=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:i}=this.opts;if(typeof e=="object")s=e[i];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;n=(0,dh.normalizeId)(s||n);let c=dh.getSchemaRefs.call(this,e,n);if(a=new uh.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:n,localRefs:c}),this._cache.set(a.schema,a),o&&!n.startsWith("#")){if(n)this._checkUnique(n);this.refs[n]=a}if(r)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else uh.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{uh.compileSchema.call(this,e)}finally{this.opts=t}}}zb.ValidationError=n3e.default;zb.MissingRefError=e5.default;Ws.default=zb;function XJ(e,t,n,r="error"){for(let o in e){let s=o;if(s in t)this.logger[r](`${n}: option ${o}. ${e[s]}`)}}function QJ(e){return e=(0,dh.normalizeId)(e),this.schemas[e]||this.refs[e]}function d3e(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function p3e(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function f3e(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let n=e[t];if(!n.keyword)n.keyword=t;this.addKeyword(n)}}function m3e(){let e={...this.opts};for(let t of i3e)delete e[t];return e}var h3e={log(){},warn(){},error(){}};function g3e(e){if(e===!1)return h3e;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var _3e=/^[a-z_$][a-z0-9_$:-]*$/i;function y3e(e,t){let{RULES:n}=this;if((0,nD.eachItem)(e,(r)=>{if(n.keywords[r])throw Error(`Keyword ${r} is already defined`);if(!_3e.test(r))throw Error(`Keyword ${r} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function tD(e,t,n){var r;let o=t===null||t===void 0?void 0:t.post;if(n&&o)throw Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===n);if(!i)i={type:n,rules:[]},s.rules.push(i);if(s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,$b.getJSONTypes)(t.type),schemaType:(0,$b.getJSONTypes)(t.schemaType)}};if(t.before)S3e.call(this,i,a,t.before);else i.rules.push(a);s.all[e]=a,(r=t.implements)===null||r===void 0||r.forEach((c)=>this.addKeyword(c))}function S3e(e,t,n){let r=e.rules.findIndex((o)=>o.keyword===n);if(r>=0)e.rules.splice(r,0,t);else e.rules.push(t),this.logger.warn(`rule ${n} is not defined`)}function b3e(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=n5(t);e.validateSchema=this.compile(t,!0)}var E3e={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function n5(e){return{anyOf:[e,E3e]}}});var s5=T(function(o5){Object.defineProperty(o5,"__esModule",{value:!0});var w3e={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};o5.default=w3e});var d5=T(function(l5){Object.defineProperty(l5,"__esModule",{value:!0});l5.callRef=l5.getValidate=void 0;var T3e=ah(),i5=Xr(),ur=Pe(),pd=Ks(),a5=Nb(),jb=We(),C3e={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:n,it:r}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=r,{root:l}=s;if((n==="#"||n==="#/")&&o===l.baseId)return p();let u=a5.resolveRef.call(c,l,o,n);if(u===void 0)throw new T3e.default(r.opts.uriResolver,o,n);if(u instanceof a5.SchemaEnv)return f(u);return m(u);function p(){if(s===l)return Hb(e,i,s,s.$async);let h=t.scopeValue("root",{ref:l});return Hb(e,ur._`${h}.validate`,l,l.$async)}function f(h){let y=c5(e,h);Hb(e,y,h,h.$async)}function m(h){let y=t.scopeValue("schema",a.code.source===!0?{ref:h,code:(0,ur.stringify)(h)}:{ref:h}),_=t.name("valid"),E=e.subschema({schema:h,dataTypes:[],schemaPath:ur.nil,topSchemaRef:y,errSchemaPath:n},_);e.mergeEvaluated(E),e.ok(_)}}};function c5(e,t){let{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):ur._`${n.scopeValue("wrapper",{ref:t})}.validate`}l5.getValidate=c5;function Hb(e,t,n,r){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,l=c.passContext?pd.default.this:ur.nil;if(r)u();else p();function u(){if(!a.$async)throw Error("async schema referenced by sync schema");let h=o.let("valid");o.try(()=>{if(o.code(ur._`await ${(0,i5.callValidateCode)(e,t,l)}`),m(t),!i)o.assign(h,!0)},(y)=>{if(o.if(ur._`!(${y} instanceof ${s.ValidationError})`,()=>o.throw(y)),f(y),!i)o.assign(h,!1)}),e.ok(h)}function p(){e.result((0,i5.callValidateCode)(e,t,l),()=>m(t),()=>f(t))}function f(h){let y=ur._`${h}.errors`;o.assign(pd.default.vErrors,ur._`${pd.default.vErrors} === null ? ${y} : ${pd.default.vErrors}.concat(${y})`),o.assign(pd.default.errors,ur._`${pd.default.vErrors}.length`)}function m(h){var y;if(!s.opts.unevaluated)return;let _=(y=n===null||n===void 0?void 0:n.validate)===null||y===void 0?void 0:y.evaluated;if(s.props!==!0)if(_&&!_.dynamicProps){if(_.props!==void 0)s.props=jb.mergeEvaluated.props(o,_.props,s.props)}else{let E=o.var("props",ur._`${h}.evaluated.props`);s.props=jb.mergeEvaluated.props(o,E,s.props,ur.Name)}if(s.items!==!0)if(_&&!_.dynamicItems){if(_.items!==void 0)s.items=jb.mergeEvaluated.items(o,_.items,s.items)}else{let E=o.var("items",ur._`${h}.evaluated.items`);s.items=jb.mergeEvaluated.items(o,E,s.items,ur.Name)}}}l5.callRef=Hb;l5.default=C3e});var f5=T(function(p5){Object.defineProperty(p5,"__esModule",{value:!0});var O3e=s5(),P3e=d5(),I3e=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",O3e.default,P3e.default];p5.default=I3e});var h5=T(function(m5){Object.defineProperty(m5,"__esModule",{value:!0});var Bb=Pe(),Yi=Bb.operators,Kb={maximum:{okStr:"<=",ok:Yi.LTE,fail:Yi.GT},minimum:{okStr:">=",ok:Yi.GTE,fail:Yi.LT},exclusiveMaximum:{okStr:"<",ok:Yi.LT,fail:Yi.GTE},exclusiveMinimum:{okStr:">",ok:Yi.GT,fail:Yi.LTE}},L3e={message:({keyword:e,schemaCode:t})=>Bb.str`must be ${Kb[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Bb._`{comparison: ${Kb[e].okStr}, limit: ${t}}`},N3e={keyword:Object.keys(Kb),type:"number",schemaType:"number",$data:!0,error:L3e,code(e){let{keyword:t,data:n,schemaCode:r}=e;e.fail$data(Bb._`${n} ${Kb[t].fail} ${r} || isNaN(${n})`)}};m5.default=N3e});var _5=T(function(g5){Object.defineProperty(g5,"__esModule",{value:!0});var ph=Pe(),U3e={message:({schemaCode:e})=>ph.str`must be multiple of ${e}`,params:({schemaCode:e})=>ph._`{multipleOf: ${e}}`},F3e={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:U3e,code(e){let{gen:t,data:n,schemaCode:r,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?ph._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:ph._`${i} !== parseInt(${i})`;e.fail$data(ph._`(${r} === 0 || (${i} = ${n}/${r}, ${a}))`)}};g5.default=F3e});var b5=T(function(S5){Object.defineProperty(S5,"__esModule",{value:!0});function y5(e){let t=e.length,n=0,r=0,o;while(r<t)if(n++,o=e.charCodeAt(r++),o>=55296&&o<=56319&&r<t){if(o=e.charCodeAt(r),(o&64512)===56320)r++}return n}S5.default=y5;y5.code='require("ajv/dist/runtime/ucs2length").default'});var x5=T(function(E5){Object.defineProperty(E5,"__esModule",{value:!0});var Sc=Pe(),j3e=We(),H3e=b5(),B3e={message({keyword:e,schemaCode:t}){let n=e==="maxLength"?"more":"fewer";return Sc.str`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>Sc._`{limit: ${e}}`},K3e={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:B3e,code(e){let{keyword:t,data:n,schemaCode:r,it:o}=e,s=t==="maxLength"?Sc.operators.GT:Sc.operators.LT,i=o.opts.unicode===!1?Sc._`${n}.length`:Sc._`${(0,j3e.useFunc)(e.gen,H3e.default)}(${n})`;e.fail$data(Sc._`${i} ${s} ${r}`)}};E5.default=K3e});var w5=T(function(v5){Object.defineProperty(v5,"__esModule",{value:!0});var W3e=Xr(),V3e=We(),fd=Pe(),q3e={message:({schemaCode:e})=>fd.str`must match pattern "${e}"`,params:({schemaCode:e})=>fd._`{pattern: ${e}}`},Z3e={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:q3e,code(e){let{gen:t,data:n,$data:r,schema:o,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(r){let{regExp:c}=i.opts.code,l=c.code==="new RegExp"?fd._`new RegExp`:(0,V3e.useFunc)(t,c),u=t.let("valid");t.try(()=>t.assign(u,fd._`${l}(${s}, ${a}).test(${n})`),()=>t.assign(u,!1)),e.fail$data(fd._`!${u}`)}else{let c=(0,W3e.usePattern)(e,o);e.fail$data(fd._`!${c}.test(${n})`)}}};v5.default=Z3e});var T5=T(function(A5){Object.defineProperty(A5,"__esModule",{value:!0});var fh=Pe(),J3e={message({keyword:e,schemaCode:t}){let n=e==="maxProperties"?"more":"fewer";return fh.str`must NOT have ${n} than ${t} properties`},params:({schemaCode:e})=>fh._`{limit: ${e}}`},X3e={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:J3e,code(e){let{keyword:t,data:n,schemaCode:r}=e,o=t==="maxProperties"?fh.operators.GT:fh.operators.LT;e.fail$data(fh._`Object.keys(${n}).length ${o} ${r}`)}};A5.default=X3e});var k5=T(function(C5){Object.defineProperty(C5,"__esModule",{value:!0});var mh=Xr(),hh=Pe(),eZe=We(),tZe={message:({params:{missingProperty:e}})=>hh.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>hh._`{missingProperty: ${e}}`},nZe={keyword:"required",type:"object",schemaType:"array",$data:!0,error:tZe,code(e){let{gen:t,schema:n,schemaCode:r,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&n.length===0)return;let c=n.length>=a.loopRequired;if(i.allErrors)l();else u();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:h}=e.it;for(let y of n)if((m===null||m===void 0?void 0:m[y])===void 0&&!h.has(y)){let _=i.schemaEnv.baseId+i.errSchemaPath,E=`required property "${y}" is not defined at "${_}" (strictRequired)`;(0,eZe.checkStrictMode)(i,E,i.opts.strictRequired)}}function l(){if(c||s)e.block$data(hh.nil,p);else for(let m of n)(0,mh.checkReportMissingProp)(e,m)}function u(){let m=t.let("missing");if(c||s){let h=t.let("valid",!0);e.block$data(h,()=>f(m,h)),e.ok(h)}else t.if((0,mh.checkMissingProp)(e,n,m)),(0,mh.reportMissingProp)(e,m),t.else()}function p(){t.forOf("prop",r,(m)=>{e.setParams({missingProperty:m}),t.if((0,mh.noPropertyInData)(t,o,m,a.ownProperties),()=>e.error())})}function f(m,h){e.setParams({missingProperty:m}),t.forOf(m,r,()=>{t.assign(h,(0,mh.propertyInData)(t,o,m,a.ownProperties)),t.if((0,hh.not)(h),()=>{e.error(),t.break()})},hh.nil)}}};C5.default=nZe});var O5=T(function(R5){Object.defineProperty(R5,"__esModule",{value:!0});var gh=Pe(),oZe={message({keyword:e,schemaCode:t}){let n=e==="maxItems"?"more":"fewer";return gh.str`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>gh._`{limit: ${e}}`},sZe={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:oZe,code(e){let{keyword:t,data:n,schemaCode:r}=e,o=t==="maxItems"?gh.operators.GT:gh.operators.LT;e.fail$data(gh._`${n}.length ${o} ${r}`)}};R5.default=sZe});var Gb=T(function(I5){Object.defineProperty(I5,"__esModule",{value:!0});var P5=zI();P5.code='require("ajv/dist/runtime/equal").default';I5.default=P5});var L5=T(function(D5){Object.defineProperty(D5,"__esModule",{value:!0});var rD=nh(),xn=Pe(),cZe=We(),lZe=Gb(),uZe={message:({params:{i:e,j:t}})=>xn.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>xn._`{i: ${e}, j: ${t}}`},dZe={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:uZe,code(e){let{gen:t,data:n,$data:r,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!r&&!o)return;let c=t.let("valid"),l=s.items?(0,rD.getSchemaTypes)(s.items):[];e.block$data(c,u,xn._`${i} === false`),e.ok(c);function u(){let h=t.let("i",xn._`${n}.length`),y=t.let("j");e.setParams({i:h,j:y}),t.assign(c,!0),t.if(xn._`${h} > 1`,()=>(p()?f:m)(h,y))}function p(){return l.length>0&&!l.some((h)=>h==="object"||h==="array")}function f(h,y){let _=t.name("item"),E=(0,rD.checkDataTypes)(l,_,a.opts.strictNumbers,rD.DataType.Wrong),S=t.const("indices",xn._`{}`);t.for(xn._`;${h}--;`,()=>{if(t.let(_,xn._`${n}[${h}]`),t.if(E,xn._`continue`),l.length>1)t.if(xn._`typeof ${_} == "string"`,xn._`${_} += "_"`);t.if(xn._`typeof ${S}[${_}] == "number"`,()=>{t.assign(y,xn._`${S}[${_}]`),e.error(),t.assign(c,!1).break()}).code(xn._`${S}[${_}] = ${h}`)})}function m(h,y){let _=(0,cZe.useFunc)(t,lZe.default),E=t.name("outer");t.label(E).for(xn._`;${h}--;`,()=>t.for(xn._`${y} = ${h}; ${y}--;`,()=>t.if(xn._`${_}(${n}[${h}], ${n}[${y}])`,()=>{e.error(),t.assign(c,!1).break(E)})))}}};D5.default=dZe});var M5=T(function(N5){Object.defineProperty(N5,"__esModule",{value:!0});var oD=Pe(),fZe=We(),mZe=Gb(),hZe={message:"must be equal to constant",params:({schemaCode:e})=>oD._`{allowedValue: ${e}}`},gZe={keyword:"const",$data:!0,error:hZe,code(e){let{gen:t,data:n,$data:r,schemaCode:o,schema:s}=e;if(r||s&&typeof s=="object")e.fail$data(oD._`!${(0,fZe.useFunc)(t,mZe.default)}(${n}, ${o})`);else e.fail(oD._`${s} !== ${n}`)}};N5.default=gZe});var F5=T(function(U5){Object.defineProperty(U5,"__esModule",{value:!0});var _h=Pe(),yZe=We(),SZe=Gb(),bZe={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>_h._`{allowedValues: ${e}}`},EZe={keyword:"enum",schemaType:"array",$data:!0,error:bZe,code(e){let{gen:t,data:n,$data:r,schema:o,schemaCode:s,it:i}=e;if(!r&&o.length===0)throw Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,l=()=>c!==null&&c!==void 0?c:c=(0,yZe.useFunc)(t,SZe.default),u;if(a||r)u=t.let("valid"),e.block$data(u,p);else{if(!Array.isArray(o))throw Error("ajv implementation error");let m=t.const("vSchema",s);u=(0,_h.or)(...o.map((h,y)=>f(m,y)))}e.pass(u);function p(){t.assign(u,!1),t.forOf("v",s,(m)=>t.if(_h._`${l()}(${n}, ${m})`,()=>t.assign(u,!0).break()))}function f(m,h){let y=o[h];return typeof y==="object"&&y!==null?_h._`${l()}(${n}, ${m}[${h}])`:_h._`${n} === ${y}`}}};U5.default=EZe});var z5=T(function($5){Object.defineProperty($5,"__esModule",{value:!0});var vZe=h5(),wZe=_5(),AZe=x5(),TZe=w5(),CZe=T5(),kZe=k5(),RZe=O5(),OZe=L5(),PZe=M5(),IZe=F5(),DZe=[vZe.default,wZe.default,AZe.default,TZe.default,CZe.default,kZe.default,RZe.default,OZe.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},PZe.default,IZe.default];$5.default=DZe});var iD=T(function(H5){Object.defineProperty(H5,"__esModule",{value:!0});H5.validateAdditionalItems=void 0;var bc=Pe(),sD=We(),NZe={message:({params:{len:e}})=>bc.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>bc._`{limit: ${e}}`},MZe={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:NZe,code(e){let{parentSchema:t,it:n}=e,{items:r}=t;if(!Array.isArray(r)){(0,sD.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}j5(e,r)}};function j5(e,t){let{gen:n,schema:r,data:o,keyword:s,it:i}=e;i.items=!0;let a=n.const("len",bc._`${o}.length`);if(r===!1)e.setParams({len:t.length}),e.pass(bc._`${a} <= ${t.length}`);else if(typeof r=="object"&&!(0,sD.alwaysValidSchema)(i,r)){let l=n.var("valid",bc._`${a} <= ${t.length}`);n.if((0,bc.not)(l),()=>c(l)),e.ok(l)}function c(l){n.forRange("i",t.length,a,(u)=>{if(e.subschema({keyword:s,dataProp:u,dataPropType:sD.Type.Num},l),!i.allErrors)n.if((0,bc.not)(l),()=>n.break())})}}H5.validateAdditionalItems=j5;H5.default=MZe});var aD=T(function(W5){Object.defineProperty(W5,"__esModule",{value:!0});W5.validateTuple=void 0;var K5=Pe(),Wb=We(),FZe=Xr(),$Ze={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:n}=e;if(Array.isArray(t))return G5(e,"additionalItems",t);if(n.items=!0,(0,Wb.alwaysValidSchema)(n,t))return;e.ok((0,FZe.validateArray)(e))}};function G5(e,t,n=e.schema){let{gen:r,parentSchema:o,data:s,keyword:i,it:a}=e;if(u(o),a.opts.unevaluated&&n.length&&a.items!==!0)a.items=Wb.mergeEvaluated.items(r,n.length,a.items);let c=r.name("valid"),l=r.const("len",K5._`${s}.length`);n.forEach((p,f)=>{if((0,Wb.alwaysValidSchema)(a,p))return;r.if(K5._`${l} > ${f}`,()=>e.subschema({keyword:i,schemaProp:f,dataProp:f},c)),e.ok(c)});function u(p){let{opts:f,errSchemaPath:m}=a,h=n.length,y=h===p.minItems&&(h===p.maxItems||p[t]===!1);if(f.strictTuples&&!y){let _=`"${i}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;(0,Wb.checkStrictMode)(a,_,f.strictTuples)}}}W5.validateTuple=G5;W5.default=$Ze});var Z5=T(function(q5){Object.defineProperty(q5,"__esModule",{value:!0});var jZe=aD(),HZe={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>(0,jZe.validateTuple)(e,"items")};q5.default=HZe});var X5=T(function(J5){Object.defineProperty(J5,"__esModule",{value:!0});var Y5=Pe(),KZe=We(),GZe=Xr(),WZe=iD(),VZe={message:({params:{len:e}})=>Y5.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Y5._`{limit: ${e}}`},qZe={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:VZe,code(e){let{schema:t,parentSchema:n,it:r}=e,{prefixItems:o}=n;if(r.items=!0,(0,KZe.alwaysValidSchema)(r,t))return;if(o)(0,WZe.validateAdditionalItems)(e,o);else e.ok((0,GZe.validateArray)(e))}};J5.default=qZe});var e8=T(function(Q5){Object.defineProperty(Q5,"__esModule",{value:!0});var Qr=Pe(),Vb=We(),YZe={message:({params:{min:e,max:t}})=>t===void 0?Qr.str`must contain at least ${e} valid item(s)`:Qr.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?Qr._`{minContains: ${e}}`:Qr._`{minContains: ${e}, maxContains: ${t}}`},JZe={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:YZe,code(e){let{gen:t,schema:n,parentSchema:r,data:o,it:s}=e,i,a,{minContains:c,maxContains:l}=r;if(s.opts.next)i=c===void 0?1:c,a=l;else i=1;let u=t.const("len",Qr._`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,Vb.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Vb.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Vb.alwaysValidSchema)(s,n)){let y=Qr._`${u} >= ${i}`;if(a!==void 0)y=Qr._`${y} && ${u} <= ${a}`;e.pass(y);return}s.items=!0;let p=t.name("valid");if(a===void 0&&i===1)m(p,()=>t.if(p,()=>t.break()));else if(i===0){if(t.let(p,!0),a!==void 0)t.if(Qr._`${o}.length > 0`,f)}else t.let(p,!1),f();e.result(p,()=>e.reset());function f(){let y=t.name("_valid"),_=t.let("count",0);m(y,()=>t.if(y,()=>h(_)))}function m(y,_){t.forRange("i",0,u,(E)=>{e.subschema({keyword:"contains",dataProp:E,dataPropType:Vb.Type.Num,compositeRule:!0},y),_()})}function h(y){if(t.code(Qr._`${y}++`),a===void 0)t.if(Qr._`${y} >= ${i}`,()=>t.assign(p,!0).break());else if(t.if(Qr._`${y} > ${a}`,()=>t.assign(p,!1).break()),i===1)t.assign(p,!0);else t.if(Qr._`${y} >= ${i}`,()=>t.assign(p,!0))}}};Q5.default=JZe});var i8=T(function(r8){Object.defineProperty(r8,"__esModule",{value:!0});r8.validateSchemaDeps=r8.validatePropertyDeps=r8.error=void 0;var cD=Pe(),QZe=We(),yh=Xr();r8.error={message:({params:{property:e,depsCount:t,deps:n}})=>{let r=t===1?"property":"properties";return cD.str`must have ${r} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:n,missingProperty:r}})=>cD._`{property: ${e},
91
+ missingProperty: ${r},
92
+ depsCount: ${t},
93
+ deps: ${n}}`};var e9e={keyword:"dependencies",type:"object",schemaType:"object",error:r8.error,code(e){let[t,n]=t9e(e);t8(e,t),n8(e,n)}};function t9e({schema:e}){let t={},n={};for(let r in e){if(r==="__proto__")continue;let o=Array.isArray(e[r])?t:n;o[r]=e[r]}return[t,n]}function t8(e,t=e.schema){let{gen:n,data:r,it:o}=e;if(Object.keys(t).length===0)return;let s=n.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=(0,yh.propertyInData)(n,r,i,o.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors)n.if(c,()=>{for(let l of a)(0,yh.checkReportMissingProp)(e,l)});else n.if(cD._`${c} && (${(0,yh.checkMissingProp)(e,a,s)})`),(0,yh.reportMissingProp)(e,s),n.else()}}r8.validatePropertyDeps=t8;function n8(e,t=e.schema){let{gen:n,data:r,keyword:o,it:s}=e,i=n.name("valid");for(let a in t){if((0,QZe.alwaysValidSchema)(s,t[a]))continue;n.if((0,yh.propertyInData)(n,r,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>n.var(i,!0)),e.ok(i)}}r8.validateSchemaDeps=n8;r8.default=e9e});var l8=T(function(c8){Object.defineProperty(c8,"__esModule",{value:!0});var a8=Pe(),o9e=We(),s9e={message:"property name must be valid",params:({params:e})=>a8._`{propertyName: ${e.propertyName}}`},i9e={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:s9e,code(e){let{gen:t,schema:n,data:r,it:o}=e;if((0,o9e.alwaysValidSchema)(o,n))return;let s=t.name("valid");t.forIn("key",r,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,a8.not)(s),()=>{if(e.error(!0),!o.allErrors)t.break()})}),e.ok(s)}};c8.default=i9e});var lD=T(function(u8){Object.defineProperty(u8,"__esModule",{value:!0});var qb=Xr(),Uo=Pe(),c9e=Ks(),Zb=We(),l9e={message:"must NOT have additional properties",params:({params:e})=>Uo._`{additionalProperty: ${e.additionalProperty}}`},u9e={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:l9e,code(e){let{gen:t,schema:n,parentSchema:r,data:o,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Zb.alwaysValidSchema)(i,n))return;let l=(0,qb.allSchemaProperties)(r.properties),u=(0,qb.allSchemaProperties)(r.patternProperties);p(),e.ok(Uo._`${s} === ${c9e.default.errors}`);function p(){t.forIn("key",o,(_)=>{if(!l.length&&!u.length)h(_);else t.if(f(_),()=>h(_))})}function f(_){let E;if(l.length>8){let S=(0,Zb.schemaRefOrVal)(i,r.properties,"properties");E=(0,qb.isOwnProperty)(t,S,_)}else if(l.length)E=(0,Uo.or)(...l.map((S)=>Uo._`${_} === ${S}`));else E=Uo.nil;if(u.length)E=(0,Uo.or)(E,...u.map((S)=>Uo._`${(0,qb.usePattern)(e,S)}.test(${_})`));return(0,Uo.not)(E)}function m(_){t.code(Uo._`delete ${o}[${_}]`)}function h(_){if(c.removeAdditional==="all"||c.removeAdditional&&n===!1){m(_);return}if(n===!1){if(e.setParams({additionalProperty:_}),e.error(),!a)t.break();return}if(typeof n=="object"&&!(0,Zb.alwaysValidSchema)(i,n)){let E=t.name("valid");if(c.removeAdditional==="failing")y(_,E,!1),t.if((0,Uo.not)(E),()=>{e.reset(),m(_)});else if(y(_,E),!a)t.if((0,Uo.not)(E),()=>t.break())}}function y(_,E,S){let x={keyword:"additionalProperties",dataProp:_,dataPropType:Zb.Type.Str};if(S===!1)Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(x,E)}}};u8.default=u9e});var m8=T(function(f8){Object.defineProperty(f8,"__esModule",{value:!0});var p9e=ih(),d8=Xr(),uD=We(),p8=lD(),f9e={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,parentSchema:r,data:o,it:s}=e;if(s.opts.removeAdditional==="all"&&r.additionalProperties===void 0)p8.default.code(new p9e.KeywordCxt(s,p8.default,"additionalProperties"));let i=(0,d8.allSchemaProperties)(n);for(let p of i)s.definedProperties.add(p);if(s.opts.unevaluated&&i.length&&s.props!==!0)s.props=uD.mergeEvaluated.props(t,(0,uD.toHash)(i),s.props);let a=i.filter((p)=>!(0,uD.alwaysValidSchema)(s,n[p]));if(a.length===0)return;let c=t.name("valid");for(let p of a){if(l(p))u(p);else{if(t.if((0,d8.propertyInData)(t,o,p,s.opts.ownProperties)),u(p),!s.allErrors)t.else().var(c,!0);t.endIf()}e.it.definedProperties.add(p),e.ok(c)}function l(p){return s.opts.useDefaults&&!s.compositeRule&&n[p].default!==void 0}function u(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},c)}}};f8.default=f9e});var S8=T(function(y8){Object.defineProperty(y8,"__esModule",{value:!0});var h8=Xr(),Yb=Pe(),g8=We(),_8=We(),h9e={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,data:r,parentSchema:o,it:s}=e,{opts:i}=s,a=(0,h8.allSchemaProperties)(n),c=a.filter((y)=>(0,g8.alwaysValidSchema)(s,n[y]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let l=i.strictSchema&&!i.allowMatchingProperties&&o.properties,u=t.name("valid");if(s.props!==!0&&!(s.props instanceof Yb.Name))s.props=(0,_8.evaluatedPropsToName)(t,s.props);let{props:p}=s;f();function f(){for(let y of a){if(l)m(y);if(s.allErrors)h(y);else t.var(u,!0),h(y),t.if(u)}}function m(y){for(let _ in l)if(new RegExp(y).test(_))(0,g8.checkStrictMode)(s,`property ${_} matches pattern ${y} (use allowMatchingProperties)`)}function h(y){t.forIn("key",r,(_)=>{t.if(Yb._`${(0,h8.usePattern)(e,y)}.test(${_})`,()=>{let E=c.includes(y);if(!E)e.subschema({keyword:"patternProperties",schemaProp:y,dataProp:_,dataPropType:_8.Type.Str},u);if(s.opts.unevaluated&&p!==!0)t.assign(Yb._`${p}[${_}]`,!0);else if(!E&&!s.allErrors)t.if((0,Yb.not)(u),()=>t.break())})})}}};y8.default=h9e});var E8=T(function(b8){Object.defineProperty(b8,"__esModule",{value:!0});var _9e=We(),y9e={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:n,it:r}=e;if((0,_9e.alwaysValidSchema)(r,n)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};b8.default=y9e});var v8=T(function(x8){Object.defineProperty(x8,"__esModule",{value:!0});var b9e=Xr(),E9e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:b9e.validateUnion,error:{message:"must match a schema in anyOf"}};x8.default=E9e});var A8=T(function(w8){Object.defineProperty(w8,"__esModule",{value:!0});var Jb=Pe(),v9e=We(),w9e={message:"must match exactly one schema in oneOf",params:({params:e})=>Jb._`{passingSchemas: ${e.passing}}`},A9e={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:w9e,code(e){let{gen:t,schema:n,parentSchema:r,it:o}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(o.opts.discriminator&&r.discriminator)return;let s=n,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(l),e.result(i,()=>e.reset(),()=>e.error(!0));function l(){s.forEach((u,p)=>{let f;if((0,v9e.alwaysValidSchema)(o,u))t.var(c,!0);else f=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},c);if(p>0)t.if(Jb._`${c} && ${i}`).assign(i,!1).assign(a,Jb._`[${a}, ${p}]`).else();t.if(c,()=>{if(t.assign(i,!0),t.assign(a,p),f)e.mergeEvaluated(f,Jb.Name)})})}}};w8.default=A9e});var C8=T(function(T8){Object.defineProperty(T8,"__esModule",{value:!0});var C9e=We(),k9e={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw Error("ajv implementation error");let o=t.name("valid");n.forEach((s,i)=>{if((0,C9e.alwaysValidSchema)(r,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};T8.default=k9e});var P8=T(function(O8){Object.defineProperty(O8,"__esModule",{value:!0});var Xb=Pe(),R8=We(),O9e={message:({params:e})=>Xb.str`must match "${e.ifClause}" schema`,params:({params:e})=>Xb._`{failingKeyword: ${e.ifClause}}`},P9e={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:O9e,code(e){let{gen:t,parentSchema:n,it:r}=e;if(n.then===void 0&&n.else===void 0)(0,R8.checkStrictMode)(r,'"if" without "then" and "else" is ignored');let o=k8(r,"then"),s=k8(r,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),o&&s){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,l("then",u),l("else",u))}else if(o)t.if(a,l("then"));else t.if((0,Xb.not)(a),l("else"));e.pass(i,()=>e.error(!0));function c(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function l(u,p){return()=>{let f=e.subschema({keyword:u},a);if(t.assign(i,a),e.mergeValidEvaluated(f,i),p)t.assign(p,Xb._`${u}`);else e.setParams({ifClause:u})}}}};function k8(e,t){let n=e.schema[t];return n!==void 0&&!(0,R8.alwaysValidSchema)(e,n)}O8.default=P9e});var D8=T(function(I8){Object.defineProperty(I8,"__esModule",{value:!0});var D9e=We(),L9e={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){if(t.if===void 0)(0,D9e.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};I8.default=L9e});var N8=T(function(L8){Object.defineProperty(L8,"__esModule",{value:!0});var M9e=iD(),U9e=Z5(),F9e=aD(),$9e=X5(),z9e=e8(),j9e=i8(),H9e=l8(),B9e=lD(),K9e=m8(),G9e=S8(),W9e=E8(),V9e=v8(),q9e=A8(),Z9e=C8(),Y9e=P8(),J9e=D8();function X9e(e=!1){let t=[W9e.default,V9e.default,q9e.default,Z9e.default,Y9e.default,J9e.default,H9e.default,B9e.default,j9e.default,K9e.default,G9e.default];if(e)t.push(U9e.default,$9e.default);else t.push(M9e.default,F9e.default);return t.push(z9e.default),t}L8.default=X9e});var U8=T(function(M8){Object.defineProperty(M8,"__esModule",{value:!0});var Bt=Pe(),eYe={message:({schemaCode:e})=>Bt.str`must match format "${e}"`,params:({schemaCode:e})=>Bt._`{format: ${e}}`},tYe={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:eYe,code(e,t){let{gen:n,data:r,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:l,schemaEnv:u,self:p}=a;if(!c.validateFormats)return;if(o)f();else m();function f(){let h=n.scopeValue("formats",{ref:p.formats,code:c.code.formats}),y=n.const("fDef",Bt._`${h}[${i}]`),_=n.let("fType"),E=n.let("format");n.if(Bt._`typeof ${y} == "object" && !(${y} instanceof RegExp)`,()=>n.assign(_,Bt._`${y}.type || "string"`).assign(E,Bt._`${y}.validate`),()=>n.assign(_,Bt._`"string"`).assign(E,y)),e.fail$data((0,Bt.or)(S(),x()));function S(){if(c.strictSchema===!1)return Bt.nil;return Bt._`${i} && !${E}`}function x(){let v=u.$async?Bt._`(${y}.async ? await ${E}(${r}) : ${E}(${r}))`:Bt._`${E}(${r})`,w=Bt._`(typeof ${E} == "function" ? ${v} : ${E}.test(${r}))`;return Bt._`${E} && ${E} !== true && ${_} === ${t} && !${w}`}}function m(){let h=p.formats[s];if(!h){S();return}if(h===!0)return;let[y,_,E]=x(h);if(y===t)e.pass(v());function S(){if(c.strictSchema===!1){p.logger.warn(w());return}throw Error(w());function w(){return`unknown format "${s}" ignored in schema at path "${l}"`}}function x(w){let U=w instanceof RegExp?(0,Bt.regexpCode)(w):c.code.formats?Bt._`${c.code.formats}${(0,Bt.getProperty)(s)}`:void 0,L=n.scopeValue("formats",{key:s,ref:w,code:U});if(typeof w=="object"&&!(w instanceof RegExp))return[w.type||"string",w.validate,Bt._`${L}.validate`];return["string",w,L]}function v(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!u.$async)throw Error("async format in sync schema");return Bt._`await ${E}(${r})`}return typeof _=="function"?Bt._`${E}(${r})`:Bt._`${E}.test(${r})`}}}};M8.default=tYe});var $8=T(function(F8){Object.defineProperty(F8,"__esModule",{value:!0});var rYe=U8(),oYe=[rYe.default];F8.default=oYe});var H8=T(function(z8){Object.defineProperty(z8,"__esModule",{value:!0});z8.contentVocabulary=z8.metadataVocabulary=void 0;z8.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];z8.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var G8=T(function(K8){Object.defineProperty(K8,"__esModule",{value:!0});var aYe=f5(),cYe=z5(),lYe=N8(),uYe=$8(),B8=H8(),dYe=[aYe.default,cYe.default,(0,lYe.default)(),uYe.default,B8.metadataVocabulary,B8.contentVocabulary];K8.default=dYe});var Z8=T(function(V8){Object.defineProperty(V8,"__esModule",{value:!0});V8.DiscrError=void 0;var W8;(function(e){e.Tag="tag",e.Mapping="mapping"})(W8||(V8.DiscrError=W8={}))});var X8=T(function(J8){Object.defineProperty(J8,"__esModule",{value:!0});var md=Pe(),dD=Z8(),Y8=Nb(),fYe=ah(),mYe=We(),hYe={message:({params:{discrError:e,tagName:t}})=>e===dD.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>md._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},gYe={keyword:"discriminator",type:"object",schemaType:"object",error:hYe,code(e){let{gen:t,data:n,schema:r,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=r.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(r.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),l=t.const("tag",md._`${n}${(0,md.getProperty)(a)}`);t.if(md._`typeof ${l} == "string"`,()=>u(),()=>e.error(!1,{discrError:dD.DiscrError.Tag,tag:l,tagName:a})),e.ok(c);function u(){let m=f();t.if(!1);for(let h in m)t.elseIf(md._`${l} === ${h}`),t.assign(c,p(m[h]));t.else(),e.error(!1,{discrError:dD.DiscrError.Mapping,tag:l,tagName:a}),t.endIf()}function p(m){let h=t.name("valid"),y=e.subschema({keyword:"oneOf",schemaProp:m},h);return e.mergeEvaluated(y,md.Name),h}function f(){var m;let h={},y=E(o),_=!0;for(let v=0;v<i.length;v++){let w=i[v];if((w===null||w===void 0?void 0:w.$ref)&&!(0,mYe.schemaHasRulesButRef)(w,s.self.RULES)){let L=w.$ref;if(w=Y8.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,L),w instanceof Y8.SchemaEnv)w=w.schema;if(w===void 0)throw new fYe.default(s.opts.uriResolver,s.baseId,L)}let U=(m=w===null||w===void 0?void 0:w.properties)===null||m===void 0?void 0:m[a];if(typeof U!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);_=_&&(y||E(w)),S(U,v)}if(!_)throw Error(`discriminator: "${a}" must be required`);return h;function E({required:v}){return Array.isArray(v)&&v.includes(a)}function S(v,w){if(v.const)x(v.const,w);else if(v.enum)for(let U of v.enum)x(U,w);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function x(v,w){if(typeof v!="string"||v in h)throw Error(`discriminator: "${a}" values must be unique strings`);h[v]=w}}}};J8.default=gYe});var Q8=T(function(D1t,yYe){yYe.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var fD=T(function(dr,pD){Object.defineProperty(dr,"__esModule",{value:!0});dr.MissingRefError=dr.ValidationError=dr.CodeGen=dr.Name=dr.nil=dr.stringify=dr.str=dr._=dr.KeywordCxt=dr.Ajv=void 0;var SYe=r5(),bYe=G8(),EYe=X8(),eX=Q8(),xYe=["/properties"],Qb="http://json-schema.org/draft-07/schema";class Sh extends SYe.default{_addVocabularies(){if(super._addVocabularies(),bYe.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(EYe.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(eX,xYe):eX;this.addMetaSchema(e,Qb,!1),this.refs["http://json-schema.org/schema"]=Qb}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Qb)?Qb:void 0)}}dr.Ajv=Sh;pD.exports=dr=Sh;pD.exports.Ajv=Sh;Object.defineProperty(dr,"__esModule",{value:!0});dr.default=Sh;var vYe=ih();Object.defineProperty(dr,"KeywordCxt",{enumerable:!0,get:function(){return vYe.KeywordCxt}});var hd=Pe();Object.defineProperty(dr,"_",{enumerable:!0,get:function(){return hd._}});Object.defineProperty(dr,"str",{enumerable:!0,get:function(){return hd.str}});Object.defineProperty(dr,"stringify",{enumerable:!0,get:function(){return hd.stringify}});Object.defineProperty(dr,"nil",{enumerable:!0,get:function(){return hd.nil}});Object.defineProperty(dr,"Name",{enumerable:!0,get:function(){return hd.Name}});Object.defineProperty(dr,"CodeGen",{enumerable:!0,get:function(){return hd.CodeGen}});var wYe=Db();Object.defineProperty(dr,"ValidationError",{enumerable:!0,get:function(){return wYe.default}});var AYe=ah();Object.defineProperty(dr,"MissingRefError",{enumerable:!0,get:function(){return AYe.default}})});var uX=T(function(cX){Object.defineProperty(cX,"__esModule",{value:!0});cX.formatNames=cX.fastFormats=cX.fullFormats=void 0;function cs(e,t){return{validate:e,compare:t}}cX.fullFormats={date:cs(oX,_D),time:cs(hD(!0),yD),"date-time":cs(tX(!0),iX),"iso-time":cs(hD(),sX),"iso-date-time":cs(tX(),aX),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:DYe,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:zYe,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:LYe,int32:{type:"number",validate:UYe},int64:{type:"number",validate:FYe},float:{type:"number",validate:rX},double:{type:"number",validate:rX},password:!0,binary:!0};cX.fastFormats={...cX.fullFormats,date:cs(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,_D),time:cs(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,yD),"date-time":cs(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,iX),"iso-time":cs(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,sX),"iso-date-time":cs(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,aX),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};cX.formatNames=Object.keys(cX.fullFormats);function kYe(e){return e%4===0&&(e%100!==0||e%400===0)}var RYe=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,OYe=[0,31,28,31,30,31,30,31,31,30,31,30,31];function oX(e){let t=RYe.exec(e);if(!t)return!1;let n=+t[1],r=+t[2],o=+t[3];return r>=1&&r<=12&&o>=1&&o<=(r===2&&kYe(n)?29:OYe[r])}function _D(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var mD=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function hD(e){return function(n){let r=mD.exec(n);if(!r)return!1;let o=+r[1],s=+r[2],i=+r[3],a=r[4],c=r[5]==="-"?-1:1,l=+(r[6]||0),u=+(r[7]||0);if(l>23||u>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let p=s-u*c,f=o-l*c-(p<0?1:0);return(f===23||f===-1)&&(p===59||p===-1)&&i<61}}function yD(e,t){if(!(e&&t))return;let n=new Date("2020-01-01T"+e).valueOf(),r=new Date("2020-01-01T"+t).valueOf();if(!(n&&r))return;return n-r}function sX(e,t){if(!(e&&t))return;let n=mD.exec(e),r=mD.exec(t);if(!(n&&r))return;if(e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t)return 1;if(e<t)return-1;return 0}var gD=/t|\s/i;function tX(e){let t=hD(e);return function(r){let o=r.split(gD);return o.length===2&&oX(o[0])&&t(o[1])}}function iX(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(!(n&&r))return;return n-r}function aX(e,t){if(!(e&&t))return;let[n,r]=e.split(gD),[o,s]=t.split(gD),i=_D(n,o);if(i===void 0)return;return i||yD(r,s)}var PYe=/\/|:/,IYe=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function DYe(e){return PYe.test(e)&&IYe.test(e)}var nX=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function LYe(e){return nX.lastIndex=0,nX.test(e)}var NYe=-2147483648,MYe=2147483647;function UYe(e){return Number.isInteger(e)&&e<=MYe&&e>=NYe}function FYe(e){return Number.isInteger(e)}function rX(){return!0}var $Ye=/[^\\]\\Z/;function zYe(e){if($Ye.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var pX=T(function(dX){Object.defineProperty(dX,"__esModule",{value:!0});dX.formatLimitDefinition=void 0;var HYe=fD(),Fo=Pe(),Ji=Fo.operators,eE={formatMaximum:{okStr:"<=",ok:Ji.LTE,fail:Ji.GT},formatMinimum:{okStr:">=",ok:Ji.GTE,fail:Ji.LT},formatExclusiveMaximum:{okStr:"<",ok:Ji.LT,fail:Ji.GTE},formatExclusiveMinimum:{okStr:">",ok:Ji.GT,fail:Ji.LTE}},BYe={message:({keyword:e,schemaCode:t})=>Fo.str`should be ${eE[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Fo._`{comparison: ${eE[e].okStr}, limit: ${t}}`};dX.formatLimitDefinition={keyword:Object.keys(eE),type:"string",schemaType:"string",$data:!0,error:BYe,code(e){let{gen:t,data:n,schemaCode:r,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new HYe.KeywordCxt(s,a.RULES.all.format.definition,"format");if(c.$data)l();else u();function l(){let f=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=t.const("fmt",Fo._`${f}[${c.schemaCode}]`);e.fail$data((0,Fo.or)(Fo._`typeof ${m} != "object"`,Fo._`${m} instanceof RegExp`,Fo._`typeof ${m}.compare != "function"`,p(m)))}function u(){let f=c.schema,m=a.formats[f];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${o}": format "${f}" does not define "compare" function`);let h=t.scopeValue("formats",{key:f,ref:m,code:i.code.formats?Fo._`${i.code.formats}${(0,Fo.getProperty)(f)}`:void 0});e.fail$data(p(h))}function p(f){return Fo._`${f}.compare(${n}, ${r}) ${eE[o].fail} 0`}},dependencies:["format"]};var KYe=(e)=>(e.addKeyword(dX.formatLimitDefinition),e);dX.default=KYe});var gX=T(function(bh,hX){Object.defineProperty(bh,"__esModule",{value:!0});var gd=uX(),WYe=pX(),ED=Pe(),fX=new ED.Name("fullFormats"),VYe=new ED.Name("fastFormats"),xD=(e,t={keywords:!0})=>{if(Array.isArray(t))return mX(e,t,gd.fullFormats,fX),e;let[n,r]=t.mode==="fast"?[gd.fastFormats,VYe]:[gd.fullFormats,fX],o=t.formats||gd.formatNames;if(mX(e,o,n,r),t.keywords)(0,WYe.default)(e);return e};xD.get=(e,t="full")=>{let r=(t==="fast"?gd.fastFormats:gd.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function mX(e,t,n,r){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=ED._`require("ajv-formats/dist/formats").${r}`);for(let i of t)e.addFormat(i,n[i])}hX.exports=bh=xD;Object.defineProperty(bh,"__esModule",{value:!0});bh.default=xD});import{randomUUID as Nd}from"crypto";import{createHash as Bne,randomBytes as Mnt}from"crypto";function YE(e){return e}var VL="[\\w-]{1,63}",Hne=new RegExp(`^${VL}$`);var Dnt=new RegExp(`^a(?:${VL}-)?[0-9a-f]{16}$`);function qL(e,t){let n=Buffer.from(t.replace(/-/g,""),"hex"),r=Bne("sha1").update(n).update(Buffer.from(e,"utf8")).digest();r[6]=r[6]&15|80,r[8]=r[8]&63|128;let o=r.subarray(0,16).toString("hex");return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20,32)}`}var Kne="3ab19d7e-9f35-45c2-926e-75e271cc60b3";function ZL(){let e=process.env.CLAUDE_CODE_REMOTE_SESSION_ID?.trim();return e?qL(e,Kne):null}function Gne(){this.__data__=[],this.size=0}var YL=Gne;function Wne(e,t){return e===t||e!==e&&t!==t}var Ho=Wne;function Vne(e,t){var n=e.length;while(n--)if(Ho(e[n][0],t))return n;return-1}var Zs=Vne;var qne=Array.prototype,Zne=qne.splice;function Yne(e){var t=this.__data__,n=Zs(t,e);if(n<0)return!1;var r=t.length-1;if(n==r)t.pop();else Zne.call(t,n,1);return--this.size,!0}var JL=Yne;function Jne(e){var t=this.__data__,n=Zs(t,e);return n<0?void 0:t[n][1]}var XL=Jne;function Xne(e){return Zs(this.__data__,e)>-1}var QL=Xne;function Qne(e,t){var n=this.__data__,r=Zs(n,e);if(r<0)++this.size,n.push([e,t]);else n[r][1]=t;return this}var e0=Qne;function Nc(e){var t=-1,n=e==null?0:e.length;this.clear();while(++t<n){var r=e[t];this.set(r[0],r[1])}}Nc.prototype.clear=YL;Nc.prototype.delete=JL;Nc.prototype.get=XL;Nc.prototype.has=QL;Nc.prototype.set=e0;var Ys=Nc;function ere(){this.__data__=new Ys,this.size=0}var t0=ere;function tre(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var n0=tre;function nre(e){return this.__data__.get(e)}var r0=nre;function rre(e){return this.__data__.has(e)}var o0=rre;var ore=typeof global=="object"&&global&&global.Object===Object&&global,qh=ore;var sre=typeof self=="object"&&self&&self.Object===Object&&self,ire=qh||sre||Function("return this")(),Gt=ire;var are=Gt.Symbol,sn=are;var s0=Object.prototype,{hasOwnProperty:cre,toString:lre}=s0,Md=sn?sn.toStringTag:void 0;function ure(e){var t=cre.call(e,Md),n=e[Md];try{e[Md]=void 0;var r=!0}catch(s){}var o=lre.call(e);if(r)if(t)e[Md]=n;else delete e[Md];return o}var i0=ure;var dre=Object.prototype,pre=dre.toString;function fre(e){return pre.call(e)}var a0=fre;var mre="[object Null]",hre="[object Undefined]",c0=sn?sn.toStringTag:void 0;function gre(e){if(e==null)return e===void 0?hre:mre;return c0&&c0 in Object(e)?i0(e):a0(e)}var mr=gre;function _re(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var jt=_re;var yre="[object AsyncFunction]",Sre="[object Function]",bre="[object GeneratorFunction]",Ere="[object Proxy]";function xre(e){if(!jt(e))return!1;var t=mr(e);return t==Sre||t==bre||t==yre||t==Ere}var Mc=xre;var vre=Gt["__core-js_shared__"],Zh=vre;var l0=function(){var e=/[^.]+$/.exec(Zh&&Zh.keys&&Zh.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function wre(e){return!!l0&&l0 in e}var u0=wre;var Are=Function.prototype,Tre=Are.toString;function Cre(e){if(e!=null){try{return Tre.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var ps=Cre;var kre=/[\\^$.*+?()[\]{}|]/g,Rre=/^\[object .+?Constructor\]$/,Ore=Function.prototype,Pre=Object.prototype,Ire=Ore.toString,Dre=Pre.hasOwnProperty,Lre=RegExp("^"+Ire.call(Dre).replace(kre,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Nre(e){if(!jt(e)||u0(e))return!1;var t=Mc(e)?Lre:Rre;return t.test(ps(e))}var d0=Nre;function Mre(e,t){return e==null?void 0:e[t]}var p0=Mre;function Ure(e,t){var n=p0(e,t);return d0(n)?n:void 0}var Vn=Ure;var Fre=Vn(Gt,"Map"),Js=Fre;var $re=Vn(Object,"create"),fs=$re;function zre(){this.__data__=fs?fs(null):{},this.size=0}var f0=zre;function jre(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var m0=jre;var Hre="__lodash_hash_undefined__",Bre=Object.prototype,Kre=Bre.hasOwnProperty;function Gre(e){var t=this.__data__;if(fs){var n=t[e];return n===Hre?void 0:n}return Kre.call(t,e)?t[e]:void 0}var h0=Gre;var Wre=Object.prototype,Vre=Wre.hasOwnProperty;function qre(e){var t=this.__data__;return fs?t[e]!==void 0:Vre.call(t,e)}var g0=qre;var Zre="__lodash_hash_undefined__";function Yre(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=fs&&t===void 0?Zre:t,this}var _0=Yre;function Uc(e){var t=-1,n=e==null?0:e.length;this.clear();while(++t<n){var r=e[t];this.set(r[0],r[1])}}Uc.prototype.clear=f0;Uc.prototype.delete=m0;Uc.prototype.get=h0;Uc.prototype.has=g0;Uc.prototype.set=_0;var JE=Uc;function Jre(){this.size=0,this.__data__={hash:new JE,map:new(Js||Ys),string:new JE}}var y0=Jre;function Xre(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var S0=Xre;function Qre(e,t){var n=e.__data__;return S0(t)?n[typeof t=="string"?"string":"hash"]:n.map}var Xs=Qre;function eoe(e){var t=Xs(this,e).delete(e);return this.size-=t?1:0,t}var b0=eoe;function toe(e){return Xs(this,e).get(e)}var E0=toe;function noe(e){return Xs(this,e).has(e)}var x0=noe;function roe(e,t){var n=Xs(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var v0=roe;function Fc(e){var t=-1,n=e==null?0:e.length;this.clear();while(++t<n){var r=e[t];this.set(r[0],r[1])}}Fc.prototype.clear=y0;Fc.prototype.delete=b0;Fc.prototype.get=E0;Fc.prototype.has=x0;Fc.prototype.set=v0;var aa=Fc;var ooe=200;function soe(e,t){var n=this.__data__;if(n instanceof Ys){var r=n.__data__;if(!Js||r.length<ooe-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new aa(r)}return n.set(e,t),this.size=n.size,this}var w0=soe;function $c(e){var t=this.__data__=new Ys(e);this.size=t.size}$c.prototype.clear=t0;$c.prototype.delete=n0;$c.prototype.get=r0;$c.prototype.has=o0;$c.prototype.set=w0;var Bo=$c;var ioe="__lodash_hash_undefined__";function aoe(e){return this.__data__.set(e,ioe),this}var A0=aoe;function coe(e){return this.__data__.has(e)}var T0=coe;function Yh(e){var t=-1,n=e==null?0:e.length;this.__data__=new aa;while(++t<n)this.add(e[t])}Yh.prototype.add=Yh.prototype.push=A0;Yh.prototype.has=T0;var C0=Yh;function loe(e,t){var n=-1,r=e==null?0:e.length;while(++n<r)if(t(e[n],n,e))return!0;return!1}var k0=loe;function uoe(e,t){return e.has(t)}var R0=uoe;var doe=1,poe=2;function foe(e,t,n,r,o,s){var i=n&doe,a=e.length,c=t.length;if(a!=c&&!(i&&c>a))return!1;var l=s.get(e),u=s.get(t);if(l&&u)return l==t&&u==e;var p=-1,f=!0,m=n&poe?new C0:void 0;s.set(e,t),s.set(t,e);while(++p<a){var h=e[p],y=t[p];if(r)var _=i?r(y,h,p,t,e,s):r(h,y,p,e,t,s);if(_!==void 0){if(_)continue;f=!1;break}if(m){if(!k0(t,function(E,S){if(!R0(m,S)&&(h===E||o(h,E,n,r,s)))return m.push(S)})){f=!1;break}}else if(!(h===y||o(h,y,n,r,s))){f=!1;break}}return s.delete(e),s.delete(t),f}var Jh=foe;var moe=Gt.Uint8Array,zc=moe;function hoe(e){var t=-1,n=Array(e.size);return e.forEach(function(r,o){n[++t]=[o,r]}),n}var O0=hoe;function goe(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var P0=goe;var _oe=1,yoe=2,Soe="[object Boolean]",boe="[object Date]",Eoe="[object Error]",xoe="[object Map]",voe="[object Number]",woe="[object RegExp]",Aoe="[object Set]",Toe="[object String]",Coe="[object Symbol]",koe="[object ArrayBuffer]",Roe="[object DataView]",I0=sn?sn.prototype:void 0,XE=I0?I0.valueOf:void 0;function Ooe(e,t,n,r,o,s,i){switch(n){case Roe:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case koe:if(e.byteLength!=t.byteLength||!s(new zc(e),new zc(t)))return!1;return!0;case Soe:case boe:case voe:return Ho(+e,+t);case Eoe:return e.name==t.name&&e.message==t.message;case woe:case Toe:return e==t+"";case xoe:var a=O0;case Aoe:var c=r&_oe;if(a||(a=P0),e.size!=t.size&&!c)return!1;var l=i.get(e);if(l)return l==t;r|=yoe,i.set(e,t);var u=Jh(a(e),a(t),r,o,s,i);return i.delete(e),u;case Coe:if(XE)return XE.call(e)==XE.call(t)}return!1}var D0=Ooe;function Poe(e,t){var n=-1,r=t.length,o=e.length;while(++n<r)e[o+n]=t[n];return e}var jc=Poe;var Ioe=Array.isArray,bt=Ioe;function Doe(e,t,n){var r=t(e);return bt(e)?r:jc(r,n(e))}var Xh=Doe;function Loe(e,t){var n=-1,r=e==null?0:e.length,o=0,s=[];while(++n<r){var i=e[n];if(t(i,n,e))s[o++]=i}return s}var L0=Loe;function Noe(){return[]}var Qh=Noe;var Moe=Object.prototype,Uoe=Moe.propertyIsEnumerable,N0=Object.getOwnPropertySymbols,Foe=!N0?Qh:function(e){if(e==null)return[];return e=Object(e),L0(N0(e),function(t){return Uoe.call(e,t)})},Hc=Foe;function $oe(e,t){var n=-1,r=Array(e);while(++n<e)r[n]=t(n);return r}var M0=$oe;function zoe(e){return e!=null&&typeof e=="object"}var Zt=zoe;var joe="[object Arguments]";function Hoe(e){return Zt(e)&&mr(e)==joe}var QE=Hoe;var U0=Object.prototype,{hasOwnProperty:Boe,propertyIsEnumerable:Koe}=U0,Goe=QE(function(){return arguments}())?QE:function(e){return Zt(e)&&Boe.call(e,"callee")&&!Koe.call(e,"callee")},ms=Goe;var tg={};on(tg,{default:()=>Ko});function Woe(){return!1}var F0=Woe;var j0=typeof tg=="object"&&tg&&!tg.nodeType&&tg,$0=j0&&typeof eg=="object"&&eg&&!eg.nodeType&&eg,Voe=$0&&$0.exports===j0,z0=Voe?Gt.Buffer:void 0,qoe=z0?z0.isBuffer:void 0,Zoe=qoe||F0,Ko=Zoe;var Yoe=9007199254740991,Joe=/^(?:0|[1-9]\d*)$/;function Xoe(e,t){var n=typeof e;return t=t==null?Yoe:t,!!t&&(n=="number"||n!="symbol"&&Joe.test(e))&&(e>-1&&e%1==0&&e<t)}var Qs=Xoe;var Qoe=9007199254740991;function ese(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Qoe}var Bc=ese;var tse="[object Arguments]",nse="[object Array]",rse="[object Boolean]",ose="[object Date]",sse="[object Error]",ise="[object Function]",ase="[object Map]",cse="[object Number]",lse="[object Object]",use="[object RegExp]",dse="[object Set]",pse="[object String]",fse="[object WeakMap]",mse="[object ArrayBuffer]",hse="[object DataView]",gse="[object Float32Array]",_se="[object Float64Array]",yse="[object Int8Array]",Sse="[object Int16Array]",bse="[object Int32Array]",Ese="[object Uint8Array]",xse="[object Uint8ClampedArray]",vse="[object Uint16Array]",wse="[object Uint32Array]",ht={};ht[gse]=ht[_se]=ht[yse]=ht[Sse]=ht[bse]=ht[Ese]=ht[xse]=ht[vse]=ht[wse]=!0;ht[tse]=ht[nse]=ht[mse]=ht[rse]=ht[hse]=ht[ose]=ht[sse]=ht[ise]=ht[ase]=ht[cse]=ht[lse]=ht[use]=ht[dse]=ht[pse]=ht[fse]=!1;function Ase(e){return Zt(e)&&Bc(e.length)&&!!ht[mr(e)]}var H0=Ase;function Tse(e){return function(t){return e(t)}}var Kc=Tse;var rg={};on(rg,{default:()=>Go});var B0=typeof rg=="object"&&rg&&!rg.nodeType&&rg,Ud=B0&&typeof ng=="object"&&ng&&!ng.nodeType&&ng,Cse=Ud&&Ud.exports===B0,ex=Cse&&qh.process,kse=function(){try{var e=Ud&&Ud.require&&Ud.require("util").types;if(e)return e;return ex&&ex.binding&&ex.binding("util")}catch(t){}}(),Go=kse;var K0=Go&&Go.isTypedArray,Rse=K0?Kc(K0):H0,Gc=Rse;var Ose=Object.prototype,Pse=Ose.hasOwnProperty;function Ise(e,t){var n=bt(e),r=!n&&ms(e),o=!n&&!r&&Ko(e),s=!n&&!r&&!o&&Gc(e),i=n||r||o||s,a=i?M0(e.length,String):[],c=a.length;for(var l in e)if((t||Pse.call(e,l))&&!(i&&(l=="length"||o&&(l=="offset"||l=="parent")||s&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||Qs(l,c))))a.push(l);return a}var og=Ise;var Dse=Object.prototype;function Lse(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Dse;return e===n}var Wc=Lse;function Nse(e,t){return function(n){return e(t(n))}}var sg=Nse;var Mse=sg(Object.keys,Object),G0=Mse;var Use=Object.prototype,Fse=Use.hasOwnProperty;function $se(e){if(!Wc(e))return G0(e);var t=[];for(var n in Object(e))if(Fse.call(e,n)&&n!="constructor")t.push(n);return t}var W0=$se;function zse(e){return e!=null&&Bc(e.length)&&!Mc(e)}var ei=zse;function jse(e){return ei(e)?og(e):W0(e)}var Wo=jse;function Hse(e){return Xh(e,Wo,Hc)}var Fd=Hse;var Bse=1,Kse=Object.prototype,Gse=Kse.hasOwnProperty;function Wse(e,t,n,r,o,s){var i=n&Bse,a=Fd(e),c=a.length,l=Fd(t),u=l.length;if(c!=u&&!i)return!1;var p=c;while(p--){var f=a[p];if(!(i?f in t:Gse.call(t,f)))return!1}var m=s.get(e),h=s.get(t);if(m&&h)return m==t&&h==e;var y=!0;s.set(e,t),s.set(t,e);var _=i;while(++p<c){f=a[p];var E=e[f],S=t[f];if(r)var x=i?r(S,E,f,t,e,s):r(E,S,f,e,t,s);if(!(x===void 0?E===S||o(E,S,n,r,s):x)){y=!1;break}_||(_=f=="constructor")}if(y&&!_){var v=e.constructor,w=t.constructor;if(v!=w&&(("constructor"in e)&&("constructor"in t))&&!(typeof v=="function"&&v instanceof v&&typeof w=="function"&&w instanceof w))y=!1}return s.delete(e),s.delete(t),y}var V0=Wse;var Vse=Vn(Gt,"DataView"),ig=Vse;var qse=Vn(Gt,"Promise"),ag=qse;var Zse=Vn(Gt,"Set"),cg=Zse;var Yse=Vn(Gt,"WeakMap"),lg=Yse;var q0="[object Map]",Jse="[object Object]",Z0="[object Promise]",Y0="[object Set]",J0="[object WeakMap]",X0="[object DataView]",Xse=ps(ig),Qse=ps(Js),eie=ps(ag),tie=ps(cg),nie=ps(lg),ca=mr;if(ig&&ca(new ig(new ArrayBuffer(1)))!=X0||Js&&ca(new Js)!=q0||ag&&ca(ag.resolve())!=Z0||cg&&ca(new cg)!=Y0||lg&&ca(new lg)!=J0)ca=function(e){var t=mr(e),n=t==Jse?e.constructor:void 0,r=n?ps(n):"";if(r)switch(r){case Xse:return X0;case Qse:return q0;case eie:return Z0;case tie:return Y0;case nie:return J0}return t};var hs=ca;var rie=1,Q0="[object Arguments]",eN="[object Array]",ug="[object Object]",oie=Object.prototype,tN=oie.hasOwnProperty;function sie(e,t,n,r,o,s){var i=bt(e),a=bt(t),c=i?eN:hs(e),l=a?eN:hs(t);c=c==Q0?ug:c,l=l==Q0?ug:l;var u=c==ug,p=l==ug,f=c==l;if(f&&Ko(e)){if(!Ko(t))return!1;i=!0,u=!1}if(f&&!u)return s||(s=new Bo),i||Gc(e)?Jh(e,t,n,r,o,s):D0(e,t,c,n,r,o,s);if(!(n&rie)){var m=u&&tN.call(e,"__wrapped__"),h=p&&tN.call(t,"__wrapped__");if(m||h){var y=m?e.value():e,_=h?t.value():t;return s||(s=new Bo),o(y,_,n,r,s)}}if(!f)return!1;return s||(s=new Bo),V0(e,t,n,r,o,s)}var nN=sie;function rN(e,t,n,r,o){if(e===t)return!0;if(e==null||t==null||!Zt(e)&&!Zt(t))return e!==e&&t!==t;return nN(e,t,n,r,rN,o)}var Vc=rN;function iie(e,t){return Vc(e,t)}var qc=iie;import{basename as cie,dirname as aN}from"path";var aie;function ye(){return aie===!0}class nt{#e;#t=new WeakMap;constructor(e){this.#e=e}of(e){let t=this.#t.get(e);if(t!==void 0)return t;let n=this.#e();return this.#t.set(e,n),n}}Zc();class dg{mergedSettings=null;perSource=new Map;parsedFiles=new Map;folderListings=new Map;managedFileReads=new Map;primedFiles=new Set;policyWalks=0;walkedFolders=new Map;policy={};lastPolicyEnvComposition=null;isLoadingFromDisk=!1;autoModeUntrustedSourceWarned=!1;changed=Tt();internalWrites=new Map;enabledSources;pluginBase;epoch=0;systemSpaceServingLogged=!1;systemAttestationContradicted=!1;backendReadResetTail=Promise.resolve();invalidated=Tt();pluginBaseLoaded=!1;primer;localStoreProbes=new cN;retained=new Map;retainedListings=new Map;setPluginBase(e){this.pluginBase=e,this.pluginBaseLoaded=!0}clearPluginBase(){this.pluginBase=void 0}invalidateAll(e){if(this.epoch++,this.mergedSettings=null,this.perSource.clear(),this.parsedFiles.clear(),this.primedFiles.clear(),this.policyWalks=0,this.walkedFolders.clear(),this.folderListings.clear(),this.policy={},e?.userLayer==="retain"&&ye()&&this.primer!==void 0){for(let[t,n]of this.retained)this.parsedFiles.set(t,n.parsed),this.primedFiles.add(t);for(let[t,n]of this.retainedListings)this.folderListings.set(t,n.names)}else this.retained.clear(),this.retainedListings.clear();this.invalidated.emit()}invalidatePolicyLayer(){this.mergedSettings=null,this.perSource.delete("policySettings"),this.policy={}}onInvalidate(e){return this.invalidated.subscribe(e)}seedParsedFile(e,t,n,r){if(r!==this.epoch)return!1;let o=this.parsedFiles.get(e),s=o===void 0||!qc(o,n);if(this.parsedFiles.set(e,n),s||this.primedFiles.has(e))this.primedFiles.add(e);let i=this.retained.get(e);if(i!==void 0)i.parsed=n;if(s)this.dropDerivedCaches(t);return!0}walkReadDiffers(e,t){let n=this.parsedFiles.get(e);return n!==void 0&&!this.primedFiles.has(e)&&!qc(n,t)}unseedParsedFile(e,t,n){if(n!==this.epoch)return;if(this.retained.delete(e),!this.primedFiles.has(e)||t==="policySettings"&&this.policyWalks>0)return;this.primedFiles.delete(e),this.parsedFiles.delete(e),this.dropDerivedCaches(t)}dropDerivedCaches(e){if(this.perSource.delete(e),this.mergedSettings=null,e==="policySettings")this.policy={}}primedFolderListing(e){return ye()?this.folderListings.get(e):void 0}folderListingForPolicyWalk(e){if(!ye())return;this.policyWalks++;let t=this.folderListings.get(e);if(!this.walkedFolders.has(e)||t!==void 0)this.walkedFolders.set(e,t??null);return t}noteWalkListing(e,t){if(!ye())return;this.walkedFolders.set(e,t)}get policyWalkCount(){return this.policyWalks}policyInstallVerdict(e,t,n){let r=this.parsedFiles.get(e);if(r===void 0||qc(r,t))return"install";if(!this.primedFiles.has(e))return"raced";if(this.policyWalks===0)return"install";return this.policyWalks>n?"raced":"deferred"}folderInstallVerdict(e,t,n){if(!this.walkedFolders.has(e))return this.hasParsedDropInOutside(e,t)?"raced":"install";let r=this.walkedFolders.get(e);if(r!==null&&r!==void 0&&qc(r,t))return"install";return this.policyWalks>n?"raced":"deferred"}seedFolderListing(e,t,n){if(n!==this.epoch)return!1;let r=this.folderListings.get(e);this.folderListings.set(e,t);let o=this.retainedListings.get(e);if(o!==void 0)o.names=t;if(r!==void 0&&!qc(r,t))this.dropDerivedCaches("policySettings");return!0}walkReadManagedFileIn(e,t){for(let[n,r]of this.parsedFiles)if(!n.includes("\x00")&&!this.primedFiles.has(n)&&(r.settings!==null||r.errors.length>0)&&(n===e||aN(n)===t))return!0;return!1}walkRead(e){return this.parsedFiles.has(e)&&!this.primedFiles.has(e)}hasParsedDropInOutside(e,t){for(let n of this.parsedFiles.keys())if(!n.includes("\x00")&&!this.primedFiles.has(n)&&aN(n)===e&&!t.includes(cie(n)))return!0;return!1}clearFolderListing(e,t){if(t!==this.epoch)return;if(this.retainedListings.delete(e),!this.folderListings.has(e)||this.walkedFolders.has(e))return;this.folderListings.delete(e),this.dropDerivedCaches("policySettings")}retainLayer(e,t){let n={parsed:t};return this.retained.set(e,n),()=>{if(this.retained.get(e)===n)this.retained.delete(e)}}dropRetainedLayer(e){this.retained.delete(e)}retainFolderListing(e,t){let n={names:t};return this.retainedListings.set(e,n),()=>{if(this.retainedListings.get(e)===n)this.retainedListings.delete(e)}}}class cN{ownerUidsByRoot=new Map;realHomeDir=void 0;canonicalRootOwnerUids(e,t){let n=this.ownerUidsByRoot.get(e);if(n!==void 0)return n;let r=t(e);return this.ownerUidsByRoot.set(e,r),r}hasCanonicalRootOwnerUids(e){return this.ownerUidsByRoot.has(e)}primeCanonicalRootOwnerUids(e,t){if(this.ownerUidsByRoot.has(e))return!1;return this.ownerUidsByRoot.set(e,t),!0}clearCanonicalRootOwnerUids(){this.ownerUidsByRoot.clear()}normalizedRealHomeDir(e){return this.realHomeDir??=e(),this.realHomeDir}clearNormalizedRealHomeDir(){this.realHomeDir=void 0}}var rx=new nt(()=>new dg);function $d(){return{sent:new Set,rejected:new Set,declaredTools:void 0,nameOnlyAnnouncements:new Set,surfacedOnWire:new Set}}import{realpathSync as lN}from"node:fs";import{cwd as lie}from"node:process";function uN(e){return process.platform==="darwin"?e.normalize("NFC"):e}function ox(){let e="";if(typeof process<"u"&&typeof process.cwd==="function"&&typeof lN==="function")try{let t=lie();try{e=uN(lN(t))}catch{e=uN(t)}}catch{}return e}var dN=ox(),uie=(()=>{if(typeof process>"u"||typeof process.cwd!=="function")return null;try{return process.cwd()}catch{return null}})();class sx{spawner=void 0;pairings=new Map;mainEnsureInFlight=!1;mainSlotBlocked=!1}class ix{#e=$d();#t=new Map;#n=void 0;stickyBetas(){return this.#e}unlatchStickyBetas(){this.#e=$d()}perTurnEffortPins(){return this.#t}atisLatch(){return this.#n}replaceAtisLatch(e){this.#n=e}reset(){this.#e=$d(),this.#t=new Map,this.#n=void 0}}var die=function(){try{var e=Vn(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Yc=die;function pie(e,t,n){if(t=="__proto__"&&Yc)Yc(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0});else e[t]=n}var ti=pie;function fie(e){return function(t,n,r){var o=-1,s=Object(t),i=r(t),a=i.length;while(a--){var c=i[e?a:++o];if(n(s[c],c,s)===!1)break}return t}}var pN=fie;var mie=pN(),pg=mie;function hie(e,t){return e&&pg(e,t,Wo)}var fN=hie;var gie=1,_ie=2;function yie(e,t,n,r){var o=n.length,s=o,i=!r;if(e==null)return!s;e=Object(e);while(o--){var a=n[o];if(i&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}while(++o<s){a=n[o];var c=a[0],l=e[c],u=a[1];if(i&&a[2]){if(l===void 0&&!(c in e))return!1}else{var p=new Bo;if(r)var f=r(l,u,c,e,t,p);if(!(f===void 0?Vc(u,l,gie|_ie,r,p):f))return!1}}return!0}var mN=yie;function Sie(e){return e===e&&!jt(e)}var fg=Sie;function bie(e){var t=Wo(e),n=t.length;while(n--){var r=t[n],o=e[r];t[n]=[r,o,fg(o)]}return t}var hN=bie;function Eie(e,t){return function(n){if(n==null)return!1;return n[e]===t&&(t!==void 0||(e in Object(n)))}}var mg=Eie;function xie(e){var t=hN(e);if(t.length==1&&t[0][2])return mg(t[0][0],t[0][1]);return function(n){return n===e||mN(n,e,t)}}var gN=xie;var vie="[object Symbol]";function wie(e){return typeof e=="symbol"||Zt(e)&&mr(e)==vie}var Jc=wie;var Aie=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Tie=/^\w*$/;function Cie(e,t){if(bt(e))return!1;var n=typeof e;if(n=="number"||n=="symbol"||n=="boolean"||e==null||Jc(e))return!0;return Tie.test(e)||!Aie.test(e)||t!=null&&e in Object(t)}var Xc=Cie;var kie="Expected a function";function ax(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw TypeError(kie);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],s=n.cache;if(s.has(o))return s.get(o);var i=e.apply(this,r);return n.cache=s.set(o,i)||s,i};return n.cache=new(ax.Cache||aa),n}ax.Cache=aa;var zd=ax;var Rie=500;function Oie(e){var t=zd(e,function(r){if(n.size===Rie)n.clear();return r}),n=t.cache;return t}var _N=Oie;var Pie=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Iie=/\\(\\)?/g,Die=_N(function(e){var t=[];if(e.charCodeAt(0)===46)t.push("");return e.replace(Pie,function(n,r,o,s){t.push(o?s.replace(Iie,"$1"):r||n)}),t}),yN=Die;function Lie(e,t){var n=-1,r=e==null?0:e.length,o=Array(r);while(++n<r)o[n]=t(e[n],n,e);return o}var Qc=Lie;var Nie=1/0,SN=sn?sn.prototype:void 0,bN=SN?SN.toString:void 0;function EN(e){if(typeof e=="string")return e;if(bt(e))return Qc(e,EN)+"";if(Jc(e))return bN?bN.call(e):"";var t=e+"";return t=="0"&&1/e==-Nie?"-0":t}var xN=EN;function Mie(e){return e==null?"":xN(e)}var vN=Mie;function Uie(e,t){if(bt(e))return e;return Xc(e,t)?[e]:yN(vN(e))}var Dr=Uie;var Fie=1/0;function $ie(e){if(typeof e=="string"||Jc(e))return e;var t=e+"";return t=="0"&&1/e==-Fie?"-0":t}var hr=$ie;function zie(e,t){t=Dr(t,e);var n=0,r=t.length;while(e!=null&&n<r)e=e[hr(t[n++])];return n&&n==r?e:void 0}var ni=zie;function jie(e,t,n){var r=e==null?void 0:ni(e,t);return r===void 0?n:r}var wN=jie;function Hie(e,t){return e!=null&&t in Object(e)}var AN=Hie;function Bie(e,t,n){t=Dr(t,e);var r=-1,o=t.length,s=!1;while(++r<o){var i=hr(t[r]);if(!(s=e!=null&&n(e,i)))break;e=e[i]}if(s||++r!=o)return s;return o=e==null?0:e.length,!!o&&Bc(o)&&Qs(i,o)&&(bt(e)||ms(e))}var TN=Bie;function Kie(e,t){return e!=null&&TN(e,t,AN)}var hg=Kie;var Gie=1,Wie=2;function Vie(e,t){if(Xc(e)&&fg(t))return mg(hr(e),t);return function(n){var r=wN(n,e);return r===void 0&&r===t?hg(n,e):Vc(t,r,Gie|Wie)}}var CN=Vie;function qie(e){return e}var el=qie;function Zie(e){return function(t){return t==null?void 0:t[e]}}var kN=Zie;function Yie(e){return function(t){return ni(t,e)}}var RN=Yie;function Jie(e){return Xc(e)?kN(hr(e)):RN(e)}var ON=Jie;function Xie(e){if(typeof e=="function")return e;if(e==null)return el;if(typeof e=="object")return bt(e)?CN(e[0],e[1]):gN(e);return ON(e)}var ri=Xie;function Qie(e,t){var n={};return t=ri(t,3),fN(e,function(r,o,s){ti(n,o,t(r,o,s))}),n}var jd=Qie;function eae(e,t){var n,r=-1,o=e.length;while(++r<o){var s=t(e[r]);if(s!==void 0)n=n===void 0?s:n+s}return n}var PN=eae;function tae(e,t){return e&&e.length?PN(e,ri(t,2)):0}var tl=tae;function gg(e){let t=Object.create(null);return Object.assign(t,e)}class cx{#e=0;#t=0;#n=0;#r=0;#i=Date.now();#u=void 0;#c=0;#l=0;#a=!1;#o=gg();#s=null;#p=null;#f=null;totalCostUSD(){return this.#e}totalAPIDuration(){return this.#t}totalAPIDurationWithoutRetries(){return this.#n}totalToolDuration(){return this.#r}totalDuration(){return Math.max(0,Date.now()-this.#i)}sessionStartTime(){return this.#u??this.#i}totalLinesAdded(){return this.#c}totalLinesRemoved(){return this.#l}hasUnknownModelCost(){return this.#a}modelUsage(){return this.#o}usageForModel(e){return this.#o[e]}totalInputTokens(){return tl(Object.values(this.#o),"inputTokens")}totalOutputTokens(){return tl(Object.values(this.#o),"outputTokens")}totalCacheReadInputTokens(){return tl(Object.values(this.#o),"cacheReadInputTokens")}totalCacheCreationInputTokens(){return tl(Object.values(this.#o),"cacheCreationInputTokens")}totalWebSearchRequests(){return tl(Object.values(this.#o),"webSearchRequests")}recordApiDuration(e,t){this.#t+=e,this.#n+=t}recordCost(e,t,n){this.#o[n]=t,this.#e+=e}recordToolDuration(e){this.#r+=e}recordLinesChanged(e,t){this.#c+=e,this.#l+=t}markUnknownModelCost(){this.#a=!0}zeroDurationsAndCostForTests(){this.#t=0,this.#n=0,this.#e=0}restartClock(){this.#i=Date.now(),this.anchorLogicalStart(void 0)}anchorLogicalStart(e){this.#u=e===void 0?void 0:Math.min(e,this.#i)}restore({totalCostUSD:e,totalAPIDuration:t,totalAPIDurationWithoutRetries:n,totalToolDuration:r,totalLinesAdded:o,totalLinesRemoved:s,lastDuration:i,startTime:a,modelUsage:c,hasUnknownModelCost:l},u){if(this.#f=u,this.#e=e,this.#t=t,this.#n=n,this.#r=r,this.#c=o,this.#l=s,this.#a=l??!1,c)this.#o=gg(c);if(i!==void 0)this.#i=Date.now()-i;this.anchorLogicalStart(a)}registerSaver(e){this.#s=e}runSaver(e,t){(this.#s??(t?t.#s:null))?.(e)}registerTranscriptRecorder(e){this.#p=e}runTranscriptRecorder(e,t,n){(this.#p??(n?n.#p:null))?.(e,t)}snapshot(){return{ownerSessionId:this.#f,totalCostUSD:this.#e,totalAPIDuration:this.#t,totalAPIDurationWithoutRetries:this.#n,totalToolDuration:this.#r,startTime:this.#i,sessionLogicalStartTime:this.#u,totalLinesAdded:this.#c,totalLinesRemoved:this.#l,hasUnknownModelCost:this.#a,modelUsage:jd(this.#o,(e)=>({...e}))}}restoreSnapshot(e){this.#f=e.ownerSessionId,this.#e=e.totalCostUSD,this.#t=e.totalAPIDuration,this.#n=e.totalAPIDurationWithoutRetries,this.#r=e.totalToolDuration,this.#i=e.startTime,this.#u=e.sessionLogicalStartTime,this.#c=e.totalLinesAdded,this.#l=e.totalLinesRemoved,this.#a=e.hasUnknownModelCost,this.#o=gg(jd(e.modelUsage,(t)=>({...t})))}claim(e){this.#f??=e}scopeTo(e){this.#f=e}ownerSessionId(){return this.#f}belongsTo(e){return this.#f===e}reset(e){this.#f=e,this.#e=0,this.#t=0,this.#n=0,this.#r=0,this.#i=Date.now(),this.anchorLogicalStart(void 0),this.#c=0,this.#l=0,this.#a=!1,this.#o=gg()}}class lx{#e=!1;fableConsentSessionFallback(){return this.#e}replaceFableConsentSessionFallback(e){this.#e=e}reset(){this.#e=!1}}class ux{#e={registeredHooks:null};#t=void 0;#n=void 0;holder(){return this.#e}mainThreadAgentType(){return this.#t}replaceMainThreadAgentType(e){this.#t=e}mainThreadAgentHooks(){return this.#n}replaceMainThreadAgentHooks(e){this.#n=e}reset(){this.#e={registeredHooks:null},this.#t=void 0,this.#n=void 0}}class dx{#e=new Map;skills(){return this.#e}lookup(e){return this.#e.get(e)}record(e,t){this.#e.set(e,t)}forget(e){this.#e.delete(e)}forgetAll(){this.#e.clear()}reset(){this.#e=new Map}}class px{#e=[];#t;#n;#r;approvedServers(){return this.#e}approveServers(e,t){for(let n of t)if(!this.#e.some((r)=>r.name===n&&r.workspaceKey===e))this.#e.push({name:n,workspaceKey:e})}registerClientsAccessor(e){this.#t=e}acquireClientsAccessor(e){if(this.#t)return()=>{};return this.#t=e,()=>{if(this.#t===e)this.#t=void 0}}clientsFromAccessor(){return this.#t?.()}registerConnectedClientWiring(e){this.#n=e}connectedClientWiring(){return this.#n}registerToolsSwapper(e){this.#r=e}acquireToolsSwapper(e){if(this.#r)return()=>{};return this.#r=e,()=>{if(this.#r===e)this.#r=void 0}}swapServerTools(e,t){if(!this.#r)return!1;return this.#r(e,t)}reset(){this.#e=[],this.#t=void 0}}class fx{#e=void 0;#t=void 0;#n=void 0;#r=void 0;#i=void 0;#u=void 0;#c=!1;#l=!1;#a=void 0;#o=void 0;mainLoopModelOverride(){return this.#e}overrideMainLoopModel(e){this.#e=e}mainLoopEffortState(){return this.#t}replaceMainLoopEffortState(e){this.#t=e}initialMainLoopModel(){return this.#n}replaceInitialMainLoopModel(e){this.#n=e}initialModelSettingLayer(){return this.#r}replaceInitialModelSettingLayer(e){this.#r=e}resolvedOrgDefault(){return this.#i}replaceResolvedOrgDefault(e){this.#i=e}initialEnvDefaultModel(){return this.#u}replaceInitialEnvDefaultModel(e){this.#u=e}refusalFallbackOccurred(){return this.#c}markRefusalFallbackOccurred(e){this.#c=!0,this.#a??=e}refusalFallbackHeaderArmed(){return this.#l}armRefusalFallbackHeader(e){this.#l=!0,this.#a??=e}refusalFallbackLatchOriginRequestId(){return this.#a}forgetRefusalFallbackOccurred(){this.#c=!1,this.#l=!1,this.#a=void 0}refusalFallbackModelLatch(){return this.#o}replaceRefusalFallbackModelLatch(e){this.#o=e}unlatchRefusalFallbackModel(){this.#o=void 0}reset(){this.#e=void 0,this.#t=void 0,this.#n=void 0,this.#r=void 0,this.#i=void 0,this.#u=void 0,this.#c=!1,this.#l=!1,this.#a=void 0,this.#o=void 0}}class mx{#e=new Map;#t=null;#n=0;#r=void 0;#i=null;sections(){return this.#e}recordSection(e,t){this.#e.set(e,t)}forgetAllSections(){this.#e.clear()}noteInvalidation(e="other"){this.#n+=1,this.#r=e}epoch(){return this.#n}lastInvalidationReason(){return this.#r}registerWordingLatchClear(e){this.#i=e}clearWordingLatch(e){(this.#i??(e?e.#i:null))?.()}lastEmittedDate(){return this.#t}replaceLastEmittedDate(e){this.#t=e}reset(){this.#e=new Map,this.#t=null}}class hx{#e=null;#t=null;#n=null;#r=null;#i=null;#u=0;#c=void 0;#l=null;#a=null;#o=!1;#s=null;#p=null;#f=!1;lastAPIRequest(){return this.#e}replaceLastAPIRequest(e){this.#e=e}lastCancelledAPIMessageId(){return this.#t}replaceLastCancelledAPIMessageId(e){this.#t=e}lastAPIRequestMessages(){return this.#n}replaceLastAPIRequestMessages(e){this.#n=e}lastClassifierRequests(){return this.#r}replaceLastClassifierRequests(e){this.#r=e}promptId(){return this.#i}replacePromptId(e){this.#i=e}promptIndex(){return this.#u}replacePromptIndex(e){this.#u=e}incrementPromptIndex(){return this.#u++,this.#u}lastMainRequestId(){return this.#c}replaceLastMainRequestId(e){this.#c=e}lastMainThreadCacheTtlMs(){return this.#l}replaceLastMainThreadCacheTtlMs(e){this.#l=e,this.#a=Date.now(),this.#o=!0}lastMainThreadRequestAt(){return this.#a}mainThreadRequestedInProcess(){return this.#o}recordMainThreadTurnStart(){this.#o=!0}replaceLastMainThreadRequest(e,t){this.#a=e,this.#l=t}lastMainThreadContextTokens(){return this.#s}replaceLastMainThreadContextTokens(e){this.#s=e}stageResumeSeed(e){this.#d=e}applyResumeSeed(e){this.#d=null,this.#l=e.ttlMs,this.#a=e.requestAt,this.#s=e.contextTokens}#d=null;clearLastMainThreadRequest(e){let t=e!==void 0&&this.#d?.sessionId===e?this.#d:null;this.#d=null,this.#l=t?.ttlMs??null,this.#a=t?.requestAt??null,this.#s=t?.contextTokens??null,this.#o=!1}lastApiCompletionTimestamp(){return this.#p}replaceLastApiCompletionTimestamp(e){this.#p=e}pendingPostCompaction(){return this.#f}replacePendingPostCompaction(e){this.#f=e}reset(){this.#e=null,this.#t=null,this.#n=null,this.#r=null,this.#i=null,this.#u=0,this.#c=void 0,this.#l=null,this.#a=null,this.#o=!1,this.#s=null,this.#d=null,this.#p=null,this.#f=!1}}class gx{#e=[];#t=Object.create(null);#n=null;#r=0;#i=!1;#u=0;tasks(){return this.#e}schedule(e){this.#e.push(e)}replaceTasks(e){this.#e=e}chainStartedAt(e){return this.#t[e]}recordChainStart(e,t){this.#t[e]=t}forgetChainStart(e){delete this.#t[e]}tickInFlightPrompt(){return this.#n}replaceTickInFlightPrompt(e){this.#n=e}consecutiveKeepalives(){return this.#r}replaceConsecutiveKeepalives(e){this.#r=e}ended(){return this.#i}replaceEnded(e){this.#i=e}wakeFires(){return this.#u}recordWakeFire(){this.#u++}resetWakeFires(){this.#u=0}reset(){this.#e=[],this.#t=Object.create(null),this.#n=null,this.#r=0,this.#i=!1,this.#u=0}}class _x{#e=!1;#t=!1;#n=!1;#r=!1;#i=!1;#u=!1;#c=!1;#l=!1;#a=!1;#o=!1;#s=null;#p=null;#f=null;#d=!1;#m=null;#y=!1;#h=!1;#g=!1;#E=!1;#S=!1;#b=void 0;#v=void 0;#x=void 0;#A=null;#T=null;onboardingShownThisSession(){return this.#e}replaceOnboardingShownThisSession(e){this.#e=e}lspRecommendationShownThisSession(){return this.#t}replaceLspRecommendationShownThisSession(e){this.#t=e}sessionTrustAccepted(){return this.#n}replaceSessionTrustAccepted(e){this.#n=e}homeTrustDialogAccepted(){return this.#r}replaceHomeTrustDialogAccepted(e){this.#r=e}hasExitedPlanMode(){return this.#i}replaceHasExitedPlanMode(e){this.#i=e}needsPlanModeExitAttachment(){return this.#u}replaceNeedsPlanModeExitAttachment(e){this.#u=e}needsAutoModeExitAttachment(){return this.#c}replaceNeedsAutoModeExitAttachment(e){this.#c=e}memoryToggledOff(){return this.#l}replaceMemoryToggledOff(e){this.#l=e}teardownUnwindRequested(){return this.#d}replaceTeardownUnwindRequested(e){this.#d=e}backgroundAutoModeSetupInFlight(){return this.#a}replaceBackgroundAutoModeSetupInFlight(e){this.#a=e}launchEffortPinsReleasedForSession(){return this.#o}markLaunchEffortPinsReleasedForSession(){this.#o=!0}restoreLaunchEffortPinsReleasedForSession(e){this.#o=e}deferredToolStubGateLatch(){return this.#s}replaceDeferredToolStubGateLatch(e){this.#s=e}verifySkillRolloutGateLatch(){return this.#p}replaceVerifySkillRolloutGateLatch(e){this.#p=e}commitSkillRolloutGateLatch(){return this.#f}replaceCommitSkillRolloutGateLatch(e){this.#f=e}memoryToolsShapeLatch(){return this.#m}replaceMemoryToolsShapeLatch(e){this.#m=e}proposeGoalAvailabilityLogged(){return this.#y}markProposeGoalAvailabilityLogged(){this.#y=!0}activeRoutine(){return this.#v}replaceActiveRoutine(e){this.#v=e}inheritedTeamName(){return this.#x}replaceInheritedTeamName(e){this.#x=e}teleportedSessionInfo(){return this.#A}replaceTeleportedSessionInfo(e){this.#A=e}markFirstTeleportMessageLogged(){if(this.#A)this.#A.hasLoggedFirstMessage=!0}cachedClaudeMdContent(){return this.#T}replaceCachedClaudeMdContent(e){this.#T=e}accountSkillsSyncEnabled(){return this.#h}replaceAccountSkillsSyncEnabled(e){this.#h=e}skillsSyncVetoed(){return this.#g}replaceSkillsSyncVetoed(e){this.#g=e}accountPluginsSyncEnabled(){return this.#E}replaceAccountPluginsSyncEnabled(e){this.#E=e}pluginsSyncVetoed(){return this.#S}replacePluginsSyncVetoed(e){this.#S=e}armPendingContextCompacted(e){this.#b=e}consumePendingContextCompacted(){let e=this.#b;return this.#b=void 0,e}forgetPendingContextCompacted(){this.#b=void 0}reset(){this.#h=!1,this.#g=!1,this.#E=!1,this.#S=!1,this.#e=!1,this.#t=!1,this.#n=!1,this.#r=!1,this.#i=!1,this.#u=!1,this.#c=!1,this.#l=!1,this.#d=!1,this.#a=!1,this.#o=!1,this.#s=null,this.#p=null,this.#f=null,this.#m=null,this.#y=!1,this.#v=void 0,this.#x=void 0,this.#A=null,this.#T=null,this.#b=void 0}}class yx{#e=new Map;#t=new Map;#n=null;#r=new Map;#i=new Set;#u=new Set;#c=new Set;#l=new Set;#a=new Set;#o=new Set;#s=new Set;#p=new Set;#f=new Set;#d=new Map;#m=new Set;#y=void 0;#h=void 0;#g=void 0;planSlugCache(){return this.#e}forgetPlanSlug(e){this.#e.delete(e)}pendingBranchLinks(){return this.#t}replacePendingBranchLinks(){this.#t=new Map}vimSharedState(){return this.#n}replaceVimSharedState(e){this.#n=e}agentColorMap(){return this.#r}sessionCreatedTeams(){return this.#i}surfacedHookSpawnFailures(){return this.#u}bareMcpServerMatchersWarned(){return this.#c}pendingConversationEditKinds(){return this.#l}clientTruncatedAssistantIds(){return this.#a}heldStatelessReplyIds(){return this.#o}unsupportedThreadKeys(){return this.#s}pendingPrLinks(){return this.#p}policyPredicateTelemetryEmitted(){return this.#f}humanAttachmentDigests(){return this.#d}chromeAvailabilityStagesLogged(){return this.#m}replaceChromeAvailabilityStagesLogged(e){if(this.#m=new Set,e)this.#y=Date.now()}chromeAvailabilityAnchorMs(){return this.#y}pendingGoalIdleCheckin(){return this.#h}replacePendingGoalIdleCheckin(e){this.#h=e}workerCheckin(){return this.#g}replaceWorkerCheckin(e){this.#g=e}reset(){this.#e=new Map,this.#t=new Map,this.#n=null,this.#r=new Map,this.#i=new Set,this.#u=new Set,this.#c=new Set,this.#l=new Set,this.#a=new Set,this.#o=new Set,this.#s=new Set,this.#p=new Set,this.#f=new Set,this.#d=new Map,this.#m=new Set,this.#y=void 0,clearTimeout(this.#h),this.#h=void 0,clearInterval(this.#g?.timer),this.#g=void 0}}var IN={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};class Sx{#e=!1;#t=void 0;#n=void 0;#r=void 0;#i=null;#u=!1;#c=void 0;#l=IN;#a=!1;#o="idle";attacherCapsChanged=Tt();rvSupervisorLinkChanged=Tt();sdkDialogHostActive(){return this.#e}markSdkDialogHostActive(e){this.#e=e}sdkSupportedDialogKinds(){return this.#t}sdkSupportedDialogKindsSource(){return this.#n}declareDialogKinds(e,t){this.#t=e,this.#n=e===void 0?void 0:t}sdkPerTaskStopAffordance(){return this.#r}declarePerTaskStopAffordance(e){this.#r=e}attacherCaps(){return this.#i}replaceAttacherCaps(e){this.#i=e,this.attacherCapsChanged.emit()}rvSupervisorLinkLive(){return this.#u}replaceRvSupervisorLinkLive(e){if(this.#u===e)return;this.#u=e,this.rvSupervisorLinkChanged.emit()}sdkBetas(){return this.#c}replaceSdkBetas(e){this.#c=e}caps(){return this.#l}replaceCaps(e){this.#l=e}markRemote(e){this.#l={...this.#l,workspace:e?"remote":"local"}}replBridgeActive(){return this.#a}replaceReplBridgeActive(e){if(this.#a===e)return;this.#a=e}mainLoopBusy(){return this.#o!=="idle"}mainQueryRunning(){return this.#o==="running"}replaceMainLoopStatus(e){this.#o=e}reset(){this.#e=!1,this.#t=void 0,this.#n=void 0,this.#r=void 0,this.#i=null,this.#c=void 0,this.#l=IN,this.#a=!1,this.#o="idle",this.#u=!1,this.attacherCapsChanged.clear(),this.rvSupervisorLinkChanged.clear()}}class bx{#e=0;#t=null;#n=0;outputTokensAtTurnStart(){return this.#e}budget(){return this.#t}continuationCount(){return this.#n}snapshotForTurn(e,t){this.#e=e,this.#t=t,this.#n=0}incrementContinuation(){this.#n++}reset(){this.#e=0,this.#t=null,this.#n=0}}var DN=150;class Ex{#e=Date.now();#t=!1;interactionFired=Tt();#n=void 0;terminalFocusFired=Tt();#r=!1;#i;lastInteractionTime(){return this.#e}recordInteraction(e){if(e)this.#u();else this.#t=!0}flushIfDirty(){if(this.#t)this.#u()}#u(){this.#e=Date.now(),this.#t=!1,this.interactionFired.emit()}resetBaseline(){this.#e=Date.now(),this.#t=!1}terminalFocus(){return this.#n}updateTerminalFocus(e){this.#n=e,this.terminalFocusFired.emit()}scrollDraining(){return this.#r}markScrollActivity(){if(this.#r=!0,this.#i)clearTimeout(this.#i);this.#i=setTimeout(()=>{this.#r=!1,this.#i=void 0},DN),this.#i.unref?.()}async waitForScrollIdle(){while(this.#r)await new Promise((e)=>setTimeout(e,DN))}reset(){this.#e=Date.now(),this.#n=void 0,this.interactionFired.clear(),this.terminalFocusFired.clear()}}var nae=["sdk_single_prompt_gate","subagent_estimate","subagent_final_turn"];class xx{byAgent=new Map;attemptsByAgent=new Map;cappedFailuresByAgent=new Map;armGateEventEmitted=new Set;sidecarIo=Promise.resolve();rehydrateAttemptedSessions=new Set;sidecarReadsAhead=new Map;get(e){return this.byAgent.get(e)}has(e){return this.byAgent.has(e)}put(e,t){this.byAgent.set(e,t)}remove(e){this.byAgent.delete(e)}nextAttemptNumber(e){let t=(this.attemptsByAgent.get(e)??0)+1;return this.attemptsByAgent.set(e,t),t}consecutiveCountedFailures(e){return this.cappedFailuresByAgent.get(e)??0}recordCountedFailure(e){let t=(this.cappedFailuresByAgent.get(e)??0)+1;return this.cappedFailuresByAgent.set(e,t),t}clearCountedFailures(e){this.cappedFailuresByAgent.delete(e)}latchArmGateEvent(e){if(this.armGateEventEmitted.has(e))return!1;return this.armGateEventEmitted.add(e),!0}enqueueSidecarIo(e,t){return this.sidecarIo=this.sidecarIo.then(e,e).catch(t),this.sidecarIo}sidecarIoSettled(){return this.sidecarIo}hasAttemptedRehydrate(e){return this.rehydrateAttemptedSessions.has(e)}markRehydrateAttempted(e){this.rehydrateAttemptedSessions.add(e)}keepSidecarReadAhead(e,t){this.sidecarReadsAhead.delete(e);while(this.sidecarReadsAhead.size>=8){let n=this.sidecarReadsAhead.keys().next().value;if(n===void 0)break;this.sidecarReadsAhead.delete(n)}this.sidecarReadsAhead.set(e,t)}takeSidecarReadAhead(e){let t=this.sidecarReadsAhead.get(e);return this.sidecarReadsAhead.delete(e),t}dropSidecarReadAhead(e){this.sidecarReadsAhead.delete(e)}forgetSubagentTelemetry(e){this.attemptsByAgent.delete(e),this.cappedFailuresByAgent.delete(e);for(let t of nae)this.armGateEventEmitted.delete(`${e}:${t}`)}}class vx{#e=null;#t=null;mainAgentId(e){return this.#e??=YE(e),this.#e}projectDir(){return this.#t}replaceProjectDir(e){this.#t=e}}class wx{openToolUseId;answeredThisSession=!1;get answered(){return this.answeredThisSession}markAnswered(){this.answeredThisSession=!0}isOpenElsewhere(e){return this.openToolUseId!==void 0&&this.openToolUseId!==e}open(e){this.openToolUseId=e}closeFor(e){if(e!==void 0&&this.openToolUseId===e)this.openToolUseId=void 0}}class Ax{granted=!1;isGranted(){return this.granted}grant(){this.granted=!0}}class Tx{inFlight=null;startedForTurnEnd=!1;reset(){this.inFlight?.abort(),this.inFlight=null,this.startedForTurnEnd=!1}}class Cx{firstSyncPromise=null;syncErrors=[];syncedLaneOpened=!1;removalsDeferredHere=new Set;pendingTrashRemovals=[]}class kx{abortController=null;reset(){this.abortController?.abort(),this.abortController=null}}class Rx{#e=void 0;#t=void 0;ccrSessionID(){return this.#e}latchCcrSessionID(e){this.#e=e}syncEnabled(){return this.#t}latchSyncEnabled(e){return this.#t=e,e}}class Ox{autonomousPreambleDelivered=!1;lastLoopFileDelivered=null;reset(){this.autonomousPreambleDelivered=!1,this.lastLoopFileDelivered=null}}class Px{exchanges=[];replace(e){this.exchanges=e}append(e,t,n){this.exchanges=[...this.exchanges,{question:e,response:t,...n&&{fallbackNotice:n}}].slice(-20)}pendingReopen=null;reopenAway=!1;get reopenPending(){return this.pendingReopen!==null}armReopen(e,t){if(this.pendingReopen){this.pendingReopen.owners.add(e);return}this.pendingReopen={owners:new Set([e]),cancel:t()}}clearPendingReopen(e){let t=this.pendingReopen;if(!t){this.reopenAway=!1;return}if(e!==void 0){if(t.owners.delete(e),t.owners.size>0)return}t.cancel(),this.pendingReopen=null,this.reopenAway=!1}reopener=null;setReopener(e){this.reopener=e}get hasReopener(){return this.reopener!==null}reopenNow(){return this.reopener?.()??!1}inFlightQuestions=[];get inFlight(){return this.inFlightQuestions.at(-1)??null}pendingBesidesTop(){return this.inFlightQuestions.slice(0,-1)}setInFlight(e){if(!this.inFlightQuestions.includes(e))this.inFlightQuestions=[...this.inFlightQuestions,e]}clearInFlight(e){if(this.inFlightQuestions.includes(e))this.inFlightQuestions=this.inFlightQuestions.filter((t)=>t!==e)}}import{lstatSync as Zlt,readlinkSync as Ylt,realpathSync as HN}from"fs";function Lr(e,t,n){return new Promise((r,o)=>{if(t?.aborted){if(n?.throwOnAbort||n?.abortError)o(n.abortError?.()??Error("aborted"));else r();return}let s=setTimeout((a,c,l)=>{a?.removeEventListener("abort",c),l()},e,t,i,r);function i(){if(clearTimeout(s),n?.throwOnAbort||n?.abortError)o(n.abortError?.()??Error("aborted"));else r()}if(t?.addEventListener("abort",i,{once:!0}),n?.unref)s.unref()})}function rae(e,t){e(Error(t))}function Nr(e,t,n){let r,o=new Promise((s,i)=>{r=setTimeout(rae,t,i,n)});return Promise.race([e,o]).finally(()=>{if(r!==void 0)clearTimeout(r)})}import{homedir as oae}from"os";import{basename as tut,dirname as LN,isAbsolute as nut,join as rut,parse as out,relative as sut,resolve as nl,sep as gs}from"path";import*as Nx from"path";function it(e){return process.platform==="darwin"?e.normalize("NFC"):e}function Vo(e){return/^[\\/]{2}/.test(e)||Eg(e)}function BN(e){return/(^|[\\/])\.\.([\\/]|$)/.test(e)}function NN(e){if(/^[\\/]{2}[?.][\\/](?!unc[\\/])/i.test(e))return null;return e.match(/^[\\/]{2}(?:[?.][\\/]unc[\\/])?([^\\/]+)/i)?.[1]?.replace(/[A-Z]/g,(t)=>t.toLowerCase())??null}function Hd(e){return/(^|[\\/])\.{1,2}[. ]*([\\/]|$)/.test(e)}function rl(e){return/^[\\/]{2}[?.][\\/]/.test(e)}function sae(e){return/^[\\/](GLOBAL\?\?|GLOBALROOT|DosDevices|Device)[\\/]/i.test(e)}function KN(e,t){if(!Vo(e))return!1;if(rl(e)||Eg(e))return!0;if(Hd(e))return!0;let n=NN(e);return n===null||n!==NN(t)}function GN(e){return e.length===2&&Ix(e[0])==="net"||e.length===3&&Ix(e[0])==="network"&&Ix(e[1])==="servers"}function Mx(e){if(process.platform==="win32"||!e.startsWith("/"))return null;let t=[];for(let n of e.split("/")){if(n===""||n===".")continue;if(n===".."){t.pop();continue}if(t.push(n),GN(t))return iae(n)}return null}function iae(e){return e.replace(/[A-Z]/g,(t)=>t.toLowerCase())}function Ix(e){return e.replace(/[\u200c-\u200f\u202a-\u202e\u206a-\u206f\ufeff]/g,"").toUpperCase().toLowerCase()}function WN(e,t){if(!ol(e))return!1;let n=Mx(e);return n===null||n!==Mx(t)}function ol(e){if(process.platform==="win32")return!1;return ua(e)}function ua(e){return Sg(e)!==null}function Sg(e){if(!e.startsWith("/"))return null;let t=[];for(let n of e.split("/")){if(n===""||n===".")continue;if(n===".."){t.pop();continue}if(t.push(n),GN(t))return"/"+t.join("/")}return null}function Bd(e){if(!e.startsWith("/"))return!1;let t=[];for(let n of e.split("/")){if(n===""||n===".")continue;if(n===".."){t.pop();continue}t.push(n)}return t.length===1&&t[0].toLowerCase()==="net"}function Kd(e){if(!e.startsWith("/"))return!1;let t=[];for(let n of e.split("/")){if(n===""||n===".")continue;if(n===".."){t.pop();continue}if(t.push(n),t.length===1&&t[0].toLowerCase()==="network")return!0}return!1}function VN(e){if(process.platform!=="darwin")return!1;return Kd(e)}function Ux(e){return Fx(e)||ua(e)||Kd(e)||Bd(e)||rl(e)||Eg(e)||sae(e)}function da(e){return/^[\\/]{2}wsl(\$|\.localhost)[\\/]/i.test(e)}function Fx(e){return Vo(e)&&!da(e)}function $x(e){if(e.startsWith("\\\\?\\UNC\\"))return"\\\\"+e.slice(8);if(e.startsWith("\\\\?\\")&&e.length>=7&&e[5]===":")return e.slice(4);return e}function qN(e){if(/^\\\\\?\\volume\{/i.test(e))return MN(e);if(Eg(e))return!0;let t=$x(e);if(t!==e&&MN(t))return!0;return Vo(t)&&!da(t)}function MN(e){return Hd(e)||e.includes("/")}function zx(e){try{return $x(HN.native(e))}catch{return null}}var aae=new Set(["EPERM","EBUSY","EACCES"]),cae=4,lae=50,UN;function _g(e){return pae(e).real??null}function bg(e,t){let n=nl(t).toLowerCase(),r=LN(nl(e)).toLowerCase();if(r===n||FN(r,n)||$N(r,n,"lexical"))return!0;let o=_g(t)?.toLowerCase();if(o==null)return!1;let s=_g(LN(nl(e)))?.toLowerCase();if(s==null)return!0;return s===o||FN(s,o)||$N(s,o,"canonical")}var uae=new Set(["node_modules",".venv","venv","env",".env","virtualenv",".tox",".nox",".direnv","__pypackages__"]);function FN(e,t){if(!e.startsWith(yg(t)+gs))return!1;return e.split(gs).some((n)=>uae.has(n))}function yg(e){return e.endsWith(gs)?e.slice(0,-1):e}var Dx;function $N(e,t,n){let r=oae(),o=(process.env.LOCALAPPDATA??"").trim();if(n==="lexical")return Lx(zN(r,o,(c)=>nl(c).toLowerCase()),e,t);let s=r+"\x00"+o;if(Dx?.key===s)return Lx(Dx.aliasDirs,e,t);let i=!0,a=zN(r,o,(c)=>{if(!dae(c))return nl(c).toLowerCase();let l=_g(c)?.toLowerCase();if(l==null)return i=!1,nl(c).toLowerCase();return l});if(i)Dx={key:s,aliasDirs:a};return Lx(a,e,t)}function zN(e,t,n){let r=[];if(e)r.push(yg(n(e))+gs+["appdata","local","microsoft","windowsapps"].join(gs));if(t){let o=yg(n(t))+gs+["microsoft","windowsapps"].join(gs);if(!r.includes(o))r.push(o)}return r}function dae(e){return process.platform==="win32"?/^[A-Za-z]:[\\/](?![\\/])/.test(e):e.startsWith("/")&&!Vo(e)}function Lx(e,t,n){let r=yg(n);for(let o of e){if(!(o===r||o.startsWith(r+gs)))continue;if(t===o||t.startsWith(o+gs))return!0}return!1}function pae(e){let t=mae(()=>$x(HN.native(e)));return{real:t.value,code:t.code}}function fae(e){return e!=null&&typeof e==="object"&&"code"in e&&typeof e.code==="string"?e.code:void 0}function mae(e){for(let t=0;;t++)try{return{value:e()}}catch(n){let r=fae(n);if(r===void 0||process.platform!=="win32"||!aae.has(r)||t>=cae-1)return{code:r};UN??=new Int32Array(new SharedArrayBuffer(4)),Atomics.wait(UN,0,0,lae)}}function Eg(e){return jN.test(e)||e.includes("??")&&jN.test(hae(e))}var jN=/^[\\/]\?\?[\\/]/;function hae(e){return Nx.win32?Nx.win32.normalize(e):e}class jx{pending=null;shownThisSession=!1;changed=Tt();subscribe=this.changed.subscribe;getSnapshot=()=>this.pending;offer(e){if(this.shownThisSession)return;this.pending=e,this.changed.emit()}dismiss(){if(this.pending!==null)this.pending=null,this.changed.emit()}markShown(){this.shownThisSession=!0}}class Hx{lastEmittedAt=new Map;shouldEmit(e,t,n){let r=this.lastEmittedAt.get(e)||0;if(t-r<n)return!1;if(this.lastEmittedAt.size>=100){let o=this.lastEmittedAt.keys().next().value;if(o!==void 0)this.lastEmittedAt.delete(o)}return this.lastEmittedAt.set(e,t),!0}}var gae=Symbol("permission-stash-evicted");class Kx{entriesCap;evictedKeysCap;lanes={write:new Map,read:new Map};evicted={write:new Set,read:new Set};poisoned={write:!1,read:!1};constructor(e=256,t=1048576){this.entriesCap=e;this.evictedKeysCap=t}stash(e,t,n,r="write"){if(e===void 0)return;let o=this.lanes[r],s=this.evicted[r],i=Bx(e,t);if(s.has(i))return;let a=o.get(i);if(a!==void 0){let c=new Set(n);o.set(i,a.filter((l)=>c.has(l)));return}if(o.size>=this.entriesCap){let c=o.keys().next().value;if(c!==void 0){if(o.delete(c),s.add(c),s.size>this.evictedKeysCap){this.poisoned[r]=!0;let l=s.values().next().value;if(l!==void 0)s.delete(l)}}}o.set(i,n)}holds(e,t,n="write"){return e!==void 0&&this.lanes[n].has(Bx(e,t))}consume(e,t,n="write"){if(e===void 0)return;let r=this.lanes[n],o=Bx(e,t),s=r.get(o),i=s===void 0&&(this.evicted[n].delete(o)||this.poisoned[n]),a=`${e}\x00`;for(let c of r.keys())if(c.startsWith(a))r.delete(c);if(i)return gae;return s}}function Bx(e,t){return`${e}\x00${t}`}function ZN(e){return YN({kind:"root",host:e.host,id:e.id,parentId:e.parentId},e.project)}function YN(e,t){let n=it(t.originalCwd),r=it(t.projectRoot),o=it(t.cwd),s=Tt(),i=e.kind==="fork"?e.root.observers:new sx,a=e.kind==="fork"?e.root.autonomousLoopPreamble:new Ox,c=e.kind==="fork"?e.root.precompute:new xx,l={get originalCwd(){return n},get projectRoot(){return r},get cwd(){return o}},u={host:e.kind==="fork"?e.root.host:e.host,get id(){return e.kind==="fork"?e.root.id:e.id},get parentId(){return e.kind==="fork"?e.root.parentId:e.parentId},get root(){return e.kind==="fork"?e.root:u},project:l,observers:i,autonomousLoopPreamble:a,btwHistory:e.kind==="fork"?e.root.btwHistory:new Px,ccrRecap:e.kind==="fork"?e.root.ccrRecap:new Tx,conversationLatches:e.kind==="fork"?e.root.conversationLatches:new ix,costLedger:e.kind==="fork"?e.root.costLedger:new cx,fableConsentSlots:e.kind==="fork"?e.root.fableConsentSlots:new lx,hookRegistry:e.kind==="fork"?e.root.hookRegistry:new ux,identity:e.kind==="fork"?e.root.identity:new vx,invokedSkills:e.kind==="fork"?e.root.invokedSkills:new dx,mcpSessionWiring:e.kind==="fork"?e.root.mcpSessionWiring:new px,modelSelection:e.kind==="fork"?e.root.modelSelection:new fx,promptAssembly:e.kind==="fork"?e.root.promptAssembly:new mx,promptSuggestion:e.kind==="fork"?e.root.promptSuggestion:new kx,pendingHint:e.kind==="fork"?e.root.pendingHint:new jx,pluginsSync:e.kind==="fork"?e.root.pluginsSync:new Cx,precompute:c,requestJournal:e.kind==="fork"?e.root.requestJournal:new hx,sessionCron:e.kind==="fork"?e.root.sessionCron:new gx,sessionFlags:e.kind==="fork"?e.root.sessionFlags:new _x,sessionRefsGate:e.kind==="fork"?e.root.sessionRefsGate:new Rx,sessionScratch:e.kind==="fork"?e.root.sessionScratch:new yx,surfaceCapabilities:e.kind==="fork"?e.root.surfaceCapabilities:new Sx,toolProgressThrottle:e.kind==="fork"?e.root.toolProgressThrottle:new Hx,turnBudget:e.kind==="fork"?e.root.turnBudget:new bx,userPresence:e.kind==="fork"?e.root.userPresence:new Ex,workflowUsageConsent:e.kind==="fork"?e.root.workflowUsageConsent:new Ax,outsideReadPrompt:e.kind==="fork"?e.root.outsideReadPrompt:new wx,writePermissionStash:e.kind==="fork"?e.root.writePermissionStash:new Kx,subscribe(p){let f=s.subscribe(p);if(e.kind!=="fork")return f;let m=e.root,{id:h,parentId:y}=m,_=m.subscribe(()=>{if(m.id===h&&m.parentId===y)return;h=m.id,y=m.parentId,p()});return()=>{f(),_()}},setCwd(p){u.update({project:{cwd:p}})},withProject(p){return YN({kind:"fork",root:u.root},{originalCwd:p.originalCwd??n,projectRoot:p.projectRoot??r,cwd:p.cwd??o})},update(p){let f=!1;if(p.id!==void 0||"parentId"in p){if(e.kind==="fork")throw Error("A withProject fork cannot re-identify the session — update the root session instead");if(p.id!==void 0&&p.id!==e.id)e.id=p.id,f=!0;if("parentId"in p&&p.parentId!==e.parentId)e.parentId=p.parentId,f=!0}let m=p.project;if(m){if(m.originalCwd!==void 0){let h=it(m.originalCwd);if(h!==n)n=h,f=!0}if(m.projectRoot!==void 0){let h=it(m.projectRoot);if(h!==r)r=h,f=!0}if(m.cwd!==void 0){let h=it(m.cwd);if(h!==o)o=h,f=!0}}if(f)s.emit()}};return u}class xg{#e;#t=new WeakMap;constructor(e){this.#e=e}peek(e){return this.#t.get(e.root)}of(e){let t=e.root,n=this.#t.get(t);if(n!==void 0)return n;let r=this.#e();return this.#t.set(t,r),r}drop(e){this.#t.delete(e.root)}}class Gx{#e=!1;#t=null;#n=!1;#r=void 0;#i=!1;#u=!1;#c=!1;#l=!1;#a=void 0;#o=!1;#s=!1;#p="cli";#f="fresh";#d=void 0;#m=[];#y=!1;#h=!1;#g=!1;#E=!1;#S=!1;#b=!1;#v=!1;#x=!1;#A=!1;#T=!1;#C=!0;#D=null;#w=!1;#N=null;#k=!1;#R=!1;#L={};isInteractive(){return this.#e}replaceIsInteractive(e){this.#e=e}printOutputFormat(){return this.#t}replacePrintOutputFormat(e){this.#t=e}thinkingDisplayExplicit(){return this.#n}replaceThinkingDisplayExplicit(e){this.#n=e}permissionPromptToolName(){return this.#r}replacePermissionPromptToolName(e){this.#r=e}hasStreamingInput(){return this.#i}replaceHasStreamingInput(e){this.#i=e}singleShotPrintSession(){return this.#u}replaceSingleShotPrintSession(e){this.#u=e}printInputClosed(){return this.#c}markPrintInputClosed(){this.#c=!0}modelOverrideOptOutForSession(){return this.#l}replaceModelOverrideOptOutForSession(e){this.#l=e}rendererMode(){return this.#a}replaceRendererMode(e){this.#a=e}strictToolResultPairing(){return this.#o}replaceStrictToolResultPairing(e){this.#o=e}restrictedSession(){return this.#s}replaceRestrictedSession(e){this.#s=e}clientType(){return this.#p}replaceClientType(e){this.#p=e}sessionStartType(){return this.#f}replaceSessionStartType(e){this.#f=e}questionPreviewFormat(){return this.#d}replaceQuestionPreviewFormat(e){this.#d=e}replConfigArgv(){return this.#m}replaceReplConfigArgv(e){this.#m=e}userMsgOptIn(){return this.#y}replaceUserMsgOptIn(e){this.#y=e}searchToolsOptIn(){return this.#h}replaceSearchToolsOptIn(e){this.#h=e}todoToolsOptIn(){return this.#g}replaceTodoToolsOptIn(e){this.#g=e}wizardOperatorToolsEnabled(){return this.#E}replaceWizardOperatorToolsEnabled(e){this.#E=e}pollEventIngressWired(){return this.#S}markPollEventIngressWired(){this.#S=!0}sdkAgentProgressSummariesEnabled(){return this.#b}replaceSdkAgentProgressSummariesEnabled(e){this.#b=e}sessionPersistenceDisabled(){return this.#v}replaceSessionPersistenceDisabled(e){this.#v=e}diskless(){return this.#x}replaceDiskless(e){this.#x=e}sessionBypassPermissionsMode(){return this.#A}replaceSessionBypassPermissionsMode(e){this.#A=e}disableSlashCommands(){return this.#T}replaceDisableSlashCommands(e){this.#T=e}mayForwardHomeSettings(){return this.#C}replaceMayForwardHomeSettings(e){this.#C=e}homeSettingsHostConsent(){return this.#D}replaceHomeSettingsHostConsent(e){this.#D=e}scheduledTasksEnabled(){return this.#w}replaceScheduledTasksEnabled(e){this.#w=e}initJsonSchema(){return this.#N}replaceInitJsonSchema(e){this.#N=e}cliSessionConfigCarried(){return this.#k}replaceCliSessionConfigCarried(e){this.#k=e}forkRestrictedLaunchConfig(){return this.#R}replaceForkRestrictedLaunchConfig(e){this.#R=e}forkReplayLaunchConfig(){return this.#L}replaceForkReplayLaunchConfig(e){this.#L=e}reset(){this.#e=!1,this.#t=null,this.#n=!1,this.#r=void 0,this.#i=!1,this.#u=!1,this.#c=!1,this.#l=!1,this.#a=void 0,this.#o=!1,this.#s=!1,this.#p="cli",this.#f="fresh",this.#d=void 0,this.#m=[],this.#y=!1,this.#h=!1,this.#g=!1,this.#E=!1,this.#S=!1,this.#b=!1,this.#v=!1,this.#x=!1,this.#A=!1,this.#T=!1,this.#C=!0,this.#D=null,this.#w=!1,this.#N=null,this.#k=!1,this.#R=!1,this.#L={}}}class Wx{#e=void 0;#t=void 0;#n=void 0;#r=null;#i=null;#u=!1;#c=JN();#l=!1;flagSettingsPath(){return this.#e}replaceFlagSettingsPath(e){this.#e=e}flagSettingsExpectedContent(){return this.#t}replaceFlagSettingsExpectedContent(e){this.#t=e}flagSettingsFilePinnedContent(){return this.#n}replaceFlagSettingsFilePinnedContent(e){this.#n=e}flagSettingsInline(){return this.#r}replaceFlagSettingsInline(e){this.#r=e}parentManagedSettings(){return this.#i}replaceParentManagedSettings(e){this.#i=e}parentManagedSettingsInvalid(){return this.#u}replaceParentManagedSettingsInvalid(e){this.#u=e}allowedSettingSources(){return this.#c}replaceAllowedSettingSources(e){this.#c=e}useCoworkPlugins(){return this.#l}replaceUseCoworkPlugins(e){this.#l=e}reset(){this.#e=void 0,this.#t=void 0,this.#n=void 0,this.#r=null,this.#i=null,this.#u=!1,this.#c=JN(),this.#l=!1}}function JN(){return["userSettings","projectSettings","localSettings","flagSettings","policySettings"]}class Vx{#e=[];#t=[];#n=[];#r=void 0;#i=[];#u=[];#c=!1;#l=void 0;#a=void 0;#o=void 0;inlinePlugins(){return this.#e}replaceInlinePlugins(e){this.#e=e}inlinePluginsNoMcp(){return this.#t}replaceInlinePluginsNoMcp(e){this.#t=e}inlinePluginUrls(){return this.#n}replaceInlinePluginUrls(e){this.#n=e}syncedPluginDirs(){return this.#r??[]}syncedPluginDirsRegistered(){return this.#r!==void 0}replaceSyncedPluginDirs(e){this.#r=e}clearSyncedPluginDirs(){this.#r=void 0}additionalDirectoriesForClaudeMd(){return this.#i}replaceAdditionalDirectoriesForClaudeMd(e){this.#i=e}allowedChannels(){return this.#u}replaceAllowedChannels(e){this.#u=e}hasDevChannels(){return this.#c}replaceHasDevChannels(e){this.#c=e}sessionSkillAllowlist(){return this.#l}replaceSessionSkillAllowlist(e){this.#l=e}chromeFlagOverride(){return this.#a}replaceChromeFlagOverride(e){this.#a=e}teammateAgentId(){return this.#o}replaceTeammateAgentId(e){this.#o=e}reset(){this.#e=[],this.#t=[],this.#n=[],this.clearSyncedPluginDirs(),this.#i=[],this.#u=[],this.#c=!1,this.#l=void 0,this.#a=void 0,this.#o=void 0}}class qx{#e=null;#t=null;modelStrings(){return this.#e}replaceModelStrings(e){this.#e=e}invalidate(){this.#e=null}admin3PSteeringSnapshot(){return this.#t}recordAdmin3PSteeringSnapshot(e){this.#t=e}reset(){this.#e=null,this.#t=null}}var XN=[];class Zx{#e=[];#t=[];#n=void 0;errorLog(){return this.#e}recordError(e){if(this.#e.length>=100)this.#e.shift();this.#e.push(e)}recordSlowOperation(e,t){return}slowOperations(){if(this.#t.length===0)return XN;let e=Date.now();if(this.#t.some((t)=>e-t.timestamp>=1e4)){if(this.#t=this.#t.filter((t)=>e-t.timestamp<1e4),this.#t.length===0)return XN}return this.#t}recordDevBarAlert(e){return}devBarAlert(){let e=this.#n;if(e&&Date.now()-e.timestamp>=60000){this.#n=void 0;return}return e}reset(){this.#e=[],this.#t=[],this.#n=void 0}}function QN(){return{rateTokens:null,rateLastRefillMs:null,featureOkLogged:!1,reportedDropReasons:new Set}}class Yx{#e=null;#t=null;#n=null;#r=null;#i=null;#u=null;#c=null;#l=null;#a=null;#o=null;#s=null;#p=null;#f=null;#d=[];#m=null;#y=QN();#h=null;#g=null;#E=null;#S={direct:null,proxied:null};#b=null;#v=null;installMeter(e,t,{omitUnits:n=!1}={}){this.#e=e;let r=(o)=>n?void 0:o;this.#t=t("claude_code.session.count",{description:"Count of CLI sessions started"}),this.#n=t("claude_code.lines_of_code.count",{description:"Count of lines of code modified, with the 'type' attribute indicating whether lines were added or removed and the 'model' attribute indicating which model made the change"}),this.#r=t("claude_code.pull_request.count",{description:"Number of pull requests created"}),this.#i=t("claude_code.commit.count",{description:"Number of git commits created"}),this.#u=t("claude_code.cost.usage",{description:"Cost of the Claude Code session",unit:r("USD")}),this.#c=t("claude_code.token.usage",{description:"Number of tokens used",unit:r("tokens")}),this.#l=t("claude_code.code_edit_tool.decision",{description:"Count of code editing tool permission decisions (accept/reject) for Edit, Write, and NotebookEdit tools"}),this.#a=t("claude_code.active_time.total",{description:"Total active time in seconds",unit:r("s")})}meter(){return this.#e}sessionCounter(){return this.#t}locCounter(){return this.#n}prCounter(){return this.#r}commitCounter(){return this.#i}costCounter(){return this.#u}tokenCounter(){return this.#c}codeEditToolDecisionCounter(){return this.#l}activeTimeCounter(){return this.#a}statsStore(){return this.#o}replaceStatsStore(e){this.#o=e}loggerProvider(){return this.#s}replaceLoggerProvider(e){this.#s=e}eventLogger(){return this.#p}eventLoggerOwner(){return this.#f}attachEventLogger(e,t){if(this.#p=e,this.#f=e?t:null,!e)return;let n=this.#d;if(this.#d=null,n)for(let r of n)e.emit(r)}bufferPendingEvent(e){if(this.#d===null||this.#d.length>=100)return!1;return this.#d.push(e),!0}closeWindow(e){this.#d=null,this.#m=e}windowCloseCause(){return this.#m}isWindowOpen(){return this.#d!==null}hostOtel(){return this.#y}meterProvider(){return this.#h}replaceMeterProvider(e){this.#h=e}tracerProvider(){return this.#g}replaceTracerProvider(e){this.#g=e}cachedTelemetryResource(){return this.#E}replaceCachedTelemetryResource(e){this.#E=e}cachedOtlpHttpAgentFactory(e){return this.#S[e?"proxied":"direct"]}replaceCachedOtlpHttpAgentFactory(e,t){this.#S[e?"proxied":"direct"]=t}inClusterOtlpTrustRoots(){return this.#b}replaceInClusterOtlpTrustRoots(e){this.#b=e}inClusterOtlpAgentFactory(){return this.#v}replaceInClusterOtlpAgentFactory(e){this.#v=e}reset(){this.#e=null,this.#t=null,this.#n=null,this.#r=null,this.#i=null,this.#u=null,this.#c=null,this.#l=null,this.#a=null,this.#o=null,this.#s=null,this.#p=null,this.#f=null,this.#d=[],this.#m=null,this.#y=QN(),this.#h=null,this.#g=null,this.#E=null,this.#S={direct:null,proxied:null},this.#b=null,this.#v=null}}class Jx{#e=void 0;#t=void 0;#n=!1;#r=void 0;#i=void 0;#u=new Set;#c=void 0;#l=null;#a=null;#o=0;#s=!1;#p=null;#f=void 0;#d=null;#m=null;sessionIngressToken(){return this.#e}replaceSessionIngressToken(e){this.#e=e}oauthTokenFromFd(){return this.#t}replaceOauthTokenFromFd(e){this.#t=e}oauthTokenFromBgSnapshot(){return this.#n}replaceOauthTokenFromBgSnapshot(e){this.#n=e}oauthScopesFromFd(){return this.#r}replaceOauthScopesFromFd(e){this.#r=e}apiKeyFromFd(){return this.#i}replaceApiKeyFromFd(e){this.#i=e}descriptorAnnouncementConsumed(e){return this.#u.has(e)}markDescriptorAnnouncementConsumed(e){this.#u.add(e)}gatewayTokenFromDescriptor(){return this.#c}replaceGatewayTokenFromDescriptor(e){this.#c=e}resetFdCredentialState(){this.#e=void 0,this.#t=void 0,this.#n=!1,this.#r=void 0,this.#i=void 0}gatewayAuth(){return this.#l}replaceGatewayAuth(e){this.#l=e}gatewayServerProcess(){return this.#s}replaceGatewayServerProcess(e){this.#s=e}authenticatedAccount(){return this.#a}authenticatedAccountEpoch(){return this.#o}stampAuthenticatedAccount(e){let t=this.#a;if(e!==null&&t!==null&&e.accountUuid===t.accountUuid&&e.emailAddress===t.emailAddress&&e.organizationUuid===t.organizationUuid)return;this.#o+=1,this.#a=e}startupPolicySnapshot(){return this.#f}replaceStartupPolicySnapshot(e){this.#f=e}gatewayRefreshInFlight(){return this.#p}replaceGatewayRefreshInFlight(e){this.#p=e}sdkOAuthTokenRefreshCallback(){return this.#d}replaceSdkOAuthTokenRefreshCallback(e){this.#d=e}hostAuthTokenRefreshCallback(){return this.#m}replaceHostAuthTokenRefreshCallback(e){this.#m=e}resetForTests(){this.#e=null,this.#t=null,this.#n=!1,this.#r=void 0,this.#i=null,this.#u.clear(),this.#c=void 0,this.#l=null,this.#a=null,this.#o=0,this.#s=!1,this.#p=null,this.#f=void 0,this.#d=null,this.#m=null}}class Xx{#e=void 0;#t=!1;#n=!1;#r;directConnectServerUrl(){return this.#e}replaceDirectConnectServerUrl(e){this.#e=e}connectNonBlocking(){return this.#t}replaceConnectNonBlocking(e){this.#t=e}strictConfig(){return this.#n}replaceStrictConfig(e){this.#n=e}registerEnsureConnectedClient(e){this.#r=e}ensureConnectedClient(){return this.#r}reset(){this.#e=void 0,this.#t=!1,this.#n=!1}}class Qx{#e=null;#t=new Map;#n=new Map;#r=new Set;#i=!1;#u=!1;#c=!1;#l=!1;#a=!1;#o=new Set;#s=new Map;#p=new Map;promptCache1hAllowlist(){return this.#e}replacePromptCache1hAllowlist(e){this.#e=e}thinkingTypeOverrides(){return this.#t}recordThinkingTypeOverride(e,t){this.#t.set(e,t)}servedModelsByRequestedModel(){return this.#n}recordServedModels(e,t){this.#n.set(e,t)}effortUnsupportedModels(){return this.#r}markEffortUnsupported(e){this.#r.add(e)}midConvCachePromotionRejected(){return this.#i}markMidConvCachePromotionRejected(){this.#i=!0}strictPrefixLockStoodDown(){return this.#u}markStrictPrefixLockStoodDown(){this.#u=!0}perTurnEffortOkEmitted(){return this.#c}markPerTurnEffortOkEmitted(){this.#c=!0}lateToolAdditionsOkEmitted(){return this.#l}markLateToolAdditionsOkEmitted(){this.#l=!0}toolChangeHeaderRefused(){return this.#a}markToolChangeHeaderRefused(){this.#a=!0}toolChangeUnsupportedModels(){return this.#o}markToolChangeUnsupportedModel(e){this.#o.add(e)}inferenceProfileBackingModels(){return this.#s}recordInferenceProfileBackingModel(e,t){this.#s.set(e,t)}foundryDeploymentCapabilities(){return this.#p}reset(){this.#e=null,this.#t=new Map,this.#n=new Map,this.#r=new Set,this.#i=!1,this.#u=!1,this.#c=!1,this.#l=!1,this.#a=!1,this.#o=new Set,this.#s=new Map,this.#p=new Map}}class ev{#e=!1;#t=!1;longContext1mCreditsBlocked(){return this.#e}replaceLongContext1mCreditsBlocked(e){this.#e=e}fableCreditsRequired(){return this.#t}replaceFableCreditsRequired(e){this.#t=e}reset(){this.#e=!1,this.#t=!1}}class tv{#e=!1;#t=!1;#n=eM;#r=Tt();selectorGate(){return this.#e}selectorGateEverOn(){return this.#t}replaceSelectorGate(e){this.#e=e,this.#t||=e}inheritSelectorGateEverOn(){this.#t=!0}resampleSelectorGate(e){let t=this.#e;if(this.#e=e,this.#t||=e,t!==e)this.#r.emit(e)}subscribeSelectorGateChanged(e){return this.#r.subscribe(e)}replaceHostGateSubscription(e){let t=this.#n;this.#n=e,t()}dropHostGateSubscription(){this.replaceHostGateSubscription(eM)}}function eM(){}class nv{started=!1;stagingReaped=!1;claim(){if(this.started)return!1;return this.started=!0,!0}claimStagingReap(){if(this.stagingReaped)return!1;return this.stagingReaped=!0,!0}}class rv{backgroundHousekeeping;launchOptions;settingsSource;extensionsConfig;modelStringsCache;diagnostics;telemetryHandles;credentialSlots;mcpProcessWiring;requestLatches;accountCreditLatches;proactivity;constructor(e){this.backgroundHousekeeping=e.backgroundHousekeeping,this.launchOptions=e.launchOptions,this.settingsSource=e.settingsSource,this.extensionsConfig=e.extensionsConfig,this.modelStringsCache=e.modelStringsCache,this.diagnostics=e.diagnostics,this.telemetryHandles=e.telemetryHandles,this.credentialSlots=e.credentialSlots,this.mcpProcessWiring=e.mcpProcessWiring,this.requestLatches=e.requestLatches,this.accountCreditLatches=e.accountCreditLatches,this.proactivity=e.proactivity}}function tM(){return new rv({backgroundHousekeeping:new nv,launchOptions:new Gx,settingsSource:new Wx,extensionsConfig:new Vx,modelStringsCache:new qx,diagnostics:new Zx,telemetryHandles:new Yx,credentialSlots:new Jx,mcpProcessWiring:new Xx,requestLatches:new Qx,accountCreditLatches:new ev,proactivity:new tv})}function _ae(e=ox()){return ZN({host:tM(),id:ZL()??Nd(),project:{originalCwd:e,projectRoot:e,cwd:e}})}var yae=_ae(dN);function Ct(){return nM()}function nM(){return rM()?.session??yae}function Sae(){let e=rM();return e?.session?void 0:e}var rM=()=>{return};function ov(){return Sae()?.sessionId??nM().id}var Rdt=new xg(()=>Tt());var Odt=new xg(()=>Tt());var Pdt=new nt(()=>Tt());import{execFile as nnt}from"child_process";import{randomUUID as PL}from"crypto";import{createReadStream as rnt,realpathSync as ont}from"fs";import{mkdir as CL,readdir as snt,readFile as sne,rm as int,writeFile as ine}from"fs/promises";import{createRequire as ant}from"module";import{homedir as kL,tmpdir as cnt}from"os";import{dirname as RL,isAbsolute as ane,join as vn,relative as cne,resolve as Vh,sep as IL}from"path";import{createInterface as lnt}from"readline";import{fileURLToPath as unt}from"url";import{setMaxListeners as bae}from"events";var Eae=50;function Gd(e=Eae){let t=new AbortController;return bae(e,t.signal),t}var Ldt=new FinalizationRegistry(({parentSignalRef:e,handler:t})=>{e.deref()?.removeEventListener("abort",t)});var Ndt={"user-cancel":new DOMException("user-cancel","AbortError"),"remote-cancel":new DOMException("remote-cancel","AbortError"),shutdown:new DOMException("shutdown","AbortError"),interrupt:new DOMException("interrupt","AbortError"),"turn-abort":new DOMException("turn-abort","AbortError"),background:new DOMException("background","AbortError"),"refusal-fallback-edit":new DOMException("refusal-fallback-edit","AbortError"),"recovery-timeout":new DOMException("recovery-timeout","AbortError")};var xae="server-fallback-tombstone";var Mdt=new DOMException(xae,"AbortError");var vae="subagent-park",Udt=new DOMException(vae,"AbortError");import{spawn as BFe}from"child_process";import{existsSync as KFe}from"fs";import{createInterface as GFe}from"readline";import{StringDecoder as WFe}from"string_decoder";var _s=["PreToolUse","PostToolUse","PostToolUseFailure","PostToolBatch","Notification","UserPromptSubmit","UserPromptExpansion","SessionStart","SessionEnd","Stop","StopFailure","SubagentStart","SubagentStop","PreCompact","PostCompact","PreModelSwitch","PostModelSwitch","PermissionRequest","PermissionDenied","Setup","TeammateIdle","TaskCreated","TaskCompleted","Elicitation","ElicitationResult","ConfigChange","WorktreeCreate","WorktreeRemove","InstructionsLoaded","CwdChanged","FileChanged","DirectoryAdded","MessageDisplay"],wae=["clear","resume","logout","prompt_input_exit","other"],Aae="__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__";function Wd(e){return e.charAt(0).toUpperCase()+e.slice(1)}function sv(e,t,n=t+"s"){return e===1?t:n}function sl(e,t){if(t<=0)return"";if(e.length<=t)return e;let n=e.slice(0,t),r=n.charCodeAt(t-1);return oM(r>=55296&&r<=56319?n.slice(0,-1):n)}function iv(e,t){if(t<=0)return"";if(e.length<=t)return e;let n=e.slice(-t),r=n.charCodeAt(0);return oM(r>=56320&&r<=57343?n.slice(1):n)}function oM(e){if(typeof Buffer<"u")return Buffer.from(e,"utf16le").toString("utf16le");return Tae(e)}function Tae(e){let n=[];for(let r=0;r<e.length;r+=8192){let o=Math.min(r+8192,e.length),s=new Uint16Array(o-r);for(let i=r;i<o;i++)s[i-r]=e.charCodeAt(i);n.push(String.fromCharCode(...s))}return n.join("")}var Cae=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/,kae=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,vg=typeof String.prototype.isWellFormed==="function"?Function.prototype.call.bind(String.prototype.isWellFormed):void 0,jdt=typeof String.prototype.toWellFormed==="function"?Function.prototype.call.bind(String.prototype.toWellFormed):void 0;function wg(e){if(vg)return vg(e);return!Cae.test(e)}function Ag(e){if(vg&&vg(e))return e;return e.replace(kae,"")}function av(e,t){let n=e.indexOf(t);return n===-1?e:e.slice(0,n)}function sM(e,t,n=0){let r=0,o=e.indexOf(t,n);while(o!==-1)r++,o=e.indexOf(t,o+1);return r}function Rae(e){let t=/[\p{Cc}\p{Cf}\p{Default_Ignorable_Code_Point}\u2028\u2029]/gu;if(!t.test(e))return e;let n="";for(let{segment:r}of new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(e)){let o=/\p{Extended_Pictographic}|\p{Regional_Indicator}|^[#*0-9]\uFE0F?\u20E3$/u.test(r),s=/^\u{1F3F4}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,6}\u{E007F}$/u.test(r);t.lastIndex=0,n+=r.replace(t,(i,a)=>{if(i===`
94
+ `||i==="\t")return i;let c=i.codePointAt(0)??0;if(o&&(i==="️"||i==="︎"||i==="⃣"||i==="‍"&&a+i.length<r.length||s&&c>=917536&&c<=917631))return i;if(c===27)return"␛";if(c<32)return String.fromCodePoint(9216+c);if(c===127)return"␡";return`\\u{${c.toString(16).toUpperCase()}}`})}return n}function Tg(e){return Rae(e).replace(/\n/g,"␤").replace(/\t/g,"␉")}var Oae=/^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/,Pae=/<command-name>(.*?)<\/command-name>/;function pa(e,t){if(e.type!=="user")return;if(e.isMeta===!0||e.isCompactSummary===!0)return;let n=e.message;if(!n)return;let r=n.content,o=[];if(typeof r==="string")o.push(r);else if(Array.isArray(r))for(let s of r){if(!s||typeof s!=="object")continue;if(s.type==="tool_result")return;if(s.type==="text"&&typeof s.text==="string")o.push(s.text)}for(let s of o){let i=s.replaceAll(`
95
+ `," ").trim();if(!i)continue;let a=Pae.exec(i);if(a){if(!t.commandFallback)t.commandFallback=a[1];continue}let c=/<bash-input>([\s\S]*?)<\/bash-input>/.exec(i);if(c)return`! ${c[1].trim()}`;if(Oae.test(i))continue;if(i.length>200)i=sl(i,200).trim()+"…";return i}return}var Iae={customTitle:"customTitle",aiTitle:"aiTitle",lastPrompt:"lastPrompt",summary:"summaryHint",gitBranch:"gitBranch"};function Cg(e,t,n,r){let o=r?.mtime??e?.mtime??0,s=e!==void 0?{sessionId:e.sessionId,mtime:o,data:{...e.data}}:{sessionId:t.sessionId,mtime:o,data:{}},i=s.data;for(let a of n){let c=Lae(a.timestamp);if(i.isSidechain===void 0)i.isSidechain=a.isSidechain===!0;if(i.createdAt===void 0&&c!==void 0)i.createdAt=c;if(i.cwd===void 0){let l=a.cwd;if(typeof l==="string"&&l)i.cwd=l}Nae(i,a);for(let[l,u]of Object.entries(Iae)){let p=a[l];if(typeof p==="string")i[u]=p}if(a.type==="tag"){let l=a.tag;if(typeof l==="string"&&l)i.tag=l;else delete i.tag}if(a.type==="relocated"){let l=a.relocatedCwd;if(typeof l==="string"&&l)i.cwd=l}}return s}function iM(e,t){let n=e.data;if(n.isSidechain===!0)return null;let r=oi(n.firstPromptLocked===!0?n.firstPrompt:n.commandFallback)||void 0,o=oi(n.customTitle)||oi(n.aiTitle)||void 0,s=o||oi(n.lastPrompt)||oi(n.summaryHint)||r;if(!s)return null;return{sessionId:e.sessionId,summary:s,lastModified:e.mtime,fileSize:void 0,customTitle:o,firstPrompt:r,gitBranch:oi(n.gitBranch)||void 0,cwd:oi(n.cwd)||t||void 0,tag:oi(n.tag)||void 0,createdAt:Dae(n.createdAt)}}function oi(e){return typeof e==="string"?e:void 0}function Dae(e){return typeof e==="number"?e:void 0}function Lae(e){if(typeof e!=="string")return;let t=Date.parse(e);return Number.isNaN(t)?void 0:t}function Nae(e,t){if(e.firstPromptLocked)return;let n={commandFallback:e.commandFallback??""},r=pa(t,n);if(n.commandFallback&&!e.commandFallback)e.commandFallback=n.commandFallback;if(r!==void 0)e.firstPrompt=r,e.firstPromptLocked=!0}class cv{store=new Map;mtimes=new Map;summaries=new Map;lastMtime=0;keyToString(e){let t=[e.projectKey,e.sessionId];if(e.subpath)t.push(e.subpath);return t.join("/")}async append(e,t){let n=this.keyToString(e),r=this.store.get(n)??[];r.push(...t),this.store.set(n,r);let o=Math.max(Date.now(),this.lastMtime+1);if(this.lastMtime=o,this.mtimes.set(n,o),e.subpath===void 0){let s=`${e.projectKey}/${e.sessionId}`,i=Cg(this.summaries.get(s),e,t,{mtime:o});this.summaries.set(s,i)}}async load(e){let t=this.keyToString(e);return this.store.get(t)??null}async listSessions(e){let t=[],n=e+"/";for(let[r]of this.store)if(r.startsWith(n)){let o=r.slice(n.length);if(!o.includes("/"))t.push({sessionId:o,mtime:this.mtimes.get(r)??0})}return t}async listSessionSummaries(e){let t=[],n=e+"/";for(let[r,o]of this.summaries)if(r.startsWith(n))t.push(o);return t}async delete(e){let t=this.keyToString(e);if(this.store.delete(t),this.mtimes.delete(t),e.subpath===void 0){this.summaries.delete(`${e.projectKey}/${e.sessionId}`);let n=`${e.projectKey}/${e.sessionId}/`;for(let r of this.store.keys())if(r.startsWith(n))this.store.delete(r),this.mtimes.delete(r)}}async listSubkeys(e){let t=`${e.projectKey}/${e.sessionId}/`,n=[];for(let r of this.store.keys())if(r.startsWith(t))n.push(r.slice(t.length));return n}getEntries(e){return this.store.get(this.keyToString(e))??[]}get size(){let e=0;for(let t of this.store.keys()){let n=t.indexOf("/");if(n!==-1&&!t.slice(n+1).includes("/"))e++}return e}clear(){this.store.clear(),this.mtimes.clear(),this.summaries.clear()}}function ys(e){return!Array.isArray?mM(e)==="[object Array]":Array.isArray(e)}var Mae=1/0;function Uae(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-Mae?"-0":t}function Fae(e){return e==null?"":Uae(e)}function qo(e){return typeof e==="string"}function pM(e){return typeof e==="number"}function $ae(e){return e===!0||e===!1||zae(e)&&mM(e)=="[object Boolean]"}function fM(e){return typeof e==="object"}function zae(e){return fM(e)&&e!==null}function gr(e){return e!==void 0&&e!==null}function lv(e){return!e.trim().length}function mM(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var jae="Incorrect 'index' type",Hae=(e)=>`Invalid value for key ${e}`,Bae=(e)=>`Pattern length exceeds max of ${e}.`,Kae=(e)=>`Missing ${e} property in key`,Gae=(e)=>`Property 'weight' in key '${e}' must be a positive integer`,aM=Object.prototype.hasOwnProperty;class hM{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((n)=>{let r=gM(n);this._keys.push(r),this._keyMap[r.id]=r,t+=r.weight}),this._keys.forEach((n)=>{n.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function gM(e){let t=null,n=null,r=null,o=1,s=null;if(qo(e)||ys(e))r=e,t=cM(e),n=uv(e);else{if(!aM.call(e,"name"))throw Error(Kae("name"));let i=e.name;if(r=i,aM.call(e,"weight")){if(o=e.weight,o<=0)throw Error(Gae(i))}t=cM(i),n=uv(i),s=e.getFn}return{path:t,id:n,weight:o,src:r,getFn:s}}function cM(e){return ys(e)?e:e.split(".")}function uv(e){return ys(e)?e.join("."):e}function Wae(e,t){let n=[],r=!1,o=(s,i,a)=>{if(!gr(s))return;if(!i[a])n.push(s);else{let c=i[a],l=s[c];if(!gr(l))return;if(a===i.length-1&&(qo(l)||pM(l)||$ae(l)))n.push(Fae(l));else if(ys(l)){r=!0;for(let u=0,p=l.length;u<p;u+=1)o(l[u],i,a+1)}else if(i.length)o(l,i,a+1)}};return o(e,qo(t)?t.split("."):t,0),r?n:n[0]}var Vae={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},qae={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},Zae={location:0,threshold:0.6,distance:100},Yae={useExtendedSearch:!1,getFn:Wae,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},Ee={...qae,...Vae,...Zae,...Yae},Jae=/[^ ]+/g;function Xae(e=1,t=3){let n=new Map,r=Math.pow(10,t);return{get(o){let s=o.match(Jae).length;if(n.has(s))return n.get(s);let i=1/Math.pow(s,0.5*e),a=parseFloat(Math.round(i*r)/r);return n.set(s,a),a},clear(){n.clear()}}}class Og{constructor({getFn:e=Ee.getFn,fieldNormWeight:t=Ee.fieldNormWeight}={}){this.norm=Xae(t,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((t,n)=>{this._keysMap[t.id]=n})}create(){if(this.isCreated||!this.docs.length)return;if(this.isCreated=!0,qo(this.docs[0]))this.docs.forEach((e,t)=>{this._addString(e,t)});else this.docs.forEach((e,t)=>{this._addObject(e,t)});this.norm.clear()}add(e){let t=this.size();if(qo(e))this._addString(e,t);else this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,n=this.size();t<n;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!gr(e)||lv(e))return;let n={v:e,i:t,n:this.norm.get(e)};this.records.push(n)}_addObject(e,t){let n={i:t,$:{}};this.keys.forEach((r,o)=>{let s=r.getFn?r.getFn(e):this.getFn(e,r.path);if(!gr(s))return;if(ys(s)){let i=[],a=[{nestedArrIndex:-1,value:s}];while(a.length){let{nestedArrIndex:c,value:l}=a.pop();if(!gr(l))continue;if(qo(l)&&!lv(l)){let u={v:l,i:c,n:this.norm.get(l)};i.push(u)}else if(ys(l))l.forEach((u,p)=>{a.push({nestedArrIndex:p,value:u})})}n.$[o]=i}else if(qo(s)&&!lv(s)){let i={v:s,n:this.norm.get(s)};n.$[o]=i}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function _M(e,t,{getFn:n=Ee.getFn,fieldNormWeight:r=Ee.fieldNormWeight}={}){let o=new Og({getFn:n,fieldNormWeight:r});return o.setKeys(e.map(gM)),o.setSources(t),o.create(),o}function Qae(e,{getFn:t=Ee.getFn,fieldNormWeight:n=Ee.fieldNormWeight}={}){let{keys:r,records:o}=e,s=new Og({getFn:t,fieldNormWeight:n});return s.setKeys(r),s.setIndexRecords(o),s}function kg(e,{errors:t=0,currentLocation:n=0,expectedLocation:r=0,distance:o=Ee.distance,ignoreLocation:s=Ee.ignoreLocation}={}){let i=t/e.length;if(s)return i;let a=Math.abs(r-n);if(!o)return a?1:i;return i+a/o}function ece(e=[],t=Ee.minMatchCharLength){let n=[],r=-1,o=-1,s=0;for(let i=e.length;s<i;s+=1){let a=e[s];if(a&&r===-1)r=s;else if(!a&&r!==-1){if(o=s-1,o-r+1>=t)n.push([r,o]);r=-1}}if(e[s-1]&&s-r>=t)n.push([r,s-1]);return n}var fa=32;function tce(e,t,n,{location:r=Ee.location,distance:o=Ee.distance,threshold:s=Ee.threshold,findAllMatches:i=Ee.findAllMatches,minMatchCharLength:a=Ee.minMatchCharLength,includeMatches:c=Ee.includeMatches,ignoreLocation:l=Ee.ignoreLocation}={}){if(t.length>fa)throw Error(Bae(fa));let u=t.length,p=e.length,f=Math.max(0,Math.min(r,p)),m=s,h=f,y=a>1||c,_=y?Array(p):[],E;while((E=e.indexOf(t,h))>-1){let L=kg(t,{currentLocation:E,expectedLocation:f,distance:o,ignoreLocation:l});if(m=Math.min(L,m),h=E+u,y){let F=0;while(F<u)_[E+F]=1,F+=1}}h=-1;let S=[],x=1,v=u+p,w=1<<u-1;for(let L=0;L<u;L+=1){let F=0,K=v;while(F<K){if(kg(t,{errors:L,currentLocation:f+K,expectedLocation:f,distance:o,ignoreLocation:l})<=m)F=K;else v=K;K=Math.floor((v-F)/2+F)}v=K;let ne=Math.max(1,f-K+1),se=i?p:Math.min(f+K,p)+u,X=Array(se+2);X[se+1]=(1<<L)-1;for(let Ie=se;Ie>=ne;Ie-=1){let yt=Ie-1,Z=n[e.charAt(yt)];if(y)_[yt]=+!!Z;if(X[Ie]=(X[Ie+1]<<1|1)&Z,L)X[Ie]|=(S[Ie+1]|S[Ie])<<1|1|S[Ie+1];if(X[Ie]&w){if(x=kg(t,{errors:L,currentLocation:yt,expectedLocation:f,distance:o,ignoreLocation:l}),x<=m){if(m=x,h=yt,h<=f)break;ne=Math.max(1,2*f-h)}}}if(kg(t,{errors:L+1,currentLocation:f,expectedLocation:f,distance:o,ignoreLocation:l})>m)break;S=X}let U={isMatch:h>=0,score:Math.max(0.001,x)};if(y){let L=ece(_,a);if(!L.length)U.isMatch=!1;else if(c)U.indices=L}return U}function nce(e){let t={};for(let n=0,r=e.length;n<r;n+=1){let o=e.charAt(n);t[o]=(t[o]||0)|1<<r-n-1}return t}class gv{constructor(e,{location:t=Ee.location,threshold:n=Ee.threshold,distance:r=Ee.distance,includeMatches:o=Ee.includeMatches,findAllMatches:s=Ee.findAllMatches,minMatchCharLength:i=Ee.minMatchCharLength,isCaseSensitive:a=Ee.isCaseSensitive,ignoreLocation:c=Ee.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:o,findAllMatches:s,minMatchCharLength:i,isCaseSensitive:a,ignoreLocation:c},this.pattern=a?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;let l=(p,f)=>{this.chunks.push({pattern:p,alphabet:nce(p),startIndex:f})},u=this.pattern.length;if(u>fa){let p=0,f=u%fa,m=u-f;while(p<m)l(this.pattern.substr(p,fa),p),p+=fa;if(f){let h=u-fa;l(this.pattern.substr(h),h)}}else l(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,includeMatches:n}=this.options;if(!t)e=e.toLowerCase();if(this.pattern===e){let m={isMatch:!0,score:0};if(n)m.indices=[[0,e.length-1]];return m}let{location:r,distance:o,threshold:s,findAllMatches:i,minMatchCharLength:a,ignoreLocation:c}=this.options,l=[],u=0,p=!1;this.chunks.forEach(({pattern:m,alphabet:h,startIndex:y})=>{let{isMatch:_,score:E,indices:S}=tce(e,m,h,{location:r+y,distance:o,threshold:s,findAllMatches:i,minMatchCharLength:a,includeMatches:n,ignoreLocation:c});if(_)p=!0;if(u+=E,_&&S)l=[...l,...S]});let f={isMatch:p,score:p?u/this.chunks.length:1};if(p&&n)f.indices=l;return f}}class Ss{constructor(e){this.pattern=e}static isMultiMatch(e){return lM(e,this.multiRegex)}static isSingleMatch(e){return lM(e,this.singleRegex)}search(){}}function lM(e,t){let n=e.match(t);return n?n[1]:null}class yM extends Ss{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){let t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}class SM extends Ss{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){let n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class bM extends Ss{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){let t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}class EM extends Ss{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){let t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class xM extends Ss{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){let t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class vM extends Ss{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){let t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class _v extends Ss{constructor(e,{location:t=Ee.location,threshold:n=Ee.threshold,distance:r=Ee.distance,includeMatches:o=Ee.includeMatches,findAllMatches:s=Ee.findAllMatches,minMatchCharLength:i=Ee.minMatchCharLength,isCaseSensitive:a=Ee.isCaseSensitive,ignoreLocation:c=Ee.ignoreLocation}={}){super(e);this._bitapSearch=new gv(e,{location:t,threshold:n,distance:r,includeMatches:o,findAllMatches:s,minMatchCharLength:i,isCaseSensitive:a,ignoreLocation:c})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class yv extends Ss{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t=0,n,r=[],o=this.pattern.length;while((n=e.indexOf(this.pattern,t))>-1)t=n+o,r.push([n,t-1]);let s=!!r.length;return{isMatch:s,score:s?0:1,indices:r}}}var dv=[yM,yv,bM,EM,vM,xM,SM,_v],uM=dv.length,rce=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,oce="|";function sce(e,t={}){return e.split(oce).map((n)=>{let r=n.trim().split(rce).filter((s)=>s&&!!s.trim()),o=[];for(let s=0,i=r.length;s<i;s+=1){let a=r[s],c=!1,l=-1;while(!c&&++l<uM){let u=dv[l],p=u.isMultiMatch(a);if(p)o.push(new u(p,t)),c=!0}if(c)continue;l=-1;while(++l<uM){let u=dv[l],p=u.isSingleMatch(a);if(p){o.push(new u(p,t));break}}}return o})}var ice=new Set([_v.type,yv.type]);class wM{constructor(e,{isCaseSensitive:t=Ee.isCaseSensitive,includeMatches:n=Ee.includeMatches,minMatchCharLength:r=Ee.minMatchCharLength,ignoreLocation:o=Ee.ignoreLocation,findAllMatches:s=Ee.findAllMatches,location:i=Ee.location,threshold:a=Ee.threshold,distance:c=Ee.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:n,minMatchCharLength:r,findAllMatches:s,ignoreLocation:o,location:i,threshold:a,distance:c},this.pattern=t?e:e.toLowerCase(),this.query=sce(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:r}=this.options;e=r?e:e.toLowerCase();let o=0,s=[],i=0;for(let a=0,c=t.length;a<c;a+=1){let l=t[a];s.length=0,o=0;for(let u=0,p=l.length;u<p;u+=1){let f=l[u],{isMatch:m,indices:h,score:y}=f.search(e);if(m){if(o+=1,i+=y,n){let _=f.constructor.type;if(ice.has(_))s=[...s,...h];else s.push(h)}}else{i=0,o=0,s.length=0;break}}if(o){let u={isMatch:!0,score:i/o};if(n)u.indices=s;return u}}return{isMatch:!1,score:1}}}var pv=[];function ace(...e){pv.push(...e)}function fv(e,t){for(let n=0,r=pv.length;n<r;n+=1){let o=pv[n];if(o.condition(e,t))return new o(e,t)}return new gv(e,t)}var Rg={AND:"$and",OR:"$or"},mv={PATH:"$path",PATTERN:"$val"},hv=(e)=>!!(e[Rg.AND]||e[Rg.OR]),cce=(e)=>!!e[mv.PATH],lce=(e)=>!ys(e)&&fM(e)&&!hv(e),dM=(e)=>({[Rg.AND]:Object.keys(e).map((t)=>({[t]:e[t]}))});function AM(e,t,{auto:n=!0}={}){let r=(o)=>{let s=Object.keys(o),i=cce(o);if(!i&&s.length>1&&!hv(o))return r(dM(o));if(lce(o)){let c=i?o[mv.PATH]:s[0],l=i?o[mv.PATTERN]:o[c];if(!qo(l))throw Error(Hae(c));let u={keyId:uv(c),pattern:l};if(n)u.searcher=fv(l,t);return u}let a={children:[],operator:s[0]};return s.forEach((c)=>{let l=o[c];if(ys(l))l.forEach((u)=>{a.children.push(r(u))})}),a};if(!hv(e))e=dM(e);return r(e)}function uce(e,{ignoreFieldNorm:t=Ee.ignoreFieldNorm}){e.forEach((n)=>{let r=1;n.matches.forEach(({key:o,norm:s,score:i})=>{let a=o?o.weight:null;r*=Math.pow(i===0&&a?Number.EPSILON:i,(a||1)*(t?1:s))}),n.score=r})}function dce(e,t){let n=e.matches;if(t.matches=[],!gr(n))return;n.forEach((r)=>{if(!gr(r.indices)||!r.indices.length)return;let{indices:o,value:s}=r,i={indices:o,value:s};if(r.key)i.key=r.key.src;if(r.idx>-1)i.refIndex=r.idx;t.matches.push(i)})}function pce(e,t){t.score=e.score}function fce(e,t,{includeMatches:n=Ee.includeMatches,includeScore:r=Ee.includeScore}={}){let o=[];if(n)o.push(dce);if(r)o.push(pce);return e.map((s)=>{let{idx:i}=s,a={item:t[i],refIndex:i};if(o.length)o.forEach((c)=>{c(s,a)});return a})}class si{constructor(e,t={},n){this.options={...Ee,...t},this.options.useExtendedSearch,this._keyStore=new hM(this.options.keys),this.setCollection(e,n)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof Og))throw Error(jae);this._myIndex=t||_M(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){if(!gr(e))return;this._docs.push(e),this._myIndex.add(e)}remove(e=()=>!1){let t=[];for(let n=0,r=this._docs.length;n<r;n+=1){let o=this._docs[n];if(e(o,n))this.removeAt(n),n-=1,r-=1,t.push(o)}return t}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){let{includeMatches:n,includeScore:r,shouldSort:o,sortFn:s,ignoreFieldNorm:i}=this.options,a=qo(e)?qo(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);if(uce(a,{ignoreFieldNorm:i}),o)a.sort(s);if(pM(t)&&t>-1)a=a.slice(0,t);return fce(a,this._docs,{includeMatches:n,includeScore:r})}_searchStringList(e){let t=fv(e,this.options),{records:n}=this._myIndex,r=[];return n.forEach(({v:o,i:s,n:i})=>{if(!gr(o))return;let{isMatch:a,score:c,indices:l}=t.searchIn(o);if(a)r.push({item:o,idx:s,matches:[{score:c,value:o,norm:i,indices:l}]})}),r}_searchLogical(e){let t=AM(e,this.options),n=(i,a,c)=>{if(!i.children){let{keyId:u,searcher:p}=i,f=this._findMatches({key:this._keyStore.get(u),value:this._myIndex.getValueForItemAtKeyId(a,u),searcher:p});if(f&&f.length)return[{idx:c,item:a,matches:f}];return[]}let l=[];for(let u=0,p=i.children.length;u<p;u+=1){let f=i.children[u],m=n(f,a,c);if(m.length)l.push(...m);else if(i.operator===Rg.AND)return[]}return l},r=this._myIndex.records,o={},s=[];return r.forEach(({$:i,i:a})=>{if(gr(i)){let c=n(t,i,a);if(c.length){if(!o[a])o[a]={idx:a,item:i,matches:[]},s.push(o[a]);c.forEach(({matches:l})=>{o[a].matches.push(...l)})}}}),s}_searchObjectList(e){let t=fv(e,this.options),{keys:n,records:r}=this._myIndex,o=[];return r.forEach(({$:s,i})=>{if(!gr(s))return;let a=[];if(n.forEach((c,l)=>{a.push(...this._findMatches({key:c,value:s[l],searcher:t}))}),a.length)o.push({idx:i,item:s,matches:a})}),o}_findMatches({key:e,value:t,searcher:n}){if(!gr(t))return[];let r=[];if(ys(t))t.forEach(({v:o,i:s,n:i})=>{if(!gr(o))return;let{isMatch:a,score:c,indices:l}=n.searchIn(o);if(a)r.push({score:c,key:e,value:o,idx:s,norm:i,indices:l})});else{let{v:o,n:s}=t,{isMatch:i,score:a,indices:c}=n.searchIn(o);if(i)r.push({score:a,key:e,value:o,norm:s,indices:c})}return r}}si.version="7.0.0";si.createIndex=_M;si.parseIndex=Qae;si.config=Ee;si.parseQuery=AM;ace(wM);var TM=/[:_-]/g;class Sv{fuse;constructor(e){let t=e.map((n)=>{let{name:r,displayName:o}=n,s=r.split(TM).filter(Boolean),i=o!==r?o.split(TM).filter(Boolean):[];return{descriptionKey:(n.description??"").split(" ").map((a)=>a.toLowerCase().replace(/[^a-z0-9]/g,"")).filter(Boolean),partKey:s.length>1?s:void 0,displayPartKey:i.length>1?i:void 0,commandName:r,displayName:o,candidate:n,aliasKey:n.aliases}});this.fuse=new si(t,{includeScore:!0,threshold:0.3,location:0,distance:100,keys:[{name:"commandName",weight:3},{name:"displayName",weight:2},{name:"partKey",weight:2},{name:"aliasKey",weight:2},{name:"displayPartKey",weight:1},{name:"descriptionKey",weight:0.5}]})}search(e,t){let{getScoreBoost:n,filter:r}=t??{},o=e.trim().toLowerCase(),s=this.fuse.search(o);if(r)s=s.filter((c)=>r(c.item.candidate));return s.map((c)=>{let l=c.item.commandName.toLowerCase(),u=c.item.displayName.toLowerCase(),p=c.item.aliasKey?.map((m)=>m.toLowerCase())??[],f=n?n(c.item.candidate):0;return{r:c,name:l,display:u,aliases:p,boost:f}}).sort((c,l)=>{let u=c.name,p=l.name,f=c.aliases,m=l.aliases,h=u===o||c.display===o,y=p===o||l.display===o;if(h&&!y)return-1;if(y&&!h)return 1;let _=f.some((se)=>se===o),E=m.some((se)=>se===o);if(_&&!E)return-1;if(E&&!_)return 1;let S=(se,X)=>Math.min(se.startsWith(o)?se.length:1/0,X.startsWith(o)?X.length:1/0),x=S(u,c.display),v=S(p,l.display),w=x<1/0,U=v<1/0;if(w&&!U)return-1;if(U&&!w)return 1;if(w&&U&&x!==v)return x-v;let L=f.find((se)=>se.startsWith(o)),F=m.find((se)=>se.startsWith(o));if(L&&!F)return-1;if(F&&!L)return 1;if(L&&F&&L.length!==F.length)return L.length-F.length;let K=Math.floor((c.r.score??0)*10),ne=Math.floor((l.r.score??0)*10);if(K!==ne)return K-ne;return l.boost-c.boost}).map((c)=>c.r.item.candidate)}}function bv(){if(typeof setImmediate==="function")return new Promise((e)=>setImmediate(e));if(typeof MessageChannel==="function")return new Promise((e)=>{let t=new MessageChannel;t.port1.onmessage=()=>{t.port1.close(),e()},t.port2.postMessage(null)});return Lr(0)}var CM=16,PM=8,mce=6,hce=4,IM=8,gce=3,_ce=1,yce=100,kM=64,RM=4;class Ev{paths=[];lowerPaths=[];charBits=new Int32Array(0);pathLens=new Uint16Array(0);topLevelCache=null;matchPositions=new Int32Array(kM);readyCount=0;buildGen=0;loadFromFileList(e){let t=new Set,n=[];for(let r of e)if(r.length>0&&!t.has(r))t.add(r),n.push(r);this.buildIndex(n)}loadFromFileListAsync(e){let t=()=>{},n=new Promise((o)=>{t=o}),r=this.buildAsync(e,t);return{queryable:n,done:r}}async buildAsync(e,t){let n=++this.buildGen,r=new Set,o=[],s=performance.now();for(let a=0;a<e.length;a++){let c=e[a];if(c.length>0&&!r.has(c))r.add(c),o.push(c);if((a&255)===255&&performance.now()-s>RM){if(await bv(),this.buildGen!==n)return t(),!1;s=performance.now()}}this.resetArrays(o),s=performance.now();let i=!0;for(let a=0;a<o.length;a++)if(this.indexPath(a),(a&255)===255&&performance.now()-s>RM){if(this.readyCount=a+1,i)t(),i=!1;if(await bv(),this.buildGen!==n)return!1;s=performance.now()}return this.readyCount=o.length,t(),!0}buildIndex(e){this.buildGen++,this.resetArrays(e);for(let t=0;t<e.length;t++)this.indexPath(t);this.readyCount=e.length}resetArrays(e){let t=e.length;this.paths=e,this.lowerPaths=Array(t),this.charBits=new Int32Array(t),this.pathLens=new Uint16Array(t),this.readyCount=0,this.topLevelCache=vce(e,yce)}indexPath(e){let t=this.paths[e].toLowerCase();this.lowerPaths[e]=t;let n=t.length;this.pathLens[e]=n;let r=0;for(let o=0;o<n;o++){let s=t.charCodeAt(o);if(s>=97&&s<=122)r|=1<<s-97}this.charBits[e]=r}search(e,t){if(t<=0)return[];if(e.length===0){if(this.topLevelCache)return this.topLevelCache.slice(0,t).map(({path:x,score:v})=>({path:x,score:v,positions:[]}));return[]}let n=e!==e.toLowerCase(),r=n?e:e.toLowerCase(),o=Math.min(r.length,kM),s=Array(o),i=0;for(let x=0;x<o;x++){let v=r.charAt(x);s[x]=v;let w=v.charCodeAt(0);if(w>=97&&w<=122)i|=1<<w-97}let a=o*(CM+PM)+IM+32,c=[],l=-1/0,{paths:u,lowerPaths:p,charBits:f,pathLens:m,readyCount:h}=this,y=this.matchPositions;e:for(let x=0;x<h;x++){if((f[x]&i)!==i)continue;let v=n?u[x]:p[x],w=v.indexOf(s[0]);if(w===-1)continue;y[0]=w;let U=0,L=0,F=w;for(let X=1;X<o;X++){if(w=v.indexOf(s[X],F+1),w===-1)continue e;y[X]=w;let re=w-F-1;if(re===0)L+=hce;else U+=gce+re*_ce;F=w}if(c.length===t&&a+L-U<=l)continue;let K=u[x],ne=m[x],se=o*CM+L-U;se+=OM(K,y[0],!0);for(let X=1;X<o;X++)se+=OM(K,y[X],!1);if(se+=Math.max(0,32-(ne>>2)),c.length<t){if(c.push({pathIndex:x,fuzzScore:se}),c.length===t)c.sort((X,re)=>X.fuzzScore-re.fuzzScore),l=c[0].fuzzScore}else if(se>l){let X=0,re=c.length;while(X<re){let Ie=X+re>>1;if(c[Ie].fuzzScore<se)X=Ie+1;else re=Ie}c.splice(X,0,{pathIndex:x,fuzzScore:se}),c.shift(),l=c[0].fuzzScore}}c.sort((x,v)=>v.fuzzScore-x.fuzzScore);let _=c.length,E=Math.max(_,1),S=Array(_);for(let x=0;x<_;x++){let v=c[x].pathIndex,w=u[v],U=p[v],L=n?w:U,F=Array(o),K=0;for(let X=0;X<o;X++){let re=L.indexOf(s[X],K);F[X]=re,K=re+1}if(!n&&U.length!==w.length)xce(w,F);let ne=x/E,se=w.includes("test")?Math.min(ne*1.05,1):ne;S[x]={path:w,score:se,positions:F}}return S}}function OM(e,t,n){if(t===0)return n?IM:0;let r=e.charCodeAt(t-1);if(Sce(r))return PM;if(bce(r)&&Ece(e.charCodeAt(t)))return mce;return 0}function Sce(e){return e===47||e===92||e===45||e===95||e===46||e===32}function bce(e){return e>=97&&e<=122}function Ece(e){return e>=65&&e<=90}function xce(e,t){let n=0,r=0,o=0;while(o<t.length&&n<e.length){let s=e.codePointAt(n),i=s>65535?2:1,a=String.fromCodePoint(s).toLowerCase().length;while(o<t.length&&t[o]<r+a)t[o]=n,o++;n+=i,r+=a}}function vce(e,t){let n=new Set;for(let o of e){let s=o.length;for(let a=0;a<o.length;a++){let c=o.charCodeAt(a);if(c===47||c===92){s=a;break}}let i=o.slice(0,s);if(i.length>0){if(n.add(i),n.size>=t)break}}let r=Array.from(n);return r.sort((o,s)=>{let i=o.length-s.length;if(i!==0)return i;return o<s?-1:o>s?1:0}),r.slice(0,t).map((o)=>({path:o,score:0,positions:[]}))}var DM=["You've hit your","You've reached your","You're out of usage credits","Your org is out of usage · add funds to continue","Your org is out of usage · contact your admin","Your seat type doesn't include usage credits","Your seat type doesn't include usage","Your usage allocation has been disabled by your admin","Your group's usage limit is set to $0","Fable 5 requires usage credits","You're out of extra usage","Your seat type doesn't include extra usage"];var LM=["This service is disabled for your org"],NM=["You've used","You're close to"],MM=["You're now using usage credits","You're now using your usage allocation","Now using your usage allocation","Now using usage credits","You're now using extra usage","Now using extra usage"];class _r extends Error{}function il(){return process.versions.bun!==void 0}Zc();import{homedir as kce}from"os";import{basename as wpt,dirname as Apt,join as Rce,resolve as UM}from"path";var wce=/^[+-]?(\d+(\.\d*)?|\.\d+)[eE][+-]?\d+$/,Ace=/^[+-]?\d{1,3}([_,\u00A0\u202F ])\d{3}(?:\1\d{3})*$/,Tce=/[_,\u00A0\u202F ]/g;function Cce(e){if(e.length<=32){if(wce.test(e)){let t=Number(e);return Number.isInteger(t)?t:NaN}if(Ace.test(e))return parseInt(e.replace(Tce,""),10)}return}function xv(e){let t=String(e).trim();return Cce(t)??parseInt(t,10)}Zc();function Pg(){return process.env.CLAUDE_CONFIG_DIR}var Wt=zd(()=>(Pg()??Rce(kce(),".claude")).normalize("NFC"),Pg);function FM(e){return UM(Wt())===UM(e)}function $M(){return process.env.CLAUDE_CODE_PROJECT_DIR_NAME}var Oce=/^[A-Za-z0-9_-]{1,64}$/,Pce=/^(?:con|prn|aux|nul|com[0-9]|lpt[0-9])$/i;function vv(e){if(!e||!Oce.test(e)||Pce.test(e))return;return e}function Ice(){return`${Pg()??""}\x00${$M()??""}`}var zM=zd(()=>Pg()?vv($M()):void 0,Ice);var Dce=/hooks\.slack\.com\/(?:services|workflows|triggers)\/[A-Za-z0-9/_-]+/gi;var wv={bearer:[/\bBearer\s+[A-Za-z0-9._~+/=-]{8,}/gi,"Bearer <token>"],basic:[/(:\s*)Basic\s+[A-Za-z0-9+/=]{8,}/gi,"$1Basic <token>"],sk:[/\bsk-[A-Za-z0-9_-]{20,}/g,"<token>"]},Lce=[/\bBearer\s{1,512}(?=[A-Za-z0-9._~+/=-]{16})(?:eyJ|(?=[A-Za-z0-9._~+/=-]{0,64}[0-9=]))/i,/:\s{0,512}Basic\s{1,512}(?=[A-Za-z0-9+/=]{16})(?=[A-Za-z0-9+/=]{0,64}[0-9=])/i,/\bsk-(?=[A-Za-z0-9_-]{20})(?=[A-Za-z0-9_-]{0,64}[0-9])/];var Ipt=new RegExp(`(?:\\b(?:xox[abe-z](?:\\.xox[a-z])?|xapp|xwfp)-${al("[A-Za-z0-9+/=%_-]")}|\\bxox[cd]-|(?:xox[abe-z](?:\\.xox[a-z])?|xapp|xwfp)-(?=[0-9])|xox[cd]-${al("[A-Za-z0-9+/=%_-]")}(?=[A-Za-z0-9+/=%_-]{16}))`,"i"),HM=[[Vd("sk-ant-","[A-Za-z0-9_-]",8,jM(8)),"<token>"],[Vd("sk-(?:proj|svcacct|admin)-","[A-Za-z0-9_-]",20,jM(20)),"<token>"]],BM=[[/(^|[^A-Za-z0-9+])AKIA[A-Z0-9]{16}(?![A-Za-z0-9+=])/g,"$1<token>"],[/(^|[^A-Za-z0-9+])ASIA[A-Z0-9]{16}(?![A-Za-z0-9+=])/g,"$1<token>"]],KM=[[Vd("gh[opusr]_","[A-Za-z0-9]",20,al("[A-Za-z0-9]")),"<token>"],[/github_pat_[A-Za-z0-9_]{82,}/g,"<token>"],[/sq0(?:atp|csp)-[A-Za-z0-9_-]{22,}/g,"<token>"],[/(^|[^A-Za-z0-9+/])EAAA[A-Za-z0-9+/=%_-]{56,}/g,"$1<token>"],[Vd("gl(?:pat|dt|rt|ft|soat|oas|agent|ptt|cbt|imt|ffct)-","[A-Za-z0-9_=-]",20,al("[A-Za-z0-9_=-]"),"(?:\\.[0-9a-z]{9})?"),"<token>"],[Vd("(?:xox[abe-z](?:\\.xox[a-z])?|xapp|xwfp)-","[A-Za-z0-9+/=%_-]",10,"(?=[0-9])","",al("[A-Za-z0-9+/=%_-]"),"gi"),"<token>"],[new RegExp(`(?:\\bxox[cd]-[A-Za-z0-9+/=%_-]{10,}|xox[cd]-${al("[A-Za-z0-9+/=%_-]")}[A-Za-z0-9+/=%_-]{16,})`,"gi"),"<token>"],[Dce,"hooks.slack.com/<redacted>"]],Nce=[/\bey[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g,"<jwt>"],Mce=/\beyJ(?:[A-Za-z0-9_-]{256}|[A-Za-z0-9_-]{8,2048}\.[A-Za-z0-9_-]{10})/,Uce=[wv.bearer,wv.basic,...HM,wv.sk,...BM],Fce=[...KM,Nce];function qd(e){return[...Uce,...Fce].reduce((t,[n,r])=>t.replace(n,r),String(e))}var Dpt=[...Lce,...[...HM,...BM,...KM].map(([e])=>new RegExp(e.source,e.flags.replaceAll("g",""))),Mce];function Vd(e,t,n,r,o="",s="",i="g"){let a=`${t}{${n},}${o}`;return new RegExp(`(?:\\b${e}${s}${a}|${e}${r}${a})`,i)}function al(e){return`(?=${e}{0,64}[0-9])`}function jM(e){return`(?=[A-Za-z0-9_-]{0,64}?(?=[A-Za-z0-9]{${e}})(?=[A-Za-z0-9]{0,64}[0-9])(?=[A-Za-z0-9]{0,64}[A-Za-z]))`}Sw();function TA(e){return e}function Tn(e){return TA(e)}function yi(e){return TA(e)}function x$(e){return TA(e)}class Ze extends Error{telemetryMessage;errorClass;constructor(e,t,n){super(e);this.name="TelemetrySafeError",this.telemetryMessage=t??e,this.errorClass=n}}var v$=(e,t)=>{try{if(e!==null&&typeof e==="object"&&!("telemetryMessage"in e)&&Object.isExtensible(e))Object.assign(e,{telemetryMessage:t})}catch{}return e},Cn=(e,t)=>{try{if(e!==null&&typeof e==="object"&&Object.isExtensible(e)){let n=e,r=Object.entries(t).filter(([o,s])=>s!==void 0&&!(o in n));Object.assign(n,Object.fromEntries(r))}}catch{}return e};function w$(e){try{if(e!==null&&typeof e==="object"&&"telemetryMessage"in e&&typeof e.telemetryMessage==="string")return e.telemetryMessage}catch{}return}function A$(e,t){return e instanceof Error&&e.message===t}function Hr(e){return e instanceof Error?e:Error(String(e))}function Br(e){return e instanceof Error?e.message:String(e)}function Me(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return}function mf(e){return ede(Me(e))}function ede(e){return e&&/^[A-Z][A-Z0-9_]{0,63}$/.test(e)?x$(e):void 0}function wr(e){return Me(e)==="ENOENT"}function CA(e){return Me(e)==="EISDIR"}var tde=new Set(["ENOENT","EACCES","EPERM","ENOTDIR","ELOOP","ENAMETOOLONG","EROFS"]);function kA(e){return nde(Me(e))}function nde(e){return e!==void 0&&tde.has(e)}import{randomUUID as $Fe}from"crypto";import{join as LK}from"path";import{AsyncLocalStorage as Tde}from"async_hooks";import{constants as Cde}from"fs";import{appendFile as kde,copyFile as Rde,lstat as Ode,mkdir as Pde,open as P$,readdir as I$,readFile as D$,stat as Ide,unlink as Dde,writeFile as DA}from"fs/promises";import{randomBytes as rde}from"crypto";import{closeSync as Ybt,constants as kn,fchmodSync as Jbt,fstatSync as Xbt,ftruncateSync as Qbt,lstatSync as eEt,openSync as tEt,readFileSync as nEt,renameSync as rEt,unlinkSync as oEt,writeFileSync as sEt}from"fs";import{lstat as OA,open as U_,rename as ode,stat as sde,unlink as M_,writeFile as ide}from"fs/promises";var ade=new Set(["EXDEV","EPERM","EEXIST","EBUSY"]),cde=new Set(["EPERM","EBUSY","EACCES"]);function lde(e){return`${e}.tmp.${rde(4).toString("hex")}`}var ude=4,dde=50,lEt=new Int32Array(new SharedArrayBuffer(4));function pde(e,t){if(process.platform!=="win32")return!1;let n=Me(e);return n!==void 0&&cde.has(n)&&t<ude-1}var fde=128;async function mde(e){try{return((await OA(e)).mode&fde)===0}catch{return!1}}async function hde(e,t){let n=!1;for(let r=0;;r++)try{return await e(),n}catch(o){if(pde(o,r)){if(r===0&&t!==void 0&&await mde(t))throw o;n=!0,await Lr(dde);continue}throw o}}function gde(e,t,n=ode){return hde(()=>n(e,t),t)}var _de=67108864,PA=process.platform==="win32"?0:kn.O_NONBLOCK;async function C$(e,t,n=process.platform){if(n!=="win32")return!0;try{return(await OA(e)).isFile()}catch(r){return t&&Me(r)==="ENOENT"}}async function yde(e,t=!1){if(!t&&!await C$(e,!0))return{kind:"unavailable"};let n;try{n=await U_(e,process.platform==="win32"?kn.O_RDONLY:kn.O_RDONLY|(t?0:kn.O_NOFOLLOW)|PA)}catch(r){return Me(r)==="ENOENT"?{kind:"absent"}:{kind:"unavailable"}}try{let r=await n.stat();if(!r.isFile()||r.size>_de)return{kind:"unavailable"};return{kind:"snapshot",bytes:new Uint8Array(await n.readFile()),mode:r.mode&4095}}catch{return{kind:"unavailable"}}finally{await n.close().catch(()=>{})}}async function Sde(e,t,n=!1){if(!n&&!await C$(e,!0))return!1;let r;try{r=await U_(e,process.platform==="win32"?"w":kn.O_WRONLY|kn.O_CREAT|kn.O_TRUNC|(n?0:kn.O_NOFOLLOW)|PA,t.mode)}catch{return!1}try{if(!(await r.stat()).isFile())return await r.close().catch(()=>{}),!1;return await r.writeFile(t.bytes),await r.chmod(t.mode).catch(()=>{}),await r.close(),!0}catch{return await r.close().catch(()=>{}),!1}}function N_(e,t,n){try{if(e instanceof Error)e.message=`${e.message}; ${t!==void 0?`new contents preserved at ${t}; `:""}${n==="restored"?"original target restored":n==="removed"?"partial target removed":n==="untouched"?"target untouched":"target left partial — treat contents as torn"}`,Object.assign(e,{...t!==void 0&&{preservedTmp:t},targetOutcome:n})}catch{}return e}function RA(e){let t=Me(e);return t==="EINVAL"||t==="ENOTSUP"||t==="EPERM"||t==="ENOSYS"}var T$=3;async function bde(e,t){if(t!=="win32")return!1;try{return await OA(e),!0}catch(n){return Me(n)==="ENOENT"?!1:{cause:n}}}function Ede(e,t){return Object.assign(Error("EEXIST: name already taken (exclusive create)",typeof t==="object"?{cause:t.cause}:void 0),{code:"EEXIST",syscall:"lstat",path:e})}async function k$(e,t,n){for(let r=1;;r++){let o=lde(e),s=await bde(o,t);if(s!==!1){if(r<T$)continue;throw Ede(o,s)}try{return await n(o)}catch(i){if(Me(i)==="EEXIST"&&r<T$)continue;throw i}}}async function xde(e,t,n,r=process.platform){return k$(e,r,async(o)=>{try{return await ide(o,t,{encoding:"utf8",mode:n,flag:"wx"}),o}catch(s){if(Me(s)!=="EEXIST")await M_(o).catch(()=>{});throw s}})}async function vde(e,t,n=process.platform){return k$(e,n,async(r)=>({fh:await U_(r,n==="win32"?"wx":kn.O_WRONLY|kn.O_CREAT|kn.O_EXCL,t),tmp:r}))}async function R$(e,t,n,r){return wde(e,t,{mode:n,renameFn:r})}async function wde(e,t,n){let{mode:r,createMode:o,exactMode:s,flush:i,followSymlinks:a,inPlaceOnTempCreateRefused:c,renameFn:l}=n,u=r??o,p=a===!0||process.platform==="win32"?0:kn.O_NOFOLLOW,f,m=!1,h=!1,y=async(_)=>{let E=await yde(e,a===!0),S=E.kind==="snapshot"?E:void 0,x=await U_(e,process.platform==="win32"?kn.O_WRONLY|kn.O_CREAT:kn.O_WRONLY|kn.O_CREAT|p|PA,s??u),v;try{v=await x.stat()}catch(F){throw await x.close().catch(()=>{}),m=_!==void 0,N_(F,_,"untouched")}let w=v.isCharacterDevice();if(!v.isFile()&&!w)throw await x.close().catch(()=>{}),Object.assign(Error("refusing the in-place arm on a non-regular target"),{code:"ENXIO",path:e});let U=!1;try{if(!w)await x.truncate(0),U=!0;await x.writeFile(t,{encoding:"utf8"});let F=w?void 0:s??(E.kind!=="absent"?r:void 0);if(F!==void 0)await x.chmod(F).catch(()=>{});if(i===!0)try{await x.sync()}catch(K){if(!RA(K))throw K}await x.close()}catch(F){if(await x.close().catch(()=>{}),!U)throw m=_!==void 0,N_(F,_,"untouched");m=_!==void 0;let ne=S!==void 0&&await Sde(e,S,a===!0)?"restored":await M_(e).then(()=>!0,(se)=>Me(se)==="ENOENT")?"removed":"partial";throw N_(F,_,ne)}let L=_??f;if(L!==void 0)await M_(L).catch(()=>{})};try{try{if(s!==void 0||i===!0){let E=await vde(e,s??u),S=E.fh;f=E.tmp;let x=!1,v;try{if(await S.writeFile(t,{encoding:"utf8"}),s!==void 0)try{await S.chmod(s)}catch(w){if(!RA(w))throw w}if(i===!0)try{await S.sync()}catch(w){if(!RA(w))throw w}}catch(w){x=!0,v=w}if(!x)h=!0;try{await S.close()}catch(w){if(!x)throw m=!0,N_(w,f,"untouched")}if(x)throw v}else f=await xde(e,t,u),h=!0}catch(E){if(c!==!0)throw E;if(h)throw E;if(Me(E)!=="EACCES")throw E;if(!await sde(e).then(()=>!0,()=>!1))throw E;await y(void 0);return}if(f===void 0)throw Error("staging block exited without a staging file");let _=f;try{await gde(_,e,l)}catch(E){let S=Me(E);if(S===void 0||!ade.has(S))throw E;await y(_)}}catch(_){if(f!==void 0&&!m)await M_(f).catch(()=>{});throw _}}import{constants as O$}from"fs";var Ade=process.platform==="win32"?0:O$.O_NONBLOCK,IA=process.platform==="win32"?0:O$.O_NOFOLLOW|Ade;class N${read(e){return D$(e,"utf8")}readBytes(e){return D$(e)}write(e,t,n){return DA(e,t,{encoding:"utf8",mode:n})}async mkdir(e,t){try{await Pde(e,{recursive:!0,mode:t})}catch(n){if(Me(n)!=="EEXIST")throw n}}atomicWrite(e,t,n){return R$(e,t,n)}delete(e){return Dde(e)}list(e){return I$(e)}append(e,t,n){return kde(e,t,{encoding:"utf8",mode:n})}writeExclusive(e,t,n){return DA(e,t,{encoding:"utf8",flag:"wx",mode:n})}writeBytes(e,t){return DA(e,t)}copy(e,t){return Rde(e,t)}async stat(e){return{mtimeMs:(await Ide(e)).mtimeMs}}async lstat(e){try{let t=await Ode(e);return{isSymbolicLink:t.isSymbolicLink(),isFile:t.isFile(),isDirectory:t.isDirectory(),mtimeMs:t.mtimeMs}}catch(t){if(Me(t)==="ENOENT")return;throw t}}async listEntries(e){return(await I$(e,{withFileTypes:!0})).map((n)=>({name:n.name,isDirectory:n.isDirectory(),isFile:n.isFile()}))}async readRange(e,t,n){LA("readRange","offset",t),LA("readRange","length",n);let r=await P$(e,"r");try{return await L$(r,t,n)}finally{await r.close()}}async readTail(e,t,n){LA("readTail","maxBytes",t);let r=n?.noFollow?Cde.O_RDONLY|IA:"r",o=await P$(e,r);try{let s=await o.stat();if(n?.noFollow&&!s.isFile())throw Object.assign(Error("ENXIO: not a regular file"),{code:"ENXIO",path:e});let{size:i}=s,a=Math.min(t,i);return await L$(o,i-a,a)}finally{await o.close()}}}function LA(e,t,n){if(!Number.isInteger(n)||n<0)throw RangeError(`${e}: ${t} must be a non-negative integer, got ${n}`)}async function L$(e,t,n){if(n===0)return Buffer.alloc(0);let r=Buffer.alloc(n),o=0;while(o<n){let{bytesRead:s}=await e.read(r,o,n-o,t+o);if(s===0)break;o+=s}return o===n?r:Buffer.from(r.subarray(0,o))}var Lde=new Tde;function $l(){return Lde.getStore()??new N$}var $A={};on($A,{AGENT_PROXY_AUTH_TOKEN:()=>dfe,ANTHROPIC_API_KEY:()=>Xpe,ANTHROPIC_AUTH_TOKEN:()=>Qpe,ANTHROPIC_AWS_API_KEY:()=>nfe,ANTHROPIC_FEDERATION_RULE_ID:()=>Yfe,ANTHROPIC_FOUNDRY_API_KEY:()=>rfe,ANTHROPIC_FOUNDRY_AUTH_TOKEN:()=>ofe,ANTHROPIC_ORGANIZATION_ID:()=>Xfe,ANTHROPIC_PROFILE:()=>eme,ANTHROPIC_WORKSPACE_ID:()=>Qfe,AWS_BEARER_TOKEN_BEDROCK:()=>tfe,AWS_CONTAINER_CREDENTIALS_FULL_URI:()=>cfe,AWS_CONTAINER_CREDENTIALS_RELATIVE_URI:()=>afe,AWS_ROLE_ARN:()=>ife,AWS_WEB_IDENTITY_TOKEN_FILE:()=>sfe,CLAUDE_CODE_ACCOUNT_TAGGED_ID:()=>nme,CLAUDE_CODE_ACCOUNT_UUID:()=>tme,CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR:()=>hfe,CLAUDE_CODE_API_KEY_HELPER_TTL_MS:()=>$fe,CLAUDE_CODE_AUTH_FAIL_EXIT_MS:()=>Ffe,CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS:()=>Zfe,CLAUDE_CODE_CUSTOM_OAUTH_URL:()=>wfe,CLAUDE_CODE_DESIGN_OAUTH_CLIENT_ID:()=>xfe,CLAUDE_CODE_ENABLE_PROXY_AUTH_HELPER:()=>zfe,CLAUDE_CODE_FEDERATION_CACHE_DIR:()=>Jfe,CLAUDE_CODE_GATEWAY_TOKEN_FILE_DESCRIPTOR:()=>_fe,CLAUDE_CODE_HFI_BEARER_TOKEN:()=>ufe,CLAUDE_CODE_HOST_AUTH_ENV_VAR:()=>kfe,CLAUDE_CODE_HOST_AUTH_REFRESH_TIMEOUT_MS:()=>Cfe,CLAUDE_CODE_HOST_CREDS_FILE:()=>Rfe,CLAUDE_CODE_OAUTH_401_WAIT_MS:()=>Ufe,CLAUDE_CODE_OAUTH_CLIENT_ID:()=>Efe,CLAUDE_CODE_OAUTH_REFRESH_TOKEN:()=>bfe,CLAUDE_CODE_OAUTH_SCOPES:()=>vfe,CLAUDE_CODE_OAUTH_TOKEN:()=>efe,CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR:()=>gfe,CLAUDE_CODE_ORGANIZATION_UUID:()=>rme,CLAUDE_CODE_PROXY_AUTH_HELPER_TTL_MS:()=>jfe,CLAUDE_CODE_RATE_LIMIT_TIER:()=>ime,CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH:()=>Tfe,CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH:()=>Afe,CLAUDE_CODE_SESSION_ACCESS_TOKEN:()=>Ofe,CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH:()=>Gfe,CLAUDE_CODE_SKIP_ANTHROPIC_GOOGLE_CLOUD_AUTH:()=>Wfe,CLAUDE_CODE_SKIP_AWS_CRED_CACHE:()=>qfe,CLAUDE_CODE_SKIP_BEDROCK_AUTH:()=>Hfe,CLAUDE_CODE_SKIP_FOUNDRY_AUTH:()=>Kfe,CLAUDE_CODE_SKIP_MANTLE_AUTH:()=>Vfe,CLAUDE_CODE_SKIP_VERTEX_AUTH:()=>Bfe,CLAUDE_CODE_SUBSCRIPTION_TYPE:()=>sme,CLAUDE_CODE_USER_EMAIL:()=>ome,CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR:()=>yfe,CLAUDE_LOCAL_OAUTH_API_BASE:()=>Lfe,CLAUDE_LOCAL_OAUTH_APPS_BASE:()=>Nfe,CLAUDE_LOCAL_OAUTH_CONSOLE_BASE:()=>Mfe,CLAUDE_SESSION_INGRESS_TOKEN_FILE:()=>Sfe,CLAUDE_TRUSTED_DEVICE_TOKEN:()=>Pfe,CLOUDSDK_AUTH_ACCESS_TOKEN:()=>lfe,ENVIRONMENT_SERVICE_KEY:()=>pfe,MCP_CLIENT_SECRET:()=>ffe,MCP_XAA_IDP_CLIENT_SECRET:()=>mfe,USE_LOCAL_OAUTH:()=>Ife,USE_STAGING_OAUTH:()=>Dfe});var Nn={};on(Nn,{BRAND:()=>ipe,DIRTY:()=>Ia,EMPTY_PATH:()=>Fde,INVALID:()=>he,NEVER:()=>Bpe,OK:()=>Rn,ParseStatus:()=>_n,Schema:()=>De,ZodAny:()=>La,ZodArray:()=>fo,ZodBigInt:()=>xi,ZodBoolean:()=>Kl,ZodBranded:()=>j_,ZodCatch:()=>Ql,ZodDate:()=>Da,ZodDefault:()=>Xl,ZodDiscriminatedUnion:()=>z_,ZodEffects:()=>go,ZodEnum:()=>vi,ZodError:()=>er,ZodFirstPartyTypeKind:()=>B,ZodFunction:()=>Bl,ZodIntersection:()=>ql,ZodIssueCode:()=>H,ZodLazy:()=>Zl,ZodLiteral:()=>Yl,ZodMap:()=>Sf,ZodNaN:()=>bf,ZodNativeEnum:()=>Jl,ZodNever:()=>ns,ZodNull:()=>Wl,ZodNullable:()=>As,ZodNumber:()=>Ei,ZodObject:()=>Rt,ZodOptional:()=>mo,ZodParsedType:()=>W,ZodPipeline:()=>Ef,ZodPromise:()=>Ma,ZodReadonly:()=>eu,ZodRecord:()=>yf,ZodSchema:()=>De,ZodSet:()=>Na,ZodString:()=>po,ZodSymbol:()=>gf,ZodTransformer:()=>go,ZodTuple:()=>rs,ZodType:()=>De,ZodUndefined:()=>Gl,ZodUnion:()=>Vl,ZodUnknown:()=>bi,ZodVoid:()=>_f,addIssueToContext:()=>Y,any:()=>hpe,array:()=>Spe,bigint:()=>upe,boolean:()=>W$,coerce:()=>Hpe,custom:()=>B$,date:()=>dpe,datetimeRegex:()=>j$,defaultErrorMap:()=>vs,discriminatedUnion:()=>xpe,effect:()=>Lpe,enum:()=>Ppe,function:()=>kpe,getErrorMap:()=>zl,getParsedType:()=>ts,instanceof:()=>cpe,intersection:()=>vpe,isAborted:()=>F_,isAsync:()=>jl,isDirty:()=>$_,isValid:()=>Si,late:()=>ape,lazy:()=>Rpe,literal:()=>Ope,makeIssue:()=>hf,map:()=>Tpe,nan:()=>lpe,nativeEnum:()=>Ipe,never:()=>_pe,null:()=>mpe,nullable:()=>Mpe,number:()=>G$,object:()=>FA,objectUtil:()=>NA,oboolean:()=>jpe,onumber:()=>zpe,optional:()=>Npe,ostring:()=>$pe,pipeline:()=>Fpe,preprocess:()=>Upe,promise:()=>Dpe,quotelessJson:()=>Nde,record:()=>Ape,set:()=>Cpe,setErrorMap:()=>Ude,strictObject:()=>bpe,string:()=>K$,symbol:()=>ppe,transformer:()=>Lpe,tuple:()=>wpe,undefined:()=>fpe,union:()=>Epe,unknown:()=>gpe,util:()=>Fe,void:()=>ype});var Fe;(function(e){e.assertEqual=(o)=>{};function t(o){}e.assertIs=t;function n(o){throw Error()}e.assertNever=n,e.arrayToEnum=(o)=>{let s={};for(let i of o)s[i]=i;return s},e.getValidEnumValues=(o)=>{let s=e.objectKeys(o).filter((a)=>typeof o[o[a]]!=="number"),i={};for(let a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=(o)=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys==="function"?(o)=>Object.keys(o):(o)=>{let s=[];for(let i in o)if(Object.prototype.hasOwnProperty.call(o,i))s.push(i);return s},e.find=(o,s)=>{for(let i of o)if(s(i))return i;return},e.isInteger=typeof Number.isInteger==="function"?(o)=>Number.isInteger(o):(o)=>typeof o==="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map((i)=>typeof i==="string"?`'${i}'`:i).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(o,s)=>{if(typeof s==="bigint")return s.toString();return s}})(Fe||(Fe={}));var NA;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(NA||(NA={}));var W=Fe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ts=(e)=>{switch(typeof e){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(e)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":if(Array.isArray(e))return W.array;if(e===null)return W.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return W.promise;if(typeof Map<"u"&&e instanceof Map)return W.map;if(typeof Set<"u"&&e instanceof Set)return W.set;if(typeof Date<"u"&&e instanceof Date)return W.date;return W.object;default:return W.unknown}};var H=Fe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Nde=(e)=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class er extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(n)=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(o){return o.message},n={_errors:[]},r=(o)=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(r);else if(s.code==="invalid_return_type")r(s.returnTypeError);else if(s.code==="invalid_arguments")r(s.argumentsError);else if(s.path.length===0)n._errors.push(t(s));else{let i=n,a=0;while(a<s.path.length){let c=s.path[a];if(a!==s.path.length-1)i[c]=i[c]||{_errors:[]};else i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s));i=i[c],a++}}};return r(this),n}static assert(e){if(!(e instanceof er))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Fe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t=Object.create(null),n=[];for(let r of this.issues)if(r.path.length>0){let o=r.path[0];t[o]=t[o]||[],t[o].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}er.create=(e)=>new er(e);var Mde=(e,t)=>{let n;switch(e.code){case H.invalid_type:if(e.received===W.undefined)n="Required";else n=`Expected ${e.expected}, received ${e.received}`;break;case H.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Fe.jsonStringifyReplacer)}`;break;case H.unrecognized_keys:n=`Unrecognized key(s) in object: ${Fe.joinValues(e.keys,", ")}`;break;case H.invalid_union:n="Invalid input";break;case H.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Fe.joinValues(e.options)}`;break;case H.invalid_enum_value:n=`Invalid enum value. Expected ${Fe.joinValues(e.options)}, received '${e.received}'`;break;case H.invalid_arguments:n="Invalid function arguments";break;case H.invalid_return_type:n="Invalid function return type";break;case H.invalid_date:n="Invalid date";break;case H.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")n=`${n} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)n=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)n=`Invalid input: must end with "${e.validation.endsWith}"`;else Fe.assertNever(e.validation);else if(e.validation!=="regex")n=`Invalid ${e.validation}`;else n="Invalid";break;case H.too_small:if(e.type==="array")n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else n="Invalid input";break;case H.too_big:if(e.type==="array")n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else n="Invalid input";break;case H.custom:n="Invalid input";break;case H.invalid_intersection_types:n="Intersection results could not be merged";break;case H.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case H.not_finite:n="Number must be finite";break;default:n=t.defaultError,Fe.assertNever(e)}return{message:n}},vs=Mde;var M$=vs;function Ude(e){M$=e}function zl(){return M$}var hf=(e)=>{let{data:t,path:n,errorMaps:r,issueData:o}=e,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=r.filter((l)=>!!l).slice().reverse();for(let l of c)a=l(i,{data:t,defaultError:a}).message;return{...o,path:s,message:a}},Fde=[];function Y(e,t){let n=zl(),r=hf({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===vs?void 0:vs].filter((o)=>!!o)});e.common.issues.push(r)}class _n{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let n=[];for(let r of t){if(r.status==="aborted")return he;if(r.status==="dirty")e.dirty();n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let r of t){let o=await r.key,s=await r.value;n.push({key:o,value:s})}return _n.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:o,value:s}=r;if(o.status==="aborted")return he;if(s.status==="aborted")return he;if(o.status==="dirty")e.dirty();if(s.status==="dirty")e.dirty();if(o.value!=="__proto__"&&(typeof s.value<"u"||r.alwaysSet))n[o.value]=s.value}return{status:e.value,value:n}}}var he=Object.freeze({status:"aborted"}),Ia=(e)=>({status:"dirty",value:e}),Rn=(e)=>({status:"valid",value:e}),F_=(e)=>e.status==="aborted",$_=(e)=>e.status==="dirty",Si=(e)=>e.status==="valid",jl=(e)=>typeof Promise<"u"&&e instanceof Promise;var ae;(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(ae||(ae={}));class ho{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var U$=(e,t)=>{if(Si(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new er(e.common.issues);return this._error=n,this._error}}}};function Ce(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:o};return{errorMap:(i,a)=>{let{message:c}=e;if(i.code==="invalid_enum_value")return{message:c??a.defaultError};if(typeof a.data>"u")return{message:c??r??a.defaultError};if(i.code!=="invalid_type")return{message:a.defaultError};return{message:c??n??a.defaultError}},description:o}}class De{get description(){return this._def.description}_getType(e){return ts(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ts(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _n,ctx:{common:e.parent.common,data:e.data,parsedType:ts(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(jl(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ts(e)},r=this._parseSync({data:e,path:n.path,parent:n});return U$(n,r)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ts(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Si(n)?{value:n.value}:{issues:t.common.issues}}catch(n){if(n?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((n)=>Si(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ts(e)},r=this._parse({data:e,path:n.path,parent:n}),o=await(jl(r)?r:Promise.resolve(r));return U$(n,o)}refine(e,t){let n=(r)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(r);else return t};return this._refinement((r,o)=>{let s=e(r),i=()=>o.addIssue({code:H.custom,...n(r)});if(typeof Promise<"u"&&s instanceof Promise)return s.then((a)=>{if(!a)return i(),!1;else return!0});if(!s)return i(),!1;else return!0})}refinement(e,t){return this._refinement((n,r)=>{if(!e(n))return r.addIssue(typeof t==="function"?t(n,r):t),!1;else return!0})}_refinement(e){return new go({schema:this,typeName:B.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(t)=>this["~validate"](t)}}optional(){return mo.create(this,this._def)}nullable(){return As.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fo.create(this)}promise(){return Ma.create(this,this._def)}or(e){return Vl.create([this,e],this._def)}and(e){return ql.create(this,e,this._def)}transform(e){return new go({...Ce(this._def),schema:this,typeName:B.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new Xl({...Ce(this._def),innerType:this,defaultValue:t,typeName:B.ZodDefault})}brand(){return new j_({typeName:B.ZodBranded,type:this,...Ce(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new Ql({...Ce(this._def),innerType:this,catchValue:t,typeName:B.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return Ef.create(this,e)}readonly(){return eu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var $de=/^c[^\s-]{8,}$/i,zde=/^[0-9a-z]+$/,jde=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Hde=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Bde=/^[a-z0-9_-]{21}$/i,Kde=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Gde=/^[-+]?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)?)??$/,Wde=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Vde="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",MA,qde=/^(?:(?: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])$/,Zde=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Yde=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Jde=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Xde=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Qde=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$$="((\\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])))",epe=new RegExp(`^${$$}$`);function z$(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function tpe(e){return new RegExp(`^${z$(e)}$`)}function j$(e){let t=`${$$}T${z$(e)}`,n=[];if(n.push(e.local?"Z?":"Z"),e.offset)n.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function npe(e,t){if((t==="v4"||!t)&&qde.test(e))return!0;if((t==="v6"||!t)&&Yde.test(e))return!0;return!1}function rpe(e,t){if(!Kde.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));if(typeof o!=="object"||o===null)return!1;if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&o.alg!==t)return!1;return!0}catch{return!1}}function ope(e,t){if((t==="v4"||!t)&&Zde.test(e))return!0;if((t==="v6"||!t)&&Jde.test(e))return!0;return!1}class po extends De{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==W.string){let o=this._getOrReturnCtx(e);return Y(o,{code:H.invalid_type,expected:W.string,received:o.parsedType}),he}let n=new _n,r=void 0;for(let o of this._def.checks)if(o.kind==="min"){if(e.data.length<o.value)r=this._getOrReturnCtx(e,r),Y(r,{code:H.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty()}else if(o.kind==="max"){if(e.data.length>o.value)r=this._getOrReturnCtx(e,r),Y(r,{code:H.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty()}else if(o.kind==="length"){let s=e.data.length>o.value,i=e.data.length<o.value;if(s||i){if(r=this._getOrReturnCtx(e,r),s)Y(r,{code:H.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message});else if(i)Y(r,{code:H.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message});n.dirty()}}else if(o.kind==="email"){if(!Wde.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"email",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="emoji"){if(!MA)MA=new RegExp(Vde,"u");if(!MA.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"emoji",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="uuid"){if(!Hde.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"uuid",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="nanoid"){if(!Bde.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"nanoid",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="cuid"){if(!$de.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"cuid",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="cuid2"){if(!zde.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"cuid2",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="ulid"){if(!jde.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"ulid",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),Y(r,{validation:"url",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="regex"){if(o.regex.lastIndex=0,!o.regex.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"regex",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="trim")e.data=e.data.trim();else if(o.kind==="includes"){if(!e.data.includes(o.value,o.position))r=this._getOrReturnCtx(e,r),Y(r,{code:H.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()}else if(o.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(o.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(o.kind==="startsWith"){if(!e.data.startsWith(o.value))r=this._getOrReturnCtx(e,r),Y(r,{code:H.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()}else if(o.kind==="endsWith"){if(!e.data.endsWith(o.value))r=this._getOrReturnCtx(e,r),Y(r,{code:H.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()}else if(o.kind==="datetime"){if(!j$(o).test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{code:H.invalid_string,validation:"datetime",message:o.message}),n.dirty()}else if(o.kind==="date"){if(!epe.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{code:H.invalid_string,validation:"date",message:o.message}),n.dirty()}else if(o.kind==="time"){if(!tpe(o).test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{code:H.invalid_string,validation:"time",message:o.message}),n.dirty()}else if(o.kind==="duration"){if(!Gde.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"duration",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="ip"){if(!npe(e.data,o.version))r=this._getOrReturnCtx(e,r),Y(r,{validation:"ip",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="jwt"){if(!rpe(e.data,o.alg))r=this._getOrReturnCtx(e,r),Y(r,{validation:"jwt",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="cidr"){if(!ope(e.data,o.version))r=this._getOrReturnCtx(e,r),Y(r,{validation:"cidr",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="base64"){if(!Xde.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"base64",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="base64url"){if(!Qde.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"base64url",code:H.invalid_string,message:o.message}),n.dirty()}else Fe.assertNever(o);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement((r)=>e.test(r),{validation:t,code:H.invalid_string,...ae.errToObj(n)})}_addCheck(e){return new po({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ae.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ae.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ae.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ae.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ae.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ae.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ae.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ae.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ae.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ae.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ae.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ae.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ae.errToObj(e)})}datetime(e){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ae.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...ae.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ae.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...ae.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...ae.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...ae.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...ae.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...ae.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...ae.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...ae.errToObj(t)})}nonempty(e){return this.min(1,ae.errToObj(e))}trim(){return new po({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new po({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new po({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e)=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find((e)=>e.kind==="date")}get isTime(){return!!this._def.checks.find((e)=>e.kind==="time")}get isDuration(){return!!this._def.checks.find((e)=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find((e)=>e.kind==="email")}get isURL(){return!!this._def.checks.find((e)=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find((e)=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find((e)=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((e)=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((e)=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((e)=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find((e)=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find((e)=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find((e)=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find((e)=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find((e)=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}po.create=(e)=>new po({checks:[],typeName:B.ZodString,coerce:e?.coerce??!1,...Ce(e)});function spe(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}class Ei extends De{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce)e.data=Number(e.data);if(this._getType(e)!==W.number){let o=this._getOrReturnCtx(e);return Y(o,{code:H.invalid_type,expected:W.number,received:o.parsedType}),he}let n=void 0,r=new _n;for(let o of this._def.checks)if(o.kind==="int"){if(!Fe.isInteger(e.data))n=this._getOrReturnCtx(e,n),Y(n,{code:H.invalid_type,expected:"integer",received:"float",message:o.message}),r.dirty()}else if(o.kind==="min"){if(o.inclusive?e.data<o.value:e.data<=o.value)n=this._getOrReturnCtx(e,n),Y(n,{code:H.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()}else if(o.kind==="max"){if(o.inclusive?e.data>o.value:e.data>=o.value)n=this._getOrReturnCtx(e,n),Y(n,{code:H.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()}else if(o.kind==="multipleOf"){if(spe(e.data,o.value)!==0)n=this._getOrReturnCtx(e,n),Y(n,{code:H.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()}else if(o.kind==="finite"){if(!Number.isFinite(e.data))n=this._getOrReturnCtx(e,n),Y(n,{code:H.not_finite,message:o.message}),r.dirty()}else Fe.assertNever(o);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,ae.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ae.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ae.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ae.toString(t))}setLimit(e,t,n,r){return new Ei({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:ae.toString(r)}]})}_addCheck(e){return new Ei({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ae.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ae.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ae.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ae.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ae.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ae.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:ae.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ae.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ae.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&Fe.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;else if(n.kind==="min"){if(t===null||n.value>t)t=n.value}else if(n.kind==="max"){if(e===null||n.value<e)e=n.value}return Number.isFinite(t)&&Number.isFinite(e)}}Ei.create=(e)=>new Ei({checks:[],typeName:B.ZodNumber,coerce:e?.coerce||!1,...Ce(e)});class xi extends De{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==W.bigint)return this._getInvalidInput(e);let n=void 0,r=new _n;for(let o of this._def.checks)if(o.kind==="min"){if(o.inclusive?e.data<o.value:e.data<=o.value)n=this._getOrReturnCtx(e,n),Y(n,{code:H.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()}else if(o.kind==="max"){if(o.inclusive?e.data>o.value:e.data>=o.value)n=this._getOrReturnCtx(e,n),Y(n,{code:H.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()}else if(o.kind==="multipleOf"){if(e.data%o.value!==BigInt(0))n=this._getOrReturnCtx(e,n),Y(n,{code:H.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()}else Fe.assertNever(o);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Y(t,{code:H.invalid_type,expected:W.bigint,received:t.parsedType}),he}gte(e,t){return this.setLimit("min",e,!0,ae.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ae.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ae.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ae.toString(t))}setLimit(e,t,n,r){return new xi({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:ae.toString(r)}]})}_addCheck(e){return new xi({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ae.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ae.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ae.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ae.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ae.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}xi.create=(e)=>new xi({checks:[],typeName:B.ZodBigInt,coerce:e?.coerce??!1,...Ce(e)});class Kl extends De{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==W.boolean){let n=this._getOrReturnCtx(e);return Y(n,{code:H.invalid_type,expected:W.boolean,received:n.parsedType}),he}return Rn(e.data)}}Kl.create=(e)=>new Kl({typeName:B.ZodBoolean,coerce:e?.coerce||!1,...Ce(e)});class Da extends De{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==W.date){let o=this._getOrReturnCtx(e);return Y(o,{code:H.invalid_type,expected:W.date,received:o.parsedType}),he}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return Y(o,{code:H.invalid_date}),he}let n=new _n,r=void 0;for(let o of this._def.checks)if(o.kind==="min"){if(e.data.getTime()<o.value)r=this._getOrReturnCtx(e,r),Y(r,{code:H.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()}else if(o.kind==="max"){if(e.data.getTime()>o.value)r=this._getOrReturnCtx(e,r),Y(r,{code:H.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()}else Fe.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Da({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:ae.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:ae.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}}Da.create=(e)=>new Da({checks:[],coerce:e?.coerce||!1,typeName:B.ZodDate,...Ce(e)});class gf extends De{_parse(e){if(this._getType(e)!==W.symbol){let n=this._getOrReturnCtx(e);return Y(n,{code:H.invalid_type,expected:W.symbol,received:n.parsedType}),he}return Rn(e.data)}}gf.create=(e)=>new gf({typeName:B.ZodSymbol,...Ce(e)});class Gl extends De{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return Y(n,{code:H.invalid_type,expected:W.undefined,received:n.parsedType}),he}return Rn(e.data)}}Gl.create=(e)=>new Gl({typeName:B.ZodUndefined,...Ce(e)});class Wl extends De{_parse(e){if(this._getType(e)!==W.null){let n=this._getOrReturnCtx(e);return Y(n,{code:H.invalid_type,expected:W.null,received:n.parsedType}),he}return Rn(e.data)}}Wl.create=(e)=>new Wl({typeName:B.ZodNull,...Ce(e)});class La extends De{constructor(){super(...arguments);this._any=!0}_parse(e){return Rn(e.data)}}La.create=(e)=>new La({typeName:B.ZodAny,...Ce(e)});class bi extends De{constructor(){super(...arguments);this._unknown=!0}_parse(e){return Rn(e.data)}}bi.create=(e)=>new bi({typeName:B.ZodUnknown,...Ce(e)});class ns extends De{_parse(e){let t=this._getOrReturnCtx(e);return Y(t,{code:H.invalid_type,expected:W.never,received:t.parsedType}),he}}ns.create=(e)=>new ns({typeName:B.ZodNever,...Ce(e)});class _f extends De{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return Y(n,{code:H.invalid_type,expected:W.void,received:n.parsedType}),he}return Rn(e.data)}}_f.create=(e)=>new _f({typeName:B.ZodVoid,...Ce(e)});class fo extends De{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==W.array)return Y(t,{code:H.invalid_type,expected:W.array,received:t.parsedType}),he;if(r.exactLength!==null){let s=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;if(s||i)Y(t,{code:s?H.too_big:H.too_small,minimum:i?r.exactLength.value:void 0,maximum:s?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty()}if(r.minLength!==null){if(t.data.length<r.minLength.value)Y(t,{code:H.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()}if(r.maxLength!==null){if(t.data.length>r.maxLength.value)Y(t,{code:H.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()}if(t.common.async)return Promise.all([...t.data].map((s,i)=>r.type._parseAsync(new ho(t,s,t.path,i)))).then((s)=>_n.mergeArray(n,s));let o=[...t.data].map((s,i)=>r.type._parseSync(new ho(t,s,t.path,i)));return _n.mergeArray(n,o)}get element(){return this._def.type}min(e,t){return new fo({...this._def,minLength:{value:e,message:ae.toString(t)}})}max(e,t){return new fo({...this._def,maxLength:{value:e,message:ae.toString(t)}})}length(e,t){return new fo({...this._def,exactLength:{value:e,message:ae.toString(t)}})}nonempty(e){return this.min(1,e)}}fo.create=(e,t)=>new fo({type:e,minLength:null,maxLength:null,exactLength:null,typeName:B.ZodArray,...Ce(t)});function Hl(e){if(e instanceof Rt){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=mo.create(Hl(r))}return new Rt({...e._def,shape:()=>t})}else if(e instanceof fo)return new fo({...e._def,type:Hl(e.element)});else if(e instanceof mo)return mo.create(Hl(e.unwrap()));else if(e instanceof As)return As.create(Hl(e.unwrap()));else if(e instanceof rs)return rs.create(e.items.map((t)=>Hl(t)));else return e}class Rt extends De{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Fe.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==W.object){let c=this._getOrReturnCtx(e);return Y(c,{code:H.invalid_type,expected:W.object,received:c.parsedType}),he}let{status:n,ctx:r}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof ns&&this._def.unknownKeys==="strip")){for(let c in r.data)if(!s.includes(c))i.push(c)}let a=[];for(let c of s){let l=o[c],u=r.data[c];a.push({key:{status:"valid",value:c},value:l._parse(new ho(r,u,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof ns){let c=this._def.unknownKeys;if(c==="passthrough")for(let l of i)a.push({key:{status:"valid",value:l},value:{status:"valid",value:r.data[l]}});else if(c==="strict"){if(i.length>0)Y(r,{code:H.unrecognized_keys,keys:i}),n.dirty()}else if(c==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let l of i){let u=r.data[l];a.push({key:{status:"valid",value:l},value:c._parse(new ho(r,u,r.path,l)),alwaysSet:l in r.data})}}if(r.common.async)return Promise.resolve().then(async()=>{let c=[];for(let l of a){let u=await l.key,p=await l.value;c.push({key:u,value:p,alwaysSet:l.alwaysSet})}return c}).then((c)=>_n.mergeObjectSync(n,c));else return _n.mergeObjectSync(n,a)}get shape(){return this._def.shape()}strict(e){return ae.errToObj,new Rt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{let r=this._def.errorMap?.(t,n).message??n.defaultError;if(t.code==="unrecognized_keys")return{message:ae.errToObj(e).message??r};return{message:r}}}:{}})}strip(){return new Rt({...this._def,unknownKeys:"strip"})}passthrough(){return new Rt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Rt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Rt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:B.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Rt({...this._def,catchall:e})}pick(e){let t={};for(let n of Fe.objectKeys(e))if(e[n]&&this.shape[n])t[n]=this.shape[n];return new Rt({...this._def,shape:()=>t})}omit(e){let t={};for(let n of Fe.objectKeys(this.shape))if(!e[n])t[n]=this.shape[n];return new Rt({...this._def,shape:()=>t})}deepPartial(){return Hl(this)}partial(e){let t={};for(let n of Fe.objectKeys(this.shape)){let r=this.shape[n];if(e&&!e[n])t[n]=r;else t[n]=r.optional()}return new Rt({...this._def,shape:()=>t})}required(e){let t={};for(let n of Fe.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let o=this.shape[n];while(o instanceof mo)o=o._def.innerType;t[n]=o}return new Rt({...this._def,shape:()=>t})}keyof(){return H$(Fe.objectKeys(this.shape))}}Rt.create=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strip",catchall:ns.create(),typeName:B.ZodObject,...Ce(t)});Rt.strictCreate=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strict",catchall:ns.create(),typeName:B.ZodObject,...Ce(t)});Rt.lazycreate=(e,t)=>new Rt({shape:e,unknownKeys:"strip",catchall:ns.create(),typeName:B.ZodObject,...Ce(t)});class Vl extends De{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(o){for(let i of o)if(i.result.status==="valid")return i.result;for(let i of o)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map((i)=>new er(i.ctx.common.issues));return Y(t,{code:H.invalid_union,unionErrors:s}),he}if(t.common.async)return Promise.all(n.map(async(o)=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(r);else{let o=void 0,s=[];for(let a of n){let c={...t,common:{...t.common,issues:[]},parent:null},l=a._parseSync({data:t.data,path:t.path,parent:c});if(l.status==="valid")return l;else if(l.status==="dirty"&&!o)o={result:l,ctx:c};if(c.common.issues.length)s.push(c.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let i=s.map((a)=>new er(a));return Y(t,{code:H.invalid_union,unionErrors:i}),he}}get options(){return this._def.options}}Vl.create=(e,t)=>new Vl({options:e,typeName:B.ZodUnion,...Ce(t)});var ws=(e)=>{if(e instanceof Zl)return ws(e.schema);else if(e instanceof go)return ws(e.innerType());else if(e instanceof Yl)return[e.value];else if(e instanceof vi)return e.options;else if(e instanceof Jl)return Fe.objectValues(e.enum);else if(e instanceof Xl)return ws(e._def.innerType);else if(e instanceof Gl)return[void 0];else if(e instanceof Wl)return[null];else if(e instanceof mo)return[void 0,...ws(e.unwrap())];else if(e instanceof As)return[null,...ws(e.unwrap())];else if(e instanceof j_)return ws(e.unwrap());else if(e instanceof eu)return ws(e.unwrap());else if(e instanceof Ql)return ws(e._def.innerType);else return[]};class z_ extends De{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==W.object)return Y(t,{code:H.invalid_type,expected:W.object,received:t.parsedType}),he;let n=this.discriminator,r=t.data[n],o=this.optionsMap.get(r);if(!o)return Y(t,{code:H.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),he;if(t.common.async)return o._parseAsync({data:t.data,path:t.path,parent:t});else return o._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let r=new Map;for(let o of t){let s=ws(o.shape[e]);if(!s.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(r.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,o)}}return new z_({typeName:B.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...Ce(n)})}}function UA(e,t){let n=ts(e),r=ts(t);if(e===t)return{valid:!0,data:e};else if(n===W.object&&r===W.object){let o=Fe.objectKeys(t),s=Fe.objectKeys(e).filter((a)=>o.indexOf(a)!==-1),i={...e,...t};for(let a of s){let c=UA(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===W.array&&r===W.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let s=0;s<e.length;s++){let i=e[s],a=t[s],c=UA(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else if(n===W.date&&r===W.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}class ql extends De{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(o,s)=>{if(F_(o)||F_(s))return he;let i=UA(o.value,s.value);if(!i.valid)return Y(n,{code:H.invalid_intersection_types}),he;if($_(o)||$_(s))t.dirty();return{status:t.value,value:i.data}};if(n.common.async)return Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>r(o,s));else return r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ql.create=(e,t,n)=>new ql({left:e,right:t,typeName:B.ZodIntersection,...Ce(n)});class rs extends De{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.array)return Y(n,{code:H.invalid_type,expected:W.array,received:n.parsedType}),he;if(n.data.length<this._def.items.length)return Y(n,{code:H.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),he;if(!this._def.rest&&n.data.length>this._def.items.length)Y(n,{code:H.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let o=[...n.data].map((s,i)=>{let a=this._def.items[i]||this._def.rest;if(!a)return null;return a._parse(new ho(n,s,n.path,i))}).filter((s)=>!!s);if(n.common.async)return Promise.all(o).then((s)=>_n.mergeArray(t,s));else return _n.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new rs({...this._def,rest:e})}}rs.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new rs({items:e,typeName:B.ZodTuple,rest:null,...Ce(t)})};class yf extends De{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.object)return Y(n,{code:H.invalid_type,expected:W.object,received:n.parsedType}),he;let r=[],o=this._def.keyType,s=this._def.valueType;for(let i in n.data)r.push({key:o._parse(new ho(n,i,n.path,i)),value:s._parse(new ho(n,n.data[i],n.path,i)),alwaysSet:i in n.data});if(n.common.async)return _n.mergeObjectAsync(t,r);else return _n.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){if(t instanceof De)return new yf({keyType:e,valueType:t,typeName:B.ZodRecord,...Ce(n)});return new yf({keyType:po.create(),valueType:e,typeName:B.ZodRecord,...Ce(t)})}}class Sf extends De{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.map)return Y(n,{code:H.invalid_type,expected:W.map,received:n.parsedType}),he;let r=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([i,a],c)=>({key:r._parse(new ho(n,i,n.path,[c,"key"])),value:o._parse(new ho(n,a,n.path,[c,"value"]))}));if(n.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let a of s){let c=await a.key,l=await a.value;if(c.status==="aborted"||l.status==="aborted")return he;if(c.status==="dirty"||l.status==="dirty")t.dirty();i.set(c.value,l.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let a of s){let{key:c,value:l}=a;if(c.status==="aborted"||l.status==="aborted")return he;if(c.status==="dirty"||l.status==="dirty")t.dirty();i.set(c.value,l.value)}return{status:t.value,value:i}}}}Sf.create=(e,t,n)=>new Sf({valueType:t,keyType:e,typeName:B.ZodMap,...Ce(n)});class Na extends De{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.set)return Y(n,{code:H.invalid_type,expected:W.set,received:n.parsedType}),he;let r=this._def;if(r.minSize!==null){if(n.data.size<r.minSize.value)Y(n,{code:H.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()}if(r.maxSize!==null){if(n.data.size>r.maxSize.value)Y(n,{code:H.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty()}let o=this._def.valueType;function s(a){let c=new Set;for(let l of a){if(l.status==="aborted")return he;if(l.status==="dirty")t.dirty();c.add(l.value)}return{status:t.value,value:c}}let i=[...n.data.values()].map((a,c)=>o._parse(new ho(n,a,n.path,c)));if(n.common.async)return Promise.all(i).then((a)=>s(a));else return s(i)}min(e,t){return new Na({...this._def,minSize:{value:e,message:ae.toString(t)}})}max(e,t){return new Na({...this._def,maxSize:{value:e,message:ae.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Na.create=(e,t)=>new Na({valueType:e,minSize:null,maxSize:null,typeName:B.ZodSet,...Ce(t)});class Bl extends De{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==W.function)return Y(t,{code:H.invalid_type,expected:W.function,received:t.parsedType}),he;function n(i,a){return hf({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,zl(),vs].filter((c)=>!!c),issueData:{code:H.invalid_arguments,argumentsError:a}})}function r(i,a){return hf({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,zl(),vs].filter((c)=>!!c),issueData:{code:H.invalid_return_type,returnTypeError:a}})}let o={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Ma){let i=this;return Rn(async function(...a){let c=new er([]),l=await i._def.args.parseAsync(a,o).catch((f)=>{throw c.addIssue(n(a,f)),c}),u=await Reflect.apply(s,this,l);return await i._def.returns._def.type.parseAsync(u,o).catch((f)=>{throw c.addIssue(r(u,f)),c})})}else{let i=this;return Rn(function(...a){let c=i._def.args.safeParse(a,o);if(!c.success)throw new er([n(a,c.error)]);let l=Reflect.apply(s,this,c.data),u=i._def.returns.safeParse(l,o);if(!u.success)throw new er([r(l,u.error)]);return u.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Bl({...this._def,args:rs.create(e).rest(bi.create())})}returns(e){return new Bl({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Bl({args:e?e:rs.create([]).rest(bi.create()),returns:t||bi.create(),typeName:B.ZodFunction,...Ce(n)})}}class Zl extends De{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Zl.create=(e,t)=>new Zl({getter:e,typeName:B.ZodLazy,...Ce(t)});class Yl extends De{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Y(t,{received:t.data,code:H.invalid_literal,expected:this._def.value}),he}return{status:"valid",value:e.data}}get value(){return this._def.value}}Yl.create=(e,t)=>new Yl({value:e,typeName:B.ZodLiteral,...Ce(t)});function H$(e,t){return new vi({values:e,typeName:B.ZodEnum,...Ce(t)})}class vi extends De{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return Y(t,{expected:Fe.joinValues(n),received:t.parsedType,code:H.invalid_type}),he}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return Y(t,{received:t.data,code:H.invalid_enum_value,options:n}),he}return Rn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return vi.create(e,{...this._def,...t})}exclude(e,t=this._def){return vi.create(this.options.filter((n)=>!e.includes(n)),{...this._def,...t})}}vi.create=H$;class Jl extends De{_parse(e){let t=Fe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==W.string&&n.parsedType!==W.number){let r=Fe.objectValues(t);return Y(n,{expected:Fe.joinValues(r),received:n.parsedType,code:H.invalid_type}),he}if(!this._cache)this._cache=new Set(Fe.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let r=Fe.objectValues(t);return Y(n,{received:n.data,code:H.invalid_enum_value,options:r}),he}return Rn(e.data)}get enum(){return this._def.values}}Jl.create=(e,t)=>new Jl({values:e,typeName:B.ZodNativeEnum,...Ce(t)});class Ma extends De{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==W.promise&&t.common.async===!1)return Y(t,{code:H.invalid_type,expected:W.promise,received:t.parsedType}),he;let n=t.parsedType===W.promise?t.data:Promise.resolve(t.data);return Rn(n.then((r)=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ma.create=(e,t)=>new Ma({type:e,typeName:B.ZodPromise,...Ce(t)});class go extends De{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===B.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,o={addIssue:(s)=>{if(Y(n,s),s.fatal)t.abort();else t.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),r.type==="preprocess"){let s=r.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async(i)=>{if(t.value==="aborted")return he;let a=await this._def.schema._parseAsync({data:i,path:n.path,parent:n});if(a.status==="aborted")return he;if(a.status==="dirty")return Ia(a.value);if(t.value==="dirty")return Ia(a.value);return a});else{if(t.value==="aborted")return he;let i=this._def.schema._parseSync({data:s,path:n.path,parent:n});if(i.status==="aborted")return he;if(i.status==="dirty")return Ia(i.value);if(t.value==="dirty")return Ia(i.value);return i}}if(r.type==="refinement"){let s=(i)=>{let a=r.refinement(i,o);if(n.common.async)return Promise.resolve(a);if(a instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(i.status==="aborted")return he;if(i.status==="dirty")t.dirty();return s(i.value),{status:t.value,value:i.value}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((i)=>{if(i.status==="aborted")return he;if(i.status==="dirty")t.dirty();return s(i.value).then(()=>({status:t.value,value:i.value}))})}if(r.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Si(s))return he;let i=r.transform(s.value,o);if(i instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((s)=>{if(!Si(s))return he;return Promise.resolve(r.transform(s.value,o)).then((i)=>({status:t.value,value:i}))});Fe.assertNever(r)}}go.create=(e,t,n)=>new go({schema:e,typeName:B.ZodEffects,effect:t,...Ce(n)});go.createWithPreprocess=(e,t,n)=>new go({schema:t,effect:{type:"preprocess",transform:e},typeName:B.ZodEffects,...Ce(n)});class mo extends De{_parse(e){if(this._getType(e)===W.undefined)return Rn(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}mo.create=(e,t)=>new mo({innerType:e,typeName:B.ZodOptional,...Ce(t)});class As extends De{_parse(e){if(this._getType(e)===W.null)return Rn(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}As.create=(e,t)=>new As({innerType:e,typeName:B.ZodNullable,...Ce(t)});class Xl extends De{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;if(t.parsedType===W.undefined)n=this._def.defaultValue();return this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Xl.create=(e,t)=>new Xl({innerType:e,typeName:B.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...Ce(t)});class Ql extends De{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});if(jl(r))return r.then((o)=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new er(n.common.issues)},input:n.data})}));else return{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new er(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ql.create=(e,t)=>new Ql({innerType:e,typeName:B.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...Ce(t)});class bf extends De{_parse(e){if(this._getType(e)!==W.nan){let n=this._getOrReturnCtx(e);return Y(n,{code:H.invalid_type,expected:W.nan,received:n.parsedType}),he}return{status:"valid",value:e.data}}}bf.create=(e)=>new bf({typeName:B.ZodNaN,...Ce(e)});var ipe=Symbol("zod_brand");class j_ extends De{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ef extends De{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});if(o.status==="aborted")return he;if(o.status==="dirty")return t.dirty(),Ia(o.value);else return this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();else{let r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});if(r.status==="aborted")return he;if(r.status==="dirty")return t.dirty(),{status:"dirty",value:r.value};else return this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,t){return new Ef({in:e,out:t,typeName:B.ZodPipeline})}}class eu extends De{_parse(e){let t=this._def.innerType._parse(e),n=(r)=>{if(Si(r))r.value=Object.freeze(r.value);return r};return jl(t)?t.then((r)=>n(r)):n(t)}unwrap(){return this._def.innerType}}eu.create=(e,t)=>new eu({innerType:e,typeName:B.ZodReadonly,...Ce(t)});function F$(e,t){let n=typeof e==="function"?e(t):typeof e==="string"?{message:e}:e;return typeof n==="string"?{message:n}:n}function B$(e,t={},n){if(e)return La.create().superRefine((r,o)=>{let s=e(r);if(s instanceof Promise)return s.then((i)=>{if(!i){let a=F$(t,r),c=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!s){let i=F$(t,r),a=i.fatal??n??!0;o.addIssue({code:"custom",...i,fatal:a})}return});return La.create()}var ape={object:Rt.lazycreate},B;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(B||(B={}));var cpe=(e,t={message:`Input not instance of ${e.name}`})=>B$((n)=>n instanceof e,t),K$=po.create,G$=Ei.create,lpe=bf.create,upe=xi.create,W$=Kl.create,dpe=Da.create,ppe=gf.create,fpe=Gl.create,mpe=Wl.create,hpe=La.create,gpe=bi.create,_pe=ns.create,ype=_f.create,Spe=fo.create,{create:FA,strictCreate:bpe}=Rt,Epe=Vl.create,xpe=z_.create,vpe=ql.create,wpe=rs.create,Ape=yf.create,Tpe=Sf.create,Cpe=Na.create,kpe=Bl.create,Rpe=Zl.create,Ope=Yl.create,Ppe=vi.create,Ipe=Jl.create,Dpe=Ma.create,Lpe=go.create,Npe=mo.create,Mpe=As.create,Upe=go.createWithPreprocess,Fpe=Ef.create,$pe=()=>K$().optional(),zpe=()=>G$().optional(),jpe=()=>W$().optional(),Hpe={string:(e)=>po.create({...e,coerce:!0}),number:(e)=>Ei.create({...e,coerce:!0}),boolean:(e)=>Kl.create({...e,coerce:!0}),bigint:(e)=>xi.create({...e,coerce:!0}),date:(e)=>Da.create({...e,coerce:!0})};var Bpe=he;class V${resetters=[];lazy(e){let t;return this.resetters.push(()=>{t=void 0}),()=>t??=e()}reset(){for(let e of this.resetters)e()}}var Gpe=new V$;function I(e){return Gpe.lazy(e)}function Wpe(e){let t=e?.trim();return t?t:void 0}function tu(e){return e===void 0?void 0:String(e)}var Vpe=I(()=>Nn.preprocess(tu,Nn.string().optional().transform(Wpe))),qpe=I(()=>Nn.preprocess(tu,Nn.string().optional())),Zpe=I(()=>Nn.preprocess(tu,Nn.string().optional().transform((e)=>Oe(e)))),Ype=I(()=>Nn.preprocess(tu,Nn.string().optional().transform((e)=>{if(Oe(e))return!0;if(la(e))return!1;return}))),Jpe=I(()=>Z$());function q$(e){if(typeof e==="boolean")return e?"1":"0";return String(e)}var d={str:()=>Vpe(),rawStr:()=>qpe(),bool:()=>Zpe(),triBool:()=>Ype(),int:(e)=>e?Z$(e):Jpe(),enum:(e)=>Nn.preprocess(tu,Nn.string().optional().transform((t)=>t!==void 0&&e.includes(t.trim())?t.trim():void 0))};function Z$(e){return Nn.preprocess(tu,Nn.string().optional().transform((t)=>{if(t===void 0)return;if(e?.digitsOnly&&!/^[+-]?\d+$/.test(t.trim()))return;let n=xv(t);if(!Number.isFinite(n))return;if(e?.min!==void 0&&n<e.min)return;if(e?.max!==void 0&&n>e.max)return;return n}))}var Xpe=d.str(),Qpe=d.str(),efe=d.str(),tfe=d.str(),nfe=d.str(),rfe=d.str(),ofe=d.str(),sfe=d.str(),ife=d.str(),afe=d.str(),cfe=d.str(),lfe=d.str(),ufe=d.str(),dfe=d.str(),pfe=d.str(),ffe=d.str(),mfe=d.str(),hfe=d.str(),gfe=d.str(),_fe=d.str(),yfe=d.str(),Sfe=d.str(),bfe=d.str(),Efe=d.str(),xfe=d.str(),vfe=d.str(),wfe=d.str(),Afe=d.bool(),Tfe=d.bool(),Cfe=d.int({min:1}),kfe=d.str(),Rfe=d.str(),Ofe=d.str(),Pfe=d.str(),Ife=d.bool(),Dfe=d.bool(),Lfe=d.str(),Nfe=d.str(),Mfe=d.str(),Ufe=d.int({min:0}),Ffe=d.int({min:0}),$fe=d.int(),zfe=d.bool(),jfe=d.int(),Hfe=d.bool(),Bfe=d.bool(),Kfe=d.bool(),Gfe=d.bool(),Wfe=d.bool(),Vfe=d.bool(),qfe=d.bool(),Zfe=d.int({min:1,max:2147483647}),Yfe=d.str(),Jfe=d.str(),Xfe=d.str(),Qfe=d.str(),eme=d.str(),tme=d.str(),nme=d.str(),rme=d.str(),ome=d.str(),sme=d.str(),ime=d.str();var zA={};on(zA,{ANT_CLAUDE_CODE_METRICS_ENDPOINT:()=>hhe,ANT_OTEL_EXPORTER_OTLP_ENDPOINT:()=>che,ANT_OTEL_EXPORTER_OTLP_HEADERS:()=>lhe,ANT_OTEL_EXPORTER_OTLP_PROTOCOL:()=>uhe,ANT_OTEL_LOGS_EXPORTER:()=>dhe,ANT_OTEL_METRICS_EXPORTER:()=>phe,ANT_OTEL_RESOURCE_ATTRIBUTES:()=>mhe,ANT_OTEL_TRACES_EXPORTER:()=>fhe,BETA_TRACING_ENDPOINT:()=>ghe,CLAUDE_CODE_BENCH_LIVE_COUNTS:()=>wme,CLAUDE_CODE_BYOC_ENABLE_DATADOG:()=>Pme,CLAUDE_CODE_DATADOG_FLUSH_INTERVAL_MS:()=>Rme,CLAUDE_CODE_DD_ERROR_TRACKING_FLUSH_INTERVAL_MS:()=>Ome,CLAUDE_CODE_DEBUG_LOGS_DIR:()=>ume,CLAUDE_CODE_DEBUG_LOG_LEVEL:()=>lme,CLAUDE_CODE_DEBUG_REPAINTS:()=>dme,CLAUDE_CODE_DIAGNOSTICS_FILE:()=>pme,CLAUDE_CODE_ENHANCED_TELEMETRY_BETA:()=>Ame,CLAUDE_CODE_FRAME_TIMING_LOG:()=>yme,CLAUDE_CODE_FRAME_TIMING_SAMPLE_EVERY:()=>Sme,CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH:()=>nhe,CLAUDE_CODE_OTEL_DIAG_STDERR:()=>Ime,CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS:()=>Tme,CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS:()=>kme,CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS:()=>Cme,CLAUDE_CODE_PERFETTO_TRACE:()=>gme,CLAUDE_CODE_PERFETTO_WRITE_INTERVAL_S:()=>_me,CLAUDE_CODE_PROFILE_STARTUP:()=>hme,CLAUDE_CODE_SESSION_LOG:()=>bme,CLAUDE_CODE_TEE_SDK_STDOUT:()=>vme,CLAUDE_CODE_TERMINAL_RECORDING:()=>xme,CLAUDE_DEBUG:()=>ame,CLAUDE_PTY_RECORD:()=>Eme,DEBUG:()=>cme,DEBUG_CLAUDE_AGENT_SDK:()=>fme,DEBUG_SDK:()=>mme,OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT:()=>Qme,OTEL_EXPORTER_OTLP_ENDPOINT:()=>Mme,OTEL_EXPORTER_OTLP_HEADERS:()=>Ume,OTEL_EXPORTER_OTLP_LOGS_ENDPOINT:()=>$me,OTEL_EXPORTER_OTLP_LOGS_HEADERS:()=>zme,OTEL_EXPORTER_OTLP_LOGS_PROTOCOL:()=>jme,OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:()=>Hme,OTEL_EXPORTER_OTLP_METRICS_HEADERS:()=>Bme,OTEL_EXPORTER_OTLP_METRICS_PROTOCOL:()=>Kme,OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE:()=>Gme,OTEL_EXPORTER_OTLP_PROTOCOL:()=>Fme,OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:()=>Wme,OTEL_EXPORTER_OTLP_TRACES_HEADERS:()=>Vme,OTEL_EXPORTER_OTLP_TRACES_PROTOCOL:()=>qme,OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT:()=>ehe,OTEL_LOGS_EXPORTER:()=>Lme,OTEL_LOGS_EXPORT_INTERVAL:()=>Yme,OTEL_LOG_ASSISTANT_RESPONSES:()=>ohe,OTEL_LOG_RAW_API_BODIES:()=>ahe,OTEL_LOG_TOOL_CONTENT:()=>she,OTEL_LOG_TOOL_DETAILS:()=>ihe,OTEL_LOG_USER_PROMPTS:()=>rhe,OTEL_METRICS_EXPORTER:()=>Dme,OTEL_METRIC_EXPORT_INTERVAL:()=>Zme,OTEL_RESOURCE_ATTRIBUTES:()=>Xme,OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT:()=>the,OTEL_TRACES_EXPORTER:()=>Nme,OTEL_TRACES_EXPORT_INTERVAL:()=>Jme});var ame=d.bool(),cme=d.str(),lme=d.str(),ume=d.str(),dme=d.bool(),pme=d.str(),fme=d.bool(),mme=d.bool(),hme=d.bool(),gme=d.str(),_me=d.int(),yme=d.str(),Sme=d.int(),bme=d.str(),Eme=d.str(),xme=d.str(),vme=d.bool(),wme=d.bool(),Ame=d.bool(),Tme=d.int(),Cme=d.int(),kme=d.int(),Rme=d.int({min:1}),Ome=d.int({min:1}),Pme=d.bool(),Ime=d.bool(),Dme=d.str(),Lme=d.str(),Nme=d.str(),Mme=d.str(),Ume=d.str(),Fme=d.str(),$me=d.str(),zme=d.str(),jme=d.str(),Hme=d.str(),Bme=d.str(),Kme=d.str(),Gme=d.str(),Wme=d.str(),Vme=d.str(),qme=d.str(),Zme=d.int(),Yme=d.int(),Jme=d.int(),Xme=d.str(),Qme=d.int({min:0}),ehe=d.int({min:0}),the=d.int({min:0}),nhe=d.int({min:1,digitsOnly:!0}),rhe=d.bool(),ohe=d.triBool(),she=d.bool(),ihe=d.bool(),ahe=d.bool(),che=d.str(),lhe=d.str(),uhe=d.str(),dhe=d.str(),phe=d.str(),fhe=d.str(),mhe=d.str(),hhe=d.str(),ghe=d.str();import{constants as wve}from"fs";import{access as MC,readdir as Ave,readFile as Tve,readlink as Cve}from"fs/promises";import{homedir as kve}from"os";import{delimiter as Rve,join as em}from"path";function xf(e,t){let n=0;for(let r of e)n+=+!!t(r);return n}function Ar(e){return[...new Set(e)]}function J$(){return"prod"}function X$(){if(process.env.CLAUDE_CODE_CUSTOM_OAUTH_URL)return"-custom-oauth";switch(J$()){case"local":return"-local-oauth";case"staging":return"-staging-oauth";case"prod":return""}}var _he=31536000;var rxt=Math.round(_he/86400),yhe="user:inference",Q$="user:profile",She="org:create_api_key";var bhe=[She,Q$],Ehe=[Q$,yhe,"user:sessions:claude_code","user:mcp_servers","user:file_upload"],oxt=Ar([...bhe,...Ehe]);var Y$={BASE_API_URL:"https://api.anthropic.com",CONSOLE_AUTHORIZE_URL:"https://platform.claude.com/oauth/authorize",CLAUDE_AI_AUTHORIZE_URL:"https://claude.com/cai/oauth/authorize",CLAUDE_AI_ORIGIN:"https://claude.ai",TOKEN_URL:"https://platform.claude.com/v1/oauth/token",API_KEY_URL:"https://api.anthropic.com/api/oauth/claude_cli/create_api_key",ROLES_URL:"https://api.anthropic.com/api/oauth/claude_cli/roles",CONSOLE_SUCCESS_URL:"https://platform.claude.com/buy_credits?returnUrl=/oauth/code/success%3Fapp%3Dclaude-code",CLAUDEAI_SUCCESS_URL:"https://platform.claude.com/oauth/code/success?app=claude-code",MANUAL_REDIRECT_URL:"https://platform.claude.com/oauth/code/callback",CLIENT_ID:"9d1c250a-e61b-44d9-88ed-5944d1962f5e",DESIGN_CLIENT_ID:"59637612-477b-4836-a601-b0589eda7704",OAUTH_FILE_SUFFIX:"",MCP_PROXY_URL:"https://mcp-proxy.anthropic.com",MCP_PROXY_PATH:"/v1/mcp/{server_id}"};var xhe=void 0;function vhe(){let e=process.env.CLAUDE_LOCAL_OAUTH_API_BASE?.replace(/\/$/,"")??"http://localhost:8000",t=process.env.CLAUDE_LOCAL_OAUTH_APPS_BASE?.replace(/\/$/,"")??"http://localhost:4000",n=process.env.CLAUDE_LOCAL_OAUTH_CONSOLE_BASE?.replace(/\/$/,"")??"http://localhost:3000";return{BASE_API_URL:e,CONSOLE_AUTHORIZE_URL:`${n}/oauth/authorize`,CLAUDE_AI_AUTHORIZE_URL:`${t}/oauth/authorize`,CLAUDE_AI_ORIGIN:t,TOKEN_URL:`${e}/v1/oauth/token`,API_KEY_URL:`${e}/api/oauth/claude_cli/create_api_key`,ROLES_URL:`${e}/api/oauth/claude_cli/roles`,CONSOLE_SUCCESS_URL:`${n}/buy_credits?returnUrl=/oauth/code/success%3Fapp%3Dclaude-code`,CLAUDEAI_SUCCESS_URL:`${n}/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`${n}/oauth/code/callback`,CLIENT_ID:"22422756-60c9-4084-8eb7-27705fd5cf9a",DESIGN_CLIENT_ID:"00000000-0000-4000-8000-000000000000",OAUTH_FILE_SUFFIX:"-local-oauth",MCP_PROXY_URL:"http://localhost:8205",MCP_PROXY_PATH:"/v1/toolbox/shttp/mcp/{server_id}"}}var whe=["https://beacon.claude-ai.staging.ant.dev","https://claude.fedstart.com","https://claude-staging.fedstart.com"];function ez(){let e=(()=>{switch(J$()){case"local":return vhe();case"staging":return xhe??Y$;case"prod":return Y$}})(),t=process.env.CLAUDE_CODE_CUSTOM_OAUTH_URL;if(t){let r=t.replace(/\/$/,"");if(!whe.includes(r))throw Error("CLAUDE_CODE_CUSTOM_OAUTH_URL is not an approved endpoint.");e={...e,BASE_API_URL:r,CONSOLE_AUTHORIZE_URL:`${r}/oauth/authorize`,CLAUDE_AI_AUTHORIZE_URL:`${r}/oauth/authorize`,CLAUDE_AI_ORIGIN:r,TOKEN_URL:`${r}/v1/oauth/token`,API_KEY_URL:`${r}/api/oauth/claude_cli/create_api_key`,ROLES_URL:`${r}/api/oauth/claude_cli/roles`,CONSOLE_SUCCESS_URL:`${r}/oauth/code/success?app=claude-code`,CLAUDEAI_SUCCESS_URL:`${r}/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`${r}/oauth/code/callback`,OAUTH_FILE_SUFFIX:"-custom-oauth"}}let n=process.env.CLAUDE_CODE_OAUTH_CLIENT_ID;if(n)e={...e,CLIENT_ID:n};return e}import*as _e from"fs";import{appendFile as cge,chmod as lge,copyFile as uge,link as dge,lstat as YA,mkdir as pge,open as K_,readdir as fge,readFile as Oz,readlink as mge,realpath as hge,rename as gge,rmdir as _ge,rm as yge,stat as Sge,symlink as bge,unlink as Ege}from"fs/promises";import*as an from"path";import{appendFile as WA,mkdir as bz,rename as Ez,stat as qhe,symlink as Zhe,unlink as VA}from"fs/promises";import{dirname as nu,isAbsolute as Yhe,join as wi,resolve as Tz}from"path";function q(e,t){return{code:"InvalidArgument",argument:e,...t!==void 0&&{reason:t}}}var Ahe="ByteViewUnsupported";function tz(e){return e.code==="Failed"&&"telemetryCode"in e&&e.telemetryCode===Ahe}var H_={home:(e)=>({space:"home",path:e}),workspace:(e)=>({space:"workspace",path:e}),system:(e)=>({space:"system",path:e}),userNamed:(e)=>({space:"userNamed",path:e})};var jA=globalThis.process?.getBuiltinModule?.("async_hooks"),rz=jA!==void 0,HA=jA?new jA.AsyncLocalStorage:{run:(e,t)=>t(),getStore:()=>{return}};function oz({writeBatch:e,sizeOf:t,flushIntervalMs:n=1000,maxBufferSize:r=100,maxBufferBytes:o=1/0,immediateMode:s=!1}){let i=[],a=0,c=null,l=null;function u(){if(c)clearTimeout(c),c=null}function p(y){try{e(y)}catch{}}function f(){if(l)p(l),l=null;if(i.length===0)return;p(i),i=[],a=0,u()}function m(){if(!c)c=setTimeout(f,n)}function h(){if(l){l.push(...i),i=[],a=0,u();return}let y=i;i=[],a=0,u(),l=y,setImmediate(()=>{let _=l;if(l=null,_)p(_)})}return{write(y){if(s){p([y]);return}if(i.push(y),a+=t(y),m(),i.length>=r||a>=o)h()},flush:f,dispose(){f()}}}function Che(e){if(typeof e==="function")return e;if(Symbol.asyncDispose in e)return()=>e[Symbol.asyncDispose]();return()=>e[Symbol.dispose]()}class BA{#e=new Set;#t=!1;get drainStarted(){return this.#t}register(e){let t=Che(e);this.#e.add(t);let n=()=>{this.#e.delete(t)};return Object.assign(n,{[Symbol.dispose]:n})}async drain(){this.#t=!0;let e=Array.from(this.#e);this.#e.clear();let n=(await Promise.allSettled(e.map(async(r)=>r()))).find((r)=>r.status==="rejected");if(n!==void 0)throw n.reason}async[Symbol.asyncDispose](){await this.drain()}get sizeForTesting(){return this.#e.size}}class sz{cleanup=new BA;preExitFlush=new BA}var khe=new nt(()=>new sz);function Rhe(){return khe.of(Ct().host)}function B_(e){return Rhe().cleanup.register(e)}class az{parsed=new Map;lookup(e){return this.parsed.get(e)}remember(e,t){this.parsed.set(e,t)}reset(){this.parsed.clear()}}var iz=new az;function cz(e){let t=iz.lookup(e);if(t!==void 0)return t;let n=Ohe(e);return iz.remember(e,n),n}function Ohe(e){if(!e||e.trim()==="")return null;let t=e.split(",").map((s)=>s.trim()).filter(Boolean);if(t.length===0)return null;let n=t.some((s)=>s.startsWith("!")),r=t.some((s)=>!s.startsWith("!"));if(n&&r)return null;let o=t.map((s)=>s.replace(/^!/,"").toLowerCase());return{include:n?[]:o,exclude:n?o:[],isExclusive:n}}function Phe(e){let t=[],n=e.match(/^MCP server ["']([^"']+)["']/);if(n&&n[1])t.push("mcp"),t.push(n[1].toLowerCase());else{let s=e.match(/^([^:[]+):/);if(s&&s[1])t.push(s[1].trim().toLowerCase())}let r=e.match(/^\[([^\]]+)]/);if(r&&r[1])t.push(r[1].trim().toLowerCase());if(e.toLowerCase().includes("1p event:"))t.push("1p");let o=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(o&&o[1]){let s=o[1].trim().toLowerCase();if(s.length<30&&!s.includes(" "))t.push(s)}return Array.from(new Set(t))}function Ihe(e,t){if(!t)return!0;if(e.length===0)return!1;if(t.isExclusive)return!e.some((n)=>t.exclude.includes(n));else return e.some((n)=>t.include.includes(n))}function lz(e,t){if(!t)return!0;let n=Phe(e);return Ihe(n,t)}function Dhe(e,t,n){if(e.destroyed||e.writableEnded)return!1;return e.write(t,n),!0}class KA{everWritten=!1;drainPromise=void 0;bytesQueued=0;bytesFlushed=0;notifyFlushProgress=void 0;notifyExternallyClocked=void 0;externallyClockedPromise=void 0;externallyClocked=!1;errored=!1;flushConfirmedPromise=void 0;flushCloseListener=void 0;markEverWritten(){this.everWritten=!0}recordQueued(e){this.bytesQueued+=e}recordFlushed(e){this.bytesFlushed+=e,this.notifyFlushProgress?.()}markErrored(){this.errored=!0,this.notifyFlushProgress?.()}outstandingBytes(){return process.stdout.destroyed||this.errored?0:this.bytesQueued-this.bytesFlushed}endStdoutOnce(){if(this.drainPromise===void 0){let e=process.stdout;if(e.isTTY||e.destroyed||e.writableEnded||!this.everWritten)return;this.drainPromise=new Promise((t)=>e.end(t))}return this.drainPromise}fullyFlushed(){if(this.flushConfirmedPromise===void 0)this.flushConfirmedPromise=new Promise((e)=>{let t=()=>{if(this.outstandingBytes()<=0)this.notifyFlushProgress=void 0,e()};this.notifyFlushProgress=t,this.flushCloseListener=t,process.stdout.once("close",t),t()});return this.flushConfirmedPromise}isExternallyClocked(){return this.externallyClocked}ensureExternallyClockedPromise(){return this.externallyClockedPromise??=new Promise((e)=>{this.notifyExternallyClocked=e})}markExternallyClocked(){this.externallyClocked=!0,this.ensureExternallyClockedPromise(),this.notifyExternallyClocked?.(),this.notifyExternallyClocked=void 0}reset(){if(this.flushCloseListener!==void 0)process.stdout.removeListener("close",this.flushCloseListener);Object.assign(this,new KA)}}var vxt=new KA;function uz(e){Dhe(process.stderr,e)}var Lhe=/api[_-]?key|secret|token|password|passwd|credential|bearer|authorization|auth[_-]?header|cookie|session[_-]?(?:id|key)|connection[_-]?string|(?:private|ssh|encryption|signing|access|deploy|master|license)[_-]?key|client[_-]?secret/i,dz="[^\\s,;&}\\])]+",pz=`"[^"]*"|'[^']*'|[^\\s-]{0,4}\\[REDACTED\\]['"\`]?|(?:Bearer|Basic)\\s+(?:\\[REDACTED\\]|${dz})|${dz}`,Nhe=["sk","ant","api"].join("-"),_o="[\\w=-]{20,}(?:\\.[0-9a-z]{9})?",gz=[{id:"url-userinfo",source:":\\/\\/([^/@\\s]+)@",confidence:"low"},{id:"gcp-service-account",source:"\\b([a-z0-9-]+@[a-z0-9-]+\\.iam\\.gserviceaccount\\.com)\\b",flags:"i",confidence:"low"},{id:"loose-anthropic-key",source:"\\b(sk-ant-?[\\w-]{10,})",confidence:"low"},{id:"http-auth-scheme",source:"\\b(?:Bearer|Basic)\\s+([A-Za-z0-9+/=._~-]{20,})",flags:"i",confidence:"low"},{id:"loose-jwt",source:"\\b(eyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,})",confidence:"low"},{id:"sensitive-assign",source:`(?:${Lhe.source})[\\w.-]*["']?\\s*[=:]\\s*(${pz})`,flags:"i",confidence:"low"},{id:"cloud-env-var",source:`\\b(?:AWS|GOOGLE|GCP|GCLOUD|AZURE)_\\w+\\s*[=:]\\s*(${pz})`,flags:"i",confidence:"low"},{id:"aws-access-token",source:"\\b((?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16})\\b",confidence:"high"},{id:"gcp-api-key",source:"\\b(AIza[\\w-]{35})(?![\\w-])",confidence:"high"},{id:"google-oauth-client-secret",source:"\\bGOCSPX-[\\w-]{28}(?![\\w-])",confidence:"high"},{id:"azure-ad-client-secret",source:`(?:^|[\\\\'"\\x60\\s>=:(,)])([a-zA-Z0-9_~.]{3}\\dQ~[a-zA-Z0-9_~.-]{31,34})(?:$|[\\\\'"\\x60\\s<),])`,confidence:"high"},{id:"digitalocean-pat",source:`\\b(dop_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"digitalocean-access-token",source:`\\b(doo_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-api-key",source:`\\b(${Nhe}03-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-admin-api-key",source:`\\b(sk-ant-admin01-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-oauth-token",source:`\\b(sk-ant-(?:oat|ort)\\d{2}-[\\w-]{20,})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"openai-api-key",source:"sk-[A-Za-z0-9_-]{8,200}T3BlbkFJ[A-Za-z0-9_-]{8,200}",confidence:"high"},{id:"openai-legacy-api-key",source:"\\bsk-[a-zA-Z0-9]{48}(?![a-zA-Z0-9])",confidence:"high"},{id:"huggingface-access-token",source:`\\b(hf_[a-zA-Z]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"supabase-secret-key",source:"\\bsb_secret_[A-Za-z0-9_-]{20,}",confidence:"high"},{id:"supabase-access-token",source:"\\bsbp_[a-z0-9]{40,}",confidence:"high"},{id:"github-pat",source:"ghp_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-fine-grained-pat",source:"github_pat_\\w{82}",confidence:"high"},{id:"github-app-token",source:"(?:ghu|ghs)_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-oauth",source:"gho_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-refresh-token",source:"ghr_[0-9a-zA-Z]{36}",confidence:"high"},{id:"gitlab-pat",source:`glpat-${_o}`,confidence:"high"},{id:"gitlab-deploy-token",source:`gldt-${_o}`,confidence:"high"},{id:"gitlab-runner-authentication-token",source:`glrt-${_o}`,confidence:"high"},{id:"gitlab-oauth-app-secret",source:`gloas-${_o}`,confidence:"high"},{id:"gitlab-pipeline-trigger-token",source:`glptt-${_o}`,confidence:"high"},{id:"gitlab-kubernetes-agent-token",source:`glagent-${_o}`,confidence:"high"},{id:"gitlab-incoming-mail-token",source:`glimt-${_o}`,confidence:"high"},{id:"gitlab-scim-oauth-token",source:`glsoat-${_o}`,confidence:"high"},{id:"gitlab-ci-build-token",source:`glcbt-${_o}`,confidence:"high"},{id:"gitlab-feed-token",source:`glft-${_o}`,confidence:"high"},{id:"gitlab-feature-flag-client-token",source:`glffct-${_o}`,confidence:"high"},{id:"slack-bot-token",source:"xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*",confidence:"high"},{id:"slack-user-token",source:"xox[a-z](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}",confidence:"high"},{id:"slack-rotation-token",source:"xoxe(?:\\.xox[a-z])?-[0-9]-[A-Za-z0-9-]{28,}",confidence:"high"},{id:"slack-app-token",source:"xapp-\\d-[A-Z0-9]+-\\d+-[a-z0-9]+",flags:"i",confidence:"high"},{id:"slack-workflow-token",source:"\\bxwfp-[a-zA-Z0-9-]{20,}",confidence:"high"},{id:"slack-webhook-url",source:"(?:https?://)?hooks\\.slack\\.com/(?:services|workflows|triggers)/[A-Za-z0-9+/_-]{40,}",flags:"i",confidence:"high"},{id:"twilio-api-key",source:"SK[0-9a-fA-F]{32}",confidence:"high"},{id:"sendgrid-api-token",source:`\\b(SG\\.[a-zA-Z0-9=_\\-.]{66})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"npm-access-token",source:`\\b(npm_[a-zA-Z0-9]{36})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"pypi-upload-token",source:"pypi-AgEIcHlwaS5vcmc[\\w-]{50,1000}",confidence:"high"},{id:"databricks-api-token",source:`\\b(dapi[a-f0-9]{32}(?:-\\d)?)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"hashicorp-tf-api-token",source:"[a-zA-Z0-9]{14}\\.atlasv1\\.[a-zA-Z0-9\\-_=]{60,70}",confidence:"high"},{id:"pulumi-api-token",source:`\\b(pul-[a-f0-9]{40})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"postman-api-token",source:`\\b(PMAK-[a-fA-F0-9]{24}-[a-fA-F0-9]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-api-key",source:`\\b(eyJrIjoi[A-Za-z0-9+/]{70,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-cloud-api-token",source:`\\b(glc_[A-Za-z0-9+/]{32,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-service-account-token",source:`\\b(glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-user-token",source:`\\b(sntryu_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-org-token",source:"\\bsntrys_eyJpYXQiO[a-zA-Z0-9+/]{10,200}(?:LCJyZWdpb25fdXJs|InJlZ2lvbl91cmwi|cmVnaW9uX3VybCI6)[a-zA-Z0-9+/]{10,200}={0,2}_[a-zA-Z0-9+/]{43}",confidence:"high"},{id:"stripe-access-token",source:`\\b((?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"shopify-access-token",source:"shpat_[a-fA-F0-9]{32}",confidence:"high"},{id:"shopify-shared-secret",source:"shpss_[a-fA-F0-9]{32}",confidence:"high"}],Mhe=64;function GA(e,t){let n=/-----BEGIN[ A-Z0-9_-]{0,100}?PRIVATE KEY(?: BLOCK)?-----/gi,r=/-----END[ A-Z0-9_-]{0,100}?PRIVATE KEY(?: BLOCK)?-----/gi;n.lastIndex=t;let o=n.exec(e);if(!o)return null;r.lastIndex=o.index+o[0].length+Mhe;let s=r.exec(e);if(!s)return null;return{start:o.index,end:s.index+s[0].length}}function Uhe(e){return GA(e,0)!==null}function Fhe(e){let t=GA(e,0);if(!t)return e;let n="",r=0;while(t)n+=e.slice(r,t.start)+"[REDACTED]",r=t.end,t=GA(e,r);return n+e.slice(r)}var fz=`(?:[\\x60'"\\s;]|\\\\[nr]|$)`,mz="(?=[^a-zA-Z0-9_\\-+=]|$)",$he="(?<![a-zA-Z0-9_\\-])";function zhe(){return gz.map((e)=>({id:e.id,confidence:e.confidence,re:new RegExp(e.confidence!=="high"?e.source:$he+(e.source.endsWith(fz)?e.source.slice(0,-fz.length)+mz:e.source+mz),(e.flags??"").replace("g","")+"g")}))}function hz(e){return gz.map((t)=>({id:t.id,confidence:t.confidence,re:new RegExp(t.source,e?(t.flags??"").replace("g","")+"g":t.flags??"")}))}function _z(e,t){if(typeof t!=="string")return"[REDACTED]";let n=t.length>=2&&(t[0]==='"'||t[0]==="'")&&t.at(-1)===t[0]?t[0]:"",r=e.lastIndexOf(t);return`${e.slice(0,r)}${n}[REDACTED]${n}${e.slice(r+t.length)}`}var jhe=512,Hhe=512;class yz{testRules=null;redactRules=null;displayRules=null;resultCache=new Map;scan(e){this.testRules??=hz(!1);let t=[];for(let n of this.testRules)if(n.confidence==="high"&&n.re.test(e))t.push({ruleId:n.id,label:n.id.split("-").map((r)=>Vhe[r]??Wd(r)).join(" ")});if(Uhe(e))t.push({ruleId:"private-key",label:"Private Key"});return t}redact(e){let t=e.length<=jhe;if(t){let r=this.resultCache.get(e);if(r!==void 0)return r}this.redactRules??=hz(!0);let n=Fhe(e);for(let r of this.redactRules)n=n.replace(r.re,_z);if(t){if(this.resultCache.size>=Hhe)this.resultCache.delete(this.resultCache.keys().next().value);this.resultCache.set(e,n)}return n}redactForDisplay(e){this.displayRules??=zhe();let t=e;for(let n of this.displayRules){if(n.confidence!=="high")continue;t=t.replace(n.re,Whe)}return t}}var Bhe=new yz;function Sz(e){return Bhe.redact(e)}var Khe=/[$\x60|;&<>()\s]/,Ghe=/[/.@:~*?\\]/;function Whe(e,t){let n=typeof t==="string"?t:e;if(Khe.test(n)||Ghe.test(n))return e;return _z(e,t)}var Vhe={aws:"AWS",gcp:"GCP",api:"API",pat:"PAT",ad:"AD",tf:"TF",oauth:"OAuth",npm:"NPM",pypi:"PyPI",jwt:"JWT",ci:"CI",scim:"SCIM",github:"GitHub",gitlab:"GitLab",openai:"OpenAI",digitalocean:"DigitalOcean",huggingface:"HuggingFace",hashicorp:"HashiCorp",sendgrid:"SendGrid"};var ZA={verbose:0,debug:1,info:2,warn:3,error:4},Jhe=10485760;function Xhe(e){return Object.hasOwn(ZA,e)}function xz(e){return qN(e)?null:Tz(e)}function vz(){}var Qhe={sessionId:"",fromBackend:!1};function wz(e,t,n,r){let o=wi(t,"debug"),s=wi(o,`${e.sessionId}.txt`),i;if(n===null)i=s;else if(r!==null&&n===r)i=wi(r,`${e.sessionId}.txt`);else i=n;let a=!e.fromBackend&&i===s?"v5":"raw";return{target:i,arm:a,configHome:t,rotate:a==="raw"&&!(nu(i)===o&&i.endsWith(".txt")),pointLatest:a==="raw"&&i!==s}}function qA(e){return H_.userNamed(Yhe(e)?e:Tz(e))}function ege(e){return e.code==="Failed"&&e.telemetryCode==="ENOENT"}function tge(e,t=rz){return t?e:void 0}async function Az(e,t,n,r){let o={namespace:"log",sessionId:t,channel:"debug"},s=await HA.run(!0,()=>e.append(o,[{data:n}],r?{markLatest:!0}:void 0));if(s.ok)return"landed";return r&&s.error.code==="InvalidArgument"&&s.error.argument==="opts.markLatest"?"refused":"dropped"}class Cz{deps;minLevel;filter;toStderr;filePath;runtimeDebugEnabled=!1;hasFormattedOutput=!1;debugFromLaunch;storageV5;writer=null;redirect=null;pendingWrite=Promise.resolve();unflushedChunks=[];backendLinesLogged=0;exiting=!1;exitHandlerRegistered=!1;successor=null;writtenBytes=-1;rotating=!1;resolvedLogPath=null;overrideDirectory=null;rotationTarget=null;latestMarked=!1;latestRefused=!1;constructor(e){this.deps=e;if(this.storageV5=tge(e.storageV5),e.launchIdentity!==void 0){this.minLevel=e.launchIdentity.minLevel,this.filter=e.launchIdentity.filter,this.toStderr=e.launchIdentity.toStderr,this.filePath=e.launchIdentity.filePath,this.debugFromLaunch=e.launchIdentity.debugFromLaunch;return}let t=Array.isArray(e.argv)?e.argv:[],n=t.indexOf("--"),r=n===-1?t:t.slice(0,n),o=e.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();this.minLevel=o&&Xhe(o)?o:"debug";let s=r.find((a)=>a.startsWith("--debug="));this.filter=s?cz(s.substring(8)):null,this.toStderr=r.includes("--debug-to-stderr")||r.includes("-d2e");let i=null;for(let a=0;a<r.length;a++){let c=r[a];if(c.startsWith("--debug-file=")){i=xz(c.substring(13));break}if(c==="--debug-file"&&a+1<r.length){i=xz(r[a+1]);break}}this.filePath=i,this.debugFromLaunch=Oe(e.env.DEBUG)||Oe(e.env.DEBUG_SDK)||r.includes("--debug")||r.includes("-d")||this.toStderr||s!==void 0||this.filePath!==null}isDebugMode(){return this.runtimeDebugEnabled||this.debugFromLaunch}drainsSyncAtExit(){return!(ye()&&this.storageV5!==void 0&&this.deps.syncExitDrain===!1)}launchIdentity(){return{minLevel:this.minLevel,filter:this.filter,toStderr:this.toStderr,filePath:this.filePath,debugFromLaunch:this.debugFromLaunch,isAnt:this.deps.isAnt,isTestEnvironment:this.deps.isTestEnvironment}}enableDebugLogging(){let e=this.isDebugMode()||this.deps.isAnt;return this.runtimeDebugEnabled=!0,e}logPath(){return this.filePath??(this.overrideDirectory!==null&&this.overrideDirectory===this.deps.env.CLAUDE_CODE_DEBUG_LOGS_DIR?wi(this.overrideDirectory,`${this.deps.sessionId()}.txt`):null)??this.resolvedLogPath??this.deps.env.CLAUDE_CODE_DEBUG_LOGS_DIR??this.defaultLogPath()}defaultLogPath(e=this.deps.sessionId()){return wi(this.deps.configHomeDir(),"debug",`${e}.txt`)}learnedOverrideDirectory(){return this.overrideDirectory}isArmed(){return this.storageV5!==void 0}log(e,{level:t}={level:"debug"}){if(ZA[t]<ZA[this.minLevel])return;if(!this.shouldLog(e))return;let n=Sz(e.trim());if(n.includes(`
96
+ `))n=me(n);let o=`${new Date().toISOString()} [${t.toUpperCase()}] ${n}
97
+ `;if(this.toStderr){this.deps.writeToStderr(o);return}this.write(o)}write(e){let t=this.getWriter(),n=Qhe;if(this.storageV5!==void 0){if(n={sessionId:this.deps.sessionId(),fromBackend:HA.getStore()===!0},n.fromBackend)this.backendLinesLogged++}if(t.write({origin:n,content:e}),this.exiting)t.flush()}async flush(){let e=this.backendLinesLogged;if(this.writer?.flush(),await this.pendingWrite,this.storageV5!==void 0&&this.successor)return this.successor.flush();for(let t=0;this.backendLinesLogged!==e&&t<3;t++)e=this.backendLinesLogged,this.writer?.flush(),await this.pendingWrite}dispose(e){this.redirect=e;try{this.writer?.dispose()}finally{this.redirect=null,this.writer=null}}succeed(e){this.runtimeDebugEnabled=e.runtimeDebugEnabled,this.hasFormattedOutput=e.hasFormattedOutput,this.pendingWrite=e.pendingWrite,this.unflushedChunks=e.unflushedChunks,this.exitHandlerRegistered=e.exitHandlerRegistered,e.successor=this,e.dispose((t)=>{this.write(t)})}handleExit(){if(this.successor){this.successor.handleExit();return}this.exiting=!0,this.writer?.flush(),this.drainSync()}async maybeRotate(e,t,n=Jhe){let r=ye()&&this.storageV5!==void 0?this.storageV5.hostFiles:void 0;if(this.writtenBytes<0)if(r){let o=await r.stat(qA(e));this.writtenBytes=o.ok&&o.value.kind!=="absent"?o.value.size:0}else this.writtenBytes=await qhe(e).then((o)=>o.size).catch(()=>0);else this.writtenBytes+=t;if(this.writtenBytes<=n||this.rotating)return;this.rotating=!0;try{let o=e.endsWith(".txt")?`${e.slice(0,-4)}.1.txt`:`${e}.1`;if(r){let s=qA(e),i=qA(o),a=await r.rename(s,i);if(!a.ok&&!ege(a.error)){if(await r.delete(i,{missingOk:!0}),!(await r.rename(s,i)).ok)await r.delete(s,{missingOk:!0})}}else try{await Ez(e,o)}catch(s){if(!wr(s))await VA(o).catch(()=>{}),await Ez(e,o).catch(()=>VA(e).catch(()=>{}))}this.writtenBytes=0}finally{this.rotating=!1}}shouldLog(e){if(this.deps.isTestEnvironment&&!this.toStderr&&this.filePath===null)return!1;if(!this.deps.isAnt&&!this.isDebugMode())return!1;if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;return lz(e,this.filter)}resolveDirToFile(e){return this.resolvedLogPath=wi(e,`${this.deps.sessionId()}.txt`),this.resolvedLogPath}async appendGroup(e,t,n,r){if(this.storageV5!==void 0&&e.arm==="v5"){await this.appendV5AndMark(this.storageV5,t,n);return}if(r)await bz(nu(e.target),{recursive:!0}).catch(()=>{});let o=e;try{await WA(e.target,n)}catch(s){if(!CA(s))throw s;if(this.storageV5===void 0)o={...e,target:this.resolveDirToFile(e.target)},await WA(o.target,n);else{if(this.overrideDirectory=e.target,o=wz(t,e.configHome,e.target,e.target),o.arm==="v5"){await this.appendV5AndMark(this.storageV5,t,n);return}await bz(nu(o.target),{recursive:!0}).catch(()=>{});try{await WA(o.target,n)}catch{return}}}if(o.rotate){if(this.storageV5!==void 0&&o.target!==this.rotationTarget)this.rotationTarget=o.target,this.writtenBytes=-1;await this.maybeRotate(o.target,Buffer.byteLength(n)).catch(vz)}if(o.pointLatest)this.markLatestSymlink()}async appendV5AndMark(e,t,n){let r=ye(),o=r&&!this.latestMarked&&!this.latestRefused,s=await Az(e,t.sessionId,n,o);if(s==="refused")this.latestRefused=!0,s=await Az(e,t.sessionId,n,!1),this.log("debug log: the storage backend refused markLatest; <debug folder>/latest is not pointed in this process",{level:"warn"});if(s!=="landed")return;if(o&&!this.latestRefused)this.latestMarked=!0;else if(!r)this.markLatestSymlink()}markLatestSymlink(){if(!this.latestMarked)this.latestMarked=!0,this.updateLatestSymlink()}shiftUnflushedChunk(){this.unflushedChunks.shift()}drainSync(){if(this.unflushedChunks.length===0)return;if(!this.drainsSyncAtExit()){this.unflushedChunks.length=0;return}let e=[];for(let t of this.unflushedChunks.splice(0)){let n=e.at(-1);if(n!==void 0&&n.armed===t.armed&&(!t.armed||n.target===t.target))n.parts.push(t);else e.push({target:t.target,armed:t.armed,parts:[t]})}for(let{target:t,armed:n,parts:r}of e){let o=n?t:this.logPath(),s=r.map((i)=>i.content).join("");try{tt().mkdirSync(nu(o))}catch{}try{tt().appendFileSync(o,s)}catch(i){if(CA(i))try{if(!n)tt().appendFileSync(this.resolveDirToFile(o),s);else{let a=(u,p)=>{try{tt().appendFileSync(wi(o,`${u}.txt`),p)}catch{}},c=r[0]?.sessionId,l="";for(let u of r){if(u.sessionId!==c)a(c,l),c=u.sessionId,l="";l+=u.content}a(c,l)}}catch{}}}}groupLines(e){let t=e[0];if(t===void 0)return[];if(this.storageV5===void 0)return[{decision:{target:this.logPath(),arm:"raw",configHome:"",rotate:!0,pointLatest:!0},origin:t.origin,lines:e}];let n=[];for(let r of e){let o=n.at(-1);if(o!==void 0&&o.origin.sessionId===r.origin.sessionId&&o.origin.fromBackend===r.origin.fromBackend)o.lines.push(r);else n.push({decision:wz(r.origin,this.deps.configHomeDir(),this.filePath??this.deps.env.CLAUDE_CODE_DEBUG_LOGS_DIR??null,this.overrideDirectory),origin:r.origin,lines:[r]})}return n}getWriter(){if(this.writer)return this.writer;let e=null,t=this.storageV5!==void 0;if(this.writer=oz({writeBatch:(n)=>{if(this.redirect){this.redirect(n.map((r)=>r.content).join(""));return}if(this.exiting){for(let r of this.groupLines(n))this.unflushedChunks.push({target:r.decision.target,sessionId:r.origin.sessionId,armed:t,content:r.lines.map((o)=>o.content).join("")});this.drainSync();return}for(let r of this.groupLines(n)){let o=r.lines.map((a)=>a.content).join(""),s=nu(r.decision.target),i=r.decision.arm==="raw"&&(r.origin.fromBackend||e!==s);if(r.decision.arm==="raw")e=s;this.unflushedChunks.push({target:r.decision.target,sessionId:r.origin.sessionId,armed:t,content:o}),this.pendingWrite=this.pendingWrite.then(this.appendGroup.bind(this,r.decision,r.origin,o,i)).catch(vz).then(this.shiftUnflushedChunk.bind(this))}},sizeOf:(n)=>n.content.length,flushIntervalMs:1000,maxBufferSize:100,immediateMode:this.isDebugMode()}),this.deps.registerCleanup(async()=>{this.writer?.dispose(),await this.pendingWrite}),!this.exitHandlerRegistered)this.exitHandlerRegistered=!0,this.deps.onExit(this.handleExit.bind(this));return this.writer}async updateLatestSymlink(){try{let e=this.logPath(),t=wi(nu(e),"latest");await VA(t).catch(()=>{}),await Zhe(e,t)}catch{}}}class kz{instance=void 0;init={};setInstance(e){this.instance=e}setInit(e){this.init=e}}var nge=new nt(()=>new kz);function rge(){return nge.of(Ct().host)}function oge(e,t){return new Cz({argv:process.argv,env:process.env,sessionId:()=>ov(),configHomeDir:()=>Wt(),onExit:(n)=>{process.on("exit",n)},registerCleanup:(n)=>{B_(n)},writeToStderr:(n)=>{uz(n)},isAnt:t?.isAnt??!1,isTestEnvironment:t?.isTestEnvironment??!1,launchIdentity:t,storageV5:e.init.storageV5!==void 0&&e.init.configHome===Wt()?e.init.storageV5:void 0,syncExitDrain:e.init.syncExitDrain})}function sge(){let e=rge(),t=e.instance;if(t)return t;let n=oge(e);return e.setInstance(n),n}function ce(e,t={level:"debug"}){sge().log(e,t)}var Zxt=(()=>{let e=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(e!==void 0){let t=Number(e);if(!Number.isNaN(t)&&t>=0)return t}return 1/0})();var ige={[Symbol.dispose](){}};function age(){return ige}var en=age;function me(e,t,n){let o=[];try{const r=$t(o,en`JSON.stringify(${e})`,0);return JSON.stringify(e,t,n)}catch(s){var i=s,a=1}finally{zt(o,i,a)}}var lt=(e,t)=>{let r=[];try{const n=$t(r,en`JSON.parse(${e})`,0);return typeof t>"u"?JSON.parse(e):JSON.parse(e,t)}catch(o){var s=o,i=1}finally{zt(r,s,i)}};function Rz(e){return JSON.parse(e)}function yo(e,t){let r=[];try{const n=$t(r,en`structuredClone(${e})`,0);return structuredClone(e,t)}catch(o){var s=o,i=1}finally{zt(r,s,i)}}var xge="→";function vge(){return process.platform==="win32"?0:_e.constants.O_NOFOLLOW|_e.constants.O_NONBLOCK}var JA=process.platform==="win32"?/[\\/]+/:/\/+/;function eT(e){let t="";for(let r of e.split(/([\\/]+)/)){if(r==="."||r==="..")break;t+=r}let n=t.replace(/(?<=[^\\/])[\\/]+$/,"");return n===""?e:n}function wge(e){let t=an.join(e).replace(/(?<=[^\\/])[\\/]+$/,"");if(Vo(t)&&!da(t))return t;return eT(e)}function Age(e){if(e.startsWith("\\\\"))return eT(e);let t=e.replace(/^\/+/,"/"),n=Sg(t);if(n!==null)return n;return eT(e)}var Tge=process.platform==="win32"?wge:Age;function Pz(e,t,n){let r=Hd(e);if(t.length===0||r||t.some((o)=>o==="."||o==="..")){if(n!==void 0&&(t.length>0||r))n(an.join(e,...t));return r?Tge(e):e}return an.join(e,...t)}var Lz="\x00unverified-ancestry";function Iz(e,t,n=!1){if(t?.unreadableAncestry!=="unverified")return;let r=e!==void 0&&typeof e==="object"&&"errno"in e?e.errno:void 0;if(r==="ENOENT"||r==="ENOTDIR")return;if(r==="ENAMETOOLONG"&&!n)return;return Lz}function XA(e){return Kd(e)}function QA(e,t){return t===void 0||t.every((n)=>WN(e,n))}function Dz(e,t){return t===void 0||t.every((n)=>KN(e,n))}function Cge(e){if(e?.anchors!==void 0&&e.anchors.length>0)return e.anchors;return e?.anchor!==void 0?[e.anchor]:void 0}async function Nz(e){return BN(e)||Fx(e)||ua(e)||Bd(e)||await Rge(Uz,e)!==void 0}function kge(e,t,n){return Oge(Mz(t,n),(r)=>{if(r.kind==="lstat")return e.lstatSync(r.path);if(r.kind==="opendirNofollow")return e.openDirNoFollowSync(r.path),"ok";return e.readlinkSync(r.path)})}function Rge(e,t,n){return Pge(Mz(t,n),async(r)=>{if(r.kind==="lstat")return e.lstat(r.path);if(r.kind==="opendirNofollow")return await e.openDirNoFollow(r.path),"ok";return e.readlink(r.path)})}function Oge(e,t){let n;for(;;){let r=e.next(n);if(r.done)return r.value;try{n=t(r.value)}catch(o){n={errno:Me(o)}}}}async function Pge(e,t){let n;for(;;){let r=e.next(n);if(r.done)return r.value;try{n=await t(r.value)}catch(o){n={errno:Me(o)}}}}function*Mz(e,t){let n=Cge(t);if(Vo(e)&&!da(e)&&Dz(e,n)||ol(e)&&QA(e,n))return;if(XA(e))return e;let r=an.resolve(e),o=an.parse(r).root,s=o,i=r.slice(o.length).split(JA).filter(Boolean),a=0,c,l=64;while(i.length>0&&a<l){let u=an.join(s,i[0]);if(ol(u)&&QA(u,n)||XA(u))return Pz(u,i.slice(1),t?.onCollapsedLanding);let p=yield{kind:"lstat",path:u};if(p===void 0||typeof p==="string"||"errno"in p){if(process.platform!=="win32"&&typeof p==="object"&&"errno"in p&&p.errno!==void 0&&p.errno!=="ENOENT"&&p.errno!=="ENOTDIR"&&p.errno!=="ENAMETOOLONG"){if(typeof(yield{kind:"opendirNofollow",path:u})==="string"){i.shift(),s=u;continue}}return Iz(p,t,a>0)}if(!p.isSymbolicLink()){i.shift(),s=u;continue}a++;let m=u+"\x00"+i.join("\x00");if((c??=new Set).has(m))return;c.add(m);let h=yield{kind:"readlink",path:u};if(typeof h!=="string")return Iz(h,t,a>0);let y=h;if(!an.isAbsolute(y)){i.shift(),i=[...y.split(JA).filter(Boolean),...i];continue}let _=y;if(Vo(_)&&!da(_)&&Dz(_,n)||ol(_)&&QA(_,n)||XA(_))return i.shift(),Pz(_,i,t?.onCollapsedLanding);if(t?.surfaceNetworkRaw===!0&&Hd(_)&&(Vo(_)||ua(_)||Kd(_)||Bd(_)))return i.shift(),i.length===0?_:_+an.sep+i.join(an.sep);i.shift();let S=an.parse(_).root||an.sep;s=S,i=[..._.slice(S.length).split(JA).filter(Boolean),...i]}if(i.length>0&&t?.surfaceNetworkRaw)return Lz;if(a>0&&Bd(s))return s;return}function vf(e,t){if(Vo(t)&&!da(t)||ol(t)||VN(t))return{resolvedPath:t,isSymlink:!1,isCanonical:!1};let n=kge(e,t);if(n!==void 0)return{resolvedPath:n,isSymlink:!0,isCanonical:!1};try{let r=e.realpathSync(t);return{resolvedPath:r,isSymlink:r!==t,isCanonical:!0}}catch(r){return{resolvedPath:t,isSymlink:!1,isCanonical:!1}}}var Uz={cwd(){return process.cwd()},existsSync(e){let n=[];try{const t=$t(n,en`fs.existsSync(${e})`,0);return _e.existsSync(e)}catch(r){var o=r,s=1}finally{zt(n,o,s)}},async stat(e){return Sge(e)},async lstat(e){return YA(e)},async openDirNoFollow(e){if(process.platform==="win32")throw Error("openDirNoFollow is a POSIX-only examination probe");await(await K_(e,_e.constants.O_DIRECTORY|_e.constants.O_NOFOLLOW)).close()},openDirNoFollowSync(e){if(process.platform==="win32")throw Error("openDirNoFollowSync is a POSIX-only examination probe");let t=_e.openSync(e,_e.constants.O_DIRECTORY|_e.constants.O_NOFOLLOW);_e.closeSync(t)},async lstatBigint(e){return YA(e,{bigint:!0})},async readdir(e){return fge(e,{withFileTypes:!0})},async unlink(e){return Ege(e)},async rmdir(e){return _ge(e)},async rm(e,t){return yge(e,t)},async mkdir(e,t){try{await pge(e,{recursive:!0,...t})}catch(n){if(Me(n)!=="EEXIST")throw n}},async readFile(e,t){return Oz(e,{encoding:t.encoding})},async rename(e,t){return gge(e,t)},async realpath(e){return it(await hge(e))},async readlink(e){return mge(e)},async copyFile(e,t){return uge(e,t)},async appendFile(e,t,n){if(n?.mode!==void 0)try{let r=await K_(e,"ax",n.mode);try{await r.appendFile(t)}finally{await r.close()}return}catch(r){if(Me(r)!=="EEXIST")throw r}return cge(e,t)},async symlink(e,t,n){return bge(e,t,n)},async link(e,t){return dge(e,t)},async chmod(e,t){return lge(e,t)},statSync(e){let n=[];try{const t=$t(n,en`fs.statSync(${e})`,0);return _e.statSync(e)}catch(r){var o=r,s=1}finally{zt(n,o,s)}},lstatSync(e){let n=[];try{const t=$t(n,en`fs.lstatSync(${e})`,0);return _e.lstatSync(e)}catch(r){var o=r,s=1}finally{zt(n,o,s)}},readFileSync(e,t){let r=[];try{const n=$t(r,en`fs.readFileSync(${e})`,0);return _e.readFileSync(e,{encoding:t.encoding})}catch(o){var s=o,i=1}finally{zt(r,s,i)}},readSync(e,t){let o=[];try{const n=$t(o,en`fs.readSync(${e}, ${t.length} bytes)`,0);let r=void 0;try{r=_e.openSync(e,"r");let c=[],l=0;while(l<t.length){let p=Buffer.allocUnsafe(Math.min(65536,t.length-l)),f=_e.readSync(r,p,0,p.length,l);if(f===0)break;c.push(p.subarray(0,f)),l+=f}return{buffer:Buffer.concat(c,l),bytesRead:l}}finally{if(r!==void 0)_e.closeSync(r)}}catch(s){var i=s,a=1}finally{zt(o,i,a)}},appendFileSync(e,t,n){let o=[];try{const r=$t(o,en`fs.appendFileSync(${e}, ${t.length} chars)`,0);if(n?.mode!==void 0)try{let c=_e.openSync(e,"ax",n.mode);try{_e.appendFileSync(c,t)}finally{_e.closeSync(c)}return}catch(c){if(Me(c)!=="EEXIST")throw c}_e.appendFileSync(e,t)}catch(s){var i=s,a=1}finally{zt(o,i,a)}},unlinkSync(e){let n=[];try{const t=$t(n,en`fs.unlinkSync(${e})`,0);_e.unlinkSync(e)}catch(r){var o=r,s=1}finally{zt(n,o,s)}},renameSync(e,t){let r=[];try{const n=$t(r,en`fs.renameSync(${e} ${xge} ${t})`,0);_e.renameSync(e,t)}catch(o){var s=o,i=1}finally{zt(r,s,i)}},readlinkSync(e){let n=[];try{const t=$t(n,en`fs.readlinkSync(${e})`,0);return _e.readlinkSync(e)}catch(r){var o=r,s=1}finally{zt(n,o,s)}},realpathSync(e){let n=[];try{const t=$t(n,en`fs.realpathSync(${e})`,0);return it(_e.realpathSync(e))}catch(r){var o=r,s=1}finally{zt(n,o,s)}},mkdirSync(e,t){let o=[];try{const n=$t(o,en`fs.mkdirSync(${e})`,0);let r={recursive:!0};if(t?.mode!==void 0)r.mode=t.mode;try{_e.mkdirSync(e,r)}catch(c){if(Me(c)!=="EEXIST")throw c}}catch(s){var i=s,a=1}finally{zt(o,i,a)}},readdirSync(e){let n=[];try{const t=$t(n,en`fs.readdirSync(${e})`,0);return _e.readdirSync(e,{withFileTypes:!0})}catch(r){var o=r,s=1}finally{zt(n,o,s)}},rmSync(e,t){let r=[];try{const n=$t(r,en`fs.rmSync(${e})`,0);_e.rmSync(e,t)}catch(o){var s=o,i=1}finally{zt(r,s,i)}},createWriteStream(e){return _e.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return Oz(e);let n=await K_(e,process.platform==="win32"?"r":_e.constants.O_RDONLY|(_e.constants.O_NONBLOCK??0)|(_e.constants.O_NOCTTY??0));try{if(!(await n.stat()).isFile())return Buffer.alloc(0);return await Fz(n,t,"file")}finally{await n.close()}},async readFileFdGated(e,t){try{let n=vge();if(n===0){if(!(await YA(e)).isFile())return null}let r=await K_(e,_e.constants.O_RDONLY|n);try{let o=await r.stat();if(!o.isFile()||o.size>t)return null;let s=Number(o.size),i=Buffer.allocUnsafe(s),a=0;while(a<s){let{bytesRead:c}=await r.read(i,a,s-a,a);if(c===0)break;a+=c}return{content:(a<s?i.subarray(0,a):i).toString("utf8"),stats:o}}finally{await r.close()}}catch{return null}}};function tt(){return Uz}async function Fz(e,t,n){let r=n!==void 0?n==="file":(await e.stat()).isFile(),o=[],s=0;while(s<t){let i=Buffer.allocUnsafe(Math.min(65536,t-s)),{bytesRead:a}=await e.read(i,0,i.length,r?s:null);if(a===0)break;o.push(i.subarray(0,a)),s+=a}return Buffer.concat(o,s)}import{readdir as qvt,readFile as Gz}from"fs/promises";import{release as zge}from"os";var Ige="finished",avt=`" ${Ige}`;var Dge="channel",cvt=`<${Dge} source="`;import Ot from"node:path";import $z from"node:os";import tT from"node:process";var Ai=$z.homedir(),nT=$z.tmpdir(),{env:ru}=tT,Lge=(e)=>{let t=Ot.join(Ai,"Library");return{data:Ot.join(t,"Application Support",e),config:Ot.join(t,"Preferences",e),cache:Ot.join(t,"Caches",e),log:Ot.join(t,"Logs",e),temp:Ot.join(nT,e)}},Nge=(e)=>{let t=ru.APPDATA||Ot.join(Ai,"AppData","Roaming"),n=ru.LOCALAPPDATA||Ot.join(Ai,"AppData","Local");return{data:Ot.join(n,e,"Data"),config:Ot.join(t,e,"Config"),cache:Ot.join(n,e,"Cache"),log:Ot.join(n,e,"Log"),temp:Ot.join(nT,e)}},Mge=(e)=>{let t=Ot.basename(Ai);return{data:Ot.join(ru.XDG_DATA_HOME||Ot.join(Ai,".local","share"),e),config:Ot.join(ru.XDG_CONFIG_HOME||Ot.join(Ai,".config"),e),cache:Ot.join(ru.XDG_CACHE_HOME||Ot.join(Ai,".cache"),e),log:Ot.join(ru.XDG_STATE_HOME||Ot.join(Ai,".local","state"),e),temp:Ot.join(nT,t,e)}};function rT(e,{suffix:t="nodejs"}={}){if(typeof e!=="string")throw TypeError(`Expected a string, got ${typeof e}`);if(t)e+=`-${t}`;if(tT.platform==="darwin")return Lge(e);if(tT.platform==="win32")return Nge(e);return Mge(e)}function oT(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t}var bvt=rT("claude-cli");function Fge(){if(process.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC)return"essential-traffic";if(process.env.DISABLE_TELEMETRY)return"no-telemetry";if(Oe(process.env.DO_NOT_TRACK))return"no-telemetry";return"default"}function zz(){return Fge()==="essential-traffic"}var $ge=100;class Hz{recentErrors=[];queue=[];sink=null;hardFailMode=void 0;remember(e){if(this.recentErrors.length>=$ge)this.recentErrors.shift();this.recentErrors.push(e)}dispatch(e){if(this.sink===null){this.queue.push(e);return}switch(e.type){case"error":this.sink.logError(e.error);break;case"mcpError":this.sink.logMCPError(e.serverName,e.error);break;case"mcpDebug":this.sink.logMCPDebug(e.serverName,e.message);break}}attachSink(e){if(this.sink!==null)return;this.sink=e;let t=this.queue;this.queue=[];for(let n of t)this.dispatch(n)}isHardFailMode(){return this.hardFailMode??=process.argv.includes("--hard-fail"),this.hardFailMode}reset(){this.recentErrors=[],this.queue=[],this.sink=null,this.hardFailMode=void 0}}var jz=new Hz;function G_(e){let t=Hr(e);try{if(Oe(process.env.CLAUDE_CODE_USE_BEDROCK)||Oe(process.env.CLAUDE_CODE_USE_VERTEX)||Oe(process.env.CLAUDE_CODE_USE_FOUNDRY)||Oe(process.env.CLAUDE_CODE_USE_ANTHROPIC_AWS)||Oe(process.env.CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD)||Oe(process.env.CLAUDE_CODE_USE_MANTLE)||process.env.DISABLE_ERROR_REPORTING||zz())return;let r={error:t.stack||t.message,timestamp:new Date().toISOString()};jz.remember(r),jz.dispatch({type:"error",error:t})}catch{}}function Bz(){try{return tt().readFileSync("/proc/version",{encoding:"utf8"}).toLowerCase()}catch{return}}function Kz(e){return e.includes("microsoft")||e.includes("wsl")}class Wz{sources;primedProcVersion;fallbackProcVersion;fallbackProcVersionRead=!1;platform;wslVersion=null;macOSMajorVersion=null;linuxDistroInfo;constructor(e){this.sources=e}kernelString(){if(this.primedProcVersion!==void 0)return this.primedProcVersion;if(!this.fallbackProcVersionRead)this.fallbackProcVersion=this.sources.readProcVersionSync(),this.fallbackProcVersionRead=!0;return this.fallbackProcVersion}getPlatform(){if(this.platform!==void 0)return this.platform;try{if(this.sources.platform==="darwin")this.platform="macos";else if(this.sources.platform==="win32")this.platform="windows";else if(this.sources.platform==="linux")if(this.sources.env.WSL_DISTRO_NAME||this.sources.env.WSL_INTEROP)this.platform="wsl";else{let e=this.kernelString();this.platform=e!==void 0&&Kz(e)?"wsl":"linux"}else this.platform="unknown"}catch(e){G_(e),this.platform="unknown"}return this.platform}getWslVersion(){if(this.wslVersion!==null)return this.wslVersion;if(this.sources.platform!=="linux"){this.wslVersion=void 0;return}let e=this.kernelString();if(e===void 0){this.wslVersion=void 0;return}let t=e.match(/wsl(\d+)/);if(t&&t[1])this.wslVersion=t[1];else if(e.includes("microsoft"))this.wslVersion="1";else this.wslVersion=void 0;return this.wslVersion}getMacOSMajorVersion(){if(this.macOSMajorVersion!==null)return this.macOSMajorVersion;if(this.sources.platform!=="darwin"){this.macOSMajorVersion=void 0;return}let e=this.sources.osRelease().match(/^(\d+)\./);return this.macOSMajorVersion=e&&e[1]?parseInt(e[1],10)-9:void 0,this.macOSMajorVersion}getLinuxDistroInfo(){return this.linuxDistroInfo??=this.readLinuxDistroInfo()}async readLinuxDistroInfo(){if(this.sources.platform!=="linux")return;let e={linuxKernel:this.sources.osRelease()};try{let t=await this.sources.readOsRelease();for(let n of t.split(`
98
+ `)){let r=n.match(/^(ID|VERSION_ID)=(.*)$/);if(r&&r[1]&&r[2]){let o=r[2].replace(/^"|"$/g,"");if(r[1]==="ID")e.linuxDistroId=o;else e.linuxDistroVersion=o}}}catch{}return e}async prime(){if(this.primedProcVersion!==void 0||this.sources.platform!=="linux")return;try{let e=await this.sources.readProcVersion();this.primedProcVersion=e.toLowerCase()}catch(e){ce(`Failed to read /proc/version for WSL detection: ${e}`,{level:"error"});return}this.platform=void 0,this.wslVersion=null}}var jge;function Hge(){return jge??=new Wz({platform:process.platform,env:process.env,readProcVersionSync:Bz,readProcVersion:()=>Gz("/proc/version",{encoding:"utf8"}),osRelease:zge,readOsRelease:()=>Gz("/etc/os-release","utf8")})}function Tr(){return Hge().getPlatform()}import{delimiter as nwt,isAbsolute as Bge}from"path";function Kge(e){let t=process.cwd();return e.filter((n)=>!bg(n,t))}function Vz(e){return Gge(e,Bun.which(e))}function Gge(e,t){if(!t||process.platform!=="win32"||Bge(e))return t;return Kge([t])[0]??null}var qz=async(e)=>Vz(e),Zz=Vz;function Yz(){if(process.platform!=="linux")return!1;return tt().existsSync("/proc/sys/fs/binfmt_misc/WSLInterop")}function Jz(){if(process.platform!=="linux")return;try{return tt().readFileSync("/sys/hypervisor/uuid",{encoding:"utf8"}).trim().toLowerCase()}catch{return}}function Xz(){if(process.platform!=="linux")return!1;return tt().existsSync("/.dockerenv")}function Ove(){if(tt().existsSync(em(Wt(),".config.json")))return em(Wt(),".config.json");return Pve()}function Pve(){let e=`.claude${X$()}.json`;return em(process.env.CLAUDE_CONFIG_DIR||kve(),e)}async function Ive(){try{let{externalHttp:e}=await Promise.resolve().then(() => (CK(),TK));return await e.head("http://1.1.1.1",{signal:AbortSignal.timeout(1000)}),!0}catch{return!1}}async function Dve(){return null}async function Cu(e){try{return!!await qz(e)}catch{return!1}}async function Lve(){let e=[];if(await Cu("npm"))e.push("npm");if(await Cu("yarn"))e.push("yarn");if(await Cu("pnpm"))e.push("pnpm");return e}async function Nve(){let e=[];if(await Cu("bun"))e.push("bun");if(await Cu("deno"))e.push("deno");if(await Cu("node"))e.push("node");return e}var kK=["git","node","npm","npx","yarn","pnpm","bun","deno","tsc","python","python3","py","pip","uv","poetry","ruby","gem","bundle","rake","dotnet","msbuild","nuget","cl","nmake","cmake","ninja","make","gcc","g++","clang","cargo","rustc","go","java","javac","mvn","gradle","docker"],Mve=1000;async function Uve(e){try{return/appinstaller/i.test(await Cve(e))}catch{return!1}}async function Fve(e,t){let n=Tr()==="windows",r=new Set(e),o=n?(process.env.PATHEXT??".COM;.EXE;.BAT;.CMD").toLowerCase().split(";").filter(Boolean):[],s=Ar((process.env.PATH??"").split(Rve).map((i)=>i.replace(/^"|"$/g,"")).filter(Boolean));await Promise.all(s.map(async(i)=>{let a;try{a=await Ave(i,{withFileTypes:!0})}catch{return}let c=n&&/[\\/]microsoft[\\/]windowsapps[\\/]?$/i.test(i);for(let l of a){if(l.isDirectory())continue;let u=l.name;if(n){let p=u.toLowerCase(),f=p.lastIndexOf(".");if(f<=0||!o.includes(p.slice(f)))continue;u=p.slice(0,f)}if(!r.has(u)||t.has(u))continue;if(n){if(c&&await Uve(em(i,l.name)))continue}else try{await MC(em(i,l.name),wve.X_OK)}catch{continue}t.add(u)}}))}async function $ve(){let e=new Set;try{await Nr(Fve(kK,e),Mve,"build tool PATH scan timed out")}catch{}return kK.filter((t)=>e.has(t))}function zve(e){try{if(!e.isWslEnvironment())return!1;let t=Zz("npm");if(t===null)return!1;return t.startsWith("/mnt/c/")}catch(t){return!1}}function jve(){return process.env.__CFBundleIdentifier==="com.conductor.app"}var RK=["pycharm","intellij","webstorm","phpstorm","rubymine","clion","goland","rider","datagrip","appcode","dataspell","aqua","gateway","fleet","jetbrains","androidstudio"];function Hve(e){let t=e.toLowerCase();return t.includes("windsurf")||t.includes("devin.app")||t.includes("devin desktop")||t.includes("devin-desktop")||/appdata[\\/]local[\\/](programs[\\/])?devin[\\/]/.test(t)}function Bve(){if(process.env.CURSOR_TRACE_ID)return"cursor";let e=process.env.VSCODE_GIT_ASKPASS_MAIN?.toLowerCase()??"";if(e.includes("cursor"))return"cursor";if(Hve(e))return"windsurf";if(e.includes("antigravity"))return"antigravity";let t=process.env.__CFBundleIdentifier?.toLowerCase();if(t?.includes("vscodium"))return"codium";if(t?.includes("windsurf")||t?.includes("devin"))return"windsurf";if(t?.includes("com.google.android.studio"))return"androidstudio";if(t){for(let n of RK)if(t.includes(n))return n}if(process.env.VisualStudioVersion)return"visualstudio";if(process.env.TERMINAL_EMULATOR==="JetBrains-JediTerm")return"pycharm";if(process.env.TERM==="xterm-ghostty")return"ghostty";if(process.env.TERM?.includes("kitty"))return"kitty";if(process.env.TERM_PROGRAM){if(/^devin([ -]desktop)?$/i.test(process.env.TERM_PROGRAM))return"windsurf";return process.env.TERM_PROGRAM}if(process.env.TMUX)return"tmux";if(process.env.STY)return"screen";if(process.env.KONSOLE_VERSION)return"konsole";if(process.env.GNOME_TERMINAL_SERVICE)return"gnome-terminal";if(process.env.XTERM_VERSION)return"xterm";if(process.env.VTE_VERSION)return"vte-based";if(process.env.TERMINATOR_UUID)return"terminator";if(process.env.KITTY_WINDOW_ID)return"kitty";if(process.env.ALACRITTY_LOG)return"alacritty";if(process.env.TILIX_ID)return"tilix";if(process.env.WT_SESSION)return"windows-terminal";if(process.env.SESSIONNAME&&process.env.TERM==="cygwin")return"cygwin";if(process.env.MSYSTEM)return process.env.MSYSTEM.toLowerCase();if(process.env.ConEmuANSI||process.env.ConEmuPID||process.env.ConEmuTask)return"conemu";if(process.env.WSL_DISTRO_NAME)return`wsl-${process.env.WSL_DISTRO_NAME}`;if(IK())return"ssh-session";if(process.env.TERM){let n=process.env.TERM;if(n.includes("alacritty"))return"alacritty";if(n.includes("rxvt"))return"rxvt";if(n.includes("termite"))return"termite";return process.env.TERM}if(!process.stdout.isTTY)return"non-interactive";return null}class OK{sources;globalClaudeFile;internetAccess;internetProbeOutcome;packageManagers;runtimes;detectedBuildTools;wslEnvironment;npmFromWindowsPath;deploymentEnvironment;primedWslInteropExists;primedHypervisorUuid;primedDockerenvExists;fallbackWslInteropExists;fallbackHypervisorUuid;fallbackDockerenvExists;constructor(e){this.sources=e}getGlobalClaudeFile(){return this.globalClaudeFile??=Ove()}seedGlobalClaudeFile(e){if(this.globalClaudeFile===void 0)return this.globalClaudeFile=e,"seeded";return this.globalClaudeFile===e?"unchanged":"conflict"}hasInternetAccess(){return this.internetAccess??=Ive().then((e)=>(this.internetProbeOutcome=e,e))}getInternetProbeOutcome(){return this.internetProbeOutcome}getPackageManagers(){return this.packageManagers??=Lve()}getRuntimes(){return this.runtimes??=Nve()}getDetectedBuildTools(){return this.detectedBuildTools??=$ve()}isWslEnvironment(){return this.wslEnvironment??=this.primedWslInteropExists??(process.platform==="linux"?this.fallbackWslInteropExists??=this.sources.wslInteropExistsSync():!1)}isNpmFromWindowsPath(){return this.npmFromWindowsPath??=zve(this)}hypervisorUuid(){return this.primedHypervisorUuid??(this.fallbackHypervisorUuid??=this.sources.readHypervisorUuidSync()??"")}isDockerenvPresent(){return this.primedDockerenvExists??(this.fallbackDockerenvExists??=this.sources.dockerenvExistsSync())}detectDeploymentEnvironment(){return this.deploymentEnvironment??=Gve(this)}async prime(){if(this.primedWslInteropExists!==void 0||process.platform!=="linux")return;let[e,t,n]=await Promise.all([MC("/proc/sys/fs/binfmt_misc/WSLInterop").then(()=>!0,()=>!1),Tve("/sys/hypervisor/uuid",{encoding:"utf8"}).then((r)=>r.trim().toLowerCase(),()=>{return}),MC("/.dockerenv").then(()=>!0,()=>!1)]);this.primedWslInteropExists=e,this.primedHypervisorUuid=t??"",this.primedDockerenvExists=n,this.wslEnvironment=void 0,this.npmFromWindowsPath=void 0,this.deploymentEnvironment=void 0}}var Kve=new nt(()=>new OK({wslInteropExistsSync:Yz,readHypervisorUuidSync:Jz,dockerenvExistsSync:Xz}));function Tu(){return Kve.of(Ct().host)}function PK(){return Tu().detectDeploymentEnvironment()}function Gve(e){if(Oe(process.env.CODESPACES))return"codespaces";if(process.env.GITPOD_WORKSPACE_ID)return"gitpod";if(Oe(process.env.CODER)||process.env.CODER_WORKSPACE_NAME)return"coder";if(Oe(process.env.DEVPOD)||process.env.DEVPOD_WORKSPACE_UID)return"devpod";if(process.env.DAYTONA_WS_ID)return"daytona";if(Oe(process.env.GOOGLE_CLOUD_WORKSTATIONS))return"gcp-cloud-workstations";if(process.env.C9_PID||process.env.C9_USER)return"aws-cloud9";if(process.env.REPL_ID||process.env.REPL_SLUG)return"replit";if(process.env.PROJECT_DOMAIN)return"glitch";if(Oe(process.env.VERCEL))return"vercel";if(process.env.RAILWAY_ENVIRONMENT_NAME||process.env.RAILWAY_SERVICE_NAME)return"railway";if(Oe(process.env.RENDER))return"render";if(Oe(process.env.NETLIFY))return"netlify";if(process.env.DYNO)return"heroku";if(process.env.FLY_APP_NAME||process.env.FLY_MACHINE_ID)return"fly.io";if(Oe(process.env.CF_PAGES))return"cloudflare-pages";if(process.env.DENO_DEPLOYMENT_ID)return"deno-deploy";if(process.env.AWS_LAMBDA_FUNCTION_NAME)return"aws-lambda";if(process.env.AWS_EXECUTION_ENV==="AWS_ECS_FARGATE")return"aws-fargate";if(process.env.AWS_EXECUTION_ENV==="AWS_ECS_EC2")return"aws-ecs";if(e.hypervisorUuid().startsWith("ec2"))return"aws-ec2";if(process.env.K_SERVICE)return"gcp-cloud-run";if(process.env.GOOGLE_CLOUD_PROJECT)return"gcp";if(process.env.WEBSITE_SITE_NAME||process.env.WEBSITE_SKU)return"azure-app-service";if(process.env.AZURE_FUNCTIONS_ENVIRONMENT)return"azure-functions";if(process.env.APP_URL?.includes("ondigitalocean.app"))return"digitalocean-app-platform";if(process.env.SPACE_CREATOR_USER_ID)return"huggingface-spaces";if(Oe(process.env.GITHUB_ACTIONS))return"github-actions";if(Oe(process.env.GITLAB_CI))return"gitlab-ci";if(process.env.CIRCLECI)return"circleci";if(process.env.BUILDKITE)return"buildkite";if(Oe(!1))return"ci";if(process.env.KUBERNETES_SERVICE_HOST)return"kubernetes";if(e.isDockerenvPresent())return"docker";if(Qf.platform==="darwin")return"unknown-darwin";if(Qf.platform==="linux")return"unknown-linux";if(Qf.platform==="win32")return"unknown-win32";return"unknown"}function IK(){return!!(process.env.SSH_CONNECTION||process.env.SSH_CLIENT||process.env.SSH_TTY)}var Qf={hasInternetAccess(){return Tu().hasInternetAccess()},probeInternalNetworkAccess:Dve,isCI:Oe(!1),platform:["win32","darwin"].includes(process.platform)?process.platform:"linux",arch:process.arch,nodeVersion:process.version,terminal:Bve(),isSSH:IK,getPackageManagers(){return Tu().getPackageManagers()},getRuntimes(){return Tu().getRuntimes()},isRunningWithBun:il,isWslEnvironment(){return Tu().isWslEnvironment()},isNpmFromWindowsPath(){return Tu().isNpmFromWindowsPath()},isConductor:jve,detectDeploymentEnvironment:PK};var UC={};on(UC,{CLAUDE_AX_PREPARK_MS:()=>qve,CLAUDE_AX_SCREEN_READER:()=>Wve,CLAUDE_AX_STARTUP_QUIET_MS:()=>Vve,CLAUDE_CHROME_CLASSIFIER_FLOOR:()=>Zve,CLAUDE_CODE_ACCESSIBILITY:()=>YAe,CLAUDE_CODE_ACT_DONT_REDERIVE:()=>JAe,CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT:()=>Jve,CLAUDE_CODE_AMBER_ASTROLABE:()=>wAe,CLAUDE_CODE_ARTIFACT_ASSETS:()=>_Te,CLAUDE_CODE_ARTIFACT_COMMENTS:()=>iTe,CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT:()=>aTe,CLAUDE_CODE_ARTIFACT_COMMENT_FAST_ACK:()=>lTe,CLAUDE_CODE_ARTIFACT_COMMENT_FAST_ACK_FIXED:()=>uTe,CLAUDE_CODE_ARTIFACT_COMMENT_RESPONDER:()=>cTe,CLAUDE_CODE_ARTIFACT_DB:()=>dTe,CLAUDE_CODE_ARTIFACT_DELETE:()=>pTe,CLAUDE_CODE_ARTIFACT_MULTI_FILE:()=>yTe,CLAUDE_CODE_ARTIFACT_OPEN_ACTION:()=>mTe,CLAUDE_CODE_ARTIFACT_PRESENCE:()=>gTe,CLAUDE_CODE_ARTIFACT_PREVIEW:()=>fTe,CLAUDE_CODE_ARTIFACT_ROOM:()=>hTe,CLAUDE_CODE_ARTIFACT_TOOLSET:()=>STe,CLAUDE_CODE_ARTIFACT_TYPES:()=>bTe,CLAUDE_CODE_ARTIFACT_TYPE_CATALOG:()=>ETe,CLAUDE_CODE_ARTIFACT_TYPE_CLOUD_CREATE:()=>xTe,CLAUDE_CODE_ARTIFACT_VERIFY:()=>vTe,CLAUDE_CODE_AUTO_CONNECT_IDE:()=>wTe,CLAUDE_CODE_BASALT_COVE:()=>nwe,CLAUDE_CODE_BASH_OUTPUT_AUDIENCE_NOTE:()=>oTe,CLAUDE_CODE_BASH_SANDBOX_SHOW_INDICATOR:()=>ATe,CLAUDE_CODE_BG_TASKS_REPORT_RUNNING:()=>cwe,CLAUDE_CODE_BISON_CAIRN:()=>AAe,CLAUDE_CODE_BREEZY_HORIZON:()=>rwe,CLAUDE_CODE_BUBBLEWRAP:()=>TTe,CLAUDE_CODE_CARVED_SLATE:()=>XAe,CLAUDE_CODE_CCR_LAZY_SUBAGENT_HYDRATE:()=>CTe,CLAUDE_CODE_CHILD_SESSION:()=>kTe,CLAUDE_CODE_COLD_COMPACT:()=>RTe,CLAUDE_CODE_COORDINATOR_FORCE_WORKER_INHERIT_MODEL:()=>lwe,CLAUDE_CODE_COWORK_FRAME_ARTIFACTS:()=>dwe,CLAUDE_CODE_DAPPER_LAGOON:()=>owe,CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING:()=>mwe,CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION:()=>pwe,CLAUDE_CODE_DISABLE_ADVISOR_TOOL:()=>hwe,CLAUDE_CODE_DISABLE_AGENT_VIEW:()=>gwe,CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN:()=>_we,CLAUDE_CODE_DISABLE_ARTIFACT:()=>ywe,CLAUDE_CODE_DISABLE_ATTACHMENTS:()=>Swe,CLAUDE_CODE_DISABLE_AUTO_MEMORY:()=>bwe,CLAUDE_CODE_DISABLE_BACKGROUND_TASKS:()=>Ewe,CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_DEFAULT:()=>vwe,CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD:()=>wwe,CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF:()=>Awe,CLAUDE_CODE_DISABLE_BUNDLED_SKILLS:()=>Twe,CLAUDE_CODE_DISABLE_CFC_PROMPT:()=>Cwe,CLAUDE_CODE_DISABLE_CLAUDE_API_SKILL:()=>kwe,CLAUDE_CODE_DISABLE_CLAUDE_CODE_SKILL:()=>Rwe,CLAUDE_CODE_DISABLE_CLAUDE_MDS:()=>Owe,CLAUDE_CODE_DISABLE_CRON:()=>Pwe,CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS:()=>Iwe,CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS:()=>Dwe,CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY:()=>Lwe,CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING:()=>Nwe,CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS:()=>Mwe,CLAUDE_CODE_DISABLE_LAUNCH_COMPOSER:()=>Uwe,CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND:()=>xwe,CLAUDE_CODE_DISABLE_MEMORY_BULK_INFLATE:()=>Fwe,CLAUDE_CODE_DISABLE_MEMORY_MASS_DELETE_HOLD:()=>$we,CLAUDE_CODE_DISABLE_MEMORY_PERIODIC_RESYNC:()=>zwe,CLAUDE_CODE_DISABLE_MEMORY_RO_UNSAVED_NOTICE:()=>jwe,CLAUDE_CODE_DISABLE_MEMORY_STREAM_LIST:()=>Hwe,CLAUDE_CODE_DISABLE_MOUSE:()=>Gwe,CLAUDE_CODE_DISABLE_MOUSE_CLICKS:()=>Wwe,CLAUDE_CODE_DISABLE_NESTED_CHAIN_IDLE:()=>Vwe,CLAUDE_CODE_DISABLE_NESTED_USER_REPAIR:()=>qwe,CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC:()=>Zwe,CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK:()=>Ywe,CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK:()=>Jwe,CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL:()=>Xwe,CLAUDE_CODE_DISABLE_ORG_MEMORY:()=>Qwe,CLAUDE_CODE_DISABLE_PERMISSION_PROMPT_NOTIFY_HOOKS:()=>Bwe,CLAUDE_CODE_DISABLE_POLICY_SKILLS:()=>eAe,CLAUDE_CODE_DISABLE_PRECOMPACT_SKIP:()=>tAe,CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK:()=>nAe,CLAUDE_CODE_DISABLE_TERMINAL_TITLE:()=>sAe,CLAUDE_CODE_DISABLE_THINKING:()=>aAe,CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL:()=>cAe,CLAUDE_CODE_DISABLE_WORKFLOWS:()=>lAe,CLAUDE_CODE_EDITOR_CODELIVERY:()=>uwe,CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT:()=>dAe,CLAUDE_CODE_ENABLE_AWAY_SUMMARY:()=>pAe,CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH:()=>fAe,CLAUDE_CODE_ENABLE_CFC:()=>mAe,CLAUDE_CODE_ENABLE_DESIGN_SYNC:()=>hAe,CLAUDE_CODE_ENABLE_EXPERIMENTAL_ADVISOR_TOOL:()=>gAe,CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL:()=>_Ae,CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING:()=>yAe,CLAUDE_CODE_ENABLE_LAUNCH_COMPOSER:()=>SAe,CLAUDE_CODE_ENABLE_MENU_KIND_LANES:()=>bAe,CLAUDE_CODE_ENABLE_NARRATION:()=>LAe,CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION:()=>IAe,CLAUDE_CODE_ENABLE_REFRESH_MCP_TOOLS:()=>DAe,CLAUDE_CODE_ENABLE_REMOTE_RECAP:()=>NAe,CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING:()=>MAe,CLAUDE_CODE_ENABLE_TASKS:()=>UAe,CLAUDE_CODE_ENABLE_TODO_TOOLS:()=>FAe,CLAUDE_CODE_ENABLE_TOKEN_USAGE_ATTACHMENT:()=>$Ae,CLAUDE_CODE_ENABLE_XAA:()=>zAe,CLAUDE_CODE_EVAL_INTERVIEW_SESSION:()=>hCe,CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:()=>OTe,CLAUDE_CODE_EXPERIMENTAL_OBSERVER_AGENTS:()=>PTe,CLAUDE_CODE_FLEETVIEW_SIMPLE:()=>EAe,CLAUDE_CODE_FORCE_MID_CONVERSATION_SYSTEM:()=>FTe,CLAUDE_CODE_FORCE_SESSION_PERSISTENCE:()=>MTe,CLAUDE_CODE_FORCE_STRIKETHROUGH:()=>UTe,CLAUDE_CODE_FORCE_WINDOWS_CREDMAN:()=>$Te,CLAUDE_CODE_FORK_SUBAGENT:()=>ITe,CLAUDE_CODE_FORWARD_SUBAGENT_TEXT:()=>zTe,CLAUDE_CODE_GAULT_KESTREL:()=>CAe,CLAUDE_CODE_GB_DISK_CACHE_WHEN_TELEMETRY_OFF:()=>xAe,CLAUDE_CODE_GENTLE_PARASOL:()=>ewe,CLAUDE_CODE_GLOB_HIDDEN:()=>DTe,CLAUDE_CODE_GLOB_NO_IGNORE:()=>LTe,CLAUDE_CODE_GORSE_PLOVER:()=>kAe,CLAUDE_CODE_HARBOR_KITE:()=>jAe,CLAUDE_CODE_HARBOR_KITE_CLOUD:()=>BAe,CLAUDE_CODE_HARBOR_KITE_PACING_OFF:()=>HAe,CLAUDE_CODE_HIDE_CWD:()=>NTe,CLAUDE_CODE_HOOKS_SAME_THREAD:()=>wke,CLAUDE_CODE_HOVER_REST:()=>vAe,CLAUDE_CODE_HUMBLE_HAMMOCK:()=>iwe,CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL:()=>jTe,CLAUDE_CODE_IDE_SKIP_VALID_CHECK:()=>HTe,CLAUDE_CODE_INCLUDE_PARTIAL_MESSAGES:()=>BTe,CLAUDE_CODE_INTRO_FRAME:()=>QAe,CLAUDE_CODE_JUNIPER_SUNDIAL:()=>PAe,CLAUDE_CODE_KB_COHESION_FIXES:()=>ZAe,CLAUDE_CODE_LANTERN_PRISM:()=>KAe,CLAUDE_CODE_LARCH_CISTERN:()=>TAe,CLAUDE_CODE_LUMINOUS_WHISTLE:()=>swe,CLAUDE_CODE_MEMORY_PUSH_DELETE_MODE:()=>Kwe,CLAUDE_CODE_NANKEEN_KESTREL:()=>fwe,CLAUDE_CODE_NATIVE_CURSOR:()=>KTe,CLAUDE_CODE_NEW_INIT:()=>GTe,CLAUDE_CODE_NO_FLICKER:()=>WTe,CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE:()=>VTe,CLAUDE_CODE_PARCHMENT_FERN:()=>RAe,CLAUDE_CODE_PEWTER_OWL:()=>TCe,CLAUDE_CODE_PEWTER_OWL_TOOL:()=>CCe,CLAUDE_CODE_PLAN_MODE_REQUIRED:()=>qTe,CLAUDE_CODE_PLUGIN_BINARY_ASSETS:()=>ECe,CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE:()=>bCe,CLAUDE_CODE_PLUGIN_PREFER_HTTPS:()=>vCe,CLAUDE_CODE_PLUGIN_USE_ZIP_CACHE:()=>xCe,CLAUDE_CODE_POLL_EVENTS:()=>ZTe,CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY:()=>wCe,CLAUDE_CODE_PROACTIVE:()=>YTe,CLAUDE_CODE_PROMPT_CACHE_TTL:()=>fke,CLAUDE_CODE_PROPAGATE_TRACEPARENT:()=>ACe,CLAUDE_CODE_REFUSAL_FALLBACK_CATCH_ALL:()=>rAe,CLAUDE_CODE_REPORT_FINDINGS:()=>oAe,CLAUDE_CODE_SEND_FEEDBACK:()=>iAe,CLAUDE_CODE_SILENT_TURN_REMINDER:()=>tTe,CLAUDE_CODE_SILENT_TURN_REMINDER_TEXT:()=>rTe,CLAUDE_CODE_SILENT_TURN_REMINDER_TURNS:()=>nTe,CLAUDE_CODE_SKILL_PROPOSALS:()=>JTe,CLAUDE_CODE_SKIP_PLUGIN_MCP_SERVERS:()=>XTe,CLAUDE_CODE_SKIP_PLUGIN_MCP_SERVERS_EXCEPT:()=>QTe,CLAUDE_CODE_SKIP_PROJECT_BACKFILL:()=>eCe,CLAUDE_CODE_SKIP_PROMPT_HISTORY:()=>tCe,CLAUDE_CODE_SKIP_REPO_UPLOAD:()=>nCe,CLAUDE_CODE_STELLAR_DRIFT:()=>awe,CLAUDE_CODE_SUBAGENT_CACHE_EVICT:()=>rCe,CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL:()=>mke,CLAUDE_CODE_SUPPRESS_SESSION_ATTRIBUTION:()=>oCe,CLAUDE_CODE_SYNC_PLUGINS:()=>iCe,CLAUDE_CODE_SYNC_PLUGIN_INSTALL:()=>sCe,CLAUDE_CODE_SYNC_SKILLS:()=>aCe,CLAUDE_CODE_TAG_ISMETA_MESSAGES:()=>cCe,CLAUDE_CODE_THINKING_DISPLAY_UPDATES:()=>sTe,CLAUDE_CODE_THISTLE_GREBE:()=>Xve,CLAUDE_CODE_THRIFTY_SONIC:()=>twe,CLAUDE_CODE_TOASTY_THIMBLE:()=>Qve,CLAUDE_CODE_TODO_REMINDER_MODE:()=>GAe,CLAUDE_CODE_TOTAL_TOKENS_REMINDER:()=>WAe,CLAUDE_CODE_TOTAL_TOKENS_REMINDER_AFTER_USER_TURN:()=>qAe,CLAUDE_CODE_TOTAL_TOKENS_REMINDER_BUDGET:()=>VAe,CLAUDE_CODE_TRANSCRIPT_LOCAL_GC:()=>lCe,CLAUDE_CODE_TURN_UPDATES:()=>eTe,CLAUDE_CODE_TWO_STAGE_CLASSIFIER:()=>uCe,CLAUDE_CODE_USE_COWORK_PLUGINS:()=>dCe,CLAUDE_CODE_USE_NATIVE_FILE_SEARCH:()=>pCe,CLAUDE_CODE_USE_POWERSHELL_TOOL:()=>fCe,CLAUDE_CODE_WALNUT_SPIRE:()=>mCe,CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS:()=>_Ce,CLAUDE_CODE_WEBFETCH_USE_CCR_PROXY:()=>yCe,CLAUDE_CODE_WEBSEARCH_USE_CCR_PROXY:()=>SCe,CLAUDE_CODE_WEB_FETCH_AGENT:()=>gCe,CLAUDE_CODE_WILLOW_TERN:()=>OAe,CLAUDE_CODE_WORKFLOWS:()=>uAe,CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS:()=>LCe,CLAUDE_CODE_WORKFLOW_SIZE_WARNING_AGENTS:()=>ICe,CLAUDE_CODE_WORKFLOW_SIZE_WARNING_TOKENS:()=>DCe,CLAUDE_DISABLE_ADOPT:()=>kCe,CLAUDE_IMPORT_CONVERSATIONS:()=>RCe,CLAUDE_RUNNER_DISABLE_AWAITING_ACTION_OVERRIDE:()=>OCe,CLAUDE_WORKFLOW_NAME_ONLY:()=>PCe,DISABLE_AUTOUPDATER:()=>MCe,DISABLE_AUTO_COMPACT:()=>NCe,DISABLE_BRIEF_MODE_STOP_HOOK:()=>UCe,DISABLE_BUG_COMMAND:()=>FCe,DISABLE_COST_WARNINGS:()=>$Ce,DISABLE_DOCTOR_COMMAND:()=>zCe,DISABLE_ERROR_REPORTING:()=>jCe,DISABLE_EXTRA_USAGE_COMMAND:()=>HCe,DISABLE_FEEDBACK_COMMAND:()=>BCe,DISABLE_GROWTHBOOK:()=>KCe,DISABLE_INSTALL_GITHUB_APP_COMMAND:()=>GCe,DISABLE_INTERLEAVED_THINKING:()=>WCe,DISABLE_LOGIN_COMMAND:()=>VCe,DISABLE_LOGOUT_COMMAND:()=>qCe,DISABLE_PROMPT_CACHING:()=>ZCe,DISABLE_PROMPT_CACHING_FABLE:()=>QCe,DISABLE_PROMPT_CACHING_HAIKU:()=>YCe,DISABLE_PROMPT_CACHING_MYTHOS:()=>eke,DISABLE_PROMPT_CACHING_OPUS:()=>JCe,DISABLE_PROMPT_CACHING_SONNET:()=>XCe,DISABLE_TELEMETRY:()=>tke,DISABLE_UPDATES:()=>nke,DISABLE_UPGRADE_COMMAND:()=>rke,EMBEDDED_SEARCH_TOOLS:()=>xke,ENABLE_BETA_TRACING_DETAILED:()=>oke,ENABLE_CLAUDEAI_MCP_SERVERS:()=>ske,ENABLE_ENHANCED_TELEMETRY_BETA:()=>ike,ENABLE_LOCKLESS_UPDATES:()=>ake,ENABLE_LSP_TOOL:()=>cke,ENABLE_MCP_LARGE_OUTPUT_FILES:()=>lke,ENABLE_PID_BASED_VERSION_LOCKING:()=>uke,ENABLE_PROMPT_CACHING_1H:()=>dke,ENABLE_PROMPT_CACHING_1H_BEDROCK:()=>pke,ENABLE_SESSION_BACKGROUNDING:()=>hke,ENABLE_SESSION_PERSISTENCE:()=>gke,ENABLE_TOOL_SEARCH:()=>_ke,FORCE_AUTOUPDATE_PLUGINS:()=>yke,FORCE_CODE_TERMINAL:()=>Ske,FORCE_PROMPT_CACHING_5M:()=>bke,FORCE_VCR:()=>Eke,INK_SCREEN_READER:()=>Yve,USE_API_CONTEXT_MANAGEMENT:()=>vke});var ku=["5m","1h"];var Wve=d.triBool(),Vve=d.int({min:0}),qve=d.int({min:0}),Zve=d.triBool(),Yve=d.bool(),Jve=d.bool(),Xve=d.str(),Qve=d.str(),ewe=d.str(),twe=d.triBool(),nwe=d.bool(),rwe=d.str(),owe=d.triBool(),swe=d.triBool(),iwe=d.triBool(),awe=d.triBool(),cwe=d.bool(),lwe=d.bool(),uwe=d.bool(),dwe=d.bool(),pwe=d.bool(),fwe=d.bool(),mwe=d.bool(),hwe=d.bool(),gwe=d.bool(),_we=d.bool(),ywe=d.bool(),Swe=d.bool(),bwe=d.bool(),Ewe=d.bool(),xwe=d.bool(),vwe=d.bool(),wwe=d.bool(),Awe=d.bool(),Twe=d.bool(),Cwe=d.bool(),kwe=d.bool(),Rwe=d.bool(),Owe=d.bool(),Pwe=d.bool(),Iwe=d.bool(),Dwe=d.bool(),Lwe=d.bool(),Nwe=d.bool(),Mwe=d.triBool(),Uwe=d.bool(),Fwe=d.bool(),$we=d.bool(),zwe=d.bool(),jwe=d.bool(),Hwe=d.bool(),Bwe=d.bool(),Kwe=d.enum(["corroborate","immediate","never"]),Gwe=d.triBool(),Wwe=d.triBool(),Vwe=d.bool(),qwe=d.bool(),Zwe=d.bool(),Ywe=d.bool(),Jwe=d.bool(),Xwe=d.bool(),Qwe=d.bool(),eAe=d.bool(),tAe=d.bool(),nAe=d.bool(),rAe=d.triBool(),oAe=d.bool(),sAe=d.bool(),iAe=d.triBool(),aAe=d.bool(),cAe=d.bool(),lAe=d.bool(),uAe=d.triBool(),dAe=d.bool(),pAe=d.bool(),fAe=d.bool(),mAe=d.triBool(),hAe=d.bool(),gAe=d.bool(),_Ae=d.bool(),yAe=d.triBool(),SAe=d.bool(),bAe=d.bool(),EAe=d.bool(),xAe=d.bool(),vAe=d.triBool(),wAe=d.bool(),AAe=d.triBool(),TAe=d.bool(),CAe=d.bool(),kAe=d.bool(),RAe=d.bool(),OAe=d.bool(),PAe=d.int({min:1,digitsOnly:!0}),IAe=d.triBool(),DAe=d.bool(),LAe=d.triBool(),NAe=d.triBool(),MAe=d.bool(),UAe=d.triBool(),FAe=d.bool(),$Ae=d.bool(),zAe=d.bool(),jAe=d.str(),HAe=d.bool(),BAe=d.bool(),KAe=d.bool(),GAe=d.enum(["baseline","off"]),WAe=d.str(),VAe=d.int(),qAe=d.triBool(),ZAe=d.bool(),YAe=d.bool(),JAe=d.triBool(),XAe=d.triBool(),QAe=d.triBool(),eTe=d.triBool(),tTe=d.triBool(),nTe=d.int({min:1}),rTe=d.str(),oTe=d.triBool(),sTe=d.triBool(),iTe=d.triBool(),aTe=d.triBool(),cTe=d.triBool(),lTe=d.triBool(),uTe=d.triBool(),dTe=d.triBool(),pTe=d.triBool(),fTe=d.triBool(),mTe=d.triBool(),hTe=d.triBool(),gTe=d.triBool(),_Te=d.triBool(),yTe=d.triBool(),STe=d.triBool(),bTe=d.triBool(),ETe=d.triBool(),xTe=d.triBool(),vTe=d.triBool(),wTe=d.triBool(),ATe=d.bool(),TTe=d.bool(),CTe=d.triBool(),kTe=d.bool(),RTe=d.bool(),OTe=d.bool(),PTe=d.bool(),ITe=d.triBool(),DTe=d.bool(),LTe=d.bool(),NTe=d.bool(),MTe=d.bool(),UTe=d.bool(),FTe=d.bool(),$Te=d.str(),zTe=d.bool(),jTe=d.bool(),HTe=d.bool(),BTe=d.bool(),KTe=d.bool(),GTe=d.bool(),WTe=d.triBool(),VTe=d.bool(),qTe=d.bool(),ZTe=d.bool(),YTe=d.bool(),JTe=d.bool(),XTe=d.bool(),QTe=d.str(),eCe=d.bool(),tCe=d.bool(),nCe=d.bool(),rCe=d.bool(),oCe=d.bool(),sCe=d.bool(),iCe=d.bool(),aCe=d.bool(),cCe=d.bool(),lCe=d.triBool(),uCe=d.bool(),dCe=d.bool(),pCe=d.bool(),fCe=d.triBool(),mCe=d.bool(),hCe=d.bool(),gCe=d.triBool(),_Ce=d.int({min:1,digitsOnly:!0}),yCe=d.bool(),SCe=d.bool(),bCe=d.bool(),ECe=d.bool(),xCe=d.bool(),vCe=d.bool(),wCe=d.bool(),ACe=d.bool(),TCe=d.triBool(),CCe=d.triBool(),kCe=d.bool(),RCe=d.bool(),OCe=d.bool(),PCe=d.bool(),ICe=d.int({min:1}),DCe=d.int({min:1}),LCe=d.int({min:0}),NCe=d.bool(),MCe=d.bool(),UCe=d.bool(),FCe=d.bool(),$Ce=d.bool(),zCe=d.bool(),jCe=d.bool(),HCe=d.bool(),BCe=d.bool(),KCe=d.bool(),GCe=d.bool(),WCe=d.bool(),VCe=d.bool(),qCe=d.bool(),ZCe=d.bool(),YCe=d.bool(),JCe=d.bool(),XCe=d.bool(),QCe=d.bool(),eke=d.bool(),tke=d.bool(),nke=d.bool(),rke=d.bool(),oke=d.bool(),ske=d.triBool(),ike=d.bool(),ake=d.bool(),cke=d.bool(),lke=d.triBool(),uke=d.triBool(),dke=d.bool(),pke=d.bool(),fke=d.enum(ku),mke=d.enum(ku),hke=d.bool(),gke=d.bool(),_ke=d.str(),yke=d.bool(),Ske=d.bool(),bke=d.bool(),Eke=d.bool(),xke=d.bool(),vke=d.bool(),wke=d.bool();var FC={};on(FC,{ALACRITTY_LOG:()=>JRe,APPDATA:()=>tRe,APP_URL:()=>UPe,AWS_CA_BUNDLE:()=>yRe,AWS_EXECUTION_ENV:()=>APe,AWS_LAMBDA_FUNCTION_NAME:()=>wPe,AZURE_FUNCTIONS_ENVIRONMENT:()=>MPe,BASH_ENV:()=>kOe,BAT_THEME:()=>HPe,BROWSER:()=>Hke,BUILDKITE:()=>sPe,BUN_CHROME_PATH:()=>jPe,BUN_CONFIG_FILE:()=>POe,BUN_INSTALL:()=>zPe,CARGO_HOME:()=>MOe,CARGO_HTTP_CAINFO:()=>bRe,CF_PAGES:()=>xPe,CIRCLECI:()=>oPe,CLOUDSDK_CONFIG:()=>DPe,CLOUDSDK_CORE_CUSTOM_CA_CERTS_FILE:()=>gRe,CODER:()=>uPe,CODER_WORKSPACE_NAME:()=>dPe,CODESPACES:()=>lPe,COLORFGBG:()=>LRe,COLORTERM:()=>DRe,COMSPEC:()=>Dke,CONTAINER_SANDBOX_MOUNT_POINT:()=>Qke,CURL_CA_BUNDLE:()=>hRe,CURSOR_TRACE_ID:()=>hOe,ComSpec:()=>Nke,ConEmuANSI:()=>cOe,ConEmuPID:()=>lOe,ConEmuTask:()=>uOe,DAYTONA_WS_ID:()=>mPe,DEMO_VERSION:()=>qPe,DENO_CERT:()=>SRe,DENO_DEPLOYMENT_ID:()=>vPe,DISPLAY:()=>Bke,DOCKER_CONFIG:()=>DOe,DO_NOT_TRACK:()=>NRe,DYNO:()=>EPe,EDITOR:()=>zke,FORCE_COLOR:()=>IRe,GCLOUD_PROJECT:()=>kPe,GCM_INTERACTIVE:()=>vOe,GH_ENTERPRISE_TOKEN:()=>HOe,GH_HOST:()=>jOe,GH_TOKEN:()=>zOe,GITHUB_ACTIONS:()=>VOe,GITHUB_ACTION_INPUTS:()=>qOe,GITHUB_ACTION_PATH:()=>ZOe,GITHUB_ACTOR:()=>YOe,GITHUB_ACTOR_ID:()=>JOe,GITHUB_ENTERPRISE_TOKEN:()=>KOe,GITHUB_ENV:()=>GOe,GITHUB_EVENT_NAME:()=>XOe,GITHUB_EVENT_PATH:()=>QOe,GITHUB_REPOSITORY:()=>ePe,GITHUB_REPOSITORY_ID:()=>tPe,GITHUB_REPOSITORY_OWNER:()=>nPe,GITHUB_REPOSITORY_OWNER_ID:()=>rPe,GITHUB_TOKEN:()=>BOe,GITHUB_WORKSPACE:()=>WOe,GITLAB_CI:()=>iPe,GITPOD_WORKSPACE_ID:()=>pPe,GIT_ASKPASS:()=>xOe,GIT_CONFIG_COUNT:()=>wOe,GIT_CONFIG_GLOBAL:()=>AOe,GIT_CONFIG_NOSYSTEM:()=>TRe,GIT_CONFIG_SYSTEM:()=>TOe,GIT_SSH_COMMAND:()=>bOe,GIT_SSL_CAINFO:()=>ARe,GIT_SSL_CAPATH:()=>CRe,GIT_TERMINAL_PROMPT:()=>EOe,GNOME_TERMINAL_SERVICE:()=>ZRe,GNUPGHOME:()=>FOe,GOOGLE_APPLICATION_CREDENTIALS:()=>RPe,GOOGLE_CLOUD_PROJECT:()=>CPe,GOOGLE_CLOUD_WORKSTATIONS:()=>fPe,GRADLE_USER_HOME:()=>$Oe,GRPC_DEFAULT_SSL_ROOTS_FILE_PATH:()=>xRe,HEX_CACERTS_PATH:()=>wRe,HISTFILE:()=>lRe,HOME:()=>Ake,HTTPLIB2_CA_CERTS:()=>_Re,INTELLIJ_TERMINAL_COMMAND_BLOCKS:()=>dOe,INTELLIJ_TERMINAL_COMMAND_BLOCKS_REWORKED:()=>pOe,IS_DEMO:()=>VPe,IS_SANDBOX:()=>WPe,ITERM_SESSION_ID:()=>GRe,JAVA_HOME:()=>RRe,JAVA_TOOL_OPTIONS:()=>ORe,KITTY_WINDOW_ID:()=>WRe,KONSOLE_VERSION:()=>VRe,KUBECONFIG:()=>IOe,KUBERNETES_SERVICE_HOST:()=>$Pe,K_SERVICE:()=>TPe,LANG:()=>Gke,LC_ALL:()=>Wke,LC_TERMINAL:()=>$Re,LC_TIME:()=>Vke,LOCALAPPDATA:()=>nRe,MSYSTEM:()=>aOe,NETLIFY:()=>bPe,NIX_SSL_CERT_FILE:()=>vRe,NODE_EXTRA_CA_CERTS:()=>dRe,NODE_OPTIONS:()=>uRe,NO_COLOR:()=>PRe,NPM_CONFIG_GLOBALCONFIG:()=>OOe,NPM_CONFIG_USERCONFIG:()=>ROe,NoDefaultCurrentDirectoryInExePath:()=>$ke,P4PORT:()=>BPe,PATH:()=>Tke,PATHEXT:()=>Fke,PIP_CERT:()=>ERe,PIP_CONFIG_FILE:()=>LOe,PLAYWRIGHT_BROWSERS_PATH:()=>KPe,PREFIX:()=>kke,PROJECT_DOMAIN:()=>_Pe,PWD:()=>Cke,PYTHONSTARTUP:()=>NOe,ProgramFiles:()=>Uke,RENDER:()=>SPe,REPL_ID:()=>hPe,REPL_SLUG:()=>gPe,REQUESTS_CA_BUNDLE:()=>mRe,RUNNER_ENVIRONMENT:()=>cPe,RUNNER_OS:()=>aPe,RUSTUP_HOME:()=>UOe,SAFEUSER:()=>rRe,SESSIONNAME:()=>QRe,SHELL:()=>Ike,SPACE_CREATOR_USER_ID:()=>FPe,SSH_AUTH_SOCK:()=>SOe,SSH_CLIENT:()=>gOe,SSH_CONNECTION:()=>_Oe,SSH_TTY:()=>yOe,SSL_CERT_DIR:()=>fRe,SSL_CERT_FILE:()=>pRe,STY:()=>eOe,SUDO_GID:()=>Yke,SUDO_UID:()=>Zke,SUDO_USER:()=>Jke,SYSTEMROOT:()=>Lke,SystemRoot:()=>Mke,TEMP:()=>Pke,TERM:()=>MRe,TERMINAL:()=>zRe,TERMINAL_EMULATOR:()=>jRe,TERMINATOR_UUID:()=>HRe,TERMUX_VERSION:()=>BRe,TERM_PROGRAM:()=>URe,TERM_PROGRAM_VERSION:()=>FRe,TILIX_ID:()=>KRe,TMP:()=>Oke,TMPDIR:()=>Rke,TMUX:()=>tOe,TMUX_PANE:()=>nOe,TRACEPARENT:()=>ZPe,TRACESTATE:()=>YPe,USER:()=>qke,USERNAME:()=>Xke,USERPROFILE:()=>eRe,USE_BUILTIN_RIPGREP:()=>GPe,UV_THREADPOOL_SIZE:()=>kRe,VERCEL:()=>yPe,VISUAL:()=>jke,VSCODE_GIT_ASKPASS_MAIN:()=>mOe,VTE_VERSION:()=>YRe,WAYLAND_DISPLAY:()=>Kke,WEBSITE_SITE_NAME:()=>LPe,WEBSITE_SKU:()=>NPe,WSL_DISTRO_NAME:()=>sOe,WSL_INTEROP:()=>iOe,WT_SESSION:()=>XRe,XDG_CACHE_HOME:()=>aRe,XDG_CONFIG_HOME:()=>sRe,XDG_DATA_HOME:()=>iRe,XDG_RUNTIME_DIR:()=>oRe,XDG_STATE_HOME:()=>cRe,XTERM_VERSION:()=>qRe,ZDOTDIR:()=>COe,ZED_TERM:()=>oOe,ZELLIJ:()=>rOe,__CFBundleIdentifier:()=>fOe,gcloud_project:()=>OPe,google_application_credentials:()=>IPe,google_cloud_project:()=>PPe});var Ake=d.str(),Tke=d.str(),Cke=d.str(),kke=d.str(),Rke=d.str(),Oke=d.str(),Pke=d.str(),Ike=d.str(),Dke=d.str(),Lke=d.str(),Nke=d.str(),Mke=d.str(),Uke=d.str(),Fke=d.str(),$ke=d.str(),zke=d.str(),jke=d.str(),Hke=d.str(),Bke=d.str(),Kke=d.str(),Gke=d.str(),Wke=d.str(),Vke=d.str(),qke=d.str(),Zke=d.int({min:0,digitsOnly:!0}),Yke=d.int({min:0,digitsOnly:!0}),Jke=d.str(),Xke=d.str(),Qke=d.str(),eRe=d.str(),tRe=d.str(),nRe=d.str(),rRe=d.str(),oRe=d.str(),sRe=d.str(),iRe=d.str(),aRe=d.str(),cRe=d.str(),lRe=d.str(),uRe=d.str(),dRe=d.str(),pRe=d.str(),fRe=d.str(),mRe=d.str(),hRe=d.str(),gRe=d.str(),_Re=d.str(),yRe=d.str(),SRe=d.str(),bRe=d.str(),ERe=d.str(),xRe=d.str(),vRe=d.str(),wRe=d.str(),ARe=d.str(),TRe=d.str(),CRe=d.str(),kRe=d.str(),RRe=d.str(),ORe=d.str(),PRe=d.rawStr(),IRe=d.rawStr(),DRe=d.str(),LRe=d.str(),NRe=d.str(),MRe=d.str(),URe=d.str(),FRe=d.str(),$Re=d.str(),zRe=d.str(),jRe=d.str(),HRe=d.str(),BRe=d.str(),KRe=d.str(),GRe=d.str(),WRe=d.str(),VRe=d.str(),qRe=d.str(),ZRe=d.str(),YRe=d.str(),JRe=d.str(),XRe=d.str(),QRe=d.str(),eOe=d.str(),tOe=d.str(),nOe=d.str(),rOe=d.str(),oOe=d.str(),sOe=d.str(),iOe=d.str(),aOe=d.str(),cOe=d.str(),lOe=d.str(),uOe=d.str(),dOe=d.str(),pOe=d.str(),fOe=d.str(),mOe=d.str(),hOe=d.rawStr(),gOe=d.str(),_Oe=d.str(),yOe=d.str(),SOe=d.str(),bOe=d.str(),EOe=d.str(),xOe=d.str(),vOe=d.str(),wOe=d.str(),AOe=d.str(),TOe=d.str(),COe=d.str(),kOe=d.str(),ROe=d.str(),OOe=d.str(),POe=d.str(),IOe=d.str(),DOe=d.str(),LOe=d.str(),NOe=d.str(),MOe=d.str(),UOe=d.str(),FOe=d.str(),$Oe=d.str(),zOe=d.str(),jOe=d.str(),HOe=d.str(),BOe=d.str(),KOe=d.str(),GOe=d.str(),WOe=d.str(),VOe=d.str(),qOe=d.rawStr(),ZOe=d.str(),YOe=d.str(),JOe=d.str(),XOe=d.str(),QOe=d.str(),ePe=d.str(),tPe=d.str(),nPe=d.str(),rPe=d.str(),oPe=d.str(),sPe=d.str(),iPe=d.str(),aPe=d.str(),cPe=d.str(),lPe=d.str(),uPe=d.str(),dPe=d.str(),pPe=d.str(),fPe=d.str(),mPe=d.str(),hPe=d.str(),gPe=d.str(),_Pe=d.str(),yPe=d.str(),SPe=d.str(),bPe=d.str(),EPe=d.str(),xPe=d.str(),vPe=d.str(),wPe=d.str(),APe=d.str(),TPe=d.str(),CPe=d.str(),kPe=d.str(),RPe=d.str(),OPe=d.str(),PPe=d.str(),IPe=d.str(),DPe=d.str(),LPe=d.str(),NPe=d.str(),MPe=d.str(),UPe=d.str(),FPe=d.str(),$Pe=d.str(),zPe=d.str(),jPe=d.str(),HPe=d.str(),BPe=d.str(),KPe=d.str(),GPe=d.str(),WPe=d.str(),VPe=d.str(),qPe=d.str(),ZPe=d.str(),YPe=d.str();var $C={};on($C,{AI_AGENT:()=>NLe,ALLOW_ANT_COMPUTER_USE_MCP:()=>MLe,ANTHROPIC_CONFIG_DIR:()=>JPe,BASH_MAX_OUTPUT_LENGTH:()=>Q0e,CLAUBBIT:()=>ULe,CLAUDECODE:()=>FLe,CLAUDE_AFK_COUNTDOWN_MS:()=>eNe,CLAUDE_AFK_TIMEOUT_MS:()=>tNe,CLAUDE_AFTER_LAST_COMPACT:()=>XPe,CLAUDE_AGENTS_SELECT:()=>QPe,CLAUDE_AGENT_SDK_CLIENT_APP:()=>eIe,CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS:()=>$Le,CLAUDE_AGENT_SDK_MCP_NO_PREFIX:()=>zLe,CLAUDE_AGENT_SDK_VERSION:()=>tIe,CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS:()=>nNe,CLAUDE_AUTOCOMPACT_PCT_OVERRIDE:()=>nIe,CLAUDE_AUTO_BACKGROUND_TASKS:()=>jLe,CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR:()=>HLe,CLAUDE_BG_AUTH_SNAPSHOT_PATH:()=>rIe,CLAUDE_BG_BACKEND:()=>oIe,CLAUDE_BG_CLAIM_AUTH:()=>sIe,CLAUDE_BG_DISPATCHER_RATE_LIMIT_TIER:()=>iIe,CLAUDE_BG_DISPATCHER_SUBSCRIPTION_TYPE:()=>aIe,CLAUDE_BG_ISOLATION:()=>cIe,CLAUDE_BG_MEMORY_TOGGLED_OFF:()=>lIe,CLAUDE_BG_POST_CLEAR_RESPAWN:()=>uIe,CLAUDE_BG_PTY_AUTH:()=>dIe,CLAUDE_BG_RENDEZVOUS_SOCK:()=>pIe,CLAUDE_BG_RV_AUTH:()=>fIe,CLAUDE_BG_SESSION_PERMISSION_RULES:()=>mIe,CLAUDE_BG_SOCKET_TOKENS_PATH:()=>hIe,CLAUDE_BG_SOURCE:()=>gIe,CLAUDE_BG_STARTUP_WEDGE_MS:()=>rNe,CLAUDE_BG_TCC_DISCLAIMED:()=>_Ie,CLAUDE_BRIDGE_BASE_URL:()=>yIe,CLAUDE_BRIDGE_OAUTH_TOKEN:()=>SIe,CLAUDE_BRIDGE_REATTACH_GROUPING:()=>bIe,CLAUDE_BRIDGE_REATTACH_NO_BACKFILL:()=>BLe,CLAUDE_BRIDGE_REATTACH_OUTBOUND_ONLY:()=>KLe,CLAUDE_BRIDGE_REATTACH_OWNER_ACCT:()=>EIe,CLAUDE_BRIDGE_REATTACH_OWNER_ORG:()=>xIe,CLAUDE_BRIDGE_REATTACH_SEQ:()=>oNe,CLAUDE_BRIDGE_REATTACH_SESSION:()=>vIe,CLAUDE_BRIDGE_SESSION_INGRESS_URL:()=>wIe,CLAUDE_CHROME_PERMISSION_MODE:()=>AIe,CLAUDE_CLIENT_PRESENCE_FILE:()=>TIe,CLAUDE_CODE_ACTION:()=>CIe,CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD:()=>kIe,CLAUDE_CODE_ADDITIONAL_PROTECTION:()=>GLe,CLAUDE_CODE_ADOPT_UNDERIVABLE_PARKED_PERMISSION:()=>O0e,CLAUDE_CODE_AGENT:()=>RIe,CLAUDE_CODE_ARTIFACT:()=>OIe,CLAUDE_CODE_ARTIFACTS_API_BASE_URL:()=>IIe,CLAUDE_CODE_ARTIFACTS_API_TOKEN:()=>DIe,CLAUDE_CODE_ARTIFACT_ASSET_BASE_URL:()=>LIe,CLAUDE_CODE_ARTIFACT_AUTO_OPEN:()=>PIe,CLAUDE_CODE_ARTIFACT_LIVE_BASE_URL:()=>NIe,CLAUDE_CODE_ARTIFACT_SYNC_BASE_URL:()=>MIe,CLAUDE_CODE_ARTIFACT_VIEWER_BASE_URL:()=>UIe,CLAUDE_CODE_AUTO_BACKGROUND_WORKER_CHECKIN_SECONDS:()=>sNe,CLAUDE_CODE_AUTO_COMPACT_WINDOW:()=>FIe,CLAUDE_CODE_AUTO_MODE_EXTERNAL_PERMISSIONS:()=>WLe,CLAUDE_CODE_BASE_REF:()=>$Ie,CLAUDE_CODE_BASE_REFS:()=>zIe,CLAUDE_CODE_BLOCKING_LIMIT_OVERRIDE:()=>jIe,CLAUDE_CODE_BRIDGE_MCP_CARRIER:()=>HIe,CLAUDE_CODE_BRIDGE_OWNER_ACCOUNT_UUID:()=>BIe,CLAUDE_CODE_BRIDGE_OWNER_ORG_UUID:()=>KIe,CLAUDE_CODE_BRIDGE_PROMPT_SHA256:()=>GIe,CLAUDE_CODE_BRIDGE_SESSION_ID:()=>WIe,CLAUDE_CODE_BRIEF:()=>VLe,CLAUDE_CODE_BRIEF_UPLOAD:()=>qLe,CLAUDE_CODE_CCR_SURFACE:()=>w0e,CLAUDE_CODE_CLASSIFIER_SUMMARY:()=>VIe,CLAUDE_CODE_CONTAINER_ID:()=>qIe,CLAUDE_CODE_COORDINATOR_WORKER_CHECKIN_SECONDS:()=>iNe,CLAUDE_CODE_DAEMON_COLD_START:()=>ZLe,CLAUDE_CODE_DECSTBM:()=>ZIe,CLAUDE_CODE_DEV_RAW_CHANGELOG_URL:()=>YIe,CLAUDE_CODE_DIR_SYNC_DISABLE_ANCHORING:()=>JIe,CLAUDE_CODE_DIR_SYNC_ENGINE:()=>tDe,CLAUDE_CODE_DIR_SYNC_FFWD:()=>nDe,CLAUDE_CODE_DIR_SYNC_GIT:()=>eDe,CLAUDE_CODE_DIR_SYNC_STREAM:()=>rDe,CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP:()=>YLe,CLAUDE_CODE_DISABLE_DIR_SYNC:()=>QIe,CLAUDE_CODE_DISABLE_HOOK_FORWARDING:()=>oDe,CLAUDE_CODE_DISABLE_PLUGIN_FORWARDING:()=>sDe,CLAUDE_CODE_DISABLE_VITALS_EMITTER:()=>iDe,CLAUDE_CODE_DISABLE_WORKING_SYNC:()=>aDe,CLAUDE_CODE_DONT_INHERIT_ENV:()=>JLe,CLAUDE_CODE_DOWNLOAD_DEADLINE_MS_FOR_TESTING:()=>cDe,CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS:()=>XLe,CLAUDE_CODE_EMIT_TOOL_USE_SUMMARIES:()=>QLe,CLAUDE_CODE_ENTRYPOINT:()=>lDe,CLAUDE_CODE_ENVIRONMENT_KIND:()=>uDe,CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION:()=>dDe,CLAUDE_CODE_EVAL_CONFINED:()=>S0e,CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER:()=>e0e,CLAUDE_CODE_EXIT_AFTER_STOP_DELAY:()=>aNe,CLAUDE_CODE_FORCE_BRIDGE:()=>t0e,CLAUDE_CODE_FORCE_EVALUATE_MEMORY:()=>n0e,CLAUDE_CODE_FORCE_FULLSCREEN_UPSELL:()=>r0e,CLAUDE_CODE_FORCE_MEMORY_SURVEY:()=>o0e,CLAUDE_CODE_FORCE_TIP_ID:()=>pDe,CLAUDE_CODE_GIT_BASH_PATH:()=>fDe,CLAUDE_CODE_GLOB_TIMEOUT_SECONDS:()=>cNe,CLAUDE_CODE_GOAL_CHECKIN_MINUTES:()=>lNe,CLAUDE_CODE_HIDE_SETTINGS_HINT:()=>mDe,CLAUDE_CODE_HOLD_REPORT_PARK_AT_INIT:()=>D0e,CLAUDE_CODE_HOLD_UNANSWERED_PARKED_PERMISSION:()=>R0e,CLAUDE_CODE_HOME_SEED_HOLD_TIMEOUT_MS:()=>hDe,CLAUDE_CODE_HOME_SEED_VERDICT_TIMEOUT_MS:()=>gDe,CLAUDE_CODE_HOST_PLATFORM:()=>_De,CLAUDE_CODE_IDE_HOST_OVERRIDE:()=>yDe,CLAUDE_CODE_IDLE_THRESHOLD_MINUTES:()=>uNe,CLAUDE_CODE_IDLE_TOKEN_THRESHOLD:()=>dNe,CLAUDE_CODE_IS_COWORK:()=>s0e,CLAUDE_CODE_LEGACY_BUNDLE:()=>XIe,CLAUDE_CODE_LOOP_KEEPALIVE:()=>i0e,CLAUDE_CODE_LOOP_PERSISTENT:()=>a0e,CLAUDE_CODE_MANAGED_SETTINGS_PATH:()=>SDe,CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS:()=>pNe,CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH:()=>fNe,CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION:()=>mNe,CLAUDE_CODE_MCP_ALLOWLIST_ENV:()=>bDe,CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS:()=>QNe,CLAUDE_CODE_MCP_MEMORY_CGROUP:()=>K0e,CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT:()=>XNe,CLAUDE_CODE_MOCK_REMOTE_SETTINGS:()=>c0e,CLAUDE_CODE_MOCK_TRIAL:()=>l0e,CLAUDE_CODE_OVERRIDE_DATE:()=>EDe,CLAUDE_CODE_PARKED_PERMISSION_WAIT_MS:()=>C0e,CLAUDE_CODE_PARKED_STOP_RETIRES:()=>I0e,CLAUDE_CODE_PERFORCE_MODE:()=>xDe,CLAUDE_CODE_PLAN_V2_AGENT_COUNT:()=>hNe,CLAUDE_CODE_PLAN_V2_EXPLORE_AGENT_COUNT:()=>gNe,CLAUDE_CODE_PLUGIN_ATTRIBUTION:()=>vDe,CLAUDE_CODE_PLUGIN_CACHE_DIR:()=>wDe,CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS:()=>_Ne,CLAUDE_CODE_PLUGIN_SEED_DIR:()=>ADe,CLAUDE_CODE_POWERUP_ONBOARDING:()=>TDe,CLAUDE_CODE_PROJECT_DIR_NAME:()=>CDe,CLAUDE_CODE_PWSH_PARSE_TIMEOUT_MS:()=>yNe,CLAUDE_CODE_QUESTION_PREVIEW_FORMAT:()=>kDe,CLAUDE_CODE_RELAUNCH_TERMINAL_SIZE:()=>RDe,CLAUDE_CODE_REMOTE:()=>u0e,CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE:()=>ODe,CLAUDE_CODE_REMOTE_HERMETIC_MODE:()=>d0e,CLAUDE_CODE_REMOTE_MEMORY_DIR:()=>PDe,CLAUDE_CODE_REMOTE_RAW_EVENTS_FILE:()=>IDe,CLAUDE_CODE_REMOTE_SEND_KEEPALIVES:()=>p0e,CLAUDE_CODE_REMOTE_SESSION_ID:()=>DDe,CLAUDE_CODE_REMOTE_SESSION_ORIGIN:()=>LDe,CLAUDE_CODE_REMOTE_SETTINGS_PATH:()=>NDe,CLAUDE_CODE_REMOTE_SETTINGS_POLL_MS:()=>SNe,CLAUDE_CODE_REPL:()=>f0e,CLAUDE_CODE_REPO_CHECKOUTS:()=>MDe,CLAUDE_CODE_RESTRICTED:()=>m0e,CLAUDE_CODE_RESUME_FROM_SESSION:()=>UDe,CLAUDE_CODE_RESUME_INTERRUPTED_TURN:()=>h0e,CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS:()=>_0e,CLAUDE_CODE_RESUME_PROMPT:()=>FDe,CLAUDE_CODE_RESUME_SOURCE_ALIVE:()=>g0e,CLAUDE_CODE_RESUME_THRESHOLD_MINUTES:()=>bNe,CLAUDE_CODE_RESUME_TOKEN_THRESHOLD:()=>ENe,CLAUDE_CODE_RESUME_TOLERATES_CONTEXT_APPENDS:()=>P0e,CLAUDE_CODE_RETIRE_UNANSWERED_PARKED_PERMISSION:()=>k0e,CLAUDE_CODE_SAFE_MODE:()=>y0e,CLAUDE_CODE_SANDBOXED:()=>b0e,CLAUDE_CODE_SCRIPT_CAPS:()=>xNe,CLAUDE_CODE_SCROLL_SPEED:()=>$De,CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS:()=>vNe,CLAUDE_CODE_SESSION_ID:()=>zDe,CLAUDE_CODE_SESSION_KIND:()=>jDe,CLAUDE_CODE_SESSION_NAME:()=>HDe,CLAUDE_CODE_SHELL:()=>BDe,CLAUDE_CODE_SHELL_PREFIX:()=>KDe,CLAUDE_CODE_SIMPLE:()=>E0e,CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT:()=>GDe,CLAUDE_CODE_SPAWN_TIMESTAMP_MS:()=>wNe,CLAUDE_CODE_SSE_PORT:()=>ANe,CLAUDE_CODE_STALL_TIMEOUT_MS_FOR_TESTING:()=>WDe,CLAUDE_CODE_STOP_HOOK_BLOCK_CAP:()=>TNe,CLAUDE_CODE_SUBPROCESS_ENV_SCRUB:()=>x0e,CLAUDE_CODE_SUPERVISED:()=>v0e,CLAUDE_CODE_SYNC_PLUGINS_BUFFERED_DOWNLOAD:()=>A0e,CLAUDE_CODE_SYNC_PLUGINS_DOWNLOAD_STALL_MS:()=>T0e,CLAUDE_CODE_SYNC_PLUGINS_INSTALL_TIMEOUT_MS:()=>kNe,CLAUDE_CODE_SYNC_PLUGINS_MCP_TIMEOUT_MS:()=>RNe,CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS:()=>CNe,CLAUDE_CODE_SYNC_SESSION_REFS:()=>L0e,CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS:()=>ONe,CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS:()=>PNe,CLAUDE_CODE_SYNTAX_HIGHLIGHT:()=>N0e,CLAUDE_CODE_SYSTEM_PROMPT_GB_FEATURE:()=>VDe,CLAUDE_CODE_TAGS:()=>qDe,CLAUDE_CODE_TASK_LIST_ID:()=>YDe,CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS:()=>INe,CLAUDE_CODE_TERMINAL_MCP_TOOLS:()=>ZDe,CLAUDE_CODE_TEST_ALLOW_REAL_NETWORK:()=>M0e,CLAUDE_CODE_TEST_FIXTURES_ROOT:()=>JDe,CLAUDE_CODE_TEST_FORCE_DENY:()=>U0e,CLAUDE_CODE_TEST_NO_GIT_BASH:()=>F0e,CLAUDE_CODE_TEST_NO_PWSH:()=>$0e,CLAUDE_CODE_TMPDIR:()=>XDe,CLAUDE_CODE_TMUX_PREFIX:()=>QDe,CLAUDE_CODE_TMUX_PREFIX_CONFLICTS:()=>z0e,CLAUDE_CODE_TMUX_SESSION:()=>eLe,CLAUDE_CODE_TMUX_TRUECOLOR:()=>j0e,CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE:()=>H0e,CLAUDE_CODE_TOOL_MEMORY_LIMIT:()=>B0e,CLAUDE_CODE_TRIGGER_ID:()=>tLe,CLAUDE_CODE_TUI_JUST_SWITCHED:()=>G0e,CLAUDE_CODE_TUI_TRIAL:()=>W0e,CLAUDE_CODE_ULTRAREVIEW_PREFLIGHT_FIXTURE:()=>nLe,CLAUDE_CODE_ULTRAREVIEW_QUOTA_FIXTURE:()=>rLe,CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS:()=>DNe,CLAUDE_CODE_VOICE_FORWARD_INTERIMS_TYPED:()=>V0e,CLAUDE_CODE_WORKER_EPOCH:()=>LNe,CLAUDE_CODE_WORKSPACE_HOST_PATHS:()=>oLe,CLAUDE_CONFIG_DIR:()=>sLe,CLAUDE_COWORK_MEMORY_EXTRA_GUIDELINES:()=>iLe,CLAUDE_COWORK_MEMORY_GUIDELINES:()=>aLe,CLAUDE_COWORK_MEMORY_INDEX_CONTENT:()=>cLe,CLAUDE_COWORK_MEMORY_PATH_OVERRIDE:()=>lLe,CLAUDE_ENV_FILE:()=>uLe,CLAUDE_FORCE_DISPLAY_SURVEY:()=>q0e,CLAUDE_INTERNAL_ASSISTANT_TEAM_NAME:()=>dLe,CLAUDE_INTERNAL_FC_OVERRIDES:()=>pLe,CLAUDE_JOB_DIR:()=>fLe,CLAUDE_MEMORY_STORES:()=>mLe,CLAUDE_PROJECT_UUID:()=>hLe,CLAUDE_PTY_HEARTBEAT_MS:()=>NNe,CLAUDE_PTY_HOST_EXEC:()=>gLe,CLAUDE_PTY_ORPHAN_CHECK_MS:()=>MNe,CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX:()=>_Le,CLAUDE_REMOTE_WORKFLOW_ARGS:()=>yLe,CLAUDE_REMOTE_WORKFLOW_SCRIPT:()=>SLe,CLAUDE_REPL_VARIANT:()=>bLe,CLAUDE_RUNNER_ACTIVITY_FD:()=>UNe,CLAUDE_RUNNER_FETCH_DEPTH:()=>ELe,CLAUDE_SECURESTORAGE_CONFIG_DIR:()=>xLe,CLAUDE_SERVE_DRAIN_TIMEOUT_MS:()=>FNe,CLAUDE_SNIP:()=>vLe,CLAUDE_SSH_LOCAL_BINARY:()=>wLe,CLAUDE_SSH_VERSION:()=>ALe,CLAUDE_STAGE_FILE_ROOT:()=>TLe,CLAUDE_SUBAGENT_BG_SHELL_MAX_MS:()=>$Ne,CLAUDE_TMPDIR:()=>CLe,LOCAL_BRIDGE:()=>Z0e,MCP_CONNECTION_NONBLOCKING:()=>Y0e,MCP_CONNECT_TIMEOUT_MS:()=>zNe,MCP_DISCOVERY_CACHE:()=>jNe,MCP_DISCOVERY_CACHE_MAX_STALE_S:()=>HNe,MCP_DISCOVERY_CACHE_STRIKES:()=>BNe,MCP_DISCOVERY_CACHE_TTL_S:()=>KNe,MCP_OAUTH_CALLBACK_PORT:()=>GNe,MCP_OAUTH_CLIENT_METADATA_URL:()=>kLe,MCP_PROTOCOL_NEGOTIATION:()=>WNe,MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE:()=>VNe,MCP_SDK_GENERATION:()=>ZNe,MCP_SERVER_CONNECTION_BATCH_SIZE:()=>qNe,MCP_TIMEOUT:()=>YNe,MCP_TOOL_TIMEOUT:()=>JNe,MCP_TRUNCATION_PROMPT_OVERRIDE:()=>RLe,SDK_NATIVE_BIN:()=>OLe,SESSION_INGRESS_URL:()=>PLe,SLASH_COMMAND_TOOL_CHAR_BUDGET:()=>eMe,TASK_MAX_OUTPUT_LENGTH:()=>tMe,TEST_ENABLE_SESSION_PERSISTENCE:()=>J0e,ULTRAPLAN_PROMPT_FILE:()=>ILe,VCR_RECORD:()=>X0e,VITALS_EMITTER_BIN:()=>DLe,VOICE_STREAM_BASE_URL:()=>LLe});var JPe=d.str(),XPe=d.str(),QPe=d.str(),eIe=d.str(),tIe=d.str(),nIe=d.str(),rIe=d.str(),oIe=d.str(),sIe=d.str(),iIe=d.str(),aIe=d.str(),cIe=d.str(),lIe=d.str(),uIe=d.bool(),dIe=d.str(),pIe=d.str(),fIe=d.str(),mIe=d.str(),hIe=d.str(),gIe=d.str(),_Ie=d.str(),yIe=d.str(),SIe=d.str(),bIe=d.str(),EIe=d.str(),xIe=d.str(),vIe=d.str(),wIe=d.str(),AIe=d.str(),TIe=d.str(),CIe=d.str(),kIe=d.str(),RIe=d.str(),OIe=d.str(),PIe=d.str(),IIe=d.str(),DIe=d.str(),LIe=d.str(),NIe=d.str(),MIe=d.str(),UIe=d.str(),FIe=d.str(),$Ie=d.str(),zIe=d.str(),jIe=d.str(),HIe=d.enum(["1","spent"]),BIe=d.str(),KIe=d.str(),GIe=d.str(),WIe=d.str(),VIe=d.str(),qIe=d.str(),ZIe=d.str(),YIe=d.str(),JIe=d.bool(),XIe=d.bool(),QIe=d.bool(),eDe=d.bool(),tDe=d.str(),nDe=d.str(),rDe=d.str(),oDe=d.bool(),sDe=d.bool(),iDe=d.bool(),aDe=d.bool(),cDe=d.str(),lDe=d.str(),uDe=d.str(),dDe=d.str(),pDe=d.str(),fDe=d.str(),mDe=d.str(),hDe=d.int({min:0}),gDe=d.int({min:0}),_De=d.str(),yDe=d.str(),SDe=d.str(),bDe=d.str(),EDe=d.str(),xDe=d.str(),vDe=d.str(),wDe=d.str(),ADe=d.str(),TDe=d.str(),CDe=d.str(),kDe=d.str(),RDe=d.str(),ODe=d.str(),PDe=d.str(),IDe=d.str(),DDe=d.str(),LDe=d.str(),NDe=d.str(),MDe=d.str(),UDe=d.str(),FDe=d.str(),$De=d.str(),zDe=d.str(),jDe=d.str(),HDe=d.str(),BDe=d.str(),KDe=d.str(),GDe=d.str(),WDe=d.str(),VDe=d.str(),qDe=d.str(),ZDe=d.str(),YDe=d.str(),JDe=d.str(),XDe=d.str(),QDe=d.str(),eLe=d.str(),tLe=d.str(),nLe=d.str(),rLe=d.str(),oLe=d.str(),sLe=d.str(),iLe=d.str(),aLe=d.str(),cLe=d.str(),lLe=d.str(),uLe=d.str(),dLe=d.str(),pLe=d.str(),fLe=d.str(),mLe=d.str(),hLe=d.str(),gLe=d.str(),_Le=d.str(),yLe=d.str(),SLe=d.str(),bLe=d.str(),ELe=d.str(),xLe=d.str(),vLe=d.str(),wLe=d.str(),ALe=d.str(),TLe=d.str(),CLe=d.str(),kLe=d.str(),RLe=d.str(),OLe=d.str(),PLe=d.str(),ILe=d.str(),DLe=d.str(),LLe=d.str(),NLe=d.bool(),MLe=d.bool(),ULe=d.bool(),FLe=d.bool(),$Le=d.bool(),zLe=d.bool(),jLe=d.bool(),HLe=d.bool(),BLe=d.bool(),KLe=d.bool(),GLe=d.bool(),WLe=d.bool(),VLe=d.bool(),qLe=d.bool(),ZLe=d.bool(),YLe=d.bool(),JLe=d.bool(),XLe=d.bool(),QLe=d.bool(),e0e=d.bool(),t0e=d.bool(),n0e=d.bool(),r0e=d.bool(),o0e=d.bool(),s0e=d.bool(),i0e=d.triBool(),a0e=d.bool(),c0e=d.str(),l0e=d.bool(),u0e=d.bool(),d0e=d.bool(),p0e=d.bool(),f0e=d.triBool(),m0e=d.bool(),h0e=d.bool(),g0e=d.str(),_0e=d.str(),y0e=d.bool(),S0e=d.bool(),b0e=d.bool(),E0e=d.bool(),x0e=d.triBool(),v0e=d.bool(),w0e=d.str(),A0e=d.bool(),T0e=d.int({min:1}),C0e=d.int({min:0}),k0e=d.bool(),R0e=d.bool(),O0e=d.bool(),P0e=d.bool(),I0e=d.bool(),D0e=d.bool(),L0e=d.bool(),N0e=d.str(),M0e=d.bool(),U0e=d.rawStr(),F0e=d.str(),$0e=d.str(),z0e=d.bool(),j0e=d.rawStr(),H0e=d.str(),B0e=d.str(),K0e=d.str(),G0e=d.str(),W0e=d.str(),V0e=d.bool(),q0e=d.bool(),Z0e=d.bool(),Y0e=d.triBool(),J0e=d.bool(),X0e=d.bool(),Q0e=d.int(),eNe=d.int(),tNe=d.int(),nNe=d.int({min:1,max:2147483647,digitsOnly:!0}),rNe=d.int(),oNe=d.int(),sNe=d.int({min:1,max:86400,digitsOnly:!0}),iNe=d.int({min:1,max:86400,digitsOnly:!0}),aNe=d.int(),cNe=d.int({min:1}),lNe=d.int({min:0,max:10080,digitsOnly:!0}),uNe=d.int(),dNe=d.int(),pNe=d.int({min:1,digitsOnly:!0}),fNe=d.int({min:1,digitsOnly:!0}),mNe=d.int({min:1,digitsOnly:!0}),hNe=d.int(),gNe=d.int(),_Ne=d.int(),yNe=d.int(),SNe=d.int(),bNe=d.int(),ENe=d.int(),xNe=d.int(),vNe=d.int(),wNe=d.int(),ANe=d.int(),TNe=d.int(),CNe=d.int({min:1}),kNe=d.int({min:1}),RNe=d.int({min:0}),ONe=d.int(),PNe=d.int(),INe=d.int({min:1000,max:60000}),DNe=d.int(),LNe=d.int(),NNe=d.int({min:1}),MNe=d.int({min:1}),UNe=d.int({min:3}),FNe=d.int({min:1}),$Ne=d.int({min:1}),zNe=d.int(),jNe=d.triBool(),HNe=d.int({min:1}),BNe=d.int({min:1}),KNe=d.int({min:1}),GNe=d.int({min:1}),WNe=d.str(),VNe=d.int({min:1}),qNe=d.int({min:1}),ZNe=d.str(),YNe=d.int(),JNe=d.int({min:1}),XNe=d.int(),QNe=d.int(),eMe=d.int({min:1}),tMe=d.int();var zC={};on(zC,{ANTHROPIC_CUSTOM_MODEL_OPTION:()=>SMe,ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION:()=>EMe,ANTHROPIC_CUSTOM_MODEL_OPTION_NAME:()=>bMe,ANTHROPIC_DEFAULT_FABLE_MODEL:()=>sMe,ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION:()=>aMe,ANTHROPIC_DEFAULT_FABLE_MODEL_NAME:()=>iMe,ANTHROPIC_DEFAULT_HAIKU_MODEL:()=>mMe,ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION:()=>gMe,ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME:()=>hMe,ANTHROPIC_DEFAULT_MODEL:()=>rMe,ANTHROPIC_DEFAULT_OPUS_MODEL:()=>cMe,ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION:()=>uMe,ANTHROPIC_DEFAULT_OPUS_MODEL_NAME:()=>lMe,ANTHROPIC_DEFAULT_SONNET_MODEL:()=>dMe,ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION:()=>fMe,ANTHROPIC_DEFAULT_SONNET_MODEL_NAME:()=>pMe,ANTHROPIC_MODEL:()=>nMe,ANTHROPIC_SMALL_FAST_MODEL:()=>oMe,CLAUDE_CODE_3P_PROBE_WROTE_OPUS_DEFAULT:()=>yMe,CLAUDE_CODE_3P_PROBE_WROTE_SONNET_DEFAULT:()=>_Me,CLAUDE_CODE_ALWAYS_ENABLE_EFFORT:()=>DMe,CLAUDE_CODE_AUTO_MODE_MODEL:()=>wMe,CLAUDE_CODE_BG_CLASSIFIER_MODEL:()=>AMe,CLAUDE_CODE_DISABLE_1M_CONTEXT:()=>UMe,CLAUDE_CODE_DISABLE_EXPLORE_INHERIT_CAP:()=>OMe,CLAUDE_CODE_DISABLE_FAST_MODE:()=>LMe,CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP:()=>PMe,CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT:()=>FMe,CLAUDE_CODE_EFFORT_LEVEL:()=>IMe,CLAUDE_CODE_MODEL_CATALOG:()=>$Me,CLAUDE_CODE_MODEL_CATALOG_URL:()=>zMe,CLAUDE_CODE_NO_MODEL_FALLBACK:()=>RMe,CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS:()=>NMe,CLAUDE_CODE_SKIP_FAST_MODE_ORG_CHECK:()=>MMe,CLAUDE_CODE_SUBAGENT_MODEL:()=>xMe,CLAUDE_CODE_SUBAGENT_MODEL_FORCE:()=>vMe,CLAUDE_CONTEXT_COLLAPSE:()=>CMe,CLAUDE_CONTEXT_COLLAPSE_MODEL:()=>TMe,FALLBACK_FOR_ALL_PRIMARY_MODELS:()=>kMe});var nMe=d.str(),rMe=d.str(),oMe=d.str(),sMe=d.str(),iMe=d.str(),aMe=d.str(),cMe=d.str(),lMe=d.str(),uMe=d.str(),dMe=d.str(),pMe=d.str(),fMe=d.str(),mMe=d.str(),hMe=d.str(),gMe=d.str(),_Me=d.str(),yMe=d.str(),SMe=d.str(),bMe=d.str(),EMe=d.str(),xMe=d.str(),vMe=d.bool(),wMe=d.str(),AMe=d.str(),TMe=d.str(),CMe=d.bool(),kMe=d.str(),RMe=d.bool(),OMe=d.bool(),PMe=d.bool(),IMe=d.str(),DMe=d.bool(),LMe=d.bool(),NMe=d.bool(),MMe=d.bool(),UMe=d.bool(),FMe=d.bool(),$Me=d.str(),zMe=d.str();var jC={};on(jC,{ALL_PROXY:()=>VMe,ANTHROPIC_BETAS:()=>eUe,ANTHROPIC_CUSTOM_HEADERS:()=>tUe,API_FORCE_IDLE_TIMEOUT:()=>hUe,API_TIMEOUT_MS:()=>mUe,CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS:()=>xUe,CLAUDE_CODE_ATTRIBUTION_HEADER:()=>oUe,CLAUDE_CODE_CERT_STORE:()=>QMe,CLAUDE_CODE_CLIENT_CERT:()=>ZMe,CLAUDE_CODE_CLIENT_KEY:()=>YMe,CLAUDE_CODE_CLIENT_KEY_PASSPHRASE:()=>JMe,CLAUDE_CODE_DISABLE_MTLS_RELOAD_ON_STALE_CONNECTION:()=>XMe,CLAUDE_CODE_EAGER_FLUSH:()=>TUe,CLAUDE_CODE_EXTRA_BODY:()=>nUe,CLAUDE_CODE_EXTRA_METADATA:()=>rUe,CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS:()=>cUe,CLAUDE_CODE_FORCE_SYNC_OUTPUT:()=>CUe,CLAUDE_CODE_GZIP_CCR_REQUEST_BODIES:()=>bUe,CLAUDE_CODE_GZIP_REQUEST_BODIES:()=>SUe,CLAUDE_CODE_MAX_CONTEXT_TOKENS:()=>aUe,CLAUDE_CODE_MAX_OUTPUT_TOKENS:()=>iUe,CLAUDE_CODE_MAX_RETRIES:()=>sUe,CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY:()=>lUe,CLAUDE_CODE_MAX_TURNS:()=>uUe,CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS:()=>OUe,CLAUDE_CODE_RETRY_WATCHDOG:()=>AUe,CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS:()=>RUe,CLAUDE_ENABLE_BYTE_WATCHDOG:()=>gUe,CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK:()=>_Ue,CLAUDE_ENABLE_STREAM_WATCHDOG:()=>yUe,CLAUDE_MOCK_HEADERLESS_429:()=>kUe,CLAUDE_SLOW_FIRST_BYTE_MS:()=>wUe,CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS:()=>vUe,CLAUDE_STREAM_IDLE_TIMEOUT_MS:()=>EUe,HTTPS_PROXY:()=>HMe,HTTP_PROXY:()=>jMe,MAX_MCP_OUTPUT_TOKENS:()=>fUe,MAX_STRUCTURED_OUTPUT_RETRIES:()=>pUe,MAX_THINKING_TOKENS:()=>dUe,NO_PROXY:()=>BMe,all_proxy:()=>qMe,http_proxy:()=>KMe,https_proxy:()=>GMe,no_proxy:()=>WMe});var jMe=d.str(),HMe=d.str(),BMe=d.str(),KMe=d.str(),GMe=d.str(),WMe=d.str(),VMe=d.str(),qMe=d.str(),ZMe=d.str(),YMe=d.str(),JMe=d.str(),XMe=d.bool(),QMe=d.str(),eUe=d.str(),tUe=d.str(),nUe=d.str(),rUe=d.str(),oUe=d.str(),sUe=d.int(),iUe=d.int(),aUe=d.int(),cUe=d.int(),lUe=d.int({min:1}),uUe=d.str(),dUe=d.int(),pUe=d.int(),fUe=d.int(),mUe=d.int(),hUe=d.int(),gUe=d.triBool(),_Ue=d.bool(),yUe=d.triBool(),SUe=d.triBool(),bUe=d.triBool(),EUe=d.int({min:1}),xUe=d.int({min:1}),vUe=d.int({min:1}),wUe=d.int({min:1}),AUe=d.bool(),TUe=d.bool(),CUe=d.bool(),kUe=d.bool(),RUe=d.int(),OUe=d.int({min:0});var HC={};on(HC,{AGENT_PROXY_URL:()=>DFe,ANTHROPIC_AWS_BASE_URL:()=>KUe,ANTHROPIC_AWS_WORKSPACE_ID:()=>GUe,ANTHROPIC_BASE_URL:()=>UUe,ANTHROPIC_BEDROCK_BASE_URL:()=>zUe,ANTHROPIC_BEDROCK_MANTLE_BASE_URL:()=>BUe,ANTHROPIC_BEDROCK_REGION_PREFIX:()=>jUe,ANTHROPIC_BEDROCK_SERVICE_TIER:()=>HUe,ANTHROPIC_FOUNDRY_BASE_URL:()=>QUe,ANTHROPIC_FOUNDRY_RESOURCE:()=>eFe,ANTHROPIC_GOOGLE_CLOUD_BASE_URL:()=>ZUe,ANTHROPIC_GOOGLE_CLOUD_LOCATION:()=>VUe,ANTHROPIC_GOOGLE_CLOUD_PROJECT:()=>WUe,ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID:()=>qUe,ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION:()=>dFe,ANTHROPIC_UNIX_SOCKET:()=>pFe,ANTHROPIC_VERTEX_BASE_URL:()=>YUe,ANTHROPIC_VERTEX_PROJECT_ID:()=>JUe,AWS_ACCESS_KEY_ID:()=>iFe,AWS_CONFIG_FILE:()=>oFe,AWS_DEFAULT_REGION:()=>nFe,AWS_ENDPOINT_URL:()=>lFe,AWS_ENDPOINT_URL_STS:()=>uFe,AWS_PROFILE:()=>rFe,AWS_REGION:()=>tFe,AWS_SECRET_ACCESS_KEY:()=>aFe,AWS_SESSION_TOKEN:()=>cFe,AWS_SHARED_CREDENTIALS_FILE:()=>sFe,CCR_AGENT_PROXY_ENABLED:()=>xFe,CCR_AGENT_PROXY_FRAME_HOSTS:()=>RFe,CCR_AGENT_PROXY_INCLUDE_HOSTS:()=>TFe,CCR_AGENT_PROXY_RECEIVE_GATE_DISABLED:()=>CFe,CCR_AGENT_PROXY_RELAY_MODE:()=>AFe,CCR_AGENT_PROXY_UPLOAD_GATE_DISABLED:()=>kFe,CCR_ENABLE_BUNDLE:()=>OFe,CCR_FORCE_BUNDLE:()=>PFe,CCR_ON_BRANCH_DEFAULT_GUARD:()=>IFe,CLAUDE_CODE_AGENT_PROXY_GH_SHIM:()=>wFe,CLAUDE_CODE_AGENT_PROXY_GIT_CONFIG:()=>vFe,CLAUDE_CODE_API_BASE_URL:()=>$Ue,CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY:()=>SFe,CLAUDE_CODE_GB_BASE_URL:()=>bFe,CLAUDE_CODE_GB_REFRESH_INTERVAL_MS:()=>EFe,CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST:()=>fFe,CLAUDE_CODE_PROXY_RESOLVES_HOSTS:()=>hFe,CLAUDE_CODE_SIMULATE_PROXY_USAGE:()=>mFe,CLAUDE_CODE_SKIP_HFI_VERSION_CHECK:()=>LFe,CLAUDE_CODE_USE_ANTHROPIC_AWS:()=>LUe,CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD:()=>NUe,CLAUDE_CODE_USE_BEDROCK:()=>PUe,CLAUDE_CODE_USE_FOUNDRY:()=>DUe,CLAUDE_CODE_USE_GATEWAY:()=>gFe,CLAUDE_CODE_USE_MANTLE:()=>MUe,CLAUDE_CODE_USE_VERTEX:()=>IUe,CLAUDE_GATEWAY_ALLOW_LOOPBACK:()=>_Fe,CLAUDE_GATEWAY_LOG_LEVEL:()=>yFe,CLOUD_ML_REGION:()=>XUe,_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL:()=>FUe});var DK=["us","eu","apac","jp","au","global"];var PUe=d.bool(),IUe=d.bool(),DUe=d.bool(),LUe=d.bool(),NUe=d.bool(),MUe=d.bool(),UUe=d.str(),FUe=d.bool(),$Ue=d.str(),zUe=d.str(),jUe=d.enum(DK),HUe=d.str(),BUe=d.str(),KUe=d.str(),GUe=d.str(),WUe=d.str(),VUe=d.str(),qUe=d.str(),ZUe=d.str(),YUe=d.str(),JUe=d.str(),XUe=d.str(),QUe=d.str(),eFe=d.str(),tFe=d.str(),nFe=d.str(),rFe=d.str(),oFe=d.str(),sFe=d.str(),iFe=d.str(),aFe=d.str(),cFe=d.str(),lFe=d.str(),uFe=d.str(),dFe=d.str(),pFe=d.str(),fFe=d.bool(),mFe=d.bool(),hFe=d.bool(),gFe=d.bool(),_Fe=d.bool(),yFe=d.str(),SFe=d.bool(),bFe=d.str(),EFe=d.int(),xFe=d.bool(),vFe=d.bool(),wFe=d.bool(),AFe=d.str(),TFe=d.str(),CFe=d.bool(),kFe=d.bool(),RFe=d.str(),OFe=d.bool(),PFe=d.bool(),IFe=d.enum(["enforce","observe","off"]),DFe=d.str(),LFe=d.bool();var MFe={...$A,...HC,...zC,...UC,...jC,...FC,...zA,...$C};function BC(e,t){let n=Object.create(t);for(let[r,o]of Object.entries(e)){let s=n,i;Object.defineProperty(n,r,{get:()=>{let a=process.env[r];if(a!==s)i=o.parse(a),s=a;return i},enumerable:!0,configurable:!0})}return Object.defineProperties(n,{set:{value:(r,o)=>{process.env[r]=q$(o)}},unset:{value:(r)=>{delete process.env[r]}}}),n}var Mn=BC(MFe,Qf),UFe={},NOt=BC(UFe,null),FFe={},MOt=BC(FFe,null);class NK{debugFilePath=void 0;initPromise=null;logStem=null}var zFe=new nt(()=>new NK);function MK(){return zFe.of(Ct().host)}function UK(e){if(e.initPromise)return e.initPromise;if(!Mn.DEBUG_CLAUDE_AGENT_SDK)return e.debugFilePath=null,e.initPromise=Promise.resolve(),e.initPromise;let t=LK(Wt(),"debug");return e.logStem=`sdk-${$Fe()}`,e.debugFilePath=LK(t,`${e.logStem}.txt`),process.stderr.write(`SDK debug logs: ${e.debugFilePath}
99
+ `),e.initPromise=$l().mkdir(t).catch(()=>{}),e.initPromise}function jFe(e){return e.logStem===null?null:{namespace:"log",sessionId:e.logStem,channel:"debug"}}function FK(){let e=MK();return UK(e),e.debugFilePath??null}function yn(e,t){let n=MK();if(n.debugFilePath===null)return;let o=`${new Date().toISOString()} ${e}
100
+ `;UK(n).then(()=>{if(t!==void 0){let s=jFe(n);if(s!==null)t.append(s,[{data:o}]).catch(()=>{});return}if(n.debugFilePath)$l().append(n.debugFilePath,o).catch(()=>{})})}function HFe(e){let t=e.trim();return t.startsWith("{")&&t.endsWith("}")}function $K(e,t){let n={...e};if(!t)return n;let r=t.enabled===!0&&t.failIfUnavailable===void 0?{...t,failIfUnavailable:!0}:t,o=n.settings;if(o&&!HFe(o))throw Error("Cannot use both a settings file path and the sandbox option. Include the sandbox configuration in your settings file instead.");let s={sandbox:r};if(o)try{s={...lt(o),sandbox:r}}catch{}return n.settings=me(s),n}function KC(e,t,n){let r=String(n);if(r.length>1&&r.startsWith("-"))e.push(`--${t}=${r}`);else e.push(`--${t}`,r)}var VFe=2000,GC=2048,HK="sdk-exit-after-stderr-drained",qFe=200;function WC(e){return e==="exit"?HK:e}class BK{#e=new Set;#t=!1;#n=()=>this.killAll();track(e){if(this.#e.add(e),!this.#t)this.#t=!0,process.on("exit",this.#n)}untrack(e){this.#e.delete(e)}isTracking(e){return this.#e.has(e)}get size(){return this.#e.size}killAll(){for(let e of this.#e)if(!e.killed)if(process.platform==="win32")try{e.stdin.end()}catch{}else e.kill("SIGTERM")}reset(){process.off("exit",this.#n),this.#t=!1,this.#e.clear()}}var By=new BK,ZFe=/[(),\u0000-\u001f\u007f-\u009f]/;function YFe(e){if(typeof e!=="string"||e.trim()==="")throw Error("Skill names must be non-empty strings.");if(!wg(e))throw new Ze(`Invalid skill name ${me(e)}: the name contains an unpaired surrogate, which cannot survive the UTF-8 encoding of the CLI invocation; no skill discovered from the filesystem can have such a name.`,"skill name with unpaired surrogate rejected");if(e!==e.trim())throw new Ze(`Invalid skill name ${me(e)}: leading or trailing whitespace is not allowed — the Skill tool trims the invoked name, so a padded rule can never match. Remove the padding.`,"skill name with surrounding whitespace rejected");if(ZFe.test(e))throw new Ze(`Invalid skill name ${me(e)}: parentheses, commas, and control characters are not allowed in skill names. Skill names match the skill's directory name (or 'plugin:skill' for plugin-qualified skills); rename the skill if its directory name contains these characters.`,"invalid skill name rejected");if(e==="*")throw Error("Invalid skill name '*': use skills: 'all' to enable every skill.");if(e.endsWith(":*")||e.endsWith(" *"))throw new Ze(`Invalid skill name ${me(e)}: wildcard-suffix names are not allowed; list each skill by its exact name.`,"wildcard-suffix skill name rejected");if(e.startsWith("/"))throw new Ze(`Invalid skill name ${me(e)}: skill names may not start with '/'. Skills are invoked as slash commands, but the skills option takes the skill's canonical name — the directory name, or 'plugin:skill'.`,"skill name with leading slash rejected");if(e.includes("\\\\"))throw new Ze(`Invalid skill name ${me(e)}: consecutive backslashes are not allowed — the permission-rule parser collapses escaped backslashes, so the rule would name a different skill. Rename the skill.`,"skill name with consecutive backslashes rejected");if(e.endsWith("\\"))throw new Ze(`Invalid skill name ${me(e)}: names may not end with an unpaired backslash.`,"skill name with unpaired trailing backslash rejected");return e}class qC{options;process;processStdin;processStdout;ready=!1;abortController;exitError;exitEventDelivered=!1;stderrTail="";exitListeners=[];abortHandler;forwardedAbort=Gd();pendingWrites=[];pendingEndInput=!1;spawnResolve;spawnReject;spawnPromise;constructor(e){this.options=e;if(this.abortController=e.abortController||Gd(),e.deferSpawn)this.spawnPromise=new Promise((t,n)=>{this.spawnResolve=t,this.spawnReject=n}),this.spawnPromise.catch(()=>{});else this.initialize()}spawn(){try{this.initialize()}catch(t){throw this.spawnAbort(Hr(t)),t}let e=this.pendingWrites;if(this.pendingWrites=[],this.spawnResolve)this.spawnResolve(),this.spawnResolve=void 0,this.spawnReject=void 0;for(let t of e)this.write(t);if(this.pendingEndInput)this.pendingEndInput=!1,this.processStdin?.end()}spawnAbort(e){if(this.spawnReject)this.spawnReject(e),this.spawnReject=void 0,this.spawnResolve=void 0,this.pendingWrites=[]}updateEnv(e){if(this.options.env)Object.assign(this.options.env,e);else this.options.env={...e}}updateResume(e){this.options.resume=e}getDefaultExecutable(){return il()?"bun":"node"}spawnLocalProcess(e){let{command:t,args:n,cwd:r,env:o,signal:s}=e,i=BFe(t,n,{cwd:r,stdio:["pipe","pipe","pipe"],signal:s,env:o,windowsHide:!0}),a=new WFe("utf8"),c=!1,l=!1,u=!1,p,f=Oe(o.DEBUG_CLAUDE_AGENT_SDK)||this.options.stderr!==void 0;i.stderr.on("data",(y)=>{if(u)return;let _=a.write(y);if(this.stderrTail+=_,this.stderrTail.length>2*GC)this.stderrTail=iv(qd(this.stderrTail),GC);if(f)yn(_),this.options.stderr?.(_)}),i.stderr.on("error",(y)=>{yn(`[ProcessTransport] stderr read failed: ${y.code??y.message}`)});let m=()=>{if(u)return;if(u=!0,p)clearTimeout(p);i.emit(HK,i.exitCode,i.signalCode);let y=i.stderr;if(e$e(y))y.unref();else y.destroy()};return i.stderr.once("close",()=>{if(this.stderrTail+=a.end(),c=!0,l)m()}),i.once("exit",()=>{if(l=!0,this.ready=!1,c)m();else p=setTimeout(m,qFe)}),{stdin:i.stdin,stdout:i.stdout,get killed(){return i.killed},get exitCode(){return i.exitCode},get signalCode(){return i.signalCode},kill:i.kill.bind(i),on:(y,_)=>i.on(WC(y),_),once:(y,_)=>i.once(WC(y),_),off:(y,_)=>i.off(WC(y),_)}}initialize(){try{let{additionalDirectories:e=[],agent:t,betas:n,cwd:r,executable:o=this.getDefaultExecutable(),executableArgs:s=[],extraArgs:i={},pathToClaudeCodeExecutable:a,env:c={...process.env},thinkingConfig:l,maxTurns:u,maxBudgetUsd:p,taskBudget:f,model:m,fallbackModel:h,jsonSchema:y,permissionMode:_,allowDangerouslySkipPermissions:E,permissionPromptToolName:S,continueConversation:x,resume:v,settingSources:w,skills:U,disallowedTools:L=[],tools:F,mcpServers:K,strictMcpConfig:ne,canUseTool:se,includePartialMessages:X,plugins:re,sandbox:Ie}=this.options,{allowedTools:yt=[]}=this.options;if(U!==void 0){let te=U==="all"?["Skill"]:U.map((Te)=>`Skill(${YFe(Te)})`),Be=new Set(yt);yt=[...yt,...te.filter((Te)=>!Be.has(Te))]}let Z=["--output-format","stream-json","--verbose","--input-format","stream-json"];if(l){switch(l.type){case"enabled":if(l.budgetTokens===void 0)Z.push("--thinking","adaptive");else Z.push("--max-thinking-tokens",l.budgetTokens.toString());break;case"disabled":Z.push("--thinking","disabled");break;case"adaptive":Z.push("--thinking","adaptive");break}if(l.type!=="disabled"&&l.display)Z.push("--thinking-display",l.display)}if(this.options.effort)Z.push("--effort",this.options.effort);if(u)Z.push("--max-turns",u.toString());if(p!==void 0)Z.push("--max-budget-usd",p.toString());if(f)Z.push("--task-budget",f.total.toString());if(m)Z.push("--model",m);if(t)Z.push("--agent",t);if(n&&n.length>0)Z.push("--betas",n.join(","));if(y)Z.push("--json-schema",me(y));if(this.options.debugFile)Z.push("--debug-file",this.options.debugFile);else if(this.options.debug)Z.push("--debug");if(!this.options.debugFile&&!this.options.spawnClaudeCodeProcess){let te=FK();if(te)Z.push("--debug-file",te)}if(se){if(S)throw Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");Z.push("--permission-prompt-tool","stdio")}else if(S)Z.push("--permission-prompt-tool",S);if(x)Z.push("--continue");if(v)Z.push(`--resume=${v}`);if(this.options.channels&&this.options.channels.length>0)for(let te of this.options.channels)KC(Z,"channels",te);if(yt.length>0)Z.push("--allowedTools",yt.join(","));if(L.length>0)Z.push("--disallowedTools",L.join(","));if(F!==void 0)if(Array.isArray(F))if(F.length===0)Z.push("--tools","");else Z.push("--tools",F.join(","));else Z.push("--tools","default");if(K&&Object.keys(K).length>0)Z.push("--mcp-config",me({mcpServers:K}));if(w!==void 0)Z.push(`--setting-sources=${w.join(",")}`);if(ne)Z.push("--strict-mcp-config");if(_)Z.push("--permission-mode",_);if(E)Z.push("--allow-dangerously-skip-permissions");if(h){if(m&&h===m)throw Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");Z.push("--fallback-model",h)}if(this.options.includeHookEvents)Z.push("--include-hook-events");if(X)Z.push("--include-partial-messages");if(this.options.sessionMirror)Z.push("--session-mirror");for(let te of e)Z.push("--add-dir",te);if(re&&re.length>0)for(let te of re)if(te.type==="local")Z.push(te.skipMcpDiscovery?"--plugin-dir-no-mcp":"--plugin-dir",te.path);else throw Error(`Unsupported plugin type: ${te.type}`);if(this.options.forkSession)Z.push("--fork-session");if(this.options.resumeSessionAt)Z.push(`--resume-session-at=${this.options.resumeSessionAt}`);if(this.options.resumeDropsTurn!==void 0)Z.push(`--resume-drops-turn=${this.options.resumeDropsTurn}`);if(this.options.sessionId)Z.push(`--session-id=${this.options.sessionId}`);if(this.options.persistSession===!1)Z.push("--no-session-persistence");if(this.options.managedSettings)Z.push("--managed-settings",this.options.managedSettings);let Qe={...i??{}};if(this.options.settings)Qe.settings=this.options.settings;let St=$K(Qe,Ie);for(let[te,Be]of Object.entries(St))if(Be===null)Z.push(`--${te}`);else KC(Z,te,Be);if(!c.CLAUDE_CODE_ENTRYPOINT)c.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(delete c.NODE_OPTIONS,Oe(c.DEBUG_CLAUDE_AGENT_SDK))c.DEBUG="1";else delete c.DEBUG;let At=JFe(a),Kn=At?a:o,Dt=At?[...s,...Z]:[...s,a,...Z],ie={command:Kn,args:Dt,cwd:r,env:c,signal:this.forwardedAbort.signal};if(this.options.spawnClaudeCodeProcess)yn(`Spawning Claude Code (custom): ${Kn} ${Dt.join(" ")}`),this.process=this.options.spawnClaudeCodeProcess(ie);else yn(`Spawning Claude Code: ${Kn} ${Dt.join(" ")}`),this.process=this.spawnLocalProcess(ie);if(this.processStdin=this.process.stdin,this.processStdout=this.process.stdout,this.processStdin.on("error",(te)=>{yn(`[ProcessTransport] stdin write failed (child likely exited): ${te.code??te.message}`),this.ready=!1}),By.track(this.process),this.abortHandler=()=>this.close(),this.abortController.signal.addEventListener("abort",this.abortHandler),this.abortController.signal.aborted)this.close();let Q=this.process;Q.on("error",(te)=>{this.ready=!1;let Be=te,Te=Be.syscall!==void 0?Be.syscall.startsWith("spawn"):kA(te);if(Te&&!Q.killed)By.untrack(Q);if(this.abortController.signal.aborted)this.exitError=Ky(),Cn(te,{telemetryMessage:"Claude Code process aborted by user",errorClass:"aborted"});else if(Te&&kA(te)){let{message:Ft,telemetryMessage:Gn,errorClass:qe}=XFe(a,At),ro={telemetryMessage:`${Gn}${VC(te)}`,errorClass:qe,code:mf(te)};this.exitError=Cn(ReferenceError(Ft),ro),Cn(te,ro),yn(this.exitError.message)}else{let Ft={telemetryMessage:Te?`Failed to spawn Claude Code process${VC(te)}`:`Claude Code process error${VC(te)}`,errorClass:Te?"spawn_failed":"process_error",code:mf(te)};this.exitError=Cn(Error(`Failed to spawn Claude Code process: ${qd(te.message)}`),Ft),Cn(te,Ft),yn(this.exitError.message)}}),Q.on("exit",(te,Be)=>{if(this.exitEventDelivered=!0,this.ready=!1,this.abortController.signal.aborted)this.exitError=Ky();else{let Te=this.getProcessExitError(te,Be);if(Te)this.exitError=Te,yn(Te.message)}}),this.ready=!this.abortController.signal.aborted}catch(e){throw this.ready=!1,e}}getProcessExitError(e,t){if(e!==0&&e!==null){let n=Number.isInteger(e)?e:void 0;return Cn(Error(`Claude Code process exited with code ${e}${this.formatStderrTail()}`),{telemetryMessage:`Claude Code process exited with code ${n??"unknown"}`,errorClass:"process_exited_nonzero",exitCode:n})}else if(t){let n=/^SIG[A-Z0-9]{1,8}$/.test(t)?t:"unknown";return Cn(Error(`Claude Code process terminated by signal ${t}${this.formatStderrTail()}`),{telemetryMessage:`Claude Code process terminated by signal ${n}`,errorClass:"process_killed_by_signal",signal:n})}return}formatStderrTail(){let e=iv(qd(this.stderrTail),GC).trim();return e?`. stderr: ${e}`:""}write(e){if(this.abortController.signal.aborted)throw zK();if(this.spawnResolve){this.pendingWrites.push(e);return}if(!this.ready||!this.processStdin)throw Error("ProcessTransport is not ready for writing");if(this.processStdin.writableEnded){yn("[ProcessTransport] Dropping write to ended stdin stream");return}if(this.process?.killed||this.process?.exitCode!==null)throw Error("Cannot write to terminated process");if(this.exitError)throw Cn(Error(`Cannot write to process that exited with error: ${this.exitError.message}`),{telemetryMessage:`Cannot write to process that exited with error: ${w$(this.exitError)??"untagged exit error"}`,errorClass:jK(this.exitError,"errorClass"),code:mf(this.exitError),exitCode:QFe(this.exitError),signal:jK(this.exitError,"signal")});yn(`[ProcessTransport] Writing to stdin: ${e.substring(0,100)}`);try{if(!this.processStdin.write(e))yn("[ProcessTransport] Write buffer full, data queued")}catch(t){throw this.ready=!1,Error(`Failed to write to process stdin: ${Br(t)}`)}}[Symbol.dispose](){this.close()}close(){if(this.spawnAbort(this.abortController.signal.aborted?Ky():Error("Query closed before spawn")),this.processStdin)this.processStdin.end(),this.processStdin=void 0;if(this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;let e=this.process?.exitCode??null,t=this.process?.signalCode??null,n=!this.exitEventDelivered&&(e!==null&&e>=0||t!==null),r;if(n){if(this.exitEventDelivered=!0,r=this.abortController.signal.aborted?Ky():this.getProcessExitError(e,t),r&&!this.exitError)this.exitError=r}let o=this.exitListeners;this.exitListeners=[];for(let{callback:a,handler:c}of o)if(this.process?.off("exit",c),n)try{a(r)}catch(l){yn(`[ProcessTransport] onExit callback threw during close(): ${Br(l)}`)}let s=()=>{if(this.abortController.signal.aborted)this.forwardedAbort.abort(this.abortController.signal.reason)},i=this.process;if(i&&!i.killed&&i.exitCode===null&&i.signalCode==null)setTimeout((a,c)=>{if(a.exitCode!==null||a.signalCode!=null){c();return}if(process.platform==="win32"){setTimeout((l,u)=>{if(l.exitCode===null)l.kill("SIGKILL");u()},5000,a,c).unref();return}a.kill("SIGTERM"),setTimeout((l)=>{if(l.exitCode===null)l.kill("SIGKILL")},5000,a).unref(),c()},VFe,i,s).unref(),i.once("exit",()=>By.untrack(i));else if(i)By.untrack(i),s();this.ready=!1}isReady(){return this.ready}async*readMessages(){if(this.spawnPromise)await this.spawnPromise,this.spawnPromise=void 0;if(!this.processStdout)throw Error("ProcessTransport output stream not available");if(this.exitError)throw this.exitError;let e=GFe({input:this.processStdout}),t=this.process?(()=>{let n=this.process,r=()=>e.close();return n.on("error",r),()=>n.off("error",r)})():void 0;if(this.exitError)e.close();try{for await(let n of e)if(n.trim()){let r;try{r=lt(n)}catch(o){yn(`Non-JSON stdout: ${n}`);continue}yield r}if(this.exitError)throw this.exitError;await this.waitForExit()}finally{t?.(),e.close()}}endInput(){if(this.spawnResolve){this.pendingEndInput=!0;return}if(this.processStdin)this.processStdin.end()}onExit(e){if(!this.process)return()=>{};let t=(n,r)=>{let o=this.getProcessExitError(n,r);e(o)};return this.process.on("exit",t),this.exitListeners.push({callback:e,handler:t}),()=>{if(this.process)this.process.off("exit",t);let n=this.exitListeners.findIndex((r)=>r.handler===t);if(n!==-1)this.exitListeners.splice(n,1)}}async waitForExit(){if(this.exitError)throw this.exitError;if(!this.process||this.process.exitCode===0||this.process.killed&&this.exitEventDelivered)return;return new Promise((e,t)=>{let n=(o,s)=>{if(this.abortController.signal.aborted){t(zK());return}let i=this.getProcessExitError(o,s);if(i)t(i);else e()};this.process.once("exit",n);let r=(o)=>{this.process.off("exit",n),t(o)};this.process.once("error",r),this.process.once("exit",()=>{this.process.off("error",r)})})}}function JFe(e){return![".js",".mjs",".tsx",".ts",".jsx"].some((n)=>e.endsWith(n))}function XFe(e,t){let n=t?"native binary":"executable",r=qd(e);if(KFe(e))return{message:t?`Claude Code native binary at ${r} exists but failed to launch. This usually means the binary does not match this system's libc — e.g. spawning a musl-linked binary on a glibc Linux host fails because the musl dynamic loader (/lib/ld-musl-*) is missing. Specify a matching binary with options.pathToClaudeCodeExecutable.`:`Claude Code executable at ${r} exists but failed to launch.`,telemetryMessage:`Claude Code ${n} exists at the configured path but failed to launch`,errorClass:"executable_launch_failed"};return{message:t?`Claude Code native binary not found at ${r}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${r}. Is options.pathToClaudeCodeExecutable set?`,telemetryMessage:`Claude Code ${n} not found at the configured path`,errorClass:"executable_not_found"}}function VC(e){let t=mf(e);return t===void 0?"":` (${t})`}function Ky(){return Cn(new _r("Claude Code process aborted by user"),{telemetryMessage:"Claude Code process aborted by user",errorClass:"aborted"})}function zK(){return Cn(new _r("Operation aborted"),{telemetryMessage:"Operation aborted",errorClass:"aborted"})}function jK(e,t){let n=Object.hasOwn(e,t)?Reflect.get(e,t):void 0;return typeof n==="string"?n:void 0}function QFe(e){let t=Object.hasOwn(e,"exitCode")?Reflect.get(e,"exitCode"):void 0;return typeof t==="number"?t:void 0}function e$e(e){return typeof Reflect.get(e,"unref")==="function"}import{existsSync as t$e}from"fs";var Ru="@anthropic-ai/claude-agent-sdk";function n$e(){if(process.platform!=="linux")return!1;let e=typeof process.report?.getReport==="function"?process.report.getReport():null;return e!=null&&e.header?.glibcVersionRuntime===void 0}function KK(e,t={}){let n=t.platform??process.platform,r=t.arch??process.arch,o=t.exists??t$e,s=t.preferMusl??n$e(),i="claude",a=n==="win32"?".exe":"",l=(n==="android"?[`${Ru}-linux-${r}-android`]:n==="linux"?s?[`${Ru}-linux-${r}-musl`,`${Ru}-linux-${r}`]:[`${Ru}-linux-${r}`,`${Ru}-linux-${r}-musl`]:[`${Ru}-${n}-${r}`]).map((u)=>`${u}/claude${a}`);for(let u of l)try{let p=e(u);if(o(p))return p}catch{}return null}var r$e=["signed_out","identity_changed","transient","refresh_failed"];function GK(e){return r$e.some((t)=>t===e)}class tm{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(e){this.returned=e}[Symbol.asyncIterator](){if(this.started)throw Error("Stream can only be iterated once");return this.started=!0,this}next(){if(this.queue.length>0)return Promise.resolve({done:!1,value:this.queue.shift()});if(this.isDone)return Promise.resolve({done:!0,value:void 0});if(this.hasError)return Promise.reject(this.hasError);return new Promise((e,t)=>{this.readResolve=e,this.readReject=t})}enqueue(e){if(this.readResolve){let t=this.readResolve;this.readResolve=void 0,this.readReject=void 0,t({done:!1,value:e})}else this.queue.push(e)}done(){if(this.isDone=!0,this.readResolve){let e=this.readResolve;this.readResolve=void 0,this.readReject=void 0,e({done:!0,value:void 0})}}error(e){if(this.hasError=e,this.readReject){let t=this.readReject;this.readResolve=void 0,this.readReject=void 0,t(e)}}return(){if(this.isDone=!0,this.returned)this.returned();return Promise.resolve({done:!0,value:void 0})}}var o$e=1000;function s$e(){return{eventQueue:[],sink:null,droppedEventCount:0}}function i$e(e,t){if(e.eventQueue.length>=o$e)e.eventQueue.shift(),e.droppedEventCount++;e.eventQueue.push(t)}class WK{state=s$e()}var a$e=new nt(()=>new WK);function c$e(){return a$e.of(Ct().host)}function Li(e,t){let n=c$e().state;if(n.sink===null){i$e(n,{eventName:e,metadata:t,async:!1});return}n.sink.logEvent(e,t)}function ZC(e,t){Li("tengu_feature_ok",{feature_name:yi(e),...t})}function YC(e,t,n){Li("tengu_feature_bad",{...n,feature_name:yi(e),error_code:t})}function VK(e,t,n){Li("tengu_feature_sad",{...n,feature_name:yi(e),error_code:t})}async function rr(e,t,n){try{let r=await t();return ZC(e),r}catch(r){throw YC(e,n?.(r)??"error"),r}}function qK(e){return"method"in e&&"id"in e&&e.id!==null}class JC{sendMcpMessage;isClosed=!1;constructor(e){this.sendMcpMessage=e}onclose;onerror;onmessage;async start(){}async send(e){if(this.isClosed)throw Error("Transport is closed");this.sendMcpMessage(e)}async close(){if(this.isClosed)return;this.isClosed=!0,this.onclose?.()}}function nm(e){return typeof e==="number"&&Number.isInteger(e)&&e>0?e:void 0}var rm=Symbol("suppressControlResponse");class Gy{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;onElicitation;getOAuthToken;getHostAuthToken;onUserDialog;pendingControlResponses=new Map;unmatchedControlResponses=new Map;static UNMATCHED_CONTROL_RESPONSES_MAX=1024;cleanupPerformed=!1;sdkMessages;inputStream=new tm;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;initHooksPayload;sdkMcpServers=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;lastErrorResultText;latestCommands;transcriptMirrorBatcher;cleanupCallbacks=[];cleanupPromise;setIsSingleUserTurn(e){this.isSingleUserTurn=e}setTranscriptMirrorBatcher(e){this.transcriptMirrorBatcher=e}reportMirrorError(e,t){let n={type:"system",subtype:"mirror_error",error:t,key:e,uuid:Nd(),session_id:e.sessionId};this.inputStream.enqueue(n)}addCleanupCallback(e){if(this.cleanupPerformed)e();else this.cleanupCallbacks.push(e)}isClosed(){return this.cleanupPerformed}hasBidirectionalNeeds(){return this.sdkMcpServers.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0||this.onElicitation!==void 0||this.onUserDialog!==void 0||this.getOAuthToken!==void 0||this.getHostAuthToken!==void 0||this.workSecretAnswerer!==void 0}remoteControlCallGeneration=0;workSecretAnswerer;constructor(e,t,n,r,o,s=new Map,i,a,c,l,u,p){this.transport=e;this.isSingleUserTurn=t;this.canUseTool=n;this.hooks=r;this.abortController=o;this.jsonSchema=i;this.initConfig=a;this.onElicitation=c;this.getOAuthToken=l;this.getHostAuthToken=u;this.onUserDialog=p;for(let[f,m]of s)this.connectSdkMcpServer(f,m);this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(e){this.inputStream.error(e)}async stopTask(e){await this.request({subtype:"stop_task",task_id:e})}async backgroundTasks(e){return(await this.request({subtype:"background_tasks",tool_use_id:e})).response.backgrounded??!0}close(){this.cleanup()}cleanup(e){if(this.cleanupPromise)return this.cleanupPromise;return this.cleanupPerformed=!0,this.cleanupPromise=this.performCleanup(e),this.cleanupPromise}async performCleanup(e){for(let t of this.cleanupCallbacks)try{t()}catch{}if(this.cleanupCallbacks=[],this.transcriptMirrorBatcher)try{await this.transcriptMirrorBatcher.flush()}catch{}try{for(let n of this.cancelControllers.values())n.abort();this.cancelControllers.clear(),this.transport.close();let t=e??Error("Query closed before response received");for(let{reject:n}of this.pendingControlResponses.values())n(t);this.pendingControlResponses.clear(),this.unmatchedControlResponses.clear();for(let{reject:n}of this.pendingMcpResponses.values())n(t);this.pendingMcpResponses.clear(),this.hookCallbacks.clear();for(let{transport:n}of this.sdkMcpServers.values())n.close().catch(()=>{});if(this.sdkMcpServers.clear(),e)this.inputStream.error(e);else this.inputStream.done()}catch(t){}if(this.transport.waitForExit){let t=new AbortController;try{await Promise.race([this.transport.waitForExit(),Lr(2000,t.signal)])}catch{}finally{t.abort()}}}next(...[e]){return this.sdkMessages.next(...[e])}async return(e){return await this.cleanup(),this.sdkMessages.return(e)}async throw(e){return await this.cleanup(),this.sdkMessages.throw(e)}[Symbol.asyncIterator](){return this.sdkMessages}async[Symbol.asyncDispose](){await this.cleanup()}async readMessages(){try{for await(let e of this.transport.readMessages()){if(e.type==="control_response"){let t=this.pendingControlResponses.get(e.response.request_id);if(t)t.handler(e.response);else{if(this.unmatchedControlResponses.size>=Gy.UNMATCHED_CONTROL_RESPONSES_MAX){let n=this.unmatchedControlResponses.keys().next().value;if(n!==void 0)this.unmatchedControlResponses.delete(n)}this.unmatchedControlResponses.set(e.response.request_id,e.response)}continue}else if(e.type==="control_request"){this.handleControlRequest(e);continue}else if(e.type==="control_cancel_request"){this.handleControlCancelRequest(e);continue}else if(e.type==="keep_alive")continue;else if(e.type==="transcript_mirror"){this.transcriptMirrorBatcher?.enqueue(e.filePath,e.entries);continue}if(e.type==="system"&&e.subtype==="commands_changed"&&Array.isArray(e.commands))this.latestCommands=e.commands;if(e.type==="system"&&(e.subtype==="post_turn_summary"||e.subtype==="task_summary")){this.inputStream.enqueue(e);continue}if(e.type==="active_goal"){this.inputStream.enqueue(e);continue}if(e.type==="autocompact_state"){this.inputStream.enqueue(e);continue}if(e.type==="result"){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();let t=e.is_error?e.subtype==="success"?e.result:e.errors.map((n)=>n.trim()).filter(Boolean).join("; "):void 0;if(this.lastErrorResultText=t||void 0,this.firstResultReceived=!0,this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.isSingleUserTurn)ce("[Query.readMessages] First result received for single-turn query, closing stdin"),this.transport.endInput()}else if(!(e.type==="system"&&e.subtype==="session_state_changed"))this.lastErrorResultText=void 0;this.inputStream.enqueue(e)}if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();this.inputStream.done(),this.cleanup()}catch(e){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.lastErrorResultText!==void 0&&!(e instanceof _r)&&e?.name!=="SSEHttpError"){let t=Cn(Error(`Claude Code returned an error result: ${this.lastErrorResultText}`),{telemetryMessage:"Claude Code returned an error result",errorClass:"error_result"});ce(`[Query.readMessages] Replacing exit error with result text. Original: ${Br(e)}`),this.inputStream.error(t),this.cleanup(t);return}this.inputStream.error(e),this.cleanup(e)}}async handleControlRequest(e){if(this.cancelControllers.has(e.request_id)){ce(`[Query.handleControlRequest] Duplicate delivery of in-flight request ${e.request_id} (${e.request.subtype}) — skipping`);return}let t=new AbortController;this.cancelControllers.set(e.request_id,t);try{let n=await this.processControlRequest(e,t.signal);if(this.cleanupPerformed)return;if(n===rm)return;let r={type:"control_response",response:{subtype:"success",request_id:e.request_id,response:n}};await Promise.resolve(this.transport.write(me(r)+`
101
+ `))}catch(n){if(this.cleanupPerformed)return;let r={type:"control_response",response:{subtype:"error",request_id:e.request_id,error:Br(n)}};try{await Promise.resolve(this.transport.write(me(r)+`
102
+ `))}catch(o){ce(`[Query.handleControlRequest] Error-response write failed: ${Br(o)}`,{level:"error"})}}finally{this.cancelControllers.delete(e.request_id)}}handleControlCancelRequest(e){let t=this.cancelControllers.get(e.request_id);if(t)t.abort(),this.cancelControllers.delete(e.request_id)}async processControlRequest(e,t){if(e.request.subtype==="can_use_tool"){if(!this.canUseTool)throw Error("canUseTool callback is not provided.");let n=await this.canUseTool(e.request.tool_name,e.request.input,{signal:t,suggestions:e.request.permission_suggestions,blockedPath:e.request.blocked_path,decisionReason:e.request.decision_reason,title:e.request.title,displayName:e.request.display_name,description:e.request.description,toolUseID:e.request.tool_use_id,agentID:e.request.agent_id,requestId:e.request_id,...e.request.matched_ask_rule&&{matchedAskRule:{source:e.request.matched_ask_rule.source,toolName:e.request.matched_ask_rule.tool_name,...e.request.matched_ask_rule.rule_content!==void 0&&{ruleContent:e.request.matched_ask_rule.rule_content}}}});if(n===null)return rm;return{...n,toolUseID:e.request.tool_use_id}}else if(e.request.subtype==="hook_callback")return await this.handleHookCallbacks(e.request.callback_id,e.request.input,e.request.tool_use_id,t);else if(e.request.subtype==="mcp_message"){let n=e.request,r=this.sdkMcpServers.get(n.server_name)?.transport;if(!r)throw Error(`SDK MCP server not found: ${n.server_name}`);if(qK(n.message))return{mcp_response:await this.handleMcpControlRequest(n.server_name,n,r)};else{if(r.onmessage)r.onmessage(n.message);return{mcp_response:{jsonrpc:"2.0",result:{},id:0}}}}else if(e.request.subtype==="elicitation"){let n=e.request;if(this.onElicitation){let r=await this.onElicitation({serverName:n.mcp_server_name,message:n.message,mode:n.mode,url:n.url,elicitationId:n.elicitation_id,requestedSchema:n.requested_schema,title:n.title,displayName:n.display_name,description:n.description},{signal:t,requestId:e.request_id});if(r===null)return rm;return r}return{action:"decline"}}else if(e.request.subtype==="request_user_dialog"){if(this.onUserDialog){let n=await this.onUserDialog({dialogKind:e.request.dialog_kind,payload:e.request.payload,toolUseID:e.request.tool_use_id},{signal:t,requestId:e.request_id});if(n===null)return rm;return n}return ce(`[Query] No onUserDialog handler for request_user_dialog (kind=${e.request.dialog_kind}) — staying silent so a capable client (or the worker's park deadline) settles it`),Li("tengu_request_user_dialog_response_ignored",{shape:yi("auto_cancel")}),rm}else if(e.request.subtype==="oauth_token_refresh"){if(!this.getOAuthToken)throw Error("getOAuthToken callback is not provided.");let n,r=await this.getOAuthToken({signal:t,onDecline:(o)=>{if(GK(o))n=o}})??null;return r===null&&n!==void 0?{accessToken:r,reason:n}:{accessToken:r}}else if(e.request.subtype==="host_auth_token_refresh"){if(!this.getHostAuthToken)throw Error("getHostAuthToken callback is not provided.");let n=await this.getHostAuthToken({signal:t})??null;return typeof n==="string"||n===null?{authToken:n}:n}else if(e.request.subtype==="remote_control_work_secret"){let n=this.workSecretAnswerer;if(!n)throw Error("refreshWorkSecret callback is not provided.");if(!ZK(n.sessionId,e.request.session_id))throw Error("remote_control_work_secret names a session this host did not attach.");return{work_secret:await n.refresh(n.sessionId,{signal:t})||null}}throw Error("Unsupported control request subtype: "+e.request.subtype)}async*readSdkMessages(){try{for await(let e of this.inputStream)yield e}finally{await this.cleanup()}}async initialize(){if(this.hooks&&!this.initHooksPayload){this.initHooksPayload={};for(let[s,i]of Object.entries(this.hooks))if(i.length>0)this.initHooksPayload[s]=i.map((a)=>{let c=[];for(let l of a.hooks){let u=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(u,l),c.push(u)}return{matcher:a.matcher,hookCallbackIds:c,timeout:a.timeout}})}let e=this.sdkMcpServers.size>0?Array.from(this.sdkMcpServers.keys()):void 0,t=Array.from(this.sdkMcpServers).flatMap(([s,{timeout:i}])=>i!==void 0?[[s,{timeout:i}]]:[]),n=t.length>0?Object.fromEntries(t):void 0,r={subtype:"initialize",hooks:this.initHooksPayload,sdkMcpServers:e,sdkMcpServerConfigs:n,jsonSchema:this.jsonSchema,systemPrompt:typeof this.initConfig?.systemPrompt==="string"?[this.initConfig.systemPrompt]:this.initConfig?.systemPrompt,appendSystemPrompt:this.initConfig?.appendSystemPrompt,planModeInstructions:this.initConfig?.planModeInstructions,systemPromptSnapshot:this.initConfig?.systemPromptSnapshot,appendSubagentSystemPrompt:this.initConfig?.appendSubagentSystemPrompt,toolAliases:this.initConfig?.toolAliases,excludeDynamicSections:this.initConfig?.excludeDynamicSections,agents:this.initConfig?.agents,title:this.initConfig?.title,skills:Array.isArray(this.initConfig?.skills)?this.initConfig.skills:void 0,webSearchIsolationExemptMcpServers:this.initConfig?.webSearchIsolationExemptMcpServers,promptSuggestions:this.initConfig?.promptSuggestions,agentProgressSummaries:this.initConfig?.agentProgressSummaries,forwardSubagentText:this.initConfig?.forwardSubagentText,supportedDialogKinds:this.initConfig?.supportedDialogKinds,perTaskStopAffordance:this.initConfig?.perTaskStopAffordance};return(await this.request(r)).response}async interrupt(e){return rr("sdk_interrupt",async()=>{let t=await this.request({subtype:"interrupt",...e?.cancelQueued===!0&&{cancel_queued:!0}}),n=t.response?.still_queued;if(!Array.isArray(n))return;let r=t.response?.cancelled;return{still_queued:n.filter((o)=>typeof o==="string"),...Array.isArray(r)&&{cancelled:r.filter((o)=>typeof o==="string")}}})}async setPermissionMode(e){await this.request({subtype:"set_permission_mode",mode:e})}async setMcpPermissionModeOverride(e,t){return(await this.request({subtype:"set_mcp_permission_mode_override",serverName:e,mode:t})).response??{}}awaitControlResponse(e){return this.transport.expectControlResponse?.(e),new Promise((t,n)=>{let r=(s)=>{if(s.subtype==="success"){let{pending_permission_requests:i,pending_user_dialog_requests:a,...c}=s;t(c)}else n(new Ze(s.error,"awaitControlResponse: CLI error verdict"));if(s.pending_permission_requests||s.pending_user_dialog_requests)ce("[Query] Ignoring prompt-redelivery fields on awaitControlResponse response")};if(this.cleanupPerformed){n(Error("Query closed before response received"));return}let o=this.unmatchedControlResponses.get(e);if(o){this.unmatchedControlResponses.delete(e),r(o);return}this.pendingControlResponses.set(e,{handler:(s)=>{this.pendingControlResponses.delete(e),r(s)},reject:n})})}async setModel(e){await this.request({subtype:"set_model",model:e})}async setMaxThinkingTokens(e,t){await this.request({subtype:"set_max_thinking_tokens",max_thinking_tokens:e,thinking_display:t})}async applyFlagSettings(e){return rr("sdk_apply_flag_settings",async()=>{await this.request({subtype:"apply_flag_settings",settings:e})})}async getSettings(){return(await this.request({subtype:"get_settings"})).response}async updateSettings(e,t){return rr("sdk_update_settings",async()=>{await this.request({subtype:"update_settings",source:e,settings:t})})}async rewindFiles(e,t){return rr("sdk_rewind_files",async()=>(await this.request({subtype:"rewind_files",user_message_id:e,dry_run:t?.dryRun})).response)}async cancelAsyncMessage(e){return(await this.request({subtype:"cancel_async_message",message_uuid:e})).response.cancelled}async seedReadState(e,t){await this.request({subtype:"seed_read_state",path:e,mtime:t})}async setCwd(e,t){return rr("sdk_set_cwd",async()=>(await this.request({subtype:"set_cwd",path:e,...t?.trustAccepted!==void 0&&{trust_accepted:t.trustAccepted},...t?.trustedDirectory!==void 0&&{trusted_directory:t.trustedDirectory}})).response)}async enableRemoteControl(e,t,n){let r=++this.remoteControlCallGeneration,o=this.workSecretAnswerer,s=n?.reattachSessionId||(n?.workSecret===void 0?void 0:l$e(n.workSecret)),i=e&&n?.workSecret!==void 0&&n.refreshWorkSecret&&s!==void 0?{sessionId:s,refresh:n.refreshWorkSecret}:void 0;this.workSecretAnswerer=i;let a;try{a=(await this.request({subtype:"remote_control",enabled:e,...t!==void 0&&{name:t},reattach_session_id:n?.reattachSessionId,keep_session_on_exit:n?.keepSessionOnExit,work_secret:n?.workSecret})).response}catch(c){if(r===this.remoteControlCallGeneration)this.workSecretAnswerer=void 0;throw c}if(e&&r===this.remoteControlCallGeneration){let c=a.bridge_session_id,l=[i,o];this.workSecretAnswerer=typeof c==="string"?l.find((u)=>u!==void 0&&ZK(u.sessionId,c)):void 0}return a}async submitFeedback(e,t){return(await this.request({subtype:"submit_feedback",description:e,surface:t?.surface,draft_id:t?.draft_id,type:t?.type,title:t?.title,area:t?.area,attach_transcript:t?.attach_transcript})).response}async generateSessionTitle(e,t){return rr("sdk_session_title_generate",async()=>(await this.request({subtype:"generate_session_title",description:e,persist:t?.persist})).response.title)}async askSideQuestion(e,t){return rr("sdk_side_question",async()=>{let r=(await this.request({subtype:"side_question",question:e,...t?.history?.length&&{history:[...t.history]}},t)).response;return r.response===null?null:{response:r.response,synthetic:r.synthetic??!1,...r.refusal_fallback&&{refusalFallback:{originalModel:r.refusal_fallback.original_model,fallbackModel:r.refusal_fallback.fallback_model,content:r.refusal_fallback.content}}}},()=>t?.signal?.aborted?"cancelled":"error")}async launchUltrareview(e,t){return(await this.request({subtype:"ultrareview_launch",args:e,confirm:t?.confirm??!1})).response}async messageRated(e){await this.request({subtype:"message_rated",messageUuid:e.messageUuid,sentiment:e.sentiment,surface:e.surface,cleared:e.cleared??!1})}processPendingPermissionRequests(e){for(let t of e)if(t.request.subtype==="can_use_tool")this.handleControlRequest(t).catch(()=>{})}processPendingUserDialogRequests(e){for(let t of e)if(t.request.subtype==="request_user_dialog")this.handleControlRequest(t).catch(()=>{})}request(e,t){let n=Math.random().toString(36).substring(2,15);this.transport.expectControlResponse?.(n);let r={request_id:n,type:"control_request",request:e},o=e.subtype==="initialize";return new Promise((s,i)=>{let a=t?.signal,c,l=(p)=>{c?.(),s(p)},u=(p)=>{c?.(),i(p)};if(a){let p=()=>{this.pendingControlResponses.delete(n),u(Hr(a.reason??"Control request aborted"));try{Promise.resolve(this.transport.write(me({type:"control_cancel_request",request_id:n})+`
103
+ `)).catch(()=>{})}catch{}};if(a.aborted){p();return}a.addEventListener("abort",p,{once:!0}),c=()=>{a.removeEventListener("abort",p)}}this.pendingControlResponses.set(n,{handler:(p)=>{if(this.pendingControlResponses.delete(n),p.subtype==="success")l(p);else u(Cn(Error(p.error),{telemetryMessage:`Claude Code control request failed (${e.subtype})`,errorClass:"control_request_failed"}));if(!o&&(p.pending_permission_requests||p.pending_user_dialog_requests))ce(`[Query] Ignoring prompt-redelivery fields on non-initialize response (subtype=${e.subtype})`);else{if(p.pending_permission_requests)this.processPendingPermissionRequests(p.pending_permission_requests);if(p.pending_user_dialog_requests)this.processPendingUserDialogRequests(p.pending_user_dialog_requests)}},reject:u}),Promise.resolve(this.transport.write(me(r)+`
104
+ `)).catch((p)=>{this.pendingControlResponses.delete(n),u(p)})})}initializationResult(){return this.initialization}reinitialize(){return rr("sdk_reinitialize",()=>this.initialize())}async supportedCommands(){let{commands:e}=await this.initialization;return this.latestCommands??e}async supportedModels(){return(await this.initialization).models}async supportedAgents(){return(await this.initialization).agents}async reconnectMcpServer(e){await this.request({subtype:"mcp_reconnect",serverName:e})}async toggleMcpServer(e,t){return rr("sdk_mcp_toggle_server",async()=>{await this.request({subtype:"mcp_toggle",serverName:e,enabled:t})})}async enableChannel(e){return rr("sdk_mcp_enable_channel",async()=>{await this.request({subtype:"channel_enable",serverName:e})})}async mcpAuthenticate(e,t){return(await this.request({subtype:"mcp_authenticate",serverName:e,redirectUri:t})).response}async mcpClearAuth(e){return(await this.request({subtype:"mcp_clear_auth",serverName:e})).response}async mcpSubmitOAuthCallbackUrl(e,t){return(await this.request({subtype:"mcp_oauth_callback_url",serverName:e,callbackUrl:t})).response}async claudeAuthenticate(e){return(await this.request({subtype:"claude_authenticate",loginWithClaudeAi:e})).response}async claudeOAuthCallback(e,t){return(await this.request({subtype:"claude_oauth_callback",authorizationCode:e,state:t})).response}async claudeOAuthWaitForCompletion(){return(await this.request({subtype:"claude_oauth_wait_for_completion"})).response}async mcpServerStatus(){return(await this.request({subtype:"mcp_status"})).response.mcpServers}async getContextUsage(e){return(await this.request({subtype:"get_context_usage",...e})).response}async usage_EXPERIMENTAL_MAY_CHANGE_DO_NOT_RELY_ON_THIS_API_YET(){return(await this.request({subtype:"get_usage"})).response}async readFile(e,t){try{return(await this.request({subtype:"read_file",path:e,max_bytes:t?.maxBytes,encoding:t?.encoding})).response}catch{return null}}async reloadPlugins(){return rr("sdk_reload_plugins",async()=>(await this.request({subtype:"reload_plugins"})).response)}async reloadSkills(){return rr("sdk_reload_skills",async()=>(await this.request({subtype:"reload_skills"})).response)}async setMcpServers(e){return rr("sdk_mcp_set_servers",async()=>{let t={},n={};for(let[a,c]of Object.entries(e))if(c.type==="sdk"&&"instance"in c)t[a]=c;else n[a]=c;let r=new Set(this.sdkMcpServers.keys()),o=new Set(Object.keys(t));for(let a of r)if(!o.has(a))await this.disconnectSdkMcpServer(a);for(let[a,c]of Object.entries(t)){let l=this.sdkMcpServers.get(a);if(!l)this.connectSdkMcpServer(a,c);else if(nm(c.timeout)!==l.timeout)ce(`[Query.setMcpServers] MCP server '${a}' is already registered; its timeout change is ignored until the server is removed and re-added`)}let s={};for(let a of Object.keys(t)){let c=this.sdkMcpServers.get(a)?.timeout;s[a]={type:"sdk",name:a,...c!==void 0&&{timeout:c}}}return(await this.request({subtype:"mcp_set_servers",servers:{...n,...s}})).response})}async accountInfo(){return(await this.initialization).account}async streamInput(e){ce("[Query.streamInput] Starting to process input stream");try{let t=0;for await(let n of e){if(t++,ce(`[Query.streamInput] Processing message ${t}: ${n.type}`),this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(me(n)+`
105
+ `))}if(ce(`[Query.streamInput] Finished processing ${t} messages from input stream`),t>0&&this.hasBidirectionalNeeds())ce("[Query.streamInput] Has bidirectional needs, waiting for first result"),await this.waitForFirstResult();ce("[Query] Calling transport.endInput() to close stdin to CLI process"),this.transport.endInput()}catch(t){if(!(t instanceof _r))throw t}}waitForFirstResult(){if(this.firstResultReceived)return ce("[Query.waitForFirstResult] Result already received, returning immediately"),Promise.resolve();return new Promise((e)=>{let t=this.abortController?.signal;if(this.cleanupPerformed||t?.aborted){e();return}let n=()=>e();t?.addEventListener("abort",n,{once:!0}),this.addCleanupCallback(()=>{t?.removeEventListener("abort",n),e()}),this.firstResultReceivedResolve=()=>{t?.removeEventListener("abort",n),e()}})}handleHookCallbacks(e,t,n,r){let o=this.hookCallbacks.get(e);if(!o)throw Error(`No hook callback found for ID: ${e}`);return o(t,n,{signal:r})}connectSdkMcpServer(e,t){let n=new JC((r)=>this.sendMcpServerMessageToCli(e,r));this.sdkMcpServers.set(e,{transport:n,timeout:nm(t.timeout)}),t.instance.connect(n).catch((r)=>{if(this.sdkMcpServers.get(e)?.transport===n)this.sdkMcpServers.delete(e);ce(`[Query.connectSdkMcpServer] Failed to connect MCP server '${e}': ${r}`,{level:"error"})})}async disconnectSdkMcpServer(e){let t=this.sdkMcpServers.get(e);if(t){if(await t.transport.close(),this.sdkMcpServers.get(e)===t)this.sdkMcpServers.delete(e)}}sendMcpServerMessageToCli(e,t){if("id"in t&&t.id!==null&&t.id!==void 0){let r=`${e}:${t.id}`,o=this.pendingMcpResponses.get(r);if(o){o.resolve(t),this.pendingMcpResponses.delete(r);return}}let n={type:"control_request",request_id:Nd(),request:{subtype:"mcp_message",server_name:e,message:t}};Promise.resolve(this.transport.write(me(n)+`
106
+ `)).catch((r)=>{ce(`[Query.sendMcpServerMessageToCli] Transport write failed: ${r}`,{level:"error"})})}handleMcpControlRequest(e,t,n){let r="id"in t.message?t.message.id:null,o=`${e}:${r}`;return new Promise((s,i)=>{let a=()=>{this.pendingMcpResponses.delete(o)},c=(u)=>{a(),s(u)},l=(u)=>{a(),i(u)};if(this.pendingMcpResponses.set(o,{resolve:c,reject:l}),n.onmessage)n.onmessage(t.message);else{a(),i(Error("No message handler registered"));return}})}}function ZK(e,t){if(e===t)return!0;let n=e.slice(e.lastIndexOf("_")+1),r=t.slice(t.lastIndexOf("_")+1);return n.length>=4&&n===r}function l$e(e){try{let t=lt(Buffer.from(e,"base64url").toString("utf8"));if(typeof t!=="object"||t===null||!("session_ingress_token"in t)||typeof t.session_ingress_token!=="string")return;let n=t.session_ingress_token,o=(n.startsWith("sk-ant-si-")?n.slice(10):n).split(".");if(o.length!==3||!o[1])return;let s=lt(Buffer.from(o[1],"base64url").toString("utf8"));return typeof s==="object"&&s!==null&&"session_id"in s&&typeof s.session_id==="string"&&s.session_id?s.session_id:void 0}catch{return}}var Wy=500,Ou=1048576;var u$e=[200,800];class XC{send;pending=[];pendingEntries=0;pendingBytes=0;flushPromise=null;sendTimeoutMs;onError;maxPendingEntries;maxPendingBytes;backoffMs;constructor(e,t){this.send=e;let{sendTimeoutMs:n=60000,onError:r,maxPendingEntries:o=Wy,maxPendingBytes:s=Ou,backoffMs:i=u$e}=t??{};this.sendTimeoutMs=n,this.onError=r,this.maxPendingEntries=o,this.maxPendingBytes=s,this.backoffMs=i}enqueue(e,t){let n=me(t).length;if(this.pending.push({filePath:e,entries:t,bytes:n}),this.pendingEntries+=t.length,this.pendingBytes+=n,this.pendingEntries>this.maxPendingEntries||this.pendingBytes>this.maxPendingBytes)this.flushPromise=this.drain(),this.flushPromise.catch(()=>{})}async flush(){let e=this.drain();if(this.flushPromise=e,await e,this.flushPromise===e)this.flushPromise=null}async drain(){let e=this.flushPromise,t=this.pending.splice(0);if(this.pendingEntries=0,this.pendingBytes=0,e)await e;if(t.length===0)return;await this.doFlush(t)}async doFlush(e){let t=new Map;for(let n of e){let r=t.get(n.filePath);if(r)r.push(...n.entries);else t.set(n.filePath,n.entries.slice())}for(let[n,r]of t)await this.sendWithRetry(n,r)}async sendWithRetry(e,t){let n=this.backoffMs.length+1,r=`SessionStore.append() timed out after ${this.sendTimeoutMs}ms for ${e}`,o,s=1;for(;s<=n;s++)try{await Nr(this.send(e,t),this.sendTimeoutMs,r),o=void 0;break}catch(i){if(o=Hr(i),o.message===r)break;let a=this.backoffMs[s-1];if(a===void 0)break;await Lr(a)}if(o){ce(`[TranscriptMirrorBatcher] flush failed for ${e} after ${s} attempt(s): ${o}`,{level:"error"});try{this.onError?.(e,o)}catch(i){ce(`[TranscriptMirrorBatcher] onError callback threw: ${i}`,{level:"error"})}}}}var KE=Wn(GV(),1);var WV="\\p{Default_Ignorable_Code_Point}\\u2800",Nu=`\\p{Cc}\\p{Cf}\\p{Cs}\\p{Co}\\p{Cn}\\u2028\\u2029${WV}`,_Dt=new RegExp(`[${Nu}]+`,"gu"),Wk="\\u200D\\uFE0E\\uFE0F",yDt=new RegExp(`(?:(?![${Wk}])[${Nu}])+`,"gu"),SDt=new RegExp(`(?:(?![${Wk}\\n])[${Nu}])+`,"gu"),bDt=new RegExp(`(?<!\\S)[${Wk}]+`,"gu");var EDt=new RegExp(`[\\p{Cf}\\p{Co}\\p{Cn}\\u2028\\u2029\\u007F-\\u009F${WV}]`,"gu");function Cje(e){let t=e.replace(/[\p{Cf}\p{Co}\p{Cn}]/gu,"");return t=t.replace(/[\u200B-\u200F]/g,"").replace(/[\u202A-\u202E]/g,"").replace(/[\u2066-\u2069]/g,"").replace(/[\uFEFF]/g,"").replace(/[\uE000-\uF8FF]/g,""),t}function kje(e){let t=Ag(e);for(let n=0;n<10;n++){let r=Cje(t);if(r===t)return t;t=r}return t}function Rje(e){let t=e,n="",r=0,o=10;while(t!==n&&r<o)n=t,t=t.normalize("NFKC"),t=kje(t),r++;if(r>=o)throw Error(`Unicode sanitization reached maximum iterations (${o}) for input: ${e.slice(0,100)}`);return t}function oc(e){if(typeof e==="string")return Rje(e);if(Array.isArray(e))return e.map(oc);if(e!==null&&typeof e==="object"){let t={};for(let[n,r]of Object.entries(e))t[oc(n)]=oc(r);return t}return e}function eS(e){return e.replace(/[\p{Cc}\p{Cf}\u2028\u2029]+/gu," ")}function Mu(e){return e.startsWith("\uFEFF")?e.slice(1):e}import{readFile as fHe}from"fs/promises";import{once as JV}from"events";import{constants as um,createWriteStream as Bje}from"fs";import{lstat as Kje,open as iq,lstat as jDt,readdir as dm,realpath as aq,rename as HDt,stat as Gje}from"fs/promises";import{basename as Wje,dirname as Vje,isAbsolute as KDt,join as To}from"path";var VV=1e4;async function Ao(e,t,n){let r=Math.max(1,Math.floor(n?.maxPages??1e4)),o;for(let s=0;s<r;s++){if(n?.budget!==void 0){if(n.budget.pagesLeft<1)return{status:"capped"};n.budget.pagesLeft--}let i=await e(o);if(!i.ok)return{status:"error",error:i.error};if(await t(i.value.items),n?.until?.())return{status:"done"};if(o=i.value.cursor,!o)return{status:"done"}}return{status:"capped"}}import{execFile as zje}from"child_process";import{promisify as jje}from"util";import{execFileSync as Oje}from"child_process";import{lstatSync as Pje}from"fs";import{join as Ije}from"path";function Dje(){return process.platform==="win32"}class ZV{resolved=new Map;lookup(e){return this.resolved.get(e)}remember(e,t){this.resolved.set(e,t)}forget(e){this.resolved.delete(e)}}var Lje=new nt(()=>new ZV),Nje=5000;function qV(e){try{return Pje(e,{throwIfNoEntry:!1})===void 0}catch{return!1}}var Mje=new Set([".com",".exe",".bat",".cmd"]);function Uje(e){let t=e.toLowerCase().replace(/.*[\\/]/,"").replace(/[. ]+$/,""),n=t.lastIndexOf(".");return n>0&&Mje.has(t.slice(n))}function Fje(e,t=!1){let n=Lje.of(Ct().host),r=n.lookup(e);if(r!==void 0)if(r!==null){if(!qV(r))return r;n.forget(e)}else{if(!t)return r;n.forget(e)}let o=Mn.SYSTEMROOT||"C:\\Windows",s=Ije(o,"System32","where.exe");try{let a=Oje(s,[e],{stdio:"pipe",encoding:"utf8",timeout:Nje,windowsHide:!0,env:process.env}).trim().split(/\r?\n/).filter(Boolean),c=process.cwd(),l=!1;for(let u of a){if(qV(u))continue;if(bg(u,c)){l=!0;continue}if(!Uje(u))continue;return n.remember(e,u),u}if(a.length>0&&!l)n.remember(e,null);return null}catch(i){if($je(i))n.remember(e,null);return null}}function $je(e){if(e===null||typeof e!=="object")return!1;let t="status"in e?e.status:void 0,n="signal"in e?e.signal:void 0,r="code"in e?e.code:void 0;return t===1&&!n&&!r}function YV(e,t=!1){if(!Dje())return e;if(e.includes("/")||e.includes("\\"))return e;return Fje(e,t)}var Hje=jje(zje);async function Ps(e){let t=YV("git");if(t===null)return[];try{let{stdout:n}=await Hje(t,["-c","core.hooksPath=/dev/null","-c","core.fsmonitor=","worktree","list","--porcelain"],{cwd:e,timeout:5000,windowsHide:!0});if(!n)return[];return n.split(`
107
+ `).filter((r)=>r.startsWith("worktree ")).map((r)=>it(r.slice(9)))}catch{return[]}}var Un=65536,qje=new Set(["sdk-cli","sdk-ts","sdk-py"]);function cq(e,t){let n=Uu(e,"entrypoint")??dn(t,"entrypoint");if(n&&qje.has(n))return!0;let r=e.split(`
108
+ `).find((s)=>s.includes('"parentUuid":'))??e,o=Uu(r,"sessionKind");return o==="daemon"||o==="daemon-worker"}var Zje=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Je(e){if(typeof e!=="string")return null;return Zje.test(e)?e:null}function lq(e){if(!e.includes("\\"))return e;try{return JSON.parse(`"${e}"`)}catch{return e}}function Uu(e,t){let n=[`"${t}":"`,`"${t}": "`];for(let r of n){let o=e.indexOf(r);if(o<0)continue;let s=o+r.length,i=s;while(i<e.length){if(e[i]==="\\"){i+=2;continue}if(e[i]==='"')return lq(e.slice(s,i));i++}}return}function dn(e,t){let n=[`"${t}":"`,`"${t}": "`],r,o=-1;for(let s of n){let i=0;while(!0){let a=e.indexOf(s,i);if(a<0)break;let c=a+s.length,l=c;while(l<e.length){if(e[l]==="\\"){l+=2;continue}if(e[l]==='"'){if(a>o)r=lq(e.slice(c,l)),o=a;break}l++}i=l+1}}return r}function oS(e,t,n){return Yje(e,n,t)}function Yje(e,t,n){let r=n===void 0?void 0:`"type":"${n}"`,o=`"${t}":`,s=e.length;while(s>0){let i=e.lastIndexOf(`
109
+ `,s-1),a=e.slice(i+1,s);if(s=i,a.includes(o)&&(r===void 0||a.includes(r)))try{let c=JSON.parse(a);if(typeof c==="object"&&c!==null&&(n===void 0||c.type===n)){let l=c[t];if(typeof l==="string")return l}}catch{}if(i<0)break}return}function Vk(e,t){let n=`"${t}":`,r=0;while(r<e.length){let o=e.indexOf(`
110
+ `,r),s=o<0?e.slice(r):e.slice(r,o);if(r=o<0?e.length:o+1,s.includes(n))try{let i=JSON.parse(s);if(typeof i==="object"&&i!==null){let a=i[t];if(typeof a==="string")return a}}catch{}}return}function sS(e,t){return e?.realWorkspacePath===void 0?void 0:{hoverRestOn:t,realPath:e.realWorkspacePath}}async function fm(e,t,n){return Jje(e,t,"w",n)}async function Jje(e,t,n,r){if(r!==void 0&&r.hoverRestOn&&(n==="w"||t.length>0))return Xje(r.source,t,n);let o=Bje(e,{mode:384,flags:n});try{for(let s of t)if(!o.write(JSON.stringify(s)+`
111
+ `))await JV(o,"drain");o.end(),await JV(o,"finish")}catch(s){throw o.destroy(),s}}async function Xje(e,t,n){let{backend:r,key:o}=e,s=t.map((a)=>({data:JSON.stringify(a)+`
112
+ `}));if(n==="w"){let a=await r.replaceRecords(o,s,{publishDiscipline:"inPlace",mode:384});if(!a.ok)throw Error("transcript stream replace failed",{cause:a.error});return}let i=await r.append(o,s);if(!i.ok)throw Error("transcript stream append failed",{cause:i.error})}function iS(e){let t=0,n={commandFallback:""};while(t<e.length){let r=e.indexOf(`
113
+ `,t),o=r>=0?e.slice(t,r):e.slice(t);if(t=r>=0?r+1:e.length,!o.includes('"type":"user"')&&!o.includes('"type": "user"'))continue;if(o.includes('"tool_result"'))continue;if(o.includes('"isMeta":true')||o.includes('"isMeta": true'))continue;if(o.includes('"isCompactSummary":true')||o.includes('"isCompactSummary": true'))continue;try{let s=JSON.parse(o),i=pa(s,n);if(i!==void 0)return i}catch{continue}}return n.commandFallback}function uq(e){let t={commandFallback:""};for(let n of e){if(typeof n!=="object"||n===null)continue;let r=pa(n,t);if(r!==void 0)return r}return t.commandFallback}var XV=process.platform==="win32"?um.O_RDONLY:um.O_RDONLY|um.O_NOFOLLOW|um.O_NONBLOCK;async function Qje(e){let{backend:t,key:n}=e;try{let r=await t.read([{key:n,offset:0,length:Un},{key:n,tail:Un}]);if(!r.ok)return null;let[o,s]=r.value.items;if(!o.found||o.value.length===0)return null;let i=QV(o.value),a=s.found&&s.value.length>0?QV(s.value):i;return{head:i,tail:a,mtimeMs:o.mtimeMs,totalBytes:o.totalBytes}}catch{return null}}function QV(e){return Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")}var XDt=Buffer.from('"type":"user"'),QDt=Buffer.from('"type":"assistant"');function aS(e,t){if(e.kind!=="scope"||e.scope.namespace!=="transcript"||e.scope.projectKey===void 0||e.scope.sessionId!==void 0||!t(e.scope.projectKey))return;return e.scope.projectKey}function dq(e){return{skipScopeStats:!0,skipKeyStats:!0,...e!==void 0&&{cursor:e}}}function e1e(e){let t=new Map,n=new Proxy(e.backend,{get(r,o,s){let i=Reflect.get(r,o,s);if(o!=="listEntries")return typeof i==="function"?i.bind(r):i;return(c,l)=>{if(!(c.namespace==="transcript"&&!("projectKey"in c)&&Object.keys(l??{}).every((m)=>m==="cursor"||m==="skipScopeStats"||m==="skipKeyStats")))return r.listEntries(c,l);let p=[l?.cursor??"",l?.skipScopeStats,l?.skipKeyStats].map(String).join("\x00"),f=t.get(p);if(f===void 0){f=r.listEntries(c,l),t.set(p,f);let m=()=>{t.delete(p)};f.then((h)=>{if(!h.ok)m()},m)}return f}}});return{...e,backend:n}}async function ic(e,t){if(t!==void 0&&t.hoverRestOn)return pq(t.source);try{if(XV===um.O_RDONLY){if(!(await Kje(e)).isFile())return null}let n=await iq(e,XV);try{let r=await n.stat();if(!r.isFile())return null;let o=Buffer.allocUnsafe(Un),s=await n.read(o,0,Un,0);if(s.bytesRead===0)return null;let i=o.toString("utf8",0,s.bytesRead),a=Math.max(0,r.size-Un),c=i;if(a>0){let l=await n.read(o,0,Un,a);c=o.toString("utf8",0,l.bytesRead)}return{mtime:r.mtime.getTime(),size:r.size,head:i,tail:c}}finally{await n.close()}}catch{return null}}async function pq(e){let t=await Qje(e);if(t===null)return null;return{mtime:Math.trunc(t.mtimeMs),size:t.totalBytes,head:t.head,tail:t.tail}}var Is=200;function t1e(e){return Math.abs(oT(e)).toString(36)}function Fu(e){return e.replace(/[^a-zA-Z0-9]/g,"-")}function mm(e){let t=Fu(e);if(t.length<=Is)return t;return`${t.slice(0,Is)}-${t1e(e)}`}function tS(e,t){let n=e.replaceAll("\\","/");return t?n.toLowerCase():n}function eq(e,t,n){let r=it(e),o=it(t),s=(i)=>n?i.toLowerCase():i;if(s(Fu(r))!==s(Fu(o)))return!1;return tS(r,n)!==tS(o,n)}async function fq(e,t,n,r,o){if(!eq(e,t,n))return!1;if(Ux(e)||Ux(t))return!1;if(await r(e)||await r(t))return!1;let s;try{if(o!==void 0&&o.hoverRestOn){let a=await o.realPath(e);if(!a.ok||!a.value.found)return!1;s=it(a.value.path)}else s=it(await aq(e))}catch{return!1}let i=await Ls(t,o);return eq(s,i,n)}function mq(e,t,n){if(t===void 0)return!1;let r=tS(it(e),n);return t.some((o)=>{let s=tS(it(o),n);return r===s||r.startsWith(s.endsWith("/")?s:s+"/")})}function qk(){return process.platform==="win32"||process.platform==="darwin"}function Et(){return To(Wt(),"projects")}function Ds(e){return zM()??mm(e)}function Zk(e){let t=mm(e);return t===Ds(e)?void 0:t}function $u(e){return To(Et(),Ds(e))}function ac(e,t){let n=Wje(e);return Vje(e)===Et()&&t(n)?n:void 0}async function Ls(e,t){try{if(t!==void 0&&t.hoverRestOn){let n=await t.realPath(e);return it(n.ok&&n.value.found?n.value.path:e)}return it(await aq(e))}catch{return it(e)}}async function zu(e,t,n,r){let o=r!==void 0&&r.hoverRestOn?r.source:void 0,s=o===void 0?void 0:ac(e,o.isKeySegment);if(o!==void 0&&s!==void 0){let c=await n1e(s,t,n,o);if(c!==void 0)return c}let i=Fu(t),a;try{a=await dm(e,{withFileTypes:!0})}catch{return!1}for(let c of a){if(!c.isFile()||!c.name.endsWith(".jsonl"))continue;let l=await ic(To(e,c.name));if(l===null)continue;if(hq(l,i,n))return!0}return!1}function hq(e,t,n){let r=oS(e.tail,"relocated","relocatedCwd")??Vk(e.head,"cwd");if(r===void 0)return!1;let o=Fu(it(r));return n?o.toLowerCase()===t.toLowerCase():o===t}async function n1e(e,t,n,r){let{backend:o,transcriptKey:s,isKeySegment:i}=r,a=Fu(t),c=!1,l=new Set;try{let u=await Ao((p)=>o.listEntries({namespace:"transcript",projectKey:e},dq(p)),async(p)=>{for(let f of p){if(f.kind!=="key"||f.key.namespace!=="transcript"||f.key.projectKey!==e||f.key.agentId!==void 0||!i(f.key.sessionId)||l.has(f.key.sessionId))continue;let m=f.key.sessionId,h=await pq({backend:o,key:s(e,m)});if(h===null)continue;if(l.add(m),hq(h,a,n)){c=!0;return}}},{until:()=>c});if(c)return!0;if(u.status!=="done")return}catch{return}return!1}async function or(e,t){if(t!==void 0&&t.hoverRestOn)return r1e(e,t);let n=$u(e),r=[];try{await dm(n),r.push(n)}catch{}let o=Zk(e);if(o!==void 0){let p=To(Et(),o);try{await dm(p),r.push(p)}catch{}return r}let s=mm(e);if(s.length<=Is)return r;let i=Et(),a=process.platform==="win32",c=(p)=>a?p.toLowerCase():p,l=c(s.slice(0,Is)+"-"),u=c(n);try{for(let p of await dm(i,{withFileTypes:!0})){if(!p.isDirectory()||!c(p.name).startsWith(l))continue;let f=To(i,p.name);if(c(f)!==u&&await zu(f,e,a))r.push(f)}}catch{}return r}async function r1e(e,t){let n=await ju(t.source);if(n===null){let r=Zk(e);return[$u(e),...r!==void 0?[To(Et(),r)]:[]]}return Yk(e,n,process.platform==="win32",t)}async function ju(e){let{backend:t,isKeySegment:n}=e,r=[],o=new Set,s=0;try{if((await Ao((a)=>t.listEntries({namespace:"transcript"},dq(a)),(a)=>{for(let c of a){let l=aS(c,n);if(l!==void 0&&!o.has(l))o.add(l),r.push(l)}s++})).status==="error")return s===0?null:r}catch{return s===0?null:r}return r}async function Yk(e,t,n,r){let o=Ds(e),s=$u(e),i=Zk(e),a=i===void 0&&o.length>Is?o.slice(0,Is)+"-":void 0,c=Et(),l=(E)=>n?E.toLowerCase():E,u=a!==void 0?l(a):void 0,p=l(o),f=!1,m,h=[],y=new Set;for(let E of t)if(E===o)f=!0;else if(i!==void 0){if(m===void 0&&l(E)===l(i))m=To(c,E)}else if(u!==void 0&&l(E).startsWith(u)&&l(E)!==p&&!y.has(l(E)))y.add(l(E)),h.push(E);let _=[];for(let E of h){let S=To(c,E);if(await zu(S,e,n,r))_.push(S)}return[...f?[s]:[],...m!==void 0?[m]:[],..._]}async function o1e(e,t){let n=[];for(let r of await Ps(e)){if(r===e)continue;let o=await or(r,t);if(t!==void 0&&t.hoverRestOn){let s=$u(r);if(!o.includes(s))o.push(s)}for(let s of o)n.push({worktreePath:r,projectDir:s})}return n}async function Ni(e,t,n,r){let o=`${e}.jsonl`,s=r&&n!==void 0&&n.isKeySegment(e)?e1e(n):void 0,i=s===void 0?void 0:{source:s,hoverRestOn:r};async function a(u,p){let f=To(u,o);if(s){let m=ac(u,s.isKeySegment);if(m!==void 0){try{let h=await s.backend.stat(s.transcriptKey(m,e));if(h.ok){let y=h.value.storedBytes??h.value.size;if(y>0)return{filePath:f,projectPath:p,fileSize:y}}}catch{}return}}try{let m=await Gje(f);if(m.size>0)return{filePath:f,projectPath:p,fileSize:m.size}}catch{}return}if(t){let u=await Ls(t,sS(n,r));for(let p of await or(u,i)){let f=await a(p,u);if(f)return f}for(let{worktreePath:p,projectDir:f}of await o1e(u,i)){let m=await a(f,p);if(m)return m}return}let c=Et();if(s){let u=new Map;try{if((await Ao((m)=>s.backend.listEntries({namespace:"transcript"},m!==void 0?{cursor:m}:void 0),(m)=>{for(let h of m){let y=aS(h,s.isKeySegment);if(y===void 0)continue;let _=h.kind==="scope"&&h.mtimeMs!==void 0?h.mtimeMs:Number.NEGATIVE_INFINITY,E=u.get(y);if(E===void 0)u.set(y,{projectKey:y,mtimeMs:_});else if(_>E.mtimeMs)E.mtimeMs=_}})).status==="error")return}catch{return}let p=[...u.values()];p.sort((f,m)=>f.mtimeMs!==m.mtimeMs?m.mtimeMs-f.mtimeMs:f.projectKey<m.projectKey?-1:f.projectKey>m.projectKey?1:0);for(let{projectKey:f}of p){let m=await a(To(c,f),void 0);if(m)return m}return}let l;try{l=await dm(c)}catch{return}for(let u of l){let p=await a(To(c,u),void 0);if(p)return p}return}var gq=1048576,_q=5242880,s1e=Buffer.from('"compact_boundary"');function yq(e){try{let t=JSON.parse(e);if(t.type!=="system"||t.subtype!=="compact_boundary")return null;return{hasPreservedSegment:Boolean(t.compactMetadata?.preservedSegment||t.compactMetadata?.preservedMessages)}}catch{return null}}function sc(e,t,n,r){let o=r-n;if(o<=0)return;if(e.len+o>e.buf.length){let s=Buffer.allocUnsafe(Math.min(Math.max(e.buf.length*2,e.len+o),e.cap));e.buf.copy(s,0,0,e.len),e.buf=s}t.copy(e.buf,e.len,n,r),e.len+=o}function nS(e,t,n,r){return r-n>=t.length&&e.compare(t,0,t.length,n,n+t.length)===0}var rS=Buffer.from('{"type":"attribution-snapshot"'),i1e=Buffer.from('{"type":"system"'),pm=10,a1e=Buffer.from([pm]),c1e=256;function tq(e,t,n){if(e.straddleSnapCarryLen=0,e.straddleSnapTailEnd=0,e.carryLen===0)return 0;let r=e.carryBuf,o=t.indexOf(pm);if(o===-1||o>=n)return 0;let s=o+1;if(nS(r,rS,0,e.carryLen))e.straddleSnapCarryLen=e.carryLen,e.straddleSnapTailEnd=s,e.lastSnapSrc=null;else if(e.carryLen<rS.length)return 0;else{if(nS(r,i1e,0,e.carryLen)){let i=yq(r.toString("utf-8",0,e.carryLen)+t.toString("utf-8",0,o));if(i?.hasPreservedSegment)e.hasPreservedSegment=!0;else if(i)e.out.len=0,e.boundaryStartOffset=e.bufFileOff,e.hasPreservedSegment=!1,e.lastSnapSrc=null}sc(e.out,r,0,e.carryLen),sc(e.out,t,0,s)}return e.bufFileOff+=e.carryLen+s,e.carryLen=0,s}function nq(e,t,n){let r=t.indexOf(n),o=0,s=0,i=-1,a=-1,c=t.indexOf(pm);while(c!==-1){let l=c+1;if(r!==-1&&r<s)r=t.indexOf(n,s);if(nS(t,rS,s,l))sc(e.out,t,o,s),i=s,a=l,o=l;else if(r>=s&&r<Math.min(s+c1e,l)){let u=yq(t.toString("utf-8",s,c));if(u?.hasPreservedSegment)e.hasPreservedSegment=!0;else if(u)e.out.len=0,e.boundaryStartOffset=e.bufFileOff+s,e.hasPreservedSegment=!1,e.lastSnapSrc=null,i=-1,e.straddleSnapCarryLen=0,o=s;r=t.indexOf(n,r+n.length)}s=l,c=t.indexOf(pm,s)}return sc(e.out,t,o,s),{lastSnapStart:i,lastSnapEnd:a,trailStart:s}}function rq(e,t,n,r,o){if(r!==-1){if(e.lastSnapLen=o-r,e.lastSnapBuf===void 0||e.lastSnapLen>e.lastSnapBuf.length)e.lastSnapBuf=Buffer.allocUnsafe(e.lastSnapLen);t.copy(e.lastSnapBuf,0,r,o),e.lastSnapSrc=e.lastSnapBuf}else if(e.straddleSnapCarryLen>0){if(e.lastSnapLen=e.straddleSnapCarryLen+e.straddleSnapTailEnd,e.lastSnapBuf===void 0||e.lastSnapLen>e.lastSnapBuf.length)e.lastSnapBuf=Buffer.allocUnsafe(e.lastSnapLen);e.carryBuf.copy(e.lastSnapBuf,0,0,e.straddleSnapCarryLen),n.copy(e.lastSnapBuf,e.straddleSnapCarryLen,0,e.straddleSnapTailEnd),e.lastSnapSrc=e.lastSnapBuf}}function oq(e,t,n){if(e.carryLen=t.length-n,e.carryLen>0){if(e.carryBuf===void 0||e.carryLen>e.carryBuf.length)e.carryBuf=Buffer.allocUnsafe(e.carryLen);t.copy(e.carryBuf,0,n,t.length)}}function sq(e){if(e.carryLen>0){let t=e.carryBuf;if(nS(t,rS,0,e.carryLen))e.lastSnapSrc=t,e.lastSnapLen=e.carryLen;else sc(e.out,t,0,e.carryLen)}if(e.lastSnapSrc){if(e.out.len>0&&e.out.buf[e.out.len-1]!==pm)sc(e.out,a1e,0,1);sc(e.out,e.lastSnapSrc,0,e.lastSnapLen)}}async function l1e(e,t,n,r){let o=0,s;while(o<n){let i=await e.readRecords(t,{order:"forward",maxBytes:gq,...s!==void 0&&{fromSeq:s}});if(!i.ok)throw Error("transcript record page failed during load",{cause:i.error});let a=[],c=0;for(let u of i.value.items){if(o+c+u.data.byteLength>n)break;a.push(u.data),c+=u.data.byteLength}if(c>0)r(Buffer.concat(a,c)),o+=c;let l=i.value.nextSeq;if(l===void 0||a.length<i.value.items.length)return;if(s!==void 0&&l<=s)throw Error("transcript record cursor did not advance during load");s=l}}async function Sq(e,t,n){let r=s1e,o=gq,s={out:{buf:Buffer.allocUnsafe(Math.min(t,8388608)),len:0,cap:t+1},boundaryStartOffset:0,hasPreservedSegment:!1,lastSnapSrc:null,lastSnapLen:0,lastSnapBuf:void 0,bufFileOff:0,carryLen:0,carryBuf:void 0,straddleSnapCarryLen:0,straddleSnapTailEnd:0};if(n!==void 0&&n.hoverRestOn){let{backend:c,key:l}=n.source,u=0,p=(f)=>{let m=f.length;u+=m;let h=tq(s,f,m),y;if(s.carryLen>0){let E=s.carryLen+(m-h);y=Buffer.allocUnsafe(E),s.carryBuf.copy(y,0,0,s.carryLen),f.copy(y,s.carryLen,h,m)}else y=f.subarray(h,m);let _=nq(s,y,r);rq(s,y,f,_.lastSnapStart,_.lastSnapEnd),oq(s,y,_.trailStart),s.bufFileOff+=_.trailStart};while(u<t){let f=await c.read([{key:l,offset:u,length:Math.min(o,t-u)}]);if(!f.ok){if(u===0&&tz(f.error)){await l1e(c,l,t,p);break}throw Error("transcript ranged read failed",{cause:f.error})}let[m]=f.value.items;if(!m.found)throw Error("transcript stream absent during load");if(m.value.length===0)break;p(Buffer.from(m.value.buffer,m.value.byteOffset,m.value.length))}return sq(s),{boundaryStartOffset:s.boundaryStartOffset,postBoundaryBuf:s.out.buf.subarray(0,s.out.len),hasPreservedSegment:s.hasPreservedSegment}}let i=Buffer.allocUnsafe(o),a=await iq(e,"r");try{let c=0;while(c<t){let{bytesRead:l}=await a.read(i,0,Math.min(o,t-c),c);if(l===0)break;c+=l;let u=tq(s,i,l),p;if(s.carryLen>0){let m=s.carryLen+(l-u);p=Buffer.allocUnsafe(m),s.carryBuf.copy(p,0,0,s.carryLen),i.copy(p,s.carryLen,u,l)}else p=i.subarray(u,l);let f=nq(s,p,r);rq(s,p,i,f.lastSnapStart,f.lastSnapEnd),oq(s,p,f.trailStart),s.bufFileOff+=f.trailStart}sq(s)}finally{await a.close()}return{boundaryStartOffset:s.boundaryStartOffset,postBoundaryBuf:s.out.buf.subarray(0,s.out.len),hasPreservedSegment:s.hasPreservedSegment}}var bq=/^[0-9a-f]{16}(?:[0-9a-f]{48})?@v\d+$/;function Eq(e,t,n){return{type:"history-suppression",sessionId:e,cause:t,...n&&{vetoedAgainstAccountUuid:n},ts:new Date().toISOString()}}import{basename as Zq,dirname as Yq,isAbsolute as YLt,join as pHe,relative as JLt,sep as XLt}from"path";var u1e=String.fromCharCode(0),d1e=/^\.[0-9a-f]{16}\.aside$/;function p1e(e){if(e.charCodeAt(0)!==46)return!1;return Ns(e).some((t)=>d1e.test(t))}function xq(e){return typeof e==="string"&&/^[. ]+$/.test(e)}function pn(e){return!(typeof e!=="string"||e.length===0||xq(e)||e.includes("/")||e.includes("\\")||e.includes(u1e)||p1e(e))}function sr(e){return e.length>0&&e.every(pn)}function hm(e){return Ns(e).some((t)=>t.endsWith(".jsonl"))}function Ns(e){let t=cS.get(e);if(t!==void 0)return t;let n=Object.freeze(f1e(e));if(cS.size>=m1e)cS.clear();return cS.set(e,n),n}function f1e(e){let t=e.toLowerCase(),n=t.indexOf(":");return n===-1?[Jk(t)]:[Jk(t),Jk(t.slice(0,n))]}var cS=new Map,m1e=32768;function Jk(e){let t=e.length;while(t>0){let n=e.charCodeAt(t-1);if(n!==46&&n!==32)break;t-=1}return t===e.length?e:e.slice(0,t)}function lS(e,t,n){return n===void 0?e:{...e,[t]:n}}function h1e(e,t,n,r){let s=lS({namespace:"transcript",projectKey:e,sessionId:t},"agentId",n);return lS(s,"agentRelPath",r)}function g1e(e,t,n){let o=lS({namespace:"log",sessionId:e,channel:t},"agentId",n?.agentId);return lS(o,"runId",n?.runId)}var tn={transcript:h1e,journal:(e,t,n)=>({namespace:"transcript",projectKey:e,sessionId:t,agentRelPath:n,journal:!0}),sessionJournal:(e,t,n)=>({namespace:"transcript",projectKey:e,sessionId:t,sessionJournal:n}),history:()=>({namespace:"history"}),log:g1e,globalConfig:()=>({namespace:"globalConfig"}),globalConfigCopy:(e,t)=>({namespace:"globalConfig",kind:e,stamp:t}),userSettings:()=>({namespace:"settings",layer:"user"}),projectSettings:(e)=>({namespace:"settings",layer:"project",projectKey:e}),localSettings:(e)=>({namespace:"settings",layer:"local",consentRootKey:e}),task:(e,t)=>({namespace:"task",listId:e,taskId:t}),taskListMeta:(e)=>({namespace:"task",listId:e,meta:!0}),taskListHighWaterMark:(e)=>({namespace:"task",listId:e,highWaterMark:!0}),memory:(e,t)=>({namespace:"memory",projectKey:e,relPath:t}),pluginRegistry:(e)=>({namespace:"pluginRegistry",file:e}),marketplaceCache:(e,t)=>({namespace:"marketplaceCache",marketplace:e,form:t}),marketplaceTree:(e,t)=>({namespace:"marketplaceCache",marketplace:e,relPath:t}),pluginCache:(e,t,n,r)=>({namespace:"pluginCache",marketplace:e,plugin:t,version:n,relPath:r}),cache:(e,t)=>({namespace:"cache",store:e,id:t}),paste:(e)=>({namespace:"paste",id:e}),state:(e)=>({namespace:"state",id:e}),pluginAssetCache:(e)=>({namespace:"pluginAssetCache",digest:e}),plan:(e)=>({namespace:"plan",name:e}),daemon:(e)=>({namespace:"daemon",relPath:e}),feedbackDraft:(e)=>({namespace:"feedbackDraft",draftId:e}),agentMemory:(e,t)=>({namespace:"agentMemory",layer:"user",agentType:e,relPath:t}),identity:()=>({namespace:"identity"}),team:(e)=>({namespace:"team",team:e}),sidecar:(e,t,n)=>({namespace:"sidecar",projectKey:e,sessionId:t,relPath:n}),mailbox:(e,t)=>({namespace:"mailbox",team:e,teammate:t}),scratch:(e,t)=>({namespace:"scratch",sessionId:e,relPath:t}),userConfigDir:(e,t)=>({namespace:"userConfigDir",dir:e,relPath:t}),fileHistory:(e,t)=>({namespace:"fileHistory",sessionId:e,backupFileName:t}),job:(e,t)=>({namespace:"job",jobId:e,relPath:t}),jobTimeline:(e)=>({namespace:"jobTimeline",jobId:e}),recording:(e,t,n)=>({namespace:"recording",projectKey:e,sessionId:t,stamp:n}),sessionLog:(e,t,n)=>({namespace:"sessionLog",projectKey:e,year:t.year,month:t.month,day:t.day,logName:n}),jobPins:()=>({namespace:"jobsRoot",file:"pins"}),jobDraft:(e)=>({namespace:"jobsRoot",draftKey:e}),session:(e)=>({namespace:"session",file:e}),bridgePointer:(e)=>({namespace:"bridgePointer",projectKey:e}),sessionAliases:(e)=>({namespace:"sessionAliases",projectKey:e}),dirSyncRecord:(e,t)=>({namespace:"dirSyncRecord",projectKey:e,sessionId:t})};class vq{available=void 0;probing=void 0;procUnreadableLogged=!1}var RLt=new nt(()=>new vq);function b1e(e){return q(e,"expected a segment that is not empty or made only of dots and spaces, with no path separator, NUL or set-aside shape")}function Ms(e){if(typeof e!=="object"||e===null)return q("key","expected a key object");let t=O1e(e);if(t!==void 0)return t;let n=sHe(e);if(n===void 0)return q("key",`${e.namespace} is not a storage namespace`);return Aq("key",n)}function Aq(e,t){for(let[n,r,o]of t){let s=`${e}.${n}`;if(r===void 0){if(o!=="optional")return q(s,"required")}else if(E1e(n)){if(!(e==="scope"&&n==="agentRelPath"&&Array.isArray(r)&&r.length===0)&&(!Array.isArray(r)||!sr(r)))return q(s,"expected a non-empty array of segments, none empty or made only of dots and spaces, with no path separator, NUL or set-aside shape")}else if(typeof r!=="string"||!pn(r))return b1e(s)}return}function E1e(e){return e==="relPath"||e==="agentRelPath"}var Tq=["commands","agents","output-styles","skills","workflows","routines","themes","rules","session-env","uploads","mcp-skill-archives","usage-data","mcp-discovery-cache"];var Cq=new Set(Tq),kq=`must be one of the userConfigDir directory names (${Tq.join(", ")})`,Rq=["installed","marketplaces","flagged","catalog","inUseSweep"];var x1e=new Set(Rq),v1e=`must be one of the pluginRegistry files (${Rq.join(", ")})`,Oq=["manifest","catalog"];var w1e=new Set(Oq),A1e=`must be one of the marketplaceCache forms (${Oq.join(", ")})`;var Pq=["world"];var T1e=new Set(Pq),C1e=`must be one of the session journal names (${Pq.join(", ")})`;function k1e(e){return T1e.has(e)}function R1e(e){return typeof e==="string"&&/^[0-9a-f]{64}$/.test(e)}function O1e(e){if(e.namespace==="transcript")return D1e(e);if(e.namespace==="pluginAssetCache"&&!R1e(e.digest))return q("key.digest","must be a SHA-256 digest: 64 lowercase hexadecimal characters");if(e.namespace==="globalConfig"&&"kind"in e){if(!Nq(e.kind))return q("key.kind",Lq);if(typeof e.stamp!=="string")return q("key.stamp","a recovery copy key carries its stamp")}if(e.namespace==="task")return Y1e(e);if(e.namespace==="sidecar"){let t=dS("key.sessionId",e.sessionId);if(t!==void 0)return t;if(pS(e.relPath))return q("key.relPath",gm);return $q(e.relPath)?q("key.relPath",Uq):void 0}if(e.namespace==="recording")return dS("key.sessionId",e.sessionId)??(Fq(e.stamp)?void 0:q("key.stamp",M1e));if(e.namespace==="jobsRoot")return J1e(e);if(e.namespace==="userConfigDir"&&!Cq.has(e.dir))return q("key.dir",kq);if(e.namespace==="fileHistory")return P1e(e);if(e.namespace==="settings"&&!q1e(e.layer))return q("key.layer","must be user, project or local");if(e.namespace==="log")return Z1e(e);if(e.namespace==="job"&&Wq(e.relPath))return q("key.relPath",Gq);if(e.namespace==="sessionLog")return Vq("key",e)??(nHe(e.logName)?void 0:q("key.logName","must be the session-log stem <sessionId8>[-<title-slug>]: up to eight word characters, then lower-case a-z / 0-9 runs joined by single hyphens; not a bare device name"));if(e.namespace==="pluginRegistry"&&!x1e.has(e.file))return q("key.file",v1e);if(e.namespace==="marketplaceCache"){if(!("relPath"in e))return w1e.has(e.form)?void 0:q("key.form",A1e);return e.form===void 0?void 0:q("key.form","a tree file key carries relPath, not form")}if(e.namespace!=="agentMemory")return;if(!Iq(e.layer))return q("key.layer","must be user, project or local");if(e.layer==="user"&&"projectKey"in e)return q("key.projectKey","the user layer is not keyed by project");if(e.layer!=="user"&&typeof e.projectKey!=="string")return q("key.projectKey","required for the project and local layers");return typeof e.agentType==="string"?void 0:q("key.agentType","an agent memory key names its agent")}function P1e(e){return typeof e.backupFileName!=="string"||!bq.test(e.backupFileName)?q("key.backupFileName","must be a backup file name the engine has ever written (hex hash @v version)"):void 0}function Iq(e){return e==="user"||e==="project"||e==="local"}var Dq=["backup","corrupted"];var I1e=new Set(Dq),Lq=`must be one of the global-config copy kinds (${Dq.join(", ")})`;function Nq(e){return I1e.has(e)}function D1e(e){let t=dS("key.sessionId",e.sessionId);if(t!==void 0)return t;if(pS(e.agentRelPath))return q("key.agentRelPath",gm);if("sessionJournal"in e){if(typeof e.sessionJournal!=="string"||!k1e(e.sessionJournal))return q("key.sessionJournal",C1e);return e.agentId===void 0&&e.agentRelPath===void 0&&!("journal"in e)?void 0:q("key.sessionJournal","a session journal key names the session's own journal: no agentId, agentRelPath or run journal")}if("journal"in e){if(e.journal!==!0)return q("key.journal","must be true");if(!Array.isArray(e.agentRelPath))return q("key.agentRelPath","a run journal key carries its run directory");return e.agentId===void 0?void 0:q("key.agentId","a transcript key names an agent transcript or the run journal, never both")}return e.agentRelPath!==void 0&&e.agentId===void 0?q("key.agentRelPath","requires agentId or journal"):void 0}var L1e="cloud-snapshots";var Mq=new Set(["memory","tiny_memory","bagel",L1e,"bridge-pointer.json",".session-aliases"]),N1e=/^[0-9]{1,16}$/,M1e="must be the recording stamp: 1 to 16 decimal digits (epoch milliseconds)",uS=".cast",Uq=`<stamp>${uS} inside a session's folder is that session's terminal recording stream: address it as keys.recording(projectKey, sessionId, stamp)`;function Fq(e){return typeof e==="string"&&N1e.test(e)}function $q(e){return Array.isArray(e)&&typeof e[0]==="string"&&Ns(e[0]).some((t)=>U1e(t)!==void 0)}function U1e(e){if(!e.endsWith(uS))return;let t=e.slice(0,-uS.length);return Fq(t)?t:void 0}var zq=[".ccr-tip.json",".precompact.json",uS],F1e=`must not end with ${zq.join(", ")}: those name a session's project-level sibling files`;function $1e(e){return Ns(e).some((t)=>zq.some((n)=>t.endsWith(n)))}var jq=".dir-sync.json",z1e=`must not end with ${jq}: that names a cloud session's directory-sync record at the project level`;function j1e(e){return Ns(e).some((t)=>t.endsWith(jq))}var H1e=`${[...Mq].join(", ")} are reserved: they name project-level entries, not sessions`;function B1e(e){return Ns(e).some((t)=>Mq.has(t))}function dS(e,t){if(typeof t!=="string")return;if(B1e(t))return q(e,H1e);if($1e(t))return q(e,F1e);if(j1e(t))return q(e,z1e);return hm(t)?q(e,gm):void 0}var K1e=".meta.json",G1e=".meta is reserved for the list metadata key, under every spelling that opens its file";function W1e(e){return V1e(`${e}.json`)}function V1e(e){return Ns(e).includes(K1e)}var gm="names a .jsonl stream, which only a transcript key addresses";function pS(e){return Array.isArray(e)&&e.some((t)=>typeof t==="string"&&hm(t))}function q1e(e){return e==="user"||e==="project"||e==="local"}var Hq="must be debug, telemetry or apiDump";function Bq(e){return e==="debug"||e==="telemetry"||e==="apiDump"}function Z1e(e){if(!Bq(e.channel))return q("key.channel",Hq);if(e.channel!=="apiDump")return;for(let t of["agentId","runId"])if(t in e&&e[t]!==void 0)return q(`key.${t}`,"an apiDump key names its dump by one id — the agent's for a subagent's requests, else the session's (today's dump-prompts/<id>.jsonl); agentId and runId nest nothing on this channel");return}function Y1e(e){if("taskId"in e&&(("meta"in e)||("highWaterMark"in e)))return q("key.taskId","a task key names an item, the list metadata or the list high-water mark, never more than one");if("meta"in e&&"highWaterMark"in e)return q("key.highWaterMark","a task key names an item, the list metadata or the list high-water mark, never more than one");if("meta"in e&&e.meta!==!0)return q("key.meta","must be true");if("highWaterMark"in e&&e.highWaterMark!==!0)return q("key.highWaterMark","must be true");if(typeof e.listId!=="string")return q("key.listId","a task key carries its listId");if("meta"in e||"highWaterMark"in e)return;if(typeof e.taskId!=="string")return q("key.taskId","a task item key carries its taskId");if(W1e(e.taskId))return q("key.taskId",G1e);return}function J1e(e){if("file"in e&&"draftKey"in e)return q("key.draftKey","a jobs-root key names the pins file or one draft, never both");if("file"in e)return e.file==="pins"?void 0:q("key.file","must be pins");if(typeof e.draftKey!=="string")return q("key.draftKey","a jobs-root draft key carries its draftKey");return oHe.test(e.draftKey)?void 0:q("key.draftKey","must be 8 lowercase hex characters")}var Kq="timeline.jsonl",Gq=`${Kq} is the job's timeline stream: address it as keys.jobTimeline(jobId)`;function Wq(e){return Array.isArray(e)&&typeof e[0]==="string"&&Ns(e[0]).includes(Kq)}var X1e=/^\d{4}$/,wq=/^\d{2}$/,Q1e=/^[A-Za-z0-9_-]{1,8}(?:-[a-z0-9]+)*$/,eHe=128,tHe=/^(?:con|prn|aux|nul|com\d|lpt\d)$/i;function nHe(e){return typeof e==="string"&&e.length<=eHe&&Q1e.test(e)&&!tHe.test(e)}function Vq(e,t){if(t.year!==void 0&&!Xk(X1e,t.year))return q(`${e}.year`,"must be four digits (YYYY)");if(t.month!==void 0&&!Xk(wq,t.month))return q(`${e}.month`,"must be two digits (MM)");if(t.day!==void 0&&!Xk(wq,t.day))return q(`${e}.day`,"must be two digits (DD)");return}function Xk(e,t){return typeof t==="string"&&e.test(t)}function rHe(e){if(e.year!==void 0&&e.projectKey===void 0)return q("scope.projectKey","required when year is given");if(e.month!==void 0&&e.year===void 0)return q("scope.year","required when month is given");if(e.day!==void 0&&e.month===void 0)return q("scope.month","required when day is given");return Vq("scope",e)}var oHe=/^[0-9a-f]{8}$/;function sHe(e){switch(e.namespace){case"transcript":return[["projectKey",e.projectKey],["sessionId",e.sessionId],["agentId",e.agentId,"optional"],["agentRelPath",e.agentRelPath,"optional"]];case"history":case"identity":return[];case"globalConfig":return"kind"in e?[["stamp",e.stamp]]:[];case"settings":return e.layer==="user"?[]:e.layer==="project"?[["projectKey",e.projectKey]]:[["consentRootKey",e.consentRootKey]];case"task":return"taskId"in e?[["listId",e.listId],["taskId",e.taskId]]:[["listId",e.listId]];case"memory":return[["projectKey",e.projectKey],["relPath",e.relPath]];case"pluginRegistry":return[];case"marketplaceCache":return"relPath"in e?[["marketplace",e.marketplace],["relPath",e.relPath]]:[["marketplace",e.marketplace]];case"pluginCache":return[["marketplace",e.marketplace],["plugin",e.plugin],["version",e.version],["relPath",e.relPath]];case"cache":return[["store",e.store],["id",e.id]];case"paste":return[["id",e.id]];case"pluginAssetCache":return[["digest",e.digest]];case"state":return[["id",e.id]];case"plan":return[["name",e.name]];case"feedbackDraft":return[["draftId",e.draftId]];case"agentMemory":return[...e.layer==="user"?[]:[["projectKey",e.projectKey]],["agentType",e.agentType],["relPath",e.relPath]];case"team":return[["team",e.team]];case"sidecar":return[["projectKey",e.projectKey],["sessionId",e.sessionId],["relPath",e.relPath]];case"scratch":return[["sessionId",e.sessionId],["relPath",e.relPath]];case"userConfigDir":return[["relPath",e.relPath]];case"fileHistory":return[["sessionId",e.sessionId],["backupFileName",e.backupFileName]];case"job":return[["jobId",e.jobId],["relPath",e.relPath]];case"daemon":return[["relPath",e.relPath]];case"jobsRoot":return"file"in e?[]:[["draftKey",e.draftKey]];case"session":return[["file",e.file]];case"bridgePointer":case"sessionAliases":return[["projectKey",e.projectKey]];case"dirSyncRecord":return[["projectKey",e.projectKey],["sessionId",e.sessionId]];case"mailbox":return[["team",e.team],["teammate",e.teammate]];case"log":return[["sessionId",e.sessionId],["agentId",e.agentId,"optional"],["runId",e.runId,"optional"]];case"jobTimeline":return[["jobId",e.jobId]];case"recording":return[["projectKey",e.projectKey],["sessionId",e.sessionId],["stamp",e.stamp]];case"sessionLog":return[["projectKey",e.projectKey],["year",e.year],["month",e.month],["day",e.day],["logName",e.logName]]}return}function Qk(e){if(typeof e!=="object"||e===null)return q("scope","expected a scope object");let t=lHe(e);if(t===void 0)return q("scope",`${String(e.namespace)} is not a listable namespace`);return aHe(e)??Aq("scope",t)}var iHe={transcript:[["agentId","names one agent transcript, a stream key, not a scope: narrow a scope with agentRelPath"],["journal","names a run journal, a stream key, not a scope: narrow a scope with agentRelPath"],["sessionJournal","names a session's own journal, a stream key, not a scope: the session scope lists it"]],log:[["agentId","names one log stream, a stream key, not a scope"],["runId","names one log stream, a stream key, not a scope"]],sessionLog:[["logName","names one session's log, a stream key, not a scope: a day scope lists its logs"]],task:[["taskId","names one task value, a key, not a scope: a list scope narrows with listId only"],["meta","names one task value, a key, not a scope: a list scope narrows with listId only"],["highWaterMark","names one task value, a key, not a scope: a list scope narrows with listId only"]],mailbox:[["teammate","names one inbox, a key, not a scope"]],cache:[["id","names one cached value, a key, not a scope: a cache scope narrows with store only"]],pluginAssetCache:[["digest","names one cached asset, a key, not a scope"]],fileHistory:[["backupFileName","names one backup, a key, not a scope: a file-history scope narrows with sessionId only"]],state:[["id","names one value, a key, not a scope"]],feedbackDraft:[["draftId","names one draft, a key, not a scope"]],jobsRoot:[["file","names one value, a key, not a scope"],["draftKey","names one value, a key, not a scope"]],plan:[["name","names one plan, a key, not a scope"]],paste:[["id","names one paste, a key, not a scope"]],session:[["file","names one value, a key, not a scope"]],globalConfig:[["stamp","names one recovery copy, a key, not a scope: the scope narrows with kind only"]],marketplaceCache:[["form","names one of the marketplace's two engine-written files, a key, not a scope: the tree narrows with relPath only"]],memory:[],pluginCache:[],daemon:[],sidecar:[],agentMemory:[],scratch:[],userConfigDir:[],job:[],bridgeSpawn:[]};function aHe(e){let t=e.namespace==="agentMemory"?cHe(e):void 0;if(t!==void 0)return t;if(e.namespace==="transcript"||e.namespace==="sidecar"){let r=dS("scope.sessionId",e.sessionId);if(r!==void 0)return r}for(let[r,o]of iHe[e.namespace])if(r in e&&e[r]!==void 0)return q(`scope.${r}`,o);if(e.namespace==="sidecar"&&pS(e.relPath))return q("scope.relPath",gm);if(e.namespace==="sidecar"&&$q(e.relPath))return q("scope.relPath",Uq);if(e.namespace==="log"&&e.channel!==void 0&&!Bq(e.channel))return q("scope.channel",Hq);if(e.namespace==="job"&&Wq(e.relPath))return q("scope.relPath",Gq);let n=e.namespace==="sessionLog"?rHe(e):void 0;if(n!==void 0)return n;if(e.namespace==="scratch"&&e.sessionId===void 0&&e.relPath!==void 0)return q("scope.relPath","requires scope.sessionId: a scratch relPath narrows one session directory, and no cross-session prefix filter exists");if(e.namespace==="userConfigDir"&&!Cq.has(e.dir))return q("scope.dir",kq);if(e.namespace==="transcript"&&e.agentRelPath!==void 0&&(e.projectKey===void 0||e.sessionId===void 0))return q("scope.agentRelPath","requires scope.projectKey and scope.sessionId: an agentRelPath narrows the subagents/ tree of one session directory");if(e.namespace==="transcript"&&pS(e.agentRelPath))return q("scope.agentRelPath",gm);if(e.namespace==="pluginCache"){if(e.marketplace===void 0&&e.plugin!==void 0)return q("scope.plugin","requires scope.marketplace: a plugin narrows one marketplace folder");if(e.plugin===void 0&&e.version!==void 0)return q("scope.version","requires scope.plugin: a version narrows one plugin folder");if(e.version===void 0&&e.relPath!==void 0)return q("scope.relPath","requires scope.version: a relPath narrows one version folder")}if(e.namespace==="job"&&e.jobId===void 0&&e.relPath!==void 0)return q("scope.relPath","requires scope.jobId: a job relPath narrows one job directory, and no cross-job prefix filter exists");if(e.namespace==="transcript"&&e.projectKey===void 0&&e.sessionId!==void 0)return q("scope.sessionId","requires scope.projectKey: a session narrows one project folder, and no cross-project session filter exists");if(e.namespace==="globalConfig"&&e.kind!==void 0&&!Nq(e.kind))return q("scope.kind",Lq);return}function cHe(e){if(!Iq(e.layer))return q("scope.layer","must be user, project or local");if(e.layer==="user"&&"projectKey"in e)return q("scope.projectKey","the user layer is not keyed by project");if(e.layer!=="user"&&typeof e.projectKey!=="string")return q("scope.projectKey","required for the project and local layers");return e.agentType===void 0&&e.relPath!==void 0?q("scope.relPath","requires scope.agentType: an agent-memory relPath narrows one agent directory"):void 0}function lHe(e){switch(e.namespace){case"transcript":return[["projectKey",e.projectKey,"optional"],["sessionId",e.sessionId,"optional"],["agentRelPath",e.agentRelPath,"optional"]];case"task":return[["listId",e.listId,"optional"]];case"mailbox":return[["team",e.team,"optional"]];case"memory":return[["projectKey",e.projectKey],["relPath",e.relPath,"optional"]];case"pluginCache":return[["marketplace",e.marketplace,"optional"],["plugin",e.plugin,"optional"],["version",e.version,"optional"],["relPath",e.relPath,"optional"]];case"marketplaceCache":return[["marketplace",e.marketplace],["relPath",e.relPath,"optional"]];case"cache":return[["store",e.store]];case"state":case"plan":case"paste":case"pluginAssetCache":case"feedbackDraft":return[];case"sidecar":return[["projectKey",e.projectKey],["sessionId",e.sessionId],["relPath",e.relPath,"optional"]];case"agentMemory":return[["projectKey",e.layer==="user"?void 0:e.projectKey,"optional"],["agentType",e.agentType,"optional"],["relPath",e.relPath,"optional"]];case"scratch":return[["sessionId",e.sessionId,"optional"],["relPath",e.relPath,"optional"]];case"userConfigDir":return[["relPath",e.relPath,"optional"]];case"fileHistory":return[["sessionId",e.sessionId,"optional"]];case"job":return[["jobId",e.jobId,"optional"],["relPath",e.relPath,"optional"]];case"daemon":return[["relPath",e.relPath,"optional"]];case"jobsRoot":case"session":return[];case"bridgeSpawn":return[["dir",e.dir,"optional"]];case"globalConfig":return[["kind",e.kind,"optional"]];case"log":return[["sessionId",e.sessionId,"optional"]];case"sessionLog":return[["projectKey",e.projectKey,"optional"],["year",e.year,"optional"],["month",e.month,"optional"],["day",e.day,"optional"]]}return}import{isAbsolute as uHe,sep as qq}from"path";function dHe(e){let t=process.cwd();return t.endsWith(qq)?t+e:t+qq+e}function eR(e){return(t)=>e.hostFiles.realPath(H_.workspace(t===""||uHe(t)?t:dHe(t)),{native:!0})}function _m(e){return e===void 0?void 0:{hoverRestOn:ye(),realPath:eR(e)}}function Co(e,t){if(!ye()||t===void 0)return;if(!e.endsWith(".jsonl"))return;let n=Yq(e);if(Yq(n)!==Et())return;let r=Zq(n),o=Zq(e,".jsonl");if(e!==pHe(Et(),r,`${o}.jsonl`))return;let s=tn.transcript(r,o);return Ms(s)===void 0?{backend:t,key:s}:void 0}function ir(e){if(!ye()||e===void 0)return;return{backend:e,transcriptKey:tn.transcript,isKeySegment:pn,realWorkspacePath:eR(e)}}function Sn(e){return e===void 0?void 0:{source:e,hoverRestOn:ye()}}async function mHe(e,t,n){try{let r=Sn(Co(e,n));if(t>_q&&!Mn.CLAUDE_CODE_DISABLE_PRECOMPACT_SKIP)return(await Sq(e,t,r)).postBoundaryBuf;if(r!==void 0&&r.hoverRestOn){let o=await r.source.backend.read([r.source.key]);if(!o.ok)return null;let s=o.value.items[0];if(!s.found)return null;return Buffer.from(s.value.buffer,s.value.byteOffset,s.value.byteLength)}return await fHe(e)}catch{return null}}var Jq=524288,Xq=8192;async function hHe(e){let a=[];try{const t=$t(a,en`parseTranscriptEntries(${e.length} bytes)`,0);let n=[];let r=10;let o=e.length;let s=0;let i=Jq;while(s<o){if(s>=i)await new Promise((h)=>setImmediate(h)),i=s+Jq;let p=e.indexOf(r,s);if(p===-1)p=o;let f=s;while(f<p&&e[f]<=32)f++;if(s=p+1,f>=p)continue;let m=e.toString("utf-8",f,p);try{let h=Rz(m),y=h.type;if((y==="user"||y==="assistant"||y==="progress"||y==="system"||y==="attachment")&&typeof h.uuid==="string")n.push(h)}catch{}}return n}catch(c){var l=c,u=1}finally{zt(a,l,u)}}async function gHe(e){let t=new Map;for(let m of e)t.set(m.uuid,m);let n=0;for(let m of t.values()){if(m.type!=="system"||m.subtype!=="compact_boundary")continue;let h=m.compactMetadata?.preservedMessages,y=m.compactMetadata?.preservedSegment;if(h){if(h.uuids.length===0||h.uuids.some((x)=>!t.has(x)))continue;let _=h.anchorUuid;for(let x of h.uuids){let v=t.get(x);t.set(x,{...v,parentUuid:_}),_=x}let E=h.uuids[0],S=h.uuids.at(-1);for(let[x,v]of t){if(++n%Xq===0)await new Promise((w)=>setImmediate(w));if(v.parentUuid===h.anchorUuid&&x!==E)t.set(x,{...v,parentUuid:S})}}else if(y){let _=t.get(y.headUuid);if(_)t.set(y.headUuid,{..._,parentUuid:y.anchorUuid});for(let[E,S]of t){if(++n%Xq===0)await new Promise((x)=>setImmediate(x));if(S.parentUuid===y.anchorUuid&&E!==y.headUuid)t.set(E,{...S,parentUuid:y.tailUuid})}}}let r=new Map;for(let m=0;m<e.length;m++)r.set(e[m].uuid,m);let o=new Set;for(let m of t.values())if(m.parentUuid)o.add(m.parentUuid);let s=[...t.values()].filter((m)=>!o.has(m.uuid)),i=[];for(let m of s){let h=m,y=new Set;while(h){if(y.has(h.uuid))break;if(y.add(h.uuid),h.type==="user"||h.type==="assistant"){i.push(h);break}h=h.parentUuid?t.get(h.parentUuid):void 0}}if(i.length===0)return[];let a=i.filter((m)=>!m.isSidechain&&!m.teamName&&!m.isMeta),c=(m)=>m.reduce((h,y)=>(r.get(y.uuid)??-1)>(r.get(h.uuid)??-1)?y:h),l=a.length>0?c(a):c(i),u=[],p=new Set,f=t.get(l.uuid);while(f){if(p.has(f.uuid))break;p.add(f.uuid),u.push(f),f=f.parentUuid?t.get(f.parentUuid):void 0}return u.reverse(),await new Promise((m)=>setImmediate(m)),yHe(t,u,p)}function tR(e){if(e.type!=="assistant")return;let t=e.message;if(typeof t!=="object"||t===null)return;let n=t.id;return typeof n==="string"?n:void 0}function _He(e){if(e.type!=="user"||!e.parentUuid)return!1;let t=e.message;if(typeof t!=="object"||t===null)return!1;let n=t.content;if(!Array.isArray(n))return!1;return n.some((r)=>typeof r==="object"&&r!==null&&r.type==="tool_result")}function yHe(e,t,n){let r=t.filter((p)=>p.type==="assistant");if(r.length===0)return t;let o=new Map;for(let p of r){let f=tR(p);if(f)o.set(f,p)}let s=new Map,i=new Map;for(let p of e.values()){let f=tR(p);if(f){let m=s.get(f);if(m)m.push(p);else s.set(f,[p])}else if(_He(p)){let m=p.parentUuid,h=i.get(m);if(h)h.push(p);else i.set(m,[p])}}let a=new Set,c=new Map,l=0;for(let p of r){let f=tR(p);if(!f||a.has(f))continue;a.add(f);let m=s.get(f)??[p],h=m.filter((x)=>!n.has(x.uuid)),y=[];for(let x of m){let v=i.get(x.uuid);if(!v)continue;for(let w of v)if(!n.has(w.uuid))y.push(w)}if(h.length===0&&y.length===0)continue;let _=(x,v)=>(x.timestamp??"").localeCompare(v.timestamp??"");h.sort(_),y.sort(_);let E=o.get(f),S=[...h,...y];for(let x of S)n.add(x.uuid);l+=S.length,c.set(E.uuid,S)}if(l===0)return t;let u=[];for(let p of t){u.push(p);let f=c.get(p.uuid);if(f)u.push(...f)}return u}function SHe(e,t){if(e.type==="user"||e.type==="assistant");else if(e.type==="system"&&t);else return!1;if(e.isMeta)return!1;if(e.isSidechain)return!1;if(e.teamName)return!1;return!0}function nR(e,t,n){return{type:e.type,uuid:e.uuid,session_id:e.sessionId,message:e.message,parent_tool_use_id:t??null,parent_agent_id:n??null,timestamp:e.timestamp}}function rR(e,t){let n=t?.offset??0;if(t?.limit!==void 0&&t.limit>0)return e.slice(n,n+t.limit);if(n>0)return e.slice(n);return e}async function Qq(e,t){let n=[];for(let r of e){if(typeof r!=="object"||r===null)continue;let o=r,s=o.type;if((s==="user"||s==="assistant"||s==="progress"||s==="system"||s==="attachment")&&typeof o.uuid==="string")n.push(o)}return e4(n,t)}async function e4(e,t){let n=await gHe(e),r=t?.includeSystemMessages??!1,s=n.filter((i)=>SHe(i,r)).map((i)=>nR(i));return rR(s,t)}async function t4(e,t,n){if(!Je(e))return[];let r=ye(),o=r?n:void 0,s=await Ni(e,t?.dir,ir(o),r);if(!s)return[];let i=await mHe(s.filePath,s.fileSize,o);if(!i)return[];return e4(await hHe(i),t)}import{readdir as zP,stat as Q2e}from"fs/promises";import{basename as bHe,dirname as EHe,join as xHe}from"path";function vHe(){return xHe(Wt(),"projects")}function n4(e){return EHe(e)===vHe()?bHe(e):void 0}class r4{projectDirCache=new Map;agentTranscriptSubdirs=new Map;cacheProjectDir(e,t){this.projectDirCache.set(e,t)}clearProjectDirCache(){this.projectDirCache.clear()}setAgentTranscriptSubdir(e,t){this.agentTranscriptSubdirs.set(e,t)}clearAgentTranscriptSubdir(e){this.agentTranscriptSubdirs.delete(e)}}var x0t=new nt(()=>new r4);import{basename as eKe,join as zm}from"path";import{readFile as F2e}from"fs/promises";import{dirname as $2e,join as z2e}from"path";var o4;function P(e,t,n){function r(a,c){if(!a._zod)Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1});if(a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let l=i.prototype,u=Object.keys(l);for(let p=0;p<u.length;p++){let f=u[p];if(!(f in a))a[f]=l[f].bind(a)}}let o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let l=n?.Parent?new s:this;r(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let u of l._zod.deferred)u();return l}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:(a)=>{if(n?.Parent&&a instanceof n.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}var wHe=Symbol("zod_brand");class Us extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ym extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(o4=globalThis).__zod_globalConfig??(o4.__zod_globalConfig={});var Hu=globalThis.__zod_globalConfig;function ar(e){if(e)Object.assign(Hu,e);return Hu}var Ue={};on(Ue,{BIGINT_FORMAT_RANGES:()=>a4,Class:()=>_4,NUMBER_FORMAT_RANGES:()=>dR,aborted:()=>Fi,allowsEval:()=>aR,assert:()=>RHe,assertEqual:()=>AHe,assertIs:()=>CHe,assertNever:()=>kHe,assertNotEqual:()=>THe,assignProp:()=>Mi,base64ToUint8Array:()=>h4,base64urlToUint8Array:()=>zHe,cached:()=>Ku,captureStackTrace:()=>hS,cleanEnum:()=>$He,cleanRegex:()=>xm,clone:()=>Fn,cloneDef:()=>PHe,createTransparentProxy:()=>UHe,defineLazy:()=>ze,esc:()=>mS,escapeRegex:()=>$s,explicitlyAborted:()=>pR,extend:()=>u4,finalizeIssue:()=>Vr,floatSafeRemainder:()=>sR,getElementAtPath:()=>IHe,getEnumValues:()=>bm,getLengthableOrigin:()=>vm,getParsedType:()=>MHe,getSizableOrigin:()=>m4,hexToUint8Array:()=>HHe,isObject:()=>cc,isPlainObject:()=>Ui,issue:()=>Gu,joinValues:()=>fS,jsonStringifyReplacer:()=>Bu,merge:()=>FHe,mergeDefs:()=>Fs,normalizeParams:()=>le,nullish:()=>Em,numKeys:()=>NHe,objectClone:()=>OHe,omit:()=>l4,optionalKeys:()=>uR,parsedType:()=>fR,partial:()=>p4,pick:()=>c4,prefixIssues:()=>zs,primitiveTypes:()=>i4,promiseAllObject:()=>DHe,propertyKeyTypes:()=>lR,randomString:()=>LHe,required:()=>f4,safeExtend:()=>d4,shallowClone:()=>cR,slugify:()=>iR,stringifyPrimitive:()=>gS,uint8ArrayToBase64:()=>g4,uint8ArrayToBase64url:()=>jHe,uint8ArrayToHex:()=>BHe,unwrapMessage:()=>Sm});function AHe(e){return e}function THe(e){return e}function CHe(e){}function kHe(e){throw Error("Unexpected value in exhaustive check")}function RHe(e){}function bm(e){let t=Object.values(e).filter((r)=>typeof r==="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function fS(e,t="|"){return e.map((n)=>gS(n)).join(t)}function Bu(e,t){if(typeof t==="bigint")return t.toString();return t}function Ku(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw Error("cached value already set")}}}function Em(e){return e===null||e===void 0}function xm(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function sR(e,t){let n=e/t,r=Math.round(n),o=Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-r)<o)return 0;return n-r}var s4=Symbol("evaluating");function ze(e,t,n){let r=void 0;Object.defineProperty(e,t,{get(){if(r===s4)return;if(r===void 0)r=s4,r=n();return r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function OHe(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Mi(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Fs(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function PHe(e){return Fs(e._zod.def)}function IHe(e,t){if(!t)return e;return t.reduce((n,r)=>n?.[r],e)}function DHe(e){let t=Object.keys(e),n=t.map((r)=>e[r]);return Promise.all(n).then((r)=>{let o={};for(let s=0;s<t.length;s++)o[t[s]]=r[s];return o})}function LHe(e=10){let n="";for(let r=0;r<e;r++)n+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return n}function mS(e){return JSON.stringify(e)}function iR(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var hS="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function cc(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var aR=Ku(()=>{if(Hu.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Ui(e){if(cc(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let n=t.prototype;if(cc(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function cR(e){if(Ui(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}function NHe(e){let t=0;for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n))t++;return t}var MHe=(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":if(Array.isArray(e))return"array";if(e===null)return"null";if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return"promise";if(typeof Map<"u"&&e instanceof Map)return"map";if(typeof Set<"u"&&e instanceof Set)return"set";if(typeof Date<"u"&&e instanceof Date)return"date";if(typeof File<"u"&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},lR=new Set(["string","number","symbol"]),i4=new Set(["string","number","bigint","boolean","symbol","undefined"]);function $s(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fn(e,t,n){let r=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)r._zod.parent=e;return r}function le(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function UHe(e){let t;return new Proxy({},{get(n,r,o){return t??(t=e()),Reflect.get(t,r,o)},set(n,r,o,s){return t??(t=e()),Reflect.set(t,r,o,s)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,o){return t??(t=e()),Reflect.defineProperty(t,r,o)}})}function gS(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function uR(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var dR={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},a4={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function c4(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s=Fs(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in n.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;i[a]=n.shape[a]}return Mi(this,"shape",i),i},checks:[]});return Fn(e,s)}function l4(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=Fs(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in n.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;delete i[a]}return Mi(this,"shape",i),i},checks:[]});return Fn(e,s)}function u4(e,t){if(!Ui(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=Fs(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return Mi(this,"shape",s),s}});return Fn(e,o)}function d4(e,t){if(!Ui(t))throw Error("Invalid input to safeExtend: expected a plain object");let n=Fs(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return Mi(this,"shape",r),r}});return Fn(e,n)}function FHe(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=Fs(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return Mi(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Fn(e,n)}function p4(e,t,n){let o=t._zod.def.checks;if(o&&o.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=Fs(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(n)for(let l in n){if(!(l in a))throw Error(`Unrecognized key: "${l}"`);if(!n[l])continue;c[l]=e?new e({type:"optional",innerType:a[l]}):a[l]}else for(let l in a)c[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return Mi(this,"shape",c),c},checks:[]});return Fn(t,i)}function f4(e,t,n){let r=Fs(t._zod.def,{get shape(){let o=t._zod.def.shape,s={...o};if(n)for(let i in n){if(!(i in s))throw Error(`Unrecognized key: "${i}"`);if(!n[i])continue;s[i]=new e({type:"nonoptional",innerType:o[i]})}else for(let i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return Mi(this,"shape",s),s}});return Fn(t,r)}function Fi(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function pR(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function zs(e,t){return t.map((n)=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Sm(e){return typeof e==="string"?e:e?.message}function Vr(e,t,n){let r=e.message?e.message:Sm(e.inst?._zod.def?.error?.(e))??Sm(t?.error?.(e))??Sm(n.customError?.(e))??Sm(n.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:i,...a}=e;if(a.path??(a.path=[]),a.message=r,t?.reportInput)a.input=i;return a}function m4(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function vm(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function fR(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 n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Gu(...e){let[t,n,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:r};return{...t}}function $He(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map((t)=>t[1])}function h4(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function g4(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function zHe(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return h4(t+n)}function jHe(e){return g4(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function HHe(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function BHe(e){return Array.from(e).map((t)=>t.toString(16).padStart(2,"0")).join("")}class _4{constructor(...e){}}var y4=(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,Bu,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},_S=P("$ZodError",y4),wm=P("$ZodError",y4,{Parent:Error});function mR(e,t=(n)=>n.message){let n={},r=[];for(let o of e.issues)if(o.path.length>0)n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o));else r.push(t(o));return{formErrors:r,fieldErrors:n}}function hR(e,t=(n)=>n.message){let n={_errors:[]},r=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((a)=>r({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")r({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")r({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)n._errors.push(t(i));else{let c=n,l=0;while(l<a.length){let u=a[l];if(l!==a.length-1)c[u]=c[u]||{_errors:[]};else c[u]=c[u]||{_errors:[]},c[u]._errors.push(t(i));c=c[u],l++}}}};return r(e),n}var Am=(e)=>(t,n,r,o)=>{let s=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new Us;if(i.issues.length){let a=new(o?.Err??e)(i.issues.map((c)=>Vr(c,s,ar())));throw hS(a,o?.callee),a}return i.value},yS=Am(wm),Tm=(e)=>async(t,n,r,o)=>{let s=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)i=await i;if(i.issues.length){let a=new(o?.Err??e)(i.issues.map((c)=>Vr(c,s,ar())));throw hS(a,o?.callee),a}return i.value},SS=Tm(wm),Cm=(e)=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Us;return s.issues.length?{success:!1,error:new(e??_S)(s.issues.map((i)=>Vr(i,o,ar())))}:{success:!0,data:s.value}},lc=Cm(wm),km=(e)=>async(t,n,r)=>{let o=r?{...r,async:!0}:{async:!0},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)s=await s;return s.issues.length?{success:!1,error:new e(s.issues.map((i)=>Vr(i,o,ar())))}:{success:!0,data:s.value}},uc=km(wm),S4=(e)=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Am(e)(t,n,o)};var b4=(e)=>(t,n,r)=>Am(e)(t,n,r);var E4=(e)=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Tm(e)(t,n,o)};var x4=(e)=>async(t,n,r)=>Tm(e)(t,n,r);var v4=(e)=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Cm(e)(t,n,o)};var w4=(e)=>(t,n,r)=>Cm(e)(t,n,r);var A4=(e)=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return km(e)(t,n,o)};var T4=(e)=>async(t,n,r)=>km(e)(t,n,r);var C4=/^[cC][0-9a-z]{6,}$/,k4=/^[0-9a-z]+$/,R4=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,O4=/^[0-9a-vA-V]{20}$/,P4=/^[A-Za-z0-9]{27}$/,I4=/^[a-zA-Z0-9_-]{21}$/,D4=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var L4=/^([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})$/,gR=(e)=>{if(!e)return/^([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)$/;return 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})$`)};var N4=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var GHe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function M4(){return new RegExp(GHe,"u")}var U4=/^(?:(?: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])$/,F4=/^(([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}|:))$/;var $4=/^((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])$/,z4=/^(([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])$/,j4=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_R=/^[A-Za-z0-9_-]*$/;var H4=/^https?$/,B4=/^\+[1-9]\d{6,14}$/,K4="(?:(?:\\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])))",G4=new RegExp(`^${K4}$`);function W4(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function V4(e){return new RegExp(`^${W4(e)}$`)}function q4(e){let t=W4({precision:e.precision}),n=["Z"];if(e.local)n.push("");if(e.offset)n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${t}(?:${n.join("|")})`;return new RegExp(`^${K4}T(?:${r})$`)}var Z4=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Y4=/^-?\d+n?$/,J4=/^-?\d+$/,bS=/^-?\d+(?:\.\d+)?$/,X4=/^(?:true|false)$/i,Q4=/^null$/i;var e6=/^undefined$/i;var t6=/^[^A-Z]*$/,n6=/^[^a-z]*$/;var fn=P("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),r6={number:"number",bigint:"bigint",object:"date"},yR=P("$ZodCheckLessThan",(e,t)=>{fn.init(e,t);let n=r6[typeof t.value];e._zod.onattach.push((r)=>{let o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<s)if(t.inclusive)o.maximum=t.value;else o.exclusiveMaximum=t.value}),e._zod.check=(r)=>{if(t.inclusive?r.value<=t.value:r.value<t.value)return;r.issues.push({origin:n,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),SR=P("$ZodCheckGreaterThan",(e,t)=>{fn.init(e,t);let n=r6[typeof t.value];e._zod.onattach.push((r)=>{let o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>s)if(t.inclusive)o.minimum=t.value;else o.exclusiveMinimum=t.value}),e._zod.check=(r)=>{if(t.inclusive?r.value>=t.value:r.value>t.value)return;r.issues.push({origin:n,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),o6=P("$ZodCheckMultipleOf",(e,t)=>{fn.init(e,t),e._zod.onattach.push((n)=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=(n)=>{if(typeof n.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?n.value%t.value===BigInt(0):sR(n.value,t.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),s6=P("$ZodCheckNumberFormat",(e,t)=>{fn.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[o,s]=dR[t.format];e._zod.onattach.push((i)=>{let a=i._zod.bag;if(a.format=t.format,a.minimum=o,a.maximum=s,n)a.pattern=J4}),e._zod.check=(i)=>{let a=i.value;if(n){if(!Number.isInteger(a)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});else i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}if(a<o)i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(a>s)i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var i6=P("$ZodCheckMaxLength",(e,t)=>{var n;fn.init(e,t),(n=e._zod.def).when??(n.when=(r)=>{let o=r.value;return!Em(o)&&o.length!==void 0}),e._zod.onattach.push((r)=>{let o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<o)r._zod.bag.maximum=t.maximum}),e._zod.check=(r)=>{let o=r.value;if(o.length<=t.maximum)return;let i=vm(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),a6=P("$ZodCheckMinLength",(e,t)=>{var n;fn.init(e,t),(n=e._zod.def).when??(n.when=(r)=>{let o=r.value;return!Em(o)&&o.length!==void 0}),e._zod.onattach.push((r)=>{let o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>o)r._zod.bag.minimum=t.minimum}),e._zod.check=(r)=>{let o=r.value;if(o.length>=t.minimum)return;let i=vm(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),c6=P("$ZodCheckLengthEquals",(e,t)=>{var n;fn.init(e,t),(n=e._zod.def).when??(n.when=(r)=>{let o=r.value;return!Em(o)&&o.length!==void 0}),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=(r)=>{let o=r.value,s=o.length;if(s===t.length)return;let i=vm(o),a=s>t.length;r.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Rm=P("$ZodCheckStringFormat",(e,t)=>{var n,r;if(fn.init(e,t),e._zod.onattach.push((o)=>{let s=o._zod.bag;if(s.format=t.format,t.pattern)s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern)}),t.pattern)(n=e._zod).check??(n.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(r=e._zod).check??(r.check=()=>{})}),l6=P("$ZodCheckRegex",(e,t)=>{Rm.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),u6=P("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=t6),Rm.init(e,t)}),d6=P("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=n6),Rm.init(e,t)}),p6=P("$ZodCheckIncludes",(e,t)=>{fn.init(e,t);let n=$s(t.includes),r=new RegExp(typeof t.position==="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push((o)=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),f6=P("$ZodCheckStartsWith",(e,t)=>{fn.init(e,t);let n=new RegExp(`^${$s(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=(r)=>{if(r.value.startsWith(t.prefix))return;r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),m6=P("$ZodCheckEndsWith",(e,t)=>{fn.init(e,t);let n=new RegExp(`.*${$s(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=(r)=>{if(r.value.endsWith(t.suffix))return;r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});var h6=P("$ZodCheckOverwrite",(e,t)=>{fn.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class bR{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
114
+ `).filter((s)=>s),r=Math.min(...n.map((s)=>s.length-s.trimStart().length)),o=n.map((s)=>s.slice(r)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let e=Function,t=this?.args,r=[...(this?.content??[""]).map((o)=>` ${o}`)];return new e(...t,r.join(`
115
+ `))}}var _6={major:4,minor:4,patch:3};var Xe=P("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=_6;let r=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))r.unshift(e);for(let o of r)for(let s of o._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(i,a,c)=>{let l=Fi(i),u;for(let p of a){if(p._zod.def.when){if(pR(i))continue;if(!p._zod.def.when(i))continue}else if(l)continue;let f=i.issues.length,m=p._zod.check(i);if(m instanceof Promise&&c?.async===!1)throw new Us;if(u||m instanceof Promise)u=(u??Promise.resolve()).then(async()=>{if(await m,i.issues.length===f)return;if(!l)l=Fi(i,f)});else{if(i.issues.length===f)continue;if(!l)l=Fi(i,f)}}if(u)return u.then(()=>i);return i},s=(i,a,c)=>{if(Fi(i))return i.aborted=!0,i;let l=o(a,r,c);if(l instanceof Promise){if(c.async===!1)throw new Us;return l.then((u)=>e._zod.parse(u,c))}return e._zod.parse(l,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let l=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});if(l instanceof Promise)return l.then((u)=>s(u,i,a));return s(l,i,a)}let c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Us;return c.then((l)=>o(l,r,a))}return o(c,r,a)}}ze(e,"~standard",()=>({validate:(o)=>{try{let s=lc(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch(s){return uc(e,o).then((i)=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Om=P("$ZodString",(e,t)=>{Xe.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Z4(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),ft=P("$ZodStringFormat",(e,t)=>{Rm.init(e,t),Om.init(e,t)}),xR=P("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=L4),ft.init(e,t)}),vR=P("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=gR(r))}else t.pattern??(t.pattern=gR());ft.init(e,t)}),wR=P("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=N4),ft.init(e,t)}),AR=P("$ZodURL",(e,t)=>{ft.init(e,t),e._zod.check=(n)=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===H4.source){if(!/^https?:\/\//i.test(r)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}}let o=new URL(r);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(o.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})}if(t.normalize)n.value=o.href;else n.value=r;return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),TR=P("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=M4()),ft.init(e,t)}),CR=P("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=I4),ft.init(e,t)}),kR=P("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=C4),ft.init(e,t)}),RR=P("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=k4),ft.init(e,t)}),OR=P("$ZodULID",(e,t)=>{t.pattern??(t.pattern=R4),ft.init(e,t)}),PR=P("$ZodXID",(e,t)=>{t.pattern??(t.pattern=O4),ft.init(e,t)}),IR=P("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=P4),ft.init(e,t)}),T6=P("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=q4(t)),ft.init(e,t)}),C6=P("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=G4),ft.init(e,t)}),k6=P("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=V4(t)),ft.init(e,t)}),R6=P("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=D4),ft.init(e,t)}),DR=P("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=U4),ft.init(e,t),e._zod.bag.format="ipv4"}),LR=P("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=F4),ft.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(n)=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}});var NR=P("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=$4),ft.init(e,t)}),MR=P("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=z4),ft.init(e,t),e._zod.check=(n)=>{let r=n.value.split("/");try{if(r.length!==2)throw Error();let[o,s]=r;if(!s)throw Error();let i=Number(s);if(`${i}`!==s)throw Error();if(i<0||i>128)throw Error();new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function O6(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var UR=P("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=j4),ft.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(n)=>{if(O6(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function WHe(e){if(!_R.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return O6(n)}var FR=P("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=_R),ft.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(n)=>{if(WHe(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),$R=P("$ZodE164",(e,t)=>{t.pattern??(t.pattern=B4),ft.init(e,t)});function VHe(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var zR=P("$ZodJWT",(e,t)=>{ft.init(e,t),e._zod.check=(n)=>{if(VHe(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});var vS=P("$ZodNumber",(e,t)=>{Xe.init(e,t),e._zod.pattern=e._zod.bag.pattern??bS,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(i){}let o=n.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let s=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?"Infinity":void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),jR=P("$ZodNumberFormat",(e,t)=>{s6.init(e,t),vS.init(e,t)}),HR=P("$ZodBoolean",(e,t)=>{Xe.init(e,t),e._zod.pattern=X4,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(s){}let o=n.value;if(typeof o==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),BR=P("$ZodBigInt",(e,t)=>{Xe.init(e,t),e._zod.pattern=Y4,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(o){}if(typeof n.value==="bigint")return n;return n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}});var KR=P("$ZodUndefined",(e,t)=>{Xe.init(e,t),e._zod.pattern=e6,e._zod.values=new Set([void 0]),e._zod.parse=(n,r)=>{let o=n.value;if(typeof o>"u")return n;return n.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),n}}),GR=P("$ZodNull",(e,t)=>{Xe.init(e,t),e._zod.pattern=Q4,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{let o=n.value;if(o===null)return n;return n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}});var WR=P("$ZodUnknown",(e,t)=>{Xe.init(e,t),e._zod.parse=(n)=>n}),VR=P("$ZodNever",(e,t)=>{Xe.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});var qR=P("$ZodDate",(e,t)=>{Xe.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(a){}let o=n.value,s=o instanceof Date;if(s&&!Number.isNaN(o.getTime()))return n;return n.issues.push({expected:"date",code:"invalid_type",input:o,...s?{received:"Invalid Date"}:{},inst:e}),n}});function y6(e,t,n){if(e.issues.length)t.issues.push(...zs(n,e.issues));t.value[n]=e.value}var ZR=P("$ZodArray",(e,t)=>{Xe.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let a=o[i],c=t.element._zod.run({value:a,issues:[]},r);if(c instanceof Promise)s.push(c.then((l)=>y6(l,n,i)));else y6(c,n,i)}if(s.length)return Promise.all(s).then(()=>n);return n}});function xS(e,t,n,r,o,s){let i=n in r;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...zs(n,e.issues))}if(!i&&!o){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(e.value===void 0){if(i)t.value[n]=void 0}else t.value[n]=e.value}function P6(e){let t=Object.keys(e.shape);for(let r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${r}": expected a Zod schema`);let n=uR(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function I6(e,t,n,r,o,s){let i=[],a=o.keySet,c=o.catchall._zod,l=c.def.type,u=c.optin==="optional",p=c.optout==="optional";for(let f in t){if(f==="__proto__")continue;if(a.has(f))continue;if(l==="never"){i.push(f);continue}let m=c.run({value:t[f],issues:[]},r);if(m instanceof Promise)e.push(m.then((h)=>xS(h,n,f,t,u,p)));else xS(m,n,f,t,u,p)}if(i.length)n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s});if(!e.length)return n;return Promise.all(e).then(()=>n)}var YR=P("$ZodObject",(e,t)=>{if(Xe.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let r=Ku(()=>P6(t));ze(e._zod,"propValues",()=>{let a=t.shape,c={};for(let l in a){let u=a[l]._zod;if(u.values){c[l]??(c[l]=new Set);for(let p of u.values)c[l].add(p)}}return c});let o=cc,s=t.catchall,i;e._zod.parse=(a,c)=>{i??(i=r.value);let l=a.value;if(!o(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a;a.value={};let u=[],p=i.shape;for(let f of i.keys){let m=p[f],h=m._zod.optin==="optional",y=m._zod.optout==="optional",_=m._zod.run({value:l[f],issues:[]},c);if(_ instanceof Promise)u.push(_.then((E)=>xS(E,a,f,l,h,y)));else xS(_,a,f,l,h,y)}if(!s)return u.length?Promise.all(u).then(()=>a):a;return I6(u,l,a,c,r.value,e)}}),D6=P("$ZodObjectJIT",(e,t)=>{YR.init(e,t);let n=e._zod.parse,r=Ku(()=>P6(t)),o=(f)=>{let m=new bR(["shape","payload","ctx"]),h=r.value,y=(x)=>{let v=mS(x);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};m.write("const input = payload.value;");let _=Object.create(null),E=0;for(let x of h.keys)_[x]=`key_${E++}`;m.write("const newResult = {};");for(let x of h.keys){let v=_[x],w=mS(x),U=f[x],L=U?._zod?.optin==="optional",F=U?._zod?.optout==="optional";if(m.write(`const ${v} = ${y(x)};`),L&&F)m.write(`
116
+ if (${v}.issues.length) {
117
+ if (${w} in input) {
118
+ payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
119
+ ...iss,
120
+ path: iss.path ? [${w}, ...iss.path] : [${w}]
121
+ })));
122
+ }
123
+ }
124
+
125
+ if (${v}.value === undefined) {
126
+ if (${w} in input) {
127
+ newResult[${w}] = undefined;
128
+ }
129
+ } else {
130
+ newResult[${w}] = ${v}.value;
131
+ }
132
+
133
+ `);else if(!L)m.write(`
134
+ const ${v}_present = ${w} in input;
135
+ if (${v}.issues.length) {
136
+ payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
137
+ ...iss,
138
+ path: iss.path ? [${w}, ...iss.path] : [${w}]
139
+ })));
140
+ }
141
+ if (!${v}_present && !${v}.issues.length) {
142
+ payload.issues.push({
143
+ code: "invalid_type",
144
+ expected: "nonoptional",
145
+ input: undefined,
146
+ path: [${w}]
147
+ });
148
+ }
149
+
150
+ if (${v}_present) {
151
+ if (${v}.value === undefined) {
152
+ newResult[${w}] = undefined;
153
+ } else {
154
+ newResult[${w}] = ${v}.value;
155
+ }
156
+ }
157
+
158
+ `);else m.write(`
159
+ if (${v}.issues.length) {
160
+ payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
161
+ ...iss,
162
+ path: iss.path ? [${w}, ...iss.path] : [${w}]
163
+ })));
164
+ }
165
+
166
+ if (${v}.value === undefined) {
167
+ if (${w} in input) {
168
+ newResult[${w}] = undefined;
169
+ }
170
+ } else {
171
+ newResult[${w}] = ${v}.value;
172
+ }
173
+
174
+ `)}m.write("payload.value = newResult;"),m.write("return payload;");let S=m.compile();return(x,v)=>S(f,x,v)},s,i=cc,a=!Hu.jitless,l=a&&aR.value,u=t.catchall,p;e._zod.parse=(f,m)=>{p??(p=r.value);let h=f.value;if(!i(h))return f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f;if(a&&l&&m?.async===!1&&m.jitless!==!0){if(!s)s=o(t.shape);if(f=s(f,m),!u)return f;return I6([],h,f,m,p,e)}return n(f,m)}});function S6(e,t,n,r){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter((s)=>!Fi(s));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((s)=>s.issues.map((i)=>Vr(i,r,ar())))}),t}var wS=P("$ZodUnion",(e,t)=>{Xe.init(e,t),ze(e._zod,"optin",()=>t.options.some((r)=>r._zod.optin==="optional")?"optional":void 0),ze(e._zod,"optout",()=>t.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),ze(e._zod,"values",()=>{if(t.options.every((r)=>r._zod.values))return new Set(t.options.flatMap((r)=>Array.from(r._zod.values)));return}),ze(e._zod,"pattern",()=>{if(t.options.every((r)=>r._zod.pattern)){let r=t.options.map((o)=>o._zod.pattern);return new RegExp(`^(${r.map((o)=>xm(o.source)).join("|")})$`)}return});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}if(!s)return S6(i,r,e,o);return Promise.all(i).then((a)=>S6(a,r,e,o))}});var JR=P("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,wS.init(e,t);let n=e._zod.parse;ze(e._zod,"propValues",()=>{let o={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){if(!o[a])o[a]=new Set;for(let l of c)o[a].add(l)}}return o});let r=Ku(()=>{let o=t.options,s=new Map;for(let i of o){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(o,s)=>{let i=o.value;if(!cc(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=r.value.get(i?.[t.discriminator]);if(a)return a._zod.run(o,s);if(t.unionFallback||s.direction==="backward")return n(o,s);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()),input:i,path:[t.discriminator],inst:e}),o}}),XR=P("$ZodIntersection",(e,t)=>{Xe.init(e,t),e._zod.parse=(n,r)=>{let o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([c,l])=>b6(n,c,l));return b6(n,s,i)}});function ER(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(Ui(e)&&Ui(t)){let n=Object.keys(t),r=Object.keys(e).filter((s)=>n.indexOf(s)!==-1),o={...e,...t};for(let s of r){let i=ER(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let o=e[r],s=t[r],i=ER(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function b6(e,t,n){let r=new Map,o;for(let a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(let c of a.keys){if(!r.has(c))r.set(c,{});r.get(c).l=!0}}else e.issues.push(a);for(let a of n.issues)if(a.code==="unrecognized_keys")for(let c of a.keys){if(!r.has(c))r.set(c,{});r.get(c).r=!0}else e.issues.push(a);let s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o)e.issues.push({...o,keys:s});if(Fi(e))return e;let i=ER(t.value,n.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var QR=P("$ZodRecord",(e,t)=>{Xe.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;if(!Ui(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;let s=[],i=t.keyType._zod.values;if(i){n.value={};let a=new Set;for(let l of i)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){a.add(typeof l==="number"?l.toString():l);let u=t.keyType._zod.run({value:l,issues:[]},r);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map((m)=>Vr(m,r,ar())),input:l,path:[l],inst:e});continue}let p=u.value,f=t.valueType._zod.run({value:o[l],issues:[]},r);if(f instanceof Promise)s.push(f.then((m)=>{if(m.issues.length)n.issues.push(...zs(l,m.issues));n.value[p]=m.value}));else{if(f.issues.length)n.issues.push(...zs(l,f.issues));n.value[p]=f.value}}let c;for(let l in o)if(!a.has(l))c=c??[],c.push(l);if(c&&c.length>0)n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{n.value={};for(let a of Reflect.ownKeys(o)){if(a==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(o,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},r);if(c instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof a==="string"&&bS.test(a)&&c.issues.length){let p=t.keyType._zod.run({value:Number(a),issues:[]},r);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(p.issues.length===0)c=p}if(c.issues.length){if(t.mode==="loose")n.value[a]=o[a];else n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map((p)=>Vr(p,r,ar())),input:a,path:[a],inst:e});continue}let u=t.valueType._zod.run({value:o[a],issues:[]},r);if(u instanceof Promise)s.push(u.then((p)=>{if(p.issues.length)n.issues.push(...zs(a,p.issues));n.value[c.value]=p.value}));else{if(u.issues.length)n.issues.push(...zs(a,u.issues));n.value[c.value]=u.value}}}if(s.length)return Promise.all(s).then(()=>n);return n}});var eO=P("$ZodEnum",(e,t)=>{Xe.init(e,t);let n=bm(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter((o)=>lR.has(typeof o)).map((o)=>typeof o==="string"?$s(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{let i=o.value;if(r.has(i))return o;return o.issues.push({code:"invalid_value",values:n,input:i,inst:e}),o}}),tO=P("$ZodLiteral",(e,t)=>{if(Xe.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map((r)=>typeof r==="string"?$s(r):r?$s(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{let s=r.value;if(n.has(s))return r;return r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}});var nO=P("$ZodTransform",(e,t)=>{Xe.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ym(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then((i)=>(n.value=i,n.fallback=!0,n));if(o instanceof Promise)throw new Us;return n.value=o,n.fallback=!0,n}});function E6(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var AS=P("$ZodOptional",(e,t)=>{Xe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ze(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ze(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${xm(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){let o=n.value,s=t.innerType._zod.run(n,r);if(s instanceof Promise)return s.then((i)=>E6(i,o));return E6(s,o)}if(n.value===void 0)return n;return t.innerType._zod.run(n,r)}}),rO=P("$ZodExactOptional",(e,t)=>{AS.init(e,t),ze(e._zod,"values",()=>t.innerType._zod.values),ze(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),oO=P("$ZodNullable",(e,t)=>{Xe.init(e,t),ze(e._zod,"optin",()=>t.innerType._zod.optin),ze(e._zod,"optout",()=>t.innerType._zod.optout),ze(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${xm(n.source)}|null)$`):void 0}),ze(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>{if(n.value===null)return n;return t.innerType._zod.run(n,r)}}),sO=P("$ZodDefault",(e,t)=>{Xe.init(e,t),e._zod.optin="optional",ze(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then((s)=>x6(s,t));return x6(o,t)}});function x6(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var iO=P("$ZodPrefault",(e,t)=>{Xe.init(e,t),e._zod.optin="optional",ze(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)n.value=t.defaultValue;return t.innerType._zod.run(n,r)}}),aO=P("$ZodNonOptional",(e,t)=>{Xe.init(e,t),ze(e._zod,"values",()=>{let n=t.innerType._zod.values;return n?new Set([...n].filter((r)=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then((s)=>v6(s,e));return v6(o,e)}});function v6(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var cO=P("$ZodCatch",(e,t)=>{Xe.init(e,t),e._zod.optin="optional",ze(e._zod,"optout",()=>t.innerType._zod.optout),ze(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then((s)=>{if(n.value=s.value,n.issues=s.issues,s.issues.length)n.value=t.catchValue({...n,error:{issues:s.issues.map((i)=>Vr(i,r,ar()))},input:n.value}),n.issues=[],n.fallback=!0;return n});if(n.value=o.value,n.issues=o.issues,o.issues.length)n.value=t.catchValue({...n,error:{issues:o.issues.map((s)=>Vr(s,r,ar()))},input:n.value}),n.issues=[],n.fallback=!0;return n}});var TS=P("$ZodPipe",(e,t)=>{Xe.init(e,t),ze(e._zod,"values",()=>t.in._zod.values),ze(e._zod,"optin",()=>t.in._zod.optin),ze(e._zod,"optout",()=>t.out._zod.optout),ze(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let s=t.out._zod.run(n,r);if(s instanceof Promise)return s.then((i)=>ES(i,t.in,r));return ES(s,t.in,r)}let o=t.in._zod.run(n,r);if(o instanceof Promise)return o.then((s)=>ES(s,t.out,r));return ES(o,t.out,r)}});function ES(e,t,n){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var L6=P("$ZodPreprocess",(e,t)=>{TS.init(e,t)}),lO=P("$ZodReadonly",(e,t)=>{Xe.init(e,t),ze(e._zod,"propValues",()=>t.innerType._zod.propValues),ze(e._zod,"values",()=>t.innerType._zod.values),ze(e._zod,"optin",()=>t.innerType?._zod?.optin),ze(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then(w6);return w6(o)}});function w6(e){return e.value=Object.freeze(e.value),e}var uO=P("$ZodLazy",(e,t)=>{Xe.init(e,t),ze(e._zod,"innerType",()=>{let n=t;if(!n._cachedInner)n._cachedInner=t.getter();return n._cachedInner}),ze(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),ze(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),ze(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),ze(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),dO=P("$ZodCustom",(e,t)=>{fn.init(e,t),Xe.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=(n)=>{let r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then((s)=>A6(s,n,r,e));A6(o,n,r,e);return}});function A6(e,t,n,r){if(!e){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};if(r._zod.def.params)o.params=r._zod.def.params;t.issues.push(Gu(o))}}var qHe=()=>{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(o){return e[o]??null}let n={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"},r={nan:"NaN"};return(o)=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,i=fR(o.input),a=r[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${gS(o.values[0])}`;return`Invalid option: expected one of ${fS(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Too big: expected ${o.origin??"value"} to have ${s}${o.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",i=t(o.origin);if(i)return`Too small: expected ${o.origin} to have ${s}${o.minimum.toString()} ${i.unit}`;return`Too small: expected ${o.origin} to be ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${n[s.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${fS(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":if(o.options&&Array.isArray(o.options)&&o.options.length>0)return`Invalid discriminator value. Expected ${o.options.map((i)=>`'${i}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function pO(){return{localeError:qHe()}}var N6,ZHe=Symbol("ZodOutput"),YHe=Symbol("ZodInput");class M6{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==="object"&&"id"in n)this._idmap.set(n.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function U6(){return new M6}(N6=globalThis).__zod_globalRegistry??(N6.__zod_globalRegistry=U6());var ko=globalThis.__zod_globalRegistry;function fO(e,t){return new e({type:"string",...le(t)})}function F6(e,t){return new e({type:"string",coerce:!0,...le(t)})}function mO(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...le(t)})}function CS(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...le(t)})}function hO(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...le(t)})}function gO(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...le(t)})}function _O(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...le(t)})}function yO(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...le(t)})}function SO(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...le(t)})}function bO(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...le(t)})}function EO(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...le(t)})}function xO(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...le(t)})}function vO(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...le(t)})}function wO(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...le(t)})}function AO(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...le(t)})}function TO(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...le(t)})}function CO(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...le(t)})}function kO(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...le(t)})}function RO(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...le(t)})}function OO(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...le(t)})}function PO(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...le(t)})}function IO(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...le(t)})}function DO(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...le(t)})}function LO(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...le(t)})}function $6(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...le(t)})}function z6(e,t){return new e({type:"string",format:"date",check:"string_format",...le(t)})}function j6(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...le(t)})}function H6(e,t){return new e({type:"string",format:"duration",check:"string_format",...le(t)})}function NO(e,t){return new e({type:"number",checks:[],...le(t)})}function B6(e,t){return new e({type:"number",coerce:!0,checks:[],...le(t)})}function MO(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...le(t)})}function UO(e,t){return new e({type:"boolean",...le(t)})}function K6(e,t){return new e({type:"boolean",coerce:!0,...le(t)})}function G6(e,t){return new e({type:"bigint",coerce:!0,...le(t)})}function FO(e,t){return new e({type:"undefined",...le(t)})}function $O(e,t){return new e({type:"null",...le(t)})}function zO(e){return new e({type:"unknown"})}function jO(e,t){return new e({type:"never",...le(t)})}function W6(e,t){return new e({type:"date",coerce:!0,...le(t)})}function Vu(e,t){return new yR({check:"less_than",...le(t),value:e,inclusive:!1})}function js(e,t){return new yR({check:"less_than",...le(t),value:e,inclusive:!0})}function qu(e,t){return new SR({check:"greater_than",...le(t),value:e,inclusive:!1})}function Ro(e,t){return new SR({check:"greater_than",...le(t),value:e,inclusive:!0})}function Pm(e,t){return new o6({check:"multiple_of",...le(t),value:e})}function kS(e,t){return new i6({check:"max_length",...le(t),maximum:e})}function Zu(e,t){return new a6({check:"min_length",...le(t),minimum:e})}function RS(e,t){return new c6({check:"length_equals",...le(t),length:e})}function HO(e,t){return new l6({check:"string_format",format:"regex",...le(t),pattern:e})}function BO(e){return new u6({check:"string_format",format:"lowercase",...le(e)})}function KO(e){return new d6({check:"string_format",format:"uppercase",...le(e)})}function GO(e,t){return new p6({check:"string_format",format:"includes",...le(t),includes:e})}function WO(e,t){return new f6({check:"string_format",format:"starts_with",...le(t),prefix:e})}function VO(e,t){return new m6({check:"string_format",format:"ends_with",...le(t),suffix:e})}function $i(e){return new h6({check:"overwrite",tx:e})}function qO(e){return $i((t)=>t.normalize(e))}function ZO(){return $i((e)=>e.trim())}function YO(){return $i((e)=>e.toLowerCase())}function JO(){return $i((e)=>e.toUpperCase())}function XO(){return $i((e)=>iR(e))}function V6(e,t,n){return new e({type:"array",element:t,...le(n)})}function QO(e,t,n){let r=le(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function eP(e,t,n){return new e({type:"custom",check:"custom",fn:t,...le(n)})}function tP(e,t){let n=JHe((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(Gu(o,r.value,n._zod.def));else{let s=o;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(Gu(s))}},e(r.value,r)),t);return n}function JHe(e,t){let n=new fn({check:"custom",...le(t)});return n._zod.check=e,n}function Dm(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??ko,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}}function ut(e,t,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,n.schemaPath.includes(e))s.cycle=n.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let u={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,u);else{let f=i.schema,m=t.processors[o.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,f,u)}let p=e._zod.parent;if(p){if(!i.ref)i.ref=p;ut(p,t,u),t.seen.get(p).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Object.assign(i.schema,c);if(t.io==="input"&&$n(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&"_prefault"in i.schema)(r=i.schema).default??(r.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function Lm(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let r=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=r.get(a);if(c&&c!==i[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,i[0])}}let o=(i)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(i[0])?.id,f=e.external.uri??((h)=>h);if(p)return{ref:f(p)};let m=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=m,{defId:m,ref:`${f("__shared")}#/${a}/${m}`}}if(i[1]===n)return{ref:"#"};let l=`${"#"}/${a}/`,u=i[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+u}},s=(i)=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:l}=o(i);if(a.def={...a.schema},l)a.defId=l;let u=a.schema;for(let p in u)delete u[p];u.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
175
+
176
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let l=e.external.registry.get(i[0])?.id;if(t!==i[0]&&l){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1){if(e.reused==="ref"){s(i);continue}}}}function Nm(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},p=c.ref;if(c.ref=null,p){r(p);let m=e.seen.get(p),h=m.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(h);else Object.assign(l,h);if(Object.assign(l,u),a._zod.parent===p)for(let _ in l){if(_==="$ref"||_==="allOf")continue;if(!(_ in u))delete l[_]}if(h.$ref&&m.def)for(let _ in l){if(_==="$ref"||_==="allOf")continue;if(_ in m.def&&JSON.stringify(l[_])===JSON.stringify(m.def[_]))delete l[_]}}let f=a._zod.parent;if(f&&f!==p){r(f);let m=e.seen.get(f);if(m?.schema.$ref){if(l.$ref=m.schema.$ref,m.def)for(let h in l){if(h==="$ref"||h==="allOf")continue;if(h in m.def&&JSON.stringify(l[h])===JSON.stringify(m.def[h]))delete l[h]}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())r(a[0]);let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,n.def??n.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&o.id===s)delete o.id;let i=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;i[c.defId]=c.def}}if(e.external);else if(Object.keys(i).length>0)if(e.target==="draft-2020-12")o.$defs=i;else o.definitions=i;try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Im(t,"input",e.processors),output:Im(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function $n(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return $n(r.element,n);if(r.type==="set")return $n(r.valueType,n);if(r.type==="lazy")return $n(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return $n(r.innerType,n);if(r.type==="intersection")return $n(r.left,n)||$n(r.right,n);if(r.type==="record"||r.type==="map")return $n(r.keyType,n)||$n(r.valueType,n);if(r.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return $n(r.in,n)||$n(r.out,n)}if(r.type==="object"){for(let o in r.shape)if($n(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(let o of r.options)if($n(o,n))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if($n(o,n))return!0;if(r.rest&&$n(r.rest,n))return!0;return!1}return!1}var q6=(e,t={})=>(n)=>{let r=Dm({...n,processors:t});return ut(e,r),Lm(r,e),Nm(r,e)},Im=(e,t,n={})=>(r)=>{let{libraryOptions:o,target:s}=r??{},i=Dm({...o??{},target:s,io:t,processors:n});return ut(e,i),Lm(i,e),Nm(i,e)};var XHe={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},nP=(e,t,n,r)=>{let o=n;o.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof s==="number")o.minLength=s;if(typeof i==="number")o.maxLength=i;if(a){if(o.format=XHe[a]??a,o.format==="")delete o.format;if(a==="time")delete o.format}if(l)o.contentEncoding=l;if(c&&c.size>0){let u=[...c];if(u.length===1)o.pattern=u[0].source;else if(u.length>1)o.allOf=[...u.map((p)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))]}},rP=(e,t,n,r)=>{let o=n,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;if(typeof a==="string"&&a.includes("int"))o.type="integer";else o.type="number";let p=typeof u==="number"&&u>=(s??Number.NEGATIVE_INFINITY),f=typeof l==="number"&&l<=(i??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(p)if(m)o.minimum=u,o.exclusiveMinimum=!0;else o.exclusiveMinimum=u;else if(typeof s==="number")o.minimum=s;if(f)if(m)o.maximum=l,o.exclusiveMaximum=!0;else o.exclusiveMaximum=l;else if(typeof i==="number")o.maximum=i;if(typeof c==="number")o.multipleOf=c},oP=(e,t,n,r)=>{n.type="boolean"},sP=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},Y6=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},iP=(e,t,n,r)=>{if(t.target==="openapi-3.0")n.type="string",n.nullable=!0,n.enum=[null];else n.type="null"},aP=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},J6=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},cP=(e,t,n,r)=>{n.not={}},X6=(e,t,n,r)=>{},lP=(e,t,n,r)=>{},uP=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},dP=(e,t,n,r)=>{let o=e._zod.def,s=bm(o.entries);if(s.every((i)=>typeof i==="number"))n.type="number";if(s.every((i)=>typeof i==="string"))n.type="string";n.enum=s},pP=(e,t,n,r)=>{let o=e._zod.def,s=[];for(let i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else s.push(Number(i));else s.push(i);if(s.length===0);else if(s.length===1){let i=s[0];if(n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0")n.enum=[i];else n.const=i}else{if(s.every((i)=>typeof i==="number"))n.type="number";if(s.every((i)=>typeof i==="string"))n.type="string";if(s.every((i)=>typeof i==="boolean"))n.type="boolean";if(s.every((i)=>i===null))n.type="null";n.enum=s}},Q6=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},e3=(e,t,n,r)=>{let o=n,s=e._zod.pattern;if(!s)throw Error("Pattern not found in template literal");o.type="string",o.pattern=s.source},t3=(e,t,n,r)=>{let o=n,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:a,mime:c}=e._zod.bag;if(i!==void 0)s.minLength=i;if(a!==void 0)s.maxLength=a;if(c)if(c.length===1)s.contentMediaType=c[0],Object.assign(o,s);else Object.assign(o,s),o.anyOf=c.map((l)=>({contentMediaType:l}));else Object.assign(o,s)},n3=(e,t,n,r)=>{n.type="boolean"},fP=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},r3=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},mP=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},o3=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},s3=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},hP=(e,t,n,r)=>{let o=n,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;if(typeof i==="number")o.minItems=i;if(typeof a==="number")o.maxItems=a;o.type="array",o.items=ut(s.element,t,{...r,path:[...r.path,"items"]})},gP=(e,t,n,r)=>{let o=n,s=e._zod.def;o.type="object",o.properties={};let i=s.shape;for(let l in i)o.properties[l]=ut(i[l],t,{...r,path:[...r.path,"properties",l]});let a=new Set(Object.keys(i)),c=new Set([...a].filter((l)=>{let u=s.shape[l]._zod;if(t.io==="input")return u.optin===void 0;else return u.optout===void 0}));if(c.size>0)o.required=Array.from(c);if(s.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")o.additionalProperties=!1}else if(s.catchall)o.additionalProperties=ut(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})},_P=(e,t,n,r)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>ut(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));if(s)n.oneOf=i;else n.anyOf=i},yP=(e,t,n,r)=>{let o=e._zod.def,s=ut(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=ut(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=(l)=>("allOf"in l)&&Object.keys(l).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=c},i3=(e,t,n,r)=>{let o=n,s=e._zod.def;o.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=s.items.map((f,m)=>ut(f,t,{...r,path:[...r.path,i,m]})),l=s.rest?ut(s.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(o.prefixItems=c,l)o.items=l}else if(t.target==="openapi-3.0"){if(o.items={anyOf:c},l)o.items.anyOf.push(l);if(o.minItems=c.length,!l)o.maxItems=c.length}else if(o.items=c,l)o.additionalItems=l;let{minimum:u,maximum:p}=e._zod.bag;if(typeof u==="number")o.minItems=u;if(typeof p==="number")o.maxItems=p},SP=(e,t,n,r)=>{let o=n,s=e._zod.def;o.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let u=ut(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let p of c)o.patternProperties[p.source]=u}else{if(t.target==="draft-07"||t.target==="draft-2020-12")o.propertyNames=ut(s.keyType,t,{...r,path:[...r.path,"propertyNames"]});o.additionalProperties=ut(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let l=i._zod.values;if(l){let u=[...l].filter((p)=>typeof p==="string"||typeof p==="number");if(u.length>0)o.required=u}},bP=(e,t,n,r)=>{let o=e._zod.def,s=ut(o.innerType,t,r),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=o.innerType,n.nullable=!0;else n.anyOf=[s,{type:"null"}]},EP=(e,t,n,r)=>{let o=e._zod.def;ut(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType},xP=(e,t,n,r)=>{let o=e._zod.def;ut(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},vP=(e,t,n,r)=>{let o=e._zod.def;ut(o.innerType,t,r);let s=t.seen.get(e);if(s.ref=o.innerType,t.io==="input")n._prefault=JSON.parse(JSON.stringify(o.defaultValue))},wP=(e,t,n,r)=>{let o=e._zod.def;ut(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},AP=(e,t,n,r)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;ut(i,t,r);let a=t.seen.get(e);a.ref=i},TP=(e,t,n,r)=>{let o=e._zod.def;ut(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},a3=(e,t,n,r)=>{let o=e._zod.def;ut(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType},OS=(e,t,n,r)=>{let o=e._zod.def;ut(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType},CP=(e,t,n,r)=>{let o=e._zod.innerType;ut(o,t,r);let s=t.seen.get(e);s.ref=o},Z6={string:nP,number:rP,boolean:oP,bigint:sP,symbol:Y6,null:iP,undefined:aP,void:J6,never:cP,any:X6,unknown:lP,date:uP,enum:dP,literal:pP,nan:Q6,template_literal:e3,file:t3,success:n3,custom:fP,function:r3,transform:mP,map:o3,set:s3,array:hP,object:gP,union:_P,intersection:yP,tuple:i3,record:SP,nullable:bP,nonoptional:EP,default:xP,prefault:vP,catch:wP,pipe:AP,readonly:TP,promise:a3,optional:OS,lazy:CP};function kP(e,t){if("_idmap"in e){let r=e,o=Dm({...t,processors:Z6}),s={};for(let c of r._idmap.entries()){let[l,u]=c;ut(u,o)}let i={},a={registry:r,uri:t?.uri,defs:s};o.external=a;for(let c of r._idmap.entries()){let[l,u]=c;Lm(o,u),i[l]=Nm(o,u)}if(Object.keys(s).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[c]:s}}return{schemas:i}}let n=Dm({...t,processors:Z6});return ut(e,n),Lm(n,e),Nm(n,e)}var Mm={};on(Mm,{ZodISODate:()=>u3,ZodISODateTime:()=>l3,ZodISODuration:()=>p3,ZodISOTime:()=>d3,date:()=>OP,datetime:()=>RP,duration:()=>IP,time:()=>PP});var l3=P("ZodISODateTime",(e,t)=>{T6.init(e,t),xt.init(e,t)});function RP(e){return $6(l3,e)}var u3=P("ZodISODate",(e,t)=>{C6.init(e,t),xt.init(e,t)});function OP(e){return z6(u3,e)}var d3=P("ZodISOTime",(e,t)=>{k6.init(e,t),xt.init(e,t)});function PP(e){return j6(d3,e)}var p3=P("ZodISODuration",(e,t)=>{R6.init(e,t),xt.init(e,t)});function IP(e){return H6(p3,e)}var sBe=(e,t)=>{_S.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(n)=>hR(e,n)},flatten:{value:(n)=>mR(e,n)},addIssue:{value:(n)=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Bu,2)}},addIssues:{value:(n)=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Bu,2)}},isEmpty:{get(){return e.issues.length===0}}})};var Pr=P("ZodError",sBe,{Parent:Error});var m3=Am(Pr),h3=Tm(Pr),g3=Cm(Pr),_3=km(Pr),y3=S4(Pr),S3=b4(Pr),b3=E4(Pr),E3=x4(Pr),x3=v4(Pr),v3=w4(Pr),w3=A4(Pr),A3=T4(Pr);var T3=new WeakMap;function Um(e,t,n){let r=Object.getPrototypeOf(e),o=T3.get(r);if(!o)o=new Set,T3.set(r,o);if(o.has(t))return;o.add(t);for(let s in n){let i=n[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}var ct=P("ZodType",(e,t)=>(Xe.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Im(e,"input"),output:Im(e,"output")}}),e.toJSONSchema=q6(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>m3(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>g3(e,n,r),e.parseAsync=async(n,r)=>h3(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>_3(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>y3(e,n,r),e.decode=(n,r)=>S3(e,n,r),e.encodeAsync=async(n,r)=>b3(e,n,r),e.decodeAsync=async(n,r)=>E3(e,n,r),e.safeEncode=(n,r)=>x3(e,n,r),e.safeDecode=(n,r)=>v3(e,n,r),e.safeEncodeAsync=async(n,r)=>w3(e,n,r),e.safeDecodeAsync=async(n,r)=>A3(e,n,r),Um(e,"ZodType",{check(...n){let r=this.def;return this.clone(Ue.mergeDefs(r,{checks:[...r.checks??[],...n.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return Fn(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(R2e(n,r))},superRefine(n,r){return this.check(O2e(n,r))},overwrite(n){return this.check($i(n))},optional(){return vt(this)},exactOptional(){return g2e(this)},nullable(){return R3(this)},nullish(){return vt(R3(this))},nonoptional(n){return x2e(this,n)},array(){return D(this)},or(n){return de([this,n])},and(n){return DS(this,n)},transform(n){return O3(this,F3(n))},default(n){return S2e(this,n)},prefault(n){return E2e(this,n)},catch(n){return w2e(this,n)},pipe(n){return O3(this,n)},readonly(){return C2e(this)},describe(n){let r=this.clone();return ko.add(r,{description:n}),r},meta(...n){if(n.length===0)return ko.get(this);let r=this.clone();return ko.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return ko.get(e)?.description},configurable:!0}),e)),P3=P("_ZodString",(e,t)=>{Om.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(r,o,s)=>nP(e,r,o,s);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Um(e,"_ZodString",{regex(...r){return this.check(HO(...r))},includes(...r){return this.check(GO(...r))},startsWith(...r){return this.check(WO(...r))},endsWith(...r){return this.check(VO(...r))},min(...r){return this.check(Zu(...r))},max(...r){return this.check(kS(...r))},length(...r){return this.check(RS(...r))},nonempty(...r){return this.check(Zu(1,...r))},lowercase(r){return this.check(BO(r))},uppercase(r){return this.check(KO(r))},trim(){return this.check(ZO())},normalize(...r){return this.check(qO(...r))},toLowerCase(){return this.check(YO())},toUpperCase(){return this.check(JO())},slugify(){return this.check(XO())}})}),NP=P("ZodString",(e,t)=>{Om.init(e,t),P3.init(e,t),e.email=(n)=>e.check(mO(HBe,n)),e.url=(n)=>e.check(SO(BBe,n)),e.jwt=(n)=>e.check(LO(o2e,n)),e.emoji=(n)=>e.check(bO(KBe,n)),e.guid=(n)=>e.check(CS(C3,n)),e.uuid=(n)=>e.check(hO(PS,n)),e.uuidv4=(n)=>e.check(gO(PS,n)),e.uuidv6=(n)=>e.check(_O(PS,n)),e.uuidv7=(n)=>e.check(yO(PS,n)),e.nanoid=(n)=>e.check(EO(GBe,n)),e.guid=(n)=>e.check(CS(C3,n)),e.cuid=(n)=>e.check(xO(WBe,n)),e.cuid2=(n)=>e.check(vO(VBe,n)),e.ulid=(n)=>e.check(wO(qBe,n)),e.base64=(n)=>e.check(PO(t2e,n)),e.base64url=(n)=>e.check(IO(n2e,n)),e.xid=(n)=>e.check(AO(ZBe,n)),e.ksuid=(n)=>e.check(TO(YBe,n)),e.ipv4=(n)=>e.check(CO(JBe,n)),e.ipv6=(n)=>e.check(kO(XBe,n)),e.cidrv4=(n)=>e.check(RO(QBe,n)),e.cidrv6=(n)=>e.check(OO(e2e,n)),e.e164=(n)=>e.check(DO(r2e,n)),e.datetime=(n)=>e.check(RP(n)),e.date=(n)=>e.check(OP(n)),e.time=(n)=>e.check(PP(n)),e.duration=(n)=>e.check(IP(n))});function g(e){return fO(NP,e)}var xt=P("ZodStringFormat",(e,t)=>{ft.init(e,t),P3.init(e,t)}),HBe=P("ZodEmail",(e,t)=>{wR.init(e,t),xt.init(e,t)});var C3=P("ZodGUID",(e,t)=>{xR.init(e,t),xt.init(e,t)});var PS=P("ZodUUID",(e,t)=>{vR.init(e,t),xt.init(e,t)});var BBe=P("ZodURL",(e,t)=>{AR.init(e,t),xt.init(e,t)});var KBe=P("ZodEmoji",(e,t)=>{TR.init(e,t),xt.init(e,t)});var GBe=P("ZodNanoID",(e,t)=>{CR.init(e,t),xt.init(e,t)});var WBe=P("ZodCUID",(e,t)=>{kR.init(e,t),xt.init(e,t)});var VBe=P("ZodCUID2",(e,t)=>{RR.init(e,t),xt.init(e,t)});var qBe=P("ZodULID",(e,t)=>{OR.init(e,t),xt.init(e,t)});var ZBe=P("ZodXID",(e,t)=>{PR.init(e,t),xt.init(e,t)});var YBe=P("ZodKSUID",(e,t)=>{IR.init(e,t),xt.init(e,t)});var JBe=P("ZodIPv4",(e,t)=>{DR.init(e,t),xt.init(e,t)});var XBe=P("ZodIPv6",(e,t)=>{LR.init(e,t),xt.init(e,t)});var QBe=P("ZodCIDRv4",(e,t)=>{NR.init(e,t),xt.init(e,t)});var e2e=P("ZodCIDRv6",(e,t)=>{MR.init(e,t),xt.init(e,t)});var t2e=P("ZodBase64",(e,t)=>{UR.init(e,t),xt.init(e,t)});var n2e=P("ZodBase64URL",(e,t)=>{FR.init(e,t),xt.init(e,t)});var r2e=P("ZodE164",(e,t)=>{$R.init(e,t),xt.init(e,t)});var o2e=P("ZodJWT",(e,t)=>{zR.init(e,t),xt.init(e,t)});var IS=P("ZodNumber",(e,t)=>{vS.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(r,o,s)=>rP(e,r,o,s),Um(e,"ZodNumber",{gt(r,o){return this.check(qu(r,o))},gte(r,o){return this.check(Ro(r,o))},min(r,o){return this.check(Ro(r,o))},lt(r,o){return this.check(Vu(r,o))},lte(r,o){return this.check(js(r,o))},max(r,o){return this.check(js(r,o))},int(r){return this.check(k3(r))},safe(r){return this.check(k3(r))},positive(r){return this.check(qu(0,r))},nonnegative(r){return this.check(Ro(0,r))},negative(r){return this.check(Vu(0,r))},nonpositive(r){return this.check(js(0,r))},multipleOf(r,o){return this.check(Pm(r,o))},step(r,o){return this.check(Pm(r,o))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??0.5),e.isFinite=!0,e.format=n.format??null});function ee(e){return NO(IS,e)}var s2e=P("ZodNumberFormat",(e,t)=>{jR.init(e,t),IS.init(e,t)});function k3(e){return MO(s2e,e)}var MP=P("ZodBoolean",(e,t)=>{HR.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>oP(e,n,r,o)});function R(e){return UO(MP,e)}var I3=P("ZodBigInt",(e,t)=>{BR.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(r,o,s)=>sP(e,r,o,s),e.gte=(r,o)=>e.check(Ro(r,o)),e.min=(r,o)=>e.check(Ro(r,o)),e.gt=(r,o)=>e.check(qu(r,o)),e.gte=(r,o)=>e.check(Ro(r,o)),e.min=(r,o)=>e.check(Ro(r,o)),e.lt=(r,o)=>e.check(Vu(r,o)),e.lte=(r,o)=>e.check(js(r,o)),e.max=(r,o)=>e.check(js(r,o)),e.positive=(r)=>e.check(qu(BigInt(0),r)),e.negative=(r)=>e.check(Vu(BigInt(0),r)),e.nonpositive=(r)=>e.check(js(BigInt(0),r)),e.nonnegative=(r)=>e.check(Ro(BigInt(0),r)),e.multipleOf=(r,o)=>e.check(Pm(r,o));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});var i2e=P("ZodUndefined",(e,t)=>{KR.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>aP(e,n,r,o)});function UP(e){return FO(i2e,e)}var a2e=P("ZodNull",(e,t)=>{GR.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>iP(e,n,r,o)});function D3(e){return $O(a2e,e)}var c2e=P("ZodUnknown",(e,t)=>{WR.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lP(e,n,r,o)});function ke(){return zO(c2e)}var l2e=P("ZodNever",(e,t)=>{VR.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cP(e,n,r,o)});function L3(e){return jO(l2e,e)}var N3=P("ZodDate",(e,t)=>{qR.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(r,o,s)=>uP(e,r,o,s),e.min=(r,o)=>e.check(Ro(r,o)),e.max=(r,o)=>e.check(js(r,o));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});var u2e=P("ZodArray",(e,t)=>{ZR.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hP(e,n,r,o),e.element=t.element,Um(e,"ZodArray",{min(n,r){return this.check(Zu(n,r))},nonempty(n){return this.check(Zu(1,n))},max(n,r){return this.check(kS(n,r))},length(n,r){return this.check(RS(n,r))},unwrap(){return this.element}})});function D(e,t){return V6(u2e,e,t)}var FP=P("ZodObject",(e,t)=>{D6.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gP(e,n,r,o),Ue.defineLazy(e,"shape",()=>t.shape),Um(e,"ZodObject",{keyof(){return V(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:ke()})},loose(){return this.clone({...this._zod.def,catchall:ke()})},strict(){return this.clone({...this._zod.def,catchall:L3()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return Ue.extend(this,n)},safeExtend(n){return Ue.safeExtend(this,n)},merge(n){return Ue.merge(this,n)},pick(n){return Ue.pick(this,n)},omit(n){return Ue.omit(this,n)},partial(...n){return Ue.partial(LS,this,n[0])},required(...n){return Ue.required($3,this,n[0])}})});function C(e,t){let n={type:"object",shape:e??{},...Ue.normalizeParams(t)};return new FP(n)}function $P(e,t){return new FP({type:"object",shape:e,catchall:L3(),...Ue.normalizeParams(t)})}function nn(e,t){return new FP({type:"object",shape:e,catchall:ke(),...Ue.normalizeParams(t)})}var M3=P("ZodUnion",(e,t)=>{wS.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_P(e,n,r,o),e.options=t.options});function de(e,t){return new M3({type:"union",options:e,...Ue.normalizeParams(t)})}var d2e=P("ZodDiscriminatedUnion",(e,t)=>{M3.init(e,t),JR.init(e,t)});function dc(e,t,n){return new d2e({type:"union",options:t,discriminator:e,...Ue.normalizeParams(n)})}var p2e=P("ZodIntersection",(e,t)=>{XR.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yP(e,n,r,o)});function DS(e,t){return new p2e({type:"intersection",left:e,right:t})}var DP=P("ZodRecord",(e,t)=>{QR.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>SP(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function J(e,t,n){if(!t||!t._zod)return new DP({type:"record",keyType:g(),valueType:e,...Ue.normalizeParams(t)});return new DP({type:"record",keyType:e,valueType:t,...Ue.normalizeParams(n)})}function U3(e,t,n){let r=Fn(e);return r._zod.values=void 0,new DP({type:"record",keyType:r,valueType:t,...Ue.normalizeParams(n)})}var LP=P("ZodEnum",(e,t)=>{eO.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(r,o,s)=>dP(e,r,o,s),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{let s={};for(let i of r)if(n.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new LP({...t,checks:[],...Ue.normalizeParams(o),entries:s})},e.exclude=(r,o)=>{let s={...t.entries};for(let i of r)if(n.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new LP({...t,checks:[],...Ue.normalizeParams(o),entries:s})}});function V(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new LP({type:"enum",entries:n,...Ue.normalizeParams(t)})}var f2e=P("ZodLiteral",(e,t)=>{tO.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>pP(e,n,r,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function z(e,t){return new f2e({type:"literal",values:Array.isArray(e)?e:[e],...Ue.normalizeParams(t)})}var m2e=P("ZodTransform",(e,t)=>{nO.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mP(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ym(e.constructor.name);n.addIssue=(s)=>{if(typeof s==="string")n.issues.push(Ue.issue(s,n.value,t));else{let i=s;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(Ue.issue(i))}};let o=t.transform(n.value,n);if(o instanceof Promise)return o.then((s)=>(n.value=s,n.fallback=!0,n));return n.value=o,n.fallback=!0,n}});function F3(e){return new m2e({type:"transform",transform:e})}var LS=P("ZodOptional",(e,t)=>{AS.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>OS(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function vt(e){return new LS({type:"optional",innerType:e})}var h2e=P("ZodExactOptional",(e,t)=>{rO.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>OS(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function g2e(e){return new h2e({type:"optional",innerType:e})}var _2e=P("ZodNullable",(e,t)=>{oO.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bP(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function R3(e){return new _2e({type:"nullable",innerType:e})}var y2e=P("ZodDefault",(e,t)=>{sO.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xP(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function S2e(e,t){return new y2e({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Ue.shallowClone(t)}})}var b2e=P("ZodPrefault",(e,t)=>{iO.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vP(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function E2e(e,t){return new b2e({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Ue.shallowClone(t)}})}var $3=P("ZodNonOptional",(e,t)=>{aO.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>EP(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function x2e(e,t){return new $3({type:"nonoptional",innerType:e,...Ue.normalizeParams(t)})}var v2e=P("ZodCatch",(e,t)=>{cO.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wP(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function w2e(e,t){return new v2e({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var z3=P("ZodPipe",(e,t)=>{TS.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>AP(e,n,r,o),e.in=t.in,e.out=t.out});function O3(e,t){return new z3({type:"pipe",in:e,out:t})}var A2e=P("ZodPreprocess",(e,t)=>{z3.init(e,t),L6.init(e,t)}),T2e=P("ZodReadonly",(e,t)=>{lO.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>TP(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function C2e(e){return new T2e({type:"readonly",innerType:e})}var k2e=P("ZodLazy",(e,t)=>{uO.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>CP(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function NS(e){return new k2e({type:"lazy",getter:e})}var j3=P("ZodCustom",(e,t)=>{dO.init(e,t),ct.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fP(e,n,r,o)});function H3(e,t){return QO(j3,e??(()=>!0),t)}function R2e(e,t={}){return eP(j3,e,t)}function O2e(e,t){return tP(e,t)}function st(e,t){return new A2e({type:"pipe",in:F3(e),out:t})}var qr={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"};var B3;(function(e){})(B3||(B3={}));var MS={};on(MS,{bigint:()=>L2e,boolean:()=>D2e,date:()=>N2e,number:()=>I2e,string:()=>P2e});function P2e(e){return F6(NP,e)}function I2e(e){return B6(IS,e)}function D2e(e){return K6(MP,e)}function L2e(e){return G6(I3,e)}function N2e(e){return W6(N3,e)}ar(pO());var K3=200;function M2e(e){return[...e.replace(/[\x00-\x1f\x7f-\x9f]/g,"")].slice(0,K3).join("")}function G3(e){return M2e(eS(e.trim())).trim()}import{basename as W3,dirname as V3}from"path";var U2e=6;function q3(e){let t=W3(e);if(hm(t))return;let n=Et(),r=[t],o=V3(e);while(o!==n&&r.length<=U2e+1){let l=V3(o);if(l===o)return;r.unshift(W3(o)),o=l}if(o!==n||r.length<3)return;let[s,i,...a]=r;if(!pn(s)||!pn(i)||a.length===0||!a.every(pn))return;let c=tn.sidecar(s,i,a);return Ms(c)===void 0?c:void 0}var j2e=I(()=>C({customTitle:g()}));function H2e(e,t){return z2e($2e(e),t,"custom-title.json")}async function Yu(e,t,n){let r=await B2e(H2e(e,t),n);if(r===void 0)return;let o;try{o=JSON.parse(r)}catch{return}let s=j2e().safeParse(o);if(!s.success)return;return G3(s.data.customTitle)||void 0}async function B2e(e,t){if(ye()&&t!==void 0)try{let n=q3(e);if(n!==void 0){let r=await t.readText([n]);if(!r.ok)return;let o=r.value.items[0];return o.found?o.value:void 0}}catch{return}try{return await F2e(e,"utf8")}catch{return}}import{constants as US}from"fs";import{lstat as K2e,open as G2e}from"fs/promises";import{dirname as W2e,join as V2e}from"path";function It(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Z3='"type":"continued-in"',q2e=I(()=>nn({type:z("continued-in"),continuedInSessionId:g()})),Z2e=I(()=>nn({type:z("assistant"),isApiErrorMessage:R().optional(),message:nn({stop_reason:g().nullish()}).optional()}));function J3(e){if(!e.includes(Z3))return;let t=e.length;while(t>0){let n=e.lastIndexOf(`
177
+ `,t-1),r=e.slice(n+1,t);t=n;let o=r.includes(Z3),s=r.includes('"type":"user"')||r.includes('"type":"assistant"');if(o||s)try{let i=JSON.parse(r);if(o){let a=q2e().safeParse(i);if(a.success)return Je(a.data.continuedInSessionId)??void 0}if(s&&Y2e(i))return}catch{}if(n<0)break}return}function Y2e(e){let t=Z2e().safeParse(e);if(t.success)return t.data.isApiErrorMessage!==!0&&typeof t.data.message?.stop_reason==="string";return It(e)&&pa(e,{commandFallback:""})!==void 0}async function X3(e,t,n){let r=V2e(W2e(e),`${t}.jsonl`),o=await ic(r,Sn(Co(r,n)));return o!==null&&await X2e(r,o.head,o.tail,o.size,n)}var Fm='"parentUuid":',J2e=16777216,Y3=1048576;async function X2e(e,t,n,r,o){if(t.includes(Fm)||n.includes(Fm))return!0;if(r<=Un)return!1;if(Co(e,o)!==void 0)return!0;try{let s=process.platform!=="win32";if(!s&&!(await K2e(e)).isFile())return!1;let i=await G2e(e,s?US.O_RDONLY|US.O_NOFOLLOW|US.O_NONBLOCK:US.O_RDONLY);try{if(!(await i.stat()).isFile())return!1;let a=Buffer.allocUnsafe(Y3+Fm.length),c=0,l=0;while(l<J2e){let{bytesRead:u}=await i.read(a,c,Y3,l);if(u===0)return!1;let p=c+u;if(a.subarray(0,p).includes(Fm))return!0;c=Math.min(Fm.length,p),a.copyWithin(0,p-c,p),l+=u}return!0}finally{await i.close()}}catch{return!1}}function Ju(e,t,n,r){let{head:o,tail:s,mtime:i,size:a}=t,c=o.indexOf(`
178
+ `),l=c>=0?o.slice(0,c):o;if(l.includes('"isSidechain":true')||l.includes('"isSidechain": true'))return null;let u=dn(s,"customTitle")||r||dn(o,"customTitle")||dn(s,"aiTitle")||dn(o,"aiTitle")||void 0,p=iS(o)||void 0,f=Uu(o,"timestamp"),m;if(f){let x=Date.parse(f);if(!Number.isNaN(x))m=x}let h=u||dn(s,"lastPrompt")||dn(s,"summary")||p;if(!h)return null;let y=dn(s,"gitBranch")||Uu(o,"gitBranch")||void 0,_=oS(s,"relocated","relocatedCwd")||Uu(o,"cwd")||n||void 0,E=s.split(`
179
+ `).findLast((x)=>x.includes('"type":"tag"')&&x.includes('"tag":"')),S=E?dn(E,"tag")||void 0:void 0;return{sessionId:e,summary:h,lastModified:i,fileSize:a,customTitle:u,firstPrompt:p,gitBranch:y,cwd:_,tag:S,createdAt:m}}function tKe(e){let t=n4(e);return t!==void 0&&pn(t)?t:void 0}function FS(e){return{pagesLeft:VV+e}}async function $m(e,t,n,r,o,s){let i=ye()&&r!==void 0?tKe(e):void 0;if(r!==void 0&&i!==void 0){let l=new Map;try{await Ao((u)=>r.listEntries({namespace:"transcript",projectKey:i},{skipScopeStats:!0,...t?{}:{skipKeyStats:!0},...u!==void 0&&{cursor:u}}),(u)=>{for(let p of u){if(p.kind!=="key"||p.key.namespace!=="transcript")continue;let f=Je(p.key.sessionId);if(!f)continue;if(t&&p.mtimeMs===void 0)continue;let m=t?Math.trunc(p.mtimeMs??0):0,h=l.get(f);if(h!==void 0){if(m>h.mtime)h.mtime=m;continue}l.set(f,{sessionId:f,filePath:zm(e,`${p.key.sessionId}.jsonl`),mtime:m,projectPath:n,ownWorktrees:s})}},o!==void 0?{budget:o}:void 0)}catch{}return[...l.values()]}let a;try{a=await zP(e)}catch{return[]}return(await Promise.all(a.map(async(l)=>{if(!l.endsWith(".jsonl"))return null;let u=Je(l.slice(0,-6));if(!u)return null;let p=zm(e,l);if(!t)return{sessionId:u,filePath:p,mtime:0,projectPath:n,ownWorktrees:s};try{let f=await Q2e(p);return{sessionId:u,filePath:p,mtime:f.mtime.getTime(),projectPath:n,ownWorktrees:s}}catch{return null}}))).filter((l)=>l!==null)}async function Q3(e,t,n){let r=await ic(e.filePath,Sn(Co(e.filePath,n)));if(!r)return null;if(!t&&cq(r.head,r.tail))return null;let o=J3(r.tail);if(o!==void 0&&await X3(e.filePath,o,n))return null;let s=dn(r.tail,"customTitle")===void 0?await Yu(e.filePath,e.sessionId,n):void 0,i=Ju(e.sessionId,r,e.projectPath,s);if(!i)return null;let a=oS(r.tail,"relocated","relocatedCwd")??Vk(r.head,"cwd");if(a!==void 0&&e.projectPath!==void 0&&!mq(a,e.ownWorktrees,qk())&&await fq(a,e.projectPath,qk(),Nz,_m(n)))return null;if(e.mtime)i.lastModified=e.mtime;return i}var nKe=32;function rKe(e,t){if(t.mtime!==e.mtime)return t.mtime-e.mtime;return t.sessionId<e.sessionId?-1:t.sessionId>e.sessionId?1:0}async function oKe(e,t,n,r,o){e.sort(rKe);let s=[],i=t&&t>0?t:1/0,a=0,c=new Set;for(let l=0;l<e.length&&s.length<i;){let u=Math.min(l+nKe,e.length),p=e.slice(l,u),f=await Promise.all(p.map((m)=>Q3(m,r,o)));for(let m=0;m<f.length&&s.length<i;m++){l++;let h=f[m];if(!h)continue;if(c.has(h.sessionId))continue;if(c.add(h.sessionId),a<n){a++;continue}s.push(h)}}return s}async function sKe(e,t,n){let r=await Promise.all(e.map((i)=>Q3(i,t,n))),o=new Map;for(let i of r){if(!i)continue;let a=o.get(i.sessionId);if(!a||i.lastModified>a.lastModified)o.set(i.sessionId,i)}let s=[...o.values()];return s.sort((i,a)=>a.lastModified!==i.lastModified?a.lastModified-i.lastModified:a.sessionId<i.sessionId?-1:a.sessionId>i.sessionId?1:0),s}async function iKe(e,t,n,r){let o=await Ls(e,_m(r)),s=Sn(ir(r)),i;if(t)try{i=await Ps(o)}catch{i=[]}else i=[];if(i.length<=1){let E=[],S=await or(o,s),x=FS(S.length);for(let v of S)E.push(...await $m(v,n,o,r,x));return E}let a=Et(),c=process.platform==="win32",l=i.map((E)=>{let S=Ds(E),x=c?S.toLowerCase():S;return{path:E,exactName:x,truncatedPrefix:S.length>Is?x.slice(0,Is):void 0}});l.sort((E,S)=>S.exactName.length-E.exactName.length);let u=s!==void 0&&s.hoverRestOn?await ju(s.source):null,p=u;if(p===null){let E;try{E=await zP(a,{withFileTypes:!0})}catch{let S=[],x=await or(o),v=FS(x.length);for(let w of x)S.push(...await $m(w,n,o,r,v));return S}p=E.filter((S)=>S.isDirectory()).map((S)=>S.name)}let f=[],m=new Set,h=FS(p.length+1),y=s!==void 0&&s.hoverRestOn&&u!==null?await Yk(o,u,c,s):await or(o),_=[o,...i];for(let E of y){let S=eKe(E),x=c?S.toLowerCase():S;m.add(x),f.push(...await $m(E,n,o,r,h,_))}for(let E of p){let S=c?E.toLowerCase():E;if(m.has(S))continue;for(let{path:x,exactName:v,truncatedPrefix:w}of l)if(S===v||w!==void 0&&S.startsWith(w+"-")&&await zu(zm(a,E),x,c,s)){m.add(S),f.push(...await $m(zm(a,E),n,x,r,h,_));break}}return f}async function aKe(e,t){let n=Et(),r=ir(t),o=r!==void 0?await ju(r):null;if(o===null){let a;try{a=await zP(n,{withFileTypes:!0})}catch{return[]}o=a.filter((c)=>c.isDirectory()).map((c)=>c.name)}let s=FS(o.length);return(await Promise.all(o.map((a)=>$m(zm(n,a),e,void 0,t,s)))).flat()}async function eZ(e,t){let n=ye()?t:void 0,{dir:r,limit:o,offset:s,includeWorktrees:i,includeProgrammatic:a}=e??{},c=s??0,l=a??!0,u=o!==void 0&&o>0||c>0,p=r?await iKe(r,i??!0,u,n):await aKe(u,n);if(!u)return sKe(p,l,n);return oKe(p,o,c,l,n)}async function tZ(e,t={},n){let r=Je(e);if(!r)return;let o=ye(),s=o?n:void 0,i=await Ni(r,t.dir,ir(s),o);if(!i)return;let a=await ic(i.filePath,Sn(Co(i.filePath,s)));if(!a)return;let c=dn(a.tail,"customTitle")===void 0?await Yu(i.filePath,r,s):void 0;return Ju(r,a,i.projectPath,c)??void 0}import{constants as nZ}from"fs";import{open as cKe,readdir as sZ,rm as rZ,stat as lKe}from"fs/promises";import{join as Hs}from"path";var uKe=64;function HP(e){return ye()?e:void 0}async function iZ(e,t,n={},r){if(!Je(e))throw Error(`Invalid sessionId: ${e}`);if(!t.trim())throw Error("title must be non-empty");let o=me({type:"custom-title",customTitle:t.trim(),sessionId:e})+`
180
+ `;await uZ(e,o,n,HP(r))}async function aZ(e,t,n={},r){if(!Je(e))throw Error(`Invalid sessionId: ${e}`);if(t!==null){let s=oc(t).trim();if(!s)throw Error("tag must be non-empty (use null to clear)");t=s}let o=me({type:"tag",tag:t??"",sessionId:e})+`
181
+ `;await uZ(e,o,n,HP(r))}async function cZ(e,t={},n){if(!Je(e))throw Error(`Invalid sessionId: ${e}`);let r=HP(n);for(let o of await pKe(t,r)){if(ye()&&r!==void 0){let a=ac(o,r.isKeySegment);if(a!==void 0){if(await dKe(a,e,r))return;continue}}let s=Hs(o,`${e}.jsonl`),i;try{({size:i}=await lKe(s))}catch(a){let c=Me(a);if(c==="ENOENT"||c==="ENOTDIR")continue;throw a}if(i===0)continue;await rZ(s,{force:!0}),await rZ(Hs(o,e),{recursive:!0,force:!0});return}throw Error(t.dir?`Session ${e} not found in project directory for ${t.dir}`:`Session ${e} not found in any project directory`)}async function dKe(e,t,n){let{backend:r,transcriptKey:o}=n,s=o(e,t),i=await r.statMeta(s);if(!i.ok){if(i.error.code==="NotFound")return!1;throw Error("Session delete: transcript unreadable via storage",{cause:i.error})}if((i.value.storedBytes??i.value.size)===0)return!1;for(let c of["transcript","sidecar"]){let l=await r.deleteScope({namespace:c,projectKey:e,sessionId:t});if(!l.ok)throw Error("Session delete: session directory not deletable via storage",{cause:l.error})}let a=await r.delete(s);if(!a.ok)throw Error("Session delete: transcript not deletable via storage",{cause:a.error});return!0}async function pKe(e,t){if(e.dir){let r=await Ls(e.dir,sS(t,ye())),o=await oZ(r,t),s;try{s=await Ps(r)}catch{s=[]}for(let i of s){if(i===r)continue;o.push(...await oZ(i,t))}return o}let n=Et();if(ye()&&t!==void 0){let r=await lZ(t);if(r===void 0)return[];if(r.laterPageFailed)throw Error("Session delete: project listing incomplete via storage");return r.names.map((o)=>Hs(n,o))}try{return(await sZ(n,{withFileTypes:!0})).filter((o)=>o.isDirectory()||o.isSymbolicLink()).map((o)=>Hs(n,o.name))}catch{return[]}}async function oZ(e,t){let n=Sn(t);if(n===void 0||!n.hoverRestOn)return or(e);let r=await or(e,n),o=$u(e),s=process.platform==="win32",i=[];for(let a of r)if(a===o||await zu(a,e,s,n))i.push(a);return i}async function lZ(e){let t=[],n,r=0;try{do{let o=await e.backend.listEntries({namespace:"transcript"},{skipScopeStats:!0,...n!==void 0&&{cursor:n}});if(!o.ok)return r===0?void 0:{names:t,laterPageFailed:!0};for(let s of o.value.items){let i=aS(s,e.isKeySegment);if(i!==void 0)t.push(i)}n=o.value.cursor}while(n&&++r<uKe);return{names:t,laterPageFailed:Boolean(n)}}catch{return r===0&&t.length===0?void 0:{names:t,laterPageFailed:!0}}}async function uZ(e,t,n,r){let o=`${e}.jsonl`;if(n.dir){let a=await Ls(n.dir,sS(r,ye()));for(let l of await or(a,Sn(r)))if(await $S(Hs(l,o),t,jP(l,e,r)))return;let c;try{c=await Ps(a)}catch{c=[]}for(let l of c){if(l===a)continue;for(let u of await or(l,Sn(r)))if(await $S(Hs(u,o),t,jP(u,e,r)))return}throw Error(`Session ${e} not found in project directory for ${n.dir}`)}let s=Et();if(ye()&&r!==void 0){let a=await lZ(r);if(a===void 0)throw new Ze(`Session ${e} not found (no projects directory)`,"Session not found (no projects directory)");let{names:c}=a;for(let l of c){let u=Hs(s,l);if(await $S(Hs(u,o),t,jP(u,e,r)))return}throw new Ze(`Session ${e} not found in any project directory`,"Session not found in any project directory")}let i;try{i=await sZ(s)}catch{throw Error(`Session ${e} not found (no projects directory)`)}for(let a of i)if(await $S(Hs(s,a,o),t))return;throw Error(`Session ${e} not found in any project directory`)}async function $S(e,t,n){if(ye()&&n!==void 0)return fKe(n,t);let r;try{r=await cKe(e,nZ.O_WRONLY|nZ.O_APPEND)}catch(o){let s=Me(o);if(s==="ENOENT"||s==="ENOTDIR")return!1;throw o}try{let{size:o}=await r.stat();if(o===0)return!1;let s=process.platform==="win32"?o:void 0,i=Buffer.from(t,"utf8"),a=0;while(a<i.length){let{bytesWritten:c}=await r.write(i,a,i.length-a,s);if(c<=0)throw new Ze(`tryAppend: short write to ${e} stalled with ${i.length-a} bytes remaining`,"tryAppend: zero-progress short write");if(a+=c,s!==void 0)s+=c}return!0}finally{await r.close()}}async function fKe({backend:e,key:t},n){let r=await e.append(t,[{data:n}],{precondition:{type:"ifExists",nonEmpty:!0}});if(!r.ok){if(r.error.code==="NotFound")return!1;throw Error("Session append: transcript not writable via storage",{cause:r.error})}return!0}function jP(e,t,n){if(!ye()||n===void 0)return;let r=ac(e,n.isKeySegment);return r===void 0?void 0:{backend:n.backend,key:n.transcriptKey(r,t)}}import{randomUUID as zS}from"crypto";import{basename as mKe,join as pc}from"path";async function hKe(e,t,n){let r=`${e}.jsonl`,o=Sn(ir(n));async function s(c){let l=Sn(Co(pc(c,r),n));if(l!==void 0&&l.hoverRestOn)try{let u=await l.source.backend.read([l.source.key]);if(!u.ok)return null;let p=u.value.items[0];if(!p?.found)return null;if(p.value.byteLength===0){let f=await l.source.backend.statMeta(l.source.key);if(!f.ok||(f.value.storedBytes??f.value.size)===0)return null}return{buf:Buffer.from(p.value),projectDir:c}}catch{return null}try{let u=await $l().readBytes(pc(c,r));if(u.length===0)return null;return{buf:u,projectDir:c}}catch{return null}}if(t){let c=await Ls(t,_m(n));for(let u of await or(c,o)){let p=await s(u);if(p)return p}let l;try{l=await Ps(c)}catch{l=[]}for(let u of l){if(u===c)continue;for(let p of await or(u,o)){let f=await s(p);if(f)return f}}return null}let i=Et();if(o!==void 0&&o.hoverRestOn){let c=await ju(o.source);if(c!==null){for(let l of c){let u=await s(pc(i,l));if(u)return u}return null}}let a;try{a=await $l().list(i)}catch{return null}for(let c of a){let l=await s(pc(i,c));if(l)return l}return null}var gKe=new Set(["user","assistant","attachment","system","progress"]);function _Ke(e,t){let n=[],r=[],o,s={historySuppressed:!1},i=10,a=e.length,c=0;while(c<a){let l=e.indexOf(10,c);if(l===-1)l=a;let u=c;while(u<l&&e[u]<=32)u++;if(c=l+1,u>=l)continue;let p=e.toString("utf-8",u,l);try{o=dZ(lt(p),t,n,r,s)??o}catch{}}return{transcript:n,contentReplacements:r,relocatedCwd:o,historySuppressed:s.historySuppressed,atisLatch:s.atisLatch}}function yKe(e,t){let n=[],r=[],o,s={historySuppressed:!1};for(let i of e){if(typeof i!=="object"||i===null)continue;o=dZ(i,t,n,r,s)??o}return{transcript:n,contentReplacements:r,relocatedCwd:o,historySuppressed:s.historySuppressed,atisLatch:s.atisLatch}}function dZ(e,t,n,r,o){if(gKe.has(e.type)&&typeof e.uuid==="string")n.push(e);else if(e.type==="history-suppression"){if(o)o.historySuppressed=!0}else if(e.type==="atis-latch"&&e.sessionId===t&&typeof e.atis==="string"&&/^[\x21-\x7e]*$/.test(e.atis)){if(o)o.atisLatch=e.atis}else if(e.type==="content-replacement"&&e.sessionId===t&&Array.isArray(e.replacements))r.push(...e.replacements);else if(e.type==="relocated"&&e.sessionId===t&&typeof e.relocatedCwd==="string"&&e.relocatedCwd!=="")return e.relocatedCwd;return}async function pZ(e,t={},n){let r=ye()?n:void 0;if(!Je(e))throw new Ze(`Invalid sessionId: ${e}`,"forkSession: invalid sessionId (not a UUID)");if(t.upToMessageId&&!Je(t.upToMessageId))throw new Ze(`Invalid upToMessageId: ${t.upToMessageId}`,"forkSession: invalid upToMessageId (not a UUID)");let o=await hKe(e,t.dir,r);if(!o)throw Error(t.dir?`Session ${e} not found in project directory for ${t.dir}`:`Session ${e} not found`);let s=await Yu(pc(o.projectDir,`${e}.jsonl`),e,r),{entries:i,forkedSessionId:a}=bKe(o.buf,e,t,s);return await fm(pc(o.projectDir,`${a}.jsonl`),i,Sn(SKe(o.projectDir,a,ir(r)))),{sessionId:a}}function SKe(e,t,n){if(n===void 0)return;let r=mKe(e);if(pc(Et(),r)!==e||!n.isKeySegment(r)||!n.isKeySegment(t))return;return{backend:n.backend,key:n.transcriptKey(r,t)}}function bKe(e,t,n,r){let o=_Ke(e,t);return mZ(o,t,n,()=>{let i=e.length,a=e.toString("utf-8",0,Math.min(i,Un)),c=e.toString("utf-8",Math.max(0,i-Un)),l=dn(c,"customTitle");return(l!==void 0?l:r??dn(a,"customTitle"))||dn(c,"aiTitle")||dn(a,"aiTitle")||iS(a)})}function fZ(e,t,n){let r=yKe(e,t);return mZ(r,t,n,()=>EKe(e))}function EKe(e){let t,n;for(let r of e){if(typeof r!=="object"||r===null)continue;let o=r;if(typeof o.customTitle==="string"&&o.customTitle)t=o.customTitle;if(typeof o.aiTitle==="string"&&o.aiTitle)n=o.aiTitle}return t||n||uq(e)||void 0}function mZ(e,t,n,r){let o=e.transcript.filter((f)=>!f.isSidechain);if(o.length===0)throw Error(`Session ${t} has no messages to fork`);if(n.upToMessageId){let f=o.findIndex((m)=>m.uuid===n.upToMessageId);if(f===-1)throw Error(`Message ${n.upToMessageId} not found in session ${t}`);o=o.slice(0,f+1)}let s=new Map;for(let f of o)s.set(f.uuid,zS());let i=o.filter((f)=>f.type!=="progress");if(i.length===0)throw Error(`Session ${t} has no messages to fork`);let a=new Map;for(let f of o)a.set(f.uuid,f);let c=zS(),l=new Date().toISOString(),u=[];if(e.historySuppressed)u.push(Eq(c,"fork_inherit"));for(let f=0;f<i.length;f++){let m=i[f],h=s.get(m.uuid),y=null,_=m.parentUuid;while(_){let w=a.get(_);if(!w)break;if(w.type!=="progress"){y=s.get(_)??null;break}_=w.parentUuid}let E=f===i.length-1?l:m.timestamp,S=m.logicalParentUuid==null?m.logicalParentUuid:s.get(m.logicalParentUuid)??null,x=m.type==="system"&&m.subtype==="model_refusal_fallback"?{neutralizedByFork:!0}:void 0,v={...m,...x,uuid:h,parentUuid:y,logicalParentUuid:S,sessionId:c,timestamp:E,isSidechain:!1,teamName:void 0,agentName:void 0,sessionKind:void 0,slug:void 0,sourceToolAssistantUUID:void 0,forkedFrom:{sessionId:t,messageUuid:m.uuid}};u.push(v)}if(e.contentReplacements.length>0)u.push({type:"content-replacement",sessionId:c,replacements:e.contentReplacements,uuid:zS(),timestamp:l});if(e.atisLatch!==void 0)u.push({type:"atis-latch",sessionId:c,atis:e.atisLatch});if(e.relocatedCwd)u.push({type:"relocated",sessionId:c,relocatedCwd:e.relocatedCwd});let p=n.title?.trim();if(!p)p=`${r()||"Forked session"} (fork)`;return u.push({type:"custom-title",sessionId:c,customTitle:p,uuid:zS(),timestamp:l}),{entries:u,forkedSessionId:c}}import{readdir as xKe,readFile as hZ}from"fs/promises";import{isAbsolute as gZ,join as jS,relative as _Z,sep as HS}from"path";async function yZ(e,t,n,r){let o=await Ni(e,t,ir(n),r);if(!o)return null;let s=o.filePath.replace(/\.jsonl$/,"");return jS(s,"subagents")}function SZ(e){let t=_Z(Et(),e);if(t===""||t.startsWith(`..${HS}`)||t===".."||gZ(t))return null;let n=t.split(HS);return n.length<4||n[2]!=="subagents"?null:n}function vKe(e){let t=SZ(e),n=t?.at(-1);if(!t||!n?.startsWith("agent-")||!n.endsWith(".jsonl"))return null;let r=n.slice(6,-6),o=t.slice(3,-1);if(!sr([t[0],t[1],r])||o.length>0&&!sr(o))return null;let s=tn.transcript(t[0],t[1],r,o.length>0?o:void 0);return Ms(s)===void 0?s:null}function wKe(e){let t=SZ(e);if(!t)return null;let n=t.slice(2);if(!sr([t[0],t[1]])||!sr(n))return null;let r=tn.sidecar(t[0],t[1],n);return Ms(r)===void 0?r:null}async function bZ(e,t){let n=ye()&&t!==void 0?AKe(e):null;if(t!==void 0&&n!==null)return CKe(t,n,e);let r=[];async function o(s){let i;try{i=await xKe(s,{withFileTypes:!0})}catch{return}for(let a of i)if(a.isFile()&&a.name.startsWith("agent-")&&a.name.endsWith(".jsonl")){let c=a.name.slice(6,-6);r.push({agentId:c,filePath:jS(s,a.name)})}else if(a.isDirectory())await o(jS(s,a.name))}return await o(e),r}function AKe(e){let t=_Z(Et(),e);if(t===""||t.startsWith(`..${HS}`)||gZ(t))return null;let n=t.split(HS);if(n.length!==3||n[2]!=="subagents"||!sr([n[0],n[1]]))return null;let r={namespace:"transcript",projectKey:n[0],sessionId:n[1]};return Qk(r)===void 0?r:null}var TKe=1e4;async function CKe(e,t,n,r=TKe){let o=[],s=[t],i=new Set([""]),a=0;try{while(s.length>0){if(++a>r)return[];let c=s.shift(),l=[];if((await Ao((p)=>e.listEntries(c,{skipKeyStats:!0,skipScopeStats:!0,...p!==void 0&&{cursor:p}}),(p)=>{for(let f of p)if(f.kind==="key"&&f.key.namespace==="transcript"&&f.key.agentId!==void 0&&pn(f.key.agentId)&&(f.key.agentRelPath===void 0||sr(f.key.agentRelPath)))o.push({agentId:f.key.agentId,filePath:jS(n,...f.key.agentRelPath??[],`agent-${f.key.agentId}.jsonl`)});else if(f.kind==="scope"&&f.scope.namespace==="transcript"&&f.scope.agentRelPath!==void 0&&sr(f.scope.agentRelPath)&&!i.has(f.scope.agentRelPath.join("/"))){let m={...t,agentRelPath:f.scope.agentRelPath};if(Qk(m)===void 0)i.add(f.scope.agentRelPath.join("/")),l.push(m)}})).status!=="done")return[];s.unshift(...l)}}catch{return[]}return o}function kKe(e){let t=[],n=10,r=e.length,o=0;while(o<r){let s=e.indexOf(10,o);if(s===-1)s=r;let i=o;while(i<s&&e[i]<=32)i++;if(o=s+1,i>=s)continue;let a=e.toString("utf-8",i,s);try{let c=lt(a),l=c.type;if((l==="user"||l==="assistant")&&typeof c.uuid==="string")t.push(c)}catch{}}return t}function RKe(e){if(e.length===0)return[];let t=new Map;for(let i of e)t.set(i.uuid,i);let n=e.findLast((i)=>i.type==="user"||i.type==="assistant");if(!n)return[];let r=[],o=new Set,s=n;while(s){if(o.has(s.uuid))break;o.add(s.uuid),r.push(s),s=s.parentUuid?t.get(s.parentUuid):void 0}return r.reverse(),r}async function EZ(e,t,n){if(!Je(e))return[];let r=ye(),o=r?n:void 0,s=await yZ(e,t?.dir,o,r);if(!s)return[];return(await bZ(s,o)).map((a)=>a.agentId)}async function xZ(e,t,n,r){if(!Je(e))return[];if(!t)return[];let o=ye(),s=o?r:void 0,i=await yZ(e,n?.dir,s,o);if(!i)return[];let c=(await bZ(i,s)).find((m)=>m.agentId===t);if(!c)return[];let l,u=s!==void 0?vKe(c.filePath):null;if(s!==void 0&&u!==null)try{let m=await s.read([u]),h=m.ok?m.value.items[0]:void 0;if(!h?.found)return[];l=Buffer.from(h.value)}catch{return[]}else try{l=await hZ(c.filePath)}catch{return[]}let p,f;try{let m=c.filePath.replace(/\.jsonl$/,".meta.json"),h=s!==void 0?wKe(m):null,y;if(s!==void 0&&h!==null){let E=await s.read([h]);if(!E.ok||!E.value.items[0]?.found)throw Error("sidecar absent");y=Buffer.from(E.value.items[0].value).toString("utf-8")}else y=await hZ(m,"utf-8");let _=lt(y);p=_.toolUseId,f=_.parentAgentId}catch{}return BP(l,n,p,f)}function BP(e,t,n,r){if(e.length===0)return[];let o=kKe(e),i=RKe(o).filter((a)=>a.type==="user"||a.type==="assistant").map((a)=>nR(a,n,r));return rR(i,t)}function BS(e){return["subagents",...e.agentRelPath??[],e.kind==="agent"?`agent-${e.agentId}`:"journal"].join("/")}async function KP(e,t,n,r,o,s=PKe){let i=[],a=0,c,l=!1;for(let u=0;u<s;u++){let p=await e.readRecords(t,{order:"forward",maxBytes:OKe,...c!==void 0&&{fromSeq:c}});if(!p.ok)throw new Ze(`importSessionToStore: transcript read failed (${p.error.code})`,"importSessionToStore: transcript read failed");for(let f of p.value.items){let m=Buffer.from(f.data.buffer,f.data.byteOffset,f.data.byteLength).toString("utf8").replace(/\r?\n$/,"");if(!m)continue;try{i.push(lt(m))}catch(h){ce(`importSessionToStore: skipping unparseable record ${f.seq}: ${h}`);continue}if(a+=m.length,i.length>=o||a>=Ou)await r.append(n,i),i=[],a=0}if(c=p.value.nextSeq,c===void 0){l=!0;break}}if(!l)throw new Ze("importSessionToStore: transcript read did not end (page cap reached)","importSessionToStore: transcript read did not end");if(i.length>0)await r.append(n,i)}var OKe=67108864,PKe=1e5,IKe=1e4;async function AZ(e,t,n,r=IKe){let o=[],s=[{namespace:"transcript",projectKey:t,sessionId:n}],i=new Set([""]),a=new Set,c=0;while(s.length>0){if(++c>r)throw Error("importSessionToStore: subagent listing did not end (scope cap reached)");let l=s.shift(),u=[];if((await Ao((f)=>e.listEntries(l,{skipKeyStats:!0,skipScopeStats:!0,...f!==void 0&&{cursor:f}}),(f)=>{for(let m of f)if(m.kind==="key"&&m.key.namespace==="transcript"){let h=m.key.agentRelPath;if(h!==void 0&&!sr(h))continue;let y=m.key.agentId!==void 0?pn(m.key.agentId)?{kind:"agent",agentId:m.key.agentId,...h&&{agentRelPath:h}}:void 0:m.key.journal===!0&&h!==void 0?{kind:"journal",agentRelPath:h}:void 0,_=y&&BS(y);if(y&&_!==void 0&&!a.has(_))a.add(_),o.push(y)}else if(m.kind==="scope"&&m.scope.namespace==="transcript"&&m.scope.agentRelPath!==void 0&&sr(m.scope.agentRelPath)&&!i.has(m.scope.agentRelPath.join("/")))i.add(m.scope.agentRelPath.join("/")),u.push({namespace:"transcript",projectKey:t,sessionId:n,agentRelPath:m.scope.agentRelPath})})).status!=="done")throw Error("importSessionToStore: subagent listing failed");s.unshift(...u)}return o}function DKe(e,t,n){return tn.sidecar(e,t,["subagents",...n.agentRelPath??[],n.kind==="agent"?`agent-${n.agentId}.meta.json`:"journal.meta.json"])}async function TZ(e,t,n,r){let o=r.map((a)=>({subpath:BS(a),key:DKe(t,n,a)})).filter(({key:a})=>Ms(a)===void 0),s=new Map;if(o.length===0)return s;let i=await e.readText(o.map(({key:a})=>a));if(i.ok)return i.value.items.forEach((a,c)=>{if(a.found)s.set(o[c].subpath,a.value)}),s;if(!vZ(i.error))throw wZ(i.error.code);for(let{subpath:a,key:c}of o){let l=await e.readText([c]);if(l.ok){if(l.value.items[0].found)s.set(a,l.value.items[0].value)}else if(!vZ(l.error))throw wZ(l.error.code)}return s}function vZ(e){return e.code==="Failed"&&(e.telemetryCode==="ELOOP"||e.telemetryCode==="ENXIO")}function wZ(e){return new Ze(`importSessionToStore: sidecar read failed (${e})`,"importSessionToStore: sidecar read failed")}import{copyFile as LKe,readFile as NKe,rm as kZ,writeFile as RZ}from"fs/promises";import{homedir as CZ}from"os";import{join as GP}from"path";function OZ(e){return{globalConfig:GP(e||CZ(),".claude.json"),userSettings:GP(e||GP(CZ(),".claude"),"settings.json")}}function WP(e,t,n,r){return e!==void 0&&t===n?{backend:e,key:r}:void 0}async function KS(e,t,n,r){if(r)return MKe(r,e,t,n);try{if(n)await RZ(t,n(await NKe(e)),{mode:384});else await LKe(e,t)}catch(o){if(Me(o)===void 0)throw o;if(!wr(o))await kZ(t,{force:!0}).catch(()=>{}),ce(`sessionStore resume: skipping ${e} (${Me(o)})`)}}async function MKe({backend:e,key:t},n,r,o){let s=await e.read([t]);if(!s.ok){if(s.error.code==="InvalidArgument")throw new Ze(`sessionStore resume: invalid v5 key for ${n}: ${s.error.argument}${s.error.reason?` (${s.error.reason})`:""}`,"sessionStore resume: invalid v5 key (InvalidArgument from backend read)");ce(`sessionStore resume: skipping ${n} (${s.error.code})`);return}let i=s.value.items[0];if(!i?.found)return;let a=Buffer.from(i.value);try{await RZ(r,o?o(a):a,{mode:384})}catch(c){if(Me(c)===void 0)throw c;if(!wr(c))await kZ(r,{force:!0}).catch(()=>{}),ce(`sessionStore resume: skipping ${n} (${Me(c)})`)}}import{createHash as UKe}from"crypto";import{homedir as yUt,userInfo as FKe}from"os";var PZ="-credentials";function IZ(e=""){let t=process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR,n=t!==void 0?!t:!process.env.CLAUDE_CONFIG_DIR,r=t!==void 0?t.normalize("NFC"):Wt(),o=n?"":`-${UKe("sha256").update(r).digest("hex").substring(0,8)}`;return`Claude Code${ez().OAUTH_FILE_SUFFIX}${e}${o}`}var $Ke=/^[a-zA-Z0-9._-]+$/;function DZ(){if(process.platform==="win32")return"claude-code-user";let e;try{e=process.env.USER||FKe().username}catch{e="claude-code-user"}if(!$Ke.test(e))return"claude-code-user";return e}class LZ{cache={data:null,cachedAt:0};generation=0;readInFlight=null;lastReadFailure=null;lastKnown=null;legacyApiKeyPrefetch=null}var vUt=new nt(()=>new LZ);function zKe(e,t){if(e==="bypassPermissions")return"canUseTool will not be invoked: permissionMode 'bypassPermissions' auto-approves every tool call (except explicit deny rules) before the callback is consulted. To gate every tool call, use a PreToolUse hook instead.";let n=t.filter((r)=>r.length>0&&!r.includes("("));if(n.length===0)return;return`canUseTool will not be invoked for: ${n.join(", ")}. Bare allowedTools entries auto-approve the whole tool before the callback is consulted. To gate every tool call, use a PreToolUse hook; or remove the bare names from allowedTools so they fall through to canUseTool. Allow rules from settings files can also shadow the callback but are not visible here.`}function NZ(e,t,n){if(!e)return;let r=zKe(t,n);if(r===void 0)return;process.emitWarning(r,{code:"CLAUDE_SDK_CAN_USE_TOOL_SHADOWED"})}var HKe=P("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");Xe.init(e,t),e.def=t,e.type=t.type,e.parse=(n,r)=>yS(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>lc(e,n,r),e.parseAsync=async(n,r)=>SS(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>uc(e,n,r),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0}),e.with=e.check,e.clone=(n,r)=>Fn(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.apply=(n)=>n(e)});var BKe=P("ZodMiniObject",(e,t)=>{YR.init(e,t),HKe.init(e,t),ze(e,"shape",()=>t.shape)});function VP(e,t){let n={type:"object",shape:e??{},...le(t)};return new BKe(n)}function Zr(e){return!!e._zod}function fc(e){let t=Object.values(e);if(t.length===0)return VP({});let n=t.every(Zr),r=t.every((o)=>!Zr(o));if(n)return VP(e);if(r)return FA(e);throw Error("Mixed Zod versions detected in object shape.")}function ji(e,t){if(Zr(e))return lc(e,t);return e.safeParse(t)}async function GS(e,t){if(Zr(e))return await uc(e,t);return await e.safeParseAsync(t)}function Hi(e){if(!e)return;let t;if(Zr(e))t=e._zod?.def?.shape;else t=e.shape;if(!t)return;if(typeof t==="function")try{return t()}catch{return}return t}function Xu(e){if(!e)return;if(typeof e==="object"){let t=e,n=e;if(!t._def&&!n._zod){let r=Object.values(e);if(r.length>0&&r.every((o)=>typeof o==="object"&&o!==null&&(o._def!==void 0||o._zod!==void 0||typeof o.parse==="function")))return fc(e)}}if(Zr(e)){let n=e._zod?.def;if(n&&(n.type==="object"||n.shape!==void 0))return e}else if(e.shape!==void 0)return e;return}function WS(e){if(e&&typeof e==="object"){if("message"in e&&typeof e.message==="string")return e.message;if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0){let t=e.issues[0];if(t&&typeof t==="object"&&"message"in t)return String(t.message)}try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function MZ(e){return e.description}function UZ(e){if(Zr(e))return e._zod?.def?.type==="optional";let t=e;if(typeof e.isOptional==="function")return e.isOptional();return t._def?.typeName==="ZodOptional"}function VS(e){if(Zr(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let n=e._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let r=e.value;if(r!==void 0)return r;return}var qP="2025-11-25";var FZ=[qP,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Bi="io.modelcontextprotocol/related-task",ZS="2.0",rn=H3((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),$Z=de([g(),ee().int()]),zZ=g(),KUt=nn({ttl:ee().optional(),pollInterval:ee().optional()}),GKe=C({ttl:ee().optional()}),WKe=C({taskId:g()}),ZP=nn({progressToken:$Z.optional(),[Bi]:WKe.optional()}),Ir=C({_meta:ZP.optional()}),jm=Ir.extend({task:GKe.optional()}),jZ=(e)=>jm.safeParse(e).success,bn=C({method:g(),params:Ir.loose().optional()}),Yr=C({_meta:ZP.optional()}),Jr=C({method:g(),params:Yr.loose().optional()}),En=nn({_meta:ZP.optional()}),YS=de([g(),ee().int()]),HZ=C({jsonrpc:z(ZS),id:YS,...bn.shape}).strict(),YP=(e)=>HZ.safeParse(e).success,BZ=C({jsonrpc:z(ZS),...Jr.shape}).strict(),KZ=(e)=>BZ.safeParse(e).success,JP=C({jsonrpc:z(ZS),id:YS,result:En}).strict(),Hm=(e)=>JP.safeParse(e).success;var fe;(function(e){e[e.ConnectionClosed=-32000]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(fe||(fe={}));var XP=C({jsonrpc:z(ZS),id:YS.optional(),error:C({code:ee().int(),message:g(),data:ke().optional()})}).strict();var GZ=(e)=>XP.safeParse(e).success;var GUt=de([HZ,BZ,JP,XP]),WUt=de([JP,XP]),JS=En.strict(),VKe=Yr.extend({requestId:YS.optional(),reason:g().optional()}),XS=Jr.extend({method:z("notifications/cancelled"),params:VKe}),qKe=C({src:g(),mimeType:g().optional(),sizes:D(g()).optional(),theme:V(["light","dark"]).optional()}),Bm=C({icons:D(qKe).optional()}),Qu=C({name:g(),title:g().optional()}),WZ=Qu.extend({...Qu.shape,...Bm.shape,version:g(),websiteUrl:g().optional(),description:g().optional()}),ZKe=DS(C({applyDefaults:R().optional()}),J(g(),ke())),YKe=st((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},DS(C({form:ZKe.optional(),url:rn.optional()}),J(g(),ke()).optional())),JKe=nn({list:rn.optional(),cancel:rn.optional(),requests:nn({sampling:nn({createMessage:rn.optional()}).optional(),elicitation:nn({create:rn.optional()}).optional()}).optional()}),XKe=nn({list:rn.optional(),cancel:rn.optional(),requests:nn({tools:nn({call:rn.optional()}).optional()}).optional()}),QKe=C({experimental:J(g(),rn).optional(),sampling:C({context:rn.optional(),tools:rn.optional()}).optional(),elicitation:YKe.optional(),roots:C({listChanged:R().optional()}).optional(),tasks:JKe.optional(),extensions:J(g(),rn).optional()}),eGe=Ir.extend({protocolVersion:g(),capabilities:QKe,clientInfo:WZ}),QP=bn.extend({method:z("initialize"),params:eGe});var tGe=C({experimental:J(g(),rn).optional(),logging:rn.optional(),completions:rn.optional(),prompts:C({listChanged:R().optional()}).optional(),resources:C({subscribe:R().optional(),listChanged:R().optional()}).optional(),tools:C({listChanged:R().optional()}).optional(),tasks:XKe.optional(),extensions:J(g(),rn).optional()}),nGe=En.extend({protocolVersion:g(),capabilities:tGe,serverInfo:WZ,instructions:g().optional()}),eI=Jr.extend({method:z("notifications/initialized"),params:Yr.optional()});var QS=bn.extend({method:z("ping"),params:Ir.optional()}),rGe=C({progress:ee(),total:vt(ee()),message:vt(g())}),oGe=C({...Yr.shape,...rGe.shape,progressToken:$Z}),eb=Jr.extend({method:z("notifications/progress"),params:oGe}),sGe=Ir.extend({cursor:zZ.optional()}),Km=bn.extend({params:sGe.optional()}),Gm=En.extend({nextCursor:zZ.optional()}),iGe=V(["working","input_required","completed","failed","cancelled"]),Wm=C({taskId:g(),status:iGe,ttl:de([ee(),D3()]),createdAt:g(),lastUpdatedAt:g(),pollInterval:vt(ee()),statusMessage:vt(g())}),ed=En.extend({task:Wm}),aGe=Yr.merge(Wm),Vm=Jr.extend({method:z("notifications/tasks/status"),params:aGe}),tb=bn.extend({method:z("tasks/get"),params:Ir.extend({taskId:g()})}),nb=En.merge(Wm),rb=bn.extend({method:z("tasks/result"),params:Ir.extend({taskId:g()})}),VUt=En.loose(),ob=Km.extend({method:z("tasks/list")}),sb=Gm.extend({tasks:D(Wm)}),ib=bn.extend({method:z("tasks/cancel"),params:Ir.extend({taskId:g()})}),VZ=En.merge(Wm),qZ=C({uri:g(),mimeType:vt(g()),_meta:J(g(),ke()).optional()}),ZZ=qZ.extend({text:g()}),tI=g().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),YZ=qZ.extend({blob:tI}),qm=V(["user","assistant"]),td=C({audience:D(qm).optional(),priority:ee().min(0).max(1).optional(),lastModified:Mm.datetime({offset:!0}).optional()}),JZ=C({...Qu.shape,...Bm.shape,uri:g(),description:vt(g()),mimeType:vt(g()),size:vt(ee()),annotations:td.optional(),_meta:vt(nn({}))}),cGe=C({...Qu.shape,...Bm.shape,uriTemplate:g(),description:vt(g()),mimeType:vt(g()),annotations:td.optional(),_meta:vt(nn({}))}),ab=Km.extend({method:z("resources/list")}),lGe=Gm.extend({resources:D(JZ)}),cb=Km.extend({method:z("resources/templates/list")}),uGe=Gm.extend({resourceTemplates:D(cGe)}),nI=Ir.extend({uri:g()}),dGe=nI,lb=bn.extend({method:z("resources/read"),params:dGe}),pGe=En.extend({contents:D(de([ZZ,YZ]))}),fGe=Jr.extend({method:z("notifications/resources/list_changed"),params:Yr.optional()}),mGe=nI,hGe=bn.extend({method:z("resources/subscribe"),params:mGe}),gGe=nI,_Ge=bn.extend({method:z("resources/unsubscribe"),params:gGe}),yGe=Yr.extend({uri:g()}),SGe=Jr.extend({method:z("notifications/resources/updated"),params:yGe}),bGe=C({name:g(),description:vt(g()),required:vt(R())}),EGe=C({...Qu.shape,...Bm.shape,description:vt(g()),arguments:vt(D(bGe)),_meta:vt(nn({}))}),ub=Km.extend({method:z("prompts/list")}),xGe=Gm.extend({prompts:D(EGe)}),vGe=Ir.extend({name:g(),arguments:J(g(),g()).optional()}),db=bn.extend({method:z("prompts/get"),params:vGe}),rI=C({type:z("text"),text:g(),annotations:td.optional(),_meta:J(g(),ke()).optional()}),oI=C({type:z("image"),data:tI,mimeType:g(),annotations:td.optional(),_meta:J(g(),ke()).optional()}),sI=C({type:z("audio"),data:tI,mimeType:g(),annotations:td.optional(),_meta:J(g(),ke()).optional()}),wGe=C({type:z("tool_use"),name:g(),id:g(),input:J(g(),ke()),_meta:J(g(),ke()).optional()}),AGe=C({type:z("resource"),resource:de([ZZ,YZ]),annotations:td.optional(),_meta:J(g(),ke()).optional()}),TGe=JZ.extend({type:z("resource_link")}),iI=de([rI,oI,sI,TGe,AGe]),CGe=C({role:qm,content:iI}),kGe=En.extend({description:g().optional(),messages:D(CGe)}),RGe=Jr.extend({method:z("notifications/prompts/list_changed"),params:Yr.optional()}),OGe=C({title:g().optional(),readOnlyHint:R().optional(),destructiveHint:R().optional(),idempotentHint:R().optional(),openWorldHint:R().optional()}),PGe=C({taskSupport:V(["required","optional","forbidden"]).optional()}),XZ=C({...Qu.shape,...Bm.shape,description:g().optional(),inputSchema:C({type:z("object"),properties:J(g(),rn).optional(),required:D(g()).optional()}).catchall(ke()),outputSchema:C({type:z("object"),properties:J(g(),rn).optional(),required:D(g()).optional()}).catchall(ke()).optional(),annotations:OGe.optional(),execution:PGe.optional(),_meta:J(g(),ke()).optional()}),pb=Km.extend({method:z("tools/list")}),IGe=Gm.extend({tools:D(XZ)}),fb=En.extend({content:D(iI).default([]),structuredContent:J(g(),ke()).optional(),isError:R().optional()}),qUt=fb.or(En.extend({toolResult:ke()})),DGe=jm.extend({name:g(),arguments:J(g(),ke()).optional()}),nd=bn.extend({method:z("tools/call"),params:DGe}),LGe=Jr.extend({method:z("notifications/tools/list_changed"),params:Yr.optional()}),ZUt=C({autoRefresh:R().default(!0),debounceMs:ee().int().nonnegative().default(300)}),Zm=V(["debug","info","notice","warning","error","critical","alert","emergency"]),NGe=Ir.extend({level:Zm}),aI=bn.extend({method:z("logging/setLevel"),params:NGe}),MGe=Yr.extend({level:Zm,logger:g().optional(),data:ke()}),UGe=Jr.extend({method:z("notifications/message"),params:MGe}),FGe=C({name:g().optional()}),$Ge=C({hints:D(FGe).optional(),costPriority:ee().min(0).max(1).optional(),speedPriority:ee().min(0).max(1).optional(),intelligencePriority:ee().min(0).max(1).optional()}),zGe=C({mode:V(["auto","required","none"]).optional()}),jGe=C({type:z("tool_result"),toolUseId:g().describe("The unique identifier for the corresponding tool call."),content:D(iI).default([]),structuredContent:C({}).loose().optional(),isError:R().optional(),_meta:J(g(),ke()).optional()}),HGe=dc("type",[rI,oI,sI]),qS=dc("type",[rI,oI,sI,wGe,jGe]),BGe=C({role:qm,content:de([qS,D(qS)]),_meta:J(g(),ke()).optional()}),KGe=jm.extend({messages:D(BGe),modelPreferences:$Ge.optional(),systemPrompt:g().optional(),includeContext:V(["none","thisServer","allServers"]).optional(),temperature:ee().optional(),maxTokens:ee().int(),stopSequences:D(g()).optional(),metadata:rn.optional(),tools:D(XZ).optional(),toolChoice:zGe.optional()}),GGe=bn.extend({method:z("sampling/createMessage"),params:KGe}),Ym=En.extend({model:g(),stopReason:vt(V(["endTurn","stopSequence","maxTokens"]).or(g())),role:qm,content:HGe}),cI=En.extend({model:g(),stopReason:vt(V(["endTurn","stopSequence","maxTokens","toolUse"]).or(g())),role:qm,content:de([qS,D(qS)])}),WGe=C({type:z("boolean"),title:g().optional(),description:g().optional(),default:R().optional()}),VGe=C({type:z("string"),title:g().optional(),description:g().optional(),minLength:ee().optional(),maxLength:ee().optional(),format:V(["email","uri","date","date-time"]).optional(),default:g().optional()}),qGe=C({type:V(["number","integer"]),title:g().optional(),description:g().optional(),minimum:ee().optional(),maximum:ee().optional(),default:ee().optional()}),ZGe=C({type:z("string"),title:g().optional(),description:g().optional(),enum:D(g()),default:g().optional()}),YGe=C({type:z("string"),title:g().optional(),description:g().optional(),oneOf:D(C({const:g(),title:g()})),default:g().optional()}),JGe=C({type:z("string"),title:g().optional(),description:g().optional(),enum:D(g()),enumNames:D(g()).optional(),default:g().optional()}),XGe=de([ZGe,YGe]),QGe=C({type:z("array"),title:g().optional(),description:g().optional(),minItems:ee().optional(),maxItems:ee().optional(),items:C({type:z("string"),enum:D(g())}),default:D(g()).optional()}),eWe=C({type:z("array"),title:g().optional(),description:g().optional(),minItems:ee().optional(),maxItems:ee().optional(),items:C({anyOf:D(C({const:g(),title:g()}))}),default:D(g()).optional()}),tWe=de([QGe,eWe]),nWe=de([JGe,XGe,tWe]),rWe=de([nWe,WGe,VGe,qGe]),oWe=jm.extend({mode:z("form").optional(),message:g(),requestedSchema:C({type:z("object"),properties:J(g(),rWe),required:D(g()).optional()})}),sWe=jm.extend({mode:z("url"),message:g(),elicitationId:g(),url:g().url()}),iWe=de([oWe,sWe]),aWe=bn.extend({method:z("elicitation/create"),params:iWe}),cWe=Yr.extend({elicitationId:g()}),lWe=Jr.extend({method:z("notifications/elicitation/complete"),params:cWe}),rd=En.extend({action:V(["accept","decline","cancel"]),content:st((e)=>e===null?void 0:e,J(g(),de([g(),ee(),R(),D(g())])).optional())}),uWe=C({type:z("ref/resource"),uri:g()});var dWe=C({type:z("ref/prompt"),name:g()}),pWe=Ir.extend({ref:de([dWe,uWe]),argument:C({name:g(),value:g()}),context:C({arguments:J(g(),g()).optional()}).optional()}),mb=bn.extend({method:z("completion/complete"),params:pWe});function QZ(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function e9(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var fWe=En.extend({completion:nn({values:D(g()).max(100),total:vt(ee().int()),hasMore:vt(R())})}),mWe=C({uri:g().startsWith("file://"),name:g().optional(),_meta:J(g(),ke()).optional()}),hWe=bn.extend({method:z("roots/list"),params:Ir.optional()}),lI=En.extend({roots:D(mWe)}),gWe=Jr.extend({method:z("notifications/roots/list_changed"),params:Yr.optional()}),YUt=de([QS,QP,mb,aI,db,ub,ab,cb,lb,hGe,_Ge,nd,pb,tb,rb,ob,ib]),JUt=de([XS,eb,eI,gWe,Vm]),XUt=de([JS,Ym,cI,rd,lI,nb,sb,ed]),QUt=de([QS,GGe,aWe,hWe,tb,rb,ob,ib]),eFt=de([XS,eb,UGe,SGe,fGe,LGe,RGe,Vm,lWe]),tFt=de([JS,nGe,fWe,kGe,xGe,lGe,uGe,pGe,fb,IGe,nb,sb,ed]);class ue extends Error{constructor(e,t,n){super(`MCP error ${e}: ${t}`);this.code=e,this.data=n,this.name="McpError"}static fromError(e,t,n){if(e===fe.UrlElicitationRequired&&n){let r=n;if(r.elicitations)return new t9(r.elicitations,t)}return new ue(e,t,n)}}class t9 extends ue{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(fe.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function Ki(e){return e==="completed"||e==="failed"||e==="cancelled"}var r9=Symbol("Let zodToJsonSchema decide on which parser to use");var n9={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},o9=(e)=>typeof e==="string"?{...n9,name:e}:{...n9,...e};var s9=(e)=>{let t=o9(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,o])=>[o._def,{def:o._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}};function uI(e,t,n,r){if(!r?.errorMessages)return;if(n)e.errorMessage={...e.errorMessage,[t]:n}}function je(e,t,n,r,o){e[t]=n,uI(e,t,r,o)}var hb=(e,t)=>{let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!==t[n])break;return[(e.length-n).toString(),...t.slice(n)].join("/")};function wt(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?hb(t,e.currentPath):t.join("/")}}function i9(e,t){let n={type:"array"};if(e.type?._def&&e.type?._def?.typeName!==B.ZodAny)n.items=ge(e.type._def,{...t,currentPath:[...t.currentPath,"items"]});if(e.minLength)je(n,"minItems",e.minLength.value,e.minLength.message,t);if(e.maxLength)je(n,"maxItems",e.maxLength.value,e.maxLength.message,t);if(e.exactLength)je(n,"minItems",e.exactLength.value,e.exactLength.message,t),je(n,"maxItems",e.exactLength.value,e.exactLength.message,t);return n}function a9(e,t){let n={type:"integer",format:"int64"};if(!e.checks)return n;for(let r of e.checks)switch(r.kind){case"min":if(t.target==="jsonSchema7")if(r.inclusive)je(n,"minimum",r.value,r.message,t);else je(n,"exclusiveMinimum",r.value,r.message,t);else{if(!r.inclusive)n.exclusiveMinimum=!0;je(n,"minimum",r.value,r.message,t)}break;case"max":if(t.target==="jsonSchema7")if(r.inclusive)je(n,"maximum",r.value,r.message,t);else je(n,"exclusiveMaximum",r.value,r.message,t);else{if(!r.inclusive)n.exclusiveMaximum=!0;je(n,"maximum",r.value,r.message,t)}break;case"multipleOf":je(n,"multipleOf",r.value,r.message,t);break}return n}function c9(){return{type:"boolean"}}function gb(e,t){return ge(e.type._def,t)}var l9=(e,t)=>ge(e.innerType._def,t);function dI(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((o,s)=>dI(e,t,o))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return _We(e,t)}}var _We=(e,t)=>{let n={type:"integer",format:"unix-time"};if(t.target==="openApi3")return n;for(let r of e.checks)switch(r.kind){case"min":je(n,"minimum",r.value,r.message,t);break;case"max":je(n,"maximum",r.value,r.message,t);break}return n};function u9(e,t){return{...ge(e.innerType._def,t),default:e.defaultValue()}}function d9(e,t){return t.effectStrategy==="input"?ge(e.schema._def,t):wt(t)}function p9(e){return{type:"string",enum:Array.from(e.values)}}var yWe=(e)=>{if("type"in e&&e.type==="string")return!1;return"allOf"in e};function f9(e,t){let n=[ge(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),ge(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((s)=>!!s),r=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return n.forEach((s)=>{if(yWe(s)){if(o.push(...s.allOf),s.unevaluatedProperties===void 0)r=void 0}else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...c}=s;i=c}else r=void 0;o.push(i)}}),o.length?{allOf:o,...r}:void 0}function m9(e,t){let n=typeof e.value;if(n!=="bigint"&&n!=="number"&&n!=="boolean"&&n!=="string")return{type:Array.isArray(e.value)?"array":"object"};if(t.target==="openApi3")return{type:n==="bigint"?"integer":n,enum:[e.value]};return{type:n==="bigint"?"integer":n,const:e.value}}var pI=void 0,Po={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(pI===void 0)pI=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return pI},uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function _b(e,t){let n={type:"string"};if(e.checks)for(let r of e.checks)switch(r.kind){case"min":je(n,"minLength",typeof n.minLength==="number"?Math.max(n.minLength,r.value):r.value,r.message,t);break;case"max":je(n,"maxLength",typeof n.maxLength==="number"?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Io(n,"email",r.message,t);break;case"format:idn-email":Io(n,"idn-email",r.message,t);break;case"pattern:zod":zn(n,Po.email,r.message,t);break}break;case"url":Io(n,"uri",r.message,t);break;case"uuid":Io(n,"uuid",r.message,t);break;case"regex":zn(n,r.regex,r.message,t);break;case"cuid":zn(n,Po.cuid,r.message,t);break;case"cuid2":zn(n,Po.cuid2,r.message,t);break;case"startsWith":zn(n,RegExp(`^${fI(r.value,t)}`),r.message,t);break;case"endsWith":zn(n,RegExp(`${fI(r.value,t)}$`),r.message,t);break;case"datetime":Io(n,"date-time",r.message,t);break;case"date":Io(n,"date",r.message,t);break;case"time":Io(n,"time",r.message,t);break;case"duration":Io(n,"duration",r.message,t);break;case"length":je(n,"minLength",typeof n.minLength==="number"?Math.max(n.minLength,r.value):r.value,r.message,t),je(n,"maxLength",typeof n.maxLength==="number"?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"includes":{zn(n,RegExp(fI(r.value,t)),r.message,t);break}case"ip":{if(r.version!=="v6")Io(n,"ipv4",r.message,t);if(r.version!=="v4")Io(n,"ipv6",r.message,t);break}case"base64url":zn(n,Po.base64url,r.message,t);break;case"jwt":zn(n,Po.jwt,r.message,t);break;case"cidr":{if(r.version!=="v6")zn(n,Po.ipv4Cidr,r.message,t);if(r.version!=="v4")zn(n,Po.ipv6Cidr,r.message,t);break}case"emoji":zn(n,Po.emoji(),r.message,t);break;case"ulid":{zn(n,Po.ulid,r.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Io(n,"binary",r.message,t);break}case"contentEncoding:base64":{je(n,"contentEncoding","base64",r.message,t);break}case"pattern:zod":{zn(n,Po.base64,r.message,t);break}}break}case"nanoid":zn(n,Po.nanoid,r.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:((o)=>{})(r)}return n}function fI(e,t){return t.patternStrategy==="escape"?bWe(e):e}var SWe=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function bWe(e){let t="";for(let n=0;n<e.length;n++){if(!SWe.has(e[n]))t+="\\";t+=e[n]}return t}function Io(e,t,n,r){if(e.format||e.anyOf?.some((o)=>o.format)){if(!e.anyOf)e.anyOf=[];if(e.format){if(e.anyOf.push({format:e.format,...e.errorMessage&&r.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage){if(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})}else je(e,"format",t,n,r)}function zn(e,t,n,r){if(e.pattern||e.allOf?.some((o)=>o.pattern)){if(!e.allOf)e.allOf=[];if(e.pattern){if(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage){if(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.allOf.push({pattern:h9(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})}else je(e,"pattern",h9(t,r),n,r)}function h9(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},r=n.i?e.source.toLowerCase():e.source,o="",s=!1,i=!1,a=!1;for(let c=0;c<r.length;c++){if(s){o+=r[c],s=!1;continue}if(n.i){if(i){if(r[c].match(/[a-z]/)){if(a)o+=r[c],o+=`${r[c-2]}-${r[c]}`.toUpperCase(),a=!1;else if(r[c+1]==="-"&&r[c+2]?.match(/[a-z]/))o+=r[c],a=!0;else o+=`${r[c]}${r[c].toUpperCase()}`;continue}}else if(r[c].match(/[a-z]/)){o+=`[${r[c]}${r[c].toUpperCase()}]`;continue}}if(n.m){if(r[c]==="^"){o+=`(^|(?<=[\r
182
+ ]))`;continue}else if(r[c]==="$"){o+=`($|(?=[\r
183
+ ]))`;continue}}if(n.s&&r[c]==="."){o+=i?`${r[c]}\r
184
+ `:`[${r[c]}\r
185
+ ]`;continue}if(o+=r[c],r[c]==="\\")s=!0;else if(i&&r[c]==="]")i=!1;else if(!i&&r[c]==="[")i=!0}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function yb(e,t){if(t.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(t.target==="openApi3"&&e.keyType?._def.typeName===B.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((r,o)=>({...r,[o]:ge(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",o]})??wt(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let n={type:"object",additionalProperties:ge(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return n;if(e.keyType?._def.typeName===B.ZodString&&e.keyType._def.checks?.length){let{type:r,...o}=_b(e.keyType._def,t);return{...n,propertyNames:o}}else if(e.keyType?._def.typeName===B.ZodEnum)return{...n,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===B.ZodBranded&&e.keyType._def.type._def.typeName===B.ZodString&&e.keyType._def.type._def.checks?.length){let{type:r,...o}=gb(e.keyType._def,t);return{...n,propertyNames:o}}return n}function g9(e,t){if(t.mapStrategy==="record")return yb(e,t);let n=ge(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||wt(t),r=ge(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||wt(t);return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function _9(e){let t=e.values,r=Object.keys(e.values).filter((s)=>typeof t[t[s]]!=="number").map((s)=>t[s]),o=Array.from(new Set(r.map((s)=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:r}}function y9(e){return e.target==="openAi"?void 0:{not:wt({...e,currentPath:[...e.currentPath,"not"]})}}function S9(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Jm={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function E9(e,t){if(t.target==="openApi3")return b9(e,t);let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every((r)=>(r._def.typeName in Jm)&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((o,s)=>{let i=Jm[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:r.length>1?r:r[0]}}else if(n.every((r)=>r._def.typeName==="ZodLiteral"&&!r.description)){let r=n.reduce((o,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(r.length===n.length){let o=r.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:n.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(n.every((r)=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,o)=>[...r,...o._def.values.filter((s)=>!r.includes(s))],[])};return b9(e,t)}var b9=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,o)=>ge(r._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter((r)=>!!r&&(!t.strictUnions||typeof r==="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function x9(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length)){if(t.target==="openApi3")return{type:Jm[e.innerType._def.typeName],nullable:!0};return{type:[Jm[e.innerType._def.typeName],"null"]}}if(t.target==="openApi3"){let r=ge(e.innerType._def,{...t,currentPath:[...t.currentPath]});if(r&&"$ref"in r)return{allOf:[r],nullable:!0};return r&&{...r,nullable:!0}}let n=ge(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function v9(e,t){let n={type:"number"};if(!e.checks)return n;for(let r of e.checks)switch(r.kind){case"int":n.type="integer",uI(n,"type",r.message,t);break;case"min":if(t.target==="jsonSchema7")if(r.inclusive)je(n,"minimum",r.value,r.message,t);else je(n,"exclusiveMinimum",r.value,r.message,t);else{if(!r.inclusive)n.exclusiveMinimum=!0;je(n,"minimum",r.value,r.message,t)}break;case"max":if(t.target==="jsonSchema7")if(r.inclusive)je(n,"maximum",r.value,r.message,t);else je(n,"exclusiveMaximum",r.value,r.message,t);else{if(!r.inclusive)n.exclusiveMaximum=!0;je(n,"maximum",r.value,r.message,t)}break;case"multipleOf":je(n,"multipleOf",r.value,r.message,t);break}return n}function w9(e,t){let n=t.target==="openAi",r={type:"object",properties:{}},o=[],s=e.shape();for(let a in s){let c=s[a];if(c===void 0||c._def===void 0)continue;let l=xWe(c);if(l&&n){if(c._def.typeName==="ZodOptional")c=c._def.innerType;if(!c.isNullable())c=c.nullable();l=!1}let u=ge(c._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});if(u===void 0)continue;if(r.properties[a]=u,!l)o.push(a)}if(o.length)r.required=o;let i=EWe(e,t);if(i!==void 0)r.additionalProperties=i;return r}function EWe(e,t){if(e.catchall._def.typeName!=="ZodNever")return ge(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function xWe(e){try{return e.isOptional()}catch{return!0}}var A9=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return ge(e.innerType._def,t);let n=ge(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:wt(t)},n]}:wt(t)};var T9=(e,t)=>{if(t.pipeStrategy==="input")return ge(e.in._def,t);else if(t.pipeStrategy==="output")return ge(e.out._def,t);let n=ge(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=ge(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter((o)=>o!==void 0)}};function C9(e,t){return ge(e.type._def,t)}function k9(e,t){let r={type:"array",uniqueItems:!0,items:ge(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};if(e.minSize)je(r,"minItems",e.minSize.value,e.minSize.message,t);if(e.maxSize)je(r,"maxItems",e.maxSize.value,e.maxSize.message,t);return r}function R9(e,t){if(e.rest)return{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>ge(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:ge(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})};else return{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>ge(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function O9(e){return{not:wt(e)}}function P9(e){return wt(e)}var I9=(e,t)=>ge(e.innerType._def,t);var D9=(e,t,n)=>{switch(t){case B.ZodString:return _b(e,n);case B.ZodNumber:return v9(e,n);case B.ZodObject:return w9(e,n);case B.ZodBigInt:return a9(e,n);case B.ZodBoolean:return c9();case B.ZodDate:return dI(e,n);case B.ZodUndefined:return O9(n);case B.ZodNull:return S9(n);case B.ZodArray:return i9(e,n);case B.ZodUnion:case B.ZodDiscriminatedUnion:return E9(e,n);case B.ZodIntersection:return f9(e,n);case B.ZodTuple:return R9(e,n);case B.ZodRecord:return yb(e,n);case B.ZodLiteral:return m9(e,n);case B.ZodEnum:return p9(e);case B.ZodNativeEnum:return _9(e);case B.ZodNullable:return x9(e,n);case B.ZodOptional:return A9(e,n);case B.ZodMap:return g9(e,n);case B.ZodSet:return k9(e,n);case B.ZodLazy:return()=>e.getter()._def;case B.ZodPromise:return C9(e,n);case B.ZodNaN:case B.ZodNever:return y9(n);case B.ZodEffects:return d9(e,n);case B.ZodAny:return wt(n);case B.ZodUnknown:return P9(n);case B.ZodDefault:return u9(e,n);case B.ZodBranded:return gb(e,n);case B.ZodReadonly:return I9(e,n);case B.ZodCatch:return l9(e,n);case B.ZodPipeline:return T9(e,n);case B.ZodFunction:case B.ZodVoid:case B.ZodSymbol:return;default:return((r)=>{return})(t)}};function ge(e,t,n=!1){let r=t.seen.get(e);if(t.override){let a=t.override?.(e,t,r,n);if(a!==r9)return a}if(r&&!n){let a=vWe(r,t);if(a!==void 0)return a}let o={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,o);let s=D9(e,e.typeName,t),i=typeof s==="function"?ge(s(),t):s;if(i)wWe(e,t,i);if(t.postProcess){let a=t.postProcess(i,e,t);return o.jsonSchema=i,a}return o.jsonSchema=i,i}var vWe=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:hb(t.currentPath,e.path)};case"none":case"seen":{if(e.path.length<t.currentPath.length&&e.path.every((n,r)=>t.currentPath[r]===n))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),wt(t);return t.$refStrategy==="seen"?wt(t):void 0}}},wWe=(e,t,n)=>{if(e.description){if(n.description=e.description,t.markdownDescription)n.markdownDescription=e.description}return n};var mI=(e,t)=>{let n=s9(t),r=typeof t==="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[l,u])=>({...c,[l]:ge(u._def,{...n,currentPath:[...n.basePath,n.definitionPath,l]},!0)??wt(n)}),{}):void 0,o=typeof t==="string"?t:t?.nameStrategy==="title"?void 0:t?.name,s=ge(e._def,o===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,o]},!1)??wt(n),i=typeof t==="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;if(i!==void 0)s.title=i;if(n.flags.hasReferencedOpenAiAnyType){if(!r)r={};if(!r[n.openAiAnyTypeName])r[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:n.$refStrategy==="relative"?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}}}let a=o===void 0?r?{...s,[n.definitionPath]:r}:s:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,o].join("/"),[n.definitionPath]:{...r,[o]:s}};if(n.target==="jsonSchema7")a.$schema="http://json-schema.org/draft-07/schema#";else if(n.target==="jsonSchema2019-09"||n.target==="openAi")a.$schema="https://json-schema.org/draft/2019-09/schema#";if(n.target==="openAi"&&(("anyOf"in a)||("oneOf"in a)||("allOf"in a)||("type"in a)&&Array.isArray(a.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return a};function AWe(e){if(!e)return"draft-7";if(e==="jsonSchema7"||e==="draft-7")return"draft-7";if(e==="jsonSchema2019-09"||e==="draft-2020-12")return"draft-2020-12";return"draft-7"}function hI(e,t){if(Zr(e))return kP(e,{target:AWe(t?.target),io:t?.pipeStrategy??"input"});return mI(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function gI(e){let n=Hi(e)?.method;if(!n)throw Error("Schema is missing a method literal");let r=VS(n);if(typeof r!=="string")throw Error("Schema method literal must be a string");return r}function _I(e,t){let n=ji(e,t);if(!n.success)throw n.error;return n.data}var TWe=60000;class yI{constructor(e){if(this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(XS,(t)=>{this._oncancel(t)}),this.setNotificationHandler(eb,(t)=>{this._onprogress(t)}),this.setRequestHandler(QS,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(tb,async(t,n)=>{let r=await this._taskStore.getTask(t.params.taskId,n.sessionId);if(!r)throw new ue(fe.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(rb,async(t,n)=>{let r=async()=>{let o=t.params.taskId;if(this._taskMessageQueue){let i;while(i=await this._taskMessageQueue.dequeue(o,n.sessionId)){if(i.type==="response"||i.type==="error"){let a=i.message,c=a.id,l=this._requestResolvers.get(c);if(l)if(this._requestResolvers.delete(c),i.type==="response")l(a);else{let u=a,p=new ue(u.error.code,u.error.message,u.error.data);l(p)}else{let u=i.type==="response"?"Response":"Error";this._onerror(Error(`${u} handler missing for request ${c}`))}continue}await this._transport?.send(i.message,{relatedRequestId:n.requestId})}}let s=await this._taskStore.getTask(o,n.sessionId);if(!s)throw new ue(fe.InvalidParams,`Task not found: ${o}`);if(!Ki(s.status))return await this._waitForTaskUpdate(o,n.signal),await r();if(Ki(s.status)){let i=await this._taskStore.getTaskResult(o,n.sessionId);return this._clearTaskQueue(o),{...i,_meta:{...i._meta,[Bi]:{taskId:o}}}}return await r()};return await r()}),this.setRequestHandler(ob,async(t,n)=>{try{let{tasks:r,nextCursor:o}=await this._taskStore.listTasks(t.params?.cursor,n.sessionId);return{tasks:r,nextCursor:o,_meta:{}}}catch(r){throw new ue(fe.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(ib,async(t,n)=>{try{let r=await this._taskStore.getTask(t.params.taskId,n.sessionId);if(!r)throw new ue(fe.InvalidParams,`Task not found: ${t.params.taskId}`);if(Ki(r.status))throw new ue(fe.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(t.params.taskId);let o=await this._taskStore.getTask(t.params.taskId,n.sessionId);if(!o)throw new ue(fe.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...o}}catch(r){if(r instanceof ue)throw r;throw new ue(fe.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),ue.fromError(fe.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=(o)=>{n?.(o),this._onerror(o)};let r=this._transport?.onmessage;this._transport.onmessage=(o,s)=>{if(r?.(o,s),Hm(o)||GZ(o))this._onresponse(o);else if(YP(o))this._onrequest(o,s);else if(KZ(o))this._onnotification(o);else this._onerror(Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let t=ue.fromError(fe.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;if(t===void 0)return;Promise.resolve().then(()=>t(e)).catch((n)=>this._onerror(Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,t){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,o=e.params?._meta?.[Bi]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:fe.MethodNotFound,message:"Method not found"}};if(o&&this._taskMessageQueue)this._enqueueTaskMessage(o,{type:"error",message:l,timestamp:Date.now()},r?.sessionId).catch((u)=>this._onerror(Error(`Failed to enqueue error response: ${u}`)));else r?.send(l).catch((u)=>this._onerror(Error(`Failed to send an error response: ${u}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let i=jZ(e.params)?e.params.task:void 0,a=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,c={signal:s.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async(l)=>{if(s.signal.aborted)return;let u={relatedRequestId:e.id};if(o)u.relatedTask={taskId:o};await this.notification(l,u)},sendRequest:async(l,u,p)=>{if(s.signal.aborted)throw new ue(fe.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:e.id};if(o&&!f.relatedTask)f.relatedTask={taskId:o};let m=f.relatedTask?.taskId??o;if(m&&a)await a.updateTaskStatus(m,"input_required");return await this.request(l,u,f)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:o,taskStore:a,taskRequestedTtl:i?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(i)this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,c)).then(async(l)=>{if(s.signal.aborted)return;let u={result:l,jsonrpc:"2.0",id:e.id};if(o&&this._taskMessageQueue)await this._enqueueTaskMessage(o,{type:"response",message:u,timestamp:Date.now()},r?.sessionId);else await r?.send(u)},async(l)=>{if(s.signal.aborted)return;let u={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:fe.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};if(o&&this._taskMessageQueue)await this._enqueueTaskMessage(o,{type:"error",message:u,timestamp:Date.now()},r?.sessionId);else await r?.send(u)}).catch((l)=>this._onerror(Error(`Failed to send response: ${l}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===s)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),o=this._progressHandlers.get(r);if(!o){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(r),i=this._timeoutInfo.get(r);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(a){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),s(a);return}o(n)}_onresponse(e){let t=Number(e.id),n=this._requestResolvers.get(t);if(n){if(this._requestResolvers.delete(t),Hm(e))n(e);else{let s=new ue(e.error.code,e.error.message,e.error.data);n(s)}return}let r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let o=!1;if(Hm(e)&&e.result&&typeof e.result==="object"){let s=e.result;if(s.task&&typeof s.task==="object"){let i=s.task;if(typeof i.taskId==="string")o=!0,this._taskProgressTokens.set(i.taskId,t)}}if(!o)this._progressHandlers.delete(t);if(Hm(e))r(e);else{let s=ue.fromError(e.error.code,e.error.message,e.error.data);r(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,n){let{task:r}=n??{};if(!r){try{yield{type:"result",result:await this.request(e,t,n)}}catch(s){yield{type:"error",error:s instanceof ue?s:new ue(fe.InternalError,String(s))}}return}let o;try{let s=await this.request(e,ed,n);if(s.task)o=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new ue(fe.InternalError,"Task creation did not return a task");while(!0){let i=await this.getTask({taskId:o},n);if(yield{type:"taskStatus",task:i},Ki(i.status)){if(i.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:o},t,n)};else if(i.status==="failed")yield{type:"error",error:new ue(fe.InternalError,`Task ${o} failed`)};else if(i.status==="cancelled")yield{type:"error",error:new ue(fe.InternalError,`Task ${o} was cancelled`)};return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},t,n)};return}let a=i.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((c)=>setTimeout(c,a)),n?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof ue?s:new ue(fe.InternalError,String(s))}}}request(e,t,n){let{relatedRequestId:r,resumptionToken:o,onresumptiontoken:s,task:i,relatedTask:a}=n??{};return new Promise((c,l)=>{let u=(E)=>{l(E)};if(!this._transport){u(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),i)this.assertTaskCapability(e.method)}catch(E){u(E);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};if(n?.onprogress)this._progressHandlers.set(p,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}};if(i)f.params={...f.params,task:i};if(a)f.params={...f.params,_meta:{...f.params?._meta||{},[Bi]:a}};let m=(E)=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(E)}},{relatedRequestId:r,resumptionToken:o,onresumptiontoken:s}).catch((x)=>this._onerror(Error(`Failed to send cancellation: ${x}`)));let S=E instanceof ue?E:new ue(fe.RequestTimeout,String(E));l(S)};this._responseHandlers.set(p,(E)=>{if(n?.signal?.aborted)return;if(E instanceof Error)return l(E);try{let S=ji(t,E.result);if(!S.success)l(S.error);else c(S.data)}catch(S){l(S)}}),n?.signal?.addEventListener("abort",()=>{m(n?.signal?.reason)});let h=n?.timeout??TWe,y=()=>m(ue.fromError(fe.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(p,h,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let _=a?.taskId;if(_){let E=(S)=>{let x=this._responseHandlers.get(p);if(x)x(S);else this._onerror(Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,E),this._enqueueTaskMessage(_,{type:"request",message:f,timestamp:Date.now()}).catch((S)=>{this._cleanupTimeout(p),l(S)})}else this._transport.send(f,{relatedRequestId:r,resumptionToken:o,onresumptiontoken:s}).catch((E)=>{this._cleanupTimeout(p),l(E)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},nb,t)}async getTaskResult(e,t,n){return this.request({method:"tasks/result",params:e},t,n)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},sb,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},VZ,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let n=t?.relatedTask?.taskId;if(n){let i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Bi]:t.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let i={...e,jsonrpc:"2.0"};if(t?.relatedTask)i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Bi]:t.relatedTask}}};this._transport?.send(i,t).catch((a)=>this._onerror(a))});return}let s={...e,jsonrpc:"2.0"};if(t?.relatedTask)s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Bi]:t.relatedTask}}};await this._transport.send(s,t)}setRequestHandler(e,t){let n=gI(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(r,o)=>{let s=_I(e,r);return Promise.resolve(t(s,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let n=gI(e);this._notificationHandlers.set(n,(r)=>{let o=_I(e,r);return Promise.resolve(t(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);if(t!==void 0)this._progressHandlers.delete(t),this._taskProgressTokens.delete(e)}async _enqueueTaskMessage(e,t,n){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,n,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,t);for(let r of n)if(r.type==="request"&&YP(r.message)){let o=r.message.id,s=this._requestResolvers.get(o);if(s)s(new ue(fe.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o);else this._onerror(Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let n=this._options?.defaultTaskPollInterval??1000;try{let r=await this._taskStore?.getTask(e);if(r?.pollInterval)n=r.pollInterval}catch{}return new Promise((r,o)=>{if(t.aborted){o(new ue(fe.InvalidRequest,"Request cancelled"));return}let s=setTimeout(r,n);t.addEventListener("abort",()=>{clearTimeout(s),o(new ue(fe.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let n=this._taskStore;if(!n)throw Error("No task store configured");return{createTask:async(r)=>{if(!e)throw Error("No request provided");return await n.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async(r)=>{let o=await n.getTask(r,t);if(!o)throw new ue(fe.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(r,o,s)=>{await n.storeTaskResult(r,o,s,t);let i=await n.getTask(r,t);if(i){let a=Vm.parse({method:"notifications/tasks/status",params:i});if(await this.notification(a),Ki(i.status))this._cleanupTaskProgressHandler(r)}},getTaskResult:(r)=>n.getTaskResult(r,t),updateTaskStatus:async(r,o,s)=>{let i=await n.getTask(r,t);if(!i)throw new ue(fe.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(Ki(i.status))throw new ue(fe.InvalidParams,`Cannot update task "${r}" from terminal status "${i.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(r,o,s,t);let a=await n.getTask(r,t);if(a){let c=Vm.parse({method:"notifications/tasks/status",params:a});if(await this.notification(c),Ki(a.status))this._cleanupTaskProgressHandler(r)}},listTasks:(r)=>n.listTasks(r,t)}}}function L9(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function N9(e,t){let n={...e};for(let r in t){let o=r,s=t[o];if(s===void 0)continue;let i=n[o];if(L9(i)&&L9(s))n[o]={...i,...s};else n[o]=s}return n}var _X=Wn(fD(),1),yX=Wn(gX(),1);function qYe(){let e=new _X.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return yX.default(e),e}class vD{constructor(e){this._ajv=e??qYe()}getValidator(e){let t="$id"in e&&typeof e.$id==="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return(n)=>{if(t(n))return{valid:!0,data:n,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class wD{constructor(e){this._server=e}requestStream(e,t,n){return this._server.requestStream(e,t,n)}createMessageStream(e,t){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let r=e.messages[e.messages.length-1],o=Array.isArray(r.content)?r.content:[r.content],s=o.some((l)=>l.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some((l)=>l.type==="tool_use");if(s){if(o.some((l)=>l.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!c)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let l=new Set(a.filter((p)=>p.type==="tool_use").map((p)=>p.id)),u=new Set(o.filter((p)=>p.type==="tool_result").map((p)=>p.toolUseId));if(l.size!==u.size||![...l].every((p)=>u.has(p)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Ym,t)}elicitInputStream(e,t){let n=this._server.getClientCapabilities(),r=e.mode??"form";switch(r){case"url":{if(!n?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let o=r==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:o},rd,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,n){return this._server.getTaskResult({taskId:e},t,n)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}function SX(e,t,n){if(!e)throw Error(`${n} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${n} does not support task creation for tools/call (required for ${t})`);break;default:break}}function bX(e,t,n){if(!e)throw Error(`${n} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${n} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${n} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}class AD extends yI{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Zm.options.map((n,r)=>[n,r])),this.isMessageIgnored=(n,r)=>{let o=this._loggingLevels.get(r);return o?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new vD,this.setRequestHandler(QP,(n)=>this._oninitialize(n)),this.setNotificationHandler(eI,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(aI,async(n,r)=>{let o=r.sessionId||r.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=n.params,i=Zm.safeParse(s);if(i.success)this._loggingLevels.set(o,i.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new wD(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=N9(this._capabilities,e)}setRequestHandler(e,t){let r=Hi(e)?.method;if(!r)throw Error("Schema is missing a method literal");let o;if(Zr(r)){let i=r;o=i._zod?.def?.value??i.value}else{let i=r;o=i._def?.value??i.value}if(typeof o!=="string")throw Error("Schema method literal must be a string");if(o==="tools/call"){let i=async(a,c)=>{let l=ji(nd,a);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new ue(fe.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:u}=l.data,p=await Promise.resolve(t(a,c));if(u.task){let m=ji(ed,p);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new ue(fe.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}let f=ji(fb,p);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new ue(fe.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){bX(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;SX(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:FZ.includes(t)?t:qP,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},JS)}async createMessage(e,t){if(e.tools||e.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(e.messages.length>0){let n=e.messages[e.messages.length-1],r=Array.isArray(n.content)?n.content:[n.content],o=r.some((c)=>c.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=s?Array.isArray(s.content)?s.content:[s.content]:[],a=i.some((c)=>c.type==="tool_use");if(o){if(r.some((c)=>c.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!a)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(a){let c=new Set(i.filter((u)=>u.type==="tool_use").map((u)=>u.id)),l=new Set(r.filter((u)=>u.type==="tool_result").map((u)=>u.toolUseId));if(c.size!==l.size||![...c].every((u)=>l.has(u)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(e.tools)return this.request({method:"sampling/createMessage",params:e},cI,t);return this.request({method:"sampling/createMessage",params:e},Ym,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let r=e;return this.request({method:"elicitation/create",params:r},rd,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let r=e.mode==="form"?e:{...e,mode:"form"},o=await this.request({method:"elicitation/create",params:r},rd,t);if(o.action==="accept"&&o.content&&r.requestedSchema)try{let i=this._jsonSchemaValidator.getValidator(r.requestedSchema)(o.content);if(!i.valid)throw new ue(fe.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorMessage}`)}catch(s){if(s instanceof ue)throw s;throw new ue(fe.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return o}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},lI,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging){if(!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var xX=Symbol.for("mcp.completable");function TD(e){return!!e&&typeof e==="object"&&xX in e}function vX(e){return e[xX]?.complete}var EX;(function(e){e.Completable="McpCompletable"})(EX||(EX={}));var ZYe=/^[A-Za-z0-9._-]{1,128}$/;function YYe(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" "))t.push("Tool name contains spaces, which may cause parsing issues");if(e.includes(","))t.push("Tool name contains commas, which may cause parsing issues");if(e.startsWith("-")||e.endsWith("-"))t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(e.startsWith(".")||e.endsWith("."))t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!ZYe.test(e)){let n=e.split("").filter((r)=>!/[A-Za-z0-9._-]/.test(r)).filter((r,o,s)=>s.indexOf(r)===o);return t.push(`Tool name contains invalid characters: ${n.map((r)=>`"${r}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function JYe(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let n of t)console.warn(` - ${n}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function CD(e){let t=YYe(e);return JYe(e,t.warnings),t.isValid}class kD{constructor(e){this._mcpServer=e}registerToolTask(e,t,n){let r={taskSupport:"required",...t.execution};if(r.taskSupport==="forbidden")throw Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,r,t._meta,n)}}class OD{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new AD(e,t)}get experimental(){if(!this._experimental)this._experimental={tasks:new kD(this)};return this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(Xi(pb)),this.server.assertCanSetRequestHandler(Xi(nd)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(pb,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:(()=>{let r=Xu(t.inputSchema);return r?hI(r,{strictUnions:!0,pipeStrategy:"input"}):XYe})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let r=Xu(t.outputSchema);if(r)n.outputSchema=hI(r,{strictUnions:!0,pipeStrategy:"output"})}return n})})),this.server.setRequestHandler(nd,async(e,t)=>{try{let n=this._registeredTools[e.params.name];if(!n)throw new ue(fe.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new ue(fe.InvalidParams,`Tool ${e.params.name} disabled`);let r=!!e.params.task,o=n.execution?.taskSupport,s="createTask"in n.handler;if((o==="required"||o==="optional")&&!s)throw new ue(fe.InternalError,`Tool ${e.params.name} has taskSupport '${o}' but was not registered with registerToolTask`);if(o==="required"&&!r)throw new ue(fe.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(o==="optional"&&!r&&s)return await this.handleAutomaticTaskPolling(n,e,t);let i=await this.validateToolInput(n,e.params.arguments,e.params.name),a=await this.executeToolHandler(n,i,t);if(r)return a;return await this.validateToolOutput(n,a,e.params.name),a}catch(n){if(n instanceof ue){if(n.code===fe.UrlElicitationRequired)throw n}return this.createToolError(n instanceof Error?n.message:String(n))}}),this._toolHandlersInitialized=!0}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,n){if(!e.inputSchema)return;let o=Xu(e.inputSchema)??e.inputSchema,s=await GS(o,t);if(!s.success){let i="error"in s?s.error:"Unknown error",a=WS(i);throw new ue(fe.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${a}`)}return s.data}async validateToolOutput(e,t,n){if(!e.outputSchema)return;if(!("content"in t))return;if(t.isError)return;if(!t.structuredContent)throw new ue(fe.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let r=Xu(e.outputSchema),o=await GS(r,t.structuredContent);if(!o.success){let s="error"in o?o.error:"Unknown error",i=WS(s);throw new ue(fe.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${i}`)}}async executeToolHandler(e,t,n){let r=e.handler;if("createTask"in r){if(!n.taskStore)throw Error("No task store provided.");let s={...n,taskStore:n.taskStore};if(e.inputSchema)return await Promise.resolve(r.createTask(t,s));else return await Promise.resolve(r.createTask(s))}if(e.inputSchema)return await Promise.resolve(r(t,n));else return await Promise.resolve(r(n))}async handleAutomaticTaskPolling(e,t,n){if(!n.taskStore)throw Error("No task store provided for task-capable tool.");let r=await this.validateToolInput(e,t.params.arguments,t.params.name),o=e.handler,s={...n,taskStore:n.taskStore},i=r?await Promise.resolve(o.createTask(r,s)):await Promise.resolve(o.createTask(s)),a=i.task.taskId,c=i.task,l=c.pollInterval??5000;while(c.status!=="completed"&&c.status!=="failed"&&c.status!=="cancelled"){await new Promise((p)=>setTimeout(p,l));let u=await n.taskStore.getTask(a);if(!u)throw new ue(fe.InternalError,`Task ${a} not found during polling`);c=u}return await n.taskStore.getTaskResult(a)}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(Xi(mb)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(mb,async(e)=>{switch(e.params.ref.type){case"ref/prompt":return QZ(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return e9(e),this.handleResourceCompletion(e,e.params.ref);default:throw new ue(fe.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(e,t){let n=this._registeredPrompts[t.name];if(!n)throw new ue(fe.InvalidParams,`Prompt ${t.name} not found`);if(!n.enabled)throw new ue(fe.InvalidParams,`Prompt ${t.name} disabled`);if(!n.argsSchema)return Eh;let o=Hi(n.argsSchema)?.[e.params.argument.name];if(!TD(o))return Eh;let s=vX(o);if(!s)return Eh;let i=await s(e.params.argument.value,e.params.context);return AX(i)}async handleResourceCompletion(e,t){let n=Object.values(this._registeredResourceTemplates).find((s)=>s.resourceTemplate.uriTemplate.toString()===t.uri);if(!n){if(this._registeredResources[t.uri])return Eh;throw new ue(fe.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let r=n.resourceTemplate.completeCallback(e.params.argument.name);if(!r)return Eh;let o=await r(e.params.argument.value,e.params.context);return AX(o)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(Xi(ab)),this.server.assertCanSetRequestHandler(Xi(cb)),this.server.assertCanSetRequestHandler(Xi(lb)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(ab,async(e,t)=>{let n=Object.entries(this._registeredResources).filter(([o,s])=>s.enabled).map(([o,s])=>({uri:o,name:s.name,...s.metadata})),r=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let s=await o.resourceTemplate.listCallback(t);for(let i of s.resources)r.push({...o.metadata,...i})}return{resources:[...n,...r]}}),this.server.setRequestHandler(cb,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,n])=>({name:t,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(lb,async(e,t)=>{let n=new URL(e.params.uri),r=this._registeredResources[n.toString()];if(r){if(!r.enabled)throw new ue(fe.InvalidParams,`Resource ${n} disabled`);return r.readCallback(n,t)}for(let o of Object.values(this._registeredResourceTemplates)){let s=o.resourceTemplate.uriTemplate.match(n.toString());if(s)return o.readCallback(n,s,t)}throw new ue(fe.InvalidParams,`Resource ${n} not found`)}),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(Xi(ub)),this.server.assertCanSetRequestHandler(Xi(db)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(ub,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?QYe(t.argsSchema):void 0}))})),this.server.setRequestHandler(db,async(e,t)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new ue(fe.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new ue(fe.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){let r=Xu(n.argsSchema),o=await GS(r,e.params.arguments);if(!o.success){let a="error"in o?o.error:"Unknown error",c=WS(a);throw new ue(fe.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${c}`)}let s=o.data,i=n.callback;return await Promise.resolve(i(s,t))}else{let r=n.callback;return await Promise.resolve(r(t))}}),this._promptHandlersInitialized=!0}resource(e,t,...n){let r;if(typeof n[0]==="object")r=n.shift();let o=n[0];if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let s=this._createRegisteredResource(e,void 0,t,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,void 0,t,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(e,t,n,r){if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let o=this._createRegisteredResource(e,n.title,t,n,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,n.title,t,n,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,t,n,r,o){let s={name:e,title:t,metadata:r,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:(i)=>{if(typeof i.uri<"u"&&i.uri!==n){if(delete this._registeredResources[n],i.uri)this._registeredResources[i.uri]=s}if(typeof i.name<"u")s.name=i.name;if(typeof i.title<"u")s.title=i.title;if(typeof i.metadata<"u")s.metadata=i.metadata;if(typeof i.callback<"u")s.readCallback=i.callback;if(typeof i.enabled<"u")s.enabled=i.enabled;this.sendResourceListChanged()}};return this._registeredResources[n]=s,s}_createRegisteredResourceTemplate(e,t,n,r,o){let s={resourceTemplate:n,title:t,metadata:r,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:(c)=>{if(typeof c.name<"u"&&c.name!==e){if(delete this._registeredResourceTemplates[e],c.name)this._registeredResourceTemplates[c.name]=s}if(typeof c.title<"u")s.title=c.title;if(typeof c.template<"u")s.resourceTemplate=c.template;if(typeof c.metadata<"u")s.metadata=c.metadata;if(typeof c.callback<"u")s.readCallback=c.callback;if(typeof c.enabled<"u")s.enabled=c.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=s;let i=n.uriTemplate.variableNames;if(Array.isArray(i)&&i.some((c)=>!!n.completeCallback(c)))this.setCompletionRequestHandler();return s}_createRegisteredPrompt(e,t,n,r,o){let s={title:t,description:n,argsSchema:r===void 0?void 0:fc(r),callback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:(i)=>{if(typeof i.name<"u"&&i.name!==e){if(delete this._registeredPrompts[e],i.name)this._registeredPrompts[i.name]=s}if(typeof i.title<"u")s.title=i.title;if(typeof i.description<"u")s.description=i.description;if(typeof i.argsSchema<"u")s.argsSchema=fc(i.argsSchema);if(typeof i.callback<"u")s.callback=i.callback;if(typeof i.enabled<"u")s.enabled=i.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=s,r){if(Object.values(r).some((a)=>{let c=a instanceof LS?a._def?.innerType:a;return TD(c)}))this.setCompletionRequestHandler()}return s}_createRegisteredTool(e,t,n,r,o,s,i,a,c){CD(e);let l={title:t,description:n,inputSchema:wX(r),outputSchema:wX(o),annotations:s,execution:i,_meta:a,handler:c,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:(u)=>{if(typeof u.name<"u"&&u.name!==e){if(typeof u.name==="string")CD(u.name);if(delete this._registeredTools[e],u.name)this._registeredTools[u.name]=l}if(typeof u.title<"u")l.title=u.title;if(typeof u.description<"u")l.description=u.description;if(typeof u.paramsSchema<"u")l.inputSchema=fc(u.paramsSchema);if(typeof u.outputSchema<"u")l.outputSchema=fc(u.outputSchema);if(typeof u.callback<"u")l.handler=u.callback;if(typeof u.annotations<"u")l.annotations=u.annotations;if(typeof u._meta<"u")l._meta=u._meta;if(typeof u.enabled<"u")l.enabled=u.enabled;this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...t){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let n,r,o,s;if(typeof t[0]==="string")n=t.shift();if(t.length>1){let a=t[0];if(RD(a)){if(r=t.shift(),t.length>1&&typeof t[0]==="object"&&t[0]!==null&&!RD(t[0]))s=t.shift()}else if(typeof a==="object"&&a!==null){if(Object.values(a).some((c)=>typeof c==="object"&&c!==null))throw Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=t.shift()}}let i=t[0];return this._createRegisteredTool(e,void 0,n,r,o,s,{taskSupport:"forbidden"},void 0,i)}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:r,description:o,inputSchema:s,outputSchema:i,annotations:a,_meta:c}=t;return this._createRegisteredTool(e,r,o,s,i,a,{taskSupport:"forbidden"},c,n)}prompt(e,...t){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let n;if(typeof t[0]==="string")n=t.shift();let r;if(t.length>1)r=t.shift();let o=t[0],s=this._createRegisteredPrompt(e,void 0,n,r,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(e,t,n){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:r,description:o,argsSchema:s}=t,i=this._createRegisteredPrompt(e,r,o,s,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var XYe={type:"object",properties:{}};function TX(e){return e!==null&&typeof e==="object"&&"parse"in e&&typeof e.parse==="function"&&"safeParse"in e&&typeof e.safeParse==="function"}function CX(e){return"_def"in e||"_zod"in e||TX(e)}function RD(e){if(typeof e!=="object"||e===null)return!1;if(CX(e))return!1;if(Object.keys(e).length===0)return!0;return Object.values(e).some(TX)}function wX(e){if(!e)return;if(RD(e))return fc(e);if(!CX(e))throw Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}function QYe(e){let t=Hi(e);if(!t)return[];return Object.entries(t).map(([n,r])=>{let o=MZ(r),s=UZ(r);return{name:n,description:o,required:!s}})}function Xi(e){let n=Hi(e)?.method;if(!n)throw Error("Schema is missing a method literal");let r=VS(n);if(typeof r==="string")return r;throw Error("Schema method literal must be a string")}function AX(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var Eh={completion:{values:[],hasMore:!1}};function eJe(e,t,n,r,o){let s={};if(o?.searchHint)s["anthropic/searchHint"]=o.searchHint;if(o?.alwaysLoad)s["anthropic/alwaysLoad"]=!0;return{name:e,description:t,inputSchema:n,handler:r,annotations:o?.annotations,_meta:Object.keys(s).length>0?s:void 0}}function tJe(e){let t=new OD({name:e.name,version:e.version??"1.0.0"},{capabilities:{tools:e.tools?{}:void 0},instructions:e.instructions});if(e.tools)e.tools.forEach((r)=>{for(let o of Object.values(r.inputSchema)){if(!nJe(o))continue;let s=o.description;if(s&&!ko.has(o))ko.add(o,{description:s})}t.registerTool(r.name,{description:r.description,inputSchema:r.inputSchema,annotations:r.annotations,_meta:e.alwaysLoad?{"anthropic/alwaysLoad":!0,...r._meta}:r._meta},r.handler)});let n=nm(e.timeout);return{type:"sdk",name:e.name,instance:t,...n!==void 0&&{timeout:n}}}function nJe(e){return typeof e==="object"&&e!==null&&"_zod"in e}var kX=15000,rJe=I(()=>C({session_id:g(),ws_url:g(),work_dir:g().optional(),session_key:g().optional()}));class $o extends Error{code;constructor(e,t){super(e);this.name="DirectConnectError",this.code=t}}class OX{options;ws;sessionId;workDir;abortController;readyState=!1;closed=!1;exitError;messages=new tm;readyPromise;readyResolve;readyReject;abortHandler;partialChunks=[];telemetryEmitted=!1;constructor(e){this.options=e;this.abortController=e.abortController??new AbortController,this.readyPromise=new Promise((t,n)=>{this.readyResolve=t,this.readyReject=n}),this.readyPromise.catch(()=>{}),this.initialize()}get ready(){return this.readyPromise}getSessionId(){return this.sessionId}getWorkDir(){return this.workDir}async initialize(){if(this.abortController.signal.aborted){this.failInit(new _r("Connection aborted"));return}this.abortHandler=()=>{this.close(),this.exitError=new _r("Connection aborted by user")},this.abortController.signal.addEventListener("abort",this.abortHandler);let e;try{let o=await sJe(this.options);this.sessionId=o.sessionId,this.workDir=o.workDir,e=o.wsUrl}catch(o){let s=Hr(o);if(!(s instanceof _r)){let i=s instanceof $o&&s.code?s.code:"session_create_failed";this.emitTelemetry("bad",i)}this.failInit(s);return}if(this.closed){if(this.options.deleteSessionOnClose&&this.sessionId)RX(this.options.serverUrl,this.sessionId,this.options.authToken);return}let t={};if(this.options.authToken)t.authorization=`Bearer ${this.options.authToken}`;let n=new WebSocket(e,{headers:t});this.ws=n;let r=setTimeout((o,s)=>{if(!o.readyState){s.close();let i=new $o(`WebSocket connection timeout after ${kX}ms`);o.exitError=i,o.readyReject?.(i),o.emitTelemetry("bad","connect_timeout")}},kX,this,n);n.addEventListener("open",()=>{clearTimeout(r),this.readyState=!0,yn(`[DirectConnectTransport] Connected to ${this.options.serverUrl}, session=${this.sessionId}`),this.readyResolve?.(),this.emitTelemetry("ok")}),n.addEventListener("message",(o)=>{let s=typeof o.data==="string"?o.data:"";if(s.indexOf(`
186
+ `)===-1){if(s)this.partialChunks.push(s);return}let i=this.partialChunks.join("")+s;this.partialChunks.length=0;let a=i.split(`
187
+ `),c=a.pop()??"";if(c)this.partialChunks.push(c);for(let l of a){if(!l)continue;let u;try{u=lt(l)}catch(p){yn(`DirectConnect: dropped malformed JSON line (${l.length} bytes): ${p}`);continue}this.messages.enqueue(u)}}),n.addEventListener("error",()=>{clearTimeout(r);let o=new $o("WebSocket connection error");if(this.exitError=o,this.readyReject?.(o),this.messages.done(),!this.readyState)this.emitTelemetry("bad","ws_error")}),n.addEventListener("close",(o)=>{let s=this.readyState;this.readyState=!1,this.closed=!0;let i=o.code!==1000&&o.code!==1001;if(i&&!this.exitError)this.exitError=new $o(`WebSocket closed abnormally: ${o.code} ${o.reason}`);if(this.messages.done(),s&&i&&!this.abortController.signal.aborted)this.emitTelemetry("sad","ws_closed_abnormally")})}emitTelemetry(e,t){if(this.telemetryEmitted)return;if(this.telemetryEmitted=!0,e==="ok")ZC("transport_direct_connect");else if(e==="bad")YC("transport_direct_connect",t??"unknown");else VK("transport_direct_connect",t??"unknown")}failInit(e){this.exitError=e,this.closed=!0,this.readyReject?.(e),this.messages.done()}async write(e){if(this.abortController.signal.aborted)throw new _r("Operation aborted");if(!this.readyState)await this.readyPromise;if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new $o("Transport is not ready for writing");this.ws.send(e)}isReady(){return this.readyState&&this.ws?.readyState===WebSocket.OPEN}endInput(){}[Symbol.dispose](){this.close()}close(){if(this.closed)return;if(this.closed=!0,this.readyState=!1,this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;if(!this.abortController.signal.aborted)this.abortController.abort();if(this.ws&&this.ws.readyState===WebSocket.OPEN)this.ws.close(1000,"Normal closure");if(this.messages.done(),this.options.deleteSessionOnClose&&this.sessionId)RX(this.options.serverUrl,this.sessionId,this.options.authToken)}async*readMessages(){if(yield*this.messages,this.exitError)throw this.exitError}}function oJe(e){if(e.startsWith("cc://")){let r=e.slice(5),o=new URL(`http://${r}`),s=o.pathname.slice(1)||void 0;return{serverUrl:`http://${o.host}`,authToken:s}}if(e.startsWith("cc+unix://"))throw new $o("Unix socket connect (cc+unix://) is not supported by the SDK transport");let t=/^https?:\/\//i.test(e)?e:`http://${e}`,n=new URL(t);return{serverUrl:`${n.protocol}//${n.host}`,authToken:void 0}}async function sJe(e){let t={"content-type":"application/json"};if(e.authToken)t.authorization=`Bearer ${e.authToken}`;let n={};if(e.cwd)n.cwd=e.cwd;if(e.sessionKey)n.session_key=e.sessionKey;if(e.permissionMode)n.permission_mode=e.permissionMode;let r;try{r=await fetch(`${e.serverUrl}/sessions`,{method:"POST",headers:t,body:me(n)})}catch(s){throw new $o(`Failed to connect to server at ${e.serverUrl}: ${s instanceof Error?s.message:String(s)}`,"session_create_failed")}if(!r.ok){let s=await r.text().catch(()=>"");throw new $o(`Failed to create session: ${r.status} ${r.statusText}${s?` — ${s}`:""}`,"session_create_failed")}let o=rJe().safeParse(await r.json());if(!o.success)throw new $o(`Invalid session response: ${o.error.message}`,"session_create_invalid_response");return{sessionId:o.data.session_id,wsUrl:o.data.ws_url,workDir:o.data.work_dir}}async function RX(e,t,n){let r={};if(n)r.authorization=`Bearer ${n}`;try{await fetch(`${e}/sessions/${t}`,{method:"DELETE",headers:r})}catch{}}import{resolve as Ztt}from"path";function Ec(){return rx.of(Ct().host)}function PX(e){Ec().invalidateAll(e)}var IX=["userSettings","projectSettings","localSettings","flagSettings","policySettings"];var iJe=["projectSettings","localSettings"],FHt=new Set(iJe);var DX=["auto","bypassPermissions"];import{join as Id}from"path";import{dirname as aJe}from"path";function NX(){}async function cJe(e,t){let n=tt();try{await n.appendFile(e,t)}catch{await n.mkdir(aJe(e)).catch(NX),await n.appendFile(e,t)}}class MX{pendingWrite=Promise.resolve();cleanupRegistered=!1;append(e,t){if(this.pendingWrite=this.pendingWrite.then(cJe.bind(null,e,t)).catch(NX),!this.cleanupRegistered)this.cleanupRegistered=!0,B_(()=>this.flush())}flush(){return this.pendingWrite}}var lJe=new nt(()=>new MX);function uJe(){return lJe.of(Ct().host)}function xh(e,t,n){let r=pJe();if(!r)return;let o;try{o=LX(e,t,dJe(n))}catch{o=LX(e,t,{diagnostics_payload_failed:!0})}uJe().append(r,o)}function dJe(e){try{return(typeof e==="function"?e():e)??{}}catch{return{diagnostics_payload_failed:!0}}}function LX(e,t,n){let r={timestamp:new Date().toISOString(),level:e,event:t,data:n};return me(r)+`
188
+ `}function pJe(){return Mn.CLAUDE_CODE_DIAGNOSTICS_FILE}function UX(e,t,n){fJe(e.statSync(t),t,n)}function fJe(e,t,n){if(e.isDirectory())throw Object.assign(Error("EISDIR: illegal operation on a directory, read"),{code:"EISDIR",errno:-21,syscall:"read",path:t});if(!e.isFile())throw Object.assign(Error("Not a regular file (device, FIFO, or socket)"),{code:"ERR_NOT_REGULAR_FILE",path:t});if(n!==void 0&&e.size>n)throw Object.assign(Error("File exceeds maxBytes limit"),{code:"ERR_FILE_TOO_LARGE",path:t,size:e.size,maxBytes:n})}function FX(e,t,n){if(n===void 0)return;if(e>n)throw Object.assign(Error("File exceeds maxBytes limit"),{code:"ERR_FILE_TOO_LARGE",path:t,size:e,maxBytes:n})}function $X(e){return e!=null&&typeof e==="object"&&"code"in e&&e.code==="ERR_FILE_TOO_LARGE"}function mJe(e){if(e.byteLength===0)return"utf8";if(e.byteLength>=2){if(e[0]===255&&e[1]===254)return"utf16le"}if(e.byteLength>=3&&e[0]===239&&e[1]===187&&e[2]===191)return"utf8";return"utf8"}function zX(e){let{buffer:t,bytesRead:n}=tt().readSync(e,{length:4096});return mJe(t.subarray(0,n))}function jX(e){let t=0,n=0;for(let r=0;r<e.length;r++)if(e[r]===`
189
+ `)if(r>0&&e[r-1]==="\r")t++;else n++;return t>n?"CRLF":"LF"}function hJe(e,t){let n=tt(),{resolvedPath:r,isSymlink:o}=vf(n,e);if(o)ce(`Reading through symlink: ${e} -> ${r}`);UX(n,e,t);let s=zX(e),i;if(t===void 0)i=n.readFileSync(e,{encoding:s});else{let{buffer:c,bytesRead:l}=n.readSync(e,{length:t+1});FX(l,e,t),i=c.subarray(0,l).toString(s)}let a=jX(i.slice(0,4096));return{content:i.replaceAll(`\r
190
+ `,`
191
+ `),encoding:s,lineEndings:a}}function xc(e,t){return hJe(e,t).content}async function HX(e,t){let n=tt(),{resolvedPath:r,isSymlink:o}=vf(n,e);if(o)ce(`Reading through symlink: ${e} -> ${r}`);UX(n,e,t);let s=zX(e),i=await n.readFileBytes(e,t===void 0?void 0:t+1);FX(i.length,e,t);let a=i.toString(s),c=jX(a.slice(0,4096));return{content:a.replaceAll(`\r
192
+ `,`
193
+ `),encoding:s,lineEndings:c}}var BX;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(BX||(BX={}));var _Je=Array(20).fill(0).map((e,t)=>" ".repeat(t));var yJe={" ":{"\n":Array(200).fill(0).map((e,t)=>`
194
+ `+" ".repeat(t)),"\r":Array(200).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":Array(200).fill(0).map((e,t)=>`\r
195
+ `+" ".repeat(t))},"\t":{"\n":Array(200).fill(0).map((e,t)=>`
196
+ `+"\t".repeat(t)),"\r":Array(200).fill(0).map((e,t)=>"\r"+"\t".repeat(t)),"\r\n":Array(200).fill(0).map((e,t)=>`\r
197
+ `+"\t".repeat(t))}};var GX;(function(e){e.DEFAULT={allowTrailingComma:!1}})(GX||(GX={}));var WX;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(WX||(WX={}));var VX;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(VX||(VX={}));var qX;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(qX||(qX={}));var _d=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,YX=new Set,PD=typeof process==="object"&&!!process?process:{},JX=(e,t,n,r)=>{typeof PD.emitWarning==="function"?PD.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},{AbortController:tE,AbortSignal:ZX}=globalThis;if(typeof tE>"u"){ZX=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(r,o){this._onabort.push(o)}},tE=class{constructor(){t()}signal=new ZX;abort(r){if(this.signal.aborted)return;this.signal.reason=r,this.signal.aborted=!0;for(let o of this.signal._onabort)o(r);this.signal.onabort?.(r)}};let e=PD.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{if(!e)return;e=!1,JX("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t)}}var AJe=(e)=>!YX.has(e),hBt=Symbol("type"),Qi=(e)=>e&&e===Math.floor(e)&&e>0&&isFinite(e),XX=(e)=>!Qi(e)?null:e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?vh:null;class vh extends Array{constructor(e){super(e);this.fill(0)}}class yd{heap;length;static#e=!1;static create(e){let t=XX(e);if(!t)return[];yd.#e=!0;let n=new yd(e,t);return yd.#e=!1,n}constructor(e,t){if(!yd.#e)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class nE{#e;#t;#n;#r;#i;#u;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#l;#a;#o;#s;#p;#f;#d;#m;#y;#h;#g;#E;#S;#b;#v;#x;static unsafeExposeInternals(e){return{starts:e.#E,ttls:e.#S,sizes:e.#g,keyMap:e.#a,keyList:e.#o,valList:e.#s,next:e.#p,prev:e.#f,get head(){return e.#d},get tail(){return e.#m},free:e.#y,isBackgroundFetch:(t)=>e.#_(t),backgroundFetch:(t,n,r,o)=>e.#F(t,n,r,o),moveToTail:(t)=>e.#M(t),indexes:(t)=>e.#O(t),rindexes:(t)=>e.#P(t),isStale:(t)=>e.#w(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#l}get size(){return this.#c}get fetchMethod(){return this.#i}get memoMethod(){return this.#u}get dispose(){return this.#n}get disposeAfter(){return this.#r}constructor(e){let{max:t=0,ttl:n,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:i,allowStale:a,dispose:c,disposeAfter:l,noDisposeOnSet:u,noUpdateTTL:p,maxSize:f=0,maxEntrySize:m=0,sizeCalculation:h,fetchMethod:y,memoMethod:_,noDeleteOnFetchRejection:E,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:v,ignoreFetchAbort:w}=e;if(t!==0&&!Qi(t))throw TypeError("max option must be a nonnegative integer");let U=t?XX(t):Array;if(!U)throw Error("invalid max value: "+t);if(this.#e=t,this.#t=f,this.maxEntrySize=m||this.#t,this.sizeCalculation=h,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw TypeError("sizeCalculation set to non-function")}if(_!==void 0&&typeof _!=="function")throw TypeError("memoMethod must be a function if defined");if(this.#u=_,y!==void 0&&typeof y!=="function")throw TypeError("fetchMethod must be a function if specified");if(this.#i=y,this.#v=!!y,this.#a=new Map,this.#o=Array(t).fill(void 0),this.#s=Array(t).fill(void 0),this.#p=new U(t),this.#f=new U(t),this.#d=0,this.#m=0,this.#y=yd.create(t),this.#c=0,this.#l=0,typeof c==="function")this.#n=c;if(typeof l==="function")this.#r=l,this.#h=[];else this.#r=void 0,this.#h=void 0;if(this.#b=!!this.#n,this.#x=!!this.#r,this.noDisposeOnSet=!!u,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!E,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!v,this.ignoreFetchAbort=!!w,this.maxEntrySize!==0){if(this.#t!==0){if(!Qi(this.#t))throw TypeError("maxSize must be a positive integer if specified")}if(!Qi(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#N()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!i,this.ttlResolution=Qi(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=n||0,this.ttl){if(!Qi(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#A()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){if(AJe("LRU_CACHE_UNBOUNDED"))YX.add("LRU_CACHE_UNBOUNDED"),JX("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",nE)}}getRemainingTTL(e){return this.#a.has(e)?1/0:0}#A(){let e=new vh(this.#e),t=new vh(this.#e);this.#S=e,this.#E=t,this.#D=(o,s,i=_d.now())=>{if(t[o]=s!==0?i:0,e[o]=s,s!==0&&this.ttlAutopurge){let a=setTimeout(()=>{if(this.#w(o))this.#I(this.#o[o],"expire")},s+1);if(a.unref)a.unref()}},this.#T=(o)=>{t[o]=e[o]!==0?_d.now():0},this.#C=(o,s)=>{if(e[s]){let i=e[s],a=t[s];if(!i||!a)return;o.ttl=i,o.start=a,o.now=n||r();let c=o.now-a;o.remainingTTL=i-c}};let n=0,r=()=>{let o=_d.now();if(this.ttlResolution>0){n=o;let s=setTimeout(()=>n=0,this.ttlResolution);if(s.unref)s.unref()}return o};this.getRemainingTTL=(o)=>{let s=this.#a.get(o);if(s===void 0)return 0;let i=e[s],a=t[s];if(!i||!a)return 1/0;let c=(n||r())-a;return i-c},this.#w=(o)=>{let s=t[o],i=e[o];return!!i&&!!s&&(n||r())-s>i}}#T=()=>{};#C=()=>{};#D=()=>{};#w=()=>!1;#N(){let e=new vh(this.#e);this.#l=0,this.#g=e,this.#k=(t)=>{this.#l-=e[t],e[t]=0},this.#L=(t,n,r,o)=>{if(this.#_(n))return 0;if(!Qi(r))if(o){if(typeof o!=="function")throw TypeError("sizeCalculation must be a function");if(r=o(n,t),!Qi(r))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r},this.#R=(t,n,r)=>{if(e[t]=n,this.#t){let o=this.#t-e[t];while(this.#l>o)this.#U(!0)}if(this.#l+=e[t],r)r.entrySize=n,r.totalCalculatedSize=this.#l}}#k=(e)=>{};#R=(e,t,n)=>{};#L=(e,t,n,r)=>{if(n||r)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#O({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#m;;){if(!this.#$(t))break;if(e||!this.#w(t))yield t;if(t===this.#d)break;else t=this.#f[t]}}*#P({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#d;;){if(!this.#$(t))break;if(e||!this.#w(t))yield t;if(t===this.#m)break;else t=this.#p[t]}}#$(e){return e!==void 0&&this.#a.get(this.#o[e])===e}*entries(){for(let e of this.#O())if(this.#s[e]!==void 0&&this.#o[e]!==void 0&&!this.#_(this.#s[e]))yield[this.#o[e],this.#s[e]]}*rentries(){for(let e of this.#P())if(this.#s[e]!==void 0&&this.#o[e]!==void 0&&!this.#_(this.#s[e]))yield[this.#o[e],this.#s[e]]}*keys(){for(let e of this.#O()){let t=this.#o[e];if(t!==void 0&&!this.#_(this.#s[e]))yield t}}*rkeys(){for(let e of this.#P()){let t=this.#o[e];if(t!==void 0&&!this.#_(this.#s[e]))yield t}}*values(){for(let e of this.#O())if(this.#s[e]!==void 0&&!this.#_(this.#s[e]))yield this.#s[e]}*rvalues(){for(let e of this.#P())if(this.#s[e]!==void 0&&!this.#_(this.#s[e]))yield this.#s[e]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let n of this.#O()){let r=this.#s[n],o=this.#_(r)?r.__staleWhileFetching:r;if(o===void 0)continue;if(e(o,this.#o[n],this))return this.get(this.#o[n],t)}}forEach(e,t=this){for(let n of this.#O()){let r=this.#s[n],o=this.#_(r)?r.__staleWhileFetching:r;if(o===void 0)continue;e.call(t,o,this.#o[n],this)}}rforEach(e,t=this){for(let n of this.#P()){let r=this.#s[n],o=this.#_(r)?r.__staleWhileFetching:r;if(o===void 0)continue;e.call(t,o,this.#o[n],this)}}purgeStale(){let e=!1;for(let t of this.#P({allowStale:!0}))if(this.#w(t))this.#I(this.#o[t],"expire"),e=!0;return e}info(e){let t=this.#a.get(e);if(t===void 0)return;let n=this.#s[t],r=this.#_(n)?n.__staleWhileFetching:n;if(r===void 0)return;let o={value:r};if(this.#S&&this.#E){let s=this.#S[t],i=this.#E[t];if(s&&i){let a=s-(_d.now()-i);o.ttl=a,o.start=Date.now()}}if(this.#g)o.size=this.#g[t];return o}dump(){let e=[];for(let t of this.#O({allowStale:!0})){let n=this.#o[t],r=this.#s[t],o=this.#_(r)?r.__staleWhileFetching:r;if(o===void 0||n===void 0)continue;let s={value:o};if(this.#S&&this.#E){s.ttl=this.#S[t];let i=_d.now()-this.#E[t];s.start=Math.floor(Date.now()-i)}if(this.#g)s.size=this.#g[t];e.unshift([n,s])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let r=Date.now()-n.start;n.start=_d.now()-r}this.set(t,n.value,n)}}set(e,t,n={}){if(t===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:i=this.sizeCalculation,status:a}=n,{noUpdateTTL:c=this.noUpdateTTL}=n,l=this.#L(e,t,n.size||0,i);if(this.maxEntrySize&&l>this.maxEntrySize){if(a)a.set="miss",a.maxEntrySizeExceeded=!0;return this.#I(e,"set"),this}let u=this.#c===0?void 0:this.#a.get(e);if(u===void 0){if(u=this.#c===0?this.#m:this.#y.length!==0?this.#y.pop():this.#c===this.#e?this.#U(!1):this.#c,this.#o[u]=e,this.#s[u]=t,this.#a.set(e,u),this.#p[this.#m]=u,this.#f[u]=this.#m,this.#m=u,this.#c++,this.#R(u,l,a),a)a.set="add";c=!1}else{this.#M(u);let p=this.#s[u];if(t!==p){if(this.#v&&this.#_(p)){p.__abortController.abort(Error("replaced"));let{__staleWhileFetching:f}=p;if(f!==void 0&&!s){if(this.#b)this.#n?.(f,e,"set");if(this.#x)this.#h?.push([f,e,"set"])}}else if(!s){if(this.#b)this.#n?.(p,e,"set");if(this.#x)this.#h?.push([p,e,"set"])}if(this.#k(u),this.#R(u,l,a),this.#s[u]=t,a){a.set="replace";let f=p&&this.#_(p)?p.__staleWhileFetching:p;if(f!==void 0)a.oldValue=f}}else if(a)a.set="update"}if(r!==0&&!this.#S)this.#A();if(this.#S){if(!c)this.#D(u,r,o);if(a)this.#C(a,u)}if(!s&&this.#x&&this.#h){let p=this.#h,f;while(f=p?.shift())this.#r?.(...f)}return this}pop(){try{while(this.#c){let e=this.#s[this.#d];if(this.#U(!0),this.#_(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#x&&this.#h){let e=this.#h,t;while(t=e?.shift())this.#r?.(...t)}}}#U(e){let t=this.#d,n=this.#o[t],r=this.#s[t];if(this.#v&&this.#_(r))r.__abortController.abort(Error("evicted"));else if(this.#b||this.#x){if(this.#b)this.#n?.(r,n,"evict");if(this.#x)this.#h?.push([r,n,"evict"])}if(this.#k(t),e)this.#o[t]=void 0,this.#s[t]=void 0,this.#y.push(t);if(this.#c===1)this.#d=this.#m=0,this.#y.length=0;else this.#d=this.#p[t];return this.#a.delete(n),this.#c--,t}has(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,o=this.#a.get(e);if(o!==void 0){let s=this.#s[o];if(this.#_(s)&&s.__staleWhileFetching===void 0)return!1;if(!this.#w(o)){if(n)this.#T(o);if(r)r.has="hit",this.#C(r,o);return!0}else if(r)r.has="stale",this.#C(r,o)}else if(r)r.has="miss";return!1}peek(e,t={}){let{allowStale:n=this.allowStale}=t,r=this.#a.get(e);if(r===void 0||!n&&this.#w(r))return;let o=this.#s[r];return this.#_(o)?o.__staleWhileFetching:o}#F(e,t,n,r){let o=t===void 0?void 0:this.#s[t];if(this.#_(o))return o;let s=new tE,{signal:i}=n;i?.addEventListener("abort",()=>s.abort(i.reason),{signal:s.signal});let a={signal:s.signal,options:n,context:r},c=(h,y=!1)=>{let{aborted:_}=s.signal,E=n.ignoreFetchAbort&&h!==void 0;if(n.status)if(_&&!y){if(n.status.fetchAborted=!0,n.status.fetchError=s.signal.reason,E)n.status.fetchAbortIgnored=!0}else n.status.fetchResolved=!0;if(_&&!E&&!y)return u(s.signal.reason);let S=f;if(this.#s[t]===f)if(h===void 0)if(S.__staleWhileFetching)this.#s[t]=S.__staleWhileFetching;else this.#I(e,"fetch");else{if(n.status)n.status.fetchUpdated=!0;this.set(e,h,a.options)}return h},l=(h)=>{if(n.status)n.status.fetchRejected=!0,n.status.fetchError=h;return u(h)},u=(h)=>{let{aborted:y}=s.signal,_=y&&n.allowStaleOnFetchAbort,E=_||n.allowStaleOnFetchRejection,S=E||n.noDeleteOnFetchRejection,x=f;if(this.#s[t]===f){if(!S||x.__staleWhileFetching===void 0)this.#I(e,"fetch");else if(!_)this.#s[t]=x.__staleWhileFetching}if(E){if(n.status&&x.__staleWhileFetching!==void 0)n.status.returnedStale=!0;return x.__staleWhileFetching}else if(x.__returned===x)throw h},p=(h,y)=>{let _=this.#i?.(e,o,a);if(_&&_ instanceof Promise)_.then((E)=>h(E===void 0?void 0:E),y);s.signal.addEventListener("abort",()=>{if(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort){if(h(void 0),n.allowStaleOnFetchAbort)h=(E)=>c(E,!0)}})};if(n.status)n.status.fetchDispatched=!0;let f=new Promise(p).then(c,l),m=Object.assign(f,{__abortController:s,__staleWhileFetching:o,__returned:void 0});if(t===void 0)this.set(e,m,{...a.options,status:void 0}),t=this.#a.get(e);else this.#s[t]=m;return m}#_(e){if(!this.#v)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof tE}async fetch(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:i=this.noDisposeOnSet,size:a=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:h,forceRefresh:y=!1,status:_,signal:E}=t;if(!this.#v){if(_)_.fetch="get";return this.get(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:_})}let S={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:i,size:a,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:m,ignoreFetchAbort:f,status:_,signal:E},x=this.#a.get(e);if(x===void 0){if(_)_.fetch="miss";let v=this.#F(e,x,S,h);return v.__returned=v}else{let v=this.#s[x];if(this.#_(v)){let K=n&&v.__staleWhileFetching!==void 0;if(_){if(_.fetch="inflight",K)_.returnedStale=!0}return K?v.__staleWhileFetching:v.__returned=v}let w=this.#w(x);if(!y&&!w){if(_)_.fetch="hit";if(this.#M(x),r)this.#T(x);if(_)this.#C(_,x);return v}let U=this.#F(e,x,S,h),F=U.__staleWhileFetching!==void 0&&n;if(_){if(_.fetch=w?"stale":"refresh",F&&w)_.returnedStale=!0}return F?U.__staleWhileFetching:U.__returned=U}}async forceFetch(e,t={}){let n=await this.fetch(e,t);if(n===void 0)throw Error("fetch() returned undefined");return n}memo(e,t={}){let n=this.#u;if(!n)throw Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...s}=t,i=this.get(e,s);if(!o&&i!==void 0)return i;let a=n(e,i,{options:s,context:r});return this.set(e,a,s),a}get(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=t,i=this.#a.get(e);if(i!==void 0){let a=this.#s[i],c=this.#_(a);if(s)this.#C(s,i);if(this.#w(i)){if(s)s.get="stale";if(!c){if(!o)this.#I(e,"expire");if(s&&n)s.returnedStale=!0;return n?a:void 0}else{if(s&&n&&a.__staleWhileFetching!==void 0)s.returnedStale=!0;return n?a.__staleWhileFetching:void 0}}else{if(s)s.get="hit";if(c)return a.__staleWhileFetching;if(this.#M(i),r)this.#T(i);return a}}else if(s)s.get="miss"}#z(e,t){this.#f[t]=e,this.#p[e]=t}#M(e){if(e!==this.#m){if(e===this.#d)this.#d=this.#p[e];else this.#z(this.#f[e],this.#p[e]);this.#z(this.#m,e),this.#m=e}}delete(e){return this.#I(e,"delete")}#I(e,t){let n=!1;if(this.#c!==0){let r=this.#a.get(e);if(r!==void 0)if(n=!0,this.#c===1)this.#j(t);else{this.#k(r);let o=this.#s[r];if(this.#_(o))o.__abortController.abort(Error("deleted"));else if(this.#b||this.#x){if(this.#b)this.#n?.(o,e,t);if(this.#x)this.#h?.push([o,e,t])}if(this.#a.delete(e),this.#o[r]=void 0,this.#s[r]=void 0,r===this.#m)this.#m=this.#f[r];else if(r===this.#d)this.#d=this.#p[r];else{let s=this.#f[r];this.#p[s]=this.#p[r];let i=this.#p[r];this.#f[i]=this.#f[r]}this.#c--,this.#y.push(r)}}if(this.#x&&this.#h?.length){let r=this.#h,o;while(o=r?.shift())this.#r?.(...o)}return n}clear(){return this.#j("delete")}#j(e){for(let t of this.#P({allowStale:!0})){let n=this.#s[t];if(this.#_(n))n.__abortController.abort(Error("deleted"));else{let r=this.#o[t];if(this.#b)this.#n?.(n,r,e);if(this.#x)this.#h?.push([n,r,e])}}if(this.#a.clear(),this.#s.fill(void 0),this.#o.fill(void 0),this.#S&&this.#E)this.#S.fill(0),this.#E.fill(0);if(this.#g)this.#g.fill(0);if(this.#d=0,this.#m=0,this.#y.length=0,this.#l=0,this.#c=0,this.#x&&this.#h){let t=this.#h,n;while(n=t?.shift())this.#r?.(...n)}}}function QX(e,t,n=100){let r=new nE({max:n}),o=(...s)=>{let i=t(...s),a=r.get(i);if(a!==void 0)return a;let c=e(...s);return r.set(i,c),c};return o.cache={clear:()=>r.clear(),size:()=>r.size,delete:(s)=>r.delete(s),get:(s)=>r.peek(s),has:(s)=>r.has(s),set:(s,i)=>void r.set(s,i)},o}var TJe=8192;function t7(e,t){try{return{ok:!0,value:JSON.parse(Mu(e))}}catch(n){if(t)G_(v$(n,`safeParseJSON: invalid JSON (${n instanceof Error?n.constructor.name:typeof n}, ${e.length} bytes)`));return{ok:!1}}}class n7{cached=QX(t7,(e)=>e,50);cache=this.cached.cache;parse(e,t){return this.cached(e,t)}}var e7=new n7;var vc=Object.assign(function(t,n=!0){if(!t)return null;let r=t.length>TJe?t7(t,n):e7.parse(t,n);return r.ok?r.value:null},{cache:e7.cache});import{join as CJe}from"path";class r7{managedFilePath=void 0;dropInDir=void 0;getManagedFilePath(){return this.managedFilePath??=RJe(),this.managedFilePath}getDropInDir(){return this.dropInDir??=CJe(wc(),"managed-settings.d"),this.dropInDir}clearDropInDir(){this.dropInDir=void 0}reset(){this.managedFilePath=void 0,this.dropInDir=void 0}}var kJe=new r7;function wc(){return kJe.getManagedFilePath()}function RJe(){let e=OJe();if(e!==void 0)return e;switch(Tr()){case"macos":return"/Library/Application Support/ClaudeCode";case"windows":return"C:\\Program Files\\ClaudeCode";default:return"/etc/claude-code"}}function OJe(){return}var wh=[{path:["allowManagedPermissionRulesOnly"],restrictive:!0},{path:["allowManagedHooksOnly"],restrictive:!0},{path:["allowManagedMcpServersOnly"],restrictive:!0},{path:["enforceAvailableModels"],restrictive:!0},{path:["disableAllHooks"],restrictive:!0},{path:["disableClaudeAiConnectors"],restrictive:!0},{path:["disableCommandPluginSources"],restrictive:!0},{path:["disableSideloadFlags"],restrictive:!0},{path:["disableSkillShellExecution"],restrictive:!0},{path:["disableRemoteControl"],restrictive:!0},{path:["disableAgentView"],restrictive:!0},{path:["disableWorkflows"],restrictive:!0},{path:["disableArtifact"],restrictive:!0},{path:["disableBundledSkills"],restrictive:!0},{path:["fastModePerSessionOptIn"],restrictive:!0},{path:["isolatePeerMachines"],restrictive:!0},{path:["strictPluginOnlyCustomization"],restrictive:!0},{path:["disableAutoMode"],restrictive:"disable"},{path:["disableDeepLinkRegistration"],restrictive:"disable"},{path:["permissions","disableBypassPermissionsMode"],restrictive:"disable"},{path:["permissions","disableAutoMode"],restrictive:"disable"},{path:["permissions","blockReadsOutsideWorkingDirectories"],restrictive:!0},{path:["autoMode","classifyAllShell"],restrictive:!0},...[],{path:["worktree","bgIsolation"],restrictive:"worktree"},{path:["enableArtifact"],restrictive:!1},{path:["enableWorkflows"],restrictive:!1},{path:["syncClaudeAiSkills"],restrictive:!1},{path:["syncClaudeAiPlugins"],restrictive:!1},{path:["useAutoModeDuringPlan"],restrictive:!1},{path:["skipDangerousModePermissionPrompt"],restrictive:!1},{path:["skipAutoPermissionPrompt"],restrictive:!1},{path:["enableAllProjectMcpServers"],restrictive:!1},{path:["channelsEnabled"],restrictive:!1},{path:["skipWebFetchPreflight"],restrictive:!1},{path:["skipWorkflowUsageWarning"],restrictive:!1},{path:["autoUploadSessions"],restrictive:!1},{path:["remoteControlAtStartup"],restrictive:!1},{path:["autoContinueAtUsageLimit"],restrictive:!1},...[],{path:["attribution","sessionUrl"],restrictive:!1},{path:["crossSessionInbound"],restrictive:["refuse","hold"]},{path:["modelProposedGoals"],restrictive:["disabled","alwaysAsk"]},{path:["feedbackDrafts"],restrictive:"off"},{path:["askUserQuestionTimeout"],restrictive:"never"},{path:["dialogExpiry"],restrictive:"never"},{path:["sandbox","enabled"],restrictive:!0},{path:["sandbox","failIfUnavailable"],restrictive:!0},{path:["sandbox","autoAllowBashIfSandboxed"],restrictive:!1},{path:["sandbox","allowUnsandboxedCommands"],restrictive:!1},{path:["sandbox","enableWeakerNestedSandbox"],restrictive:!1},{path:["sandbox","enableWeakerNetworkIsolation"],restrictive:!1},{path:["sandbox","allowAppleEvents"],restrictive:!1},{path:["sandbox","network","allowManagedDomainsOnly"],restrictive:!0},{path:["sandbox","network","strictAllowlist"],restrictive:!0},{path:["sandbox","network","allowAllUnixSockets"],restrictive:!1},{path:["sandbox","network","allowLocalBinding"],restrictive:!1},{path:["sandbox","filesystem","allowManagedReadPathsOnly"],restrictive:!0},{path:["sandbox","filesystem","disabled"],restrictive:!1},{path:["sandbox","credentials","allowPlaintextInject"],restrictive:!1},{path:["sandbox","credentials","sigv4","streaming"],restrictive:"deny"},{path:["sandbox","credentials","sigv4","presigned"],restrictive:"deny"},{path:["sandbox","credentials","sigv4","sigv4a"],restrictive:"deny"}];function Ah(e){return Array.isArray(e)?e:[e]}function Vs(e,t){let n=e;for(let r of t){if(n===null||typeof n!=="object")return;n=n[r]}return n}function ea(e,t,n){let r=[e],o=e;for(let i of t.slice(0,-1)){let a={...o[i]};o[i]=a,o=a,r.push(o)}let s=t.at(-1);if(n!==void 0){o[s]=n;return}delete o[s];for(let i=r.length-1;i>0;i--){if(Object.keys(r[i]).length>0)break;delete r[i-1][t[i-1]]}}function PJe(e,t,n){if(n!==void 0&&!Ho(e[t],n)||n===void 0&&!(t in e))ti(e,t,n)}var Th=PJe;var oE={};on(oE,{default:()=>Ch});var a7=typeof oE=="object"&&oE&&!oE.nodeType&&oE,o7=a7&&typeof rE=="object"&&rE&&!rE.nodeType&&rE,IJe=o7&&o7.exports===a7,s7=IJe?Gt.Buffer:void 0,i7=s7?s7.allocUnsafe:void 0;function DJe(e,t){if(t)return e.slice();var n=e.length,r=i7?i7(n):new e.constructor(n);return e.copy(r),r}var Ch=DJe;function LJe(e){var t=new e.constructor(e.byteLength);return new zc(t).set(new zc(e)),t}var Sd=LJe;function NJe(e,t){var n=t?Sd(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var sE=NJe;function MJe(e,t){var n=-1,r=e.length;t||(t=Array(r));while(++n<r)t[n]=e[n];return t}var iE=MJe;var c7=Object.create,UJe=function(){function e(){}return function(t){if(!jt(t))return{};if(c7)return c7(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),l7=UJe;var FJe=sg(Object.getPrototypeOf,Object),bd=FJe;function $Je(e){return typeof e.constructor=="function"&&!Wc(e)?l7(bd(e)):{}}var aE=$Je;function zJe(e){return Zt(e)&&ei(e)}var u7=zJe;var jJe="[object Object]",HJe=Function.prototype,BJe=Object.prototype,d7=HJe.toString,KJe=BJe.hasOwnProperty,GJe=d7.call(Object);function WJe(e){if(!Zt(e)||mr(e)!=jJe)return!1;var t=bd(e);if(t===null)return!0;var n=KJe.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&d7.call(n)==GJe}var cE=WJe;function VJe(e,t){if(t==="constructor"&&typeof e[t]==="function")return;if(t=="__proto__")return;return e[t]}var kh=VJe;var qJe=Object.prototype,ZJe=qJe.hasOwnProperty;function YJe(e,t,n){var r=e[t];if(!(ZJe.call(e,t)&&Ho(r,n))||n===void 0&&!(t in e))ti(e,t,n)}var Ed=YJe;function JJe(e,t,n,r){var o=!n;n||(n={});var s=-1,i=t.length;while(++s<i){var a=t[s],c=r?r(n[a],e[a],a,n,e):void 0;if(c===void 0)c=e[a];if(o)ti(n,a,c);else Ed(n,a,c)}return n}var eo=JJe;function XJe(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var p7=XJe;var QJe=Object.prototype,e5e=QJe.hasOwnProperty;function t5e(e){if(!jt(e))return p7(e);var t=Wc(e),n=[];for(var r in e)if(!(r=="constructor"&&(t||!e5e.call(e,r))))n.push(r);return n}var f7=t5e;function n5e(e){return ei(e)?og(e,!0):f7(e)}var ls=n5e;function r5e(e){return eo(e,ls(e))}var m7=r5e;function o5e(e,t,n,r,o,s,i){var a=kh(e,n),c=kh(t,n),l=i.get(c);if(l){Th(e,n,l);return}var u=s?s(a,c,n+"",e,t,i):void 0,p=u===void 0;if(p){var f=bt(c),m=!f&&Ko(c),h=!f&&!m&&Gc(c);if(u=c,f||m||h)if(bt(a))u=a;else if(u7(a))u=iE(a);else if(m)p=!1,u=Ch(c,!0);else if(h)p=!1,u=sE(c,!0);else u=[];else if(cE(c)||ms(c)){if(u=a,ms(a))u=m7(a);else if(!jt(a)||Mc(a))u=aE(c)}else p=!1}if(p)i.set(c,u),o(u,c,r,s,i),i.delete(c);Th(e,n,u)}var h7=o5e;function g7(e,t,n,r,o){if(e===t)return;pg(t,function(s,i){if(o||(o=new Bo),jt(s))h7(e,t,i,n,g7,r,o);else{var a=r?r(kh(e,i),s,i+"",e,t,o):void 0;if(a===void 0)a=s;Th(e,i,a)}},ls)}var _7=g7;function s5e(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var y7=s5e;var S7=Math.max;function i5e(e,t,n){return t=S7(t===void 0?e.length-1:t,0),function(){var r=arguments,o=-1,s=S7(r.length-t,0),i=Array(s);while(++o<s)i[o]=r[t+o];o=-1;var a=Array(t+1);while(++o<t)a[o]=r[o];return a[t]=n(i),y7(e,this,a)}}var lE=i5e;function a5e(e){return function(){return e}}var b7=a5e;var c5e=!Yc?el:function(e,t){return Yc(e,"toString",{configurable:!0,enumerable:!1,value:b7(t),writable:!0})},E7=c5e;var l5e=800,u5e=16,d5e=Date.now;function p5e(e){var t=0,n=0;return function(){var r=d5e(),o=u5e-(r-n);if(n=r,o>0){if(++t>=l5e)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var x7=p5e;var f5e=x7(E7),uE=f5e;function m5e(e,t){return uE(lE(e,t,el),e+"")}var v7=m5e;function h5e(e,t,n){if(!jt(n))return!1;var r=typeof t;if(r=="number"?ei(n)&&Qs(t,n.length):r=="string"&&(t in n))return Ho(n[t],e);return!1}var w7=h5e;function g5e(e){return v7(function(t,n){var r=-1,o=n.length,s=o>1?n[o-1]:void 0,i=o>2?n[2]:void 0;if(s=e.length>3&&typeof s=="function"?(o--,s):void 0,i&&w7(n[0],n[1],i))s=o<3?void 0:s,o=1;t=Object(t);while(++r<o){var a=n[r];if(a)e(t,a,r,s)}return t})}var A7=g5e;var _5e=A7(function(e,t,n,r){_7(e,t,n,r)}),Bn=_5e;function y5e(e,t){var n=-1,r=e==null?0:e.length;while(++n<r)if(t(e[n],n,e)===!1)break;return e}var T7=y5e;function S5e(e,t){return e&&eo(t,Wo(t),e)}var C7=S5e;function b5e(e,t){return e&&eo(t,ls(t),e)}var k7=b5e;function E5e(e,t){return eo(e,Hc(e),t)}var R7=E5e;var x5e=Object.getOwnPropertySymbols,v5e=!x5e?Qh:function(e){var t=[];while(e)jc(t,Hc(e)),e=bd(e);return t},dE=v5e;function w5e(e,t){return eo(e,dE(e),t)}var O7=w5e;function A5e(e){return Xh(e,ls,dE)}var xd=A5e;var T5e=Object.prototype,C5e=T5e.hasOwnProperty;function k5e(e){var t=e.length,n=new e.constructor(t);if(t&&typeof e[0]=="string"&&C5e.call(e,"index"))n.index=e.index,n.input=e.input;return n}var P7=k5e;function R5e(e,t){var n=t?Sd(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var I7=R5e;var O5e=/\w*$/;function P5e(e){var t=new e.constructor(e.source,O5e.exec(e));return t.lastIndex=e.lastIndex,t}var D7=P5e;var L7=sn?sn.prototype:void 0,N7=L7?L7.valueOf:void 0;function I5e(e){return N7?Object(N7.call(e)):{}}var M7=I5e;var D5e="[object Boolean]",L5e="[object Date]",N5e="[object Map]",M5e="[object Number]",U5e="[object RegExp]",F5e="[object Set]",$5e="[object String]",z5e="[object Symbol]",j5e="[object ArrayBuffer]",H5e="[object DataView]",B5e="[object Float32Array]",K5e="[object Float64Array]",G5e="[object Int8Array]",W5e="[object Int16Array]",V5e="[object Int32Array]",q5e="[object Uint8Array]",Z5e="[object Uint8ClampedArray]",Y5e="[object Uint16Array]",J5e="[object Uint32Array]";function X5e(e,t,n){var r=e.constructor;switch(t){case j5e:return Sd(e);case D5e:case L5e:return new r(+e);case H5e:return I7(e,n);case B5e:case K5e:case G5e:case W5e:case V5e:case q5e:case Z5e:case Y5e:case J5e:return sE(e,n);case N5e:return new r;case M5e:case $5e:return new r(e);case U5e:return D7(e);case F5e:return new r;case z5e:return M7(e)}}var U7=X5e;var Q5e="[object Map]";function e8e(e){return Zt(e)&&hs(e)==Q5e}var F7=e8e;var $7=Go&&Go.isMap,t8e=$7?Kc($7):F7,z7=t8e;var n8e="[object Set]";function r8e(e){return Zt(e)&&hs(e)==n8e}var j7=r8e;var H7=Go&&Go.isSet,o8e=H7?Kc(H7):j7,B7=o8e;var s8e=1,i8e=2,a8e=4,K7="[object Arguments]",c8e="[object Array]",l8e="[object Boolean]",u8e="[object Date]",d8e="[object Error]",G7="[object Function]",p8e="[object GeneratorFunction]",f8e="[object Map]",m8e="[object Number]",W7="[object Object]",h8e="[object RegExp]",g8e="[object Set]",_8e="[object String]",y8e="[object Symbol]",S8e="[object WeakMap]",b8e="[object ArrayBuffer]",E8e="[object DataView]",x8e="[object Float32Array]",v8e="[object Float64Array]",w8e="[object Int8Array]",A8e="[object Int16Array]",T8e="[object Int32Array]",C8e="[object Uint8Array]",k8e="[object Uint8ClampedArray]",R8e="[object Uint16Array]",O8e="[object Uint32Array]",mt={};mt[K7]=mt[c8e]=mt[b8e]=mt[E8e]=mt[l8e]=mt[u8e]=mt[x8e]=mt[v8e]=mt[w8e]=mt[A8e]=mt[T8e]=mt[f8e]=mt[m8e]=mt[W7]=mt[h8e]=mt[g8e]=mt[_8e]=mt[y8e]=mt[C8e]=mt[k8e]=mt[R8e]=mt[O8e]=!0;mt[d8e]=mt[G7]=mt[S8e]=!1;function pE(e,t,n,r,o,s){var i,a=t&s8e,c=t&i8e,l=t&a8e;if(n)i=o?n(e,r,o,s):n(e);if(i!==void 0)return i;if(!jt(e))return e;var u=bt(e);if(u){if(i=P7(e),!a)return iE(e,i)}else{var p=hs(e),f=p==G7||p==p8e;if(Ko(e))return Ch(e,a);if(p==W7||p==K7||f&&!o){if(i=c||f?{}:aE(e),!a)return c?O7(e,k7(i,e)):R7(e,C7(i,e))}else{if(!mt[p])return o?e:{};i=U7(e,p,a)}}s||(s=new Bo);var m=s.get(e);if(m)return m;if(s.set(e,i),B7(e))e.forEach(function(_){i.add(pE(_,t,n,_,e,s))});else if(z7(e))e.forEach(function(_,E){i.set(E,pE(_,t,n,E,e,s))});var h=l?c?xd:Fd:c?ls:Wo,y=u?void 0:h(e);return T7(y||e,function(_,E){if(y)E=_,_=e[E];Ed(i,E,pE(_,t,n,E,e,s))}),i}var V7=pE;function P8e(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var q7=P8e;function I8e(e,t,n){var r=-1,o=e.length;if(t<0)t=-t>o?0:o+t;if(n=n>o?o:n,n<0)n+=o;o=t>n?0:n-t>>>0,t>>>=0;var s=Array(o);while(++r<o)s[r]=e[r+t];return s}var Z7=I8e;function D8e(e,t){return t.length<2?e:ni(e,Z7(t,0,-1))}var Y7=D8e;var L8e=Object.prototype,N8e=L8e.hasOwnProperty;function M8e(e,t){t=Dr(t,e);var n=-1,r=t.length;if(!r)return!0;while(++n<r){var o=hr(t[n]);if(o==="__proto__"&&!N8e.call(e,"__proto__"))return!1;if((o==="constructor"||o==="prototype")&&n<r-1)return!1}var s=Y7(e,t);return s==null||delete s[hr(q7(t))]}var J7=M8e;function U8e(e){return cE(e)?void 0:e}var X7=U8e;var Q7=sn?sn.isConcatSpreadable:void 0;function F8e(e){return bt(e)||ms(e)||!!(Q7&&e&&e[Q7])}var eQ=F8e;function tQ(e,t,n,r,o){var s=-1,i=e.length;n||(n=eQ),o||(o=[]);while(++s<i){var a=e[s];if(t>0&&n(a))if(t>1)tQ(a,t-1,n,r,o);else jc(o,a);else if(!r)o[o.length]=a}return o}var nQ=tQ;function $8e(e){var t=e==null?0:e.length;return t?nQ(e,1):[]}var rQ=$8e;function z8e(e){return uE(lE(e,void 0,rQ),e+"")}var fE=z8e;var j8e=1,H8e=2,B8e=4,K8e=fE(function(e,t){var n={};if(e==null)return n;var r=!1;if(t=Qc(t,function(s){return s=Dr(s,e),r||(r=s.length>1),s}),eo(e,xd(e),n),r)n=V7(n,j8e|H8e|B8e,X7);var o=t.length;while(o--)J7(n,t[o]);return n}),mE=K8e;function G8e(e,t,n,r){if(!jt(e))return e;t=Dr(t,e);var o=-1,s=t.length,i=s-1,a=e;while(a!=null&&++o<s){var c=hr(t[o]),l=n;if(c==="__proto__"||c==="constructor"||c==="prototype")return e;if(o!=i){var u=a[c];if(l=r?r(u,c,a):void 0,l===void 0)l=jt(u)?u:Qs(t[o+1])?[]:{}}Ed(a,c,l),a=a[c]}return e}var oQ=G8e;function W8e(e,t,n){var r=-1,o=t.length,s={};while(++r<o){var i=t[r],a=ni(e,i);if(n(a,i))oQ(s,Dr(i,e),a)}return s}var hE=W8e;function V8e(e,t){return hE(e,t,function(n,r){return hg(e,r)})}var sQ=V8e;var q8e=fE(function(e,t){return e==null?{}:sQ(e,t)}),Rh=q8e;import{homedir as Fet}from"os";import{dirname as $et,join as jo,resolve as to}from"path";Zc();var Z8e="Expected a function";function Y8e(e){if(typeof e!="function")throw TypeError(Z8e);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}var iQ=Y8e;function J8e(e,t){if(e==null)return{};var n=Qc(xd(e),function(r){return[r]});return t=ri(t),hE(e,n,function(r,o){return t(r,o[0])})}var aQ=J8e;function X8e(e,t){return aQ(e,iQ(ri(t)))}var Oh=X8e;var Ph=[{alias:"additionalMarketplaces",canonical:"extraKnownMarketplaces"},{alias:"allowedMarketplaces",canonical:"strictKnownMarketplaces"}];function cQ(e,t){if(!It(e))return[];let n=[];for(let{alias:r,canonical:o}of Ph){if(!(r in e))continue;if(o in e&&e[o]!==null)n.push({file:t,path:r,message:`"${r}" is an alias for "${o}" and this file sets both; the "${r}" value was ignored. Use only "${o}".`,severity:"warning",alias:r,canonical:o});else e[o]=e[r];delete e[r]}return n}import{join as Zee}from"path";import{isAbsolute as lQ}from"path";var Q8e=I(()=>C({allowedDomains:D(g()).optional(),deniedDomains:D(g()).optional().describe("Domains that are always blocked, even if matched by allowedDomains. Supports the same wildcard syntax as allowedDomains. Merged from all settings sources regardless of allowManagedDomainsOnly."),strictAllowlist:R().optional().describe("When true, the sandbox runtime deterministically denies hosts not in allowedDomains instead of prompting. "+"Enforced for sandboxed commands only — in-process tools such as WebFetch are not gated by this setting. "+"Only honored from user, managed/policy, or CLI (--settings) settings — "+"project settings (.claude/settings.json and .claude/settings.local.json) are ignored."),allowManagedDomainsOnly:R().optional().describe("When true (and set in managed settings), only allowedDomains and WebFetch(domain:...) allow rules from managed settings are respected. User, project, local, and flag settings domains are ignored. Denied domains are still respected from all sources."),allowUnixSockets:D(g()).optional().describe("macOS only: Unix socket paths to allow. Ignored on Linux (seccomp cannot filter by path)."),allowAllUnixSockets:R().optional().describe("If true, allow all Unix sockets (disables blocking on both platforms)."),allowLocalBinding:R().optional(),allowMachLookup:D(g().refine((e)=>!(e.endsWith("*")?e.slice(0,-1):e).includes("*"),{message:'Wildcards are only allowed as a single trailing "*" (e.g., "com.example.*" or "*" for all services).'})).optional().describe('macOS only: Additional XPC/Mach service names to allow looking up. Supports trailing-wildcard prefix matching (e.g., "com.apple.coresimulator.*"). Needed for tools that communicate via XPC such as the iOS Simulator or Playwright.'),httpProxyPort:ee().optional(),socksProxyPort:ee().optional(),tlsTerminate:C({caCertPath:g().min(1).optional(),caKeyPath:g().min(1).optional()}).optional().describe("[EXPERIMENTAL] Enable in-process TLS termination so the per-request filter can see HTTPS request bodies. Provide a CA cert+key, or omit both to have sandbox-runtime generate an ephemeral one for the session. On native Windows an ephemeral CA cannot pass the sandbox trust check, so omitting the paths uses a persistent CA managed by the sandbox runtime (set up and trusted via /sandbox install); configured paths are passed to the sandbox runtime verbatim, which rejects a bad or incomplete pair at sandbox initialization. "+"Only honored from user, managed/policy, or CLI (`--settings`) settings — project settings "+"(.claude/settings.json and .claude/settings.local.json) are ignored.")}).optional()),eXe=I(()=>C({allowWrite:D(g()).optional().describe("Additional paths to allow writing within the sandbox. Merged with paths from Edit(...) allow permission rules."),denyWrite:D(g()).optional().describe("Additional paths to deny writing within the sandbox. Merged with paths from Edit(...) deny permission rules."),denyRead:D(g()).optional().describe("Additional paths to deny reading within the sandbox. Merged with paths from Read(...) deny permission rules."),allowRead:D(g()).optional().describe("Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths."),allowManagedReadPathsOnly:R().optional().describe("When true (set in managed settings), only allowRead paths from policySettings are used."),disabled:R().optional().describe("macOS and Linux/WSL only: skip filesystem isolation entirely while keeping network and seccomp isolation. Ignored on native Windows, where the sandboxed process runs as a separate user with no inherent rights, so skipping the filesystem rules would "+"withhold every access grant rather than loosen them — filesystem isolation stays on there. "+"Sandboxed commands get unrestricted read/write access to the host filesystem; network egress is still confined to network.allowedDomains. Intended for deployments whose goal is egress control rather than filesystem containment. Does not change Bash prompting: sandbox.autoAllowBashIfSandboxed is independent and still defaults to true, so set it to false to keep prompting for sandboxed commands. Drops the read protection from filesystem.denyRead and credentials.files deny entries for sandboxed commands, since both are enforced by the filesystem layer this turns off; credentials.files mask entries (sentinel binds) and credentials.envVars deny/mask are unaffected. "+"Only honored from user, managed/policy, or CLI (`--settings`) settings — "+"project settings (.claude/settings.json and .claude/settings.local.json) are ignored. If managed settings configure sandbox.filesystem at all, or list any sandbox.credentials.files deny entry, only managed settings can set this: an admin who deployed filesystem restrictions must not have them switched off by a user-writable file. (sandbox.credentials.envVars and credentials.files mask entries "+"do not pin it — env scrubbing and sentinel binds are independent of the filesystem "+"layer and survive this setting.) When unset, filesystem isolation stays on.")}).optional());function uQ(e,t,n){if(e.length===0||e.some((r)=>r.length===0))n.addIssue({code:qr.custom,path:["maskClaims"],message:"maskClaims must name at least one non-empty claim — omit maskClaims for whole-token masking."});if(t===void 0)n.addIssue({code:qr.custom,path:["maskClaims"],message:"maskClaims requires decode — without a decode format there is no token to read claims from. Set decode, or omit maskClaims."})}function dQ(e,t){let n;try{n=new RegExp(e)}catch(o){t.addIssue({code:qr.custom,path:["extract"],message:`extract is not a valid regular expression: ${Br(o)}`});return}if(new RegExp(n.source+"|").exec("").length-1<1)t.addIssue({code:qr.custom,path:["extract"],message:"extract must contain at least one capturing group — "+'group 1 is the credential value to mask (e.g. "token:\\s*(\\S+)").'})}function pQ(e){if(typeof e!=="object"||e===null)return e;let t=e;if(t.mode!=="deny")return e;let n={...t};if("extract"in n&&typeof n.extract!=="string")delete n.extract;if("onExtractNoMatch"in n&&n.onExtractNoMatch!=="warn"&&n.onExtractNoMatch!=="deny"&&n.onExtractNoMatch!=="error")delete n.onExtractNoMatch;if("decode"in n&&n.decode!=="jwt")delete n.decode;if("maskClaims"in n&&!(Array.isArray(n.maskClaims)&&n.maskClaims.every((r)=>typeof r==="string")))delete n.maskClaims;if("maskDuplicates"in n&&typeof n.maskDuplicates!=="boolean")delete n.maskDuplicates;if("injectHosts"in n&&!(Array.isArray(n.injectHosts)&&n.injectHosts.every((r)=>typeof r==="string")))delete n.injectHosts;return n}var gE=I(()=>st(pQ,C({path:g().min(1).describe("Path to a credential file or directory. Same resolution as sandbox.filesystem.* paths: absolute, ~ expanded, or relative to the settings file root (project root for project settings, ~/.claude for user settings)."),mode:V(["deny","mask"]).describe("Access mode for this path. `deny` blocks reads inside the sandbox; `mask` shows sandboxed commands a sentinel-substituted copy (whole-file, or only the spans captured by `extract`) and the "+"host proxy swaps sentinel→real on egress to `injectHosts`. "+"On macOS and Windows `mask` currently degrades to `deny`."),extract:g().optional().describe("Optional regex for structured masking when mode is `mask`. Applied globally to the file; capture group 1 of each match is a credential value, and only those captured spans are replaced "+"with sentinels — the rest of the file is preserved so a tool "+"that parses it (.netrc, JSON, YAML) still succeeds. Without `extract`, the entire file content is replaced with one sentinel (whole-file masking, suited to single-secret files). If the regex matches nothing, behavior is governed by `onExtractNoMatch` (default `warn`). Accepted but ignored for `deny`."),onExtractNoMatch:V(["warn","deny","error"]).optional().describe("What to do when `extract` matches nothing in the file — or, "+"with `decode`, when no candidate survives verification. `warn` (default) emits a stderr warning and leaves the file readable as-is inside the sandbox (fail-open, for credentials that may be legitimately absent); `deny` degrades the entry to "+"mode `deny` so the file is unreadable (fail-closed) — under "+"`sandbox.filesystem.disabled` it is treated as `error`, since read-denies are dropped in that mode; `error` aborts at sandbox setup so nothing runs until the config is fixed. Only meaningful when mode is `mask` and `extract` or `decode` is set; accepted but ignored otherwise."),decode:V(["jwt"]).optional().describe("Optional encoded-credential format for `mask` mode. `jwt`: candidates are located with a built-in JWT regex (or the explicit `extract` pattern, if set), verified to actually be JWTs before masking, and replaced with a structurally valid fake JWT so client-side token parsing inside the sandbox keeps working. If no candidate verifies, behavior is governed by `onExtractNoMatch` (default `warn`). Accepted but ignored for `deny`."),maskClaims:D(g()).optional().describe("Names of top-level payload claims to mask inside each decoded value, instead of replacing the whole token. Each named claim present with a string value gets its own sentinel and the token is rebuilt around the modified payload; all other claims are preserved so a tool that decodes the token and reads a non-secret claim keeps working. Requires `decode`. If no named claim matches in any verified token, behavior is governed by `onExtractNoMatch` (default `warn`). Only meaningful when mode is `mask`; accepted but ignored for `deny`."),maskDuplicates:R().optional().describe("If true, verbatim occurrences of each captured credential value outside the regex-matched spans are also replaced with the "+"corresponding sentinel — for a secret repeated where the regex "+"does not reach (e.g. pasted into a comment). Matches raw substrings, so short or common values may corrupt unrelated content; intended for long, high-entropy secrets. Defaults to false. Only meaningful when mode is `mask` and `extract` or `decode` is set; accepted but ignored otherwise."),injectHosts:D(g()).optional().describe("Optional narrowing of where the proxy substitutes this credential. Only meaningful when mode is `mask`; accepted but ignored for `deny`. If unset, defaults to "+"`network.allowedDomains` — the credential is injected at "+"every reachable host. Each entry must be reachable via `network.allowedDomains` (sandbox-runtime validates this).")}).superRefine((e,t)=>{if(e.mode==="mask"&&e.path.endsWith("/"))t.addIssue({code:qr.custom,path:["path"],message:'Credential mode "mask" applies to a single file, not a directory. List the specific credential file(s), or use "deny" for the directory.'});if(e.mode==="mask"&&e.extract!==void 0)dQ(e.extract,t);if(e.mode==="mask"&&e.maskClaims!==void 0)uQ(e.maskClaims,e.decode,t)}))),vd=()=>g().regex(/^[A-Za-z_][A-Za-z0-9_]*$/,"Environment variable name must start with a letter or underscore and contain only letters, digits, and underscores"),_E=I(()=>st(pQ,C({name:vd().describe("Environment variable name."),mode:V(["deny","mask"]).describe("Access mode for this environment variable. `deny` unsets the variable for sandboxed commands; `mask` shows sandboxed commands a sentinel value and the "+"host proxy swaps sentinel→real on egress to `injectHosts`."),extract:g().optional().describe("Optional regex for structured masking when mode is `mask`. Applied globally to the value; capture group 1 of each match is a credential value, and only those captured spans are "+"replaced with sentinels — the rest of the value is preserved "+"so a tool that parses it (a `DATABASE_URL` connection string, a composite `KEY:SECRET` pair) still succeeds inside the sandbox. Without `extract`, the entire value is replaced with one sentinel (whole-value masking, suited to bare tokens). If the regex matches nothing, behavior is governed by `onExtractNoMatch` (default `warn`). Cannot be combined with `decode` (the decode path never consults it). Accepted but ignored for `deny`."),onExtractNoMatch:V(["warn","deny","error"]).optional().describe("What to do when `extract` matches nothing in the value. `warn` (default) emits a stderr warning and lets the variable pass through unmasked (fail-open, for credentials that may be legitimately absent); `deny` unsets the variable inside the sandbox (fail-closed); `error` aborts at sandbox setup so nothing runs until the config is fixed. Only meaningful when mode is `mask` and `extract` is set without `decode`. On a mask entry with `decode`, the runtime takes the decode path and never consults this field, so a fail-closed setting "+"cannot be honored — `deny` and `error` are rejected there; "+"only `warn` is accepted. In all other shapes the field is accepted but ignored."),decode:V(["jwt"]).optional().describe("Optional encoded-credential format for `mask` mode. `jwt`: the variable's whole value is verified to actually be a JWT and replaced with a structurally valid fake JWT so client-side token parsing inside the sandbox keeps working; the proxy swaps the whole fake token on egress. If the value does not verify, the variable is left unmasked with a stderr warning "+"(fail-open). Cannot be combined with `extract` — the decode "+"path never consults it. Accepted but ignored for `deny`."),maskClaims:D(g()).optional().describe("Names of top-level payload claims to mask inside the decoded value, instead of replacing the whole token. Each named claim present with a string value gets its own sentinel and the token is rebuilt around the modified payload; all other claims are preserved so claim-reading clients keep working. Requires `decode`. If no named claim matches, the variable is left unmasked with a stderr warning (fail-open). Only meaningful when mode is `mask`; accepted but ignored for `deny`."),injectHosts:D(g()).optional().describe("Optional narrowing of where the proxy substitutes this credential. Only meaningful when mode is `mask`; accepted but ignored for `deny`. If unset, defaults to "+"`network.allowedDomains` — the credential is injected at "+"every reachable host. Each entry must be reachable via `network.allowedDomains` (sandbox-runtime validates this).")}).superRefine((e,t)=>{if(e.mode==="mask"&&e.extract!==void 0)dQ(e.extract,t);if(e.mode==="mask"&&e.maskClaims!==void 0)uQ(e.maskClaims,e.decode,t);if(e.mode==="mask"&&e.decode!==void 0&&e.extract!==void 0)t.addIssue({code:qr.custom,path:["extract"],message:"extract cannot be combined with decode on an env entry — the runtime takes the decode path (whole-value JWT verification) and never consults extract, silently disabling the structured masking. Remove one of the two."});if(e.mode==="mask"&&e.decode!==void 0&&(e.onExtractNoMatch==="deny"||e.onExtractNoMatch==="error"))t.addIssue({code:qr.custom,path:["onExtractNoMatch"],message:"onExtractNoMatch cannot be honored on an env entry with decode — the runtime takes the decode path (which is unconditionally fail-open on verify failure) and never consults extract or onExtractNoMatch. Remove onExtractNoMatch, or drop decode to use extract-based masking (whose no-match handling does honor it)."})}))),ta=["AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN"];var ID="_INVALID_PAIR_",yE="_PARENT_PAIR_SUPPRESSOR_";var SE=I(()=>C({accessKeyIdVar:vd().describe("Name of the masked env var holding the AWS access key id."),secretAccessKeyVar:vd().describe("Name of the masked env var holding the AWS secret access key."),sessionTokenVar:vd().optional().describe("Optional name of the masked env var holding the AWS session token (temporary credentials). When set, the proxy sends the real token as x-amz-security-token on re-signed requests and adds it to the signed header set if the client did not.")}).superRefine((e,t)=>{let n=new Map;for(let[r,o]of[["accessKeyIdVar",e.accessKeyIdVar],["secretAccessKeyVar",e.secretAccessKeyVar],["sessionTokenVar",e.sessionTokenVar]]){if(o===void 0)continue;let s=n.get(o);if(s!==void 0)t.addIssue({code:qr.custom,path:[r],message:`${r} names the same env var ('${o}') as ${s} — each pair member must be a distinct variable.`});else n.set(o,r)}})),tXe=I(()=>{let e=V(["deny","passthrough"]);return C({streaming:e.optional().describe("Policy for aws-chunked streaming uploads (x-amz-content-sha256: STREAMING-*): per-chunk signatures chain off the seed signature, so re-signing would require rewriting the body. `deny` (default) fails closed with a 403; `passthrough` forwards the request unre-signed (the upstream will reject its signature)."),presigned:e.optional().describe("Policy for presigned URLs (X-Amz-Algorithm/X-Amz-Signature in the query, no Authorization header): the signature lives in the URL itself. `deny` (default) or `passthrough`."),sigv4a:e.optional().describe("Policy for SigV4A (AWS4-ECDSA-P256-SHA256) asymmetric signatures: there is no shared-key HMAC to recompute. `deny` (default) or `passthrough`.")})}),nXe=I(()=>C({files:D(gE()).optional().describe("Credential files or directories to protect. `deny` blocks reads inside the sandbox; `mask` substitutes a sentinel inside the sandbox (whole-file, or per-`extract` capture) and injects the real value at the proxy. On macOS and Windows `mask` degrades to `deny`."),envVars:D(_E()).optional().describe("Environment variables to protect. `deny` unsets the variable for sandboxed commands; `mask` substitutes a sentinel inside the sandbox and injects the real value at the proxy."),allowPlaintextInject:R().optional().describe("Allow sentinel→real substitution on the plain-HTTP proxy path. "+"Defaults to false: without TLS termination the upstream identity is unverified and the credential travels in cleartext. Set only for trusted-network test fixtures. Only honored from user, managed/policy, or CLI (`--settings`) "+"settings — project settings (.claude/settings.json and "+".claude/settings.local.json) are ignored."),awsPairs:D(SE()).optional().describe("Explicit groupings of masked env vars into AWS credential pairs for SigV4 re-signing, for non-standard variable names. The conventional AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY / AWS_SESSION_TOKEN trio is paired automatically when masked. Only honored from user, managed/policy, or CLI (`--settings`) "+"settings — project settings (.claude/settings.json and "+".claude/settings.local.json) are ignored. A member is only usable when its env var is forwarded as a whole-value `mask` entry (an entry carrying `extract` or `decode` does not "+"qualify — re-signing needs the whole real value). A pair "+"whose key id or secret member is unusable never re-signs: it is dropped, unless it names a conventional AWS variable, in which case it is forwarded as an inert suppressor so implicit auto-pairing stays overridden. A pair whose ONLY unusable member is the session token still re-signs, without an x-amz-security-token (temporary-credential requests fail upstream until the entry is fixed)."),sigv4:tXe().optional().describe("Policies for AWS SigV4 request shapes the proxy cannot re-sign (streaming, presigned, sigv4a) when they reference a masked credential pair: `deny` (default) or `passthrough`. Only honored from user, managed/policy, or CLI (`--settings`) "+"settings — project settings (.claude/settings.json and "+".claude/settings.local.json) are ignored.")}).superRefine((e,t)=>{let n=new Set;for(let[r,o]of(e?.awsPairs??[]).entries()){let s=[["accessKeyIdVar",o.accessKeyIdVar],["secretAccessKeyVar",o.secretAccessKeyVar],["sessionTokenVar",o.sessionTokenVar]],i=new Set;for(let[a,c]of s){if(c===void 0)continue;if(n.has(c))t.addIssue({code:qr.custom,path:["awsPairs",r,a],message:`"${c}" appears in more than one awsPairs slot (within or across pairs) — each variable can fill exactly one slot.`});i.add(c)}for(let a of i)n.add(a)}}).optional()),DD=I(()=>C({enabled:R().optional(),failIfUnavailable:R().optional().describe("Exit with an error at startup if sandbox.enabled is true but the sandbox cannot start (missing dependencies or unsupported platform). When false (default), a warning is shown and commands run unsandboxed. Intended for managed-settings deployments that require sandboxing as a hard gate."),autoAllowBashIfSandboxed:R().optional(),allowUnsandboxedCommands:R().optional().describe("Allow commands to run outside the sandbox via the dangerouslyDisableSandbox parameter. When false, the dangerouslyDisableSandbox parameter is completely ignored and all commands must run sandboxed. Default: true."),network:Q8e(),filesystem:eXe(),credentials:nXe(),ignoreViolations:J(g(),D(g())).optional(),enableWeakerNestedSandbox:R().optional(),enableWeakerNetworkIsolation:R().optional().describe("macOS only: Allow access to com.apple.trustd.agent in the sandbox. Needed for Go-based CLI tools (gh, gcloud, terraform, etc.) to verify TLS certificates when using httpProxyPort with a MITM proxy and custom CA. "+"**Reduces security** — opens a potential data exfiltration vector through the trustd service. Default: false"),allowAppleEvents:R().optional().describe("macOS only: Allow sandboxed commands to send Apple Events (and look up the appleeventsd Mach service). Needed for `open`, `osascript`, and browser-based auth flows that open URLs. "+"**Removes code-execution isolation** — sandboxed commands can launch other applications "+"unsandboxed with no user prompt, and can script running apps (e.g. Terminal) subject to the user's per-app TCC automation consent. "+"Only honored from user, managed/policy, or CLI (--settings) settings — "+"project settings (.claude/settings.json and .claude/settings.local.json) are ignored. Default: false"),excludedCommands:D(g()).optional(),ripgrep:C({command:g(),args:D(g()).optional()}).optional().describe("Custom ripgrep configuration for bundled ripgrep support. "+"Only honored from user, managed/policy, or CLI (--settings) settings — "+"project settings (.claude/settings.json and .claude/settings.local.json) are ignored."),bwrapPath:st((e)=>typeof e==="string"&&lQ(e)?e:void 0,g()).optional().catch(void 0).describe("Linux/WSL only: Absolute path to the bwrap (bubblewrap) binary. Overrides auto-detection via PATH. Only honored from admin-controlled managed settings."),socatPath:st((e)=>typeof e==="string"&&lQ(e)?e:void 0,g()).optional().catch(void 0).describe("Linux/WSL only: Absolute path to the socat binary used for the sandbox network proxy. Overrides auto-detection via PATH. Only honored from admin-controlled managed settings.")}).passthrough());var fQ=new Set(["disableAllHooks"]);function mQ(e){let t={};for(let{path:u,restrictive:p}of wh){if(fQ.has(u[0]))continue;let f=Vs(e,u);if((typeof f==="boolean"||typeof f==="string")&&Ah(p).includes(f))ea(t,u,f)}let n=bE(e.permissions,["deny","ask","disableBypassPermissionsMode","disableAutoMode"]);if(n)t.permissions={...t.permissions,...n};for(let u of rXe)if(e[u]!==void 0)t[u]=e[u];for(let[u,p]of Object.entries(e))if((u.startsWith("disable")&&(p===!0||p==="disable")||u.startsWith("enable")&&p===!1)&&!fQ.has(u))t[u]=p;if(e.disableAllHooks===!0)t.allowManagedHooksOnly=!0;if(Array.isArray(e.httpHookAllowedEnvVars)&&e.httpHookAllowedEnvVars.length===0)t.httpHookAllowedEnvVars=[];let r=bE(e.sandbox?.filesystem,["denyRead","denyWrite","allowManagedReadPathsOnly"]),o=bE(e.sandbox?.network,["deniedDomains","strictAllowlist","allowManagedDomainsOnly"]),s=bE(e.sandbox?.credentials,["files","envVars"])??{},i=(e.sandbox?.credentials?.awsPairs??[]).flatMap((u)=>[u.accessKeyIdVar,u.secretAccessKeyVar,u.sessionTokenVar]),a=ta.filter((u)=>i.includes(u));if(a.length>0)s.awsPairs=a.map((u,p)=>({accessKeyIdVar:u,secretAccessKeyVar:`${yE}${p+1}_`}));let c=e.sandbox?.credentials?.sigv4;if(c){let u={};for(let[p,f]of Object.entries(c))if(f==="deny")u[p]="deny";if(Object.keys(u).length>0)s.sigv4=u}let l=Object.keys(s).length>0;if(r||o||l){let u=t.sandbox??{};t.sandbox={...u,...r&&{filesystem:{...u.filesystem,...r}},...o&&{network:{...u.network,...o}},...l&&{credentials:{...u.credentials,...s}}}}return Object.keys(t).length>0?t:null}function bE(e,t){if(!e)return;let n={};for(let r of t)if(e[r]!==void 0)n[r]=e[r];return Object.keys(n).length>0?n:void 0}var rXe=["allowedMcpServers","deniedMcpServers","allowManagedMcpServersOnly","disabledMcpjsonServers","allowManagedHooksOnly","allowedHttpHookUrls","strictKnownMarketplaces","allowedMarketplaces","blockedMarketplaces","strictPluginOnlyCustomization","availableModels","enforceAvailableModels"];function gQ(e){let t=0,n=e.length;while(t<n&&hQ(e.charCodeAt(t)))t++;while(n>t&&hQ(e.charCodeAt(n-1)))n--;let r=oXe(e.slice(t,n));if(r!==-1)return{kind:"line_break",index:LD(e,t+r)};for(let o=t;o<n;o++){let s=e.charCodeAt(o);if(s===0)return{kind:"nul",index:LD(e,o)};if(s>255)return{kind:"non_ascii",index:LD(e,o),codePoint:sXe(e,o)}}return null}function oXe(e){let t=e.indexOf(`
198
+ `),n=e.indexOf("\r");if(t===-1)return n;return n===-1?t:Math.min(t,n)}function hQ(e){return e===9||e===32||e===10||e===13}function sXe(e,t){return e.codePointAt(t)??e.charCodeAt(t)}function LD(e,t){let n=0;for(let r=0;r<t;r++){let o=e.charCodeAt(r);if(o>=55296&&o<=56319&&r+1<e.length&&(e.charCodeAt(r+1)&64512)===56320)r++;n++}return n}var ND=["CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_VERTEX","CLAUDE_CODE_USE_FOUNDRY","CLAUDE_CODE_USE_ANTHROPIC_AWS","CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD","CLAUDE_CODE_USE_MANTLE","CLAUDE_CODE_USE_GATEWAY","ANTHROPIC_FOUNDRY_RESOURCE","ANTHROPIC_VERTEX_PROJECT_ID","ANTHROPIC_AWS_WORKSPACE_ID","ANTHROPIC_GOOGLE_CLOUD_PROJECT","ANTHROPIC_GOOGLE_CLOUD_LOCATION","ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID","CLOUD_ML_REGION"],_Q=["CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_ANTHROPIC_AWS","CLAUDE_CODE_USE_MANTLE"];var yQ="OTEL_EXPORTER_OTLP_",SQ=["OTEL_LOG_RAW_API_BODIES","OTEL_LOG_USER_PROMPTS","OTEL_LOG_ASSISTANT_RESPONSES","OTEL_LOG_TOOL_CONTENT","OTEL_LOG_TOOL_DETAILS","OTEL_LOGS_EXPORTER","ENABLE_BETA_TRACING_DETAILED","BETA_TRACING_ENDPOINT","ANT_OTEL_LOGS_EXPORTER"],bQ=[yQ,`ANT_${yQ}`],EQ={apiKeyHelper:["ANTHROPIC_BASE_URL","_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL"],awsAuthRefresh:[..._Q,"ANTHROPIC_BEDROCK_BASE_URL","ANTHROPIC_AWS_BASE_URL","ANTHROPIC_BEDROCK_MANTLE_BASE_URL"],awsCredentialExport:[..._Q,"ANTHROPIC_BEDROCK_BASE_URL","ANTHROPIC_AWS_BASE_URL","ANTHROPIC_BEDROCK_MANTLE_BASE_URL"],gcpAuthRefresh:["CLAUDE_CODE_USE_VERTEX","CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD","ANTHROPIC_VERTEX_BASE_URL","ANTHROPIC_GOOGLE_CLOUD_BASE_URL"]},iXe=["CLAUDE_CODE_MEMORY_API_BASE_URL","CLAUDE_CODE_MEMORY_API_TOKEN"];var MD=["ANTHROPIC_BASE_URL","_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL","ANTHROPIC_BEDROCK_BASE_URL","ANTHROPIC_VERTEX_BASE_URL","ANTHROPIC_FOUNDRY_BASE_URL","ANTHROPIC_AWS_BASE_URL","ANTHROPIC_GOOGLE_CLOUD_BASE_URL","ANTHROPIC_BEDROCK_MANTLE_BASE_URL","CLAUDE_CODE_ARTIFACTS_API_BASE_URL","CLAUDE_CODE_ARTIFACTS_API_TOKEN","CLAUDE_CODE_ARTIFACT_ASSET_BASE_URL","CLAUDE_CODE_ARTIFACT_LIVE_BASE_URL","CLAUDE_CODE_ARTIFACT_SYNC_BASE_URL","CLAUDE_CODE_ARTIFACT_VIEWER_BASE_URL",...iXe],aXe=[{endpoint:"ANTHROPIC_BASE_URL",companions:["_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL","ANTHROPIC_CUSTOM_HEADERS"]},{endpoint:"ANTHROPIC_BEDROCK_BASE_URL",selection:"CLAUDE_CODE_USE_BEDROCK",companions:["CLAUDE_CODE_SKIP_BEDROCK_AUTH","ANTHROPIC_CUSTOM_HEADERS"]},{endpoint:"ANTHROPIC_VERTEX_BASE_URL",selection:"CLAUDE_CODE_USE_VERTEX",companions:["CLAUDE_CODE_SKIP_VERTEX_AUTH","ANTHROPIC_CUSTOM_HEADERS"]},{endpoint:"ANTHROPIC_FOUNDRY_BASE_URL",selection:"CLAUDE_CODE_USE_FOUNDRY",companions:["CLAUDE_CODE_SKIP_FOUNDRY_AUTH","ANTHROPIC_CUSTOM_HEADERS"]},{endpoint:"ANTHROPIC_AWS_BASE_URL",selection:"CLAUDE_CODE_USE_ANTHROPIC_AWS",companions:["CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH","ANTHROPIC_CUSTOM_HEADERS"]},{endpoint:"ANTHROPIC_GOOGLE_CLOUD_BASE_URL",selection:"CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD",companions:["CLAUDE_CODE_SKIP_ANTHROPIC_GOOGLE_CLOUD_AUTH","ANTHROPIC_CUSTOM_HEADERS"]},{endpoint:"ANTHROPIC_BEDROCK_MANTLE_BASE_URL",selection:"CLAUDE_CODE_USE_MANTLE",companions:["CLAUDE_CODE_SKIP_MANTLE_AUTH","ANTHROPIC_CUSTOM_HEADERS"]}],lVt=Ar(aXe.flatMap((e)=>[e.endpoint,...e.companions])),UD=["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_BEARER_TOKEN_BEDROCK","ANTHROPIC_FOUNDRY_API_KEY","ANTHROPIC_FOUNDRY_AUTH_TOKEN","ANTHROPIC_AWS_API_KEY"],cXe=["CLAUDE_CODE_SKIP_BEDROCK_AUTH","CLAUDE_CODE_SKIP_VERTEX_AUTH","CLAUDE_CODE_SKIP_FOUNDRY_AUTH","CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH","CLAUDE_CODE_SKIP_ANTHROPIC_GOOGLE_CLOUD_AUTH","CLAUDE_CODE_SKIP_MANTLE_AUTH"],FD=["ANTHROPIC_MODEL","ANTHROPIC_DEFAULT_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_FABLE_MODEL_NAME","ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_HAIKU_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME","ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_OPUS_MODEL_NAME","ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_SONNET_MODEL_NAME","ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_SMALL_FAST_MODEL","ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION","CLAUDE_CODE_SUBAGENT_MODEL","CLAUDE_CODE_3P_PROBE_WROTE_SONNET_DEFAULT","CLAUDE_CODE_3P_PROBE_WROTE_OPUS_DEFAULT"],$D=["ANTHROPIC_CUSTOM_MODEL_OPTION","ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION","ANTHROPIC_CUSTOM_MODEL_OPTION_NAME","ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES"],lXe=["CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR","CLAUDE_CODE_GATEWAY_TOKEN_FILE_DESCRIPTOR","CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR","CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR"],uVt=["CLAUDE_CODE_OAUTH_TOKEN",...lXe,"CLAUDE_CODE_ARTIFACTS_API_TOKEN","CLAUDE_CODE_SLACK_TAG_TOKEN","CLAUDE_CODE_HFI_BEARER_TOKEN","CLAUDE_BRIDGE_OAUTH_TOKEN","CLAUDE_TRUSTED_DEVICE_TOKEN","AGENT_PROXY_AUTH_TOKEN","CLAUDE_BG_AUTH_SNAPSHOT_PATH","CLAUDE_BG_SOCKET_TOKENS_PATH","CLAUDE_BG_RV_AUTH","CLAUDE_BG_PTY_AUTH","CLAUDE_BG_CLAIM_AUTH"],uXe=["AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN"],zD=[...uXe,"AWS_PROFILE","AWS_CONFIG_FILE","AWS_SHARED_CREDENTIALS_FILE","GOOGLE_APPLICATION_CREDENTIALS","GOOGLE_CLOUD_PROJECT"];var jD=["AWS_CONTAINER_CREDENTIALS_FULL_URI","AWS_CONTAINER_CREDENTIALS_RELATIVE_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE","AWS_EC2_METADATA_SERVICE_ENDPOINT","AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE","AWS_WEB_IDENTITY_TOKEN_FILE","AWS_ROLE_ARN"],HD=["GCE_METADATA_HOST","GCE_METADATA_ROOT","GCE_METADATA_IP","METADATA_SERVER_DETECTION"],dVt=new Set(["CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST",...ND,...MD,...UD,...cXe,"CLAUDE_CODE_HOST_AUTH_ENV_VAR","CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH","CLAUDE_CODE_HOST_AUTH_REFRESH_TIMEOUT_MS","CLAUDE_CODE_HOST_CREDS_FILE",...zD,"GCLOUD_PROJECT","GOOGLE_CLOUD_QUOTA_PROJECT",...HD,...jD,"AWS_REGION","AWS_DEFAULT_REGION",...FD,"ANTHROPIC_BEDROCK_SERVICE_TIER","ANTHROPIC_BEDROCK_REGION_PREFIX","CLAUDE_CODE_CERT_STORE","DISABLE_GROWTHBOOK","CLAUDE_CODE_AUTO_MODE_MODEL","CLAUDE_CODE_BG_CLASSIFIER_MODEL","CLAUDE_CONTEXT_COLLAPSE_MODEL","CLAUDE_CODE_SUBAGENT_MODEL_FORCE",...$D]);var xQ=["apiKeyHelper","awsAuthRefresh","awsCredentialExport","fileSuggestion","gcpAuthRefresh","otelHeadersHelper","processWrapper","policyHelpers","proxyAuthHelper","statusLine","subagentStatusLine"],vQ=["bwrapPath","ripgrep","socatPath"],wQ=["allowAppleEvents","credentials","enableWeakerNestedSandbox","enableWeakerNetworkIsolation","filesystem.disabled","network.allowAllUnixSockets","network.allowMachLookup","network.allowUnixSockets","network.httpProxyPort","network.socksProxyPort","network.tlsTerminate"],dXe=new Set(["ANTHROPIC_BEDROCK_REGION_PREFIX","ANTHROPIC_BEDROCK_SERVICE_TIER","ANTHROPIC_CUSTOM_MODEL_OPTION","ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION","ANTHROPIC_CUSTOM_MODEL_OPTION_NAME","ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_FABLE_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_FABLE_MODEL_NAME","ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME","ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_OPUS_MODEL_NAME","ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_SONNET_MODEL_NAME","ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_FOUNDRY_API_KEY","ANTHROPIC_MODEL","ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION","ANTHROPIC_SMALL_FAST_MODEL","AWS_DEFAULT_REGION","AWS_PROFILE","AWS_REGION","BASH_DEFAULT_TIMEOUT_MS","BASH_MAX_OUTPUT_LENGTH","BASH_MAX_TIMEOUT_MS","CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR","CLAUDE_CODE_API_KEY_HELPER_TTL_MS","CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS","CLAUDE_CODE_DISABLE_TERMINAL_TITLE","CLAUDE_CODE_ENABLE_AUTO_MODE","CLAUDE_CODE_ENABLE_DESIGN_SYNC","CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL","CLAUDE_CODE_ENABLE_TELEMETRY","CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS","CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL","CLAUDE_CODE_MAX_OUTPUT_TOKENS","CLAUDE_CODE_SKIP_BEDROCK_AUTH","CLAUDE_CODE_SKIP_FOUNDRY_AUTH","CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH","CLAUDE_CODE_SKIP_ANTHROPIC_GOOGLE_CLOUD_AUTH","CLAUDE_CODE_SKIP_MANTLE_AUTH","CLAUDE_CODE_SKIP_VERTEX_AUTH","CLAUDE_CODE_SUBAGENT_MODEL","CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_FOUNDRY","CLAUDE_CODE_USE_ANTHROPIC_AWS","CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD","CLAUDE_CODE_USE_GATEWAY","CLAUDE_CODE_USE_MANTLE","CLAUDE_CODE_USE_POWERSHELL_TOOL","CLAUDE_CODE_USE_VERTEX","DISABLE_AUTOUPDATER","DISABLE_BUG_COMMAND","DISABLE_COST_WARNINGS","DISABLE_FEEDBACK_COMMAND","DISABLE_GROWTHBOOK","DISABLE_INSTALLATION_CHECKS","DISABLE_UPDATES","ENABLE_TOOL_SEARCH","MAX_MCP_OUTPUT_TOKENS","MAX_THINKING_TOKENS","MCP_CONNECT_TIMEOUT_MS","MCP_TIMEOUT","MCP_TOOL_TIMEOUT","OTEL_EXPORTER_OTLP_COMPRESSION","OTEL_EXPORTER_OTLP_HEADERS","OTEL_EXPORTER_OTLP_LOGS_COMPRESSION","OTEL_EXPORTER_OTLP_LOGS_HEADERS","OTEL_EXPORTER_OTLP_LOGS_PROTOCOL","OTEL_EXPORTER_OTLP_METRICS_COMPRESSION","OTEL_EXPORTER_OTLP_METRICS_HEADERS","OTEL_EXPORTER_OTLP_METRICS_PROTOCOL","OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE","OTEL_EXPORTER_OTLP_PROTOCOL","OTEL_EXPORTER_OTLP_TRACES_COMPRESSION","OTEL_EXPORTER_OTLP_TRACES_HEADERS","OTEL_EXPORTER_OTLP_TRACES_PROTOCOL","OTEL_LOG_ASSISTANT_RESPONSES","OTEL_LOG_TOOL_CONTENT","OTEL_LOG_TOOL_DETAILS","OTEL_LOG_USER_PROMPTS","OTEL_LOGS_EXPORT_INTERVAL","OTEL_LOGS_EXPORTER","OTEL_METRIC_EXPORT_INTERVAL","OTEL_METRICS_EXPORTER","OTEL_METRICS_INCLUDE_ACCOUNT_UUID","OTEL_METRICS_INCLUDE_ENTRYPOINT","OTEL_METRICS_INCLUDE_RESOURCE_ATTRIBUTES","OTEL_METRICS_INCLUDE_SESSION_ID","OTEL_METRICS_INCLUDE_VERSION","OTEL_RESOURCE_ATTRIBUTES","OTEL_SERVICE_NAME","OTEL_TRACES_EXPORT_INTERVAL","OTEL_TRACES_EXPORTER","USE_BUILTIN_RIPGREP","VERTEX_REGION_CLAUDE_3_5_HAIKU","VERTEX_REGION_CLAUDE_3_5_SONNET","VERTEX_REGION_CLAUDE_3_7_SONNET","VERTEX_REGION_CLAUDE_4_0_OPUS","VERTEX_REGION_CLAUDE_4_0_SONNET","VERTEX_REGION_CLAUDE_4_1_OPUS","VERTEX_REGION_CLAUDE_4_5_OPUS","VERTEX_REGION_CLAUDE_4_6_OPUS","VERTEX_REGION_CLAUDE_4_7_OPUS","VERTEX_REGION_CLAUDE_4_8_OPUS","VERTEX_REGION_CLAUDE_5_OPUS","VERTEX_REGION_CLAUDE_FABLE_5","VERTEX_REGION_CLAUDE_FABLE_5_1","VERTEX_REGION_CLAUDE_4_5_SONNET","VERTEX_REGION_CLAUDE_4_6_SONNET","VERTEX_REGION_CLAUDE_5_SONNET","VERTEX_REGION_CLAUDE_HAIKU_4_5","CLAUDE_AUTOCOMPACT_PCT_OVERRIDE","CLAUDE_CODE_AUTO_COMPACT_WINDOW","CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT","CLAUDE_CODE_MAX_CONTEXT_TOKENS","DISABLE_AUTO_COMPACT","DISABLE_COMPACT","CLAUDE_CODE_ALWAYS_ENABLE_EFFORT","CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING","CLAUDE_CODE_DISABLE_FAST_MODE","CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP","CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK","CLAUDE_CODE_DISABLE_THINKING","CLAUDE_CODE_EFFORT_LEVEL","CLAUDE_CODE_PROMPT_CACHE_TTL","CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL","DISABLE_INTERLEAVED_THINKING","DISABLE_PROMPT_CACHING","DISABLE_PROMPT_CACHING_FABLE","DISABLE_PROMPT_CACHING_HAIKU","DISABLE_PROMPT_CACHING_OPUS","DISABLE_PROMPT_CACHING_SONNET","ENABLE_PROMPT_CACHING_1H","ENABLE_PROMPT_CACHING_1H_BEDROCK","FALLBACK_FOR_ALL_PRIMARY_MODELS","FORCE_PROMPT_CACHING_5M","CLAUDE_AUTO_BACKGROUND_TASKS","CLAUDE_CODE_DISABLE_ADVISOR_TOOL","CLAUDE_CODE_DISABLE_AGENT_VIEW","CLAUDE_CODE_DISABLE_ARTIFACT","CLAUDE_CODE_DISABLE_BACKGROUND_TASKS","CLAUDE_CODE_DISABLE_BUNDLED_SKILLS","CLAUDE_CODE_DISABLE_CRON","CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS","CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY","CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING","CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND","CLAUDE_CODE_DISABLE_MEMORY_RO_UNSAVED_NOTICE","CLAUDE_CODE_DISABLE_WORKFLOWS","CLAUDE_CODE_ENABLE_AWAY_SUMMARY","CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING","CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION","CLAUDE_CODE_ENABLE_TASKS","CLAUDE_CODE_FORK_SUBAGENT","CLAUDE_CODE_PLAN_MODE_REQUIRED","DISABLE_DOCTOR_COMMAND","DISABLE_EXTRA_USAGE_COMMAND","DISABLE_INSTALL_GITHUB_APP_COMMAND","DISABLE_LOGIN_COMMAND","DISABLE_LOGOUT_COMMAND","DISABLE_UPGRADE_COMMAND","CLAUDE_AX_SCREEN_READER","CLAUDE_CODE_ACCESSIBILITY","CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN","CLAUDE_CODE_DISABLE_MOUSE","CLAUDE_CODE_DISABLE_MOUSE_CLICKS","CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL","CLAUDE_CODE_FORCE_STRIKETHROUGH","CLAUDE_CODE_HIDE_CWD","CLAUDE_CODE_NATIVE_CURSOR","CLAUDE_CODE_NO_FLICKER","CLAUDE_CODE_SCROLL_SPEED","CLAUDE_CODE_SYNTAX_HIGHLIGHT","API_TIMEOUT_MS","CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS","CLAUDE_CODE_COORDINATOR_WORKER_CHECKIN_SECONDS","CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS","CLAUDE_CODE_GLOB_TIMEOUT_SECONDS","CLAUDE_CODE_MAX_RETRIES","CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION","CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY","CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION","CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS","CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT","CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS","CLAUDE_STREAM_IDLE_TIMEOUT_MS","MAX_STRUCTURED_OUTPUT_RETRIES","MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE","MCP_SERVER_CONNECTION_BATCH_SIZE","SLASH_COMMAND_TOOL_CHAR_BUDGET","TASK_MAX_OUTPUT_LENGTH","MCP_CONNECTION_NONBLOCKING","CLAUDE_ENABLE_BYTE_WATCHDOG","CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK","CLAUDE_ENABLE_STREAM_WATCHDOG"]),pXe=new Set(["API_FORCE_IDLE_TIMEOUT","CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC","DISABLE_ERROR_REPORTING","DISABLE_TELEMETRY","DO_NOT_TRACK"]),fXe=new Set(["ENABLE_BETA_TRACING_DETAILED","OTEL_LOG_RAW_API_BODIES"]),mXe=/auth|key|token|cookie|secret|credential|session|signature|passw|jwt|assertion|cert|oidc|org|tenant|account|project|workspace|user|email|identity|principal|consumer|client|host|url|base|target|upstream|endpoint|proxy|forward|route|fallback|override|apigw|x-goog-|l5d-|bypass|guardrail|amz|x-ms-|azureml|extra-parameters|envoy|helicone|litellm|cf-aig|cf-access|beta|version/;function hXe(e){if(/\r(?!\n)/.test(e))return!0;return e.split(/\n|\r\n/).some((t)=>{let n=t.indexOf(":");if(n===-1)return!1;let r=t.slice(0,n).trim();return!gXe.test(r)||gQ(t.slice(n+1))!==null||mXe.test(r.toLowerCase())})}var gXe=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function AQ(e,t){let n=e.toUpperCase();return dXe.has(n)||pXe.has(n)&&Oe(t)||fXe.has(n)&&la(t)||n==="ANTHROPIC_CUSTOM_HEADERS"&&!hXe(t)}import{createHash as Kee}from"crypto";import{posix as Uee,win32 as Fee}from"path";var wd=["acceptEdits","auto","bypassPermissions","default","dontAsk","plan"],yXe=[...wd],TQ=yXe;function Ih(e){return e==="manual"?"default":e}var xVt=`Cannot set permission mode: must be one of ${wd.join(", ")}`,vVt={dangerousRemoval:{bypassImmune:!0,classifierRouted:!0},backgroundOperator:{bypassImmune:!1,classifierRouted:!0},suspiciousWindowsPath:{bypassImmune:!1,classifierRouted:!0},isolatePeerMachines:{bypassImmune:!0,classifierRouted:!1},restrictedMode:{bypassImmune:!0,classifierRouted:!1},outsideReadsBlocked:{bypassImmune:!0,classifierRouted:!1},...{}};var CQ=["auto","iterm2","terminal_bell","iterm2_with_bell","kitty","ghostty","notifications_disabled"];var kQ=["normal","vim"],RQ=["classic","readline"];var OQ=["auto","12-hour","24-hour","24-hour-utc"],PQ=["auto","tmux","iterm2","in-process"],SXe=["dark","light","light-daltonized","dark-daltonized","light-ansi","dark-ansi"],IQ=["auto",...SXe],DQ=["auto","alwaysAsk","disabled"],LQ=1e5,NQ=1e6;var kVt=Tr()==="macos"?"⏺":"●";var MVt=I(()=>st(Ih,V(TQ))),UVt=I(()=>st(Ih,V(wd)));import{posix as VXe,win32 as qXe}from"path";import{isIPv4 as bXe,isIPv6 as EXe}from"net";var xXe=new Set(["metadata.google.internal","metadata.goog","metadata","instance-data","instance-data.ec2.internal","ip6-localhost","ip6-loopback","localhost.localdomain","localhost4","localhost4.localdomain4","localhost6","localhost6.localdomain6"]),MQ=new Set(["100.100.100.200","168.63.129.16","192.0.0.192"]);function UQ(e,t,n,r){return e===127||e===169&&t===254||e===0}function vXe(e){let t=e.indexOf("%"),r=(t>=0?e.slice(0,t):e).toLowerCase().split("::");if(r.length>2)return;let o=r[0]?r[0].split(":"):[],s=r.length===2&&r[1]?r[1].split(":"):[],i=r.length===2?s:o,a=[],c=i.at(-1);if(c!==void 0&&c.includes(".")){let m=c.split(".").map(Number);if(m.length!==4||m.some((h)=>!Number.isInteger(h)||h<0||h>255))return;a=m,i.pop()}let l=(m)=>{let h=[];for(let y of m){if(!/^[0-9a-f]{1,4}$/.test(y))return;let _=parseInt(y,16);h.push(_>>8,_&255)}return h},u=l(r.length===2?o:[]),p=l(i);if(u===void 0||p===void 0)return;let f=u.length+p.length+a.length;if(f>16||r.length===1&&f!==16)return;return[...u,...Array(16-f).fill(0),...p,...a]}function wXe(e){return FQ(e)&&e[4]===0&&e[5]===1}function FQ(e){return e[0]===0&&e[1]===100&&e[2]===255&&e[3]===155}function AXe(e){let t=[];if(e[0]===32&&e[1]===2)t.push(e.slice(2,6));let n=e.slice(0,10).every((a)=>a===0),r=n&&e[10]===255&&e[11]===255,o=n&&e[10]===0&&e[11]===0,s=FQ(e)&&e.slice(4,12).every((a)=>a===0),i=(e[8]===0||e[8]===2)&&e[9]===0&&e[10]===94&&e[11]===254;if(r||o||s||i)t.push(e.slice(12,16));return t}function $Q(e){let t=e.toLowerCase().replace(/^\[|\]$/g,"");if(t.endsWith("."))t=t.slice(0,-1);if(t===""||t==="localhost"||t.endsWith(".localhost"))return!0;if(xXe.has(t))return!0;if(t.startsWith("instance-data.")&&t.endsWith(".compute.internal"))return!0;if(bXe(t)){if(MQ.has(t))return!0;let[r=0,o=0,s=0,i=0]=t.split(".").map(Number);return UQ(r,o,s,i)}if(!EXe(t))return!1;let n=vXe(t);if(n===void 0)return!0;if(wXe(n))return!0;if(n.every((r)=>r===0))return!0;if(n.slice(0,15).every((r)=>r===0)&&n[15]===1)return!0;if(t==="fd00:ec2::254")return!0;if(n[0]===254&&(n[1]??0)>=128&&(n[1]??0)<=191)return!0;return AXe(n).some((r)=>{let[o=0,s=0,i=0,a=0]=r;return UQ(o,s,i,a)||MQ.has(`${o}.${s}.${i}.${a}`)})}var zQ=["bash","powershell"];var Dh=I(()=>g().optional().describe('Permission rule syntax to filter when this hook runs (e.g., "Bash(git *)"). Only runs if the tool call matches the pattern. Avoids spawning hooks for non-matching commands.'));function TXe(){let e=C({type:z("command").describe("Shell command hook type"),command:g().describe("Shell command to execute"),args:D(g()).optional().describe("Argument list for exec form. When present, `command` is resolved as "+"an executable and spawned directly with these arguments — no shell. "+"Path placeholders like ${CLAUDE_PLUGIN_ROOT} are substituted per-element as plain strings, so paths with quotes, $, or backticks never reach a shell parser. When absent, `command` runs through a shell (bash on POSIX, PowerShell on Windows without Git Bash)."),if:Dh(),shell:V(zQ).optional().describe("Shell interpreter. 'bash' uses your $SHELL (bash/zsh/sh); 'powershell' uses pwsh. Defaults to bash (powershell on Windows without Git Bash)."),timeout:ee().positive().optional().describe("Timeout in seconds for this specific command"),statusMessage:g().optional().describe("Custom status message to display in spinner while hook runs"),once:R().optional().describe("If true, hook runs once and is removed after execution"),async:R().optional().describe("If true, hook runs in background without blocking"),asyncRewake:R().optional().describe("If true, hook runs in background and wakes the model on exit code 2 (blocking error). Implies async."),rewakeMessage:g().min(1).optional().describe("@internal Custom prefix for the system-reminder shown to the model when an asyncRewake hook exits with code 2. The hook output is appended after this prefix."),rewakeSummary:g().min(1).optional().describe('@internal One-line summary shown to the user in the terminal when an asyncRewake hook exits with code 2. Defaults to "Stop hook feedback".'),cloud:V(["device","skip"]).optional().catch("skip").describe("@internal Where this hook may run when a cloud session is driven from this machine. 'device': offer it to the cloud session and run it here even when its script sits where the cloud session can write on this machine or cannot be pinned — the author accepts that the session may have changed files this hook executes. 'skip': never offer it to cloud sessions. Omit for the default: a command hook whose script could be read and pinned and lies outside everything the cloud session can write here is offered; other command hooks are not. Applies to this entry only: the same hook written in another settings scope keeps its own setting. An unrecognised value reads as 'skip' (the file still loads; the hook stays on this machine).")}),t=C({type:z("prompt").describe("LLM prompt hook type"),prompt:g().describe("Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON."),if:Dh(),timeout:ee().positive().optional().describe("Timeout in seconds for this specific prompt evaluation"),model:g().optional().describe('Model to use for this prompt hook (e.g., "claude-sonnet-5"). If not specified, uses the default small fast model.'),continueOnBlock:R().optional().describe(`Sets the continue value for the decision:"block" produced when ok is false. Default false (turn ends). Whether continue:true lets the turn proceed depends on the event's decision:"block" semantics. On PostToolUse, the reason is fed back to Claude and the turn continues.`),statusMessage:g().optional().describe("Custom status message to display in spinner while hook runs"),once:R().optional().describe("If true, hook runs once and is removed after execution")}),n=C({type:z("mcp_tool").describe("MCP tool hook type"),server:g().describe("Name of an already-configured MCP server to invoke"),tool:g().describe("Name of the tool on that server to call"),input:J(g(),ke()).optional().describe('Arguments passed to the MCP tool. String values support ${path} interpolation from the hook input JSON (e.g. "${tool_input.file_path}").'),if:Dh(),timeout:ee().positive().optional().describe("Timeout in seconds for this specific tool call"),statusMessage:g().optional().describe("Custom status message to display in spinner while hook runs"),once:R().optional().describe("If true, hook runs once and is removed after execution")}),r=C({type:z("http").describe("HTTP hook type"),url:g().url().describe("URL to POST the hook input JSON to"),if:Dh(),timeout:ee().positive().optional().describe("Timeout in seconds for this specific request"),headers:J(g(),g()).optional().describe('Additional headers to include in the request. Values may reference environment variables using $VAR_NAME or ${VAR_NAME} syntax (e.g., "Authorization": "Bearer $MY_TOKEN"). Only variables listed in allowedEnvVars will be interpolated.'),allowedEnvVars:D(g()).optional().describe("Explicit list of environment variable names that may be interpolated in header values. Only variables listed here will be resolved; all other $VAR references are left as empty strings. Required for env var interpolation to work."),statusMessage:g().optional().describe("Custom status message to display in spinner while hook runs"),once:R().optional().describe("If true, hook runs once and is removed after execution"),cloud:V(["device","skip"]).optional().catch("skip").describe("@internal Where this hook may run when a cloud session is driven from this machine. 'skip': never offer it to cloud sessions; 'device' or omitted: offered (an HTTP hook has no script to pin). Applies to this entry only. An unrecognised value reads as 'skip' (the file still loads).")}),o=C({type:z("agent").describe("Agentic verifier hook type"),prompt:g().describe('Prompt describing what to verify (e.g. "Verify that unit tests ran and passed."). Use $ARGUMENTS placeholder for hook input JSON.'),if:Dh(),timeout:ee().positive().optional().describe("Timeout in seconds for agent execution (default 60)"),model:g().optional().describe('Model to use for this agent hook (e.g., "claude-sonnet-5"). If not specified, uses Haiku.'),statusMessage:g().optional().describe("Custom status message to display in spinner while hook runs"),once:R().optional().describe("If true, hook runs once and is removed after execution")});return{BashCommandHookSchema:e,PromptHookSchema:t,HttpHookSchema:r,AgentHookSchema:o,McpToolHookSchema:n}}var EE=I(()=>{let{BashCommandHookSchema:e,PromptHookSchema:t,AgentHookSchema:n,HttpHookSchema:r,McpToolHookSchema:o}=TXe();return dc("type",[...[e,t,n,r,o]])}),BD=I(()=>C({matcher:g().optional().describe('String pattern to match (e.g. tool names like "Write")'),hooks:D(EE()).describe("List of hooks to execute when the matcher matches")})),Cc=I(()=>U3(V(_s),D(BD())));function xE(){return new Set(EE().options.map((e)=>e.shape.type.value))}function CXe(e,t){if(!e||typeof e!=="object"||Array.isArray(e)){let o=Ac(e);return{problem:`Hook entry must be an object; received ${o}`,received:o,aboutType:!1}}let n=e.type;if(typeof n!=="string"){let o=Ac(n);return{problem:n===void 0?'Hook entry has no "type"':`Hook entry "type" must be a string; received ${o}`,received:o,aboutType:!0}}if(!t.has(n)){let o=Tg(n);return{problem:`Unknown hook type "${o}"`,received:o,aboutType:!0}}let r=EE().safeParse(e);if(!r.success)return{problem:`Invalid ${n} hook (${jQ(r.error)})`,received:n,aboutType:!1};return}function jQ(e){return e.issues.map((t)=>t.path.length>0?`${t.path.join(".")}: ${t.message}`:t.message).join("; ")}function vE(e){if(!e||typeof e!=="object"||Array.isArray(e))return!1;if(!("matcher"in e)&&Object.keys(e).some((n)=>_s.includes(n)))return!1;let t=e.hooks;if(Array.isArray(t))return t.length>0;return!!t&&typeof t==="object"&&(("matcher"in e)||typeof t.type==="string")}function Tc(e,t=3,{matchersCount:n=!0,unscannedKeys:r=kXe,inHooksList:o=!1}={}){if(KQ(e))return!0;if(n&&vE(e))return!0;if(t===0||!e||typeof e!=="object")return!1;if(Array.isArray(e))return e.some((s)=>Tc(s,t-1,{matchersCount:n,unscannedKeys:r,inHooksList:o}));if(o&&typeof e.type==="string")return!1;return Object.entries(e).some(([s,i])=>!r.has(s)&&Tc(i,t-1,{unscannedKeys:r,matchersCount:n&&!_s.includes(s),inHooksList:s==="hooks"&&Array.isArray(i)}))}function HQ(e,t){if(!e||typeof e!=="object"||Array.isArray(e))return!1;return KQ(e)||Object.entries(e).some(([n,r])=>n!=="hooks"&&!t.has(n)&&Tc(r,3,{unscannedKeys:t,matchersCount:!_s.includes(n)}))}var kXe=new Set,BQ=new Set(["mcpServers","lspServers","pluginConfigs","enabledPlugins","extraKnownMarketplaces","env","skillOverrides","modelSettings"]),RXe=new Set(["metadata","mcpServers","lspServers"]),VVt=new Set([...RXe,"experimental"]);function KQ(e){if(!e||typeof e!=="object"||Array.isArray(e))return!1;return Object.entries(e).some(([t,n])=>Lh.has(t)&&n!==null&&n!==void 0&&!(Array.isArray(n)&&n.length===0))}function KD(e){if(vE(e))return!0;if(Array.isArray(e))return e.some(KD);if(!e||typeof e!=="object")return!1;return Object.entries(e).some(([t,n])=>Lh.has(t)&&n!==null&&n!==void 0&&!(Array.isArray(n)&&n.length===0))}var Lh=new Set(["PreToolUse","PermissionRequest"]);function GQ(e,t){if(!Array.isArray(e))return{stripped:[],unloadableGuards:[]};let n=Lh.has(t),r=xE(),o=BD(),s=[],i=[];for(let a=e.length-1;a>=0;a--){let c=e[a],l=(m,h)=>{if(!n)e.splice(a,1);s.push({matcherIndex:a,hookIndex:void 0,path:`${a}`,problem:m,received:h,aboutType:!1})};if(Tc(c,3,{matchersCount:!1})){(n?s:i).push({matcherIndex:a,hookIndex:void 0,path:`${a}`,problem:"holds PreToolUse/PermissionRequest hooks where a matcher was expected",received:Ac(c),aboutType:!1});continue}if(!c||typeof c!=="object"||Array.isArray(c)){l(`Hook matcher must be an object; received ${Ac(c)}`,Ac(c));continue}let u=c.hooks;if(!Array.isArray(u)){l(`Hook matcher "hooks" must be an array of hook entries; received ${Ac(u)}`,Ac(u));continue}let p=[];for(let m=u.length-1;m>=0;m--){let h=CXe(u[m],r);if(h!==void 0){if(!n)u.splice(m,1);p.push({matcherIndex:a,hookIndex:m,path:`${a}.hooks.${m}`,...h})}}let f=o.safeParse(n?{...c,hooks:[]}:c);if(!f.success){l(`Invalid hook matcher (${jQ(f.error)})`,"matcher");continue}s.push(...p)}return s.reverse(),i.reverse(),n?{stripped:[],unloadableGuards:s}:{stripped:s,unloadableGuards:i}}var kc="a PreToolUse/PermissionRequest hook that cannot be loaded may be what guards the permissions declared beside it, so nothing it sits in is applied until the entry is fixed or removed";function Ac(e){if(e===null||e===void 0)return String(e);if(Array.isArray(e))return"an array";let t=typeof e;return`${t==="object"?"an":"a"} ${t}`}var YVt=I(()=>V(["local","user","project","dynamic","enterprise","claudeai","managed","agent"])),JVt=I(()=>V(["stdio","sse","sse-ide","http","ws","sdk"])),Ad=I(()=>z("comms").optional().catch(void 0)),na=I(()=>ee().int().positive()),OXe=300000,WQ=I(()=>ee().int().positive().optional().catch(void 0).describe("@internal CCR backend wire hint; folded into timeout at parse."));function VQ({request_timeout_ms:e,...t}){return{...t,...t.timeout===void 0&&e!==void 0&&{timeout:Math.min(e,OXe)}}}var PXe=I(()=>C({type:z("stdio").optional(),command:g().min(1,"Command cannot be empty"),args:D(g()).default([]),env:J(g(),g()).optional(),timeout:na().optional(),alwaysLoad:R().optional(),role:Ad()})),IXe=I(()=>R()),qQ=I(()=>C({clientId:g().optional(),callbackPort:ee().int().positive().optional(),authServerMetadataUrl:g().url().startsWith("https://",{message:"authServerMetadataUrl must use https://"}).optional(),scopes:g().min(1).optional(),xaa:IXe().optional()})),ZQ=I(()=>C({name:g(),permission_policy:V(["always_allow","always_ask","always_deny"]).optional()})),DXe=I(()=>C({type:z("sse"),url:g(),headers:J(g(),g()).optional(),headersHelper:g().optional(),oauth:qQ().optional(),timeout:na().optional(),request_timeout_ms:WQ(),tools:D(ZQ()).optional(),alwaysLoad:R().optional(),discoveryCache:R().optional(),role:Ad(),toolPermissions:J(g(),GD()).optional()}).transform(VQ)),LXe=I(()=>C({type:z("sse-ide"),url:g(),ideName:g(),ideRunningInWindows:R().optional(),timeout:na().optional(),alwaysLoad:R().optional(),role:Ad()})),NXe=I(()=>C({type:z("ws-ide"),url:g(),ideName:g(),authToken:g().optional(),ideRunningInWindows:R().optional(),timeout:na().optional(),alwaysLoad:R().optional(),role:Ad()})),MXe=I(()=>C({type:V(["http","streamable-http"]).transform(()=>"http"),url:g(),headers:J(g(),g()).optional(),headersHelper:g().optional(),oauth:qQ().optional(),timeout:na().optional(),request_timeout_ms:WQ(),tools:D(ZQ()).optional(),alwaysLoad:R().optional(),discoveryCache:R().optional(),role:Ad(),toolPermissions:J(g(),GD()).optional()}).transform(VQ)),UXe=I(()=>C({type:z("ws"),url:g(),headers:J(g(),g()).optional(),headersHelper:g().optional(),timeout:na().optional(),alwaysLoad:R().optional(),role:Ad()})),FXe=I(()=>C({type:z("sdk"),name:g(),timeout:na().optional(),alwaysLoad:R().optional()})),GD=I(()=>V(["allow","ask","blocked"])),$Xe=I(()=>C({type:z("claudeai-proxy"),url:g(),id:g(),displayName:g().optional(),iconUrl:g().optional(),timeout:na().optional(),alwaysLoad:R().optional(),toolPermissions:J(g(),GD()).optional(),stateless:R().optional(),cachedInitResponse:J(g(),ke()).nullish(),discoverSupport:V(["supported","legacy","unknown"]).optional().catch(void 0),cachedDiscoverResponse:J(g(),ke()).nullish(),eligible:R().nullish(),ineligibleReason:g().nullish(),enterpriseManaged:R().optional()})),wE=I(()=>de([PXe(),DXe(),LXe(),NXe(),MXe(),UXe(),FXe(),$Xe()]));var XVt=I(()=>C({mcpServers:J(g(),wE())}));function zXe(e){return eS(BXe(Ag(e))).replace(/ {2,}/g," ").trim()}var jXe=/\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]|\x1b[\]PX^_][^\x1b\x07]*(?:\x07|\x1b\\)/g,HXe=4;function BXe(e){let t=e;for(let n=0;n<HXe;n++){let r=t.replace(jXe,"");if(r===t)break;t=r}return t}function WD(e,t=160){return KXe(zXe(GXe(e,t)).normalize("NFC").replace(/[`\uff40\u02cb\u1fef\u2035]/g,"'").replace(WXe,""),t)}function KXe(e,t=2000){return e.length>t?`${sl(e,t)}…`:e}function GXe(e,t){let n=sl(e,t*8);if(n.length===e.length)return n;let r=/\x1b(?:[\]PX^_][^\x1b\x07]*\x1b?|\[[\x30-\x3f]*[\x20-\x2f]*)$/.exec(n);if(r===null)return n;let o=e.slice(r.index);return(o[1]==="["?/^\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]/.test(o):/^\x1b[\]PX^_][^\x1b\x07]*(?:\x07|\x1b\\)/.test(o))?n.slice(0,r.index):n}var WXe=/(?<![^\s\p{P}])\p{M}+/gu;var YD=500,ZXe=32;function nee(){return{sourceCommand:g().max(YD+20).optional().catch(void 0).describe("The `command`-source command the user accepted at explicit install/update. The once-per-session background re-resolve only runs while the marketplace entry still declares this exact command; a changed command (or an entry that became command-sourced later) is skipped with a warning until the user runs an explicit update."),sourceProducerPath:g().max(4096).refine(YQ,{message:"must be an absolute path"}).optional().catch(void 0).describe("The directory a `command`-source plugin was last resolved to (what its command printed). Served in place in link mode and re-copied every session in copy mode, so the sandbox write-denies it; refreshed on every install/update, including no-op updates that resolve to a new location."),previousProducerPaths:D(ke()).transform((e)=>e.filter((t)=>typeof t==="string"&&t.length<=4096&&YQ(t)).slice(-ZXe)).optional().catch(void 0).describe("Producer directories this installation was resolved to before the current one (most recent last, bounded). A concurrent older session may still serve one of them, so the sandbox keeps write-denying them too.")}}function YQ(e){return VXe.isAbsolute(e)||qXe.isAbsolute(e)}var ree=/[^\x20-\x7E]| {4,}/;function JD(){return g().max(YD,{message:"headersHelper must not be longer than the install consent UI can display"}).refine((e)=>!ree.test(e),{message:"headersHelper must be printable ASCII (letters, digits, punctuation, single spaces) with no runs of 4 or more spaces"})}var YXe=new Set(["claude-community","claude-plugins-community","healthcare"]),JXe=new Set(["claude-code-marketplace","claude-code-plugins","claude-plugins-official","anthropic-marketplace","anthropic-plugins","agent-skills","anthropic-agent-skills","life-sciences","knowledge-work-plugins","claude-for-legal","claude-for-financial-services","financial-services-plugins","first-party-plugins"]),oee=new Set([...JXe,...YXe]);var XXe=/(?:official[^a-z0-9]*(anthropic|claude)|(?:anthropic|claude)[^a-z0-9]*official|^(?:anthropic|claude)[^a-z0-9]*(marketplace|plugins|official))/i,QXe=/[^\u0020-\u007E]/;function e7e(e){if(oee.has(e.toLowerCase()))return!1;if(QXe.test(e))return!0;return XXe.test(e)}var us=I(()=>g().startsWith("./")),Rc=I(()=>us().endsWith(".json")),JQ=I(()=>de([z("."),us()])),XQ=I(()=>de([us().refine((e)=>e.endsWith(".mcpb")||e.endsWith(".dxt"),{message:"MCPB file path must end with .mcpb or .dxt"}).describe("Path to MCPB file relative to plugin root"),g().url().refine((e)=>e.endsWith(".mcpb")||e.endsWith(".dxt"),{message:"MCPB URL must end with .mcpb or .dxt"}).describe("URL to MCPB file")])),qD=I(()=>us().endsWith(".md")),ZD=I(()=>de([qD(),us()])),see={inline:"--plugin-dir session plugins",builtin:"built-in plugins","skills-dir":"plugins auto-loaded from .claude/skills/",synced:"plugins synced from your claude.ai account"};function t7e(e){return Object.hasOwn(see,e)}var iee=I(()=>g().min(1,"Marketplace must have a name").refine((e)=>!e.includes(" "),{message:'Marketplace name cannot contain spaces. Use kebab-case (e.g., "my-marketplace")'}).refine((e)=>!gee.test(e),{message:"Marketplace name cannot contain control or bidirectional-formatting characters"}).refine((e)=>!e.includes("/")&&!e.includes("\\")&&!e.includes("..")&&e!==".",{message:'Marketplace name cannot contain path separators (/ or \\), ".." sequences, or be "."'}).refine((e)=>!e7e(e),{message:"Marketplace name impersonates an official Anthropic/Claude marketplace"}).superRefine((e,t)=>{let n=e.toLowerCase();if(!t7e(n))return;t.addIssue({code:"custom",message:`Marketplace name "${n}" is reserved for ${see[n]}`})})),AE=I(()=>g().min(1,"Plugin name cannot be empty").refine((e)=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).refine((e)=>!gee.test(e),{message:"Plugin name cannot contain control or bidirectional-formatting characters"})),XD=I(()=>C({name:g().min(1,"Author name cannot be empty").describe("Display name of the plugin author or organization"),email:g().optional().describe("Contact email for support or feedback"),url:g().optional().describe("Website, GitHub profile, or organization URL")})),n7e=I(()=>C({$schema:g().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:AE().describe("Unique identifier for the plugin, used for namespacing (prefer kebab-case)"),displayName:g().optional().describe('Human-readable name shown in UI (e.g., "GitHub Utils"). Falls back to `name` when omitted. Unlike `name`, may contain spaces and any casing; not used for namespacing or lookup.'),version:g().optional().describe("Semantic version (e.g., 1.2.3) following semver.org specification"),description:g().optional().describe("Brief, user-facing explanation of what the plugin provides"),author:XD().optional().describe("Information about the plugin creator or maintainer"),homepage:g().url().optional().describe("Plugin homepage or documentation URL"),repository:g().optional().describe("Source code repository URL"),license:g().optional().describe("SPDX license identifier (e.g., MIT, Apache-2.0)"),keywords:D(g()).optional().describe("Tags for plugin discovery and categorization"),defaultEnabled:R().optional().describe("Whether the plugin starts enabled when the user has no explicit enabled/disabled setting for it (default: true). Explicit enabledPlugins values always win, and a plugin required by an enabled dependent is enabled regardless of this value."),dependencies:D(Q7e()).optional().describe(`Plugins that must be enabled for this plugin to function. Bare names (no "@marketplace") are resolved against the declaring plugin's own marketplace.`),metadata:st((e)=>It(e)?e:void 0,J(g(),ke()).optional()).describe("Free-form metadata for the plugin author's own use (e.g. entitlement or catalog fields). Preserved on the parsed manifest but not read by Claude Code.")})),r7e=1,yqt=I(()=>C({description:g().optional().describe("Brief, user-facing explanation of what these hooks provide"),hooks:NS(()=>Cc()).optional().describe("The hooks provided by the plugin, in the same format as the one used for settings"),modules:D(g()).max(r7e,{message:"hooks.json `modules` names one hooks module per plugin; a second entry is refused"}).optional().describe("The hooks module: one path, relative to this hooks.json, of a module exporting register(on). What it hooks and calls is read from its source before it loads; `claude plugin validate` shows the result.")}).refine((e)=>e.hooks!==void 0||(e.modules?.length??0)>0,{message:"hooks.json must have `hooks` (the hook matchers) or `modules` (hooks modules), or both"})),o7e=I(()=>C({hooks:de([Rc().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),NS(()=>Cc()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)"),D(de([Rc().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),NS(()=>Cc()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)")]))])})),s7e=I(()=>C({source:ZD().optional().describe("Path to command markdown file, relative to plugin root"),content:g().optional().describe("Inline markdown content for the command"),description:g().optional().describe("Command description override"),argumentHint:g().optional().describe('Hint for command arguments (e.g., "[file]")'),model:g().optional().describe("Default model for this command"),allowedTools:D(g()).optional().describe("Tools allowed when command runs")}).refine((e)=>e.source&&!e.content||!e.source&&e.content,{message:'Command must have either "source" (file path) or "content" (inline markdown), but not both'})),i7e=I(()=>C({commands:de([ZD().describe("Path to a command file or skill directory, relative to the plugin root. When set, the commands/ directory is not auto-loaded — list its files here if you want both."),D(ZD().describe("Path to a command file or skill directory, relative to the plugin root. When set, the commands/ directory is not auto-loaded — list its files here if you want both.")).describe("List of command file or skill directory paths. When set, the commands/ directory is not auto-loaded."),J(g(),s7e()).describe('Object mapping of command names to their metadata and source files. Command name becomes the slash command name (e.g., "about" → "/plugin:about")')])})),a7e=I(()=>C({agents:de([qD().describe("Path to an agent file, relative to the plugin root. When set, the agents/ directory is not auto-loaded — list its files here if you want both."),D(qD().describe("Path to an agent file, relative to the plugin root. When set, the agents/ directory is not auto-loaded — list its files here if you want both.")).describe("List of agent file paths. When set, the agents/ directory is not auto-loaded.")])})),c7e=I(()=>C({skills:de([JQ().describe('Path to a skill directory, relative to the plugin root ("." / "./" denote the plugin root itself). Loaded in addition to the skills/ directory (except: for a marketplace entry whose source resolves to the marketplace root, declaring a specific subdirectory replaces the skills/ scan).'),D(JQ().describe('Path to a skill directory, relative to the plugin root ("." / "./" denote the plugin root itself).')).describe("List of skill directory paths, loaded in addition to the skills/ directory (except: for a marketplace entry whose source resolves to the marketplace root, declaring specific subdirectories replaces the skills/ scan).")])})),l7e=I(()=>de([g(),D(g())])),aee=I(()=>C({outputStyles:de([us().describe("Path to an output-styles directory or file, relative to the plugin root. When set, the output-styles/ directory is not auto-loaded — list its files here if you want both."),D(us().describe("Path to an output-styles directory or file, relative to the plugin root. When set, the output-styles/ directory is not auto-loaded — list its files here if you want both.")).describe("List of output-style directory or file paths. When set, the output-styles/ directory is not auto-loaded.")])})),u7e=I(()=>g().max(64).regex(/^[a-z][a-z0-9_-]*$/,"must match ^[a-z][a-z0-9_-]*$")),d7e=16,p7e=I(()=>C({id:u7e(),remote:g().max(256).regex(/^(npm:[@a-z0-9/._-]+(@[a-z0-9._+-]+)?|github:[\w.-]+\/[\w.-]+@[\w./-]+#.+\.js)$/,"must be npm:<pkg>[@ver] or github:<owner>/<repo>@<ref>#<path>.js").optional(),integrity:g().max(512).regex(/^sha(256|384|512)-[A-Za-z0-9+/=]+$/,"must be SRI form: sha256-, sha384-, or sha512-<base64>").optional()}).strict()),f7e=I(()=>C({syntaxHighlighting:C({hljsLanguages:D(p7e()).max(d7e)}).strict()})),cee=I(()=>C({themes:de([us().describe("Path to a themes directory or file, relative to the plugin root. When set, the themes/ directory is not auto-loaded — list its files here if you want both."),D(us().describe("Path to a themes directory or file, relative to the plugin root. When set, the themes/ directory is not auto-loaded — list its files here if you want both.")).describe("List of theme directory or file paths. When set, the themes/ directory is not auto-loaded.")])})),m7e=I(()=>C({})),QQ=I(()=>g().min(1)),h7e=I(()=>g().min(2).refine((e)=>e.startsWith("."),{message:'File extensions must start with dot (e.g., ".ts", not "ts")'})),g7e=I(()=>C({mcpServers:de([Rc().describe("MCP servers to include in the plugin (in addition to those in the .mcp.json file, if it exists)"),XQ().describe("Path or URL to MCPB file containing MCP server configuration"),J(g(),wE()).describe("MCP server configurations keyed by server name"),D(de([Rc().describe("Path to MCP servers configuration file"),XQ().describe("Path or URL to MCPB file"),J(g(),wE()).describe("Inline MCP server configurations")])).describe("Array of MCP server configurations (paths, MCPB files, or inline definitions)")])})),lee=I(()=>C({type:V(["string","number","boolean","directory","file"]).describe("Type of the configuration value"),title:g().describe("Human-readable label shown in the config dialog"),description:g().describe("Help text shown beneath the field in the config dialog"),required:R().optional().describe("If true, validation fails when this field is empty"),default:de([g(),ee(),R(),D(g())]).optional().describe("Default value used when the user provides nothing"),multiple:R().optional().describe("For string type: allow an array of strings"),sensitive:R().optional().describe("If true, masks dialog input and stores value in secure storage (keychain/credentials file) instead of settings.json"),min:ee().optional().describe("Minimum value (number type only)"),max:ee().optional().describe("Maximum value (number type only)")}).strict()),_7e=I(()=>C({userConfig:J(g().regex(/^[A-Za-z_]\w*$/,"Option keys must be valid identifiers (letters, digits, underscore; no leading digit) — they become CLAUDE_PLUGIN_OPTION_<KEY> env vars in hooks"),lee()).optional().describe("User-configurable values this plugin needs. Prompted at enable time. Non-sensitive values saved to settings.json; sensitive values to secure storage. Available as ${user_config.KEY} in MCP/LSP server config, hook commands, and (non-sensitive only) skill/agent content. Keep sensitive value counts small.")})),y7e=I(()=>C({channels:D(C({server:g().min(1).describe("Name of the MCP server this channel binds to. Must match a key in this plugin's mcpServers."),displayName:g().optional().describe('Human-readable name shown in the config dialog title (e.g., "Telegram"). Defaults to the server name.'),userConfig:J(g(),lee()).optional().describe("Fields to prompt the user for when enabling this plugin in assistant mode. Saved values are substituted into ${user_config.KEY} references in the mcpServers env.")}).strict()).describe("Channels this plugin provides. Each entry declares an MCP server as a message channel and optionally specifies user configuration to prompt for at enable time.")})),eee=I(()=>$P({command:g().min(1).refine((e)=>{if(e.includes(" ")&&!e.startsWith("/"))return!1;return!0},{message:"Command should not contain spaces. Use args array for arguments."}).describe('Command to execute the LSP server (e.g., "typescript-language-server")'),args:D(QQ()).optional().describe("Command-line arguments to pass to the server"),extensionToLanguage:J(h7e(),QQ()).refine((e)=>Object.keys(e).length>0,{message:"extensionToLanguage must have at least one mapping"}).describe("Mapping from file extension to LSP language ID. File extensions and languages are derived from this mapping."),transport:V(["stdio","socket"]).default("stdio").describe("Communication transport mechanism"),env:J(g(),g()).optional().describe("Environment variables to set when starting the server"),initializationOptions:ke().optional().describe("Initialization options passed to the server during initialization"),settings:ke().optional().describe("Settings passed to the server via workspace/didChangeConfiguration"),workspaceFolder:g().optional().describe("Workspace folder path to use for the server"),startupTimeout:ee().int().positive().optional().describe("Maximum time to wait for server startup (milliseconds)"),shutdownTimeout:ee().int().positive().optional().describe("Maximum time to wait for graceful shutdown (milliseconds)"),restartOnCrash:R().optional().describe("Whether to restart the server if it crashes"),maxRestarts:ee().int().nonnegative().optional().describe("Maximum number of restart attempts before giving up"),diagnostics:R().optional().describe("Whether to push publishDiagnostics into the agent context after edits. Set to false to keep LSP navigation (goToDefinition, hover, etc.) but suppress automatic diagnostic injection. Defaults to true.")})),S7e=I(()=>$P({name:g().min(1).describe("Identifier for this monitor, unique within the plugin. Used to dedupe so re-arming (plugin reload, repeat skill invoke) does not spawn duplicates."),command:g().min(1).describe('Shell command to run as a persistent background monitor. Each stdout line is delivered to the model as a <task_notification> event; the process runs for the session lifetime. ${CLAUDE_PLUGIN_ROOT}, ${CLAUDE_PLUGIN_DATA}, ${CLAUDE_PROJECT_DIR}, ${user_config.*}, and ${ENV_VAR} are substituted. Runs in the session cwd — prefix with `cd "${CLAUDE_PLUGIN_ROOT}" && ` if the script needs its own directory.'),description:g().min(1).describe("Short human-readable description of what is being monitored (shown in task panel and notification summary)."),when:de([z("always"),g().startsWith("on-skill-invoke:").refine((e)=>e.length>16,{message:"on-skill-invoke: must specify a skill name"})]).default("always").describe('Arm trigger. "always" arms at session start and on plugin reload. "on-skill-invoke:<skill>" arms the first time that skill is dispatched (via Skill tool or slash command).')})),b7e=I(()=>D(S7e()).refine((e)=>new Set(e.map((t)=>t.name)).size===e.length,{message:"Monitor names must be unique within a plugin"})),uee=I(()=>C({monitors:de([Rc().describe("Path to a JSON file containing the monitors array, relative to the plugin root"),b7e()]).describe("Background watch scripts the host arms as persistent Monitor tasks (unsandboxed, same trust tier as hooks) so plugins need not instruct the model to arm them. When omitted, monitors/monitors.json at the plugin root is loaded if present.")})),E7e=I(()=>C({lspServers:de([Rc().describe("Path to .lsp.json configuration file relative to plugin root"),J(g(),eee()).describe("LSP server configurations keyed by server name"),D(de([Rc().describe("Path to LSP configuration file"),J(g(),eee()).describe("Inline LSP server configurations")])).describe("Array of LSP server configurations (paths or inline definitions)")])})),dee=I(()=>g().refine((e)=>!e.includes("..")&&!e.includes("//"),"Package name cannot contain path traversal patterns").refine((e)=>{let t=/^@[a-z0-9][a-z0-9-._]*\/[a-z0-9][a-z0-9-._]*$/,n=/^[a-z0-9][a-z0-9-._]*$/;return t.test(e)||n.test(e)},"Invalid npm package name format")),x7e=/^[a-z0-9](?:[a-z0-9._-]*[a-z0-9_-])?$/,v7e=/^[0-9a-f]{64}$/;var w7e=64;var A7e=I(()=>C({sha256:g().regex(v7e)}));function T7e(e){let t=J(g(),ke()).safeParse(e);if(!t.success)return;let n=Object.create(null),r=0;for(let[o,s]of Object.entries(t.data)){if(r>=w7e)break;let i=A7e().safeParse(s);if(x7e.test(o)&&i.success)n[o]=i.data,r++}return r>0?n:void 0}var C7e=I(()=>C({binaries:ke().transform(T7e).describe("sha256-pinned files to fetch into bin/ at install time, keyed by basename (target triple encoded in the name)")})),k7e=I(()=>C({settings:J(g(),ke()).optional().describe("Settings to merge into the user settings while this plugin is enabled. Only the documented allowlisted keys are applied.")})),R7e=I(()=>C({experimental:st((e)=>It(e)?e:void 0,C({...cee().partial().shape,...f7e().partial().shape,...uee().partial().shape,...aee().partial().shape,evals:l7e().optional().describe("Directory of eval cases for the plugin evaluation harness, relative to the plugin root (default: evals/). A list is accepted; its first entry is the case directory.")}).passthrough().optional().describe("Components whose manifest shape may change without a deprecation cycle. Move a key out of here once it is promoted to stable."))}));var O7e=I(()=>C({...n7e().shape,...o7e().partial().shape,...i7e().partial().shape,...a7e().partial().shape,...c7e().partial().shape,...aee().partial().shape,...cee().partial().shape,...m7e().shape,...y7e().partial().shape,...g7e().partial().shape,...E7e().partial().shape,...uee().partial().shape,...k7e().partial().shape,..._7e().partial().shape,...C7e().partial().shape,...R7e().partial().shape})),pee=new Set(["url","github","git","npm","file","directory","skills-dir","hostPattern","pathPattern","settings"]),Td=I(()=>dc("source",[C({source:z("url"),url:g().url().describe("Direct URL to marketplace.json file"),headers:J(g(),g()).optional().describe("Custom HTTP headers (e.g., for authentication)"),headersHelper:JD().optional().describe("Command that prints a JSON object of HTTP headers (e.g. a short-lived auth token). Its output overrides `headers` and, like `headers`, is inherited by same-origin archive downloads from this marketplace. Runs from a fixed directory (the Claude config home, never the session's), so give a bare command found via PATH or an absolute path; it is re-run on later refreshes of this marketplace.")}),C({source:z("github"),repo:g().describe('GitHub repository in owner/repo format. ONLY in the managed-settings policy lists (strictKnownMarketplaces / blockedMarketplaces) the owner-wildcard form "owner/*" matches every repository under exactly that owner. Everywhere else (marketplace add, extraKnownMarketplaces, known_marketplaces.json) the value '+"must name a single repository — a wildcard is taken literally and fails to clone."),ref:g().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:g().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:D(g()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.'),skipLfs:R().optional().describe("Skip Git LFS smudge during clone and update (sets GIT_LFS_SKIP_SMUDGE=1) so LFS pointer files stay as pointers instead of downloading their content. Use for marketplaces hosted in repos with large LFS objects.")}),C({source:z("git"),url:g().describe("Full git repository URL"),ref:g().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:g().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:D(g()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.'),skipLfs:R().optional().describe("Skip Git LFS smudge during clone and update (sets GIT_LFS_SKIP_SMUDGE=1) so LFS pointer files stay as pointers instead of downloading their content. Use for marketplaces hosted in repos with large LFS objects.")}),C({source:z("npm"),package:dee().describe("NPM package containing marketplace.json")}),C({source:z("file"),path:g().describe("Local file path to marketplace.json")}),C({source:z("directory"),path:g().describe("Local directory containing .claude-plugin/marketplace.json")}),C({source:z("skills-dir")}).describe("Policy-list sentinel for the ~/.claude/skills/ auto-load (@skills-dir plugins). In strictKnownMarketplaces: opt the scan back IN (by default any allowlist blocks it). In blockedMarketplaces: turn the scan OFF without otherwise restricting marketplaces. Only meaningful in those two managed-settings lists (areLocalPluginDirsAllowedByPolicy); known_marketplaces.json / marketplace add etc. ignore it."),C({source:z("hostPattern"),hostPattern:g().describe('Regex pattern to match the host/domain extracted from any marketplace source type. For github sources, matches against github.com. For git sources (SSH or HTTPS), extracts the hostname from the URL. Use in strictKnownMarketplaces to allow all marketplaces from a specific host (e.g., "^github\\.mycompany\\.com$").')}),C({source:z("pathPattern"),pathPattern:g().describe('Regex pattern matched against the .path field of file and directory sources. Use in strictKnownMarketplaces to allow filesystem-based marketplaces alongside hostPattern restrictions for network sources. Use ".*" to allow all filesystem paths, or a narrower pattern (e.g., "^/opt/approved/") to restrict to specific directories.')}),C({source:z("settings"),name:iee().refine((e)=>!oee.has(e.toLowerCase()),{message:"Reserved marketplace names cannot be used with settings sources. validateOfficialNameSource only accepts github/git sources from anthropics/* for these names; a settings source would be rejected after loadAndCacheMarketplace has already written to disk with cleanupNeeded=false."}).describe("Marketplace name. Must match the extraKnownMarketplaces key (enforced); the synthetic manifest is written under this name. Same validation "+"as PluginMarketplaceSchema plus reserved-name rejection — "+"validateOfficialNameSource runs after the disk write, too late to clean up."),plugins:D(N7e()).describe("Plugin entries declared inline in settings.json"),owner:XD().optional()}).describe("Inline marketplace manifest defined directly in settings.json. The reconciler writes a synthetic marketplace.json to the cache; diffMarketplaces detects edits via isEqual on the stored source (the plugins array is inside this object, so edits surface as sourceChanged).")])),VD=I(()=>g().length(40).regex(/^[a-f0-9]{40}$/,"Must be a full 40-character lowercase git commit SHA")),P7e=I(()=>g().regex(/^[0-9a-fA-F]{64}$/,"Must be a 64-character hex SHA-256 digest")),I7e="Archive URLs must use https:// and must not point at a loopback, link-local, or cloud-metadata host";function D7e(e){try{let t=new URL(e);return t.protocol==="https:"&&!$Q(t.hostname)}catch{return!1}}var L7e=I(()=>C({source:z("archive"),url:g().url().refine(D7e,{message:I7e}).describe("HTTPS URL of a zip archive containing the plugin. The plugin root (the directory holding .claude-plugin/) may be at the top of the archive "+"or nested one directory deep — a single wrapping directory is stripped."),sha256:P7e().optional().describe("SHA-256 digest of the archive. When set, every download is verified against it and the install is refused on mismatch. It also serves as the version identity when neither plugin.json nor the marketplace entry declares a `version`. Recommended. Note the update signal is the version string (plugin.json "+"version, else the entry version, else this digest) — changing only the digest "+"while a version is declared does not trigger an update.")}).describe("Plugin distributed as a zip archive fetched over HTTPS — for hosting on any "+"static file server or artifact repository (S3, GitLab, nginx) with no git or npm on the client. Authentication: the entry's own `headers` / `headersHelper` (bound to this URL), overlaid on the enclosing url-source marketplace's headers (static or `headersHelper`-minted) when the archive shares its origin.")),fee=I(()=>de([st((e)=>e==="."?"./":e,us()).describe("Path to the plugin root, relative to the marketplace root (the directory containing .claude-plugin/, not .claude-plugin/ itself)"),C({source:z("npm"),package:dee().or(g().refine((e)=>/^(?:file|https?|git(?:\+https?|\+ssh)?|ssh|github|gitlab|bitbucket):/i.test(e)||!e.includes(".."),'Package reference cannot contain ".." path segments')).describe("Package name (or url, or local path, or anything else that can be passed to `npm` as a package)"),version:g().optional().describe("Specific version or version range (e.g., ^1.0.0, ~2.1.0)"),registry:g().url().optional().describe("Custom NPM registry URL (defaults to using system default, likely npmjs.org)")}).describe("NPM package as plugin source"),C({source:z("url"),url:g().describe("Full git repository URL (https:// or git@)"),ref:g().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:VD().optional().describe("Specific commit SHA to use")}),C({source:z("github"),repo:g().describe("GitHub repository in owner/repo format"),ref:g().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:VD().optional().describe("Specific commit SHA to use")}),C({source:z("git-subdir"),url:g().describe("Git repository: GitHub owner/repo shorthand, https://, or git@ URL"),path:g().min(1).describe('Subdirectory within the repo containing the plugin (e.g., "tools/claude-plugin"). Cloned sparsely using partial clone (--filter=tree:0) to minimize bandwidth for monorepos.'),ref:g().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:VD().optional().describe("Specific commit SHA to use")}).describe("Plugin located in a subdirectory of a larger repository (monorepo). Only the specified subdirectory is materialized; the rest of the repo is not downloaded."),L7e(),C({source:z("command"),command:g().min(1).max(YD,{message:"command must not be longer than the install consent UI can display"}).refine((e)=>!ree.test(e),{message:"command must be printable ASCII (letters, digits, punctuation, single spaces) with no runs of 4 or more spaces"}).describe("Shell command that prints the absolute path of the plugin directory on stdout (exactly one line) and exits 0. It must leave a complete plugin in that directory before exiting; the directory is copied into the plugin cache, so the printed path may change between runs (it is re-resolved on every install and update, and once per session in the background). Runs through the platform shell (sh on macOS/Linux, cmd.exe on Windows) from the user's home directory with Claude Code's subprocess environment."),timeout:ee().int().positive().max(600).optional().describe("Seconds to wait for the command before giving up (default: 60)"),mode:V(["copy","link"]).optional().describe("copy (default): the printed directory is copied into the plugin cache and content-hashed, so it may be deleted afterwards. link: the cache entry links to the printed directory "+"in place (no copy, no size limit; macOS/Linux) — for large exports; the directory must then stay "+"valid while Claude Code runs, and a different printed path is what signals new content.")}).describe("Plugin directory produced by a locally installed tool (e.g. an IDE that renders its plugin for the currently selected SDK). Claude Code runs the command, copies the directory it prints, and re-runs it in the background at startup to pick up changes."),C({source:z("unsupported"),error:g().optional()}).describe("Placeholder for source types this Claude Code version does not recognize, or a known type whose fields failed validation (then `error` "+"holds the reason). Never authored by hand — PluginMarketplaceSchema rewrites "+"unparseable sources to this so the entry remains in marketplace.plugins (detectDelistedPlugins must not see it as removed). Install attempts fail at cachePlugin with an actionable message.")])),N7e=I(()=>C({name:AE().describe("Plugin name as it appears in the target repository"),source:fee().describe("Where to fetch the plugin from. Must be a remote source — relative "+"paths have no marketplace repository to resolve against."),description:g().optional(),version:g().optional(),strict:R().optional(),headers:J(g(),g()).optional().describe("HTTP headers sent when downloading this entry's `archive` source."),headersHelper:JD().optional().describe("Command that prints a JSON object of HTTP headers for downloading this entry's `archive` source. Runs only when a user explicitly installs or updates this plugin. Unlike a catalog entry, an entry written here does not need `strict: false`: it is declared in a settings file, which has no manifest fields to inline. A declaration in project settings is not operator-authored, so request-routing and client-identity header names are still filtered there. Use an absolute path.")}).refine((e)=>typeof e.source!=="string",{message:'Plugins in a settings-sourced marketplace must use remote sources (github, git-subdir, npm, url, archive, command). Relative-path sources like "./foo" have no marketplace repository to resolve against.'}).refine((e)=>typeof e.source==="string"||e.source.source!=="unsupported",{message:"source.source: 'unsupported' is a parse-time placeholder and cannot be authored. Use a remote source (github, git-subdir, npm, url, archive, command)."}));var M7e=I(()=>C({cli:D(g().max(64)).max(10).optional().describe('First command tokens (e.g. ["stripe"]) — exact match against commands run this session.'),hosts:D(g().max(128)).max(20).optional().describe('Hostnames (e.g. ["api.stripe.com"]) — exact, case-insensitive match against '+"hostnames seen in https?:// URLs in bash commands run this session. Bare hostname only: lowercase, no scheme, no port, no path."),filesRead:D(g().max(256)).max(10).optional().describe('Glob patterns (e.g. ["**/*.tf"]) — the plugin is relevant when a file Claude has read '+"this session matches any pattern. Matched against read-file paths, forward-slash normalized, case-insensitive."),manifestDeps:D(C({file:g().max(256),pattern:g().max(256)})).max(10).optional().describe("Dependency declared in a package manifest. Each {file, pattern} is a pair of RegExp sources: "+"`file` matches the manifest filename (package.json, go.mod, requirements.txt, …); "+"`pattern` matches the dependency declaration inside that file. Evaluated against files read this session."),cwd:D(g().max(256)).max(10).optional().describe('Glob patterns (e.g. ["Engine/Source/Runtime/Renderer/**"]) — the plugin is relevant when the '+`session's working directory is at or under a directory matching the pattern. Matched against the cwd both relative to the enclosing git repo root and as an absolute path, forward-slash normalized, case-insensitive. A bare directory (no glob characters) means "cwd is at or under this directory". Known at session start, so this signal can surface a suggestion before the first turn.`)})),U7e=I(()=>C({topic:g().max(64).optional().describe('What the user is working with when this plugin is relevant — fills "Working with {topic}?". '+'Often the product name (e.g. "Stripe"); use a domain (e.g. "design") when the plugin name does not read naturally as a topic. Defaults to the plugin name with each hyphen-segment capitalized.'),signals:M7e().optional().describe("Matchers that determine when the plugin is relevant.")})),F7e=I(()=>O7e().partial().extend({name:AE().describe("Unique identifier matching the plugin name"),source:fee().describe("Where to fetch the plugin from"),headers:J(g(),g()).optional().describe("Custom HTTP headers for fetching this plugin's archive; overrides the marketplace's"),headersHelper:JD().optional().describe("Command that prints a JSON object of HTTP headers for fetching this plugin's archive (e.g. a short-lived auth token); overrides this entry's `headers` and the marketplace's. Runs only when the user installs or updates this plugin, never during catalog browse. An entry that sets it must be `strict: false` with its manifest inlined here, so consent is informed from the entry alone before the command runs."),category:g().optional().describe('Category for organizing plugins (e.g., "productivity", "development")'),tags:D(g()).optional().describe("Tags for searchability and discovery"),strict:R().optional().default(!0).describe("Require the plugin manifest to be present in the plugin folder. If false, the marketplace entry provides the manifest."),relevance:st((e)=>It(e)?e:void 0,U7e().optional()).describe(`Declares when this plugin is relevant to the user's work. Consumed by the spinner tip ("Working with {topic}?"), session-start auto-suggest, and marketplace browse ranking.`)})),$7e=I(()=>C({name:AE()}));function z7e(e){let t=F7e();return e.flatMap((n,r)=>{let o=t.safeParse(n);if(o.success){let a=o.data.source;if(typeof a==="object"&&a.source==="unsupported"&&a.error!==void 0)return[{...o.data,source:{source:"unsupported"}}];return[o.data]}let s=$7e().safeParse(n).data?.name,i=o.error.issues.map((a)=>`${a.path.join(".")}: ${a.message}`).join(", ");if(s){ce(`Stubbing unparseable marketplace plugin entry (${s}): ${i}`,{level:"warn"});let a=mee(It(n)?n.source:void 0)?V7e:QD(n)?void 0:H7e(o.error.issues)??TE(o.error.issues);return[{name:s,source:{source:"unsupported",...a&&{error:a}},strict:!0}]}return ce(`Dropping unparseable marketplace plugin entry (index ${r}): ${i}`,{level:"warn"}),[]})}var j7e=new Set(["npm","url","github","git-subdir","archive","command","unsupported"]);function QD(e){if(!e||typeof e!=="object")return!1;let t=e.source;if(!t||typeof t!=="object")return!1;let n=t.source;return typeof n==="string"&&!j7e.has(n)}function H7e(e){let t=e.find((r)=>r.path.length===1&&r.path[0]==="source");if(!t||t.code!=="invalid_union")return;let n=t.errors.find((r)=>!r.some((o)=>o.path.length===0||o.code==="invalid_value"&&o.path[0]==="source"));if(!n||n.length===0)return;return TE(n.map((r)=>({...r,path:["source",...r.path]})))}var B7e=/^[A-Za-z0-9_$.-]{1,40}$/;function ra(e){return B7e.test(e)?e:"<key>"}var K7e=3,G7e=160;function TE(e){let t=e.slice(0,K7e).map((r)=>{let o=r.path.map(String).map((i)=>ra(i)).join("."),s=r.code==="unrecognized_keys"?`Unrecognized ${r.keys.length===1?"field":"fields"}: ${r.keys.map(ra).join(", ")}`:WD(r.message,G7e);return o?`${o}: ${s}`:s}),n=e.length-t.length;return n>0?`${t.join(", ")} (+${n} more)`:t.join(", ")}var W7e=/^[A-Za-z0-9][-A-Za-z0-9._]*$/,V7e='Bare source names resolve under metadata.pluginRoot, which this marketplace does not set (or sets to a path outside the marketplace root). Use a "./relative/path" source, or set metadata.pluginRoot to allow bare names.';function mee(e){return typeof e==="string"&&W7e.test(e)&&!e.includes("..")}function q7e(e){if(typeof e!=="string"||e===""||e.startsWith("/")||e.includes("\\")||e.includes(":"))return;let t=e.replace(/^\.\//,"").replace(/\/+$/,"");if(t===""||t===".")return".";if(t.split("/").some((n)=>n===""||n==="."||n===".."))return;return t}function Z7e(e,t){if(t===void 0||!It(e)||!mee(e.source))return e;let n=t==="."?`./${e.source}`:`./${t}/${e.source}`;return{...e,source:n}}function Y7e(e){if(!It(e)||!Array.isArray(e.plugins))return e;let t=It(e.metadata)?q7e(e.metadata.pluginRoot):void 0;if(t===void 0)return e;return{...e,plugins:e.plugins.map((n)=>Z7e(n,t))}}var J7e=I(()=>C({$schema:g().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:iee(),version:g().optional().describe("Marketplace manifest version"),description:g().optional().describe("Human-readable description of this marketplace"),owner:XD().describe("Marketplace maintainer or curator information"),plugins:D(ke()).transform(z7e).describe("Collection of available plugins in this marketplace"),forceRemoveDeletedPlugins:R().optional().describe("When true, plugins removed from this marketplace will be automatically uninstalled and flagged for users"),metadata:C({pluginRoot:g().optional().describe('Base directory for bare plugin source names, relative to the marketplace root (e.g. "./plugins" resolves "source": "formatter" as ./plugins/formatter). Sources that already start with "./" are unaffected.'),version:g().optional().describe("Marketplace version"),description:g().optional().describe("Marketplace description")}).optional().describe("Optional marketplace metadata"),allowCrossMarketplaceDependenciesOn:D(g()).optional().describe("Marketplace names whose plugins may be auto-installed as dependencies. Only the root marketplace's allowlist applies — no transitive trust."),renames:J(g(),g().nullable()).optional().catch(void 0).describe("Append-only map of old plugin name → current name (or null when removed). The loader follows this on plugin-not-found and migrates user settings to the new name.")})),Sqt=I(()=>st(Y7e,J7e())),tee="[A-Za-z0-9][-A-Za-z0-9._]*",hee=I(()=>g().regex(new RegExp(`^${tee}@${tee}$`),"Plugin ID must be in format: plugin@marketplace")),bqt=new RegExp(`[@:\\s/\\\\${Nu}]`,"u"),Eqt=new RegExp(`[${Nu}]`,"u"),gee=/[\p{Cc}\u200E\u200F\u202A-\u202E\u2066-\u2069]/u,X7e=/^[A-Za-z0-9][-A-Za-z0-9._]*(@[A-Za-z0-9][-A-Za-z0-9._]*)?(@\^[^@]*)?$/,Q7e=I(()=>de([g().regex(X7e,"Dependency must be a plugin name, optionally qualified with @marketplace").transform((e)=>e.replace(/@\^[^@]*$/,"")),C({name:g().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/),marketplace:g().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/).optional()}).loose().transform((e)=>e.marketplace?`${e.name}@${e.marketplace}`:e.name)])),eQe=I(()=>C({version:g().describe("Currently installed version"),installedAt:g().describe("ISO 8601 timestamp of installation"),lastUpdated:g().optional().describe("ISO 8601 timestamp of last update"),installPath:g().describe("Absolute path to the installed plugin directory"),gitCommitSha:g().optional().describe("Git commit SHA for git-based plugins (for version tracking)"),resolvedVersion:g().optional().describe("Tag-derived semver this install resolved to (when fetched via a version constraint). Used by verifyAndDemote in preference to manifest.version, since the upstream may have forgotten to bump plugin.json."),auto:R().optional().describe("True when this plugin was pulled in as a dependency rather than installed explicitly. Auto-installed plugins are eligible for removal by the orphan sweep when nothing depends on them. Absent = manual (preserves pre-flag installs)."),...nee()})),xqt=I(()=>C({version:z(1).describe("Schema version 1"),plugins:J(hee(),eQe()).describe("Map of plugin IDs to their installation metadata")})),tQe=I(()=>V(["managed","user","project","local"])),nQe=I(()=>C({scope:tQe().describe("Installation scope"),projectPath:g().optional().describe("Project path (required for project/local scopes)"),installPath:g().describe("Absolute path to the versioned plugin directory"),version:g().optional().describe("Currently installed version"),installedAt:g().optional().describe("ISO 8601 timestamp of installation"),lastUpdated:g().optional().describe("ISO 8601 timestamp of last update"),gitCommitSha:g().optional().describe("Git commit SHA for git-based plugins"),resolvedVersion:g().optional().describe("Tag-derived semver this install resolved to"),auto:R().optional().describe("True when pulled in as a dependency. Eligible for orphan sweep."),...nee()})),vqt=I(()=>C({version:z(2).describe("Schema version 2"),plugins:J(hee(),D(nQe())).describe("Map of plugin IDs to arrays of installation entries")})),rQe=I(()=>C({source:Td().describe("Where to fetch the marketplace from"),installLocation:g().describe("Local cache path where marketplace manifest is stored"),lastUpdated:g().describe("ISO 8601 timestamp of last marketplace refresh"),autoUpdate:R().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),wqt=I(()=>J(g(),rQe()));var CE=["aspell","hunspell","ispell"];var _ee=2147483647;var oQe=["autoMode","deepLink","voice","briefView","screenReader"],eL={},kE={autoMode:{buildGate:()=>!1,shape:()=>eL,permissionsShape:()=>eL,permissionModes:()=>[]},deepLink:{buildGate:()=>!0,shape:()=>({disableDeepLinkRegistration:V(["disable"]).optional().describe("Prevent claude-cli:// protocol handler registration with the OS")})},voice:{buildGate:()=>!0,shape:()=>({voiceEnabled:R().optional().describe("Enable voice mode (hold-to-talk dictation)")})},briefView:{buildGate:()=>!0,shape:()=>({defaultView:V(["chat","transcript"]).optional().describe("Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)")})},screenReader:{buildGate:()=>!1,shape:()=>eL}};function Mh(){return oQe.filter((e)=>kE[e].buildGate())}function yee(e){let t={};for(let n of e)t={...t,...kE[n].shape()};return t}function See(e){let t={};for(let n of e)t={...t,...kE[n].permissionsShape?.()};return t}function bee(e){let t=[];for(let n of e)t.push(...kE[n].permissionModes?.()??[]);return t}var Eee={Task:"Agent",KillShell:"TaskStop",KillBash:"TaskStop",AgentOutputTool:"TaskOutput",BashOutputTool:"TaskOutput",AgentOutput:"TaskOutput",BashOutput:"TaskOutput",ListPeers:"ListAgents",Brief:"SendUserMessage",ListMcpResources:"ListMcpResourcesTool",ReadMcpResource:"ReadMcpResourceTool",ReadMcpResourceDir:"ReadMcpResourceDirTool"};function Cd(e){return Object.hasOwn(Eee,e)?Eee[e]:e}var xee="workspace",Iqt=`mcp__${xee}__bash`,Dqt=`mcp__${xee}__web_fetch`;function RE(e){return e.includes("*")}function sQe(e){return e.replaceAll("\\","\\\\").replaceAll("(","\\(").replaceAll(")","\\)")}function iQe(e){return e.replaceAll("\\(","(").replaceAll("\\)",")").replaceAll("\\\\","\\")}function vee(e){let t=aQe(e,"(");if(t===-1)return{toolName:Cd(e)};let n=cQe(e,")");if(n===-1||n<=t)return{toolName:Cd(e)};if(n!==e.length-1)return{toolName:Cd(e)};let r=e.substring(0,t),o=e.substring(t+1,n);if(!r)return{toolName:Cd(e)};if(o===""||o==="*")return{toolName:Cd(r)};let s=iQe(o);return{toolName:Cd(r),ruleContent:s}}function OE(e){if(!e.ruleContent)return e.toolName;let t=sQe(e.ruleContent);return`${e.toolName}(${t})`}function aQe(e,t){for(let n=0;n<e.length;n++)if(e[n]===t){let r=0,o=n-1;while(o>=0&&e[o]==="\\")r++,o--;if(r%2===0)return n}return-1}function cQe(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t){let r=0,o=n-1;while(o>=0&&e[o]==="\\")r++,o--;if(r%2===0)return n}return-1}function tL(e){let t=e.split("__"),[n,r,...o]=t;if(n!=="mcp"||!r)return null;let s=o.length>0?o.join("__"):void 0;return{serverName:r,toolName:s}}var PE={filePatternTools:["Read","Write","Edit","Glob","NotebookRead","NotebookEdit","Cd"],bashPrefixTools:["Bash"],customValidation:{WebSearch:(e)=>{if(e.includes("*")||e.includes("?"))return{valid:!1,error:"WebSearch does not support wildcards",suggestion:"Use exact search terms without * or ?",examples:["WebSearch(claude ai)","WebSearch(typescript tutorial)"]};return{valid:!0}},WebFetch:(e)=>{if(e.includes("://")||e.startsWith("http"))return{valid:!1,error:"WebFetch permissions use domain format, not URLs",suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:github.com)"]};if(!e.startsWith("domain:"))return{valid:!1,error:'WebFetch permissions must use "domain:" prefix',suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:*.google.com)"]};return{valid:!0}}}};function wee(e){return PE.filePatternTools.includes(e)}function Aee(e){return PE.bashPrefixTools.includes(e)}function Tee(e){return Object.hasOwn(PE.customValidation,e)?PE.customValidation[e]:void 0}function rL(e,t){let n=0,r=t-1;while(r>=0&&e[r]==="\\")n++,r--;return n%2!==0}function nL(e,t){let n=0;for(let r=0;r<e.length;r++)if(e[r]===t&&!rL(e,r))n++;return n}function lQe(e){for(let t=0;t<e.length-1;t++)if(e[t]==="("&&e[t+1]===")"){if(!rL(e,t))return!0}return!1}var uQe=/^(?:[|&;<>]|\d+[<>])/;function dQe(e){return uQe.test(e)}function Cee(e){for(let t=0;t<e.length;t++)if(e[t]==="*"&&!rL(e,t))return!0;return!1}function pQe(e){if(e.endsWith(":*"))return;let t=e.trim().split(/\s+/).filter(Boolean),n=t[0];if(t.length<3||n===void 0||Cee(n))return;let r=!1;for(let o of t.slice(1)){if(dQe(o))return;if(Cee(o)){r=!0;continue}if(o.startsWith("-"))continue;return r?n:void 0}return}function kee(e){if(!RE(e))return null;let t=tL(e);if(t&&!RE(t.serverName))return null;return{valid:!1,error:`Wildcard tool name "${e}" is not supported in allow rules`,suggestion:"An allow pattern must name the scope it widens — globs are permitted only in the tool position after a literal mcp__<server>__ prefix. Deny and ask rules accept wildcards anywhere",examples:["mcp__puppeteer__*","mcp__github__get_*"]}}function oL(e,t){if(!e||e.trim()==="")return{valid:!1,error:"Permission rule cannot be empty"};let n=nL(e,"("),r=nL(e,")");if(n!==r)return{valid:!1,error:"Mismatched parentheses",suggestion:"Ensure all opening parentheses have matching closing parentheses"};if(lQe(e)){let a=e.substring(0,e.indexOf("("));if(!a)return{valid:!1,error:"Empty parentheses with no tool name",suggestion:"Specify a tool name before the parentheses"};return{valid:!1,error:"Empty parentheses",suggestion:`Either specify a pattern or use just "${a}" without parentheses`,examples:[`${a}`,`${a}(some-pattern)`]}}let o=vee(e),s=tL(o.toolName);if(s){if(o.ruleContent!==void 0||nL(e,"(")>0)return{valid:!1,error:"MCP rules do not support patterns in parentheses",suggestion:`Use "${o.toolName}" without parentheses, or use "mcp__${s.serverName}__*" for all tools`,examples:[`mcp__${s.serverName}`,`mcp__${s.serverName}__*`,s.toolName&&s.toolName!=="*"?`mcp__${s.serverName}__${s.toolName}`:void 0].filter(Boolean)};if(t==="allow"){let a=kee(o.toolName);if(a)return a}return{valid:!0}}if(!o.toolName||o.toolName.length===0)return{valid:!1,error:"Tool name cannot be empty"};if(t==="allow"){let a=kee(o.toolName);if(a)return a}if(!o.toolName.includes("_")&&o.toolName[0]!==o.toolName[0]?.toUpperCase())return{valid:!1,error:"Tool names must start with uppercase",suggestion:`Use "${Wd(String(o.toolName))}"`};let i=Tee(o.toolName);if(i&&o.ruleContent!==void 0){let a=i(o.ruleContent);if(!a.valid)return a}if(Aee(o.toolName)&&o.ruleContent!==void 0){let a=o.ruleContent;if(a.includes(":*")&&!a.endsWith(":*"))return{valid:!1,error:"The :* pattern must be at the end",suggestion:"Move :* to the end for prefix matching, or use * for wildcard matching",examples:["Bash(npm run:*) - prefix matching (legacy)","Bash(npm run *) - wildcard matching"]};if(a===":*")return{valid:!1,error:"Prefix cannot be empty before :*",suggestion:"Specify a command prefix before :*",examples:["Bash(npm *)","Bash(git *)"]};if(t==="allow"){let c=pQe(a);if(c!==void 0){let l=c==="git",u=l?" For git, options such as -c and --exec-path can run arbitrary commands.":"",p=l?" (for example Bash(git status *))":"";return{valid:!0,warning:`${OE(o)} has a wildcard before the rest of the command, so it also matches any options inserted at that position and approves them without a prompt.${u} Replace that * with the exact value you mean, or only use * after the subcommand${p}.`}}}}if(wee(o.toolName)&&o.ruleContent!==void 0){if(o.ruleContent.includes(":*"))return{valid:!1,error:'The ":*" syntax is only for Bash prefix rules',suggestion:'Use glob patterns like "*" or "**" for file matching',examples:[`${o.toolName}(*.ts) - matches .ts files`,`${o.toolName}(src/**) - matches all files in src`,`${o.toolName}(**/*.test.ts) - matches test files`]}}if(o.ruleContent!==void 0){let a=o.toolName==="Write"||o.toolName==="NotebookEdit"||o.toolName==="MultiEdit"?"Edit":o.toolName==="Glob"?"Read":void 0;if(a!==void 0&&!o.ruleContent.includes(":*"))return{valid:!0,warning:`${OE(o)} is not matched by file permission checks — only ${a}(path) rules are. Use ${OE({toolName:a,ruleContent:o.ruleContent})} instead (${a} rules cover all file-${a==="Edit"?"editing":"reading"} tools).`}}return{valid:!0}}var sL=I(()=>Oee()),Ree=I(()=>Oee("allow"));function Oee(e){return g().superRefine((t,n)=>{let r=oL(t,e);if(!r.valid){let o=r.error;if(r.suggestion)o+=`. ${r.suggestion}`;if(r.examples&&r.examples.length>0)o+=`. Examples: ${r.examples.join(", ")}`;n.addIssue({code:qr.custom,message:o,params:{received:t}})}})}var Uh=["accept","hold","refuse"],fQe=I(()=>J(g(),MS.string()));function $ee(e){return C({allow:D(Ree()).optional().describe("List of permission rules for allowed operations"),deny:D(sL()).optional().describe("List of permission rules for denied operations"),ask:D(sL()).optional().describe("List of permission rules that should always prompt for confirmation"),defaultMode:st(Ih,V([...wd,...bee(e)])).optional().describe("Default permission mode when Claude Code needs access ('manual' is accepted as an alias for 'default')"),disableBypassPermissionsMode:V(["disable"]).optional().describe("Disable the ability to bypass permission prompts"),blockReadsOutsideWorkingDirectories:R().optional().describe('Refuse file-tool reads (Read, Grep, Glob, LSP) outside the working directories in every permission mode; true in any settings source wins. Also set when the user picks "block" on the one-time auto-mode prompt for a read outside the working directories.'),...See(e),additionalDirectories:D(g()).optional().describe("Additional directories to include in the permission scope")}).passthrough()}var h4t=I(()=>$ee(Mh())),mQe=I(()=>de([g(),C({}).passthrough().describe('{ id: stable id (letters, digits, ".", "_", "-"; max 64), text: the tip (max 500 characters, one line), cooldownSessions?: sessions to wait before showing it again (default 0), priority?: tie-break weight among never-shown tips (default 0) }')])),hQe=I(()=>st((e)=>Array.isArray(e)?e.filter((t)=>typeof t==="string"||!!t&&typeof t==="object"&&!Array.isArray(t)):[],D(mQe()))),cL=I(()=>C({source:Td().describe("Where to fetch the marketplace from"),installLocation:g().optional().describe("Local cache path where marketplace manifest is stored (auto-generated if not provided)"),autoUpdate:R().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),lL=I(()=>{let e=()=>ee().min(0).max(1e4);return C({input:e(),output:e(),cacheRead:e(),cacheWrite:e()})}),uL=I(()=>ee().gt(0).lte(1).optional()),dL=I(()=>C({model:g().describe('Model to select, taken verbatim: an alias ("opus"), an Anthropic model ID, or a provider-format ID (Vertex, Bedrock, gateway). Same values --model accepts.'),label:g().optional().describe("Row title. Defaults to the model name."),description:g().optional().describe("Row subtitle. Defaults to a generic description."),behavesAs:g().optional().describe("For a model this version of Claude Code does not know: the ID of a model it does know "+'(e.g. "claude-opus-4-8") whose client-side handling — prompt profile, capability and effort '+"defaults — applies to it. Changes neither the row's label nor the model ID sent. Without it, "+"a model-catalog row for a model this version does not know is not offered until Claude Code is updated.")})),LE=I(()=>C({serverName:g().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that users are allowed to configure"),serverCommand:D(g()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for allowed stdio servers"),serverUrl:g().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers')}).refine((e)=>xf([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),NE=I(()=>C({serverName:g().min(1,"Server name must be non-empty").refine((e)=>e.trim().length>0,{message:"Server name must not be whitespace-only"}).refine((e)=>e===e.trim(),{message:"Server name has leading or trailing whitespace and will never match (names are compared verbatim)"}).optional().describe("Name of the MCP server that is explicitly blocked"),serverCommand:D(g()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for blocked stdio servers"),serverUrl:g().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers')}).refine((e)=>xf([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),gQe=/[\x00-\x1f\x7f-\x9f\u2028\u2029]|\p{DI}/u;function _Qe(e){let t=e.replaceAll("/","\\");if(rl(t))return!1;return/^\\{2}[^\\]/.test(t)}function yQe(e){return ua(e)||/^\/network\/servers(\/|$)/i.test(e)}function SQe(e){return/^\/(proc|dev\/(fd|stdin|stdout|stderr))(\/|$)/i.test(e)}function bQe(e,t,n={}){if(t==="win32"){let r=e.replaceAll("/","\\");if(rl(r))return!1;let o=_Qe(r);if(n.rejectUnc&&o)return!1;if(n.rejectDriveRelative){if(!/^[A-Za-z]:\\/.test(r)&&!o&&/^(\\|[A-Za-z]:)/.test(r))return!1}if(Fee.normalize(r)!==r)return!1;let s=r.split("\\");if(s.some((a)=>a==="."||a===".."))return!1;if(s.some((a,c)=>/[. ]$/.test(a)||a.includes(":")&&!(c===0&&/^[A-Za-z]:$/.test(a))))return!1;let i=r.startsWith("\\\\")?r.slice(2):r;if(/\\{2}/.test(i))return!1;return!r.endsWith("\\")||/^([A-Za-z]:)?\\$/.test(r)}if(n.rejectNetworkRoot&&yQe(e))return!1;if(n.rejectMagicLinkRoot&&SQe(e))return!1;if(Uee.normalize(e)!==e)return!1;if(e.split("/").some((r)=>r==="."||r===".."))return!1;if(/\/{2}/.test(e))return!1;return!e.endsWith("/")||e==="/"}var EQe=/\.(exe|ps1)$/i;function xQe(e){return/\.ps1$/i.test(e)}function vQe(e){return xQe(e)&&/[[\]`*?]/.test(e)}var wQe='a .ps1 path must not contain "[", "]", "`", "*", or "?" on Windows (PowerShell resolves them as wildcard syntax)',AQe=()=>g().describe("Absolute path to the helper executable"),kd=(e)=>st((t)=>t===null?void 0:t,e.optional()).optional(),TQe=_ee,Pee=(e)=>ee().int().min(e).transform((t)=>Math.min(t,TQe)),Iee=["path","script","defaultSettings"];function zee(e){if(!e||typeof e!=="object"||Array.isArray(e))return!1;let t=e;return Iee.some((n)=>t[n]===null)&&Iee.every((n)=>t[n]===null||t[n]===void 0)}var DE=I(()=>C({path:AQe(),timeoutMs:kd(Pee(1000)),refreshIntervalMs:kd(de([z(0),Pee(60000)]))})),jee=()=>V(["replace","merge"]).describe("How the helper's managedSettings compose with the settings of the source that delivered this entry: 'replace' (default) — the output is the policy; 'merge' — the output is deep-merged over that source's own settings the way merged managed sources compose (helper scalars win, arrays union, objects merge — except fallbackModel, forceLoginOrgUUID, sandbox.filesystem.allowRead, sandbox.credentials.awsPairs, sandbox.ripgrep and the restriction allowlists such as allowedMcpServers, availableModels and allowedHttpHookUrls, which are the helper's whole value when it emits one; tighten a permission with a deny), so a failed helper costs only the delta"),CQe=(e)=>(e==="windows"?z("pwsh",{message:"interpreter must be 'pwsh' on windows ('sh' is not supported there)"}):z("sh",{message:"interpreter must be 'sh' on macos/linux/wsl"})).describe("Fixed interpreter for `script`: 'sh' (/bin/sh) on macos/linux/wsl entries; 'pwsh' (PowerShell at its fixed install locations, never PATH) on the windows entry"),kQe="exactly one of path/script must be configured",RQe='"script" and "interpreter" must be configured together',OQe="script must be ASCII-only on Windows (PowerShell decodes stdin with the console OEM code page); spell non-ASCII characters as escapes, e.g. [char]0x00E9",PQe=(e)=>g({message:"script must be a string"}).min(1,{message:"script must not be empty"}).max(65536,{message:"script must be at most 65536 characters"}).refine((t)=>!t.includes("\x00"),{message:"script must not contain NUL bytes"}).refine((t)=>wg(t),{message:"script must be valid UTF-8 (no lone surrogates)"}).refine((t)=>e!=="windows"||!/[\u0080-\uffff]/.test(t),{message:OQe}).describe("Inline helper script, delivered to the fixed interpreter over stdin (never written to disk)");var ds=["macos","linux","windows","wsl"];function IQe(e){return e==="windows"?"win32":"posix"}function DQe(e){return{rejectDriveRelative:e==="windows",rejectUnc:e==="windows",rejectNetworkRoot:e!=="windows",rejectMagicLinkRoot:e!=="windows",requireWin32ExecutableSuffix:e==="windows"}}function LQe(e){let t=IQe(e),n=DQe(e);return g().max(1024,{message:"path must be at most 1024 characters"}).refine((r)=>!gQe.test(r),{message:"path must not contain control, line/paragraph-separator, or invisible (default-ignorable) characters"}).refine((r)=>(t==="win32"?Fee:Uee).isAbsolute(r),{message:"path must be absolute"}).refine((r)=>!(t==="win32"&&n.requireWin32ExecutableSuffix)||EQe.test(r),{message:"path must end in .exe or .ps1 on Windows"}).refine((r)=>t!=="win32"||!vQe(r),{message:wQe}).refine((r)=>bQe(r,t,n),{message:t==="win32"?'path must be in normalized form: no "." or ".." segments, no doubled or trailing separators, no component ending in "." or a space, no ":" outside the drive letter, no device-namespace (\\\\?\\) prefix, no drive-relative (\\dir or C:name) or UNC (\\\\server\\share) form':'path must be in normalized form: no "." or ".." segments, no doubled or trailing separators, and not under a network automount root (/net/<host>, /Network/Servers) or a kernel magic-link root (/proc, /dev/fd)'}).describe("Absolute path to the helper executable")}var pL=[...ds,"default"],iL=["path","script","interpreter","outputBehavior","timeoutMs","refreshIntervalMs","defaultSettings"],IE=["managedSettings","appendSystemPrompt"],Oc=I(()=>J(g(),ke()).superRefine((e,t)=>{for(let n of["policyHelper","policyHelpers"])if(e[n]!==void 0&&e[n]!==null)t.addIssue({code:"custom",message:`must not contain "${n}" — the default payload is applied as managed settings and cannot configure further policy helpers`});for(let n of iL)if(e[n]!==void 0&&e[n]!==null)t.addIssue({code:"custom",message:`must not contain "${n}" — a static payload is a managed-settings object, not a policyHelpers entry; entry fields (${iL.join("/")}) belong on the per-OS entries (policyHelpers.${ds.join("/")})`});for(let n of IE)if(e[n]!==void 0&&e[n]!==null)t.addIssue({code:"custom",message:`must not contain "${n}" — a static payload is the managedSettings SUBTREE, not the helper's stdout envelope; paste the object your helper emits UNDER "managedSettings", not the envelope around it`});for(let n of pL)if(e[n]!==void 0&&e[n]!==null)t.addIssue({code:"custom",message:`must not contain "${n}" — a static payload is the VALUE of a policyHelpers key (a managed-settings object), never another policyHelpers map; don't paste the map or its "${n}" line inside the slot`})})),NQe='Entry must carry "path" (a helper executable) or "script" + "interpreter" (an inline helper), and/or "defaultSettings" (a static settings payload)';function MQe(e){let{path:t,script:n,interpreter:r,defaultSettings:o}=e;if(t!==void 0&&n!==void 0)return kQe;if(n===void 0!==(r===void 0))return RQe;if(t===void 0&&n===void 0&&o===void 0)return NQe;return null}function Hee(e,t){return DE().omit({path:!0}).extend({path:kd(LQe(e)),script:kd(PQe(e)),interpreter:kd(CQe(e)),outputBehavior:kd(jee()),defaultSettings:st((n)=>n===null?void 0:n,t.optional()).optional()}).check((n)=>{if(n.issues.length>0)return;let r=MQe(n.value);if(r!==null)n.issues.push({code:"custom",message:r,input:n.value})})}var g4t=I(()=>Hee("linux",Oc()));function aL(e,t=Oc()){return e==="default"?Oc():Hee(e,t)}var UQe=I(()=>C(Object.fromEntries(pL.map((e)=>[e,st((t)=>{if(t===null)return;if(e!=="default"&&zee(t))return;return t},aL(e).optional()).optional()])))),Dee=["skills","agents","hooks","mcp"],Lee=Object.freeze({type:"invalid-entry-stripped"}),FQe=I(()=>de([C({type:z("regex").describe('Config variant. This client understands "regex": matches turn output and builds a URL from named capture groups. Entries with other variants are preserved but skipped at runtime.'),pattern:g().describe("Regex matched against turn output (tool results and assistant text)"),url:g().describe("Link target. {name} placeholders are filled from named regex capture groups, e.g. (?<id>...) -> {id}. Values are URL-encoded; the origin must be literal in the template. The scheme must be https, http, or a recognized editor or workspace deep-link scheme: vscode, vscode-insiders, cursor, windsurf, zed, jetbrains, idea, slack, linear, notion, figma."),label:g().optional().describe("Badge text. {name} placeholders filled from named capture groups; defaults to the full match.")}).passthrough(),C({type:g().describe("Config variant discriminator for entries this client does not understand; the entry is preserved as-is and skipped at runtime.")}).passthrough()])),$Qe=()=>ee().int().min(LQ).max(NQ).optional().catch(void 0);function ME(e,{strictPolicyHelperKeys:t=!1}={}){function n(o){return J(g(),cL()).check((s)=>{for(let[i,a]of Object.entries(s.value))if(a.source.source==="settings"&&a.source.name!==i)s.issues.push({code:"custom",input:a.source.name,path:[i,"source","name"],message:`Settings-sourced marketplace name must match its ${o} key (got key "${i}" but source.name "${a.source.name}")`})})}let r=(o,s)=>t?st((i)=>{if(i===null)return;return s?s(i):i},o):o.catch(void 0);return C({$schema:g().optional().describe("JSON Schema reference for Claude Code settings"),apiKeyHelper:g().optional().describe("Path to a script that outputs authentication values"),proxyAuthHelper:g().optional().describe("Shell command that outputs a Proxy-Authorization header value (EAP)"),awsCredentialExport:g().optional().describe("Path to a script that exports AWS credentials"),awsAuthRefresh:g().optional().describe("Path to a script that refreshes AWS authentication"),gcpAuthRefresh:g().optional().describe("Command to refresh GCP authentication (e.g., gcloud auth application-default login)"),processWrapper:g().optional().describe("Corporate launcher argv prefix for the background-agent supervisor, the sessions and workers it hosts, and the other covered background processes listed in the Claude Code corporate-launcher documentation. Equivalent to the CLAUDE_CODE_PROCESS_WRAPPER environment variable, which takes precedence when set. Honored from managed settings, a --settings/SDK-supplied settings file, and user settings, in that precedence order; project and local settings are ignored."),policyHelper:r(DE().optional(),(o)=>o&&typeof o==="object"&&!Array.isArray(o)&&o.path===null?void 0:o).describe("Executable that computes managed settings at startup. Honored only from admin-controlled policy sources."),policyHelpers:r(UQe().optional()).describe(`@internal Per-OS variant of policyHelper, keyed by platform: macos, linux, windows, wsl, plus an optional "default" entry that is a STATIC settings payload (a JSON object of managed settings, not a helper). Each per-OS entry carries a helper — a "path", or an inline "script" + "interpreter" delivered to a fixed interpreter over stdin, either with timeoutMs/refreshIntervalMs — its own static "defaultSettings" payload, or both; an entry may be payload-only. Selection for a platform walks its chain (the platform's own entry; on wsl the linux entry next): the first helper on the chain wins over policyHelper; if no helper is configured — or the selected helper fails at startup or refresh — the first payload applies (the chain's "defaultSettings" in platform-specific-first order, then the top-level "default", applied with no process spawned; unrecognized platforms reach only "default"); with no payload either, policyHelper. Honored only from admin-controlled policy sources.`),...Mn.CLAUDE_CODE_ENABLE_XAA&&{xaaIdp:C({issuer:g().url().describe("IdP issuer URL for OIDC discovery"),clientId:g().describe("Claude Code's client_id registered at the IdP"),callbackPort:ee().int().positive().optional().describe("Fixed loopback callback port for the IdP OIDC login. Only needed if the IdP does not honor RFC 8252 port-any matching.")}).optional().describe("XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.")},fileSuggestion:C({type:z("command"),command:g()}).optional().describe("Custom file suggestion configuration for @ mentions"),respectGitignore:R().optional().describe("Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected."),breakReminder:C({enabled:R().optional().describe("Show a friendly nudge after sustained continuous use (default false). Must be true for the reminder to fire."),intervalMinutes:ee().int().positive().optional().describe("Minutes of continuous use before the reminder fires (default 30). Re-fires every interval until you take a break."),breakThresholdMinutes:ee().int().positive().optional().describe("Minutes of inactivity that count as a break and reset the timer (default 10)"),message:g().optional().describe("Custom reminder text. Leave unset for a rotating set of friendly nudges.")}).optional().describe("@internal Opt-in break reminder. When enabled, shows a dismissible nudge after sustained continuous use. Never blocks — just a friendly heads-up."),quietHours:C({enabled:R().optional().describe("Show a one-time nudge when you start or keep using the CLI inside your quiet-hours window (default false)."),start:g().regex(/^([01]?\d|2[0-3]):[0-5]\d$/,'Expected 24-hour local time "HH:MM" (e.g. "22:00")').optional().describe('Start of the quiet-hours window, 24-hour local time "HH:MM".'),end:g().regex(/^([01]?\d|2[0-3]):[0-5]\d$/,'Expected 24-hour local time "HH:MM" (e.g. "07:00")').optional().describe('End of the quiet-hours window, 24-hour local time "HH:MM". May be earlier than start for an overnight range.')}).optional().describe("@internal Opt-in quiet hours. When enabled, shows a single soft nudge per session while inside the configured local-time window. Never blocks."),cleanupPeriodDays:ee().int().positive().optional().describe("Number of days to retain chat transcripts before automatic cleanup (default: 30). Minimum 1. Use a large value for long retention; use --no-session-persistence to disable transcript writes entirely."),desktopSessionCleanupPeriodDays:ee().int().nonnegative().optional().describe("Retention ceiling in days for session transcripts created or last written by a desktop-host surface (Claude Desktop, Cowork), which are otherwise exempt from the cleanupPeriodDays sweep. 0 (the default) means no ceiling: such transcripts are kept until deleted another way. Unlike cleanupPeriodDays, 0 is allowed because this setting never disables writes — it only bounds an exemption from deletion. The ceiling is a hard cap: it also bounds an active archive grace, so the grace window of a release marker never keeps files past the ceiling. Ignored when cleanupPeriodDays is managed by org policy. A ceiling at or below cleanupPeriodDays effectively disables the exemption: those transcripts age out on the regular cleanupPeriodDays schedule, so the effective retention is whichever of the two periods is longer."),syncClaudeAiSkills:R().optional().describe("Set to false to turn off syncing of the skills you have enabled on claude.ai. In your user settings (or managed settings): nothing more is downloaded, previously synced skills (~/.claude/skills/synced) can no longer be run, are hidden from every session started afterwards, and are moved to ~/.claude/skills/.trash at the next launch (deleted after cleanupPeriodDays; re-downloaded, not restored, if you re-enable). In .claude/settings.local.json or --settings: downloads stop and synced skills are blocked and hidden for sessions in that workspace or invocation only (nothing is moved). Not read from project settings (.claude/settings.json). Only false is honored — the feature is enabled server-side for your account, so setting true does not turn it on early. While it is on, synced skills are available in every session, re-synced every 10 minutes, and removed when you disable them on claude.ai. Only applies when signed in with your Claude account."),syncClaudeAiPlugins:R().optional().describe("Set to false to turn off syncing of the plugins you have enabled on claude.ai. In your user settings (or managed settings): nothing more is downloaded, previously synced plugins (~/.claude/plugins/synced) are hidden from every session started afterwards and moved to ~/.claude/plugins/.trash at the next launch (deleted after cleanupPeriodDays; re-downloaded, not restored, if you re-enable). In .claude/settings.local.json or --settings: downloads stop and synced plugins are hidden for sessions in that workspace or invocation only (nothing is moved). Not read from project settings (.claude/settings.json). Only false is honored — the feature is enabled server-side for your account, so setting true does not turn it on early. While it is on, synced plugins load in every session like plugins you installed yourself (a plugin you installed with the same name takes precedence), are re-synced at each launch, and are removed when you disable them on claude.ai. Only applies when signed in with your Claude account."),skillListingMaxDescChars:ee().int().positive().optional().describe("Per-skill description character cap in the skill listing sent to Claude (default: 1536). Descriptions longer than this are truncated. Raise to opt in to higher per-turn context cost."),skillListingBudgetFraction:ee().gt(0).lte(1).optional().describe("Fraction of the context window (in characters) reserved for the skill listing sent to Claude (default: 0.01 = 1%). When the listing exceeds this, descriptions are shortened to fit. Raise to opt in to higher per-turn context cost."),wslInheritsWindowsSettings:R().optional().describe("When set to true in either admin-only Windows source — the HKLM SOFTWARE/Policies/ClaudeCode registry key or C:/Program Files/ClaudeCode/managed-settings.json — WSL reads managed settings from the full Windows policy chain (HKLM, C:/Program Files/ClaudeCode via DrvFs, HKCU) in addition to /etc/claude-code. Windows sources take priority. The flag is also required in HKCU itself for HKCU policy to apply on WSL (double opt-in: admin enables the chain, user confirms HKCU). On native Windows the flag has no effect."),env:fQe().optional().describe("Environment variables to set for Claude Code sessions"),attribution:C({commit:g().optional().describe("Attribution text for git commits, including any trailers. Empty string hides attribution."),pr:g().optional().describe("Attribution text for pull request descriptions. Empty string hides attribution."),sessionUrl:R().optional().describe("Whether to append the claude.ai session link to commits and PRs created from web or Remote Control sessions (default: true). Set to false to omit the Claude-Session trailer and PR-body link."),...!1}).passthrough().optional().describe("Customize attribution text for commits and PRs. Each field defaults to the standard Claude Code attribution if not set."),includeCoAuthoredBy:R().optional().describe("Deprecated: Use attribution instead. Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)"),...!1,...!1,includeGitInstructions:R().optional().describe("Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)"),permissions:$ee(e).optional().describe("Tool usage permissions configuration"),model:g().optional().describe("Override the default model used by Claude Code"),fallbackModel:D(g()).optional().describe('Fallback model(s) tried in order when the primary model is overloaded or unavailable. Each element accepts a model name or alias; "default" expands to the default model. CLI --fallback-model takes precedence.'),availableModels:D(g()).optional().describe('Allowlist of models that users can select. Accepts family aliases ("opus" allows any opus version), version prefixes ("opus-4-5" allows only that version), and full model IDs. If undefined, all models are available. If empty array, only the default model is available. Typically set in managed settings by enterprise administrators.'),enforceAvailableModels:R().optional().describe("When true and availableModels is a non-empty array, the Default model selection is also constrained: if the default model for the user tier is not in availableModels, Default resolves to the first allowed availableModels entry instead. Has no effect when availableModels is unset or an empty array. Typically set in managed settings by enterprise administrators."),modelOverrides:J(g(),g()).optional().describe('Override mapping from Anthropic model ID (e.g. "claude-opus-4-6") to provider-specific model ID (e.g. a Bedrock inference profile ARN). Typically set in managed settings by enterprise administrators.'),modelPicker:C({options:D(dL()).describe("Rows to show in the /model picker, in order."),replaceBuiltInOptions:R().optional().describe("When true, the picker shows only the Default row and these options — the built-in "+"lineup, gateway-discovered models and ANTHROPIC_CUSTOM_MODEL_OPTION are hidden. When false or unset, these options are added after the built-in lineup.")}).optional().describe("Curate the /model picker: an ordered list of models with your own labels, independent of the built-in lineup and of Claude Code releases. availableModels still applies to these rows. Honored from managed, --settings/SDK, and user settings only (not from a project checkout); the highest-precedence of those that defines modelPicker wins outright (no merging across sources). Typically set in managed settings by enterprise administrators."),modelPricing:C({multiplier:uL(),overrides:J(g(),lL()).optional()}).optional().describe("Price usage at your organization's contracted rates instead of list price. "+"Affects every spend figure Claude Code reports — /cost, the status line, the SDK total_cost_usd, "+"--max-budget-usd, and the OpenTelemetry cost metric and events — which remain USD estimates, not an invoice "+'(the per-Mtok price labels in /model stay at list). "overrides" maps a model ID to its USD-per-million-token rates (input, output, cacheRead, '+"cacheWrite — all four required, each 0 to 10000; cacheWrite prices both 5-minute and 1-hour cache writes). "+"A matching row is charged exactly as written; fast-mode and US-data-residency surcharges are not added on top. "+'A key Claude Code itself uses for a built-in model — its ID such as "claude-sonnet-4-6", or its '+"first-party, Bedrock (any or no region prefix), Vertex or Foundry ID — covers every dated and provider form "+"of that model; any other key — a gateway model alias, or a spelling Claude Code does not itself use — "+'matches that model ID only (case-insensitive), and such an exact match wins over a built-in row. On Bedrock an application inference profile is matched by its backing model. An invalid row or multiplier is reported and skipped; the rest still apply. "multiplier" in (0, 1] scales every computed cost, overridden or not (0.85 = 85% of the price). Only honored from managed settings (server-managed, MDM / OS policy, or managed-settings.json), '+"or — when none of those sets it — when supplied by a host application that manages the model "+"provider; ignored in user, project, local and --settings sources."),...!1,enableAllProjectMcpServers:R().optional().describe("Whether to automatically approve all MCP servers in the project"),enabledMcpjsonServers:D(g()).optional().describe("List of approved MCP servers from .mcp.json"),disabledMcpjsonServers:D(g()).optional().describe("List of rejected MCP servers from .mcp.json"),disableClaudeAiConnectors:R().optional().describe("When true in any settings source, claude.ai MCP cloud connectors are not auto-fetched or connected. "+"Only gates auto-fetched connectors — a claudeai-proxy server passed explicitly "+"(e.g. via --mcp-config or the SDK mcpServers option) still follows the normal MCP config trust flow. Any-source-true wins: a project can opt out, but a project-level false cannot override a user-level true."),skillOverrides:J(g(),V(["on","name-only","user-invocable-only","off"])).optional().describe('Per-skill listing overrides keyed by skill name. "name-only" lists the skill without its description; "user-invocable-only" hides it from the model but keeps /name; "off" hides it from both. Absent = on.'),disableBundledSkills:R().optional().describe("Disable the skills and workflows that ship with Claude Code: bundled skills and workflows are removed entirely; built-in slash commands stay typable but are hidden from the model. Plugins, .claude/skills/, and .claude/commands/ are unaffected. Equivalent to CLAUDE_CODE_DISABLE_BUNDLED_SKILLS=1."),allowedMcpServers:D(LE()).optional().describe("Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied."),deniedMcpServers:D(NE()).optional().describe("Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied."),hooks:Cc().optional().describe("Custom commands to run before/after tool executions"),worktree:C({symlinkDirectories:D(g()).optional().describe('Directories to symlink from main repository to worktrees to avoid disk bloat. Must be explicitly configured - no directories are symlinked by default. Common examples: "node_modules", ".cache", ".bin"'),sparsePaths:D(g()).optional().describe("Directories to include when creating worktrees, via git sparse-checkout (cone mode). "+"Dramatically faster in large monorepos — only the listed paths are written to disk."),baseRef:V(["fresh","head"]).optional().describe("Which ref new worktrees branch from. 'fresh' (default) branches from origin/<default-branch> for a clean tree. 'head' branches from your current local HEAD so unpushed commits and feature-branch state are present. Applies to --worktree, EnterWorktree, and agent isolation."),bgIsolation:V(["worktree","none"]).optional().catch(void 0).describe("Isolation mode for background sessions in this repo. 'worktree' (default) blocks Edit/Write in the main checkout until EnterWorktree is called. 'none' lets background jobs edit the working copy directly."),location:g().optional().catch(void 0).describe("Directory under which Claude Code Desktop creates the worktrees of SSH sessions that run on this machine (an absolute path or one starting with ~/), instead of <project>/.claude/worktrees. Read by the desktop app from the SSH host user settings; a location chosen in the desktop app's SSH connection settings takes precedence. The CLI (--worktree, EnterWorktree, agent isolation) does not read it yet.")}).optional().describe("Git worktree configuration: the CLI --worktree flag, EnterWorktree and agent isolation, plus the location Claude Code Desktop uses for SSH-session worktrees on this machine."),disableAllHooks:R().optional().describe("Disable all hooks and statusLine execution"),disableAgentView:R().optional().describe("Disable agent view (`claude agents`, `--bg`, /background, the on-demand daemon). Typically set in managed settings. Equivalent to CLAUDE_CODE_DISABLE_AGENT_VIEW=1."),disableRemoteControl:R().optional().describe("Disable Remote Control (claude.ai/code, `claude remote-control`, `--remote-control`/`--rc`, auto-start, and the in-session toggle). Typically set in managed settings."),disableWorkflows:R().optional().describe("Disable the Workflows feature (also via CLAUDE_CODE_DISABLE_WORKFLOWS)."),disableArtifact:R().optional().describe("Deprecated: use enableArtifact: false. Still honored — true disables the Artifact tool; false is ignored."),enableArtifact:R().optional().describe("Turn the Artifact tool on or off. Off in any of managed, --settings, or user settings wins; project and local settings can only turn it off. Unset defaults to on once the feature is available."),enableWorkflows:R().optional().describe("Enable or disable the Workflows feature for this user. Unset = default by plan once the feature is available."),workflowSizeGuideline:V(["unrestricted","small","medium","large"]).optional().describe('Advisory size guideline for the dynamic workflows Claude writes: "small" aims for fewer than 5 agents, "medium" (the default) fewer than 15, "large" fewer than 50, and "unrestricted" sends no guideline. A value here — including from managed settings — takes precedence over the "Dynamic workflow size" choice in /config, and that /config row is hidden while a settings file provides the key. This is a guideline, not an enforced limit.'),workflowKeywordTriggerEnabled:R().optional().describe('Enable the "ultracode" keyword trigger: including the keyword in a prompt opts that turn into the Workflow tool. Set to false to disable the trigger. Default: true.'),disableSkillShellExecution:R().optional().describe("Disable inline shell execution in skills and custom slash commands from user, project, or plugin sources. Commands are replaced with a placeholder instead of being run."),defaultShell:V(["bash","powershell"]).optional().describe("Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip)."),respondToBashCommands:R().optional().describe("Whether Claude responds after an input-box ! bash command runs. Set to false to add the command output to context without a response. Default: true."),allowManagedHooksOnly:R().optional().describe("When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored."),allowedHttpHookUrls:D(g()).optional().describe('Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard (e.g. "https://hooks.example.com/*"). When set, HTTP hooks with non-matching URLs are blocked. If undefined, all URLs are allowed. If empty array, no HTTP hooks are allowed. Arrays merge across settings sources (same semantics as allowedMcpServers).'),httpHookAllowedEnvVars:D(g()).optional().describe("Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. If undefined, no restriction is applied. Arrays merge across settings sources (same semantics as allowedMcpServers)."),allowManagedPermissionRulesOnly:R().optional().describe("When true (and set in managed settings), permission rules from user, project, local, and --settings files and allow rules from --allowedTools are ignored; only managed settings can add allow rules through settings. --disallowedTools and other deny and ask rules from the command line or the current session still apply."),allowManagedMcpServersOnly:R().optional().describe("When true (and set in managed settings), allowedMcpServers is only read from managed settings. deniedMcpServers still merges from all sources, so users can deny servers for themselves. Users can still add their own MCP servers, but only the admin-defined allowlist applies."),allowAllClaudeAiMcps:R().optional().describe("When true (and set in managed settings), claude.ai cloud MCP connectors load alongside managed-mcp.json instead of being suppressed by its exclusive-control lockdown. Default off preserves the lockdown. Read from managed settings only."),strictPluginOnlyCustomization:st((o)=>Array.isArray(o)?o.filter((s)=>Dee.includes(s)):o,de([R(),D(V(Dee))])).optional().catch(void 0).describe('When set in managed settings, blocks non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g. ["skills", "hooks"]); `true` locks all four; `false` is an explicit no-op. Blocked: ~/.claude/{surface}/, .claude/{surface}/ (project), settings.json hooks, .mcp.json. NOT blocked: managed (policySettings) sources, plugin-provided customizations. '+"Composes with strictKnownMarketplaces for end-to-end admin control — plugins gated by "+"marketplace allowlist, everything else blocked here."),statusLine:C({type:z("command"),command:g(),padding:ee().optional(),refreshInterval:ee().min(1).optional().catch(void 0).describe("Re-run the status line command every N seconds in addition to event-driven updates"),hideVimModeIndicator:R().optional().describe("Hide the built-in `-- INSERT --` / `-- VISUAL --` indicator below the prompt. Use this when your status line script renders `vim.mode` itself.")}).optional().describe("Custom status line display configuration"),prUrlTemplate:g().optional().describe('URL template for PR links in the footer link badges and inline messages. The detected git PR is rendered as the first footer-link badge. Placeholders: {host} {owner} {repo} {number} {url}. Example: "https://reviews.example.com/{owner}/{repo}/pull/{number}"'),footerLinksRegexes:D(FQe().catch(Lee)).transform((o)=>o.filter((s)=>s!==Lee)).optional().catch(void 0).describe("Extra clickable footer badges that appear when a regex matches turn output (tool results and assistant responses). Read from user, flag, and managed settings only; ignored in project .claude/settings.json and local .claude/settings.local.json. At most 5 badges render; the oldest is displaced by newer matches and /clear removes them. Use to surface IDs printed by project CLIs as session links."),subagentStatusLine:C({type:z("command"),command:g()}).optional().describe("Custom per-subagent status line shown in the agent panel; receives row context as JSON on stdin"),enabledPlugins:J(g(),de([D(g()),R(),UP()])).optional().describe('Enabled plugins using plugin-id@marketplace-id format. Example: { "formatter@anthropic-tools": true }. Also supports extended format with version constraints. Settings precedence is user < project < local < flag < policy, so to disable a plugin that project settings enable, set it to false in .claude/settings.local.json — setting false in ~/.claude/settings.json is overridden by the project.'),extraKnownMarketplaces:n("extraKnownMarketplaces").optional().describe("Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources."),additionalMarketplaces:n("additionalMarketplaces").optional().describe("Alias for extraKnownMarketplaces: this key is read exactly as if it were spelled "+"extraKnownMarketplaces. Do not set both in one file — if both appear, this key is ignored "+"with a warning. Claude Code may rewrite this key as extraKnownMarketplaces when it updates the file. Clients older than this alias ignore it, so prefer extraKnownMarketplaces while older Claude Code versions still share the same settings."),strictKnownMarketplaces:D(Td()).optional().describe('Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these sources can be added as marketplaces. Entries match exactly, except that a github entry may use the owner-wildcard form {"source":"github","repo":"owner/*"} to allow every repository under that owner. The check happens BEFORE downloading, so blocked sources never touch the filesystem. '+"Note: this is a policy gate only — it does NOT register marketplaces. "+"To pre-register allowed marketplaces for users, also set extraKnownMarketplaces."),allowedMarketplaces:D(Td()).optional().describe("Alias for strictKnownMarketplaces (managed settings only): this key is read exactly as if it "+"were spelled strictKnownMarketplaces. Do not set both in one file — if both appear, this key "+"is ignored with a warning. Clients older than this alias ignore it, so keep using strictKnownMarketplaces when the allowlist must also bind older Claude Code versions."),blockedMarketplaces:D(Td()).optional().describe('Enterprise blocklist of marketplace sources. When set in managed settings, these sources are blocked from being added as marketplaces. Entries match exactly, except that a github entry may use the owner-wildcard form {"source":"github","repo":"owner/*"} to block every repository under that owner. The check happens BEFORE downloading, so blocked sources never touch the filesystem.'),disableCommandPluginSources:R().optional().describe("Controls the `command` plugin source, whose plugin directory is produced by running a marketplace-declared command on this machine. true: command-sourced plugins are never installed, updated, or re-resolved (the command never runs). false: explicitly allowed. "+"Unset: follows allowManagedHooksOnly — an org that restricts hook execution to managed "+"settings gets command sources disabled too. Only honored from managed settings."),disableSideloadFlags:R().optional().describe("When true (and set in managed settings), rejects the --plugin-dir, --plugin-url, --agents, and non-sdk --mcp-config CLI flags at startup. Closes the CLI-flag bypass of strictKnownMarketplaces. Pair with allowedMcpServers for per-server MCP control; this setting does not gate other MCP entry points (SDK setMcpServers, claude mcp add, .mcp.json). Also blocks surfaces that spawn the CLI with these flags internally (see settings documentation). Only honored from managed settings; ignored in user/project/local settings."),pluginSuggestionMarketplaces:D(g()).optional().describe("Marketplace names whose plugins may surface as contextual install suggestions (relevance-based tips). No marketplace-declared suggestions surface without this allowlist; the built-in first-party frontend-design tip is unaffected. Only honored when set in managed settings (policy scope); the key is ignored in user, project, and local settings. A name only takes effect when the marketplace is registered on the machine AND its registered source is also declared in managed settings, either as the extraKnownMarketplaces entry for that name or as an entry of strictKnownMarketplaces. A marketplace registered from a different source under an allowlisted name is ignored. The official marketplace is exempt from the source requirement: allowlisting its name alone suffices, since that name can only register from the official Anthropic source."),forceLoginMethod:V(["claudeai","console","gateway"]).optional().catch(void 0).describe('Force a specific login method: "claudeai" for Claude Pro/Max, "console" for Console billing, "gateway" for the Cloud gateway OIDC device flow'),forceLoginGatewayUrl:g().url().optional().catch(void 0).describe('Cloud gateway URL to pre-fill and auto-connect to during login, alongside forceLoginMethod: "gateway". Honored only from admin-controlled managed settings (MDM / managed-settings.json / policy helper); ignored in user, project, and remote-delivered settings.'),parentSettingsBehavior:V(["first-wins","merge"]).optional().describe('Controls whether the SDK parent tier (Options.managedSettings / --managed-settings) layers under this admin tier. "first-wins" '+"(default): parent is dropped — admin tiers are the only policy "+`source. "merge": parent's restrictive-only-filtered settings union under the admin winner. Has no effect when no admin tier exists (parent applies as the sole policy tier, still filtered restrictive-only).`),managedSourcesBehavior:V(["first-wins","merge"]).optional().describe('Controls how the managed settings sources compose. "first-wins" (default): the highest-priority source present (server-managed > MDM (managed plist / HKLM) > managed-settings.json) is the managed tier alone. "merge": every present source deep-merges with fixed '+"precedence server-managed > MDM > managed-settings.json — scalars "+"take the highest source's value and arrays union, except fallbackModel, the restriction allowlists allowedMcpServers, availableModels, strictKnownMarketplaces and allowedChannelPlugins, and sandbox.credentials.awsPairs and sandbox.ripgrep (the highest source that sets one owns it whole) and the auth pins forceLoginOrgUUID, forceLoginMethod and forceLoginGatewayUrl (highest source only). Honored only from the highest-priority source present; enable it only when every lower source is admin-controlled, since lower sources then contribute entries such as permissions.allow. HKCU and --managed-settings never take part in the merge."),forceLoginOrgUUID:de([g(),D(g())]).optional().describe("Organization UUID to require for OAuth login. Accepts a single UUID string or an array of UUIDs (any one is permitted). When set in managed settings, login fails if the authenticated account does not belong to a listed organization."),forceRemoteSettingsRefresh:R().optional().describe("When set in managed settings, the CLI blocks startup until remote managed settings are freshly fetched, and exits if the fetch fails"),otelHeadersHelper:g().optional().describe("Path to a script that outputs OpenTelemetry headers"),outputStyle:g().optional().describe("Controls the output style for assistant responses"),viewMode:V(["default","verbose","focus"]).optional().catch(void 0).describe("Default transcript view mode on startup"),language:g().optional().describe('Preferred language for Claude responses and voice dictation (e.g., "japanese", "spanish")'),skipWebFetchPreflight:R().optional().describe("Skip the WebFetch blocklist check for enterprise environments with restrictive security policies"),sandbox:DD().optional(),feedbackSurveyRate:ee().min(0).max(1).optional().describe("Probability (0–1) that the session quality survey appears when eligible. 0.05 is a reasonable starting point."),feedbackDrafts:V(["notify","quiet","off"]).optional().describe('Model-drafted feedback (the SendFeedback tool). "notify" (default) shows a one-line notice when a draft is queued; "quiet" shows only the footer counter; "off" disables the tool entirely so drafts are never queued.'),spinnerTipsEnabled:R().optional().describe("Whether to show tips in the spinner"),spinnerVerbs:C({mode:V(["append","replace"]),verbs:D(g())}).optional().describe('Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.'),spinnerTipsOverride:C({excludeDefault:R().optional().catch(void 0),tips:hQe().optional(),tipsFile:g().optional().catch(void 0).describe("Absolute or ~/ local path to a JSON file holding an array of tips (same shapes as `tips`); honored from user, --settings and on-disk managed settings only. Read once per CLI process (restart to pick up edits)."),label:g().optional().catch(void 0).describe('Prefix shown before your tips in the spinner (default "Tip")')}).passthrough().optional().catch(void 0).describe("Add your organization's own tips to the spinner tip rotation. tips: strings or {id, text, cooldownSessions?, priority?} objects; tipsFile: a JSON file of the same; label: prefix shown before your tips; excludeDefault: if true, only show your tips (default: false)."),syntaxHighlightingDisabled:R().optional().describe("Whether to disable syntax highlighting in diffs"),spellcheck:C({enabled:R().optional().catch(void 0).describe("Turn on spell checking of the prompt input (default: false)"),checker:g().optional().catch(void 0).describe(`Which spell checker to run: ${CE.map((o)=>`"${o}"`).join(", ")}, or "auto" (default) for the first of those found on PATH`),language:g().optional().catch(void 0).describe(`Dictionary to use, passed to the checker as-is (aspell --lang, hunspell -d, ispell -d), e.g. "en_GB"; names are checker-specific (letters, digits and _ - . , only). Default: the checker's own default`),color:g().optional().catch(void 0).describe(`Color of misspelled words (they are also underlined): a terminal color name such as "red" or "magenta", "#rrggbb", "rgb(r,g,b)", "ansi256(n)" or "ansi:<name>". Default: the theme's error color`)}).passthrough().optional().catch(void 0).describe(`Underline misspelled words in the prompt input as you type, using an installed ${CE.slice(0,-1).join(", ")} or ${CE.at(-1)} (off unless "enabled" is true; does nothing if none is installed). Read from user, flag and managed settings only (the whole block from the highest-precedence of those applies); ignored in project .claude/settings.json and .claude/settings.local.json.`),terminalTitleFromRename:R().optional().describe("Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles."),promptCacheTtl:V(ku).optional().catch(void 0).describe('Prompt cache TTL for the main conversation (interactive, -p and SDK turns, plus the helpers that run inline with it): "5m" or "1h". Unset = automatic: 1 hour on a Claude subscription within its usage limits, 5 minutes on an API key, Bedrock, Vertex or Foundry. 1-hour cache writes are billed at a higher rate; the cache stays warm across longer breaks. The CLAUDE_CODE_PROMPT_CACHE_TTL environment variable takes precedence.'),subagentPromptCacheTtl:V(ku).optional().catch(void 0).describe("Prompt cache TTL for everything outside the main conversation — subagents, workflows, background and helper requests: "+'"5m" or "1h". Unset = automatic (5 minutes unless ENABLE_PROMPT_CACHING_1H=1). The CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL environment variable takes precedence.'),alwaysThinkingEnabled:R().optional().describe("When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models."),effortLevel:V(["low","medium","high","xhigh"]).optional().catch(void 0).describe("Persisted effort level for supported models."),modelSettings:st((o)=>typeof o==="object"&&o!==null&&!Array.isArray(o)?Oh(o,(s,i)=>Object.hasOwn(Object.prototype,i)):o,J(g(),C({effortLevel:V(["low","medium","high","xhigh"]).optional().catch(void 0).describe("Persisted effort level for this model.")}).passthrough().optional().catch(void 0))).optional().catch(void 0).describe("Per-model settings keyed by canonical model name."),ultracode:R().optional().catch(void 0).describe("Enable ultracode for the session: xhigh effort plus standing dynamic-workflow orchestration. "+"Session-scoped — typically provided via --settings or the apply_flag_settings control request; "+"interactive toggles never persist it. Requires workflows to be enabled and an xhigh-capable model."),autoCompactWindow:$Qe().describe("Auto-compact window size"),...!1,advisorModel:g().optional().describe("Advisor model for the server-side advisor tool."),fastMode:R().optional().describe("When true, fast mode is enabled. When absent or false, fast mode is off."),fastModePerSessionOptIn:R().optional().describe("When true, fast mode does not persist across sessions. Each session starts with fast mode off."),promptSuggestionEnabled:R().optional().describe("When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled."),emojiCompletionEnabled:R().optional().describe("When false, the :emoji: shortcode typeahead (the suggestion popup and the :name: inline replacement) is disabled. When absent or true, it is enabled."),awaySummaryEnabled:R().optional().describe("@internal When false, the session recap (shown when you return after being away for 5+ minutes) is disabled. When absent or true, recap is enabled. Hidden from public SDK types until external launch."),showClearContextOnPlanAccept:R().optional().describe('When true, the plan-approval dialog offers a "clear context" option. Defaults to false.'),askUserQuestionTimeout:V(["60s","5m","10m","never"]).optional().catch(void 0).describe("Idle time before Claude's questions auto-continue with any answers "+"selected so far. Defaults to never — auto-continue only runs "+"when explicitly set to 60s/5m/10m."),dialogExpiry:V(["60s","5m","10m","never"]).optional().catch(void 0).describe('Max time a permission/user dialog forwarded to a remote client stays parked awaiting an answer, and how long a HELD cross-session message awaits approval, before either resolves to its safe no-action default (cancelled / dropped-with-denial). Defaults to 5m to match the long-standing remote-dialog deadline; "never" disables the deadline. Local-only permission prompts (no remote client) are unaffected. The CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS env var, when set, overrides this. Read from trusted sources only (never a checked-in repo settings file).'),agent:g().optional().describe("Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model."),modelProposedGoals:V(DQ).optional().catch(void 0).describe("@internal Controls the ProposeGoal tool (model-proposed session goals). 'auto' (the default when absent) lets the model choose per proposal whether to ask for approval via its ask_user parameter; 'alwaysAsk' routes every model-proposed goal through the approval dialog; 'disabled' turns the tool off. A typed /goal is unaffected. Consent-affecting, so it is read "+"from trusted sources only (user/policy/flag) — "+"workspace-resident project and local settings are ignored."),companyAnnouncements:D(g()).optional().describe("Company announcements to display at startup (one will be randomly selected if multiple are provided)"),pluginConfigs:J(g(),C({mcpServers:J(g(),J(g(),de([g(),ee(),R(),D(g())]))).optional().describe("User configuration values for MCP servers keyed by server name"),options:J(g(),de([g(),ee(),R(),D(g())])).optional().describe("Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.")}).or(UP())).optional().describe("Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)"),remote:C({defaultEnvironmentId:g().optional().describe("Default environment ID to use for cloud sessions")}).optional().describe("Cloud session configuration"),autoUpdatesChannel:V(["latest","stable","rc"]).optional().describe("Release channel for auto-updates (latest or stable)"),minimumVersion:g().optional().describe("Minimum version to stay on - prevents downgrades when switching to stable channel"),requiredMinimumVersion:g().optional().describe("Minimum Claude Code version required to start. If the running version is older, Claude Code exits at startup with instructions to update. Only enforced from managed (policy) settings."),requiredMaximumVersion:g().optional().describe("Maximum Claude Code version allowed to start. If the running version is newer, Claude Code exits at startup with instructions to install an approved version. Only enforced from managed (policy) settings."),plansDirectory:g().optional().describe("Custom directory for plan files, relative to project root. If not set, defaults to ~/.claude/plans/"),tui:V(["default","fullscreen"]).optional().describe('Terminal UI renderer. "fullscreen" uses the flicker-free alt-screen renderer with virtualized scrollback (equivalent to CLAUDE_CODE_NO_FLICKER=1). "default" uses the classic main-screen renderer.'),...!1,voice:C({enabled:R().optional(),mode:V(["hold","tap"]).optional().describe("'hold' (default): hold to talk. 'tap': tap to start, tap to stop+submit."),autoSubmit:R().optional().describe("Submit the prompt when hold-to-talk is released (hold mode only)")}).optional().describe("Voice mode settings (hold-to-talk / tap-to-toggle dictation)"),channelsEnabled:R().optional().describe("Managed-org opt-in for channel notifications (MCP servers with the claude/channel capability pushing inbound messages). claude.ai Teams/Enterprise: default off. Console: default on unless managed settings exist. Set true to allow; users then select servers via --channels."),allowedChannelPlugins:D(C({marketplace:g(),plugin:g()})).optional().describe("Managed-org allowlist of channel plugins. When set, "+"replaces the default Anthropic allowlist — admins decide which "+"plugins may push inbound messages. Undefined falls back to the default. Requires channelsEnabled: true."),prefersReducedMotion:R().optional().describe("Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)"),timeFormat:de([V(OQ),g()]).optional().describe('Clock format for times shown in the UI: "auto" (default, follows the locale), "12-hour", "24-hour", "24-hour-utc" ("18:05Z"), or a strftime pattern such as "%H:%M" (any value containing "%"; other values read as "auto"). A pattern replaces the time everywhere; message timestamps show only the pattern, so include %Y-%m-%d for the date. /config offers the presets; a pattern is set here.'),timeZone:g().optional().describe('IANA time zone for times shown in the UI, e.g. "UTC" or "Europe/Dublin". Default: the system time zone. An unknown name falls back to the system time zone.'),doneMeansMerged:R().optional().describe("@internal When true, Claude keeps working until the PR is ready for you to merge, a cron/Monitor is armed to resume later, or it hands you a self-contained next step."),totalTokensReminder:V(["off","infinite","fixed","countdown","padded-countdown"]).optional().describe("@internal Emit a <total_tokens>N tokens left</total_tokens> block in the system prompt, after each tool result, and (when totalTokensReminderAfterUserTurn is on) after each regular user prompt. 'infinite' uses the literal value Infinite, 'fixed' uses 5000000, 'countdown' uses the live remaining context-window tokens, 'padded-countdown' counts down from totalTokensReminderBudget (re-anchoring to the full budget on each regular user prompt when totalTokensReminderAfterUserTurn "+"is on — task-budget semantics). Defaults to padded-countdown. "+"Env var CLAUDE_CODE_TOTAL_TOKENS_REMINDER overrides."),totalTokensReminderBudget:ee().int().positive().optional().describe("@internal Starting budget (tokens) for totalTokensReminder 'padded-countdown' mode. Defaults to 15000000. Server-controlled via GrowthBook; env var CLAUDE_CODE_TOTAL_TOKENS_REMINDER_BUDGET overrides."),totalTokensReminderAfterUserTurn:R().optional().describe("@internal When true, emit the totalTokensReminder block after each regular user prompt and (for 'padded-countdown') re-anchor the task budget to the full configured value at the start of each user turn. When false, the reminder appears only in the system prompt and after each tool-result batch, and 'padded-countdown' counts down over the whole session. Defaults to on. Env var CLAUDE_CODE_TOTAL_TOKENS_REMINDER_AFTER_USER_TURN overrides; server-controlled via GrowthBook tengu_lapis_anchor_user_turn."),autoMemoryEnabled:R().optional().describe("Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory."),autoMemoryDirectory:g().optional().describe("Custom directory path for auto-memory storage. Supports ~/ prefix for home directory expansion. Ignored if set in projectSettings (checked-in .claude/settings.json) for security. When unset, defaults to ~/.claude/projects/<sanitized-cwd>/memory/."),autoDreamEnabled:R().optional().describe("Enable background memory consolidation (auto-dream). When set, overrides the server-side default."),showThinkingSummaries:R().optional().describe("Request API-side thinking summaries and show them in the conversation and in the transcript view (ctrl+o). Set explicitly to override the default for your install."),skipDangerousModePermissionPrompt:R().optional().describe("Whether the user has accepted the bypass permissions mode dialog"),skipWorkflowUsageWarning:R().optional().describe("@internal Whether the user has accepted the multi-agent workflow usage warning. Until set, auto permission mode prompts before running a workflow."),disableAutoMode:V(["disable"]).optional().describe("Disable auto mode"),sshConfigs:D(C({id:g().describe("Unique identifier for this SSH config. Used to match configs across settings sources."),name:g().describe("Display name for the SSH connection"),sshHost:g().describe('SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config'),sshPort:ee().int().optional().describe("SSH port (default: 22)"),sshIdentityFile:g().optional().describe("Path to SSH identity file (private key)"),startDirectory:g().optional().describe("Default working directory on the remote host. Supports tilde expansion (e.g. ~/projects). If not specified, defaults to the remote user home directory. Can be overridden by the [dir] positional argument in `claude ssh <config> [dir]`.")})).optional().describe("SSH connection configurations for remote environments. Typically set in managed settings by enterprise administrators to pre-configure SSH connections for team members."),claudeMd:g().optional().describe("CLAUDE.md-style instructions injected as organization-managed memory. Only honored from managed/policy settings."),claudeMdExcludes:D(g()).optional().describe('Glob patterns or absolute paths of CLAUDE.md files to exclude from loading. Patterns are matched against absolute file paths using picomatch. Only applies to User, Project, and Local memory types (Managed/policy files cannot be excluded). Examples: "/home/user/monorepo/CLAUDE.md", "**/code/CLAUDE.md", "**/some-dir/.claude/rules/**"'),pluginTrustMessage:g().optional().describe('Custom message to append to the plugin trust warning shown before installation. Only read from policy settings (managed-settings.json / MDM). Useful for enterprise administrators to add organization-specific context (e.g., "All plugins from our internal marketplace are vetted and approved.").'),theme:de([V(IQ),g().startsWith("custom:").transform((o)=>o)]).optional().catch(void 0).describe("Color theme for the UI"),editorMode:V(kQ).optional().catch(void 0).describe("Key binding mode for the prompt input"),keybindingFlavor:V(RQ).optional().catch(void 0).describe(`Which conventions the prompt's word-editing keys follow: "readline" matches Bash and other readline programs (Ctrl+W deletes back to the previous whitespace; Alt+F and Alt+D stop at the end of the current word and Ctrl+Y can paste back what Alt+D deleted; for Alt+B, Alt+F, Alt+D, Ctrl/Option+Arrow and Option/Ctrl+Backspace a word is a run of letters and digits, so punctuation separates words); "classic" (default) keeps Claude Code's long-standing behavior (Ctrl+W deletes the previous word; the word keys use Unicode word segmentation, so foo_bar and 3.14 are one word)`),vimInsertModeRemaps:J(g(),ke()).optional().catch(void 0).describe('Vim INSERT-mode key-sequence remaps, e.g. {"jj": "<Esc>"}. Each key is exactly two printable characters typed in sequence; "<Esc>" (return to NORMAL mode) is the only supported target. Applies when editorMode is "vim".'),verbose:R().optional().describe("Show full tool output instead of truncated summaries"),preferredNotifChannel:V(CQ).optional().catch(void 0).describe("Preferred OS notification channel"),autoCompactEnabled:R().optional().describe("Automatically compact conversation when context fills"),precomputeCompactionEnabled:R().optional().describe("Precompute the compaction summary in the background before it is needed. Only applies when auto-compact is on."),switchModelsOnFlag:R().optional().describe("When safeguards flag a message, automatically switch to a different model to keep chatting. When off, your session will pause instead."),autoContinueAtUsageLimit:R().optional().describe("When a claude.ai usage limit stops your session, wait for the limit to reset and continue the task automatically. When off, the limit dialog offers the wait as a choice instead."),autoScrollEnabled:R().optional().describe("Auto-scroll the conversation view to bottom (fullscreen mode only)"),wheelScrollAccelerationEnabled:R().optional().describe("Ramp mouse-wheel scroll speed during fast scrolls (fullscreen mode only)"),fileCheckpointingEnabled:R().optional().describe("Snapshot files before edits so /rewind can restore them"),showTurnDuration:R().optional().describe('Show "Cooked for Nm Ns" after each assistant turn'),showMessageTimestamps:R().optional().describe("Stamp each message with its arrival time"),terminalProgressBarEnabled:R().optional().describe("Emit OSC 9;4 progress sequences during long operations"),todoFeatureEnabled:R().optional().describe("Enable the todo / task tracking panel"),teammateMode:V(PQ).optional().catch(void 0).describe("How spawned teammates execute (tmux, iterm2, in-process, auto)"),remoteControlAtStartup:R().optional().describe("Start Remote Control bridge automatically each session"),isolatePeerMachines:R().optional().describe("Require explicit approval before SendMessage can reach a peer session on another machine via Remote Control"),daemonColdStart:V(["transient","ask"]).optional().describe("When no background service is running: 'transient' spawns one for this login session; 'ask' offers to install it persistently"),crossSessionInbound:V(Uh).optional().catch(void 0).describe("Inbound cross-session peer messages (SendMessage from your other sessions): 'accept' delivers them, 'hold' parks them for your review without letting Claude act, 'refuse' opts this session out. An explicit value always wins. Unset (mode parity): a message auto-delivers only when the sending session's permission-mode class matches yours (bypass↔bypass or prompting↔prompting); a mismatched sender's message is held for your approval; a sender that asserts no class is held only while this session bypasses permission prompts."),autoUploadSessions:R().optional().describe("Mirror local sessions to claude.ai as view-only (no remote control)"),inputNeededNotifEnabled:R().optional().describe("Push to mobile when a permission prompt or question is waiting"),agentPushNotifEnabled:R().optional().describe("Allow Claude to push proactive mobile notifications"),...yee(e)}).passthrough()}var Rd=I(()=>ME(Mh())),Nee=Object.freeze({serverName:"invalid-entry-stripped"});function Mee(e,t,n){return D(t.catch((r)=>(n({path:`${e}[]`,message:`Invalid entry was ignored: ${r.issues[0]?.message??"failed validation"}`}),Nee))).transform((r)=>r.filter((o)=>o!==Nee)).optional()}function fL(e,t){let n=Rd(),r={};for(let[S,x]of Object.entries(n.shape))r[S]=x.catch((v)=>{e({path:S,message:`${v.issues[0]?.message??"Failed schema validation"}. This field was ignored.`});return});r.allowedMcpServers=Mee("allowedMcpServers",LE(),e).catch(()=>(e({path:"allowedMcpServers",message:'"allowedMcpServers" was present but invalid; enforcing an empty allowlist (no MCP servers admitted) until it is fixed.'}),[])),r.deniedMcpServers=Mee("deniedMcpServers",NE(),e).catch(()=>{e({path:"deniedMcpServers",message:'"deniedMcpServers" was present but invalid and was dropped; its entries cannot be enforced until it is fixed.'});return}),r.allowManagedHooksOnly=n.shape.allowManagedHooksOnly.catch(()=>(e({path:"allowManagedHooksOnly",message:'"allowManagedHooksOnly" was present but invalid; treating it as true (only managed hooks run; command-sourced plugins disabled) until it is fixed.'}),!0)),r.syncClaudeAiSkills=n.shape.syncClaudeAiSkills.catch(()=>(e({path:"syncClaudeAiSkills",message:'"syncClaudeAiSkills" was present but invalid; treating it as false (claude.ai skills sync off) until it is fixed.'}),!1)),r.syncClaudeAiPlugins=n.shape.syncClaudeAiPlugins.catch(()=>(e({path:"syncClaudeAiPlugins",message:'"syncClaudeAiPlugins" was present but invalid; treating it as false (claude.ai plugins sync off) until it is fixed.'}),!1)),r.disableCommandPluginSources=n.shape.disableCommandPluginSources.catch(()=>(e({path:"disableCommandPluginSources",message:'"disableCommandPluginSources" was present but invalid; treating it as true (command-sourced plugins disabled) until it is fixed.'}),!0)),r.allowManagedMcpServersOnly=n.shape.allowManagedMcpServersOnly.catch(()=>(e({path:"allowManagedMcpServersOnly",message:'"allowManagedMcpServersOnly" was present but invalid; treating it as true until it is fixed.'}),!0)),r.enforceAvailableModels=n.shape.enforceAvailableModels.catch(()=>(e({path:"enforceAvailableModels",message:'"enforceAvailableModels" was present but invalid; treating it as true until it is fixed.'}),!0)),r.availableModels=D(ke()).transform((S,x)=>{let v=[];for(let w of S)if(typeof w==="string")v.push(w);else e({path:"availableModels",message:`"availableModels" contained a non-string entry (${JSON.stringify(w)}); the entry was ignored.`});return v}).optional().catch(()=>(e({path:"availableModels",message:'"availableModels" was present but invalid; enforcing an empty allowlist (only the default model is available) until it is fixed.'}),[])),r.forceLoginOrgUUID=n.shape.forceLoginOrgUUID.catch(()=>(e({path:"forceLoginOrgUUID",message:'"forceLoginOrgUUID" was present but invalid; no organization is permitted to log in until it is fixed.'}),[]));let o=!1,s=(S,x)=>{let v=S.safeParse(x);if(v.success)return;return v.error.issues.slice(0,3).map((w)=>w.path.length?`${w.path.join(".")}: ${w.message}`:w.message).join("; ")},i;r.policyHelper=st((S)=>{if(o=!1,i=S,S&&typeof S==="object"&&!Array.isArray(S)){let x=S;for(let v of["defaultSettings","default",...IE])if(x[v]!==void 0&&x[v]!==null)e({path:"policyHelper",message:`"${v}" on the singular policyHelper is ignored — static fallback payloads belong on the policyHelpers per-OS entries ("defaultSettings") or the map's "default" key. The intended fallback will NOT apply from here.`,statusOnly:!0});for(let v of["policyHelper","policyHelpers"])if(x[v]!==void 0&&x[v]!==null)e({path:"policyHelper",message:`"${v}" inside the singular policyHelper is ignored — "policyHelper" and "policyHelpers" are TOP-LEVEL settings keys; nothing nests inside the singular entry. The nested config will NOT apply from here.`,statusOnly:!0});for(let v of ds)if(x[v]!==void 0&&x[v]!==null)e({path:"policyHelper",message:`"${v}" on the singular policyHelper is ignored — per-OS entries live on the policyHelpers MAP ("policyHelpers": {"${v}": ...}), not inside the singular key. The intended per-OS config will NOT apply from here.`,statusOnly:!0});if(x.claudeMd!==void 0&&x.claudeMd!==null)e({path:"policyHelper",message:`"claudeMd" on the singular policyHelper is ignored — "claudeMd" is a managed-settings key: put it at the settings top level or inside a static payload, or emit it from the helper's stdout envelope. The intended instructions will NOT apply from here.`,statusOnly:!0});if(x.outputBehavior!==void 0&&x.outputBehavior!==null)e({path:"policyHelper",message:`"outputBehavior" on the singular policyHelper is ignored — it is only honored on the policyHelpers per-OS entries (policyHelpers.${ds.join("/")}); this helper's output REPLACES the policy tier whatever the value says.`,statusOnly:!0});if(x.path===null||x.path===void 0)o=!0}return S===null?void 0:S},DE().optional()).catch((S)=>{e({path:"policyHelper",message:`${S.issues[0]?.message??s(DE(),i)??"Failed schema validation"}. This field was ignored.`,...o&&{statusOnly:!0}});return});let a=(S,x)=>{e({path:S,message:`"${S}" is not a valid static settings payload: ${x??"failed validation"}. When delivered from an OS-admin policy source (MDM or the managed settings file), Claude Code will not start until this is fixed.`,startupFatal:!0})},c=(S)=>{let x=!1,v,w=aL(S,Oc().optional().catch((U)=>{x=!0,a(`policyHelpers.${S}.defaultSettings`,U.issues[0]?.message??s(Oc(),v&&typeof v==="object"&&!Array.isArray(v)?v.defaultSettings:void 0));return}));return st((U)=>{if(x=!1,v=U,S!=="default"&&U&&typeof U==="object"&&!Array.isArray(U)){let L=U;for(let F of[...IE,"claudeMd"])if(L[F]!==void 0&&L[F]!==null)e({path:`policyHelpers.${S}`,message:`"${F}" on the policyHelpers.${S} entry is ignored — helper output cannot be pre-seeded on an entry; a static fallback payload goes under this entry's "defaultSettings" (a managed-settings object). The intended content will NOT apply from here.`,statusOnly:!0});for(let F of["policyHelper","policyHelpers"])if(L[F]!==void 0&&L[F]!==null)e({path:`policyHelpers.${S}`,message:`"${F}" on the policyHelpers.${S} entry is ignored — "policyHelper" and "policyHelpers" are TOP-LEVEL settings keys; nothing nests inside an entry. The nested config will NOT apply from here.`,statusOnly:!0});for(let F of ds)if(L[F]!==void 0&&L[F]!==null)e({path:`policyHelpers.${S}`,message:`"${F}" on the policyHelpers.${S} entry is ignored — per-OS entries are SIBLINGS on the policyHelpers map, not nested inside each other. The intended ${F} config will NOT apply from here.`,statusOnly:!0});if(L.default!==void 0&&L.default!==null)e({path:`policyHelpers.${S}`,message:`"default" on the policyHelpers.${S} entry is ignored — the per-entry static payload field is spelled "defaultSettings"; "default" is the MAP's any-platform catch-all key (a sibling of the OS entries). The intended fallback will NOT apply from here.`,statusOnly:!0});if(zee(U))return}return U===null?void 0:U},w.optional()).catch((U)=>{if(S==="default"){a("policyHelpers.default",U.issues[0]?.message??s(Oc(),v));return}if(x)return;let L=s(aL(S),v)??"failed validation",F=v;if(F&&typeof F==="object"&&!Array.isArray(F)){let K=F,ne=K.defaultSettings;if(ne!==void 0&&ne!==null){let se=Oc().safeParse(ne);if(se.success){let X=K.outputBehavior,re=X===void 0||X===null?null:jee().safeParse(X);if(re&&!re.success){e({path:`policyHelpers.${S}`,message:`Invalid entry was ignored: ${L}. Its "defaultSettings" static payload was NOT kept: "outputBehavior" is unrecognized, so whether the payload replaces or merges over this source's settings is unknown. No policy helper runs on ${S} from this entry.`,statusOnly:!0});return}return e({path:`policyHelpers.${S}`,message:`Invalid entry: its helper fields were ignored (${L}), but its "defaultSettings" static payload was kept. No policy helper runs on ${S} from this entry.`,statusOnly:!0}),{defaultSettings:se.data,...re&&{outputBehavior:re.data}}}}}e({path:`policyHelpers.${S}`,message:`Invalid entry was ignored: ${L}. No policy helper runs on ${S} from this entry.`,statusOnly:!0});return})};r.policyHelpers=st((S)=>{if(S&&typeof S==="object"&&!Array.isArray(S)){let x=S;for(let v of["defaultSettings",...IE,"claudeMd"])if(x[v]!==void 0&&x[v]!==null)e({path:"policyHelpers",message:`"${v}" directly on the policyHelpers map is ignored — static fallback payloads go on a per-OS entry's "defaultSettings" or the map's "default" key (a managed-settings object), and helper-output keys come from the helper's stdout. The intended content will NOT apply from here.`,statusOnly:!0});for(let v of["policyHelper","policyHelpers"])if(x[v]!==void 0&&x[v]!==null)e({path:"policyHelpers",message:`"${v}" inside the policyHelpers map is ignored — "policyHelper" and "policyHelpers" are TOP-LEVEL settings keys; the map's keys are the per-OS entries and "default". The nested config will NOT apply from here.`,statusOnly:!0});for(let v of iL.filter((w)=>w!=="defaultSettings"))if(x[v]!==void 0&&x[v]!==null){let w=v==="script"||v==="interpreter"?"; inline scripts are per-OS only (the singular policyHelper key takes a path)":v==="outputBehavior"?"":", or on the singular policyHelper key";e({path:"policyHelpers",message:`"${v}" directly on the policyHelpers map is ignored — helper configs go on a per-OS entry (policyHelpers.${ds.join("/")})${w}. No helper runs from this field here.`,statusOnly:!0})}}return S===null?void 0:S},C(Object.fromEntries(pL.map((S)=>[S,c(S)]))).transform((S)=>{for(let x of Object.keys(S))if(S[x]===void 0)delete S[x];return S}).optional().catch((S)=>(e({path:"policyHelpers",message:`"policyHelpers" could not be parsed: expected an object mapping OS keys (${ds.join(", ")}) to helper entries, plus an optional "default" settings payload (${S.issues[0]?.message??"failed schema validation"}). When delivered from an OS-admin policy source (MDM or the managed settings file), Claude Code will not start until this is fixed.`,startupFatal:!0}),{})));let l=Object.freeze({mode:"deny"}),u=Object.freeze({accessKeyIdVar:"_STRIPPED_",secretAccessKeyVar:"_STRIPPED_2_"}),p=0,f=[],m=t===void 0?"":`${[...t].reduce((S,x)=>Math.imul(S^x.charCodeAt(0),16777619)>>>0,2166136261).toString(16).toUpperCase().padStart(8,"0")}_`,h=(S,x)=>{if(typeof S!=="object"||S===null)return;let v=(Qe)=>x.some((St)=>St.path?.includes(Qe)),w=(Qe)=>{let St=S[Qe];if(typeof St==="string")return St;return v(Qe)?"":void 0},U=w("accessKeyIdVar"),L=w("secretAccessKeyVar"),F=w("sessionTokenVar"),K=ta;if(![U,L,F].some((Qe)=>Qe!==void 0&&K.includes(Qe)))return;let ne=(Qe)=>Qe!==void 0&&vd().safeParse(Qe).success;p+=1;let se=(Qe)=>`${ID}${Qe}_${m}${p}_`,X=ne(U)?U:se("ACCESS_KEY_ID"),re=ne(L)&&L!==X?L:se("SECRET_ACCESS_KEY"),Ie=F===void 0?void 0:ne(F)&&F!==X&&F!==re?F:se("SESSION_TOKEN"),yt=(Qe)=>Qe.startsWith(ID);if(!yt(X)&&!yt(re)){let Qe=K.includes(re)?re:void 0;if(re=se("SECRET_ACCESS_KEY"),Qe!==void 0){let St=h({accessKeyIdVar:Qe},[]);if(St!==void 0)f.push(St)}}let Z=SE().safeParse({accessKeyIdVar:X,secretAccessKeyVar:re,...Ie!==void 0&&{sessionTokenVar:Ie}});return Z.success?Z.data:void 0},y=(S,x,v)=>D(x.catch((w)=>{let U=v(w.value);if(U!==void 0)return e({path:`sandbox.credentials.${S}[]`,message:`Invalid entry was degraded to mode "deny": ${w.issues[0]?.message??"failed validation"}. The credential stays blocked (not masked) until the entry is fixed.${S==="files"?" Under sandbox.filesystem.disabled, file read-denies are not enforced.":""}`}),U;return e({path:`sandbox.credentials.${S}[]`,message:`Invalid entry was ignored: ${w.issues[0]?.message??"failed validation"}. This credential is NOT protected until the entry is fixed.`}),l})).transform((w)=>w.filter((U)=>U!==l)).optional().catch((w)=>{if(typeof w.value==="object"&&w.value!==null&&!Array.isArray(w.value)){let U=x.safeParse(w.value);if(U.success)return e({path:`sandbox.credentials.${S}`,message:`"${S}" must be an array; a lone entry object was accepted as a one-element list. Wrap it in [ ] to silence this warning.`}),[U.data];let L=v(w.value);if(L!==void 0)return e({path:`sandbox.credentials.${S}`,message:`"${S}" must be an array; its lone entry object was invalid and was degraded to mode "deny". The credential stays blocked (not masked) until it is fixed.`}),[L]}return e({path:`sandbox.credentials.${S}`,message:`${w.issues[0]?.message??"Invalid value"}. "${S}" was ignored; these credential entries are NOT protected until it is fixed.`}),[]}),_=C({files:y("files",gE(),(S)=>{if(typeof S!=="object"||S===null||!("mode"in S)||S.mode!=="mask"&&S.mode!=="deny"||!("path"in S)||typeof S.path!=="string")return;let x=gE().safeParse({path:S.path,mode:"deny"});return x.success?x.data:void 0}),envVars:y("envVars",_E(),(S)=>{if(typeof S!=="object"||S===null||!("mode"in S)||S.mode!=="mask"&&S.mode!=="deny"||!("name"in S)||typeof S.name!=="string")return;let x=_E().safeParse({name:S.name,mode:"deny"});return x.success?x.data:void 0}),allowPlaintextInject:R().optional().catch((S)=>(e({path:"sandbox.credentials.allowPlaintextInject",message:`${S.issues[0]?.message??"Invalid value"}. "allowPlaintextInject" was degraded to an explicit false; plaintext credential injection stays disabled (lower-precedence values cannot enable it) until it is fixed.`}),!1)),awsPairs:D(SE().catch((S)=>{let x=h(S.value,S.issues);if(x!==void 0)return e({path:"sandbox.credentials.awsPairs[]",message:`Invalid pair was degraded to a non-functional suppressor: ${S.issues[0]?.message??"failed validation"}. It keeps implicit AWS auto-pairing suppressed but re-signs nothing until it is fixed.`}),x;return e({path:"sandbox.credentials.awsPairs[]",message:`Invalid pair was ignored: ${S.issues[0]?.message??"failed validation"}. SigV4 re-signing stays unconfigured for this pair until it is fixed.`}),u})).transform((S)=>{let x=S.filter((v)=>v!==u);if(f.length>0)x.push(...f),f.length=0;return x}).optional().catch((S)=>{let x=typeof S.value==="object"&&S.value!==null?h(S.value,[]):void 0,v=typeof S.value==="object"&&S.value!==null&&(("accessKeyIdVar"in S.value)||("secretAccessKeyVar"in S.value)||("sessionTokenVar"in S.value));if(x===void 0&&v)return f.length=0,e({path:"sandbox.credentials.awsPairs",message:`${S.issues[0]?.message??"Invalid value"}. "awsPairs" must be an array; its lone pair-shaped entry claimed no conventional AWS name and was ignored. SigV4 re-signing stays unconfigured until it is fixed.`}),[];let w=x!==void 0?[x]:ta.flatMap((U)=>{let L=h({accessKeyIdVar:U},[]);return L!==void 0?[L]:[]});if(f.length>0)w.push(...f),f.length=0;return e({path:"sandbox.credentials.awsPairs",message:`${S.issues[0]?.message??"Invalid value"}. "awsPairs" was degraded to non-functional suppressor pair(s); implicit AWS auto-pairing stays suppressed but nothing re-signs until it is fixed.`}),w}),sigv4:C(Object.fromEntries(["streaming","presigned","sigv4a"].map((S)=>[S,V(["deny","passthrough"]).optional().catch((x)=>(e({path:`sandbox.credentials.sigv4.${S}`,message:`${x.issues[0]?.message??"Invalid value"}. "${S}" was degraded to an explicit deny; this SigV4 request shape stays denied until it is fixed.`}),"deny"))]))).optional().catch((S)=>(e({path:"sandbox.credentials.sigv4",message:`${S.issues[0]?.message??"Invalid value"}. "sigv4" was degraded to an all-deny block (all shapes stay denied, and lower-precedence sigv4 values cannot take effect) until it is fixed.`}),{streaming:"deny",presigned:"deny",sigv4a:"deny"}))}).optional().catch((S)=>{e({path:"sandbox.credentials",message:`${S.issues[0]?.message??"Failed schema validation"}. The credentials block was degraded to a fail-closed skeleton (all-deny sigv4, implicit AWS auto-pairing suppressed, no masking) until it is fixed.`});let x=ta.flatMap((v)=>{let w=h({accessKeyIdVar:v},[]);return w!==void 0?[w]:[]});return f.length=0,{allowPlaintextInject:!1,awsPairs:x,sigv4:{streaming:"deny",presigned:"deny",sigv4a:"deny"}}});return r.sandbox=DD().extend({credentials:_}).optional().catch((S)=>{e({path:"sandbox",message:`${S.issues[0]?.message??"Failed schema validation"}. This field was ignored.`});let x=S.value;if(typeof x==="object"&&x!==null&&"credentials"in x){let v=_.safeParse(x.credentials);if(v.success&&v.data!==void 0)return e({path:"sandbox.credentials",message:"The credentials block was salvaged from the invalid sandbox value and stays enforced; every other sandbox field was ignored."}),{credentials:v.data}}return}),C(r).passthrough().transform((S)=>{for(let x of Object.keys(S))if(S[x]===void 0)delete S[x];return S})}function UE(e){if(Array.isArray(e))return e.map(UE);if(e!==null&&typeof e==="object"){let t={};for(let n of Object.keys(e).sort())t[n]=UE(e[n]);return t}return e}function Gee(e){if(!e)return{shellSettings:{},envVars:{},sandboxSettings:{},hasHooks:!1,hasClaudeMd:!1};let t={},n;for(let l of xQ){let u=e[l];if(l==="policyHelpers"){if(u!==null&&typeof u==="object")for(let f of ds){let m=WQe(u[f]);if(m){if(t[`policyHelpers.${f}`]=m.command,m.scriptSize)n??={},n[`policyHelpers.${f}`]=m.scriptSize}}continue}let p;if(typeof u==="string")p=u;else if(u!==null&&typeof u==="object"&&"command"in u&&typeof u.command==="string")p=u.command;if(p!==void 0&&p.length>0)t[l]=p}let r=JQe(e);if(r&&typeof r==="object")for(let[l,u]of Object.entries(r)){let p=u?.source;if(!p||typeof p!=="object")continue;if(p.source==="url"&&typeof p.headersHelper==="string"&&p.headersHelper.length>0)t[`extraKnownMarketplaces[${me(l)}].source.headersHelper`]=Bee(p.headersHelper,"url",p.url);if(p.source==="settings"&&Array.isArray(p.plugins)){let f=new Map;for(let m of p.plugins){let h=me(m?.name),y=f.get(h)??0;f.set(h,y+1);let _=m?.source;if(_!==null&&typeof _==="object"&&"source"in _&&_.source==="command"&&"command"in _&&typeof _.command==="string"&&_.command.length>0)t[`extraKnownMarketplaces[${me(l)}].plugins[${me(m.name)}][${y}].source.command`]=_.command;if(typeof m?.headersHelper==="string"&&m.headersHelper.length>0){let E=m.source,S=E!==null&&typeof E==="object";t[`extraKnownMarketplaces[${me(l)}].plugins[${me(m.name)}][${y}].headersHelper`]=Bee(m.headersHelper,S&&"source"in E?E.source:void 0,S&&"url"in E?E.url:void 0)}}}}let o=e.sandbox,s={};if(o!==null&&typeof o==="object"){let l={enabled:FE(o,"enabled"),enabledPlatforms:FE(o,"enabledPlatforms")};for(let u of vQ){let p=ZQe(o[u]);if(p)t[`sandbox.${u}`]=mL({value:p,...l})}for(let u of wQ){let p=FE(o,u);if(HQe(u,p))s[`sandbox.${u}`]=mL({value:p,...l,...zQe.has(u)&&{allowedDomains:jQe(FE(o,"network.allowedDomains"))}})}}let i={};if(e.env&&typeof e.env==="object")for(let[l,u]of Object.entries(e.env)){if(u===void 0)continue;let p=String(u);if(p.length>0&&!AQ(l,p))i[l]=p}let a=e.hooks!==void 0&&e.hooks!==null&&typeof e.hooks==="object"&&Object.keys(e.hooks).length>0,c=typeof e.claudeMd==="string"&&e.claudeMd.length>0;return{shellSettings:t,inlineHelperScriptSizes:n,envVars:i,sandboxSettings:s,hasHooks:a,hooks:a?e.hooks:void 0,hasClaudeMd:c,claudeMd:c?e.claudeMd:void 0}}var zQe=new Set(["credentials","network.tlsTerminate"]);function jQe(e){return Array.isArray(e)?Ar(e.filter((t)=>typeof t==="string")).sort():void 0}function FE(e,t){let n=e;for(let r of t.split(".")){if(n===null||typeof n!=="object")return;n=n[r]}return n}function HQe(e,t){if(t===void 0||t===null||t===!1)return!1;if(Array.isArray(t)&&t.length===0)return!1;return!(e==="credentials"&&BQe(t))}function BQe(e){if(typeof e!=="object"||e===null)return!1;return Object.entries(e).every(([t,n])=>{if(n===void 0)return!0;if(t==="files"||t==="envVars")return Array.isArray(n)&&n.every((r)=>typeof r==="object"&&r!==null&&r.mode==="deny");if(t==="sigv4")return typeof n==="object"&&n!==null&&Object.values(n).every((r)=>r===void 0||r==="deny");return t==="allowPlaintextInject"&&n===!1})}function KQe(e){return Object.keys(e.shellSettings).some((t)=>t.startsWith("policyHelpers."))}function Wee(e){return KQe(e)||Object.keys(e.shellSettings).some((t)=>t.startsWith("extraKnownMarketplaces["))}function GQe(e){return e==="sh"||e==="pwsh"}function WQe(e){if(e===null||typeof e!=="object")return;let{path:t,script:n,interpreter:r,timeoutMs:o,refreshIntervalMs:s}=e,i,a;if(typeof t==="string"&&t)i=t;else if(typeof n==="string"&&n&&GQe(r))i={interpreter:r,script:qQe(n)},a=VQe(n);else return;return{command:me([i,o??null,s??null]),scriptSize:a}}function VQe(e){return{bytes:Buffer.byteLength(e,"utf8"),lines:sM(e,`
199
+ `)+(e.endsWith(`
200
+ `)?0:1)}}function qQe(e){return Kee("sha256").update(me(e)).digest("hex")}function ZQe(e){if(typeof e==="string")return e||void 0;if(e===null||typeof e!=="object"||!("command"in e)||typeof e.command!=="string"||!e.command)return;let t="args"in e&&Array.isArray(e.args)?e.args.map(String):[];return me([e.command,...t])}function YQe(e){return mL({shellSettings:e.shellSettings,envVars:e.envVars,sandboxSettings:Object.keys(e.sandboxSettings).length>0?e.sandboxSettings:void 0,hooks:e.hooks,claudeMd:e.claudeMd})}function mL(e){return me(UE(e))}function Vee(e){return Kee("sha256").update(YQe(e)).digest("hex")}function Bee(e,t,n){return me([e,typeof t==="string"?t:null,typeof n==="string"?n:null])}function qee(e){return e.replace(/[^\x20-\x7e]/gu,"?")}function JQe(e){let t=e.extraKnownMarketplaces;if(t!==void 0&&t!==null)return t;let n=e;for(let{alias:r,canonical:o}of Ph){if(o!=="extraKnownMarketplaces")continue;let s=n[r];if(s!==void 0&&s!==null&&typeof s==="object")return s}return}var XQe="remote-settings.json";var Yee="remote-settings-helper-consent";function QQe(){return Zee(Wt(),Yee)}function eet(e){if(e.policyHelpers===void 0&&e.extraKnownMarketplaces===void 0&&!Ph.some(({alias:n,canonical:r})=>r==="extraKnownMarketplaces"&&e[n]!==void 0))return;let t=Gee(e);return Wee(t)?Vee(t):void 0}function tet(e){return Oh(e,(t,n)=>n.startsWith("$")&&n!=="$schema")}class Jee{sessionCache=null;eligible=void 0;eligibilityMemo=void 0;ineligibleReason=void 0;evalPolicySnapshotOnly=!1;lastLoadStatus=void 0;lastLoadStatusChanged=Tt();policySettingsNotified=!1;verifiedPayload=null;unverifiedView=null;projectedView=null;consentedPayload=null;resetEpoch=0;backendView=void 0;replaceSessionCache(e,t){if(this.sessionCache=e,t?.verified)this.verifiedPayload=e}seedFromDisk(e){this.sessionCache=e;let t=eet(e);if(t===void 0||t===aet())this.consentedPayload??=e}markConsented(e){this.consentedPayload=e}markPolicySettingsNotified(){this.policySettingsNotified=!0}recordEligibility(e,t){if(this.eligible=e,t.memoize)this.eligibilityMemo=e,this.ineligibleReason=e?void 0:t.ineligibleReason}resetListener=null;registerResetListener(e){if(this.resetListener!==null)throw Error("registerSyncCacheResetListener: a listener is already registered; a second one would unhook the first");this.resetListener=e}reset(){this.sessionCache=null,this.eligible=void 0,this.eligibilityMemo=void 0,this.ineligibleReason=void 0,this.evalPolicySnapshotOnly=!1,this.lastLoadStatus=void 0,this.policySettingsNotified=!1,this.verifiedPayload=null,this.unverifiedView=null,this.projectedView=null,this.consentedPayload=null,this.resetEpoch++,this.emitLoadStatusChanged(void 0)}emitLoadStatusChanged(e){try{this.lastLoadStatusChanged.emit(e)}catch(t){ce(`Remote settings: load-status listener threw: ${Br(t)}`,{level:"error"})}}}var net=new nt(()=>new Jee);function Fh(){return net.of(Ct().host)}function $E(){return}function Xee(){return Fh().evalPolicySnapshotOnly}function Qee(e){return e!==null&&Fh().projectedView?.view===e}function ret(e){return e&&Xee()?{...mQ(e),managedSourcesBehavior:"merge"}:e}function oet(){return $E()??Zee(Wt(),XQe)}var ete=8388608;function set(){try{let e=cet();if(e===null)return null;let t=lt(Mu(e));if(!t||typeof t!=="object"||Array.isArray(t))return null;return tet(t)}catch(e){if($X(e))ce(`Remote settings: Disk cache exceeds ${ete} bytes; ignoring it as if absent`);return null}}var iet=4096;function aet(){let e=hL();if(e!==void 0)return e.attestation;try{return xc(QQe(),iet).trim()||void 0}catch{return}}function cet(){let e=hL();if(e!==void 0)return e.content;return xc(oet(),ete)}function hL(){let e=Fh().backendView;if(!ye()||e===void 0||!e.ready||e.stoodDown||$E()!==void 0)return;if(!FM(e.configHome)){e.standDown("config home changed");return}return e}var o6t=tn.state("remote-settings"),s6t=tn.state(Yee);var uet=new Set(["HTTPS_PROXY","HTTP_PROXY","NO_PROXY","CLAUDE_CODE_PROXY_RESOLVES_HOSTS","CLAUDE_CODE_ENABLE_PROXY_AUTH_HELPER","CLAUDE_CODE_PROXY_AUTH_HELPER_TTL_MS","API_FORCE_IDLE_TIMEOUT","ANTHROPIC_UNIX_SOCKET","NODE_EXTRA_CA_CERTS","CLAUDE_CODE_CERT_STORE","CLAUDE_CODE_CLIENT_CERT","CLAUDE_CODE_CLIENT_KEY","CLAUDE_CODE_CLIENT_KEY_PASSPHRASE","ALL_PROXY","NODE_OPTIONS","NODE_TLS_REJECT_UNAUTHORIZED",...ND,...MD,"AWS_ENDPOINT_URL_STS","AWS_ENDPOINT_URL","AWS_ENDPOINT_URL_SSO","AWS_ENDPOINT_URL_SSO_OIDC","AWS_ENDPOINT_URL_BEDROCK","AWS_ENDPOINT_URL_BEDROCK_RUNTIME",...zD,...jD,...HD,"CLOUDSDK_CONFIG","GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES","GCLOUD_PROJECT","CLAUDE_CODE_CUSTOM_OAUTH_URL",...UD,"CLAUDE_CODE_API_BASE_URL","CLAUDE_CODE_OAUTH_REFRESH_TOKEN","CLAUDE_CODE_OAUTH_SCOPES","CLAUDE_CODE_OAUTH_CLIENT_ID","CLAUDE_CODE_SESSION_ACCESS_TOKEN","CLAUDE_SESSION_INGRESS_TOKEN_FILE","CLAUDE_CODE_ENVIRONMENT_KIND","CLAUDE_CODE_REMOTE_SESSION_ID","ANTHROPIC_FEDERATION_RULE_ID","ANTHROPIC_ORGANIZATION_ID","ANTHROPIC_WORKSPACE_ID","ANTHROPIC_SERVICE_ACCOUNT_ID","ANTHROPIC_IDENTITY_TOKEN","ANTHROPIC_IDENTITY_TOKEN_FILE","ANTHROPIC_SCOPE","ANTHROPIC_PROFILE","ANTHROPIC_CONFIG_DIR","CLAUDE_CODE_FEDERATION_CACHE_DIR","HOME","XDG_CONFIG_HOME","APPDATA","USERPROFILE","ANTHROPIC_CUSTOM_HEADERS","CLAUDE_CODE_HOST_CREDS_FILE","CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST","CLAUDE_CODE_HOST_AUTH_ENV_VAR","CLAUDE_CONFIG_DIR","CLAUDE_SECURESTORAGE_CONFIG_DIR","CLAUDE_CODE_REMOTE_SETTINGS_PATH","CLAUDE_CODE_MANAGED_SETTINGS_PATH","CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION","CLAUDE_CODE_MOCK_REMOTE_SETTINGS","USE_LOCAL_OAUTH","USE_STAGING_OAUTH","CLAUDE_LOCAL_OAUTH_API_BASE","CLAUDE_LOCAL_OAUTH_APPS_BASE","CLAUDE_LOCAL_OAUTH_CONSOLE_BASE","CLAUDE_BRIDGE_BASE_URL","CLAUDE_BRIDGE_OAUTH_TOKEN","CLAUDE_BRIDGE_SESSION_INGRESS_URL","CLAUDE_REMOTE_TOOLS_BRIDGE_URL"].map((e)=>e.toUpperCase()));function det(e){if(!e?.env)return e;let t=Oh(e.env,(n,r)=>uet.has(r.toUpperCase()));return{...e,env:t}}function pet(){let e=Fh();if(!$E()&&e.eligible!==!0)return null;if(e.sessionCache)return e.sessionCache;let t=hL()!==void 0,n=set();if(n){if(e.seedFromDisk(n),t)Ec().invalidatePolicyLayer();else PX();return n}return null}function tte(){let e=pet(),t=Fh(),n=e===t.verifiedPayload||$E()?e:fet(t,e);if(n===null||!Xee())return n;if(t.projectedView?.raw!==n)t.projectedView={raw:n,view:ret(n)};return t.projectedView.view}function fet(e,t){if(t===null)return null;if(e.unverifiedView?.raw!==t)e.unverifiedView={raw:t,view:det(t)};return e.unverifiedView.view}function met(e){return e!==void 0&&(e.commit!==void 0||e.pr!==void 0)}function nte(e,t){let n=e?.commitTrailers;if(typeof n==="boolean")return n?"explicit-enabled":"disabled";if(e!==void 0&&met(e))return e.commit===""?"disabled":"implicit-enabled";if(t!==void 0)return t?"implicit-enabled":"disabled";return}import{userInfo as het}from"os";var rte="com.anthropic.claudecode",$h="HKLM\\SOFTWARE\\Policies\\ClaudeCode",zh="HKCU\\SOFTWARE\\Policies\\ClaudeCode",oa="Settings",ote="/usr/bin/plutil",ste=["-convert","json","-o","-","--"],ite=5000,gL="/mnt/c/Windows/System32/reg.exe",Od="/mnt/c/Program Files/ClaudeCode";function jh(){if(process.platform!=="linux")return!1;if(process.env.WSL_DISTRO_NAME)return!0;try{let e=xe("fs").readFileSync("/proc/version","utf8").toLowerCase();return e.includes("microsoft")||e.includes("wsl")}catch{return!1}}function ate(){let e="";try{e=het().username}catch{}let t=[];if(e)t.push({path:`/Library/Managed Preferences/${e}/${rte}.plist`,label:"per-user managed preferences"});return t.push({path:`/Library/Managed Preferences/${rte}.plist`,label:"device-level managed preferences"}),t}var cte=512;function lte(e){return e.map(get)}function get(e){let{file:t,severity:n,docLink:r,statusOnly:o,startupFatal:s,preserveOnWrite:i,mcpErrorMetadata:a,path:c,message:l,expected:u,suggestion:p,invalidValue:f,...m}=e,h=m;return{file:t,severity:n,docLink:r,statusOnly:o,startupFatal:s,preserveOnWrite:i,mcpErrorMetadata:a,path:Hh(c),message:Hh(l),expected:u===void 0?void 0:Hh(u),suggestion:p===void 0?void 0:Hh(p),invalidValue:typeof f==="string"?Hh(f):void 0}}function Hh(e){let t=qee(e.replace(/\s+/gu," "));return t.length>cte?`${t.slice(0,cte-1)}…`:t}var qs="https://code.claude.com/docs/en",_et=[{matches:(e)=>e.path==="permissions.defaultMode"&&e.code==="invalid_value",tip:{suggestion:'Valid modes: "acceptEdits" (ask before file changes), "plan" (analysis only), "bypassPermissions" (auto-accept all), or "default" (standard behavior)',docLink:`${qs}/iam#permission-modes`}},{matches:(e)=>e.path==="apiKeyHelper"&&e.code==="invalid_type",tip:{suggestion:'Provide a shell command that outputs your API key to stdout. The script should output only the API key. Example: "/bin/generate_temp_api_key.sh"'}},{matches:(e)=>e.path==="cleanupPeriodDays"&&e.code==="too_small",tip:{suggestion:'cleanupPeriodDays must be at least 1. To keep transcripts for a long time, set a large number (e.g. 3650 for ~10 years). To disable transcript writes entirely, remove this setting and use the --no-session-persistence CLI flag or the SDK persistSession:false option instead. (0 is rejected because it previously silently disabled all transcript writes, which users setting it to mean "never clean up" did not expect.)'}},{matches:(e)=>e.path.startsWith("env.")&&e.code==="invalid_type",tip:{suggestion:'Environment variables must be strings. Wrap numbers and booleans in quotes. Example: "DEBUG": "true", "PORT": "3000"',docLink:`${qs}/settings#environment-variables`}},{matches:(e)=>(e.path==="permissions.allow"||e.path==="permissions.deny")&&e.code==="invalid_type"&&e.expected==="array",tip:{suggestion:'Permission rules must be in an array. Format: ["Tool(specifier)"]. Examples: ["Bash(npm run build)", "Edit(docs/**)", "Read(~/.zshrc)"]. Use * for wildcards.'}},{matches:(e)=>e.path.startsWith("hooks.")&&e.code==="invalid_key",tip:{suggestion:"Not a recognized hook event. Common events: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop. Check spelling and capitalization.",docLink:`${qs}/hooks`}},{matches:(e)=>/\.hooks\.\d+\.command$/.test(e.path)&&e.code==="invalid_type"&&e.received==="undefined",tip:{suggestion:'Command hooks require `command`. For exec form (no shell), set `command` to the executable and `args` to its arguments: {"type": "command", "command": "echo", "args": ["hi"]}. For shell form, set `command` to the full shell string: {"type": "command", "command": "echo hi"}.',docLink:`${qs}/hooks#exec-form-and-shell-form`}},{matches:(e)=>e.path.includes("hooks")&&e.code==="invalid_type",tip:{suggestion:'Hooks use a matcher + hooks array. The matcher is a string: a tool name ("Bash"), pipe-separated list ("Edit|Write"), or empty to match all. Example: {"PostToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "echo Done"}]}]}'}},{matches:(e)=>e.code==="invalid_type"&&e.expected==="boolean",tip:{suggestion:'Use true or false without quotes. Example: "includeCoAuthoredBy": true'}},{matches:(e)=>e.code==="unrecognized_keys",tip:{suggestion:"Check for typos or refer to the documentation for valid fields",docLink:`${qs}/settings`}},{matches:(e)=>e.code==="invalid_value"&&e.enumValues!==void 0,tip:{suggestion:void 0}},{matches:(e)=>e.code==="invalid_type"&&e.expected==="object"&&e.received===null&&e.path==="",tip:{suggestion:"Check for missing commas, unmatched brackets, or trailing commas. Use a JSON validator to identify the exact syntax error."}},{matches:(e)=>e.path==="permissions.additionalDirectories"&&e.code==="invalid_type",tip:{suggestion:'Must be an array of directory paths. Example: ["~/projects", "/tmp/workspace"]. You can also use --add-dir flag or /add-dir command',docLink:`${qs}/iam#working-directories`}}],yet={permissions:`${qs}/iam#configuring-permissions`,env:`${qs}/settings#environment-variables`,hooks:`${qs}/hooks`};function ute(e){let t=_et.find((r)=>r.matches(e));if(!t)return null;let n={...t.tip};if(e.code==="invalid_value"&&e.enumValues&&!n.suggestion)n.suggestion=`Valid values: ${e.enumValues.map((r)=>`"${r}"`).join(", ")}`;if(!n.docLink&&e.path)n.docLink=yet[av(e.path,".")];return n}var $6t=I(()=>ME(Mh(),{strictPolicyHelperKeys:!0}).strict());function dte(e){return e.code==="invalid_type"}function pte(e){return e.code==="invalid_value"}function bet(e){return e.code==="unrecognized_keys"}function fte(e){return e.code==="too_small"}function pr(e){if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";return typeof e}function mte(e){let t=e.match(/received (\w+)/);return t?t[1]:void 0}function Bh(e,t){return e.issues.map((n)=>{let r=n.path.map(String).join("."),o=n.message,s,i,a,c,l;if(pte(n))i=n.values.map((p)=>String(p)),a=i.join(" | "),c=void 0,l=void 0;else if(dte(n)){a=n.expected;let p=mte(n.message);c=p??pr(n.input),l=p??pr(n.input)}else if(fte(n))a=String(n.minimum);else if(n.code==="custom"&&"params"in n)c=n.params.received,l=c;let u=ute({path:r,code:n.code,expected:a,received:c,enumValues:i,message:n.message,value:c});if(pte(n))s=i?.map((p)=>`"${p}"`).join(", "),o=`Invalid value. Expected one of: ${s}`;else if(dte(n)){let p=mte(n.message)??pr(n.input);if(n.expected==="object"&&p==="null"&&r==="")o="Invalid or malformed JSON";else o=`Expected ${n.expected}, but received ${p}`}else if(bet(n)){let p=n.keys.join(", ");o=`Unrecognized ${sv(n.keys.length,"field")}: ${p}`}else if(fte(n))o=`Number must be greater than or equal to ${n.minimum}`,s=String(n.minimum);return{file:t,path:r,message:o,expected:s,invalidValue:l,suggestion:u?.suggestion,docLink:u?.docLink}})}function Eet(e,t){if(!e||typeof e!=="object")return[];let n=e;if(!n.permissions||typeof n.permissions!=="object")return[];let r=n.permissions,o=[];for(let s of["allow","deny","ask"]){let i=r[s];if(!Array.isArray(i))continue;r[s]=i.filter((a)=>{if(typeof a!=="string")return o.push({file:t,path:`permissions.${s}`,message:`Non-string value in ${s} array was removed`,severity:"warning",invalidValue:a}),!1;let c=oL(a,s);if(!c.valid){let l=`Invalid permission rule "${a}" was skipped: ${c.error}`;if(c.suggestion)l+=`. ${c.suggestion}`;return o.push({file:t,path:`permissions.${s}`,message:l,severity:"warning",invalidValue:a}),!1}return!0})}return o}var xet=new Set(_s);function vet(e,t){if(!e||typeof e!=="object")return[];return[...HQ(e,BQ)?[{file:t,path:"hooks",message:`PreToolUse/PermissionRequest hooks are declared outside "hooks" (at the top level or under another key) — ${kc}.`,severity:"fatal",docLink:"https://code.claude.com/docs/en/hooks"}]:[],...wet(e,t)]}function wet(e,t){if(!("hooks"in e))return[];if(e.hooks===null||typeof e.hooks!=="object"||Array.isArray(e.hooks)){let o=pr(e.hooks);if(Array.isArray(e.hooks)&&(e.hooks.some(It)||KD(e.hooks)))return[{file:t,path:"hooks",message:`"hooks" must be an object mapping event names to matcher arrays; received ${o} — ${kc}.`,invalidValue:o,docLink:"https://code.claude.com/docs/en/hooks"}];return delete e.hooks,[{file:t,path:"hooks",message:`"hooks" must be an object mapping event names to matcher arrays; received ${o}. This field was ignored.`,severity:"warning",invalidValue:o,docLink:"https://code.claude.com/docs/en/hooks"}]}let n=e.hooks;if(vE(n))return[{file:t,path:"hooks",message:`"hooks" must be an object mapping event names to matcher arrays; received a single matcher — ${kc}.`,docLink:"https://code.claude.com/docs/en/hooks"}];let r=[];for(let o of Object.keys(n)){let s=Tg(o);if(!xet.has(o)){if(Tc(n[o],3,{matchersCount:!Array.isArray(n[o])})){r.push({file:t,path:`hooks.${s}`,message:`"${s}" is not a hook event, but it holds PreToolUse/PermissionRequest hooks — ${kc}.`,docLink:"https://code.claude.com/docs/en/hooks"});continue}delete n[o],r.push({file:t,path:`hooks.${s}`,message:`Unknown hook event "${s}" was ignored. Valid events: ${_s.join(", ")}`,severity:"warning",invalidValue:s,docLink:"https://code.claude.com/docs/en/hooks",preserveOnWrite:!0});continue}if(!Array.isArray(n[o])){let i=n[o],a=pr(i);if(Lh.has(o)&&i!==null||Tc(i,3,{matchersCount:!1})){r.push({file:t,path:`hooks.${s}`,message:`Hook event "${s}" must be an array of matchers; received ${a} — ${kc}.`,invalidValue:a,docLink:"https://code.claude.com/docs/en/hooks"});continue}delete n[o],r.push({file:t,path:`hooks.${s}`,message:`Hook event "${s}" must be an array of matchers; received ${a}. This entry was ignored.`,severity:"warning",invalidValue:a,docLink:"https://code.claude.com/docs/en/hooks",...i!==null&&{preserveOnWrite:!0}})}}for(let[o,s]of Object.entries(n)){let{stripped:i,unloadableGuards:a}=GQ(s,o);for(let c of a)r.push({file:t,path:c.aboutType?`hooks.${o}.${c.path}.type`:`hooks.${o}.${c.path}`,message:`${c.problem} — ${kc}.${c.aboutType?` Valid types: ${[...xE()].join(", ")}`:""}`,severity:"fatal",invalidValue:c.received,docLink:"https://code.claude.com/docs/en/hooks"});for(let c of i)r.push({file:t,path:c.aboutType?`hooks.${o}.${c.path}.type`:`hooks.${o}.${c.path}`,message:c.aboutType?`${c.problem}; entry ignored. Valid types: ${[...xE()].join(", ")}`:`${c.problem}; ${c.hookIndex===void 0?"matcher":"entry"} ignored.`,severity:"warning",invalidValue:c.received,docLink:"https://code.claude.com/docs/en/hooks",preserveOnWrite:!0})}if(r.length>0&&Object.keys(n).length===0)delete e.hooks;return r}var Aet=[{key:"allowedMcpServers",schema:LE},{key:"deniedMcpServers",schema:NE}];function Tet(e,t,n){if(!e||typeof e!=="object")return[];let r=e,o=[];for(let{key:s,schema:i}of Aet){if(!(s in r))continue;if(!Array.isArray(r[s])){if(n?.keepWholeFieldInvalid)continue;let l=r[s];delete r[s],o.push({file:t,path:s,message:`"${s}" must be an array; received ${pr(l)}. This field was ignored.`,severity:"warning",invalidValue:l});continue}let a=r[s],c=[];for(let l=0;l<a.length;l++){let u=i().safeParse(a[l]);if(u.success)c.push(a[l]);else o.push({file:t,path:`${s}[${l}]`,message:`Invalid entry was ignored: ${u.error.issues[0]?.message??"failed validation"}`,severity:"warning",invalidValue:a[l]})}if(c.length<a.length)r[s]=c}return o}function Cet(e){if(!e||typeof e!=="object")return;let t=e.source;if(!t||typeof t!=="object")return;let n=t.source;return typeof n==="string"?n:void 0}function ket(e){if(!e||typeof e!=="object")return!1;let t=e.source;if(!t||typeof t!=="object")return!1;let n=t.plugins;return Array.isArray(n)&&n.some(QD)}function Ret(e,t){if(!e||typeof e!=="object")return[];let n=e,r="extraKnownMarketplaces";if(!(r in n))return[];let o=n[r];if(!o||typeof o!=="object"||Array.isArray(o)){let a=pr(o);return delete n[r],[{file:t,path:r,message:`"${r}" must be an object mapping marketplace names to declarations; received ${a}. This field was ignored.`,severity:"warning",invalidValue:a}]}let s=o,i=[];for(let a of Object.keys(s)){let c=cL().safeParse(s[a]),l;if(!c.success){let u=Cet(s[a]);if(u!==void 0&&!pee.has(u)||ket(s[a]))continue;l=TE(c.error.issues)}else if(c.data.source.source==="settings"&&c.data.source.name!==a)l=`key "${ra(a)}" must match the settings source name "${ra(c.data.source.name)}"`;if(l!==void 0)i.push({file:t,path:`${r}.${ra(a)}`,message:`Invalid marketplace entry was ignored: ${l}`,severity:"warning"}),delete s[a]}return i}function Oet(e,t){if(!e||typeof e!=="object")return[];let n=e,r="modelPicker";if(!(r in n))return[];let o=n[r];if(!It(o)||!Array.isArray(o.options)){let c=It(o)?`options: ${pr(o.options)}`:pr(o);return delete n[r],[{file:t,path:r,message:`"${r}" must be an object with an "options" array of { model, label?, description?, behavesAs? } rows; received ${c}. This field was ignored.`,severity:"warning",invalidValue:c}]}let s=[];if("replaceBuiltInOptions"in o&&typeof o.replaceBuiltInOptions!=="boolean"){let c=pr(o.replaceBuiltInOptions);delete o.replaceBuiltInOptions,s.push({file:t,path:`${r}.replaceBuiltInOptions`,message:`"replaceBuiltInOptions" must be true or false; received ${c}. This entry was ignored (the rows are added to the built-in lineup).`,severity:"warning",invalidValue:c})}let i=o.options,a=[];for(let c=0;c<i.length;c++){let l=dL().safeParse(i[c]);if(l.success){a.push(i[c]);continue}s.push({file:t,path:`${r}.options.${c}`,message:`${Iet(l.error.issues[0])}. This row was ignored; the other rows still apply.`,severity:"warning",invalidValue:pr(i[c])})}if(a.length!==i.length)o.options=a;return s}function Pet(e,t){if(!e||typeof e!=="object"||Array.isArray(e))return[];let n=e;if(!("modelPricing"in n)||n.modelPricing===void 0)return[];let r=n.modelPricing;if(!r||typeof r!=="object"||Array.isArray(r))return delete n.modelPricing,[{file:t,path:"modelPricing",message:`"modelPricing" must be an object; received ${pr(r)}. It was ignored.`,severity:"warning"}];let o=r,s=[];if(o.multiplier!==void 0&&!uL().safeParse(o.multiplier).success)s.push({file:t,path:"modelPricing.multiplier",message:'"multiplier" must be a number in (0, 1]. It was ignored.',severity:"warning",invalidValue:o.multiplier}),delete o.multiplier;if(o.overrides!==void 0){let i=o.overrides;if(!i||typeof i!=="object"||Array.isArray(i))s.push({file:t,path:"modelPricing.overrides",message:`"overrides" must be an object mapping model ID to rates; received ${pr(i)}. It was ignored.`,severity:"warning"}),delete o.overrides;else{let a=i;for(let c of Object.keys(a)){let l=lL().safeParse(a[c]);if(l.success&&c!=="constructor"&&c!=="__proto__")continue;let u=l.success?void 0:l.error.issues[0];s.push({file:t,path:`modelPricing.overrides.${ra(c)}`,message:`Invalid pricing row was ignored (${u?`${u.path.join(".")||"row"}: ${u.message}`:"not a model ID"}).`,severity:"warning",invalidValue:a[c]}),delete a[c]}}}return s}function Iet(e){if(!e)return"Invalid modelPicker row";return`modelPicker row ${e.path.length>0?`"${e.path.join(".")}" `:""}${e.message}`.trim()}function Det(e,t,n){if(!e||typeof e!=="object"||Array.isArray(e))return[];let r=e,o=r.crossSessionInbound;if(o===void 0||Let(o))return[];if(n?.policySource)r.crossSessionInbound="refuse";else delete r.crossSessionInbound;return[Uet(o,t,n?.policySource===!0)]}function Let(e){return typeof e==="string"&&Uh.includes(e)}var Net="crossSessionInbound";function Met(e){let t=Uh.map((r)=>`"${r}"`).join(", "),n=typeof e==="string"?`"${ra(e).replace(/^<key>$/,"<value>")}"`:pr(e);return`must be one of ${t}; received ${n}`}function Uet(e,t,n=!1){let r=Uh.map((s)=>`"${s}"`).join(", "),o=n?'In managed settings an unrecognized value is treated as "refuse" (the most restrictive): cross-session messages to this session are turned away until an administrator fixes it.':"This value was ignored; while it is present, cross-session messages are held for your approval instead of being delivered. Set it to one of the values above.";return{file:t,path:Net,message:`"crossSessionInbound" ${Met(e)}. ${o}`,severity:"warning",expected:r,...n&&{statusOnly:!0}}}function Pc(e,t,n){return[...cQ(e,t),...Eet(e,t),...vet(e,t),...Ret(e,t),...Oet(e,t),...Pet(e,t),...Det(e,t,{policySource:n?.policySource}),...n?.skipMcpServerEntryFilter?[]:Tet(e,t,{keepWholeFieldInvalid:n?.mcpServerEntrySalvageOnly})]}function EL(e){let t=new Set(e.allowedSources);return t.add("flagSettings"),t.add("policySettings"),IX.filter((n)=>t.has(n))}function zet(){return jo(wc(),"managed-settings.json")}function xL(e){if(Tr()==="wsl"&&e.wslInherits?.()){let t=_L(Od,e.store);if(t.settings)return t;let n=_L(wc(),e.store);return{settings:n.settings,errors:[...t.errors,...n.errors]}}return _L(wc(),e.store)}function jet(e){return e.endsWith(".json")&&!e.startsWith(".")}function _L(e,t){let n=[],r={},o=!1,{settings:s,errors:i}=Pd(jo(e,"managed-settings.json"),t,void 0,!0);if(n.push(...i),s&&Object.keys(s).length>0)r=Bn(r,s,zo),o=!0;let a=jo(e,"managed-settings.d");try{let c=t.folderListingForPolicyWalk(a),l;if(c!==void 0)l=c;else l=tt().readdirSync(a).filter((u)=>(u.isFile()||u.isSymbolicLink())&&jet(u.name)).map((u)=>u.name).sort(),t.noteWalkListing(a,l);for(let u of l){let{settings:p,errors:f}=Pd(jo(a,u),t,void 0,!0);if(n.push(...f),p&&Object.keys(p).length>0)r=Bn(r,p,zo),o=!0}}catch(c){let l=Me(c);if(l!=="ENOENT"&&l!=="ENOTDIR")ce(`managed-settings.d read failed: ${c}`,{level:"error"}),n.push({file:a,path:"",message:`Managed settings drop-in directory could not be read: ${l??"unknown error"}`,severity:"fatal"})}return{settings:o&&Ic(r)?r:null,errors:n}}function Het(e,t){if(wr(e))Zet(t);else ce(`settings file read failed at ${t}: ${e}`,{level:"error"})}function Pd(e,t,n,r){let o=n!==void 0?`${e}\x00pinned`:e,s=t.parsedFiles.get(o);if(s)return{settings:s.settings?yo(s.settings):null,errors:s.errors};let i=Vet(e,n,r);return t.parsedFiles.set(o,i),{settings:i.settings?yo(i.settings):null,errors:i.errors}}function vL(e){if(!e.mdm)return{settings:null,errors:[]};let t=e.mdm();return{settings:Object.keys(t.settings).length>0?t.settings:null,errors:t.errors}}function jE(e,t){let n=hte.get(e),r=n?.get(t);if(r)return{settings:r.settings&&yo(r.settings),errors:r.errors.map((s)=>({...s}))};let o=Bet(e,t);if(n)n.set(t,o);else hte.set(e,new Map([[t,o]]));return{settings:o.settings&&yo(o.settings),errors:o.errors.map((s)=>({...s}))}}var hte=new WeakMap;function Bet(e,t){let n=yo(e),r=Pc(n,t,{skipMcpServerEntryFilter:!0,policySource:!0}),o=[],s=fL(bte(t,o),t).safeParse(n);if(!s.success)return{settings:null,errors:[...r,...Bh(s.error,t)]};return{settings:Object.keys(s.data).length>0?s.data:null,errors:[...r,...o]}}function bte(e,t){return(n)=>{if(t.push({file:e,path:n.path,message:n.message,severity:"warning",...n.statusOnly&&{statusOnly:n.statusOnly},...n.startupFatal&&{startupFatal:n.startupFatal}}),n.statusOnly||n.startupFatal)ce(`${e}: ${n.path}: ${n.message}`,{level:n.startupFatal?"error":"warn"})}}function Ete(e){let t=e?.remote?e.remote():tte();if(!t||Object.keys(t).length===0)return{settings:null,errors:[],servedSnapshot:!1};let{settings:n,errors:r}=jE(t,"remote managed settings");return{settings:n,errors:lte(r),servedSnapshot:Qee(t)}}var Ket="parent managed settings";function Get(e){let t=e.parentManaged;if(!t||Object.keys(t).length===0)return{settings:null,errors:[]};return jE(t,Ket)}function xte(e){let t=e.flagInline;if(!t)return{settings:null,errors:[]};let n=yo(t),r=Pc(n,"SDK inline settings"),o=Rd().safeParse(n);if(!o.success)return{settings:null,errors:[...r,...Bh(o.error,"SDK inline settings")]};if(r.some((s)=>s.severity==="fatal"))return{settings:null,errors:r};return{settings:o.data,errors:r}}var Wet=2097152;function Vet(e,t,n){try{let r;if(t!==void 0)r=t;else{let{resolvedPath:o}=vf(tt(),e);r=xc(o,Wet)}return qet(r,e,n)}catch(r){return Jet(r,e)}}function qet(e,t,n){if(e.trim()==="")return{settings:{},errors:[]};let r=yo(vc(e,!1));if(n){let i=Pc(r,t,{skipMcpServerEntryFilter:!0,policySource:!0}),a=[],c=fL(bte(t,a),t).safeParse(r);if(!c.success)return{settings:null,errors:[...i,...Bh(c.error,t)]};return{settings:c.data,errors:[...i,...a]}}let o=Pc(r,t),s=Rd().safeParse(r);if(!s.success){let i=Bh(s.error,t);return{settings:null,errors:[...o,...i]}}if(o.some((i)=>i.severity==="fatal"))return{settings:null,errors:o};return{settings:s.data,errors:o}}function Zet(e){ce(`Broken symlink or missing file encountered for settings.json at path: ${e}`)}function Yet(){return{settings:null,errors:[]}}function Jet(e,t){if(Het(e,t),wr(e))return Yet();return{settings:null,errors:[{file:t,path:"",message:`Settings file could not be read: ${e instanceof Error?e.message:String(e)}`,severity:"fatal"}]}}function gte(e,t){switch(e){case"userSettings":return to(Wt());case"policySettings":case"projectSettings":return to(t.cwd);case"localSettings":return vte(t.cwd,t.canonicalGitRoot);case"flagSettings":return t.flagPath?$et(to(t.flagPath)):to(t.cwd)}}function vte(e,t){let n=Xet(e,t);if(n.decided!==void 0)return n.decided;if(!ttt(n.root))return n.cwdResolved;return n.root}function Xet(e,t){let n=t?.(e);if(!n)return{decided:to(e)};let r=to(n),o=to(e);if(r===o)return{decided:r};let s;try{s=ntt()}catch{return{decided:o}}if(r===s)return{decided:o};return{decided:void 0,root:r,cwdResolved:o}}function Qet(e){return Ec().localStoreProbes.canonicalRootOwnerUids(e,ett)}function ett(e){let t=tt(),n=null;try{n=t.lstatSync(jo(e,".claude")).uid}catch(r){if(!wr(r))throw r}return{rootUid:t.statSync(e).uid,gitEntryUid:t.lstatSync(jo(e,".git")).uid,claudeEntryUid:n}}function ttt(e){if(typeof process.getuid!=="function"&&typeof process.geteuid!=="function")return ce(`localSettings: not canonicalizing the consent store to ${e} — this platform has no uid semantics to verify directory ownership with, so the store stays at the session cwd (canonicalization is POSIX-only)`,{level:"warn"}),!1;let t=typeof process.geteuid==="function"?process.geteuid():process.getuid?.();try{let{rootUid:n,gitEntryUid:r,claudeEntryUid:o}=Qet(e);if(n===t&&r===t&&(o===null||o===t))return!0;return ce(`localSettings: not canonicalizing the consent store to ${e} — it (uid ${n}), its .git entry (uid ${r}), or its .claude entry (uid ${o??"absent"}) is not owned by the current user (uid ${t}); the store stays at the session cwd (the pre-canonicalization behavior). If you own this repo, chown it (including .git and .claude) or run from a directory you own.`,{level:"warn"}),!1}catch(n){return ce(`localSettings: not canonicalizing the consent store to ${e} — its ownership could not be verified (${n instanceof Error?n.message:String(n)}); the store stays at the session cwd`,{level:"warn"}),!1}}function ntt(){return Ec().localStoreProbes.normalizedRealHomeDir(rtt)}function rtt(){let e=zx(Fet());if(e===null)throw Error("home directory realpath unavailable");return it(e)}var _te={default:"settings.json",cowork:"cowork_settings.json"};function ott(e){if(e.coworkPlugins||Mn.CLAUDE_CODE_USE_COWORK_PLUGINS)return _te.cowork;return _te.default}function Kh(e,t){switch(e){case"userSettings":return jo(gte(e,t),ott(t));case"projectSettings":case"localSettings":return jo(gte(e,t),wte(e));case"policySettings":return zet();case"flagSettings":return t.flagPath}}function wte(e){switch(e){case"projectSettings":return jo(".claude","settings.json");case"localSettings":return jo(".claude","settings.local.json")}}function Ate(e){if(vte(e.cwd,e.canonicalGitRoot)===to(e.cwd))return;return jo(to(e.cwd),wte("localSettings"))}function Tte(e,t){let n=t.store.perSource.get(e);if(n!==void 0)return n;let r=Ott(e,t);return t.store.perSource.set(e,r),r}function stt(e,t=!1){return!e||e.parentSettingsBehavior==="merge"||t}var itt=[["permissions","defaultMode"],["modelPicker","replaceBuiltInOptions"]];function att(e){let t={};for(let{path:n,restrictive:r}of wh){let o=Vs(e,n);if(n[0]==="sandbox"&&Ah(r).includes(o))ea(t,n,o)}return t.sandbox??{}}function ctt(e,t){let n={};if(e.allowManagedHooksOnly===!0)n.allowManagedHooksOnly=!0;if(e.disableCommandPluginSources===!0)n.disableCommandPluginSources=!0;if(e.allowManagedMcpServersOnly===!0)n.allowManagedMcpServersOnly=!0;if(e.disableClaudeAiConnectors===!0)n.disableClaudeAiConnectors=!0;if(e.syncClaudeAiSkills===!1)n.syncClaudeAiSkills=!1;if(e.syncClaudeAiPlugins===!1)n.syncClaudeAiPlugins=!1;if(e.allowManagedPermissionRulesOnly===!0)n.allowManagedPermissionRulesOnly=!0;if(nte(e.attribution,e.includeCoAuthoredBy)==="disabled")n.attribution={...n.attribution,commitTrailers:!1};if(e.attribution?.sessionUrl===!1)n.attribution={...n.attribution,sessionUrl:!1};let r=e.strictPluginOnlyCustomization;if(r===!0||Array.isArray(r)&&r.length>0)n.strictPluginOnlyCustomization=r;if(e.deniedMcpServers)n.deniedMcpServers=e.deniedMcpServers;if(t.forceLoginOrgUUID===void 0&&e.forceLoginOrgUUID)n.forceLoginOrgUUID=e.forceLoginOrgUUID;if(t.allowedMcpServers===void 0&&e.allowedMcpServers)n.allowedMcpServers=e.allowedMcpServers;if(t.availableModels===void 0&&e.availableModels)n.availableModels=e.availableModels;if(e.enforceAvailableModels===!0)n.enforceAvailableModels=!0;if(e.permissions){let o=Rh(e.permissions,["deny","ask"]);if(e.permissions.disableBypassPermissionsMode==="disable")o.disableBypassPermissionsMode="disable";if(e.permissions.blockReadsOutsideWorkingDirectories===!0)o.blockReadsOutsideWorkingDirectories=!0;if(t.allowManagedPermissionRulesOnly!==!0){let{allow:s,additionalDirectories:i}=e.permissions;if(s&&t.sandbox?.network?.allowManagedDomainsOnly!==!0)o.allow=s;if(i)o.additionalDirectories=i}if(Object.keys(o).length>0)n.permissions=o}if(e.sandbox){let{network:o,filesystem:s,credentials:i}=e.sandbox,a={},c=o?Rh(o,["deniedDomains"]):{},l=s?Rh(s,["denyRead","denyWrite"]):{};if(o){if(t.sandbox?.network?.allowManagedDomainsOnly!==!0&&o.allowedDomains)c.allowedDomains=o.allowedDomains}if(Object.keys(c).length>0)a.network=c;if(s){if(t.sandbox?.filesystem?.allowManagedReadPathsOnly!==!0&&s.allowRead)l.allowRead=s.allowRead}if(Object.keys(l).length>0)a.filesystem=l;if(i){let u=(i.files??[]).map((m)=>m.mode==="deny"?{path:m.path,mode:"deny"}:{path:m.path,mode:"mask",injectHosts:[]}),p=(i.envVars??[]).filter((m)=>m.mode==="deny").map((m)=>({name:m.name,mode:"deny"})),f={...u.length>0&&{files:u},...p.length>0&&{envVars:p}};if(i.sigv4){let m={};for(let h of["streaming","presigned","sigv4a"])if(i.sigv4[h]==="deny")m[h]="deny";f.sigv4=m}{let m=Cte(i.awsPairs??[],[]);if(m.length>0)f.awsPairs=m}if(Object.keys(f).length>0)a.credentials=f}if(Bn(a,att(e)),Object.keys(a).length>0)n.sandbox=a}return n}function Cte(e,t){let n=ta,r=new Set(t.flatMap(yte));return Ar(e.flatMap(yte)).filter((o)=>n.includes(o)&&!r.has(o)).map((o,s)=>({accessKeyIdVar:o,secretAccessKeyVar:`${yE}${s+1}_`}))}function yte(e){if(!It(e))return[];return[e.accessKeyIdVar,e.secretAccessKeyVar,e.sessionTokenVar].filter((t)=>typeof t==="string")}var ltt=new Set([...[...FD].filter((e)=>e!=="ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION"),...$D,"CLAUDE_CODE_AUTO_MODE_MODEL","CLAUDE_CODE_BG_CLASSIFIER_MODEL","CLAUDE_CONTEXT_COLLAPSE_MODEL","CLAUDE_CODE_SUBAGENT_MODEL_FORCE"]);function utt(e,t){if(!t||!e)return null;let n={};if(e.model!==void 0)n.model=e.model;if(e.availableModels!==void 0)n.availableModels=e.availableModels;if(e.enforceAvailableModels!==void 0)n.enforceAvailableModels=e.enforceAvailableModels;if(e.fallbackModel!==void 0)n.fallbackModel=e.fallbackModel;if(e.modelPicker!==void 0)n.modelPicker=e.modelPicker;return Object.keys(n).length>0?n:null}function zE(e){if(delete e.model,delete e.fallbackModel,delete e.modelPicker,delete e.modelOverrides,e.env){let t={};for(let[n,r]of Object.entries(e.env))if(!ltt.has(n.toUpperCase()))t[n]=r;e.env=t}}function dtt(){return Tr()==="macos"?"plist":"hklm"}function kte(e){let t=wL(e);if(t.composes==="tier")return"helper";let n=SL(e);if(t.composes==="remoteSlot"||n.present.remote)return"remote";if(n.present.mdm)return dtt();if(n.present.file)return"file";if(n.parentSlice||n.hostModelOverlay)return"parent";let r=e.hkcu?.();return r&&Object.keys(r.settings).length>0?"hkcu":null}function SL(e){let t=[],{settings:n,errors:r,servedSnapshot:o}=Ete(e);t.push(...r);let s=wL(e),i=s.composes==="remoteSlot"?s.helper:yL(n),{settings:a,errors:c}=vL(e);t.push(...c);let l=yL(a),{settings:u,errors:p}=e.file?.()??xL(e);t.push(...p);let f=yL(u),{settings:m,errors:h}=Get(e);t.push(...h);let y=m!==null&&(l===null&&f===null||(l??f)?.parentSettingsBehavior==="merge"),_=[_tt(i,o&&s.composes!=="remoteSlot",[l,f,...y?[Rh(m,gtt)]:[]]),l,f].filter((re)=>re!==null),S=(s.composes==="remoteSlot"?s.helper:[n,a,u].find((re)=>re!==null&&(re===n&&o?i!==null:re.managedSourcesBehavior!==void 0||Ic(re))))?.managedSourcesBehavior,x=i!==null&&o&&s.composes!=="remoteSlot",{admin:v,merged:w}=ptt(_,S,x),U={remote:i!==null,mdm:l!==null,file:f!==null},L=(re)=>re!==null&&(re===_[0]||Object.keys(mE(re,Nte())).length>0),F={remote:L(i),mdm:L(l),file:L(f)},K={allowManagedPermissionRulesOnly:_.some((re)=>re.allowManagedPermissionRulesOnly===!0)||void 0,forceLoginOrgUUID:v?.forceLoginOrgUUID,allowedMcpServers:v?.allowedMcpServers,availableModels:v?.availableModels,sandbox:{network:{allowManagedDomainsOnly:_.some((re)=>re.sandbox?.network?.allowManagedDomainsOnly===!0)||void 0},filesystem:{allowManagedReadPathsOnly:_.some((re)=>re.sandbox?.filesystem?.allowManagedReadPathsOnly===!0)||void 0}}},ne=m&&stt(v,x&&!U.mdm&&!U.file)?ctt(m,K):null,se=ne&&Object.keys(ne).length>0?ne:null,X=utt(m,e.hostManagedProvider);return{tiers:_,admin:v,parentSlice:se,hostModelOverlay:X,errors:t,present:U,merged:w,composed:F,snapshotFirst:x}}function ptt(e,t,n){let r=e[0];if(!r)return{admin:null,merged:!1};let{managedSourcesBehavior:o,...s}=r;if(t!=="merge"||e.length<2)return{admin:o===void 0?r:s,merged:!1};let i=e.slice(1).map((c,l)=>{let u=n&&l===0?{...c}:mE(c,Nte());if(!(n&&l===0)){for(let f of itt)if(Vs(u,f)!==void 0)ea(u,f,void 0)}let p=Vs(u.sandbox,["enabledPlatforms"]);if(Array.isArray(p)&&p.includes(Tr()))ea(u,["sandbox","enabledPlatforms"],void 0);else if(p!==void 0)delete u.sandbox;return u}),a={};for(let c of[...i].reverse())Bn(a,c,bL);return Bn(a,s,n?ytt:bL),Stt(a,[r,...i]),ftt(a,[r,...i],n),{admin:a,merged:!0}}var Rte=["managedSourcesBehavior","wslInheritsWindowsSettings"];function Ic(e){return Object.keys(e).some((t)=>!Rte.includes(t))}function yL(e){return e&&Ic(e)?e:null}function ftt(e,t,n){let r=t.findIndex((s)=>s.availableModels!==void 0),o=t.findIndex((s)=>s.modelOverrides!==void 0);if(o!==-1&&(r===-1||o<=r||n&&r===0))e.modelOverrides={...t[o].modelOverrides};else delete e.modelOverrides}var Ote=["allowedMcpServers","availableModels","strictKnownMarketplaces","allowedChannelPlugins"],mtt=["awsPairs","ripgrep"];function Pte(e,t,n){if(t===void 0)return e;if(Array.isArray(t))return n==="awsPairs"&&Array.isArray(e)?[...t,...Cte(e,t)]:[...t];if(!It(t))return t;return jd(t,(r)=>Array.isArray(r)?[...r]:r)}var htt=["allowedMcpServers","availableModels","strictKnownMarketplaces","allowedChannelPlugins","allowedMarketplaces","allowedHttpHookUrls","httpHookAllowedEnvVars"],gtt=["allowedMcpServers","availableModels"];function _tt(e,t,n){if(e===null||!t)return e;let r=htt.filter((o)=>n.some((s)=>s?.[o]!==void 0));return r.length===0?e:mE(e,r)}function bL(e,t,n){if(n!==void 0&&(Ote.includes(n)||mtt.includes(n)))return Pte(e,t,n);return Ite(e,t,n)}function ytt(e,t,n){if(n!==void 0&&Ote.includes(n))return Pte(e,t,n);return Ite(e,t,n)}function Ite(e,t,n){if(Array.isArray(e)&&Array.isArray(t)&&n!=="fallbackModel")return Ar([...t,...e]);return zo(e,t,n)}function Stt(e,t){let n=t[0],r=e;for(let{path:o,restrictive:s}of wh){let i=Ah(s),a=Math.min(...t.map((c)=>i.indexOf(Vs(c,o))).filter((c)=>c!==-1));if(Number.isFinite(a))ea(r,o,i[a]);else if(Vs(n,o)===void 0&&Vs(e,o)!==void 0)ea(r,o,void 0)}if(e.strictPluginOnlyCustomization!==!0){let o=Ar(t.flatMap((s)=>Array.isArray(s.strictPluginOnlyCustomization)?s.strictPluginOnlyCustomization:[]));if(o.length>0)e.strictPluginOnlyCustomization=o;else if(n?.strictPluginOnlyCustomization===void 0)delete e.strictPluginOnlyCustomization}}function wL(e){let t=e.helper?.()??null;if(!t)return{composes:"none"};let n=e.helperArmedFromRemote?.()===!1?"tier":"remoteSlot";if(e.helperMergesOutput?.()!==!0)return{composes:n,helper:t,mergedOver:null};if(!e.store.policy.mergedHelper){let r,o;if(n==="remoteSlot")r=Ete(e).settings,o="remote";else if(r=vL(e).settings)o=Tr()==="macos"?"plist":"hklm";else r=(e.file?.()??xL(e)).settings,o="file";e.store.policy.mergedHelper={helper:vtt(r,t),mergedOver:Object.keys(Dte(r)).length>0?o:null}}return{composes:n,...e.store.policy.mergedHelper}}function Dte(e){let{policyHelper:t,policyHelpers:n,...r}=e??{};return r}function btt(e,t){let n=new Map;for(let[o,s]of Object.entries(t)){let i=o.toUpperCase();if(!n.has(i))n.set(i,s)}let r={};for(let[o,s]of Object.entries(e))r[o]=n.get(o.toUpperCase())??s;return Object.assign(r,t)}var Ett=["forceLoginOrgUUID","allowedHttpHookUrls","httpHookAllowedEnvVars","allowRead"];function xtt(e,t,n){let r=n!==void 0&&t!==void 0&&Ett.includes(n)?t:bL(e,t,n);return r===t&&Array.isArray(r)?[...r]:r}function vtt(e,t){let n=Dte(e),r=Bn({},n,t,xtt);if(n.env&&t.env)r.env=btt(n.env,t.env);return r}var Lte=["apiKeyHelper","awsAuthRefresh","awsCredentialExport","gcpAuthRefresh"];var wtt=[...Lte,"otelHeadersHelper","proxyAuthHelper","forceLoginOrgUUID","forceLoginMethod","forceLoginGatewayUrl","parentSettingsBehavior","env","modelPicker",...Rte];function Nte(){return wtt}function Att(e){return bQ.some((t)=>e.startsWith(t))||SQ.includes(e)}function Ttt(e,t,n,r=0){let o=new Map,s=new Map,i=!1;for(let[a,c]of e.entries()){let l=new Set,u=t?.[a]===!0;for(let[p,f]of Object.entries(c??{})){let m=p.toUpperCase(),h=Att(m);if(h&&f.trim()==="")continue;if(h&&i)continue;if(h&&a>r&&t?.[a]===!0)continue;let y=o.get(m);if(y!==void 0){if(l.has(m))s.set(p,f);else if(!s.has(p))s.set(p,y);continue}if(a>r&&n?.[a]?.has(m))continue;if(s.set(p,f),l.add(m),o.set(m,f),h)u=!0}if(u)i=!0}return Object.fromEntries(s)}var Ctt="CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION";function Ste(e){if(!e)return;let t={};for(let[n,r]of Object.entries(e))if(n.toUpperCase()!==Ctt)t[n]=r;return t}function ktt(e,t){let n=Object.entries(e??{}),r=t??{};return n.length===Object.keys(r).length&&n.every(([o,s])=>r[o]===s)}function Rtt(e){let t=vL(e);return t.settings?t.errors:[...t.errors,...(e.file?.()??xL(e)).errors]}function Mte(e){let t=wL(e),n=e.helperWarnings?.()??[];if(t.composes==="tier"){let{helper:y}=t;e.store.lastPolicyEnvComposition=null;let _=e.hostManagedProvider?{...y}:y;if(e.hostManagedProvider)zE(_);e.store.policy.pairedModelOverrides={value:e.hostManagedProvider&&y.availableModels!==void 0?y.modelOverrides:void 0};let E=e.store.policy.helperBaseStatusNotices??=[...e.helperMergesOutput?.()===!0?Rtt(e).filter((S)=>!S.statusOnly):[],...SL(e).errors.filter((S)=>S.statusOnly)];return{settings:_,errors:[...E,...n]}}let{tiers:r,admin:o,parentSlice:s,hostModelOverlay:i,errors:a,present:c,snapshotFirst:l}=SL(e);if(a.push(...n),!o&&!s){e.store.lastPolicyEnvComposition=null,e.store.policy.pairedModelOverrides={value:void 0};let y=e.hkcu?.();if(y&&Object.keys(y.settings).length>0){let _=e.hostManagedProvider?{...y.settings}:y.settings;if(e.hostManagedProvider){if(zE(_),i)Object.assign(_,i)}return{settings:_,errors:[...a,...y.errors]}}if(i)return{settings:{...i},errors:[...a,...y?.errors??[]]};return{settings:null,errors:[...a,...y?.errors??[]]}}let u=Bn({},s??{},o??{},zo);if(r.some((y)=>y.forceRemoteSettingsRefresh===!0))u.forceRemoteSettingsRefresh=!0;let p=Mn.CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION===!0,f=u.env;if(!p){let y=Ttt(r.map((_)=>_.env),r.map((_)=>(_.otelHeadersHelper??"").trim()!==""),r.map((_)=>{let E=new Set;for(let S of Lte){let x=_[S];if(typeof x==="string"&&x.trim()!=="")for(let v of EQ[S])E.add(v)}return E.size>0?E:void 0}),l?1:0);if(Object.keys(y).length>0)u.env=y;else delete u.env}if(u.env){let y=Ste(u.env);if(y&&Object.keys(y).length>0)u.env=y;else delete u.env}if(e.hostManagedProvider){if(zE(u),i)Object.assign(u,i)}let m={env:Ste(f)};if(e.hostManagedProvider)zE(m);let h=!p&&!ktt(u.env,m.env);return e.store.lastPolicyEnvComposition={unionOptedOut:p,unionChangedEnv:h,remoteTierPresent:c.remote,mdmTierPresent:c.mdm,fileTierPresent:c.file,adminTierCount:r.length,tiersWithEnv:xf(r,(y)=>Object.keys(y.env??{}).length>0)},e.store.policy.pairedModelOverrides={value:e.hostManagedProvider&&o?.availableModels!==void 0&&o.modelOverrides!==void 0&&i?.availableModels===void 0?o.modelOverrides:void 0},{settings:u,errors:a}}function Ott(e,t,{includeLegacyLocalSettings:n=!0}={}){if(e==="policySettings")return Mte(t).settings;let r=Kh(e,t),{settings:o}=r?Pd(r,t.store,e==="flagSettings"?t.flagExpectedContent:void 0):{settings:null};if(e==="flagSettings"){let{settings:s}=xte(t);if(s)return Bn(o||{},s,zo)}if(e==="localSettings"&&n){let s=Ate(t);if(s){let{settings:i}=Pd(s,t.store);if(i)return t.onLegacyLocalSettingsRead?.("per_source"),Bn(i,o||{},zo)}}return o}function Ptt(e,t){return{...e,...t}}function zo(e,t,n){if(n==="modelPicker"&&t!==void 0)return Ute(t);if(Array.isArray(e)&&Array.isArray(t)){if(n==="fallbackModel")return t;return Ar([...e,...t])}if(n==="extraKnownMarketplaces"&&It(e)&&It(t))return Ptt(e,t);return}function Ute(e){if(!It(e))return e;let t=e.options;return{...e,...Array.isArray(t)&&{options:t.map((n)=>It(n)?{...n}:n)}}}function Itt(e){if(e.store.isLoadingFromDisk)return{settings:{},errors:[]};let t=Date.now();xh("info","settings_load_started"),e.store.isLoadingFromDisk=!0;try{let n=e.store.pluginBase,r={};if(n)r=Bn(r,n,zo);let o=[],s=new Set,i=new Set,a=(l)=>{for(let u of l){let p=`${u.file}:${u.path}:${u.message}`;if(!s.has(p))s.add(p),o.push(u)}},c=null;for(let l of EL(e)){if(l==="policySettings"){let{settings:p,errors:f}=Mte(e);if(c=p,p)r=Bn(r,p,zo);a(f);continue}if(l==="localSettings"){let p=Ate(e);if(p&&!i.has(to(p))){i.add(to(p));let{settings:f,errors:m}=Pd(p,e.store);if(a(m),f)e.onLegacyLocalSettingsRead?.("cascade"),r=Bn(r,f,zo)}}let u=Kh(l,e);if(u){let p=to(u),f=l==="flagSettings"&&e.flagExpectedContent!==void 0;if(!i.has(p)||f){i.add(p);let{settings:m,errors:h}=Pd(u,e.store,l==="flagSettings"?e.flagExpectedContent:void 0);if(a(h),m)r=Bn(r,m,zo)}}if(l==="flagSettings"){let{settings:p,errors:f}=xte(e);if(a(f),p)r=Bn(r,p,zo)}}if(c){if(c.availableModels!==void 0)r.availableModels=[...c.availableModels];if(c.enforceAvailableModels!==void 0)r.enforceAvailableModels=c.enforceAvailableModels;if(c.modelPicker!==void 0)r.modelPicker=Ute(c.modelPicker)}return xh("info","settings_load_completed",{duration_ms:Date.now()-t,source_count:i.size,error_count:o.length}),{settings:r,errors:o}}finally{e.store.isLoadingFromDisk=!1}}function Dtt(e){let t=e.store.mergedSettings;if(t!==null)return t;let n=Itt(e);return e.store.mergedSettings=n,n}function Ltt(e){let{settings:t}=Dtt(e);return t||{}}function Fte(e){e.store.invalidateAll();let t=[];for(let n of EL(e)){let r=Tte(n,e);if(r&&Object.keys(r).length>0)t.push({source:n,settings:r})}return{effective:Ltt(e),sources:t}}function $te(e,t){let n=EL(t);for(let r=n.length-1;r>=0;r--){let o=n[r];if(Tte(o,t)?.[e]!==void 0)return o}return null}import{execFile as Ntt}from"child_process";import{existsSync as Mtt}from"fs";class zte{promise=null;start(){if(this.promise)return;this.promise=AL()}reset(){this.promise=null}}var Utt=new zte;function Ftt(e){if(!e)return{status:"ok",exitCode:0,errno:null,signal:null};let t=e,n=typeof t.signal==="string"&&t.signal?t.signal:null;if(typeof t.code==="string")return{status:"spawn_error",exitCode:null,errno:t.code,signal:null};if(t.killed===!0)return{status:"timeout",exitCode:null,errno:null,signal:n};if(n)return{status:"killed",exitCode:null,errno:null,signal:n};return{status:"exited",exitCode:typeof t.code==="number"?t.code:null,errno:null,signal:null}}function Gh(e,t){let n=Date.now();return new Promise((r)=>{try{Ntt(e,t,{encoding:"utf-8",timeout:ite,windowsHide:!0},(o,s)=>{r({stdout:s??"",...Ftt(o),durationMs:Date.now()-n})})}catch(o){let s=o.code;r({stdout:"",status:"spawn_error",exitCode:null,errno:typeof s==="string"?s:null,signal:null,durationMs:Date.now()-n})}})}function HE(e){return{status:e.status,exitCode:e.exitCode,errno:e.errno,signal:e.signal,durationMs:e.durationMs}}function AL(){return(async()=>{if(process.platform==="darwin"){let e=ate(),n=(await Promise.all(e.map(async({path:r,label:o})=>{if(!Mtt(r))return{stdout:"",label:o,ok:!1};let{stdout:s,status:i}=await Gh(ote,[...ste,r]);return{stdout:s,label:o,ok:i==="ok"&&!!s}}))).find((r)=>r.ok);return{plistStdouts:n?[{stdout:n.stdout,label:n.label}]:[],hklmStdout:null,hkcuStdout:null,outcomes:{hklm:null,hkcu:null}}}if(process.platform==="win32"){let t=`${process.env.SYSTEMROOT||"C:\\Windows"}\\System32\\reg.exe`,[n,r]=await Promise.all([Gh(t,["query",$h,"/v",oa]),Gh(t,["query",zh,"/v",oa])]);return{plistStdouts:null,hklmStdout:n.status==="ok"?n.stdout:null,hkcuStdout:r.status==="ok"?r.stdout:null,outcomes:{hklm:HE(n),hkcu:HE(r)}}}if(jh()){let[e,t]=await Promise.all([Gh(gL,["query",$h,"/v",oa]),Gh(gL,["query",zh,"/v",oa])]);return{plistStdouts:null,hklmStdout:e.status==="ok"?e.stdout:null,hkcuStdout:t.status==="ok"?t.stdout:null,outcomes:{hklm:HE(e),hkcu:HE(t)}}}return{plistStdouts:null,hklmStdout:null,hkcuStdout:null,outcomes:{hklm:null,hkcu:null}}})()}function jte(){return Utt.promise}var sa=Object.freeze({settings:{},errors:[]});class Wte{mdm=null;hkcu=null;wslInherits=!1;loadPromise=null;startLoad(e){if(this.loadPromise)return;this.loadPromise=(async()=>{let t=Date.now(),r=await(jte()??AL()),{mdm:o,hkcu:s,wslInherits:i}=await Wtt(r,e);this.replace(o,s,i);let a=Date.now()-t;ce(`MDM settings load completed in ${a}ms`);try{Li("tengu_managed_settings_os_read",Gtt(r,a))}catch{}if(Object.keys(o.settings).length>0){ce(`MDM settings found: ${Object.keys(o.settings).join(", ")}`);try{xh("info","mdm_settings_loaded",{duration_ms:a,key_count:Object.keys(o.settings).length,error_count:o.errors.length})}catch{}}})()}replace(e,t,n){this.mdm=e,this.hkcu=t,this.wslInherits=n}reset(){this.mdm=null,this.hkcu=null,this.wslInherits=!1,this.loadPromise=null}}var $tt=new nt(()=>new Wte);function Wh(){return $tt.of(Ct().host)}function ztt(e){Wh().startLoad(e)}async function Vte(){let e=Wh();if(!e.loadPromise)ztt();await e.loadPromise}function qte(){return Wh().mdm??sa}function Zte(){return Wh().hkcu??sa}function Yte(){return Wh().wslInherits}function TL(e,t){let n=vc(e,!1);if(!n||typeof n!=="object")return{settings:{},errors:[]};let{settings:r,errors:o}=jE(n,t);return{settings:r??{},errors:o}}function Hte(e,t="Settings"){let n=e.split(/\r?\n/),r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`^\\s+${r}\\s+REG_(?:EXPAND_)?SZ\\s+(.*)$`,"i");for(let s of n){let i=s.match(o);if(i&&i[1])return i[1].trimEnd()}return null}var jtt=new Map([["ENOENT",Tn("ENOENT")],["EACCES",Tn("EACCES")],["EPERM",Tn("EPERM")],["ENOEXEC",Tn("ENOEXEC")],["EAGAIN",Tn("EAGAIN")],["EMFILE",Tn("EMFILE")],["ENOMEM",Tn("ENOMEM")],["ETIMEDOUT",Tn("ETIMEDOUT")],["ERR_CHILD_PROCESS_STDIO_MAXBUFFER",Tn("ERR_CHILD_PROCESS_STDIO_MAXBUFFER")]]),Htt=new Map([["SIGTERM",Tn("SIGTERM")],["SIGKILL",Tn("SIGKILL")],["SIGINT",Tn("SIGINT")]]);function Btt(e){if(!e)return;return jtt.get(e)??Tn("other")}function Ktt(e){if(!e)return;return Htt.get(e)??Tn("other")}function Bte(e,t){if(!t)return{};return{[`${e}_status`]:yi(t.status),[`${e}_exit_code`]:t.exitCode??void 0,[`${e}_errno`]:Btt(t.errno),[`${e}_signal`]:Ktt(t.signal),[`${e}_duration_ms`]:t.durationMs}}function Gtt(e,t){return{is_wsl:jh(),await_ms:t,...Bte("hklm",e.outcomes.hklm),...Bte("hkcu",e.outcomes.hkcu)}}async function Wtt(e,t){let n=[];if(e.plistStdouts&&e.plistStdouts.length>0){let{stdout:a,label:c}=e.plistStdouts[0],l=TL(a,c);if(Ic(l.settings))return{mdm:l,hkcu:sa,wslInherits:!1};n.push(...l.errors)}let r=null;if(e.hklmStdout){let a=Hte(e.hklmStdout);if(a)r=TL(a,`Registry: ${$h}\\${oa}`)}if(r)n.push(...r.errors);let o=n.length>0?{settings:{},errors:n}:sa,s=jh(),i=!1;if(s){if(i=r?.settings.wslInheritsWindowsSettings===!0||await qtt(t),!i)return{mdm:o,hkcu:sa,wslInherits:!1}}if(r){if(Ic(r.settings))return{mdm:r,hkcu:sa,wslInherits:i}}if(await Vtt(i,t))return{mdm:o,hkcu:sa,wslInherits:i};if(e.hkcuStdout){let a=Hte(e.hkcuStdout);if(a){let c=TL(a,`Registry: ${zh}\\${oa}`);if(!s||c.settings.wslInheritsWindowsSettings===!0){let{wslInheritsWindowsSettings:l,managedSourcesBehavior:u,...p}=c.settings;return{mdm:o,hkcu:{settings:p,errors:c.errors},wslInherits:i}}if(c.errors.length>0)return{mdm:o,hkcu:{settings:{},errors:c.errors},wslInherits:i}}}return{mdm:o,hkcu:sa,wslInherits:i}}async function Jte(e,t){if(ye()&&t!==void 0)return(await HX(e)).content;return xc(e)}async function Xte(e,t){if(ye()&&t!==void 0)return await tt().readdir(e);return tt().readdirSync(e)}async function Vtt(e,t){if(e&&await Gte(Od,t))return!0;return Gte(wc(),t)}async function Kte(e,t){let n=yo(vc(await Jte(e,t),!1));if(!n||typeof n!=="object")return!1;return Pc(n,e,{skipMcpServerEntryFilter:!0,policySource:!0}),Ic(n)}async function qtt(e){async function t(n){try{let r=vc(await Jte(n,e),!1);return!!r&&typeof r==="object"&&"wslInheritsWindowsSettings"in r&&r.wslInheritsWindowsSettings===!0}catch{return!1}}if(await t(Id(Od,"managed-settings.json")))return!0;try{let n=Id(Od,"managed-settings.d");for(let r of await Xte(n,e))if((r.isFile()||r.isSymbolicLink())&&r.name.endsWith(".json")&&!r.name.startsWith(".")&&await t(Id(n,r.name)))return!0}catch{}return!1}async function Gte(e,t){try{if(await Kte(Id(e,"managed-settings.json"),t))return!0}catch{}try{let n=Id(e,"managed-settings.d"),r=await Xte(n,t);for(let o of r){if(!(o.isFile()||o.isSymbolicLink())||!o.name.endsWith(".json")||o.name.startsWith("."))continue;try{if(await Kte(Id(n,o.name),t))return!0}catch{}}}catch{}return!1}var Ytt={user:"userSettings",project:"projectSettings",local:"localSettings"},Qte={userSettings:"user",projectSettings:"project",localSettings:"local",flagSettings:"flag",policySettings:"managed"},Jtt=["user","project","local"],Xtt=new Set(["bypassPermissions","auto","acceptEdits"]),Qtt=new Set(["project"]),ent=new Set(["project","local"]);function tnt(e){let t=e.effective.permissions?.defaultMode;if(!t||!Xtt.has(t))return e.effective;for(let n=e.sources.length-1;n>=0;n--){let r=e.sources[n];if(r.settings.permissions?.defaultMode!==void 0){if((DX.includes(t)?ent:Qtt).has(r.source)){let{defaultMode:s,...i}=e.effective.permissions??{};return{...e.effective,permissions:i}}return e.effective}}return e.effective}async function ene(e={}){await Vte();let t={store:new dg,cwd:Ztt(e.cwd??tt().cwd()),allowedSources:(e.settingSources??Jtt).map((a)=>Ytt[a]),parentManaged:e.managedSettings??null,flagInline:null,flagPath:void 0,mdm:qte,hkcu:Zte,wslInherits:Yte,...e.serverManagedSettings!==void 0&&{remote:()=>e.serverManagedSettings}},{effective:n,sources:r}=Fte(t),o=kte(t)??void 0,s=r.map(({source:a,settings:c})=>({source:Qte[a],settings:c,path:a==="policySettings"?void 0:Kh(a,t),...a==="policySettings"&&{policyOrigin:o}})),i={};for(let a of Object.keys(n)){let c=$te(a,t);if(c)i[a]={source:Qte[c],path:c==="policySettings"?void 0:Kh(c,t),...c==="policySettings"&&{policyOrigin:o}}}return{effective:n,provenance:i,sources:s}}process.env.NoDefaultCurrentDirectoryInExePath="1";async function NZt(e){return ene(e)}var dnt=["enabledPlugins","extraKnownMarketplaces","additionalMarketplaces"];function tne(e){let t;try{t=lt(Mu(e.toString("utf8")))}catch{return e}if(!nne(t))return e;let n=!1;for(let o of dnt)if(Object.hasOwn(t,o))delete t[o],n=!0;let r=t.env;if(nne(r)&&Object.hasOwn(r,"CLAUDE_CONFIG_DIR"))delete r.CLAUDE_CONFIG_DIR,n=!0;return n?me(t):e}function nne(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}async function pnt(e,t){if(!e)return;let n=e;try{let r=lt(e);if(r?.claudeAiOauth?.refreshToken)delete r.claudeAiOauth.refreshToken,n=me(r)}catch{}await ine(t,n,{mode:384})}function fnt(){if(process.platform!=="darwin")return Promise.resolve(void 0);let e=IZ(PZ);return new Promise((t)=>{nnt("security",["find-generic-password","-a",DZ(),"-w","-s",e],{encoding:"utf-8",timeout:5000,windowsHide:!0},(n,r)=>t(n?void 0:r.trim()||void 0))})}async function lne(e,t,n,r,o=60000,s){if(!Je(t))return;let i=no(n,r),a=await Nr(e.load({projectKey:i,sessionId:t}),o,`SessionStore.load() timed out after ${o}ms for session ${t}`);if(!a||a.length===0)return;let c=vn(cnt(),`claude-resume-${PL()}`);try{let l=vn(c,"projects",i);await CL(l,{recursive:!0,mode:448});let u=vn(l,`${t}.jsonl`);await fm(u,a);let p=r?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR,f=p??vn(kL(),".claude"),m;try{m=await sne(vn(f,".credentials.json"),"utf-8")}catch(E){if(!wr(E))throw E}if(!p&&!(r??process.env).ANTHROPIC_API_KEY&&!(r??process.env).CLAUDE_CODE_OAUTH_TOKEN)m=await fnt()??m;await pnt(m,vn(c,".credentials.json"));let h=OZ(Mn.CLAUDE_CONFIG_DIR),y=vn(p??kL(),".claude.json");await KS(y,vn(c,".claude.json"),void 0,WP(s,y,h.globalConfig,tn.globalConfig()));let _=vn(f,"settings.json");if(await KS(_,vn(c,"settings.json"),tne,WP(s,_,h.userSettings,tn.userSettings())),await KS(vn(f,"cowork_settings.json"),vn(c,"cowork_settings.json"),tne),e.listSubkeys)await mnt(e,{projectKey:i,sessionId:t},vn(l,t),o);return c}catch(l){throw await BE(c),l}}async function mnt(e,t,n,r){let o=await Nr(e.listSubkeys({projectKey:t.projectKey,sessionId:t.sessionId}),r,`SessionStore.listSubkeys() timed out after ${r}ms for session ${t.sessionId}`);for(let s of o){let i=Vh(n,s+".jsonl");if(!s||ane(s)||s.split(/[\\/]/).includes("..")||!i.startsWith(n+IL)){ce(`[SessionStore] skipping unsafe subpath from listSubkeys: ${s}`,{level:"warn"});continue}let a=await Nr(e.load({projectKey:t.projectKey,sessionId:t.sessionId,subpath:s}),r,`SessionStore.load() timed out after ${r}ms for session ${t.sessionId} subpath ${s}`);if(!a||a.length===0)continue;let c=[],l=[];for(let u of a)if(OL(u))c.push(u);else l.push(u);if(l.length>0)await CL(RL(i),{recursive:!0}),await fm(i,l);if(c.length>0){let u=c.at(-1),p=Vh(n,s+".meta.json");await CL(RL(p),{recursive:!0});let{type:f,...m}=u;await ine(p,me(m),{mode:384})}}}function DL(e,t){let{isSingleUserTurn:n,resumeConfigDir:r,deferSpawn:o}=t,{systemPrompt:s,settings:i,managedSettings:a,settingSources:c,sandbox:l,...u}=e??{},p,f,m,h;if(s===void 0)p="";else if(typeof s==="string")p=s;else if(Array.isArray(s))p=s;else if(s.type==="custom")p=s.prompt,h=s.snapshot;else if(s.type==="preset")f=s.append,m=s.excludeDynamicSections,h=s.snapshot;process.env.CLAUDE_AGENT_SDK_VERSION="0.3.257";let{abortController:y=Gd(),additionalDirectories:_=[],agent:E,agents:S,allowedTools:x=[],betas:v,canUseTool:w,continue:U,cwd:L,debug:F,debugFile:K,disallowedTools:ne=[],tools:se,env:X,executable:re=il()?"bun":"node",executableArgs:Ie=[],extraArgs:yt={},fallbackModel:Z,enableFileCheckpointing:Qe,toolConfig:St,forkSession:At,hooks:Kn,includeHookEvents:Dt,includePartialMessages:ie,forwardSubagentText:Q,onElicitation:te,onUserDialog:Be,supportedDialogKinds:Te,perTaskStopAffordance:Ft,persistSession:Gn,sessionStore:qe,sessionStoreFlush:ro,thinking:oo,effort:Kt,maxThinkingTokens:Dc,maxTurns:gne,maxBudgetUsd:_ne,taskBudget:yne,mcpServers:NL,model:Sne,outputFormat:ML,permissionMode:bne,allowDangerouslySkipPermissions:Ene=!1,permissionPromptToolName:xne,plugins:vne,getOAuthToken:UL,getHostAuthToken:FL,workload:$L,resume:zL,resumeSessionAt:wne,resumeDropsTurn:Ane,sessionId:Tne,skills:jL,stderr:Cne,strictMcpConfig:kne}=u,HL=bne??(e?.resolvePermissionModeInCli?void 0:"default");if(qe&&Gn===!1)throw Error("sessionStore cannot be used with persistSession: false -- the storage adapter requires local writes to mirror from. Use CLAUDE_CONFIG_DIR=/tmp for ephemeral local writes with external mirroring.");if(Te!==void 0&&Te.length>0&&!Be)throw Error("supportedDialogKinds requires an onUserDialog callback -- declaring dialog kinds without a handler would park dialogs nothing can answer. Provide onUserDialog, or omit supportedDialogKinds.");if(qe&&U&&!zL&&!qe.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");if(qe&&Qe)throw Error("enableFileCheckpointing is not yet supported with sessionStore (backup blobs are not mirrored, so rewindFiles() fails after a store-backed resume).");if(qe&&u.spawnClaudeCodeProcess)ce("sessionStore with custom spawnClaudeCodeProcess: ensure the subprocess CLAUDE_CONFIG_DIR matches the parent (same path, same separators) or transcript_mirror frames will be dropped.",{level:"warn"});NZ(!!w,HL??"default",x);let GE=u.pathToClaudeCodeExecutable;if(!GE){let fr=unt(import.meta.url),so=ant(fr),ia=KK((Lc)=>so.resolve(Lc));if(!ia)throw Error(`Native CLI binary for ${process.platform}-${process.arch} not found. Reinstall @anthropic-ai/claude-agent-sdk without --omit=optional, or set options.pathToClaudeCodeExecutable.`);GE=ia}let BL=ML?.type==="json_schema"?ML.schema:void 0,In=X?{...X}:{...process.env};if(!In.CLAUDE_CODE_ENTRYPOINT)In.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(!In.CLAUDE_AGENT_SDK_VERSION)In.CLAUDE_AGENT_SDK_VERSION="0.3.257";if(Qe)In.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true";if(UL)In.CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH="1";if(FL)In.CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH="1";if(St?.askUserQuestion?.previewFormat)In.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT=St.askUserQuestion.previewFormat;let WE={};if(KE.propagation.inject(KE.context.active(),WE),"traceparent"in WE){for(let fr of["TRACEPARENT","TRACESTATE"])if(!(fr in(X??{})))delete In[fr]}for(let[fr,so]of Object.entries(WE)){let ia=fr.toUpperCase();if(!(ia in(X??{})))In[ia]=so}let KL={},GL=new Map;if(NL)for(let[fr,so]of Object.entries(NL))if(so.type==="sdk"&&so.instance)GL.set(fr,so);else KL[fr]=so;let Dd;if(oo)switch(oo.type){case"adaptive":Dd={type:"adaptive",display:oo.display};break;case"enabled":Dd={type:"enabled",budgetTokens:oo.budgetTokens,display:oo.display};break;case"disabled":Dd={type:"disabled"};break}else if(Dc!==void 0)Dd=Dc===0?{type:"disabled"}:{type:"enabled",budgetTokens:Dc};if(r){if(In.CLAUDE_CONFIG_DIR=r,process.platform==="win32")In.CLAUDE_SECURESTORAGE_CONFIG_DIR=X?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??X?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??""}let WL=new qC({abortController:y,additionalDirectories:_,agent:E,betas:v,cwd:L,debug:F,debugFile:K,executable:re,executableArgs:Ie,extraArgs:$L?{...yt,workload:$L}:yt,pathToClaudeCodeExecutable:GE,env:In,forkSession:At,stderr:Cne,thinkingConfig:Dd,effort:Kt,maxTurns:gne,maxBudgetUsd:_ne,taskBudget:yne,model:Sne,fallbackModel:Z,jsonSchema:BL,permissionMode:HL,allowDangerouslySkipPermissions:Ene,permissionPromptToolName:xne,continueConversation:qe?void 0:U,resume:zL,resumeSessionAt:wne,resumeDropsTurn:Ane,sessionId:Tne,settings:typeof i==="object"?me(i):i,managedSettings:a?me(a):void 0,settingSources:c,skills:jL,allowedTools:x,disallowedTools:ne,tools:se,mcpServers:KL,strictMcpConfig:kne,canUseTool:!!w,hooks:!!Kn,includeHookEvents:Dt,includePartialMessages:ie,persistSession:Gn,sessionMirror:!!qe,plugins:vne,sandbox:l,spawnClaudeCodeProcess:u.spawnClaudeCodeProcess,deferSpawn:o}),Rne={systemPrompt:p,appendSystemPrompt:f,planModeInstructions:u.planModeInstructions,systemPromptSnapshot:h,appendSubagentSystemPrompt:u.appendSubagentSystemPrompt,toolAliases:u.toolAliases,excludeDynamicSections:m,agents:S,title:u.title,skills:jL,webSearchIsolationExemptMcpServers:u.webSearchIsolationExemptMcpServers,promptSuggestions:u.promptSuggestions,agentProgressSummaries:u.agentProgressSummaries,forwardSubagentText:Q,supportedDialogKinds:Te,perTaskStopAffordance:Ft},VE=new Gy(WL,n,w,Kn,y,GL,BL,Rne,te,UL,FL,Be);if(qe){let fr=()=>vn(In.CLAUDE_CONFIG_DIR??vn(kL(),".claude"),"projects"),so=ro==="eager",ia=new XC(async(Lc,qE)=>{let Ld=one(Lc,fr());if(Ld)await qe.append(Ld,qE);else ce(`[SessionStore] dropping mirror frame: filePath ${Lc} is not under ${fr()} -- subprocess CLAUDE_CONFIG_DIR likely differs from parent (custom spawnClaudeCodeProcess / container?)`,{level:"warn"})},{onError:(Lc,qE)=>{let Ld=one(Lc,fr());if(Ld)VE.reportMirrorError(Ld,qE.message)},maxPendingEntries:so?0:Wy,maxPendingBytes:so?0:Ou});VE.setTranscriptMirrorBatcher(ia)}return{queryInstance:VE,transport:WL,abortController:y,processEnv:In}}function LL(e,t,n,r){if(typeof n==="string")t.write(me({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:n}]},parent_tool_use_id:null})+`
201
+ `);else e.streamInput(n).catch((o)=>r.abort(o))}var hnt=new Set(["EBUSY","EMFILE","ENFILE","ENOTEMPTY","EPERM"]);async function BE(e){for(let t=0;;t++)try{return await int(e,{recursive:!0,force:!0})}catch(n){if(t>=4||!hnt.has(Me(n)??""))return;await Lr((t+1)*100)}}function gnt(e,t){e.waitForExit().catch(()=>{}).finally(()=>BE(t))}function MZt({prompt:e,options:t}){if((t?.resume||t?.continue)&&t?.sessionStore)return _nt(e,t);let{queryInstance:n,transport:r,abortController:o}=DL(t,{isSingleUserTurn:typeof e==="string"});return LL(n,r,e,o),n}function _nt(e,t){let{queryInstance:n,transport:r,abortController:o,processEnv:s}=DL({...t},{isSingleUserTurn:typeof e==="string",deferSpawn:!0}),i=Vh(t.cwd??"."),a=t.sessionStore,c=t.loadTimeoutMs??60000,l=t.resume;return(async()=>{if(!l)l=(await Nr(a.listSessions(no(i,t.env)),c,`SessionStore.listSessions() timed out after ${c}ms`)).slice().sort((f,m)=>m.mtime-f.mtime)[0]?.sessionId;if(!l)return;return lne(a,l,i,t.env,t.loadTimeoutMs)})().then((p)=>{if(p){r.updateResume(l);let f={CLAUDE_CONFIG_DIR:p};if(process.platform==="win32"){let m=t.env?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??t.env?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??"";f.CLAUDE_SECURESTORAGE_CONFIG_DIR=m,s.CLAUDE_SECURESTORAGE_CONFIG_DIR=m}r.updateEnv(f),s.CLAUDE_CONFIG_DIR=p,n.addCleanupCallback(()=>gnt(r,p))}if(!n.isClosed())r.spawn()}).catch((p)=>{let f=Hr(p);r.spawnAbort(f),n.setError(f)}),LL(n,r,e,o),n}async function UZt({options:e,initializeTimeoutMs:t=60000}={}){let n,r=e?.resume;if((r||e?.continue)&&e?.sessionStore){let a=Vh(e.cwd??".");if(!r){if(!e.sessionStore.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");let c=e.loadTimeoutMs??60000;r=(await Nr(e.sessionStore.listSessions(no(a,e.env)),c,`SessionStore.listSessions() timed out after ${c}ms`)).slice().sort((u,p)=>p.mtime-u.mtime)[0]?.sessionId}if(r)n=await lne(e.sessionStore,r,a,e.env,e.loadTimeoutMs)}let o,s,i;try{let m=function(){if(f)return;f=!0,u.close()},a=DL(n&&r&&r!==e?.resume?{...e,resume:r}:e,{isSingleUserTurn:!1,resumeConfigDir:n});o=a.queryInstance;let{transport:c,abortController:l}=a;s=c;let u=a.queryInstance;if(n){let h=n;u.addCleanupCallback(()=>{i=c.waitForExit().catch(()=>{}).then(()=>BE(h))})}let p=`Subprocess initialization did not complete within ${t}ms — check authentication and network connectivity`;await Nr(u.initializationResult(),t,p).catch((h)=>{throw A$(h,p)?Cn(h,{telemetryMessage:`Subprocess initialization did not complete within ${t}ms`,errorClass:"initialize_timeout"}):h});let f=!1;return{query(h){if(f)throw Error("WarmQuery.query() can only be called once");f=!0;try{LL(u,c,h,l)}catch(y){throw u.close(),y}if(typeof h==="string")u.setIsSingleUserTurn(!0);return u},close:m,async[Symbol.asyncDispose](){f=!0,u.close(),await i}}}catch(a){if(o?.close(),n&&!i){let c=s;i=(c?c.waitForExit().catch(()=>{}):Promise.resolve()).then(()=>BE(n))}throw await i,a}}async function FZt(e,t){if(t?.sessionStore)return xnt(t.sessionStore,e,t);return t4(e,t)}async function $Zt(e){if(e?.sessionStore)return Snt(e.sessionStore,e);return eZ(e)}async function zZt(e,t){if(t?.sessionStore)return vnt(t.sessionStore,e,t);return tZ(e,t)}async function jZt(e,t,n){if(n?.sessionStore)return wnt(n.sessionStore,e,t,n.dir);return iZ(e,t,n)}async function HZt(e,t,n){if(n?.sessionStore)return Ant(n.sessionStore,e,t,n.dir);return aZ(e,t,n)}async function BZt(e,t){if(!Je(e))throw new Ze(`Invalid sessionId: ${e}`,"deleteSession: invalid sessionId (must be a UUID)");if(t?.sessionStore){if(!t.sessionStore.delete)return;let n=no(t.dir);await t.sessionStore.delete({projectKey:n,sessionId:e});return}return cZ(e,t)}async function KZt(e,t){if(t?.sessionStore)return Tnt(t.sessionStore,e,t);return pZ(e,t)}async function GZt(e,t,n,r){if(!Je(e))throw new Ze(`Invalid sessionId: ${e}`,"importSessionToStore: invalid sessionId (must be a UUID)");let o=ye(),s=o?r:void 0,i=await Ni(e,n?.dir,ir(s),o);if(!i)throw Error(`Session ${e} not found`);let a=no(n?.dir),c=n?.batchSize&&n.batchSize>0?n.batchSize:Wy,l=s===void 0?void 0:ac(RL(i.filePath),pn),u=s!==void 0&&l!==void 0?{backend:s,projectKey:l}:void 0;if(u!==void 0)await KP(u.backend,tn.transcript(u.projectKey,e),{projectKey:a,sessionId:e},t,c);else await rne(i.filePath,{projectKey:a,sessionId:e},t,c);if(n?.includeSubagents===!1)return;if(u!==void 0){let m=await AZ(u.backend,u.projectKey,e),h=await TZ(u.backend,u.projectKey,e,m);for(let y of m){let _={projectKey:a,sessionId:e,subpath:BS(y)};await KP(u.backend,y.kind==="agent"?tn.transcript(u.projectKey,e,y.agentId,y.agentRelPath):tn.journal(u.projectKey,e,y.agentRelPath),_,t,c);let E=h.get(_.subpath),S;if(E!==void 0)try{S=lt(E)}catch(x){ce(`importSessionToStore: skipping unreadable sidecar for ${_.subpath}: ${x}`)}if(S!==void 0)await t.append(_,[{type:"agent_metadata",...S}])}return}let p=i.filePath.replace(/\.jsonl$/,""),f=vn(p,"subagents");for(let m of await ynt(f)){let h=cne(p,m).split(IL);h[h.length-1]=h.at(-1).replace(/\.jsonl$/,"");let y={projectKey:a,sessionId:e,subpath:h.join("/")};await rne(m,y,t,c);let _=m.replace(/\.jsonl$/,".meta.json"),E;try{E=lt(await sne(_,"utf8"))}catch(S){if(!wr(S))ce(`importSessionToStore: skipping unreadable sidecar ${_}: ${S}`)}if(E!==void 0)await t.append(y,[{type:"agent_metadata",...E}])}}async function rne(e,t,n,r){let o=lnt({input:rnt(e,{encoding:"utf8"}),crlfDelay:1/0}),s=[],i=0;for await(let a of o){if(!a)continue;try{s.push(lt(a))}catch(c){ce(`importSessionToStore: skipping unparseable line in ${e}: ${c}`);continue}if(i+=a.length,s.length>=r||i>=Ou)await n.append(t,s),s=[],i=0}if(s.length>0)await n.append(t,s)}async function ynt(e){let t=[];async function n(r){let o;try{o=await snt(r,{withFileTypes:!0})}catch{return}for(let s of o){let i=vn(r,s.name);if(s.isDirectory())await n(i);else if(s.isFile()&&s.name.endsWith(".jsonl"))t.push(i)}}return await n(e),t}async function WZt(e,t){if(t?.sessionStore)return Cnt(t.sessionStore,e,t.dir);return EZ(e,t)}async function VZt(e,t,n){if(n?.sessionStore)return knt(n.sessionStore,e,t,n);return xZ(e,t,n)}function une(e){let t=Vh(e??"."),n;try{n=ont(t)}catch{n=t}return it(n)}function no(e,t){let n=une(e);if(t===void 0)return Ds(n);return(t.CLAUDE_CONFIG_DIR?vv(t.CLAUDE_CODE_PROJECT_DIR_NAME):void 0)??mm(n)}function dne(e){return e.map((t)=>me(t)).join(`
202
+ `)+`
203
+ `}function pne(e,t,n){if(t!==void 0&&t>0)return e.slice(n,n+t);if(n>0)return e.slice(n);return e}function OL(e){return typeof e==="object"&&e!==null&&"type"in e&&e.type==="agent_metadata"}async function Snt(e,t){let n=une(t.dir),r=Ds(n),o=t.offset??0,s=t.limit;if(e.listSessionSummaries)return bnt(e,r,n,t.dir,s,o);if(!e.listSessions)throw Error("sessionStore.listSessions is not implemented -- cannot list sessions. Provide a store with a listSessions() method.");let a=(await e.listSessions(r)).slice().sort((l,u)=>u.mtime-l.mtime),c=pne(a,s,o);return fne(e,c,t.dir,n)}async function bnt(e,t,n,r,o,s){let i=await e.listSessionSummaries(t),a=e.listSessions?new Map((await e.listSessions(t)).map((p)=>[p.sessionId,p])):void 0,c=[];for(let p of i){let f=a?.get(p.sessionId);if(a&&!f)continue;let m=f!==void 0&&p.mtime<f.mtime;c.push({sessionId:p.sessionId,mtime:m?f.mtime:p.mtime,info:m?void 0:iM(p,n)})}if(a){let p=new Set(i.map((f)=>f.sessionId));for(let[f,m]of a)if(!p.has(f))c.push({sessionId:f,mtime:m.mtime})}else ce("listSessionSummaries without listSessions: gap-fill skipped; sessions lacking a sidecar will be omitted");c.sort((p,f)=>f.mtime-p.mtime);let l=pne(c,o,s),u=l.filter((p)=>p.info===void 0);if(u.length>0){let p=await fne(e,u,r,n),f=new Map(p.map((m)=>[m.sessionId,m]));for(let m of l)if(m.info===void 0)m.info=f.get(m.sessionId)??null}return l.flatMap((p)=>p.info?[p.info]:[])}async function fne(e,t,n,r){return(await Promise.allSettled(t.map(async(s)=>{let i=await hne(e,s.sessionId,n);if(!i)return null;let a=Ju(s.sessionId,mne(i,s.mtime),r);return a?{...a,lastModified:s.mtime}:null}))).flatMap((s,i)=>{let a=t[i];if(s.status==="fulfilled")return s.value?[s.value]:[];return[{sessionId:a.sessionId,summary:"",lastModified:a.mtime}]})}function mne(e,t){let n=Buffer.from(e,"utf-8"),r=n.length,o=n.subarray(0,Un).toString("utf-8"),s=r>Un?n.subarray(r-Un).toString("utf-8"):o;return{mtime:t,size:r,head:o,tail:s}}function Ent(e){let t=e.trimEnd(),n=t.slice(t.lastIndexOf(`
204
+ `)+1);try{let r=lt(n);if(typeof r==="object"&&r!==null&&"timestamp"in r&&typeof r.timestamp==="string"){let o=Date.parse(r.timestamp);if(!Number.isNaN(o))return o}}catch{}return Date.now()}async function hne(e,t,n){let r=no(n),o=await e.load({projectKey:r,sessionId:t});if(!o||o.length===0)return null;return dne(o)}async function xnt(e,t,n){if(!Je(t))return[];let r=no(n.dir),o=await e.load({projectKey:r,sessionId:t});if(!o||o.length===0)return[];return Qq(o,{limit:n.limit,offset:n.offset,includeSystemMessages:n.includeSystemMessages})}async function vnt(e,t,n){if(!Je(t))return;let r=await hne(e,t,n.dir);if(!r)return;let o=mne(r,Ent(r));return Ju(t,o)??void 0}async function wnt(e,t,n,r){if(!Je(t))throw new Ze(`Invalid sessionId: ${t}`,"renameSession: invalid sessionId (must be a UUID)");if(!n.trim())throw Error("title must be non-empty");let o=no(r);await e.append({projectKey:o,sessionId:t},[{type:"custom-title",customTitle:n.trim(),sessionId:t,uuid:PL(),timestamp:new Date().toISOString()}])}async function Ant(e,t,n,r){if(!Je(t))throw new Ze(`Invalid sessionId: ${t}`,"tagSession: invalid sessionId (must be a UUID)");if(n!==null){let s=oc(n).trim();if(!s)throw Error("tag must be non-empty (use null to clear)");n=s}let o=no(r);await e.append({projectKey:o,sessionId:t},[{type:"tag",tag:n??"",sessionId:t,uuid:PL(),timestamp:new Date().toISOString()}])}async function Tnt(e,t,n){if(!Je(t))throw new Ze(`Invalid sessionId: ${t}`,"forkSession: invalid sessionId (must be a UUID)");if(n.upToMessageId&&!Je(n.upToMessageId))throw new Ze(`Invalid upToMessageId: ${n.upToMessageId}`,"forkSession: invalid upToMessageId (must be a UUID)");let r=no(n.dir),o=await e.load({projectKey:r,sessionId:t});if(!o||o.length===0)throw Error(`Session ${t} not found`);let{entries:s,forkedSessionId:i}=fZ(o,t,n);return await e.append({projectKey:r,sessionId:i},s),{sessionId:i}}async function Cnt(e,t,n){if(!Je(t))return[];if(!e.listSubkeys)throw Error("sessionStore.listSubkeys is not implemented -- cannot list subagents. Provide a store with a listSubkeys() method.");let r=no(n),o=await e.listSubkeys({projectKey:r,sessionId:t}),s=new Set;for(let i of o){if(!i.startsWith("subagents/"))continue;let a=i.split("/").at(-1);if(a.startsWith("agent-"))s.add(a.slice(6))}return[...s]}async function knt(e,t,n,r){if(!Je(t))return[];if(!n)return[];let o=no(r.dir),s=`subagents/agent-${n}`;if(e.listSubkeys){let p=await e.listSubkeys({projectKey:o,sessionId:t}),f=`agent-${n}`,m=p.find((h)=>h.startsWith("subagents/")&&h.split("/").at(-1)===f);if(!m)return[];s=m}let i=await e.load({projectKey:o,sessionId:t,subpath:s});if(!i||i.length===0)return[];let a=i.findLast(OL),c=typeof a?.toolUseId==="string"?a.toolUseId:void 0,l=typeof a?.parentAgentId==="string"?a.parentAgentId:void 0,u=i.filter((p)=>!OL(p));if(u.length===0)return[];return BP(Buffer.from(dne(u)),{limit:r.limit,offset:r.offset},c,l)}function one(e,t){let n=cne(t,e),r=n.split(IL);if(r[0]===".."||ane(n))return null;if(r.length<2)return null;let o=r[0],s=r[1];if(r.length===2&&s.endsWith(".jsonl"))return{projectKey:o,sessionId:s.replace(/\.jsonl$/,"")};if(r.length>=4){let i=r.slice(2),a=i.length-1;return i[a]=i.at(-1).replace(/\.jsonl$/,""),{projectKey:o,sessionId:s,subpath:i.join("/")}}return null}export{_r as AbortError,Sv as CommandMatcher,$o as DirectConnectError,OX as DirectConnectTransport,wae as EXIT_REASONS,Ev as FileIndex,_s as HOOK_EVENTS,cv as InMemorySessionStore,LM as ORG_POLICY_LIMIT_PREFIXES,Aae as SYSTEM_PROMPT_DYNAMIC_BOUNDARY,DM as USAGE_LIMIT_ERROR_PREFIXES,MM as USAGE_TRANSITION_PREFIXES,NM as USAGE_WARNING_PREFIXES,tJe as createSdkMcpServer,BZt as deleteSession,tnt as filterEscalatingDefaultMode,Cg as foldSessionSummary,KZt as forkSession,zZt as getSessionInfo,FZt as getSessionMessages,VZt as getSubagentMessages,GZt as importSessionToStore,$Zt as listSessions,WZt as listSubagents,oJe as parseDirectConnectUrl,MZt as query,jZt as renameSession,NZt as resolveSettings,UZt as startup,HZt as tagSession,eJe as tool};