@open-mercato/cezar 0.20.0-pr2192.5251 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/server/agent-setup-routes.d.ts +14 -14
  2. package/dist/server/dashboard.d.ts +54 -54
  3. package/dist/server/server.d.ts +68 -68
  4. package/dist/server/worktree-lifecycle.d.ts +90 -90
  5. package/dist/telemetry-service.json +1 -0
  6. package/dist/workflows/run-env-keys.d.ts +8 -0
  7. package/dist/workflows/run-env-keys.js +14 -0
  8. package/dist/workflows/run-env-keys.js.map +1 -0
  9. package/package.json +5 -5
  10. package/web/dist/assets/{active-forge-KyXM3uG9.js → active-forge-CkAcQPDz.js} +1 -1
  11. package/web/dist/assets/{agent-task-pickers-UkVtTCna.js → agent-task-pickers-BXCIulS3.js} +1 -1
  12. package/web/dist/assets/{alert-dialog-DT465VL4.js → alert-dialog-B2Vi6MQZ.js} +1 -1
  13. package/web/dist/assets/{ask-card-DVv8mY_R.js → ask-card-DPIjQSs8.js} +1 -1
  14. package/web/dist/assets/{assets-view-D22vr-oN.js → assets-view-CsFjfV2n.js} +1 -1
  15. package/web/dist/assets/{automation-format-KxcnBz7L.js → automation-format-CMG-6CYi.js} +1 -1
  16. package/web/dist/assets/{automations-route-3gfbxDq2.js → automations-route-Dd7F6b4F.js} +1 -1
  17. package/web/dist/assets/{button-CEskWahs.js → button-CJXK1JqU.js} +1 -1
  18. package/web/dist/assets/{centered-state-Cpzaj75Y.js → centered-state-DE6sgEMs.js} +1 -1
  19. package/web/dist/assets/{chip-CEZRGBV7.js → chip-DTCkrr8F.js} +1 -1
  20. package/web/dist/assets/{collapsible-ZLdkcdMa.js → collapsible-DHALizq-.js} +1 -1
  21. package/web/dist/assets/{command-CcbuBum7.js → command-CwP_dLx3.js} +1 -1
  22. package/web/dist/assets/{commit-list-BSjLQA6p.js → commit-list-BJeaIEp4.js} +1 -1
  23. package/web/dist/assets/{compare-variants-C9soYpuE.js → compare-variants-CYv97XSw.js} +1 -1
  24. package/web/dist/assets/{composer-Bz8ZfbHr.js → composer-C-aBJhY0.js} +1 -1
  25. package/web/dist/assets/{composer-attachments-BD2enHFJ.js → composer-attachments-ChelZhq4.js} +1 -1
  26. package/web/dist/assets/{dashboard-Bl6qWW8i.js → dashboard-Dh65_Yi7.js} +1 -1
  27. package/web/dist/assets/{dialog-nn9sCNvn.js → dialog-DVZE8yAO.js} +1 -1
  28. package/web/dist/assets/{diff-FrEDv09S.js → diff-aKT-mpn8.js} +2 -2
  29. package/web/dist/assets/{diff-stat-zisAayZW.js → diff-stat-DPetRUXO.js} +1 -1
  30. package/web/dist/assets/{diff-view-BeoeZVcx.js → diff-view-m4TvXu0y.js} +1 -1
  31. package/web/dist/assets/{dist-B_KqW6o6.js → dist-Bsi6zLdE.js} +1 -1
  32. package/web/dist/assets/{dropdown-menu-ayNafd3n.js → dropdown-menu-BKvUsb5Y.js} +1 -1
  33. package/web/dist/assets/{file-preview-Dzc3RFUx.js → file-preview-C2EkjhOh.js} +1 -1
  34. package/web/dist/assets/{follow-up-engine-Dul_3U9s.js → follow-up-engine-BnRCTyQ4.js} +1 -1
  35. package/web/dist/assets/{git-tab-loading-DG4p-eF4.js → git-tab-loading-DpG2D8Vl.js} +1 -1
  36. package/web/dist/assets/{github-DvZE0hDJ.js → github-CWRtsamJ.js} +1 -1
  37. package/web/dist/assets/{host-usage-GTjB03IM.js → host-usage-B8ohHYHR.js} +1 -1
  38. package/web/dist/assets/{icon-tooltip-DRhwcic2.js → icon-tooltip-DYk5cjLx.js} +1 -1
  39. package/web/dist/assets/{impact-control-CTdtyfcn.js → impact-control-ClslFBBA.js} +1 -1
  40. package/web/dist/assets/{impact-model-CpNcUgTV.js → impact-model-DCDyRxcf.js} +1 -1
  41. package/web/dist/assets/{index-BMA7ZpLG.js → index-BfbbA0lF.js} +4 -4
  42. package/web/dist/assets/{input-BtDLUR9Q.js → input-DofKzJZl.js} +1 -1
  43. package/web/dist/assets/{loading-state-BTvZxCb2.js → loading-state-NiNQtJ5H.js} +1 -1
  44. package/web/dist/assets/{manager-avatar-Ct1uVuvZ.js → manager-avatar-CKfqcoJQ.js} +1 -1
  45. package/web/dist/assets/{manager-chat-BfxPyXv3.js → manager-chat-BdigDKYZ.js} +1 -1
  46. package/web/dist/assets/{manager-index-CeMdRtKd.js → manager-index-D0TOmxr6.js} +1 -1
  47. package/web/dist/assets/{manager-new-Bs8_CMUR.js → manager-new-CCet_7u8.js} +1 -1
  48. package/web/dist/assets/{manager-settings-Bv2EqZvs.js → manager-settings-I1AeATjr.js} +1 -1
  49. package/web/dist/assets/{managers-DDPXJoKR.js → managers-Dr63u21Y.js} +1 -1
  50. package/web/dist/assets/{markdown-3rt1rOmI.js → markdown-CXJIKz2i.js} +1 -1
  51. package/web/dist/assets/{markdown-LlPZylt7.js → markdown-YSf01kqC.js} +1 -1
  52. package/web/dist/assets/{mascot-picker-BuGxdrpW.js → mascot-picker-C4s7n9Fc.js} +1 -1
  53. package/web/dist/assets/{new-task-form-BoiK41PS.js → new-task-form-2p4cXcVQ.js} +1 -1
  54. package/web/dist/assets/{picker-pill-CzANlEqt.js → picker-pill-Dv9H0dRF.js} +1 -1
  55. package/web/dist/assets/{pill-C2wRS9lg.js → pill-CoDPUIcJ.js} +1 -1
  56. package/web/dist/assets/{popover-DPba6FvD.js → popover-DUg9gBOn.js} +1 -1
  57. package/web/dist/assets/{project-router-CnMbTz-a.js → project-router-B1Q3upIJ.js} +1 -1
  58. package/web/dist/assets/{project-terminal-sfYncenW.js → project-terminal-DbIohh5G.js} +2 -2
  59. package/web/dist/assets/{provider-auth-alert-DbNH_-XT.js → provider-auth-alert-GxIEkIvw.js} +1 -1
  60. package/web/dist/assets/{queries-DVZ1lYAo.js → queries-BQUz3Wnb.js} +1 -1
  61. package/web/dist/assets/{reasoning-effort-pill-al6bbPpw.js → reasoning-effort-pill-BOV3C0If.js} +1 -1
  62. package/web/dist/assets/{reference-chip-DdxKs2_A.js → reference-chip-BpbybBvl.js} +1 -1
  63. package/web/dist/assets/{reference-conflict-action-Ci4LDmIm.js → reference-conflict-action-ByDYwT-Y.js} +1 -1
  64. package/web/dist/assets/{repo-git-BcEGYBrc.js → repo-git-ikURCYEK.js} +1 -1
  65. package/web/dist/assets/{run-actions-CDKK-8MP.js → run-actions-ChUnbFA7.js} +1 -1
  66. package/web/dist/assets/{run-diff-JJOUeclX.js → run-diff-B08Fk7dR.js} +1 -1
  67. package/web/dist/assets/{scroll-within-CfS_Ia4E.js → scroll-within-DMA4ZbQV.js} +1 -1
  68. package/web/dist/assets/{segmented-Chb1Y4ie.js → segmented-DI7abdqX.js} +1 -1
  69. package/web/dist/assets/{select-DG3hFvx2.js → select-DL5E3ZAD.js} +1 -1
  70. package/web/dist/assets/{sheet-DirfZrZD.js → sheet-DPwaj6sk.js} +1 -1
  71. package/web/dist/assets/{skills-CxWFZgjH.js → skills-BNiKFlUw.js} +1 -1
  72. package/web/dist/assets/{spinner-CwKcijCN.js → spinner-hSpq0sPM.js} +1 -1
  73. package/web/dist/assets/{status-dot-CZAbXsOs.js → status-dot-AP_4obOJ.js} +1 -1
  74. package/web/dist/assets/{tabs-r4PCzkHp.js → tabs-DrhZb97I.js} +1 -1
  75. package/web/dist/assets/{task-commits-CHnonzuD.js → task-commits-Di0Mc8MX.js} +1 -1
  76. package/web/dist/assets/{task-graph-DZAjkdmH.js → task-graph-Bpi3lEER.js} +1 -1
  77. package/web/dist/assets/{task-notes-CHs_WZf5.js → task-notes-DCHLinAF.js} +1 -1
  78. package/web/dist/assets/{task-workspace-DWGBLHlR.js → task-workspace-DHl5akxu.js} +3 -3
  79. package/web/dist/assets/{telemetry-onLa6CTl.js → telemetry-3DhVDxf8.js} +1 -1
  80. package/web/dist/assets/{terminal-drawer-DV7kUP0D.js → terminal-drawer-CEktqC3z.js} +1 -1
  81. package/web/dist/assets/{terminal-pane-DQAHtCtb.js → terminal-pane-CmmTwiTX.js} +1 -1
  82. package/web/dist/assets/{terminal-scope-CEQdw5Tz.js → terminal-scope-okFE6qRP.js} +1 -1
  83. package/web/dist/assets/{textarea-BqeSvPOp.js → textarea-DDyYxCcO.js} +1 -1
  84. package/web/dist/assets/{thread-items-CNxMLcOo.js → thread-items-C-4IW5zi.js} +1 -1
  85. package/web/dist/assets/{toaster-4t61QM_C.js → toaster-BoJZiTRl.js} +1 -1
  86. package/web/dist/assets/{tracker-B7u8exjG.js → tracker-bQUG9SkJ.js} +1 -1
  87. package/web/dist/assets/{tree-pane-resize-XHzIJDtc.js → tree-pane-resize-xgVK7J9r.js} +1 -1
  88. package/web/dist/assets/utils-Dp6vCdiU.js +55 -0
  89. package/web/dist/assets/{workflow-graph-BaZd6m6v.js → workflow-graph-CGMeFErv.js} +1 -1
  90. package/web/dist/assets/{worktree-lifecycle-YFVatYLd.js → worktree-lifecycle-C18dBDW4.js} +1 -1
  91. package/web/dist/assets/{worktree-lifecycle-operation-CYHhFvQF.js → worktree-lifecycle-operation-_xqKBVKB.js} +1 -1
  92. package/web/dist/assets/{zoomable-image-D4B6jvp-.js → zoomable-image-BiM5LfTG.js} +1 -1
  93. package/web/dist/index.html +46 -46
  94. package/web/dist/assets/utils-DWwoYTjU.js +0 -60
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$ as r,Ht as i,It as a,Nt as o,Pt as s,Q as c,Rt as l,Vt as u,_ as d,_t as f,a as p,c as m,d as h,et as g,h as ee,i as _,l as v,o as te,pt as y,s as ne,v as re}from"./utils-DWwoYTjU.js";var ie=/^[\w!#$%&'*.^`|~+-]+$/,ae=(e,t,n={})=>{if(!ie.test(e))throw Error(`Invalid cookie name`);let r=`${e}=${t}`;if(e.startsWith(`__Secure-`)&&!n.secure)throw Error(`__Secure- Cookie must have Secure attributes`);if(e.startsWith(`__Host-`)){if(!n.secure)throw Error(`__Host- Cookie must have Secure attributes`);if(n.path!==`/`)throw Error(`__Host- Cookie must have Path attributes with "/"`);if(n.domain)throw Error(`__Host- Cookie must not have Domain attributes`)}for(let e of[`domain`,`path`,`sameSite`,`priority`])if(n[e]&&/[;\r\n]/.test(n[e]))throw Error(`${e} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge==`number`&&n.maxAge>=0){if(n.maxAge>3456e4)throw Error(`Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.`);r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!==`host`&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw Error(`Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw Error(`Partitioned Cookie must have Secure attributes`);r+=`; Partitioned`}return r},oe=(e,t,n)=>(t=encodeURIComponent(t),ae(e,t,n)),se=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),ce=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??`);e=e.replace(t,r?`/${r}`:``)}return e},le=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.set(n,r);return t},ue=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},de=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function fe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pe(e,t){if(!fe(e)&&!fe(t))return t;let n={...e};for(let e in t){let r=t[e];fe(n[e])&&fe(r)?n[e]=pe(n[e],r):n[e]=r}return n}var me=(e,t)=>new Proxy(()=>{},{get(n,r){if(!(typeof r!=`string`||r===`then`))return me(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),he=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor(e,t,n){this.url=e,this.method=t,this.buildSearchParams=n.buildSearchParams}fetch=async(e,t)=>{if(e){if(e.query&&(this.queryParams=this.buildSearchParams(e.query)),e.form){let t=new FormData;for(let[n,r]of Object.entries(e.form))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.append(n,r);this.rBody=t}e.json&&(this.rBody=JSON.stringify(e.json),this.cType=`application/json`),e.param&&(this.pathParams=e.param)}let n=this.method.toUpperCase(),r={...e?.header,...typeof t?.headers==`function`?await t.headers():t?.headers};if(e?.cookie){let t=[];for(let[n,r]of Object.entries(e.cookie))t.push(oe(n,r,{path:`/`}));r.Cookie=t.join(`,`)}this.cType&&(r[`Content-Type`]=this.cType);let i=new Headers(r??void 0),a=this.url;a=de(a),a=ce(a,this.pathParams),this.queryParams&&(a=a+`?`+this.queryParams.toString()),n=this.method.toUpperCase();let o=!(n===`GET`||n===`HEAD`);return(t?.fetch||fetch)(a,{body:o?this.rBody:void 0,method:n,headers:i,...t?.init})}},ge=(e,t)=>me(function n(r){let i=t?.buildSearchParams??le,a=[...r.path],o=a.slice(-3).reverse();if(o[0]===`toString`)return o[1]===`name`?o[2]||``:n.toString();if(o[0]===`valueOf`)return o[1]===`name`?o[2]||``:n;let s=``;if(/^\$/.test(o[0])){let e=a.pop();e&&(s=e.replace(/^\$/,``))}let c=se(e,a.join(`/`));if(s===`url`||s===`path`){let t=c;return r.args[0]&&(r.args[0].param&&(t=ce(c,r.args[0].param)),r.args[0].query&&(t=t+`?`+i(r.args[0].query).toString())),t=de(t),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=ue(r.args[0]&&r.args[0].param?ce(c,r.args[0].param):c,`ws`),n=new URL(e),i=r.args[0]?.query;return i&&Object.entries(i).forEach(([e,t])=>{Array.isArray(t)?t.forEach(t=>n.searchParams.append(e,t)):n.searchParams.set(e,t)}),((...e)=>t?.webSocket!==void 0&&typeof t.webSocket==`function`?t.webSocket(...e):new WebSocket(...e))(n.toString())}let l=new he(c,s,{buildSearchParams:i});if(s){t??={};let e={...r.args[1]},n=t.headers,i=e.headers;n&&i&&(e.headers=async()=>({...typeof n==`function`?await n():n,...typeof i==`function`?await i():i}));let a=pe(t,e);return l.fetch(r.args[0],a)}return l},[]);function _e(e={}){let{baseUrl:t=``,token:n,headers:r,fetch:i}=e;return ge(t,{headers:{...n?{Authorization:`Bearer ${n}`}:{},...r},...i?{fetch:i}:{}})}var b=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(){}},ve=new class extends b{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},ye={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},x=new class{#e=ye;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function be(e){setTimeout(e,0)}var xe=typeof window>`u`||`Deno`in globalThis;function S(){}function Se(e,t){return typeof e==`function`?e(t):e}function Ce(e){return typeof e==`number`&&e>=0&&e!==1/0}function we(e,t){return Math.max(e+(t||0)-Date.now(),0)}function C(e,t){return typeof e==`function`?e(t):e}function w(e,t){return typeof e==`function`?e(t):e}function Te(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==De(o,t.options))return!1}else if(!E(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Ee(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(T(t.options.mutationKey)!==T(a))return!1}else if(!E(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function De(e,t){return(t?.queryKeyHashFn||T)(e)}function T(e){return JSON.stringify(e,(e,t)=>je(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function E(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>E(e[n],t[n])):!1}var Oe=Object.prototype.hasOwnProperty;function ke(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Ae(e)&&Ae(t);if(!r&&!(je(e)&&je(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Oe.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=ke(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function D(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Ae(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function je(e){if(!Me(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Me(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Me(e){return Object.prototype.toString.call(e)===`[object Object]`}function Ne(e){return new Promise(t=>{x.setTimeout(t,e)})}function Pe(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ke(e,t)}function Fe(e){return e}function Ie(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Le(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Re=Symbol();function ze(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Re?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Be(e,t){return typeof e==`function`?e(...t):!!e}function Ve(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var O=(()=>{let e=()=>xe;return{isServer(){return e()},setIsServer(t){e=t}}})();function He(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Ue=be;function We(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Ue,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var k=We(),Ge=new class extends b{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let 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.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Ke(e){return Math.min(1e3*2**e,3e4)}function qe(e){return(e??`online`)!==`online`||Ge.isOnline()}var Je=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ye(e){let t=!1,n=0,r,i=He(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Je(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>ve.isFocused()&&(e.networkMode===`always`||Ge.isOnline())&&e.canRun(),u=()=>qe(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(O.isServer()?0:3),o=e.retryDelay??Ke,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),Ne(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Xe=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ce(this.gcTime)&&(this.#e=x.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(O.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(x.clearTimeout(this.#e),this.#e=void 0)}};function Ze(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Ve(e,()=>t.signal,()=>n=!0)},u=ze(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Le:Ie;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?$e:Qe,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Qe(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Qe(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function $e(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function et(e,t){return t?Qe(e,t)!=null:!1}function tt(e,t){return!t||!e.getPreviousPageParam?!1:$e(e,t)!=null}var nt=class extends Xe{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=at(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=at(this.options);e.data!==void 0&&(this.setState(it(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Pe(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(S).catch(S):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>w(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Re||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>C(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!we(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.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.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ze(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Ze(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=Ye({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Je&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Je){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...rt(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...it(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),k.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function rt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:qe(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function it(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function at(e){let 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 ot=class extends b{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=He(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ct(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return lt(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return lt(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof w(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!D(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&ut(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||C(this.options.staleTime,this.#t)!==C(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ft(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(S)),t}#g(){this.#b();let e=C(this.options.staleTime,this.#t);if(O.isServer()||this.#r.isStale||!Ce(e))return;let t=we(this.#r.dataUpdatedAt,e)+1;this.#d=x.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(O.isServer()||w(this.options.enabled,this.#t)===!1||!Ce(this.#p)||this.#p===0)&&(this.#f=x.setInterval(()=>{(this.options.refetchIntervalInBackground||ve.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(x.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(x.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ct(e,t),o=i&&ut(e,n,t,r);(a||o)&&(l={...l,...rt(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=Pe(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=Pe(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,ee=m===`pending`,_=m===`error`,v=ee&&g,te=d!==void 0,y={status:m,fetchStatus:l.fetchStatus,isPending:ee,isSuccess:m===`success`,isError:_,isInitialLoading:v,isLoading:v,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!ee,isLoadingError:_&&!te,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:_&&te,isStale:dt(e,t),refetch:this.refetch,promise:this.#o,isEnabled:w(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=y.data!==void 0,r=y.status===`error`&&!t,i=e=>{r?e.reject(y.error):t&&e.resolve(y.data)},a=()=>{let e=this.#o=y.promise=He();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||y.data!==o.value)&&a();break;case`rejected`:(!r||y.error!==o.reason)&&a();break}}return y}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!D(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){k.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function st(e,t){return w(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&w(t.retryOnMount,e)===!1)}function ct(e,t){return st(e,t)||e.state.data!==void 0&&lt(e,t,t.refetchOnMount)}function lt(e,t,n){if(w(t.enabled,e)!==!1&&C(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&dt(e,t)}return!1}function ut(e,t,n,r){return(e!==t||w(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&dt(e,n)}function dt(e,t){return w(t.enabled,e)!==!1&&e.isStaleByTime(C(t.staleTime,e))}function ft(e,t){return!D(e.getCurrentResult(),t)}var pt=class extends ot{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:et(t,n.data),hasPreviousPage:tt(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},mt=class extends Xe{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||ht(),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.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Ye({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,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{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),k.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ht(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var gt=class extends b{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),D(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&T(t.mutationKey)!==T(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??ht();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){k.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function _t(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function vt(e,t,n){let r=e.slice(0);return r[t]=n,r}var yt=class extends b{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,k.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!D(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(_t(e,n).forEach(e=>{e.destroy()}),_t(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=ke(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new ot(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=vt(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&k.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},A=e(t(),1),bt=n(),xt=A.createContext(void 0),j=e=>{let t=A.useContext(xt);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},St=({client:e,children:t})=>(A.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,bt.jsx)(xt.Provider,{value:e,children:t})),Ct=A.createContext(!1),wt=()=>A.useContext(Ct);Ct.Provider;function Tt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Et=A.createContext(Tt()),Dt=()=>A.useContext(Et),Ot=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Be(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},kt=e=>{A.useEffect(()=>{e.clearReset()},[e])},At=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Be(n,[e.error,r])),jt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Mt=(e,t)=>e.isLoading&&e.isFetching&&!t,Nt=(e,t)=>e?.suspense&&t.isPending,Pt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ft({queries:e,...t},n){let r=j(n),i=wt(),a=Dt(),o=A.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{jt(e);let t=r.getQueryCache().get(e.queryHash);Ot(e,a,t)}),kt(a);let[s]=A.useState(()=>new yt(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;A.useSyncExternalStore(A.useCallback(e=>d?s.subscribe(k.batchCalls(e)):S,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),A.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>Nt(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&Nt(n,e)?Pt(n,new ot(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&At({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function It(e,t,n){let r=wt(),i=Dt(),a=j(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,jt(o),Ot(o,i,s),kt(i);let l=!a.getQueryCache().get(o.queryHash),[u]=A.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(A.useSyncExternalStore(A.useCallback(e=>{let t=f?u.subscribe(k.batchCalls(e)):S;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),A.useEffect(()=>{u.setOptions(o)},[o,u]),Nt(o,d))throw Pt(o,u,i);if(At({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!O.isServer()&&Mt(d,r)&&(l?Pt(o,u,i):s?.promise)?.catch(S).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function M(e,t){return It(e,ot,t)}function N(e,t){let n=j(t),[r]=A.useState(()=>new gt(n,e));A.useEffect(()=>{r.setOptions(e)},[r,e]);let i=A.useSyncExternalStore(A.useCallback(e=>r.subscribe(k.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=A.useCallback((e,t)=>{r.mutate(e,t).catch(S)},[r]);if(i.error&&Be(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Lt(e,t){return It(e,pt,t)}var Rt={projectId:null,apiBase:_},zt=(0,A.createContext)(Rt);function Bt(){return(0,A.useContext)(zt)}function Vt({projectId:e,children:t}){ne()!==e&&h(e),(0,A.useLayoutEffect)(()=>{h(e)},[e]),(0,A.useLayoutEffect)(()=>()=>h(null),[]);let n=(0,A.useMemo)(()=>e===null?Rt:{projectId:e,apiBase:`${_}/p/${encodeURIComponent(e)}`},[e]);return(0,bt.jsx)(zt.Provider,{value:n,children:t})}var Ht={claude:0,codex:1,junie:2,opencode:3,cursor:4,pi:5,copilot:6,omp:7,antigravity:8,gemini:9,kimi:10},Ut=[...l].sort((e,t)=>Ht[e]-Ht[t]),Wt=new Set([`connected`,`disconnected`,`not-installed`,`unknown`]);function Gt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Kt(e,t){if(!Gt(e))return null;let{provider:n,status:r,enabled:i,hint:a,authFailureId:o}=e;return typeof n!=`string`||!Ut.includes(n)||typeof r!=`string`||!Wt.has(r)||t&&typeof i!=`boolean`||!t&&i!==void 0&&typeof i!=`boolean`||a!==void 0&&typeof a!=`string`||o!==void 0&&(typeof o!=`string`||o.length<1||o.length>128||r!==`disconnected`)?null:{provider:n,status:r,...typeof i==`boolean`?{enabled:i}:{},...a===void 0?{}:{hint:a},...o===void 0?{}:{authFailureId:o}}}function qt(e){return Kt(e,!1)}function Jt(e,t){if(!Gt(e)||!Array.isArray(e.providers))return null;let n=[],r=new Set;for(let i of e.providers){let e=Kt(i,t);if(e===null||r.has(e.provider))return null;r.add(e.provider),n.push(e)}return n}function P(e){let t=Jt(e,!0);if(t===null||t.length===0)return null;let n=new Map(t.map(e=>[e.provider,e]));return Ut.flatMap(e=>{let t=n.get(e);return t?[t]:[]})}function Yt(e){let t=P(e);if(t===null)throw Error(`Invalid provider status response`);return{providers:t}}function Xt(e,t){let n=P(e);if(n!==null)return{providers:n.map(e=>e.provider===t.provider?{provider:t.provider,status:t.status,enabled:t.enabled??e.enabled,...t.hint===void 0?{}:{hint:t.hint},...t.authFailureId===void 0?{}:{authFailureId:t.authFailureId}}:e)}}function Zt(e,t,n,r){let i=P(e),a=P(t),o=P(n);if(o===null||a===null)return n;if(i===null)return{providers:a};let s=new Map(i.map(e=>[e.provider,e])),c=new Map(a.map(e=>[e.provider,e]));return{providers:o.map(e=>{let t=s.get(e.provider),n=c.get(e.provider);if(t===void 0||n===void 0)return n??e;let i=r!==void 0&&n.authFailureId===r&&e.authFailureId===void 0;return r!==void 0&&n.authFailureId!==void 0&&n.authFailureId!==r&&e.authFailureId===void 0?n:Qt(t,n)?e:i?{...e,enabled:n.enabled}:n})}}function Qt(e,t){return e.provider===t.provider&&e.status===t.status&&e.enabled===t.enabled&&e.hint===t.hint&&e.authFailureId===t.authFailureId}var $t=new Set([`junie`,`antigravity`,`omp`]);function en(e){return e.status===`connected`||e.status===`unknown`&&$t.has(e.provider)}function tn(e){let t=P(e);if(t===null)return[];let n=new Set(t.filter(e=>e.enabled&&en(e)).map(e=>e.provider));return Ut.filter(e=>n.has(e))}function nn(e,t){return P(e)?.find(e=>e.provider===t)}var rn=`cezar:sid`,an;function on(e=Date.now()){let t=crypto.getRandomValues(new Uint8Array(16));for(let n=0;n<6;n++)t[n]=Math.floor(e/2**(8*(5-n)))&255;t[6]=t[6]&15|112,t[8]=t[8]&63|128;let n=[...t].map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function sn(){try{let e=localStorage.getItem(rn);if(e)return e;let t=on();return localStorage.setItem(rn,t),t}catch{return an??=on()}}var cn=`x-cezar-sid`;function ln(){an=void 0;try{localStorage.removeItem(rn)}catch{}}function un(e){if(typeof e!=`object`||!e)return;let{name:t,message:n}=e;return{name:typeof t==`string`?t:`unknown`,message:typeof n==`string`?n:``}}var dn=/\/(?:providers|agent-profiles)(?:\/|$)/;function fn(e,t){if(!dn.test(e))return;let n=e.split(`/`),r=n[n.indexOf(`providers`)+1];if(n.includes(`providers`)&&c.safeParse(r).success)return r;if(typeof t==`string`)try{let e=JSON.parse(t).provider;return c.safeParse(e).success?e:void 0}catch{return}}var pn=null;function mn(e,t,n,r,i){try{let a=new URL(e,window.location.origin).pathname,o=fn(a,r),s=un(i);pn={method:(t??`GET`).toUpperCase(),path:a,status:n,at:Date.now(),...o?{provider:o}:{},...s?{cause:s}:{}}}catch{}}function hn(e=3e3,t=Date.now()){return pn&&t-pn.at<=e?pn:null}var F=class extends Error{status;manual;command;runIds;exists;constructor(e,t,n={}){super(t,n.cause===void 0?void 0:{cause:n.cause}),this.name=`ApiError`,this.status=e,this.manual=n.manual,this.command=n.command,this.exists=n.exists,this.runIds=n.runIds}};function I(e){try{return JSON.parse(e)}catch{return}}function gn(e){return typeof e==`string`?e:void 0}var _n=`the request was too large for the server, or for a proxy in front of it — attach fewer or smaller files, or raise the proxy body limit (nginx: client_max_body_size 32m)`;function L(e,t,n){let r=I(n),i=r&&typeof r==`object`?r:{},a=gn(i.error)??(e===413?_n:`${e} ${t||`request failed`}`.trim()),o=e===409?ee.safeParse(r):void 0;return new F(e,a,{...o?.success?{runIds:o.data.runIds}:{},manual:gn(i.manual),command:gn(i.command),exists:typeof i.exists==`boolean`?i.exists:void 0})}var R=_e({fetch:(e,t)=>xn(vn(String(e)),t)});function vn(e){let t=bn(e.endsWith(`?`)?e.slice(0,-1):e);return t.startsWith(`/`)?`${te()}${t}`:t}var yn=`${_}/p/default`;function bn(e){if(ne()!==null||!e.startsWith(yn))return e;let t=e.slice(yn.length);return t===``||t.startsWith(`/`)||t.startsWith(`?`)?`${_}${t}`:e}var z=e=>({init:{signal:e?.signal}});async function B(e){try{return await e.text()}catch(t){throw t instanceof DOMException&&t.name===`AbortError`?t:(mn(e.url,void 0,0,void 0,t),new F(0,`cannot reach the cezar server (${e.url})`,{cause:t}))}}async function V(e,t){let n=await B(e);if(!e.ok)throw L(e.status,e.statusText,n);let r=I(n);if(r===void 0)throw new F(e.status,`the cezar server answered ${t} with a non-JSON body`);return r}async function H(e,t,n){let r=e.status,i=await V(e,t),a=n.safeParse(i);if(!a.success)throw new F(r,`the cezar server answered ${t} with an unexpected body`);return a.data}async function xn(e,t){try{let n=new Headers(t?.headers);n.set(cn,sn());let r=await fetch(e,{...t,headers:n,credentials:`include`});return r.ok||mn(e,t?.method,r.status,t?.body),r}catch(n){throw n instanceof DOMException&&n.name===`AbortError`?n:(mn(e,t?.method,0,t?.body,n),new F(0,`cannot reach the cezar server (${e})`,{cause:n}))}}async function Sn(e,t){return xn(p(e),t)}async function Cn(e,t={}){let n=new Headers(t.headers);n.set(`accept`,`text/plain`);let r=await Sn(e,{...t,headers:n}),i=await B(r);if(!r.ok)throw L(r.status,r.statusText,i);return i}var U=(e,t=``)=>`/runs/${encodeURIComponent(e)}${t}`;async function wn(e){return V(await R.api.v1.health.$get({},z(e)),`/health`)}async function Tn(e){return V(await R.api.v1[`star-count`].$get({},z(e)),`/star-count`)}async function En(e){return V(await R.api.v1.preview[`design-proxy`].$post({json:e}),`/preview/design-proxy`)}async function Dn(e){return V(await R.api.v1.telemetry.consent.$get({},z(e)),`/telemetry/consent`)}async function On(e){return V(await R.api.v1.telemetry.consent.$put({json:e}),`/telemetry/consent`)}async function kn(e,t){return V(await R.api.v1.models.$get({query:{runner:e}},z(t)),`/models`)}async function An(e=!1,t){return Yt(await V(await R.api.v1.providers.status.$get({query:e?{refresh:`1`}:{}},z(t)),`/providers/status`))}async function jn(e){return V(await R.api.v1.p[`:projectId`][`launch-key`].$get({param:{projectId:m()}},z(e)),`/launch-key`)}async function Mn(e){return V(await R.api.v1.projects.$get({},z(e)),`/projects`)}async function Nn(e,t){return V(await R.api.v1.fs.browse.$get({query:{path:e===``?void 0:e,...t?.showHidden?{showHidden:`1`}:{}}},z(t)),`/fs/browse`)}async function Pn(e){return V(await R.api.v1.fs.repos.$get({},z(e)),`/fs/repos`)}async function Fn(e){return V(await R.api.v1.projects[`:projectId`][`git-init`].$post({param:{projectId:encodeURIComponent(e)}}),`/projects/${encodeURIComponent(e)}/git-init`)}async function In(e,t){return V(await R.api.v1.projects[`:projectId`][`publish-github`].$post({param:{projectId:encodeURIComponent(e)},json:t}),`/projects/${encodeURIComponent(e)}/publish-github`)}async function Ln(){return V(await R.api.v1.github.login.$post(),`/github/login`)}async function Rn(e){return V(await R.api.v1.github.login.$get({},z(e)),`/github/login`)}async function zn(){return V(await R.api.v1.github.login.$delete(),`/github/login`)}async function Bn(e){return V(await R.api.v1.providers.setup.$get({},z(e)),`/providers/setup`)}async function Vn(e,t){return V(await R.api.v1.providers.setup.sessions.$post({json:{provider:e,action:t}}),`/providers/setup/sessions`)}async function Hn(e,t){return V(await R.api.v1.providers.setup.sessions[`:sessionId`].output.$get({param:{sessionId:e},query:{cursor:String(t)}}),`/providers/setup/sessions/${e}/output`)}async function Un(e,t){await V(await R.api.v1.providers.setup.sessions[`:sessionId`].input.$post({param:{sessionId:e},json:{data:t}}),`/providers/setup/sessions/${e}/input`)}async function Wn(e,t,n){await V(await R.api.v1.providers.setup.sessions[`:sessionId`].resize.$post({param:{sessionId:e},json:{cols:t,rows:n}}),`/providers/setup/sessions/${e}/resize`)}async function Gn(e){await V(await R.api.v1.providers.setup.sessions[`:sessionId`].$delete({param:{sessionId:e}}),`/providers/setup/sessions/${e}`)}async function Kn(e){return V(await R.api.v1.p[`:projectId`].runs.$get({param:{projectId:m()},query:{}},z(e)),`/runs`)}async function qn(e,t){return V(await R.api.v1.p[`:projectId`].runs.$get({param:{projectId:e},query:{}},z(t)),`/runs`)}async function Jn(e){return V(await R.api.v1.workspace[`runs-index`].$get({},z(e)),`/workspace/runs-index`)}async function Yn(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:m(),id:encodeURIComponent(e)}},z(t)),U(e))}async function Xn(e,t,n){return V(await R.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:e,id:encodeURIComponent(t)}},z(n)),U(t))}async function Zn(e,t,n){return H(await R.api.v1.p[`:projectId`].runs[`:id`].history.$get({param:{projectId:m(),id:encodeURIComponent(e)},query:{...t===void 0?{}:{cursor:t}}},z(n)),`${U(e)}/history`,i)}async function Qn(e,t){return H(await R.api.v1.p[`:projectId`].runs[`:id`][`history-context`].$get({param:{projectId:m(),id:encodeURIComponent(e)}},z(t)),`${U(e)}/history-context`,u)}async function $n(e){return V(await R.api.v1.p[`:projectId`][`ui-state`].$get({param:{projectId:m()}},z(e)),`/ui-state`)}async function er(e){return V(await R.api.v1.p[`:projectId`].workflows.$get({param:{projectId:m()}},z(e)),`/workflows`)}async function tr(e){return V(await R.api.v1.p[`:projectId`].skills.$get({param:{projectId:m()},query:{}},z(e)),`/skills`)}async function nr(e){return V(await R.api.v1.p[`:projectId`].skills.$get({param:{projectId:m()},query:{wait:`1`}},z(e)),`/skills`)}async function rr(){return V(await R.api.v1.p[`:projectId`].skills.refresh.$post({param:{projectId:m()}}),`/skills/refresh`)}async function ir(e){return V(await R.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:m()},query:{}},z(e)),`/skills/importable`)}async function ar(e){return V(await R.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:m()},query:{wait:`1`}},z(e)),`/skills/importable`)}async function or(e){return V(await R.api.v1.p[`:projectId`].todos.$get({param:{projectId:m()}},z(e)),`/todos`)}async function sr(e){return V(await R.api.v1.p[`:projectId`].repo.$get({param:{projectId:m()}},z(e)),`/repo`)}async function cr(e){return V(await R.api.v1.p[`:projectId`].config.$get({param:{projectId:m()}},z(e)),`/config`)}async function lr(e={}){return V(await R.api.v1.p[`:projectId`][`agent-config`].$get({param:{projectId:m()}},z(e)),`/agent-config`)}async function ur(e,t={}){return V(await R.api.v1.p[`:projectId`][`agent-config`][`:id`].$get({param:{projectId:m(),id:encodeURIComponent(e)}},z(t)),`/agent-config/${encodeURIComponent(e)}`)}async function dr(e,t){return V(await R.api.v1.p[`:projectId`][`agent-config`][`:id`].$put({param:{projectId:m(),id:encodeURIComponent(e)},json:t}),`/agent-config/${encodeURIComponent(e)}`)}async function fr(e){return V(await R.api.v1.p[`:projectId`].repo.changes.$get({param:{projectId:m()}},z(e)),`/repo/changes`)}async function pr(e){return V(await R.api.v1.p[`:projectId`].repo.tree.$get({param:{projectId:m()}},z(e)),`/repo/tree`)}async function mr(e,t){return V(await R.api.v1.p[`:projectId`].repo.files.$get({param:{projectId:m()},query:{path:e}},z(t)),`/repo/files`)}function hr(e){return p(`/repo/files?path=${encodeURIComponent(e)}&raw=1`)}async function gr(e,t){return V(await R.api.v1.p[`:projectId`].repo.commit[`:sha`].$get({param:{projectId:m(),sha:encodeURIComponent(e)},query:{structured:`1`}},z(t)),`/repo/commit/:sha`)}async function _r(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`].tree.$get({param:{projectId:m(),id:encodeURIComponent(e)}},z(t)),U(e,`/tree`))}async function vr(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`].commits.$get({param:{projectId:m(),id:encodeURIComponent(e)}},z(t)),U(e,`/commits`))}async function yr(e,t,n){return V(await R.api.v1.p[`:projectId`].runs[`:id`].commit[`:sha`].$get({param:{projectId:m(),id:encodeURIComponent(e),sha:encodeURIComponent(t)}},z(n)),U(e,`/commit/${encodeURIComponent(t)}`))}async function br(e={},t){return V(await R.api.v1.p[`:projectId`].github.$get({param:{projectId:m()},query:{limit:e.limit===void 0?void 0:String(e.limit),refresh:e.refresh?`1`:void 0,issuesCursor:e.issuesCursor,prsCursor:e.prsCursor,issuesDone:e.issuesDone?`1`:void 0,prsDone:e.prsDone?`1`:void 0}},z(t)),`/github`)}async function xr(e={},t){return V(await R.api.v1.p[`:projectId`].tracker[`automation-options`].$get({param:{projectId:m()},query:e},z(t)),`/tracker/automation-options`)}async function Sr(e){return V(await R.api.v1.p[`:projectId`].tracker.connection.$get({param:{projectId:m()}},z(e)),`/tracker/connection`)}async function Cr(e){return V(await R.api.v1.p[`:projectId`].tracker.connection.$put({param:{projectId:m()},json:e}),`/tracker/connection`)}async function wr(){return V(await R.api.v1.p[`:projectId`].tracker.connection.$delete({param:{projectId:m()}}),`/tracker/connection`)}async function Tr(e){return V(await R.api.v1.p[`:projectId`].secrets.$get({param:{projectId:m()}},z(e)),`/secrets`)}async function Er(e){return V(await R.api.v1.workspace.secrets.$get({},z(e)),`/workspace/secrets`)}async function Dr(e){if(!e.ok)throw L(e.status,e.statusText,await B(e))}async function Or(e,t){await Dr(await R.api.v1.p[`:projectId`].secrets[`:name`].$put({param:{projectId:m(),name:e},json:t}))}async function kr(e){await Dr(await R.api.v1.p[`:projectId`].secrets[`:name`].$delete({param:{projectId:m(),name:e}}))}async function Ar(e,t){await Dr(await R.api.v1.workspace.secrets[`:name`].$put({param:{name:e},json:t}))}async function jr(e){await Dr(await R.api.v1.workspace.secrets[`:name`].$delete({param:{name:e}}))}async function Mr(e){return V(await R.api.v1.p[`:projectId`].e2e.$get({param:{projectId:m()}},z(e)),`/e2e`)}async function Nr(e){return V(await R.api.v1.p[`:projectId`].e2e.setup.$post({param:{projectId:m()},json:e}),`/e2e/setup`)}async function Pr(e){return V(await R.api.v1.p[`:projectId`].tracker.association.$get({param:{projectId:m()}},z(e)),`/tracker/association`)}async function Fr(e,t={},n){return V(await R.api.v1.p[`:projectId`].tracker.candidates.$get({param:{projectId:m()},query:{kind:e,q:t.q,cursor:t.cursor,limit:t.limit===void 0?void 0:String(t.limit)}},z(n)),`/tracker/candidates`)}async function Ir(e){return V(await R.api.v1.p[`:projectId`].tracker.association.$put({param:{projectId:m()},json:e}),`/tracker/association`)}async function Lr(){return V(await R.api.v1.p[`:projectId`].tracker.association.$delete({param:{projectId:m()}}),`/tracker/association`)}function Rr(e){return{expectedScope:e.association?o(e.association):void 0,cursor:e.cursor,limit:e.limit===void 0?void 0:String(e.limit),refresh:e.refresh?`1`:void 0,state:e.state,labels:e.labels?.length?JSON.stringify(e.labels):void 0}}async function zr(e={},t){return V(await R.api.v1.p[`:projectId`].tracker.$get({param:{projectId:m()},query:Rr(e)},z(t)),`/tracker`)}async function Br(e,t={},n){return V(await R.api.v1.p[`:projectId`].tracker.search.$get({param:{projectId:m()},query:{...Rr(t),q:e}},z(n)),`/tracker/search`)}async function Vr(e,t){return V(await R.api.v1.p[`:projectId`].tracker[`:id`].$get({param:{projectId:m(),id:encodeURIComponent(e)},query:{expectedScope:t?.association?o(t.association):void 0}},z(t)),`/tracker/${encodeURIComponent(e)}`)}async function Hr(e,t){return V(await R.api.v1.p[`:projectId`].github.checks.$get({param:{projectId:m()},query:{prs:e.join(`,`)}},z(t)),`/github/checks`)}async function Ur(e,t,n={},r){return V(await R.api.v1.p[`:projectId`].github.search.$get({param:{projectId:m()},query:{kind:e,q:t,limit:n.limit}},z(r)),`/github/search`)}async function Wr(e,t,n){return V(await R.api.v1.p[`:projectId`].github[`ref-status`].$get({param:{projectId:e},query:{...t.prs?.length?{prs:t.prs.join(`,`)}:{},...t.issues?.length?{issues:t.issues.join(`,`)}:{}}},z(n)),`/github/ref-status`)}async function Gr(e,t,n={},r){return V(await R.api.v1.p[`:projectId`].github.comments[`:kind`][`:number`].$get({param:{projectId:m(),kind:e,number:String(t)},query:{refresh:n.refresh?`1`:void 0}},z(r)),`/github/comments/${e}/${t}`)}async function Kr(e,t={},n){return V(await R.api.v1.p[`:projectId`].github.prs[`:number`][`merge-state`].$get({param:{projectId:m(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},z(n)),`/github/prs/${e}/merge-state`)}async function qr(e,t){return V(await R.api.v1.p[`:projectId`].github.prs[`:number`].merge.$post({param:{projectId:m(),number:String(e)},json:t}),`/github/prs/:number/merge`)}async function Jr(e,t={},n){return V(await R.api.v1.p[`:projectId`].github.prs[`:number`].changes.$get({param:{projectId:m(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},z(n)),`/github/prs/${e}/changes`)}function Yr(e,t){return Cn(U(e,`/diff`),{method:`GET`,signal:t?.signal})}function Xr(e,t){return Cn(U(e,`/handoff`),{method:`GET`,signal:t?.signal})}async function Zr(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`].changes.$get({param:{projectId:m(),id:encodeURIComponent(e)}},z(t)),U(e,`/changes`))}async function Qr(e,t,n){return V(await R.api.v1.p[`:projectId`].runs[`:id`].files.$get({param:{projectId:m(),id:encodeURIComponent(e)},query:{path:t}},z(n)),`/runs/:id/files`)}function $r(e,t,n){let r=n?`&rev=${encodeURIComponent(n)}`:``;return p(U(e,`/files?path=${encodeURIComponent(t)}&raw=1${r}`))}async function ei(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`].artifacts.$get({param:{projectId:m(),id:encodeURIComponent(e)}},z(t)),U(e,`/artifacts`))}function ti(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}function ni(e,t,n){return Cn(U(e,`/artifacts/${ti(t)}`),{method:`GET`,signal:n?.signal})}function ri(e,t,n){let r=n===void 0?``:`?v=${n}`;return p(U(e,`/artifacts/${ti(t)}${r}`))}function W(e){return e.kind===`pr`?`pr:${e.number}`:`spec:${e.path}`}async function ii(e){return V(await R.api.v1.p[`:projectId`].impact.$post({param:{projectId:m()},json:e}),`/impact`)}async function ai(e,t){let n=W(e);return H(await R.api.v1.p[`:projectId`].artifacts.$get({param:{projectId:m()},query:{subject:n}},z(t)),`/artifacts?subject=${encodeURIComponent(n)}`,re)}async function oi(e){return H(await R.api.v1.p[`:projectId`].assets.$get({param:{projectId:m()}},z(e)),`/assets`,d)}async function si(e,t){return V(await R.api.v1.p[`:projectId`].groups[`:groupId`].$get({param:{projectId:m(),groupId:encodeURIComponent(e)}},z(t)),`/groups/${encodeURIComponent(e)}`)}async function ci(e,t){return V(await R.api.v1.providers.connect.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/connect`)}async function li(e){return V(await R.api.v1.providers[`:provider`].update.$post({param:{provider:e}}),`/providers/${encodeURIComponent(e)}/update`)}async function ui(e,t){return Yt(await V(await R.api.v1.providers[`:provider`].enabled.$put({param:{provider:e},json:{enabled:t}}),`/providers/${encodeURIComponent(e)}/enabled`))}async function di(e,t){return Yt(await V(await R.api.v1.providers[`:provider`].retry.$post({param:{provider:e},json:{authFailureId:t}}),`/providers/${encodeURIComponent(e)}/retry`))}async function fi(e){let t=`/projects`,n=await Sn(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({root:e})}),r=await B(n),i=I(r),a=i?.project;if((n.ok||n.status===409)&&a!=null)return i;throw n.ok?new F(n.status,`the cezar server answered ${t} without a project`):L(n.status,n.statusText,r)}async function pi(e){return V(await R.api.v1.projects.checkout.$post({json:e}),`/projects/checkout`)}async function mi(e){return V(await R.api.v1.projects.create.$post({json:e}),`/projects/create`)}async function hi(e){return H(await R.api.v1.projects[`github-owners`].$get({},z(e)),`/projects/github-owners`,y)}async function gi(e){return V(await R.api.v1.projects[`:projectId`].$delete({param:{projectId:encodeURIComponent(e)}}),`/projects/${encodeURIComponent(e)}`)}async function _i(e,t){return V(await R.api.v1.projects[`:projectId`].$patch({param:{projectId:encodeURIComponent(e)},json:t}),`/projects/${encodeURIComponent(e)}`)}async function vi(e){return V(await R.api.v1.p[`:projectId`].runs.$post({param:{projectId:m()},json:e}),`/runs`)}async function yi(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].cancel.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/cancel`))}async function bi(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].promote.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/promote`))}async function xi(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`][`start-now`].$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/start-now`))}async function Si(e,t=!0,n){return V(await R.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:{archived:t,...n?{surface:n}:{}}}),U(e,`/archive`))}async function Ci(e,t=!0,n){return V(await R.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:{pinned:t,...n?{surface:n}:{}}}),U(e,`/pin`))}async function wi(e,t,n=!0,r){return V(await R.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{pinned:n,...r?{surface:r}:{}}}),U(t,`/pin`))}async function Ti(e,t,n=!0,r){return V(await R.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{archived:n,...r?{surface:r}:{}}}),U(t,`/archive`))}async function Ei(e,t,n){let r=n?`read`:`unread`;return V(await(n?R.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:e,id:encodeURIComponent(t)}}):R.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:e,id:encodeURIComponent(t)}})),U(t,`/${r}`))}async function Di(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`][`auto-resume`].$delete({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/auto-resume`))}async function Oi(){return V(await R.api.v1.p[`:projectId`].runs[`archive-finished`].$post({param:{projectId:m()}}),`/runs/archive-finished`)}async function ki(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/read`))}async function Ai(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/unread`))}async function ji(){return V(await R.api.v1.p[`:projectId`].runs[`read-all`].$post({param:{projectId:m()}}),`/runs/read-all`)}async function Mi(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].land.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/land`))}async function Ni(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].finish.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/finish`))}async function Pi(e,t={}){let n={...t.text===void 0?{}:{text:t.text},...t.images===void 0?{}:{images:t.images},...t.runner===void 0?{}:{runner:t.runner},...t.model===void 0?{}:{model:t.model},...t.reasoningEffort===void 0?{}:{reasoningEffort:t.reasoningEffort},...t.agentProfile===void 0?{}:{agentProfile:t.agentProfile},...t.idempotencyKey===void 0?{}:{idempotencyKey:t.idempotencyKey}};return V(await R.api.v1.p[`:projectId`].runs[`:id`].continue.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:n}),U(e,`/continue`))}async function Fi(e,t,n={}){return V(await R.api.v1.p[`:projectId`].runs[`:id`].continue.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{...n.text===void 0?{}:{text:n.text},...n.images===void 0?{}:{images:n.images},...n.runner===void 0?{}:{runner:n.runner},...n.model===void 0?{}:{model:n.model},...n.agentProfile===void 0?{}:{agentProfile:n.agentProfile},...n.idempotencyKey===void 0?{}:{idempotencyKey:n.idempotencyKey}}}),U(t,`/continue`))}var Ii=1e3;async function Li(e,t={}){let n=m(),r=async()=>V(await R.api.v1.p[`:projectId`].runs[`:id`].pr.$post({param:{projectId:n,id:encodeURIComponent(e)},json:t}),U(e,`/pr`));try{return await r()}catch(e){if(!(e instanceof F)||e.status!==0)throw e;await new Promise(e=>setTimeout(e,Ii));try{return await r()}catch(t){throw t instanceof F&&t.status===0?e:t}}}async function Ri(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].pr.adopt.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/pr/adopt`))}async function zi(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`].$patch({param:{projectId:m(),id:encodeURIComponent(e)},json:t}),U(e))}async function Bi(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].$delete({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e))}async function Vi(e){return V(await R.api.v1.p[`:projectId`].todos[`:id`].$delete({param:{projectId:m(),id:encodeURIComponent(e)}}),`/todos/${encodeURIComponent(e)}`)}async function Hi(e,t={}){let n={...t.runner===void 0?{}:{runner:t.runner},...t.model===void 0?{}:{model:t.model},...t.reasoningEffort===void 0?{}:{reasoningEffort:t.reasoningEffort},...t.prompt===void 0?{}:{prompt:t.prompt}};return V(await R.api.v1.p[`:projectId`].todos[`:id`].start.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:Object.keys(n).length>0?n:void 0}),`/todos/${encodeURIComponent(e)}/start`)}async function Ui(e,t){return V(await R.api.v1.p[`:projectId`].groups[`:groupId`].pick.$post({param:{projectId:m(),groupId:encodeURIComponent(e)},json:{runId:t}}),`/groups/${encodeURIComponent(e)}/pick`)}async function Wi(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`][`open-in-cli`].$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/open-in-cli`))}async function Gi(e){return V(await R.api.v1.p[`:projectId`][`open-targets`].$get({param:{projectId:m()}},z(e)),`/open-targets`)}async function Ki(e){return V(await R.api.v1.p[`:projectId`][`open-in`].$post({param:{projectId:m()},json:{target:e}}),`/open-in`)}async function qi(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:m(),id:encodeURIComponent(e)},json:{target:t}}),U(e,`/open-in`))}async function Ji(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:m(),id:encodeURIComponent(e)},json:{target:`default`,path:t}}),U(e,`/open-in`))}async function Yi(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`].git.commit.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:{message:t}}),U(e,`/git/commit`))}async function Xi(e,t,n=m()){return V(await R.api.v1.p[`:projectId`].runs[`:id`].git.status.$get({param:{projectId:n,id:encodeURIComponent(e)}},z(t)),U(e,`/git/status`))}async function Zi(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].git.push.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/git/push`))}var Qi=[250,750,1500],$i=e=>new Promise(t=>setTimeout(t,e));async function ea(e,t,n=$i){let r={text:t.text??``,images:t.images??[],idempotencyKey:t.idempotencyKey??on()};for(let t=0;;t+=1)try{return await e(r)}catch(e){let r=Qi[t];if(!(e instanceof F)||e.status!==0||r===void 0)throw e;await n(r)}}async function ta(e,t){return ea(async t=>V(await R.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:t}),U(e,`/messages`)),t)}async function na(e,t,n){return ea(async n=>V(await R.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:e,id:encodeURIComponent(t)},json:n}),U(t,`/messages`)),n)}async function ra(e,t,n){return V(await R.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$patch({param:{projectId:m(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)},json:n}),U(e,`/queued-messages/${encodeURIComponent(t)}`))}async function ia(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$delete({param:{projectId:m(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)}}),U(e,`/queued-messages/${encodeURIComponent(t)}`))}async function aa(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`].drafts.$get({param:{projectId:m(),id:encodeURIComponent(e)}},z(t)),U(e,`/drafts`))}var oa=56*1024;async function sa(e,t,n,r){let i=r?.keepalive===!0&&new TextEncoder().encode(JSON.stringify(n)).length<=oa;return V(await R.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].$put({param:{projectId:m(),id:encodeURIComponent(e),surface:t},json:n},{init:{keepalive:i}}),U(e,`/drafts/${t}`))}async function ca(e,t,n){return V(await R.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images.$post({param:{projectId:m(),id:encodeURIComponent(e),surface:t},json:n}),U(e,`/drafts/${t}/images`))}async function la(e){return V(await R.api.v1.workspace.uploads.$post({json:e}),`/workspace/uploads`)}async function ua(e){return V(await R.api.v1.workspace.uploads[`:uploadId`].$delete({param:{uploadId:e}}),`/workspace/uploads/${e}`)}async function da(e,t,n,r){return V(await R.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$get({param:{projectId:m(),id:encodeURIComponent(e),surface:t,imageId:n}},z(r)),U(e,`/drafts/${t}/images/${n}`))}async function fa(e,t,n){return V(await R.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$delete({param:{projectId:m(),id:encodeURIComponent(e),surface:t,imageId:n}}),U(e,`/drafts/${t}/images/${n}`))}async function pa(e){return V(await R.api.v1.p[`:projectId`].repo.branch.$post({param:{projectId:m()},json:e}),`/repo/branch`)}async function ma(e){return V(await R.api.v1.p[`:projectId`].repo.sync.$get({param:{projectId:m()}},z(e)),`/repo/sync`)}async function ha(e){let t={param:{projectId:m()}},n=R.api.v1.p[`:projectId`].repo;return V(e===`fetch`?await n.fetch.$post(t):e===`pull`?await n.pull.$post(t):e===`push`?await n.push.$post(t):await n.sync.$post(t),`/repo/${e}`)}async function ga(e){return V(await R.api.v1.p[`:projectId`].plan.$post({param:{projectId:m()},json:{task:e}}),`/plan`)}async function _a(e){return V(await R.api.v1.p[`:projectId`].automations.$get({param:{projectId:m()}},z(e)),`/automations`)}async function va(e){return V(await R.api.v1.p[`:projectId`].automations.$post({param:{projectId:m()},json:e}),`/automations`)}async function ya(e,t){return V(await R.api.v1.p[`:projectId`].automations[`:id`].report.$put({param:{projectId:m(),id:encodeURIComponent(e)},json:{report:t}}),`/automations/${encodeURIComponent(e)}/report`)}async function ba(e,t){return V(await R.api.v1.p[`:projectId`].automations[`:id`].$put({param:{projectId:m(),id:encodeURIComponent(e)},json:t}),`/automations/${encodeURIComponent(e)}`)}async function xa(e,t){let n={projectId:m(),id:encodeURIComponent(e)},r=`/automations/${encodeURIComponent(e)}/${t?`enable`:`pause`}`;return V(t?await R.api.v1.p[`:projectId`].automations[`:id`].enable.$post({param:n}):await R.api.v1.p[`:projectId`].automations[`:id`].pause.$post({param:n}),r)}async function Sa(e){let t=`/automations/${encodeURIComponent(e)}/work`;return V(await R.api.v1.p[`:projectId`].automations[`:id`].work.$get({param:{projectId:m(),id:encodeURIComponent(e)}}),t)}async function Ca(e){let t=`/automations/${encodeURIComponent(e)}/cancel-queued`;return V(await R.api.v1.p[`:projectId`].automations[`:id`][`cancel-queued`].$post({param:{projectId:m(),id:encodeURIComponent(e)}}),t)}async function wa(e,t){return V(await R.api.v1.p[`:projectId`].automations[`:id`].check.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:{mode:t}}),`/automations/${encodeURIComponent(e)}/check`)}async function Ta(e,t){return V(await R.api.v1.p[`:projectId`][`automation-log`].$get({param:{projectId:m()},query:{automationId:e}},z(t)),`/automation-log?automationId=${encodeURIComponent(e)}`)}async function Ea(e){return V(await R.api.v1.p[`:projectId`][`automation-log`][`:receiptId`].retry.$post({param:{projectId:m(),receiptId:encodeURIComponent(e)}}),`/automation-log/${encodeURIComponent(e)}/retry`)}async function Da(e,t){return V(await R.api.v1.p[`:projectId`].automations[`:id`].run.$post({param:{projectId:m(),id:encodeURIComponent(e)},query:t?{expectedRevision:String(t)}:{}}),`/automations/${encodeURIComponent(e)}/run`)}async function Oa(e,t){let n=await R.api.v1.p[`:projectId`].automations[`:id`].$delete({param:{projectId:m(),id:encodeURIComponent(e)},query:t?{expectedRevision:String(t)}:{}});if(!n.ok)throw L(n.status,n.statusText,await B(n))}async function ka(e){return V(await R.api.v1.p[`:projectId`].automations.export.$get({param:{projectId:m()},query:e?.length?{ids:e.join(`,`)}:{}}),`/automations/export`)}async function Aa(e){return V(await R.api.v1.p[`:projectId`].automations.import.preview.$post({param:{projectId:m()},json:e}),`/automations/import/preview`)}async function ja(e){return V(await R.api.v1.p[`:projectId`].automations.import.$post({param:{projectId:m()},json:e}),`/automations/import`)}async function Ma(e,t){return V(await R.api.v1.workspace[`automation-templates`].$get({query:e?{exclude:e}:{}},z(t)),`/workspace/automation-templates`)}async function Na(e){return V(await R.api.v1.p[`:projectId`].workflows.$post({param:{projectId:m()},json:e}),`/workflows`)}async function Pa(e){return V(await R.api.v1.p[`:projectId`].workflows.nodes.$get({param:{projectId:m()}},z(e)),`/workflows/nodes`)}async function Fa(e){return V(await R.api.v1.p[`:projectId`].workflows.validate.$post({param:{projectId:m()},json:{graph:e}}),`/workflows/validate`)}async function Ia(e){return V(await R.api.v1.p[`:projectId`].workflows.graph.$post({param:{projectId:m()},json:e}),`/workflows/graph`)}async function La(e){return V(await R.api.v1.p[`:projectId`].workflows.parse.$post({param:{projectId:m()},json:{yaml:e}}),`/workflows/parse`)}async function Ra(e){return V(await R.api.v1.p[`:projectId`].workflows[`:name`].$delete({param:{projectId:m(),name:encodeURIComponent(e)}}),`/workflows/${encodeURIComponent(e)}`)}async function za(e,t=m()){return V(await R.api.v1.p[`:projectId`][`ui-state`].$put({param:{projectId:t},json:e}),`/ui-state`)}async function Ba(e){return V(await R.api.v1.workspace[`ui-state`].$get({},z(e)),`/workspace/ui-state`)}async function Va(e,t={}){return V(await R.api.v1.workspace[`ui-state`].$put({json:e},{init:{keepalive:t.keepalive}}),`/workspace/ui-state`)}async function Ha(e){let t=await V(await R.api.v1.workspace.config.$get({},z(e)),`/workspace/config`);return{...t,branding:t.branding?{...t.branding,logoUrl:t.branding.logoUrl?v(t.branding.logoUrl):null}:{name:`cezar`,logoUrl:null},agentDefaults:t.agentDefaults??{},orgSkillsRepos:t.orgSkillsRepos??[],resources:{...t.resources,idleTimeoutMinutes:t.resources.idleTimeoutMinutes===void 0?15:t.resources.idleTimeoutMinutes}}}async function Ua(e){let t=new FormData;t.set(`file`,e);let n=await Sn(`/workspace/branding-logo`,{method:`POST`,body:t}),r=await B(n);if(!n.ok)throw L(n.status,n.statusText,r);let i=I(r),a=g.safeParse(i);if(!a.success)throw new F(n.status,`the cezar server answered /workspace/branding-logo with an unexpected body`);return a.data.logoUrl?v(a.data.logoUrl):null}async function Wa(){let e=await Sn(`/workspace/branding-logo`,{method:`DELETE`}),t=await B(e);if(!e.ok)throw L(e.status,e.statusText,t);let n=g.safeParse(I(t));if(!n.success)throw new F(e.status,`the cezar server answered /workspace/branding-logo with an unexpected body`);return n.data.logoUrl?v(n.data.logoUrl):null}async function Ga(e){return V(await R.api.v1.workspace[`host-usage`].$get({},z(e)),`/workspace/host-usage`)}async function Ka(e){let t=await V(await R.api.v1.workspace[`agent-profiles`].$get({},z(e)),`/workspace/agent-profiles`);return{...t,profileCapableProviders:t.profileCapableProviders??[],selections:t.selections??{},defaults:t.defaults??{},profiles:(t.profiles??[]).map(e=>({...e,files:e.files??[]}))}}async function qa(e,t){return V(await R.api.v1.workspace[`agent-profiles`][`fallback-policy`].$get({query:e},z(t)),`/workspace/agent-profiles/fallback-policy`)}async function Ja(e,t){return V(await R.api.v1.workspace[`agent-profiles`][`fallback-policy`].$put({json:e},z(t)),`/workspace/agent-profiles/fallback-policy`)}async function Ya(e){return V(await R.api.v1.workspace[`agent-profiles`].$post({json:e}),`/workspace/agent-profiles`)}async function Xa(e,t){return V(await R.api.v1.workspace[`agent-profiles`][`:id`].status.$get({param:{id:encodeURIComponent(e)},query:{...t?.refresh||t?.recheck?{refresh:`1`}:{},...t?.recheck?{recheck:`1`}:{}}},z(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/status`)}async function Za(e,t){return V(await R.api.v1.workspace[`agent-profiles`][`:id`].details.$get({param:{id:encodeURIComponent(e)}},z(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/details`)}async function Qa(e,t){return V(await R.api.v1.workspace[`agent-profiles`][`:id`].open.$post({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}/open`)}async function $a(e){return V(await R.api.v1.workspace[`agent-profiles`].selection.$put({json:e}),`/workspace/agent-profiles/selection`)}async function eo(e,t){return V(await R.api.v1.workspace[`agent-profiles`][`:id`].$patch({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function to(e){return V(await R.api.v1.workspace[`agent-profiles`][`:id`].$delete({param:{id:encodeURIComponent(e)}}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function no(e,t){return V(await R.api.v1.workspace[`skills-update`].$get({query:{projectId:e}},z(t)),`/workspace/skills-update?projectId=${encodeURIComponent(e)}`)}async function ro(e){return V(await R.api.v1.workspace[`skills-update`].check.$post({json:{projectId:e}}),`/workspace/skills-update/check`)}async function io(e){return V(await R.api.v1.workspace[`skills-update`].apply.$post({json:{projectId:e}}),`/workspace/skills-update/apply`)}async function ao(e){return V(await R.api.v1.workspace[`self-update`].$get({},z(e)),`/workspace/self-update`)}async function oo(){return V(await R.api.v1.workspace[`self-update`].refresh.$post({}),`/workspace/self-update/refresh`)}async function so(e){return V(await R.api.v1.workspace[`self-update`].development.$get({query:e?.refresh?{refresh:`1`}:{}},z(e)),`/workspace/self-update/development`)}async function co(e){return V(await R.api.v1.workspace[`self-update`].channel.$put({json:{channel:e}}),`/workspace/self-update/channel`)}async function lo(e){return V(await R.api.v1.workspace[`self-update`].apply.$post({json:{version:e}}),`/workspace/self-update/apply`)}async function uo(e){return V(await R.api.v1.workspace[`self-update`].apply.$post({json:{version:e,whenIdle:!0}}),`/workspace/self-update/apply`)}async function fo(){return V(await R.api.v1.workspace[`self-update`].scheduled.$delete({}),`/workspace/self-update/scheduled`)}async function po(e){let t=await V(await R.api.v1.workspace.config.$put({json:e}),`/workspace/config`);return{...t,orgSkillsRepos:t.orgSkillsRepos??[]}}async function mo(e){return V(await R.api.v1.p[`:projectId`].config.$put({param:{projectId:m()},json:e}),`/config`)}async function ho(e){return V(await R.api.v1.p[`:projectId`].worktrees.$get({param:{projectId:m()}},z(e)),`/worktrees`)}async function go(){return V(await R.api.v1.p[`:projectId`].worktrees.reclaim.$post({param:{projectId:m()},json:{}}),`/worktrees/reclaim`)}async function _o(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`][`remove-worktree`].$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/remove-worktree`))}async function vo(e,t,n){return s.parse(await V(await R.api.v1.p[`:projectId`].tracker.watch.$post({param:{projectId:e},json:t},{init:{signal:n}}),`/tracker/watch`))}async function yo(e,t,n,r){return a.parse(await V(await R.api.v1.p[`:projectId`].tracker.watch[`:watchId`].$get({param:{projectId:e,watchId:t},query:{after:r===void 0?void 0:String(r)}},{init:{signal:n}}),`/tracker/watch`))}async function bo(e,t,n){return a.parse(await V(await R.api.v1.p[`:projectId`].tracker.watch[`:watchId`].$post({param:{projectId:e,watchId:t}},{init:{signal:n}}),`/tracker/watch`))}var xo={list:async(e,t)=>V(await R.api.v1.p[`:projectId`].webhooks.$get({param:{projectId:e}},{init:{signal:t}}),`/webhooks`),create:async(e,t)=>V(await R.api.v1.p[`:projectId`].webhooks.$post({param:{projectId:e},json:t}),`/webhooks`),update:async(e,t,n)=>V(await R.api.v1.p[`:projectId`].webhooks[`:id`].$patch({param:{projectId:e,id:t},json:n}),`/webhooks`),remove:async(e,t,n)=>V(await R.api.v1.p[`:projectId`].webhooks[`:id`].$delete({param:{projectId:e,id:t},json:{expectedRevision:n}}),`/webhooks`),activate:async(e,t,n)=>V(await R.api.v1.p[`:projectId`].webhooks[`:id`].activate.$post({param:{projectId:e,id:t},json:{expectedRevision:n,confirmed:!0}}),`/webhooks`),pause:async(e,t,n)=>V(await R.api.v1.p[`:projectId`].webhooks[`:id`].pause.$post({param:{projectId:e,id:t},json:{expectedRevision:n}}),`/webhooks`),resume:async(e,t,n)=>V(await R.api.v1.p[`:projectId`].webhooks[`:id`].resume.$post({param:{projectId:e,id:t},json:{expectedRevision:n,confirmed:!0}}),`/webhooks`),rotate:async(e,t,n,r)=>V(await R.api.v1.p[`:projectId`].webhooks[`:id`][`rotate-secret`].$post({param:{projectId:e,id:t},json:{expectedRevision:n,mode:r}}),`/webhooks`),test:async(e,t,n)=>V(await R.api.v1.p[`:projectId`].webhooks[`:id`].test.$post({param:{projectId:e,id:t},json:n}),`/webhooks`),retry:async(e,t,n)=>V(await R.api.v1.p[`:projectId`].webhooks.deliveries[`:deliveryId`].retry.$post({param:{projectId:e,deliveryId:t},json:n}),`/webhooks`),replay:async(e,t,n)=>V(await R.api.v1.p[`:projectId`].webhooks.deliveries[`:deliveryId`].replay.$post({param:{projectId:e,deliveryId:t},json:{...n,confirmed:!0}}),`/webhooks`),acknowledge:async(e,t)=>V(await R.api.v1.p[`:projectId`].webhooks.notice.acknowledge.$post({param:{projectId:e},json:{expectedChangeSequence:t}}),`/webhooks`),history:async(e,t)=>V(await R.api.v1.p[`:projectId`].webhooks.history.$get({param:{projectId:e},query:{limit:`100`,...t?{cursor:t}:{}}}),`/webhooks/history`),deliveries:async(e,t,n,r)=>V(await R.api.v1.p[`:projectId`].webhooks[`:id`].deliveries.$get({param:{projectId:e,id:t},query:{limit:`100`,...n?{cursor:n}:{},...r?{taskId:r}:{}}}),`/webhooks/deliveries`),activity:async(e,t)=>V(await R.api.v1.p[`:projectId`].webhooks[`:id`].activity.$get({param:{projectId:e,id:t}}),`/webhooks/activity`)};async function So(e={limit:50},t){return V(await R.api.v1.p[`:projectId`][`worktree-lifecycle`].$get({param:{projectId:m()},query:{cursor:e.cursor,limit:e.limit,attentionOnly:e.attentionOnly===void 0?void 0:e.attentionOnly?`true`:`false`}},z(t)),`/worktree-lifecycle`)}async function Co(e,t){return V(await R.api.v1.p[`:projectId`][`worktree-lifecycle`][`:worktreeId`].$get({param:{projectId:m(),worktreeId:e}},z(t)),`/worktree-lifecycle`)}async function wo(e,t){return V(await R.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].$get({param:{projectId:m(),operationId:e}},z(t)),`/worktree-lifecycle/operations`)}async function To(e,t=0,n){return V(await R.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].output.$get({param:{projectId:m(),operationId:e},query:{afterSeq:t,limit:100}},z(n)),`/worktree-lifecycle/operations/output`)}async function Eo(e,t=m()){return V(await R.api.v1.p[`:projectId`][`worktree-lifecycle`].operations.$post({param:{projectId:t},json:e}),`/worktree-lifecycle/operations`)}async function Do(e,t){return V(await R.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].actions.$post({param:{projectId:m(),operationId:e},json:t}),`/worktree-lifecycle/operations/actions`)}async function Oo(e){return V(await R.api.v1.p[`:projectId`][`worktree-lifecycle`].preview.$post({param:{projectId:m()},json:e}),`/worktree-lifecycle/preview`)}async function ko(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].terminal.$get({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/terminal`))}async function Ao(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`].terminal.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:t}),U(e,`/terminal`))}async function jo(e,t,n){return V(await R.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].output.$get({param:{projectId:m(),id:encodeURIComponent(e),sessionId:t},query:{cursor:String(n)}}),U(e,`/terminal/${t}/output`))}async function Mo(e,t,n){await V(await R.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].input.$post({param:{projectId:m(),id:encodeURIComponent(e),sessionId:t},json:{data:n}}),U(e,`/terminal/${t}/input`))}async function No(e,t,n,r){await V(await R.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].resize.$post({param:{projectId:m(),id:encodeURIComponent(e),sessionId:t},json:{cols:n,rows:r}}),U(e,`/terminal/${t}/resize`))}async function Po(e,t){await V(await R.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].$delete({param:{projectId:m(),id:encodeURIComponent(e),sessionId:t}}),U(e,`/terminal/${t}`))}async function Fo(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].terminal.urls.$get({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/terminal/urls`))}async function Io(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].terminal.commands.$get({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/terminal/commands`))}async function Lo(){return V(await R.api.v1.p[`:projectId`].terminal.$get({param:{projectId:m()}}),`/terminal`)}async function Ro(e){return V(await R.api.v1.p[`:projectId`].terminal.$post({param:{projectId:m()},json:e}),`/terminal`)}async function zo(e,t){return V(await R.api.v1.p[`:projectId`].terminal[`:sessionId`].output.$get({param:{projectId:m(),sessionId:e},query:{cursor:String(t)}}),`/terminal/${e}/output`)}async function Bo(e,t){await V(await R.api.v1.p[`:projectId`].terminal[`:sessionId`].input.$post({param:{projectId:m(),sessionId:e},json:{data:t}}),`/terminal/${e}/input`)}async function Vo(e,t,n){await V(await R.api.v1.p[`:projectId`].terminal[`:sessionId`].resize.$post({param:{projectId:m(),sessionId:e},json:{cols:t,rows:n}}),`/terminal/${e}/resize`)}async function Ho(e){await V(await R.api.v1.p[`:projectId`].terminal[`:sessionId`].$delete({param:{projectId:m(),sessionId:e}}),`/terminal/${e}`)}async function Uo(){return V(await R.api.v1.p[`:projectId`].terminal.commands.$get({param:{projectId:m()}}),`/terminal/commands`)}async function Wo(){return V(await R.api.v1.p[`:projectId`][`start-app`].$get({param:{projectId:m()}}),`/start-app`)}async function Go(e){return V(await R.api.v1.p[`:projectId`][`start-app`].$put({param:{projectId:m()},json:e}),`/start-app`)}async function Ko(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].layouts.$get({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/layouts`))}async function qo(e,t,n){let r=n?.keepalive===!0&&new TextEncoder().encode(JSON.stringify(t)).length<=oa;return V(await R.api.v1.p[`:projectId`].runs[`:id`].layouts.$put({param:{projectId:m(),id:encodeURIComponent(e)},json:t},{init:{keepalive:r}}),U(e,`/layouts`))}async function Jo(e){return V(await R.api.v1.p[`:projectId`][`deferred-start`].preview.$post({param:{projectId:m()},json:e}),`/deferred-start/preview`)}async function Yo(e){return V(await R.api.v1.p[`:projectId`][`deferred-start`].$post({param:{projectId:m()},json:e}),`/deferred-start`)}async function Xo(e){return V(await R.api.v1.p[`:projectId`][`deferred-start`].options.$post({param:{projectId:m()},json:e}),`/deferred-start/options`)}async function Zo(e,t,n=m()){return V(await R.api.v1.p[`:projectId`].github.asset.$post({param:{projectId:n},json:{url:e}},z(t)),`/github/asset`)}function Qo(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!$o(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return es(t)?{project:r,event:{type:`run`,run:t}}:null}case`run-deleted`:{let e=n.id;return typeof e==`string`&&e?{project:r,event:{type:`run-deleted`,id:e}}:null}case`todos`:return Array.isArray(n.items)?{project:r,event:{type:`todos`,items:n.items}}:null;case`usage`:return $o(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function $o(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function es(e){return $o(e)&&typeof e.id==`string`&&e.id!==``}function ts(e){return typeof e.task==`string`&&Array.isArray(e.steps)}function ns(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id),r=n<0?void 0:e[n];if(r!==void 0){let i=[...e];return i[n]=is(r,t),i}if(!ts(t))return e;let i=t.createdAt??``,a=e.findIndex(e=>(e.createdAt??``).localeCompare(i)<0),o=[...e];return o.splice(a<0?e.length:a,0,t),o}function rs(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function is(e,t){let n={...t};if(!ts(t)){let t=n;for(let n of f)n in e&&(t[n]=e[n])}let r=e=>e===`user`?2:+(e===`marker`);return r(e.titleOrigin)>r(t.titleOrigin)&&(n.title=e.title,n.titleSummary=e.titleSummary,n.titleOrigin=e.titleOrigin),e.usage&&(n.usage=e.usage),n}var as=Object.freeze({});function os(){let e=as,t=new Set;return{subscribe(e){return t.add(e),()=>t.delete(e)},get:()=>e,set(n){e=n;for(let e of t)e()}}}var ss={draft:{label:`Draft`,hint:`the author has not marked it ready for review`,tone:`neutral`},"review-required":{label:`Waiting for review`,hint:`checks are fine, no one has reviewed it yet`,tone:`info`},"changes-requested":{label:`Changes requested`,hint:`a reviewer asked for edits before this can merge`,tone:`danger`},"checks-pending":{label:`Checks running`,hint:`CI has not finished on the latest commit`,tone:`pending`},"checks-failing":{label:`Checks failing`,hint:`CI is red on the latest commit`,tone:`danger`},ready:{label:`Ready to merge`,hint:`open, checks pass, nothing is waiting on a reviewer — your move`,tone:`info`},merged:{label:`Merged`,hint:`this landed on its base branch`,tone:`success`},closed:{label:`Closed`,hint:`closed without merging — the work did not land`,tone:`danger`},open:{label:`Open`,hint:`still open on the tracker`,tone:`neutral`},completed:{label:`Closed as completed`,hint:`the issue was resolved`,tone:`success`},"not-planned":{label:`Closed as not planned`,hint:`the issue was declined — nothing shipped for it`,tone:`neutral`}},cs={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function ls(e){return typeof e==`string`&&Object.hasOwn(ss,e)}function us(e){return e!==void 0&&ls(e)?ss[e]:void 0}var ds={permission:0,error:1,waiting:2,running:3,unseen:4,none:5};function fs(e){return!1}function ps(e){return!1}function ms(e){let t=e.dispatch?.overBudget?e.dispatch.budgetUsd:void 0;if(!(e.status!==`waiting`||t===void 0))return{spent:e.costUsd??0,ceiling:t}}function G(e){return e.status===`failed`&&e.awaitingAnswerSince!==void 0}function hs(e){return e.status===`failed`&&e.idleClosedAt!==void 0&&!G(e)}function gs(e){return G(e)?`answer`:hs(e)?`idle`:void 0}function _s(e){let t,n;for(let r of e){if(r.status!==`failed`)continue;n=r.id;let e=r.finishedAt===void 0?NaN:Date.parse(r.finishedAt);!Number.isNaN(e)&&(t===void 0||e>=t.at)&&(t={id:r.id,at:e})}return t?.id??n}function vs(e){return!!e.worktreeLifecycle?.needsAttention||e.status===`waiting`||e.status===`review`||G(e)}function ys(e){let t=e.worktreeLifecycle;return t?.needsAttention?{bucket:`waiting`,tone:`pending`,pulse:!1,label:t.phase===`setup`?`setup needs attention`:`cleanup needs attention`}:t?.activeOperationId?{bucket:`running`,tone:`pending`,pulse:!0,label:t.phase===`setup`?`preparing worktree`:`cleaning up worktree`}:fs(e)?{bucket:`permission`,tone:`info`,pulse:!0,label:`needs permission`}:e.status===`failed`&&e.autoResumeAt?{bucket:`none`,tone:`pending`,pulse:!1,label:`scheduled`}:G(e)?{bucket:`waiting`,tone:`info`,pulse:!0,label:`needs you`}:hs(e)?{bucket:`none`,tone:`idle`,pulse:!1,label:`closed · idle`}:e.status===`failed`?{bucket:`error`,tone:`danger`,pulse:!1,label:`failed`}:e.status===`waiting`?{bucket:`waiting`,tone:`info`,pulse:!0,label:ms(e)?.ceiling===void 0?`needs you`:`budget reached`}:e.status===`review`?{bucket:`waiting`,tone:`info`,pulse:!0,label:`needs review`}:e.status===`running`&&e.activity===`monitoring`?{bucket:`running`,tone:`violet`,pulse:!0,label:`monitoring`}:e.status===`running`?{bucket:`running`,tone:`violet`,pulse:!0,label:`running`}:ps(e)?{bucket:`unseen`,tone:`violet`,pulse:!1,label:`unseen`}:e.status===`queued`&&e.fallbackEpisode?.pending?{bucket:`running`,tone:`violet`,pulse:!0,label:`switching agent`}:e.status===`queued`?{bucket:`none`,tone:`neutral`,pulse:!1,label:`queued`}:e.status===`done`?{bucket:`none`,tone:`success`,pulse:!1,label:`done`}:{bucket:`none`,tone:`neutral`,pulse:!1,label:`cancelled`}}function bs(e){return ds[ys(e).bucket]<=ds.waiting}var xs={waiting:0,review:1,running:2,queued:4,done:5,failed:5,cancelled:5},Ss=3,Cs=e=>e.status===`failed`&&e.autoResumeAt!==void 0?Ss:G(e)?xs.waiting??0:xs[e.status]??9;function ws(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function Ts(e){let t=/^(\d{1,9}): (.+)$/.exec(e),n=t?.[1],r=t?.[2];return n===void 0||r===void 0?{ref:null,rest:e}:{ref:Number(n),rest:r}}function Es(e,t){return t!==void 0&&Ts(e).ref===t}function Ds(e){return e.title.replace(/ \([A-C]\)$/,``)}function Os(e,t){if(e.promotedAt||t.promotedAt){if(!e.promotedAt)return 1;if(!t.promotedAt)return-1;let n=t.promotedAt.localeCompare(e.promotedAt);if(n!==0)return n}return e.createdAt.localeCompare(t.createdAt)}function ks(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort(Os);return new Map(t.map((e,t)=>[e.id,t+1]))}var As=[{value:`recent`,label:`Recent`},{value:`created`,label:`Created`}];function K(e,t){let n=Date.parse(e),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?t.localeCompare(e):r-n}function js(e){if(e.lastActivityAt!==void 0)return e.lastActivityAt;let t=e.finishedAt??e.startedAt??e.createdAt;for(let n of e.steps??[]){let e=n.finishedAt??n.startedAt;e!==void 0&&K(e,t)<0&&(t=e)}return t}function Ms(e,t){return t===`created`?e.createdAt:js(e)}function Ns(e){return e===`created`?`Created`:`Updated`}function Ps(e,t){if(t===`archived`)return[{key:`rest`,label:null,runs:[...e]}];let n=new Map(e.map(e=>[e.id,e])),r=e=>{let t=new Set;for(let r=e;r&&!t.has(r.id);r=n.get(r.dispatch?.parentRunId??``)){if(r.pinned)return!0;t.add(r.id)}return!1},i=e.filter(r);if(i.length===0)return[{key:`rest`,label:null,runs:[...e]}];let a=e.filter(e=>!r(e));return[{key:`pinned`,label:`Pinned`,runs:i},...a.length>0?[{key:`rest`,label:`All tasks`,runs:a}]:[]]}function Fs(e,t){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,n)=>{if(t!==`archived`){let t=Number(!!n.pinned)-Number(!!e.pinned);if(t!==0)return t}let r=Cs(e)-Cs(n);if(r!==0)return r;if(Cs(e)===Ss&&e.autoResumeAt&&n.autoResumeAt){let t=e.autoResumeAt.localeCompare(n.autoResumeAt);if(t!==0)return t}return e.status===`queued`&&n.status===`queued`?Os(e,n):K(js(e),js(n))})}function Is(e,t,n){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,r)=>{if(t!==`archived`){let t=Number(!!r.pinned)-Number(!!e.pinned);if(t!==0)return t}return K(Ms(e,n),Ms(r,n))})}function Ls(e){let t=0,n=0,r=0;for(let i of e){if(i.archived){n+=1;continue}t+=1,vs(i)&&(r+=1)}return{active:t,archived:n,waiting:r}}var Rs=new Set([`running`,`waiting`]),zs=new Set([`done`,`failed`,`review`,`cancelled`]),Bs=new Set([`done`,`failed`,`cancelled`]);function Vs(e){return e?e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} kB`:``}function Hs(e){return e?`$${e>=10?e.toFixed(0):e.toFixed(2)}`:``}function Us(e,t=new Date){if(e.status!==`failed`||!e.autoResumeAt)return;let n=new Date(e.autoResumeAt);if(!Number.isFinite(n.getTime()))return;let r=n.toDateString()===t.toDateString(),i=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);return{label:r?i:`${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(n)} ${i}`,title:`Resumes automatically at ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n)}`}}function Ws(e){if(e.workflow===`(planned)`||e.workflow===`(inbox)`){let t=e.steps.find(e=>e.kind===`agent`);if(t?.name)return t.name}return e.workflow}function Gs(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[ws(e),e.branch??``,e.workflow,Ws(e)].some(e=>e.toLowerCase().includes(n))):[...e]}function Ks(e){return e.filter(e=>!e.archived&&Bs.has(e.status)&&!G(e)).length}function qs(e,t=!1){if(!e)return;let n=e.trim().replace(/\/+$/,``),r=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(n),i=r?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(n),a=r??i;if(!a)return;let[,o,s]=a;if(!s||!o||!t&&o.toLowerCase()!==`github.com`)return;let c=s.replace(/\.git$/i,``).split(`/`).filter(Boolean),l=c[c.length-2],u=c[c.length-1];return l&&u?`https://${o.toLowerCase()}/${l}/${u}`:void 0}function Js(e){if(e.pullRequestUrl){let t=Number(q(e.pullRequestUrl));return{url:e.pullRequestUrl,...t>0?{number:t}:{}}}let t=e.prRefs?.find(e=>e.origin===`created`||e.origin===`marker`);if(t)return{number:t.number,...t.url?{url:t.url}:{}};let n=e.markerRefs?.pr;return n===void 0?void 0:{number:n}}function Ys(e){return Xs(e)[0]?.url??Zs(e)[0]}function Xs(e,t){if(!e.prRefs?.length)return Zs(e).map(e=>({number:Number(q(e)),url:e,origin:`legacy`})).filter(e=>Number.isInteger(e.number)&&e.number>0);let n={created:0,marker:1,legacy:2,derived:3};return[...e.prRefs].sort((e,t)=>n[e.origin]-n[t.origin]).map(e=>({number:e.number,url:e.url??ic(`PR`,e.number,t),origin:e.origin}))}function Zs(e){let t=[];return e.pullRequestUrl&&t.push(e.pullRequestUrl),!(e.markerRefs?.issue!==void 0&&e.markerRefs?.pr===void 0)&&e.referencedPullRequestUrl&&t.push(e.referencedPullRequestUrl),t}function Qs(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.markerRefs?.issue??e.issueNumber;if(!(!n||!t)&&!$s(e.referencedIssueCandidates,n,t))return`${t}/issues/${n}`}function $s(e,t,n){let r=`${n.toLowerCase()}/`;return(e??[]).some(e=>e.endsWith(`/${t}`)&&!e.toLowerCase().startsWith(r))}function ec(e,t){return e.map((e,t)=>({reference:e,index:t})).sort((e,n)=>{let r=e.reference.kind===`PR`&&t(e.reference)===`closed`,i=n.reference.kind===`PR`&&t(n.reference)===`closed`;return Number(r)-Number(i)||e.index-n.index}).map(({reference:e})=>e)}function tc(e,t){let n=e.prRefs?.length?Xs(e,t).map(e=>({number:e.number,url:e.url})):Zs(e).map(e=>({url:e,number:Number(q(e))||void 0})),r=e.markerRefs?.pr,i=[...r===void 0||n.some(e=>e.number===r)?[]:[{kind:`PR`,number:r}],...n.map(e=>({kind:`PR`,url:e.url,number:e.number})),{kind:`PR`,number:rc(e,t)},{kind:`Issue`,url:Qs(e,t)},{kind:`Issue`,number:nc(e,t)}],a=new Set,o=[];for(let e of i){let n=e.url?Number(q(e.url)):e.number;if(!n||!Number.isInteger(n))continue;let r=e.url??ic(e.kind,n,t),i=o.findIndex(t=>t.kind===e.kind&&t.number===n&&(!t.url||!r||t.url===r));if(i>=0){!o[i].url&&r&&(o[i]={...o[i],url:r});continue}let s=`${e.kind}#${n}#${r??``}`;a.has(s)||(a.add(s),o.push({kind:e.kind,number:n,...r?{url:r}:{}}))}return o}function nc(e,t){let n=e.issueNumber;return n===void 0||!t?n:$s(e.referencedIssueCandidates,n,t)?void 0:n}function rc(e,t){let n=e.prNumber;return n===void 0||!t?n:$s(e.referencedPrCandidates,n,t)?void 0:n}function ic(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function ac(e,t){return tc(e,t)[0]}function q(e){let t=e.split(`/`).pop()??``;return/^\d+$/.test(t)?t:null}function oc(e,t){let n=Rs.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:Vs(n.rssBytes),kind:`live`}};let r=Vs(e.peakRssBytes);return{cpu:{text:``,kind:`none`},mem:r?{text:`peak ${r}`,kind:`peak`,title:`peak — run finished${e.peakProcCount?` · ${e.peakProcCount} procs`:``}`}:{text:``,kind:`none`}}}function sc(e,t){let n=e.filter(e=>t===`archived`?e.archived:!e.archived),r=new Map;for(let e of n){if(!e.groupId)continue;let t=r.get(e.groupId);t?t.push(e):r.set(e.groupId,[e])}return[...r.entries()].flatMap(([e,t])=>{let n=t[0];return!n||t.length<2||!t.every(e=>zs.has(e.status))?[]:[{groupId:e,title:Ds(n),count:t.length}]})}function cc(e,t,n){if(!n)return[];let r=t.kind===`pr`?`PR`:`Issue`,i=`${n.toLowerCase()}/`;return e.filter(e=>tc(e,n).some(e=>e.kind===r&&e.number===t.number&&e.url?.toLowerCase().startsWith(i))).sort((e,t)=>K(e.createdAt,t.createdAt))}function lc(e){return 220+Math.max(0,e)*14}function uc(e){let t=new Map;for(let n of e)for(let e of n.tags??[]){let n=e.toLowerCase();t.has(n)||t.set(n,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function dc(e,t,n,r=8){let i=n.trim().toLowerCase(),a=new Set(t.map(e=>e.toLowerCase())),o=e.filter(e=>{let t=e.toLowerCase();return a.has(t)?!1:i===``||t.includes(i)&&t!==i});return i===``?o.slice(0,r):o.sort((e,t)=>Number(t.toLowerCase().startsWith(i))-Number(e.toLowerCase().startsWith(i))||e.localeCompare(t,void 0,{sensitivity:`base`})).slice(0,r)}function fc(e){let t=new Map;for(let n of e){let e=n.trim();if(!e)continue;let r=e.toLowerCase();t.has(r)||t.set(r,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}var pc=`/api/v1/ws`,mc=3e3,hc=1e3,gc=7e4,_c=0,vc=1;function yc(e){let t=new Map,n=new Map,r=null,i,a,o,s=()=>{clearTimeout(o),o=setTimeout(()=>{o=void 0,r?.close()},gc)},c=()=>e??`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${pc}`,l=e=>{r?.readyState===vc&&r.send(JSON.stringify(e))},u=()=>{let e=globalThis.WebSocket;if(typeof e!=`function`||r&&(r.readyState===_c||r.readyState===vc))return;let a=new e(c());r=a,a.addEventListener(`open`,()=>{if(a===r){s();for(let e of t.keys())l({type:`subscribe`,topic:e})}}),a.addEventListener(`message`,e=>{if(a!==r)return;s();let i;try{i=JSON.parse(e.data)}catch{return}if(typeof i!=`object`||!i)return;let{type:o,topic:c,data:l}=i;if(typeof c!=`string`)return;if(o===`error`){for(let e of[...n.get(c)??[]])e();return}if(o!==`event`)return;let u=t.get(c);if(u)for(let e of[...u])e(l)}),a.addEventListener(`close`,()=>{a===r&&(r=null,clearTimeout(o),o=void 0,t.size>0&&i===void 0&&(i=setTimeout(()=>{i=void 0,t.size>0&&u()},mc)))}),a.addEventListener(`error`,()=>void 0)};return{subscribe(e,s,c){let d=()=>c?.();c&&(n.has(e)||n.set(e,new Set),n.get(e).add(d));let f=t.get(e);f||(f=new Set,t.set(e,f));let p=f.size===0;f.add(s),clearTimeout(a),a=void 0,r?p&&l({type:`subscribe`,topic:e}):(clearTimeout(i),i=void 0,u());let m=!0;return()=>{m&&(m=!1,n.get(e)?.delete(d),n.get(e)?.size||n.delete(e),f.delete(s),!(f.size>0)&&(t.delete(e),l({type:`unsubscribe`,topic:e}),t.size===0&&a===void 0&&(a=setTimeout(()=>{a=void 0,!(t.size>0)&&(clearTimeout(i),i=void 0,clearTimeout(o),o=void 0,r?.close(),r=null)},hc))))}}}}var bc=null;function xc(e,t,n){return bc??=yc(),bc.subscribe(e,t,n)}var J={secrets:{allFor:e=>[`secrets`,e],list:()=>[`secrets`,m()]},e2e:{allFor:e=>[`e2e`,e],status:()=>[`e2e`,m()]},tracker:{allFor:e=>[`tracker`,e],all:()=>[`tracker`,m()],associationFor:e=>[`tracker`,e,`association`],association:()=>[`tracker`,m(),`association`],candidates:(e,t=``)=>[`tracker`,m(),`candidates`,e,t],connection:()=>[`tracker`,m(),`connection`],items:(e,t)=>[`tracker`,m(),`items`,e.kind,e.source.id,e.source.webUrl,e.externalId,e.connectionId??null,t.state,[...t.labels],t.query??``],detail:(e,t)=>[`tracker`,m(),`detail`,e.kind,e.source.id,e.source.webUrl,e.externalId,e.connectionId??null,t]},get health(){return[m(),`health`]},runs:{get all(){return[m(),`runs`]},list:()=>[m(),`runs`,`list`],detail:e=>[m(),`runs`,`detail`,e],diff:e=>[m(),`runs`,`diff`,e],changes:e=>[m(),`runs`,`changes`,e],gitStatus:e=>[m(),`runs`,`git-status`,e],file:(e,t)=>[m(),`runs`,`files`,e,t],artifacts:e=>[m(),`runs`,`artifacts`,e],impactSubject:e=>[m(),`runs`,`impact-subject`,e],get impactSubjects(){return[m(),`runs`,`impact-subject`]},get projectAssets(){return[m(),`runs`,`project-assets`]},artifactText:(e,t,n)=>[m(),`runs`,`artifact-text`,e,t,n],handoff:e=>[m(),`runs`,`handoff`,e],drafts:e=>[m(),`runs`,`drafts`,e],commits:e=>[m(),`runs`,`commits`,e],tree:e=>[m(),`runs`,`tree`,e],commit:(e,t)=>[m(),`runs`,`commit`,e,t]},groups:{detail:e=>[m(),`groups`,e]},get todos(){return[m(),`todos`]},get workflows(){return[m(),`workflows`]},get workflowNodes(){return[m(),`workflow-nodes`]},get skills(){return[m(),`skills`]},get skillsReady(){return[m(),`skills`,`ready`]},get importableSkills(){return[m(),`skills`,`importable`]},get importableSkillsReady(){return[m(),`skills`,`importable`,`ready`]},get launchKey(){return[m(),`launch-key`]},get repo(){return[m(),`repo`]},get repoChanges(){return[m(),`repo`,`changes`]},repoCommit:e=>[m(),`repo`,`commit`,e],get repoSync(){return[m(),`repo`,`sync`]},get repoTree(){return[m(),`repo`,`tree`]},repoFile:e=>[m(),`repo`,`file`,e],get uiState(){return[m(),`ui-state`]},get config(){return[m(),`config`]},get agentConfig(){return[m(),`agent-config`]},agentConfigFile:e=>[m(),`agent-config`,`file`,e],get worktrees(){return[m(),`worktrees`]},github:(e={})=>[m(),`github`,e.limit??null],githubPages:(e=50)=>[m(),`github`,`pages`,e],githubChecks:e=>[m(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[m(),`github`,`search`,e,t],githubRefStatus:(e,t,n)=>[e,`github`,`ref-status`,[...t].sort((e,t)=>e-t).join(`,`),[...n].sort((e,t)=>e-t).join(`,`)],githubComments:(e,t)=>[m(),`github`,`comments`,e,t],githubMergeState:e=>[m(),`github`,`merge-state`,e],get openTargets(){return[m(),`open-targets`]}},Sc=6e4;function Cc(){return M({queryKey:J.secrets.list(),queryFn:({signal:e})=>Tr({signal:e})})}function wc(){return M({queryKey:Y.secrets,queryFn:({signal:e})=>Er({signal:e})})}function Tc(){return M({queryKey:J.e2e.status(),queryFn:({signal:e})=>Mr({signal:e})})}function Ec(){return M({queryKey:J.tracker.connection(),queryFn:({signal:e})=>Sr({signal:e})})}function Dc(){return M({queryKey:J.tracker.association(),queryFn:({signal:e})=>Pr({signal:e})})}function Oc(e,t,n){return Lt({queryKey:J.tracker.candidates(e,t),staleTime:Sc,queryFn:({pageParam:n,signal:r})=>Fr(e,{q:t.trim()||void 0,cursor:n,limit:50},{signal:r}),initialPageParam:void 0,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,enabled:n})}var kc=class extends Error{failure;constructor(e){super(e.reason),this.failure=e,this.name=`TrackerRefreshError`}};function Ac(e,t,n=!0){let r=t.query.trim(),i=j(),a=e?J.tracker.items(e,{...t,query:r}):[`tracker`,m(),`items`,`unassociated`];return{...Lt({queryKey:a,staleTime:1/0,queryFn:({pageParam:n,signal:i})=>r?Br(r,{association:e??void 0,cursor:n,limit:50,state:t.state,labels:t.labels,refresh:!0},{signal:i}):zr({association:e??void 0,cursor:n,limit:50,state:t.state,labels:t.labels,refresh:!1},{signal:i}),initialPageParam:void 0,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,enabled:e!=null&&n}),queryKey:a,restart:async()=>{await i.cancelQueries({queryKey:a,exact:!0});try{await i.fetchInfiniteQuery({queryKey:a,initialPageParam:void 0,pages:1,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,staleTime:0,retry:!1,queryFn:async({signal:n})=>{let i={association:e??void 0,limit:50,state:t.state,labels:t.labels,refresh:!0},a=r?await Br(r,i,{signal:n}):await zr(i,{signal:n});if(!a.available)throw new kc(a);return a}})}catch{}}}}function jc(e,t){return M({staleTime:Sc,queryKey:e&&t?J.tracker.detail(e,t):[`tracker`,m(),`detail`,`disabled`],queryFn:({signal:n})=>Vr(t,{signal:n,association:e??void 0}),enabled:e!=null&&t!=null&&t!==``})}var Y={dashboard:[`workspace`,`dashboard`],models:e=>[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],agentSetup:[`workspace`,`providers`,`setup`],projects:[`workspace`,`projects`],githubOwners:[`workspace`,`github-owners`],githubLogin:[`workspace`,`github-login`],repoSuggestions:[`workspace`,`repo-suggestions`],runsIndex:[`workspace`,`runs-index`],secrets:[`workspace`,`secrets`],uiState:[`workspace`,`ui-state`],config:[`workspace`,`config`],hostUsage:[`workspace`,`host-usage`],agentProfiles:[`workspace`,`agent-profiles`],agentFallbackPolicy:e=>[`workspace`,`agent-profiles`,`fallback-policy`,e],agentAccountDetails:e=>[`workspace`,`agent-profiles`,`details`,e],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],skillsUpdateAll:[`workspace`,`skills-update`],skillsUpdate:e=>[`workspace`,`skills-update`,e],selfUpdate:[`workspace`,`self-update`],selfUpdateDevelopment:[`workspace`,`self-update`,`development`],starCount:[`workspace`,`star-count`],telemetryConsent:[`workspace`,`telemetry-consent`],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...Y.fsBrowseRoot,e,t]};function X(e,t=!0){return M({queryKey:Y.models(e),queryFn:({signal:t})=>r(e)?kn(e,{signal:t}):Promise.reject(Error(`${e} has no host model catalog`)),staleTime:300*1e3,enabled:t&&r(e)})}function Mc(e=!0){let t=X(`claude`,e),n=X(`codex`,e),r=X(`opencode`,e),i=X(`cursor`,e),a=X(`pi`,e);return{claude:t,codex:n,junie:X(`junie`,e),opencode:r,cursor:i,pi:a,copilot:X(`copilot`,e),omp:X(`omp`,e),antigravity:X(`antigravity`,e),gemini:X(`gemini`,e),kimi:X(`kimi`,e)}}function Nc(){let e=j();return M({queryKey:Y.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(Y.providerStatus),r=await An(!1,{signal:t});return Zt(n,e.getQueryData(Y.providerStatus),r)},staleTime:5*6e4,refetchInterval:!1,refetchOnWindowFocus:!0})}function Pc(){let e=j();return N({mutationFn:()=>An(!0),onMutate:()=>e.getQueryData(Y.providerStatus),onSuccess:(t,n,r)=>e.setQueryData(Y.providerStatus,e=>Zt(r,e,t))})}function Fc(){return M({queryKey:Y.agentSetup,queryFn:({signal:e})=>Bn({signal:e}),retry:!1,gcTime:0,refetchInterval:e=>{let t=e.state.data;return t?.available&&t.session?.exitCode===null?Ic:!1},refetchIntervalInBackground:!0})}var Ic=1e3;function Lc(){let e=j();return(0,A.useCallback)(()=>void e.invalidateQueries({queryKey:J.health}),[e])}function Rc(){let e=j();return N({mutationFn:({provider:e,action:t})=>Vn(e,t),retry:!1,onSuccess:t=>e.setQueryData(Y.agentSetup,e=>e?.available?{...e,session:t}:e),onSettled:()=>e.invalidateQueries({queryKey:Y.agentSetup})})}function zc(){let e=j();return N({mutationFn:e=>Gn(e),retry:!1,onSettled:()=>e.invalidateQueries({queryKey:Y.agentSetup})})}function Bc(){let e=j();return N({mutationFn:({provider:e,authFailureId:t})=>di(e,t),onMutate:()=>e.getQueryData(Y.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(Y.providerStatus,e=>Zt(r,e,t,n.authFailureId))}})}function Vc(){return M({queryKey:Y.projects,queryFn:({signal:e})=>Mn({signal:e})})}function Hc(e,t=!1){return M({queryKey:Y.fsBrowse(e,t),queryFn:({signal:n})=>Nn(e??void 0,{signal:n,showHidden:t}),retry:!1})}function Uc(){let e=j();return N({mutationFn:e=>fi(e),onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function Wc(){let e=j();return N({mutationFn:e=>gi(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:Y.projects})}})}function Gc(){let e=j();return N({mutationFn:e=>{let{id:t,...n}=e;return _i(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:Y.projects});let r=e.getQueryData(Y.projects);return e.setQueryData(Y.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?Kc(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(Y.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(Y.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:Y.projects})})}function Kc(e,t){let{maxParallel:n,tags:r,...i}=e,a={...i},o=`maxParallel`in t?t.maxParallel:e.maxParallel;o!=null&&(a.maxParallel=o);let s=`tags`in t&&t.tags!==void 0?t.tags:e.tags,c=s==null?[]:fc(s);return c.length>0&&(a.tags=c),a}function qc(e){let t=j();return N({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:Y.agentProfiles}),t.invalidateQueries({queryKey:Y.projects})])}})}function Jc(){return qc(e=>Ya(e))}function Yc(){return qc(e=>{let{id:t,...n}=e;return eo(t,n)})}function Xc(){return qc(e=>to(e))}function Zc(){return qc(e=>$a(e))}function Qc(e,t){return M({queryKey:Y.agentAccountDetails(e),queryFn:({signal:t})=>Za(e,{signal:t}),enabled:t,staleTime:0,retry:!1})}function $c(e,t){return M({queryKey:Y.agentAccountStatus(e),queryFn:({signal:t})=>Xa(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function el(){let e=j();return N({mutationFn:({provider:e,profileId:t})=>ci(e,t),retry:!1,onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Y.agentProfiles}),e.invalidateQueries({queryKey:Y.providerStatus})])}})}function tl(){let e=j();return N({mutationFn:e=>Xa(e,{recheck:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(Y.agentAccountStatus(n),t),e.invalidateQueries({queryKey:Y.agentProfiles})}})}function nl(){return N({mutationFn:e=>{let{routeId:t,...n}=e;return Qa(t,n)},retry:!1})}function rl(){let e=j();return N({mutationFn:e=>pi(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function il(){let e=j();return N({mutationFn:e=>mi(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function al(e=!0){return M({queryKey:Y.repoSuggestions,queryFn:({signal:e})=>Pn({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function ol(){let e=j();return N({mutationFn:e=>Fn(e),retry:!1,onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:Y.projects}),e.invalidateQueries({queryKey:J.repo}),e.invalidateQueries({queryKey:J.health})])})}function sl(){let e=j();return N({mutationFn:({projectId:e,owner:t,name:n})=>In(e,{owner:t,name:n}),retry:!1,onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:Y.projects}),e.invalidateQueries({queryKey:J.repo}),e.invalidateQueries({queryKey:J.health})])})}function cl(e){let t=j(),n=(0,A.useRef)(e);n.current=e;let r=(0,A.useRef)(!1),i=N({mutationFn:Ln,retry:!1,onMutate:()=>{r.current=!0,t.setQueryData(Y.githubLogin,{status:`starting`})},onSuccess:e=>t.setQueryData(Y.githubLogin,e)}),a=N({mutationFn:zn,retry:!1,onMutate:()=>{r.current=!1},onSuccess:e=>t.setQueryData(Y.githubLogin,e)}),o=M({queryKey:Y.githubLogin,queryFn:({signal:e})=>Rn({signal:e}),enabled:i.isSuccess,refetchInterval:e=>{let t=e.state.data?.status;return t===`pending`||t===`starting`?2e3:!1},staleTime:0,retry:!1}),s=r.current||i.isPending||i.isSuccess?o.data:void 0,c=s?.status,l=s?.status===`done`?s.login:void 0;return(0,A.useEffect)(()=>{c!==`done`||!r.current||(r.current=!1,Promise.all([t.invalidateQueries({queryKey:Y.githubOwners}),t.invalidateQueries({queryKey:Y.projects}),t.invalidateQueries({queryKey:[m(),`github`]}),t.invalidateQueries({queryKey:J.repo}),t.invalidateQueries({queryKey:J.health})]),n.current?.(l))},[c,l,t]),{state:s,start:i,cancel:a}}function ll(){return M({queryKey:Y.githubOwners,queryFn:({signal:e})=>hi({signal:e}),staleTime:5*6e4,retry:!1})}function ul(){let e=j();(0,A.useEffect)(()=>{let t,n=()=>{let n=e.getQueryData(J.health)?.capabilities?.localHandoff===!0;n&&t===void 0?t=xc(`health`,t=>{e.setQueryData(J.health,t)}):!n&&t!==void 0&&(t(),t=void 0)};n();let r=e.getQueryCache().subscribe(n);return()=>{r(),t?.()}},[e])}function dl(){return M({queryKey:J.health,queryFn:({signal:e})=>wn({signal:e}),refetchInterval:e=>pl(e.state.data)})}var fl=3e4;function pl(e){return e?.capabilities?.localHandoff===!1&&e.forge!=null&&e.forge.available!==!0&&fl}function ml(){let e=dl().data,t=Vc().data?.projects,{projectId:n}=Bt(),r=n??e?.bootProject,i=r===void 0?void 0:t?.find(e=>e.id===r);return i?.repoUrl?i.repoUrl:n===null||n===e?.bootProject?qs(e?.repo?.remote,e?.forge?.kind===`github`):void 0}function hl(){return M({queryKey:J.openTargets,queryFn:({signal:e})=>Gi({signal:e}),staleTime:5*6e4})}function gl(e){return M({queryKey:J.runs.list(),queryFn:({signal:e})=>Kn({signal:e}),select:e})}function _l(e=!0,t){return M({queryKey:Y.runsIndex,queryFn:({signal:e})=>Jn({signal:e}),enabled:e,staleTime:3e4,...t===void 0?{}:{refetchInterval:typeof t==`function`?e=>t(e.state.data):t}})}function vl(e,t=!0,n=!1,r){return M({queryKey:[n?`default`:e,`runs`,`list`],queryFn:({signal:t})=>qn(e,{signal:t}),enabled:t,select:r})}function yl(e,t,n){let r=e==="default"?null:e,i=r===null||t!=null&&r===t;return vl(i?`default`:r??`default`,!0,i,n)}function bl(e){return{queryKey:J.runs.detail(e),queryFn:({signal:t})=>Yn(e,{signal:t})}}function xl(e){return M({...bl(e??``),enabled:!!e})}function Sl(e,t,n=!0){return M({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Xn(e,t,{signal:n}),enabled:n&&!!e&&!!t})}function Cl(e){return M({queryKey:J.runs.diff(e??``),queryFn:({signal:t})=>Yr(e,{signal:t}),enabled:!!e})}function wl(e,t=!1){return M({queryKey:J.runs.changes(e??``),queryFn:({signal:t})=>Zr(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?4e3:!1,refetchOnWindowFocus:!0,staleTime:0})}function Tl(e,t,n=!1){return M({queryKey:J.runs.gitStatus(e),queryFn:({signal:t})=>Xi(e,{signal:t}),enabled:t,retry:!1,refetchInterval:n?1e4:!1,refetchOnWindowFocus:!0,staleTime:0})}function El(e,t=!0){return M({queryKey:J.runs.tree(e??``),queryFn:({signal:t})=>_r(e,{signal:t}),enabled:t&&!!e,retry:!1,staleTime:0})}function Dl(e,t){return M({queryKey:J.runs.file(e??``,t??``),queryFn:({signal:n})=>Qr(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function Ol(e){return M({queryKey:J.runs.artifacts(e??``),queryFn:({signal:t})=>ei(e,{signal:t}),enabled:!!e,retry:!1})}function kl(e,t,n){return M({queryKey:J.runs.artifactText(e,t??``,n??``),queryFn:({signal:n})=>ni(e,t,{signal:n}),enabled:t!==void 0&&n!==void 0,retry:!1,staleTime:1/0})}function Al(e){return M({queryKey:J.runs.impactSubject(e?W(e):``),queryFn:({signal:t})=>ai(e,{signal:t}),enabled:e!==null,retry:!1})}function jl(){return M({queryKey:J.runs.projectAssets,queryFn:({signal:e})=>oi({signal:e}),retry:!1})}function Ml(){let e=j();return N({mutationFn:e=>ii(e),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:J.runs.impactSubject(W(n.subject))}),e.invalidateQueries({queryKey:J.runs.list()})}})}function Nl(e){return M({queryKey:J.groups.detail(e??``),queryFn:({signal:t})=>si(e,{signal:t}),enabled:!!e})}function Pl(e,t=!1){return M({queryKey:J.runs.commits(e??``),queryFn:({signal:t})=>vr(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?5e3:!1})}function Fl(e,t){return M({queryKey:J.runs.commit(e??``,t??``),queryFn:({signal:n})=>yr(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function Il(e,t=!0){return M({queryKey:J.runs.handoff(e??``),queryFn:({signal:t})=>Xr(e,{signal:t}),enabled:!!e&&t})}function Ll(e){return M({queryKey:J.runs.drafts(e??``),queryFn:({signal:t})=>aa(e,{signal:t}),enabled:!!e,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1})}function Rl(e=!0){return M({queryKey:J.todos,queryFn:({signal:e})=>or({signal:e}),enabled:e})}function zl(){return M({queryKey:J.workflowNodes,queryFn:({signal:e})=>Pa({signal:e}),staleTime:1/0})}function Bl(e={}){return M({queryKey:J.workflows,enabled:e.enabled??!0,queryFn:({signal:e})=>er({signal:e})})}function Vl(e=!0){let t=j(),n=J.skills,r=n[0],i=M({queryKey:n,queryFn:({signal:e})=>tr({signal:e}),enabled:e}),a=M({queryKey:J.skillsReady,queryFn:({signal:e})=>nr({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,A.useEffect)(()=>{if(!Array.isArray(a.data))return;let e=t.getQueryState([r,`skills`])?.dataUpdatedAt??0;a.dataUpdatedAt<e||t.setQueryData([r,`skills`],a.data)},[t,a.data,a.dataUpdatedAt,r]),i}function Hl(e=!0){let t=j(),n=J.importableSkills,r=n[0],i=M({queryKey:n,queryFn:({signal:e})=>ir({signal:e}),enabled:e}),a=M({queryKey:J.importableSkillsReady,queryFn:({signal:e})=>ar({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,A.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`,`importable`],a.data)},[t,a.data,r]),i}function Ul(){return M({queryKey:J.launchKey,queryFn:({signal:e})=>jn({signal:e}),staleTime:1/0})}function Wl(){return M({queryKey:J.repo,queryFn:({signal:e})=>sr({signal:e})})}function Gl(){return M({queryKey:J.repoSync,queryFn:({signal:e})=>ma({signal:e}),refetchOnWindowFocus:!0})}function Kl(){let e=j();return N({mutationFn:e=>ha(e),onSuccess:t=>{e.setQueryData(J.repoSync,t.sync),e.invalidateQueries({queryKey:J.repo,predicate:e=>e.queryKey[2]!==`sync`})}})}function ql(){return M({queryKey:J.repoChanges,queryFn:({signal:e})=>fr({signal:e}),retry:!1})}function Jl(){return M({queryKey:J.repoTree,queryFn:({signal:e})=>pr({signal:e}),retry:!1,refetchOnWindowFocus:!0,staleTime:0})}function Yl(e){return M({queryKey:J.repoFile(e??``),queryFn:({signal:t})=>mr(e,{signal:t}),enabled:e!==void 0&&e!==``,retry:!1,refetchOnWindowFocus:!0,staleTime:0})}function Xl(e){return M({queryKey:J.repoCommit(e??``),queryFn:({signal:t})=>gr(e,{signal:t}),enabled:!!e,retry:!1})}function Zl(){return M({queryKey:J.config,queryFn:({signal:e})=>cr({signal:e})})}function Ql(){return M({queryKey:J.worktrees,queryFn:({signal:e})=>ho({signal:e})})}function $l(){return M({queryKey:J.uiState,queryFn:({signal:e})=>$n({signal:e})})}function eu(){return M({queryKey:J.agentConfig,queryFn:({signal:e})=>lr({signal:e})})}function tu(e){return M({queryKey:J.agentConfigFile(e??``),queryFn:({signal:t})=>ur(e,{signal:t}),enabled:e!==null})}function nu(e){let t=j(),n=J.agentConfig,r=J.agentConfigFile(e);return N({mutationFn:t=>dr(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}function ru(){return M({queryKey:Y.uiState,queryFn:({signal:e})=>Ba({signal:e})})}function iu(){return M({queryKey:Y.config,queryFn:({signal:e})=>Ha({signal:e})})}function au(){return M({queryKey:Y.agentProfiles,queryFn:({signal:e})=>Ka({signal:e})})}function ou(e){return M({queryKey:Y.agentFallbackPolicy(e??`default`),queryFn:({signal:t})=>qa({projectId:e??`default`},{signal:t}),enabled:e!==null,retry:!1})}function su(e){let t=j();return N({mutationFn:t=>Ja({projectId:e??`default`,...t}),retry:!1,onSuccess:n=>t.setQueryData(Y.agentFallbackPolicy(e??`default`),n)})}var cu=15*6e4;function lu(e=!0){let t=j();return(0,A.useEffect)(()=>{if(e)return t.getQueryCache().subscribe(e=>{e.type!==`updated`||e.action.type!==`success`||e.action.manual||e.query.queryHash!==du&&t.prefetchQuery(uu)})},[e,t]),M({...uu,enabled:e,refetchOnMount:!1})}var uu={queryKey:Y.starCount,queryFn:({signal:e})=>Tn({signal:e}),staleTime:cu,retry:!1},du=T(Y.starCount);function fu(){return M({queryKey:Y.telemetryConsent,queryFn:({signal:e})=>Dn({signal:e}),staleTime:1/0,retry:!1})}var pu=6;function mu(e,t=!0){return M({queryKey:Y.skillsUpdate(e),queryFn:({signal:t})=>no(e,{signal:t}),enabled:t,refetchInterval:e=>{let t=e.state.data?.status;return(t===void 0||t===`checking`||t===`updating`||t===`idle`&&e.state.dataUpdateCount<pu)&&6e4}})}function hu(e=!0){return M({queryKey:Y.selfUpdate,queryFn:({signal:e})=>ao({signal:e}),enabled:e,refetchInterval:e=>e.state.data?.job?.status===`running`?1e3:e.state.data?.scheduled?5e3:!1})}function gu(e=!0){return M({queryKey:Y.selfUpdateDevelopment,queryFn:({signal:e})=>so({signal:e}),enabled:e,staleTime:3e4})}function _u(){let e=j();return N({mutationFn:()=>so({refresh:!0}),onSuccess:t=>e.setQueryData(Y.selfUpdateDevelopment,t)})}function vu(){let e=j();return N({mutationFn:()=>oo(),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function yu(){let e=j();return N({mutationFn:e=>co(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function bu(){let e=j();return N({mutationFn:e=>lo(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function xu(){let e=j();return N({mutationFn:e=>uo(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function Su(){let e=j();return N({mutationFn:()=>fo(),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function Cu(e){let t=j();return N({mutationFn:t=>zi(e,t),onSuccess:e=>{wu(t,e),t.invalidateQueries({queryKey:J.runs.all})}})}function wu(e,t){e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t.id?is(e,t):e)),e.setQueryData(J.runs.detail(t.id),e=>e?is(e,t):t),Tu(e)}function Tu(e){e.invalidateQueries({queryKey:Y.runsIndex})}function Eu(){let e=j();return N({mutationFn:e=>ki(e),onMutate:async t=>{await e.cancelQueries({queryKey:J.runs.list()}),await e.cancelQueries({queryKey:J.runs.detail(t)});let n=e.getQueryData(J.runs.list()),r=e.getQueryData(J.runs.detail(t)),i=new Date().toISOString();return e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t?{...e,seenAt:i}:e)),e.setQueryData(J.runs.detail(t),e=>e&&{...e,seenAt:i}),{prevList:n,prevDetail:r,id:t}},onError:(t,n,r)=>{r?.prevList&&e.setQueryData(J.runs.list(),r.prevList),r?.prevDetail&&e.setQueryData(J.runs.detail(n),r.prevDetail)},onSuccess:t=>{let n=e=>e.id===t.id?{...e,seenAt:t.seenAt}:e;e.setQueryData(J.runs.list(),e=>e?.map(n)),e.setQueryData(J.runs.detail(t.id),e=>e?n(e):t),Tu(e)}})}function Du(){let e=j();return N({mutationFn:e=>Ai(e),onMutate:async t=>{await e.cancelQueries({queryKey:J.runs.list()}),await e.cancelQueries({queryKey:J.runs.detail(t)});let n=e.getQueryData(J.runs.list()),r=e.getQueryData(J.runs.detail(t));return e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t?Ou(e):e)),e.setQueryData(J.runs.detail(t),e=>e&&Ou(e)),{prevList:n,prevDetail:r,id:t}},onError:(t,n,r)=>{r?.prevList&&e.setQueryData(J.runs.list(),r.prevList),r?.prevDetail&&e.setQueryData(J.runs.detail(n),r.prevDetail)},onSuccess:t=>{let n=e=>e.id===t.id?Ou(e):e;e.setQueryData(J.runs.list(),e=>e?.map(n)),e.setQueryData(J.runs.detail(t.id),e=>e?n(e):t),Tu(e)}})}function Ou(e){let{seenAt:t,...n}=e;return n}function ku(e,t,n){let r=j();return N({mutationFn:({id:n,pinned:r,surface:i})=>t===void 0?Ci(n,r,i??e):wi(t,n,r,i??e),onSuccess:()=>r.invalidateQueries({queryKey:n===void 0?J.runs.all:[n,`runs`]})})}function Au(e,t,n){let r=j();return N({mutationFn:({id:n,archived:r})=>t===void 0?Si(n,r,e):Ti(t,n,r,e),onSuccess:()=>r.invalidateQueries({queryKey:n===void 0?J.runs.all:[n,`runs`]})})}function ju(e,t){let n=j();return N({mutationFn:n=>t===void 0?ta(e,n):na(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:J.runs.all}),onError:e=>{e instanceof F&&e.status===409&&n.invalidateQueries({queryKey:J.runs.all})}})}function Mu(e,t){let n=j();return N({mutationFn:(n={})=>t===void 0?Pi(e,n):Fi(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:J.runs.all})})}function Nu(e){let t=j();return N({mutationFn:({msgId:t,message:n})=>ra(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function Pu(e){let t=j();return N({mutationFn:t=>ia(e,t),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function Fu(e={},t=!0){return M({queryKey:J.github(e),queryFn:({signal:t})=>br({limit:e.limit},{signal:t}),enabled:t})}function Iu(e=50,t=!0){return Lt({queryKey:J.githubPages(e),queryFn:({pageParam:t,signal:n})=>br({limit:e,...t},{signal:n}),initialPageParam:{issuesCursor:void 0,prsCursor:void 0,issuesDone:!1,prsDone:!1},getNextPageParam:e=>{let t=e.issuesNextCursor??void 0,n=e.prsNextCursor??void 0;return t||n?{issuesCursor:t,prsCursor:n,issuesDone:!t,prsDone:!n}:void 0},enabled:t,staleTime:6e4})}function Lu(e,t=!0){return M({queryKey:J.githubChecks(e),queryFn:({signal:t})=>Hr(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function Ru(e,t,n=!0){return M({queryKey:J.githubSearch(e,t),queryFn:({signal:n})=>Ur(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var zu=100;function Bu(e){return[...e].sort((e,t)=>t-e).slice(0,zu).sort((e,t)=>e-t)}var Z=new Map(Ku()),Vu=1e3;function Hu(e,t){if(Z.get(e)!==t){for(Z.delete(e),Z.set(e,t);Z.size>Vu;){let e=Z.keys().next().value;if(e===void 0)break;Z.delete(e)}Yu()}}var Q=new Set(qu());function Uu(e,t){if(Q.has(e)!==t){if(t)for(Q.add(e);Q.size>Vu;){let e=Q.values().next().value;if(e===void 0)break;Q.delete(e)}else Q.delete(e);Yu()}}var Wu=`cez.reference-statuses.v1`,Gu=`cez.reference-conflicts.v1`;function Ku(){try{let e=globalThis.sessionStorage?.getItem(Wu);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&ls(e[1])):[]}catch{return[]}}function qu(){try{let e=globalThis.sessionStorage?.getItem(Gu);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var Ju;function Yu(){Ju===void 0&&(Ju=setTimeout(()=>{Ju=void 0;try{globalThis.sessionStorage?.setItem(Wu,JSON.stringify([...Z])),globalThis.sessionStorage?.setItem(Gu,JSON.stringify([...Q]))}catch{}},250))}function Xu(){let e=Bt(),t=dl();return e.projectId??t.data?.bootProject}function Zu(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))Hu($({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))Hu($({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var Qu=5*6e4;function $u(e){return e?e.recheckAfterMs:Qu}var $=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function ed(e,t=!0){let n=(0,A.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{prs:new Set,issues:new Set};e[n.kind===`PR`?`prs`:`issues`].add(n.number),t.set(n.projectId,e)}return[...t.entries()].map(([e,t])=>({projectId:e,prs:Bu(t.prs),issues:Bu(t.issues)}))},[e.map($).sort().join(`|`)]),r=Ft({queries:n.map(e=>({queryKey:J.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>Wr(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>$u(e.state.data)??1/0,refetchInterval:e=>$u(e.state.data)??!1,refetchOnWindowFocus:!0}))}),{byRef:i,learned:a}=(0,A.useMemo)(()=>{let e=new Map,t=[];return r.forEach((r,i)=>{let a=n[i];if(!a)return;let o=[...a.prs.map(e=>({projectId:a.projectId,kind:`PR`,number:e})),...a.issues.map(e=>({projectId:a.projectId,kind:`Issue`,number:e}))],s=r.data;for(let n of o){let i=$(n),a=Z.get(i),o=Q.has(i)?!0:void 0;if(s?.available){let r=s.prs[n.number]??s.issues[n.number];if(r){let a=s.conflicts?s.conflicts.includes(n.number):void 0;t.push({key:i,status:r,conflicting:a}),e.set(i,{state:`ready`,status:r,...a??o?{conflicting:!0}:{}})}else e.set(i,{state:`unknown`,...a?{status:a}:{}})}else s?e.set(i,{state:`unavailable`,reason:s.reason,...a?{status:a}:{},...o?{conflicting:!0}:{}}):r.isError?e.set(i,{state:`unavailable`,reason:r.error instanceof Error?r.error.message:void 0,...a?{status:a}:{},...o?{conflicting:!0}:{}}):e.set(i,{state:`loading`,...a?{status:a}:{},...o?{conflicting:!0}:{}})}}),{byRef:e,learned:t}},[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,A.useEffect)(()=>{for(let{key:e,status:t,conflicting:n}of a)Hu(e,t),n!==void 0&&Uu(e,n)},[a]),(0,A.useCallback)(e=>{let t=$(e),n=i.get(t);if(n)return n;let r=Z.get(t);return{state:`idle`,...r?{status:r}:{},...Q.has(t)?{conflicting:!0}:{}}},[i])}function td(e,t,n=!0){return M({queryKey:J.githubComments(e,t),queryFn:({signal:n})=>Gr(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function nd(e){return M({queryKey:[`github`,`pr-changes`,e??0],queryFn:({signal:t})=>Jr(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{Vc as $,Un as $a,Jo as $i,ys as $n,Sa as $r,Dc as $t,cl as A,Or as Aa,Vr as Ai,Qs as An,Ee as Ao,Yi as Ar,Dl as At,Lc as B,la as Ba,qr as Bi,Ls as Bn,Na as Br,xu as Bt,Tc as C,Wn as Ca,ko as Ci,Vs as Cn,nt as Co,Di as Cr,kl as Ct,Lu as D,ri as Da,no as Di,cc as Dn,T as Do,wa as Dr,Pl as Dt,Fu as E,Ea,ao as Ei,ec as En,Se as Eo,R as Er,Fl as Et,dl as F,xa as Fa,Co as Fi,Ws as Fn,Re as Fo,Ro as Fr,X as Ft,hl as G,Ho as Ga,Wi as Gi,Is as Gn,Ra as Gr,yu as Gt,Eu as H,Eo as Ha,Ki as Hi,Es as Hn,Bi as Hr,hu as Ht,ul as I,ya as Ia,W as Ii,As as In,ve as Io,pa as Ir,gl as It,jl as J,ba as Ja,zi as Ji,Ts as Jn,Ni as Jr,lu as Jt,Cu as K,Po as Ka,vo as Ki,Ns as Kn,Wa as Kr,Vl as Kt,Al as L,Ei as La,ja as Li,K as Ln,b as Lo,vi as Lr,yl as Lt,nd as M,Cr as Ma,Ga as Mi,ac as Mn,S as Mo,Pi as Mr,Il as Mt,Ru as N,Ia as Na,Ba as Ni,tc as Nn,E as No,va as Nr,El as Nt,td as O,Da as Oa,Wo as Oi,Us as On,De as Oo,ro as Or,Cl as Ot,Nl as P,Ar as Pa,So as Pi,oc as Pn,C as Po,Yo as Pr,Mc as Pt,Cc as Q,xo as Qa,Aa as Qi,_s as Qn,Ma as Qr,Rl as Qt,Hl as R,ui as Ra,Mi as Ri,Ds as Rn,Li as Rr,_l as Rt,il as S,hr as Sa,Ko as Si,Hs as Sn,mt as So,Gn as Sr,xl as St,Hc as T,No as Ta,Fo as Ti,q as Tn,k as To,yi as Tr,wl as Tt,Du as U,xi as Ua,Ji as Ui,ws as Un,fa as Ur,gu as Ut,Ul as V,Nr as Va,En as Vi,ks as Vn,Oa as Vr,Zc as Vt,nl as W,Hi as Wa,qi as Wi,Fs as Wn,ua as Wr,ju as Wt,Sl as X,Ua as Xa,ga as Xi,ds as Xn,Xa as Xr,Ml as Xt,ml as Y,li as Ya,Ui as Yi,Ps as Yn,Za as Yr,Rc as Yt,vl as Z,Fa as Za,ca as Zi,ms as Zn,Ta as Zr,fu as Zt,rl as _,kr as _a,aa as _i,dc as _n,Lt as _o,Ri as _r,al as _t,bl as a,qo as aa,Gr as ai,Yc as an,sn as ao,cs as ar,ed as at,Mu as b,wr as ba,Zn as bi,Gs as bn,St as bo,Ti as br,Jl as bt,eu as c,po as ca,wn as ci,Bl as cn,Xt as co,rs as cr,_u as ct,au as d,zo as da,To as di,ru as dn,en as do,ts as dr,Wc as dt,Oo as ea,_a as ei,Oc as en,Bo as eo,G as er,Nc as et,Fc as f,jo as fa,Xn as fi,Ql as fn,nn as fo,is as fr,Pu as ft,Su as g,bo as ga,da as gi,uc as gn,Bt as go,Do as gr,Yl as gt,zc as h,rr as ha,vr as hi,xc as hn,Vt as ho,Qi as hr,Xl as ht,Zu as i,sa as ia,Zo as ii,$l as in,ln as io,bs as ir,Xu as it,ll as j,Ir as ja,zr as ji,Ys as jn,Te as jo,ci as jr,Tl as jt,Iu as k,$r as ka,xr as ki,lc as kn,Fe as ko,Lr as kr,Ll as kt,tu as l,Va as la,jn as li,iu as ln,qt as lo,ns as lr,Uc as lt,Au as m,go as ma,Uo as mi,wu as mn,zt as mo,F as mr,ql as mt,kc as n,Zi as na,Xo as ni,jc as nn,hn as no,vs as nr,nu as nt,Qc as o,On as oa,Jr as oi,Gc as on,on as oo,us as or,Pc as ot,bu as p,yo as pa,Lo as pi,Y as pn,tn as po,Qo as pr,Wl as pt,ku as q,V as qa,La as qi,Ms as qn,ka as qr,mu as qt,J as r,mo as ra,br as ri,Ac as rn,cn as ro,gs as rr,tl as rt,$c as s,za as sa,Kr as si,zl as sn,Ut as so,as as sr,vu as st,Sc as t,bi as ta,cr as ti,Ec as tn,Mo as to,hs as tr,sl as tt,ou as u,Hn as ua,wo as ui,wc as un,Yt as uo,os as ur,Xc as ut,Zl as v,_o as va,Qr as vi,zs as vn,N as vo,io as vr,Gl as vt,Nu as w,Vo as wa,Io as wi,Js as wn,Ge as wo,Ca as wr,Ol as wt,Jc as x,jr as xa,Qn as xi,Ks as xn,j as xo,Si as xr,Bc as xt,el as y,Vi as ya,Xi as yi,sc as yn,M as yo,Oi as yr,Kl as yt,ol as z,Go as za,ji as zi,js as zn,Ao as zr,su as zt};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$ as r,Ht as i,It as a,Nt as o,Pt as s,Q as c,Rt as l,Vt as u,_ as d,_t as f,a as p,c as m,d as h,et as g,h as ee,i as _,l as v,o as te,pt as y,s as ne,v as re}from"./utils-Dp6vCdiU.js";var ie=/^[\w!#$%&'*.^`|~+-]+$/,ae=(e,t,n={})=>{if(!ie.test(e))throw Error(`Invalid cookie name`);let r=`${e}=${t}`;if(e.startsWith(`__Secure-`)&&!n.secure)throw Error(`__Secure- Cookie must have Secure attributes`);if(e.startsWith(`__Host-`)){if(!n.secure)throw Error(`__Host- Cookie must have Secure attributes`);if(n.path!==`/`)throw Error(`__Host- Cookie must have Path attributes with "/"`);if(n.domain)throw Error(`__Host- Cookie must not have Domain attributes`)}for(let e of[`domain`,`path`,`sameSite`,`priority`])if(n[e]&&/[;\r\n]/.test(n[e]))throw Error(`${e} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge==`number`&&n.maxAge>=0){if(n.maxAge>3456e4)throw Error(`Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.`);r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!==`host`&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw Error(`Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw Error(`Partitioned Cookie must have Secure attributes`);r+=`; Partitioned`}return r},oe=(e,t,n)=>(t=encodeURIComponent(t),ae(e,t,n)),se=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),ce=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??`);e=e.replace(t,r?`/${r}`:``)}return e},le=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.set(n,r);return t},ue=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},de=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function fe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pe(e,t){if(!fe(e)&&!fe(t))return t;let n={...e};for(let e in t){let r=t[e];fe(n[e])&&fe(r)?n[e]=pe(n[e],r):n[e]=r}return n}var me=(e,t)=>new Proxy(()=>{},{get(n,r){if(!(typeof r!=`string`||r===`then`))return me(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),he=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor(e,t,n){this.url=e,this.method=t,this.buildSearchParams=n.buildSearchParams}fetch=async(e,t)=>{if(e){if(e.query&&(this.queryParams=this.buildSearchParams(e.query)),e.form){let t=new FormData;for(let[n,r]of Object.entries(e.form))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.append(n,r);this.rBody=t}e.json&&(this.rBody=JSON.stringify(e.json),this.cType=`application/json`),e.param&&(this.pathParams=e.param)}let n=this.method.toUpperCase(),r={...e?.header,...typeof t?.headers==`function`?await t.headers():t?.headers};if(e?.cookie){let t=[];for(let[n,r]of Object.entries(e.cookie))t.push(oe(n,r,{path:`/`}));r.Cookie=t.join(`,`)}this.cType&&(r[`Content-Type`]=this.cType);let i=new Headers(r??void 0),a=this.url;a=de(a),a=ce(a,this.pathParams),this.queryParams&&(a=a+`?`+this.queryParams.toString()),n=this.method.toUpperCase();let o=!(n===`GET`||n===`HEAD`);return(t?.fetch||fetch)(a,{body:o?this.rBody:void 0,method:n,headers:i,...t?.init})}},ge=(e,t)=>me(function n(r){let i=t?.buildSearchParams??le,a=[...r.path],o=a.slice(-3).reverse();if(o[0]===`toString`)return o[1]===`name`?o[2]||``:n.toString();if(o[0]===`valueOf`)return o[1]===`name`?o[2]||``:n;let s=``;if(/^\$/.test(o[0])){let e=a.pop();e&&(s=e.replace(/^\$/,``))}let c=se(e,a.join(`/`));if(s===`url`||s===`path`){let t=c;return r.args[0]&&(r.args[0].param&&(t=ce(c,r.args[0].param)),r.args[0].query&&(t=t+`?`+i(r.args[0].query).toString())),t=de(t),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=ue(r.args[0]&&r.args[0].param?ce(c,r.args[0].param):c,`ws`),n=new URL(e),i=r.args[0]?.query;return i&&Object.entries(i).forEach(([e,t])=>{Array.isArray(t)?t.forEach(t=>n.searchParams.append(e,t)):n.searchParams.set(e,t)}),((...e)=>t?.webSocket!==void 0&&typeof t.webSocket==`function`?t.webSocket(...e):new WebSocket(...e))(n.toString())}let l=new he(c,s,{buildSearchParams:i});if(s){t??={};let e={...r.args[1]},n=t.headers,i=e.headers;n&&i&&(e.headers=async()=>({...typeof n==`function`?await n():n,...typeof i==`function`?await i():i}));let a=pe(t,e);return l.fetch(r.args[0],a)}return l},[]);function _e(e={}){let{baseUrl:t=``,token:n,headers:r,fetch:i}=e;return ge(t,{headers:{...n?{Authorization:`Bearer ${n}`}:{},...r},...i?{fetch:i}:{}})}var b=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(){}},ve=new class extends b{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},ye={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},x=new class{#e=ye;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function be(e){setTimeout(e,0)}var xe=typeof window>`u`||`Deno`in globalThis;function S(){}function Se(e,t){return typeof e==`function`?e(t):e}function Ce(e){return typeof e==`number`&&e>=0&&e!==1/0}function we(e,t){return Math.max(e+(t||0)-Date.now(),0)}function C(e,t){return typeof e==`function`?e(t):e}function w(e,t){return typeof e==`function`?e(t):e}function Te(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==De(o,t.options))return!1}else if(!E(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Ee(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(T(t.options.mutationKey)!==T(a))return!1}else if(!E(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function De(e,t){return(t?.queryKeyHashFn||T)(e)}function T(e){return JSON.stringify(e,(e,t)=>je(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function E(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>E(e[n],t[n])):!1}var Oe=Object.prototype.hasOwnProperty;function ke(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Ae(e)&&Ae(t);if(!r&&!(je(e)&&je(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Oe.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=ke(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function D(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Ae(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function je(e){if(!Me(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Me(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Me(e){return Object.prototype.toString.call(e)===`[object Object]`}function Ne(e){return new Promise(t=>{x.setTimeout(t,e)})}function Pe(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ke(e,t)}function Fe(e){return e}function Ie(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Le(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Re=Symbol();function ze(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Re?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Be(e,t){return typeof e==`function`?e(...t):!!e}function Ve(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var O=(()=>{let e=()=>xe;return{isServer(){return e()},setIsServer(t){e=t}}})();function He(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Ue=be;function We(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Ue,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var k=We(),Ge=new class extends b{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let 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.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Ke(e){return Math.min(1e3*2**e,3e4)}function qe(e){return(e??`online`)!==`online`||Ge.isOnline()}var Je=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ye(e){let t=!1,n=0,r,i=He(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Je(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>ve.isFocused()&&(e.networkMode===`always`||Ge.isOnline())&&e.canRun(),u=()=>qe(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(O.isServer()?0:3),o=e.retryDelay??Ke,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),Ne(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Xe=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ce(this.gcTime)&&(this.#e=x.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(O.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(x.clearTimeout(this.#e),this.#e=void 0)}};function Ze(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Ve(e,()=>t.signal,()=>n=!0)},u=ze(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Le:Ie;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?$e:Qe,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Qe(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Qe(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function $e(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function et(e,t){return t?Qe(e,t)!=null:!1}function tt(e,t){return!t||!e.getPreviousPageParam?!1:$e(e,t)!=null}var nt=class extends Xe{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=at(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=at(this.options);e.data!==void 0&&(this.setState(it(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Pe(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(S).catch(S):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>w(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Re||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>C(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!we(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.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.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ze(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Ze(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=Ye({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Je&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Je){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...rt(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...it(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),k.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function rt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:qe(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function it(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function at(e){let 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 ot=class extends b{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=He(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ct(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return lt(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return lt(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof w(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!D(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&ut(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||C(this.options.staleTime,this.#t)!==C(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ft(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(S)),t}#g(){this.#b();let e=C(this.options.staleTime,this.#t);if(O.isServer()||this.#r.isStale||!Ce(e))return;let t=we(this.#r.dataUpdatedAt,e)+1;this.#d=x.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(O.isServer()||w(this.options.enabled,this.#t)===!1||!Ce(this.#p)||this.#p===0)&&(this.#f=x.setInterval(()=>{(this.options.refetchIntervalInBackground||ve.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(x.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(x.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ct(e,t),o=i&&ut(e,n,t,r);(a||o)&&(l={...l,...rt(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=Pe(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=Pe(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,ee=m===`pending`,_=m===`error`,v=ee&&g,te=d!==void 0,y={status:m,fetchStatus:l.fetchStatus,isPending:ee,isSuccess:m===`success`,isError:_,isInitialLoading:v,isLoading:v,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!ee,isLoadingError:_&&!te,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:_&&te,isStale:dt(e,t),refetch:this.refetch,promise:this.#o,isEnabled:w(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=y.data!==void 0,r=y.status===`error`&&!t,i=e=>{r?e.reject(y.error):t&&e.resolve(y.data)},a=()=>{let e=this.#o=y.promise=He();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||y.data!==o.value)&&a();break;case`rejected`:(!r||y.error!==o.reason)&&a();break}}return y}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!D(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){k.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function st(e,t){return w(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&w(t.retryOnMount,e)===!1)}function ct(e,t){return st(e,t)||e.state.data!==void 0&&lt(e,t,t.refetchOnMount)}function lt(e,t,n){if(w(t.enabled,e)!==!1&&C(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&dt(e,t)}return!1}function ut(e,t,n,r){return(e!==t||w(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&dt(e,n)}function dt(e,t){return w(t.enabled,e)!==!1&&e.isStaleByTime(C(t.staleTime,e))}function ft(e,t){return!D(e.getCurrentResult(),t)}var pt=class extends ot{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:et(t,n.data),hasPreviousPage:tt(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},mt=class extends Xe{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||ht(),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.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Ye({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,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{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),k.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ht(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var gt=class extends b{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),D(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&T(t.mutationKey)!==T(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??ht();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){k.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function _t(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function vt(e,t,n){let r=e.slice(0);return r[t]=n,r}var yt=class extends b{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,k.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!D(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(_t(e,n).forEach(e=>{e.destroy()}),_t(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=ke(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new ot(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=vt(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&k.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},A=e(t(),1),bt=n(),xt=A.createContext(void 0),j=e=>{let t=A.useContext(xt);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},St=({client:e,children:t})=>(A.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,bt.jsx)(xt.Provider,{value:e,children:t})),Ct=A.createContext(!1),wt=()=>A.useContext(Ct);Ct.Provider;function Tt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Et=A.createContext(Tt()),Dt=()=>A.useContext(Et),Ot=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Be(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},kt=e=>{A.useEffect(()=>{e.clearReset()},[e])},At=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Be(n,[e.error,r])),jt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Mt=(e,t)=>e.isLoading&&e.isFetching&&!t,Nt=(e,t)=>e?.suspense&&t.isPending,Pt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ft({queries:e,...t},n){let r=j(n),i=wt(),a=Dt(),o=A.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{jt(e);let t=r.getQueryCache().get(e.queryHash);Ot(e,a,t)}),kt(a);let[s]=A.useState(()=>new yt(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;A.useSyncExternalStore(A.useCallback(e=>d?s.subscribe(k.batchCalls(e)):S,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),A.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>Nt(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&Nt(n,e)?Pt(n,new ot(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&At({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function It(e,t,n){let r=wt(),i=Dt(),a=j(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,jt(o),Ot(o,i,s),kt(i);let l=!a.getQueryCache().get(o.queryHash),[u]=A.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(A.useSyncExternalStore(A.useCallback(e=>{let t=f?u.subscribe(k.batchCalls(e)):S;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),A.useEffect(()=>{u.setOptions(o)},[o,u]),Nt(o,d))throw Pt(o,u,i);if(At({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!O.isServer()&&Mt(d,r)&&(l?Pt(o,u,i):s?.promise)?.catch(S).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function M(e,t){return It(e,ot,t)}function N(e,t){let n=j(t),[r]=A.useState(()=>new gt(n,e));A.useEffect(()=>{r.setOptions(e)},[r,e]);let i=A.useSyncExternalStore(A.useCallback(e=>r.subscribe(k.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=A.useCallback((e,t)=>{r.mutate(e,t).catch(S)},[r]);if(i.error&&Be(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Lt(e,t){return It(e,pt,t)}var Rt={projectId:null,apiBase:_},zt=(0,A.createContext)(Rt);function Bt(){return(0,A.useContext)(zt)}function Vt({projectId:e,children:t}){ne()!==e&&h(e),(0,A.useLayoutEffect)(()=>{h(e)},[e]),(0,A.useLayoutEffect)(()=>()=>h(null),[]);let n=(0,A.useMemo)(()=>e===null?Rt:{projectId:e,apiBase:`${_}/p/${encodeURIComponent(e)}`},[e]);return(0,bt.jsx)(zt.Provider,{value:n,children:t})}var Ht={claude:0,codex:1,junie:2,opencode:3,cursor:4,pi:5,copilot:6,omp:7,antigravity:8,gemini:9,kimi:10},Ut=[...l].sort((e,t)=>Ht[e]-Ht[t]),Wt=new Set([`connected`,`disconnected`,`not-installed`,`unknown`]);function Gt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Kt(e,t){if(!Gt(e))return null;let{provider:n,status:r,enabled:i,hint:a,authFailureId:o}=e;return typeof n!=`string`||!Ut.includes(n)||typeof r!=`string`||!Wt.has(r)||t&&typeof i!=`boolean`||!t&&i!==void 0&&typeof i!=`boolean`||a!==void 0&&typeof a!=`string`||o!==void 0&&(typeof o!=`string`||o.length<1||o.length>128||r!==`disconnected`)?null:{provider:n,status:r,...typeof i==`boolean`?{enabled:i}:{},...a===void 0?{}:{hint:a},...o===void 0?{}:{authFailureId:o}}}function qt(e){return Kt(e,!1)}function Jt(e,t){if(!Gt(e)||!Array.isArray(e.providers))return null;let n=[],r=new Set;for(let i of e.providers){let e=Kt(i,t);if(e===null||r.has(e.provider))return null;r.add(e.provider),n.push(e)}return n}function P(e){let t=Jt(e,!0);if(t===null||t.length===0)return null;let n=new Map(t.map(e=>[e.provider,e]));return Ut.flatMap(e=>{let t=n.get(e);return t?[t]:[]})}function Yt(e){let t=P(e);if(t===null)throw Error(`Invalid provider status response`);return{providers:t}}function Xt(e,t){let n=P(e);if(n!==null)return{providers:n.map(e=>e.provider===t.provider?{provider:t.provider,status:t.status,enabled:t.enabled??e.enabled,...t.hint===void 0?{}:{hint:t.hint},...t.authFailureId===void 0?{}:{authFailureId:t.authFailureId}}:e)}}function Zt(e,t,n,r){let i=P(e),a=P(t),o=P(n);if(o===null||a===null)return n;if(i===null)return{providers:a};let s=new Map(i.map(e=>[e.provider,e])),c=new Map(a.map(e=>[e.provider,e]));return{providers:o.map(e=>{let t=s.get(e.provider),n=c.get(e.provider);if(t===void 0||n===void 0)return n??e;let i=r!==void 0&&n.authFailureId===r&&e.authFailureId===void 0;return r!==void 0&&n.authFailureId!==void 0&&n.authFailureId!==r&&e.authFailureId===void 0?n:Qt(t,n)?e:i?{...e,enabled:n.enabled}:n})}}function Qt(e,t){return e.provider===t.provider&&e.status===t.status&&e.enabled===t.enabled&&e.hint===t.hint&&e.authFailureId===t.authFailureId}var $t=new Set([`junie`,`antigravity`,`omp`]);function en(e){return e.status===`connected`||e.status===`unknown`&&$t.has(e.provider)}function tn(e){let t=P(e);if(t===null)return[];let n=new Set(t.filter(e=>e.enabled&&en(e)).map(e=>e.provider));return Ut.filter(e=>n.has(e))}function nn(e,t){return P(e)?.find(e=>e.provider===t)}var rn=`cezar:sid`,an;function on(e=Date.now()){let t=crypto.getRandomValues(new Uint8Array(16));for(let n=0;n<6;n++)t[n]=Math.floor(e/2**(8*(5-n)))&255;t[6]=t[6]&15|112,t[8]=t[8]&63|128;let n=[...t].map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function sn(){try{let e=localStorage.getItem(rn);if(e)return e;let t=on();return localStorage.setItem(rn,t),t}catch{return an??=on()}}var cn=`x-cezar-sid`;function ln(){an=void 0;try{localStorage.removeItem(rn)}catch{}}function un(e){if(typeof e!=`object`||!e)return;let{name:t,message:n}=e;return{name:typeof t==`string`?t:`unknown`,message:typeof n==`string`?n:``}}var dn=/\/(?:providers|agent-profiles)(?:\/|$)/;function fn(e,t){if(!dn.test(e))return;let n=e.split(`/`),r=n[n.indexOf(`providers`)+1];if(n.includes(`providers`)&&c.safeParse(r).success)return r;if(typeof t==`string`)try{let e=JSON.parse(t).provider;return c.safeParse(e).success?e:void 0}catch{return}}var pn=null;function mn(e,t,n,r,i){try{let a=new URL(e,window.location.origin).pathname,o=fn(a,r),s=un(i);pn={method:(t??`GET`).toUpperCase(),path:a,status:n,at:Date.now(),...o?{provider:o}:{},...s?{cause:s}:{}}}catch{}}function hn(e=3e3,t=Date.now()){return pn&&t-pn.at<=e?pn:null}var F=class extends Error{status;manual;command;runIds;exists;constructor(e,t,n={}){super(t,n.cause===void 0?void 0:{cause:n.cause}),this.name=`ApiError`,this.status=e,this.manual=n.manual,this.command=n.command,this.exists=n.exists,this.runIds=n.runIds}};function I(e){try{return JSON.parse(e)}catch{return}}function gn(e){return typeof e==`string`?e:void 0}var _n=`the request was too large for the server, or for a proxy in front of it — attach fewer or smaller files, or raise the proxy body limit (nginx: client_max_body_size 32m)`;function L(e,t,n){let r=I(n),i=r&&typeof r==`object`?r:{},a=gn(i.error)??(e===413?_n:`${e} ${t||`request failed`}`.trim()),o=e===409?ee.safeParse(r):void 0;return new F(e,a,{...o?.success?{runIds:o.data.runIds}:{},manual:gn(i.manual),command:gn(i.command),exists:typeof i.exists==`boolean`?i.exists:void 0})}var R=_e({fetch:(e,t)=>xn(vn(String(e)),t)});function vn(e){let t=bn(e.endsWith(`?`)?e.slice(0,-1):e);return t.startsWith(`/`)?`${te()}${t}`:t}var yn=`${_}/p/default`;function bn(e){if(ne()!==null||!e.startsWith(yn))return e;let t=e.slice(yn.length);return t===``||t.startsWith(`/`)||t.startsWith(`?`)?`${_}${t}`:e}var z=e=>({init:{signal:e?.signal}});async function B(e){try{return await e.text()}catch(t){throw t instanceof DOMException&&t.name===`AbortError`?t:(mn(e.url,void 0,0,void 0,t),new F(0,`cannot reach the cezar server (${e.url})`,{cause:t}))}}async function V(e,t){let n=await B(e);if(!e.ok)throw L(e.status,e.statusText,n);let r=I(n);if(r===void 0)throw new F(e.status,`the cezar server answered ${t} with a non-JSON body`);return r}async function H(e,t,n){let r=e.status,i=await V(e,t),a=n.safeParse(i);if(!a.success)throw new F(r,`the cezar server answered ${t} with an unexpected body`);return a.data}async function xn(e,t){try{let n=new Headers(t?.headers);n.set(cn,sn());let r=await fetch(e,{...t,headers:n,credentials:`include`});return r.ok||mn(e,t?.method,r.status,t?.body),r}catch(n){throw n instanceof DOMException&&n.name===`AbortError`?n:(mn(e,t?.method,0,t?.body,n),new F(0,`cannot reach the cezar server (${e})`,{cause:n}))}}async function Sn(e,t){return xn(p(e),t)}async function Cn(e,t={}){let n=new Headers(t.headers);n.set(`accept`,`text/plain`);let r=await Sn(e,{...t,headers:n}),i=await B(r);if(!r.ok)throw L(r.status,r.statusText,i);return i}var U=(e,t=``)=>`/runs/${encodeURIComponent(e)}${t}`;async function wn(e){return V(await R.api.v1.health.$get({},z(e)),`/health`)}async function Tn(e){return V(await R.api.v1[`star-count`].$get({},z(e)),`/star-count`)}async function En(e){return V(await R.api.v1.preview[`design-proxy`].$post({json:e}),`/preview/design-proxy`)}async function Dn(e){return V(await R.api.v1.telemetry.consent.$get({},z(e)),`/telemetry/consent`)}async function On(e){return V(await R.api.v1.telemetry.consent.$put({json:e}),`/telemetry/consent`)}async function kn(e,t){return V(await R.api.v1.models.$get({query:{runner:e}},z(t)),`/models`)}async function An(e=!1,t){return Yt(await V(await R.api.v1.providers.status.$get({query:e?{refresh:`1`}:{}},z(t)),`/providers/status`))}async function jn(e){return V(await R.api.v1.p[`:projectId`][`launch-key`].$get({param:{projectId:m()}},z(e)),`/launch-key`)}async function Mn(e){return V(await R.api.v1.projects.$get({},z(e)),`/projects`)}async function Nn(e,t){return V(await R.api.v1.fs.browse.$get({query:{path:e===``?void 0:e,...t?.showHidden?{showHidden:`1`}:{}}},z(t)),`/fs/browse`)}async function Pn(e){return V(await R.api.v1.fs.repos.$get({},z(e)),`/fs/repos`)}async function Fn(e){return V(await R.api.v1.projects[`:projectId`][`git-init`].$post({param:{projectId:encodeURIComponent(e)}}),`/projects/${encodeURIComponent(e)}/git-init`)}async function In(e,t){return V(await R.api.v1.projects[`:projectId`][`publish-github`].$post({param:{projectId:encodeURIComponent(e)},json:t}),`/projects/${encodeURIComponent(e)}/publish-github`)}async function Ln(){return V(await R.api.v1.github.login.$post(),`/github/login`)}async function Rn(e){return V(await R.api.v1.github.login.$get({},z(e)),`/github/login`)}async function zn(){return V(await R.api.v1.github.login.$delete(),`/github/login`)}async function Bn(e){return V(await R.api.v1.providers.setup.$get({},z(e)),`/providers/setup`)}async function Vn(e,t){return V(await R.api.v1.providers.setup.sessions.$post({json:{provider:e,action:t}}),`/providers/setup/sessions`)}async function Hn(e,t){return V(await R.api.v1.providers.setup.sessions[`:sessionId`].output.$get({param:{sessionId:e},query:{cursor:String(t)}}),`/providers/setup/sessions/${e}/output`)}async function Un(e,t){await V(await R.api.v1.providers.setup.sessions[`:sessionId`].input.$post({param:{sessionId:e},json:{data:t}}),`/providers/setup/sessions/${e}/input`)}async function Wn(e,t,n){await V(await R.api.v1.providers.setup.sessions[`:sessionId`].resize.$post({param:{sessionId:e},json:{cols:t,rows:n}}),`/providers/setup/sessions/${e}/resize`)}async function Gn(e){await V(await R.api.v1.providers.setup.sessions[`:sessionId`].$delete({param:{sessionId:e}}),`/providers/setup/sessions/${e}`)}async function Kn(e){return V(await R.api.v1.p[`:projectId`].runs.$get({param:{projectId:m()},query:{}},z(e)),`/runs`)}async function qn(e,t){return V(await R.api.v1.p[`:projectId`].runs.$get({param:{projectId:e},query:{}},z(t)),`/runs`)}async function Jn(e){return V(await R.api.v1.workspace[`runs-index`].$get({},z(e)),`/workspace/runs-index`)}async function Yn(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:m(),id:encodeURIComponent(e)}},z(t)),U(e))}async function Xn(e,t,n){return V(await R.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:e,id:encodeURIComponent(t)}},z(n)),U(t))}async function Zn(e,t,n){return H(await R.api.v1.p[`:projectId`].runs[`:id`].history.$get({param:{projectId:m(),id:encodeURIComponent(e)},query:{...t===void 0?{}:{cursor:t}}},z(n)),`${U(e)}/history`,i)}async function Qn(e,t){return H(await R.api.v1.p[`:projectId`].runs[`:id`][`history-context`].$get({param:{projectId:m(),id:encodeURIComponent(e)}},z(t)),`${U(e)}/history-context`,u)}async function $n(e){return V(await R.api.v1.p[`:projectId`][`ui-state`].$get({param:{projectId:m()}},z(e)),`/ui-state`)}async function er(e){return V(await R.api.v1.p[`:projectId`].workflows.$get({param:{projectId:m()}},z(e)),`/workflows`)}async function tr(e){return V(await R.api.v1.p[`:projectId`].skills.$get({param:{projectId:m()},query:{}},z(e)),`/skills`)}async function nr(e){return V(await R.api.v1.p[`:projectId`].skills.$get({param:{projectId:m()},query:{wait:`1`}},z(e)),`/skills`)}async function rr(){return V(await R.api.v1.p[`:projectId`].skills.refresh.$post({param:{projectId:m()}}),`/skills/refresh`)}async function ir(e){return V(await R.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:m()},query:{}},z(e)),`/skills/importable`)}async function ar(e){return V(await R.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:m()},query:{wait:`1`}},z(e)),`/skills/importable`)}async function or(e){return V(await R.api.v1.p[`:projectId`].todos.$get({param:{projectId:m()}},z(e)),`/todos`)}async function sr(e){return V(await R.api.v1.p[`:projectId`].repo.$get({param:{projectId:m()}},z(e)),`/repo`)}async function cr(e){return V(await R.api.v1.p[`:projectId`].config.$get({param:{projectId:m()}},z(e)),`/config`)}async function lr(e={}){return V(await R.api.v1.p[`:projectId`][`agent-config`].$get({param:{projectId:m()}},z(e)),`/agent-config`)}async function ur(e,t={}){return V(await R.api.v1.p[`:projectId`][`agent-config`][`:id`].$get({param:{projectId:m(),id:encodeURIComponent(e)}},z(t)),`/agent-config/${encodeURIComponent(e)}`)}async function dr(e,t){return V(await R.api.v1.p[`:projectId`][`agent-config`][`:id`].$put({param:{projectId:m(),id:encodeURIComponent(e)},json:t}),`/agent-config/${encodeURIComponent(e)}`)}async function fr(e){return V(await R.api.v1.p[`:projectId`].repo.changes.$get({param:{projectId:m()}},z(e)),`/repo/changes`)}async function pr(e){return V(await R.api.v1.p[`:projectId`].repo.tree.$get({param:{projectId:m()}},z(e)),`/repo/tree`)}async function mr(e,t){return V(await R.api.v1.p[`:projectId`].repo.files.$get({param:{projectId:m()},query:{path:e}},z(t)),`/repo/files`)}function hr(e){return p(`/repo/files?path=${encodeURIComponent(e)}&raw=1`)}async function gr(e,t){return V(await R.api.v1.p[`:projectId`].repo.commit[`:sha`].$get({param:{projectId:m(),sha:encodeURIComponent(e)},query:{structured:`1`}},z(t)),`/repo/commit/:sha`)}async function _r(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`].tree.$get({param:{projectId:m(),id:encodeURIComponent(e)}},z(t)),U(e,`/tree`))}async function vr(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`].commits.$get({param:{projectId:m(),id:encodeURIComponent(e)}},z(t)),U(e,`/commits`))}async function yr(e,t,n){return V(await R.api.v1.p[`:projectId`].runs[`:id`].commit[`:sha`].$get({param:{projectId:m(),id:encodeURIComponent(e),sha:encodeURIComponent(t)}},z(n)),U(e,`/commit/${encodeURIComponent(t)}`))}async function br(e={},t){return V(await R.api.v1.p[`:projectId`].github.$get({param:{projectId:m()},query:{limit:e.limit===void 0?void 0:String(e.limit),refresh:e.refresh?`1`:void 0,issuesCursor:e.issuesCursor,prsCursor:e.prsCursor,issuesDone:e.issuesDone?`1`:void 0,prsDone:e.prsDone?`1`:void 0}},z(t)),`/github`)}async function xr(e={},t){return V(await R.api.v1.p[`:projectId`].tracker[`automation-options`].$get({param:{projectId:m()},query:e},z(t)),`/tracker/automation-options`)}async function Sr(e){return V(await R.api.v1.p[`:projectId`].tracker.connection.$get({param:{projectId:m()}},z(e)),`/tracker/connection`)}async function Cr(e){return V(await R.api.v1.p[`:projectId`].tracker.connection.$put({param:{projectId:m()},json:e}),`/tracker/connection`)}async function wr(){return V(await R.api.v1.p[`:projectId`].tracker.connection.$delete({param:{projectId:m()}}),`/tracker/connection`)}async function Tr(e){return V(await R.api.v1.p[`:projectId`].secrets.$get({param:{projectId:m()}},z(e)),`/secrets`)}async function Er(e){return V(await R.api.v1.workspace.secrets.$get({},z(e)),`/workspace/secrets`)}async function Dr(e){if(!e.ok)throw L(e.status,e.statusText,await B(e))}async function Or(e,t){await Dr(await R.api.v1.p[`:projectId`].secrets[`:name`].$put({param:{projectId:m(),name:e},json:t}))}async function kr(e){await Dr(await R.api.v1.p[`:projectId`].secrets[`:name`].$delete({param:{projectId:m(),name:e}}))}async function Ar(e,t){await Dr(await R.api.v1.workspace.secrets[`:name`].$put({param:{name:e},json:t}))}async function jr(e){await Dr(await R.api.v1.workspace.secrets[`:name`].$delete({param:{name:e}}))}async function Mr(e){return V(await R.api.v1.p[`:projectId`].e2e.$get({param:{projectId:m()}},z(e)),`/e2e`)}async function Nr(e){return V(await R.api.v1.p[`:projectId`].e2e.setup.$post({param:{projectId:m()},json:e}),`/e2e/setup`)}async function Pr(e){return V(await R.api.v1.p[`:projectId`].tracker.association.$get({param:{projectId:m()}},z(e)),`/tracker/association`)}async function Fr(e,t={},n){return V(await R.api.v1.p[`:projectId`].tracker.candidates.$get({param:{projectId:m()},query:{kind:e,q:t.q,cursor:t.cursor,limit:t.limit===void 0?void 0:String(t.limit)}},z(n)),`/tracker/candidates`)}async function Ir(e){return V(await R.api.v1.p[`:projectId`].tracker.association.$put({param:{projectId:m()},json:e}),`/tracker/association`)}async function Lr(){return V(await R.api.v1.p[`:projectId`].tracker.association.$delete({param:{projectId:m()}}),`/tracker/association`)}function Rr(e){return{expectedScope:e.association?o(e.association):void 0,cursor:e.cursor,limit:e.limit===void 0?void 0:String(e.limit),refresh:e.refresh?`1`:void 0,state:e.state,labels:e.labels?.length?JSON.stringify(e.labels):void 0}}async function zr(e={},t){return V(await R.api.v1.p[`:projectId`].tracker.$get({param:{projectId:m()},query:Rr(e)},z(t)),`/tracker`)}async function Br(e,t={},n){return V(await R.api.v1.p[`:projectId`].tracker.search.$get({param:{projectId:m()},query:{...Rr(t),q:e}},z(n)),`/tracker/search`)}async function Vr(e,t){return V(await R.api.v1.p[`:projectId`].tracker[`:id`].$get({param:{projectId:m(),id:encodeURIComponent(e)},query:{expectedScope:t?.association?o(t.association):void 0}},z(t)),`/tracker/${encodeURIComponent(e)}`)}async function Hr(e,t){return V(await R.api.v1.p[`:projectId`].github.checks.$get({param:{projectId:m()},query:{prs:e.join(`,`)}},z(t)),`/github/checks`)}async function Ur(e,t,n={},r){return V(await R.api.v1.p[`:projectId`].github.search.$get({param:{projectId:m()},query:{kind:e,q:t,limit:n.limit}},z(r)),`/github/search`)}async function Wr(e,t,n){return V(await R.api.v1.p[`:projectId`].github[`ref-status`].$get({param:{projectId:e},query:{...t.prs?.length?{prs:t.prs.join(`,`)}:{},...t.issues?.length?{issues:t.issues.join(`,`)}:{}}},z(n)),`/github/ref-status`)}async function Gr(e,t,n={},r){return V(await R.api.v1.p[`:projectId`].github.comments[`:kind`][`:number`].$get({param:{projectId:m(),kind:e,number:String(t)},query:{refresh:n.refresh?`1`:void 0}},z(r)),`/github/comments/${e}/${t}`)}async function Kr(e,t={},n){return V(await R.api.v1.p[`:projectId`].github.prs[`:number`][`merge-state`].$get({param:{projectId:m(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},z(n)),`/github/prs/${e}/merge-state`)}async function qr(e,t){return V(await R.api.v1.p[`:projectId`].github.prs[`:number`].merge.$post({param:{projectId:m(),number:String(e)},json:t}),`/github/prs/:number/merge`)}async function Jr(e,t={},n){return V(await R.api.v1.p[`:projectId`].github.prs[`:number`].changes.$get({param:{projectId:m(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},z(n)),`/github/prs/${e}/changes`)}function Yr(e,t){return Cn(U(e,`/diff`),{method:`GET`,signal:t?.signal})}function Xr(e,t){return Cn(U(e,`/handoff`),{method:`GET`,signal:t?.signal})}async function Zr(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`].changes.$get({param:{projectId:m(),id:encodeURIComponent(e)}},z(t)),U(e,`/changes`))}async function Qr(e,t,n){return V(await R.api.v1.p[`:projectId`].runs[`:id`].files.$get({param:{projectId:m(),id:encodeURIComponent(e)},query:{path:t}},z(n)),`/runs/:id/files`)}function $r(e,t,n){let r=n?`&rev=${encodeURIComponent(n)}`:``;return p(U(e,`/files?path=${encodeURIComponent(t)}&raw=1${r}`))}async function ei(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`].artifacts.$get({param:{projectId:m(),id:encodeURIComponent(e)}},z(t)),U(e,`/artifacts`))}function ti(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}function ni(e,t,n){return Cn(U(e,`/artifacts/${ti(t)}`),{method:`GET`,signal:n?.signal})}function ri(e,t,n){let r=n===void 0?``:`?v=${n}`;return p(U(e,`/artifacts/${ti(t)}${r}`))}function W(e){return e.kind===`pr`?`pr:${e.number}`:`spec:${e.path}`}async function ii(e){return V(await R.api.v1.p[`:projectId`].impact.$post({param:{projectId:m()},json:e}),`/impact`)}async function ai(e,t){let n=W(e);return H(await R.api.v1.p[`:projectId`].artifacts.$get({param:{projectId:m()},query:{subject:n}},z(t)),`/artifacts?subject=${encodeURIComponent(n)}`,re)}async function oi(e){return H(await R.api.v1.p[`:projectId`].assets.$get({param:{projectId:m()}},z(e)),`/assets`,d)}async function si(e,t){return V(await R.api.v1.p[`:projectId`].groups[`:groupId`].$get({param:{projectId:m(),groupId:encodeURIComponent(e)}},z(t)),`/groups/${encodeURIComponent(e)}`)}async function ci(e,t){return V(await R.api.v1.providers.connect.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/connect`)}async function li(e){return V(await R.api.v1.providers[`:provider`].update.$post({param:{provider:e}}),`/providers/${encodeURIComponent(e)}/update`)}async function ui(e,t){return Yt(await V(await R.api.v1.providers[`:provider`].enabled.$put({param:{provider:e},json:{enabled:t}}),`/providers/${encodeURIComponent(e)}/enabled`))}async function di(e,t){return Yt(await V(await R.api.v1.providers[`:provider`].retry.$post({param:{provider:e},json:{authFailureId:t}}),`/providers/${encodeURIComponent(e)}/retry`))}async function fi(e){let t=`/projects`,n=await Sn(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({root:e})}),r=await B(n),i=I(r),a=i?.project;if((n.ok||n.status===409)&&a!=null)return i;throw n.ok?new F(n.status,`the cezar server answered ${t} without a project`):L(n.status,n.statusText,r)}async function pi(e){return V(await R.api.v1.projects.checkout.$post({json:e}),`/projects/checkout`)}async function mi(e){return V(await R.api.v1.projects.create.$post({json:e}),`/projects/create`)}async function hi(e){return H(await R.api.v1.projects[`github-owners`].$get({},z(e)),`/projects/github-owners`,y)}async function gi(e){return V(await R.api.v1.projects[`:projectId`].$delete({param:{projectId:encodeURIComponent(e)}}),`/projects/${encodeURIComponent(e)}`)}async function _i(e,t){return V(await R.api.v1.projects[`:projectId`].$patch({param:{projectId:encodeURIComponent(e)},json:t}),`/projects/${encodeURIComponent(e)}`)}async function vi(e){return V(await R.api.v1.p[`:projectId`].runs.$post({param:{projectId:m()},json:e}),`/runs`)}async function yi(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].cancel.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/cancel`))}async function bi(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].promote.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/promote`))}async function xi(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`][`start-now`].$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/start-now`))}async function Si(e,t=!0,n){return V(await R.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:{archived:t,...n?{surface:n}:{}}}),U(e,`/archive`))}async function Ci(e,t=!0,n){return V(await R.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:{pinned:t,...n?{surface:n}:{}}}),U(e,`/pin`))}async function wi(e,t,n=!0,r){return V(await R.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{pinned:n,...r?{surface:r}:{}}}),U(t,`/pin`))}async function Ti(e,t,n=!0,r){return V(await R.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{archived:n,...r?{surface:r}:{}}}),U(t,`/archive`))}async function Ei(e,t,n){let r=n?`read`:`unread`;return V(await(n?R.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:e,id:encodeURIComponent(t)}}):R.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:e,id:encodeURIComponent(t)}})),U(t,`/${r}`))}async function Di(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`][`auto-resume`].$delete({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/auto-resume`))}async function Oi(){return V(await R.api.v1.p[`:projectId`].runs[`archive-finished`].$post({param:{projectId:m()}}),`/runs/archive-finished`)}async function ki(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/read`))}async function Ai(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/unread`))}async function ji(){return V(await R.api.v1.p[`:projectId`].runs[`read-all`].$post({param:{projectId:m()}}),`/runs/read-all`)}async function Mi(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].land.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/land`))}async function Ni(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].finish.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/finish`))}async function Pi(e,t={}){let n={...t.text===void 0?{}:{text:t.text},...t.images===void 0?{}:{images:t.images},...t.runner===void 0?{}:{runner:t.runner},...t.model===void 0?{}:{model:t.model},...t.reasoningEffort===void 0?{}:{reasoningEffort:t.reasoningEffort},...t.agentProfile===void 0?{}:{agentProfile:t.agentProfile},...t.idempotencyKey===void 0?{}:{idempotencyKey:t.idempotencyKey}};return V(await R.api.v1.p[`:projectId`].runs[`:id`].continue.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:n}),U(e,`/continue`))}async function Fi(e,t,n={}){return V(await R.api.v1.p[`:projectId`].runs[`:id`].continue.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{...n.text===void 0?{}:{text:n.text},...n.images===void 0?{}:{images:n.images},...n.runner===void 0?{}:{runner:n.runner},...n.model===void 0?{}:{model:n.model},...n.agentProfile===void 0?{}:{agentProfile:n.agentProfile},...n.idempotencyKey===void 0?{}:{idempotencyKey:n.idempotencyKey}}}),U(t,`/continue`))}var Ii=1e3;async function Li(e,t={}){let n=m(),r=async()=>V(await R.api.v1.p[`:projectId`].runs[`:id`].pr.$post({param:{projectId:n,id:encodeURIComponent(e)},json:t}),U(e,`/pr`));try{return await r()}catch(e){if(!(e instanceof F)||e.status!==0)throw e;await new Promise(e=>setTimeout(e,Ii));try{return await r()}catch(t){throw t instanceof F&&t.status===0?e:t}}}async function Ri(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].pr.adopt.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/pr/adopt`))}async function zi(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`].$patch({param:{projectId:m(),id:encodeURIComponent(e)},json:t}),U(e))}async function Bi(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].$delete({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e))}async function Vi(e){return V(await R.api.v1.p[`:projectId`].todos[`:id`].$delete({param:{projectId:m(),id:encodeURIComponent(e)}}),`/todos/${encodeURIComponent(e)}`)}async function Hi(e,t={}){let n={...t.runner===void 0?{}:{runner:t.runner},...t.model===void 0?{}:{model:t.model},...t.reasoningEffort===void 0?{}:{reasoningEffort:t.reasoningEffort},...t.prompt===void 0?{}:{prompt:t.prompt}};return V(await R.api.v1.p[`:projectId`].todos[`:id`].start.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:Object.keys(n).length>0?n:void 0}),`/todos/${encodeURIComponent(e)}/start`)}async function Ui(e,t){return V(await R.api.v1.p[`:projectId`].groups[`:groupId`].pick.$post({param:{projectId:m(),groupId:encodeURIComponent(e)},json:{runId:t}}),`/groups/${encodeURIComponent(e)}/pick`)}async function Wi(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`][`open-in-cli`].$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/open-in-cli`))}async function Gi(e){return V(await R.api.v1.p[`:projectId`][`open-targets`].$get({param:{projectId:m()}},z(e)),`/open-targets`)}async function Ki(e){return V(await R.api.v1.p[`:projectId`][`open-in`].$post({param:{projectId:m()},json:{target:e}}),`/open-in`)}async function qi(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:m(),id:encodeURIComponent(e)},json:{target:t}}),U(e,`/open-in`))}async function Ji(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:m(),id:encodeURIComponent(e)},json:{target:`default`,path:t}}),U(e,`/open-in`))}async function Yi(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`].git.commit.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:{message:t}}),U(e,`/git/commit`))}async function Xi(e,t,n=m()){return V(await R.api.v1.p[`:projectId`].runs[`:id`].git.status.$get({param:{projectId:n,id:encodeURIComponent(e)}},z(t)),U(e,`/git/status`))}async function Zi(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].git.push.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/git/push`))}var Qi=[250,750,1500],$i=e=>new Promise(t=>setTimeout(t,e));async function ea(e,t,n=$i){let r={text:t.text??``,images:t.images??[],idempotencyKey:t.idempotencyKey??on()};for(let t=0;;t+=1)try{return await e(r)}catch(e){let r=Qi[t];if(!(e instanceof F)||e.status!==0||r===void 0)throw e;await n(r)}}async function ta(e,t){return ea(async t=>V(await R.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:t}),U(e,`/messages`)),t)}async function na(e,t,n){return ea(async n=>V(await R.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:e,id:encodeURIComponent(t)},json:n}),U(t,`/messages`)),n)}async function ra(e,t,n){return V(await R.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$patch({param:{projectId:m(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)},json:n}),U(e,`/queued-messages/${encodeURIComponent(t)}`))}async function ia(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$delete({param:{projectId:m(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)}}),U(e,`/queued-messages/${encodeURIComponent(t)}`))}async function aa(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`].drafts.$get({param:{projectId:m(),id:encodeURIComponent(e)}},z(t)),U(e,`/drafts`))}var oa=56*1024;async function sa(e,t,n,r){let i=r?.keepalive===!0&&new TextEncoder().encode(JSON.stringify(n)).length<=oa;return V(await R.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].$put({param:{projectId:m(),id:encodeURIComponent(e),surface:t},json:n},{init:{keepalive:i}}),U(e,`/drafts/${t}`))}async function ca(e,t,n){return V(await R.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images.$post({param:{projectId:m(),id:encodeURIComponent(e),surface:t},json:n}),U(e,`/drafts/${t}/images`))}async function la(e){return V(await R.api.v1.workspace.uploads.$post({json:e}),`/workspace/uploads`)}async function ua(e){return V(await R.api.v1.workspace.uploads[`:uploadId`].$delete({param:{uploadId:e}}),`/workspace/uploads/${e}`)}async function da(e,t,n,r){return V(await R.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$get({param:{projectId:m(),id:encodeURIComponent(e),surface:t,imageId:n}},z(r)),U(e,`/drafts/${t}/images/${n}`))}async function fa(e,t,n){return V(await R.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$delete({param:{projectId:m(),id:encodeURIComponent(e),surface:t,imageId:n}}),U(e,`/drafts/${t}/images/${n}`))}async function pa(e){return V(await R.api.v1.p[`:projectId`].repo.branch.$post({param:{projectId:m()},json:e}),`/repo/branch`)}async function ma(e){return V(await R.api.v1.p[`:projectId`].repo.sync.$get({param:{projectId:m()}},z(e)),`/repo/sync`)}async function ha(e){let t={param:{projectId:m()}},n=R.api.v1.p[`:projectId`].repo;return V(e===`fetch`?await n.fetch.$post(t):e===`pull`?await n.pull.$post(t):e===`push`?await n.push.$post(t):await n.sync.$post(t),`/repo/${e}`)}async function ga(e){return V(await R.api.v1.p[`:projectId`].plan.$post({param:{projectId:m()},json:{task:e}}),`/plan`)}async function _a(e){return V(await R.api.v1.p[`:projectId`].automations.$get({param:{projectId:m()}},z(e)),`/automations`)}async function va(e){return V(await R.api.v1.p[`:projectId`].automations.$post({param:{projectId:m()},json:e}),`/automations`)}async function ya(e,t){return V(await R.api.v1.p[`:projectId`].automations[`:id`].report.$put({param:{projectId:m(),id:encodeURIComponent(e)},json:{report:t}}),`/automations/${encodeURIComponent(e)}/report`)}async function ba(e,t){return V(await R.api.v1.p[`:projectId`].automations[`:id`].$put({param:{projectId:m(),id:encodeURIComponent(e)},json:t}),`/automations/${encodeURIComponent(e)}`)}async function xa(e,t){let n={projectId:m(),id:encodeURIComponent(e)},r=`/automations/${encodeURIComponent(e)}/${t?`enable`:`pause`}`;return V(t?await R.api.v1.p[`:projectId`].automations[`:id`].enable.$post({param:n}):await R.api.v1.p[`:projectId`].automations[`:id`].pause.$post({param:n}),r)}async function Sa(e){let t=`/automations/${encodeURIComponent(e)}/work`;return V(await R.api.v1.p[`:projectId`].automations[`:id`].work.$get({param:{projectId:m(),id:encodeURIComponent(e)}}),t)}async function Ca(e){let t=`/automations/${encodeURIComponent(e)}/cancel-queued`;return V(await R.api.v1.p[`:projectId`].automations[`:id`][`cancel-queued`].$post({param:{projectId:m(),id:encodeURIComponent(e)}}),t)}async function wa(e,t){return V(await R.api.v1.p[`:projectId`].automations[`:id`].check.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:{mode:t}}),`/automations/${encodeURIComponent(e)}/check`)}async function Ta(e,t){return V(await R.api.v1.p[`:projectId`][`automation-log`].$get({param:{projectId:m()},query:{automationId:e}},z(t)),`/automation-log?automationId=${encodeURIComponent(e)}`)}async function Ea(e){return V(await R.api.v1.p[`:projectId`][`automation-log`][`:receiptId`].retry.$post({param:{projectId:m(),receiptId:encodeURIComponent(e)}}),`/automation-log/${encodeURIComponent(e)}/retry`)}async function Da(e,t){return V(await R.api.v1.p[`:projectId`].automations[`:id`].run.$post({param:{projectId:m(),id:encodeURIComponent(e)},query:t?{expectedRevision:String(t)}:{}}),`/automations/${encodeURIComponent(e)}/run`)}async function Oa(e,t){let n=await R.api.v1.p[`:projectId`].automations[`:id`].$delete({param:{projectId:m(),id:encodeURIComponent(e)},query:t?{expectedRevision:String(t)}:{}});if(!n.ok)throw L(n.status,n.statusText,await B(n))}async function ka(e){return V(await R.api.v1.p[`:projectId`].automations.export.$get({param:{projectId:m()},query:e?.length?{ids:e.join(`,`)}:{}}),`/automations/export`)}async function Aa(e){return V(await R.api.v1.p[`:projectId`].automations.import.preview.$post({param:{projectId:m()},json:e}),`/automations/import/preview`)}async function ja(e){return V(await R.api.v1.p[`:projectId`].automations.import.$post({param:{projectId:m()},json:e}),`/automations/import`)}async function Ma(e,t){return V(await R.api.v1.workspace[`automation-templates`].$get({query:e?{exclude:e}:{}},z(t)),`/workspace/automation-templates`)}async function Na(e){return V(await R.api.v1.p[`:projectId`].workflows.$post({param:{projectId:m()},json:e}),`/workflows`)}async function Pa(e){return V(await R.api.v1.p[`:projectId`].workflows.nodes.$get({param:{projectId:m()}},z(e)),`/workflows/nodes`)}async function Fa(e){return V(await R.api.v1.p[`:projectId`].workflows.validate.$post({param:{projectId:m()},json:{graph:e}}),`/workflows/validate`)}async function Ia(e){return V(await R.api.v1.p[`:projectId`].workflows.graph.$post({param:{projectId:m()},json:e}),`/workflows/graph`)}async function La(e){return V(await R.api.v1.p[`:projectId`].workflows.parse.$post({param:{projectId:m()},json:{yaml:e}}),`/workflows/parse`)}async function Ra(e){return V(await R.api.v1.p[`:projectId`].workflows[`:name`].$delete({param:{projectId:m(),name:encodeURIComponent(e)}}),`/workflows/${encodeURIComponent(e)}`)}async function za(e,t=m()){return V(await R.api.v1.p[`:projectId`][`ui-state`].$put({param:{projectId:t},json:e}),`/ui-state`)}async function Ba(e){return V(await R.api.v1.workspace[`ui-state`].$get({},z(e)),`/workspace/ui-state`)}async function Va(e,t={}){return V(await R.api.v1.workspace[`ui-state`].$put({json:e},{init:{keepalive:t.keepalive}}),`/workspace/ui-state`)}async function Ha(e){let t=await V(await R.api.v1.workspace.config.$get({},z(e)),`/workspace/config`);return{...t,branding:t.branding?{...t.branding,logoUrl:t.branding.logoUrl?v(t.branding.logoUrl):null}:{name:`cezar`,logoUrl:null},agentDefaults:t.agentDefaults??{},orgSkillsRepos:t.orgSkillsRepos??[],resources:{...t.resources,idleTimeoutMinutes:t.resources.idleTimeoutMinutes===void 0?15:t.resources.idleTimeoutMinutes}}}async function Ua(e){let t=new FormData;t.set(`file`,e);let n=await Sn(`/workspace/branding-logo`,{method:`POST`,body:t}),r=await B(n);if(!n.ok)throw L(n.status,n.statusText,r);let i=I(r),a=g.safeParse(i);if(!a.success)throw new F(n.status,`the cezar server answered /workspace/branding-logo with an unexpected body`);return a.data.logoUrl?v(a.data.logoUrl):null}async function Wa(){let e=await Sn(`/workspace/branding-logo`,{method:`DELETE`}),t=await B(e);if(!e.ok)throw L(e.status,e.statusText,t);let n=g.safeParse(I(t));if(!n.success)throw new F(e.status,`the cezar server answered /workspace/branding-logo with an unexpected body`);return n.data.logoUrl?v(n.data.logoUrl):null}async function Ga(e){return V(await R.api.v1.workspace[`host-usage`].$get({},z(e)),`/workspace/host-usage`)}async function Ka(e){let t=await V(await R.api.v1.workspace[`agent-profiles`].$get({},z(e)),`/workspace/agent-profiles`);return{...t,profileCapableProviders:t.profileCapableProviders??[],selections:t.selections??{},defaults:t.defaults??{},profiles:(t.profiles??[]).map(e=>({...e,files:e.files??[]}))}}async function qa(e,t){return V(await R.api.v1.workspace[`agent-profiles`][`fallback-policy`].$get({query:e},z(t)),`/workspace/agent-profiles/fallback-policy`)}async function Ja(e,t){return V(await R.api.v1.workspace[`agent-profiles`][`fallback-policy`].$put({json:e},z(t)),`/workspace/agent-profiles/fallback-policy`)}async function Ya(e){return V(await R.api.v1.workspace[`agent-profiles`].$post({json:e}),`/workspace/agent-profiles`)}async function Xa(e,t){return V(await R.api.v1.workspace[`agent-profiles`][`:id`].status.$get({param:{id:encodeURIComponent(e)},query:{...t?.refresh||t?.recheck?{refresh:`1`}:{},...t?.recheck?{recheck:`1`}:{}}},z(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/status`)}async function Za(e,t){return V(await R.api.v1.workspace[`agent-profiles`][`:id`].details.$get({param:{id:encodeURIComponent(e)}},z(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/details`)}async function Qa(e,t){return V(await R.api.v1.workspace[`agent-profiles`][`:id`].open.$post({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}/open`)}async function $a(e){return V(await R.api.v1.workspace[`agent-profiles`].selection.$put({json:e}),`/workspace/agent-profiles/selection`)}async function eo(e,t){return V(await R.api.v1.workspace[`agent-profiles`][`:id`].$patch({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function to(e){return V(await R.api.v1.workspace[`agent-profiles`][`:id`].$delete({param:{id:encodeURIComponent(e)}}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function no(e,t){return V(await R.api.v1.workspace[`skills-update`].$get({query:{projectId:e}},z(t)),`/workspace/skills-update?projectId=${encodeURIComponent(e)}`)}async function ro(e){return V(await R.api.v1.workspace[`skills-update`].check.$post({json:{projectId:e}}),`/workspace/skills-update/check`)}async function io(e){return V(await R.api.v1.workspace[`skills-update`].apply.$post({json:{projectId:e}}),`/workspace/skills-update/apply`)}async function ao(e){return V(await R.api.v1.workspace[`self-update`].$get({},z(e)),`/workspace/self-update`)}async function oo(){return V(await R.api.v1.workspace[`self-update`].refresh.$post({}),`/workspace/self-update/refresh`)}async function so(e){return V(await R.api.v1.workspace[`self-update`].development.$get({query:e?.refresh?{refresh:`1`}:{}},z(e)),`/workspace/self-update/development`)}async function co(e){return V(await R.api.v1.workspace[`self-update`].channel.$put({json:{channel:e}}),`/workspace/self-update/channel`)}async function lo(e){return V(await R.api.v1.workspace[`self-update`].apply.$post({json:{version:e}}),`/workspace/self-update/apply`)}async function uo(e){return V(await R.api.v1.workspace[`self-update`].apply.$post({json:{version:e,whenIdle:!0}}),`/workspace/self-update/apply`)}async function fo(){return V(await R.api.v1.workspace[`self-update`].scheduled.$delete({}),`/workspace/self-update/scheduled`)}async function po(e){let t=await V(await R.api.v1.workspace.config.$put({json:e}),`/workspace/config`);return{...t,orgSkillsRepos:t.orgSkillsRepos??[]}}async function mo(e){return V(await R.api.v1.p[`:projectId`].config.$put({param:{projectId:m()},json:e}),`/config`)}async function ho(e){return V(await R.api.v1.p[`:projectId`].worktrees.$get({param:{projectId:m()}},z(e)),`/worktrees`)}async function go(){return V(await R.api.v1.p[`:projectId`].worktrees.reclaim.$post({param:{projectId:m()},json:{}}),`/worktrees/reclaim`)}async function _o(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`][`remove-worktree`].$post({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/remove-worktree`))}async function vo(e,t,n){return s.parse(await V(await R.api.v1.p[`:projectId`].tracker.watch.$post({param:{projectId:e},json:t},{init:{signal:n}}),`/tracker/watch`))}async function yo(e,t,n,r){return a.parse(await V(await R.api.v1.p[`:projectId`].tracker.watch[`:watchId`].$get({param:{projectId:e,watchId:t},query:{after:r===void 0?void 0:String(r)}},{init:{signal:n}}),`/tracker/watch`))}async function bo(e,t,n){return a.parse(await V(await R.api.v1.p[`:projectId`].tracker.watch[`:watchId`].$post({param:{projectId:e,watchId:t}},{init:{signal:n}}),`/tracker/watch`))}var xo={list:async(e,t)=>V(await R.api.v1.p[`:projectId`].webhooks.$get({param:{projectId:e}},{init:{signal:t}}),`/webhooks`),create:async(e,t)=>V(await R.api.v1.p[`:projectId`].webhooks.$post({param:{projectId:e},json:t}),`/webhooks`),update:async(e,t,n)=>V(await R.api.v1.p[`:projectId`].webhooks[`:id`].$patch({param:{projectId:e,id:t},json:n}),`/webhooks`),remove:async(e,t,n)=>V(await R.api.v1.p[`:projectId`].webhooks[`:id`].$delete({param:{projectId:e,id:t},json:{expectedRevision:n}}),`/webhooks`),activate:async(e,t,n)=>V(await R.api.v1.p[`:projectId`].webhooks[`:id`].activate.$post({param:{projectId:e,id:t},json:{expectedRevision:n,confirmed:!0}}),`/webhooks`),pause:async(e,t,n)=>V(await R.api.v1.p[`:projectId`].webhooks[`:id`].pause.$post({param:{projectId:e,id:t},json:{expectedRevision:n}}),`/webhooks`),resume:async(e,t,n)=>V(await R.api.v1.p[`:projectId`].webhooks[`:id`].resume.$post({param:{projectId:e,id:t},json:{expectedRevision:n,confirmed:!0}}),`/webhooks`),rotate:async(e,t,n,r)=>V(await R.api.v1.p[`:projectId`].webhooks[`:id`][`rotate-secret`].$post({param:{projectId:e,id:t},json:{expectedRevision:n,mode:r}}),`/webhooks`),test:async(e,t,n)=>V(await R.api.v1.p[`:projectId`].webhooks[`:id`].test.$post({param:{projectId:e,id:t},json:n}),`/webhooks`),retry:async(e,t,n)=>V(await R.api.v1.p[`:projectId`].webhooks.deliveries[`:deliveryId`].retry.$post({param:{projectId:e,deliveryId:t},json:n}),`/webhooks`),replay:async(e,t,n)=>V(await R.api.v1.p[`:projectId`].webhooks.deliveries[`:deliveryId`].replay.$post({param:{projectId:e,deliveryId:t},json:{...n,confirmed:!0}}),`/webhooks`),acknowledge:async(e,t)=>V(await R.api.v1.p[`:projectId`].webhooks.notice.acknowledge.$post({param:{projectId:e},json:{expectedChangeSequence:t}}),`/webhooks`),history:async(e,t)=>V(await R.api.v1.p[`:projectId`].webhooks.history.$get({param:{projectId:e},query:{limit:`100`,...t?{cursor:t}:{}}}),`/webhooks/history`),deliveries:async(e,t,n,r)=>V(await R.api.v1.p[`:projectId`].webhooks[`:id`].deliveries.$get({param:{projectId:e,id:t},query:{limit:`100`,...n?{cursor:n}:{},...r?{taskId:r}:{}}}),`/webhooks/deliveries`),activity:async(e,t)=>V(await R.api.v1.p[`:projectId`].webhooks[`:id`].activity.$get({param:{projectId:e,id:t}}),`/webhooks/activity`)};async function So(e={limit:50},t){return V(await R.api.v1.p[`:projectId`][`worktree-lifecycle`].$get({param:{projectId:m()},query:{cursor:e.cursor,limit:e.limit,attentionOnly:e.attentionOnly===void 0?void 0:e.attentionOnly?`true`:`false`}},z(t)),`/worktree-lifecycle`)}async function Co(e,t){return V(await R.api.v1.p[`:projectId`][`worktree-lifecycle`][`:worktreeId`].$get({param:{projectId:m(),worktreeId:e}},z(t)),`/worktree-lifecycle`)}async function wo(e,t){return V(await R.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].$get({param:{projectId:m(),operationId:e}},z(t)),`/worktree-lifecycle/operations`)}async function To(e,t=0,n){return V(await R.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].output.$get({param:{projectId:m(),operationId:e},query:{afterSeq:t,limit:100}},z(n)),`/worktree-lifecycle/operations/output`)}async function Eo(e,t=m()){return V(await R.api.v1.p[`:projectId`][`worktree-lifecycle`].operations.$post({param:{projectId:t},json:e}),`/worktree-lifecycle/operations`)}async function Do(e,t){return V(await R.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].actions.$post({param:{projectId:m(),operationId:e},json:t}),`/worktree-lifecycle/operations/actions`)}async function Oo(e){return V(await R.api.v1.p[`:projectId`][`worktree-lifecycle`].preview.$post({param:{projectId:m()},json:e}),`/worktree-lifecycle/preview`)}async function ko(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].terminal.$get({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/terminal`))}async function Ao(e,t){return V(await R.api.v1.p[`:projectId`].runs[`:id`].terminal.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:t}),U(e,`/terminal`))}async function jo(e,t,n){return V(await R.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].output.$get({param:{projectId:m(),id:encodeURIComponent(e),sessionId:t},query:{cursor:String(n)}}),U(e,`/terminal/${t}/output`))}async function Mo(e,t,n){await V(await R.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].input.$post({param:{projectId:m(),id:encodeURIComponent(e),sessionId:t},json:{data:n}}),U(e,`/terminal/${t}/input`))}async function No(e,t,n,r){await V(await R.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].resize.$post({param:{projectId:m(),id:encodeURIComponent(e),sessionId:t},json:{cols:n,rows:r}}),U(e,`/terminal/${t}/resize`))}async function Po(e,t){await V(await R.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].$delete({param:{projectId:m(),id:encodeURIComponent(e),sessionId:t}}),U(e,`/terminal/${t}`))}async function Fo(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].terminal.urls.$get({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/terminal/urls`))}async function Io(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].terminal.commands.$get({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/terminal/commands`))}async function Lo(){return V(await R.api.v1.p[`:projectId`].terminal.$get({param:{projectId:m()}}),`/terminal`)}async function Ro(e){return V(await R.api.v1.p[`:projectId`].terminal.$post({param:{projectId:m()},json:e}),`/terminal`)}async function zo(e,t){return V(await R.api.v1.p[`:projectId`].terminal[`:sessionId`].output.$get({param:{projectId:m(),sessionId:e},query:{cursor:String(t)}}),`/terminal/${e}/output`)}async function Bo(e,t){await V(await R.api.v1.p[`:projectId`].terminal[`:sessionId`].input.$post({param:{projectId:m(),sessionId:e},json:{data:t}}),`/terminal/${e}/input`)}async function Vo(e,t,n){await V(await R.api.v1.p[`:projectId`].terminal[`:sessionId`].resize.$post({param:{projectId:m(),sessionId:e},json:{cols:t,rows:n}}),`/terminal/${e}/resize`)}async function Ho(e){await V(await R.api.v1.p[`:projectId`].terminal[`:sessionId`].$delete({param:{projectId:m(),sessionId:e}}),`/terminal/${e}`)}async function Uo(){return V(await R.api.v1.p[`:projectId`].terminal.commands.$get({param:{projectId:m()}}),`/terminal/commands`)}async function Wo(){return V(await R.api.v1.p[`:projectId`][`start-app`].$get({param:{projectId:m()}}),`/start-app`)}async function Go(e){return V(await R.api.v1.p[`:projectId`][`start-app`].$put({param:{projectId:m()},json:e}),`/start-app`)}async function Ko(e){return V(await R.api.v1.p[`:projectId`].runs[`:id`].layouts.$get({param:{projectId:m(),id:encodeURIComponent(e)}}),U(e,`/layouts`))}async function qo(e,t,n){let r=n?.keepalive===!0&&new TextEncoder().encode(JSON.stringify(t)).length<=oa;return V(await R.api.v1.p[`:projectId`].runs[`:id`].layouts.$put({param:{projectId:m(),id:encodeURIComponent(e)},json:t},{init:{keepalive:r}}),U(e,`/layouts`))}async function Jo(e){return V(await R.api.v1.p[`:projectId`][`deferred-start`].preview.$post({param:{projectId:m()},json:e}),`/deferred-start/preview`)}async function Yo(e){return V(await R.api.v1.p[`:projectId`][`deferred-start`].$post({param:{projectId:m()},json:e}),`/deferred-start`)}async function Xo(e){return V(await R.api.v1.p[`:projectId`][`deferred-start`].options.$post({param:{projectId:m()},json:e}),`/deferred-start/options`)}async function Zo(e,t,n=m()){return V(await R.api.v1.p[`:projectId`].github.asset.$post({param:{projectId:n},json:{url:e}},z(t)),`/github/asset`)}function Qo(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!$o(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return es(t)?{project:r,event:{type:`run`,run:t}}:null}case`run-deleted`:{let e=n.id;return typeof e==`string`&&e?{project:r,event:{type:`run-deleted`,id:e}}:null}case`todos`:return Array.isArray(n.items)?{project:r,event:{type:`todos`,items:n.items}}:null;case`usage`:return $o(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function $o(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function es(e){return $o(e)&&typeof e.id==`string`&&e.id!==``}function ts(e){return typeof e.task==`string`&&Array.isArray(e.steps)}function ns(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id),r=n<0?void 0:e[n];if(r!==void 0){let i=[...e];return i[n]=is(r,t),i}if(!ts(t))return e;let i=t.createdAt??``,a=e.findIndex(e=>(e.createdAt??``).localeCompare(i)<0),o=[...e];return o.splice(a<0?e.length:a,0,t),o}function rs(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function is(e,t){let n={...t};if(!ts(t)){let t=n;for(let n of f)n in e&&(t[n]=e[n])}let r=e=>e===`user`?2:+(e===`marker`);return r(e.titleOrigin)>r(t.titleOrigin)&&(n.title=e.title,n.titleSummary=e.titleSummary,n.titleOrigin=e.titleOrigin),e.usage&&(n.usage=e.usage),n}var as=Object.freeze({});function os(){let e=as,t=new Set;return{subscribe(e){return t.add(e),()=>t.delete(e)},get:()=>e,set(n){e=n;for(let e of t)e()}}}var ss={draft:{label:`Draft`,hint:`the author has not marked it ready for review`,tone:`neutral`},"review-required":{label:`Waiting for review`,hint:`checks are fine, no one has reviewed it yet`,tone:`info`},"changes-requested":{label:`Changes requested`,hint:`a reviewer asked for edits before this can merge`,tone:`danger`},"checks-pending":{label:`Checks running`,hint:`CI has not finished on the latest commit`,tone:`pending`},"checks-failing":{label:`Checks failing`,hint:`CI is red on the latest commit`,tone:`danger`},ready:{label:`Ready to merge`,hint:`open, checks pass, nothing is waiting on a reviewer — your move`,tone:`info`},merged:{label:`Merged`,hint:`this landed on its base branch`,tone:`success`},closed:{label:`Closed`,hint:`closed without merging — the work did not land`,tone:`danger`},open:{label:`Open`,hint:`still open on the tracker`,tone:`neutral`},completed:{label:`Closed as completed`,hint:`the issue was resolved`,tone:`success`},"not-planned":{label:`Closed as not planned`,hint:`the issue was declined — nothing shipped for it`,tone:`neutral`}},cs={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function ls(e){return typeof e==`string`&&Object.hasOwn(ss,e)}function us(e){return e!==void 0&&ls(e)?ss[e]:void 0}var ds={permission:0,error:1,waiting:2,running:3,unseen:4,none:5};function fs(e){return!1}function ps(e){return!1}function ms(e){let t=e.dispatch?.overBudget?e.dispatch.budgetUsd:void 0;if(!(e.status!==`waiting`||t===void 0))return{spent:e.costUsd??0,ceiling:t}}function G(e){return e.status===`failed`&&e.awaitingAnswerSince!==void 0}function hs(e){return e.status===`failed`&&e.idleClosedAt!==void 0&&!G(e)}function gs(e){return G(e)?`answer`:hs(e)?`idle`:void 0}function _s(e){let t,n;for(let r of e){if(r.status!==`failed`)continue;n=r.id;let e=r.finishedAt===void 0?NaN:Date.parse(r.finishedAt);!Number.isNaN(e)&&(t===void 0||e>=t.at)&&(t={id:r.id,at:e})}return t?.id??n}function vs(e){return!!e.worktreeLifecycle?.needsAttention||e.status===`waiting`||e.status===`review`||G(e)}function ys(e){let t=e.worktreeLifecycle;return t?.needsAttention?{bucket:`waiting`,tone:`pending`,pulse:!1,label:t.phase===`setup`?`setup needs attention`:`cleanup needs attention`}:t?.activeOperationId?{bucket:`running`,tone:`pending`,pulse:!0,label:t.phase===`setup`?`preparing worktree`:`cleaning up worktree`}:fs(e)?{bucket:`permission`,tone:`info`,pulse:!0,label:`needs permission`}:e.status===`failed`&&e.autoResumeAt?{bucket:`none`,tone:`pending`,pulse:!1,label:`scheduled`}:G(e)?{bucket:`waiting`,tone:`info`,pulse:!0,label:`needs you`}:hs(e)?{bucket:`none`,tone:`idle`,pulse:!1,label:`closed · idle`}:e.status===`failed`?{bucket:`error`,tone:`danger`,pulse:!1,label:`failed`}:e.status===`waiting`?{bucket:`waiting`,tone:`info`,pulse:!0,label:ms(e)?.ceiling===void 0?`needs you`:`budget reached`}:e.status===`review`?{bucket:`waiting`,tone:`info`,pulse:!0,label:`needs review`}:e.status===`running`&&e.activity===`monitoring`?{bucket:`running`,tone:`violet`,pulse:!0,label:`monitoring`}:e.status===`running`?{bucket:`running`,tone:`violet`,pulse:!0,label:`running`}:ps(e)?{bucket:`unseen`,tone:`violet`,pulse:!1,label:`unseen`}:e.status===`queued`&&e.fallbackEpisode?.pending?{bucket:`running`,tone:`violet`,pulse:!0,label:`switching agent`}:e.status===`queued`?{bucket:`none`,tone:`neutral`,pulse:!1,label:`queued`}:e.status===`done`?{bucket:`none`,tone:`success`,pulse:!1,label:`done`}:{bucket:`none`,tone:`neutral`,pulse:!1,label:`cancelled`}}function bs(e){return ds[ys(e).bucket]<=ds.waiting}var xs={waiting:0,review:1,running:2,queued:4,done:5,failed:5,cancelled:5},Ss=3,Cs=e=>e.status===`failed`&&e.autoResumeAt!==void 0?Ss:G(e)?xs.waiting??0:xs[e.status]??9;function ws(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function Ts(e){let t=/^(\d{1,9}): (.+)$/.exec(e),n=t?.[1],r=t?.[2];return n===void 0||r===void 0?{ref:null,rest:e}:{ref:Number(n),rest:r}}function Es(e,t){return t!==void 0&&Ts(e).ref===t}function Ds(e){return e.title.replace(/ \([A-C]\)$/,``)}function Os(e,t){if(e.promotedAt||t.promotedAt){if(!e.promotedAt)return 1;if(!t.promotedAt)return-1;let n=t.promotedAt.localeCompare(e.promotedAt);if(n!==0)return n}return e.createdAt.localeCompare(t.createdAt)}function ks(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort(Os);return new Map(t.map((e,t)=>[e.id,t+1]))}var As=[{value:`recent`,label:`Recent`},{value:`created`,label:`Created`}];function K(e,t){let n=Date.parse(e),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?t.localeCompare(e):r-n}function js(e){if(e.lastActivityAt!==void 0)return e.lastActivityAt;let t=e.finishedAt??e.startedAt??e.createdAt;for(let n of e.steps??[]){let e=n.finishedAt??n.startedAt;e!==void 0&&K(e,t)<0&&(t=e)}return t}function Ms(e,t){return t===`created`?e.createdAt:js(e)}function Ns(e){return e===`created`?`Created`:`Updated`}function Ps(e,t){if(t===`archived`)return[{key:`rest`,label:null,runs:[...e]}];let n=new Map(e.map(e=>[e.id,e])),r=e=>{let t=new Set;for(let r=e;r&&!t.has(r.id);r=n.get(r.dispatch?.parentRunId??``)){if(r.pinned)return!0;t.add(r.id)}return!1},i=e.filter(r);if(i.length===0)return[{key:`rest`,label:null,runs:[...e]}];let a=e.filter(e=>!r(e));return[{key:`pinned`,label:`Pinned`,runs:i},...a.length>0?[{key:`rest`,label:`All tasks`,runs:a}]:[]]}function Fs(e,t){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,n)=>{if(t!==`archived`){let t=Number(!!n.pinned)-Number(!!e.pinned);if(t!==0)return t}let r=Cs(e)-Cs(n);if(r!==0)return r;if(Cs(e)===Ss&&e.autoResumeAt&&n.autoResumeAt){let t=e.autoResumeAt.localeCompare(n.autoResumeAt);if(t!==0)return t}return e.status===`queued`&&n.status===`queued`?Os(e,n):K(js(e),js(n))})}function Is(e,t,n){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,r)=>{if(t!==`archived`){let t=Number(!!r.pinned)-Number(!!e.pinned);if(t!==0)return t}return K(Ms(e,n),Ms(r,n))})}function Ls(e){let t=0,n=0,r=0;for(let i of e){if(i.archived){n+=1;continue}t+=1,vs(i)&&(r+=1)}return{active:t,archived:n,waiting:r}}var Rs=new Set([`running`,`waiting`]),zs=new Set([`done`,`failed`,`review`,`cancelled`]),Bs=new Set([`done`,`failed`,`cancelled`]);function Vs(e){return e?e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} kB`:``}function Hs(e){return e?`$${e>=10?e.toFixed(0):e.toFixed(2)}`:``}function Us(e,t=new Date){if(e.status!==`failed`||!e.autoResumeAt)return;let n=new Date(e.autoResumeAt);if(!Number.isFinite(n.getTime()))return;let r=n.toDateString()===t.toDateString(),i=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);return{label:r?i:`${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(n)} ${i}`,title:`Resumes automatically at ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n)}`}}function Ws(e){if(e.workflow===`(planned)`||e.workflow===`(inbox)`){let t=e.steps.find(e=>e.kind===`agent`);if(t?.name)return t.name}return e.workflow}function Gs(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[ws(e),e.branch??``,e.workflow,Ws(e)].some(e=>e.toLowerCase().includes(n))):[...e]}function Ks(e){return e.filter(e=>!e.archived&&Bs.has(e.status)&&!G(e)).length}function qs(e,t=!1){if(!e)return;let n=e.trim().replace(/\/+$/,``),r=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(n),i=r?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(n),a=r??i;if(!a)return;let[,o,s]=a;if(!s||!o||!t&&o.toLowerCase()!==`github.com`)return;let c=s.replace(/\.git$/i,``).split(`/`).filter(Boolean),l=c[c.length-2],u=c[c.length-1];return l&&u?`https://${o.toLowerCase()}/${l}/${u}`:void 0}function Js(e){if(e.pullRequestUrl){let t=Number(q(e.pullRequestUrl));return{url:e.pullRequestUrl,...t>0?{number:t}:{}}}let t=e.prRefs?.find(e=>e.origin===`created`||e.origin===`marker`);if(t)return{number:t.number,...t.url?{url:t.url}:{}};let n=e.markerRefs?.pr;return n===void 0?void 0:{number:n}}function Ys(e){return Xs(e)[0]?.url??Zs(e)[0]}function Xs(e,t){if(!e.prRefs?.length)return Zs(e).map(e=>({number:Number(q(e)),url:e,origin:`legacy`})).filter(e=>Number.isInteger(e.number)&&e.number>0);let n={created:0,marker:1,legacy:2,derived:3};return[...e.prRefs].sort((e,t)=>n[e.origin]-n[t.origin]).map(e=>({number:e.number,url:e.url??ic(`PR`,e.number,t),origin:e.origin}))}function Zs(e){let t=[];return e.pullRequestUrl&&t.push(e.pullRequestUrl),!(e.markerRefs?.issue!==void 0&&e.markerRefs?.pr===void 0)&&e.referencedPullRequestUrl&&t.push(e.referencedPullRequestUrl),t}function Qs(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.markerRefs?.issue??e.issueNumber;if(!(!n||!t)&&!$s(e.referencedIssueCandidates,n,t))return`${t}/issues/${n}`}function $s(e,t,n){let r=`${n.toLowerCase()}/`;return(e??[]).some(e=>e.endsWith(`/${t}`)&&!e.toLowerCase().startsWith(r))}function ec(e,t){return e.map((e,t)=>({reference:e,index:t})).sort((e,n)=>{let r=e.reference.kind===`PR`&&t(e.reference)===`closed`,i=n.reference.kind===`PR`&&t(n.reference)===`closed`;return Number(r)-Number(i)||e.index-n.index}).map(({reference:e})=>e)}function tc(e,t){let n=e.prRefs?.length?Xs(e,t).map(e=>({number:e.number,url:e.url})):Zs(e).map(e=>({url:e,number:Number(q(e))||void 0})),r=e.markerRefs?.pr,i=[...r===void 0||n.some(e=>e.number===r)?[]:[{kind:`PR`,number:r}],...n.map(e=>({kind:`PR`,url:e.url,number:e.number})),{kind:`PR`,number:rc(e,t)},{kind:`Issue`,url:Qs(e,t)},{kind:`Issue`,number:nc(e,t)}],a=new Set,o=[];for(let e of i){let n=e.url?Number(q(e.url)):e.number;if(!n||!Number.isInteger(n))continue;let r=e.url??ic(e.kind,n,t),i=o.findIndex(t=>t.kind===e.kind&&t.number===n&&(!t.url||!r||t.url===r));if(i>=0){!o[i].url&&r&&(o[i]={...o[i],url:r});continue}let s=`${e.kind}#${n}#${r??``}`;a.has(s)||(a.add(s),o.push({kind:e.kind,number:n,...r?{url:r}:{}}))}return o}function nc(e,t){let n=e.issueNumber;return n===void 0||!t?n:$s(e.referencedIssueCandidates,n,t)?void 0:n}function rc(e,t){let n=e.prNumber;return n===void 0||!t?n:$s(e.referencedPrCandidates,n,t)?void 0:n}function ic(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function ac(e,t){return tc(e,t)[0]}function q(e){let t=e.split(`/`).pop()??``;return/^\d+$/.test(t)?t:null}function oc(e,t){let n=Rs.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:Vs(n.rssBytes),kind:`live`}};let r=Vs(e.peakRssBytes);return{cpu:{text:``,kind:`none`},mem:r?{text:`peak ${r}`,kind:`peak`,title:`peak — run finished${e.peakProcCount?` · ${e.peakProcCount} procs`:``}`}:{text:``,kind:`none`}}}function sc(e,t){let n=e.filter(e=>t===`archived`?e.archived:!e.archived),r=new Map;for(let e of n){if(!e.groupId)continue;let t=r.get(e.groupId);t?t.push(e):r.set(e.groupId,[e])}return[...r.entries()].flatMap(([e,t])=>{let n=t[0];return!n||t.length<2||!t.every(e=>zs.has(e.status))?[]:[{groupId:e,title:Ds(n),count:t.length}]})}function cc(e,t,n){if(!n)return[];let r=t.kind===`pr`?`PR`:`Issue`,i=`${n.toLowerCase()}/`;return e.filter(e=>tc(e,n).some(e=>e.kind===r&&e.number===t.number&&e.url?.toLowerCase().startsWith(i))).sort((e,t)=>K(e.createdAt,t.createdAt))}function lc(e){return 220+Math.max(0,e)*14}function uc(e){let t=new Map;for(let n of e)for(let e of n.tags??[]){let n=e.toLowerCase();t.has(n)||t.set(n,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function dc(e,t,n,r=8){let i=n.trim().toLowerCase(),a=new Set(t.map(e=>e.toLowerCase())),o=e.filter(e=>{let t=e.toLowerCase();return a.has(t)?!1:i===``||t.includes(i)&&t!==i});return i===``?o.slice(0,r):o.sort((e,t)=>Number(t.toLowerCase().startsWith(i))-Number(e.toLowerCase().startsWith(i))||e.localeCompare(t,void 0,{sensitivity:`base`})).slice(0,r)}function fc(e){let t=new Map;for(let n of e){let e=n.trim();if(!e)continue;let r=e.toLowerCase();t.has(r)||t.set(r,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}var pc=`/api/v1/ws`,mc=3e3,hc=1e3,gc=7e4,_c=0,vc=1;function yc(e){let t=new Map,n=new Map,r=null,i,a,o,s=()=>{clearTimeout(o),o=setTimeout(()=>{o=void 0,r?.close()},gc)},c=()=>e??`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${pc}`,l=e=>{r?.readyState===vc&&r.send(JSON.stringify(e))},u=()=>{let e=globalThis.WebSocket;if(typeof e!=`function`||r&&(r.readyState===_c||r.readyState===vc))return;let a=new e(c());r=a,a.addEventListener(`open`,()=>{if(a===r){s();for(let e of t.keys())l({type:`subscribe`,topic:e})}}),a.addEventListener(`message`,e=>{if(a!==r)return;s();let i;try{i=JSON.parse(e.data)}catch{return}if(typeof i!=`object`||!i)return;let{type:o,topic:c,data:l}=i;if(typeof c!=`string`)return;if(o===`error`){for(let e of[...n.get(c)??[]])e();return}if(o!==`event`)return;let u=t.get(c);if(u)for(let e of[...u])e(l)}),a.addEventListener(`close`,()=>{a===r&&(r=null,clearTimeout(o),o=void 0,t.size>0&&i===void 0&&(i=setTimeout(()=>{i=void 0,t.size>0&&u()},mc)))}),a.addEventListener(`error`,()=>void 0)};return{subscribe(e,s,c){let d=()=>c?.();c&&(n.has(e)||n.set(e,new Set),n.get(e).add(d));let f=t.get(e);f||(f=new Set,t.set(e,f));let p=f.size===0;f.add(s),clearTimeout(a),a=void 0,r?p&&l({type:`subscribe`,topic:e}):(clearTimeout(i),i=void 0,u());let m=!0;return()=>{m&&(m=!1,n.get(e)?.delete(d),n.get(e)?.size||n.delete(e),f.delete(s),!(f.size>0)&&(t.delete(e),l({type:`unsubscribe`,topic:e}),t.size===0&&a===void 0&&(a=setTimeout(()=>{a=void 0,!(t.size>0)&&(clearTimeout(i),i=void 0,clearTimeout(o),o=void 0,r?.close(),r=null)},hc))))}}}}var bc=null;function xc(e,t,n){return bc??=yc(),bc.subscribe(e,t,n)}var J={secrets:{allFor:e=>[`secrets`,e],list:()=>[`secrets`,m()]},e2e:{allFor:e=>[`e2e`,e],status:()=>[`e2e`,m()]},tracker:{allFor:e=>[`tracker`,e],all:()=>[`tracker`,m()],associationFor:e=>[`tracker`,e,`association`],association:()=>[`tracker`,m(),`association`],candidates:(e,t=``)=>[`tracker`,m(),`candidates`,e,t],connection:()=>[`tracker`,m(),`connection`],items:(e,t)=>[`tracker`,m(),`items`,e.kind,e.source.id,e.source.webUrl,e.externalId,e.connectionId??null,t.state,[...t.labels],t.query??``],detail:(e,t)=>[`tracker`,m(),`detail`,e.kind,e.source.id,e.source.webUrl,e.externalId,e.connectionId??null,t]},get health(){return[m(),`health`]},runs:{get all(){return[m(),`runs`]},list:()=>[m(),`runs`,`list`],detail:e=>[m(),`runs`,`detail`,e],diff:e=>[m(),`runs`,`diff`,e],changes:e=>[m(),`runs`,`changes`,e],gitStatus:e=>[m(),`runs`,`git-status`,e],file:(e,t)=>[m(),`runs`,`files`,e,t],artifacts:e=>[m(),`runs`,`artifacts`,e],impactSubject:e=>[m(),`runs`,`impact-subject`,e],get impactSubjects(){return[m(),`runs`,`impact-subject`]},get projectAssets(){return[m(),`runs`,`project-assets`]},artifactText:(e,t,n)=>[m(),`runs`,`artifact-text`,e,t,n],handoff:e=>[m(),`runs`,`handoff`,e],drafts:e=>[m(),`runs`,`drafts`,e],commits:e=>[m(),`runs`,`commits`,e],tree:e=>[m(),`runs`,`tree`,e],commit:(e,t)=>[m(),`runs`,`commit`,e,t]},groups:{detail:e=>[m(),`groups`,e]},get todos(){return[m(),`todos`]},get workflows(){return[m(),`workflows`]},get workflowNodes(){return[m(),`workflow-nodes`]},get skills(){return[m(),`skills`]},get skillsReady(){return[m(),`skills`,`ready`]},get importableSkills(){return[m(),`skills`,`importable`]},get importableSkillsReady(){return[m(),`skills`,`importable`,`ready`]},get launchKey(){return[m(),`launch-key`]},get repo(){return[m(),`repo`]},get repoChanges(){return[m(),`repo`,`changes`]},repoCommit:e=>[m(),`repo`,`commit`,e],get repoSync(){return[m(),`repo`,`sync`]},get repoTree(){return[m(),`repo`,`tree`]},repoFile:e=>[m(),`repo`,`file`,e],get uiState(){return[m(),`ui-state`]},get config(){return[m(),`config`]},get agentConfig(){return[m(),`agent-config`]},agentConfigFile:e=>[m(),`agent-config`,`file`,e],get worktrees(){return[m(),`worktrees`]},github:(e={})=>[m(),`github`,e.limit??null],githubPages:(e=50)=>[m(),`github`,`pages`,e],githubChecks:e=>[m(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[m(),`github`,`search`,e,t],githubRefStatus:(e,t,n)=>[e,`github`,`ref-status`,[...t].sort((e,t)=>e-t).join(`,`),[...n].sort((e,t)=>e-t).join(`,`)],githubComments:(e,t)=>[m(),`github`,`comments`,e,t],githubMergeState:e=>[m(),`github`,`merge-state`,e],get openTargets(){return[m(),`open-targets`]}},Sc=6e4;function Cc(){return M({queryKey:J.secrets.list(),queryFn:({signal:e})=>Tr({signal:e})})}function wc(){return M({queryKey:Y.secrets,queryFn:({signal:e})=>Er({signal:e})})}function Tc(){return M({queryKey:J.e2e.status(),queryFn:({signal:e})=>Mr({signal:e})})}function Ec(){return M({queryKey:J.tracker.connection(),queryFn:({signal:e})=>Sr({signal:e})})}function Dc(){return M({queryKey:J.tracker.association(),queryFn:({signal:e})=>Pr({signal:e})})}function Oc(e,t,n){return Lt({queryKey:J.tracker.candidates(e,t),staleTime:Sc,queryFn:({pageParam:n,signal:r})=>Fr(e,{q:t.trim()||void 0,cursor:n,limit:50},{signal:r}),initialPageParam:void 0,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,enabled:n})}var kc=class extends Error{failure;constructor(e){super(e.reason),this.failure=e,this.name=`TrackerRefreshError`}};function Ac(e,t,n=!0){let r=t.query.trim(),i=j(),a=e?J.tracker.items(e,{...t,query:r}):[`tracker`,m(),`items`,`unassociated`];return{...Lt({queryKey:a,staleTime:1/0,queryFn:({pageParam:n,signal:i})=>r?Br(r,{association:e??void 0,cursor:n,limit:50,state:t.state,labels:t.labels,refresh:!0},{signal:i}):zr({association:e??void 0,cursor:n,limit:50,state:t.state,labels:t.labels,refresh:!1},{signal:i}),initialPageParam:void 0,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,enabled:e!=null&&n}),queryKey:a,restart:async()=>{await i.cancelQueries({queryKey:a,exact:!0});try{await i.fetchInfiniteQuery({queryKey:a,initialPageParam:void 0,pages:1,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,staleTime:0,retry:!1,queryFn:async({signal:n})=>{let i={association:e??void 0,limit:50,state:t.state,labels:t.labels,refresh:!0},a=r?await Br(r,i,{signal:n}):await zr(i,{signal:n});if(!a.available)throw new kc(a);return a}})}catch{}}}}function jc(e,t){return M({staleTime:Sc,queryKey:e&&t?J.tracker.detail(e,t):[`tracker`,m(),`detail`,`disabled`],queryFn:({signal:n})=>Vr(t,{signal:n,association:e??void 0}),enabled:e!=null&&t!=null&&t!==``})}var Y={dashboard:[`workspace`,`dashboard`],models:e=>[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],agentSetup:[`workspace`,`providers`,`setup`],projects:[`workspace`,`projects`],githubOwners:[`workspace`,`github-owners`],githubLogin:[`workspace`,`github-login`],repoSuggestions:[`workspace`,`repo-suggestions`],runsIndex:[`workspace`,`runs-index`],secrets:[`workspace`,`secrets`],uiState:[`workspace`,`ui-state`],config:[`workspace`,`config`],hostUsage:[`workspace`,`host-usage`],agentProfiles:[`workspace`,`agent-profiles`],agentFallbackPolicy:e=>[`workspace`,`agent-profiles`,`fallback-policy`,e],agentAccountDetails:e=>[`workspace`,`agent-profiles`,`details`,e],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],skillsUpdateAll:[`workspace`,`skills-update`],skillsUpdate:e=>[`workspace`,`skills-update`,e],selfUpdate:[`workspace`,`self-update`],selfUpdateDevelopment:[`workspace`,`self-update`,`development`],starCount:[`workspace`,`star-count`],telemetryConsent:[`workspace`,`telemetry-consent`],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...Y.fsBrowseRoot,e,t]};function X(e,t=!0){return M({queryKey:Y.models(e),queryFn:({signal:t})=>r(e)?kn(e,{signal:t}):Promise.reject(Error(`${e} has no host model catalog`)),staleTime:300*1e3,enabled:t&&r(e)})}function Mc(e=!0){let t=X(`claude`,e),n=X(`codex`,e),r=X(`opencode`,e),i=X(`cursor`,e),a=X(`pi`,e);return{claude:t,codex:n,junie:X(`junie`,e),opencode:r,cursor:i,pi:a,copilot:X(`copilot`,e),omp:X(`omp`,e),antigravity:X(`antigravity`,e),gemini:X(`gemini`,e),kimi:X(`kimi`,e)}}function Nc(){let e=j();return M({queryKey:Y.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(Y.providerStatus),r=await An(!1,{signal:t});return Zt(n,e.getQueryData(Y.providerStatus),r)},staleTime:5*6e4,refetchInterval:!1,refetchOnWindowFocus:!0})}function Pc(){let e=j();return N({mutationFn:()=>An(!0),onMutate:()=>e.getQueryData(Y.providerStatus),onSuccess:(t,n,r)=>e.setQueryData(Y.providerStatus,e=>Zt(r,e,t))})}function Fc(){return M({queryKey:Y.agentSetup,queryFn:({signal:e})=>Bn({signal:e}),retry:!1,gcTime:0,refetchInterval:e=>{let t=e.state.data;return t?.available&&t.session?.exitCode===null?Ic:!1},refetchIntervalInBackground:!0})}var Ic=1e3;function Lc(){let e=j();return(0,A.useCallback)(()=>void e.invalidateQueries({queryKey:J.health}),[e])}function Rc(){let e=j();return N({mutationFn:({provider:e,action:t})=>Vn(e,t),retry:!1,onSuccess:t=>e.setQueryData(Y.agentSetup,e=>e?.available?{...e,session:t}:e),onSettled:()=>e.invalidateQueries({queryKey:Y.agentSetup})})}function zc(){let e=j();return N({mutationFn:e=>Gn(e),retry:!1,onSettled:()=>e.invalidateQueries({queryKey:Y.agentSetup})})}function Bc(){let e=j();return N({mutationFn:({provider:e,authFailureId:t})=>di(e,t),onMutate:()=>e.getQueryData(Y.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(Y.providerStatus,e=>Zt(r,e,t,n.authFailureId))}})}function Vc(){return M({queryKey:Y.projects,queryFn:({signal:e})=>Mn({signal:e})})}function Hc(e,t=!1){return M({queryKey:Y.fsBrowse(e,t),queryFn:({signal:n})=>Nn(e??void 0,{signal:n,showHidden:t}),retry:!1})}function Uc(){let e=j();return N({mutationFn:e=>fi(e),onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function Wc(){let e=j();return N({mutationFn:e=>gi(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:Y.projects})}})}function Gc(){let e=j();return N({mutationFn:e=>{let{id:t,...n}=e;return _i(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:Y.projects});let r=e.getQueryData(Y.projects);return e.setQueryData(Y.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?Kc(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(Y.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(Y.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:Y.projects})})}function Kc(e,t){let{maxParallel:n,tags:r,...i}=e,a={...i},o=`maxParallel`in t?t.maxParallel:e.maxParallel;o!=null&&(a.maxParallel=o);let s=`tags`in t&&t.tags!==void 0?t.tags:e.tags,c=s==null?[]:fc(s);return c.length>0&&(a.tags=c),a}function qc(e){let t=j();return N({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:Y.agentProfiles}),t.invalidateQueries({queryKey:Y.projects})])}})}function Jc(){return qc(e=>Ya(e))}function Yc(){return qc(e=>{let{id:t,...n}=e;return eo(t,n)})}function Xc(){return qc(e=>to(e))}function Zc(){return qc(e=>$a(e))}function Qc(e,t){return M({queryKey:Y.agentAccountDetails(e),queryFn:({signal:t})=>Za(e,{signal:t}),enabled:t,staleTime:0,retry:!1})}function $c(e,t){return M({queryKey:Y.agentAccountStatus(e),queryFn:({signal:t})=>Xa(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function el(){let e=j();return N({mutationFn:({provider:e,profileId:t})=>ci(e,t),retry:!1,onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Y.agentProfiles}),e.invalidateQueries({queryKey:Y.providerStatus})])}})}function tl(){let e=j();return N({mutationFn:e=>Xa(e,{recheck:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(Y.agentAccountStatus(n),t),e.invalidateQueries({queryKey:Y.agentProfiles})}})}function nl(){return N({mutationFn:e=>{let{routeId:t,...n}=e;return Qa(t,n)},retry:!1})}function rl(){let e=j();return N({mutationFn:e=>pi(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function il(){let e=j();return N({mutationFn:e=>mi(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function al(e=!0){return M({queryKey:Y.repoSuggestions,queryFn:({signal:e})=>Pn({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function ol(){let e=j();return N({mutationFn:e=>Fn(e),retry:!1,onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:Y.projects}),e.invalidateQueries({queryKey:J.repo}),e.invalidateQueries({queryKey:J.health})])})}function sl(){let e=j();return N({mutationFn:({projectId:e,owner:t,name:n})=>In(e,{owner:t,name:n}),retry:!1,onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:Y.projects}),e.invalidateQueries({queryKey:J.repo}),e.invalidateQueries({queryKey:J.health})])})}function cl(e){let t=j(),n=(0,A.useRef)(e);n.current=e;let r=(0,A.useRef)(!1),i=N({mutationFn:Ln,retry:!1,onMutate:()=>{r.current=!0,t.setQueryData(Y.githubLogin,{status:`starting`})},onSuccess:e=>t.setQueryData(Y.githubLogin,e)}),a=N({mutationFn:zn,retry:!1,onMutate:()=>{r.current=!1},onSuccess:e=>t.setQueryData(Y.githubLogin,e)}),o=M({queryKey:Y.githubLogin,queryFn:({signal:e})=>Rn({signal:e}),enabled:i.isSuccess,refetchInterval:e=>{let t=e.state.data?.status;return t===`pending`||t===`starting`?2e3:!1},staleTime:0,retry:!1}),s=r.current||i.isPending||i.isSuccess?o.data:void 0,c=s?.status,l=s?.status===`done`?s.login:void 0;return(0,A.useEffect)(()=>{c!==`done`||!r.current||(r.current=!1,Promise.all([t.invalidateQueries({queryKey:Y.githubOwners}),t.invalidateQueries({queryKey:Y.projects}),t.invalidateQueries({queryKey:[m(),`github`]}),t.invalidateQueries({queryKey:J.repo}),t.invalidateQueries({queryKey:J.health})]),n.current?.(l))},[c,l,t]),{state:s,start:i,cancel:a}}function ll(){return M({queryKey:Y.githubOwners,queryFn:({signal:e})=>hi({signal:e}),staleTime:5*6e4,retry:!1})}function ul(){let e=j();(0,A.useEffect)(()=>{let t,n=()=>{let n=e.getQueryData(J.health)?.capabilities?.localHandoff===!0;n&&t===void 0?t=xc(`health`,t=>{e.setQueryData(J.health,t)}):!n&&t!==void 0&&(t(),t=void 0)};n();let r=e.getQueryCache().subscribe(n);return()=>{r(),t?.()}},[e])}function dl(){return M({queryKey:J.health,queryFn:({signal:e})=>wn({signal:e}),refetchInterval:e=>pl(e.state.data)})}var fl=3e4;function pl(e){return e?.capabilities?.localHandoff===!1&&e.forge!=null&&e.forge.available!==!0&&fl}function ml(){let e=dl().data,t=Vc().data?.projects,{projectId:n}=Bt(),r=n??e?.bootProject,i=r===void 0?void 0:t?.find(e=>e.id===r);return i?.repoUrl?i.repoUrl:n===null||n===e?.bootProject?qs(e?.repo?.remote,e?.forge?.kind===`github`):void 0}function hl(){return M({queryKey:J.openTargets,queryFn:({signal:e})=>Gi({signal:e}),staleTime:5*6e4})}function gl(e){return M({queryKey:J.runs.list(),queryFn:({signal:e})=>Kn({signal:e}),select:e})}function _l(e=!0,t){return M({queryKey:Y.runsIndex,queryFn:({signal:e})=>Jn({signal:e}),enabled:e,staleTime:3e4,...t===void 0?{}:{refetchInterval:typeof t==`function`?e=>t(e.state.data):t}})}function vl(e,t=!0,n=!1,r){return M({queryKey:[n?`default`:e,`runs`,`list`],queryFn:({signal:t})=>qn(e,{signal:t}),enabled:t,select:r})}function yl(e,t,n){let r=e==="default"?null:e,i=r===null||t!=null&&r===t;return vl(i?`default`:r??`default`,!0,i,n)}function bl(e){return{queryKey:J.runs.detail(e),queryFn:({signal:t})=>Yn(e,{signal:t})}}function xl(e){return M({...bl(e??``),enabled:!!e})}function Sl(e,t,n=!0){return M({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Xn(e,t,{signal:n}),enabled:n&&!!e&&!!t})}function Cl(e){return M({queryKey:J.runs.diff(e??``),queryFn:({signal:t})=>Yr(e,{signal:t}),enabled:!!e})}function wl(e,t=!1){return M({queryKey:J.runs.changes(e??``),queryFn:({signal:t})=>Zr(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?4e3:!1,refetchOnWindowFocus:!0,staleTime:0})}function Tl(e,t,n=!1){return M({queryKey:J.runs.gitStatus(e),queryFn:({signal:t})=>Xi(e,{signal:t}),enabled:t,retry:!1,refetchInterval:n?1e4:!1,refetchOnWindowFocus:!0,staleTime:0})}function El(e,t=!0){return M({queryKey:J.runs.tree(e??``),queryFn:({signal:t})=>_r(e,{signal:t}),enabled:t&&!!e,retry:!1,staleTime:0})}function Dl(e,t){return M({queryKey:J.runs.file(e??``,t??``),queryFn:({signal:n})=>Qr(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function Ol(e){return M({queryKey:J.runs.artifacts(e??``),queryFn:({signal:t})=>ei(e,{signal:t}),enabled:!!e,retry:!1})}function kl(e,t,n){return M({queryKey:J.runs.artifactText(e,t??``,n??``),queryFn:({signal:n})=>ni(e,t,{signal:n}),enabled:t!==void 0&&n!==void 0,retry:!1,staleTime:1/0})}function Al(e){return M({queryKey:J.runs.impactSubject(e?W(e):``),queryFn:({signal:t})=>ai(e,{signal:t}),enabled:e!==null,retry:!1})}function jl(){return M({queryKey:J.runs.projectAssets,queryFn:({signal:e})=>oi({signal:e}),retry:!1})}function Ml(){let e=j();return N({mutationFn:e=>ii(e),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:J.runs.impactSubject(W(n.subject))}),e.invalidateQueries({queryKey:J.runs.list()})}})}function Nl(e){return M({queryKey:J.groups.detail(e??``),queryFn:({signal:t})=>si(e,{signal:t}),enabled:!!e})}function Pl(e,t=!1){return M({queryKey:J.runs.commits(e??``),queryFn:({signal:t})=>vr(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?5e3:!1})}function Fl(e,t){return M({queryKey:J.runs.commit(e??``,t??``),queryFn:({signal:n})=>yr(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function Il(e,t=!0){return M({queryKey:J.runs.handoff(e??``),queryFn:({signal:t})=>Xr(e,{signal:t}),enabled:!!e&&t})}function Ll(e){return M({queryKey:J.runs.drafts(e??``),queryFn:({signal:t})=>aa(e,{signal:t}),enabled:!!e,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1})}function Rl(e=!0){return M({queryKey:J.todos,queryFn:({signal:e})=>or({signal:e}),enabled:e})}function zl(){return M({queryKey:J.workflowNodes,queryFn:({signal:e})=>Pa({signal:e}),staleTime:1/0})}function Bl(e={}){return M({queryKey:J.workflows,enabled:e.enabled??!0,queryFn:({signal:e})=>er({signal:e})})}function Vl(e=!0){let t=j(),n=J.skills,r=n[0],i=M({queryKey:n,queryFn:({signal:e})=>tr({signal:e}),enabled:e}),a=M({queryKey:J.skillsReady,queryFn:({signal:e})=>nr({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,A.useEffect)(()=>{if(!Array.isArray(a.data))return;let e=t.getQueryState([r,`skills`])?.dataUpdatedAt??0;a.dataUpdatedAt<e||t.setQueryData([r,`skills`],a.data)},[t,a.data,a.dataUpdatedAt,r]),i}function Hl(e=!0){let t=j(),n=J.importableSkills,r=n[0],i=M({queryKey:n,queryFn:({signal:e})=>ir({signal:e}),enabled:e}),a=M({queryKey:J.importableSkillsReady,queryFn:({signal:e})=>ar({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,A.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`,`importable`],a.data)},[t,a.data,r]),i}function Ul(){return M({queryKey:J.launchKey,queryFn:({signal:e})=>jn({signal:e}),staleTime:1/0})}function Wl(){return M({queryKey:J.repo,queryFn:({signal:e})=>sr({signal:e})})}function Gl(){return M({queryKey:J.repoSync,queryFn:({signal:e})=>ma({signal:e}),refetchOnWindowFocus:!0})}function Kl(){let e=j();return N({mutationFn:e=>ha(e),onSuccess:t=>{e.setQueryData(J.repoSync,t.sync),e.invalidateQueries({queryKey:J.repo,predicate:e=>e.queryKey[2]!==`sync`})}})}function ql(){return M({queryKey:J.repoChanges,queryFn:({signal:e})=>fr({signal:e}),retry:!1})}function Jl(){return M({queryKey:J.repoTree,queryFn:({signal:e})=>pr({signal:e}),retry:!1,refetchOnWindowFocus:!0,staleTime:0})}function Yl(e){return M({queryKey:J.repoFile(e??``),queryFn:({signal:t})=>mr(e,{signal:t}),enabled:e!==void 0&&e!==``,retry:!1,refetchOnWindowFocus:!0,staleTime:0})}function Xl(e){return M({queryKey:J.repoCommit(e??``),queryFn:({signal:t})=>gr(e,{signal:t}),enabled:!!e,retry:!1})}function Zl(){return M({queryKey:J.config,queryFn:({signal:e})=>cr({signal:e})})}function Ql(){return M({queryKey:J.worktrees,queryFn:({signal:e})=>ho({signal:e})})}function $l(){return M({queryKey:J.uiState,queryFn:({signal:e})=>$n({signal:e})})}function eu(){return M({queryKey:J.agentConfig,queryFn:({signal:e})=>lr({signal:e})})}function tu(e){return M({queryKey:J.agentConfigFile(e??``),queryFn:({signal:t})=>ur(e,{signal:t}),enabled:e!==null})}function nu(e){let t=j(),n=J.agentConfig,r=J.agentConfigFile(e);return N({mutationFn:t=>dr(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}function ru(){return M({queryKey:Y.uiState,queryFn:({signal:e})=>Ba({signal:e})})}function iu(){return M({queryKey:Y.config,queryFn:({signal:e})=>Ha({signal:e})})}function au(){return M({queryKey:Y.agentProfiles,queryFn:({signal:e})=>Ka({signal:e})})}function ou(e){return M({queryKey:Y.agentFallbackPolicy(e??`default`),queryFn:({signal:t})=>qa({projectId:e??`default`},{signal:t}),enabled:e!==null,retry:!1})}function su(e){let t=j();return N({mutationFn:t=>Ja({projectId:e??`default`,...t}),retry:!1,onSuccess:n=>t.setQueryData(Y.agentFallbackPolicy(e??`default`),n)})}var cu=15*6e4;function lu(e=!0){let t=j();return(0,A.useEffect)(()=>{if(e)return t.getQueryCache().subscribe(e=>{e.type!==`updated`||e.action.type!==`success`||e.action.manual||e.query.queryHash!==du&&t.prefetchQuery(uu)})},[e,t]),M({...uu,enabled:e,refetchOnMount:!1})}var uu={queryKey:Y.starCount,queryFn:({signal:e})=>Tn({signal:e}),staleTime:cu,retry:!1},du=T(Y.starCount);function fu(){return M({queryKey:Y.telemetryConsent,queryFn:({signal:e})=>Dn({signal:e}),staleTime:1/0,retry:!1})}var pu=6;function mu(e,t=!0){return M({queryKey:Y.skillsUpdate(e),queryFn:({signal:t})=>no(e,{signal:t}),enabled:t,refetchInterval:e=>{let t=e.state.data?.status;return(t===void 0||t===`checking`||t===`updating`||t===`idle`&&e.state.dataUpdateCount<pu)&&6e4}})}function hu(e=!0){return M({queryKey:Y.selfUpdate,queryFn:({signal:e})=>ao({signal:e}),enabled:e,refetchInterval:e=>e.state.data?.job?.status===`running`?1e3:e.state.data?.scheduled?5e3:!1})}function gu(e=!0){return M({queryKey:Y.selfUpdateDevelopment,queryFn:({signal:e})=>so({signal:e}),enabled:e,staleTime:3e4})}function _u(){let e=j();return N({mutationFn:()=>so({refresh:!0}),onSuccess:t=>e.setQueryData(Y.selfUpdateDevelopment,t)})}function vu(){let e=j();return N({mutationFn:()=>oo(),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function yu(){let e=j();return N({mutationFn:e=>co(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function bu(){let e=j();return N({mutationFn:e=>lo(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function xu(){let e=j();return N({mutationFn:e=>uo(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function Su(){let e=j();return N({mutationFn:()=>fo(),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function Cu(e){let t=j();return N({mutationFn:t=>zi(e,t),onSuccess:e=>{wu(t,e),t.invalidateQueries({queryKey:J.runs.all})}})}function wu(e,t){e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t.id?is(e,t):e)),e.setQueryData(J.runs.detail(t.id),e=>e?is(e,t):t),Tu(e)}function Tu(e){e.invalidateQueries({queryKey:Y.runsIndex})}function Eu(){let e=j();return N({mutationFn:e=>ki(e),onMutate:async t=>{await e.cancelQueries({queryKey:J.runs.list()}),await e.cancelQueries({queryKey:J.runs.detail(t)});let n=e.getQueryData(J.runs.list()),r=e.getQueryData(J.runs.detail(t)),i=new Date().toISOString();return e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t?{...e,seenAt:i}:e)),e.setQueryData(J.runs.detail(t),e=>e&&{...e,seenAt:i}),{prevList:n,prevDetail:r,id:t}},onError:(t,n,r)=>{r?.prevList&&e.setQueryData(J.runs.list(),r.prevList),r?.prevDetail&&e.setQueryData(J.runs.detail(n),r.prevDetail)},onSuccess:t=>{let n=e=>e.id===t.id?{...e,seenAt:t.seenAt}:e;e.setQueryData(J.runs.list(),e=>e?.map(n)),e.setQueryData(J.runs.detail(t.id),e=>e?n(e):t),Tu(e)}})}function Du(){let e=j();return N({mutationFn:e=>Ai(e),onMutate:async t=>{await e.cancelQueries({queryKey:J.runs.list()}),await e.cancelQueries({queryKey:J.runs.detail(t)});let n=e.getQueryData(J.runs.list()),r=e.getQueryData(J.runs.detail(t));return e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t?Ou(e):e)),e.setQueryData(J.runs.detail(t),e=>e&&Ou(e)),{prevList:n,prevDetail:r,id:t}},onError:(t,n,r)=>{r?.prevList&&e.setQueryData(J.runs.list(),r.prevList),r?.prevDetail&&e.setQueryData(J.runs.detail(n),r.prevDetail)},onSuccess:t=>{let n=e=>e.id===t.id?Ou(e):e;e.setQueryData(J.runs.list(),e=>e?.map(n)),e.setQueryData(J.runs.detail(t.id),e=>e?n(e):t),Tu(e)}})}function Ou(e){let{seenAt:t,...n}=e;return n}function ku(e,t,n){let r=j();return N({mutationFn:({id:n,pinned:r,surface:i})=>t===void 0?Ci(n,r,i??e):wi(t,n,r,i??e),onSuccess:()=>r.invalidateQueries({queryKey:n===void 0?J.runs.all:[n,`runs`]})})}function Au(e,t,n){let r=j();return N({mutationFn:({id:n,archived:r})=>t===void 0?Si(n,r,e):Ti(t,n,r,e),onSuccess:()=>r.invalidateQueries({queryKey:n===void 0?J.runs.all:[n,`runs`]})})}function ju(e,t){let n=j();return N({mutationFn:n=>t===void 0?ta(e,n):na(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:J.runs.all}),onError:e=>{e instanceof F&&e.status===409&&n.invalidateQueries({queryKey:J.runs.all})}})}function Mu(e,t){let n=j();return N({mutationFn:(n={})=>t===void 0?Pi(e,n):Fi(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:J.runs.all})})}function Nu(e){let t=j();return N({mutationFn:({msgId:t,message:n})=>ra(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function Pu(e){let t=j();return N({mutationFn:t=>ia(e,t),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function Fu(e={},t=!0){return M({queryKey:J.github(e),queryFn:({signal:t})=>br({limit:e.limit},{signal:t}),enabled:t})}function Iu(e=50,t=!0){return Lt({queryKey:J.githubPages(e),queryFn:({pageParam:t,signal:n})=>br({limit:e,...t},{signal:n}),initialPageParam:{issuesCursor:void 0,prsCursor:void 0,issuesDone:!1,prsDone:!1},getNextPageParam:e=>{let t=e.issuesNextCursor??void 0,n=e.prsNextCursor??void 0;return t||n?{issuesCursor:t,prsCursor:n,issuesDone:!t,prsDone:!n}:void 0},enabled:t,staleTime:6e4})}function Lu(e,t=!0){return M({queryKey:J.githubChecks(e),queryFn:({signal:t})=>Hr(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function Ru(e,t,n=!0){return M({queryKey:J.githubSearch(e,t),queryFn:({signal:n})=>Ur(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var zu=100;function Bu(e){return[...e].sort((e,t)=>t-e).slice(0,zu).sort((e,t)=>e-t)}var Z=new Map(Ku()),Vu=1e3;function Hu(e,t){if(Z.get(e)!==t){for(Z.delete(e),Z.set(e,t);Z.size>Vu;){let e=Z.keys().next().value;if(e===void 0)break;Z.delete(e)}Yu()}}var Q=new Set(qu());function Uu(e,t){if(Q.has(e)!==t){if(t)for(Q.add(e);Q.size>Vu;){let e=Q.values().next().value;if(e===void 0)break;Q.delete(e)}else Q.delete(e);Yu()}}var Wu=`cez.reference-statuses.v1`,Gu=`cez.reference-conflicts.v1`;function Ku(){try{let e=globalThis.sessionStorage?.getItem(Wu);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&ls(e[1])):[]}catch{return[]}}function qu(){try{let e=globalThis.sessionStorage?.getItem(Gu);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var Ju;function Yu(){Ju===void 0&&(Ju=setTimeout(()=>{Ju=void 0;try{globalThis.sessionStorage?.setItem(Wu,JSON.stringify([...Z])),globalThis.sessionStorage?.setItem(Gu,JSON.stringify([...Q]))}catch{}},250))}function Xu(){let e=Bt(),t=dl();return e.projectId??t.data?.bootProject}function Zu(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))Hu($({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))Hu($({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var Qu=5*6e4;function $u(e){return e?e.recheckAfterMs:Qu}var $=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function ed(e,t=!0){let n=(0,A.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{prs:new Set,issues:new Set};e[n.kind===`PR`?`prs`:`issues`].add(n.number),t.set(n.projectId,e)}return[...t.entries()].map(([e,t])=>({projectId:e,prs:Bu(t.prs),issues:Bu(t.issues)}))},[e.map($).sort().join(`|`)]),r=Ft({queries:n.map(e=>({queryKey:J.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>Wr(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>$u(e.state.data)??1/0,refetchInterval:e=>$u(e.state.data)??!1,refetchOnWindowFocus:!0}))}),{byRef:i,learned:a}=(0,A.useMemo)(()=>{let e=new Map,t=[];return r.forEach((r,i)=>{let a=n[i];if(!a)return;let o=[...a.prs.map(e=>({projectId:a.projectId,kind:`PR`,number:e})),...a.issues.map(e=>({projectId:a.projectId,kind:`Issue`,number:e}))],s=r.data;for(let n of o){let i=$(n),a=Z.get(i),o=Q.has(i)?!0:void 0;if(s?.available){let r=s.prs[n.number]??s.issues[n.number];if(r){let a=s.conflicts?s.conflicts.includes(n.number):void 0;t.push({key:i,status:r,conflicting:a}),e.set(i,{state:`ready`,status:r,...a??o?{conflicting:!0}:{}})}else e.set(i,{state:`unknown`,...a?{status:a}:{}})}else s?e.set(i,{state:`unavailable`,reason:s.reason,...a?{status:a}:{},...o?{conflicting:!0}:{}}):r.isError?e.set(i,{state:`unavailable`,reason:r.error instanceof Error?r.error.message:void 0,...a?{status:a}:{},...o?{conflicting:!0}:{}}):e.set(i,{state:`loading`,...a?{status:a}:{},...o?{conflicting:!0}:{}})}}),{byRef:e,learned:t}},[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,A.useEffect)(()=>{for(let{key:e,status:t,conflicting:n}of a)Hu(e,t),n!==void 0&&Uu(e,n)},[a]),(0,A.useCallback)(e=>{let t=$(e),n=i.get(t);if(n)return n;let r=Z.get(t);return{state:`idle`,...r?{status:r}:{},...Q.has(t)?{conflicting:!0}:{}}},[i])}function td(e,t,n=!0){return M({queryKey:J.githubComments(e,t),queryFn:({signal:n})=>Gr(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function nd(e){return M({queryKey:[`github`,`pr-changes`,e??0],queryFn:({signal:t})=>Jr(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{Vc as $,Un as $a,Jo as $i,ys as $n,Sa as $r,Dc as $t,cl as A,Or as Aa,Vr as Ai,Qs as An,Ee as Ao,Yi as Ar,Dl as At,Lc as B,la as Ba,qr as Bi,Ls as Bn,Na as Br,xu as Bt,Tc as C,Wn as Ca,ko as Ci,Vs as Cn,nt as Co,Di as Cr,kl as Ct,Lu as D,ri as Da,no as Di,cc as Dn,T as Do,wa as Dr,Pl as Dt,Fu as E,Ea,ao as Ei,ec as En,Se as Eo,R as Er,Fl as Et,dl as F,xa as Fa,Co as Fi,Ws as Fn,Re as Fo,Ro as Fr,X as Ft,hl as G,Ho as Ga,Wi as Gi,Is as Gn,Ra as Gr,yu as Gt,Eu as H,Eo as Ha,Ki as Hi,Es as Hn,Bi as Hr,hu as Ht,ul as I,ya as Ia,W as Ii,As as In,ve as Io,pa as Ir,gl as It,jl as J,ba as Ja,zi as Ji,Ts as Jn,Ni as Jr,lu as Jt,Cu as K,Po as Ka,vo as Ki,Ns as Kn,Wa as Kr,Vl as Kt,Al as L,Ei as La,ja as Li,K as Ln,b as Lo,vi as Lr,yl as Lt,nd as M,Cr as Ma,Ga as Mi,ac as Mn,S as Mo,Pi as Mr,Il as Mt,Ru as N,Ia as Na,Ba as Ni,tc as Nn,E as No,va as Nr,El as Nt,td as O,Da as Oa,Wo as Oi,Us as On,De as Oo,ro as Or,Cl as Ot,Nl as P,Ar as Pa,So as Pi,oc as Pn,C as Po,Yo as Pr,Mc as Pt,Cc as Q,xo as Qa,Aa as Qi,_s as Qn,Ma as Qr,Rl as Qt,Hl as R,ui as Ra,Mi as Ri,Ds as Rn,Li as Rr,_l as Rt,il as S,hr as Sa,Ko as Si,Hs as Sn,mt as So,Gn as Sr,xl as St,Hc as T,No as Ta,Fo as Ti,q as Tn,k as To,yi as Tr,wl as Tt,Du as U,xi as Ua,Ji as Ui,ws as Un,fa as Ur,gu as Ut,Ul as V,Nr as Va,En as Vi,ks as Vn,Oa as Vr,Zc as Vt,nl as W,Hi as Wa,qi as Wi,Fs as Wn,ua as Wr,ju as Wt,Sl as X,Ua as Xa,ga as Xi,ds as Xn,Xa as Xr,Ml as Xt,ml as Y,li as Ya,Ui as Yi,Ps as Yn,Za as Yr,Rc as Yt,vl as Z,Fa as Za,ca as Zi,ms as Zn,Ta as Zr,fu as Zt,rl as _,kr as _a,aa as _i,dc as _n,Lt as _o,Ri as _r,al as _t,bl as a,qo as aa,Gr as ai,Yc as an,sn as ao,cs as ar,ed as at,Mu as b,wr as ba,Zn as bi,Gs as bn,St as bo,Ti as br,Jl as bt,eu as c,po as ca,wn as ci,Bl as cn,Xt as co,rs as cr,_u as ct,au as d,zo as da,To as di,ru as dn,en as do,ts as dr,Wc as dt,Oo as ea,_a as ei,Oc as en,Bo as eo,G as er,Nc as et,Fc as f,jo as fa,Xn as fi,Ql as fn,nn as fo,is as fr,Pu as ft,Su as g,bo as ga,da as gi,uc as gn,Bt as go,Do as gr,Yl as gt,zc as h,rr as ha,vr as hi,xc as hn,Vt as ho,Qi as hr,Xl as ht,Zu as i,sa as ia,Zo as ii,$l as in,ln as io,bs as ir,Xu as it,ll as j,Ir as ja,zr as ji,Ys as jn,Te as jo,ci as jr,Tl as jt,Iu as k,$r as ka,xr as ki,lc as kn,Fe as ko,Lr as kr,Ll as kt,tu as l,Va as la,jn as li,iu as ln,qt as lo,ns as lr,Uc as lt,Au as m,go as ma,Uo as mi,wu as mn,zt as mo,F as mr,ql as mt,kc as n,Zi as na,Xo as ni,jc as nn,hn as no,vs as nr,nu as nt,Qc as o,On as oa,Jr as oi,Gc as on,on as oo,us as or,Pc as ot,bu as p,yo as pa,Lo as pi,Y as pn,tn as po,Qo as pr,Wl as pt,ku as q,V as qa,La as qi,Ms as qn,ka as qr,mu as qt,J as r,mo as ra,br as ri,Ac as rn,cn as ro,gs as rr,tl as rt,$c as s,za as sa,Kr as si,zl as sn,Ut as so,as as sr,vu as st,Sc as t,bi as ta,cr as ti,Ec as tn,Mo as to,hs as tr,sl as tt,ou as u,Hn as ua,wo as ui,wc as un,Yt as uo,os as ur,Xc as ut,Zl as v,_o as va,Qr as vi,zs as vn,N as vo,io as vr,Gl as vt,Nu as w,Vo as wa,Io as wi,Js as wn,Ge as wo,Ca as wr,Ol as wt,Jc as x,jr as xa,Qn as xi,Ks as xn,j as xo,Si as xr,Bc as xt,el as y,Vi as ya,Xi as yi,sc as yn,M as yo,Oi as yr,Kl as yt,ol as z,Go as za,ji as zi,js as zn,Ao as zr,su as zt};