@open-mercato/cezar 0.19.0 → 0.20.0-pr1372.4752
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contract/index.js +4 -1
- package/dist/contract/repo.d.ts +3 -1
- package/dist/git-worktree.d.ts +2 -1
- package/dist/git-worktree.js +7 -2
- package/dist/git-worktree.js.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/runs/retention.d.ts +9 -2
- package/dist/runs/retention.js +23 -4
- package/dist/runs/retention.js.map +1 -1
- package/dist/server/server.d.ts +12 -10
- package/dist/server/server.js +27 -2
- package/dist/server/server.js.map +1 -1
- package/dist/worktree-in-use.d.ts +25 -0
- package/dist/worktree-in-use.js +274 -0
- package/dist/worktree-in-use.js.map +1 -0
- package/dist/worktree-lifecycle/coordinator.js +4 -0
- package/dist/worktree-lifecycle/coordinator.js.map +1 -1
- package/package.json +3 -3
- package/web/dist/assets/{agent-task-pickers-C6pdeuHJ.js → agent-task-pickers-C0lbPIio.js} +1 -1
- package/web/dist/assets/{alert-dialog-DsAKVB9U.js → alert-dialog-D7_6EawW.js} +1 -1
- package/web/dist/assets/arrow-left-Ci5OwIMH.js +1 -0
- package/web/dist/assets/{arrow-up-DerG9eQK.js → arrow-up-Pd8kIuRY.js} +1 -1
- package/web/dist/assets/{assets-view-COAZvPqm.js → assets-view-Dig8Ow0W.js} +1 -1
- package/web/dist/assets/{automation-format-DmmN5Z7N.js → automation-format-MLNn8qnY.js} +1 -1
- package/web/dist/assets/{automations-route-C9h3Pe23.js → automations-route-B_hyZJ2Q.js} +1 -1
- package/web/dist/assets/{bot-tf6AC27f.js → bot-TU5OTE8D.js} +1 -1
- package/web/dist/assets/{button-DhBNRPDb.js → button-jcXhXi-5.js} +1 -1
- package/web/dist/assets/{centered-state-DWZ57Ha1.js → centered-state-zjxxQcEb.js} +1 -1
- package/web/dist/assets/check-CNVywZ6B.js +1 -0
- package/web/dist/assets/chevron-left-D94sZNQc.js +1 -0
- package/web/dist/assets/chevron-right-D2EqYt_O.js +1 -0
- package/web/dist/assets/circle-check-C09e7mFj.js +1 -0
- package/web/dist/assets/{collapsible-BXlCnxCU.js → collapsible-BGyXLTVv.js} +1 -1
- package/web/dist/assets/{commit-list-Inz2UHlC.js → commit-list-DxiIebKF.js} +1 -1
- package/web/dist/assets/{compare-variants-B66gT_Lp.js → compare-variants-RfJUgKZi.js} +1 -1
- package/web/dist/assets/{dashboard-DQ2EsruE.js → dashboard-CPnDqmbf.js} +1 -1
- package/web/dist/assets/{diff-NBMGWe9I.js → diff-DpElozOH.js} +2 -2
- package/web/dist/assets/{diff-stat-CgvKmRgV.js → diff-stat-YT7Licr1.js} +1 -1
- package/web/dist/assets/{diff-view-t0WQPrPT.js → diff-view-mNp6Fo84.js} +1 -1
- package/web/dist/assets/{dist-BJiHofth.js → dist-C2IyLYZs.js} +1 -1
- package/web/dist/assets/{download-CEvQNLNA.js → download-Cu9ySzL2.js} +1 -1
- package/web/dist/assets/{dropdown-menu-R7qzKuR5.js → dropdown-menu-Da8iP-nI.js} +1 -1
- package/web/dist/assets/{external-link-OzBGW2PE.js → external-link-CTJbUN9h.js} +1 -1
- package/web/dist/assets/{facet-filter-Qbx1pf2T.js → facet-filter-Be0XFoHu.js} +1 -1
- package/web/dist/assets/{file-fM0ty7CG.js → file-D9jm2sJ3.js} +1 -1
- package/web/dist/assets/{file-preview-vKAohITF.js → file-preview-BIAcYezC.js} +1 -1
- package/web/dist/assets/{file-tree-DZ2eXzpR.js → file-tree-hpaNl9qS.js} +1 -1
- package/web/dist/assets/{folder-DdjIxY7B.js → folder-Ctd1Xvqx.js} +1 -1
- package/web/dist/assets/{follow-up-engine-BSEbPKpI.js → follow-up-engine-WsUFV3Ry.js} +1 -1
- package/web/dist/assets/{git-pull-request-D2gvtstb.js → git-pull-request-BAfSEvVb.js} +1 -1
- package/web/dist/assets/{git-pull-request-draft-CLy0NzfX.js → git-pull-request-draft-BIgZJsu-.js} +1 -1
- package/web/dist/assets/{git-tab-loading-BfHswOkO.js → git-tab-loading-BnU4U-BA.js} +1 -1
- package/web/dist/assets/{github-3riSQ6Lm.js → github-DnDrPPfz.js} +1 -1
- package/web/dist/assets/{host-usage-7ZdPz-XK.js → host-usage-BeX2ZFmV.js} +1 -1
- package/web/dist/assets/{icon-tooltip-DWp0bFCr.js → icon-tooltip-BfI1AC00.js} +1 -1
- package/web/dist/assets/{impact-control-C6qnPF32.js → impact-control-Ba9XW3tV.js} +1 -1
- package/web/dist/assets/{impact-model-BXkk-8LD.js → impact-model-Bo4KSZmi.js} +1 -1
- package/web/dist/assets/{index-BJPVto-W.js → index-Crs_dvXc.js} +5 -5
- package/web/dist/assets/{input-Cv2-g500.js → input-vswZUfsf.js} +1 -1
- package/web/dist/assets/{layout-cards-rvwV0uTN.js → layout-cards-BxB9Sv6Z.js} +1 -1
- package/web/dist/assets/loader-circle-BuBcxAH7.js +1 -0
- package/web/dist/assets/{markdown-DpThfUoB.js → markdown--qN61YgZ.js} +1 -1
- package/web/dist/assets/{markdown-ugFgDUM5.js → markdown-BiRiR9OM.js} +1 -1
- package/web/dist/assets/{message-square-k8K2YFw2.js → message-square-Jt8U2gAH.js} +1 -1
- package/web/dist/assets/{picker-pill-DjKsq5S1.js → picker-pill-BFprBA9h.js} +1 -1
- package/web/dist/assets/plus-nGmv0BVG.js +1 -0
- package/web/dist/assets/{project-router-DXcbRXxc.js → project-router-ByYpf5zi.js} +1 -1
- package/web/dist/assets/{queries-DvnoUOE1.js → queries-DbDUaheq.js} +1 -1
- package/web/dist/assets/{reasoning-effort-pill-BtWN6FBA.js → reasoning-effort-pill-BMAjcAKk.js} +1 -1
- package/web/dist/assets/{repo-git-DQHghYiX.js → repo-git-CpbhUvyL.js} +1 -1
- package/web/dist/assets/{run-diff-CymNF6XN.js → run-diff-DTbhZHQE.js} +1 -1
- package/web/dist/assets/{save-A5Be1rcj.js → save-DGJET0jv.js} +1 -1
- package/web/dist/assets/{scroll-within-DIDO40Ps.js → scroll-within-sbc5xXAl.js} +1 -1
- package/web/dist/assets/search-P545ZVzc.js +1 -0
- package/web/dist/assets/{search-x-DHAJ1hHA.js → search-x-BI_L6x3P.js} +1 -1
- package/web/dist/assets/{settings-2-CT4CHpD0.js → settings-2-CcipoS54.js} +1 -1
- package/web/dist/assets/{sheet-D8vk1p4X.js → sheet-DJ7Q8rRA.js} +1 -1
- package/web/dist/assets/{skills-BAzH59kW.js → skills-DwnXdnzS.js} +1 -1
- package/web/dist/assets/{square-dKpVPAsQ.js → square-CuNOgYBC.js} +1 -1
- package/web/dist/assets/{tabs-B_vUNwk9.js → tabs-BCUQqEYa.js} +1 -1
- package/web/dist/assets/{tag-BWgO0bkB.js → tag-DHjatodA.js} +1 -1
- package/web/dist/assets/{task-commits-rj991QXb.js → task-commits-x21u_XE-.js} +1 -1
- package/web/dist/assets/{task-graph-VKJ_lfXL.js → task-graph-DdCE5G3r.js} +1 -1
- package/web/dist/assets/{task-notes-CyXwM1jJ.js → task-notes-C6RP3maE.js} +1 -1
- package/web/dist/assets/task-workspace-xnZHXFXk.js +29 -0
- package/web/dist/assets/terminal-ZT2Z_ALj.js +1 -0
- package/web/dist/assets/{terminal-drawer-BZItdxn-.js → terminal-drawer-Dm0kyMmF.js} +1 -1
- package/web/dist/assets/{terminal-pane-D4ZoQdKv.js → terminal-pane-CRjYeI78.js} +1 -1
- package/web/dist/assets/{textarea-DGt1COuN.js → textarea-Ckx3d0hV.js} +1 -1
- package/web/dist/assets/{toaster-DkOynrTr.js → toaster-CejrnYvv.js} +1 -1
- package/web/dist/assets/{token-metrics-CH6yTO0m.js → token-metrics-BINGXGrg.js} +1 -1
- package/web/dist/assets/{tooltip-DZFNJfGV.js → tooltip-26XdOGj8.js} +1 -1
- package/web/dist/assets/{tracker-CfV4FaME.js → tracker-BzXE6yLf.js} +1 -1
- package/web/dist/assets/{triangle-alert-DPgo0TAM.js → triangle-alert-CBrg6nYB.js} +1 -1
- package/web/dist/assets/{upload-CyWxzeww.js → upload-Cu6NRABh.js} +1 -1
- package/web/dist/assets/{use-now-p7SRpNs9.js → use-now-CdtIyF-0.js} +1 -1
- package/web/dist/assets/{use-submit-shortcut-DbaZm8p1.js → use-submit-shortcut-B3TJ3HBP.js} +1 -1
- package/web/dist/assets/{utils-DujIMO-J.js → utils-Bl_tQdVw.js} +1 -1
- package/web/dist/assets/{workflow-graph-Bi8UYX1n.js → workflow-graph-CkCPBwhB.js} +1 -1
- package/web/dist/assets/{worktree-lifecycle-operation-D7uIWIl_.js → worktree-lifecycle-operation-UpV9MAuk.js} +1 -1
- package/web/dist/assets/x-Qhn_uE86.js +1 -0
- package/web/dist/index.html +50 -50
- package/dist/telemetry-service.json +0 -1
- package/web/dist/assets/arrow-left-D773GDAV.js +0 -1
- package/web/dist/assets/check--JMF5pzG.js +0 -1
- package/web/dist/assets/chevron-left-BiwkBjqr.js +0 -1
- package/web/dist/assets/chevron-right-QEoLhwFQ.js +0 -1
- package/web/dist/assets/circle-check-C7cRTvGo.js +0 -1
- package/web/dist/assets/loader-circle-wWXhd3lT.js +0 -1
- package/web/dist/assets/plus-BCu7YC-w.js +0 -1
- package/web/dist/assets/search-_XntIRWA.js +0 -1
- package/web/dist/assets/task-workspace-BsOvp8_P.js +0 -29
- package/web/dist/assets/terminal-De3oF9fR.js +0 -1
- package/web/dist/assets/x-BzTqCf_Q.js +0 -1
|
@@ -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,Ct as i,Et as a,Mt as o,Ot as s,Q as c,Z as l,_ as u,a as d,c as f,d as p,h as m,i as h,jt as ee,l as g,o as te,rt as ne,s as _,st as v,v as re,wt as ie}from"./utils-DujIMO-J.js";var ae=/^[\w!#$%&'*.^`|~+-]+$/,oe=(e,t,n={})=>{if(!ae.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},se=(e,t,n)=>(t=encodeURIComponent(t),oe(e,t,n)),ce=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),le=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??`);e=e.replace(t,r?`/${r}`:``)}return e},ue=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},de=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},fe=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pe(e,t){if(!y(e)&&!y(t))return t;let n={...e};for(let e in t){let r=t[e];y(n[e])&&y(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(se(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=fe(a),a=le(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??ue,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=ce(e,a.join(`/`));if(s===`url`||s===`path`){let t=c;return r.args[0]&&(r.args[0].param&&(t=le(c,r.args[0].param)),r.args[0].query&&(t=t+`?`+i(r.args[0].query).toString())),t=fe(t),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=de(r.args[0]&&r.args[0].param?le(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(!Oe(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(!Oe(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)=>Me(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Oe(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Oe(e[n],t[n])):!1}var ke=Object.prototype.hasOwnProperty;function Ae(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=je(e)&&je(t);if(!r&&!(Me(e)&&Me(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:ke.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Ae(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function E(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 je(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Me(e){if(!Ne(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Ne(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Ne(e){return Object.prototype.toString.call(e)===`[object Object]`}function Pe(e){return new Promise(t=>{x.setTimeout(t,e)})}function Fe(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Ae(e,t)}function Ie(e){return e}function Le(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Re(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ze=Symbol();function Be(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ze?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ve(e,t){return typeof e==`function`?e(...t):!!e}function He(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 D=(()=>{let e=()=>xe;return{isServer(){return e()},setIsServer(t){e=t}}})();function Ue(){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 We=be;function Ge(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=We,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 O=Ge(),Ke=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 qe(e){return Math.min(1e3*2**e,3e4)}function Je(e){return(e??`online`)!==`online`||Ke.isOnline()}var Ye=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Xe(e){let t=!1,n=0,r,i=Ue(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Ye(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>ve.isFocused()&&(e.networkMode===`always`||Ke.isOnline())&&e.canRun(),u=()=>Je(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??(D.isServer()?0:3),o=e.retryDelay??qe,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),Pe(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 Ze=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??(D.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(x.clearTimeout(this.#e),this.#e=void 0)}};function Qe(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=>{He(e,()=>t.signal,()=>n=!0)},u=Be(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?Re:Le;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?et:$e,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:$e(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 $e(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 et(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function tt(e,t){return t?$e(e,t)!=null:!1}function nt(e,t){return!t||!e.getPreviousPageParam?!1:et(e,t)!=null}var rt=class extends Ze{#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=ot(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=ot(this.options);e.data!==void 0&&(this.setState(at(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Fe(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===ze||!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=Be(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`?Qe(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=Xe({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Ye&&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 Ye){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,...it(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...at(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),O.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function it(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Je(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function at(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function ot(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 st=class extends b{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Ue(),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),lt(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ut(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ut(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&&!E(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&dt(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 pt(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(D.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,!(D.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&<(e,t),o=i&&dt(e,n,t,r);(a||o)&&(l={...l,...it(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=Fe(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=Fe(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 ee=l.fetchStatus===`fetching`,g=m===`pending`,te=m===`error`,ne=g&&ee,_=d!==void 0,v={status:m,fetchStatus:l.fetchStatus,isPending:g,isSuccess:m===`success`,isError:te,isInitialLoading:ne,isLoading:ne,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:ee,isRefetching:ee&&!g,isLoadingError:te&&!_,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:te&&_,isStale:ft(e,t),refetch:this.refetch,promise:this.#o,isEnabled:w(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=v.data!==void 0,r=v.status===`error`&&!t,i=e=>{r?e.reject(v.error):t&&e.resolve(v.data)},a=()=>{let e=this.#o=v.promise=Ue();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||v.data!==o.value)&&a();break;case`rejected`:(!r||v.error!==o.reason)&&a();break}}return v}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),!E(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){O.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function ct(e,t){return w(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&w(t.retryOnMount,e)===!1)}function lt(e,t){return ct(e,t)||e.state.data!==void 0&&ut(e,t,t.refetchOnMount)}function ut(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&&ft(e,t)}return!1}function dt(e,t,n,r){return(e!==t||w(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ft(e,n)}function ft(e,t){return w(t.enabled,e)!==!1&&e.isStaleByTime(C(t.staleTime,e))}function pt(e,t){return!E(e.getCurrentResult(),t)}var mt=class extends st{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:tt(t,n.data),hasPreviousPage:nt(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},ht=class extends Ze{#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||gt(),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=Xe({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),O.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function gt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var _t=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),E(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??gt();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){O.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 vt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function yt(e,t,n){let r=e.slice(0);return r[t]=n,r}var bt=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,O.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||!E(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(vt(e,n).forEach(e=>{e.destroy()}),vt(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=Ae(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 st(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=yt(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)&&O.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},k=e(t(),1),xt=n(),St=k.createContext(void 0),A=e=>{let t=k.useContext(St);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Ct=({client:e,children:t})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,xt.jsx)(St.Provider,{value:e,children:t})),wt=k.createContext(!1),Tt=()=>k.useContext(wt);wt.Provider;function Et(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Dt=k.createContext(Et()),Ot=()=>k.useContext(Dt),kt=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Ve(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},At=e=>{k.useEffect(()=>{e.clearReset()},[e])},jt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Ve(n,[e.error,r])),Mt=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))}},Nt=(e,t)=>e.isLoading&&e.isFetching&&!t,Pt=(e,t)=>e?.suspense&&t.isPending,Ft=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function It({queries:e,...t},n){let r=A(n),i=Tt(),a=Ot(),o=k.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{Mt(e);let t=r.getQueryCache().get(e.queryHash);kt(e,a,t)}),At(a);let[s]=k.useState(()=>new bt(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;k.useSyncExternalStore(k.useCallback(e=>d?s.subscribe(O.batchCalls(e)):S,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),k.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>Pt(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&Pt(n,e)?Ft(n,new st(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&jt({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 Lt(e,t,n){let r=Tt(),i=Ot(),a=A(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,Mt(o),kt(o,i,s),At(i);let l=!a.getQueryCache().get(o.queryHash),[u]=k.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(k.useSyncExternalStore(k.useCallback(e=>{let t=f?u.subscribe(O.batchCalls(e)):S;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),k.useEffect(()=>{u.setOptions(o)},[o,u]),Pt(o,d))throw Ft(o,u,i);if(jt({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&&!D.isServer()&&Nt(d,r)&&(l?Ft(o,u,i):s?.promise)?.catch(S).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function j(e,t){return Lt(e,st,t)}function M(e,t){let n=A(t),[r]=k.useState(()=>new _t(n,e));k.useEffect(()=>{r.setOptions(e)},[r,e]);let i=k.useSyncExternalStore(k.useCallback(e=>r.subscribe(O.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=k.useCallback((e,t)=>{r.mutate(e,t).catch(S)},[r]);if(i.error&&Ve(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function N(e,t){return Lt(e,mt,t)}var Rt={projectId:null,apiBase:h},zt=(0,k.createContext)(Rt);function Bt(){return(0,k.useContext)(zt)}function Vt({projectId:e,children:t}){_()!==e&&p(e),(0,k.useLayoutEffect)(()=>{p(e)},[e]),(0,k.useLayoutEffect)(()=>()=>p(null),[]);let n=(0,k.useMemo)(()=>e===null?Rt:{projectId:e,apiBase:`${h}/p/${encodeURIComponent(e)}`},[e]);return(0,xt.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},P=[...s].sort((e,t)=>Ht[e]-Ht[t]),Ut=new Set([`connected`,`disconnected`,`not-installed`,`unknown`]);function Wt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Gt(e,t){if(!Wt(e))return null;let{provider:n,status:r,enabled:i,hint:a,authFailureId:o}=e;return typeof n!=`string`||!P.includes(n)||typeof r!=`string`||!Ut.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 Kt(e){return Gt(e,!1)}function qt(e,t){if(!Wt(e)||!Array.isArray(e.providers))return null;let n=[],r=new Set;for(let i of e.providers){let e=Gt(i,t);if(e===null||r.has(e.provider))return null;r.add(e.provider),n.push(e)}return n}function F(e){let t=qt(e,!0);if(t===null||t.length===0)return null;let n=new Map(t.map(e=>[e.provider,e]));return P.flatMap(e=>{let t=n.get(e);return t?[t]:[]})}function I(e){let t=F(e);if(t===null)throw Error(`Invalid provider status response`);return{providers:t}}function Jt(e,t){let n=F(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 Yt(e,t,n,r){let i=F(e),a=F(t),o=F(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:Xt(t,n)?e:i?{...e,enabled:n.enabled}:n})}}function Xt(e,t){return e.provider===t.provider&&e.status===t.status&&e.enabled===t.enabled&&e.hint===t.hint&&e.authFailureId===t.authFailureId}var Zt=new Set([`junie`,`antigravity`,`omp`]);function Qt(e){return e.status===`connected`||e.status===`unknown`&&Zt.has(e.provider)}function $t(e){let t=F(e);if(t===null)return[];let n=new Set(t.filter(e=>e.enabled&&Qt(e)).map(e=>e.provider));return P.filter(e=>n.has(e))}function en(e,t){return F(e)?.find(e=>e.provider===t)}var tn=`cezar:sid`,nn;function rn(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 an(){try{let e=localStorage.getItem(tn);if(e)return e;let t=rn();return localStorage.setItem(tn,t),t}catch{return nn??=rn()}}var on=`x-cezar-sid`;function sn(){nn=void 0;try{localStorage.removeItem(tn)}catch{}}function cn(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 ln=/\/(?:providers|agent-profiles)(?:\/|$)/;function un(e,t){if(!ln.test(e))return;let n=e.split(`/`),r=n[n.indexOf(`providers`)+1];if(n.includes(`providers`)&&l.safeParse(r).success)return r;if(typeof t==`string`)try{let e=JSON.parse(t).provider;return l.safeParse(e).success?e:void 0}catch{return}}var dn=null;function fn(e,t,n,r,i){try{let a=new URL(e,window.location.origin).pathname,o=un(a,r),s=cn(i);dn={method:(t??`GET`).toUpperCase(),path:a,status:n,at:Date.now(),...o?{provider:o}:{},...s?{cause:s}:{}}}catch{}}function pn(e=3e3,t=Date.now()){return dn&&t-dn.at<=e?dn:null}var L=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 R(e){try{return JSON.parse(e)}catch{return}}function mn(e){return typeof e==`string`?e:void 0}var hn=`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 z(e,t,n){let r=R(n),i=r&&typeof r==`object`?r:{},a=mn(i.error)??(e===413?hn:`${e} ${t||`request failed`}`.trim()),o=e===409?m.safeParse(r):void 0;return new L(e,a,{...o?.success?{runIds:o.data.runIds}:{},manual:mn(i.manual),command:mn(i.command),exists:typeof i.exists==`boolean`?i.exists:void 0})}var B=_e({fetch:(e,t)=>yn(gn(String(e)),t)});function gn(e){let t=vn(e.endsWith(`?`)?e.slice(0,-1):e);return t.startsWith(`/`)?`${te()}${t}`:t}var _n=`${h}/p/default`;function vn(e){if(_()!==null||!e.startsWith(_n))return e;let t=e.slice(_n.length);return t===``||t.startsWith(`/`)||t.startsWith(`?`)?`${h}${t}`:e}var V=e=>({init:{signal:e?.signal}});async function H(e){try{return await e.text()}catch(t){throw t instanceof DOMException&&t.name===`AbortError`?t:(fn(e.url,void 0,0,void 0,t),new L(0,`cannot reach the cezar server (${e.url})`,{cause:t}))}}async function U(e,t){let n=await H(e);if(!e.ok)throw z(e.status,e.statusText,n);let r=R(n);if(r===void 0)throw new L(e.status,`the cezar server answered ${t} with a non-JSON body`);return r}async function W(e,t,n){let r=e.status,i=await U(e,t),a=n.safeParse(i);if(!a.success)throw new L(r,`the cezar server answered ${t} with an unexpected body`);return a.data}async function yn(e,t){try{let n=new Headers(t?.headers);n.set(on,an());let r=await fetch(e,{...t,headers:n,credentials:`include`});return r.ok||fn(e,t?.method,r.status,t?.body),r}catch(n){throw n instanceof DOMException&&n.name===`AbortError`?n:(fn(e,t?.method,0,t?.body,n),new L(0,`cannot reach the cezar server (${e})`,{cause:n}))}}async function bn(e,t){return yn(d(e),t)}async function xn(e,t={}){let n=new Headers(t.headers);n.set(`accept`,`text/plain`);let r=await bn(e,{...t,headers:n}),i=await H(r);if(!r.ok)throw z(r.status,r.statusText,i);return i}var G=(e,t=``)=>`/runs/${encodeURIComponent(e)}${t}`;async function Sn(e){return U(await B.api.v1.health.$get({},V(e)),`/health`)}async function Cn(e){return U(await B.api.v1[`star-count`].$get({},V(e)),`/star-count`)}async function wn(e){return U(await B.api.v1.preview[`design-proxy`].$post({json:e}),`/preview/design-proxy`)}async function Tn(e){return U(await B.api.v1.telemetry.consent.$get({},V(e)),`/telemetry/consent`)}async function En(e){return U(await B.api.v1.telemetry.consent.$put({json:e}),`/telemetry/consent`)}async function Dn(e,t){return U(await B.api.v1.models.$get({query:{runner:e}},V(t)),`/models`)}async function On(e=!1,t){return I(await U(await B.api.v1.providers.status.$get({query:e?{refresh:`1`}:{}},V(t)),`/providers/status`))}async function kn(e){return U(await B.api.v1.p[`:projectId`][`launch-key`].$get({param:{projectId:f()}},V(e)),`/launch-key`)}async function An(e){return U(await B.api.v1.projects.$get({},V(e)),`/projects`)}async function jn(e,t){return U(await B.api.v1.fs.browse.$get({query:{path:e===``?void 0:e,...t?.showHidden?{showHidden:`1`}:{}}},V(t)),`/fs/browse`)}async function Mn(e){return U(await B.api.v1.fs.repos.$get({},V(e)),`/fs/repos`)}async function Nn(e){return U(await B.api.v1.projects[`:projectId`][`git-init`].$post({param:{projectId:encodeURIComponent(e)}}),`/projects/${encodeURIComponent(e)}/git-init`)}async function Pn(e,t){return U(await B.api.v1.projects[`:projectId`][`publish-github`].$post({param:{projectId:encodeURIComponent(e)},json:t}),`/projects/${encodeURIComponent(e)}/publish-github`)}async function Fn(){return U(await B.api.v1.github.login.$post(),`/github/login`)}async function In(e){return U(await B.api.v1.github.login.$get({},V(e)),`/github/login`)}async function Ln(){return U(await B.api.v1.github.login.$delete(),`/github/login`)}async function Rn(e){return U(await B.api.v1.providers.setup.$get({},V(e)),`/providers/setup`)}async function zn(e,t){return U(await B.api.v1.providers.setup.sessions.$post({json:{provider:e,action:t}}),`/providers/setup/sessions`)}async function Bn(e,t){return U(await B.api.v1.providers.setup.sessions[`:sessionId`].output.$get({param:{sessionId:e},query:{cursor:String(t)}}),`/providers/setup/sessions/${e}/output`)}async function Vn(e,t){await U(await B.api.v1.providers.setup.sessions[`:sessionId`].input.$post({param:{sessionId:e},json:{data:t}}),`/providers/setup/sessions/${e}/input`)}async function Hn(e,t,n){await U(await B.api.v1.providers.setup.sessions[`:sessionId`].resize.$post({param:{sessionId:e},json:{cols:t,rows:n}}),`/providers/setup/sessions/${e}/resize`)}async function Un(e){await U(await B.api.v1.providers.setup.sessions[`:sessionId`].$delete({param:{sessionId:e}}),`/providers/setup/sessions/${e}`)}async function Wn(e){return U(await B.api.v1.p[`:projectId`].runs.$get({param:{projectId:f()},query:{}},V(e)),`/runs`)}async function Gn(e,t){return U(await B.api.v1.p[`:projectId`].runs.$get({param:{projectId:e},query:{}},V(t)),`/runs`)}async function Kn(e){return U(await B.api.v1.workspace[`runs-index`].$get({},V(e)),`/workspace/runs-index`)}async function qn(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:f(),id:encodeURIComponent(e)}},V(t)),G(e))}async function Jn(e,t,n){return U(await B.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:e,id:encodeURIComponent(t)}},V(n)),G(t))}async function Yn(e,t,n){return W(await B.api.v1.p[`:projectId`].runs[`:id`].history.$get({param:{projectId:f(),id:encodeURIComponent(e)},query:{...t===void 0?{}:{cursor:t}}},V(n)),`${G(e)}/history`,o)}async function Xn(e,t){return W(await B.api.v1.p[`:projectId`].runs[`:id`][`history-context`].$get({param:{projectId:f(),id:encodeURIComponent(e)}},V(t)),`${G(e)}/history-context`,ee)}async function Zn(e){return U(await B.api.v1.p[`:projectId`][`ui-state`].$get({param:{projectId:f()}},V(e)),`/ui-state`)}async function Qn(e){return U(await B.api.v1.p[`:projectId`].workflows.$get({param:{projectId:f()}},V(e)),`/workflows`)}async function $n(e){return U(await B.api.v1.p[`:projectId`].skills.$get({param:{projectId:f()},query:{}},V(e)),`/skills`)}async function er(e){return U(await B.api.v1.p[`:projectId`].skills.$get({param:{projectId:f()},query:{wait:`1`}},V(e)),`/skills`)}async function tr(){return U(await B.api.v1.p[`:projectId`].skills.refresh.$post({param:{projectId:f()}}),`/skills/refresh`)}async function nr(e){return U(await B.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:f()},query:{}},V(e)),`/skills/importable`)}async function rr(e){return U(await B.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:f()},query:{wait:`1`}},V(e)),`/skills/importable`)}async function ir(e){return U(await B.api.v1.p[`:projectId`].todos.$get({param:{projectId:f()}},V(e)),`/todos`)}async function ar(e){return U(await B.api.v1.p[`:projectId`].repo.$get({param:{projectId:f()}},V(e)),`/repo`)}async function or(e){return U(await B.api.v1.p[`:projectId`].config.$get({param:{projectId:f()}},V(e)),`/config`)}async function sr(e={}){return U(await B.api.v1.p[`:projectId`][`agent-config`].$get({param:{projectId:f()}},V(e)),`/agent-config`)}async function cr(e,t={}){return U(await B.api.v1.p[`:projectId`][`agent-config`][`:id`].$get({param:{projectId:f(),id:encodeURIComponent(e)}},V(t)),`/agent-config/${encodeURIComponent(e)}`)}async function lr(e,t){return U(await B.api.v1.p[`:projectId`][`agent-config`][`:id`].$put({param:{projectId:f(),id:encodeURIComponent(e)},json:t}),`/agent-config/${encodeURIComponent(e)}`)}async function ur(e){return U(await B.api.v1.p[`:projectId`].repo.changes.$get({param:{projectId:f()}},V(e)),`/repo/changes`)}async function dr(e){return U(await B.api.v1.p[`:projectId`].repo.tree.$get({param:{projectId:f()}},V(e)),`/repo/tree`)}async function fr(e,t){return U(await B.api.v1.p[`:projectId`].repo.files.$get({param:{projectId:f()},query:{path:e}},V(t)),`/repo/files`)}function pr(e){return d(`/repo/files?path=${encodeURIComponent(e)}&raw=1`)}async function mr(e,t){return U(await B.api.v1.p[`:projectId`].repo.commit[`:sha`].$get({param:{projectId:f(),sha:encodeURIComponent(e)},query:{structured:`1`}},V(t)),`/repo/commit/:sha`)}async function hr(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`].tree.$get({param:{projectId:f(),id:encodeURIComponent(e)}},V(t)),G(e,`/tree`))}async function gr(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`].commits.$get({param:{projectId:f(),id:encodeURIComponent(e)}},V(t)),G(e,`/commits`))}async function _r(e,t,n){return U(await B.api.v1.p[`:projectId`].runs[`:id`].commit[`:sha`].$get({param:{projectId:f(),id:encodeURIComponent(e),sha:encodeURIComponent(t)}},V(n)),G(e,`/commit/${encodeURIComponent(t)}`))}async function vr(e={},t){return U(await B.api.v1.p[`:projectId`].github.$get({param:{projectId:f()},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}},V(t)),`/github`)}async function yr(e={},t){return U(await B.api.v1.p[`:projectId`].tracker[`automation-options`].$get({param:{projectId:f()},query:e},V(t)),`/tracker/automation-options`)}async function br(e){return U(await B.api.v1.p[`:projectId`].tracker.connection.$get({param:{projectId:f()}},V(e)),`/tracker/connection`)}async function xr(e){return U(await B.api.v1.p[`:projectId`].tracker.connection.$put({param:{projectId:f()},json:e}),`/tracker/connection`)}async function Sr(){return U(await B.api.v1.p[`:projectId`].tracker.connection.$delete({param:{projectId:f()}}),`/tracker/connection`)}async function Cr(e){return U(await B.api.v1.p[`:projectId`].secrets.$get({param:{projectId:f()}},V(e)),`/secrets`)}async function wr(e){return U(await B.api.v1.workspace.secrets.$get({},V(e)),`/workspace/secrets`)}async function Tr(e){if(!e.ok)throw z(e.status,e.statusText,await H(e))}async function Er(e,t){await Tr(await B.api.v1.p[`:projectId`].secrets[`:name`].$put({param:{projectId:f(),name:e},json:t}))}async function Dr(e){await Tr(await B.api.v1.p[`:projectId`].secrets[`:name`].$delete({param:{projectId:f(),name:e}}))}async function Or(e,t){await Tr(await B.api.v1.workspace.secrets[`:name`].$put({param:{name:e},json:t}))}async function kr(e){await Tr(await B.api.v1.workspace.secrets[`:name`].$delete({param:{name:e}}))}async function Ar(e){return U(await B.api.v1.p[`:projectId`].e2e.$get({param:{projectId:f()}},V(e)),`/e2e`)}async function jr(e){return U(await B.api.v1.p[`:projectId`].e2e.setup.$post({param:{projectId:f()},json:e}),`/e2e/setup`)}async function Mr(e){return U(await B.api.v1.p[`:projectId`].tracker.association.$get({param:{projectId:f()}},V(e)),`/tracker/association`)}async function Nr(e,t={},n){return U(await B.api.v1.p[`:projectId`].tracker.candidates.$get({param:{projectId:f()},query:{kind:e,q:t.q,cursor:t.cursor,limit:t.limit===void 0?void 0:String(t.limit)}},V(n)),`/tracker/candidates`)}async function Pr(e){return U(await B.api.v1.p[`:projectId`].tracker.association.$put({param:{projectId:f()},json:e}),`/tracker/association`)}async function Fr(){return U(await B.api.v1.p[`:projectId`].tracker.association.$delete({param:{projectId:f()}}),`/tracker/association`)}function Ir(e){return{expectedScope:e.association?i(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 Lr(e={},t){return U(await B.api.v1.p[`:projectId`].tracker.$get({param:{projectId:f()},query:Ir(e)},V(t)),`/tracker`)}async function Rr(e,t={},n){return U(await B.api.v1.p[`:projectId`].tracker.search.$get({param:{projectId:f()},query:{...Ir(t),q:e}},V(n)),`/tracker/search`)}async function zr(e,t){return U(await B.api.v1.p[`:projectId`].tracker[`:id`].$get({param:{projectId:f(),id:encodeURIComponent(e)},query:{expectedScope:t?.association?i(t.association):void 0}},V(t)),`/tracker/${encodeURIComponent(e)}`)}async function Br(e,t){return U(await B.api.v1.p[`:projectId`].github.checks.$get({param:{projectId:f()},query:{prs:e.join(`,`)}},V(t)),`/github/checks`)}async function Vr(e,t,n={},r){return U(await B.api.v1.p[`:projectId`].github.search.$get({param:{projectId:f()},query:{kind:e,q:t,limit:n.limit}},V(r)),`/github/search`)}async function Hr(e,t,n){return U(await B.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(`,`)}:{}}},V(n)),`/github/ref-status`)}async function Ur(e,t,n={},r){return U(await B.api.v1.p[`:projectId`].github.comments[`:kind`][`:number`].$get({param:{projectId:f(),kind:e,number:String(t)},query:{refresh:n.refresh?`1`:void 0}},V(r)),`/github/comments/${e}/${t}`)}async function Wr(e,t={},n){return U(await B.api.v1.p[`:projectId`].github.prs[`:number`][`merge-state`].$get({param:{projectId:f(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},V(n)),`/github/prs/${e}/merge-state`)}async function Gr(e,t){return U(await B.api.v1.p[`:projectId`].github.prs[`:number`].merge.$post({param:{projectId:f(),number:String(e)},json:t}),`/github/prs/:number/merge`)}async function Kr(e,t={},n){return U(await B.api.v1.p[`:projectId`].github.prs[`:number`].changes.$get({param:{projectId:f(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},V(n)),`/github/prs/${e}/changes`)}function qr(e,t){return xn(G(e,`/diff`),{method:`GET`,signal:t?.signal})}function Jr(e,t){return xn(G(e,`/handoff`),{method:`GET`,signal:t?.signal})}async function Yr(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`].changes.$get({param:{projectId:f(),id:encodeURIComponent(e)}},V(t)),G(e,`/changes`))}async function Xr(e,t,n){return U(await B.api.v1.p[`:projectId`].runs[`:id`].files.$get({param:{projectId:f(),id:encodeURIComponent(e)},query:{path:t}},V(n)),`/runs/:id/files`)}function Zr(e,t,n){let r=n?`&rev=${encodeURIComponent(n)}`:``;return d(G(e,`/files?path=${encodeURIComponent(t)}&raw=1${r}`))}async function Qr(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`].artifacts.$get({param:{projectId:f(),id:encodeURIComponent(e)}},V(t)),G(e,`/artifacts`))}function $r(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}function ei(e,t,n){return xn(G(e,`/artifacts/${$r(t)}`),{method:`GET`,signal:n?.signal})}function ti(e,t,n){let r=n===void 0?``:`?v=${n}`;return d(G(e,`/artifacts/${$r(t)}${r}`))}function ni(e){return e.kind===`pr`?`pr:${e.number}`:`spec:${e.path}`}async function ri(e){return U(await B.api.v1.p[`:projectId`].impact.$post({param:{projectId:f()},json:e}),`/impact`)}async function ii(e,t){let n=ni(e);return W(await B.api.v1.p[`:projectId`].artifacts.$get({param:{projectId:f()},query:{subject:n}},V(t)),`/artifacts?subject=${encodeURIComponent(n)}`,re)}async function ai(e){return W(await B.api.v1.p[`:projectId`].assets.$get({param:{projectId:f()}},V(e)),`/assets`,u)}async function oi(e,t){return U(await B.api.v1.p[`:projectId`].groups[`:groupId`].$get({param:{projectId:f(),groupId:encodeURIComponent(e)}},V(t)),`/groups/${encodeURIComponent(e)}`)}async function si(e,t){return U(await B.api.v1.providers.connect.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/connect`)}async function ci(e){return U(await B.api.v1.providers[`:provider`].update.$post({param:{provider:e}}),`/providers/${encodeURIComponent(e)}/update`)}async function li(e,t){return I(await U(await B.api.v1.providers[`:provider`].enabled.$put({param:{provider:e},json:{enabled:t}}),`/providers/${encodeURIComponent(e)}/enabled`))}async function ui(e,t){return I(await U(await B.api.v1.providers[`:provider`].retry.$post({param:{provider:e},json:{authFailureId:t}}),`/providers/${encodeURIComponent(e)}/retry`))}async function di(e){let t=`/projects`,n=await bn(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({root:e})}),r=await H(n),i=R(r),a=i?.project;if((n.ok||n.status===409)&&a!=null)return i;throw n.ok?new L(n.status,`the cezar server answered ${t} without a project`):z(n.status,n.statusText,r)}async function fi(e){return U(await B.api.v1.projects.checkout.$post({json:e}),`/projects/checkout`)}async function pi(e){return U(await B.api.v1.projects.create.$post({json:e}),`/projects/create`)}async function mi(e){return W(await B.api.v1.projects[`github-owners`].$get({},V(e)),`/projects/github-owners`,ne)}async function hi(e){return U(await B.api.v1.projects[`:projectId`].$delete({param:{projectId:encodeURIComponent(e)}}),`/projects/${encodeURIComponent(e)}`)}async function gi(e,t){return U(await B.api.v1.projects[`:projectId`].$patch({param:{projectId:encodeURIComponent(e)},json:t}),`/projects/${encodeURIComponent(e)}`)}async function _i(e){return U(await B.api.v1.p[`:projectId`].runs.$post({param:{projectId:f()},json:e}),`/runs`)}async function vi(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].cancel.$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/cancel`))}async function yi(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].promote.$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/promote`))}async function bi(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`][`start-now`].$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/start-now`))}async function xi(e,t=!0,n){return U(await B.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:f(),id:encodeURIComponent(e)},json:{archived:t,...n?{surface:n}:{}}}),G(e,`/archive`))}async function Si(e,t=!0,n){return U(await B.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:f(),id:encodeURIComponent(e)},json:{pinned:t,...n?{surface:n}:{}}}),G(e,`/pin`))}async function Ci(e,t,n=!0,r){return U(await B.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{pinned:n,...r?{surface:r}:{}}}),G(t,`/pin`))}async function wi(e,t,n=!0,r){return U(await B.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{archived:n,...r?{surface:r}:{}}}),G(t,`/archive`))}async function Ti(e,t,n){let r=n?`read`:`unread`;return U(await(n?B.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:e,id:encodeURIComponent(t)}}):B.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:e,id:encodeURIComponent(t)}})),G(t,`/${r}`))}async function Ei(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`][`auto-resume`].$delete({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/auto-resume`))}async function Di(){return U(await B.api.v1.p[`:projectId`].runs[`archive-finished`].$post({param:{projectId:f()}}),`/runs/archive-finished`)}async function Oi(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/read`))}async function ki(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/unread`))}async function Ai(){return U(await B.api.v1.p[`:projectId`].runs[`read-all`].$post({param:{projectId:f()}}),`/runs/read-all`)}async function ji(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].land.$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/land`))}async function Mi(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].finish.$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/finish`))}async function Ni(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 U(await B.api.v1.p[`:projectId`].runs[`:id`].continue.$post({param:{projectId:f(),id:encodeURIComponent(e)},json:n}),G(e,`/continue`))}async function Pi(e,t,n={}){return U(await B.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}}}),G(t,`/continue`))}var Fi=1e3;async function Ii(e,t={}){let n=f(),r=async()=>U(await B.api.v1.p[`:projectId`].runs[`:id`].pr.$post({param:{projectId:n,id:encodeURIComponent(e)},json:t}),G(e,`/pr`));try{return await r()}catch(e){if(!(e instanceof L)||e.status!==0)throw e;await new Promise(e=>setTimeout(e,Fi));try{return await r()}catch(t){throw t instanceof L&&t.status===0?e:t}}}async function Li(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].pr.adopt.$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/pr/adopt`))}async function Ri(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`].$patch({param:{projectId:f(),id:encodeURIComponent(e)},json:t}),G(e))}async function zi(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].$delete({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e))}async function Bi(e){return U(await B.api.v1.p[`:projectId`].todos[`:id`].$delete({param:{projectId:f(),id:encodeURIComponent(e)}}),`/todos/${encodeURIComponent(e)}`)}async function Vi(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 U(await B.api.v1.p[`:projectId`].todos[`:id`].start.$post({param:{projectId:f(),id:encodeURIComponent(e)},json:Object.keys(n).length>0?n:void 0}),`/todos/${encodeURIComponent(e)}/start`)}async function Hi(e,t){return U(await B.api.v1.p[`:projectId`].groups[`:groupId`].pick.$post({param:{projectId:f(),groupId:encodeURIComponent(e)},json:{runId:t}}),`/groups/${encodeURIComponent(e)}/pick`)}async function Ui(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`][`open-in-cli`].$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/open-in-cli`))}async function Wi(e){return U(await B.api.v1.p[`:projectId`][`open-targets`].$get({param:{projectId:f()}},V(e)),`/open-targets`)}async function Gi(e){return U(await B.api.v1.p[`:projectId`][`open-in`].$post({param:{projectId:f()},json:{target:e}}),`/open-in`)}async function Ki(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:f(),id:encodeURIComponent(e)},json:{target:t}}),G(e,`/open-in`))}async function qi(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:f(),id:encodeURIComponent(e)},json:{target:`default`,path:t}}),G(e,`/open-in`))}async function Ji(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`].git.commit.$post({param:{projectId:f(),id:encodeURIComponent(e)},json:{message:t}}),G(e,`/git/commit`))}async function Yi(e,t,n=f()){return U(await B.api.v1.p[`:projectId`].runs[`:id`].git.status.$get({param:{projectId:n,id:encodeURIComponent(e)}},V(t)),G(e,`/git/status`))}async function Xi(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].git.push.$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/git/push`))}var Zi=[250,750,1500],Qi=e=>new Promise(t=>setTimeout(t,e));async function $i(e,t,n=Qi){let r={text:t.text??``,images:t.images??[],idempotencyKey:t.idempotencyKey??rn()};for(let t=0;;t+=1)try{return await e(r)}catch(e){let r=Zi[t];if(!(e instanceof L)||e.status!==0||r===void 0)throw e;await n(r)}}async function ea(e,t){return $i(async t=>U(await B.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:f(),id:encodeURIComponent(e)},json:t}),G(e,`/messages`)),t)}async function ta(e,t,n){return $i(async n=>U(await B.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:e,id:encodeURIComponent(t)},json:n}),G(t,`/messages`)),n)}async function na(e,t,n){return U(await B.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$patch({param:{projectId:f(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)},json:n}),G(e,`/queued-messages/${encodeURIComponent(t)}`))}async function ra(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$delete({param:{projectId:f(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)}}),G(e,`/queued-messages/${encodeURIComponent(t)}`))}async function ia(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`].drafts.$get({param:{projectId:f(),id:encodeURIComponent(e)}},V(t)),G(e,`/drafts`))}var aa=56*1024;async function oa(e,t,n,r){let i=r?.keepalive===!0&&new TextEncoder().encode(JSON.stringify(n)).length<=aa;return U(await B.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].$put({param:{projectId:f(),id:encodeURIComponent(e),surface:t},json:n},{init:{keepalive:i}}),G(e,`/drafts/${t}`))}async function sa(e,t,n){return U(await B.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images.$post({param:{projectId:f(),id:encodeURIComponent(e),surface:t},json:n}),G(e,`/drafts/${t}/images`))}async function ca(e){return U(await B.api.v1.workspace.uploads.$post({json:e}),`/workspace/uploads`)}async function la(e){return U(await B.api.v1.workspace.uploads[`:uploadId`].$delete({param:{uploadId:e}}),`/workspace/uploads/${e}`)}async function ua(e,t,n,r){return U(await B.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$get({param:{projectId:f(),id:encodeURIComponent(e),surface:t,imageId:n}},V(r)),G(e,`/drafts/${t}/images/${n}`))}async function da(e,t,n){return U(await B.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$delete({param:{projectId:f(),id:encodeURIComponent(e),surface:t,imageId:n}}),G(e,`/drafts/${t}/images/${n}`))}async function fa(e){return U(await B.api.v1.p[`:projectId`].repo.branch.$post({param:{projectId:f()},json:e}),`/repo/branch`)}async function pa(e){return U(await B.api.v1.p[`:projectId`].repo.sync.$get({param:{projectId:f()}},V(e)),`/repo/sync`)}async function ma(e){let t={param:{projectId:f()}},n=B.api.v1.p[`:projectId`].repo;return U(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 ha(e){return U(await B.api.v1.p[`:projectId`].plan.$post({param:{projectId:f()},json:{task:e}}),`/plan`)}async function ga(e){return U(await B.api.v1.p[`:projectId`].automations.$get({param:{projectId:f()}},V(e)),`/automations`)}async function _a(e){return U(await B.api.v1.p[`:projectId`].automations.$post({param:{projectId:f()},json:e}),`/automations`)}async function va(e,t){return U(await B.api.v1.p[`:projectId`].automations[`:id`].$put({param:{projectId:f(),id:encodeURIComponent(e)},json:t}),`/automations/${encodeURIComponent(e)}`)}async function ya(e,t){let n={projectId:f(),id:encodeURIComponent(e)},r=`/automations/${encodeURIComponent(e)}/${t?`enable`:`pause`}`;return U(t?await B.api.v1.p[`:projectId`].automations[`:id`].enable.$post({param:n}):await B.api.v1.p[`:projectId`].automations[`:id`].pause.$post({param:n}),r)}async function ba(e){let t=`/automations/${encodeURIComponent(e)}/work`;return U(await B.api.v1.p[`:projectId`].automations[`:id`].work.$get({param:{projectId:f(),id:encodeURIComponent(e)}}),t)}async function xa(e){let t=`/automations/${encodeURIComponent(e)}/cancel-queued`;return U(await B.api.v1.p[`:projectId`].automations[`:id`][`cancel-queued`].$post({param:{projectId:f(),id:encodeURIComponent(e)}}),t)}async function Sa(e,t){return U(await B.api.v1.p[`:projectId`].automations[`:id`].check.$post({param:{projectId:f(),id:encodeURIComponent(e)},json:{mode:t}}),`/automations/${encodeURIComponent(e)}/check`)}async function Ca(e,t){return U(await B.api.v1.p[`:projectId`][`automation-log`].$get({param:{projectId:f()},query:{automationId:e}},V(t)),`/automation-log?automationId=${encodeURIComponent(e)}`)}async function wa(e){return U(await B.api.v1.p[`:projectId`][`automation-log`][`:receiptId`].retry.$post({param:{projectId:f(),receiptId:encodeURIComponent(e)}}),`/automation-log/${encodeURIComponent(e)}/retry`)}async function Ta(e,t){return U(await B.api.v1.p[`:projectId`].automations[`:id`].run.$post({param:{projectId:f(),id:encodeURIComponent(e)},query:t?{expectedRevision:String(t)}:{}}),`/automations/${encodeURIComponent(e)}/run`)}async function Ea(e,t){let n=await B.api.v1.p[`:projectId`].automations[`:id`].$delete({param:{projectId:f(),id:encodeURIComponent(e)},query:t?{expectedRevision:String(t)}:{}});if(!n.ok)throw z(n.status,n.statusText,await H(n))}async function Da(e){return U(await B.api.v1.p[`:projectId`].automations.export.$get({param:{projectId:f()},query:e?.length?{ids:e.join(`,`)}:{}}),`/automations/export`)}async function Oa(e){return U(await B.api.v1.p[`:projectId`].automations.import.preview.$post({param:{projectId:f()},json:e}),`/automations/import/preview`)}async function ka(e){return U(await B.api.v1.p[`:projectId`].automations.import.$post({param:{projectId:f()},json:e}),`/automations/import`)}async function Aa(e,t){return U(await B.api.v1.workspace[`automation-templates`].$get({query:e?{exclude:e}:{}},V(t)),`/workspace/automation-templates`)}async function ja(e){return U(await B.api.v1.p[`:projectId`].workflows.$post({param:{projectId:f()},json:e}),`/workflows`)}async function Ma(e){return U(await B.api.v1.p[`:projectId`].workflows.nodes.$get({param:{projectId:f()}},V(e)),`/workflows/nodes`)}async function Na(e){return U(await B.api.v1.p[`:projectId`].workflows.validate.$post({param:{projectId:f()},json:{graph:e}}),`/workflows/validate`)}async function Pa(e){return U(await B.api.v1.p[`:projectId`].workflows.graph.$post({param:{projectId:f()},json:e}),`/workflows/graph`)}async function Fa(e){return U(await B.api.v1.p[`:projectId`].workflows.parse.$post({param:{projectId:f()},json:{yaml:e}}),`/workflows/parse`)}async function Ia(e){return U(await B.api.v1.p[`:projectId`].workflows[`:name`].$delete({param:{projectId:f(),name:encodeURIComponent(e)}}),`/workflows/${encodeURIComponent(e)}`)}async function La(e,t=f()){return U(await B.api.v1.p[`:projectId`][`ui-state`].$put({param:{projectId:t},json:e}),`/ui-state`)}async function Ra(e){return U(await B.api.v1.workspace[`ui-state`].$get({},V(e)),`/workspace/ui-state`)}async function za(e,t={}){return U(await B.api.v1.workspace[`ui-state`].$put({json:e},{init:{keepalive:t.keepalive}}),`/workspace/ui-state`)}async function Ba(e){let t=await U(await B.api.v1.workspace.config.$get({},V(e)),`/workspace/config`);return{...t,branding:t.branding?{...t.branding,logoUrl:t.branding.logoUrl?g(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 Va(e){let t=new FormData;t.set(`file`,e);let n=await bn(`/workspace/branding-logo`,{method:`POST`,body:t}),i=await H(n);if(!n.ok)throw z(n.status,n.statusText,i);let a=R(i),o=r.safeParse(a);if(!o.success)throw new L(n.status,`the cezar server answered /workspace/branding-logo with an unexpected body`);return o.data.logoUrl?g(o.data.logoUrl):null}async function Ha(){let e=await bn(`/workspace/branding-logo`,{method:`DELETE`}),t=await H(e);if(!e.ok)throw z(e.status,e.statusText,t);let n=r.safeParse(R(t));if(!n.success)throw new L(e.status,`the cezar server answered /workspace/branding-logo with an unexpected body`);return n.data.logoUrl?g(n.data.logoUrl):null}async function Ua(e){return U(await B.api.v1.workspace[`host-usage`].$get({},V(e)),`/workspace/host-usage`)}async function Wa(e){let t=await U(await B.api.v1.workspace[`agent-profiles`].$get({},V(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 Ga(e,t){return U(await B.api.v1.workspace[`agent-profiles`][`fallback-policy`].$get({query:e},V(t)),`/workspace/agent-profiles/fallback-policy`)}async function Ka(e,t){return U(await B.api.v1.workspace[`agent-profiles`][`fallback-policy`].$put({json:e},V(t)),`/workspace/agent-profiles/fallback-policy`)}async function qa(e){return U(await B.api.v1.workspace[`agent-profiles`].$post({json:e}),`/workspace/agent-profiles`)}async function Ja(e,t){return U(await B.api.v1.workspace[`agent-profiles`][`:id`].status.$get({param:{id:encodeURIComponent(e)},query:{...t?.refresh||t?.recheck?{refresh:`1`}:{},...t?.recheck?{recheck:`1`}:{}}},V(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/status`)}async function Ya(e,t){return U(await B.api.v1.workspace[`agent-profiles`][`:id`].details.$get({param:{id:encodeURIComponent(e)}},V(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/details`)}async function Xa(e,t){return U(await B.api.v1.workspace[`agent-profiles`][`:id`].open.$post({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}/open`)}async function Za(e){return U(await B.api.v1.workspace[`agent-profiles`].selection.$put({json:e}),`/workspace/agent-profiles/selection`)}async function Qa(e,t){return U(await B.api.v1.workspace[`agent-profiles`][`:id`].$patch({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function $a(e){return U(await B.api.v1.workspace[`agent-profiles`][`:id`].$delete({param:{id:encodeURIComponent(e)}}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function eo(e,t){return U(await B.api.v1.workspace[`skills-update`].$get({query:{projectId:e}},V(t)),`/workspace/skills-update?projectId=${encodeURIComponent(e)}`)}async function to(e){return U(await B.api.v1.workspace[`skills-update`].check.$post({json:{projectId:e}}),`/workspace/skills-update/check`)}async function no(e){return U(await B.api.v1.workspace[`skills-update`].apply.$post({json:{projectId:e}}),`/workspace/skills-update/apply`)}async function ro(e){return U(await B.api.v1.workspace[`self-update`].$get({},V(e)),`/workspace/self-update`)}async function io(){return U(await B.api.v1.workspace[`self-update`].refresh.$post({}),`/workspace/self-update/refresh`)}async function ao(e){return U(await B.api.v1.workspace[`self-update`].development.$get({query:e?.refresh?{refresh:`1`}:{}},V(e)),`/workspace/self-update/development`)}async function oo(e){return U(await B.api.v1.workspace[`self-update`].channel.$put({json:{channel:e}}),`/workspace/self-update/channel`)}async function so(e){return U(await B.api.v1.workspace[`self-update`].apply.$post({json:{version:e}}),`/workspace/self-update/apply`)}async function co(e){return U(await B.api.v1.workspace[`self-update`].apply.$post({json:{version:e,whenIdle:!0}}),`/workspace/self-update/apply`)}async function lo(){return U(await B.api.v1.workspace[`self-update`].scheduled.$delete({}),`/workspace/self-update/scheduled`)}async function uo(e){let t=await U(await B.api.v1.workspace.config.$put({json:e}),`/workspace/config`);return{...t,orgSkillsRepos:t.orgSkillsRepos??[]}}async function fo(e){return U(await B.api.v1.p[`:projectId`].config.$put({param:{projectId:f()},json:e}),`/config`)}async function po(e){return U(await B.api.v1.p[`:projectId`].worktrees.$get({param:{projectId:f()}},V(e)),`/worktrees`)}async function mo(){return U(await B.api.v1.p[`:projectId`].worktrees.reclaim.$post({param:{projectId:f()},json:{}}),`/worktrees/reclaim`)}async function ho(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`][`remove-worktree`].$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/remove-worktree`))}async function go(e,t,n){return ie.parse(await U(await B.api.v1.p[`:projectId`].tracker.watch.$post({param:{projectId:e},json:t},{init:{signal:n}}),`/tracker/watch`))}async function _o(e,t,n,r){return a.parse(await U(await B.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 vo(e,t,n){return a.parse(await U(await B.api.v1.p[`:projectId`].tracker.watch[`:watchId`].$post({param:{projectId:e,watchId:t}},{init:{signal:n}}),`/tracker/watch`))}var yo={list:async(e,t)=>U(await B.api.v1.p[`:projectId`].webhooks.$get({param:{projectId:e}},{init:{signal:t}}),`/webhooks`),create:async(e,t)=>U(await B.api.v1.p[`:projectId`].webhooks.$post({param:{projectId:e},json:t}),`/webhooks`),update:async(e,t,n)=>U(await B.api.v1.p[`:projectId`].webhooks[`:id`].$patch({param:{projectId:e,id:t},json:n}),`/webhooks`),remove:async(e,t,n)=>U(await B.api.v1.p[`:projectId`].webhooks[`:id`].$delete({param:{projectId:e,id:t},json:{expectedRevision:n}}),`/webhooks`),activate:async(e,t,n)=>U(await B.api.v1.p[`:projectId`].webhooks[`:id`].activate.$post({param:{projectId:e,id:t},json:{expectedRevision:n,confirmed:!0}}),`/webhooks`),pause:async(e,t,n)=>U(await B.api.v1.p[`:projectId`].webhooks[`:id`].pause.$post({param:{projectId:e,id:t},json:{expectedRevision:n}}),`/webhooks`),resume:async(e,t,n)=>U(await B.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)=>U(await B.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)=>U(await B.api.v1.p[`:projectId`].webhooks[`:id`].test.$post({param:{projectId:e,id:t},json:n}),`/webhooks`),retry:async(e,t,n)=>U(await B.api.v1.p[`:projectId`].webhooks.deliveries[`:deliveryId`].retry.$post({param:{projectId:e,deliveryId:t},json:n}),`/webhooks`),replay:async(e,t,n)=>U(await B.api.v1.p[`:projectId`].webhooks.deliveries[`:deliveryId`].replay.$post({param:{projectId:e,deliveryId:t},json:{...n,confirmed:!0}}),`/webhooks`),acknowledge:async(e,t)=>U(await B.api.v1.p[`:projectId`].webhooks.notice.acknowledge.$post({param:{projectId:e},json:{expectedChangeSequence:t}}),`/webhooks`),history:async(e,t)=>U(await B.api.v1.p[`:projectId`].webhooks.history.$get({param:{projectId:e},query:{limit:`100`,...t?{cursor:t}:{}}}),`/webhooks/history`),deliveries:async(e,t,n,r)=>U(await B.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)=>U(await B.api.v1.p[`:projectId`].webhooks[`:id`].activity.$get({param:{projectId:e,id:t}}),`/webhooks/activity`)};async function bo(e={limit:50},t){return U(await B.api.v1.p[`:projectId`][`worktree-lifecycle`].$get({param:{projectId:f()},query:{cursor:e.cursor,limit:e.limit,attentionOnly:e.attentionOnly===void 0?void 0:e.attentionOnly?`true`:`false`}},V(t)),`/worktree-lifecycle`)}async function xo(e,t){return U(await B.api.v1.p[`:projectId`][`worktree-lifecycle`][`:worktreeId`].$get({param:{projectId:f(),worktreeId:e}},V(t)),`/worktree-lifecycle`)}async function So(e,t){return U(await B.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].$get({param:{projectId:f(),operationId:e}},V(t)),`/worktree-lifecycle/operations`)}async function Co(e,t=0,n){return U(await B.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].output.$get({param:{projectId:f(),operationId:e},query:{afterSeq:t,limit:100}},V(n)),`/worktree-lifecycle/operations/output`)}async function wo(e,t=f()){return U(await B.api.v1.p[`:projectId`][`worktree-lifecycle`].operations.$post({param:{projectId:t},json:e}),`/worktree-lifecycle/operations`)}async function To(e,t){return U(await B.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].actions.$post({param:{projectId:f(),operationId:e},json:t}),`/worktree-lifecycle/operations/actions`)}async function Eo(e){return U(await B.api.v1.p[`:projectId`][`worktree-lifecycle`].preview.$post({param:{projectId:f()},json:e}),`/worktree-lifecycle/preview`)}async function Do(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].terminal.$get({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/terminal`))}async function Oo(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`].terminal.$post({param:{projectId:f(),id:encodeURIComponent(e)},json:t}),G(e,`/terminal`))}async function ko(e,t,n){return U(await B.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].output.$get({param:{projectId:f(),id:encodeURIComponent(e),sessionId:t},query:{cursor:String(n)}}),G(e,`/terminal/${t}/output`))}async function Ao(e,t,n){await U(await B.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].input.$post({param:{projectId:f(),id:encodeURIComponent(e),sessionId:t},json:{data:n}}),G(e,`/terminal/${t}/input`))}async function jo(e,t,n,r){await U(await B.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].resize.$post({param:{projectId:f(),id:encodeURIComponent(e),sessionId:t},json:{cols:n,rows:r}}),G(e,`/terminal/${t}/resize`))}async function Mo(e,t){await U(await B.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].$delete({param:{projectId:f(),id:encodeURIComponent(e),sessionId:t}}),G(e,`/terminal/${t}`))}async function No(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].terminal.urls.$get({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/terminal/urls`))}async function Po(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].terminal.commands.$get({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/terminal/commands`))}async function Fo(){return U(await B.api.v1.p[`:projectId`][`start-app`].$get({param:{projectId:f()}}),`/start-app`)}async function Io(e){return U(await B.api.v1.p[`:projectId`][`start-app`].$put({param:{projectId:f()},json:e}),`/start-app`)}async function Lo(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].layouts.$get({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/layouts`))}async function Ro(e,t,n){let r=n?.keepalive===!0&&new TextEncoder().encode(JSON.stringify(t)).length<=aa;return U(await B.api.v1.p[`:projectId`].runs[`:id`].layouts.$put({param:{projectId:f(),id:encodeURIComponent(e)},json:t},{init:{keepalive:r}}),G(e,`/layouts`))}async function zo(e){return U(await B.api.v1.p[`:projectId`][`deferred-start`].preview.$post({param:{projectId:f()},json:e}),`/deferred-start/preview`)}async function Bo(e){return U(await B.api.v1.p[`:projectId`][`deferred-start`].$post({param:{projectId:f()},json:e}),`/deferred-start`)}async function Vo(e){return U(await B.api.v1.p[`:projectId`][`deferred-start`].options.$post({param:{projectId:f()},json:e}),`/deferred-start/options`)}async function Ho(e,t,n=f()){return U(await B.api.v1.p[`:projectId`].github.asset.$post({param:{projectId:n},json:{url:e}},V(t)),`/github/asset`)}function Uo(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!Wo(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return Go(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 Wo(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function Wo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Go(e){return Wo(e)&&typeof e.id==`string`&&e.id!==``}function Ko(e){return typeof e.task==`string`&&Array.isArray(e.steps)}function qo(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]=Yo(r,t),i}if(!Ko(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 Jo(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function Yo(e,t){let n={...t};if(!Ko(t)){let t=n;for(let n of v)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 Xo=Object.freeze({});function Zo(){let e=Xo,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 Qo={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`,tone:`success`},merged:{label:`Merged`,hint:`this landed on its base branch`,tone:`violet`},closed:{label:`Closed`,hint:`closed without merging — the work did not land`,tone:`danger`},open:{label:`Open`,hint:`still open on the tracker`,tone:`success`},completed:{label:`Closed as completed`,hint:`the issue was resolved`,tone:`violet`},"not-planned":{label:`Closed as not planned`,hint:`the issue was declined — nothing shipped for it`,tone:`neutral`}},$o={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function es(e){return typeof e==`string`&&Object.hasOwn(Qo,e)}function ts(e){return e!==void 0&&es(e)?Qo[e]:void 0}var ns={permission:0,error:1,waiting:2,running:3,unseen:4,none:5};function rs(e){return!1}function is(e){return!1}function as(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 K(e){return e.status===`failed`&&e.awaitingAnswerSince!==void 0}function os(e){return e.status===`failed`&&e.idleClosedAt!==void 0&&!K(e)}function ss(e){return!!e.worktreeLifecycle?.needsAttention||e.status===`waiting`||e.status===`review`||K(e)}function cs(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`}:rs(e)?{bucket:`permission`,tone:`violet`,pulse:!0,label:`needs permission`}:e.status===`failed`&&e.autoResumeAt?{bucket:`none`,tone:`pending`,pulse:!1,label:`scheduled`}:K(e)?{bucket:`waiting`,tone:`pending`,pulse:!0,label:`needs you`}:os(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:`pending`,pulse:!0,label:as(e)?.ceiling===void 0?`needs you`:`budget reached`}:e.status===`review`?{bucket:`waiting`,tone:`violet`,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`}:is(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 ls(e){return ns[cs(e).bucket]<=ns.waiting}var us=[`Pinned`,`Needs you`,`Working`,`Recent`,`Archived`],ds={waiting:0,review:1,running:2,queued:4,done:5,failed:5,cancelled:5},fs=3,ps=e=>e.status===`failed`&&e.autoResumeAt!==void 0?fs:K(e)?ds.waiting??0:ds[e.status]??9;function ms(e,t){return t===`archived`?`Archived`:e.pinned?`Pinned`:ss(e)?`Needs you`:e.status===`running`||e.status===`queued`||e.status===`failed`&&e.autoResumeAt?`Working`:`Recent`}function hs(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function gs(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 _s(e,t){return t!==void 0&&gs(e).ref===t}function vs(e){return e.title.replace(/ \([A-C]\)$/,``)}function ys(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 bs(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort(ys);return new Map(t.map((e,t)=>[e.id,t+1]))}var xs=[{value:`recent`,label:`Recent`},{value:`created`,label:`Created`}];function Ss(e,t){let n=Date.parse(e),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?t.localeCompare(e):r-n}function Cs(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&&Ss(e,t)<0&&(t=e)}return t}function ws(e,t){return t===`created`?e.createdAt:Cs(e)}function Ts(e){return e===`created`?`Created`:`Updated`}function Es(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 Ds(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=ps(e)-ps(n);if(r!==0)return r;if(ps(e)===fs&&e.autoResumeAt&&n.autoResumeAt){let t=e.autoResumeAt.localeCompare(n.autoResumeAt);if(t!==0)return t}return e.status===`queued`&&n.status===`queued`?ys(e,n):Ss(Cs(e),Cs(n))})}function Os(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 Ss(ws(e,n),ws(r,n))})}function ks(e,t){let n=bs(e),r=Ds(e,t),i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])},o=new Set;for(let e of r){if(e.groupId){if(o.has(e.groupId))continue;o.add(e.groupId);let n=r.filter(t=>t.groupId===e.groupId).sort((e,t)=>(e.variant??``).localeCompare(t.variant??``));if(n.length>1){a(ms(e,t),{kind:`group`,groupId:e.groupId,title:vs(e),members:n});continue}}a(ms(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null})}return us.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function As(e,t){let n=[],r=t;for(let t of e){if(t.label===`Pinned`){n.push({label:t.label,rows:[...t.rows]});continue}if(r<=0)continue;let e=t.rows.slice(0,r);r-=e.length,n.push({label:t.label,rows:e})}return n}function js(e){let t=0,n=0,r=0;for(let i of e){if(i.archived){n+=1;continue}t+=1,ss(i)&&(r+=1)}return{active:t,archived:n,waiting:r}}var Ms=new Set([`running`,`waiting`]),Ns=new Set([`done`,`failed`,`review`,`cancelled`]),Ps=new Set([`done`,`failed`,`cancelled`]);function Fs(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 Is(e){return e?`$${e>=10?e.toFixed(0):e.toFixed(2)}`:``}function Ls(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 Rs(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 zs(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[hs(e),e.branch??``,e.workflow,Rs(e)].some(e=>e.toLowerCase().includes(n))):[...e]}function Bs(e){return e.filter(e=>!e.archived&&Ps.has(e.status)&&!K(e)).length}function Vs(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 Hs(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 Us(e){return Ws(e)[0]?.url??Gs(e)[0]}function Ws(e,t){if(!e.prRefs?.length)return Gs(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??Qs(`PR`,e.number,t),origin:e.origin}))}function Gs(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 Ks(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.markerRefs?.issue??e.issueNumber;if(!(!n||!t)&&!qs(e.referencedIssueCandidates,n,t))return`${t}/issues/${n}`}function qs(e,t,n){let r=`${n.toLowerCase()}/`;return(e??[]).some(e=>e.endsWith(`/${t}`)&&!e.toLowerCase().startsWith(r))}function Js(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 Ys(e,t){let n=e.prRefs?.length?Ws(e,t).map(e=>({number:e.number,url:e.url})):Gs(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:Zs(e,t)},{kind:`Issue`,url:Ks(e,t)},{kind:`Issue`,number:Xs(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??Qs(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 Xs(e,t){let n=e.issueNumber;return n===void 0||!t?n:qs(e.referencedIssueCandidates,n,t)?void 0:n}function Zs(e,t){let n=e.prNumber;return n===void 0||!t?n:qs(e.referencedPrCandidates,n,t)?void 0:n}function Qs(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function $s(e,t){return Ys(e,t)[0]}function q(e){let t=e.split(`/`).pop()??``;return/^\d+$/.test(t)?t:null}function ec(e,t){let n=Ms.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:Fs(n.rssBytes),kind:`live`}};let r=Fs(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 tc(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=>Ns.has(e.status))?[]:[{groupId:e,title:vs(n),count:t.length}]})}function nc(e){return 220+Math.max(0,e)*14}function rc(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 ic(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 ac(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 oc=`/api/v1/ws`,sc=3e3,cc=1e3,lc=7e4,uc=0,dc=1;function fc(e){let t=new Map,n=new Map,r=null,i,a,o,s=()=>{clearTimeout(o),o=setTimeout(()=>{o=void 0,r?.close()},lc)},c=()=>e??`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${oc}`,l=e=>{r?.readyState===dc&&r.send(JSON.stringify(e))},u=()=>{let e=globalThis.WebSocket;if(typeof e!=`function`||r&&(r.readyState===uc||r.readyState===dc))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()},sc)))}),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)},cc))))}}}}var pc=null;function mc(e,t,n){return pc??=fc(),pc.subscribe(e,t,n)}var J={secrets:{allFor:e=>[`secrets`,e],list:()=>[`secrets`,f()]},e2e:{allFor:e=>[`e2e`,e],status:()=>[`e2e`,f()]},tracker:{allFor:e=>[`tracker`,e],all:()=>[`tracker`,f()],associationFor:e=>[`tracker`,e,`association`],association:()=>[`tracker`,f(),`association`],candidates:(e,t=``)=>[`tracker`,f(),`candidates`,e,t],connection:()=>[`tracker`,f(),`connection`],items:(e,t)=>[`tracker`,f(),`items`,e.kind,e.source.id,e.source.webUrl,e.externalId,e.connectionId??null,t.state,[...t.labels],t.query??``],detail:(e,t)=>[`tracker`,f(),`detail`,e.kind,e.source.id,e.source.webUrl,e.externalId,e.connectionId??null,t]},get health(){return[f(),`health`]},runs:{get all(){return[f(),`runs`]},list:()=>[f(),`runs`,`list`],detail:e=>[f(),`runs`,`detail`,e],diff:e=>[f(),`runs`,`diff`,e],changes:e=>[f(),`runs`,`changes`,e],gitStatus:e=>[f(),`runs`,`git-status`,e],file:(e,t)=>[f(),`runs`,`files`,e,t],artifacts:e=>[f(),`runs`,`artifacts`,e],impactSubject:e=>[f(),`runs`,`impact-subject`,e],get impactSubjects(){return[f(),`runs`,`impact-subject`]},get projectAssets(){return[f(),`runs`,`project-assets`]},artifactText:(e,t,n)=>[f(),`runs`,`artifact-text`,e,t,n],handoff:e=>[f(),`runs`,`handoff`,e],drafts:e=>[f(),`runs`,`drafts`,e],commits:e=>[f(),`runs`,`commits`,e],tree:e=>[f(),`runs`,`tree`,e],commit:(e,t)=>[f(),`runs`,`commit`,e,t]},groups:{detail:e=>[f(),`groups`,e]},get todos(){return[f(),`todos`]},get workflows(){return[f(),`workflows`]},get workflowNodes(){return[f(),`workflow-nodes`]},get skills(){return[f(),`skills`]},get skillsReady(){return[f(),`skills`,`ready`]},get importableSkills(){return[f(),`skills`,`importable`]},get importableSkillsReady(){return[f(),`skills`,`importable`,`ready`]},get launchKey(){return[f(),`launch-key`]},get repo(){return[f(),`repo`]},get repoChanges(){return[f(),`repo`,`changes`]},repoCommit:e=>[f(),`repo`,`commit`,e],get repoSync(){return[f(),`repo`,`sync`]},get repoTree(){return[f(),`repo`,`tree`]},repoFile:e=>[f(),`repo`,`file`,e],get uiState(){return[f(),`ui-state`]},get config(){return[f(),`config`]},get agentConfig(){return[f(),`agent-config`]},agentConfigFile:e=>[f(),`agent-config`,`file`,e],get worktrees(){return[f(),`worktrees`]},github:(e={})=>[f(),`github`,e.limit??null],githubPages:(e=50)=>[f(),`github`,`pages`,e],githubChecks:e=>[f(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[f(),`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)=>[f(),`github`,`comments`,e,t],githubMergeState:e=>[f(),`github`,`merge-state`,e],get openTargets(){return[f(),`open-targets`]}},hc=6e4;function gc(){return j({queryKey:J.secrets.list(),queryFn:({signal:e})=>Cr({signal:e})})}function _c(){return j({queryKey:Y.secrets,queryFn:({signal:e})=>wr({signal:e})})}function vc(){return j({queryKey:J.e2e.status(),queryFn:({signal:e})=>Ar({signal:e})})}function yc(){return j({queryKey:J.tracker.connection(),queryFn:({signal:e})=>br({signal:e})})}function bc(){return j({queryKey:J.tracker.association(),queryFn:({signal:e})=>Mr({signal:e})})}function xc(e,t,n){return N({queryKey:J.tracker.candidates(e,t),staleTime:hc,queryFn:({pageParam:n,signal:r})=>Nr(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 Sc=class extends Error{failure;constructor(e){super(e.reason),this.failure=e,this.name=`TrackerRefreshError`}};function Cc(e,t,n=!0){let r=t.query.trim(),i=A(),a=e?J.tracker.items(e,{...t,query:r}):[`tracker`,f(),`items`,`unassociated`];return{...N({queryKey:a,staleTime:1/0,queryFn:({pageParam:n,signal:i})=>r?Rr(r,{association:e??void 0,cursor:n,limit:50,state:t.state,labels:t.labels,refresh:!0},{signal:i}):Lr({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 Rr(r,i,{signal:n}):await Lr(i,{signal:n});if(!a.available)throw new Sc(a);return a}})}catch{}}}}function wc(e,t){return j({staleTime:hc,queryKey:e&&t?J.tracker.detail(e,t):[`tracker`,f(),`detail`,`disabled`],queryFn:({signal:n})=>zr(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 j({queryKey:Y.models(e),queryFn:({signal:t})=>c(e)?Dn(e,{signal:t}):Promise.reject(Error(`${e} has no host model catalog`)),staleTime:300*1e3,enabled:t&&c(e)})}function Tc(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 Ec(){let e=A();return j({queryKey:Y.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(Y.providerStatus),r=await On(!1,{signal:t});return Yt(n,e.getQueryData(Y.providerStatus),r)},staleTime:5*6e4,refetchInterval:!1,refetchOnWindowFocus:!0})}function Dc(){let e=A();return M({mutationFn:()=>On(!0),onMutate:()=>e.getQueryData(Y.providerStatus),onSuccess:(t,n,r)=>e.setQueryData(Y.providerStatus,e=>Yt(r,e,t))})}function Oc(){return j({queryKey:Y.agentSetup,queryFn:({signal:e})=>Rn({signal:e}),retry:!1,gcTime:0,refetchInterval:e=>{let t=e.state.data;return t?.available&&t.session?.exitCode===null?kc:!1},refetchIntervalInBackground:!0})}var kc=1e3;function Ac(){let e=A();return(0,k.useCallback)(()=>void e.invalidateQueries({queryKey:J.health}),[e])}function jc(){let e=A();return M({mutationFn:({provider:e,action:t})=>zn(e,t),retry:!1,onSuccess:t=>e.setQueryData(Y.agentSetup,e=>e?.available?{...e,session:t}:e),onSettled:()=>e.invalidateQueries({queryKey:Y.agentSetup})})}function Mc(){let e=A();return M({mutationFn:e=>Un(e),retry:!1,onSettled:()=>e.invalidateQueries({queryKey:Y.agentSetup})})}function Nc(){let e=A();return M({mutationFn:({provider:e,authFailureId:t})=>ui(e,t),onMutate:()=>e.getQueryData(Y.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(Y.providerStatus,e=>Yt(r,e,t,n.authFailureId))}})}function Pc(){return j({queryKey:Y.projects,queryFn:({signal:e})=>An({signal:e})})}function Fc(e,t=!1){return j({queryKey:Y.fsBrowse(e,t),queryFn:({signal:n})=>jn(e??void 0,{signal:n,showHidden:t}),retry:!1})}function Ic(){let e=A();return M({mutationFn:e=>di(e),onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function Lc(){let e=A();return M({mutationFn:e=>hi(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:Y.projects})}})}function Rc(){let e=A();return M({mutationFn:e=>{let{id:t,...n}=e;return gi(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?zc(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 zc(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?[]:ac(s);return c.length>0&&(a.tags=c),a}function Bc(e){let t=A();return M({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:Y.agentProfiles}),t.invalidateQueries({queryKey:Y.projects})])}})}function Vc(){return Bc(e=>qa(e))}function Hc(){return Bc(e=>{let{id:t,...n}=e;return Qa(t,n)})}function Uc(){return Bc(e=>$a(e))}function Wc(){return Bc(e=>Za(e))}function Gc(e,t){return j({queryKey:Y.agentAccountDetails(e),queryFn:({signal:t})=>Ya(e,{signal:t}),enabled:t,staleTime:0,retry:!1})}function Kc(e,t){return j({queryKey:Y.agentAccountStatus(e),queryFn:({signal:t})=>Ja(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function qc(){let e=A();return M({mutationFn:({provider:e,profileId:t})=>si(e,t),retry:!1,onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Y.agentProfiles}),e.invalidateQueries({queryKey:Y.providerStatus})])}})}function Jc(){let e=A();return M({mutationFn:e=>Ja(e,{recheck:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(Y.agentAccountStatus(n),t),e.invalidateQueries({queryKey:Y.agentProfiles})}})}function Yc(){return M({mutationFn:e=>{let{routeId:t,...n}=e;return Xa(t,n)},retry:!1})}function Xc(){let e=A();return M({mutationFn:e=>fi(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function Zc(){let e=A();return M({mutationFn:e=>pi(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function Qc(e=!0){return j({queryKey:Y.repoSuggestions,queryFn:({signal:e})=>Mn({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function $c(){let e=A();return M({mutationFn:e=>Nn(e),retry:!1,onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:Y.projects}),e.invalidateQueries({queryKey:J.repo}),e.invalidateQueries({queryKey:J.health})])})}function el(){let e=A();return M({mutationFn:({projectId:e,owner:t,name:n})=>Pn(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 tl(e){let t=A(),n=(0,k.useRef)(e);n.current=e;let r=(0,k.useRef)(!1),i=M({mutationFn:Fn,retry:!1,onMutate:()=>{r.current=!0,t.setQueryData(Y.githubLogin,{status:`starting`})},onSuccess:e=>t.setQueryData(Y.githubLogin,e)}),a=M({mutationFn:Ln,retry:!1,onMutate:()=>{r.current=!1},onSuccess:e=>t.setQueryData(Y.githubLogin,e)}),o=j({queryKey:Y.githubLogin,queryFn:({signal:e})=>In({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,k.useEffect)(()=>{c!==`done`||!r.current||(r.current=!1,Promise.all([t.invalidateQueries({queryKey:Y.githubOwners}),t.invalidateQueries({queryKey:Y.projects}),t.invalidateQueries({queryKey:[f(),`github`]}),t.invalidateQueries({queryKey:J.repo}),t.invalidateQueries({queryKey:J.health})]),n.current?.(l))},[c,l,t]),{state:s,start:i,cancel:a}}function nl(){return j({queryKey:Y.githubOwners,queryFn:({signal:e})=>mi({signal:e}),staleTime:5*6e4,retry:!1})}function rl(){let e=A();(0,k.useEffect)(()=>{let t,n=()=>{let n=e.getQueryData(J.health)?.capabilities?.localHandoff===!0;n&&t===void 0?t=mc(`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 il(){return j({queryKey:J.health,queryFn:({signal:e})=>Sn({signal:e}),refetchInterval:e=>ol(e.state.data)})}var al=3e4;function ol(e){return e?.capabilities?.localHandoff===!1&&e.forge!=null&&e.forge.available!==!0&&al}function sl(){let e=il().data,t=Pc().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?Vs(e?.repo?.remote,e?.forge?.kind===`github`):void 0}function cl(){return j({queryKey:J.openTargets,queryFn:({signal:e})=>Wi({signal:e}),staleTime:5*6e4})}function ll(e){return j({queryKey:J.runs.list(),queryFn:({signal:e})=>Wn({signal:e}),select:e})}function ul(e=!0,t){return j({queryKey:Y.runsIndex,queryFn:({signal:e})=>Kn({signal:e}),enabled:e,staleTime:3e4,...t===void 0?{}:{refetchInterval:typeof t==`function`?e=>t(e.state.data):t}})}function dl(e,t=!0,n=!1,r){return j({queryKey:[n?`default`:e,`runs`,`list`],queryFn:({signal:t})=>Gn(e,{signal:t}),enabled:t,select:r})}function fl(e,t,n){let r=e==="default"?null:e,i=r===null||t!=null&&r===t;return dl(i?`default`:r??`default`,!0,i,n)}function pl(e){return{queryKey:J.runs.detail(e),queryFn:({signal:t})=>qn(e,{signal:t})}}function ml(e){return j({...pl(e??``),enabled:!!e})}function hl(e,t,n=!0){return j({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Jn(e,t,{signal:n}),enabled:n&&!!e&&!!t})}function gl(e){return j({queryKey:J.runs.diff(e??``),queryFn:({signal:t})=>qr(e,{signal:t}),enabled:!!e})}function _l(e,t=!1){return j({queryKey:J.runs.changes(e??``),queryFn:({signal:t})=>Yr(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?4e3:!1,refetchOnWindowFocus:!0,staleTime:0})}function vl(e,t,n=!1){return j({queryKey:J.runs.gitStatus(e),queryFn:({signal:t})=>Yi(e,{signal:t}),enabled:t,retry:!1,refetchInterval:n?1e4:!1,refetchOnWindowFocus:!0,staleTime:0})}function yl(e,t=!0){return j({queryKey:J.runs.tree(e??``),queryFn:({signal:t})=>hr(e,{signal:t}),enabled:t&&!!e,retry:!1,staleTime:0})}function bl(e,t){return j({queryKey:J.runs.file(e??``,t??``),queryFn:({signal:n})=>Xr(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function xl(e){return j({queryKey:J.runs.artifacts(e??``),queryFn:({signal:t})=>Qr(e,{signal:t}),enabled:!!e,retry:!1})}function Sl(e,t,n){return j({queryKey:J.runs.artifactText(e,t??``,n??``),queryFn:({signal:n})=>ei(e,t,{signal:n}),enabled:t!==void 0&&n!==void 0,retry:!1,staleTime:1/0})}function Cl(e){return j({queryKey:J.runs.impactSubject(e?ni(e):``),queryFn:({signal:t})=>ii(e,{signal:t}),enabled:e!==null,retry:!1})}function wl(){return j({queryKey:J.runs.projectAssets,queryFn:({signal:e})=>ai({signal:e}),retry:!1})}function Tl(){let e=A();return M({mutationFn:e=>ri(e),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:J.runs.impactSubject(ni(n.subject))}),e.invalidateQueries({queryKey:J.runs.list()})}})}function El(e){return j({queryKey:J.groups.detail(e??``),queryFn:({signal:t})=>oi(e,{signal:t}),enabled:!!e})}function Dl(e,t=!1){return j({queryKey:J.runs.commits(e??``),queryFn:({signal:t})=>gr(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?5e3:!1})}function Ol(e,t){return j({queryKey:J.runs.commit(e??``,t??``),queryFn:({signal:n})=>_r(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function kl(e,t=!0){return j({queryKey:J.runs.handoff(e??``),queryFn:({signal:t})=>Jr(e,{signal:t}),enabled:!!e&&t})}function Al(e){return j({queryKey:J.runs.drafts(e??``),queryFn:({signal:t})=>ia(e,{signal:t}),enabled:!!e,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1})}function jl(e=!0){return j({queryKey:J.todos,queryFn:({signal:e})=>ir({signal:e}),enabled:e})}function Ml(){return j({queryKey:J.workflowNodes,queryFn:({signal:e})=>Ma({signal:e}),staleTime:1/0})}function Nl(e={}){return j({queryKey:J.workflows,enabled:e.enabled??!0,queryFn:({signal:e})=>Qn({signal:e})})}function Pl(e=!0){let t=A(),n=J.skills,r=n[0],i=j({queryKey:n,queryFn:({signal:e})=>$n({signal:e}),enabled:e}),a=j({queryKey:J.skillsReady,queryFn:({signal:e})=>er({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,k.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`],a.data)},[t,a.data,r]),i}function Fl(e=!0){let t=A(),n=J.importableSkills,r=n[0],i=j({queryKey:n,queryFn:({signal:e})=>nr({signal:e}),enabled:e}),a=j({queryKey:J.importableSkillsReady,queryFn:({signal:e})=>rr({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,k.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`,`importable`],a.data)},[t,a.data,r]),i}function Il(){return j({queryKey:J.launchKey,queryFn:({signal:e})=>kn({signal:e}),staleTime:1/0})}function Ll(){return j({queryKey:J.repo,queryFn:({signal:e})=>ar({signal:e})})}function Rl(){return j({queryKey:J.repoSync,queryFn:({signal:e})=>pa({signal:e}),refetchOnWindowFocus:!0})}function zl(){let e=A();return M({mutationFn:e=>ma(e),onSuccess:t=>{e.setQueryData(J.repoSync,t.sync),e.invalidateQueries({queryKey:J.repo,predicate:e=>e.queryKey[2]!==`sync`})}})}function Bl(){return j({queryKey:J.repoChanges,queryFn:({signal:e})=>ur({signal:e}),retry:!1})}function Vl(){return j({queryKey:J.repoTree,queryFn:({signal:e})=>dr({signal:e}),retry:!1,refetchOnWindowFocus:!0,staleTime:0})}function Hl(e){return j({queryKey:J.repoFile(e??``),queryFn:({signal:t})=>fr(e,{signal:t}),enabled:e!==void 0&&e!==``,retry:!1,refetchOnWindowFocus:!0,staleTime:0})}function Ul(e){return j({queryKey:J.repoCommit(e??``),queryFn:({signal:t})=>mr(e,{signal:t}),enabled:!!e,retry:!1})}function Wl(){return j({queryKey:J.config,queryFn:({signal:e})=>or({signal:e})})}function Gl(){return j({queryKey:J.worktrees,queryFn:({signal:e})=>po({signal:e})})}function Kl(){return j({queryKey:J.uiState,queryFn:({signal:e})=>Zn({signal:e})})}function ql(){return j({queryKey:J.agentConfig,queryFn:({signal:e})=>sr({signal:e})})}function Jl(e){return j({queryKey:J.agentConfigFile(e??``),queryFn:({signal:t})=>cr(e,{signal:t}),enabled:e!==null})}function Yl(e){let t=A(),n=J.agentConfig,r=J.agentConfigFile(e);return M({mutationFn:t=>lr(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}function Xl(){return j({queryKey:Y.uiState,queryFn:({signal:e})=>Ra({signal:e})})}function Zl(){return j({queryKey:Y.config,queryFn:({signal:e})=>Ba({signal:e})})}function Ql(){return j({queryKey:Y.agentProfiles,queryFn:({signal:e})=>Wa({signal:e})})}function $l(e){return j({queryKey:Y.agentFallbackPolicy(e??`default`),queryFn:({signal:t})=>Ga({projectId:e??`default`},{signal:t}),enabled:e!==null,retry:!1})}function eu(e){let t=A();return M({mutationFn:t=>Ka({projectId:e??`default`,...t}),retry:!1,onSuccess:n=>t.setQueryData(Y.agentFallbackPolicy(e??`default`),n)})}var tu=15*6e4;function nu(e=!0){let t=A();return(0,k.useEffect)(()=>{if(e)return t.getQueryCache().subscribe(e=>{e.type!==`updated`||e.action.type!==`success`||e.action.manual||e.query.queryHash!==iu&&t.prefetchQuery(ru)})},[e,t]),j({...ru,enabled:e,refetchOnMount:!1})}var ru={queryKey:Y.starCount,queryFn:({signal:e})=>Cn({signal:e}),staleTime:tu,retry:!1},iu=T(Y.starCount);function au(){return j({queryKey:Y.telemetryConsent,queryFn:({signal:e})=>Tn({signal:e}),staleTime:1/0,retry:!1})}var ou=6;function su(e,t=!0){return j({queryKey:Y.skillsUpdate(e),queryFn:({signal:t})=>eo(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<ou)&&6e4}})}function cu(e=!0){return j({queryKey:Y.selfUpdate,queryFn:({signal:e})=>ro({signal:e}),enabled:e,refetchInterval:e=>e.state.data?.job?.status===`running`?1e3:e.state.data?.scheduled?5e3:!1})}function lu(e=!0){return j({queryKey:Y.selfUpdateDevelopment,queryFn:({signal:e})=>ao({signal:e}),enabled:e,staleTime:3e4})}function uu(){let e=A();return M({mutationFn:()=>ao({refresh:!0}),onSuccess:t=>e.setQueryData(Y.selfUpdateDevelopment,t)})}function du(){let e=A();return M({mutationFn:()=>io(),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function fu(){let e=A();return M({mutationFn:e=>oo(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function pu(){let e=A();return M({mutationFn:e=>so(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function mu(){let e=A();return M({mutationFn:e=>co(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function hu(){let e=A();return M({mutationFn:()=>lo(),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function gu(e){let t=A();return M({mutationFn:t=>Ri(e,t),onSuccess:e=>{_u(t,e),t.invalidateQueries({queryKey:J.runs.all})}})}function _u(e,t){e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t.id?Yo(e,t):e)),e.setQueryData(J.runs.detail(t.id),e=>e?Yo(e,t):t),vu(e)}function vu(e){e.invalidateQueries({queryKey:Y.runsIndex})}function yu(){let e=A();return M({mutationFn:e=>Oi(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),vu(e)}})}function bu(){let e=A();return M({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));return e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t?xu(e):e)),e.setQueryData(J.runs.detail(t),e=>e&&xu(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?xu(e):e;e.setQueryData(J.runs.list(),e=>e?.map(n)),e.setQueryData(J.runs.detail(t.id),e=>e?n(e):t),vu(e)}})}function xu(e){let{seenAt:t,...n}=e;return n}function Su(e,t,n){let r=A();return M({mutationFn:({id:n,pinned:r,surface:i})=>t===void 0?Si(n,r,i??e):Ci(t,n,r,i??e),onSuccess:()=>r.invalidateQueries({queryKey:n===void 0?J.runs.all:[n,`runs`]})})}function Cu(e,t,n){let r=A();return M({mutationFn:({id:n,archived:r})=>t===void 0?xi(n,r,e):wi(t,n,r,e),onSuccess:()=>r.invalidateQueries({queryKey:n===void 0?J.runs.all:[n,`runs`]})})}function wu(e,t){let n=A();return M({mutationFn:n=>t===void 0?ea(e,n):ta(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:J.runs.all}),onError:e=>{e instanceof L&&e.status===409&&n.invalidateQueries({queryKey:J.runs.all})}})}function Tu(e,t){let n=A();return M({mutationFn:(n={})=>t===void 0?Ni(e,n):Pi(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:J.runs.all})})}function Eu(e){let t=A();return M({mutationFn:({msgId:t,message:n})=>na(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function Du(e){let t=A();return M({mutationFn:t=>ra(e,t),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function Ou(e={},t=!0){return j({queryKey:J.github(e),queryFn:({signal:t})=>vr({limit:e.limit},{signal:t}),enabled:t})}function ku(e=50,t=!0){return N({queryKey:J.githubPages(e),queryFn:({pageParam:t,signal:n})=>vr({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 Au(e,t=!0){return j({queryKey:J.githubChecks(e),queryFn:({signal:t})=>Br(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function ju(e,t,n=!0){return j({queryKey:J.githubSearch(e,t),queryFn:({signal:n})=>Vr(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var Mu=100;function Nu(e){return[...e].sort((e,t)=>t-e).slice(0,Mu).sort((e,t)=>e-t)}var Z=new Map(zu()),Pu=1e3;function Fu(e,t){if(Z.get(e)!==t){for(Z.delete(e),Z.set(e,t);Z.size>Pu;){let e=Z.keys().next().value;if(e===void 0)break;Z.delete(e)}Hu()}}var Q=new Set(Bu());function Iu(e,t){if(Q.has(e)!==t){if(t)for(Q.add(e);Q.size>Pu;){let e=Q.values().next().value;if(e===void 0)break;Q.delete(e)}else Q.delete(e);Hu()}}var Lu=`cez.reference-statuses.v1`,Ru=`cez.reference-conflicts.v1`;function zu(){try{let e=globalThis.sessionStorage?.getItem(Lu);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`&&es(e[1])):[]}catch{return[]}}function Bu(){try{let e=globalThis.sessionStorage?.getItem(Ru);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var Vu;function Hu(){Vu===void 0&&(Vu=setTimeout(()=>{Vu=void 0;try{globalThis.sessionStorage?.setItem(Lu,JSON.stringify([...Z])),globalThis.sessionStorage?.setItem(Ru,JSON.stringify([...Q]))}catch{}},250))}function Uu(){let e=Bt(),t=il();return e.projectId??t.data?.bootProject}function Wu(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))Fu($({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))Fu($({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var Gu=5*6e4;function Ku(e){return e?e.recheckAfterMs:Gu}var $=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function qu(e,t=!0){let n=(0,k.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:Nu(t.prs),issues:Nu(t.issues)}))},[e.map($).sort().join(`|`)]),r=It({queries:n.map(e=>({queryKey:J.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>Hr(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>Ku(e.state.data)??1/0,refetchInterval:e=>Ku(e.state.data)??!1,refetchOnWindowFocus:!0}))}),{byRef:i,learned:a}=(0,k.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,k.useEffect)(()=>{for(let{key:e,status:t,conflicting:n}of a)Fu(e,t),n!==void 0&&Iu(e,n)},[a]),(0,k.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 Ju(e,t,n=!0){return j({queryKey:J.githubComments(e,t),queryFn:({signal:n})=>Ur(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Yu(e){return j({queryKey:[`github`,`pr-changes`,e??0],queryFn:({signal:t})=>Kr(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{Pc as $,Kt as $a,oa as $i,cs as $n,or as $r,bc as $t,tl as A,li as Aa,xo as Ai,Us as An,si as Ar,bl as At,Ac as B,ci as Ba,Ui as Bi,Cs as Bn,zi as Br,mu as Bt,vc as C,Er as Ca,Fo as Ci,Fs as Cn,C as Co,xa as Cr,Sl as Ct,Au as D,Or as Da,Ua as Di,Ls as Dn,to as Dr,Dl as Dt,Ou as E,Pa as Ea,Lr as Ei,Js as En,b as Eo,Sa as Er,Ol as Et,il as F,bi as Fa,Gr as Fi,xs as Fn,_i as Fr,X as Ft,cl as G,Ao as Ga,ha as Gi,Ds as Gn,Da as Gr,fu as Gt,yu as H,Na as Ha,Fa as Hi,bs as Hn,la as Hr,cu as Ht,rl as I,Vi as Ia,wn as Ii,As as In,Ii as Ir,ll as It,wl as J,sn as Ja,zo as Ji,ws as Jn,Ja as Jr,nu as Jt,gu as K,pn as Ka,sa as Ki,Os as Kn,Mi as Kr,Pl as Kt,Cl as L,Mo as La,Gi as Li,Ss as Ln,Oo as Lr,fl as Lt,Yu as M,ca as Ma,ka as Mi,Ys as Mn,_a as Mr,kl as Mt,ju as N,jr as Na,ji as Ni,ec as Nn,Bo as Nr,yl as Nt,Ju as O,ya as Oa,Ra as Oi,nc as On,Fr as Or,gl as Ot,El as P,wo as Pa,Ai as Pi,Rs as Pn,fa as Pr,Tc as Pt,gc as Q,Jt as Qa,fo as Qi,as as Qn,ga as Qr,jl as Qt,Fl as R,U as Ra,qi as Ri,ks as Rn,ja as Rr,ul as Rt,Zc as S,Zr as Sa,eo as Si,Is as Sn,Oe as So,Ei as Sr,ml as St,Fc as T,xr as Ta,zr as Ti,q as Tn,ve as To,B as Tr,_l as Tt,bu as U,yo as Ua,Ri as Ui,_s as Un,Ia as Ur,lu as Ut,Il as V,Va,go as Vi,js as Vn,da as Vr,Wc as Vt,Yc as W,Vn as Wa,Hi as Wi,hs as Wn,Ha as Wr,wu as Wt,hl as X,rn as Xa,yi as Xi,Es as Xn,Aa as Xr,Tl as Xt,sl as Y,an as Ya,Eo as Yi,gs as Yn,Ca as Yr,jc as Yt,dl as Z,P as Za,Xi as Zi,ns as Zn,ba as Zr,au as Zt,Xc as _,Hn as _a,Lo as _i,ic as _n,De as _o,no as _r,Qc as _t,pl as a,Bn as aa,Wr as ai,Hc as an,Bt as ao,ts as ar,qu as at,Tu as b,ti as ba,No as bi,zs as bn,Te as bo,xi as br,Vl as bt,ql as c,mo as ca,So as ci,Nl as cn,j as co,qo as cr,uu as ct,Ql as d,Dr as da,ua as di,Xl as dn,ht as do,Yo as dr,Lc as dt,Ro as ea,Vo as ei,xc as en,I as eo,K as er,Ec as et,Oc as f,ho as fa,ia as fi,Gl as fn,rt as fo,Uo as fr,Du as ft,hu as g,pr as ga,Xn as gi,rc as gn,T as go,Li as gr,Hl as gt,Mc as h,kr as ha,Yn as hi,mc as hn,Se as ho,To as hr,Ul as ht,Wu as i,za as ia,Kr as ii,Kl as in,Vt as io,$o as ir,Uu as it,nl as j,Io as ja,ni as ji,$s as jn,Ni as jr,vl as jt,ku as k,Ti as ka,bo as ki,Ks as kn,Ji as kr,Al as kt,Jl as l,tr as la,Co as li,Zl as ln,Ct as lo,Zo as lr,Ic as lt,Cu as m,Sr as ma,Yi as mi,_u as mn,O as mo,Zi as mr,Bl as mt,Sc as n,La as na,Ho as ni,wc as nn,en as no,ss as nr,Yl as nt,Gc as o,ko as oa,Sn as oi,Rc as on,N as oo,Xo as or,Dc as ot,pu as p,Bi as pa,Xr as pi,Y as pn,Ke as po,L as pr,Ll as pt,Su as q,on as qa,Oa as qi,Ts as qn,Ya as qr,su as qt,J as r,uo as ra,Ur as ri,Cc as rn,$t as ro,ls as rr,Jc as rt,Kc as s,_o as sa,kn as si,Ml as sn,M as so,Jo as sr,du as st,hc as t,En as ta,vr as ti,yc as tn,Qt as to,os as tr,el as tt,$l as u,vo as ua,Jn as ui,_c as un,A as uo,Ko as ur,Uc as ut,Wl as v,jo as va,Do as vi,Ns as vn,Ie as vo,Di as vr,Rl as vt,Eu as w,Pr as wa,yr as wi,Hs as wn,ze as wo,vi as wr,xl as wt,Vc as x,Ta as xa,ro as xi,Bs as xn,S as xo,Un as xr,Nc as xt,qc as y,wa as ya,Po as yi,tc as yn,Ee as yo,wi as yr,zl as yt,$c as z,va as za,Ki as zi,vs as zn,Ea as zr,eu 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,Ct as i,Et as a,Mt as o,Ot as s,Q as c,Z as l,_ as u,a as d,c as f,d as p,h as m,i as h,jt as ee,l as g,o as te,rt as ne,s as _,st as v,v as re,wt as ie}from"./utils-Bl_tQdVw.js";var ae=/^[\w!#$%&'*.^`|~+-]+$/,oe=(e,t,n={})=>{if(!ae.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},se=(e,t,n)=>(t=encodeURIComponent(t),oe(e,t,n)),ce=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),le=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??`);e=e.replace(t,r?`/${r}`:``)}return e},ue=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},de=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},fe=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pe(e,t){if(!y(e)&&!y(t))return t;let n={...e};for(let e in t){let r=t[e];y(n[e])&&y(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(se(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=fe(a),a=le(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??ue,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=ce(e,a.join(`/`));if(s===`url`||s===`path`){let t=c;return r.args[0]&&(r.args[0].param&&(t=le(c,r.args[0].param)),r.args[0].query&&(t=t+`?`+i(r.args[0].query).toString())),t=fe(t),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=de(r.args[0]&&r.args[0].param?le(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(!Oe(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(!Oe(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)=>Me(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Oe(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Oe(e[n],t[n])):!1}var ke=Object.prototype.hasOwnProperty;function Ae(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=je(e)&&je(t);if(!r&&!(Me(e)&&Me(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:ke.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Ae(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function E(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 je(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Me(e){if(!Ne(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Ne(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Ne(e){return Object.prototype.toString.call(e)===`[object Object]`}function Pe(e){return new Promise(t=>{x.setTimeout(t,e)})}function Fe(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Ae(e,t)}function Ie(e){return e}function Le(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Re(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ze=Symbol();function Be(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ze?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ve(e,t){return typeof e==`function`?e(...t):!!e}function He(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 D=(()=>{let e=()=>xe;return{isServer(){return e()},setIsServer(t){e=t}}})();function Ue(){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 We=be;function Ge(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=We,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 O=Ge(),Ke=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 qe(e){return Math.min(1e3*2**e,3e4)}function Je(e){return(e??`online`)!==`online`||Ke.isOnline()}var Ye=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Xe(e){let t=!1,n=0,r,i=Ue(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Ye(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>ve.isFocused()&&(e.networkMode===`always`||Ke.isOnline())&&e.canRun(),u=()=>Je(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??(D.isServer()?0:3),o=e.retryDelay??qe,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),Pe(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 Ze=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??(D.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(x.clearTimeout(this.#e),this.#e=void 0)}};function Qe(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=>{He(e,()=>t.signal,()=>n=!0)},u=Be(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?Re:Le;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?et:$e,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:$e(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 $e(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 et(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function tt(e,t){return t?$e(e,t)!=null:!1}function nt(e,t){return!t||!e.getPreviousPageParam?!1:et(e,t)!=null}var rt=class extends Ze{#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=ot(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=ot(this.options);e.data!==void 0&&(this.setState(at(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Fe(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===ze||!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=Be(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`?Qe(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=Xe({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Ye&&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 Ye){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,...it(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...at(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),O.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function it(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Je(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function at(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function ot(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 st=class extends b{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Ue(),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),lt(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ut(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ut(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&&!E(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&dt(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 pt(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(D.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,!(D.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&<(e,t),o=i&&dt(e,n,t,r);(a||o)&&(l={...l,...it(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=Fe(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=Fe(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 ee=l.fetchStatus===`fetching`,g=m===`pending`,te=m===`error`,ne=g&&ee,_=d!==void 0,v={status:m,fetchStatus:l.fetchStatus,isPending:g,isSuccess:m===`success`,isError:te,isInitialLoading:ne,isLoading:ne,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:ee,isRefetching:ee&&!g,isLoadingError:te&&!_,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:te&&_,isStale:ft(e,t),refetch:this.refetch,promise:this.#o,isEnabled:w(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=v.data!==void 0,r=v.status===`error`&&!t,i=e=>{r?e.reject(v.error):t&&e.resolve(v.data)},a=()=>{let e=this.#o=v.promise=Ue();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||v.data!==o.value)&&a();break;case`rejected`:(!r||v.error!==o.reason)&&a();break}}return v}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),!E(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){O.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function ct(e,t){return w(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&w(t.retryOnMount,e)===!1)}function lt(e,t){return ct(e,t)||e.state.data!==void 0&&ut(e,t,t.refetchOnMount)}function ut(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&&ft(e,t)}return!1}function dt(e,t,n,r){return(e!==t||w(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ft(e,n)}function ft(e,t){return w(t.enabled,e)!==!1&&e.isStaleByTime(C(t.staleTime,e))}function pt(e,t){return!E(e.getCurrentResult(),t)}var mt=class extends st{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:tt(t,n.data),hasPreviousPage:nt(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},ht=class extends Ze{#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||gt(),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=Xe({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),O.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function gt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var _t=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),E(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??gt();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){O.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 vt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function yt(e,t,n){let r=e.slice(0);return r[t]=n,r}var bt=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,O.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||!E(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(vt(e,n).forEach(e=>{e.destroy()}),vt(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=Ae(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 st(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=yt(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)&&O.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},k=e(t(),1),xt=n(),St=k.createContext(void 0),A=e=>{let t=k.useContext(St);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Ct=({client:e,children:t})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,xt.jsx)(St.Provider,{value:e,children:t})),wt=k.createContext(!1),Tt=()=>k.useContext(wt);wt.Provider;function Et(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Dt=k.createContext(Et()),Ot=()=>k.useContext(Dt),kt=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Ve(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},At=e=>{k.useEffect(()=>{e.clearReset()},[e])},jt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Ve(n,[e.error,r])),Mt=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))}},Nt=(e,t)=>e.isLoading&&e.isFetching&&!t,Pt=(e,t)=>e?.suspense&&t.isPending,Ft=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function It({queries:e,...t},n){let r=A(n),i=Tt(),a=Ot(),o=k.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{Mt(e);let t=r.getQueryCache().get(e.queryHash);kt(e,a,t)}),At(a);let[s]=k.useState(()=>new bt(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;k.useSyncExternalStore(k.useCallback(e=>d?s.subscribe(O.batchCalls(e)):S,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),k.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>Pt(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&Pt(n,e)?Ft(n,new st(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&jt({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 Lt(e,t,n){let r=Tt(),i=Ot(),a=A(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,Mt(o),kt(o,i,s),At(i);let l=!a.getQueryCache().get(o.queryHash),[u]=k.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(k.useSyncExternalStore(k.useCallback(e=>{let t=f?u.subscribe(O.batchCalls(e)):S;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),k.useEffect(()=>{u.setOptions(o)},[o,u]),Pt(o,d))throw Ft(o,u,i);if(jt({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&&!D.isServer()&&Nt(d,r)&&(l?Ft(o,u,i):s?.promise)?.catch(S).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function j(e,t){return Lt(e,st,t)}function M(e,t){let n=A(t),[r]=k.useState(()=>new _t(n,e));k.useEffect(()=>{r.setOptions(e)},[r,e]);let i=k.useSyncExternalStore(k.useCallback(e=>r.subscribe(O.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=k.useCallback((e,t)=>{r.mutate(e,t).catch(S)},[r]);if(i.error&&Ve(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function N(e,t){return Lt(e,mt,t)}var Rt={projectId:null,apiBase:h},zt=(0,k.createContext)(Rt);function Bt(){return(0,k.useContext)(zt)}function Vt({projectId:e,children:t}){_()!==e&&p(e),(0,k.useLayoutEffect)(()=>{p(e)},[e]),(0,k.useLayoutEffect)(()=>()=>p(null),[]);let n=(0,k.useMemo)(()=>e===null?Rt:{projectId:e,apiBase:`${h}/p/${encodeURIComponent(e)}`},[e]);return(0,xt.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},P=[...s].sort((e,t)=>Ht[e]-Ht[t]),Ut=new Set([`connected`,`disconnected`,`not-installed`,`unknown`]);function Wt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Gt(e,t){if(!Wt(e))return null;let{provider:n,status:r,enabled:i,hint:a,authFailureId:o}=e;return typeof n!=`string`||!P.includes(n)||typeof r!=`string`||!Ut.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 Kt(e){return Gt(e,!1)}function qt(e,t){if(!Wt(e)||!Array.isArray(e.providers))return null;let n=[],r=new Set;for(let i of e.providers){let e=Gt(i,t);if(e===null||r.has(e.provider))return null;r.add(e.provider),n.push(e)}return n}function F(e){let t=qt(e,!0);if(t===null||t.length===0)return null;let n=new Map(t.map(e=>[e.provider,e]));return P.flatMap(e=>{let t=n.get(e);return t?[t]:[]})}function I(e){let t=F(e);if(t===null)throw Error(`Invalid provider status response`);return{providers:t}}function Jt(e,t){let n=F(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 Yt(e,t,n,r){let i=F(e),a=F(t),o=F(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:Xt(t,n)?e:i?{...e,enabled:n.enabled}:n})}}function Xt(e,t){return e.provider===t.provider&&e.status===t.status&&e.enabled===t.enabled&&e.hint===t.hint&&e.authFailureId===t.authFailureId}var Zt=new Set([`junie`,`antigravity`,`omp`]);function Qt(e){return e.status===`connected`||e.status===`unknown`&&Zt.has(e.provider)}function $t(e){let t=F(e);if(t===null)return[];let n=new Set(t.filter(e=>e.enabled&&Qt(e)).map(e=>e.provider));return P.filter(e=>n.has(e))}function en(e,t){return F(e)?.find(e=>e.provider===t)}var tn=`cezar:sid`,nn;function rn(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 an(){try{let e=localStorage.getItem(tn);if(e)return e;let t=rn();return localStorage.setItem(tn,t),t}catch{return nn??=rn()}}var on=`x-cezar-sid`;function sn(){nn=void 0;try{localStorage.removeItem(tn)}catch{}}function cn(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 ln=/\/(?:providers|agent-profiles)(?:\/|$)/;function un(e,t){if(!ln.test(e))return;let n=e.split(`/`),r=n[n.indexOf(`providers`)+1];if(n.includes(`providers`)&&l.safeParse(r).success)return r;if(typeof t==`string`)try{let e=JSON.parse(t).provider;return l.safeParse(e).success?e:void 0}catch{return}}var dn=null;function fn(e,t,n,r,i){try{let a=new URL(e,window.location.origin).pathname,o=un(a,r),s=cn(i);dn={method:(t??`GET`).toUpperCase(),path:a,status:n,at:Date.now(),...o?{provider:o}:{},...s?{cause:s}:{}}}catch{}}function pn(e=3e3,t=Date.now()){return dn&&t-dn.at<=e?dn:null}var L=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 R(e){try{return JSON.parse(e)}catch{return}}function mn(e){return typeof e==`string`?e:void 0}var hn=`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 z(e,t,n){let r=R(n),i=r&&typeof r==`object`?r:{},a=mn(i.error)??(e===413?hn:`${e} ${t||`request failed`}`.trim()),o=e===409?m.safeParse(r):void 0;return new L(e,a,{...o?.success?{runIds:o.data.runIds}:{},manual:mn(i.manual),command:mn(i.command),exists:typeof i.exists==`boolean`?i.exists:void 0})}var B=_e({fetch:(e,t)=>yn(gn(String(e)),t)});function gn(e){let t=vn(e.endsWith(`?`)?e.slice(0,-1):e);return t.startsWith(`/`)?`${te()}${t}`:t}var _n=`${h}/p/default`;function vn(e){if(_()!==null||!e.startsWith(_n))return e;let t=e.slice(_n.length);return t===``||t.startsWith(`/`)||t.startsWith(`?`)?`${h}${t}`:e}var V=e=>({init:{signal:e?.signal}});async function H(e){try{return await e.text()}catch(t){throw t instanceof DOMException&&t.name===`AbortError`?t:(fn(e.url,void 0,0,void 0,t),new L(0,`cannot reach the cezar server (${e.url})`,{cause:t}))}}async function U(e,t){let n=await H(e);if(!e.ok)throw z(e.status,e.statusText,n);let r=R(n);if(r===void 0)throw new L(e.status,`the cezar server answered ${t} with a non-JSON body`);return r}async function W(e,t,n){let r=e.status,i=await U(e,t),a=n.safeParse(i);if(!a.success)throw new L(r,`the cezar server answered ${t} with an unexpected body`);return a.data}async function yn(e,t){try{let n=new Headers(t?.headers);n.set(on,an());let r=await fetch(e,{...t,headers:n,credentials:`include`});return r.ok||fn(e,t?.method,r.status,t?.body),r}catch(n){throw n instanceof DOMException&&n.name===`AbortError`?n:(fn(e,t?.method,0,t?.body,n),new L(0,`cannot reach the cezar server (${e})`,{cause:n}))}}async function bn(e,t){return yn(d(e),t)}async function xn(e,t={}){let n=new Headers(t.headers);n.set(`accept`,`text/plain`);let r=await bn(e,{...t,headers:n}),i=await H(r);if(!r.ok)throw z(r.status,r.statusText,i);return i}var G=(e,t=``)=>`/runs/${encodeURIComponent(e)}${t}`;async function Sn(e){return U(await B.api.v1.health.$get({},V(e)),`/health`)}async function Cn(e){return U(await B.api.v1[`star-count`].$get({},V(e)),`/star-count`)}async function wn(e){return U(await B.api.v1.preview[`design-proxy`].$post({json:e}),`/preview/design-proxy`)}async function Tn(e){return U(await B.api.v1.telemetry.consent.$get({},V(e)),`/telemetry/consent`)}async function En(e){return U(await B.api.v1.telemetry.consent.$put({json:e}),`/telemetry/consent`)}async function Dn(e,t){return U(await B.api.v1.models.$get({query:{runner:e}},V(t)),`/models`)}async function On(e=!1,t){return I(await U(await B.api.v1.providers.status.$get({query:e?{refresh:`1`}:{}},V(t)),`/providers/status`))}async function kn(e){return U(await B.api.v1.p[`:projectId`][`launch-key`].$get({param:{projectId:f()}},V(e)),`/launch-key`)}async function An(e){return U(await B.api.v1.projects.$get({},V(e)),`/projects`)}async function jn(e,t){return U(await B.api.v1.fs.browse.$get({query:{path:e===``?void 0:e,...t?.showHidden?{showHidden:`1`}:{}}},V(t)),`/fs/browse`)}async function Mn(e){return U(await B.api.v1.fs.repos.$get({},V(e)),`/fs/repos`)}async function Nn(e){return U(await B.api.v1.projects[`:projectId`][`git-init`].$post({param:{projectId:encodeURIComponent(e)}}),`/projects/${encodeURIComponent(e)}/git-init`)}async function Pn(e,t){return U(await B.api.v1.projects[`:projectId`][`publish-github`].$post({param:{projectId:encodeURIComponent(e)},json:t}),`/projects/${encodeURIComponent(e)}/publish-github`)}async function Fn(){return U(await B.api.v1.github.login.$post(),`/github/login`)}async function In(e){return U(await B.api.v1.github.login.$get({},V(e)),`/github/login`)}async function Ln(){return U(await B.api.v1.github.login.$delete(),`/github/login`)}async function Rn(e){return U(await B.api.v1.providers.setup.$get({},V(e)),`/providers/setup`)}async function zn(e,t){return U(await B.api.v1.providers.setup.sessions.$post({json:{provider:e,action:t}}),`/providers/setup/sessions`)}async function Bn(e,t){return U(await B.api.v1.providers.setup.sessions[`:sessionId`].output.$get({param:{sessionId:e},query:{cursor:String(t)}}),`/providers/setup/sessions/${e}/output`)}async function Vn(e,t){await U(await B.api.v1.providers.setup.sessions[`:sessionId`].input.$post({param:{sessionId:e},json:{data:t}}),`/providers/setup/sessions/${e}/input`)}async function Hn(e,t,n){await U(await B.api.v1.providers.setup.sessions[`:sessionId`].resize.$post({param:{sessionId:e},json:{cols:t,rows:n}}),`/providers/setup/sessions/${e}/resize`)}async function Un(e){await U(await B.api.v1.providers.setup.sessions[`:sessionId`].$delete({param:{sessionId:e}}),`/providers/setup/sessions/${e}`)}async function Wn(e){return U(await B.api.v1.p[`:projectId`].runs.$get({param:{projectId:f()},query:{}},V(e)),`/runs`)}async function Gn(e,t){return U(await B.api.v1.p[`:projectId`].runs.$get({param:{projectId:e},query:{}},V(t)),`/runs`)}async function Kn(e){return U(await B.api.v1.workspace[`runs-index`].$get({},V(e)),`/workspace/runs-index`)}async function qn(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:f(),id:encodeURIComponent(e)}},V(t)),G(e))}async function Jn(e,t,n){return U(await B.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:e,id:encodeURIComponent(t)}},V(n)),G(t))}async function Yn(e,t,n){return W(await B.api.v1.p[`:projectId`].runs[`:id`].history.$get({param:{projectId:f(),id:encodeURIComponent(e)},query:{...t===void 0?{}:{cursor:t}}},V(n)),`${G(e)}/history`,o)}async function Xn(e,t){return W(await B.api.v1.p[`:projectId`].runs[`:id`][`history-context`].$get({param:{projectId:f(),id:encodeURIComponent(e)}},V(t)),`${G(e)}/history-context`,ee)}async function Zn(e){return U(await B.api.v1.p[`:projectId`][`ui-state`].$get({param:{projectId:f()}},V(e)),`/ui-state`)}async function Qn(e){return U(await B.api.v1.p[`:projectId`].workflows.$get({param:{projectId:f()}},V(e)),`/workflows`)}async function $n(e){return U(await B.api.v1.p[`:projectId`].skills.$get({param:{projectId:f()},query:{}},V(e)),`/skills`)}async function er(e){return U(await B.api.v1.p[`:projectId`].skills.$get({param:{projectId:f()},query:{wait:`1`}},V(e)),`/skills`)}async function tr(){return U(await B.api.v1.p[`:projectId`].skills.refresh.$post({param:{projectId:f()}}),`/skills/refresh`)}async function nr(e){return U(await B.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:f()},query:{}},V(e)),`/skills/importable`)}async function rr(e){return U(await B.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:f()},query:{wait:`1`}},V(e)),`/skills/importable`)}async function ir(e){return U(await B.api.v1.p[`:projectId`].todos.$get({param:{projectId:f()}},V(e)),`/todos`)}async function ar(e){return U(await B.api.v1.p[`:projectId`].repo.$get({param:{projectId:f()}},V(e)),`/repo`)}async function or(e){return U(await B.api.v1.p[`:projectId`].config.$get({param:{projectId:f()}},V(e)),`/config`)}async function sr(e={}){return U(await B.api.v1.p[`:projectId`][`agent-config`].$get({param:{projectId:f()}},V(e)),`/agent-config`)}async function cr(e,t={}){return U(await B.api.v1.p[`:projectId`][`agent-config`][`:id`].$get({param:{projectId:f(),id:encodeURIComponent(e)}},V(t)),`/agent-config/${encodeURIComponent(e)}`)}async function lr(e,t){return U(await B.api.v1.p[`:projectId`][`agent-config`][`:id`].$put({param:{projectId:f(),id:encodeURIComponent(e)},json:t}),`/agent-config/${encodeURIComponent(e)}`)}async function ur(e){return U(await B.api.v1.p[`:projectId`].repo.changes.$get({param:{projectId:f()}},V(e)),`/repo/changes`)}async function dr(e){return U(await B.api.v1.p[`:projectId`].repo.tree.$get({param:{projectId:f()}},V(e)),`/repo/tree`)}async function fr(e,t){return U(await B.api.v1.p[`:projectId`].repo.files.$get({param:{projectId:f()},query:{path:e}},V(t)),`/repo/files`)}function pr(e){return d(`/repo/files?path=${encodeURIComponent(e)}&raw=1`)}async function mr(e,t){return U(await B.api.v1.p[`:projectId`].repo.commit[`:sha`].$get({param:{projectId:f(),sha:encodeURIComponent(e)},query:{structured:`1`}},V(t)),`/repo/commit/:sha`)}async function hr(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`].tree.$get({param:{projectId:f(),id:encodeURIComponent(e)}},V(t)),G(e,`/tree`))}async function gr(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`].commits.$get({param:{projectId:f(),id:encodeURIComponent(e)}},V(t)),G(e,`/commits`))}async function _r(e,t,n){return U(await B.api.v1.p[`:projectId`].runs[`:id`].commit[`:sha`].$get({param:{projectId:f(),id:encodeURIComponent(e),sha:encodeURIComponent(t)}},V(n)),G(e,`/commit/${encodeURIComponent(t)}`))}async function vr(e={},t){return U(await B.api.v1.p[`:projectId`].github.$get({param:{projectId:f()},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}},V(t)),`/github`)}async function yr(e={},t){return U(await B.api.v1.p[`:projectId`].tracker[`automation-options`].$get({param:{projectId:f()},query:e},V(t)),`/tracker/automation-options`)}async function br(e){return U(await B.api.v1.p[`:projectId`].tracker.connection.$get({param:{projectId:f()}},V(e)),`/tracker/connection`)}async function xr(e){return U(await B.api.v1.p[`:projectId`].tracker.connection.$put({param:{projectId:f()},json:e}),`/tracker/connection`)}async function Sr(){return U(await B.api.v1.p[`:projectId`].tracker.connection.$delete({param:{projectId:f()}}),`/tracker/connection`)}async function Cr(e){return U(await B.api.v1.p[`:projectId`].secrets.$get({param:{projectId:f()}},V(e)),`/secrets`)}async function wr(e){return U(await B.api.v1.workspace.secrets.$get({},V(e)),`/workspace/secrets`)}async function Tr(e){if(!e.ok)throw z(e.status,e.statusText,await H(e))}async function Er(e,t){await Tr(await B.api.v1.p[`:projectId`].secrets[`:name`].$put({param:{projectId:f(),name:e},json:t}))}async function Dr(e){await Tr(await B.api.v1.p[`:projectId`].secrets[`:name`].$delete({param:{projectId:f(),name:e}}))}async function Or(e,t){await Tr(await B.api.v1.workspace.secrets[`:name`].$put({param:{name:e},json:t}))}async function kr(e){await Tr(await B.api.v1.workspace.secrets[`:name`].$delete({param:{name:e}}))}async function Ar(e){return U(await B.api.v1.p[`:projectId`].e2e.$get({param:{projectId:f()}},V(e)),`/e2e`)}async function jr(e){return U(await B.api.v1.p[`:projectId`].e2e.setup.$post({param:{projectId:f()},json:e}),`/e2e/setup`)}async function Mr(e){return U(await B.api.v1.p[`:projectId`].tracker.association.$get({param:{projectId:f()}},V(e)),`/tracker/association`)}async function Nr(e,t={},n){return U(await B.api.v1.p[`:projectId`].tracker.candidates.$get({param:{projectId:f()},query:{kind:e,q:t.q,cursor:t.cursor,limit:t.limit===void 0?void 0:String(t.limit)}},V(n)),`/tracker/candidates`)}async function Pr(e){return U(await B.api.v1.p[`:projectId`].tracker.association.$put({param:{projectId:f()},json:e}),`/tracker/association`)}async function Fr(){return U(await B.api.v1.p[`:projectId`].tracker.association.$delete({param:{projectId:f()}}),`/tracker/association`)}function Ir(e){return{expectedScope:e.association?i(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 Lr(e={},t){return U(await B.api.v1.p[`:projectId`].tracker.$get({param:{projectId:f()},query:Ir(e)},V(t)),`/tracker`)}async function Rr(e,t={},n){return U(await B.api.v1.p[`:projectId`].tracker.search.$get({param:{projectId:f()},query:{...Ir(t),q:e}},V(n)),`/tracker/search`)}async function zr(e,t){return U(await B.api.v1.p[`:projectId`].tracker[`:id`].$get({param:{projectId:f(),id:encodeURIComponent(e)},query:{expectedScope:t?.association?i(t.association):void 0}},V(t)),`/tracker/${encodeURIComponent(e)}`)}async function Br(e,t){return U(await B.api.v1.p[`:projectId`].github.checks.$get({param:{projectId:f()},query:{prs:e.join(`,`)}},V(t)),`/github/checks`)}async function Vr(e,t,n={},r){return U(await B.api.v1.p[`:projectId`].github.search.$get({param:{projectId:f()},query:{kind:e,q:t,limit:n.limit}},V(r)),`/github/search`)}async function Hr(e,t,n){return U(await B.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(`,`)}:{}}},V(n)),`/github/ref-status`)}async function Ur(e,t,n={},r){return U(await B.api.v1.p[`:projectId`].github.comments[`:kind`][`:number`].$get({param:{projectId:f(),kind:e,number:String(t)},query:{refresh:n.refresh?`1`:void 0}},V(r)),`/github/comments/${e}/${t}`)}async function Wr(e,t={},n){return U(await B.api.v1.p[`:projectId`].github.prs[`:number`][`merge-state`].$get({param:{projectId:f(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},V(n)),`/github/prs/${e}/merge-state`)}async function Gr(e,t){return U(await B.api.v1.p[`:projectId`].github.prs[`:number`].merge.$post({param:{projectId:f(),number:String(e)},json:t}),`/github/prs/:number/merge`)}async function Kr(e,t={},n){return U(await B.api.v1.p[`:projectId`].github.prs[`:number`].changes.$get({param:{projectId:f(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},V(n)),`/github/prs/${e}/changes`)}function qr(e,t){return xn(G(e,`/diff`),{method:`GET`,signal:t?.signal})}function Jr(e,t){return xn(G(e,`/handoff`),{method:`GET`,signal:t?.signal})}async function Yr(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`].changes.$get({param:{projectId:f(),id:encodeURIComponent(e)}},V(t)),G(e,`/changes`))}async function Xr(e,t,n){return U(await B.api.v1.p[`:projectId`].runs[`:id`].files.$get({param:{projectId:f(),id:encodeURIComponent(e)},query:{path:t}},V(n)),`/runs/:id/files`)}function Zr(e,t,n){let r=n?`&rev=${encodeURIComponent(n)}`:``;return d(G(e,`/files?path=${encodeURIComponent(t)}&raw=1${r}`))}async function Qr(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`].artifacts.$get({param:{projectId:f(),id:encodeURIComponent(e)}},V(t)),G(e,`/artifacts`))}function $r(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}function ei(e,t,n){return xn(G(e,`/artifacts/${$r(t)}`),{method:`GET`,signal:n?.signal})}function ti(e,t,n){let r=n===void 0?``:`?v=${n}`;return d(G(e,`/artifacts/${$r(t)}${r}`))}function ni(e){return e.kind===`pr`?`pr:${e.number}`:`spec:${e.path}`}async function ri(e){return U(await B.api.v1.p[`:projectId`].impact.$post({param:{projectId:f()},json:e}),`/impact`)}async function ii(e,t){let n=ni(e);return W(await B.api.v1.p[`:projectId`].artifacts.$get({param:{projectId:f()},query:{subject:n}},V(t)),`/artifacts?subject=${encodeURIComponent(n)}`,re)}async function ai(e){return W(await B.api.v1.p[`:projectId`].assets.$get({param:{projectId:f()}},V(e)),`/assets`,u)}async function oi(e,t){return U(await B.api.v1.p[`:projectId`].groups[`:groupId`].$get({param:{projectId:f(),groupId:encodeURIComponent(e)}},V(t)),`/groups/${encodeURIComponent(e)}`)}async function si(e,t){return U(await B.api.v1.providers.connect.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/connect`)}async function ci(e){return U(await B.api.v1.providers[`:provider`].update.$post({param:{provider:e}}),`/providers/${encodeURIComponent(e)}/update`)}async function li(e,t){return I(await U(await B.api.v1.providers[`:provider`].enabled.$put({param:{provider:e},json:{enabled:t}}),`/providers/${encodeURIComponent(e)}/enabled`))}async function ui(e,t){return I(await U(await B.api.v1.providers[`:provider`].retry.$post({param:{provider:e},json:{authFailureId:t}}),`/providers/${encodeURIComponent(e)}/retry`))}async function di(e){let t=`/projects`,n=await bn(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({root:e})}),r=await H(n),i=R(r),a=i?.project;if((n.ok||n.status===409)&&a!=null)return i;throw n.ok?new L(n.status,`the cezar server answered ${t} without a project`):z(n.status,n.statusText,r)}async function fi(e){return U(await B.api.v1.projects.checkout.$post({json:e}),`/projects/checkout`)}async function pi(e){return U(await B.api.v1.projects.create.$post({json:e}),`/projects/create`)}async function mi(e){return W(await B.api.v1.projects[`github-owners`].$get({},V(e)),`/projects/github-owners`,ne)}async function hi(e){return U(await B.api.v1.projects[`:projectId`].$delete({param:{projectId:encodeURIComponent(e)}}),`/projects/${encodeURIComponent(e)}`)}async function gi(e,t){return U(await B.api.v1.projects[`:projectId`].$patch({param:{projectId:encodeURIComponent(e)},json:t}),`/projects/${encodeURIComponent(e)}`)}async function _i(e){return U(await B.api.v1.p[`:projectId`].runs.$post({param:{projectId:f()},json:e}),`/runs`)}async function vi(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].cancel.$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/cancel`))}async function yi(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].promote.$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/promote`))}async function bi(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`][`start-now`].$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/start-now`))}async function xi(e,t=!0,n){return U(await B.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:f(),id:encodeURIComponent(e)},json:{archived:t,...n?{surface:n}:{}}}),G(e,`/archive`))}async function Si(e,t=!0,n){return U(await B.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:f(),id:encodeURIComponent(e)},json:{pinned:t,...n?{surface:n}:{}}}),G(e,`/pin`))}async function Ci(e,t,n=!0,r){return U(await B.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{pinned:n,...r?{surface:r}:{}}}),G(t,`/pin`))}async function wi(e,t,n=!0,r){return U(await B.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{archived:n,...r?{surface:r}:{}}}),G(t,`/archive`))}async function Ti(e,t,n){let r=n?`read`:`unread`;return U(await(n?B.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:e,id:encodeURIComponent(t)}}):B.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:e,id:encodeURIComponent(t)}})),G(t,`/${r}`))}async function Ei(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`][`auto-resume`].$delete({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/auto-resume`))}async function Di(){return U(await B.api.v1.p[`:projectId`].runs[`archive-finished`].$post({param:{projectId:f()}}),`/runs/archive-finished`)}async function Oi(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/read`))}async function ki(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/unread`))}async function Ai(){return U(await B.api.v1.p[`:projectId`].runs[`read-all`].$post({param:{projectId:f()}}),`/runs/read-all`)}async function ji(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].land.$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/land`))}async function Mi(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].finish.$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/finish`))}async function Ni(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 U(await B.api.v1.p[`:projectId`].runs[`:id`].continue.$post({param:{projectId:f(),id:encodeURIComponent(e)},json:n}),G(e,`/continue`))}async function Pi(e,t,n={}){return U(await B.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}}}),G(t,`/continue`))}var Fi=1e3;async function Ii(e,t={}){let n=f(),r=async()=>U(await B.api.v1.p[`:projectId`].runs[`:id`].pr.$post({param:{projectId:n,id:encodeURIComponent(e)},json:t}),G(e,`/pr`));try{return await r()}catch(e){if(!(e instanceof L)||e.status!==0)throw e;await new Promise(e=>setTimeout(e,Fi));try{return await r()}catch(t){throw t instanceof L&&t.status===0?e:t}}}async function Li(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].pr.adopt.$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/pr/adopt`))}async function Ri(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`].$patch({param:{projectId:f(),id:encodeURIComponent(e)},json:t}),G(e))}async function zi(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].$delete({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e))}async function Bi(e){return U(await B.api.v1.p[`:projectId`].todos[`:id`].$delete({param:{projectId:f(),id:encodeURIComponent(e)}}),`/todos/${encodeURIComponent(e)}`)}async function Vi(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 U(await B.api.v1.p[`:projectId`].todos[`:id`].start.$post({param:{projectId:f(),id:encodeURIComponent(e)},json:Object.keys(n).length>0?n:void 0}),`/todos/${encodeURIComponent(e)}/start`)}async function Hi(e,t){return U(await B.api.v1.p[`:projectId`].groups[`:groupId`].pick.$post({param:{projectId:f(),groupId:encodeURIComponent(e)},json:{runId:t}}),`/groups/${encodeURIComponent(e)}/pick`)}async function Ui(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`][`open-in-cli`].$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/open-in-cli`))}async function Wi(e){return U(await B.api.v1.p[`:projectId`][`open-targets`].$get({param:{projectId:f()}},V(e)),`/open-targets`)}async function Gi(e){return U(await B.api.v1.p[`:projectId`][`open-in`].$post({param:{projectId:f()},json:{target:e}}),`/open-in`)}async function Ki(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:f(),id:encodeURIComponent(e)},json:{target:t}}),G(e,`/open-in`))}async function qi(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:f(),id:encodeURIComponent(e)},json:{target:`default`,path:t}}),G(e,`/open-in`))}async function Ji(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`].git.commit.$post({param:{projectId:f(),id:encodeURIComponent(e)},json:{message:t}}),G(e,`/git/commit`))}async function Yi(e,t,n=f()){return U(await B.api.v1.p[`:projectId`].runs[`:id`].git.status.$get({param:{projectId:n,id:encodeURIComponent(e)}},V(t)),G(e,`/git/status`))}async function Xi(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].git.push.$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/git/push`))}var Zi=[250,750,1500],Qi=e=>new Promise(t=>setTimeout(t,e));async function $i(e,t,n=Qi){let r={text:t.text??``,images:t.images??[],idempotencyKey:t.idempotencyKey??rn()};for(let t=0;;t+=1)try{return await e(r)}catch(e){let r=Zi[t];if(!(e instanceof L)||e.status!==0||r===void 0)throw e;await n(r)}}async function ea(e,t){return $i(async t=>U(await B.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:f(),id:encodeURIComponent(e)},json:t}),G(e,`/messages`)),t)}async function ta(e,t,n){return $i(async n=>U(await B.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:e,id:encodeURIComponent(t)},json:n}),G(t,`/messages`)),n)}async function na(e,t,n){return U(await B.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$patch({param:{projectId:f(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)},json:n}),G(e,`/queued-messages/${encodeURIComponent(t)}`))}async function ra(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$delete({param:{projectId:f(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)}}),G(e,`/queued-messages/${encodeURIComponent(t)}`))}async function ia(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`].drafts.$get({param:{projectId:f(),id:encodeURIComponent(e)}},V(t)),G(e,`/drafts`))}var aa=56*1024;async function oa(e,t,n,r){let i=r?.keepalive===!0&&new TextEncoder().encode(JSON.stringify(n)).length<=aa;return U(await B.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].$put({param:{projectId:f(),id:encodeURIComponent(e),surface:t},json:n},{init:{keepalive:i}}),G(e,`/drafts/${t}`))}async function sa(e,t,n){return U(await B.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images.$post({param:{projectId:f(),id:encodeURIComponent(e),surface:t},json:n}),G(e,`/drafts/${t}/images`))}async function ca(e){return U(await B.api.v1.workspace.uploads.$post({json:e}),`/workspace/uploads`)}async function la(e){return U(await B.api.v1.workspace.uploads[`:uploadId`].$delete({param:{uploadId:e}}),`/workspace/uploads/${e}`)}async function ua(e,t,n,r){return U(await B.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$get({param:{projectId:f(),id:encodeURIComponent(e),surface:t,imageId:n}},V(r)),G(e,`/drafts/${t}/images/${n}`))}async function da(e,t,n){return U(await B.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$delete({param:{projectId:f(),id:encodeURIComponent(e),surface:t,imageId:n}}),G(e,`/drafts/${t}/images/${n}`))}async function fa(e){return U(await B.api.v1.p[`:projectId`].repo.branch.$post({param:{projectId:f()},json:e}),`/repo/branch`)}async function pa(e){return U(await B.api.v1.p[`:projectId`].repo.sync.$get({param:{projectId:f()}},V(e)),`/repo/sync`)}async function ma(e){let t={param:{projectId:f()}},n=B.api.v1.p[`:projectId`].repo;return U(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 ha(e){return U(await B.api.v1.p[`:projectId`].plan.$post({param:{projectId:f()},json:{task:e}}),`/plan`)}async function ga(e){return U(await B.api.v1.p[`:projectId`].automations.$get({param:{projectId:f()}},V(e)),`/automations`)}async function _a(e){return U(await B.api.v1.p[`:projectId`].automations.$post({param:{projectId:f()},json:e}),`/automations`)}async function va(e,t){return U(await B.api.v1.p[`:projectId`].automations[`:id`].$put({param:{projectId:f(),id:encodeURIComponent(e)},json:t}),`/automations/${encodeURIComponent(e)}`)}async function ya(e,t){let n={projectId:f(),id:encodeURIComponent(e)},r=`/automations/${encodeURIComponent(e)}/${t?`enable`:`pause`}`;return U(t?await B.api.v1.p[`:projectId`].automations[`:id`].enable.$post({param:n}):await B.api.v1.p[`:projectId`].automations[`:id`].pause.$post({param:n}),r)}async function ba(e){let t=`/automations/${encodeURIComponent(e)}/work`;return U(await B.api.v1.p[`:projectId`].automations[`:id`].work.$get({param:{projectId:f(),id:encodeURIComponent(e)}}),t)}async function xa(e){let t=`/automations/${encodeURIComponent(e)}/cancel-queued`;return U(await B.api.v1.p[`:projectId`].automations[`:id`][`cancel-queued`].$post({param:{projectId:f(),id:encodeURIComponent(e)}}),t)}async function Sa(e,t){return U(await B.api.v1.p[`:projectId`].automations[`:id`].check.$post({param:{projectId:f(),id:encodeURIComponent(e)},json:{mode:t}}),`/automations/${encodeURIComponent(e)}/check`)}async function Ca(e,t){return U(await B.api.v1.p[`:projectId`][`automation-log`].$get({param:{projectId:f()},query:{automationId:e}},V(t)),`/automation-log?automationId=${encodeURIComponent(e)}`)}async function wa(e){return U(await B.api.v1.p[`:projectId`][`automation-log`][`:receiptId`].retry.$post({param:{projectId:f(),receiptId:encodeURIComponent(e)}}),`/automation-log/${encodeURIComponent(e)}/retry`)}async function Ta(e,t){return U(await B.api.v1.p[`:projectId`].automations[`:id`].run.$post({param:{projectId:f(),id:encodeURIComponent(e)},query:t?{expectedRevision:String(t)}:{}}),`/automations/${encodeURIComponent(e)}/run`)}async function Ea(e,t){let n=await B.api.v1.p[`:projectId`].automations[`:id`].$delete({param:{projectId:f(),id:encodeURIComponent(e)},query:t?{expectedRevision:String(t)}:{}});if(!n.ok)throw z(n.status,n.statusText,await H(n))}async function Da(e){return U(await B.api.v1.p[`:projectId`].automations.export.$get({param:{projectId:f()},query:e?.length?{ids:e.join(`,`)}:{}}),`/automations/export`)}async function Oa(e){return U(await B.api.v1.p[`:projectId`].automations.import.preview.$post({param:{projectId:f()},json:e}),`/automations/import/preview`)}async function ka(e){return U(await B.api.v1.p[`:projectId`].automations.import.$post({param:{projectId:f()},json:e}),`/automations/import`)}async function Aa(e,t){return U(await B.api.v1.workspace[`automation-templates`].$get({query:e?{exclude:e}:{}},V(t)),`/workspace/automation-templates`)}async function ja(e){return U(await B.api.v1.p[`:projectId`].workflows.$post({param:{projectId:f()},json:e}),`/workflows`)}async function Ma(e){return U(await B.api.v1.p[`:projectId`].workflows.nodes.$get({param:{projectId:f()}},V(e)),`/workflows/nodes`)}async function Na(e){return U(await B.api.v1.p[`:projectId`].workflows.validate.$post({param:{projectId:f()},json:{graph:e}}),`/workflows/validate`)}async function Pa(e){return U(await B.api.v1.p[`:projectId`].workflows.graph.$post({param:{projectId:f()},json:e}),`/workflows/graph`)}async function Fa(e){return U(await B.api.v1.p[`:projectId`].workflows.parse.$post({param:{projectId:f()},json:{yaml:e}}),`/workflows/parse`)}async function Ia(e){return U(await B.api.v1.p[`:projectId`].workflows[`:name`].$delete({param:{projectId:f(),name:encodeURIComponent(e)}}),`/workflows/${encodeURIComponent(e)}`)}async function La(e,t=f()){return U(await B.api.v1.p[`:projectId`][`ui-state`].$put({param:{projectId:t},json:e}),`/ui-state`)}async function Ra(e){return U(await B.api.v1.workspace[`ui-state`].$get({},V(e)),`/workspace/ui-state`)}async function za(e,t={}){return U(await B.api.v1.workspace[`ui-state`].$put({json:e},{init:{keepalive:t.keepalive}}),`/workspace/ui-state`)}async function Ba(e){let t=await U(await B.api.v1.workspace.config.$get({},V(e)),`/workspace/config`);return{...t,branding:t.branding?{...t.branding,logoUrl:t.branding.logoUrl?g(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 Va(e){let t=new FormData;t.set(`file`,e);let n=await bn(`/workspace/branding-logo`,{method:`POST`,body:t}),i=await H(n);if(!n.ok)throw z(n.status,n.statusText,i);let a=R(i),o=r.safeParse(a);if(!o.success)throw new L(n.status,`the cezar server answered /workspace/branding-logo with an unexpected body`);return o.data.logoUrl?g(o.data.logoUrl):null}async function Ha(){let e=await bn(`/workspace/branding-logo`,{method:`DELETE`}),t=await H(e);if(!e.ok)throw z(e.status,e.statusText,t);let n=r.safeParse(R(t));if(!n.success)throw new L(e.status,`the cezar server answered /workspace/branding-logo with an unexpected body`);return n.data.logoUrl?g(n.data.logoUrl):null}async function Ua(e){return U(await B.api.v1.workspace[`host-usage`].$get({},V(e)),`/workspace/host-usage`)}async function Wa(e){let t=await U(await B.api.v1.workspace[`agent-profiles`].$get({},V(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 Ga(e,t){return U(await B.api.v1.workspace[`agent-profiles`][`fallback-policy`].$get({query:e},V(t)),`/workspace/agent-profiles/fallback-policy`)}async function Ka(e,t){return U(await B.api.v1.workspace[`agent-profiles`][`fallback-policy`].$put({json:e},V(t)),`/workspace/agent-profiles/fallback-policy`)}async function qa(e){return U(await B.api.v1.workspace[`agent-profiles`].$post({json:e}),`/workspace/agent-profiles`)}async function Ja(e,t){return U(await B.api.v1.workspace[`agent-profiles`][`:id`].status.$get({param:{id:encodeURIComponent(e)},query:{...t?.refresh||t?.recheck?{refresh:`1`}:{},...t?.recheck?{recheck:`1`}:{}}},V(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/status`)}async function Ya(e,t){return U(await B.api.v1.workspace[`agent-profiles`][`:id`].details.$get({param:{id:encodeURIComponent(e)}},V(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/details`)}async function Xa(e,t){return U(await B.api.v1.workspace[`agent-profiles`][`:id`].open.$post({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}/open`)}async function Za(e){return U(await B.api.v1.workspace[`agent-profiles`].selection.$put({json:e}),`/workspace/agent-profiles/selection`)}async function Qa(e,t){return U(await B.api.v1.workspace[`agent-profiles`][`:id`].$patch({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function $a(e){return U(await B.api.v1.workspace[`agent-profiles`][`:id`].$delete({param:{id:encodeURIComponent(e)}}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function eo(e,t){return U(await B.api.v1.workspace[`skills-update`].$get({query:{projectId:e}},V(t)),`/workspace/skills-update?projectId=${encodeURIComponent(e)}`)}async function to(e){return U(await B.api.v1.workspace[`skills-update`].check.$post({json:{projectId:e}}),`/workspace/skills-update/check`)}async function no(e){return U(await B.api.v1.workspace[`skills-update`].apply.$post({json:{projectId:e}}),`/workspace/skills-update/apply`)}async function ro(e){return U(await B.api.v1.workspace[`self-update`].$get({},V(e)),`/workspace/self-update`)}async function io(){return U(await B.api.v1.workspace[`self-update`].refresh.$post({}),`/workspace/self-update/refresh`)}async function ao(e){return U(await B.api.v1.workspace[`self-update`].development.$get({query:e?.refresh?{refresh:`1`}:{}},V(e)),`/workspace/self-update/development`)}async function oo(e){return U(await B.api.v1.workspace[`self-update`].channel.$put({json:{channel:e}}),`/workspace/self-update/channel`)}async function so(e){return U(await B.api.v1.workspace[`self-update`].apply.$post({json:{version:e}}),`/workspace/self-update/apply`)}async function co(e){return U(await B.api.v1.workspace[`self-update`].apply.$post({json:{version:e,whenIdle:!0}}),`/workspace/self-update/apply`)}async function lo(){return U(await B.api.v1.workspace[`self-update`].scheduled.$delete({}),`/workspace/self-update/scheduled`)}async function uo(e){let t=await U(await B.api.v1.workspace.config.$put({json:e}),`/workspace/config`);return{...t,orgSkillsRepos:t.orgSkillsRepos??[]}}async function fo(e){return U(await B.api.v1.p[`:projectId`].config.$put({param:{projectId:f()},json:e}),`/config`)}async function po(e){return U(await B.api.v1.p[`:projectId`].worktrees.$get({param:{projectId:f()}},V(e)),`/worktrees`)}async function mo(){return U(await B.api.v1.p[`:projectId`].worktrees.reclaim.$post({param:{projectId:f()},json:{}}),`/worktrees/reclaim`)}async function ho(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`][`remove-worktree`].$post({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/remove-worktree`))}async function go(e,t,n){return ie.parse(await U(await B.api.v1.p[`:projectId`].tracker.watch.$post({param:{projectId:e},json:t},{init:{signal:n}}),`/tracker/watch`))}async function _o(e,t,n,r){return a.parse(await U(await B.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 vo(e,t,n){return a.parse(await U(await B.api.v1.p[`:projectId`].tracker.watch[`:watchId`].$post({param:{projectId:e,watchId:t}},{init:{signal:n}}),`/tracker/watch`))}var yo={list:async(e,t)=>U(await B.api.v1.p[`:projectId`].webhooks.$get({param:{projectId:e}},{init:{signal:t}}),`/webhooks`),create:async(e,t)=>U(await B.api.v1.p[`:projectId`].webhooks.$post({param:{projectId:e},json:t}),`/webhooks`),update:async(e,t,n)=>U(await B.api.v1.p[`:projectId`].webhooks[`:id`].$patch({param:{projectId:e,id:t},json:n}),`/webhooks`),remove:async(e,t,n)=>U(await B.api.v1.p[`:projectId`].webhooks[`:id`].$delete({param:{projectId:e,id:t},json:{expectedRevision:n}}),`/webhooks`),activate:async(e,t,n)=>U(await B.api.v1.p[`:projectId`].webhooks[`:id`].activate.$post({param:{projectId:e,id:t},json:{expectedRevision:n,confirmed:!0}}),`/webhooks`),pause:async(e,t,n)=>U(await B.api.v1.p[`:projectId`].webhooks[`:id`].pause.$post({param:{projectId:e,id:t},json:{expectedRevision:n}}),`/webhooks`),resume:async(e,t,n)=>U(await B.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)=>U(await B.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)=>U(await B.api.v1.p[`:projectId`].webhooks[`:id`].test.$post({param:{projectId:e,id:t},json:n}),`/webhooks`),retry:async(e,t,n)=>U(await B.api.v1.p[`:projectId`].webhooks.deliveries[`:deliveryId`].retry.$post({param:{projectId:e,deliveryId:t},json:n}),`/webhooks`),replay:async(e,t,n)=>U(await B.api.v1.p[`:projectId`].webhooks.deliveries[`:deliveryId`].replay.$post({param:{projectId:e,deliveryId:t},json:{...n,confirmed:!0}}),`/webhooks`),acknowledge:async(e,t)=>U(await B.api.v1.p[`:projectId`].webhooks.notice.acknowledge.$post({param:{projectId:e},json:{expectedChangeSequence:t}}),`/webhooks`),history:async(e,t)=>U(await B.api.v1.p[`:projectId`].webhooks.history.$get({param:{projectId:e},query:{limit:`100`,...t?{cursor:t}:{}}}),`/webhooks/history`),deliveries:async(e,t,n,r)=>U(await B.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)=>U(await B.api.v1.p[`:projectId`].webhooks[`:id`].activity.$get({param:{projectId:e,id:t}}),`/webhooks/activity`)};async function bo(e={limit:50},t){return U(await B.api.v1.p[`:projectId`][`worktree-lifecycle`].$get({param:{projectId:f()},query:{cursor:e.cursor,limit:e.limit,attentionOnly:e.attentionOnly===void 0?void 0:e.attentionOnly?`true`:`false`}},V(t)),`/worktree-lifecycle`)}async function xo(e,t){return U(await B.api.v1.p[`:projectId`][`worktree-lifecycle`][`:worktreeId`].$get({param:{projectId:f(),worktreeId:e}},V(t)),`/worktree-lifecycle`)}async function So(e,t){return U(await B.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].$get({param:{projectId:f(),operationId:e}},V(t)),`/worktree-lifecycle/operations`)}async function Co(e,t=0,n){return U(await B.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].output.$get({param:{projectId:f(),operationId:e},query:{afterSeq:t,limit:100}},V(n)),`/worktree-lifecycle/operations/output`)}async function wo(e,t=f()){return U(await B.api.v1.p[`:projectId`][`worktree-lifecycle`].operations.$post({param:{projectId:t},json:e}),`/worktree-lifecycle/operations`)}async function To(e,t){return U(await B.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].actions.$post({param:{projectId:f(),operationId:e},json:t}),`/worktree-lifecycle/operations/actions`)}async function Eo(e){return U(await B.api.v1.p[`:projectId`][`worktree-lifecycle`].preview.$post({param:{projectId:f()},json:e}),`/worktree-lifecycle/preview`)}async function Do(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].terminal.$get({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/terminal`))}async function Oo(e,t){return U(await B.api.v1.p[`:projectId`].runs[`:id`].terminal.$post({param:{projectId:f(),id:encodeURIComponent(e)},json:t}),G(e,`/terminal`))}async function ko(e,t,n){return U(await B.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].output.$get({param:{projectId:f(),id:encodeURIComponent(e),sessionId:t},query:{cursor:String(n)}}),G(e,`/terminal/${t}/output`))}async function Ao(e,t,n){await U(await B.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].input.$post({param:{projectId:f(),id:encodeURIComponent(e),sessionId:t},json:{data:n}}),G(e,`/terminal/${t}/input`))}async function jo(e,t,n,r){await U(await B.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].resize.$post({param:{projectId:f(),id:encodeURIComponent(e),sessionId:t},json:{cols:n,rows:r}}),G(e,`/terminal/${t}/resize`))}async function Mo(e,t){await U(await B.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].$delete({param:{projectId:f(),id:encodeURIComponent(e),sessionId:t}}),G(e,`/terminal/${t}`))}async function No(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].terminal.urls.$get({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/terminal/urls`))}async function Po(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].terminal.commands.$get({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/terminal/commands`))}async function Fo(){return U(await B.api.v1.p[`:projectId`][`start-app`].$get({param:{projectId:f()}}),`/start-app`)}async function Io(e){return U(await B.api.v1.p[`:projectId`][`start-app`].$put({param:{projectId:f()},json:e}),`/start-app`)}async function Lo(e){return U(await B.api.v1.p[`:projectId`].runs[`:id`].layouts.$get({param:{projectId:f(),id:encodeURIComponent(e)}}),G(e,`/layouts`))}async function Ro(e,t,n){let r=n?.keepalive===!0&&new TextEncoder().encode(JSON.stringify(t)).length<=aa;return U(await B.api.v1.p[`:projectId`].runs[`:id`].layouts.$put({param:{projectId:f(),id:encodeURIComponent(e)},json:t},{init:{keepalive:r}}),G(e,`/layouts`))}async function zo(e){return U(await B.api.v1.p[`:projectId`][`deferred-start`].preview.$post({param:{projectId:f()},json:e}),`/deferred-start/preview`)}async function Bo(e){return U(await B.api.v1.p[`:projectId`][`deferred-start`].$post({param:{projectId:f()},json:e}),`/deferred-start`)}async function Vo(e){return U(await B.api.v1.p[`:projectId`][`deferred-start`].options.$post({param:{projectId:f()},json:e}),`/deferred-start/options`)}async function Ho(e,t,n=f()){return U(await B.api.v1.p[`:projectId`].github.asset.$post({param:{projectId:n},json:{url:e}},V(t)),`/github/asset`)}function Uo(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!Wo(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return Go(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 Wo(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function Wo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Go(e){return Wo(e)&&typeof e.id==`string`&&e.id!==``}function Ko(e){return typeof e.task==`string`&&Array.isArray(e.steps)}function qo(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]=Yo(r,t),i}if(!Ko(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 Jo(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function Yo(e,t){let n={...t};if(!Ko(t)){let t=n;for(let n of v)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 Xo=Object.freeze({});function Zo(){let e=Xo,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 Qo={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`,tone:`success`},merged:{label:`Merged`,hint:`this landed on its base branch`,tone:`violet`},closed:{label:`Closed`,hint:`closed without merging — the work did not land`,tone:`danger`},open:{label:`Open`,hint:`still open on the tracker`,tone:`success`},completed:{label:`Closed as completed`,hint:`the issue was resolved`,tone:`violet`},"not-planned":{label:`Closed as not planned`,hint:`the issue was declined — nothing shipped for it`,tone:`neutral`}},$o={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function es(e){return typeof e==`string`&&Object.hasOwn(Qo,e)}function ts(e){return e!==void 0&&es(e)?Qo[e]:void 0}var ns={permission:0,error:1,waiting:2,running:3,unseen:4,none:5};function rs(e){return!1}function is(e){return!1}function as(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 K(e){return e.status===`failed`&&e.awaitingAnswerSince!==void 0}function os(e){return e.status===`failed`&&e.idleClosedAt!==void 0&&!K(e)}function ss(e){return!!e.worktreeLifecycle?.needsAttention||e.status===`waiting`||e.status===`review`||K(e)}function cs(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`}:rs(e)?{bucket:`permission`,tone:`violet`,pulse:!0,label:`needs permission`}:e.status===`failed`&&e.autoResumeAt?{bucket:`none`,tone:`pending`,pulse:!1,label:`scheduled`}:K(e)?{bucket:`waiting`,tone:`pending`,pulse:!0,label:`needs you`}:os(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:`pending`,pulse:!0,label:as(e)?.ceiling===void 0?`needs you`:`budget reached`}:e.status===`review`?{bucket:`waiting`,tone:`violet`,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`}:is(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 ls(e){return ns[cs(e).bucket]<=ns.waiting}var us=[`Pinned`,`Needs you`,`Working`,`Recent`,`Archived`],ds={waiting:0,review:1,running:2,queued:4,done:5,failed:5,cancelled:5},fs=3,ps=e=>e.status===`failed`&&e.autoResumeAt!==void 0?fs:K(e)?ds.waiting??0:ds[e.status]??9;function ms(e,t){return t===`archived`?`Archived`:e.pinned?`Pinned`:ss(e)?`Needs you`:e.status===`running`||e.status===`queued`||e.status===`failed`&&e.autoResumeAt?`Working`:`Recent`}function hs(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function gs(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 _s(e,t){return t!==void 0&&gs(e).ref===t}function vs(e){return e.title.replace(/ \([A-C]\)$/,``)}function ys(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 bs(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort(ys);return new Map(t.map((e,t)=>[e.id,t+1]))}var xs=[{value:`recent`,label:`Recent`},{value:`created`,label:`Created`}];function Ss(e,t){let n=Date.parse(e),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?t.localeCompare(e):r-n}function Cs(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&&Ss(e,t)<0&&(t=e)}return t}function ws(e,t){return t===`created`?e.createdAt:Cs(e)}function Ts(e){return e===`created`?`Created`:`Updated`}function Es(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 Ds(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=ps(e)-ps(n);if(r!==0)return r;if(ps(e)===fs&&e.autoResumeAt&&n.autoResumeAt){let t=e.autoResumeAt.localeCompare(n.autoResumeAt);if(t!==0)return t}return e.status===`queued`&&n.status===`queued`?ys(e,n):Ss(Cs(e),Cs(n))})}function Os(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 Ss(ws(e,n),ws(r,n))})}function ks(e,t){let n=bs(e),r=Ds(e,t),i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])},o=new Set;for(let e of r){if(e.groupId){if(o.has(e.groupId))continue;o.add(e.groupId);let n=r.filter(t=>t.groupId===e.groupId).sort((e,t)=>(e.variant??``).localeCompare(t.variant??``));if(n.length>1){a(ms(e,t),{kind:`group`,groupId:e.groupId,title:vs(e),members:n});continue}}a(ms(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null})}return us.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function As(e,t){let n=[],r=t;for(let t of e){if(t.label===`Pinned`){n.push({label:t.label,rows:[...t.rows]});continue}if(r<=0)continue;let e=t.rows.slice(0,r);r-=e.length,n.push({label:t.label,rows:e})}return n}function js(e){let t=0,n=0,r=0;for(let i of e){if(i.archived){n+=1;continue}t+=1,ss(i)&&(r+=1)}return{active:t,archived:n,waiting:r}}var Ms=new Set([`running`,`waiting`]),Ns=new Set([`done`,`failed`,`review`,`cancelled`]),Ps=new Set([`done`,`failed`,`cancelled`]);function Fs(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 Is(e){return e?`$${e>=10?e.toFixed(0):e.toFixed(2)}`:``}function Ls(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 Rs(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 zs(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[hs(e),e.branch??``,e.workflow,Rs(e)].some(e=>e.toLowerCase().includes(n))):[...e]}function Bs(e){return e.filter(e=>!e.archived&&Ps.has(e.status)&&!K(e)).length}function Vs(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 Hs(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 Us(e){return Ws(e)[0]?.url??Gs(e)[0]}function Ws(e,t){if(!e.prRefs?.length)return Gs(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??Qs(`PR`,e.number,t),origin:e.origin}))}function Gs(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 Ks(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.markerRefs?.issue??e.issueNumber;if(!(!n||!t)&&!qs(e.referencedIssueCandidates,n,t))return`${t}/issues/${n}`}function qs(e,t,n){let r=`${n.toLowerCase()}/`;return(e??[]).some(e=>e.endsWith(`/${t}`)&&!e.toLowerCase().startsWith(r))}function Js(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 Ys(e,t){let n=e.prRefs?.length?Ws(e,t).map(e=>({number:e.number,url:e.url})):Gs(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:Zs(e,t)},{kind:`Issue`,url:Ks(e,t)},{kind:`Issue`,number:Xs(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??Qs(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 Xs(e,t){let n=e.issueNumber;return n===void 0||!t?n:qs(e.referencedIssueCandidates,n,t)?void 0:n}function Zs(e,t){let n=e.prNumber;return n===void 0||!t?n:qs(e.referencedPrCandidates,n,t)?void 0:n}function Qs(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function $s(e,t){return Ys(e,t)[0]}function q(e){let t=e.split(`/`).pop()??``;return/^\d+$/.test(t)?t:null}function ec(e,t){let n=Ms.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:Fs(n.rssBytes),kind:`live`}};let r=Fs(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 tc(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=>Ns.has(e.status))?[]:[{groupId:e,title:vs(n),count:t.length}]})}function nc(e){return 220+Math.max(0,e)*14}function rc(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 ic(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 ac(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 oc=`/api/v1/ws`,sc=3e3,cc=1e3,lc=7e4,uc=0,dc=1;function fc(e){let t=new Map,n=new Map,r=null,i,a,o,s=()=>{clearTimeout(o),o=setTimeout(()=>{o=void 0,r?.close()},lc)},c=()=>e??`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${oc}`,l=e=>{r?.readyState===dc&&r.send(JSON.stringify(e))},u=()=>{let e=globalThis.WebSocket;if(typeof e!=`function`||r&&(r.readyState===uc||r.readyState===dc))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()},sc)))}),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)},cc))))}}}}var pc=null;function mc(e,t,n){return pc??=fc(),pc.subscribe(e,t,n)}var J={secrets:{allFor:e=>[`secrets`,e],list:()=>[`secrets`,f()]},e2e:{allFor:e=>[`e2e`,e],status:()=>[`e2e`,f()]},tracker:{allFor:e=>[`tracker`,e],all:()=>[`tracker`,f()],associationFor:e=>[`tracker`,e,`association`],association:()=>[`tracker`,f(),`association`],candidates:(e,t=``)=>[`tracker`,f(),`candidates`,e,t],connection:()=>[`tracker`,f(),`connection`],items:(e,t)=>[`tracker`,f(),`items`,e.kind,e.source.id,e.source.webUrl,e.externalId,e.connectionId??null,t.state,[...t.labels],t.query??``],detail:(e,t)=>[`tracker`,f(),`detail`,e.kind,e.source.id,e.source.webUrl,e.externalId,e.connectionId??null,t]},get health(){return[f(),`health`]},runs:{get all(){return[f(),`runs`]},list:()=>[f(),`runs`,`list`],detail:e=>[f(),`runs`,`detail`,e],diff:e=>[f(),`runs`,`diff`,e],changes:e=>[f(),`runs`,`changes`,e],gitStatus:e=>[f(),`runs`,`git-status`,e],file:(e,t)=>[f(),`runs`,`files`,e,t],artifacts:e=>[f(),`runs`,`artifacts`,e],impactSubject:e=>[f(),`runs`,`impact-subject`,e],get impactSubjects(){return[f(),`runs`,`impact-subject`]},get projectAssets(){return[f(),`runs`,`project-assets`]},artifactText:(e,t,n)=>[f(),`runs`,`artifact-text`,e,t,n],handoff:e=>[f(),`runs`,`handoff`,e],drafts:e=>[f(),`runs`,`drafts`,e],commits:e=>[f(),`runs`,`commits`,e],tree:e=>[f(),`runs`,`tree`,e],commit:(e,t)=>[f(),`runs`,`commit`,e,t]},groups:{detail:e=>[f(),`groups`,e]},get todos(){return[f(),`todos`]},get workflows(){return[f(),`workflows`]},get workflowNodes(){return[f(),`workflow-nodes`]},get skills(){return[f(),`skills`]},get skillsReady(){return[f(),`skills`,`ready`]},get importableSkills(){return[f(),`skills`,`importable`]},get importableSkillsReady(){return[f(),`skills`,`importable`,`ready`]},get launchKey(){return[f(),`launch-key`]},get repo(){return[f(),`repo`]},get repoChanges(){return[f(),`repo`,`changes`]},repoCommit:e=>[f(),`repo`,`commit`,e],get repoSync(){return[f(),`repo`,`sync`]},get repoTree(){return[f(),`repo`,`tree`]},repoFile:e=>[f(),`repo`,`file`,e],get uiState(){return[f(),`ui-state`]},get config(){return[f(),`config`]},get agentConfig(){return[f(),`agent-config`]},agentConfigFile:e=>[f(),`agent-config`,`file`,e],get worktrees(){return[f(),`worktrees`]},github:(e={})=>[f(),`github`,e.limit??null],githubPages:(e=50)=>[f(),`github`,`pages`,e],githubChecks:e=>[f(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[f(),`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)=>[f(),`github`,`comments`,e,t],githubMergeState:e=>[f(),`github`,`merge-state`,e],get openTargets(){return[f(),`open-targets`]}},hc=6e4;function gc(){return j({queryKey:J.secrets.list(),queryFn:({signal:e})=>Cr({signal:e})})}function _c(){return j({queryKey:Y.secrets,queryFn:({signal:e})=>wr({signal:e})})}function vc(){return j({queryKey:J.e2e.status(),queryFn:({signal:e})=>Ar({signal:e})})}function yc(){return j({queryKey:J.tracker.connection(),queryFn:({signal:e})=>br({signal:e})})}function bc(){return j({queryKey:J.tracker.association(),queryFn:({signal:e})=>Mr({signal:e})})}function xc(e,t,n){return N({queryKey:J.tracker.candidates(e,t),staleTime:hc,queryFn:({pageParam:n,signal:r})=>Nr(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 Sc=class extends Error{failure;constructor(e){super(e.reason),this.failure=e,this.name=`TrackerRefreshError`}};function Cc(e,t,n=!0){let r=t.query.trim(),i=A(),a=e?J.tracker.items(e,{...t,query:r}):[`tracker`,f(),`items`,`unassociated`];return{...N({queryKey:a,staleTime:1/0,queryFn:({pageParam:n,signal:i})=>r?Rr(r,{association:e??void 0,cursor:n,limit:50,state:t.state,labels:t.labels,refresh:!0},{signal:i}):Lr({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 Rr(r,i,{signal:n}):await Lr(i,{signal:n});if(!a.available)throw new Sc(a);return a}})}catch{}}}}function wc(e,t){return j({staleTime:hc,queryKey:e&&t?J.tracker.detail(e,t):[`tracker`,f(),`detail`,`disabled`],queryFn:({signal:n})=>zr(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 j({queryKey:Y.models(e),queryFn:({signal:t})=>c(e)?Dn(e,{signal:t}):Promise.reject(Error(`${e} has no host model catalog`)),staleTime:300*1e3,enabled:t&&c(e)})}function Tc(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 Ec(){let e=A();return j({queryKey:Y.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(Y.providerStatus),r=await On(!1,{signal:t});return Yt(n,e.getQueryData(Y.providerStatus),r)},staleTime:5*6e4,refetchInterval:!1,refetchOnWindowFocus:!0})}function Dc(){let e=A();return M({mutationFn:()=>On(!0),onMutate:()=>e.getQueryData(Y.providerStatus),onSuccess:(t,n,r)=>e.setQueryData(Y.providerStatus,e=>Yt(r,e,t))})}function Oc(){return j({queryKey:Y.agentSetup,queryFn:({signal:e})=>Rn({signal:e}),retry:!1,gcTime:0,refetchInterval:e=>{let t=e.state.data;return t?.available&&t.session?.exitCode===null?kc:!1},refetchIntervalInBackground:!0})}var kc=1e3;function Ac(){let e=A();return(0,k.useCallback)(()=>void e.invalidateQueries({queryKey:J.health}),[e])}function jc(){let e=A();return M({mutationFn:({provider:e,action:t})=>zn(e,t),retry:!1,onSuccess:t=>e.setQueryData(Y.agentSetup,e=>e?.available?{...e,session:t}:e),onSettled:()=>e.invalidateQueries({queryKey:Y.agentSetup})})}function Mc(){let e=A();return M({mutationFn:e=>Un(e),retry:!1,onSettled:()=>e.invalidateQueries({queryKey:Y.agentSetup})})}function Nc(){let e=A();return M({mutationFn:({provider:e,authFailureId:t})=>ui(e,t),onMutate:()=>e.getQueryData(Y.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(Y.providerStatus,e=>Yt(r,e,t,n.authFailureId))}})}function Pc(){return j({queryKey:Y.projects,queryFn:({signal:e})=>An({signal:e})})}function Fc(e,t=!1){return j({queryKey:Y.fsBrowse(e,t),queryFn:({signal:n})=>jn(e??void 0,{signal:n,showHidden:t}),retry:!1})}function Ic(){let e=A();return M({mutationFn:e=>di(e),onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function Lc(){let e=A();return M({mutationFn:e=>hi(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:Y.projects})}})}function Rc(){let e=A();return M({mutationFn:e=>{let{id:t,...n}=e;return gi(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?zc(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 zc(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?[]:ac(s);return c.length>0&&(a.tags=c),a}function Bc(e){let t=A();return M({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:Y.agentProfiles}),t.invalidateQueries({queryKey:Y.projects})])}})}function Vc(){return Bc(e=>qa(e))}function Hc(){return Bc(e=>{let{id:t,...n}=e;return Qa(t,n)})}function Uc(){return Bc(e=>$a(e))}function Wc(){return Bc(e=>Za(e))}function Gc(e,t){return j({queryKey:Y.agentAccountDetails(e),queryFn:({signal:t})=>Ya(e,{signal:t}),enabled:t,staleTime:0,retry:!1})}function Kc(e,t){return j({queryKey:Y.agentAccountStatus(e),queryFn:({signal:t})=>Ja(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function qc(){let e=A();return M({mutationFn:({provider:e,profileId:t})=>si(e,t),retry:!1,onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Y.agentProfiles}),e.invalidateQueries({queryKey:Y.providerStatus})])}})}function Jc(){let e=A();return M({mutationFn:e=>Ja(e,{recheck:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(Y.agentAccountStatus(n),t),e.invalidateQueries({queryKey:Y.agentProfiles})}})}function Yc(){return M({mutationFn:e=>{let{routeId:t,...n}=e;return Xa(t,n)},retry:!1})}function Xc(){let e=A();return M({mutationFn:e=>fi(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function Zc(){let e=A();return M({mutationFn:e=>pi(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function Qc(e=!0){return j({queryKey:Y.repoSuggestions,queryFn:({signal:e})=>Mn({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function $c(){let e=A();return M({mutationFn:e=>Nn(e),retry:!1,onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:Y.projects}),e.invalidateQueries({queryKey:J.repo}),e.invalidateQueries({queryKey:J.health})])})}function el(){let e=A();return M({mutationFn:({projectId:e,owner:t,name:n})=>Pn(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 tl(e){let t=A(),n=(0,k.useRef)(e);n.current=e;let r=(0,k.useRef)(!1),i=M({mutationFn:Fn,retry:!1,onMutate:()=>{r.current=!0,t.setQueryData(Y.githubLogin,{status:`starting`})},onSuccess:e=>t.setQueryData(Y.githubLogin,e)}),a=M({mutationFn:Ln,retry:!1,onMutate:()=>{r.current=!1},onSuccess:e=>t.setQueryData(Y.githubLogin,e)}),o=j({queryKey:Y.githubLogin,queryFn:({signal:e})=>In({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,k.useEffect)(()=>{c!==`done`||!r.current||(r.current=!1,Promise.all([t.invalidateQueries({queryKey:Y.githubOwners}),t.invalidateQueries({queryKey:Y.projects}),t.invalidateQueries({queryKey:[f(),`github`]}),t.invalidateQueries({queryKey:J.repo}),t.invalidateQueries({queryKey:J.health})]),n.current?.(l))},[c,l,t]),{state:s,start:i,cancel:a}}function nl(){return j({queryKey:Y.githubOwners,queryFn:({signal:e})=>mi({signal:e}),staleTime:5*6e4,retry:!1})}function rl(){let e=A();(0,k.useEffect)(()=>{let t,n=()=>{let n=e.getQueryData(J.health)?.capabilities?.localHandoff===!0;n&&t===void 0?t=mc(`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 il(){return j({queryKey:J.health,queryFn:({signal:e})=>Sn({signal:e}),refetchInterval:e=>ol(e.state.data)})}var al=3e4;function ol(e){return e?.capabilities?.localHandoff===!1&&e.forge!=null&&e.forge.available!==!0&&al}function sl(){let e=il().data,t=Pc().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?Vs(e?.repo?.remote,e?.forge?.kind===`github`):void 0}function cl(){return j({queryKey:J.openTargets,queryFn:({signal:e})=>Wi({signal:e}),staleTime:5*6e4})}function ll(e){return j({queryKey:J.runs.list(),queryFn:({signal:e})=>Wn({signal:e}),select:e})}function ul(e=!0,t){return j({queryKey:Y.runsIndex,queryFn:({signal:e})=>Kn({signal:e}),enabled:e,staleTime:3e4,...t===void 0?{}:{refetchInterval:typeof t==`function`?e=>t(e.state.data):t}})}function dl(e,t=!0,n=!1,r){return j({queryKey:[n?`default`:e,`runs`,`list`],queryFn:({signal:t})=>Gn(e,{signal:t}),enabled:t,select:r})}function fl(e,t,n){let r=e==="default"?null:e,i=r===null||t!=null&&r===t;return dl(i?`default`:r??`default`,!0,i,n)}function pl(e){return{queryKey:J.runs.detail(e),queryFn:({signal:t})=>qn(e,{signal:t})}}function ml(e){return j({...pl(e??``),enabled:!!e})}function hl(e,t,n=!0){return j({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Jn(e,t,{signal:n}),enabled:n&&!!e&&!!t})}function gl(e){return j({queryKey:J.runs.diff(e??``),queryFn:({signal:t})=>qr(e,{signal:t}),enabled:!!e})}function _l(e,t=!1){return j({queryKey:J.runs.changes(e??``),queryFn:({signal:t})=>Yr(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?4e3:!1,refetchOnWindowFocus:!0,staleTime:0})}function vl(e,t,n=!1){return j({queryKey:J.runs.gitStatus(e),queryFn:({signal:t})=>Yi(e,{signal:t}),enabled:t,retry:!1,refetchInterval:n?1e4:!1,refetchOnWindowFocus:!0,staleTime:0})}function yl(e,t=!0){return j({queryKey:J.runs.tree(e??``),queryFn:({signal:t})=>hr(e,{signal:t}),enabled:t&&!!e,retry:!1,staleTime:0})}function bl(e,t){return j({queryKey:J.runs.file(e??``,t??``),queryFn:({signal:n})=>Xr(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function xl(e){return j({queryKey:J.runs.artifacts(e??``),queryFn:({signal:t})=>Qr(e,{signal:t}),enabled:!!e,retry:!1})}function Sl(e,t,n){return j({queryKey:J.runs.artifactText(e,t??``,n??``),queryFn:({signal:n})=>ei(e,t,{signal:n}),enabled:t!==void 0&&n!==void 0,retry:!1,staleTime:1/0})}function Cl(e){return j({queryKey:J.runs.impactSubject(e?ni(e):``),queryFn:({signal:t})=>ii(e,{signal:t}),enabled:e!==null,retry:!1})}function wl(){return j({queryKey:J.runs.projectAssets,queryFn:({signal:e})=>ai({signal:e}),retry:!1})}function Tl(){let e=A();return M({mutationFn:e=>ri(e),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:J.runs.impactSubject(ni(n.subject))}),e.invalidateQueries({queryKey:J.runs.list()})}})}function El(e){return j({queryKey:J.groups.detail(e??``),queryFn:({signal:t})=>oi(e,{signal:t}),enabled:!!e})}function Dl(e,t=!1){return j({queryKey:J.runs.commits(e??``),queryFn:({signal:t})=>gr(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?5e3:!1})}function Ol(e,t){return j({queryKey:J.runs.commit(e??``,t??``),queryFn:({signal:n})=>_r(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function kl(e,t=!0){return j({queryKey:J.runs.handoff(e??``),queryFn:({signal:t})=>Jr(e,{signal:t}),enabled:!!e&&t})}function Al(e){return j({queryKey:J.runs.drafts(e??``),queryFn:({signal:t})=>ia(e,{signal:t}),enabled:!!e,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1})}function jl(e=!0){return j({queryKey:J.todos,queryFn:({signal:e})=>ir({signal:e}),enabled:e})}function Ml(){return j({queryKey:J.workflowNodes,queryFn:({signal:e})=>Ma({signal:e}),staleTime:1/0})}function Nl(e={}){return j({queryKey:J.workflows,enabled:e.enabled??!0,queryFn:({signal:e})=>Qn({signal:e})})}function Pl(e=!0){let t=A(),n=J.skills,r=n[0],i=j({queryKey:n,queryFn:({signal:e})=>$n({signal:e}),enabled:e}),a=j({queryKey:J.skillsReady,queryFn:({signal:e})=>er({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,k.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`],a.data)},[t,a.data,r]),i}function Fl(e=!0){let t=A(),n=J.importableSkills,r=n[0],i=j({queryKey:n,queryFn:({signal:e})=>nr({signal:e}),enabled:e}),a=j({queryKey:J.importableSkillsReady,queryFn:({signal:e})=>rr({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,k.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`,`importable`],a.data)},[t,a.data,r]),i}function Il(){return j({queryKey:J.launchKey,queryFn:({signal:e})=>kn({signal:e}),staleTime:1/0})}function Ll(){return j({queryKey:J.repo,queryFn:({signal:e})=>ar({signal:e})})}function Rl(){return j({queryKey:J.repoSync,queryFn:({signal:e})=>pa({signal:e}),refetchOnWindowFocus:!0})}function zl(){let e=A();return M({mutationFn:e=>ma(e),onSuccess:t=>{e.setQueryData(J.repoSync,t.sync),e.invalidateQueries({queryKey:J.repo,predicate:e=>e.queryKey[2]!==`sync`})}})}function Bl(){return j({queryKey:J.repoChanges,queryFn:({signal:e})=>ur({signal:e}),retry:!1})}function Vl(){return j({queryKey:J.repoTree,queryFn:({signal:e})=>dr({signal:e}),retry:!1,refetchOnWindowFocus:!0,staleTime:0})}function Hl(e){return j({queryKey:J.repoFile(e??``),queryFn:({signal:t})=>fr(e,{signal:t}),enabled:e!==void 0&&e!==``,retry:!1,refetchOnWindowFocus:!0,staleTime:0})}function Ul(e){return j({queryKey:J.repoCommit(e??``),queryFn:({signal:t})=>mr(e,{signal:t}),enabled:!!e,retry:!1})}function Wl(){return j({queryKey:J.config,queryFn:({signal:e})=>or({signal:e})})}function Gl(){return j({queryKey:J.worktrees,queryFn:({signal:e})=>po({signal:e})})}function Kl(){return j({queryKey:J.uiState,queryFn:({signal:e})=>Zn({signal:e})})}function ql(){return j({queryKey:J.agentConfig,queryFn:({signal:e})=>sr({signal:e})})}function Jl(e){return j({queryKey:J.agentConfigFile(e??``),queryFn:({signal:t})=>cr(e,{signal:t}),enabled:e!==null})}function Yl(e){let t=A(),n=J.agentConfig,r=J.agentConfigFile(e);return M({mutationFn:t=>lr(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}function Xl(){return j({queryKey:Y.uiState,queryFn:({signal:e})=>Ra({signal:e})})}function Zl(){return j({queryKey:Y.config,queryFn:({signal:e})=>Ba({signal:e})})}function Ql(){return j({queryKey:Y.agentProfiles,queryFn:({signal:e})=>Wa({signal:e})})}function $l(e){return j({queryKey:Y.agentFallbackPolicy(e??`default`),queryFn:({signal:t})=>Ga({projectId:e??`default`},{signal:t}),enabled:e!==null,retry:!1})}function eu(e){let t=A();return M({mutationFn:t=>Ka({projectId:e??`default`,...t}),retry:!1,onSuccess:n=>t.setQueryData(Y.agentFallbackPolicy(e??`default`),n)})}var tu=15*6e4;function nu(e=!0){let t=A();return(0,k.useEffect)(()=>{if(e)return t.getQueryCache().subscribe(e=>{e.type!==`updated`||e.action.type!==`success`||e.action.manual||e.query.queryHash!==iu&&t.prefetchQuery(ru)})},[e,t]),j({...ru,enabled:e,refetchOnMount:!1})}var ru={queryKey:Y.starCount,queryFn:({signal:e})=>Cn({signal:e}),staleTime:tu,retry:!1},iu=T(Y.starCount);function au(){return j({queryKey:Y.telemetryConsent,queryFn:({signal:e})=>Tn({signal:e}),staleTime:1/0,retry:!1})}var ou=6;function su(e,t=!0){return j({queryKey:Y.skillsUpdate(e),queryFn:({signal:t})=>eo(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<ou)&&6e4}})}function cu(e=!0){return j({queryKey:Y.selfUpdate,queryFn:({signal:e})=>ro({signal:e}),enabled:e,refetchInterval:e=>e.state.data?.job?.status===`running`?1e3:e.state.data?.scheduled?5e3:!1})}function lu(e=!0){return j({queryKey:Y.selfUpdateDevelopment,queryFn:({signal:e})=>ao({signal:e}),enabled:e,staleTime:3e4})}function uu(){let e=A();return M({mutationFn:()=>ao({refresh:!0}),onSuccess:t=>e.setQueryData(Y.selfUpdateDevelopment,t)})}function du(){let e=A();return M({mutationFn:()=>io(),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function fu(){let e=A();return M({mutationFn:e=>oo(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function pu(){let e=A();return M({mutationFn:e=>so(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function mu(){let e=A();return M({mutationFn:e=>co(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function hu(){let e=A();return M({mutationFn:()=>lo(),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function gu(e){let t=A();return M({mutationFn:t=>Ri(e,t),onSuccess:e=>{_u(t,e),t.invalidateQueries({queryKey:J.runs.all})}})}function _u(e,t){e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t.id?Yo(e,t):e)),e.setQueryData(J.runs.detail(t.id),e=>e?Yo(e,t):t),vu(e)}function vu(e){e.invalidateQueries({queryKey:Y.runsIndex})}function yu(){let e=A();return M({mutationFn:e=>Oi(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),vu(e)}})}function bu(){let e=A();return M({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));return e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t?xu(e):e)),e.setQueryData(J.runs.detail(t),e=>e&&xu(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?xu(e):e;e.setQueryData(J.runs.list(),e=>e?.map(n)),e.setQueryData(J.runs.detail(t.id),e=>e?n(e):t),vu(e)}})}function xu(e){let{seenAt:t,...n}=e;return n}function Su(e,t,n){let r=A();return M({mutationFn:({id:n,pinned:r,surface:i})=>t===void 0?Si(n,r,i??e):Ci(t,n,r,i??e),onSuccess:()=>r.invalidateQueries({queryKey:n===void 0?J.runs.all:[n,`runs`]})})}function Cu(e,t,n){let r=A();return M({mutationFn:({id:n,archived:r})=>t===void 0?xi(n,r,e):wi(t,n,r,e),onSuccess:()=>r.invalidateQueries({queryKey:n===void 0?J.runs.all:[n,`runs`]})})}function wu(e,t){let n=A();return M({mutationFn:n=>t===void 0?ea(e,n):ta(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:J.runs.all}),onError:e=>{e instanceof L&&e.status===409&&n.invalidateQueries({queryKey:J.runs.all})}})}function Tu(e,t){let n=A();return M({mutationFn:(n={})=>t===void 0?Ni(e,n):Pi(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:J.runs.all})})}function Eu(e){let t=A();return M({mutationFn:({msgId:t,message:n})=>na(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function Du(e){let t=A();return M({mutationFn:t=>ra(e,t),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function Ou(e={},t=!0){return j({queryKey:J.github(e),queryFn:({signal:t})=>vr({limit:e.limit},{signal:t}),enabled:t})}function ku(e=50,t=!0){return N({queryKey:J.githubPages(e),queryFn:({pageParam:t,signal:n})=>vr({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 Au(e,t=!0){return j({queryKey:J.githubChecks(e),queryFn:({signal:t})=>Br(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function ju(e,t,n=!0){return j({queryKey:J.githubSearch(e,t),queryFn:({signal:n})=>Vr(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var Mu=100;function Nu(e){return[...e].sort((e,t)=>t-e).slice(0,Mu).sort((e,t)=>e-t)}var Z=new Map(zu()),Pu=1e3;function Fu(e,t){if(Z.get(e)!==t){for(Z.delete(e),Z.set(e,t);Z.size>Pu;){let e=Z.keys().next().value;if(e===void 0)break;Z.delete(e)}Hu()}}var Q=new Set(Bu());function Iu(e,t){if(Q.has(e)!==t){if(t)for(Q.add(e);Q.size>Pu;){let e=Q.values().next().value;if(e===void 0)break;Q.delete(e)}else Q.delete(e);Hu()}}var Lu=`cez.reference-statuses.v1`,Ru=`cez.reference-conflicts.v1`;function zu(){try{let e=globalThis.sessionStorage?.getItem(Lu);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`&&es(e[1])):[]}catch{return[]}}function Bu(){try{let e=globalThis.sessionStorage?.getItem(Ru);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var Vu;function Hu(){Vu===void 0&&(Vu=setTimeout(()=>{Vu=void 0;try{globalThis.sessionStorage?.setItem(Lu,JSON.stringify([...Z])),globalThis.sessionStorage?.setItem(Ru,JSON.stringify([...Q]))}catch{}},250))}function Uu(){let e=Bt(),t=il();return e.projectId??t.data?.bootProject}function Wu(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))Fu($({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))Fu($({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var Gu=5*6e4;function Ku(e){return e?e.recheckAfterMs:Gu}var $=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function qu(e,t=!0){let n=(0,k.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:Nu(t.prs),issues:Nu(t.issues)}))},[e.map($).sort().join(`|`)]),r=It({queries:n.map(e=>({queryKey:J.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>Hr(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>Ku(e.state.data)??1/0,refetchInterval:e=>Ku(e.state.data)??!1,refetchOnWindowFocus:!0}))}),{byRef:i,learned:a}=(0,k.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,k.useEffect)(()=>{for(let{key:e,status:t,conflicting:n}of a)Fu(e,t),n!==void 0&&Iu(e,n)},[a]),(0,k.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 Ju(e,t,n=!0){return j({queryKey:J.githubComments(e,t),queryFn:({signal:n})=>Ur(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Yu(e){return j({queryKey:[`github`,`pr-changes`,e??0],queryFn:({signal:t})=>Kr(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{Pc as $,Kt as $a,oa as $i,cs as $n,or as $r,bc as $t,tl as A,li as Aa,xo as Ai,Us as An,si as Ar,bl as At,Ac as B,ci as Ba,Ui as Bi,Cs as Bn,zi as Br,mu as Bt,vc as C,Er as Ca,Fo as Ci,Fs as Cn,C as Co,xa as Cr,Sl as Ct,Au as D,Or as Da,Ua as Di,Ls as Dn,to as Dr,Dl as Dt,Ou as E,Pa as Ea,Lr as Ei,Js as En,b as Eo,Sa as Er,Ol as Et,il as F,bi as Fa,Gr as Fi,xs as Fn,_i as Fr,X as Ft,cl as G,Ao as Ga,ha as Gi,Ds as Gn,Da as Gr,fu as Gt,yu as H,Na as Ha,Fa as Hi,bs as Hn,la as Hr,cu as Ht,rl as I,Vi as Ia,wn as Ii,As as In,Ii as Ir,ll as It,wl as J,sn as Ja,zo as Ji,ws as Jn,Ja as Jr,nu as Jt,gu as K,pn as Ka,sa as Ki,Os as Kn,Mi as Kr,Pl as Kt,Cl as L,Mo as La,Gi as Li,Ss as Ln,Oo as Lr,fl as Lt,Yu as M,ca as Ma,ka as Mi,Ys as Mn,_a as Mr,kl as Mt,ju as N,jr as Na,ji as Ni,ec as Nn,Bo as Nr,yl as Nt,Ju as O,ya as Oa,Ra as Oi,nc as On,Fr as Or,gl as Ot,El as P,wo as Pa,Ai as Pi,Rs as Pn,fa as Pr,Tc as Pt,gc as Q,Jt as Qa,fo as Qi,as as Qn,ga as Qr,jl as Qt,Fl as R,U as Ra,qi as Ri,ks as Rn,ja as Rr,ul as Rt,Zc as S,Zr as Sa,eo as Si,Is as Sn,Oe as So,Ei as Sr,ml as St,Fc as T,xr as Ta,zr as Ti,q as Tn,ve as To,B as Tr,_l as Tt,bu as U,yo as Ua,Ri as Ui,_s as Un,Ia as Ur,lu as Ut,Il as V,Va,go as Vi,js as Vn,da as Vr,Wc as Vt,Yc as W,Vn as Wa,Hi as Wi,hs as Wn,Ha as Wr,wu as Wt,hl as X,rn as Xa,yi as Xi,Es as Xn,Aa as Xr,Tl as Xt,sl as Y,an as Ya,Eo as Yi,gs as Yn,Ca as Yr,jc as Yt,dl as Z,P as Za,Xi as Zi,ns as Zn,ba as Zr,au as Zt,Xc as _,Hn as _a,Lo as _i,ic as _n,De as _o,no as _r,Qc as _t,pl as a,Bn as aa,Wr as ai,Hc as an,Bt as ao,ts as ar,qu as at,Tu as b,ti as ba,No as bi,zs as bn,Te as bo,xi as br,Vl as bt,ql as c,mo as ca,So as ci,Nl as cn,j as co,qo as cr,uu as ct,Ql as d,Dr as da,ua as di,Xl as dn,ht as do,Yo as dr,Lc as dt,Ro as ea,Vo as ei,xc as en,I as eo,K as er,Ec as et,Oc as f,ho as fa,ia as fi,Gl as fn,rt as fo,Uo as fr,Du as ft,hu as g,pr as ga,Xn as gi,rc as gn,T as go,Li as gr,Hl as gt,Mc as h,kr as ha,Yn as hi,mc as hn,Se as ho,To as hr,Ul as ht,Wu as i,za as ia,Kr as ii,Kl as in,Vt as io,$o as ir,Uu as it,nl as j,Io as ja,ni as ji,$s as jn,Ni as jr,vl as jt,ku as k,Ti as ka,bo as ki,Ks as kn,Ji as kr,Al as kt,Jl as l,tr as la,Co as li,Zl as ln,Ct as lo,Zo as lr,Ic as lt,Cu as m,Sr as ma,Yi as mi,_u as mn,O as mo,Zi as mr,Bl as mt,Sc as n,La as na,Ho as ni,wc as nn,en as no,ss as nr,Yl as nt,Gc as o,ko as oa,Sn as oi,Rc as on,N as oo,Xo as or,Dc as ot,pu as p,Bi as pa,Xr as pi,Y as pn,Ke as po,L as pr,Ll as pt,Su as q,on as qa,Oa as qi,Ts as qn,Ya as qr,su as qt,J as r,uo as ra,Ur as ri,Cc as rn,$t as ro,ls as rr,Jc as rt,Kc as s,_o as sa,kn as si,Ml as sn,M as so,Jo as sr,du as st,hc as t,En as ta,vr as ti,yc as tn,Qt as to,os as tr,el as tt,$l as u,vo as ua,Jn as ui,_c as un,A as uo,Ko as ur,Uc as ut,Wl as v,jo as va,Do as vi,Ns as vn,Ie as vo,Di as vr,Rl as vt,Eu as w,Pr as wa,yr as wi,Hs as wn,ze as wo,vi as wr,xl as wt,Vc as x,Ta as xa,ro as xi,Bs as xn,S as xo,Un as xr,Nc as xt,qc as y,wa as ya,Po as yi,tc as yn,Ee as yo,wi as yr,zl as yt,$c as z,va as za,Ki as zi,vs as zn,Ea as zr,eu as zt};
|