@cline/core 0.0.95 → 0.2.0-nightly.1793312794

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 (175) hide show
  1. package/dist/ClineCore.d.ts +6 -1
  2. package/dist/account/rpc.d.ts +3 -1
  3. package/dist/account/types.d.ts +2 -0
  4. package/dist/artifacts/cloud/fetch.d.ts +8 -0
  5. package/dist/artifacts/cloud/publish.d.ts +6 -0
  6. package/dist/artifacts/publish.d.ts +30 -0
  7. package/dist/cline-core/runtime-services.d.ts +4 -2
  8. package/dist/cloud/computer-use-prompt.d.ts +9 -0
  9. package/dist/cloud/controller.d.ts +26 -4
  10. package/dist/cloud/hub-client.d.ts +53 -0
  11. package/dist/cloud/hub-protocol.d.ts +32 -0
  12. package/dist/cloud/index.d.ts +5 -0
  13. package/dist/cloud/index.js +34 -17
  14. package/dist/cloud/types.d.ts +4 -1
  15. package/dist/extensions/context/compaction-shared.d.ts +1 -0
  16. package/dist/extensions/context/compaction.d.ts +7 -0
  17. package/dist/extensions/context/summarize-conversation.d.ts +7 -0
  18. package/dist/extensions/context/summary-generation.d.ts +14 -0
  19. package/dist/extensions/mcp/apps.d.ts +16 -0
  20. package/dist/extensions/mcp/client.d.ts +1 -0
  21. package/dist/extensions/mcp/index.d.ts +5 -1
  22. package/dist/extensions/mcp/manager.d.ts +2 -1
  23. package/dist/extensions/mcp/session-apps.d.ts +28 -0
  24. package/dist/extensions/mcp/types.d.ts +22 -0
  25. package/dist/extensions/plugin/plugin-command-origin.d.ts +8 -0
  26. package/dist/extensions/plugin/plugin-registry.d.ts +1 -0
  27. package/dist/extensions/plugin/plugin-runtime.d.ts +7 -0
  28. package/dist/hub/client/index.d.ts +6 -0
  29. package/dist/hub/client/managed-hub-build-watcher.d.ts +2 -0
  30. package/dist/hub/client/plugin-commands.d.ts +4 -0
  31. package/dist/hub/client/session-client.d.ts +2 -0
  32. package/dist/hub/daemon/entry.js +248 -229
  33. package/dist/hub/daemon/index.d.ts +2 -0
  34. package/dist/hub/index.d.ts +1 -0
  35. package/dist/hub/index.js +238 -219
  36. package/dist/hub/runtime-host/hub-runtime-host.d.ts +6 -0
  37. package/dist/hub/server/cloud-session-service.d.ts +52 -0
  38. package/dist/hub/server/handlers/capability-handlers.d.ts +18 -1
  39. package/dist/hub/server/handlers/context.d.ts +13 -2
  40. package/dist/hub/server/handlers/mcp-apps-handlers.d.ts +5 -0
  41. package/dist/hub/server/handlers/session-handlers.d.ts +4 -0
  42. package/dist/hub/server/hub-server-options.d.ts +3 -0
  43. package/dist/hub/server/hub-server-transport.d.ts +2 -0
  44. package/dist/index.d.ts +10 -5
  45. package/dist/index.js +284 -258
  46. package/dist/plugin-runtime/node_modules/@cline/agents/dist/index.js +76 -0
  47. package/dist/plugin-runtime/node_modules/@cline/agents/package.json +1 -0
  48. package/dist/plugin-runtime/node_modules/@cline/core/dist/ai-sdk-bdvd54cj.js +1 -0
  49. package/dist/plugin-runtime/node_modules/@cline/core/dist/anthropic-d88t4w67.js +1 -0
  50. package/dist/plugin-runtime/node_modules/@cline/core/dist/bedrock-4rh6dw0e.js +1 -0
  51. package/dist/plugin-runtime/node_modules/@cline/core/dist/cline-dex049wz.js +1 -0
  52. package/dist/plugin-runtime/node_modules/@cline/core/dist/cloud/index.js +38 -0
  53. package/dist/plugin-runtime/node_modules/@cline/core/dist/community-adrseffv.js +1 -0
  54. package/dist/plugin-runtime/node_modules/@cline/core/dist/foundation-models-embedding-model-strategy-SAVQFBF4-vf44v1q1.js +1 -0
  55. package/dist/plugin-runtime/node_modules/@cline/core/dist/foundation-models-language-model-strategy-BPQO66W7-np6pavev.js +1 -0
  56. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-bsd-1xg0n8py.js +1 -0
  57. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-bsd-2h2811k3.js +1 -0
  58. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-darwin-918h9zb6.js +2 -0
  59. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-darwin-9g9qz8kw.js +2 -0
  60. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-linux-8p52y0t4.js +1 -0
  61. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-linux-cr4wnstr.js +1 -0
  62. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-unsupported-aa72jh2v.js +1 -0
  63. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-unsupported-k2y10eep.js +1 -0
  64. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-win-1hvm2h6v.js +1 -0
  65. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-win-7nqbajdc.js +1 -0
  66. package/dist/plugin-runtime/node_modules/@cline/core/dist/google-nqn5r579.js +1 -0
  67. package/dist/plugin-runtime/node_modules/@cline/core/dist/hub/daemon/entry.js +1166 -0
  68. package/dist/plugin-runtime/node_modules/@cline/core/dist/hub/index.js +1153 -0
  69. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-0ahmqye5.js +2 -0
  70. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-1jwj53tz.js +2 -0
  71. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-3qy7846d.js +14 -0
  72. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-418gvd4a.js +2 -0
  73. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-4etvmc8g.js +2 -0
  74. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-4pm9q9we.js +1 -0
  75. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-4tgv599k.js +2 -0
  76. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-5hwscy9s.js +15 -0
  77. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-6dpcn5cw.js +9 -0
  78. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-7ycwqbm0.js +1 -0
  79. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-8qjtgvqw.js +9 -0
  80. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-8zb5grad.js +1210 -0
  81. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-94jdgxt6.js +2 -0
  82. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-9g67p34k.js +2 -0
  83. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-a9d2sjh0.js +85 -0
  84. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-agemt17a.js +3 -0
  85. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-bhf7enwn.js +1 -0
  86. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-bnwxdgvg.js +1 -0
  87. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-brjxtvsh.js +4 -0
  88. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-bvb7f701.js +1 -0
  89. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-bwet95hr.js +2 -0
  90. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-cadyf2yp.js +14 -0
  91. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-cxfnnrmh.js +9 -0
  92. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-cyyvppz9.js +6 -0
  93. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-d4pbedxj.js +137 -0
  94. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-ddwn220p.js +12 -0
  95. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-edf1hmcw.js +62 -0
  96. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-ejyd73x5.js +1 -0
  97. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-f25bf131.js +4 -0
  98. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-f4rfmj6q.js +3 -0
  99. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-fet3kwk6.js +1 -0
  100. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-ffna8yzn.js +121 -0
  101. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-g2y6ptdc.js +213 -0
  102. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-ge184xvn.js +6 -0
  103. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-gevnedsc.js +13 -0
  104. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-hkmarmve.js +190 -0
  105. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-kqacxn3s.js +39 -0
  106. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-m3gtj35r.js +14 -0
  107. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-neczvge6.js +21 -0
  108. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-p5k5hnam.js +75 -0
  109. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-sdvqs19c.js +20 -0
  110. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-t75m2pgm.js +146 -0
  111. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-v4-qqb2kabr.js +1 -0
  112. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-v6mehmme.js +12 -0
  113. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-v80fh3x3.js +16 -0
  114. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-vd605jwp.js +2 -0
  115. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-vryppqt1.js +1 -0
  116. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-w55v4n1n.js +2 -0
  117. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-w9n2kgjk.js +140 -0
  118. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-yjbp9r76.js +142 -0
  119. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-ztb3cjfh.js +3 -0
  120. package/dist/plugin-runtime/node_modules/@cline/core/dist/index.js +1 -0
  121. package/dist/plugin-runtime/node_modules/@cline/core/dist/jiti-static-kj4rdeey.js +473 -0
  122. package/dist/plugin-runtime/node_modules/@cline/core/dist/jiti-y9tt7gmq.js +1 -0
  123. package/dist/plugin-runtime/node_modules/@cline/core/dist/langfuse-stream-telemetry-bg81k3qh.js +1 -0
  124. package/dist/plugin-runtime/node_modules/@cline/core/dist/langfuse-telemetry-tkbfbx5w.js +1 -0
  125. package/dist/plugin-runtime/node_modules/@cline/core/dist/mistral-mkw95amh.js +1 -0
  126. package/dist/plugin-runtime/node_modules/@cline/core/dist/multipart-parser-9z19cm6q.js +2 -0
  127. package/dist/plugin-runtime/node_modules/@cline/core/dist/ollama-sjp09b7p.js +1 -0
  128. package/dist/plugin-runtime/node_modules/@cline/core/dist/openai-1eyn4hw0.js +1 -0
  129. package/dist/plugin-runtime/node_modules/@cline/core/dist/openai-compatible-f99c7syq.js +1 -0
  130. package/dist/plugin-runtime/node_modules/@cline/core/dist/orchestration-embedding-model-strategy-GT27AFII-19936r1a.js +1 -0
  131. package/dist/plugin-runtime/node_modules/@cline/core/dist/orchestration-language-model-strategy-YEQPUCOT-eavx3zc3.js +1 -0
  132. package/dist/plugin-runtime/node_modules/@cline/core/dist/services/feature-flags/posthog.js +2 -0
  133. package/dist/plugin-runtime/node_modules/@cline/core/dist/services/telemetry/index.js +1 -0
  134. package/dist/plugin-runtime/node_modules/@cline/core/dist/token-04d0mwe8.js +1 -0
  135. package/dist/plugin-runtime/node_modules/@cline/core/dist/token-util-mt7pvm61.js +1 -0
  136. package/dist/plugin-runtime/node_modules/@cline/core/dist/vertex-6armtc3s.js +1 -0
  137. package/dist/plugin-runtime/node_modules/@cline/core/package.json +1 -0
  138. package/dist/plugin-runtime/node_modules/@cline/llms/dist/index.browser.js +16 -0
  139. package/dist/plugin-runtime/node_modules/@cline/llms/dist/index.js +1 -0
  140. package/dist/plugin-runtime/node_modules/@cline/llms/package.json +1 -0
  141. package/dist/plugin-runtime/node_modules/@cline/sdk/dist/index.js +1 -0
  142. package/dist/plugin-runtime/node_modules/@cline/sdk/package.json +1 -0
  143. package/dist/plugin-runtime/node_modules/@cline/shared/dist/automation/index.js +57 -0
  144. package/dist/plugin-runtime/node_modules/@cline/shared/dist/db/index.js +127 -0
  145. package/dist/plugin-runtime/node_modules/@cline/shared/dist/index.browser.js +110 -0
  146. package/dist/plugin-runtime/node_modules/@cline/shared/dist/index.js +1 -0
  147. package/dist/plugin-runtime/node_modules/@cline/shared/dist/node.js +1 -0
  148. package/dist/plugin-runtime/node_modules/@cline/shared/dist/remote-config/index.js +68 -0
  149. package/dist/plugin-runtime/node_modules/@cline/shared/dist/storage/index.js +1 -0
  150. package/dist/plugin-runtime/node_modules/@cline/shared/dist/types/index.js +1 -0
  151. package/dist/plugin-runtime/node_modules/@cline/shared/package.json +1 -0
  152. package/dist/plugin-runtime/package.json +1 -0
  153. package/dist/{extensions → plugin-runtime}/plugin-sandbox-bootstrap.js +129 -129
  154. package/dist/remote/remote-environments.d.ts +1 -0
  155. package/dist/runtime/config/agent-runtime-config-builder.d.ts +2 -0
  156. package/dist/runtime/host/local-runtime-host.d.ts +10 -0
  157. package/dist/runtime/host/runtime-host.d.ts +6 -0
  158. package/dist/runtime/orchestration/runtime-oauth-token-manager.d.ts +3 -0
  159. package/dist/runtime/orchestration/session-runtime-orchestrator.d.ts +10 -1
  160. package/dist/runtime/orchestration/session-runtime.d.ts +2 -0
  161. package/dist/runtime/tools/subprocess-sandbox.d.ts +22 -0
  162. package/dist/services/cloud-handoff/git-preparation.d.ts +22 -0
  163. package/dist/services/global-settings.d.ts +6 -0
  164. package/dist/services/llms/cline-recommended-models.d.ts +2 -0
  165. package/dist/services/local-runtime-bootstrap.d.ts +1 -0
  166. package/dist/services/plugin-command-api.d.ts +47 -0
  167. package/dist/services/plugin-commands.d.ts +25 -27
  168. package/dist/services/skills-cli.d.ts +2 -0
  169. package/dist/services/telemetry/core-events.d.ts +26 -0
  170. package/dist/services/telemetry/index.js +1 -1
  171. package/dist/services/telemetry/run-health.d.ts +40 -0
  172. package/dist/services/telemetry/stall-signals.d.ts +12 -0
  173. package/dist/types/config.d.ts +1 -0
  174. package/dist/types/session.d.ts +7 -0
  175. package/package.json +6 -5
