skill-creator 1.5.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +73 -0
- package/LICENSE +21 -0
- package/README.md +248 -275
- package/dist/cli.js +51129 -0
- package/dist/cli.js.map +7 -0
- package/dist/daemon.js +52163 -0
- package/dist/daemon.js.map +7 -0
- package/dist/package.json +5 -0
- package/dist/webui/_app/immutable/assets/0.0XN00VKF.css +2 -0
- package/dist/webui/_app/immutable/assets/ProviderView.DEH95hqa.css +1 -0
- package/dist/webui/_app/immutable/assets/inter-cyrillic-ext-wght-normal.BOeWTOD4.woff2 +0 -0
- package/dist/webui/_app/immutable/assets/inter-cyrillic-wght-normal.DqGufNeO.woff2 +0 -0
- package/dist/webui/_app/immutable/assets/inter-greek-ext-wght-normal.DlzME5K_.woff2 +0 -0
- package/dist/webui/_app/immutable/assets/inter-greek-wght-normal.CkhJZR-_.woff2 +0 -0
- package/dist/webui/_app/immutable/assets/inter-latin-ext-wght-normal.DO1Apj_S.woff2 +0 -0
- package/dist/webui/_app/immutable/assets/inter-latin-wght-normal.Dx4kXJAl.woff2 +0 -0
- package/dist/webui/_app/immutable/assets/inter-vietnamese-wght-normal.CBcvBZtf.woff2 +0 -0
- package/dist/webui/_app/immutable/assets/shell.U4CQV8re.css +1 -0
- package/dist/webui/_app/immutable/chunks/0umLG1IN.js +1 -0
- package/dist/webui/_app/immutable/chunks/B2zyE4XX.js +1 -0
- package/dist/webui/_app/immutable/chunks/BD9g8Udg.js +1 -0
- package/dist/webui/_app/immutable/chunks/BEPs9Z9s.js +1 -0
- package/dist/webui/_app/immutable/chunks/BEsyQXpe.js +1 -0
- package/dist/webui/_app/immutable/chunks/BIfnT_mK.js +1 -0
- package/dist/webui/_app/immutable/chunks/BYNWtKcf.js +259 -0
- package/dist/webui/_app/immutable/chunks/B_YFzSAv.js +2 -0
- package/dist/webui/_app/immutable/chunks/BaH4uqzh.js +1 -0
- package/dist/webui/_app/immutable/chunks/Bjy-W4x2.js +81 -0
- package/dist/webui/_app/immutable/chunks/BkEnd9_Z.js +1 -0
- package/dist/webui/_app/immutable/chunks/BrDKAjtR.js +1 -0
- package/dist/webui/_app/immutable/chunks/Bs27XW8_.js +1 -0
- package/dist/webui/_app/immutable/chunks/BySEbwqx.js +1 -0
- package/dist/webui/_app/immutable/chunks/C3mlWJXx.js +1 -0
- package/dist/webui/_app/immutable/chunks/CEpOi93z.js +2 -0
- package/dist/webui/_app/immutable/chunks/CIFG41pU.js +1 -0
- package/dist/webui/_app/immutable/chunks/CNPsST_i.js +1 -0
- package/dist/webui/_app/immutable/chunks/CQD9uzpA.js +1 -0
- package/dist/webui/_app/immutable/chunks/CeR4do8T.js +1 -0
- package/dist/webui/_app/immutable/chunks/Ckw1quWt.js +1 -0
- package/dist/webui/_app/immutable/chunks/CmCJ0SKP.js +3 -0
- package/dist/webui/_app/immutable/chunks/D-V0xBeS.js +1 -0
- package/dist/webui/_app/immutable/chunks/D-ecV3TD.js +1 -0
- package/dist/webui/_app/immutable/chunks/D0xHg31U.js +1 -0
- package/dist/webui/_app/immutable/chunks/D25cXQtk.js +1 -0
- package/dist/webui/_app/immutable/chunks/D8Der6oM.js +1 -0
- package/dist/webui/_app/immutable/chunks/DEtYLPO4.js +8 -0
- package/dist/webui/_app/immutable/chunks/DJNLWtK-.js +1 -0
- package/dist/webui/_app/immutable/chunks/DLuJKUyD.js +1 -0
- package/dist/webui/_app/immutable/chunks/DWcQbrnv.js +52 -0
- package/dist/webui/_app/immutable/chunks/DZ_Kltd5.js +1 -0
- package/dist/webui/_app/immutable/chunks/DecrR9TK.js +1 -0
- package/dist/webui/_app/immutable/chunks/Dl8eQ129.js +5 -0
- package/dist/webui/_app/immutable/chunks/Dnkino9G.js +1 -0
- package/dist/webui/_app/immutable/chunks/HclGiUj8.js +1 -0
- package/dist/webui/_app/immutable/chunks/IYkYSIV6.js +1 -0
- package/dist/webui/_app/immutable/chunks/J36u8XLO.js +1 -0
- package/dist/webui/_app/immutable/chunks/UeEccMjN.js +1 -0
- package/dist/webui/_app/immutable/chunks/Y--VMh3y.js +1 -0
- package/dist/webui/_app/immutable/chunks/iicbWqXp.js +3 -0
- package/dist/webui/_app/immutable/chunks/s48N5eaK.js +67 -0
- package/dist/webui/_app/immutable/chunks/xihTtKlq.js +1 -0
- package/dist/webui/_app/immutable/entry/app.CbFi8HIH.js +2 -0
- package/dist/webui/_app/immutable/entry/start.C3bV1TCO.js +1 -0
- package/dist/webui/_app/immutable/nodes/0.C7-AKGsj.js +231 -0
- package/dist/webui/_app/immutable/nodes/1.raBmjc20.js +1 -0
- package/dist/webui/_app/immutable/nodes/2.ewWz-Ki-.js +1 -0
- package/dist/webui/_app/immutable/nodes/3.DCVfhckZ.js +1 -0
- package/dist/webui/_app/version.json +1 -0
- package/dist/webui/icons/app-icon/darwin-dark.icns +0 -0
- package/dist/webui/icons/app-icon/darwin-light.icns +0 -0
- package/dist/webui/icons/app-icon/win32-dark.ico +0 -0
- package/dist/webui/icons/app-icon/win32-light.ico +0 -0
- package/dist/webui/icons/app-icon.icns +0 -0
- package/dist/webui/icons/app-icon.ico +0 -0
- package/dist/webui/icons/app-icon.json +84 -0
- package/dist/webui/icons/app-icon.png +0 -0
- package/dist/webui/icons/flat-symbol.png +0 -0
- package/dist/webui/icons/linux/128x128/app-icon.png +0 -0
- package/dist/webui/icons/linux/16x16/app-icon.png +0 -0
- package/dist/webui/icons/linux/256x256/app-icon.png +0 -0
- package/dist/webui/icons/linux/32x32/app-icon.png +0 -0
- package/dist/webui/icons/linux/48x48/app-icon.png +0 -0
- package/dist/webui/icons/linux/512x512/app-icon.png +0 -0
- package/dist/webui/icons/linux/64x64/app-icon.png +0 -0
- package/dist/webui/icons/monochrome-mini.png +0 -0
- package/dist/webui/index.html +62 -0
- package/dist/webui/robots.txt +3 -0
- package/package.json +100 -70
- package/dist/chunk-Da8dvM5T.mjs +0 -1
- package/dist/cli.d.mts +0 -1016
- package/dist/cli.d.mts.map +0 -1
- package/dist/cli.mjs +0 -36
- package/dist/cli.mjs.map +0 -1
- package/dist/contentManager-8rmWJMb6.mjs +0 -22
- package/dist/contentManager-8rmWJMb6.mjs.map +0 -1
- package/dist/contentManager-Xt8N5psY.mjs +0 -1
- package/dist/dist-DZL34HNo.mjs +0 -8
- package/dist/dist-DZL34HNo.mjs.map +0 -1
- package/dist/dist-X_kVEzbK.mjs +0 -1
- package/dist/esm-8qfZdcpd.mjs +0 -33
- package/dist/esm-8qfZdcpd.mjs.map +0 -1
- package/dist/esm-BF5pvSbc.mjs +0 -1
- package/dist/esm-BbhxxeGF.mjs +0 -4
- package/dist/esm-BbhxxeGF.mjs.map +0 -1
- package/dist/index.d.mts +0 -1964
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -21
- package/dist/index.mjs.map +0 -1
- package/dist/listContext7-DKXzgWdn.mjs +0 -2
- package/dist/listContext7-DKXzgWdn.mjs.map +0 -1
- package/dist/package-Cxx_VSyD.mjs +0 -2
- package/dist/package-Cxx_VSyD.mjs.map +0 -1
- package/dist/path-CuoiIaIe.mjs +0 -2
- package/dist/path-CuoiIaIe.mjs.map +0 -1
- package/dist/removeContext7-DOXrTXeI.mjs +0 -3
- package/dist/removeContext7-DOXrTXeI.mjs.map +0 -1
- package/dist/removeSkill-C-ehFexk.mjs +0 -5
- package/dist/removeSkill-C-ehFexk.mjs.map +0 -1
- package/dist/removeSkill-DWwhvzej.mjs +0 -1
- package/dist/runScript-Cr9RRN9y.mjs +0 -14
- package/dist/runScript-Cr9RRN9y.mjs.map +0 -1
- package/dist/search_format-DIs-1lKk.mjs +0 -5
- package/dist/search_format-DIs-1lKk.mjs.map +0 -1
- package/dist/shared-CFoY2Xhg.mjs +0 -2
- package/dist/shared-CFoY2Xhg.mjs.map +0 -1
- package/dist/skillMdManager-DP8fGZb7.mjs +0 -7
- package/dist/skillMdManager-DP8fGZb7.mjs.map +0 -1
- package/dist/unifiedSearch-CGZXw0NB.mjs +0 -1
- package/dist/unifiedSearch-l-lrSc9C.mjs +0 -4
- package/dist/unifiedSearch-l-lrSc9C.mjs.map +0 -1
- package/templates/SKILL.md +0 -41
- package/templates/SKILL.zh-CN.md +0 -297
- package/templates/skill-creator.md +0 -97
- package/templates/skill-creator.zh-CN.md +0 -100
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import{ut as e}from"./CmCJ0SKP.js";import{n as t}from"./BaH4uqzh.js";import"./DLuJKUyD.js";function n(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 r(e,t=`|`){return e.map(e=>ae(e)).join(t)}function i(e,t){return typeof t==`bigint`?t.toString():t}function a(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function o(e){return e==null}function s(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function c(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 l(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function u(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function d(e){return JSON.stringify(e)}function f(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var p=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ee=a(()=>{if(x.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function te(e){if(m(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return m(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ne(e){return te(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var re=new Set([`string`,`number`,`symbol`]);function ie(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function h(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function g(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 ae(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function oe(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var se={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ce(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 h(e,u(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]&&l(e,r,n.shape[r])}return l(this,`shape`,e),e},checks:[]}))}function le(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 h(e,u(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 l(this,`shape`,r),r},checks:[]}))}function ue(e,t){if(!te(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 h(e,u(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return l(this,`shape`,n),n}}))}function de(e,t){if(!te(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return h(e,u(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return l(this,`shape`,n),n}}))}function fe(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 h(e,u(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return l(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function pe(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 h(t,u(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 l(this,`shape`,i),i},checks:[]}))}function me(e,t,n){return h(t,u(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 l(this,`shape`,i),i}}))}function he(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 ge(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 _(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function _e(e){return typeof e==`string`?e:e?.message}function ve(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function v(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:_e(e.inst?._zod.def?.error?.(e))??_e(a?.(e))??_e(t?.error?.(e))??_e(n.customError?.(e))??_e(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}var ye=/[\uD800-\uDBFF]/;function be(e){let t=e.length;if(!ye.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 xe(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Se(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 Ce(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function we(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):De(e,n,r.value)}}function Te(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Ee(e,t,n){return Te(e,t,n,!1)}function De(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Te(this,t,n.bind(this))},set(e){Te(this,t,e)}})}function Oe(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var ke,Ae=!1,je={configurable:!0,get(){Ae=!0}};function y(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&ke!==e._zod){ke=void 0;return}ke=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,je);let e=Ae;Ae=!1;try{let r=n(this);return Ae?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Ae||=e,r}catch(n){throw delete this[t],Ae||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Me(e,t,n,r){let i=Oe(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})}})}var Ne=`~constantCatch`;function Pe(e){let t=()=>e;return t[Ne]=!0,t}var Fe,Ie={value:void 0,enumerable:!1},Le=`captureStackTrace`in Error?Error:null;function Re(e){let t=Le;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Le=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function b(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){Ie.value=new a(r);try{Object.defineProperty(n,"_zod",Ie)}finally{Ie.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),we(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?Re(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.`)}},Be=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Fe=globalThis).__zod_globalConfig??(Fe.__zod_globalConfig={});var x=globalThis.__zod_globalConfig;function S(e){return e&&Object.assign(x,e),x}function Ve(){let e=this._zod;return e.message??=JSON.stringify(e.def,i,2),e.message}function He(e){this._zod.message=e}var Ue={get:Ve,set:He,enumerable:!0,configurable:!0},We={value:void 0,enumerable:!1},Ge={value:void 0,enumerable:!1},Ke=new WeakSet([Object.prototype,Error.prototype]),qe=(e,t)=>{e.name=`$ZodError`,We.value=e._zod,Object.defineProperty(e,"_zod",We),Ge.value=t,Object.defineProperty(e,"issues",Ge),We.value=void 0,Ge.value=void 0,Object.defineProperty(e,"message",Ue);let n=Object.getPrototypeOf(e);Ke.has(n)||(Ke.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})}}))},Je=b(`$ZodError`,qe),Ye=b(`$ZodError`,qe,void 0,{Parent:Error});function Xe(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 Ze(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Xe(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Qe(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 $e(e,t){return{callee:t?.callee??e,Err:t?.Err}}var et=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=>v(e,o,S())));throw p(n,a?.callee??t),n}return s.value};return t},tt=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=>v(e,o,S())));throw p(n,a?.callee??t),n}return s.value};return t},nt=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??Je)(a.issues.map(e=>v(e,i,S())))}:{success:!0,data:a.value}},rt=nt(Ye),it=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=>v(e,i,S())))}:{success:!0,data:a.value}},at=it(Ye),ot=e=>{let t=et(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,$e(n,a))};return n},st=e=>{let t=et(e),n=(e,r,i,a)=>t(e,r,i,$e(n,a));return n},ct=e=>{let t=tt(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,$e(n,a))};return n},lt=e=>{let t=tt(e),n=async(e,r,i,a)=>await t(e,r,i,$e(n,a));return n},ut=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return nt(e)(t,n,i)},dt=e=>(t,n,r)=>nt(e)(t,n,r),ft=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return it(e)(t,n,i)},pt=e=>async(t,n,r)=>it(e)(t,n,r),mt=/^[cC][0-9a-z]{6,}$/,ht=/^[0-9a-z]+$/,gt=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,_t=/^[0-9a-vA-V]{20}$/,vt=/^[A-Za-z0-9]{27}$/,yt=/^[a-zA-Z0-9_-]{21}$/;function bt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var xt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,St=/^([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})$/,Ct=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)$/,wt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Tt=`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Et(){return new RegExp(Tt,`u`)}var Dt=/^(?:(?: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])$/,Ot=/^(([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}|:))$/,kt=/^((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])$/,At=/^(([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])$/,jt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Mt=/^[A-Za-z0-9_-]*$/,Nt=/^https?$/,Pt=/^\+[1-9]\d{6,14}$/,Ft=`(?:(?:\\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 It(e){return RegExp(`^${e}$`)}var Lt=It(Ft);function Rt(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(`^${Rt(e)}$`)}function Bt(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Rt({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Rt({precision:e.precision})}`:n;return RegExp(`^${Ft}T(?:${r})$`)}var Vt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ht=/^-?\d+$/,Ut=/^-?\d+(?:\.\d+)?$/,Wt=/^(?:true|false)$/i,Gt=/^null$/i,Kt=/^[^A-Z]*$/,qt=/^[^a-z]*$/,C=b(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Jt=e=>{let t=e.value;return!o(t)&&t.length!==void 0},Yt={number:`number`,bigint:`bigint`,object:`date`},Xt=b(`$ZodCheckLessThan`,(e,t)=>{C.init(e,t);let n=Yt[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:Yt[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})}}),Zt=b(`$ZodCheckGreaterThan`,(e,t)=>{C.init(e,t);let n=Yt[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:Yt[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})}}),Qt=b(`$ZodCheckMultipleOf`,(e,t)=>{C.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):c(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})}}),$t=b(`$ZodCheckNumberFormat`,(e,t)=>{C.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=se[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=Ht)}),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})}}),en=b(`$ZodCheckMaxLength`,(e,t)=>{var n;C.init(e,t),(n=e._zod.def).when??(n.when=Jt),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?be(r):i)<=t.maximum)return;let a=xe(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),tn=b(`$ZodCheckMinLength`,(e,t)=>{var n;C.init(e,t),(n=e._zod.def).when??(n.when=Jt),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?be(r):i)>=t.minimum)return;let a=xe(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),nn=b(`$ZodCheckLengthEquals`,(e,t)=>{var n;C.init(e,t),(n=e._zod.def).when??(n.when=Jt),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?be(r):i;if(a===t.length)return;let o=xe(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})}}),rn=b(`$ZodCheckStringFormat`,(e,t)=>{var n,r;C.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=()=>{})}),an=b(`$ZodCheckRegex`,(e,t)=>{rn.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})}}),on=b(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Kt,rn.init(e,t)}),sn=b(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=qt,rn.init(e,t)}),cn=b(`$ZodCheckIncludes`,(e,t)=>{C.init(e,t);let n=ie(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})}}),ln=b(`$ZodCheckStartsWith`,(e,t)=>{C.init(e,t);let n=RegExp(`^${ie(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})}}),un=b(`$ZodCheckEndsWith`,(e,t)=>{C.init(e,t);let n=RegExp(`.*${ie(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})}}),dn=b(`$ZodCheckOverwrite`,(e,t)=>{C.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),fn=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(`
|
|
2
|
+
`).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(`
|
|
3
|
+
`)}\n};`)(...Object.values(this.closed))}},pn={major:4,minor:5,patch:4},w=b(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=pn;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=he(t),a;for(let o of n){if(o._zod.def.when){if(ge(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&&(ve(t.issues,n,e),i||=he(t,n))});else{if(t.issues.length===n)continue;ve(t.issues,n,e),i||=he(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(he(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 Ee(this,`~standard`,hn(this))},set"~standard"(e){Te(this,`~standard`,e)}}),mn=e=>e.success?{value:e.data}:{issues:e.error?.issues};function hn(e){return{validate:t=>{try{return mn(rt(e,t))}catch{return at(e,t).then(mn)}},vendor:`zod`,version:1}}var gn=b(`$ZodString`,(e,t)=>{w.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Vt(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}}),T=b(`$ZodStringFormat`,(e,t)=>{rn.init(e,t),gn.init(e,t)}),_n=b(`$ZodGUID`,(e,t)=>{t.pattern??=St,T.init(e,t)}),vn=b(`$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??=Ct(e)}else t.pattern??=Ct();T.init(e,t)}),yn=b(`$ZodEmail`,(e,t)=>{t.pattern??=wt,T.init(e,t)});function bn(e,t){if(!t.normalize&&t.protocol?.source===Nt.source&&!/^https?:\/\//i.test(e))return 1;try{return new URL(e)}catch{return 2}}var xn=/[\t\n\r]/g;function Sn(e){return e.replace(xn,``)}function Cn(e,t){return t.lastIndex=0,t.test(e.hostname)}function wn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Tn=b(`$ZodURL`,(e,t)=>{T.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=bn(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&&!Cn(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&&!wn(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:Sn(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),En=b(`$ZodEmoji`,(e,t)=>{t.pattern??=Et(),T.init(e,t)}),Dn=b(`$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?yt:bt(t.length),T.init(e,t)}),On=b(`$ZodCUID`,(e,t)=>{t.pattern??=mt,T.init(e,t)}),kn=b(`$ZodCUID2`,(e,t)=>{t.pattern??=ht,T.init(e,t)}),An=b(`$ZodULID`,(e,t)=>{t.pattern??=gt,T.init(e,t)}),jn=b(`$ZodXID`,(e,t)=>{t.pattern??=_t,T.init(e,t)}),Mn=b(`$ZodKSUID`,(e,t)=>{t.pattern??=vt,T.init(e,t)}),Nn=b(`$ZodISODateTime`,(e,t)=>{t.pattern??=Bt(t),T.init(e,t),(t.local||t.precision===-1)&&(e._zod.bag.laxFormat=!0,e._zod.onattach.push(e=>{e._zod.bag.laxFormat=!0}))}),Pn=b(`$ZodISODate`,(e,t)=>{t.pattern??=Lt,T.init(e,t)}),Fn=b(`$ZodISOTime`,(e,t)=>{t.pattern??=zt(t),T.init(e,t)}),In=b(`$ZodISODuration`,(e,t)=>{t.pattern??=xt,T.init(e,t)}),Ln=b(`$ZodIPv4`,(e,t)=>{t.pattern??=Dt,T.init(e,t),e._zod.bag.format=`ipv4`}),Rn=/^[0-9a-fA-F:.]+$/;function zn(e){if(!Rn.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}var Bn=b(`$ZodIPv6`,(e,t)=>{t.pattern??=Ot,T.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})}}),Vn=b(`$ZodCIDRv4`,(e,t)=>{t.pattern??=kt,T.init(e,t)});function Hn(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)}var Un=b(`$ZodCIDRv6`,(e,t)=>{t.pattern??=At,T.init(e,t),e._zod.check=n=>{Hn(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Wn(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Gn=b(`$ZodBase64`,(e,t)=>{t.pattern??=jt,T.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Wn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Kn(e){if(!Mt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Wn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var qn=b(`$ZodBase64URL`,(e,t)=>{t.pattern??=Mt,T.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Kn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Jn=b(`$ZodE164`,(e,t)=>{t.pattern??=Pt,T.init(e,t)});function Yn(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}}var Xn=b(`$ZodJWT`,(e,t)=>{T.init(e,t),e._zod.check=n=>{Yn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Zn=b(`$ZodNumber`,(e,t)=>{w.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ut,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}}),Qn=b(`$ZodNumberFormat`,(e,t)=>{$t.init(e,t),Zn.init(e,t)}),$n=b(`$ZodBoolean`,(e,t)=>{w.init(e,t),e._zod.pattern=Wt,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}}),er=b(`$ZodNull`,(e,t)=>{w.init(e,t),e._zod.pattern=Gt,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}}),tr=b(`$ZodUnknown`,(e,t)=>{w.init(e,t),e._zod.parse=e=>e}),nr=b(`$ZodNever`,(e,t)=>{w.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function rr(e,t,n){e.issues.length&&t.issues.push(..._(n,e.issues)),t.value[n]=e.value}var ir=b(`$ZodArray`,(e,t)=>{w.init(e,t);let n=x.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=>rr(t,r,e))):rr(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function ar(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(..._(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}}var or=[];function sr(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:or,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=oe(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function cr(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=>ar(e,n,i,t,u,d))):ar(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}var lr=new WeakMap,ur=b(`$ZodObject`,(e,t)=>{if(w.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;lr.set(t,e),Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),lr.set(t,n),n}})}let n=a(()=>sr(t));y(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)||l(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=m,i=t.catchall,o,s=x.memoizer;s?.attach(e),e._zod.parse=(t,a)=>{o??=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=s?s.alloc(e,t,{},a):{};let l=[],u=o.shape;for(let e of o.allKeys){if(e===`__proto__`)continue;let n=u[e],r=n._zod.optin,i=n._zod.optout,o=n._zod.run({value:c[e],issues:[]},a);o instanceof Promise?l.push(o.then(n=>ar(n,t,e,c,r,i))):ar(o,t,e,c,r,i)}return i?cr(l,c,t,a,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),dr=b(`$ZodObjectJIT`,(e,t)=>{ur.init(e,t);let n=e._zod.parse,r=a(()=>sr(t)),i=x.memoizer,o=t=>{let n=r.value,a=n.symbolKeys,o=new fn([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
4
|
+
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
5
|
+
const iss = ${e}.issues[i];
|
|
6
|
+
iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
|
|
7
|
+
payload.issues.push(iss);
|
|
8
|
+
}`;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)}]`:d(e),i=`${r} in input`,u=t[e],f=u?._zod?.optin,p=f!==void 0,m=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),p&&m){let e=f===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
|
|
9
|
+
const ${n}_present = ${i};
|
|
10
|
+
if (!${n}.issues.length || ${n}_present) {
|
|
11
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (${e}) {
|
|
15
|
+
newResult[${r}] = ${n}.value;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
`)}else p?o.write(`
|
|
20
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (${n}.value === undefined) {
|
|
24
|
+
if (${i}) {
|
|
25
|
+
newResult[${r}] = undefined;
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
newResult[${r}] = ${n}.value;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
`):o.write(`
|
|
32
|
+
const ${n}_present = ${i};
|
|
33
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
34
|
+
}
|
|
35
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
36
|
+
payload.issues.push({
|
|
37
|
+
code: "invalid_type",
|
|
38
|
+
expected: "nonoptional",
|
|
39
|
+
input: undefined,
|
|
40
|
+
path: [${r}]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (${n}_present) {
|
|
45
|
+
newResult[${r}] = ${n}.value;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},s,c=m,l=!x.jitless,u=l&&ee.value,f=t.catchall,p;e._zod.parse=(i,a)=>{p??=r.value;let d=i.value;return c(d)?l&&u&&a?.async===!1&&a.jitless!==!0?(s||=o(t.shape),i=s(i,a),f?cr([],d,i,a,p,e):i):n(i,a):(i.issues.push({expected:`object`,code:`invalid_type`,input:d,inst:e}),i)}});function fr(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=>!he(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=>v(e,r,S())))}),t)}var pr=b(`$ZodUnion`,(e,t)=>{w.init(e,t),y(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),y(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),y(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)))}),y(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=>s(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=>fr(t,r,e,i)):fr(o,r,e,i)}}),mr=b(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,pr.init(e,t);let n=e._zod.parse;y(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)||l(t,e,new Set);for(let r of n)t[e].add(r)}}return t}),t.options.forEach((e,n)=>{let r=lr.get(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=a(()=>{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(!m(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)}}),hr=b(`$ZodIntersection`,(e,t)=>{w.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])=>_r(e,t,n)):_r(e,i,a)}});function gr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(te(e)&&te(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=gr(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=gr(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 _r(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=gr(t.value,n.value);if(!c.valid){if(he(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var vr=b(`$ZodTuple`,(e,t)=>{w.init(e,t);let n=t.items,r=x.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=yr(n,`optin`),l=yr(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=>br(t,i,e))):br(r,i,e)}}return s.length?Promise.all(s).then(()=>xr(u,i,n,o,l)):xr(u,i,n,o,l)}});function yr(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 br(e,t,n){e.issues.length&&t.issues.push(..._(n,e.issues)),t.value[n]=e.value}function xr(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(..._(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}var Sr=b(`$ZodRecord`,(e,t)=>{w.init(e,t);let n=x.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!te(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=>v(e,i,S())),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(..._(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(..._(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`&&Ut.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=>v(e,i,S())),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(..._(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(..._(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}}),Cr=b(`$ZodEnum`,(e,t)=>{w.init(e,t);let r=n(t.entries),i=new Set(r);e._zod.values=i;let a=r.filter(e=>re.has(typeof e));e._zod.pattern=RegExp(a.length?`^(${a.map(e=>ie(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`),e._zod.parse=(t,n)=>{let a=t.value;return i.has(a)||t.issues.push({code:`invalid_value`,values:r,input:a,inst:e}),t}}),wr=b(`$ZodLiteral`,(e,t)=>{w.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`?ie(e):e?ie(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}}),Tr=b(`$ZodTransform`,(e,t)=>{w.init(e,t),e._zod.optin=`optional`,x.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Be(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 Er(e,t){return e.value=t.issues.length?void 0:t.value,e}var Dr=b(`$ZodOptional`,(e,t)=>{w.init(e,t),y(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,y(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),y(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${s(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=>Er(e,t)):Er(e,r)}return t.innerType._zod.run(e,n)}}),Or=b(`$ZodExactOptional`,(e,t)=>{Dr.init(e,t),y(e,`values`,e=>e.def.innerType._zod.values),y(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),kr=b(`$ZodNullable`,(e,t)=>{w.init(e,t),y(e,`optin`,e=>e.def.innerType._zod.optin),y(e,`optout`,e=>e.def.innerType._zod.optout),y(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${s(t.source)}|null)$`):void 0}),y(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)}),Ar=b(`$ZodDefault`,(e,t)=>{w.init(e,t),e._zod.optin=`defaulted`,y(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=>jr(e,t)):jr(r,t)}});function jr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Mr=b(`$ZodPrefault`,(e,t)=>{w.init(e,t),e._zod.optin=`defaulted`,y(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))}),Nr=b(`$ZodNonOptional`,(e,t)=>{w.init(e,t),y(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=>Pr(t,e)):Pr(i,e)}});function Pr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Fr(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>v(e,r,S()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Ir=b(`$ZodCatch`,(e,t)=>{w.init(e,t),y(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),y(e,`optout`,e=>e.def.innerType._zod.optout),y(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=>Fr(e,r,t,n)):Fr(e,r,t,n)}}),Lr=b(`$ZodPipe`,(e,t)=>{w.init(e,t),y(e,`values`,e=>e.def.in._zod.values),y(e,`optin`,e=>e.def.in._zod.optin),y(e,`optout`,e=>e.def.out._zod.optout),y(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=>Rr(e,t.in,n)):Rr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Rr(e,t.out,n)):Rr(r,t.out,n)}});function Rr(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)}var zr=b(`$ZodReadonly`,(e,t)=>{w.init(e,t),y(e,`propValues`,e=>e.def.innerType._zod.propValues),y(e,`values`,e=>e.def.innerType._zod.values),y(e,`optin`,e=>e.def.innerType?._zod?.optin),y(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(Br):Br(r)}});function Br(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Vr=b(`$ZodCustom`,(e,t)=>{C.init(e,t),w.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=>Hr(t,n,r,e));Hr(i,n,r,e)}});function Hr(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(Ce(e))}}var Ur=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},Wr=`~memo`,Gr=[];function Kr(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var qr=new WeakMap;function Jr(e,t){let n=qr.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&&Jr(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),qr.set(e,r),r}function Yr(e,t){let n=e.buckets.get(t);return n||(n=new Map,e.buckets.set(t,n)),n}var Xr,Zr=[],Qr={alloc(e,t,n){let r=Xr;if(!r)return n;Xr=void 0;let i={value:n,issues:null};return r.set(t.value,i),Zr.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`&&ei(n,e.value))throw new Ur;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=Jr(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[Wr];l||(l={buckets:new Map,backEdges:void 0},s[Wr]=l);let u;r===s?u=i:(u=Yr(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(...Kr(d.issues)):(o.memo=!0,l.backEdges??(l.backEdges=new Set),l.backEdges.add(d.value)),o;Xr=u;let f=Zr.length,p=t(o,s);Xr=void 0;let m=Zr.length>f?Zr.pop():void 0;return p instanceof Promise?p.then(e=>(m&&(m.issues=e.issues.length?Kr(e.issues):Gr),e)):(m&&(m.issues=p.issues.length?Kr(p.issues):Gr),p)};e._zod.parse=a,e._zod.run===t&&(e._zod.run=a)})}};function $r(){return Qr}function ei(e,t){let n=e[Wr]?.backEdges;return n!==void 0&&typeof t==`object`&&!!t&&n.has(t)}var ti=()=>{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`},i={nan:`NaN`};function a(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):i[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${a(e.expected)}, received ${a(Se(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${ae(e.values[0])}`:`Invalid option: expected one of ${r(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`:``}: ${r(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 ni(){return{localeError:ti()}}var ri,ii=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 ai(){return new ii}(ri=globalThis).__zod_globalRegistry??(ri.__zod_globalRegistry=ai());var oi=globalThis.__zod_globalRegistry;function si(e,t){return new e({type:`string`,...g(t)})}function ci(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...g(t)})}function li(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...g(t)})}function ui(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...g(t)})}function di(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...g(t)})}function fi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...g(t)})}function pi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...g(t)})}function mi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...g(t)})}function hi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...g(t)})}function gi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...g(t)})}function _i(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...g(t)})}function vi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...g(t)})}function yi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...g(t)})}function bi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...g(t)})}function xi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...g(t)})}function Si(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...g(t)})}function Ci(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...g(t)})}function wi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...g(t)})}function Ti(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...g(t)})}function Ei(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...g(t)})}function Di(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...g(t)})}function Oi(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...g(t)})}function ki(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...g(t)})}function Ai(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...g(t)})}function ji(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...g(t)})}function Mi(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...g(t)})}function Ni(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...g(t)})}function Pi(e,t){return new e({type:`number`,checks:[],...g(t)})}function Fi(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...g(t)})}function Ii(e,t){return new e({type:`boolean`,...g(t)})}function Li(e,t){return new e({type:`null`,...g(t)})}function Ri(e){return new e({type:`unknown`})}function zi(e,t){return new e({type:`never`,...g(t)})}function Bi(e,t){return new Xt({check:`less_than`,...g(t),value:e,inclusive:!1})}function Vi(e,t){return new Xt({check:`less_than`,...g(t),value:e,inclusive:!0})}function Hi(e,t){return new Zt({check:`greater_than`,...g(t),value:e,inclusive:!1})}function Ui(e,t){return new Zt({check:`greater_than`,...g(t),value:e,inclusive:!0})}function Wi(e,t){return new Qt({check:`multiple_of`,...g(t),value:e})}function Gi(e,t){return new en({check:`max_length`,...g(t),maximum:e})}function Ki(e,t){return new tn({check:`min_length`,...g(t),minimum:e})}function qi(e,t){return new nn({check:`length_equals`,...g(t),length:e})}function Ji(e,t){return new an({check:`string_format`,format:`regex`,...g(t),pattern:e})}function Yi(e){return new on({check:`string_format`,format:`lowercase`,...g(e)})}function Xi(e){return new sn({check:`string_format`,format:`uppercase`,...g(e)})}function Zi(e,t){return new cn({check:`string_format`,format:`includes`,...g(t),includes:e})}function Qi(e,t){return new ln({check:`string_format`,format:`starts_with`,...g(t),prefix:e})}function $i(e,t){return new un({check:`string_format`,format:`ends_with`,...g(t),suffix:e})}function ea(e){return new dn({check:`overwrite`,tx:e})}function ta(e){return ea(t=>t.normalize(e))}function na(){return ea(e=>e.trim())}function ra(){return ea(e=>e.toLowerCase())}function ia(){return ea(e=>e.toUpperCase())}function aa(){return ea(e=>f(e))}function oa(e,t,n){return new e({type:`array`,element:t,...g(n)})}function sa(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...g(n)})}function ca(e,t){let n=la(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Ce(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(Ce(r))}},e(t.value,t)),t);return n}function la(e,t){let n=new C({check:`custom`,...g(t)});return n._zod.check=e,n}function ua(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&l(e,t,n[t]);return e}function da(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??oi,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 E(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 D(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,D(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&ua(o.schema,c),t.io===`input`&&O(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 fa(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function pa(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}/${fa(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+fa(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>
|
|
49
|
+
|
|
50
|
+
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 ma(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;ma(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}var ha=new Set([`type`,`properties`,`required`,`additionalProperties`]),ga=[`oneOf`,`anyOf`];function _a(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function va(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!ha.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]??_a(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}l(n,r,e.length===1?e[0]:va(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=_a(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 ya(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of ha)if(t in e)return;let n=t.filter(e=>ga.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=va(t);else{let e=n[0],i=ga.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=>va([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,ua(e,r))}function ba(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)):ua(i,s),ua(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())ma(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)??[])ya(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)}ua(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,l(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:Sa(t,`input`,e.processors),output:Sa(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function O(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 O(r.element,n);if(r.type===`set`)return O(r.valueType,n);if(r.type===`lazy`)return O(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 O(r.innerType,n);if(r.type===`intersection`)return O(r.left,n)||O(r.right,n);if(r.type===`record`||r.type===`map`)return O(r.keyType,n)||O(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:O(r.in,n)||O(r.out,n);if(r.type===`object`){for(let e in r.shape)if(O(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(O(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(O(e,n))return!0;return!!(r.rest&&O(r.rest,n))}return!1}var xa=(e,t={})=>n=>{let r=da({...n,processors:t});return D(e,r),pa(r,e),ba(r,e)},Sa=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=da({...i??{},target:a,io:t,processors:n});return D(e,o),pa(o,e),ba(o,e)},Ca={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},wa=(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=Ca[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}))])}},Ta=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`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):E(e,t,i,r,`A multipleOf divisor of ${c} cannot be represented in JSON Schema`))},Ea=(e,t,n,r)=>{n.type=`boolean`},Da=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Oa=(e,t,n,r)=>{n.not={}},ka=(e,t,r,i)=>{let a=e._zod.def,o=n(a.entries);if(o.length===0){r.not={};return}o.every(e=>typeof e==`number`)&&(r.type=`number`),o.every(e=>typeof e==`string`)&&(r.type=`string`),r.enum=o},Aa=(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(E(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(E(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}},ja=(e,t,n,r)=>{E(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Ma=(e,t,n,r)=>{E(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Na=(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=D(a.element,t,{...r,path:[...r.path,`items`]})};function Pa(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Pa(t.out):t.type===`catch`?Pa(t.innerType):e._zod.optin}var Fa=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&E(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)l(i.properties,e,D(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`?Pa(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=D(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ia=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>D(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},La=(e,t,n,r)=>{let i=e._zod.def,a=D(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=D(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)},Ra=(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)=>D(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?D(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`?Pa(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 za(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=za(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=>za(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`)?Ut:Ht).source),p):p}var Ba=new WeakMap;function Va(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 Ba.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=za(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)}}var Ha=(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=D(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)l(i.patternProperties,t.source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=D(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Ba.get(t);n||(n=[],Ba.set(t,n),t.deferred.push(()=>Va(t))),n.push(e)}i.additionalProperties=D(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,u=t.io===`input`&&Pa(a.valueType)!==void 0;if(c&&!a.partial&&!u){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Ua=(e,t,n,r)=>{let i=e._zod.def,a=D(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`}]},Wa=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ga=Symbol();function Ka(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(E(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Ga):JSON.parse(o)}var qa=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Ka(i.defaultValue,e,t,n,r);o!==Ga&&(n.default=o)},Ja=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Ka(i.defaultValue,e,t,n,r);o!==Ga&&(n._prefault=o)},Ya=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{E(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Xa=(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;D(o,t,r);let s=t.seen.get(e);s.ref=o},Za=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Qa=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},$a=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})}})}var k=b(`ZodError`,(e,t)=>{Je.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);$a.has(n)||($a.add(n),eo(n,`format`,e=>t=>Qe(e,t)),eo(n,`flatten`,e=>t=>Ze(e,t)),eo(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,i,2)}),eo(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,i,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),to=et(k),no=tt(k),ro=nt(k),io=it(k),ao=ot(k),oo=st(k),so=ct(k),co=lt(k),lo=ut(k),uo=dt(k),fo=ft(k),po=pt(k);function mo(){x.localeError||S(ni())}function ho(){x.memoizer||S({memoizer:$r()})}var A=b(`ZodType`,(e,t)=>(mo(),w.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(u(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 h(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(As(e,t))},superRefine(e,t){return this.check(js(e,t))},overwrite(e){return this.check(ea(e))},optional(){return fs(this)},exactOptional(){return ms(this)},nullable(){return gs(this)},nullish(){return fs(gs(this))},nonoptional(e){return Ss(this,e)},array(){return I(this)},or(e){return $o([this,e])},and(e){return ns(this,e)},transform(e){return Es(this,us(e))},default(e){return vs(this,e)},prefault(e){return bs(this,e)},catch(e){return ws(this,e)},pipe(e){return Es(this,e)},readonly(){return Os(this)},describe(e){let t=this.clone();return oi.add(t,{description:e}),t},meta(...e){if(e.length===0)return oi.get(this);let t=this.clone();return oi.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 Ee(this,`~standard`,{...hn(this),jsonSchema:{input:Sa(this,`input`),output:Sa(this,`output`)}})},set"~standard"(e){Te(this,`~standard`,e)},parse:function e(t,n){return to(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await no(this,t,n,{callee:e})},safeParse(e,t){return ro(this,e,t)},async safeParseAsync(e,t){return io(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Te(this,`spa`,e)},encode:function e(t,n){return ao(this,t,n,{callee:e})},decode:function e(t,n){return oo(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await so(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await co(this,t,n,{callee:e})},safeEncode(e,t){return lo(this,e,t)},safeDecode(e,t){return uo(this,e,t)},async safeEncodeAsync(e,t){return fo(this,e,t)},async safeDecodeAsync(e,t){return po(this,e,t)},toJSONSchema(e){return xa(this,{})(e)},get description(){return oi.get(this)?.description},get _def(){return this._zod.def}}),go=b(`_ZodString`,(e,t)=>{gn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wa(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(Ji(...e))},includes(...e){return this.check(Zi(...e))},startsWith(...e){return this.check(Qi(...e))},endsWith(...e){return this.check($i(...e))},min(...e){return this.check(Ki(...e))},max(...e){return this.check(Gi(...e))},length(...e){return this.check(qi(...e))},nonempty(...e){return this.check(Ki(1,...e))},lowercase(e){return this.check(Yi(e))},uppercase(e){return this.check(Xi(e))},trim(){return this.check(na())},normalize(...e){return this.check(ta(...e))},toLowerCase(){return this.check(ra())},toUpperCase(){return this.check(ia())},slugify(){return this.check(aa())}}),_o=b(`ZodString`,(e,t)=>{gn.init(e,t),go.init(e,t)},{email(e){return this.check(ci(So,e))},url(e){return this.check(mi(To,e))},jwt(e){return this.check(ki(Bo,e))},emoji(e){return this.check(hi(Eo,e))},guid(e){return this.check(li(Co,e))},uuid(e){return this.check(ui(wo,e))},uuidv4(e){return this.check(di(wo,e))},uuidv6(e){return this.check(fi(wo,e))},uuidv7(e){return this.check(pi(wo,e))},nanoid(e){return this.check(gi(Do,e))},cuid(e){return this.check(_i(Oo,e))},cuid2(e){return this.check(vi(ko,e))},ulid(e){return this.check(yi(Ao,e))},base64(e){return this.check(Ei(Lo,e))},base64url(e){return this.check(Di(Ro,e))},xid(e){return this.check(bi(jo,e))},ksuid(e){return this.check(xi(Mo,e))},ipv4(e){return this.check(Si(No,e))},ipv6(e){return this.check(Ci(Po,e))},cidrv4(e){return this.check(wi(Fo,e))},cidrv6(e){return this.check(Ti(Io,e))},e164(e){return this.check(Oi(zo,e))},datetime(e){return this.check(Ai(vo,e))},date(e){return this.check(ji(yo,e))},time(e){return this.check(Mi(bo,e))},duration(e){return this.check(Ni(xo,e))}});function j(e){return si(_o,e)}var M=b(`ZodStringFormat`,(e,t)=>{T.init(e,t),go.init(e,t)}),vo=b(`ZodISODateTime`,(e,t)=>{Nn.init(e,t),M.init(e,t)}),yo=b(`ZodISODate`,(e,t)=>{Pn.init(e,t),M.init(e,t)}),bo=b(`ZodISOTime`,(e,t)=>{Fn.init(e,t),M.init(e,t)}),xo=b(`ZodISODuration`,(e,t)=>{In.init(e,t),M.init(e,t)}),So=b(`ZodEmail`,(e,t)=>{yn.init(e,t),M.init(e,t)}),Co=b(`ZodGUID`,(e,t)=>{_n.init(e,t),M.init(e,t)}),wo=b(`ZodUUID`,(e,t)=>{vn.init(e,t),M.init(e,t)}),To=b(`ZodURL`,(e,t)=>{Tn.init(e,t),M.init(e,t)}),Eo=b(`ZodEmoji`,(e,t)=>{En.init(e,t),M.init(e,t)}),Do=b(`ZodNanoID`,(e,t)=>{Dn.init(e,t),M.init(e,t)}),Oo=b(`ZodCUID`,(e,t)=>{On.init(e,t),M.init(e,t)}),ko=b(`ZodCUID2`,(e,t)=>{kn.init(e,t),M.init(e,t)}),Ao=b(`ZodULID`,(e,t)=>{An.init(e,t),M.init(e,t)}),jo=b(`ZodXID`,(e,t)=>{jn.init(e,t),M.init(e,t)}),Mo=b(`ZodKSUID`,(e,t)=>{Mn.init(e,t),M.init(e,t)}),No=b(`ZodIPv4`,(e,t)=>{Ln.init(e,t),M.init(e,t)}),Po=b(`ZodIPv6`,(e,t)=>{Bn.init(e,t),M.init(e,t)}),Fo=b(`ZodCIDRv4`,(e,t)=>{Vn.init(e,t),M.init(e,t)}),Io=b(`ZodCIDRv6`,(e,t)=>{Un.init(e,t),M.init(e,t)}),Lo=b(`ZodBase64`,(e,t)=>{Gn.init(e,t),M.init(e,t)}),Ro=b(`ZodBase64URL`,(e,t)=>{qn.init(e,t),M.init(e,t)}),zo=b(`ZodE164`,(e,t)=>{Jn.init(e,t),M.init(e,t)}),Bo=b(`ZodJWT`,(e,t)=>{Xn.init(e,t),M.init(e,t)}),Vo=b(`ZodNumber`,(e,t)=>{Zn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ta(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(Hi(e,t))},gte(e,t){return this.check(Ui(e,t))},min(e,t){return this.check(Ui(e,t))},lt(e,t){return this.check(Bi(e,t))},lte(e,t){return this.check(Vi(e,t))},max(e,t){return this.check(Vi(e,t))},int(e){return this.check(Uo(e))},safe(e){return this.check(Uo(e))},positive(e){return this.check(Hi(0,e))},nonnegative(e){return this.check(Ui(0,e))},negative(e){return this.check(Bi(0,e))},nonpositive(e){return this.check(Vi(0,e))},multipleOf(e,t){return this.check(Wi(e,t))},step(e,t){return this.check(Wi(e,t))},finite(){return this}});function N(e){return Pi(Vo,e)}var Ho=b(`ZodNumberFormat`,(e,t)=>{Qn.init(e,t),Vo.init(e,t)});function Uo(e){return Fi(Ho,e)}var Wo=b(`ZodBoolean`,(e,t)=>{$n.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ea(e,t,n,r)});function P(e){return Ii(Wo,e)}var Go=b(`ZodNull`,(e,t)=>{er.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Da(e,t,n,r)});function Ko(e){return Li(Go,e)}var qo=b(`ZodUnknown`,(e,t)=>{tr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function F(){return Ri(qo)}var Jo=b(`ZodNever`,(e,t)=>{nr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oa(e,t,n,r)});function Yo(e){return zi(Jo,e)}var Xo=b(`ZodArray`,(e,t)=>{ho(),ir.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Na(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Ki(e,t))},nonempty(e){return this.check(Ki(1,e))},max(e,t){return this.check(Gi(e,t))},length(e,t){return this.check(qi(e,t))},unwrap(){return this.element}});function I(e,t){return oa(Xo,e,t)}var Zo=b(`ZodObject`,(e,t)=>{ho(),dr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fa(e,t,n,r),Me(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:Yo()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return ue(this,e)},safeExtend(e){return de(this,e)},merge(e){return fe(this,e)},pick(e){return ce(this,e)},omit(e){return le(this,e)},partial(...e){return pe(ds,this,e[0])},exactPartial(...e){return pe(ps,this,e[0],`exactPartial`)},required(...e){return me(xs,this,e[0])}});function L(e,t){return new Zo({type:`object`,shape:e??{},...g(t)})}function R(e,t){return new Zo({type:`object`,shape:e,catchall:Yo(),...g(t)})}var Qo=b(`ZodUnion`,(e,t)=>{pr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ia(e,t,n,r),e.options=t.options});function $o(e,t){return new Qo({type:`union`,options:e,...g(t)})}var es=b(`ZodDiscriminatedUnion`,(e,t)=>{Qo.init(e,t),mr.init(e,t)});function z(e,t,n){return new es({type:`union`,options:t,discriminator:e,...g(n)})}var ts=b(`ZodIntersection`,(e,t)=>{hr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>La(e,t,n,r)});function ns(e,t){return new ts({type:`intersection`,left:e,right:t})}var rs=b(`ZodTuple`,(e,t)=>{ho(),vr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ra(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 ds({type:`optional`,innerType:e}))})}});function is(e,t,n){let r=t instanceof w;return new rs({type:`tuple`,items:e,rest:r?t:null,...g(r?n:t)})}var as=b(`ZodRecord`,(e,t)=>{ho(),Sr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ha(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function os(e,t,n){return!t||!t._zod?new as({type:`record`,keyType:j(),valueType:e,...g(t)}):new as({type:`record`,keyType:e,valueType:t,...g(n)})}var ss=b(`ZodEnum`,(e,t)=>{Cr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ka(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 ss({...t,checks:[],...g(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 ss({...t,checks:[],...g(r),entries:i})}});function B(e,t){return new ss({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...g(t)})}var cs=b(`ZodLiteral`,(e,t)=>{wr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aa(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 cs({type:`literal`,values:Array.isArray(e)?e:[e],...g(t)})}var ls=b(`ZodTransform`,(e,t)=>{ho(),Tr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ma(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Be(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ce(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(Ce(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function us(e){return new ls({type:`transform`,transform:e})}var ds=b(`ZodOptional`,(e,t)=>{Dr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fs(e){return new ds({type:`optional`,innerType:e})}var ps=b(`ZodExactOptional`,(e,t)=>{Or.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ms(e){return new ps({type:`optional`,innerType:e})}var hs=b(`ZodNullable`,(e,t)=>{kr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ua(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gs(e){return new hs({type:`nullable`,innerType:e})}var _s=b(`ZodDefault`,(e,t)=>{Ar.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function vs(e,t){return new _s({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ne(t)}})}var ys=b(`ZodPrefault`,(e,t)=>{Mr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ja(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bs(e,t){return new ys({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ne(t)}})}var xs=b(`ZodNonOptional`,(e,t)=>{Nr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ss(e,t){return new xs({type:`nonoptional`,innerType:e,...g(t)})}var Cs=b(`ZodCatch`,(e,t)=>{Ir.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ya(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ws(e,t){return new Cs({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Pe(t)})}var Ts=b(`ZodPipe`,(e,t)=>{Lr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xa(e,t,n,r),e.in=t.in,e.out=t.out});function Es(e,t){return new Ts({type:`pipe`,in:e,out:t})}var Ds=b(`ZodReadonly`,(e,t)=>{zr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Za(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Os(e){return new Ds({type:`readonly`,innerType:e})}var ks=b(`ZodCustom`,(e,t)=>{Vr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ja(e,t,n,r)});function As(e,t={}){return sa(ks,e,t)}function js(e,t){return ca(e,t)}var Ms=j().regex(/^[a-z][a-z0-9-]*$/).brand(),Ns=j().regex(/^ws_[a-f0-9]{24}$/).brand(),Ps=$o([V(`~`),Ns]),Fs=L({id:Ms,label:j().min(1),path:j().min(1).nullable(),available:P(),writable:P(),skillCount:N().int().nonnegative()}),H=L({workspaceId:Ps,providerId:Ms}),Is=L({label:j().min(1),active:P(),available:P(),skillCount:N().int().nonnegative(),providers:I(Fs)}),Ls=z(`kind`,[Is.extend({id:V(`~`),kind:V(`global`),path:Ko()}),Is.extend({id:Ns,kind:V(`directory`),path:j().min(1)})]),U=j().regex(/^sk_[a-f0-9]{24}$/).brand(),Rs=B([`user`,`project`,`plugin`]),zs=L({pluginName:j(),marketplace:j(),version:j()}),Bs=B([`skills-cli`,`manual`,`unknown`]),Vs=L({id:U,name:j(),description:j(),directoryName:j(),disabled:P(),provider:j(),location:Rs,sourcePriority:N().optional(),sourceKind:j().optional(),path:j(),hasReferences:P(),hasScripts:P(),hasAssets:P(),pluginInfo:zs.nullable(),installedVia:Bs.optional(),updatable:P().optional()}),Hs=Vs.extend({size:N().int().nonnegative(),content:j(),revision:j().regex(/^sha256:[a-f0-9]{64}$/)}),Us=L({skillId:U,name:j(),status:B([`enabled`,`disabled`,`skipped`,`conflict`,`failed`]),error:j().optional()}),Ws=L({mode:B([`enable`,`disable`]),results:I(Us),succeeded:N().int().nonnegative(),skipped:N().int().nonnegative(),conflicts:N().int().nonnegative(),failed:N().int().nonnegative()}),Gs=L({skillId:U,name:j(),success:P(),errors:I(j()),warnings:I(j())});function Ks(e){return e[0]??{}}function qs(e){return Array.isArray(e)?e:e==null?[]:[e]}function Js(e){return typeof e.bytes==`function`?e.bytes():e.arrayBuffer()}var Ys=`orpc`,Xs=`@orpc/shared`,Zs=`1.14.6`,Qs=class extends Error{constructor(...e){super(...e),this.name=`AbortError`}};function $s(e){let t=Promise.resolve();return(...n)=>t=t.catch(()=>{}).then(()=>e(...n))}var ec=2,tc=`__${Xs}@${Zs}/otel/config__`;function nc(){return globalThis[tc]}function rc(e,t={},n){return(nc()?.tracer)?.startSpan(e,t,n)}function ic(e,t,n={}){if(!e)return;let r=ac(t);e.recordException(r),(!n.signal?.aborted||n.signal.reason!==t)&&e.setStatus({code:ec,message:r.message})}function ac(e){if(e instanceof Error){let t={message:e.message,name:e.name,stack:e.stack};return`code`in e&&(typeof e.code==`string`||typeof e.code==`number`)&&(t.code=e.code),t}return{message:String(e)}}async function oc({name:e,context:t,...n},r){let i=nc()?.tracer;if(!i)return r();let a=async e=>{try{return await r(e)}catch(t){throw ic(e,t,n),t}finally{e.end()}};return t?i.startActiveSpan(e,n,t,a):i.startActiveSpan(e,n,a)}async function sc(e,t){let n=nc();if(!e||!n)return t();let r=n.trace.setSpan(n.context.active(),e);return n.context.with(r,t)}var cc=class{openIds=new Set;queues=new Map;waiters=new Map;get length(){return this.openIds.size}get waiterIds(){return Array.from(this.waiters.keys())}hasBufferedItems(e){return!!this.queues.get(e)?.length}open(e){this.openIds.add(e)}isOpen(e){return this.openIds.has(e)}push(e,t){this.assertOpen(e);let n=this.waiters.get(e);if(n?.length)n.shift()[0](t),n.length===0&&this.waiters.delete(e);else{let n=this.queues.get(e);n?n.push(t):this.queues.set(e,[t])}}async pull(e){this.assertOpen(e);let t=this.queues.get(e);if(t?.length){let n=t.shift();return t.length===0&&this.queues.delete(e),n}return new Promise((t,n)=>{let r=this.waiters.get(e),i=[t,n];r?r.push(i):this.waiters.set(e,[i])})}close({id:e,reason:t}={}){if(e===void 0){this.waiters.forEach((e,n)=>{let r=t??new Qs(`[AsyncIdQueue] Queue[${n}] was closed or aborted while waiting for pulling.`);e.forEach(([,e])=>e(r))}),this.waiters.clear(),this.openIds.clear(),this.queues.clear();return}let n=t??new Qs(`[AsyncIdQueue] Queue[${e}] was closed or aborted while waiting for pulling.`);this.waiters.get(e)?.forEach(([,e])=>e(n)),this.waiters.delete(e),this.openIds.delete(e),this.queues.delete(e)}assertOpen(e){if(!this.isOpen(e))throw Error(`[AsyncIdQueue] Cannot access queue[${e}] because it is not open or aborted.`)}};function lc(e){return!e||typeof e!=`object`?!1:`next`in e&&typeof e.next==`function`&&Symbol.asyncIterator in e&&typeof e[Symbol.asyncIterator]==`function`}var uc=Symbol.asyncDispose??Symbol.for(`asyncDispose`),dc=class{#e=!1;#t=!1;#n;#r;constructor(e,t){this.#n=t,this.#r=$s(async()=>{if(this.#e)return{done:!0,value:void 0};try{let t=await e();return t.done&&(this.#e=!0),t}catch(e){throw this.#e=!0,e}finally{this.#e&&!this.#t&&(this.#t=!0,await this.#n(`next`))}})}next(){return this.#r()}async return(e){return this.#e=!0,this.#t||(this.#t=!0,await this.#n(`return`)),{done:!0,value:e}}async throw(e){throw this.#e=!0,this.#t||(this.#t=!0,await this.#n(`throw`)),e}async[uc](){this.#e=!0,this.#t||(this.#t=!0,await this.#n(`dispose`))}[Symbol.asyncIterator](){return this}};function fc({name:e,...t},n){let r;return new dc(async()=>{r??=rc(e);try{let e=await sc(r,()=>n.next());return r?.addEvent(e.done?`completed`:`yielded`),e}catch(e){throw ic(r,e,t),e}},async e=>{try{e!==`next`&&await sc(r,()=>n.return?.())}catch(e){throw ic(r,e,t),e}finally{r?.end()}})}var pc=class{index=BigInt(1);generate(){let e=this.index.toString(36);return this.index++,e}};function mc(e,t,n){let r=(t,i)=>{let a=e[i];return a?a({...t,next:(e=t)=>r(e,i+1)}):n(t)};return r(t,0)}function hc(e){return JSON.stringify(e)}function gc(e){return vc(e)?Object.getPrototypeOf(e)?.constructor:null}function _c(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||!t||!t.constructor}function vc(e){return!!e&&(typeof e==`object`||typeof e==`function`)}function yc(e){if(Array.isArray(e))return e.map(yc);if(_c(e)){let t={};for(let n in e)t[n]=yc(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=yc(e[n]);return t}return e}function bc(e,...t){return typeof e==`function`?e(...t):e}function xc(e){return new Proxy(e,{get(e,t,n){let r=Reflect.get(e,t,n);return t!==`then`||typeof r!=`function`?r:new Proxy(r,{apply(t,n,r){if(r.length!==2||r.some(e=>!Cc(e)))return Reflect.apply(t,n,r);let i=!0;r[0].call(n,xc(new Proxy(e,{get:(e,t,n)=>{if(i&&t===`then`){i=!1;return}return Reflect.get(e,t,n)}})))}})}})}var Sc=/^\s*function\s*\(\)\s*\{\s*\[native code\]\s*\}\s*$/;function Cc(e){return typeof e==`function`&&Sc.test(e.toString())}function wc(e){try{return decodeURIComponent(e)}catch{return e}}var Tc=`@orpc/client`,Ec=`1.14.6`,Dc={BAD_REQUEST:{status:400,message:`Bad Request`},UNAUTHORIZED:{status:401,message:`Unauthorized`},FORBIDDEN:{status:403,message:`Forbidden`},NOT_FOUND:{status:404,message:`Not Found`},METHOD_NOT_SUPPORTED:{status:405,message:`Method Not Supported`},NOT_ACCEPTABLE:{status:406,message:`Not Acceptable`},TIMEOUT:{status:408,message:`Request Timeout`},CONFLICT:{status:409,message:`Conflict`},PRECONDITION_FAILED:{status:412,message:`Precondition Failed`},PAYLOAD_TOO_LARGE:{status:413,message:`Payload Too Large`},UNSUPPORTED_MEDIA_TYPE:{status:415,message:`Unsupported Media Type`},UNPROCESSABLE_CONTENT:{status:422,message:`Unprocessable Content`},TOO_MANY_REQUESTS:{status:429,message:`Too Many Requests`},CLIENT_CLOSED_REQUEST:{status:499,message:`Client Closed Request`},INTERNAL_SERVER_ERROR:{status:500,message:`Internal Server Error`},NOT_IMPLEMENTED:{status:501,message:`Not Implemented`},BAD_GATEWAY:{status:502,message:`Bad Gateway`},SERVICE_UNAVAILABLE:{status:503,message:`Service Unavailable`},GATEWAY_TIMEOUT:{status:504,message:`Gateway Timeout`}};function Oc(e,t){return t??Dc[e]?.status??500}function kc(e,t){return t||Dc[e]?.message||e}var Ac,jc=class e extends Error{defined;code;status;data;static{let t=Symbol.for(`__${Tc}@${Ec}/error/ORPC_ERROR_CONSTRUCTORS__`);globalThis[t]??=new WeakSet,Ac=globalThis[t],Ac.add(e)}constructor(e,...t){let n=Ks(t);if(n.status!==void 0&&!Nc(n.status))throw Error(`[ORPCError] Invalid error status code.`);let r=kc(e,n.message);super(r,n),this.code=e,this.status=Oc(e,n.status),this.defined=n.defined??!1,this.data=n.data}toJSON(){return{defined:this.defined,code:this.code,status:this.status,message:this.message,data:this.data}}static[Symbol.hasInstance](e){if(Ac.has(this)){let t=gc(e);if(t&&Ac.has(t))return!0}return super[Symbol.hasInstance](e)}};function Mc(e){return e instanceof jc?e:new jc(`INTERNAL_SERVER_ERROR`,{message:`Internal server error`,cause:e})}function Nc(e){return e<200||e>=400}function Pc(e){if(!_c(e))return!1;let t=[`defined`,`code`,`status`,`message`,`data`];return!Object.keys(e).some(e=>!t.includes(e))&&`defined`in e&&typeof e.defined==`boolean`&&`code`in e&&typeof e.code==`string`&&`status`in e&&typeof e.status==`number`&&Nc(e.status)&&`message`in e&&typeof e.message==`string`}function Fc(e,t={}){return new jc(e.code,{...t,...e})}var Ic=class extends TypeError{},Lc=class extends Error{data;constructor(e){super(e?.message??`An error event was received`,e),this.data=e?.data}};TransformStream;function Rc(e){if(e.includes(`
|
|
51
|
+
`))throw new Ic(`Event's id must not contain a newline character`)}function zc(e){if(!Number.isInteger(e)||e<0)throw new Ic(`Event's retry must be a integer and >= 0`)}function Bc(e){if(e.includes(`
|
|
52
|
+
`))throw new Ic(`Event's comment must not contain a newline character`)}var Vc=Symbol(`ORPC_EVENT_SOURCE_META`);function Hc(e,t){if(t.id===void 0&&t.retry===void 0&&!t.comments?.length)return e;if(t.id!==void 0&&Rc(t.id),t.retry!==void 0&&zc(t.retry),t.comments!==void 0)for(let e of t.comments)Bc(e);return new Proxy(e,{get(e,n,r){return n===Vc?t:Reflect.get(e,n,r)}})}function Uc(e){return vc(e)?Reflect.get(e,Vc):void 0}function Wc(e,t=`inline`){return`${t}; filename="${e.replace(/[^\x20-\x7E]/g,`_`).replace(/"/g,`\\"`)}"; filename*=utf-8''${encodeURIComponent(e).replace(/['()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`).replace(/%(7C|60|5E)/g,(e,t)=>String.fromCharCode(Number.parseInt(t,16)))}`}function Gc(e){let t=e.match(/filename\*=(UTF-8'')?([^;]*)/i);if(t&&typeof t[2]==`string`)return wc(t[2]);let n=e.match(/filename="((?:\\"|[^"])*)"/i);if(n&&typeof n[1]==`string`)return n[1].replace(/\\"/g,`"`)}function Kc(e,t){let n={...e};for(let e in t)Array.isArray(t[e])?n[e]=[...qs(n[e]),...t[e]]:t[e]!==void 0&&(n[e]=Array.isArray(n[e])?[...n[e],t[e]]:n[e]===void 0?t[e]:[n[e],t[e]]);return n}function qc(e){if(typeof e==`string`||e===void 0)return e;if(e.length!==0)return e.join(`, `)}function Jc(e){return!!(qc(e[`content-type`])?.startsWith(`text/event-stream`)&&qc(e[`content-disposition`])===void 0)}function Yc(e,t){let n=async e=>{let n=await t.error(e);if(n!==e){let t=Uc(e);t&&vc(n)&&(n=Hc(n,t))}return n};return new dc(async()=>{let{done:r,value:i}=await(async()=>{try{return await e.next()}catch(e){throw await n(e)}})(),a=await t.value(i,r);if(a!==i){let e=Uc(i);e&&vc(a)&&(a=Hc(a,e))}return{done:r,value:a}},async()=>{try{await e.return?.()}catch(e){throw await n(e)}})}function Xc(e){return{...e,context:e.context??{}}}function Zc(e,t={}){let n=t.path??[];return xc(new Proxy(async(...[t,r={}])=>await e.call(n,t,Xc(r)),{get(r,i){return typeof i==`string`?Zc(e,{...t,path:[...n,i]}):Reflect.get(r,i)}}))}var Qc=/^http:\/\/orpc\//,W=(e=>(e[e.REQUEST=1]=`REQUEST`,e[e.RESPONSE=2]=`RESPONSE`,e[e.EVENT_ITERATOR=3]=`EVENT_ITERATOR`,e[e.ABORT_SIGNAL=4]=`ABORT_SIGNAL`,e))(W||{});function $c(e,t,n){if(t===3){let r=n;return{i:e,t,p:{e:r.event,d:r.data,m:r.meta}}}if(t===4)return{i:e,t,p:n};let r=n;return{i:e,p:{u:r.url.toString().replace(Qc,`/`),b:r.body,h:Object.keys(r.headers).length>0?r.headers:void 0,m:r.method===`POST`?void 0:r.method}}}function el(e){let t=e.i,n=e.t;if(n===3){let r=e.p;return[t,n,{event:r.e,data:r.d,meta:r.m}]}if(n===4)return[t,n,e.p];let r=e.p;return[t,2,{status:r.s??200,headers:r.h??{},body:r.b}]}async function tl(e,t,n){if(t===3||t===4)return ol($c(e,t,n));let r=n,{body:i,headers:a}=await rl(r.body,r.headers),o=$c(e,1,{...r,body:i instanceof Blob?void 0:i,headers:a});return i instanceof Blob?ol(o,i):ol(o)}async function nl(e){let{json:t,buffer:n}=await sl(e),[r,i,a]=el(t);if(i===3||i===4)return[r,i,a];let o=a,s=await il(o.headers,o.body,n);return[r,i,{...o,body:s}]}async function rl(e,t){let n={...t},r=n[`content-disposition`];if(delete n[`content-type`],delete n[`content-disposition`],e instanceof Blob)return n[`content-type`]=e.type,n[`content-disposition`]=r??Wc(e instanceof File?e.name:`blob`),{body:e,headers:n};if(e instanceof FormData){let t=new Response(e);return n[`content-type`]=t.headers.get(`content-type`),{body:await t.blob(),headers:n}}return e instanceof URLSearchParams?(n[`content-type`]=`application/x-www-form-urlencoded`,{body:e.toString(),headers:n}):lc(e)?(n[`content-type`]=`text/event-stream`,{body:void 0,headers:n}):{body:e,headers:n}}async function il(e,t,n){let r=qc(e[`content-type`]),i=qc(e[`content-disposition`]);if(typeof i==`string`){let e=Gc(i)??`blob`;return new File(n===void 0?[]:[n],e,{type:r})}return r?.startsWith(`multipart/form-data`)?new Response(n,{headers:{"content-type":r}}).formData():r?.startsWith(`application/x-www-form-urlencoded`)&&typeof t==`string`?new URLSearchParams(t):t}var al=255;async function ol(e,t){let n=hc(e);return t===void 0||t.size===0?n:Js(new Blob([new TextEncoder().encode(n),new Uint8Array([al]),t]))}async function sl(e){if(typeof e==`string`)return{json:JSON.parse(e)};let t=e instanceof Uint8Array?e:new Uint8Array(e),n=t.indexOf(al);if(n===-1){let e=new TextDecoder().decode(t);return{json:JSON.parse(e)}}let r=new TextDecoder().decode(t.subarray(0,n)),i=t.subarray(n+1);return{json:JSON.parse(r),buffer:i}}function cl(e,t,n,r={}){let i;return new dc(async()=>{i??=rc(`consume_event_iterator_stream`);try{let n=await sc(i,()=>e.pull(t));switch(n.event){case`message`:{let e=n.data;return n.meta&&vc(e)&&(e=Hc(e,n.meta)),i?.addEvent(`message`),{value:e,done:!1}}case`error`:{let e=new Lc({data:n.data});throw n.meta&&(e=Hc(e,n.meta)),i?.addEvent(`error`),e}case`done`:{let e=n.data;return n.meta&&vc(e)&&(e=Hc(e,n.meta)),i?.addEvent(`done`),{value:e,done:!0}}}}catch(e){throw e instanceof Lc||ic(i,e,r),e}},async e=>{try{e!==`next`&&i?.addEvent(`cancelled`),await sc(i,()=>n(e))}catch(e){throw ic(i,e,r),e}finally{i?.end()}})}function ll(e,t){return oc({name:`stream_event_iterator`},async n=>{for(;;){let r=await(async()=>{try{let{value:t,done:r}=await e.next();return r?(n?.addEvent(`done`),{event:`done`,data:t,meta:Uc(t)}):(n?.addEvent(`message`),{event:`message`,data:t,meta:Uc(t)})}catch(e){if(e instanceof Lc)return n?.addEvent(`error`),{event:`error`,data:e.data,meta:Uc(e)};try{await t({event:`error`,data:void 0})}catch(t){throw ic(n,e),t}throw e}})(),i=!1;try{let n=await t(r);if(r.event===`done`||r.event===`error`)return;if(n===`abort`){i=!0,await e.return?.();return}}catch(t){if(!i)try{await e.return?.()}catch(e){throw ic(n,t),e}throw t}}})}var ul=class{peer;constructor(e){this.peer=new dl(async([t,n,r])=>{await e(await tl(t,n,r))})}get length(){return this.peer.length}open(e){return this.peer.open(e)}async request(e){return this.peer.request(e)}async message(e){return this.peer.message(await nl(e))}close(e={}){return this.peer.close(e)}},dl=class{idGenerator=new pc;responseQueue=new cc;serverEventIteratorQueue=new cc;serverControllers=new Map;cleanupFns=new Map;send;constructor(e){this.send=async t=>{let n=t[0];this.serverControllers.has(n)&&await e(t)}}get length(){return(+this.responseQueue.length+this.serverEventIteratorQueue.length+this.serverControllers.size+this.cleanupFns.size)/4}open(e){this.serverEventIteratorQueue.open(e),this.responseQueue.open(e);let t=new AbortController;return this.serverControllers.set(e,t),this.cleanupFns.set(e,[]),t}async request(e){let t=e.signal;return oc({name:`send_peer_request`,signal:t},async()=>{if(t?.aborted)throw t.reason;let n=this.idGenerator.generate(),r=this.open(n);try{let i=nc();if(i){let t=yc(e.headers);i.propagation.inject(i.context.active(),t),e={...e,headers:t}}if(await this.send([n,W.REQUEST,e]),t?.aborted)throw await this.send([n,W.ABORT_SIGNAL,void 0]),t.reason;let a;if(t?.addEventListener(`abort`,a=async()=>{await this.send([n,W.ABORT_SIGNAL,void 0]),this.close({id:n,reason:t.reason})},{once:!0}),this.cleanupFns.get(n)?.push(()=>{t?.removeEventListener(`abort`,a)}),lc(e.body)){let t=e.body;ll(t,async e=>r.signal.aborted?`abort`:(await this.send([n,W.EVENT_ITERATOR,e]),`next`))}let o=await this.responseQueue.pull(n);if(Jc(o.headers)){let e=cl(this.serverEventIteratorQueue,n,async e=>{try{e!==`next`&&await this.send([n,W.ABORT_SIGNAL,void 0])}finally{this.close({id:n})}},{signal:t});return{...o,body:e}}return this.close({id:n}),o}catch(e){throw this.close({id:n,reason:e}),e}})}async message([e,t,n]){if(t===W.ABORT_SIGNAL){this.serverControllers.get(e)?.abort();return}if(t===W.EVENT_ITERATOR){this.serverEventIteratorQueue.isOpen(e)&&this.serverEventIteratorQueue.push(e,n);return}this.responseQueue.isOpen(e)&&this.responseQueue.push(e,n)}close(e={}){e.id===void 0?(this.serverControllers.forEach(t=>t.abort(e.reason)),this.serverControllers.clear(),this.cleanupFns.forEach(e=>e.forEach(e=>e())),this.cleanupFns.clear()):(this.serverControllers.get(e.id)?.abort(e.reason),this.serverControllers.delete(e.id),this.cleanupFns.get(e.id)?.forEach(e=>e()),this.cleanupFns.delete(e.id)),this.responseQueue.close(e),this.serverEventIteratorQueue.close(e)}};function fl(e,t={}){return e.forEach((e,n)=>{Array.isArray(t[n])?t[n].push(e):t[n]=t[n]===void 0?e:[t[n],e]}),t}var pl=class{plugins;constructor(e=[]){this.plugins=[...e].sort((e,t)=>(e.order??0)-(t.order??0))}init(e){for(let t of this.plugins)t.init?.(e)}},ml=class{constructor(e,t,n={}){this.codec=e,this.sender=t,new pl(n.plugins).init(n),this.interceptors=qs(n.interceptors),this.clientInterceptors=qs(n.clientInterceptors)}interceptors;clientInterceptors;call(e,t,n){return oc({name:`${Ys}.${e.join(`/`)}`,signal:n.signal},r=>(r?.setAttribute(`rpc.system`,Ys),r?.setAttribute(`rpc.method`,e.join(`.`)),lc(t)&&(t=fc({name:`consume_event_iterator_input`,signal:n.signal},t)),mc(this.interceptors,{...n,path:e,input:t},async({path:e,input:t,...n})=>{let i=nc(),a,o=i?.trace.getActiveSpan()??r;o&&i&&(a=i?.trace.setSpan(i.context.active(),o));let s=await oc({name:`encode_request`,context:a},()=>this.codec.encode(e,t,n)),c=await mc(this.clientInterceptors,{...n,input:t,path:e,request:s},({input:e,path:t,request:n,...r})=>oc({name:`send_request`,signal:r.signal,context:a},()=>this.sender.call(n,r,t,e))),l=await oc({name:`decode_response`,context:a},()=>this.codec.decode(c,n,e,t));return lc(l)?fc({name:`consume_event_iterator_output`,signal:n.signal},l):l})))}},G={BIGINT:0,DATE:1,NAN:2,UNDEFINED:3,URL:4,REGEXP:5,SET:6,MAP:7},hl=class{customSerializers;constructor(e={}){if(this.customSerializers=e.customJsonSerializers??[],this.customSerializers.length!==new Set(this.customSerializers.map(e=>e.type)).size)throw Error(`Custom serializer type must be unique.`)}serialize(e,t=[],n=[],r=[],i=[]){for(let a of this.customSerializers)if(a.condition(e)){let o=this.serialize(a.serialize(e),t,n,r,i);return n.push([a.type,...t]),o}if(e instanceof Blob)return r.push(t),i.push(e),[e,n,r,i];if(typeof e==`bigint`)return n.push([G.BIGINT,...t]),[e.toString(),n,r,i];if(e instanceof Date)return n.push([G.DATE,...t]),Number.isNaN(e.getTime())?[null,n,r,i]:[e.toISOString(),n,r,i];if(Number.isNaN(e))return n.push([G.NAN,...t]),[null,n,r,i];if(e instanceof URL)return n.push([G.URL,...t]),[e.toString(),n,r,i];if(e instanceof RegExp)return n.push([G.REGEXP,...t]),[e.toString(),n,r,i];if(e instanceof Set){let a=this.serialize(Array.from(e),t,n,r,i);return n.push([G.SET,...t]),a}if(e instanceof Map){let a=this.serialize(Array.from(e.entries()),t,n,r,i);return n.push([G.MAP,...t]),a}if(Array.isArray(e))return[e.map((e,a)=>e===void 0?(n.push([G.UNDEFINED,...t,a]),null):this.serialize(e,[...t,a],n,r,i)[0]),n,r,i];if(_c(e)){let a={};for(let o in e)(o!==`toJSON`||typeof e[o]!=`function`)&&(a[o]=this.serialize(e[o],[...t,o],n,r,i)[0]);return[a,n,r,i]}return[e,n,r,i]}deserialize(e,t,n,r){let i={data:e};n&&r&&n.forEach((e,t)=>{let n=i,a=`data`;e.forEach(e=>{if(n=n[a],a=e,!Object.hasOwn(n,a))throw Error(`Security error: accessing non-existent path during deserialization. Path segment: ${a}`)}),n[a]=r(t)});for(let e of t){let t=e[0],n=i,r=`data`;for(let t=1;t<e.length;t++)if(n=n[r],r=e[t],!Object.hasOwn(n,r))throw Error(`Security error: accessing non-existent path during deserialization. Path segment: ${r}`);for(let e of this.customSerializers)if(e.type===t){n[r]=e.deserialize(n[r]);break}switch(t){case G.BIGINT:n[r]=BigInt(n[r]);break;case G.DATE:n[r]=new Date(n[r]??`Invalid Date`);break;case G.NAN:n[r]=NaN;break;case G.UNDEFINED:n[r]=void 0;break;case G.URL:n[r]=new URL(n[r]);break;case G.REGEXP:{let[,e,t]=n[r].match(/^\/(.*)\/([a-z]*)$/);n[r]=new RegExp(e,t);break}case G.SET:n[r]=new Set(n[r]);break;case G.MAP:n[r]=new Map(n[r])}}return i.data}};function gl(e){return`/${e.map(encodeURIComponent).join(`/`)}`}function _l(e){return typeof e.forEach==`function`?fl(e):e}function vl(e){return Object.entries(Dc).find(([,t])=>t.status===e)?.[0]??`MALFORMED_ORPC_ERROR_RESPONSE`}var yl=class{constructor(e,t){this.serializer=e,this.baseUrl=t.url,this.maxUrlLength=t.maxUrlLength??2083,this.fallbackMethod=t.fallbackMethod??`POST`,this.expectedMethod=t.method??this.fallbackMethod,this.headers=t.headers??{}}baseUrl;maxUrlLength;fallbackMethod;expectedMethod;headers;async encode(e,t,n){let r=_l(await bc(this.headers,n,e,t));n.lastEventId!==void 0&&(r=Kc(r,{"last-event-id":n.lastEventId}));let i=await bc(this.expectedMethod,n,e,t),a=await bc(this.baseUrl,n,e,t),o=new URL(a);o.pathname=`${o.pathname.replace(/\/$/,``)}${gl(e)}`;let s=this.serializer.serialize(t);if(i===`GET`&&!(s instanceof FormData)&&!lc(s)){let a=await bc(this.maxUrlLength,n,e,t),c=new URL(o);if(c.searchParams.append(`data`,hc(s)),c.toString().length<=a)return{body:void 0,method:i,headers:r,url:c,signal:n.signal}}return{url:o,method:i===`GET`?this.fallbackMethod:i,headers:r,body:s,signal:n.signal}}async decode(e){let t=!Nc(e.status),n=await(async()=>{let t=!1;try{let n=await e.body();return t=!0,this.serializer.deserialize(n)}catch(e){throw Error(t?`Invalid RPC response format.`:`Cannot parse response body, please check the response body and content-type.`,{cause:e})}})();if(!t)throw Pc(n)?Fc(n):new jc(vl(e.status),{status:e.status,data:{...e,body:n}});return n}},bl=class{constructor(e){this.jsonSerializer=e}serialize(e){return lc(e)?Yc(e,{value:async e=>this.#e(e,!1),error:async e=>new Lc({data:this.#e(Mc(e).toJSON(),!1),cause:e})}):this.#e(e,!0)}#e(e,t){let[n,r,i,a]=this.jsonSerializer.serialize(e),o=r.length===0?void 0:r;if(!t||a.length===0)return{json:n,meta:o};let s=new FormData;return s.set(`data`,hc({json:n,meta:o,maps:i})),a.forEach((e,t)=>{s.set(t.toString(),e)}),s}deserialize(e){return lc(e)?Yc(e,{value:async e=>this.#t(e),error:async e=>{if(!(e instanceof Lc))return e;let t=this.#t(e.data);return Pc(t)?Fc(t,{cause:e}):new Lc({data:t,cause:e})}}):this.#t(e)}#t(e){if(e===void 0)return;if(!(e instanceof FormData))return this.jsonSerializer.deserialize(e.json,e.meta??[]);let t=JSON.parse(e.get(`data`));return this.jsonSerializer.deserialize(t.json,t.meta??[],t.maps,t=>e.get(t.toString()))}},xl=class extends ml{constructor(e,t){let n=new yl(new bl(new hl(t)),t);super(n,e,t)}},Sl=0,Cl=1,wl=class{peer;constructor(e){this.peer=new ul(async t=>{if(e.websocket.readyState===Sl&&await new Promise(t=>{let n=()=>{e.websocket.removeEventListener(`open`,n),e.websocket.removeEventListener(`close`,n),t()};e.websocket.addEventListener(`open`,n,{once:!0}),e.websocket.addEventListener(`close`,n,{once:!0})}),e.websocket.readyState!==Cl)throw Error(`Cannot send message, WebSocket is not open.`);return e.websocket.send(t)}),e.websocket.addEventListener(`message`,async e=>{let t=e.data instanceof Blob?await Js(e.data):e.data;this.peer.message(t)}),e.websocket.addEventListener(`close`,()=>{this.peer.close()})}async call(e,t,n,r){let i=await this.peer.request(e);return{...i,body:()=>Promise.resolve(i.body)}}},Tl=class extends xl{constructor(e){let t=new wl(e);super(t,{...e,url:`http://orpc`})}},El=`d347e703908d0406b7a7ef80e3a0e594d86b2215`,Dl=L({packageName:j().min(1),lockedVersion:j().min(1),resolvedVersion:j().min(1),exportName:j().min(1),seam:j().min(1)}),Ol=L({agentRegistry:P(),agentLoop:P(),toolRuntime:P(),systemPrompt:P(),sessionStore:P()}),kl=B([`MISSING_PACKAGE`,`VERSION_MISMATCH`,`COMPOSITION_ROW_MISSING`]);z(`state`,[L({state:V(`available`),auditedCommit:V(El),rows:I(Dl),capabilities:Ol}),L({state:V(`unavailable`),code:kl,packageName:j().min(1),detail:j().min(1)})]);var Al=L({provider:j().min(1),model:j().min(1),reasoningEffort:j().min(1).optional()}),jl=B([`create`,`manage`,`explore`,`free`]),Ml=[{id:`create`,label:`Create`,description:`Author new skills: frontmatter law, progressive disclosure, validation-first workflow.`},{id:`manage`,label:`Manage`,description:`Curate the local library: dedupe, merge, optimize, toggle, and update installed skills.`},{id:`explore`,label:`Explore`,description:`Search skill sources, read candidates, and analyze fit against your requirements.`},{id:`free`,label:`General`,description:`One session with everything available; focused modes are one switch away.`}],Nl=B([`text`,`image`,`video`,`pdf`]),Pl=B([`text`,`image`]),Fl=L({provider:j().min(1),label:j().min(1),api:j().min(1),baseURL:j().min(1),icon:j().nullable(),models:I(L({id:j().min(1),name:j().optional(),image:P(),contextWindow:N().int().positive().optional(),supportsReasoningEffort:P().optional(),inputTypes:I(Nl).optional(),maxOutputTokens:N().int().positive().optional(),effortTiers:I(j().min(1)).optional()})).min(1)}),Il=[`anthropic-messages`,`azure-openai-responses`,`bedrock-converse-stream`,`google-generative-ai`,`google-vertex`,`mistral-conversations`,`openai-codex-responses`,`openai-completions`,`openai-responses`];function Ll(e){let t=e.trim();if(!/^\d+(\.\d+)?\s*[kKmM]?$/.test(t))return null;let n=t.match(/^(\d+(?:\.\d+)?)\s*([kKmM])?$/);if(n===null)return null;let r=Number(n[1]);if(!Number.isFinite(r)||r<=0)return null;let i=n[2]?.toLowerCase(),a=i===`k`?r*1024:i===`m`?r*1024*1024:r,o=Math.round(a);return Number.isSafeInteger(o)&&o>0?o:null}var Rl=L({provider:j().min(1),api:j().min(1).optional(),baseURL:j().min(1),icon:j().min(1).optional(),iconLetter:j().min(1).max(2).optional(),iconColor:j().min(1).optional(),iconSuppressed:P().optional(),models:I(L({id:j().min(1),name:j().min(1).optional(),efforts:I(j().min(1)).optional(),contextWindow:N().int().positive().optional(),maxOutputTokens:N().int().positive().optional(),inputTypes:I(Nl).optional(),outputTypes:I(Pl).optional()})).min(1)}),zl=B([`deterministic`,`live`]),Bl=L({approvalPolicy:B([`ask`,`never`])}),Vl=L({streamRetention:N().int().min(10).max(500),streamProjection:B([`enabled`,`disabled`]),sessionCleanupDays:N().int().min(1).max(365).default(30)}),Hl=L({settings:L({configVersion:V(1),revision:N().int().nonnegative(),model:Al,preset:zl,permissions:Bl,session:Vl,defaultMode:jl.default(`free`),modelRoutes:I(Rl).default([])}),providers:I(L({provider:j().min(1),configured:P(),apiKey:j().nullable()}))}),Ul=L({model:Al.optional(),preset:zl.optional(),permissions:Bl.partial().optional(),session:Vl.partial().optional(),defaultMode:jl.optional(),modelRoutes:I(Rl).optional()}),Wl=B([`PRESET_REQUIRES_CREDENTIAL`,`MODEL_PROVIDER_WITHOUT_CREDENTIAL`]),Gl=z(`outcome`,[L({outcome:V(`updated`),view:Hl,changed:P(),previousRevision:N().int().nonnegative(),revision:N().int().nonnegative()}),L({outcome:V(`rejected`),code:Wl,detail:j().min(1)})]),Kl=L({provider:j().min(1),apiKey:j().min(1)}),ql=z(`outcome`,[L({outcome:V(`stored`),view:Hl}),L({outcome:V(`rejected`),code:V(`INVALID_API_KEY`),detail:j().min(1)})]),Jl=L({provider:j().min(1)}),Yl=L({api:j().min(1),baseURL:j().min(1),apiKey:j().min(1).optional(),provider:j().min(1).optional(),modelId:j().min(1)}),Xl=z(`outcome`,[L({outcome:V(`ok`),latencyMs:N().int().nonnegative()}),L({outcome:V(`failed`),detail:j().min(1)})]),Zl=B([`CREDENTIAL_MISSING`]);z(`outcome`,[L({outcome:V(`deterministic`),model:Al}),L({outcome:V(`live`),model:Al,apiKey:j().min(1)}),L({outcome:V(`failed`),code:Zl,detail:j().min(1)})]);var Ql=B([`turn-start`,`status`,`tool-call`,`tool-result`,`tool-args-delta`,`assistant-text`,`assistant-delta`,`assistant-reasoning`,`assistant-reasoning-delta`,`user-text`,`turn-end`,`approval-request`,`approval-resolved`,`mode-changed`,`session-title`,`todo-snapshot`,`auto-compact`]),$l=L({seq:N().int().nonnegative(),at:j().min(1),runId:j().min(1),sessionId:j().min(1),kind:Ql,toolName:j().min(1).optional(),toolCallId:j().min(1).optional(),text:j().optional(),payload:F().optional()}),eu=L({kind:B([`image`,`file`]),name:j().min(1).optional(),thumb:j().regex(/^data:image\/(png|jpeg|webp|gif);base64,[A-Za-z0-9+/=]+$/).max(262144).optional().catch(void 0)});L({runId:j().min(1).optional(),limit:N().int().positive().max(500).optional()});function tu(e,t){return{...e,...t}}var nu=class{"~orpc";constructor(e){if(e.route?.successStatus&&Nc(e.route.successStatus))throw Error(`[ContractProcedure] Invalid successStatus.`);if(Object.values(e.errorMap).some(e=>e&&e.status&&!Nc(e.status)))throw Error(`[ContractProcedure] Invalid error status code.`);this[`~orpc`]=e}};function ru(e){return e instanceof nu||(typeof e==`object`||typeof e==`function`)&&e!==null&&`~orpc`in e&&typeof e[`~orpc`]==`object`&&e[`~orpc`]!==null&&`errorMap`in e[`~orpc`]&&`route`in e[`~orpc`]&&`meta`in e[`~orpc`]}function iu(e,t){return{...e,...t}}function au(e,t){return{...e,...t}}function ou(e,t){return e.path?{...e,path:`${t}${e.path}`}:e}function su(e,t){return{...e,tags:[...t,...e.tags??[]]}}function cu(e,t){return e?`${e}${t}`:t}function lu(e,t){return e?[...e,...t]:t}function uu(e,t){let n=e;return t.prefix&&(n=ou(n,t.prefix)),t.tags?.length&&(n=su(n,t.tags)),n}function du(e,t){if(ru(e))return new nu({...e[`~orpc`],errorMap:tu(t.errorMap,e[`~orpc`].errorMap),route:uu(e[`~orpc`].route,t)});if(typeof e!=`object`||!e)return e;let n={};for(let r in e)n[r]=du(e[r],t);return n}var K=new class e extends nu{constructor(e){super(e),this[`~orpc`].prefix=e.prefix,this[`~orpc`].tags=e.tags}$meta(t){return new e({...this[`~orpc`],meta:t})}$route(t){return new e({...this[`~orpc`],route:t})}$input(t){return new e({...this[`~orpc`],inputSchema:t})}errors(t){return new e({...this[`~orpc`],errorMap:tu(this[`~orpc`].errorMap,t)})}meta(t){return new e({...this[`~orpc`],meta:iu(this[`~orpc`].meta,t)})}route(t){return new e({...this[`~orpc`],route:au(this[`~orpc`].route,t)})}input(t){return new e({...this[`~orpc`],inputSchema:t})}output(t){return new e({...this[`~orpc`],outputSchema:t})}prefix(t){return new e({...this[`~orpc`],prefix:cu(this[`~orpc`].prefix,t)})}tag(...t){return new e({...this[`~orpc`],tags:lu(this[`~orpc`].tags,t)})}router(e){return du(e,this[`~orpc`])}}({errorMap:{},route:{},meta:{}}),fu=j().regex(/^[a-z][a-z0-9-]*$/).brand(),pu=L({id:fu,label:j().min(1),vendor:j().min(1),binaryPath:j(),available:P()}),mu=j().regex(/^acp_[a-f0-9]{24}$/).brand(),hu=L({agentId:fu,target:H}),gu=L({sessionId:mu,pid:N().int().positive()}),_u=L({sessionId:mu});L({type:V(`exited`),sessionId:mu,code:N().int().nullable()});var vu=B([`idle`,`running`,`disposed`]),yu=L({sessionId:j().min(1),title:j(),status:vu,cwd:j(),createdAt:j().min(1),mode:jl,hasTranscript:P().optional()}),bu=L({cwd:j().min(1).optional(),prompt:j().min(1).max(2e4).optional(),mode:jl.optional()}),xu=L({session:yu}),Su=$o([R({mediaType:B([`image/png`,`image/jpeg`,`image/webp`,`image/gif`]),data:j().min(1),name:j().min(1).max(120).optional()}),R({path:j().min(1),name:j().min(1).max(120).optional()})]),Cu=$o([R({name:j().min(1).max(200),data:j().min(1).max(71e4)}),R({path:j().min(1)})]),wu=L({sessionId:j().min(1),text:j().max(2e4),images:I(Su).max(4).default([]),files:I(Cu).max(2).default([])}).refine(e=>e.text.trim().length>0||e.images.length>0||e.files.length>0,{message:`prompt needs text, an image, or a file attachment`}).refine(e=>e.images.every(e=>!(`data`in e)||e.data.length<=5592406),{message:`each image must decode to ≤4MiB`}),Tu=L({accepted:V(!0)}),Eu=L({sessionId:j().min(1),mode:jl}),Du=L({session:yu}),Ou=L({sessionId:j().min(1)}),ku=L({canceled:V(!0)}),Au=L({sessionId:j().min(1),afterSeq:N().int().nonnegative().default(0),limit:N().int().positive().max(200).default(50)}),ju=L({frames:I($l),status:vu}),Mu=L({runId:j().min(1).optional(),limit:N().int().positive().max(500).optional()}),Nu=$o([R({beforeDays:N().int().min(0).max(365)}),R({all:V(!0)}),R({sessionIds:I(j().min(1)).min(1).max(200)})]),Pu=L({kind:V(`summary`),deleted:N().int().nonnegative(),kept:N().int().nonnegative(),deletedIds:I(j().min(1)).max(1e3).optional(),deletedIdsTruncated:P().optional(),errors:I(j().min(1)).optional()}),Fu=L({id:j().min(1),question:j().min(1),detail:j().optional(),header:j().optional(),multiSelect:P().optional(),options:I(L({label:j().min(1),description:j().optional()})).optional()}),Iu=L({sessionId:j().min(1),requestSeq:N().int().nonnegative(),answers:I(L({id:j().min(1),selected:I(j().min(1)),custom:j().optional()})).min(1)}),Lu=L({answered:P()}),Ru=L({uri:j().regex(/^ui:\/\/card\/[a-z-]+\/[a-z0-9-]+$/)}),zu=L({html:j().nullable()}),Bu=L({proposalId:j().min(1),capability:j().min(1),input:F(),status:B([`pending`,`approved`,`rejected`,`executed`,`failed`]),createdAt:j().min(1),decidedAt:j().optional()}),Vu=L({proposalId:j().min(1)}),Hu=L({dir:j().min(1).optional()}),Uu=L({name:j().min(1),kind:B([`file`,`dir`]),size:N().int().nonnegative().optional()}),Wu=L({dir:j().min(1),parent:j().min(1).nullable(),entries:I(Uu).max(2e3),truncated:P().optional()}),Gu=L({path:j().min(1)}),Ku=z(`kind`,[R({kind:V(`image`),name:j().min(1),size:N().int().nonnegative(),mediaType:B([`image/png`,`image/jpeg`]),dataUrl:j().min(1),width:N().int().positive(),height:N().int().positive()}),R({kind:V(`text`),name:j().min(1),size:N().int().nonnegative(),text:j(),truncated:P()}),R({kind:V(`binary`),name:j().min(1),size:N().int().nonnegative()})]),qu=j().trim().min(1).max(100).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/,`Use lowercase letters, numbers, and hyphens.`),q=L({name:j().trim().min(1),description:j().trim().min(1)}).passthrough(),Ju=L({skillId:U,...H.shape,directoryName:qu,frontmatter:q,body:j(),revision:j().regex(/^sha256:[a-f0-9]{64}$/)}),Yu=z(`mode`,[L({mode:V(`create`),...H.shape,directoryName:qu,frontmatter:q,body:j()}),L({mode:V(`update`),...H.shape,skillId:U,expectedRevision:j().regex(/^sha256:[a-f0-9]{64}$/),frontmatter:q,body:j()})]),Xu=L({created:P(),document:Ju,validation:Gs}),Zu=L({...H.shape,skillId:U,limit:N().int().positive().max(100).optional()}),Qu=L({revisions:I(L({revision:j().regex(/^sha256:[a-f0-9]{64}$/),timestamp:N().int().nonnegative(),diff:j().nullable(),content:j().nullable()}))}),$u=B([`duplicate-name`,`duplicate-trigger`,`overlapping-responsibility`,`mutually-exclusive-rules`,`shared-resource-path`,`missing-description`,`empty-body`,`wide-trigger-surface`,`validation-error`,`validation-warning`]),ed=B([`info`,`warning`,`error`]),td=L({label:j().min(1),snippet:j().min(1)}),nd=j().regex(/^fn_[a-f0-9]{16}$/).brand(),rd=L({id:nd,kind:$u,severity:ed,message:j().min(1),skillIds:I(U).min(1),observedRevisions:os(j(),j().regex(/^sha256:[a-f0-9]{64}$/)),evidence:I(td).min(1)}),id=L({...H.shape,skillId:U,name:j(),directoryName:j(),revision:j().regex(/^sha256:[a-f0-9]{64}$/),bodyLength:N().int().nonnegative(),triggers:I(j()),referencedPaths:I(j()),disabled:P(),validation:L({success:P(),errors:I(j()),warnings:I(j())})}),ad=L({kind:B([`overlap`,`conflict`,`shared-resource`]),skillIds:is([U,U]),findingIds:I(nd).min(1)}),od=L({createdAt:j().datetime(),snapshots:I(id),findings:I(rd),edges:I(ad)}),J=L({...H.shape,skillId:U}),sd=L({...J.shape,code:B([`NOT_FOUND`,`UNAVAILABLE`,`FAILED`]),message:j().min(1)}),cd=L({selections:I(J).min(1)}),ld=L({report:od,failures:I(sd)}),ud=j().regex(/^pr_[a-f0-9]{24}$/).brand(),dd=z(`kind`,[L({kind:V(`edit`),edits:I(L({selection:J,frontmatter:q,body:j()})).min(1)}),L({kind:V(`disable`),selections:I(J).min(1),reason:j().min(1)}),L({kind:V(`split`),source:J,targets:I(L({directoryName:qu,frontmatter:q,body:j()})).min(2)}),L({kind:V(`merge`),sources:I(J).min(2),target:L({directoryName:qu,frontmatter:q,body:j()})})]),fd=L({id:ud,payload:dd,observedRevisions:I(L({...J.shape,revision:j().regex(/^sha256:[a-f0-9]{64}$/)})),findingIds:I(nd),rationale:j().min(1),createdAt:j().datetime()}),pd=L({payload:dd,findingIds:I(nd),rationale:j().trim().min(1)}),md=L({proposal:fd}),hd=L({proposals:I(fd)}),gd=L({proposalId:ud}),_d=L({rejected:V(!0)}),vd=L({proposalId:ud}),yd=L({results:I(L({...J.shape,name:j(),status:B([`applied`,`conflict`,`failed`,`skipped`]),error:j().optional()})),applied:N().int().nonnegative(),conflicts:N().int().nonnegative(),failed:N().int().nonnegative(),skipped:N().int().nonnegative()}),bd=B([`fixture`,`dsh`,`codex`]),Y=j().regex(/^sr_[a-f0-9]{24}$/).brand(),xd=j().regex(/^prm_[a-f0-9]{16}$/).brand(),Sd=B([`analyzing`,`recommending`,`drafting`,`validating`,`awaiting-approval`,`applying`]),Cd=B([`running`,`completed`,`cancelled`,`failed`,`disconnected`,`unavailable`,`stopped`]),wd=B([`run-started`,`phase`,`agent-message`,`agent-item`,`recommendation`,`permission-request`,`permission-decision`,`draft-created`,`draft-failed`,`approval`,`apply`,`run-terminal`]),Td=B([`reasoning`,`agent-message`,`command`,`file-change`,`tool-call`,`web-search`,`error`,`other`]),Ed=L({seq:N().int().positive(),at:j().datetime(),runId:Y,kind:wd,phase:Sd.optional(),message:j().optional(),itemKind:Td.optional(),recommendationId:j().optional(),proposalId:ud.optional(),permissionRequestId:xd.optional(),terminalStatus:Cd.optional()}),Dd=L({backendId:bd,version:j().min(1),streamingEvents:P(),cancellation:P(),permissionRequests:P(),executionRoot:B([`isolated`,`patch-context`])}),Od=z(`state`,[L({state:V(`available`),capabilities:Dd}),L({state:V(`unavailable`),capabilities:L({backendId:bd}).passthrough(),reason:j().min(1)})]),kd=L({id:j().regex(/^rcmd_[a-f0-9]{16}$/).brand(),kind:B([`edit`,`disable`,`split`,`merge`]),skillIds:I(U).min(1),rationale:j().min(1),findingIds:I(nd),payload:dd}),Ad=L({id:xd,runId:Y,at:j().datetime(),summary:j().min(1),detail:j().optional()}),jd=L({requestId:xd,at:j().datetime(),decision:B([`granted`,`denied`]),note:j().optional()}),Md=L({runId:Y,backendId:bd,target:H,skillIds:I(U),observedRevisions:I(L({skillId:U,revision:j().regex(/^sha256:[a-f0-9]{64}$/)})),capabilities:Dd,executionRoot:j().min(1),objective:j().min(1),startedAt:j().datetime(),endedAt:j().datetime().nullable(),status:Cd,phase:Sd.nullable(),error:j().nullable(),recommendations:I(kd),proposalIds:I(ud),permissionRequests:I(Ad),permissionDecisions:I(jd)}),Nd=L({backends:I(Od)}),Pd=L({runs:I(Md)}),Fd=L({backendId:bd,target:H,skillIds:I(U).optional(),objective:j().min(1).max(400).optional()}),Id=L({run:Md}),Ld=L({runId:Y,afterSeq:N().int().nonnegative().optional()}),Rd=L({runId:Y,events:I(Ed),status:Cd,phase:Sd.nullable()}),zd=L({runId:Y}),Bd=L({run:Md}),Vd=L({runId:Y,requestId:xd,decision:B([`granted`,`denied`]),note:j().max(400).optional()}),Hd=L({run:Md}),Ud=L({runId:Y,proposalId:ud}),Wd=L({run:Md,result:yd}),Gd=L({run:Md}),Kd=j().regex(/^\d+\.\d+\.\d+$/),X=j().regex(/^snap_[a-f0-9]{16}$/).brand(),qd=j().regex(/^sr_[a-f0-9]{24}$/).brand(),Jd=j().regex(/^task_[a-f0-9]{16}$/).brand(),Yd=j().regex(/^call_[a-f0-9]{16}$/).brand(),Xd=j().regex(/^spp_[a-f0-9]{16}$/).brand(),Zd=j().regex(/^grant_[a-f0-9]{16}$/).brand(),Qd=j().regex(/^aud_[a-f0-9]{16}$/).brand(),Z=j().regex(/^sha256:[a-f0-9]{64}$/),$d=L({skillId:U,revision:Z}),ef=L({backendId:j().min(1).max(64),version:j().min(1).max(200),streamingEvents:P(),cancellation:P(),permissionRequests:P(),executionRoot:B([`isolated`,`patch-context`])});function tf(e){return e.length===0||e.length>500||e.includes(`\\`)||e.includes(`\0`)||/^[a-zA-Z]:/.test(e)||e.startsWith(`//`)?!1:e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`)}var nf=j().refine(tf,{message:`Relative path inside the skill directory (segment-safe, no traversal/backslash/roots).`}),rf=e=>new TextEncoder().encode(e).length,af=262144,of=2097152,sf=j().min(1).max(200).regex(/^(?!\.\.$)[^/\\\0]+$/,`Snapshot directory name must be one plain path segment.`),cf=L({skillId:U,name:j().min(1).max(200),directoryName:sf,revision:Z,disabled:P(),content:j().max(af),byteSize:N().int().nonnegative()}),lf=L({skillId:U,relPath:nf,hash:j().regex(/^[a-f0-9]{64}$/),byteSize:N().int().nonnegative(),kind:B([`file`,`other`])});L({id:X,createdAt:j().datetime(),target:H,scopeKind:B([`global`,`imported`]),skills:I(cf).min(1).max(100),resources:I(lf).max(4e3),promptVersion:Kd,toolVersion:Kd,capabilities:ef}).superRefine((e,t)=>{let n=new Set,r=new Set;for(let i of e.skills){let e=i.directoryName.toLowerCase();n.has(e)&&t.addIssue({code:`custom`,message:`Snapshot skills contain duplicate directoryName: ${i.directoryName}.`}),n.add(e);let a=i.name.toLowerCase();r.has(a)&&t.addIssue({code:`custom`,message:`Snapshot skills contain duplicate frontmatter name: ${i.name}.`}),r.add(a)}let i=new Set;for(let n of e.resources){let e=`${n.skillId}\u0000${n.relPath}`;i.has(e)&&t.addIssue({code:`custom`,message:`Snapshot resource manifest contains duplicate (skillId, relPath): ${n.skillId} ${n.relPath}.`}),i.add(e)}let a=0;for(let n of e.skills){let e=rf(n.content);e!==n.byteSize&&t.addIssue({code:`custom`,message:`Skill ${n.directoryName} byteSize ${n.byteSize} != computed ${e}.`}),e>262144&&t.addIssue({code:`custom`,message:`Skill ${n.directoryName} exceeds the per-skill byte budget (${e}).`}),a+=e}a>2097152&&t.addIssue({code:`custom`,message:`Snapshot content budget exceeded: ${a} > ${of} bytes.`});let o=new Set(e.skills.map(e=>e.skillId));o.size!==e.skills.length&&t.addIssue({code:`custom`,message:`Snapshot contains duplicate skill ids.`}),e.target.workspaceId===`~`!=(e.scopeKind===`global`)&&t.addIssue({code:`custom`,message:`scopeKind must match the workspace identity (global iff workspaceId is '~').`});for(let n of e.resources)o.has(n.skillId)||t.addIssue({code:`custom`,message:`Snapshot resource references unknown skill: ${n.skillId}.`})});var uf=B([`check`,`optimize`,`organize`]);L({id:Jd,kind:uf,snapshotId:X,skillIds:I(U).min(1),instructions:j().max(2e3).optional(),promptVersion:Kd,toolVersion:Kd,createdAt:j().datetime()}).superRefine((e,t)=>{new Set(e.skillIds).size!==e.skillIds.length&&t.addIssue({code:`custom`,message:`Task skillIds contain duplicates.`})});var df=[`skills.list_context`,`skills.inspect`,`skills.relations`,`skills.propose`,`skills.validate_proposal`,`skills.apply_proposal`,`skills.rollback`];B(df);var ff=B([`agent`,`human-ui`,`manager-recovery`]),pf=z(`kind`,[L({kind:V(`ok`),value:F()}),L({kind:V(`denied`),reason:B([`unsupported-capability`,`principal-forbidden`]),requestedOperation:j().min(1).max(200)}),L({kind:V(`failed`),code:B([`NOT_FOUND`,`CONFLICT`,`INVALID_OPERATION`,`UNAVAILABLE`,`STALE`]),message:j().min(1).max(2e3)})]);L({id:Yd,at:j().datetime(),runId:qd,tool:j().min(1).max(200),principal:ff,input:F(),result:pf,observedRevisions:I($d).default([])}).superRefine((e,t)=>{!df.includes(e.tool)&&e.result.kind!==`denied`&&t.addIssue({code:`custom`,message:`Non-domain tool "${e.tool}" must record a denied result.`}),(e.tool===`skills.apply_proposal`||e.tool===`skills.rollback`)&&e.principal===`agent`&&t.addIssue({code:`custom`,message:`Agent principal cannot invoke ${e.tool}.`})});var mf=L({skillId:U,path:nf.optional(),lineStart:N().int().positive().optional(),lineEnd:N().int().positive().optional(),snippet:j().max(2e3).optional(),note:j().max(500).optional()}).superRefine((e,t)=>{let n=e.path!==void 0,r=e.snippet!==void 0&&e.snippet.length>0,i=e.lineStart!==void 0&&e.lineEnd!==void 0;!n&&!r&&!i&&t.addIssue({code:`custom`,message:`Evidence needs a path, snippet, or line range.`}),e.lineStart!==void 0&&e.lineEnd!==void 0&&e.lineEnd<e.lineStart&&t.addIssue({code:`custom`,message:`Evidence line range is inverted.`})}),hf=L({contractVersion:Kd,origin:B([`deterministic`,`agent-semantic`]),severity:ed,category:j().min(1).max(100),message:j().min(1).max(2e3),skillIds:I(U).min(1),observedRevisions:I($d).min(1),evidence:I(mf).min(1).max(20),findingId:nd.optional()}).superRefine((e,t)=>{e.origin===`deterministic`&&e.findingId===void 0&&t.addIssue({code:`custom`,message:`Deterministic findings must carry their Manager-assigned id.`});let n=new Set(e.observedRevisions.map(e=>e.skillId));for(let r of e.skillIds)n.has(r)||t.addIssue({code:`custom`,message:`Finding references skill ${r} without an observed revision.`});(n.size!==e.observedRevisions.length||n.size!==new Set(e.skillIds).size)&&t.addIssue({code:`custom`,message:`Finding observedRevisions must equal skillIds exactly.`});let r=new Set(e.skillIds);for(let n of e.evidence)r.has(n.skillId)||t.addIssue({code:`custom`,message:`Finding evidence references skill ${n.skillId} outside the finding skillIds scope.`})}),gf=L({sourceSkillId:U,sourcePath:nf,targetPath:nf,strategy:B([`copy`,`move`,`reference`])}),_f=L({directoryName:qu,frontmatter:q,body:j().max(af),resources:I(gf).max(200).default([])}).superRefine((e,t)=>{e.frontmatter.name!==e.directoryName&&t.addIssue({code:`custom`,message:`Target frontmatter name "${e.frontmatter.name}" must equal directoryName "${e.directoryName}".`}),new Set(e.resources.map(e=>e.targetPath.toLowerCase())).size!==e.resources.length&&t.addIssue({code:`custom`,message:`Target resource mappings contain duplicate targetPath.`});for(let n of e.resources){let e=n.targetPath.split(`/`);(e[e.length-1]??``).toLowerCase()===`skill.md`&&t.addIssue({code:`custom`,message:`Resource targetPath must not target the skill document (SKILL.md): ${n.targetPath}`})}}),vf=B([`edit`,`disable`,`enable`,`split`,`merge`]),yf=L({skillId:U,expectedRevision:Z}),bf=L({contractVersion:Kd,action:vf,patch:z(`kind`,[L({kind:V(`edit`),snapshotId:X,edits:I(L({skillId:U,expectedRevision:Z,frontmatter:q,body:j().max(af)})).min(1).max(100)}).superRefine((e,t)=>{new Set(e.edits.map(e=>e.skillId)).size!==e.edits.length&&t.addIssue({code:`custom`,message:`Edit patch contains duplicate skill ids.`})}),L({kind:V(`disable`),snapshotId:X,selections:I(yf).min(1).max(100),reason:j().min(1).max(2e3)}).superRefine((e,t)=>{new Set(e.selections.map(e=>e.skillId)).size!==e.selections.length&&t.addIssue({code:`custom`,message:`Disable patch contains duplicate skill ids.`})}),L({kind:V(`enable`),snapshotId:X,selections:I(yf).min(1).max(100),reason:j().min(1).max(2e3)}).superRefine((e,t)=>{new Set(e.selections.map(e=>e.skillId)).size!==e.selections.length&&t.addIssue({code:`custom`,message:`Enable patch contains duplicate skill ids.`})}),L({kind:V(`split`),snapshotId:X,source:yf,targets:I(_f).min(2).max(20)}).superRefine((e,t)=>{new Set(e.targets.map(e=>e.directoryName)).size!==e.targets.length&&t.addIssue({code:`custom`,message:`Split targets must have unique directory names.`})}),L({kind:V(`merge`),snapshotId:X,sources:I(yf).min(2).max(100),target:_f}).superRefine((e,t)=>{new Set(e.sources.map(e=>e.skillId)).size!==e.sources.length&&t.addIssue({code:`custom`,message:`Merge patch contains duplicate source skill ids.`})})]),rationale:j().min(1).max(4e3),findingIds:I(nd).max(20).default([]),evidence:I(mf).min(1).max(20),skillIds:I(U).min(1),observedRevisions:I($d).min(1)}).superRefine((e,t)=>{e.action!==e.patch.kind&&t.addIssue({code:`custom`,message:`Proposal action "${e.action}" does not match patch kind "${e.patch.kind}".`});let n=xf(e.patch),r=new Set(e.skillIds);for(let e of n)r.has(e)||t.addIssue({code:`custom`,message:`Patch affects skill ${e} missing from proposal skillIds.`});for(let r of e.skillIds)n.includes(r)||t.addIssue({code:`custom`,message:`Proposal declares skill ${r} which the patch does not affect.`});let i=new Map(e.observedRevisions.map(e=>[e.skillId,e.revision]));i.size!==e.observedRevisions.length&&t.addIssue({code:`custom`,message:`Proposal observedRevisions contain duplicate skill ids.`});for(let e of i.keys())r.has(e)||t.addIssue({code:`custom`,message:`Proposal observes skill ${e} outside the proposal skillIds scope.`});for(let n of e.skillIds)i.has(n)||t.addIssue({code:`custom`,message:`Proposal references skill ${n} without an observed revision.`});new Set(e.skillIds).size!==e.skillIds.length&&t.addIssue({code:`custom`,message:`Proposal skillIds contain duplicates.`});for(let[n,r]of Df(e.patch)){let e=i.get(n);e!==void 0&&e!==r&&t.addIssue({code:`custom`,message:`Observed revision for ${n} (${e}) differs from the patch expectation (${r}).`})}let a=new Set(e.skillIds);for(let n of e.evidence)a.has(n.skillId)||t.addIssue({code:`custom`,message:`Evidence references skill ${n.skillId} outside the proposal skillIds scope.`});if(e.patch.kind===`split`||e.patch.kind===`merge`){let n=e.patch.kind===`split`?e.patch.targets:[e.patch.target],r=e.patch.kind===`split`?new Set([e.patch.source.skillId]):new Set(e.patch.sources.map(e=>e.skillId));for(let i of n)for(let n of i.resources)r.has(n.sourceSkillId)||t.addIssue({code:`custom`,message:`Resource mapping source ${n.sourceSkillId} is not a patch source skill (kind ${e.patch.kind}).`})}});function xf(e){switch(e.kind){case`edit`:return e.edits.map(e=>e.skillId);case`disable`:return e.selections.map(e=>e.skillId);case`enable`:return e.selections.map(e=>e.skillId);case`split`:return[e.source.skillId];case`merge`:return e.sources.map(e=>e.skillId)}}var Sf=B([`completed`,`needs-review`,`scope-limit`,`failed`]),Cf=B([`started`,`collecting`,`analyzing`,`proposing`,`validating`,`done`]);z(`kind`,[L({kind:V(`stage`),stage:Cf,note:j().max(1e3).optional()}),L({kind:V(`finding`),finding:hf}),L({kind:V(`proposal`),proposal:bf}),L({kind:V(`question`),question:j().min(1).max(2e3),options:I(j().min(1).max(500)).max(10).optional()}),L({kind:V(`terminal`),reason:Sf,message:j().max(2e3).optional()})]);var wf=L({name:j().min(1).max(100),status:B([`passed`,`failed`,`skipped`]),detail:j().max(2e3).optional()}),Tf=L({proposalId:Xd,overall:B([`valid`,`invalid`,`stale`]),checks:I(wf).min(1).max(50)});L({id:Zd,proposalId:Xd,snapshotId:X,runId:qd,fingerprint:Z,principal:B([`human-ui`,`manager-recovery`]),issuedAt:j().datetime(),consumedAt:j().datetime().nullable(),inputRevisions:I($d).min(1),absentPreconditions:I(qu).max(20).default([])});var Ef=L({skillId:U.optional(),relPath:nf,beforeRevision:Z.nullable(),afterRevision:Z.nullable(),semantic:B([`content`,`enablement`,`resource`]).default(`content`)});L({id:Qd,runId:qd,proposalId:Xd,snapshotId:X,action:vf,principal:B([`human-ui`,`manager-recovery`]),appliedAt:j().datetime(),status:B([`applied`,`rolled-back`,`recovery-required`]),mutations:I(Ef).min(1).max(500),inverseManifestRef:j().min(1).optional()});function Df(e){let t=new Map,n=(e,n)=>{t.set(e,n)};switch(e.kind){case`edit`:for(let t of e.edits)n(t.skillId,t.expectedRevision);break;case`disable`:case`enable`:for(let t of e.selections)n(t.skillId,t.expectedRevision);break;case`split`:n(e.source.skillId,e.source.expectedRevision);break;case`merge`:for(let t of e.sources)n(t.skillId,t.expectedRevision)}return t}var Of=L({target:H,skillIds:I(U).optional(),taskKind:uf,scenario:B([`valid-check`,`valid-optimize`,`valid-organize`,`organize-disable`,`organize-merge`,`malformed`,`stale`,`disconnect`,`cancel`,`late-event`,`approval-replay`]).optional()}),kf=L({snapshotId:X,dshSessionId:j().min(1).optional(),terminal:j().min(1),acceptedResponses:N().int().nonnegative(),droppedLateResponses:N().int().nonnegative(),toolCalls:N().int().nonnegative(),proposals:I(L({proposalId:Xd,action:vf}))}),Af=L({proposalId:Xd}),jf=L({grantId:Zd,fingerprint:Z,issuedAt:j().datetime()}),Mf=L({outcomeStatus:B([`applied`,`compensated`,`recovery-required`]),failure:j().optional(),auditId:Qd,auditStatus:B([`applied`,`rolled-back`,`recovery-required`]),mutations:I(Ef)}),Nf=L({auditId:Qd}),Pf=L({reverseProposalId:Xd.optional(),note:j().min(1)}),Ff=B([`starting`,`mounted`,`headless`,`web`]),If=L({active:P(),pid:N().int().positive(),version:j(),port:N().int().nonnegative(),startedAt:N().int().nonnegative(),tray:Ff,trayError:j().optional(),webUrl:j().optional(),dsh:L({mounted:P(),reason:j().optional(),port:N().int().nonnegative().optional(),entries:I(j()).optional(),activationOrder:I(j()).optional()}).optional()});B([`NOT_FOUND`,`CONFLICT`,`INVALID_OPERATION`,`UNAVAILABLE`]);var Lf={NOT_FOUND:{status:404,message:`The requested resource was not found.`},CONFLICT:{status:409,message:`The operation conflicts with current state.`},INVALID_OPERATION:{status:422,message:`The requested operation is not valid.`},UNAVAILABLE:{status:503,message:`The requested resource is unavailable.`}},Rf=j().regex(/^repo_[a-f0-9]{24}$/).brand(),zf=j().regex(/^rsk_[a-f0-9]{24}$/).brand(),Bf=j().regex(/^[a-f0-9]{40,64}$/),Vf=L({id:zf,name:j(),description:j(),relativePath:j(),installable:P(),issues:I(j())}),Hf=L({sessionId:Rf,source:j(),title:j(),commit:Bf,skills:I(Vf)}),Uf=L({sessionId:Rf,skill:Vf,content:j()}),Wf=L({target:H,skill:j(),destination:j(),path:j()}),Gf=z(`status`,[Wf.extend({status:V(`installed`),skillId:U}),Wf.extend({status:V(`overwritten`),skillId:U}),Wf.extend({status:V(`skipped`),error:j().optional()}),Wf.extend({status:V(`failed`),error:j().optional()})]),Kf=z(`kind`,[L({kind:V(`result`),targets:I(H).min(1),results:I(Gf),installed:N().int().nonnegative(),skipped:N().int().nonnegative(),overwritten:N().int().nonnegative(),failed:N().int().nonnegative()}),L({kind:V(`preview`),skills:I(L({name:j(),description:j()})),destinations:I(L({target:H,path:j(),exists:P()})),totalInstalls:N().int().nonnegative()})]),qf=L({sessionId:Rf,skillIds:I(zf).min(1),targets:I(H).min(1).superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.entries()){let e=`${i.workspaceId}:${i.providerId}`;n.has(e)&&t.addIssue({code:`custom`,message:`Install targets must be unique.`,path:[r]}),n.add(e)}}),force:P().optional(),dryRun:P().optional()}),Jf=j().regex(/^user_[a-z0-9]{1,64}$/).brand(),Yf=j().trim().min(1).max(2048).refine(e=>e.startsWith(`https://`),`Git URL must use the https scheme.`).refine(e=>{try{let t=new URL(e);return t.protocol===`https:`&&t.hostname.length>0}catch{return!1}},`Git URL must be a valid https URL.`),Xf=L({id:Jf,label:j().trim().min(1).max(120),gitUrl:Yf,description:j().trim().max(400).default(``),addedAt:j().datetime()});L({version:V(1),sources:I(Xf).default([])});var Zf=L({label:j().trim().min(1).max(120),gitUrl:Yf,description:j().trim().max(400).optional()}),Qf=L({id:Jf}),$f=L({...H.shape,skillIds:I(U).optional()}),ep=B([`updated`,`already-current`,`failed`,`unavailable`]),tp=L({results:I(L({skillId:U,name:j(),currentHash:j(),upstreamHash:j(),source:j(),status:ep,error:j().optional()}))}),np=L({...H.shape,skillIds:I(U).min(1)}),rp=B([`updated`,`already-current`,`failed`]),ip=L({results:I(L({skillId:U,name:j(),status:rp,error:j().optional()}))}),ap=L({...H.shape,includeDisabled:P().optional()}),op=ap,sp=ap.extend({skillId:U}),cp=L({...H.shape,skillIds:I(U).min(1),mode:B([`enable`,`disable`])}),lp=L({path:j().trim().min(1),label:j().trim().min(1).optional()}),up=L({id:Ns}),dp=L({id:Ps}),fp=L({...H.shape,skillId:U,expectedRevision:j().regex(/^sha256:[a-f0-9]{64}$/)}),pp=L({source:j().trim().min(1),ref:j().trim().min(1).optional()}),mp=L({sessionId:Rf,skillId:zf});K.errors(Lf).router({skills:{list:K.input(op).output(L({skills:I(Vs)})),info:K.input(sp).output(Hs),toggle:K.input(cp).output(Ws),validate:K.input(sp).output(Gs),update:{check:K.input($f).output(tp),apply:K.input(np).output(ip)}},workspace:{list:K.input(L({})).output(L({workspaces:I(Ls)})),add:K.input(lp).output(L({workspace:Ls})),remove:K.input(up).output(L({activeId:Ps})),setActive:K.input(dp).output(L({activeId:Ps}))},creator:{save:K.input(Yu).output(Xu),load:K.input(sp).output(Ju),remove:K.input(fp).output(L({removed:V(!0)})),revisions:K.input(Zu).output(Qu)},repository:{scan:K.input(pp).output(Hf),preview:K.input(mp).output(Uf),install:K.input(qf).output(Kf),sources:{list:K.input(L({})).output(L({builtIn:I(L({id:j(),label:j(),gitUrl:j(),description:j(),homepage:j().optional()})),user:I(Xf)})),add:K.input(Zf).output(L({source:Xf})),remove:K.input(Qf).output(L({removed:V(!0)}))}},daemon:{status:K.input(L({})).output(If)},skillIntelligence:{analyze:K.input(cd).output(ld),propose:K.input(pd).output(md),list:K.input(L({})).output(hd),reject:K.input(gd).output(_d),approve:K.input(vd).output(yd)},steward:{backends:K.input(L({})).output(Nd),list:K.input(L({})).output(Pd),start:K.input(Fd).output(Id),events:K.input(Ld).output(Rd),cancel:K.input(zd).output(Bd),decidePermission:K.input(Vd).output(Hd),approveProposal:K.input(Ud).output(Wd),rejectProposal:K.input(Ud).output(Gd)},skillSteward:{startRun:K.input(Of).output(kf),validate:K.input(Af).output(Tf),approve:K.input(Af).output(jf),apply:K.input(Af).output(Mf),prepareRollback:K.input(Nf).output(Pf),applyRollback:K.input(Nf).output(Mf)},agent:{card:{get:K.input(Ru).output(zu)},proposals:{list:K.input(L({})).output(L({proposals:I(Bu)})),approve:K.input(Vu).output(L({proposal:Bu})),reject:K.input(Vu).output(L({proposal:Bu}))},sessions:{list:K.input(L({})).output(L({sessions:I(yu)})),streams:K.input(Mu).output(L({frames:I($l)})),cleanup:K.input(Nu).output(Pu)},session:{create:K.input(bu).output(xu),prompt:K.input(wu).output(Tu),cancel:K.input(Ou).output(ku),answer:K.input(Iu).output(Lu),stream:K.input(Au).output(ju),setMode:K.input(Eu).output(Du)},files:{list:K.input(Hu).output(Wu),preview:K.input(Gu).output(Ku),pickFiles:K.input(L({mode:B([`image`,`file`])})).output(L({paths:I(j().min(1))}))},models:{catalog:K.input(L({})).output(L({providers:I(Fl)}))},settings:{get:K.input(L({})).output(Hl),update:K.input(Ul).output(Gl),testConnection:K.input(Yl).output(Xl)},credentials:{set:K.input(Kl).output(ql),clear:K.input(Jl).output(Hl)}},acp:{agents:{list:K.input(L({})).output(L({agents:I(pu)}))},session:{open:K.input(hu).output(gu),close:K.input(_u).output(L({closed:V(!0)}))}}});var hp=`skill-creator-token`;function gp(){if(typeof window>`u`)return;let e=window.location.hash.replace(/^#/,``),n=new URLSearchParams(e).get(`token`);if(n){sessionStorage.setItem(hp,n);let e=window.location.pathname+window.location.search;setTimeout(()=>t(e,{}),0)}}function _p(){return gp(),typeof window>`u`?``:sessionStorage.getItem(hp)??``}function vp(e){if(typeof window>`u`)return``;let t=window.location.protocol===`https:`?`wss:`:`ws:`,n=window.location.port||(window.location.protocol===`https:`?`443`:`80`);return`${t}//${window.location.hostname}:${n}/ws/rpc?token=${encodeURIComponent(e)}`}function yp(){let e=_p();return new WebSocket(vp(e))}function bp(e){return Zc(new Tl({websocket:e}))}var Q=e({status:`idle`,error:null}),$=null,xp=null,Sp=0,Cp=null,wp=!1;function Tp(){return Sp}function Ep(){if($)return;wp=!1,Q.status=`connecting`,Q.error=null;let e=yp();$=e,e.onopen=()=>{$===e&&(Ap(bp(e)),Q.status=`connected`,Q.error=null)},e.onclose=t=>{$===e&&($=null,Ap(null),Q.status=`disconnected`,Q.error=t.code===1006?`Cannot authenticate with the local daemon. Open Skill Creator from its tray icon.`:`The local daemon connection closed.`,wp||(Cp=setTimeout(Ep,1500)))}}function Dp(){wp=!0,Cp&&clearTimeout(Cp),Cp=null,$?.close(),$=null,Ap(null),Q.status=`idle`}function Op(){return xp}function kp(){if(!xp)throw Error(`The Skill Creator daemon is not connected.`);return xp}function Ap(e){xp!==e&&(xp=e,Sp+=1)}function jp(e=Mp){let t=0;return{issue(){t+=1;let n=t,r=e(),i=()=>n===t;return{isLatest:i,isCurrent:()=>i()&&r===e()}},invalidate(){t+=1}}}function Mp(){return 0}export{F as A,I as C,os as D,L as E,j as O,B as S,V as T,jc as _,Tp as a,Ms as b,gp as c,Fu as d,Ml as f,Ll as g,eu as h,Dp as i,$o as k,qu as l,jl as m,Ep as n,Op as o,Il as p,Q as r,kp as s,jp as t,q as u,U as v,P as w,Ps as x,Ns as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ot as e}from"./CmCJ0SKP.js";e();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={};throw Error(`Could not resolve "katex" imported by "markstream-svelte". Is it installed?`);export{e as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{$ as e,At as t,B as n,C as r,Ct as i,D as a,F as o,H as s,I as c,L as l,M as u,N as d,O as f,P as p,Q as m,R as h,St as g,U as _,X as v,Y as y,a as b,bt as ee,dt as te,et as x,f as S,ft as C,gt as w,it as ne,jt as T,kt as re,l as ie,lt as E,mt as D,nt as ae,o as O,ot as k,pt as oe,q as A,rt as j,s as M,st as N,tt as se,ut as ce,wt as le,xt as ue,yt as de,z as P}from"./CmCJ0SKP.js";import"./xihTtKlq.js";import{t as fe}from"./BkEnd9_Z.js";import{a as pe,i as me,s as F}from"./CNPsST_i.js";import{t as he}from"./BEPs9Z9s.js";import{t as ge}from"./Bs27XW8_.js";function _e(e){return typeof e==`function`}function ve(e){return typeof e==`object`&&!!e}var ye=[`string`,`number`,`bigint`,`boolean`];function be(e){return e==null||ye.includes(typeof e)?!0:Array.isArray(e)?e.every(e=>be(e)):typeof e==`object`&&Object.getPrototypeOf(e)===Object.prototype}var I=Symbol(`box`),xe=Symbol(`is-writable`);function L(e,t){let n=w(e);return t?{[I]:!0,[xe]:!0,get current(){return v(n)},set current(e){t(e)}}:{[I]:!0,get current(){return e()}}}function Se(e){return ve(e)&&I in e}function Ce(e){return Se(e)&&xe in e}function we(e){return Se(e)?e:_e(e)?L(e):De(e)}function Te(e){return Object.entries(e).reduce((e,[t,n])=>Se(n)?(Ce(n)?Object.defineProperty(e,t,{get(){return n.current},set(e){n.current=e}}):Object.defineProperty(e,t,{get(){return n.current}}),e):Object.assign(e,{[t]:n}),{})}function Ee(e){return Ce(e)?{[I]:!0,get current(){return e.current}}:e}function De(e){let t=D(ce(e));return{[I]:!0,[xe]:!0,get current(){return v(t)},set current(e){C(t,e,!0)}}}function R(e){let t=D(ce(e));return{[I]:!0,[xe]:!0,get current(){return v(t)},set current(e){C(t,e,!0)}}}R.from=we,R.with=L,R.flatten=Te,R.readonly=Ee,R.isBox=Se,R.isWritableBox=Ce;function Oe(...e){return function(t){for(let n of e)if(n){if(t.defaultPrevented)return;typeof n==`function`?n.call(this,t):n.current?.call(this,t)}}}var ke=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Ae=/\n/g,je=/^\s*/,Me=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Ne=/^:\s*/,Pe=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Fe=/^[;\s]*/,Ie=/^\s+|\s+$/g,Le=`
|
|
2
|
+
`,Re=`/`,ze=`*`,z=``,Be=`comment`,Ve=`declaration`;function He(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var n=1,r=1;function i(e){var t=e.match(Ae);t&&(n+=t.length);var i=e.lastIndexOf(Le);r=~i?e.length-i:r+e.length}function a(){var e={line:n,column:r};return function(t){return t.position=new o(e),l(),t}}function o(e){this.start=e,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function s(i){var a=Error(t.source+`:`+n+`:`+r+`: `+i);if(a.reason=i,a.filename=t.source,a.line=n,a.column=r,a.source=e,!t.silent)throw a}function c(t){var n=t.exec(e);if(n){var r=n[0];return i(r),e=e.slice(r.length),n}}function l(){c(je)}function u(e){var t;for(e||=[];t=d();)t!==!1&&e.push(t);return e}function d(){var t=a();if(Re==e.charAt(0)&&ze==e.charAt(1)){for(var n=2;z!=e.charAt(n)&&(ze!=e.charAt(n)||Re!=e.charAt(n+1));)++n;if(n+=2,z===e.charAt(n-1))return s(`End of comment missing`);var o=e.slice(2,n-2);return r+=2,i(o),e=e.slice(n),r+=2,t({type:Be,comment:o})}}function f(){var e=a(),t=c(Me);if(t){if(d(),!c(Ne))return s(`property missing ':'`);var n=c(Pe),r=e({type:Ve,property:Ue(t[0].replace(ke,z)),value:n?Ue(n[0].replace(ke,z)):z});return c(Fe),r}}function p(){var e=[];u(e);for(var t;t=f();)t!==!1&&(e.push(t),u(e));return e}return l(),p()}function Ue(e){return e?e.replace(Ie,z):z}function We(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=He(e),i=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:a}=e;i?t(r,a,e):a&&(n||={},n[r]=a)}),n}var Ge=/\d/,Ke=[`-`,`_`,`/`,`.`];function qe(e=``){if(!Ge.test(e))return e!==e.toLowerCase()}function Je(e){let t=[],n=``,r,i;for(let a of e){let e=Ke.includes(a);if(e===!0){t.push(n),n=``,r=void 0;continue}let o=qe(a);if(i===!1){if(r===!1&&o===!0){t.push(n),n=a,r=o;continue}if(r===!0&&o===!1&&n.length>1){let e=n.at(-1);t.push(n.slice(0,Math.max(0,n.length-1))),n=e+a,r=o;continue}}n+=a,r=o,i=e}return t.push(n),t}function Ye(e){return e?Je(e).map(e=>Ze(e)).join(``):``}function Xe(e){return Qe(Ye(e||``))}function Ze(e){return e?e[0].toUpperCase()+e.slice(1):``}function Qe(e){return e?e[0].toLowerCase()+e.slice(1):``}function $e(e){if(!e)return{};let t={};function n(e,n){if(e.startsWith(`-moz-`)||e.startsWith(`-webkit-`)||e.startsWith(`-ms-`)||e.startsWith(`-o-`)){t[Ye(e)]=n;return}if(e.startsWith(`--`)){t[e]=n;return}t[Xe(e)]=n}return We(e,n),t}function B(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}function et(e,t){let n=RegExp(e,`g`);return e=>{if(typeof e!=`string`)throw TypeError(`expected an argument of type string, but got ${typeof e}`);return e.match(n)?e.replace(n,t):e}}var tt=et(/[A-Z]/,e=>`-${e.toLowerCase()}`);function nt(e){if(!e||typeof e!=`object`||Array.isArray(e))throw TypeError(`expected an argument of type object, but got ${typeof e}`);return Object.keys(e).map(t=>`${tt(t)}: ${e[t]};`).join(`
|
|
3
|
+
`)}function rt(e={}){return nt(e).replace(`
|
|
4
|
+
`,` `)}var it=new Set(`onabort.onanimationcancel.onanimationend.onanimationiteration.onanimationstart.onauxclick.onbeforeinput.onbeforetoggle.onblur.oncancel.oncanplay.oncanplaythrough.onchange.onclick.onclose.oncompositionend.oncompositionstart.oncompositionupdate.oncontextlost.oncontextmenu.oncontextrestored.oncopy.oncuechange.oncut.ondblclick.ondrag.ondragend.ondragenter.ondragleave.ondragover.ondragstart.ondrop.ondurationchange.onemptied.onended.onerror.onfocus.onfocusin.onfocusout.onformdata.ongotpointercapture.oninput.oninvalid.onkeydown.onkeypress.onkeyup.onload.onloadeddata.onloadedmetadata.onloadstart.onlostpointercapture.onmousedown.onmouseenter.onmouseleave.onmousemove.onmouseout.onmouseover.onmouseup.onpaste.onpause.onplay.onplaying.onpointercancel.onpointerdown.onpointerenter.onpointerleave.onpointermove.onpointerout.onpointerover.onpointerup.onprogress.onratechange.onreset.onresize.onscroll.onscrollend.onsecuritypolicyviolation.onseeked.onseeking.onselect.onselectionchange.onselectstart.onslotchange.onstalled.onsubmit.onsuspend.ontimeupdate.ontoggle.ontouchcancel.ontouchend.ontouchmove.ontouchstart.ontransitioncancel.ontransitionend.ontransitionrun.ontransitionstart.onvolumechange.onwaiting.onwebkitanimationend.onwebkitanimationiteration.onwebkitanimationstart.onwebkittransitionend.onwheel`.split(`.`));function at(e){return it.has(e)}function V(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let i=e[n];if(i){for(let e of Object.keys(i)){let n=t[e],a=i[e],o=typeof n==`function`,s=typeof a==`function`;if(o&&typeof s&&at(e))t[e]=Oe(n,a);else if(o&&s)t[e]=B(n,a);else if(e===`class`){let i=be(n),o=be(a);i&&o?t[e]=r(n,a):i?t[e]=r(n):o&&(t[e]=r(a))}else if(e===`style`){let r=typeof n==`object`,i=typeof a==`object`,o=typeof n==`string`,s=typeof a==`string`;if(r&&i)t[e]={...n,...a};else if(r&&s){let r=$e(a);t[e]={...n,...r}}else if(o&&i)t[e]={...$e(n),...a};else if(o&&s){let r=$e(n),i=$e(a);t[e]={...r,...i}}else r?t[e]=n:i?t[e]=a:o?t[e]=n:s&&(t[e]=a)}else t[e]=a===void 0?n:a}for(let e of Object.getOwnPropertySymbols(i)){let n=t[e],r=i[e];t[e]=r===void 0?n:r}}}return typeof t.style==`object`&&(t.style=rt(t.style).replaceAll(`
|
|
5
|
+
`,` `)),t.hidden===!1&&(t.hidden=void 0,delete t.hidden),t.disabled===!1&&(t.disabled=void 0,delete t.disabled),t}var ot=typeof window<`u`?window:void 0;typeof window<`u`&&window.document,typeof window<`u`&&window.navigator,typeof window<`u`&&window.location;function st(e){let t=e.activeElement;for(;t?.shadowRoot;){let e=t.shadowRoot.activeElement;if(e===t)break;t=e}return t}var ct=class extends Map{#e=new Map;#t=D(0);#n=D(0);#r=x||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(e){return x===this.#r?D(e):oe(e)}has(e){var t=this.#e,n=t.get(e);if(n===void 0){if(super.has(e))n=this.#i(0),t.set(e,n);else return v(this.#t),!1}return v(n),!0}forEach(e,t){this.#a(),super.forEach(e,t)}get(e){var t=this.#e,n=t.get(e);if(n===void 0){if(super.has(e))n=this.#i(0),t.set(e,n);else{v(this.#t);return}}return v(n),super.get(e)}getOrInsert(e,t){return super.has(e)||this.set(e,t),this.get(e)}getOrInsertComputed(e,t){return super.has(e)||this.set(e,t(e)),this.get(e)}set(e,t){var n=this.#e,r=n.get(e),i=super.get(e),a=super.set(e,t),o=this.#t;if(r===void 0)r=this.#i(0),n.set(e,r),C(this.#n,super.size),te(o);else if(i!==t){te(r);var s=o.reactions===null?null:new Set(o.reactions);(s===null||!r.reactions?.every(e=>s.has(e)))&&te(o)}return a}delete(e){var t=this.#e,n=t.get(e),r=super.delete(e);return n!==void 0&&(t.delete(e),C(n,-1)),r&&(C(this.#n,super.size),te(this.#t)),r}clear(){if(super.size!==0){super.clear();var e=this.#e;C(this.#n,0);for(var t of e.values())C(t,-1);te(this.#t),e.clear()}}#a(){v(this.#t);var e=this.#e;if(this.#n.v!==e.size){for(var t of super.keys())if(!e.has(t)){var n=this.#i(0);e.set(t,n)}}for([,n]of this.#e)v(n)}keys(){return v(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return v(this.#n),super.size}};new class{#e;#t;constructor(e={}){let{window:t=ot,document:n=t?.document}=e;t!==void 0&&(this.#e=n,this.#t=l(e=>{let n=A(t,`focusin`,e),r=A(t,`focusout`,e);return()=>{n(),r()}}))}get current(){return this.#t?.(),this.#e?st(this.#e):null}};function lt(e){return typeof e==`function`}var H=class{#e;#t;constructor(e){this.#e=e,this.#t=Symbol(e)}get key(){return this.#t}exists(){return ue(this.#t)}get(){let e=ee(this.#t);if(e===void 0)throw Error(`Context "${this.#e}" not found`);return e}getOr(e){let t=ee(this.#t);return t===void 0?e:t}set(e){return le(this.#t,e)}};function ut(e,t){switch(e){case`post`:j(t);break;case`pre`:ne(t)}}function dt(t,n,r,i={}){let{lazy:a=!1}=i,o=!a,s=Array.isArray(t)?[]:void 0;ut(n,()=>{let n=Array.isArray(t)?t.map(e=>e()):t();if(!o){o=!0,s=n;return}let i=e(()=>r(n,s));return s=n,i})}function U(e,t,n){dt(e,`post`,t,n)}function ft(e,t,n){dt(e,`pre`,t,n)}U.pre=ft;function pt(e){return lt(e)?e():e}var mt=class{#e={width:0,height:0};#t=!1;#n;#r;#i;#a=w(()=>(v(this.#s)?.(),this.getSize().width));#o=w(()=>(v(this.#s)?.(),this.getSize().height));#s=w(()=>{let e=pt(this.#r);if(e)return l(t=>{if(!this.#i)return;let n=new this.#i.ResizeObserver(e=>{this.#t=!0;for(let t of e){let e=this.#n.box===`content-box`?t.contentBoxSize:t.borderBoxSize,n=Array.isArray(e)?e:[e];this.#e.width=n.reduce((e,t)=>Math.max(e,t.inlineSize),0),this.#e.height=n.reduce((e,t)=>Math.max(e,t.blockSize),0)}t()});return n.observe(e),()=>{this.#t=!1,n.disconnect()}})});constructor(e,t={box:`border-box`}){this.#i=t.window??ot,this.#n=t,this.#r=e,this.#e={width:0,height:0}}calculateSize(){let e=pt(this.#r);if(!e||!this.#i)return;let t=e.offsetWidth,n=e.offsetHeight;if(this.#n.box===`border-box`)return{width:t,height:n};let r=this.#i.getComputedStyle(e),i=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),a=parseFloat(r.paddingTop)+parseFloat(r.paddingBottom),o=parseFloat(r.borderLeftWidth)+parseFloat(r.borderRightWidth),s=parseFloat(r.borderTopWidth)+parseFloat(r.borderBottomWidth);return{width:t-i-o,height:n-a-s}}getSize(){return this.#t?this.#e:this.calculateSize()??this.#e}get current(){return v(this.#s)?.(),this.getSize()}get width(){return v(this.#a)}get height(){return v(this.#o)}};function W(e){j(()=>()=>{e()})}function ht(e,t){return setTimeout(t,e)}function G(e){m().then(e)}var gt=1,_t=9,vt=11;function yt(e){return ve(e)&&e.nodeType===gt&&typeof e.nodeName==`string`}function bt(e){return ve(e)&&e.nodeType===_t}function xt(e){return ve(e)&&e.constructor?.name===`VisualViewport`}function St(e){return ve(e)&&e.nodeType!==void 0}function Ct(e){return St(e)&&e.nodeType===vt&&`host`in e}function wt(e,t){if(!e||!t||!yt(e)||!yt(t))return!1;let n=t.getRootNode?.();if(e===t||e.contains(t))return!0;if(n&&Ct(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Tt(e){return bt(e)?e:xt(e)?e.document:e?.ownerDocument??document}function Et(e){return Ct(e)?Et(e.host):bt(e)?e.defaultView??window:yt(e)?e.ownerDocument?.defaultView??window:window}function Dt(e){let t=e.activeElement;for(;t?.shadowRoot;){let e=t.shadowRoot.activeElement;if(e===t)break;t=e}return t}var Ot=class{element;#e=w(()=>this.element.current?this.element.current.getRootNode()??document:document);get root(){return v(this.#e)}set root(e){C(this.#e,e)}constructor(e){this.element=typeof e==`function`?L(e):e}getDocument=()=>Tt(this.root);getWindow=()=>this.getDocument().defaultView??window;getActiveElement=()=>Dt(this.root);isActiveElement=e=>e===this.getActiveElement();getElementById(e){return this.root.getElementById(e)}querySelector=e=>this.root?this.root.querySelector(e):null;querySelectorAll=e=>this.root?this.root.querySelectorAll(e):[];setTimeout=(e,t)=>this.getWindow().setTimeout(e,t);clearTimeout=e=>this.getWindow().clearTimeout(e)};function K(t,n){return{[y()]:r=>Se(t)?(t.current=r,e(()=>n?.(r)),()=>{`isConnected`in r&&r.isConnected||(t.current=null,n?.(null))}):(t(r),e(()=>n?.(r)),()=>{`isConnected`in r&&r.isConnected||(t(null),n?.(null))})}}function kt(e){return e?`true`:`false`}function q(e){return e?``:void 0}function At(e){return e?`open`:`closed`}function jt(e){return e===`starting`?{"data-starting-style":``}:e===`ending`?{"data-ending-style":``}:{}}var Mt=class{#e;#t;attrs;constructor(e){this.#e=e.getVariant?e.getVariant():null,this.#t=this.#e?`data-${this.#e}-`:`data-${e.component}-`,this.getAttr=this.getAttr.bind(this),this.selector=this.selector.bind(this),this.attrs=Object.fromEntries(e.parts.map(e=>[e,this.getAttr(e)]))}getAttr(e,t){return t?`data-${t}-${e}`:`${this.#t}${e}`}selector(e,t){return`[${this.getAttr(e,t)}]`}};function Nt(e){let t=new Mt(e);return{...t.attrs,selector:t.selector,getAttr:t.getAttr}}var Pt=`ArrowDown`,Ft=`ArrowLeft`,It=`ArrowRight`,Lt=`ArrowUp`,Rt=`Enter`,zt=`Home`,Bt=`PageDown`,Vt=`PageUp`;function Ht(e){return window.getComputedStyle(e).getPropertyValue(`direction`)}var Ut=[Pt,Vt,zt],Wt=[Lt,Bt,`End`];[...Ut,...Wt];function Gt(e=`ltr`,t=`horizontal`){return{horizontal:e===`rtl`?Ft:It,vertical:Pt}[t]}function Kt(e=`ltr`,t=`horizontal`){return{horizontal:e===`rtl`?It:Ft,vertical:Lt}[t]}function qt(e=`ltr`,t=`horizontal`){return[`ltr`,`rtl`].includes(e)||(e=`ltr`),[`horizontal`,`vertical`].includes(t)||(t=`horizontal`),{nextKey:Gt(e,t),prevKey:Kt(e,t)}}var Jt=typeof document<`u`,Yt=Xt();function Xt(){return Jt&&window?.navigator?.userAgent&&(/iP(ad|hone|od)/.test(window.navigator.userAgent)||window?.navigator?.maxTouchPoints>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function J(e){return e instanceof HTMLElement}function Zt(e){return e instanceof Element}function Qt(e){return e instanceof Element||e instanceof SVGElement}function $t(e){return e!==null}function en(e){return e instanceof HTMLInputElement&&`select`in e}var tn=class{#e;#t=R(null);constructor(e){this.#e=e}getCandidateNodes(){return this.#e.rootNode.current?this.#e.candidateSelector?Array.from(this.#e.rootNode.current.querySelectorAll(this.#e.candidateSelector)):this.#e.candidateAttr?Array.from(this.#e.rootNode.current.querySelectorAll(`[${this.#e.candidateAttr}]:not([data-disabled])`)):[]:[]}focusFirstCandidate(){let e=this.getCandidateNodes();e.length&&e[0]?.focus()}handleKeydown(e,t,n=!1){let r=this.#e.rootNode.current;if(!r||!e)return;let i=this.getCandidateNodes();if(!i.length)return;let a=i.indexOf(e),{nextKey:o,prevKey:s}=qt(Ht(r),this.#e.orientation.current),c=this.#e.loop.current,l={[o]:a+1,[s]:a-1,[zt]:0,End:i.length-1};if(n){let e=o===`ArrowDown`?It:Pt,t=s===`ArrowUp`?Ft:Lt;l[e]=a+1,l[t]=a-1}let u=l[t.key];if(u===void 0)return;t.preventDefault(),u<0&&c?u=i.length-1:u===i.length&&c&&(u=0);let d=i[u];if(d)return d.focus(),this.#t.current=d.id,this.#e.onCandidateFocus?.(d),d}getTabIndex(e){let t=this.getCandidateNodes(),n=this.#t.current!==null;return e&&!n&&t[0]===e?(this.#t.current=e.id,0):e?.id===this.#t.current?0:-1}setCurrentTabStopId(e){this.#t.current=e}focusCurrentTabStop(){let e=this.#t.current;if(!e)return;let t=this.#e.rootNode.current?.querySelector(`#${e}`);t&&J(t)&&t.focus()}},nn=class{#e;#t=null;#n=null;#r=0;constructor(e){this.#e=e,W(()=>this.#i())}#i(){this.#t!==null&&(window.cancelAnimationFrame(this.#t),this.#t=null),this.#n?.disconnect(),this.#n=null,this.#r++}run(e){this.#i();let t=this.#e.ref.current;if(!t)return;if(typeof t.getAnimations!=`function`){this.#a(e);return}let n=this.#r,r=()=>{n===this.#r&&this.#a(e)},i=()=>{if(n!==this.#r)return;let e=t.getAnimations();if(e.length===0){r();return}Promise.all(e.map(e=>e.finished)).then(()=>{r()}).catch(()=>{if(n===this.#r){if(t.getAnimations().some(e=>e.pending||e.playState!==`finished`)){i();return}r()}})},a=()=>{this.#t=window.requestAnimationFrame(()=>{this.#t=null,i()})};if(!this.#e.afterTick.current){a();return}this.#t=window.requestAnimationFrame(()=>{this.#t=null;let e=`data-starting-style`;if(!t.hasAttribute(e)){a();return}this.#n=new MutationObserver(()=>{n===this.#r&&(t.hasAttribute(e)||(this.#n?.disconnect(),this.#n=null,a()))}),this.#n.observe(t,{attributes:!0,attributeFilter:[e]})})}#a(e){let t=()=>{e()};this.#e.afterTick?G(t):t()}},rn=class{#e;#t;#n;#r=D(!1);#i=D(void 0);#a=!1;#o=null;constructor(e){this.#e=e,C(this.#r,e.open.current,!0),this.#t=e.enabled??!0,this.#n=new nn({ref:this.#e.ref,afterTick:this.#e.open}),W(()=>this.#s()),U(()=>this.#e.open.current,e=>{if(!this.#a){this.#a=!0;return}if(this.#s(),!e&&this.#e.shouldSkipExitAnimation?.()){C(this.#r,!1),C(this.#i,void 0),this.#e.onComplete?.();return}if(e&&C(this.#r,!0),C(this.#i,e?`starting`:`ending`,!0),e&&(this.#o=window.requestAnimationFrame(()=>{this.#o=null,this.#e.open.current&&C(this.#i,void 0)})),!this.#t){e||C(this.#r,!1),C(this.#i,void 0),this.#e.onComplete?.();return}this.#n.run(()=>{e===this.#e.open.current&&(this.#e.open.current||C(this.#r,!1),C(this.#i,void 0),this.#e.onComplete?.())})})}get shouldRender(){return v(this.#r)}get transitionStatus(){return v(this.#i)}#s(){this.#o!==null&&(window.cancelAnimationFrame(this.#o),this.#o=null)}};function Y(){}function X(e,t){return t===void 0?`bits-${e}`:`bits-${e}-${t}`}var an=Nt({component:`dialog`,parts:[`content`,`trigger`,`overlay`,`title`,`description`,`close`,`cancel`,`action`]}),Z=new H(`Dialog.Root | AlertDialog.Root`),on=class e{static create(t){let n=Z.getOr(null);return Z.set(new e(t,n))}opts;#e=D(null);get triggerNode(){return v(this.#e)}set triggerNode(e){C(this.#e,e,!0)}#t=D(null);get contentNode(){return v(this.#t)}set contentNode(e){C(this.#t,e,!0)}#n=D(null);get overlayNode(){return v(this.#n)}set overlayNode(e){C(this.#n,e,!0)}#r=D(null);get descriptionNode(){return v(this.#r)}set descriptionNode(e){C(this.#r,e,!0)}#i=D(void 0);get contentId(){return v(this.#i)}set contentId(e){C(this.#i,e,!0)}#a=D(void 0);get titleId(){return v(this.#a)}set titleId(e){C(this.#a,e,!0)}#o=D(void 0);get triggerId(){return v(this.#o)}set triggerId(e){C(this.#o,e,!0)}#s=D(void 0);get descriptionId(){return v(this.#s)}set descriptionId(e){C(this.#s,e,!0)}#c=D(null);get cancelNode(){return v(this.#c)}set cancelNode(e){C(this.#c,e,!0)}#l=D(0);get nestedOpenCount(){return v(this.#l)}set nestedOpenCount(e){C(this.#l,e,!0)}depth;parent;contentPresence;overlayPresence;constructor(e,t){this.opts=e,this.parent=t,this.depth=t?t.depth+1:0,this.handleOpen=this.handleOpen.bind(this),this.handleClose=this.handleClose.bind(this),this.contentPresence=new rn({ref:L(()=>this.contentNode),open:this.opts.open,enabled:!0,onComplete:()=>{this.opts.onOpenChangeComplete.current(this.opts.open.current)}}),this.overlayPresence=new rn({ref:L(()=>this.overlayNode),open:this.opts.open,enabled:!0}),U(()=>this.opts.open.current,e=>{this.parent&&(e?this.parent.incrementNested():this.parent.decrementNested())},{lazy:!0}),W(()=>{this.opts.open.current&&this.parent?.decrementNested()})}handleOpen(){this.opts.open.current||(this.opts.open.current=!0)}handleClose(){this.opts.open.current&&(this.opts.open.current=!1)}getBitsAttr=e=>an.getAttr(e,this.opts.variant.current);incrementNested(){this.nestedOpenCount++,this.parent?.incrementNested()}decrementNested(){this.nestedOpenCount!==0&&(this.nestedOpenCount--,this.parent?.decrementNested())}#u=w(()=>({"data-state":At(this.opts.open.current)}));get sharedProps(){return v(this.#u)}set sharedProps(e){C(this.#u,e)}},sn=class e{static create(t){return new e(t,Z.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=K(this.opts.ref),this.onclick=this.onclick.bind(this),this.onkeydown=this.onkeydown.bind(this)}onclick(e){this.opts.disabled.current||e.button>0||this.root.handleClose()}onkeydown(e){this.opts.disabled.current||(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),this.root.handleClose())}#e=w(()=>({id:this.opts.id.current,[this.root.getBitsAttr(this.opts.variant.current)]:``,onclick:this.onclick,onkeydown:this.onkeydown,disabled:this.opts.disabled.current?!0:void 0,tabindex:0,...this.root.sharedProps,...this.attachment}));get props(){return v(this.#e)}set props(e){C(this.#e,e)}},cn=class e{static create(t){return new e(t,Z.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.root.titleId=this.opts.id.current,this.attachment=K(this.opts.ref),U.pre(()=>this.opts.id.current,e=>{this.root.titleId=e})}#e=w(()=>({id:this.opts.id.current,role:`heading`,"aria-level":this.opts.level.current,[this.root.getBitsAttr(`title`)]:``,...this.root.sharedProps,...this.attachment}));get props(){return v(this.#e)}set props(e){C(this.#e,e)}},ln=class e{static create(t){return new e(t,Z.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.root.descriptionId=this.opts.id.current,this.attachment=K(this.opts.ref,e=>{this.root.descriptionNode=e}),U.pre(()=>this.opts.id.current,e=>{this.root.descriptionId=e})}#e=w(()=>({id:this.opts.id.current,[this.root.getBitsAttr(`description`)]:``,...this.root.sharedProps,...this.attachment}));get props(){return v(this.#e)}set props(e){C(this.#e,e)}},un=class e{static create(t){return new e(t,Z.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=K(this.opts.ref,e=>{this.root.contentNode=e,this.root.contentId=e?.id})}#e=w(()=>({open:this.root.opts.open.current}));get snippetProps(){return v(this.#e)}set snippetProps(e){C(this.#e,e)}#t=w(()=>({id:this.opts.id.current,role:this.root.opts.variant.current===`alert-dialog`?`alertdialog`:`dialog`,"aria-modal":`true`,"aria-describedby":this.root.descriptionId,"aria-labelledby":this.root.titleId,[this.root.getBitsAttr(`content`)]:``,style:{pointerEvents:`auto`,outline:this.root.opts.variant.current===`alert-dialog`?`none`:void 0,"--bits-dialog-depth":this.root.depth,"--bits-dialog-nested-count":this.root.nestedOpenCount,contain:`layout style`},tabindex:this.root.opts.variant.current===`alert-dialog`?-1:void 0,"data-nested-open":q(this.root.nestedOpenCount>0),"data-nested":q(this.root.parent!==null),...jt(this.root.contentPresence.transitionStatus),...this.root.sharedProps,...this.attachment}));get props(){return v(this.#t)}set props(e){C(this.#t,e)}get shouldRender(){return this.root.contentPresence.shouldRender}},dn=class e{static create(t){return new e(t,Z.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=K(this.opts.ref,e=>this.root.overlayNode=e)}#e=w(()=>({open:this.root.opts.open.current}));get snippetProps(){return v(this.#e)}set snippetProps(e){C(this.#e,e)}#t=w(()=>({id:this.opts.id.current,[this.root.getBitsAttr(`overlay`)]:``,style:{pointerEvents:`auto`,"--bits-dialog-depth":this.root.depth,"--bits-dialog-nested-count":this.root.nestedOpenCount},"data-nested-open":q(this.root.nestedOpenCount>0),"data-nested":q(this.root.parent!==null),...jt(this.root.overlayPresence.transitionStatus),...this.root.sharedProps,...this.attachment}));get props(){return v(this.#t)}set props(e){C(this.#t,e)}get shouldRender(){return this.root.overlayPresence.shouldRender}},fn=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`child`,`children`,`level`]),pn=n(`<div><!></div>`);function mn(e,n){let r=s();i(n,!0);let a=b(n,`id`,19,()=>X(r)),o=b(n,`ref`,15,null),c=b(n,`level`,3,2),l=O(n,fn),u=cn.create({id:L(()=>a()),level:L(()=>c()),ref:L(()=>o(),e=>o(e))}),p=w(()=>V(l,u.props));var m=P(),_=N(m),y=e=>{var t=P(),r=N(t);f(r,()=>n.child,()=>({props:v(p)})),h(e,t)},ee=e=>{var r=pn();S(r,()=>({...v(p)}));var i=k(r);f(i,()=>n.children??T),t(r),h(e,r)};d(_,e=>{n.child?e(y):e(ee,-1)}),h(e,m),g()}function hn(e,t){var n=P(),r=N(n);u(r,()=>t.children,e=>{var n=P(),r=N(n);f(r,()=>t.children??T),h(e,n)}),h(e,n)}var gn=new H(`BitsConfig`);function _n(){let e=new vn(null,{});return gn.getOr(e).opts}var vn=class{opts;constructor(e,t){let n=yn(e,t);this.opts={defaultPortalTo:n(e=>e.defaultPortalTo),defaultLocale:n(e=>e.defaultLocale)}}};function yn(e,t){return n=>L(()=>{let r=n(t)?.current;if(r!==void 0)return r;if(e!==null)return n(e.opts)?.current})}function bn(e,t){return n=>{let r=_n();return L(()=>{let i=n();if(i!==void 0)return i;let a=e(r).current;return a===void 0?t:a})}}var xn=bn(e=>e.defaultPortalTo,`body`);function Sn(e,t){i(t,!0);let n=xn(()=>t.to),r=de(),a=w(o);function o(){if(!Jt||t.disabled)return null;let e=null;return e=typeof n.current==`string`?document.querySelector(n.current):n.current,e}let s;function l(){s&&=(c(s),null)}U([()=>v(a),()=>t.disabled],([e,n])=>{if(!e||n){l();return}return s=p(hn,{target:e,props:{children:t.children},context:r}),()=>{l()}});var u=P(),m=N(u),_=e=>{var n=P(),r=N(n);f(r,()=>t.children??T),h(e,n)};d(m,e=>{t.disabled&&e(_)}),h(e,u),g()}var Cn=class{eventName;options;constructor(e,t={bubbles:!0,cancelable:!0}){this.eventName=e,this.options=t}createEvent(e){return new CustomEvent(this.eventName,{...this.options,detail:e})}dispatch(e,t){let n=this.createEvent(t);return e.dispatchEvent(n),n}listen(e,t,n){return A(e,this.eventName,e=>{t(e)},n)}};function wn(e,t=500){let n=null,r=(...r)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...r)},t)};return r.destroy=()=>{n!==null&&(clearTimeout(n),n=null)},r}function Tn(e,t){return e===t||e.contains(t)}function En(e){return e?.ownerDocument??document}function Dn(e){if(!e)return null;for(let t of e.childNodes)if(t.nodeType!==Node.COMMENT_NODE)return t;return null}function On(e,t){let{clientX:n,clientY:r}=e,i=t.getBoundingClientRect();return n<i.left||n>i.right||r<i.top||r>i.bottom}var kn=[Rt,` `],An=[Pt,Vt,zt],jn=[Lt,Bt,`End`],Mn=[...An,...jn];[...kn],[...kn];function Q(e){return e.pointerType===`mouse`}function Nn(e,{select:t=!1}={}){if(!e||!e.focus)return;let n=Tt(e);if(n.activeElement===e)return;let r=n.activeElement;e.focus({preventScroll:!0}),e!==r&&en(e)&&t&&e.select()}function Pn(e,{select:t=!1}={},n){let r=n();for(let i of e)if(Nn(i,{select:t}),n()!==r)return!0}var Fn=D(!1),In=class e{static _refs=0;static _cleanup;constructor(){j(()=>(e._refs===0&&(e._cleanup=se(()=>{let e=[],t=e=>{C(Fn,!1)};return e.push(A(document,`pointerdown`,t,{capture:!0}),A(document,`pointermove`,t,{capture:!0}),A(document,`keydown`,e=>{C(Fn,!0)},{capture:!0})),B(...e)})),e._refs++,()=>{e._refs--,e._refs===0&&(C(Fn,!1),e._cleanup?.())}))}get current(){return v(Fn)}set current(e){C(Fn,e,!0)}},Ln=[`input:not([inert]):not([inert] *)`,`select:not([inert]):not([inert] *)`,`textarea:not([inert]):not([inert] *)`,`a[href]:not([inert]):not([inert] *)`,`area[href]:not([inert]):not([inert] *)`,`button:not([inert]):not([inert] *)`,`[tabindex]:not(slot):not([inert]):not([inert] *)`,`audio[controls]:not([inert]):not([inert] *)`,`video[controls]:not([inert]):not([inert] *)`,`[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)`,`details>summary:first-of-type:not([inert]):not([inert] *)`,`details:not([inert]):not([inert] *)`],Rn=Ln.join(`,`),zn=typeof Element>`u`,$=zn?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Bn=!zn&&Element.prototype.getRootNode?function(e){return e?.getRootNode?.call(e)}:function(e){return e?.ownerDocument},Vn=function(e,t){t===void 0&&(t=!0);var n=e?.getAttribute?.call(e,`inert`);return n===``||n===`true`||t&&e&&(typeof e.closest==`function`?e.closest(`[inert]`):Vn(e.parentNode))},Hn=function(e){var t=e?.getAttribute?.call(e,`contenteditable`);return t===``||t===`true`},Un=function(e,t,n){if(Vn(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(Rn));return t&&$.call(e,Rn)&&r.unshift(e),r=r.filter(n),r},Wn=function(e,t,n){for(var r=[],i=Array.from(e);i.length;){var a=i.shift();if(!Vn(a,!1)){if(a.tagName===`SLOT`){var o=a.assignedElements(),s=Wn(o.length?o:a.children,!0,n);n.flatten?r.push.apply(r,s):r.push({scopeParent:a,candidates:s})}else{$.call(a,Rn)&&n.filter(a)&&(t||!e.includes(a))&&r.push(a);var c=a.shadowRoot||typeof n.getShadowRoot==`function`&&n.getShadowRoot(a),l=!Vn(c,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(a));if(c&&l){var u=Wn(c===!0?a.children:c.children,!0,n);n.flatten?r.push.apply(r,u):r.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}}return r},Gn=function(e){return!isNaN(parseInt(e.getAttribute(`tabindex`),10))},Kn=function(e){if(!e)throw Error(`No node provided`);return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Hn(e))&&!Gn(e)?0:e.tabIndex},qn=function(e,t){var n=Kn(e);return n<0&&t&&!Gn(e)?0:n},Jn=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Yn=function(e){return e.tagName===`INPUT`},Xn=function(e){return Yn(e)&&e.type===`hidden`},Zn=function(e){return e.tagName===`DETAILS`&&Array.prototype.slice.apply(e.children).some(function(e){return e.tagName===`SUMMARY`})},Qn=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},$n=function(e){if(!e.name)return!0;var t=e.form||Bn(e),n=function(e){return t.querySelectorAll(`input[type="radio"][name="`+e+`"]`)},r;if(typeof window<`u`&&window.CSS!==void 0&&typeof window.CSS.escape==`function`)r=n(window.CSS.escape(e.name));else try{r=n(e.name)}catch(e){return console.error(`Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s`,e.message),!1}var i=Qn(r,e.form);return!i||i===e},er=function(e){return Yn(e)&&e.type===`radio`},tr=function(e){return er(e)&&!$n(e)},nr=function(e){var t=e&&Bn(e),n=t?.host,r=!1;if(t&&t!==e){var i,a,o;for(r=!!((i=n)!=null&&(a=i.ownerDocument)!=null&&a.contains(n)||e!=null&&(o=e.ownerDocument)!=null&&o.contains(e));!r&&n;){var s,c;t=Bn(n),n=t?.host,r=!!((s=n)!=null&&(c=s.ownerDocument)!=null&&c.contains(n))}}return r},rr=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return n===0&&r===0},ir=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if(n===`full-native`&&`checkVisibility`in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});var i=getComputedStyle(e).visibility;if(i===`hidden`||i===`collapse`)return!0;var a=$.call(e,`details>summary:first-of-type`)?e.parentElement:e;if($.call(a,`details:not([open]) *`))return!0;if(!n||n===`full`||n===`full-native`||n===`legacy-full`){if(typeof r==`function`){for(var o=e;e;){var s=e.parentElement,c=Bn(e);if(s&&!s.shadowRoot&&r(s)===!0)return rr(e);e=e.assignedSlot?e.assignedSlot:!s&&c!==e.ownerDocument?c.host:s}e=o}if(nr(e))return!e.getClientRects().length;if(n!==`legacy-full`)return!0}else if(n===`non-zero-area`)return rr(e);return!1},ar=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName===`FIELDSET`&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if(r.tagName===`LEGEND`)return $.call(t,`fieldset[disabled] *`)?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},or=function(e,t){return!(t.disabled||Xn(t)||ir(t,e)||Zn(t)||ar(t))},sr=function(e,t){return!(tr(t)||Kn(t)<0||!or(e,t))},cr=function(e){var t=parseInt(e.getAttribute(`tabindex`),10);return!!(isNaN(t)||t>=0)},lr=function(e){var t=[],n=[];return e.forEach(function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,o=qn(a,i),s=i?lr(e.candidates):a;o===0?i?t.push.apply(t,s):t.push(a):n.push({documentOrder:r,tabIndex:o,item:e,isScope:i,content:s})}),n.sort(Jn).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},ur=function(e,t){return t||={},lr(t.getShadowRoot?Wn([e],t.includeContainer,{filter:sr.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:cr}):Un(e,t.includeContainer,sr.bind(null,t)))},dr=function(e,t){return t||={},t.getShadowRoot?Wn([e],t.includeContainer,{filter:or.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):Un(e,t.includeContainer,or.bind(null,t))},fr=function(e,t){if(t||={},!e)throw Error(`No node provided`);return $.call(e,Rn)!==!1&&sr(t,e)},pr=Ln.concat(`iframe:not([inert]):not([inert] *)`).join(`,`),mr=function(e,t){if(t||={},!e)throw Error(`No node provided`);return $.call(e,pr)!==!1&&or(t,e)};function hr(){return{getShadowRoot:!0,displayCheck:typeof ResizeObserver==`function`&&ResizeObserver.toString().includes(`[native code]`)?`full`:`none`}}function gr(e,t){if(!fr(e,hr()))return _r(e,t);let n=Tt(e),r=ur(n.body,hr());t===`prev`&&r.reverse();let i=r.indexOf(e);return i===-1?n.body:r.slice(i+1)[0]}function _r(e,t){let n=Tt(e);if(!mr(e,hr()))return n.body;let r=dr(n.body,hr());t===`prev`&&r.reverse();let i=r.indexOf(e);return i===-1?n.body:r.slice(i+1).find(e=>fr(e,hr()))??n.body}function vr(e,t,n){let r=t.toLowerCase();if(r.endsWith(` `)){let i=r.slice(0,-1);if(e.filter(e=>e.toLowerCase().startsWith(i)).length<=1)return vr(e,i,n);let a=n?.toLowerCase();if(a&&a.startsWith(i)&&a.charAt(i.length)===` `&&t.trim()===i)return n;let o=e.filter(e=>e.toLowerCase().startsWith(r));if(o.length>0){let t=n?e.indexOf(n):-1;return yr(o,Math.max(t,0)).find(e=>e!==n)||n}}let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=i.toLowerCase(),o=n?e.indexOf(n):-1,s=yr(e,Math.max(o,0));i.length===1&&(s=s.filter(e=>e!==n));let c=s.find(e=>e?.toLowerCase().startsWith(a));return c===n?void 0:c}function yr(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var br={afterMs:1e4,onChange:Y};function xr(e,t){let{afterMs:n,onChange:r,getWindow:i}={...br,...t},a=null,o=D(ce(e));function s(){return i().setTimeout(()=>{C(o,e,!0),r?.(e)},n)}return j(()=>()=>{a&&i().clearTimeout(a)}),L(()=>v(o),e=>{C(o,e,!0),r?.(e),a&&i().clearTimeout(a),a=s()})}var Sr=class{#e;#t;#n=w(()=>this.#e.onMatch?this.#e.onMatch:e=>e.focus());#r=w(()=>this.#e.getCurrentItem?this.#e.getCurrentItem:this.#e.getActiveElement);constructor(e){this.#e=e,this.#t=xr(``,{afterMs:1e3,getWindow:e.getWindow}),this.handleTypeaheadSearch=this.handleTypeaheadSearch.bind(this),this.resetTypeahead=this.resetTypeahead.bind(this)}handleTypeaheadSearch(e,t){if(!t.length)return;this.#t.current=this.#t.current+e;let n=v(this.#r)(),r=t.find(e=>e===n)?.textContent?.trim()??``,i=vr(t.map(e=>e.textContent?.trim()??``),this.#t.current,r),a=t.find(e=>e.textContent?.trim()===i);return a&&v(this.#n)(a),a}resetTypeahead(){this.#t.current=``}get search(){return this.#t.current}},Cr=`data-context-menu-trigger`,wr=`data-context-menu-content`,Tr=new H(`Menu.Root`),Er=new H(`Menu.Root | Menu.Sub`),Dr=new H(`Menu.Content`),Or=new H(`Menu.Group | Menu.RadioGroup`),kr=new H(`Menu.RadioGroup`),Ar=new H(`Menu.CheckboxGroup`),jr=new Cn(`bitsmenuopen`,{bubbles:!1,cancelable:!0}),Mr=Nt({component:`menu`,parts:[`trigger`,`content`,`sub-trigger`,`item`,`group`,`group-heading`,`checkbox-group`,`checkbox-item`,`radio-group`,`radio-item`,`separator`,`sub-content`,`arrow`]}),Nr=class{#e;#t=null;#n=null;#r=!1;#i=null;#a=null;#o=null;#s=null;constructor(e){this.#e=e,U([e.triggerNode,e.contentNode,e.enabled],([e,t,n])=>{if(this.#_(),!e||!t||!n)return;let r=e=>{Q(e)&&(this.#s={x:e.clientX,y:e.clientY},this.#r||this.#d(e,`content`))},i=e=>{Q(e)&&this.#f(e,`content`)},a=e=>{Q(e)&&(this.#r||this.#d(e,`trigger`))},o=e=>{if(Q(e)){if(Zt(e.relatedTarget)){let n=this.#e.subContentSelector(),r=e.relatedTarget.closest(n);if(r&&r!==t&&r.id&&t.querySelector(`[aria-controls="${r.id}"]`))return}this.#f(e,`trigger`)}},s=e=>{Q(e)&&this.#m()},c=e=>{Q(e)&&this.#m()};return e.addEventListener(`pointermove`,r),e.addEventListener(`pointerleave`,i),e.addEventListener(`pointerenter`,s),t.addEventListener(`pointermove`,a),t.addEventListener(`pointerleave`,o),t.addEventListener(`pointerenter`,c),()=>{e.removeEventListener(`pointermove`,r),e.removeEventListener(`pointerleave`,i),e.removeEventListener(`pointerenter`,s),t.removeEventListener(`pointermove`,a),t.removeEventListener(`pointerleave`,o),t.removeEventListener(`pointerenter`,c),this.#_()}}),W(()=>{this.#_()})}#c(){let e=this.#e.parentContentNode();return e?e.getBoundingClientRect():this.#e.triggerNode()?.getBoundingClientRect()??null}#l(e,t){let n=this.#e.triggerNode(),r=this.#e.contentNode();if(!n||!r)return null;let i=n.getBoundingClientRect(),a=r.getBoundingClientRect(),o=Lr(i,a),s,c,l;return t===`content`?(s=this.#r?this.#a??e:e,c=a):(s=this.#s??e,c=this.#c()??i,l=a),this.#a=s,{corridor:Rr(i,a,o),intent:zr(s,c,o,t,l),targetRect:c,side:o}}#u(e,t,n){return Pr(e,t)||Pr(e,n)}#d(e,t){let n={x:e.clientX,y:e.clientY};this.#l(n,t)&&(this.#i=t,this.#o=n)}#f(e,t){if(!this.#e.enabled())return;let n=this.#e.triggerNode(),r=this.#e.contentNode();if(!n||!r)return;let i=e.relatedTarget;if(Zt(i)&&(t===`content`&&r.contains(i)||t===`trigger`&&n.contains(i)))return;let a={x:e.clientX,y:e.clientY},o=this.#l(a,t);if(o){if(!Fr(a,o.targetRect)&&!this.#u(a,o.corridor,o.intent)){this.#w();return}this.#r=!0,this.#i=t,this.#o=a,this.#e.setIsPointerInTransit(!0),this.#b(),this.#S()}}#p=null;#m(){if(!this.#r)return;let e=this.#i===`trigger`;this.#x(),this.#C(),this.#r=!1,this.#w(),e?(this.#h(),this.#p=setTimeout(()=>{this.#p=null,this.#e.setIsPointerInTransit(!1)},100)):this.#e.setIsPointerInTransit(!1)}#h(){this.#p!==null&&(clearTimeout(this.#p),this.#p=null)}#g(){let e=this.#o;this.#x(),this.#C(),this.#h(),this.#r=!1,this.#e.setIsPointerInTransit(!1),this.#w(),this.#e.onIntentExit(e)}#_(){this.#x(),this.#C(),this.#h(),this.#r&&this.#e.setIsPointerInTransit(!1),this.#r=!1,this.#i=null,this.#a=null,this.#o=null,this.#s=null}#v(e){let t=this.#e.contentNode();if(!t)return!1;let n=t.ownerDocument.elementFromPoint(e.x,e.y);if(!n)return!1;let r=this.#e.subContentSelector(),i=n.closest(r);return!i||i===t?!1:i.id?!!t.querySelector(`[aria-controls="${i.id}"]`):!1}#y=e=>{if(!this.#r||!this.#i||!Q(e))return;let t=this.#e.triggerNode(),n=this.#e.contentNode();if(!t||!n){this.#g();return}this.#C();let r={x:e.clientX,y:e.clientY};this.#o=r;let i=t.getBoundingClientRect(),a=n.getBoundingClientRect();if(this.#i===`content`&&Fr(r,a)){this.#m();return}if(this.#i===`trigger`&&Ir(r,i,4)){this.#m();return}if(this.#v(r)){this.#S();return}let o=this.#l(r,this.#i);if(!o){this.#g();return}if(this.#u(r,o.corridor,o.intent)){this.#S();return}this.#g()};#b(){if(this.#t)return;let e=Tt(this.#e.triggerNode()??this.#e.contentNode());e&&(e.addEventListener(`pointermove`,this.#y,!0),this.#t=()=>{e.removeEventListener(`pointermove`,this.#y,!0),this.#t=null})}#x(){this.#t?.()}#S(){this.#C(),this.#n=setTimeout(()=>{this.#n=null,this.#r&&this.#g()},500)}#C(){this.#n!==null&&(clearTimeout(this.#n),this.#n=null)}#w(){this.#i=null,this.#a=null,this.#o=null}};function Pr(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e].x,s=t[e].y,c=t[a].x,l=t[a].y;s>r!=l>r&&n<(c-o)*(r-s)/(l-s)+o&&(i=!i)}return i}function Fr(e,t){return e.x>=t.left&&e.x<=t.right&&e.y>=t.top&&e.y<=t.bottom}function Ir(e,t,n){return e.x>=t.left+n&&e.x<=t.right-n&&e.y>=t.top+n&&e.y<=t.bottom-n}function Lr(e,t){let n=e.left+e.width/2,r=e.top+e.height/2,i=t.left+t.width/2,a=t.top+t.height/2,o=i-n,s=a-r;return Math.abs(o)>Math.abs(s)?o>0?`right`:`left`:s>0?`bottom`:`top`}function Rr(e,t,n){switch(n){case`top`:return[{x:Math.min(e.left,t.left)-2,y:e.top},{x:Math.min(e.left,t.left)-2,y:t.bottom},{x:Math.max(e.right,t.right)+2,y:t.bottom},{x:Math.max(e.right,t.right)+2,y:e.top}];case`bottom`:return[{x:Math.min(e.left,t.left)-2,y:e.bottom},{x:Math.min(e.left,t.left)-2,y:t.top},{x:Math.max(e.right,t.right)+2,y:t.top},{x:Math.max(e.right,t.right)+2,y:e.bottom}];case`left`:return[{x:e.left,y:Math.min(e.top,t.top)-2},{x:t.right,y:Math.min(e.top,t.top)-2},{x:t.right,y:Math.max(e.bottom,t.bottom)+2},{x:e.left,y:Math.max(e.bottom,t.bottom)+2}];case`right`:return[{x:e.right,y:Math.min(e.top,t.top)-2},{x:t.left,y:Math.min(e.top,t.top)-2},{x:t.left,y:Math.max(e.bottom,t.bottom)+2},{x:e.right,y:Math.max(e.bottom,t.bottom)+2}]}}function zr(e,t,n,r,i){let a=r===`trigger`?Br(n):n,o=i?Math.min(t.top,i.top)-8:t.top-8,s=i?Math.max(t.bottom,i.bottom)+8:t.bottom+8,c=i?Math.min(t.left,i.left)-8:t.left-8,l=i?Math.max(t.right,i.right)+8:t.right+8;switch(a){case`right`:return[e,{x:t.left,y:o},{x:t.left,y:s}];case`left`:return[e,{x:t.right,y:o},{x:t.right,y:s}];case`bottom`:return[e,{x:c,y:t.top},{x:l,y:t.top}];case`top`:return[e,{x:c,y:t.bottom},{x:l,y:t.bottom}]}}function Br(e){switch(e){case`top`:return`bottom`;case`bottom`:return`top`;case`left`:return`right`;case`right`:return`left`}}var Vr=class e{static create(t){let n=new e(t);return Tr.set(n)}opts;isUsingKeyboard=new In;#e=D(!1);get ignoreCloseAutoFocus(){return v(this.#e)}set ignoreCloseAutoFocus(e){C(this.#e,e,!0)}#t=D(!1);get isPointerInTransit(){return v(this.#t)}set isPointerInTransit(e){C(this.#t,e,!0)}constructor(e){this.opts=e}getBitsAttr=e=>Mr.getAttr(e,this.opts.variant.current)},Hr=class e{static create(t,n){return Er.set(new e(t,n,null))}opts;root;parentMenu;contentId=L(()=>``);#e=D(null);get contentNode(){return v(this.#e)}set contentNode(e){C(this.#e,e,!0)}contentPresence;#t=D(null);get triggerNode(){return v(this.#t)}set triggerNode(e){C(this.#t,e,!0)}constructor(e,t,n){this.opts=e,this.root=t,this.parentMenu=n,this.contentPresence=new rn({ref:L(()=>this.contentNode),open:this.opts.open,onComplete:()=>{this.opts.onOpenChangeComplete.current(this.opts.open.current)},shouldSkipExitAnimation:()=>this.root.opts.variant.current!==`menubar`||this.parentMenu!==null?!1:this.root.opts.shouldSkipExitAnimation?.()??!1}),n&&U(()=>n.opts.open.current,()=>{n.opts.open.current||(this.opts.open.current=!1)})}toggleOpen(){this.opts.open.current=!this.opts.open.current}onOpen(){this.opts.open.current=!0}onClose(){this.opts.open.current=!1}},Ur=class e{static create(t){return Dr.set(new e(t,Er.get()))}opts;parentMenu;rovingFocusGroup;domContext;attachment;#e=D(``);get search(){return v(this.#e)}set search(e){C(this.#e,e,!0)}#t=0;#n;#r=D(!1);get mounted(){return v(this.#r)}set mounted(e){C(this.#r,e,!0)}#i;constructor(e,t){this.opts=e,this.parentMenu=t,this.domContext=new Ot(e.ref),this.attachment=K(this.opts.ref,e=>{this.parentMenu.contentNode!==e&&(this.parentMenu.contentNode=e)}),t.contentId=e.id,this.#i=e.isSub??!1,this.onkeydown=this.onkeydown.bind(this),this.onblur=this.onblur.bind(this),this.onfocus=this.onfocus.bind(this),this.handleInteractOutside=this.handleInteractOutside.bind(this),new Nr({contentNode:()=>this.parentMenu.contentNode,triggerNode:()=>this.parentMenu.triggerNode,parentContentNode:()=>this.parentMenu.parentMenu?.contentNode??null,subContentSelector:()=>`[${this.parentMenu.root.getBitsAttr(`sub-content`)}]`,enabled:()=>this.parentMenu.opts.open.current&&!!this.parentMenu.triggerNode?.hasAttribute(this.parentMenu.root.getBitsAttr(`sub-trigger`)),onIntentExit:e=>{this.parentMenu.opts.open.current=!1,this.#s(e)},setIsPointerInTransit:e=>{this.parentMenu.root.isPointerInTransit=e}}),this.#n=new Sr({getActiveElement:()=>this.domContext.getActiveElement(),getWindow:()=>this.domContext.getWindow()}).handleTypeaheadSearch,this.rovingFocusGroup=new tn({rootNode:L(()=>this.parentMenu.contentNode),candidateAttr:this.parentMenu.root.getBitsAttr(`item`),loop:this.opts.loop,orientation:L(()=>`vertical`)}),U(()=>this.parentMenu.contentNode,e=>e?jr.listen(e,()=>{G(()=>{this.parentMenu.root.isUsingKeyboard.current&&this.rovingFocusGroup.focusFirstCandidate()})}):void 0),j(()=>{this.parentMenu.opts.open.current||this.domContext.getWindow().clearTimeout(this.#t)})}#a(){let e=this.parentMenu.contentNode;return e?Array.from(e.querySelectorAll(`[${this.parentMenu.root.getBitsAttr(`item`)}]:not([data-disabled])`)):[]}#o(){return this.parentMenu.root.isPointerInTransit}#s(e){if(!e)return;let t=this.parentMenu.parentMenu?.contentNode;if(!t)return;let n=this.domContext.getDocument().elementFromPoint(e.x,e.y);if(!Zt(n))return;let r=n.closest(`[${this.parentMenu.root.getBitsAttr(`sub-trigger`)}]`);r&&t.contains(r)&&r!==this.parentMenu.triggerNode&&r.dispatchEvent(new PointerEvent(`pointermove`,{bubbles:!0,cancelable:!0,pointerType:`mouse`,clientX:e.x,clientY:e.y}))}onCloseAutoFocus=e=>{if(this.opts.onCloseAutoFocus.current?.(e),!(e.defaultPrevented||this.#i)){if(this.parentMenu.root.ignoreCloseAutoFocus){e.preventDefault();return}this.parentMenu.triggerNode&&fr(this.parentMenu.triggerNode)&&(e.preventDefault(),this.parentMenu.triggerNode.focus())}};handleTabKeyDown(e){let t=this.parentMenu;for(;t.parentMenu!==null;)t=t.parentMenu;if(!t.triggerNode)return;e.preventDefault();let n=gr(t.triggerNode,e.shiftKey?`prev`:`next`);n?(this.parentMenu.root.ignoreCloseAutoFocus=!0,t.onClose(),G(()=>{n.focus(),G(()=>{this.parentMenu.root.ignoreCloseAutoFocus=!1})})):this.domContext.getDocument().body.focus()}onkeydown(e){if(e.defaultPrevented)return;if(e.key===`Tab`){this.handleTabKeyDown(e);return}let t=e.target,n=e.currentTarget;if(!J(t)||!J(n))return;let r=t.closest(`[${this.parentMenu.root.getBitsAttr(`content`)}]`)?.id===this.parentMenu.contentId.current,i=e.ctrlKey||e.altKey||e.metaKey,a=e.key.length===1;if(this.rovingFocusGroup.handleKeydown(t,e)||e.code===`Space`)return;let o=this.#a();r&&!i&&a&&this.#n(e.key,o),e.target?.id===this.parentMenu.contentId.current&&Mn.includes(e.key)&&(e.preventDefault(),jn.includes(e.key)&&o.reverse(),Pn(o,{select:!1},()=>this.domContext.getActiveElement()))}onblur(e){Zt(e.currentTarget)&&Zt(e.target)&&(e.currentTarget.contains?.(e.target)||(this.domContext.getWindow().clearTimeout(this.#t),this.search=``))}onfocus(e){this.parentMenu.root.isUsingKeyboard.current&&G(()=>this.rovingFocusGroup.focusFirstCandidate())}onItemEnter(){return this.#o()}onItemLeave(e){e.currentTarget.hasAttribute(this.parentMenu.root.getBitsAttr(`sub-trigger`))||this.#o()||this.parentMenu.root.isUsingKeyboard.current||(this.parentMenu.contentNode?.focus({preventScroll:!0}),this.rovingFocusGroup.setCurrentTabStopId(``))}onTriggerLeave(){return!!this.#o()}handleInteractOutside(e){if(!Qt(e.target))return;let t=this.parentMenu.triggerNode?.id;if(e.target.id===t){e.preventDefault();return}if(e.target.closest(`#${t}`)){e.preventDefault();return}this.parentMenu.root.ignoreCloseAutoFocus=!0,G(()=>{this.parentMenu.root.ignoreCloseAutoFocus=!1})}get shouldRender(){return this.parentMenu.contentPresence.shouldRender}#c=w(()=>({open:this.parentMenu.opts.open.current}));get snippetProps(){return v(this.#c)}set snippetProps(e){C(this.#c,e)}#l=w(()=>({id:this.opts.id.current,role:`menu`,"aria-orientation":`vertical`,[this.parentMenu.root.getBitsAttr(`content`)]:``,"data-state":At(this.parentMenu.opts.open.current),...jt(this.parentMenu.contentPresence.transitionStatus),onkeydown:this.onkeydown,onblur:this.onblur,onfocus:this.onfocus,dir:this.parentMenu.root.opts.dir.current,style:{pointerEvents:`auto`,contain:`layout style`},...this.attachment}));get props(){return v(this.#l)}set props(e){C(this.#l,e)}popperProps={onCloseAutoFocus:e=>this.onCloseAutoFocus(e)}},Wr=class{opts;content;attachment;#e=D(!1);constructor(e,t){this.opts=e,this.content=t,this.attachment=K(this.opts.ref),this.onpointermove=this.onpointermove.bind(this),this.onpointerleave=this.onpointerleave.bind(this),this.onfocus=this.onfocus.bind(this),this.onblur=this.onblur.bind(this)}onpointermove(e){if(!e.defaultPrevented&&Q(e)){if(this.opts.disabled.current)this.content.onItemLeave(e);else{if(this.content.onItemEnter())return;let t=e.currentTarget;if(!J(t))return;t.focus({preventScroll:!0})}}}onpointerleave(e){e.defaultPrevented||Q(e)&&this.content.onItemLeave(e)}onfocus(e){G(()=>{e.defaultPrevented||this.opts.disabled.current||C(this.#e,!0)})}onblur(e){G(()=>{e.defaultPrevented||C(this.#e,!1)})}#t=w(()=>({id:this.opts.id.current,tabindex:-1,role:`menuitem`,"aria-disabled":kt(this.opts.disabled.current),"data-disabled":q(this.opts.disabled.current),"data-highlighted":v(this.#e)?``:void 0,[this.content.parentMenu.root.getBitsAttr(`item`)]:``,onpointermove:this.onpointermove,onpointerleave:this.onpointerleave,onfocus:this.onfocus,onblur:this.onblur,...this.attachment}));get props(){return v(this.#t)}set props(e){C(this.#t,e)}},Gr=class e{static create(t){let n=new Wr(t,Dr.get());return new e(t,n)}opts;item;root;#e=!1;constructor(e,t){this.opts=e,this.item=t,this.root=t.content.parentMenu.root,this.onkeydown=this.onkeydown.bind(this),this.onclick=this.onclick.bind(this),this.onpointerdown=this.onpointerdown.bind(this),this.onpointerup=this.onpointerup.bind(this)}#t(){if(this.item.opts.disabled.current)return;let e=new CustomEvent(`menuitemselect`,{bubbles:!0,cancelable:!0});if(this.opts.onSelect.current(e),e.defaultPrevented){this.item.content.parentMenu.root.isUsingKeyboard.current=!1;return}this.opts.closeOnSelect.current&&this.item.content.parentMenu.root.opts.onClose()}onkeydown(e){let t=this.item.content.search!==``;if(!(this.item.opts.disabled.current||t&&e.key===` `)&&kn.includes(e.key)){if(!J(e.currentTarget))return;e.currentTarget.click(),e.preventDefault()}}onclick(e){this.item.opts.disabled.current||this.#t()}onpointerup(e){if(!e.defaultPrevented&&!this.#e){if(!J(e.currentTarget))return;e.currentTarget?.click()}}onpointerdown(e){this.#e=!0}#n=w(()=>V(this.item.props,{onclick:this.onclick,onpointerdown:this.onpointerdown,onpointerup:this.onpointerup,onkeydown:this.onkeydown}));get props(){return v(this.#n)}set props(e){C(this.#n,e)}},Kr=class e{static create(t){return Or.set(new e(t,Tr.get()))}opts;root;attachment;#e=D(void 0);get groupHeadingId(){return v(this.#e)}set groupHeadingId(e){C(this.#e,e,!0)}constructor(e,t){this.opts=e,this.root=t,this.attachment=K(this.opts.ref)}#t=w(()=>({id:this.opts.id.current,role:`group`,"aria-labelledby":this.groupHeadingId,[this.root.getBitsAttr(`group`)]:``,...this.attachment}));get props(){return v(this.#t)}set props(e){C(this.#t,e)}},qr=class e{static create(t){let n=Ar.getOr(null);if(n)return new e(t,n);let r=kr.getOr(null);return r?new e(t,r):new e(t,Or.get())}opts;group;attachment;constructor(e,t){this.opts=e,this.group=t,this.attachment=K(this.opts.ref,e=>this.group.groupHeadingId=e?.id)}#e=w(()=>({id:this.opts.id.current,role:`group`,[this.group.root.getBitsAttr(`group-heading`)]:``,...this.attachment}));get props(){return v(this.#e)}set props(e){C(this.#e,e)}},Jr=class e{static create(t){return new e(t,Tr.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=K(this.opts.ref)}#e=w(()=>({id:this.opts.id.current,role:`group`,[this.root.getBitsAttr(`separator`)]:``,...this.attachment}));get props(){return v(this.#e)}set props(e){C(this.#e,e)}},Yr=class e{static create(t){return new e(t,Er.get())}opts;parentMenu;attachment;constructor(e,t){this.opts=e,this.parentMenu=t,this.attachment=K(this.opts.ref,e=>this.parentMenu.triggerNode=e)}onclick=e=>{this.opts.disabled.current||e.detail!==0||(this.parentMenu.toggleOpen(),e.preventDefault())};onpointerdown=e=>{if(!this.opts.disabled.current){if(e.pointerType===`touch`)return e.preventDefault();e.button===0&&e.ctrlKey===!1&&(this.parentMenu.toggleOpen(),this.parentMenu.opts.open.current||e.preventDefault())}};onpointerup=e=>{this.opts.disabled.current||e.pointerType===`touch`&&(e.preventDefault(),this.parentMenu.toggleOpen())};onkeydown=e=>{if(!this.opts.disabled.current){if(e.key===` `||e.key===`Enter`){this.parentMenu.toggleOpen(),e.preventDefault();return}e.key===`ArrowDown`&&(this.parentMenu.onOpen(),e.preventDefault())}};#e=w(()=>{if(this.parentMenu.opts.open.current&&this.parentMenu.contentId.current)return this.parentMenu.contentId.current});#t=w(()=>({id:this.opts.id.current,disabled:this.opts.disabled.current,"aria-haspopup":`menu`,"aria-expanded":kt(this.parentMenu.opts.open.current),"aria-controls":v(this.#e),"data-disabled":q(this.opts.disabled.current),"data-state":At(this.parentMenu.opts.open.current),[this.parentMenu.root.getBitsAttr(`trigger`)]:``,onclick:this.onclick,onpointerdown:this.onpointerdown,onpointerup:this.onpointerup,onkeydown:this.onkeydown,...this.attachment}));get props(){return v(this.#t)}set props(e){C(this.#t,e)}};globalThis.bitsDismissableLayers??=new Map;var Xr=class e{static create(t){return new e(t)}opts;#e;#t;#n={pointerdown:!1};#r=!1;#i=!1;#a=void 0;#o;#s=Y;constructor(e){this.opts=e,this.#t=e.interactOutsideBehavior,this.#e=e.onInteractOutside,this.#o=e.onFocusOutside,j(()=>{this.#a=En(this.opts.ref.current)});let t=Y,n=null,r=!1,i=()=>{n!=null&&(clearTimeout(n),n=null)},a=()=>{i(),this.#g(),globalThis.bitsDismissableLayers.delete(this),this.#d.destroy(),t()};U([()=>this.opts.enabled.current,()=>this.opts.ref.current],()=>{if(this.opts.enabled.current&&this.opts.ref.current)return i(),n=ht(1,()=>{n=null,!r&&this.opts.ref.current&&(globalThis.bitsDismissableLayers.set(this,this.#t),t(),t=this.#l())}),a}),W(()=>{r=!0,i(),this.#g.destroy(),globalThis.bitsDismissableLayers.delete(this),this.#d.destroy(),this.#s(),t()})}#c=e=>{e.defaultPrevented||this.opts.ref.current&&G(()=>{this.opts.ref.current&&!this.#h(e.target)&&e.target&&!this.#i&&this.#o.current?.(e)})};#l(){return B(A(this.#a,`pointerdown`,B(this.#f,this.#m),{capture:!0}),A(this.#a,`pointerdown`,B(this.#p,this.#d)),A(this.#a,`focusin`,this.#c))}#u=e=>{let t=e;t.defaultPrevented&&(t=ei(e)),this.#e.current(e)};#d=wn(e=>{if(!this.opts.ref.current){this.#s();return}let t=this.opts.isValidEvent.current(e,this.opts.ref.current)||$r(e,this.opts.ref.current);if(!this.#r||this.#_()||!t){this.#s();return}let n=e;if(n.defaultPrevented&&(n=ei(n)),this.#t.current!==`close`&&this.#t.current!==`defer-otherwise-close`){this.#s();return}e.pointerType===`touch`?(this.#s(),this.#s=A(this.#a,`click`,this.#u,{once:!0})):this.#e.current(n)},10);#f=e=>{this.#n[e.type]=!0};#p=e=>{this.#n[e.type]=!1};#m=()=>{this.opts.ref.current&&(this.#r=Qr(this.opts.ref.current))};#h=e=>this.opts.ref.current?Tn(this.opts.ref.current,e):!1;#g=wn(()=>{for(let e in this.#n)this.#n[e]=!1;this.#r=!1},20);#_(){return Object.values(this.#n).some(Boolean)}#v=()=>{this.#i=!0};#y=()=>{this.#i=!1};props={onfocuscapture:this.#v,onblurcapture:this.#y}};function Zr(e=[...globalThis.bitsDismissableLayers]){return e.findLast(([e,{current:t}])=>t===`close`||t===`ignore`)}function Qr(e){let t=[...globalThis.bitsDismissableLayers],n=Zr(t);if(n)return n[0].opts.ref.current===e;let[r]=t[0];return r.opts.ref.current===e}function $r(e,t){let n=e.target;if(!Qt(n))return!1;let r=!!n.closest(`[${Cr}]`),i=!!t.closest(`[${wr}]`);return`button`in e&&e.button>0&&!r?!1:`button`in e&&e.button===0&&r&&i?!0:r&&i?!1:En(n).documentElement.contains(n)&&!Tn(t,n)&&On(e,t)}function ei(e){let t=e.currentTarget,n=e.target,r;r=e instanceof PointerEvent?new PointerEvent(e.type,e):new PointerEvent(`pointerdown`,e);let i=!1;return new Proxy(r,{get:(r,a)=>a===`currentTarget`?t:a===`target`?n:a===`preventDefault`?()=>{i=!0,typeof r.preventDefault==`function`&&r.preventDefault()}:a===`defaultPrevented`?i:a in r?r[a]:e[a]})}function ti(e,t){i(t,!0);let n=b(t,`interactOutsideBehavior`,3,`close`),r=b(t,`onInteractOutside`,3,Y),a=b(t,`onFocusOutside`,3,Y),o=b(t,`isValidEvent`,3,()=>!1),s=Xr.create({id:L(()=>t.id),interactOutsideBehavior:L(()=>n()),onInteractOutside:L(()=>r()),enabled:L(()=>t.enabled),onFocusOutside:L(()=>a()),isValidEvent:L(()=>o()),ref:t.ref});var c=P(),l=N(c);f(l,()=>t.children??T,()=>({props:s.props})),h(e,c),g()}globalThis.bitsEscapeLayers??=new Map;var ni=class e{static create(t){return new e(t)}opts;domContext;constructor(e){this.opts=e,this.domContext=new Ot(this.opts.ref);let t=Y;U(()=>e.enabled.current,n=>(n&&(globalThis.bitsEscapeLayers.set(this,e.escapeKeydownBehavior),t=this.#e()),()=>{t(),globalThis.bitsEscapeLayers.delete(this)}))}#e=()=>A(this.domContext.getDocument(),`keydown`,this.#t,{passive:!1});#t=e=>{if(e.key!==`Escape`||!ri(this))return;let t=new KeyboardEvent(e.type,e);e.preventDefault();let n=this.opts.escapeKeydownBehavior.current;(n===`close`||n===`defer-otherwise-close`)&&this.opts.onEscapeKeydown.current(t)}};function ri(e){let t=[...globalThis.bitsEscapeLayers],n=t.findLast(([e,{current:t}])=>t===`close`||t===`ignore`);if(n)return n[0]===e;let[r]=t[0];return r===e}function ii(e,t){i(t,!0);let n=b(t,`escapeKeydownBehavior`,3,`close`),r=b(t,`onEscapeKeydown`,3,Y);ni.create({escapeKeydownBehavior:L(()=>n()),onEscapeKeydown:L(()=>r()),enabled:L(()=>t.enabled),ref:t.ref});var a=P(),o=N(a);f(o,()=>t.children??T),h(e,a),g()}var ai=class e{static instance;#e=De([]);#t=new WeakMap;#n=new WeakMap;static getInstance(){return this.instance||=new e,this.instance}register(e){let t=this.getActive();t&&t!==e&&t.pause();let n=document.activeElement;n&&n!==document.body&&this.#n.set(e,n),this.#e.current=this.#e.current.filter(t=>t!==e),this.#e.current.unshift(e)}unregister(e){this.#e.current=this.#e.current.filter(t=>t!==e);let t=this.getActive();t&&t.resume()}getActive(){return this.#e.current[0]}setFocusMemory(e,t){this.#t.set(e,t)}getFocusMemory(e){return this.#t.get(e)}isActiveScope(e){return this.getActive()===e}setPreFocusMemory(e,t){this.#n.set(e,t)}getPreFocusMemory(e){return this.#n.get(e)}clearPreFocusMemory(e){this.#n.delete(e)}},oi=class e{#e=!1;#t=null;#n=ai.getInstance();#r=[];#i;constructor(e){this.#i=e}get paused(){return this.#e}pause(){this.#e=!0}resume(){this.#e=!1}#a(){for(let e of this.#r)e();this.#r=[]}mount(e){this.#t&&this.unmount(),this.#t=e,this.#n.register(this),this.#c(),this.#o()}unmount(){this.#t&&=(this.#a(),this.#s(),this.#n.unregister(this),this.#n.clearPreFocusMemory(this),null)}#o(){if(!this.#t)return;let e=new CustomEvent(`focusScope.onOpenAutoFocus`,{bubbles:!1,cancelable:!0});this.#i.onOpenAutoFocus.current(e),e.defaultPrevented||requestAnimationFrame(()=>{if(!this.#t)return;let e=this.#u();e?(e.focus(),this.#n.setFocusMemory(this,e)):this.#t.focus()})}#s(){let e=new CustomEvent(`focusScope.onCloseAutoFocus`,{bubbles:!1,cancelable:!0});if(this.#i.onCloseAutoFocus.current?.(e),!e.defaultPrevented){let e=this.#n.getPreFocusMemory(this);if(e&&document.contains(e))try{e.focus()}catch{document.body.focus()}}}#c(){if(!this.#t||!this.#i.trap.current)return;let e=this.#t,t=e.ownerDocument;this.#r.push(A(t,`focusin`,t=>{if(this.#e||!this.#n.isActiveScope(this))return;let n=t.target;if(n){if(e.contains(n))this.#n.setFocusMemory(this,n);else{let n=this.#n.getFocusMemory(this);if(n&&e.contains(n)&&mr(n))t.preventDefault(),n.focus();else{let t=this.#u(),n=this.#d()[0];(t||n||e).focus()}}}},{capture:!0}),A(e,`keydown`,e=>{if(!this.#i.loop||this.#e||e.key!==`Tab`||!this.#n.isActiveScope(this))return;let n=this.#l();if(n.length===0)return;let r=n[0],i=n[n.length-1];!e.shiftKey&&t.activeElement===i?(e.preventDefault(),r.focus()):e.shiftKey&&t.activeElement===r&&(e.preventDefault(),i.focus())}));let n=new MutationObserver(()=>{let t=this.#n.getFocusMemory(this);if(t&&!e.contains(t)){let t=this.#u(),n=this.#d()[0],r=t||n;r?(r.focus(),this.#n.setFocusMemory(this,r)):e.focus()}});n.observe(e,{childList:!0,subtree:!0}),this.#r.push(()=>n.disconnect())}#l(){return this.#t?ur(this.#t,{includeContainer:!1,getShadowRoot:!0}):[]}#u(){return this.#l()[0]||null}#d(){return this.#t?dr(this.#t,{includeContainer:!1,getShadowRoot:!0}):[]}static use(t){let n=null;return U([()=>t.ref.current,()=>t.enabled.current],([r,i])=>{r&&i?(n||=new e(t),n.mount(r)):n&&=(n.unmount(),null)}),W(()=>{n?.unmount()}),{get props(){return{tabindex:-1}}}}};function si(e,t){i(t,!0);let n=b(t,`enabled`,3,!1),r=b(t,`trapFocus`,3,!1),a=b(t,`loop`,3,!1),o=b(t,`onCloseAutoFocus`,3,Y),s=b(t,`onOpenAutoFocus`,3,Y),c=oi.use({enabled:L(()=>n()),trap:L(()=>r()),loop:a(),onCloseAutoFocus:L(()=>o()),onOpenAutoFocus:L(()=>s()),ref:t.ref});var l=P(),u=N(l);f(u,()=>t.focusScope??T,()=>({props:c.props})),h(e,l),g()}var ci=()=>{};globalThis.bitsTextSelectionLayers??=new Map;var li=class e{static create(t){return new e(t)}opts;domContext;#e=Y;#t=!1;#n=ci;#r=ci;constructor(e){this.opts=e,this.domContext=new Ot(e.ref);let t=Y;U(()=>[this.opts.enabled.current,this.opts.onPointerDown.current,this.opts.onPointerUp.current],([e,n,r])=>(this.#t=e,this.#n=n,this.#r=r,e&&(globalThis.bitsTextSelectionLayers.set(this,this.opts.enabled),t(),t=this.#i()),()=>{this.#t=!1,t(),this.#s(),globalThis.bitsTextSelectionLayers.delete(this)}))}#i(){return B(A(this.domContext.getDocument(),`pointerdown`,this.#o),A(this.domContext.getDocument(),`pointerup`,Oe(this.#s,this.#a)))}#a=e=>{this.#r(e)};#o=e=>{if(!this.#t)return;let t=this.opts.ref.current,n=e.target;J(t)&&J(n)&&pi(this)&&wt(t,n)&&(this.#n(e),!e.defaultPrevented&&(this.#e=di(t,this.domContext.getDocument().body)))};#s=()=>{this.#e(),this.#e=Y}},ui=e=>e.style.userSelect||e.style.webkitUserSelect;function di(e,t){let n=ui(t),r=ui(e);return fi(t,`none`),fi(e,`text`),()=>{fi(t,n),fi(e,r)}}function fi(e,t){e.style.userSelect=t,e.style.webkitUserSelect=t}function pi(e){let t=[...globalThis.bitsTextSelectionLayers];if(!t.length)return!1;let n=t.at(-1);return n?n[0]===e:!1}function mi(e,t){i(t,!0);let n=b(t,`preventOverflowTextSelection`,3,!0),r=b(t,`onPointerDown`,3,Y),a=b(t,`onPointerUp`,3,Y);li.create({id:L(()=>t.id),onPointerDown:L(()=>r()),onPointerUp:L(()=>a()),enabled:L(()=>t.enabled&&n()),ref:t.ref});var o=P(),s=N(o);f(s,()=>t.children??T),h(e,o),g()}globalThis.bitsIdCounter??={current:0};function hi(e=`bits`){return globalThis.bitsIdCounter.current++,`${e}-${globalThis.bitsIdCounter.current}`}var gi=class{#e;#t=0;#n=D();#r;constructor(e){this.#e=e}#i(){--this.#t,this.#r&&this.#t<=0&&(this.#r(),C(this.#n,void 0),this.#r=void 0)}get(...e){return this.#t+=1,v(this.#n)===void 0&&(this.#r=se(()=>{C(this.#n,this.#e(...e),!0)})),j(()=>()=>{this.#i()}),v(this.#n)}},_i=new ct,vi=D(null),yi=null,bi=null,xi=!1,Si=L(()=>{for(let e of _i.values())if(e)return!0;return!1}),Ci=null,wi=new gi(()=>{function e(){document.body.setAttribute(`style`,v(vi)??``),document.body.style.removeProperty(`--scrollbar-width`),Yt&&yi?.(),C(vi,null)}function t(){bi!==null&&(window.clearTimeout(bi),bi=null)}function n(e,n){t(),xi=!0,Ci=Date.now();let r=Ci,i=()=>{bi=null,Ci===r&&(Ei(_i)?xi=!1:(xi=!1,n()))},a=e===null?24:e;bi=window.setTimeout(i,a)}function r(){v(vi)===null&&_i.size===0&&!xi&&C(vi,document.body.getAttribute(`style`),!0)}return U(()=>Si.current,()=>{if(!Si.current)return;r(),xi=!1;let e=getComputedStyle(document.documentElement),t=getComputedStyle(document.body),n=e.scrollbarGutter?.includes(`stable`)||t.scrollbarGutter?.includes(`stable`),i=window.innerWidth-document.documentElement.clientWidth,a={padding:Number.parseInt(t.paddingRight??`0`,10)+i,margin:Number.parseInt(t.marginRight??`0`,10)};i>0&&!n&&(document.body.style.paddingRight=`${a.padding}px`,document.body.style.marginRight=`${a.margin}px`,document.body.style.setProperty(`--scrollbar-width`,`${i}px`)),document.body.style.overflow=`hidden`,Yt&&(yi=A(document,`touchmove`,e=>{e.target===document.documentElement&&(e.touches.length>1||e.preventDefault())},{passive:!1})),G(()=>{document.body.style.pointerEvents=`none`,document.body.style.overflow=`hidden`})}),W(()=>()=>{yi?.()}),{get lockMap(){return _i},resetBodyStyle:e,scheduleCleanupIfNoNewLocks:n,cancelPendingCleanup:t,ensureInitialStyleCaptured:r}}),Ti=class{#e=hi();#t;#n=()=>null;#r;locked;constructor(e,t=()=>null){this.#t=e,this.#n=t,this.#r=wi.get(),this.#r&&(this.#r.cancelPendingCleanup(),this.#r.ensureInitialStyleCaptured(),this.#r.lockMap.set(this.#e,this.#t??!1),this.locked=L(()=>this.#r.lockMap.get(this.#e)??!1,e=>this.#r.lockMap.set(this.#e,e)),W(()=>{if(this.#r.lockMap.delete(this.#e),Ei(this.#r.lockMap))return;let e=this.#n();this.#r.scheduleCleanupIfNoNewLocks(e,()=>{this.#r.resetBodyStyle()})}))}};function Ei(e){for(let[t,n]of e)if(n)return!0;return!1}function Di(e,t){i(t,!0);let n=b(t,`preventScroll`,3,!0),r=b(t,`restoreScrollDelay`,3,null);n()&&new Ti(n(),()=>r()),g()}var Oi=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`forceMount`,`child`,`children`,`ref`]),ki=n(`<div><!></div>`);function Ai(e,n){let r=s();i(n,!0);let a=b(n,`id`,19,()=>X(r)),o=b(n,`forceMount`,3,!1),c=b(n,`ref`,15,null),l=O(n,Oi),u=dn.create({id:L(()=>a()),ref:L(()=>c(),e=>c(e))}),p=w(()=>V(l,u.props));var m=P(),_=N(m),y=e=>{var r=P(),i=N(r),a=e=>{var t=P(),r=N(t);{let e=w(()=>({props:V(v(p)),...u.snippetProps}));f(r,()=>n.child,()=>v(e))}h(e,t)},o=e=>{var r=ki();S(r,e=>({...e}),[()=>V(v(p))]);var i=k(r);f(i,()=>n.children??T,()=>u.snippetProps),t(r),h(e,r)};d(i,e=>{n.child?e(a):e(o,-1)}),h(e,r)};d(_,e=>{(u.shouldRender||o())&&e(y)}),h(e,m),g()}var ji=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`children`,`child`,`ref`]),Mi=n(`<div><!></div>`);function Ni(e,n){let r=s();i(n,!0);let a=b(n,`id`,19,()=>X(r)),o=b(n,`ref`,15,null),c=O(n,ji),l=ln.create({id:L(()=>a()),ref:L(()=>o(),e=>o(e))}),u=w(()=>V(c,l.props));var p=P(),m=N(p),_=e=>{var t=P(),r=N(t);f(r,()=>n.child,()=>({props:v(u)})),h(e,t)},y=e=>{var r=Mi();S(r,()=>({...v(u)}));var i=k(r);f(i,()=>n.children??T),t(r),h(e,r)};d(m,e=>{n.child?e(_):e(y,-1)}),h(e,p),g()}function Pi(e,t){i(t,!0);let n=b(t,`open`,15,!1),r=b(t,`onOpenChange`,3,Y),a=b(t,`onOpenChangeComplete`,3,Y);on.create({variant:L(()=>`dialog`),open:L(()=>n(),e=>{n(e),r()(e)}),onOpenChangeComplete:L(()=>a())});var o=P(),s=N(o);f(s,()=>t.children??T),h(e,o),g()}var Fi=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`ref`,`disabled`]),Ii=n(`<button><!></button>`);function Li(e,n){let r=s();i(n,!0);let a=b(n,`id`,19,()=>X(r)),o=b(n,`ref`,15,null),c=b(n,`disabled`,3,!1),l=O(n,Fi),u=sn.create({variant:L(()=>`close`),id:L(()=>a()),ref:L(()=>o(),e=>o(e)),disabled:L(()=>!!c())}),p=w(()=>V(l,u.props));var m=P(),_=N(m),y=e=>{var t=P(),r=N(t);f(r,()=>n.child,()=>({props:v(p)})),h(e,t)},ee=e=>{var r=Ii();S(r,()=>({...v(p)}));var i=k(r);f(i,()=>n.children??T),t(r),h(e,r)};d(_,e=>{n.child?e(y):e(ee,-1)}),h(e,m),g()}var Ri=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`children`,`child`,`ref`,`forceMount`,`onCloseAutoFocus`,`onOpenAutoFocus`,`onEscapeKeydown`,`onInteractOutside`,`trapFocus`,`preventScroll`,`restoreScrollDelay`]),zi=n(`<!> <!>`,1),Bi=n(`<!> <div><!></div>`,1);function Vi(e,n){let r=s();i(n,!0);let a=b(n,`id`,19,()=>X(r)),o=b(n,`ref`,15,null),c=b(n,`forceMount`,3,!1),l=b(n,`onCloseAutoFocus`,3,Y),u=b(n,`onOpenAutoFocus`,3,Y),p=b(n,`onEscapeKeydown`,3,Y),m=b(n,`onInteractOutside`,3,Y),_=b(n,`trapFocus`,3,!0),y=b(n,`preventScroll`,3,!0),ee=b(n,`restoreScrollDelay`,3,null),te=O(n,Ri),x=un.create({id:L(()=>a()),ref:L(()=>o(),e=>o(e))}),C=w(()=>V(te,x.props));var ne=P(),re=N(ne),ie=e=>{si(e,{get ref(){return x.opts.ref},loop:!0,get trapFocus(){return _()},get enabled(){return x.root.opts.open.current},get onOpenAutoFocus(){return u()},get onCloseAutoFocus(){return l()},focusScope:(e,r)=>{let i=()=>(r?.()).props;ii(e,M(()=>v(C),{get enabled(){return x.root.opts.open.current},get ref(){return x.opts.ref},onEscapeKeydown:e=>{p()(e),!e.defaultPrevented&&x.root.handleClose()},children:(e,r)=>{ti(e,M(()=>v(C),{get ref(){return x.opts.ref},get enabled(){return x.root.opts.open.current},onInteractOutside:e=>{m()(e),!e.defaultPrevented&&x.root.handleClose()},children:(e,r)=>{mi(e,M(()=>v(C),{get ref(){return x.opts.ref},get enabled(){return x.root.opts.open.current},children:(e,r)=>{var a=P(),o=N(a),s=e=>{var t=zi(),r=N(t),a=e=>{Di(e,{get preventScroll(){return y()},get restoreScrollDelay(){return ee()}})};d(r,e=>{x.root.opts.open.current&&e(a)});var o=E(r,2);{let e=w(()=>({props:V(v(C),i()),...x.snippetProps}));f(o,()=>n.child,()=>v(e))}h(e,t)},c=e=>{var r=Bi(),a=N(r);Di(a,{get preventScroll(){return y()}});var o=E(a,2);S(o,e=>({...e}),[()=>V(v(C),i())]);var s=k(o);f(s,()=>n.children??T),t(o),h(e,r)};d(o,e=>{n.child?e(s):e(c,-1)}),h(e,a)},$$slots:{default:!0}}))},$$slots:{default:!0}}))},$$slots:{default:!0}}))},$$slots:{focusScope:!0}})};d(re,e=>{(x.shouldRender||c())&&e(ie)}),h(e,ne),g()}var Hi=new Set([`$$slots`,`$$events`,`$$legacy`,`open`]);function Ui(e,t){i(t,!0);let n=b(t,`open`,15,!1),r=O(t,Hi);var o=P(),s=N(o);a(s,()=>Pi,(e,t)=>{t(e,M(()=>r,{get open(){return n()},set open(e){n(e)}}))}),h(e,o),g()}var Wi=new Set([`$$slots`,`$$events`,`$$legacy`]);function Gi(e,t){let n=O(t,Wi);var r=P(),i=N(r);a(i,()=>Sn,(e,t)=>{t(e,M(()=>n))}),h(e,r)}var Ki=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function qi(e,t){i(t,!0);let n=b(t,`ref`,15,null),r=O(t,Ki);var o=P(),s=N(o);{let e=w(()=>F(`text-sm font-medium`,t.class));a(s,()=>mn,(t,i)=>{i(t,M({"data-slot":`dialog-title`,get class(){return v(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}h(e,o),g()}var Ji=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`,`showCloseButton`]),Yi=n(`<div><!> <!></div>`);function Xi(e,n){i(n,!0);let r=b(n,`ref`,15,null),o=b(n,`showCloseButton`,3,!1),s=O(n,Ji);var c=Yi();S(c,e=>({"data-slot":`dialog-footer`,class:e,...s}),[()=>F(`gap-2 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,n.class)]);var l=k(c);f(l,()=>n.children??T);var u=E(l,2),p=e=>{var t=P(),n=N(t);{let e=(e,t)=>{pe(e,M({variant:`outline`},()=>(t?.()).props,{children:(e,t)=>{re();var n=_(`Close`);h(e,n)},$$slots:{default:!0}}))};a(n,()=>Li,(t,n)=>{n(t,{child:e,$$slots:{child:!0}})})}h(e,t)};d(u,e=>{o()&&e(p)}),t(c),ie(c,e=>r(e),()=>r()),h(e,c),g()}var Zi=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`]),Qi=n(`<div><!></div>`);function $i(e,n){i(n,!0);let r=b(n,`ref`,15,null),a=O(n,Zi);var o=Qi();S(o,e=>({"data-slot":`dialog-header`,class:e,...a}),[()=>F(`gap-1 flex flex-col`,n.class)]);var s=k(o);f(s,()=>n.children??T),t(o),ie(o,e=>r(e),()=>r()),h(e,o),g()}var ea=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function ta(e,t){i(t,!0);let n=b(t,`ref`,15,null),r=O(t,ea);var o=P(),s=N(o);{let e=w(()=>F(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50`,t.class));a(s,()=>Ai,(t,i)=>{i(t,M({"data-slot":`dialog-overlay`,get class(){return v(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}h(e,o),g()}var na=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`portalProps`,`children`,`showCloseButton`]),ra=n(`<!> <span class="sr-only">Close</span>`,1),ia=n(`<!> <!>`,1);function aa(e,t){i(t,!0);let n=b(t,`ref`,15,null),r=b(t,`showCloseButton`,3,!0),o=O(t,na);Gi(e,M(()=>t.portalProps,{children:(e,i)=>{var s=ia(),c=N(s);a(c,()=>ta,(e,t)=>{t(e,{})});var l=E(c,2);{let e=w(()=>F(`bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-4 rounded-xl p-4 text-xs/relaxed ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none`,t.class));a(l,()=>Vi,(i,s)=>{s(i,M({"data-slot":`dialog-content`,get class(){return v(e)}},()=>o,{get ref(){return n()},set ref(e){n(e)},children:(e,n)=>{var i=ia(),o=N(i);f(o,()=>t.children??T);var s=E(o,2),c=e=>{var t=P(),n=N(t);{let e=(e,t)=>{pe(e,M({variant:`ghost`,class:`absolute top-2 right-2`,size:`icon-sm`},()=>(t?.()).props,{children:(e,t)=>{var n=ra(),r=N(n);he(r,{}),re(2),h(e,n)},$$slots:{default:!0}}))};a(n,()=>Li,(t,n)=>{n(t,{"data-slot":`dialog-close`,child:e,$$slots:{child:!0}})})}h(e,t)};d(s,e=>{r()&&e(c)}),h(e,i)},$$slots:{default:!0}}))})}h(e,s)},$$slots:{default:!0}})),g()}var oa=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function sa(e,t){i(t,!0);let n=b(t,`ref`,15,null),r=O(t,oa);var o=P(),s=N(o);{let e=w(()=>F(`text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed *:[a]:underline *:[a]:underline-offset-3`,t.class));a(s,()=>Ni,(t,i)=>{i(t,M({"data-slot":`dialog-description`,get class(){return v(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}h(e,o),g()}var ca=n(`<!> `,1),la=n(`<!> <!>`,1);function ua(e,t){i(t,!0);let n=b(t,`open`,15,!1),r=b(t,`confirmLabel`,3,`Remove`),s=b(t,`busy`,3,!1);var c=P(),l=N(c);a(l,()=>Ui,(e,i)=>{i(e,{get open(){return n()},set open(e){n(e)},children:(e,i)=>{var c=P(),l=N(c);a(l,()=>aa,(e,i)=>{i(e,{class:`sm:max-w-[420px]`,children:(e,i)=>{var c=la(),l=N(c);a(l,()=>$i,(e,n)=>{n(e,{children:(e,n)=>{var r=la(),i=N(r);a(i,()=>qi,(e,n)=>{n(e,{class:`flex items-center gap-2`,children:(e,n)=>{var r=ca(),i=N(r);ge(i,{class:`h-4 w-4 text-destructive`});var a=E(i);ae(()=>o(a,` ${t.title??``}`)),h(e,r)},$$slots:{default:!0}})});var s=E(i,2);a(s,()=>sa,(e,n)=>{n(e,{children:(e,n)=>{re();var r=_();ae(()=>o(r,t.description)),h(e,r)},$$slots:{default:!0}})}),h(e,r)},$$slots:{default:!0}})});var u=E(l,2);a(u,()=>Xi,(e,i)=>{i(e,{children:(e,i)=>{var a=la(),c=N(a);pe(c,{variant:`outline`,get disabled(){return s()},onclick:()=>n(!1),children:(e,t)=>{re();var n=_(`Cancel`);h(e,n)},$$slots:{default:!0}});var l=E(c,2);pe(l,{variant:`destructive`,get disabled(){return s()},onclick:()=>t.onConfirm(),children:(e,t)=>{var n=ca(),i=N(n),a=e=>{me(e,{class:`h-4 w-4 animate-spin`})};d(i,e=>{s()&&e(a)});var c=E(i);ae(()=>o(c,` ${r()??``}`)),h(e,n)},$$slots:{default:!0}}),h(e,a)},$$slots:{default:!0}})}),h(e,c)},$$slots:{default:!0}})}),h(e,c)},$$slots:{default:!0}})}),h(e,c),g()}var da=new Set([`$$slots`,`$$events`,`$$legacy`]);function fa(e,t){let n=O(t,da),r=[[`path`,{d:`M10 11v6`}],[`path`,{d:`M14 11v6`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}],[`path`,{d:`M3 6h18`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}]];fe(e,M({name:`trash`},()=>n,{get iconNode(){return r}}))}export{Lt as A,W as B,Sn as C,Pt as D,$t as E,Nt as F,rt as G,U as H,K as I,L as J,$e as K,Et as L,zt as M,q as N,Ft as O,kt as P,G as R,Dn as S,Y as T,H as U,mt as V,V as W,De as Y,Kr as _,$i as a,Vr as b,Di as c,si as d,ii as f,qr as g,Ur as h,aa as i,Rt as j,It as k,hi as l,Yr as m,ua as n,qi as o,ti as p,we as q,sa as r,Ui as s,fa as t,mi as u,Gr as v,X as w,Jr as x,Hr as y,ht as z};
|