local-operator-ui 0.36.9 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/out/main/index.js +1728 -9
  2. package/out/preload/index.js +32 -1
  3. package/out/renderer/assets/{_basePickBy-DMcJ3S7k.js → _basePickBy-Ccz_FVoP.js} +1 -1
  4. package/out/renderer/assets/{_baseUniq-D1lM95PP.js → _baseUniq-i6vGpLRc.js} +1 -1
  5. package/out/renderer/assets/{agent-details-page-BtlkMdIG.js → agent-details-page-Vg5HG_l0.js} +2 -2
  6. package/out/renderer/assets/{agent-hub-page-CvnosPnb.js → agent-hub-page-K4pCiyVg.js} +1 -1
  7. package/out/renderer/assets/{agents-page-C3p0casO.js → agents-page-DO-dA64a.js} +3 -3
  8. package/out/renderer/assets/{arc-DsWPhFjP.js → arc-B4AUWIOq.js} +1 -1
  9. package/out/renderer/assets/{architectureDiagram-IEHRJDOE-DNfaqYw7.js → architectureDiagram-IEHRJDOE-B6S5IVGr.js} +1 -1
  10. package/out/renderer/assets/{arrow-up-Begz0H6P.js → arrow-up-BQ3q9CbG.js} +1 -1
  11. package/out/renderer/assets/{blockDiagram-JOT3LUYC-BJENelAS.js → blockDiagram-JOT3LUYC-LpW3K6pq.js} +1 -1
  12. package/out/renderer/assets/{book-open-5BRzSc1Z.js → book-open-1KhbTE6j.js} +1 -1
  13. package/out/renderer/assets/browser-page-C2PcMomi.js +1 -0
  14. package/out/renderer/assets/{browser-webauthn-prompt-yiiGM34k.js → browser-webauthn-prompt-DW_0ckOh.js} +1 -1
  15. package/out/renderer/assets/{building-2-T3OwRXqF.js → building-2-B-r5qz8T.js} +1 -1
  16. package/out/renderer/assets/{c4Diagram-VJAJSXHY-CEijvBuX.js → c4Diagram-VJAJSXHY-CAqRIAIW.js} +1 -1
  17. package/out/renderer/assets/channel-C3p9uq-y.js +1 -0
  18. package/out/renderer/assets/{chunk-4BMEZGHF-CtdEc_y-.js → chunk-4BMEZGHF-xA1Nsxex.js} +1 -1
  19. package/out/renderer/assets/{chunk-A2AXSNBT-DzhnEf46.js → chunk-A2AXSNBT-CUDzamID.js} +1 -1
  20. package/out/renderer/assets/{chunk-AEK57VVT-BNPXglh5.js → chunk-AEK57VVT-DlMRhXPR.js} +1 -1
  21. package/out/renderer/assets/{chunk-D6G4REZN-xyBvlSTD.js → chunk-D6G4REZN-VcBIri9Q.js} +1 -1
  22. package/out/renderer/assets/{chunk-RZ5BOZE2-8dmoMKQZ.js → chunk-RZ5BOZE2-CCsj9xK4.js} +1 -1
  23. package/out/renderer/assets/{chunk-XZIHB7SX-DLfyXOIE.js → chunk-XZIHB7SX-CKTgVOcT.js} +1 -1
  24. package/out/renderer/assets/classDiagram-GIVACNV2-E64bGPOA.js +1 -0
  25. package/out/renderer/assets/classDiagram-v2-COTLJTTW-E64bGPOA.js +1 -0
  26. package/out/renderer/assets/clone-Cp6fbpqM.js +1 -0
  27. package/out/renderer/assets/{console-mirror-Ddv0LHdM.js → console-mirror-rnDJat8Q.js} +1 -1
  28. package/out/renderer/assets/{consoleCapture-Cm0PxzNK.js → consoleCapture-BDAHhWI6.js} +1 -1
  29. package/out/renderer/assets/{conversation-input-sync-i6ilfEnc.js → conversation-input-sync-DkdrIqiD.js} +277 -277
  30. package/out/renderer/assets/{dagre-OKDRZEBW-Dob_U_wx.js → dagre-OKDRZEBW-BLJ3cLu1.js} +1 -1
  31. package/out/renderer/assets/{diagram-SSKATNLV-Dh8_PC2b.js → diagram-SSKATNLV-BH0p-5Dv.js} +1 -1
  32. package/out/renderer/assets/{diagram-VNBRO52H-NZ9qo5oG.js → diagram-VNBRO52H-B82m2-a7.js} +1 -1
  33. package/out/renderer/assets/{erDiagram-Q7BY3M3F-BOUqITNj.js → erDiagram-Q7BY3M3F-B49jRhsr.js} +1 -1
  34. package/out/renderer/assets/{error-boundary-LwhkYl0Z.js → error-boundary-2fpGTHTH.js} +2 -2
  35. package/out/renderer/assets/{flowDiagram-4HSFHLVR-CZiUXOWe.js → flowDiagram-4HSFHLVR-OEuTrGbc.js} +1 -1
  36. package/out/renderer/assets/{ganttDiagram-APWFNJXF-DqweVTOi.js → ganttDiagram-APWFNJXF-WrHus6zK.js} +1 -1
  37. package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-KbIhBWBs.js → gitGraphDiagram-7IBYFJ6S-sdpNtvIC.js} +1 -1
  38. package/out/renderer/assets/{graph-O8aHYPDC.js → graph-CPx4Z3cH.js} +1 -1
  39. package/out/renderer/assets/{hash-WYoE1Khd.js → hash-MswM3CQT.js} +1 -1
  40. package/out/renderer/assets/index-Bt4e_nGt.js +57 -0
  41. package/out/renderer/assets/index-CXF8GwAZ.js +825 -0
  42. package/out/renderer/assets/index-Ct_f1nHS.css +1 -0
  43. package/out/renderer/assets/{index-D4j9Ycfd.js → index-D0ZcaKHz.js} +1 -1
  44. package/out/renderer/assets/{index-D8fns19J.js → index-bD-9hTJ5.js} +1 -1
  45. package/out/renderer/assets/{infoDiagram-PH2N3AL5-DU0dbmt7.js → infoDiagram-PH2N3AL5-CgbaZe5Z.js} +1 -1
  46. package/out/renderer/assets/{installer-C-rmt1Yr.js → installer-GzNnUma-.js} +1 -1
  47. package/out/renderer/assets/{journeyDiagram-U35MCT3I-DUybkPWl.js → journeyDiagram-U35MCT3I-CIWLEQby.js} +1 -1
  48. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-onKwvi0l.js → kanban-definition-NDS4AKOZ-ORj0JKQO.js} +1 -1
  49. package/out/renderer/assets/{layout-RKbPA5d2.js → layout-5wBU4YOj.js} +1 -1
  50. package/out/renderer/assets/legacy-agents-page-ou1Xp1az.js +33 -0
  51. package/out/renderer/assets/library-page-BloF_iPE.js +157 -0
  52. package/out/renderer/assets/{mermaid.core-DdYe4AYl.js → mermaid.core-bCTq7TEV.js} +5 -5
  53. package/out/renderer/assets/{mesh-page-CW4tQHZJ.js → mesh-page-IaVtAjU1.js} +1 -1
  54. package/out/renderer/assets/{mindmap-definition-ALO5MXBD-DrsGVqDZ.js → mindmap-definition-ALO5MXBD-Ddhl_xII.js} +1 -1
  55. package/out/renderer/assets/{mini-CHtVBEDV.js → mini-CwNeJTk5.js} +1 -1
  56. package/out/renderer/assets/{notebook-pen-BHmA9Aor.js → notebook-pen-BY9EwH-7.js} +1 -1
  57. package/out/renderer/assets/{org-access-Bqdb8uRz.js → org-access-c2-UvVYd.js} +1 -1
  58. package/out/renderer/assets/{org-surface-gate-UD-oXlvB.js → org-surface-gate-B-MS3UYv.js} +1 -1
  59. package/out/renderer/assets/{page-header-CoSSp6Ks.js → page-header-CD8VERYn.js} +1 -1
  60. package/out/renderer/assets/{pieDiagram-IB7DONF6-C0gYyuJA.js → pieDiagram-IB7DONF6-STqRBD1R.js} +1 -1
  61. package/out/renderer/assets/{projects-page-DU4wZXNY.js → projects-page-EY7aplWJ.js} +2 -2
  62. package/out/renderer/assets/{publication-validation-D4Bef-1h.js → publication-validation-cVu_vGjF.js} +1 -1
  63. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-DbEt_1Ti.js → quadrantDiagram-7GDLP6J5-D93w-jxI.js} +1 -1
  64. package/out/renderer/assets/{radar-MK3ICKWK-BCsS7AKJ.js → radar-MK3ICKWK-Dh3CwqLm.js} +1 -1
  65. package/out/renderer/assets/{radient-auth-buttons-vBcfzZdx.js → radient-auth-buttons-BuUoxJkL.js} +1 -1
  66. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-C3WoUU_2.js → requirementDiagram-KVF5MWMF-pKCmrqyl.js} +1 -1
  67. package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-vE9T4I2u.js → sankeyDiagram-QLVOVGJD-Dv2syjv2.js} +1 -1
  68. package/out/renderer/assets/{schedules-page-CGCopxbo.js → schedules-page-DJ7BtTi7.js} +1 -1
  69. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-CqwLiiP3.js → sequenceDiagram-X6HHIX6F-D14uGazi.js} +1 -1
  70. package/out/renderer/assets/{settings-page-DrZcB4mR.js → settings-page-BPkUfxJX.js} +7 -7
  71. package/out/renderer/assets/smartart-uE0Bdv7c.js +1 -0
  72. package/out/renderer/assets/{stateDiagram-DGXRK772-W9r7i0O7.js → stateDiagram-DGXRK772-CTKP8UrZ.js} +1 -1
  73. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-C1y1no_O.js +1 -0
  74. package/out/renderer/assets/team-bridge-page-ClnOkizZ.js +11 -0
  75. package/out/renderer/assets/{timeline-definition-BDJGKUSR-QYcBKPg2.js → timeline-definition-BDJGKUSR-bs2AK5mP.js} +1 -1
  76. package/out/renderer/assets/ui-preferences-store-B5lixHt9.js +1 -0
  77. package/out/renderer/assets/{use-download-agent-mutation-CNw_prc9.js → use-download-agent-mutation-B3IkEPEZ.js} +3 -3
  78. package/out/renderer/assets/{use-session-snapshot-CzQdg29b.js → use-session-snapshot-BKx6oLGB.js} +1 -1
  79. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-B37S1SAD.js → xychartDiagram-VJFVF3MP-B8vPLffn.js} +1 -1
  80. package/out/renderer/console-capture.html +5 -5
  81. package/out/renderer/index.html +7 -7
  82. package/out/renderer/installer.html +4 -4
  83. package/out/renderer/mini.html +7 -7
  84. package/package.json +3 -2
  85. package/out/renderer/assets/browser-page-Dwy1BXTz.js +0 -1
  86. package/out/renderer/assets/channel-BuIK1RR0.js +0 -1
  87. package/out/renderer/assets/classDiagram-GIVACNV2-CcLuC1It.js +0 -1
  88. package/out/renderer/assets/classDiagram-v2-COTLJTTW-CcLuC1It.js +0 -1
  89. package/out/renderer/assets/clone-C-B3TV1U.js +0 -1
  90. package/out/renderer/assets/index-6crVx9hx.js +0 -57
  91. package/out/renderer/assets/index-O8V3Lal4.css +0 -1
  92. package/out/renderer/assets/index-Re5k_KqO.js +0 -824
  93. package/out/renderer/assets/legacy-agents-page-DmUlGbZ_.js +0 -33
  94. package/out/renderer/assets/library-page-CsUF7SOa.js +0 -157
  95. package/out/renderer/assets/smartart-C6SIDcio.js +0 -1
  96. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-cX4iVUJF.js +0 -1
  97. package/out/renderer/assets/tags-input-chips-CqW7e8j3.js +0 -1
  98. package/out/renderer/assets/team-bridge-page-Dt4lEU3y.js +0 -11
  99. package/out/renderer/assets/ui-preferences-store-BWYRkg79.js +0 -1