@@ -0,0 +1,190 @@
1
+ import _f from"node:path";import ie from"node:fs/promises";import yn from"node:path";import{createHmac as Nf}from"node:crypto";import{basename as Pf}from"node:path";import xe from"node:path";import{basename as um}from"node:path";import{webcrypto as di}from"node:crypto";import{existsSync as Hm,mkdirSync as Vm,readFileSync as Jm,writeFileSync as Wm}from"node:fs";import{dirname as Km,resolve as Gm}from"node:path";function Qt(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,r])=>t.indexOf(+n)===-1).map(([n,r])=>r)}function Jn(e,t="|"){return e.map((n)=>bi(n)).join(t)}function tn(e,t){if(typeof t==="bigint")return t.toString();return t}class mi{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function Nt(e){return new mi(e)}function Aa(e){return e===null||e===void 0}function Tn(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function xa(e,t){let n=e/t,r=Math.round(n),i=4*Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-r)<i)return 0;return n-r}function ae(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Sn(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function ue(e){return Sn(e._zod.def)??e._zod.def.shape}function hi(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return ae(this,t,r),r},enumerable:!0,configurable:!0})}function yi(e,t,n){if(t in e)ae(e,t,n);else e[t]=n}function Ie(e,t,n,r){let i=ue(t);for(let o of n){let a=Object.getOwnPropertyDescriptor(i,o);if(!a.enumerable)continue;if(a.get)hi(e,o,()=>{let s=t._zod.def.shape[o];return r?r(s,o):s});else yi(e,o,r?r(a.value,o):a.value)}}function Ca(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);if(!r.enumerable)continue;if(r.get)hi(e,n,()=>t[n]);else yi(e,n,r.value)}}function Y(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Na(e){return JSON.stringify(e)}function Pa(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var vi="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function tt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Ra=Nt(()=>{if(Q.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function Le(e){if(tt(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(tt(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function _i(e){if(Le(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}var za=new Set(["string","number","symbol"]);function Me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function we(e,t,n){let r=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)r._zod.parent=e;return r}function w(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 bi(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function $a(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var wi=(()=>({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]}))(),La={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ma(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 i={};return Ie(i,e,Pt(e,t)),we(e,Y(n,{shape:i,checks:[]}))}function Pt(e,t){let n=ue(e),r=[];for(let i of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,i)?.enumerable)throw Error(`Unrecognized key: "${String(i)}"`);if(t[i])r.push(i)}return r}function Ua(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 i=new Set(Pt(e,t)),o={};return Ie(o,e,Reflect.ownKeys(ue(e)).filter((a)=>!i.has(a))),we(e,Y(n,{shape:o,checks:[]}))}function Da(e,t){if(!Le(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let r=ue(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(r,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return we(e,Y(e._zod.def,{shape:Ei(e,t)}))}function Ei(e,t){let n={};return Ie(n,e,Reflect.ownKeys(ue(e))),Ca(n,t),n}function ja(e,t){if(!Le(t))throw Error("Invalid input to safeExtend: expected a plain object");return we(e,Y(e._zod.def,{shape:Ei(e,t)}))}function Ba(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};Ie(n,e,Reflect.ownKeys(ue(e))),Ie(n,t,Reflect.ownKeys(ue(t)));let r=Y(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return we(e,r)}function Wn(e,t,n,r="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let o=n?new Set(Pt(t,n)):void 0,a={};return Ie(a,t,Reflect.ownKeys(ue(t)),e&&((s,l)=>o&&!o.has(l)?s:new e({type:"optional",innerType:s}))),we(t,Y(t._zod.def,{shape:a,checks:[]}))}function Fa(e,t,n){let r=n?new Set(Pt(t,n)):void 0,i={};return Ie(i,t,Reflect.ownKeys(ue(t)),(o,a)=>r&&!r.has(a)?o:new e({type:"nonoptional",innerType:o})),we(t,Y(t._zod.def,{shape:i}))}function re(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 Za(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 ye(e,t){return t.map((n)=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function He(e){return typeof e==="string"?e:e?.message}function Kn(e){let t=[];for(let n of e??[]){let r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;let i=r.maximum??r.length??r.size;if(i>=0)t.push([i,n])}return t}function nn(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function _e(e,t,n){var r;let i=e.inst?._zod?.traits;if(i?.has("$ZodType"))if(i.has("$ZodCheck"))(r=e).schema??(r.schema=e.inst);else e.schema=e.inst;let o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,a=e.message?e.message:He(e.inst?._zod.def?.error?.(e))??He(o?.(e))??He(t?.error?.(e))??He(n.customError?.(e))??He(n.localeError?.(e))??"Invalid input",s={};for(let l of Object.keys(e)){if(l==="inst"||l==="schema"||l==="continue"||l==="input"||l==="__proto__")continue;s[l]=e[l]}if(s.path??(s.path=[]),s.message=a,t?.reportInput)s.input=e.input;return s}var Ha=/[\uD800-\uDBFF]/;function In(e){let t=e.length;if(!Ha.test(e))return t;let n=t;for(let r=0;r<t-1;r++)if((e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320)n--,r++;return n}function On(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function qa(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 nt(...e){let[t,n,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:r};return{...t}}function Va(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);if(r.get)Object.defineProperty(e,n,{...r,enumerable:!1});else Ja(e,n,r.value)}}function be(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function ki(e,t,n){return be(e,t,n,!1)}function An(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return be(this,n,r(this))},set(i){be(this,n,i)}})}return t}function Ja(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:be(this,t,n.bind(this))},set(r){be(this,t,r)}})}function Wa(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var jt,me=!1,Ka={configurable:!0,get(){me=!0;return}};function x(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&jt!==e._zod){jt=void 0;return}jt=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Ka);let i=me;me=!1;try{let o=n(this);if(me)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o});return me=me||i,o}catch(o){throw delete this[t],me=me||i,o}},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i})}})}function Ga(e,t,n,r){let i=Wa(e,t);if(!i)return;Object.defineProperty(i,t,{configurable:!0,get(){let o={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,o),o.value=n(this),Object.defineProperty(this,t,o),o.value},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:o})}})}var Ya="~constantCatch";function Xa(e){let t=()=>e;return t[Ya]=!0,t}var Gn,Bt={value:void 0,enumerable:!1},Yn="captureStackTrace"in Error?Error:null;function Qa(e){let t=Yn;if(t){let n=t.stackTraceLimit;if(typeof n==="number"){try{t.stackTraceLimit=0}catch{return Yn=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function h(e,t,n,r){let i={};function o(f){this.def=f,this.constr=p,this.traits=new Set}o.prototype=i;let a=n,s=a&&new WeakSet;function l(f,m){if(!f._zod){Bt.value=new o(m);try{Object.defineProperty(f,"_zod",Bt)}finally{Bt.value=void 0}}else if(f._zod.traits.has(e))return;if(f._zod.traits.add(e),t(f,m),s){let y=Object.getPrototypeOf(f),T=f._zod.constr.prototype,b=y;while(b&&b!==T)b=Object.getPrototypeOf(b);let U=b??y;if(!s.has(U))s.add(U),Va(U,a)}let g=p.prototype;for(let y in g){if(!Object.prototype.hasOwnProperty.call(g,y))continue;if(!(y in f))f[y]=g[y].bind(f)}}let u=r?.Parent??Object;class d extends u{}Object.defineProperty(d,"name",{value:e});function p(f){let m=r?.Parent?Qa(d):this;l(m,f);let g=m._zod.deferred;if(g){for(let T of g)T();m._zod.deferred=void 0}let y=globalThis.__zod_globalConfig?.postProcessor;if(y)y(m);return m}return Object.defineProperty(p,"init",{value:l}),Object.defineProperty(p,Symbol.hasInstance,{value:(f)=>{if(r?.Parent&&f instanceof r.Parent)return!0;return f?._zod?.traits?.has(e)}}),Object.defineProperty(p,"name",{value:e}),p}class ve extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class xn extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Gn=globalThis).__zod_globalConfig??(Gn.__zod_globalConfig={});var Q=globalThis.__zod_globalConfig;function oe(e){if(e)Object.assign(Q,e);return Q}function es(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,tn,2)),e.message}function ts(e){this._zod.message=e}var ns={get:es,set:ts,enumerable:!0,configurable:!0},Ft={value:void 0,enumerable:!1},Xn=new WeakSet([Object.prototype,Error.prototype]),Ti=(e,t)=>{e.name="$ZodError",Ft.value=t,Object.defineProperty(e,"issues",Ft),Ft.value=void 0,Object.defineProperty(e,"message",ns);let n=Object.getPrototypeOf(e);if(!Xn.has(n))Xn.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}})},rs=h("$ZodError",Ti),Si=h("$ZodError",Ti,void 0,{Parent:Error});function is(e,t,n){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0});else e[t]=n();return e[t]}function os(e,t=(n)=>n.message){let n={},r=[];for(let i of e.issues)if(i.path.length>0)is(n,i.path[0],()=>[]).push(t(i));else r.push(t(i));return{formErrors:r,fieldErrors:n}}function as(e,t=(n)=>n.message){let n={_errors:[]},r=(i,o=[])=>{for(let a of i.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map((s)=>r({issues:s},[...o,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...o,...a.path]);else{let s=[...o,...a.path];if(s.length===0)n._errors.push(t(a));else{let l=n,u=0;while(u<s.length){let d=s[u],p=u===s.length-1;if(d==="_errors"){if(p)l._errors.push(t(a));u++;continue}if(!Object.prototype.hasOwnProperty.call(l,d))Object.defineProperty(l,d,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let f=l[d];if(p)f._errors.push(t(a));l=f,u++}}}};return r(e),n}function ss(e){let t=[],n=e.map((r)=>typeof r==="object"?r.key:r);for(let r of n)if(typeof r==="number")t.push(`[${r}]`);else if(typeof r==="symbol")t.push(`[${JSON.stringify(String(r))}]`);else if(/[^\w$]/.test(r))t.push(`[${JSON.stringify(r)}]`);else{if(t.length)t.push(".");t.push(r)}return t.join("")}function ls(e){let t=[],n=[...e.issues].sort((r,i)=>(r.path??[]).length-(i.path??[]).length);for(let r of n)if(t.push(`✖ ${r.message}`),r.path?.length)t.push(` → at ${ss(r.path)}`);return t.join(`
2
+ `)}function Rt(e,t){return{callee:t?.callee??e,Err:t?.Err}}var zt=(e)=>{let t=(n,r,i,o)=>{let a=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},a);if(s instanceof Promise)throw new ve;if(s.issues.length){let l=new(o?.Err??e)(s.issues.map((u)=>_e(u,a,oe())));throw vi(l,o?.callee??t),l}return s.value};return t},Qn=zt(Si),$t=(e)=>{let t=async(n,r,i,o)=>{let a=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},a);if(s instanceof Promise)s=await s;if(s.issues.length){let l=new(o?.Err??e)(s.issues.map((u)=>_e(u,a,oe())));throw vi(l,o?.callee??t),l}return s.value};return t},er=$t(Si),Cn=(e)=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new ve;return o.issues.length?Ii(e,o.issues,i):{success:!0,data:o.value}};function Ii(e,t,n){let r;return{success:!1,get error(){if(!r)r=new e(t.map((i)=>_e(i,n,oe()))),t=void 0,n=void 0;return r},set error(i){r=i,t=void 0,n=void 0}}}var Nn=(e)=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)o=await o;return o.issues.length?Ii(e,o.issues,i):{success:!0,data:o.value}},us=Symbol.for("zod.compile.invalid"),cs=Symbol.for("zod.compile.fallback"),ds=(e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==us)return!0;if(r.definite===!0&&n===void 0)return!1}return ps(e,t,n)};function ps(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,o;if(i)r[cs]=!0,o=i({value:t,issues:[]},r);else o=e._zod.run({value:t,issues:[]},r);if(o instanceof Promise)throw new ve;return o.issues.length===0}var fs=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);if(i instanceof Promise)i=await i;return i.issues.length===0},ms=(e)=>{let t=zt(e),n=(r,i,o,a)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return t(r,i,s,Rt(n,a))};return n},hs=(e)=>{let t=zt(e),n=(r,i,o,a)=>t(r,i,o,Rt(n,a));return n},gs=(e)=>{let t=$t(e),n=async(r,i,o,a)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return await t(r,i,s,Rt(n,a))};return n},ys=(e)=>{let t=$t(e),n=async(r,i,o,a)=>await t(r,i,o,Rt(n,a));return n},vs=(e)=>(t,n,r)=>{let i=r?{...r,direction:"backward"}:{direction:"backward"};return Cn(e)(t,n,i)},_s=(e)=>(t,n,r)=>Cn(e)(t,n,r),bs=(e)=>async(t,n,r)=>{let i=r?{...r,direction:"backward"}:{direction:"backward"};return Nn(e)(t,n,i)},ws=(e)=>async(t,n,r)=>Nn(e)(t,n,r),Es=/^[cC][0-9a-z]{6,}$/,ks=/^[0-9a-z]+$/,Ts=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ss=/^[0-9a-vA-V]{20}$/,Is=/^[A-Za-z0-9]{27}$/,Os=/^[a-zA-Z0-9_-]{21}$/;function As(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var xs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ns=/^([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})$/,tr=(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})$`)},Rs=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,zs="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function $s(){return new RegExp(zs,"u")}var Ls=/^(?:(?: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])$/,Us=/^(([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}|:))$/,js=/^((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])$/,Bs=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Fs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zs=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Hs=/^https?$/,qs=/^\+[1-9]\d{6,14}$/,Oi="(?:(?:\\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])))";function Vs(e){return new RegExp(`^${e}$`)}var Js=Vs(Oi);function rn(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}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Ws(e){return new RegExp(`^${rn(e)}$`)}function Ks(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${rn({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${rn({precision:e.precision})}`:n;return new RegExp(`^${Oi}T(?:${r})$`)}var Gs=/^[\s\S]{0,}$/,Ys=/^-?\d+$/,Pn=/^-?\d+(?:\.\d+)?$/,Xs=/^(?:true|false)$/i,Qs=/^[^A-Z]*$/,el=/^[^a-z]*$/,G=h("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Rn=(e)=>{let t=e.value;return!Aa(t)&&t.length!==void 0},wt={number:"number",bigint:"bigint",object:"date"},xi=h("$ZodCheckLessThan",(e,t)=>{G.init(e,t);let n=wt[typeof t.value];e._zod.check=(r)=>{if(t.inclusive?r.value<=t.value:r.value<t.value)return;r.issues.push({origin:wt[typeof r.value]??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})}}),Ci=h("$ZodCheckGreaterThan",(e,t)=>{G.init(e,t);let n=wt[typeof t.value];e._zod.check=(r)=>{if(t.inclusive?r.value>=t.value:r.value>t.value)return;r.issues.push({origin:wt[typeof r.value]??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})}}),tl=h("$ZodCheckMultipleOf",(e,t)=>{G.init(e,t),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"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):xa(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})}}),nl=h("$ZodCheckNumberFormat",(e,t)=>{G.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[i,o]=wi[t.format];e._zod.check=(a)=>{let s=a.value;if(n){if(!Number.isInteger(s)){a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){if(s>0)a.issues.push({input:s,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 a.issues.push({input:s,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(s<i)a.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort});if(s>o)a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),rl=h("$ZodCheckMaxLength",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=Rn),e._zod.check=(r)=>{let i=r.value,o=i.length;if((typeof i==="string"&&o>t.maximum?In(i):o)<=t.maximum)return;let a=On(i);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),il=h("$ZodCheckMinLength",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=Rn),e._zod.check=(r)=>{let i=r.value,o=i.length;if((typeof i==="string"&&o>=t.minimum&&o<t.minimum*2?In(i):o)>=t.minimum)return;let a=On(i);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),ol=h("$ZodCheckLengthEquals",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=Rn),e._zod.check=(r)=>{let i=r.value,o=i.length,a=typeof i==="string"&&o>=t.length&&o<=t.length*2?In(i):o;if(a===t.length)return;let s=On(i),l=a>t.length;r.issues.push({origin:s,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Lt=h("$ZodCheckStringFormat",(e,t)=>{var n,r;if(G.init(e,t),t.pattern)(n=e._zod).check??(n.check=(i)=>{if(t.pattern.lastIndex=0,t.pattern.test(i.value))return;i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(r=e._zod).check??(r.check=()=>{})}),al=h("$ZodCheckRegex",(e,t)=>{Lt.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})}}),sl=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Qs),Lt.init(e,t)}),ll=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=el),Lt.init(e,t)}),ul=h("$ZodCheckIncludes",(e,t)=>{G.init(e,t);let n=Me(t.includes),r=new RegExp(typeof t.position==="number"?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=(i)=>{if(i.value.includes(t.includes,t.position))return;i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),cl=h("$ZodCheckStartsWith",(e,t)=>{G.init(e,t);let n=new RegExp(`^${Me(t.prefix)}.*`);t.pattern??(t.pattern=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})}}),fl=h("$ZodCheckEndsWith",(e,t)=>{G.init(e,t);let n=new RegExp(`.*${Me(t.suffix)}$`);t.pattern??(t.pattern=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})}}),gl=h("$ZodCheckOverwrite",(e,t)=>{G.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class Ni{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split(`
3
+ `).filter((i)=>i),n=Math.min(...t.map((i)=>i.length-i.trimStart().length)),r=t.map((i)=>i.slice(n)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of r)this.content.push(i)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
4
+ ${t.join(`
5
+ `)}
6
+ };`)(...Object.values(this.closed))}}var yl={major:4,minor:6,patch:7},R=h("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=yl;let r=e._zod.def.checks,i=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let o of i)for(let a of o._zod.onattach)a(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(s,l,u)=>{if(s.memo)return s;let d=re(s),p;for(let f of l){if(f._zod.def.when){if(Za(s))continue;if(!f._zod.def.when(s))continue}else if(d)continue;let m=s.issues.length,g=f._zod.check(s);if(g instanceof Promise&&u?.async===!1)throw new ve;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{if(await g,s.issues.length===m)return;if(nn(s.issues,m,e),!d)d=re(s,m)});else{if(s.issues.length===m)continue;if(nn(s.issues,m,e),!d)d=re(s,m)}}if(p)return p.then(()=>s);return s},a=(s,l,u)=>{if(re(s))return s.aborted=!0,s;let d=o(l,i,u);if(d instanceof Promise){if(u.async===!1)throw new ve;return d.then((p)=>e._zod.parse(p,u))}return e._zod.parse(d,u)};e._zod.run=(s,l)=>{if(l.skipChecks)return e._zod.parse(s,l);if(l.direction==="backward"){let d=e._zod.parse({value:s.value,issues:[]},{...l,skipChecks:!0});if(d instanceof Promise)return d.then((p)=>a(p,s,l));return a(d,s,l)}let u=e._zod.parse(s,l);if(u instanceof Promise){if(l.async===!1)throw new ve;return u.then((d)=>o(d,i,l))}return o(u,i,l)}}},{get "~standard"(){return ki(this,"~standard",Ri(this))},set "~standard"(e){be(this,"~standard",e)}}),Pi=(e,t)=>e.issues.length?{issues:e.issues.map((n)=>_e(n,t,oe()))}:{value:e.value};async function vl(e,t){let n={async:!0};return Pi(await e._zod.run({value:t,issues:[]},n),n)}function Ri(e){return{validate:(t)=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Pi(r,n)}catch(r){}return vl(e,t)},vendor:"zod",version:1}}var zn=h("$ZodString",(e,t)=>{R.init(e,t),e._zod.pattern=t.pattern??Gs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(i){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),j=h("$ZodStringFormat",(e,t)=>{Lt.init(e,t),zn.init(e,t)}),_l=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ns),j.init(e,t)}),bl=h("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=tr(n))}else t.pattern??(t.pattern=tr());j.init(e,t)}),wl=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Rs),j.init(e,t)}),zi=1,Et=2;function $i(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function El(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return $i(e)||Et;return kl(e,t)}function kl(e,t){if(!t.normalize&&t.protocol?.source===Hs.source&&!/^https?:\/\//i.test(e))return zi;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse==="function")return n.parse(e)??Et}return new URL(e)}catch{return Et}}var Tl=/[\t\n\r]/g;function nr(e){return e.replace(Tl,"")}function Sl(e,t){return t.lastIndex=0,t.test(e.hostname)}function Il(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Ol=h("$ZodURL",(e,t)=>{j.init(e,t),e._zod.check=(n)=>{try{let r=n.value.trim(),i=El(r,t);if(i===zi){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(i===Et){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=nr(r);return}if(t.hostname&&!Sl(i,t.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&&!Il(i,t.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort});n.value=t.normalize?i.href:nr(r);return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Al=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=$s()),j.init(e,t)}),xl=h("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?Os:As(t.length)),j.init(e,t)}),Cl=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Es),j.init(e,t)}),Nl=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ks),j.init(e,t)}),Pl=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ts),j.init(e,t)}),Rl=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ss),j.init(e,t)}),zl=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Is),j.init(e,t)}),$l=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ks(t)),j.init(e,t)}),Ll=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Js),j.init(e,t)}),Ml=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ws(t)),j.init(e,t)}),Ul=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=xs),j.init(e,t)}),Dl=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ls),j.init(e,t)}),jl=/^[0-9a-fA-F:.]+$/;function Li(e){if(!jl.test(e))return!1;return $i(`http://[${e}]`)}var Bl=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Us),j.init(e,t),e._zod.check=(n)=>{if(!Li(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Fl=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=js),j.init(e,t)});function Zl(e){let t=e.split("/");if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);if(`${i}`!==r)return!1;if(i<0||i>128)return!1;return Li(n)}var Hl=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Bs),j.init(e,t),e._zod.check=(n)=>{if(!Zl(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Mi(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 Ui=/^[0-9a-zA-Z+/]*={0,2}$/,ql=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ui),j.init(e,t),e._zod.check=(n)=>{if(Mi(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),$n=/^[A-Za-z0-9_-]*$/;function Vl(e){if(!$n.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Mi(n)}var Jl=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=$n),j.init(e,t),e._zod.check=(n)=>{if(Vl(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Wl=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=qs),j.init(e,t)});function Kl(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));if("typ"in i&&i?.typ!=="JWT")return!1;if(!i.alg)return!1;if(t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}var Gl=h("$ZodJWT",(e,t)=>{j.init(e,t),e._zod.check=(n)=>{if(Kl(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Di=h("$ZodNumber",(e,t)=>{R.init(e,t),e._zod.pattern=Pn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(a){}let i=n.value;if(typeof i==="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;let o=typeof i==="number"?Number.isNaN(i)?"NaN":!Number.isFinite(i)?String(i):void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),Yl=h("$ZodNumberFormat",(e,t)=>{nl.init(e,t),Di.init(e,t)}),Xl=h("$ZodBoolean",(e,t)=>{R.init(e,t),e._zod.pattern=Xs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(o){}let i=n.value;if(typeof i==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),Ql=h("$ZodUnknown",(e,t)=>{R.init(e,t),e._zod.parse=(n)=>n}),eu=h("$ZodNever",(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),tu=h("$ZodVoid",(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(typeof i>"u")return n;return n.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),n}}),nu=h("$ZodDate",(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(a){}let i=n.value,o=i instanceof Date;if(o&&!Number.isNaN(i.getTime()))return n;return n.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:e}),n}});function ru(e,t){let n=Kn(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map((o)=>o[0])),i=e._zod.parse;e._zod.parse=(o,a)=>{let s=t(o.value);if(s>r&&!a?.skipChecks&&a?.direction!=="backward"){for(let[l,u]of Kn(e._zod.def.checks))if(s>l&&u._zod.def.when(o)){let d=o.issues.length;return u._zod.check(o),o.issues[d].continue=!1,nn(o.issues,d,e),o}}return i(o,a)}}var iu=(e)=>Array.isArray(e)?e.length:-1;function rr(e,t,n){if(e.issues.length)t.issues.push(...ye(n,e.issues));t.value[n]=e.value}var ou=h("$ZodArray",(e,t)=>{R.init(e,t);let n=Q.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=n?n.alloc(e,r,Array(o.length),i):Array(o.length);let a=[],s=i?.abortEarly;for(let l=0;l<o.length;l++){let u=o[l],d=t.element._zod.run({value:u,issues:[]},i);if(d instanceof Promise)a.push(d.then((p)=>rr(p,r,l)));else if(rr(d,r,l),s&&d.issues.length!==0&&re(d))break}if(a.length)return Promise.all(a).then(()=>r);return r},ru(e,iu)});function kt(e,t,n,r,i,o){let a=n in r,s=o==="optional";if(!a&&s&&i==="optional")return;if(e.issues.length){if(i!==void 0&&s&&!a)return;t.issues.push(...ye(n,e.issues))}if(!a&&i===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(e.value===void 0){if(a||i==="defaulted"&&!s)t.value[n]=void 0}else t.value[n]=e.value}var au=[];function ji(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:au,i=r.length?[...t,...r]:t;for(let a of i)if(!e.shape?.[a]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(a)}": expected a Zod schema`);let o=$a(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function Bi(e,t,n,r,i,o,a){let s=[],l=i.keySet,u=i.catchall._zod,d=u.def.type,{optin:p,optout:f}=u,m=0;for(let g in t){if(a&&n.issues.length!==m){if(re(n,m))break;m=n.issues.length}if(l.has(g))continue;if(g==="__proto__"){if(d==="never")s.push(g);continue}if(d==="never"){s.push(g);continue}let y=u.run({value:t[g],issues:[]},r);if(y instanceof Promise)e.push(y.then((T)=>kt(T,n,g,t,p,f)));else kt(y,n,g,t,p,f)}if(s.length)n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o,continue:!0});if(!e.length)return n;return Promise.all(e).then(()=>n)}var su=h("$ZodObject",(e,t)=>{R.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){let u=()=>{let d={...r};return Object.defineProperty(t,"shape",{value:d}),u.raw=d,d};u.raw=r,Object.defineProperty(t,"shape",{get:u})}let i=Nt(()=>ji(t));x(e,"propValues",(u)=>{let d=u.def.shape,p={};for(let f in d){let m=d[f]._zod;if(m.values){if(!Object.prototype.hasOwnProperty.call(p,f))ae(p,f,new Set);for(let g of m.values)p[f].add(g);if(m.optin!==void 0)p[f].add(void 0)}}return p});let o=tt,a=t.catchall,s,l=Q.memoizer;l?.attach(e),e._zod.parse=(u,d)=>{s??(s=i.value);let p=u.value;if(!o(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value=l?l.alloc(e,u,{},d):{};let f=[],m=s.shape,g=d?.abortEarly,y=u.issues.length;for(let T of s.allKeys){if(g&&u.issues.length!==y){if(re(u,y))break;y=u.issues.length}if(T==="__proto__")continue;let b=m[T],U=b._zod.optin,C=b._zod.optout,N=b._zod.run({value:p[T],issues:[]},d);if(N instanceof Promise)f.push(N.then((S)=>kt(S,u,T,p,U,C)));else kt(N,u,T,p,U,C)}if(!a)return f.length?Promise.all(f).then(()=>u):u;return Bi(f,p,u,d,i.value,e,g===!0)}}),lu=h("$ZodObjectJIT",(e,t)=>{su.init(e,t);let n=e._zod.parse,r=Nt(()=>ji(t)),i=Q.memoizer,o=(f)=>{let m=r.value,g=m.symbolKeys,y=new Ni(["payload","ctx"],{shape:f,inst:e,memo:i,syms:g}),T=(N)=>`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`,b=(N,S)=>`
7
+ let ${N}_ab = false;
8
+ for (let i = 0; i < ${N}.issues.length; i++) {
9
+ const iss = ${N}.issues[i];
10
+ iss.path = iss.path ? [${S}, ...iss.path] : [${S}];
11
+ payload.issues.push(iss);
12
+ if (iss.continue !== true) ${N}_ab = true;
13
+ }
14
+ if (${N}_ab && ctx && ctx.abortEarly) {
15
+ payload.value = newResult;
16
+ return payload;
17
+ }`;y.write("const input = payload.value;");let U=Object.create(null),C=0;for(let N of m.allKeys)U[N]=`key_${C++}`;y.write(i?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let N of m.allKeys){if(N==="__proto__")continue;let S=U[N],q=typeof N==="symbol"?`syms[${g.indexOf(N)}]`:Na(N),ce=`${q} in input`,Ee=f[N],Be=Ee?._zod?.optin,Fe=Be!==void 0,Ut=Ee?._zod?.optout==="optional";if(y.write(`const ${S} = ${T(q)};`),Fe&&Ut){let Ze=Be==="optional"?`${S}_present`:`${S}.value !== undefined || ${S}_present`;y.write(`
18
+ const ${S}_present = ${ce};
19
+ if (!${S}.issues.length || ${S}_present) {
20
+ if (${S}.issues.length) {${b(S,q)}
21
+ }
22
+
23
+ if (${Ze}) {
24
+ newResult[${q}] = ${S}.value;
25
+ }
26
+ }
27
+
28
+ `)}else if(!Fe)y.write(`
29
+ const ${S}_present = ${ce};
30
+ if (${S}.issues.length) {${b(S,q)}
31
+ }
32
+ if (!${S}_present && !${S}.issues.length) {
33
+ payload.issues.push({
34
+ code: "invalid_type",
35
+ expected: "nonoptional",
36
+ input: undefined,
37
+ path: [${q}]
38
+ });
39
+ if (ctx && ctx.abortEarly) {
40
+ payload.value = newResult;
41
+ return payload;
42
+ }
43
+ }
44
+
45
+ if (${S}_present) {
46
+ newResult[${q}] = ${S}.value;
47
+ }
48
+
49
+ `);else if(y.write(`
50
+ if (${S}.issues.length) {${b(S,q)}
51
+ }
52
+ `),Be==="defaulted")y.write(`newResult[${q}] = ${S}.value;`);else y.write(`
53
+ if (${S}.value !== undefined || ${ce}) {
54
+ newResult[${q}] = ${S}.value;
55
+ }
56
+ `)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},a,s=tt,l=!Q.jitless,u=l&&Ra.value,d=t.catchall,p;e._zod.parse=(f,m)=>{p??(p=r.value);let g=f.value;if(!s(g))return f.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),f;if(l&&u&&m?.async===!1&&m.jitless!==!0){if(!a)a=o(t.shape);if(f=a(f,m),!d)return f;return Bi([],g,f,m,p,e,m?.abortEarly===!0)}return n(f,m)}});function ir(e,t,n,r){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let i=e.filter((o)=>!re(o));if(i.length===1)return t.value=i[0].value,i[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((o)=>o.issues.map((a)=>_e(a,r,oe())))}),t}var Fi=h("$ZodUnion",(e,t)=>{R.init(e,t),x(e,"optin",(r)=>r.def.options.some((i)=>i._zod.optin==="defaulted")?"defaulted":r.def.options.some((i)=>i._zod.optin!==void 0)?"optional":void 0),x(e,"optout",(r)=>r.def.options.some((i)=>i._zod.optout==="optional")?"optional":void 0),x(e,"values",(r)=>{if(r.def.options.every((i)=>i._zod.values))return new Set(r.def.options.flatMap((i)=>Array.from(i._zod.values)));return}),x(e,"pattern",(r)=>{if(r.def.options.every((i)=>i._zod.pattern)){let i=r.def.options.map((o)=>o._zod.pattern);return new RegExp(`^(${i.map((o)=>Tn(o.source)).join("|")})$`)}return});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let o=!1,a=[];for(let s of t.options){let l=s._zod.run({value:r.value,issues:[]},i);if(l instanceof Promise)a.push(l),o=!0;else{if(l.issues.length===0)return l;a.push(l)}}if(!o)return ir(a,r,e,i);return Promise.all(a).then((s)=>ir(s,r,e,i))}});function uu(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let i of r)if(t.has(i)){if(i!==void 0)throw Error(`Duplicate discriminator value "${String(i)}"`);t.set(i,null)}else t.set(i,n)}return t}var cu=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Fi.init(e,t);let n=e._zod.parse;x(e,"propValues",(i)=>{let o={},a=0;for(let s of i.def.options){let l=s._zod.propValues;if(!l||Object.keys(l).length===0)throw Error(`Invalid discriminated union option at index "${i.def.options.indexOf(s)}"`);if(l[i.def.discriminator]?.has(void 0))a++;for(let[u,d]of Object.entries(l)){if(!Object.prototype.hasOwnProperty.call(o,u))ae(o,u,new Set);for(let p of d)o[u].add(p)}}if(!i.def.unionFallback&&a>1)o[i.def.discriminator]?.delete(void 0);return o}),t.options.forEach((i,o)=>{let a=Sn(i._zod.def);if(a&&!Object.prototype.hasOwnProperty.call(a,t.discriminator))throw Error(`Invalid discriminated union option at index "${o}"`)});let r=Nt(()=>uu(t));e._zod.parse=(i,o)=>{let a=i.value;if(!tt(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),i;let s=a?.[t.discriminator],l=r.value.get(s);if(l&&(s!==void 0||o.direction!=="backward"))return l._zod.run(i,o);if(t.unionFallback||o.direction==="backward")return n(i,o);return i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter((u)=>r.value.get(u)!==null),input:a,path:[t.discriminator],inst:e}),i}}),du=h("$ZodIntersection",(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{let i=n.value,o=t.left._zod.run({value:i,issues:[]},r),a=t.right._zod.run({value:i,issues:[]},r);if(o instanceof Promise||a instanceof Promise)return Promise.all([o,a]).then(([s,l])=>or(n,s,l));return or(n,o,a)}});function on(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(Le(e)&&Le(t)){let n=Object.keys(t),r=Object.keys(e).filter((o)=>n.indexOf(o)!==-1),i={...e,...t};if(Object.prototype.hasOwnProperty.call(i,"__proto__"))delete i.__proto__;for(let o of r){if(o==="__proto__")continue;let a=on(e[o],t[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};i[o]=a.data}return{valid:!0,data:i}}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 i=e[r],o=t[r],a=on(i,o);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function or(e,t,n){let r=new Map,i,o=new Map,a=(u,d)=>{let p;if(u.code==="unrecognized_keys"&&!u.path?.length)i??(i=u),p=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let f=String(u.path[0]);if(!o.has(f))o.set(f,u);p=[f]}else return!1;for(let f of p){if(!r.has(f))r.set(f,{});r.get(f)[d]=!0}return!0};for(let u of t.issues)if(!a(u,"l"))e.issues.push(u);for(let u of n.issues)if(!a(u,"r"))e.issues.push(u);let s=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(s.length){let u=i?s.filter((d)=>i.keys.includes(d)):[];if(u.length)e.issues.push({...i,keys:u});for(let d of s)if(!u.includes(d)&&o.has(d))e.issues.push(o.get(d))}let l=on(t.value,n.value);if(!l.valid){if(re(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(l.mergeErrorPath)}`)}return e.value=l.data,e}var Zi=h("$ZodTuple",(e,t)=>{R.init(e,t);let n=t.items,r=Q.memoizer;r?.attach(e),e._zod.parse=(i,o)=>{let a=i.value;if(!Array.isArray(a))return i.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),i;i.value=r?r.alloc(e,i,[],o):[];let s=[],l=ar(n,"optin"),u=ar(n,"optout");if(!t.rest){if(a.length<l)return i.issues.push({code:"too_small",minimum:l,inclusive:!0,input:a,inst:e,origin:"array"}),i;if(a.length>n.length)i.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:a,inst:e,origin:"array"})}let d=Array(n.length),p=t.rest?o?.abortEarly:void 0,f=!1;for(let m=0;m<n.length;m++){let g=n[m]._zod.run({value:a[m],issues:[]},o);if(g instanceof Promise)s.push(g.then((y)=>{d[m]=y}));else if(d[m]=g,p&&!f&&g.issues.length)f=re(g)}if(t.rest&&!f){let m=n.length-1,g=a.slice(n.length),y=i.issues.length;for(let T of g){if(p&&i.issues.length!==y){if(re(i,y))break;y=i.issues.length}m++;let b=t.rest._zod.run({value:T,issues:[]},o);if(b instanceof Promise)s.push(b.then((U)=>sr(U,i,m)));else sr(b,i,m)}}if(s.length)return Promise.all(s).then(()=>lr(d,i,n,a,u));return lr(d,i,n,a,u)}});function ar(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function sr(e,t,n){if(e.issues.length)t.issues.push(...ye(n,e.issues));t.value[n]=e.value}function lr(e,t,n,r,i){for(let o=0;o<n.length;o++){let a=e[o],s=o<r.length;if(!s&&o>=i&&n[o]._zod.optin==="optional"){t.value.length=o;break}if(a.issues.length){if(!s&&o>=i){t.value.length=o;break}t.issues.push(...ye(o,a.issues))}t.value[o]=a.value}for(let o=t.value.length-1;o>=r.length;o--)if(n[o]._zod.optout==="optional"&&t.value[o]===void 0)t.value.length=o;else break;return t}var pu=h("$ZodRecord",(e,t)=>{R.init(e,t);let n=Q.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let o=r.value;if(!Le(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let a=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let l=new Set;for(let d of s)if(typeof d==="string"||typeof d==="number"||typeof d==="symbol"){if(l.add(typeof d==="number"?d.toString():d),d==="__proto__")continue;let p=t.keyType._zod.run({value:d,issues:[]},i);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(p.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map((g)=>_e(g,i,oe())),input:d,path:[d],inst:e});continue}let f=p.value;if(f==="__proto__")continue;let m=t.valueType._zod.run({value:o[d],issues:[]},i);if(m instanceof Promise)a.push(m.then((g)=>{if(g.issues.length)r.issues.push(...ye(d,g.issues));r.value[f]=g.value}));else{if(m.issues.length)r.issues.push(...ye(d,m.issues));r.value[f]=m.value}}let u;for(let d in o)if(!l.has(d))if(t.mode==="loose"){if(d==="__proto__")continue;r.value[d]=o[d]}else u=u??[],u.push(d);if(u&&u.length>0)r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:u,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let l;for(let u of Reflect.ownKeys(o)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(o,u))continue;let d=t.keyType._zod.run({value:u,issues:[]},i);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&Pn.test(u)&&d.issues.length){let m=t.keyType._zod.run({value:Number(u),issues:[]},i);if(m instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(m.issues.length===0)d=m}if(d.issues.length){if(t.mode==="loose")r.value[u]=o[u];else if(s)l=l??[],l.push(u);else r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((m)=>_e(m,i,oe())),input:u,path:[u],inst:e});continue}let p=d.value;if(p==="__proto__")continue;let f=t.valueType._zod.run({value:o[u],issues:[]},i);if(f instanceof Promise)a.push(f.then((m)=>{if(m.issues.length)r.issues.push(...ye(u,m.issues));r.value[p]=m.value}));else{if(f.issues.length)r.issues.push(...ye(u,f.issues));r.value[p]=f.value}}if(l&&l.length>0)r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l,continue:!0})}if(a.length)return Promise.all(a).then(()=>r);return r}}),fu=h("$ZodEnum",(e,t)=>{R.init(e,t);let n=Qt(t.entries),r=new Set(n);e._zod.values=r,x(e,"pattern",(i)=>{let o=Qt(i.def.entries).filter((a)=>za.has(typeof a));return new RegExp(o.length?`^(${o.map((a)=>Me(a.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(i,o)=>{let a=i.value;if(r.has(a))return i;return i.issues.push({code:"invalid_value",values:n,input:a,inst:e}),i}}),mu=h("$ZodLiteral",(e,t)=>{R.init(e,t);let n=new Set(t.values);e._zod.values=n,x(e,"pattern",(r)=>{let i=r.def.values;return new RegExp(i.length?`^(${i.map((o)=>typeof o==="string"?Me(o):o?Me(o.toString()):String(o)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,i)=>{let o=r.value;if(n.has(o))return r;return r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),hu=h("$ZodTransform",(e,t)=>{R.init(e,t),e._zod.optin="optional",Q.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new xn(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then((o)=>(n.value=o,n));if(i instanceof Promise)throw new ve;return n.value=i,n}});function ur(e,t){return e.value=t.issues.length?void 0:t.value,e}var Hi=h("$ZodOptional",(e,t)=>{R.init(e,t),x(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",x(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),x(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Tn(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let i=t.innerType._zod.run({value:n.value,issues:[]},r);if(i instanceof Promise)return i.then((o)=>ur(n,o));return ur(n,i)}return t.innerType._zod.run(n,r)}}),gu=h("$ZodExactOptional",(e,t)=>{Hi.init(e,t),x(e,"values",(n)=>n.def.innerType._zod.values),x(e,"pattern",(n)=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),yu=h("$ZodNullable",(e,t)=>{R.init(e,t),x(e,"optin",(n)=>n.def.innerType._zod.optin),x(e,"optout",(n)=>n.def.innerType._zod.optout),x(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Tn(r.source)}|null)$`):void 0}),x(e,"values",(n)=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>{if(n.value===null)return n;return t.innerType._zod.run(n,r)}}),vu=h("$ZodDefault",(e,t)=>{R.init(e,t),e._zod.optin="defaulted",x(e,"values",(n)=>n.def.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 i=t.innerType._zod.run(n,r);if(i instanceof Promise)return i.then((o)=>cr(o,t));return cr(i,t)}});function cr(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var _u=h("$ZodPrefault",(e,t)=>{R.init(e,t),e._zod.optin="defaulted",x(e,"values",(n)=>n.def.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)}}),bu=h("$ZodNonOptional",(e,t)=>{R.init(e,t),x(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r].filter((i)=>i!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);if(i instanceof Promise)return i.then((o)=>dr(o,e));return dr(i,e)}});function dr(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}function pr(e,t,n,r){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map((i)=>_e(i,r,oe()))},input:e.value}),e}var wu=h("$ZodCatch",(e,t)=>{R.init(e,t),x(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),x(e,"optout",(n)=>n.def.innerType._zod.optout),x(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let i=t.innerType._zod.run({value:n.value,issues:[]},r);if(i instanceof Promise)return i.then((o)=>pr(n,o,t,r));return pr(n,i,t,r)}}),qi=h("$ZodPipe",(e,t)=>{R.init(e,t),x(e,"values",(n)=>n.def.in._zod.values),x(e,"optin",(n)=>n.def.in._zod.optin),x(e,"optout",(n)=>n.def.out._zod.optout),x(e,"propValues",(n)=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let o=t.out._zod.run(n,r);if(o instanceof Promise)return o.then((a)=>st(a,t.in,r));return st(o,t.in,r)}let i=t.in._zod.run(n,r);if(i instanceof Promise)return i.then((o)=>st(o,t.out,r));return st(i,t.out,r)}});function st(e,t,n){if(e.issues.some((r)=>r.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},n)}var Eu=h("$ZodPreprocess",(e,t)=>{qi.init(e,t)}),ku=h("$ZodReadonly",(e,t)=>{R.init(e,t),x(e,"propValues",(n)=>n.def.innerType._zod.propValues),x(e,"values",(n)=>n.def.innerType._zod.values),x(e,"optin",(n)=>n.def.innerType?._zod?.optin),x(e,"optout",(n)=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let i=t.innerType._zod.run(n,r);if(i instanceof Promise)return i.then(fr);return fr(i)}});function fr(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Tu=h("$ZodFunction",(e,t)=>(R.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=(n)=>{if(typeof n!=="function")throw Error("implement() must be called with a function");return Object.defineProperty(function(...r){let i=e._def.input?Qn(e._def.input,r):r,o=Reflect.apply(n,this,i);if(e._def.output)return Qn(e._def.output,o);return o},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=(n)=>{if(typeof n!=="function")throw Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){let i=e._def.input?await er(e._def.input,r):r,o=await Reflect.apply(n,this,i);if(e._def.output)return await er(e._def.output,o);return o},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(n,r)=>{if(typeof n.value!=="function")return n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n;if(e._def.output&&e._def.output._zod.def.type==="promise")n.value=e.implementAsync(n.value);else n.value=e.implement(n.value);return n},e.input=(...n)=>{let r=e.constructor;if(Array.isArray(n[0]))return new r({type:"function",input:new Zi({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output});return new r({type:"function",input:n[0],output:e._def.output})},e.output=(n)=>new e.constructor({type:"function",input:e._def.input,output:n}),e)),Su=h("$ZodPromise",(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>Promise.resolve(n.value).then((i)=>t.innerType._zod.run({value:i,issues:[]},r))}),Iu=h("$ZodCustom",(e,t)=>{G.init(e,t),R.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=(n)=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then((o)=>mr(o,n,r,e));mr(i,n,r,e);return}});function mr(e,t,n,r){if(!e){let i={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};if(r._zod.def.params)i.params=r._zod.def.params;t.issues.push(nt(i))}}class Vi extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var an="~memo",hr=[];function Ji(e){return e!==null&&typeof e==="object"}function Zt(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Wi=new WeakMap,We=0,gt=1,Xe=2;function yt(e,t,n){let r=Wi.get(e);if(r!==void 0)return r?Xe:We;if(t.has(e))return Xe;t.add(e);let i=We,o=(d)=>{if(i!==Xe&&d?._zod){let p=yt(d,t,n);if(p>i)i=p}},a=(d,p)=>{let f=We;for(let m of Reflect.ownKeys(d)){let g=Object.getOwnPropertyDescriptor(d,m);if(p&&!g.enumerable)continue;let y=g.get?gt:g.value?._zod?yt(g.value,t,n):We;if(y>f)f=y}return f},s=(d)=>{if(d>i)i=d},l=e._zod.def;switch(l.type){case"object":{let d=Sn(l);s(d?a(d,!0):gt),o(l.catchall);break}case"array":o(l.element);break;case"tuple":for(let d of l.items)o(d);o(l.rest);break;case"record":case"map":o(l.keyType),o(l.valueType);break;case"set":o(l.valueType);break;case"union":for(let d of l.options)o(d);break;case"intersection":o(l.left),o(l.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":o(l.innerType);break;case"pipe":o(l.in),o(l.out);break;case"function":o(l.input),o(l.output);break;case"lazy":{let d=l._cachedInner??(n?e._zod.innerType:void 0);s(d?yt(d,t,!1):gt);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let d in l){let p=Object.getOwnPropertyDescriptor(l,d);if(!p||p.get)continue;let f=p.value;if(!f||typeof f!=="object")continue;if(f._zod)o(f);else if(Array.isArray(f))for(let m of f)o(m)}}return t.delete(e),Ou(e,i)}function Ou(e,t){if(t!==gt)Wi.set(e,t===Xe);return t}function Au(e,t){let n=e.buckets.get(t);if(!n)n=new WeakMap,e.buckets.set(t,n);return n}var lt,ut=[],xu={alloc(e,t,n){let r=lt;if(!r)return n;lt=void 0;let i={value:n,issues:null};return r.set(t.value,i),ut.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,r=(i,o)=>{if(o.direction!=="backward"&&Nu(o,i.value))throw new Vi;return n(i,o)};if(e._zod.parse=r,e._zod.run===n)e._zod.run=r})},attach(e){var t;let n,r=!1,i,o;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let a=e._zod.parse,s=(l,u)=>{if(n===void 0){let b=yt(e,new Set,!1);if(b===We){if(e._zod.parse=a,e._zod.run===s)e._zod.run=a;return a(l,u)}if(b===Xe||r)n=!0;else r=!0}let d=l.value;if(!Ji(d))return a(l,u);let p=u[an];if(!p)p={buckets:new WeakMap,backEdges:void 0},u[an]=p;let f;if(i===u)f=o;else f=Au(p,e),i=u,o=f;let m=f.get(d);if(m){if(l.value=m.value,m.issues){if(m.issues.length)l.issues.push(...Zt(m.issues))}else l.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(m.value);return l}lt=f;let g=ut.length,y=a(l,u);lt=void 0;let T=ut.length>g?ut.pop():void 0;if(y instanceof Promise)return y.then((b)=>{if(T)T.issues=b.issues.length?Zt(b.issues):hr;return b});if(T)T.issues=y.issues.length?Zt(y.issues):hr;return y};if(e._zod.parse=s,e._zod.run===a)e._zod.run=s})}};function Cu(){return xu}function Nu(e,t){let n=e[an]?.backEdges;return n!==void 0&&Ji(t)&&n.has(t)}var Pu=()=>{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",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function i(o,a){if(o==="number"&&typeof a==="number"&&!Number.isFinite(a))return String(a);return r[o]??o}return(o)=>{switch(o.code){case"invalid_type":{let a=i(o.expected),s=qa(o.input),l=i(s,o.input);return`Invalid input: expected ${a}, received ${l}`}case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${bi(o.values[0])}`;return`Invalid option: expected one of ${Jn(o.values,"|")}`;case"too_big":{let a=o.exact?"exactly ":o.inclusive?"<=":"<",s=t(o.origin);if(s)return`Too big: expected ${o.origin??"value"} to have ${a}${o.maximum.toString()} ${s.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${a}${o.maximum.toString()}`}case"too_small":{let a=o.exact?"exactly ":o.inclusive?">=":">",s=t(o.origin);if(s)return`Too small: expected ${o.origin} to have ${a}${o.minimum.toString()} ${s.unit}`;return`Too small: expected ${o.origin} to be ${a}${o.minimum.toString()}`}case"invalid_format":{let a=o;if(a.format==="starts_with")return`Invalid string: must start with "${a.prefix}"`;if(a.format==="ends_with")return`Invalid string: must end with "${a.suffix}"`;if(a.format==="includes")return`Invalid string: must include "${a.includes}"`;if(a.format==="regex")return`Invalid string: must match pattern ${a.pattern}`;return`Invalid ${n[a.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":""}: ${Jn(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((a)=>`'${a}'`).join(" | ")}`;if(o.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Ru(){return{localeError:Pu()}}var gr;class Ki{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 zu(){return new Ki}(gr=globalThis).__zod_globalRegistry??(gr.__zod_globalRegistry=zu());var Ke=globalThis.__zod_globalRegistry;function Gi(e){if(e.checks)e.checks=[...e.checks];return e}function $u(e,t){return new e(Gi({type:"string",...w(t)}))}function Lu(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...w(t)})}function Mu(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...w(t)})}function Uu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...w(t)})}function Du(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...w(t)})}function ju(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...w(t)})}function Bu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...w(t)})}function Fu(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...w(t)})}function Zu(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}function Hu(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}function qu(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}function Vu(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}function Ju(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...w(t)})}function Wu(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...w(t)})}function Ku(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...w(t)})}function Gu(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...w(t)})}function Yu(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...w(t)})}function Xu(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...w(t)})}function Qu(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...w(t)})}function ec(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...w(t)})}function tc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...w(t)})}function nc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...w(t)})}function rc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...w(t)})}function ic(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}function oc(e,t){return new e({type:"string",format:"date",check:"string_format",...w(t)})}function ac(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...w(t)})}function sc(e,t){return new e({type:"string",format:"duration",check:"string_format",...w(t)})}function lc(e,t){return new e(Gi({type:"number",checks:[],...w(t)}))}function uc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...w(t)})}function cc(e,t){return new e({type:"boolean",...w(t)})}function dc(e){return new e({type:"unknown"})}function pc(e,t){return new e({type:"never",...w(t)})}function fc(e,t){return new e({type:"void",...w(t)})}function mc(e,t){return new e({type:"date",...w(t)})}function yr(e,t){return new xi({check:"less_than",...w(t),value:e,inclusive:!1})}function vt(e,t){return new xi({check:"less_than",...w(t),value:e,inclusive:!0})}function vr(e,t){return new Ci({check:"greater_than",...w(t),value:e,inclusive:!1})}function _t(e,t){return new Ci({check:"greater_than",...w(t),value:e,inclusive:!0})}function _r(e,t){return new tl({check:"multiple_of",...w(t),value:e})}function Yi(e,t){return new rl({check:"max_length",...w(t),maximum:e})}function Tt(e,t){return new il({check:"min_length",...w(t),minimum:e})}function Xi(e,t){return new ol({check:"length_equals",...w(t),length:e})}function hc(e,t){return new al({check:"string_format",format:"regex",...w(t),pattern:e})}function yc(e){return new sl({check:"string_format",format:"lowercase",...w(e)})}function vc(e){return new ll({check:"string_format",format:"uppercase",...w(e)})}function _c(e,t){return new ul({check:"string_format",format:"includes",...w(t),includes:e})}function bc(e,t){return new cl({check:"string_format",format:"starts_with",...w(t),prefix:e})}function wc(e,t){return new fl({check:"string_format",format:"ends_with",...w(t),suffix:e})}function je(e){return new gl({check:"overwrite",tx:e})}function Ec(e){return je((t)=>t.normalize(e))}function kc(){return je((e)=>e.trim())}function Tc(){return je((e)=>e.toLowerCase())}function Sc(){return je((e)=>e.toUpperCase())}function Ic(){return je((e)=>Pa(e))}function Oc(e,t,n){return new e({type:"array",element:t,...w(n)})}function Ac(e,t,n){let r=w(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function xc(e,t,n){return new e({type:"custom",check:"custom",fn:t,...w(n)})}function Cc(e,t){let n=Nc((r)=>(r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(nt(i,r.value,n._zod.def));else{let o=i;if(o.fatal)o.continue=!1;if(o.code??(o.code="custom"),!("input"in o))o.input=r.value;o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),r.issues.push(nt(o))}},e(r.value,r)),t);return n}function Nc(e,t){let n=new G({check:"custom",...w(t)});return n._zod.check=e,n}function Qe(e,...t){for(let n of t)for(let r of Reflect.ownKeys(n))if(Object.prototype.propertyIsEnumerable.call(n,r))ae(e,r,n[r]);return e}function St(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??Ke,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function J(e,t,n,r,i){let o=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(o==="any")return!1;if(o===void 0||o==="throw")throw Error(i);return Object.assign(n,o),!0}function M(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,o=t.seen.get(e);if(o){if(o.count++,n.schemaPath.includes(e))o.cycle=n.path;return o.schema}let a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let u={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,u);else{let p=a.schema,f=t.processors[i.type];if(!f)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);f(e,t,p,u)}let d=e._zod.parent;if(d){if(!a.ref)a.ref=d;M(d,t,u),t.seen.get(d).isParent=!0}}let l=t.metadataRegistry.get(e);if(l)Qe(a.schema,l);if(t.io==="input"&&W(e))delete a.schema.examples,delete a.schema.default;if(t.io==="input"&&"_prefault"in a.schema)(r=a.schema).default??(r.default=a.schema._prefault);return delete a.schema._prefault,t.seen.get(e).schema}function br(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function It(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let l=r.get(s);if(l&&l!==a[0])throw Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(s,a[0])}}let i=(a)=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(a[0])?.id,f=e.external.uri??((g)=>g);if(p)return{ref:f(p)};let m=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=m,{defId:m,ref:`${f("__shared")}#/${s}/${br(m)}`}}let l="#",u=`${l}/${s}/`;if(a[1]===n&&!a[1].schema.id)return{ref:l};let d=a[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+br(d)}},o=(a)=>{if(a[1].schema.$ref)return;let s=a[1],{ref:l,defId:u}=i(a);if(s.def={...s.schema},u)s.defId=u;let d=s.schema;for(let p in d)delete d[p];d.$ref=l};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
57
+
58
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){o(a);continue}if(e.external){let l=e.external.registry.get(a[0])?.id;if(t!==a[0]&&l){o(a);continue}}if(e.metadataRegistry.get(a[0])?.id){o(a);continue}if(s.cycle){o(a);continue}if(s.count>1){if(e.reused==="ref")o(a)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Qi(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let r of t){if(!r||typeof r!=="object")return;Qi(r);let i=Object.keys(r);if(i.length!==1||i[0]!=="type")return;let o=r.type;for(let a of Array.isArray(o)?o:[o]){if(typeof a!=="string")return;if(!n.includes(a))n.push(a)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var eo=new Set(["type","properties","required","additionalProperties"]),wr=["oneOf","anyOf"];function Er(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function sn(e){let t=[];for(let o of e){if(typeof o!=="object"||o.type!=="object")return null;for(let a in o)if(!eo.has(a))return null;t.push(o)}let n={},r=new Set;for(let o of t){for(let a in o.properties){if(Object.prototype.hasOwnProperty.call(n,a))continue;let s=[];for(let u of t){let d=u.properties?.[a]??Er(u);if(d===null||d===void 0)continue;if(!s.some((p)=>JSON.stringify(p)===JSON.stringify(d)))s.push(d)}let l=s.length===1?s[0]:sn(s)??{allOf:s};ae(n,a,l)}for(let a of o.required??[])r.add(a)}let i={type:"object",properties:n};if(r.size)i.required=[...r];if(t.every((o)=>o.additionalProperties===!1))i.additionalProperties=!1;else{let o=[];for(let a of t){let s=Er(a);if(s&&!o.some((l)=>JSON.stringify(l)===JSON.stringify(s)))o.push(s)}if(o.length===1)i.additionalProperties=o[0];else if(o.length>1)i.additionalProperties={allOf:o}}return i}function Pc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let i of eo)if(i in e)return;let n=t.filter((i)=>wr.some((o)=>Array.isArray(i[o]))),r=null;if(!n.length)r=sn(t);else{let i=n[0],o=wr.find((l)=>Array.isArray(i[l]));if(Object.keys(i).length!==1)return;let a=t.filter((l)=>l!==i),s=i[o].map((l)=>sn([...a,l]));if(s.some((l)=>!l))return;r={[o]:s}}if(!r)return;delete e.allOf,Qe(e,r)}function Ot(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(s)=>{let l=e.seen.get(s);if(l.ref===null)return;let u=l.def??l.schema,d={...u},p=l.ref;if(l.ref=null,p){r(p);let m=e.seen.get(p),g=m.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(g);else Qe(u,g);if(Qe(u,d),s._zod.parent===p)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(!(y in d))delete u[y]}if(g.$ref&&m.def)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(y in m.def&&JSON.stringify(u[y])===JSON.stringify(m.def[y]))delete u[y]}}let f=s._zod.parent;if(f&&f!==p){r(f);let m=e.seen.get(f);if(m?.schema.$ref){if(u.$ref=m.schema.$ref,m.def)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(g in m.def&&JSON.stringify(u[g])===JSON.stringify(m.def[g]))delete u[g]}}}e.override({zodSchema:s,jsonSchema:u,path:l.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let s of[...e.seen.entries()].reverse())r(s[0]);if(e.target!=="openapi-3.0")for(let s of e.seen.entries())Qi(s[1].def??s[1].schema);for(let s of e.deferred)s();if(e.intersections.length){let s=new Map;for(let l of e.seen.values())for(let u of[l.schema,l.def]){let d=u?.allOf;if(!Array.isArray(d))continue;let p=s.get(d);if(p)p.push(u);else s.set(d,[u])}for(let l of e.intersections)for(let u of s.get(l)??[])Pc(u)}}let i={};if(e.target==="draft-2020-12")i.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")i.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")i.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(s)}Qe(i,n.defId?n.schema:n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;if(o!==void 0&&i.id===o)delete i.id;let a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let s of e.seen.entries()){let l=s[1];if(l.def&&l.defId){if(l.def.id===l.defId)delete l.def.id;ae(a,l.defId,l.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(a).length>0)if(e.target==="draft-2020-12")i.$defs=a;else i.definitions=a;try{let s=JSON.parse(JSON.stringify(i));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:At(t,"input",e.processors),output:At(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch(s){throw Error("Error converting schema to JSON.")}}function W(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 W(r.element,n);if(r.type==="set")return W(r.valueType,n);if(r.type==="lazy")return W(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"||r.type==="catch")return W(r.innerType,n);if(r.type==="intersection")return W(r.left,n)||W(r.right,n);if(r.type==="record"||r.type==="map")return W(r.keyType,n)||W(r.valueType,n);if(r.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return W(r.in,n)||W(r.out,n)}if(r.type==="object"){for(let i in r.shape)if(W(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(let i of r.options)if(W(i,n))return!0;return!1}if(r.type==="tuple"){for(let i of r.items)if(W(i,n))return!0;if(r.rest&&W(r.rest,n))return!0;return!1}return!1}var Rc=(e,t={})=>(n)=>{let r=St({...n,processors:t});return M(e,r),It(r,e),Ot(r,e)},At=(e,t,n={})=>(r)=>{let{libraryOptions:i,target:o}=r??{},a=St({...i??{},target:o,io:t,processors:n});return M(e,a),It(a,e),Ot(a,e)},Ue=(e,t,n)=>{if(e[t]===void 0||n>e[t])e[t]=n},De=(e,t,n)=>{if(e[t]===void 0||n<e[t])e[t]=n},kr=(e,t)=>{Ue(e,"minimum",t),De(e,"maximum",t)},to=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},no=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},ro=(e,t)=>{e.mime=e.mime?e.mime.filter((n)=>t.includes(n)):[...t]},io=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Tr=(e,t)=>Ue(e,"minimum",t.minimum),Sr=(e,t)=>De(e,"maximum",t.maximum),Ir=(e)=>(t,n)=>{io(t,n.format);let[r,i]=e[n.format];Ue(t,"minimum",r),De(t,"maximum",i)},zc={greater_than:(e,t)=>Ue(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>De(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>to(e,t.value),number_format:Ir(wi),bigint_format:Ir(La),min_length:Tr,max_length:Sr,length_equals:(e,t)=>kr(e,t.length),min_size:Tr,max_size:Sr,size_equals:(e,t)=>kr(e,t.size),string_format:(e,t)=>{if(io(e,t.format),t.pattern)no(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>ro(e,t.mime)};function K(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let o of r)zc[o._zod.def.check]?.(t,o._zod.def);let i=e._zod.bag;if(i.minimum!==void 0)Ue(t,"minimum",i.minimum);if(i.exclusiveMinimum!==void 0)Ue(t,"exclusiveMinimum",i.exclusiveMinimum);if(i.maximum!==void 0)De(t,"maximum",i.maximum);if(i.exclusiveMaximum!==void 0)De(t,"exclusiveMaximum",i.exclusiveMaximum);if(i.multipleOf!==void 0)to(t,i.multipleOf);if(i.format!==void 0){if(t.format??(t.format=i.format),i.format.includes("int"))t.isInt=!0}if(i.mime)ro(t,i.mime);for(let o of i.patterns??[])no(t,o);return t}var $c={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Lc=new Map([[Ui,Fs],[$n,Zs]]),oo=(e)=>Lc.get(e)??e,ao=(e,t,n,r)=>{let i=n;i.type="string";let{minimum:o,maximum:a,format:s,patterns:l,contentEncoding:u,laxFormat:d}=K(e);if(typeof o==="number")i.minLength=o;if(typeof a==="number")i.maxLength=a;if(s){if(i.format=$c[s]??s,i.format==="")delete i.format;if(s==="time"||d)delete i.format}if(u)i.contentEncoding=u;if(l&&l.size>0){let p=[...l].map(oo);if(p.length===1)i.pattern=p[0].source;else if(p.length>1)i.allOf=[...p.map((f)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))]}},so=(e,t,n,r)=>{let i=n,{minimum:o,maximum:a,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:u,isInt:d}=K(e);i.type=d?"integer":"number";let p=typeof u==="number"&&u>=(o??Number.NEGATIVE_INFINITY),f=typeof l==="number"&&l<=(a??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(p)if(m)i.minimum=u,i.exclusiveMinimum=!0;else i.exclusiveMinimum=u;else if(typeof o==="number")i.minimum=o;if(f)if(m)i.maximum=l,i.exclusiveMaximum=!0;else i.exclusiveMaximum=l;else if(typeof a==="number")i.maximum=a;if(s){let g=new Set;for(let b of s)if(Number.isFinite(b)&&b!==0)g.add(Math.abs(b));else J(e,t,i,r,`A multipleOf divisor of ${b} cannot be represented in JSON Schema`);let[y,...T]=g;if(y!==void 0)i.multipleOf=y;if(T.length)i.allOf=[...i.allOf??[],...T.map((b)=>({multipleOf:b}))]}},lo=(e,t,n,r)=>{n.type="boolean"},Mc=(e,t,n,r)=>{J(e,t,n,r,"BigInt cannot be represented in JSON Schema")},Uc=(e,t,n,r)=>{J(e,t,n,r,"Symbols cannot be represented in JSON Schema")},Dc=(e,t,n,r)=>{if(t.target==="openapi-3.0")n.type="string",n.nullable=!0,n.enum=[null];else n.type="null"},jc=(e,t,n,r)=>{J(e,t,n,r,"Undefined cannot be represented in JSON Schema")},uo=(e,t,n,r)=>{J(e,t,n,r,"Void cannot be represented in JSON Schema")},co=(e,t,n,r)=>{n.not={}},Bc=(e,t,n,r)=>{},po=(e,t,n,r)=>{},fo=(e,t,n,r)=>{J(e,t,n,r,"Date cannot be represented in JSON Schema")},mo=(e,t,n,r)=>{let i=e._zod.def,o=Qt(i.entries);if(o.length===0){n.not={};return}if(o.every((a)=>typeof a==="number"))n.type="number";if(o.every((a)=>typeof a==="string"))n.type="string";n.enum=o},ho=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let o=[];for(let a of i.values)if(a===void 0){if(J(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a==="bigint"){if(J(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(a))}else o.push(a);if(o.length===0);else if(o.length===1){let a=o[0];if(n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0")n.enum=[a];else n.const=a}else{if(o.every((a)=>typeof a==="number"))n.type="number";if(o.every((a)=>typeof a==="string"))n.type="string";if(o.every((a)=>typeof a==="boolean"))n.type="boolean";if(o.every((a)=>a===null))n.type="null";n.enum=o}},Fc=(e,t,n,r)=>{J(e,t,n,r,"NaN cannot be represented in JSON Schema")},Zc=(e,t,n,r)=>{let i=n,o=e._zod.pattern;if(!o)throw Error("Pattern not found in template literal");i.type="string",i.pattern=o.source},Hc=(e,t,n,r)=>{let i=n;i.type="string",i.format="binary",i.contentEncoding="binary";let{minimum:o,maximum:a,mime:s}=K(e);if(o!==void 0)i.minLength=o;if(a!==void 0)i.maxLength=a;if(!s)return;if(s.length===0)i.not={};else if(s.length===1)i.contentMediaType=s[0];else i.anyOf=s.map((l)=>({contentMediaType:l}))},qc=(e,t,n,r)=>{n.type="boolean"},go=(e,t,n,r)=>{J(e,t,n,r,"Custom types cannot be represented in JSON Schema")},yo=(e,t,n,r)=>{J(e,t,n,r,"Function types cannot be represented in JSON Schema")},vo=(e,t,n,r)=>{J(e,t,n,r,"Transforms cannot be represented in JSON Schema")},Vc=(e,t,n,r)=>{J(e,t,n,r,"Map cannot be represented in JSON Schema")},Jc=(e,t,n,r)=>{J(e,t,n,r,"Set cannot be represented in JSON Schema")},_o=(e,t,n,r)=>{let i=n,o=e._zod.def,{minimum:a,maximum:s}=K(e);if(typeof a==="number")i.minItems=a;if(typeof s==="number")i.maxItems=s;i.type="array",i.items=M(o.element,t,{...r,path:[...r.path,"items"]})};function rt(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return rt(t.out);if(t.type==="catch")return rt(t.innerType);return e._zod.optin}var bo=(e,t,n,r)=>{let i=n,o=e._zod.def,a=o.shape;if(Object.getOwnPropertySymbols(a).length&&J(e,t,i,r,"Symbol keys cannot be represented in JSON Schema"))return;i.type="object",i.properties={};for(let l in a)ae(i.properties,l,M(a[l],t,{...r,path:[...r.path,"properties",l]}));let s=[];for(let l of Object.keys(a)){let u=o.shape[l];if(t.io==="input"?rt(u)===void 0:u._zod.optout===void 0)s.push(l)}if(s.length>0)i.required=s;if(o.catchall?._zod.def.type==="never")i.additionalProperties=!1;else if(!o.catchall){if(t.io==="output")i.additionalProperties=!1}else if(o.catchall)i.additionalProperties=M(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})},wo=(e,t,n,r)=>{let i=e._zod.def,o=i.inclusive===!1,a=i.options.map((s,l)=>M(s,t,{...r,path:[...r.path,o?"oneOf":"anyOf",l]}));if(o)n.oneOf=a;else n.anyOf=a},Eo=(e,t,n,r)=>{let i=e._zod.def,o=M(i.left,t,{...r,path:[...r.path,"allOf",0]}),a=M(i.right,t,{...r,path:[...r.path,"allOf",1]}),s=(u)=>("allOf"in u)&&Object.keys(u).length===1,l=[...s(o)?o.allOf:[o],...s(a)?a.allOf:[a]];n.allOf=l,t.intersections.push(l)},ko=(e,t,n,r)=>{let i=n,o=e._zod.def;i.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",l=o.items.map((y,T)=>M(y,t,{...r,path:[...r.path,a,T]})),u=o.rest?M(o.rest,t,{...r,path:[...r.path,s,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null,d=o.items.length;while(d>0){let y=o.items[d-1];if(!(t.io==="input"?rt(y)!==void 0:y._zod.optout==="optional"))break;d--}let p=o.items.length,f=!o.rest;if(t.target==="draft-2020-12"){if(i.prefixItems=l,f)i.items=!1;else if(u)i.items=u;if(d>0)i.minItems=d;if(f)i.maxItems=p}else if(t.target==="openapi-3.0"){if(i.items={anyOf:l},u)i.items.anyOf.push(u);if(d>0)i.minItems=d;if(f)i.maxItems=p}else{if(i.items=l,f)i.additionalItems=!1;else if(u)i.additionalItems=u;if(d>0)i.minItems=d;if(f)i.maxItems=p}let{minimum:m,maximum:g}=K(e);if(typeof m==="number")i.minItems=m;if(typeof g==="number")i.maxItems=g};function ln(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let g=e.get(t)?.def;if(!g)return t;let y=ln(e,g,n);return y===g?t:y}for(let g of["anyOf","oneOf"]){let y=t[g];if(!Array.isArray(y))continue;let T=y.map((b)=>ln(e,b,n));if(T.some((b,U)=>b!==y[U]))t={...t,[g]:T}}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes("string")&&r.some((g)=>g==="number"||g==="integer"),o=t.enum??(t.const!==void 0?[t.const]:void 0);if(!i&&!o?.some((g)=>typeof g==="number"))return t;let{minimum:a,maximum:s,exclusiveMinimum:l,exclusiveMaximum:u,multipleOf:d,format:p,id:f,...m}=t;if(m.enum)m.enum=m.enum.map((g)=>typeof g==="number"?String(g):g);else if(typeof m.const==="number")m.const=String(m.const);if(!i)return m;if(m.type="string",!o)m.pattern=(r.includes("number")?Pn:Ys).source;return m}var un=new WeakMap;function Wc(e){let t=new Map;for(let r of e.seen.values())if(r.def&&!t.has(r.schema))t.set(r.schema,r);let n=new Map;for(let r of un.get(e)??[]){let i=e.seen.get(r),o=(i?.def??i?.schema)?.propertyNames;if(!o||o===!0||n.has(o))continue;let a=ln(t,o,new Set);if(a!==o)n.set(o,a)}if(!n.size)return;for(let r of e.seen.values())for(let i of[r.schema,r.def]){let o=i&&n.get(i.propertyNames);if(o)i.propertyNames=o}}var To=(e,t,n,r)=>{let i=n,o=e._zod.def;i.type="object";let a=o.keyType,s=K(a).patterns;if(o.mode==="loose"&&s&&s.size>0){let d=M(o.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(let p of s)ae(i.patternProperties,oo(p).source,d)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){i.propertyNames=M(o.keyType,t,{...r,path:[...r.path,"propertyNames"]});let d=un.get(t);if(!d)d=[],un.set(t,d),t.deferred.push(()=>Wc(t));d.push(e)}i.additionalProperties=M(o.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let l=a._zod.values,u=t.io==="input"&&rt(o.valueType)!==void 0;if(l&&!o.partial&&!u){let d=[...l].filter((p)=>typeof p==="string"||typeof p==="number");if(d.length>0)i.required=d.map(String)}},So=(e,t,n,r)=>{let i=e._zod.def,o=M(i.innerType,t,r),a=t.seen.get(e);if(t.target==="openapi-3.0")a.ref=i.innerType,n.nullable=!0;else n.anyOf=[o,{type:"null"}]},Io=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let o=t.seen.get(e);o.ref=i.innerType},Ln=Symbol();function Oo(e,t,n,r,i){let o=!1,a=JSON.stringify(e,(s,l)=>{if(typeof l!=="bigint")return l;return o=!0,null});if(!o)return JSON.parse(a);return J(t,n,r,i,"BigInt defaults cannot be represented in JSON Schema"),Ln}var Ao=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let o=t.seen.get(e);o.ref=i.innerType;let a=Oo(i.defaultValue,e,t,n,r);if(a!==Ln)n.default=a},xo=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let o=t.seen.get(e);if(o.ref=i.innerType,t.io!=="input")return;let a=Oo(i.defaultValue,e,t,n,r);if(a!==Ln)n._prefault=a},Co=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let o=t.seen.get(e);o.ref=i.innerType;let a;try{a=i.catchValue(void 0)}catch{J(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=a},No=(e,t,n,r)=>{let i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?o?i.out:i.in:i.out;M(a,t,r);let s=t.seen.get(e);s.ref=a},Po=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let o=t.seen.get(e);o.ref=i.innerType,n.readOnly=!0},Ro=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let o=t.seen.get(e);o.ref=i.innerType},Mn=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let o=t.seen.get(e);o.ref=i.innerType},Kc=(e,t,n,r)=>{let i=e._zod.innerType;M(i,t,r);let o=t.seen.get(e);o.ref=i},Or={string:ao,number:so,boolean:lo,bigint:Mc,symbol:Uc,null:Dc,undefined:jc,void:uo,never:co,any:Bc,unknown:po,date:fo,enum:mo,literal:ho,nan:Fc,template_literal:Zc,file:Hc,success:qc,custom:go,function:yo,transform:vo,map:Vc,set:Jc,array:_o,object:bo,union:wo,intersection:Eo,tuple:ko,record:To,nullable:So,nonoptional:Io,default:Ao,prefault:xo,catch:Co,pipe:No,readonly:Po,promise:Ro,optional:Mn,lazy:Kc};function Gc(e,t){if("_idmap"in e){let r=e,i=St({...t,processors:Or}),o={};for(let l of r._idmap.entries()){let[u,d]=l;M(d,i)}let a={},s={registry:r,uri:t?.uri,defs:o};i.external=s;for(let l of r._idmap.entries()){let[u,d]=l;It(i,d),ae(a,u,Ot(i,d))}if(Object.keys(o).length>0){let l=i.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[l]:o}}return{schemas:a}}let n=St({...t,processors:Or});return M(e,n),It(n,e),Ot(n,e)}var Ar=new WeakSet([Object.prototype,Error.prototype]);function ct(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}var Yc=(e,t)=>{rs.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);if(Ar.has(n))return;Ar.add(n),ct(n,"format",(r)=>(i)=>as(r,i)),ct(n,"flatten",(r)=>(i)=>os(r,i)),ct(n,"addIssue",(r)=>(i)=>{r.issues.push(i),r.message=JSON.stringify(r.issues,tn,2)}),ct(n,"addIssues",(r)=>(i)=>{r.issues.push(...i),r.message=JSON.stringify(r.issues,tn,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})},ee=h("ZodError",Yc,void 0,{Parent:Error}),Xc=zt(ee),Qc=$t(ee),ed=Cn(ee),td=Nn(ee),nd=ms(ee),rd=hs(ee),id=gs(ee),od=ys(ee),ad=vs(ee),sd=_s(ee),ld=bs(ee),ud=ws(ee);function cd(){if(!Q.localeError)oe(Ru())}function it(){if(!Q.memoizer)oe({memoizer:Cu()})}var z=h("ZodType",(e,t)=>(cd(),R.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Y(t,{checks:[...t.checks??[],...e.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return we(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(wp(e,t))},superRefine(e,t){return this.check(Ep(e,t))},overwrite(e){return this.check(je(e))},optional(){return Nr(this)},exactOptional(){return Yd(this)},nullable(){return Rr(this)},nullish(){return Nr(Rr(this))},nonoptional(e){return fp(this,e)},array(){return I(this)},or(e){return Ne([this,e])},and(e){return Vd(this,e)},transform(e){return zr(this,Mo(e))},default(e){return ep(this,e)},prefault(e){return dp(this,e)},catch(e){return hp(this,e)},pipe(e){return zr(this,e)},readonly(){return vp(this)},describe(e){let t=this.clone();return Ke.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ke.get(this);let t=this.clone();return Ke.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return ki(this,"~standard",{...Ri(this),jsonSchema:{input:At(this,"input"),output:At(this,"output")}})},set "~standard"(e){be(this,"~standard",e)},parse:function e(t,n){return Xc(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Qc(this,t,n,{callee:e})},safeParse(e,t){return ed(this,e,t)},async safeParseAsync(e,t){return td(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){be(this,"spa",e)},validate(e,t){return ds(this,e,t)},validateAsync(e,t){return fs(this,e,t)},encode:function e(t,n){return nd(this,t,n,{callee:e})},decode:function e(t,n){return rd(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await id(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await od(this,t,n,{callee:e})},safeEncode(e,t){return ad(this,e,t)},safeDecode(e,t){return sd(this,e,t)},async safeEncodeAsync(e,t){return ld(this,e,t)},async safeDecodeAsync(e,t){return ud(this,e,t)},toJSONSchema(e){return Rc(this,{})(e)},get description(){return Ke.get(this)?.description},get _def(){return this._zod.def}}),zo=h("_ZodString",(e,t)=>{zn.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ao(e,n,r,i)},An({format:(e)=>K(e).format??null,minLength:(e)=>K(e).minimum??null,maxLength:(e)=>K(e).maximum??null},{regex(...e){return this.check(hc(...e))},includes(...e){return this.check(_c(...e))},startsWith(...e){return this.check(bc(...e))},endsWith(...e){return this.check(wc(...e))},min(...e){return this.check(Tt(...e))},max(...e){return this.check(Yi(...e))},length(...e){return this.check(Xi(...e))},nonempty(...e){return this.check(Tt(1,...e))},lowercase(e){return this.check(yc(e))},uppercase(e){return this.check(vc(e))},trim(){return this.check(kc())},normalize(...e){return this.check(Ec(...e))},toLowerCase(){return this.check(Tc())},toUpperCase(){return this.check(Sc())},slugify(){return this.check(Ic())}})),dd=h("ZodString",(e,t)=>{zn.init(e,t),zo.init(e,t)},{email(e){return this.check(Lu(gd,e))},url(e){return this.check(Fu(vd,e))},jwt(e){return this.check(rc(Rd,e))},emoji(e){return this.check(Zu(_d,e))},guid(e){return this.check(Mu(yd,e))},uuid(e){return this.check(Uu(dt,e))},uuidv4(e){return this.check(Du(dt,e))},uuidv6(e){return this.check(ju(dt,e))},uuidv7(e){return this.check(Bu(dt,e))},nanoid(e){return this.check(Hu(bd,e))},cuid(e){return this.check(qu(wd,e))},cuid2(e){return this.check(Vu(Ed,e))},ulid(e){return this.check(Ju(kd,e))},base64(e){return this.check(ec(Cd,e))},base64url(e){return this.check(tc(Nd,e))},xid(e){return this.check(Wu(Td,e))},ksuid(e){return this.check(Ku(Sd,e))},ipv4(e){return this.check(Gu(Id,e))},ipv6(e){return this.check(Yu(Od,e))},cidrv4(e){return this.check(Xu(Ad,e))},cidrv6(e){return this.check(Qu(xd,e))},e164(e){return this.check(nc(Pd,e))},datetime(e){return this.check(ic(pd,e))},date(e){return this.check(oc(fd,e))},time(e){return this.check(ac(md,e))},duration(e){return this.check(sc(hd,e))}});function c(e){return $u(dd,e)}var B=h("ZodStringFormat",(e,t)=>{j.init(e,t),zo.init(e,t)}),pd=h("ZodISODateTime",(e,t)=>{$l.init(e,t),B.init(e,t)}),fd=h("ZodISODate",(e,t)=>{Ll.init(e,t),B.init(e,t)}),md=h("ZodISOTime",(e,t)=>{Ml.init(e,t),B.init(e,t)}),hd=h("ZodISODuration",(e,t)=>{Ul.init(e,t),B.init(e,t)}),gd=h("ZodEmail",(e,t)=>{wl.init(e,t),B.init(e,t)}),yd=h("ZodGUID",(e,t)=>{_l.init(e,t),B.init(e,t)}),dt=h("ZodUUID",(e,t)=>{bl.init(e,t),B.init(e,t)}),vd=h("ZodURL",(e,t)=>{Ol.init(e,t),B.init(e,t)}),_d=h("ZodEmoji",(e,t)=>{Al.init(e,t),B.init(e,t)}),bd=h("ZodNanoID",(e,t)=>{xl.init(e,t),B.init(e,t)}),wd=h("ZodCUID",(e,t)=>{Cl.init(e,t),B.init(e,t)}),Ed=h("ZodCUID2",(e,t)=>{Nl.init(e,t),B.init(e,t)}),kd=h("ZodULID",(e,t)=>{Pl.init(e,t),B.init(e,t)}),Td=h("ZodXID",(e,t)=>{Rl.init(e,t),B.init(e,t)}),Sd=h("ZodKSUID",(e,t)=>{zl.init(e,t),B.init(e,t)}),Id=h("ZodIPv4",(e,t)=>{Dl.init(e,t),B.init(e,t)}),Od=h("ZodIPv6",(e,t)=>{Bl.init(e,t),B.init(e,t)}),Ad=h("ZodCIDRv4",(e,t)=>{Fl.init(e,t),B.init(e,t)}),xd=h("ZodCIDRv6",(e,t)=>{Hl.init(e,t),B.init(e,t)}),Cd=h("ZodBase64",(e,t)=>{ql.init(e,t),B.init(e,t)}),Nd=h("ZodBase64URL",(e,t)=>{Jl.init(e,t),B.init(e,t)}),Pd=h("ZodE164",(e,t)=>{Wl.init(e,t),B.init(e,t)}),Rd=h("ZodJWT",(e,t)=>{Gl.init(e,t),B.init(e,t)}),$o=h("ZodNumber",(e,t)=>{Di.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>so(e,n,r,i),e.isFinite=!0},An({minValue:(e)=>{let{minimum:t,exclusiveMinimum:n}=K(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:n}=K(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:n}=K(e);return!!t||!!n?.some(Number.isSafeInteger)},format:(e)=>K(e).format??null},{gt(e,t){return this.check(vr(e,t))},gte(e,t){return this.check(_t(e,t))},min(e,t){return this.check(_t(e,t))},lt(e,t){return this.check(yr(e,t))},lte(e,t){return this.check(vt(e,t))},max(e,t){return this.check(vt(e,t))},int(e){return this.check(xr(e))},safe(e){return this.check(xr(e))},positive(e){return this.check(vr(0,e))},nonnegative(e){return this.check(_t(0,e))},negative(e){return this.check(yr(0,e))},nonpositive(e){return this.check(vt(0,e))},multipleOf(e,t){return this.check(_r(e,t))},step(e,t){return this.check(_r(e,t))},finite(){return this}}));function _(e){return lc($o,e)}var zd=h("ZodNumberFormat",(e,t)=>{Yl.init(e,t),$o.init(e,t)});function xr(e){return uc(zd,e)}var $d=h("ZodBoolean",(e,t)=>{Xl.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>lo(e,n,r,i)});function A(e){return cc($d,e)}var Ld=h("ZodUnknown",(e,t)=>{Ql.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>po(e,n,r,i)});function V(){return dc(Ld)}var Md=h("ZodNever",(e,t)=>{eu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>co(e,n,r,i)});function Ud(e){return pc(Md,e)}var Dd=h("ZodVoid",(e,t)=>{tu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>uo(e,n,r,i)});function jd(e){return fc(Dd,e)}var Bd=h("ZodDate",(e,t)=>{nu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>fo(e,n,r,i),e.min=(n,r)=>e.check(_t(n,r)),e.max=(n,r)=>e.check(vt(n,r))},An({minDate:(e)=>{let{minimum:t}=K(e);return t?new Date(t):null},maxDate:(e)=>{let{maximum:t}=K(e);return t?new Date(t):null}},{}));function xt(e){return mc(Bd,e)}var Fd=h("ZodArray",(e,t)=>{it(),ou.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>_o(e,n,r,i),e.element=t.element},{min(e,t){return this.check(Tt(e,t))},nonempty(e){return this.check(Tt(1,e))},max(e,t){return this.check(Yi(e,t))},length(e,t){return this.check(Xi(e,t))},unwrap(){return this.element}});function I(e,t){return Oc(Fd,e,t)}var Zd=h("ZodObject",(e,t)=>{it(),lu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>bo(e,n,r,i),Ga(e,"shape",(n)=>n._zod.def.shape,!1)},{keyof(){return O(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Y(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Y(this._zod.def,{catchall:V()}))},loose(){return this.clone(Y(this._zod.def,{catchall:V()}))},strict(){return this.clone(Y(this._zod.def,{catchall:Ud()}))},strip(){return this.clone(Y(this._zod.def,{catchall:void 0}))},extend(e){return Da(this,e)},safeExtend(e){return ja(this,e)},merge(e){return Ba(this,e)},pick(e){return Ma(this,e)},omit(e){return Ua(this,e)},partial(...e){return Wn(Dn,this,e[0])},exactPartial(...e){return Wn(Uo,this,e[0],"exactPartial")},required(...e){return Fa(Do,this,e[0])}});function v(e,t){let n={type:"object",shape:e??{},...w(t)};return new Zd(n)}var Lo=h("ZodUnion",(e,t)=>{Fi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>wo(e,n,r,i),e.options=t.options});function Ne(e,t){return new Lo({type:"union",options:e,...w(t)})}var Hd=h("ZodDiscriminatedUnion",(e,t)=>{Lo.init(e,t),cu.init(e,t)});function Un(e,t,n){return new Hd({type:"union",options:t,discriminator:e,...w(n)})}var qd=h("ZodIntersection",(e,t)=>{du.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Eo(e,n,r,i)});function Vd(e,t){return new qd({type:"intersection",left:e,right:t})}var Jd=h("ZodTuple",(e,t)=>{it(),Zi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ko(e,n,r,i)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((t)=>new Dn({type:"optional",innerType:t}))})}});function Wd(e,t,n){let r=t instanceof R;return new Jd({type:"tuple",items:e,rest:r?t:null,...w(r?n:t)})}var Cr=h("ZodRecord",(e,t)=>{it(),pu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>To(e,n,r,i),e.keyType=t.keyType,e.valueType=t.valueType});function H(e,t,n){if(!t||!t._zod)return new Cr({type:"record",keyType:c(),valueType:e,...w(t)});return new Cr({type:"record",keyType:e,valueType:t,...w(n)})}var cn=h("ZodEnum",(e,t)=>{fu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,i,o)=>mo(e,r,i,o),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(r,i)=>{let o={};for(let a of r)if(n.has(a))o[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new cn({...t,checks:[],...w(i),entries:o})},e.exclude=(r,i)=>{let o={...t.entries};for(let a of r)if(n.has(a))delete o[a];else throw Error(`Key ${a} not found in enum`);return new cn({...t,checks:[],...w(i),entries:o})}});function O(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new cn({type:"enum",entries:n,...w(t)})}var Kd=h("ZodLiteral",(e,t)=>{mu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ho(e,n,r,i),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 Kd({type:"literal",values:Array.isArray(e)?e:[e],...w(t)})}var Gd=h("ZodTransform",(e,t)=>{it(),hu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>vo(e,n,r,i),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new xn(e.constructor.name);n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(nt(o,n.value,t));else{let a=o;if(a.fatal)a.continue=!1;if(a.code??(a.code="custom"),!("input"in a))a.input=n.value;a.inst??(a.inst=e),n.issues.push(nt(a))}};let i=t.transform(n.value,n);if(i instanceof Promise)return i.then((o)=>(n.value=o,n));return n.value=i,n}});function Mo(e){return new Gd({type:"transform",transform:e})}var Dn=h("ZodOptional",(e,t)=>{Hi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Mn(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Nr(e){return new Dn({type:"optional",innerType:e})}var Uo=h("ZodExactOptional",(e,t)=>{gu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Mn(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Yd(e){return new Uo({type:"optional",innerType:e})}var Xd=h("ZodNullable",(e,t)=>{yu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>So(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Rr(e){return new Xd({type:"nullable",innerType:e})}var Qd=h("ZodDefault",(e,t)=>{vu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ao(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ep(e,t){return new Qd({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():_i(t)}})}var tp=h("ZodPrefault",(e,t)=>{_u.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>xo(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function dp(e,t){return new tp({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():_i(t)}})}var Do=h("ZodNonOptional",(e,t)=>{bu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Io(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function fp(e,t){return new Do({type:"nonoptional",innerType:e,...w(t)})}var mp=h("ZodCatch",(e,t)=>{wu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Co(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function hp(e,t){return new mp({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Xa(t)})}var jo=h("ZodPipe",(e,t)=>{qi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>No(e,n,r,i),e.in=t.in,e.out=t.out});function zr(e,t){return new jo({type:"pipe",in:e,out:t})}var gp=h("ZodPreprocess",(e,t)=>{jo.init(e,t),Eu.init(e,t)}),yp=h("ZodReadonly",(e,t)=>{ku.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Po(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function vp(e){return new yp({type:"readonly",innerType:e})}var _p=h("ZodPromise",(e,t)=>{Su.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ro(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Ht(e){return new _p({type:"promise",innerType:e})}var bp=h("ZodFunction",(e,t)=>{Tu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>yo(e,n,r,i)});function pt(e){return new bp({type:"function",input:Array.isArray(e?.input)?Wd(e?.input):e?.input??I(V()),output:e?.output??V()})}var Bo=h("ZodCustom",(e,t)=>{Iu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>go(e,n,r,i)});function X(e,t){return Ac(Bo,e??(()=>!0),t)}function wp(e,t={}){return xc(Bo,e,t)}function Ep(e,t){return Cc(e,t)}function Fo(e,t){return new gp({type:"pipe",in:Mo(e),out:t})}var ip=["none","minimal","low","medium","high","xhigh","max"],II=O(ip),np=II.exclude(["none"]),kp=O([...ip,"default"]).nullable(),SI=Un("type",[v({type:Z("toggle")}).strict(),v({type:Z("effort"),values:I(kp)}).strict(),v({type:Z("budget_tokens"),min:_().min(-1).optional(),max:_().min(0).optional()}).strict().refine((e)=>e.min===void 0||e.max===void 0||e.min<=e.max,{message:"Minimum reasoning budget cannot exceed maximum",path:["min"]})]),EI=O(["default","openai-responses","r1"]),jE={DEFAULT:"default",OPENAI_RESPONSES:"openai-responses",R1:"r1"},RI=O(["images","video","tools","streaming","prompt-cache","reasoning","reasoning-effort","computer-use","global-endpoint","structured_output","temperature","files"]),AI=O(["active","preview","deprecated","legacy"]),OI=v({input:_().optional(),output:_().optional(),cacheWrite:_().optional(),cacheRead:_().optional()}),CI=v({maxBudget:_().optional(),outputPrice:_().optional(),thinkingLevel:O(["low","high"]).optional()}),PI=v({reasoningDefaultOn:A().optional(),apiProtocol:O(["openai-chat","openai-responses","anthropic","gemini"]).optional()}).catchall(V()),cw=O(["text","image","audio","video","pdf"]),DI=v({input:I(cw),output:I(cw)});function MI(e){return(e?.input===void 0||e.input.includes("text"))&&(e?.output===void 0||e.output.includes("text"))}var WI=O(["language","image-generation","speech-generation","video-generation","transcription","realtime"]);function ap(e){let t=e.modalities?.input,n=e.modalities?.output;return t?.length===1&&t[0]==="audio"&&n?.length===1&&n[0]==="text"}function zf(e){return(e.operation===void 0||e.operation==="language")&&MI(e.modalities)}var NI=O(["batch","streaming"]);function Cs(e){return e.modalities?.input.includes("text")===!0&&e.modalities.output.includes("image")}function pl(e){return e.operation==="image-generation"}function lw(e,t,n){let r=e.capabilities;if(r===void 0||r.length===0)return n?.assumeWhenUnspecified??!1;return r.includes(t)}function Gf(e){return lw(e,"tools",{assumeWhenUnspecified:!0})}function $E(e){return lw(e,"images",{assumeWhenUnspecified:!0})}var uw=v({id:c(),name:c().optional(),description:c().optional(),maxTokens:_().optional(),contextWindow:_().optional(),maxInputTokens:_().optional(),capabilities:I(RI).optional(),operation:WI.optional(),operationModes:I(NI).optional(),modalities:DI.optional(),reasoningOptions:I(SI).optional(),apiFormat:EI.optional(),systemRole:O(["system","developer"]).optional(),temperature:_().optional(),pricing:OI.optional(),thinkingConfig:CI.optional(),status:AI.optional(),deprecationNotice:c().optional(),replacedBy:c().optional(),releaseDate:c().optional(),deprecationDate:c().optional(),family:c().optional(),metadata:PI.optional()}),qE="This tool call was rejected by the user and not executed.",Vf="NOT a tool or system failure. Clarify with user before proceeding.",LI=v({id:c(),name:c(),execution:O(["client","provider"]).optional(),input:V(),output:V(),error:c().optional(),durationMs:_(),startedAt:xt(),endedAt:xt()}),UI=O(["completed","max_iterations","aborted","mistake_limit","error"]),BI=v({inputTokens:_(),outputTokens:_(),cacheReadTokens:_().optional(),cacheWriteTokens:_().optional(),totalCost:_().optional()}),zE=v({text:c(),usage:BI,messages:I(X()),toolCalls:I(LI),iterations:_(),finishReason:UI,model:v({id:c(),provider:c(),info:uw.optional()}),startedAt:xt(),endedAt:xt(),durationMs:_()}),GE=v({distinctId:c().optional(),sessionId:c().optional(),providerId:c(),modelId:c(),apiKey:c().optional(),baseUrl:c().url().optional(),headers:H(c(),c()).optional(),knownModels:H(c(),uw).optional(),providerConfig:V().optional(),initialMessages:I(X()).optional(),systemPrompt:c(),tools:I(X()),modelTools:I(X()).optional(),maxIterations:_().positive().optional(),maxParallelToolCalls:_().int().positive().default(8),maxTokensPerTurn:_().positive().optional(),temperature:_().nonnegative().optional(),apiTimeoutMs:_().positive().default(180000),userFileContentLoader:pt().input([c()]).output(Ht(c())).optional(),toolContextMetadata:H(c(),V()).optional(),execution:v({maxConsecutiveMistakes:_().int().positive().optional(),reminderAfterIterations:_().nonnegative().optional(),reminderText:c().optional(),loopDetection:Ne([Z(!1),v({softThreshold:_().int().positive().optional(),hardThreshold:_().int().positive().optional()})]).optional()}).optional(),reasoningEffort:np.optional(),thinkingBudgetTokens:_().positive().optional(),thinking:A().optional(),onEvent:pt().input([X()]).output(jd()).optional(),hooks:X().optional(),parentAgentId:c().optional(),extensions:I(X()).optional(),hookErrorMode:O(["ignore","throw"]).default("ignore"),toolPolicies:H(c(),v({enabled:A().optional(),autoApprove:A().optional()})).optional(),requestToolApproval:pt().input([v({sessionId:c(),agentId:c(),conversationId:c(),iteration:_(),toolCallId:c(),toolName:c(),input:V(),policy:v({enabled:A().optional(),autoApprove:A().optional()}).default({})})]).output(Ne([v({approved:A(),reason:c().optional()}),Ht(v({approved:A(),reason:c().optional()}))])).optional(),onConsecutiveMistakeLimitReached:pt().input([v({iteration:_().int().positive(),consecutiveMistakes:_().int().positive(),maxConsecutiveMistakes:_().int().positive(),reason:O(["api_error","invalid_tool_call","tool_execution_failed"]),details:c().optional()})]).output(Ne([v({action:Z("continue"),guidance:c().optional()}),v({action:Z("stop"),reason:c().optional()}),Ht(Ne([v({action:Z("continue"),guidance:c().optional()}),v({action:Z("stop"),reason:c().optional()})]))])).optional(),logger:X().optional(),extensionContext:X().optional(),abortSignal:X().optional()}),FI=O(["connector.started","connector.stopping","session.authorize","message.received","message.denied","message.completed","message.failed","session.started","session.reused","session.reset","schedule.delivery.started","schedule.delivery.sent","schedule.delivery.failed"]),jI=v({id:c().optional(),label:c().optional(),role:c().optional(),participantKey:c().optional(),participantLabel:c().optional(),platformUserId:c().optional(),metadata:H(c(),V()).optional()}),$I=v({source:c(),sourceEvent:c(),threadId:c(),channelId:c(),isDM:A(),sessionId:c().optional(),workspaceRoot:c().optional(),metadata:H(c(),V()).optional()}),VE=v({actor:jI,context:$I,payload:H(c(),V()).optional()}),KE=v({action:O(["allow","deny"]).default("allow"),message:c().optional(),reason:c().optional(),metadata:H(c(),V()).optional()}),HE=v({adapter:c(),botUserName:c().optional(),event:FI,payload:H(c(),V()),ts:c()}),qI=[{name:"discord",description:"Discord interactions and gateway bridge backed by RPC runtime sessions"},{name:"gchat",description:"Google Chat webhook bridge backed by RPC runtime sessions"},{name:"linear",description:"Linear webhook bridge backed by RPC runtime sessions"},{name:"slack",description:"Slack webhook/socket bridge backed by RPC runtime sessions"},{name:"telegram",description:"Bridge Telegram bot messages into RPC chat sessions"},{name:"whatsapp",description:"Bridge WhatsApp webhook messages into RPC chat sessions"}];function zI(){return qI.map((e)=>({...e}))}function GI(e,t){let n=e.includeWhen;if(!n)return!0;let r=t[n.flag]??"";if(n.equals!==void 0&&r!==n.equals)return!1;if(n.notEquals!==void 0&&r===n.notEquals)return!1;return!0}function QE(e,t,n){let r={};for(let o of e.fields){let a=t[o.flag];r[o.flag]=typeof a==="string"?a.trim():o.initialValue??""}let i=[];for(let o of e.fields){if(!GI(o,r))continue;let a=r[o.flag]??"";if(!a){if(o.required)throw Error(`${o.label} is required`);continue}i.push(o.flag,a)}if(n?.enabled===!0&&e.security){let o={};for(let a of e.security.fields){let s=n.values[a.key]?.trim();if(!s)throw Error(a.requiredMessage);let l=a.validate?.(s);if(l)throw Error(l);o[a.key]=s}i.push(...e.security.buildArgs(o))}return i}function Tp(e,t){if(t.has(e))return{managed:!0,consumesNext:!0};for(let n of t)if(e.startsWith(`${n}=`))return{managed:!0,consumesNext:!1};return{managed:!1,consumesNext:!1}}function YE(e,t,n,r){let i=new Set([...e.fields.flatMap((a)=>[a.flag,...a.aliases??[]]),...e.derivedReconnectFlags??[]]);if(r.replaceSecurityArgs)for(let a of e.security?.argumentFlags??[])i.add(a);let o=[];for(let a=0;a<t.length;a+=1){let s=t[a]??"",l=Tp(s,i);if(!l.managed){o.push(s);continue}if(l.consumesNext)a+=1}return[...o,...n]}function JE(e=VI){let t=new Set(zI().map((n)=>n.name));return e.filter((n)=>t.has(n.id)).map((n)=>({id:n.id,name:n.name,type:n.type,hint:n.hint,fields:n.fields.map((r)=>({flag:r.flag,label:r.label,placeholder:r.placeholder,required:r.required,help:r.help,initialValue:r.initialValue,options:r.options,includeWhen:r.includeWhen})),security:n.security?{prompt:n.security.prompt,fields:n.security.fields.map((r)=>({key:r.key,label:r.label,placeholder:r.placeholder,help:r.help,requiredMessage:r.requiredMessage}))}:void 0}))}function Sp(e){return/^\d+$/.test(e)?void 0:"Telegram user ID must contain digits only"}function Ip(e){return/^T[A-Z0-9]+$/.test(e)?void 0:"Slack workspace ID must start with T and contain uppercase letters or digits only"}function Op(e){return/^[UW][A-Z0-9]+$/.test(e)?void 0:"Slack member ID must start with U or W and contain uppercase letters or digits only"}var VI=[{id:"telegram",name:"Telegram",type:"polling",hint:"Easiest to set up. No public URL needed.",derivedReconnectFlags:["-m","--bot-username"],fields:[{flag:"-k",aliases:["--bot-token"],label:"Bot token",placeholder:"7123456789:AAH...",required:!0,help:["Open Telegram and start a chat with @BotFather","Send /newbot and follow the prompts","BotFather gives you this after creating the bot","It looks like 7123456789:AAHxxx..."]}],security:{prompt:"By default, anyone who finds your bot can message it and run tasks on your machine. Restrict access to your Telegram user ID?",fields:[{key:"userId",label:"Your Telegram user ID",placeholder:"123456789",help:["Message @userinfobot on Telegram","It will reply with your numeric user ID"],requiredMessage:"User ID is required to restrict access",validate:Sp}],argumentFlags:["--allowed-user-id","--hook-command"],buildArgs:({userId:e})=>["--allowed-user-id",e??""]}},{id:"slack",name:"Slack",type:"hybrid",hint:"Public URL for webhook mode; leave blank for socket mode.",fields:[{flag:"--bot-token",label:"Bot token",placeholder:"xoxb-...",required:!0,help:["Go to api.slack.com/apps and create a new app","Add Bot Token Scopes: chat:write, app_mentions:read, channels:history, channels:read, im:history, im:read, im:write, users:read","Install to workspace and copy the Bot Token"]},{flag:"--base-url",label:"Public base URL",placeholder:"leave blank for socket mode",help:["Enter a publicly accessible URL for webhook mode","Leave blank to use Slack socket mode instead"]},{flag:"--signing-secret",label:"Signing secret",required:!0,help:["Found in your app's Basic Information page"],includeWhen:{flag:"--base-url",notEquals:""}},{flag:"--app-token",label:"App-level token",placeholder:"xapp-...",required:!0,help:["Enable Socket Mode in the Slack app","Generate an app-level token with the connections:write scope"],includeWhen:{flag:"--base-url",equals:""}}],security:{prompt:"Restrict which Slack users can interact with the bot?",fields:[{key:"teamId",label:"Allowed Slack workspace ID",placeholder:"T01ABC123",help:["Open your Slack workspace URL in a browser","The workspace ID is the segment after /client/, for example T01ABC123"],requiredMessage:"Workspace ID is required to restrict access",validate:Ip},{key:"userId",label:"Allowed Slack member ID",placeholder:"U01ABC123",help:["Click a user's name in Slack, then View full profile","Click ... and Copy member ID"],requiredMessage:"Member ID is required to restrict access",validate:Op}],argumentFlags:["--hook-command"],buildArgs:({teamId:e,userId:t})=>["--hook-command",`jq -r ".payload.actor.participantKey" | grep -qx "slack:team:${e}:user:${t}" && echo '{"action":"allow"}' || echo '{"action":"deny"}'`]}},{id:"discord",name:"Discord",type:"webhook",hint:"Requires a Discord app and public URL.",fields:[{flag:"--application-id",aliases:["--app-id"],label:"Application ID",required:!0,help:["Go to discord.com/developers/applications","Create a new app, copy the Application ID"]},{flag:"--bot-token",aliases:["--token"],label:"Bot token",required:!0,help:["Go to Bot section, create a bot, copy the token"]},{flag:"--public-key",label:"Public key",required:!0,help:["Found in General Information of your app"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0,help:["Base URL for the connector","For Discord, set the Interactions Endpoint URL to <base-url>/api/webhooks/discord"]}]},{id:"whatsapp",name:"WhatsApp",type:"webhook",hint:"Requires Meta developer account and public URL.",fields:[{flag:"--phone-number-id",label:"Phone number ID",required:!0,help:["From your WhatsApp Business account in Meta Developer portal"]},{flag:"--access-token",label:"Access token",required:!0,help:["Generate a permanent token in Meta Developer portal"]},{flag:"--app-secret",label:"App secret",required:!0,help:["Found in App Settings > Basic"]},{flag:"--verify-token",label:"Webhook verify token",placeholder:"my-verify-token",required:!0,help:["Any string you choose, used to verify webhook setup"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"gchat",name:"Google Chat",type:"webhook",hint:"Requires Google Cloud project and public URL.",fields:[{flag:"--credentials-json",label:"Service account credentials JSON",required:!0,help:["Create a service account in Google Cloud Console","Download the credentials JSON file","Paste the JSON content here"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"linear",name:"Linear",type:"webhook",hint:"React to Linear issues and comments.",fields:[{flag:"--api-key",label:"API key",required:!0,help:["Go to Linear Settings > API > Personal API keys"]},{flag:"--webhook-secret",label:"Webhook signing secret",required:!0,help:["Go to Settings > API > Webhooks, create one","Copy the signing secret"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]}],Zo=[];function KI(e){Zo.push(e)}async function XE(){let e=Zo.splice(0);await Promise.all(e.map((t)=>{try{return(typeof t==="function"?t():t.dispose())??Promise.resolve()}catch{return Promise.resolve()}}))}var Ap=["hooks","tools","commands","rules","skills","messageBuilders","providers","automationEvents","mcp"],xp=new Set(Ap);function Ho(e,t){return e.name||`extension_${String(t).padStart(4,"0")}`}function $r(e){return Array.isArray(e)&&e.every((t)=>typeof t==="string")}function Lr(e){if(!Array.isArray(e))return;let t=e.filter((n)=>typeof n==="string").map((n)=>n.trim()).filter((n)=>n.length>0);return t.length>0?t:void 0}function HI(e){let t=Lr(e.providerIds),n=Lr(e.modelIds);return{...e,...t?{providerIds:t}:{},...n?{modelIds:n}:{}}}function Cp(e,t){let n=Ho(e,t),r=e.manifest;if(!r||typeof r!=="object")throw Error(`Invalid manifest for extension "${n}": manifest is required`);if(!Array.isArray(r.capabilities)||r.capabilities.length===0)throw Error(`Invalid manifest for extension "${n}": capabilities must be a non-empty array`);let i=new Set;for(let a of r.capabilities){if(!xp.has(a))throw Error(`Invalid manifest for extension "${n}": unsupported capability "${String(a)}"`);i.add(a)}if(Object.hasOwn(r,"providerIds")&&!$r(r.providerIds))throw Error(`Invalid manifest for extension "${n}": providerIds must be a string array when provided`);if(Object.hasOwn(r,"modelIds")&&!$r(r.modelIds))throw Error(`Invalid manifest for extension "${n}": modelIds must be a string array when provided`);let o=i.has("hooks");if(e.hooks!==void 0&&!o)throw Error(`Invalid manifest for extension "${n}": runtime hooks require the "hooks" capability`);return{capabilities:i,raw:HI(r)}}function Np(e,t){if(!e||typeof e!=="object")throw Error(`Invalid automation event contribution for extension "${t}": expected object`);let n=typeof e.eventType==="string"?e.eventType.trim():"",r=typeof e.source==="string"?e.source.trim():"";if(!n)throw Error(`Invalid automation event contribution for extension "${t}": eventType is required`);if(!r)throw Error(`Invalid automation event contribution for extension "${t}": source is required`);return{...e,eventType:n,source:r,examples:e.examples?[...e.examples]:void 0,metadata:e.metadata?{...e.metadata}:void 0}}class pw{extensions;registry={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]};normalized=[];phase="resolve";setupContext;constructor(e={}){this.extensions=e.extensions??[],this.setupContext=e.setupContext??{}}resolve(){if(this.phase!=="resolve")return;this.normalized=this.extensions.map((e,t)=>({extension:e,order:t,manifest:{capabilities:new Set,raw:e.manifest}})),this.phase="validate"}validate(){if(this.phase==="resolve")this.resolve();if(this.phase!=="validate")return;this.normalized=this.normalized.map((e)=>({...e,manifest:Cp(e.extension,e.order)})),this.phase="setup"}async setup(e={}){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase!=="setup")return;let t,n=[];for(let r of this.normalized){let{extension:i}=r;if(i.disabled)continue;let o=Ho(i,r.order),a={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]},s={registerTool:(u)=>a.tools.push(u),registerCommand:(u)=>a.commands.push(u),registerRule:(u)=>{if(!r.manifest.capabilities.has("rules"))throw Error(`Invalid setup for extension "${o}": registerRule requires the "rules" capability`);a.rules.push(u)},registerMessageBuilder:(u)=>a.messageBuilder.push(u),registerProvider:(u)=>a.providers.push(u),registerAutomationEventType:(u)=>{if(!r.manifest.capabilities.has("automationEvents"))throw Error(`Invalid setup for extension "${o}": registerAutomationEventType requires the "automationEvents" capability`);a.automationEventTypes.push(Np(u,o))},registerMcpServer:(u)=>{if(!r.manifest.capabilities.has("mcp"))throw Error(`Invalid setup for extension "${o}": registerMcpServer requires the "mcp" capability`);a.mcpServers.push({...u,metadata:{...u.metadata??{},source:"plugin",plugin:o}})}},l=r.manifest.capabilities.has("automationEvents")?this.setupContext:{...this.setupContext,automation:void 0};try{await i.setup?.(s,l),n.push(a)}catch(u){if(e.tolerateSetupErrors!==!0)throw u;t??=u}}if(t&&e.tolerateSetupErrors!==!0)throw t;for(let r of n)this.registry.tools.push(...r.tools),this.registry.commands.push(...r.commands),this.registry.rules.push(...r.rules),this.registry.messageBuilder.push(...r.messageBuilder),this.registry.providers.push(...r.providers),this.registry.automationEventTypes.push(...r.automationEventTypes),this.registry.mcpServers.push(...r.mcpServers);if(this.phase="activate",t)throw t}activate(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase==="setup")throw Error("Contribution registry setup must complete before activation");if(this.phase!=="activate")return;this.phase="run"}async initialize(e={}){this.resolve(),this.validate();try{await this.setup(e)}finally{if(this.phase==="activate")this.activate()}}isActivated(){return this.phase==="run"}getRegistrySnapshot(){return{tools:[...this.registry.tools],commands:[...this.registry.commands],rules:[...this.registry.rules],messageBuilder:[...this.registry.messageBuilder],providers:[...this.registry.providers],automationEventTypes:[...this.registry.automationEventTypes],mcpServers:[...this.registry.mcpServers]}}getRegisteredTools(){return[...this.registry.tools]}getRegisteredRules(){return[...this.registry.rules]}getRegisteredAutomationEventTypes(){return[...this.registry.automationEventTypes]}getRegisteredMcpServers(){return[...this.registry.mcpServers]}getValidatedExtensions(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();return this.normalized.slice().sort((e,t)=>e.order-t.order).map(({extension:e})=>e)}}function ZE(e={}){return new pw(e)}var e5=[".js",".ts"],dl={CLINE_PASS:"ext-cline-pass",CODE_CLOUD_AGENTS:"code-cloud-agents",CODE_ONBOARDING_GITHUB:"code-onboarding-github",CLINE_COMPOSIO_BETA:"CLINE_COMPOSIO_BETA",CLOUD_COMPUTER_USE:"cloud-computer-use"},t5={[dl.CLINE_PASS]:!1,[dl.CODE_CLOUD_AGENTS]:!1,[dl.CODE_ONBOARDING_GITHUB]:!1,[dl.CLINE_COMPOSIO_BETA]:!1,[dl.CLOUD_COMPUTER_USE]:!1},i5=Object.values(dl),QI=O(["agent_start","agent_resume","agent_abort","agent_end","agent_error","tool_call","tool_result","prompt_submit","pre_compact","session_shutdown"]),Oe=H(c(),c()),Pp=v({toolName:c(),parameters:Oe}),Rp=v({toolName:c(),parameters:Oe,result:c(),success:A(),executionTimeMs:_()}),zp=v({prompt:c(),attachments:I(c())}),$p=v({taskMetadata:Oe}),Lp=v({taskMetadata:Oe,previousState:Oe}),Mp=v({taskMetadata:Oe}),Up=v({taskMetadata:Oe}),Dp=v({taskId:c(),ulid:c(),contextSize:_(),compactionStrategy:c(),previousApiReqIndex:_(),tokensIn:_(),tokensOut:_(),tokensInCache:_(),tokensOutCache:_(),deletedRangeStart:_(),deletedRangeEnd:_(),contextJsonPath:c(),contextRawPath:c()}),YI=v({clineVersion:c(),hookName:QI,timestamp:c(),taskId:c(),sessionContext:v({rootSessionId:c().optional(),hookLogPath:c().optional()}).optional(),workspaceRoots:I(c()),workspaceInfo:X().optional(),userId:c(),agent_id:c(),parent_agent_id:c().nullable(),iteration:_().optional(),reason:c().optional(),tool_call:v({id:c(),name:c(),input:V()}).optional(),tool_result:X().optional(),turn:V().optional(),error:v({name:c(),message:c(),stack:c().optional()}).optional(),preToolUse:Pp.optional(),postToolUse:Rp.optional(),userPromptSubmit:zp.optional(),taskStart:$p.optional(),taskResume:Lp.optional(),taskCancel:Mp.optional(),taskComplete:Up.optional(),preCompact:Dp.optional()}).passthrough();function n5(e){let t=YI.safeParse(e);if(!t.success)return;return t.data}var a5="v1",o5="v1",r5="v1",s5=["client.register","client.list","session.create","session.list","session.get","session.run","session.abort","schedule.create","schedule.list","task.create","task.list","task.get","task.update","task.approve","task.cancel","task.run","task.automation.get","task.automation.set","settings.get","settings.set","connector.start","connector.stop","connector.supervised","run.enqueue","run.list","hub.drain","hub.status","plugins.list","plugins.status","plugins.reload","stream.replay"];function ft(e){let t=/^v(\d+)$/.exec(e?.trim()??"");if(!t)return;return Number.parseInt(t[1]??"",10)}function c5(e,t="v1"){let n=ft(e.protocolVersion),r=ft(t);if(n===void 0||r===void 0)return{compatible:!1,reason:"missing_protocol"};let i=ft(e.minClientProtocolVersion)??n,o=ft(e.maxClientProtocolVersion)??n;return r>=i&&r<=o?{compatible:!0}:{compatible:!1,reason:"unsupported_protocol"}}var l5="approval.respond",u5="0",p5="__hubScheduleRunAt",dw=["act","plan","yolo"];function JI(e){return dw.some((t)=>t===e)}function d5(e,t){if(!e||!Object.hasOwn(e,"mode"))return t;let n=e.mode;if(JI(n))return n;throw Error(`mode must be one of: ${dw.join(", ")}`)}var XI=30000,m5=5000;function ZI(e){switch(e){case"run.start":case"session.send_input":case"plugins.commands.run":return null;default:return XI}}function h5(e,t){return t===void 0?ZI(e):t}var eS=["readFile","search","bash","webFetch","editor","applyPatch","skills","askQuestion","submit"],jp=new Set(eS);function g5(e){return typeof e==="string"&&jp.has(e)}var f5="tool_executor.",y5="custom_tool.",x5="hook.",b5="compaction.compact",v5="checkpoint.create",w5="mistake_limit.decide",T5="user_instructions.snapshot";function _5(e){let t=e.activeSessionCount;if(typeof t!=="number"||t<=0)return"active sessions from other Cline clients";let n=`${t} active session${t===1?"":"s"}`,r=e.participantClientCount;if(typeof r!=="number"||r<=0)return n;return`${n} from ${r} connected Cline client${r===1?"":"s"}`}function tS(e,t){return`<file_content path="${e}">
59
+ ${t}
60
+ </file_content>`}function k5(e,t="act"){return`<user_input mode="${t}">${e}</user_input>`}function I5(e,t){return`<user_command slash="${t}">${e}</user_command>`}var Bp=/<user_input\b[^>]*\bmode="(act|plan|yolo)"/;function S5(e){let t=Bp.exec(e??"");return t?t[1]:void 0}function E5(e,t){return`<mode_notice>The user switched from ${e} mode to ${t} mode before sending this message.</mode_notice>`}function R5(){let e=null;return{record(t,n){if(t===n)return;if(e){e=e.from===n?null:{from:e.from,to:n};return}e={from:t,to:n}},consume(){let t=e;return e=null,t}}}function Fp(e,t){let n=e.trim(),r=new RegExp(`^<${t}\\b([^>]*)>([\\s\\S]*?)<\\/${t}>$`,"i").exec(n);if(!r)return;return{attrs:r[1]??"",content:r[2]??""}}function Zp(e,t){return new RegExp(`${t}="([^"]+)"`,"i").exec(e)?.[1]?.trim()||void 0}function iS(e){if(!e?.trim())return;let t=Fp(e,"user_command");if(!t)return;let n=Zp(t.attrs,"slash");if(!n)return;return{slash:n,content:t.content.trim()}}function nS(e){if(!e?.trim())return"";let t=e.trim();for(let n of["user_input","user_command"]){let r=sS(t,n);t=(r!==t?r:t.replace(new RegExp(`<${n}[^>]*>`,"g"),"")).trim()}return t}function aS(e){if(!e?.trim())return"";return Hp(e,"mode_notice").trim()}function Hp(e,t){let n=`<${t}>`,r=`</${t}>`,i=e,o=i.indexOf(n);while(o!==-1){let a=i.indexOf(r,o+n.length);if(a===-1)break;i=i.slice(0,o)+i.slice(a+r.length),o=i.indexOf(n,o)}return i}function mw(e){let t=aS(nS(e)),n=iS(e);if(!n)return t;if(n.slash.toLowerCase()==="team"){let r=t.toLowerCase().startsWith("spawn a team of agents for the following task:")?t.slice(46).trim():t;return r?`/team ${r}`:"/team"}return t?`/${n.slash} ${t}`:`/${n.slash}`}var oS=240,rS=480;function qo(e,t){let n=e.replace(/\s+/gu," ").trim();if(n.length<=t)return n;return`${n.slice(0,t-1).trimEnd()}…`}function A5(e){return qo(mw(e),oS)}function O5(e,t){let n=t?.trim()??"",r=e.toLowerCase(),i=r==="user"||r==="session"?mw(n):n;return qo(i,rS)}function sS(e,t){if(!e?.trim())return"";if(!t)return e;let n=new RegExp(`<${t}\\b[^>]*>([\\s\\S]*?)</${t}>`,"g");return e.replace(n,"$1")}var Ps="[media omitted: invalid or exceeds size limit]",Fm="[Image attached — this model cannot view images]",cS=O(["image","audio","video","file"]),lS=Un("type",[v({type:Z("base64"),data:c().min(1)}),v({type:Z("url"),url:c().url().refine((e)=>{let t=new URL(e).protocol;return t==="http:"||t==="https:"},"Generated media URLs must use HTTP or HTTPS")}),v({type:Z("artifact"),artifactId:c().min(1)})]);function Vo(e){if(e.startsWith("image/"))return"image";if(e.startsWith("audio/"))return"audio";if(e.startsWith("video/"))return"video";return"file"}var jm=v({id:c().min(1),modality:cS,mediaType:c().min(1),source:lS,name:c().min(1).optional(),sizeBytes:_().int().nonnegative().optional()}).refine((e)=>Vo(e.mediaType)===e.modality,{message:"Generated media modality must match its media type",path:["modality"]});function C5(e){return jm.safeParse(e).success}function Kf(e){return Vo(e)}var hw=["image/png","image/jpeg","image/gif","image/webp"],gw=5242880,gi=gw,en=6291456,uS=8388608;function P5(e){return e.length}function fw(e){let t=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.floor(e.length*3/4)-t}function D5(e=gw){return Math.floor(e*3/4)}function pS(e){return Math.ceil(e/3)*4}function yw(e={}){return{maxImageEncodedBytes:e.maxImageEncodedBytes??gi,maxImageDecodedBytes:e.maxImageDecodedBytes??en,maxTotalMediaBytes:e.maxTotalMediaBytes??uS}}function Ds(){return{totalEncodedBytes:0,keptImages:0,omittedImages:0,omittedReasons:{}}}function bt(e,t){e.omittedImages+=1,e.omittedReasons[t]=(e.omittedReasons[t]??0)+1}function Ms(e,t,n,r){let i=yw(n);if(e>i.maxImageEncodedBytes){let o={ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${i.maxImageEncodedBytes} byte encoded limit`};return bt(r,o.reason),o}if(t>i.maxImageDecodedBytes){let o={ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${i.maxImageDecodedBytes} byte decoded limit`};return bt(r,o.reason),o}if(r.totalEncodedBytes+e>i.maxTotalMediaBytes){let o={ok:!1,reason:"total_limit",message:`Image media exceeds the ${i.maxTotalMediaBytes} byte total media limit`};return bt(r,o.reason),o}return r.totalEncodedBytes+=e,r.keptImages+=1,null}function dS(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===47}function Hf(e){return e.length>0&&jn(e,0,e.length)}function $m(e,t,n){let r=Jo(e),i=r.end-r.start;if(i===0)return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let o=yw(t);if(n.totalEncodedBytes+i>o.maxTotalMediaBytes)return{ok:!1,reason:"total_limit",message:`Generated media exceeds the ${o.maxTotalMediaBytes} byte total media limit`};if(!jn(e,r.start,r.end))return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let a=e.slice(r.start,r.end);return n.totalEncodedBytes+=i,{ok:!0,base64:a,encodedBytes:i,decodedBytes:fw(a)}}function jn(e,t,n){let r=n-t;if(r%4!==0)return!1;let i=n;if(r>=2&&e.charCodeAt(n-2)===61&&e.charCodeAt(n-1)===61)i-=2;else if(r>=1&&e.charCodeAt(n-1)===61)i-=1;for(let o=t;o<i;o++)if(!dS(e.charCodeAt(o)))return!1;for(let o=i;o<n;o++)if(e.charCodeAt(o)!==61)return!1;return!0}function qp(e,t,n){return n-t>=5&&(e.charCodeAt(t)|32)===100&&(e.charCodeAt(t+1)|32)===97&&(e.charCodeAt(t+2)|32)===116&&(e.charCodeAt(t+3)|32)===97&&e.charCodeAt(t+4)===58}function Jo(e){let t=0,n=e.length;while(t<n&&/\s/.test(e[t]??""))t+=1;while(n>t&&/\s/.test(e[n-1]??""))n-=1;return{start:t,end:n}}function Vp(e,t,n){if(!qp(e,t,n))return;let r=t+5,i=e.indexOf(",",r);if(i===-1||i>=n)return;if(i-r>128)return;let o=e.slice(r,i).toLowerCase(),a=";base64";if(!o.endsWith(a))return;let s=o.slice(0,-a.length);if(!s||s.includes(";"))return;return{mediaType:s,base64Start:i+1,base64End:n}}function op(e,t,n={}){let r=n.maxEncodedBytes??gi,i=n.maxDecodedBytes??en,o=new Set(n.supportedMediaTypes??hw),a=e?.toLowerCase(),s=Jo(t),{start:l,end:u}=s,d=Vp(t,s.start,s.end);if(d){if(a&&a!==d.mediaType)return{ok:!1,reason:"media_type_mismatch",message:`Image media type ${e} does not match data URL type ${d.mediaType}`};a=d.mediaType,l=d.base64Start,u=d.base64End}if(!a||!o.has(a))return{ok:!1,reason:"unsupported_media_type",message:`Unsupported image media type: ${e??"unknown"}`};let p=u-l;if(p===0)return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};if(p>r)return{ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${r} byte encoded limit`};if(!jn(t,l,u))return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};let f=t.slice(l,u),m=fw(f);if(m>i)return{ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${i} byte decoded limit`};return{ok:!0,mediaType:a,base64:f,encodedBytes:p,decodedBytes:m}}function Pr(e,t,n,r){let i=op(e,t,{maxEncodedBytes:n.maxImageEncodedBytes,maxDecodedBytes:n.maxImageDecodedBytes});if(!i.ok)return bt(r,i.reason),i;let o=Ms(i.encodedBytes,i.decodedBytes,n,r);if(o)return o;return i}function Ai(e){return e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"�")}var qm="ERROR: EMPTY CONTENT",Jp="[image attached]",Wp="[generated image]";function Kp(e){return`[generated ${e}]`}function mt(e){return{type:"text",text:`[generated ${e.modality} unavailable to this model]`}}function qt(e,t){let n=e[e.length-1];if(t.role==="tool"&&n?.role==="tool"&&Array.isArray(n.content)&&Array.isArray(t.content)){n.content.push(...t.content);return}e.push(t)}function Gp(e){if(!Array.isArray(e)||e.length===0)return!1;return e.every((t)=>{if(!t||typeof t!=="object")return!1;let n=t;if(n.type==="text")return typeof n.text==="string";if(n.type==="image")return typeof n.data==="string"&&typeof n.mediaType==="string";return!1})}function ke(){return{type:"text",text:Ps}}function Mr(e){return Ms(gi,0,{maxImageEncodedBytes:gi,maxImageDecodedBytes:en},e)===null}function Wo(e){try{return new URL(e).protocol}catch{return}}function dn(e,t){let n=Pr(e.mediaType,e.data,{maxImageEncodedBytes:gi,maxImageDecodedBytes:en},t);if(!n.ok)return ke();return Ko(n.base64,n.mediaType)}function Ko(e,t){return{type:"file",data:{type:"data",data:e},mediaType:t}}function Ce(e,t){return{type:"file",data:e,mediaType:t??"image"}}function pn(e,t){if(e.image instanceof URL){if(e.image.protocol==="data:"){let o=Pr(e.mediaType,e.image.href,{maxImageEncodedBytes:gi,maxImageDecodedBytes:en},t);if(!o.ok)return ke();return Ce(`data:${o.mediaType};base64,${o.base64}`,o.mediaType)}if(e.image.protocol!=="http:"&&e.image.protocol!=="https:")return ke();if(!Mr(t))return ke();return Ce(e.image,e.mediaType)}if(typeof e.image==="string"){let o=Wo(e.image);if(o==="http:"||o==="https:"){if(!Mr(t))return ke();return Ce(e.image,e.mediaType)}let a=o==="data:",s=Pr(e.mediaType??(a?void 0:"image/png"),e.image,{maxImageEncodedBytes:gi,maxImageDecodedBytes:en},t);if(!s.ok)return ke();return Ce(a?`data:${s.mediaType};base64,${s.base64}`:s.base64,s.mediaType)}let n=e.image.byteLength,r=pS(n),i=e.mediaType?.toLowerCase()??"image/png";if(!hw.includes(i)||Ms(r,n,{maxImageEncodedBytes:gi,maxImageDecodedBytes:en},t))return ke();return Ce(e.image,i)}function Yp(e,t){if(!t)return!0;if(e.modality==="file")return e.mediaType==="application/pdf"&&t.includes("pdf");return t.includes(e.modality)}function Ur(e,t,n){if(!Yp(e,n))return mt(e);if(e.modality==="image"){if(e.source.type==="artifact")return mt(e);return pn({type:"image",image:e.source.type==="url"?e.source.url:e.source.data,mediaType:e.mediaType},t)}if(e.source.type==="artifact")return mt(e);if(e.source.type==="url"){let r=Wo(e.source.url);if(r!=="http:"&&r!=="https:"&&r!=="data:")return mt(e)}return Ce(e.source.type==="url"?e.source.url:e.source.data,e.mediaType)}function fn(e,t,n,r){let{hoistImages:i,inlineImagePlaceholder:o}=r;if(e==null||typeof e!=="object")return{value:e,changed:!1,mediaChanged:!1};if(Array.isArray(e)){let d=[],p=!1,f=!1;for(let m of e){if(m&&typeof m==="object"){let y=m;if(y.type==="image"&&typeof y.data==="string"&&typeof y.mediaType==="string"){if(!i){d.push(o),p=!0,f=!0;continue}let T={type:"image",data:y.data,mediaType:y.mediaType},b=dn(T,n);if(b.type==="file")t.push({type:"image",data:b.data.data,mediaType:b.mediaType});else d.push(b.text);p=!0,f=!0;continue}if(y.type==="image"){d.push(Ps),p=!0,f=!0;continue}if(y.type==="text"&&typeof y.text==="string"){d.push(y.text),p=!0;continue}}let g=fn(m,t,n,r);d.push(g.value),p||=g.changed,f||=g.mediaChanged}return{value:p?d:e,changed:p,mediaChanged:f}}let a=e;if(a.type==="image"){if(typeof a.data==="string"&&typeof a.mediaType==="string"){if(!i)return{value:o,changed:!0,mediaChanged:!0};let d={type:"image",data:a.data,mediaType:a.mediaType},p=dn(d,n);if(p.type==="file")return t.push({type:"image",data:p.data.data,mediaType:p.mediaType}),{value:Jp,changed:!0,mediaChanged:!0};return{value:p.text,changed:!0,mediaChanged:!0}}return{value:Ps,changed:!0,mediaChanged:!0}}let s={},l=!1,u=!1;for(let[d,p]of Object.entries(a)){let f=fn(p,t,n,r);s[d]=f.value,l||=f.changed,u||=f.mediaChanged}return{value:l?s:e,changed:l,mediaChanged:u}}function et(e){if(typeof e==="string")return Ai(e);if(Array.isArray(e))return e.map((t)=>et(t));if(e!==null&&typeof e==="object"){let t=e,n={};for(let[r,i]of Object.entries(t))n[r]=et(i);return n}return e}function mS(e,t=!1,n=Ds(),r){let i=r?.supportsImages??!0;if(typeof e==="string")return{type:t?"error-text":"text",value:Ai(e)};if(!t&&Gp(e))return{type:"content",value:e.map((o)=>o.type==="image"?i?dn(o,n):{type:"text",text:Fm}:{type:"text",text:Ai(o.text)})};if(e!==null&&typeof e==="object"){let o=[],a=fn(e,o,n,{hoistImages:!t&&i,inlineImagePlaceholder:i?Ps:Fm});if(!t&&o.length>0)return{type:"content",value:[{type:"text",text:typeof a.value==="string"?Ai(a.value):JSON.stringify(et(a.value))},...o.map((s)=>Ko(s.data,s.mediaType))]};if(a.mediaChanged)return{type:t?"error-json":"json",value:et(a.value)}}if(e===null||typeof e==="boolean"||typeof e==="number"||typeof e==="object")return{type:t?"error-json":"json",value:et(e)};return{type:t?"error-text":"text",value:Ai(String(e))}}function Qf(e,t,n){let r=n?.assistantToolCallArgKey??"input",i=n?.supportedInputModalities,o=!i||i.includes("image"),a=[],s=Ds(),l=[],u=()=>l.splice(0).map((d)=>d.type==="image"?o?pn(d,s):{type:"text",text:Fm}:Ur(d.media,s,i));if(typeof e==="string"&&e.trim().length>0||Array.isArray(e)&&e.length>0)a.push({role:"system",content:typeof e==="string"?Ai(e):e});for(let d of t){let p=d.content;if(typeof p==="string"){let y=d.role==="user"&&l.length>0?u():[];if(y.length>0){a.push({role:d.role,content:[{type:"text",text:p.trim().length>0?Ai(p):qm},...y]});continue}if(p.trim().length===0){a.push({role:d.role,content:[{type:"text",text:qm}]});continue}a.push({role:d.role,content:Ai(p)});continue}let f=[],m=[];if(p.length===0){a.push({role:d.role,content:[{type:"text",text:qm}]});continue}for(let y of p)switch(y.type){case"text":f.push({type:"text",text:Ai(y.text),...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"reasoning":f.push({type:"reasoning",text:Ai(y.text),...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"image":if(d.role==="assistant")l.push(y),f.push({type:"text",text:Wp});else f.push(o?pn(y,s):{type:"text",text:Fm});break;case"media":if(d.role==="assistant")l.push(y),f.push({type:"text",text:Kp(y.media.modality)});else f.push(Ur(y.media,s,i));break;case"file":f.push({type:"text",text:tS(y.path,Ai(y.content))});break;case"tool-call":if(d.role==="assistant")f.push({type:"tool-call",toolCallId:y.toolCallId,toolName:y.toolName,[r]:y.input,...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"tool-result":{m.push({type:"tool-result",toolCallId:y.toolCallId,toolName:y.toolName,output:mS(y.output,y.isError??!1,s,{supportsImages:o})});break}}let g=m.length>0;if(d.role==="user"&&!g&&l.length>0)f.push(...u());if(f.length>0&&f.every((y)=>y.type==="text"&&typeof y.text==="string"&&y.text.trim().length===0))f.splice(0,f.length,{type:"text",text:qm});if(f.length>0)qt(a,{role:d.role,content:f});if(g)qt(a,{role:"tool",content:m})}if(l.length>0)qt(a,{role:"user",content:u()});return a}var Yf=["show","hide","subscription"];function jr(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function rp(e,t){if(!e&&!t)return;let n=e?.metadata,r=t?.metadata,i={...e??{},...t??{}};if(jr(n)&&jr(r))i.metadata={...n,...r};return i}var M5=["web_search","image_generation"],W5=["web_search"],zm={max:1,xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},N5=void 0;function L5(e,t){if(typeof e==="string"&&e.toLowerCase()in zm)return e.toLowerCase();return t?void 0:void 0}function hS(e,t){let n=typeof e==="string"?e.toLowerCase():void 0;if(n&&n in zm)return zm[n];if(t?.fallbackEffort)return zm[t.fallbackEffort];return}function sp(e){let t=hS(e.effort,{fallbackEffort:e.fallbackEffort});if(t===void 0)return;if(t<=0)return 0;let n=e.minimumBudget??1;if(e.maxBudget<n)return;let r=e.scaleTokens??e.maxBudget;return Math.min(Math.max(Math.floor(r*t),n),e.maxBudget)}function U5(e){return e instanceof Error?{name:e.name,message:e.message}:e}var B5=3;function Dr(e){return Math.max(1,Math.ceil(e/3))}var gS=1600;function fS(){let e=0;return{replacer:(t,n)=>{if(n===null||typeof n!=="object"||n.type!=="image")return n;let r=n;if(typeof r.data==="string")return e+=1,{...r,data:""};if("image"in r)return e+=1,{...r,image:""};return n},imageCount:()=>e}}function Vt(e){let t=new WeakSet;try{return JSON.stringify(e,(n,r)=>{if(typeof r==="bigint")return r.toString();if(typeof r!=="object"||r===null)return r;if(t.has(r))return"[Circular]";return t.add(r),r})??""}catch{return String(e??"")}}function Jf(e){let{replacer:t,imageCount:n}=fS(),r,i=0;try{r=JSON.stringify({systemPrompt:e.systemPrompt,messages:e.messages,tools:e.tools},t),i=n()}catch{r=[Vt(e.systemPrompt),Vt(e.messages),Vt(e.tools)].join(`
61
+ `)}return Dr(r.length)+i*gS}var F5={debug:()=>{},log:()=>{},error:()=>{}},j5=60,$5=1,q5=3600;function yS(e){return typeof e==="number"&&Number.isFinite(e)}function xS(e){return Math.min(Math.max(e,1),3600)}function z5(e){if(!yS(e))return 60;return xS(e)}function G5(e,t,n){let r=n?` (${n})`:"",i=Math.round(t/100)/10;return`MCP request to "${e}"${r} timed out after ${i}s. Increase the "timeout" field (in seconds) for this server in cline_mcp_settings.json.`}function V5(e){if(e instanceof Error)return e.message;return String(e)}function K5(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return""}class Te extends Error{constructor(e,t){super(`${e} at position ${t}`);this.position=t}}function Xp(e){return/^[0-9A-Fa-f]$/.test(e)}function pe(e){return e>="0"&&e<="9"}function Qp(e){return e>=" "}function qe(e){return`,:[]/{}()
62
+ +`.includes(e)}function Br(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"||e==="$"}function Jt(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"||e==="$"||e>="0"&&e<="9"}var Fr=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,Zr=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function Hr(e){return`,[]/{}
63
+ +`.includes(e)}function qr(e){return Ge(e)||ef.test(e)}var ef=/^[[{\w-]$/;function Vr(e){return e===`
64
+ `||e==="\r"||e==="\t"||e==="\b"||e==="\f"}function ge(e,t){let n=e.charCodeAt(t);return n===32||n===10||n===9||n===13}function tf(e,t){let n=e.charCodeAt(t);return n===32||n===9||n===13}function nf(e,t){let n=e.charCodeAt(t);return n===160||n===6158||n>=8192&&n<=8203||n===8239||n===8287||n===12288||n===65279}function Ge(e){return Go(e)||mn(e)}function Go(e){return e==='"'||e==="“"||e==="”"}function Jr(e){return e==='"'}function mn(e){return e==="'"||e==="‘"||e==="’"||e==="`"||e==="´"}function Wr(e){return e==="'"}function Ve(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=e.lastIndexOf(t);return r!==-1?e.substring(0,r)+(n?"":e.substring(r+1)):e}function te(e,t){let n=e.length;if(!ge(e,n-1))return e+t;while(ge(e,n-1))n--;return e.substring(0,n)+t+e.substring(n)}function rf(e,t,n){return e.substring(0,t)+e.substring(t+n)}function of(e){return/[,\n][ \t\r]*$/.test(e)}var af={"&quot;":'"',"&amp;":"&","&lt;":"<","&gt;":">","&apos;":"'"},Kr=12;function Gr(e){if(e.charAt(0)!=="&")return null;let t=e.indexOf(";");if(t===-1)return null;let n=e.substring(0,t+1),r=af[n];if(r!==void 0)return{char:r,length:n.length};if(e.charAt(1)==="#"){let i=e.substring(2,t),o=i.charAt(0)==="x"||i.charAt(0)==="X",a=o?i.substring(1):i;if(a.length>0){let s=Number.parseInt(a,o?16:10);if(!Number.isNaN(s)&&s>=0&&s<=1114111)return{char:String.fromCodePoint(s),length:n.length}}}return null}function sf(e){return e!==null&&e.char==='"'}function lf(e){return e!==null&&e.char==="'"}function Ae(e,t){let n=0;for(let r=0;r<e.length;r++)if(e.charAt(r)===t)n++;return n}function uf(e,t){switch(t){case")":return Ae(e,"(")>Ae(e,")");case"]":return Ae(e,"[")>Ae(e,"]");case"}":return Ae(e,"{")>Ae(e,"}");default:return!1}}var Yr={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},cf={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
65
+ `,r:"\r",t:"\t"};function df(e){let t=0,n="";if(l(["```","[```","{```"]),!i())Ta();l(["```","```]","```}"]);let r=d(",");if(r)o();if(qr(e[t])&&of(n)){if(!r)n=te(n,",");T()}else if(r)n=Ve(n,",");while(e[t]==="}"||e[t]==="]")t++,o();if(t>=e.length)return n;Ze();function i(){o();let E=g()||y()||b()||C()||N()||q(!1)||ce();return o(),E}function o(){let E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,k=t,P=a(E);do if(P=s(),P)P=a(E);while(P);return t>k}function a(E){let k=E?ge:tf,P="";while(!0)if(k(e,t))P+=e[t],t++;else if(nf(e,t))P+=" ",t++;else break;if(P.length>0)return n+=P,!0;return!1}function s(){if(e[t]==="/"&&e[t+1]==="*"){while(t<e.length&&!pf(e,t))t++;return t+=2,!0}if(e[t]==="/"&&e[t+1]==="/"){while(t<e.length&&e[t]!==`
66
+ `)t++;return!0}return!1}function l(E){if(u(E)){if(Br(e[t]))while(t<e.length&&Jt(e[t]))t++;return o(),!0}return!1}function u(E){a(!0);for(let k of E){let P=t+k.length;if(e.slice(t,P)===k)return t=P,!0}return!1}function d(E){if(e[t]===E)return n+=e[t],t++,!0;return!1}function p(E){if(e[t]===E)return t++,!0;return!1}function f(){return p("\\")}function m(){if(o(),e[t]==="."&&e[t+1]==="."&&e[t+2]===".")return t+=3,o(),p(","),!0;return!1}function g(){if(e[t]==="{"){if(n+="{",t++,o(),p(","))o();let E=!0;while(t<e.length&&e[t]!=="}"){let k;if(!E){if(k=d(","),!k)n=te(n,",");o()}else k=!0;if(m(),!(b()||q(!0))){if(e[t]==="}"||e[t]==="{"||e[t]==="]"||e[t]==="["||e[t]===void 0){if(!E)n=Ve(n,",")}else Sa();break}o();let P=d(":"),se=t>=e.length;if(!P)if(qr(e[t])||se)n=te(n,":");else Hn();if(!i())if(P||se)n+="null";else Hn();E=!1}if(e[t]==="}")n+="}",t++;else n=te(n,"}");return!0}return!1}function y(){if(e[t]==="["){if(n+="[",t++,o(),p(","))o();let E=!0;while(t<e.length&&e[t]!=="]"){if(!E){if(!d(","))n=te(n,",")}if(m(),!i()){if(!E)n=Ve(n,",");break}E=!1}if(e[t]==="]")n+="]",t++;else n=te(n,"]");return!0}return!1}function T(){let E=!0,k=!0;while(k){if(!E){if(!d(","))n=te(n,",")}else E=!1;k=i()}if(!k)n=Ve(n,",");n=`[
67
+ ${n}
68
+ ]`}function b(){let E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,P=e[t]==="\\";if(P){if(t++,!Ge(e[t]))Ze()}let se=e[t]==="&"?Gr(e.slice(t,t+Kr)):null,Dt=sf(se)||lf(se);if(Ge(e[t])||Dt){let Oa=Jr(e[t])?Jr:Wr(e[t])?Wr:mn(e[t])?mn:Go,ot=t,at=n.length,L='"';t+=Dt&&se?se.length:1;while(!0){if(t>=e.length){let F=Ee(t-1);if(!E&&qe(e.charAt(F)))return t=ot,n=n.substring(0,at),b(!0);return L=te(L,'"'),n+=L,!0}if(t===k)return L=te(L,'"'),n+=L,!0;let le=Dt&&e[t]==="&"?Gr(e.slice(t,t+Kr)):null;if(le&&se?le.char===se.char:Oa(e[t])){let F=t,de=L.length;if(L+='"',t+=le?le.length:1,n+=L,o(!1),E||t>=e.length||qe(e[t])&&!uf(L,e[t])||Ge(e[t])&&!Be(t)||pe(e[t]))return U(),!0;if(e[t]==="\\")Ze();let qn=Ee(F-1),Vn=e.charAt(qn);if(Vn===",")return t=ot,n=n.substring(0,at),b(!1,qn);if(qe(Vn))return t=ot,n=n.substring(0,at),b(!0);n=n.substring(0,at),t=F+(le?le.length:1),L=`${L.substring(0,de)}\\${L.substring(de)}`}else if(E&&Hr(e[t])){if(e[t-1]===":"&&Fr.test(e.substring(ot+1,t+2)))while(t<e.length&&Zr.test(e[t]))L+=e[t],t++;return L=te(L,'"'),n+=L,U(),!0}else if(le){let F=le.char;if(F==='"')L+="\\\"";else if(Vr(F))L+=Yr[F];else L+=F;t+=le.length}else if(e[t]==="\\"){let F=e.charAt(t+1);if(cf[F]!==void 0)L+=e.slice(t,t+2),t+=2;else if(F==="u"){let de=2;while(de<6&&Xp(e[t+de]))de++;if(de===6)L+=e.slice(t,t+6),t+=6;else if(t+de>=e.length)t=e.length;else Ia()}else if(F===`
69
+ `)L+="\\n",t+=2;else L+=F,t+=2}else{let F=e.charAt(t);if(F==='"'&&e[t-1]!=="\\")L+=`\\${F}`,t++;else if(Vr(F))L+=Yr[F],t++;else{if(!Qp(F))Ut(F);L+=F,t++}}if(P)f()}}return!1}function U(){let E=!1;o();while(e[t]==="+"){E=!0,t++,o(),n=Ve(n,'"',!0);let k=n.length;if(b())n=rf(n,k,1);else n=te(n,'"')}return E}function C(){let E=t,k="",P=!1;if(e[t]==="-"){if(k+=e[t],t++,!pe(e[t])&&Fe())k+="0"}if(e[t]==="0"&&pe(e[t+1]))P=!0;while(pe(e[t]))k+=e[t],t++;if(e[t]==="."){if(k===""||k==="-")k+="0";if(k+=e[t],t++,!pe(e[t]))k+="0";while(pe(e[t]))k+=e[t],t++}if(t>E){if(e[t]==="e"||e[t]==="E"){if(k==="-")P=!0;if(k+=e[t],t++,e[t]==="-"||e[t]==="+")k+=e[t],t++;if(!pe(e[t]))k+="0";while(pe(e[t]))k+=e[t],t++}if(!Fe())return t=E,!1;return n+=P?`"${e.substring(E,t)}"`:k,!0}return!1}function N(){return S("true","true")||S("false","false")||S("null","null")||S("True","true")||S("False","false")||S("None","null")}function S(E,k){if(e.slice(t,t+E.length)===E&&!Jt(e[t+E.length]))return n+=k,t+=E.length,!0;return!1}function q(E){let k=t;if(Br(e[t])){while(t<e.length&&Jt(e[t]))t++;let P=t;while(ge(e,P))P++;if(e[P]==="("){if(t=P+1,i(),e[t]===")"){if(t++,e[t]===";")t++}return!0}}while(t<e.length&&!Hr(e[t])&&!Ge(e[t])&&(!E||e[t]!==":"))t++;if(e[t-1]===":"&&Fr.test(e.substring(k,t+2)))while(t<e.length&&Zr.test(e[t]))t++;if(t>k){while(ge(e,t-1)&&t>0)t--;let P=e.slice(k,t);if(n+=P==="undefined"?"null":JSON.stringify(P),e[t]==='"')t++;return!0}}function ce(){if(e[t]==="/"){let E=t;t++;while(t<e.length&&(e[t]!=="/"||e[t-1]==="\\"))t++;return t++,n+=JSON.stringify(e.substring(E,t)),!0}}function Ee(E){let k=E;while(k>0&&ge(e,k))k--;return k}function Be(E){let k=E+1;while(k<e.length&&ge(e,k))k++;return k>=e.length||qe(e[k])}function Fe(){return t>=e.length||qe(e[t])||ge(e,t)}function Ut(E){throw new Te(`Invalid character ${JSON.stringify(E)}`,t)}function Ze(){throw new Te(`Unexpected character ${JSON.stringify(e[t])}`,t)}function Ta(){throw new Te("Unexpected end of json string",e.length)}function Sa(){throw new Te("Object key expected",t)}function Hn(){throw new Te("Colon expected",t)}function Ia(){let E=e.slice(t,t+6);throw new Te(`Invalid unicode character "${E}"`,t)}}function pf(e,t){return e[t]==="*"&&e[t+1]==="/"}function ff(e){let t=!1,n=!1,r=!1;for(let i=0;i<e.length;i+=1){let o=e[i];if(r){r=!1;continue}if(o==="\\"){r=!0;continue}if(!n&&o==='"')t=!t;else if(!t&&o==="'")n=!n}return t||n}var mf=/^\{\s*"([A-Za-z0-9_.$-]+)"\s*:\s*([\s\S]+?)\s*\}$/;function hf(e){let t=e.match(mf);if(!t)return;let[,n,r]=t,i=r.trim();if(!i)return;let o=i[0];if(o==='"'||o==="{"||o==="["||i==="true"||i==="false"||i==="null"||Number.isFinite(Number(i)))return;return JSON.parse(`{"${n}":${JSON.stringify(i)}}`)}function Xf(e){if(typeof e!=="string")return e;let t=e.trimStart();if(t[0]!=="{"&&t[0]!=="[")return e;try{return JSON.parse(t)}catch{}if(!ff(t))try{return JSON.parse(df(t))}catch{}return hf(t)??e}function Zf(e){let t=new WeakSet;try{return JSON.stringify(e,(n,r)=>{if(typeof r==="bigint")return r.toString();if(r&&typeof r==="object"){if(t.has(r))return"[Circular]";t.add(r)}return r})??"null"}catch{return String(e)}}function cp(e){try{return JSON.parse(e)}catch{return}}function Pe(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function gf(e){let t=e.type;if(typeof t==="string")return[t];return Array.isArray(t)?t.filter((n)=>typeof n==="string"):[]}function hn(e,t){if(gf(e).includes(t))return!0;for(let n of["anyOf","oneOf","allOf"]){let r=e[n];if(Array.isArray(r)&&r.some((i)=>Pe(i)&&hn(i,t)))return!0}return!1}function yf(e,t){if(typeof e!=="string")return e;let n=e.trim(),r=hn(t,"array"),i=hn(t,"object");if((!r||!n.startsWith("["))&&(!i||!n.startsWith("{")))return e;try{let o=JSON.parse(n);if(Array.isArray(o))return r?o:e;if(Pe(o))return i?o:e;return e}catch{return e}}function lp(e,t){let n=yf(e,t);if(Array.isArray(n)){let a=t.items;if(!Pe(a))return n;let s=!1,l=n.map((u)=>{let d=lp(u,a);return s||=d!==u,d});return s?l:n}if(!Pe(n))return n;let r=t.properties;if(!Pe(r))return n;let i=!1,o={...n};for(let[a,s]of Object.entries(r)){if(!(a in n)||!Pe(s))continue;let l=lp(n[a],s);if(l!==n[a])o[a]=l,i=!0}return i?o:n}function vf(e){if(typeof globalThis.atob==="function")try{let t=globalThis.atob(e),n=Uint8Array.from(t,(r)=>r.charCodeAt(0));return new TextDecoder().decode(n)}catch{return null}if(typeof Buffer<"u")try{return Buffer.from(e,"base64").toString("utf8")}catch{return null}return null}function ey(e){let t=e?.trim();if(!t)return null;try{let n=t.split(".");if(n.length!==3)return null;let r=n[1];if(!r)return null;let i=r.replace(/-/g,"+").replace(/_/g,"/"),o=i.padEnd(i.length+(4-i.length%4)%4,"="),a=vf(o);return a?JSON.parse(a):null}catch{return null}}function ty(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function H5(e){return e.split(_f.sep).join("/")}function Yo(e){let t=e.replaceAll("\\","/"),n=t.lastIndexOf("/");return(n>=0?t.slice(n+1):t).toLowerCase()}function Q5(e){return e==="win32"?"powershell":"/bin/bash"}function xw(e){let t=Yo(e);if(up(e)!==void 0)return"powershell";if(t==="cmd"||t==="cmd.exe")return"cmd";if(t==="wsl"||t==="wsl.exe")return"wsl";return"posix"}var bf=new Set(["-nologo","-noninteractive","-noprofile"]),wf="-noprofile";function Ef(e,t){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(i==="`"&&r+1<e.length){let o=e[r+1];if(o==="u"&&t==="core"&&e[r+2]==="{"){let a=e.indexOf("}",r+3),s=a>r+3?e.slice(r+3,a):"",l=Number.parseInt(s,16);if(s.length<=6&&/^[0-9a-fA-F]+$/.test(s)&&l<=1114111){n+=String.fromCodePoint(l),r=a;continue}}switch(o){case"n":n+=`
70
+ `;break;case"r":n+="\r";break;case"t":n+="\t";break;case"b":n+="\b";break;case"f":n+="\f";break;case"v":n+="\v";break;case"0":n+="\x00";break;case"a":n+="\x07";break;case"e":n+=t==="core"?"\x1B":"e";break;default:n+=o}r++;continue}if(i==='"'&&e[r+1]==='"'){n+='"',r++;continue}n+=i}return n}function kf(e){let t=e[0];if(t!=="'"&&t!=='"')return;for(let n=1;n<e.length;n++){let r=e[n];if(t==='"'&&r==="`"){n++;continue}if(r===t){if(e[n+1]===t){n++;continue}if(e.slice(n+1).trim()!=="")return;return{quote:t,body:e.slice(1,n)}}}return}function up(e){let t=Yo(e);if(t==="powershell"||t==="powershell.exe")return"windows";if(t==="pwsh"||t==="pwsh.exe")return"core";return}function Tf(e,t){let n=kf(e);if(!n)return;let r=(n.quote==="'"?n.body.replaceAll("''","'"):Ef(n.body,t)).trim();return r.length>0?r:void 0}function Sf(e,t){let n=/^[ \t]*(?:&[ \t]*(?:"([^"$`]*)"|'((?:[^']|'')*)')|(?:&[ \t]*)?([^\s$`"';&|<>(){}#@,]+))[ \t]+([\S\s]*)$/.exec(e);if(!n)return;let r=n[1]??n[2]?.replaceAll("''","'")??n[3],i=up(t);if(!i||!up(r))return;let o=n[4],a=!1;for(;;){let s=/^(-[^\s=]+)[ \t]*([\S\s]*)$/.exec(o);if(!s)return;let l=s[1].toLowerCase();if(l==="-command"){let u=a?Tf(s[2],i):void 0;return u===void 0?void 0:{executable:r,script:u}}if(!bf.has(l))return;if(l===wf)a=!0;o=s[2]}}function If(e,t){if(!/[\\/:]/.test(t)&&up(t)===up(e))return e;return t}function bS(e,t){switch(xw(e)){case"powershell":{let n={executable:e,script:t};for(;;){let r=Sf(n.script,n.executable);if(!r)break;n={executable:If(e,r.executable),script:r.script}}return{executable:n.executable,args:["-NoProfile","-NonInteractive","-Command","[Console]::InputEncoding=[Text.UTF8Encoding]::new();[Console]::OutputEncoding=[Text.UTF8Encoding]::new();$ErrorActionPreference='Stop';$c=[Console]::In.ReadToEnd();$c+=[Environment]::NewLine+'if(-not $?){exit 1}';& ([ScriptBlock]::Create($c))"],input:n.script}}case"cmd":return{executable:e,args:["/d","/s","/c",t]};case"wsl":return{executable:e,args:["bash","-c",t]};case"posix":return{executable:e,args:["-c",t]}}}function Y5(e,t){if(xw(e)==="powershell")return["-NoProfile","-NonInteractive","-Command",t];return bS(e,t).args}function J5(e){return e.toLowerCase().replace(/[^\w.-]+/g,"_")}function fi(e){let t=e?.trim();return t?t:void 0}function vS(e,t){if(e.length<=t)return e;return`${e.slice(0,t-1)}…`}function X5(e,t="/",n=100){if(!e||e.length<=n)return e||"";let r=e.split(t)?.shift()?.trim()?.slice(0,n-1);return r?`${r}…`:vS(e,n)}function Z5(e){if(e.length<=8)return"****";return`${e.slice(0,4)}...${e.slice(-4)}`}function e6(e){return e.charCodeAt(0)===65279?e.slice(1):e}function t6(e){if(!e)return"(unknown-date)";let t=new Date(e);if(Number.isNaN(t.getTime()))return e;return t.toLocaleString("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0})}function i6(e){let t=Math.max(0,Math.floor(e/1000)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),o=t%60;if(n>0)return`${n}d ${r}h`;if(r>0)return`${r}h ${i}m`;if(i>0)return`${i}m ${o}s`;return`${o}s`}function n6(e,t){let n=e.safeParse(t);if(!n.success)throw Error(ls(n.error));return n.data}function wS(e){return Gc(e)}function ta(e){return e==="cline"||e==="cline-pass"}var Of=`You are Cline, an AI coding agent. Your primary goal is to assist users with various coding tasks by leveraging your knowledge and the tools at your disposal. Given the user's prompt, you should use the tools available to you to answer user's question.
71
+
72
+ Always gather all the necessary context before starting to work on a task. For example, if you are generating a unit test or new code, make sure you understand the requirement, the naming conventions, frameworks and libraries used and aligned in the current codebase, and the environment and commands used to run and test the code etc. Always validate the new unit test at the end including running the code if possible for live feedback.
73
+ Review each question carefully and answer it with detailed, accurate information.
74
+ If you need more information, use one of the available tools or ask for clarification instead of making assumptions or lies.
75
+
76
+ Environment you are running in:
77
+ <env>
78
+ 1. Platform: {{PLATFORM_NAME}}
79
+ 2. Date: {{CURRENT_DATE}}
80
+ 3. IDE: {{IDE_NAME}}
81
+ 4. Working Directory: {{CWD}}
82
+ </env>
83
+
84
+ Remember:
85
+ - Always adhere to existing code conventions and patterns.
86
+ - Use only libraries and frameworks that are confirmed to be in use in the current codebase.
87
+ - Provide complete and functional code without omissions or placeholders.
88
+ - Be explicit about any assumptions or limitations in your solution.
89
+ - Always show your planning process before executing any task. This will help ensure that you have a clear understanding of the requirements and that your approach aligns with the user's needs.
90
+ - Always use absolute paths when referring to files.
91
+ - You can call multiple tools in a single response. Before using tools, identify every independent read, search, command, or edit needed for the next step and emit all of those tool calls now, either as multiple tool calls or as one batched input for tools that accept arrays. Do not wait for one independent result before requesting another. Do not split independent reads, searches, checks, or edits across separate turns.
92
+ - Good parallelism examples: read all known relevant files in one read_files call; run independent inspection commands in one run_commands call; emit independent read_files, search_codebase, and run_commands calls together in one response; emit multiple editor calls together when editing different files or non-overlapping regions.
93
+ - Always verify the files you have edited or created at the end of the task to ensure they are completed and working as expected.
94
+
95
+ Begin by analyzing the user's input and gathering any necessary additional context. Then, present your plan at the start of your response along with tool calls before proceeding with the task. It's OK for this section to be quite long.
96
+
97
+ REMEMBER, be helpful and proactive! Don't ask for permission to do something when you can do it! Do not indicates you will be using a tool unless you are actually going to use it.
98
+
99
+ IMPORTANT: Always includes tool calls in your response until the task is completed. Response without tool calls will considered as completed with final answer.
100
+
101
+ When you have completed the task, please provide a summary of what you did and any relevant information that the user should know. This will help ensure that the user understands the changes made and can easily follow up if they have any questions or need further assistance. Do not indicate that you will perform an action without actually doing it. Always provide the final result in your response. Always validate your answer with checking the code and running it if possible.
102
+
103
+ If user asked a simple question without any coding context, answer it directly without using any tools.
104
+ {{CLINE_RULES}}
105
+ {{CLINE_METADATA}}`,Af=`You are Cline, a careful and helpful coding agent that works in the background.
106
+ You are tasked to solve an issue reported by the user who you cannot communicate with directly.
107
+ Your goal is to utilize the tools at your disposal to investigate and answer the question according to user's instructions with the aim to verify that the issue is resolved.
108
+
109
+ RULES:
110
+ - Always match output format exactly as shown in examples or existing files.
111
+ - Use only libraries and frameworks that are confirmed and compatible to be in use in the current codebase.
112
+ - Provide complete and functional code without omissions or placeholders.
113
+ - During thinking stage, show your planning process. Keep the plan to one short paragraph.
114
+ - Be proactive and avoid overthinking. Once the next action is clear, execute it. Do not seek perfect certainty, repeatedly compare alternatives, or revisit settled decisions without new evidence. Use focused tool calls to resolve uncertainty.
115
+ - If repeated fixes fail without new evidence, stop making similar edits. Test your assumptions with a focused check or minimal reproduction, then adjust your approach based on the result.
116
+ - Put complete code, commands, and edit payloads in the tool arguments. Do not draft them in full in your plan if you can execute them directly.
117
+ - Provide text response when it adds value: a brief plan summary for multi-step work, a meaningful progress update, concise task notes, a blocker, or the final result. Routine tool calls need no text preamble. Keep plan summaries and progress updates to one short paragraph, reporting decisions and new evidence rather than internal deliberation.
118
+ - Keep task notes focused on confirmed facts, decisions, and remaining work. Update existing notes when possible instead of repeating the task history.
119
+ - Always use absolute paths when referring to files.
120
+ - You can call multiple tools in a single response. Before using tools, identify every independent read, search, command, or edit needed for the next step and emit all of those tool calls now, either as multiple tool calls or as one batched input for tools that accept arrays. Do not wait for one independent result before requesting another. Do not split independent reads, searches, checks, or edits across separate turns.
121
+ - Good parallelism examples: read all known relevant files in one read_files call; run independent inspection commands in one run_commands call; emit independent read_files, search_codebase, and run_commands calls together in one response; emit multiple editor calls together when editing different files or non-overlapping regions.
122
+ - Always verify the files you have edited or created at the end of the task to ensure they are completed and working as expected.
123
+
124
+ Environment you are running in:
125
+ <env>
126
+ 1. Platform: {{PLATFORM_NAME}}
127
+ 2. Date: {{CURRENT_DATE}}
128
+ 3. IDE: {{IDE_NAME}}
129
+ 4. Working Directory: {{CWD}}
130
+ </env>
131
+
132
+ IMPORTANT:
133
+ - When the user describes a bug, unexpected behavior, or provides a bug report, your primary goal is to produce a correct fix in the source code that resolves the issue.
134
+ - A correct fix means the underlying behavior is fixed — not just the symptoms addressed superficially.
135
+ - Verify by execution, never by assumption. Before considering any task done, gather concrete evidence from your own tool output that every requirement is satisfied:
136
+ - If a test suite, tests, or assertions are provided or referenced, run them and confirm they pass. If they fail, analyze the failures, revise, and re-run until they pass.
137
+ - If no tests are provided, construct your own verification: actually run the program, script, or command you produced; confirm every required output file exists at the exact path requested; and confirm its contents match the expected format, data types, and values described in the task. Read the output back to confirm.
138
+ - Treat "this should work", "assume it works", or "probably correct" as a signal that you have NOT verified yet — go run the check instead of finishing.
139
+ - Do not consider the task complete until you have observed evidence that all stated requirements are met.
140
+ - Always includes tool calls in your response until the task is completed. You should only end the task when all the requirements are met by calling the 'submit_and_exit' tool.
141
+ - When you call 'submit_and_exit', set 'verified' to true only if your tool output shows the requirements are met; otherwise set it to false.
142
+ - Response without the submit_and_exit tool call will considered not completed and the task will continue.
143
+ {{CLINE_RULES}}
144
+ {{CLINE_METADATA}}`,Xr={ACT:Of,YOLO:Af},gn="# Workspace Configuration",TS=`# Plan / Act Modes
145
+
146
+ User messages arrive wrapped in a <user_input mode="..."> tag. The mode attribute is the interaction mode the user was in when they sent that message: "plan" means plan-mode constraints applied (explore, analyze, and align on a plan -- no edits or state-changing commands), while "act" (or "yolo") means implementation was allowed. If the mode attribute changes between messages, the user switched modes -- the newest message's mode is what governs right now, regardless of what earlier messages allowed. A <mode_notice> block inside a message marks exactly when such a switch happened.`,Xo=`# Plan Mode
147
+
148
+ You are in Plan mode. Your role is to explore, analyze, and plan -- not to execute.
149
+
150
+ - Read files, search the codebase, and gather context to understand the problem
151
+ - Ask clarifying questions when requirements are ambiguous
152
+ - Present your plan as a structured outline with clear steps
153
+ - Explain tradeoffs between different approaches when they exist
154
+ - Do NOT edit files, write code, run destructive commands, or make any changes
155
+ - Do NOT implement anything -- focus on understanding and alignment first
156
+
157
+ The run_commands tool remains available in plan mode strictly for read-only inspection -- listing files, searching (grep), reading configs, inspecting git history and diffs, checking tool versions, and the like. Never use it to change anything: no creating, modifying, or deleting files, no writing scripts that make changes, and no state-changing commands (installs, migrations, database or schema changes, container commands that mutate state, etc.). File-editing commands (rm/mv/cp, in-place edits like sed -i, output redirection to files outside /tmp, git commands that change the working tree, package installs) are hard-blocked in plan mode: they are not executed and return a tool error instead, so do not attempt them. If the task requires a mutation, put it in the plan; it happens only after the user switches to act mode.`,_S=`${Xo}
158
+
159
+ Once the user has reviewed your plan and explicitly approved it in a follow-up message, use the switch_to_act_mode tool to switch to act mode and begin implementation. Calling switch_to_act_mode immediately starts execution, so never call it in the same turn you present a plan and never treat the original task request as approval -- end your turn after presenting the plan and wait for the user's response.`,kS=`${Xo}
160
+
161
+ Once you have presented your plan, end your turn and wait for the user's response. You do NOT have the ability to switch to act mode yourself -- the user must do it manually with the Plan/Act toggle once they are satisfied with the plan. If the task requires tools that are only available in act mode, ask the user to "toggle to Act mode" (use those words).`;function xf(e){let t=e.indexOf("://");if(t<1)return e;let n=t+3,r=n;while(r<e.length){let o=e[r];if(o==="/"||o==="?"||o==="#"||o.charCodeAt(0)<=32)break;r++}let i=e.lastIndexOf("@",r-1);if(i<n)return e;return e.slice(0,n)+e.slice(i+1)}function a6(e){return JSON.stringify({workspaces:{[e.rootPath]:{hint:e.hint,associatedRemoteUrls:e.associatedRemoteUrls?.map(xf),latestGitCommitHash:e.latestGitCommitHash,latestGitBranchName:e.latestGitBranchName}}},null,2)}function Qr(e,t,n){if(n?.trim()?.includes(gn))return n.trim();let r=n||JSON.stringify({workspaces:{[e]:{hint:t||e.split("/").at(-1)||e}}},null,2);return`
162
+ ${gn}
163
+ ${r}`}function o6(e){let{ide:t="Terminal Shell",mode:n,platform:r="unknown",workspaceName:i,metadata:o,rules:a,overridePrompt:s,providerId:l,planModeSwitchTool:u=!0}=e,d=e.workspaceRoot??e.rootPath??"",p=ta(l||"");if(s?.trim()){let g=s.trim();if(p&&o?.trim()&&!g.includes(gn))return`${g}
164
+
165
+ ${Qr(d,i,o)}`.trim();return g}let f=n==="yolo"?Xr.YOLO:Xr.ACT,m=[a,n==="yolo"?void 0:TS,n==="plan"?u?_S:kS:void 0].filter(Boolean).join(`
166
+
167
+ `);return f.replace("{{PLATFORM_NAME}}",r).replace("{{CWD}}",d).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",t).replace("{{CLINE_METADATA}}",p?Qr(d,i,o):"").replace("{{CLINE_RULES}}",m).trim()}function r6(e){return e?.metadata?.apiKeyOptional===!0}function iy(e){let t=e?.metadata?.localCliCommand;if(typeof t!=="string"||!t.trim())return;return{command:t.trim(),docsUrl:e?.docsUrl}}var pp="anthropic/claude-sonnet-5.5";async function Cf(e){try{return await ie.access(e),!0}catch{return!1}}class Qo{filePath;constructor(e){this.filePath=e}async read(){try{return JSON.parse(await ie.readFile(this.filePath,"utf8"))}catch(e){if(e.code==="ENOENT")return;throw e}}async write(e){await ie.mkdir(yn.dirname(this.filePath),{recursive:!0}),await ie.writeFile(this.filePath,JSON.stringify(e,null,2),"utf8")}async clear(){await ie.rm(this.filePath,{force:!0})}}class Bn{async writeText(e,t){await ie.mkdir(yn.dirname(e),{recursive:!0}),await ie.writeFile(e,t,"utf8")}async remove(e){await ie.rm(e,{recursive:!0,force:!0})}async removeChildren(e){if(!await Cf(e))return;let t=await ie.readdir(e);await Promise.all(t.map((n)=>ie.rm(yn.join(e,n),{recursive:!0,force:!0})))}}var vn=new TextEncoder,Rf={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},$f=new Set(["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"]);class Fn{constructor({accessKeyId:e,secretAccessKey:t,sessionToken:n,service:r,region:i,cache:o,retries:a,initRetryMs:s}){if(e==null)throw TypeError("accessKeyId is a required option");if(t==null)throw TypeError("secretAccessKey is a required option");this.accessKeyId=e,this.secretAccessKey=t,this.sessionToken=n,this.service=r,this.region=i,this.cache=o||new Map,this.retries=a!=null?a:10,this.initRetryMs=s||50}async sign(e,t){if(e instanceof Request){let{method:i,url:o,headers:a,body:s}=e;if(t=Object.assign({method:i,url:o,headers:a},t),t.body==null&&a.has("Content-Type"))t.body=s!=null&&a.has("X-Amz-Content-Sha256")?s:await e.clone().arrayBuffer();e=o}let n=new ea(Object.assign({url:e.toString()},t,this,t&&t.aws)),r=Object.assign({},t,await n.sign());delete r.aws;try{return new Request(r.url.toString(),r)}catch(i){if(i instanceof TypeError)return new Request(r.url.toString(),Object.assign({duplex:"half"},r));throw i}}async fetch(e,t){for(let n=0;n<=this.retries;n++){let r=fetch(await this.sign(e,t));if(n===this.retries)return r;let i=await r;if(i.status<500&&i.status!==429)return i;await new Promise((o)=>setTimeout(o,Math.random()*this.initRetryMs*Math.pow(2,n)))}throw Error("An unknown error occurred, ensure retries is not negative")}}class ea{constructor({method:e,url:t,headers:n,body:r,accessKeyId:i,secretAccessKey:o,sessionToken:a,service:s,region:l,cache:u,datetime:d,signQuery:p,appendSessionToken:f,allHeaders:m,singleEncode:g}){if(t==null)throw TypeError("url is a required option");if(i==null)throw TypeError("accessKeyId is a required option");if(o==null)throw TypeError("secretAccessKey is a required option");this.method=e||(r?"POST":"GET"),this.url=new URL(t),this.headers=new Headers(n||{}),this.body=r,this.accessKeyId=i,this.secretAccessKey=o,this.sessionToken=a;let y,T;if(!s||!l)[y,T]=Lf(this.url,this.headers);if(this.service=s||y||"",this.region=l||T||"us-east-1",this.cache=u||new Map,this.datetime=d||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=p,this.appendSessionToken=f||this.service==="iotdevicegateway",this.headers.delete("Host"),this.service==="s3"&&!this.signQuery&&!this.headers.has("X-Amz-Content-Sha256"))this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD");let b=this.signQuery?this.url.searchParams:this.headers;if(b.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken)b.set("X-Amz-Security-Token",this.sessionToken);if(this.signableHeaders=["host",...this.headers.keys()].filter((C)=>m||!$f.has(C)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map((C)=>C+":"+(C==="host"?this.url.host:(this.headers.get(C)||"").replace(/\s+/g," "))).join(`
168
+ `),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery){if(this.service==="s3"&&!b.has("X-Amz-Expires"))b.set("X-Amz-Expires","86400");b.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),b.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),b.set("X-Amz-SignedHeaders",this.signedHeaders)}if(this.service==="s3")try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch(C){this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");if(!g)this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/");this.encodedPath=ni(this.encodedPath);let U=new Set;this.encodedSearch=[...this.url.searchParams].filter(([C])=>{if(!C)return!1;if(this.service==="s3"){if(U.has(C))return!1;U.add(C)}return!0}).map((C)=>C.map((N)=>ni(encodeURIComponent(N)))).sort(([C,N],[S,q])=>C<S?-1:C>S?1:N<q?-1:N>q?1:0).map((C)=>C.join("=")).join("&")}async sign(){if(this.signQuery){if(this.url.searchParams.set("X-Amz-Signature",await this.signature()),this.sessionToken&&this.appendSessionToken)this.url.searchParams.set("X-Amz-Security-Token",this.sessionToken)}else this.headers.set("Authorization",await this.authHeader());return{method:this.method,url:this.url,headers:this.headers,body:this.body}}async authHeader(){return["AWS4-HMAC-SHA256 Credential="+this.accessKeyId+"/"+this.credentialString,"SignedHeaders="+this.signedHeaders,"Signature="+await this.signature()].join(", ")}async signature(){let e=this.datetime.slice(0,8),t=[this.secretAccessKey,e,this.region,this.service].join(),n=this.cache.get(t);if(!n){let r=await Je("AWS4"+this.secretAccessKey,e),i=await Je(r,this.region),o=await Je(i,this.service);n=await Je(o,"aws4_request"),this.cache.set(t,n)}return Wt(await Je(n,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,Wt(await ei(await this.canonicalString()))].join(`
169
+ `)}async canonicalString(){return[this.method.toUpperCase(),this.encodedPath,this.encodedSearch,this.canonicalHeaders+`
170
+ `,this.signedHeaders,await this.hexBodyHash()].join(`
171
+ `)}async hexBodyHash(){let e=this.headers.get("X-Amz-Content-Sha256")||(this.service==="s3"&&this.signQuery?"UNSIGNED-PAYLOAD":null);if(e==null){if(this.body&&typeof this.body!=="string"&&!("byteLength"in this.body))throw Error("body must be a string, ArrayBuffer or ArrayBufferView, unless you include the X-Amz-Content-Sha256 header");e=Wt(await ei(this.body||""))}return e}}async function Je(e,t){let n=await crypto.subtle.importKey("raw",typeof e==="string"?vn.encode(e):e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return crypto.subtle.sign("HMAC",n,vn.encode(t))}async function ei(e){return crypto.subtle.digest("SHA-256",typeof e==="string"?vn.encode(e):e)}var ti=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function Wt(e){let t=new Uint8Array(e),n="";for(let r=0;r<t.length;r++){let i=t[r];n+=ti[i>>>4&15],n+=ti[i&15]}return n}function ni(e){return e.replace(/[!'()*]/g,(t)=>"%"+t.charCodeAt(0).toString(16).toUpperCase())}function Lf(e,t){let{hostname:n,pathname:r}=e;if(n.endsWith(".on.aws")){let s=n.match(/^[^.]{1,63}\.lambda-url\.([^.]{1,63})\.on\.aws$/);return s!=null?["lambda",s[1]||""]:["",""]}if(n.endsWith(".r2.cloudflarestorage.com"))return["s3","auto"];if(n.endsWith(".backblazeb2.com")){let s=n.match(/^(?:[^.]{1,63}\.)?s3\.([^.]{1,63})\.backblazeb2\.com$/);return s!=null?["s3",s[1]||""]:["",""]}let i=n.replace("dualstack.","").match(/([^.]{1,63})\.(?:([^.]{0,63})\.)?amazonaws\.com(?:\.cn)?$/),o=i&&i[1]||"",a=i&&i[2];if(a==="us-gov")a="us-gov-west-1";else if(a==="s3"||a==="s3-accelerate")a="us-east-1",o="s3";else if(o==="iot")if(n.startsWith("iot."))o="execute-api";else if(n.startsWith("data.jobs.iot."))o="iot-jobs-data";else o=r==="/mqtt"?"iotdevicegateway":"iotdata";else if(o==="autoscaling"){let s=(t.get("X-Amz-Target")||"").split(".")[0];if(s==="AnyScaleFrontendService")o="application-autoscaling";else if(s==="AnyScaleScalingPlannerFrontendService")o="autoscaling-plans"}else if(a==null&&o.startsWith("s3-"))a=o.slice(3).replace(/^fips-|^external-1/,""),o="s3";else if(o.endsWith("-fips"))o=o.slice(0,-5);else if(a&&/-\d$/.test(o)&&!/-\d$/.test(a))[o,a]=[a,o];return[Rf[o]||o,a||""]}var IS="enterprise.blobUpload",Ct=new Map;function Kt(e,t){return{adapterType:e,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,region:t.region,bucket:t.bucket,endpoint:t.endpoint,accountId:t.accountId}}function na(e){return{adapterType:e.adapterType,bucket:e.bucket,region:e.region,endpoint:e.endpoint,accountId:e.accountId}}function Mf(e){if(!e||e.enabled!==!0)return;if(e.type==="s3_access_keys"&&e.s3AccessSettings)return Kt("s3",e.s3AccessSettings);if(e.type==="r2_access_keys"&&e.r2AccessSettings)return Kt("r2",e.r2AccessSettings);if(e.type==="azure_access_keys"&&e.azureAccessSettings)return Kt("azure",e.azureAccessSettings);return}function ra(e){return Mf(e?.enterpriseTelemetry?.promptUploading)}function s6(e,t){let n=ra(e);if(!n)return;return{version:1,storage:na(n),userDistinctId:t}}function c6(e,t,n){let r=ra(t);if(!r){Ct.delete(e);return}return Ct.set(e,r),{version:1,storage:na(r),userDistinctId:n}}function l6(e){Ct.delete(e)}function ia(e,t,n){let r=`${t}/${n}`;return{async write(i,o){let a=await e.fetch(`${r}/${i}`,{method:"PUT",body:o,headers:{"Content-Type":"application/json; charset=utf-8"}});if(!a.ok)throw Error(`Failed to write ${i}: ${a.status}`)}}}function Uf(e){let{bucket:t,accessKeyId:n,secretAccessKey:r}=e;if(!t||!n||!r)return;let i=e.region||"us-east-1",o=e.endpoint||`https://s3.${i}.amazonaws.com`;return ia(new Fn({region:i,accessKeyId:n,secretAccessKey:r}),o,t)}function Df(e){let{accountId:t,endpoint:n,bucket:r,accessKeyId:i,secretAccessKey:o}=e;if(!n&&!t||!r||!i||!o)return;return ia(new Fn({accessKeyId:i,secretAccessKey:o}),e.endpoint??`https://${t}.r2.cloudflarestorage.com`,r)}function jf(e,t,n,r,i){let o=i["Content-Length"]||"",a=i["Content-Type"]||"",s=Object.entries(i).filter(([f])=>f.toLowerCase().startsWith("x-ms-")).sort(([f],[m])=>f.toLowerCase().localeCompare(m.toLowerCase())).map(([f,m])=>`${f.toLowerCase()}:${m}`).join(`
172
+ `),l=`/${e}${r}`,u=[n,"","",o,"",a,"","","","","","",s,l].join(`
173
+ `),d=Buffer.from(t,"base64"),p=Nf("sha256",d).update(u,"utf8").digest("base64");return`SharedKey ${e}:${p}`}function Bf(e){let{accessKeyId:t,secretAccessKey:n,bucket:r}=e;if(!t||!n||!r)return;let i=e.endpoint||`https://${t}.blob.core.windows.net`;return{async write(o,a){let s=`/${r}/${o}`,l=new Date().toUTCString(),u=Buffer.from(a,"utf8"),d={"x-ms-date":l,"x-ms-version":"2024-11-04","x-ms-blob-type":"BlockBlob","Content-Type":"application/json; charset=utf-8","Content-Length":u.byteLength.toString()};d.Authorization=jf(t,n,"PUT",s,d);let p=await fetch(`${i}${s}`,{method:"PUT",body:u,headers:d});if(!p.ok){let f=await p.text().catch(()=>"");throw Error(`Failed to write ${o}: ${p.status} ${f}`.trim())}}}}function Ff(e){if(e.adapterType==="s3")return Uf(e);if(e.adapterType==="r2")return Df(e);if(e.adapterType==="azure")return Bf(e);return}function ri(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function SS(e){let t=e?.metadata?.[IS];if(!ri(t))return;let n=t.storage;if(!ri(n))return;let r=n.adapterType;if(r!=="s3"&&r!=="r2"&&r!=="azure")return;if(typeof n.bucket!=="string")return;return{version:1,storage:{adapterType:r,bucket:n.bucket,region:typeof n.region==="string"?n.region:void 0,endpoint:typeof n.endpoint==="string"?n.endpoint:void 0,accountId:typeof n.accountId==="string"?n.accountId:void 0},keyPrefix:typeof t.keyPrefix==="string"?t.keyPrefix:void 0,userDistinctId:typeof t.userDistinctId==="string"?t.userDistinctId:void 0}}function qf(e,t,n){return["sessions",n.userDistinctId?.trim()||"unknown",e,t?.endsWith("messages.json")?"messages.json":Pf(t)].filter((r)=>Boolean(r?.trim())).join("/")}function u6(){let e=new Map;return{async uploadMessagesFile({sessionId:t,path:n,contents:r,row:i}){let o=SS(i);if(!o)return;let a=Ct.get(t);if(!a)return;let s=JSON.stringify(a),l=e.get(s);if(!l){if(l=Ff(a),!l)return;e.set(s,l)}await l.write(qf(t,n,o),r)}}}function ii(e,t,n){return{id:`remote-config:${e}:${n}:${t.name}`,name:t.name,kind:e,contents:t.contents,alwaysEnabled:t.alwaysEnabled}}var p6="remote://";function oi(e){let t="",n=!1;for(let r of e.trim().toLowerCase()){let i=r.charCodeAt(0);if(i>=97&&i<=122||i>=48&&i<=57||r==="."||r==="_"||r==="-"){if(n&&t&&t[t.length-1]!=="-")t+="-";n=!1,t+=r}else n=!0;if(t.length>=80)break}while(t.endsWith("-"))t=t.slice(0,-1);while(t.startsWith("-"))t=t.slice(1);return t||"item"}function Wf(e){let t=e?.globalRules?.map((r,i)=>ii("rule",r,`${i}`))??[],n=e?.globalWorkflows?.map((r,i)=>ii("workflow",r,`${i}`))??[];return[...t,...n]}function em(e){return[...Wf(e.remoteConfig),...e.managedInstructions??[]]}function tm(e){return e.map((t)=>{let n=`## ${t.name}`,r=t.alwaysEnabled?`_Always enabled_
174
+ `:"";return`${n}
175
+
176
+ ${r}${t.contents.trim()}`}).join(`
177
+
178
+ `)}function Gt(e,t){return e.filter((n)=>n.kind===t)}class oa{async materialize(e){let t=em(e.bundle),n=Gt(t,"rule"),r=Gt(t,"workflow"),i=Gt(t,"skill");await e.artifactStore.removeChildren(e.paths.workflowsPath),await e.artifactStore.removeChildren(e.paths.skillsPath);let o=[];if(n.length>0)await e.artifactStore.writeText(e.paths.rulesFilePath,tm(n)),o.push(...n.map((a)=>({kind:a.kind,filePath:e.paths.rulesFilePath,id:a.id,name:a.name})));else await e.artifactStore.remove(e.paths.rulesFilePath);for(let a of r){let s=`${e.paths.workflowsPath}/${oi(a.name.replace(/\.(md|markdown|txt)$/i,""))}.md`;await e.artifactStore.writeText(s,a.contents),o.push({kind:a.kind,filePath:s,id:a.id,name:a.name})}for(let a of i){let s=`${e.paths.skillsPath}/${oi(a.name)}/SKILL.md`;await e.artifactStore.writeText(s,a.contents),o.push({kind:a.kind,filePath:s,id:a.id,name:a.name})}return await e.artifactStore.writeText(e.paths.manifestPath,JSON.stringify({source:e.bundle.source,version:e.bundle.version,files:o},null,2)),{paths:e.paths,rulesFilePath:n.length>0?e.paths.rulesFilePath:void 0,files:o}}}var nm="remote-config";function aa(e){let t=e.pluginName??nm,n=xe.join(e.workspacePath,".cline",t);return{pluginName:t,pluginPath:n,workflowsPath:xe.join(n,"workflows"),skillsPath:xe.join(n,"skills"),bundleCachePath:xe.join(n,"cache","bundle.json"),manifestPath:xe.join(n,"managed.json"),rulesFilePath:xe.join(n,"rules.md")}}function rm(e){return{workflowsDirectories:[e.workflowsPath],skillsDirectories:[e.skillsPath]}}function im(e){if(!e)return;return{enabled:e.openTelemetryEnabled??!1,metricsExporter:e.openTelemetryMetricsExporter,logsExporter:e.openTelemetryLogsExporter,otlpProtocol:e.openTelemetryOtlpProtocol,otlpEndpoint:e.openTelemetryOtlpEndpoint,otlpHeaders:e.openTelemetryOtlpHeaders,otlpMetricsProtocol:e.openTelemetryOtlpMetricsProtocol,otlpMetricsEndpoint:e.openTelemetryOtlpMetricsEndpoint,otlpMetricsHeaders:e.openTelemetryOtlpMetricsHeaders,otlpLogsProtocol:e.openTelemetryOtlpLogsProtocol,otlpLogsEndpoint:e.openTelemetryOtlpLogsEndpoint,otlpLogsHeaders:e.openTelemetryOtlpLogsHeaders,metricExportInterval:e.openTelemetryMetricExportInterval,otlpInsecure:e.openTelemetryOtlpInsecure,logBatchSize:e.openTelemetryLogBatchSize,logBatchTimeout:e.openTelemetryLogBatchTimeout,logMaxQueueSize:e.openTelemetryLogMaxQueueSize}}function sa(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function fe(e,t){let n=e[t];return typeof n==="string"?n:void 0}function ai(e,t){let n=e[t];return typeof n==="boolean"?n:void 0}function ht(e,t){let n=e[t];return typeof n==="number"&&Number.isFinite(n)?n:void 0}function Yt(e,t){let n=e[t];if(!sa(n))return;let r=Object.entries(n).filter((i)=>typeof i[1]==="string");return r.length>0?Object.fromEntries(r):void 0}function om(e){if(!sa(e))return;let t={enabled:ai(e,"enabled"),metricsExporter:fe(e,"metricsExporter"),logsExporter:fe(e,"logsExporter"),otlpProtocol:fe(e,"otlpProtocol"),otlpEndpoint:fe(e,"otlpEndpoint"),otlpHeaders:Yt(e,"otlpHeaders"),otlpMetricsProtocol:fe(e,"otlpMetricsProtocol"),otlpMetricsEndpoint:fe(e,"otlpMetricsEndpoint"),otlpMetricsHeaders:Yt(e,"otlpMetricsHeaders"),otlpLogsProtocol:fe(e,"otlpLogsProtocol"),otlpLogsEndpoint:fe(e,"otlpLogsEndpoint"),otlpLogsHeaders:Yt(e,"otlpLogsHeaders"),metricExportInterval:ht(e,"metricExportInterval"),otlpInsecure:ai(e,"otlpInsecure"),logBatchSize:ht(e,"logBatchSize"),logBatchTimeout:ht(e,"logBatchTimeout"),logMaxQueueSize:ht(e,"logMaxQueueSize")};return Object.values(t).some((n)=>n!==void 0)?t:void 0}class la{name="remote-config";resolveTelemetry(e,t){return{...im(e.remoteConfig),...om(e.telemetry)}}}async function d6(e){let t=aa(e),n=e.artifactStore??new Bn;await n.removeChildren(t.workflowsPath),await n.removeChildren(t.skillsPath),await n.remove(t.rulesFilePath),await n.remove(t.manifestPath),await n.remove(t.bundleCachePath)}function ua(e){return e?.claims}function ca(e,t){if(!e)return[];if(t.claimsMapper)return t.claimsMapper.mapClaimsToRoles(e);return e.roles??[]}function am(e,t){return{...e,metadata:{...e.metadata??{},paths:t}}}class da{options;constructor(e){this.options=e}async sync(e){let t=await this.options.controlPlane.fetchBundle({workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:this.options.logger});if(!t)throw Error("Remote config control plane returned no bundle");await this.options.bundleStore.write(t);let n=await this.options.materializer.materialize({bundle:t,paths:e.paths,artifactStore:this.options.artifactStore}),r=this.options.telemetryAdapter?await this.options.telemetryAdapter.resolveTelemetry(t,{workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:this.options.logger}):void 0,i=ua(t),o=ca(i,this.options);return{bundle:t,materialized:n,telemetry:r,roles:o,claims:i}}}function sm(e){let t=e?.name??"remote-config";return{name:t,manifest:{capabilities:["providers"]},async setup(n,r){n.registerProvider?.({name:t,description:"Remote-config managed runtime integration"}),await e?.setup?.(n,r)}}}async function m6(e){let t=aa({workspacePath:e.workspacePath,pluginName:e.pluginName}),n=e.bundleStore??new Qo(t.bundleCachePath),r=e.artifactStore??new Bn,i=e.materializer??new oa,o=e.telemetryAdapter??new la,a,s,l=[],u,d=!1,p=!1;if(e.controlPlane){let m=new da({controlPlane:e.controlPlane,bundleStore:n,artifactStore:r,materializer:i,telemetryAdapter:o,claimsMapper:e.claimsMapper,logger:e.logger});try{let g=await m.sync({workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,paths:t,signal:e.signal,now:e.now});a=g.bundle,s=g.telemetry,l=g.roles,u=g.claims,p=!0}catch(g){if(e.useCachedBundle!==!1)a=await n.read(),d=Boolean(a);if(!a)throw g}}else if(e.useCachedBundle!==!1)a=await n.read(),d=Boolean(a);if(!a&&e.requireBundle)throw Error("Remote config runtime preparation requires a bundle");if(a){let m=am(a,t);if(await n.write(m),!p)await i.materialize({bundle:m,paths:t,artifactStore:r});u??=ua(m),l=l.length>0?l:ca(u,e),s??=await o.resolveTelemetry(m,{workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:e.logger}),a=m}let f=rm(t);return{pluginName:t.pluginName,pluginDefinition:sm({name:t.pluginName}),paths:t,bundle:a,telemetry:s,roles:l,claims:u,usedCachedBundle:d,workflowsDirectories:f.workflowsDirectories,skillsDirectories:f.skillsDirectories}}var ES=v({id:c(),temperature:_().optional(),maxTokens:_().optional(),contextWindow:_().optional(),inputPrice:_().optional(),outputPrice:_().optional(),supportsImages:A().optional()}),RS=v({models:I(ES).optional(),openAiBaseUrl:c().optional(),openAiHeaders:H(c(),c()).optional(),azureApiVersion:c().optional(),azureIdentity:A().optional()}),AS=v({id:c(),thinkingBudgetTokens:_().optional()}),OS=v({name:c(),baseModelId:c(),thinkingBudgetTokens:_().optional()}),CS=v({models:I(AS).optional(),customModels:I(OS).optional(),awsRegion:c().optional(),awsUseCrossRegionInference:A().optional(),awsUseGlobalInference:A().optional(),awsBedrockUsePromptCache:A().optional(),awsBedrockEndpoint:c().optional()}),PS=v({id:c()}),DS=v({models:I(PS).optional()}),MS=v({id:c(),thinkingBudgetTokens:_().optional()}),WS=v({models:I(MS).optional(),vertexProjectId:c().optional(),vertexRegion:c().optional()}),NS=v({id:c(),thinkingBudgetTokens:_().optional(),promptCachingEnabled:A().optional()}),LS=v({models:I(NS).optional(),baseUrl:c().optional()}),US=v({id:c(),thinkingBudgetTokens:_().optional()}),BS=v({models:I(US).optional(),baseUrl:c().optional()}),lm=v({OpenAiCompatible:RS.optional(),AwsBedrock:CS.optional(),Cline:DS.optional(),Vertex:WS.optional(),LiteLLM:LS.optional(),Anthropic:BS.optional()}),FS=v({id:c()}),jS=v({name:c(),url:c(),alwaysEnabled:A().optional(),headers:H(c(),c()).optional()}),bw=v({alwaysEnabled:A(),name:c(),contents:c()}),ny=v({bucket:c(),accessKeyId:c(),secretAccessKey:c(),region:c().optional(),endpoint:c().optional(),accountId:c().optional()}),$S=v({enabled:A().optional(),type:Ne([Z("s3_access_keys"),Z("r2_access_keys"),Z("azure_access_keys")]).optional(),s3AccessSettings:ny.optional(),r2AccessSettings:ny.optional(),azureAccessSettings:ny.optional()}),qS=v({promptUploading:$S.optional()}),h6=v({version:c(),providerSettings:lm.optional(),telemetryEnabled:A().optional(),kanbanEnabled:A().optional(),mcpMarketplaceEnabled:A().optional(),allowedMCPServers:I(FS).optional(),remoteMCPServers:I(jS).optional(),blockPersonalRemoteMCPServers:A().optional(),yoloModeAllowed:A().optional(),openTelemetryEnabled:A().optional(),openTelemetryMetricsExporter:c().optional(),openTelemetryLogsExporter:c().optional(),openTelemetryOtlpProtocol:c().optional(),openTelemetryOtlpEndpoint:c().optional(),openTelemetryOtlpHeaders:H(c(),c()).optional(),openTelemetryOtlpMetricsProtocol:c().optional(),openTelemetryOtlpMetricsEndpoint:c().optional(),openTelemetryOtlpMetricsHeaders:H(c(),c()).optional(),openTelemetryOtlpLogsProtocol:c().optional(),openTelemetryOtlpLogsEndpoint:c().optional(),openTelemetryOtlpLogsHeaders:H(c(),c()).optional(),openTelemetryMetricExportInterval:_().optional(),openTelemetryOtlpInsecure:A().optional(),openTelemetryLogBatchSize:_().optional(),openTelemetryLogBatchTimeout:_().optional(),openTelemetryLogMaxQueueSize:_().optional(),enterpriseTelemetry:qS.optional(),globalRules:I(bw).optional(),globalWorkflows:I(bw).optional()}),g6=H(c(),c()),f6=25463,y6=25466,x6=4317,b6="127.0.0.1:4317",v6=O(["reasoning","prompt-cache","tools","provider-tools","oauth","temperature","files","streaming","vision","computer-use","local-auth","popular"]),w6=O(["anthropic","gemini","openai-chat","openai-responses","openai-r1","ai-sdk"]),T6=O(["anthropic","ai-sdk","ai-sdk-community","openai","openai-compatible","openai-r1","gemini","bedrock","custom","fetch","vertex"]),_6="runtime.team.progress.v1",k6="runtime.team.lifecycle.v1",ay="CLINE_BUILD_ENV",zS="CLINE_DEBUG_HOST",GS="CLINE_DEBUG_PORT_BASE";function pa(e){let t=e?.trim().toLowerCase();if(t==="development"||t==="production")return t;return}function cm(e){for(let t=0;t<e.length;t+=1){let n=e[t]?.trim();if(!n)continue;if(n==="--conditions"&&e[t+1]?.trim()==="development")return!0;if(n.startsWith("--conditions=")&&n.slice(13).split(",").map((r)=>r.trim()).includes("development"))return!0}return!1}function dm(e){if(!e?.trim())return!1;let t=um(e).toLowerCase();return t==="node"||t==="node.exe"||t==="bun"||t==="bun.exe"}function pm(e){return e.some((t)=>t==="--inspect"||t.startsWith("--inspect=")||t==="--inspect-brk"||t.startsWith("--inspect-brk="))}function fm(e){return e.some((t)=>t==="--enable-source-maps")}function mm(e){return e[zS]?.trim()||"127.0.0.1"}function hm(e){let t=e[GS]?.trim();if(!t)return;let n=Number.parseInt(t,10);return Number.isInteger(n)&&n>0?n:void 0}function gm(e){switch(e){case"rpc":return 0;case"hook":return 1;case"plugin-sandbox":return 2;case"connector":return 3;case"sandbox":return 4;default:return 9}}function vw(e={}){let t=e.env??process.env,n=e.execArgv??process.execArgv,r=pa(t[ay]);if(r)return r;let i=t.NODE_ENV?.trim().toLowerCase();if(i==="production")return"production";if(i==="development")return"development";return cm(n)?"development":"production"}function I6(e=process.env,t={}){if(pa(e[ay]))return e;return{...e,[ay]:vw({env:e,execArgv:t.execArgv})}}function S6(e,t={}){if(e.length===0||!dm(e[0]))return[...e];if(vw(t)!=="development")return[...e];let n=t.env??process.env,r=[...n.NODE_OPTIONS?.split(/\s+/).filter(Boolean)??[],...e.slice(1)],i=[];if(!pm(r)){let o=mm(n),a=hm(n),s=a===void 0?0:a+gm(t.debugRole);i.push(`--inspect=${o}:${s}`)}if(!fm(r))i.push("--enable-source-maps");return[e[0],...i,...e.slice(1)]}function E6(e){let t=e?.trim();if(!t)return!1;if(t.startsWith("/$bunfs/"))return!0;return t.replace(/\\/g,"/").toLowerCase().startsWith("b:/~bun/")}function fa(){return globalThis}function R6(e){fa().__clineClientIdentity=e}function oy(){return fa().__clineClientIdentity}var A6="CLINE_ENVIRONMENT",O6="CLINE_ENVIRONMENT_OVERRIDE",ww={production:{environment:"production",appBaseUrl:"https://app.cline.bot",apiBaseUrl:"https://api.cline.bot",mcpBaseUrl:"https://api.cline.bot/v1/mcp",workOsClientId:"client_01K3A541FN8TA3EPPHTD2325AR"},staging:{environment:"staging",appBaseUrl:"https://staging-app.cline.bot",apiBaseUrl:"https://core-api.staging.int.cline.bot",mcpBaseUrl:"https://core-api.staging.int.cline.bot/v1/mcp",workOsClientId:"client_01K3A5415VF6QBQBG3XYCW91G6"},local:{environment:"local",appBaseUrl:"http://localhost:3000",apiBaseUrl:"http://localhost:7777",mcpBaseUrl:"http://localhost:7777/v1/mcp",workOsClientId:"client_01K6XQAY7JK6T5HXVSZW2S5VYK"}},C6="production";function si(e){let t=e?.trim().toLowerCase();if(t==="production"||t==="staging"||t==="local")return t;return}function ma(){if(typeof process>"u"||!process?.env)return{};return process.env}function VS(){let e=ma();return si(e.CLINE_ENVIRONMENT_OVERRIDE)??si(e.CLINE_ENVIRONMENT)??"production"}function ym(e){if(typeof e==="string")return ww[e];return ww[VS()]}function vm(e,t){if(t.CLINE_API_BASE_URL)e={...e,apiBaseUrl:t.CLINE_API_BASE_URL,mcpBaseUrl:`${t.CLINE_API_BASE_URL}/v1/mcp`};return e}function gc(e){let t=ym(e);return vm(t,ma())}function P6(e,t){if(!e||!t)return;try{let n=new URL(e,t);return n.origin===new URL(t).origin?n.href:void 0}catch{return}}var D6="CLINE_RUN_AS_HUB_DAEMON",M6="CLINE_CONNECTOR_CLI_LAUNCH",W6="CLINE_CONNECTOR_STARTING_INSTANCE",N6="CLINE_CONNECTOR_SUPERVISED",L6="CLINE_HUB_LAUNCHER_CLIENT",U6="CLINE_HUB_LAUNCHER_VERSION",B6="CLINE_HUB_LAUNCHER_TRANSPORT";function F6(e,t){if(e.CLINE_HUB_LAUNCHER_CLIENT?.trim())return e;let n=t?.client?.trim();if(!n)return e;let r=t?.version?.trim();return{...e,["CLINE_HUB_LAUNCHER_CLIENT"]:n,...r?{["CLINE_HUB_LAUNCHER_VERSION"]:r}:{},["CLINE_HUB_LAUNCHER_TRANSPORT"]:t?.transport??"local"}}function j6(e=process.env){let t=KS(e);return delete e.CLINE_HUB_LAUNCHER_CLIENT,delete e.CLINE_HUB_LAUNCHER_VERSION,delete e.CLINE_HUB_LAUNCHER_TRANSPORT,t}function KS(e=process.env){let t=e.CLINE_HUB_LAUNCHER_CLIENT?.trim();if(!t)return;let n=e.CLINE_HUB_LAUNCHER_VERSION?.trim(),r=e.CLINE_HUB_LAUNCHER_TRANSPORT?.trim();return{client:t,...n?{version:n}:{},...r==="ssh"||r==="local"?{transport:r}:{}}}var _n;function $6(e=process.env){return _n=e.CLINE_RUN_AS_HUB_DAEMON==="1",delete e.CLINE_RUN_AS_HUB_DAEMON,_n}function q6(e){if(e)return e.CLINE_RUN_AS_HUB_DAEMON==="1";return _n??process.env.CLINE_RUN_AS_HUB_DAEMON==="1"}function z6(e,t=process.env){t.CLINE_CONNECTOR_CLI_LAUNCH=JSON.stringify(e)}var bn;function G6(e=process.env){return bn=e.CLINE_CONNECTOR_SUPERVISED==="1",delete e.CLINE_CONNECTOR_SUPERVISED,bn}function V6(e){if(e)return e.CLINE_CONNECTOR_SUPERVISED==="1";return bn??process.env.CLINE_CONNECTOR_SUPERVISED==="1"}function K6(e,t=process.env){t.CLINE_CONNECTOR_STARTING_INSTANCE=JSON.stringify(e)}function H6(e=process.env){let t=e.CLINE_CONNECTOR_STARTING_INSTANCE;if(!t)return;try{let n=JSON.parse(t);if(typeof n.channel!=="string"||!n.channel.trim()||typeof n.instanceId!=="string"||!n.instanceId.trim())return;return{channel:n.channel,instanceId:n.instanceId}}catch{return}}function Q6(e=process.env){let t=e.CLINE_CONNECTOR_CLI_LAUNCH;if(!t)return;try{let n=JSON.parse(t);if(typeof n.launcher!=="string"||!n.launcher.trim()||!Array.isArray(n.connectArgsPrefix)||!n.connectArgsPrefix.every((r)=>typeof r==="string")||typeof n.cwd!=="string"||!n.cwd.trim())return;return{launcher:n.launcher,connectArgsPrefix:n.connectArgsPrefix,cwd:n.cwd}}catch{return}}var _m=["HTTP_PROXY","http_proxy","HTTPS_PROXY","https_proxy","ALL_PROXY","all_proxy"],HS=["localhost","127.0.0.1","::1","[::1]"];function bm(e){for(let t of _m){let n=e[t]?.trim();if(n)return n}return}function wn(e){return(e??"").split(",").map((t)=>t.trim()).filter((t)=>t.length>0)}function wm(e,t){let n=[],r=new Set;for(let i of[...wn(e),...wn(t),...HS]){let o=i.toLowerCase();if(o!=="*"&&!r.has(o))r.add(o),n.push(i)}return n.join(",")}function li(e){return wn(e).includes("*")}function Y6(e=process.env){if(!bm(e))return;let t=li(e.NO_PROXY),n=li(e.no_proxy);if(t&&n)return;let r=wm(e.NO_PROXY,e.no_proxy);if(!t)e.NO_PROXY=r;if(!n)e.no_proxy=r}var J6="NoDefaultCurrentDirectoryInExePath";function X6(e={}){let{env:t=process.env,platform:n=process.platform}=e;if(n!=="win32")return;t.NoDefaultCurrentDirectoryInExePath="1"}var Z6="agent.reasoning.unexpected_tokens",ry="task.provider_request_started",sy="task.provider_stream_started",cy="task.first_chunk_received",ly="task.provider_stream_failed",uy="task.cancelled",ml="task.max_tokens_recovery",eR=["initial","crash_restart","rollout_fallback","rollout_demotion","user_restart"],tR="sdk.error",Se=new Map;function iR(){Se.clear()}function Em(e,t){let n=typeof t.error_message==="string"?t.error_message:"";return[e,t.component,t.operation,t.error_type,t.error_code??"",t.error_status??"",n.replace(/\d+/g,"#").replace(/\s+/g," ").trim().toLowerCase().slice(0,256)].join("\x00")}function km(e){let t=Date.now(),n=Se.get(e);if(n&&t-n.startMs<3600000){if(n.emitted<5)return n.emitted+=1,{emit:!0,suppressed:0};return n.suppressed+=1,{emit:!1,suppressed:n.suppressed}}let r=n?.suppressed??0;if(Se.delete(e),Se.size>=512){let i=Se.keys().next();if(!i.done)Se.delete(i.value)}return Se.set(e,{startMs:t,emitted:1,suppressed:0}),{emit:!0,suppressed:r}}function py(e,t){e?.capture({event:"agent.reasoning.unexpected_tokens",properties:Zn({sessionId:t.sessionId,agentId:t.agentId,runId:t.runId,iteration:t.iteration,providerId:t.providerId,modelId:t.modelId,requestedThinking:t.requestedThinking,reasoningTokenCount:t.reasoningTokenCount})})}function dy(e,t){if(!e)return;e.capture({event:t.event,properties:Zn({sessionId:t.sessionId,modelRequestId:t.modelRequestId,ulid:t.ulid??t.sessionId,agentId:t.agentId,conversationId:t.conversationId,runId:t.runId,iteration:t.iteration,provider:t.providerId,providerId:t.providerId,model:t.modelId,modelId:t.modelId,phase:t.phase,durationMs:t.durationMs,eventType:t.eventType,...t.error===void 0?{}:Tw(t.error,t.messageLimit),error_class:t.errorClass})})}function hl(e,t){if(!e)return!1;let n=t.event??"sdk.error",r=QS(t),i=0;try{let o=km(Em(n,r));if(!o.emit)return!0;i=o.suppressed}catch{}return e.capture({event:n,properties:i>0?{...r,suppressed_count:i}:r}),!0}function QS(e){return Zn({...e.context??{},component:e.component,operation:e.operation,severity:e.severity??"error",handled:e.handled??!0,...Tw(e.error,e.messageLimit,e.errorMessage)})}function Zn(e){let t={};for(let[n,r]of Object.entries(e))if(r!==void 0)t[n]=r;return t}function Tw(e,t=500,n){let r=ui(e)?e:void 0,i=e instanceof Error?e:void 0,o=Ye(n)??Ye(i?.message)??Ye(r?.message)??Im(e)??"Unknown error",a=ci(r?.code),s=[],l=new Set([e]),u=r?.cause;while(ui(u)&&!l.has(u)&&s.length<8)l.add(u),s.push(u),u=u.cause;let d=s.map((f)=>ci(f.code)).find((f)=>f!==void 0),p=Xt(r?.status)??Xt(r?.statusCode)??Xt(r?.responseStatus);return{error_type:i?.name?.trim()||Ye(r?.name)||i?.constructor?.name||"Error",error_message:Sm(Tm(o),t),...a!==void 0?{error_code:a}:{},...d!==void 0?{error_cause_code:d}:{},...typeof r?.isRetryable==="boolean"?{error_retryable:r.isRetryable}:{},...p!==void 0?{error_status:p}:{}}}function Tm(e){return e.replace(/(authorization=Bearer\s+)[^&\s]+/gi,"$1[redacted]").replace(/(api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|password|secret)=([^&\s]+)/gi,"$1=[redacted]").replace(/(Bearer\s+)[A-Za-z0-9._~+/-]+=*/gi,"$1[redacted]").replace(/\/Users\/[^/\s]+/g,"/Users/[redacted]").replace(/\/home\/[^/\s]+/g,"/home/[redacted]").replace(/([A-Za-z]:[\\/]+Users[\\/]+)[^\\/\s]+/g,"$1[redacted]")}function Sm(e,t){let n=Math.max(1,Math.floor(t));return e.length>n?e.substring(0,n):e}function ui(e){return typeof e==="object"&&e!==null}function Ye(e){return typeof e==="string"&&e.trim().length>0?e:void 0}function Im(e){if(e instanceof Error)return;let t=typeof e==="string"?e:String(e);return t==="[object Object]"?void 0:Ye(t)}function ci(e){if(typeof e==="string"&&e.trim().length>0)return e;if(typeof e==="number"&&Number.isFinite(e))return e;return}function Xt(e){return typeof e==="number"&&Number.isFinite(e)?e:void 0}var _w="_clineOtlpTraceRelay";function nR(e){e[_w]=!0}function aR(e){return!!e&&typeof e==="object"&&e[_w]===!0}function Om(e){let t={};if(!e)return t;return e.split(",").forEach((n)=>{let r=n.indexOf("=");if(r<=0)return;try{let i=decodeURIComponent(n.substring(0,r).trim()),o=decodeURIComponent(n.substring(r+1).trim());if(!i||!o)return;t[i]=o}catch{}}),t}function Am(){if(!process.env)return{enabled:!1};return{enabled:process.env.OTEL_TELEMETRY_ENABLED==="1"||process.env.OTEL_TELEMETRY_ENABLED==="true",metricsExporter:process.env.OTEL_METRICS_EXPORTER||"otlp",logsExporter:process.env.OTEL_LOGS_EXPORTER||"otlp",tracesExporter:process.env.OTEL_TRACES_EXPORTER,otlpProtocol:process.env.OTEL_EXPORTER_OTLP_PROTOCOL||"http/json",otlpEndpoint:process.env.OTEL_EXPORTER_OTLP_ENDPOINT,metricExportInterval:process.env.OTEL_METRIC_EXPORT_INTERVAL?Number.parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL,10):void 0,otlpHeaders:process.env.OTEL_EXPORTER_OTLP_HEADERS?Om(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}}function YS(e={}){return{extension_version:"unknown",cline_type:"unknown",platform:"terminal",platform_version:process?.version||"unknown",os_type:process?.platform||"unknown",os_version:process?.platform==="win32"?process?.env?.OS??"unknown":"unknown",...e}}function oR(e={}){return{...Am(),...e,metadata:YS(e.metadata)}}var xm=new Set(["http:","https:"]);function Cm(e){if(!e)return"";try{let t=new URL(e);return xm.has(t.protocol)&&t.host?t.host:"invalid-endpoint-url"}catch{return"invalid-endpoint-url"}}function rR(e){return{telemetry_selfcheck:!0,enabled:e.enabled===!0,otlp_endpoint_host:Cm(e.otlpEndpoint),logs_exporter:e.logsExporter??"",metrics_exporter:e.metricsExporter??"",traces_exporter:e.tracesExporter??""}}function ha(e){let t=e?.trim();return t?t:void 0}function sR(e,t){if(!e)return;let n=typeof e==="function"?e(t):e;if(!n)return;let r=ha(n.rootSessionId);if(!r)return;return{rootSessionId:r}}function cR(e){return ha(e?.rootSessionId)}var Nm=128,he,Re;function Pm(e){if(e<0)throw RangeError("Wrong ID size");try{if(!he||he.length<e)he=Buffer.allocUnsafe(e*Nm),di.getRandomValues(he),Re=0;else if(Re+e>he.length)di.getRandomValues(he),Re=0}catch(t){throw he=void 0,t}Re+=e}function Rm(e){return Pm(e|=0),he.subarray(Re-e,Re)}function Lm(e,t,n){let r=256-256%e.length;if(r===256){let o=e.length-1;return(a=t)=>{if(!a)return"";let s="";while(!0){let l=n(a),u=a;while(u--)if(s+=e[l[u]&o],s.length>=a)return s}}}let i=Math.ceil(409.6*t/r);return(o=t)=>{if(!o)return"";let a="";while(!0){let s=n(i),l=i;while(l--)if(s[l]<r){if(a+=e[s[l]%e.length],a.length>=o)return a}}}}function Mm(e,t=21){return Lm(e,t,Rm)}function lR(e="",t=""){let n=Mm("1234567890abcdefghijklmnopqrstuvwxyz",10);return`${e}${Date.now()}_${n(5)}${t}`}var uR=["idle","running","pending","completed","failed","cancelled"],kw=["rules","skills","workflows","plugins","hooks"],JS=kw,Um=new Set(kw);function XS(e){return typeof e==="string"&&Um.has(e)}function pR(e){if(!Array.isArray(e))return;let t=e.map((n)=>typeof n==="string"?n.trim():"").filter(XS);return[...new Set(t)]}function dR(e,t){return new Set(e??JS).has(t)}var ZS=v({rootPath:c().min(1),hint:c().min(1).optional(),associatedRemoteUrls:I(c().min(1)).optional(),latestGitCommitHash:c().min(1).optional(),latestGitBranchName:c().min(1).optional()}),eE=v({currentWorkspacePath:c().min(1).optional(),workspaces:H(c().min(1),ZS)});function mR(){return{workspaces:{}}}function hR(e,t){let n={...e,workspaces:{...e.workspaces,[t.rootPath]:t}};if(!n.currentWorkspacePath)n.currentWorkspacePath=t.rootPath;return eE.parse(n)}var gR="workspaces",fR="chat";function yR(e){let t=e.trim(),n=/^[A-Za-z]:[\\/]/.test(t)||t.startsWith("\\\\"),r=t.startsWith("/");if(!n&&!r)return!1;let i=t.split(n?/[\\/]+/:/\/+/).filter(Boolean),o=i.at(-1)??"",a=i.at(-2)??"",s=i.at(-3)??"";return(i.at(-4)??"")===".cline"&&s==="data"&&a==="workspaces"&&o==="chat"}var tE=["current_state","boundary_analysis","interface_proposal"],xR=3600000,bR=240,vR=400,ne=Fo((e)=>e instanceof Date?e.toISOString():e,c().datetime()),ze=O(["pending","in_progress","blocked","completed"]),ga=O(["queued","running","completed","failed","cancelled","interrupted"]),Mt=O(["draft","in_review","finalized"]),Dm=v({agentId:c(),role:O(["lead","teammate"]),description:c().optional(),status:O(["idle","running","stopped"])}),wR=v({agentId:c(),rolePrompt:c(),modelId:c().optional(),maxIterations:_().optional()});function D(e){return Fo((t)=>t===null?void 0:t,e.optional())}var TR=v({agentId:c().min(1).describe("Teammate identifier"),rolePrompt:c().min(1).describe("System prompt describing teammate role")}).strict(),_R=v({agentId:c().min(1).describe("Teammate identifier"),reason:D(c().min(1)).describe("Optional shutdown reason")}),kR=v({}),Bm={create:["title","description"],list:[],claim:["taskId"],complete:["taskId","summary"],block:["taskId","reason"]},IR={create:["status","taskId","summary","reason"]},SR=v({action:O(["create","list","claim","complete","block"]),title:D(c().min(1)).describe("Task title"),description:D(c().min(1)).describe("Task details"),dependsOn:D(I(c().describe("Dependency task ID"))).describe("Array of dependency task IDs"),assignee:D(c().min(1)).describe("Optional assignee"),status:D(O(["pending","in_progress","blocked","completed"])).describe("Optional task status filter"),taskId:D(c()).describe("Task ID"),summary:D(c().min(1)).describe("Completion summary"),reason:D(c().min(1)).describe("Blocking reason")}).superRefine((e,t)=>{for(let n of Bm[e.action]){if(e[n]!==void 0)continue;t.addIssue({code:"custom",path:[n],message:`Field "${n}" is required when action=${e.action}`})}}),ER=v({agentId:c().describe("Teammate agent ID"),task:c().min(1).describe("Task instructions for the teammate"),taskId:D(c()).describe("Optional shared task list ID"),runMode:D(O(["sync","async"])).describe("Execution mode: 'sync' blocks until the teammate finishes and returns the result (default if omitted); 'async' queues the run and returns a runId immediately — use team_await_runs to collect results later."),continueConversation:D(A()).describe("If true, continue the teammate conversation; otherwise start fresh")}),RR=v({status:D(O(["queued","running","completed","failed","cancelled","interrupted"])).describe("Optional run status filter. Omit to include all statuses."),agentId:D(c().min(1)).describe("Optional teammate ID filter. Omit to include all teammates."),includeCompleted:D(A()).describe("Include completed/failed runs (default true)")}),AR=v({runId:c().min(1).describe("Run ID"),reason:D(c().min(1)).describe("Optional cancellation reason")}),OR=v({runId:D(c().min(1)).describe("Optional async run ID to await. Omit to wait for all active async runs.")}).strict(),CR=v({toAgentId:c().min(1).describe("Recipient agent ID"),subject:c().min(1).describe("Message subject"),body:c().min(1).describe("Message body"),taskId:D(c().min(1)).describe("Optional task ID context")}),PR=v({subject:c().min(1).describe("Message subject"),body:c().min(1).describe("Message body"),taskId:D(c().min(1)).describe("Optional task ID context")}),DR=v({unreadOnly:D(A()).describe("Only unread messages for read action (default true)")}),MR=v({kind:O(["progress","handoff","blocked","decision","done","error"]),summary:c().min(1).describe("Update summary"),taskId:D(c().min(1)).describe("Optional task ID context"),evidence:D(I(c().min(1))).describe("Optional evidence links/snippets"),nextAction:D(c().min(1)).describe("Planned next step")}),WR=v({}),NR=v({title:c().describe("Outcome title"),requiredSections:I(c()).default(tE).describe("Required sections for finalization gate (defaults to current_state,boundary_analysis,interface_proposal)")}),LR=v({outcomeId:c().describe("Outcome ID"),section:c().describe("Section name"),sourceRunId:D(c()).describe("Optional source run ID"),content:c().describe("Section fragment content")}),UR=v({fragmentId:c().describe("Fragment ID"),approved:A().describe("Review decision")}),BR=v({outcomeId:c().describe("Outcome ID")}),FR=v({}),jR=v({teamId:c(),teamName:c(),members:I(Dm),taskCounts:H(ze,_()),unreadMessages:_(),missionLogEntries:_(),activeRuns:_(),queuedRuns:_(),outcomeCounts:H(Mt,_())}),iE=v({id:c(),title:c(),description:c(),status:ze,createdAt:ne,updatedAt:ne,createdBy:c(),assignee:c().optional(),dependsOn:I(c()),summary:c().optional(),isReady:A(),blockedBy:I(c())}),$R=Un("action",[v({action:Z("create"),taskId:c(),status:ze,ignoredFields:I(c()).optional(),note:c().optional()}),v({action:Z("list"),tasks:I(iE)}),v({action:Z("claim"),taskId:c(),status:ze,nextStep:c()}),v({action:Z("complete"),taskId:c(),status:ze}),v({action:Z("block"),taskId:c(),status:ze})]),qR=v({agentId:c(),mode:O(["sync","async"]),status:O(["dispatched","running","queued","joined"]),dispatched:A(),message:c(),deduped:A().optional(),runId:c().optional(),text:c().optional(),iterations:_().optional()}),nE=v({textPreview:c(),iterations:_(),finishReason:c(),durationMs:_(),usage:v({inputTokens:_(),outputTokens:_(),cacheReadTokens:_().optional(),cacheWriteTokens:_().optional(),totalCost:_().optional()})}),zR=v({id:c(),agentId:c(),taskId:c().optional(),status:ga,messagePreview:c(),priority:_(),retryCount:_(),maxRetries:_(),nextAttemptAt:ne.optional(),continueConversation:A().optional(),startedAt:ne,endedAt:ne.optional(),leaseOwner:c().optional(),heartbeatAt:ne.optional(),lastProgressAt:ne.optional(),lastProgressMessage:c().optional(),currentActivity:c().optional(),error:c().optional(),resultSummary:nE.optional()}),GR=v({id:c(),teamId:c(),fromAgentId:c(),toAgentId:c(),subject:c(),body:c(),taskId:c().optional(),sentAt:ne,readAt:ne.optional()}),VR=v({id:c(),teamId:c(),title:c(),status:Mt,requiredSections:I(c()),createdBy:c(),createdAt:ne,finalizedAt:ne.optional()}),KR=v({outcomeId:c(),status:Mt,requiredSections:I(c())}),HR=v({agentId:c(),status:c()}),QR=v({runId:c(),status:ga}),YR=v({id:c(),toAgentId:c()}),JR=v({delivered:_()}),XR=v({id:c()}),ZR=v({status:c()}),e4=v({fragmentId:c(),status:c()}),t4=v({outcomeId:c(),status:Mt}),aE;((e)=>{e.TaskStart="task_start",e.TaskEnd="task_end",e.AgentEvent="agent_event",e.TeammateSpawned="teammate_spawned",e.TeammateShutdown="teammate_shutdown",e.TeamTaskUpdated="team_task_updated",e.TeamMessage="team_message",e.TeamMissionLog="team_mission_log",e.TeamTaskCompleted="team_task_completed",e.RunStarted="run_started",e.RunQueued="run_queued",e.RunProgress="run_progress",e.RunCompleted="run_completed",e.RunFailed="run_failed",e.RunCancelled="run_cancelled",e.RunInterrupted="run_interrupted",e.OutcomeCreated="outcome_created",e.OutcomeFragmentAttached="outcome_fragment_attached",e.OutcomeFragmentReviewed="outcome_fragment_reviewed",e.OutcomeFinalized="outcome_finalized"})(aE||={});function Zm(e){let{$schema:t,...n}=e;if(typeof n.type==="string")return n;if("properties"in n||"required"in n||"additionalProperties"in n)return{type:"object",...n};for(let r of["oneOf","anyOf","allOf"]){let i=n[r];if(!Array.isArray(i)||i.length===0)continue;if(r==="allOf"){if(i.some((o)=>o&&typeof o==="object"&&o.type==="object"))return{type:"object",...n};throw Error('Tool inputSchema must describe an object at the top level, but the schema has a top-level "allOf" with no branch that asserts type: "object". Add type: "object" to at least one allOf branch to make the object constraint explicit.')}if(i.every((o)=>o&&typeof o==="object"&&o.type==="object"))return{type:"object",...n};throw Error(`Tool inputSchema must describe an object at the top level, but the schema has a top-level "${r}" whose branches include non-object types. Pass the strict object schema as inputSchema and reserve union/coercion schemas for use inside execute().`)}return n}function i4(e){let t=Zm(e.inputSchema instanceof z?wS(e.inputSchema):e.inputSchema);return{name:e.name,resultPolicy:e.resultPolicy,description:e.description,inputSchema:t,lifecycle:e.lifecycle,successContext:e.successContext,executionMode:e.executionMode,timeoutMs:e.timeoutMs??30000,retryable:e.retryable??!0,maxRetries:e.maxRetries??3,execute:e.execute}}var oE=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function n4(e){let t=(e instanceof Error?e.message:String(e)).toLowerCase();return oE.some((n)=>t.includes(n))}var Ym=new Set(["accesskeyid","secretaccesskey","idtoken","refreshtoken","accesstoken","access_token","refresh_token","apikey","api_key","authorization","password","secret","token","email","displayname","display_name","userinfo"]),Xm=["id","balance","cost","secret"];function Qm(e){let t=e.toLowerCase();if(Ym.has(t))return!0;for(let n of Xm){if(t===n)return!0;if(t.endsWith(n)&&t.length>n.length){let r=t[t.length-n.length-1];if(r==="_"||r==="-")return!0;let i=e[e.length-n.length];if(i&&i===i.toUpperCase()&&i!==i.toLowerCase())return!0}if(t.endsWith(`_${n}`))return!0}return!1}var eh=[{pattern:/AKIA[A-Z0-9]{16}/g,replacement:"AKIA_REDACTED"},{pattern:/\/Users\/[A-Za-z0-9._-]+/g,replacement:"/Users/REDACTED_USER"},{pattern:/\/home\/[A-Za-z0-9._-]+/g,replacement:"/home/REDACTED_USER"}];function ya(e){let t=e;for(let{pattern:n,replacement:r}of eh)t=t.replace(n,r);return t}function En(e){if(Array.isArray(e))return e.map(En);if(!e||typeof e!=="object")return e;return Object.fromEntries(Object.entries(e).sort(([t],[n])=>th(t,n)).map(([t,n])=>[t,En(n)]))}function th(e,t){if(e<t)return-1;if(e>t)return 1;return 0}function pi(e){return JSON.stringify(En(e))}var nh=[{pattern:/tasks\/[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+\/api_conversation_history/g,replacement:"tasks/usr-test/taskid/api_conversation_history"},{pattern:/\/(org|usr|mbr|ses|gen|req|msg|tsk|sch|exe|srv|cli|wkr|evt|sub|tkn)-[A-Za-z0-9]{10,}(?=[/?#]|$)/g,replacement:"/$1-REDACTED"}];function kn(e){let t=e;for(let{pattern:n,replacement:r}of nh)t=t.replace(n,r);return t}function $e(e){if(e===null||e===void 0)return e;if(typeof e==="string"){try{let t=JSON.parse(e);if(typeof t==="object"&&t!==null)return JSON.stringify($e(t))}catch{}return ya(e)}if(Array.isArray(e))return e.map($e);if(typeof e==="object"){let t={};for(let[n,r]of Object.entries(e))if(Qm(n)&&(typeof r==="string"||typeof r==="number"))t[n]="REDACTED";else t[n]=$e(r);return t}return e}function rh(e){let t=new URLSearchParams(e),n=Array.from(t.entries());if(n.length===0||n.some(([i])=>i.length===0))return;let r={};for(let[i,o]of n){let a=r[i];if(a===void 0)r[i]=o;else if(Array.isArray(a))a.push(o);else r[i]=[a,o]}return r}function ih(e){return e?.toLowerCase().split(";")[0]?.trim()==="application/x-www-form-urlencoded"}function va(e,t){try{return pi($e(JSON.parse(e)))}catch{if(ih(t)){let n=rh(e);if(n)return pi($e(n))}return ya(e)}}function oh(e,t){let n={...e},r=t&&e.body!==void 0?va(e.body,e.requestContentType):void 0;if(delete n.body,delete n.requestContentType,r!==void 0)n.requestBody=r;if(typeof n.path==="string")n.path=kn(n.path);if(n.response!==void 0)n.response=$e(n.response);return n}function _a(e){try{let t=new URL(e),n=`${t.protocol}//${t.host}`,r=t.pathname+t.search;return{scope:n,path:r}}catch{return{scope:"",path:e}}}function ba(e){if(typeof e==="string")return e;if(e instanceof URL)return e.toString();if(e&&typeof e.url==="string")return e.url;return String(e)}function wa(e,t){if(t?.method)return t.method.toUpperCase();if(e&&typeof e.method==="string")return e.method.toUpperCase();return"GET"}function ah(e){if(!e)return;return new Headers(e).get("content-type")??void 0}function Ea(e,t){let n=ah(t?.headers);if(n)return n;if(t?.body instanceof URLSearchParams)return"application/x-www-form-urlencoded;charset=UTF-8";if(e instanceof Request)return e.headers.get("content-type")??void 0;return}async function ka(e,t){if(t?.body){if(typeof t.body==="string")return t.body;if(t.body instanceof URLSearchParams)return t.body.toString();if(t.body instanceof ArrayBuffer)return new TextDecoder().decode(t.body);if(ArrayBuffer.isView(t.body))return new TextDecoder().decode(new Uint8Array(t.body.buffer,t.body.byteOffset,t.body.byteLength));return}if(e instanceof Request)try{return await e.clone().text()}catch{return}return}function sh(e){if(!e)return null;if(!process.env.CLINE_VCR_CASSETTE)return process.stderr.write(`[VCR] No CLINE_VCR_CASSETTE: requests will not be recorded or played back.
179
+ `),null;if(e!=="record"&&e!=="playback")process.stderr.write(`[VCR] Invalid CLINE_VCR value: "${e}". Expected "record" or "playback".
180
+ `),process.exit(1);let t=Gm(process.env.CLINE_VCR_CASSETTE),n=process.env.CLINE_VCR_FILTER??"",r=process.env.CLINE_VCR_INCLUDE_REQUEST_BODY==="1"||process.env.CLINE_VCR_INCLUDE_REQUEST_BODY==="true";return{mode:e,cassettePath:t,filter:n,includeRequestBody:r}}function lh(e,t,n){let r=[],i=[],o=globalThis.fetch;function a(u){if(u.finalized)return;u.finalized=!0;let d=new TextDecoder,p=u.chunks.map((m)=>d.decode(m,{stream:!0})).join("")+d.decode(),f;try{f=JSON.parse(p)}catch{f=p}r.push({scope:u.scope,method:u.method,path:u.path,body:u.body,requestContentType:u.requestContentType,status:u.status,response:f,responseIsBinary:!1,contentType:u.contentType})}globalThis.fetch=Object.assign(async(u,d)=>{let p=ba(u),f=wa(u,d),{scope:m,path:g}=_a(p),y=await ka(u,d),T=Ea(u,d),b=await o(u,d);if(t&&!g.includes(t))return b;let U=b.headers.get("content-type")??void 0;if(!b.body)return r.push({scope:m,method:f,path:g,body:y??"",requestContentType:T,status:b.status,response:"",responseIsBinary:!1,contentType:U}),b;let C={scope:m,method:f,path:g,body:y??"",requestContentType:T,status:b.status,contentType:U,chunks:[],finalized:!1};i.push(C);let N=b.body,S=new TransformStream({transform(ce,Ee){C.chunks.push(ce),Ee.enqueue(ce)},flush(){a(C)}}),q=N.pipeThrough(S);return new Response(q,{status:b.status,statusText:b.statusText,headers:b.headers})},{preconnect:(u)=>{}});let s=t?`matching path "*${t}*"`:"all paths";process.stderr.write(`[VCR] Recording HTTP requests (${s}). Cassette will be saved to: ${e}
181
+ `);let l=!1;KI(()=>{if(l)return;l=!0,globalThis.fetch=o;for(let p of i)a(p);if(r.length===0){process.stderr.write(`[VCR] No HTTP requests${t?` matching "${t}"`:""} were recorded.
182
+ `);return}let u=Km(e);Vm(u,{recursive:!0});let d=r.map((p)=>oh(p,n));Wm(e,JSON.stringify(d,null,2)),process.stderr.write(`[VCR] Saved ${d.length} recorded HTTP interaction(s) to ${e}
183
+ `)})}function uh(e){let t=[],n=e.split(/\n\n/);for(let r of n){let i=r.trim();if(i)t.push(`${i}
184
+
185
+ `)}return t}function ch(e,t){let n=new TextEncoder,r=0;return new ReadableStream({async pull(i){if(r>=e.length){i.close();return}if(r>0&&t>0)await new Promise((a)=>setTimeout(a,t));let o=e[r];if(o===void 0){i.close();return}i.enqueue(n.encode(o)),r+=1}})}async function dh(e){if(e.recording.requestBody===void 0)return;let t=await ka(e.requestInput,e.requestInit),n=Ea(e.requestInput,e.requestInit),r=va(t??"",n);if(r!==e.recording.requestBody)throw Error(`[VCR] Request body mismatch for ${e.method} ${e.path}.
186
+ expected: ${e.recording.requestBody}
187
+ actual: ${r}
188
+ Re-record the cassette if the request change is intentional.`)}function ph(e,t){if(!Hm(e))process.stderr.write(`[VCR] Cassette file not found: ${e}
189
+ `),process.exit(1);let n=JSON.parse(Jm(e,"utf-8")),r=Number.parseInt(process.env.CLINE_VCR_SSE_DELAY??"100",10),i=Array(n.length).fill(!1),o=globalThis.fetch;globalThis.fetch=Object.assign(async(s,l)=>{let u=ba(s),d=wa(s,l),{path:p}=_a(u),f=kn(p);if(t&&!p.includes(t))return o(s,l);let m=n.findIndex((g,y)=>{if(i[y])return!1;let T=kn(g.path);return g.method.toUpperCase()===d&&T===f});if(m>=0){let g=n[m];if(!g)return o(s,l);await dh({recording:g,requestInput:s,requestInit:l,method:d,path:f}),i[m]=!0;let y=typeof g.response==="string"?g.response:JSON.stringify(g.response),T=new Headers;if(g.contentType)T.set("content-type",g.contentType);else if(typeof g.response==="string"&&g.response.trimStart().startsWith("data:"))T.set("content-type","text/event-stream");else if(typeof g.response==="object")T.set("content-type","application/json");let b=T.get("content-type")?.includes("text/event-stream")??!1;if(b)T.set("cache-control","no-cache"),T.set("connection","keep-alive");if(b&&typeof g.response==="string"){let U=uh(g.response);if(U.length>1){let C=ch(U,r);return new Response(C,{status:g.status,headers:T})}}return new Response(y,{status:g.status,headers:T})}if(!t)throw Error(`[VCR] No matching recording for ${d} ${u} (path: ${f}). ${n.length} recording(s) loaded from ${e}.`);return o(s,l)},{preconnect:(s)=>{}});let a=t?`(only paths matching "*${t}*", all other requests go through normally)`:"(all requests intercepted)";process.stderr.write(`[VCR] Playing back ${n.length} recorded HTTP interaction(s) from ${e} ${a}
190
+ `)}function a4(e){let t=sh(e);if(!t)return;if(t.mode==="record")lh(t.cassettePath,t.filter,t.includeRequestBody);else ph(t.cassettePath,t.filter)}export{ip,II,np,SI,EI,jE,RI,AI,OI,CI,PI,cw,DI,MI,WI,ap,zf,NI,Cs,pl,lw,Gf,$E,uw,qE,Vf,LI,UI,BI,zE,GE,FI,jI,$I,VE,KE,HE,qI,zI,GI,QE,YE,JE,VI,KI,XE,HI,pw,ZE,e5,dl,t5,i5,QI,YI,n5,a5,o5,r5,s5,c5,l5,u5,p5,dw,JI,d5,XI,m5,ZI,h5,eS,g5,f5,y5,x5,b5,v5,w5,T5,_5,tS,k5,I5,S5,E5,R5,iS,nS,aS,mw,oS,rS,A5,O5,sS,Ps,Fm,cS,lS,jm,C5,Kf,hw,gw,gi,en,uS,P5,fw,D5,pS,yw,Ds,Ms,dS,Hf,$m,op,Pr,Ai,qm,mS,Qf,Yf,rp,M5,W5,zm,N5,L5,hS,sp,U5,B5,Dr,gS,fS,Jf,F5,j5,$5,q5,yS,xS,z5,G5,V5,K5,Xf,Zf,cp,lp,ey,ty,H5,Q5,xw,up,bS,Y5,J5,fi,vS,X5,Z5,e6,t6,i6,n6,wS,ta,TS,_S,kS,a6,o6,r6,iy,pp,IS,s6,c6,l6,SS,u6,p6,d6,m6,ES,RS,AS,OS,CS,PS,DS,MS,WS,NS,LS,US,BS,FS,jS,bw,ny,$S,qS,h6,g6,f6,y6,x6,b6,v6,w6,T6,_6,k6,ay,zS,GS,vw,I6,S6,E6,R6,oy,A6,O6,ww,C6,VS,gc,P6,D6,M6,W6,N6,L6,U6,B6,F6,j6,KS,$6,q6,z6,G6,V6,K6,H6,Q6,HS,Y6,J6,X6,Z6,ry,sy,cy,ly,uy,ml,eR,tR,iR,py,dy,hl,QS,Tw,_w,nR,aR,YS,oR,rR,sR,cR,lR,uR,kw,JS,XS,pR,dR,ZS,eE,mR,hR,gR,fR,yR,tE,xR,bR,vR,wR,TR,_R,kR,IR,SR,ER,RR,AR,OR,CR,PR,DR,MR,WR,NR,LR,UR,BR,FR,jR,iE,$R,qR,nE,zR,GR,VR,KR,HR,QR,YR,JR,XR,ZR,e4,t4,aE,i4,oE,n4,a4};