local-operator-ui 0.46.13 → 0.46.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/out/main/index.js +48 -8
  2. package/out/renderer/assets/{_basePickBy-DsQRe1Fk.js → _basePickBy-Bi0kJeK2.js} +1 -1
  3. package/out/renderer/assets/{_baseUniq-Dq2hVDlF.js → _baseUniq-BKZXUQvf.js} +1 -1
  4. package/out/renderer/assets/{agent-details-page-CehHl4QN.js → agent-details-page-BMAZZR3E.js} +1 -1
  5. package/out/renderer/assets/{agent-hub-page-CNh9xjWE.js → agent-hub-page-CN2lFv-R.js} +1 -1
  6. package/out/renderer/assets/{agents-page-DGL5E2SL.js → agents-page-B0SoLjZT.js} +3 -3
  7. package/out/renderer/assets/{approvalsOverlay-Bccl6pNw.js → approvalsOverlay-B-lJNuk9.js} +1 -1
  8. package/out/renderer/assets/{arc-ChSeCKrR.js → arc-C2kBR7qX.js} +1 -1
  9. package/out/renderer/assets/{architectureDiagram-IEHRJDOE-D8iJ-WCa.js → architectureDiagram-IEHRJDOE-_gjmR4iq.js} +1 -1
  10. package/out/renderer/assets/{blockDiagram-JOT3LUYC-pts1tBja.js → blockDiagram-JOT3LUYC-DSUyCb9u.js} +1 -1
  11. package/out/renderer/assets/{book-open-C4c6vo5s.js → book-open-DnoWx9VQ.js} +1 -1
  12. package/out/renderer/assets/browser-page-DC82hsTE.js +1 -0
  13. package/out/renderer/assets/{browser-webauthn-prompt-DlGNaSwO.js → browser-webauthn-prompt-PmaG5LnK.js} +1 -1
  14. package/out/renderer/assets/{building-2-CC51Sxbq.js → building-2-ChKo6hUY.js} +1 -1
  15. package/out/renderer/assets/{c4Diagram-VJAJSXHY-_6nMq85p.js → c4Diagram-VJAJSXHY-v2pORjf4.js} +1 -1
  16. package/out/renderer/assets/channel-Co_Q7qav.js +1 -0
  17. package/out/renderer/assets/{chunk-4BMEZGHF-DmmGQ8WK.js → chunk-4BMEZGHF-BHQtZxK4.js} +1 -1
  18. package/out/renderer/assets/{chunk-A2AXSNBT-CD9kxqVi.js → chunk-A2AXSNBT-1fEe-Pt3.js} +1 -1
  19. package/out/renderer/assets/{chunk-AEK57VVT-CA5eBYIu.js → chunk-AEK57VVT-yhpvqm94.js} +1 -1
  20. package/out/renderer/assets/{chunk-D6G4REZN-CQED1GQr.js → chunk-D6G4REZN-DPS_uWzo.js} +1 -1
  21. package/out/renderer/assets/{chunk-RZ5BOZE2-D4baRZw0.js → chunk-RZ5BOZE2-nI340kNQ.js} +1 -1
  22. package/out/renderer/assets/{chunk-XZIHB7SX-DiTYuVn3.js → chunk-XZIHB7SX-DZHC4n9a.js} +1 -1
  23. package/out/renderer/assets/classDiagram-GIVACNV2-y61u6s5o.js +1 -0
  24. package/out/renderer/assets/classDiagram-v2-COTLJTTW-y61u6s5o.js +1 -0
  25. package/out/renderer/assets/clone-KM8E6pL3.js +1 -0
  26. package/out/renderer/assets/{console-mirror-okL-VDWq.js → console-mirror-MA3Xpei-.js} +1 -1
  27. package/out/renderer/assets/{consoleCapture-C1BLares.js → consoleCapture-ZC-24mWp.js} +1 -1
  28. package/out/renderer/assets/{conversation-input-sync-Bn6qzeik.js → conversation-input-sync-5PEcynRC.js} +5 -5
  29. package/out/renderer/assets/{dagre-OKDRZEBW-Bi3vws_k.js → dagre-OKDRZEBW-B2ZuWuim.js} +1 -1
  30. package/out/renderer/assets/{diagram-SSKATNLV-eQK3yLXc.js → diagram-SSKATNLV-DXNjaWnl.js} +1 -1
  31. package/out/renderer/assets/{diagram-VNBRO52H-h05aP0kj.js → diagram-VNBRO52H-DCw5Q7wP.js} +1 -1
  32. package/out/renderer/assets/{erDiagram-Q7BY3M3F-COWNfcj7.js → erDiagram-Q7BY3M3F-DydOJlV1.js} +1 -1
  33. package/out/renderer/assets/{error-boundary-C1A2ZHOy.js → error-boundary-D5FC12NQ.js} +1 -1
  34. package/out/renderer/assets/{flowDiagram-4HSFHLVR-C8kw1nUn.js → flowDiagram-4HSFHLVR-tjmZgsvp.js} +1 -1
  35. package/out/renderer/assets/{ganttDiagram-APWFNJXF-CKi9B5Vf.js → ganttDiagram-APWFNJXF-DtZ_cEpz.js} +1 -1
  36. package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-D31lBYch.js → gitGraphDiagram-7IBYFJ6S-CgukFz4_.js} +1 -1
  37. package/out/renderer/assets/{graph-DBBfeuzn.js → graph-Buoe5j9V.js} +1 -1
  38. package/out/renderer/assets/{hash-DlI0KZAR.js → hash-BZKl5Bte.js} +1 -1
  39. package/out/renderer/assets/{heart-Bzjo4B8d.js → heart-B9-eKwhZ.js} +1 -1
  40. package/out/renderer/assets/{index-C0MluhOY.js → index-0-CzoNW3.js} +1 -1
  41. package/out/renderer/assets/{index-DODZOUVR.js → index-BdGQAMVE.js} +1 -1
  42. package/out/renderer/assets/{index-B-_5p-wE.js → index-CDGKiohP.js} +1 -1
  43. package/out/renderer/assets/{index-BrOI6Fl4.js → index-Cv-3KYtb.js} +4 -4
  44. package/out/renderer/assets/infoDiagram-PH2N3AL5-ytHki6Qw.js +2 -0
  45. package/out/renderer/assets/{installer-DB5XOrcz.js → installer-GFv4iSAS.js} +1 -1
  46. package/out/renderer/assets/{journeyDiagram-U35MCT3I-dewtG8N1.js → journeyDiagram-U35MCT3I-_pSxP3ro.js} +1 -1
  47. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-CzAAi293.js → kanban-definition-NDS4AKOZ-BM6cKt4-.js} +1 -1
  48. package/out/renderer/assets/{layout-C9rKkr_l.js → layout-BOfiVv9T.js} +1 -1
  49. package/out/renderer/assets/{legacy-agents-page-DXgslw2C.js → legacy-agents-page-jlqw07-Y.js} +1 -1
  50. package/out/renderer/assets/{library-page-CziLtskI.js → library-page-_rVwXKLD.js} +3 -3
  51. package/out/renderer/assets/{mermaid.core-keBJS-Du.js → mermaid.core-ClIahLAs.js} +5 -5
  52. package/out/renderer/assets/{mesh-page-zA7PSAdP.js → mesh-page-CSJUTsDr.js} +1 -1
  53. package/out/renderer/assets/{messages-CTFN8JZ3.js → messages-C8-2GbIi.js} +8 -8
  54. package/out/renderer/assets/{mindmap-definition-ALO5MXBD-DUGwzRo4.js → mindmap-definition-ALO5MXBD-BsVdb6cp.js} +1 -1
  55. package/out/renderer/assets/{mini-Bu_oiI40.js → mini-BMtQ9Lkr.js} +1 -1
  56. package/out/renderer/assets/{notebook-pen-UVm_KjKh.js → notebook-pen-BwmrCIfc.js} +1 -1
  57. package/out/renderer/assets/{notifications-page-iWrkrYaU.js → notifications-page-B729U7op.js} +1 -1
  58. package/out/renderer/assets/{org-access-BO64ehdB.js → org-access-MXi-ayKi.js} +1 -1
  59. package/out/renderer/assets/{org-surface-gate-a5Qany13.js → org-surface-gate-D2TGUr_k.js} +1 -1
  60. package/out/renderer/assets/{page-header-B47gwfoq.js → page-header-CYA98CDY.js} +1 -1
  61. package/out/renderer/assets/{path-utils-FHeQsOkm.js → path-utils-B1vHQIA7.js} +2 -2
  62. package/out/renderer/assets/{pieDiagram-IB7DONF6-4f4GlgfK.js → pieDiagram-IB7DONF6-DBifbHS2.js} +1 -1
  63. package/out/renderer/assets/{project-markdown-CXVp0jYO.js → project-markdown-C5tsMBN9.js} +1 -1
  64. package/out/renderer/assets/{projects-page-DcXtxilr.js → projects-page-C4D1kzXC.js} +1 -1
  65. package/out/renderer/assets/{publication-validation-CW1Ts4et.js → publication-validation-BHfINGe5.js} +1 -1
  66. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-oeNudzvM.js → quadrantDiagram-7GDLP6J5-ObWGbTx0.js} +1 -1
  67. package/out/renderer/assets/{radar-MK3ICKWK-B52IcRND.js → radar-MK3ICKWK-BNPcd31u.js} +1 -1
  68. package/out/renderer/assets/{radient-auth-buttons-CPXkUr4k.js → radient-auth-buttons-DOmqmcac.js} +1 -1
  69. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-BpXhtKho.js → requirementDiagram-KVF5MWMF-BXhgwQb6.js} +1 -1
  70. package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-AneBCPnQ.js → sankeyDiagram-QLVOVGJD-BPMf0ga7.js} +1 -1
  71. package/out/renderer/assets/{schedules-page-BMPLalLJ.js → schedules-page-Dd3hncVY.js} +1 -1
  72. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-DgoNf4Rl.js → sequenceDiagram-X6HHIX6F-S0uTsYCL.js} +1 -1
  73. package/out/renderer/assets/{settings-page-CqgeDbXv.js → settings-page-B3UQ-sk7.js} +1 -1
  74. package/out/renderer/assets/{smartart-pyUKQRlk.js → smartart-ByuvZpfQ.js} +1 -1
  75. package/out/renderer/assets/{stateDiagram-DGXRK772-D9s0Uwb6.js → stateDiagram-DGXRK772-DAO1wv3D.js} +1 -1
  76. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-3I3dw3vM.js +1 -0
  77. package/out/renderer/assets/{team-bridge-page-DpjePvaY.js → team-bridge-page-B3cJUwc3.js} +11 -11
  78. package/out/renderer/assets/{timeline-definition-BDJGKUSR-BekNHywI.js → timeline-definition-BDJGKUSR-D5pYxzeA.js} +1 -1
  79. package/out/renderer/assets/{use-default-on-banner-CcjjyYQa.js → use-default-on-banner-Du-6qrfi.js} +1 -1
  80. package/out/renderer/assets/{use-download-agent-mutation-CjF3QE5Y.js → use-download-agent-mutation-Cy6vJ9vj.js} +1 -1
  81. package/out/renderer/assets/{use-session-snapshot-g7NYa7d8.js → use-session-snapshot-kufwX3B1.js} +1 -1
  82. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-ByEGNUFa.js → xychartDiagram-VJFVF3MP-FG8Nkkrm.js} +1 -1
  83. package/out/renderer/browser-approvals-overlay.html +2 -2
  84. package/out/renderer/console-capture.html +5 -5
  85. package/out/renderer/index.html +7 -7
  86. package/out/renderer/installer.html +4 -4
  87. package/out/renderer/mini.html +7 -7
  88. package/package.json +2 -2
  89. package/out/renderer/assets/browser-page-BG4iVV2q.js +0 -1
  90. package/out/renderer/assets/channel-DQ-yu_TV.js +0 -1
  91. package/out/renderer/assets/classDiagram-GIVACNV2-BwBOpbi1.js +0 -1
  92. package/out/renderer/assets/classDiagram-v2-COTLJTTW-BwBOpbi1.js +0 -1
  93. package/out/renderer/assets/clone-Bo7vSroX.js +0 -1
  94. package/out/renderer/assets/infoDiagram-PH2N3AL5-CoW1-CfI.js +0 -2
  95. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-YMTFT4eQ.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as S,j as qf,b as Ma,D as ep}from"./index-C0MluhOY.js";import{t as h,a as tp}from"./messages-CTFN8JZ3.js";var Rr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},on=typeof window>"u"||"Deno"in globalThis;function Xe(){}function np(e,t){return typeof e=="function"?e(t):e}function Cs(e){return typeof e=="number"&&e>=0&&e!==1/0}function Gl(e,t){return Math.max(e+(t||0)-Date.now(),0)}function kn(e,t){return typeof e=="function"?e(t):e}function ot(e,t){return typeof e=="function"?e(t):e}function Da(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:a,stale:c}=e;if(a){if(r){if(t.queryHash!==wo(a,t.options))return!1}else if(!ir(t.queryKey,a))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof c=="boolean"&&t.isStale()!==c||i&&i!==t.state.fetchStatus||s&&!s(t))}function Na(e,t){const{exact:n,status:r,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(rr(t.options.mutationKey)!==rr(s))return!1}else if(!ir(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function wo(e,t){return(t?.queryKeyHashFn||rr)(e)}function rr(e){return JSON.stringify(e,(t,n)=>Os(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function ir(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>ir(e[n],t[n])):!1}function Hl(e,t){if(e===t)return e;const n=La(e)&&La(t);if(n||Os(e)&&Os(t)){const r=n?e:Object.keys(e),i=r.length,s=n?t:Object.keys(t),a=s.length,c=n?[]:{};let l=0;for(let d=0;d<a;d++){const u=n?d:s[d];(!n&&r.includes(u)||n)&&e[u]===void 0&&t[u]===void 0?(c[u]=void 0,l++):(c[u]=Hl(e[u],t[u]),c[u]===e[u]&&e[u]!==void 0&&l++)}return i===a&&l===i?e:c}return t}function As(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function La(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Os(e){if(!$a(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!$a(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function $a(e){return Object.prototype.toString.call(e)==="[object Object]"}function rp(e){return new Promise(t=>{setTimeout(t,e)})}function Ps(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Hl(e,t):t}function ip(e){return e}function sp(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function op(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var So=Symbol();function Wl(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===So?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var ap=class extends Rr{#t;#e;#n;constructor(){super(),this.#n=e=>{if(!on&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#t!==e&&(this.#t=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},ko=new ap,cp=class extends Rr{#t=!0;#e;#n;constructor(){super(),this.#n=e=>{if(!on&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(this.setOnline.bind(this))}setOnline(e){this.#t!==e&&(this.#t=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#t}},ri=new cp;function js(){let e,t;const n=new Promise((i,s)=>{e=i,t=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}function lp(e){return Math.min(1e3*2**e,3e4)}function zl(e){return(e??"online")==="online"?ri.isOnline():!0}var Zl=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Ki(e){return e instanceof Zl}function Kl(e){let t=!1,n=0,r=!1,i;const s=js(),a=m=>{r||(p(new Zl(m)),e.abort?.())},c=()=>{t=!0},l=()=>{t=!1},d=()=>ko.isFocused()&&(e.networkMode==="always"||ri.isOnline())&&e.canRun(),u=()=>zl(e.networkMode)&&e.canRun(),f=m=>{r||(r=!0,e.onSuccess?.(m),i?.(),s.resolve(m))},p=m=>{r||(r=!0,e.onError?.(m),i?.(),s.reject(m))},g=()=>new Promise(m=>{i=b=>{(r||d())&&m(b)},e.onPause?.()}).then(()=>{i=void 0,r||e.onContinue?.()}),y=()=>{if(r)return;let m;const b=n===0?e.initialPromise:void 0;try{m=b??e.fn()}catch(_){m=Promise.reject(_)}Promise.resolve(m).then(f).catch(_=>{if(r)return;const k=e.retry??(on?0:3),E=e.retryDelay??lp,A=typeof E=="function"?E(n,_):E,$=k===!0||typeof k=="number"&&n<k||typeof k=="function"&&k(n,_);if(t||!$){p(_);return}n++,e.onFail?.(n,_),rp(A).then(()=>d()?void 0:g()).then(()=>{t?p(_):y()})})};return{promise:s,cancel:a,continue:()=>(i?.(),s),cancelRetry:c,continueRetry:l,canStart:u,start:()=>(u()?y():g().then(y),s)}}var dp=e=>setTimeout(e,0);function up(){let e=[],t=0,n=c=>{c()},r=c=>{c()},i=dp;const s=c=>{t?e.push(c):i(()=>{n(c)})},a=()=>{const c=e;e=[],c.length&&i(()=>{r(()=>{c.forEach(l=>{n(l)})})})};return{batch:c=>{let l;t++;try{l=c()}finally{t--,t||a()}return l},batchCalls:c=>(...l)=>{s(()=>{c(...l)})},schedule:s,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{r=c},setScheduler:c=>{i=c}}}var De=up(),Vl=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Cs(this.gcTime)&&(this.#t=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(on?1/0:5*60*1e3))}clearGcTimeout(){this.#t&&(clearTimeout(this.#t),this.#t=void 0)}},fp=class extends Vl{#t;#e;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=pp(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=Ps(this.state.data,e,this.options);return this.#s({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(Xe).catch(Xe):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(e=>ot(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===So||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!Gl(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}fetch(e,t){if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){const c=this.observers.find(l=>l.options.queryFn);c&&this.setOptions(c.options)}const n=new AbortController,r=c=>{Object.defineProperty(c,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{const c=Wl(this.options,t),l={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(l),this.#o=!1,this.options.persister?this.options.persister(c,l,this):c(l)},s={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};r(s),this.options.behavior?.onFetch(s,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&this.#s({type:"fetch",meta:s.fetchOptions?.meta});const a=c=>{Ki(c)&&c.silent||this.#s({type:"error",error:c}),Ki(c)||(this.#n.config.onError?.(c,this),this.#n.config.onSettled?.(this.state.data,c,this)),this.scheduleGc()};return this.#i=Kl({initialPromise:t?.initialPromise,fn:s.fetchFn,abort:n.abort.bind(n),onSuccess:c=>{if(c===void 0){a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(c)}catch(l){a(l);return}this.#n.config.onSuccess?.(c,this),this.#n.config.onSettled?.(c,this.state.error,this),this.scheduleGc()},onError:a,onFail:(c,l)=>{this.#s({type:"failed",failureCount:c,error:l})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0}),this.#i.start()}#s(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Yl(n.data,this.options),fetchMeta:e.meta??null};case"success":return{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const r=e.error;return Ki(r)&&r.revert&&this.#e?{...this.#e,fetchStatus:"idle"}:{...n,error:r,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),De.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Yl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:zl(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function pp(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var hp=class extends Rr{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,t,n){const r=t.queryKey,i=t.queryHash??wo(r,t);let s=this.get(i);return s||(s=new fp({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(s)),s}add(e){this.#t.has(e.queryHash)||(this.#t.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#t.get(e.queryHash);t&&(e.destroy(),t===e&&this.#t.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){De.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#t.get(e)}getAll(){return[...this.#t.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>Da(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>Da(e,n)):t}notify(e){De.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){De.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){De.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},mp=class extends Vl{#t;#e;#n;constructor(e){super(),this.mutationId=e.mutationId,this.#e=e.mutationCache,this.#t=[],this.state=e.state||gp(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#e.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#e.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#e.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){this.#n=Kl({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(r,i)=>{this.#r({type:"failed",failureCount:r,error:i})},onPause:()=>{this.#r({type:"pause"})},onContinue:()=>{this.#r({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#e.canRun(this)});const t=this.state.status==="pending",n=!this.#n.canStart();try{if(!t){this.#r({type:"pending",variables:e,isPaused:n}),await this.#e.config.onMutate?.(e,this);const i=await this.options.onMutate?.(e);i!==this.state.context&&this.#r({type:"pending",context:i,variables:e,isPaused:n})}const r=await this.#n.start();return await this.#e.config.onSuccess?.(r,e,this.state.context,this),await this.options.onSuccess?.(r,e,this.state.context),await this.#e.config.onSettled?.(r,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(r,null,e,this.state.context),this.#r({type:"success",data:r}),r}catch(r){try{throw await this.#e.config.onError?.(r,e,this.state.context,this),await this.options.onError?.(r,e,this.state.context),await this.#e.config.onSettled?.(void 0,r,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,r,e,this.state.context),r}finally{this.#r({type:"error",error:r})}}finally{this.#e.runNext(this)}}#r(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),De.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#e.notify({mutation:this,type:"updated",action:e})})}};function gp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var _p=class extends Rr{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#e=new Map,this.#n=0}#t;#e;#n;build(e,t,n){const r=new mp({mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#t.add(e);const t=Ur(e);if(typeof t=="string"){const n=this.#e.get(t);n?n.push(e):this.#e.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){const t=Ur(e);if(typeof t=="string"){const n=this.#e.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#e.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Ur(e);if(typeof t=="string"){const r=this.#e.get(t)?.find(i=>i.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=Ur(e);return typeof t=="string"?this.#e.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){De.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>Na(t,n))}findAll(e={}){return this.getAll().filter(t=>Na(e,t))}notify(e){De.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return De.batch(()=>Promise.all(e.map(t=>t.continue().catch(Xe))))}};function Ur(e){return e.options.scope?.id}function Ua(e){return{onFetch:(t,n)=>{const r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let c={pages:[],pageParams:[]},l=0;const d=async()=>{let u=!1;const f=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},p=Wl(t.options,t.fetchOptions),g=async(y,m,b)=>{if(u)return Promise.reject();if(m==null&&y.pages.length)return Promise.resolve(y);const _={client:t.client,queryKey:t.queryKey,pageParam:m,direction:b?"backward":"forward",meta:t.options.meta};f(_);const k=await p(_),{maxPages:E}=t.options,A=b?op:sp;return{pages:A(y.pages,k,E),pageParams:A(y.pageParams,m,E)}};if(i&&s.length){const y=i==="backward",m=y?Ql:Ms,b={pages:s,pageParams:a},_=m(r,b);c=await g(b,_,y)}else{const y=e??s.length;do{const m=l===0?a[0]??r.initialPageParam:Ms(r,c);if(l>0&&m==null)break;c=await g(c,m),l++}while(l<y)}return c};t.options.persister?t.fetchFn=()=>t.options.persister?.(d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=d}}}function Ms(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ql(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function fx(e,t){return t?Ms(e,t)!=null:!1}function px(e,t){return!t||!e.getPreviousPageParam?!1:Ql(e,t)!=null}var yp=class{#t;#e;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#t=e.queryCache||new hp,this.#e=e.mutationCache||new _p,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ko.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#s=ri.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#t.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#e.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#t.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(kn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#t.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=this.#t.get(r.queryHash)?.state.data,a=np(t,s);if(a!==void 0)return this.#t.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return De.batch(()=>this.#t.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state}removeQueries(e){const t=this.#t;De.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#t;return De.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=De.batch(()=>this.#t.findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(Xe).catch(Xe)}invalidateQueries(e,t={}){return De.batch(()=>(this.#t.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=De.batch(()=>this.#t.findAll(e).filter(i=>!i.isDisabled()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Xe)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Xe)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#t.build(this,t);return n.isStaleByTime(kn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Xe).catch(Xe)}fetchInfiniteQuery(e){return e.behavior=Ua(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Xe).catch(Xe)}ensureInfiniteQueryData(e){return e.behavior=Ua(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ri.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(rr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{ir(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(rr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(r=>{ir(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=wo(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===So&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},bp=class extends Rr{constructor(e,t){super(),this.options=t,this.#t=e,this.#s=null,this.#o=js(),this.options.experimental_prefetchInRender||this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(t)}#t;#e=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#m;#f;#p;#l;#d;#c;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Fa(this.#e,this.options)?this.#u():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ds(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ds(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#v(),this.#w(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,n=this.#e;if(this.options=this.#t.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ot(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#e.setOptions(this.options),t._defaulted&&!As(this.options,t)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&Ba(this.#e,n,this.options,t)&&this.#u(),this.updateResult(),r&&(this.#e!==n||ot(this.options.enabled,this.#e)!==ot(t.enabled,this.#e)||kn(this.options.staleTime,this.#e)!==kn(t.staleTime,this.#e))&&this.#g();const i=this.#_();r&&(this.#e!==n||ot(this.options.enabled,this.#e)!==ot(t.enabled,this.#e)||i!==this.#c)&&this.#y(i)}getOptimisticResult(e){const t=this.#t.getQueryCache().build(this.#t,e),n=this.createResult(t,e);return wp(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#e.state),n}getCurrentResult(){return this.#r}trackResult(e,t){const n={};return Object.keys(e).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(r),t?.(r),e[r])})}),n}trackProp(e){this.#h.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#t.defaultQueryOptions(e),n=this.#t.getQueryCache().build(this.#t,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#u({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#u(e){this.#S();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Xe)),t}#g(){this.#v();const e=kn(this.options.staleTime,this.#e);if(on||this.#r.isStale||!Cs(e))return;const n=Gl(this.#r.dataUpdatedAt,e)+1;this.#l=setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#_(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#c=e,!(on||ot(this.options.enabled,this.#e)===!1||!Cs(this.#c)||this.#c===0)&&(this.#d=setInterval(()=>{(this.options.refetchIntervalInBackground||ko.isFocused())&&this.#u()},this.#c))}#b(){this.#g(),this.#y(this.#_())}#v(){this.#l&&(clearTimeout(this.#l),this.#l=void 0)}#w(){this.#d&&(clearInterval(this.#d),this.#d=void 0)}createResult(e,t){const n=this.#e,r=this.options,i=this.#r,s=this.#i,a=this.#a,l=e!==n?e.state:this.#n,{state:d}=e;let u={...d},f=!1,p;if(t._optimisticResults){const x=this.hasListeners(),N=!x&&Fa(e,t),F=x&&Ba(e,n,t,r);(N||F)&&(u={...u,...Yl(d.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:g,errorUpdatedAt:y,status:m}=u;p=u.data;let b=!1;if(t.placeholderData!==void 0&&p===void 0&&m==="pending"){let x;i?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(x=i.data,b=!0):x=typeof t.placeholderData=="function"?t.placeholderData(this.#p?.state.data,this.#p):t.placeholderData,x!==void 0&&(m="success",p=Ps(i?.data,x,t),f=!0)}if(t.select&&p!==void 0&&!b)if(i&&p===s?.data&&t.select===this.#m)p=this.#f;else try{this.#m=t.select,p=t.select(p),p=Ps(i?.data,p,t),this.#f=p,this.#s=null}catch(x){this.#s=x}this.#s&&(g=this.#s,p=this.#f,y=Date.now(),m="error");const _=u.fetchStatus==="fetching",k=m==="pending",E=m==="error",A=k&&_,$=p!==void 0,C={status:m,fetchStatus:u.fetchStatus,isPending:k,isSuccess:m==="success",isError:E,isInitialLoading:A,isLoading:A,data:p,dataUpdatedAt:u.dataUpdatedAt,error:g,errorUpdatedAt:y,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>l.dataUpdateCount||u.errorUpdateCount>l.errorUpdateCount,isFetching:_,isRefetching:_&&!k,isLoadingError:E&&!$,isPaused:u.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:E&&$,isStale:Eo(e,t),refetch:this.refetch,promise:this.#o};if(this.options.experimental_prefetchInRender){const x=se=>{C.status==="error"?se.reject(C.error):C.data!==void 0&&se.resolve(C.data)},N=()=>{const se=this.#o=C.promise=js();x(se)},F=this.#o;switch(F.status){case"pending":e.queryHash===n.queryHash&&x(F);break;case"fulfilled":(C.status==="error"||C.data!==F.value)&&N();break;case"rejected":(C.status!=="error"||C.error!==F.reason)&&N();break}}return C}updateResult(){const e=this.#r,t=this.createResult(this.#e,this.options);if(this.#i=this.#e.state,this.#a=this.options,this.#i.data!==void 0&&(this.#p=this.#e),As(t,e))return;this.#r=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#h.size)return!0;const s=new Set(i??this.#h);return this.options.throwOnError&&s.add("error"),Object.keys(this.#r).some(a=>{const c=a;return this.#r[c]!==e[c]&&s.has(c)})};this.#k({listeners:n()})}#S(){const e=this.#t.getQueryCache().build(this.#t,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#k(e){De.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function vp(e,t){return ot(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Fa(e,t){return vp(e,t)||e.state.data!==void 0&&Ds(e,t,t.refetchOnMount)}function Ds(e,t,n){if(ot(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Eo(e,t)}return!1}function Ba(e,t,n,r){return(e!==t||ot(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Eo(e,n)}function Eo(e,t){return ot(t.enabled,e)!==!1&&e.isStaleByTime(kn(t.staleTime,e))}function wp(e,t){return!As(e.getCurrentResult(),t)}var xo=S.createContext(void 0),Sp=e=>{const t=S.useContext(xo);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},hx=({client:e,children:t})=>(S.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),qf.jsx(xo.Provider,{value:e,children:t})),Jl=S.createContext(!1),kp=()=>S.useContext(Jl);Jl.Provider;function Ep(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var xp=S.createContext(Ep()),Ip=()=>S.useContext(xp);function Rp(e,t){return typeof e=="function"?e(...t):!!e}function Ga(){}var Tp=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Cp=e=>{S.useEffect(()=>{e.clearReset()},[e])},Ap=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Rp(n,[e.error,r])),Op=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},Pp=(e,t)=>e.isLoading&&e.isFetching&&!t,jp=(e,t)=>e?.suspense&&t.isPending,Ha=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Mp(e,t,n){const r=Sp(n),i=kp(),s=Ip(),a=r.defaultQueryOptions(e);r.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=i?"isRestoring":"optimistic",Op(a),Tp(a,s),Cp(s);const c=!r.getQueryCache().get(a.queryHash),[l]=S.useState(()=>new t(r,a)),d=l.getOptimisticResult(a),u=!i&&e.subscribed!==!1;if(S.useSyncExternalStore(S.useCallback(f=>{const p=u?l.subscribe(De.batchCalls(f)):Ga;return l.updateResult(),p},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),S.useEffect(()=>{l.setOptions(a)},[a,l]),jp(a,d))throw Ha(a,l,s);if(Ap({result:d,errorResetBoundary:s,throwOnError:a.throwOnError,query:r.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw d.error;return r.getDefaultOptions().queries?._experimental_afterQuery?.(a,d),a.experimental_prefetchInRender&&!on&&Pp(d,i)&&(c?Ha(a,l,s):r.getQueryCache().get(a.queryHash)?.promise)?.catch(Ga).finally(()=>{l.updateResult()}),a.notifyOnChangeProps?d:l.trackResult(d)}function Xl(e,t){return Mp(e,bp,t)}const Dp=()=>{const e=S.useContext(xo)??null,t=S.useMemo(()=>new yp({defaultOptions:{queries:{enabled:!1,retry:!1,gcTime:0}}}),[]);return S.useEffect(()=>{if(!e)return()=>t.clear()},[e,t]),S.useMemo(()=>e?{client:e,provided:!0}:{client:t,provided:!1},[e,t])};function mx(e){return e!=="detached"&&e!=="wedged"}function ql(e){return e!=="governed-elsewhere"&&e!=="pre-handshake"}function gx(e){if(!e)return{title:"Not connected to a Local Operator server.",detail:null,retry:!0};const t=e.addressSubstitution??null;if(t&&e.state!=="detached"&&e.state!=="wedged")return t.kind==="substituted"?{title:`Serving on ${t.serving}, not the address this app is configured for.`,detail:t.holder?`${t.holder}. The app uses ${t.serving} while that holds.${t.reclaim?` ${t.reclaim}`:""} It is back on ${t.configured} on its next launch or recovery.`:`The daemon this app is using was already running, so it did not start one. It looks for ${t.configured} again on its next launch or recovery.`,retry:!0}:{title:`Back on ${t.configured}, the address this app is configured for.`,detail:`It served on ${t.serving} while the configured address was held; it is on the address it was told to use again.`,retry:!1,dismiss:!0};const n=e.detail?.trim()?e.detail.trim():null,r=ql(e.pairing?.cause??null);switch(e.state){case"wedged":return{title:"A Local Operator server is running on this machine and this app is not attached to it.",detail:n,retry:r};case"detached":return e.reconnecting?{title:r?"Not connected to a Local Operator server. If one is still running, the app reconnects to it on its own.":"Not connected to a Local Operator server.",detail:n,retry:r}:{title:r?"The Local Operator server stopped. The app keeps looking for one and attaches to it when it appears.":"Not connected to a Local Operator server. The app keeps looking for one.",detail:n,retry:r};default:return null}}var re;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const s={};for(const a of i)s[a]=a;return s},e.getValidEnumValues=i=>{const s=e.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),a={};for(const c of s)a[c]=i[c];return e.objectValues(a)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&s.push(a);return s},e.find=(i,s)=>{for(const a of i)if(s(a))return a},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(re||(re={}));var Ns;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Ns||(Ns={}));const M=re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),kt=e=>{switch(typeof e){case"undefined":return M.undefined;case"string":return M.string;case"number":return isNaN(e)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":return Array.isArray(e)?M.array:e===null?M.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?M.promise:typeof Map<"u"&&e instanceof Map?M.map:typeof Set<"u"&&e instanceof Set?M.set:typeof Date<"u"&&e instanceof Date?M.date:M.object;default:return M.unknown}},R=re.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Np=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Ye extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(s){return s.message},r={_errors:[]},i=s=>{for(const a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let c=r,l=0;for(;l<a.path.length;){const d=a.path[l];l===a.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(n(a))):c[d]=c[d]||{_errors:[]},c=c[d],l++}}};return i(this),r}static assert(t){if(!(t instanceof Ye))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,re.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ye.create=e=>new Ye(e);const Tn=(e,t)=>{let n;switch(e.code){case R.invalid_type:e.received===M.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case R.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,re.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:n=`Unrecognized key(s) in object: ${re.joinValues(e.keys,", ")}`;break;case R.invalid_union:n="Invalid input";break;case R.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${re.joinValues(e.options)}`;break;case R.invalid_enum_value:n=`Invalid enum value. Expected ${re.joinValues(e.options)}, received '${e.received}'`;break;case R.invalid_arguments:n="Invalid function arguments";break;case R.invalid_return_type:n="Invalid function return type";break;case R.invalid_date:n="Invalid date";break;case R.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:re.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case R.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case R.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case R.custom:n="Invalid input";break;case R.invalid_intersection_types:n="Intersection results could not be merged";break;case R.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case R.not_finite:n="Number must be finite";break;default:n=t.defaultError,re.assertNever(e)}return{message:n}};let ed=Tn;function Lp(e){ed=e}function ii(){return ed}const si=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],a={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let c="";const l=r.filter(d=>!!d).slice().reverse();for(const d of l)c=d(a,{data:t,defaultError:c}).message;return{...i,path:s,message:c}},$p=[];function j(e,t){const n=ii(),r=si({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Tn?void 0:Tn].filter(i=>!!i)});e.common.issues.push(r)}class $e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return z;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const s=await i.key,a=await i.value;r.push({key:s,value:a})}return $e.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:s,value:a}=i;if(s.status==="aborted"||a.status==="aborted")return z;s.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(r[s.value]=a.value)}return{status:t.value,value:r}}}const z=Object.freeze({status:"aborted"}),vn=e=>({status:"dirty",value:e}),Ue=e=>({status:"valid",value:e}),Ls=e=>e.status==="aborted",$s=e=>e.status==="dirty",an=e=>e.status==="valid",sr=e=>typeof Promise<"u"&&e instanceof Promise;function oi(e,t,n,r){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function td(e,t,n,r,i){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var U;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(U||(U={}));var Kn,Vn;class gt{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Wa=(e,t)=>{if(an(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ye(e.common.issues);return this._error=n,this._error}}};function J(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(a,c)=>{var l,d;const{message:u}=e;return a.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:(l=u??r)!==null&&l!==void 0?l:c.defaultError}:a.code!=="invalid_type"?{message:c.defaultError}:{message:(d=u??n)!==null&&d!==void 0?d:c.defaultError}},description:i}}class X{get description(){return this._def.description}_getType(t){return kt(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:kt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new $e,ctx:{common:t.parent.common,data:t.data,parsedType:kt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(sr(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const i={common:{issues:[],async:(r=n?.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:kt(t)},s=this._parseSync({data:t,path:i.path,parent:i});return Wa(i,s)}"~validate"(t){var n,r;const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:kt(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:i});return an(s)?{value:s.value}:{issues:i.common.issues}}catch(s){!((r=(n=s?.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:i}).then(s=>an(s)?{value:s.value}:{issues:i.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:kt(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(sr(i)?i:Promise.resolve(i));return Wa(r,s)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const a=t(i),c=()=>s.addIssue({code:R.custom,...r(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(c(),!1)):a?!0:(c(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new lt({schema:this,typeName:H.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return ht.create(this,this._def)}nullable(){return Gt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ct.create(this)}promise(){return An.create(this,this._def)}or(t){return lr.create([this,t],this._def)}and(t){return dr.create(this,t,this._def)}transform(t){return new lt({...J(this._def),schema:this,typeName:H.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new mr({...J(this._def),innerType:this,defaultValue:n,typeName:H.ZodDefault})}brand(){return new Io({typeName:H.ZodBranded,type:this,...J(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new gr({...J(this._def),innerType:this,catchValue:n,typeName:H.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Tr.create(this,t)}readonly(){return _r.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Up=/^c[^\s-]{8,}$/i,Fp=/^[0-9a-z]+$/,Bp=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Gp=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Hp=/^[a-z0-9_-]{21}$/i,Wp=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,zp=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Zp=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Kp="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Vi;const Vp=/^(?:(?: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])$/,Yp=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Qp=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Jp=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Xp=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qp=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nd="((\\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])))",eh=new RegExp(`^${nd}$`);function rd(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function th(e){return new RegExp(`^${rd(e)}$`)}function id(e){let t=`${nd}T${rd(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function nh(e,t){return!!((t==="v4"||!t)&&Vp.test(e)||(t==="v6"||!t)&&Qp.test(e))}function rh(e,t){if(!Wp.test(e))return!1;try{const[n]=e.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||!i.typ||!i.alg||t&&i.alg!==t)}catch{return!1}}function ih(e,t){return!!((t==="v4"||!t)&&Yp.test(e)||(t==="v6"||!t)&&Jp.test(e))}class at extends X{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==M.string){const s=this._getOrReturnCtx(t);return j(s,{code:R.invalid_type,expected:M.string,received:s.parsedType}),z}const r=new $e;let i;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),j(i,{code:R.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),j(i,{code:R.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const a=t.data.length>s.value,c=t.data.length<s.value;(a||c)&&(i=this._getOrReturnCtx(t,i),a?j(i,{code:R.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&j(i,{code:R.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Zp.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"email",code:R.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Vi||(Vi=new RegExp(Kp,"u")),Vi.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"emoji",code:R.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")Gp.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"uuid",code:R.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")Hp.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"nanoid",code:R.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")Up.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"cuid",code:R.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")Fp.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"cuid2",code:R.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")Bp.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"ulid",code:R.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),j(i,{validation:"url",code:R.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"regex",code:R.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),j(i,{code:R.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),j(i,{code:R.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),j(i,{code:R.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?id(s).test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{code:R.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?eh.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{code:R.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?th(s).test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{code:R.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?zp.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"duration",code:R.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?nh(t.data,s.version)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"ip",code:R.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?rh(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"jwt",code:R.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?ih(t.data,s.version)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"cidr",code:R.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?Xp.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"base64",code:R.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?qp.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"base64url",code:R.invalid_string,message:s.message}),r.dirty()):re.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:R.invalid_string,...U.errToObj(r)})}_addCheck(t){return new at({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...U.errToObj(t)})}url(t){return this._addCheck({kind:"url",...U.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...U.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...U.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...U.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...U.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...U.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...U.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...U.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...U.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...U.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...U.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...U.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(n=t?.offset)!==null&&n!==void 0?n:!1,local:(r=t?.local)!==null&&r!==void 0?r:!1,...U.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...U.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...U.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...U.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...U.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...U.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...U.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...U.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...U.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...U.errToObj(n)})}nonempty(t){return this.min(1,U.errToObj(t))}trim(){return new at({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new at({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new at({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}at.create=e=>{var t;return new at({checks:[],typeName:H.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...J(e)})};function sh(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,s=parseInt(e.toFixed(i).replace(".","")),a=parseInt(t.toFixed(i).replace(".",""));return s%a/Math.pow(10,i)}class Ut extends X{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==M.number){const s=this._getOrReturnCtx(t);return j(s,{code:R.invalid_type,expected:M.number,received:s.parsedType}),z}let r;const i=new $e;for(const s of this._def.checks)s.kind==="int"?re.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{code:R.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),j(r,{code:R.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),j(r,{code:R.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?sh(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),j(r,{code:R.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{code:R.not_finite,message:s.message}),i.dirty()):re.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,U.toString(n))}gt(t,n){return this.setLimit("min",t,!1,U.toString(n))}lte(t,n){return this.setLimit("max",t,!0,U.toString(n))}lt(t,n){return this.setLimit("max",t,!1,U.toString(n))}setLimit(t,n,r,i){return new Ut({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:U.toString(i)}]})}_addCheck(t){return new Ut({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:U.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:U.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:U.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:U.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:U.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:U.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:U.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:U.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:U.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&re.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Ut.create=e=>new Ut({checks:[],typeName:H.ZodNumber,coerce:e?.coerce||!1,...J(e)});class Ft extends X{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==M.bigint)return this._getInvalidInput(t);let r;const i=new $e;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),j(r,{code:R.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),j(r,{code:R.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),j(r,{code:R.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):re.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return j(n,{code:R.invalid_type,expected:M.bigint,received:n.parsedType}),z}gte(t,n){return this.setLimit("min",t,!0,U.toString(n))}gt(t,n){return this.setLimit("min",t,!1,U.toString(n))}lte(t,n){return this.setLimit("max",t,!0,U.toString(n))}lt(t,n){return this.setLimit("max",t,!1,U.toString(n))}setLimit(t,n,r,i){return new Ft({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:U.toString(i)}]})}_addCheck(t){return new Ft({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:U.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:U.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:U.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:U.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:U.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Ft.create=e=>{var t;return new Ft({checks:[],typeName:H.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...J(e)})};class or extends X{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==M.boolean){const r=this._getOrReturnCtx(t);return j(r,{code:R.invalid_type,expected:M.boolean,received:r.parsedType}),z}return Ue(t.data)}}or.create=e=>new or({typeName:H.ZodBoolean,coerce:e?.coerce||!1,...J(e)});class cn extends X{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==M.date){const s=this._getOrReturnCtx(t);return j(s,{code:R.invalid_type,expected:M.date,received:s.parsedType}),z}if(isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return j(s,{code:R.invalid_date}),z}const r=new $e;let i;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),j(i,{code:R.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),j(i,{code:R.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):re.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new cn({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:U.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:U.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}cn.create=e=>new cn({checks:[],coerce:e?.coerce||!1,typeName:H.ZodDate,...J(e)});class ai extends X{_parse(t){if(this._getType(t)!==M.symbol){const r=this._getOrReturnCtx(t);return j(r,{code:R.invalid_type,expected:M.symbol,received:r.parsedType}),z}return Ue(t.data)}}ai.create=e=>new ai({typeName:H.ZodSymbol,...J(e)});class ar extends X{_parse(t){if(this._getType(t)!==M.undefined){const r=this._getOrReturnCtx(t);return j(r,{code:R.invalid_type,expected:M.undefined,received:r.parsedType}),z}return Ue(t.data)}}ar.create=e=>new ar({typeName:H.ZodUndefined,...J(e)});class cr extends X{_parse(t){if(this._getType(t)!==M.null){const r=this._getOrReturnCtx(t);return j(r,{code:R.invalid_type,expected:M.null,received:r.parsedType}),z}return Ue(t.data)}}cr.create=e=>new cr({typeName:H.ZodNull,...J(e)});class Cn extends X{constructor(){super(...arguments),this._any=!0}_parse(t){return Ue(t.data)}}Cn.create=e=>new Cn({typeName:H.ZodAny,...J(e)});class tn extends X{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ue(t.data)}}tn.create=e=>new tn({typeName:H.ZodUnknown,...J(e)});class xt extends X{_parse(t){const n=this._getOrReturnCtx(t);return j(n,{code:R.invalid_type,expected:M.never,received:n.parsedType}),z}}xt.create=e=>new xt({typeName:H.ZodNever,...J(e)});class ci extends X{_parse(t){if(this._getType(t)!==M.undefined){const r=this._getOrReturnCtx(t);return j(r,{code:R.invalid_type,expected:M.void,received:r.parsedType}),z}return Ue(t.data)}}ci.create=e=>new ci({typeName:H.ZodVoid,...J(e)});class ct extends X{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==M.array)return j(n,{code:R.invalid_type,expected:M.array,received:n.parsedType}),z;if(i.exactLength!==null){const a=n.data.length>i.exactLength.value,c=n.data.length<i.exactLength.value;(a||c)&&(j(n,{code:a?R.too_big:R.too_small,minimum:c?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(j(n,{code:R.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(j(n,{code:R.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,c)=>i.type._parseAsync(new gt(n,a,n.path,c)))).then(a=>$e.mergeArray(r,a));const s=[...n.data].map((a,c)=>i.type._parseSync(new gt(n,a,n.path,c)));return $e.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new ct({...this._def,minLength:{value:t,message:U.toString(n)}})}max(t,n){return new ct({...this._def,maxLength:{value:t,message:U.toString(n)}})}length(t,n){return new ct({...this._def,exactLength:{value:t,message:U.toString(n)}})}nonempty(t){return this.min(1,t)}}ct.create=(e,t)=>new ct({type:e,minLength:null,maxLength:null,exactLength:null,typeName:H.ZodArray,...J(t)});function _n(e){if(e instanceof we){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ht.create(_n(r))}return new we({...e._def,shape:()=>t})}else return e instanceof ct?new ct({...e._def,type:_n(e.element)}):e instanceof ht?ht.create(_n(e.unwrap())):e instanceof Gt?Gt.create(_n(e.unwrap())):e instanceof _t?_t.create(e.items.map(t=>_n(t))):e}class we extends X{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=re.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==M.object){const d=this._getOrReturnCtx(t);return j(d,{code:R.invalid_type,expected:M.object,received:d.parsedType}),z}const{status:r,ctx:i}=this._processInputParams(t),{shape:s,keys:a}=this._getCached(),c=[];if(!(this._def.catchall instanceof xt&&this._def.unknownKeys==="strip"))for(const d in i.data)a.includes(d)||c.push(d);const l=[];for(const d of a){const u=s[d],f=i.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new gt(i,f,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof xt){const d=this._def.unknownKeys;if(d==="passthrough")for(const u of c)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(d==="strict")c.length>0&&(j(i,{code:R.unrecognized_keys,keys:c}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const u of c){const f=i.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new gt(i,f,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const d=[];for(const u of l){const f=await u.key,p=await u.value;d.push({key:f,value:p,alwaysSet:u.alwaysSet})}return d}).then(d=>$e.mergeObjectSync(r,d)):$e.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return U.errToObj,new we({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,s,a,c;const l=(a=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,n,r).message)!==null&&a!==void 0?a:r.defaultError;return n.code==="unrecognized_keys"?{message:(c=U.errToObj(t).message)!==null&&c!==void 0?c:l}:{message:l}}}:{}})}strip(){return new we({...this._def,unknownKeys:"strip"})}passthrough(){return new we({...this._def,unknownKeys:"passthrough"})}extend(t){return new we({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new we({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:H.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new we({...this._def,catchall:t})}pick(t){const n={};return re.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new we({...this._def,shape:()=>n})}omit(t){const n={};return re.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new we({...this._def,shape:()=>n})}deepPartial(){return _n(this)}partial(t){const n={};return re.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}),new we({...this._def,shape:()=>n})}required(t){const n={};return re.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof ht;)s=s._def.innerType;n[r]=s}}),new we({...this._def,shape:()=>n})}keyof(){return sd(re.objectKeys(this.shape))}}we.create=(e,t)=>new we({shape:()=>e,unknownKeys:"strip",catchall:xt.create(),typeName:H.ZodObject,...J(t)});we.strictCreate=(e,t)=>new we({shape:()=>e,unknownKeys:"strict",catchall:xt.create(),typeName:H.ZodObject,...J(t)});we.lazycreate=(e,t)=>new we({shape:e,unknownKeys:"strip",catchall:xt.create(),typeName:H.ZodObject,...J(t)});class lr extends X{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(s){for(const c of s)if(c.result.status==="valid")return c.result;for(const c of s)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const a=s.map(c=>new Ye(c.ctx.common.issues));return j(n,{code:R.invalid_union,unionErrors:a}),z}if(n.common.async)return Promise.all(r.map(async s=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(i);{let s;const a=[];for(const l of r){const d={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const c=a.map(l=>new Ye(l));return j(n,{code:R.invalid_union,unionErrors:c}),z}}get options(){return this._def.options}}lr.create=(e,t)=>new lr({options:e,typeName:H.ZodUnion,...J(t)});const wt=e=>e instanceof fr?wt(e.schema):e instanceof lt?wt(e.innerType()):e instanceof pr?[e.value]:e instanceof Bt?e.options:e instanceof hr?re.objectValues(e.enum):e instanceof mr?wt(e._def.innerType):e instanceof ar?[void 0]:e instanceof cr?[null]:e instanceof ht?[void 0,...wt(e.unwrap())]:e instanceof Gt?[null,...wt(e.unwrap())]:e instanceof Io||e instanceof _r?wt(e.unwrap()):e instanceof gr?wt(e._def.innerType):[];class wi extends X{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==M.object)return j(n,{code:R.invalid_type,expected:M.object,received:n.parsedType}),z;const r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(j(n,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const s of n){const a=wt(s.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const c of a){if(i.has(c))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(c)}`);i.set(c,s)}}return new wi({typeName:H.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...J(r)})}}function Us(e,t){const n=kt(e),r=kt(t);if(e===t)return{valid:!0,data:e};if(n===M.object&&r===M.object){const i=re.objectKeys(t),s=re.objectKeys(e).filter(c=>i.indexOf(c)!==-1),a={...e,...t};for(const c of s){const l=Us(e[c],t[c]);if(!l.valid)return{valid:!1};a[c]=l.data}return{valid:!0,data:a}}else if(n===M.array&&r===M.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let s=0;s<e.length;s++){const a=e[s],c=t[s],l=Us(a,c);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===M.date&&r===M.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class dr extends X{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(s,a)=>{if(Ls(s)||Ls(a))return z;const c=Us(s.value,a.value);return c.valid?(($s(s)||$s(a))&&n.dirty(),{status:n.value,value:c.data}):(j(r,{code:R.invalid_intersection_types}),z)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,a])=>i(s,a)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}dr.create=(e,t,n)=>new dr({left:e,right:t,typeName:H.ZodIntersection,...J(n)});class _t extends X{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==M.array)return j(r,{code:R.invalid_type,expected:M.array,received:r.parsedType}),z;if(r.data.length<this._def.items.length)return j(r,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),z;!this._def.rest&&r.data.length>this._def.items.length&&(j(r,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((a,c)=>{const l=this._def.items[c]||this._def.rest;return l?l._parse(new gt(r,a,r.path,c)):null}).filter(a=>!!a);return r.common.async?Promise.all(s).then(a=>$e.mergeArray(n,a)):$e.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new _t({...this._def,rest:t})}}_t.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _t({items:e,typeName:H.ZodTuple,rest:null,...J(t)})};class ur extends X{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==M.object)return j(r,{code:R.invalid_type,expected:M.object,received:r.parsedType}),z;const i=[],s=this._def.keyType,a=this._def.valueType;for(const c in r.data)i.push({key:s._parse(new gt(r,c,r.path,c)),value:a._parse(new gt(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?$e.mergeObjectAsync(n,i):$e.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof X?new ur({keyType:t,valueType:n,typeName:H.ZodRecord,...J(r)}):new ur({keyType:at.create(),valueType:t,typeName:H.ZodRecord,...J(n)})}}class li extends X{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==M.map)return j(r,{code:R.invalid_type,expected:M.map,received:r.parsedType}),z;const i=this._def.keyType,s=this._def.valueType,a=[...r.data.entries()].map(([c,l],d)=>({key:i._parse(new gt(r,c,r.path,[d,"key"])),value:s._parse(new gt(r,l,r.path,[d,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const l of a){const d=await l.key,u=await l.value;if(d.status==="aborted"||u.status==="aborted")return z;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),c.set(d.value,u.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const l of a){const d=l.key,u=l.value;if(d.status==="aborted"||u.status==="aborted")return z;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),c.set(d.value,u.value)}return{status:n.value,value:c}}}}li.create=(e,t,n)=>new li({valueType:t,keyType:e,typeName:H.ZodMap,...J(n)});class ln extends X{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==M.set)return j(r,{code:R.invalid_type,expected:M.set,received:r.parsedType}),z;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(j(r,{code:R.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(j(r,{code:R.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function a(l){const d=new Set;for(const u of l){if(u.status==="aborted")return z;u.status==="dirty"&&n.dirty(),d.add(u.value)}return{status:n.value,value:d}}const c=[...r.data.values()].map((l,d)=>s._parse(new gt(r,l,r.path,d)));return r.common.async?Promise.all(c).then(l=>a(l)):a(c)}min(t,n){return new ln({...this._def,minSize:{value:t,message:U.toString(n)}})}max(t,n){return new ln({...this._def,maxSize:{value:t,message:U.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}ln.create=(e,t)=>new ln({valueType:e,minSize:null,maxSize:null,typeName:H.ZodSet,...J(t)});class En extends X{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==M.function)return j(n,{code:R.invalid_type,expected:M.function,received:n.parsedType}),z;function r(c,l){return si({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ii(),Tn].filter(d=>!!d),issueData:{code:R.invalid_arguments,argumentsError:l}})}function i(c,l){return si({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ii(),Tn].filter(d=>!!d),issueData:{code:R.invalid_return_type,returnTypeError:l}})}const s={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof An){const c=this;return Ue(async function(...l){const d=new Ye([]),u=await c._def.args.parseAsync(l,s).catch(g=>{throw d.addIssue(r(l,g)),d}),f=await Reflect.apply(a,this,u);return await c._def.returns._def.type.parseAsync(f,s).catch(g=>{throw d.addIssue(i(f,g)),d})})}else{const c=this;return Ue(function(...l){const d=c._def.args.safeParse(l,s);if(!d.success)throw new Ye([r(l,d.error)]);const u=Reflect.apply(a,this,d.data),f=c._def.returns.safeParse(u,s);if(!f.success)throw new Ye([i(u,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new En({...this._def,args:_t.create(t).rest(tn.create())})}returns(t){return new En({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new En({args:t||_t.create([]).rest(tn.create()),returns:n||tn.create(),typeName:H.ZodFunction,...J(r)})}}class fr extends X{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}fr.create=(e,t)=>new fr({getter:e,typeName:H.ZodLazy,...J(t)});class pr extends X{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return j(n,{received:n.data,code:R.invalid_literal,expected:this._def.value}),z}return{status:"valid",value:t.data}}get value(){return this._def.value}}pr.create=(e,t)=>new pr({value:e,typeName:H.ZodLiteral,...J(t)});function sd(e,t){return new Bt({values:e,typeName:H.ZodEnum,...J(t)})}class Bt extends X{constructor(){super(...arguments),Kn.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return j(n,{expected:re.joinValues(r),received:n.parsedType,code:R.invalid_type}),z}if(oi(this,Kn)||td(this,Kn,new Set(this._def.values)),!oi(this,Kn).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return j(n,{received:n.data,code:R.invalid_enum_value,options:r}),z}return Ue(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Bt.create(t,{...this._def,...n})}exclude(t,n=this._def){return Bt.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Kn=new WeakMap;Bt.create=sd;class hr extends X{constructor(){super(...arguments),Vn.set(this,void 0)}_parse(t){const n=re.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==M.string&&r.parsedType!==M.number){const i=re.objectValues(n);return j(r,{expected:re.joinValues(i),received:r.parsedType,code:R.invalid_type}),z}if(oi(this,Vn)||td(this,Vn,new Set(re.getValidEnumValues(this._def.values))),!oi(this,Vn).has(t.data)){const i=re.objectValues(n);return j(r,{received:r.data,code:R.invalid_enum_value,options:i}),z}return Ue(t.data)}get enum(){return this._def.values}}Vn=new WeakMap;hr.create=(e,t)=>new hr({values:e,typeName:H.ZodNativeEnum,...J(t)});class An extends X{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==M.promise&&n.common.async===!1)return j(n,{code:R.invalid_type,expected:M.promise,received:n.parsedType}),z;const r=n.parsedType===M.promise?n.data:Promise.resolve(n.data);return Ue(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}An.create=(e,t)=>new An({type:e,typeName:H.ZodPromise,...J(t)});class lt extends X{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===H.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:a=>{j(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const a=i.transform(r.data,s);if(r.common.async)return Promise.resolve(a).then(async c=>{if(n.value==="aborted")return z;const l=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return l.status==="aborted"?z:l.status==="dirty"||n.value==="dirty"?vn(l.value):l});{if(n.value==="aborted")return z;const c=this._def.schema._parseSync({data:a,path:r.path,parent:r});return c.status==="aborted"?z:c.status==="dirty"||n.value==="dirty"?vn(c.value):c}}if(i.type==="refinement"){const a=c=>{const l=i.refinement(c,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?z:(c.status==="dirty"&&n.dirty(),a(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?z:(c.status==="dirty"&&n.dirty(),a(c.value).then(()=>({status:n.value,value:c.value}))))}if(i.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!an(a))return a;const c=i.transform(a.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>an(a)?Promise.resolve(i.transform(a.value,s)).then(c=>({status:n.value,value:c})):a);re.assertNever(i)}}lt.create=(e,t,n)=>new lt({schema:e,typeName:H.ZodEffects,effect:t,...J(n)});lt.createWithPreprocess=(e,t,n)=>new lt({schema:t,effect:{type:"preprocess",transform:e},typeName:H.ZodEffects,...J(n)});class ht extends X{_parse(t){return this._getType(t)===M.undefined?Ue(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ht.create=(e,t)=>new ht({innerType:e,typeName:H.ZodOptional,...J(t)});class Gt extends X{_parse(t){return this._getType(t)===M.null?Ue(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Gt.create=(e,t)=>new Gt({innerType:e,typeName:H.ZodNullable,...J(t)});class mr extends X{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===M.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}mr.create=(e,t)=>new mr({innerType:e,typeName:H.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...J(t)});class gr extends X{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return sr(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ye(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ye(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}gr.create=(e,t)=>new gr({innerType:e,typeName:H.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...J(t)});class di extends X{_parse(t){if(this._getType(t)!==M.nan){const r=this._getOrReturnCtx(t);return j(r,{code:R.invalid_type,expected:M.nan,received:r.parsedType}),z}return{status:"valid",value:t.data}}}di.create=e=>new di({typeName:H.ZodNaN,...J(e)});const oh=Symbol("zod_brand");class Io extends X{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Tr extends X{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?z:s.status==="dirty"?(n.dirty(),vn(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?z:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new Tr({in:t,out:n,typeName:H.ZodPipeline})}}class _r extends X{_parse(t){const n=this._def.innerType._parse(t),r=i=>(an(i)&&(i.value=Object.freeze(i.value)),i);return sr(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}_r.create=(e,t)=>new _r({innerType:e,typeName:H.ZodReadonly,...J(t)});function za(e,t){const n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function od(e,t={},n){return e?Cn.create().superRefine((r,i)=>{var s,a;const c=e(r);if(c instanceof Promise)return c.then(l=>{var d,u;if(!l){const f=za(t,r),p=(u=(d=f.fatal)!==null&&d!==void 0?d:n)!==null&&u!==void 0?u:!0;i.addIssue({code:"custom",...f,fatal:p})}});if(!c){const l=za(t,r),d=(a=(s=l.fatal)!==null&&s!==void 0?s:n)!==null&&a!==void 0?a:!0;i.addIssue({code:"custom",...l,fatal:d})}}):Cn.create()}const ah={object:we.lazycreate};var H;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(H||(H={}));const ch=(e,t={message:`Input not instance of ${e.name}`})=>od(n=>n instanceof e,t),ad=at.create,cd=Ut.create,lh=di.create,dh=Ft.create,ld=or.create,uh=cn.create,fh=ai.create,ph=ar.create,hh=cr.create,mh=Cn.create,gh=tn.create,_h=xt.create,yh=ci.create,bh=ct.create,vh=we.create,wh=we.strictCreate,Sh=lr.create,kh=wi.create,Eh=dr.create,xh=_t.create,Ih=ur.create,Rh=li.create,Th=ln.create,Ch=En.create,Ah=fr.create,Oh=pr.create,Ph=Bt.create,jh=hr.create,Mh=An.create,Za=lt.create,Dh=ht.create,Nh=Gt.create,Lh=lt.createWithPreprocess,$h=Tr.create,Uh=()=>ad().optional(),Fh=()=>cd().optional(),Bh=()=>ld().optional(),Gh={string:e=>at.create({...e,coerce:!0}),number:e=>Ut.create({...e,coerce:!0}),boolean:e=>or.create({...e,coerce:!0}),bigint:e=>Ft.create({...e,coerce:!0}),date:e=>cn.create({...e,coerce:!0})},Hh=z;var o=Object.freeze({__proto__:null,defaultErrorMap:Tn,setErrorMap:Lp,getErrorMap:ii,makeIssue:si,EMPTY_PATH:$p,addIssueToContext:j,ParseStatus:$e,INVALID:z,DIRTY:vn,OK:Ue,isAborted:Ls,isDirty:$s,isValid:an,isAsync:sr,get util(){return re},get objectUtil(){return Ns},ZodParsedType:M,getParsedType:kt,ZodType:X,datetimeRegex:id,ZodString:at,ZodNumber:Ut,ZodBigInt:Ft,ZodBoolean:or,ZodDate:cn,ZodSymbol:ai,ZodUndefined:ar,ZodNull:cr,ZodAny:Cn,ZodUnknown:tn,ZodNever:xt,ZodVoid:ci,ZodArray:ct,ZodObject:we,ZodUnion:lr,ZodDiscriminatedUnion:wi,ZodIntersection:dr,ZodTuple:_t,ZodRecord:ur,ZodMap:li,ZodSet:ln,ZodFunction:En,ZodLazy:fr,ZodLiteral:pr,ZodEnum:Bt,ZodNativeEnum:hr,ZodPromise:An,ZodEffects:lt,ZodTransformer:lt,ZodOptional:ht,ZodNullable:Gt,ZodDefault:mr,ZodCatch:gr,ZodNaN:di,BRAND:oh,ZodBranded:Io,ZodPipeline:Tr,ZodReadonly:_r,custom:od,Schema:X,ZodSchema:X,late:ah,get ZodFirstPartyTypeKind(){return H},coerce:Gh,any:mh,array:bh,bigint:dh,boolean:ld,date:uh,discriminatedUnion:kh,effect:Za,enum:Ph,function:Ch,instanceof:ch,intersection:Eh,lazy:Ah,literal:Oh,map:Rh,nan:lh,nativeEnum:jh,never:_h,null:hh,nullable:Nh,number:cd,object:vh,oboolean:Bh,onumber:Fh,optional:Dh,ostring:Uh,pipeline:$h,preprocess:Lh,promise:Mh,record:Ih,set:Th,strictObject:wh,string:ad,symbol:fh,transformer:Za,tuple:xh,undefined:ph,union:Sh,unknown:gh,void:yh,NEVER:Hh,ZodIssueCode:R,quotelessJson:Np,ZodError:Ye});const Ka=o.enum(["app_start","sign_in","window_focus","surface_open"]),dd=o.object({id:o.string().min(1),state:o.enum(["active","paused","disabled"])}).passthrough(),Wh=o.object({tenant_id:o.string().min(1),tenant_name:o.string().optional(),eligible:o.boolean(),endpoint:dd.nullable()}).passthrough(),zh=o.object({code:o.string(),message:o.string(),details:o.record(o.unknown()).optional(),retry_after_seconds:o.number().optional()}).passthrough(),Zh=o.object({code:o.string().min(1),count:o.number().int().nonnegative(),session:o.string().min(1).nullable().optional().catch(null)}).passthrough().nullable().optional().catch(null),Kh=o.object({in_force:o.boolean(),notice_pending:o.boolean().catch(!1)}).passthrough().optional().catch(void 0),_x=o.object({capability:o.number(),consent_account_guard:o.boolean().optional(),state:o.enum(["ready","signed_out","unavailable","update_required"]),account_id:o.string().nullable(),tenant_id:o.string().nullable(),surface_state:o.enum(["A","B","C","D","E","F","G"]).nullable(),visibility:o.object({settings:o.boolean(),inbox:o.boolean(),account_door:o.boolean(),onboarding:o.boolean()}),update_required:o.boolean(),local:o.object({enabled:o.boolean(),onboarding:o.string(),session:o.string()}),status:o.object({tenants:o.array(Wh)}).passthrough().nullable(),consent:o.object({version:o.string().min(1).max(128),text:o.string().min(1).refine(e=>new TextEncoder().encode(e).length<=2048,"Consent exceeds the served-text contract"),source:o.enum(["served","cached","embedded"])}).nullable(),error:zh.nullable(),state_note:o.string().nullable().optional(),read_only:o.boolean().optional(),delivery_hold:Zh,default_on:Kh}).passthrough(),Vh=o.object({version:o.string().min(1),consented_at:o.string().min(1),consented_via:o.string().min(1),current:o.boolean()}).passthrough(),yx=o.object({endpoint:dd.extend({tenant_id:o.string().min(1),label:o.string().optional(),consent:Vh.nullable().optional(),created_at:o.string().optional(),updated_at:o.string().optional()}).nullable(),settings:o.object({tenant_id:o.string().min(1),eligible:o.boolean(),consent_version:o.string().optional(),consent_required:o.boolean()}).passthrough(),default_on:o.boolean().optional().catch(void 0)}).passthrough(),Yh=o.object({kind:o.enum(["endpoint","account"]).optional(),endpoint_id:o.string().min(1).optional(),account_id:o.string().min(1).optional()}).passthrough().refine(e=>!!e.endpoint_id!=!!e.account_id,"An allowlist target names exactly one of endpoint_id or account_id").refine(e=>e.kind===void 0||(e.kind==="endpoint"?e.endpoint_id!==void 0:e.account_id!==void 0),"An allowlist target's kind must agree with the id it carries"),Va=o.object({direction:o.enum(["send","receive"]),effect:o.enum(["allow","deny"]),target:Yh,id:o.string().optional()}).passthrough(),Ya=o.object({mode:o.enum(["class_default","listed_only"]),allow:o.number(),deny:o.number()}).passthrough(),bx=o.object({allowlist:o.object({tenant_id:o.string().min(1),entries:o.array(Va)}).passthrough(),view:o.object({tenant_id:o.string().nullable(),entries:o.array(Va),directions:o.object({send:Ya,receive:Ya}),class_default:o.literal("cos_cos"),cues:o.object({allow_entry_switches_direction_to_listed_only:o.boolean(),listed_only_affects:o.string(),removing_allow_does_not_stop_open_thread:o.boolean(),deny_stops_pair_both_directions:o.boolean()}).passthrough()}).passthrough()}).passthrough(),vx=o.object({onboarding:o.literal("seen")}).passthrough();function Qh(e){return e?.default_on?.in_force===!0}function wx(e,t){const n=Jh(e),r=t?.endpoint?.consent?.version;return n&&r&&n.version===r?n.text:null}function Sx(e,t){return e?.surface_state==="C"&&t?.default_on===!0&&t.endpoint?.state==="active"&&e.default_on?.notice_pending===!0}function kx(e,t){if(!e||!t||Qh(e)||e.account_id!==t||e.capability<1||e.state!=="ready"||e.update_required||e.surface_state!=="B"||!e.visibility.onboarding||!e.tenant_id)return null;const n=e.status?.tenants.filter(r=>r.tenant_id===e.tenant_id);return n?.length!==1||n[0].eligible!==!0||n[0].endpoint!==null?null:{accountId:t,tenantId:e.tenant_id}}function Jh(e){const t=e?.consent;return t&&(t.source==="served"||t.source==="cached")?t:null}const Xh=8,Fs=["aida","library","projects","agents","schedules","browser","team-bridge","agent-hub","mesh","notifications"],qh=6*1024,em=512;function ui(e,t,n){let r=new TextEncoder().encode(`${t}${e.size?`?${e}`:""}`).length;const i=[];for(const s of n){if(i.length===em)break;const c=new URLSearchParams({order_ids:s}).toString().length+1;if(r+c>qh)break;e.append("order_ids",s),i.push(s),r+=c}return i}function tm(e,t,n){return ui(new URLSearchParams(n),t,e)}const v=o.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/),Fr=o.string().min(1).max(256).regex(/^[a-zA-Z0-9_][a-zA-Z0-9_.-]*$/),Br=o.string().min(1).max(32768),nm=/^[a-f0-9]{12}$/,L=o.string().regex(nm),Yi=o.string().regex(/^[a-f0-9]{12}$/),Qi=o.string().min(1).max(128),rm=o.string().min(1).max(4096),Un=o.string().min(1).max(128).regex(/^[A-Za-z0-9_.-]+$/),Ji=o.string().regex(/^[A-Za-z0-9_.:-]{1,100}$/),Gr=o.string().regex(/^\$\{[A-Za-z_][A-Za-z0-9_]*\}$/),Qa=o.string().regex(/^[a-f0-9]{32}$/),im=/^(\/|[A-Za-z]:[\\/])/,Xi=o.string().min(1).max(4096).regex(im),Ja=/^[a-f0-9]{32}$/,te=o.string().regex(/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/),Xa=o.string().min(1).max(512).nullish(),mn=o.string().regex(/^[A-Za-z0-9_-]{1,128}$/),qa=o.string().regex(/^ap_[0-9a-hjkmnp-tv-z]{1,64}$/),Fn=o.string().regex(/^la_[0-9a-f]{16}$/),Bn=o.string().min(1).max(128).regex(/^[A-Za-z0-9_.:-]+$/),ec=o.object({data_b64:o.string().min(1).max(1e6),mime_type:o.enum(["image/png","image/jpeg","image/gif","image/webp"]),origin_path:o.string().max(4096).optional()}).strict(),sm=o.object({digest:o.string().regex(/^[0-9a-f]{32}$/),name:o.string().max(1024).optional(),mime_type:o.string().max(255).optional(),bytes:o.number().int().min(0).optional(),path:o.string().max(4096).optional()}).strict(),tc=2e5,nc=8,om=256,am=100,rc=16,cm=256,lm=100,dm=200,um=1e6,fm=o.enum(["auto","none","minimal","low","medium","high","xhigh","max"]),Me=o.string().min(1).max(128).refine(e=>e!=="."&&e!==".."&&!e.includes("/")&&!e.includes("\\")&&[...e].every(t=>t.charCodeAt(0)>=32&&t.charCodeAt(0)!==127)),Hr=o.object({kind:o.enum(["agent","team"]),name:Me}).strict(),ud=o.enum(["claude","codex","omp"]),pm=o.record(o.string(),o.array(o.string().min(1).max(512)).max(5e3)),ic={sources:o.array(ud).max(3).optional(),sessionIds:pm.optional(),all:o.boolean().optional(),includeSubagents:o.boolean().optional(),includeClearedSegments:o.boolean().optional(),includeMemory:o.boolean().optional(),includeInstructions:o.boolean().optional(),maxSessions:o.number().int().min(1).max(5e3).optional()},qi=o.object({provider:o.string().min(1).max(128),model_id:o.string().min(1).max(512),reasoning_effort:o.string().min(1).max(64).nullable(),fast_mode:o.boolean().nullable().optional()}).strict(),sc=o.object({kind:o.enum(["role","specialist"]).optional(),description:o.string().max(8e3).optional(),instructions:o.string().max(8e3).optional(),tools:o.array(o.string().min(1).max(128)).max(256).optional(),effort:o.string().max(64).optional(),delegate:o.boolean().optional(),action_class:o.enum(["reactive","proactive"]).optional()}).strict(),oc=o.object({name:o.string().min(1).max(64).optional(),description:o.string().max(8e3).optional(),manager:Me.optional(),members:o.array(o.object({role:Me,count:o.number().int().min(1).max(16),kind:o.enum(["agent","team"]),tier:o.enum(["lo","med","hi"]).nullable().optional(),effort:fm.nullable().optional()}).strict()).max(128).optional(),instructions:o.string().max(8e3).optional(),project:o.string().max(8e3).optional()}).strict(),hm=o.record(o.array(o.string().max(1024)).max(100)),es=o.array(v).max(4).refine(e=>new Set(e).size===e.length,"Duplicate attachment"),mm=o.array(o.object({kind:o.enum(["human","agent"]),account_id:v,endpoint_id:v.optional()}).strict()).max(50).refine(e=>new Set(e.map(t=>`${t.kind}:${t.account_id}:${t.endpoint_id??""}`)).size===e.length,"Duplicate mention"),ac=o.enum(["minutes","hours","days"]);function gm(e){return!/^\.+$/.test(e)}const Ex=e=>qr.safeParse(e).success,qr=o.string().min(1).max(128).refine(e=>[...e].every(t=>t.charCodeAt(0)>=32&&t.charCodeAt(0)!==127&&t!=="/"&&t!=="\\")).refine(gm),cc=o.enum(["str","int","float","bool","list","dict"]),lc=o.string().max(16384),_m=2e3,dc=o.string().min(1).max(_m),uc=o.string().min(1).max(64),ym=o.string().min(1).max(64),bm=o.string().min(1).max(64),fc=o.object({is_active:o.boolean().nullish(),one_time:o.boolean().nullish(),start_time_utc:o.string().max(64).nullish(),end_time_utc:o.string().max(64).nullish()}).strict(),vm=o.object({conversation_length:o.number().int().optional(),detail_length:o.number().int().optional(),max_learnings_history:o.number().int().optional(),hosting:o.string().max(256).optional(),model_name:o.string().max(1024).optional(),auto_save_conversation:o.boolean().optional()}).strict(),Bs=128,pc=2e3,hc=8e3,mc=64,gc=64,Si=e=>[...e].length,Gs=e=>e>=9&&e<=13||e>=28&&e<=32||e===133||e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288,wm=e=>e===9||e===10||e===11||e===12||e===13||e===133,Sm=e=>e<=31||e>=127&&e<=159,km=e=>new RegExp("\\p{Cf}","u").test(String.fromCodePoint(e)),Em=e=>e>=8234&&e<=8238||e>=8294&&e<=8297,Wr=(e,t)=>{for(const n of e)if(t(n.codePointAt(0)??0))return!0;return!1},fd=e=>{const t=[...e];let n=0,r=t.length;for(;n<r&&Gs(t[n].codePointAt(0)??0);)n++;for(;r>n&&Gs(t[r-1].codePointAt(0)??0);)r--;return t.slice(n,r).join("")},xm=e=>{let t="",n=!1;for(const r of e){if(Gs(r.codePointAt(0)??0)){n=t.length>0;continue}n&&(t+=" ",n=!1),t+=r}return t};function Im(e){const t=fd(e);if(!t)return"must not be empty";if(Si(t)>Bs)return`must be at most ${Bs} characters`;if(/[/\\:]/.test(t))return'must not contain "/", "\\" or ":"';if(Wr(t,Em))return"must not contain Unicode bidirectional override characters";if(Wr(t,wm))return"must not contain whitespace";if(Wr(t,Sm))return"must not contain control characters";if(Wr(t,km))return"must not contain invisible Unicode formatting characters";const n=[...t];return"-.".includes(n[0])||"-.".includes(n[n.length-1])?'must not begin or end with "-" or "."':null}function xx(e){return xm(fd(e).normalize("NFKC").toLowerCase())}function Rm(e){return e.trim()?Si(e)>pc?`must be at most ${pc} characters`:null:"must not be empty"}function Tm(e){return e.trim()?Si(e)>hc?`must be at most ${hc} characters`:null:"must not be empty"}function Cm(e){if(e.length>gc)return`must hold at most ${gc} items`;for(const t of e)if(!t.trim()||Si(t)>mc)return`must hold items of 1 to ${mc} characters`;return null}const Am=e=>Im(e)===null,Om=o.string().refine(Am,{message:"That is not a name the hub can publish."}),Pm=o.string().refine(e=>Tm(e)===null,{message:"That instruction body cannot be published."}),jm=o.string().refine(e=>Rm(e)===null,{message:"That description cannot be published."}),Mm=o.array(o.string()).refine(e=>Cm(e)===null,{message:"That tool list cannot be published."}),ts={requestId:te.optional(),subscribe:o.boolean().optional(),autoPush:o.boolean().optional(),confirmPublicEgress:o.boolean().optional()},_c=o.object({name:Om,description:jm,instructions:Pm,kind:o.enum(["role","specialist"]),when_to_use:o.string(),tools:Mm,effort:o.string(),delegate:o.boolean(),version:o.string(),categories:o.array(o.string()),tags:o.array(o.string())}).partial().strict(),Dm=o.enum(["team","agent"]),Nm=o.string().min(1).max(64),Lm=o.string().min(1).max(256),pd=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,ns=o.string().regex(pd,{message:"Letters, digits, dot, underscore and dash; no spaces."}),$m=["planning","active","qa","validation","done","paused","archived"],yc=o.enum($m),zr=o.string().regex(/^$|^\d{4}-\d{2}-\d{2}$/,"Dates are YYYY-MM-DD, or empty to clear."),bc=o.array(o.string().min(1).max(24)).max(8),Mt=o.string().min(1).max(64),Um=1e3,vc=240,wc=80,Fm=256,Bm=100,Gm=200,Hm=/^[a-z0-9][a-z0-9_-]{0,23}$/;function Ix(e){return e?pd.test(e)?null:"Names start with a letter or digit and may use letters, digits, dot, underscore or dash.":"Give the project a name."}function Rx(e){return Hm.test(e)?null:"Tags are 1-24 characters of lowercase letters, digits, underscore or dash."}const Zr=o.enum(["agent","team","skill"]),rs=o.string().min(1).max(128).regex(/\S/),Sc=o.enum(Fs),Wm=o.object({visible:o.array(Sc).max(Fs.length),more:o.array(Sc).max(Fs.length)}).strict(),Et=o.string().min(3).max(256).regex(/^(?:n_[a-z2-7]{4,32}|ask:[A-Za-z0-9_-]+:[A-Za-z0-9_-]+)$/),kc=o.object({selectionToken:o.string().min(1).max(512),reconcileIds:o.array(Et).max(500).optional(),excludedIds:o.array(Et).max(500).optional()}).strict(),zm=o.object({operationToken:o.string().min(1).max(512),reconcileIds:o.array(Et).max(500).optional()}).strict(),Ec=o.union([o.object({throughSeq:o.number().int().min(0).optional(),receipt:o.literal(!0).optional(),reconcileIds:o.array(Et).max(500).optional(),items:o.array(o.object({id:Et,revision:o.number().int().min(1)}).strict()).min(1).max(500)}).strict(),o.object({sessionId:L,throughSeq:o.number().int().min(0),observed:o.array(o.object({id:Et,revision:o.number().int().min(1)}).strict()).max(500)}).strict(),o.object({all:o.literal(!0),throughSeq:o.number().int().min(0),observed:o.array(o.object({id:Et,revision:o.number().int().min(1)}).strict()).max(500)}).strict()]),Zm={pointer:"pointerdown",key:"keydown",wheel:"wheel"},Km=o.discriminatedUnion("op",[o.object({op:o.literal("capabilities")}).strict(),o.object({op:o.literal("runtimes.list")}).strict(),o.object({op:o.literal("profiles.list")}).strict(),o.object({op:o.literal("profiles.get"),name:Me}).strict(),o.object({op:o.literal("imports.sources")}).strict(),o.object({op:o.literal("imports.sessions"),source:ud,includeSubagents:o.boolean().optional()}).strict(),o.object({op:o.literal("imports.preview"),...ic}).strict(),o.object({op:o.literal("imports.start"),...ic}).strict(),o.object({op:o.literal("imports.status"),jobId:o.string().min(1).max(128)}).strict(),o.object({op:o.literal("imports.cancel"),jobId:o.string().min(1).max(128)}).strict(),o.object({op:o.literal("profiles.update"),name:Me,requestId:te,fields:sc,expectedDefinitionRevision:Xa.optional()}).strict(),o.object({op:o.literal("profiles.install"),name:Me,requestId:te}).strict(),o.object({op:o.literal("profiles.create"),name:Me,requestId:te,fields:sc.extend({description:o.string().max(8e3),instructions:o.string().min(1).max(8e3)})}).strict(),o.object({op:o.literal("hub.updates")}).strict(),o.object({op:o.literal("hub.skillPull"),requestId:te,hubId:v,hubSource:o.string().min(1).max(2048),visibility:o.enum(["public","org"]),tenantId:v.nullable(),localAlias:Me,subscribe:o.boolean().optional(),autoPush:o.boolean().optional(),confirmPublicEgress:o.boolean().optional()}).strict(),o.object({op:o.literal("hub.skillSubscribe"),requestId:te,hubId:v,hubSource:o.string().min(1).max(2048),visibility:o.enum(["public","org"]),tenantId:v.nullable(),localAlias:Me}).strict(),o.object({op:o.literal("hub.skillUnpull"),requestId:te,linkId:o.string().min(1).max(256)}).strict(),o.object({op:o.literal("hub.skillPublish"),requestId:te,dryRun:o.boolean(),sourceSkill:Me,localAlias:Me,visibility:o.enum(["public","org"]),tenantId:v.nullable(),subscribe:o.boolean(),autoPush:o.boolean(),confirmPublicEgress:o.boolean(),previewReceipt:o.string().min(1).max(4096).optional(),confirmPublish:o.literal(!0).optional()}).strict(),o.object({op:o.literal("hub.links"),kind:o.enum(["agent","team","skill"]).optional()}).strict(),o.object({op:o.literal("hub.policy"),requestId:te,linkId:o.string().min(1).max(256),expectedPolicyRevision:o.string().min(1).max(256),subscribe:o.boolean().optional(),autoPush:o.boolean().optional(),confirmPublicEgress:o.boolean().optional()}).strict(),o.object({op:o.literal("hub.check"),requestId:te,kind:Zr.optional(),name:Me.optional(),localId:rs.optional()}).strict(),o.object({op:o.literal("hub.apply"),requestId:te,kind:Zr.optional(),name:Me.optional(),localId:rs.optional(),prefer:o.enum(["local","remote"]).optional(),acknowledgeUnknownBaseline:o.boolean().optional(),dryRun:o.boolean().optional(),resolveSource:o.literal(!0).optional(),hubSource:o.string().min(1).max(2048).optional(),visibility:o.enum(["public","org"]).optional(),tenantId:o.string().min(1).max(128).nullable().optional()}).strict(),o.object({op:o.literal("hub.applyAll"),requestId:te,kind:Zr.optional()}).strict(),o.object({op:o.literal("hub.retry"),requestId:te,kind:Zr.optional(),name:Me.optional(),localId:rs.optional()}).strict(),o.object({op:o.literal("hub.push"),requestId:te,linkId:o.string().min(1).max(256),direction:o.literal("push"),dryRun:o.boolean(),previewReceipt:o.string().min(1).max(4096).optional(),confirmPublish:o.literal(!0).optional()}).strict(),o.object({op:o.literal("teams.list")}).strict(),o.object({op:o.literal("teams.get"),name:Me}).strict(),o.object({op:o.literal("teams.effective"),name:Me}).strict(),o.object({op:o.literal("teams.update"),name:Me,requestId:te,fields:oc,expectedDefinitionRevision:Xa.optional()}).strict(),o.object({op:o.literal("teams.create"),requestId:te,fields:oc.extend({name:o.string().min(1).max(64)})}).strict(),o.object({op:o.literal("sessions.list"),limit:o.number().int().min(1).max(500).optional(),include_archived:o.boolean().optional(),include_peers:o.boolean().optional(),scope_kind:Dm.optional(),scope_name:Nm.optional(),cursor:Lm.optional(),with_counts:o.boolean().optional(),sort:o.literal("activity").optional()}).strict(),o.object({op:o.literal("delegated_cleanup_notice.ack")}).strict(),o.object({op:o.literal("sessions.search"),q:o.string().min(1).max(om),limit:o.number().int().min(1).max(500).optional(),include_archived:o.boolean().optional()}).strict(),o.object({op:o.literal("sessions.archive"),sessionId:L,archived:o.boolean()}).strict(),o.object({op:o.literal("sessions.delete"),sessionId:L,confirmed:o.literal(!0)}).strict(),o.object({op:o.literal("sessions.create"),requestId:te,cwd:o.string().min(1).max(4096).optional(),target:Hr.optional(),purpose:o.literal("agents-config").optional(),model:qi.optional(),draftId:L.optional(),peer:mn.optional()}).strict(),o.object({op:o.literal("sessions.preview"),requestId:te,cwd:o.string().min(1).max(4096),target:Hr.optional(),model:qi.optional()}).strict(),o.object({op:o.literal("sessions.draft"),requestId:te,cwd:o.string().min(1).max(4096),target:Hr.optional(),model:qi.optional()}).strict(),o.object({op:o.literal("sessions.get"),sessionId:L,journalOrder:o.boolean().optional(),orderIds:o.array(o.string().min(1).max(128)).max(512).optional(),peerJournalSource:o.boolean().optional()}).strict(),o.object({op:o.literal("sessions.files"),sessionId:L,scope:o.enum(["family","self"]).optional(),kind:o.string().max(256).optional(),q:o.string().max(256).optional(),sort:o.enum(["recent","name","kind","modified","created","size"]).optional(),order:o.enum(["asc","desc"]).optional(),limit:o.number().int().min(1).max(200).optional(),cursor:o.string().max(8192).optional()}).strict(),o.object({op:o.literal("sessions.files.materialise"),sessionId:L,fileId:o.string().regex(/^[a-f0-9]{16}$/)}).strict(),o.object({op:o.literal("sessions.userAttachments"),sessionId:L}).strict(),o.object({op:o.literal("sessions.userAttachments.materialise"),sessionId:L,digest:o.string().regex(/^[a-f0-9]{32}$/)}).strict(),o.object({op:o.literal("sessions.history"),sessionId:L,beforeId:v.optional(),limit:o.number().int().min(1).max(500).optional(),openFrame:o.boolean().optional(),journalOrder:o.boolean().optional(),orderIds:o.array(o.string().min(1).max(128)).max(512).optional(),peerJournalSource:o.boolean().optional(),sourceRead:o.enum(["metadata","payload"]).optional(),expectedJournalGeneration:o.string().min(1).max(128).optional()}).strict(),o.object({op:o.literal("sessions.checkpoints"),sessionId:L}).strict(),o.object({op:o.literal("sessions.checkpoints.warm"),sessionId:L,ids:o.array(v).max(rc).optional(),limit:o.number().int().min(1).max(rc).optional()}).strict(),o.object({op:o.literal("sessions.find"),sessionId:L,q:o.string().min(1).max(cm),limit:o.number().int().min(1).max(dm).optional()}).strict(),o.object({op:o.literal("subagents.transcript"),sessionId:L,childId:L,beforeId:v.optional(),limit:o.number().int().min(1).max(500).optional()}).strict(),o.object({op:o.literal("sessions.message"),sessionId:L,requestId:te,text:o.string().max(tc),images:o.array(ec).max(nc).optional(),files:o.array(sm).max(Xh).optional(),mode:o.enum(["prompt","steer"]).optional(),inputMode:o.enum(["typed","dictated","mixed"]).optional(),inputPath:o.string().max(1024).optional()}).strict(),o.object({op:o.literal("sessions.command"),sessionId:L,requestId:te,command:o.string().regex(/^\/?[A-Za-z]+$/).max(64),args:o.string().max(tc).optional(),images:o.array(ec).max(nc).optional()}).strict(),o.object({op:o.literal("sessions.move"),sessionId:L,requestId:te,cwd:o.string().min(1).max(4096)}).strict(),o.object({op:o.literal("sessions.answer"),sessionId:L,epoch:v.optional(),requestId:v.optional(),value:o.string().max(32768).optional(),approved:o.boolean().optional(),questionIndex:o.number().int().min(0).optional(),askId:v.optional(),answers:o.record(o.string(),o.array(o.string().max(32768))).optional(),decline:o.boolean().optional(),revise:o.boolean().optional(),dismiss:o.boolean().optional(),reason:o.enum(["answered_in_chat","moot"]).optional()}).strict(),o.object({op:o.literal("sessions.seen"),sessionId:L,completionToken:o.string().uuid()}).strict(),o.object({op:o.literal("attention.seen"),items:o.array(o.object({sessionId:L,completionToken:o.string().uuid()}).strict()).min(1).max(500)}).strict(),o.object({op:o.literal("sessions.notified"),sessionId:L,completionToken:o.string().uuid()}).strict(),o.object({op:o.literal("tags.list")}).strict(),o.object({op:o.literal("tags.replace"),tags:o.array(o.object({id:o.string().optional(),name:o.string()}).strict())}).strict(),o.object({op:o.literal("sessions.tags"),expected_revision:o.string().optional(),sessionId:L,tags:o.array(o.string()),primary:o.string().nullable()}).strict(),o.object({op:o.literal("sessions.pin"),sessionId:L,pinned:o.boolean()}).strict(),o.object({op:o.literal("sessions.watch"),sessionId:L,subscriptionId:o.string().regex(Ja),visible:o.boolean(),canNotify:o.boolean()}).strict(),o.object({op:o.literal("sessions.warm"),sessionId:L}).strict(),o.object({op:o.literal("sessions.interrupt"),sessionId:L,requestId:te}).strict(),o.object({op:o.literal("supplements.cancel"),sessionId:L,job:Yi,anchor:Qi}).strict(),o.object({op:o.literal("supplements.restart"),sessionId:L,job:Yi,anchor:Qi}).strict(),o.object({op:o.literal("supplements.steer"),sessionId:L,job:Yi,anchor:Qi,text:o.string().min(1).max(500)}).strict(),o.object({op:o.literal("sessions.variables.list"),sessionId:L}).strict(),o.object({op:o.literal("sessions.variables.create"),sessionId:L,key:qr,value:lc,type:cc}).strict(),o.object({op:o.literal("sessions.variables.update"),sessionId:L,key:qr,value:lc,type:cc}).strict(),o.object({op:o.literal("sessions.variables.delete"),sessionId:L,key:qr}).strict(),o.object({op:o.literal("sessions.presence"),subscriptionId:o.string().regex(/^[a-f0-9]{1,64}$/),canNotify:o.boolean(),canNotifyKinds:o.array(o.enum(["complete","error"])).max(4),sessionId:o.string().regex(/^([a-f0-9]{12})?$/),window:o.object({exists:o.boolean(),focused:o.boolean(),visible:o.boolean(),minimized:o.boolean()}).strict()}).strict(),o.object({op:o.literal("legacy.models"),provider:o.string().max(128).optional(),sort:o.enum(["id","name","provider","recommended"]).optional(),direction:o.enum(["ascending","descending"]).optional()}).strict(),o.object({op:o.literal("legacy.models.providers")}).strict(),o.object({op:o.literal("auth.probe"),provider:v}).strict(),o.object({op:o.literal("legacy.agent.upload"),agentId:v}).strict(),o.object({op:o.literal("agent.publish"),agentId:v,document:_c.optional(),...ts,visibility:o.literal("org").optional(),tenantId:v.optional()}).strict(),o.object({op:o.literal("agent.republish"),agentId:v,hubAgentId:v,expectedRemoteRevision:o.string().min(1).max(512).optional(),document:_c.optional(),...ts,visibility:o.literal("org").optional(),tenantId:v.optional()}).strict(),o.object({op:o.literal("team.publish"),teamId:v,...ts,visibility:o.literal("org").optional(),tenantId:v.optional()}).strict(),o.object({op:o.literal("team.pull"),teamId:v,tenantId:v.optional()}).strict(),o.object({op:o.literal("agent.nameAvailability"),name:o.string().min(1).max(Bs)}).strict(),o.object({op:o.literal("legacy.agents.list"),page:o.number().int().min(1).optional(),perPage:o.number().int().min(1).max(500).optional(),name:o.string().max(256).optional(),sort:o.string().max(64).optional(),direction:o.enum(["asc","desc"]).optional()}).strict(),o.object({op:o.literal("legacy.agent.get"),agentId:v}).strict(),o.object({op:o.literal("legacy.agent.history"),agentId:v,page:o.number().int().min(1).optional(),perPage:o.number().int().min(1).max(500).optional()}).strict(),o.object({op:o.literal("legacy.jobs.list"),agentId:v.optional(),status:o.string().max(64).optional()}).strict(),o.object({op:o.literal("legacy.job.get"),jobId:v}).strict(),o.object({op:o.literal("legacy.schedules.list"),page:o.number().int().min(1).optional(),perPage:o.number().int().min(1).max(100).optional()}).strict(),o.object({op:o.literal("legacy.agent.schedules.list"),agentId:v,page:o.number().int().min(1).optional(),perPage:o.number().int().min(1).max(100).optional()}).strict(),o.object({op:o.literal("legacy.agent.schedule.create"),agentId:v,schedule:fc.extend({prompt:o.string().max(64e3),interval:o.number().int().min(1),unit:ac})}).strict(),o.object({op:o.literal("legacy.schedule.get"),scheduleId:v}).strict(),o.object({op:o.literal("legacy.schedule.edit"),scheduleId:v,schedule:fc.extend({prompt:o.string().max(64e3).nullish(),interval:o.number().int().min(1).nullish(),unit:ac.nullish()})}).strict(),o.object({op:o.literal("legacy.schedule.remove"),scheduleId:v}).strict(),o.object({op:o.literal("legacy.agent.create"),agent:o.record(o.unknown())}).strict(),o.object({op:o.literal("legacy.agent.update"),agentId:v,update:o.record(o.unknown())}).strict(),o.object({op:o.literal("legacy.agent.delete"),agentId:v}).strict(),o.object({op:o.literal("legacy.agent.conversation.clear"),agentId:v}).strict(),o.object({op:o.literal("legacy.agent.systemPrompt.get"),agentId:v}).strict(),o.object({op:o.literal("legacy.agent.systemPrompt.update"),agentId:v,systemPrompt:o.string().max(um)}).strict(),o.object({op:o.literal("legacy.agent.download"),agentId:v}).strict(),o.object({op:o.literal("legacy.job.cancel"),jobId:v}).strict(),o.object({op:o.literal("commands.list")}).strict(),o.object({op:o.literal("commands.entities"),sessionId:L,command:v,name:o.string().max(128).optional()}).strict(),o.object({op:o.literal("models.catalogue"),live:o.boolean().optional(),scope:o.enum(["usable","all"]).optional()}).strict(),o.object({op:o.literal("usage.get"),provider:v.optional(),live:o.boolean().optional(),refresh:o.boolean().optional()}).strict(),o.object({op:o.literal("quota.notice"),provider:v.optional(),model:o.string().min(1).max(200).optional(),refresh:o.boolean().optional()}).strict(),o.object({op:o.literal("analytics.get"),sessionId:L.optional(),sinceMs:o.number().int().nonnegative().optional(),untilMs:o.number().int().nonnegative().optional(),days:o.number().int().min(1).max(366).optional()}).strict(),o.object({op:o.literal("analytics.models"),sessionId:L.optional(),sinceMs:o.number().int().nonnegative().optional(),untilMs:o.number().int().nonnegative().optional(),days:o.number().int().min(1).max(366).optional()}).strict(),o.object({op:o.literal("info.get")}).strict(),o.object({op:o.literal("sessions.report"),sessionId:L,recentLimit:o.number().int().min(0).max(50).optional()}).strict(),o.object({op:o.literal("skills.list"),sessionId:L.optional(),cwd:rm.optional(),name:Un.optional()}).strict(),o.object({op:o.literal("skills.create"),requestId:te,name:Un,copyFrom:Un}).strict(),o.object({op:o.literal("skills.update"),requestId:te,name:Un,expectedFingerprint:o.string().regex(/^[a-f0-9]{64}$/),files:o.array(o.object({path:o.string().min(1).max(240),content:o.string().max(1024*1024)}).strict()).min(1).max(64)}).strict(),o.object({op:o.literal("skills.remove"),requestId:te,name:Un,discardLocalChanges:o.boolean()}).strict(),o.object({op:o.literal("sessions.failovers"),sessionId:L}).strict(),o.object({op:o.literal("sessions.credential"),sessionId:L,action:o.enum(["list","store","forget"]),key:Fr.optional(),value:Br.optional(),confirmed:o.boolean().optional()}).strict(),o.object({op:o.literal("sessions.fork"),sessionId:L,requestId:te,message:o.string().max(2e5).optional(),boundary:o.enum(["next_safe","at_entry"]).optional(),entryId:o.string().max(128).optional(),autoTag:o.boolean().optional()}).strict(),o.object({op:o.literal("sessions.stop"),requestId:te,targets:o.array(L).min(1).max(100),confirmed:o.literal(!0)}).strict(),o.object({op:o.literal("sessions.aside"),sessionId:L,requestId:te,text:o.string().min(1).max(32768),asideId:te.optional(),subscriptionId:o.string().regex(Ja).optional()}).strict(),o.object({op:o.literal("sessions.adopt"),sessionId:L,requestId:te,asideId:te,confirmed:o.literal(!0)}).strict(),o.object({op:o.literal("sessions.aside.get"),sessionId:L,asideId:te}).strict(),o.object({op:o.literal("sessions.aside.close"),sessionId:L,asideId:te}).strict(),o.object({op:o.literal("wakes.list"),limit:o.number().int().min(1).max(500).optional(),includeDormant:o.boolean().optional()}).strict(),o.object({op:o.literal("wakes.create"),requestId:te,sessionId:L.optional(),cwd:o.string().min(1).max(4096).optional(),target:Hr.optional(),message:dc,in:o.string().min(1).max(64).optional(),at:o.string().min(1).max(64).optional(),every:o.string().min(1).max(64).optional(),until:o.string().min(1).max(64).optional(),limit:o.number().int().min(1).optional(),title:o.string().min(1).max(200).optional()}).strict(),o.object({op:o.literal("wakes.edit"),sessionId:L,wakeId:uc,message:dc.optional(),in:o.string().min(1).max(64).optional(),at:o.string().min(1).max(64).optional(),every:o.string().min(1).max(64).optional(),until:o.string().min(1).max(64).optional(),limit:o.number().int().min(1).optional()}).strict(),o.object({op:o.literal("wakes.remove"),sessionId:L,wakeId:uc}).strict(),o.object({op:o.literal("monitors.cancel"),sessionId:L,monitorId:ym}).strict(),o.object({op:o.literal("jobs.cancel"),sessionId:L,jobId:bm}).strict(),o.object({op:o.literal("mcp.list"),sessionId:L}).strict(),o.object({op:o.literal("mcp.credentials.store"),sessionId:L,name:o.string().min(1).max(256),values:o.record(o.string().min(1).max(128),o.string().min(1).max(32768)).refine(e=>Object.keys(e).length<=32&&Object.values(e).reduce((t,n)=>t+n.length,0)<=65536,{message:"Too many secret values, or too much secret text, for one MCP credential write."}),confirmedReplace:o.array(o.string().min(1).max(128)).max(32)}).strict(),o.object({op:o.literal("mcp.control"),sessionId:L,control:o.object({action:o.enum(["list","add","remove","reload","connect","probe","disconnect","login","logout","reauth","status","cancel"]),name:Ji.optional(),scope:o.enum(["global","project"]).optional(),command:o.string().min(1).max(4096).optional(),args:o.array(o.string().max(8192)).max(128).optional(),env:o.record(Gr).optional(),url:o.string().max(4096).optional(),headers:o.record(Gr).optional(),oauth:o.boolean().optional(),confirmed:o.boolean().optional(),operation_id:Qa.optional()}).strict()}).strict(),o.object({op:o.literal("mcp.catalog"),cwd:Xi.optional(),sessionId:L.optional()}).strict(),o.object({op:o.literal("mcp.catalog.control"),cwd:Xi.optional(),control:o.object({action:o.enum(["add","remove","test","login","reauth","logout","status","cancel"]),name:Ji.optional(),scope:o.enum(["global","project"]).optional(),command:o.string().min(1).max(4096).optional(),args:o.array(o.string().max(8192)).max(128).optional(),env:o.record(Gr).optional(),url:o.string().max(4096).optional(),headers:o.record(Gr).optional(),confirmed:o.boolean().optional(),operation_id:Qa.optional()}).strict()}).strict(),o.object({op:o.literal("mcp.catalog.credentials"),header:o.string().min(1).max(128).optional(),cwd:Xi.optional(),name:Ji,values:o.record(o.string().min(1).max(128),o.string().min(1).max(32768)).refine(e=>Object.keys(e).length<=32&&Object.values(e).reduce((t,n)=>t+n.length,0)<=65536,{message:"Too many secret values, or too much secret text, for one MCP credential write."}),confirmedReplace:o.array(o.string().min(1).max(128)).max(32)}).strict(),o.object({op:o.literal("radient.request"),control:o.object({operation:o.enum(["account","prices","credits","usage","provision","application.create","agents.list","agents.get","agents.create","agents.update","agents.delete","agents.like","agents.unlike","agents.liked","agents.like_count","agents.favourite","agents.unfavourite","agents.favourited","agents.favourite_count","agents.download_count","agents.statuses","comments.list","comments.create","comments.update","comments.delete","account.agents","memberships.list","org_agents.list","org_team.get","org_teams.list","org_skills.list","org_skill.get","signup.resend"]),request_id:te.optional(),tenant_id:v.optional(),account_id:v.optional(),agent_id:v.optional(),comment_id:v.optional(),team_id:v.optional(),skill_id:v.optional(),query:o.record(o.union([o.string().max(1024),o.number().int()])).optional(),payload:o.record(o.unknown()).optional(),confirmed:o.boolean().optional()}).strict()}).strict(),o.object({op:o.literal("providers.list")}).strict(),o.object({op:o.literal("accounts.list")}).strict(),o.object({op:o.literal("accounts.remove"),accountId:o.number().int().positive(),confirmed:o.literal(!0)}).strict(),o.object({op:o.literal("tunnel.setup.read"),credentialId:o.number().int().positive().optional()}).strict(),o.object({op:o.literal("tunnel.setup.plan"),credentialId:o.number().int().positive().optional()}).strict(),o.object({op:o.literal("tunnel.setup.run"),credentialId:o.number().int().positive(),acceptMonthlyPrice:o.string().min(1).max(64).optional()}).strict(),o.object({op:o.literal("auth.start"),provider:v}).strict(),o.object({op:o.literal("auth.status"),id:v}).strict(),o.object({op:o.literal("auth.input"),id:v,promptId:v,value:Br}).strict(),o.object({op:o.literal("auth.cancel"),id:v}).strict(),o.object({op:o.literal("auth.key"),provider:v,value:Br}).strict(),o.object({op:o.literal("auth.logout"),provider:v}).strict(),o.object({op:o.literal("agent_messages.status"),boundary:Ka}).strict(),o.object({op:o.literal("agent_messages.enable"),expected_account_id:v,tenant_id:v,state:o.literal("active"),consent_version:o.string().min(1).max(128),consented_via:o.literal("dialog")}).strict(),o.object({op:o.literal("agent_messages.settings"),tenant_id:v.optional()}).strict(),o.object({op:o.literal("agent_messages.settings.put"),expected_account_id:v,tenant_id:v.optional(),consent_version:o.string().min(1).max(128).optional(),consented_via:o.enum(["dialog","settings"]).optional(),label:o.string().min(1).max(128).optional(),state:o.enum(["active","paused","disabled"])}).strict(),o.object({op:o.literal("agent_messages.onboarding.dismiss")}).strict(),o.object({op:o.literal("agent_messages.allowlist.get"),tenant_id:v.optional()}).strict(),o.object({op:o.literal("agent_messages.allowlist.put"),expected_account_id:v,tenant_id:v.optional(),entries:o.array(o.object({direction:o.enum(["send","receive"]),effect:o.enum(["allow","deny"]),target:o.object({endpoint_id:v.optional(),account_id:v.optional()}).strict().refine(e=>!!e.endpoint_id!=!!e.account_id,"An allowlist target names exactly one of endpoint_id or account_id")}).strict()).max(200)}).strict(),o.object({op:o.literal("team_bridge.conversations.list"),scope:o.literal("account").optional(),tenant_id:v.optional(),limit:o.number().int().min(1).max(100).optional(),cursor:o.string().min(1).max(512).optional(),before:o.string().min(1).max(64).optional(),status:o.enum(["open","archived"]).optional()}).strict(),o.object({op:o.literal("team_bridge.conversations.get"),conversation_id:v,tenant_id:v.optional()}).strict(),o.object({op:o.literal("team_bridge.conversations.create"),expected_account_id:v.optional(),tenant_id:v.optional(),kind:o.enum(["dm","group","channel"]),name:o.string().min(1).max(128).optional(),topic:o.string().min(1).max(512).optional(),visibility:o.enum(["private","tenant"]).optional(),agent_capable:o.boolean().optional(),members:o.array(o.object({account_id:v,kind:o.enum(["human","agent"]),endpoint_id:v.optional(),display_label:o.string().min(1).max(64)}).strict()).max(500)}).strict(),o.object({op:o.literal("team_bridge.conversations.lifecycle"),expected_account_id:v.optional(),tenant_id:v.optional(),conversation_id:v,action:o.enum(["archive","unarchive","join","leave"])}).strict(),o.object({op:o.literal("team_bridge.conversations.join"),expected_account_id:v.optional(),conversation_id:v,tenant_id:v.optional()}).strict(),o.object({op:o.literal("team_bridge.conversations.notify"),expected_account_id:v.optional(),conversation_id:v,tenant_id:v.optional(),notify:o.enum(["all","mention","mute"])}).strict(),o.object({op:o.literal("team_bridge.conversations.agent_notify"),expected_account_id:v.optional(),conversation_id:v,tenant_id:v.optional(),notify:o.enum(["all","mention","mute"])}).strict(),o.object({op:o.literal("team_bridge.conversations.members.add"),expected_account_id:v.optional(),conversation_id:v,tenant_id:v.optional(),members:o.array(o.object({account_id:v,kind:o.enum(["human","agent"]),endpoint_id:v.optional(),display_label:o.string().min(1).max(64)}).strict()).min(1).max(500)}).strict(),o.object({op:o.literal("team_bridge.conversations.members.remove"),expected_account_id:v.optional(),tenant_id:v.optional(),conversation_id:v,account_id:v}).strict(),o.object({op:o.literal("team_bridge.conversations.delete"),expected_account_id:v.optional(),tenant_id:v.optional(),conversation_id:v}).strict(),o.object({op:o.literal("team_bridge.conversations.consent"),expected_account_id:v.optional(),conversation_id:v,account_id:v,decision:o.enum(["accept","decline"]),consent_version:o.string().min(1).max(128),tenant_id:v.optional()}).strict(),o.object({op:o.literal("team_bridge.owner_audit.conversations"),expected_account_id:v,tenant_id:v,limit:o.number().int().min(1).max(100).optional(),cursor:o.string().min(1).optional()}).strict(),o.object({op:o.literal("team_bridge.owner_audit.messages"),expected_account_id:v,tenant_id:v,conversation_id:v,limit:o.number().int().min(1).max(100).optional(),before_seq:o.number().int().nonnegative().optional()}).strict(),o.object({op:o.literal("team_bridge.owner_audit.replies"),expected_account_id:v,tenant_id:v,conversation_id:v,message_id:v,limit:o.number().int().min(1).max(100).optional(),after_seq:o.number().int().nonnegative().optional()}).strict(),o.object({op:o.literal("team_bridge.messages.list"),conversation_id:v,tenant_id:v.optional(),limit:o.number().int().min(1).max(100).optional(),before_seq:o.number().int().nonnegative().optional(),endpoint_id:v.optional()}).strict(),o.object({op:o.literal("team_bridge.reactions.toggle"),conversation_id:v,message_id:v,expected_account_id:v,tenant_id:v,emoji:o.string().min(1),active:o.boolean()}).strict(),o.object({op:o.literal("team_bridge.messages.send"),expected_account_id:v.optional(),conversation_id:v,tenant_id:v.optional(),client_ref:v,body:o.string(),agent_label:o.string().min(1).max(64).optional(),thread_root_id:v.optional(),attachment_ids:es.optional(),mentions:mm.optional()}).strict(),o.object({op:o.literal("team_bridge.messages.replies"),conversation_id:v,message_id:v,expected_account_id:v,tenant_id:v,limit:o.number().int().min(1).max(100).optional(),after_seq:o.number().int().nonnegative().optional()}).strict(),o.object({op:o.literal("team_bridge.scheduled.list"),tenant_id:v}).strict(),o.object({op:o.literal("team_bridge.scheduled.create"),tenant_id:v,conversation_id:v,client_ref:v,body:o.string(),send_at:o.string().datetime({offset:!0}),attachment_ids:es.optional(),thread_root_id:v.optional()}).strict(),o.object({op:o.literal("team_bridge.scheduled.update"),tenant_id:v,scheduled_id:v,body:o.string().optional(),send_at:o.string().datetime({offset:!0}).optional(),attachment_ids:es.optional(),expected_version:o.number().int().nonnegative().optional()}).strict(),o.object({op:o.literal("team_bridge.attachments.delete"),tenant_id:v,conversation_id:v,attachment_id:v,expected_account_id:v}).strict(),o.object({op:o.literal("team_bridge.scheduled.cancel"),tenant_id:v,scheduled_id:v}).strict(),o.object({op:o.literal("team_bridge.read"),expected_account_id:v.optional(),conversation_id:v,tenant_id:v.optional(),seq:o.number().int().nonnegative().optional(),muted:o.boolean().optional()}).strict(),o.object({op:o.literal("team_bridge.unread"),scope:o.literal("account").optional(),tenant_id:v.optional()}).strict(),o.object({op:o.literal("team_bridge.directory"),tenant_id:v}).strict(),o.object({op:o.literal("team_bridge.status"),boundary:Ka.optional()}).strict(),o.object({op:o.literal("settings.list")}).strict(),o.object({op:o.literal("settings.edit"),key:Fr,value:o.unknown().refine(e=>e!==void 0,"A setting value is required."),base:hm.optional()}).strict(),o.object({op:o.literal("settings.reset"),key:Fr}).strict(),o.object({op:o.literal("tts.paths")}).strict(),o.object({op:o.literal("config.get")}).strict(),o.object({op:o.literal("config.update"),value:vm}).strict(),o.object({op:o.literal("instructions.get")}).strict(),o.object({op:o.literal("instructions.update"),content:o.string().max(64e3)}).strict(),o.object({op:o.literal("credentials.list")}).strict(),o.object({op:o.literal("credentials.update"),key:Fr,value:Br}).strict(),o.object({op:o.literal("peers.list")}).strict(),o.object({op:o.literal("networks.list")}).strict(),o.object({op:o.literal("networks.invite"),networkId:mn,role:o.enum(["read","drive","admin"]),deviceId:mn.optional()}).strict(),o.object({op:o.literal("networks.member.remove"),networkId:mn,deviceId:mn,confirm:o.string().min(1).max(256)}).strict(),o.object({op:o.literal("sessions.transfer"),sessionId:L,to:o.union([o.literal("local"),mn]),keep:o.boolean().optional(),waitS:o.number().min(0).max(300).optional(),requestId:te.optional()}).strict(),o.object({op:o.literal("approvals.list")}).strict(),o.object({op:o.literal("approvals.approve"),approvalId:qa}).strict(),o.object({op:o.literal("approvals.deny"),approvalId:qa}).strict(),o.object({op:o.literal("asks.list")}).strict(),o.object({op:o.literal("projects.list")}).strict(),o.object({op:o.literal("projects.get"),key:Mt}).strict(),o.object({op:o.literal("projects.create"),name:ns,description:o.string().max(vc).optional(),status:yc.optional(),tags:bc.optional()}).strict(),o.object({op:o.literal("projects.update"),key:Mt,fields:o.object({name:ns.optional(),title:o.string().max(80).optional(),owner:o.string().max(80).optional(),team:o.string().max(80).optional(),description:o.string().max(vc).optional(),status:yc.optional(),progress:o.string().max(Um).optional(),tags:bc.optional(),start_date:zr.optional(),target_date:zr.optional(),completed_at:zr.optional(),estimate:o.number().positive().max(1e3).optional(),estimate_unit:o.enum(["points","days"]).optional()}).strict(),force_done:o.boolean().optional()}).strict(),o.object({op:o.literal("projects.delete"),key:Mt,confirmed_name:ns}).strict(),o.object({op:o.literal("projects.link"),key:Mt,sessionId:L}).strict(),o.object({op:o.literal("projects.unlink"),key:Mt,sessionId:L}).strict(),o.object({op:o.literal("projects.milestone"),key:Mt,name:o.string().min(1).max(wc),targetDate:zr.optional(),completed:o.boolean().optional()}).strict(),o.object({op:o.literal("projects.milestone.remove"),key:Mt,name:o.string().min(1).max(wc)}).strict(),o.object({op:o.literal("projects.request_update"),key:Mt}).strict(),o.object({op:o.literal("projects.search"),q:o.string().min(1).max(Fm),limit:o.number().int().min(1).max(Gm).optional()}).strict(),o.object({op:o.literal("aida.status")}).strict(),o.object({op:o.literal("aida.control"),action:o.enum(["open","pause","resume","greet","status"])}).strict(),o.object({op:o.literal("code_requests.list"),sessionId:L}).strict(),o.object({op:o.literal("code_requests.refresh"),sessionId:L,keys:o.array(o.string().min(1).max(512)).max(256).optional(),force:o.boolean().optional()}).strict(),o.object({op:o.literal("static.sign"),route:o.enum(["images","videos","audio","html"]),path:o.string().min(1),ttlS:o.number().int().min(1).max(3600).optional()}).strict(),o.object({op:o.literal("library.list"),scope:o.enum(["final","all"]).optional(),q:o.string().max(512).optional(),category:o.string().min(1).max(64).optional(),kind:o.string().min(1).max(64).optional(),origin_group:o.enum(["generated","created","mentioned"]).optional(),origin:o.string().min(1).max(64).optional(),tag:o.string().min(1).max(128).optional(),tag_mode:o.enum(["all","any"]).optional(),highlighted:o.boolean().optional(),organized:o.boolean().optional(),favorite:o.boolean().optional(),session:o.string().min(1).max(12).optional(),session_id:o.string().min(1).max(512).optional(),sort:o.enum(["recent","name","kind","size","created","modified","organized"]).optional(),order:o.enum(["asc","desc"]).optional(),limit:o.number().int().min(1).max(200).optional(),cursor:o.string().max(512).optional()}).strict(),o.object({op:o.literal("library.get"),id:Fn}).strict(),o.object({op:o.literal("library.update"),id:Fn,fields:o.object({name:o.string().max(200).optional(),description:o.string().max(2e3).optional(),favorite:o.boolean().optional(),locked:o.boolean().optional(),archived:o.boolean().optional()}).strict()}).strict(),o.object({op:o.literal("library.tags")}).strict(),o.object({op:o.literal("library.tags.create"),name:o.string().trim().min(1).max(24),category:o.string().min(1).max(64).optional()}).strict(),o.object({op:o.literal("library.tags.update"),id:Bn,name:o.string().trim().min(1).max(24).optional(),category:o.string().min(1).max(64).optional()}).strict(),o.object({op:o.literal("library.tags.delete"),id:Bn}).strict(),o.object({op:o.literal("library.tags.merge"),id:Bn,into:Bn}).strict(),o.object({op:o.literal("library.tags.assign"),id:Fn,tags:o.array(Bn).max(64),primary:o.string().max(128).optional()}).strict(),o.object({op:o.literal("library.chat.link"),id:Fn,sessionId:L}).strict(),o.object({op:o.literal("library.chat.clear"),id:Fn}).strict(),o.object({op:o.literal("library.librarian"),action:o.enum(["status","open","pause","resume","run"]).optional()}).strict(),o.object({op:o.literal("sidebar_layout.get")}).strict(),o.object({op:o.literal("sidebar_layout.set"),layout:Wm}).strict(),o.object({op:o.literal("notifications.list"),preview:o.literal(!0).optional(),includeAskReads:o.boolean().optional(),countSessionIds:o.array(L).max(50).optional(),kind:o.enum(["all","asks","updates"]).optional(),bulkPriority:o.enum(["any","high","normal_up"]).optional(),state:o.enum(["unread","all","dismissed"]).optional(),source:o.enum(["notify","ask"]).optional(),priority:o.enum(["high","normal","low"]).optional(),sessionId:L.optional(),throughSeq:o.number().int().min(0).optional(),cursor:o.string().min(1).max(64).optional(),limit:o.number().int().min(1).max(100).optional()}).strict(),o.object({op:o.literal("notifications.get"),id:Et}).strict(),o.object({op:o.literal("notifications.count")}).strict(),o.object({op:o.literal("notifications.read"),verb:o.enum(["read","unread","undo"]),target:o.union([Ec,kc,zm])}).strict(),o.object({op:o.literal("notifications.dismiss"),verb:o.enum(["dismiss","undismiss"]),target:o.union([Ec,kc])}).strict(),o.object({op:o.literal("notifications.seen"),items:o.array(o.object({id:Et,revision:o.number().int().min(1),anchorId:o.string().min(1).max(256),visibleSinceMs:o.number().int().min(0)}).strict()).min(1).max(50),evidence:o.object({sessionId:L,inputKind:o.enum(["pointer","key","wheel"]),inputAtMs:o.number().int().min(0),visibleSinceMs:o.number().int().min(0)}).strict()}).strict()]);Km.superRefine((e,t)=>{if((e.op==="notifications.read"||e.op==="notifications.dismiss")&&"items"in e.target&&!!e.target.receipt!=(e.target.throughSeq!==void 0)&&t.addIssue({code:o.ZodIssueCode.custom,message:"Receipt writes require a sequence boundary",path:["target"]}),e.op==="notifications.read"&&e.verb==="undo"!="operationToken"in e.target&&t.addIssue({code:o.ZodIssueCode.custom,message:"Undo requires an operation token, and only undo accepts one",path:["target"]}),(e.op==="team_bridge.messages.send"||e.op==="team_bridge.scheduled.create"||e.op==="team_bridge.scheduled.update"&&e.body!==void 0)&&e.body?.trim()===""&&(e.attachment_ids?.length??0)===0){t.addIssue({code:o.ZodIssueCode.custom,message:"A message needs text or an image",path:["body"]});return}if(e.op.startsWith("team_bridge.")&&"expected_account_id"in e&&e.expected_account_id&&(!("tenant_id"in e)||!e.tenant_id)){t.addIssue({code:o.ZodIssueCode.custom,path:["tenant_id"],message:"Guarded conversation writes require an explicit tenant"});return}if(e.op==="team_bridge.messages.send"&&e.thread_root_id!==void 0&&!e.expected_account_id){t.addIssue({code:o.ZodIssueCode.custom,path:["expected_account_id"],message:"Thread replies require the captured account"});return}if(e.op==="hub.skillPull"||e.op==="hub.skillSubscribe"||e.op==="hub.skillPublish"){if(e.visibility==="public"&&e.tenantId!==null||e.visibility==="org"&&!e.tenantId){t.addIssue({code:o.ZodIssueCode.custom,message:"A skill destination requires explicit paired scope",path:["tenantId"]});return}if(e.op==="hub.skillPublish"&&(e.dryRun?e.previewReceipt!==void 0||e.confirmPublish!==void 0:!e.previewReceipt||e.confirmPublish!==!0)){t.addIssue({code:o.ZodIssueCode.custom,message:"An initial skill publication requires its reviewed draft receipt",path:["previewReceipt"]});return}}if(e.op==="hub.check"||e.op==="hub.apply"||e.op==="hub.retry"){const n=e.name!==void 0,r=e.localId!==void 0,i=e.op!=="hub.check";if(n&&r||i&&!n&&!r||r&&e.kind===void 0){t.addIssue({code:o.ZodIssueCode.custom,message:"A hub action addresses one item by name or local id, never both",path:["localId"]});return}}if(e.op==="hub.apply"&&e.resolveSource===!0){const n=e.visibility==="public"&&e.tenantId===null||e.visibility==="org"&&typeof e.tenantId=="string"&&e.tenantId.length>0;if(!e.hubSource||!n||e.acknowledgeUnknownBaseline!==!0||e.localId!==void 0||e.prefer!==void 0){t.addIssue({code:o.ZodIssueCode.custom,message:"Confirming a source requires its exact stated destination and the unknown-baseline acknowledgement, addressed by name, with no preference",path:["hubSource"]});return}}if(e.op==="hub.push"&&(e.dryRun?e.previewReceipt!==void 0||e.confirmPublish!==void 0:!e.previewReceipt||e.confirmPublish!==!0)){t.addIssue({code:o.ZodIssueCode.custom,message:"A confirmed publication requires its reviewed preview receipt",path:["previewReceipt"]});return}if(e.op==="hub.policy"&&e.subscribe===void 0&&e.autoPush===void 0){t.addIssue({code:o.ZodIssueCode.custom,message:"A hub policy change must name subscribe or autoPush",path:["subscribe"]});return}if((e.op==="team_bridge.conversations.list"||e.op==="team_bridge.unread")&&e.scope==="account"&&e.tenant_id!==void 0){t.addIssue({code:o.ZodIssueCode.custom,message:"An account-scoped read cannot name a tenant",path:["scope"]});return}if(e.op==="team_bridge.conversations.list"&&e.scope==="account"&&e.before!==void 0){t.addIssue({code:o.ZodIssueCode.custom,message:"An account-scoped page uses cursor, not before",path:["before"]});return}if(e.op==="sessions.answer"){if(e.askId!==void 0){if(e.askId||t.addIssue({code:o.ZodIssueCode.custom,message:"ask_id must be a non-empty string",path:["askId"]}),e.dismiss===!0){(e.answers!==void 0||e.decline===!0||e.revise===!0)&&t.addIssue({code:o.ZodIssueCode.custom,message:"A dismissal carries no answers, decline or revise",path:["dismiss"]});return}e.reason!==void 0?t.addIssue({code:o.ZodIssueCode.custom,message:"A reason applies to a dismissal",path:["reason"]}):e.decline!==!0&&!e.answers?t.addIssue({code:o.ZodIssueCode.custom,message:"A queued-ask answer needs answers or decline",path:["answers"]}):e.decline===!0&&e.answers!==void 0?t.addIssue({code:o.ZodIssueCode.custom,message:"Supply either answers or decline",path:["decline"]}):e.revise===!0&&e.decline===!0?t.addIssue({code:o.ZodIssueCode.custom,message:"Supply either decline or revise",path:["revise"]}):e.answers!==void 0&&Object.keys(e.answers).length===0&&t.addIssue({code:o.ZodIssueCode.custom,message:"answers must name at least one question",path:["answers"]});return}e.epoch||t.addIssue({code:o.ZodIssueCode.custom,message:"An epoch is required to answer a gate",path:["epoch"]}),e.requestId||t.addIssue({code:o.ZodIssueCode.custom,message:"A request id is required to answer a gate",path:["requestId"]}),e.revise===!0&&t.addIssue({code:o.ZodIssueCode.custom,message:"revise applies to a queued ask",path:["revise"]}),e.dismiss===!0&&t.addIssue({code:o.ZodIssueCode.custom,message:"dismiss applies to a queued ask",path:["dismiss"]}),e.reason!==void 0&&t.addIssue({code:o.ZodIssueCode.custom,message:"reason applies to a queued ask",path:["reason"]});return}if(e.op==="sessions.create"&&e.purpose===void 0){e.cwd===void 0&&t.addIssue({code:o.ZodIssueCode.custom,message:"A conversation needs a working directory: only a configuration run (`purpose`) may omit `cwd`.",path:["cwd"]});return}if(e.op==="sessions.create"&&e.purpose!==void 0){for(const n of["cwd","target","model","draftId"])e[n]!==void 0&&t.addIssue({code:o.ZodIssueCode.custom,message:`A configuration run resolves its own \`${n}\`: send \`purpose\` alone.`,path:[n]});return}if(!(e.op!=="agent.publish"&&e.op!=="agent.republish"&&e.op!=="team.publish")){if((e.subscribe!==void 0||e.autoPush!==void 0||e.confirmPublicEgress!==void 0)&&!e.requestId){t.addIssue({code:o.ZodIssueCode.custom,message:"Initial link policy needs a durable publication request ID",path:["requestId"]});return}e.visibility==="org"!=!!e.tenantId&&t.addIssue({code:o.ZodIssueCode.custom,message:'A publication target needs both `visibility: "org"` and `tenantId`, or neither: one half would publish to the public hub.'})}});const qe={noCredential:"pairing.no-credential",refused:"pairing.refused",planeClosed:"pairing.plane-closed",transportFailed:"transport.failed"},Vm={runtimeUnreachable:"runtime_unreachable"},ki="runtime_busy",hd="runtime_retiring";o.object({data:o.object({aside_id:o.string().optional(),status:o.union([o.enum(["adopted","queued"]),o.string()]).optional()}).passthrough()}).passthrough();const md=o.object({name:o.string(),description:o.string().nullish(),source:o.string().nullish(),link_id:o.string().nullish(),editable:o.boolean().nullish(),installed:o.boolean().nullish(),fingerprint:o.string().nullish(),form:o.string().nullish()}).passthrough(),Ym=o.object({path:o.string(),size:o.number().nullish(),preview:o.string().nullish(),preview_truncated:o.boolean().nullish()}).passthrough(),Qm=md.extend({body:o.string().nullish(),body_in_detail:o.boolean().nullish(),body_length:o.number().nullish(),body_bytes:o.number().nullish(),body_truncated:o.boolean().nullish(),files:o.array(Ym).nullish(),files_total:o.number().nullish(),files_truncated:o.boolean().nullish(),publish_budget:o.object({limit:o.number(),total:o.number()}).passthrough().nullish()}).passthrough(),Tx=o.object({skills:o.array(md),scope:o.string().nullish(),detail:o.string().nullish(),skill_detail:Qm.nullish(),warning_count:o.number().nullish(),version:o.string().nullish()}).passthrough(),Cx="aside_adopt_refused",Jm=["session_closed","open_tool_batch","turn_running"];function Ax(e){if(typeof e!="object"||e===null)return;const t=e.reason;return Jm.find(n=>n===t)}const Xm={[qe.noCredential]:"ui.common.errors.desktop_refusal.no_credential",[qe.refused]:"ui.common.errors.desktop_refusal.refused",[qe.planeClosed]:"ui.common.errors.desktop_refusal.plane_closed",[qe.transportFailed]:"ui.common.errors.desktop_refusal.transport_failed"},Hs={noCredential:"Restart with a desktop-managed backend to use these controls.",transportFailed:"The backend could not complete this request. Check its connection and try again."};function Ei(e){return e!==void 0&&Object.values(qe).includes(e)}function qm(e,t){if(e.startsWith("/v1/desktop/")){if(t===401||t===403)return qe.refused;if(t===503)return qe.planeClosed}}const Ox=o.object({step:o.string(),blocked_on:o.string(),configured:o.boolean(),ready:o.boolean(),verified:o.boolean(),url:o.string().nullable(),credential_id:o.number().int().positive().nullable(),identity_label:o.string().nullable(),credential_choices:o.array(o.object({id:o.number().int().positive(),identity_label:o.string().nullable().optional()}).passthrough()).default([]),quote:o.object({monthly_price_usd:o.string().nullable(),positive_balance:o.boolean(),eligible:o.boolean(),account_valid:o.boolean()}).passthrough().nullable(),receipts:o.array(o.object({step:o.string(),ok:o.boolean(),text:o.string()})).default([]),remedy:o.object({kind:o.string(),text:o.string(),command:o.string().nullable().optional(),url:o.string().nullable().optional()}).nullable(),source:o.string(),in_progress:o.boolean().default(!1),progress:o.array(o.string()).default([]),active_credential_id:o.number().int().positive().nullable().default(null),billing_outcome:o.string().optional(),reservation_outcome:o.string().optional(),failure_stage:o.string().optional()}).passthrough(),Px=new Set(["setup_in_progress","setup_deadline","setup_unavailable","setup_intent_corrupt"]),eg=88e4,tg=11e5,ng=2e4,rg=9e4,ig=new Set(["analytics.get","analytics.models","sessions.report"]),sg=new Set(["usage.get"]),og=new Set(["networks.list","peers.list"]),ag=new Set([...ig,...sg,...og]),cg=90,lg=30,dg=300,ug=10,gd=15,fg=1e4;function pg(e){const n=e.to==="local"||e.keep?dg:lg,r=Math.max(0,e.waitS??0);return(cg+n+ug+gd)*1e3+r*1e3}const hg=18e4,mg=hg+15e3,gg=120,_g=135e3,yg=93e4,_d=(gg+30+gd)*1e3,bg=6e4,vg=5*_d,wg=new Set(["hub.apply","hub.retry","hub.push","hub.skillPublish","hub.skillPull","hub.skillSubscribe","hub.skillUnpull","hub.check","hub.applyAll"]);function Sg(e){switch(e){case"hub.apply":case"hub.retry":case"hub.push":case"hub.skillPublish":case"hub.skillPull":case"hub.skillSubscribe":case"hub.skillUnpull":return _d;case"hub.check":return bg;case"hub.applyAll":return vg;default:return null}}function kg(e){if(typeof e!="string"&&e.op==="sessions.transfer")return pg(e)+fg;const t=typeof e=="string"?e:e.op;if(t==="approvals.approve")return mg;if(t==="tunnel.setup.run")return yg;if(t==="tunnel.setup.plan")return _g;const n=Sg(t);return n!==null?n:ag.has(t)?rg:ng}const Eg=5e3;function yd(e){return kg(e)+Eg}const Ro="deadline_exceeded",bd="foreground_required",vd="View these completions in the foreground before marking them read.",xg=new Set(["capabilities","agent_messages.status","agent_messages.settings","agent_messages.allowlist.get","team_bridge.conversations.list","team_bridge.conversations.get","team_bridge.messages.list","team_bridge.messages.replies","team_bridge.owner_audit.conversations","team_bridge.owner_audit.messages","team_bridge.owner_audit.replies","team_bridge.unread","team_bridge.directory","team_bridge.status","accounts.list","analytics.get","analytics.models","approvals.list","commands.entities","commands.list","config.get","credentials.list","hub.updates","hub.links","info.get","instructions.get","legacy.agent.get","legacy.agent.history","legacy.agent.schedules.list","legacy.agents.list","legacy.job.get","legacy.jobs.list","legacy.models","legacy.models.providers","legacy.schedule.get","legacy.schedules.list","mcp.catalog","mcp.list","models.catalogue","networks.list","peers.list","profiles.get","profiles.list","projects.search","providers.list","quota.notice","runtimes.list","sessions.aside.get","sessions.checkpoints","sessions.failovers","sessions.find","sessions.get","sessions.history","sessions.files","sessions.userAttachments","sessions.list","sessions.preview","sessions.report","sessions.search","sessions.variables.list","skills.list","subagents.transcript","teams.effective","teams.get","teams.list","tunnel.setup.plan","tunnel.setup.read","usage.get"]),Ig=new Set(["analytics.get","analytics.models","networks.list","peers.list","usage.get","sessions.report","info.get","sessions.failovers"]);function Rg(e,t){const n=Math.round(t/1e3),r=Ro;return e==="sessions.transfer"?{code:r,message:`The app waits up to ${n} seconds for a move, and it was still running when the app stopped waiting. The move was asked for, so its outcome is unknown from here: read the session again before moving it anywhere else.`}:e==="approvals.approve"?{code:r,message:`The app waits up to ${n} seconds for an approval, and the signing prompt was still open when it stopped waiting. The request was sent, so the decision may or may not have landed: read the approvals again — if the record still waits, answering it again is safe, because the store keeps the first decision and refuses a second.`}:wg.has(e)?{code:r,message:"This is taking longer than expected. It may still finish; the mark will update."}:xg.has(e)?{code:r,message:Ig.has(e)?`The app waits up to ${n} seconds for this panel's data, and the read was still running when the app stopped waiting. Nothing was read; reopen the panel to ask again.`:`The app waits up to ${n} seconds for this read, and it was still running when the app stopped waiting. Nothing was read; ask again.`}:{code:r,message:`The app waits up to ${n} seconds for this request, and it was still running when the app stopped waiting. It may or may not have reached the server; check the result before repeating it.`}}const jx=eg,Mx=tg;o.object({state:o.enum(["ok","depleted","limit_reached","unverified","unknown","not_applicable"]),provider:o.string(),kind:o.enum(["balance","subscription","radient","none"]),model_free:o.boolean(),title:o.string(),body:o.string(),actions:o.array(o.object({id:o.enum(["open_url","resend_verification","refresh"]),label:o.string(),url:o.string().nullable().optional()})),resets_at_ms:o.number().int().nullable().optional(),checked_at_ms:o.number().int(),age_ms:o.number().int().nullable().optional(),source:o.enum(["cached","live"])});function Tg(e){return e.sessionId?{session_id:e.sessionId}:{...e.cwd?{cwd:e.cwd}:{},...e.target?{target:e.target}:{}}}function xc(e){return{...e.in!==void 0?{in:e.in}:{},...e.at!==void 0?{at:e.at}:{},...e.every!==void 0?{every:e.every}:{},...e.until!==void 0?{until:e.until}:{},...e.limit!==void 0?{limit:e.limit}:{}}}function is(e){return{...e.requestId?{request_id:e.requestId}:{},...e.subscribe!==void 0?{subscribe:e.subscribe}:{},...e.autoPush!==void 0?{auto_push:e.autoPush}:{},...e.confirmPublicEgress!==void 0?{confirm_public_egress:e.confirmPublicEgress}:{}}}function ss(e){if(e.visibility==="org"!=!!e.tenantId)throw new Error('A publication target needs both `visibility: "org"` and `tenantId`, or neither: one half would publish to the public hub.')}function Ic(e){return{sources:e.sources??null,session_ids:e.sessionIds??{},all:e.all??!1,include_subagents:e.includeSubagents??!1,include_cleared_segments:e.includeClearedSegments??!1,include_memory:e.includeMemory??!0,include_instructions:e.includeInstructions??!0,...e.maxSessions===void 0?{}:{max_sessions:e.maxSessions}}}function Kr(e){const t=new URLSearchParams;return e.tenant_id&&t.set("tenant_id",e.tenant_id),e.expected_account_id&&t.set("expected_account_id",e.expected_account_id),t.size?`?${t.toString()}`:""}function os(e){return e===void 0?"":`?tenant_id=${encodeURIComponent(e)}`}function Cg(e){switch(e.op){case"capabilities":return{path:"/v1/capabilities",method:"GET"};case"runtimes.list":return{path:"/v1/desktop/runtimes?probe=false",method:"GET"};case"peers.list":return{path:"/v1/desktop/peers",method:"GET"};case"networks.list":return{path:"/v1/desktop/networks",method:"GET"};case"asks.list":return{path:"/v1/desktop/asks",method:"GET"};case"networks.invite":return{path:`/v1/desktop/networks/${encodeURIComponent(e.networkId)}/invite`,method:"POST",body:{role:e.role,device:e.deviceId??null}};case"networks.member.remove":return{path:`/v1/desktop/networks/${encodeURIComponent(e.networkId)}/members/${encodeURIComponent(e.deviceId)}`,method:"DELETE",body:{confirm:e.confirm}};case"sessions.transfer":return{path:`/v1/desktop/sessions/${encodeURIComponent(e.sessionId)}/transfer`,method:"POST",body:{to:e.to,keep:e.keep??!1,wait_s:e.waitS??0,...e.requestId?{request_id:e.requestId}:{}}};case"approvals.list":return{path:"/v1/desktop/approvals",method:"GET"};case"approvals.approve":return{path:`/v1/desktop/approvals/${encodeURIComponent(e.approvalId)}/approve`,method:"POST"};case"approvals.deny":return{path:`/v1/desktop/approvals/${encodeURIComponent(e.approvalId)}/deny`,method:"POST"};case"profiles.list":return{path:"/v1/desktop/profiles",method:"GET"};case"profiles.get":return{path:`/v1/desktop/profiles/${encodeURIComponent(e.name)}`,method:"GET"};case"profiles.install":return{path:"/v1/desktop/profiles/install",method:"POST",body:{request_id:e.requestId,name:e.name}};case"imports.sources":return{path:"/v1/desktop/imports/sources",method:"GET"};case"imports.sessions":{const t=new URLSearchParams({source:e.source});return e.includeSubagents&&t.set("include_subagents","true"),{path:`/v1/desktop/imports/sessions?${t.toString()}`,method:"GET"}}case"imports.preview":return{path:"/v1/desktop/imports/preview",method:"POST",body:Ic(e)};case"imports.start":return{path:"/v1/desktop/imports/jobs",method:"POST",body:Ic(e)};case"imports.status":return{path:`/v1/desktop/imports/jobs/${encodeURIComponent(e.jobId)}`,method:"GET"};case"imports.cancel":return{path:`/v1/desktop/imports/jobs/${encodeURIComponent(e.jobId)}`,method:"DELETE"};case"profiles.create":return{path:"/v1/desktop/profiles",method:"POST",body:{request_id:e.requestId,name:e.name,...e.fields}};case"profiles.update":return{path:`/v1/desktop/profiles/${encodeURIComponent(e.name)}`,method:"PATCH",body:{request_id:e.requestId,...e.fields,...e.expectedDefinitionRevision!==void 0&&e.expectedDefinitionRevision!==null?{expected_definition_revision:e.expectedDefinitionRevision}:{}}};case"hub.updates":return{path:"/v1/desktop/hub/updates",method:"GET"};case"hub.skillPull":return{path:"/v1/desktop/hub/skills/pull",method:"POST",body:{request_id:e.requestId,hub_id:e.hubId,hub_source:e.hubSource,visibility:e.visibility,tenant_id:e.tenantId,local_alias:e.localAlias,...e.subscribe!==void 0?{subscribe:e.subscribe}:{},...e.autoPush!==void 0?{auto_push:e.autoPush}:{},...e.confirmPublicEgress!==void 0?{confirm_public_egress:e.confirmPublicEgress}:{}}};case"hub.skillSubscribe":return{path:"/v1/desktop/hub/skills/subscribe",method:"POST",body:{request_id:e.requestId,hub_id:e.hubId,hub_source:e.hubSource,visibility:e.visibility,tenant_id:e.tenantId,local_alias:e.localAlias}};case"hub.skillUnpull":return{path:"/v1/desktop/hub/skills/unpull",method:"POST",body:{request_id:e.requestId,link_id:e.linkId}};case"hub.skillPublish":return{path:"/v1/desktop/hub/skills/publish",method:"POST",body:{request_id:e.requestId,dry_run:e.dryRun,source_skill:e.sourceSkill,local_alias:e.localAlias,visibility:e.visibility,tenant_id:e.tenantId,subscribe:e.subscribe,auto_push:e.autoPush,confirm_public_egress:e.confirmPublicEgress,...e.previewReceipt?{preview_receipt:e.previewReceipt}:{},...e.confirmPublish?{confirm_publish:!0}:{}}};case"hub.links":return{path:`/v1/desktop/hub/links${e.kind?`?kind=${e.kind}`:""}`,method:"GET"};case"hub.policy":return{path:`/v1/desktop/hub/links/${encodeURIComponent(e.linkId)}`,method:"PATCH",body:{request_id:e.requestId,expected_policy_revision:e.expectedPolicyRevision,...e.subscribe!==void 0?{subscribe:e.subscribe}:{},...e.autoPush!==void 0?{auto_push:e.autoPush}:{},...e.confirmPublicEgress!==void 0?{confirm_public_egress:e.confirmPublicEgress}:{}}};case"hub.check":return{path:"/v1/desktop/hub/updates/check",method:"POST",body:{request_id:e.requestId,...e.kind?{kind:e.kind}:{},...e.name?{name:e.name}:{},...e.localId?{local_id:e.localId}:{}}};case"hub.apply":return{path:"/v1/desktop/hub/updates/apply",method:"POST",body:{request_id:e.requestId,...e.kind?{kind:e.kind}:{},...e.name?{name:e.name}:{},...e.localId?{local_id:e.localId}:{},...e.prefer?{prefer:e.prefer}:{},...e.acknowledgeUnknownBaseline!==void 0?{acknowledge_unknown_baseline:e.acknowledgeUnknownBaseline}:{},...e.dryRun!==void 0?{dry_run:e.dryRun}:{},...e.resolveSource===!0?{resolve_source:!0,hub_source:e.hubSource,visibility:e.visibility,tenant_id:e.tenantId??null}:{}}};case"hub.applyAll":return{path:"/v1/desktop/hub/updates/apply-all",method:"POST",body:{request_id:e.requestId,...e.kind?{kind:e.kind}:{}}};case"hub.retry":return{path:"/v1/desktop/hub/updates/retry",method:"POST",body:{request_id:e.requestId,...e.kind?{kind:e.kind}:{},...e.name?{name:e.name}:{},...e.localId?{local_id:e.localId}:{}}};case"hub.push":return{path:"/v1/desktop/hub/updates/push",method:"POST",body:{request_id:e.requestId,link_id:e.linkId,direction:e.direction,dry_run:e.dryRun,...e.previewReceipt?{preview_receipt:e.previewReceipt}:{},...e.confirmPublish?{confirm_publish:!0}:{}}};case"teams.list":return{path:"/v1/desktop/teams",method:"GET"};case"teams.get":return{path:`/v1/desktop/teams/${encodeURIComponent(e.name)}`,method:"GET"};case"teams.effective":return{path:`/v1/desktop/teams/${encodeURIComponent(e.name)}/effective`,method:"GET"};case"teams.create":return{path:"/v1/desktop/teams",method:"POST",body:{request_id:e.requestId,...e.fields}};case"teams.update":return{path:`/v1/desktop/teams/${encodeURIComponent(e.name)}`,method:"PATCH",body:{request_id:e.requestId,...e.fields,...e.expectedDefinitionRevision!==void 0&&e.expectedDefinitionRevision!==null?{expected_definition_revision:e.expectedDefinitionRevision}:{}}};case"sessions.list":{const t=new URLSearchParams;return t.set("limit",String(e.limit??100)),e.include_archived&&t.set("include_archived","true"),e.scope_kind&&t.set("scope_kind",e.scope_kind),e.scope_name&&t.set("scope_name",e.scope_name),e.cursor&&t.set("cursor",e.cursor),e.with_counts&&t.set("with_counts","true"),e.include_peers&&t.set("include_peers","true"),e.sort&&t.set("sort",e.sort),{path:`/v1/desktop/sessions?${t}`,method:"GET"}}case"delegated_cleanup_notice.ack":return{path:"/v1/desktop/delegated-cleanup-notice/ack",method:"POST"};case"sessions.search":{const t=new URLSearchParams({q:e.q,limit:String(e.limit??am)});return e.include_archived&&t.set("include_archived","true"),{path:`/v1/desktop/sessions/search?${t}`,method:"GET"}}case"sessions.archive":return{path:`/v1/desktop/sessions/${e.sessionId}/archive`,method:"POST",body:{archived:e.archived}};case"sessions.delete":return{path:`/v1/desktop/sessions/${e.sessionId}`,method:"DELETE",body:{confirmed:!0}};case"sessions.create":return{path:"/v1/desktop/sessions",method:"POST",body:{request_id:e.requestId,...e.cwd!==void 0?{cwd:e.cwd}:{},...e.peer?{peer:e.peer}:{},...e.target?{target:e.target}:{},...e.model?{model:e.model}:{},...e.draftId?{draft_id:e.draftId}:{},...e.purpose?{purpose:e.purpose}:{}}};case"sessions.preview":return{path:"/v1/desktop/sessions/preview",method:"POST",body:{request_id:e.requestId,cwd:e.cwd,...e.target?{target:e.target}:{},...e.model?{model:e.model}:{}}};case"sessions.draft":return{path:"/v1/desktop/sessions/draft",method:"POST",body:{request_id:e.requestId,cwd:e.cwd,...e.target?{target:e.target}:{},...e.model?{model:e.model}:{}}};case"sessions.get":{const t=new URLSearchParams;return e.journalOrder&&(t.set("journal_order","1"),e.peerJournalSource&&t.set("peer_journal_source","1"),ui(t,`/v1/desktop/sessions/${e.sessionId}`,e.orderIds??[])),{path:`/v1/desktop/sessions/${e.sessionId}${t.size?`?${t}`:""}`,method:"GET"}}case"sessions.files":{const t=new URLSearchParams({limit:String(e.limit??200)});for(const n of["scope","kind","q","sort","order","cursor"]){const r=e[n];r!==void 0&&t.set(n,r)}return{path:`/v1/desktop/sessions/${encodeURIComponent(e.sessionId)}/files?${t}`,method:"GET"}}case"sessions.files.materialise":return{path:`/v1/desktop/sessions/${encodeURIComponent(e.sessionId)}/files/${encodeURIComponent(e.fileId)}/materialise`,method:"POST"};case"sessions.userAttachments":return{path:`/v1/desktop/sessions/${encodeURIComponent(e.sessionId)}/user-attachments`,method:"GET"};case"sessions.userAttachments.materialise":return{path:`/v1/desktop/sessions/${encodeURIComponent(e.sessionId)}/user-attachments/${encodeURIComponent(e.digest)}/materialise`,method:"POST"};case"sessions.history":{const t=new URLSearchParams({limit:String(e.limit??100)});return e.beforeId&&t.set("before_id",e.beforeId),e.openFrame&&(t.set("open_frame","1"),t.set("supplements","1")),e.journalOrder&&(t.set("journal_order","1"),e.peerJournalSource&&t.set("peer_journal_source","1"),e.sourceRead==="metadata"?t.set("source_read","metadata"):e.sourceRead==="payload"&&e.expectedJournalGeneration&&t.set("source_read","payload"),e.expectedJournalGeneration&&t.set("expected_journal_generation",e.expectedJournalGeneration),ui(t,`/v1/desktop/sessions/${e.sessionId}/history`,e.orderIds??[])),{path:`/v1/desktop/sessions/${e.sessionId}/history?${t}`,method:"GET"}}case"sessions.checkpoints":return{path:`/v1/desktop/sessions/${e.sessionId}/checkpoints`,method:"GET"};case"sessions.checkpoints.warm":return{path:`/v1/desktop/sessions/${e.sessionId}/checkpoints/warm`,method:"POST",body:{...e.ids?{ids:e.ids}:{},...e.limit!==void 0?{limit:e.limit}:{}}};case"sessions.find":{const t=new URLSearchParams({q:e.q,limit:String(e.limit??lm)});return{path:`/v1/desktop/sessions/${e.sessionId}/find?${t}`,method:"GET"}}case"subagents.transcript":{const t=new URLSearchParams({limit:String(e.limit??100)});return e.beforeId&&t.set("before_id",e.beforeId),{path:`/v1/desktop/sessions/${e.sessionId}/children/${e.childId}/transcript?${t}`,method:"GET"}}case"sessions.message":return{path:`/v1/desktop/sessions/${e.sessionId}/messages`,method:"POST",body:{request_id:e.requestId,text:e.text,images:e.images??[],...e.files?.length?{files:e.files}:{},mode:e.mode??"prompt",...e.inputMode?{input_mode:e.inputMode}:{},...e.inputPath?{input_path:e.inputPath}:{}}};case"sessions.command":return{path:`/v1/desktop/sessions/${e.sessionId}/commands`,method:"POST",body:{request_id:e.requestId,command:e.command,args:e.args??"",images:e.images??[]}};case"sessions.answer":return e.askId!==void 0?{path:`/v1/desktop/sessions/${e.sessionId}/answers`,method:"POST",body:{ask_id:e.askId,answers:e.answers,decline:e.decline,...e.revise===!0?{revise:!0}:{},...e.dismiss===!0?{dismiss:!0,...e.reason!==void 0?{reason:e.reason}:{}}:{}}}:{path:`/v1/desktop/sessions/${e.sessionId}/answers`,method:"POST",body:{epoch:e.epoch,request_id:e.requestId,value:e.value,approved:e.approved,question_index:e.questionIndex}};case"sessions.seen":return{path:`/v1/desktop/sessions/${e.sessionId}/seen`,method:"POST",body:{completion_token:e.completionToken}};case"attention.seen":return{path:"/v1/desktop/attention/seen",method:"POST",body:{items:e.items.map(t=>({session_id:t.sessionId,completion_token:t.completionToken}))}};case"sessions.notified":return{path:`/v1/desktop/sessions/${e.sessionId}/notified`,method:"POST",body:{completion_token:e.completionToken}};case"tags.list":return{path:"/v1/desktop/tags",method:"GET"};case"tags.replace":return{path:"/v1/desktop/tags",method:"PUT",body:{tags:e.tags}};case"sessions.tags":return{path:`/v1/desktop/sessions/${e.sessionId}/tags`,method:"PUT",body:{tags:e.tags,primary:e.primary,...e.expected_revision===void 0?{}:{expected_revision:e.expected_revision}}};case"sessions.pin":return{path:`/v1/desktop/sessions/${e.sessionId}/pin`,method:"POST",body:{pinned:e.pinned}};case"sessions.watch":return{path:`/v1/desktop/sessions/${e.sessionId}/watch`,method:"POST",body:{subscription_id:e.subscriptionId,visible:e.visible,can_notify:e.canNotify}};case"sessions.presence":return{path:"/v1/desktop/presence",method:"POST",body:{subscription_id:e.subscriptionId,can_notify_kinds:e.canNotifyKinds,session_id:e.sessionId,window:e.window,can_notify:e.canNotify}};case"sessions.move":return{path:`/v1/desktop/sessions/${e.sessionId}/working-directory`,method:"POST",body:{request_id:e.requestId,cwd:e.cwd}};case"sessions.warm":return{path:`/v1/desktop/sessions/${e.sessionId}/warm`,method:"POST",body:{}};case"sessions.interrupt":return{path:`/v1/desktop/sessions/${e.sessionId}/interrupt`,method:"POST",body:{request_id:e.requestId}};case"supplements.cancel":return{path:`/v1/desktop/sessions/${e.sessionId}/supplements/${e.job}/cancel`,method:"POST",body:{anchor:e.anchor}};case"supplements.restart":return{path:`/v1/desktop/sessions/${e.sessionId}/supplements/${e.job}/restart`,method:"POST",body:{anchor:e.anchor}};case"supplements.steer":return{path:`/v1/desktop/sessions/${e.sessionId}/supplements/${e.job}/steer`,method:"POST",body:{anchor:e.anchor,text:e.text}};case"sessions.variables.list":return{path:`/v1/desktop/sessions/${e.sessionId}/variables`,method:"GET"};case"sessions.variables.create":return{path:`/v1/desktop/sessions/${e.sessionId}/variables`,method:"POST",body:{key:e.key,value:e.value,type:e.type}};case"sessions.variables.update":return{path:`/v1/desktop/sessions/${e.sessionId}/variables/${encodeURIComponent(e.key)}`,method:"PATCH",body:{value:e.value,type:e.type}};case"sessions.variables.delete":return{path:`/v1/desktop/sessions/${e.sessionId}/variables/${encodeURIComponent(e.key)}`,method:"DELETE"};case"legacy.models":{const t=new URLSearchParams;return e.provider&&t.set("provider",e.provider),e.sort&&t.set("sort",e.sort),e.direction&&t.set("direction",e.direction),{path:t.size>0?`/v1/models?${t}`:"/v1/models",method:"GET"}}case"legacy.models.providers":return{path:"/v1/models/providers",method:"GET"};case"auth.probe":return{path:`/v1/auth/providers/${e.provider}/probe`,method:"POST"};case"legacy.agent.upload":return{path:`/v1/agents/${e.agentId}/upload`,method:"POST"};case"agent.publish":{ss(e);const t=new URLSearchParams;e.visibility==="org"&&e.tenantId&&(t.set("visibility","org"),t.set("tenant_id",e.tenantId));const n=t.toString();return{path:`/v1/agents/${e.agentId}/publish${n?`?${n}`:""}`,method:"POST",body:{document:e.document??{},...is(e)}}}case"agent.republish":{ss(e);const t=new URLSearchParams;e.visibility==="org"&&e.tenantId&&(t.set("visibility","org"),t.set("tenant_id",e.tenantId));const n=t.toString();return{path:`/v1/agents/${e.agentId}/publish${n?`?${n}`:""}`,method:"PUT",body:{hub_agent_id:e.hubAgentId,document:e.document??{},...is(e),...e.expectedRemoteRevision?{expected_remote_revision:e.expectedRemoteRevision}:{}}}}case"team.publish":{ss(e);const t=new URLSearchParams;return e.visibility==="org"&&e.tenantId&&(t.set("visibility","org"),t.set("tenant_id",e.tenantId)),{path:`/v1/teams/${e.teamId}/publish${t.size?`?${t}`:""}`,method:"POST",body:is(e)}}case"team.pull":{const t=new URLSearchParams;e.tenantId&&t.set("tenant_id",e.tenantId);const n=t.toString();return{path:`/v1/teams/pull/${e.teamId}${n?`?${n}`:""}`,method:"GET"}}case"agent.nameAvailability":return{path:`/v1/agent-name-availability?${new URLSearchParams({name:e.name})}`,method:"GET"};case"legacy.agents.list":{const t=new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)});return e.name&&t.set("name",e.name),e.sort&&t.set("sort",e.sort),e.direction&&t.set("direction",e.direction),{path:`/v1/agents?${t}`,method:"GET"}}case"legacy.agent.get":return{path:`/v1/agents/${e.agentId}`,method:"GET"};case"legacy.agent.history":{const t=new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)});return{path:`/v1/agents/${e.agentId}/history?${t}`,method:"GET"}}case"wakes.list":{const t=new URLSearchParams;return e.limit!==void 0&&t.set("limit",String(e.limit)),e.includeDormant!==void 0&&t.set("include_dormant",String(e.includeDormant)),{path:t.size>0?`/v1/desktop/wakes?${t}`:"/v1/desktop/wakes",method:"GET"}}case"wakes.create":return{path:"/v1/desktop/wakes",method:"POST",body:{request_id:e.requestId,...Tg(e),message:e.message,...xc(e)}};case"wakes.edit":return{path:`/v1/desktop/wakes/${e.sessionId}/${e.wakeId}`,method:"PATCH",body:{...e.message!==void 0?{message:e.message}:{},...xc(e)}};case"wakes.remove":return{path:`/v1/desktop/wakes/${e.sessionId}/${e.wakeId}`,method:"DELETE"};case"monitors.cancel":return{path:`/v1/desktop/monitors/${encodeURIComponent(e.sessionId)}/${encodeURIComponent(e.monitorId)}`,method:"DELETE"};case"jobs.cancel":return{path:`/v1/desktop/sessions/${encodeURIComponent(e.sessionId)}/jobs/${encodeURIComponent(e.jobId)}/cancel`,method:"POST"};case"legacy.jobs.list":{const t=new URLSearchParams;return e.agentId&&t.set("agent_id",e.agentId),e.status&&t.set("status",e.status),{path:t.size>0?`/v1/jobs?${t}`:"/v1/jobs",method:"GET"}}case"legacy.job.get":return{path:`/v1/jobs/${e.jobId}`,method:"GET"};case"legacy.schedules.list":return{path:`/v1/schedules?${new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)})}`,method:"GET"};case"legacy.agent.schedules.list":{const t=new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)});return{path:`/v1/agents/${e.agentId}/schedules?${t}`,method:"GET"}}case"legacy.agent.schedule.create":return{path:`/v1/agents/${e.agentId}/schedules`,method:"POST",body:e.schedule};case"legacy.schedule.get":return{path:`/v1/schedules/${e.scheduleId}`,method:"GET"};case"legacy.schedule.edit":return{path:`/v1/schedules/${e.scheduleId}`,method:"PATCH",body:e.schedule};case"legacy.schedule.remove":return{path:`/v1/schedules/${e.scheduleId}`,method:"DELETE"};case"legacy.agent.create":return{path:"/v1/agents",method:"POST",body:e.agent};case"legacy.agent.update":return{path:`/v1/agents/${e.agentId}`,method:"PATCH",body:e.update};case"legacy.agent.delete":return{path:`/v1/agents/${e.agentId}`,method:"DELETE"};case"legacy.agent.conversation.clear":return{path:`/v1/agents/${e.agentId}/conversation`,method:"DELETE"};case"legacy.agent.systemPrompt.get":return{path:`/v1/agents/${e.agentId}/system-prompt`,method:"GET"};case"legacy.agent.systemPrompt.update":return{path:`/v1/agents/${e.agentId}/system-prompt`,method:"PUT",body:{system_prompt:e.systemPrompt}};case"legacy.agent.download":return{path:`/v1/agents/${e.agentId}/download`,method:"GET"};case"legacy.job.cancel":return{path:`/v1/jobs/${e.jobId}`,method:"DELETE"};case"commands.list":return{path:"/v1/desktop/commands",method:"GET"};case"commands.entities":return{path:`/v1/desktop/sessions/${e.sessionId}/command-entities?command=${encodeURIComponent(e.command)}${e.name?`&name=${encodeURIComponent(e.name)}`:""}`,method:"GET"};case"models.catalogue":{const t=e.scope?`&scope=${e.scope}`:"";return{path:`/v1/desktop/models?live=${e.live??!1}${t}`,method:"GET"}}case"usage.get":{const t=new URLSearchParams({live:String(e.live??!1),refresh:String(e.refresh??!1)});return e.provider&&t.set("provider",e.provider),{path:`/v1/desktop/usage?${t}`,method:"GET"}}case"quota.notice":{const t=new URLSearchParams({refresh:String(e.refresh??!1)});return e.provider&&t.set("provider",e.provider),e.model&&t.set("model",e.model),{path:`/v1/desktop/quota-notice?${t}`,method:"GET"}}case"analytics.get":{const t=new URLSearchParams({days:String(e.days??30)});return e.sessionId&&t.set("session_id",e.sessionId),e.sinceMs!==void 0&&t.set("since_ms",String(e.sinceMs)),e.untilMs!==void 0&&t.set("until_ms",String(e.untilMs)),{path:`/v1/desktop/analytics?${t}`,method:"GET"}}case"analytics.models":{const t=new URLSearchParams({days:String(e.days??30)});return e.sessionId&&t.set("session_id",e.sessionId),e.sinceMs!==void 0&&t.set("since_ms",String(e.sinceMs)),e.untilMs!==void 0&&t.set("until_ms",String(e.untilMs)),{path:`/v1/desktop/analytics/models?${t}`,method:"GET"}}case"info.get":return{path:"/v1/desktop/info",method:"GET"};case"sessions.report":{const t=new URLSearchParams({recent_limit:String(e.recentLimit??12)});return{path:`/v1/desktop/sessions/${e.sessionId}/report?${t}`,method:"GET"}}case"skills.list":{const t=new URLSearchParams;e.sessionId&&t.set("session_id",e.sessionId),e.cwd&&t.set("cwd",e.cwd),e.name&&t.set("name",e.name);const n=t.toString();return{path:`/v1/desktop/skills${n?`?${n}`:""}`,method:"GET"}}case"skills.create":return{path:"/v1/desktop/skills",method:"POST",body:{request_id:e.requestId,name:e.name,copy_from:e.copyFrom}};case"skills.update":return{path:`/v1/desktop/skills/${encodeURIComponent(e.name)}`,method:"PUT",body:{request_id:e.requestId,expected_fingerprint:e.expectedFingerprint,files:e.files}};case"skills.remove":return{path:`/v1/desktop/skills/${encodeURIComponent(e.name)}`,method:"DELETE",body:{request_id:e.requestId,discard_local_changes:e.discardLocalChanges}};case"sessions.failovers":return{path:`/v1/desktop/sessions/${e.sessionId}/failovers`,method:"GET"};case"sessions.credential":return{path:`/v1/desktop/sessions/${e.sessionId}/credentials`,method:"POST",body:{action:e.action,key:e.key,value:e.value,confirmed:e.confirmed}};case"sessions.fork":return{path:`/v1/desktop/sessions/${e.sessionId}/fork`,method:"POST",body:{request_id:e.requestId,message:e.message,boundary:e.boundary,entry_id:e.entryId,auto_tag:e.autoTag}};case"sessions.stop":return{path:"/v1/desktop/stop",method:"POST",body:{request_id:e.requestId,targets:e.targets,confirmed:e.confirmed}};case"sessions.aside":return{path:`/v1/desktop/sessions/${e.sessionId}/asides`,method:"POST",body:{request_id:e.requestId,text:e.text,aside_id:e.asideId,subscription_id:e.subscriptionId}};case"sessions.adopt":return{path:`/v1/desktop/sessions/${e.sessionId}/asides/${e.asideId}/adopt`,method:"POST",body:{request_id:e.requestId,confirmed:e.confirmed}};case"sessions.aside.get":case"sessions.aside.close":return{path:`/v1/desktop/sessions/${e.sessionId}/asides/${e.asideId}`,method:e.op==="sessions.aside.get"?"GET":"DELETE"};case"mcp.list":return{path:`/v1/desktop/sessions/${e.sessionId}/mcp`,method:"GET"};case"mcp.credentials.store":return{path:`/v1/desktop/sessions/${e.sessionId}/mcp/credentials`,method:"POST",body:{name:e.name,values:e.values,confirmed_replace:e.confirmedReplace}};case"mcp.control":return{path:`/v1/desktop/sessions/${e.sessionId}/mcp`,method:"POST",body:e.control};case"mcp.catalog":{const t=new URLSearchParams;e.cwd&&t.set("cwd",e.cwd),e.sessionId&&t.set("session_id",e.sessionId);const n=t.toString();return{path:n?`/v1/desktop/mcp?${n}`:"/v1/desktop/mcp",method:"GET"}}case"mcp.catalog.control":return{path:"/v1/desktop/mcp",method:"POST",body:{...e.control,...e.cwd?{cwd:e.cwd}:{}}};case"mcp.catalog.credentials":return{path:"/v1/desktop/mcp/credentials",method:"POST",body:{name:e.name,values:e.values,...e.header?{header:e.header}:{},confirmed_replace:e.confirmedReplace,...e.cwd?{cwd:e.cwd}:{}}};case"radient.request":return{path:"/v1/desktop/radient",method:"POST",body:e.control};case"providers.list":return{path:"/v1/auth/providers",method:"GET"};case"accounts.list":return{path:"/v1/auth/status",method:"GET"};case"accounts.remove":return{path:`/v1/auth/accounts/${e.accountId}`,method:"DELETE"};case"tunnel.setup.read":return{path:e.credentialId===void 0?"/v1/desktop/tunnel/setup":`/v1/desktop/tunnel/setup?credential_id=${e.credentialId}`,method:"GET"};case"tunnel.setup.plan":return{path:"/v1/desktop/tunnel/setup",method:"POST",body:{action:"plan",...e.credentialId!==void 0?{credential_id:e.credentialId}:{}}};case"tunnel.setup.run":return{path:"/v1/desktop/tunnel/setup",method:"POST",body:{action:"run",credential_id:e.credentialId,...e.acceptMonthlyPrice!==void 0?{accept_monthly_price:e.acceptMonthlyPrice}:{}}};case"auth.start":return{path:"/v1/auth/login",method:"POST",body:{provider:e.provider}};case"auth.status":return{path:`/v1/auth/operations/${e.id}`,method:"GET"};case"auth.input":return{path:`/v1/auth/operations/${e.id}/input`,method:"POST",body:{prompt_id:e.promptId,value:e.value}};case"auth.cancel":return{path:`/v1/auth/operations/${e.id}`,method:"DELETE"};case"auth.key":return{path:`/v1/auth/providers/${e.provider}/key`,method:"PUT",body:{value:e.value}};case"auth.logout":return{path:`/v1/auth/providers/${e.provider}/credentials`,method:"DELETE"};case"agent_messages.status":return{path:`/v1/desktop/team-bridge/status?boundary=${e.boundary}`,method:"GET"};case"agent_messages.enable":return{path:"/v1/desktop/team-bridge/settings",method:"PUT",body:{expected_account_id:e.expected_account_id,tenant_id:e.tenant_id,state:e.state,consent_version:e.consent_version,consented_via:e.consented_via}};case"agent_messages.settings":return{path:`/v1/desktop/team-bridge/settings${os(e.tenant_id)}`,method:"GET"};case"agent_messages.settings.put":return{path:"/v1/desktop/team-bridge/settings",method:"PUT",body:{expected_account_id:e.expected_account_id,...e.tenant_id===void 0?{}:{tenant_id:e.tenant_id},...e.consent_version===void 0?{}:{consent_version:e.consent_version},...e.consented_via===void 0?{}:{consented_via:e.consented_via},...e.label===void 0?{}:{label:e.label},state:e.state}};case"agent_messages.onboarding.dismiss":return{path:"/v1/desktop/team-bridge/onboarding/dismiss",method:"POST"};case"agent_messages.allowlist.get":return{path:`/v1/desktop/team-bridge/allowlist${os(e.tenant_id)}`,method:"GET"};case"agent_messages.allowlist.put":return{path:"/v1/desktop/team-bridge/allowlist",method:"PUT",body:{expected_account_id:e.expected_account_id,...e.tenant_id===void 0?{}:{tenant_id:e.tenant_id},entries:e.entries}};case"team_bridge.conversations.list":{const t=new URLSearchParams;return e.scope==="account"&&t.set("scope","account"),e.tenant_id&&t.set("tenant_id",e.tenant_id),e.limit!==void 0&&t.set("limit",String(e.limit)),e.cursor&&t.set("cursor",e.cursor),e.before&&t.set("before",e.before),e.status&&t.set("status",e.status),{path:`/v1/desktop/team-bridge/conversations${t.size>0?`?${t.toString()}`:""}`,method:"GET"}}case"team_bridge.conversations.get":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}${os(e.tenant_id)}`,method:"GET"};case"team_bridge.conversations.create":return{path:"/v1/desktop/team-bridge/conversations",method:"POST",body:{...e.expected_account_id?{expected_account_id:e.expected_account_id}:{},...e.tenant_id?{tenant_id:e.tenant_id}:{},kind:e.kind,...e.name?{name:e.name}:{},...e.topic?{topic:e.topic}:{},...e.visibility?{visibility:e.visibility}:{},...e.agent_capable===void 0?{}:{agent_capable:e.agent_capable},members:e.members}};case"team_bridge.conversations.lifecycle":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/${e.action}${e.action==="join"?"":Kr(e)}`,method:"POST",...e.action==="join"&&(e.tenant_id||e.expected_account_id)?{body:{...e.tenant_id?{tenant_id:e.tenant_id}:{},...e.expected_account_id?{expected_account_id:e.expected_account_id}:{}}}:{}};case"team_bridge.conversations.join":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/join`,method:"POST",...e.tenant_id||e.expected_account_id?{body:{...e.tenant_id?{tenant_id:e.tenant_id}:{},...e.expected_account_id?{expected_account_id:e.expected_account_id}:{}}}:{}};case"team_bridge.conversations.notify":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/read`,method:"POST",body:{...e.expected_account_id?{expected_account_id:e.expected_account_id}:{},...e.tenant_id?{tenant_id:e.tenant_id}:{},notify:e.notify}};case"team_bridge.conversations.agent_notify":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/agent-notify`,method:"PUT",body:{...e.expected_account_id?{expected_account_id:e.expected_account_id}:{},...e.tenant_id?{tenant_id:e.tenant_id}:{},notify:e.notify}};case"team_bridge.conversations.members.add":{const t=new URLSearchParams;e.tenant_id&&t.set("tenant_id",e.tenant_id),e.expected_account_id&&t.set("expected_account_id",e.expected_account_id);const n=t.size>0?`?${t.toString()}`:"";return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/members${n}`,method:"POST",body:e.members}}case"team_bridge.conversations.delete":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}${Kr(e)}`,method:"DELETE"};case"team_bridge.conversations.members.remove":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/members/${encodeURIComponent(e.account_id)}${Kr(e)}`,method:"DELETE"};case"team_bridge.conversations.consent":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/members/${encodeURIComponent(e.account_id)}/consent`,method:"POST",body:{...e.expected_account_id?{expected_account_id:e.expected_account_id}:{},...e.tenant_id?{tenant_id:e.tenant_id}:{},decision:e.decision,consent_version:e.consent_version}};case"team_bridge.owner_audit.conversations":case"team_bridge.owner_audit.messages":case"team_bridge.owner_audit.replies":{const t=new URLSearchParams({expected_account_id:e.expected_account_id,tenant_id:e.tenant_id});e.limit!==void 0&&t.set("limit",String(e.limit));let n="/v1/desktop/team-bridge/owner-audit/conversations";return e.op==="team_bridge.owner_audit.conversations"?e.cursor!==void 0&&t.set("cursor",e.cursor):(n+=`/${encodeURIComponent(e.conversation_id)}/messages`,e.op==="team_bridge.owner_audit.messages"?e.before_seq!==void 0&&t.set("before_seq",String(e.before_seq)):(n+=`/${encodeURIComponent(e.message_id)}/replies`,e.after_seq!==void 0&&t.set("after_seq",String(e.after_seq)))),{path:`${n}?${t}`,method:"GET"}}case"team_bridge.messages.list":{const t=new URLSearchParams;e.tenant_id&&t.set("tenant_id",e.tenant_id),e.limit!==void 0&&t.set("limit",String(e.limit)),e.before_seq!==void 0&&t.set("before_seq",String(e.before_seq)),e.endpoint_id&&t.set("endpoint_id",e.endpoint_id);const n=t.size>0?`?${t.toString()}`:"";return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/messages${n}`,method:"GET"}}case"team_bridge.reactions.toggle":{const t=`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/messages/${encodeURIComponent(e.message_id)}/reactions/${encodeURIComponent(e.emoji)}`;return e.active?{path:t,method:"PUT",body:{expected_account_id:e.expected_account_id,tenant_id:e.tenant_id}}:{path:`${t}${Kr(e)}`,method:"DELETE"}}case"team_bridge.messages.send":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/messages`,method:"POST",body:{...e.expected_account_id?{expected_account_id:e.expected_account_id}:{},...e.tenant_id?{tenant_id:e.tenant_id}:{},client_ref:e.client_ref,body:e.body,...e.agent_label?{agent_label:e.agent_label}:{},...e.thread_root_id?{thread_root_id:e.thread_root_id}:{},...e.attachment_ids?.length?{attachment_ids:e.attachment_ids}:{},...e.mentions?.length?{mentions:e.mentions}:{}}};case"team_bridge.scheduled.list":return{path:`/v1/desktop/team-bridge/scheduled?${new URLSearchParams({tenant_id:e.tenant_id})}`,method:"GET"};case"team_bridge.scheduled.create":return{path:"/v1/desktop/team-bridge/scheduled",method:"POST",body:{tenant_id:e.tenant_id,conversation_id:e.conversation_id,client_ref:e.client_ref,body:e.body,send_at:e.send_at,...e.attachment_ids?.length?{attachment_ids:e.attachment_ids}:{},...e.thread_root_id?{thread_root_id:e.thread_root_id}:{}}};case"team_bridge.scheduled.update":return{path:`/v1/desktop/team-bridge/scheduled/${encodeURIComponent(e.scheduled_id)}?${new URLSearchParams({tenant_id:e.tenant_id})}`,method:"PATCH",body:{...e.body===void 0?{}:{body:e.body},...e.send_at===void 0?{}:{send_at:e.send_at},...e.attachment_ids===void 0?{}:{attachment_ids:e.attachment_ids},...e.expected_version===void 0?{}:{expected_version:e.expected_version}}};case"team_bridge.attachments.delete":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/attachments/${encodeURIComponent(e.attachment_id)}?${new URLSearchParams({tenant_id:e.tenant_id,expected_account_id:e.expected_account_id})}`,method:"DELETE"};case"team_bridge.scheduled.cancel":return{path:`/v1/desktop/team-bridge/scheduled/${encodeURIComponent(e.scheduled_id)}?${new URLSearchParams({tenant_id:e.tenant_id})}`,method:"DELETE"};case"team_bridge.messages.replies":{const t=new URLSearchParams({expected_account_id:e.expected_account_id,tenant_id:e.tenant_id});e.limit!==void 0&&t.set("limit",String(e.limit)),e.after_seq!==void 0&&t.set("after_seq",String(e.after_seq));const n=t.size>0?`?${t.toString()}`:"";return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/messages/${encodeURIComponent(e.message_id)}/replies${n}`,method:"GET"}}case"team_bridge.read":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/read`,method:"POST",body:{...e.expected_account_id?{expected_account_id:e.expected_account_id}:{},...e.tenant_id?{tenant_id:e.tenant_id}:{},...e.seq===void 0?{}:{seq:e.seq},...e.muted===void 0?{}:{muted:e.muted}}};case"team_bridge.unread":{const t=new URLSearchParams;return e.scope==="account"?t.set("scope","account"):e.tenant_id&&t.set("tenant_id",e.tenant_id),{path:`/v1/desktop/team-bridge/unread${t.size>0?`?${t.toString()}`:""}`,method:"GET"}}case"team_bridge.directory":return{path:`/v1/desktop/team-bridge/directory?tenant_id=${encodeURIComponent(e.tenant_id)}`,method:"GET"};case"team_bridge.status":{const t=new URLSearchParams;return e.boundary&&t.set("boundary",e.boundary),{path:`/v1/desktop/team-bridge/status${t.size>0?`?${t.toString()}`:""}`,method:"GET"}}case"settings.list":return{path:"/v1/settings",method:"GET"};case"settings.edit":return{path:`/v1/settings/${e.key}`,method:"PATCH",body:{value:e.value,base:e.base}};case"settings.reset":return{path:`/v1/settings/${e.key}/reset`,method:"POST"};case"tts.paths":return{path:"/v1/tts/paths",method:"GET"};case"config.get":return{path:"/v1/config",method:"GET"};case"config.update":return{path:"/v1/config",method:"PATCH",body:e.value};case"instructions.get":return{path:"/v1/config/system-prompt",method:"GET"};case"instructions.update":return{path:"/v1/config/system-prompt",method:"PATCH",body:{content:e.content}};case"credentials.list":return{path:"/v1/credentials",method:"GET"};case"credentials.update":return{path:"/v1/credentials",method:"PATCH",body:{key:e.key,value:e.value}};case"library.list":{const t=new URLSearchParams;e.scope&&t.set("scope",e.scope),e.q&&t.set("q",e.q),e.category&&t.set("category",e.category),e.kind&&t.set("kind",e.kind),e.origin_group&&t.set("origin_group",e.origin_group),e.origin&&t.set("origin",e.origin),e.tag&&t.set("tag",e.tag),e.tag_mode&&t.set("tag_mode",e.tag_mode),e.highlighted!==void 0&&t.set("highlighted",e.highlighted?"1":"0"),e.organized!==void 0&&t.set("organized",e.organized?"1":"0"),e.favorite!==void 0&&t.set("favorite",e.favorite?"1":"0"),e.session&&t.set("session",e.session),e.session_id&&t.set("session_id",e.session_id),e.sort&&t.set("sort",e.sort),e.order&&t.set("order",e.order),e.limit!==void 0&&t.set("limit",String(e.limit)),e.cursor&&t.set("cursor",e.cursor);const n=t.toString();return{path:`/v1/desktop/library/assets${n?`?${n}`:""}`,method:"GET"}}case"library.get":return{path:`/v1/desktop/library/assets/${encodeURIComponent(e.id)}`,method:"GET"};case"library.update":return{path:`/v1/desktop/library/assets/${encodeURIComponent(e.id)}`,method:"PATCH",body:e.fields};case"library.tags":return{path:"/v1/desktop/library/tags",method:"GET"};case"library.tags.create":return{path:"/v1/desktop/library/tags",method:"POST",body:{name:e.name,...e.category!==void 0?{category:e.category}:{}}};case"library.tags.update":return{path:`/v1/desktop/library/tags/${encodeURIComponent(e.id)}`,method:"PATCH",body:{...e.name!==void 0?{name:e.name}:{},...e.category!==void 0?{category:e.category}:{}}};case"library.tags.delete":return{path:`/v1/desktop/library/tags/${encodeURIComponent(e.id)}`,method:"DELETE"};case"library.tags.merge":return{path:`/v1/desktop/library/tags/${encodeURIComponent(e.id)}/merge`,method:"POST",body:{into:e.into}};case"library.tags.assign":return{path:`/v1/desktop/library/assets/${encodeURIComponent(e.id)}/tags`,method:"PUT",body:{tags:e.tags,...e.primary!==void 0?{primary:e.primary}:{}}};case"library.chat.link":return{path:`/v1/desktop/library/assets/${encodeURIComponent(e.id)}/chat`,method:"PUT",body:{session_id:e.sessionId}};case"library.chat.clear":return{path:`/v1/desktop/library/assets/${encodeURIComponent(e.id)}/chat`,method:"DELETE"};case"library.librarian":{const t=e.action??"status";return t==="status"?{path:"/v1/desktop/librarian",method:"GET"}:{path:"/v1/desktop/librarian",method:"POST",body:{op:t}}}case"projects.list":return{path:"/v1/desktop/projects",method:"GET"};case"projects.get":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}`,method:"GET"};case"projects.create":return{path:"/v1/desktop/projects",method:"POST",body:{name:e.name,...e.description!==void 0?{description:e.description}:{},...e.status!==void 0?{status:e.status}:{},...e.tags!==void 0?{tags:e.tags}:{}}};case"projects.update":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}`,method:"PATCH",body:{...e.fields,...e.force_done===!0?{force_done:!0}:{}}};case"projects.delete":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}`,method:"DELETE",body:{confirm:e.confirmed_name}};case"projects.link":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/links`,method:"POST",body:{session_id:e.sessionId}};case"projects.unlink":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/links/${encodeURIComponent(e.sessionId)}`,method:"DELETE"};case"projects.milestone":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/milestones`,method:"POST",body:{name:e.name,...e.targetDate!==void 0?{target_date:e.targetDate}:{},...e.completed!==void 0?{completed:e.completed}:{}}};case"projects.milestone.remove":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/milestones/${encodeURIComponent(e.name)}`,method:"DELETE"};case"projects.request_update":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/request-update`,method:"POST"};case"projects.search":return{path:`/v1/desktop/projects/search?${new URLSearchParams({q:e.q,limit:String(e.limit??Bm)})}`,method:"GET"};case"aida.status":return{path:"/v1/desktop/aida",method:"GET"};case"aida.control":return{path:"/v1/desktop/aida",method:"POST",body:{op:e.action}};case"code_requests.list":return{path:`/v1/desktop/sessions/${e.sessionId}/code-requests`,method:"GET"};case"code_requests.refresh":return{path:`/v1/desktop/sessions/${e.sessionId}/code-requests/refresh`,method:"POST",body:{...e.keys!==void 0?{keys:e.keys}:{},...e.force!==void 0?{force:e.force}:{}}};case"static.sign":return{path:"/v1/static/sign",method:"POST",body:{route:e.route,path:e.path,ttl_s:e.ttlS}};case"sidebar_layout.get":return{path:"/v1/desktop/sidebar-layout",method:"GET"};case"sidebar_layout.set":return{path:"/v1/desktop/sidebar-layout",method:"PUT",body:{layout:e.layout}};case"notifications.list":{const t=new URLSearchParams;e.preview&&t.set("preview","true"),e.includeAskReads&&t.set("include_ask_reads","true");for(const n of e.countSessionIds??[])t.append("count_session_ids",n);return e.kind&&t.set("kind",e.kind),e.bulkPriority&&t.set("bulk_priority",e.bulkPriority),e.state&&t.set("state",e.state),e.source&&t.set("source",e.source),e.priority&&t.set("priority",e.priority),e.sessionId&&t.set("session_id",e.sessionId),e.cursor&&t.set("cursor",e.cursor),e.throughSeq!==void 0&&t.set("through_seq",String(e.throughSeq)),e.limit!==void 0&&t.set("limit",String(e.limit)),{path:`/v1/desktop/notifications${t.size?`?${t}`:""}`,method:"GET"}}case"notifications.get":return{path:`/v1/desktop/notifications/${encodeURIComponent(e.id)}`,method:"GET"};case"notifications.count":return{path:"/v1/desktop/notifications/count",method:"GET"};case"notifications.read":case"notifications.dismiss":return{path:"/v1/desktop/notifications",method:"PATCH",body:{op:e.verb,...Ag(e.target)}};case"notifications.seen":return{path:"/v1/desktop/notifications/seen",method:"POST",body:{items:e.items.map(t=>({id:t.id,revision:t.revision,anchor_id:t.anchorId,visible_since_ms:t.visibleSinceMs})),evidence:{surface:"desktop",session_id:e.evidence.sessionId,input_kind:Zm[e.evidence.inputKind],input_at_ms:e.evidence.inputAtMs,visible_since_ms:e.evidence.visibleSinceMs}}}}}function Ag(e){return"selectionToken"in e?{selection_token:e.selectionToken,...e.reconcileIds?{reconcile_ids:e.reconcileIds}:{},...e.excludedIds?{excluded_ids:e.excludedIds}:{}}:"operationToken"in e?{operation_token:e.operationToken,...e.reconcileIds?{reconcile_ids:e.reconcileIds}:{}}:"items"in e?{...e.receipt?{receipt:!0,through_seq:e.throughSeq,...e.reconcileIds?{reconcile_ids:e.reconcileIds}:{}}:{},ids:e.items.map(t=>({id:t.id,revision:t.revision}))}:"sessionId"in e?{session_id:e.sessionId,through_seq:e.throughSeq,observed:e.observed}:{all:!0,through_seq:e.throughSeq,observed:e.observed}}const Dx=64,Nx=64*1024*1024,Lx="superseded_completion_token",$x="store_busy",Og="session_is_remote",Pg="owner_build_behind";function Ux(e,t,n){if(!e||typeof e!="object")return!1;const r=e;return r.unseen===!1&&r.conversation_id===`session/${t}`&&r.completion_token===n}function wn(e,t,n){return!t||t.conversation_id!==`session/${n}`||!Array.isArray(t.revision)||t.revision.length!==2||!t.revision.every(r=>Number.isSafeInteger(r)&&r>=0)||e?.conversation_id===t.conversation_id&&(t.revision[0]<e.revision[0]||t.revision[1]<e.revision[1])?e:t.supported===void 0&&e?.supported!==void 0?{...t,supported:e.supported}:t}function jg(e){const t=Number(e);return Number.isFinite(t)&&t>0?Math.round(t*1e3):null}const Fx=e=>typeof e?.goal_status=="string",Bx=e=>(e?.goal??"").trim().length>0;function Mg(e,t,n={}){return!e||e.epoch!==t.epoch?!0:t.seq>e.seq||n.allowEqual===!0&&t.seq===e.seq}function Dg(e,t,n){return n.session_id!==t||n.payload.frontend.snapshot.session_id!==t||!e?!1:e.epoch===n.epoch&&n.seq>e.seq}const qn={notPaired:"This backend was not started with desktop controls.",serverDown:"The Local Operator server is not answering.",frameBudget:"The event stream exceeded its frame budget.",ended:"The event stream ended."};function Ng(e){return e?e===qn.notPaired?"notPaired":e===qn.serverDown?"serverDown":e===qn.frameBudget?"frameTooLarge":"lost":"lost"}const Rc=e=>{let t;const n=new Set,r=(d,u)=>{const f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){const p=t;t=u??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,p))}},i=()=>t,c={setState:r,getState:i,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d))},l=t=e(r,i,c);return c},Lg=e=>e?Rc(e):Rc,$g=e=>e;function Ug(e,t=$g){const n=Ma.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return Ma.useDebugValue(n),n}const Tc=e=>{const t=Lg(e),n=r=>Ug(t,r);return Object.assign(n,t),n},Cr=e=>e?Tc(e):Tc;function wd(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var s;const a=l=>l===null?null:JSON.parse(l,void 0),c=(s=n.getItem(i))!=null?s:null;return c instanceof Promise?c.then(a):a(c)},setItem:(i,s)=>n.setItem(i,JSON.stringify(s,void 0)),removeItem:i=>n.removeItem(i)}}const Ws=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Ws(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Ws(r)(n)}}}},Fg=(e,t)=>(n,r,i)=>{let s={storage:wd(()=>localStorage),partialize:m=>m,version:0,merge:(m,b)=>({...b,...m}),...t},a=!1;const c=new Set,l=new Set;let d=s.storage;if(!d)return e((...m)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...m)},r,i);const u=()=>{const m=s.partialize({...r()});return d.setItem(s.name,{state:m,version:s.version})},f=i.setState;i.setState=(m,b)=>{f(m,b),u()};const p=e((...m)=>{n(...m),u()},r,i);i.getInitialState=()=>p;let g;const y=()=>{var m,b;if(!d)return;a=!1,c.forEach(k=>{var E;return k((E=r())!=null?E:p)});const _=((b=s.onRehydrateStorage)==null?void 0:b.call(s,(m=r())!=null?m:p))||void 0;return Ws(d.getItem.bind(d))(s.name).then(k=>{if(k)if(typeof k.version=="number"&&k.version!==s.version){if(s.migrate){const E=s.migrate(k.state,k.version);return E instanceof Promise?E.then(A=>[!0,A]):[!0,E]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,k.state];return[!1,void 0]}).then(k=>{var E;const[A,$]=k;if(g=s.merge($,(E=r())!=null?E:p),n(g,!0),A)return u()}).then(()=>{_?.(g,void 0),g=r(),a=!0,l.forEach(k=>k(g))}).catch(k=>{_?.(void 0,k)})};return i.persist={setOptions:m=>{s={...s,...m},m.storage&&(d=m.storage)},clearStorage:()=>{d?.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>y(),hasHydrated:()=>a,onHydrate:m=>(c.add(m),()=>{c.delete(m)}),onFinishHydration:m=>(l.add(m),()=>{l.delete(m)})},s.skipHydration||y(),g||p},xi=Fg,Bg=(e,t)=>e!==null&&e.message===t.message&&e.removed===t.removed&&e.max_age_hours===t.max_age_hours&&e.in_progress===t.in_progress&&e.first_removal_at===t.first_removal_at&&e.freed_bytes_estimate===t.freed_bytes_estimate&&e.record===t.record;function Gg(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.message!="string"||t.message.trim()==="")return null;const n=(r,i)=>typeof r=="number"&&Number.isFinite(r)?r:i;return{message:t.message,removed:n(t.removed,0),max_age_hours:n(t.max_age_hours,48),in_progress:t.in_progress===!0,first_removal_at:typeof t.first_removal_at=="string"?t.first_removal_at:"",freed_bytes_estimate:typeof t.freed_bytes_estimate=="number"&&Number.isFinite(t.freed_bytes_estimate)?t.freed_bytes_estimate:null,record:typeof t.record=="string"?t.record:""}}const Sd=Cr()(xi(e=>({notice:null,receive:t=>e(n=>Bg(n.notice,t)?n:{notice:t}),dismiss:()=>e(t=>t.notice===null?t:{notice:null})}),{name:"delegated-cleanup-notice",storage:wd(()=>{if(typeof localStorage>"u"||localStorage===null)throw new Error("no localStorage in this environment");return localStorage}),partialize:e=>({notice:e.notice})}));function To(e){return h(Xm[e])}async function kd(e){if(window.api?.desktop)try{return await Hg(window.api.desktop.request(e),e)}catch(n){throw n instanceof ye?n:Yg(n)?new Ht(vd,bd):new ye(null,"Desktop controls could not reach the backend process.",n)}let t;try{t=await fetch("/__desktop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(n){throw new ye(null,"Desktop controls could not reach the backend process.",n)}if(!t.ok)throw new ye(t.status,"Desktop controls need a compatible backend connection.");return t.json()}function Hg(e,t){const n=yd(t);let r;return Promise.race([e,new Promise((i,s)=>{r=setTimeout(()=>{const a=Rg(t.op,n);s(new ye(null,a.message,void 0,a.code))},n)})]).finally(()=>clearTimeout(r))}const Ed="This server did not answer the request for its desktop controls.",Wg=()=>h("ui.common.errors.desktop_refusal_placeholder");class ye extends Error{status;cause;code;retryAfterMs;detail;constructor(t,n,r,i,s,a){super(n),this.name="DesktopControlError",this.status=t,this.cause=r,this.code=i,this.retryAfterMs=s,this.detail=a}}class Ht extends Error{code;constructor(t,n){super(t),this.name="UserFacingError",this.code=n}}function Co(e,t){return e instanceof ye||e instanceof Ht?Ei(e.code)?To(e.code):e.message===Ed?Wg():e.message:t}function zg(e,t,n,r){return typeof r=="string"?r:n===Hs.noCredential?qe.noCredential:n===Hs.transportFailed?qe.transportFailed:qm(Cg(e).path,t)}async function Re(e){const t=await kd(e),n=t.body;if(t.status<200||t.status>=300){const r=typeof n?.detail=="string"?n.detail:typeof n?.detail?.text=="string"?n.detail.text:typeof n?.detail?.message=="string"?n.detail.message:null;throw new ye(t.status,r??Ed,void 0,zg(e,t.status,r,typeof n?.detail=="object"?n.detail?.code:void 0),typeof n?.detail=="object"&&typeof n.detail?.retry_after_ms=="number"&&Number.isFinite(n.detail.retry_after_ms)?n.detail.retry_after_ms:void 0,typeof n?.detail=="object"?n.detail:void 0)}return e.op==="sessions.list"&&Zg(n?.result),n?.result}function Zg(e){if(typeof e!="object"||e===null)return;const t=Gg(e.delegated_cleanup_notice);t&&Sd.getState().receive(t)}async function Kg(){try{await Re({op:"delegated_cleanup_notice.ack"})}catch{}}async function Gx(){Sd.getState().dismiss(),await Kg()}function Vg(e){return e instanceof ye&&e.code===Ro}function Hx(e){if(!(e instanceof ye))return!1;const t=e.detail?.cause;return typeof t=="string"&&t.length>0?t===Pg:e.code===Og}function Wx(e){return e instanceof Ht&&e.code===bd}function Yg(e){return e instanceof Error&&e.message.includes(vd)}async function zx(e){const t=await kd(e);return new Response(t.status===204?null:JSON.stringify(t.body),{status:t.status,headers:{"Content-Type":"application/json"}})}async function Zx(e,t=!1){if(window.api?.desktop)return window.api.desktop.openAuthorization(e,t);const n=await Re({op:"auth.status",id:e});if(!n.auth_url)throw new Error("This sign-in is no longer waiting for a browser.");const r=new URL(n.auth_url);if(r.username||r.password||r.protocol!=="https:"&&!(r.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(r.hostname)))throw new Error("The provider returned an invalid sign-in address.");window.open(r.href,"_blank","noopener,noreferrer")}function Qg(e,t){const n=window.api?.desktop?.stream;if(n){const s=n.subscribe(e,t);return()=>s.dispose()}const r=new URLSearchParams({session:e.sessionId});e.epoch&&r.set("epoch",e.epoch),e.afterSeq!==void 0&&r.set("after_seq",String(e.afterSeq)),r.set("frontend_replace","1"),e.openFrame===!0&&r.set("open_frame","1"),e.journalOrder===!0&&(r.set("journal_order","1"),e.peerJournalSource===!0&&r.set("peer_journal_source","1"),ui(r,"/__desktop/stream",e.orderIds??[]));const i=new EventSource(`/__desktop/stream?${r}`);return i.onmessage=s=>{t({kind:"data",data:s.data})},i.onerror=()=>{i.readyState===EventSource.CLOSED&&(t({kind:"error",detail:qn.ended}),i.close())},()=>{i.close(),t({kind:"end"})}}async function Kx(e,t){const n=window.api?.desktop?.media;if(n)return n(e,t);const r=await fetch("/__desktop/media",{method:"POST",headers:{"x-desktop-media":JSON.stringify(e),"Content-Type":"application/octet-stream"},body:t?new Blob([t]):void 0}),i=r.headers.get("content-type")??"";if(!r.ok){let s="The media request failed.",a;if(i.includes("application/json"))try{const l=(await r.json())?.detail;if(typeof l=="string")s=l;else if(typeof l=="object"&&l!==null){const d=l;typeof d.text=="string"&&d.text.trim()?s=d.text:typeof d.message=="string"&&d.message.trim()&&(s=d.message),typeof d.code=="string"&&(a=d.code)}}catch{}return{status:r.status,kind:"error",detail:s,code:a!==void 0&&Ei(a)?a:s===Hs.noCredential?qe.noCredential:void 0}}return i.includes("application/json")?{status:r.status,kind:"json",body:await r.json()}:{status:r.status,kind:"bytes",mimeType:i||"application/octet-stream",data:new Uint8Array(await r.arrayBuffer())}}function Vx(e){return e.kind==="error"?Ei(e.code)?new Ht(To(e.code),e.code):new Error(e.detail):new Error("The media request returned an unexpected response.")}function Jg(e){if(Vg(e))return"deadline";const t=e instanceof ye?e.status:null;return t===null||t===503?"unreachable":t===401||t===403?"unauthorized":t===404?"outdated":"unknown"}const xd={unreachable:"",deadline:"",unauthorized:"",get outdated(){return h("ui.common.connection.backend.remedy_outdated")},unknown:""},zs={get unreachable(){return h("ui.common.connection.backend.diagnosis_unreachable")},get deadline(){return h("ui.common.connection.backend.diagnosis_deadline")},get unauthorized(){return h("ui.common.connection.backend.diagnosis_unauthorized")},get outdated(){return h("ui.common.connection.backend.diagnosis_outdated")},unknown:""};function Xg(e,t){const n=Jg(t);return[e,zs[n],xd[n]].filter(Boolean).join(" ")}const Zs={get successor(){return h("ui.common.connection.backend.pairing_successor")},get"governed-elsewhere"(){return h("ui.common.connection.backend.pairing_governed")},get"pre-handshake"(){return h("ui.common.connection.backend.pairing_pre_handshake")},get"credential-refused"(){return h("ui.common.connection.backend.pairing_credential_refused")},get unpaired(){return h("ui.common.connection.backend.pairing_unpaired")}},qg={get successor(){return h("ui.common.connection.backend.pane_successor")},get"governed-elsewhere"(){return h("ui.common.connection.backend.pane_governed")},get"pre-handshake"(){return h("ui.common.connection.backend.pane_pre_handshake")},get"credential-refused"(){return h("ui.common.connection.backend.pane_credential_refused")},get unpaired(){return h("ui.common.connection.backend.pane_unpaired")}};function Yx(e,t){return e!=="unpaired"?null:qg[t??"unpaired"]}function Qx(e,t){return e!=="unpaired"?null:Zs[t??"unpaired"]}function Jx(e){const{kind:t,unpaired:n,answered:r,cause:i=null,servedByThisApp:s=!1}=e;return i==="pre-handshake"?s:i!==null||n?!1:r?s:t==="outdated"}function Xx(e){const{kind:t,unpaired:n,missing:r,answered:i,cause:s=null}=e;if(s!==null)return Zs[s];if(!i){if(t==="unreachable")return h("ui.common.connection.backend.compatibility_unreachable",{diagnosis:zs.unreachable});if(t==="unauthorized")return h("ui.common.connection.backend.compatibility_unauthorized");if(t==="deadline")return h("ui.common.connection.backend.compatibility_deadline",{diagnosis:zs.deadline});if(t==="outdated")return h("ui.common.connection.backend.compatibility_outdated",{remedy:xd.outdated})}return n?Zs.unpaired:i?h("ui.common.connection.backend.compatibility_missing",{features:r.join(", ")}):h("ui.common.connection.backend.compatibility_unknown")}const e_=["auth","settings","commands","catalogues","lifecycle","mcp","radient"];function qx(e,t=null){return t!==null||!e?!0:e_.filter(r=>(e.features?.[r]??0)<1).length>0||e.desktop_available!==!0}function t_(e,t){return t instanceof ye&&t.status===null?!1:e<1}function eI(e,t){return t instanceof ye&&t.status!==null&&t.status>=400&&t.status<500&&t.status!==408&&t.status!==425&&t.status!==429?!1:e<1}const n_={get successor(){return h("ui.common.connection.backend.card_successor")},get"governed-elsewhere"(){return h("ui.common.connection.backend.card_governed")},get"pre-handshake"(){return h("ui.common.connection.backend.card_pre_handshake")},get"credential-refused"(){return h("ui.common.connection.backend.card_credential_refused")},get unpaired(){return h("ui.common.connection.backend.card_unpaired")}};function tI(e,t,n){return e===null?{sentence:Xg(t,n),remedy:!0}:{sentence:n_[e],remedy:ql(e)}}const Id={settings:["desktop","settings"],capabilities:["desktop","capabilities"],providers:["desktop","auth","providers"],commands:["desktop","commands"],accounts:["desktop","auth","accounts"],catalogue:["desktop","models"],credentials:e=>["desktop","credentials",e]},r_=3e4,i_=15e3;function s_(e){return e?.desktop_available===!0}function nI(){const{client:e,provided:t}=Dp();return Xl({enabled:t,queryKey:Id.capabilities,queryFn:async()=>{try{return await Re({op:"capabilities"})}catch(n){throw n instanceof Error?n:new Error(String(n))}},staleTime:6e4,retry:!1,refetchInterval:n=>s_(n.state.data)?r_:i_,refetchIntervalInBackground:!0},e)}function o_(e,t,n=1){return e?e.desktop_available?(e.features?.[t]??0)>=n?"enabled":"below-version":"unpaired":"unknown"}function rI(e,t,n=1){return o_(e,t,n)==="enabled"}function iI(e){return Xl({queryKey:Id.providers,queryFn:()=>Re({op:"providers.list"}).then(t=>t.providers),enabled:e,staleTime:3e4,retry:t_})}const Gn=e=>{const t=e.id;return typeof t=="string"?t:typeof t=="number"?String(t):null};function a_(e,t){const n=new Set((t.removed??[]).map(String)),r=e.filter(a=>{const c=Gn(a);return c===null||!n.has(c)});for(const a of t.upserted??[]){const c=Gn(a);if(c===null){r.push(a);continue}const l=r.findIndex(d=>Gn(d)===c);l===-1?r.push(a):r[l]=a}if(!t.order)return r;const i=new Map;for(const a of r){const c=Gn(a);c!==null&&i.set(c,a)}const s=[];for(const a of t.order){const c=String(a),l=i.get(c);l&&(s.push(l),i.delete(c))}for(const a of r){const c=Gn(a);c!==null&&i.has(c)?(s.push(a),i.delete(c)):c===null&&s.push(a)}return s}const Ks=e=>({revision:Je(e),demand:e.orderDemand}),nn=e=>typeof e=="number"&&Number.isSafeInteger(e)&&e>=0;function On(e,t,n,r,i,s={}){let a=e;const c=t.journal_generation;if(t.reconcile===!0){const p=typeof c=="string"&&c.length>0?c:void 0;return a.orderNeedsReconcile&&a.orderWantedGeneration===p?a.journalMode?a:{...a,journalMode:!0}:{...a,journalMode:!0,orderNeedsReconcile:!0,orderWantedGeneration:p,orderDemand:p!==void 0?{generation:p}:{}}}if(typeof c!="string"||c.length===0)return t.journal_order_state&&t.journal_order_state!=="unsupported"&&!a.journalMode?{...a,journalMode:!0}:a;if(r&&t.journal_order_state==="ready"&&i&&a.orderNeedsReconcile&&a.orderDemand===i.demand&&(a={...a,orderNeedsReconcile:!1,orderWantedGeneration:void 0,orderDemand:void 0}),c!==a.journalGeneration&&!r)return a.orderNeedsReconcile&&a.orderWantedGeneration===c?a:{...a,orderNeedsReconcile:!0,orderWantedGeneration:c,orderDemand:{generation:c}};let l=a.journalMode?a:{...a,journalMode:!0};if(c!==a.journalGeneration&&(l={...a,journalMode:!0,journalGeneration:c,orderRevision:(a.orderRevision??0)+1,journalPositions:new Map,orderNeedsReconcile:a.orderNeedsReconcile,orderWantedGeneration:a.orderWantedGeneration,orderDemand:a.orderDemand},s.peer===!0)){const p=(a.orderRevision??0)+1,g=new Map;for(const y of a.records){const m=y.sourceEntryId??(y.kind==="tool"||y.kind==="supplement"?null:y.id);typeof m=="string"&&m.length>0&&m.length<=128&&g.set(m,p)}l={...l,...g.size>0?{journalBodyOwed:g}:{},journalSourceVoid:void 0}}let d=l.journalPositions??new Map;const u=d,f=(p,g,y)=>{if(!nn(y))return;const m=d.get(p);m&&m.seq>=y||(d===u&&(d=new Map(d)),d.set(p,{entryId:g,seq:y}))};for(const[p,g]of Object.entries(t.journal_ordinals??{}))f(p,p,g);for(const p of n)typeof p.id=="string"&&(f(p.id,p.id,p.journal_seq),p.role==="tool"&&typeof p.tool_call_id=="string"&&f(`tool:${p.tool_call_id}`,p.id,p.journal_seq),typeof p.anchor=="string"&&f(`supplement:${p.anchor}`,p.id,p.journal_seq));return d!==u&&(l={...l,journalPositions:d}),l}function Ao(e,t){if(!e.journalMode||typeof t.id!="string"||!Array.isArray(t.tool_calls))return e;let n=e.journalCallOwners??new Map,r=e.journalCallSlots??new Map;const i=n,s=r;return t.tool_calls.forEach((a,c)=>{!a||typeof a.id!="string"||(n.get(a.id)!==t.id&&(n===i&&(n=new Map(n)),n.set(a.id,t.id)),r.get(a.id)!==c&&(r===s&&(r=new Map(r)),r.set(a.id,c)))}),n===i&&r===s?e:{...e,journalCallOwners:n,journalCallSlots:r}}function Rd(e,t){const n=new Set(e.map(s=>s.id));let r=!1,i;for(let s=0;s<e.length;s++){const a=e[s];if(a.kind==="user"&&a.provisional===!0){i=a;continue}if(a.sourcePrecedes!==void 0){if(a.sourceAdmissionAnchor!==void 0){const{sourceAdmissionAnchor:c,...l}=a;e[s]=l,r=!0}i=e[s];continue}!t(a)&&i&&(a.sourceAdmissionAnchor===void 0||!n.has(a.sourceAdmissionAnchor))&&(e[s]={...a,sourceAdmissionAnchor:i.id},r=!0),i=e[s]}return r}function Td(e,t,n,r,i){const s=[],a=new Set;let c=e,l;for(;c!==void 0;){if(i.has(c.id)){l=i.get(c.id);break}if(n(c)){l=r(c);break}if(c.kind==="user"&&c.provisional===!0||a.has(c.id))break;a.add(c.id),s.push(c.id),c=c.sourceAdmissionAnchor?t.get(c.sourceAdmissionAnchor):void 0}for(const d of s)i.set(d,l);return l}const c_=Number.MAX_SAFE_INTEGER;function l_(e,t){const n=new Map,r=new Map,i=new Map;for(const s of e){if(s.sourcePrecedes===void 0)continue;const a=t(s);if(a!==void 0)r.set(s.sourcePrecedes,a);else{const c=r.get(s.sourcePrecedes);c!==void 0&&n.set(s.id,{seq:c,slot:c_})}}for(let s=e.length-1;s>=0;s--){const a=e[s];if(a.sourcePrecedes===void 0)continue;const c=t(a);if(c!==void 0)i.set(a.sourcePrecedes,c);else if(!n.has(a.id)){const l=i.get(a.sourcePrecedes);l!==void 0&&n.set(a.id,{seq:l,slot:-1})}}return n}function Cd(e,t){return{floor:d_(e,t),position:new Map(e.map((n,r)=>[n.id,r])),page:l_(e,t)}}function Ad(e,t,n,r){if(r===void 0||e.sourcePrecedes===void 0)return;const i=r.page.get(e.id);if(i!==void 0)return i;const s=new Set;let a=1,c=t.get(e.sourcePrecedes);for(;c!==void 0&&!s.has(c.id);){s.add(c.id);const l=n(c);if(l!==void 0)return{seq:l,slot:-a};const d=r.page.get(c.id);if(d!==void 0)return{seq:d.seq,slot:d.slot-a};a+=1,c=c.sourcePrecedes?t.get(c.sourcePrecedes):void 0}return r.floor===void 0?void 0:{seq:r.floor,slot:-a}}function Od(e,t,n){if(n===void 0||e.sourcePrecedes===void 0)return;const{position:r}=n,i=new Set;let s=1,a=t.get(e.sourcePrecedes);for(;a!==void 0&&!i.has(a.id);){if(a.sourcePrecedes===void 0){const c=r.get(a.id);return c===void 0?void 0:{slot:c,depth:s}}i.add(a.id),s+=1,a=t.get(a.sourcePrecedes)}}function d_(e,t){let n;for(const r of e){if(r.sourcePrecedes!==void 0)continue;const i=t(r);i!==void 0&&(n===void 0||i<n)&&(n=i)}return n}function Pd(e,t){const n=new Map;return r=>{if(!r)return;const i=t(r);if(i===void 0)return;const s=[],a=new Set;let c=r,l=!0;for(;c;){if(n.has(c.id)){l=n.get(c.id)===!0;break}if(a.has(c.id)||t(c)===void 0){l=!1;break}a.add(c.id),s.push(c.id),c=c.sourceAdmissionAnchor===void 0?void 0:e.get(c.sourceAdmissionAnchor)}for(const d of s)n.set(d,l);return l?i:void 0}}function fi(e,t){const n=e.journalCallOwners,r=e.journalCallSlots;if(!n||!r)return t;const i=new Map;t.forEach((a,c)=>{if(a.kind!=="tool")return;const l=n.get(a.toolCallId);if(l===void 0||!r.has(a.toolCallId))return;const d=i.get(l);d?d.push(c):i.set(l,[c])});let s=t;for(const a of i.values()){if(a.length<2)continue;const c=a.map(l=>t[l]).sort((l,d)=>(r.get(l.toolCallId)??0)-(r.get(d.toolCallId)??0));c.every((l,d)=>l===t[a[d]])||(s===t&&(s=t.slice()),a.forEach((l,d)=>{s[l]=c[d]}))}return s}function jd(e,t){if(!e.journalMode)return t;if(e.journalPeerSource===!0)return u_(e,t);const n=e.journalGeneration,r=e.journalPositions;let i=!1,s=!1;const a=t.map(m=>{m.sourcePrecedes!==void 0&&(s=!0);let _=[r?.get(m.sourceEntryId??m.id),r?.get(m.id)].filter(A=>A!==void 0).sort((A,$)=>$.seq-A.seq)[0];if(m.journalGeneration===n&&nn(m.journalSeq)&&(!_||m.journalSeq>_.seq)&&(_={entryId:m.sourceEntryId??m.id,seq:m.journalSeq}),!_||!n||!(m.kind==="user"&&(m.provisional===!0||m.local===!0))&&m.sourceEntryId===_.entryId&&m.journalSeq===_.seq&&m.journalGeneration===n)return m;i=!0;let E={...m,sourceEntryId:_.entryId,journalSeq:_.seq,journalGeneration:n};if(E.kind==="user"){const{provisional:A,local:$,...O}=E;E=O}return E});Rd(a,m=>m.journalGeneration===n&&nn(m.journalSeq))&&(i=!0);const l=new Map,d=new Map(a.map(m=>[m.id,m])),u=Pd(d,m=>m!==void 0&&m.journalGeneration===n&&nn(m.journalSeq)?m.journalSeq:void 0),f=m=>u(m)!==void 0,p=s?Cd(a,u):void 0,g=(m,b)=>{const _=u(m);if(m.kind==="user"&&m.provisional===!0&&_===void 0)return[1,0,0,0,b];const k=m.kind==="supplement"?m.anchor:m.kind==="tool"?e.journalCallOwners?.get(m.toolCallId)??e.argsByCall.get(m.toolCallId)?.anchorId:void 0,E=typeof k=="string"?u(d.get(k)):void 0,A=E===void 0&&_===void 0?Ad(m,d,u,p):void 0,$=_===void 0&&A===void 0?Td(m,d,f,u,l):void 0,O=E??_??A?.seq??$;if(O===void 0){const C=Od(m,d,p);return[1,C?.slot??b,C?-C.depth:0,0,b]}return[0,O,E!==void 0?1:_!==void 0?0:A!==void 0?A.slot:2,_??Number.MAX_SAFE_INTEGER,b]},y=a.map((m,b)=>({record:m,index:b,rank:g(m,b)}));return y.sort((m,b)=>{for(let _=0;_<m.rank.length;_++){const k=m.rank[_]-b.rank[_];if(k)return k}return 0}),!i&&y.every((m,b)=>m.index===b)?fi(e,t):fi(e,y.map(m=>m.record))}function u_(e,t){const n=e.journalGeneration,r=e.journalPositions,i=new Map;let s=!1;for(const _ of t){_.sourcePrecedes!==void 0&&(s=!0);let E=[r?.get(_.sourceEntryId??_.id),r?.get(_.id)].filter(A=>A!==void 0).sort((A,$)=>$.seq-A.seq)[0];_.journalGeneration===n&&nn(_.journalSeq)&&(!E||_.journalSeq>E.seq)&&(E={entryId:_.sourceEntryId??_.id,seq:_.journalSeq}),E&&i.set(_.id,E)}const a=_=>_===void 0?void 0:i.get(_.id)??r?.get(_.sourceEntryId??_.id)??r?.get(_.id);let c=!1;const l=t.slice();Rd(l,_=>_.journalGeneration===n&&nn(_.journalSeq))&&(c=!0);const u=new Map,f=new Map(l.map(_=>[_.id,_])),p=Pd(f,_=>a(_)?.seq),g=_=>p(_)!==void 0,y=s?Cd(l,p):void 0,m=(_,k)=>{const E=p(_);if(_.kind==="user"&&_.provisional===!0&&E===void 0)return[1,0,0,0,k];const A=_.kind==="supplement"?_.anchor:_.kind==="tool"?e.journalCallOwners?.get(_.toolCallId)??e.argsByCall.get(_.toolCallId)?.anchorId:void 0,$=typeof A=="string"?p(f.get(A)):void 0,O=$===void 0&&E===void 0?Ad(_,f,p,y):void 0,C=E===void 0&&O===void 0?Td(_,f,g,p,u):void 0,x=$??E??O?.seq??C;if(x===void 0){const N=Od(_,f,y);return[1,N?.slot??k,N?-N.depth:0,0,k]}return[0,x,$!==void 0?1:E!==void 0?0:O!==void 0?O.slot:2,E??Number.MAX_SAFE_INTEGER,k]},b=l.map((_,k)=>({record:_,index:k,rank:m(_,k)}));return b.sort((_,k)=>{for(let E=0;E<_.rank.length;E++){const A=_.rank[E]-k.rank[E];if(A)return A}return 0}),!c&&b.every((_,k)=>_.index===k)?fi(e,t):fi(e,b.map(_=>_.record))}function ut(e){const t=e.records.filter(i=>i.kind==="user"&&i.provisional===!0),n=e.records.filter(i=>i.journalGeneration!==e.journalGeneration||!nn(i.journalSeq)),r=[...t,...n].map(i=>i.sourceEntryId??(i.kind==="tool"||i.kind==="supplement"?null:i.id));if(r.push(...Oo(e)),e.journalPositions?.has(e.oldestId??"")||r.push(e.oldestId),e.journalSourceVoid?.size)for(let i=r.length-1;i>=0;i--){const s=r[i];typeof s=="string"&&e.journalSourceVoid.has(s)&&r.splice(i,1)}return[...new Set(r.filter(i=>typeof i=="string"&&i.length>0&&i.length<=128))]}function Oo(e){if(e.journalPeerSource!==!0||!e.journalBodyOwed)return[];const t=new Set;for(const r of e.records){const i=r.sourceEntryId??(r.kind==="tool"||r.kind==="supplement"?null:r.id);typeof i=="string"&&i.length>0&&i.length<=128&&t.add(i)}const n=[];for(const r of e.journalBodyOwed.keys())r.length<1||r.length>128||t.has(r)&&(e.journalSourceVoid?.has(r)||n.push(r));return n}function Md(e,t){const n=e.journalPositions;return ut(e).filter(r=>!n?.has(r)&&!t?.has(r))}const Je=e=>e.orderRevision??0;async function f_(e){const t=new Map,n=c=>{let l=t.get(c);return l||(l=new Set,t.set(c,l)),l},r=(c,l)=>l==="payload"?Oo(c):l==="lookup"?Md(c):ut(c);let i=e.getTranscript().journalGeneration,s=0,a=0;for(;;){if(!e.isCurrent())return{kind:"stale"};const c=e.getTranscript(),l=Ks(c),d=l.revision,u=e.sweep?.(c,n);if(u?.kind==="none")return{kind:"complete",transcript:c};const f=u?.kind??"authority",p=tm(r(c,f).filter(b=>!n(f).has(b)),u?.path??e.lookupPath,u?.query??new URLSearchParams({journal_order:"1"})),g=await e.read(p,f);if(!e.isCurrent()||Je(e.getTranscript())!==d)return{kind:"stale"};if(e.commit(g,d,l),!e.isCurrent())return{kind:"stale"};const y=e.getTranscript(),m=e.page(g);if(m.journal_order_state==="ready"&&m.journal_generation===y.journalGeneration){m.journal_generation!==i&&(t.clear(),i=m.journal_generation);for(const k of p)n(f).add(k);if(y.orderNeedsReconcile){if(y.orderDemand===l.demand||s===1)return{kind:"waiting"};s++,t.clear();continue}if(f==="payload"){const k=(m.source_retry_ids??[]).filter(E=>typeof E=="string"&&E.length>0&&E.length<=128);if(k.length>0&&p.length>1&&a===0){a++;for(const E of k)n("payload").delete(E);continue}}const b=e.sweep?.(y,n);if(b?.kind==="none")return{kind:"complete",transcript:y};const _=b?.kind??"authority";if(r(y,_).some(k=>!n(_).has(k)))continue;return{kind:"complete",transcript:y}}if(!y.orderNeedsReconcile||y.orderDemand===l.demand||s===1)return{kind:"waiting"};s++,t.clear()}}function it(e){const t=e.payload,n=t?.tool_call_id;if(t?.role==="tool"&&typeof n=="string"&&n)return`tool:${n}`;const i=(t?.details??{}).anchor;return t?.custom_type==="completion_attention"&&typeof i=="string"&&i?i:e.id}function as(e){return typeof e!="number"||!Number.isFinite(e)?null:Math.max(0,Math.trunc(e))}function Cc(e){return typeof e!="number"||!Number.isFinite(e)||e<0?null:e}function sI(e){if(!e||e.runs_state!=="ready")return null;const t=e.runs;if(!t||t.length===0)return null;const n=new Map;for(const s of t){if(!s.settled||typeof s.run_key!="string"||s.run_key.length===0)continue;const a=as(s.action_count);if(a===null)continue;const c={actions:a,workedSeconds:Cc(s.worked_seconds),failed:as(s.failed_count)??0,complete:s.complete!==!1,openingUserId:typeof s.opening_user_id=="string"&&s.opening_user_id.length>0?s.opening_user_id:null,closingAnswerId:typeof s.closing_answer_id=="string"&&s.closing_answer_id.length>0?s.closing_answer_id:null,crossSessionActions:as(s.cross_session_action_count),crossSessionWorkedSeconds:Cc(s.cross_session_worked_seconds)};n.set(s.run_key,c),c.openingUserId!==null&&n.set(c.openingUserId,c),c.closingAnswerId!==null&&n.set(c.closingAnswerId,c)}if(n.size===0)return null;const r=new Set;for(const s of e.entries)r.add(it(s));const i=e.entries[e.entries.length-1];return{runs:n,page:{ids:r,newestKey:i?it(i):null}}}function p_(e){if(!e||e.runs_state!=="ready"||e.head_cut===!0)return null;const t=e.runs,n=e.entries[0];if(!n||!t||t.length===0||!t.find(s=>s.opening_user_id===n.id))return null;const i=Math.round((n.ts??0)*1e3);return i>0?{id:n.id,tsMs:i}:null}function h_(e,t,n){const r=p_(e),i=e?.entries;if(r===null||!i||i.length===0)return!1;const s=Math.round((i[i.length-1].ts??0)*1e3);if(!(s>r.tsMs))return!1;for(const[a,c]of t)if(!n.has(a)&&(c===null||!(c>r.tsMs)||!(c<s)))return!1;return!0}const Po=new Set,Wt="\\t\\n\\v\\f\\r\\u001C-\\u001F \\u0085\\u00A0\\u1680\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000",jo=new RegExp(`[${Wt}]`),m_=new RegExp(`[${Wt}]+`),oI=new RegExp(`[${Wt}]+`,"g"),g_=new RegExp(`^[${Wt}]+|[${Wt}]+$`,"g"),__=new RegExp(`^[${Wt}]+`),aI=new RegExp(`[^${Wt}]`);function mt(e){return e.replace(g_,"")}function yr(e){return e.replace(__,"")}function Dd(e,t){return t===0||jo.test(e[t-1])}function Nd(e){const t=[];for(let n=0;n<e.length;n++)e[n]==="/"&&Dd(e,n)&&t.push(n);return t}function Mo(e,t){let n=t===null||t>e.length?e.length:t;n<0&&(n=0);const r=e.lastIndexOf(`
1
+ import{r as S,j as qf,b as Ma,D as ep}from"./index-0-CzoNW3.js";import{t as h,a as tp}from"./messages-C8-2GbIi.js";var Rr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},on=typeof window>"u"||"Deno"in globalThis;function Xe(){}function np(e,t){return typeof e=="function"?e(t):e}function Cs(e){return typeof e=="number"&&e>=0&&e!==1/0}function Gl(e,t){return Math.max(e+(t||0)-Date.now(),0)}function kn(e,t){return typeof e=="function"?e(t):e}function ot(e,t){return typeof e=="function"?e(t):e}function Da(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:a,stale:c}=e;if(a){if(r){if(t.queryHash!==wo(a,t.options))return!1}else if(!ir(t.queryKey,a))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof c=="boolean"&&t.isStale()!==c||i&&i!==t.state.fetchStatus||s&&!s(t))}function Na(e,t){const{exact:n,status:r,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(rr(t.options.mutationKey)!==rr(s))return!1}else if(!ir(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function wo(e,t){return(t?.queryKeyHashFn||rr)(e)}function rr(e){return JSON.stringify(e,(t,n)=>Os(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function ir(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>ir(e[n],t[n])):!1}function Hl(e,t){if(e===t)return e;const n=La(e)&&La(t);if(n||Os(e)&&Os(t)){const r=n?e:Object.keys(e),i=r.length,s=n?t:Object.keys(t),a=s.length,c=n?[]:{};let l=0;for(let d=0;d<a;d++){const u=n?d:s[d];(!n&&r.includes(u)||n)&&e[u]===void 0&&t[u]===void 0?(c[u]=void 0,l++):(c[u]=Hl(e[u],t[u]),c[u]===e[u]&&e[u]!==void 0&&l++)}return i===a&&l===i?e:c}return t}function As(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function La(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Os(e){if(!$a(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!$a(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function $a(e){return Object.prototype.toString.call(e)==="[object Object]"}function rp(e){return new Promise(t=>{setTimeout(t,e)})}function Ps(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Hl(e,t):t}function ip(e){return e}function sp(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function op(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var So=Symbol();function Wl(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===So?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var ap=class extends Rr{#t;#e;#n;constructor(){super(),this.#n=e=>{if(!on&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#t!==e&&(this.#t=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},ko=new ap,cp=class extends Rr{#t=!0;#e;#n;constructor(){super(),this.#n=e=>{if(!on&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(this.setOnline.bind(this))}setOnline(e){this.#t!==e&&(this.#t=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#t}},ri=new cp;function js(){let e,t;const n=new Promise((i,s)=>{e=i,t=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}function lp(e){return Math.min(1e3*2**e,3e4)}function zl(e){return(e??"online")==="online"?ri.isOnline():!0}var Zl=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Ki(e){return e instanceof Zl}function Kl(e){let t=!1,n=0,r=!1,i;const s=js(),a=m=>{r||(p(new Zl(m)),e.abort?.())},c=()=>{t=!0},l=()=>{t=!1},d=()=>ko.isFocused()&&(e.networkMode==="always"||ri.isOnline())&&e.canRun(),u=()=>zl(e.networkMode)&&e.canRun(),f=m=>{r||(r=!0,e.onSuccess?.(m),i?.(),s.resolve(m))},p=m=>{r||(r=!0,e.onError?.(m),i?.(),s.reject(m))},g=()=>new Promise(m=>{i=b=>{(r||d())&&m(b)},e.onPause?.()}).then(()=>{i=void 0,r||e.onContinue?.()}),y=()=>{if(r)return;let m;const b=n===0?e.initialPromise:void 0;try{m=b??e.fn()}catch(_){m=Promise.reject(_)}Promise.resolve(m).then(f).catch(_=>{if(r)return;const k=e.retry??(on?0:3),E=e.retryDelay??lp,A=typeof E=="function"?E(n,_):E,$=k===!0||typeof k=="number"&&n<k||typeof k=="function"&&k(n,_);if(t||!$){p(_);return}n++,e.onFail?.(n,_),rp(A).then(()=>d()?void 0:g()).then(()=>{t?p(_):y()})})};return{promise:s,cancel:a,continue:()=>(i?.(),s),cancelRetry:c,continueRetry:l,canStart:u,start:()=>(u()?y():g().then(y),s)}}var dp=e=>setTimeout(e,0);function up(){let e=[],t=0,n=c=>{c()},r=c=>{c()},i=dp;const s=c=>{t?e.push(c):i(()=>{n(c)})},a=()=>{const c=e;e=[],c.length&&i(()=>{r(()=>{c.forEach(l=>{n(l)})})})};return{batch:c=>{let l;t++;try{l=c()}finally{t--,t||a()}return l},batchCalls:c=>(...l)=>{s(()=>{c(...l)})},schedule:s,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{r=c},setScheduler:c=>{i=c}}}var De=up(),Vl=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Cs(this.gcTime)&&(this.#t=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(on?1/0:5*60*1e3))}clearGcTimeout(){this.#t&&(clearTimeout(this.#t),this.#t=void 0)}},fp=class extends Vl{#t;#e;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=pp(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=Ps(this.state.data,e,this.options);return this.#s({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(Xe).catch(Xe):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(e=>ot(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===So||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!Gl(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}fetch(e,t){if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){const c=this.observers.find(l=>l.options.queryFn);c&&this.setOptions(c.options)}const n=new AbortController,r=c=>{Object.defineProperty(c,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{const c=Wl(this.options,t),l={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(l),this.#o=!1,this.options.persister?this.options.persister(c,l,this):c(l)},s={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};r(s),this.options.behavior?.onFetch(s,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&this.#s({type:"fetch",meta:s.fetchOptions?.meta});const a=c=>{Ki(c)&&c.silent||this.#s({type:"error",error:c}),Ki(c)||(this.#n.config.onError?.(c,this),this.#n.config.onSettled?.(this.state.data,c,this)),this.scheduleGc()};return this.#i=Kl({initialPromise:t?.initialPromise,fn:s.fetchFn,abort:n.abort.bind(n),onSuccess:c=>{if(c===void 0){a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(c)}catch(l){a(l);return}this.#n.config.onSuccess?.(c,this),this.#n.config.onSettled?.(c,this.state.error,this),this.scheduleGc()},onError:a,onFail:(c,l)=>{this.#s({type:"failed",failureCount:c,error:l})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0}),this.#i.start()}#s(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Yl(n.data,this.options),fetchMeta:e.meta??null};case"success":return{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const r=e.error;return Ki(r)&&r.revert&&this.#e?{...this.#e,fetchStatus:"idle"}:{...n,error:r,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),De.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Yl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:zl(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function pp(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var hp=class extends Rr{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,t,n){const r=t.queryKey,i=t.queryHash??wo(r,t);let s=this.get(i);return s||(s=new fp({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(s)),s}add(e){this.#t.has(e.queryHash)||(this.#t.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#t.get(e.queryHash);t&&(e.destroy(),t===e&&this.#t.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){De.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#t.get(e)}getAll(){return[...this.#t.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>Da(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>Da(e,n)):t}notify(e){De.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){De.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){De.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},mp=class extends Vl{#t;#e;#n;constructor(e){super(),this.mutationId=e.mutationId,this.#e=e.mutationCache,this.#t=[],this.state=e.state||gp(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#e.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#e.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#e.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){this.#n=Kl({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(r,i)=>{this.#r({type:"failed",failureCount:r,error:i})},onPause:()=>{this.#r({type:"pause"})},onContinue:()=>{this.#r({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#e.canRun(this)});const t=this.state.status==="pending",n=!this.#n.canStart();try{if(!t){this.#r({type:"pending",variables:e,isPaused:n}),await this.#e.config.onMutate?.(e,this);const i=await this.options.onMutate?.(e);i!==this.state.context&&this.#r({type:"pending",context:i,variables:e,isPaused:n})}const r=await this.#n.start();return await this.#e.config.onSuccess?.(r,e,this.state.context,this),await this.options.onSuccess?.(r,e,this.state.context),await this.#e.config.onSettled?.(r,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(r,null,e,this.state.context),this.#r({type:"success",data:r}),r}catch(r){try{throw await this.#e.config.onError?.(r,e,this.state.context,this),await this.options.onError?.(r,e,this.state.context),await this.#e.config.onSettled?.(void 0,r,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,r,e,this.state.context),r}finally{this.#r({type:"error",error:r})}}finally{this.#e.runNext(this)}}#r(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),De.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#e.notify({mutation:this,type:"updated",action:e})})}};function gp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var _p=class extends Rr{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#e=new Map,this.#n=0}#t;#e;#n;build(e,t,n){const r=new mp({mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#t.add(e);const t=Ur(e);if(typeof t=="string"){const n=this.#e.get(t);n?n.push(e):this.#e.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){const t=Ur(e);if(typeof t=="string"){const n=this.#e.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#e.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Ur(e);if(typeof t=="string"){const r=this.#e.get(t)?.find(i=>i.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=Ur(e);return typeof t=="string"?this.#e.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){De.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>Na(t,n))}findAll(e={}){return this.getAll().filter(t=>Na(e,t))}notify(e){De.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return De.batch(()=>Promise.all(e.map(t=>t.continue().catch(Xe))))}};function Ur(e){return e.options.scope?.id}function Ua(e){return{onFetch:(t,n)=>{const r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let c={pages:[],pageParams:[]},l=0;const d=async()=>{let u=!1;const f=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},p=Wl(t.options,t.fetchOptions),g=async(y,m,b)=>{if(u)return Promise.reject();if(m==null&&y.pages.length)return Promise.resolve(y);const _={client:t.client,queryKey:t.queryKey,pageParam:m,direction:b?"backward":"forward",meta:t.options.meta};f(_);const k=await p(_),{maxPages:E}=t.options,A=b?op:sp;return{pages:A(y.pages,k,E),pageParams:A(y.pageParams,m,E)}};if(i&&s.length){const y=i==="backward",m=y?Ql:Ms,b={pages:s,pageParams:a},_=m(r,b);c=await g(b,_,y)}else{const y=e??s.length;do{const m=l===0?a[0]??r.initialPageParam:Ms(r,c);if(l>0&&m==null)break;c=await g(c,m),l++}while(l<y)}return c};t.options.persister?t.fetchFn=()=>t.options.persister?.(d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=d}}}function Ms(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ql(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function fx(e,t){return t?Ms(e,t)!=null:!1}function px(e,t){return!t||!e.getPreviousPageParam?!1:Ql(e,t)!=null}var yp=class{#t;#e;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#t=e.queryCache||new hp,this.#e=e.mutationCache||new _p,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ko.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#s=ri.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#t.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#e.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#t.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(kn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#t.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=this.#t.get(r.queryHash)?.state.data,a=np(t,s);if(a!==void 0)return this.#t.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return De.batch(()=>this.#t.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state}removeQueries(e){const t=this.#t;De.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#t;return De.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=De.batch(()=>this.#t.findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(Xe).catch(Xe)}invalidateQueries(e,t={}){return De.batch(()=>(this.#t.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=De.batch(()=>this.#t.findAll(e).filter(i=>!i.isDisabled()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Xe)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Xe)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#t.build(this,t);return n.isStaleByTime(kn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Xe).catch(Xe)}fetchInfiniteQuery(e){return e.behavior=Ua(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Xe).catch(Xe)}ensureInfiniteQueryData(e){return e.behavior=Ua(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ri.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(rr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{ir(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(rr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(r=>{ir(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=wo(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===So&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},bp=class extends Rr{constructor(e,t){super(),this.options=t,this.#t=e,this.#s=null,this.#o=js(),this.options.experimental_prefetchInRender||this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(t)}#t;#e=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#m;#f;#p;#l;#d;#c;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Fa(this.#e,this.options)?this.#u():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ds(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ds(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#v(),this.#w(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,n=this.#e;if(this.options=this.#t.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ot(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#e.setOptions(this.options),t._defaulted&&!As(this.options,t)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&Ba(this.#e,n,this.options,t)&&this.#u(),this.updateResult(),r&&(this.#e!==n||ot(this.options.enabled,this.#e)!==ot(t.enabled,this.#e)||kn(this.options.staleTime,this.#e)!==kn(t.staleTime,this.#e))&&this.#g();const i=this.#_();r&&(this.#e!==n||ot(this.options.enabled,this.#e)!==ot(t.enabled,this.#e)||i!==this.#c)&&this.#y(i)}getOptimisticResult(e){const t=this.#t.getQueryCache().build(this.#t,e),n=this.createResult(t,e);return wp(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#e.state),n}getCurrentResult(){return this.#r}trackResult(e,t){const n={};return Object.keys(e).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(r),t?.(r),e[r])})}),n}trackProp(e){this.#h.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#t.defaultQueryOptions(e),n=this.#t.getQueryCache().build(this.#t,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#u({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#u(e){this.#S();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Xe)),t}#g(){this.#v();const e=kn(this.options.staleTime,this.#e);if(on||this.#r.isStale||!Cs(e))return;const n=Gl(this.#r.dataUpdatedAt,e)+1;this.#l=setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#_(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#c=e,!(on||ot(this.options.enabled,this.#e)===!1||!Cs(this.#c)||this.#c===0)&&(this.#d=setInterval(()=>{(this.options.refetchIntervalInBackground||ko.isFocused())&&this.#u()},this.#c))}#b(){this.#g(),this.#y(this.#_())}#v(){this.#l&&(clearTimeout(this.#l),this.#l=void 0)}#w(){this.#d&&(clearInterval(this.#d),this.#d=void 0)}createResult(e,t){const n=this.#e,r=this.options,i=this.#r,s=this.#i,a=this.#a,l=e!==n?e.state:this.#n,{state:d}=e;let u={...d},f=!1,p;if(t._optimisticResults){const x=this.hasListeners(),N=!x&&Fa(e,t),F=x&&Ba(e,n,t,r);(N||F)&&(u={...u,...Yl(d.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:g,errorUpdatedAt:y,status:m}=u;p=u.data;let b=!1;if(t.placeholderData!==void 0&&p===void 0&&m==="pending"){let x;i?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(x=i.data,b=!0):x=typeof t.placeholderData=="function"?t.placeholderData(this.#p?.state.data,this.#p):t.placeholderData,x!==void 0&&(m="success",p=Ps(i?.data,x,t),f=!0)}if(t.select&&p!==void 0&&!b)if(i&&p===s?.data&&t.select===this.#m)p=this.#f;else try{this.#m=t.select,p=t.select(p),p=Ps(i?.data,p,t),this.#f=p,this.#s=null}catch(x){this.#s=x}this.#s&&(g=this.#s,p=this.#f,y=Date.now(),m="error");const _=u.fetchStatus==="fetching",k=m==="pending",E=m==="error",A=k&&_,$=p!==void 0,C={status:m,fetchStatus:u.fetchStatus,isPending:k,isSuccess:m==="success",isError:E,isInitialLoading:A,isLoading:A,data:p,dataUpdatedAt:u.dataUpdatedAt,error:g,errorUpdatedAt:y,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>l.dataUpdateCount||u.errorUpdateCount>l.errorUpdateCount,isFetching:_,isRefetching:_&&!k,isLoadingError:E&&!$,isPaused:u.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:E&&$,isStale:Eo(e,t),refetch:this.refetch,promise:this.#o};if(this.options.experimental_prefetchInRender){const x=se=>{C.status==="error"?se.reject(C.error):C.data!==void 0&&se.resolve(C.data)},N=()=>{const se=this.#o=C.promise=js();x(se)},F=this.#o;switch(F.status){case"pending":e.queryHash===n.queryHash&&x(F);break;case"fulfilled":(C.status==="error"||C.data!==F.value)&&N();break;case"rejected":(C.status!=="error"||C.error!==F.reason)&&N();break}}return C}updateResult(){const e=this.#r,t=this.createResult(this.#e,this.options);if(this.#i=this.#e.state,this.#a=this.options,this.#i.data!==void 0&&(this.#p=this.#e),As(t,e))return;this.#r=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#h.size)return!0;const s=new Set(i??this.#h);return this.options.throwOnError&&s.add("error"),Object.keys(this.#r).some(a=>{const c=a;return this.#r[c]!==e[c]&&s.has(c)})};this.#k({listeners:n()})}#S(){const e=this.#t.getQueryCache().build(this.#t,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#k(e){De.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function vp(e,t){return ot(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Fa(e,t){return vp(e,t)||e.state.data!==void 0&&Ds(e,t,t.refetchOnMount)}function Ds(e,t,n){if(ot(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Eo(e,t)}return!1}function Ba(e,t,n,r){return(e!==t||ot(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Eo(e,n)}function Eo(e,t){return ot(t.enabled,e)!==!1&&e.isStaleByTime(kn(t.staleTime,e))}function wp(e,t){return!As(e.getCurrentResult(),t)}var xo=S.createContext(void 0),Sp=e=>{const t=S.useContext(xo);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},hx=({client:e,children:t})=>(S.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),qf.jsx(xo.Provider,{value:e,children:t})),Jl=S.createContext(!1),kp=()=>S.useContext(Jl);Jl.Provider;function Ep(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var xp=S.createContext(Ep()),Ip=()=>S.useContext(xp);function Rp(e,t){return typeof e=="function"?e(...t):!!e}function Ga(){}var Tp=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Cp=e=>{S.useEffect(()=>{e.clearReset()},[e])},Ap=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Rp(n,[e.error,r])),Op=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},Pp=(e,t)=>e.isLoading&&e.isFetching&&!t,jp=(e,t)=>e?.suspense&&t.isPending,Ha=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Mp(e,t,n){const r=Sp(n),i=kp(),s=Ip(),a=r.defaultQueryOptions(e);r.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=i?"isRestoring":"optimistic",Op(a),Tp(a,s),Cp(s);const c=!r.getQueryCache().get(a.queryHash),[l]=S.useState(()=>new t(r,a)),d=l.getOptimisticResult(a),u=!i&&e.subscribed!==!1;if(S.useSyncExternalStore(S.useCallback(f=>{const p=u?l.subscribe(De.batchCalls(f)):Ga;return l.updateResult(),p},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),S.useEffect(()=>{l.setOptions(a)},[a,l]),jp(a,d))throw Ha(a,l,s);if(Ap({result:d,errorResetBoundary:s,throwOnError:a.throwOnError,query:r.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw d.error;return r.getDefaultOptions().queries?._experimental_afterQuery?.(a,d),a.experimental_prefetchInRender&&!on&&Pp(d,i)&&(c?Ha(a,l,s):r.getQueryCache().get(a.queryHash)?.promise)?.catch(Ga).finally(()=>{l.updateResult()}),a.notifyOnChangeProps?d:l.trackResult(d)}function Xl(e,t){return Mp(e,bp,t)}const Dp=()=>{const e=S.useContext(xo)??null,t=S.useMemo(()=>new yp({defaultOptions:{queries:{enabled:!1,retry:!1,gcTime:0}}}),[]);return S.useEffect(()=>{if(!e)return()=>t.clear()},[e,t]),S.useMemo(()=>e?{client:e,provided:!0}:{client:t,provided:!1},[e,t])};function mx(e){return e!=="detached"&&e!=="wedged"}function ql(e){return e!=="governed-elsewhere"&&e!=="pre-handshake"}function gx(e){if(!e)return{title:"Not connected to a Local Operator server.",detail:null,retry:!0};const t=e.addressSubstitution??null;if(t&&e.state!=="detached"&&e.state!=="wedged")return t.kind==="substituted"?{title:`Serving on ${t.serving}, not the address this app is configured for.`,detail:t.holder?`${t.holder}. The app uses ${t.serving} while that holds.${t.reclaim?` ${t.reclaim}`:""} It is back on ${t.configured} on its next launch or recovery.`:`The daemon this app is using was already running, so it did not start one. It looks for ${t.configured} again on its next launch or recovery.`,retry:!0}:{title:`Back on ${t.configured}, the address this app is configured for.`,detail:`It served on ${t.serving} while the configured address was held; it is on the address it was told to use again.`,retry:!1,dismiss:!0};const n=e.detail?.trim()?e.detail.trim():null,r=ql(e.pairing?.cause??null);switch(e.state){case"wedged":return{title:"A Local Operator server is running on this machine and this app is not attached to it.",detail:n,retry:r};case"detached":return e.reconnecting?{title:r?"Not connected to a Local Operator server. If one is still running, the app reconnects to it on its own.":"Not connected to a Local Operator server.",detail:n,retry:r}:{title:r?"The Local Operator server stopped. The app keeps looking for one and attaches to it when it appears.":"Not connected to a Local Operator server. The app keeps looking for one.",detail:n,retry:r};default:return null}}var re;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const s={};for(const a of i)s[a]=a;return s},e.getValidEnumValues=i=>{const s=e.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),a={};for(const c of s)a[c]=i[c];return e.objectValues(a)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&s.push(a);return s},e.find=(i,s)=>{for(const a of i)if(s(a))return a},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(re||(re={}));var Ns;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Ns||(Ns={}));const M=re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),kt=e=>{switch(typeof e){case"undefined":return M.undefined;case"string":return M.string;case"number":return isNaN(e)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":return Array.isArray(e)?M.array:e===null?M.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?M.promise:typeof Map<"u"&&e instanceof Map?M.map:typeof Set<"u"&&e instanceof Set?M.set:typeof Date<"u"&&e instanceof Date?M.date:M.object;default:return M.unknown}},R=re.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Np=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Ye extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(s){return s.message},r={_errors:[]},i=s=>{for(const a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let c=r,l=0;for(;l<a.path.length;){const d=a.path[l];l===a.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(n(a))):c[d]=c[d]||{_errors:[]},c=c[d],l++}}};return i(this),r}static assert(t){if(!(t instanceof Ye))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,re.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ye.create=e=>new Ye(e);const Tn=(e,t)=>{let n;switch(e.code){case R.invalid_type:e.received===M.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case R.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,re.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:n=`Unrecognized key(s) in object: ${re.joinValues(e.keys,", ")}`;break;case R.invalid_union:n="Invalid input";break;case R.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${re.joinValues(e.options)}`;break;case R.invalid_enum_value:n=`Invalid enum value. Expected ${re.joinValues(e.options)}, received '${e.received}'`;break;case R.invalid_arguments:n="Invalid function arguments";break;case R.invalid_return_type:n="Invalid function return type";break;case R.invalid_date:n="Invalid date";break;case R.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:re.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case R.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case R.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case R.custom:n="Invalid input";break;case R.invalid_intersection_types:n="Intersection results could not be merged";break;case R.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case R.not_finite:n="Number must be finite";break;default:n=t.defaultError,re.assertNever(e)}return{message:n}};let ed=Tn;function Lp(e){ed=e}function ii(){return ed}const si=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],a={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let c="";const l=r.filter(d=>!!d).slice().reverse();for(const d of l)c=d(a,{data:t,defaultError:c}).message;return{...i,path:s,message:c}},$p=[];function j(e,t){const n=ii(),r=si({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Tn?void 0:Tn].filter(i=>!!i)});e.common.issues.push(r)}class $e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return z;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const s=await i.key,a=await i.value;r.push({key:s,value:a})}return $e.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:s,value:a}=i;if(s.status==="aborted"||a.status==="aborted")return z;s.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(r[s.value]=a.value)}return{status:t.value,value:r}}}const z=Object.freeze({status:"aborted"}),vn=e=>({status:"dirty",value:e}),Ue=e=>({status:"valid",value:e}),Ls=e=>e.status==="aborted",$s=e=>e.status==="dirty",an=e=>e.status==="valid",sr=e=>typeof Promise<"u"&&e instanceof Promise;function oi(e,t,n,r){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function td(e,t,n,r,i){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var U;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(U||(U={}));var Kn,Vn;class gt{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Wa=(e,t)=>{if(an(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ye(e.common.issues);return this._error=n,this._error}}};function J(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(a,c)=>{var l,d;const{message:u}=e;return a.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:(l=u??r)!==null&&l!==void 0?l:c.defaultError}:a.code!=="invalid_type"?{message:c.defaultError}:{message:(d=u??n)!==null&&d!==void 0?d:c.defaultError}},description:i}}class X{get description(){return this._def.description}_getType(t){return kt(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:kt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new $e,ctx:{common:t.parent.common,data:t.data,parsedType:kt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(sr(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const i={common:{issues:[],async:(r=n?.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:kt(t)},s=this._parseSync({data:t,path:i.path,parent:i});return Wa(i,s)}"~validate"(t){var n,r;const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:kt(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:i});return an(s)?{value:s.value}:{issues:i.common.issues}}catch(s){!((r=(n=s?.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:i}).then(s=>an(s)?{value:s.value}:{issues:i.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:kt(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(sr(i)?i:Promise.resolve(i));return Wa(r,s)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const a=t(i),c=()=>s.addIssue({code:R.custom,...r(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(c(),!1)):a?!0:(c(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new lt({schema:this,typeName:H.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return ht.create(this,this._def)}nullable(){return Gt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ct.create(this)}promise(){return An.create(this,this._def)}or(t){return lr.create([this,t],this._def)}and(t){return dr.create(this,t,this._def)}transform(t){return new lt({...J(this._def),schema:this,typeName:H.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new mr({...J(this._def),innerType:this,defaultValue:n,typeName:H.ZodDefault})}brand(){return new Io({typeName:H.ZodBranded,type:this,...J(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new gr({...J(this._def),innerType:this,catchValue:n,typeName:H.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Tr.create(this,t)}readonly(){return _r.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Up=/^c[^\s-]{8,}$/i,Fp=/^[0-9a-z]+$/,Bp=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Gp=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Hp=/^[a-z0-9_-]{21}$/i,Wp=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,zp=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Zp=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Kp="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Vi;const Vp=/^(?:(?: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])$/,Yp=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Qp=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Jp=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Xp=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qp=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nd="((\\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])))",eh=new RegExp(`^${nd}$`);function rd(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function th(e){return new RegExp(`^${rd(e)}$`)}function id(e){let t=`${nd}T${rd(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function nh(e,t){return!!((t==="v4"||!t)&&Vp.test(e)||(t==="v6"||!t)&&Qp.test(e))}function rh(e,t){if(!Wp.test(e))return!1;try{const[n]=e.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||!i.typ||!i.alg||t&&i.alg!==t)}catch{return!1}}function ih(e,t){return!!((t==="v4"||!t)&&Yp.test(e)||(t==="v6"||!t)&&Jp.test(e))}class at extends X{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==M.string){const s=this._getOrReturnCtx(t);return j(s,{code:R.invalid_type,expected:M.string,received:s.parsedType}),z}const r=new $e;let i;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),j(i,{code:R.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),j(i,{code:R.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const a=t.data.length>s.value,c=t.data.length<s.value;(a||c)&&(i=this._getOrReturnCtx(t,i),a?j(i,{code:R.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&j(i,{code:R.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Zp.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"email",code:R.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Vi||(Vi=new RegExp(Kp,"u")),Vi.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"emoji",code:R.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")Gp.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"uuid",code:R.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")Hp.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"nanoid",code:R.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")Up.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"cuid",code:R.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")Fp.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"cuid2",code:R.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")Bp.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"ulid",code:R.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),j(i,{validation:"url",code:R.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"regex",code:R.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),j(i,{code:R.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),j(i,{code:R.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),j(i,{code:R.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?id(s).test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{code:R.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?eh.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{code:R.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?th(s).test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{code:R.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?zp.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"duration",code:R.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?nh(t.data,s.version)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"ip",code:R.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?rh(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"jwt",code:R.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?ih(t.data,s.version)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"cidr",code:R.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?Xp.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"base64",code:R.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?qp.test(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{validation:"base64url",code:R.invalid_string,message:s.message}),r.dirty()):re.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:R.invalid_string,...U.errToObj(r)})}_addCheck(t){return new at({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...U.errToObj(t)})}url(t){return this._addCheck({kind:"url",...U.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...U.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...U.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...U.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...U.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...U.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...U.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...U.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...U.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...U.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...U.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...U.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(n=t?.offset)!==null&&n!==void 0?n:!1,local:(r=t?.local)!==null&&r!==void 0?r:!1,...U.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...U.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...U.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...U.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...U.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...U.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...U.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...U.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...U.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...U.errToObj(n)})}nonempty(t){return this.min(1,U.errToObj(t))}trim(){return new at({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new at({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new at({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}at.create=e=>{var t;return new at({checks:[],typeName:H.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...J(e)})};function sh(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,s=parseInt(e.toFixed(i).replace(".","")),a=parseInt(t.toFixed(i).replace(".",""));return s%a/Math.pow(10,i)}class Ut extends X{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==M.number){const s=this._getOrReturnCtx(t);return j(s,{code:R.invalid_type,expected:M.number,received:s.parsedType}),z}let r;const i=new $e;for(const s of this._def.checks)s.kind==="int"?re.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{code:R.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),j(r,{code:R.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),j(r,{code:R.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?sh(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),j(r,{code:R.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{code:R.not_finite,message:s.message}),i.dirty()):re.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,U.toString(n))}gt(t,n){return this.setLimit("min",t,!1,U.toString(n))}lte(t,n){return this.setLimit("max",t,!0,U.toString(n))}lt(t,n){return this.setLimit("max",t,!1,U.toString(n))}setLimit(t,n,r,i){return new Ut({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:U.toString(i)}]})}_addCheck(t){return new Ut({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:U.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:U.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:U.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:U.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:U.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:U.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:U.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:U.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:U.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&re.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Ut.create=e=>new Ut({checks:[],typeName:H.ZodNumber,coerce:e?.coerce||!1,...J(e)});class Ft extends X{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==M.bigint)return this._getInvalidInput(t);let r;const i=new $e;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),j(r,{code:R.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),j(r,{code:R.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),j(r,{code:R.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):re.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return j(n,{code:R.invalid_type,expected:M.bigint,received:n.parsedType}),z}gte(t,n){return this.setLimit("min",t,!0,U.toString(n))}gt(t,n){return this.setLimit("min",t,!1,U.toString(n))}lte(t,n){return this.setLimit("max",t,!0,U.toString(n))}lt(t,n){return this.setLimit("max",t,!1,U.toString(n))}setLimit(t,n,r,i){return new Ft({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:U.toString(i)}]})}_addCheck(t){return new Ft({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:U.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:U.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:U.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:U.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:U.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Ft.create=e=>{var t;return new Ft({checks:[],typeName:H.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...J(e)})};class or extends X{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==M.boolean){const r=this._getOrReturnCtx(t);return j(r,{code:R.invalid_type,expected:M.boolean,received:r.parsedType}),z}return Ue(t.data)}}or.create=e=>new or({typeName:H.ZodBoolean,coerce:e?.coerce||!1,...J(e)});class cn extends X{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==M.date){const s=this._getOrReturnCtx(t);return j(s,{code:R.invalid_type,expected:M.date,received:s.parsedType}),z}if(isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return j(s,{code:R.invalid_date}),z}const r=new $e;let i;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),j(i,{code:R.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),j(i,{code:R.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):re.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new cn({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:U.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:U.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}cn.create=e=>new cn({checks:[],coerce:e?.coerce||!1,typeName:H.ZodDate,...J(e)});class ai extends X{_parse(t){if(this._getType(t)!==M.symbol){const r=this._getOrReturnCtx(t);return j(r,{code:R.invalid_type,expected:M.symbol,received:r.parsedType}),z}return Ue(t.data)}}ai.create=e=>new ai({typeName:H.ZodSymbol,...J(e)});class ar extends X{_parse(t){if(this._getType(t)!==M.undefined){const r=this._getOrReturnCtx(t);return j(r,{code:R.invalid_type,expected:M.undefined,received:r.parsedType}),z}return Ue(t.data)}}ar.create=e=>new ar({typeName:H.ZodUndefined,...J(e)});class cr extends X{_parse(t){if(this._getType(t)!==M.null){const r=this._getOrReturnCtx(t);return j(r,{code:R.invalid_type,expected:M.null,received:r.parsedType}),z}return Ue(t.data)}}cr.create=e=>new cr({typeName:H.ZodNull,...J(e)});class Cn extends X{constructor(){super(...arguments),this._any=!0}_parse(t){return Ue(t.data)}}Cn.create=e=>new Cn({typeName:H.ZodAny,...J(e)});class tn extends X{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ue(t.data)}}tn.create=e=>new tn({typeName:H.ZodUnknown,...J(e)});class xt extends X{_parse(t){const n=this._getOrReturnCtx(t);return j(n,{code:R.invalid_type,expected:M.never,received:n.parsedType}),z}}xt.create=e=>new xt({typeName:H.ZodNever,...J(e)});class ci extends X{_parse(t){if(this._getType(t)!==M.undefined){const r=this._getOrReturnCtx(t);return j(r,{code:R.invalid_type,expected:M.void,received:r.parsedType}),z}return Ue(t.data)}}ci.create=e=>new ci({typeName:H.ZodVoid,...J(e)});class ct extends X{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==M.array)return j(n,{code:R.invalid_type,expected:M.array,received:n.parsedType}),z;if(i.exactLength!==null){const a=n.data.length>i.exactLength.value,c=n.data.length<i.exactLength.value;(a||c)&&(j(n,{code:a?R.too_big:R.too_small,minimum:c?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(j(n,{code:R.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(j(n,{code:R.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,c)=>i.type._parseAsync(new gt(n,a,n.path,c)))).then(a=>$e.mergeArray(r,a));const s=[...n.data].map((a,c)=>i.type._parseSync(new gt(n,a,n.path,c)));return $e.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new ct({...this._def,minLength:{value:t,message:U.toString(n)}})}max(t,n){return new ct({...this._def,maxLength:{value:t,message:U.toString(n)}})}length(t,n){return new ct({...this._def,exactLength:{value:t,message:U.toString(n)}})}nonempty(t){return this.min(1,t)}}ct.create=(e,t)=>new ct({type:e,minLength:null,maxLength:null,exactLength:null,typeName:H.ZodArray,...J(t)});function _n(e){if(e instanceof we){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ht.create(_n(r))}return new we({...e._def,shape:()=>t})}else return e instanceof ct?new ct({...e._def,type:_n(e.element)}):e instanceof ht?ht.create(_n(e.unwrap())):e instanceof Gt?Gt.create(_n(e.unwrap())):e instanceof _t?_t.create(e.items.map(t=>_n(t))):e}class we extends X{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=re.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==M.object){const d=this._getOrReturnCtx(t);return j(d,{code:R.invalid_type,expected:M.object,received:d.parsedType}),z}const{status:r,ctx:i}=this._processInputParams(t),{shape:s,keys:a}=this._getCached(),c=[];if(!(this._def.catchall instanceof xt&&this._def.unknownKeys==="strip"))for(const d in i.data)a.includes(d)||c.push(d);const l=[];for(const d of a){const u=s[d],f=i.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new gt(i,f,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof xt){const d=this._def.unknownKeys;if(d==="passthrough")for(const u of c)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(d==="strict")c.length>0&&(j(i,{code:R.unrecognized_keys,keys:c}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const u of c){const f=i.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new gt(i,f,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const d=[];for(const u of l){const f=await u.key,p=await u.value;d.push({key:f,value:p,alwaysSet:u.alwaysSet})}return d}).then(d=>$e.mergeObjectSync(r,d)):$e.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return U.errToObj,new we({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,s,a,c;const l=(a=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,n,r).message)!==null&&a!==void 0?a:r.defaultError;return n.code==="unrecognized_keys"?{message:(c=U.errToObj(t).message)!==null&&c!==void 0?c:l}:{message:l}}}:{}})}strip(){return new we({...this._def,unknownKeys:"strip"})}passthrough(){return new we({...this._def,unknownKeys:"passthrough"})}extend(t){return new we({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new we({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:H.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new we({...this._def,catchall:t})}pick(t){const n={};return re.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new we({...this._def,shape:()=>n})}omit(t){const n={};return re.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new we({...this._def,shape:()=>n})}deepPartial(){return _n(this)}partial(t){const n={};return re.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}),new we({...this._def,shape:()=>n})}required(t){const n={};return re.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof ht;)s=s._def.innerType;n[r]=s}}),new we({...this._def,shape:()=>n})}keyof(){return sd(re.objectKeys(this.shape))}}we.create=(e,t)=>new we({shape:()=>e,unknownKeys:"strip",catchall:xt.create(),typeName:H.ZodObject,...J(t)});we.strictCreate=(e,t)=>new we({shape:()=>e,unknownKeys:"strict",catchall:xt.create(),typeName:H.ZodObject,...J(t)});we.lazycreate=(e,t)=>new we({shape:e,unknownKeys:"strip",catchall:xt.create(),typeName:H.ZodObject,...J(t)});class lr extends X{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(s){for(const c of s)if(c.result.status==="valid")return c.result;for(const c of s)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const a=s.map(c=>new Ye(c.ctx.common.issues));return j(n,{code:R.invalid_union,unionErrors:a}),z}if(n.common.async)return Promise.all(r.map(async s=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(i);{let s;const a=[];for(const l of r){const d={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const c=a.map(l=>new Ye(l));return j(n,{code:R.invalid_union,unionErrors:c}),z}}get options(){return this._def.options}}lr.create=(e,t)=>new lr({options:e,typeName:H.ZodUnion,...J(t)});const wt=e=>e instanceof fr?wt(e.schema):e instanceof lt?wt(e.innerType()):e instanceof pr?[e.value]:e instanceof Bt?e.options:e instanceof hr?re.objectValues(e.enum):e instanceof mr?wt(e._def.innerType):e instanceof ar?[void 0]:e instanceof cr?[null]:e instanceof ht?[void 0,...wt(e.unwrap())]:e instanceof Gt?[null,...wt(e.unwrap())]:e instanceof Io||e instanceof _r?wt(e.unwrap()):e instanceof gr?wt(e._def.innerType):[];class wi extends X{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==M.object)return j(n,{code:R.invalid_type,expected:M.object,received:n.parsedType}),z;const r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(j(n,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const s of n){const a=wt(s.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const c of a){if(i.has(c))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(c)}`);i.set(c,s)}}return new wi({typeName:H.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...J(r)})}}function Us(e,t){const n=kt(e),r=kt(t);if(e===t)return{valid:!0,data:e};if(n===M.object&&r===M.object){const i=re.objectKeys(t),s=re.objectKeys(e).filter(c=>i.indexOf(c)!==-1),a={...e,...t};for(const c of s){const l=Us(e[c],t[c]);if(!l.valid)return{valid:!1};a[c]=l.data}return{valid:!0,data:a}}else if(n===M.array&&r===M.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let s=0;s<e.length;s++){const a=e[s],c=t[s],l=Us(a,c);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===M.date&&r===M.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class dr extends X{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(s,a)=>{if(Ls(s)||Ls(a))return z;const c=Us(s.value,a.value);return c.valid?(($s(s)||$s(a))&&n.dirty(),{status:n.value,value:c.data}):(j(r,{code:R.invalid_intersection_types}),z)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,a])=>i(s,a)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}dr.create=(e,t,n)=>new dr({left:e,right:t,typeName:H.ZodIntersection,...J(n)});class _t extends X{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==M.array)return j(r,{code:R.invalid_type,expected:M.array,received:r.parsedType}),z;if(r.data.length<this._def.items.length)return j(r,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),z;!this._def.rest&&r.data.length>this._def.items.length&&(j(r,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((a,c)=>{const l=this._def.items[c]||this._def.rest;return l?l._parse(new gt(r,a,r.path,c)):null}).filter(a=>!!a);return r.common.async?Promise.all(s).then(a=>$e.mergeArray(n,a)):$e.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new _t({...this._def,rest:t})}}_t.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _t({items:e,typeName:H.ZodTuple,rest:null,...J(t)})};class ur extends X{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==M.object)return j(r,{code:R.invalid_type,expected:M.object,received:r.parsedType}),z;const i=[],s=this._def.keyType,a=this._def.valueType;for(const c in r.data)i.push({key:s._parse(new gt(r,c,r.path,c)),value:a._parse(new gt(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?$e.mergeObjectAsync(n,i):$e.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof X?new ur({keyType:t,valueType:n,typeName:H.ZodRecord,...J(r)}):new ur({keyType:at.create(),valueType:t,typeName:H.ZodRecord,...J(n)})}}class li extends X{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==M.map)return j(r,{code:R.invalid_type,expected:M.map,received:r.parsedType}),z;const i=this._def.keyType,s=this._def.valueType,a=[...r.data.entries()].map(([c,l],d)=>({key:i._parse(new gt(r,c,r.path,[d,"key"])),value:s._parse(new gt(r,l,r.path,[d,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const l of a){const d=await l.key,u=await l.value;if(d.status==="aborted"||u.status==="aborted")return z;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),c.set(d.value,u.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const l of a){const d=l.key,u=l.value;if(d.status==="aborted"||u.status==="aborted")return z;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),c.set(d.value,u.value)}return{status:n.value,value:c}}}}li.create=(e,t,n)=>new li({valueType:t,keyType:e,typeName:H.ZodMap,...J(n)});class ln extends X{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==M.set)return j(r,{code:R.invalid_type,expected:M.set,received:r.parsedType}),z;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(j(r,{code:R.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(j(r,{code:R.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function a(l){const d=new Set;for(const u of l){if(u.status==="aborted")return z;u.status==="dirty"&&n.dirty(),d.add(u.value)}return{status:n.value,value:d}}const c=[...r.data.values()].map((l,d)=>s._parse(new gt(r,l,r.path,d)));return r.common.async?Promise.all(c).then(l=>a(l)):a(c)}min(t,n){return new ln({...this._def,minSize:{value:t,message:U.toString(n)}})}max(t,n){return new ln({...this._def,maxSize:{value:t,message:U.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}ln.create=(e,t)=>new ln({valueType:e,minSize:null,maxSize:null,typeName:H.ZodSet,...J(t)});class En extends X{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==M.function)return j(n,{code:R.invalid_type,expected:M.function,received:n.parsedType}),z;function r(c,l){return si({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ii(),Tn].filter(d=>!!d),issueData:{code:R.invalid_arguments,argumentsError:l}})}function i(c,l){return si({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ii(),Tn].filter(d=>!!d),issueData:{code:R.invalid_return_type,returnTypeError:l}})}const s={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof An){const c=this;return Ue(async function(...l){const d=new Ye([]),u=await c._def.args.parseAsync(l,s).catch(g=>{throw d.addIssue(r(l,g)),d}),f=await Reflect.apply(a,this,u);return await c._def.returns._def.type.parseAsync(f,s).catch(g=>{throw d.addIssue(i(f,g)),d})})}else{const c=this;return Ue(function(...l){const d=c._def.args.safeParse(l,s);if(!d.success)throw new Ye([r(l,d.error)]);const u=Reflect.apply(a,this,d.data),f=c._def.returns.safeParse(u,s);if(!f.success)throw new Ye([i(u,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new En({...this._def,args:_t.create(t).rest(tn.create())})}returns(t){return new En({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new En({args:t||_t.create([]).rest(tn.create()),returns:n||tn.create(),typeName:H.ZodFunction,...J(r)})}}class fr extends X{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}fr.create=(e,t)=>new fr({getter:e,typeName:H.ZodLazy,...J(t)});class pr extends X{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return j(n,{received:n.data,code:R.invalid_literal,expected:this._def.value}),z}return{status:"valid",value:t.data}}get value(){return this._def.value}}pr.create=(e,t)=>new pr({value:e,typeName:H.ZodLiteral,...J(t)});function sd(e,t){return new Bt({values:e,typeName:H.ZodEnum,...J(t)})}class Bt extends X{constructor(){super(...arguments),Kn.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return j(n,{expected:re.joinValues(r),received:n.parsedType,code:R.invalid_type}),z}if(oi(this,Kn)||td(this,Kn,new Set(this._def.values)),!oi(this,Kn).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return j(n,{received:n.data,code:R.invalid_enum_value,options:r}),z}return Ue(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Bt.create(t,{...this._def,...n})}exclude(t,n=this._def){return Bt.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Kn=new WeakMap;Bt.create=sd;class hr extends X{constructor(){super(...arguments),Vn.set(this,void 0)}_parse(t){const n=re.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==M.string&&r.parsedType!==M.number){const i=re.objectValues(n);return j(r,{expected:re.joinValues(i),received:r.parsedType,code:R.invalid_type}),z}if(oi(this,Vn)||td(this,Vn,new Set(re.getValidEnumValues(this._def.values))),!oi(this,Vn).has(t.data)){const i=re.objectValues(n);return j(r,{received:r.data,code:R.invalid_enum_value,options:i}),z}return Ue(t.data)}get enum(){return this._def.values}}Vn=new WeakMap;hr.create=(e,t)=>new hr({values:e,typeName:H.ZodNativeEnum,...J(t)});class An extends X{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==M.promise&&n.common.async===!1)return j(n,{code:R.invalid_type,expected:M.promise,received:n.parsedType}),z;const r=n.parsedType===M.promise?n.data:Promise.resolve(n.data);return Ue(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}An.create=(e,t)=>new An({type:e,typeName:H.ZodPromise,...J(t)});class lt extends X{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===H.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:a=>{j(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const a=i.transform(r.data,s);if(r.common.async)return Promise.resolve(a).then(async c=>{if(n.value==="aborted")return z;const l=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return l.status==="aborted"?z:l.status==="dirty"||n.value==="dirty"?vn(l.value):l});{if(n.value==="aborted")return z;const c=this._def.schema._parseSync({data:a,path:r.path,parent:r});return c.status==="aborted"?z:c.status==="dirty"||n.value==="dirty"?vn(c.value):c}}if(i.type==="refinement"){const a=c=>{const l=i.refinement(c,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?z:(c.status==="dirty"&&n.dirty(),a(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?z:(c.status==="dirty"&&n.dirty(),a(c.value).then(()=>({status:n.value,value:c.value}))))}if(i.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!an(a))return a;const c=i.transform(a.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>an(a)?Promise.resolve(i.transform(a.value,s)).then(c=>({status:n.value,value:c})):a);re.assertNever(i)}}lt.create=(e,t,n)=>new lt({schema:e,typeName:H.ZodEffects,effect:t,...J(n)});lt.createWithPreprocess=(e,t,n)=>new lt({schema:t,effect:{type:"preprocess",transform:e},typeName:H.ZodEffects,...J(n)});class ht extends X{_parse(t){return this._getType(t)===M.undefined?Ue(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ht.create=(e,t)=>new ht({innerType:e,typeName:H.ZodOptional,...J(t)});class Gt extends X{_parse(t){return this._getType(t)===M.null?Ue(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Gt.create=(e,t)=>new Gt({innerType:e,typeName:H.ZodNullable,...J(t)});class mr extends X{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===M.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}mr.create=(e,t)=>new mr({innerType:e,typeName:H.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...J(t)});class gr extends X{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return sr(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ye(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ye(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}gr.create=(e,t)=>new gr({innerType:e,typeName:H.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...J(t)});class di extends X{_parse(t){if(this._getType(t)!==M.nan){const r=this._getOrReturnCtx(t);return j(r,{code:R.invalid_type,expected:M.nan,received:r.parsedType}),z}return{status:"valid",value:t.data}}}di.create=e=>new di({typeName:H.ZodNaN,...J(e)});const oh=Symbol("zod_brand");class Io extends X{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Tr extends X{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?z:s.status==="dirty"?(n.dirty(),vn(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?z:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new Tr({in:t,out:n,typeName:H.ZodPipeline})}}class _r extends X{_parse(t){const n=this._def.innerType._parse(t),r=i=>(an(i)&&(i.value=Object.freeze(i.value)),i);return sr(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}_r.create=(e,t)=>new _r({innerType:e,typeName:H.ZodReadonly,...J(t)});function za(e,t){const n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function od(e,t={},n){return e?Cn.create().superRefine((r,i)=>{var s,a;const c=e(r);if(c instanceof Promise)return c.then(l=>{var d,u;if(!l){const f=za(t,r),p=(u=(d=f.fatal)!==null&&d!==void 0?d:n)!==null&&u!==void 0?u:!0;i.addIssue({code:"custom",...f,fatal:p})}});if(!c){const l=za(t,r),d=(a=(s=l.fatal)!==null&&s!==void 0?s:n)!==null&&a!==void 0?a:!0;i.addIssue({code:"custom",...l,fatal:d})}}):Cn.create()}const ah={object:we.lazycreate};var H;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(H||(H={}));const ch=(e,t={message:`Input not instance of ${e.name}`})=>od(n=>n instanceof e,t),ad=at.create,cd=Ut.create,lh=di.create,dh=Ft.create,ld=or.create,uh=cn.create,fh=ai.create,ph=ar.create,hh=cr.create,mh=Cn.create,gh=tn.create,_h=xt.create,yh=ci.create,bh=ct.create,vh=we.create,wh=we.strictCreate,Sh=lr.create,kh=wi.create,Eh=dr.create,xh=_t.create,Ih=ur.create,Rh=li.create,Th=ln.create,Ch=En.create,Ah=fr.create,Oh=pr.create,Ph=Bt.create,jh=hr.create,Mh=An.create,Za=lt.create,Dh=ht.create,Nh=Gt.create,Lh=lt.createWithPreprocess,$h=Tr.create,Uh=()=>ad().optional(),Fh=()=>cd().optional(),Bh=()=>ld().optional(),Gh={string:e=>at.create({...e,coerce:!0}),number:e=>Ut.create({...e,coerce:!0}),boolean:e=>or.create({...e,coerce:!0}),bigint:e=>Ft.create({...e,coerce:!0}),date:e=>cn.create({...e,coerce:!0})},Hh=z;var o=Object.freeze({__proto__:null,defaultErrorMap:Tn,setErrorMap:Lp,getErrorMap:ii,makeIssue:si,EMPTY_PATH:$p,addIssueToContext:j,ParseStatus:$e,INVALID:z,DIRTY:vn,OK:Ue,isAborted:Ls,isDirty:$s,isValid:an,isAsync:sr,get util(){return re},get objectUtil(){return Ns},ZodParsedType:M,getParsedType:kt,ZodType:X,datetimeRegex:id,ZodString:at,ZodNumber:Ut,ZodBigInt:Ft,ZodBoolean:or,ZodDate:cn,ZodSymbol:ai,ZodUndefined:ar,ZodNull:cr,ZodAny:Cn,ZodUnknown:tn,ZodNever:xt,ZodVoid:ci,ZodArray:ct,ZodObject:we,ZodUnion:lr,ZodDiscriminatedUnion:wi,ZodIntersection:dr,ZodTuple:_t,ZodRecord:ur,ZodMap:li,ZodSet:ln,ZodFunction:En,ZodLazy:fr,ZodLiteral:pr,ZodEnum:Bt,ZodNativeEnum:hr,ZodPromise:An,ZodEffects:lt,ZodTransformer:lt,ZodOptional:ht,ZodNullable:Gt,ZodDefault:mr,ZodCatch:gr,ZodNaN:di,BRAND:oh,ZodBranded:Io,ZodPipeline:Tr,ZodReadonly:_r,custom:od,Schema:X,ZodSchema:X,late:ah,get ZodFirstPartyTypeKind(){return H},coerce:Gh,any:mh,array:bh,bigint:dh,boolean:ld,date:uh,discriminatedUnion:kh,effect:Za,enum:Ph,function:Ch,instanceof:ch,intersection:Eh,lazy:Ah,literal:Oh,map:Rh,nan:lh,nativeEnum:jh,never:_h,null:hh,nullable:Nh,number:cd,object:vh,oboolean:Bh,onumber:Fh,optional:Dh,ostring:Uh,pipeline:$h,preprocess:Lh,promise:Mh,record:Ih,set:Th,strictObject:wh,string:ad,symbol:fh,transformer:Za,tuple:xh,undefined:ph,union:Sh,unknown:gh,void:yh,NEVER:Hh,ZodIssueCode:R,quotelessJson:Np,ZodError:Ye});const Ka=o.enum(["app_start","sign_in","window_focus","surface_open"]),dd=o.object({id:o.string().min(1),state:o.enum(["active","paused","disabled"])}).passthrough(),Wh=o.object({tenant_id:o.string().min(1),tenant_name:o.string().optional(),eligible:o.boolean(),endpoint:dd.nullable()}).passthrough(),zh=o.object({code:o.string(),message:o.string(),details:o.record(o.unknown()).optional(),retry_after_seconds:o.number().optional()}).passthrough(),Zh=o.object({code:o.string().min(1),count:o.number().int().nonnegative(),session:o.string().min(1).nullable().optional().catch(null)}).passthrough().nullable().optional().catch(null),Kh=o.object({in_force:o.boolean(),notice_pending:o.boolean().catch(!1)}).passthrough().optional().catch(void 0),_x=o.object({capability:o.number(),consent_account_guard:o.boolean().optional(),state:o.enum(["ready","signed_out","unavailable","update_required"]),account_id:o.string().nullable(),tenant_id:o.string().nullable(),surface_state:o.enum(["A","B","C","D","E","F","G"]).nullable(),visibility:o.object({settings:o.boolean(),inbox:o.boolean(),account_door:o.boolean(),onboarding:o.boolean()}),update_required:o.boolean(),local:o.object({enabled:o.boolean(),onboarding:o.string(),session:o.string()}),status:o.object({tenants:o.array(Wh)}).passthrough().nullable(),consent:o.object({version:o.string().min(1).max(128),text:o.string().min(1).refine(e=>new TextEncoder().encode(e).length<=2048,"Consent exceeds the served-text contract"),source:o.enum(["served","cached","embedded"])}).nullable(),error:zh.nullable(),state_note:o.string().nullable().optional(),read_only:o.boolean().optional(),delivery_hold:Zh,default_on:Kh}).passthrough(),Vh=o.object({version:o.string().min(1),consented_at:o.string().min(1),consented_via:o.string().min(1),current:o.boolean()}).passthrough(),yx=o.object({endpoint:dd.extend({tenant_id:o.string().min(1),label:o.string().optional(),consent:Vh.nullable().optional(),created_at:o.string().optional(),updated_at:o.string().optional()}).nullable(),settings:o.object({tenant_id:o.string().min(1),eligible:o.boolean(),consent_version:o.string().optional(),consent_required:o.boolean()}).passthrough(),default_on:o.boolean().optional().catch(void 0)}).passthrough(),Yh=o.object({kind:o.enum(["endpoint","account"]).optional(),endpoint_id:o.string().min(1).optional(),account_id:o.string().min(1).optional()}).passthrough().refine(e=>!!e.endpoint_id!=!!e.account_id,"An allowlist target names exactly one of endpoint_id or account_id").refine(e=>e.kind===void 0||(e.kind==="endpoint"?e.endpoint_id!==void 0:e.account_id!==void 0),"An allowlist target's kind must agree with the id it carries"),Va=o.object({direction:o.enum(["send","receive"]),effect:o.enum(["allow","deny"]),target:Yh,id:o.string().optional()}).passthrough(),Ya=o.object({mode:o.enum(["class_default","listed_only"]),allow:o.number(),deny:o.number()}).passthrough(),bx=o.object({allowlist:o.object({tenant_id:o.string().min(1),entries:o.array(Va)}).passthrough(),view:o.object({tenant_id:o.string().nullable(),entries:o.array(Va),directions:o.object({send:Ya,receive:Ya}),class_default:o.literal("cos_cos"),cues:o.object({allow_entry_switches_direction_to_listed_only:o.boolean(),listed_only_affects:o.string(),removing_allow_does_not_stop_open_thread:o.boolean(),deny_stops_pair_both_directions:o.boolean()}).passthrough()}).passthrough()}).passthrough(),vx=o.object({onboarding:o.literal("seen")}).passthrough();function Qh(e){return e?.default_on?.in_force===!0}function wx(e,t){const n=Jh(e),r=t?.endpoint?.consent?.version;return n&&r&&n.version===r?n.text:null}function Sx(e,t){return e?.surface_state==="C"&&t?.default_on===!0&&t.endpoint?.state==="active"&&e.default_on?.notice_pending===!0}function kx(e,t){if(!e||!t||Qh(e)||e.account_id!==t||e.capability<1||e.state!=="ready"||e.update_required||e.surface_state!=="B"||!e.visibility.onboarding||!e.tenant_id)return null;const n=e.status?.tenants.filter(r=>r.tenant_id===e.tenant_id);return n?.length!==1||n[0].eligible!==!0||n[0].endpoint!==null?null:{accountId:t,tenantId:e.tenant_id}}function Jh(e){const t=e?.consent;return t&&(t.source==="served"||t.source==="cached")?t:null}const Xh=8,Fs=["aida","library","projects","agents","schedules","browser","team-bridge","agent-hub","mesh","notifications"],qh=6*1024,em=512;function ui(e,t,n){let r=new TextEncoder().encode(`${t}${e.size?`?${e}`:""}`).length;const i=[];for(const s of n){if(i.length===em)break;const c=new URLSearchParams({order_ids:s}).toString().length+1;if(r+c>qh)break;e.append("order_ids",s),i.push(s),r+=c}return i}function tm(e,t,n){return ui(new URLSearchParams(n),t,e)}const v=o.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/),Fr=o.string().min(1).max(256).regex(/^[a-zA-Z0-9_][a-zA-Z0-9_.-]*$/),Br=o.string().min(1).max(32768),nm=/^[a-f0-9]{12}$/,L=o.string().regex(nm),Yi=o.string().regex(/^[a-f0-9]{12}$/),Qi=o.string().min(1).max(128),rm=o.string().min(1).max(4096),Un=o.string().min(1).max(128).regex(/^[A-Za-z0-9_.-]+$/),Ji=o.string().regex(/^[A-Za-z0-9_.:-]{1,100}$/),Gr=o.string().regex(/^\$\{[A-Za-z_][A-Za-z0-9_]*\}$/),Qa=o.string().regex(/^[a-f0-9]{32}$/),im=/^(\/|[A-Za-z]:[\\/])/,Xi=o.string().min(1).max(4096).regex(im),Ja=/^[a-f0-9]{32}$/,te=o.string().regex(/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/),Xa=o.string().min(1).max(512).nullish(),mn=o.string().regex(/^[A-Za-z0-9_-]{1,128}$/),qa=o.string().regex(/^ap_[0-9a-hjkmnp-tv-z]{1,64}$/),Fn=o.string().regex(/^la_[0-9a-f]{16}$/),Bn=o.string().min(1).max(128).regex(/^[A-Za-z0-9_.:-]+$/),ec=o.object({data_b64:o.string().min(1).max(1e6),mime_type:o.enum(["image/png","image/jpeg","image/gif","image/webp"]),origin_path:o.string().max(4096).optional()}).strict(),sm=o.object({digest:o.string().regex(/^[0-9a-f]{32}$/),name:o.string().max(1024).optional(),mime_type:o.string().max(255).optional(),bytes:o.number().int().min(0).optional(),path:o.string().max(4096).optional()}).strict(),tc=2e5,nc=8,om=256,am=100,rc=16,cm=256,lm=100,dm=200,um=1e6,fm=o.enum(["auto","none","minimal","low","medium","high","xhigh","max"]),Me=o.string().min(1).max(128).refine(e=>e!=="."&&e!==".."&&!e.includes("/")&&!e.includes("\\")&&[...e].every(t=>t.charCodeAt(0)>=32&&t.charCodeAt(0)!==127)),Hr=o.object({kind:o.enum(["agent","team"]),name:Me}).strict(),ud=o.enum(["claude","codex","omp"]),pm=o.record(o.string(),o.array(o.string().min(1).max(512)).max(5e3)),ic={sources:o.array(ud).max(3).optional(),sessionIds:pm.optional(),all:o.boolean().optional(),includeSubagents:o.boolean().optional(),includeClearedSegments:o.boolean().optional(),includeMemory:o.boolean().optional(),includeInstructions:o.boolean().optional(),maxSessions:o.number().int().min(1).max(5e3).optional()},qi=o.object({provider:o.string().min(1).max(128),model_id:o.string().min(1).max(512),reasoning_effort:o.string().min(1).max(64).nullable(),fast_mode:o.boolean().nullable().optional()}).strict(),sc=o.object({kind:o.enum(["role","specialist"]).optional(),description:o.string().max(8e3).optional(),instructions:o.string().max(8e3).optional(),tools:o.array(o.string().min(1).max(128)).max(256).optional(),effort:o.string().max(64).optional(),delegate:o.boolean().optional(),action_class:o.enum(["reactive","proactive"]).optional()}).strict(),oc=o.object({name:o.string().min(1).max(64).optional(),description:o.string().max(8e3).optional(),manager:Me.optional(),members:o.array(o.object({role:Me,count:o.number().int().min(1).max(16),kind:o.enum(["agent","team"]),tier:o.enum(["lo","med","hi"]).nullable().optional(),effort:fm.nullable().optional()}).strict()).max(128).optional(),instructions:o.string().max(8e3).optional(),project:o.string().max(8e3).optional()}).strict(),hm=o.record(o.array(o.string().max(1024)).max(100)),es=o.array(v).max(4).refine(e=>new Set(e).size===e.length,"Duplicate attachment"),mm=o.array(o.object({kind:o.enum(["human","agent"]),account_id:v,endpoint_id:v.optional()}).strict()).max(50).refine(e=>new Set(e.map(t=>`${t.kind}:${t.account_id}:${t.endpoint_id??""}`)).size===e.length,"Duplicate mention"),ac=o.enum(["minutes","hours","days"]);function gm(e){return!/^\.+$/.test(e)}const Ex=e=>qr.safeParse(e).success,qr=o.string().min(1).max(128).refine(e=>[...e].every(t=>t.charCodeAt(0)>=32&&t.charCodeAt(0)!==127&&t!=="/"&&t!=="\\")).refine(gm),cc=o.enum(["str","int","float","bool","list","dict"]),lc=o.string().max(16384),_m=2e3,dc=o.string().min(1).max(_m),uc=o.string().min(1).max(64),ym=o.string().min(1).max(64),bm=o.string().min(1).max(64),fc=o.object({is_active:o.boolean().nullish(),one_time:o.boolean().nullish(),start_time_utc:o.string().max(64).nullish(),end_time_utc:o.string().max(64).nullish()}).strict(),vm=o.object({conversation_length:o.number().int().optional(),detail_length:o.number().int().optional(),max_learnings_history:o.number().int().optional(),hosting:o.string().max(256).optional(),model_name:o.string().max(1024).optional(),auto_save_conversation:o.boolean().optional()}).strict(),Bs=128,pc=2e3,hc=8e3,mc=64,gc=64,Si=e=>[...e].length,Gs=e=>e>=9&&e<=13||e>=28&&e<=32||e===133||e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288,wm=e=>e===9||e===10||e===11||e===12||e===13||e===133,Sm=e=>e<=31||e>=127&&e<=159,km=e=>new RegExp("\\p{Cf}","u").test(String.fromCodePoint(e)),Em=e=>e>=8234&&e<=8238||e>=8294&&e<=8297,Wr=(e,t)=>{for(const n of e)if(t(n.codePointAt(0)??0))return!0;return!1},fd=e=>{const t=[...e];let n=0,r=t.length;for(;n<r&&Gs(t[n].codePointAt(0)??0);)n++;for(;r>n&&Gs(t[r-1].codePointAt(0)??0);)r--;return t.slice(n,r).join("")},xm=e=>{let t="",n=!1;for(const r of e){if(Gs(r.codePointAt(0)??0)){n=t.length>0;continue}n&&(t+=" ",n=!1),t+=r}return t};function Im(e){const t=fd(e);if(!t)return"must not be empty";if(Si(t)>Bs)return`must be at most ${Bs} characters`;if(/[/\\:]/.test(t))return'must not contain "/", "\\" or ":"';if(Wr(t,Em))return"must not contain Unicode bidirectional override characters";if(Wr(t,wm))return"must not contain whitespace";if(Wr(t,Sm))return"must not contain control characters";if(Wr(t,km))return"must not contain invisible Unicode formatting characters";const n=[...t];return"-.".includes(n[0])||"-.".includes(n[n.length-1])?'must not begin or end with "-" or "."':null}function xx(e){return xm(fd(e).normalize("NFKC").toLowerCase())}function Rm(e){return e.trim()?Si(e)>pc?`must be at most ${pc} characters`:null:"must not be empty"}function Tm(e){return e.trim()?Si(e)>hc?`must be at most ${hc} characters`:null:"must not be empty"}function Cm(e){if(e.length>gc)return`must hold at most ${gc} items`;for(const t of e)if(!t.trim()||Si(t)>mc)return`must hold items of 1 to ${mc} characters`;return null}const Am=e=>Im(e)===null,Om=o.string().refine(Am,{message:"That is not a name the hub can publish."}),Pm=o.string().refine(e=>Tm(e)===null,{message:"That instruction body cannot be published."}),jm=o.string().refine(e=>Rm(e)===null,{message:"That description cannot be published."}),Mm=o.array(o.string()).refine(e=>Cm(e)===null,{message:"That tool list cannot be published."}),ts={requestId:te.optional(),subscribe:o.boolean().optional(),autoPush:o.boolean().optional(),confirmPublicEgress:o.boolean().optional()},_c=o.object({name:Om,description:jm,instructions:Pm,kind:o.enum(["role","specialist"]),when_to_use:o.string(),tools:Mm,effort:o.string(),delegate:o.boolean(),version:o.string(),categories:o.array(o.string()),tags:o.array(o.string())}).partial().strict(),Dm=o.enum(["team","agent"]),Nm=o.string().min(1).max(64),Lm=o.string().min(1).max(256),pd=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,ns=o.string().regex(pd,{message:"Letters, digits, dot, underscore and dash; no spaces."}),$m=["planning","active","qa","validation","done","paused","archived"],yc=o.enum($m),zr=o.string().regex(/^$|^\d{4}-\d{2}-\d{2}$/,"Dates are YYYY-MM-DD, or empty to clear."),bc=o.array(o.string().min(1).max(24)).max(8),Mt=o.string().min(1).max(64),Um=1e3,vc=240,wc=80,Fm=256,Bm=100,Gm=200,Hm=/^[a-z0-9][a-z0-9_-]{0,23}$/;function Ix(e){return e?pd.test(e)?null:"Names start with a letter or digit and may use letters, digits, dot, underscore or dash.":"Give the project a name."}function Rx(e){return Hm.test(e)?null:"Tags are 1-24 characters of lowercase letters, digits, underscore or dash."}const Zr=o.enum(["agent","team","skill"]),rs=o.string().min(1).max(128).regex(/\S/),Sc=o.enum(Fs),Wm=o.object({visible:o.array(Sc).max(Fs.length),more:o.array(Sc).max(Fs.length)}).strict(),Et=o.string().min(3).max(256).regex(/^(?:n_[a-z2-7]{4,32}|ask:[A-Za-z0-9_-]+:[A-Za-z0-9_-]+)$/),kc=o.object({selectionToken:o.string().min(1).max(512),reconcileIds:o.array(Et).max(500).optional(),excludedIds:o.array(Et).max(500).optional()}).strict(),zm=o.object({operationToken:o.string().min(1).max(512),reconcileIds:o.array(Et).max(500).optional()}).strict(),Ec=o.union([o.object({throughSeq:o.number().int().min(0).optional(),receipt:o.literal(!0).optional(),reconcileIds:o.array(Et).max(500).optional(),items:o.array(o.object({id:Et,revision:o.number().int().min(1)}).strict()).min(1).max(500)}).strict(),o.object({sessionId:L,throughSeq:o.number().int().min(0),observed:o.array(o.object({id:Et,revision:o.number().int().min(1)}).strict()).max(500)}).strict(),o.object({all:o.literal(!0),throughSeq:o.number().int().min(0),observed:o.array(o.object({id:Et,revision:o.number().int().min(1)}).strict()).max(500)}).strict()]),Zm={pointer:"pointerdown",key:"keydown",wheel:"wheel"},Km=o.discriminatedUnion("op",[o.object({op:o.literal("capabilities")}).strict(),o.object({op:o.literal("runtimes.list")}).strict(),o.object({op:o.literal("profiles.list")}).strict(),o.object({op:o.literal("profiles.get"),name:Me}).strict(),o.object({op:o.literal("imports.sources")}).strict(),o.object({op:o.literal("imports.sessions"),source:ud,includeSubagents:o.boolean().optional()}).strict(),o.object({op:o.literal("imports.preview"),...ic}).strict(),o.object({op:o.literal("imports.start"),...ic}).strict(),o.object({op:o.literal("imports.status"),jobId:o.string().min(1).max(128)}).strict(),o.object({op:o.literal("imports.cancel"),jobId:o.string().min(1).max(128)}).strict(),o.object({op:o.literal("profiles.update"),name:Me,requestId:te,fields:sc,expectedDefinitionRevision:Xa.optional()}).strict(),o.object({op:o.literal("profiles.install"),name:Me,requestId:te}).strict(),o.object({op:o.literal("profiles.create"),name:Me,requestId:te,fields:sc.extend({description:o.string().max(8e3),instructions:o.string().min(1).max(8e3)})}).strict(),o.object({op:o.literal("hub.updates")}).strict(),o.object({op:o.literal("hub.skillPull"),requestId:te,hubId:v,hubSource:o.string().min(1).max(2048),visibility:o.enum(["public","org"]),tenantId:v.nullable(),localAlias:Me,subscribe:o.boolean().optional(),autoPush:o.boolean().optional(),confirmPublicEgress:o.boolean().optional()}).strict(),o.object({op:o.literal("hub.skillSubscribe"),requestId:te,hubId:v,hubSource:o.string().min(1).max(2048),visibility:o.enum(["public","org"]),tenantId:v.nullable(),localAlias:Me}).strict(),o.object({op:o.literal("hub.skillUnpull"),requestId:te,linkId:o.string().min(1).max(256)}).strict(),o.object({op:o.literal("hub.skillPublish"),requestId:te,dryRun:o.boolean(),sourceSkill:Me,localAlias:Me,visibility:o.enum(["public","org"]),tenantId:v.nullable(),subscribe:o.boolean(),autoPush:o.boolean(),confirmPublicEgress:o.boolean(),previewReceipt:o.string().min(1).max(4096).optional(),confirmPublish:o.literal(!0).optional()}).strict(),o.object({op:o.literal("hub.links"),kind:o.enum(["agent","team","skill"]).optional()}).strict(),o.object({op:o.literal("hub.policy"),requestId:te,linkId:o.string().min(1).max(256),expectedPolicyRevision:o.string().min(1).max(256),subscribe:o.boolean().optional(),autoPush:o.boolean().optional(),confirmPublicEgress:o.boolean().optional()}).strict(),o.object({op:o.literal("hub.check"),requestId:te,kind:Zr.optional(),name:Me.optional(),localId:rs.optional()}).strict(),o.object({op:o.literal("hub.apply"),requestId:te,kind:Zr.optional(),name:Me.optional(),localId:rs.optional(),prefer:o.enum(["local","remote"]).optional(),acknowledgeUnknownBaseline:o.boolean().optional(),dryRun:o.boolean().optional(),resolveSource:o.literal(!0).optional(),hubSource:o.string().min(1).max(2048).optional(),visibility:o.enum(["public","org"]).optional(),tenantId:o.string().min(1).max(128).nullable().optional()}).strict(),o.object({op:o.literal("hub.applyAll"),requestId:te,kind:Zr.optional()}).strict(),o.object({op:o.literal("hub.retry"),requestId:te,kind:Zr.optional(),name:Me.optional(),localId:rs.optional()}).strict(),o.object({op:o.literal("hub.push"),requestId:te,linkId:o.string().min(1).max(256),direction:o.literal("push"),dryRun:o.boolean(),previewReceipt:o.string().min(1).max(4096).optional(),confirmPublish:o.literal(!0).optional()}).strict(),o.object({op:o.literal("teams.list")}).strict(),o.object({op:o.literal("teams.get"),name:Me}).strict(),o.object({op:o.literal("teams.effective"),name:Me}).strict(),o.object({op:o.literal("teams.update"),name:Me,requestId:te,fields:oc,expectedDefinitionRevision:Xa.optional()}).strict(),o.object({op:o.literal("teams.create"),requestId:te,fields:oc.extend({name:o.string().min(1).max(64)})}).strict(),o.object({op:o.literal("sessions.list"),limit:o.number().int().min(1).max(500).optional(),include_archived:o.boolean().optional(),include_peers:o.boolean().optional(),scope_kind:Dm.optional(),scope_name:Nm.optional(),cursor:Lm.optional(),with_counts:o.boolean().optional(),sort:o.literal("activity").optional()}).strict(),o.object({op:o.literal("delegated_cleanup_notice.ack")}).strict(),o.object({op:o.literal("sessions.search"),q:o.string().min(1).max(om),limit:o.number().int().min(1).max(500).optional(),include_archived:o.boolean().optional()}).strict(),o.object({op:o.literal("sessions.archive"),sessionId:L,archived:o.boolean()}).strict(),o.object({op:o.literal("sessions.delete"),sessionId:L,confirmed:o.literal(!0)}).strict(),o.object({op:o.literal("sessions.create"),requestId:te,cwd:o.string().min(1).max(4096).optional(),target:Hr.optional(),purpose:o.literal("agents-config").optional(),model:qi.optional(),draftId:L.optional(),peer:mn.optional()}).strict(),o.object({op:o.literal("sessions.preview"),requestId:te,cwd:o.string().min(1).max(4096),target:Hr.optional(),model:qi.optional()}).strict(),o.object({op:o.literal("sessions.draft"),requestId:te,cwd:o.string().min(1).max(4096),target:Hr.optional(),model:qi.optional()}).strict(),o.object({op:o.literal("sessions.get"),sessionId:L,journalOrder:o.boolean().optional(),orderIds:o.array(o.string().min(1).max(128)).max(512).optional(),peerJournalSource:o.boolean().optional()}).strict(),o.object({op:o.literal("sessions.files"),sessionId:L,scope:o.enum(["family","self"]).optional(),kind:o.string().max(256).optional(),q:o.string().max(256).optional(),sort:o.enum(["recent","name","kind","modified","created","size"]).optional(),order:o.enum(["asc","desc"]).optional(),limit:o.number().int().min(1).max(200).optional(),cursor:o.string().max(8192).optional()}).strict(),o.object({op:o.literal("sessions.files.materialise"),sessionId:L,fileId:o.string().regex(/^[a-f0-9]{16}$/)}).strict(),o.object({op:o.literal("sessions.userAttachments"),sessionId:L}).strict(),o.object({op:o.literal("sessions.userAttachments.materialise"),sessionId:L,digest:o.string().regex(/^[a-f0-9]{32}$/)}).strict(),o.object({op:o.literal("sessions.history"),sessionId:L,beforeId:v.optional(),limit:o.number().int().min(1).max(500).optional(),openFrame:o.boolean().optional(),journalOrder:o.boolean().optional(),orderIds:o.array(o.string().min(1).max(128)).max(512).optional(),peerJournalSource:o.boolean().optional(),sourceRead:o.enum(["metadata","payload"]).optional(),expectedJournalGeneration:o.string().min(1).max(128).optional()}).strict(),o.object({op:o.literal("sessions.checkpoints"),sessionId:L}).strict(),o.object({op:o.literal("sessions.checkpoints.warm"),sessionId:L,ids:o.array(v).max(rc).optional(),limit:o.number().int().min(1).max(rc).optional()}).strict(),o.object({op:o.literal("sessions.find"),sessionId:L,q:o.string().min(1).max(cm),limit:o.number().int().min(1).max(dm).optional()}).strict(),o.object({op:o.literal("subagents.transcript"),sessionId:L,childId:L,beforeId:v.optional(),limit:o.number().int().min(1).max(500).optional()}).strict(),o.object({op:o.literal("sessions.message"),sessionId:L,requestId:te,text:o.string().max(tc),images:o.array(ec).max(nc).optional(),files:o.array(sm).max(Xh).optional(),mode:o.enum(["prompt","steer"]).optional(),inputMode:o.enum(["typed","dictated","mixed"]).optional(),inputPath:o.string().max(1024).optional()}).strict(),o.object({op:o.literal("sessions.command"),sessionId:L,requestId:te,command:o.string().regex(/^\/?[A-Za-z]+$/).max(64),args:o.string().max(tc).optional(),images:o.array(ec).max(nc).optional()}).strict(),o.object({op:o.literal("sessions.move"),sessionId:L,requestId:te,cwd:o.string().min(1).max(4096)}).strict(),o.object({op:o.literal("sessions.answer"),sessionId:L,epoch:v.optional(),requestId:v.optional(),value:o.string().max(32768).optional(),approved:o.boolean().optional(),questionIndex:o.number().int().min(0).optional(),askId:v.optional(),answers:o.record(o.string(),o.array(o.string().max(32768))).optional(),decline:o.boolean().optional(),revise:o.boolean().optional(),dismiss:o.boolean().optional(),reason:o.enum(["answered_in_chat","moot"]).optional()}).strict(),o.object({op:o.literal("sessions.seen"),sessionId:L,completionToken:o.string().uuid()}).strict(),o.object({op:o.literal("attention.seen"),items:o.array(o.object({sessionId:L,completionToken:o.string().uuid()}).strict()).min(1).max(500)}).strict(),o.object({op:o.literal("sessions.notified"),sessionId:L,completionToken:o.string().uuid()}).strict(),o.object({op:o.literal("tags.list")}).strict(),o.object({op:o.literal("tags.replace"),tags:o.array(o.object({id:o.string().optional(),name:o.string()}).strict())}).strict(),o.object({op:o.literal("sessions.tags"),expected_revision:o.string().optional(),sessionId:L,tags:o.array(o.string()),primary:o.string().nullable()}).strict(),o.object({op:o.literal("sessions.pin"),sessionId:L,pinned:o.boolean()}).strict(),o.object({op:o.literal("sessions.watch"),sessionId:L,subscriptionId:o.string().regex(Ja),visible:o.boolean(),canNotify:o.boolean()}).strict(),o.object({op:o.literal("sessions.warm"),sessionId:L}).strict(),o.object({op:o.literal("sessions.interrupt"),sessionId:L,requestId:te}).strict(),o.object({op:o.literal("supplements.cancel"),sessionId:L,job:Yi,anchor:Qi}).strict(),o.object({op:o.literal("supplements.restart"),sessionId:L,job:Yi,anchor:Qi}).strict(),o.object({op:o.literal("supplements.steer"),sessionId:L,job:Yi,anchor:Qi,text:o.string().min(1).max(500)}).strict(),o.object({op:o.literal("sessions.variables.list"),sessionId:L}).strict(),o.object({op:o.literal("sessions.variables.create"),sessionId:L,key:qr,value:lc,type:cc}).strict(),o.object({op:o.literal("sessions.variables.update"),sessionId:L,key:qr,value:lc,type:cc}).strict(),o.object({op:o.literal("sessions.variables.delete"),sessionId:L,key:qr}).strict(),o.object({op:o.literal("sessions.presence"),subscriptionId:o.string().regex(/^[a-f0-9]{1,64}$/),canNotify:o.boolean(),canNotifyKinds:o.array(o.enum(["complete","error"])).max(4),sessionId:o.string().regex(/^([a-f0-9]{12})?$/),window:o.object({exists:o.boolean(),focused:o.boolean(),visible:o.boolean(),minimized:o.boolean()}).strict()}).strict(),o.object({op:o.literal("legacy.models"),provider:o.string().max(128).optional(),sort:o.enum(["id","name","provider","recommended"]).optional(),direction:o.enum(["ascending","descending"]).optional()}).strict(),o.object({op:o.literal("legacy.models.providers")}).strict(),o.object({op:o.literal("auth.probe"),provider:v}).strict(),o.object({op:o.literal("legacy.agent.upload"),agentId:v}).strict(),o.object({op:o.literal("agent.publish"),agentId:v,document:_c.optional(),...ts,visibility:o.literal("org").optional(),tenantId:v.optional()}).strict(),o.object({op:o.literal("agent.republish"),agentId:v,hubAgentId:v,expectedRemoteRevision:o.string().min(1).max(512).optional(),document:_c.optional(),...ts,visibility:o.literal("org").optional(),tenantId:v.optional()}).strict(),o.object({op:o.literal("team.publish"),teamId:v,...ts,visibility:o.literal("org").optional(),tenantId:v.optional()}).strict(),o.object({op:o.literal("team.pull"),teamId:v,tenantId:v.optional()}).strict(),o.object({op:o.literal("agent.nameAvailability"),name:o.string().min(1).max(Bs)}).strict(),o.object({op:o.literal("legacy.agents.list"),page:o.number().int().min(1).optional(),perPage:o.number().int().min(1).max(500).optional(),name:o.string().max(256).optional(),sort:o.string().max(64).optional(),direction:o.enum(["asc","desc"]).optional()}).strict(),o.object({op:o.literal("legacy.agent.get"),agentId:v}).strict(),o.object({op:o.literal("legacy.agent.history"),agentId:v,page:o.number().int().min(1).optional(),perPage:o.number().int().min(1).max(500).optional()}).strict(),o.object({op:o.literal("legacy.jobs.list"),agentId:v.optional(),status:o.string().max(64).optional()}).strict(),o.object({op:o.literal("legacy.job.get"),jobId:v}).strict(),o.object({op:o.literal("legacy.schedules.list"),page:o.number().int().min(1).optional(),perPage:o.number().int().min(1).max(100).optional()}).strict(),o.object({op:o.literal("legacy.agent.schedules.list"),agentId:v,page:o.number().int().min(1).optional(),perPage:o.number().int().min(1).max(100).optional()}).strict(),o.object({op:o.literal("legacy.agent.schedule.create"),agentId:v,schedule:fc.extend({prompt:o.string().max(64e3),interval:o.number().int().min(1),unit:ac})}).strict(),o.object({op:o.literal("legacy.schedule.get"),scheduleId:v}).strict(),o.object({op:o.literal("legacy.schedule.edit"),scheduleId:v,schedule:fc.extend({prompt:o.string().max(64e3).nullish(),interval:o.number().int().min(1).nullish(),unit:ac.nullish()})}).strict(),o.object({op:o.literal("legacy.schedule.remove"),scheduleId:v}).strict(),o.object({op:o.literal("legacy.agent.create"),agent:o.record(o.unknown())}).strict(),o.object({op:o.literal("legacy.agent.update"),agentId:v,update:o.record(o.unknown())}).strict(),o.object({op:o.literal("legacy.agent.delete"),agentId:v}).strict(),o.object({op:o.literal("legacy.agent.conversation.clear"),agentId:v}).strict(),o.object({op:o.literal("legacy.agent.systemPrompt.get"),agentId:v}).strict(),o.object({op:o.literal("legacy.agent.systemPrompt.update"),agentId:v,systemPrompt:o.string().max(um)}).strict(),o.object({op:o.literal("legacy.agent.download"),agentId:v}).strict(),o.object({op:o.literal("legacy.job.cancel"),jobId:v}).strict(),o.object({op:o.literal("commands.list")}).strict(),o.object({op:o.literal("commands.entities"),sessionId:L,command:v,name:o.string().max(128).optional()}).strict(),o.object({op:o.literal("models.catalogue"),live:o.boolean().optional(),scope:o.enum(["usable","all"]).optional()}).strict(),o.object({op:o.literal("usage.get"),provider:v.optional(),live:o.boolean().optional(),refresh:o.boolean().optional()}).strict(),o.object({op:o.literal("quota.notice"),provider:v.optional(),model:o.string().min(1).max(200).optional(),refresh:o.boolean().optional()}).strict(),o.object({op:o.literal("analytics.get"),sessionId:L.optional(),sinceMs:o.number().int().nonnegative().optional(),untilMs:o.number().int().nonnegative().optional(),days:o.number().int().min(1).max(366).optional()}).strict(),o.object({op:o.literal("analytics.models"),sessionId:L.optional(),sinceMs:o.number().int().nonnegative().optional(),untilMs:o.number().int().nonnegative().optional(),days:o.number().int().min(1).max(366).optional()}).strict(),o.object({op:o.literal("info.get")}).strict(),o.object({op:o.literal("sessions.report"),sessionId:L,recentLimit:o.number().int().min(0).max(50).optional()}).strict(),o.object({op:o.literal("skills.list"),sessionId:L.optional(),cwd:rm.optional(),name:Un.optional()}).strict(),o.object({op:o.literal("skills.create"),requestId:te,name:Un,copyFrom:Un}).strict(),o.object({op:o.literal("skills.update"),requestId:te,name:Un,expectedFingerprint:o.string().regex(/^[a-f0-9]{64}$/),files:o.array(o.object({path:o.string().min(1).max(240),content:o.string().max(1024*1024)}).strict()).min(1).max(64)}).strict(),o.object({op:o.literal("skills.remove"),requestId:te,name:Un,discardLocalChanges:o.boolean()}).strict(),o.object({op:o.literal("sessions.failovers"),sessionId:L}).strict(),o.object({op:o.literal("sessions.credential"),sessionId:L,action:o.enum(["list","store","forget"]),key:Fr.optional(),value:Br.optional(),confirmed:o.boolean().optional()}).strict(),o.object({op:o.literal("sessions.fork"),sessionId:L,requestId:te,message:o.string().max(2e5).optional(),boundary:o.enum(["next_safe","at_entry"]).optional(),entryId:o.string().max(128).optional(),autoTag:o.boolean().optional()}).strict(),o.object({op:o.literal("sessions.stop"),requestId:te,targets:o.array(L).min(1).max(100),confirmed:o.literal(!0)}).strict(),o.object({op:o.literal("sessions.aside"),sessionId:L,requestId:te,text:o.string().min(1).max(32768),asideId:te.optional(),subscriptionId:o.string().regex(Ja).optional()}).strict(),o.object({op:o.literal("sessions.adopt"),sessionId:L,requestId:te,asideId:te,confirmed:o.literal(!0)}).strict(),o.object({op:o.literal("sessions.aside.get"),sessionId:L,asideId:te}).strict(),o.object({op:o.literal("sessions.aside.close"),sessionId:L,asideId:te}).strict(),o.object({op:o.literal("wakes.list"),limit:o.number().int().min(1).max(500).optional(),includeDormant:o.boolean().optional()}).strict(),o.object({op:o.literal("wakes.create"),requestId:te,sessionId:L.optional(),cwd:o.string().min(1).max(4096).optional(),target:Hr.optional(),message:dc,in:o.string().min(1).max(64).optional(),at:o.string().min(1).max(64).optional(),every:o.string().min(1).max(64).optional(),until:o.string().min(1).max(64).optional(),limit:o.number().int().min(1).optional(),title:o.string().min(1).max(200).optional()}).strict(),o.object({op:o.literal("wakes.edit"),sessionId:L,wakeId:uc,message:dc.optional(),in:o.string().min(1).max(64).optional(),at:o.string().min(1).max(64).optional(),every:o.string().min(1).max(64).optional(),until:o.string().min(1).max(64).optional(),limit:o.number().int().min(1).optional()}).strict(),o.object({op:o.literal("wakes.remove"),sessionId:L,wakeId:uc}).strict(),o.object({op:o.literal("monitors.cancel"),sessionId:L,monitorId:ym}).strict(),o.object({op:o.literal("jobs.cancel"),sessionId:L,jobId:bm}).strict(),o.object({op:o.literal("mcp.list"),sessionId:L}).strict(),o.object({op:o.literal("mcp.credentials.store"),sessionId:L,name:o.string().min(1).max(256),values:o.record(o.string().min(1).max(128),o.string().min(1).max(32768)).refine(e=>Object.keys(e).length<=32&&Object.values(e).reduce((t,n)=>t+n.length,0)<=65536,{message:"Too many secret values, or too much secret text, for one MCP credential write."}),confirmedReplace:o.array(o.string().min(1).max(128)).max(32)}).strict(),o.object({op:o.literal("mcp.control"),sessionId:L,control:o.object({action:o.enum(["list","add","remove","reload","connect","probe","disconnect","login","logout","reauth","status","cancel"]),name:Ji.optional(),scope:o.enum(["global","project"]).optional(),command:o.string().min(1).max(4096).optional(),args:o.array(o.string().max(8192)).max(128).optional(),env:o.record(Gr).optional(),url:o.string().max(4096).optional(),headers:o.record(Gr).optional(),oauth:o.boolean().optional(),confirmed:o.boolean().optional(),operation_id:Qa.optional()}).strict()}).strict(),o.object({op:o.literal("mcp.catalog"),cwd:Xi.optional(),sessionId:L.optional()}).strict(),o.object({op:o.literal("mcp.catalog.control"),cwd:Xi.optional(),control:o.object({action:o.enum(["add","remove","test","login","reauth","logout","status","cancel"]),name:Ji.optional(),scope:o.enum(["global","project"]).optional(),command:o.string().min(1).max(4096).optional(),args:o.array(o.string().max(8192)).max(128).optional(),env:o.record(Gr).optional(),url:o.string().max(4096).optional(),headers:o.record(Gr).optional(),confirmed:o.boolean().optional(),operation_id:Qa.optional()}).strict()}).strict(),o.object({op:o.literal("mcp.catalog.credentials"),header:o.string().min(1).max(128).optional(),cwd:Xi.optional(),name:Ji,values:o.record(o.string().min(1).max(128),o.string().min(1).max(32768)).refine(e=>Object.keys(e).length<=32&&Object.values(e).reduce((t,n)=>t+n.length,0)<=65536,{message:"Too many secret values, or too much secret text, for one MCP credential write."}),confirmedReplace:o.array(o.string().min(1).max(128)).max(32)}).strict(),o.object({op:o.literal("radient.request"),control:o.object({operation:o.enum(["account","prices","credits","usage","provision","application.create","agents.list","agents.get","agents.create","agents.update","agents.delete","agents.like","agents.unlike","agents.liked","agents.like_count","agents.favourite","agents.unfavourite","agents.favourited","agents.favourite_count","agents.download_count","agents.statuses","comments.list","comments.create","comments.update","comments.delete","account.agents","memberships.list","org_agents.list","org_team.get","org_teams.list","org_skills.list","org_skill.get","signup.resend"]),request_id:te.optional(),tenant_id:v.optional(),account_id:v.optional(),agent_id:v.optional(),comment_id:v.optional(),team_id:v.optional(),skill_id:v.optional(),query:o.record(o.union([o.string().max(1024),o.number().int()])).optional(),payload:o.record(o.unknown()).optional(),confirmed:o.boolean().optional()}).strict()}).strict(),o.object({op:o.literal("providers.list")}).strict(),o.object({op:o.literal("accounts.list")}).strict(),o.object({op:o.literal("accounts.remove"),accountId:o.number().int().positive(),confirmed:o.literal(!0)}).strict(),o.object({op:o.literal("tunnel.setup.read"),credentialId:o.number().int().positive().optional()}).strict(),o.object({op:o.literal("tunnel.setup.plan"),credentialId:o.number().int().positive().optional()}).strict(),o.object({op:o.literal("tunnel.setup.run"),credentialId:o.number().int().positive(),acceptMonthlyPrice:o.string().min(1).max(64).optional()}).strict(),o.object({op:o.literal("auth.start"),provider:v}).strict(),o.object({op:o.literal("auth.status"),id:v}).strict(),o.object({op:o.literal("auth.input"),id:v,promptId:v,value:Br}).strict(),o.object({op:o.literal("auth.cancel"),id:v}).strict(),o.object({op:o.literal("auth.key"),provider:v,value:Br}).strict(),o.object({op:o.literal("auth.logout"),provider:v}).strict(),o.object({op:o.literal("agent_messages.status"),boundary:Ka}).strict(),o.object({op:o.literal("agent_messages.enable"),expected_account_id:v,tenant_id:v,state:o.literal("active"),consent_version:o.string().min(1).max(128),consented_via:o.literal("dialog")}).strict(),o.object({op:o.literal("agent_messages.settings"),tenant_id:v.optional()}).strict(),o.object({op:o.literal("agent_messages.settings.put"),expected_account_id:v,tenant_id:v.optional(),consent_version:o.string().min(1).max(128).optional(),consented_via:o.enum(["dialog","settings"]).optional(),label:o.string().min(1).max(128).optional(),state:o.enum(["active","paused","disabled"])}).strict(),o.object({op:o.literal("agent_messages.onboarding.dismiss")}).strict(),o.object({op:o.literal("agent_messages.allowlist.get"),tenant_id:v.optional()}).strict(),o.object({op:o.literal("agent_messages.allowlist.put"),expected_account_id:v,tenant_id:v.optional(),entries:o.array(o.object({direction:o.enum(["send","receive"]),effect:o.enum(["allow","deny"]),target:o.object({endpoint_id:v.optional(),account_id:v.optional()}).strict().refine(e=>!!e.endpoint_id!=!!e.account_id,"An allowlist target names exactly one of endpoint_id or account_id")}).strict()).max(200)}).strict(),o.object({op:o.literal("team_bridge.conversations.list"),scope:o.literal("account").optional(),tenant_id:v.optional(),limit:o.number().int().min(1).max(100).optional(),cursor:o.string().min(1).max(512).optional(),before:o.string().min(1).max(64).optional(),status:o.enum(["open","archived"]).optional()}).strict(),o.object({op:o.literal("team_bridge.conversations.get"),conversation_id:v,tenant_id:v.optional()}).strict(),o.object({op:o.literal("team_bridge.conversations.create"),expected_account_id:v.optional(),tenant_id:v.optional(),kind:o.enum(["dm","group","channel"]),name:o.string().min(1).max(128).optional(),topic:o.string().min(1).max(512).optional(),visibility:o.enum(["private","tenant"]).optional(),agent_capable:o.boolean().optional(),members:o.array(o.object({account_id:v,kind:o.enum(["human","agent"]),endpoint_id:v.optional(),display_label:o.string().min(1).max(64)}).strict()).max(500)}).strict(),o.object({op:o.literal("team_bridge.conversations.lifecycle"),expected_account_id:v.optional(),tenant_id:v.optional(),conversation_id:v,action:o.enum(["archive","unarchive","join","leave"])}).strict(),o.object({op:o.literal("team_bridge.conversations.join"),expected_account_id:v.optional(),conversation_id:v,tenant_id:v.optional()}).strict(),o.object({op:o.literal("team_bridge.conversations.notify"),expected_account_id:v.optional(),conversation_id:v,tenant_id:v.optional(),notify:o.enum(["all","mention","mute"])}).strict(),o.object({op:o.literal("team_bridge.conversations.agent_notify"),expected_account_id:v.optional(),conversation_id:v,tenant_id:v.optional(),notify:o.enum(["all","mention","mute"])}).strict(),o.object({op:o.literal("team_bridge.conversations.members.add"),expected_account_id:v.optional(),conversation_id:v,tenant_id:v.optional(),members:o.array(o.object({account_id:v,kind:o.enum(["human","agent"]),endpoint_id:v.optional(),display_label:o.string().min(1).max(64)}).strict()).min(1).max(500)}).strict(),o.object({op:o.literal("team_bridge.conversations.members.remove"),expected_account_id:v.optional(),tenant_id:v.optional(),conversation_id:v,account_id:v}).strict(),o.object({op:o.literal("team_bridge.conversations.delete"),expected_account_id:v.optional(),tenant_id:v.optional(),conversation_id:v}).strict(),o.object({op:o.literal("team_bridge.conversations.consent"),expected_account_id:v.optional(),conversation_id:v,account_id:v,decision:o.enum(["accept","decline"]),consent_version:o.string().min(1).max(128),tenant_id:v.optional()}).strict(),o.object({op:o.literal("team_bridge.owner_audit.conversations"),expected_account_id:v,tenant_id:v,limit:o.number().int().min(1).max(100).optional(),cursor:o.string().min(1).optional()}).strict(),o.object({op:o.literal("team_bridge.owner_audit.messages"),expected_account_id:v,tenant_id:v,conversation_id:v,limit:o.number().int().min(1).max(100).optional(),before_seq:o.number().int().nonnegative().optional()}).strict(),o.object({op:o.literal("team_bridge.owner_audit.replies"),expected_account_id:v,tenant_id:v,conversation_id:v,message_id:v,limit:o.number().int().min(1).max(100).optional(),after_seq:o.number().int().nonnegative().optional()}).strict(),o.object({op:o.literal("team_bridge.messages.list"),conversation_id:v,tenant_id:v.optional(),limit:o.number().int().min(1).max(100).optional(),before_seq:o.number().int().nonnegative().optional(),endpoint_id:v.optional()}).strict(),o.object({op:o.literal("team_bridge.reactions.toggle"),conversation_id:v,message_id:v,expected_account_id:v,tenant_id:v,emoji:o.string().min(1),active:o.boolean()}).strict(),o.object({op:o.literal("team_bridge.messages.send"),expected_account_id:v.optional(),conversation_id:v,tenant_id:v.optional(),client_ref:v,body:o.string(),agent_label:o.string().min(1).max(64).optional(),thread_root_id:v.optional(),attachment_ids:es.optional(),mentions:mm.optional()}).strict(),o.object({op:o.literal("team_bridge.messages.replies"),conversation_id:v,message_id:v,expected_account_id:v,tenant_id:v,limit:o.number().int().min(1).max(100).optional(),after_seq:o.number().int().nonnegative().optional()}).strict(),o.object({op:o.literal("team_bridge.scheduled.list"),tenant_id:v}).strict(),o.object({op:o.literal("team_bridge.scheduled.create"),tenant_id:v,conversation_id:v,client_ref:v,body:o.string(),send_at:o.string().datetime({offset:!0}),attachment_ids:es.optional(),thread_root_id:v.optional()}).strict(),o.object({op:o.literal("team_bridge.scheduled.update"),tenant_id:v,scheduled_id:v,body:o.string().optional(),send_at:o.string().datetime({offset:!0}).optional(),attachment_ids:es.optional(),expected_version:o.number().int().nonnegative().optional()}).strict(),o.object({op:o.literal("team_bridge.attachments.delete"),tenant_id:v,conversation_id:v,attachment_id:v,expected_account_id:v}).strict(),o.object({op:o.literal("team_bridge.scheduled.cancel"),tenant_id:v,scheduled_id:v}).strict(),o.object({op:o.literal("team_bridge.read"),expected_account_id:v.optional(),conversation_id:v,tenant_id:v.optional(),seq:o.number().int().nonnegative().optional(),muted:o.boolean().optional()}).strict(),o.object({op:o.literal("team_bridge.unread"),scope:o.literal("account").optional(),tenant_id:v.optional()}).strict(),o.object({op:o.literal("team_bridge.directory"),tenant_id:v}).strict(),o.object({op:o.literal("team_bridge.status"),boundary:Ka.optional()}).strict(),o.object({op:o.literal("settings.list")}).strict(),o.object({op:o.literal("settings.edit"),key:Fr,value:o.unknown().refine(e=>e!==void 0,"A setting value is required."),base:hm.optional()}).strict(),o.object({op:o.literal("settings.reset"),key:Fr}).strict(),o.object({op:o.literal("tts.paths")}).strict(),o.object({op:o.literal("config.get")}).strict(),o.object({op:o.literal("config.update"),value:vm}).strict(),o.object({op:o.literal("instructions.get")}).strict(),o.object({op:o.literal("instructions.update"),content:o.string().max(64e3)}).strict(),o.object({op:o.literal("credentials.list")}).strict(),o.object({op:o.literal("credentials.update"),key:Fr,value:Br}).strict(),o.object({op:o.literal("peers.list")}).strict(),o.object({op:o.literal("networks.list")}).strict(),o.object({op:o.literal("networks.invite"),networkId:mn,role:o.enum(["read","drive","admin"]),deviceId:mn.optional()}).strict(),o.object({op:o.literal("networks.member.remove"),networkId:mn,deviceId:mn,confirm:o.string().min(1).max(256)}).strict(),o.object({op:o.literal("sessions.transfer"),sessionId:L,to:o.union([o.literal("local"),mn]),keep:o.boolean().optional(),waitS:o.number().min(0).max(300).optional(),requestId:te.optional()}).strict(),o.object({op:o.literal("approvals.list")}).strict(),o.object({op:o.literal("approvals.approve"),approvalId:qa}).strict(),o.object({op:o.literal("approvals.deny"),approvalId:qa}).strict(),o.object({op:o.literal("asks.list")}).strict(),o.object({op:o.literal("projects.list")}).strict(),o.object({op:o.literal("projects.get"),key:Mt}).strict(),o.object({op:o.literal("projects.create"),name:ns,description:o.string().max(vc).optional(),status:yc.optional(),tags:bc.optional()}).strict(),o.object({op:o.literal("projects.update"),key:Mt,fields:o.object({name:ns.optional(),title:o.string().max(80).optional(),owner:o.string().max(80).optional(),team:o.string().max(80).optional(),description:o.string().max(vc).optional(),status:yc.optional(),progress:o.string().max(Um).optional(),tags:bc.optional(),start_date:zr.optional(),target_date:zr.optional(),completed_at:zr.optional(),estimate:o.number().positive().max(1e3).optional(),estimate_unit:o.enum(["points","days"]).optional()}).strict(),force_done:o.boolean().optional()}).strict(),o.object({op:o.literal("projects.delete"),key:Mt,confirmed_name:ns}).strict(),o.object({op:o.literal("projects.link"),key:Mt,sessionId:L}).strict(),o.object({op:o.literal("projects.unlink"),key:Mt,sessionId:L}).strict(),o.object({op:o.literal("projects.milestone"),key:Mt,name:o.string().min(1).max(wc),targetDate:zr.optional(),completed:o.boolean().optional()}).strict(),o.object({op:o.literal("projects.milestone.remove"),key:Mt,name:o.string().min(1).max(wc)}).strict(),o.object({op:o.literal("projects.request_update"),key:Mt}).strict(),o.object({op:o.literal("projects.search"),q:o.string().min(1).max(Fm),limit:o.number().int().min(1).max(Gm).optional()}).strict(),o.object({op:o.literal("aida.status")}).strict(),o.object({op:o.literal("aida.control"),action:o.enum(["open","pause","resume","greet","status"])}).strict(),o.object({op:o.literal("code_requests.list"),sessionId:L}).strict(),o.object({op:o.literal("code_requests.refresh"),sessionId:L,keys:o.array(o.string().min(1).max(512)).max(256).optional(),force:o.boolean().optional()}).strict(),o.object({op:o.literal("static.sign"),route:o.enum(["images","videos","audio","html"]),path:o.string().min(1),ttlS:o.number().int().min(1).max(3600).optional()}).strict(),o.object({op:o.literal("library.list"),scope:o.enum(["final","all"]).optional(),q:o.string().max(512).optional(),category:o.string().min(1).max(64).optional(),kind:o.string().min(1).max(64).optional(),origin_group:o.enum(["generated","created","mentioned"]).optional(),origin:o.string().min(1).max(64).optional(),tag:o.string().min(1).max(128).optional(),tag_mode:o.enum(["all","any"]).optional(),highlighted:o.boolean().optional(),organized:o.boolean().optional(),favorite:o.boolean().optional(),session:o.string().min(1).max(12).optional(),session_id:o.string().min(1).max(512).optional(),sort:o.enum(["recent","name","kind","size","created","modified","organized"]).optional(),order:o.enum(["asc","desc"]).optional(),limit:o.number().int().min(1).max(200).optional(),cursor:o.string().max(512).optional()}).strict(),o.object({op:o.literal("library.get"),id:Fn}).strict(),o.object({op:o.literal("library.update"),id:Fn,fields:o.object({name:o.string().max(200).optional(),description:o.string().max(2e3).optional(),favorite:o.boolean().optional(),locked:o.boolean().optional(),archived:o.boolean().optional()}).strict()}).strict(),o.object({op:o.literal("library.tags")}).strict(),o.object({op:o.literal("library.tags.create"),name:o.string().trim().min(1).max(24),category:o.string().min(1).max(64).optional()}).strict(),o.object({op:o.literal("library.tags.update"),id:Bn,name:o.string().trim().min(1).max(24).optional(),category:o.string().min(1).max(64).optional()}).strict(),o.object({op:o.literal("library.tags.delete"),id:Bn}).strict(),o.object({op:o.literal("library.tags.merge"),id:Bn,into:Bn}).strict(),o.object({op:o.literal("library.tags.assign"),id:Fn,tags:o.array(Bn).max(64),primary:o.string().max(128).optional()}).strict(),o.object({op:o.literal("library.chat.link"),id:Fn,sessionId:L}).strict(),o.object({op:o.literal("library.chat.clear"),id:Fn}).strict(),o.object({op:o.literal("library.librarian"),action:o.enum(["status","open","pause","resume","run"]).optional()}).strict(),o.object({op:o.literal("sidebar_layout.get")}).strict(),o.object({op:o.literal("sidebar_layout.set"),layout:Wm}).strict(),o.object({op:o.literal("notifications.list"),preview:o.literal(!0).optional(),includeAskReads:o.boolean().optional(),countSessionIds:o.array(L).max(50).optional(),kind:o.enum(["all","asks","updates"]).optional(),bulkPriority:o.enum(["any","high","normal_up"]).optional(),state:o.enum(["unread","all","dismissed"]).optional(),source:o.enum(["notify","ask"]).optional(),priority:o.enum(["high","normal","low"]).optional(),sessionId:L.optional(),throughSeq:o.number().int().min(0).optional(),cursor:o.string().min(1).max(64).optional(),limit:o.number().int().min(1).max(100).optional()}).strict(),o.object({op:o.literal("notifications.get"),id:Et}).strict(),o.object({op:o.literal("notifications.count")}).strict(),o.object({op:o.literal("notifications.read"),verb:o.enum(["read","unread","undo"]),target:o.union([Ec,kc,zm])}).strict(),o.object({op:o.literal("notifications.dismiss"),verb:o.enum(["dismiss","undismiss"]),target:o.union([Ec,kc])}).strict(),o.object({op:o.literal("notifications.seen"),items:o.array(o.object({id:Et,revision:o.number().int().min(1),anchorId:o.string().min(1).max(256),visibleSinceMs:o.number().int().min(0)}).strict()).min(1).max(50),evidence:o.object({sessionId:L,inputKind:o.enum(["pointer","key","wheel"]),inputAtMs:o.number().int().min(0),visibleSinceMs:o.number().int().min(0)}).strict()}).strict()]);Km.superRefine((e,t)=>{if((e.op==="notifications.read"||e.op==="notifications.dismiss")&&"items"in e.target&&!!e.target.receipt!=(e.target.throughSeq!==void 0)&&t.addIssue({code:o.ZodIssueCode.custom,message:"Receipt writes require a sequence boundary",path:["target"]}),e.op==="notifications.read"&&e.verb==="undo"!="operationToken"in e.target&&t.addIssue({code:o.ZodIssueCode.custom,message:"Undo requires an operation token, and only undo accepts one",path:["target"]}),(e.op==="team_bridge.messages.send"||e.op==="team_bridge.scheduled.create"||e.op==="team_bridge.scheduled.update"&&e.body!==void 0)&&e.body?.trim()===""&&(e.attachment_ids?.length??0)===0){t.addIssue({code:o.ZodIssueCode.custom,message:"A message needs text or an image",path:["body"]});return}if(e.op.startsWith("team_bridge.")&&"expected_account_id"in e&&e.expected_account_id&&(!("tenant_id"in e)||!e.tenant_id)){t.addIssue({code:o.ZodIssueCode.custom,path:["tenant_id"],message:"Guarded conversation writes require an explicit tenant"});return}if(e.op==="team_bridge.messages.send"&&e.thread_root_id!==void 0&&!e.expected_account_id){t.addIssue({code:o.ZodIssueCode.custom,path:["expected_account_id"],message:"Thread replies require the captured account"});return}if(e.op==="hub.skillPull"||e.op==="hub.skillSubscribe"||e.op==="hub.skillPublish"){if(e.visibility==="public"&&e.tenantId!==null||e.visibility==="org"&&!e.tenantId){t.addIssue({code:o.ZodIssueCode.custom,message:"A skill destination requires explicit paired scope",path:["tenantId"]});return}if(e.op==="hub.skillPublish"&&(e.dryRun?e.previewReceipt!==void 0||e.confirmPublish!==void 0:!e.previewReceipt||e.confirmPublish!==!0)){t.addIssue({code:o.ZodIssueCode.custom,message:"An initial skill publication requires its reviewed draft receipt",path:["previewReceipt"]});return}}if(e.op==="hub.check"||e.op==="hub.apply"||e.op==="hub.retry"){const n=e.name!==void 0,r=e.localId!==void 0,i=e.op!=="hub.check";if(n&&r||i&&!n&&!r||r&&e.kind===void 0){t.addIssue({code:o.ZodIssueCode.custom,message:"A hub action addresses one item by name or local id, never both",path:["localId"]});return}}if(e.op==="hub.apply"&&e.resolveSource===!0){const n=e.visibility==="public"&&e.tenantId===null||e.visibility==="org"&&typeof e.tenantId=="string"&&e.tenantId.length>0;if(!e.hubSource||!n||e.acknowledgeUnknownBaseline!==!0||e.localId!==void 0||e.prefer!==void 0){t.addIssue({code:o.ZodIssueCode.custom,message:"Confirming a source requires its exact stated destination and the unknown-baseline acknowledgement, addressed by name, with no preference",path:["hubSource"]});return}}if(e.op==="hub.push"&&(e.dryRun?e.previewReceipt!==void 0||e.confirmPublish!==void 0:!e.previewReceipt||e.confirmPublish!==!0)){t.addIssue({code:o.ZodIssueCode.custom,message:"A confirmed publication requires its reviewed preview receipt",path:["previewReceipt"]});return}if(e.op==="hub.policy"&&e.subscribe===void 0&&e.autoPush===void 0){t.addIssue({code:o.ZodIssueCode.custom,message:"A hub policy change must name subscribe or autoPush",path:["subscribe"]});return}if((e.op==="team_bridge.conversations.list"||e.op==="team_bridge.unread")&&e.scope==="account"&&e.tenant_id!==void 0){t.addIssue({code:o.ZodIssueCode.custom,message:"An account-scoped read cannot name a tenant",path:["scope"]});return}if(e.op==="team_bridge.conversations.list"&&e.scope==="account"&&e.before!==void 0){t.addIssue({code:o.ZodIssueCode.custom,message:"An account-scoped page uses cursor, not before",path:["before"]});return}if(e.op==="sessions.answer"){if(e.askId!==void 0){if(e.askId||t.addIssue({code:o.ZodIssueCode.custom,message:"ask_id must be a non-empty string",path:["askId"]}),e.dismiss===!0){(e.answers!==void 0||e.decline===!0||e.revise===!0)&&t.addIssue({code:o.ZodIssueCode.custom,message:"A dismissal carries no answers, decline or revise",path:["dismiss"]});return}e.reason!==void 0?t.addIssue({code:o.ZodIssueCode.custom,message:"A reason applies to a dismissal",path:["reason"]}):e.decline!==!0&&!e.answers?t.addIssue({code:o.ZodIssueCode.custom,message:"A queued-ask answer needs answers or decline",path:["answers"]}):e.decline===!0&&e.answers!==void 0?t.addIssue({code:o.ZodIssueCode.custom,message:"Supply either answers or decline",path:["decline"]}):e.revise===!0&&e.decline===!0?t.addIssue({code:o.ZodIssueCode.custom,message:"Supply either decline or revise",path:["revise"]}):e.answers!==void 0&&Object.keys(e.answers).length===0&&t.addIssue({code:o.ZodIssueCode.custom,message:"answers must name at least one question",path:["answers"]});return}e.epoch||t.addIssue({code:o.ZodIssueCode.custom,message:"An epoch is required to answer a gate",path:["epoch"]}),e.requestId||t.addIssue({code:o.ZodIssueCode.custom,message:"A request id is required to answer a gate",path:["requestId"]}),e.revise===!0&&t.addIssue({code:o.ZodIssueCode.custom,message:"revise applies to a queued ask",path:["revise"]}),e.dismiss===!0&&t.addIssue({code:o.ZodIssueCode.custom,message:"dismiss applies to a queued ask",path:["dismiss"]}),e.reason!==void 0&&t.addIssue({code:o.ZodIssueCode.custom,message:"reason applies to a queued ask",path:["reason"]});return}if(e.op==="sessions.create"&&e.purpose===void 0){e.cwd===void 0&&t.addIssue({code:o.ZodIssueCode.custom,message:"A conversation needs a working directory: only a configuration run (`purpose`) may omit `cwd`.",path:["cwd"]});return}if(e.op==="sessions.create"&&e.purpose!==void 0){for(const n of["cwd","target","model","draftId"])e[n]!==void 0&&t.addIssue({code:o.ZodIssueCode.custom,message:`A configuration run resolves its own \`${n}\`: send \`purpose\` alone.`,path:[n]});return}if(!(e.op!=="agent.publish"&&e.op!=="agent.republish"&&e.op!=="team.publish")){if((e.subscribe!==void 0||e.autoPush!==void 0||e.confirmPublicEgress!==void 0)&&!e.requestId){t.addIssue({code:o.ZodIssueCode.custom,message:"Initial link policy needs a durable publication request ID",path:["requestId"]});return}e.visibility==="org"!=!!e.tenantId&&t.addIssue({code:o.ZodIssueCode.custom,message:'A publication target needs both `visibility: "org"` and `tenantId`, or neither: one half would publish to the public hub.'})}});const qe={noCredential:"pairing.no-credential",refused:"pairing.refused",planeClosed:"pairing.plane-closed",transportFailed:"transport.failed"},Vm={runtimeUnreachable:"runtime_unreachable"},ki="runtime_busy",hd="runtime_retiring";o.object({data:o.object({aside_id:o.string().optional(),status:o.union([o.enum(["adopted","queued"]),o.string()]).optional()}).passthrough()}).passthrough();const md=o.object({name:o.string(),description:o.string().nullish(),source:o.string().nullish(),link_id:o.string().nullish(),editable:o.boolean().nullish(),installed:o.boolean().nullish(),fingerprint:o.string().nullish(),form:o.string().nullish()}).passthrough(),Ym=o.object({path:o.string(),size:o.number().nullish(),preview:o.string().nullish(),preview_truncated:o.boolean().nullish()}).passthrough(),Qm=md.extend({body:o.string().nullish(),body_in_detail:o.boolean().nullish(),body_length:o.number().nullish(),body_bytes:o.number().nullish(),body_truncated:o.boolean().nullish(),files:o.array(Ym).nullish(),files_total:o.number().nullish(),files_truncated:o.boolean().nullish(),publish_budget:o.object({limit:o.number(),total:o.number()}).passthrough().nullish()}).passthrough(),Tx=o.object({skills:o.array(md),scope:o.string().nullish(),detail:o.string().nullish(),skill_detail:Qm.nullish(),warning_count:o.number().nullish(),version:o.string().nullish()}).passthrough(),Cx="aside_adopt_refused",Jm=["session_closed","open_tool_batch","turn_running"];function Ax(e){if(typeof e!="object"||e===null)return;const t=e.reason;return Jm.find(n=>n===t)}const Xm={[qe.noCredential]:"ui.common.errors.desktop_refusal.no_credential",[qe.refused]:"ui.common.errors.desktop_refusal.refused",[qe.planeClosed]:"ui.common.errors.desktop_refusal.plane_closed",[qe.transportFailed]:"ui.common.errors.desktop_refusal.transport_failed"},Hs={noCredential:"Restart with a desktop-managed backend to use these controls.",transportFailed:"The backend could not complete this request. Check its connection and try again."};function Ei(e){return e!==void 0&&Object.values(qe).includes(e)}function qm(e,t){if(e.startsWith("/v1/desktop/")){if(t===401||t===403)return qe.refused;if(t===503)return qe.planeClosed}}const Ox=o.object({step:o.string(),blocked_on:o.string(),configured:o.boolean(),ready:o.boolean(),verified:o.boolean(),url:o.string().nullable(),credential_id:o.number().int().positive().nullable(),identity_label:o.string().nullable(),credential_choices:o.array(o.object({id:o.number().int().positive(),identity_label:o.string().nullable().optional()}).passthrough()).default([]),quote:o.object({monthly_price_usd:o.string().nullable(),positive_balance:o.boolean(),eligible:o.boolean(),account_valid:o.boolean()}).passthrough().nullable(),receipts:o.array(o.object({step:o.string(),ok:o.boolean(),text:o.string()})).default([]),remedy:o.object({kind:o.string(),text:o.string(),command:o.string().nullable().optional(),url:o.string().nullable().optional()}).nullable(),source:o.string(),in_progress:o.boolean().default(!1),progress:o.array(o.string()).default([]),active_credential_id:o.number().int().positive().nullable().default(null),billing_outcome:o.string().optional(),reservation_outcome:o.string().optional(),failure_stage:o.string().optional()}).passthrough(),Px=new Set(["setup_in_progress","setup_deadline","setup_unavailable","setup_intent_corrupt"]),eg=88e4,tg=11e5,ng=2e4,rg=9e4,ig=new Set(["analytics.get","analytics.models","sessions.report"]),sg=new Set(["usage.get"]),og=new Set(["networks.list","peers.list"]),ag=new Set([...ig,...sg,...og]),cg=90,lg=30,dg=300,ug=10,gd=15,fg=1e4;function pg(e){const n=e.to==="local"||e.keep?dg:lg,r=Math.max(0,e.waitS??0);return(cg+n+ug+gd)*1e3+r*1e3}const hg=18e4,mg=hg+15e3,gg=120,_g=135e3,yg=93e4,_d=(gg+30+gd)*1e3,bg=6e4,vg=5*_d,wg=new Set(["hub.apply","hub.retry","hub.push","hub.skillPublish","hub.skillPull","hub.skillSubscribe","hub.skillUnpull","hub.check","hub.applyAll"]);function Sg(e){switch(e){case"hub.apply":case"hub.retry":case"hub.push":case"hub.skillPublish":case"hub.skillPull":case"hub.skillSubscribe":case"hub.skillUnpull":return _d;case"hub.check":return bg;case"hub.applyAll":return vg;default:return null}}function kg(e){if(typeof e!="string"&&e.op==="sessions.transfer")return pg(e)+fg;const t=typeof e=="string"?e:e.op;if(t==="approvals.approve")return mg;if(t==="tunnel.setup.run")return yg;if(t==="tunnel.setup.plan")return _g;const n=Sg(t);return n!==null?n:ag.has(t)?rg:ng}const Eg=5e3;function yd(e){return kg(e)+Eg}const Ro="deadline_exceeded",bd="foreground_required",vd="View these completions in the foreground before marking them read.",xg=new Set(["capabilities","agent_messages.status","agent_messages.settings","agent_messages.allowlist.get","team_bridge.conversations.list","team_bridge.conversations.get","team_bridge.messages.list","team_bridge.messages.replies","team_bridge.owner_audit.conversations","team_bridge.owner_audit.messages","team_bridge.owner_audit.replies","team_bridge.unread","team_bridge.directory","team_bridge.status","accounts.list","analytics.get","analytics.models","approvals.list","commands.entities","commands.list","config.get","credentials.list","hub.updates","hub.links","info.get","instructions.get","legacy.agent.get","legacy.agent.history","legacy.agent.schedules.list","legacy.agents.list","legacy.job.get","legacy.jobs.list","legacy.models","legacy.models.providers","legacy.schedule.get","legacy.schedules.list","mcp.catalog","mcp.list","models.catalogue","networks.list","peers.list","profiles.get","profiles.list","projects.search","providers.list","quota.notice","runtimes.list","sessions.aside.get","sessions.checkpoints","sessions.failovers","sessions.find","sessions.get","sessions.history","sessions.files","sessions.userAttachments","sessions.list","sessions.preview","sessions.report","sessions.search","sessions.variables.list","skills.list","subagents.transcript","teams.effective","teams.get","teams.list","tunnel.setup.plan","tunnel.setup.read","usage.get"]),Ig=new Set(["analytics.get","analytics.models","networks.list","peers.list","usage.get","sessions.report","info.get","sessions.failovers"]);function Rg(e,t){const n=Math.round(t/1e3),r=Ro;return e==="sessions.transfer"?{code:r,message:`The app waits up to ${n} seconds for a move, and it was still running when the app stopped waiting. The move was asked for, so its outcome is unknown from here: read the session again before moving it anywhere else.`}:e==="approvals.approve"?{code:r,message:`The app waits up to ${n} seconds for an approval, and the signing prompt was still open when it stopped waiting. The request was sent, so the decision may or may not have landed: read the approvals again — if the record still waits, answering it again is safe, because the store keeps the first decision and refuses a second.`}:wg.has(e)?{code:r,message:"This is taking longer than expected. It may still finish; the mark will update."}:xg.has(e)?{code:r,message:Ig.has(e)?`The app waits up to ${n} seconds for this panel's data, and the read was still running when the app stopped waiting. Nothing was read; reopen the panel to ask again.`:`The app waits up to ${n} seconds for this read, and it was still running when the app stopped waiting. Nothing was read; ask again.`}:{code:r,message:`The app waits up to ${n} seconds for this request, and it was still running when the app stopped waiting. It may or may not have reached the server; check the result before repeating it.`}}const jx=eg,Mx=tg;o.object({state:o.enum(["ok","depleted","limit_reached","unverified","unknown","not_applicable"]),provider:o.string(),kind:o.enum(["balance","subscription","radient","none"]),model_free:o.boolean(),title:o.string(),body:o.string(),actions:o.array(o.object({id:o.enum(["open_url","resend_verification","refresh"]),label:o.string(),url:o.string().nullable().optional()})),resets_at_ms:o.number().int().nullable().optional(),checked_at_ms:o.number().int(),age_ms:o.number().int().nullable().optional(),source:o.enum(["cached","live"])});function Tg(e){return e.sessionId?{session_id:e.sessionId}:{...e.cwd?{cwd:e.cwd}:{},...e.target?{target:e.target}:{}}}function xc(e){return{...e.in!==void 0?{in:e.in}:{},...e.at!==void 0?{at:e.at}:{},...e.every!==void 0?{every:e.every}:{},...e.until!==void 0?{until:e.until}:{},...e.limit!==void 0?{limit:e.limit}:{}}}function is(e){return{...e.requestId?{request_id:e.requestId}:{},...e.subscribe!==void 0?{subscribe:e.subscribe}:{},...e.autoPush!==void 0?{auto_push:e.autoPush}:{},...e.confirmPublicEgress!==void 0?{confirm_public_egress:e.confirmPublicEgress}:{}}}function ss(e){if(e.visibility==="org"!=!!e.tenantId)throw new Error('A publication target needs both `visibility: "org"` and `tenantId`, or neither: one half would publish to the public hub.')}function Ic(e){return{sources:e.sources??null,session_ids:e.sessionIds??{},all:e.all??!1,include_subagents:e.includeSubagents??!1,include_cleared_segments:e.includeClearedSegments??!1,include_memory:e.includeMemory??!0,include_instructions:e.includeInstructions??!0,...e.maxSessions===void 0?{}:{max_sessions:e.maxSessions}}}function Kr(e){const t=new URLSearchParams;return e.tenant_id&&t.set("tenant_id",e.tenant_id),e.expected_account_id&&t.set("expected_account_id",e.expected_account_id),t.size?`?${t.toString()}`:""}function os(e){return e===void 0?"":`?tenant_id=${encodeURIComponent(e)}`}function Cg(e){switch(e.op){case"capabilities":return{path:"/v1/capabilities",method:"GET"};case"runtimes.list":return{path:"/v1/desktop/runtimes?probe=false",method:"GET"};case"peers.list":return{path:"/v1/desktop/peers",method:"GET"};case"networks.list":return{path:"/v1/desktop/networks",method:"GET"};case"asks.list":return{path:"/v1/desktop/asks",method:"GET"};case"networks.invite":return{path:`/v1/desktop/networks/${encodeURIComponent(e.networkId)}/invite`,method:"POST",body:{role:e.role,device:e.deviceId??null}};case"networks.member.remove":return{path:`/v1/desktop/networks/${encodeURIComponent(e.networkId)}/members/${encodeURIComponent(e.deviceId)}`,method:"DELETE",body:{confirm:e.confirm}};case"sessions.transfer":return{path:`/v1/desktop/sessions/${encodeURIComponent(e.sessionId)}/transfer`,method:"POST",body:{to:e.to,keep:e.keep??!1,wait_s:e.waitS??0,...e.requestId?{request_id:e.requestId}:{}}};case"approvals.list":return{path:"/v1/desktop/approvals",method:"GET"};case"approvals.approve":return{path:`/v1/desktop/approvals/${encodeURIComponent(e.approvalId)}/approve`,method:"POST"};case"approvals.deny":return{path:`/v1/desktop/approvals/${encodeURIComponent(e.approvalId)}/deny`,method:"POST"};case"profiles.list":return{path:"/v1/desktop/profiles",method:"GET"};case"profiles.get":return{path:`/v1/desktop/profiles/${encodeURIComponent(e.name)}`,method:"GET"};case"profiles.install":return{path:"/v1/desktop/profiles/install",method:"POST",body:{request_id:e.requestId,name:e.name}};case"imports.sources":return{path:"/v1/desktop/imports/sources",method:"GET"};case"imports.sessions":{const t=new URLSearchParams({source:e.source});return e.includeSubagents&&t.set("include_subagents","true"),{path:`/v1/desktop/imports/sessions?${t.toString()}`,method:"GET"}}case"imports.preview":return{path:"/v1/desktop/imports/preview",method:"POST",body:Ic(e)};case"imports.start":return{path:"/v1/desktop/imports/jobs",method:"POST",body:Ic(e)};case"imports.status":return{path:`/v1/desktop/imports/jobs/${encodeURIComponent(e.jobId)}`,method:"GET"};case"imports.cancel":return{path:`/v1/desktop/imports/jobs/${encodeURIComponent(e.jobId)}`,method:"DELETE"};case"profiles.create":return{path:"/v1/desktop/profiles",method:"POST",body:{request_id:e.requestId,name:e.name,...e.fields}};case"profiles.update":return{path:`/v1/desktop/profiles/${encodeURIComponent(e.name)}`,method:"PATCH",body:{request_id:e.requestId,...e.fields,...e.expectedDefinitionRevision!==void 0&&e.expectedDefinitionRevision!==null?{expected_definition_revision:e.expectedDefinitionRevision}:{}}};case"hub.updates":return{path:"/v1/desktop/hub/updates",method:"GET"};case"hub.skillPull":return{path:"/v1/desktop/hub/skills/pull",method:"POST",body:{request_id:e.requestId,hub_id:e.hubId,hub_source:e.hubSource,visibility:e.visibility,tenant_id:e.tenantId,local_alias:e.localAlias,...e.subscribe!==void 0?{subscribe:e.subscribe}:{},...e.autoPush!==void 0?{auto_push:e.autoPush}:{},...e.confirmPublicEgress!==void 0?{confirm_public_egress:e.confirmPublicEgress}:{}}};case"hub.skillSubscribe":return{path:"/v1/desktop/hub/skills/subscribe",method:"POST",body:{request_id:e.requestId,hub_id:e.hubId,hub_source:e.hubSource,visibility:e.visibility,tenant_id:e.tenantId,local_alias:e.localAlias}};case"hub.skillUnpull":return{path:"/v1/desktop/hub/skills/unpull",method:"POST",body:{request_id:e.requestId,link_id:e.linkId}};case"hub.skillPublish":return{path:"/v1/desktop/hub/skills/publish",method:"POST",body:{request_id:e.requestId,dry_run:e.dryRun,source_skill:e.sourceSkill,local_alias:e.localAlias,visibility:e.visibility,tenant_id:e.tenantId,subscribe:e.subscribe,auto_push:e.autoPush,confirm_public_egress:e.confirmPublicEgress,...e.previewReceipt?{preview_receipt:e.previewReceipt}:{},...e.confirmPublish?{confirm_publish:!0}:{}}};case"hub.links":return{path:`/v1/desktop/hub/links${e.kind?`?kind=${e.kind}`:""}`,method:"GET"};case"hub.policy":return{path:`/v1/desktop/hub/links/${encodeURIComponent(e.linkId)}`,method:"PATCH",body:{request_id:e.requestId,expected_policy_revision:e.expectedPolicyRevision,...e.subscribe!==void 0?{subscribe:e.subscribe}:{},...e.autoPush!==void 0?{auto_push:e.autoPush}:{},...e.confirmPublicEgress!==void 0?{confirm_public_egress:e.confirmPublicEgress}:{}}};case"hub.check":return{path:"/v1/desktop/hub/updates/check",method:"POST",body:{request_id:e.requestId,...e.kind?{kind:e.kind}:{},...e.name?{name:e.name}:{},...e.localId?{local_id:e.localId}:{}}};case"hub.apply":return{path:"/v1/desktop/hub/updates/apply",method:"POST",body:{request_id:e.requestId,...e.kind?{kind:e.kind}:{},...e.name?{name:e.name}:{},...e.localId?{local_id:e.localId}:{},...e.prefer?{prefer:e.prefer}:{},...e.acknowledgeUnknownBaseline!==void 0?{acknowledge_unknown_baseline:e.acknowledgeUnknownBaseline}:{},...e.dryRun!==void 0?{dry_run:e.dryRun}:{},...e.resolveSource===!0?{resolve_source:!0,hub_source:e.hubSource,visibility:e.visibility,tenant_id:e.tenantId??null}:{}}};case"hub.applyAll":return{path:"/v1/desktop/hub/updates/apply-all",method:"POST",body:{request_id:e.requestId,...e.kind?{kind:e.kind}:{}}};case"hub.retry":return{path:"/v1/desktop/hub/updates/retry",method:"POST",body:{request_id:e.requestId,...e.kind?{kind:e.kind}:{},...e.name?{name:e.name}:{},...e.localId?{local_id:e.localId}:{}}};case"hub.push":return{path:"/v1/desktop/hub/updates/push",method:"POST",body:{request_id:e.requestId,link_id:e.linkId,direction:e.direction,dry_run:e.dryRun,...e.previewReceipt?{preview_receipt:e.previewReceipt}:{},...e.confirmPublish?{confirm_publish:!0}:{}}};case"teams.list":return{path:"/v1/desktop/teams",method:"GET"};case"teams.get":return{path:`/v1/desktop/teams/${encodeURIComponent(e.name)}`,method:"GET"};case"teams.effective":return{path:`/v1/desktop/teams/${encodeURIComponent(e.name)}/effective`,method:"GET"};case"teams.create":return{path:"/v1/desktop/teams",method:"POST",body:{request_id:e.requestId,...e.fields}};case"teams.update":return{path:`/v1/desktop/teams/${encodeURIComponent(e.name)}`,method:"PATCH",body:{request_id:e.requestId,...e.fields,...e.expectedDefinitionRevision!==void 0&&e.expectedDefinitionRevision!==null?{expected_definition_revision:e.expectedDefinitionRevision}:{}}};case"sessions.list":{const t=new URLSearchParams;return t.set("limit",String(e.limit??100)),e.include_archived&&t.set("include_archived","true"),e.scope_kind&&t.set("scope_kind",e.scope_kind),e.scope_name&&t.set("scope_name",e.scope_name),e.cursor&&t.set("cursor",e.cursor),e.with_counts&&t.set("with_counts","true"),e.include_peers&&t.set("include_peers","true"),e.sort&&t.set("sort",e.sort),{path:`/v1/desktop/sessions?${t}`,method:"GET"}}case"delegated_cleanup_notice.ack":return{path:"/v1/desktop/delegated-cleanup-notice/ack",method:"POST"};case"sessions.search":{const t=new URLSearchParams({q:e.q,limit:String(e.limit??am)});return e.include_archived&&t.set("include_archived","true"),{path:`/v1/desktop/sessions/search?${t}`,method:"GET"}}case"sessions.archive":return{path:`/v1/desktop/sessions/${e.sessionId}/archive`,method:"POST",body:{archived:e.archived}};case"sessions.delete":return{path:`/v1/desktop/sessions/${e.sessionId}`,method:"DELETE",body:{confirmed:!0}};case"sessions.create":return{path:"/v1/desktop/sessions",method:"POST",body:{request_id:e.requestId,...e.cwd!==void 0?{cwd:e.cwd}:{},...e.peer?{peer:e.peer}:{},...e.target?{target:e.target}:{},...e.model?{model:e.model}:{},...e.draftId?{draft_id:e.draftId}:{},...e.purpose?{purpose:e.purpose}:{}}};case"sessions.preview":return{path:"/v1/desktop/sessions/preview",method:"POST",body:{request_id:e.requestId,cwd:e.cwd,...e.target?{target:e.target}:{},...e.model?{model:e.model}:{}}};case"sessions.draft":return{path:"/v1/desktop/sessions/draft",method:"POST",body:{request_id:e.requestId,cwd:e.cwd,...e.target?{target:e.target}:{},...e.model?{model:e.model}:{}}};case"sessions.get":{const t=new URLSearchParams;return e.journalOrder&&(t.set("journal_order","1"),e.peerJournalSource&&t.set("peer_journal_source","1"),ui(t,`/v1/desktop/sessions/${e.sessionId}`,e.orderIds??[])),{path:`/v1/desktop/sessions/${e.sessionId}${t.size?`?${t}`:""}`,method:"GET"}}case"sessions.files":{const t=new URLSearchParams({limit:String(e.limit??200)});for(const n of["scope","kind","q","sort","order","cursor"]){const r=e[n];r!==void 0&&t.set(n,r)}return{path:`/v1/desktop/sessions/${encodeURIComponent(e.sessionId)}/files?${t}`,method:"GET"}}case"sessions.files.materialise":return{path:`/v1/desktop/sessions/${encodeURIComponent(e.sessionId)}/files/${encodeURIComponent(e.fileId)}/materialise`,method:"POST"};case"sessions.userAttachments":return{path:`/v1/desktop/sessions/${encodeURIComponent(e.sessionId)}/user-attachments`,method:"GET"};case"sessions.userAttachments.materialise":return{path:`/v1/desktop/sessions/${encodeURIComponent(e.sessionId)}/user-attachments/${encodeURIComponent(e.digest)}/materialise`,method:"POST"};case"sessions.history":{const t=new URLSearchParams({limit:String(e.limit??100)});return e.beforeId&&t.set("before_id",e.beforeId),e.openFrame&&(t.set("open_frame","1"),t.set("supplements","1")),e.journalOrder&&(t.set("journal_order","1"),e.peerJournalSource&&t.set("peer_journal_source","1"),e.sourceRead==="metadata"?t.set("source_read","metadata"):e.sourceRead==="payload"&&e.expectedJournalGeneration&&t.set("source_read","payload"),e.expectedJournalGeneration&&t.set("expected_journal_generation",e.expectedJournalGeneration),ui(t,`/v1/desktop/sessions/${e.sessionId}/history`,e.orderIds??[])),{path:`/v1/desktop/sessions/${e.sessionId}/history?${t}`,method:"GET"}}case"sessions.checkpoints":return{path:`/v1/desktop/sessions/${e.sessionId}/checkpoints`,method:"GET"};case"sessions.checkpoints.warm":return{path:`/v1/desktop/sessions/${e.sessionId}/checkpoints/warm`,method:"POST",body:{...e.ids?{ids:e.ids}:{},...e.limit!==void 0?{limit:e.limit}:{}}};case"sessions.find":{const t=new URLSearchParams({q:e.q,limit:String(e.limit??lm)});return{path:`/v1/desktop/sessions/${e.sessionId}/find?${t}`,method:"GET"}}case"subagents.transcript":{const t=new URLSearchParams({limit:String(e.limit??100)});return e.beforeId&&t.set("before_id",e.beforeId),{path:`/v1/desktop/sessions/${e.sessionId}/children/${e.childId}/transcript?${t}`,method:"GET"}}case"sessions.message":return{path:`/v1/desktop/sessions/${e.sessionId}/messages`,method:"POST",body:{request_id:e.requestId,text:e.text,images:e.images??[],...e.files?.length?{files:e.files}:{},mode:e.mode??"prompt",...e.inputMode?{input_mode:e.inputMode}:{},...e.inputPath?{input_path:e.inputPath}:{}}};case"sessions.command":return{path:`/v1/desktop/sessions/${e.sessionId}/commands`,method:"POST",body:{request_id:e.requestId,command:e.command,args:e.args??"",images:e.images??[]}};case"sessions.answer":return e.askId!==void 0?{path:`/v1/desktop/sessions/${e.sessionId}/answers`,method:"POST",body:{ask_id:e.askId,answers:e.answers,decline:e.decline,...e.revise===!0?{revise:!0}:{},...e.dismiss===!0?{dismiss:!0,...e.reason!==void 0?{reason:e.reason}:{}}:{}}}:{path:`/v1/desktop/sessions/${e.sessionId}/answers`,method:"POST",body:{epoch:e.epoch,request_id:e.requestId,value:e.value,approved:e.approved,question_index:e.questionIndex}};case"sessions.seen":return{path:`/v1/desktop/sessions/${e.sessionId}/seen`,method:"POST",body:{completion_token:e.completionToken}};case"attention.seen":return{path:"/v1/desktop/attention/seen",method:"POST",body:{items:e.items.map(t=>({session_id:t.sessionId,completion_token:t.completionToken}))}};case"sessions.notified":return{path:`/v1/desktop/sessions/${e.sessionId}/notified`,method:"POST",body:{completion_token:e.completionToken}};case"tags.list":return{path:"/v1/desktop/tags",method:"GET"};case"tags.replace":return{path:"/v1/desktop/tags",method:"PUT",body:{tags:e.tags}};case"sessions.tags":return{path:`/v1/desktop/sessions/${e.sessionId}/tags`,method:"PUT",body:{tags:e.tags,primary:e.primary,...e.expected_revision===void 0?{}:{expected_revision:e.expected_revision}}};case"sessions.pin":return{path:`/v1/desktop/sessions/${e.sessionId}/pin`,method:"POST",body:{pinned:e.pinned}};case"sessions.watch":return{path:`/v1/desktop/sessions/${e.sessionId}/watch`,method:"POST",body:{subscription_id:e.subscriptionId,visible:e.visible,can_notify:e.canNotify}};case"sessions.presence":return{path:"/v1/desktop/presence",method:"POST",body:{subscription_id:e.subscriptionId,can_notify_kinds:e.canNotifyKinds,session_id:e.sessionId,window:e.window,can_notify:e.canNotify}};case"sessions.move":return{path:`/v1/desktop/sessions/${e.sessionId}/working-directory`,method:"POST",body:{request_id:e.requestId,cwd:e.cwd}};case"sessions.warm":return{path:`/v1/desktop/sessions/${e.sessionId}/warm`,method:"POST",body:{}};case"sessions.interrupt":return{path:`/v1/desktop/sessions/${e.sessionId}/interrupt`,method:"POST",body:{request_id:e.requestId}};case"supplements.cancel":return{path:`/v1/desktop/sessions/${e.sessionId}/supplements/${e.job}/cancel`,method:"POST",body:{anchor:e.anchor}};case"supplements.restart":return{path:`/v1/desktop/sessions/${e.sessionId}/supplements/${e.job}/restart`,method:"POST",body:{anchor:e.anchor}};case"supplements.steer":return{path:`/v1/desktop/sessions/${e.sessionId}/supplements/${e.job}/steer`,method:"POST",body:{anchor:e.anchor,text:e.text}};case"sessions.variables.list":return{path:`/v1/desktop/sessions/${e.sessionId}/variables`,method:"GET"};case"sessions.variables.create":return{path:`/v1/desktop/sessions/${e.sessionId}/variables`,method:"POST",body:{key:e.key,value:e.value,type:e.type}};case"sessions.variables.update":return{path:`/v1/desktop/sessions/${e.sessionId}/variables/${encodeURIComponent(e.key)}`,method:"PATCH",body:{value:e.value,type:e.type}};case"sessions.variables.delete":return{path:`/v1/desktop/sessions/${e.sessionId}/variables/${encodeURIComponent(e.key)}`,method:"DELETE"};case"legacy.models":{const t=new URLSearchParams;return e.provider&&t.set("provider",e.provider),e.sort&&t.set("sort",e.sort),e.direction&&t.set("direction",e.direction),{path:t.size>0?`/v1/models?${t}`:"/v1/models",method:"GET"}}case"legacy.models.providers":return{path:"/v1/models/providers",method:"GET"};case"auth.probe":return{path:`/v1/auth/providers/${e.provider}/probe`,method:"POST"};case"legacy.agent.upload":return{path:`/v1/agents/${e.agentId}/upload`,method:"POST"};case"agent.publish":{ss(e);const t=new URLSearchParams;e.visibility==="org"&&e.tenantId&&(t.set("visibility","org"),t.set("tenant_id",e.tenantId));const n=t.toString();return{path:`/v1/agents/${e.agentId}/publish${n?`?${n}`:""}`,method:"POST",body:{document:e.document??{},...is(e)}}}case"agent.republish":{ss(e);const t=new URLSearchParams;e.visibility==="org"&&e.tenantId&&(t.set("visibility","org"),t.set("tenant_id",e.tenantId));const n=t.toString();return{path:`/v1/agents/${e.agentId}/publish${n?`?${n}`:""}`,method:"PUT",body:{hub_agent_id:e.hubAgentId,document:e.document??{},...is(e),...e.expectedRemoteRevision?{expected_remote_revision:e.expectedRemoteRevision}:{}}}}case"team.publish":{ss(e);const t=new URLSearchParams;return e.visibility==="org"&&e.tenantId&&(t.set("visibility","org"),t.set("tenant_id",e.tenantId)),{path:`/v1/teams/${e.teamId}/publish${t.size?`?${t}`:""}`,method:"POST",body:is(e)}}case"team.pull":{const t=new URLSearchParams;e.tenantId&&t.set("tenant_id",e.tenantId);const n=t.toString();return{path:`/v1/teams/pull/${e.teamId}${n?`?${n}`:""}`,method:"GET"}}case"agent.nameAvailability":return{path:`/v1/agent-name-availability?${new URLSearchParams({name:e.name})}`,method:"GET"};case"legacy.agents.list":{const t=new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)});return e.name&&t.set("name",e.name),e.sort&&t.set("sort",e.sort),e.direction&&t.set("direction",e.direction),{path:`/v1/agents?${t}`,method:"GET"}}case"legacy.agent.get":return{path:`/v1/agents/${e.agentId}`,method:"GET"};case"legacy.agent.history":{const t=new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)});return{path:`/v1/agents/${e.agentId}/history?${t}`,method:"GET"}}case"wakes.list":{const t=new URLSearchParams;return e.limit!==void 0&&t.set("limit",String(e.limit)),e.includeDormant!==void 0&&t.set("include_dormant",String(e.includeDormant)),{path:t.size>0?`/v1/desktop/wakes?${t}`:"/v1/desktop/wakes",method:"GET"}}case"wakes.create":return{path:"/v1/desktop/wakes",method:"POST",body:{request_id:e.requestId,...Tg(e),message:e.message,...xc(e)}};case"wakes.edit":return{path:`/v1/desktop/wakes/${e.sessionId}/${e.wakeId}`,method:"PATCH",body:{...e.message!==void 0?{message:e.message}:{},...xc(e)}};case"wakes.remove":return{path:`/v1/desktop/wakes/${e.sessionId}/${e.wakeId}`,method:"DELETE"};case"monitors.cancel":return{path:`/v1/desktop/monitors/${encodeURIComponent(e.sessionId)}/${encodeURIComponent(e.monitorId)}`,method:"DELETE"};case"jobs.cancel":return{path:`/v1/desktop/sessions/${encodeURIComponent(e.sessionId)}/jobs/${encodeURIComponent(e.jobId)}/cancel`,method:"POST"};case"legacy.jobs.list":{const t=new URLSearchParams;return e.agentId&&t.set("agent_id",e.agentId),e.status&&t.set("status",e.status),{path:t.size>0?`/v1/jobs?${t}`:"/v1/jobs",method:"GET"}}case"legacy.job.get":return{path:`/v1/jobs/${e.jobId}`,method:"GET"};case"legacy.schedules.list":return{path:`/v1/schedules?${new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)})}`,method:"GET"};case"legacy.agent.schedules.list":{const t=new URLSearchParams({page:String(e.page??1),per_page:String(e.perPage??10)});return{path:`/v1/agents/${e.agentId}/schedules?${t}`,method:"GET"}}case"legacy.agent.schedule.create":return{path:`/v1/agents/${e.agentId}/schedules`,method:"POST",body:e.schedule};case"legacy.schedule.get":return{path:`/v1/schedules/${e.scheduleId}`,method:"GET"};case"legacy.schedule.edit":return{path:`/v1/schedules/${e.scheduleId}`,method:"PATCH",body:e.schedule};case"legacy.schedule.remove":return{path:`/v1/schedules/${e.scheduleId}`,method:"DELETE"};case"legacy.agent.create":return{path:"/v1/agents",method:"POST",body:e.agent};case"legacy.agent.update":return{path:`/v1/agents/${e.agentId}`,method:"PATCH",body:e.update};case"legacy.agent.delete":return{path:`/v1/agents/${e.agentId}`,method:"DELETE"};case"legacy.agent.conversation.clear":return{path:`/v1/agents/${e.agentId}/conversation`,method:"DELETE"};case"legacy.agent.systemPrompt.get":return{path:`/v1/agents/${e.agentId}/system-prompt`,method:"GET"};case"legacy.agent.systemPrompt.update":return{path:`/v1/agents/${e.agentId}/system-prompt`,method:"PUT",body:{system_prompt:e.systemPrompt}};case"legacy.agent.download":return{path:`/v1/agents/${e.agentId}/download`,method:"GET"};case"legacy.job.cancel":return{path:`/v1/jobs/${e.jobId}`,method:"DELETE"};case"commands.list":return{path:"/v1/desktop/commands",method:"GET"};case"commands.entities":return{path:`/v1/desktop/sessions/${e.sessionId}/command-entities?command=${encodeURIComponent(e.command)}${e.name?`&name=${encodeURIComponent(e.name)}`:""}`,method:"GET"};case"models.catalogue":{const t=e.scope?`&scope=${e.scope}`:"";return{path:`/v1/desktop/models?live=${e.live??!1}${t}`,method:"GET"}}case"usage.get":{const t=new URLSearchParams({live:String(e.live??!1),refresh:String(e.refresh??!1)});return e.provider&&t.set("provider",e.provider),{path:`/v1/desktop/usage?${t}`,method:"GET"}}case"quota.notice":{const t=new URLSearchParams({refresh:String(e.refresh??!1)});return e.provider&&t.set("provider",e.provider),e.model&&t.set("model",e.model),{path:`/v1/desktop/quota-notice?${t}`,method:"GET"}}case"analytics.get":{const t=new URLSearchParams({days:String(e.days??30)});return e.sessionId&&t.set("session_id",e.sessionId),e.sinceMs!==void 0&&t.set("since_ms",String(e.sinceMs)),e.untilMs!==void 0&&t.set("until_ms",String(e.untilMs)),{path:`/v1/desktop/analytics?${t}`,method:"GET"}}case"analytics.models":{const t=new URLSearchParams({days:String(e.days??30)});return e.sessionId&&t.set("session_id",e.sessionId),e.sinceMs!==void 0&&t.set("since_ms",String(e.sinceMs)),e.untilMs!==void 0&&t.set("until_ms",String(e.untilMs)),{path:`/v1/desktop/analytics/models?${t}`,method:"GET"}}case"info.get":return{path:"/v1/desktop/info",method:"GET"};case"sessions.report":{const t=new URLSearchParams({recent_limit:String(e.recentLimit??12)});return{path:`/v1/desktop/sessions/${e.sessionId}/report?${t}`,method:"GET"}}case"skills.list":{const t=new URLSearchParams;e.sessionId&&t.set("session_id",e.sessionId),e.cwd&&t.set("cwd",e.cwd),e.name&&t.set("name",e.name);const n=t.toString();return{path:`/v1/desktop/skills${n?`?${n}`:""}`,method:"GET"}}case"skills.create":return{path:"/v1/desktop/skills",method:"POST",body:{request_id:e.requestId,name:e.name,copy_from:e.copyFrom}};case"skills.update":return{path:`/v1/desktop/skills/${encodeURIComponent(e.name)}`,method:"PUT",body:{request_id:e.requestId,expected_fingerprint:e.expectedFingerprint,files:e.files}};case"skills.remove":return{path:`/v1/desktop/skills/${encodeURIComponent(e.name)}`,method:"DELETE",body:{request_id:e.requestId,discard_local_changes:e.discardLocalChanges}};case"sessions.failovers":return{path:`/v1/desktop/sessions/${e.sessionId}/failovers`,method:"GET"};case"sessions.credential":return{path:`/v1/desktop/sessions/${e.sessionId}/credentials`,method:"POST",body:{action:e.action,key:e.key,value:e.value,confirmed:e.confirmed}};case"sessions.fork":return{path:`/v1/desktop/sessions/${e.sessionId}/fork`,method:"POST",body:{request_id:e.requestId,message:e.message,boundary:e.boundary,entry_id:e.entryId,auto_tag:e.autoTag}};case"sessions.stop":return{path:"/v1/desktop/stop",method:"POST",body:{request_id:e.requestId,targets:e.targets,confirmed:e.confirmed}};case"sessions.aside":return{path:`/v1/desktop/sessions/${e.sessionId}/asides`,method:"POST",body:{request_id:e.requestId,text:e.text,aside_id:e.asideId,subscription_id:e.subscriptionId}};case"sessions.adopt":return{path:`/v1/desktop/sessions/${e.sessionId}/asides/${e.asideId}/adopt`,method:"POST",body:{request_id:e.requestId,confirmed:e.confirmed}};case"sessions.aside.get":case"sessions.aside.close":return{path:`/v1/desktop/sessions/${e.sessionId}/asides/${e.asideId}`,method:e.op==="sessions.aside.get"?"GET":"DELETE"};case"mcp.list":return{path:`/v1/desktop/sessions/${e.sessionId}/mcp`,method:"GET"};case"mcp.credentials.store":return{path:`/v1/desktop/sessions/${e.sessionId}/mcp/credentials`,method:"POST",body:{name:e.name,values:e.values,confirmed_replace:e.confirmedReplace}};case"mcp.control":return{path:`/v1/desktop/sessions/${e.sessionId}/mcp`,method:"POST",body:e.control};case"mcp.catalog":{const t=new URLSearchParams;e.cwd&&t.set("cwd",e.cwd),e.sessionId&&t.set("session_id",e.sessionId);const n=t.toString();return{path:n?`/v1/desktop/mcp?${n}`:"/v1/desktop/mcp",method:"GET"}}case"mcp.catalog.control":return{path:"/v1/desktop/mcp",method:"POST",body:{...e.control,...e.cwd?{cwd:e.cwd}:{}}};case"mcp.catalog.credentials":return{path:"/v1/desktop/mcp/credentials",method:"POST",body:{name:e.name,values:e.values,...e.header?{header:e.header}:{},confirmed_replace:e.confirmedReplace,...e.cwd?{cwd:e.cwd}:{}}};case"radient.request":return{path:"/v1/desktop/radient",method:"POST",body:e.control};case"providers.list":return{path:"/v1/auth/providers",method:"GET"};case"accounts.list":return{path:"/v1/auth/status",method:"GET"};case"accounts.remove":return{path:`/v1/auth/accounts/${e.accountId}`,method:"DELETE"};case"tunnel.setup.read":return{path:e.credentialId===void 0?"/v1/desktop/tunnel/setup":`/v1/desktop/tunnel/setup?credential_id=${e.credentialId}`,method:"GET"};case"tunnel.setup.plan":return{path:"/v1/desktop/tunnel/setup",method:"POST",body:{action:"plan",...e.credentialId!==void 0?{credential_id:e.credentialId}:{}}};case"tunnel.setup.run":return{path:"/v1/desktop/tunnel/setup",method:"POST",body:{action:"run",credential_id:e.credentialId,...e.acceptMonthlyPrice!==void 0?{accept_monthly_price:e.acceptMonthlyPrice}:{}}};case"auth.start":return{path:"/v1/auth/login",method:"POST",body:{provider:e.provider}};case"auth.status":return{path:`/v1/auth/operations/${e.id}`,method:"GET"};case"auth.input":return{path:`/v1/auth/operations/${e.id}/input`,method:"POST",body:{prompt_id:e.promptId,value:e.value}};case"auth.cancel":return{path:`/v1/auth/operations/${e.id}`,method:"DELETE"};case"auth.key":return{path:`/v1/auth/providers/${e.provider}/key`,method:"PUT",body:{value:e.value}};case"auth.logout":return{path:`/v1/auth/providers/${e.provider}/credentials`,method:"DELETE"};case"agent_messages.status":return{path:`/v1/desktop/team-bridge/status?boundary=${e.boundary}`,method:"GET"};case"agent_messages.enable":return{path:"/v1/desktop/team-bridge/settings",method:"PUT",body:{expected_account_id:e.expected_account_id,tenant_id:e.tenant_id,state:e.state,consent_version:e.consent_version,consented_via:e.consented_via}};case"agent_messages.settings":return{path:`/v1/desktop/team-bridge/settings${os(e.tenant_id)}`,method:"GET"};case"agent_messages.settings.put":return{path:"/v1/desktop/team-bridge/settings",method:"PUT",body:{expected_account_id:e.expected_account_id,...e.tenant_id===void 0?{}:{tenant_id:e.tenant_id},...e.consent_version===void 0?{}:{consent_version:e.consent_version},...e.consented_via===void 0?{}:{consented_via:e.consented_via},...e.label===void 0?{}:{label:e.label},state:e.state}};case"agent_messages.onboarding.dismiss":return{path:"/v1/desktop/team-bridge/onboarding/dismiss",method:"POST"};case"agent_messages.allowlist.get":return{path:`/v1/desktop/team-bridge/allowlist${os(e.tenant_id)}`,method:"GET"};case"agent_messages.allowlist.put":return{path:"/v1/desktop/team-bridge/allowlist",method:"PUT",body:{expected_account_id:e.expected_account_id,...e.tenant_id===void 0?{}:{tenant_id:e.tenant_id},entries:e.entries}};case"team_bridge.conversations.list":{const t=new URLSearchParams;return e.scope==="account"&&t.set("scope","account"),e.tenant_id&&t.set("tenant_id",e.tenant_id),e.limit!==void 0&&t.set("limit",String(e.limit)),e.cursor&&t.set("cursor",e.cursor),e.before&&t.set("before",e.before),e.status&&t.set("status",e.status),{path:`/v1/desktop/team-bridge/conversations${t.size>0?`?${t.toString()}`:""}`,method:"GET"}}case"team_bridge.conversations.get":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}${os(e.tenant_id)}`,method:"GET"};case"team_bridge.conversations.create":return{path:"/v1/desktop/team-bridge/conversations",method:"POST",body:{...e.expected_account_id?{expected_account_id:e.expected_account_id}:{},...e.tenant_id?{tenant_id:e.tenant_id}:{},kind:e.kind,...e.name?{name:e.name}:{},...e.topic?{topic:e.topic}:{},...e.visibility?{visibility:e.visibility}:{},...e.agent_capable===void 0?{}:{agent_capable:e.agent_capable},members:e.members}};case"team_bridge.conversations.lifecycle":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/${e.action}${e.action==="join"?"":Kr(e)}`,method:"POST",...e.action==="join"&&(e.tenant_id||e.expected_account_id)?{body:{...e.tenant_id?{tenant_id:e.tenant_id}:{},...e.expected_account_id?{expected_account_id:e.expected_account_id}:{}}}:{}};case"team_bridge.conversations.join":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/join`,method:"POST",...e.tenant_id||e.expected_account_id?{body:{...e.tenant_id?{tenant_id:e.tenant_id}:{},...e.expected_account_id?{expected_account_id:e.expected_account_id}:{}}}:{}};case"team_bridge.conversations.notify":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/read`,method:"POST",body:{...e.expected_account_id?{expected_account_id:e.expected_account_id}:{},...e.tenant_id?{tenant_id:e.tenant_id}:{},notify:e.notify}};case"team_bridge.conversations.agent_notify":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/agent-notify`,method:"PUT",body:{...e.expected_account_id?{expected_account_id:e.expected_account_id}:{},...e.tenant_id?{tenant_id:e.tenant_id}:{},notify:e.notify}};case"team_bridge.conversations.members.add":{const t=new URLSearchParams;e.tenant_id&&t.set("tenant_id",e.tenant_id),e.expected_account_id&&t.set("expected_account_id",e.expected_account_id);const n=t.size>0?`?${t.toString()}`:"";return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/members${n}`,method:"POST",body:e.members}}case"team_bridge.conversations.delete":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}${Kr(e)}`,method:"DELETE"};case"team_bridge.conversations.members.remove":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/members/${encodeURIComponent(e.account_id)}${Kr(e)}`,method:"DELETE"};case"team_bridge.conversations.consent":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/members/${encodeURIComponent(e.account_id)}/consent`,method:"POST",body:{...e.expected_account_id?{expected_account_id:e.expected_account_id}:{},...e.tenant_id?{tenant_id:e.tenant_id}:{},decision:e.decision,consent_version:e.consent_version}};case"team_bridge.owner_audit.conversations":case"team_bridge.owner_audit.messages":case"team_bridge.owner_audit.replies":{const t=new URLSearchParams({expected_account_id:e.expected_account_id,tenant_id:e.tenant_id});e.limit!==void 0&&t.set("limit",String(e.limit));let n="/v1/desktop/team-bridge/owner-audit/conversations";return e.op==="team_bridge.owner_audit.conversations"?e.cursor!==void 0&&t.set("cursor",e.cursor):(n+=`/${encodeURIComponent(e.conversation_id)}/messages`,e.op==="team_bridge.owner_audit.messages"?e.before_seq!==void 0&&t.set("before_seq",String(e.before_seq)):(n+=`/${encodeURIComponent(e.message_id)}/replies`,e.after_seq!==void 0&&t.set("after_seq",String(e.after_seq)))),{path:`${n}?${t}`,method:"GET"}}case"team_bridge.messages.list":{const t=new URLSearchParams;e.tenant_id&&t.set("tenant_id",e.tenant_id),e.limit!==void 0&&t.set("limit",String(e.limit)),e.before_seq!==void 0&&t.set("before_seq",String(e.before_seq)),e.endpoint_id&&t.set("endpoint_id",e.endpoint_id);const n=t.size>0?`?${t.toString()}`:"";return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/messages${n}`,method:"GET"}}case"team_bridge.reactions.toggle":{const t=`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/messages/${encodeURIComponent(e.message_id)}/reactions/${encodeURIComponent(e.emoji)}`;return e.active?{path:t,method:"PUT",body:{expected_account_id:e.expected_account_id,tenant_id:e.tenant_id}}:{path:`${t}${Kr(e)}`,method:"DELETE"}}case"team_bridge.messages.send":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/messages`,method:"POST",body:{...e.expected_account_id?{expected_account_id:e.expected_account_id}:{},...e.tenant_id?{tenant_id:e.tenant_id}:{},client_ref:e.client_ref,body:e.body,...e.agent_label?{agent_label:e.agent_label}:{},...e.thread_root_id?{thread_root_id:e.thread_root_id}:{},...e.attachment_ids?.length?{attachment_ids:e.attachment_ids}:{},...e.mentions?.length?{mentions:e.mentions}:{}}};case"team_bridge.scheduled.list":return{path:`/v1/desktop/team-bridge/scheduled?${new URLSearchParams({tenant_id:e.tenant_id})}`,method:"GET"};case"team_bridge.scheduled.create":return{path:"/v1/desktop/team-bridge/scheduled",method:"POST",body:{tenant_id:e.tenant_id,conversation_id:e.conversation_id,client_ref:e.client_ref,body:e.body,send_at:e.send_at,...e.attachment_ids?.length?{attachment_ids:e.attachment_ids}:{},...e.thread_root_id?{thread_root_id:e.thread_root_id}:{}}};case"team_bridge.scheduled.update":return{path:`/v1/desktop/team-bridge/scheduled/${encodeURIComponent(e.scheduled_id)}?${new URLSearchParams({tenant_id:e.tenant_id})}`,method:"PATCH",body:{...e.body===void 0?{}:{body:e.body},...e.send_at===void 0?{}:{send_at:e.send_at},...e.attachment_ids===void 0?{}:{attachment_ids:e.attachment_ids},...e.expected_version===void 0?{}:{expected_version:e.expected_version}}};case"team_bridge.attachments.delete":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/attachments/${encodeURIComponent(e.attachment_id)}?${new URLSearchParams({tenant_id:e.tenant_id,expected_account_id:e.expected_account_id})}`,method:"DELETE"};case"team_bridge.scheduled.cancel":return{path:`/v1/desktop/team-bridge/scheduled/${encodeURIComponent(e.scheduled_id)}?${new URLSearchParams({tenant_id:e.tenant_id})}`,method:"DELETE"};case"team_bridge.messages.replies":{const t=new URLSearchParams({expected_account_id:e.expected_account_id,tenant_id:e.tenant_id});e.limit!==void 0&&t.set("limit",String(e.limit)),e.after_seq!==void 0&&t.set("after_seq",String(e.after_seq));const n=t.size>0?`?${t.toString()}`:"";return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/messages/${encodeURIComponent(e.message_id)}/replies${n}`,method:"GET"}}case"team_bridge.read":return{path:`/v1/desktop/team-bridge/conversations/${encodeURIComponent(e.conversation_id)}/read`,method:"POST",body:{...e.expected_account_id?{expected_account_id:e.expected_account_id}:{},...e.tenant_id?{tenant_id:e.tenant_id}:{},...e.seq===void 0?{}:{seq:e.seq},...e.muted===void 0?{}:{muted:e.muted}}};case"team_bridge.unread":{const t=new URLSearchParams;return e.scope==="account"?t.set("scope","account"):e.tenant_id&&t.set("tenant_id",e.tenant_id),{path:`/v1/desktop/team-bridge/unread${t.size>0?`?${t.toString()}`:""}`,method:"GET"}}case"team_bridge.directory":return{path:`/v1/desktop/team-bridge/directory?tenant_id=${encodeURIComponent(e.tenant_id)}`,method:"GET"};case"team_bridge.status":{const t=new URLSearchParams;return e.boundary&&t.set("boundary",e.boundary),{path:`/v1/desktop/team-bridge/status${t.size>0?`?${t.toString()}`:""}`,method:"GET"}}case"settings.list":return{path:"/v1/settings",method:"GET"};case"settings.edit":return{path:`/v1/settings/${e.key}`,method:"PATCH",body:{value:e.value,base:e.base}};case"settings.reset":return{path:`/v1/settings/${e.key}/reset`,method:"POST"};case"tts.paths":return{path:"/v1/tts/paths",method:"GET"};case"config.get":return{path:"/v1/config",method:"GET"};case"config.update":return{path:"/v1/config",method:"PATCH",body:e.value};case"instructions.get":return{path:"/v1/config/system-prompt",method:"GET"};case"instructions.update":return{path:"/v1/config/system-prompt",method:"PATCH",body:{content:e.content}};case"credentials.list":return{path:"/v1/credentials",method:"GET"};case"credentials.update":return{path:"/v1/credentials",method:"PATCH",body:{key:e.key,value:e.value}};case"library.list":{const t=new URLSearchParams;e.scope&&t.set("scope",e.scope),e.q&&t.set("q",e.q),e.category&&t.set("category",e.category),e.kind&&t.set("kind",e.kind),e.origin_group&&t.set("origin_group",e.origin_group),e.origin&&t.set("origin",e.origin),e.tag&&t.set("tag",e.tag),e.tag_mode&&t.set("tag_mode",e.tag_mode),e.highlighted!==void 0&&t.set("highlighted",e.highlighted?"1":"0"),e.organized!==void 0&&t.set("organized",e.organized?"1":"0"),e.favorite!==void 0&&t.set("favorite",e.favorite?"1":"0"),e.session&&t.set("session",e.session),e.session_id&&t.set("session_id",e.session_id),e.sort&&t.set("sort",e.sort),e.order&&t.set("order",e.order),e.limit!==void 0&&t.set("limit",String(e.limit)),e.cursor&&t.set("cursor",e.cursor);const n=t.toString();return{path:`/v1/desktop/library/assets${n?`?${n}`:""}`,method:"GET"}}case"library.get":return{path:`/v1/desktop/library/assets/${encodeURIComponent(e.id)}`,method:"GET"};case"library.update":return{path:`/v1/desktop/library/assets/${encodeURIComponent(e.id)}`,method:"PATCH",body:e.fields};case"library.tags":return{path:"/v1/desktop/library/tags",method:"GET"};case"library.tags.create":return{path:"/v1/desktop/library/tags",method:"POST",body:{name:e.name,...e.category!==void 0?{category:e.category}:{}}};case"library.tags.update":return{path:`/v1/desktop/library/tags/${encodeURIComponent(e.id)}`,method:"PATCH",body:{...e.name!==void 0?{name:e.name}:{},...e.category!==void 0?{category:e.category}:{}}};case"library.tags.delete":return{path:`/v1/desktop/library/tags/${encodeURIComponent(e.id)}`,method:"DELETE"};case"library.tags.merge":return{path:`/v1/desktop/library/tags/${encodeURIComponent(e.id)}/merge`,method:"POST",body:{into:e.into}};case"library.tags.assign":return{path:`/v1/desktop/library/assets/${encodeURIComponent(e.id)}/tags`,method:"PUT",body:{tags:e.tags,...e.primary!==void 0?{primary:e.primary}:{}}};case"library.chat.link":return{path:`/v1/desktop/library/assets/${encodeURIComponent(e.id)}/chat`,method:"PUT",body:{session_id:e.sessionId}};case"library.chat.clear":return{path:`/v1/desktop/library/assets/${encodeURIComponent(e.id)}/chat`,method:"DELETE"};case"library.librarian":{const t=e.action??"status";return t==="status"?{path:"/v1/desktop/librarian",method:"GET"}:{path:"/v1/desktop/librarian",method:"POST",body:{op:t}}}case"projects.list":return{path:"/v1/desktop/projects",method:"GET"};case"projects.get":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}`,method:"GET"};case"projects.create":return{path:"/v1/desktop/projects",method:"POST",body:{name:e.name,...e.description!==void 0?{description:e.description}:{},...e.status!==void 0?{status:e.status}:{},...e.tags!==void 0?{tags:e.tags}:{}}};case"projects.update":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}`,method:"PATCH",body:{...e.fields,...e.force_done===!0?{force_done:!0}:{}}};case"projects.delete":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}`,method:"DELETE",body:{confirm:e.confirmed_name}};case"projects.link":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/links`,method:"POST",body:{session_id:e.sessionId}};case"projects.unlink":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/links/${encodeURIComponent(e.sessionId)}`,method:"DELETE"};case"projects.milestone":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/milestones`,method:"POST",body:{name:e.name,...e.targetDate!==void 0?{target_date:e.targetDate}:{},...e.completed!==void 0?{completed:e.completed}:{}}};case"projects.milestone.remove":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/milestones/${encodeURIComponent(e.name)}`,method:"DELETE"};case"projects.request_update":return{path:`/v1/desktop/projects/${encodeURIComponent(e.key)}/request-update`,method:"POST"};case"projects.search":return{path:`/v1/desktop/projects/search?${new URLSearchParams({q:e.q,limit:String(e.limit??Bm)})}`,method:"GET"};case"aida.status":return{path:"/v1/desktop/aida",method:"GET"};case"aida.control":return{path:"/v1/desktop/aida",method:"POST",body:{op:e.action}};case"code_requests.list":return{path:`/v1/desktop/sessions/${e.sessionId}/code-requests`,method:"GET"};case"code_requests.refresh":return{path:`/v1/desktop/sessions/${e.sessionId}/code-requests/refresh`,method:"POST",body:{...e.keys!==void 0?{keys:e.keys}:{},...e.force!==void 0?{force:e.force}:{}}};case"static.sign":return{path:"/v1/static/sign",method:"POST",body:{route:e.route,path:e.path,ttl_s:e.ttlS}};case"sidebar_layout.get":return{path:"/v1/desktop/sidebar-layout",method:"GET"};case"sidebar_layout.set":return{path:"/v1/desktop/sidebar-layout",method:"PUT",body:{layout:e.layout}};case"notifications.list":{const t=new URLSearchParams;e.preview&&t.set("preview","true"),e.includeAskReads&&t.set("include_ask_reads","true");for(const n of e.countSessionIds??[])t.append("count_session_ids",n);return e.kind&&t.set("kind",e.kind),e.bulkPriority&&t.set("bulk_priority",e.bulkPriority),e.state&&t.set("state",e.state),e.source&&t.set("source",e.source),e.priority&&t.set("priority",e.priority),e.sessionId&&t.set("session_id",e.sessionId),e.cursor&&t.set("cursor",e.cursor),e.throughSeq!==void 0&&t.set("through_seq",String(e.throughSeq)),e.limit!==void 0&&t.set("limit",String(e.limit)),{path:`/v1/desktop/notifications${t.size?`?${t}`:""}`,method:"GET"}}case"notifications.get":return{path:`/v1/desktop/notifications/${encodeURIComponent(e.id)}`,method:"GET"};case"notifications.count":return{path:"/v1/desktop/notifications/count",method:"GET"};case"notifications.read":case"notifications.dismiss":return{path:"/v1/desktop/notifications",method:"PATCH",body:{op:e.verb,...Ag(e.target)}};case"notifications.seen":return{path:"/v1/desktop/notifications/seen",method:"POST",body:{items:e.items.map(t=>({id:t.id,revision:t.revision,anchor_id:t.anchorId,visible_since_ms:t.visibleSinceMs})),evidence:{surface:"desktop",session_id:e.evidence.sessionId,input_kind:Zm[e.evidence.inputKind],input_at_ms:e.evidence.inputAtMs,visible_since_ms:e.evidence.visibleSinceMs}}}}}function Ag(e){return"selectionToken"in e?{selection_token:e.selectionToken,...e.reconcileIds?{reconcile_ids:e.reconcileIds}:{},...e.excludedIds?{excluded_ids:e.excludedIds}:{}}:"operationToken"in e?{operation_token:e.operationToken,...e.reconcileIds?{reconcile_ids:e.reconcileIds}:{}}:"items"in e?{...e.receipt?{receipt:!0,through_seq:e.throughSeq,...e.reconcileIds?{reconcile_ids:e.reconcileIds}:{}}:{},ids:e.items.map(t=>({id:t.id,revision:t.revision}))}:"sessionId"in e?{session_id:e.sessionId,through_seq:e.throughSeq,observed:e.observed}:{all:!0,through_seq:e.throughSeq,observed:e.observed}}const Dx=64,Nx=64*1024*1024,Lx="superseded_completion_token",$x="store_busy",Og="session_is_remote",Pg="owner_build_behind";function Ux(e,t,n){if(!e||typeof e!="object")return!1;const r=e;return r.unseen===!1&&r.conversation_id===`session/${t}`&&r.completion_token===n}function wn(e,t,n){return!t||t.conversation_id!==`session/${n}`||!Array.isArray(t.revision)||t.revision.length!==2||!t.revision.every(r=>Number.isSafeInteger(r)&&r>=0)||e?.conversation_id===t.conversation_id&&(t.revision[0]<e.revision[0]||t.revision[1]<e.revision[1])?e:t.supported===void 0&&e?.supported!==void 0?{...t,supported:e.supported}:t}function jg(e){const t=Number(e);return Number.isFinite(t)&&t>0?Math.round(t*1e3):null}const Fx=e=>typeof e?.goal_status=="string",Bx=e=>(e?.goal??"").trim().length>0;function Mg(e,t,n={}){return!e||e.epoch!==t.epoch?!0:t.seq>e.seq||n.allowEqual===!0&&t.seq===e.seq}function Dg(e,t,n){return n.session_id!==t||n.payload.frontend.snapshot.session_id!==t||!e?!1:e.epoch===n.epoch&&n.seq>e.seq}const qn={notPaired:"This backend was not started with desktop controls.",serverDown:"The Local Operator server is not answering.",frameBudget:"The event stream exceeded its frame budget.",ended:"The event stream ended."};function Ng(e){return e?e===qn.notPaired?"notPaired":e===qn.serverDown?"serverDown":e===qn.frameBudget?"frameTooLarge":"lost":"lost"}const Rc=e=>{let t;const n=new Set,r=(d,u)=>{const f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){const p=t;t=u??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,p))}},i=()=>t,c={setState:r,getState:i,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d))},l=t=e(r,i,c);return c},Lg=e=>e?Rc(e):Rc,$g=e=>e;function Ug(e,t=$g){const n=Ma.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return Ma.useDebugValue(n),n}const Tc=e=>{const t=Lg(e),n=r=>Ug(t,r);return Object.assign(n,t),n},Cr=e=>e?Tc(e):Tc;function wd(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var s;const a=l=>l===null?null:JSON.parse(l,void 0),c=(s=n.getItem(i))!=null?s:null;return c instanceof Promise?c.then(a):a(c)},setItem:(i,s)=>n.setItem(i,JSON.stringify(s,void 0)),removeItem:i=>n.removeItem(i)}}const Ws=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Ws(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Ws(r)(n)}}}},Fg=(e,t)=>(n,r,i)=>{let s={storage:wd(()=>localStorage),partialize:m=>m,version:0,merge:(m,b)=>({...b,...m}),...t},a=!1;const c=new Set,l=new Set;let d=s.storage;if(!d)return e((...m)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...m)},r,i);const u=()=>{const m=s.partialize({...r()});return d.setItem(s.name,{state:m,version:s.version})},f=i.setState;i.setState=(m,b)=>{f(m,b),u()};const p=e((...m)=>{n(...m),u()},r,i);i.getInitialState=()=>p;let g;const y=()=>{var m,b;if(!d)return;a=!1,c.forEach(k=>{var E;return k((E=r())!=null?E:p)});const _=((b=s.onRehydrateStorage)==null?void 0:b.call(s,(m=r())!=null?m:p))||void 0;return Ws(d.getItem.bind(d))(s.name).then(k=>{if(k)if(typeof k.version=="number"&&k.version!==s.version){if(s.migrate){const E=s.migrate(k.state,k.version);return E instanceof Promise?E.then(A=>[!0,A]):[!0,E]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,k.state];return[!1,void 0]}).then(k=>{var E;const[A,$]=k;if(g=s.merge($,(E=r())!=null?E:p),n(g,!0),A)return u()}).then(()=>{_?.(g,void 0),g=r(),a=!0,l.forEach(k=>k(g))}).catch(k=>{_?.(void 0,k)})};return i.persist={setOptions:m=>{s={...s,...m},m.storage&&(d=m.storage)},clearStorage:()=>{d?.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>y(),hasHydrated:()=>a,onHydrate:m=>(c.add(m),()=>{c.delete(m)}),onFinishHydration:m=>(l.add(m),()=>{l.delete(m)})},s.skipHydration||y(),g||p},xi=Fg,Bg=(e,t)=>e!==null&&e.message===t.message&&e.removed===t.removed&&e.max_age_hours===t.max_age_hours&&e.in_progress===t.in_progress&&e.first_removal_at===t.first_removal_at&&e.freed_bytes_estimate===t.freed_bytes_estimate&&e.record===t.record;function Gg(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.message!="string"||t.message.trim()==="")return null;const n=(r,i)=>typeof r=="number"&&Number.isFinite(r)?r:i;return{message:t.message,removed:n(t.removed,0),max_age_hours:n(t.max_age_hours,48),in_progress:t.in_progress===!0,first_removal_at:typeof t.first_removal_at=="string"?t.first_removal_at:"",freed_bytes_estimate:typeof t.freed_bytes_estimate=="number"&&Number.isFinite(t.freed_bytes_estimate)?t.freed_bytes_estimate:null,record:typeof t.record=="string"?t.record:""}}const Sd=Cr()(xi(e=>({notice:null,receive:t=>e(n=>Bg(n.notice,t)?n:{notice:t}),dismiss:()=>e(t=>t.notice===null?t:{notice:null})}),{name:"delegated-cleanup-notice",storage:wd(()=>{if(typeof localStorage>"u"||localStorage===null)throw new Error("no localStorage in this environment");return localStorage}),partialize:e=>({notice:e.notice})}));function To(e){return h(Xm[e])}async function kd(e){if(window.api?.desktop)try{return await Hg(window.api.desktop.request(e),e)}catch(n){throw n instanceof ye?n:Yg(n)?new Ht(vd,bd):new ye(null,"Desktop controls could not reach the backend process.",n)}let t;try{t=await fetch("/__desktop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(n){throw new ye(null,"Desktop controls could not reach the backend process.",n)}if(!t.ok)throw new ye(t.status,"Desktop controls need a compatible backend connection.");return t.json()}function Hg(e,t){const n=yd(t);let r;return Promise.race([e,new Promise((i,s)=>{r=setTimeout(()=>{const a=Rg(t.op,n);s(new ye(null,a.message,void 0,a.code))},n)})]).finally(()=>clearTimeout(r))}const Ed="This server did not answer the request for its desktop controls.",Wg=()=>h("ui.common.errors.desktop_refusal_placeholder");class ye extends Error{status;cause;code;retryAfterMs;detail;constructor(t,n,r,i,s,a){super(n),this.name="DesktopControlError",this.status=t,this.cause=r,this.code=i,this.retryAfterMs=s,this.detail=a}}class Ht extends Error{code;constructor(t,n){super(t),this.name="UserFacingError",this.code=n}}function Co(e,t){return e instanceof ye||e instanceof Ht?Ei(e.code)?To(e.code):e.message===Ed?Wg():e.message:t}function zg(e,t,n,r){return typeof r=="string"?r:n===Hs.noCredential?qe.noCredential:n===Hs.transportFailed?qe.transportFailed:qm(Cg(e).path,t)}async function Re(e){const t=await kd(e),n=t.body;if(t.status<200||t.status>=300){const r=typeof n?.detail=="string"?n.detail:typeof n?.detail?.text=="string"?n.detail.text:typeof n?.detail?.message=="string"?n.detail.message:null;throw new ye(t.status,r??Ed,void 0,zg(e,t.status,r,typeof n?.detail=="object"?n.detail?.code:void 0),typeof n?.detail=="object"&&typeof n.detail?.retry_after_ms=="number"&&Number.isFinite(n.detail.retry_after_ms)?n.detail.retry_after_ms:void 0,typeof n?.detail=="object"?n.detail:void 0)}return e.op==="sessions.list"&&Zg(n?.result),n?.result}function Zg(e){if(typeof e!="object"||e===null)return;const t=Gg(e.delegated_cleanup_notice);t&&Sd.getState().receive(t)}async function Kg(){try{await Re({op:"delegated_cleanup_notice.ack"})}catch{}}async function Gx(){Sd.getState().dismiss(),await Kg()}function Vg(e){return e instanceof ye&&e.code===Ro}function Hx(e){if(!(e instanceof ye))return!1;const t=e.detail?.cause;return typeof t=="string"&&t.length>0?t===Pg:e.code===Og}function Wx(e){return e instanceof Ht&&e.code===bd}function Yg(e){return e instanceof Error&&e.message.includes(vd)}async function zx(e){const t=await kd(e);return new Response(t.status===204?null:JSON.stringify(t.body),{status:t.status,headers:{"Content-Type":"application/json"}})}async function Zx(e,t=!1){if(window.api?.desktop)return window.api.desktop.openAuthorization(e,t);const n=await Re({op:"auth.status",id:e});if(!n.auth_url)throw new Error("This sign-in is no longer waiting for a browser.");const r=new URL(n.auth_url);if(r.username||r.password||r.protocol!=="https:"&&!(r.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(r.hostname)))throw new Error("The provider returned an invalid sign-in address.");window.open(r.href,"_blank","noopener,noreferrer")}function Qg(e,t){const n=window.api?.desktop?.stream;if(n){const s=n.subscribe(e,t);return()=>s.dispose()}const r=new URLSearchParams({session:e.sessionId});e.epoch&&r.set("epoch",e.epoch),e.afterSeq!==void 0&&r.set("after_seq",String(e.afterSeq)),r.set("frontend_replace","1"),e.openFrame===!0&&r.set("open_frame","1"),e.journalOrder===!0&&(r.set("journal_order","1"),e.peerJournalSource===!0&&r.set("peer_journal_source","1"),ui(r,"/__desktop/stream",e.orderIds??[]));const i=new EventSource(`/__desktop/stream?${r}`);return i.onmessage=s=>{t({kind:"data",data:s.data})},i.onerror=()=>{i.readyState===EventSource.CLOSED&&(t({kind:"error",detail:qn.ended}),i.close())},()=>{i.close(),t({kind:"end"})}}async function Kx(e,t){const n=window.api?.desktop?.media;if(n)return n(e,t);const r=await fetch("/__desktop/media",{method:"POST",headers:{"x-desktop-media":JSON.stringify(e),"Content-Type":"application/octet-stream"},body:t?new Blob([t]):void 0}),i=r.headers.get("content-type")??"";if(!r.ok){let s="The media request failed.",a;if(i.includes("application/json"))try{const l=(await r.json())?.detail;if(typeof l=="string")s=l;else if(typeof l=="object"&&l!==null){const d=l;typeof d.text=="string"&&d.text.trim()?s=d.text:typeof d.message=="string"&&d.message.trim()&&(s=d.message),typeof d.code=="string"&&(a=d.code)}}catch{}return{status:r.status,kind:"error",detail:s,code:a!==void 0&&Ei(a)?a:s===Hs.noCredential?qe.noCredential:void 0}}return i.includes("application/json")?{status:r.status,kind:"json",body:await r.json()}:{status:r.status,kind:"bytes",mimeType:i||"application/octet-stream",data:new Uint8Array(await r.arrayBuffer())}}function Vx(e){return e.kind==="error"?Ei(e.code)?new Ht(To(e.code),e.code):new Error(e.detail):new Error("The media request returned an unexpected response.")}function Jg(e){if(Vg(e))return"deadline";const t=e instanceof ye?e.status:null;return t===null||t===503?"unreachable":t===401||t===403?"unauthorized":t===404?"outdated":"unknown"}const xd={unreachable:"",deadline:"",unauthorized:"",get outdated(){return h("ui.common.connection.backend.remedy_outdated")},unknown:""},zs={get unreachable(){return h("ui.common.connection.backend.diagnosis_unreachable")},get deadline(){return h("ui.common.connection.backend.diagnosis_deadline")},get unauthorized(){return h("ui.common.connection.backend.diagnosis_unauthorized")},get outdated(){return h("ui.common.connection.backend.diagnosis_outdated")},unknown:""};function Xg(e,t){const n=Jg(t);return[e,zs[n],xd[n]].filter(Boolean).join(" ")}const Zs={get successor(){return h("ui.common.connection.backend.pairing_successor")},get"governed-elsewhere"(){return h("ui.common.connection.backend.pairing_governed")},get"pre-handshake"(){return h("ui.common.connection.backend.pairing_pre_handshake")},get"credential-refused"(){return h("ui.common.connection.backend.pairing_credential_refused")},get unpaired(){return h("ui.common.connection.backend.pairing_unpaired")}},qg={get successor(){return h("ui.common.connection.backend.pane_successor")},get"governed-elsewhere"(){return h("ui.common.connection.backend.pane_governed")},get"pre-handshake"(){return h("ui.common.connection.backend.pane_pre_handshake")},get"credential-refused"(){return h("ui.common.connection.backend.pane_credential_refused")},get unpaired(){return h("ui.common.connection.backend.pane_unpaired")}};function Yx(e,t){return e!=="unpaired"?null:qg[t??"unpaired"]}function Qx(e,t){return e!=="unpaired"?null:Zs[t??"unpaired"]}function Jx(e){const{kind:t,unpaired:n,answered:r,cause:i=null,servedByThisApp:s=!1}=e;return i==="pre-handshake"?s:i!==null||n?!1:r?s:t==="outdated"}function Xx(e){const{kind:t,unpaired:n,missing:r,answered:i,cause:s=null}=e;if(s!==null)return Zs[s];if(!i){if(t==="unreachable")return h("ui.common.connection.backend.compatibility_unreachable",{diagnosis:zs.unreachable});if(t==="unauthorized")return h("ui.common.connection.backend.compatibility_unauthorized");if(t==="deadline")return h("ui.common.connection.backend.compatibility_deadline",{diagnosis:zs.deadline});if(t==="outdated")return h("ui.common.connection.backend.compatibility_outdated",{remedy:xd.outdated})}return n?Zs.unpaired:i?h("ui.common.connection.backend.compatibility_missing",{features:r.join(", ")}):h("ui.common.connection.backend.compatibility_unknown")}const e_=["auth","settings","commands","catalogues","lifecycle","mcp","radient"];function qx(e,t=null){return t!==null||!e?!0:e_.filter(r=>(e.features?.[r]??0)<1).length>0||e.desktop_available!==!0}function t_(e,t){return t instanceof ye&&t.status===null?!1:e<1}function eI(e,t){return t instanceof ye&&t.status!==null&&t.status>=400&&t.status<500&&t.status!==408&&t.status!==425&&t.status!==429?!1:e<1}const n_={get successor(){return h("ui.common.connection.backend.card_successor")},get"governed-elsewhere"(){return h("ui.common.connection.backend.card_governed")},get"pre-handshake"(){return h("ui.common.connection.backend.card_pre_handshake")},get"credential-refused"(){return h("ui.common.connection.backend.card_credential_refused")},get unpaired(){return h("ui.common.connection.backend.card_unpaired")}};function tI(e,t,n){return e===null?{sentence:Xg(t,n),remedy:!0}:{sentence:n_[e],remedy:ql(e)}}const Id={settings:["desktop","settings"],capabilities:["desktop","capabilities"],providers:["desktop","auth","providers"],commands:["desktop","commands"],accounts:["desktop","auth","accounts"],catalogue:["desktop","models"],credentials:e=>["desktop","credentials",e]},r_=3e4,i_=15e3;function s_(e){return e?.desktop_available===!0}function nI(){const{client:e,provided:t}=Dp();return Xl({enabled:t,queryKey:Id.capabilities,queryFn:async()=>{try{return await Re({op:"capabilities"})}catch(n){throw n instanceof Error?n:new Error(String(n))}},staleTime:6e4,retry:!1,refetchInterval:n=>s_(n.state.data)?r_:i_,refetchIntervalInBackground:!0},e)}function o_(e,t,n=1){return e?e.desktop_available?(e.features?.[t]??0)>=n?"enabled":"below-version":"unpaired":"unknown"}function rI(e,t,n=1){return o_(e,t,n)==="enabled"}function iI(e){return Xl({queryKey:Id.providers,queryFn:()=>Re({op:"providers.list"}).then(t=>t.providers),enabled:e,staleTime:3e4,retry:t_})}const Gn=e=>{const t=e.id;return typeof t=="string"?t:typeof t=="number"?String(t):null};function a_(e,t){const n=new Set((t.removed??[]).map(String)),r=e.filter(a=>{const c=Gn(a);return c===null||!n.has(c)});for(const a of t.upserted??[]){const c=Gn(a);if(c===null){r.push(a);continue}const l=r.findIndex(d=>Gn(d)===c);l===-1?r.push(a):r[l]=a}if(!t.order)return r;const i=new Map;for(const a of r){const c=Gn(a);c!==null&&i.set(c,a)}const s=[];for(const a of t.order){const c=String(a),l=i.get(c);l&&(s.push(l),i.delete(c))}for(const a of r){const c=Gn(a);c!==null&&i.has(c)?(s.push(a),i.delete(c)):c===null&&s.push(a)}return s}const Ks=e=>({revision:Je(e),demand:e.orderDemand}),nn=e=>typeof e=="number"&&Number.isSafeInteger(e)&&e>=0;function On(e,t,n,r,i,s={}){let a=e;const c=t.journal_generation;if(t.reconcile===!0){const p=typeof c=="string"&&c.length>0?c:void 0;return a.orderNeedsReconcile&&a.orderWantedGeneration===p?a.journalMode?a:{...a,journalMode:!0}:{...a,journalMode:!0,orderNeedsReconcile:!0,orderWantedGeneration:p,orderDemand:p!==void 0?{generation:p}:{}}}if(typeof c!="string"||c.length===0)return t.journal_order_state&&t.journal_order_state!=="unsupported"&&!a.journalMode?{...a,journalMode:!0}:a;if(r&&t.journal_order_state==="ready"&&i&&a.orderNeedsReconcile&&a.orderDemand===i.demand&&(a={...a,orderNeedsReconcile:!1,orderWantedGeneration:void 0,orderDemand:void 0}),c!==a.journalGeneration&&!r)return a.orderNeedsReconcile&&a.orderWantedGeneration===c?a:{...a,orderNeedsReconcile:!0,orderWantedGeneration:c,orderDemand:{generation:c}};let l=a.journalMode?a:{...a,journalMode:!0};if(c!==a.journalGeneration&&(l={...a,journalMode:!0,journalGeneration:c,orderRevision:(a.orderRevision??0)+1,journalPositions:new Map,orderNeedsReconcile:a.orderNeedsReconcile,orderWantedGeneration:a.orderWantedGeneration,orderDemand:a.orderDemand},s.peer===!0)){const p=(a.orderRevision??0)+1,g=new Map;for(const y of a.records){const m=y.sourceEntryId??(y.kind==="tool"||y.kind==="supplement"?null:y.id);typeof m=="string"&&m.length>0&&m.length<=128&&g.set(m,p)}l={...l,...g.size>0?{journalBodyOwed:g}:{},journalSourceVoid:void 0}}let d=l.journalPositions??new Map;const u=d,f=(p,g,y)=>{if(!nn(y))return;const m=d.get(p);m&&m.seq>=y||(d===u&&(d=new Map(d)),d.set(p,{entryId:g,seq:y}))};for(const[p,g]of Object.entries(t.journal_ordinals??{}))f(p,p,g);for(const p of n)typeof p.id=="string"&&(f(p.id,p.id,p.journal_seq),p.role==="tool"&&typeof p.tool_call_id=="string"&&f(`tool:${p.tool_call_id}`,p.id,p.journal_seq),typeof p.anchor=="string"&&f(`supplement:${p.anchor}`,p.id,p.journal_seq));return d!==u&&(l={...l,journalPositions:d}),l}function Ao(e,t){if(!e.journalMode||typeof t.id!="string"||!Array.isArray(t.tool_calls))return e;let n=e.journalCallOwners??new Map,r=e.journalCallSlots??new Map;const i=n,s=r;return t.tool_calls.forEach((a,c)=>{!a||typeof a.id!="string"||(n.get(a.id)!==t.id&&(n===i&&(n=new Map(n)),n.set(a.id,t.id)),r.get(a.id)!==c&&(r===s&&(r=new Map(r)),r.set(a.id,c)))}),n===i&&r===s?e:{...e,journalCallOwners:n,journalCallSlots:r}}function Rd(e,t){const n=new Set(e.map(s=>s.id));let r=!1,i;for(let s=0;s<e.length;s++){const a=e[s];if(a.kind==="user"&&a.provisional===!0){i=a;continue}if(a.sourcePrecedes!==void 0){if(a.sourceAdmissionAnchor!==void 0){const{sourceAdmissionAnchor:c,...l}=a;e[s]=l,r=!0}i=e[s];continue}!t(a)&&i&&(a.sourceAdmissionAnchor===void 0||!n.has(a.sourceAdmissionAnchor))&&(e[s]={...a,sourceAdmissionAnchor:i.id},r=!0),i=e[s]}return r}function Td(e,t,n,r,i){const s=[],a=new Set;let c=e,l;for(;c!==void 0;){if(i.has(c.id)){l=i.get(c.id);break}if(n(c)){l=r(c);break}if(c.kind==="user"&&c.provisional===!0||a.has(c.id))break;a.add(c.id),s.push(c.id),c=c.sourceAdmissionAnchor?t.get(c.sourceAdmissionAnchor):void 0}for(const d of s)i.set(d,l);return l}const c_=Number.MAX_SAFE_INTEGER;function l_(e,t){const n=new Map,r=new Map,i=new Map;for(const s of e){if(s.sourcePrecedes===void 0)continue;const a=t(s);if(a!==void 0)r.set(s.sourcePrecedes,a);else{const c=r.get(s.sourcePrecedes);c!==void 0&&n.set(s.id,{seq:c,slot:c_})}}for(let s=e.length-1;s>=0;s--){const a=e[s];if(a.sourcePrecedes===void 0)continue;const c=t(a);if(c!==void 0)i.set(a.sourcePrecedes,c);else if(!n.has(a.id)){const l=i.get(a.sourcePrecedes);l!==void 0&&n.set(a.id,{seq:l,slot:-1})}}return n}function Cd(e,t){return{floor:d_(e,t),position:new Map(e.map((n,r)=>[n.id,r])),page:l_(e,t)}}function Ad(e,t,n,r){if(r===void 0||e.sourcePrecedes===void 0)return;const i=r.page.get(e.id);if(i!==void 0)return i;const s=new Set;let a=1,c=t.get(e.sourcePrecedes);for(;c!==void 0&&!s.has(c.id);){s.add(c.id);const l=n(c);if(l!==void 0)return{seq:l,slot:-a};const d=r.page.get(c.id);if(d!==void 0)return{seq:d.seq,slot:d.slot-a};a+=1,c=c.sourcePrecedes?t.get(c.sourcePrecedes):void 0}return r.floor===void 0?void 0:{seq:r.floor,slot:-a}}function Od(e,t,n){if(n===void 0||e.sourcePrecedes===void 0)return;const{position:r}=n,i=new Set;let s=1,a=t.get(e.sourcePrecedes);for(;a!==void 0&&!i.has(a.id);){if(a.sourcePrecedes===void 0){const c=r.get(a.id);return c===void 0?void 0:{slot:c,depth:s}}i.add(a.id),s+=1,a=t.get(a.sourcePrecedes)}}function d_(e,t){let n;for(const r of e){if(r.sourcePrecedes!==void 0)continue;const i=t(r);i!==void 0&&(n===void 0||i<n)&&(n=i)}return n}function Pd(e,t){const n=new Map;return r=>{if(!r)return;const i=t(r);if(i===void 0)return;const s=[],a=new Set;let c=r,l=!0;for(;c;){if(n.has(c.id)){l=n.get(c.id)===!0;break}if(a.has(c.id)||t(c)===void 0){l=!1;break}a.add(c.id),s.push(c.id),c=c.sourceAdmissionAnchor===void 0?void 0:e.get(c.sourceAdmissionAnchor)}for(const d of s)n.set(d,l);return l?i:void 0}}function fi(e,t){const n=e.journalCallOwners,r=e.journalCallSlots;if(!n||!r)return t;const i=new Map;t.forEach((a,c)=>{if(a.kind!=="tool")return;const l=n.get(a.toolCallId);if(l===void 0||!r.has(a.toolCallId))return;const d=i.get(l);d?d.push(c):i.set(l,[c])});let s=t;for(const a of i.values()){if(a.length<2)continue;const c=a.map(l=>t[l]).sort((l,d)=>(r.get(l.toolCallId)??0)-(r.get(d.toolCallId)??0));c.every((l,d)=>l===t[a[d]])||(s===t&&(s=t.slice()),a.forEach((l,d)=>{s[l]=c[d]}))}return s}function jd(e,t){if(!e.journalMode)return t;if(e.journalPeerSource===!0)return u_(e,t);const n=e.journalGeneration,r=e.journalPositions;let i=!1,s=!1;const a=t.map(m=>{m.sourcePrecedes!==void 0&&(s=!0);let _=[r?.get(m.sourceEntryId??m.id),r?.get(m.id)].filter(A=>A!==void 0).sort((A,$)=>$.seq-A.seq)[0];if(m.journalGeneration===n&&nn(m.journalSeq)&&(!_||m.journalSeq>_.seq)&&(_={entryId:m.sourceEntryId??m.id,seq:m.journalSeq}),!_||!n||!(m.kind==="user"&&(m.provisional===!0||m.local===!0))&&m.sourceEntryId===_.entryId&&m.journalSeq===_.seq&&m.journalGeneration===n)return m;i=!0;let E={...m,sourceEntryId:_.entryId,journalSeq:_.seq,journalGeneration:n};if(E.kind==="user"){const{provisional:A,local:$,...O}=E;E=O}return E});Rd(a,m=>m.journalGeneration===n&&nn(m.journalSeq))&&(i=!0);const l=new Map,d=new Map(a.map(m=>[m.id,m])),u=Pd(d,m=>m!==void 0&&m.journalGeneration===n&&nn(m.journalSeq)?m.journalSeq:void 0),f=m=>u(m)!==void 0,p=s?Cd(a,u):void 0,g=(m,b)=>{const _=u(m);if(m.kind==="user"&&m.provisional===!0&&_===void 0)return[1,0,0,0,b];const k=m.kind==="supplement"?m.anchor:m.kind==="tool"?e.journalCallOwners?.get(m.toolCallId)??e.argsByCall.get(m.toolCallId)?.anchorId:void 0,E=typeof k=="string"?u(d.get(k)):void 0,A=E===void 0&&_===void 0?Ad(m,d,u,p):void 0,$=_===void 0&&A===void 0?Td(m,d,f,u,l):void 0,O=E??_??A?.seq??$;if(O===void 0){const C=Od(m,d,p);return[1,C?.slot??b,C?-C.depth:0,0,b]}return[0,O,E!==void 0?1:_!==void 0?0:A!==void 0?A.slot:2,_??Number.MAX_SAFE_INTEGER,b]},y=a.map((m,b)=>({record:m,index:b,rank:g(m,b)}));return y.sort((m,b)=>{for(let _=0;_<m.rank.length;_++){const k=m.rank[_]-b.rank[_];if(k)return k}return 0}),!i&&y.every((m,b)=>m.index===b)?fi(e,t):fi(e,y.map(m=>m.record))}function u_(e,t){const n=e.journalGeneration,r=e.journalPositions,i=new Map;let s=!1;for(const _ of t){_.sourcePrecedes!==void 0&&(s=!0);let E=[r?.get(_.sourceEntryId??_.id),r?.get(_.id)].filter(A=>A!==void 0).sort((A,$)=>$.seq-A.seq)[0];_.journalGeneration===n&&nn(_.journalSeq)&&(!E||_.journalSeq>E.seq)&&(E={entryId:_.sourceEntryId??_.id,seq:_.journalSeq}),E&&i.set(_.id,E)}const a=_=>_===void 0?void 0:i.get(_.id)??r?.get(_.sourceEntryId??_.id)??r?.get(_.id);let c=!1;const l=t.slice();Rd(l,_=>_.journalGeneration===n&&nn(_.journalSeq))&&(c=!0);const u=new Map,f=new Map(l.map(_=>[_.id,_])),p=Pd(f,_=>a(_)?.seq),g=_=>p(_)!==void 0,y=s?Cd(l,p):void 0,m=(_,k)=>{const E=p(_);if(_.kind==="user"&&_.provisional===!0&&E===void 0)return[1,0,0,0,k];const A=_.kind==="supplement"?_.anchor:_.kind==="tool"?e.journalCallOwners?.get(_.toolCallId)??e.argsByCall.get(_.toolCallId)?.anchorId:void 0,$=typeof A=="string"?p(f.get(A)):void 0,O=$===void 0&&E===void 0?Ad(_,f,p,y):void 0,C=E===void 0&&O===void 0?Td(_,f,g,p,u):void 0,x=$??E??O?.seq??C;if(x===void 0){const N=Od(_,f,y);return[1,N?.slot??k,N?-N.depth:0,0,k]}return[0,x,$!==void 0?1:E!==void 0?0:O!==void 0?O.slot:2,E??Number.MAX_SAFE_INTEGER,k]},b=l.map((_,k)=>({record:_,index:k,rank:m(_,k)}));return b.sort((_,k)=>{for(let E=0;E<_.rank.length;E++){const A=_.rank[E]-k.rank[E];if(A)return A}return 0}),!c&&b.every((_,k)=>_.index===k)?fi(e,t):fi(e,b.map(_=>_.record))}function ut(e){const t=e.records.filter(i=>i.kind==="user"&&i.provisional===!0),n=e.records.filter(i=>i.journalGeneration!==e.journalGeneration||!nn(i.journalSeq)),r=[...t,...n].map(i=>i.sourceEntryId??(i.kind==="tool"||i.kind==="supplement"?null:i.id));if(r.push(...Oo(e)),e.journalPositions?.has(e.oldestId??"")||r.push(e.oldestId),e.journalSourceVoid?.size)for(let i=r.length-1;i>=0;i--){const s=r[i];typeof s=="string"&&e.journalSourceVoid.has(s)&&r.splice(i,1)}return[...new Set(r.filter(i=>typeof i=="string"&&i.length>0&&i.length<=128))]}function Oo(e){if(e.journalPeerSource!==!0||!e.journalBodyOwed)return[];const t=new Set;for(const r of e.records){const i=r.sourceEntryId??(r.kind==="tool"||r.kind==="supplement"?null:r.id);typeof i=="string"&&i.length>0&&i.length<=128&&t.add(i)}const n=[];for(const r of e.journalBodyOwed.keys())r.length<1||r.length>128||t.has(r)&&(e.journalSourceVoid?.has(r)||n.push(r));return n}function Md(e,t){const n=e.journalPositions;return ut(e).filter(r=>!n?.has(r)&&!t?.has(r))}const Je=e=>e.orderRevision??0;async function f_(e){const t=new Map,n=c=>{let l=t.get(c);return l||(l=new Set,t.set(c,l)),l},r=(c,l)=>l==="payload"?Oo(c):l==="lookup"?Md(c):ut(c);let i=e.getTranscript().journalGeneration,s=0,a=0;for(;;){if(!e.isCurrent())return{kind:"stale"};const c=e.getTranscript(),l=Ks(c),d=l.revision,u=e.sweep?.(c,n);if(u?.kind==="none")return{kind:"complete",transcript:c};const f=u?.kind??"authority",p=tm(r(c,f).filter(b=>!n(f).has(b)),u?.path??e.lookupPath,u?.query??new URLSearchParams({journal_order:"1"})),g=await e.read(p,f);if(!e.isCurrent()||Je(e.getTranscript())!==d)return{kind:"stale"};if(e.commit(g,d,l),!e.isCurrent())return{kind:"stale"};const y=e.getTranscript(),m=e.page(g);if(m.journal_order_state==="ready"&&m.journal_generation===y.journalGeneration){m.journal_generation!==i&&(t.clear(),i=m.journal_generation);for(const k of p)n(f).add(k);if(y.orderNeedsReconcile){if(y.orderDemand===l.demand||s===1)return{kind:"waiting"};s++,t.clear();continue}if(f==="payload"){const k=(m.source_retry_ids??[]).filter(E=>typeof E=="string"&&E.length>0&&E.length<=128);if(k.length>0&&p.length>1&&a===0){a++;for(const E of k)n("payload").delete(E);continue}}const b=e.sweep?.(y,n);if(b?.kind==="none")return{kind:"complete",transcript:y};const _=b?.kind??"authority";if(r(y,_).some(k=>!n(_).has(k)))continue;return{kind:"complete",transcript:y}}if(!y.orderNeedsReconcile||y.orderDemand===l.demand||s===1)return{kind:"waiting"};s++,t.clear()}}function it(e){const t=e.payload,n=t?.tool_call_id;if(t?.role==="tool"&&typeof n=="string"&&n)return`tool:${n}`;const i=(t?.details??{}).anchor;return t?.custom_type==="completion_attention"&&typeof i=="string"&&i?i:e.id}function as(e){return typeof e!="number"||!Number.isFinite(e)?null:Math.max(0,Math.trunc(e))}function Cc(e){return typeof e!="number"||!Number.isFinite(e)||e<0?null:e}function sI(e){if(!e||e.runs_state!=="ready")return null;const t=e.runs;if(!t||t.length===0)return null;const n=new Map;for(const s of t){if(!s.settled||typeof s.run_key!="string"||s.run_key.length===0)continue;const a=as(s.action_count);if(a===null)continue;const c={actions:a,workedSeconds:Cc(s.worked_seconds),failed:as(s.failed_count)??0,complete:s.complete!==!1,openingUserId:typeof s.opening_user_id=="string"&&s.opening_user_id.length>0?s.opening_user_id:null,closingAnswerId:typeof s.closing_answer_id=="string"&&s.closing_answer_id.length>0?s.closing_answer_id:null,crossSessionActions:as(s.cross_session_action_count),crossSessionWorkedSeconds:Cc(s.cross_session_worked_seconds)};n.set(s.run_key,c),c.openingUserId!==null&&n.set(c.openingUserId,c),c.closingAnswerId!==null&&n.set(c.closingAnswerId,c)}if(n.size===0)return null;const r=new Set;for(const s of e.entries)r.add(it(s));const i=e.entries[e.entries.length-1];return{runs:n,page:{ids:r,newestKey:i?it(i):null}}}function p_(e){if(!e||e.runs_state!=="ready"||e.head_cut===!0)return null;const t=e.runs,n=e.entries[0];if(!n||!t||t.length===0||!t.find(s=>s.opening_user_id===n.id))return null;const i=Math.round((n.ts??0)*1e3);return i>0?{id:n.id,tsMs:i}:null}function h_(e,t,n){const r=p_(e),i=e?.entries;if(r===null||!i||i.length===0)return!1;const s=Math.round((i[i.length-1].ts??0)*1e3);if(!(s>r.tsMs))return!1;for(const[a,c]of t)if(!n.has(a)&&(c===null||!(c>r.tsMs)||!(c<s)))return!1;return!0}const Po=new Set,Wt="\\t\\n\\v\\f\\r\\u001C-\\u001F \\u0085\\u00A0\\u1680\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000",jo=new RegExp(`[${Wt}]`),m_=new RegExp(`[${Wt}]+`),oI=new RegExp(`[${Wt}]+`,"g"),g_=new RegExp(`^[${Wt}]+|[${Wt}]+$`,"g"),__=new RegExp(`^[${Wt}]+`),aI=new RegExp(`[^${Wt}]`);function mt(e){return e.replace(g_,"")}function yr(e){return e.replace(__,"")}function Dd(e,t){return t===0||jo.test(e[t-1])}function Nd(e){const t=[];for(let n=0;n<e.length;n++)e[n]==="/"&&Dd(e,n)&&t.push(n);return t}function Mo(e,t){let n=t===null||t>e.length?e.length:t;n<0&&(n=0);const r=e.lastIndexOf(`
2
2
  `,n-1)+1,i=e.indexOf(`
3
3
  `,n),s=i===-1?e.length:i;let a=e.slice(r,s);return a.endsWith("\r")&&(a=a.slice(0,-1)),{line:a,lineStart:r,column:n-r}}function y_(e,t){if(t.size===0)return null;for(const n of Nd(e)){const r=e.slice(n+1),i=r.indexOf(" ");if(i!==-1&&t.has(r.slice(0,i).toLowerCase()))return n}return null}function Do(e,t,n){const r=y_(e,n);let i=null;for(const s of Nd(e)){if(s===r)return t>s?s:i;s<=t&&(i=s)}return i}function b_(e,t=null,n=Po){const{line:r,lineStart:i,column:s}=Mo(e,t),a=Do(r,s,n);if(a===null)return null;let c=a+1;for(;c<r.length&&!jo.test(r[c]);)c++;return s>c?null:{start:i+a,query:r.slice(a+1,c),end:i+c}}function cI(e,t=null,n=Po){const{line:r,lineStart:i,column:s}=Mo(e,t),a=Do(r,s,n);return a===null?null:{start:i+a,end:i+r.length}}function v_(e,t,n=null,r=Po){const{line:i,lineStart:s,column:a}=Mo(e,n),c=r.size>0?r:new Set(t.map(g=>g.toLowerCase())),l=Do(i,a,c);if(l===null)return null;const d=i.slice(l+1),u=d.indexOf(" ");if(u===-1)return null;const f=d.slice(0,u);if(!t.some(g=>g.toLowerCase()===f.toLowerCase()))return null;const p=l+1+f.length;return a<=p?null:{value:d.slice(u+1),start:s+p+1,end:s+i.length,tokenStart:s+l}}function Ac(e,t){return mt(e.slice(0,t))===""}function lI(e,t,n,r){const i=v_(e,r,t,n);if(i!==null&&Ac(e,i.tokenStart))return"argument";const s=b_(e,t,n);return s!==null&&Ac(e,s.start)?"command":null}function dI(e,t,n,r){let i=t,s=n;const a=c=>c>=0&&c<e.length&&`
4
4
  `.includes(e[c]);return r===""?i>0&&a(i-1)?i-=1:a(s)&&(s+=1):i===0&&a(s)&&(s+=1),{text:`${e.slice(0,i)}${r}${e.slice(s)}`,caret:i+r.length}}const w_=1e3,S_=900,k_=40,Ld=3;function E_(e,t){let n=0,r=-2,i=0;for(const s of e){const a=t.indexOf(s,i);if(a<0)return 0;n+=a===r+1?2:1,r=a,i=a+1}return n<=0?0:Math.max(1,Math.min(k_,n))}function $d(e,t){const n=e.toLowerCase(),r=t.toLowerCase();return n?n===r?w_:r.startsWith(n)?S_:E_(n,r):0}function x_(e){const n=mt(e).split(m_).pop()??"";return n.startsWith("/")?n.slice(1):n}function I_(e,t){const n=x_(e),r=[];return t.forEach((i,s)=>{let a=0,c=i.name;for(const l of[i.name,...i.aliases]){const d=$d(n,l);d>a&&(a=d,c=l)}a>0&&r.push({score:a,index:s,name:c,command:i})}),r.sort((i,s)=>s.score-i.score||i.index-s.index),r.map(i=>({name:i.name,command:i.command}))}function uI(e,t){if(!e)return t.map(s=>({name:s.name,command:s}));const n=I_(`/${e}`,t);if(e.length>=Ld)return n;const r=e.toLowerCase(),i=n.filter(({name:s})=>s.toLowerCase().startsWith(r));return i.length>0?i:n}function Oc(e,t){if(!e)return t.map(r=>({name:r.name,choice:r}));const n=[];return t.forEach((r,i)=>{const s=Math.max(0,...[r.name,...r.aliases??[]].map(a=>$d(e,a)));s>0&&n.push({score:s,order:i,choice:r})}),n.sort((r,i)=>i.score-r.score||r.order-i.order),n.map(r=>({name:r.choice.name,choice:r.choice}))}const Pc=/^-+/;function fI(e,t,n,r,i){if(i)return!0;const s=mt(e).toLowerCase(),a=mt(t).toLowerCase();return s===a||s.length>0&&s.replace(Pc,"")===a.replace(Pc,"")?!0:!r&&n<=1}const R_=new RegExp("\\p{Ll}","u");function Ud(e){for(const t of e)if(R_.test(t))return!0;return!1}function pI(e,t,n){if(n){if(!e)return t.map(a=>({name:a.name,choice:a}));const r=Oc(e,t);if(e.length>=Ld)return r;const i=e.toLowerCase(),s=r.filter(a=>a.name.toLowerCase().startsWith(i));return s.length>0?s:r}return Ud(e)?Oc(e,t).filter(r=>r.name.startsWith(e)):[]}const T_=/<skill name="([^"]*)" invocation="([^"]*)">/,C_=/[A-Za-z0-9]/,A_=/[A-Za-z0-9._-]/,O_=/[._-]/;function P_(e,t){if(t>=e.length||!C_.test(e[t]))return t;let n=t+1;for(;n<e.length&&A_.test(e[n]);)n++;return n}function j_(e){const t=[];let n=0;for(;n<e.length;){if(e[n]!=="$"||!Dd(e,n)){n+=1;continue}const r=P_(e,n+1);r>n+1&&t.push({start:n,end:r,name:e.slice(n+1,r)}),n+=Math.max(r-n,1)}return t}function M_(e,t,n,r,i,s){let a=n;for(;;){const c=e.slice(t+1,a);if(r.has(c))return{end:a,name:c};if(s||Ud(c)){const l=i.get(c.toLowerCase());if(l!==void 0)return{end:a,name:l}}if(a>t+2&&O_.test(e[a-1])){a-=1;continue}return null}}function D_(e,t,n={}){const r=new Set(t),i=new Map;for(const l of t)i.has(l.toLowerCase())||i.set(l.toLowerCase(),l);const s=n.skipSpans??[],a=[],c=new Set;for(const l of j_(e)){if(s.some(([f,p])=>f<=l.start&&l.start<p))continue;const d=yr(e.slice(0,l.start))==="",u=M_(e,l.start,l.end,r,i,d);u===null||c.has(u.name)||(c.add(u.name),a.push({start:l.start,end:u.end,text:e.slice(l.start,u.end),name:u.name,leading:d}))}return a}const Sn="<operator-skills>",pi="</operator-skills>",Yn=`
@@ -61,4 +61,4 @@ ${e}`)}function ho(e,t){return e.sessionId===t||e.key===t||e.key===`send:${t}`}f
61
61
  * LICENSE.md file in the root directory of this source tree.
62
62
  *
63
63
  * @license MIT
64
- */function Er(){return Er=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Er.apply(this,arguments)}const oa=S.createContext(null),wk=S.createContext(null),un=S.createContext(null),Oi=S.createContext(null),Tt=S.createContext({outlet:null,matches:[],isDataRoute:!1}),Ef=S.createContext(null);function GT(e,t){let{relative:n}=t===void 0?{}:t;jn()||ke(!1);let{basename:r,navigator:i}=S.useContext(un),{hash:s,pathname:a,search:c}=Ek(e,{relative:n}),l=a;return r!=="/"&&(l=a==="/"?r:$t([r,a])),i.createHref({pathname:l,search:c,hash:s})}function jn(){return S.useContext(Oi)!=null}function Pi(){return jn()||ke(!1),S.useContext(Oi).location}function xf(e){S.useContext(un).static||S.useLayoutEffect(e)}function Sk(){let{isDataRoute:e}=S.useContext(Tt);return e?Nk():kk()}function kk(){jn()||ke(!1);let e=S.useContext(oa),{basename:t,future:n,navigator:r}=S.useContext(un),{matches:i}=S.useContext(Tt),{pathname:s}=Pi(),a=JSON.stringify(ia(i,n.v7_relativeSplatPath)),c=S.useRef(!1);return xf(()=>{c.current=!0}),S.useCallback(function(d,u){if(u===void 0&&(u={}),!c.current)return;if(typeof d=="number"){r.go(d);return}let f=sa(d,JSON.parse(a),s,u.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:$t([t,f.pathname])),(u.replace?r.replace:r.push)(f,u.state,u)},[t,r,a,s,e])}function HT(){let{matches:e}=S.useContext(Tt),t=e[e.length-1];return t?t.params:{}}function Ek(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=S.useContext(un),{matches:i}=S.useContext(Tt),{pathname:s}=Pi(),a=JSON.stringify(ia(i,r.v7_relativeSplatPath));return S.useMemo(()=>sa(e,JSON.parse(a),s,n==="path"),[e,a,s,n])}function xk(e,t){return Ik(e,t)}function Ik(e,t,n,r){jn()||ke(!1);let{navigator:i,static:s}=S.useContext(un),{matches:a}=S.useContext(Tt),c=a[a.length-1],l=c?c.params:{};c&&c.pathname;let d=c?c.pathnameBase:"/";c&&c.route;let u=Pi(),f;if(t){var p;let _=typeof t=="string"?dn(t):t;d==="/"||(p=_.pathname)!=null&&p.startsWith(d)||ke(!1),f=_}else f=u;let g=f.pathname||"/",y=g;if(d!=="/"){let _=d.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(_.length).join("/")}let m=XS(e,{pathname:y}),b=Ok(m&&m.map(_=>Object.assign({},_,{params:Object.assign({},l,_.params),pathname:$t([d,i.encodeLocation?i.encodeLocation(_.pathname).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?d:$t([d,i.encodeLocation?i.encodeLocation(_.pathnameBase).pathname:_.pathnameBase])})),a,n,r);return t&&b?S.createElement(Oi.Provider,{value:{location:Er({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:Nt.Pop}},b):b}function Rk(){let e=Dk(),t=bk(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},t),n?S.createElement("pre",{style:i},n):null,null)}const Tk=S.createElement(Rk,null);class Ck extends S.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?S.createElement(Tt.Provider,{value:this.props.routeContext},S.createElement(Ef.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Ak(e){let{routeContext:t,match:n,children:r}=e,i=S.useContext(oa);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),S.createElement(Tt.Provider,{value:t},r)}function Ok(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,c=(i=n)==null?void 0:i.errors;if(c!=null){let u=a.findIndex(f=>f.route.id&&c?.[f.route.id]!==void 0);u>=0||ke(!1),a=a.slice(0,Math.min(a.length,u+1))}let l=!1,d=-1;if(n&&r&&r.v7_partialHydration)for(let u=0;u<a.length;u++){let f=a[u];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(d=u),f.route.id){let{loaderData:p,errors:g}=n,y=f.route.loader&&p[f.route.id]===void 0&&(!g||g[f.route.id]===void 0);if(f.route.lazy||y){l=!0,d>=0?a=a.slice(0,d+1):a=[a[0]];break}}}return a.reduceRight((u,f,p)=>{let g,y=!1,m=null,b=null;n&&(g=c&&f.route.id?c[f.route.id]:void 0,m=f.route.errorElement||Tk,l&&(d<0&&p===0?(Lk("route-fallback"),y=!0,b=null):d===p&&(y=!0,b=f.route.hydrateFallbackElement||null)));let _=t.concat(a.slice(0,p+1)),k=()=>{let E;return g?E=m:y?E=b:f.route.Component?E=S.createElement(f.route.Component,null):f.route.element?E=f.route.element:E=u,S.createElement(Ak,{match:f,routeContext:{outlet:u,matches:_,isDataRoute:n!=null},children:E})};return n&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?S.createElement(Ck,{location:n.location,revalidation:n.revalidation,component:m,error:g,children:k(),routeContext:{outlet:null,matches:_,isDataRoute:!0}}):k()},null)}var If=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(If||{}),Rf=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Rf||{});function Pk(e){let t=S.useContext(oa);return t||ke(!1),t}function jk(e){let t=S.useContext(wk);return t||ke(!1),t}function Mk(e){let t=S.useContext(Tt);return t||ke(!1),t}function Tf(e){let t=Mk(),n=t.matches[t.matches.length-1];return n.route.id||ke(!1),n.route.id}function Dk(){var e;let t=S.useContext(Ef),n=jk(),r=Tf();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function Nk(){let{router:e}=Pk(If.UseNavigateStable),t=Tf(Rf.UseNavigateStable),n=S.useRef(!1);return xf(()=>{n.current=!0}),S.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,Er({fromRouteId:t},s)))},[e,t])}const jl={};function Lk(e,t,n){jl[e]||(jl[e]=!0)}function WT(e,t){e?.v7_startTransition,e?.v7_relativeSplatPath}function zT(e){let{to:t,replace:n,state:r,relative:i}=e;jn()||ke(!1);let{future:s,static:a}=S.useContext(un),{matches:c}=S.useContext(Tt),{pathname:l}=Pi(),d=Sk(),u=sa(t,ia(c,s.v7_relativeSplatPath),l,i==="path"),f=JSON.stringify(u);return S.useEffect(()=>d(JSON.parse(f),{replace:n,state:r,relative:i}),[d,f,i,n,r]),null}function $k(e){ke(!1)}function ZT(e){let{basename:t="/",children:n=null,location:r,navigationType:i=Nt.Pop,navigator:s,static:a=!1,future:c}=e;jn()&&ke(!1);let l=t.replace(/^\/*/,"/"),d=S.useMemo(()=>({basename:l,navigator:s,static:a,future:Er({v7_relativeSplatPath:!1},c)}),[l,c,s,a]);typeof r=="string"&&(r=dn(r));let{pathname:u="/",search:f="",hash:p="",state:g=null,key:y="default"}=r,m=S.useMemo(()=>{let b=Sf(u,l);return b==null?null:{location:{pathname:b,search:f,hash:p,state:g,key:y},navigationType:i}},[l,u,f,p,g,y,i]);return m==null?null:S.createElement(un.Provider,{value:d},S.createElement(Oi.Provider,{children:n,value:m}))}function KT(e){let{children:t,location:n}=e;return xk(go(t),n)}new Promise(()=>{});function go(e,t){t===void 0&&(t=[]);let n=[];return S.Children.forEach(e,(r,i)=>{if(!S.isValidElement(r))return;let s=[...t,i];if(r.type===S.Fragment){n.push.apply(n,go(r.props.children,s));return}r.type!==$k&&ke(!1),!r.props.index||!r.props.children||ke(!1);let a={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=go(r.props.children,s)),n.push(a)}),n}const ji=260,aa=220,ca=320,Cf=56,la=480,VT=8,da=44,Af=400,Of=1200;function Pf(e){return Math.max(0,Math.min(Of,e-la))}function Ml(e){return Pf(e)>=Af?"docked":"overlay"}function YT({capacity:e,min:t,max:n,drawn:r}){const i=e>=t;return i?{resizable:i,value:Math.min(Math.max(r,t),e),minWidth:t,maxWidth:Math.min(n,e)}:{resizable:i,value:r,minWidth:r,maxWidth:r}}function Uk(e,t=ji,n=da){return Ml(e-jf(t)-n)==="overlay"&&Ml(e-Cf-n)==="docked"}function jf(e){return Number.isNaN(e)?ji:Math.min(ca,Math.max(aa,e))}function Fk(e,t=da){return Math.max(0,Math.min(ca,e-la-t))}function QT(e,t,n=ji,r=!1,i=da){const s=!t&&r&&Uk(e,n,i),a=t||s,c=Fk(e,i);return{mode:a?"strip":"docked",width:a?Cf:Math.min(jf(n),c),collapsed:a,resizable:!a&&c>=aa}}function JT(e){return e.shiftKey||e.altKey||!(e.metaKey||e.ctrlKey)?!1:e.key.toLowerCase()==="b"}const XT=e=>e?"⌘B":"Ctrl+B",Bk=["active","created"],qT={running:"ui.chat.sidebar_view.section.running",today:"ui.chat.sidebar_view.section.today",week:"ui.chat.sidebar_view.section.week",older:"ui.chat.sidebar_view.section.older"},Gk=new Set(["waiting","busy","delegating","approval","answer","wedged"]);function Mi(e){return Gk.has(e.status?.code??"")}const Hk=new Set(["approval","answer"]);function Wk(e){return Hk.has(e.status?.code??"")}const zk=24*60*60*1e3,Zk=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()};function ua(e,t){const n=t==="created"?e.created_at:e.updated_at;return typeof n!="number"||!Number.isFinite(n)||n<=0?null:n*1e3}const Kk="last_user_at";function Vk(e){const t=e[Kk],n=typeof t=="number"&&Number.isFinite(t)&&t>0?t:e.created_at;return typeof n!="number"||!Number.isFinite(n)||n<=0?null:n*1e3}function Yk(e,t,n){if(Mi(e))return"running";const r=ua(e,n);if(r===null)return"older";const i=Zk(t);return r>=i?"today":r>=i-6*zk?"week":"older"}function eC(e,t,n){const r={running:[],today:[],week:[],older:[]};for(const i of e)r[Yk(i,t,n)].push(i);return r}function Qk(e,t,n){const r=ua(e,n);if(r===null)return"";const i=Math.floor(Math.max(0,t-r)/6e4);if(i<1)return"now";if(i<60)return`${i}m`;const s=Math.floor(i/60);if(s<24)return`${s}h`;const a=Math.floor(s/24);if(a<7)return`${a}d`;const c=Math.floor(a/7);return a<365?`${c}w`:`${Math.floor(a/365)}y`}function tC(e,t,n){const r=Qk(e,t,n);if(!r)return"";const i=n==="created"?"created":"last active";if(r==="now")return`${i} just now`;const s={m:"minute",h:"hour",d:"day",w:"week",y:"year"},a=Number.parseInt(r,10),c=s[r.slice(-1)];return`${i} ${a} ${c}${a===1?"":"s"} ago`}const _o=["pinned","running","today","week","older","agents","teams"],nC={pinned:"ui.chat.sidebar_view.section.pinned",running:"ui.chat.sidebar_view.section.running",today:"ui.chat.sidebar_view.section.today",week:"ui.chat.sidebar_view.section.week",older:"ui.chat.sidebar_view.section.older",agents:"ui.chat.sidebar_view.section.agents",teams:"ui.chat.sidebar_view.section.teams"};function rC(e){return e==="agents"||e==="teams"}const xr=8;function Jk(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function iC(e,t){return{...e,[t]:(e[t]??xr)+xr}}function sC(e,t,n,r,i){const s=!(e[n]??r);return{expanded:{...e,[n]:s},caps:!s&&!i?Jk(t,n):t}}function oC(e,t,n,r){return(e||t!=="")&&(r>xr||n.trim()!=="")}const aC="Collapse, then reopen, to restore the compact list";function cC(e){return(e??xr)>xr}const lC=e=>`section-grown-hint-${e}`,Xk=e=>e===1?"Show 1 more":`Show ${e} more`;function dC(e,t){return`${Xk(e)} ${t}`}const bn={hidden:[],order:[..._o],pins:[],groupBy:"section",tagsEnabled:!1,autoTagForks:!0,basis:"active",orderBy:"active-first",loads:0,pinnedAgents:[]},qk=10,Wn=[25,50],eE=50,tE=500,nE=64;function Rn(e){const t=Math.max(0,Math.floor(e));return t===0?qk:t<=Wn.length?Wn[t-1]:Wn[Wn.length-1]+(t-Wn.length)*eE}function uC(e,t){const n=Rn(e+1)-Rn(e),r=Math.max(0,Math.min(n,t));return r===1?"Show 1 more chat":`Show ${r} more chats`}function fC(e,t,n){const r=Rn(t+1)-Rn(t),i=Rn(t),s=Math.min(i+r,e.length);let a=0;for(let l=i;l<s;l+=1)fa(e[l])&&(a+=1);const c=Math.max(0,s-i-a);return c>0?c:Math.max(0,Math.min(r,n))}function fa(e){return Mi(e)}function rE(e){return Wk(e)?0:Mi(e)?1:2}function iE(e,t){return Mi(e)?Vk(e):ua(e,t)}function sE(e,t){return e===null&&t===null?0:e===null?1:t===null?-1:t-e}function pC(e,t,n){const r=e.map((i,s)=>({row:i,index:s,lane:t==="active-first"?rE(i):0,at:iE(i,n)}));return r.sort((i,s)=>i.lane-s.lane||sE(i.at,s.at)||i.index-s.index),r.map(i=>i.row)}function hC(e,t){const{limit:n,currentId:r,searching:i=!1}=t;if(i)return{rows:[...e],lifted:!1,remaining:0};const s=[];let a=Math.max(0,n);for(const d of e){if(a>0){s.push(d),a-=1;continue}fa(d)&&s.push(d)}const c=Math.max(0,e.length-s.length);if(!r)return{rows:s,lifted:!1,remaining:c};const l=e.find(d=>d.session_id===r)??null;return l===null||s.includes(l)?{rows:s,lifted:!1,remaining:c}:{rows:[l,...s],lifted:!0,remaining:c}}function mC(e,t){if(t.searching)return{rows:[...e],lifted:!1,hidden:0,held:e.length};const n=Rn(t.loads),r=[];let i=n;for(const l of e){if(fa(l)){r.push(l);continue}i>0&&(r.push(l),i-=1)}const s=t.currentId,a=s==null?null:e.find(l=>l.session_id===s)??null,c=a!==null&&!r.includes(a);return{rows:c&&a!==null?[a,...r]:r,lifted:c,hidden:e.length-r.length-(c?1:0),held:e.length}}function gC(e){if(e.add<=0)return null;const t=e.add===1?"Show 1 more chat":`Show ${e.add} more chats`;if(e.drawn>=e.total)return{label:t,aria:t};const n=`${e.drawn} of ${e.total}`;return{label:`${t} · ${n}`,aria:`${t} · ${n} shown`}}const oE="mt-4",aE="mt-2";function _C(e){return e?oE:aE}function yC(e,t,n,r){return n?e.toLocaleLowerCase().includes(n.toLocaleLowerCase())||(r??"").toLocaleLowerCase().includes(n.toLocaleLowerCase())||t>0:!0}function bC(e,t){if(t==="section")return null;if(t==="flat")return[{key:"all",label:"",rows:[...e]}];const n=new Map;for(const s of e){const a=s.binding?.team||s.binding?.agent||"",c=a||"ungrouped",l=n.get(c)??{key:c,label:a||"Ungrouped",rows:[]};l.rows.push(s),n.set(c,l)}const r=[...n.values()],i=r.findIndex(s=>s.key==="ungrouped");return i>0&&r.push(...r.splice(i,1)),r}function cE(e,t){return!e.hidden.includes(t)}function Mf(e){return e.order.filter(t=>cE(e,t))}function vC(e,t){const n=e.hidden.includes(t)?e.hidden.filter(r=>r!==t):[...e.hidden,t];return{...e,hidden:n}}function wC(e,t,n){const r=Mf(e),i=r.indexOf(t),s=r[i+n];if(i<0||s===void 0)return e;const a=e.order.indexOf(t),c=e.order.indexOf(s),l=[...e.order];return l[a]=s,l[c]=t,{...e,order:l}}const lE=["running","today","week","older"];function Dl(e){return lE.includes(e)}function SC(e,t,n,r){if(!Dl(t)||r&&!r(t))return!1;const i=Mf(e),s=i.indexOf(t);if(s<0)return!1;const a=i[s+n];return a===void 0||!Dl(a)?!1:r?r(a):!0}const dE=["section","agent","flat"],uE=["active-first","recent"];function kC(e){if(typeof e!="object"||e===null)return bn;const t=e,n=new Set(_o),r=[];if(Array.isArray(t.order))for(const p of t.order)typeof p=="string"&&n.has(p)&&(r.includes(p)||r.push(p));for(const p of _o)r.includes(p)||r.push(p);const i=[];if(Array.isArray(t.hidden))for(const p of t.hidden)typeof p=="string"&&n.has(p)&&(i.includes(p)||i.push(p));const s=dE.includes(t.groupBy)?t.groupBy:bn.groupBy,a=Bk.includes(t.basis)?t.basis:bn.basis,c=uE.includes(t.orderBy)?t.orderBy:bn.orderBy,l=typeof t.loads=="number"&&Number.isFinite(t.loads)&&t.loads>0?Math.min(tE,Math.floor(t.loads)):0,d=[];if(Array.isArray(t.pinnedAgents)){for(const p of t.pinnedAgents)if(typeof p=="string"&&p!==""&&!d.includes(p)){if(d.length>=nE)break;d.push(p)}}const u=[],f=new Set;if(Array.isArray(t.pins))for(const p of t.pins)typeof p=="string"&&p.length!==0&&(f.has(p)||(f.add(p),u.push(p)));return{hidden:i,order:r,groupBy:s,tagsEnabled:typeof t.tagsEnabled=="boolean"?t.tagsEnabled:!1,autoTagForks:typeof t.autoTagForks=="boolean"?t.autoTagForks:bn.autoTagForks,basis:a,orderBy:c,loads:l,pins:u,pinnedAgents:d}}const Df={sort:"recent",order:"asc",group:!0,workingOpen:!1,closedSections:[],kinds:[]},fE=["recent","name","kind","modified","created","size"],pE=["images","video","audio","documents","spreadsheets","presentations","code","archives","other"];function pa(e){const t=e&&typeof e=="object"?e:{};return{sort:fE.includes(t.sort??"")?t.sort:Df.sort,order:t.order==="desc"?"desc":"asc",group:typeof t.group=="boolean"?t.group:!0,workingOpen:t.workingOpen===!0,closedSections:Array.isArray(t.closedSections)?[...new Set(t.closedSections.filter(n=>[Ir,"Highlights","Images","Videos","Sounds","Documents","Spreadsheets","Other"].includes(n)))]:[],kinds:Array.isArray(t.kinds)?[...new Set(t.kinds.filter(n=>pE.includes(n)))]:[]}}const Ir="Attachments";function EC(e,t){const n=r=>{switch(t.sort){case"name":return r.row.name;case"kind":return`${r.row.kind}\0${r.row.name}`;case"modified":return r.modified;case"created":return r.created;case"size":return r.row.document.sizeBytes??null;default:return r.mentioned}};return[...e].sort((r,i)=>{const s=n(r),a=n(i);if(s===null||a===null)return s===a?0:s===null?1:-1;const c=typeof s=="string"&&typeof a=="string"?s.localeCompare(a,void 0,{numeric:!0}):Number(s)-Number(a);return(t.order==="asc"?c:-c)||r.mentioned-i.mentioned})}const hE=e=>{switch(e.row.kind){case"images":return"Images";case"video":return"Videos";case"audio":return"Sounds";case"spreadsheets":return"Spreadsheets";case"documents":case"presentations":case"code":return"Documents";default:return"Other"}};function xC(e,t,n,r,i=[]){const s=e.filter(l=>l.highlighted),a=e.filter(l=>!l.highlighted),c=[];if(i.length&&c.push({id:Ir,label:h("ui.canvas.files.attachments"),items:i,open:n||!r.has(Ir),highlights:!1}),s.length&&c.push({id:"Highlights",label:h("ui.canvas.finder_layout.highlights"),items:s,open:n||!r.has("Highlights"),highlights:!0}),s.length&&a.length&&(c.push({id:"Working files",label:h("ui.canvas.finder_layout.working_files"),items:[],open:t.workingOpen||n,highlights:!1}),!t.workingOpen&&!n))return c;if(!t.group)a.length&&c.push({id:"Files",label:h("ui.canvas.finder_layout.files"),items:a,open:!0,highlights:!1});else for(const l of["Images","Videos","Sounds","Documents","Spreadsheets","Other"]){const d=a.filter(u=>hE(u)===l);d.length&&c.push({id:l,label:l,items:d,open:n||!r.has(l),highlights:!1})}return c}const mE=32,IC=4,Nf=32,Lf=18;function RC(e){return e.height-Nf-(e.kind==="tiles"&&e.section.id===Ir?Lf:0)}function TC(e,t,n){const r=[],i=new Map,s=Math.max(136,t-16),a=Math.max(1,Math.floor((s+4)/140));let c=0;const l=(d,u,f,p,g=1)=>{p.forEach((y,m)=>i.set(y.row.document.id,{band:r.length,column:m})),r.push({section:d,kind:u,height:f,top:c,items:p,cols:g}),c+=f};for(const d of e)if(l(d,"header",mE,[]),!!d.open)if(d.highlights)for(const u of d.items)l(d,"highlight",u.why?68:44,[u]);else if(d.id===Ir){const u=d.items.filter(y=>y.row.media!=="image"),f=d.items.filter(y=>y.row.media==="image");for(const y of u)l(d,"compact",36,[y]);const p=(s-4*(a-1))/a,g=Math.round((p-8)*3/4)+Nf+Lf;for(let y=0;y<f.length;y+=a)l(d,"tiles",g,f.slice(y,y+a),a)}else if(n&&d.id==="Images"){const u=(s-4*(a-1))/a,f=Math.round((u-8)*3/4)+32;for(let p=0;p<d.items.length;p+=a)l(d,"tiles",f,d.items.slice(p,p+a),a)}else if(n&&d.id==="Videos")for(const u of d.items)l(d,"video",Math.min(Math.round((s-8)*9/16),280)+32,[u]);else if(n&&d.id==="Sounds")for(const u of d.items)l(d,"audio",80,[u]);else for(const u of d.items)l(d,"compact",36,[u]);return{bands:r,height:c,columns:a,positions:i}}function CC(e,t,n,r){const i=Math.max(600,n*.75);let s=0,a=e.bands.length;for(;s<a;){const d=s+a>>>1,u=e.bands[d];u.top+u.height<t-i?s=d+1:a=d}const c=new Set;for(let d=s;d<e.bands.length&&e.bands[d].top<=t+n+i;d++)c.add(d);const l=r?e.positions.get(r):null;return l&&c.add(l.band),[...c].sort((d,u)=>d-u)}function AC(e,t,n,r){const i=e.positions.get(t);if(!i)return null;const s=e.bands[i.band],a=e.bands.filter(u=>u.section.id===s.section.id&&u.items.length);if(n==="Home")return a[0]?.items[0]?.row.document.id??null;if(n==="End")return a.at(-1)?.items.at(-1)?.row.document.id??null;if(n==="ArrowLeft"||n==="ArrowRight")return s.items[i.column+(n==="ArrowLeft"?-1:1)]?.row.document.id??null;const c=n==="ArrowUp"||n==="PageUp"?-1:1,l=s.top+(n.startsWith("Page")?r*c:c);let d=i.band+c;for(;d>=0&&d<e.bands.length;d+=c){const u=e.bands[d];if(u.items.length&&!(n.startsWith("Page")&&(c>0?u.top<l:u.top>l)))return u.items[Math.min(i.column,u.items.length-1)].row.document.id}if(n.startsWith("Page")){const u=e.bands.filter(p=>p.items.length),f=c<0?u[0]:u.at(-1);return f?.items[c<0?0:f.items.length-1]?.row.document.id??null}return null}const gE="both",$f="by-turn",yo=[{value:"by-turn",label:"By turn"},{value:"by-response",label:"By response"}];function OC(e){for(const t of yo)if(e===t.value)return t.value;return $f}function PC(e){return yo.find(t=>t.value===e)?.label??yo[0].label}const jC="primary+alt+shift+space",_E=/^f([1-9]|1[0-9]|2[0-4])$/;function yE(e){return _E.test(e)}function bE(e,t){const n=vE(e,t);return t==="mac"?n.join(""):n.join("+")}function vE(e,t){const r=t==="mac"?{primary:"⌘",meta:"⌘",ctrl:"⌃",alt:"⌥",shift:"⇧"}:{primary:"Ctrl",meta:t==="win"?"Win":"Super",ctrl:"Ctrl",alt:"Alt",shift:"Shift"},i={space:"Space",backspace:"Backspace",delete:"Delete",insert:"Insert",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown",up:"Up",down:"Down",left:"Left",right:"Right"};return e.split("+").map(s=>s.trim().toLowerCase()).filter(s=>s.length>0).map(s=>s in r?r[s]:s in i?i[s]:yE(s)||s.length===1?s.toUpperCase():s)}const Di=[{id:"panel.console",get label(){return h("ui.settings.shortcuts.action.open_console")},get category(){return h("ui.settings.shortcuts.category.panels")},defaultChord:"primary+j",scope:"app"},{id:"panel.canvas",get label(){return h("ui.settings.shortcuts.action.open_canvas")},get category(){return h("ui.settings.shortcuts.category.panels")},defaultChord:"primary+shift+c",scope:"app"},{id:"panel.run",get label(){return h("ui.settings.shortcuts.action.open_run_details")},get category(){return h("ui.settings.shortcuts.category.panels")},defaultChord:null,scope:"app"},{id:"panel.ask",get label(){return h("ui.settings.shortcuts.action.open_asks")},get category(){return h("ui.settings.shortcuts.category.panels")},defaultChord:null,scope:"app"},{id:"panel.browser",get label(){return h("ui.settings.shortcuts.action.open_browser")},get category(){return h("ui.settings.shortcuts.category.panels")},defaultChord:null,scope:"app"},{id:"panel.code",get label(){return h("ui.settings.shortcuts.action.open_code_review")},get category(){return h("ui.settings.shortcuts.category.panels")},defaultChord:null,scope:"app"}],wE=new Map(Di.map(e=>[e.id,e])),SE=e=>wE.get(e),kE=new Set(["primary+0","primary+r","primary+shift+r","primary+t","primary+shift+t","primary+l",...[1,2,3,4,5,6,7,8,9].map(e=>`primary+${e}`)]);class EE extends Map{copy;constructor(t){super(),this.copy=new Map(t)}get(t){return this.copy.get(t)?.()}has(t){return this.copy.has(t)}get size(){return this.copy.size}*entries(){for(const[t,n]of this.copy)yield[t,n()]}*keys(){yield*this.copy.keys()}*values(){for(const t of this.copy.values())yield t()}forEach(t,n){for(const[r,i]of this)t.call(n,i,r,this)}[Symbol.iterator](){return this.entries()}}const ha=new EE([["primary+p",()=>h("ui.settings.shortcuts.reserved.palette_anywhere")],["primary+shift+p",()=>h("ui.settings.shortcuts.reserved.palette_commands")],["primary+k",()=>h("ui.settings.shortcuts.reserved.palette_chats")],["primary+n",()=>h("ui.settings.shortcuts.reserved.new_chat")],["primary+b",()=>h("ui.settings.shortcuts.reserved.toggle_sidebar")],["primary+[",()=>h("ui.settings.shortcuts.reserved.browser_back")],["primary+]",()=>h("ui.settings.shortcuts.reserved.browser_forward")],["primary+f",()=>h("ui.settings.shortcuts.reserved.find")],["primary+alt+up",()=>h("ui.settings.shortcuts.reserved.chat_region_up")],["primary+alt+down",()=>h("ui.settings.shortcuts.reserved.chat_region_down")],["primary+shift+a",()=>h("ui.settings.shortcuts.reserved.archive_chat")],["primary+shift+l",()=>h("ui.settings.shortcuts.reserved.chat_tags")],["primary+s",()=>h("ui.settings.shortcuts.reserved.canvas_save")],["primary+o",()=>h("ui.settings.shortcuts.reserved.canvas_open")],["primary+shift+up",()=>h("ui.settings.shortcuts.reserved.chat_move_up")],["primary+shift+down",()=>h("ui.settings.shortcuts.reserved.chat_move_down")],["primary+c",()=>h("ui.settings.shortcuts.reserved.copy")],["primary+x",()=>h("ui.settings.shortcuts.reserved.cut")],["primary+v",()=>h("ui.settings.shortcuts.reserved.paste")],["primary+a",()=>h("ui.settings.shortcuts.reserved.select_all")],["primary+z",()=>h("ui.settings.shortcuts.reserved.undo")],["primary+shift+z",()=>h("ui.settings.shortcuts.reserved.redo")],["primary+y",()=>h("ui.settings.shortcuts.reserved.redo_windows_linux")],["primary+r",()=>h("ui.settings.shortcuts.reserved.browser_reload")],["primary+shift+r",()=>h("ui.settings.shortcuts.reserved.browser_reload_cache")],["primary+t",()=>h("ui.settings.shortcuts.reserved.browser_new_tab")],["primary+shift+t",()=>h("ui.settings.shortcuts.reserved.browser_reopen_tab")],["primary+l",()=>h("ui.settings.shortcuts.reserved.browser_address")],...[1,2,3,4,5,6,7,8,9].map(e=>[`primary+${e}`,e===9?()=>h("ui.settings.shortcuts.reserved.browser_last_tab"):()=>h("ui.settings.shortcuts.reserved.browser_numbered_tab",{digit:e})]),["primary+0",()=>h("ui.settings.shortcuts.reserved.zoom_reset")],["primary+plus",()=>h("ui.settings.shortcuts.reserved.zoom_in")],["primary+=",()=>h("ui.settings.shortcuts.reserved.zoom_in")],["primary+-",()=>h("ui.settings.shortcuts.reserved.zoom_out")],["primary+q",()=>h("ui.settings.shortcuts.reserved.quit")],["primary+w",()=>h("ui.settings.shortcuts.reserved.close")],["primary+m",()=>h("ui.settings.shortcuts.reserved.minimise")]]),xE=["primary","alt","shift"],IE={primary:"primary",meta:"primary",cmd:"primary",command:"primary",super:"primary",ctrl:"primary",control:"primary",alt:"alt",option:"alt",shift:"shift"},RE=new Set(["space","backspace","delete","insert","home","end","pageup","pagedown","up","down","left","right"]),TE=e=>RE.has(e)||/^[a-z0-9]$/.test(e);function ma(e){if(typeof e!="string")return null;const t=e.toLowerCase().split("+").map(s=>s.trim()).filter(s=>s.length>0);if(t.length===0)return null;const n=t[t.length-1];if(!TE(n))return null;const r=new Set;for(const s of t.slice(0,-1)){const a=IE[s];if(a===void 0)return null;r.add(a)}return[...xE.filter(s=>r.has(s)),n].join("+")}const Uf=e=>e.split("+").includes("primary");function Ni(e,t){const n=t?.[e];return n===null?null:typeof n=="string"&&!ha.has(n)?n:SE(e)?.defaultChord??null}function MC(e){const t=new Map;for(const n of Di){const r=Ni(n.id,e);r!==null&&!t.has(r)&&t.set(r,n.id)}return t}const CE=e=>e==="mac"?h("ui.settings.shortcuts.capture.needs_modifier_mac"):h("ui.settings.shortcuts.capture.needs_modifier");function AE(e,t,n,r="linux",i=new Map){const s=e===null?null:ma(e);if(s===null)return h("ui.settings.shortcuts.capture.unbindable");if(!Uf(s))return CE(r);const a=ha.get(s);if(a!==void 0)return a;const c=i.get(s);if(c!==void 0)return h("ui.settings.shortcuts.capture.already_assigned",{label:c});for(const l of Di)if(l.id!==t&&Ni(l.id,n)===s)return h("ui.settings.shortcuts.capture.already_assigned",{label:l.label});return null}function OE(e){if(e===null||typeof e!="object"||Array.isArray(e))return{};const t=e,n=new Set,r={};for(const i of Di){const s=t[i.id];if(s===null){r[i.id]=null;continue}const a=typeof s=="string"?ma(s):null,c=a!==null&&kE.has(a),l=a!==null&&Uf(a)&&(c||!ha.has(a)&&!n.has(a))?a:null;l!==null&&(r[i.id]=l);const d=Ni(i.id,r);d!==null&&n.add(d)}return r}function DC(e,t,n){const r=Ni(e,t);return r===null?null:Ff(r,n)}function Ff(e,t){return bE(e,t)}function NC(e,t){const n=e.split("+"),r=n[n.length-1],i=n.slice(0,-1).map(s=>s==="primary"?t==="mac"?"Meta":"Control":s==="shift"?"Shift":s==="alt"?"Alt":s);return{glyph:Ff(e,t),aria:[...i,r.length===1?r.toUpperCase():r].join("+")}}const Nl=64,bo=["canvas","run","browser","console","code"],PE={canvas:"isCanvasOpen",run:"isRunPanelOpen",browser:"isBrowserPaneOpen",console:"isConsolePaneOpen",code:"isCodeReviewPaneOpen"};function Bf(e){return typeof e=="string"&&bo.includes(e)}function ga(e){return e.startsWith("draft:")}function jr(e,t){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(r[0]===t)return r[1]}}function _a(e){return e.length>Nl?e.slice(e.length-Nl):e}function Gf(e,t,n){return _a([...e.filter(([r])=>r!==t),[t,n]])}function jE(e,t,n){return jr(e,t)!==n?e:e.filter(([r])=>r!==t)}function ME(e,t){return jr(e,t)===void 0?e:e.filter(([n])=>n!==t)}function DE(e,t,n){const r=jr(e,t);return r===void 0?e:_a([...e.filter(([i])=>i!==t&&i!==n),[n,r]])}const Ll=Object.freeze({isCanvasOpen:!1,isRunPanelOpen:!1,isBrowserPaneOpen:!1,isConsolePaneOpen:!1,isCodeReviewPaneOpen:!1});function $l(e,t,n){if(n||typeof t!="string")return Ll;const r=jr(e,t);return r===void 0?Ll:{isCanvasOpen:r==="canvas",isRunPanelOpen:r==="run",isBrowserPaneOpen:r==="browser",isConsolePaneOpen:r==="console",isCodeReviewPaneOpen:r==="code"}}function NE(e){if(!Array.isArray(e))return[];const t=new Map;for(const n of e){if(!Array.isArray(n)||n.length!==2)continue;const[r,i]=n;typeof r!="string"||r===""||ga(r)||Bf(i)&&(t.delete(r),t.set(r,i))}return _a([...t.entries()])}function LC(e){const t=new Set(Object.keys(e.forgotten));for(const[n,r]of Object.entries(e.archiveFacts))r?.archived===!0&&r.answered===!0&&t.add(n);return t}function Ul(e){return PE[e]}const LE={canvas:"isCanvasOpen",run:"isRunPanelOpen",browser:"isBrowserPaneOpen",console:"isConsolePaneOpen",code:"isCodeReviewPaneOpen"},Mr=e=>e.isCanvasOpen?"canvas":e.isRunPanelOpen?"run":e.isBrowserPaneOpen?"browser":e.isConsolePaneOpen?"console":e.isCodeReviewPaneOpen?"code":e.isAskDrawerOpen?"ask":null,Li=(e,t)=>e==="ask"?t.askDrawerScope==="fleet"||t.rightSlotRoute.mounted&&t.rightSlotRoute.session:t.rightSlotRoute.mounted,$E=e=>{const t=Mr(e);return t===null||t==="ask"?null:LE[t]},Dt=e=>({isRunPanelOpen:e==="isRunPanelOpen",isCanvasOpen:e==="isCanvasOpen",isBrowserPaneOpen:e==="isBrowserPaneOpen",isConsolePaneOpen:e==="isConsolePaneOpen",isCodeReviewPaneOpen:e==="isCodeReviewPaneOpen",isAskDrawerOpen:e==="isAskDrawerOpen",askDrawerEvictedPane:null}),Yt=(e,t)=>{const n=e.rightSlotKey;return typeof n!="string"?{}:{rightSlotMemory:Gf(e.rightSlotMemory,n,t)}},zn=(e,t)=>{const n=e.rightSlotKey;if(typeof n!="string")return{};const r=jE(e.rightSlotMemory,n,t);return r===e.rightSlotMemory?{}:{rightSlotMemory:r}},UE=e=>{const t=e.rightSlotKey;if(typeof t!="string")return{};const n=ME(e.rightSlotMemory,t);return n===e.rightSlotMemory?{}:{rightSlotMemory:n}},FE=Object.freeze({mounted:!1,session:!1}),Hf=Object.freeze([]);function $C(e,t){const n=Mr(t);if(n===null||!Li(n,t))return 0;let r;switch(n){case"canvas":case"ask":r=Zn(Af,t.rightSlotWidth);break;case"run":r=Zn(Bl,t.rightSlotWidth);break;case"browser":r=Zn(zE,t.rightSlotWidth);break;case"console":r=Zn(ZE,t.rightSlotWidth);break;case"code":r=Zn(Bl,t.rightSlotWidth);break}return e<=0?r:n==="canvas"||n==="ask"?Math.min(r,Pf(e)):Math.min(r,Math.max(0,e-la))}function Zn(e,t){return Math.min(Of,Math.max(e,t||BE))}function UC(e){const t=Mr(e);return t!==null&&Li(t,e)}function FC(e){const t=Mr(e);return t!==null&&Li(t,e)?t:null}function BC(e){const t=Mr(e);return(t==="canvas"||t==="ask")&&Li(t,e)}const BE=640,Fl=ji,GE=20,HE=4,WE=20,Bl=320,zE=480,ZE=480,KE=5e3,GC=(e,t)=>e.some(n=>n.surface===t),HC=(e,t=Date.now())=>e.some(n=>t-n.at<KE),VE=[],YE=4,QE=["chatMeasureWidth"],WC=Cr()(xi((e,t)=>({finderFiles:Df,setFinderFiles:n=>e({finderFiles:pa({...t().finderFiles,...n})}),isCommandPaletteOpen:!1,commandPaletteQuery:"",isSidebarCollapsed:!1,sidebarOverflowExpanded:!1,showAgentReasoning:!1,transcriptDisplayMode:$f,themeName:ep,rightSlotWidth:0,chatSidebarWidth:Fl,chatSidebarRegions:gE,chatSidebarView:bn,chatSidebarListHeight:null,chatSidebarOrder:"entities-first",dismissedBuiltinOfferSignature:"",isCanvasOpen:!1,isRunPanelOpen:!1,isBrowserPaneOpen:!1,isConsolePaneOpen:!1,isCodeReviewPaneOpen:!1,rightSlotKey:void 0,rightSlotMemory:Hf,rightSlotLegacySeed:null,isAskDrawerOpen:!1,askDrawerScope:"session",askDrawerEvictedPane:null,askOpenIntent:null,rightSlotRoute:FE,consoleOpenIntent:null,consoleLiveSurface:null,runPanelReveal:null,codeReviewReveal:null,browserPaneScope:"conversation",consoleActiveSurface:null,consoleUnseen:VE,isCreateAgentDialogOpen:!1,mentionRecents:null,profileRecents:{agent:[],team:[]},conversationRecents:[],shortcutBindings:{},openCreateAgentDialog:()=>{e({isCreateAgentDialogOpen:!0})},closeCreateAgentDialog:()=>{e({isCreateAgentDialogOpen:!1})},openCommandPalette:()=>{e({isCommandPaletteOpen:!0})},closeCommandPalette:()=>{e({isCommandPaletteOpen:!1,commandPaletteQuery:""})},toggleCommandPalette:(n="")=>{e(r=>({isCommandPaletteOpen:!r.isCommandPaletteOpen,commandPaletteQuery:r.isCommandPaletteOpen?r.commandPaletteQuery:n}))},setCommandPaletteQuery:n=>{e({commandPaletteQuery:n})},toggleSidebar:()=>{e(n=>({isSidebarCollapsed:!n.isSidebarCollapsed}))},setSidebarOverflowExpanded:n=>{e({sidebarOverflowExpanded:n})},setSidebarCollapsed:n=>{e({isSidebarCollapsed:n})},setShowAgentReasoning:n=>{e({showAgentReasoning:n})},setTranscriptDisplayMode:n=>{e({transcriptDisplayMode:n})},setTheme:n=>{e({themeName:n})},setCanvasOpen:n=>{e(r=>n?{...Dt("isCanvasOpen"),...Yt(r,"canvas")}:{isCanvasOpen:!1,...zn(r,"canvas")})},setRunPanelOpen:n=>{e(r=>n?{...Dt("isRunPanelOpen"),...Yt(r,"run")}:{isRunPanelOpen:!1,...zn(r,"run")})},setBrowserPaneOpen:n=>{e(r=>n?{...Dt("isBrowserPaneOpen"),...Yt(r,"browser")}:{isBrowserPaneOpen:!1,...zn(r,"browser")})},setConsolePaneOpen:n=>{e(r=>n?{...Dt("isConsolePaneOpen"),...Yt(r,"console")}:{isConsolePaneOpen:!1,...zn(r,"console")})},setCodeReviewPaneOpen:n=>{e(r=>n?{...Dt("isCodeReviewPaneOpen"),...Yt(r,"code")}:{isCodeReviewPaneOpen:!1,...zn(r,"code")})},clearCodeReviewReveal:n=>{e(r=>r.codeReviewReveal?.nonce===n?{codeReviewReveal:null}:{})},revealCodeReviewPane:()=>{e(n=>({...Dt("isCodeReviewPaneOpen"),...Yt(n,"code"),codeReviewReveal:{nonce:(n.codeReviewReveal?.nonce??0)+1}}))},setAskDrawerOpen:(n,r,i)=>{e(s=>{const a=typeof s.rightSlotKey=="string";if(n)return{...Dt("isAskDrawerOpen"),askDrawerScope:r,askDrawerEvictedPane:a?null:$E(s),askOpenIntent:null};const c={isAskDrawerOpen:!1,askDrawerEvictedPane:null,askOpenIntent:null};return a?i?.dismissSlot?{...c,...UE(s)}:{...c,...$l(s.rightSlotMemory,s.rightSlotKey,!1)}:s.rightSlotKey===null?i?.dismissSlot?{...c,rightSlotLegacySeed:null}:c:i?.dismissSlot?{...c,rightSlotLegacySeed:null}:{...c,...s.askDrawerEvictedPane===null?null:{[s.askDrawerEvictedPane]:!0}}})},requestAskOpen:(n,r="menu")=>{e({askOpenIntent:{scope:n,via:r}})},clearAskOpenIntent:n=>{e(r=>r.askOpenIntent?.scope===n?{askOpenIntent:null}:{})},setConsoleActiveSurface:n=>{e({consoleActiveSurface:n})},requestConsoleOpen:n=>{e({consoleOpenIntent:n})},clearConsoleOpenIntent:n=>{e(r=>r.consoleOpenIntent===n?{consoleOpenIntent:null}:{})},setConsoleLiveSurface:(n,r)=>{e(i=>{if(n===null||r<=0)return i.consoleLiveSurface===null?{}:{consoleLiveSurface:null};const s=i.consoleLiveSurface;return s?.sessionId===n&&s.count===r?{}:{consoleLiveSurface:{sessionId:n,count:r}}})},markConsoleUnseen:(n,r)=>{e(i=>i.consoleUnseen.some(s=>s.surface===r)?{}:{consoleUnseen:[...i.consoleUnseen,{sessionId:n,surface:r,at:Date.now()}]})},clearConsoleUnseen:n=>{const r=Array.isArray(n)?n:[n];e(i=>{const s=i.consoleUnseen.filter(a=>!r.includes(a.surface));return s.length===i.consoleUnseen.length?{}:{consoleUnseen:s}})},setRightSlotWidth:n=>{e({rightSlotWidth:n})},restoreDefaultRightSlotWidth:()=>{e({rightSlotWidth:0})},bindRightSlotKey:(n,r)=>{e(i=>{let s=i.rightSlotMemory,a=i.rightSlotLegacySeed;const c=r?.admittedFrom;return typeof c=="string"&&typeof n=="string"&&(s=DE(s,c,n)),n===null||(ga(n)?a=null:a!==null&&jr(s,n)===void 0&&(s=Gf(s,n,a),a=null)),{rightSlotKey:n,rightSlotMemory:s,rightSlotLegacySeed:a,...$l(s,n,i.isAskDrawerOpen)}})},setRightSlotRoute:n=>{const r=t().rightSlotRoute;r.mounted===n.mounted&&r.session===n.session||e({rightSlotRoute:{...n}})},setShortcutBinding:(n,r,i)=>{if(r===null){e(a=>{const c={...a.shortcutBindings};return delete c[n],{shortcutBindings:c}});return}const s=ma(r);s!==null&&AE(s,n,t().shortcutBindings,"linux",i)===null&&e(a=>({shortcutBindings:{...a.shortcutBindings,[n]:s}}))},clearShortcutBinding:n=>{e(r=>({shortcutBindings:{...r.shortcutBindings,[n]:null}}))},setBrowserPaneScope:n=>{e({browserPaneScope:n})},revealRunPanelSection:n=>{e(r=>({...Dt("isRunPanelOpen"),...Yt(r,"run"),runPanelReveal:{section:n,nonce:(r.runPanelReveal?.nonce??0)+1}}))},clearRunPanelReveal:n=>{e(r=>r.runPanelReveal?.nonce===n?{runPanelReveal:null}:{})},setChatSidebarWidth:n=>{e({chatSidebarWidth:Math.min(ca,Math.max(aa,n))})},setChatSidebarRegions:n=>{e({chatSidebarRegions:n})},setChatSidebarListHeight:n=>{e({chatSidebarListHeight:n})},restoreDefaultChatSidebarListHeight:()=>{e({chatSidebarListHeight:null})},setChatSidebarOrder:n=>{e({chatSidebarOrder:n})},setChatSidebarView:n=>{e({chatSidebarView:n})},dismissBuiltinOffer:n=>{e({dismissedBuiltinOfferSignature:n})},restoreDefaultChatSidebarWidth:()=>{e({chatSidebarWidth:Fl})},rememberMention:(n,r)=>{e(i=>{const s=i.mentionRecents,a=s?.cwd===n?s.paths:[],c=[r,...a.filter(l=>l!==r)].slice(0,GE);return{mentionRecents:{cwd:n,paths:c}}})},rememberProfile:(n,r)=>{e(i=>({profileRecents:{...i.profileRecents,[n]:JE(i.profileRecents[n]??[],r)}}))},rememberConversation:n=>{e(r=>{const i=ex(r.conversationRecents),s=XE(i,n);return s.length===i.length&&s.every((a,c)=>a===i[c])?r:{conversationRecents:s}})}}),{name:"ui-preferences-storage",version:YE,migrate:ix,partialize:tx,merge:rx}));function JE(e,t){return[t,...e.filter(n=>n!==t)].slice(0,HE)}function XE(e,t){return[t,...e.filter(n=>n!==t)].slice(0,WE)}const qE=[];function ex(e){return Array.isArray(e)?e:qE}function tx(e){const{runPanelReveal:t,codeReviewReveal:n,consoleOpenIntent:r,consoleLiveSurface:i,askOpenIntent:s,isAskDrawerOpen:a,askDrawerScope:c,askDrawerEvictedPane:l,rightSlotRoute:d,isCanvasOpen:u,isRunPanelOpen:f,isBrowserPaneOpen:p,isConsolePaneOpen:g,isCodeReviewPaneOpen:y,rightSlotKey:m,...b}=e;return{...b,rightSlotMemory:nx(e.rightSlotMemory)}}function nx(e){return(e??Hf).filter(([t])=>!ga(t))}function rx(e,t){const n=e??{},{isCanvasOpen:r,isRunPanelOpen:i,isBrowserPaneOpen:s,isConsolePaneOpen:a,isCodeReviewPaneOpen:c,...l}=n;return{...t,...l,finderFiles:pa(n.finderFiles),rightSlotKey:t.rightSlotKey,rightSlotMemory:NE(n.rightSlotMemory),rightSlotLegacySeed:Bf(n.rightSlotLegacySeed)?n.rightSlotLegacySeed:null,shortcutBindings:OE(n.shortcutBindings)}}function ix(e,t){const n={...e??{}};if(t<1&&sx(n),t<2)for(const r of QE)delete n[r];if(t<3){let r=null;for(const i of bo)if(n[Ul(i)]===!0){r=i;break}r!==null&&(n.rightSlotLegacySeed=r);for(const i of bo)delete n[Ul(i)]}return t<4&&(n.finderFiles=pa(n.finderFiles)),n}function sx(e){const t=[["canvasWidth",800],["runPanelWidth",420],["browserPanelWidth",640],["consolePanelWidth",796]];let n=0;for(const[r,i]of t){const s=e[r];if(typeof s=="number"&&s>0&&s!==i){n=s;break}}for(const[r]of t)delete e[r];e.rightSlotWidth=n}const ox="data-canvas-shortcuts",ax=`[${ox}]`,cx=e=>Wf(e,ax),lx='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"]',zC=e=>Wf(e,lx);function Wf(e,t){const n=e;return typeof n?.closest=="function"?n.closest(t)!==null:!1}const ZC=e=>{if(!(e.metaKey||e.ctrlKey))return null;const t=e.key.toLowerCase();return t==="o"?"open-file":t==="n"&&cx(e.target)?"new-file":null},vo=e=>e.replace(/\\/g,"/"),KC=()=>window.location.hash?vo(window.location.hash.substring(1)):vo(window.location.pathname),VC=(e,t)=>{if(t!==null&&(e===t||e.startsWith(`${t}/`)||e.startsWith(`${t}\\`))){const r=e.substring(t.length);return r.startsWith("/")||r.startsWith("\\")||r===""?`~${r.replace(/\\/g,"/")}`:`~/${r.replace(/\\/g,"/")}`}return e==="~"?"~":e.replace(/\\/g,"/")},YC=(e,t)=>{if(e.length<=t)return e;const n=e.split("/"),r=n[n.length-1]??"";if(r.length+1>=t)return`…${r.slice(-39)}`;const i=n[0]==="~"||n[0]==="",s=i?n.slice(0,2):n.slice(0,1),a=n.slice(s.length),c=y=>{const m=t-y.length-(y?3:2);let b=[];for(let _=a.length-1;_>=0;_-=1){const k=[a[_],...b];if(k.join("/").length>m)break;b=k}return b},l=(y,m)=>y?`${y}/…/${m.join("/")}`:`…/${m.join("/")}`,d=s.join("/"),u=c(d);if(u.length>0)return u.length===a.length?e:l(d,u);const f=i?n[0]:"",p=c(f);if(p.length>0)return l(f,p);const g=t-(f?`${f}/…/`.length:2);return g>0?l(f,[r.slice(-g)]):"…"},QC=(e,t)=>vo(e).includes(t);export{Pi as $,gS as A,WC as B,Le as C,jC as D,vE as E,Id as F,ye as G,sS as H,oS as I,_T as J,nf as K,fT as L,rf as M,pT as N,lT as O,hc as P,gT as Q,hT as R,Ge as S,uT as T,of as U,mT as V,zT as W,KC as X,ff as Y,OT as Z,PT as _,nI as a,qe as a$,zC as a0,ex as a1,Jg as a2,tT as a3,Cr as a4,ZR as a5,Tx as a6,xi as a7,Am as a8,eI as a9,Hl as aA,bp as aB,kp as aC,Ip as aD,Op as aE,Tp as aF,Cp as aG,Ga as aH,jp as aI,Ha as aJ,Pp as aK,Ap as aL,FT as aM,LS as aN,NS as aO,wT as aP,QC as aQ,vx as aR,bx as aS,yx as aT,_x as aU,kx as aV,nm as aW,st as aX,nr as aY,Ed as aZ,_m as a_,Kx as aa,Fm as ab,Bm as ac,vc as ad,Rx as ae,Ix as af,wd as ag,vo as ah,K_ as ai,wx as aj,o as ak,Jh as al,Qh as am,ER as an,K0 as ao,yR as ap,vR as aq,wR as ar,Vu as as,tb as at,TS as au,tI as av,yo as aw,OC as ax,Rr as ay,De as az,Qx as b,_C as b$,FC as b0,DC as b1,HR as b2,Ht as b3,Ja as b4,Ro as b5,Vm as b6,ki as b7,hd as b8,rS as b9,am as bA,ua as bB,$x as bC,kl as bD,Hx as bE,RS as bF,cE as bG,Dl as bH,rC as bI,vC as bJ,wC as bK,SC as bL,nC as bM,vT as bN,yT as bO,pf as bP,UT as bQ,kC as bR,pC as bS,hC as bT,Rn as bU,bn as bV,eC as bW,Mf as bX,oC as bY,yC as bZ,xr as b_,dT as ba,Q as bb,cT as bc,yn as bd,lo as be,uo as bf,oT as bg,aT as bh,nT as bi,rT as bj,iT as bk,NC as bl,HC as bm,KE as bn,GC as bo,e_ as bp,qx as bq,Xx as br,Jx as bs,Sd as bt,Gx as bu,Dx as bv,kd as bw,Vg as bx,om as by,ip as bz,rI as c,na as c$,bC as c0,uC as c1,fC as c2,Il as c3,cC as c4,aC as c5,lC as c6,Xk as c7,dC as c8,iC as c9,UC as cA,FE as cB,Zn as cC,$C as cD,YT as cE,VT as cF,Af as cG,Pf as cH,Bx as cI,Fx as cJ,zE as cK,Of as cL,ZE as cM,Bl as cN,Ml as cO,la as cP,mR as cQ,gR as cR,DT as cS,MT as cT,NT as cU,$T as cV,LT as cW,m_ as cX,Pr as cY,Yx as cZ,ql as c_,mC as ca,gC as cb,Qk as cc,bT as cd,Mi as ce,tC as cf,jT as cg,sC as ch,qT as ci,EC as cj,xC as ck,TC as cl,CC as cm,mE as cn,IC as co,Ir as cp,RC as cq,AC as cr,Ex as cs,ZC as ct,VC as cu,YC as cv,PC as cw,gx as cx,Bw as cy,sI as cz,Re as d,Ei as d$,WR as d0,xR as d1,JR as d2,XR as d3,df as d4,wS as d5,Ai as d6,TT as d7,CT as d8,ey as d9,KT as dA,$k as dB,jf as dC,fp as dD,bE as dE,hx as dF,ga as dG,LC as dH,Ua as dI,px as dJ,fx as dK,As as dL,rr as dM,gp as dN,Rp as dO,Mp as dP,Bb as dQ,un as dR,Sf as dS,GT as dT,Ek as dU,bf as dV,BT as dW,WT as dX,ZT as dY,zx as dZ,Vx as d_,zR as da,TR as db,$0 as dc,hS as dd,lf as de,fS as df,wl as dg,ST as dh,cx as di,RT as dj,sT as dk,Ox as dl,Px as dm,Zx as dn,Di as dp,Ni as dq,Ff as dr,AE as ds,ha as dt,Ki as du,MC as dv,zt as dw,sn as dx,Fs as dy,XT as dz,iI as e,fv as e$,Ye as e0,xS as e1,BC as e2,JT as e3,da as e4,QT as e5,Cf as e6,Fk as e7,aa as e8,jx as e9,Wt as eA,mt as eB,GI as eC,HI as eD,FI as eE,UI as eF,jI as eG,RI as eH,TI as eI,AI as eJ,CI as eK,ou as eL,LI as eM,pR as eN,Dy as eO,ny as eP,$I as eQ,uv as eR,oR as eS,_u as eT,cR as eU,rR as eV,iR as eW,aR as eX,cv as eY,us as eZ,sR as e_,tc as ea,Cg as eb,Mx as ec,um as ed,DR as ee,NR as ef,Cx as eg,Ax as eh,MR as ei,Yu as ej,Lw as ek,ku as el,$f as em,su as en,jg as eo,Nx as ep,_R as eq,bR as er,RR as es,IR as et,SR as eu,wn as ev,Ux as ew,Wx as ex,Lx as ey,jo as ez,Sx as f,qR as f$,eR as f0,zI as f1,XI as f2,dR as f3,WI as f4,qI as f5,nR as f6,fR as f7,uR as f8,tR as f9,vI as fA,Gy as fB,kI as fC,EI as fD,II as fE,xI as fF,bI as fG,OI as fH,hR as fI,UR as fJ,LR as fK,Qw as fL,BR as fM,$R as fN,FR as fO,GR as fP,yI as fQ,wI as fR,To as fS,Hs as fT,yp as fU,kR as fV,KR as fW,VR as fX,gs as fY,QR as fZ,YR as f_,ZI as fa,KI as fb,VI as fc,YI as fd,QI as fe,JI as ff,lR as fg,cm as fh,lm as fi,dm as fj,Dc as fk,_I as fl,DI as fm,kb as fn,iu as fo,tu as fp,SI as fq,xo as fr,rc as fs,ma as ft,yE as fu,PI as fv,vb as fw,NI as fx,BI as fy,MI as fz,Xg as g,Z0 as g0,eT as g1,AR as g2,$d as g3,yr as g4,mI as g5,j_ as g6,Ud as g7,Mo as g8,Dd as g9,b_ as ga,v_ as gb,pI as gc,im as gd,fI as ge,cI as gf,dI as gg,Ac as gh,aI as gi,oI as gj,uI as gk,Oc as gl,lI as gm,yd as gn,gI as go,hI as gp,xT as gq,CR as gr,jR as gs,OR as gt,PR as gu,kT as gv,ET as gw,Xh as gx,nc as gy,Co as h,Xl as i,Im as j,Rm as k,Tm as l,Cm as m,HT as n,Sk as o,xx as p,o_ as q,t_ as r,Dp as s,mx as t,Sp as u,jS as v,Ke as w,IT as x,AT as y,yS as z};
64
+ */function Er(){return Er=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Er.apply(this,arguments)}const oa=S.createContext(null),wk=S.createContext(null),un=S.createContext(null),Oi=S.createContext(null),Tt=S.createContext({outlet:null,matches:[],isDataRoute:!1}),Ef=S.createContext(null);function GT(e,t){let{relative:n}=t===void 0?{}:t;jn()||ke(!1);let{basename:r,navigator:i}=S.useContext(un),{hash:s,pathname:a,search:c}=Ek(e,{relative:n}),l=a;return r!=="/"&&(l=a==="/"?r:$t([r,a])),i.createHref({pathname:l,search:c,hash:s})}function jn(){return S.useContext(Oi)!=null}function Pi(){return jn()||ke(!1),S.useContext(Oi).location}function xf(e){S.useContext(un).static||S.useLayoutEffect(e)}function Sk(){let{isDataRoute:e}=S.useContext(Tt);return e?Nk():kk()}function kk(){jn()||ke(!1);let e=S.useContext(oa),{basename:t,future:n,navigator:r}=S.useContext(un),{matches:i}=S.useContext(Tt),{pathname:s}=Pi(),a=JSON.stringify(ia(i,n.v7_relativeSplatPath)),c=S.useRef(!1);return xf(()=>{c.current=!0}),S.useCallback(function(d,u){if(u===void 0&&(u={}),!c.current)return;if(typeof d=="number"){r.go(d);return}let f=sa(d,JSON.parse(a),s,u.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:$t([t,f.pathname])),(u.replace?r.replace:r.push)(f,u.state,u)},[t,r,a,s,e])}function HT(){let{matches:e}=S.useContext(Tt),t=e[e.length-1];return t?t.params:{}}function Ek(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=S.useContext(un),{matches:i}=S.useContext(Tt),{pathname:s}=Pi(),a=JSON.stringify(ia(i,r.v7_relativeSplatPath));return S.useMemo(()=>sa(e,JSON.parse(a),s,n==="path"),[e,a,s,n])}function xk(e,t){return Ik(e,t)}function Ik(e,t,n,r){jn()||ke(!1);let{navigator:i,static:s}=S.useContext(un),{matches:a}=S.useContext(Tt),c=a[a.length-1],l=c?c.params:{};c&&c.pathname;let d=c?c.pathnameBase:"/";c&&c.route;let u=Pi(),f;if(t){var p;let _=typeof t=="string"?dn(t):t;d==="/"||(p=_.pathname)!=null&&p.startsWith(d)||ke(!1),f=_}else f=u;let g=f.pathname||"/",y=g;if(d!=="/"){let _=d.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(_.length).join("/")}let m=XS(e,{pathname:y}),b=Ok(m&&m.map(_=>Object.assign({},_,{params:Object.assign({},l,_.params),pathname:$t([d,i.encodeLocation?i.encodeLocation(_.pathname).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?d:$t([d,i.encodeLocation?i.encodeLocation(_.pathnameBase).pathname:_.pathnameBase])})),a,n,r);return t&&b?S.createElement(Oi.Provider,{value:{location:Er({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:Nt.Pop}},b):b}function Rk(){let e=Dk(),t=bk(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},t),n?S.createElement("pre",{style:i},n):null,null)}const Tk=S.createElement(Rk,null);class Ck extends S.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?S.createElement(Tt.Provider,{value:this.props.routeContext},S.createElement(Ef.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Ak(e){let{routeContext:t,match:n,children:r}=e,i=S.useContext(oa);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),S.createElement(Tt.Provider,{value:t},r)}function Ok(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,c=(i=n)==null?void 0:i.errors;if(c!=null){let u=a.findIndex(f=>f.route.id&&c?.[f.route.id]!==void 0);u>=0||ke(!1),a=a.slice(0,Math.min(a.length,u+1))}let l=!1,d=-1;if(n&&r&&r.v7_partialHydration)for(let u=0;u<a.length;u++){let f=a[u];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(d=u),f.route.id){let{loaderData:p,errors:g}=n,y=f.route.loader&&p[f.route.id]===void 0&&(!g||g[f.route.id]===void 0);if(f.route.lazy||y){l=!0,d>=0?a=a.slice(0,d+1):a=[a[0]];break}}}return a.reduceRight((u,f,p)=>{let g,y=!1,m=null,b=null;n&&(g=c&&f.route.id?c[f.route.id]:void 0,m=f.route.errorElement||Tk,l&&(d<0&&p===0?(Lk("route-fallback"),y=!0,b=null):d===p&&(y=!0,b=f.route.hydrateFallbackElement||null)));let _=t.concat(a.slice(0,p+1)),k=()=>{let E;return g?E=m:y?E=b:f.route.Component?E=S.createElement(f.route.Component,null):f.route.element?E=f.route.element:E=u,S.createElement(Ak,{match:f,routeContext:{outlet:u,matches:_,isDataRoute:n!=null},children:E})};return n&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?S.createElement(Ck,{location:n.location,revalidation:n.revalidation,component:m,error:g,children:k(),routeContext:{outlet:null,matches:_,isDataRoute:!0}}):k()},null)}var If=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(If||{}),Rf=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Rf||{});function Pk(e){let t=S.useContext(oa);return t||ke(!1),t}function jk(e){let t=S.useContext(wk);return t||ke(!1),t}function Mk(e){let t=S.useContext(Tt);return t||ke(!1),t}function Tf(e){let t=Mk(),n=t.matches[t.matches.length-1];return n.route.id||ke(!1),n.route.id}function Dk(){var e;let t=S.useContext(Ef),n=jk(),r=Tf();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function Nk(){let{router:e}=Pk(If.UseNavigateStable),t=Tf(Rf.UseNavigateStable),n=S.useRef(!1);return xf(()=>{n.current=!0}),S.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,Er({fromRouteId:t},s)))},[e,t])}const jl={};function Lk(e,t,n){jl[e]||(jl[e]=!0)}function WT(e,t){e?.v7_startTransition,e?.v7_relativeSplatPath}function zT(e){let{to:t,replace:n,state:r,relative:i}=e;jn()||ke(!1);let{future:s,static:a}=S.useContext(un),{matches:c}=S.useContext(Tt),{pathname:l}=Pi(),d=Sk(),u=sa(t,ia(c,s.v7_relativeSplatPath),l,i==="path"),f=JSON.stringify(u);return S.useEffect(()=>d(JSON.parse(f),{replace:n,state:r,relative:i}),[d,f,i,n,r]),null}function $k(e){ke(!1)}function ZT(e){let{basename:t="/",children:n=null,location:r,navigationType:i=Nt.Pop,navigator:s,static:a=!1,future:c}=e;jn()&&ke(!1);let l=t.replace(/^\/*/,"/"),d=S.useMemo(()=>({basename:l,navigator:s,static:a,future:Er({v7_relativeSplatPath:!1},c)}),[l,c,s,a]);typeof r=="string"&&(r=dn(r));let{pathname:u="/",search:f="",hash:p="",state:g=null,key:y="default"}=r,m=S.useMemo(()=>{let b=Sf(u,l);return b==null?null:{location:{pathname:b,search:f,hash:p,state:g,key:y},navigationType:i}},[l,u,f,p,g,y,i]);return m==null?null:S.createElement(un.Provider,{value:d},S.createElement(Oi.Provider,{children:n,value:m}))}function KT(e){let{children:t,location:n}=e;return xk(go(t),n)}new Promise(()=>{});function go(e,t){t===void 0&&(t=[]);let n=[];return S.Children.forEach(e,(r,i)=>{if(!S.isValidElement(r))return;let s=[...t,i];if(r.type===S.Fragment){n.push.apply(n,go(r.props.children,s));return}r.type!==$k&&ke(!1),!r.props.index||!r.props.children||ke(!1);let a={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=go(r.props.children,s)),n.push(a)}),n}const ji=260,aa=220,ca=320,Cf=56,la=480,VT=8,da=44,Af=400,Of=1200;function Pf(e){return Math.max(0,Math.min(Of,e-la))}function Ml(e){return Pf(e)>=Af?"docked":"overlay"}function YT({capacity:e,min:t,max:n,drawn:r}){const i=e>=t;return i?{resizable:i,value:Math.min(Math.max(r,t),e),minWidth:t,maxWidth:Math.min(n,e)}:{resizable:i,value:r,minWidth:r,maxWidth:r}}function Uk(e,t=ji,n=da){return Ml(e-jf(t)-n)==="overlay"&&Ml(e-Cf-n)==="docked"}function jf(e){return Number.isNaN(e)?ji:Math.min(ca,Math.max(aa,e))}function Fk(e,t=da){return Math.max(0,Math.min(ca,e-la-t))}function QT(e,t,n=ji,r=!1,i=da){const s=!t&&r&&Uk(e,n,i),a=t||s,c=Fk(e,i);return{mode:a?"strip":"docked",width:a?Cf:Math.min(jf(n),c),collapsed:a,resizable:!a&&c>=aa}}function JT(e){return e.shiftKey||e.altKey||!(e.metaKey||e.ctrlKey)?!1:e.key.toLowerCase()==="b"}const XT=e=>e?"⌘B":"Ctrl+B",Bk=["active","created"],qT={running:"ui.chat.sidebar_view.section.running",today:"ui.chat.sidebar_view.section.today",week:"ui.chat.sidebar_view.section.week",older:"ui.chat.sidebar_view.section.older"},Gk=new Set(["waiting","busy","delegating","approval","answer","wedged"]);function Mi(e){return Gk.has(e.status?.code??"")}const Hk=new Set(["approval","answer"]);function Wk(e){return Hk.has(e.status?.code??"")}const zk=24*60*60*1e3,Zk=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()};function ua(e,t){const n=t==="created"?e.created_at:e.updated_at;return typeof n!="number"||!Number.isFinite(n)||n<=0?null:n*1e3}const Kk="last_user_at";function Vk(e){const t=e[Kk],n=typeof t=="number"&&Number.isFinite(t)&&t>0?t:e.created_at;return typeof n!="number"||!Number.isFinite(n)||n<=0?null:n*1e3}function Yk(e,t,n){if(Mi(e))return"running";const r=ua(e,n);if(r===null)return"older";const i=Zk(t);return r>=i?"today":r>=i-6*zk?"week":"older"}function eC(e,t,n){const r={running:[],today:[],week:[],older:[]};for(const i of e)r[Yk(i,t,n)].push(i);return r}function Qk(e,t,n){const r=ua(e,n);if(r===null)return"";const i=Math.floor(Math.max(0,t-r)/6e4);if(i<1)return"now";if(i<60)return`${i}m`;const s=Math.floor(i/60);if(s<24)return`${s}h`;const a=Math.floor(s/24);if(a<7)return`${a}d`;const c=Math.floor(a/7);return a<365?`${c}w`:`${Math.floor(a/365)}y`}function tC(e,t,n){const r=Qk(e,t,n);if(!r)return"";const i=n==="created"?"created":"last active";if(r==="now")return`${i} just now`;const s={m:"minute",h:"hour",d:"day",w:"week",y:"year"},a=Number.parseInt(r,10),c=s[r.slice(-1)];return`${i} ${a} ${c}${a===1?"":"s"} ago`}const _o=["pinned","running","today","week","older","agents","teams"],nC={pinned:"ui.chat.sidebar_view.section.pinned",running:"ui.chat.sidebar_view.section.running",today:"ui.chat.sidebar_view.section.today",week:"ui.chat.sidebar_view.section.week",older:"ui.chat.sidebar_view.section.older",agents:"ui.chat.sidebar_view.section.agents",teams:"ui.chat.sidebar_view.section.teams"};function rC(e){return e==="agents"||e==="teams"}const xr=8;function Jk(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function iC(e,t){return{...e,[t]:(e[t]??xr)+xr}}function sC(e,t,n,r,i){const s=!(e[n]??r);return{expanded:{...e,[n]:s},caps:!s&&!i?Jk(t,n):t}}function oC(e,t,n,r){return(e||t!=="")&&(r>xr||n.trim()!=="")}const aC="Collapse, then reopen, to restore the compact list";function cC(e){return(e??xr)>xr}const lC=e=>`section-grown-hint-${e}`,Xk=e=>e===1?"Show 1 more":`Show ${e} more`;function dC(e,t){return`${Xk(e)} ${t}`}const bn={hidden:[],order:[..._o],pins:[],groupBy:"section",tagsEnabled:!1,autoTagForks:!0,basis:"active",orderBy:"active-first",loads:0,pinnedAgents:[]},qk=10,Wn=[25,50],eE=50,tE=500,nE=64;function Rn(e){const t=Math.max(0,Math.floor(e));return t===0?qk:t<=Wn.length?Wn[t-1]:Wn[Wn.length-1]+(t-Wn.length)*eE}function uC(e,t){const n=Rn(e+1)-Rn(e),r=Math.max(0,Math.min(n,t));return r===1?"Show 1 more chat":`Show ${r} more chats`}function fC(e,t,n){const r=Rn(t+1)-Rn(t),i=Rn(t),s=Math.min(i+r,e.length);let a=0;for(let l=i;l<s;l+=1)fa(e[l])&&(a+=1);const c=Math.max(0,s-i-a);return c>0?c:Math.max(0,Math.min(r,n))}function fa(e){return Mi(e)}function rE(e){return Wk(e)?0:Mi(e)?1:2}function iE(e,t){return Mi(e)?Vk(e):ua(e,t)}function sE(e,t){return e===null&&t===null?0:e===null?1:t===null?-1:t-e}function pC(e,t,n){const r=e.map((i,s)=>({row:i,index:s,lane:t==="active-first"?rE(i):0,at:iE(i,n)}));return r.sort((i,s)=>i.lane-s.lane||sE(i.at,s.at)||i.index-s.index),r.map(i=>i.row)}function hC(e,t){const{limit:n,currentId:r,searching:i=!1}=t;if(i)return{rows:[...e],lifted:!1,remaining:0};const s=[];let a=Math.max(0,n);for(const d of e){if(a>0){s.push(d),a-=1;continue}fa(d)&&s.push(d)}const c=Math.max(0,e.length-s.length);if(!r)return{rows:s,lifted:!1,remaining:c};const l=e.find(d=>d.session_id===r)??null;return l===null||s.includes(l)?{rows:s,lifted:!1,remaining:c}:{rows:[l,...s],lifted:!0,remaining:c}}function mC(e,t){if(t.searching)return{rows:[...e],lifted:!1,hidden:0,held:e.length};const n=Rn(t.loads),r=[];let i=n;for(const l of e){if(fa(l)){r.push(l);continue}i>0&&(r.push(l),i-=1)}const s=t.currentId,a=s==null?null:e.find(l=>l.session_id===s)??null,c=a!==null&&!r.includes(a);return{rows:c&&a!==null?[a,...r]:r,lifted:c,hidden:e.length-r.length-(c?1:0),held:e.length}}function gC(e){if(e.add<=0)return null;const t=e.add===1?"Show 1 more chat":`Show ${e.add} more chats`;if(e.drawn>=e.total)return{label:t,aria:t};const n=`${e.drawn} of ${e.total}`;return{label:`${t} · ${n}`,aria:`${t} · ${n} shown`}}const oE="mt-4",aE="mt-2";function _C(e){return e?oE:aE}function yC(e,t,n,r){return n?e.toLocaleLowerCase().includes(n.toLocaleLowerCase())||(r??"").toLocaleLowerCase().includes(n.toLocaleLowerCase())||t>0:!0}function bC(e,t){if(t==="section")return null;if(t==="flat")return[{key:"all",label:"",rows:[...e]}];const n=new Map;for(const s of e){const a=s.binding?.team||s.binding?.agent||"",c=a||"ungrouped",l=n.get(c)??{key:c,label:a||"Ungrouped",rows:[]};l.rows.push(s),n.set(c,l)}const r=[...n.values()],i=r.findIndex(s=>s.key==="ungrouped");return i>0&&r.push(...r.splice(i,1)),r}function cE(e,t){return!e.hidden.includes(t)}function Mf(e){return e.order.filter(t=>cE(e,t))}function vC(e,t){const n=e.hidden.includes(t)?e.hidden.filter(r=>r!==t):[...e.hidden,t];return{...e,hidden:n}}function wC(e,t,n){const r=Mf(e),i=r.indexOf(t),s=r[i+n];if(i<0||s===void 0)return e;const a=e.order.indexOf(t),c=e.order.indexOf(s),l=[...e.order];return l[a]=s,l[c]=t,{...e,order:l}}const lE=["running","today","week","older"];function Dl(e){return lE.includes(e)}function SC(e,t,n,r){if(!Dl(t)||r&&!r(t))return!1;const i=Mf(e),s=i.indexOf(t);if(s<0)return!1;const a=i[s+n];return a===void 0||!Dl(a)?!1:r?r(a):!0}const dE=["section","agent","flat"],uE=["active-first","recent"];function kC(e){if(typeof e!="object"||e===null)return bn;const t=e,n=new Set(_o),r=[];if(Array.isArray(t.order))for(const p of t.order)typeof p=="string"&&n.has(p)&&(r.includes(p)||r.push(p));for(const p of _o)r.includes(p)||r.push(p);const i=[];if(Array.isArray(t.hidden))for(const p of t.hidden)typeof p=="string"&&n.has(p)&&(i.includes(p)||i.push(p));const s=dE.includes(t.groupBy)?t.groupBy:bn.groupBy,a=Bk.includes(t.basis)?t.basis:bn.basis,c=uE.includes(t.orderBy)?t.orderBy:bn.orderBy,l=typeof t.loads=="number"&&Number.isFinite(t.loads)&&t.loads>0?Math.min(tE,Math.floor(t.loads)):0,d=[];if(Array.isArray(t.pinnedAgents)){for(const p of t.pinnedAgents)if(typeof p=="string"&&p!==""&&!d.includes(p)){if(d.length>=nE)break;d.push(p)}}const u=[],f=new Set;if(Array.isArray(t.pins))for(const p of t.pins)typeof p=="string"&&p.length!==0&&(f.has(p)||(f.add(p),u.push(p)));return{hidden:i,order:r,groupBy:s,tagsEnabled:typeof t.tagsEnabled=="boolean"?t.tagsEnabled:!1,autoTagForks:typeof t.autoTagForks=="boolean"?t.autoTagForks:bn.autoTagForks,basis:a,orderBy:c,loads:l,pins:u,pinnedAgents:d}}const Df={sort:"recent",order:"asc",group:!0,workingOpen:!1,closedSections:[],kinds:[]},fE=["recent","name","kind","modified","created","size"],pE=["images","video","audio","documents","spreadsheets","presentations","code","archives","other"];function pa(e){const t=e&&typeof e=="object"?e:{};return{sort:fE.includes(t.sort??"")?t.sort:Df.sort,order:t.order==="desc"?"desc":"asc",group:typeof t.group=="boolean"?t.group:!0,workingOpen:t.workingOpen===!0,closedSections:Array.isArray(t.closedSections)?[...new Set(t.closedSections.filter(n=>[Ir,"Highlights","Images","Videos","Sounds","Documents","Spreadsheets","Other"].includes(n)))]:[],kinds:Array.isArray(t.kinds)?[...new Set(t.kinds.filter(n=>pE.includes(n)))]:[]}}const Ir="Attachments";function EC(e,t){const n=r=>{switch(t.sort){case"name":return r.row.name;case"kind":return`${r.row.kind}\0${r.row.name}`;case"modified":return r.modified;case"created":return r.created;case"size":return r.row.document.sizeBytes??null;default:return r.mentioned}};return[...e].sort((r,i)=>{const s=n(r),a=n(i);if(s===null||a===null)return s===a?0:s===null?1:-1;const c=typeof s=="string"&&typeof a=="string"?s.localeCompare(a,void 0,{numeric:!0}):Number(s)-Number(a);return(t.order==="asc"?c:-c)||r.mentioned-i.mentioned})}const hE=e=>{switch(e.row.kind){case"images":return"Images";case"video":return"Videos";case"audio":return"Sounds";case"spreadsheets":return"Spreadsheets";case"documents":case"presentations":case"code":return"Documents";default:return"Other"}};function xC(e,t,n,r,i=[]){const s=e.filter(l=>l.highlighted),a=e.filter(l=>!l.highlighted),c=[];if(i.length&&c.push({id:Ir,label:h("ui.canvas.files.attachments"),items:i,open:n||!r.has(Ir),highlights:!1}),s.length&&c.push({id:"Highlights",label:h("ui.canvas.finder_layout.highlights"),items:s,open:n||!r.has("Highlights"),highlights:!0}),s.length&&a.length&&(c.push({id:"Working files",label:h("ui.canvas.finder_layout.working_files"),items:[],open:t.workingOpen||n,highlights:!1}),!t.workingOpen&&!n))return c;if(!t.group)a.length&&c.push({id:"Files",label:h("ui.canvas.finder_layout.files"),items:a,open:!0,highlights:!1});else for(const l of["Images","Videos","Sounds","Documents","Spreadsheets","Other"]){const d=a.filter(u=>hE(u)===l);d.length&&c.push({id:l,label:l,items:d,open:n||!r.has(l),highlights:!1})}return c}const mE=32,IC=4,Nf=32,Lf=18;function RC(e){return e.height-Nf-(e.kind==="tiles"&&e.section.id===Ir?Lf:0)}function TC(e,t,n){const r=[],i=new Map,s=Math.max(136,t-16),a=Math.max(1,Math.floor((s+4)/140));let c=0;const l=(d,u,f,p,g=1)=>{p.forEach((y,m)=>i.set(y.row.document.id,{band:r.length,column:m})),r.push({section:d,kind:u,height:f,top:c,items:p,cols:g}),c+=f};for(const d of e)if(l(d,"header",mE,[]),!!d.open)if(d.highlights)for(const u of d.items)l(d,"highlight",u.why?68:44,[u]);else if(d.id===Ir){const u=d.items.filter(y=>y.row.media!=="image"),f=d.items.filter(y=>y.row.media==="image");for(const y of u)l(d,"compact",36,[y]);const p=(s-4*(a-1))/a,g=Math.round((p-8)*3/4)+Nf+Lf;for(let y=0;y<f.length;y+=a)l(d,"tiles",g,f.slice(y,y+a),a)}else if(n&&d.id==="Images"){const u=(s-4*(a-1))/a,f=Math.round((u-8)*3/4)+32;for(let p=0;p<d.items.length;p+=a)l(d,"tiles",f,d.items.slice(p,p+a),a)}else if(n&&d.id==="Videos")for(const u of d.items)l(d,"video",Math.min(Math.round((s-8)*9/16),280)+32,[u]);else if(n&&d.id==="Sounds")for(const u of d.items)l(d,"audio",80,[u]);else for(const u of d.items)l(d,"compact",36,[u]);return{bands:r,height:c,columns:a,positions:i}}function CC(e,t,n,r){const i=Math.max(600,n*.75);let s=0,a=e.bands.length;for(;s<a;){const d=s+a>>>1,u=e.bands[d];u.top+u.height<t-i?s=d+1:a=d}const c=new Set;for(let d=s;d<e.bands.length&&e.bands[d].top<=t+n+i;d++)c.add(d);const l=r?e.positions.get(r):null;return l&&c.add(l.band),[...c].sort((d,u)=>d-u)}function AC(e,t,n,r){const i=e.positions.get(t);if(!i)return null;const s=e.bands[i.band],a=e.bands.filter(u=>u.section.id===s.section.id&&u.items.length);if(n==="Home")return a[0]?.items[0]?.row.document.id??null;if(n==="End")return a.at(-1)?.items.at(-1)?.row.document.id??null;if(n==="ArrowLeft"||n==="ArrowRight")return s.items[i.column+(n==="ArrowLeft"?-1:1)]?.row.document.id??null;const c=n==="ArrowUp"||n==="PageUp"?-1:1,l=s.top+(n.startsWith("Page")?r*c:c);let d=i.band+c;for(;d>=0&&d<e.bands.length;d+=c){const u=e.bands[d];if(u.items.length&&!(n.startsWith("Page")&&(c>0?u.top<l:u.top>l)))return u.items[Math.min(i.column,u.items.length-1)].row.document.id}if(n.startsWith("Page")){const u=e.bands.filter(p=>p.items.length),f=c<0?u[0]:u.at(-1);return f?.items[c<0?0:f.items.length-1]?.row.document.id??null}return null}const gE="both",$f="by-turn",yo=[{value:"by-turn",label:"By turn"},{value:"by-response",label:"By response"}];function OC(e){for(const t of yo)if(e===t.value)return t.value;return $f}function PC(e){return yo.find(t=>t.value===e)?.label??yo[0].label}const jC="primary+alt+shift+space",_E=/^f([1-9]|1[0-9]|2[0-4])$/;function yE(e){return _E.test(e)}function bE(e,t){const n=vE(e,t);return t==="mac"?n.join(""):n.join("+")}function vE(e,t){const r=t==="mac"?{primary:"⌘",meta:"⌘",ctrl:"⌃",alt:"⌥",shift:"⇧"}:{primary:"Ctrl",meta:t==="win"?"Win":"Super",ctrl:"Ctrl",alt:"Alt",shift:"Shift"},i={space:"Space",backspace:"Backspace",delete:"Delete",insert:"Insert",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown",up:"Up",down:"Down",left:"Left",right:"Right"};return e.split("+").map(s=>s.trim().toLowerCase()).filter(s=>s.length>0).map(s=>s in r?r[s]:s in i?i[s]:yE(s)||s.length===1?s.toUpperCase():s)}const Di=[{id:"panel.console",get label(){return h("ui.settings.shortcuts.action.open_console")},get category(){return h("ui.settings.shortcuts.category.panels")},defaultChord:"primary+j",scope:"app"},{id:"panel.canvas",get label(){return h("ui.settings.shortcuts.action.open_canvas")},get category(){return h("ui.settings.shortcuts.category.panels")},defaultChord:"primary+shift+c",scope:"app"},{id:"panel.run",get label(){return h("ui.settings.shortcuts.action.open_run_details")},get category(){return h("ui.settings.shortcuts.category.panels")},defaultChord:null,scope:"app"},{id:"panel.ask",get label(){return h("ui.settings.shortcuts.action.open_asks")},get category(){return h("ui.settings.shortcuts.category.panels")},defaultChord:null,scope:"app"},{id:"panel.browser",get label(){return h("ui.settings.shortcuts.action.open_browser")},get category(){return h("ui.settings.shortcuts.category.panels")},defaultChord:null,scope:"app"},{id:"panel.code",get label(){return h("ui.settings.shortcuts.action.open_code_review")},get category(){return h("ui.settings.shortcuts.category.panels")},defaultChord:null,scope:"app"}],wE=new Map(Di.map(e=>[e.id,e])),SE=e=>wE.get(e),kE=new Set(["primary+0","primary+r","primary+shift+r","primary+t","primary+shift+t","primary+l",...[1,2,3,4,5,6,7,8,9].map(e=>`primary+${e}`)]);class EE extends Map{copy;constructor(t){super(),this.copy=new Map(t)}get(t){return this.copy.get(t)?.()}has(t){return this.copy.has(t)}get size(){return this.copy.size}*entries(){for(const[t,n]of this.copy)yield[t,n()]}*keys(){yield*this.copy.keys()}*values(){for(const t of this.copy.values())yield t()}forEach(t,n){for(const[r,i]of this)t.call(n,i,r,this)}[Symbol.iterator](){return this.entries()}}const ha=new EE([["primary+p",()=>h("ui.settings.shortcuts.reserved.palette_anywhere")],["primary+shift+p",()=>h("ui.settings.shortcuts.reserved.palette_commands")],["primary+k",()=>h("ui.settings.shortcuts.reserved.palette_chats")],["primary+n",()=>h("ui.settings.shortcuts.reserved.new_chat")],["primary+b",()=>h("ui.settings.shortcuts.reserved.toggle_sidebar")],["primary+[",()=>h("ui.settings.shortcuts.reserved.browser_back")],["primary+]",()=>h("ui.settings.shortcuts.reserved.browser_forward")],["primary+f",()=>h("ui.settings.shortcuts.reserved.find")],["primary+alt+up",()=>h("ui.settings.shortcuts.reserved.chat_region_up")],["primary+alt+down",()=>h("ui.settings.shortcuts.reserved.chat_region_down")],["primary+shift+a",()=>h("ui.settings.shortcuts.reserved.archive_chat")],["primary+shift+l",()=>h("ui.settings.shortcuts.reserved.chat_tags")],["primary+s",()=>h("ui.settings.shortcuts.reserved.canvas_save")],["primary+o",()=>h("ui.settings.shortcuts.reserved.canvas_open")],["primary+shift+up",()=>h("ui.settings.shortcuts.reserved.chat_move_up")],["primary+shift+down",()=>h("ui.settings.shortcuts.reserved.chat_move_down")],["primary+c",()=>h("ui.settings.shortcuts.reserved.copy")],["primary+x",()=>h("ui.settings.shortcuts.reserved.cut")],["primary+v",()=>h("ui.settings.shortcuts.reserved.paste")],["primary+a",()=>h("ui.settings.shortcuts.reserved.select_all")],["primary+z",()=>h("ui.settings.shortcuts.reserved.undo")],["primary+shift+z",()=>h("ui.settings.shortcuts.reserved.redo")],["primary+y",()=>h("ui.settings.shortcuts.reserved.redo_windows_linux")],["primary+r",()=>h("ui.settings.shortcuts.reserved.browser_reload")],["primary+shift+r",()=>h("ui.settings.shortcuts.reserved.browser_reload_cache")],["primary+t",()=>h("ui.settings.shortcuts.reserved.browser_new_tab")],["primary+shift+t",()=>h("ui.settings.shortcuts.reserved.browser_reopen_tab")],["primary+l",()=>h("ui.settings.shortcuts.reserved.browser_address")],...[1,2,3,4,5,6,7,8,9].map(e=>[`primary+${e}`,e===9?()=>h("ui.settings.shortcuts.reserved.browser_last_tab"):()=>h("ui.settings.shortcuts.reserved.browser_numbered_tab",{digit:e})]),["primary+0",()=>h("ui.settings.shortcuts.reserved.zoom_reset")],["primary+plus",()=>h("ui.settings.shortcuts.reserved.zoom_in")],["primary+=",()=>h("ui.settings.shortcuts.reserved.zoom_in")],["primary+-",()=>h("ui.settings.shortcuts.reserved.zoom_out")],["primary+q",()=>h("ui.settings.shortcuts.reserved.quit")],["primary+w",()=>h("ui.settings.shortcuts.reserved.close")],["primary+m",()=>h("ui.settings.shortcuts.reserved.minimise")]]),xE=["primary","alt","shift"],IE={primary:"primary",meta:"primary",cmd:"primary",command:"primary",super:"primary",ctrl:"primary",control:"primary",alt:"alt",option:"alt",shift:"shift"},RE=new Set(["space","backspace","delete","insert","home","end","pageup","pagedown","up","down","left","right"]),TE=e=>RE.has(e)||/^[a-z0-9]$/.test(e);function ma(e){if(typeof e!="string")return null;const t=e.toLowerCase().split("+").map(s=>s.trim()).filter(s=>s.length>0);if(t.length===0)return null;const n=t[t.length-1];if(!TE(n))return null;const r=new Set;for(const s of t.slice(0,-1)){const a=IE[s];if(a===void 0)return null;r.add(a)}return[...xE.filter(s=>r.has(s)),n].join("+")}const Uf=e=>e.split("+").includes("primary");function Ni(e,t){const n=t?.[e];return n===null?null:typeof n=="string"&&!ha.has(n)?n:SE(e)?.defaultChord??null}function MC(e){const t=new Map;for(const n of Di){const r=Ni(n.id,e);r!==null&&!t.has(r)&&t.set(r,n.id)}return t}const CE=e=>e==="mac"?h("ui.settings.shortcuts.capture.needs_modifier_mac"):h("ui.settings.shortcuts.capture.needs_modifier");function AE(e,t,n,r="linux",i=new Map){const s=e===null?null:ma(e);if(s===null)return h("ui.settings.shortcuts.capture.unbindable");if(!Uf(s))return CE(r);const a=ha.get(s);if(a!==void 0)return a;const c=i.get(s);if(c!==void 0)return h("ui.settings.shortcuts.capture.already_assigned",{label:c});for(const l of Di)if(l.id!==t&&Ni(l.id,n)===s)return h("ui.settings.shortcuts.capture.already_assigned",{label:l.label});return null}function OE(e){if(e===null||typeof e!="object"||Array.isArray(e))return{};const t=e,n=new Set,r={};for(const i of Di){const s=t[i.id];if(s===null){r[i.id]=null;continue}const a=typeof s=="string"?ma(s):null,c=a!==null&&kE.has(a),l=a!==null&&Uf(a)&&(c||!ha.has(a)&&!n.has(a))?a:null;l!==null&&(r[i.id]=l);const d=Ni(i.id,r);d!==null&&n.add(d)}return r}function DC(e,t,n){const r=Ni(e,t);return r===null?null:Ff(r,n)}function Ff(e,t){return bE(e,t)}function NC(e,t){const n=e.split("+"),r=n[n.length-1],i=n.slice(0,-1).map(s=>s==="primary"?t==="mac"?"Meta":"Control":s==="shift"?"Shift":s==="alt"?"Alt":s);return{glyph:Ff(e,t),aria:[...i,r.length===1?r.toUpperCase():r].join("+")}}const Nl=64,bo=["canvas","run","browser","console","code"],PE={canvas:"isCanvasOpen",run:"isRunPanelOpen",browser:"isBrowserPaneOpen",console:"isConsolePaneOpen",code:"isCodeReviewPaneOpen"};function Bf(e){return typeof e=="string"&&bo.includes(e)}function ga(e){return e.startsWith("draft:")}function jr(e,t){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(r[0]===t)return r[1]}}function _a(e){return e.length>Nl?e.slice(e.length-Nl):e}function Gf(e,t,n){return _a([...e.filter(([r])=>r!==t),[t,n]])}function jE(e,t,n){return jr(e,t)!==n?e:e.filter(([r])=>r!==t)}function ME(e,t){return jr(e,t)===void 0?e:e.filter(([n])=>n!==t)}function DE(e,t,n){const r=jr(e,t);return r===void 0?e:_a([...e.filter(([i])=>i!==t&&i!==n),[n,r]])}const Ll=Object.freeze({isCanvasOpen:!1,isRunPanelOpen:!1,isBrowserPaneOpen:!1,isConsolePaneOpen:!1,isCodeReviewPaneOpen:!1});function $l(e,t,n){if(n||typeof t!="string")return Ll;const r=jr(e,t);return r===void 0?Ll:{isCanvasOpen:r==="canvas",isRunPanelOpen:r==="run",isBrowserPaneOpen:r==="browser",isConsolePaneOpen:r==="console",isCodeReviewPaneOpen:r==="code"}}function NE(e){if(!Array.isArray(e))return[];const t=new Map;for(const n of e){if(!Array.isArray(n)||n.length!==2)continue;const[r,i]=n;typeof r!="string"||r===""||ga(r)||Bf(i)&&(t.delete(r),t.set(r,i))}return _a([...t.entries()])}function LC(e){const t=new Set(Object.keys(e.forgotten));for(const[n,r]of Object.entries(e.archiveFacts))r?.archived===!0&&r.answered===!0&&t.add(n);return t}function Ul(e){return PE[e]}const LE={canvas:"isCanvasOpen",run:"isRunPanelOpen",browser:"isBrowserPaneOpen",console:"isConsolePaneOpen",code:"isCodeReviewPaneOpen"},Mr=e=>e.isCanvasOpen?"canvas":e.isRunPanelOpen?"run":e.isBrowserPaneOpen?"browser":e.isConsolePaneOpen?"console":e.isCodeReviewPaneOpen?"code":e.isAskDrawerOpen?"ask":null,Li=(e,t)=>e==="ask"?t.askDrawerScope==="fleet"||t.rightSlotRoute.mounted&&t.rightSlotRoute.session:t.rightSlotRoute.mounted,$E=e=>{const t=Mr(e);return t===null||t==="ask"?null:LE[t]},Dt=e=>({isRunPanelOpen:e==="isRunPanelOpen",isCanvasOpen:e==="isCanvasOpen",isBrowserPaneOpen:e==="isBrowserPaneOpen",isConsolePaneOpen:e==="isConsolePaneOpen",isCodeReviewPaneOpen:e==="isCodeReviewPaneOpen",isAskDrawerOpen:e==="isAskDrawerOpen",askDrawerEvictedPane:null}),Yt=(e,t)=>{const n=e.rightSlotKey;return typeof n!="string"?{}:{rightSlotMemory:Gf(e.rightSlotMemory,n,t)}},zn=(e,t)=>{const n=e.rightSlotKey;if(typeof n!="string")return{};const r=jE(e.rightSlotMemory,n,t);return r===e.rightSlotMemory?{}:{rightSlotMemory:r}},UE=e=>{const t=e.rightSlotKey;if(typeof t!="string")return{};const n=ME(e.rightSlotMemory,t);return n===e.rightSlotMemory?{}:{rightSlotMemory:n}},FE=Object.freeze({mounted:!1,session:!1}),Hf=Object.freeze([]);function $C(e,t){const n=Mr(t);if(n===null||!Li(n,t))return 0;let r;switch(n){case"canvas":case"ask":r=Zn(Af,t.rightSlotWidth);break;case"run":r=Zn(Bl,t.rightSlotWidth);break;case"browser":r=Zn(zE,t.rightSlotWidth);break;case"console":r=Zn(ZE,t.rightSlotWidth);break;case"code":r=Zn(Bl,t.rightSlotWidth);break}return e<=0?r:n==="canvas"||n==="ask"?Math.min(r,Pf(e)):Math.min(r,Math.max(0,e-la))}function Zn(e,t){return Math.min(Of,Math.max(e,t||BE))}function UC(e){const t=Mr(e);return t!==null&&Li(t,e)}function FC(e){const t=Mr(e);return t!==null&&Li(t,e)?t:null}function BC(e){const t=Mr(e);return(t==="canvas"||t==="ask")&&Li(t,e)}const BE=640,Fl=ji,GE=20,HE=4,WE=20,Bl=320,zE=480,ZE=480,KE=5e3,GC=(e,t)=>e.some(n=>n.surface===t),HC=(e,t=Date.now())=>e.some(n=>t-n.at<KE),VE=[],YE=4,QE=["chatMeasureWidth"],WC=Cr()(xi((e,t)=>({finderFiles:Df,setFinderFiles:n=>e({finderFiles:pa({...t().finderFiles,...n})}),isCommandPaletteOpen:!1,commandPaletteQuery:"",isSidebarCollapsed:!1,sidebarOverflowExpanded:!1,showAgentReasoning:!1,transcriptDisplayMode:$f,themeName:ep,rightSlotWidth:0,chatSidebarWidth:Fl,chatSidebarRegions:gE,chatSidebarView:bn,chatSidebarListHeight:null,chatSidebarOrder:"entities-first",dismissedBuiltinOfferSignature:"",isCanvasOpen:!1,isRunPanelOpen:!1,isBrowserPaneOpen:!1,isConsolePaneOpen:!1,isCodeReviewPaneOpen:!1,rightSlotKey:void 0,rightSlotMemory:Hf,rightSlotLegacySeed:null,isAskDrawerOpen:!1,askDrawerScope:"session",askDrawerEvictedPane:null,askOpenIntent:null,rightSlotRoute:FE,consoleOpenIntent:null,consoleLiveSurface:null,runPanelReveal:null,codeReviewReveal:null,browserPaneScope:"conversation",consoleActiveSurface:null,consoleUnseen:VE,isCreateAgentDialogOpen:!1,mentionRecents:null,profileRecents:{agent:[],team:[]},conversationRecents:[],shortcutBindings:{},openCreateAgentDialog:()=>{e({isCreateAgentDialogOpen:!0})},closeCreateAgentDialog:()=>{e({isCreateAgentDialogOpen:!1})},openCommandPalette:()=>{e({isCommandPaletteOpen:!0})},closeCommandPalette:()=>{e({isCommandPaletteOpen:!1,commandPaletteQuery:""})},toggleCommandPalette:(n="")=>{e(r=>({isCommandPaletteOpen:!r.isCommandPaletteOpen,commandPaletteQuery:r.isCommandPaletteOpen?r.commandPaletteQuery:n}))},setCommandPaletteQuery:n=>{e({commandPaletteQuery:n})},toggleSidebar:()=>{e(n=>({isSidebarCollapsed:!n.isSidebarCollapsed}))},setSidebarOverflowExpanded:n=>{e({sidebarOverflowExpanded:n})},setSidebarCollapsed:n=>{e({isSidebarCollapsed:n})},setShowAgentReasoning:n=>{e({showAgentReasoning:n})},setTranscriptDisplayMode:n=>{e({transcriptDisplayMode:n})},setTheme:n=>{e({themeName:n})},setCanvasOpen:n=>{e(r=>n?{...Dt("isCanvasOpen"),...Yt(r,"canvas")}:{isCanvasOpen:!1,...zn(r,"canvas")})},setRunPanelOpen:n=>{e(r=>n?{...Dt("isRunPanelOpen"),...Yt(r,"run")}:{isRunPanelOpen:!1,...zn(r,"run")})},setBrowserPaneOpen:n=>{e(r=>n?{...Dt("isBrowserPaneOpen"),...Yt(r,"browser")}:{isBrowserPaneOpen:!1,...zn(r,"browser")})},setConsolePaneOpen:n=>{e(r=>n?{...Dt("isConsolePaneOpen"),...Yt(r,"console")}:{isConsolePaneOpen:!1,...zn(r,"console")})},setCodeReviewPaneOpen:n=>{e(r=>n?{...Dt("isCodeReviewPaneOpen"),...Yt(r,"code")}:{isCodeReviewPaneOpen:!1,...zn(r,"code")})},clearCodeReviewReveal:n=>{e(r=>r.codeReviewReveal?.nonce===n?{codeReviewReveal:null}:{})},revealCodeReviewPane:()=>{e(n=>({...Dt("isCodeReviewPaneOpen"),...Yt(n,"code"),codeReviewReveal:{nonce:(n.codeReviewReveal?.nonce??0)+1}}))},setAskDrawerOpen:(n,r,i)=>{e(s=>{const a=typeof s.rightSlotKey=="string";if(n)return{...Dt("isAskDrawerOpen"),askDrawerScope:r,askDrawerEvictedPane:a?null:$E(s),askOpenIntent:null};const c={isAskDrawerOpen:!1,askDrawerEvictedPane:null,askOpenIntent:null};return a?i?.dismissSlot?{...c,...UE(s)}:{...c,...$l(s.rightSlotMemory,s.rightSlotKey,!1)}:s.rightSlotKey===null?i?.dismissSlot?{...c,rightSlotLegacySeed:null}:c:i?.dismissSlot?{...c,rightSlotLegacySeed:null}:{...c,...s.askDrawerEvictedPane===null?null:{[s.askDrawerEvictedPane]:!0}}})},requestAskOpen:(n,r="menu")=>{e({askOpenIntent:{scope:n,via:r}})},clearAskOpenIntent:n=>{e(r=>r.askOpenIntent?.scope===n?{askOpenIntent:null}:{})},setConsoleActiveSurface:n=>{e({consoleActiveSurface:n})},requestConsoleOpen:n=>{e({consoleOpenIntent:n})},clearConsoleOpenIntent:n=>{e(r=>r.consoleOpenIntent===n?{consoleOpenIntent:null}:{})},setConsoleLiveSurface:(n,r)=>{e(i=>{if(n===null||r<=0)return i.consoleLiveSurface===null?{}:{consoleLiveSurface:null};const s=i.consoleLiveSurface;return s?.sessionId===n&&s.count===r?{}:{consoleLiveSurface:{sessionId:n,count:r}}})},markConsoleUnseen:(n,r)=>{e(i=>i.consoleUnseen.some(s=>s.surface===r)?{}:{consoleUnseen:[...i.consoleUnseen,{sessionId:n,surface:r,at:Date.now()}]})},clearConsoleUnseen:n=>{const r=Array.isArray(n)?n:[n];e(i=>{const s=i.consoleUnseen.filter(a=>!r.includes(a.surface));return s.length===i.consoleUnseen.length?{}:{consoleUnseen:s}})},setRightSlotWidth:n=>{e({rightSlotWidth:n})},restoreDefaultRightSlotWidth:()=>{e({rightSlotWidth:0})},bindRightSlotKey:(n,r)=>{e(i=>{let s=i.rightSlotMemory,a=i.rightSlotLegacySeed;const c=r?.admittedFrom;return typeof c=="string"&&typeof n=="string"&&(s=DE(s,c,n)),n===null||(ga(n)?a=null:a!==null&&jr(s,n)===void 0&&(s=Gf(s,n,a),a=null)),{rightSlotKey:n,rightSlotMemory:s,rightSlotLegacySeed:a,...$l(s,n,i.isAskDrawerOpen)}})},setRightSlotRoute:n=>{const r=t().rightSlotRoute;r.mounted===n.mounted&&r.session===n.session||e({rightSlotRoute:{...n}})},setShortcutBinding:(n,r,i)=>{if(r===null){e(a=>{const c={...a.shortcutBindings};return delete c[n],{shortcutBindings:c}});return}const s=ma(r);s!==null&&AE(s,n,t().shortcutBindings,"linux",i)===null&&e(a=>({shortcutBindings:{...a.shortcutBindings,[n]:s}}))},clearShortcutBinding:n=>{e(r=>({shortcutBindings:{...r.shortcutBindings,[n]:null}}))},setBrowserPaneScope:n=>{e({browserPaneScope:n})},revealRunPanelSection:n=>{e(r=>({...Dt("isRunPanelOpen"),...Yt(r,"run"),runPanelReveal:{section:n,nonce:(r.runPanelReveal?.nonce??0)+1}}))},clearRunPanelReveal:n=>{e(r=>r.runPanelReveal?.nonce===n?{runPanelReveal:null}:{})},setChatSidebarWidth:n=>{e({chatSidebarWidth:Math.min(ca,Math.max(aa,n))})},setChatSidebarRegions:n=>{e({chatSidebarRegions:n})},setChatSidebarListHeight:n=>{e({chatSidebarListHeight:n})},restoreDefaultChatSidebarListHeight:()=>{e({chatSidebarListHeight:null})},setChatSidebarOrder:n=>{e({chatSidebarOrder:n})},setChatSidebarView:n=>{e({chatSidebarView:n})},dismissBuiltinOffer:n=>{e({dismissedBuiltinOfferSignature:n})},restoreDefaultChatSidebarWidth:()=>{e({chatSidebarWidth:Fl})},rememberMention:(n,r)=>{e(i=>{const s=i.mentionRecents,a=s?.cwd===n?s.paths:[],c=[r,...a.filter(l=>l!==r)].slice(0,GE);return{mentionRecents:{cwd:n,paths:c}}})},rememberProfile:(n,r)=>{e(i=>({profileRecents:{...i.profileRecents,[n]:JE(i.profileRecents[n]??[],r)}}))},rememberConversation:n=>{e(r=>{const i=ex(r.conversationRecents),s=XE(i,n);return s.length===i.length&&s.every((a,c)=>a===i[c])?r:{conversationRecents:s}})}}),{name:"ui-preferences-storage",version:YE,migrate:ix,partialize:tx,merge:rx}));function JE(e,t){return[t,...e.filter(n=>n!==t)].slice(0,HE)}function XE(e,t){return[t,...e.filter(n=>n!==t)].slice(0,WE)}const qE=[];function ex(e){return Array.isArray(e)?e:qE}function tx(e){const{runPanelReveal:t,codeReviewReveal:n,consoleOpenIntent:r,consoleLiveSurface:i,askOpenIntent:s,isAskDrawerOpen:a,askDrawerScope:c,askDrawerEvictedPane:l,rightSlotRoute:d,isCanvasOpen:u,isRunPanelOpen:f,isBrowserPaneOpen:p,isConsolePaneOpen:g,isCodeReviewPaneOpen:y,rightSlotKey:m,...b}=e;return{...b,rightSlotMemory:nx(e.rightSlotMemory)}}function nx(e){return(e??Hf).filter(([t])=>!ga(t))}function rx(e,t){const n=e??{},{isCanvasOpen:r,isRunPanelOpen:i,isBrowserPaneOpen:s,isConsolePaneOpen:a,isCodeReviewPaneOpen:c,...l}=n;return{...t,...l,finderFiles:pa(n.finderFiles),rightSlotKey:t.rightSlotKey,rightSlotMemory:NE(n.rightSlotMemory),rightSlotLegacySeed:Bf(n.rightSlotLegacySeed)?n.rightSlotLegacySeed:null,shortcutBindings:OE(n.shortcutBindings)}}function ix(e,t){const n={...e??{}};if(t<1&&sx(n),t<2)for(const r of QE)delete n[r];if(t<3){let r=null;for(const i of bo)if(n[Ul(i)]===!0){r=i;break}r!==null&&(n.rightSlotLegacySeed=r);for(const i of bo)delete n[Ul(i)]}return t<4&&(n.finderFiles=pa(n.finderFiles)),n}function sx(e){const t=[["canvasWidth",800],["runPanelWidth",420],["browserPanelWidth",640],["consolePanelWidth",796]];let n=0;for(const[r,i]of t){const s=e[r];if(typeof s=="number"&&s>0&&s!==i){n=s;break}}for(const[r]of t)delete e[r];e.rightSlotWidth=n}const ox="data-canvas-shortcuts",ax=`[${ox}]`,cx=e=>Wf(e,ax),lx='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"]',zC=e=>Wf(e,lx);function Wf(e,t){const n=e;return typeof n?.closest=="function"?n.closest(t)!==null:!1}const ZC=e=>{if(!(e.metaKey||e.ctrlKey))return null;const t=e.key.toLowerCase();return t==="o"?"open-file":t==="n"&&cx(e.target)?"new-file":null},vo=e=>e.replace(/\\/g,"/"),KC=()=>window.location.hash?vo(window.location.hash.substring(1)):vo(window.location.pathname),VC=(e,t)=>{if(t!==null&&(e===t||e.startsWith(`${t}/`)||e.startsWith(`${t}\\`))){const r=e.substring(t.length);return r.startsWith("/")||r.startsWith("\\")||r===""?`~${r.replace(/\\/g,"/")}`:`~/${r.replace(/\\/g,"/")}`}return e==="~"?"~":e.replace(/\\/g,"/")},YC=(e,t)=>{if(e.length<=t)return e;const n=e.split("/"),r=n[n.length-1]??"";if(r.length+1>=t)return`…${r.slice(-39)}`;const i=n[0]==="~"||n[0]==="",s=i?n.slice(0,2):n.slice(0,1),a=n.slice(s.length),c=y=>{const m=t-y.length-(y?3:2);let b=[];for(let _=a.length-1;_>=0;_-=1){const k=[a[_],...b];if(k.join("/").length>m)break;b=k}return b},l=(y,m)=>y?`${y}/…/${m.join("/")}`:`…/${m.join("/")}`,d=s.join("/"),u=c(d);if(u.length>0)return u.length===a.length?e:l(d,u);const f=i?n[0]:"",p=c(f);if(p.length>0)return l(f,p);const g=t-(f?`${f}/…/`.length:2);return g>0?l(f,[r.slice(-g)]):"…"},QC=(e,t)=>vo(e).includes(t);export{Pi as $,gS as A,WC as B,Le as C,jC as D,vE as E,Id as F,ye as G,sS as H,oS as I,_T as J,nf as K,fT as L,rf as M,pT as N,lT as O,hc as P,gT as Q,hT as R,Ge as S,uT as T,of as U,mT as V,zT as W,KC as X,ff as Y,OT as Z,PT as _,nI as a,Ed as a$,zC as a0,ex as a1,Jg as a2,tT as a3,Cr as a4,ZR as a5,Tx as a6,xi as a7,Am as a8,eI as a9,Rr as aA,De as aB,Hl as aC,bp as aD,kp as aE,Ip as aF,Op as aG,Tp as aH,Cp as aI,Ga as aJ,jp as aK,Ha as aL,Pp as aM,Ap as aN,FT as aO,LS as aP,NS as aQ,wT as aR,QC as aS,vx as aT,bx as aU,yx as aV,_x as aW,kx as aX,nm as aY,st as aZ,nr as a_,Kx as aa,Fm as ab,Bm as ac,vc as ad,Rx as ae,Ix as af,wd as ag,vo as ah,K_ as ai,wx as aj,o as ak,Zl as al,Ki as am,Jh as an,Qh as ao,ER as ap,K0 as aq,yR as ar,vR as as,wR as at,Vu as au,tb as av,TS as aw,tI as ax,yo as ay,OC as az,Qx as b,yC as b$,_m as b0,qe as b1,FC as b2,DC as b3,HR as b4,Ht as b5,Ja as b6,Ro as b7,Vm as b8,ki as b9,om as bA,ip as bB,am as bC,ua as bD,$x as bE,kl as bF,Hx as bG,RS as bH,cE as bI,Dl as bJ,rC as bK,vC as bL,wC as bM,SC as bN,nC as bO,vT as bP,yT as bQ,pf as bR,UT as bS,kC as bT,pC as bU,hC as bV,Rn as bW,bn as bX,eC as bY,Mf as bZ,oC as b_,hd as ba,rS as bb,dT as bc,Q as bd,cT as be,yn as bf,lo as bg,uo as bh,oT as bi,aT as bj,nT as bk,rT as bl,iT as bm,NC as bn,HC as bo,KE as bp,GC as bq,e_ as br,qx as bs,Xx as bt,Jx as bu,Sd as bv,Gx as bw,Dx as bx,kd as by,Vg as bz,rI as c,Yx as c$,xr as c0,_C as c1,bC as c2,uC as c3,fC as c4,Il as c5,cC as c6,aC as c7,lC as c8,Xk as c9,Bw as cA,sI as cB,UC as cC,FE as cD,Zn as cE,$C as cF,YT as cG,VT as cH,Af as cI,Pf as cJ,Bx as cK,Fx as cL,zE as cM,Of as cN,ZE as cO,Bl as cP,Ml as cQ,la as cR,mR as cS,gR as cT,DT as cU,MT as cV,NT as cW,$T as cX,LT as cY,m_ as cZ,Pr as c_,dC as ca,iC as cb,mC as cc,gC as cd,Qk as ce,bT as cf,Mi as cg,tC as ch,jT as ci,sC as cj,qT as ck,EC as cl,xC as cm,TC as cn,CC as co,mE as cp,IC as cq,Ir as cr,RC as cs,AC as ct,Ex as cu,ZC as cv,VC as cw,YC as cx,PC as cy,gx as cz,Re as d,Vx as d$,ql as d0,na as d1,WR as d2,xR as d3,JR as d4,XR as d5,df as d6,wS as d7,Ai as d8,TT as d9,XT as dA,KT as dB,$k as dC,jf as dD,fp as dE,bE as dF,hx as dG,ga as dH,LC as dI,Ua as dJ,px as dK,fx as dL,As as dM,rr as dN,gp as dO,Rp as dP,Mp as dQ,Bb as dR,un as dS,Sf as dT,GT as dU,Ek as dV,bf as dW,BT as dX,WT as dY,ZT as dZ,zx as d_,CT as da,ey as db,zR as dc,TR as dd,$0 as de,hS as df,lf as dg,fS as dh,wl as di,ST as dj,cx as dk,RT as dl,sT as dm,Ox as dn,Px as dp,Zx as dq,Di as dr,Ni as ds,Ff as dt,AE as du,ha as dv,MC as dw,zt as dx,sn as dy,Fs as dz,iI as e,sR as e$,Ei as e0,Ye as e1,xS as e2,BC as e3,JT as e4,da as e5,QT as e6,Cf as e7,Fk as e8,aa as e9,jo as eA,Wt as eB,mt as eC,GI as eD,HI as eE,FI as eF,UI as eG,jI as eH,RI as eI,TI as eJ,AI as eK,CI as eL,ou as eM,LI as eN,pR as eO,Dy as eP,ny as eQ,$I as eR,uv as eS,oR as eT,_u as eU,cR as eV,rR as eW,iR as eX,aR as eY,cv as eZ,us as e_,jx as ea,tc as eb,Cg as ec,Mx as ed,um as ee,DR as ef,NR as eg,Cx as eh,Ax as ei,MR as ej,Yu as ek,Lw as el,ku as em,$f as en,su as eo,jg as ep,Nx as eq,_R as er,bR as es,RR as et,IR as eu,SR as ev,wn as ew,Ux as ex,Wx as ey,Lx as ez,Sx as f,YR as f$,fv as f0,eR as f1,zI as f2,XI as f3,dR as f4,WI as f5,qI as f6,nR as f7,fR as f8,uR as f9,MI as fA,vI as fB,Gy as fC,kI as fD,EI as fE,II as fF,xI as fG,bI as fH,OI as fI,hR as fJ,UR as fK,LR as fL,Qw as fM,BR as fN,$R as fO,FR as fP,GR as fQ,yI as fR,wI as fS,To as fT,Hs as fU,yp as fV,kR as fW,KR as fX,VR as fY,gs as fZ,QR as f_,tR as fa,ZI as fb,KI as fc,VI as fd,YI as fe,QI as ff,JI as fg,lR as fh,cm as fi,lm as fj,dm as fk,Dc as fl,_I as fm,DI as fn,kb as fo,iu as fp,tu as fq,SI as fr,xo as fs,rc as ft,ma as fu,yE as fv,PI as fw,vb as fx,NI as fy,BI as fz,Xg as g,qR as g0,Z0 as g1,eT as g2,AR as g3,$d as g4,yr as g5,mI as g6,j_ as g7,Ud as g8,Mo as g9,Dd as ga,b_ as gb,v_ as gc,pI as gd,im as ge,fI as gf,cI as gg,dI as gh,Ac as gi,aI as gj,oI as gk,uI as gl,Oc as gm,lI as gn,yd as go,gI as gp,hI as gq,xT as gr,CR as gs,jR as gt,OR as gu,PR as gv,kT as gw,ET as gx,Xh as gy,nc as gz,Co as h,Xl as i,Im as j,Rm as k,Tm as l,Cm as m,HT as n,Sk as o,xx as p,o_ as q,t_ as r,Dp as s,mx as t,Sp as u,jS as v,Ke as w,IT as x,AT as y,yS as z};