@@ -1 +0,0 @@
1
- import{b as Lt,D as ds}from"./index-6crVx9hx.js";var I;(function(e){e.assertEqual=a=>a;function t(a){}e.assertIs=t;function s(a){throw new Error}e.assertNever=s,e.arrayToEnum=a=>{const o={};for(const r of a)o[r]=r;return o},e.getValidEnumValues=a=>{const o=e.objectKeys(a).filter(c=>typeof a[a[c]]!="number"),r={};for(const c of o)r[c]=a[c];return e.objectValues(r)},e.objectValues=a=>e.objectKeys(a).map(function(o){return a[o]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const o=[];for(const r in a)Object.prototype.hasOwnProperty.call(a,r)&&o.push(r);return o},e.find=(a,o)=>{for(const r of a)if(o(r))return r},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function i(a,o=" | "){return a.map(r=>typeof r=="string"?`'${r}'`:r).join(o)}e.joinValues=i,e.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(I||(I={}));var vt;(function(e){e.mergeShapes=(t,s)=>({...t,...s})})(vt||(vt={}));const f=I.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),G=e=>{switch(typeof e){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(e)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(e)?f.array:e===null?f.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?f.promise:typeof Map<"u"&&e instanceof Map?f.map:typeof Set<"u"&&e instanceof Set?f.set:typeof Date<"u"&&e instanceof Date?f.date:f.object;default:return f.unknown}},p=I.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),ps=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class A extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=t}format(t){const s=t||function(o){return o.message},i={_errors:[]},a=o=>{for(const r of o.issues)if(r.code==="invalid_union")r.unionErrors.map(a);else if(r.code==="invalid_return_type")a(r.returnTypeError);else if(r.code==="invalid_arguments")a(r.argumentsError);else if(r.path.length===0)i._errors.push(s(r));else{let c=i,d=0;for(;d<r.path.length;){const l=r.path[d];d===r.path.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(s(r))):c[l]=c[l]||{_errors:[]},c=c[l],d++}}};return a(this),i}static assert(t){if(!(t instanceof A))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,I.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=s=>s.message){const s={},i=[];for(const a of this.issues)a.path.length>0?(s[a.path[0]]=s[a.path[0]]||[],s[a.path[0]].push(t(a))):i.push(t(a));return{formErrors:i,fieldErrors:s}}get formErrors(){return this.flatten()}}A.create=e=>new A(e);const ce=(e,t)=>{let s;switch(e.code){case p.invalid_type:e.received===f.undefined?s="Required":s=`Expected ${e.expected}, received ${e.received}`;break;case p.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(e.expected,I.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:s=`Unrecognized key(s) in object: ${I.joinValues(e.keys,", ")}`;break;case p.invalid_union:s="Invalid input";break;case p.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${I.joinValues(e.options)}`;break;case p.invalid_enum_value:s=`Invalid enum value. Expected ${I.joinValues(e.options)}, received '${e.received}'`;break;case p.invalid_arguments:s="Invalid function arguments";break;case p.invalid_return_type:s="Invalid function return type";break;case p.invalid_date:s="Invalid date";break;case p.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(s=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?s=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?s=`Invalid input: must end with "${e.validation.endsWith}"`:I.assertNever(e.validation):e.validation!=="regex"?s=`Invalid ${e.validation}`:s="Invalid";break;case p.too_small:e.type==="array"?s=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?s=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?s=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?s=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:s="Invalid input";break;case p.too_big:e.type==="array"?s=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?s=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?s=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?s=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?s=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:s="Invalid input";break;case p.custom:s="Invalid input";break;case p.invalid_intersection_types:s="Intersection results could not be merged";break;case p.not_multiple_of:s=`Number must be a multiple of ${e.multipleOf}`;break;case p.not_finite:s="Number must be finite";break;default:s=t.defaultError,I.assertNever(e)}return{message:s}};let Pn=ce;function us(e){Pn=e}function We(){return Pn}const Ke=e=>{const{data:t,path:s,errorMaps:i,issueData:a}=e,o=[...s,...a.path||[]],r={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let c="";const d=i.filter(l=>!!l).slice().reverse();for(const l of d)c=l(r,{data:t,defaultError:c}).message;return{...a,path:o,message:c}},ms=[];function h(e,t){const s=We(),i=Ke({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,s,s===ce?void 0:ce].filter(a=>!!a)});e.common.issues.push(i)}class P{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,s){const i=[];for(const a of s){if(a.status==="aborted")return _;a.status==="dirty"&&t.dirty(),i.push(a.value)}return{status:t.value,value:i}}static async mergeObjectAsync(t,s){const i=[];for(const a of s){const o=await a.key,r=await a.value;i.push({key:o,value:r})}return P.mergeObjectSync(t,i)}static mergeObjectSync(t,s){const i={};for(const a of s){const{key:o,value:r}=a;if(o.status==="aborted"||r.status==="aborted")return _;o.status==="dirty"&&t.dirty(),r.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof r.value<"u"||a.alwaysSet)&&(i[o.value]=r.value)}return{status:t.value,value:i}}}const _=Object.freeze({status:"aborted"}),ae=e=>({status:"dirty",value:e}),C=e=>({status:"valid",value:e}),_t=e=>e.status==="aborted",yt=e=>e.status==="dirty",q=e=>e.status==="valid",ye=e=>typeof Promise<"u"&&e instanceof Promise;function Ye(e,t,s,i){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function On(e,t,s,i,a){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,s),s}var g;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(g||(g={}));var be,ve;class L{constructor(t,s,i,a){this._cachedPath=[],this.parent=t,this.data=s,this._path=i,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ut=(e,t)=>{if(q(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const s=new A(e.common.issues);return this._error=s,this._error}}};function k(e){if(!e)return{};const{errorMap:t,invalid_type_error:s,required_error:i,description:a}=e;if(t&&(s||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(r,c)=>{var d,l;const{message:m}=e;return r.code==="invalid_enum_value"?{message:m??c.defaultError}:typeof c.data>"u"?{message:(d=m??i)!==null&&d!==void 0?d:c.defaultError}:r.code!=="invalid_type"?{message:c.defaultError}:{message:(l=m??s)!==null&&l!==void 0?l:c.defaultError}},description:a}}class S{get description(){return this._def.description}_getType(t){return G(t.data)}_getOrReturnCtx(t,s){return s||{common:t.parent.common,data:t.data,parsedType:G(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new P,ctx:{common:t.parent.common,data:t.data,parsedType:G(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const s=this._parse(t);if(ye(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(t){const s=this._parse(t);return Promise.resolve(s)}parse(t,s){const i=this.safeParse(t,s);if(i.success)return i.data;throw i.error}safeParse(t,s){var i;const a={common:{issues:[],async:(i=s?.async)!==null&&i!==void 0?i:!1,contextualErrorMap:s?.errorMap},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:G(t)},o=this._parseSync({data:t,path:a.path,parent:a});return Ut(a,o)}"~validate"(t){var s,i;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:G(t)};if(!this["~standard"].async)try{const o=this._parseSync({data:t,path:[],parent:a});return q(o)?{value:o.value}:{issues:a.common.issues}}catch(o){!((i=(s=o?.message)===null||s===void 0?void 0:s.toLowerCase())===null||i===void 0)&&i.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:a}).then(o=>q(o)?{value:o.value}:{issues:a.common.issues})}async parseAsync(t,s){const i=await this.safeParseAsync(t,s);if(i.success)return i.data;throw i.error}async safeParseAsync(t,s){const i={common:{issues:[],contextualErrorMap:s?.errorMap,async:!0},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:G(t)},a=this._parse({data:t,path:i.path,parent:i}),o=await(ye(a)?a:Promise.resolve(a));return Ut(i,o)}refine(t,s){const i=a=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(a):s;return this._refinement((a,o)=>{const r=t(a),c=()=>o.addIssue({code:p.custom,...i(a)});return typeof Promise<"u"&&r instanceof Promise?r.then(d=>d?!0:(c(),!1)):r?!0:(c(),!1)})}refinement(t,s){return this._refinement((i,a)=>t(i)?!0:(a.addIssue(typeof s=="function"?s(i,a):s),!1))}_refinement(t){return new M({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:s=>this["~validate"](s)}}optional(){return D.create(this,this._def)}nullable(){return Y.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return N.create(this)}promise(){return de.create(this,this._def)}or(t){return Ie.create([this,t],this._def)}and(t){return xe.create(this,t,this._def)}transform(t){return new M({...k(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const s=typeof t=="function"?t:()=>t;return new Oe({...k(this._def),innerType:this,defaultValue:s,typeName:v.ZodDefault})}brand(){return new Ot({typeName:v.ZodBranded,type:this,...k(this._def)})}catch(t){const s=typeof t=="function"?t:()=>t;return new Ce({...k(this._def),innerType:this,catchValue:s,typeName:v.ZodCatch})}describe(t){const s=this.constructor;return new s({...this._def,description:t})}pipe(t){return $e.create(this,t)}readonly(){return je.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const hs=/^c[^\s-]{8,}$/i,fs=/^[0-9a-z]+$/,gs=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bs=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,vs=/^[a-z0-9_-]{21}$/i,_s=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ys=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ks=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ss="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let rt;const ws=/^(?:(?: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])$/,Is=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,xs=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ts=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Es=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Rs=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Cn="((\\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])))",Ps=new RegExp(`^${Cn}$`);function jn(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function Os(e){return new RegExp(`^${jn(e)}$`)}function An(e){let t=`${Cn}T${jn(e)}`;const s=[];return s.push(e.local?"Z?":"Z"),e.offset&&s.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${s.join("|")})`,new RegExp(`^${t}$`)}function Cs(e,t){return!!((t==="v4"||!t)&&ws.test(e)||(t==="v6"||!t)&&xs.test(e))}function js(e,t){if(!_s.test(e))return!1;try{const[s]=e.split("."),i=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),a=JSON.parse(atob(i));return!(typeof a!="object"||a===null||!a.typ||!a.alg||t&&a.alg!==t)}catch{return!1}}function As(e,t){return!!((t==="v4"||!t)&&Is.test(e)||(t==="v6"||!t)&&Ts.test(e))}class $ extends S{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==f.string){const o=this._getOrReturnCtx(t);return h(o,{code:p.invalid_type,expected:f.string,received:o.parsedType}),_}const i=new P;let a;for(const o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(a=this._getOrReturnCtx(t,a),h(a,{code:p.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="max")t.data.length>o.value&&(a=this._getOrReturnCtx(t,a),h(a,{code:p.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="length"){const r=t.data.length>o.value,c=t.data.length<o.value;(r||c)&&(a=this._getOrReturnCtx(t,a),r?h(a,{code:p.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):c&&h(a,{code:p.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),i.dirty())}else if(o.kind==="email")ks.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"email",code:p.invalid_string,message:o.message}),i.dirty());else if(o.kind==="emoji")rt||(rt=new RegExp(Ss,"u")),rt.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"emoji",code:p.invalid_string,message:o.message}),i.dirty());else if(o.kind==="uuid")bs.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"uuid",code:p.invalid_string,message:o.message}),i.dirty());else if(o.kind==="nanoid")vs.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"nanoid",code:p.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid")hs.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"cuid",code:p.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid2")fs.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"cuid2",code:p.invalid_string,message:o.message}),i.dirty());else if(o.kind==="ulid")gs.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"ulid",code:p.invalid_string,message:o.message}),i.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{a=this._getOrReturnCtx(t,a),h(a,{validation:"url",code:p.invalid_string,message:o.message}),i.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"regex",code:p.invalid_string,message:o.message}),i.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(a=this._getOrReturnCtx(t,a),h(a,{code:p.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),i.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(a=this._getOrReturnCtx(t,a),h(a,{code:p.invalid_string,validation:{startsWith:o.value},message:o.message}),i.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(a=this._getOrReturnCtx(t,a),h(a,{code:p.invalid_string,validation:{endsWith:o.value},message:o.message}),i.dirty()):o.kind==="datetime"?An(o).test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{code:p.invalid_string,validation:"datetime",message:o.message}),i.dirty()):o.kind==="date"?Ps.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{code:p.invalid_string,validation:"date",message:o.message}),i.dirty()):o.kind==="time"?Os(o).test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{code:p.invalid_string,validation:"time",message:o.message}),i.dirty()):o.kind==="duration"?ys.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"duration",code:p.invalid_string,message:o.message}),i.dirty()):o.kind==="ip"?Cs(t.data,o.version)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"ip",code:p.invalid_string,message:o.message}),i.dirty()):o.kind==="jwt"?js(t.data,o.alg)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"jwt",code:p.invalid_string,message:o.message}),i.dirty()):o.kind==="cidr"?As(t.data,o.version)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"cidr",code:p.invalid_string,message:o.message}),i.dirty()):o.kind==="base64"?Es.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"base64",code:p.invalid_string,message:o.message}),i.dirty()):o.kind==="base64url"?Rs.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"base64url",code:p.invalid_string,message:o.message}),i.dirty()):I.assertNever(o);return{status:i.value,value:t.data}}_regex(t,s,i){return this.refinement(a=>t.test(a),{validation:s,code:p.invalid_string,...g.errToObj(i)})}_addCheck(t){return new $({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...g.errToObj(t)})}url(t){return this._addCheck({kind:"url",...g.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...g.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...g.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...g.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...g.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...g.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...g.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...g.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...g.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...g.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...g.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...g.errToObj(t)})}datetime(t){var s,i;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(s=t?.offset)!==null&&s!==void 0?s:!1,local:(i=t?.local)!==null&&i!==void 0?i:!1,...g.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...g.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...g.errToObj(t)})}regex(t,s){return this._addCheck({kind:"regex",regex:t,...g.errToObj(s)})}includes(t,s){return this._addCheck({kind:"includes",value:t,position:s?.position,...g.errToObj(s?.message)})}startsWith(t,s){return this._addCheck({kind:"startsWith",value:t,...g.errToObj(s)})}endsWith(t,s){return this._addCheck({kind:"endsWith",value:t,...g.errToObj(s)})}min(t,s){return this._addCheck({kind:"min",value:t,...g.errToObj(s)})}max(t,s){return this._addCheck({kind:"max",value:t,...g.errToObj(s)})}length(t,s){return this._addCheck({kind:"length",value:t,...g.errToObj(s)})}nonempty(t){return this.min(1,g.errToObj(t))}trim(){return new $({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new $({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new $({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxLength(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}}$.create=e=>{var t;return new $({checks:[],typeName:v.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...k(e)})};function $s(e,t){const s=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,a=s>i?s:i,o=parseInt(e.toFixed(a).replace(".","")),r=parseInt(t.toFixed(a).replace(".",""));return o%r/Math.pow(10,a)}class V extends S{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==f.number){const o=this._getOrReturnCtx(t);return h(o,{code:p.invalid_type,expected:f.number,received:o.parsedType}),_}let i;const a=new P;for(const o of this._def.checks)o.kind==="int"?I.isInteger(t.data)||(i=this._getOrReturnCtx(t,i),h(i,{code:p.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(i=this._getOrReturnCtx(t,i),h(i,{code:p.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(i=this._getOrReturnCtx(t,i),h(i,{code:p.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?$s(t.data,o.value)!==0&&(i=this._getOrReturnCtx(t,i),h(i,{code:p.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(i=this._getOrReturnCtx(t,i),h(i,{code:p.not_finite,message:o.message}),a.dirty()):I.assertNever(o);return{status:a.value,value:t.data}}gte(t,s){return this.setLimit("min",t,!0,g.toString(s))}gt(t,s){return this.setLimit("min",t,!1,g.toString(s))}lte(t,s){return this.setLimit("max",t,!0,g.toString(s))}lt(t,s){return this.setLimit("max",t,!1,g.toString(s))}setLimit(t,s,i,a){return new V({...this._def,checks:[...this._def.checks,{kind:t,value:s,inclusive:i,message:g.toString(a)}]})}_addCheck(t){return new V({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:g.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(t)})}multipleOf(t,s){return this._addCheck({kind:"multipleOf",value:t,message:g.toString(s)})}finite(t){return this._addCheck({kind:"finite",message:g.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.toString(t)})}get minValue(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxValue(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&I.isInteger(t.value))}get isFinite(){let t=null,s=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(s===null||i.value>s)&&(s=i.value):i.kind==="max"&&(t===null||i.value<t)&&(t=i.value)}return Number.isFinite(s)&&Number.isFinite(t)}}V.create=e=>new V({checks:[],typeName:v.ZodNumber,coerce:e?.coerce||!1,...k(e)});class W extends S{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==f.bigint)return this._getInvalidInput(t);let i;const a=new P;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(i=this._getOrReturnCtx(t,i),h(i,{code:p.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(i=this._getOrReturnCtx(t,i),h(i,{code:p.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(i=this._getOrReturnCtx(t,i),h(i,{code:p.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):I.assertNever(o);return{status:a.value,value:t.data}}_getInvalidInput(t){const s=this._getOrReturnCtx(t);return h(s,{code:p.invalid_type,expected:f.bigint,received:s.parsedType}),_}gte(t,s){return this.setLimit("min",t,!0,g.toString(s))}gt(t,s){return this.setLimit("min",t,!1,g.toString(s))}lte(t,s){return this.setLimit("max",t,!0,g.toString(s))}lt(t,s){return this.setLimit("max",t,!1,g.toString(s))}setLimit(t,s,i,a){return new W({...this._def,checks:[...this._def.checks,{kind:t,value:s,inclusive:i,message:g.toString(a)}]})}_addCheck(t){return new W({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:g.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(t)})}multipleOf(t,s){return this._addCheck({kind:"multipleOf",value:t,message:g.toString(s)})}get minValue(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxValue(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}}W.create=e=>{var t;return new W({checks:[],typeName:v.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...k(e)})};class ke extends S{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==f.boolean){const i=this._getOrReturnCtx(t);return h(i,{code:p.invalid_type,expected:f.boolean,received:i.parsedType}),_}return C(t.data)}}ke.create=e=>new ke({typeName:v.ZodBoolean,coerce:e?.coerce||!1,...k(e)});class ee extends S{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==f.date){const o=this._getOrReturnCtx(t);return h(o,{code:p.invalid_type,expected:f.date,received:o.parsedType}),_}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return h(o,{code:p.invalid_date}),_}const i=new P;let a;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(a=this._getOrReturnCtx(t,a),h(a,{code:p.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),i.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(a=this._getOrReturnCtx(t,a),h(a,{code:p.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),i.dirty()):I.assertNever(o);return{status:i.value,value:new Date(t.data.getTime())}}_addCheck(t){return new ee({...this._def,checks:[...this._def.checks,t]})}min(t,s){return this._addCheck({kind:"min",value:t.getTime(),message:g.toString(s)})}max(t,s){return this._addCheck({kind:"max",value:t.getTime(),message:g.toString(s)})}get minDate(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t!=null?new Date(t):null}}ee.create=e=>new ee({checks:[],coerce:e?.coerce||!1,typeName:v.ZodDate,...k(e)});class Xe extends S{_parse(t){if(this._getType(t)!==f.symbol){const i=this._getOrReturnCtx(t);return h(i,{code:p.invalid_type,expected:f.symbol,received:i.parsedType}),_}return C(t.data)}}Xe.create=e=>new Xe({typeName:v.ZodSymbol,...k(e)});class Se extends S{_parse(t){if(this._getType(t)!==f.undefined){const i=this._getOrReturnCtx(t);return h(i,{code:p.invalid_type,expected:f.undefined,received:i.parsedType}),_}return C(t.data)}}Se.create=e=>new Se({typeName:v.ZodUndefined,...k(e)});class we extends S{_parse(t){if(this._getType(t)!==f.null){const i=this._getOrReturnCtx(t);return h(i,{code:p.invalid_type,expected:f.null,received:i.parsedType}),_}return C(t.data)}}we.create=e=>new we({typeName:v.ZodNull,...k(e)});class le extends S{constructor(){super(...arguments),this._any=!0}_parse(t){return C(t.data)}}le.create=e=>new le({typeName:v.ZodAny,...k(e)});class Q extends S{constructor(){super(...arguments),this._unknown=!0}_parse(t){return C(t.data)}}Q.create=e=>new Q({typeName:v.ZodUnknown,...k(e)});class z extends S{_parse(t){const s=this._getOrReturnCtx(t);return h(s,{code:p.invalid_type,expected:f.never,received:s.parsedType}),_}}z.create=e=>new z({typeName:v.ZodNever,...k(e)});class Je extends S{_parse(t){if(this._getType(t)!==f.undefined){const i=this._getOrReturnCtx(t);return h(i,{code:p.invalid_type,expected:f.void,received:i.parsedType}),_}return C(t.data)}}Je.create=e=>new Je({typeName:v.ZodVoid,...k(e)});class N extends S{_parse(t){const{ctx:s,status:i}=this._processInputParams(t),a=this._def;if(s.parsedType!==f.array)return h(s,{code:p.invalid_type,expected:f.array,received:s.parsedType}),_;if(a.exactLength!==null){const r=s.data.length>a.exactLength.value,c=s.data.length<a.exactLength.value;(r||c)&&(h(s,{code:r?p.too_big:p.too_small,minimum:c?a.exactLength.value:void 0,maximum:r?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),i.dirty())}if(a.minLength!==null&&s.data.length<a.minLength.value&&(h(s,{code:p.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),i.dirty()),a.maxLength!==null&&s.data.length>a.maxLength.value&&(h(s,{code:p.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),i.dirty()),s.common.async)return Promise.all([...s.data].map((r,c)=>a.type._parseAsync(new L(s,r,s.path,c)))).then(r=>P.mergeArray(i,r));const o=[...s.data].map((r,c)=>a.type._parseSync(new L(s,r,s.path,c)));return P.mergeArray(i,o)}get element(){return this._def.type}min(t,s){return new N({...this._def,minLength:{value:t,message:g.toString(s)}})}max(t,s){return new N({...this._def,maxLength:{value:t,message:g.toString(s)}})}length(t,s){return new N({...this._def,exactLength:{value:t,message:g.toString(s)}})}nonempty(t){return this.min(1,t)}}N.create=(e,t)=>new N({type:e,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...k(t)});function ie(e){if(e instanceof E){const t={};for(const s in e.shape){const i=e.shape[s];t[s]=D.create(ie(i))}return new E({...e._def,shape:()=>t})}else return e instanceof N?new N({...e._def,type:ie(e.element)}):e instanceof D?D.create(ie(e.unwrap())):e instanceof Y?Y.create(ie(e.unwrap())):e instanceof U?U.create(e.items.map(t=>ie(t))):e}class E extends S{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),s=I.objectKeys(t);return this._cached={shape:t,keys:s}}_parse(t){if(this._getType(t)!==f.object){const l=this._getOrReturnCtx(t);return h(l,{code:p.invalid_type,expected:f.object,received:l.parsedType}),_}const{status:i,ctx:a}=this._processInputParams(t),{shape:o,keys:r}=this._getCached(),c=[];if(!(this._def.catchall instanceof z&&this._def.unknownKeys==="strip"))for(const l in a.data)r.includes(l)||c.push(l);const d=[];for(const l of r){const m=o[l],w=a.data[l];d.push({key:{status:"valid",value:l},value:m._parse(new L(a,w,a.path,l)),alwaysSet:l in a.data})}if(this._def.catchall instanceof z){const l=this._def.unknownKeys;if(l==="passthrough")for(const m of c)d.push({key:{status:"valid",value:m},value:{status:"valid",value:a.data[m]}});else if(l==="strict")c.length>0&&(h(a,{code:p.unrecognized_keys,keys:c}),i.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const m of c){const w=a.data[m];d.push({key:{status:"valid",value:m},value:l._parse(new L(a,w,a.path,m)),alwaysSet:m in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const l=[];for(const m of d){const w=await m.key,y=await m.value;l.push({key:w,value:y,alwaysSet:m.alwaysSet})}return l}).then(l=>P.mergeObjectSync(i,l)):P.mergeObjectSync(i,d)}get shape(){return this._def.shape()}strict(t){return g.errToObj,new E({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(s,i)=>{var a,o,r,c;const d=(r=(o=(a=this._def).errorMap)===null||o===void 0?void 0:o.call(a,s,i).message)!==null&&r!==void 0?r:i.defaultError;return s.code==="unrecognized_keys"?{message:(c=g.errToObj(t).message)!==null&&c!==void 0?c:d}:{message:d}}}:{}})}strip(){return new E({...this._def,unknownKeys:"strip"})}passthrough(){return new E({...this._def,unknownKeys:"passthrough"})}extend(t){return new E({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new E({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:v.ZodObject})}setKey(t,s){return this.augment({[t]:s})}catchall(t){return new E({...this._def,catchall:t})}pick(t){const s={};return I.objectKeys(t).forEach(i=>{t[i]&&this.shape[i]&&(s[i]=this.shape[i])}),new E({...this._def,shape:()=>s})}omit(t){const s={};return I.objectKeys(this.shape).forEach(i=>{t[i]||(s[i]=this.shape[i])}),new E({...this._def,shape:()=>s})}deepPartial(){return ie(this)}partial(t){const s={};return I.objectKeys(this.shape).forEach(i=>{const a=this.shape[i];t&&!t[i]?s[i]=a:s[i]=a.optional()}),new E({...this._def,shape:()=>s})}required(t){const s={};return I.objectKeys(this.shape).forEach(i=>{if(t&&!t[i])s[i]=this.shape[i];else{let o=this.shape[i];for(;o instanceof D;)o=o._def.innerType;s[i]=o}}),new E({...this._def,shape:()=>s})}keyof(){return $n(I.objectKeys(this.shape))}}E.create=(e,t)=>new E({shape:()=>e,unknownKeys:"strip",catchall:z.create(),typeName:v.ZodObject,...k(t)});E.strictCreate=(e,t)=>new E({shape:()=>e,unknownKeys:"strict",catchall:z.create(),typeName:v.ZodObject,...k(t)});E.lazycreate=(e,t)=>new E({shape:e,unknownKeys:"strip",catchall:z.create(),typeName:v.ZodObject,...k(t)});class Ie extends S{_parse(t){const{ctx:s}=this._processInputParams(t),i=this._def.options;function a(o){for(const c of o)if(c.result.status==="valid")return c.result;for(const c of o)if(c.result.status==="dirty")return s.common.issues.push(...c.ctx.common.issues),c.result;const r=o.map(c=>new A(c.ctx.common.issues));return h(s,{code:p.invalid_union,unionErrors:r}),_}if(s.common.async)return Promise.all(i.map(async o=>{const r={...s,common:{...s.common,issues:[]},parent:null};return{result:await o._parseAsync({data:s.data,path:s.path,parent:r}),ctx:r}})).then(a);{let o;const r=[];for(const d of i){const l={...s,common:{...s.common,issues:[]},parent:null},m=d._parseSync({data:s.data,path:s.path,parent:l});if(m.status==="valid")return m;m.status==="dirty"&&!o&&(o={result:m,ctx:l}),l.common.issues.length&&r.push(l.common.issues)}if(o)return s.common.issues.push(...o.ctx.common.issues),o.result;const c=r.map(d=>new A(d));return h(s,{code:p.invalid_union,unionErrors:c}),_}}get options(){return this._def.options}}Ie.create=(e,t)=>new Ie({options:e,typeName:v.ZodUnion,...k(t)});const B=e=>e instanceof Ee?B(e.schema):e instanceof M?B(e.innerType()):e instanceof Re?[e.value]:e instanceof K?e.options:e instanceof Pe?I.objectValues(e.enum):e instanceof Oe?B(e._def.innerType):e instanceof Se?[void 0]:e instanceof we?[null]:e instanceof D?[void 0,...B(e.unwrap())]:e instanceof Y?[null,...B(e.unwrap())]:e instanceof Ot||e instanceof je?B(e.unwrap()):e instanceof Ce?B(e._def.innerType):[];class et extends S{_parse(t){const{ctx:s}=this._processInputParams(t);if(s.parsedType!==f.object)return h(s,{code:p.invalid_type,expected:f.object,received:s.parsedType}),_;const i=this.discriminator,a=s.data[i],o=this.optionsMap.get(a);return o?s.common.async?o._parseAsync({data:s.data,path:s.path,parent:s}):o._parseSync({data:s.data,path:s.path,parent:s}):(h(s,{code:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),_)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,s,i){const a=new Map;for(const o of s){const r=B(o.shape[t]);if(!r.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const c of r){if(a.has(c))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(c)}`);a.set(c,o)}}return new et({typeName:v.ZodDiscriminatedUnion,discriminator:t,options:s,optionsMap:a,...k(i)})}}function kt(e,t){const s=G(e),i=G(t);if(e===t)return{valid:!0,data:e};if(s===f.object&&i===f.object){const a=I.objectKeys(t),o=I.objectKeys(e).filter(c=>a.indexOf(c)!==-1),r={...e,...t};for(const c of o){const d=kt(e[c],t[c]);if(!d.valid)return{valid:!1};r[c]=d.data}return{valid:!0,data:r}}else if(s===f.array&&i===f.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let o=0;o<e.length;o++){const r=e[o],c=t[o],d=kt(r,c);if(!d.valid)return{valid:!1};a.push(d.data)}return{valid:!0,data:a}}else return s===f.date&&i===f.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class xe extends S{_parse(t){const{status:s,ctx:i}=this._processInputParams(t),a=(o,r)=>{if(_t(o)||_t(r))return _;const c=kt(o.value,r.value);return c.valid?((yt(o)||yt(r))&&s.dirty(),{status:s.value,value:c.data}):(h(i,{code:p.invalid_intersection_types}),_)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,r])=>a(o,r)):a(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}xe.create=(e,t,s)=>new xe({left:e,right:t,typeName:v.ZodIntersection,...k(s)});class U extends S{_parse(t){const{status:s,ctx:i}=this._processInputParams(t);if(i.parsedType!==f.array)return h(i,{code:p.invalid_type,expected:f.array,received:i.parsedType}),_;if(i.data.length<this._def.items.length)return h(i,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_;!this._def.rest&&i.data.length>this._def.items.length&&(h(i,{code:p.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const o=[...i.data].map((r,c)=>{const d=this._def.items[c]||this._def.rest;return d?d._parse(new L(i,r,i.path,c)):null}).filter(r=>!!r);return i.common.async?Promise.all(o).then(r=>P.mergeArray(s,r)):P.mergeArray(s,o)}get items(){return this._def.items}rest(t){return new U({...this._def,rest:t})}}U.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new U({items:e,typeName:v.ZodTuple,rest:null,...k(t)})};class Te extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:s,ctx:i}=this._processInputParams(t);if(i.parsedType!==f.object)return h(i,{code:p.invalid_type,expected:f.object,received:i.parsedType}),_;const a=[],o=this._def.keyType,r=this._def.valueType;for(const c in i.data)a.push({key:o._parse(new L(i,c,i.path,c)),value:r._parse(new L(i,i.data[c],i.path,c)),alwaysSet:c in i.data});return i.common.async?P.mergeObjectAsync(s,a):P.mergeObjectSync(s,a)}get element(){return this._def.valueType}static create(t,s,i){return s instanceof S?new Te({keyType:t,valueType:s,typeName:v.ZodRecord,...k(i)}):new Te({keyType:$.create(),valueType:t,typeName:v.ZodRecord,...k(s)})}}class Qe extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:s,ctx:i}=this._processInputParams(t);if(i.parsedType!==f.map)return h(i,{code:p.invalid_type,expected:f.map,received:i.parsedType}),_;const a=this._def.keyType,o=this._def.valueType,r=[...i.data.entries()].map(([c,d],l)=>({key:a._parse(new L(i,c,i.path,[l,"key"])),value:o._parse(new L(i,d,i.path,[l,"value"]))}));if(i.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const d of r){const l=await d.key,m=await d.value;if(l.status==="aborted"||m.status==="aborted")return _;(l.status==="dirty"||m.status==="dirty")&&s.dirty(),c.set(l.value,m.value)}return{status:s.value,value:c}})}else{const c=new Map;for(const d of r){const l=d.key,m=d.value;if(l.status==="aborted"||m.status==="aborted")return _;(l.status==="dirty"||m.status==="dirty")&&s.dirty(),c.set(l.value,m.value)}return{status:s.value,value:c}}}}Qe.create=(e,t,s)=>new Qe({valueType:t,keyType:e,typeName:v.ZodMap,...k(s)});class te extends S{_parse(t){const{status:s,ctx:i}=this._processInputParams(t);if(i.parsedType!==f.set)return h(i,{code:p.invalid_type,expected:f.set,received:i.parsedType}),_;const a=this._def;a.minSize!==null&&i.data.size<a.minSize.value&&(h(i,{code:p.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),s.dirty()),a.maxSize!==null&&i.data.size>a.maxSize.value&&(h(i,{code:p.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),s.dirty());const o=this._def.valueType;function r(d){const l=new Set;for(const m of d){if(m.status==="aborted")return _;m.status==="dirty"&&s.dirty(),l.add(m.value)}return{status:s.value,value:l}}const c=[...i.data.values()].map((d,l)=>o._parse(new L(i,d,i.path,l)));return i.common.async?Promise.all(c).then(d=>r(d)):r(c)}min(t,s){return new te({...this._def,minSize:{value:t,message:g.toString(s)}})}max(t,s){return new te({...this._def,maxSize:{value:t,message:g.toString(s)}})}size(t,s){return this.min(t,s).max(t,s)}nonempty(t){return this.min(1,t)}}te.create=(e,t)=>new te({valueType:e,minSize:null,maxSize:null,typeName:v.ZodSet,...k(t)});class oe extends S{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:s}=this._processInputParams(t);if(s.parsedType!==f.function)return h(s,{code:p.invalid_type,expected:f.function,received:s.parsedType}),_;function i(c,d){return Ke({data:c,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,We(),ce].filter(l=>!!l),issueData:{code:p.invalid_arguments,argumentsError:d}})}function a(c,d){return Ke({data:c,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,We(),ce].filter(l=>!!l),issueData:{code:p.invalid_return_type,returnTypeError:d}})}const o={errorMap:s.common.contextualErrorMap},r=s.data;if(this._def.returns instanceof de){const c=this;return C(async function(...d){const l=new A([]),m=await c._def.args.parseAsync(d,o).catch(O=>{throw l.addIssue(i(d,O)),l}),w=await Reflect.apply(r,this,m);return await c._def.returns._def.type.parseAsync(w,o).catch(O=>{throw l.addIssue(a(w,O)),l})})}else{const c=this;return C(function(...d){const l=c._def.args.safeParse(d,o);if(!l.success)throw new A([i(d,l.error)]);const m=Reflect.apply(r,this,l.data),w=c._def.returns.safeParse(m,o);if(!w.success)throw new A([a(m,w.error)]);return w.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new oe({...this._def,args:U.create(t).rest(Q.create())})}returns(t){return new oe({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,s,i){return new oe({args:t||U.create([]).rest(Q.create()),returns:s||Q.create(),typeName:v.ZodFunction,...k(i)})}}class Ee extends S{get schema(){return this._def.getter()}_parse(t){const{ctx:s}=this._processInputParams(t);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}Ee.create=(e,t)=>new Ee({getter:e,typeName:v.ZodLazy,...k(t)});class Re extends S{_parse(t){if(t.data!==this._def.value){const s=this._getOrReturnCtx(t);return h(s,{received:s.data,code:p.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:t.data}}get value(){return this._def.value}}Re.create=(e,t)=>new Re({value:e,typeName:v.ZodLiteral,...k(t)});function $n(e,t){return new K({values:e,typeName:v.ZodEnum,...k(t)})}class K extends S{constructor(){super(...arguments),be.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const s=this._getOrReturnCtx(t),i=this._def.values;return h(s,{expected:I.joinValues(i),received:s.parsedType,code:p.invalid_type}),_}if(Ye(this,be)||On(this,be,new Set(this._def.values)),!Ye(this,be).has(t.data)){const s=this._getOrReturnCtx(t),i=this._def.values;return h(s,{received:s.data,code:p.invalid_enum_value,options:i}),_}return C(t.data)}get options(){return this._def.values}get enum(){const t={};for(const s of this._def.values)t[s]=s;return t}get Values(){const t={};for(const s of this._def.values)t[s]=s;return t}get Enum(){const t={};for(const s of this._def.values)t[s]=s;return t}extract(t,s=this._def){return K.create(t,{...this._def,...s})}exclude(t,s=this._def){return K.create(this.options.filter(i=>!t.includes(i)),{...this._def,...s})}}be=new WeakMap;K.create=$n;class Pe extends S{constructor(){super(...arguments),ve.set(this,void 0)}_parse(t){const s=I.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==f.string&&i.parsedType!==f.number){const a=I.objectValues(s);return h(i,{expected:I.joinValues(a),received:i.parsedType,code:p.invalid_type}),_}if(Ye(this,ve)||On(this,ve,new Set(I.getValidEnumValues(this._def.values))),!Ye(this,ve).has(t.data)){const a=I.objectValues(s);return h(i,{received:i.data,code:p.invalid_enum_value,options:a}),_}return C(t.data)}get enum(){return this._def.values}}ve=new WeakMap;Pe.create=(e,t)=>new Pe({values:e,typeName:v.ZodNativeEnum,...k(t)});class de extends S{unwrap(){return this._def.type}_parse(t){const{ctx:s}=this._processInputParams(t);if(s.parsedType!==f.promise&&s.common.async===!1)return h(s,{code:p.invalid_type,expected:f.promise,received:s.parsedType}),_;const i=s.parsedType===f.promise?s.data:Promise.resolve(s.data);return C(i.then(a=>this._def.type.parseAsync(a,{path:s.path,errorMap:s.common.contextualErrorMap})))}}de.create=(e,t)=>new de({type:e,typeName:v.ZodPromise,...k(t)});class M extends S{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:s,ctx:i}=this._processInputParams(t),a=this._def.effect||null,o={addIssue:r=>{h(i,r),r.fatal?s.abort():s.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){const r=a.transform(i.data,o);if(i.common.async)return Promise.resolve(r).then(async c=>{if(s.value==="aborted")return _;const d=await this._def.schema._parseAsync({data:c,path:i.path,parent:i});return d.status==="aborted"?_:d.status==="dirty"||s.value==="dirty"?ae(d.value):d});{if(s.value==="aborted")return _;const c=this._def.schema._parseSync({data:r,path:i.path,parent:i});return c.status==="aborted"?_:c.status==="dirty"||s.value==="dirty"?ae(c.value):c}}if(a.type==="refinement"){const r=c=>{const d=a.refinement(c,o);if(i.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(i.common.async===!1){const c=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return c.status==="aborted"?_:(c.status==="dirty"&&s.dirty(),r(c.value),{status:s.value,value:c.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(c=>c.status==="aborted"?_:(c.status==="dirty"&&s.dirty(),r(c.value).then(()=>({status:s.value,value:c.value}))))}if(a.type==="transform")if(i.common.async===!1){const r=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!q(r))return r;const c=a.transform(r.value,o);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:c}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(r=>q(r)?Promise.resolve(a.transform(r.value,o)).then(c=>({status:s.value,value:c})):r);I.assertNever(a)}}M.create=(e,t,s)=>new M({schema:e,typeName:v.ZodEffects,effect:t,...k(s)});M.createWithPreprocess=(e,t,s)=>new M({schema:t,effect:{type:"preprocess",transform:e},typeName:v.ZodEffects,...k(s)});class D extends S{_parse(t){return this._getType(t)===f.undefined?C(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}D.create=(e,t)=>new D({innerType:e,typeName:v.ZodOptional,...k(t)});class Y extends S{_parse(t){return this._getType(t)===f.null?C(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Y.create=(e,t)=>new Y({innerType:e,typeName:v.ZodNullable,...k(t)});class Oe extends S{_parse(t){const{ctx:s}=this._processInputParams(t);let i=s.data;return s.parsedType===f.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}Oe.create=(e,t)=>new Oe({innerType:e,typeName:v.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...k(t)});class Ce extends S{_parse(t){const{ctx:s}=this._processInputParams(t),i={...s,common:{...s.common,issues:[]}},a=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return ye(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new A(i.common.issues)},input:i.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new A(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}Ce.create=(e,t)=>new Ce({innerType:e,typeName:v.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...k(t)});class qe extends S{_parse(t){if(this._getType(t)!==f.nan){const i=this._getOrReturnCtx(t);return h(i,{code:p.invalid_type,expected:f.nan,received:i.parsedType}),_}return{status:"valid",value:t.data}}}qe.create=e=>new qe({typeName:v.ZodNaN,...k(e)});const Ns=Symbol("zod_brand");class Ot extends S{_parse(t){const{ctx:s}=this._processInputParams(t),i=s.data;return this._def.type._parse({data:i,path:s.path,parent:s})}unwrap(){return this._def.type}}class $e extends S{_parse(t){const{status:s,ctx:i}=this._processInputParams(t);if(i.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?_:o.status==="dirty"?(s.dirty(),ae(o.value)):this._def.out._parseAsync({data:o.value,path:i.path,parent:i})})();{const a=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?_:a.status==="dirty"?(s.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:i.path,parent:i})}}static create(t,s){return new $e({in:t,out:s,typeName:v.ZodPipeline})}}class je extends S{_parse(t){const s=this._def.innerType._parse(t),i=a=>(q(a)&&(a.value=Object.freeze(a.value)),a);return ye(s)?s.then(a=>i(a)):i(s)}unwrap(){return this._def.innerType}}je.create=(e,t)=>new je({innerType:e,typeName:v.ZodReadonly,...k(t)});function Zt(e,t){const s=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof s=="string"?{message:s}:s}function Nn(e,t={},s){return e?le.create().superRefine((i,a)=>{var o,r;const c=e(i);if(c instanceof Promise)return c.then(d=>{var l,m;if(!d){const w=Zt(t,i),y=(m=(l=w.fatal)!==null&&l!==void 0?l:s)!==null&&m!==void 0?m:!0;a.addIssue({code:"custom",...w,fatal:y})}});if(!c){const d=Zt(t,i),l=(r=(o=d.fatal)!==null&&o!==void 0?o:s)!==null&&r!==void 0?r:!0;a.addIssue({code:"custom",...d,fatal:l})}}):le.create()}const Ms={object:E.lazycreate};var v;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(v||(v={}));const Ds=(e,t={message:`Input not instance of ${e.name}`})=>Nn(s=>s instanceof e,t),Mn=$.create,Dn=V.create,Ls=qe.create,Us=W.create,Ln=ke.create,Zs=ee.create,Bs=Xe.create,Gs=Se.create,zs=we.create,Fs=le.create,Hs=Q.create,Vs=z.create,Ws=Je.create,Ks=N.create,Ys=E.create,Xs=E.strictCreate,Js=Ie.create,Qs=et.create,qs=xe.create,ei=U.create,ti=Te.create,ni=Qe.create,si=te.create,ii=oe.create,ai=Ee.create,oi=Re.create,ri=K.create,ci=Pe.create,li=de.create,Bt=M.create,di=D.create,pi=Y.create,ui=M.createWithPreprocess,mi=$e.create,hi=()=>Mn().optional(),fi=()=>Dn().optional(),gi=()=>Ln().optional(),bi={string:e=>$.create({...e,coerce:!0}),number:e=>V.create({...e,coerce:!0}),boolean:e=>ke.create({...e,coerce:!0}),bigint:e=>W.create({...e,coerce:!0}),date:e=>ee.create({...e,coerce:!0})},vi=_;var n=Object.freeze({__proto__:null,defaultErrorMap:ce,setErrorMap:us,getErrorMap:We,makeIssue:Ke,EMPTY_PATH:ms,addIssueToContext:h,ParseStatus:P,INVALID:_,DIRTY:ae,OK:C,isAborted:_t,isDirty:yt,isValid:q,isAsync:ye,get util(){return I},get objectUtil(){return vt},ZodParsedType:f,getParsedType:G,ZodType:S,datetimeRegex:An,ZodString:$,ZodNumber:V,ZodBigInt:W,ZodBoolean:ke,ZodDate:ee,ZodSymbol:Xe,ZodUndefined:Se,ZodNull:we,ZodAny:le,ZodUnknown:Q,ZodNever:z,ZodVoid:Je,ZodArray:N,ZodObject:E,ZodUnion:Ie,ZodDiscriminatedUnion:et,ZodIntersection:xe,ZodTuple:U,ZodRecord:Te,ZodMap:Qe,ZodSet:te,ZodFunction:oe,ZodLazy:Ee,ZodLiteral:Re,ZodEnum:K,ZodNativeEnum:Pe,ZodPromise:de,ZodEffects:M,ZodTransformer:M,ZodOptional:D,ZodNullable:Y,ZodDefault:Oe,ZodCatch:Ce,ZodNaN:qe,BRAND:Ns,ZodBranded:Ot,ZodPipeline:$e,ZodReadonly:je,custom:Nn,Schema:S,ZodSchema:S,late:Ms,get ZodFirstPartyTypeKind(){return v},coerce:bi,any:Fs,array:Ks,bigint:Us,boolean:Ln,date:Zs,discriminatedUnion:Qs,effect:Bt,enum:ri,function:ii,instanceof:Ds,intersection:qs,lazy:ai,literal:oi,map:ni,nan:Ls,nativeEnum:ci,never:Vs,null:zs,nullable:pi,number:Dn,object:Ys,oboolean:gi,onumber:fi,optional:di,ostring:hi,pipeline:mi,preprocess:ui,promise:li,record:ti,set:si,strictObject:Xs,string:Mn,symbol:Bs,transformer:Bt,tuple:ei,undefined:Gs,union:Js,unknown:Hs,void:Ws,NEVER:vi,ZodIssueCode:p,quotelessJson:ps,ZodError:A});const _i=n.enum(["app_start","sign_in","window_focus","surface_open"]),Un=n.object({id:n.string().min(1),state:n.enum(["active","paused","disabled"])}).passthrough(),yi=n.object({tenant_id:n.string().min(1),tenant_name:n.string().optional(),eligible:n.boolean(),endpoint:Un.nullable()}).passthrough(),ki=n.object({code:n.string(),message:n.string(),details:n.record(n.unknown()).optional(),retry_after_seconds:n.number().optional()}).passthrough(),br=n.object({capability:n.number(),consent_account_guard:n.boolean().optional(),state:n.enum(["ready","signed_out","unavailable","update_required"]),account_id:n.string().nullable(),tenant_id:n.string().nullable(),surface_state:n.enum(["A","B","C","D","E","F","G"]).nullable(),visibility:n.object({settings:n.boolean(),inbox:n.boolean(),account_door:n.boolean(),onboarding:n.boolean()}),update_required:n.boolean(),local:n.object({enabled:n.boolean(),onboarding:n.string(),session:n.string()}),status:n.object({tenants:n.array(yi)}).passthrough().nullable(),consent:n.object({version:n.string().min(1).max(128),text:n.string().min(1).refine(e=>new TextEncoder().encode(e).length<=2048,"Consent exceeds the served-text contract"),source:n.enum(["served","cached","embedded"])}).nullable(),error:ki.nullable(),state_note:n.string().nullable().optional(),read_only:n.boolean().optional()}).passthrough(),Si=n.object({version:n.string().min(1),consented_at:n.string().min(1),consented_via:n.enum(["dialog","settings"]),current:n.boolean()}).passthrough(),vr=n.object({endpoint:Un.extend({tenant_id:n.string().min(1),label:n.string().optional(),consent:Si.nullable().optional(),created_at:n.string().optional(),updated_at:n.string().optional()}).nullable(),settings:n.object({tenant_id:n.string().min(1),eligible:n.boolean(),consent_version:n.string().optional(),consent_required:n.boolean()}).passthrough()}).passthrough(),wi=n.object({kind:n.enum(["endpoint","account"]).optional(),endpoint_id:n.string().min(1).optional(),account_id:n.string().min(1).optional()}).passthrough().refine(e=>!!e.endpoint_id!=!!e.account_id,"An allowlist target names exactly one of endpoint_id or account_id").refine(e=>e.kind===void 0||(e.kind==="endpoint"?e.endpoint_id!==void 0:e.account_id!==void 0),"An allowlist target's kind must agree with the id it carries"),Gt=n.object({direction:n.enum(["send","receive"]),effect:n.enum(["allow","deny"]),target:wi,id:n.string().optional()}).passthrough(),zt=n.object({mode:n.enum(["class_default","listed_only"]),allow:n.number(),deny:n.number()}).passthrough(),_r=n.object({allowlist:n.object({tenant_id:n.string().min(1),entries:n.array(Gt)}).passthrough(),view:n.object({tenant_id:n.string().nullable(),entries:n.array(Gt),directions:n.object({send:zt,receive:zt}),class_default:n.literal("cos_cos"),cues:n.object({allow_entry_switches_direction_to_listed_only:n.boolean(),listed_only_affects:n.string(),removing_allow_does_not_stop_open_thread:n.boolean(),deny_stops_pair_both_directions:n.boolean()}).passthrough()}).passthrough()}).passthrough();function yr(e,t){if(!e||!t||e.account_id!==t||e.capability<1||e.state!=="ready"||e.update_required||e.surface_state!=="B"||!e.visibility.onboarding||!e.tenant_id)return null;const s=e.status?.tenants.filter(i=>i.tenant_id===e.tenant_id);return s?.length!==1||s[0].eligible!==!0||s[0].endpoint!==null?null:{accountId:t,tenantId:e.tenant_id}}function kr(e){const t=e?.consent;return t&&(t.source==="served"||t.source==="cached")?t:null}const Ii=6*1024,xi=512;function St(e,t,s){let i=new TextEncoder().encode(`${t}${e.size?`?${e}`:""}`).length;const a=[];for(const o of s){if(a.length===xi)break;const c=new URLSearchParams({order_ids:o}).toString().length+1;if(i+c>Ii)break;e.append("order_ids",o),a.push(o),i+=c}return a}function Sr(e,t,s){return St(new URLSearchParams(s),t,e)}const u=n.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/),Ue=n.string().min(1).max(256).regex(/^[a-zA-Z0-9_][a-zA-Z0-9_.-]*$/),Ze=n.string().min(1).max(32768),Ti=/^[a-f0-9]{12}$/,b=n.string().regex(Ti),ct=n.string().regex(/^[a-f0-9]{12}$/),lt=n.string().min(1).max(128),Ei=n.string().min(1).max(4096),dt=n.string().regex(/^[A-Za-z0-9_.:-]{1,100}$/),Be=n.string().regex(/^\$\{[A-Za-z_][A-Za-z0-9_]*\}$/),Ft=n.string().regex(/^[a-f0-9]{32}$/),Ri=/^(\/|[A-Za-z]:[\\/])/,pt=n.string().min(1).max(4096).regex(Ri),Ht=/^[a-f0-9]{32}$/,x=n.string().regex(/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/),Vt=n.string().min(1).max(512).nullish(),se=n.string().regex(/^[A-Za-z0-9_-]{1,128}$/),Wt=n.string().regex(/^ap_[0-9a-hjkmnp-tv-z]{1,64}$/),ue=n.string().regex(/^la_[0-9a-f]{16}$/),me=n.string().min(1).max(128).regex(/^[A-Za-z0-9_.:-]+$/),Kt=n.object({data_b64:n.string().min(1).max(1e6),mime_type:n.enum(["image/png","image/jpeg","image/gif","image/webp"])}).strict(),Yt=2e5,Xt=8,Pi=256,Oi=100,Jt=16,Ci=256,ji=100,Ai=200,$i=1e6,Ni=n.enum(["auto","none","minimal","low","medium","high","xhigh","max"]),R=n.string().min(1).max(128).refine(e=>e!=="."&&e!==".."&&!e.includes("/")&&!e.includes("\\")&&[...e].every(t=>t.charCodeAt(0)>=32&&t.charCodeAt(0)!==127)),Ge=n.object({kind:n.enum(["agent","team"]),name:R}).strict(),Zn=n.enum(["claude","codex","omp"]),Mi=n.record(n.string(),n.array(n.string().min(1).max(512)).max(5e3)),Qt={sources:n.array(Zn).max(3).optional(),sessionIds:Mi.optional(),all:n.boolean().optional(),includeSubagents:n.boolean().optional(),includeClearedSegments:n.boolean().optional(),includeMemory:n.boolean().optional(),includeInstructions:n.boolean().optional(),maxSessions:n.number().int().min(1).max(5e3).optional()},ut=n.object({provider:n.string().min(1).max(128),model_id:n.string().min(1).max(512),reasoning_effort:n.string().min(1).max(64).nullable()}).strict(),qt=n.object({kind:n.enum(["role","specialist"]).optional(),description:n.string().max(8e3).optional(),instructions:n.string().max(8e3).optional(),tools:n.array(n.string().min(1).max(128)).max(256).optional(),effort:n.string().max(64).optional(),delegate:n.boolean().optional(),action_class:n.enum(["reactive","proactive"]).optional()}).strict(),en=n.object({name:n.string().min(1).max(64).optional(),description:n.string().max(8e3).optional(),manager:R.optional(),members:n.array(n.object({role:R,count:n.number().int().min(1).max(16),kind:n.enum(["agent","team"]),tier:n.enum(["lo","med","hi"]).nullable().optional(),effort:Ni.nullable().optional()}).strict()).max(128).optional(),instructions:n.string().max(8e3).optional(),project:n.string().max(8e3).optional()}).strict(),Di=n.record(n.array(n.string().max(1024)).max(100)),tn=n.enum(["minutes","hours","days"]);function Li(e){return!/^\.+$/.test(e)}const wr=e=>Ve.safeParse(e).success,Ve=n.string().min(1).max(128).refine(e=>[...e].every(t=>t.charCodeAt(0)>=32&&t.charCodeAt(0)!==127&&t!=="/"&&t!=="\\")).refine(Li),nn=n.enum(["str","int","float","bool","list","dict"]),sn=n.string().max(16384),Ui=2e3,an=n.string().min(1).max(Ui),on=n.string().min(1).max(64),Zi=n.string().min(1).max(64),Bi=n.string().min(1).max(64),rn=n.object({is_active:n.boolean().nullish(),one_time:n.boolean().nullish(),start_time_utc:n.string().max(64).nullish(),end_time_utc:n.string().max(64).nullish()}).strict(),Gi=n.object({conversation_length:n.number().int().optional(),detail_length:n.number().int().optional(),max_learnings_history:n.number().int().optional(),hosting:n.string().max(256).optional(),model_name:n.string().max(1024).optional(),auto_save_conversation:n.boolean().optional()}).strict(),wt=128,cn=2e3,ln=8e3,dn=64,pn=64,tt=e=>[...e].length,It=e=>e>=9&&e<=13||e>=28&&e<=32||e===133||e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288,zi=e=>e===9||e===10||e===11||e===12||e===13||e===133,Fi=e=>e<=31||e>=127&&e<=159,Hi=e=>new RegExp("\\p{Cf}","u").test(String.fromCodePoint(e)),Vi=e=>e>=8234&&e<=8238||e>=8294&&e<=8297,ze=(e,t)=>{for(const s of e)if(t(s.codePointAt(0)??0))return!0;return!1},Bn=e=>{const t=[...e];let s=0,i=t.length;for(;s<i&&It(t[s].codePointAt(0)??0);)s++;for(;i>s&&It(t[i-1].codePointAt(0)??0);)i--;return t.slice(s,i).join("")},Wi=e=>{let t="",s=!1;for(const i of e){if(It(i.codePointAt(0)??0)){s=t.length>0;continue}s&&(t+=" ",s=!1),t+=i}return t};function Ki(e){const t=Bn(e);if(!t)return"must not be empty";if(tt(t)>wt)return`must be at most ${wt} characters`;if(/[/\\:]/.test(t))return'must not contain "/", "\\" or ":"';if(ze(t,Vi))return"must not contain Unicode bidirectional override characters";if(ze(t,zi))return"must not contain whitespace";if(ze(t,Fi))return"must not contain control characters";if(ze(t,Hi))return"must not contain invisible Unicode formatting characters";const s=[...t];return"-.".includes(s[0])||"-.".includes(s[s.length-1])?'must not begin or end with "-" or "."':null}function Ir(e){return Wi(Bn(e).normalize("NFKC").toLowerCase())}function Yi(e){return e.trim()?tt(e)>cn?`must be at most ${cn} characters`:null:"must not be empty"}function Xi(e){return e.trim()?tt(e)>ln?`must be at most ${ln} characters`:null:"must not be empty"}function Ji(e){if(e.length>pn)return`must hold at most ${pn} items`;for(const t of e)if(!t.trim()||tt(t)>dn)return`must hold items of 1 to ${dn} characters`;return null}const Qi=e=>Ki(e)===null,qi=n.string().refine(Qi,{message:"That is not a name the hub can publish."}),ea=n.string().refine(e=>Xi(e)===null,{message:"That instruction body cannot be published."}),ta=n.string().refine(e=>Yi(e)===null,{message:"That description cannot be published."}),na=n.array(n.string()).refine(e=>Ji(e)===null,{message:"That tool list cannot be published."}),mt={requestId:x.optional(),subscribe:n.boolean().optional(),autoPush:n.boolean().optional(),confirmPublicEgress:n.boolean().optional()},un=n.object({name:qi,description:ta,instructions:ea,kind:n.enum(["role","specialist"]),when_to_use:n.string(),tools:na,effort:n.string(),delegate:n.boolean(),version:n.string(),categories:n.array(n.string()),tags:n.array(n.string())}).partial().strict(),sa=n.enum(["team","agent"]),ia=n.string().min(1).max(64),aa=n.string().min(1).max(256),Gn=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,ht=n.string().regex(Gn,{message:"Letters, digits, dot, underscore and dash; no spaces."}),oa=["planning","active","qa","validation","done","paused","archived"],mn=n.enum(oa),Fe=n.string().regex(/^$|^\d{4}-\d{2}-\d{2}$/,"Dates are YYYY-MM-DD, or empty to clear."),hn=n.array(n.string().min(1).max(24)).max(8),F=n.string().min(1).max(64),ra=1e3,fn=240,gn=80,ca=256,la=100,da=200,pa=/^[a-z0-9][a-z0-9_-]{0,23}$/;function xr(e){return e?Gn.test(e)?null:"Names start with a letter or digit and may use letters, digits, dot, underscore or dash.":"Give the project a name."}function Tr(e){return pa.test(e)?null:"Tags are 1-24 characters of lowercase letters, digits, underscore or dash."}const He=n.enum(["agent","team"]),ua=n.discriminatedUnion("op",[n.object({op:n.literal("capabilities")}).strict(),n.object({op:n.literal("runtimes.list")}).strict(),n.object({op:n.literal("profiles.list")}).strict(),n.object({op:n.literal("profiles.get"),name:R}).strict(),n.object({op:n.literal("imports.sources")}).strict(),n.object({op:n.literal("imports.sessions"),source:Zn,includeSubagents:n.boolean().optional()}).strict(),n.object({op:n.literal("imports.preview"),...Qt}).strict(),n.object({op:n.literal("imports.start"),...Qt}).strict(),n.object({op:n.literal("imports.status"),jobId:n.string().min(1).max(128)}).strict(),n.object({op:n.literal("imports.cancel"),jobId:n.string().min(1).max(128)}).strict(),n.object({op:n.literal("profiles.update"),name:R,requestId:x,fields:qt,expectedDefinitionRevision:Vt.optional()}).strict(),n.object({op:n.literal("profiles.install"),name:R,requestId:x}).strict(),n.object({op:n.literal("profiles.create"),name:R,requestId:x,fields:qt.extend({description:n.string().max(8e3),instructions:n.string().min(1).max(8e3)})}).strict(),n.object({op:n.literal("hub.updates")}).strict(),n.object({op:n.literal("hub.skillPull"),requestId:x,hubId:u,hubSource:n.string().min(1).max(2048),visibility:n.enum(["public","org"]),tenantId:u.nullable(),localAlias:R,subscribe:n.boolean().optional(),autoPush:n.boolean().optional(),confirmPublicEgress:n.boolean().optional()}).strict(),n.object({op:n.literal("hub.skillPublish"),requestId:x,dryRun:n.boolean(),sourceSkill:R,localAlias:R,visibility:n.enum(["public","org"]),tenantId:u.nullable(),subscribe:n.boolean(),autoPush:n.boolean(),confirmPublicEgress:n.boolean(),previewReceipt:n.string().min(1).max(4096).optional(),confirmPublish:n.literal(!0).optional()}).strict(),n.object({op:n.literal("hub.links"),kind:n.enum(["agent","team","skill"]).optional()}).strict(),n.object({op:n.literal("hub.policy"),requestId:x,linkId:n.string().min(1).max(256),expectedPolicyRevision:n.string().min(1).max(256),subscribe:n.boolean().optional(),autoPush:n.boolean().optional(),confirmPublicEgress:n.boolean().optional()}).strict(),n.object({op:n.literal("hub.check"),requestId:x,linkId:n.string().min(1).max(256).optional(),direction:n.enum(["pull","push"]).optional(),kind:He.optional(),name:R.optional()}).strict(),n.object({op:n.literal("hub.apply"),requestId:x,previewReceipt:n.string().min(1).max(4096).optional(),confirmApply:n.literal(!0).optional(),linkId:n.string().min(1).max(256).optional(),direction:n.literal("pull").optional(),kind:He.optional(),name:R.optional(),prefer:n.enum(["local","remote"]).optional(),acknowledgeUnknownBaseline:n.boolean().optional(),dryRun:n.boolean().optional(),resolveSource:n.literal(!0).optional(),hubSource:n.string().min(1).max(2048).optional(),visibility:n.enum(["public","org"]).optional(),tenantId:n.string().min(1).max(128).nullable().optional()}).strict(),n.object({op:n.literal("hub.applyAll"),requestId:x,kind:He.optional()}).strict(),n.object({op:n.literal("hub.retry"),requestId:x,linkId:n.string().min(1).max(256).optional(),direction:n.enum(["pull","push"]).optional(),kind:He.optional(),name:R.optional()}).strict(),n.object({op:n.literal("hub.push"),requestId:x,linkId:n.string().min(1).max(256),direction:n.literal("push"),dryRun:n.boolean(),previewReceipt:n.string().min(1).max(4096).optional(),confirmPublish:n.literal(!0).optional()}).strict(),n.object({op:n.literal("teams.list")}).strict(),n.object({op:n.literal("teams.get"),name:R}).strict(),n.object({op:n.literal("teams.effective"),name:R}).strict(),n.object({op:n.literal("teams.update"),name:R,requestId:x,fields:en,expectedDefinitionRevision:Vt.optional()}).strict(),n.object({op:n.literal("teams.create"),requestId:x,fields:en.extend({name:n.string().min(1).max(64)})}).strict(),n.object({op:n.literal("sessions.list"),limit:n.number().int().min(1).max(500).optional(),include_archived:n.boolean().optional(),include_peers:n.boolean().optional(),scope_kind:sa.optional(),scope_name:ia.optional(),cursor:aa.optional(),with_counts:n.boolean().optional(),sort:n.literal("activity").optional()}).strict(),n.object({op:n.literal("delegated_cleanup_notice.ack")}).strict(),n.object({op:n.literal("sessions.search"),q:n.string().min(1).max(Pi),limit:n.number().int().min(1).max(500).optional(),include_archived:n.boolean().optional()}).strict(),n.object({op:n.literal("sessions.archive"),sessionId:b,archived:n.boolean()}).strict(),n.object({op:n.literal("sessions.delete"),sessionId:b,confirmed:n.literal(!0)}).strict(),n.object({op:n.literal("sessions.create"),requestId:x,cwd:n.string().min(1).max(4096).optional(),target:Ge.optional(),purpose:n.literal("agents-config").optional(),model:ut.optional(),draftId:b.optional(),peer:se.optional()}).strict(),n.object({op:n.literal("sessions.preview"),requestId:x,cwd:n.string().min(1).max(4096),target:Ge.optional(),model:ut.optional()}).strict(),n.object({op:n.literal("sessions.draft"),requestId:x,cwd:n.string().min(1).max(4096),target:Ge.optional(),model:ut.optional()}).strict(),n.object({op:n.literal("sessions.get"),sessionId:b,journalOrder:n.boolean().optional(),orderIds:n.array(n.string().min(1).max(128)).max(512).optional(),peerJournalSource:n.boolean().optional()}).strict(),n.object({op:n.literal("sessions.files"),sessionId:b,scope:n.enum(["family","self"]).optional(),kind:n.string().max(256).optional(),q:n.string().max(256).optional(),sort:n.enum(["recent","name","kind","modified","created","size"]).optional(),order:n.enum(["asc","desc"]).optional(),limit:n.number().int().min(1).max(200).optional(),cursor:n.string().max(8192).optional()}).strict(),n.object({op:n.literal("sessions.files.materialise"),sessionId:b,fileId:n.string().regex(/^[a-f0-9]{16}$/)}).strict(),n.object({op:n.literal("sessions.history"),sessionId:b,beforeId:u.optional(),limit:n.number().int().min(1).max(500).optional(),openFrame:n.boolean().optional(),journalOrder:n.boolean().optional(),orderIds:n.array(n.string().min(1).max(128)).max(512).optional(),peerJournalSource:n.boolean().optional(),sourceRead:n.enum(["metadata","payload"]).optional(),expectedJournalGeneration:n.string().min(1).max(128).optional()}).strict(),n.object({op:n.literal("sessions.checkpoints"),sessionId:b}).strict(),n.object({op:n.literal("sessions.checkpoints.warm"),sessionId:b,ids:n.array(u).max(Jt).optional(),limit:n.number().int().min(1).max(Jt).optional()}).strict(),n.object({op:n.literal("sessions.find"),sessionId:b,q:n.string().min(1).max(Ci),limit:n.number().int().min(1).max(Ai).optional()}).strict(),n.object({op:n.literal("subagents.transcript"),sessionId:b,childId:b,beforeId:u.optional(),limit:n.number().int().min(1).max(500).optional()}).strict(),n.object({op:n.literal("sessions.message"),sessionId:b,requestId:x,text:n.string().max(Yt),images:n.array(Kt).max(Xt).optional(),mode:n.enum(["prompt","steer"]).optional(),inputMode:n.enum(["typed","dictated","mixed"]).optional(),inputPath:n.string().max(1024).optional()}).strict(),n.object({op:n.literal("sessions.command"),sessionId:b,requestId:x,command:n.string().regex(/^\/?[A-Za-z]+$/).max(64),args:n.string().max(Yt).optional(),images:n.array(Kt).max(Xt).optional()}).strict(),n.object({op:n.literal("sessions.move"),sessionId:b,requestId:x,cwd:n.string().min(1).max(4096)}).strict(),n.object({op:n.literal("sessions.answer"),sessionId:b,epoch:u.optional(),requestId:u.optional(),value:n.string().max(32768).optional(),approved:n.boolean().optional(),questionIndex:n.number().int().min(0).optional(),askId:u.optional(),answers:n.record(n.string(),n.array(n.string().max(32768))).optional(),decline:n.boolean().optional(),revise:n.boolean().optional()}).strict(),n.object({op:n.literal("sessions.seen"),sessionId:b,completionToken:n.string().uuid()}).strict(),n.object({op:n.literal("attention.seen"),items:n.array(n.object({sessionId:b,completionToken:n.string().uuid()}).strict()).min(1).max(500)}).strict(),n.object({op:n.literal("sessions.notified"),sessionId:b,completionToken:n.string().uuid()}).strict(),n.object({op:n.literal("tags.list")}).strict(),n.object({op:n.literal("tags.replace"),tags:n.array(n.object({id:n.string().optional(),name:n.string()}).strict())}).strict(),n.object({op:n.literal("sessions.tags"),expected_revision:n.string().optional(),sessionId:b,tags:n.array(n.string()),primary:n.string().nullable()}).strict(),n.object({op:n.literal("sessions.pin"),sessionId:b,pinned:n.boolean()}).strict(),n.object({op:n.literal("sessions.watch"),sessionId:b,subscriptionId:n.string().regex(Ht),visible:n.boolean(),canNotify:n.boolean()}).strict(),n.object({op:n.literal("sessions.warm"),sessionId:b}).strict(),n.object({op:n.literal("sessions.interrupt"),sessionId:b,requestId:x}).strict(),n.object({op:n.literal("supplements.cancel"),sessionId:b,job:ct,anchor:lt}).strict(),n.object({op:n.literal("supplements.restart"),sessionId:b,job:ct,anchor:lt}).strict(),n.object({op:n.literal("supplements.steer"),sessionId:b,job:ct,anchor:lt,text:n.string().min(1).max(500)}).strict(),n.object({op:n.literal("sessions.variables.list"),sessionId:b}).strict(),n.object({op:n.literal("sessions.variables.create"),sessionId:b,key:Ve,value:sn,type:nn}).strict(),n.object({op:n.literal("sessions.variables.update"),sessionId:b,key:Ve,value:sn,type:nn}).strict(),n.object({op:n.literal("sessions.variables.delete"),sessionId:b,key:Ve}).strict(),n.object({op:n.literal("sessions.presence"),subscriptionId:n.string().regex(/^[a-f0-9]{1,64}$/),canNotify:n.boolean(),canNotifyKinds:n.array(n.enum(["complete","error"])).max(4),sessionId:n.string().regex(/^([a-f0-9]{12})?$/),window:n.object({exists:n.boolean(),focused:n.boolean(),visible:n.boolean(),minimized:n.boolean()}).strict()}).strict(),n.object({op:n.literal("legacy.models"),provider:n.string().max(128).optional(),sort:n.enum(["id","name","provider","recommended"]).optional(),direction:n.enum(["ascending","descending"]).optional()}).strict(),n.object({op:n.literal("legacy.models.providers")}).strict(),n.object({op:n.literal("auth.probe"),provider:u}).strict(),n.object({op:n.literal("legacy.agent.upload"),agentId:u}).strict(),n.object({op:n.literal("agent.publish"),agentId:u,document:un.optional(),...mt,visibility:n.literal("org").optional(),tenantId:u.optional()}).strict(),n.object({op:n.literal("agent.republish"),agentId:u,hubAgentId:u,expectedRemoteRevision:n.string().min(1).max(512).optional(),document:un.optional(),...mt,visibility:n.literal("org").optional(),tenantId:u.optional()}).strict(),n.object({op:n.literal("team.publish"),teamId:u,...mt,visibility:n.literal("org").optional(),tenantId:u.optional()}).strict(),n.object({op:n.literal("team.pull"),teamId:u,tenantId:u.optional()}).strict(),n.object({op:n.literal("agent.nameAvailability"),name:n.string().min(1).max(wt)}).strict(),n.object({op:n.literal("legacy.agents.list"),page:n.number().int().min(1).optional(),perPage:n.number().int().min(1).max(500).optional(),name:n.string().max(256).optional(),sort:n.string().max(64).optional(),direction:n.enum(["asc","desc"]).optional()}).strict(),n.object({op:n.literal("legacy.agent.get"),agentId:u}).strict(),n.object({op:n.literal("legacy.agent.history"),agentId:u,page:n.number().int().min(1).optional(),perPage:n.number().int().min(1).max(500).optional()}).strict(),n.object({op:n.literal("legacy.jobs.list"),agentId:u.optional(),status:n.string().max(64).optional()}).strict(),n.object({op:n.literal("legacy.job.get"),jobId:u}).strict(),n.object({op:n.literal("legacy.schedules.list"),page:n.number().int().min(1).optional(),perPage:n.number().int().min(1).max(100).optional()}).strict(),n.object({op:n.literal("legacy.agent.schedules.list"),agentId:u,page:n.number().int().min(1).optional(),perPage:n.number().int().min(1).max(100).optional()}).strict(),n.object({op:n.literal("legacy.agent.schedule.create"),agentId:u,schedule:rn.extend({prompt:n.string().max(64e3),interval:n.number().int().min(1),unit:tn})}).strict(),n.object({op:n.literal("legacy.schedule.get"),scheduleId:u}).strict(),n.object({op:n.literal("legacy.schedule.edit"),scheduleId:u,schedule:rn.extend({prompt:n.string().max(64e3).nullish(),interval:n.number().int().min(1).nullish(),unit:tn.nullish()})}).strict(),n.object({op:n.literal("legacy.schedule.remove"),scheduleId:u}).strict(),n.object({op:n.literal("legacy.agent.create"),agent:n.record(n.unknown())}).strict(),n.object({op:n.literal("legacy.agent.update"),agentId:u,update:n.record(n.unknown())}).strict(),n.object({op:n.literal("legacy.agent.delete"),agentId:u}).strict(),n.object({op:n.literal("legacy.agent.conversation.clear"),agentId:u}).strict(),n.object({op:n.literal("legacy.agent.systemPrompt.get"),agentId:u}).strict(),n.object({op:n.literal("legacy.agent.systemPrompt.update"),agentId:u,systemPrompt:n.string().max($i)}).strict(),n.object({op:n.literal("legacy.agent.download"),agentId:u}).strict(),n.object({op:n.literal("legacy.job.cancel"),jobId:u}).strict(),n.object({op:n.literal("commands.list")}).strict(),n.object({op:n.literal("commands.entities"),sessionId:b,command:u,name:n.string().max(128).optional()}).strict(),n.object({op:n.literal("models.catalogue"),live:n.boolean().optional(),scope:n.enum(["usable","all"]).optional()}).strict(),n.object({op:n.literal("usage.get"),provider:u.optional(),live:n.boolean().optional(),refresh:n.boolean().optional()}).strict(),n.object({op:n.literal("quota.notice"),provider:u.optional(),model:n.string().min(1).max(200).optional(),refresh:n.boolean().optional()}).strict(),n.object({op:n.literal("analytics.get"),sessionId:b.optional(),sinceMs:n.number().int().nonnegative().optional(),untilMs:n.number().int().nonnegative().optional(),days:n.number().int().min(1).max(366).optional()}).strict(),n.object({op:n.literal("analytics.models"),sessionId:b.optional(),sinceMs:n.number().int().nonnegative().optional(),untilMs:n.number().int().nonnegative().optional(),days:n.number().int().min(1).max(366).optional()}).strict(),n.object({op:n.literal("info.get")}).strict(),n.object({op:n.literal("sessions.report"),sessionId:b,recentLimit:n.number().int().min(0).max(50).optional()}).strict(),n.object({op:n.literal("skills.list"),sessionId:b.optional(),cwd:Ei.optional(),name:u.optional()}).strict(),n.object({op:n.literal("sessions.failovers"),sessionId:b}).strict(),n.object({op:n.literal("sessions.credential"),sessionId:b,action:n.enum(["list","store","forget"]),key:Ue.optional(),value:Ze.optional(),confirmed:n.boolean().optional()}).strict(),n.object({op:n.literal("sessions.fork"),sessionId:b,requestId:x,message:n.string().max(2e5).optional(),boundary:n.enum(["next_safe","at_entry"]).optional(),entryId:n.string().max(128).optional()}).strict(),n.object({op:n.literal("sessions.stop"),requestId:x,targets:n.array(b).min(1).max(100),confirmed:n.literal(!0)}).strict(),n.object({op:n.literal("sessions.aside"),sessionId:b,requestId:x,text:n.string().min(1).max(32768),asideId:x.optional(),subscriptionId:n.string().regex(Ht).optional()}).strict(),n.object({op:n.literal("sessions.adopt"),sessionId:b,requestId:x,asideId:x,confirmed:n.literal(!0)}).strict(),n.object({op:n.literal("sessions.aside.get"),sessionId:b,asideId:x}).strict(),n.object({op:n.literal("sessions.aside.close"),sessionId:b,asideId:x}).strict(),n.object({op:n.literal("wakes.list"),limit:n.number().int().min(1).max(500).optional(),includeDormant:n.boolean().optional()}).strict(),n.object({op:n.literal("wakes.create"),requestId:x,sessionId:b.optional(),cwd:n.string().min(1).max(4096).optional(),target:Ge.optional(),message:an,in:n.string().min(1).max(64).optional(),at:n.string().min(1).max(64).optional(),every:n.string().min(1).max(64).optional(),until:n.string().min(1).max(64).optional(),limit:n.number().int().min(1).optional(),title:n.string().min(1).max(200).optional()}).strict(),n.object({op:n.literal("wakes.edit"),sessionId:b,wakeId:on,message:an.optional(),in:n.string().min(1).max(64).optional(),at:n.string().min(1).max(64).optional(),every:n.string().min(1).max(64).optional(),until:n.string().min(1).max(64).optional(),limit:n.number().int().min(1).optional()}).strict(),n.object({op:n.literal("wakes.remove"),sessionId:b,wakeId:on}).strict(),n.object({op:n.literal("monitors.cancel"),sessionId:b,monitorId:Zi}).strict(),n.object({op:n.literal("jobs.cancel"),sessionId:b,jobId:Bi}).strict(),n.object({op:n.literal("mcp.list"),sessionId:b}).strict(),n.object({op:n.literal("mcp.credentials.store"),sessionId:b,name:n.string().min(1).max(256),values:n.record(n.string().min(1).max(128),n.string().min(1).max(32768)).refine(e=>Object.keys(e).length<=32&&Object.values(e).reduce((t,s)=>t+s.length,0)<=65536,{message:"Too many secret values, or too much secret text, for one MCP credential write."}),confirmedReplace:n.array(n.string().min(1).max(128)).max(32)}).strict(),n.object({op:n.literal("mcp.control"),sessionId:b,control:n.object({action:n.enum(["list","add","remove","reload","connect","probe","disconnect","login","logout","reauth","status","cancel"]),name:dt.optional(),scope:n.enum(["global","project"]).optional(),command:n.string().min(1).max(4096).optional(),args:n.array(n.string().max(8192)).max(128).optional(),env:n.record(Be).optional(),url:n.string().max(4096).optional(),headers:n.record(Be).optional(),oauth:n.boolean().optional(),confirmed:n.boolean().optional(),operation_id:Ft.optional()}).strict()}).strict(),n.object({op:n.literal("mcp.catalog"),cwd:pt.optional(),sessionId:b.optional()}).strict(),n.object({op:n.literal("mcp.catalog.control"),cwd:pt.optional(),control:n.object({action:n.enum(["add","remove","test","login","reauth","logout","status","cancel"]),name:dt.optional(),scope:n.enum(["global","project"]).optional(),command:n.string().min(1).max(4096).optional(),args:n.array(n.string().max(8192)).max(128).optional(),env:n.record(Be).optional(),url:n.string().max(4096).optional(),headers:n.record(Be).optional(),confirmed:n.boolean().optional(),operation_id:Ft.optional()}).strict()}).strict(),n.object({op:n.literal("mcp.catalog.credentials"),header:n.string().min(1).max(128).optional(),cwd:pt.optional(),name:dt,values:n.record(n.string().min(1).max(128),n.string().min(1).max(32768)).refine(e=>Object.keys(e).length<=32&&Object.values(e).reduce((t,s)=>t+s.length,0)<=65536,{message:"Too many secret values, or too much secret text, for one MCP credential write."}),confirmedReplace:n.array(n.string().min(1).max(128)).max(32)}).strict(),n.object({op:n.literal("radient.request"),control:n.object({operation:n.enum(["account","prices","credits","usage","provision","application.create","agents.list","agents.get","agents.create","agents.update","agents.delete","agents.like","agents.unlike","agents.liked","agents.like_count","agents.favourite","agents.unfavourite","agents.favourited","agents.favourite_count","agents.download_count","agents.statuses","comments.list","comments.create","comments.update","comments.delete","account.agents","memberships.list","org_agents.list","org_team.get","org_teams.list","org_skills.list","org_skill.get","signup.resend"]),request_id:x.optional(),tenant_id:u.optional(),account_id:u.optional(),agent_id:u.optional(),comment_id:u.optional(),team_id:u.optional(),skill_id:u.optional(),query:n.record(n.union([n.string().max(1024),n.number().int()])).optional(),payload:n.record(n.unknown()).optional(),confirmed:n.boolean().optional()}).strict()}).strict(),n.object({op:n.literal("providers.list")}).strict(),n.object({op:n.literal("accounts.list")}).strict(),n.object({op:n.literal("accounts.remove"),accountId:n.number().int().positive(),confirmed:n.literal(!0)}).strict(),n.object({op:n.literal("tunnel.setup.read"),credentialId:n.number().int().positive().optional()}).strict(),n.object({op:n.literal("tunnel.setup.plan"),credentialId:n.number().int().positive().optional()}).strict(),n.object({op:n.literal("tunnel.setup.run"),credentialId:n.number().int().positive(),acceptMonthlyPrice:n.string().min(1).max(64).optional()}).strict(),n.object({op:n.literal("auth.start"),provider:u}).strict(),n.object({op:n.literal("auth.status"),id:u}).strict(),n.object({op:n.literal("auth.input"),id:u,promptId:u,value:Ze}).strict(),n.object({op:n.literal("auth.cancel"),id:u}).strict(),n.object({op:n.literal("auth.key"),provider:u,value:Ze}).strict(),n.object({op:n.literal("auth.logout"),provider:u}).strict(),n.object({op:n.literal("agent_messages.status"),boundary:_i}).strict(),n.object({op:n.literal("agent_messages.enable"),expected_account_id:u,tenant_id:u,state:n.literal("active"),consent_version:n.string().min(1).max(128),consented_via:n.literal("dialog")}).strict(),n.object({op:n.literal("agent_messages.settings"),tenant_id:u.optional()}).strict(),n.object({op:n.literal("agent_messages.settings.put"),expected_account_id:u,tenant_id:u.optional(),consent_version:n.string().min(1).max(128).optional(),consented_via:n.enum(["dialog","settings"]).optional(),label:n.string().min(1).max(128).optional(),state:n.enum(["active","paused","disabled"])}).strict(),n.object({op:n.literal("agent_messages.allowlist.get"),tenant_id:u.optional()}).strict(),n.object({op:n.literal("agent_messages.allowlist.put"),expected_account_id:u,tenant_id:u.optional(),entries:n.array(n.object({direction:n.enum(["send","receive"]),effect:n.enum(["allow","deny"]),target:n.object({endpoint_id:u.optional(),account_id:u.optional()}).strict().refine(e=>!!e.endpoint_id!=!!e.account_id,"An allowlist target names exactly one of endpoint_id or account_id")}).strict()).max(200)}).strict(),n.object({op:n.literal("team_bridge.conversations.list"),scope:n.literal("account").optional(),tenant_id:u.optional(),limit:n.number().int().min(1).max(100).optional(),cursor:n.string().min(1).max(64).optional(),before:n.string().min(1).max(64).optional()}).strict(),n.object({op:n.literal("team_bridge.conversations.get"),conversation_id:u,tenant_id:u.optional()}).strict(),n.object({op:n.literal("team_bridge.conversations.create"),tenant_id:u.optional(),kind:n.enum(["dm","group","channel"]),name:n.string().min(1).max(128).optional(),topic:n.string().min(1).max(512).optional(),visibility:n.enum(["private","tenant"]).optional(),agent_capable:n.boolean().optional(),members:n.array(n.object({account_id:u,kind:n.enum(["human","agent"]),endpoint_id:u.optional(),display_label:n.string().min(1).max(64)}).strict()).max(500)}).strict(),n.object({op:n.literal("team_bridge.conversations.lifecycle"),conversation_id:u,action:n.enum(["archive","unarchive","join","leave"])}).strict(),n.object({op:n.literal("team_bridge.conversations.join"),conversation_id:u,tenant_id:u.optional()}).strict(),n.object({op:n.literal("team_bridge.conversations.notify"),conversation_id:u,tenant_id:u.optional(),notify:n.enum(["all","mention","mute"])}).strict(),n.object({op:n.literal("team_bridge.conversations.members.add"),conversation_id:u,tenant_id:u.optional(),members:n.array(n.object({account_id:u,kind:n.enum(["human","agent"]),endpoint_id:u.optional(),display_label:n.string().min(1).max(64)}).strict()).min(1).max(500)}).strict(),n.object({op:n.literal("team_bridge.conversations.members.remove"),conversation_id:u,account_id:u}).strict(),n.object({op:n.literal("team_bridge.conversations.consent"),conversation_id:u,account_id:u,decision:n.enum(["accept","decline"]),consent_version:n.string().min(1).max(128),tenant_id:u.optional()}).strict(),n.object({op:n.literal("team_bridge.messages.list"),conversation_id:u,tenant_id:u.optional(),limit:n.number().int().min(1).max(100).optional(),before_seq:n.number().int().nonnegative().optional(),endpoint_id:u.optional()}).strict(),n.object({op:n.literal("team_bridge.messages.send"),conversation_id:u,tenant_id:u.optional(),client_ref:u,body:n.string().min(1),agent_label:n.string().min(1).max(64).optional()}).strict(),n.object({op:n.literal("team_bridge.read"),conversation_id:u,tenant_id:u.optional(),seq:n.number().int().nonnegative().optional(),muted:n.boolean().optional()}).strict(),n.object({op:n.literal("team_bridge.unread"),scope:n.literal("account").optional(),tenant_id:u.optional()}).strict(),n.object({op:n.literal("settings.list")}).strict(),n.object({op:n.literal("settings.edit"),key:Ue,value:n.unknown().refine(e=>e!==void 0,"A setting value is required."),base:Di.optional()}).strict(),n.object({op:n.literal("settings.reset"),key:Ue}).strict(),n.object({op:n.literal("tts.paths")}).strict(),n.object({op:n.literal("config.get")}).strict(),n.object({op:n.literal("config.update"),value:Gi}).strict(),n.object({op:n.literal("instructions.get")}).strict(),n.object({op:n.literal("instructions.update"),content:n.string().max(64e3)}).strict(),n.object({op:n.literal("credentials.list")}).strict(),n.object({op:n.literal("credentials.update"),key:Ue,value:Ze}).strict(),n.object({op:n.literal("peers.list")}).strict(),n.object({op:n.literal("networks.list")}).strict(),n.object({op:n.literal("networks.invite"),networkId:se,role:n.enum(["read","drive","admin"]),deviceId:se.optional()}).strict(),n.object({op:n.literal("networks.member.remove"),networkId:se,deviceId:se,confirm:n.string().min(1).max(256)}).strict(),n.object({op:n.literal("sessions.transfer"),sessionId:b,to:n.union([n.literal("local"),se]),keep:n.boolean().optional(),waitS:n.number().min(0).max(300).optional(),requestId:x.optional()}).strict(),n.object({op:n.literal("approvals.list")}).strict(),n.object({op:n.literal("approvals.approve"),approvalId:Wt}).strict(),n.object({op:n.literal("approvals.deny"),approvalId:Wt}).strict(),n.object({op:n.literal("asks.list")}).strict(),n.object({op:n.literal("projects.list")}).strict(),n.object({op:n.literal("projects.get"),key:F}).strict(),n.object({op:n.literal("projects.create"),name:ht,description:n.string().max(fn).optional(),status:mn.optional(),tags:hn.optional()}).strict(),n.object({op:n.literal("projects.update"),key:F,fields:n.object({name:ht.optional(),title:n.string().max(80).optional(),owner:n.string().max(80).optional(),team:n.string().max(80).optional(),description:n.string().max(fn).optional(),status:mn.optional(),progress:n.string().max(ra).optional(),tags:hn.optional(),start_date:Fe.optional(),target_date:Fe.optional(),completed_at:Fe.optional(),estimate:n.number().positive().max(1e3).optional(),estimate_unit:n.enum(["points","days"]).optional()}).strict(),force_done:n.boolean().optional()}).strict(),n.object({op:n.literal("projects.delete"),key:F,confirmed_name:ht}).strict(),n.object({op:n.literal("projects.link"),key:F,sessionId:b}).strict(),n.object({op:n.literal("projects.unlink"),key:F,sessionId:b}).strict(),n.object({op:n.literal("projects.milestone"),key:F,name:n.string().min(1).max(gn),targetDate:Fe.optional(),completed:n.boolean().optional()}).strict(),n.object({op:n.literal("projects.milestone.remove"),key:F,name:n.string().min(1).max(gn)}).strict(),n.object({op:n.literal("projects.request_update"),key:F}).strict(),n.object({op:n.literal("projects.search"),q:n.string().min(1).max(ca),limit:n.number().int().min(1).max(da).optional()}).strict(),n.object({op:n.literal("aida.status")}).strict(),n.object({op:n.literal("aida.control"),action:n.enum(["open","pause","resume","greet","status"])}).strict(),n.object({op:n.literal("code_requests.list"),sessionId:b}).strict(),n.object({op:n.literal("code_requests.refresh"),sessionId:b,keys:n.array(n.string().min(1).max(512)).max(256).optional(),force:n.boolean().optional()}).strict(),n.object({op:n.literal("static.sign"),route:n.enum(["images","videos","audio","html"]),path:n.string().min(1),ttlS:n.number().int().min(1).max(3600).optional()}).strict(),n.object({op:n.literal("library.list"),scope:n.enum(["final","all"]).optional(),q:n.string().max(512).optional(),category:n.string().min(1).max(64).optional(),kind:n.string().min(1).max(64).optional(),origin_group:n.enum(["generated","created","mentioned"]).optional(),origin:n.string().min(1).max(64).optional(),tag:n.string().min(1).max(128).optional(),tag_mode:n.enum(["all","any"]).optional(),highlighted:n.boolean().optional(),organized:n.boolean().optional(),favorite:n.boolean().optional(),session:n.string().min(1).max(12).optional(),session_id:n.string().min(1).max(512).optional(),sort:n.enum(["recent","name","kind","size","created","modified","organized"]).optional(),order:n.enum(["asc","desc"]).optional(),limit:n.number().int().min(1).max(200).optional(),cursor:n.string().max(512).optional()}).strict(),n.object({op:n.literal("library.get"),id:ue}).strict(),n.object({op:n.literal("library.update"),id:ue,fields:n.object({name:n.string().max(200).optional(),description:n.string().max(2e3).optional(),favorite:n.boolean().optional(),locked:n.boolean().optional(),archived:n.boolean().optional()}).strict()}).strict(),n.object({op:n.literal("library.tags")}).strict(),n.object({op:n.literal("library.tags.create"),name:n.string().trim().min(1).max(24),category:n.string().min(1).max(64).optional()}).strict(),n.object({op:n.literal("library.tags.update"),id:me,name:n.string().trim().min(1).max(24).optional(),category:n.string().min(1).max(64).optional()}).strict(),n.object({op:n.literal("library.tags.delete"),id:me}).strict(),n.object({op:n.literal("library.tags.merge"),id:me,into:me}).strict(),n.object({op:n.literal("library.tags.assign"),id:ue,tags:n.array(me).max(64),primary:n.string().max(128).optional()}).strict(),n.object({op:n.literal("library.chat.link"),id:ue,sessionId:b}).strict(),n.object({op:n.literal("library.chat.clear"),id:ue}).strict(),n.object({op:n.literal("library.librarian"),action:n.enum(["status","open","pause","resume","run"]).optional()}).strict()]);ua.superRefine((e,t)=>{if(e.op==="hub.skillPull"||e.op==="hub.skillPublish"){if(e.visibility==="public"&&e.tenantId!==null||e.visibility==="org"&&!e.tenantId){t.addIssue({code:n.ZodIssueCode.custom,message:"A skill destination requires explicit paired scope",path:["tenantId"]});return}if(e.op==="hub.skillPublish"&&(e.dryRun?e.previewReceipt!==void 0||e.confirmPublish!==void 0:!e.previewReceipt||e.confirmPublish!==!0)){t.addIssue({code:n.ZodIssueCode.custom,message:"An initial skill publication requires its reviewed draft receipt",path:["previewReceipt"]});return}}if(e.op==="hub.check"||e.op==="hub.apply"||e.op==="hub.retry"){const s=e.linkId!==void 0,i=e.kind!==void 0||e.name!==void 0;if(s&&i||e.op!=="hub.check"&&!s&&(!e.kind||!e.name)||e.op==="hub.retry"&&s&&!e.direction||e.direction==="push"&&!s){t.addIssue({code:n.ZodIssueCode.custom,message:"A hub action requires one unambiguous selector and an explicit retry direction",path:["linkId"]});return}}if(e.op==="hub.apply"&&(e.previewReceipt!==void 0||e.confirmApply!==void 0)&&(!e.linkId||e.dryRun||!e.previewReceipt||e.confirmApply!==!0)){t.addIssue({code:n.ZodIssueCode.custom,message:"A viewed incoming application requires its scoped preview receipt and confirmation",path:["previewReceipt"]});return}if(e.op==="hub.apply"&&e.resolveSource===!0){const s=e.visibility==="public"&&e.tenantId===null||e.visibility==="org"&&typeof e.tenantId=="string"&&e.tenantId.length>0;if(!e.hubSource||!s||e.acknowledgeUnknownBaseline!==!0||e.linkId!==void 0||e.previewReceipt!==void 0||e.confirmApply!==void 0||e.prefer!==void 0){t.addIssue({code:n.ZodIssueCode.custom,message:"Confirming a source requires its exact stated destination and the unknown-baseline acknowledgement, with no link, preview or preference",path:["hubSource"]});return}}if(e.op==="hub.push"&&(e.dryRun?e.previewReceipt!==void 0||e.confirmPublish!==void 0:!e.previewReceipt||e.confirmPublish!==!0)){t.addIssue({code:n.ZodIssueCode.custom,message:"A confirmed publication requires its reviewed preview receipt",path:["previewReceipt"]});return}if(e.op==="hub.policy"&&e.subscribe===void 0&&e.autoPush===void 0){t.addIssue({code:n.ZodIssueCode.custom,message:"A hub policy change must name subscribe or autoPush",path:["subscribe"]});return}if((e.op==="team_bridge.conversations.list"||e.op==="team_bridge.unread")&&e.scope==="account"&&e.tenant_id!==void 0){t.addIssue({code:n.ZodIssueCode.custom,message:"An account-scoped read cannot name a tenant",path:["scope"]});return}if(e.op==="team_bridge.conversations.list"&&e.scope==="account"&&e.before!==void 0){t.addIssue({code:n.ZodIssueCode.custom,message:"An account-scoped page uses cursor, not before",path:["before"]});return}if(e.op==="sessions.answer"){if(e.askId!==void 0){e.askId||t.addIssue({code:n.ZodIssueCode.custom,message:"ask_id must be a non-empty string",path:["askId"]}),e.decline!==!0&&!e.answers?t.addIssue({code:n.ZodIssueCode.custom,message:"A queued-ask answer needs answers or decline",path:["answers"]}):e.decline===!0&&e.answers!==void 0?t.addIssue({code:n.ZodIssueCode.custom,message:"Supply either answers or decline",path:["decline"]}):e.revise===!0&&e.decline===!0?t.addIssue({code:n.ZodIssueCode.custom,message:"Supply either decline or revise",path:["revise"]}):e.answers!==void 0&&Object.keys(e.answers).length===0&&t.addIssue({code:n.ZodIssueCode.custom,message:"answers must name at least one question",path:["answers"]});return}e.epoch||t.addIssue({code:n.ZodIssueCode.custom,message:"An epoch is required to answer a gate",path:["epoch"]}),e.requestId||t.addIssue({code:n.ZodIssueCode.custom,message:"A request id is required to answer a gate",path:["requestId"]}),e.revise===!0&&t.addIssue({code:n.ZodIssueCode.custom,message:"revise applies to a queued ask",path:["revise"]});return}if(e.op==="sessions.create"&&e.purpose===void 0){e.cwd===void 0&&t.addIssue({code:n.ZodIssueCode.custom,message:"A conversation needs a working directory: only a configuration run (`purpose`) may omit `cwd`.",path:["cwd"]});return}if(e.op==="sessions.create"&&e.purpose!==void 0){for(const s of["cwd","target","model","draftId"])e[s]!==void 0&&t.addIssue({code:n.ZodIssueCode.custom,message:`A configuration run resolves its own \`${s}\`: send \`purpose\` alone.`,path:[s]});return}if(!(e.op!=="agent.publish"&&e.op!=="agent.republish"&&e.op!=="team.publish")){if((e.subscribe!==void 0||e.autoPush!==void 0||e.confirmPublicEgress!==void 0)&&!e.requestId){t.addIssue({code:n.ZodIssueCode.custom,message:"Initial link policy needs a durable publication request ID",path:["requestId"]});return}e.visibility==="org"!=!!e.tenantId&&t.addIssue({code:n.ZodIssueCode.custom,message:'A publication target needs both `visibility: "org"` and `tenantId`, or neither: one half would publish to the public hub.'})}});const J={noCredential:"pairing.no-credential",refused:"pairing.refused",planeClosed:"pairing.plane-closed",transportFailed:"transport.failed"},Er={runtimeUnreachable:"runtime_unreachable"},Rr="runtime_busy",Pr="runtime_retiring";n.object({data:n.object({aside_id:n.string().optional(),status:n.union([n.enum(["adopted","queued"]),n.string()]).optional()}).passthrough()}).passthrough();const Or="aside_adopt_refused",ma=["session_closed","open_tool_batch","turn_running"];function Cr(e){if(typeof e!="object"||e===null)return;const t=e.reason;return ma.find(s=>s===t)}const jr={[J.noCredential]:"This app is not paired with the running Local Operator server, so this control is unavailable.",[J.refused]:"This app's credential for the running Local Operator server was refused, so this control is unavailable.",[J.planeClosed]:"The running Local Operator server does not accept this app's desktop controls.",[J.transportFailed]:"The Local Operator server did not answer this request."},Ar={noCredential:"Restart with a desktop-managed backend to use these controls.",transportFailed:"The backend could not complete this request. Check its connection and try again."};function $r(e){return e!==void 0&&Object.values(J).includes(e)}function Nr(e,t){if(e.startsWith("/v1/desktop/")){if(t===401||t===403)return J.refused;if(t===503)return J.planeClosed}}const Mr=n.object({step:n.string(),blocked_on:n.string(),configured:n.boolean(),ready:n.boolean(),verified:n.boolean(),url:n.string().nullable(),credential_id:n.number().int().positive().nullable(),identity_label:n.string().nullable(),credential_choices:n.array(n.object({id:n.number().int().positive(),identity_label:n.string().nullable().optional()}).passthrough()).default([]),quote:n.object({monthly_price_usd:n.string().nullable(),positive_balance:n.boolean(),eligible:n.boolean(),account_valid:n.boolean()}).passthrough().nullable(),receipts:n.array(n.object({step:n.string(),ok:n.boolean(),text:n.string()})).default([]),remedy:n.object({kind:n.string(),text:n.string(),command:n.string().nullable().optional(),url:n.string().nullable().optional()}).nullable(),source:n.string(),in_progress:n.boolean().default(!1),progress:n.array(n.string()).default([]),active_credential_id:n.number().int().positive().nullable().default(null),billing_outcome:n.string().optional(),reservation_outcome:n.string().optional(),failure_stage:n.string().optional()}).passthrough(),Dr=new Set(["setup_in_progress","setup_deadline","setup_unavailable","setup_intent_corrupt"]),ha=88e4,fa=11e5,ga=2e4,ba=9e4,va=new Set(["analytics.get","analytics.models","sessions.report"]),_a=new Set(["usage.get"]),ya=new Set(["networks.list","peers.list"]),ka=new Set([...va,..._a,...ya]),Sa=90,wa=30,Ia=300,xa=10,zn=15,Ta=1e4;function Ea(e){const s=e.to==="local"||e.keep?Ia:wa,i=Math.max(0,e.waitS??0);return(Sa+s+xa+zn)*1e3+i*1e3}const Ra=18e4,Pa=Ra+15e3,Oa=120,Ca=135e3,ja=93e4,Fn=(Oa+30+zn)*1e3,Aa=6e4,$a=5*Fn,Na=new Set(["hub.apply","hub.retry","hub.push","hub.skillPublish","hub.skillPull","hub.check","hub.applyAll"]);function Ma(e){switch(e){case"hub.apply":case"hub.retry":case"hub.push":case"hub.skillPublish":case"hub.skillPull":return Fn;case"hub.check":return Aa;case"hub.applyAll":return $a;default:return null}}function Da(e){if(typeof e!="string"&&e.op==="sessions.transfer")return Ea(e)+Ta;const t=typeof e=="string"?e:e.op;if(t==="approvals.approve")return Pa;if(t==="tunnel.setup.run")return ja;if(t==="tunnel.setup.plan")return Ca;const s=Ma(t);return s!==null?s:ka.has(t)?ba:ga}const La=5e3;function Lr(e){return Da(e)+La}const Ua="deadline_exceeded",Ur="foreground_required",Zr="View these completions in the foreground before marking them read.",Za=new Set(["capabilities","agent_messages.status","agent_messages.settings","agent_messages.allowlist.get","team_bridge.conversations.list","team_bridge.conversations.get","team_bridge.messages.list","team_bridge.unread","accounts.list","analytics.get","analytics.models","approvals.list","commands.entities","commands.list","config.get","credentials.list","hub.updates","hub.links","info.get","instructions.get","legacy.agent.get","legacy.agent.history","legacy.agent.schedules.list","legacy.agents.list","legacy.job.get","legacy.jobs.list","legacy.models","legacy.models.providers","legacy.schedule.get","legacy.schedules.list","mcp.catalog","mcp.list","models.catalogue","networks.list","peers.list","profiles.get","profiles.list","projects.search","providers.list","quota.notice","runtimes.list","sessions.aside.get","sessions.checkpoints","sessions.failovers","sessions.find","sessions.get","sessions.history","sessions.files","sessions.list","sessions.preview","sessions.report","sessions.search","sessions.variables.list","skills.list","subagents.transcript","teams.effective","teams.get","teams.list","tunnel.setup.plan","tunnel.setup.read","usage.get"]),Ba=new Set(["analytics.get","analytics.models","networks.list","peers.list","usage.get","sessions.report","info.get","sessions.failovers"]);function Br(e,t){const s=Math.round(t/1e3),i=Ua;return e==="sessions.transfer"?{code:i,message:`The app waits up to ${s} seconds for a move, and it was still running when the app stopped waiting. The move was asked for, so its outcome is unknown from here: read the session again before moving it anywhere else.`}:e==="approvals.approve"?{code:i,message:`The app waits up to ${s} seconds for an approval, and the signing prompt was still open when it stopped waiting. The request was sent, so the decision may or may not have landed: read the approvals again — if the record still waits, answering it again is safe, because the store keeps the first decision and refuses a second.`}:Na.has(e)?{code:i,message:"This is taking longer than expected. It may still finish; the mark will update."}:Za.has(e)?{code:i,message:Ba.has(e)?`The app waits up to ${s} seconds for this panel's data, and the read was still running when the app stopped waiting. Nothing was read; reopen the panel to ask again.`:`The app waits up to ${s} seconds for this read, and it was still running when the app stopped waiting. Nothing was read; ask again.`}:{code:i,message:`The app waits up to ${s} seconds for this request, and it was still running when the app stopped waiting. It may or may not have reached the server; check the result before repeating it.`}}const Gr=ha,zr=fa;n.object({state:n.enum(["ok","depleted","limit_reached","unverified","unknown","not_applicable"]),provider:n.string(),kind:n.enum(["balance","subscription","radient","none"]),model_free:n.boolean(),title:n.string(),body:n.string(),actions:n.array(n.object({id:n.enum(["open_url","resend_verification","refresh"]),label:n.string(),url:n.string().nullable().optional()})),resets_at_ms:n.number().int().nullable().optional(),checked_at_ms:n.number().int(),age_ms:n.number().int().nullable().optional(),source:n.enum(["cached","live"])});function Ga(e){return e.sessionId?{session_id:e.sessionId}:{...e.cwd?{cwd:e.cwd}:{},...e.target?{target:e.target}:{}}}function bn(e){return{...e.in!==void 0?{in:e.in}:{},...e.at!==void 0?{at:e.at}:{},...e.every!==void 0?{every:e.every}:{},...e.until!==void 0?{until:e.until}:{},...e.limit!==void 0?{limit:e.limit}:{}}}function ft(e){return{...e.requestId?{request_id:e.requestId}:{},...e.subscribe!==void 0?{subscribe:e.subscribe}:{},...e.autoPush!==void 0?{auto_push:e.autoPush}:{},...e.confirmPublicEgress!==void 0?{confirm_public_egress:e.confirmPublicEgress}:{}}}function gt(e){if(e.visibility==="org"!=!!e.tenantId)throw new Error('A publication target needs both `visibility: "org"` and `tenantId`, or neither: one half would publish to the public hub.')}function vn(e){return{sources:e.sources??null,session_ids:e.sessionIds??{},all:e.all??!1,include_subagents:e.includeSubagents??!1,include_cleared_segments:e.includeClearedSegments??!1,include_memory:e.includeMemory??!0,include_instructions:e.includeInstructions??!0,...e.maxSessions===void 0?{}:{max_sessions:e.maxSessions}}}function bt(e){return e===void 0?"":`?tenant_id=${encodeURIComponent(e)}`}function Fr(e){switch(e.op){case"capabilities":return{path:"/v1/capabilities",method:"GET"};case"runtimes.list":return{path:"/v1/desktop/runtimes?probe=false",method:"GET"};case"peers.list":return{path:"/v1/desktop/peers",method:"GET"};case"networks.list":return{path:"/v1/desktop/networks",method:"GET"};case"asks.list":return{path:"/v1/desktop/asks",method:"GET"};case"networks.invite":return{path:`/v1/desktop/networks/${encodeURIComponent(e.networkId)}/invite`,method:"POST",body:{role:e.role,device:e.deviceId??null}};case"networks.member.remove":return{path:`/v1/desktop/networks/${encodeURIComponent(e.networkId)}/members/${encodeURIComponent(e.deviceId)}`,method:"DELETE",body:{confirm:e.confirm}};case"sessions.transfer":return{path:`/v1/desktop/sessions/${encodeURIComponent(e.sessionId)}/transfer`,method:"POST",body:{to:e.to,keep:e.keep??!1,wait_s:e.waitS??0,...e.requestId?{request_id:e.requestId}:{}}};case"approvals.list":return{path:"/v1/desktop/approvals",method:"GET"};case"approvals.approve":return{path:`/v1/desktop/approvals/${encodeURIComponent(e.approvalId)}/approve`,method:"POST"};case"approvals.deny":return{path:`/v1/desktop/approvals/${encodeURIComponent(e.approvalId)}/deny`,method:"POST"};case"profiles.list":return{path:"/v1/desktop/profiles",method:"GET"};case"profiles.get":return{path:`/v1/desktop/profiles/${encodeURIComponent(e.name)}`,method:"GET"};case"profiles.install":return{path:"/v1/desktop/profiles/install",method:"POST",body:{request_id:e.requestId,name:e.name}};case"imports.sources":return{path:"/v1/desktop/imports/sources",method:"GET"};case"imports.sessions":{const t=new URLSearchParams({source:e.source});return e.includeSubagents&&t.set("include_subagents","true"),{path:`/v1/desktop/imports/sessions?${t.toString()}`,method:"GET"}}case"imports.preview":return{path:"/v1/desktop/imports/preview",method:"POST",body:vn(e)};case"imports.start":return{path:"/v1/desktop/imports/jobs",method:"POST",body:vn(e)};case"imports.status":return{path:`/v1/desktop/imports/jobs/${encodeURIComponent(e.jobId)}`,method:"GET"};case"imports.cancel":return{path:`/v1/desktop/imports/jobs/${encodeURIComponent(e.jobId)}`,method:"DELETE"};case"profiles.create":return{path:"/v1/desktop/profiles",method:"POST",body:{request_id:e.requestId,name:e.name,...e.fields}};case"profiles.update":return{path:`/v1/desktop/profiles/${encodeURIComponent(e.name)}`,method:"PATCH",body:{request_id:e.requestId,...e.fields,...e.expectedDefinitionRevision!==void 0&&e.expectedDefinitionRevision!==null?{expected_definition_revision:e.expectedDefinitionRevision}:{}}};case"hub.updates":return{path:"/v1/desktop/hub/updates",method:"GET"};case"hub.skillPull":return{path:"/v1/desktop/hub/skills/pull",method:"POST",body:{request_id:e.requestId,hub_id:e.hubId,hub_source:e.hubSource,visibility:e.visibility,tenant_id:e.tenantId,local_alias:e.localAlias,...e.subscribe!==void 0?{subscribe:e.subscribe}:{},...e.autoPush!==void 0?{auto_push:e.autoPush}:{},...e.confirmPublicEgress!==void 0?{confirm_public_egress:e.confirmPublicEgress}:{}}};case"hub.skillPublish":return{path:"/v1/desktop/hub/skills/publish",method:"POST",body:{request_id:e.requestId,dry_run:e.dryRun,source_skill:e.sourceSkill,local_alias:e.localAlias,visibility:e.visibility,tenant_id:e.tenantId,subscribe:e.subscribe,auto_push:e.autoPush,confirm_public_egress:e.confirmPublicEgress,...e.previewReceipt?{preview_receipt:e.previewReceipt}:{},...e.confirmPublish?{confirm_publish:!0}:{}}};case"hub.links":return{path:`/v1/desktop/hub/links${e.kind?`?kind=${e.kind}`:""}`,method:"GET"};case"hub.policy":return{path:`/v1/desktop/hub/links/${encodeURIComponent(e.linkId)}`,method:"PATCH",body:{request_id:e.requestId,expected_policy_revision:e.expectedPolicyRevision,...e.subscribe!==void 0?{subscribe:e.subscribe}:{},...e.autoPush!==void 0?{auto_push:e.autoPush}:{},...e.confirmPublicEgress!==void 0?{confirm_public_egress:e.confirmPublicEgress}:{}}};case"hub.check":return{path:"/v1/desktop/hub/updates/check",method:"POST",body:{request_id:e.requestId,...e.linkId?{link_id:e.linkId}:{},...e.direction?{direction:e.direction}:{},...e.kind?{kind:e.kind}:{},...e.name?{name:e.name}:{}}};case"hub.apply":return{path:"/v1/desktop/hub/updates/apply",method:"POST",body:{request_id:e.requestId,...e.previewReceipt?{preview_receipt:e.previewReceipt}:{},...e.confirmApply?{confirm_apply:!0}:{},...e.linkId?{link_id:e.linkId}:{},...e.direction?{direction:e.direction}:{},...e.kind?{kind:e.kind}:{},...e.name?{name:e.name}:{},...e.prefer?{prefer:e.prefer}:{},...e.acknowledgeUnknownBaseline!==void 0?{acknowledge_unknown_baseline:e.acknowledgeUnknownBaseline}:{},...e.dryRun!==void 0?{dry_run:e.dryRun}:{},...e.resolveSource===!0?{resolve_source:!0,hub_source:e.hubSource,visibility:e.visibility,tenant_id:e.tenantId??null}:{}}};case"hub.applyAll":return{path:"/v1/desktop/hub/updates/apply-all",method:"POST",body:{request_id:e.requestId,...e.kind?{kind:e.kind}:{}}};case"hub.retry":return{path:"/v1/desktop/hub/updates/retry",method:"POST",body:{request_id:e.requestId,...e.linkId?{link_id:e.linkId}:{},...e.direction?{direction:e.direction}:{},...e.kind?{kind:e.kind}:{},...e.name?{name:e.name}:{}}};case"hub.push":return{path:"/v1/desktop/hub/updates/push",method:"POST",body:{request_id:e.requestId,link_id:e.linkId,direction:e.direction,dry_run:e.dryRun,...e.previewReceipt?{preview_receipt:e.previewReceipt}:{},...e.confirmPublish?{confirm_publish:!0}:{}}};case"teams.list":return{path:"/v1/desktop/teams",method:"GET"};case"teams.get":return{path:`/v1/desktop/teams/${encodeURIComponent(e.name)}`,method:"GET"};case"teams.effective":return{path:`/v1/desktop/teams/${encodeURIComponent(e.name)}/effective`,method:"GET"};case"teams.create":return{path:"/v1/desktop/teams",method:"POST",body:{request_id:e.requestId,...e.fields}};case"teams.update":return{path:`/v1/desktop/teams/${encodeURIComponent(e.name)}`,method:"PATCH",body:{request_id:e.requestId,...e.fields,...e.expectedDefinitionRevision!==void 0&&e.expectedDefinitionRevision!==null?{expected_definition_revision:e.expectedDefinitionRevision}:{}}};case"sessions.list":{const t=new URLSearchParams;return t.set("limit",String(e.limit??100)),e.include_archived&&t.set("include_archived","true"),e.scope_kind&&t.set("scope_kind",e.scope_kind),e.scope_name&&t.set("scope_name",e.scope_name),e.cursor&&t.set("cursor",e.cursor),e.with_counts&&t.set("with_counts","true"),e.include_peers&&t.set("include_peers","true"),e.sort&&t.set("sort",e.sort),{path:`/v1/desktop/sessions?${t}`,method:"GET"}}case"delegated_cleanup_notice.ack":return{path:"/v1/desktop/delegated-cleanup-notice/ack",method:"POST"};case"sessions.search":{const t=new URLSearchParams({q:e.q,limit:String(e.limit??Oi)});return e.include_archived&&t.set("include_archived","true"),{path:`/v1/desktop/sessions/search?${t}`,method:"GET"}}case"sessions.archive":return{path:`/v1/desktop/sessions/${e.sessionId}/archive`,method:"POST",body:{archived:e.archived}};case"sessions.delete":return{path:`/v1/desktop/sessions/${e.sessionId}`,method:"DELETE",body:{confirmed:!0}};case"sessions.create":return{path:"/v1/desktop/sessions",method:"POST",body:{request_id:e.requestId,...e.cwd!==void 0?{cwd:e.cwd}:{},...e.peer?{peer:e.peer}:{},...e.target?{target:e.target}:{},...e.model?{model:e.model}:{},...e.draftId?{draft_id:e.draftId}:{},...e.purpose?{purpose:e.purpose}:{}}};case"sessions.preview":return{path:"/v1/desktop/sessions/preview",method:"POST",body:{request_id:e.requestId,cwd:e.cwd,...e.target?{target:e.target}:{},...e.model?{model:e.model}:{}}};case"sessions.draft":return{path:"/v1/desktop/sessions/draft",method:"POST",body:{request_id:e.requestId,cwd:e.cwd,...e.target?{target:e.target}:{},...e.model?{model:e.model}:{}}};case"sessions.get":{const t=new URLSearchParams;return e.journalOrder&&(t.set("journal_order","1"),e.peerJournalSource&&t.set("peer_journal_source","1"),St(t,`/v1/desktop/sessions/${e.sessionId}`,e.orderIds??[])),{path:`/v1/desktop/sessions/${e.sessionId}${t.size?`?${t}`:""}`,method:"GET"}}case"sessions.files":{const t=new URLSearchParams({limit:String(e.limit??200)});for(const s of["scope","kind","q","sort","order","cursor"]){const i=e[s];i!==void 0&&t.set(s,i)}return{path:`/v1/desktop/sessions/${encodeURIComponent(e.sessionId)}/files?${t}`,method:"GET"}}case"sessions.files.materialise":return{path:`/v1/desktop/sessions/${encodeURIComponent(e.sessionId)}/files/${encodeURIComponent(e.fileId)}/materialise`,method:"POST"};case"sessions.history":{const t=new URLSearchParams({limit:String(e.limit??100)});return e.beforeId&&t.set("before_id",e.beforeId),e.openFrame&&(t.set("open_frame","1"),t.set("supplements","1")),e.journalOrder&&(t.set("journal_order","1"),e.peerJournalSource&&t.set("peer_journal_source","1"),e.sourceRead==="metadata"?t.set("source_read","metadata"):e.sourceRead==="payload"&&e.expectedJournalGeneration&&t.set("source_read","payload"),e.expectedJournalGeneration&&t.set("expected_journal_generation",e.expectedJournalGeneration),St(t,`/v1/desktop/sessions/${e.sessionId}/history`,e.orderIds??[])),{path:`/v1/desktop/sessions/${e.sessionId}/history?${t}`,method:"GET"}}case"sessions.checkpoints":return{path:`/v1/desktop/sessions/${e.sessionId}/checkpoints`,method:"GET"};case"sessions.checkpoints.warm":return{path:`/v1/desktop/sessions/${e.sessionId}/checkpoints/warm`,method:"POST",body:{...e.ids?{ids:e.ids}:{},...e.limit!==void 0?{limit:e.limit}:{}}};case"sessions.find":{const t=new URLSearchParams({q:e.q,limit:String(e.limit??ji)});return{path:`/v1/desktop/sessions/${e.sessionId}/find?${t}`,method:"GET"}}case"subagents.transcript":{const t=new URLSearchParams({limit:String(e.limit??100)});return e.beforeId&&t.set("before_id",e.beforeId),{path:`/v1/desktop/sessions/${e.sessionId}/children/${e.childId}/transcript?${t}`,method:"GET"}}case"sessions.message":return{path:`/v1/desktop/sessions/${e.sessionId}/messages`,method:"POST",body:{request_id:e.requestId,text:e.text,images:e.images??[],mode:e.mode??"prompt",...e.inputMode?{input_mode:e.inputMode}:{},...e.inputPath?{input_path:e.inputPath}:{}}};case"sessions.command":return{path:`/v1/desktop/sessions/${e.sessionId}/commands`,method:"POST",body:{request_id:e.requestId,command:e.command,args:e.args??"",images:e.images??[]}};case"sessions.answer":return e.askId!==void 0?{path:`/v1/desktop/sessions/${e.sessionId}/answers`,method:"POST",body:{ask_id:e.askId,answers:e.answers,decline:e.decline,...e.revise===!0?{revise:!0}:{}}}:{path:`/v1/desktop/sessions/${e.sessionId}/answers`,method:"POST",body:{epoch:e.epoch,request_id:e.requestId,value:e.value,approved:e.approved,question_index:e.questionIndex}};case"sessions.seen":return{path:`/v1/desktop/sessions/${e.sessionId}/seen`,method:"POST",body:{completion_token:e.completionToken}};case"attention.seen":return{path:"/v1/desktop/attention/seen",method:"POST",body:{items:e.items.map(t=>({session_id:t.sessionId,completion_token:t.completionToken}))}};case"sessions.notified":return{path:`/v1/desktop/sessions/${e.sessionId}/notified`,method:"POST",body:{completion_token:e.completionToken}};case"tags.list":return{path:"/v1/desktop/tags",method:"GET"};case"tags.replace":return{path:"/v1/desktop/tags",method:"PUT",body:{tags:e.tags}};case"sessions.tags":return{path:`/v1/desktop/sessions/${e.sessionId}/tags`,method:"PUT",body:{tags:e.tags,primary:e.primary,...e.expected_revision===void 0?{}:{expected_revision:e.expected_revision}}};case"sessions.pin":return{path:`/v1/desktop/sessions/${e.sessionId}/pin`,method:"POST",body:{pinned:e.pinned}};case"sessions.watch":return{path:`/v1/desktop/sessions/${e.sessionId}/watch`,method:"POST",body:{subscription_id:e.subscriptionId,visible:e.visible,can_notify:e.canNotify}};case"sessions.presence":return{path:"/v1/desktop/presence",method:"POST",body:{subscription_id:e.subscriptionId,can_notify_kinds:e.canNotifyKinds,session_id:e.sessionId,window:e.window,can_notify:e.canNotify}};case"sessions.move":return{path:`/v1/desktop/sessions/${e.sessionId}/working-directory`,method:"POST",body:{request_id:e.requestId,cwd:e.cwd}};case"sessions.warm":return{path:`/v1/desktop/sessions/${e.sessionId}/warm`,method:"POST",body:{}};case"sessions.interrupt":return{path:`/v1/desktop/sessions/${e.sessionId}/interrupt`,method:"POST",body:{request_id:e.requestId}};case"supplements.cancel":return{path:`/v1/desktop/sessions/${e.sessionId}/supplements/${e.job}/cancel`,method:"POST",body:{anchor:e.anchor}};case"supplements.restart":return{path:`/v1/desktop/sessions/${e.sessionId}/supplements/${e.job}/restart`,method:"POST",body:{anchor:e.anchor}};case"supplements.steer":return{path:`/v1/desktop/sessions/${e.sessionId}/supplements/${e.job}/steer`,method:"POST",body:{anchor:e.anchor,text:e.text}};case"sessions.variables.list":return{path:`/v1/desktop/sessions/${e.sessionId}/variables`,method:"GET"};case"sessions.variables.create":return{path:`/v1/desktop/sessions/${e.sessionId}/variables`,method:"POST",body:{key:e.key,value:e.value,type:e.type}};case"sessions.variables.update":return{path:`/v1/desktop/sessions/${e.sessionId}/variables/${encodeURIComponent(e.key)}`,method:"PATCH",body:{value:e.value,type:e.type}};case"sessions.variables.delete":return{path:`/v1/desktop/sessions/${e.sessionId}/variables/${encodeURIComponent(e.key)}`,method:"DELETE"};case"legacy.models":{const t=new URLSearchParams;return e.provider&&t.set("provider",e.provider),e.sort&&t.set("sort",e.sort),e.direction&&t.set("direction",e.direction),{path:t.size>0?`/v1/models?${t}`:"/v1/models",method:"GET"}}case"legacy.models.providers":return{path:"/v1/models/providers",method:"GET"};case"auth.probe":return{path:`/v1/auth/providers/${e.provider}/probe`,method:"POST"};case"legacy.agent.upload":return{path:`/v1/agents/${e.agentId}/upload`,method:"POST"};case"agent.publish":{gt(e);const t=new URLSearchParams;e.visibility==="org"&&e.tenantId&&(t.set("visibility","org"),t.set("tenant_id",e.tenantId));const s=t.toString();return{path:`/v1/agents/${e.agentId}/publish${s?`?${s}`:""}`,method:"POST",body:{document:e.document??{},...ft(e)}}}case"agent.republish":{gt(e);const t=new URLSearchParams;e.visibility==="org"&&e.tenantId&&(t.set("visibility","org"),t.set("tenant_id",e.tenantId));const s=t.toString();return{path:`/v1/agents/${e.agentId}/publish${s?`?${s}`:""}`,method:"PUT",body:{hub_agent_id:e.hubAgentId,document:e.document??{},...ft(e),...e.expectedRemoteRevision?{expected_remote_revision:e.expectedRemoteRevision}:{}}}}case"team.publish":{gt(e);const t=new URLSearchParams;return e.visibility==="org"&&e.tenantId&&(t.set("visibility","org"),t.set("tenant_id",e.tenantId)),{path:`/v1/teams/${e.teamId}/publish${t.size?`?${t}`:""}`,method:"POST",body:ft(e)}}case"team.pull":{const t=new URLSearchParams;e.tenantId&&t.set("tenant_id",e.tenantId);const s=t.toString();return{path:`/v1/teams/pull/${e.teamId}${s?`?${s}`:""}`,method:"GET"}}case"agent.nameAvailability":return{path:`/v1/agent-name-availability?${new URLSearchParams({name:e.name})}`,method:"GET"};case"legacy.agents.list":{const t=new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)});return e.name&&t.set("name",e.name),e.sort&&t.set("sort",e.sort),e.direction&&t.set("direction",e.direction),{path:`/v1/agents?${t}`,method:"GET"}}case"legacy.agent.get":return{path:`/v1/agents/${e.agentId}`,method:"GET"};case"legacy.agent.history":{const t=new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)});return{path:`/v1/agents/${e.agentId}/history?${t}`,method:"GET"}}case"wakes.list":{const t=new URLSearchParams;return e.limit!==void 0&&t.set("limit",String(e.limit)),e.includeDormant!==void 0&&t.set("include_dormant",String(e.includeDormant)),{path:t.size>0?`/v1/desktop/wakes?${t}`:"/v1/desktop/wakes",method:"GET"}}case"wakes.create":return{path:"/v1/desktop/wakes",method:"POST",body:{request_id:e.requestId,...Ga(e),message:e.message,...bn(e)}};case"wakes.edit":return{path:`/v1/desktop/wakes/${e.sessionId}/${e.wakeId}`,method:"PATCH",body:{...e.message!==void 0?{message:e.message}:{},...bn(e)}};case"wakes.remove":return{path:`/v1/desktop/wakes/${e.sessionId}/${e.wakeId}`,method:"DELETE"};case"monitors.cancel":return{path:`/v1/desktop/monitors/${encodeURIComponent(e.sessionId)}/${encodeURIComponent(e.monitorId)}`,method:"DELETE"};case"jobs.cancel":return{path:`/v1/desktop/sessions/${encodeURIComponent(e.sessionId)}/jobs/${encodeURIComponent(e.jobId)}/cancel`,method:"POST"};case"legacy.jobs.list":{const t=new URLSearchParams;return e.agentId&&t.set("agent_id",e.agentId),e.status&&t.set("status",e.status),{path:t.size>0?`/v1/jobs?${t}`:"/v1/jobs",method:"GET"}}case"legacy.job.get":return{path:`/v1/jobs/${e.jobId}`,method:"GET"};case"legacy.schedules.list":return{path:`/v1/schedules?${new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)})}`,method:"GET"};case"legacy.agent.schedules.list":{const t=new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)});return{path:`/v1/agents/${e.agentId}/schedules?${t}`,method:"GET"}}case"legacy.agent.schedule.create":return{path:`/v1/agents/${e.agentId}/schedules`,method:"POST",body:e.schedule};case"legacy.schedule.get":return{path:`/v1/schedules/${e.scheduleId}`,method:"GET"};case"legacy.schedule.edit":return{path:`/v1/schedules/${e.scheduleId}`,method:"PATCH",body:e.schedule};case"legacy.schedule.remove":return{path:`/v1/schedules/${e.scheduleId}`,method:"DELETE"};case"legacy.agent.create":return{path:"/v1/agents",method:"POST",body:e.agent};case"legacy.agent.update":return{path:`/v1/agents/${e.agentId}`,method:"PATCH",body:e.update};case"legacy.agent.delete":return{path:`/v1/agents/${e.agentId}`,method:"DELETE"};case"legacy.agent.conversation.clear":return{path:`/v1/agents/${e.agentId}/conversation`,method:"DELETE"};case"legacy.agent.systemPrompt.get":return{path:`/v1/agents/${e.agentId}/system-prompt`,method:"GET"};case"legacy.agent.systemPrompt.update":return{path:`/v1/agents/${e.agentId}/system-prompt`,method:"PUT",body:{system_prompt:e.systemPrompt}};case"legacy.agent.download":return{path:`/v1/agents/${e.agentId}/download`,method:"GET"};case"legacy.job.cancel":return{path:`/v1/jobs/${e.jobId}`,method:"DELETE"};case"commands.list":return{path:"/v1/desktop/commands",method:"GET"};case"commands.entities":return{path:`/v1/desktop/sessions/${e.sessionId}/command-entities?command=${encodeURIComponent(e.command)}${e.name?`&name=${encodeURIComponent(e.name)}`:""}`,method:"GET"};case"models.catalogue":{const t=e.scope?`&scope=${e.scope}`:"";return{path:`/v1/desktop/models?live=${e.live??!1}${t}`,method:"GET"}}case"usage.get":{const t=new URLSearchParams({live:String(e.live??!1),refresh:String(e.refresh??!1)});return e.provider&&t.set("provider",e.provider),{path:`/v1/desktop/usage?${t}`,method:"GET"}}case"quota.notice":{const t=new URLSearchParams({refresh:String(e.refresh??!1)});return e.provider&&t.set("provider",e.provider),e.model&&t.set("model",e.model),{path:`/v1/desktop/quota-notice?${t}`,method:"GET"}}case"analytics.get":{const t=new URLSearchParams({days:String(e.days??30)});return e.sessionId&&t.set("session_id",e.sessionId),e.sinceMs!==void 0&&t.set("since_ms",String(e.sinceMs)),e.untilMs!==void 0&&t.set("until_ms",String(e.untilMs)),{path:`/v1/desktop/analytics?${t}`,method:"GET"}}case"analytics.models":{const t=new URLSearchParams({days:String(e.days??30)});return e.sessionId&&t.set("session_id",e.sessionId),e.sinceMs!==void 0&&t.set("since_ms",String(e.sinceMs)),e.untilMs!==void 0&&t.set("until_ms",String(e.untilMs)),{path:`/v1/desktop/analytics/models?${t}`,method:"GET"}}case"info.get":return{path:"/v1/desktop/info",method:"GET"};case"sessions.report":{const t=new URLSearchParams({recent_limit:String(e.recentLimit??12)});return{path:`/v1/desktop/sessions/${e.sessionId}/report?${t}`,method:"GET"}}case"skills.list":{const t=new URLSearchParams;e.sessionId&&t.set("session_id",e.sessionId),e.cwd&&t.set("cwd",e.cwd),e.name&&t.set("name",e.name);const s=t.toString();return{path:`/v1/desktop/skills${s?`?${s}`:""}`,method:"GET"}}case"sessions.failovers":return{path:`/v1/desktop/sessions/${e.sessionId}/failovers`,method:"GET"};case"sessions.credential":return{path:`/v1/desktop/sessions/${e.sessionId}/credentials`,method:"POST",body:{action:e.action,key:e.key,value:e.value,confirmed:e.confirmed}};case"sessions.fork":return{path:`/v1/desktop/sessions/${e.sessionId}/fork`,method:"POST",body:{request_id:e.requestId,message:e.message,boundary:e.boundary,entry_id:e.entryId}};case"sessions.stop":return{path:"/v1/desktop/stop",method:"POST",body:{request_id:e.requestId,targets:e.targets,confirmed:e.confirmed}};case"sessions.aside":return{path:`/v1/desktop/sessions/${e.sessionId}/asides`,method:"POST",body:{request_id:e.requestId,text:e.text,aside_id:e.asideId,subscription_id:e.subscriptionId}};case"sessions.adopt":return{path:`/v1/desktop/sessions/${e.sessionId}/asides/${e.asideId}/adopt`,method:"POST",body:{request_id:e.requestId,confirmed:e.confirmed}};case"sessions.aside.get":case"sessions.aside.close":return{path:`/v1/desktop/sessions/${e.sessionId}/asides/${e.asideId}`,method:e.op==="sessions.aside.get"?"GET":"DELETE"};case"mcp.list":return{path:`/v1/desktop/sessions/${e.sessionId}/mcp`,method:"GET"};case"mcp.credentials.store":return{path:`/v1/desktop/sessions/${e.sessionId}/mcp/credentials`,method:"POST",body:{name:e.name,values:e.values,confirmed_replace:e.confirmedReplace}};case"mcp.control":return{path:`/v1/desktop/sessions/${e.sessionId}/mcp`,method:"POST",body:e.control};case"mcp.catalog":{const t=new URLSearchParams;e.cwd&&t.set("cwd",e.cwd),e.sessionId&&t.set("session_id",e.sessionId);const s=t.toString();return{path:s?`/v1/desktop/mcp?${s}`:"/v1/desktop/mcp",method:"GET"}}case"mcp.catalog.control":return{path:"/v1/desktop/mcp",method:"POST",body:{...e.control,...e.cwd?{cwd:e.cwd}:{}}};case"mcp.catalog.credentials":return{path:"/v1/desktop/mcp/credentials",method:"POST",body:{name:e.name,values:e.values,...e.header?{header:e.header}:{},confirmed_replace:e.confirmedReplace,...e.cwd?{cwd:e.cwd}:{}}};case"radient.request":return{path:"/v1/desktop/radient",method:"POST",body:e.control};case"providers.list":return{path:"/v1/auth/providers",method:"GET"};case"accounts.list":return{path:"/v1/auth/status",method:"GET"};case"accounts.remove":return{path:`/v1/auth/accounts/${e.accountId}`,method:"DELETE"};case"tunnel.setup.read":return{path:e.credentialId===void 0?"/v1/desktop/tunnel/setup":`/v1/desktop/tunnel/setup?credential_id=${e.credentialId}`,method:"GET"};case"tunnel.setup.plan":return{path:"/v1/desktop/tunnel/setup",method:"POST",body:{action:"plan",...e.credentialId!==void 0?{credential_id:e.credentialId}:{}}};case"tunnel.setup.run":return{path:"/v1/desktop/tunnel/setup",method:"POST",body:{action:"run",credential_id:e.credentialId,...e.acceptMonthlyPrice!==void 0?{accept_monthly_price:e.acceptMonthlyPrice}:{}}};case"auth.start":return{path:"/v1/auth/login",method:"POST",body:{provider:e.provider}};case"auth.status":return{path:`/v1/auth/operations/${e.id}`,method:"GET"};case"auth.input":return{path:`/v1/auth/operations/${e.id}/input`,method:"POST",body:{prompt_id:e.promptId,value:e.value}};case"auth.cancel":return{path:`/v1/auth/operations/${e.id}`,method:"DELETE"};case"auth.key":return{path:`/v1/auth/providers/${e.provider}/key`,method:"PUT",body:{value:e.value}};case"auth.logout":return{path:`/v1/auth/providers/${e.provider}/credentials`,method:"DELETE"};case"agent_messages.status":return{path:`/v1/desktop/team-bridge/status?boundary=${e.boundary}`,method:"GET"};case"agent_messages.enable":return{path:"/v1/desktop/team-bridge/settings",method:"PUT",body:{expected_account_id:e.expected_account_id,tenant_id:e.tenant_id,state:e.state,consent_version:e.consent_version,consented_via:e.consented_via}};case"agent_messages.settings":return{path:`/v1/desktop/team-bridge/settings${bt(e.tenant_id)}`,method:"GET"};case"agent_messages.settings.put":return{path:"/v1/desktop/team-bridge/settings",method:"PUT",body:{expected_account_id:e.expected_account_id,...e.tenant_id===void 0?{}:{tenant_id:e.tenant_id},...e.consent_version===void 0?{}:{consent_version:e.consent_version},...e.consented_via===void 0?{}:{consented_via:e.consented_via},...e.label===void 0?{}:{label:e.label},state:e.state}};case"agent_messages.allowlist.get":return{path:`/v1/desktop/team-bridge/allowlist${bt(e.tenant_id)}`,method:"GET"};case"agent_messages.allowlist.put":return{path:"/v1/desktop/team-bridge/allowlist",method:"PUT",body:{expected_account_id:e.expected_account_id,...e.tenant_id===void 0?{}:{tenant_id:e.tenant_id},entries:e.entries}};case"team_bridge.conversations.list":{const t=new URLSearchParams;return e.scope==="account"&&t.set("scope","account"),e.tenant_id&&t.set("tenant_id",e.tenant_id),e.limit!==void 0&&t.set("limit",String(e.limit)),e.cursor&&t.set("cursor",e.cursor),e.before&&t.set("before",e.before),{path:`/v1/desktop/team-bridge/conversations${t.size>0?`?${t.toString()}`:""}`,method:"GET"}}case"team_bridge.conversations.get":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}${bt(e.tenant_id)}`,method:"GET"};case"team_bridge.conversations.create":return{path:"/v1/desktop/team-bridge/conversations",method:"POST",body:{...e.tenant_id?{tenant_id:e.tenant_id}:{},kind:e.kind,...e.name?{name:e.name}:{},...e.topic?{topic:e.topic}:{},...e.visibility?{visibility:e.visibility}:{},...e.agent_capable===void 0?{}:{agent_capable:e.agent_capable},members:e.members}};case"team_bridge.conversations.lifecycle":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/${e.action}`,method:"POST"};case"team_bridge.conversations.join":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/join`,method:"POST",...e.tenant_id?{body:{tenant_id:e.tenant_id}}:{}};case"team_bridge.conversations.notify":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/read`,method:"POST",body:{...e.tenant_id?{tenant_id:e.tenant_id}:{},notify:e.notify}};case"team_bridge.conversations.members.add":{const t=new URLSearchParams;e.tenant_id&&t.set("tenant_id",e.tenant_id);const s=t.size>0?`?${t.toString()}`:"";return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/members${s}`,method:"POST",body:e.members}}case"team_bridge.conversations.members.remove":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/members/${encodeURIComponent(e.account_id)}`,method:"DELETE"};case"team_bridge.conversations.consent":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/members/${encodeURIComponent(e.account_id)}/consent`,method:"POST",body:{...e.tenant_id?{tenant_id:e.tenant_id}:{},decision:e.decision,consent_version:e.consent_version}};case"team_bridge.messages.list":{const t=new URLSearchParams;e.tenant_id&&t.set("tenant_id",e.tenant_id),e.limit!==void 0&&t.set("limit",String(e.limit)),e.before_seq!==void 0&&t.set("before_seq",String(e.before_seq)),e.endpoint_id&&t.set("endpoint_id",e.endpoint_id);const s=t.size>0?`?${t.toString()}`:"";return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/messages${s}`,method:"GET"}}case"team_bridge.messages.send":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/messages`,method:"POST",body:{...e.tenant_id?{tenant_id:e.tenant_id}:{},client_ref:e.client_ref,body:e.body,...e.agent_label?{agent_label:e.agent_label}:{}}};case"team_bridge.read":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/read`,method:"POST",body:{...e.tenant_id?{tenant_id:e.tenant_id}:{},...e.seq===void 0?{}:{seq:e.seq},...e.muted===void 0?{}:{muted:e.muted}}};case"team_bridge.unread":{const t=new URLSearchParams;return e.scope==="account"?t.set("scope","account"):e.tenant_id&&t.set("tenant_id",e.tenant_id),{path:`/v1/desktop/team-bridge/unread${t.size>0?`?${t.toString()}`:""}`,method:"GET"}}case"settings.list":return{path:"/v1/settings",method:"GET"};case"settings.edit":return{path:`/v1/settings/${e.key}`,method:"PATCH",body:{value:e.value,base:e.base}};case"settings.reset":return{path:`/v1/settings/${e.key}/reset`,method:"POST"};case"tts.paths":return{path:"/v1/tts/paths",method:"GET"};case"config.get":return{path:"/v1/config",method:"GET"};case"config.update":return{path:"/v1/config",method:"PATCH",body:e.value};case"instructions.get":return{path:"/v1/config/system-prompt",method:"GET"};case"instructions.update":return{path:"/v1/config/system-prompt",method:"PATCH",body:{content:e.content}};case"credentials.list":return{path:"/v1/credentials",method:"GET"};case"credentials.update":return{path:"/v1/credentials",method:"PATCH",body:{key:e.key,value:e.value}};case"library.list":{const t=new URLSearchParams;e.scope&&t.set("scope",e.scope),e.q&&t.set("q",e.q),e.category&&t.set("category",e.category),e.kind&&t.set("kind",e.kind),e.origin_group&&t.set("origin_group",e.origin_group),e.origin&&t.set("origin",e.origin),e.tag&&t.set("tag",e.tag),e.tag_mode&&t.set("tag_mode",e.tag_mode),e.highlighted!==void 0&&t.set("highlighted",e.highlighted?"1":"0"),e.organized!==void 0&&t.set("organized",e.organized?"1":"0"),e.favorite!==void 0&&t.set("favorite",e.favorite?"1":"0"),e.session&&t.set("session",e.session),e.session_id&&t.set("session_id",e.session_id),e.sort&&t.set("sort",e.sort),e.order&&t.set("order",e.order),e.limit!==void 0&&t.set("limit",String(e.limit)),e.cursor&&t.set("cursor",e.cursor);const s=t.toString();return{path:`/v1/desktop/library/assets${s?`?${s}`:""}`,method:"GET"}}case"library.get":return{path:`/v1/desktop/library/assets/${encodeURIComponent(e.id)}`,method:"GET"};case"library.update":return{path:`/v1/desktop/library/assets/${encodeURIComponent(e.id)}`,method:"PATCH",body:e.fields};case"library.tags":return{path:"/v1/desktop/library/tags",method:"GET"};case"library.tags.create":return{path:"/v1/desktop/library/tags",method:"POST",body:{name:e.name,...e.category!==void 0?{category:e.category}:{}}};case"library.tags.update":return{path:`/v1/desktop/library/tags/${encodeURIComponent(e.id)}`,method:"PATCH",body:{...e.name!==void 0?{name:e.name}:{},...e.category!==void 0?{category:e.category}:{}}};case"library.tags.delete":return{path:`/v1/desktop/library/tags/${encodeURIComponent(e.id)}`,method:"DELETE"};case"library.tags.merge":return{path:`/v1/desktop/library/tags/${encodeURIComponent(e.id)}/merge`,method:"POST",body:{into:e.into}};case"library.tags.assign":return{path:`/v1/desktop/library/assets/${encodeURIComponent(e.id)}/tags`,method:"PUT",body:{tags:e.tags,...e.primary!==void 0?{primary:e.primary}:{}}};case"library.chat.link":return{path:`/v1/desktop/library/assets/${encodeURIComponent(e.id)}/chat`,method:"PUT",body:{session_id:e.sessionId}};case"library.chat.clear":return{path:`/v1/desktop/library/assets/${encodeURIComponent(e.id)}/chat`,method:"DELETE"};case"library.librarian":{const t=e.action??"status";return t==="status"?{path:"/v1/desktop/librarian",method:"GET"}:{path:"/v1/desktop/librarian",method:"POST",body:{op:t}}}case"projects.list":return{path:"/v1/desktop/projects",method:"GET"};case"projects.get":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}`,method:"GET"};case"projects.create":return{path:"/v1/desktop/projects",method:"POST",body:{name:e.name,...e.description!==void 0?{description:e.description}:{},...e.status!==void 0?{status:e.status}:{},...e.tags!==void 0?{tags:e.tags}:{}}};case"projects.update":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}`,method:"PATCH",body:{...e.fields,...e.force_done===!0?{force_done:!0}:{}}};case"projects.delete":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}`,method:"DELETE",body:{confirm:e.confirmed_name}};case"projects.link":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/links`,method:"POST",body:{session_id:e.sessionId}};case"projects.unlink":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/links/${encodeURIComponent(e.sessionId)}`,method:"DELETE"};case"projects.milestone":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/milestones`,method:"POST",body:{name:e.name,...e.targetDate!==void 0?{target_date:e.targetDate}:{},...e.completed!==void 0?{completed:e.completed}:{}}};case"projects.milestone.remove":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/milestones/${encodeURIComponent(e.name)}`,method:"DELETE"};case"projects.request_update":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/request-update`,method:"POST"};case"projects.search":return{path:`/v1/desktop/projects/search?${new URLSearchParams({q:e.q,limit:String(e.limit??la)})}`,method:"GET"};case"aida.status":return{path:"/v1/desktop/aida",method:"GET"};case"aida.control":return{path:"/v1/desktop/aida",method:"POST",body:{op:e.action}};case"code_requests.list":return{path:`/v1/desktop/sessions/${e.sessionId}/code-requests`,method:"GET"};case"code_requests.refresh":return{path:`/v1/desktop/sessions/${e.sessionId}/code-requests/refresh`,method:"POST",body:{...e.keys!==void 0?{keys:e.keys}:{},...e.force!==void 0?{force:e.force}:{}}};case"static.sign":return{path:"/v1/static/sign",method:"POST",body:{route:e.route,path:e.path,ttl_s:e.ttlS}}}}const Hr=64,Vr=64*1024*1024,_n=e=>{let t;const s=new Set,i=(l,m)=>{const w=typeof l=="function"?l(t):l;if(!Object.is(w,t)){const y=t;t=m??(typeof w!="object"||w===null)?w:Object.assign({},t,w),s.forEach(O=>O(t,y))}},a=()=>t,c={setState:i,getState:a,getInitialState:()=>d,subscribe:l=>(s.add(l),()=>s.delete(l))},d=t=e(i,a,c);return c},za=e=>e?_n(e):_n,Fa=e=>e;function Ha(e,t=Fa){const s=Lt.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return Lt.useDebugValue(s),s}const yn=e=>{const t=za(e),s=i=>Ha(t,i);return Object.assign(s,t),s},Hn=e=>e?yn(e):yn;function Vn(e,t){let s;try{s=e()}catch{return}return{getItem:a=>{var o;const r=d=>d===null?null:JSON.parse(d,void 0),c=(o=s.getItem(a))!=null?o:null;return c instanceof Promise?c.then(r):r(c)},setItem:(a,o)=>s.setItem(a,JSON.stringify(o,void 0)),removeItem:a=>s.removeItem(a)}}const xt=e=>t=>{try{const s=e(t);return s instanceof Promise?s:{then(i){return xt(i)(s)},catch(i){return this}}}catch(s){return{then(i){return this},catch(i){return xt(i)(s)}}}},Va=(e,t)=>(s,i,a)=>{let o={storage:Vn(()=>localStorage),partialize:T=>T,version:0,merge:(T,ne)=>({...ne,...T}),...t},r=!1;const c=new Set,d=new Set;let l=o.storage;if(!l)return e((...T)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),s(...T)},i,a);const m=()=>{const T=o.partialize({...i()});return l.setItem(o.name,{state:T,version:o.version})},w=a.setState;a.setState=(T,ne)=>{w(T,ne),m()};const y=e((...T)=>{s(...T),m()},i,a);a.getInitialState=()=>y;let O;const pe=()=>{var T,ne;if(!l)return;r=!1,c.forEach(j=>{var Z;return j((Z=i())!=null?Z:y)});const Le=((ne=o.onRehydrateStorage)==null?void 0:ne.call(o,(T=i())!=null?T:y))||void 0;return xt(l.getItem.bind(l))(o.name).then(j=>{if(j)if(typeof j.version=="number"&&j.version!==o.version){if(o.migrate){const Z=o.migrate(j.state,j.version);return Z instanceof Promise?Z.then(ot=>[!0,ot]):[!0,Z]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,j.state];return[!1,void 0]}).then(j=>{var Z;const[ot,ls]=j;if(O=o.merge(ls,(Z=i())!=null?Z:y),s(O,!0),ot)return m()}).then(()=>{Le?.(O,void 0),O=i(),r=!0,d.forEach(j=>j(O))}).catch(j=>{Le?.(void 0,j)})};return a.persist={setOptions:T=>{o={...o,...T},T.storage&&(l=T.storage)},clearStorage:()=>{l?.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>pe(),hasHydrated:()=>r,onHydrate:T=>(c.add(T),()=>{c.delete(T)}),onFinishHydration:T=>(d.add(T),()=>{d.delete(T)})},o.skipHydration||pe(),O||y},Wn=Va,Wa=(e,t)=>e!==null&&e.message===t.message&&e.removed===t.removed&&e.max_age_hours===t.max_age_hours&&e.in_progress===t.in_progress&&e.first_removal_at===t.first_removal_at&&e.freed_bytes_estimate===t.freed_bytes_estimate&&e.record===t.record;function Wr(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.message!="string"||t.message.trim()==="")return null;const s=(i,a)=>typeof i=="number"&&Number.isFinite(i)?i:a;return{message:t.message,removed:s(t.removed,0),max_age_hours:s(t.max_age_hours,48),in_progress:t.in_progress===!0,first_removal_at:typeof t.first_removal_at=="string"?t.first_removal_at:"",freed_bytes_estimate:typeof t.freed_bytes_estimate=="number"&&Number.isFinite(t.freed_bytes_estimate)?t.freed_bytes_estimate:null,record:typeof t.record=="string"?t.record:""}}const Kr=Hn()(Wn(e=>({notice:null,receive:t=>e(s=>Wa(s.notice,t)?s:{notice:t}),dismiss:()=>e(t=>t.notice===null?t:{notice:null})}),{name:"delegated-cleanup-notice",storage:Vn(()=>{if(typeof localStorage>"u"||localStorage===null)throw new Error("no localStorage in this environment");return localStorage}),partialize:e=>({notice:e.notice})})),Ne=260,Kn=220,Yn=320,Tt=56,Ka=Ne,Ya=1024,Xn=480,Jn=44,Qn=400,Xa=560;function qn(e){return Math.max(0,Math.min(Xa,e-Xn))}function kn(e){return qn(e)>=Qn?"docked":"overlay"}function Yr({capacity:e,min:t,max:s,drawn:i}){const a=e>=t;return a?{resizable:a,value:Math.min(Math.max(i,t),e),minWidth:t,maxWidth:Math.min(s,e)}:{resizable:a,value:i,minWidth:i,maxWidth:i}}function Ja(e,t=Ne,s=Jn){return kn(e-es(t)-s)==="overlay"&&kn(e-Tt-s)==="docked"}function es(e){return Number.isNaN(e)?Ne:Math.min(Yn,Math.max(Kn,e))}function Xr(e,t,s,i=Ne,a=!1,o=Jn){if(e>=Ya){const c=!t&&a&&Ja(e,i,o);return{mode:t||c?"strip":"docked",width:t||c?Tt:es(i),collapsed:t||c,sheetOpen:!1,resizable:!t&&!c}}return{mode:s?"overlay":"strip",width:s?Ka:Tt,collapsed:!0,sheetOpen:s,resizable:!1}}function Jr(e){return e.shiftKey||e.altKey||!(e.metaKey||e.ctrlKey)?!1:e.key.toLowerCase()==="b"}const Qr=e=>e?"⌘B":"Ctrl+B",Qa=["active","created"],qr={running:"Running",today:"Today",week:"This week",older:"Older"},qa=new Set(["waiting","busy","delegating","approval","answer","wedged"]);function nt(e){return qa.has(e.status?.code??"")}const eo=new Set(["approval","answer"]);function to(e){return eo.has(e.status?.code??"")}const no=24*60*60*1e3,so=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()};function Ct(e,t){const s=t==="created"?e.created_at:e.updated_at;return typeof s!="number"||!Number.isFinite(s)||s<=0?null:s*1e3}const io="last_user_at";function ao(e){const t=e[io],s=typeof t=="number"&&Number.isFinite(t)&&t>0?t:e.created_at;return typeof s!="number"||!Number.isFinite(s)||s<=0?null:s*1e3}function oo(e,t,s){if(nt(e))return"running";const i=Ct(e,s);if(i===null)return"older";const a=so(t);return i>=a?"today":i>=a-6*no?"week":"older"}function ec(e,t,s){const i={running:[],today:[],week:[],older:[]};for(const a of e)i[oo(a,t,s)].push(a);return i}function ro(e,t,s){const i=Ct(e,s);if(i===null)return"";const a=Math.floor(Math.max(0,t-i)/6e4);if(a<1)return"now";if(a<60)return`${a}m`;const o=Math.floor(a/60);if(o<24)return`${o}h`;const r=Math.floor(o/24);if(r<7)return`${r}d`;const c=Math.floor(r/7);return r<365?`${c}w`:`${Math.floor(r/365)}y`}function tc(e,t,s){const i=ro(e,t,s);if(!i)return"";const a=s==="created"?"created":"last active";if(i==="now")return`${a} just now`;const o={m:"minute",h:"hour",d:"day",w:"week",y:"year"},r=Number.parseInt(i,10),c=o[i.slice(-1)];return`${a} ${r} ${c}${r===1?"":"s"} ago`}const Et=["pinned","running","today","week","older","agents","teams"];function nc(e){return e==="agents"||e==="teams"}const Ae=8;function co(e,t){if(!(t in e))return e;const s={...e};return delete s[t],s}function sc(e,t){return{...e,[t]:(e[t]??Ae)+Ae}}function ic(e,t,s,i,a){const o=!(e[s]??i);return{expanded:{...e,[s]:o},caps:!o&&!a?co(t,s):t}}function ac(e,t,s,i){return(e||t!=="")&&(i>Ae||s.trim()!=="")}const oc="Collapse, then reopen, to restore the compact list";function rc(e){return(e??Ae)>Ae}const cc=e=>`section-grown-hint-${e}`,lo=e=>e===1?"Show 1 more":`Show ${e} more`;function lc(e,t){return`${lo(e)} ${t}`}const _e={hidden:[],order:[...Et],pins:[],groupBy:"section",tagsEnabled:!1,basis:"active",orderBy:"active-first",loads:0,pinnedAgents:[]},po=10,he=[25,50],uo=50,mo=500,ho=64;function re(e){const t=Math.max(0,Math.floor(e));return t===0?po:t<=he.length?he[t-1]:he[he.length-1]+(t-he.length)*uo}function dc(e,t){const s=re(e+1)-re(e),i=Math.max(0,Math.min(s,t));return i===1?"Show 1 more chat":`Show ${i} more chats`}function pc(e,t,s){const i=re(t+1)-re(t),a=re(t),o=Math.min(a+i,e.length);let r=0;for(let d=a;d<o;d+=1)jt(e[d])&&(r+=1);const c=Math.max(0,o-a-r);return c>0?c:Math.max(0,Math.min(i,s))}function jt(e){return nt(e)}function fo(e){return to(e)?0:nt(e)?1:2}function go(e,t){return nt(e)?ao(e):Ct(e,t)}function bo(e,t){return e===null&&t===null?0:e===null?1:t===null?-1:t-e}function uc(e,t,s){const i=e.map((a,o)=>({row:a,index:o,lane:t==="active-first"?fo(a):0,at:go(a,s)}));return i.sort((a,o)=>a.lane-o.lane||bo(a.at,o.at)||a.index-o.index),i.map(a=>a.row)}function mc(e,t){const{limit:s,currentId:i,searching:a=!1}=t;if(a)return{rows:[...e],lifted:!1,remaining:0};const o=[];let r=Math.max(0,s);for(const l of e){if(r>0){o.push(l),r-=1;continue}jt(l)&&o.push(l)}const c=Math.max(0,e.length-o.length);if(!i)return{rows:o,lifted:!1,remaining:c};const d=e.find(l=>l.session_id===i)??null;return d===null||o.includes(d)?{rows:o,lifted:!1,remaining:c}:{rows:[d,...o],lifted:!0,remaining:c}}function hc(e,t){if(t.searching)return{rows:[...e],lifted:!1,hidden:0,held:e.length};const s=re(t.loads),i=[];let a=s;for(const d of e){if(jt(d)){i.push(d);continue}a>0&&(i.push(d),a-=1)}const o=t.currentId,r=o==null?null:e.find(d=>d.session_id===o)??null,c=r!==null&&!i.includes(r);return{rows:c&&r!==null?[r,...i]:i,lifted:c,hidden:e.length-i.length-(c?1:0),held:e.length}}function fc(e){if(e.add<=0)return null;const t=e.add===1?"Show 1 more chat":`Show ${e.add} more chats`;if(e.drawn>=e.total)return{label:t,aria:t};const s=`${e.drawn} of ${e.total}`;return{label:`${t} · ${s}`,aria:`${t} · ${s} shown`}}const vo="mt-4",_o="mt-2";function gc(e){return e?vo:_o}function bc(e,t,s,i){return s?e.toLocaleLowerCase().includes(s.toLocaleLowerCase())||(i??"").toLocaleLowerCase().includes(s.toLocaleLowerCase())||t>0:!0}function vc(e,t){if(t==="section")return null;if(t==="flat")return[{key:"all",label:"",rows:[...e]}];const s=new Map;for(const o of e){const r=o.binding?.team||o.binding?.agent||"",c=r||"ungrouped",d=s.get(c)??{key:c,label:r||"Ungrouped",rows:[]};d.rows.push(o),s.set(c,d)}const i=[...s.values()],a=i.findIndex(o=>o.key==="ungrouped");return a>0&&i.push(...i.splice(a,1)),i}function yo(e,t){return!e.hidden.includes(t)}function ts(e){return e.order.filter(t=>yo(e,t))}function _c(e,t){const s=e.hidden.includes(t)?e.hidden.filter(i=>i!==t):[...e.hidden,t];return{...e,hidden:s}}function yc(e,t,s){const i=ts(e),a=i.indexOf(t),o=i[a+s];if(a<0||o===void 0)return e;const r=e.order.indexOf(t),c=e.order.indexOf(o),d=[...e.order];return d[r]=o,d[c]=t,{...e,order:d}}const ko=["running","today","week","older"];function Sn(e){return ko.includes(e)}function kc(e,t,s,i){if(!Sn(t)||i&&!i(t))return!1;const a=ts(e),o=a.indexOf(t);if(o<0)return!1;const r=a[o+s];return r===void 0||!Sn(r)?!1:i?i(r):!0}const So=["section","agent","flat"],wo=["active-first","recent"];function Sc(e){if(typeof e!="object"||e===null)return _e;const t=e,s=new Set(Et),i=[];if(Array.isArray(t.order))for(const y of t.order)typeof y=="string"&&s.has(y)&&(i.includes(y)||i.push(y));for(const y of Et)i.includes(y)||i.push(y);const a=[];if(Array.isArray(t.hidden))for(const y of t.hidden)typeof y=="string"&&s.has(y)&&(a.includes(y)||a.push(y));const o=So.includes(t.groupBy)?t.groupBy:_e.groupBy,r=Qa.includes(t.basis)?t.basis:_e.basis,c=wo.includes(t.orderBy)?t.orderBy:_e.orderBy,d=typeof t.loads=="number"&&Number.isFinite(t.loads)&&t.loads>0?Math.min(mo,Math.floor(t.loads)):0,l=[];if(Array.isArray(t.pinnedAgents)){for(const y of t.pinnedAgents)if(typeof y=="string"&&y!==""&&!l.includes(y)){if(l.length>=ho)break;l.push(y)}}const m=[],w=new Set;if(Array.isArray(t.pins))for(const y of t.pins)typeof y=="string"&&y.length!==0&&(w.has(y)||(w.add(y),m.push(y)));return{hidden:a,order:i,groupBy:o,tagsEnabled:typeof t.tagsEnabled=="boolean"?t.tagsEnabled:!1,basis:r,orderBy:c,loads:d,pins:m,pinnedAgents:l}}const ns={sort:"recent",order:"asc",group:!0,workingOpen:!1,closedSections:[],kinds:[]},Io=["recent","name","kind","modified","created","size"],xo=["images","video","audio","documents","spreadsheets","presentations","code","archives","other"];function At(e){const t=e&&typeof e=="object"?e:{};return{sort:Io.includes(t.sort??"")?t.sort:ns.sort,order:t.order==="desc"?"desc":"asc",group:typeof t.group=="boolean"?t.group:!0,workingOpen:t.workingOpen===!0,closedSections:Array.isArray(t.closedSections)?[...new Set(t.closedSections.filter(s=>["Highlights","Images","Videos","Sounds","Documents","Spreadsheets","Other"].includes(s)))]:[],kinds:Array.isArray(t.kinds)?[...new Set(t.kinds.filter(s=>xo.includes(s)))]:[]}}function wc(e,t){const s=i=>{switch(t.sort){case"name":return i.row.name;case"kind":return`${i.row.kind}\0${i.row.name}`;case"modified":return i.modified;case"created":return i.created;case"size":return i.row.document.sizeBytes??null;default:return i.mentioned}};return[...e].sort((i,a)=>{const o=s(i),r=s(a);if(o===null||r===null)return o===r?0:o===null?1:-1;const c=typeof o=="string"&&typeof r=="string"?o.localeCompare(r,void 0,{numeric:!0}):Number(o)-Number(r);return(t.order==="asc"?c:-c)||i.mentioned-a.mentioned})}const To=e=>{switch(e.row.kind){case"images":return"Images";case"video":return"Videos";case"audio":return"Sounds";case"spreadsheets":return"Spreadsheets";case"documents":case"presentations":case"code":return"Documents";default:return"Other"}};function Ic(e,t,s,i){const a=e.filter(c=>c.highlighted),o=e.filter(c=>!c.highlighted),r=[];if(a.length&&r.push({id:"Highlights",label:"Highlights",items:a,open:s||!i.has("Highlights"),highlights:!0}),a.length&&o.length&&(r.push({id:"Working files",label:"Working files",items:[],open:t.workingOpen||s,highlights:!1}),!t.workingOpen&&!s))return r;if(!t.group)o.length&&r.push({id:"Files",label:"Files",items:o,open:!0,highlights:!1});else for(const c of["Images","Videos","Sounds","Documents","Spreadsheets","Other"]){const d=o.filter(l=>To(l)===c);d.length&&r.push({id:c,label:c,items:d,open:s||!i.has(c),highlights:!1})}return r}const Eo=32,xc=4;function Tc(e,t,s){const i=[],a=new Map,o=Math.max(136,t-16),r=Math.max(1,Math.floor((o+4)/140));let c=0;const d=(l,m,w,y,O=1)=>{y.forEach((pe,T)=>a.set(pe.row.document.id,{band:i.length,column:T})),i.push({section:l,kind:m,height:w,top:c,items:y,cols:O}),c+=w};for(const l of e)if(d(l,"header",Eo,[]),!!l.open)if(l.highlights)for(const m of l.items)d(l,"highlight",m.why?68:44,[m]);else if(s&&l.id==="Images"){const m=(o-4*(r-1))/r,w=Math.round((m-8)*3/4)+32;for(let y=0;y<l.items.length;y+=r)d(l,"tiles",w,l.items.slice(y,y+r),r)}else if(s&&l.id==="Videos")for(const m of l.items)d(l,"video",Math.min(Math.round((o-8)*9/16),280)+32,[m]);else if(s&&l.id==="Sounds")for(const m of l.items)d(l,"audio",80,[m]);else for(const m of l.items)d(l,"compact",36,[m]);return{bands:i,height:c,columns:r,positions:a}}function Ec(e,t,s,i){const a=Math.max(600,s*.75);let o=0,r=e.bands.length;for(;o<r;){const l=o+r>>>1,m=e.bands[l];m.top+m.height<t-a?o=l+1:r=l}const c=new Set;for(let l=o;l<e.bands.length&&e.bands[l].top<=t+s+a;l++)c.add(l);const d=i?e.positions.get(i):null;return d&&c.add(d.band),[...c].sort((l,m)=>l-m)}function Rc(e,t,s,i){const a=e.positions.get(t);if(!a)return null;const o=e.bands[a.band],r=e.bands.filter(m=>m.section.id===o.section.id&&m.items.length);if(s==="Home")return r[0]?.items[0]?.row.document.id??null;if(s==="End")return r.at(-1)?.items.at(-1)?.row.document.id??null;if(s==="ArrowLeft"||s==="ArrowRight")return o.items[a.column+(s==="ArrowLeft"?-1:1)]?.row.document.id??null;const c=s==="ArrowUp"||s==="PageUp"?-1:1,d=o.top+(s.startsWith("Page")?i*c:c);let l=a.band+c;for(;l>=0&&l<e.bands.length;l+=c){const m=e.bands[l];if(m.items.length&&!(s.startsWith("Page")&&(c>0?m.top<d:m.top>d)))return m.items[Math.min(a.column,m.items.length-1)].row.document.id}if(s.startsWith("Page")){const m=e.bands.filter(y=>y.items.length),w=c<0?m[0]:m.at(-1);return w?.items[c<0?0:w.items.length-1]?.row.document.id??null}return null}const Ro="both",ss="by-turn",Rt=[{value:"by-turn",label:"By turn"},{value:"by-response",label:"By response"}];function Pc(e){for(const t of Rt)if(e===t.value)return t.value;return ss}function Oc(e){return Rt.find(t=>t.value===e)?.label??Rt[0].label}const Cc="primary+alt+shift+space",Po=/^f([1-9]|1[0-9]|2[0-4])$/;function Oo(e){return Po.test(e)}function Co(e,t){const s=jo(e,t);return t==="mac"?s.join(""):s.join("+")}function jo(e,t){const i=t==="mac"?{primary:"⌘",meta:"⌘",ctrl:"⌃",alt:"⌥",shift:"⇧"}:{primary:"Ctrl",meta:t==="win"?"Win":"Super",ctrl:"Ctrl",alt:"Alt",shift:"Shift"},a={space:"Space",backspace:"Backspace",delete:"Delete",insert:"Insert",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown",up:"Up",down:"Down",left:"Left",right:"Right"};return e.split("+").map(o=>o.trim().toLowerCase()).filter(o=>o.length>0).map(o=>o in i?i[o]:o in a?a[o]:Oo(o)||o.length===1?o.toUpperCase():o)}const st=[{id:"panel.console",label:"Open console",category:"Panels",defaultChord:"primary+j",scope:"app"},{id:"panel.canvas",label:"Open canvas",category:"Panels",defaultChord:"primary+shift+c",scope:"app"},{id:"panel.run",label:"Open run details",category:"Panels",defaultChord:null,scope:"app"},{id:"panel.ask",label:"Open asks",category:"Panels",defaultChord:null,scope:"app"},{id:"panel.browser",label:"Open browser",category:"Panels",defaultChord:null,scope:"app"},{id:"panel.code",label:"Open code review",category:"Panels",defaultChord:null,scope:"app"}],Ao=new Map(st.map(e=>[e.id,e])),$o=e=>Ao.get(e),No=new Set(["primary+0","primary+r","primary+shift+r","primary+t","primary+shift+t","primary+l",...[1,2,3,4,5,6,7,8,9].map(e=>`primary+${e}`)]),$t=new Map([["primary+p","Reserved: opens the command palette from anywhere."],["primary+shift+p","Reserved: opens the command palette on commands."],["primary+shift+s","Reserved: starts speech to text."],["primary+k","Reserved: opens the command palette on chats."],["primary+n","Reserved: starts a new chat."],["primary+b","Reserved: toggles the sidebar."],["primary+[","Reserved: goes back in the browser, or between chats outside it."],["primary+]","Reserved: goes forward in the browser, or between chats outside it."],["primary+f","Reserved: finds in the browser page, or searches the transcript outside it."],["primary+alt+up","Reserved: walks up the chat regions."],["primary+alt+down","Reserved: walks down the chat regions."],["primary+shift+a","Reserved: archives the focused conversation."],["primary+s","Reserved: saves the canvas document."],["primary+o","Reserved: opens a file in the canvas."],["primary+shift+up","Reserved: moves the focused chat up the pinned order."],["primary+shift+down","Reserved: moves the focused chat down the pinned order."],["primary+c","Reserved: copy."],["primary+x","Reserved: cut."],["primary+v","Reserved: paste."],["primary+a","Reserved: select all."],["primary+z","Reserved: undo."],["primary+shift+z","Reserved: redo."],["primary+y","Reserved: redo on Windows and Linux."],["primary+r","Reserved: reloads the browser page."],["primary+shift+r","Reserved: reloads the browser page, ignoring the cache."],["primary+t","Reserved: opens a new browser tab."],["primary+shift+t","Reserved: reopens the last closed browser tab."],["primary+l","Reserved: focuses the browser address bar."],...[1,2,3,4,5,6,7,8,9].map(e=>[`primary+${e}`,e===9?"Reserved: switches to the last browser tab.":`Reserved: switches to browser tab ${e}.`]),["primary+0","Reserved: resets browser page zoom, or app zoom outside it."],["primary+plus","Reserved: zooms the browser page or app in."],["primary+=","Reserved: zooms the browser page or app in."],["primary+-","Reserved: zooms the browser page or app out."],["primary+q","Reserved: quits the app."],["primary+w","Reserved: closes the browser tab, or the window outside it."],["primary+m","Reserved: minimises the window."]]),Mo=["primary","alt","shift"],Do={primary:"primary",meta:"primary",cmd:"primary",command:"primary",super:"primary",ctrl:"primary",control:"primary",alt:"alt",option:"alt",shift:"shift"},Lo=new Set(["space","backspace","delete","insert","home","end","pageup","pagedown","up","down","left","right"]),Uo=e=>Lo.has(e)||/^[a-z0-9]$/.test(e);function Nt(e){if(typeof e!="string")return null;const t=e.toLowerCase().split("+").map(o=>o.trim()).filter(o=>o.length>0);if(t.length===0)return null;const s=t[t.length-1];if(!Uo(s))return null;const i=new Set;for(const o of t.slice(0,-1)){const r=Do[o];if(r===void 0)return null;i.add(r)}return[...Mo.filter(o=>i.has(o)),s].join("+")}const is=e=>e.split("+").includes("primary");function it(e,t){const s=t?.[e];return s===null?null:typeof s=="string"&&!$t.has(s)?s:$o(e)?.defaultChord??null}function jc(e){const t=new Map;for(const s of st){const i=it(s.id,e);i!==null&&!t.has(i)&&t.set(i,s.id)}return t}const Zo=e=>e==="mac"?"A shortcut needs ⌘ or Ctrl.":"A shortcut needs Ctrl.";function Bo(e,t,s,i="linux"){const a=e===null?null:Nt(e);if(a===null)return"That key cannot be bound.";if(!is(a))return Zo(i);const o=$t.get(a);if(o!==void 0)return o;for(const r of st)if(r.id!==t&&it(r.id,s)===a)return`Already assigned to ${r.label}.`;return null}function Go(e){if(e===null||typeof e!="object"||Array.isArray(e))return{};const t=e,s=new Set,i={};for(const a of st){const o=t[a.id];if(o===null){i[a.id]=null;continue}const r=typeof o=="string"?Nt(o):null,c=r!==null&&No.has(r),d=r!==null&&is(r)&&(c||!$t.has(r)&&!s.has(r))?r:null;d!==null&&(i[a.id]=d);const l=it(a.id,i);l!==null&&s.add(l)}return i}function Ac(e,t,s){const i=it(e,t);return i===null?null:as(i,s)}function as(e,t){return Co(e,t)}function $c(e,t){const s=e.split("+"),i=s[s.length-1],a=s.slice(0,-1).map(o=>o==="primary"?t==="mac"?"Meta":"Control":o==="shift"?"Shift":o==="alt"?"Alt":o);return{glyph:as(e,t),aria:[...a,i.length===1?i.toUpperCase():i].join("+")}}const wn=64,Pt=["canvas","run","browser","console","code"],zo={canvas:"isCanvasOpen",run:"isRunPanelOpen",browser:"isBrowserPaneOpen",console:"isConsolePaneOpen",code:"isCodeReviewPaneOpen"};function os(e){return typeof e=="string"&&Pt.includes(e)}function Mt(e){return e.startsWith("draft:")}function Me(e,t){for(let s=e.length-1;s>=0;s-=1){const i=e[s];if(i[0]===t)return i[1]}}function Dt(e){return e.length>wn?e.slice(e.length-wn):e}function rs(e,t,s){return Dt([...e.filter(([i])=>i!==t),[t,s]])}function Fo(e,t,s){return Me(e,t)!==s?e:e.filter(([i])=>i!==t)}function Ho(e,t){return Me(e,t)===void 0?e:e.filter(([s])=>s!==t)}function Vo(e,t,s){const i=Me(e,t);return i===void 0?e:Dt([...e.filter(([a])=>a!==t&&a!==s),[s,i]])}const In=Object.freeze({isCanvasOpen:!1,isRunPanelOpen:!1,isBrowserPaneOpen:!1,isConsolePaneOpen:!1,isCodeReviewPaneOpen:!1});function xn(e,t,s){if(s||typeof t!="string")return In;const i=Me(e,t);return i===void 0?In:{isCanvasOpen:i==="canvas",isRunPanelOpen:i==="run",isBrowserPaneOpen:i==="browser",isConsolePaneOpen:i==="console",isCodeReviewPaneOpen:i==="code"}}function Wo(e){if(!Array.isArray(e))return[];const t=new Map;for(const s of e){if(!Array.isArray(s)||s.length!==2)continue;const[i,a]=s;typeof i!="string"||i===""||Mt(i)||os(a)&&(t.delete(i),t.set(i,a))}return Dt([...t.entries()])}function Nc(e){const t=new Set(Object.keys(e.forgotten));for(const[s,i]of Object.entries(e.archiveFacts))i?.archived===!0&&i.answered===!0&&t.add(s);return t}function Tn(e){return zo[e]}const Ko={canvas:"isCanvasOpen",run:"isRunPanelOpen",browser:"isBrowserPaneOpen",console:"isConsolePaneOpen",code:"isCodeReviewPaneOpen"},De=e=>e.isCanvasOpen?"canvas":e.isRunPanelOpen?"run":e.isBrowserPaneOpen?"browser":e.isConsolePaneOpen?"console":e.isCodeReviewPaneOpen?"code":e.isAskDrawerOpen?"ask":null,at=(e,t)=>e==="ask"?t.askDrawerScope==="fleet"||t.rightSlotRoute.mounted&&t.rightSlotRoute.session:t.rightSlotRoute.mounted,Yo=e=>{const t=De(e);return t===null||t==="ask"?null:Ko[t]},H=e=>({isRunPanelOpen:e==="isRunPanelOpen",isCanvasOpen:e==="isCanvasOpen",isBrowserPaneOpen:e==="isBrowserPaneOpen",isConsolePaneOpen:e==="isConsolePaneOpen",isCodeReviewPaneOpen:e==="isCodeReviewPaneOpen",isAskDrawerOpen:e==="isAskDrawerOpen",askDrawerEvictedPane:null}),X=(e,t)=>{const s=e.rightSlotKey;return typeof s!="string"?{}:{rightSlotMemory:rs(e.rightSlotMemory,s,t)}},fe=(e,t)=>{const s=e.rightSlotKey;if(typeof s!="string")return{};const i=Fo(e.rightSlotMemory,s,t);return i===e.rightSlotMemory?{}:{rightSlotMemory:i}},Xo=e=>{const t=e.rightSlotKey;if(typeof t!="string")return{};const s=Ho(e.rightSlotMemory,t);return s===e.rightSlotMemory?{}:{rightSlotMemory:s}},Jo=Object.freeze({mounted:!1,session:!1}),cs=Object.freeze([]);function Mc(e,t){const s=De(t);if(s===null||!at(s,t))return 0;let i;switch(s){case"canvas":case"ask":i=Math.max(Qn,t.rightSlotWidth||ge);break;case"run":i=Math.max(Rn,t.rightSlotWidth||ge);break;case"browser":i=Math.max(tr,t.rightSlotWidth||ge);break;case"console":i=Math.max(nr,t.rightSlotWidth||ge);break;case"code":i=Math.max(Rn,t.rightSlotWidth||ge);break}return e<=0?i:s==="canvas"||s==="ask"?Math.min(i,qn(e)):Math.min(i,Math.max(0,e-Xn))}function Dc(e){const t=De(e);return t!==null&&at(t,e)}function Lc(e){const t=De(e);return t!==null&&at(t,e)?t:null}function Uc(e){const t=De(e);return(t==="canvas"||t==="ask")&&at(t,e)}const ge=640,En=Ne,Qo=20,qo=4,er=20,Rn=320,tr=480,nr=480,sr=5e3,Zc=(e,t)=>e.some(s=>s.surface===t),Bc=(e,t=Date.now())=>e.some(s=>t-s.at<sr),ir=[],ar=4,or=["chatMeasureWidth"],Gc=Hn()(Wn((e,t)=>({finderFiles:ns,setFinderFiles:s=>e({finderFiles:At({...t().finderFiles,...s})}),isCommandPaletteOpen:!1,commandPaletteQuery:"",isSidebarCollapsed:!1,sidebarOverflowExpanded:!1,showAgentReasoning:!1,transcriptDisplayMode:ss,themeName:ds,rightSlotWidth:0,chatSidebarWidth:En,chatSidebarRegions:Ro,chatSidebarView:_e,chatSidebarListHeight:null,chatSidebarOrder:"entities-first",dismissedBuiltinOfferSignature:"",isCanvasOpen:!1,isRunPanelOpen:!1,isBrowserPaneOpen:!1,isConsolePaneOpen:!1,isCodeReviewPaneOpen:!1,rightSlotKey:void 0,rightSlotMemory:cs,rightSlotLegacySeed:null,isAskDrawerOpen:!1,askDrawerScope:"session",askDrawerEvictedPane:null,askOpenIntent:null,rightSlotRoute:Jo,consoleOpenIntent:null,runPanelReveal:null,codeReviewReveal:null,browserPaneScope:"conversation",consoleActiveSurface:null,consoleUnseen:ir,isCreateAgentDialogOpen:!1,mentionRecents:null,profileRecents:{agent:[],team:[]},conversationRecents:[],shortcutBindings:{},openCreateAgentDialog:()=>{e({isCreateAgentDialogOpen:!0})},closeCreateAgentDialog:()=>{e({isCreateAgentDialogOpen:!1})},openCommandPalette:()=>{e({isCommandPaletteOpen:!0})},closeCommandPalette:()=>{e({isCommandPaletteOpen:!1,commandPaletteQuery:""})},toggleCommandPalette:(s="")=>{e(i=>({isCommandPaletteOpen:!i.isCommandPaletteOpen,commandPaletteQuery:i.isCommandPaletteOpen?i.commandPaletteQuery:s}))},setCommandPaletteQuery:s=>{e({commandPaletteQuery:s})},toggleSidebar:()=>{e(s=>({isSidebarCollapsed:!s.isSidebarCollapsed}))},setSidebarOverflowExpanded:s=>{e({sidebarOverflowExpanded:s})},setSidebarCollapsed:s=>{e({isSidebarCollapsed:s})},setShowAgentReasoning:s=>{e({showAgentReasoning:s})},setTranscriptDisplayMode:s=>{e({transcriptDisplayMode:s})},setTheme:s=>{e({themeName:s})},setCanvasOpen:s=>{e(i=>s?{...H("isCanvasOpen"),...X(i,"canvas")}:{isCanvasOpen:!1,...fe(i,"canvas")})},setRunPanelOpen:s=>{e(i=>s?{...H("isRunPanelOpen"),...X(i,"run")}:{isRunPanelOpen:!1,...fe(i,"run")})},setBrowserPaneOpen:s=>{e(i=>s?{...H("isBrowserPaneOpen"),...X(i,"browser")}:{isBrowserPaneOpen:!1,...fe(i,"browser")})},setConsolePaneOpen:s=>{e(i=>s?{...H("isConsolePaneOpen"),...X(i,"console")}:{isConsolePaneOpen:!1,...fe(i,"console")})},setCodeReviewPaneOpen:s=>{e(i=>s?{...H("isCodeReviewPaneOpen"),...X(i,"code")}:{isCodeReviewPaneOpen:!1,...fe(i,"code")})},clearCodeReviewReveal:s=>{e(i=>i.codeReviewReveal?.nonce===s?{codeReviewReveal:null}:{})},revealCodeReviewPane:()=>{e(s=>({...H("isCodeReviewPaneOpen"),...X(s,"code"),codeReviewReveal:{nonce:(s.codeReviewReveal?.nonce??0)+1}}))},setAskDrawerOpen:(s,i,a)=>{e(o=>{const r=typeof o.rightSlotKey=="string";if(s)return{...H("isAskDrawerOpen"),askDrawerScope:i,askDrawerEvictedPane:r?null:Yo(o),askOpenIntent:null};const c={isAskDrawerOpen:!1,askDrawerEvictedPane:null,askOpenIntent:null};return r?a?.dismissSlot?{...c,...Xo(o)}:{...c,...xn(o.rightSlotMemory,o.rightSlotKey,!1)}:o.rightSlotKey===null?a?.dismissSlot?{...c,rightSlotLegacySeed:null}:c:a?.dismissSlot?{...c,rightSlotLegacySeed:null}:{...c,...o.askDrawerEvictedPane===null?null:{[o.askDrawerEvictedPane]:!0}}})},requestAskOpen:(s,i="menu")=>{e({askOpenIntent:{scope:s,via:i}})},clearAskOpenIntent:s=>{e(i=>i.askOpenIntent?.scope===s?{askOpenIntent:null}:{})},setConsoleActiveSurface:s=>{e({consoleActiveSurface:s})},requestConsoleOpen:s=>{e({consoleOpenIntent:s})},clearConsoleOpenIntent:s=>{e(i=>i.consoleOpenIntent===s?{consoleOpenIntent:null}:{})},markConsoleUnseen:(s,i)=>{e(a=>a.consoleUnseen.some(o=>o.surface===i)?{}:{consoleUnseen:[...a.consoleUnseen,{sessionId:s,surface:i,at:Date.now()}]})},clearConsoleUnseen:s=>{const i=Array.isArray(s)?s:[s];e(a=>{const o=a.consoleUnseen.filter(r=>!i.includes(r.surface));return o.length===a.consoleUnseen.length?{}:{consoleUnseen:o}})},setRightSlotWidth:s=>{e({rightSlotWidth:s})},restoreDefaultRightSlotWidth:()=>{e({rightSlotWidth:0})},bindRightSlotKey:(s,i)=>{e(a=>{let o=a.rightSlotMemory,r=a.rightSlotLegacySeed;const c=i?.admittedFrom;return typeof c=="string"&&typeof s=="string"&&(o=Vo(o,c,s)),s===null||(Mt(s)?r=null:r!==null&&Me(o,s)===void 0&&(o=rs(o,s,r),r=null)),{rightSlotKey:s,rightSlotMemory:o,rightSlotLegacySeed:r,...xn(o,s,a.isAskDrawerOpen)}})},setRightSlotRoute:s=>{const i=t().rightSlotRoute;i.mounted===s.mounted&&i.session===s.session||e({rightSlotRoute:{...s}})},setShortcutBinding:(s,i)=>{if(i===null){e(o=>{const r={...o.shortcutBindings};return delete r[s],{shortcutBindings:r}});return}const a=Nt(i);a!==null&&Bo(a,s,t().shortcutBindings)===null&&e(o=>({shortcutBindings:{...o.shortcutBindings,[s]:a}}))},clearShortcutBinding:s=>{e(i=>({shortcutBindings:{...i.shortcutBindings,[s]:null}}))},setBrowserPaneScope:s=>{e({browserPaneScope:s})},revealRunPanelSection:s=>{e(i=>({...H("isRunPanelOpen"),...X(i,"run"),runPanelReveal:{section:s,nonce:(i.runPanelReveal?.nonce??0)+1}}))},clearRunPanelReveal:s=>{e(i=>i.runPanelReveal?.nonce===s?{runPanelReveal:null}:{})},setChatSidebarWidth:s=>{e({chatSidebarWidth:Math.min(Yn,Math.max(Kn,s))})},setChatSidebarRegions:s=>{e({chatSidebarRegions:s})},setChatSidebarListHeight:s=>{e({chatSidebarListHeight:s})},restoreDefaultChatSidebarListHeight:()=>{e({chatSidebarListHeight:null})},setChatSidebarOrder:s=>{e({chatSidebarOrder:s})},setChatSidebarView:s=>{e({chatSidebarView:s})},dismissBuiltinOffer:s=>{e({dismissedBuiltinOfferSignature:s})},restoreDefaultChatSidebarWidth:()=>{e({chatSidebarWidth:En})},rememberMention:(s,i)=>{e(a=>{const o=a.mentionRecents,r=o?.cwd===s?o.paths:[],c=[i,...r.filter(d=>d!==i)].slice(0,Qo);return{mentionRecents:{cwd:s,paths:c}}})},rememberProfile:(s,i)=>{e(a=>({profileRecents:{...a.profileRecents,[s]:rr(a.profileRecents[s]??[],i)}}))},rememberConversation:s=>{e(i=>{const a=dr(i.conversationRecents),o=cr(a,s);return o.length===a.length&&o.every((r,c)=>r===a[c])?i:{conversationRecents:o}})}}),{name:"ui-preferences-storage",version:ar,migrate:hr,partialize:pr,merge:mr}));function rr(e,t){return[t,...e.filter(s=>s!==t)].slice(0,qo)}function cr(e,t){return[t,...e.filter(s=>s!==t)].slice(0,er)}const lr=[];function dr(e){return Array.isArray(e)?e:lr}function pr(e){const{runPanelReveal:t,codeReviewReveal:s,consoleOpenIntent:i,askOpenIntent:a,isAskDrawerOpen:o,askDrawerScope:r,askDrawerEvictedPane:c,rightSlotRoute:d,isCanvasOpen:l,isRunPanelOpen:m,isBrowserPaneOpen:w,isConsolePaneOpen:y,isCodeReviewPaneOpen:O,rightSlotKey:pe,...T}=e;return{...T,rightSlotMemory:ur(e.rightSlotMemory)}}function ur(e){return(e??cs).filter(([t])=>!Mt(t))}function mr(e,t){const s=e??{},{isCanvasOpen:i,isRunPanelOpen:a,isBrowserPaneOpen:o,isConsolePaneOpen:r,isCodeReviewPaneOpen:c,...d}=s;return{...t,...d,finderFiles:At(s.finderFiles),rightSlotKey:t.rightSlotKey,rightSlotMemory:Wo(s.rightSlotMemory),rightSlotLegacySeed:os(s.rightSlotLegacySeed)?s.rightSlotLegacySeed:null,shortcutBindings:Go(s.shortcutBindings)}}function hr(e,t){const s={...e??{}};if(t<1&&fr(s),t<2)for(const i of or)delete s[i];if(t<3){let i=null;for(const a of Pt)if(s[Tn(a)]===!0){i=a;break}i!==null&&(s.rightSlotLegacySeed=i);for(const a of Pt)delete s[Tn(a)]}return t<4&&(s.finderFiles=At(s.finderFiles)),s}function fr(e){const t=[["canvasWidth",800],["runPanelWidth",420],["browserPanelWidth",640],["consolePanelWidth",796]];let s=0;for(const[i,a]of t){const o=e[i];if(typeof o=="number"&&o>0&&o!==a){s=o;break}}for(const[i]of t)delete e[i];e.rightSlotWidth=s}export{uc as $,Ac as A,J as B,Ua as C,Cc as D,Er as E,Pr as F,$c as G,Bc as H,sr as I,Zc as J,st as K,Kr as L,Hr as M,Pi as N,Oi as O,ln as P,Ct as Q,Rr as R,Ht as S,Rt as T,yo as U,Sn as V,nc as W,_c as X,yc as Y,kc as Z,Sc as _,Ki as a,Wr as a$,mc as a0,re as a1,_e as a2,ec as a3,ts as a4,ac as a5,bc as a6,Ae as a7,gc as a8,vc as a9,Mc as aA,Yr as aB,Qn as aC,qn as aD,Rn as aE,ge as aF,tr as aG,nr as aH,kn as aI,Xn as aJ,dr as aK,Mr as aL,Dr as aM,n as aN,jc as aO,Qr as aP,es as aQ,Co as aR,Mt as aS,Nc as aT,$r as aU,jr as aV,Zr as aW,Ur as aX,Ar as aY,Nr as aZ,Fr as a_,dc as aa,pc as ab,rc as ac,oc as ad,cc as ae,lo as af,lc as ag,sc as ah,hc as ai,fc as aj,ro as ak,nt as al,tc as am,qr as an,ic as ao,wc as ap,Ic as aq,Tc as ar,Ec as as,Eo as at,xc as au,Rc as av,wr as aw,Oc as ax,Dc as ay,Jo as az,Yi as b,Lr as b0,Br as b1,St as b2,Sr as b3,A as b4,Vn as b5,Uc as b6,Xr as b7,Jr as b8,Ya as b9,Tt as ba,Jn as bb,Yn as bc,Kn as bd,Gr as be,Yt as bf,zr as bg,$i as bh,Or as bi,Cr as bj,ss as bk,Vr as bl,Ci as bm,ji as bn,Ai as bo,Jt as bp,Nt as bq,Oo as br,Ui as bs,Ri as bt,Xt as bu,Xi as c,Ji as d,Hn as e,jo as f,Wn as g,ca as h,Qi as i,la as j,fn as k,Tr as l,xr as m,kr as n,it as o,Ir as p,as as q,Bo as r,Pc as s,_r as t,Gc as u,vr as v,br as w,yr as x,Ti as y,Lc as z};