@entrydesk/cli 2.1.0-beta.2 → 2.1.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -12
- package/dist/{add-DXYghmJz.js → add-4VqDcbIj.js} +9 -1
- package/dist/agents-CCOqroYN.js +10 -0
- package/dist/{billing-Bkk1BhAw.js → billing-BV5kdyQb.js} +9 -1
- package/dist/{budget-dazpYOON.js → budget-CnxbNkne.js} +9 -1
- package/dist/build-task-request-config-CjKDSNjv.js +10 -0
- package/dist/commands-DRUlUd-I.js +10 -0
- package/dist/{commands-DUKXJUfr.js → commands-gyHmiEsC.js} +9 -1
- package/dist/{config-CSJx1Xlt.js → config-CJf4r7wp.js} +9 -1
- package/dist/confirm-Ct432t3K.js +10 -0
- package/dist/connectors-C_Re7e0l.js +11 -0
- package/dist/{file-upload-BmP4AJY0.js → file-upload-D2s_clGk.js} +8 -0
- package/dist/{format-C3tQC6LL.js → format-DCvznP70.js} +8 -0
- package/dist/{hash-Ddmw8YE4.js → hash-CnSb1n2t.js} +8 -0
- package/dist/index.js +50 -15
- package/dist/{installer-iaoPJQn3.js → installer-CKB3jBE-.js} +8 -0
- package/dist/instruction-DYgn39xF.js +10 -0
- package/dist/isRecord-BNZWvqVS.js +10 -0
- package/dist/{login-ACaFCfsh.js → login-C0Zz6tHG.js} +9 -1
- package/dist/logout-DnFBlXMZ.js +10 -0
- package/dist/{marketplace-S_4fkbWt.js → marketplace-DQsEzT6T.js} +9 -1
- package/dist/{mcp-DOUHU2_Z.js → mcp-DHXuIFWP.js} +9 -1
- package/dist/{mcp-client-LcmqajIh.js → mcp-client-EK-Fh8gM.js} +9 -1
- package/dist/{meeting-BG76tnT9.js → meeting-C6H_GJB7.js} +9 -1
- package/dist/message-utils-Cq_Fel5P.js +15 -0
- package/dist/{models-CkepW_-c.js → models-DT78HZxx.js} +9 -1
- package/dist/{notifications-BAMcYXhl.js → notifications-3UrKbGaT.js} +9 -1
- package/dist/options-Dpxg1wT1.js +10 -0
- package/dist/paginate-Brd-j5V8.js +10 -0
- package/dist/{paths-DQh1PdjS.js → paths-mBL9tt9p.js} +9 -1
- package/dist/{profile-BzXbLYDw.js → profile-D4m5ZAG7.js} +9 -1
- package/dist/profile-storage-CPg61h-2.js +68 -0
- package/dist/{project-B9uLW5nn.js → project-C5_rCWCh.js} +9 -1
- package/dist/project-context-DnIuy1T0.js +10 -0
- package/dist/{project-governance-CwVlxGE2.js → project-governance-CxDZSThr.js} +9 -1
- package/dist/{project-sources-BzMkopCj.js → project-sources-D17oXXhL.js} +9 -1
- package/dist/project-sources-write-C-W8gjLg.js +10 -0
- package/dist/{project-tasks-CnXLm061.js → project-tasks-t4HFgEoZ.js} +9 -1
- package/dist/{push-DWIgzvqe.js → push-CJZLFEdk.js} +9 -1
- package/dist/{recordings-_HnTtukO.js → recordings-DeB1LqiS.js} +9 -1
- package/dist/remote-D3JMUBbh.js +10 -0
- package/dist/{remove-Cpen9pWn.js → remove-ChV-BE95.js} +9 -1
- package/dist/resolve-Czx_OkYk.js +14 -0
- package/dist/resource-grants-zAoqe73P.js +10 -0
- package/dist/{rolldown-runtime-CIdiawuB.js → rolldown-runtime-CiM6yMNq.js} +8 -0
- package/dist/{schedules-DACWrdY_.js → schedules-COBaV-Be.js} +10 -2
- package/dist/skills-OLZywcSs.js +10 -0
- package/dist/{status-BKd81bGK.js → status-CpfDbB9S.js} +9 -1
- package/dist/{status-ErhWpQxW.js → status-Oo8upbyy.js} +9 -1
- package/dist/stdin-B18x8pUF.js +10 -0
- package/dist/task-C8PttINZ.js +108 -0
- package/dist/tasks-CAmfAGsn.js +22 -0
- package/dist/tasks-dv0gJ38_.js +10 -0
- package/dist/tool-kEevHrsQ.js +17 -0
- package/dist/{update-D09UponU.js → update-Y9S-P4wG.js} +9 -1
- package/dist/{usage-Dibnsgtg.js → usage-CHIhyA8S.js} +9 -1
- package/dist/{usage-audit-Be431Kj1.js → usage-audit-C1xGe42N.js} +9 -1
- package/dist/version-Dgsb7T5N.js +10 -0
- package/dist/workflow-DWmgcRJ_.js +14 -0
- package/dist/{workspaces-rVOwf5zp.js → workspaces-3PFiXy1I.js} +9 -1
- package/package.json +11 -7
- package/dist/agents-Drg2ZD85.js +0 -2
- package/dist/build-task-request-config-BDlX-M_P.js +0 -2
- package/dist/commands-FVFeS1MV.js +0 -2
- package/dist/confirm-BrJZbaxf.js +0 -2
- package/dist/connectors-CHcopt49.js +0 -3
- package/dist/instruction-BXKEUplM.js +0 -2
- package/dist/logout-BX4YsOqw.js +0 -2
- package/dist/options-CgmngSTC.js +0 -2
- package/dist/paginate-DUu8qbek.js +0 -2
- package/dist/profile-storage-DlaupNlV.js +0 -60
- package/dist/project-context-VlX5GZxr.js +0 -2
- package/dist/project-sources-write-D3WzWqet.js +0 -2
- package/dist/remote-nEFOyIM2.js +0 -2
- package/dist/resolve-7OXPmNrX.js +0 -6
- package/dist/resource-grants-D-ImlByb.js +0 -2
- package/dist/skills-BenhDHKq.js +0 -2
- package/dist/stdin-DzzLUF6W.js +0 -2
- package/dist/task-CvQD8Y4d.js +0 -104
- package/dist/tasks-C4dAgHmR.js +0 -2
- package/dist/tasks-CnncSIan.js +0 -14
- package/dist/terminal-text-D04u1hg1.js +0 -2
- package/dist/tool-CpSoLUlR.js +0 -5
- package/dist/version-BTqAbDeB.js +0 -2
- package/dist/workflow-Dx41WM43.js +0 -6
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{n as e,t}from"./rolldown-runtime-CIdiawuB.js";import n from"node:fs";import r from"node:os";import i from"node:path";import a,{HTTPError as o,TimeoutError as s,isHTTPError as c}from"ky";import{isToolUIPart as l}from"ai";import u from"node:crypto";import{execFile as d}from"node:child_process";import{setTimeout as f}from"node:timers/promises";import{decodeJwt as p}from"jose";function m(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ee(e,t=`|`){return e.map(e=>ge(e)).join(t)}function te(e,t){return typeof t==`bigint`?t.toString():t}function ne(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function re(e){return e==null}function ie(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ae(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function h(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function g(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function oe(e){return JSON.stringify(e)}function se(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const ce=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function le(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const ue=ne(()=>{if(b.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function de(e){if(le(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return le(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function fe(e){return de(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const pe=new Set([`string`,`number`,`symbol`]);function me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function he(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ge(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function _e(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}const ve={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ye(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return he(e,g(e._zod.def,{get shape(){let e={};for(let r of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,r))throw Error(`Unrecognized key: "${String(r)}"`);t[r]&&h(e,r,n.shape[r])}return h(this,`shape`,e),e},checks:[]}))}function be(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return he(e,g(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,e))throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&delete r[e]}return h(this,`shape`,r),r},checks:[]}))}function xe(e,t){if(!de(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return he(e,g(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return h(this,`shape`,n),n}}))}function Se(e,t){if(!de(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return he(e,g(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return h(this,`shape`,n),n}}))}function Ce(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return he(e,g(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return h(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function we(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);return he(t,g(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t of Reflect.ownKeys(r))i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return h(this,`shape`,i),i},checks:[]}))}function Te(e,t,n){return he(t,g(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(i,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t of Reflect.ownKeys(r))i[t]=new e({type:`nonoptional`,innerType:r[t]});return h(this,`shape`,i),i}}))}function Ee(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function De(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Oe(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ke(e){return typeof e==`string`?e:e?.message}function Ae(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function je(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:ke(e.inst?._zod.def?.error?.(e))??ke(a?.(e))??ke(t?.error?.(e))??ke(n.customError?.(e))??ke(n.localeError?.(e))??`Invalid input`,{inst:s,schema:c,continue:l,input:u,...d}=e;return d.path??=[],d.message=o,t?.reportInput&&(d.input=u),d}const Me=/[\uD800-\uDBFF]/;function Ne(e){let t=e.length;if(!Me.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Pe(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Fe(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Ie(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Le(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Be(e,n,r.value)}}function Re(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function ze(e,t,n){return Re(e,t,n,!1)}function Be(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Re(this,t,n.bind(this))},set(e){Re(this,t,e)}})}function Ve(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let He,Ue=!1;const We={configurable:!0,get(){Ue=!0}};function v(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&He!==e._zod){He=void 0;return}He=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,We);let e=Ue;Ue=!1;try{let r=n(this);return Ue?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Ue||=e,r}catch(n){throw delete this[t],Ue||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Ge(e,t,n,r){let i=Ve(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function Ke(e){let t=()=>e;return t[`~constantCatch`]=!0,t}var qe;const Je={value:void 0,enumerable:!1};let Ye=`captureStackTrace`in Error?Error:null;function Xe(e){let t=Ye;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Ye=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function y(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Je.value=new a(r);try{Object.defineProperty(n,"_zod",Je)}finally{Je.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Le(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Xe(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Ze=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Qe=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(qe=globalThis).__zod_globalConfig??(qe.__zod_globalConfig={});const b=globalThis.__zod_globalConfig;function $e(e){return e&&Object.assign(b,e),b}function et(){let e=this._zod;return e.message??=JSON.stringify(e.def,te,2),e.message}function tt(e){this._zod.message=e}const nt={get:et,set:tt,enumerable:!0,configurable:!0},rt={value:void 0,enumerable:!1},it={value:void 0,enumerable:!1},at=new WeakSet([Object.prototype,Error.prototype]),ot=(e,t)=>{e.name=`$ZodError`,rt.value=e._zod,Object.defineProperty(e,"_zod",rt),it.value=t,Object.defineProperty(e,"issues",it),rt.value=void 0,it.value=void 0,Object.defineProperty(e,"message",nt);let n=Object.getPrototypeOf(e);at.has(n)||(at.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},st=y(`$ZodError`,ot),ct=y(`$ZodError`,ot,void 0,{Parent:Error});function lt(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function ut(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?lt(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function dt(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function ft(e,t){return{callee:t?.callee??e,Err:t?.Err}}const pt=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Ze;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>je(e,o,$e())));throw ce(n,a?.callee??t),n}return s.value};return t},mt=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>je(e,o,$e())));throw ce(n,a?.callee??t),n}return s.value};return t},ht=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Ze;return a.issues.length?{success:!1,error:new(e??st)(a.issues.map(e=>je(e,i,$e())))}:{success:!0,data:a.value}},gt=ht(ct),_t=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>je(e,i,$e())))}:{success:!0,data:a.value}},vt=_t(ct),yt=e=>{let t=pt(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,ft(n,a))};return n},bt=e=>{let t=pt(e),n=(e,r,i,a)=>t(e,r,i,ft(n,a));return n},xt=e=>{let t=mt(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,ft(n,a))};return n},St=e=>{let t=mt(e),n=async(e,r,i,a)=>await t(e,r,i,ft(n,a));return n},Ct=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ht(e)(t,n,i)},wt=e=>(t,n,r)=>ht(e)(t,n,r),Tt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return _t(e)(t,n,i)},Et=e=>async(t,n,r)=>_t(e)(t,n,r),Dt=/^[cC][0-9a-z]{6,}$/,Ot=/^[0-9a-z]+$/,kt=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,At=/^[0-9a-vA-V]{20}$/,jt=/^[A-Za-z0-9]{27}$/,Mt=/^[a-zA-Z0-9_-]{21}$/;function Nt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const Pt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ft=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,It=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Lt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Rt(){return RegExp(`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}const zt=/^(?:(?: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])$/,Bt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Vt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ht=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ut=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Wt=/^[A-Za-z0-9_-]*$/,Gt=/^https?$/,Kt=/^\+[1-9]\d{6,14}$/,qt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Jt(e){return RegExp(`^${e}$`)}const Yt=Jt(qt);function Xt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Zt(e){return RegExp(`^${Xt(e)}$`)}function Qt(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Xt({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Xt({precision:e.precision})}`:n;return RegExp(`^${qt}T(?:${r})$`)}const $t=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},en=/^-?\d+$/,tn=/^-?\d+(?:\.\d+)?$/,nn=/^(?:true|false)$/i,rn=/^null$/i,an=/^[^A-Z]*$/,on=/^[^a-z]*$/,x=y(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),sn=e=>{let t=e.value;return!re(t)&&t.length!==void 0},cn={number:`number`,bigint:`bigint`,object:`date`},ln=y(`$ZodCheckLessThan`,(e,t)=>{x.init(e,t);let n=cn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:cn[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),un=y(`$ZodCheckGreaterThan`,(e,t)=>{x.init(e,t);let n=cn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:cn[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),dn=y(`$ZodCheckMultipleOf`,(e,t)=>{x.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):ae(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),fn=y(`$ZodCheckNumberFormat`,(e,t)=>{x.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ve[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=en)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),pn=y(`$ZodCheckMaxLength`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=sn),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Ne(r):i)<=t.maximum)return;let a=Pe(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),mn=y(`$ZodCheckMinLength`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=sn),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Ne(r):i)>=t.minimum)return;let a=Pe(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),hn=y(`$ZodCheckLengthEquals`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=sn),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Ne(r):i;if(a===t.length)return;let o=Pe(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),gn=y(`$ZodCheckStringFormat`,(e,t)=>{var n,r;x.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),_n=y(`$ZodCheckRegex`,(e,t)=>{gn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),vn=y(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=an,gn.init(e,t)}),yn=y(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=on,gn.init(e,t)}),bn=y(`$ZodCheckIncludes`,(e,t)=>{x.init(e,t);let n=me(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),xn=y(`$ZodCheckStartsWith`,(e,t)=>{x.init(e,t);let n=RegExp(`^${me(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Sn=y(`$ZodCheckEndsWith`,(e,t)=>{x.init(e,t);let n=RegExp(`.*${me(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Cn=y(`$ZodCheckOverwrite`,(e,t)=>{x.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var wn=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
3
|
-
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
4
|
-
`)}\n};`)(...Object.values(this.closed))}};const Tn={major:4,minor:5,patch:4},S=y(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Tn;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=Ee(t),a;for(let o of n){if(o._zod.def.when){if(De(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Ze;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Ae(t.issues,n,e),i||=Ee(t,n))});else{if(t.issues.length===n)continue;Ae(t.issues,n,e),i||=Ee(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Ee(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Ze;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Ze;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return ze(this,`~standard`,Dn(this))},set"~standard"(e){Re(this,`~standard`,e)}}),En=e=>e.success?{value:e.data}:{issues:e.error?.issues};function Dn(e){return{validate:t=>{try{return En(gt(e,t))}catch{return vt(e,t).then(En)}},vendor:`zod`,version:1}}const On=y(`$ZodString`,(e,t)=>{S.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??$t(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),C=y(`$ZodStringFormat`,(e,t)=>{gn.init(e,t),On.init(e,t)}),kn=y(`$ZodGUID`,(e,t)=>{t.pattern??=Ft,C.init(e,t)}),An=y(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=It(e)}else t.pattern??=It();C.init(e,t)}),jn=y(`$ZodEmail`,(e,t)=>{t.pattern??=Lt,C.init(e,t)});function Mn(e,t){if(!t.normalize&&t.protocol?.source===Gt.source&&!/^https?:\/\//i.test(e))return 1;try{return new URL(e)}catch{return 2}}const Nn=/[\t\n\r]/g;function Pn(e){return e.replace(Nn,``)}function Fn(e,t){return t.lastIndex=0,t.test(e.hostname)}function In(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}const Ln=y(`$ZodURL`,(e,t)=>{C.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Mn(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}t.hostname&&!Fn(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!In(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Pn(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Rn=y(`$ZodEmoji`,(e,t)=>{t.pattern??=Rt(),C.init(e,t)}),zn=y(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Mt:Nt(t.length),C.init(e,t)}),Bn=y(`$ZodCUID`,(e,t)=>{t.pattern??=Dt,C.init(e,t)}),Vn=y(`$ZodCUID2`,(e,t)=>{t.pattern??=Ot,C.init(e,t)}),Hn=y(`$ZodULID`,(e,t)=>{t.pattern??=kt,C.init(e,t)}),Un=y(`$ZodXID`,(e,t)=>{t.pattern??=At,C.init(e,t)}),Wn=y(`$ZodKSUID`,(e,t)=>{t.pattern??=jt,C.init(e,t)}),Gn=y(`$ZodISODateTime`,(e,t)=>{t.pattern??=Qt(t),C.init(e,t),(t.local||t.precision===-1)&&(e._zod.bag.laxFormat=!0,e._zod.onattach.push(e=>{e._zod.bag.laxFormat=!0}))}),Kn=y(`$ZodISODate`,(e,t)=>{t.pattern??=Yt,C.init(e,t)}),qn=y(`$ZodISOTime`,(e,t)=>{t.pattern??=Zt(t),C.init(e,t)}),Jn=y(`$ZodISODuration`,(e,t)=>{t.pattern??=Pt,C.init(e,t)}),Yn=y(`$ZodIPv4`,(e,t)=>{t.pattern??=zt,C.init(e,t),e._zod.bag.format=`ipv4`}),Xn=/^[0-9a-fA-F:.]+$/;function Zn(e){if(!Xn.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}const Qn=y(`$ZodIPv6`,(e,t)=>{t.pattern??=Bt,C.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{Zn(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),$n=y(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Vt,C.init(e,t)});function er(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Zn(n)}const tr=y(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ht,C.init(e,t),e._zod.check=n=>{er(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function nr(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const rr=y(`$ZodBase64`,(e,t)=>{t.pattern??=Ut,C.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{nr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function ir(e){if(!Wt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return nr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const ar=y(`$ZodBase64URL`,(e,t)=>{t.pattern??=Wt,C.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{ir(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),or=y(`$ZodE164`,(e,t)=>{t.pattern??=Kt,C.init(e,t)});function sr(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const cr=y(`$ZodJWT`,(e,t)=>{C.init(e,t),e._zod.check=n=>{sr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),lr=y(`$ZodNumber`,(e,t)=>{S.init(e,t),e._zod.pattern=e._zod.bag.pattern??tn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),ur=y(`$ZodNumberFormat`,(e,t)=>{fn.init(e,t),lr.init(e,t)}),dr=y(`$ZodBoolean`,(e,t)=>{S.init(e,t),e._zod.pattern=nn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),fr=y(`$ZodNull`,(e,t)=>{S.init(e,t),e._zod.pattern=rn,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),pr=y(`$ZodAny`,(e,t)=>{S.init(e,t),e._zod.parse=e=>e}),mr=y(`$ZodUnknown`,(e,t)=>{S.init(e,t),e._zod.parse=e=>e}),hr=y(`$ZodNever`,(e,t)=>{S.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),gr=y(`$ZodDate`,(e,t)=>{S.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:i,...a?{received:`Invalid Date`}:{},inst:e}),n}});function _r(e,t,n){e.issues.length&&t.issues.push(...Oe(n,e.issues)),t.value[n]=e.value}const vr=y(`$ZodArray`,(e,t)=>{S.init(e,t);let n=b.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[];for(let e=0;e<a.length;e++){let n=a[e],s=t.element._zod.run({value:n,issues:[]},i);s instanceof Promise?o.push(s.then(t=>_r(t,r,e))):_r(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function yr(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(!(!o&&s&&i===`optional`)){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Oe(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}}const br=[];function xr(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:br,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=_e(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Sr(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin,d=c.optout;for(let i in t){if(s.has(i))continue;if(i===`__proto__`){l===`never`&&o.push(i);continue}if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>yr(e,n,i,t,u,d))):yr(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const Cr=new WeakMap,wr=y(`$ZodObject`,(e,t)=>{if(S.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Cr.set(t,e),Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),Cr.set(t,n),n}})}let n=ne(()=>xr(t));v(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||h(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let r=le,i=t.catchall,a,o=b.memoizer;o?.attach(e),e._zod.parse=(t,s)=>{a??=n.value;let c=t.value;if(!r(c))return t.issues.push({expected:`object`,code:`invalid_type`,input:c,inst:e}),t;t.value=o?o.alloc(e,t,{},s):{};let l=[],u=a.shape;for(let e of a.allKeys){if(e===`__proto__`)continue;let n=u[e],r=n._zod.optin,i=n._zod.optout,a=n._zod.run({value:c[e],issues:[]},s);a instanceof Promise?l.push(a.then(n=>yr(n,t,e,c,r,i))):yr(a,t,e,c,r,i)}return i?Sr(l,c,t,s,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),Tr=y(`$ZodObjectJIT`,(e,t)=>{wr.init(e,t);let n=e._zod.parse,r=ne(()=>xr(t)),i=b.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new wn([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
5
|
-
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
6
|
-
const iss = ${e}.issues[i];
|
|
7
|
-
iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
|
|
8
|
-
payload.issues.push(iss);
|
|
9
|
-
}`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:oe(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
|
|
10
|
-
const ${n}_present = ${i};
|
|
11
|
-
if (!${n}.issues.length || ${n}_present) {
|
|
12
|
-
if (${n}.issues.length) {${c(n,r)}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (${e}) {
|
|
16
|
-
newResult[${r}] = ${n}.value;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
`)}else f?o.write(`
|
|
21
|
-
if (${n}.issues.length) {${c(n,r)}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (${n}.value === undefined) {
|
|
25
|
-
if (${i}) {
|
|
26
|
-
newResult[${r}] = undefined;
|
|
27
|
-
}
|
|
28
|
-
} else {
|
|
29
|
-
newResult[${r}] = ${n}.value;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
`):o.write(`
|
|
33
|
-
const ${n}_present = ${i};
|
|
34
|
-
if (${n}.issues.length) {${c(n,r)}
|
|
35
|
-
}
|
|
36
|
-
if (!${n}_present && !${n}.issues.length) {
|
|
37
|
-
payload.issues.push({
|
|
38
|
-
code: "invalid_type",
|
|
39
|
-
expected: "nonoptional",
|
|
40
|
-
input: undefined,
|
|
41
|
-
path: [${r}]
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (${n}_present) {
|
|
46
|
-
newResult[${r}] = ${n}.value;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=le,c=!b.jitless,l=c&&ue.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Sr([],p,i,f,d,e):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Er(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Ee(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>je(e,r,$e())))}),t)}const Dr=y(`$ZodUnion`,(e,t)=>{S.init(e,t),v(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),v(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),v(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),v(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>ie(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Er(t,r,e,i)):Er(o,r,e,i)}}),Or=y(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Dr.init(e,t);let n=e._zod.parse;v(e,`propValues`,e=>{let t={};for(let n of e.def.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(n)}"`);for(let[e,n]of Object.entries(r)){Object.prototype.hasOwnProperty.call(t,e)||h(t,e,new Set);for(let r of n)t[e].add(r)}}return t}),t.options.forEach((e,n)=>{let r=Cr.get(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=ne(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!le(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),kr=y(`$ZodIntersection`,(e,t)=>{S.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>jr(e,t,n)):jr(e,i,a)}});function Ar(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(de(e)&&de(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Ar(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ar(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function jr(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Ar(t.value,n.value);if(!c.valid){if(Ee(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}const Mr=y(`$ZodTuple`,(e,t)=>{S.init(e,t);let n=t.items,r=b.memoizer;r?.attach(e),e._zod.parse=(i,a)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),i;i.value=r?r.alloc(e,i,[],a):[];let s=[],c=Nr(n,`optin`),l=Nr(n,`optout`);if(!t.rest){if(o.length<c)return i.issues.push({code:`too_small`,minimum:c,inclusive:!0,input:o,inst:e,origin:`array`}),i;o.length>n.length&&i.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:o,inst:e,origin:`array`})}let u=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:o[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{u[e]=t})):u[e]=t}if(t.rest){let e=n.length-1,r=o.slice(n.length);for(let n of r){e++;let r=t.rest._zod.run({value:n,issues:[]},a);r instanceof Promise?s.push(r.then(t=>Pr(t,i,e))):Pr(r,i,e)}}return s.length?Promise.all(s).then(()=>Fr(u,i,n,o,l)):Fr(u,i,n,o,l)}});function Nr(e,t){for(let n=e.length-1;n>=0;n--)if(!(t===`optin`?e[n]._zod.optin!==void 0:e[n]._zod.optout===`optional`))return n+1;return 0}function Pr(e,t,n){e.issues.length&&t.issues.push(...Oe(n,e.issues)),t.value[n]=e.value}function Fr(e,t,n,r,i){for(let a=0;a<n.length;a++){let o=e[a],s=a<r.length;if(!s&&a>=i&&n[a]._zod.optin===`optional`){t.value.length=a;break}if(o.issues.length){if(!s&&a>=i){t.value.length=a;break}t.issues.push(...Oe(a,o.issues))}t.value[a]=o.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}const Ir=y(`$ZodRecord`,(e,t)=>{S.init(e,t);let n=b.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!de(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>je(e,i,$e())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Oe(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Oe(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e))if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e);l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&tn.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>je(e,i,$e())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Oe(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Oe(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Lr=y(`$ZodEnum`,(e,t)=>{S.init(e,t);let n=m(t.entries),r=new Set(n);e._zod.values=r;let i=n.filter(e=>pe.has(typeof e));e._zod.pattern=RegExp(i.length?`^(${i.map(e=>me(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Rr=y(`$ZodLiteral`,(e,t)=>{S.init(e,t);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(t.values.length?`^(${t.values.map(e=>typeof e==`string`?me(e):e?me(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),zr=y(`$ZodTransform`,(e,t)=>{S.init(e,t),e._zod.optin=`optional`,b.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Qe(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Ze;return n.value=i,n}});function Br(e,t){return e.value=t.issues.length?void 0:t.value,e}const Vr=y(`$ZodOptional`,(e,t)=>{S.init(e,t),v(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,v(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),v(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${ie(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Br(e,t)):Br(e,r)}return t.innerType._zod.run(e,n)}}),Hr=y(`$ZodExactOptional`,(e,t)=>{Vr.init(e,t),v(e,`values`,e=>e.def.innerType._zod.values),v(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Ur=y(`$ZodNullable`,(e,t)=>{S.init(e,t),v(e,`optin`,e=>e.def.innerType._zod.optin),v(e,`optout`,e=>e.def.innerType._zod.optout),v(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${ie(t.source)}|null)$`):void 0}),v(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Wr=y(`$ZodDefault`,(e,t)=>{S.init(e,t),e._zod.optin=`defaulted`,v(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Gr(e,t)):Gr(r,t)}});function Gr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Kr=y(`$ZodPrefault`,(e,t)=>{S.init(e,t),e._zod.optin=`defaulted`,v(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),qr=y(`$ZodNonOptional`,(e,t)=>{S.init(e,t),v(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Jr(t,e)):Jr(i,e)}});function Jr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Yr(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>je(e,r,$e()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const Xr=y(`$ZodCatch`,(e,t)=>{S.init(e,t),v(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),v(e,`optout`,e=>e.def.innerType._zod.optout),v(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Yr(e,r,t,n)):Yr(e,r,t,n)}}),Zr=y(`$ZodPipe`,(e,t)=>{S.init(e,t),v(e,`values`,e=>e.def.in._zod.values),v(e,`optin`,e=>e.def.in._zod.optin),v(e,`optout`,e=>e.def.out._zod.optout),v(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Qr(e,t.in,n)):Qr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Qr(e,t.out,n)):Qr(r,t.out,n)}});function Qr(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const $r=y(`$ZodCodec`,(e,t)=>{S.init(e,t),v(e,`values`,e=>e.def.in._zod.values),v(e,`optin`,e=>e.def.in._zod.optin),v(e,`optout`,e=>e.def.out._zod.optout),v(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if((n.direction||`forward`)===`forward`){let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ei(e,t,n)):ei(r,t,n)}else{let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>ei(e,t,n)):ei(r,t,n)}}});function ei(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||`forward`)===`forward`){let r=t.transform(e.value,e);return r instanceof Promise?r.then(r=>ti(e,r,t.out,n)):ti(e,r,t.out,n)}else{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(r=>ti(e,r,t.in,n)):ti(e,r,t.in,n)}}function ti(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}const ni=y(`$ZodPreprocess`,(e,t)=>{Zr.init(e,t)}),ri=y(`$ZodReadonly`,(e,t)=>{S.init(e,t),v(e,`propValues`,e=>e.def.innerType._zod.propValues),v(e,`values`,e=>e.def.innerType._zod.values),v(e,`optin`,e=>e.def.innerType?._zod?.optin),v(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ii):ii(r)}});function ii(e){return e.memo||(e.value=Object.freeze(e.value)),e}const ai=y(`$ZodCustom`,(e,t)=>{x.init(e,t),S.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>oi(t,n,r,e));oi(i,n,r,e)}});function oi(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ie(e))}}var si=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}};const ci=`~memo`,li=[];function ui(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const di=new WeakMap;function fi(e,t){let n=di.get(e);if(n!==void 0)return n;if(t.has(e))return!0;t.add(e);let r=!1,i=e=>{!r&&e?._zod&&fi(e,t)&&(r=!0)},a=e._zod.def;switch(a.type){case`object`:for(let e of Reflect.ownKeys(a.shape))i(a.shape[e]);i(a.catchall);break;case`array`:i(a.element);break;case`tuple`:for(let e of a.items)i(e);i(a.rest);break;case`record`:case`map`:i(a.keyType),i(a.valueType);break;case`set`:i(a.valueType);break;case`union`:for(let e of a.options)i(e);break;case`intersection`:i(a.left),i(a.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:i(a.innerType);break;case`pipe`:i(a.in),i(a.out);break;case`function`:i(a.input),i(a.output);break;case`lazy`:i(e._zod.innerType);break;case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in a){let t=Object.getOwnPropertyDescriptor(a,e);if(!t||t.get)continue;let n=t.value;if(!(!n||typeof n!=`object`)){if(n._zod)i(n);else if(Array.isArray(n))for(let e of n)i(e)}}}return t.delete(e),di.set(e,r),r}function pi(e,t){let n=e.buckets.get(t);return n||(n=new Map,e.buckets.set(t,n)),n}let mi;const hi=[],gi={alloc(e,t,n){let r=mi;if(!r)return n;mi=void 0;let i={value:n,issues:null};return r.set(t.value,i),hi.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&vi(n,e.value))throw new si;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,a=(o,s)=>{if(n===void 0&&(n=fi(e,new Set),!n))return e._zod.parse=t,e._zod.run===a&&(e._zod.run=t),t(o,s);let c=o.value;if(typeof c!=`object`||!c)return t(o,s);let l=s[ci];l||(l={buckets:new Map,backEdges:void 0},s[ci]=l);let u;r===s?u=i:(u=pi(l,e),r=s,i=u);let d=u.get(c);if(d)return o.value=d.value,d.issues?d.issues.length&&o.issues.push(...ui(d.issues)):(o.memo=!0,l.backEdges??=new Set,l.backEdges.add(d.value)),o;mi=u;let f=hi.length,p=t(o,s);mi=void 0;let m=hi.length>f?hi.pop():void 0;return p instanceof Promise?p.then(e=>(m&&(m.issues=e.issues.length?ui(e.issues):li),e)):(m&&(m.issues=p.issues.length?ui(p.issues):li),p)};e._zod.parse=a,e._zod.run===t&&(e._zod.run=a)})}};function _i(){return gi}function vi(e,t){let n=e[ci]?.backEdges;return n!==void 0&&typeof t==`object`&&!!t&&n.has(t)}const yi=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,credit_card:`credit card number`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Fe(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${ge(e.values[0])}`:`Invalid option: expected one of ${ee(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${ee(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function bi(){return{localeError:yi()}}var xi,Si=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Ci(){return new Si}(xi=globalThis).__zod_globalRegistry??(xi.__zod_globalRegistry=Ci());const wi=globalThis.__zod_globalRegistry;function Ti(e,t){return new e({type:`string`,..._(t)})}function Ei(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,..._(t)})}function Di(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,..._(t)})}function Oi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,..._(t)})}function ki(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,..._(t)})}function Ai(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,..._(t)})}function ji(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,..._(t)})}function Mi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,..._(t)})}function Ni(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,..._(t)})}function Pi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,..._(t)})}function Fi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,..._(t)})}function Ii(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,..._(t)})}function Li(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,..._(t)})}function Ri(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,..._(t)})}function zi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,..._(t)})}function Bi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,..._(t)})}function Vi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,..._(t)})}function Hi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,..._(t)})}function Ui(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,..._(t)})}function Wi(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,..._(t)})}function Gi(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,..._(t)})}function Ki(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,..._(t)})}function qi(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,..._(t)})}function Ji(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,..._(t)})}function Yi(e,t){return new e({type:`string`,format:`date`,check:`string_format`,..._(t)})}function Xi(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,..._(t)})}function Zi(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,..._(t)})}function Qi(e,t){return new e({type:`number`,checks:[],..._(t)})}function $i(e,t){return new e({type:`number`,coerce:!0,checks:[],..._(t)})}function ea(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,..._(t)})}function ta(e,t){return new e({type:`boolean`,..._(t)})}function na(e,t){return new e({type:`null`,..._(t)})}function ra(e){return new e({type:`any`})}function ia(e){return new e({type:`unknown`})}function aa(e,t){return new e({type:`never`,..._(t)})}function oa(e,t){return new e({type:`date`,coerce:!0,..._(t)})}function sa(e,t){return new ln({check:`less_than`,..._(t),value:e,inclusive:!1})}function ca(e,t){return new ln({check:`less_than`,..._(t),value:e,inclusive:!0})}function la(e,t){return new un({check:`greater_than`,..._(t),value:e,inclusive:!1})}function ua(e,t){return new un({check:`greater_than`,..._(t),value:e,inclusive:!0})}function da(e,t){return new dn({check:`multiple_of`,..._(t),value:e})}function fa(e,t){return new pn({check:`max_length`,..._(t),maximum:e})}function pa(e,t){return new mn({check:`min_length`,..._(t),minimum:e})}function ma(e,t){return new hn({check:`length_equals`,..._(t),length:e})}function ha(e,t){return new _n({check:`string_format`,format:`regex`,..._(t),pattern:e})}function ga(e){return new vn({check:`string_format`,format:`lowercase`,..._(e)})}function _a(e){return new yn({check:`string_format`,format:`uppercase`,..._(e)})}function va(e,t){return new bn({check:`string_format`,format:`includes`,..._(t),includes:e})}function ya(e,t){return new xn({check:`string_format`,format:`starts_with`,..._(t),prefix:e})}function ba(e,t){return new Sn({check:`string_format`,format:`ends_with`,..._(t),suffix:e})}function xa(e){return new Cn({check:`overwrite`,tx:e})}function Sa(e){return xa(t=>t.normalize(e))}function Ca(){return xa(e=>e.trim())}function wa(){return xa(e=>e.toLowerCase())}function Ta(){return xa(e=>e.toUpperCase())}function Ea(){return xa(e=>se(e))}function Da(e,t,n){return new e({type:`array`,element:t,..._(n)})}function Oa(e,t,n){let r=_(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function ka(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,..._(n)})}function Aa(e,t){let n=ja(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Ie(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Ie(r))}},e(t.value,t)),t);return n}function ja(e,t){let n=new x({check:`custom`,..._(t)});return n._zod.check=e,n}function Ma(e,t){let n=_(t),r=n.truthy??[`true`,`1`,`yes`,`on`,`y`,`enabled`],i=n.falsy??[`false`,`0`,`no`,`off`,`n`,`disabled`];n.case!==`sensitive`&&(r=r.map(e=>typeof e==`string`?e.toLowerCase():e),i=i.map(e=>typeof e==`string`?e.toLowerCase():e));let a=new Set(r),o=new Set(i),s=e.Codec??$r,c=e.Boolean??dr,l=new s({type:`pipe`,in:new(e.String??On)({type:`string`,error:n.error}),out:new c({type:`boolean`,error:n.error}),transform:((e,t)=>{let r=e;return n.case!==`sensitive`&&(r=r.toLowerCase()),a.has(r)?!0:o.has(r)?!1:(t.issues.push({code:`invalid_value`,expected:`stringbool`,values:[...a,...o],input:t.value,inst:l,continue:!1}),{})}),reverseTransform:((e,t)=>e===!0?r[0]||`true`:i[0]||`false`),error:n.error});return l._zod.bag.truthy=r,l._zod.bag.falsy=i,l._zod.bag.case=n.case??`insensitive`,l}function Na(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&h(e,t,n[t]);return e}function Pa(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??wi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Fa(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function w(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,w(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Na(o.schema,c),t.io===`input`&&T(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ia(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function La(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Ia(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Ia(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
50
|
-
|
|
51
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ra(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Ra(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const za=new Set([`type`,`properties`,`required`,`additionalProperties`]),Ba=[`oneOf`,`anyOf`];function Va(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Ha(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!za.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Va(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}h(n,r,e.length===1?e[0]:Ha(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Va(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Ua(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of za)if(t in e)return;let n=t.filter(e=>Ba.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Ha(t);else{let e=n[0],i=Ba.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Ha([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Na(e,r))}function Wa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Na(i,s),Na(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Ra(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Ua(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Na(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,h(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Ka(t,`input`,e.processors),output:Ka(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function T(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return T(r.element,n);if(r.type===`set`)return T(r.valueType,n);if(r.type===`lazy`)return T(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return T(r.innerType,n);if(r.type===`intersection`)return T(r.left,n)||T(r.right,n);if(r.type===`record`||r.type===`map`)return T(r.keyType,n)||T(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:T(r.in,n)||T(r.out,n);if(r.type===`object`){for(let e in r.shape)if(T(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(T(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(T(e,n))return!0;return!!(r.rest&&T(r.rest,n))}return!1}const Ga=(e,t={})=>n=>{let r=Pa({...n,processors:t});return w(e,r),La(r,e),Wa(r,e)},Ka=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Pa({...i??{},target:a,io:t,processors:n});return w(e,o),La(o,e),Wa(o,e)},qa={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ja=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=qa[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Ya=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(Number.isFinite(c)&&c!==0?i.multipleOf=Math.abs(c):Fa(e,t,i,r,`A multipleOf divisor of ${c} cannot be represented in JSON Schema`))},Xa=(e,t,n,r)=>{n.type=`boolean`},Za=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Qa=(e,t,n,r)=>{n.not={}},$a=(e,t,n,r)=>{Fa(e,t,n,r,`Date cannot be represented in JSON Schema`)},eo=(e,t,n,r)=>{let i=e._zod.def,a=m(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},to=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Fa(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Fa(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},no=(e,t,n,r)=>{Fa(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},ro=(e,t,n,r)=>{Fa(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},io=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=w(a.element,t,{...r,path:[...r.path,`items`]})};function ao(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?ao(t.out):t.type===`catch`?ao(t.innerType):e._zod.optin}const oo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Fa(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)h(i.properties,e,w(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e];return t.io===`input`?ao(n)===void 0:n._zod.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=w(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},so=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>w(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},co=(e,t,n,r)=>{let i=e._zod.def,a=w(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=w(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},lo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>w(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?w(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?ao(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=e._zod.bag;typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function uo(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=uo(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>uo(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?tn:en).source),p):p}const fo=new WeakMap;function po(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of fo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=uo(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}const mo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=w(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)h(i.patternProperties,t.source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=w(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=fo.get(t);n||(n=[],fo.set(t,n),t.deferred.push(()=>po(t))),n.push(e)}i.additionalProperties=w(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&ao(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},ho=(e,t,n,r)=>{let i=e._zod.def,a=w(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},go=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},_o=Symbol();function vo(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Fa(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),_o):JSON.parse(o)}const yo=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=vo(i.defaultValue,e,t,n,r);o!==_o&&(n.default=o)},bo=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=vo(i.defaultValue,e,t,n,r);o!==_o&&(n._prefault=o)},xo=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Fa(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},So=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;w(o,t,r);let s=t.seen.get(e);s.ref=o},Co=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},wo=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},To=new WeakSet([Object.prototype,Error.prototype]);function Eo(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}const E=y(`ZodError`,(e,t)=>{st.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);To.has(n)||(To.add(n),Eo(n,`format`,e=>t=>dt(e,t)),Eo(n,`flatten`,e=>t=>ut(e,t)),Eo(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,te,2)}),Eo(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,te,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Do=pt(E),Oo=mt(E),ko=ht(E),Ao=_t(E),jo=yt(E),Mo=bt(E),No=xt(E),Po=St(E),Fo=Ct(E),Io=wt(E),Lo=Tt(E),Ro=Et(E);function zo(){b.localeError||$e(bi())}function Bo(){b.memoizer||$e({memoizer:_i()})}const D=y(`ZodType`,(e,t)=>(zo(),S.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(g(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return he(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(lc(e,t))},superRefine(e,t){return this.check(uc(e,t))},overwrite(e){return this.check(xa(e))},optional(){return Hs(this)},exactOptional(){return Ws(this)},nullable(){return Ks(this)},nullish(){return Hs(Ks(this))},nonoptional(e){return Qs(this,e)},array(){return I(this)},or(e){return R([this,e])},and(e){return js(this,e)},transform(e){return nc(this,Bs(e))},default(e){return Js(this,e)},prefault(e){return Xs(this,e)},catch(e){return ec(this,e)},pipe(e){return nc(this,e)},readonly(){return oc(this)},describe(e){let t=this.clone();return wi.add(t,{description:e}),t},meta(...e){if(e.length===0)return wi.get(this);let t=this.clone();return wi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return ze(this,`~standard`,{...Dn(this),jsonSchema:{input:Ka(this,`input`),output:Ka(this,`output`)}})},set"~standard"(e){Re(this,`~standard`,e)},parse:function e(t,n){return Do(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Oo(this,t,n,{callee:e})},safeParse(e,t){return ko(this,e,t)},async safeParseAsync(e,t){return Ao(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Re(this,`spa`,e)},encode:function e(t,n){return jo(this,t,n,{callee:e})},decode:function e(t,n){return Mo(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await No(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Po(this,t,n,{callee:e})},safeEncode(e,t){return Fo(this,e,t)},safeDecode(e,t){return Io(this,e,t)},async safeEncodeAsync(e,t){return Lo(this,e,t)},async safeDecodeAsync(e,t){return Ro(this,e,t)},toJSONSchema(e){return Ga(this,{})(e)},get description(){return wi.get(this)?.description},get _def(){return this._zod.def}}),Vo=y(`_ZodString`,(e,t)=>{On.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ja(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null},{regex(...e){return this.check(ha(...e))},includes(...e){return this.check(va(...e))},startsWith(...e){return this.check(ya(...e))},endsWith(...e){return this.check(ba(...e))},min(...e){return this.check(pa(...e))},max(...e){return this.check(fa(...e))},length(...e){return this.check(ma(...e))},nonempty(...e){return this.check(pa(1,...e))},lowercase(e){return this.check(ga(e))},uppercase(e){return this.check(_a(e))},trim(){return this.check(Ca())},normalize(...e){return this.check(Sa(...e))},toLowerCase(){return this.check(wa())},toUpperCase(){return this.check(Ta())},slugify(){return this.check(Ea())}}),Ho=y(`ZodString`,(e,t)=>{On.init(e,t),Vo.init(e,t)},{email(e){return this.check(Ei(qo,e))},url(e){return this.check(Mi(Xo,e))},jwt(e){return this.check(qi(fs,e))},emoji(e){return this.check(Ni(Zo,e))},guid(e){return this.check(Di(Jo,e))},uuid(e){return this.check(Oi(Yo,e))},uuidv4(e){return this.check(ki(Yo,e))},uuidv6(e){return this.check(Ai(Yo,e))},uuidv7(e){return this.check(ji(Yo,e))},nanoid(e){return this.check(Pi(Qo,e))},cuid(e){return this.check(Fi($o,e))},cuid2(e){return this.check(Ii(es,e))},ulid(e){return this.check(Li(ts,e))},base64(e){return this.check(Wi(cs,e))},base64url(e){return this.check(Gi(us,e))},xid(e){return this.check(Ri(ns,e))},ksuid(e){return this.check(zi(rs,e))},ipv4(e){return this.check(Bi(is,e))},ipv6(e){return this.check(Vi(as,e))},cidrv4(e){return this.check(Hi(os,e))},cidrv6(e){return this.check(Ui(ss,e))},e164(e){return this.check(Ki(ds,e))},datetime(e){return this.check(Ji(Uo,e))},date(e){return this.check(Yi(Wo,e))},time(e){return this.check(Xi(Go,e))},duration(e){return this.check(Zi(Ko,e))}});function O(e){return Ti(Ho,e)}const k=y(`ZodStringFormat`,(e,t)=>{C.init(e,t),Vo.init(e,t)}),Uo=y(`ZodISODateTime`,(e,t)=>{Gn.init(e,t),k.init(e,t)}),Wo=y(`ZodISODate`,(e,t)=>{Kn.init(e,t),k.init(e,t)}),Go=y(`ZodISOTime`,(e,t)=>{qn.init(e,t),k.init(e,t)}),Ko=y(`ZodISODuration`,(e,t)=>{Jn.init(e,t),k.init(e,t)}),qo=y(`ZodEmail`,(e,t)=>{jn.init(e,t),k.init(e,t)});function A(e){return Ei(qo,e)}const Jo=y(`ZodGUID`,(e,t)=>{kn.init(e,t),k.init(e,t)}),Yo=y(`ZodUUID`,(e,t)=>{An.init(e,t),k.init(e,t)});function j(e){return Oi(Yo,e)}const Xo=y(`ZodURL`,(e,t)=>{Ln.init(e,t),k.init(e,t)});function M(e){return Mi(Xo,e)}const Zo=y(`ZodEmoji`,(e,t)=>{Rn.init(e,t),k.init(e,t)}),Qo=y(`ZodNanoID`,(e,t)=>{zn.init(e,t),k.init(e,t)}),$o=y(`ZodCUID`,(e,t)=>{Bn.init(e,t),k.init(e,t)}),es=y(`ZodCUID2`,(e,t)=>{Vn.init(e,t),k.init(e,t)}),ts=y(`ZodULID`,(e,t)=>{Hn.init(e,t),k.init(e,t)}),ns=y(`ZodXID`,(e,t)=>{Un.init(e,t),k.init(e,t)}),rs=y(`ZodKSUID`,(e,t)=>{Wn.init(e,t),k.init(e,t)}),is=y(`ZodIPv4`,(e,t)=>{Yn.init(e,t),k.init(e,t)}),as=y(`ZodIPv6`,(e,t)=>{Qn.init(e,t),k.init(e,t)}),os=y(`ZodCIDRv4`,(e,t)=>{$n.init(e,t),k.init(e,t)}),ss=y(`ZodCIDRv6`,(e,t)=>{tr.init(e,t),k.init(e,t)}),cs=y(`ZodBase64`,(e,t)=>{rr.init(e,t),k.init(e,t)});function ls(e){return Wi(cs,e)}const us=y(`ZodBase64URL`,(e,t)=>{ar.init(e,t),k.init(e,t)}),ds=y(`ZodE164`,(e,t)=>{or.init(e,t),k.init(e,t)}),fs=y(`ZodJWT`,(e,t)=>{cr.init(e,t),k.init(e,t)}),ps=y(`ZodNumber`,(e,t)=>{lr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ya(e,t,n,r);let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null},{gt(e,t){return this.check(la(e,t))},gte(e,t){return this.check(ua(e,t))},min(e,t){return this.check(ua(e,t))},lt(e,t){return this.check(sa(e,t))},lte(e,t){return this.check(ca(e,t))},max(e,t){return this.check(ca(e,t))},int(e){return this.check(hs(e))},safe(e){return this.check(hs(e))},positive(e){return this.check(la(0,e))},nonnegative(e){return this.check(ua(0,e))},negative(e){return this.check(sa(0,e))},nonpositive(e){return this.check(ca(0,e))},multipleOf(e,t){return this.check(da(e,t))},step(e,t){return this.check(da(e,t))},finite(){return this}});function N(e){return Qi(ps,e)}const ms=y(`ZodNumberFormat`,(e,t)=>{ur.init(e,t),ps.init(e,t)});function hs(e){return ea(ms,e)}const gs=y(`ZodBoolean`,(e,t)=>{dr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xa(e,t,n,r)});function P(e){return ta(gs,e)}const _s=y(`ZodNull`,(e,t)=>{fr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Za(e,t,n,r)});function vs(e){return na(_s,e)}const ys=y(`ZodAny`,(e,t)=>{pr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function bs(){return ra(ys)}const xs=y(`ZodUnknown`,(e,t)=>{mr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function F(){return ia(xs)}const Ss=y(`ZodNever`,(e,t)=>{hr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qa(e,t,n,r)});function Cs(e){return aa(Ss,e)}const ws=y(`ZodDate`,(e,t)=>{gr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$a(e,t,n,r),e.min=(t,n)=>e.check(ua(t,n)),e.max=(t,n)=>e.check(ca(t,n));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null}),Ts=y(`ZodArray`,(e,t)=>{Bo(),vr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r),e.element=t.element},{min(e,t){return this.check(pa(e,t))},nonempty(e){return this.check(pa(1,e))},max(e,t){return this.check(fa(e,t))},length(e,t){return this.check(ma(e,t))},unwrap(){return this.element}});function I(e,t){return Da(Ts,e,t)}const Es=y(`ZodObject`,(e,t)=>{Bo(),Tr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r),Ge(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return B(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:F()})},loose(){return this.clone({...this._zod.def,catchall:F()})},strict(){return this.clone({...this._zod.def,catchall:Cs()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return xe(this,e)},safeExtend(e){return Se(this,e)},merge(e){return Ce(this,e)},pick(e){return ye(this,e)},omit(e){return be(this,e)},partial(...e){return we(Vs,this,e[0])},exactPartial(...e){return we(Us,this,e[0],`exactPartial`)},required(...e){return Te(Zs,this,e[0])}});function L(e,t){let n={type:`object`,shape:e??{},..._(t)};return new Es(n)}function Ds(e,t){return new Es({type:`object`,shape:e,catchall:F(),..._(t)})}const Os=y(`ZodUnion`,(e,t)=>{Dr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r),e.options=t.options});function R(e,t){return new Os({type:`union`,options:e,..._(t)})}const ks=y(`ZodDiscriminatedUnion`,(e,t)=>{Os.init(e,t),Or.init(e,t)});function z(e,t,n){return new ks({type:`union`,options:t,discriminator:e,..._(n)})}const As=y(`ZodIntersection`,(e,t)=>{kr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r)});function js(e,t){return new As({type:`intersection`,left:e,right:t})}const Ms=y(`ZodTuple`,(e,t)=>{Bo(),Mr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new Vs({type:`optional`,innerType:e}))})}});function Ns(e,t,n){let r=t instanceof S;return new Ms({type:`tuple`,items:e,rest:r?t:null,..._(r?n:t)})}const Ps=y(`ZodRecord`,(e,t)=>{Bo(),Ir.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Fs(e,t,n){return!t||!t._zod?new Ps({type:`record`,keyType:O(),valueType:e,..._(t)}):new Ps({type:`record`,keyType:e,valueType:t,..._(n)})}function Is(e,t,n){return new Ps({type:`record`,keyType:e,valueType:t,..._(n),partial:!0})}const Ls=y(`ZodEnum`,(e,t)=>{Lr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eo(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ls({...t,checks:[],..._(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ls({...t,checks:[],..._(r),entries:i})}});function B(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Ls({type:`enum`,entries:n,..._(t)})}const Rs=y(`ZodLiteral`,(e,t)=>{Rr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>to(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function V(e,t){return new Rs({type:`literal`,values:Array.isArray(e)?e:[e],..._(t)})}const zs=y(`ZodTransform`,(e,t)=>{Bo(),zr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Qe(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ie(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Ie(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Bs(e){return new zs({type:`transform`,transform:e})}const Vs=y(`ZodOptional`,(e,t)=>{Vr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hs(e){return new Vs({type:`optional`,innerType:e})}const Us=y(`ZodExactOptional`,(e,t)=>{Hr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ws(e){return new Us({type:`optional`,innerType:e})}const Gs=y(`ZodNullable`,(e,t)=>{Ur.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ks(e){return new Gs({type:`nullable`,innerType:e})}const qs=y(`ZodDefault`,(e,t)=>{Wr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Js(e,t){return new qs({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():fe(t)}})}const Ys=y(`ZodPrefault`,(e,t)=>{Kr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xs(e,t){return new Ys({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():fe(t)}})}const Zs=y(`ZodNonOptional`,(e,t)=>{qr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Qs(e,t){return new Zs({type:`nonoptional`,innerType:e,..._(t)})}const $s=y(`ZodCatch`,(e,t)=>{Xr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ec(e,t){return new $s({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Ke(t)})}const tc=y(`ZodPipe`,(e,t)=>{Zr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r),e.in=t.in,e.out=t.out});function nc(e,t){return new tc({type:`pipe`,in:e,out:t})}const rc=y(`ZodCodec`,(e,t)=>{tc.init(e,t),$r.init(e,t)}),ic=y(`ZodPreprocess`,(e,t)=>{tc.init(e,t),ni.init(e,t)}),ac=y(`ZodReadonly`,(e,t)=>{ri.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function oc(e){return new ac({type:`readonly`,innerType:e})}const sc=y(`ZodCustom`,(e,t)=>{ai.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r)});function cc(e,t){return Oa(sc,e??(()=>!0),t)}function lc(e,t={}){return ka(sc,e,t)}function uc(e,t){return Aa(e,t)}const dc=(...e)=>Ma({Codec:rc,Boolean:gs,String:Ho},...e);function fc(e,t){return new ic({type:`pipe`,in:Bs(e),out:t})}function H(e){return Ji(Uo,e)}function U(e){return $i(ps,e)}function pc(e){return oa(ws,e)}const W=R([H(),H({precision:-1})]);R([H({offset:!0}),H({offset:!0,precision:-1})]);const mc=B([`mobile_to_desktop`,`desktop_to_mobile`]),hc=B([`project`,`task`,`asset`,`asset_conflict`]),gc=L({kind:B([`project`,`task`]),id:j()});L({direction:mc,target:gc}),L({workspaceId:j()}),L({workspaceId:j(),notificationId:j()}),L({target:gc});const _c=[`en`,`zh-TW`,`de`,`fr`,`es-ES`,`es-419`,`ja`,`ko`,`it`,`pt-BR`],vc=B(_c).default(`en`);function yc(e){return e?_c.includes(e):!1}function bc(e){return yc(e)?e:`en`}const xc=[`usage_exhausted`,`payment_failed`,`auto_reload_threshold_exceeded`,`role_changed`,`schedules_agent_deleted`,`agent_binding_removed`,`schedule_run_completed`,`publish_submitted`,`publish_approved`,`publish_rejected`,`task_complete`,`task_waiting_approval`,`workspace_join_request`,`access_request`,`meeting_shared`,`meeting_shared_workspace`,`project_member_added`,`task_shared_to_project`,`task_shared_with_member`,`schedules_calendar_auth_expired`,`agent_monthly_cap_threshold`,`handoff_requested`,`announcement`],Sc=[`info`,`action`],Cc=[`all`,`action`,`info`],wc=[`low`,`medium`,`high`],Tc=[`web`,`ios`,`android`],G=j(),Ec=B(_c),Dc=B(xc),Oc=B(Sc),kc=B(wc),Ac=B(Tc);L({workspaceId:G}),L({workspaceId:G,notificationId:G}),L({workspaceId:G,deviceId:G}),L({tab:B(Cc).default(`all`),eventType:R([Dc,I(Dc)]).transform(e=>Array.isArray(e)?e:[e]).optional(),cursor:O().optional(),limit:U().int().min(1).max(100).default(20),lang:Ec.optional()});const jc=L({id:O().min(1),labelKey:O().min(1),method:V(`POST`),path:O().min(1),requiresInput:I(L({fieldName:O().min(1),displayNameKey:O().min(1)})).min(1).optional(),style:B([`primary`,`destructive`,`secondary`]).optional()}),Mc=L({scope:B([`workspace`,`team`]),scopeName:O(),oldRole:O(),newRole:O(),canManageMember:P()}),Nc=L({workspaceName:O().min(1)}),Pc=L({workspaceName:O().min(1),invoiceId:O().min(1)}),Fc=L({workspaceName:O().min(1),thresholdUsd:O().min(1),reloadAmountUsd:O().min(1)}),Ic=L({scheduleName:O().min(1),agentName:O().min(1),scheduleId:G}),Lc=L({scheduleName:O().min(1),scheduleId:G}),Rc=V([100,80]),zc=L({agentName:O().min(1),agentId:G,threshold:Rc,spentUsd:O().min(1),capUsd:O().min(1)}),Bc=L({agentName:O().min(1),resourceName:O().min(1),resourceType:B([`model`,`connector`]),agentId:G}),Vc=L({requesterName:O().min(1),resourceName:O().min(1),resourceType:B([`agent`,`connector`,`skill`]),scope:B([`team`,`workspace`]),teamId:G.optional(),scopeName:O().min(1),inlineActions:I(jc),publishId:G}),Hc=L({approverName:O().min(1),resourceName:O().min(1),resourceType:B([`agent`,`connector`,`skill`]),resourceId:G}),Uc=L({approverName:O().min(1),resourceName:O().min(1),resourceType:B([`agent`,`connector`,`skill`]),reason:O(),actions:I(L({id:B([`resubmit`,`viewResource`]),labelKey:O().min(1),href:O().min(1)})),resourceId:G}),Wc=L({workspaceName:O().min(1),requesterEmail:A(),invitationId:G});B([`task`,`preview`,`meeting`]);const Gc=L({requesterName:O().min(1),resourceName:O().min(1),resourceId:G}),Kc=z(`resourceType`,[Gc.extend({resourceType:V([`task`,`preview`]),parentTaskId:G}),Gc.extend({resourceType:V(`meeting`),meetingId:G})]),qc=L({meetingId:G,meetingTitle:O().min(1),sharedByName:O().min(1),role:B([`viewer`,`editor`])}),Jc=L({meetingId:G,meetingTitle:O().min(1),sharedByName:O().min(1)}),Yc=L({projectId:G,projectName:O().min(1),addedByName:O().min(1)}),Xc=L({direction:mc,targetKind:hc,targetId:G}),Zc=L({taskId:G,taskTitle:O(),projectId:G,projectName:O().min(1),sharedByName:O().min(1)}),Qc=L({taskId:G,taskTitle:O(),projectId:G,projectName:O().min(1),sharedByName:O().min(1)}),$c=L({name:O(),taskTitle:O(),taskId:G}),el=L({aiResponseSnippet:O(),taskId:G}),tl=L({aiResponseSnippet:O(),taskId:G}),nl=L({title:O().min(1).max(200),body:O().min(1).max(2e3),ctaLabel:O().max(80).optional()}),rl=L({en:nl}).catchall(nl),il=L({notification:V(!0),webPush:P(),mobilePush:P(),email:P()}),al=B([`notification`,`popup`]),ol=L({announcementId:G,contentI18n:rl,channels:il,category:Oc,ctaUrl:O().optional(),surface:al.optional(),mediaKey:O().optional()}),sl=L({id:O().min(1),label:O().min(1),method:V(`POST`),path:O().min(1),style:B([`primary`,`destructive`,`secondary`]).optional(),requiresInput:I(L({fieldName:O().min(1),displayName:O().min(1)})).min(1).optional()}),cl=O().refine(e=>e.startsWith(`/`)||/^https?:\/\//.test(e),{message:`ctaUrl must be an absolute URL or a path starting with /`}),ll=L({title:O(),body:O(),ctaLabel:O().optional(),ctaUrl:cl.optional(),inlineActions:I(sl).optional()}),ul=L({id:G,urgency:kc,category:Oc,relatedEntityId:O().nullable(),rendered:ll,renderedLocale:Ec,readAt:H().nullable(),processedAt:H().nullable(),createdAt:H()}),dl=z(`eventType`,[L({eventType:V(`role_changed`),payload:Mc}),L({eventType:V(`usage_exhausted`),payload:Nc}),L({eventType:V(`payment_failed`),payload:Pc}),L({eventType:V(`auto_reload_threshold_exceeded`),payload:Fc}),L({eventType:V(`schedules_agent_deleted`),payload:Ic}),L({eventType:V(`schedules_calendar_auth_expired`),payload:Lc}),L({eventType:V(`agent_binding_removed`),payload:Bc}),L({eventType:V(`agent_monthly_cap_threshold`),payload:zc}),L({eventType:V(`schedule_run_completed`),payload:$c}),L({eventType:V(`publish_submitted`),payload:Vc}),L({eventType:V(`publish_approved`),payload:Hc}),L({eventType:V(`publish_rejected`),payload:Uc}),L({eventType:V(`task_complete`),payload:el}),L({eventType:V(`task_waiting_approval`),payload:tl}),L({eventType:V(`workspace_join_request`),payload:Wc}),L({eventType:V(`access_request`),payload:Kc}),L({eventType:V(`meeting_shared`),payload:qc}),L({eventType:V(`meeting_shared_workspace`),payload:Jc}),L({eventType:V(`project_member_added`),payload:Yc}),L({eventType:V(`task_shared_to_project`),payload:Zc}),L({eventType:V(`task_shared_with_member`),payload:Qc}),L({eventType:V(`handoff_requested`),payload:Xc}),L({eventType:V(`announcement`),payload:ol})]),fl=ul.and(dl);L({items:I(fl),nextKey:O().optional()}),L({item:fl.nullable()}),L({count:N().int().min(0),capped:P().optional()}),L({deviceType:Ac,fcmToken:O().min(1),description:O().max(500).optional()}),L({id:G,createdAt:H()}),L({}).strict();const pl=z(`kind`,[L({kind:V(`all`)}),L({kind:V(`admins`)}),L({kind:V(`specific`),userIds:I(G).min(1)})]);L({workspaceId:G.nullish(),contentI18n:rl,ctaUrl:M({protocol:/^https?$/}).max(2e3).optional(),urgency:kc,category:Oc,audience:pl,channels:il,surface:al.default(`notification`),mediaKey:O().min(1).max(100).optional()}).refine(e=>e.audience.kind===`all`||e.workspaceId!=null,{message:`workspaceId is required when audience.kind is 'admins' or 'specific'`,path:[`workspaceId`]}).refine(e=>e.surface!==`popup`||e.ctaUrl!=null,{message:`ctaUrl is required when surface is 'popup'`,path:[`ctaUrl`]}),L({id:G,createdAt:H()});const ml=L({limit:U().int().min(1).max(100).default(20),nextKey:O().optional()}),hl=L({limit:U().int().min(1).max(100).default(20),offset:U().int().nonnegative().default(0)});L({limit:U().int().min(1).max(100).default(50),beforeVersionNumber:U().int().positive().optional()}).extend({versionNumber:U().int().positive().optional()});const gl=[`asc`,`desc`];function _l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function vl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?_l(Object(n),!0).forEach(function(t){yl(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function yl(e,t,n){return t=bl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bl(e){var t=xl(e,`string`);return typeof t==`symbol`?t:String(t)}function xl(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}Sl({});function Sl(e){return t.withOptions=t=>Sl(vl(vl({},e),t)),t;function t(t,...n){let r=typeof t==`string`?[t]:t.raw,{alignValues:i=!1,escapeSpecialCharacters:a=Array.isArray(t),trimWhitespace:o=!0}=e,s=``;for(let e=0;e<r.length;e++){let t=r[e];if(a&&(t=t.replace(/\\\n[ \t]*/g,``).replace(/\\`/g,"`").replace(/\\\$/g,`$`).replace(/\\\{/g,`{`)),s+=t,e<n.length){let t=i?Cl(n[e],s):n[e];s+=t}}let c=s.split(`
|
|
52
|
-
`),l=null;for(let e of c){let t=e.match(/^(\s+)\S+/);if(t){let e=t[1].length;l=l?Math.min(l,e):e}}if(l!==null){let e=l;s=c.map(t=>t[0]===` `||t[0]===` `?t.slice(e):t).join(`
|
|
53
|
-
`)}return o&&(s=s.trim()),a&&(s=s.replace(/\\n/g,`
|
|
54
|
-
`).replace(/\\t/g,` `).replace(/\\r/g,`\r`).replace(/\\v/g,`\v`).replace(/\\b/g,`\b`).replace(/\\f/g,`\f`).replace(/\\0/g,`\0`).replace(/\\x([\da-fA-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16))).replace(/\\u\{([\da-fA-F]{1,6})\}/g,(e,t)=>String.fromCodePoint(parseInt(t,16))).replace(/\\u([\da-fA-F]{4})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))),typeof Bun<`u`&&(s=s.replace(/\\u(?:\{([\da-fA-F]{1,6})\}|([\da-fA-F]{4}))/g,(e,t,n)=>{let r=t??n??``;return String.fromCodePoint(parseInt(r,16))})),s}}function Cl(e,t){if(typeof e!=`string`||!e.includes(`
|
|
55
|
-
`))return e;let n=t.slice(t.lastIndexOf(`
|
|
56
|
-
`)+1).match(/^(\s+)/);if(n){let t=n[1];return e.replace(/\n/g,`\n${t}`)}return e}const wl={blue:`#0360f0`,yellow:`#ffce25`,cyan:`#00d2ff`},Tl={width:570.45,height:120.05};`${Tl.width}${Tl.height}`;const El=[{tag:`polygon`,points:`893.15 145.4 764.8 145.4 764.8 171.11 816.12 171.11 816.12 265.19 841.83 265.19 841.83 171.11 893.15 171.11 893.15 145.4`},{tag:`path`,commands:`M935.9,183.97c0-7.1,5.76-12.86,12.86-12.86h86.93v-25.71h-95.26c-16.7,0-30.24,13.54-30.24,30.24v59.31c0,16.7,13.54,30.24,30.24,30.24h95.26v-25.71h-86.93c-7.1,0-12.86-5.76-12.86-12.86v-42.65Z`},{tag:`path`,commands:`M717.67,145.14v89.92l-66.31-85.23h0c-2.36-2.86-5.93-4.68-9.92-4.68-.33,0-13.61,0-13.61,0-7.1,0-12.86,5.76-12.86,12.86v107.19h25.71v-89l66.31,84.32h0c2.36,2.86,5.93,4.68,9.92,4.68q1.25,0,0,0h13.62q-2.5,0,0,0c7.04,0,12.75-5.66,12.85-12.68v-107.37h-25.71Z`},{tag:`path`,commands:`M495.48,145.14c-16.7,0-30.24,13.54-30.24,30.24v59.57c0,16.07,12.53,29.2,28.35,30.18h87.25c7.07,0,12.81-5.76,12.81-12.87v-47.1c0-7.11-5.73-12.87-12.81-12.87h-64.29v25.71h51.39v21.44h-64.15c-7.06,0-12.78-5.69-12.86-12.73v-43.1c.07-7.04,5.8-12.73,12.86-12.73l89.85-.02v-25.71h-98.17`}],Dl=[{tag:`path`,commands:`M1378.44,219.45c0,30.39-18.05,46.04-44.94,46.04s-44.94-15.47-44.94-46.04v-47.33h21.92v47.33c0,17.31,9.21,25.6,23.02,25.6s23.02-8.29,23.02-25.6v-47.33h21.92v47.33Z`},{tag:`path`,commands:`M1396.49,230.5v-88.22h21.92v32.23h46.96v19.89h-46.96v36.1c0,12.15,6.26,16.94,15.29,16.94s15.29-4.6,15.29-16.94v-2.39h21.92v2.39c0,25.23-15.1,37.39-37.2,37.39s-37.2-12.16-37.2-37.39Z`},{tag:`path`,commands:`M1485.49,218.16c0-30.39,18.05-46.04,44.94-46.04s44.94,15.47,44.94,46.04v47.33h-21.92v-47.33c0-17.31-9.21-25.6-23.02-25.6s-23.02,8.29-23.02,25.6v47.33h-21.92v-47.33Z`},{tag:`rect`,x:`1485.49`,y:`133.11`,width:`21.92`,height:`132.38`},{tag:`path`,commands:`M1172.56,217.04c0-29.54,22.45-48.9,48.41-48.9s48.61,19.36,48.61,48.9-22.64,49.1-48.61,49.1-48.41-19.56-48.41-49.1ZM1248.03,217.04c0-16.77-12.3-28.71-27.06-28.71s-26.85,11.95-26.85,28.71,12.09,28.92,26.85,28.92,27.06-11.74,27.06-28.92Z`},{tag:`rect`,x:`1248.21`,y:`172.2`,width:`21.92`,height:`93.29`},{tag:`rect`,x:`1077.07`,y:`193.92`,width:`55.68`,height:`21.92`}],Ol=[{tag:`polygon`,fill:wl.cyan,points:`232.67 341.7 241.66 346.89 250.66 341.68 361.69 277.59 297.18 240.35 297.17 240.35 250.66 267.2 241.66 272.4 232.67 267.21 186.15 240.35 121.63 277.59 232.67 341.7`},{tag:`polygon`,fill:wl.yellow,points:`177.15 224.77 177.15 160.66 186.14 155.47 232.67 128.6 232.67 54.11 121.63 118.23 112.64 123.42 112.64 262.01 177.15 224.77`},{tag:`polygon`,fill:wl.blue,points:`306.17 160.66 306.17 224.77 370.68 262.01 370.68 123.42 361.69 118.23 250.66 54.12 250.66 128.61 297.18 155.47 306.17 160.66`}];[...El,...Dl,...Ol],new TextEncoder,new TextDecoder(`utf-8`,{fatal:!1});const kl=B([`starter`,`pro`,`premium`]);B([`pro`,`premium`]).options,B([`basic_window`,`granted_pool`,`purchased_pool`]);const Al=B([`purchased`,`granted`]);B([`task`,`title_generate`,`agent`,`schedule`,`sandbox_llm`,`sandbox_runtime`,`web_search`,`image_generation`,`agent_icon_generation`,`auto_routing`,`chatbot`,`meeting`,`mcp_tool_api_call`]);const K={TASK_MESSAGE:`task_message`,TITLE_GENERATION:`title_generation`,SENSITIVITY_CHECK:`sensitivity_check`,TOOL_CALL_EXTRA_TOKENS:`tool_call_extra_tokens`,TASK_SUMMARY:`task_summary`,SUBAGENT:`subagent`,WORKFLOW_AGENT:`workflow_agent`,LLM_PROXY:`llm_proxy`,IMAGE_GENERATION:`image_generation`,WEB_SEARCH:`web_search`,SANDBOX_RUNTIME:`sandbox_runtime`,MEETING:`meeting`,MEETING_RECORDING_TRANSCRIPTION:`meeting_recording_transcription`,MEETING_RECORDING_SUMMARY:`meeting_recording_summary`,MEETING_RECORDING_REFINE:`meeting_recording_refine`,MEETING_RECORDING_TITLE:`meeting_recording_title`,TOOL_CALL_RISK_ASSESSMENT:`tool_call_risk_assessment`,SCHEDULE_JUDGE:`schedule_judge`,SCHEDULE_JUDGE_REVIEW:`schedule_judge_review`,SCHEDULE_JUDGE_EXTRACT:`schedule_judge_extract`,PROJECT_KNOWLEDGE_DESCRIPTION:`project_knowledge_description`,PROJECT_KNOWLEDGE_EXTRACTION:`project_knowledge_extraction`,PUBLISH_CHANGE_SUMMARY:`publish_change_summary`};K.MEETING,K.MEETING_RECORDING_TRANSCRIPTION,K.MEETING_RECORDING_SUMMARY,K.MEETING_RECORDING_REFINE,K.MEETING_RECORDING_TITLE,K.WORKFLOW_AGENT,K.SCHEDULE_JUDGE_EXTRACT,K.WEB_SEARCH,K.PROJECT_KNOWLEDGE_DESCRIPTION,K.PROJECT_KNOWLEDGE_EXTRACTION,K.SENSITIVITY_CHECK,K.PUBLISH_CHANGE_SUMMARY;const jl={WEB_SEARCH:K.WEB_SEARCH,SANDBOX_RUNTIME:K.SANDBOX_RUNTIME};B([jl.WEB_SEARCH,jl.SANDBOX_RUNTIME]);const Ml={SEARCH:`search`,SCRAPE:`scrape`};B([Ml.SEARCH,Ml.SCRAPE]),L({workspaceId:j()});const Nl=L({usedPercent:N().min(0).max(100),resetAt:H().nullable()});L({seatType:kl,hourly:Nl.nullable(),weekly:Nl,trial:L({endsAt:H(),remainingDays:N().int().positive()}).optional(),extraUsage:L({spentUsd:N().nonnegative(),resetAt:H().nullable()}),availability:L({allowed:P(),reason:B([`usage_exhausted`,`budget_exceeded`]).nullable(),resetAt:H().nullable()})});const Pl=L({startAt:H(),endAt:H(),previousStartAt:H().optional()}),Fl=L({period:Pl,balanceUsd:N().nonnegative(),nextExpiry:L({amountUsd:N().positive(),expiresAt:H()}).optional(),currentSpentUsd:N().nonnegative(),currentSpentUsedPercent:N().nonnegative().nullable(),monthlyExtraUsageLimitUsd:N().positive().nullable(),memberMonthlyExtraUsageLimitUsd:N().positive().nullable()});L({periodStart:W.optional()}),L({period:Pl,spentUsd:N().nonnegative(),purchasedUsd:N().nonnegative()});const Il=B([`extraUsage:desc`,`extraUsage:asc`]);L({periodStart:W.optional(),limit:U().int().min(1).max(100).default(20),offset:U().int().nonnegative().default(0),sort:Il.default(`extraUsage:desc`),search:O().trim().max(200).optional()}),L({items:I(L({id:j(),user:L({id:j(),name:O(),email:A()}),seatType:kl,extraUsage:N().nonnegative(),monthlyLimitOverride:L({limitUsd:N().positive().nullable()}).nullable().optional()})),total:N().int().nonnegative()}),L({id:j(),poolType:Al,balanceUsd:N().nonnegative(),initialAmountUsd:N().positive(),expiresAt:H().nullable(),isAutoReload:P().nullable(),purchaseId:j().nullable(),createdBy:j(),createdAt:H(),updatedAt:H()}),L({amountUsd:N().positive().max(1e5),expiresAt:W.optional()}),L({id:j(),workspaceId:j(),amountUsd:O(),expiresAt:H().nullable(),createdAt:H()}),L({enabled:P(),thresholdUsd:N().positive(),reloadAmountUsd:N().positive()}).nullable(),L({enabled:P(),thresholdUsd:N().positive(),reloadAmountUsd:N().positive()}),L({checkoutUrl:O().url().nullable()}),L({limitUsd:N().positive().nullable()}),L({limitUsd:N().positive().nullable()});const Ll=L({id:j(),name:O(),email:A()});L({items:I(L({user:Ll,limitUsd:N().positive().nullable()}))}),L({workspaceId:j(),userId:j()}),L({limitUsd:N().min(.01).max(999999.99).nullable()});const Rl=O().regex(/^\d+(\.\d+)?$/,`Budget must be a valid positive decimal number`).refine(e=>Number(e)>0,{message:`Budget must be a valid positive decimal number`});L({items:I(L({user:Ll,budget:O().nullable()}))}),L({workspaceId:j(),userId:j()}),L({budget:Rl.nullable()}),L({periodStart:W.optional()});const zl=L({model:O(),costUsd:N(),tokens:N()}),Bl=L({costUsd:N(),totalTokens:N(),tokens:L({input:N(),output:N(),cachedInput:N(),cacheCreation:N()}),byModel:I(zl)});L({taskId:j(),totalCostUsd:N(),totalTokens:N(),tokens:Bl.shape.tokens,byModel:Bl.shape.byModel}),L({taskId:j(),scheduleId:j(),scheduleRunId:j(),work:Bl,extraction:Bl,judgePrimary:Bl,judgeReview:Bl,runTotal:Bl,includingExtraction:Bl});const Vl=[`google`,`password`];L({users:I(L({id:j(),name:O(),email:A(),image:O().nullable().optional(),role:O(),loginMethods:I(B(Vl)),createdAt:H(),seatType:kl.nullable(),pendingSeatType:kl.nullable(),pendingEffectiveAt:H().nullable()})),total:N().int().nonnegative()}),hl.extend({search:O().trim().max(200).optional()});const Hl=O().min(10,`Password must be at least 10 characters long`).regex(/[a-z]/,`Password must contain at least one lowercase letter`).regex(/[A-Z]/,`Password must contain at least one uppercase letter`).regex(/[0-9]/,`Password must contain at least one number`).regex(/[^a-zA-Z0-9]/,`Password must contain at least one special character`);L({currentPassword:O().min(1,`Current password is required`),newPassword:Hl}),L({message:O()});const Ul=B(_c);L({email:A(),name:O(),image:O().nullable().optional(),locale:Ul,hasPassword:P()}),L({locale:Ul});const Wl=[`super_admin`,`operator`];B([`vertex/gemini-3.7-flash`,`vertex/gemini-3.5-flash`]),L({provider:V(`gemini`),model:O().min(1),estimatedHourlyCostUsd:N().nonnegative()}),L({model:O().min(1)});const Gl=L({id:j(),email:O()});L({admins:I(L({id:j(),email:O(),role:B(Wl),createdBy:Gl.nullable(),createdAt:H(),updatedAt:H()}))}),L({id:j(),role:B(Wl)}),L({email:A(),role:B(Wl)}),L({adminId:j()});const Kl=B([`owner`,`admin`,`member`]);L({email:A(),name:O().trim().min(1).max(100).optional(),password:Hl,workspaceId:j().optional(),role:Kl.default(`member`)});const ql=L({id:j(),email:A(),name:O(),createdAt:H()}),Jl=L({resetPasswordUrl:M(),resetPasswordExpiresAt:H()});ql.extend(Jl.shape),L({email:A(),role:Kl.default(`member`),sendPasswordSetupEmail:P().default(!1)}),L({id:j(),email:A(),name:O(),role:O(),passwordSetupEmailSent:P()}),L({workspaceId:j(),userId:j()}),L({sendEmail:P().default(!1)}),Jl.extend({emailSentAt:H().nullable()}),L({role:B(Wl)});const Yl=[`create`,`update`,`delete`],Xl=[`workspace`,`admin`,`user`,`extra_usage`,`marketplace_agent`,`marketplace_skill`,`azure_openai_deployment`,`connector`,`model_tier`,`announcement`],Zl=[`success`,`failure`],Ql=L({adminId:j(),email:O().nullable(),isRemoved:P()}),$l=L({ipAddress:O().optional(),details:Fs(O(),F()).optional(),errorMessage:O().optional()}),eu=L({id:j(),actor:Ql,action:B(Yl),resourceType:B(Xl),resourceId:O().nullable(),resourceLabel:O().nullable(),status:B(Zl),metadata:$l,createdAt:H()});hl.extend({actorAdminId:j().optional(),action:B(Yl).optional(),resourceType:B(Xl).optional(),status:B(Zl).optional(),workspaceSearch:O().trim().max(200).optional(),from:W.optional(),to:W.optional()}),L({items:I(eu),total:N().int().nonnegative()});const tu=L({id:j(),workspaceId:j().nullable(),contentI18n:rl,ctaUrl:O().nullable(),urgency:kc,category:Oc,audience:pl,channels:il,surface:al,mediaKey:O().nullable(),createdBy:j().nullable(),createdAt:H()});hl.extend({surface:al.optional()}),L({items:I(tu),total:N().int().nonnegative()}),L({announcementId:j()});const nu={"user:read":`Read your profile information`,"user:write":`Update your profile and preferences`,"user:email":`Read your email address`,"workspaces:read":`List and read your workspaces`,"workspaces:write":`Create and modify workspaces`,"tasks:read":`Read your task history and messages`,"tasks:write":`Create and send messages`,"tasks:delete":`Delete your tasks`,"projects:read":`List and read your projects`,"projects:write":`Create and modify projects`,"agents:read":`List and read agents`,"agents:write":`Create and modify agents`,"agents:execute":`Execute agents via the external API`,"connectors:read":`List available connectors`,"connectors:write":`Configure connector settings`,"tools:read":`List available tools`,"tools:execute":`Execute tools`,"skills:read":`List and read skills`,"skills:write":`Create and modify skills`,"meetings:read":`Read meetings and recordings`,"meetings:write":`Create and modify meetings and recordings`,"notifications:read":`Read your notifications`,"notifications:write":`Manage notification state and device registrations`,"publishes:read":`List and read publish requests`,"publishes:write":`Submit, approve, reject, and revoke publishes`,"calendar:read":`Read your calendar accounts and events`,"calendar:write":`Manage calendar accounts and sync settings`,"schedules:read":`Read your schedules`,"schedules:write":`Create and modify schedules`,"subscriptions:read":`Read your personal subscription connections`,"subscriptions:write":`Connect and disconnect personal subscriptions`,"workflows:read":`Read your workflows and their runs`,"workflows:write":`Create, modify, and run workflows`,"chatbot:read":`List and read chatbot installations and configurations`,"chatbot:write":`Manage chatbot installations and configurations`,"llm:chat":`Call LLM models via the proxy endpoint`,offline_access:`Access your data when you are not present`},ru=[`offline_access`,`user:email`],iu=Object.keys(nu).filter(e=>!ru.includes(e));if(iu.length===0)throw Error(`PAT_AVAILABLE_SCOPES must not be empty`);const au=B(iu),ou=L({id:j(),name:O(),tokenPrefix:O(),scopes:I(O()).nullable(),resources:L({agents:I(O()).optional(),skills:I(O()).optional(),connectors:I(O()).optional()}).nullable(),expiresAt:H().nullable(),lastUsedAt:H().nullable(),createdAt:H()});L({name:O().trim().min(1).max(200),expiresInDays:N().int().min(1).max(3650).nullable(),scopes:I(au).min(1).transform(e=>[...new Set(e)]).nullable().default(null)}).refine(e=>!e.scopes?.includes(`agents:execute`),{message:`issue execute keys via POST /agents/:agentId/apiKeys`,path:[`scopes`]});const su=L({token:O(),data:ou});L({tokens:I(ou)});var cu=e(t(((e,t)=>{(function(e){let n=`(0?\\d+|0x[a-f0-9]+)`,r={fourOctet:RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,`i`),threeOctet:RegExp(`^${n}\\.${n}\\.${n}$`,`i`),twoOctet:RegExp(`^${n}\\.${n}$`,`i`),longValue:RegExp(`^${n}$`,`i`)},i=RegExp(`^0[0-7]+$`,`i`),a=RegExp(`^0x[a-f0-9]+$`,`i`),o=`%[0-9a-z]{1,}`,s=`(?:[0-9a-f]+::?)+`,c={zoneIndex:RegExp(o,`i`),native:RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,`i`),deprecatedTransitional:RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${o})?)$`,`i`),transitional:RegExp(`^((?:${s})|(?:::)(?:${s})?)${n}\\.${n}\\.${n}\\.${n}(${o})?$`,`i`)};function l(e,t){if(e.indexOf(`::`)!==e.lastIndexOf(`::`))return null;let n=0,r=-1,i=(e.match(c.zoneIndex)||[])[0],a,o;for(i&&(i=i.substring(1),e=e.replace(/%.+$/,``));(r=e.indexOf(`:`,r+1))>=0;)n++;if(e.substr(0,2)===`::`&&n--,e.substr(-2,2)===`::`&&n--,n>t)return null;for(o=t-n,a=`:`;o--;)a+=`0:`;return e=e.replace(`::`,a),e[0]===`:`&&(e=e.slice(1)),e[e.length-1]===`:`&&(e=e.slice(0,-1)),t=(function(){let t=e.split(`:`),n=[];for(let e=0;e<t.length;e++)n.push(parseInt(t[e],16));return n})(),{parts:t,zoneId:i}}function u(e,t,n,r){if(e.length!==t.length)throw Error(`ipaddr: cannot match CIDR for objects with different lengths`);let i=0,a;for(;r>0;){if(a=n-r,a<0&&(a=0),e[i]>>a!==t[i]>>a)return!1;r-=n,i+=1}return!0}function d(e){if(a.test(e))return parseInt(e,16);if(e[0]===`0`&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function f(e,t){for(;e.length<t;)e=`0${e}`;return e}let p={};p.IPv4=(function(){function e(e){if(e.length!==4)throw Error(`ipaddr: ipv4 octet count should be 4`);let t,n;for(t=0;t<e.length;t++)if(n=e[t],!(0<=n&&n<=255))throw Error(`ipaddr: ipv4 octet should fit in 8 bits`);this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]],as112:[[new e([192,175,48,0]),24],[new e([192,31,196,0]),24]],amt:[[new e([192,52,193,0]),24]]},e.prototype.kind=function(){return`ipv4`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv4`)throw Error(`ipaddr: cannot match ipv4 address with non-ipv4 one`);return u(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},r,i,a;for(r=3;r>=0;--r)if(i=this.octets[r],i in n){if(a=n[i],t&&a!==0)return null;a!==8&&(t=!0),e+=a}else return null;return 32-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(`.`)},e})(),p.IPv4.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<4;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},p.IPv4.isIPv4=function(e){return this.parser(e)!==null},p.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch{return!1}},p.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv4.isValidFourPartDecimal=function(e){return!!(p.IPv4.isValid(e)&&e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.isValidCIDRFourPartDecimal=function(e){let t=e.match(/^(.+)\/(\d+)$/);return!p.IPv4.isValidCIDR(e)||!t?!1:p.IPv4.isValidFourPartDecimal(t[1])},p.IPv4.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},p.IPv4.parse=function(e){let t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like an IPv4 Address`);return new this(t)},p.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){let e=parseInt(t[2]);if(e>=0&&e<=32){let n=[this.parse(t[1]),e];return Object.defineProperty(n,"toString",{value:function(){return this.join(`/`)}}),n}}throw Error(`ipaddr: string is not formatted like an IPv4 CIDR range`)},p.IPv4.parser=function(e){let t,n,i;if(t=e.match(r.fourOctet))return(function(){let e=t.slice(1,6),r=[];for(let t=0;t<e.length;t++)n=e[t],r.push(d(n));return r})();if(t=e.match(r.longValue)){if(i=d(t[1]),i>4294967295||i<0)throw Error(`ipaddr: address outside defined range`);return(function(){let e=[],t;for(t=0;t<=24;t+=8)e.push(i>>t&255);return e})().reverse()}else if(t=e.match(r.twoOctet))return(function(){let e=t.slice(1,4),n=[];if(i=d(e[1]),i>16777215||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(i>>16&255),n.push(i>>8&255),n.push(i&255),n})();else if(t=e.match(r.threeOctet))return(function(){let e=t.slice(1,5),n=[];if(i=d(e[2]),i>65535||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(d(e[1])),n.push(i>>8&255),n.push(i&255),n})();else return null},p.IPv4.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),e<0||e>32)throw Error(`ipaddr: invalid IPv4 prefix length`);let t=[0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<4&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.IPv6=(function(){function e(e,t){let n,r;if(e.length===16)for(this.parts=[],n=0;n<=14;n+=2)this.parts.push(e[n]<<8|e[n+1]);else if(e.length===8)this.parts=e;else throw Error(`ipaddr: ipv6 part count should be 8 or 16`);for(n=0;n<this.parts.length;n++)if(r=this.parts[n],!(0<=r&&r<=65535))throw Error(`ipaddr: ipv6 part should fit in 16 bits`);t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],discard:[new e([256,0,0,0,0,0,0,0]),64],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[new e([100,65435,0,0,0,0,0,0]),96],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[[new e([8193,4,274,0,0,0,0,0]),48],[new e([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new e([8193,48,0,0,0,0,0,0]),28],reserved:[[new e([8193,0,0,0,0,0,0,0]),23],[new e([8193,3512,0,0,0,0,0,0]),32]]},e.prototype.isIPv4MappedAddress=function(){return this.range()===`ipv4Mapped`},e.prototype.kind=function(){return`ipv6`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv6`)throw Error(`ipaddr: cannot match ipv6 address with non-ipv6 one`);return u(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},r,i;for(let a=7;a>=0;--a)if(r=this.parts[a],r in n){if(i=n[r],t&&i!==0)return null;i!==16&&(t=!0),e+=i}else return null;return 128-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e,t=[],n=this.parts;for(let r=0;r<n.length;r++)e=n[r],t.push(e>>8),t.push(e&255);return t},e.prototype.toFixedLengthString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(f(this.parts[t].toString(16),4));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw Error(`ipaddr: trying to convert a generic ipv6 address to ipv4`);let e=this.parts.slice(-2),t=e[0],n=e[1];return new p.IPv4([t>>8,t&255,n>>8,n&255])},e.prototype.toNormalizedString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){let e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString(),n=0,r=-1,i;for(;i=e.exec(t);)i[0].length>r&&(n=i.index,r=i[0].length);return r<0?t:`${t.substring(0,n)}::${t.substring(n+r)}`},e.prototype.toString=function(){return this.toRFC5952String()},e})(),p.IPv6.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<16;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},p.IPv6.isIPv6=function(e){return this.parser(e)!==null},p.IPv6.isValid=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{let t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch{return!1}},p.IPv6.isValidCIDR=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv6.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<16;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},p.IPv6.parse=function(e){let t=this.parser(e);if(t.parts===null)throw Error(`ipaddr: string is not formatted like an IPv6 Address`);return new this(t.parts,t.zoneId)},p.IPv6.parseCIDR=function(e){let t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv6 CIDR range`)},p.IPv6.parser=function(e){let t,n,r,i,a,o;if(r=e.match(c.deprecatedTransitional))return this.parser(`::ffff:${r[1]}`);if(c.native.test(e))return l(e,8);if((r=e.match(c.transitional))&&(o=r[6]||``,t=r[1],r[1].endsWith(`::`)||(t=t.slice(0,-1)),t=l(t+o,6),t.parts)){for(a=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],n=0;n<a.length;n++)if(i=a[n],!(0<=i&&i<=255))return null;return t.parts.push(a[0]<<8|a[1]),t.parts.push(a[2]<<8|a[3]),{parts:t.parts,zoneId:t.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),e<0||e>128)throw Error(`ipaddr: invalid IPv6 prefix length`);let t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<16&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.fromByteArray=function(e){let t=e.length;if(t===4)return new p.IPv4(e);if(t===16)return new p.IPv6(e);throw Error(`ipaddr: the binary input is neither an IPv6 nor IPv4 address`)},p.isValid=function(e){return p.IPv6.isValid(e)||p.IPv4.isValid(e)},p.isValidCIDR=function(e){return p.IPv6.isValidCIDR(e)||p.IPv4.isValidCIDR(e)},p.parse=function(e){if(p.IPv6.isValid(e))return p.IPv6.parse(e);if(p.IPv4.isValid(e))return p.IPv4.parse(e);throw Error(`ipaddr: the address has neither IPv6 nor IPv4 format`)},p.parseCIDR=function(e){try{return p.IPv6.parseCIDR(e)}catch{try{return p.IPv4.parseCIDR(e)}catch{throw Error(`ipaddr: the address has neither IPv6 nor IPv4 CIDR format`)}}},p.process=function(e){let t=this.parse(e);return t.kind()===`ipv6`&&t.isIPv4MappedAddress()?t.toIPv4Address():t},p.subnetMatch=function(e,t,n){let r,i,a,o;for(i in n??=`unicast`,t)if(Object.prototype.hasOwnProperty.call(t,i)){for(a=t[i],a[0]&&!(a[0]instanceof Array)&&(a=[a]),r=0;r<a.length;r++)if(o=a[r],e.kind()===o[0].kind()&&e.match.apply(e,o))return i}return n},t!==void 0&&t.exports?t.exports=p:e.ipaddr=p})(e)}))(),1);function lu(e){return cu.default.isValid(e)&&cu.default.parse(e).range()===`unicast`}function uu(e){try{let{hostname:t}=new URL(e),n=t.toLowerCase().replace(/\.$/u,``);if(n===`localhost`||n.endsWith(`.localhost`))return!1;let r=n.startsWith(`[`)&&n.endsWith(`]`)?n.slice(1,-1):n;return!cu.default.isValid(r)||lu(r)}catch{return!1}}const du=M().min(1).max(4096).refine(e=>{try{return[`http:`,`https:`].includes(new URL(e).protocol)}catch{return!1}},{message:`Only HTTP/HTTPS protocols are allowed`}).refine(uu,{message:`Access to private network addresses is not allowed`}),fu=B([`queued`,`running`,`completed`,`failed`]),pu=L({tool:O(),connectorId:O().optional(),summary:O(),status:O()});L({executionId:j(),status:fu,agentVersionId:j().optional(),output:L({text:O(),structured:F().optional()}).optional(),actions:I(pu).optional(),cost:N().optional()}),L({executionId:j(),status:V(`running`)}),L({input:O().min(1).max(1e5),agentVersionId:j().optional(),webhookUrl:du.optional(),metadata:Fs(O().max(100),O().max(1e3)).refine(e=>Object.keys(e).length<=20,{message:`metadata supports at most 20 keys`}).optional()}),L({requestsPerMinute:N().int().min(1).max(1e4).nullable()}),L({requestsPerMinute:N().int().nullable()}),L({items:I(ou.pick({id:!0,name:!0,createdAt:!0,lastUsedAt:!0}))}),L({name:O().trim().min(1).max(200),expiresInDays:N().int().min(1).max(3650).nullable()}),su.extend({webhookSecret:O()});const q={AGENT:`agent`,ASSET:`asset`,AUDIT_LOG:`audit_log`,CHART:`chart`,IMAGE_GENERATION:`image_generation`,MEETING:`meeting`,MEMORY:`memory`,PROJECT:`project`,SANDBOX:`sandbox`,SCHEDULE:`schedule`,SKILL:`skill`,SKILL_MANAGEMENT:`skill_management`,SLIDES:`slides`,SUBAGENT:`subagent`,TASK:`task`,WEB_SEARCH:`web_search`,WORKFLOW:`workflow`};Object.values(q);const mu=[q.WEB_SEARCH,q.IMAGE_GENERATION],J={SANDBOX:`sandbox`,MULTITASKING:`multitasking`,HISTORY:`history`,CREATION:`creation`,PROJECT:`project`,WEB_SEARCH:`web_search`,SCHEDULE:`schedule`,AGENTS_AND_SKILLS:`agents_and_skills`,AUDIT_LOG:`audit_log`},hu=Object.values(J);J.SANDBOX,q.SANDBOX,q.SKILL,J.MULTITASKING,q.SUBAGENT,q.WORKFLOW,J.HISTORY,q.TASK,q.MEETING,q.MEMORY,J.CREATION,q.ASSET,q.SLIDES,q.IMAGE_GENERATION,J.PROJECT,q.PROJECT,q.ASSET,J.WEB_SEARCH,q.WEB_SEARCH,J.SCHEDULE,q.SCHEDULE,J.AGENTS_AND_SKILLS,q.AGENT,q.SKILL_MANAGEMENT,J.AUDIT_LOG,q.AUDIT_LOG;const gu=Is(B(hu),P());function _u(e,t){return e===void 0?!0:e[t]??t!==J.AUDIT_LOG}function vu(e){return Object.fromEntries(hu.map(t=>[t,e.includes(t)]))}function yu(e){return hu.filter(t=>_u(e,t))}const bu=Object.freeze(vu([J.SANDBOX,J.AGENTS_AND_SKILLS]));q.CHART;const xu=[`chatgpt`,`claude`],Su={chatgpt:{modelProvider:`chatgpt-subscription`,modelIdPrefix:`chatgpt-sub/`,connectionFlow:`device-code`},claude:{modelProvider:`claude-subscription`,modelIdPrefix:`claude-sub/`,connectionFlow:`authorization-code`}},Cu=B(xu);L({connections:I(L({provider:Cu,status:B([`pending`,`connected`,`expired`,`error`]),accountLabel:O().nullable(),plan:O().nullable(),lastError:O().nullable(),connectedAt:H().nullable()})),connectableProviders:I(Cu)}),z(`connectionFlow`,[L({userCode:O(),verificationUrl:M(),expiresAt:H(),pollIntervalSeconds:N().int().positive()}).extend({connectionFlow:V(`device-code`)}),L({connectionFlow:V(`authorization-code`),authorizationUrl:M(),expiresAt:H()})]),L({code:O().trim().min(1).max(4096)}),L({models:I(L({id:O(),name:O(),provider:Cu}))});const wu=[`openai`,`anthropic`,`vertex-anthropic`,`vertex-google`,`google`,`openrouter`,`selfhosted`,`apmic`,`cerebras`],Tu=[`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],Eu=[{id:`gpt-5.6-sol`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5.6 Sol`,description:`Frontier model for complex professional work`,hiddenInTask:!1,active:!0,contextWindowTokens:105e4,maxOutputTokens:128e3,pricing:{input:`0.000_005`,output:`0.000_030`,cachedInput:`0.000_000_5`,cacheCreation:`0.000_006_25`,longContext:{input:`0.000_010`,output:`0.000_045`,cachedInput:`0.000_001`,cacheCreation:`0.000_012_5`}},capabilities:{reasoning:!0},tokenCalculator:{kind:`input-context`,thresholdTokens:272e3}},{id:`gpt-5.6-terra`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5.6 Terra`,description:`GPT-5.6 model that balances intelligence and cost`,hiddenInTask:!1,active:!0,contextWindowTokens:105e4,maxOutputTokens:128e3,pricing:{input:`0.000_002`,output:`0.000_012`,cachedInput:`0.000_000_2`,cacheCreation:`0.000_002_5`,longContext:{input:`0.000_004`,output:`0.000_018`,cachedInput:`0.000_000_4`,cacheCreation:`0.000_005`}},capabilities:{reasoning:!0},tokenCalculator:{kind:`input-context`,thresholdTokens:272e3}},{id:`gpt-5.6-luna`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5.6 Luna`,description:`GPT-5.6 model optimized for cost-sensitive workloads`,hiddenInTask:!1,active:!0,contextWindowTokens:105e4,maxOutputTokens:128e3,pricing:{input:`0.000_000_2`,output:`0.000_001_2`,cachedInput:`0.000_000_02`,cacheCreation:`0.000_000_25`,longContext:{input:`0.000_000_4`,output:`0.000_001_8`,cachedInput:`0.000_000_04`,cacheCreation:`0.000_000_5`}},capabilities:{reasoning:!0},tokenCalculator:{kind:`input-context`,thresholdTokens:272e3}},{id:`gpt-5.5`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5.5`,description:`A new class of intelligence for coding and professional work`,hiddenInTask:!1,active:!0,contextWindowTokens:272e3,maxOutputTokens:64e3,pricing:{input:`0.000_005`,output:`0.000_030`,cachedInput:`0.000_000_5`,longContext:{input:`0.000_010`,output:`0.000_045`,cachedInput:`0.000_001`}},capabilities:{reasoning:!0},tokenCalculator:{kind:`input-context`,thresholdTokens:272e3}},{id:`gpt-5.4`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5.4`,description:`A more affordable model for coding and professional work`,hiddenInTask:!1,active:!0,contextWindowTokens:272e3,maxOutputTokens:64e3,pricing:{input:`0.000_002_5`,output:`0.000_015`,cachedInput:`0.000_000_25`,longContext:{input:`0.000_005`,output:`0.000_022_5`,cachedInput:`0.000_000_5`}},capabilities:{reasoning:!0},tokenCalculator:{kind:`input-context`,thresholdTokens:272e3}},{id:`gpt-5.4-mini`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5.4 mini`,description:`Our strongest mini model yet for coding, computer use, and subagents`,hiddenInTask:!1,active:!0,contextWindowTokens:272e3,maxOutputTokens:32e3,pricing:{input:`0.000_000_75`,output:`0.000_004_5`,cachedInput:`0.000_000_075`},capabilities:{reasoning:!0}},{id:`gpt-5.2`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5.2`,description:`The most advanced frontier model for professional work and long-running agents`,hiddenInTask:!1,active:!1,contextWindowTokens:272e3,maxOutputTokens:64e3,pricing:{input:`0.000_001_75`,output:`0.000_014`,cachedInput:`0.000_000_175`},capabilities:{reasoning:!0}},{id:`gpt-5.1`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5.1`,description:`Smarter, more conversational TaskGPT`,hiddenInTask:!1,active:!1,contextWindowTokens:272e3,maxOutputTokens:64e3,pricing:{input:`0.000_001_25`,output:`0.000_010`,cachedInput:`0.000_000_125`},capabilities:{reasoning:!0}},{id:`gpt-5`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5`,description:`Smartest, fastest, most useful model from OpenAI`,hiddenInTask:!1,active:!1,contextWindowTokens:272e3,maxOutputTokens:64e3,pricing:{input:`0.000_001_25`,output:`0.000_010`,cachedInput:`0.000_000_125`},capabilities:{reasoning:!0}},{id:`gpt-5-mini`,provider:`openai`,reasoning:{effort:`medium`},name:`GPT-5 mini`,description:`Fast for everyday tasks in low-cost`,hiddenInTask:!1,active:!1,contextWindowTokens:272e3,maxOutputTokens:32e3,pricing:{input:`0.000_000_25`,output:`0.000_002`,cachedInput:`0.000_000_025`},capabilities:{reasoning:!0}},{id:`o3`,provider:`openai`,reasoning:{effort:`medium`},name:`o3`,description:`Great for advanced reasoning`,hiddenInTask:!1,active:!1,contextWindowTokens:2e5,maxOutputTokens:64e3,pricing:{input:`0.000_002`,output:`0.000_008`,cachedInput:`0.000_000_5`},capabilities:{reasoning:!0}},{id:`gpt-4o`,provider:`openai`,name:`GPT-4o`,description:`Great for most tasks`,hiddenInTask:!1,active:!1,contextWindowTokens:2e5,maxOutputTokens:16e3,pricing:{input:`0.000_002_5`,output:`0.000_010`,cachedInput:`0.000_001_25`}},{id:`gpt-4.1-mini`,provider:`openai`,name:`GPT-4.1 mini`,description:`Fast for everyday tasks in low-cost`,hiddenInTask:!1,active:!1,contextWindowTokens:2e5,maxOutputTokens:32e3,pricing:{input:`0.000_000_4`,output:`0.000_001_6`,cachedInput:`0.000_000_1`}},{id:`gpt-image-2`,provider:`openai`,name:`GPT Image 2`,description:`OpenAI state-of-the-art image generation model. Supports text + image input; outputs images.`,hiddenInTask:!0,active:!0,contextWindowTokens:2e5,pricing:{input:`0.000_005`,output:`0.000_030`},imageGeneration:`gpt-image-2`,imageModel:!0},{id:`claude-haiku-4-5-20251001`,provider:`anthropic`,reasoning:{thinking:{type:`enabled`,budgetTokens:12e3}},name:`Claude Haiku 4.5`,description:`Near-frontier performance with much greater cost-efficiency`,hiddenInTask:!1,active:!0,contextWindowTokens:2e5,maxOutputTokens:64e3,pricing:{input:`0.000_001`,output:`0.000_005`,cachedInput:`0.000_000_1`,cacheCreation:`0.000_001_25`,cacheCreation1h:`0.000_002`}},{id:`claude-sonnet-4-20250514`,provider:`anthropic`,reasoning:{thinking:{type:`enabled`,budgetTokens:12e3}},name:`Claude Sonnet 4`,description:`Smart, efficient model for everyday use`,hiddenInTask:!1,active:!1,contextWindowTokens:2e5,extendedContextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_003`,output:`0.000_015`,cachedInput:`0.000_000_3`,cacheCreation:`0.000_003_75`,cacheCreation1h:`0.000_006`,longContext:{input:`0.000_006`,output:`0.000_022_5`,cachedInput:`0.000_000_6`,cacheCreation:`0.000_007_5`,cacheCreation1h:`0.000_012`}},tokenCalculator:{kind:`long-context`,thresholdTokens:2e5}},{id:`claude-sonnet-4-5-20250929`,provider:`anthropic`,reasoning:{thinking:{type:`enabled`,budgetTokens:12e3}},name:`Claude Sonnet 4.5`,description:`Anthropic's best model for complex agents and coding`,hiddenInTask:!1,active:!0,contextWindowTokens:2e5,extendedContextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_003`,output:`0.000_015`,cachedInput:`0.000_000_3`,cacheCreation:`0.000_003_75`,cacheCreation1h:`0.000_006`,longContext:{input:`0.000_006`,output:`0.000_022_5`,cachedInput:`0.000_000_6`,cacheCreation:`0.000_007_5`,cacheCreation1h:`0.000_012`}},tokenCalculator:{kind:`long-context`,thresholdTokens:2e5}},{id:`claude-sonnet-4-6`,provider:`anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},name:`Claude Sonnet 4.6`,description:`Anthropic's best model for complex agents and coding`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_003`,output:`0.000_015`,cachedInput:`0.000_000_3`,cacheCreation:`0.000_003_75`,cacheCreation1h:`0.000_006`}},{id:`claude-sonnet-5`,provider:`anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},name:`Claude Sonnet 5`,description:`Best combination of speed and intelligence for agents and coding`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_002`,output:`0.000_010`,cachedInput:`0.000_000_2`,cacheCreation:`0.000_002_5`,cacheCreation1h:`0.000_004`}},{id:`claude-opus-4-1-20250805`,provider:`anthropic`,reasoning:{thinking:{type:`enabled`,budgetTokens:12e3}},name:`Claude Opus 4.1`,description:`Powerful model for complex challenges with 5x money cost`,hiddenInTask:!1,active:!1,contextWindowTokens:2e5,maxOutputTokens:32e3,pricing:{input:`0.000_015`,output:`0.000_075`,cachedInput:`0.000_001_5`,cacheCreation:`0.000_018_75`,cacheCreation1h:`0.000_030`}},{id:`claude-opus-4-6`,provider:`anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},name:`Claude Opus 4.6`,description:`Most powerful model for complex challenges`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_005`,output:`0.000_025`,cachedInput:`0.000_000_5`,cacheCreation:`0.000_006_25`,cacheCreation1h:`0.000_010`}},{id:`claude-opus-4-8`,provider:`anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},name:`Claude Opus 4.8`,description:`Most powerful model for complex challenges`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_005`,output:`0.000_025`,cachedInput:`0.000_000_5`,cacheCreation:`0.000_006_25`,cacheCreation1h:`0.000_010`}},{id:`claude-opus-5`,provider:`anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},name:`Claude Opus 5`,description:`Most powerful model for complex challenges`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_005`,output:`0.000_025`,cachedInput:`0.000_000_5`,cacheCreation:`0.000_006_25`,cacheCreation1h:`0.000_010`}},{id:`claude-haiku-4-5@20251001`,provider:`vertex-anthropic`,reasoning:{thinking:{type:`enabled`,budgetTokens:12e3}},name:`Claude Haiku 4.5`,description:`Near-frontier performance with much greater cost-efficiency (via Vertex AI)`,hiddenInTask:!1,active:!0,contextWindowTokens:2e5,maxOutputTokens:64e3,pricing:{input:`0.000_001`,output:`0.000_005`,cachedInput:`0.000_000_1`,cacheCreation:`0.000_001_25`,cacheCreation1h:`0.000_002`}},{id:`claude-sonnet-4-5@20250929`,provider:`vertex-anthropic`,reasoning:{thinking:{type:`enabled`,budgetTokens:12e3}},name:`Claude Sonnet 4.5`,description:`Anthropic's best model for complex agents and coding (via Vertex AI)`,hiddenInTask:!1,active:!0,contextWindowTokens:2e5,extendedContextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_003`,output:`0.000_015`,cachedInput:`0.000_000_3`,cacheCreation:`0.000_003_75`,cacheCreation1h:`0.000_006`,longContext:{input:`0.000_006`,output:`0.000_022_5`,cachedInput:`0.000_000_6`,cacheCreation:`0.000_007_5`,cacheCreation1h:`0.000_012`}},tokenCalculator:{kind:`long-context`,thresholdTokens:2e5}},{id:`vertex/claude-sonnet-4-6`,provider:`vertex-anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},providerModelId:`claude-sonnet-4-6`,name:`Claude Sonnet 4.6`,description:`Anthropic's best model for complex agents and coding (via Vertex AI)`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_003`,output:`0.000_015`,cachedInput:`0.000_000_3`,cacheCreation:`0.000_003_75`,cacheCreation1h:`0.000_006`}},{id:`vertex/claude-sonnet-5`,provider:`vertex-anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},providerModelId:`claude-sonnet-5`,name:`Claude Sonnet 5`,description:`Best combination of speed and intelligence for agents and coding (via Vertex AI)`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_002`,output:`0.000_010`,cachedInput:`0.000_000_2`,cacheCreation:`0.000_002_5`,cacheCreation1h:`0.000_004`}},{id:`claude-opus-4-5@20251101`,provider:`vertex-anthropic`,reasoning:{thinking:{type:`enabled`,budgetTokens:12e3}},name:`Claude Opus 4.5`,description:`Latest Opus model for most complex tasks (via Vertex AI)`,hiddenInTask:!1,active:!1,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_015`,output:`0.000_075`,cachedInput:`0.000_001_5`,cacheCreation:`0.000_018_75`,cacheCreation1h:`0.000_030`}},{id:`vertex/claude-opus-4-6`,provider:`vertex-anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},providerModelId:`claude-opus-4-6`,name:`Claude Opus 4.6`,description:`Most powerful model for complex challenges (via Vertex AI)`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_005`,output:`0.000_025`,cachedInput:`0.000_000_5`,cacheCreation:`0.000_006_25`,cacheCreation1h:`0.000_010`}},{id:`vertex/claude-opus-4-8`,provider:`vertex-anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},providerModelId:`claude-opus-4-8`,name:`Claude Opus 4.8`,description:`Most powerful model for complex challenges (via Vertex AI)`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_005`,output:`0.000_025`,cachedInput:`0.000_000_5`,cacheCreation:`0.000_006_25`,cacheCreation1h:`0.000_010`}},{id:`vertex/claude-opus-5`,provider:`vertex-anthropic`,reasoning:{thinking:{type:`adaptive`},effort:`high`},providerModelId:`claude-opus-5`,name:`Claude Opus 5`,description:`Most powerful model for complex challenges (via Vertex AI)`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_005`,output:`0.000_025`,cachedInput:`0.000_000_5`,cacheCreation:`0.000_006_25`,cacheCreation1h:`0.000_010`}},{id:`vertex/gemini-3.8-flash`,provider:`vertex-google`,reasoning:{type:`level`,level:`high`},providerModelId:`gemini-3.8-flash`,name:`Gemini 3.8 Flash (Vertex)`,description:`Most intelligent Flash model for long-horizon software engineering and autonomous agents (via Vertex AI).`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_75`,output:`0.000_003_75`,cachedInput:`0.000_000_075`}},{id:`vertex/gemini-3.7-flash`,provider:`vertex-google`,reasoning:{type:`level`,level:`high`},providerModelId:`gemini-3.7-flash`,name:`Gemini 3.7 Flash (Vertex)`,description:`Fast, efficient model for agentic, multimodal, and coding workflows (via Vertex AI).`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_75`,output:`0.000_003_75`,cachedInput:`0.000_000_075`}},{id:`vertex/gemini-3.5-flash`,provider:`vertex-google`,reasoning:{type:`level`,level:`medium`},providerModelId:`gemini-3.5-flash`,name:`Gemini 3.5 Flash (Vertex)`,description:`Frontier-level intelligence optimized for fast agentic and coding workflows (via Vertex AI).`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_001_5`,output:`0.000_009`,cachedInput:`0.000_000_15`}},{id:`vertex/gemini-3.1-pro-preview`,provider:`vertex-google`,reasoning:{type:`level`,level:`high`},providerModelId:`gemini-3.1-pro-preview`,name:`Gemini 3.1 Pro (Vertex)`,description:`Next-generation model with enhanced reasoning capabilities and improved performance (via Vertex AI).`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_002`,cachedInput:`0.000_000_2`,output:`0.000_012`,longContext:{input:`0.000_004`,cachedInput:`0.000_000_4`,output:`0.000_018`}},tokenCalculator:{kind:`long-context`,thresholdTokens:2e5}},{id:`vertex/gemini-3.5-flash-lite`,provider:`vertex-google`,reasoning:{type:`level`,level:`medium`},providerModelId:`gemini-3.5-flash-lite`,name:`Gemini 3.5 Flash Lite (Vertex)`,description:`Most cost-efficient model for high-volume agentic tasks (via Vertex AI).`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_3`,output:`0.000_002_5`,cachedInput:`0.000_000_03`}},{id:`vertex/gemini-3.1-flash-lite-preview`,provider:`vertex-google`,reasoning:{type:`level`,level:`minimal`},providerModelId:`gemini-3.1-flash-lite-preview`,name:`Gemini 3.1 Flash Lite (Vertex)`,description:`Lightweight and fast (via Vertex AI).`,hiddenInTask:!0,active:!1,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_25`,output:`0.000_001_5`,cachedInput:`0.000_000_025`}},{id:`vertex/gemini-3-pro-preview`,provider:`vertex-google`,reasoning:{type:`level`,level:`high`},providerModelId:`gemini-3-pro-preview`,name:`Gemini 3 Pro (Vertex)`,description:`The most powerful agentic model yet combines state-of-the-art reasoning with richer visuals and deep interactivity (via Vertex AI).`,hiddenInTask:!1,active:!1,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_002`,cachedInput:`0.000_000_2`,output:`0.000_012`,longContext:{input:`0.000_004`,cachedInput:`0.000_000_4`,output:`0.000_018`}},tokenCalculator:{kind:`long-context`,thresholdTokens:2e4}},{id:`vertex/gemini-3-pro-image-preview`,provider:`vertex-google`,reasoning:{type:`level`,level:`high`},providerModelId:`gemini-3-pro-image-preview`,name:`Gemini 3 Pro Image Preview (Vertex)`,description:`The most powerful image generation model that lets you generate and edit images conversationally with state-of-the-art quality (via Vertex AI).`,hiddenInTask:!0,active:!0,contextWindowTokens:1e6,maxOutputTokens:32e3,pricing:{input:`0.000_002`,output:`0.000_012`,outputImage:`0.000_12`,cachedInput:`0.000_000_2`},tokenCalculator:{kind:`image-output`},imageGeneration:`gemini-3-pro`},{id:`vertex/gemini-3-flash-preview`,provider:`vertex-google`,reasoning:{type:`level`,level:`high`},providerModelId:`gemini-3-flash-preview`,name:`Gemini 3 Flash (Vertex)`,description:`Fast and efficient preview model (via Vertex AI)`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_5`,output:`0.000_003`,cachedInput:`0.000_000_05`}},{id:`vertex/gemini-2.5-flash-image`,provider:`vertex-google`,reasoning:{type:`budget`,budgetTokens:12e3},providerModelId:`gemini-2.5-flash-image`,name:`Gemini 2.5 Flash Image (Vertex)`,description:`Latest, fastest, and most efficient natively multimodal model that lets you generate and edit images conversationally (via Vertex AI).`,hiddenInTask:!0,active:!0,contextWindowTokens:1e6,maxOutputTokens:32e3,pricing:{input:`0.000_000_3`,output:`0.000_002_5`,outputImage:`0.000_03`,cachedInput:`0.000_000_03`,cacheCreation:`0.000_001`},tokenCalculator:{kind:`image-output`},imageGeneration:`gemini-2.5-flash`},{id:`vertex/gemini-2.5-flash-lite`,provider:`vertex-google`,reasoning:{type:`budget`,budgetTokens:12e3},providerModelId:`gemini-2.5-flash-lite`,name:`Gemini 2.5 Flash Lite (Vertex)`,description:`Lightweight and fast (via Vertex AI).`,hiddenInTask:!0,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_1`,output:`0.000_000_4`,cachedInput:`0.000_000_01`,cacheCreation:`0.000_001`}},{id:`gemini-3.8-flash`,provider:`google`,reasoning:{type:`level`,level:`high`},name:`Gemini 3.8 Flash`,description:`Most intelligent Flash model for long-horizon software engineering and autonomous agents`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_75`,output:`0.000_003_75`,cachedInput:`0.000_000_075`}},{id:`gemini-3.7-flash`,provider:`google`,reasoning:{type:`level`,level:`high`},name:`Gemini 3.7 Flash`,description:`Fast, efficient model for agentic, multimodal, and coding workflows`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_75`,output:`0.000_003_75`,cachedInput:`0.000_000_075`}},{id:`gemini-3.5-flash`,provider:`google`,reasoning:{type:`level`,level:`medium`},name:`Gemini 3.5 Flash`,description:`Frontier-level intelligence optimized for fast agentic and coding workflows`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_001_5`,output:`0.000_009`,cachedInput:`0.000_000_15`}},{id:`gemini-3.1-pro-preview`,provider:`google`,reasoning:{type:`level`,level:`high`},name:`Gemini 3.1 Pro`,description:`Next-generation model with enhanced reasoning capabilities and improved performance.`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_002`,cachedInput:`0.000_000_2`,output:`0.000_012`,longContext:{input:`0.000_004`,cachedInput:`0.000_000_4`,output:`0.000_018`}},tokenCalculator:{kind:`long-context`,thresholdTokens:2e5}},{id:`gemini-3.5-flash-lite`,provider:`google`,reasoning:{type:`level`,level:`medium`},name:`Gemini 3.5 Flash Lite`,description:`Most cost-efficient model for high-volume agentic tasks`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_3`,output:`0.000_002_5`,cachedInput:`0.000_000_03`}},{id:`gemini-3.1-flash-lite-preview`,provider:`google`,reasoning:{type:`level`,level:`minimal`},name:`Gemini 3.1 Flash Lite`,description:`Lightweight and fast`,hiddenInTask:!0,active:!1,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_25`,output:`0.000_001_5`,cachedInput:`0.000_000_025`}},{id:`gemini-3-pro-preview`,provider:`google`,reasoning:{type:`level`,level:`high`},name:`Gemini 3 Pro`,description:`The most powerful agentic model yet combines state-of-the-art reasoning with richer visuals and deep interactivity.`,hiddenInTask:!1,active:!1,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_002`,cachedInput:`0.000_000_2`,output:`0.000_012`,longContext:{input:`0.000_004`,cachedInput:`0.000_000_4`,output:`0.000_018`}},tokenCalculator:{kind:`long-context`,thresholdTokens:2e4}},{id:`gemini-3-pro-image-preview`,provider:`google`,reasoning:{type:`level`,level:`high`},name:`Gemini 3 Pro Image Preview`,description:`The most powerful image generation model that lets you generate and edit images conversationally with state-of-the-art quality.`,hiddenInTask:!0,active:!0,contextWindowTokens:1e6,maxOutputTokens:32e3,pricing:{input:`0.000_002`,output:`0.000_012`,outputImage:`0.000_12`,cachedInput:`0.000_000_2`},tokenCalculator:{kind:`image-output`},imageGeneration:`gemini-3-pro`},{id:`gemini-3-flash-preview`,provider:`google`,reasoning:{type:`level`,level:`high`},name:`Gemini 3 Flash`,description:`Fast and efficient preview model`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_5`,output:`0.000_003`,cachedInput:`0.000_000_05`}},{id:`gemini-2.5-pro`,provider:`google`,reasoning:{type:`budget`,budgetTokens:12e3},name:`Gemini 2.5 Pro`,description:`For reasoning, mathematics and programming`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_001_25`,output:`0.000_010`,cachedInput:`0.000_000_125`,cacheCreation:`0.000_004_5`,longContext:{input:`0.000_002_5`,output:`0.000_015`,cachedInput:`0.000_000_25`,cacheCreation:`0.000_004_5`}},tokenCalculator:{kind:`long-context`,thresholdTokens:2e5}},{id:`gemini-2.5-flash`,provider:`google`,reasoning:{type:`budget`,budgetTokens:12e3},name:`Gemini 2.5 Flash`,description:`Get quick assistance for various types`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_3`,output:`0.000_002_5`,cachedInput:`0.000_000_03`,cacheCreation:`0.000_001`}},{id:`gemini-2.5-flash-image`,provider:`google`,reasoning:{type:`budget`,budgetTokens:12e3},name:`Gemini 2.5 Flash Image `,description:`Latest, fastest, and most efficient natively multimodal model that lets you generate and edit images conversationally.`,hiddenInTask:!0,active:!0,contextWindowTokens:1e6,maxOutputTokens:32e3,pricing:{input:`0.000_000_3`,output:`0.000_002_5`,outputImage:`0.000_03`,cachedInput:`0.000_000_03`,cacheCreation:`0.000_001`},tokenCalculator:{kind:`image-output`},imageGeneration:`gemini-2.5-flash`},{id:`gemini-2.5-flash-lite`,provider:`google`,reasoning:{type:`budget`,budgetTokens:12e3},name:`Gemini 2.5 Flash Lite`,description:`Lightweight and fast`,hiddenInTask:!0,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_1`,output:`0.000_000_4`,cachedInput:`0.000_000_01`,cacheCreation:`0.000_001`}},{id:`openai/gpt-oss-120b`,provider:`openrouter`,reasoning:{type:`effort`,effort:`medium`},name:`GPT-OSS 120B`,description:`Open source model from OpenAI`,hiddenInTask:!1,active:!0,contextWindowTokens:131072,maxOutputTokens:64e3,pricing:{input:`0.000_000_1`,output:`0.000_000_5`}},{id:`z-ai/glm-4.6`,provider:`openrouter`,reasoning:{type:`enabled`},name:`GLM 4.6`,description:`GLM-4.6 with 200K context window, superior coding performance, advanced reasoning, and refined writing`,hiddenInTask:!1,active:!0,contextWindowTokens:2e5,maxOutputTokens:64e3,pricing:{input:`0.000_000_6`,output:`0.000_002_2`,cachedInput:`0.000_000_11`}},{id:`moonshotai/kimi-k2-thinking`,provider:`openrouter`,reasoning:{type:`enabled`},name:`Kimi K2 Thinking`,description:`Moonshot AI's most advanced open reasoning model with 256K context window, optimized for persistent step-by-step thought and complex reasoning workflows`,hiddenInTask:!1,active:!0,contextWindowTokens:2e5,maxOutputTokens:64e3,pricing:{input:`0.000_000_6`,output:`0.000_002_5`,cachedInput:`0.000_000_15`}},{id:`minimax/minimax-m2`,provider:`openrouter`,reasoning:{type:`enabled`},name:`MiniMax M2`,description:`Compact, high-efficiency model optimized for end-to-end coding and agentic workflows with 204.8K context window`,hiddenInTask:!1,active:!0,contextWindowTokens:2e5,maxOutputTokens:64e3,pricing:{input:`0.000_000_3`,output:`0.000_001_2`}},{id:`meta/muse-glimmer-30b`,provider:`openrouter`,reasoning:{type:`effort`,effort:`medium`},name:`Muse Glimmer 30B`,description:`Dense, open-weight multimodal model from Meta Superintelligence Labs, distilled from Muse Spark and optimized for autonomous agents on consumer hardware`,hiddenInTask:!1,active:!0,contextWindowTokens:131072,maxOutputTokens:64e3,pricing:{input:`0.000_000_35`,output:`0.000_001_5`,cachedInput:`0.000_000_04`}},{id:`moonshotai/kimi-k3`,provider:`openrouter`,reasoning:{type:`effort`,effort:`max`},name:`Kimi K3`,description:`Moonshot AI's multimodal reasoning model with a 1M context window, built for long-horizon agentic workflows`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_003`,output:`0.000_015`,cachedInput:`0.000_000_3`}},{id:`z-ai/glm-5.2`,provider:`openrouter`,reasoning:{type:`effort`,effort:`high`},name:`GLM 5.2`,description:`GLM-5.2 with strong coding and agentic performance, advanced reasoning, and long-context support`,hiddenInTask:!1,active:!0,contextWindowTokens:262144,maxOutputTokens:64e3,pricing:{input:`0.000_000_76`,output:`0.000_002_42`,cachedInput:`0.000_000_14`}},{id:`deepseek/deepseek-v4-flash-0731`,provider:`openrouter`,reasoning:{type:`effort`,effort:`high`},name:`DeepSeek V4 Flash`,description:`Low-cost, high-throughput DeepSeek model with a 1M context window, suited for high-volume agentic and coding workloads`,hiddenInTask:!1,active:!0,contextWindowTokens:1e6,maxOutputTokens:64e3,pricing:{input:`0.000_000_08`,output:`0.000_000_18`,cachedInput:`0.000_000_016`}},{id:`gpt-oss-120b`,provider:`selfhosted`,name:`GPT-OSS 120B`,description:`Open source model from OpenAI`,hiddenInTask:!1,active:!0,contextWindowTokens:131072,maxOutputTokens:64e3,pricing:{input:`0.000_000_1`,output:`0.000_000_5`}},{id:`apmic/qwen3.8-27b`,provider:`apmic`,providerModelId:`Qwen3.8-27B`,name:`Qwen3.8 27B`,description:`Qwen 3.8 27B served by APMIC`,hiddenInTask:!1,active:!0,contextWindowTokens:262144,maxOutputTokens:64e3,pricing:{input:`0`,output:`0`}},{id:`cerebras/qwen-3.8-27b`,provider:`cerebras`,providerModelId:`qwen-3.8-27b`,reasoning:{effort:`medium`},name:`Qwen3.8 27B (Cerebras)`,description:`Qwen 3.8 27B served on Cerebras wafer-scale inference`,hiddenInTask:!1,active:!0,capabilities:{reasoning:!0},contextWindowTokens:131072,maxOutputTokens:4e4,pricing:{input:`0.000_000_99`,output:`0.000_001_49`}},{id:`cerebras/gpt-oss-120b`,provider:`cerebras`,providerModelId:`gpt-oss-120b`,reasoning:{effort:`medium`},name:`GPT-OSS 120B (Cerebras)`,description:`Open source model from OpenAI served on Cerebras wafer-scale inference`,hiddenInTask:!1,active:!0,capabilities:{reasoning:!0},contextWindowTokens:131e3,maxOutputTokens:4e4,pricing:{input:`0.000_000_35`,output:`0.000_000_75`}}],Du=[...wu,`azure-openai`],Ou=xu.map(e=>Su[e].modelProvider),ku=[...Du,...Ou];function Au(e){return Eu.filter(t=>t.provider===e).map(e=>e.id)}Au(`openai`),Au(`anthropic`),Au(`vertex-anthropic`),Au(`vertex-google`),Au(`google`),Au(`openrouter`),Au(`selfhosted`),Au(`apmic`),Au(`cerebras`);const ju=[`chatgpt-sub/gpt-5.6-sol`,`chatgpt-sub/gpt-5.6-terra`,`chatgpt-sub/gpt-5.6-luna`,`chatgpt-sub/gpt-5.5`,`claude-sub/opus-5`,`claude-sub/sonnet-5`,`claude-sub/haiku-4-5`],Mu=[`chatgpt-pool/gpt-5.6-sol`,`chatgpt-pool/gpt-5.6-terra`,`chatgpt-pool/gpt-5.6-luna`,`chatgpt-pool/gpt-5.5`],Nu=Eu.map(e=>e.id);function Pu(e){return e.startsWith(`azure-`)}const Fu=[`lite`,`pro`,`max`],Iu=[`image`,`image-lite`],Lu=[`functionality`],Ru=[...Fu,...Iu,...Lu],zu=R([B(Nu),B(Fu),O().refine(e=>Pu(e)),B(ju),B(Mu)]),Bu=R([zu,V(`auto`)]),Vu=L({id:O(),name:O(),shortName:O().optional(),description:O(),shortDescription:O().optional(),enabled:P().optional(),tags:I(O()).optional()});L({models:I(Vu)}),L({tiers:I(L({tier:O(),model:Vu.optional()}))}),L({modelId:O()}),L({providers:I(L({id:O(),name:O(),baseUrl:O().nullable().optional(),verified:P(),models:I(L({id:O(),name:O(),enabled:P().optional(),additional:P().optional()})),options:Fs(O(),bs()).optional()}))}),L({models:I(L({id:O(),name:O(),provider:B(ku),supportsChat:P(),supportsImageGeneration:P(),availableForAdvanced:P()}))}),L({tiers:I(L({tier:B(Ru),modelId:O(),fallbackModelId:O().nullable()}))}),L({tier:B(Ru)}),L({modelId:O().min(1),fallbackModelId:O().min(1).nullable().optional()});const Hu=B([`create`,`user_edit`,`agent_tool`,`restore`,`marketplace_install`,`publish`,`migration`]),Uu=L({id:j(),versionNumber:N().int(),origin:Hu,note:O().nullable(),restoredFromVersionNumber:N().int().nullable(),createdBy:L({id:j(),name:O(),image:O().nullable()}).nullable(),createdAt:H()});L({versions:I(Uu.extend({publishedTargets:L({workspace:P(),teams:I(L({id:j(),name:O()}))})})),nextVersionNumber:N().int().nullable()});const Wu=L({id:j(),name:O(),available:P()}),Gu=Uu.extend({name:O(),description:O(),systemPrompt:O(),modelId:O(),connectorIds:I(j()),capabilities:gu,conversationStarters:I(O()),tools:I(O()).nullable(),iconId:j().nullable(),iconUrl:O().optional(),skillIds:I(j()),delegatableAgentIds:I(j()),connectors:I(Wu),skills:I(Wu),delegatableAgents:I(Wu)});L({workspaceId:j(),agentId:j(),versionId:j()}),L({expectedHeadVersionId:j(),dryRun:P().optional(),modelId:Bu.optional(),omitConnectorIds:I(j()).optional(),omitSkillIds:I(j()).optional(),omitDelegatableAgentIds:I(j()).optional(),omitTools:I(O()).optional(),note:O().trim().max(500).optional()}),L({issues:L({modelUnavailable:P(),connectorIds:I(j()),skillIds:I(j()),delegatableAgentIds:I(j()),tools:I(O())}).optional(),version:L({id:j(),versionNumber:N().int().positive()}).nullable()});const Ku=[`updatedAt`,`name`],qu={BUILT_IN:`built_in`,CUSTOM_SOURCE_CODE:`custom_source_code`,CUSTOM_REMOTE_URL:`custom_remote_url`},Ju=[qu.BUILT_IN,qu.CUSTOM_SOURCE_CODE,qu.CUSTOM_REMOTE_URL],Yu={PENDING:`pending`,APPROVED:`approved`,REJECTED:`rejected`,PENDING_UPDATE:`pending_update`};Yu.APPROVED,Yu.PENDING_UPDATE,Yu.PENDING,Yu.PENDING_UPDATE;const Xu={CONNECTOR:`connector`,AGENT:`agent`,SKILL:`skill`,MEETING:`meeting`};({...Xu});const Zu={OWNER:`owner`,MANAGER:`manager`,MEMBER:`member`},Qu={VISIBLE:`visible`,HIDDEN:`hidden`},$u={OWNER:`owner`,EDITOR:`editor`,VIEWER:`viewer`},ed=B([$u.OWNER,$u.EDITOR,$u.VIEWER]);$u.OWNER,$u.EDITOR,$u.VIEWER;const td={USER:`user`,TEAM:`team`},nd=B([td.USER,td.TEAM]),rd=ed.nullable(),id=B([Xu.CONNECTOR,Xu.AGENT,Xu.SKILL]),ad=[Yu.PENDING,Yu.APPROVED,Yu.REJECTED,Yu.PENDING_UPDATE],od=L({id:j(),name:O()}),sd=L({id:j(),type:id,name:O(),description:O().optional(),connectorType:B(Ju).optional(),iconUrl:O().optional(),provider:O().optional()});L({rejectReason:O().trim().max(500).optional()}),L({search:O().trim().max(200).optional(),status:R([B(ad),I(B(ad)).min(1)]).optional(),resourceType:id.optional(),limit:U().int().min(1).max(100).default(20),nextKey:O().optional()});const cd=L({id:j(),name:O(),versionNumber:N().int().nullable(),versionId:j().nullable(),publishId:j(),status:B(ad),rejectReason:O().nullable()}),ld=L({workspace:L({published:P(),versionNumber:N().int().nullable(),versionId:j().nullable(),publishId:j().nullable(),status:B(ad).nullable(),rejectReason:O().nullable()}),teams:I(cd)}),ud=L({type:O(),provider:O().optional(),scopes:I(O()).optional(),tutorial:O().optional()}),dd=L({type:V(`connector`),id:j(),name:O(),description:O(),iconUrl:O().optional(),toolPrefix:O(),url:O(),transport:O(),authorization:ud.optional()}),fd=L({id:j(),name:O(),hasPermission:P()}),pd=L({id:O(),name:O(),available:P()}),md=L({previous:Gu,current:Gu}),hd=L({type:V(`agent`),id:j(),name:O(),description:O(),iconUrl:O().optional(),systemPrompt:O(),conversationStarters:I(O()),model:pd,connectors:I(fd),capabilities:gu,diff:md.optional(),changeSummary:O().nullable().optional()}),gd=L({id:j(),description:O(),createdBy:L({id:j(),name:O()}),createdAt:H()}),_d=gd.extend({name:O(),downloadUrl:O(),contentChanged:P()});z(`type`,[dd,hd,L({type:V(`skill`),id:j(),name:O(),description:O(),currentVersion:gd,downloadUrl:O(),previousVersion:_d.optional(),changeSummary:O().nullable().optional()})]);const vd=[`private`,`review`,`live`,`rejected`],yd=L({private:N().int().nonnegative(),review:N().int().nonnegative(),live:N().int().nonnegative(),rejected:N().int().nonnegative()}),bd=L({id:j(),versionNumber:N().int().positive()});function xd(e){let t=e;for(;typeof t==`string`;)try{let e=JSON.parse(t);if(e===t)break;t=e}catch{break}return t}const Sd=e=>fc(xd,R([e,O()])),Cd=e=>fc(xd,e),wd=L({name:O().describe(`Identifier: file path, resource id, URL, or title.`),detail:O().describe(`What it is plus what was done to it or why it matters — detailed enough to act on again.`)});L({overview:O().describe(`1–3 sentences: what this session is about and where it stands now.`),userRequests:Sd(I(O())).describe(`Every distinct thing the user has asked for, in their own framing, oldest → newest. Never drop an ask — even a completed one (record completion in state). Merge near-duplicate or sub-divided asks into a single entry so this list stays bounded across repeated compactions.`),keyFacts:Sd(I(O())).describe(`Durable facts, decisions made, concepts/constraints discovered, and errors with their fixes. Omit facts later turns made obsolete.`),artifacts:Sd(I(wd)).optional().default([]).describe(`Concrete things touched that may need further action: files, resources, documents, datasets, URLs, IDs.`),constraints:Sd(L({preferences:I(O()).describe(`How the user wants output: format, tone, language, style.`),negativeConstraints:I(O()).describe(`What the user explicitly said NOT to do.`)})).describe(`What the user wants and explicitly does not want.`),state:Sd(L({status:B([`pending_input`,`in_progress`,`completed`]).describe(`Overall task state at the point of truncation.`),currentWork:O().describe(`What was actively in progress at truncation, detailed enough to resume immediately.`),nextStep:O().describe(`The single most logical next action. Empty only if genuinely blocked or awaiting the user.`),pendingQuestions:I(O()).describe(`Questions the agent still needs answered to proceed.`)})).describe(`Resumption state — how to pick the work back up seamlessly.`)});const Td=1500,Ed=2e3;function Dd(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function Od(e){return[...new Set(e)].slice(0,12)}function kd(e){let t=new Set;return e.filter(e=>{let n=JSON.stringify([e.value,e.context]);return t.has(n)?!1:(t.add(n),!0)}).slice(0,12)}const Ad=I(O().overwrite(e=>Dd(e,500)).max(500)).overwrite(Od).max(12),jd=I(L({value:O().overwrite(e=>Dd(e,Ed)).max(Ed).describe(`Exact identifier, path, URL, value, resource id, or title.`),context:O().overwrite(e=>Dd(e,500)).max(500).describe(`Why this reference still matters for the continuation.`)})).overwrite(kd).max(12);L({version:N().min(2).max(2).transform(()=>2),overview:O().overwrite(e=>Dd(e,Td)).max(Td).describe(`A concise orientation to the current conversation and active objective.`),userRequests:Cd(Ad).describe(`Active or still-relevant user requests. Merge repetitions and omit superseded requests whose effects are preserved elsewhere.`),keyFacts:Cd(Ad).describe(`Facts and observations whose loss would change later reasoning. Preserve uncertainty and exact values.`),decisions:Cd(Ad).describe(`Still-relevant accepted, rejected, superseded, or abandoned decisions with enough rationale to apply them consistently and avoid repeating discarded approaches.`),reportedProgress:Cd(Ad).describe(`Relevant work, observations, and outcomes reported in the conversation. Preserve who or what reported uncertain claims; narration is not runtime-verified progress.`),references:Cd(jd).describe(`Exact identifiers and artifacts that remain necessary for continuation.`),constraints:Cd(Ad).describe(`Still-governing requirements, preferences, and prohibitions.`),currentFocus:O().overwrite(e=>Dd(e,Td)).max(Td).describe(`The current conversational focus, not a lifecycle state.`),openQuestions:Cd(Ad).describe(`Unresolved questions, dependencies, or user decisions that still matter.`),continuationHint:O().overwrite(e=>Dd(e,Td)).max(Td).describe(`Advisory conversational guidance only. It never grants permission or defines an executable runtime transition.`)});const Md=L({key:O(),value:O()});L({summary:O(),sessionMeta:Sd(L({currentIntent:O()})),knowledgeBase:Sd(L({entities:I(Md),factsEstablished:I(O())})),userConstraints:Sd(L({formatPreferences:O(),toneStyle:O(),negativeConstraints:I(O())})),workflowStatus:Sd(L({lastAction:O(),pendingQuestions:I(O())}))});const Nd=B([`pending`,`ready`,`failed`]),Pd=2e3,Fd=L({id:j(),projectId:j(),fileId:j(),name:O(),mimeType:O(),size:N().int().nonnegative(),url:O().nullable(),description:O().nullable(),addedBy:j(),createdAt:H(),updatedAt:H()}),Id=L({id:j(),projectId:j(),url:O(),title:O().nullable(),status:Nd,description:O().nullable(),fetchError:O().nullable(),lastFetchedAt:H().nullable(),addedBy:j(),createdAt:H(),updatedAt:H()}),Ld=O().max(Pd),Rd=L({description:Ld.optional()});Rd.extend({fileId:j()}),Rd.extend({url:du});const zd=L({description:Ld});L({files:I(Fd)}),L({links:I(Id)});const Bd=1e5;L({content:O().trim().min(1).max(Bd),title:O().trim().min(1).max(100).optional()}),L({taskId:j(),projectId:j()});const Vd=B([`task`,`file`,`link`]);L({q:O().trim().min(1).max(200),type:R([Vd,I(Vd).min(1)]).optional().transform(e=>{if(e!==void 0)return[...new Set(Array.isArray(e)?e:[e])]}),limit:U().int().min(1).max(20).default(10)}),L({results:I(z(`type`,[L({type:V(`task`),taskId:j(),title:O(),updatedAt:H(),snippet:O().optional()}),L({type:V(`file`),sourceId:j(),title:O(),description:O().optional(),snippet:O().optional()}),L({type:V(`link`),sourceId:j(),title:O(),description:O().optional(),snippet:O().optional()})]))}),L({depth:B([`summary`,`full`]).default(`summary`),offset:U().int().min(0).optional()}),z(`status`,[L({status:V(`text`),sourceType:Vd,sourceId:j(),title:O(),content:O(),truncated:P(),nextOffset:N().int().nonnegative().optional()}),L({status:V(`download`),sourceType:B([`file`,`link`]),sourceId:j(),title:O(),downloadUrl:M()}),L({status:V(`pending`),sourceType:V(`link`),sourceId:j(),title:O()}),L({status:V(`failed`),sourceType:V(`link`),sourceId:j(),title:O(),error:O()})]);const Hd=2e3,Ud=1e4,Wd=B([`owner`,`member`]),Gd=L({id:j(),workspaceId:j(),name:O(),description:O().nullable(),instruction:O().nullable(),createdAt:H(),updatedAt:H()}),Kd=L({userId:j(),role:Wd,name:O(),email:A(),image:O().nullable().optional()}),qd=O().max(Ud,`Instruction is too long: the maximum is ${Ud} characters.`);L({name:O().trim().min(1).max(255),description:O().max(Hd).nullable().optional(),instruction:qd.nullable().optional()}).partial();const Jd=L({userId:j(),name:O(),email:A(),image:O().nullable()}),Yd=Gd.extend({role:Wd,creator:Jd.nullable(),isShared:P(),hasOtherMembers:P()}),Xd=B([`all`,`mine`,`shared`]),Zd=B([`lastActivityAt`,`createdAt`]);L({limit:U().int().min(1).max(100).default(50),nextKey:O().optional(),filter:Xd.default(`all`),search:O().trim().max(200).optional(),sortBy:Zd.default(`lastActivityAt`),order:B(gl).default(`desc`)}),L({projects:I(Yd),nextKey:O().optional()}),Gd.extend({role:Wd,creator:Jd.nullable(),isShared:P(),members:I(Kd),taskCount:N().int().nonnegative(),sourceCount:N().int().nonnegative(),assetCount:N().int().nonnegative(),assetVersionCount:N().int().nonnegative()}),L({userId:j()}),L({role:Wd});const Qd=j().optional().describe(`The project the caller last saw the task in. Compared against the current project under the task row lock; a mismatch answers 409 task_project_mismatch and writes nothing. Omitted, the write is unconditional.`);L({projectId:j().nullable(),confirmAssetSharing:P().optional(),expectedProjectId:Qd}),L({taskId:j(),projectId:j().nullable()}),L({expectedProjectId:Qd});const $d=L({id:j(),name:O()}),ef=[`personal`,`managed`],tf=`always_allow`,nf={ALWAYS_ASK:`always_ask`,AUTO:`auto`,ALWAYS_ALLOW:`always_allow`},rf=B(nf);rf.exclude([`ALWAYS_ASK`]);const af={BY_USER:`The user denied this tool call, so it did not run.`,UNATTENDED:`This tool call needs human approval and this run has no one to ask, so it did not run.`,ASSESSMENT:`The risk assessment said:`,INSTRUCTION:`Do not call it again unless the user explicitly asks you to, and do not reach the same result through another tool or route. Continue with the parts of the task that do not depend on it. In your reply, say which call was refused and what you left out; if the task cannot be completed without it, stop and ask the user how to proceed.`,TURN_REMINDER:`These calls were refused in the turn you are answering. Name each of them in your reply and say what you could not do without it. Do not present earlier results, background knowledge, or a guess as if the refused call had returned them, and do not reach the same result through another tool or route. If what the user asked for cannot be finished without these calls, say so and ask how to proceed instead of answering around them.`},of={ASK:`ask`,DENY:`deny`,BYPASS:`bypass`},sf=B(of);nf.ALWAYS_ALLOW,nf.AUTO,nf.ALWAYS_ASK,of.BYPASS,of.ASK,of.DENY,B([`allow_all`,`auto_ask`,`auto_deny`]);const cf=[{id:`allow_all`,toolApprovalMode:nf.ALWAYS_ALLOW,approvalHandling:of.BYPASS},{id:`auto_ask`,toolApprovalMode:nf.AUTO,approvalHandling:of.ASK},{id:`auto_deny`,toolApprovalMode:nf.AUTO,approvalHandling:of.DENY}];function lf(e,t){return cf.find(n=>n.toolApprovalMode===e&&n.approvalHandling===t)?.id}const uf={always_ask:`Always Ask`,auto:`Auto`,always_allow:`Always Allow`},df={always_ask:`Ask before every tool runs`,auto:`Ask only before high-risk tools; approve the rest automatically`,always_allow:`Run every tool without asking for approval`},ff=new Set(Object.values({WORKSPACE_POLICY:`workspace_policy_need_approval`,TASK_POLICY:`task_policy_need_approval`,USER_POLICY:`user_policy_need_approval`,ALWAYS_ASK_MODE:`always_ask_mode`,REQUIRES_USER_INTERACTION:`tool_requires_user_interaction`,HIGH_SENSITIVITY:`high_sensitivity`,MUTATING_TOOL:`mutating_tool`,NO_SIGNALS:`no_signals`,ASSESSMENT_HIGH_RISK:`assessment_high_risk`,ASSESSMENT_FAILED:`assessment_failed`,POLICY_LOOKUP_FAILED:`policy_lookup_failed`,INNER_TOOL_NOT_FOUND:`inner_tool_not_found`,INPUT_MISSING_TOOL_NAME:`input_missing_tool_name`,INNER_RESOLUTION_FAILED:`inner_resolution_failed`}));function pf(e){return ff.has(e)}function mf(e){let[t,...n]=e?.split(`
|
|
57
|
-
`)??[],r=n.join(`
|
|
58
|
-
`).trim();return{reason:t!==void 0&&pf(t)?t:`generic`,detail:r||void 0}}function hf(e){return mf(e).reason}const gf=`This tool's policy could not be resolved, so it needs your approval.`,_f={workspace_policy_need_approval:`Your workspace requires approval before this tool runs.`,task_policy_need_approval:`This task is set to ask before this tool runs.`,user_policy_need_approval:`You chose to be asked before this tool runs.`,always_ask_mode:`Your approval mode asks before every tool.`,tool_requires_user_interaction:`This tool needs your input to continue.`,high_sensitivity:`This tool is marked high risk.`,mutating_tool:`This tool can change data.`,no_signals:`This tool has not declared what it changes.`,assessment_high_risk:`This call was assessed as high risk.`,assessment_failed:`The risk check was unavailable, so it needs your approval.`,policy_lookup_failed:gf,inner_tool_not_found:gf,input_missing_tool_name:gf,inner_resolution_failed:gf,generic:`This tool needs your approval before it runs.`};function vf(e){return _f[hf(e)]}const yf={ALWAYS_ALLOW:`always_allow`,NEED_APPROVAL:`need_approval`,BLOCK:`block`},bf=B([yf.ALWAYS_ALLOW,yf.NEED_APPROVAL,yf.BLOCK]),xf=L({toolName:O().trim().min(1).max(200),policy:bf});I(xf).refine(e=>{let t=e.map(e=>e.toolName);return new Set(t).size===t.length},{message:`Duplicate toolName in toolPolicies`});const Sf={[yf.ALWAYS_ALLOW]:0,[yf.NEED_APPROVAL]:1,[yf.BLOCK]:2};function Cf(...e){let t=new Map;for(let n of e)for(let{toolName:e,policy:r}of n??[]){let n=t.get(e);(n===void 0||Sf[r]>Sf[n])&&t.set(e,r)}return t}const wf=L({hour:N().int().min(0).max(23),minute:N().int().min(0).max(59)}).describe(`Wall-clock local time in the schedule's own utcOffset timezone (NOT UTC). E.g. { "hour": 9, "minute": 0 } means 9:00 AM in that timezone, regardless of what utcOffset is — do not convert a user-stated local time to UTC before setting this field.`),Tf=O().trim().min(1).max(2e3),Ef=L({enabled:P().optional(),criteria:Tf.optional(),extracted:L({outcomes:I(Tf).min(1).max(20),extractedAt:H(),inputFingerprint:O().regex(/^[a-f0-9]{64}$/u).optional(),extractorVersion:N().int().positive().optional()}).optional()});L({completed:V(!1),reason:Tf,unmet:I(Tf).max(20),criteriaSource:B([`inferred`,`explicit`,`extracted`]),analysis:O().trim().min(1).max(1e3).optional(),escalated:P().optional(),reviewSkipped:P().optional()});const Df=e=>e.hour*60+e.minute,Of=I(L({start:wf,end:wf}).refine(e=>Df(e.end)>Df(e.start),{message:`Run window end must be after start (no cross-midnight)`,path:[`end`]})).min(1).max(5),kf=I(wf).min(1).max(5).refine(e=>new Set(e.map(e=>e.hour*60+e.minute)).size===e.length,{message:`Trigger times must not contain duplicates`}).optional(),Af=I(N().int().min(0).max(6)).min(1);z(`type`,[L({type:V(`no-repeat`)}),L({type:V(`repeat`),interval:z(`unit`,[L({unit:V(`minutes`),every:N().int().min(15,`Minimum interval is 15 minutes`).max(1440,`Maximum interval is 1440 minutes (24 hours)`),dailyWindows:Of.optional(),daysOfWeek:Af.optional()}),L({unit:V(`hours`),every:N().int().min(1),minute:N().int().min(0).max(59),dailyWindows:Of.optional(),daysOfWeek:Af.optional()}),L({unit:V(`days`),every:N().int().min(1),time:wf,times:kf,daysOfWeek:Af.optional()}),L({unit:V(`weeks`),every:N().int().min(1),daysOfWeek:I(N().int().min(0).max(6)).min(1),time:wf}),L({unit:V(`months`),every:N().int().min(1),daysOfMonth:I(N().int().min(1).max(31)),lastDayOfMonth:P(),time:wf})])})]).superRefine((e,t)=>{if(e.type!==`repeat`)return;let n=e.interval;if(n.unit===`months`&&n.daysOfMonth.length===0&&!n.lastDayOfMonth&&t.addIssue({code:`custom`,message:`lastDayOfMonth must be true when daysOfMonth is empty`,path:[`interval`,`daysOfMonth`]}),n.unit===`hours`&&n.every>=24&&(n.daysOfWeek?.length??0)>0&&t.addIssue({code:`custom`,message:`Weekday filter is not available for hourly intervals of 24 hours or more`,path:[`interval`,`daysOfWeek`]}),n.unit===`days`&&n.every%7==0&&(n.daysOfWeek?.length??0)>0&&t.addIssue({code:`custom`,message:`Weekday filter is not supported for day intervals that are a multiple of 7 (the weekday never changes); use the weeks unit instead`,path:[`interval`,`daysOfWeek`]}),n.unit===`hours`&&n.every>=24&&(n.dailyWindows?.length??0)>0&&t.addIssue({code:`custom`,message:`Active windows are not available for hourly intervals of 24 hours or more`,path:[`interval`,`dailyWindows`]}),n.unit!==`minutes`&&n.unit!==`hours`||n.unit===`hours`&&n.every>=24)return;let r=n.dailyWindows;if(!r)return;let i=n.unit===`minutes`?n.every:n.every*60;r.some(e=>Df(e.end)-Df(e.start)<i)&&t.addIssue({code:`custom`,message:`Each run window must be at least as long as the interval`,path:[`interval`,`dailyWindows`]});let a=[...r].toSorted((e,t)=>Df(e.start)-Df(t.start));for(let e=1;e<a.length;e++){let n=a[e],r=a[e-1];if(n&&r&&Df(n.start)<Df(r.end)){t.addIssue({code:`custom`,message:`Run windows must not overlap`,path:[`interval`,`dailyWindows`]});break}}});const jf=L({id:j(),name:O(),kind:B(ef).optional(),iconUrl:O().optional(),deletedAt:H().optional(),specifiedVersion:bd.nullable().optional(),updatableToVersion:bd.nullable().optional()});j().nullable().optional();const Mf=L({id:O(),name:O()}),Nf=L({id:j(),title:O(),read:P(),deletedAt:H().nullable()}),Pf=L({id:j(),name:O(),isWorkspaceMember:P()}),Ff=L({id:j(),name:O(),prompt:O(),user:Pf.optional(),agent:jf.optional(),model:Mf.optional(),startsAt:H(),isActive:P(),unreadTasks:N().int(),nextRunAt:H().nullable(),utcOffset:O(),config:cc().meta({type:`object`}),judge:Ef.nullish(),toolApprovalMode:rf.nullish(),approvalHandling:sf.nullish(),holidayCalendarIds:I(j()).nullish(),recentTasks:I(Nf).optional(),createdAt:H(),updatedAt:H()});Ff.extend({toolPolicies:I(xf)}),L({schedules:I(Ff),nextKey:O().optional()}),ml.extend({search:O().trim().max(200).optional(),sortBy:B([`nextRunAt`,`name`]).optional(),isActive:dc().optional(),agentId:j().optional()});const If=B([`queued`,`running`,`completed`,`failed`,`skipped`]),Lf=L({type:O().optional().transform(e=>e===`runtime`||e===`judge`?e:void 0),message:O(),code:O().optional()}),Rf=L({id:j(),name:O()}),zf=B([`approval`]);L({runs:I(L({id:j(),scheduledAt:H(),agent:jf.optional(),model:Mf.optional(),task:Nf.nullable(),error:Lf.nullish(),status:If.optional(),skipReason:O().nullish(),resolvedAt:H().nullish(),resolvedBy:Rf.nullish(),waitingReason:zf.nullish()})),nextKey:O().optional()}),L({resolvedAt:H(),resolvedBy:Rf.nullable()});const Y={SELF:`self`,WORKSPACE:`workspace`,PUBLIC:`public`},Bf=B([Y.SELF,Y.WORKSPACE,Y.PUBLIC]);Y.SELF,Y.WORKSPACE,Y.PUBLIC;const Vf=B([Y.PUBLIC,Y.WORKSPACE,`none`]);Y.PUBLIC,Y.WORKSPACE;const Hf=N().int().positive().optional(),Uf=j().nullable(),Wf=L({id:j(),name:O(),mimeType:O(),size:N(),url:M()}),Gf=z(`type`,[L({id:j(),type:V(`file`),workingCopyAvailable:P().optional(),hasUnsavedWork:P().optional(),baseVersionNumber:N().int().positive().optional(),projectId:Uf,file:Wf,versionNumber:Hf,createdAt:H(),updatedAt:H()}),L({id:j(),type:V(`website`),projectId:Uf,url:M(),sandboxId:O().nullable(),title:O().optional(),visibility:Bf.default(Y.SELF),source:Wf.optional(),hasUnsavedWork:P().optional(),baseVersionNumber:N().int().positive().optional(),versionNumber:Hf,createdAt:H(),updatedAt:H()}),L({id:j(),type:V(`deck`),projectId:Uf,title:O(),pdf:Wf,pptx:Wf.optional(),hasUnsavedWork:P().optional(),baseVersionNumber:N().int().positive().optional(),versionNumber:Hf,createdAt:H(),updatedAt:H()})]);L({data:I(Gf),nextKey:O().optional()}),L({data:Gf}),L({data:L({webViewLink:M()})}),L({visibility:Bf});const Kf=L({id:j(),versionNumber:N().int().positive(),title:O().nullable(),summary:O().nullable(),editor:L({id:j(),name:O(),email:A(),image:O().nullable()}),createdAt:H(),sourceTask:R([L({visible:V(!0),id:j(),title:O().nullable()}),L({visible:V(!1)})]).nullable(),revertedFrom:N().int().positive().nullable()});L({data:L({headVersionId:j(),canRevert:P(),versions:I(Kf)})}),L({summary:O().trim().min(1).max(500).optional()}),L({data:z(`status`,[L({status:V(`saved`),versionId:j(),versionNumber:N().int().positive()}),L({status:V(`unchanged`),versionNumber:N().int().positive()})])});const qf=L({id:j(),name:O()});L({assetProjectId:j().nullable(),assetName:O(),assetHasPreviewableVersions:P(),currentVersionNumber:N().int().positive(),currentVersionSavedAt:H(),currentVersionEditor:qf,baseVersionNumber:N().int().positive()}).extend({assetId:j()}),L({expectedHeadVersionId:j()}),L({data:L({versionId:j(),versionNumber:N().int().positive(),revertedFrom:N().int().positive()})});const Jf=B([Y.SELF,`project`,Y.WORKSPACE,Y.PUBLIC]);Y.SELF,Y.WORKSPACE,Y.PUBLIC,L({shareId:j(),assetId:j()}),L({data:Gf}),L({visibility:Jf,expectedProjectId:Qd}),L({id:j(),visibility:Jf,createdAt:H(),updatedAt:H()});const Yf=L({userId:j(),name:O(),email:A(),image:O().nullable().optional(),grantedAt:H()});L({data:I(Yf)}),L({data:Yf}),B([`running`,`completed`,`failed`]);const Xf=L({id:j(),name:O(),iconId:j().optional(),iconUrl:O().optional(),deletedAt:H().optional(),specifiedVersion:bd.nullable().optional()}),Zf=[`chat`,`chatbot`,`schedule`,`agent_api`],Qf=B(Zf);L({tasks:I(L({editAssetId:j().optional(),id:j(),title:O(),read:P(),toolApprovalMode:rf.optional(),userId:j(),workspaceId:j(),source:Qf,waitingReason:V(`approval`).optional(),share:L({id:j(),visibility:Jf}).optional(),isSharedWithOthers:P().optional(),isOwn:P().optional(),agent:Xf.optional(),schedule:L({id:j(),name:O()}).optional(),scheduleRun:L({runId:j(),status:If,error:Lf.nullish(),resolvedAt:H().nullable(),resolvedBy:Rf.nullish(),canResolve:P()}).optional(),project:$d.nullable().optional(),containsSensitiveContent:P().optional(),createdAt:H(),updatedAt:H()})),nextKey:O().optional()}),L({id:j(),title:O(),visibility:Jf,workspace:L({id:j()}),agent:Xf.optional(),project:$d.optional(),createdAt:H()}),L({results:I(L({id:j(),title:O(),titleHighlight:O().nullable(),contentSnippet:O().nullable(),project:$d.nullable().optional(),createdAt:H(),updatedAt:H()})),nextKey:O().optional()});const $f=[`enabled`,`disabled`];L({userId:j()}),L({status:B($f)}),L({monthlyCapUsd:N().positive().nullable()}),L({items:I(L({connectorId:j(),name:O(),authorizedBy:L({id:j(),name:O(),disabled:P()}),updatedAt:H()}))});const ep=Zf,tp=[`completed`,`failed`,`running`];ml.extend({limit:U().int().min(1).max(100).default(30),source:B(ep).optional(),status:B(tp).optional(),initiatorId:j().optional(),from:W.optional(),to:W.optional(),q:O().trim().max(200).optional()}).refine(e=>e.from===void 0||e.to===void 0||new Date(e.from)<=new Date(e.to),{message:`to must be greater than or equal to from`,path:[`to`]}),L({items:I(L({taskId:j(),title:O(),source:B(ep),initiator:L({userId:j().nullable(),name:O(),unlinked:P()}).nullable(),status:B(tp),actionCount:N().int(),cost:N(),createdAt:H()})),nextKey:O().nullable()});const np=L({conversationCount:N().int(),actionCount:N().int(),cost:N(),errorRate:N()});L({today:np,week:np,monthCost:N(),monthlyCapUsd:N().nullable()}),L({items:I(L({id:j(),name:O(),missingConnectorNames:I(O()),disabled:P()})),nextKey:O().nullable()});const rp={[J.SANDBOX]:`Sandbox`,[J.MULTITASKING]:`Multitasking`,[J.HISTORY]:`History`,[J.CREATION]:`Content Creation`,[J.PROJECT]:`Project Knowledge`,[J.WEB_SEARCH]:`Web Search`,[J.SCHEDULE]:`Schedules`,[J.AGENTS_AND_SKILLS]:`Agents & Skills`,[J.AUDIT_LOG]:`Audit Logs`};function ip(e){return rp[e]??e}L({id:j(),versionNumber:N().int().positive()}).nullable(),L({iconId:j(),url:M()});const ap=[`updatedAt`,`usedAt`,`name`];L({search:O().trim().max(200).optional(),nextKey:O().optional(),limit:U().int().min(1).max(100).default(20),sortBy:B(ap).optional()});const op=L({id:j(),name:O(),isMe:P()}),sp=L({id:j()}).nullable();L({agents:I(L({id:j(),name:O(),description:O(),kind:B(ef),managedStatus:B($f).optional(),provider:O(),author:op,iconUrl:O().optional(),publish:sp,myRole:rd,createdAt:H(),updatedAt:H()})),nextKey:O().optional()}),L({search:O().trim().max(200).optional(),status:B(vd).optional(),nextKey:O().optional(),limit:U().int().min(1).max(100).default(20),sortBy:B(ap).optional()}),L({agents:I(L({id:j(),name:O(),description:O(),kind:B(ef),managedStatus:B($f).optional(),iconUrl:O().optional(),hasUnpublishedChanges:P(),latestVersionNumber:N().int().nullable(),publishedTo:ld.optional(),myRole:rd,createdAt:H(),updatedAt:H()})),nextKey:O().optional(),totalCount:N().int().nonnegative(),statusCounts:yd}),L({id:j(),name:O(),deletedAt:H().optional()});const cp=L({id:O(),name:O(),available:P()}),lp=L({id:j(),name:O(),hasPermission:P(),added:P()}),up=L({name:O(),isMe:P()}),dp=L({sponsor:L({id:j(),name:O(),image:O().nullable().optional()}),monthlyCapUsd:N().nullable(),skills:I(L({id:j(),name:O()})),delegatableAgents:I(L({id:j(),name:O()})),apiRateLimit:N().int().nullable()});L({id:j(),name:O(),description:O(),kind:B(ef),managedStatus:B($f).optional(),managed:dp.optional(),model:cp.optional(),systemPrompt:O().optional(),conversationStarters:I(O()),connectors:I(lp).optional(),capabilities:gu.optional(),provider:O(),author:up,iconId:j().optional(),iconUrl:O().optional(),versionNumber:N().int().nullable(),selectableVersions:I(bd).optional(),latestVersionNumber:N().int().nullable().optional(),publishedTo:ld.optional(),myRole:rd,createdAt:H(),updatedAt:H()}),L({agents:I(L({id:j(),name:O(),description:O(),iconUrl:O().optional(),versionNumber:N().int().nullable(),createdAt:H(),updatedAt:H()}))}),L({agents:I(L({id:j(),name:O(),description:O(),kind:B(ef),managedStatus:B($f).optional(),conversationStarters:I(O()),provider:O().nullable(),author:up,publishedTo:ld.optional(),team:L({id:j(),name:O()}).optional(),iconUrl:O().optional(),versionNumber:N().int().nullable(),myRole:rd,createdAt:H(),updatedAt:H()})),nextKey:O().optional()});const fp=B([`true`,`false`]).transform(e=>e===`true`);ml.extend({createdBy:B([`workspace`,`team`,`me`]).optional(),teamId:j().optional(),search:O().trim().max(200).optional(),executableOnly:fp.optional(),sortBy:B(ap).optional()}).refine(e=>!e.teamId||e.createdBy===`team`,{message:`teamId can only be used with createdBy: team`,path:[`teamId`]}),L({workspaceId:j(),agentId:j()}),L({limit:U().int().min(1).max(100).default(20),offset:U().int().nonnegative().default(0)});const pp=L({taskId:j(),title:O(),source:Qf,amountUsd:N().nonnegative().nullable(),amountCredits:N().nonnegative().nullable(),usageCount:N().int().nonnegative(),lastUsageAt:H(),createdAt:H(),updatedAt:H()}),mp=L({toolName:O(),input:O().optional(),output:O().optional()}),hp=L({role:B([`user`,`assistant`]),texts:I(O()),toolCalls:I(mp).optional()}),gp=L({taskId:j(),title:O(),amountUsd:N().nonnegative().nullable(),amountCredits:N().nonnegative().nullable(),promptTexts:I(O()),messages:I(hp).optional()});L({agentName:O().optional(),totalAmountUsd:N().nonnegative().nullable(),totalAmountCredits:N().nonnegative().nullable(),runCount:N().int().nonnegative(),total:N().int().nonnegative(),runs:I(pp),promptSamples:I(gp).optional(),promptSamplesTruncated:P().optional()});const _p=L({agentId:j(),agentName:O(),amountUsd:N().nonnegative().nullable(),amountCredits:N().nonnegative().nullable(),runCount:N().int().nonnegative(),usageCount:N().int().nonnegative(),lastUsageAt:H()});L({periodDays:N().int().positive(),since:H(),totalAmountUsd:N().nonnegative().nullable(),totalAmountCredits:N().nonnegative().nullable(),totalAgents:N().int().nonnegative(),agents:I(_p)});const vp=L({p50AmountUsdPerRun:N().nonnegative().nullable(),p50AmountCreditsPerRun:N().nonnegative().nullable(),percentile:N().min(0).max(100).nullable(),workspaceAgentCount:N().int().nonnegative()}),yp=L({avgInputTokensPerRun:N().nonnegative(),avgOutputTokensPerRun:N().nonnegative(),avgCachedInputTokensPerRun:N().nonnegative(),avgTotalTokensPerRun:N().nonnegative(),inputToOutputRatio:N().nonnegative(),cachedInputRatio:N().min(0).max(1),avgLlmCallsPerRun:N().nonnegative()}),bp=L({usageType:O(),amountUsd:N().nonnegative().nullable(),amountCredits:N().nonnegative().nullable()});L({agentId:j(),agentName:O(),modelId:O(),periodDays:N().int().positive(),since:H(),runCount:N().int().nonnegative(),totalAmountUsd:N().nonnegative().nullable(),totalAmountCredits:N().nonnegative().nullable(),avgAmountUsdPerRun:N().nonnegative().nullable(),avgAmountCreditsPerRun:N().nonnegative().nullable(),scheduleRunCount:N().int().nonnegative(),manualRunCount:N().int().nonnegative(),runsPerDay:N().nonnegative(),benchmark:vp,tokenProfile:yp.nullable(),costByType:I(bp),llmCostRatio:N().min(0).max(1).nullable(),highCostPerRun:P(),highFrequency:P(),systemPrompt:O(),systemPromptLength:N().int().nonnegative()}),L({capabilities:I(B(hu)),workspaceCapabilities:I(B(mu))});const xp={invalidInput:`invalid_input`,staleRef:`stale_ref`,noMatch:`no_match`,ambiguousLocator:`ambiguous_locator`,resolutionFailed:`resolution_failed`,permissionDenied:`permission_denied`,userCancelled:`user_cancelled`,navigationFailed:`navigation_failed`,timeout:`timeout`,sensitiveContext:`sensitive_context`,backendFailure:`backend_failure`};xp.permissionDenied,xp.userCancelled,xp.sensitiveContext;const Sp={DIRECT:`direct`,HINTED:`hinted`};Sp.DIRECT,Sp.HINTED,new TextEncoder;function Cp(e,t){return e.map(e=>({...e,disclosureMode:e.disclosureMode??t}))}const wp=[`single_select`,`multi_select`],Tp=L({label:O().min(1).max(200).describe(`Display text for this option`),description:O().max(500).optional().describe(`Optional explanation of what this option means`)});L({questions:I(L({question:O().min(1).max(500).describe(`The question to ask the user`),type:B(wp).describe(`single_select: user picks one option. multi_select: user picks one or more options.`),options:I(Tp).min(2).max(4).describe(`The available choices (2-4 options)`)})).min(1).max(3).describe(`One to three structured questions to ask the user`)}),L({answers:I(L({questionIndex:N().int().min(0).describe(`Index of the question answered`),type:B(wp).describe(`Question type`),selectedOptions:I(O()).describe(`Labels of selected options (empty if skipped)`),customText:O().optional().describe(`Free text if user chose "Something else"`),skipped:P().describe(`Whether the user skipped this question`)})).describe(`Answers for each question`),dismissed:P().describe(`True if the user dismissed the entire wizard without answering`)});const Ep=B([`all`,`agent`,`general-task`,`connector`,`skill`,`system`]),Dp=B([`workspace_owner`,`agent_owner`]),Op=B([`success`,`failure`]),kp=B([`personal`,`managed`]),Ap=B([`manual`,`scheduled`]);L({workspaceId:j()}),L({...L({category:Ep.optional(),targetId:O().trim().min(1).optional(),agentType:kp.optional(),executionSource:Ap.optional(),result:Op.optional(),actorId:j().optional(),search:O().trim().max(200).optional()}).shape,category:Ep.optional().default(`all`),snapshot:O().min(1).max(2048).optional(),beforeOccurredAt:W.optional(),beforeId:O().min(1).optional(),limit:U().int().min(1).max(100).default(50),offset:U().int().min(0).default(0)}).refine(e=>!!e.beforeOccurredAt==!!e.beforeId,{message:`beforeOccurredAt and beforeId must be provided together`,path:[`beforeOccurredAt`]});const jp=L({id:j(),name:O(),email:O()}),Mp=L({type:O(),id:O(),name:O(),agentId:j().optional()}),Np=z(`type`,[L({type:V(`role`),from:O().optional(),to:O()})]),Pp=L({type:B([`user`,`team`,`email`]),id:O().optional(),name:O(),email:O().optional(),role:O().optional()}),Fp=L({id:O(),occurredAt:H(),actor:jp.nullable(),event:O(),category:Ep.exclude([`all`]),result:Op,resource:Mp,change:Np.optional(),subject:Pp.optional(),changedFields:I(O()).optional(),detail:O().optional(),taskUrl:O().optional()}),Ip=L({id:O(),name:O(),category:Ep.exclude([`all`])}),Lp=L({all:N().int().nonnegative(),agent:N().int().nonnegative(),"general-task":N().int().nonnegative(),connector:N().int().nonnegative(),skill:N().int().nonnegative(),system:N().int().nonnegative()});L({items:I(Fp),asOf:H(),snapshot:O().min(1),total:N().int().nonnegative(),scope:Dp,counts:Lp,targets:I(Ip),actors:I(jp),retentionDays:N().int().positive()}),L({items:I(Fp),asOf:H(),maxRows:N().int().positive()}),L({canAccess:P(),scope:Dp.nullable()});const Rp=B([`chat`,`image`]),zp=O().refine(e=>{if(e===``)return!1;let t=e.replace(/_/g,``),n=Number(t);return!Number.isNaN(n)&&Number.isFinite(n)&&n>=0},{message:`Invalid decimal string`}),Bp=L({input:O(),output:O(),cachedInput:O().optional(),cacheCreation:O().optional()}),Vp=L({input:zp,output:zp,cachedInput:zp.optional(),cacheCreation:zp.optional()}),Hp=L({effort:B(Tu)}),Up=L({modelId:O(),deploymentName:O(),workspaceId:O().nullable(),kind:Rp,name:O(),description:O(),pricing:Bp,reasoning:Hp.nullable(),createdAt:H(),updatedAt:H()});L({deployments:I(Up),nextKey:O().optional()}),L({deploymentName:O().min(1),name:O().min(1),description:O().default(``),pricing:Vp,reasoning:Hp.nullable().default(null)}),L({name:O().min(1).optional(),description:O().optional(),pricing:Vp.optional(),reasoning:Hp.nullable().optional()}),L({deploymentName:O().min(1),kind:Rp,name:O().min(1),description:O().default(``),pricing:Vp,reasoning:Hp.nullable().default(null)}),L({name:O().min(1).optional(),description:O().optional(),kind:Rp.optional(),pricing:Vp.optional(),reasoning:Hp.nullable().optional()}),L({deploymentName:O().min(1)}),L({deployments:I(Up)}),L({workspaceId:j()}),L({amountUsd:N().positive().max(1e4)}),L({checkoutUrl:M()}),L({id:j(),workspaceId:j(),amountUsd:O(),purchasedBy:j().nullable(),stripeCheckoutSessionId:O(),stripePaymentIntentId:O().nullable(),isAutoReload:P(),createdAt:H()}),L({workspaceId:j()}),L({checkoutUrl:M()}),B([`incomplete`,`incomplete_expired`,`trialing`,`active`,`past_due`,`canceled`,`unpaid`,`paused`]);const Wp=B([`draft`,`open`,`paid`,`uncollectible`,`void`]);B([`upgrade`,`downgrade`,`invite_accept`,`member_join`]),B([`pending`,`processing`,`processed`,`failed`]),B([`seat_change`,`extra_usage_purchase`]),B([`pending`,`processing`,`requires_action`,`succeeded`,`failed`,`expired`,`superseded`]),B([`pending`,`applied`,`failed`,`canceled`]);const Gp=B([`subscription`,`extra_usage`]),Kp=L({id:j(),type:Gp,status:Wp,totalUsd:N().nonnegative(),billingDate:H(),hostedInvoiceUrl:M().nullable()});L({workspaceId:j()}),L({limit:U().int().min(1).max(100).default(20),nextKey:O().optional()}),L({invoices:I(Kp),nextKey:O().optional()});const qp=B([`pro`,`premium`]),Jp=L({pro:N().int().nonnegative(),premium:N().int().nonnegative()});L({pro:N().int(),premium:N().int()});const Yp=L({lineItems:I(L({seatType:qp,quantity:N().int(),amountUsd:O()})),subtotalUsd:O(),taxUsd:O(),totalUsd:O()}),Xp=B([`seat_pool_invariant`,`subscription_canceling`,`payment_required`,`unsupported_billing_state`]);L({workspaceId:j()});const Zp=L({targetPurchasedSeats:Jp,seatAssignment:L({userId:j(),seatType:qp}).optional()});z(`outcome`,[L({outcome:V(`unchanged`),quoteHash:O().min(1),targetPurchasedSeats:Jp,nextMonthlyAmountUsd:O()}),L({outcome:V(`immediate`),quoteHash:O().min(1),targetPurchasedSeats:Jp,nextMonthlyAmountUsd:O(),dueToday:Yp}),L({outcome:V(`scheduled`),quoteHash:O().min(1),targetPurchasedSeats:Jp,nextMonthlyAmountUsd:O(),dueToday:Yp,effectiveAt:H()}),L({outcome:V(`split`),quoteHash:O().min(1),immediatePurchasedSeats:Jp,targetPurchasedSeats:Jp,nextMonthlyAmountUsd:O(),dueToday:Yp,effectiveAt:H()}),L({outcome:V(`blocked`),reason:Xp})]),L({workspaceId:j()}),Zp.extend({expectedQuoteHash:O().min(1)}),z(`kind`,[L({kind:V(`completed`),operationId:j().nullable()}),L({kind:V(`processing`),operationId:j()}),L({kind:V(`redirect`),operationId:j().nullable(),url:M()})]),L({workspaceId:j()});const Qp=L({startAt:H(),endAt:H()}),$p=L({cancelAtPeriodEnd:P(),canceledAt:H().nullable()}),em=L({reason:B([`invoice_payment_failed`,`checkout_incomplete`,`subscription_unpaid`,`subscription_paused`,`unsupported_state`]),startedAt:H().nullable(),retryEndsAt:H().nullable(),stripeInvoiceId:O().min(1).nullable(),hostedInvoiceUrl:M().nullable()});L({lifecycle:z(`kind`,[L({kind:V(`default`),period:vs(),cancellation:vs(),paymentIssue:vs()}),L({kind:V(`active`),period:Qp,cancellation:$p,paymentIssue:vs()}),L({kind:V(`payment_required`),period:Qp.nullable(),cancellation:vs(),paymentIssue:em}),L({kind:V(`canceled`),period:vs(),cancellation:$p,paymentIssue:vs()}),L({kind:V(`unavailable`),period:Qp.nullable(),cancellation:vs(),paymentIssue:em})]),subscription:L({planName:O().min(1),estimatedMonthlyChargeUsd:N().nonnegative(),nextInvoiceDueAt:H().nullable()}).nullable(),seats:L({purchased:Jp,assigned:Jp,available:Jp,totalPurchased:N().int().nonnegative(),totalAssigned:N().int().nonnegative(),totalAvailable:N().int().nonnegative()}),extraUsage:Fl.extend({currentPurchasedUsd:N().nonnegative()})}),L({workspaceId:j()}),L({portalUrl:M()}),L({workspaceId:j(),userId:j()}),L({seatType:kl});const tm=B([`google`,`outlook`,`caldav`]),nm=B([`confirmed`,`tentative`,`cancelled`]),rm=L({email:O(),displayName:O().optional(),responseStatus:B([`needsAction`,`declined`,`tentative`,`accepted`]).optional(),organizer:P().optional(),self:P().optional(),resource:P().optional()}),im=L({type:B([`hangoutsMeet`,`zoom`,`teams`,`webex`,`other`]),uri:O().optional(),label:O().optional()}),am=L({id:j(),providerCalendarId:O(),name:O(),color:O().nullable(),isVisible:P()});L({accounts:I(L({id:j(),provider:tm,email:O(),isActive:P(),lastSyncAt:O().nullable(),reminderEnabled:P(),reminderMinutesBefore:N(),createdAt:H(),calendars:I(am)}))}),L({events:I(L({id:j(),calendarId:j(),calendarName:O(),calendarColor:O().nullable(),provider:tm,providerEventId:O(),title:O(),description:O().nullable(),location:O().nullable(),startTime:O(),endTime:O(),isAllDay:P(),status:nm,conferenceLink:O().nullable(),conferenceData:im.nullable(),attendees:I(rm).nullable(),organizerEmail:O().nullable()}).extend({meetingId:j().nullable(),hasRecordings:P(),hasAudioFile:P()})),nextCursor:j().nullable(),hasMore:P()}),L({startTime:W.optional(),endTime:W.optional(),limit:U().int().min(1).max(500).default(50),cursor:j().optional()}).refine(e=>e.startTime&&e.endTime?new Date(e.startTime)<new Date(e.endTime):!0,{message:`endTime must be greater than startTime`,path:[`endTime`]}),L({hours:U().int().min(1).max(168).default(24),limit:U().int().min(1).max(50).default(10),cursor:j().optional()}),L({id:j(),reminderEnabled:P(),reminderMinutesBefore:N()}),L({updated:N()}),q.IMAGE_GENERATION,q.PROJECT,q.SANDBOX,q.WEB_SEARCH,q.SKILL,q.SLIDES,q.WORKFLOW;const om=L({inputTokens:N().optional(),outputTokens:N().optional(),totalTokens:N().optional(),reasoningTokens:N().optional(),cachedInputTokens:N().optional(),cachedCreationTokens:N().optional()});L({modelId:O().optional(),toolApprovalMode:rf.optional(),usage:om.optional(),totalUsage:om.optional(),platformMessageTs:O().optional(),postedMessageTs:I(O()).optional()}),L({id:j(),name:O(),mimeType:O(),size:N(),url:O().optional().describe(`The signed URL for the file, only available if the file is not expired`),expired:P(),createdAt:H(),updatedAt:H()}),L({phase:B([`running`,`done`])});const sm=B([`step_limit`,`output_limit`,`retry_limit`]);L({reason:sm,toolCallIds:I(O()).optional()});function cm(e){return e.state===`approval-requested`&&e.approval?.isAutomatic!==!0}const lm=L({reason:sm,sourceMessageId:j()}),um=new TextEncoder;function dm(e){try{let t=JSON.stringify(e);return typeof t==`string`?um.encode(t).byteLength:null}catch{return null}}const fm=L({sourceMessageId:j(),action:V(`continueConversation`),values:F().refine(e=>{let t=dm(e);return t!==null&&t<=65536},`Widget interaction values must be JSON and at most 64 KiB`)});L({context:O()}),L({runs:I(L({runId:O(),kind:B([`subagent`,`workflow`]),status:O(),summary:O()}))});const pm=L({system:N(),tools:N(),history:N()});L({totalTokens:N(),breakdown:pm,contextWindowTokens:N().optional(),compactionTriggerTokens:N().optional()});const mm=L({text:O(),type:V(`text`)}),hm=L({type:V(`data-widget-interaction`),data:fm}),gm=L({type:V(`data-task-continuation`),data:lm}),_m=L({id:j(),createdAt:pc().optional(),role:V(`user`),parts:R([Ns([mm]),Ns([hm]),Ns([gm])])}),vm=R([O().startsWith(`tool-`),V(`dynamic-tool`)]),ym=L({id:O(),approved:P(),reason:O().optional()}),bm=L({type:vm,toolCallId:O(),state:V(`approval-responded`),input:bs().optional(),approval:ym}),xm=L({type:vm,toolCallId:O(),state:V(`output-available`),output:bs(),approval:ym.optional()}),Sm=L({type:vm,toolCallId:O(),state:V(`output-error`),errorText:O(),approval:ym.optional()}),Cm=L({id:O(),approved:V(!1),reason:O().optional()}),wm=L({type:vm,toolCallId:O(),state:V(`output-denied`),errorText:O().optional(),approval:Cm.optional()}).refine(e=>e.errorText!==void 0||e.approval!==void 0,{message:`An output-denied part must carry the refusal, as errorText or as approval.reason`,path:[`errorText`]});z(`role`,[_m,L({id:j(),createdAt:pc().optional(),role:V(`assistant`),parts:I(z(`state`,[bm,xm,Sm,wm])).min(1)})]);const Tm=[`approval-responded`,`output-available`,`output-error`,`output-denied`],Em=[`output-available`,`output-error`,`output-denied`];function Dm(e){for(let t=e.length-1;t>=0;--t)if(e[t]?.type===`step-start`)return t;return-1}function Om(e){return Tm.includes(e)}function km(e){return Em.includes(e)}function Am(e){return e?.role===`assistant`?e.parts.filter(l).filter(e=>!e.providerExecuted):[]}function jm(e){if(e?.role!==`assistant`)return[];let t=Dm(e.parts);return Am({role:e.role,parts:e.parts.slice(t+1)})}function Mm(e,t){return t(e)?km(e.state):Om(e.state)}function Nm(e,t){return t(e)?km(e.state):e.state===`approval-responded`||e.state===`output-denied`}function Pm(e){let t=`approval`in e?e.approval:void 0;return{type:e.type,toolCallId:e.toolCallId,state:e.state,...e.state===`output-available`&&{output:e.output},...`errorText`in e&&e.errorText!==void 0&&{errorText:e.errorText},...t!==void 0&&{approval:t}}}function Fm(e,{isClientTool:t}){return e?.role===`assistant`?{id:e.id,role:`assistant`,parts:jm(e).filter(e=>Nm(e,t)).map(Pm)}:e}function Im(e){let t=e?.message?.parts;return Array.isArray(t)?t.flatMap(e=>{let t=e?.toolCallId;return typeof t==`string`?[t]:[]}):[]}function Lm({messages:e,isClientTool:t,suppressAutomaticSend:n=!1,submittedToolCallIds:r}){if(n)return!1;let i=jm(e.at(-1));return!i.some(e=>!Mm(e,t))&&i.some(e=>Nm(e,t)&&!r.has(e.toolCallId))}function Rm(e){if(e.reason!==void 0)return e.reason;let t=Error(`The operation was aborted.`);return t.name=`AbortError`,t}function zm(e,t){if(!t)return e;let n=()=>Rm(t),r,i,a=()=>{i&&=(t.removeEventListener(`abort`,i),void 0)};return new ReadableStream({start(a){if(i=()=>{a.error(n()),(r??e).cancel(n()).catch(()=>{})},t.aborted){i();return}t.addEventListener(`abort`,i,{once:!0})},async pull(n){r??=e.getReader();try{let{done:e,value:t}=await r.read();if(e){n.close(),a();return}n.enqueue(t)}catch(e){t.aborted||n.error(e),a()}},cancel(t){a(),(r??e).cancel(t).catch(()=>{})}})}const Bm={schemaVersion:V(2),siteKey:O().min(1),assetId:j(),title:O()};z(`state`,[L({...Bm,state:V(`working`),revision:O().min(1)}),L({...Bm,state:V(`saved`),versionId:j(),versionNumber:N().int().positive()})]);const Vm=B([`pending`,`generating`,`ready`,`error`]),Hm=L({page:N().int().positive(),heading:O(),status:Vm,version:N().int().nonnegative().default(0),imageUrl:O().optional(),assetId:O().optional(),note:O().optional()});L({deckId:O().min(1),title:O(),style:O(),aspectRatio:O(),status:B([`generating`,`partial`,`ready`]),outputs:L({pdfUrl:O().optional(),pptxUrl:O().optional(),pdfAssetId:O().optional(),pptxAssetId:O().optional()}).default({}),slides:I(Hm)});const Um=L({slideId:j(),position:N().int().positive(),heading:O(),status:Vm,note:O().optional()}),Wm={schemaVersion:V(2),deckKey:O().min(1),assetId:j(),title:O(),style:O(),aspectRatio:O(),slides:I(Um)};z(`state`,[L({...Wm,state:V(`working`),revision:O().min(1)}),L({...Wm,state:V(`saved`),versionId:j(),versionNumber:N().int().positive()})]),L({data:L({assetId:j(),versionId:j(),versionNumber:N().int().positive(),title:O(),style:O(),aspectRatio:O(),slides:I(L({slideId:j(),position:N().int().positive(),heading:O(),imageUrl:M()})),pdfUrl:M(),pptxUrl:M().optional()})});const Gm=[`slack`,`teams`],Km=[`active`,`inactive`,`needs_reauth`],qm=B(Gm),Jm=B(Km),Ym=L({id:j(),platform:qm,platformWorkspaceId:O(),platformWorkspaceName:O(),botUserId:O(),status:Jm,autoBindEnabled:P(),createdAt:H(),updatedAt:H()});L({platform:qm.optional(),limit:U().int().min(1).max(100).default(20),cursor:j().optional()}),L({installations:I(Ym),nextKey:O().optional()}),L({status:B([`active`,`inactive`]).optional()});const Xm=L({id:j(),workspaceInstallationId:j(),platform:qm,platformWorkspaceName:O(),platformUserId:O(),createdAt:H()});L({installations:I(Xm)}),L({workspaceInstallation:Ym.nullable(),userInstallation:Xm.nullable(),canManageChatbot:P()}).extend({installUrl:M().nullable()}),L({userInstallation:Xm}),L({autoBindEnabled:P()}),L({workspaceInstallation:Ym}),L({bindings:I(L({id:j().nullable(),workspaceInstallationId:j().nullable(),userId:j(),userName:O(),userEmail:A(),platformUserId:O().nullable(),createdAt:H().nullable(),updatedAt:H().nullable()})),total:N().int().nonnegative()}),hl.extend({search:O().trim().max(200).optional()}),L({authorizeUrl:O()});const Zm=2048,Qm=B([`self`,`anyone`]),$m=L({id:j(),platform:qm,userInstallationId:j(),platformChannelId:O(),channelName:O().nullable(),platformThreadId:O().nullable(),keyword:O().nullable(),triggerScope:Qm,agentId:j().nullable(),agentName:O().nullable(),sourceKeywordListenerIds:I(j()),taskId:j().nullable(),titlePreview:O().nullable(),threadUrl:M().nullable(),lastInteractedAt:H().nullable(),enabled:P(),createdAt:H(),updatedAt:H()});L({installationId:j().optional()}),L({listeners:I($m)}),L({installationId:j(),platformChannelId:O().trim().min(1).max(Zm).regex(/^(?:(?:slack:)?[CG][A-Z0-9]+|teams:[A-Za-z0-9_-]+:[A-Za-z0-9_-]+)$/u,`Must be a valid Slack or Microsoft Teams channel id.`),keyword:O().trim().min(1).max(200),triggerScope:Qm.optional(),agentId:j().nullable().optional()}),L({listener:$m}),L({keyword:O().trim().min(1).max(200).optional(),triggerScope:Qm.optional(),agentId:j().nullable().optional(),enabled:P().optional()}).refine(e=>e.keyword!==void 0||e.triggerScope!==void 0||e.agentId!==void 0||e.enabled!==void 0,{message:`At least one field must be provided`}),L({installationId:j(),platformChannelId:O().trim().min(1).max(Zm),keyword:O().trim().min(1).max(200)}),L({count:N().int().nonnegative()}),L({installationId:j()}),L({channels:I(L({id:O(),name:O(),isPrivate:P()}))}),L({}).optional(),L({ok:V(!0),messageTs:O()}),L({olderThanDays:N().int().min(1).max(365).default(14).optional()}).optional(),L({deletedCount:N().int().min(0)});const eh=B([`enabled`,`disabled`]);L({items:I(L({agentId:j(),agentName:O(),status:eh,capReached:P(),connectorNames:I(O())}))}),L({items:I(L({agentId:j(),agentName:O(),connectorNames:I(O())}))}),L({agentId:j()}),L({archiveContext:dc().optional()}),L({activeConversationCount:N().int(),suppressedListenerCount:N().int()});const th=O().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/),nh=L({minSupportedVersion:th,latestVersion:th});L({ios:nh,android:nh,gntcLoginEnabled:P(),googleLoginEnabled:P()});const rh=`usage_audit__`,ih={GET_DAILY_SUMMARY:`${rh}get_daily_summary`,GET_MONTHLY_COSTS:`${rh}get_monthly_costs`,GET_USER_BREAKDOWN:`${rh}get_user_breakdown`,GET_USER_DAILY_TREND:`${rh}get_user_daily_trend`,FIND_USAGE_DROPS:`${rh}find_usage_drops`,FIND_STALE_SCHEDULES:`${rh}find_stale_schedules`,GET_SCHEDULE_TOOL_CALLS:`${rh}get_schedule_tool_calls`,GET_COST_RANKING:`${rh}get_cost_ranking`,GET_WORKSPACE_TOTALS:`${rh}get_workspace_totals`},ah=`subagent__`,oh={SPAWN:`${ah}spawn`,GET_RUN:`${ah}get_run`},sh=[`browser__`,`task__`,`project__`,`asset__`,`agent__`,`connector__`,`filesystem__`,`image__`,`meeting__`,`memory__`,`sandbox__`,`schedule__`,`skill__`,`site__`,`slides__`,`tool_result__`,`meta_tool__`,rh,`audit_log__`,ah,`ui__`,`web__`,`workflow__`].map(e=>e.slice(0,-2)),ch=B([`pat`,`oauth`,`dcard-dual`,`google-iap`,`credentials`,`mcp-oauth`,`composio`]),lh=/^[a-z][a-z0-9-]*$/,uh=[`pat`,`credentials`],dh=L({key:O().regex(lh).max(32),label:O().min(1).max(50),description:O().max(200).optional(),placeholder:O().max(100).optional(),required:P()}),fh=I(dh).max(10).refine(e=>new Set(e.map(e=>e.key)).size===e.length,{message:`config field keys must be unique`});Fs(O().regex(lh).max(32),O().min(1).max(256).regex(/^[\u0020-\u007E]*$/,`must be printable ASCII`));const ph={pat:!1,oauth:!0,"dcard-dual":!0,"google-iap":!0,credentials:!1,"mcp-oauth":!0,composio:!0};function mh(e){let t=ch.safeParse(e);return t.success&&ph[t.data]}const hh=B([`pending`,`running`,`failed`]),gh=B([`pending`,`in_review`,`approved`,`rejected`]),_h=L({name:O(),isMe:P()}),vh=L({id:O(),name:O(),configured:P(),builtIn:P()}),yh=L({type:ch,tutorial:O().optional(),configFields:I(dh).optional(),tokenless:P().optional().describe(`PAT connectors whose connect step is a pure opt-in: the client submits a constant token without asking the user for input`),provider:vh.optional().describe(`The OAuth provider, only present for OAuth authorization`)});L({iconId:j(),url:M()}),L({connectors:I(L({id:j(),name:O(),description:O(),provider:O().nullable().describe(`The provider of the connector, either EntryDesk (for built-in connectors) or Workspace name`),author:L(_h.shape).optional().describe(`The author of the connector, not available for built-in connectors`),connected:P().describe(`Whether the user has connected the connector to the workspace`),iconUrl:O().optional().describe(`The URL of the connector icon`),team:L({id:j(),name:O()}).optional().describe(`The team this connector is published to, only present when createdBy is team`),hasPermission:P().describe(`Whether the user has permission to use the connector`),added:P().describe(`Whether the connector has a workspace_connectors record. Without one it has no tool registry, so the per-connector tool endpoints answer 404`),hasWorkspaceToken:P().describe(`Whether the workspace has a workspace token configured for this connector`),tokenMode:B([`personal`,`workspace`]).describe(`Token mode: personal (each member connects) or workspace (admin provides shared token)`),reviewStatus:gh.optional().describe(`The review status of the connector, not available for built-in connectors`),authorization:yh.optional(),versionNumber:N().int().nullable(),myRole:rd,createdAt:H(),updatedAt:H()})),nextKey:O().optional()}),ml.extend({reviewStatus:gh.optional().describe(`Filter connectors by review status (only applies to custom connectors)`),includeNotAdded:R([V(`true`).transform(()=>!0),V(`false`).transform(()=>!1),P()]).optional().describe(`Include connectors that have not been added to the workspace (no workspace_connectors record)`),type:B(Ju).optional().describe(`Filter connectors by type`),sortBy:B(Ku).optional()}).refine(e=>!(e.type===qu.BUILT_IN&&e.reviewStatus),{message:`reviewStatus parameter is not applicable when type is built_in`,path:[`reviewStatus`]}),ml.extend({createdBy:B([`workspace`,`team`,`me`]).optional(),teamId:j().optional(),connectionStatus:B([`all`,`connected`]).optional().default(`all`).describe(`Filter connectors by connection status`),strict:R([V(`true`).transform(()=>!0),V(`false`).transform(()=>!1),P()]).optional().default(!0).describe(`Whether to filter out connectors that the user does not have permission to use`),search:O().trim().max(200).optional().describe(`Search connectors by name using SQL LIKE query`),connectorIds:R([j(),I(j())]).optional().transform(e=>{if(e!==void 0)return Array.isArray(e)?e:[e]}).describe(`Filter connectors by specific IDs`),sortBy:B(Ku).optional()}).refine(e=>!e.teamId||e.createdBy===`team`,{message:`teamId can only be used with createdBy: team`,path:[`teamId`]});const bh=L({id:O(),name:O()}),xh=L({id:j()}).nullable();L({connectors:I(L({id:j(),type:B(Ju),name:O(),description:O(),provider:O().describe(`The provider of the connector, either EntryDesk (for built-in connectors) or Workspace name`),iconUrl:O().optional().describe(`The URL of the connector icon`),author:_h.optional().describe(`The author of the connector, not available for built-in connectors`),roles:I(bh).describe(`The roles of the user who has access to the connector`),executionStatus:hh.optional().describe(`The execution status of the connector, not available for built-in connectors`),reviewStatus:gh.optional().describe(`The review status of the connector, not available for built-in connectors`),hasWorkspaceToken:P().describe(`Whether the workspace has a workspace token configured for this connector`),tokenMode:B([`personal`,`workspace`]).describe(`Token mode: personal (each member connects) or workspace (admin provides shared token)`),added:P().describe(`Whether the connector has been added to the workspace`),toolPrefix:O().optional().describe(`The prefix of the tool name, available when the connector is added to the workspace`),authorization:yh.optional().describe(`The authorization of the connector.`),publish:xh,myRole:rd,createdAt:H(),updatedAt:H()})),nextKey:O().optional()});const Sh=B([`pat`,`oauth`,`dcard-dual`,`google-iap`,`credentials`,`mcp-oauth`]),Ch={pat:!1,oauth:!0,"dcard-dual":!0,"google-iap":!0,credentials:!1,"mcp-oauth":!1};function wh(e){let t=Sh.safeParse(e);return t.success&&Ch[t.data]}const Th=L({type:Sh,provider:O().optional(),scopes:I(O()).optional(),tutorial:O().optional(),configFields:I(dh).optional()}),Eh=L({type:Sh,provider:O().optional(),scopes:I(O()).optional(),tutorial:M().max(100).optional(),configFields:fh.optional()}).refine(e=>!wh(e.type)||e.provider!==void 0&&e.provider.trim().length>0&&e.scopes!==void 0&&e.scopes.length>0,{message:`provider and at least one scope are required when type is oauth, google-iap, or dcard-dual`,path:[`provider`,`scopes`]}).refine(e=>e.type!==`dcard-dual`||e.provider!==`googleIAP`,{message:`dcard-dual requires a second provider other than googleIAP`,path:[`provider`]}).refine(e=>!(e.tutorial&&![`pat`,`credentials`].includes(e.type)),{message:`tutorial is only allowed for PAT and CREDENTIALS authorization types`,path:[`tutorial`]}).refine(e=>!(e.configFields?.length&&!uh.some(t=>t===e.type)),{message:`configFields is only allowed for PAT and CREDENTIALS authorization types`,path:[`configFields`]}),Dh=/^[A-Za-z0-9\s]+$/u,Oh=[`empty`,`too_long`,`invalid_characters`,`consecutive_spaces`,`untrimmed`],kh={empty:e=>e.length===0,too_long:e=>e.length>50,invalid_characters:e=>!Dh.test(e),consecutive_spaces:e=>/\s{2,}/u.test(e),untrimmed:e=>e.trim()!==e},Ah={empty:`must not be empty`,too_long:`must be at most 50 characters`,invalid_characters:`must use only letters, digits and spaces`,consecutive_spaces:`must not contain consecutive spaces`,untrimmed:`must not start or end with whitespace`};function jh(e){return Oh.find(t=>kh[t](e))}const Mh=/^[a-z][a-z0-9_-]*$/u,Nh=[`empty`,`too_long`,`invalid_characters`,`consecutive_underscores`,`reserved`],Ph={empty:e=>e.length===0,too_long:e=>e.length>32,invalid_characters:e=>!Mh.test(e),consecutive_underscores:e=>e.includes(`__`),reserved:e=>sh.includes(e)},Fh={empty:`must not be empty`,too_long:`must be at most 32 characters`,invalid_characters:`must start with a lowercase letter and use only lowercase letters, digits, hyphen and underscore`,consecutive_underscores:`must not contain consecutive underscores`,reserved:`is reserved for a built-in EntryDesk tool namespace`};function Ih(e){return Nh.find(t=>Ph[t](e))}function Lh(){return O().superRefine((e,t)=>{let n=Ih(e);n&&t.addIssue({code:`custom`,message:`Tool namespace "${e}" ${Fh[n]}`})})}function Rh(e){let t=e.toLowerCase().replaceAll(/[^a-z0-9]+/gu,`_`).replace(/^_/u,``).replace(/_$/u,``);return/^[0-9]/u.test(t)?`c_${t}`:t}const zh=B([`streamable_http`,`sse`]);L({id:j(),type:V(qu.CUSTOM_REMOTE_URL),name:O(),description:O(),url:O(),transport:zh,toolPrefix:O(),author:_h.optional(),authorization:Th.optional(),executionStatus:hh.optional(),reviewStatus:gh.optional(),createdAt:H(),updatedAt:H(),iconId:j().nullable().optional(),iconUrl:O().optional(),publish:L({id:j()}).nullable(),myRole:rd}),L({id:j(),type:V(qu.CUSTOM_REMOTE_URL),name:O(),description:O(),transport:zh,url:O(),executionStatus:hh,reviewStatus:gh,toolPrefix:O(),createdAt:H(),updatedAt:H()}),L({type:V(qu.CUSTOM_REMOTE_URL),name:O().min(1),description:O().min(1),transport:zh,url:M(),toolPrefix:Lh().describe(`The tool prefix for the connector`),authorization:Eh.optional().nullable(),iconId:j().nullable().optional()});const Bh=[`composio`,`mcp`],Vh=[`stdio`,`sse`,`streamable_http`];zh.options;const Hh=ch.exclude([`composio`]);Hh.options;const Uh=[`pat`,`credentials`];L({items:I(L({id:j(),name:O(),description:O(),iconUrl:O().nullable(),kind:B(Bh),toolkit:O().nullable(),transport:B(Vh),authorizationType:ch.nullable(),createdAt:H()}))});const Wh=L({kind:V(`composio`),name:O().min(1).max(100),description:O().min(1),toolkit:O().min(1),tools:I(O().min(1)).optional(),extraTools:I(O().min(1)).optional(),composioAuthConfigId:O().min(1).optional()}),Gh=L({kind:V(`mcp`),name:O().min(1).max(100),description:O().min(1),url:M(),transport:zh,authorization:L({type:Hh,provider:O().min(1).optional(),scopes:I(O().min(1)).optional(),tutorial:M().max(100).optional(),configFields:fh.optional()}).optional()}).refine(e=>e.authorization?.type!==`oauth`||e.authorization.provider!==void 0&&e.authorization.scopes!==void 0,{message:`provider and scopes are required when type is oauth`,path:[`authorization`]}).refine(e=>!e.authorization?.tutorial||Uh.some(t=>t===e.authorization?.type),{message:`tutorial is only allowed for pat and credentials authorization types`,path:[`authorization`,`tutorial`]}).refine(e=>!e.authorization?.configFields?.length||uh.some(t=>t===e.authorization?.type),{message:`configFields is only allowed for pat and credentials authorization types`,path:[`authorization`,`configFields`]});L({toolkit:O().min(1)});const Kh=L({name:O(),mode:O(),scopes:I(O())});L({slug:O(),name:O(),managedAuthSchemes:I(O()),auths:I(Kh)}),z(`kind`,[Wh,Gh]);const qh={en:{authLink:[`auth`,`oauth`,`authorize`,`authorization`,`connect`,`login`,`sign in`,`sign-in`,`signin`],authGlossVerbs:[`authorize`,`connect`,`login`,`sign in`,`sign-in`,`signin`],placement:[`button`,`buttons`,`link`,`links`,`click`,`below`,`following`]},"zh-TW":{authLink:[`授權`,`授权`,`連接`,`连接`,`認證`,`认证`,`登入`,`登录`],authGlossVerbs:[`授權`,`授权`,`連接`,`连接`,`認證`,`认证`,`登入`,`登录`],placement:[`按鈕`,`按钮`,`連結`,`链接`,`點擊`,`点击`,`下方`,`以下`]},de:{authLink:[`autorisieren`,`autorisierung`,`verbinden`,`anmelden`,`login`],authGlossVerbs:[`autorisieren`,`verbinden`,`anmelden`,`login`],placement:[`schaltfläche`,`schaltflächen`,`button`,`buttons`,`link`,`links`,`klicken`,`unten`,`folgende`,`folgenden`]},fr:{authLink:[`autoriser`,`autorisation`,`connecter`,`connexion`,`login`,`se connecter`],authGlossVerbs:[`autoriser`,`connecter`,`connexion`,`login`,`se connecter`],placement:[`bouton`,`boutons`,`lien`,`liens`,`cliquer`,`cliquez`,`ci-dessous`,`suivant`,`suivants`]},"es-ES":{authLink:[`autorizar`,`autorización`,`conectar`,`conexión`,`iniciar sesión`,`login`],authGlossVerbs:[`autorizar`,`conectar`,`iniciar sesión`,`login`],placement:[`botón`,`botones`,`enlace`,`enlaces`,`clic`,`haz clic`,`hacer clic`,`abajo`,`siguiente`,`siguientes`]},"es-419":{authLink:[`autorizar`,`autorización`,`conectar`,`conexión`,`iniciar sesión`,`login`],authGlossVerbs:[`autorizar`,`conectar`,`iniciar sesión`,`login`],placement:[`botón`,`botones`,`enlace`,`enlaces`,`clic`,`haz clic`,`hacer clic`,`abajo`,`siguiente`,`siguientes`]},ja:{authLink:[`認可`,`承認`,`認証`,`接続`,`ログイン`],authGlossVerbs:[`認可`,`承認`,`認証`,`接続`,`ログイン`],placement:[`ボタン`,`リンク`,`クリック`,`下`,`以下`,`次`]},ko:{authLink:[`인증`,`승인`,`권한`,`연결`,`로그인`],authGlossVerbs:[`인증`,`승인`,`연결`,`로그인`],placement:[`버튼`,`링크`,`클릭`,`아래`,`다음`]},it:{authLink:[`autorizza`,`autorizzare`,`autorizzazione`,`connetti`,`connettere`,`accesso`,`login`],authGlossVerbs:[`autorizza`,`autorizzare`,`connetti`,`connettere`,`accedi`,`login`],placement:[`pulsante`,`pulsanti`,`link`,`collegamento`,`collegamenti`,`clic`,`fare clic`,`sotto`,`seguente`,`seguenti`]},"pt-BR":{authLink:[`autorizar`,`autorização`,`conectar`,`conexão`,`entrar`,`login`],authGlossVerbs:[`autorizar`,`conectar`,`entrar`,`login`],placement:[`botão`,`botões`,`link`,`links`,`clicar`,`clique`,`abaixo`,`seguinte`,`seguintes`]}},Jh=/[.*+?^${}()|[\]\\]/g;function Yh(e){return e.replace(Jh,`\\$&`)}function Xh(e){let t=new Set,n=[];for(let r of e){let e=r.trim();e.length>0&&!t.has(e)&&(t.add(e),n.push(e))}return n}function Zh(e){return Xh(Object.values(qh).flatMap(t=>t[e]))}function Qh(e){let t=Zh(e).toSorted((e,t)=>t.length-e.length).map(Yh).join(`|`);return new RegExp(t,`iu`)}function $h(){let e=Zh(`authGlossVerbs`).toSorted((e,t)=>t.length-e.length).map(Yh).join(`|`);return RegExp(`^(?:${e})(?=\\s|$|[^\\p{Letter}\\p{Number}])`,`iu`)}Qh(`authLink`),Qh(`placement`),$h(),L({toolkit:O(),tools:I(O()).optional(),extraTools:I(O()).optional()}),L({search:O().trim().max(200).optional(),status:B(vd).optional(),nextKey:O().optional(),limit:U().int().min(1).max(100).default(20),sortBy:B(Ku).optional()}),L({connectors:I(L({id:j(),name:O(),iconUrl:O().optional(),hasUnpublishedChanges:P(),latestVersionNumber:N().int().nullable(),publishedTo:ld.optional(),myRole:rd,createdAt:H(),updatedAt:H()})),nextKey:O().optional(),totalCount:N().int().nonnegative(),statusCounts:yd});const eg=B([`user_configurable`,`need_approval`,`block`]),tg=B([`need_approval`,`always_allow`,`block`]),ng=L({id:j(),name:O(),toolName:O(),description:O(),workspacePolicy:eg,userPolicy:tg.nullable()});L({tools:I(ng)}),L({tools:I(ng.extend({schedulePolicy:bf.nullable()}))});const rg=B([`saas`,`on-premises`]);L({path:O(),value:F().optional()});const ig=B([`scheduled`,`in_progress`,`completed`,`cancelled`]),ag=B([`manual`,`calendar`,`recording`]),og=B([`local`,`upload`,`zoom`,`youtube`,`media`,`bot`]),sg=B([`chrome_extension`]),cg=B([`pending`,`extracting_subtitles`,`downloading`,`transcribing`,`refining`,`completed`,`failed`]),lg=B([`recall`]),ug=B([`scheduled`,`joining`,`in_call`,`recording`,`done`,`failed`,`removed`]),dg=B([`manual`,`api`,`connector`,`calendar_subscription`]),fg=B([`idle`,`queued`,`generating`,`completed`,`failed`]),pg=B([`generated`,`import`,`user_edit`,`restore`,`migration`]),mg=L({type:B([`hangoutsMeet`,`zoom`,`teams`,`webex`,`other`]),uri:O().optional(),label:O().optional()}),hg=L({email:O(),displayName:O().nullable().optional(),role:B([`organizer`,`attendee`,`optional`]).optional(),responseStatus:B([`needsAction`,`declined`,`tentative`,`accepted`]).nullable().optional(),userId:j().nullable().optional()}),gg=L({start:N(),end:N(),text:O()}),_g=Fs(O().regex(/^[A-Z0-9]{1,2}$/u),O().trim().min(1).max(100).regex(/^[^\r\n]+$/u)),vg=L({description:O(),assignee:O().nullable().optional(),dueDate:O().nullable().optional(),completed:P()}),yg=B([`private`,`workspace`]),bg=B([`viewer`,`editor`]),xg=B([`owner`,`editor`,`viewer`]),Sg=B([`explicit`,`workspace`]),Cg=L({userId:j(),userName:O(),userEmail:A(),userImage:O().nullable().optional(),role:bg,grantedBy:j().nullable(),createdAt:H()}),wg=L({teamId:j(),teamName:O(),memberCount:N(),role:bg,grantedBy:j().nullable(),createdAt:H()});L({visibility:yg,userGrants:I(Cg),teamGrants:I(wg)}),L({role:bg}),L({title:O().trim().min(1).max(500),description:O().optional(),location:O().optional(),startTime:W.optional(),endTime:W.optional(),conferenceLink:M().optional(),conferenceData:mg.optional(),calendarEventId:j().optional(),notes:O().optional()}),L({title:O().trim().min(1).max(500).optional(),description:O().nullable().optional(),location:O().nullable().optional(),startTime:W.nullable().optional(),endTime:W.nullable().optional(),status:ig.optional(),conferenceLink:M().nullable().optional(),conferenceData:mg.nullable().optional(),notes:O().nullable().optional(),summary:O().nullable().optional(),expectedSummary:O().nullable().optional(),calendarEventId:j().nullable().optional(),visibility:yg.optional()});const Tg=L({processedChunks:N().int().nonnegative(),totalChunks:N().int().positive()}),Eg=B([`preparing`,`queued`,`transcribing`,`validating`,`finalizing`,`falling_back`]),Dg=L({percentage:N().int().min(0).max(100),batchStage:Eg.optional(),batchStartedAt:H().optional(),batchElapsedSeconds:N().int().nonnegative().optional()}),Og=L({provisionalCoverageRatio:N().min(0).max(1),finalTranscription:Tg}),kg=L({transcript:O(),transcriptWithTimestamps:O(),segments:I(gg),summary:O().nullable(),actionItems:I(vg).nullable().optional(),generatedAt:H(),stability:L({coverageRatio:N().min(0).max(1),eligible:P(),failedChunkCount:N().int().nonnegative(),maxGapSec:N().nonnegative(),missingRangeCount:N().int().nonnegative(),pendingChunkCount:N().int().nonnegative(),reason:O()})}),Ag=kg.pick({summary:!0,actionItems:!0});L({id:j(),uploadedBy:j(),meetingId:j(),title:O(),duration:N().nullable(),transcript:O().nullable(),transcriptWithTimestamps:O().nullable(),segments:I(gg).nullable(),speakerNames:_g,transcriptRevision:N().int().nonnegative(),needsSummaryRefresh:P(),isSummaryStale:P(),summary:O().nullable(),actionItems:I(vg).nullable(),summaryStatus:fg,audioStorageKey:O().nullable(),canRetranscribe:P().optional(),captureClient:sg.nullable().optional(),processingStatus:cg.nullable(),processingProgress:Dg.nullable().optional(),hybridProgress:Og.nullable().optional(),provisionalResult:kg.nullable().optional(),transcriptionProgress:Tg.nullable().optional(),recordedAt:H().nullable(),createdAt:H(),updatedAt:H()});const jg=L({id:j(),title:O(),duration:N().nullable(),hasSummary:P(),hasTranscript:P(),canRetry:P().optional(),needsSummaryRefresh:P(),isSummaryStale:P(),summary:O().nullable().optional(),actionItems:I(vg).nullable().optional(),summaryStatus:fg,source:og.nullable().optional(),captureClient:sg.nullable().optional(),processingStatus:cg.nullable(),processingProgress:Dg.nullable().optional(),hybridProgress:Og.nullable().optional(),provisionalResult:Ag.nullable().optional(),transcriptionProgress:Tg.nullable().optional(),recordedAt:H().nullable(),createdAt:H(),updatedAt:H().optional()}),Mg=B([`transcript`,`summary`]),Ng=L({id:j(),name:O()}),Pg=L({id:j(),versionNumber:N().int().nonnegative(),origin:pg,restoredFromVersionId:j().nullable(),createdBy:Ng.nullable(),createdAt:H(),excerpt:O().nullable()});L({contentType:Mg,currentVersionId:j().nullable(),canRestore:P(),versions:I(Pg),nextVersionNumber:N().int().nonnegative().nullable()});const Fg=Pg.omit({excerpt:!0});z(`contentType`,[Fg.extend({contentType:V(`transcript`),transcript:O().nullable(),transcriptWithTimestamps:O().nullable(),rawTranscript:O().nullable(),segments:I(gg).nullable(),speakerNames:_g}),Fg.extend({contentType:V(`summary`),summary:O(),actionItems:I(vg).nullable(),sourceTranscriptRevision:N().int().nonnegative().nullable()})]),L({expectedHeadVersionId:j()}),L({currentVersionId:j().nullable(),canRestore:P(),versions:I(Pg),nextVersionNumber:N().int().positive().nullable()}),Fg.extend({summary:O(),actionItems:I(vg).nullable(),sourceRecordingSummaryVersionIds:I(j())});const Ig=L({id:j(),meetingRecordingId:j().nullable(),provider:lg,meetingUrl:O(),botName:O().nullable(),status:ug,statusDetail:O().nullable(),dispatchSource:dg,joinedAt:H().nullable(),endedAt:H().nullable(),recordingReadyAt:H().nullable(),createdAt:H(),updatedAt:H()});L({relatedActiveBot:L({meetingId:j(),status:ug,dispatchedAt:H(),dispatchedBy:L({id:j(),name:O().nullable()}).nullable(),canAccess:P()}).nullable()});const Lg=B([`all`,`matching_rules`,`none`]),Rg=L({field:B([`meeting_type`,`meeting_title`]),matchType:B([`is`,`is_not`,`contains`,`does_not_contain`]),value:O().trim().min(1).max(200)}).superRefine((e,t)=>{if(e.field===`meeting_type`){e.matchType!==`is`&&e.matchType!==`is_not`&&t.addIssue({code:`custom`,path:[`matchType`],message:`meeting_type conditions must use is / is_not`}),e.value!==`internal`&&e.value!==`external`&&t.addIssue({code:`custom`,path:[`value`],message:`meeting_type conditions must match internal / external`});return}e.matchType!==`contains`&&e.matchType!==`does_not_contain`&&t.addIssue({code:`custom`,path:[`matchType`],message:`meeting_title conditions must use contains / does_not_contain`})});L({settings:L({recorderAgentName:O().trim().min(1).max(100),recordingPolicy:Lg,conditions:I(Rg).max(20)}).superRefine((e,t)=>{e.recordingPolicy===`matching_rules`&&e.conditions.length===0&&t.addIssue({code:`custom`,path:[`conditions`],message:`matching_rules requires at least one condition`})}).nullable(),hasCalendarAccounts:P()}),L({policyVersion:O(),segmentSeconds:N().int().positive(),minFlushSegmentSeconds:N().positive(),maxSegmentDurationSeconds:N().int().positive(),idlePollIntervalMs:N().int().positive(),pendingPollBackoffIntervalsMs:I(N().int().positive()).min(1),pendingPollIntervalMs:N().int().positive(),pollJitterRatio:N().min(0).max(1),uploadTimeoutMs:N().int().positive(),liveTranscriptionModelTimeoutMs:N().int().positive(),maxQueuedSegments:N().int().positive(),maxPendingChunks:N().int().positive(),maxUploadBytes:N().int().positive(),displayLagSeconds:N().nonnegative(),timelineCatchUpIntervalMs:N().int().positive(),timelineGapRevealAheadChunks:N().int().nonnegative(),timelineMaxBurstSegments:N().int().positive(),timelineMaxDisplaySegmentDurationSeconds:N().positive(),timelineMinDisplaySegmentDurationSeconds:N().positive(),timelineTypingCriticalBacklogChars:N().int().positive(),timelineTypingCriticalCharsPerSecond:N().int().positive(),timelineTypingHighBacklogChars:N().int().positive(),timelineTypingHighBacklogCharsPerSecond:N().int().positive(),timelineTypingLowBacklogChars:N().int().positive(),timelineTypingLowBacklogCharsPerSecond:N().int().positive(),timelineTypingNormalCharsPerSecond:N().int().positive(),timelineTypingRevealTickMs:N().int().positive()});const zg=L({userId:j(),name:O().nullable(),email:O(),image:O().nullable().optional()});L({id:j(),workspaceId:j(),createdBy:j(),owner:zg.optional(),calendarEventId:j().nullable(),title:O(),description:O().nullable(),location:O().nullable(),startTime:O().nullable(),endTime:O().nullable(),status:ig,source:ag,conferenceLink:O().nullable(),conferenceData:mg.nullable(),notes:O().nullable(),summary:O().nullable(),actionItems:I(vg).nullable().optional(),calendarEvent:L({title:O(),providerEventId:O(),calendarId:O(),provider:B([`google`,`outlook`,`caldav`]),providerCalendarId:O(),startTime:O(),endTime:O()}).nullable(),participants:I(hg).optional(),recordings:I(jg).optional(),hasEverRecorded:P().optional(),meetingBots:I(Ig).optional(),isOwner:P().optional(),sharedVia:Sg.optional(),visibility:yg,myRole:xg.optional(),createdAt:H(),updatedAt:H()});const Bg=L({id:j(),title:O(),sortTime:O(),createdAt:H(),updatedAt:H(),startTime:O().nullable(),endTime:O().nullable(),status:ig.nullable(),source:ag.nullable(),conferenceLink:O().nullable(),hasRecordings:P(),hasNotes:P().optional(),hasEverRecorded:P().optional(),participantCount:N().nullable(),isOwner:P(),myRole:xg,owner:zg.optional(),sharedVia:Sg.optional(),isSharedWithOthers:P().optional(),duration:N().nullable(),hasTranscript:P(),hasSummary:P(),summaryStatus:fg,recordingSource:og.nullable(),processingStatus:cg.nullable(),hasActiveMeetingBot:P().optional(),activeMeetingBot:Ig.optional()}),Vg=L({meetingId:O(),userId:O(),userName:O(),userEmail:O(),userImage:O().nullable().optional(),createdAt:H()});L({recordings:I(jg),nextKey:O().optional()}),L({meetings:I(Bg),nextKey:O().optional()}),L({shares:I(Vg)}),L({meetings:I(L({id:O(),title:O(),startTime:O().nullable()}))}),L({photos:Fs(O(),O())}),L({previous:L({meetingId:j(),title:O(),startTime:O().nullable(),summary:O(),actionItems:I(vg)}).nullable()}),ml.extend({search:O().trim().max(200).optional(),filter:B([`mine`,`shared`,`all`]).default(`all`),sortBy:B([`updated_at`,`start_time`]).default(`updated_at`),hasContent:dc().optional(),hasActiveMeetingBot:dc().optional()});function Hg(e){return e.summary?e.summary:e.recordings?.find(e=>e.summary)?.summary||e.recordings?.find(e=>e.provisionalResult?.summary)?.provisionalResult?.summary}const Ug=Object.values({AGENT:`agent`,SKILL:`skill`}),Wg={ROLE:`role`,BADGE:`badge`,USE_CASE:`use_case`},Gg=Object.values(Wg),Kg=L({speaker:B([`user`,`assistant`]),text:O()}),qg=L({id:j(),name:O(),provider:O(),iconUrl:O().nullable(),purpose:O()}),Jg=L({tag:O(),category:B(Gg),label:O()}),Yg=L({slug:O(),type:B(Ug),name:O(),description:O(),iconUrl:O().nullable(),tags:I(Jg)}),Xg=O().optional().transform(e=>bc(e));L({type:B(Ug).optional(),tag:O().optional(),limit:U().int().min(1).max(100).default(30),cursor:O().optional(),lang:Xg}),L({items:I(Yg),nextCursor:O().nullable()}),z(`type`,[L({slug:O(),type:V(`agent`),name:O(),description:O(),iconUrl:O().nullable(),tags:I(Jg),starterPrompts:I(O()),exampleConversation:I(Kg),connectors:I(qg)}),L({slug:O(),type:V(`skill`),name:O(),description:O(),iconUrl:O().nullable(),tags:I(Jg),exampleConversation:I(Kg)})]),L({items:I(L({tag:O(),name:O(),tagline:O()}))}),L({toolApprovalMode:rf.optional()}).default({}),L({resourceId:j(),resourceType:B(Ug),workspaceId:j(),taskId:j().nullable(),resourceSlug:O()}),L({type:B(Ug),slug:O().min(1)}),L({lang:Xg});const Zg=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,Qg=L({connectorId:j(),purpose:O().trim().min(1,`Purpose is required`)}),$g={name:O().trim().min(1).max(120),description:O().trim().min(1).max(2e3),iconId:j().nullable().optional(),tags:I(O()).default([]),model:Bu,systemPrompt:O().trim().min(1),conversationStarters:I(O().trim().min(1)).max(5).default([]),exampleConversation:I(Kg).min(1,`At least one example turn is required`),connectors:I(Qg).refine(e=>new Set(e.map(e=>e.connectorId)).size===e.length,{message:`Each connector can only be added once`}).default([])};L({slug:O().trim().regex(Zg,`Use lowercase-kebab-case`).max(120),...$g}),L($g),L({id:j()}),L({type:B(Ug).optional(),limit:U().int().min(1).max(100).default(30),offset:U().int().min(0).default(0)}),L({items:I(L({id:j(),type:B(Ug),slug:O(),name:O(),description:O(),tags:I(O()),isDelisted:P(),createdAt:H(),updatedAt:H()})),total:N().int().min(0)});const e_=L({connectorId:j(),name:O(),purpose:O()});L({id:j(),slug:O(),name:O(),description:O(),iconId:j().nullable(),tags:I(O()),model:O(),systemPrompt:O(),conversationStarters:I(O()),exampleConversation:I(Kg),connectors:I(e_),isDelisted:P(),createdAt:H(),updatedAt:H()}),L({items:I(L({tag:O(),category:B([Wg.ROLE,Wg.BADGE,Wg.USE_CASE])}))}),L({items:I(L({id:j(),name:O(),description:O()}))});const t_={description:O().trim().min(1).max(2e3),iconId:j().nullable().optional(),tags:I(O()).default([]),exampleConversation:I(Kg).min(1,`At least one example turn is required`)};L({slug:O().trim().regex(Zg,`Use lowercase-kebab-case`).max(120),...t_}),L(t_),L({id:j()}),L({id:j(),slug:O(),name:O(),description:O(),iconId:j().nullable(),tags:I(O()),exampleConversation:I(Kg),hasPackagedContent:P(),isDelisted:P(),createdAt:H(),updatedAt:H()}),L({name:O(),description:O()});const n_=L({id:N(),content:O(),createdAt:H(),updatedAt:H()});L({limit:U().int().min(1).max(100).default(100),nextKey:O().optional()}),L({memories:I(n_),nextKey:O().optional()}),L({workspaceId:j()}),L({workspaceId:j(),memoryId:U().int()}),L({providers:I(L({id:O(),name:O(),clientId:O().nullable(),authUrl:O(),tokenUrl:O(),usePKCE:P(),defaultScopes:I(O()).nullable(),strategy:O(),configured:P(),builtIn:P(),iconUrl:O().optional()}))});const r_={AGENT:`agent`,SKILL:`skill`,WORKFLOW:`workflow`,CONNECTOR:`connector`,SCHEDULE:`schedule`,PROJECT:`project`};function i_({resourceType:e,resourceId:t}){return`${e}:${t}`}const a_=B([r_.AGENT,r_.SKILL,r_.WORKFLOW,r_.CONNECTOR,r_.SCHEDULE,r_.PROJECT]),o_=L({resourceType:a_,resourceId:j(),name:O(),managedAgent:L({channelCount:N().int().nonnegative()}).optional()});L({hash:O().regex(/^[0-9a-f]{64}$/),items:I(o_)});const s_=z(`action`,[L({resourceType:a_,resourceId:j(),action:V(`transfer`),successorUserId:j()}),L({resourceType:a_,resourceId:j(),action:V(`delete`)})]),c_=z(`action`,[L({action:V(`transfer`),successorUserId:j()}),L({action:V(`delete`)})]);L({inventoryHash:O().min(1),defaultAction:c_.optional(),decisions:I(s_).max(1e3).superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.entries()){let e=i_(i);n.has(e)?t.addIssue({code:`custom`,path:[r],message:`Duplicate decision for resource`}):n.add(e)}})}),L({transferred:N(),deleted:N()});const X={Access:`access`,ManageWorkspace:`manage_workspace`,ManageRole:`manage_role`,ManageMember:`manage_member`,ManagePayment:`manage_payment`,SubmitCustomConnector:`submit_custom_connector`,ReviewCustomConnector:`review_custom_connector`,ManageConnector:`manage_connector`,ManageModel:`manage_model`,ManageCapability:`manage_capability`,ManageTeam:`manage_team`,ReviewResourcePublish:`review_resource_publish`,CreateAgent:`create_agent`,PublishAgent:`publish_agent`,CreateSkill:`create_skill`,PublishSkill:`publish_skill`,CreateWorkflow:`create_workflow`,CreateCustomConnector:`create_custom_connector`,PublishCustomConnector:`publish_custom_connector`,ManageAllTeams:`manage_all_teams`,ManageChatbot:`manage_chatbot`,ManageChannelAgents:`manage_channel_agents`,ViewAuditLogs:`view_audit_logs`};X.ManageWorkspace,X.ManageRole,X.ManageMember,X.ManagePayment,X.ManageModel,X.ManageCapability,X.ManageConnector,X.ManageChatbot,X.ManageChannelAgents,X.CreateCustomConnector,X.PublishCustomConnector,X.CreateAgent,X.PublishAgent,X.CreateSkill,X.PublishSkill,X.ReviewResourcePublish,X.ManageTeam,X.ManageAllTeams,X.ViewAuditLogs,X.ManageMember,X.ManageCapability,X.ManageConnector,X.ManageChatbot,X.ManageChannelAgents,X.CreateCustomConnector,X.PublishCustomConnector,X.CreateAgent,X.PublishAgent,X.CreateSkill,X.PublishSkill,X.ManageTeam,X.CreateCustomConnector,X.PublishCustomConnector,X.CreateAgent,X.PublishAgent,X.CreateSkill,X.PublishSkill;const l_=B([`workspace`,`resource`,`team`]),u_=L({id:B(Object.values(X)),name:O(),descriptions:I(O()).min(1),category:l_});L({lang:vc}),L({permissions:I(u_)});const d_=B([{id:`manage_role`,category:`workspace`},{id:`manage_member`,category:`workspace`},{id:`manage_workspace`,category:`workspace`},{id:`manage_payment`,category:`workspace`},{id:`manage_model`,category:`workspace`},{id:`view_audit_logs`,category:`workspace`},{id:`manage_capability`,category:`resource`},{id:`create_custom_connector`,category:`resource`},{id:`publish_custom_connector`,category:`resource`},{id:`create_agent`,category:`resource`},{id:`publish_agent`,category:`resource`},{id:`create_skill`,category:`resource`},{id:`publish_skill`,category:`resource`},{id:`create_workflow`,category:`resource`},{id:`review_resource_publish`,category:`resource`},{id:`manage_team`,category:`team`},{id:`manage_all_teams`,category:`team`},{id:`manage_chatbot`,category:`workspace`},{id:`manage_channel_agents`,category:`workspace`}].map(e=>e.id));L({permissions:I(d_)});const f_=L({en:B([`en-US`,`en-GB`]).optional(),zh:B([`zh-CN`,`zh-HK`,`zh-TW`]).optional(),es:B([`es-MX`,`es-ES`,`es-US`]).optional(),fr:B([`fr-FR`,`fr-CA`]).optional(),pt:B([`pt-PT`,`pt-BR`]).optional()}).strict(),p_=L({displayName:O().nullable(),jobTitle:O().nullable(),language:O().nullable(),customPreferences:O().nullable(),voiceLanguageVariants:f_.nullable(),updatedAt:H()});L({displayName:O().trim().max(100).nullable().optional(),jobTitle:O().trim().max(100).nullable().optional(),language:O().trim().max(100).nullable().optional(),customPreferences:O().trim().max(1e3).nullable().optional(),voiceLanguageVariants:f_.nullable().optional()}),L({workspaceId:j()}),p_.extend({updatedAt:H().nullable()}),L({workspaceId:j()}),L({workspaceId:j(),teamId:j(),publishId:j()}),L({workspaceId:j(),teamId:j()});const m_=[Zu.MEMBER,Zu.MANAGER,Zu.OWNER];L({resourceType:id,resourceId:j(),versionId:j().optional(),teamIds:I(j()).min(1).max(20).refine(e=>new Set(e).size===e.length,{message:`teamIds must not contain duplicates`}),message:O().trim().max(500).optional()}),L({roles:I(B(m_)).min(1).refine(e=>new Set(e).size===e.length,{message:`Roles must be unique`})}),L({roles:I(B(m_)).min(1).refine(e=>new Set(e).size===e.length,{message:`Roles must be unique`})}),L({items:I(L({id:j(),resource:sd,author:od,requester:od,teamId:j(),versionNumber:N().int().nullable(),status:B(ad),message:O().nullable(),roles:I(B(m_)).nullable(),reviewer:od.nullable(),reviewedAt:H().nullable(),rejectReason:O().nullable(),createdAt:H(),updatedAt:H()})),nextKey:O().optional()}),L({count:N().int()}),L({workspaceId:j()}),L({workspaceId:j(),publishId:j()}),L({resourceType:id,resourceId:j(),versionId:j().optional(),message:O().trim().max(500).optional()}),L({roleIds:I(j()).min(1).optional()}),L({roleIds:I(j()).nullable().optional()}),L({items:I(L({id:j(),resource:sd,author:od.nullable(),requester:od.nullable(),versionNumber:N().int().nullable(),workspaceId:j(),status:B(ad),message:O().nullable(),roleIds:I(j()).nullable(),reviewer:od.nullable(),reviewedAt:H().nullable(),rejectReason:O().nullable(),createdAt:H(),updatedAt:H()})),total:N().int().nonnegative(),nextKey:O().optional()}),L({resourceType:id.optional()}),L({count:N().int()}),[{extension:`mp3`,mimeTypes:[`audio/mpeg`]},{extension:`m4a`,mimeTypes:[`audio/mp4`,`audio/x-m4a`]},{extension:`wav`,mimeTypes:[`audio/wav`,`audio/wave`]},{extension:`mp4`,mimeTypes:[`video/mp4`]},{extension:`webm`,mimeTypes:[`audio/webm`,`video/webm`]},{extension:`aac`,mimeTypes:[`audio/aac`]},{extension:`ogg`,mimeTypes:[`audio/ogg`]},{extension:`flac`,mimeTypes:[`audio/flac`]},{extension:`mpeg`,mimeTypes:[`audio/mpeg`]}].map(({extension:e})=>`.${e}`),L({url:M(),title:O().trim().min(1).max(500).optional(),preferredLanguage:O().trim().min(2).max(10).regex(/^[a-zA-Z]{2,3}(-[a-zA-Z]{2,8})?$/,`Invalid language code format`).optional()}),L({recordingId:j(),source:V(`media`),message:O()}),L({url:M()}),L({url:O(),type:V(`media`),title:O(),duration:N().optional(),thumbnailUrl:O().optional(),contentType:O().optional(),fileSize:N().optional(),extractor:O().optional(),channelName:O().optional(),uploadDate:O().optional()}),L({downloadUrl:O(),playbackPending:P(),url:O()}),L({deploymentMode:rg,features:L({enableCapability:P(),enableCapabilityProviderSwitch:P(),enableChatbotSlack:P(),enableChatbotTeams:P(),enableProject:P(),enableScheduleActiveWindows:P(),enableScheduleJudge:P(),scheduleJudgeDefaultEnabled:P()})});const h_=L({id:j(),name:O(),email:A(),image:O().nullable().optional()}),g_=L({id:j(),name:O()});L({subjectType:nd,subjectId:j()}),L({grants:I(z(`subjectType`,[L({subjectType:V(td.USER),subjectId:j(),userId:j().optional(),role:ed,user:h_}),L({subjectType:V(td.TEAM),subjectId:j(),teamId:j().optional(),role:ed,team:g_})]))}),L({role:ed});function __(e){return e.subjectType===td.USER}function v_(e){return e.grants.filter(__)}L({workspaceId:j(),resourceType:id}),L({teams:I(L({id:j(),name:O()}))}),L({roles:I(L({id:j(),name:O(),description:O().optional(),isDefault:P(),memberCount:N().int(),permissions:I(O()),createdAt:H(),updatedAt:H()})),nextKey:O().optional()}),L({name:O().trim().min(1).max(100),description:O().trim().max(500).optional(),permissions:I(d_).min(1)}),L({name:O().trim().min(1).max(100),description:O().trim().max(500).optional(),permissions:I(d_).min(1)});const y_={},b_={};function x_(e,t){try{let n=(y_[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in b_?b_[n]:C_(n,n.split(`:`))}catch{if(e in b_)return b_[e];let t=e?.match(S_);return t?C_(e,t.slice(1)):NaN}}const S_=/([+-]\d\d):?(\d\d)?/;function C_(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return b_[e]=n*60+r>0?n*60+r+i:n*60-r-i}var w_=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(x_(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]==`number`&&(e.length===1||e.length===2&&typeof e[1]!=`number`)?this.setTime(e[0]):typeof e[0]==`string`?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),O_(this,e)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){let e=-x_(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),E_(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}};const T_=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!T_.test(e))return;let t=e.replace(T_,`$1UTC`);w_.prototype[t]&&(e.startsWith(`get`)?w_.prototype[e]=function(){return this.internal[t]()}:(w_.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),D_(this),+this},w_.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),E_(this),+this}))});function E_(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-x_(e.timeZone,e)*60))}function D_(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),O_(e)}function O_(e,t){let n=Array.isArray(t)?k_(t):+e.internal,r=x_(e.timeZone,e),i=r>0?Math.floor(r):Math.ceil(r),a=new Date(+e);a.setUTCHours(a.getUTCHours()-1);let o=-new Date(+e).getTimezoneOffset(),s=-new Date(+a).getTimezoneOffset(),c=o-s,l=o;if(c&&o!==i&&Date.prototype.getHours.apply(e)!==(Array.isArray(t)?t[3]||0:e.internal.getUTCHours())){let t=new Date(+e),n=o-i;n&&t.setUTCMinutes(t.getUTCMinutes()+n);let r=x_(e.timeZone,t);(r>0?Math.floor(r):Math.ceil(r))===i&&(l=s)}let u=l-i;u&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+u);let d=new Date(+e);d.setUTCSeconds(0);let f=o>0?d.getSeconds():(d.getSeconds()-60)%60,p=Math.round(-(x_(e.timeZone,e)*60))%60;(p||f)&&Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+p+f);let m=x_(e.timeZone,e),ee=m>0?Math.floor(m):Math.ceil(m),te=-new Date(+e).getTimezoneOffset()-ee,ne=ee!==i,re=te-u,ie=ee-i,ae=n-ee*60*1e3,h=ie>0&&A_(e)-n===ie*60*1e3&&A_(e,ae)!==n;if(ne&&re&&!h){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+re);let t=x_(e.timeZone,e),n=ee-(t>0?Math.floor(t):Math.ceil(t));n&&re<0&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n)}E_(e);let g=(t?n:n+p*1e3)-+e.internal;g&&Math.abs(g)<1800*1e3&&(Date.prototype.setTime.call(e,+e+g),E_(e))}function k_(e){return Date.UTC(e[0],e.length>1?e[1]:0,e.length>2?e[2]:1,...e.slice(3))}function A_(e,t){let n=new Date(t??+e);return n.setUTCSeconds(n.getUTCSeconds()-Math.round(-x_(e.timeZone,n)*60)),+n}const j_=O().length(12).regex(/^[a-z0-9]+$/u),M_=R([z(`mode`,[L({mode:V(`version`),versionId:j()}),L({mode:V(`work`),taskId:j()})]),L({mode:V(`file`),fileId:j()}),L({mode:V(`live`)})]);Ds({siteKey:j_,env:O().min(1),serve:M_,iat:N().optional(),exp:N().optional()});const N_=[`preview_site_ready`,`preview_site_publish`,`preview_site_read`,`preview_site_delete`];function P_(e,t){let n=new Set;for(let r of e){let e=t(r);if(n.has(e))return e;n.add(e)}}const F_=I(O().min(1)).superRefine((e,t)=>{let n=P_(e,e=>e);n&&t.addIssue({code:`custom`,message:`Duplicate path: ${n}`})});B(N_);const I_={env:O().min(1),sandboxDomain:O().min(1),sandboxId:O().min(1)},L_={...I_,siteDir:O().min(1).default(`app`)},R_={env:O().min(1),siteKey:j_},z_={...R_,serve:M_};z(`op`,[L({op:V(`preview_site_ready`),...L_}),L({op:V(`preview_site_publish`),...L_}),L({op:V(`preview_site_delete`),...I_})]),z(`op`,[L({op:V(`preview_site_ready`),...z_}),L({op:V(`preview_site_publish`),...z_}),L({op:V(`preview_site_read`),...z_}),L({op:V(`preview_site_delete`),...R_})]),L({files:I(L({path:O().min(1),contentBase64:ls(`Invalid base64 content`),contentType:O().optional()})).max(128).superRefine((e,t)=>{let n=P_(e,e=>e.path);n&&t.addIssue({code:`custom`,message:`Duplicate path: ${n}`})}),finalize:P().default(!0),manifestFiles:F_.optional()}).superRefine((e,t)=>{if(!e.finalize||!e.manifestFiles)return;let n=new Set(e.manifestFiles);for(let r of e.files)if(!n.has(r.path)){t.addIssue({code:`custom`,message:`Manifest is missing published file: ${r.path}`});return}}),L({filesUploaded:N().int().nonnegative(),filesDeleted:N().int().nonnegative()}),L({files:F_});const B_=Object.values({BUILT_IN:`built_in`,CUSTOM:`custom`}),V_=[`updatedAt`,`name`];ml.extend({createdBy:B([`me`]).optional(),search:O().trim().max(200).optional(),sortBy:B(V_).optional()});const H_=L({id:j(),name:O(),isMe:P()}),U_=L({id:j()}).nullable(),W_=L({id:j(),name:O(),description:O(),type:B(B_).optional(),provider:O().nullable(),author:H_.nullable(),publish:U_,publishedTo:ld.optional(),team:L({id:j(),name:O()}).optional().describe(`The team this skill is published to, only present when createdBy is team`),versionNumber:N().int().nullable().optional(),isEnabled:P(),myRole:rd,createdAt:H(),updatedAt:H()});L({skills:I(W_),nextKey:O().optional()}),L({workspaceId:j(),skillId:j(),versionId:j()});const G_=L({id:j(),name:O()}),K_=L({id:j(),versionNumber:N().int().min(1),description:O(),createdBy:G_,createdAt:H()});L({skillId:j(),skillName:O(),versions:I(K_)}),L({url:M()}),L({search:O().trim().max(200).optional(),status:B(vd).optional(),nextKey:O().optional(),limit:U().int().min(1).max(100).default(20),sortBy:B(V_).optional()}),L({skills:I(L({id:j(),name:O(),description:O().optional(),hasUnpublishedChanges:P(),latestVersionNumber:N().int().nullable(),publishedTo:ld.optional(),myRole:rd,createdAt:H(),updatedAt:H()})),nextKey:O().optional(),totalCount:N().int().nonnegative(),statusCounts:yd}),ml.extend({createdBy:B([`workspace`,`team`,`me`]).optional(),teamId:j().optional(),search:O().trim().max(200).optional(),sortBy:B(V_).optional()}).refine(e=>!e.teamId||e.createdBy===`team`,{message:`teamId can only be used with createdBy: team`,path:[`teamId`]}),L({field:O(),message:O()}),L({workspaceId:j(),skillId:j()}),L({isEnabled:P()}),L({isEnabled:P()}),L({skills:I(W_),nextKey:O().optional()}),L({workspaceId:j(),skillId:j()});const q_=L({path:O(),size:N().int().nonnegative()});L({skillId:j(),skillName:O(),description:O(),versionId:j(),files:I(q_)}),L({workspaceId:j(),skillId:j()}),L({path:O().trim().min(1).max(1024)}),z(`kind`,[L({kind:V(`text`),path:O(),size:N().int().nonnegative(),content:O()}),L({kind:V(`image`),path:O(),size:N().int().nonnegative(),content:O()}),L({kind:V(`binary`),path:O(),size:N().int().nonnegative()}),L({kind:V(`too_large`),path:O(),size:N().int().nonnegative()})]);const J_=B([`queued`,`running`,`completed`,`failed`,`cancelled`]),Y_=J_,X_=B([`subagent`,`workflow`]);function Z_(e){return e===`subagent`?`subagentRuns`:`workflowRuns`}const Q_=new Set([`completed`,`failed`,`cancelled`]);function $_(e){return Q_.has(e)}function ev(e){return e.at(-1)?.toolCallCount??0}L({runs:I(L({runId:O(),kind:X_,status:Y_,label:O(),startedAt:O().nullable(),createdAt:O()}))}),L({runId:j(),status:J_,startedAt:O().nullable(),progress:cc().nullable().meta({type:`object`}),result:cc().nullable().meta({type:`object`}),error:cc().nullable().meta({type:`object`})});const tv=B([`chatgpt`]),nv=B([`active`,`expired`,`needs_reauth`,`quota_exhausted`,`error`]),rv=Nl,iv=L({observedAt:H(),windows:Fs(O(),rv)}),av=L({id:j(),provider:tv,label:O(),accountId:O(),status:nv,quotaResetAt:H().nullable(),quota:iv.nullable(),lastCheckedAt:H().nullable(),createdAt:H()});L({accounts:I(av)}),L({accountIds:I(j()).min(1)}),L({provider:tv,label:O().trim().min(1).max(100).optional()}),L({provider:tv}),L({status:B([`pending`,`connected`,`error`]),account:av.nullable(),lastError:O().nullable()}),L({errorMessage:O().min(1).max(1e3),url:M().max(2e3).optional(),userAgent:O().max(500),workspaceId:j().optional(),sentryEventId:O().max(64).optional(),description:O().max(5e3).nullable()}),L({requestId:N().int()}),B([`step_limit`,`usage_exhausted`,`output_limit`,`retry_limit`]);const ov=[`pending`,`running`,`completed`,`failed`,`cancelled`],sv=[`input`,`output`],cv=B(ov),lv=B(sv),uv=L({taskAssetId:j(),role:lv}),dv=L({id:j(),position:N().int().positive().nullable(),title:O(),status:cv,startedAt:pc().nullable(),finishedAt:pc().nullable(),assets:I(uv)}),fv=L({id:j(),taskRunId:j(),revision:N().int().nonnegative(),items:I(dv)}),pv=dv.extend({startedAt:H().nullable(),finishedAt:H().nullable()});fv.extend({items:I(pv)}),L({workspaceId:j()}),L({workspaceId:j(),teamId:j()}),L({workspaceId:j(),teamId:j(),userId:j()});const mv=[Zu.OWNER,Zu.MANAGER,Zu.MEMBER],hv=[Qu.VISIBLE,Qu.HIDDEN],gv=[Zu.OWNER,Zu.MANAGER,Zu.MEMBER],_v=L({email:A(),role:B(gv)});L({name:O().trim().min(1).max(100),description:O().trim().max(500).nullable().default(null),visibility:B(hv).optional(),requireReview:P().optional(),acceptExternalSubmissions:P().optional(),members:I(_v).min(1).max(50).optional()}),L({name:O().trim().min(1).max(100).optional(),description:O().trim().max(500).nullable().optional(),visibility:B(hv).optional(),requireReview:P().optional(),acceptExternalSubmissions:P().optional()}).refine(e=>e.name!==void 0||e.description!==void 0||e.visibility!==void 0||e.requireReview!==void 0||e.acceptExternalSubmissions!==void 0,{message:`At least one field must be provided`}),L({members:I(_v).min(1).max(50)}),L({role:B(gv)});const vv=L({id:j(),name:O()});L({teams:I(L({id:j(),name:O(),description:O().nullable(),visibility:B(hv),requireReview:P(),acceptExternalSubmissions:P(),memberCount:N().int(),currentUserRole:B(mv).nullable(),createdBy:vv,createdAt:H(),updatedAt:H()}).extend({publishPendingCount:N().int(),published:P().optional()})),nextKey:O().optional()}),ml.extend({search:O().trim().max(200).optional(),resourceType:id.optional(),resourceId:j().optional()}),L({members:I(L({userId:j(),name:O(),email:O(),role:B(mv),createdAt:H()})),total:N().int().nonnegative()}),hl.extend({search:O().trim().max(200).optional()}),L({platform:B([`posthog`,`sentry`,`zendesk`])}),L({id:j()});const yv={MANUAL:`manual`,AUTO_LEARNED:`auto_learned`},bv=L({id:j(),word:O(),source:B([yv.MANUAL,yv.AUTO_LEARNED]),createdAt:H()});L({word:O().trim().min(1).max(200)}),L({limit:U().int().min(1).max(100).default(100),nextKey:O().optional()}),L({words:I(bv),nextKey:O().optional()}),L({workspaceId:j(),wordId:j()}),L({workspaceId:j()});const xv=1e3,Sv=B([`personal`,`team`,`workspace`]),Cv=B([`manual`,`auto_learned`]),wv=L({id:j(),workspaceId:j(),scope:Sv,userId:j().nullable(),teamId:j().nullable(),term:O(),usageContext:O().nullable(),source:Cv,createdBy:j().nullable(),createdAt:H(),updatedAt:H()}),Tv=L({workspaceId:j()}),Ev=Tv.extend({teamId:j()});Tv.extend({entryId:j()}),Ev.extend({entryId:j()}),L({limit:U().int().min(1).max(100).default(100),nextKey:O().optional()}),L({entries:I(wv),nextKey:O().optional()});const Dv=O().trim().min(1).max(200);L({term:Dv,usageContext:O().trim().max(xv).nullable().optional()}),L({term:Dv.optional(),usageContext:O().trim().max(xv).nullable().optional()}).refine(e=>Object.keys(e).length>0,{message:`At least one field is required`});const Ov=Fs(O(),F()),kv=O().min(1).max(64).regex(/^[a-z][a-z0-9_]*$/,`node id must be lower_snake_case`),Av=B(Fu),jv=R([V(`auto`),Av]),Mv=B([`routine`,`reasoning`,`judgment`]),Nv=B([`implicit_auto`,`fanout_max_excluded`,`only_enabled_tier`,`single_eligible_tier`,`tier_unavailable`]),Pv=L({requestedTier:jv,classifiedDemand:Mv.optional(),selectedTier:Av,source:B([`pinned`,`classified`,`fallback`,`policy`,`chat-router`]),constraints:I(Nv),policyVersion:B([`chat-router-v1`,`workflow-v1`])});L({id:kv,label:O().min(1).max(120)}).extend({kind:V(`agent`),promptTemplate:O().min(1),agentId:j().optional(),toolAllowlist:I(O()).optional(),outputSchema:Ov.optional(),modelSelection:jv.optional(),maxSteps:N().int().min(1).max(50).optional()}),L({status:B([`queued`,`running`,`done`,`failed`]),output:F().optional(),error:O().optional(),durationMs:N().int().optional(),tokens:N().int().optional(),usage:L({inputTokens:N().int(),outputTokens:N().int(),totalTokens:N().int(),reasoningTokens:N().int(),cachedInputTokens:N().int(),cachedCreationTokens:N().int(),model:O().optional()}).optional(),fanOut:L({total:N().int(),done:N().int(),failed:N().int(),running:N().int()}).optional(),label:O().optional(),kind:B([`agent`,`fan_out`]).optional(),seq:N().int().optional(),prompt:O().optional(),invocation:L({schema:F().optional(),toolAllowlist:I(O()).optional(),agentId:O().optional(),maxSteps:N().int().optional(),model:jv.optional()}).optional(),modelAllocation:Pv.optional(),stepCount:N().int().optional(),toolCalls:I(L({name:O(),summary:O()})).optional(),phaseId:O().optional(),phaseSeq:N().int().optional()}),L({workflows:I(L({id:j(),name:O(),description:O().nullable(),scriptSource:O(),isActive:P(),createdAt:H(),updatedAt:H(),myRole:rd})),nextKey:O().optional()});const Fv=B([`queued`,`running`,`completed`,`failed`,`cancelled`]),Iv=L({id:j(),status:Fv,startedAt:H().nullable(),completedAt:H().nullable(),error:F().nullable(),createdAt:H()});L({runs:I(Iv),nextKey:O().optional()}),Iv.extend({workflowId:j(),context:cc().meta({type:`object`}),scriptSnapshot:O(),args:F().nullable()});const Lv=B([`invite-only`,`open`]),Rv=O().min(1,`Workspace name is required`).max(50,`Workspace name must be 50 characters or less`).regex(/^[\p{L}\p{N} ._-]+$/u,`Workspace name can only contain letters, numbers, spaces, dashes, underscores, and periods`).refine(e=>e===e.trim(),{message:`Workspace name cannot start or end with spaces`}),zv=L({name:O().trim().min(1).max(50),latinName:O().trim().max(50).nullable().optional(),logoIconId:j(),faviconIconId:j().nullable().optional()}),Bv=L({name:O().trim().min(1).max(50),latinName:O().trim().max(50).nullable().optional(),logoUrl:O().min(1),faviconUrl:O().nullable().optional()}),Vv=L({id:O(),name:O(),userCount:N(),config:L({branding:Bv.nullable().optional(),additionalModelsEnabled:P().optional(),subscriptionModelsEnabled:P().optional(),subscriptionPoolEnabled:P().optional(),managedAgentEnabled:P().optional(),autopilotEnabled:P().optional(),subscriptionPoolFallbackModelId:zu.nullable().optional()}).optional(),createdAt:H(),updatedAt:H()});L({workspaces:I(Vv)}),L({workspaces:I(Vv.extend({config:L({joinPolicy:Lv})}))}),L({joined:P()}),L({name:Rv,ownerId:j()}),L({name:Rv});const Hv=O().trim().toLowerCase().max(253).regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/,`Invalid email domain`);L({hideThinking:P().optional(),joinPolicy:Lv.optional(),allowedDomains:I(O()),defaultToolApprovalMode:rf.optional(),requireReview:P().optional(),shareSensitiveScanEnabled:P().optional(),maxShareVisibility:Vf.optional(),maxPreviewVisibility:Vf.optional(),disabledModelTiers:I(B(Fu)).optional(),additionalModelsEnabled:P().optional(),subscriptionModelsEnabled:P().optional(),subscriptionPoolEnabled:P().optional(),managedAgentEnabled:P().optional(),autopilotEnabled:P().optional(),subscriptionPoolFallbackModelId:zu.nullable().optional(),autoTierDisabled:P().optional(),chatbotSlackEffectivelyEnabled:P().optional(),chatbotTeamsEffectivelyEnabled:P().optional(),systemPrompt:O().trim().max(1e3).nullable().optional()}),L({email:A(),name:O(),roles:I(O()),permissions:I(d_)});const Uv=B([`requested`,`approved`,`rejected`]);L({workspaceId:j(),invitationId:j()}),L({email:A(),status:Uv,workspace:L({id:j(),name:O()})}),L({invitations:I(L({id:j(),workspaceId:j(),email:A(),status:Uv,role:O(),requestedSeatType:kl,invitedBy:L({email:A(),name:O(),isMe:P()}).optional(),invitedAt:H().optional(),expiresAt:H().optional(),createdAt:H(),updatedAt:H()})),total:N().int().nonnegative()}),hl.extend({status:Uv.optional(),search:O().trim().max(200).optional()});const Wv=L({starter:N().int().nonnegative(),pro:N().int().nonnegative(),premium:N().int().nonnegative()}),Gv=L({id:O(),email:O()}),Kv=L({id:O(),name:O(),owners:I(Gv),userCount:N().int().nonnegative(),paidSeatCount:N().int().nonnegative(),seatCountsByType:Wv,createdAt:H(),updatedAt:H()});hl.extend({search:O().trim().max(200).optional(),exact:dc().optional(),sortBy:B([`createdAt`,`userCount`,`paidSeatCount`]).default(`createdAt`),order:B(gl).default(`desc`)}),L({workspaces:I(Kv),total:N().int().nonnegative()}),L({workspaceId:j()});const qv=L({purchasedUsd:N().nonnegative(),grantedUsd:N().nonnegative(),totalUsd:N().nonnegative(),nextExpiry:L({amountUsd:N().nonnegative(),expiresAt:H()}).nullable()}),Jv=L({id:O(),email:O(),name:O(),seatType:kl.nullable(),joinedAt:H(),loginMethods:I(B(Vl)),lastLoginAt:H().nullable(),passwordSetupEmailSentAt:H().nullable()}),Yv=L({enabled:P(),modelIds:I(O())}),Xv=L({id:O(),name:O()}),Zv=L({slackEnabled:P(),slackAvailable:P(),teamsEnabled:P(),teamsAvailable:P(),defaultAgentId:O().nullable(),ownerPanelDisabled:P(),inheritsLegacySettings:P(),agents:I(Xv)});L({slackEnabled:P(),teamsEnabled:P(),defaultAgentId:j().nullable(),ownerPanelDisabled:P()});const Qv=zv.extend({logoUrl:O(),faviconUrl:O().nullable().optional()});L({branding:zv.nullable()}),L({logoIconId:j(),faviconIconId:j(),logoUrl:O(),faviconUrl:O()}),L({id:O(),name:O(),owners:I(Gv),userCount:N().int().nonnegative(),paidSeatCount:N().int().nonnegative(),seatCountsByType:Wv,extraUsage:qv,members:I(Jv),allowedDomains:I(O()),advancedModels:Yv,chatbotSettings:Zv,managedAgentEnabled:P(),autopilotEnabled:P(),branding:Qv.nullable(),createdAt:H(),updatedAt:H()}),L({allowedDomains:I(Hv).max(50)}),L({enabled:P(),modelIds:I(O().trim().min(1).max(200)).max(100)}),L({enabled:P()}),L({enabled:P()});const $v=L({id:j(),userId:j(),workspaceId:j(),year:N(),month:N(),totalCost:O(),operationCount:N(),createdAt:H(),updatedAt:H(),user:L({id:j(),name:O(),email:O()}),budgetOverride:L({budget:O().nullable()}).nullable().optional()});ml.extend({search:O().trim().max(200).optional()}),L({monthlyUsages:I($v),nextKey:O().optional()});const ey=[`apiUrl`,`hubUrl`];function ty(e){let t=$.getEffectiveProfileName(e);return $.getProfileConfigFile(t)}function Z(e){let t=ty(e);try{if(!n.existsSync(t))return{};let e=n.readFileSync(t,`utf-8`);return JSON.parse(e)}catch{return{}}}function ny(e,t){let r=$.getEffectiveProfileName(t);$.ensureProfileDir(r);let i=$.getProfileConfigFile(r);n.writeFileSync(i,JSON.stringify(e,null,2),{mode:384});try{n.chmodSync(i,384)}catch{}}const ry={getApiUrl(e){return Z(e).apiUrl??null},setApiUrl(e,t){let n=Z(t);n.apiUrl=e,ny(n,t)},clearApiUrl(e){let t=Z(e);delete t.apiUrl,ny(t,e)},getHubUrl(e){return Z(e).hubUrl??null},setHubUrl(e,t){let n=Z(t);n.hubUrl=e,ny(n,t)},getAll(e){return Z(e)},setAll(e,t){ny(e,t)},set(e,t,n){let r=Z(n);r[e]=t,ny(r,n)},get(e,t){return Z(t)[e]},unset(e,t){let n=Z(t);delete n[e],ny(n,t)},getDefaultModel(e){return Z(e).model?.default??null},setDefaultModel(e,t){let n=Z(t);n.model={...n.model,default:e},ny(n,t)},getDefaultConnectorIds(e){return Z(e).connectors?.defaults??null},setDefaultConnectorIds(e,t){let n=Z(t);n.connectors={...n.connectors,defaults:e},ny(n,t)},getLocalTools(e){return Z(e).localTools??null},setLocalTools(e,t){let n=Z(t);n.localTools={...n.localTools,...e},ny(n,t)},getToolApprovalMode(e){let t=rf.safeParse(Z(e).toolApprovalMode);return t.success?t.data:null},setToolApprovalMode(e,t){let n=Z(t);n.toolApprovalMode=e,ny(n,t)},clearToolApprovalMode(e){let t=Z(e);delete t.toolApprovalMode,ny(t,e)}},iy=`ENTRYDESK_MCP_TIMEOUT`,ay=`ENTRYDESK_MCP_MAX_TIMEOUT`;function oy(e,t){let n=process.env[e];if(!n)return t;let r=Number(n);return Number.isSafeInteger(r)&&r>0?Math.min(r,2147483647):t}function sy(e){let t=oy(iy,3e5);return{apiUrl:process.env.ENTRYDESK_API_URL||ry.getApiUrl(e)||`https://api.entrydesk.com`,hubUrl:process.env.ENTRYDESK_HUB_URL||ry.getHubUrl(e)||`https://app.entrydesk.com`,mcp:{httpPort:3100,requestTimeout:t,requestMaxTotalTimeout:Math.max(oy(ay,18e5),t)},auth:{loginTimeout:3e5,ignoreSslErrors:process.env.ENTRYDESK_IGNORE_SSL_ERRORS===`true`||!1}}}function cy(e){return sy(e).apiUrl}function ly(e){return sy(e).hubUrl}function uy(e,t){return`${ly(t).replace(/\/$/u,``)}${e}`}function dy(){return sy().auth}function fy(){return sy().mcp}function py(e){if(typeof e!=`object`||!e)return{error:``};let t=e;return{code:typeof t.code==`string`?t.code:void 0,error:typeof t.error==`string`?t.error:``}}const my=/^[a-z0-9_.-]{1,64}$/iu;function hy(e){let t=py(e).code;return t&&my.test(t)?t:void 0}function gy(e){return[...e].filter(e=>{let t=e.codePointAt(0)??0;return!(t<=31)&&t!==127&&!(t>=128&&t<=159)}).join(``)}const _y=`EntryDesk CLI`,vy={keychain:!1,permissions:!1,corruptFile:!1,windowsFile:!1};function yy(e,t){vy[e]||(vy[e]=!0,console.error(t))}function by(){return process.env.ENTRYDESK_DEBUG?.toLowerCase()===`true`}function xy(e){if(!e||typeof e!=`object`)return!1;let t=e;return!(!(`accessToken`in t||`refreshToken`in t||`email`in t||`workspaceId`in t)||`accessToken`in t&&typeof t.accessToken!=`string`||`refreshToken`in t&&typeof t.refreshToken!=`string`||`email`in t&&typeof t.email!=`string`||`workspaceId`in t&&typeof t.workspaceId!=`string`)}function Sy(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.getPassword==`function`&&typeof t.setPassword==`function`&&typeof t.deletePassword==`function`}function Cy(e){return $.getProfileCredentialsFile(e)}var wy=class{getKeyFilePath(e){return i.join($.getProfileDir(e),`.credentials.key`)}loadEncryptionKey(e){let t=this.getKeyFilePath(e);try{if(!n.existsSync(t))return null;let e=n.readFileSync(t);return e.length===32?(this.ensureSecureFilePermissions(t),e):null}catch{return null}}createEncryptionKey(e){$.ensureProfileDir(e);let t=this.getKeyFilePath(e),r=u.randomBytes(32);return n.writeFileSync(t,r,{mode:384}),this.ensureSecureFilePermissions(t),r}getOrCreateEncryptionKey(e){return this.loadEncryptionKey(e)||this.createEncryptionKey(e)}encrypt(e,t){let n=u.randomBytes(16),r=u.createCipheriv(`aes-256-gcm`,t,n),i=r.update(e,`utf8`,`hex`);i+=r.final(`hex`);let a=r.getAuthTag();return`${n.toString(`hex`)}:${a.toString(`hex`)}:${i}`}decrypt(e,t){let n=e.split(`:`);if(n.length!==3)throw Error(`Invalid encrypted data format`);let r=Buffer.from(n[0],`hex`),i=Buffer.from(n[1],`hex`),a=n[2],o=u.createDecipheriv(`aes-256-gcm`,t,r,{authTagLength:16});o.setAuthTag(i);let s=o.update(a,`hex`,`utf8`);return s+=o.final(`utf8`),s}tryDecrypt(e,t){try{return this.decrypt(e,t)}catch{return null}}tryParseCredentials(e){try{let t=JSON.parse(e);return xy(t)?t:null}catch{return null}}ensureSecureFilePermissions(e){if(process.platform!==`win32`){try{n.chmodSync(e,384)}catch{yy(`permissions`,`Warning: Failed to set secure permissions on credentials file.`);return}try{(n.statSync(e).mode&511)!=384&&yy(`permissions`,`Warning: Credentials file permissions are too permissive.`)}catch{yy(`permissions`,`Warning: Failed to verify credentials file permissions.`)}}}async getCredentials(e){let t=Cy(e);try{if(!n.existsSync(t))return null;let r=n.readFileSync(t,`utf-8`).trim();if(!r)return null;let i=this.loadEncryptionKey(e),a=i?this.tryDecrypt(r,i):null;if(a){let e=this.tryParseCredentials(a);if(e)return e}return yy(`corruptFile`,"Warning: Credentials file is unreadable. Run `entrydesk login` again."),null}catch{return null}}async setCredentials(e,t){$.ensureProfileDir(e);let r=Cy(e),i=this.getOrCreateEncryptionKey(e),a=this.encrypt(JSON.stringify(t),i);n.writeFileSync(r,a,{mode:384}),this.ensureSecureFilePermissions(r)}async deleteCredentials(e){let t=Cy(e);try{n.existsSync(t)&&n.unlinkSync(t)}catch{}}},Ty=class{keytarModule=null;keytarLoadAttempted=!1;keychainAvailable=null;async getKeytar(){if(this.keytarLoadAttempted)return this.keytarModule;this.keytarLoadAttempted=!0;try{let e=await import(`keytar`),t=e&&typeof e==`object`&&`default`in e?e.default:e;this.keytarModule=Sy(t)?t:null}catch{this.keytarModule=null}return this.keytarModule}getAccount(e){return`profile:${e}`}async checkKeychainAvailability(){if(this.keychainAvailable!==null)return this.keychainAvailable;try{let e=await this.getKeytar();if(!e)return this.keychainAvailable=!1,!1;let t=`__entrydesk_keychain_test__${u.randomBytes(8).toString(`hex`)}`,n=`test`;await e.setPassword(_y,t,n);let r=await e.getPassword(_y,t),i=await e.deletePassword(_y,t);return this.keychainAvailable=i&&r===n,this.keychainAvailable}catch{return this.keychainAvailable=!1,!1}}async isAvailable(){return this.checkKeychainAvailability()}async getCredentials(e){if(!await this.checkKeychainAvailability())throw Error(`Keychain is not available`);let t=await this.getKeytar();if(!t)throw Error(`Keytar module not available`);let n=await t.getPassword(_y,this.getAccount(e));if(!n)return null;let r=this.tryParseKeychainPayload(n);return r||yy(`corruptFile`,`Warning: Keychain entry for profile "${e}" is unreadable.`),r}async setCredentials(e,t){if(!await this.checkKeychainAvailability())throw Error(`Keychain is not available`);let n=await this.getKeytar();if(!n)throw Error(`Keytar module not available`);let r=JSON.stringify(t);await n.setPassword(_y,this.getAccount(e),r)}async deleteCredentials(e){if(!await this.checkKeychainAvailability())throw Error(`Keychain is not available`);let t=await this.getKeytar();if(!t)throw Error(`Keytar module not available`);await t.deletePassword(_y,this.getAccount(e))}tryParseKeychainPayload(e){try{let t=JSON.parse(e);return xy(t)?t:null}catch{return null}}};const Q=new class{keychainStorage=null;fileStorage=new wy;keychainAvailable=null;initPromise=null;shouldForceFileStorage(){return process.env.ENTRYDESK_FORCE_FILE_STORAGE?.toLowerCase()===`true`}async initializeStorage(){if(this.shouldForceFileStorage()){this.keychainAvailable=!1,this.keychainStorage=null;return}try{let e=new Ty,t=await e.isAvailable();this.keychainAvailable=t,this.keychainStorage=t?e:null}catch{this.keychainAvailable=!1,this.keychainStorage=null}!this.keychainAvailable&&!this.shouldForceFileStorage()&&(by()&&yy(`keychain`,`Keychain unavailable. Falling back to file-based credentials.`),process.platform===`win32`&&yy(`windowsFile`,`Warning: File-based credentials on Windows may be readable by other users.`))}async ensureInitialized(){if(this.shouldForceFileStorage()){this.keychainAvailable=!1,this.keychainStorage=null;return}this.keychainAvailable===null&&(this.initPromise??=this.initializeStorage(),await this.initPromise)}disableKeychain(){this.shouldForceFileStorage()||yy(`keychain`,`Keychain error encountered. Falling back to file-based credentials.`),this.keychainAvailable=!1,this.keychainStorage=null}async getKeychainStorage(){return await this.ensureInitialized(),this.shouldForceFileStorage()?null:this.keychainAvailable?this.keychainStorage:null}async getCredentials(e){let t=await this.getKeychainStorage();if(!t)return this.fileStorage.getCredentials(e);try{let n=await t.getCredentials(e);if(n)return n}catch{return this.disableKeychain(),this.fileStorage.getCredentials(e)}let n=await this.fileStorage.getCredentials(e);if(n)try{await t.setCredentials(e,n),await this.fileStorage.deleteCredentials(e)}catch{}return n}async setCredentials(e,t){let n=await this.getKeychainStorage();if(!n){await this.fileStorage.setCredentials(e,t);return}try{await n.setCredentials(e,t),await this.fileStorage.deleteCredentials(e)}catch{this.disableKeychain(),await this.fileStorage.setCredentials(e,t)}}async deleteCredentials(e){let t=await this.getKeychainStorage();if(t)try{await t.deleteCredentials(e)}catch{this.disableKeychain()}await this.fileStorage.deleteCredentials(e)}},Ey={async saveAccessToken(e,t){let n=$.getEffectiveProfileName(t),r=await Q.getCredentials(n)??{};r.accessToken=e,await Q.setCredentials(n,r)},async getAccessToken(e){let t=$.getEffectiveProfileName(e);return(await Q.getCredentials(t))?.accessToken??null},async saveRefreshToken(e,t){let n=$.getEffectiveProfileName(t),r=await Q.getCredentials(n)??{};r.refreshToken=e,await Q.setCredentials(n,r)},async getRefreshToken(e){let t=$.getEffectiveProfileName(e);return(await Q.getCredentials(t))?.refreshToken??null},async saveEmail(e,t){let n=$.getEffectiveProfileName(t),r=await Q.getCredentials(n)??{};r.email=e,await Q.setCredentials(n,r)},async getEmail(e){let t=$.getEffectiveProfileName(e);return(await Q.getCredentials(t))?.email??null},async saveWorkspaceId(e,t){let n=$.getEffectiveProfileName(t),r=await Q.getCredentials(n)??{};r.workspaceId=e,await Q.setCredentials(n,r)},async getWorkspaceId(e){let t=$.getEffectiveProfileName(e);return(await Q.getCredentials(t))?.workspaceId??null},async saveAll(e,t){let n=$.getEffectiveProfileName(t);await Q.setCredentials(n,e)},async getAll(e){let t=$.getEffectiveProfileName(e);return Q.getCredentials(t)},async clear(e){let t=$.getEffectiveProfileName(e);await Q.deleteCredentials(t)},async moveProfileCredentials(e,t){let n=await Q.getCredentials(e);n&&(await Q.setCredentials(t,n),await Q.deleteCredentials(e))},async deleteProfileCredentials(e){await Q.deleteCredentials(e)},async isLoggedIn(e){let t=$.getEffectiveProfileName(e);return(await Q.getCredentials(t))?.accessToken!=null}};function Dy(){let e=process.env.X_WEB_PROXY_ID;return e?{"x-web-proxy-id":e}:{}}function Oy(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return;let{code:n}=t;return typeof n==`string`?n:void 0}catch{return}}function ky(e){return{...e,title:gy(e.title),...e.project&&{project:{...e.project,name:gy(e.project.name)}}}}function Ay(e){return{...e,tasks:e.tasks.map(ky)}}function jy(e){return{...e,results:e.results.map(e=>({...e,title:gy(e.title),titleHighlight:e.titleHighlight&&gy(e.titleHighlight),contentSnippet:e.contentSnippet&&gy(e.contentSnippet)}))}}var My=class extends Error{status;code;constructor(e,t){super(`Task API failed (${e}): ${t}`),this.status=e,this.name=`TaskApiError`,this.code=Oy(t)}};function Ny(e){let t=new FormData;return t.append(`file`,new Blob([e.buffer],{type:e.mimeType}),e.filename),t}var Py=class e{client;baseUrl;runtimeConfigCache;constructor(e,t){this.baseUrl=e||cy(t),dy().ignoreSslErrors&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED=`0`,process.env.DEBUG&&console.log(`[DEBUG] ApiClient: SSL certificate validation disabled`)),this.client=a.create({baseUrl:this.baseUrl.replace(/\/?$/,`/`),timeout:3e4,headers:Dy(),retry:{limit:3,methods:[`get`,`put`,`head`,`delete`,`options`,`trace`],statusCodes:[408,413,429,500,502,503,504]},hooks:{beforeError:[({error:e})=>(c(e)&&(e.request.headers.delete(`authorization`),e.request.headers.delete(`Authorization`),e.request.headers.delete(`x-web-proxy-id`)),e)]}})}getBaseUrl(){return this.baseUrl}async refreshOAuthToken(e){return this.client.post(`v1/oauth/token`,{json:{grant_type:`refresh_token`,refresh_token:e.refreshToken,client_id:e.clientId}}).json()}async revokeOAuthToken(e){await this.client.post(`v1/oauth/revoke`,{json:{token:e.token,token_type_hint:`refresh_token`,client_id:e.clientId}})}async getWorkspaces(e){try{return process.env.DEBUG&&console.log(`[DEBUG] Calling getWorkspaces API: ${this.baseUrl}/v1/workspaces`),await this.client.get(`v1/workspaces`,{headers:{Authorization:`Bearer ${e}`}}).json()}catch(e){throw process.env.DEBUG&&(console.error(`[DEBUG] getWorkspaces error:`,e),e instanceof Error&&`cause`in e&&console.error(`[DEBUG] Error cause:`,e.cause)),e}}async getAgents(e,t,n){let r={limit:n?.limit??100};return n?.nextKey&&(r.nextKey=n.nextKey),n?.search&&(r.search=n.search),await this.client.get(`v1/workspaces/${t}/availableAgents`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async createAgent(e,t,n){return await this.client.post(`v1/workspaces/${t}/agents`,{headers:{Authorization:`Bearer ${e}`},json:n}).json()}async updateAgent(e,t,n,r){await this.client.put(`v1/workspaces/${t}/agents/${n}`,{headers:{Authorization:`Bearer ${e}`},json:r})}async deleteAgent(e,t,n){await this.client.delete(`v1/workspaces/${t}/agents/${n}`,{headers:{Authorization:`Bearer ${e}`}})}async getMyAgents(e,t,n){let r={limit:n?.limit??100};return n?.nextKey&&(r.nextKey=n.nextKey),n?.search&&(r.search=n.search),await this.client.get(`v1/workspaces/${t}/myAgents`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async publishAgent(e,t,n){await this.client.post(`v1/workspaces/${t}/agents/${n}/publish`,{headers:{Authorization:`Bearer ${e}`}})}async getAgentGrants(e,t,n){return await this.client.get(`v1/workspaces/${t}/agents/${n}/grants`,{headers:{Authorization:`Bearer ${e}`}}).json()}async upsertAgentGrant(e,t,n,r,i){return await this.client.put(`v1/workspaces/${t}/agents/${n}/grants/${r}`,{headers:{Authorization:`Bearer ${e}`},json:{role:i}}).json()}async removeAgentGrant(e,t,n,r){await this.client.delete(`v1/workspaces/${t}/agents/${n}/grants/${r}`,{headers:{Authorization:`Bearer ${e}`}})}async getMeetings(e,t,n){let r={limit:n?.limit??20};return n?.nextKey&&(r.nextKey=n.nextKey),n?.search&&(r.search=n.search),n?.filter&&(r.filter=n.filter),n?.sortBy&&(r.sortBy=n.sortBy),await this.client.get(`v1/workspaces/${t}/meetings`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async getMeeting(e,t,n){return await this.client.get(`v1/workspaces/${t}/meetings/${n}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async createMeeting(e,t,n){return await this.client.post(`v1/workspaces/${t}/meetings`,{headers:{Authorization:`Bearer ${e}`},json:n}).json()}async updateMeeting(e,t,n,r){return await this.client.patch(`v1/workspaces/${t}/meetings/${n}`,{headers:{Authorization:`Bearer ${e}`},json:r}).json()}async deleteMeeting(e,t,n){await this.client.delete(`v1/workspaces/${t}/meetings/${n}`,{headers:{Authorization:`Bearer ${e}`}})}async getMeetingPreviousBrief(e,t,n){return await this.client.get(`v1/workspaces/${t}/meetings/${n}/previous`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getRecording(e,t,n){return await this.client.get(`v1/workspaces/${t}/recordings/${n}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getMeetingShares(e,t,n){return await this.client.get(`v1/workspaces/${t}/meetings/${n}/shares`,{headers:{Authorization:`Bearer ${e}`}}).json()}async upsertMeetingUserGrant(e,t,n,r,i){return await this.client.put(`v1/workspaces/${t}/meetings/${n}/shares/users/${r}`,{headers:{Authorization:`Bearer ${e}`},json:{role:i}}).json()}async removeMeetingUserGrant(e,t,n,r){await this.client.delete(`v1/workspaces/${t}/meetings/${n}/shares/users/${r}`,{headers:{Authorization:`Bearer ${e}`}})}async upsertMeetingTeamGrant(e,t,n,r,i){return await this.client.put(`v1/workspaces/${t}/meetings/${n}/shares/teams/${r}`,{headers:{Authorization:`Bearer ${e}`},json:{role:i}}).json()}async removeMeetingTeamGrant(e,t,n,r){await this.client.delete(`v1/workspaces/${t}/meetings/${n}/shares/teams/${r}`,{headers:{Authorization:`Bearer ${e}`}})}async getWorkflows(e,t,n){let r={limit:n?.limit??20};return n?.nextKey&&(r.nextKey=n.nextKey),n?.search&&(r.search=n.search),await this.client.get(`v1/workspaces/${t}/workflows`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async getWorkflow(e,t,n){return await this.client.get(`v1/workspaces/${t}/workflows/${n}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async createWorkflow(e,t,n){return await this.client.post(`v1/workspaces/${t}/workflows`,{headers:{Authorization:`Bearer ${e}`},json:n}).json()}async updateWorkflow(e,t,n,r){await this.client.put(`v1/workspaces/${t}/workflows/${n}`,{headers:{Authorization:`Bearer ${e}`},json:r})}async triggerWorkflowRun(e,t,n,r){return await this.client.post(`v1/workspaces/${t}/workflows/${n}/runs`,{headers:{Authorization:`Bearer ${e}`},json:r===void 0?{}:{args:r}}).json()}async getWorkflowRuns(e,t,n,r){let i={limit:r?.limit??20};return r?.nextKey&&(i.nextKey=r.nextKey),await this.client.get(`v1/workspaces/${t}/workflows/${n}/runs`,{headers:{Authorization:`Bearer ${e}`},searchParams:i}).json()}async getWorkflowRun(e,t,n,r){return await this.client.get(`v1/workspaces/${t}/workflows/${n}/runs/${r}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getWorkflowGrants(e,t,n){return await this.client.get(`v1/workspaces/${t}/workflows/${n}/grants`,{headers:{Authorization:`Bearer ${e}`}}).json()}async upsertWorkflowGrant(e,t,n,r,i){return await this.client.put(`v1/workspaces/${t}/workflows/${n}/grants/${r}`,{headers:{Authorization:`Bearer ${e}`},json:{role:i}}).json()}async removeWorkflowGrant(e,t,n,r){await this.client.delete(`v1/workspaces/${t}/workflows/${n}/grants/${r}`,{headers:{Authorization:`Bearer ${e}`}})}async listProjects(e,t,n){let r={limit:n.limit,sortBy:n.sortBy,order:n.order};return n.nextKey&&(r.nextKey=n.nextKey),n.filter&&(r.filter=n.filter),this.client.get(`v1/workspaces/${t}/projects`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async getProject(e,t,n){return this.client.get(`v1/workspaces/${t}/projects/${n}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async updateProject(e,t,n,r){return this.client.patch(`v1/workspaces/${t}/projects/${n}`,{headers:{Authorization:`Bearer ${e}`},json:r}).json()}async createProjectNote(e,t,n,r){return this.client.post(`v1/workspaces/${t}/projects/${n}/notes`,{headers:{Authorization:`Bearer ${e}`},json:r}).json()}async createProject(e,t,n){return this.client.post(`v1/workspaces/${t}/projects`,{headers:{Authorization:`Bearer ${e}`},json:n}).json()}async deleteProject(e,t,n){await this.client.delete(`v1/workspaces/${t}/projects/${n}`,{headers:{Authorization:`Bearer ${e}`}})}async addProjectMember(e,t,n,r){return this.client.post(`v1/workspaces/${t}/projects/${n}/members`,{headers:{Authorization:`Bearer ${e}`},json:{userId:r}}).json()}async updateProjectMemberRole(e,t,n,r,i){await this.client.patch(`v1/workspaces/${t}/projects/${n}/members/${r}`,{headers:{Authorization:`Bearer ${e}`},json:i})}async removeProjectMember(e,t,n,r){await this.client.delete(`v1/workspaces/${t}/projects/${n}/members/${r}`,{headers:{Authorization:`Bearer ${e}`}})}async listProjectFiles(e,t,n){return this.client.get(`v1/workspaces/${t}/projects/${n}/files`,{headers:{Authorization:`Bearer ${e}`}}).json()}async listProjectLinks(e,t,n){return this.client.get(`v1/workspaces/${t}/projects/${n}/links`,{headers:{Authorization:`Bearer ${e}`}}).json()}async searchProjectContext(e,t,n,r){let i={q:r.q};return r.type&&(i.type=r.type),r.limit!==void 0&&(i.limit=r.limit),this.client.get(`v1/workspaces/${t}/projects/${n}/context/search`,{headers:{Authorization:`Bearer ${e}`},searchParams:i}).json()}async readProjectContext(e,t,n,r,i){let a={depth:i.depth};return i.offset!==void 0&&(a.offset=i.offset),this.client.get(`v1/workspaces/${t}/projects/${n}/context/${r.sourceType}/${encodeURIComponent(r.sourceId)}`,{headers:{Authorization:`Bearer ${e}`},searchParams:a}).json()}async assignTaskProject(e,t,n,r){return this.client.put(`v1/workspaces/${t}/tasks/${n}/project`,{headers:{Authorization:`Bearer ${e}`},json:r}).json()}async grantTaskShareMember(e,t,n,r,i={}){let{data:a}=await this.client.put(`v1/workspaces/${t}/tasks/${n}/shares/members/${r}`,{headers:{Authorization:`Bearer ${e}`},json:i}).json();return{...a,name:gy(a.name),email:gy(a.email)}}async revokeTaskShareMember(e,t,n,r,i={}){await this.client.delete(`v1/workspaces/${t}/tasks/${n}/shares/members/${r}`,{headers:{Authorization:`Bearer ${e}`},json:i})}async upsertTaskShare(e,t,n,r){return this.client.post(`v1/workspaces/${t}/tasks/${n}/shares`,{headers:{Authorization:`Bearer ${e}`},json:r}).json()}async uploadProjectFile(e,t,n,r,i){let a=Ny(r);return i.description!==void 0&&a.append(`description`,i.description),this.client.post(`v1/workspaces/${t}/projects/${n}/files/upload`,{headers:{Authorization:`Bearer ${e}`},body:a,timeout:12e4}).json()}async updateProjectFileDescription(e,t,n,r,i){return this.client.patch(`v1/workspaces/${t}/projects/${n}/files/${encodeURIComponent(r)}`,{headers:{Authorization:`Bearer ${e}`},json:i}).json()}async removeProjectFile(e,t,n,r){await this.client.delete(`v1/workspaces/${t}/projects/${n}/files/${encodeURIComponent(r)}`,{headers:{Authorization:`Bearer ${e}`}})}async addProjectLink(e,t,n,r){return this.client.post(`v1/workspaces/${t}/projects/${n}/links`,{headers:{Authorization:`Bearer ${e}`},json:r}).json()}async updateProjectLinkDescription(e,t,n,r,i){return this.client.patch(`v1/workspaces/${t}/projects/${n}/links/${encodeURIComponent(r)}`,{headers:{Authorization:`Bearer ${e}`},json:i}).json()}async removeProjectLink(e,t,n,r){await this.client.delete(`v1/workspaces/${t}/projects/${n}/links/${encodeURIComponent(r)}`,{headers:{Authorization:`Bearer ${e}`}})}async refetchProjectLink(e,t,n,r){return this.client.post(`v1/workspaces/${t}/projects/${n}/links/${encodeURIComponent(r)}/refetch`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getNotifications(e,t,n){let r={limit:n?.limit??20};return n?.tab&&(r.tab=n.tab),n?.eventType&&(r.eventType=n.eventType),n?.cursor&&(r.cursor=n.cursor),await this.client.get(`v1/workspaces/${t}/notifications`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async getNotificationUnreadCount(e,t){return await this.client.get(`v1/workspaces/${t}/notifications/unreadCount`,{headers:{Authorization:`Bearer ${e}`}}).json()}async markNotificationRead(e,t,n){await this.client.post(`v1/workspaces/${t}/notifications/${n}/read`,{headers:{Authorization:`Bearer ${e}`}})}async markAllNotificationsRead(e,t){await this.client.post(`v1/workspaces/${t}/notifications/readAll`,{headers:{Authorization:`Bearer ${e}`}})}async getRuntimeConfig(){if(this.runtimeConfigCache)return this.runtimeConfigCache;let e=await this.client.get(`v1/runtimeConfig`).json();return this.runtimeConfigCache=e,e}async getModels(e,t){return await this.client.get(`v1/workspaces/${t}/models`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getWorkspaceConfig(e,t){return await this.client.get(`v1/workspaces/${t}/config`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getModelTiers(e,t){return await this.client.get(`v1/workspaces/${t}/modelTiers`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getModelTierMappings(e,t){return await this.client.get(`v1/workspaces/${t}/modelTierMappings`,{headers:{Authorization:`Bearer ${e}`}}).json()}async listSelectableModels(e,t){let{deploymentMode:n}=await this.getRuntimeConfig(),{models:r}=n===`saas`?await this.getModelTiers(e,t):await this.getModels(e,t);return{models:r.filter(e=>e.enabled!==!1)}}async getConnectors(e,t,n){let r={limit:n?.limit??100,connectionStatus:n?.connectionStatus??`connected`};return n?.search&&(r.search=n.search),n?.nextKey&&(r.nextKey=n.nextKey),await this.client.get(`v1/workspaces/${t}/availableConnectors`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async getConnectorTools(e,t,n){return this.client.get(`v1/workspaces/${t}/connectors/${n}/tools`,{headers:{Authorization:`Bearer ${e}`}}).json()}async connectConnectorToken(e,t,n,r){await this.client.put(`v1/workspaces/${t}/connectors/${n}/token`,{headers:{Authorization:`Bearer ${e}`},json:r})}async getConnectorAuthUrl(e,t,n){return this.client.post(`v1/workspaces/${t}/connectors/${n}/authUrl`,{headers:{Authorization:`Bearer ${e}`},json:{}}).json()}async createCustomConnector(e,t,n){return this.client.post(`v1/workspaces/${t}/customConnectors`,{headers:{Authorization:`Bearer ${e}`},json:n}).json()}async disconnectConnector(e,t,n){await this.client.delete(`v1/workspaces/${t}/connectors/${n}/token`,{headers:{Authorization:`Bearer ${e}`}})}async getTasks(e,t,n){let r={limit:n?.limit??20};return n?.nextKey&&(r.nextKey=n.nextKey),this.client.get(n?.projectId?`v1/workspaces/${t}/projects/${n.projectId}/tasks`:`v1/workspaces/${t}/tasks`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json().then(Ay)}async searchTasks(e,t,n,r){let i={q:n,limit:r?.limit??20};return r?.nextKey&&(i.nextKey=r.nextKey),r?.projectId&&(i.projectId=r.projectId),jy(await this.client.get(`v1/workspaces/${t}/tasks/search`,{headers:{Authorization:`Bearer ${e}`},searchParams:i}).json())}async getMessages(e,t,n,r=50){return await this.client.get(`v1/workspaces/${t}/tasks/${n}/messages`,{headers:{Authorization:`Bearer ${e}`},searchParams:{limit:r}}).json()}async getAgent(e,t,n){return await this.client.get(`v1/workspaces/${t}/agents/${n}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getAgentVersionByNumber(e,t,n,r){return(await this.client.get(`v1/workspaces/${t}/agents/${n}/versions`,{headers:{Authorization:`Bearer ${e}`},searchParams:{versionNumber:r,limit:1}}).json()).versions.at(0)}async listAvailableSkills(e,t,n){return await this.client.get(`v1/workspaces/${t}/availableSkills`,{headers:{Authorization:`Bearer ${e}`},searchParams:{createdBy:n?.createdBy,nextKey:n?.nextKey,limit:n?.limit??20}}).json()}async uploadSkill(e,t,n){return await this.client.post(`v1/workspaces/${t}/skills`,{headers:{Authorization:`Bearer ${e}`},body:n}).json()}async deleteSkill(e,t,n){await this.client.delete(`v1/workspaces/${t}/skills/${n}`,{headers:{Authorization:`Bearer ${e}`}})}async updateSkillPreference(e,t,n,r){return await this.client.patch(`v1/workspaces/${t}/skills/${n}/preference`,{headers:{Authorization:`Bearer ${e}`},json:{isEnabled:r}}).json()}async getSkillVersions(e,t,n){return await this.client.get(`v1/workspaces/${t}/skills/${n}/versions`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getSkillGrants(e,t,n){return await this.client.get(`v1/workspaces/${t}/skills/${n}/grants`,{headers:{Authorization:`Bearer ${e}`}}).json()}async upsertSkillGrant(e,t,n,r,i){return await this.client.put(`v1/workspaces/${t}/skills/${n}/grants/${r}`,{headers:{Authorization:`Bearer ${e}`},json:{role:i}}).json()}async removeSkillGrant(e,t,n,r){await this.client.delete(`v1/workspaces/${t}/skills/${n}/grants/${r}`,{headers:{Authorization:`Bearer ${e}`}})}async downloadSkillCurrent(e,t,n){return await this.client.get(`v1/workspaces/${t}/skills/${n}/download`,{headers:{Authorization:`Bearer ${e}`}}).json()}async task(e,t,n,r){try{let i=await this.client.post(`v1/workspaces/${t}/tasks`,{headers:{Authorization:`Bearer ${e}`},json:n,timeout:6e4,throwHttpErrors:!1});if(!i.ok){let e=await i.text();throw new My(i.status,e)}let a=await i.json();return r?.(),a.noop||!a.streamId?new Response(`data: [DONE]
|
|
59
|
-
|
|
60
|
-
`,{headers:{"Content-Type":`text/event-stream`}}):await this.taskStream(e,t,a.taskId)}catch(e){throw e instanceof s?TypeError(`Request timed out. Check your connection and try again.`,{cause:e}):e}}async taskStream(e,t,n){let r=await this.client.get(`v1/workspaces/${t}/tasks/${n}/stream`,{headers:{Authorization:`Bearer ${e}`,Accept:`text/event-stream`},timeout:!1,throwHttpErrors:!1});if(!r.ok){let e=await r.text();throw Error(`Task stream failed (${r.status}): ${e}`)}return r}resumeTaskStream(e,t,n){return this.taskStream(e,t,n)}async getSubagentRun(e,t,n,r){return this.client.get(`v1/workspaces/${t}/subagentRuns/${n}`,{headers:{Authorization:`Bearer ${e}`},signal:r}).json()}async openSubagentRunEvents(e,t,n,r){let i=await this.client.get(`v1/workspaces/${t}/subagentRuns/${n}/events`,{headers:{Authorization:`Bearer ${e}`,Accept:`text/event-stream`},timeout:!1,throwHttpErrors:!1,signal:r});if(!i.ok){let e=await i.text();throw Error(`Subagent run events stream failed (${i.status}): ${e}`)}return i}async listBackgroundRuns(e,t,n){return this.client.get(`v1/workspaces/${t}/tasks/${n}/backgroundRuns`,{headers:{Authorization:`Bearer ${e}`}}).json()}async stopBackgroundRun(e,t,n,r,i){let a=Z_(i);return(await this.client.post(`v1/workspaces/${t}/tasks/${n}/${a}/${r}/stop`,{headers:{Authorization:`Bearer ${e}`}})).status===202?`stopping`:`already-finished`}async openWakeEvents(e,t,n,r){let i=await this.client.get(`v1/workspaces/${t}/tasks/${n}/wakeEvents`,{headers:{Authorization:`Bearer ${e}`,Accept:`text/event-stream`},timeout:!1,throwHttpErrors:!1,signal:r});if(!i.ok){let e=await i.text();throw Error(`Wake events stream failed (${i.status}): ${e}`)}return i}async getBudget(e,t){return await this.client.get(`v1/workspaces/${t}/budget`,{headers:{Authorization:`Bearer ${e}`}}).json()}async updateBudget(e,t,n){await this.client.put(`v1/workspaces/${t}/budget`,{headers:{Authorization:`Bearer ${e}`},json:{budget:n}})}async getMonthlyUsages(e,t,n){return await this.client.get(`v1/workspaces/${t}/monthlyUsages`,{headers:{Authorization:`Bearer ${e}`},searchParams:{nextKey:n?.nextKey,limit:n?.limit??20}}).json()}async getBillingOverview(e,t){return await this.client.get(`v1/workspaces/${t}/billing/overview`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getBillingInvoices(e,t,n){let r={limit:n?.limit??20};return n?.nextKey&&(r.nextKey=n.nextKey),await this.client.get(`v1/workspaces/${t}/billing/invoices`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async getUsageOverview(e,t){return await this.client.get(`v1/workspaces/${t}/usage/overview`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getUsageMe(e,t){return await this.client.get(`v1/workspaces/${t}/usage/me`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getUsageConsumptions(e,t,n){let r={limit:n?.limit??20,offset:n?.offset??0};return n?.periodStart&&(r.periodStart=n.periodStart),await this.client.get(`v1/workspaces/${t}/usage/consumptions`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async exportUsageCsv(e,t,n){let r={};return n&&(r.periodStart=n),await this.client.get(`v1/workspaces/${t}/usage/export`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).text()}async createTaskShare(e,t,n,r=`public`){try{return await this.upsertTaskShare(e,t,n,{visibility:r})}catch(e){if(c(e)&&e.response.status===403){let t=await e.response.json().catch(()=>null);if(t?.code===`sharing_disabled`)throw Error(`Sharing is turned off for this workspace by an admin.`,{cause:e});if(t?.code===`share_visibility_not_allowed`)throw Error(`Public sharing is turned off for this workspace by an admin.`,{cause:e})}throw e}}async getSharedTask(e,t){let n={};return t&&(n.Authorization=`Bearer ${t}`),await this.client.get(`v1/shares/${e}`,{headers:n}).json()}async getSharedMessages(e,t=50,n){let r={};return n&&(r.Authorization=`Bearer ${n}`),await this.client.get(`v1/shares/${e}/messages`,{headers:r,searchParams:{limit:t}}).json()}async getTask(e,t,n){return this.client.get(`v1/workspaces/${t}/tasks/${n}`,{headers:{Authorization:`Bearer ${e}`}}).json().then(ky)}async updateTaskToolApprovalMode(e,t,n,r){await this.client.patch(`v1/workspaces/${t}/tasks/${n}/toolApprovalMode`,{headers:{Authorization:`Bearer ${e}`},json:{toolApprovalMode:r}})}async deleteTask(e,t,n){await this.client.delete(`v1/workspaces/${t}/tasks/${n}`,{headers:{Authorization:`Bearer ${e}`}})}async getModelProviders(e,t){return await this.client.get(`v1/workspaces/${t}/modelProviders`,{headers:{Authorization:`Bearer ${e}`}}).json()}async uploadFile(e,t,n,r){let i=Ny(n);return i.append(`modelProviderId`,r),await this.client.post(`v1/workspaces/${t}/files`,{headers:{Authorization:`Bearer ${e}`},body:i,timeout:12e4}).json()}async getCalendarAccounts(e,t){return await this.client.get(`v1/workspaces/${t}/calendar/accounts`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getSchedules(e,t,n){let r={limit:n?.limit??20};return n?.nextKey&&(r.nextKey=n.nextKey),n?.search&&(r.search=n.search),await this.client.get(`v1/workspaces/${t}/schedules`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async getSchedule(e,t,n){return await this.client.get(`v1/workspaces/${t}/schedules/${n}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async createSchedule(e,t,n){return await this.client.post(`v1/workspaces/${t}/schedules`,{headers:{Authorization:`Bearer ${e}`},json:n}).json()}async updateSchedule(e,t,n,r){await this.client.put(`v1/workspaces/${t}/schedules/${n}`,{headers:{Authorization:`Bearer ${e}`},json:r})}async deleteSchedule(e,t,n){await this.client.delete(`v1/workspaces/${t}/schedules/${n}`,{headers:{Authorization:`Bearer ${e}`}})}async activateSchedule(e,t,n){await this.client.post(`v1/workspaces/${t}/schedules/${n}/activate`,{headers:{Authorization:`Bearer ${e}`}})}async deactivateSchedule(e,t,n){await this.client.post(`v1/workspaces/${t}/schedules/${n}/deactivate`,{headers:{Authorization:`Bearer ${e}`}})}async runScheduleNow(e,t,n){return await this.client.post(`v1/workspaces/${t}/schedules/${n}/run`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getScheduleRuns(e,t,n,r){let i={limit:r?.limit??20};return r?.nextKey&&(i.nextKey=r.nextKey),await this.client.get(`v1/workspaces/${t}/schedules/${n}/runs`,{headers:{Authorization:`Bearer ${e}`},searchParams:i}).json()}async listRecordings(e,t,n){let r={limit:n?.limit??20};return n?.nextKey&&(r.nextKey=n.nextKey),n?.search&&(r.search=n.search),this.client.get(`v1/workspaces/${t}/recordings`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async importRecordingMedia(e,t,n){return this.client.post(`v1/workspaces/${t}/recordings/import/media`,{headers:{Authorization:`Bearer ${e}`},json:n}).json()}async previewRecordingMedia(e,t,n){let r={url:n};return this.client.get(`v1/workspaces/${t}/recordings/preview/media`,{headers:{Authorization:`Bearer ${e}`},searchParams:r}).json()}async getRecordingAudioUrl(e,t,n){return this.client.get(`v1/workspaces/${t}/recordings/${n}/audioUrl`,{headers:{Authorization:`Bearer ${e}`}}).json()}async retryRecording(e,t,n){return this.client.post(`v1/workspaces/${t}/recordings/${n}/retry`,{headers:{Authorization:`Bearer ${e}`}}).json()}async deleteRecording(e,t,n){await this.client.delete(`v1/workspaces/${t}/recordings/${n}`,{headers:{Authorization:`Bearer ${e}`}})}async searchMarketplace(e){let t={};return e?.type&&(t.type=e.type),e?.tag&&(t.tag=e.tag),e?.limit&&(t.limit=e.limit),e?.cursor&&(t.cursor=e.cursor),this.client.get(`v1/marketplace/resources`,{searchParams:t}).json()}async getMarketplaceAgent(e){return this.client.get(`v1/marketplace/agents/${encodeURIComponent(e)}`).json()}async getMarketplaceSkill(e){return this.client.get(`v1/marketplace/skills/${encodeURIComponent(e)}`).json()}async listMarketplaceRoles(){return this.client.get(`v1/marketplace/roles`).json()}async installMarketplaceResource(e,t,n,r,i){return this.client.post(`v1/workspaces/${t}/marketplace/${n}s/${encodeURIComponent(r)}/install`,{headers:{Authorization:`Bearer ${e}`},json:{toolApprovalMode:i}}).json()}static async getAuthenticatedClient(t){let n=await Ey.getAll(t);return n?{client:new e(void 0,t),accessToken:n.accessToken,workspaceId:n.workspaceId??null}:null}};function Fy(){return process.env.ENTRYDESK_SANDBOX===`true`}function Iy(){if(!Fy())return null;let e=process.env.ENTRYDESK_SANDBOX_ACCESS_TOKEN?.trim(),t=process.env.ENTRYDESK_SANDBOX_WORKSPACE_ID?.trim();if(!e||!t){let n=[];throw e||n.push(`ENTRYDESK_SANDBOX_ACCESS_TOKEN`),t||n.push(`ENTRYDESK_SANDBOX_WORKSPACE_ID`),Error(`Sandbox mode enabled but missing credentials: ${n.join(`, `)}`)}return{accessToken:e,workspaceId:t}}function Ly(){return!!process.env.ENTRYDESK_TOKEN?.trim()}function Ry(){let e=process.env.ENTRYDESK_TOKEN?.trim();if(!e)return null;let t=process.env.ENTRYDESK_WORKSPACE_ID?.trim();if(!t)throw Error(`ENTRYDESK_TOKEN is set but ENTRYDESK_WORKSPACE_ID is missing. Both are required for PAT authentication.`);return{accessToken:e,workspaceId:t}}const zy=`sandbox environment (ENTRYDESK_SANDBOX)`;function By(){let e=Iy();if(e)return{authSource:`sandbox-env`,label:zy,workspaceId:e.workspaceId};let t=Ry();return t?{authSource:`pat-env`,label:`personal access token (ENTRYDESK_TOKEN)`,workspaceId:t.workspaceId}:null}const Vy=`entrydesk-cli`;function Hy(e,t){let n=new Set(t.split(/[\s,]+/).filter(Boolean)),r=e.split(` `).filter(Boolean);return{rejected:r.filter(e=>n.has(e)),remaining:r.filter(e=>!n.has(e))}}async function Uy(e,t,n){try{return await e.post(`v1/oauth/device/code`,{json:{client_id:Vy,scope:t}}).json()}catch(r){if(!(r instanceof o))throw r;let{code:i,error:a}=py(r.data);if(i===`invalid_scope`){let{rejected:r,remaining:i}=Hy(t,a);if(r.length>0&&i.length>0)return n?.onWarning?.(`This server doesn't support these scopes: ${r.join(`, `)}. Continuing without them — commands that need them may be unavailable.`),e.post(`v1/oauth/device/code`,{json:{client_id:Vy,scope:i.join(` `)}}).json()}throw Error(a?`Failed to request device code: ${a}`:`Failed to request device code`,{cause:r})}}const Wy=new Set([`localhost`,`0.0.0.0`,`::`,`::1`]);function Gy(e){let t=e.replace(/^\[|\]$/gu,``).replace(/\.$/u,``).toLowerCase(),n=t.replace(/^::ffff:/u,``);return Wy.has(t)||/^127(?:\.\d{1,3}){3}$/u.test(n)||t.startsWith(`::ffff:7f`)}const Ky=/^[A-Za-z0-9\-._~/]*$/u,qy=/^[A-Za-z0-9-]{1,64}$/u;function Jy(e,t,n){let r=null;if(e)try{let t=new URL(e);(t.protocol===`https:`||t.protocol===`http:`)&&t.username===``&&t.password===``&&t.hostname!==``&&!Gy(t.hostname)&&Ky.test(t.pathname)&&(r=new URL(t.pathname,t.origin))}catch{}return r??=new URL(`/oauth/device`,t),qy.test(n)&&r.searchParams.set(`user_code`,n),r.toString()}function Yy(e){return new Promise((t,n)=>{let r=process.platform,i,a;switch(r){case`darwin`:i=`open`,a=[e];break;case`win32`:i=`cmd`,a=[`/c`,`start`,``,e];break;default:i=`xdg-open`,a=[e];break}d(i,a,r=>{r?n(Error(`Could not open the browser. Visit this URL to continue: ${e}`,{cause:r})):t()})})}async function Xy(e){let t=cy(),n=ly(),r=dy(),i=process.env.NODE_TLS_REJECT_UNAUTHORIZED;r.ignoreSslErrors&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED=`0`,console.error(`WARNING: SSL certificate validation is disabled globally for this process during the login flow. All connections in this process will skip TLS verification. Only use ENTRYDESK_IGNORE_SSL_ERRORS for local development.`));try{let r=a.create({baseUrl:t.replace(/\/?$/,`/`),timeout:3e4,headers:Dy(),hooks:{beforeError:[({error:e})=>(c(e)&&(e.request.headers.delete(`authorization`),e.request.headers.delete(`Authorization`),e.request.headers.delete(`x-web-proxy-id`)),e)]}}),i;try{i=await Uy(r,`offline_access workspaces:read tasks:read tasks:write tasks:delete projects:read projects:write agents:read agents:write connectors:read connectors:write tools:read tools:execute skills:read skills:write meetings:read meetings:write workflows:read workflows:write notifications:read notifications:write publishes:read publishes:write calendar:read calendar:write schedules:read schedules:write user:read user:write`,e)}catch(t){let n=t instanceof Error?t:Error(`Failed to request device code`);throw e?.onError?.(n),n}let{device_code:s,user_code:l,expires_in:u,interval:d}=i,m=Jy(i.verification_uri,n,l);e?.onDeviceCodeReceived?.(l,m),e?.onBrowserOpening?.();try{await Yy(m)}catch(e){process.env.DEBUG&&console.error(`[DEBUG] Failed to open browser:`,e)}e?.onWaitingForAuthorization?.();let ee=Math.max(d,5)*1e3,te=Date.now()+u*1e3;for(;Date.now()<te;){await f(ee);try{let t=await r.post(`v1/oauth/token`,{json:{grant_type:`urn:ietf:params:oauth:grant-type:device_code`,device_code:s,client_id:Vy}}).json();e?.onAuthorized?.();let n={};try{n=p(t.access_token)}catch{}return{accessToken:t.access_token,refreshToken:t.refresh_token??void 0,email:n.email||``,scopes:t.scope.split(` `).filter(e=>e.length>0)}}catch(t){if(t instanceof o){let{code:e,error:n}=py(t.data),r=e||n;if(!r)continue;switch(r){case`authorization_pending`:continue;case`slow_down`:ee+=5e3;continue;case`access_denied`:throw Error(`Authorization denied.`,{cause:t});case`expired_token`:throw Error("Device code expired. Run `entrydesk login` again.",{cause:t});default:throw Error(`Authorization failed: ${r||`Unknown error`}`,{cause:t})}}let n=t instanceof Error?t:Error(`Unknown error during authorization`);throw e?.onError?.(n),n}}throw Error("Device code expired. Run `entrydesk login` again.")}finally{i===void 0?delete process.env.NODE_TLS_REJECT_UNAUTHORIZED:process.env.NODE_TLS_REJECT_UNAUTHORIZED=i}}function Zy(e){if(e instanceof o){let t=e.response.status;return t===400||t===401}return!1}var Qy=class extends Error{code;constructor(e,t){super(t),this.name=`AuthError`,this.code=e}};function $y(e){try{let t=e.split(`.`);if(t.length<2)return null;let n=t[1].replace(/-/g,`+`).replace(/_/g,`/`),r=(4-n.length%4)%4,i=n.padEnd(n.length+r,`=`),a=Buffer.from(i,`base64`).toString(`utf8`);return JSON.parse(a)}catch{return null}}function eb(e,t=300){let n=$y(e)?.exp;return typeof n==`number`&&n-Math.floor(Date.now()/1e3)<=t}async function tb(e){let t=e.accessToken;if(!eb(t))return t;if(!e.refreshToken)throw await Ey.clear(),new Qy(`session-expired`,"Session expired. Run `entrydesk login` again.");let n=e.refreshToken;try{let t=await new Py().refreshOAuthToken({refreshToken:n,clientId:Vy}),r=await Ey.getAll();return r?.accessToken&&r.refreshToken&&r.refreshToken!==n?r.accessToken:(await Ey.saveAll({...r??e,accessToken:t.access_token,refreshToken:t.refresh_token??r?.refreshToken??n}),t.access_token)}catch(e){if(!Zy(e))throw new Qy(`refresh-failed`,`Could not refresh your session — the auth server is unreachable. Try again in a moment.`);let t=await Ey.getAll();if(t?.accessToken&&t.refreshToken&&t.refreshToken!==n)return t.accessToken;throw await Ey.clear(),new Qy(`session-expired`,"Session expired. Run `entrydesk login` again.")}}async function nb(){let e=Iy();if(e)return e.accessToken;let t=await Ey.getAll();if(!t?.accessToken)throw new Qy(`not-logged-in`,"Not logged in. Run `entrydesk login` first.");return tb(t)}async function rb(){let e=Iy();if(e)return{accessToken:e.accessToken,workspaceId:e.workspaceId};let t=Ry();if(t)return t;let n=await Ey.getAll();if(!n?.accessToken)throw new Qy(`not-logged-in`,"Not logged in. Run `entrydesk login` first.");if(!n.workspaceId)throw new Qy(`no-workspace`,"No workspace selected. Run `entrydesk workspaces` first.");return{accessToken:await tb(n),workspaceId:n.workspaceId}}function ib(e){let t=``;try{t=` by ${cy()}`}catch{}let n=hy(e.data),r=n?` (server code: ${n})`:``,i;return i=n===`missing_token`||n===`bearer_not_supported`?process.env.ENTRYDESK_API_URL?`The API did not accept your Authorization header (stripped or refused en route) — the URL likely points at a browser-facing proxy path (such as a Hub "/api" URL). It comes from the ENTRYDESK_API_URL environment variable, which overrides profile config — update or unset ENTRYDESK_API_URL.`:'The API did not accept your Authorization header (stripped or refused en route) — the URL likely points at a browser-facing proxy path (such as a Hub "/api" URL). Set apiUrl to the API server URL with `entrydesk config set apiUrl <url>`.':Fy()?`Requests are authenticated via ${zy} — ask the sandbox owner to issue fresh credentials.`:Ly()?"ENTRYDESK_TOKEN is set and takes priority over `entrydesk login` credentials for workspace commands — unset it or replace it with a valid token; if this command does not use it, run `entrydesk login`.":"Your session may have expired — run `entrydesk login`. If this is not the environment you expect, check `entrydesk config get apiUrl`.",`Not authorized (401)${t}${r}. ${i}`}function ab(e){let t=Math.round(e/1e3);return t%60==0&&t>=60?`${t/60}m`:`${t}s`}function ob(e){return e instanceof Error&&e.name===`SdkError`&&`code`in e&&e.code===`REQUEST_TIMEOUT`}function sb(){let{requestTimeout:e,requestMaxTotalTimeout:t}=fy();return`The request timed out after ${ab(e)} without a response or progress update (absolute cap ${ab(t)}). Raise the limit with ${iy}=<milliseconds>, and ${ay}=<milliseconds> for the absolute cap.`}var cb=class extends Error{exitCode;cause;constructor(e,t=1,n){super(e),this.exitCode=t,this.cause=n,this.name=`CLIError`}};function lb(e){if(e instanceof cb)return{message:`Error: ${e.message}`,exitCode:e.exitCode,cause:e.cause,stack:e.cause?.stack};if(e instanceof Qy)return{message:e.message,exitCode:1,stack:e.stack};if(ob(e))return{message:sb(),exitCode:1,stack:e instanceof Error?e.stack:void 0};if(e instanceof s)return{message:`Request timed out. Check your connection and try again.`,exitCode:1,stack:e.stack};if(e instanceof o){let t=e.response.status;if(t===401)return{message:ib(e),exitCode:1,stack:e.stack};if(t===403)return{message:"Forbidden (403). Your account or token lacks permission for this action. If your token predates a recently added feature, run `entrydesk login` to refresh its scopes; otherwise you may lack permission in this workspace.",exitCode:1,stack:e.stack};let n=py(e.data),r=hy(e.data),i=r?` (server code: ${r})`:``,a=gy(n.error),o=gy(e.response.statusText);return{message:`Request failed (${t}): ${a||o}${i}`,exitCode:1,stack:e.stack}}return e instanceof Error?{message:`Unexpected error: ${e.message}`,exitCode:1,stack:e.stack}:{message:`An unknown error occurred`,exitCode:1}}function ub(e){let t=lb(e);console.error(t.message),t.cause&&console.error(`Cause: ${t.cause.message}`),process.env.DEBUG&&t.stack&&console.error(t.stack),process.exit(t.exitCode)}const db=`default`,fb=/^[A-Za-z0-9_-]+$/;let pb=null;function mb(){return i.join(r.homedir(),`.entrydesk`)}function hb(){return i.join(mb(),`profiles`)}function gb(){return i.join(mb(),`profiles.json`)}function _b(e){return i.join(hb(),e)}function vb(e){if(n.existsSync(e))try{n.chmodSync(e,448)}catch{}else n.mkdirSync(e,{mode:448,recursive:!0})}function yb(){vb(mb())}function bb(){vb(hb())}function xb(){let e=gb();try{if(!n.existsSync(e))return null;let t=n.readFileSync(e,`utf-8`);return JSON.parse(t)}catch{return null}}function Sb(e){yb();let t=gb();n.writeFileSync(t,JSON.stringify(e,null,2),{mode:384});try{n.chmodSync(t,384)}catch{}}function Cb(e){let t=e.profiles?.length?[...new Set(e.profiles)]:[],n=e.currentProfile&&t.includes(e.currentProfile)?e.currentProfile:t[0]||db;return t.length===0&&t.push(db),t.includes(n)||t.unshift(n),{currentProfile:n,profiles:t}}function wb(e){bb(),vb(_b(e))}function Tb(){let e=xb();if(!e){let e={currentProfile:db,profiles:[db]};return Sb(e),bb(),wb(db),e}let t=Cb(e);return(t.currentProfile!==e.currentProfile||t.profiles.length!==e.profiles.length)&&Sb(t),bb(),t}function Eb(e){if(!e)throw new cb(`Profile name is required.`);if(!fb.test(e))throw new cb(`Invalid profile name. Use letters, numbers, dash, or underscore.`)}function Db(e,t){if(!e.profiles.includes(t))throw new cb(`Profile not found: ${t}`)}function Ob(e,t){if(e.profiles.includes(t))throw new cb(`Profile already exists: ${t}`)}const $={DEFAULT_PROFILE:db,setOverrideProfile(e){pb=e},getOverrideProfile(){return pb},getProfileDir(e){return _b(e)},getProfileConfigFile(e){return i.join($.getProfileDir(e),`config.json`)},getProfileCredentialsFile(e){return i.join($.getProfileDir(e),`credentials.json`)},getProfileNames(){return[...Tb().profiles]},getProfileCount(){return $.getProfileNames().length},getCurrentProfileName(){return Tb().currentProfile},getEffectiveProfileName(e){let t=Tb(),n=e||pb||t.currentProfile;return Eb(n),Db(t,n),n},ensureProfileExists(e){let t=Tb();Eb(e),Db(t,e)},createProfile(e){Eb(e);let t=Tb();Ob(t,e),Sb({currentProfile:t.currentProfile,profiles:[...t.profiles,e]}),wb(e)},deleteProfile(e){Eb(e);let t=Tb();if(Db(t,e),t.profiles.length===1)throw new cb(`Cannot delete the last profile.`);let r=t.profiles.filter(t=>t!==e),i=t.currentProfile;i===e&&(i=r.includes(db)?db:r[0]),Sb({currentProfile:i,profiles:r});try{n.rmSync($.getProfileDir(e),{recursive:!0,force:!0})}catch{}return{currentProfile:i}},renameProfile(e,t){Eb(e),Eb(t);let r=Tb();Db(r,e),Ob(r,t);let i=_b(e),a=_b(t);if(n.existsSync(i))try{n.renameSync(i,a)}catch(e){throw new cb(`Failed to rename profile directory.`,1,e)}else wb(t);let o=r.profiles.map(n=>n===e?t:n),s=r.currentProfile===e?t:r.currentProfile;return Sb({currentProfile:s,profiles:o}),{currentProfile:s}},setCurrentProfile(e){Eb(e);let t=Tb();Db(t,e),Sb({currentProfile:e,profiles:t.profiles}),wb(e)},ensureProfileDir:wb};export{Im as $,fy as A,bu as At,ig as B,Ey as C,Wd as Ct,sy as D,zd as Dt,cy as E,Vd as Et,v_ as F,du as Ft,jh as G,Ah as H,Ug as I,nu as It,Rh as J,zh as K,Hg as L,gl as Lt,ry as M,hu as Mt,ev as N,yu as Nt,uy as O,ed as Ot,$_ as P,vu as Pt,jm as Q,bg as R,Cc as Rt,Dy as S,Zd as St,gy as T,Bd as Tt,Ih as U,Fh as V,Sh as W,ih as X,oh as Y,zm as Z,Iy as _,lf as _t,lb as a,ip as at,Py as b,Ud as bt,Qy as c,Cf as ct,eb as d,nf as dt,Fm as et,tb as f,df as ft,By as g,mf as gt,zy as h,vf as ht,sb as i,Cp as it,ey as j,J as jt,ly as k,qu as kt,nb as l,tf as lt,Xy as m,af as mt,mb as n,cm as nt,ub as o,Jf as ot,Vy as p,uf as pt,mh as q,cb as r,Sp as rt,ob as s,yf as st,$ as t,Lm as tt,rb as u,cf as ut,Ry as v,rf as vt,hy as w,Pd as wt,My as x,Xd as xt,Ly as y,Hd as yt,yg as z};
|