@open-mercato/cezar 0.15.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/dist/automations/github-poller.d.ts +8 -1
  2. package/dist/automations/github-poller.js +78 -13
  3. package/dist/automations/github-poller.js.map +1 -1
  4. package/dist/automations/pr-head.js +15 -1
  5. package/dist/automations/pr-head.js.map +1 -1
  6. package/dist/automations/prompts.js +2 -2
  7. package/dist/automations/types.d.ts +10 -0
  8. package/dist/automations/types.js +12 -1
  9. package/dist/automations/types.js.map +1 -1
  10. package/dist/config.d.ts +1 -0
  11. package/dist/config.js +6 -0
  12. package/dist/config.js.map +1 -1
  13. package/dist/contract/automations.d.ts +31 -1
  14. package/dist/contract/index.d.ts +1 -0
  15. package/dist/contract/index.js +161 -17
  16. package/dist/contract/projects.d.ts +46 -0
  17. package/dist/contract/runs.d.ts +15 -0
  18. package/dist/contract/skills.d.ts +1 -0
  19. package/dist/contract/telemetry.d.ts +124 -0
  20. package/dist/contract/workspace.d.ts +3 -0
  21. package/dist/core/cursor-agent-runner.d.ts +11 -0
  22. package/dist/core/cursor-agent-runner.js +48 -4
  23. package/dist/core/cursor-agent-runner.js.map +1 -1
  24. package/dist/core/disclaim-spawn.d.ts +10 -0
  25. package/dist/core/disclaim-spawn.js +105 -8
  26. package/dist/core/disclaim-spawn.js.map +1 -1
  27. package/dist/git-diff-base.js +26 -19
  28. package/dist/git-diff-base.js.map +1 -1
  29. package/dist/git-remotes.d.ts +43 -0
  30. package/dist/git-remotes.js +127 -0
  31. package/dist/git-remotes.js.map +1 -0
  32. package/dist/git-worktree.d.ts +43 -19
  33. package/dist/git-worktree.js +138 -54
  34. package/dist/git-worktree.js.map +1 -1
  35. package/dist/index.js +46 -6
  36. package/dist/index.js.map +1 -1
  37. package/dist/runs/auto-name.d.ts +17 -0
  38. package/dist/runs/auto-name.js +47 -2
  39. package/dist/runs/auto-name.js.map +1 -1
  40. package/dist/runs/event-history.d.ts +10 -2
  41. package/dist/runs/event-history.js +290 -120
  42. package/dist/runs/event-history.js.map +1 -1
  43. package/dist/runs/retention.js +1 -1
  44. package/dist/runs/retention.js.map +1 -1
  45. package/dist/runs/store.d.ts +16 -3
  46. package/dist/runs/store.js +89 -10
  47. package/dist/runs/store.js.map +1 -1
  48. package/dist/server/checkout.d.ts +4 -0
  49. package/dist/server/checkout.js +9 -5
  50. package/dist/server/checkout.js.map +1 -1
  51. package/dist/server/create-project.d.ts +77 -0
  52. package/dist/server/create-project.js +342 -0
  53. package/dist/server/create-project.js.map +1 -0
  54. package/dist/server/forge/github.d.ts +2 -0
  55. package/dist/server/forge/github.js +32 -10
  56. package/dist/server/forge/github.js.map +1 -1
  57. package/dist/server/forge/index.d.ts +1 -12
  58. package/dist/server/forge/index.js +7 -29
  59. package/dist/server/forge/index.js.map +1 -1
  60. package/dist/server/forge/types.d.ts +2 -0
  61. package/dist/server/git-changes.d.ts +15 -0
  62. package/dist/server/git-changes.js +51 -1
  63. package/dist/server/git-changes.js.map +1 -1
  64. package/dist/server/git.d.ts +3 -2
  65. package/dist/server/git.js +4 -3
  66. package/dist/server/git.js.map +1 -1
  67. package/dist/server/project-context.js +1 -1
  68. package/dist/server/project-context.js.map +1 -1
  69. package/dist/server/server.d.ts +609 -302
  70. package/dist/server/server.js +191 -12
  71. package/dist/server/server.js.map +1 -1
  72. package/dist/server/star-count.d.ts +27 -11
  73. package/dist/server/star-count.js +57 -28
  74. package/dist/server/star-count.js.map +1 -1
  75. package/dist/telemetry-cli.d.ts +10 -0
  76. package/dist/telemetry-cli.js +54 -0
  77. package/dist/telemetry-cli.js.map +1 -0
  78. package/dist/telemetry-service.json +1 -0
  79. package/dist/telemetry.d.ts +79 -0
  80. package/dist/telemetry.js +453 -0
  81. package/dist/telemetry.js.map +1 -0
  82. package/dist/workflows/run.d.ts +28 -0
  83. package/dist/workflows/run.js +111 -16
  84. package/dist/workflows/run.js.map +1 -1
  85. package/dist/workspace/config.d.ts +10 -0
  86. package/dist/workspace/config.js +16 -0
  87. package/dist/workspace/config.js.map +1 -1
  88. package/dist/workspace/projects-cli.js +3 -0
  89. package/dist/workspace/projects-cli.js.map +1 -1
  90. package/package.json +3 -3
  91. package/scripts/mock-claude.mjs +32 -17
  92. package/scripts/stamp-telemetry-service.mjs +20 -0
  93. package/web/dist/assets/agent-task-pickers-mJzYn0UB.js +1 -0
  94. package/web/dist/assets/{alert-dialog-CF_-dmQ1.js → alert-dialog-Dd1WPOaz.js} +1 -1
  95. package/web/dist/assets/arrow-left-fsST4JqT.js +1 -0
  96. package/web/dist/assets/{automation-format-D1nqk0ID.js → automation-format-BTIFWfjt.js} +1 -1
  97. package/web/dist/assets/automations-route-DJjhwqug.js +1 -0
  98. package/web/dist/assets/button-BNnH7COh.js +100 -0
  99. package/web/dist/assets/{centered-state-T0J7VmBb.js → centered-state-sEYB3bgq.js} +1 -1
  100. package/web/dist/assets/check-DA37PQLT.js +1 -0
  101. package/web/dist/assets/chevron-left-zbXV2Qbu.js +1 -0
  102. package/web/dist/assets/chevron-right-Beu1pd6H.js +1 -0
  103. package/web/dist/assets/{collapsible-RD4hkew7.js → collapsible-MuXfYnM8.js} +1 -1
  104. package/web/dist/assets/commit-list-Bps23fvP.js +1 -0
  105. package/web/dist/assets/compare-variants-CQskdfDW.js +1 -0
  106. package/web/dist/assets/composer-DKWLJeo9.js +18 -0
  107. package/web/dist/assets/dashboard-BCNe_6p7.js +44 -0
  108. package/web/dist/assets/diff-CrLUECGW.js +3 -0
  109. package/web/dist/assets/{diff-stat-CFoeFye2.js → diff-stat-SpfygteL.js} +1 -1
  110. package/web/dist/assets/diff-view-DP4Gw3QJ.js +13 -0
  111. package/web/dist/assets/{download-BFQEsJRY.js → download-CBwSbmy_.js} +1 -1
  112. package/web/dist/assets/dropdown-menu-CxPGHgWX.js +1 -0
  113. package/web/dist/assets/ellipsis-BmusVE8U.js +1 -0
  114. package/web/dist/assets/{file-Df5WtpM_.js → file-DkvcUwxT.js} +1 -1
  115. package/web/dist/assets/file-preview-DxFusXAO.js +2 -0
  116. package/web/dist/assets/file-text-DBeC0yKb.js +1 -0
  117. package/web/dist/assets/file-tree-BTJZXRkM.js +1 -0
  118. package/web/dist/assets/{git-commit-horizontal-DawNm4qg.js → git-commit-horizontal-BM9_nEW7.js} +1 -1
  119. package/web/dist/assets/git-toolbar-DXyPCDkQ.js +1 -0
  120. package/web/dist/assets/github-G5fU4gJd.js +1 -0
  121. package/web/dist/assets/index-BN3w52uE.js +21 -0
  122. package/web/dist/assets/index-CAvSSpvF.css +2 -0
  123. package/web/dist/assets/{markdown-Bmfy_1Ll.js → markdown-BpZ4p95p.js} +1 -1
  124. package/web/dist/assets/{markdown-B_O1ys3h.js → markdown-C5F95Rt-.js} +1 -1
  125. package/web/dist/assets/{message-square-BOO9s3qX.js → message-square-BFQln9c4.js} +1 -1
  126. package/web/dist/assets/{pill-bO5OcHuK.js → pill-BcIQGDbn.js} +1 -1
  127. package/web/dist/assets/project-router-CWMOKp_H.js +3 -0
  128. package/web/dist/assets/reference-chip-B7lU_Pyh.js +1 -0
  129. package/web/dist/assets/reference-overflow-ClRRXWez.js +1 -0
  130. package/web/dist/assets/{refresh-cw-BaFyjVUz.js → refresh-cw-BBEYC6z2.js} +1 -1
  131. package/web/dist/assets/repo-git-CgxxZ7cO.js +1 -0
  132. package/web/dist/assets/{run-diff-GZbNs8fA.js → run-diff-BTB7nBeD.js} +1 -1
  133. package/web/dist/assets/run-header-BPNBEaOy.js +1 -0
  134. package/web/dist/assets/{image-preview-4SVDrBvn.js → scroll-within-DRt7mAnQ.js} +1 -1
  135. package/web/dist/assets/{search-x-bpAfQtVY.js → search-x-6BavY3mg.js} +1 -1
  136. package/web/dist/assets/sheet-D9PeyyRZ.js +1 -0
  137. package/web/dist/assets/skills-SIMzpL0l.js +1 -0
  138. package/web/dist/assets/square-DsFAQaY9.js +1 -0
  139. package/web/dist/assets/tab-link-DEUSZU49.js +1 -0
  140. package/web/dist/assets/{tag-DLwUkUsN.js → tag-DvCVnA6I.js} +1 -1
  141. package/web/dist/assets/task-changes-D-aajoMU.js +1 -0
  142. package/web/dist/assets/task-commits-BYD1GVkS.js +1 -0
  143. package/web/dist/assets/task-composer-7bdNNMP_.js +12 -0
  144. package/web/dist/assets/task-files-BfIOz-eN.js +1 -0
  145. package/web/dist/assets/task-graph-B5-5_IPh.js +1 -0
  146. package/web/dist/assets/task-notes-CfkTBgo8.js +1 -0
  147. package/web/dist/assets/task-thread-eEkjTDxr.js +10 -0
  148. package/web/dist/assets/{terminal-CwrL1hAi.js → terminal-xRHwWarr.js} +1 -1
  149. package/web/dist/assets/textarea-rKUFh5lI.js +1 -0
  150. package/web/dist/assets/thread-loading-DLlbK51g.js +1 -0
  151. package/web/dist/assets/{token-metrics-C149OWmd.js → token-metrics-BcPjL36-.js} +1 -1
  152. package/web/dist/assets/tooltip-BVqBAGNb.js +1 -0
  153. package/web/dist/assets/tracker-2DfMzsIE.js +4 -0
  154. package/web/dist/assets/triangle-alert-CP3Xp0FU.js +1 -0
  155. package/web/dist/assets/upload-bwO_2kok.js +1 -0
  156. package/web/dist/assets/use-automations-PceYR6ss.js +5 -0
  157. package/web/dist/assets/use-now-BAKdIYLG.js +1 -0
  158. package/web/dist/assets/use-submit-shortcut-BA4NVpJl.js +1 -0
  159. package/web/dist/assets/workflow-graph-HopaWPea.js +13 -0
  160. package/web/dist/assets/x-HaVPcg_B.js +1 -0
  161. package/web/dist/index.html +28 -31
  162. package/web/dist/assets/agent-task-pickers-C3ydGatB.js +0 -1
  163. package/web/dist/assets/arrow-left-BxBdc5DC.js +0 -1
  164. package/web/dist/assets/automations-route-BsflncpV.js +0 -1
  165. package/web/dist/assets/button-CjSjKnkd.js +0 -100
  166. package/web/dist/assets/check-DAAMuI4o.js +0 -1
  167. package/web/dist/assets/chevron-left-CvcqxpQZ.js +0 -1
  168. package/web/dist/assets/chevron-right-DKiL3NWw.js +0 -1
  169. package/web/dist/assets/commit-list-BJac2uO6.js +0 -1
  170. package/web/dist/assets/compare-variants-CfqICvRy.js +0 -1
  171. package/web/dist/assets/composer-DZx3cwQW.js +0 -18
  172. package/web/dist/assets/dashboard-CpCDiZdE.js +0 -44
  173. package/web/dist/assets/diff-LG2cl0PE.js +0 -3
  174. package/web/dist/assets/diff-controls-QgdH-r3F.js +0 -1
  175. package/web/dist/assets/diff-view-BVwSaBb2.js +0 -13
  176. package/web/dist/assets/dropdown-menu-DkEK7m00.js +0 -1
  177. package/web/dist/assets/editable-title-CJSWyCcL.js +0 -1
  178. package/web/dist/assets/ellipsis-vertical-CB0adfr7.js +0 -1
  179. package/web/dist/assets/external-link-DPKRidDg.js +0 -1
  180. package/web/dist/assets/eye-CEHQ0c-s.js +0 -1
  181. package/web/dist/assets/file-preview-kYsqZiLU.js +0 -2
  182. package/web/dist/assets/file-text-m0tZu8sU.js +0 -1
  183. package/web/dist/assets/git-merge-B7oVXcKc.js +0 -1
  184. package/web/dist/assets/git-toolbar-B0K4Q5Zv.js +0 -1
  185. package/web/dist/assets/github-C4WaHPni.js +0 -1
  186. package/web/dist/assets/index-CiQrbvAq.js +0 -21
  187. package/web/dist/assets/index-WWaEax-B.css +0 -2
  188. package/web/dist/assets/pencil-CCR9uUZ1.js +0 -1
  189. package/web/dist/assets/reference-chip-Bx_mG9QG.js +0 -1
  190. package/web/dist/assets/repo-git-Mn3_jrGP.js +0 -1
  191. package/web/dist/assets/run-header-i1D5Lvfs.js +0 -1
  192. package/web/dist/assets/sheet-DCdZVHFk.js +0 -1
  193. package/web/dist/assets/skills-Dea5ynJK.js +0 -1
  194. package/web/dist/assets/tab-link-BVItTl_Y.js +0 -1
  195. package/web/dist/assets/task-changes-xNbBM7FO.js +0 -1
  196. package/web/dist/assets/task-commits-BYozE_X3.js +0 -1
  197. package/web/dist/assets/task-composer-Brx0sa7_.js +0 -12
  198. package/web/dist/assets/task-files-MAPO-efK.js +0 -1
  199. package/web/dist/assets/task-graph-BSLCUr1E.js +0 -1
  200. package/web/dist/assets/task-thread-CRVmwchQ.js +0 -9
  201. package/web/dist/assets/textarea-Bb0_Hz53.js +0 -1
  202. package/web/dist/assets/thread-loading-Bo6IOu3Y.js +0 -1
  203. package/web/dist/assets/toaster-Hj_czp_o.js +0 -3
  204. package/web/dist/assets/tooltip--PYfu68E.js +0 -1
  205. package/web/dist/assets/tracker-DM5WtYD0.js +0 -4
  206. package/web/dist/assets/trash-2-EdjdGvEo.js +0 -1
  207. package/web/dist/assets/triangle-alert-DpH3QFz6.js +0 -1
  208. package/web/dist/assets/use-automations-XKvBTPM-.js +0 -5
  209. package/web/dist/assets/use-now-CrM50BFB.js +0 -1
  210. package/web/dist/assets/use-submit-shortcut-BJ10ZshV.js +0 -1
  211. package/web/dist/assets/workflow-graph-Y2Pr7ubb.js +0 -13
  212. package/web/dist/assets/x-BkwTUDpG.js +0 -1
@@ -1,3 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{B as r,Et as i,I as a,L as o,Mt as s,Nt as c,Ot as l,R as u,Tt as d,U as f,V as p,_t as m,gt as h,r as g,z as _}from"./button-CjSjKnkd.js";import{i as v}from"./bundle-mjs-BT31bpU6.js";var y=/^[\w!#$%&'*.^`|~+-]+$/,b=(e,t,n={})=>{if(!y.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},x=(e,t,n)=>(t=encodeURIComponent(t),b(e,t,n)),S=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),ee=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??`);e=e.replace(t,r?`/${r}`:``)}return e},te=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},ne=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},re=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function ie(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ae(e,t){if(!ie(e)&&!ie(t))return t;let n={...e};for(let e in t){let r=t[e];ie(n[e])&&ie(r)?n[e]=ae(n[e],r):n[e]=r}return n}var oe=(e,t)=>new Proxy(()=>{},{get(n,r){if(!(typeof r!=`string`||r===`then`))return oe(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),se=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(x(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=re(a),a=ee(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})}},ce=(e,t)=>oe(function n(r){let i=t?.buildSearchParams??te,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=S(e,a.join(`/`));if(s===`url`||s===`path`){let t=c;return r.args[0]&&(r.args[0].param&&(t=ee(c,r.args[0].param)),r.args[0].query&&(t=t+`?`+i(r.args[0].query).toString())),t=re(t),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=ne(r.args[0]&&r.args[0].param?ee(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 se(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=ae(t,e);return l.fetch(r.args[0],a)}return l},[]);function le(e={}){let{baseUrl:t=``,token:n,headers:r,fetch:i}=e;return ce(t,{headers:{...n?{Authorization:`Bearer ${n}`}:{},...r},...i?{fetch:i}:{}})}var C=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(){}},ue=new class extends C{#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`}},de={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},w=new class{#e=de;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 fe(e){setTimeout(e,0)}var pe=typeof window>`u`||`Deno`in globalThis;function T(){}function me(e,t){return typeof e==`function`?e(t):e}function he(e){return typeof e==`number`&&e>=0&&e!==1/0}function ge(e,t){return Math.max(e+(t||0)-Date.now(),0)}function E(e,t){return typeof e==`function`?e(t):e}function D(e,t){return typeof e==`function`?e(t):e}function _e(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ye(o,t.options))return!1}else if(!xe(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 ve(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(be(t.options.mutationKey)!==be(a))return!1}else if(!xe(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ye(e,t){return(t?.queryKeyHashFn||be)(e)}function be(e){return JSON.stringify(e,(e,t)=>Ee(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function xe(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>xe(e[n],t[n])):!1}var Se=Object.prototype.hasOwnProperty;function Ce(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Te(e)&&Te(t);if(!r&&!(Ee(e)&&Ee(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:Se.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Ce(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function we(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 Te(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ee(e){if(!De(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!De(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function De(e){return Object.prototype.toString.call(e)===`[object Object]`}function Oe(e){return new Promise(t=>{w.setTimeout(t,e)})}function ke(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Ce(e,t)}function Ae(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function je(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Me=Symbol();function Ne(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Me?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Pe(e,t){return typeof e==`function`?e(...t):!!e}function Fe(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 Ie=(()=>{let e=()=>pe;return{isServer(){return e()},setIsServer(t){e=t}}})();function Le(){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 Re=fe;function ze(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Re,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=ze(),Be=new class extends C{#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 Ve(e){return Math.min(1e3*2**e,3e4)}function He(e){return(e??`online`)!==`online`||Be.isOnline()}var Ue=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function We(e){let t=!1,n=0,r,i=Le(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Ue(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>ue.isFocused()&&(e.networkMode===`always`||Be.isOnline())&&e.canRun(),u=()=>He(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??(Ie.isServer()?0:3),o=e.retryDelay??Ve,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),Oe(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 Ge=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),he(this.gcTime)&&(this.#e=w.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ie.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(w.clearTimeout(this.#e),this.#e=void 0)}};function Ke(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=>{Fe(e,()=>t.signal,()=>n=!0)},u=Ne(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?je:Ae;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Je:qe,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:qe(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function qe(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Je(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Ye(e,t){return t?qe(e,t)!=null:!1}function Xe(e,t){return!t||!e.getPreviousPageParam?!1:Je(e,t)!=null}var Ze=class extends Ge{#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=et(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=et(this.options);e.data!==void 0&&(this.setState($e(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=ke(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(T).catch(T):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=>D(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Me||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>E(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:!ge(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=Ne(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`?Ke(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=We({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Ue&&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 Ue){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,...Qe(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...$e(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 Qe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:He(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function $e(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function et(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 tt=class extends C{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Le(),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),rt(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return it(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return it(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 D(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&&!we(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&at(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||D(this.options.enabled,this.#t)!==D(t.enabled,this.#t)||E(this.options.staleTime,this.#t)!==E(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||D(this.options.enabled,this.#t)!==D(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 st(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(T)),t}#g(){this.#b();let e=E(this.options.staleTime,this.#t);if(Ie.isServer()||this.#r.isStale||!he(e))return;let t=ge(this.#r.dataUpdatedAt,e)+1;this.#d=w.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,!(Ie.isServer()||D(this.options.enabled,this.#t)===!1||!he(this.#p)||this.#p===0)&&(this.#f=w.setInterval(()=>{(this.options.refetchIntervalInBackground||ue.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(w.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(w.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&&rt(e,t),o=i&&at(e,n,t,r);(a||o)&&(l={...l,...Qe(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=ke(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=ke(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:ot(e,t),refetch:this.refetch,promise:this.#o,isEnabled:D(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{let e=this.#o=x.promise=Le();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}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),!we(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 nt(e,t){return D(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&D(t.retryOnMount,e)===!1)}function rt(e,t){return nt(e,t)||e.state.data!==void 0&&it(e,t,t.refetchOnMount)}function it(e,t,n){if(D(t.enabled,e)!==!1&&E(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&ot(e,t)}return!1}function at(e,t,n,r){return(e!==t||D(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ot(e,n)}function ot(e,t){return D(t.enabled,e)!==!1&&e.isStaleByTime(E(t.staleTime,e))}function st(e,t){return!we(e.getCurrentResult(),t)}var ct=class extends tt{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:Ye(t,n.data),hasPreviousPage:Xe(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},lt=class extends Ge{#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||ut(),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=We({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 ut(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var dt=class extends C{#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),we(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&be(t.mutationKey)!==be(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??ut();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 ft(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function pt(e,t,n){let r=e.slice(0);return r[t]=n,r}var mt=class extends C{#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||!we(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(ft(e,n).forEach(e=>{e.destroy()}),ft(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=Ce(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 tt(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=pt(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),A=n(),ht=k.createContext(void 0),j=e=>{let t=k.useContext(ht);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},gt=({client:e,children:t})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,A.jsx)(ht.Provider,{value:e,children:t})),_t=k.createContext(!1),vt=()=>k.useContext(_t);_t.Provider;function yt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var bt=k.createContext(yt()),xt=()=>k.useContext(bt),St=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Pe(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Ct=e=>{k.useEffect(()=>{e.clearReset()},[e])},wt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Pe(n,[e.error,r])),Tt=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))}},Et=(e,t)=>e.isLoading&&e.isFetching&&!t,Dt=(e,t)=>e?.suspense&&t.isPending,Ot=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function kt({queries:e,...t},n){let r=j(n),i=vt(),a=xt(),o=k.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{Tt(e);let t=r.getQueryCache().get(e.queryHash);St(e,a,t)}),Ct(a);let[s]=k.useState(()=>new mt(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)):T,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),k.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>Dt(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&Dt(n,e)?Ot(n,new tt(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&wt({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 At(e,t,n){let r=vt(),i=xt(),a=j(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Tt(o),St(o,i,s),Ct(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)):T;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),k.useEffect(()=>{u.setOptions(o)},[o,u]),Dt(o,d))throw Ot(o,u,i);if(wt({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&&!Ie.isServer()&&Et(d,r)&&(l?Ot(o,u,i):s?.promise)?.catch(T).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function M(e,t){return At(e,tt,t)}function N(e,t){let n=j(t),[r]=k.useState(()=>new dt(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(T)},[r]);if(i.error&&Pe(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function jt(e,t){return At(e,ct,t)}var Mt=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Nt=/^[\\/]{2}/;function Pt(e,t){return t+e.replace(/\\/g,`/`)}var Ft=`popstate`;function It(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function Lt(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return Bt(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:Vt(t)}return Ht(t,n,null,e)}function P(e,t){if(e===!1||e==null)throw Error(t)}function F(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Rt(){return Math.random().toString(36).substring(2,10)}function zt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Bt(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?I(t):t,state:n,key:t&&t.key||r||Rt(),mask:i}}function Vt({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function I(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Ht(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=It(e)?e:Bt(h.location,e,t);n&&n(r,e),l=u()+1;let d=zt(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=It(e)?e:Bt(h.location,e,t);n&&n(r,e),l=u();let i=zt(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return Ut(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(Ft,d),c=e,()=>{i.removeEventListener(Ft,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function Ut(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),P(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:Vt(t);return i=i.replace(/ $/,`%20`),!n&&Nt.test(i)&&(i=r+i),new URL(i,r)}function Wt(e,t,n=`/`){return Gt(e,t,n,!1)}function Gt(e,t,n,r,i){let a=L((typeof t==`string`?I(t):t).pathname||`/`,n);if(a==null)return null;let o=i??qt(e),s=null,c=dn(a);for(let e=0;s==null&&e<o.length;++e)s=sn(o[e],c,r);return s}function Kt(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function qt(e){let t=Jt(e);return Xt(t),t}function Jt(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;P(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=R([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(P(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Jt(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:an(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=un(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Yt(e.path))a(e,t,!0,n)}),t}function Yt(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Yt(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Xt(e){e.sort((e,t)=>e.score===t.score?on(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Zt=/^:[\w-]+$/,Qt=3,$t=2,en=1,tn=10,nn=-2,rn=e=>e===`*`;function an(e,t){let n=e.split(`/`),r=n.length;return n.some(rn)&&(r+=nn),t&&(r+=$t),n.filter(e=>!rn(e)).reduce((e,t)=>e+(Zt.test(t)?Qt:t===``?en:tn),r)}function on(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function sn(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?ln(u,l,s.matcher,s.compiledParams):cn(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=cn({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:R([a,d.pathname]),pathnameBase:bn(R([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=R([a,d.pathnameBase]))}return o}function cn(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=un(e.path,e.caseSensitive,e.end);return ln(e,t,n,r)}function ln(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function un(e,t=!1,n=!0){F(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function dn(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return F(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function L(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function fn(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?I(e):e,a;return n?(n=vn(n),a=n.startsWith(`/`)?pn(n.substring(1),`/`):pn(n,t)):a=t,{pathname:a,search:xn(r),hash:Sn(i)}}function pn(e,t){let n=yn(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function mn(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function hn(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function gn(e){let t=hn(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function _n(e,t,n,r=!1){let i;typeof e==`string`?i=I(e):(i={...e},P(!i.pathname||!i.pathname.includes(`?`),mn(`?`,`pathname`,`search`,i)),P(!i.pathname||!i.pathname.includes(`#`),mn(`#`,`pathname`,`hash`,i)),P(!i.search||!i.search.includes(`#`),mn(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=fn(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var vn=e=>e.replace(/[\\/]{2,}/g,`/`),R=e=>vn(e.join(`/`)),yn=e=>e.replace(/\/+$/,``),bn=e=>yn(e).replace(/^\/*/,`/`),xn=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Sn=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Cn=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function wn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Tn(e){return R(e.map(e=>e.route.path).filter(Boolean))||`/`}var En=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Dn(e,t){let n=e;if(typeof n!=`string`||!Mt.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(En)try{let e=new URL(window.location.href),r=Nt.test(n)?new URL(Pt(n,e.protocol)):new URL(n),a=L(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{F(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var On=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(On);var kn=[`GET`,...On];new Set(kn);var An=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function jn(e){try{return An.includes(new URL(e).protocol)}catch{return!1}}var Mn=k.createContext(null);Mn.displayName=`DataRouter`;var Nn=k.createContext(null);Nn.displayName=`DataRouterState`;var Pn=k.createContext(!1);function Fn(){return k.useContext(Pn)}var In=k.createContext({isTransitioning:!1});In.displayName=`ViewTransition`;var Ln=k.createContext(new Map);Ln.displayName=`Fetchers`;var Rn=k.createContext(null);Rn.displayName=`Await`;var z=k.createContext(null);z.displayName=`Navigation`;var zn=k.createContext(null);zn.displayName=`Location`;var B=k.createContext({outlet:null,matches:[],isDataRoute:!1});B.displayName=`Route`;var Bn=k.createContext(null);Bn.displayName=`RouteError`;var Vn=`REACT_ROUTER_ERROR`,Hn=`REDIRECT`,Un=`ROUTE_ERROR_RESPONSE`;function Wn(e){if(e.startsWith(`${Vn}:${Hn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Gn(e){if(e.startsWith(`${Vn}:${Un}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Cn(t.status,t.statusText,t.data)}catch{}}function Kn(e,{relative:t}={}){P(qn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=k.useContext(z),{hash:i,pathname:a,search:o}=tr(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:R([n,a])),r.createHref({pathname:s,search:o,hash:i})}function qn(){return k.useContext(zn)!=null}function V(){return P(qn(),`useLocation() may be used only in the context of a <Router> component.`),k.useContext(zn).location}var Jn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Yn(e){k.useContext(z).static||k.useLayoutEffect(e)}function Xn(){let{isDataRoute:e}=k.useContext(B);return e?br():Zn()}function Zn(){P(qn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=k.useContext(Mn),{basename:t,navigator:n}=k.useContext(z),{matches:r}=k.useContext(B),{pathname:i}=V(),a=JSON.stringify(gn(r)),o=k.useRef(!1);return Yn(()=>{o.current=!0}),k.useCallback((r,s={})=>{if(F(o.current,Jn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=_n(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:R([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var Qn=k.createContext(null);function $n(e){let t=k.useContext(B).outlet;return k.useMemo(()=>t&&k.createElement(Qn.Provider,{value:e},t),[t,e])}function er(){let{matches:e}=k.useContext(B);return e[e.length-1]?.params??{}}function tr(e,{relative:t}={}){let{matches:n}=k.useContext(B),{pathname:r}=V(),i=JSON.stringify(gn(n));return k.useMemo(()=>_n(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function nr(e,t){return rr(e,t)}function rr(e,t,n){P(qn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=k.useContext(z),{matches:i}=k.useContext(B),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Sr(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
2
-
3
- Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=V(),d;if(t){let e=typeof t==`string`?I(t):t;P(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):Wt(e,{pathname:p});F(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),F(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=ur(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:R([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:R([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?k.createElement(zn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function ir(){let e=yr(),t=wn(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=k.createElement(k.Fragment,null,k.createElement(`p`,null,`💿 Hey developer 👋`),k.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,k.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,k.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),k.createElement(k.Fragment,null,k.createElement(`h2`,null,`Unexpected Application Error!`),k.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?k.createElement(`pre`,{style:i},n):null,o)}var ar=k.createElement(ir,null),or=class extends k.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Gn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:k.createElement(B.Provider,{value:this.props.routeContext},k.createElement(Bn.Provider,{value:e,children:this.props.component}));return this.context?k.createElement(cr,{error:e},t):t}};or.contextType=Pn;var sr=new WeakMap;function cr({children:e,error:t}){let{basename:n}=k.useContext(z);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Wn(t.digest);if(e){let r=sr.get(t);if(r)throw r;let i=Dn(e.location,n),a=i.absoluteURL||i.to;if(jn(a))throw Error(`Invalid redirect location`);if(En&&!sr.get(t))if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw sr.set(t,n),n}return k.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function lr({routeContext:e,match:t,children:n}){let r=k.useContext(Mn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),k.createElement(B.Provider,{value:e},n)}function ur(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);P(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Tn(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||ar,o&&(s<0&&c===0?(Sr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?k.createElement(n.route.Component,null):n.route.element?n.route.element:e,k.createElement(lr,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?k.createElement(or,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function dr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function fr(e){let t=k.useContext(Mn);return P(t,dr(e)),t}function pr(e){let t=k.useContext(Nn);return P(t,dr(e)),t}function mr(e){let t=k.useContext(B);return P(t,dr(e)),t}function hr(e){let t=mr(e),n=t.matches[t.matches.length-1];return P(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function gr(){return hr(`useRouteId`)}function _r(){let e=pr(`useNavigation`);return k.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function vr(){let{matches:e,loaderData:t}=pr(`useMatches`);return k.useMemo(()=>e.map(e=>Kt(e,t)),[e,t])}function yr(){let e=k.useContext(Bn),t=pr(`useRouteError`),n=hr(`useRouteError`);return e===void 0?t.errors?.[n]:e}function br(){let{router:e}=fr(`useNavigate`),t=hr(`useNavigate`),n=k.useRef(!1);return Yn(()=>{n.current=!0}),k.useCallback(async(r,i={})=>{F(n.current,Jn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var xr={};function Sr(e,t,n){!t&&!xr[e]&&(xr[e]=!0,F(!1,n))}k.memo(Cr);function Cr({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return rr(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function wr({to:e,replace:t,state:n,relative:r}){P(qn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=k.useContext(z);F(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=k.useContext(B),{pathname:o}=V(),s=Xn(),c=_n(e,gn(a),o,r===`path`),l=JSON.stringify(c);return k.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function Tr(e){return $n(e.context)}function Er(e){P(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Dr({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){P(!qn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=k.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=I(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=k.useMemo(()=>{let e=L(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return F(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:k.createElement(z.Provider,{value:c},k.createElement(zn.Provider,{children:t,value:h}))}function Or({children:e,location:t}){return nr(kr(e),t)}k.Component;function kr(e,t=[]){let n=[];return k.Children.forEach(e,(e,r)=>{if(!k.isValidElement(e))return;let i=[...t,r];if(e.type===k.Fragment){n.push.apply(n,kr(e.props.children,i));return}P(e.type===Er,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),P(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=kr(e.props.children,i)),n.push(a)}),n}var Ar=`get`,jr=`application/x-www-form-urlencoded`;function Mr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Nr(e){return Mr(e)&&e.tagName.toLowerCase()===`button`}function Pr(e){return Mr(e)&&e.tagName.toLowerCase()===`form`}function Fr(e){return Mr(e)&&e.tagName.toLowerCase()===`input`}function Ir(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Lr(e,t){return e.button===0&&(!t||t===`_self`)&&!Ir(e)}function Rr(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function zr(e,t){let n=Rr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Br=null;function Vr(){if(Br===null)try{new FormData(document.createElement(`form`),0),Br=!1}catch{Br=!0}return Br}var Hr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Ur(e){return e!=null&&!Hr.has(e)?(F(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${jr}"`),null):e}function Wr(e,t){let n,r,i,a,o;if(Pr(e)){let o=e.getAttribute(`action`);r=o?L(o,t):null,n=e.getAttribute(`method`)||Ar,i=Ur(e.getAttribute(`enctype`))||jr,a=new FormData(e)}else if(Nr(e)||Fr(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?L(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Ar,i=Ur(e.getAttribute(`formenctype`))||Ur(o.getAttribute(`enctype`))||jr,a=new FormData(o,e),!Vr()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Mr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Ar,r=null,i=jr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Gr={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Kr=/[&><\u2028\u2029]/g;function qr(e){return e.replace(Kr,e=>Gr[e])}function Jr(e,t){if(e===!1||e==null)throw Error(t)}function Yr(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&L(i.pathname,t)===`/`?i.pathname=`${yn(t)}/_root.${r}`:i.pathname=`${yn(i.pathname)}.${r}`,i}async function Xr(e,t){if(e.id in t)return t[e.id];try{let n=await v(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Zr(e){return e!=null&&typeof e.page==`string`}function Qr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function $r(e,t,n){return ii((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Xr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Qr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function ei(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function ti(e,t,{includeHydrateFallback:n}={}){return ni(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function ni(e){return[...new Set(e)]}function ri(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function ii(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Zr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(ri(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function ai(){let e=k.useContext(Mn);return Jr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function oi(){let e=k.useContext(Nn);return Jr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var si=k.createContext(void 0);si.displayName=`FrameworkContext`;function ci(){let e=k.useContext(si);return Jr(e,`You must render this element inside a <HydratedRouter> element`),e}function li(e,t){let n=k.useContext(si),[r,i]=k.useState(!1),[a,o]=k.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=k.useRef(null);k.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),k.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:ui(s,p),onBlur:ui(c,m),onMouseEnter:ui(l,p),onMouseLeave:ui(u,m),onTouchStart:ui(d,p)}]:[a,f,{}]:[!1,f,{}]}function ui(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function di({page:e,...t}){let n=Fn(),{nonce:r}=ci(),{router:i}=ai(),a=k.useMemo(()=>Wt(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?k.createElement(pi,{page:e,matches:a,...t}):k.createElement(mi,{page:e,matches:a,...t})):null}function fi(e){let{manifest:t,routeModules:n}=ci(),[r,i]=k.useState([]);return k.useEffect(()=>{let r=!1;return $r(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function pi({page:e,matches:t,...n}){let r=V(),{future:i}=ci(),{basename:a}=ai(),o=k.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Yr(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return k.createElement(k.Fragment,null,o.map(e=>k.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function mi({page:e,matches:t,...n}){let r=V(),{future:i,manifest:a,routeModules:o}=ci(),{basename:s}=ai(),{loaderData:c,matches:l}=oi(),u=k.useMemo(()=>ei(e,t,l,a,r,`data`),[e,t,l,a,r]),d=k.useMemo(()=>ei(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=k.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Yr(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=k.useMemo(()=>ti(d,a),[d,a]),m=fi(d);return k.createElement(k.Fragment,null,f.map(e=>k.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>k.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>k.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function hi(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}k.Component;var gi=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{gi&&(window.__reactRouterVersion=`7.18.1`)}catch{}function _i({basename:e,children:t,useTransitions:n,window:r}){let i=k.useRef();i.current??=Lt({window:r,v5Compat:!0});let a=i.current,[o,s]=k.useState({action:a.action,location:a.location}),c=k.useCallback(e=>{n===!1?s(e):k.startTransition(()=>s(e))},[n]);return k.useLayoutEffect(()=>a.listen(c),[a,c]),k.createElement(Dr,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function vi({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=k.useState({action:n.action,location:n.location}),o=k.useCallback(e=>{r===!1?a(e):k.startTransition(()=>a(e))},[r]);return k.useLayoutEffect(()=>n.listen(o),[n,o]),k.createElement(Dr,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}vi.displayName=`unstable_HistoryRouter`;var yi=k.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=k.useContext(z),v=typeof l==`string`&&Mt.test(l),y=Dn(l,h);l=y.to;let b=Kn(l,{relative:r}),x=V(),S=null;if(o){let e=_n(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:R([h,e.pathname])),S=g.createHref(e)}let[ee,te,ne]=li(n,p),re=Ei(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function ie(t){e&&e(t),t.defaultPrevented||re(t)}let ae=!(y.isExternal||i),oe=k.createElement(`a`,{...p,...ne,href:(ae?S:void 0)||y.absoluteURL||b,onClick:ae?ie:e,ref:hi(m,te),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return ee&&!v?k.createElement(k.Fragment,null,oe,k.createElement(di,{page:b})):oe});yi.displayName=`Link`;var bi=k.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=tr(a,{relative:c.relative}),d=V(),f=k.useContext(Nn),{navigator:p,basename:m}=k.useContext(z),h=f!=null&&Li(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=L(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},ee=b?e:void 0,te;te=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let ne=typeof i==`function`?i(S):i;return k.createElement(yi,{...c,"aria-current":ee,className:te,ref:l,style:ne,to:a,viewTransition:o},typeof s==`function`?s(S):s)});bi.displayName=`NavLink`;var xi=k.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Ar,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=k.useContext(z),g=Ai(),_=ji(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&Mt.test(s);return k.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?k.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});xi.displayName=`Form`;function Si({getKey:e,storageKey:t,...n}){let r=k.useContext(si),{basename:i}=k.useContext(z),a=V(),o=vr();Fi({getKey:e,storageKey:t});let s=k.useMemo(()=>{if(!r||!e)return null;let t=Pi(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&r?.nonce&&(n.nonce=r.nonce),k.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${qr(JSON.stringify(t||Mi))}, ${qr(JSON.stringify(s))})`}})}Si.displayName=`ScrollRestoration`;function Ci(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function wi(e){let t=k.useContext(Mn);return P(t,Ci(e)),t}function Ti(e){let t=k.useContext(Nn);return P(t,Ci(e)),t}function Ei(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Xn(),d=V(),f=tr(e,{relative:o});return k.useCallback(p=>{if(Lr(p,t)){p.preventDefault();let t=n===void 0?Vt(d)===Vt(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?k.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function Di(e){F(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=k.useRef(Rr(e)),n=k.useRef(!1),r=V(),i=k.useMemo(()=>zr(r.search,n.current?null:t.current),[r.search]),a=Xn();return[i,k.useCallback((e,t)=>{let r=Rr(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Oi=0,ki=()=>`__${String(++Oi)}__`;function Ai(){let{router:e}=wi(`useSubmit`),{basename:t}=k.useContext(z),n=gr(),r=e.fetch,i=e.navigate;return k.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Wr(e,t);if(a.navigate===!1){let e=a.fetcherKey||ki();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function ji(e,{relative:t}={}){let{basename:n}=k.useContext(z),r=k.useContext(B);P(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...tr(e||`.`,{relative:t})},o=V();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:R([n,a.pathname])),Vt(a)}var Mi=`react-router-scroll-positions`,Ni={};function Pi(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:L(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Fi({getKey:e,storageKey:t}={}){let{router:n}=wi(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Ti(`useScrollRestoration`),{basename:a}=k.useContext(z),o=V(),s=vr(),c=_r();k.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Ii(k.useCallback(()=>{if(c.state===`idle`){let t=Pi(o,s,a,e);Ni[t]=window.scrollY}try{sessionStorage.setItem(t||Mi,JSON.stringify(Ni))}catch(e){F(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(k.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Mi);e&&(Ni=JSON.parse(e))}catch{}},[t]),k.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Ni,()=>window.scrollY,e?(t,n)=>Pi(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),k.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{F(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Ii(e,t){let{capture:n}=t||{};k.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Li(e,{relative:t}={}){let n=k.useContext(In);P(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=wi(`useViewTransitionState`),i=tr(e,{relative:t});if(!n.isTransitioning)return!1;let a=L(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=L(n.nextLocation.pathname,r)||n.nextLocation.pathname;return cn(i.pathname,o)!=null||cn(i.pathname,a)!=null}var Ri=[`claude`,`codex`,`junie`,`opencode`,`cursor`,`pi`,`copilot`],zi=new Set([`connected`,`disconnected`,`not-installed`,`unknown`]);function Bi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Vi(e,t){if(!Bi(e))return null;let{provider:n,status:r,enabled:i,hint:a,authFailureId:o}=e;return typeof n!=`string`||!Ri.includes(n)||typeof r!=`string`||!zi.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 Hi(e){return Vi(e,!1)}function Ui(e,t){if(!Bi(e)||!Array.isArray(e.providers))return null;let n=[],r=new Set;for(let i of e.providers){let e=Vi(i,t);if(e===null||r.has(e.provider))return null;r.add(e.provider),n.push(e)}return n}function H(e){let t=Ui(e,!0);if(t===null||t.length===0)return null;let n=new Map(t.map(e=>[e.provider,e]));return Ri.flatMap(e=>{let t=n.get(e);return t?[t]:[]})}function Wi(e){let t=H(e);if(t===null)throw Error(`Invalid provider status response`);return{providers:t}}function Gi(e,t){let n=H(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 Ki(e,t,n,r){let i=H(e),a=H(t),o=H(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:qi(t,n)?e:i?{...e,enabled:n.enabled}:n})}}function qi(e,t){return e.provider===t.provider&&e.status===t.status&&e.enabled===t.enabled&&e.hint===t.hint&&e.authFailureId===t.authFailureId}function Ji(e){let t=H(e);if(t===null)return[];let n=new Set(t.filter(e=>e.enabled&&(e.status===`connected`||e.provider===`junie`&&e.status===`unknown`)).map(e=>e.provider));return Ri.filter(e=>n.has(e))}function Yi(e,t){return H(e)?.find(e=>e.provider===t)}function Xi(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!Zi(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return Qi(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 Zi(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function Zi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Qi(e){return Zi(e)&&typeof e.id==`string`&&e.id!==``}function $i(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=[...e];return r[n]=ta(e[n],t),r}let r=t.createdAt??``,i=e.findIndex(e=>(e.createdAt??``).localeCompare(r)<0),a=[...e];return a.splice(i<0?e.length:i,0,t),a}function ea(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function ta(e,t){if(!e)return t;let n=e=>e===`user`?2:+(e===`marker`),r=n(e.titleOrigin)>n(t.titleOrigin)?{title:e.title,titleSummary:e.titleSummary,titleOrigin:e.titleOrigin}:{};return e.usage?{...t,...r,usage:e.usage}:{...t,...r}}var na=Object.freeze({});function ra(){let e=na,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 U=class extends Error{status;manual;command;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}};function ia(e){try{return JSON.parse(e)}catch{return}}function aa(e){return typeof e==`string`?e:void 0}function W(e,t,n){let r=ia(n),i=r&&typeof r==`object`?r:{};return new U(e,aa(i.error)??`${e} ${t||`request failed`}`.trim(),{manual:aa(i.manual),command:aa(i.command),exists:typeof i.exists==`boolean`?i.exists:void 0})}var G=le({fetch:(e,t)=>ua(oa(String(e)),t)});function oa(e){let t=ca(e.endsWith(`?`)?e.slice(0,-1):e);return t.startsWith(`/`)?`${u()}${t}`:t}var sa=`${a}/p/default`;function ca(e){if(_()!==null||!e.startsWith(sa))return e;let t=e.slice(sa.length);return t===``||t.startsWith(`/`)||t.startsWith(`?`)?`${a}${t}`:e}var K=e=>({init:{signal:e?.signal}});async function q(e,t){let n=await e.text();if(!e.ok)throw W(e.status,e.statusText,n);let r=ia(n);if(r===void 0)throw new U(e.status,`the cezar server answered ${t} with a non-JSON body`);return r}async function la(e,t,n){let r=e.status,i=await q(e,t),a=n.safeParse(i);if(!a.success)throw new U(r,`the cezar server answered ${t} with an unexpected body`);return a.data}async function ua(e,t){try{return await fetch(e,{...t,credentials:`include`})}catch(t){throw t instanceof DOMException&&t.name===`AbortError`?t:new U(0,`cannot reach the cezar server (${e})`,{cause:t})}}async function da(e,t){return ua(o(e),t)}async function fa(e,t={}){let n=new Headers(t.headers);n.set(`accept`,`text/plain`);let r=await da(e,{...t,headers:n}),i=await r.text();if(!r.ok)throw W(r.status,r.statusText,i);return i}var J=(e,t=``)=>`/runs/${encodeURIComponent(e)}${t}`;async function pa(e){return q(await G.api.v1.health.$get({},K(e)),`/health`)}async function ma(e){return q(await G.api.v1[`star-count`].$get({},K(e)),`/star-count`)}async function ha(e,t){return q(await G.api.v1.models.$get({query:{runner:e}},K(t)),`/models`)}async function ga(e=!1,t){return Wi(await q(await G.api.v1.providers.status.$get({query:e?{refresh:`1`}:{}},K(t)),`/providers/status`))}async function _a(e){return q(await G.api.v1.p[`:projectId`][`launch-key`].$get({param:{projectId:r()}},K(e)),`/launch-key`)}async function va(e){return q(await G.api.v1.projects.$get({},K(e)),`/projects`)}async function ya(e,t){return q(await G.api.v1.fs.browse.$get({query:{path:e===``?void 0:e,...t?.showHidden?{showHidden:`1`}:{}}},K(t)),`/fs/browse`)}async function ba(e){return q(await G.api.v1.p[`:projectId`].runs.$get({param:{projectId:r()}},K(e)),`/runs`)}async function xa(e,t){return q(await G.api.v1.p[`:projectId`].runs.$get({param:{projectId:e}},K(t)),`/runs`)}async function Sa(e){return q(await G.api.v1.workspace[`runs-index`].$get({},K(e)),`/workspace/runs-index`)}async function Ca(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:r(),id:encodeURIComponent(e)}},K(t)),J(e))}async function wa(e,t,n){return q(await G.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:e,id:encodeURIComponent(t)}},K(n)),J(t))}async function Ta(e,t,n){return la(await G.api.v1.p[`:projectId`].runs[`:id`].history.$get({param:{projectId:r(),id:encodeURIComponent(e)},query:{...t===void 0?{}:{cursor:t}}},K(n)),`${J(e)}/history`,c)}async function Ea(e,t){return la(await G.api.v1.p[`:projectId`].runs[`:id`][`history-context`].$get({param:{projectId:r(),id:encodeURIComponent(e)}},K(t)),`${J(e)}/history-context`,s)}async function Da(e){return q(await G.api.v1.p[`:projectId`][`ui-state`].$get({param:{projectId:r()}},K(e)),`/ui-state`)}async function Oa(e){return q(await G.api.v1.p[`:projectId`].workflows.$get({param:{projectId:r()}},K(e)),`/workflows`)}async function ka(e){return q(await G.api.v1.p[`:projectId`].skills.$get({param:{projectId:r()},query:{}},K(e)),`/skills`)}async function Aa(e){return q(await G.api.v1.p[`:projectId`].skills.$get({param:{projectId:r()},query:{wait:`1`}},K(e)),`/skills`)}async function ja(){return q(await G.api.v1.p[`:projectId`].skills.refresh.$post({param:{projectId:r()}}),`/skills/refresh`)}async function Ma(e){return q(await G.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:r()},query:{}},K(e)),`/skills/importable`)}async function Na(e){return q(await G.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:r()},query:{wait:`1`}},K(e)),`/skills/importable`)}async function Pa(e){return q(await G.api.v1.p[`:projectId`].todos.$get({param:{projectId:r()}},K(e)),`/todos`)}async function Fa(e){return q(await G.api.v1.p[`:projectId`].repo.$get({param:{projectId:r()}},K(e)),`/repo`)}async function Ia(e){return q(await G.api.v1.p[`:projectId`].config.$get({param:{projectId:r()}},K(e)),`/config`)}async function La(e={}){return q(await G.api.v1.p[`:projectId`][`agent-config`].$get({param:{projectId:r()}},K(e)),`/agent-config`)}async function Ra(e,t={}){return q(await G.api.v1.p[`:projectId`][`agent-config`][`:id`].$get({param:{projectId:r(),id:encodeURIComponent(e)}},K(t)),`/agent-config/${encodeURIComponent(e)}`)}async function za(e,t){return q(await G.api.v1.p[`:projectId`][`agent-config`][`:id`].$put({param:{projectId:r(),id:encodeURIComponent(e)},json:t}),`/agent-config/${encodeURIComponent(e)}`)}async function Ba(e){return q(await G.api.v1.p[`:projectId`].repo.changes.$get({param:{projectId:r()}},K(e)),`/repo/changes`)}async function Va(e){return q(await G.api.v1.p[`:projectId`].repo.tree.$get({param:{projectId:r()}},K(e)),`/repo/tree`)}async function Ha(e,t){return q(await G.api.v1.p[`:projectId`].repo.files.$get({param:{projectId:r()},query:{path:e}},K(t)),`/repo/files`)}function Ua(e){return o(`/repo/files?path=${encodeURIComponent(e)}&raw=1`)}async function Wa(e,t){return q(await G.api.v1.p[`:projectId`].repo.commit[`:sha`].$get({param:{projectId:r(),sha:encodeURIComponent(e)},query:{structured:`1`}},K(t)),`/repo/commit/:sha`)}async function Ga(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`].commits.$get({param:{projectId:r(),id:encodeURIComponent(e)}},K(t)),J(e,`/commits`))}async function Ka(e,t,n){return q(await G.api.v1.p[`:projectId`].runs[`:id`].commit[`:sha`].$get({param:{projectId:r(),id:encodeURIComponent(e),sha:encodeURIComponent(t)}},K(n)),J(e,`/commit/${encodeURIComponent(t)}`))}async function qa(e={},t){return q(await G.api.v1.p[`:projectId`].github.$get({param:{projectId:r()},query:{limit:e.limit===void 0?void 0:String(e.limit),refresh:e.refresh?`1`:void 0,issuesCursor:e.issuesCursor,prsCursor:e.prsCursor}},K(t)),`/github`)}async function Ja(e={},t){return q(await G.api.v1.p[`:projectId`].tracker[`automation-options`].$get({param:{projectId:r()},query:e},K(t)),`/tracker/automation-options`)}async function Ya(e){return q(await G.api.v1.p[`:projectId`].tracker.connection.$get({param:{projectId:r()}},K(e)),`/tracker/connection`)}async function Xa(e){return q(await G.api.v1.p[`:projectId`].tracker.connection.$put({param:{projectId:r()},json:e}),`/tracker/connection`)}async function Za(){return q(await G.api.v1.p[`:projectId`].tracker.connection.$delete({param:{projectId:r()}}),`/tracker/connection`)}async function Qa(e){return q(await G.api.v1.p[`:projectId`].secrets.$get({param:{projectId:r()}},K(e)),`/secrets`)}async function $a(e){return q(await G.api.v1.workspace.secrets.$get({},K(e)),`/workspace/secrets`)}async function eo(e){if(!e.ok)throw W(e.status,e.statusText,await e.text())}async function to(e,t){await eo(await G.api.v1.p[`:projectId`].secrets[`:name`].$put({param:{projectId:r(),name:e},json:t}))}async function no(e){await eo(await G.api.v1.p[`:projectId`].secrets[`:name`].$delete({param:{projectId:r(),name:e}}))}async function ro(e,t){await eo(await G.api.v1.workspace.secrets[`:name`].$put({param:{name:e},json:t}))}async function io(e){await eo(await G.api.v1.workspace.secrets[`:name`].$delete({param:{name:e}}))}async function ao(e){return q(await G.api.v1.p[`:projectId`].e2e.$get({param:{projectId:r()}},K(e)),`/e2e`)}async function oo(e){return q(await G.api.v1.p[`:projectId`].e2e.setup.$post({param:{projectId:r()},json:e}),`/e2e/setup`)}async function so(e){return q(await G.api.v1.p[`:projectId`].tracker.association.$get({param:{projectId:r()}},K(e)),`/tracker/association`)}async function co(e,t={},n){return q(await G.api.v1.p[`:projectId`].tracker.candidates.$get({param:{projectId:r()},query:{kind:e,q:t.q,cursor:t.cursor,limit:t.limit===void 0?void 0:String(t.limit)}},K(n)),`/tracker/candidates`)}async function lo(e){return q(await G.api.v1.p[`:projectId`].tracker.association.$put({param:{projectId:r()},json:e}),`/tracker/association`)}async function uo(){return q(await G.api.v1.p[`:projectId`].tracker.association.$delete({param:{projectId:r()}}),`/tracker/association`)}function fo(e){return{expectedScope:e.association?d(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 po(e={},t){return q(await G.api.v1.p[`:projectId`].tracker.$get({param:{projectId:r()},query:fo(e)},K(t)),`/tracker`)}async function mo(e,t={},n){return q(await G.api.v1.p[`:projectId`].tracker.search.$get({param:{projectId:r()},query:{...fo(t),q:e}},K(n)),`/tracker/search`)}async function ho(e,t){return q(await G.api.v1.p[`:projectId`].tracker[`:id`].$get({param:{projectId:r(),id:encodeURIComponent(e)},query:{expectedScope:t?.association?d(t.association):void 0}},K(t)),`/tracker/${encodeURIComponent(e)}`)}async function go(e,t){return q(await G.api.v1.p[`:projectId`].github.checks.$get({param:{projectId:r()},query:{prs:e.join(`,`)}},K(t)),`/github/checks`)}async function _o(e,t,n={},i){return q(await G.api.v1.p[`:projectId`].github.search.$get({param:{projectId:r()},query:{kind:e,q:t,limit:n.limit}},K(i)),`/github/search`)}async function vo(e,t,n){return q(await G.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(`,`)}:{}}},K(n)),`/github/ref-status`)}async function yo(e,t,n={},i){return q(await G.api.v1.p[`:projectId`].github.comments[`:kind`][`:number`].$get({param:{projectId:r(),kind:e,number:String(t)},query:{refresh:n.refresh?`1`:void 0}},K(i)),`/github/comments/${e}/${t}`)}async function bo(e,t={},n){return q(await G.api.v1.p[`:projectId`].github.prs[`:number`][`merge-state`].$get({param:{projectId:r(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},K(n)),`/github/prs/${e}/merge-state`)}async function xo(e,t){return q(await G.api.v1.p[`:projectId`].github.prs[`:number`].merge.$post({param:{projectId:r(),number:String(e)},json:t}),`/github/prs/:number/merge`)}async function So(e,t={},n){return q(await G.api.v1.p[`:projectId`].github.prs[`:number`].changes.$get({param:{projectId:r(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},K(n)),`/github/prs/${e}/changes`)}function Co(e,t){return fa(J(e,`/diff`),{method:`GET`,signal:t?.signal})}function wo(e,t){return fa(J(e,`/handoff`),{method:`GET`,signal:t?.signal})}async function To(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`].changes.$get({param:{projectId:r(),id:encodeURIComponent(e)}},K(t)),J(e,`/changes`))}async function Eo(e,t,n){return q(await G.api.v1.p[`:projectId`].runs[`:id`].files.$get({param:{projectId:r(),id:encodeURIComponent(e)},query:{path:t}},K(n)),`/runs/:id/files`)}function Do(e,t){return o(J(e,`/files?path=${encodeURIComponent(t)}&raw=1`))}async function Oo(e,t){return q(await G.api.v1.p[`:projectId`].groups[`:groupId`].$get({param:{projectId:r(),groupId:encodeURIComponent(e)}},K(t)),`/groups/${encodeURIComponent(e)}`)}async function ko(e,t){return q(await G.api.v1.providers.connect.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/connect`)}async function Ao(e,t){return Wi(await q(await G.api.v1.providers[`:provider`].enabled.$put({param:{provider:e},json:{enabled:t}}),`/providers/${encodeURIComponent(e)}/enabled`))}async function jo(e,t){return Wi(await q(await G.api.v1.providers[`:provider`].retry.$post({param:{provider:e},json:{authFailureId:t}}),`/providers/${encodeURIComponent(e)}/retry`))}async function Mo(e){let t=`/projects`,n=await da(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({root:e})}),r=await n.text(),i=ia(r),a=i?.project;if((n.ok||n.status===409)&&a!=null)return i;throw n.ok?new U(n.status,`the cezar server answered ${t} without a project`):W(n.status,n.statusText,r)}async function No(e){return q(await G.api.v1.projects.checkout.$post({json:e}),`/projects/checkout`)}async function Po(e){return q(await G.api.v1.projects[`:projectId`].$delete({param:{projectId:encodeURIComponent(e)}}),`/projects/${encodeURIComponent(e)}`)}async function Fo(e,t){return q(await G.api.v1.projects[`:projectId`].$patch({param:{projectId:encodeURIComponent(e)},json:t}),`/projects/${encodeURIComponent(e)}`)}async function Io(e){return q(await G.api.v1.p[`:projectId`].runs.$post({param:{projectId:r()},json:e}),`/runs`)}async function Lo(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`].cancel.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e,`/cancel`))}async function Ro(e,t=!0){return q(await G.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{archived:t}}),J(e,`/archive`))}async function zo(e,t=!0){return q(await G.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{pinned:t}}),J(e,`/pin`))}async function Bo(e,t,n=!0){return q(await G.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{pinned:n}}),J(t,`/pin`))}async function Vo(e,t,n=!0){return q(await G.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{archived:n}}),J(t,`/archive`))}async function Ho(e,t,n){let r=n?`read`:`unread`;return q(await(n?G.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:e,id:encodeURIComponent(t)}}):G.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:e,id:encodeURIComponent(t)}})),J(t,`/${r}`))}async function Uo(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`][`auto-resume`].$delete({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e,`/auto-resume`))}async function Wo(){return q(await G.api.v1.p[`:projectId`].runs[`archive-finished`].$post({param:{projectId:r()}}),`/runs/archive-finished`)}async function Go(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e,`/read`))}async function Ko(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e,`/unread`))}async function qo(){return q(await G.api.v1.p[`:projectId`].runs[`read-all`].$post({param:{projectId:r()}}),`/runs/read-all`)}async function Jo(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`].finish.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e,`/finish`))}async function Yo(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.agentProfile===void 0?{}:{agentProfile:t.agentProfile}};return q(await G.api.v1.p[`:projectId`].runs[`:id`].continue.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:n}),J(e,`/continue`))}async function Xo(e,t,n={}){return q(await G.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}}}),J(t,`/continue`))}async function Zo(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`].pr.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e,`/pr`))}async function Qo(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`].$patch({param:{projectId:r(),id:encodeURIComponent(e)},json:t}),J(e))}async function $o(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`].$delete({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e))}async function es(e){return q(await G.api.v1.p[`:projectId`].todos[`:id`].$delete({param:{projectId:r(),id:encodeURIComponent(e)}}),`/todos/${encodeURIComponent(e)}`)}async function ts(e,t={}){let n={...t.runner===void 0?{}:{runner:t.runner},...t.model===void 0?{}:{model:t.model},...t.prompt===void 0?{}:{prompt:t.prompt}};return q(await G.api.v1.p[`:projectId`].todos[`:id`].start.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:Object.keys(n).length>0?n:void 0}),`/todos/${encodeURIComponent(e)}/start`)}async function ns(e,t){return q(await G.api.v1.p[`:projectId`].groups[`:groupId`].pick.$post({param:{projectId:r(),groupId:encodeURIComponent(e)},json:{runId:t}}),`/groups/${encodeURIComponent(e)}/pick`)}async function rs(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`][`open-in-cli`].$post({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e,`/open-in-cli`))}async function is(e){return q(await G.api.v1.p[`:projectId`][`open-targets`].$get({param:{projectId:r()}},K(e)),`/open-targets`)}async function as(e){return q(await G.api.v1.p[`:projectId`][`open-in`].$post({param:{projectId:r()},json:{target:e}}),`/open-in`)}async function os(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{target:t}}),J(e,`/open-in`))}async function ss(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{target:`default`,path:t}}),J(e,`/open-in`))}async function cs(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`].git.commit.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{message:t}}),J(e,`/git/commit`))}async function ls(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`].git.push.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e,`/git/push`))}async function us(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{text:t.text??``,images:t.images??[]}}),J(e,`/messages`))}async function ds(e,t,n){return q(await G.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{text:n.text??``,images:n.images??[]}}),J(t,`/messages`))}async function fs(e,t,n){return q(await G.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$patch({param:{projectId:r(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)},json:n}),J(e,`/queued-messages/${encodeURIComponent(t)}`))}async function ps(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$delete({param:{projectId:r(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)}}),J(e,`/queued-messages/${encodeURIComponent(t)}`))}async function ms(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`].drafts.$get({param:{projectId:r(),id:encodeURIComponent(e)}},K(t)),J(e,`/drafts`))}var hs=56*1024;async function gs(e,t,n,i){let a=i?.keepalive===!0&&new TextEncoder().encode(JSON.stringify(n)).length<=hs;return q(await G.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].$put({param:{projectId:r(),id:encodeURIComponent(e),surface:t},json:n},{init:{keepalive:a}}),J(e,`/drafts/${t}`))}async function _s(e,t,n){return q(await G.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images.$post({param:{projectId:r(),id:encodeURIComponent(e),surface:t},json:n}),J(e,`/drafts/${t}/images`))}async function vs(e,t,n,i){return q(await G.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$get({param:{projectId:r(),id:encodeURIComponent(e),surface:t,imageId:n}},K(i)),J(e,`/drafts/${t}/images/${n}`))}async function ys(e,t,n){return q(await G.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$delete({param:{projectId:r(),id:encodeURIComponent(e),surface:t,imageId:n}}),J(e,`/drafts/${t}/images/${n}`))}async function bs(e){return q(await G.api.v1.p[`:projectId`].repo.branch.$post({param:{projectId:r()},json:e}),`/repo/branch`)}async function xs(e){return q(await G.api.v1.p[`:projectId`].plan.$post({param:{projectId:r()},json:{task:e}}),`/plan`)}async function Ss(e){return q(await G.api.v1.p[`:projectId`].automations.$get({param:{projectId:r()}},K(e)),`/automations`)}async function Cs(e){return q(await G.api.v1.p[`:projectId`].automations.$post({param:{projectId:r()},json:e}),`/automations`)}async function ws(e,t){return q(await G.api.v1.p[`:projectId`].automations[`:id`].$put({param:{projectId:r(),id:encodeURIComponent(e)},json:t}),`/automations/${encodeURIComponent(e)}`)}async function Ts(e,t){let n={projectId:r(),id:encodeURIComponent(e)},i=`/automations/${encodeURIComponent(e)}/${t?`enable`:`pause`}`;return q(t?await G.api.v1.p[`:projectId`].automations[`:id`].enable.$post({param:n}):await G.api.v1.p[`:projectId`].automations[`:id`].pause.$post({param:n}),i)}async function Es(e,t){return q(await G.api.v1.p[`:projectId`].automations[`:id`].check.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{mode:t}}),`/automations/${encodeURIComponent(e)}/check`)}async function Ds(e,t){return q(await G.api.v1.p[`:projectId`][`automation-log`].$get({param:{projectId:r()},query:{automationId:e}},K(t)),`/automation-log?automationId=${encodeURIComponent(e)}`)}async function Os(e){return q(await G.api.v1.p[`:projectId`][`automation-log`][`:receiptId`].retry.$post({param:{projectId:r(),receiptId:encodeURIComponent(e)}}),`/automation-log/${encodeURIComponent(e)}/retry`)}async function ks(e){return q(await G.api.v1.p[`:projectId`].automations[`:id`].run.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),`/automations/${encodeURIComponent(e)}/run`)}async function As(e){let t=await G.api.v1.p[`:projectId`].automations[`:id`].$delete({param:{projectId:r(),id:encodeURIComponent(e)}});if(!t.ok)throw W(t.status,t.statusText,await t.text())}async function js(e,t){return q(await G.api.v1.workspace[`automation-templates`].$get({query:e?{exclude:e}:{}},K(t)),`/workspace/automation-templates`)}async function Ms(e){return q(await G.api.v1.p[`:projectId`].workflows.$post({param:{projectId:r()},json:e}),`/workflows`)}async function Ns(e){return q(await G.api.v1.p[`:projectId`].workflows.nodes.$get({param:{projectId:r()}},K(e)),`/workflows/nodes`)}async function Ps(e){return q(await G.api.v1.p[`:projectId`].workflows.validate.$post({param:{projectId:r()},json:{graph:e}}),`/workflows/validate`)}async function Fs(e){return q(await G.api.v1.p[`:projectId`].workflows.graph.$post({param:{projectId:r()},json:e}),`/workflows/graph`)}async function Is(e){return q(await G.api.v1.p[`:projectId`].workflows.parse.$post({param:{projectId:r()},json:{yaml:e}}),`/workflows/parse`)}async function Ls(e){return q(await G.api.v1.p[`:projectId`].workflows[`:name`].$delete({param:{projectId:r(),name:encodeURIComponent(e)}}),`/workflows/${encodeURIComponent(e)}`)}async function Rs(e,t=r()){return q(await G.api.v1.p[`:projectId`][`ui-state`].$put({param:{projectId:t},json:e}),`/ui-state`)}async function zs(e){return q(await G.api.v1.workspace[`ui-state`].$get({},K(e)),`/workspace/ui-state`)}async function Bs(e,t={}){return q(await G.api.v1.workspace[`ui-state`].$put({json:e},{init:{keepalive:t.keepalive}}),`/workspace/ui-state`)}async function Vs(e){let t=await q(await G.api.v1.workspace.config.$get({},K(e)),`/workspace/config`);return{...t,branding:t.branding?{...t.branding,logoUrl:t.branding.logoUrl?p(t.branding.logoUrl):null}:{name:`cezar`,logoUrl:null},agentDefaults:t.agentDefaults??{},resources:{...t.resources,idleTimeoutMinutes:t.resources.idleTimeoutMinutes===void 0?15:t.resources.idleTimeoutMinutes}}}async function Hs(e){let t=new FormData;t.set(`file`,e);let n=await da(`/workspace/branding-logo`,{method:`POST`,body:t}),r=await n.text();if(!n.ok)throw W(n.status,n.statusText,r);let i=ia(r),a=m.safeParse(i);if(!a.success)throw new U(n.status,`the cezar server answered /workspace/branding-logo with an unexpected body`);return a.data.logoUrl?p(a.data.logoUrl):null}async function Us(){let e=await da(`/workspace/branding-logo`,{method:`DELETE`}),t=await e.text();if(!e.ok)throw W(e.status,e.statusText,t);let n=m.safeParse(ia(t));if(!n.success)throw new U(e.status,`the cezar server answered /workspace/branding-logo with an unexpected body`);return n.data.logoUrl?p(n.data.logoUrl):null}async function Ws(e){return q(await G.api.v1.workspace[`host-usage`].$get({},K(e)),`/workspace/host-usage`)}async function Gs(e){let t=await q(await G.api.v1.workspace[`agent-profiles`].$get({},K(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 Ks(e){return q(await G.api.v1.workspace[`agent-profiles`].$post({json:e}),`/workspace/agent-profiles`)}async function qs(e,t){return q(await G.api.v1.workspace[`agent-profiles`][`:id`].status.$get({param:{id:encodeURIComponent(e)},query:t?.refresh?{refresh:`1`}:{}},K(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/status`)}async function Js(e,t){return q(await G.api.v1.workspace[`agent-profiles`][`:id`].details.$get({param:{id:encodeURIComponent(e)}},K(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/details`)}async function Ys(e,t){return q(await G.api.v1.workspace[`agent-profiles`][`:id`].open.$post({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}/open`)}async function Xs(e){return q(await G.api.v1.workspace[`agent-profiles`].selection.$put({json:e}),`/workspace/agent-profiles/selection`)}async function Zs(e,t){return q(await G.api.v1.workspace[`agent-profiles`][`:id`].$patch({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function Qs(e){return q(await G.api.v1.workspace[`agent-profiles`][`:id`].$delete({param:{id:encodeURIComponent(e)}}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function $s(e,t){return q(await G.api.v1.workspace[`skills-update`].$get({query:{projectId:e}},K(t)),`/workspace/skills-update?projectId=${encodeURIComponent(e)}`)}async function ec(e){return q(await G.api.v1.workspace[`skills-update`].check.$post({json:{projectId:e}}),`/workspace/skills-update/check`)}async function tc(e){return q(await G.api.v1.workspace[`skills-update`].apply.$post({json:{projectId:e}}),`/workspace/skills-update/apply`)}async function nc(e){return q(await G.api.v1.workspace[`self-update`].$get({},K(e)),`/workspace/self-update`)}async function rc(){return q(await G.api.v1.workspace[`self-update`].refresh.$post({}),`/workspace/self-update/refresh`)}async function ic(e){return q(await G.api.v1.workspace[`self-update`].development.$get({query:e?.refresh?{refresh:`1`}:{}},K(e)),`/workspace/self-update/development`)}async function ac(e){return q(await G.api.v1.workspace[`self-update`].channel.$put({json:{channel:e}}),`/workspace/self-update/channel`)}async function oc(e){return q(await G.api.v1.workspace[`self-update`].apply.$post({json:{version:e}}),`/workspace/self-update/apply`)}async function sc(e){return q(await G.api.v1.workspace.config.$put({json:e}),`/workspace/config`)}async function cc(e){return q(await G.api.v1.p[`:projectId`].config.$put({param:{projectId:r()},json:e}),`/config`)}async function lc(e){return q(await G.api.v1.p[`:projectId`].worktrees.$get({param:{projectId:r()}},K(e)),`/worktrees`)}async function uc(){return q(await G.api.v1.p[`:projectId`].worktrees.reclaim.$post({param:{projectId:r()},json:{}}),`/worktrees/reclaim`)}async function dc(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`][`remove-worktree`].$post({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e,`/remove-worktree`))}async function fc(e,t,n){return i.parse(await q(await G.api.v1.p[`:projectId`].tracker.watch.$post({param:{projectId:e},json:t},{init:{signal:n}}),`/tracker/watch`))}async function pc(e,t,n,r){return l.parse(await q(await G.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 mc(e,t,n){return l.parse(await q(await G.api.v1.p[`:projectId`].tracker.watch[`:watchId`].$post({param:{projectId:e,watchId:t}},{init:{signal:n}}),`/tracker/watch`))}var hc={projectId:null,apiBase:a},gc=(0,k.createContext)(hc);function _c(){return(0,k.useContext)(gc)}function vc({projectId:e,children:t}){_()!==e&&f(e),(0,k.useLayoutEffect)(()=>{f(e)},[e]),(0,k.useLayoutEffect)(()=>()=>f(null),[]);let n=(0,k.useMemo)(()=>e===null?hc:{projectId:e,apiBase:`${a}/p/${encodeURIComponent(e)}`},[e]);return(0,A.jsx)(gc.Provider,{value:n,children:t})}var yc={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`}},bc={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function xc(e){return typeof e==`string`&&Object.hasOwn(yc,e)}function Sc(e){return e!==void 0&&xc(e)?yc[e]:void 0}var Cc={permission:0,error:1,waiting:2,running:3,unseen:4,none:5};function wc(e){return!1}function Tc(e){return!1}function Ec(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 Dc(e){return e.status===`failed`&&e.awaitingAnswerSince!==void 0}function Oc(e){return e.status===`waiting`||e.status===`review`||Dc(e)}function kc(e){return wc(e)?{bucket:`permission`,tone:`violet`,pulse:!0,label:`needs permission`}:e.status===`failed`&&e.autoResumeAt?{bucket:`none`,tone:`pending`,pulse:!1,label:`scheduled`}:Dc(e)?{bucket:`waiting`,tone:`pending`,pulse:!0,label:`needs you`}:e.status===`failed`?{bucket:`error`,tone:`danger`,pulse:!1,label:`failed`}:e.status===`waiting`?{bucket:`waiting`,tone:`pending`,pulse:!0,label:Ec(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`}:Tc(e)?{bucket:`unseen`,tone:`violet`,pulse:!1,label:`unseen`}: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 Ac(e){return Cc[kc(e).bucket]<=Cc.waiting}var jc=[`Pinned`,`Needs you`,`Working`,`Recent`,`Archived`],Mc={waiting:0,review:1,running:2,queued:4,done:5,failed:6,cancelled:7},Nc=3,Pc=e=>e.status===`failed`&&e.autoResumeAt!==void 0?Nc:Dc(e)?Mc.waiting??0:Mc[e.status]??9;function Fc(e,t){return t===`archived`?`Archived`:e.pinned?`Pinned`:Oc(e)?`Needs you`:e.status===`running`||e.status===`queued`||e.status===`failed`&&e.autoResumeAt?`Working`:`Recent`}function Ic(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function Lc(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 Rc(e,t){return t!==void 0&&Lc(e).ref===t}function zc(e){return e.title.replace(/ \([A-C]\)$/,``)}function Bc(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));return new Map(t.map((e,t)=>[e.id,t+1]))}function Vc(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=Pc(e)-Pc(n);if(r!==0)return r;if(Pc(e)===Nc&&e.autoResumeAt&&n.autoResumeAt){let t=e.autoResumeAt.localeCompare(n.autoResumeAt);if(t!==0)return t}return e.status===`queued`&&n.status===`queued`?e.createdAt.localeCompare(n.createdAt):n.createdAt.localeCompare(e.createdAt)})}function Hc(e,t){let n=Bc(e),r=Vc(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(Fc(e,t),{kind:`group`,groupId:e.groupId,title:zc(e),members:n});continue}}a(Fc(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null})}return jc.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function Uc(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 Wc(e){let t=0,n=0,r=0;for(let i of e){if(i.archived){n+=1;continue}t+=1,Oc(i)&&(r+=1)}return{active:t,archived:n,waiting:r}}var Gc=new Set([`running`,`waiting`]),Kc=new Set([`done`,`failed`,`review`,`cancelled`]),qc=new Set([`done`,`failed`,`cancelled`]);function Jc(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 Yc(e){return e?`$${e>=10?e.toFixed(0):e.toFixed(2)}`:``}function Xc(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 Zc(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 Qc(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[Ic(e),e.branch??``,e.workflow,Zc(e)].some(e=>e.toLowerCase().includes(n))):[...e]}function $c(e){return e.filter(e=>!e.archived&&qc.has(e.status)&&!Dc(e)).length}function el(e){if(!e)return;let t=e.trim().replace(/\/+$/,``),n=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(t),r=n?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(t),i=n??r;if(!i)return;let[,a,o]=i;if(!o||a?.toLowerCase()!==`github.com`)return;let s=o.replace(/\.git$/i,``).split(`/`).filter(Boolean),c=s[s.length-2],l=s[s.length-1];return c&&l?`https://github.com/${c}/${l}`:void 0}function tl(e){return nl(e)[0]?.url??rl(e)[0]}function nl(e,t){if(!e.prRefs?.length)return rl(e).map(e=>({number:Number(ll(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??sl(`PR`,e.number,t),origin:e.origin}))}function rl(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 il(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.markerRefs?.issue??e.issueNumber;if(!(!n||!t))return`${t}/issues/${n}`}function al(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 ol(e,t){let n=e.prRefs?.length?nl(e,t).map(e=>({number:e.number,url:e.url})):rl(e).map(e=>({url:e,number:Number(ll(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:e.prNumber},{kind:`Issue`,url:il(e,t)},{kind:`Issue`,number:e.issueNumber}],a=new Set,o=[];for(let e of i){let n=e.url?Number(ll(e.url)):e.number;if(!n||!Number.isInteger(n))continue;let r=e.url??sl(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 sl(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function cl(e){return ol(e)[0]}function ll(e){let t=e.split(`/`).pop()??``;return/^\d+$/.test(t)?t:null}function ul(e,t){let n=Gc.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:Jc(n.rssBytes),kind:`live`}};let r=Jc(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 dl(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=>Kc.has(e.status))?[]:[{groupId:e,title:zc(n),count:t.length}]})}function fl(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 pl(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 ml(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 hl=`/api/v1/ws`,gl=3e3,_l=1e3,vl=7e4,yl=0,bl=1;function xl(e){let t=new Map,n=new Map,r=null,i,a,o,s=()=>{clearTimeout(o),o=setTimeout(()=>{o=void 0,r?.close()},vl)},c=()=>e??`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${hl}`,l=e=>{r?.readyState===bl&&r.send(JSON.stringify(e))},u=()=>{let e=globalThis.WebSocket;if(typeof e!=`function`||r&&(r.readyState===yl||r.readyState===bl))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()},gl)))}),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)},_l))))}}}}var Sl=null;function Cl(e,t,n){return Sl??=xl(),Sl.subscribe(e,t,n)}var Y={secrets:{allFor:e=>[`secrets`,e],list:()=>[`secrets`,r()]},e2e:{allFor:e=>[`e2e`,e],status:()=>[`e2e`,r()]},tracker:{allFor:e=>[`tracker`,e],all:()=>[`tracker`,r()],associationFor:e=>[`tracker`,e,`association`],association:()=>[`tracker`,r(),`association`],candidates:(e,t=``)=>[`tracker`,r(),`candidates`,e,t],connection:()=>[`tracker`,r(),`connection`],items:(e,t)=>[`tracker`,r(),`items`,e.kind,e.source.id,e.source.webUrl,e.externalId,e.connectionId??null,t.state,[...t.labels],t.query??``],detail:(e,t)=>[`tracker`,r(),`detail`,e.kind,e.source.id,e.source.webUrl,e.externalId,e.connectionId??null,t]},get health(){return[r(),`health`]},runs:{get all(){return[r(),`runs`]},list:()=>[r(),`runs`,`list`],detail:e=>[r(),`runs`,`detail`,e],diff:e=>[r(),`runs`,`diff`,e],changes:e=>[r(),`runs`,`changes`,e],file:(e,t)=>[r(),`runs`,`files`,e,t],handoff:e=>[r(),`runs`,`handoff`,e],drafts:e=>[r(),`runs`,`drafts`,e],commits:e=>[r(),`runs`,`commits`,e],commit:(e,t)=>[r(),`runs`,`commit`,e,t]},groups:{detail:e=>[r(),`groups`,e]},get todos(){return[r(),`todos`]},get workflows(){return[r(),`workflows`]},get workflowNodes(){return[r(),`workflow-nodes`]},get skills(){return[r(),`skills`]},get skillsReady(){return[r(),`skills`,`ready`]},get importableSkills(){return[r(),`skills`,`importable`]},get importableSkillsReady(){return[r(),`skills`,`importable`,`ready`]},get launchKey(){return[r(),`launch-key`]},get repo(){return[r(),`repo`]},get repoChanges(){return[r(),`repo`,`changes`]},repoCommit:e=>[r(),`repo`,`commit`,e],get repoTree(){return[r(),`repo`,`tree`]},repoFile:e=>[r(),`repo`,`file`,e],get uiState(){return[r(),`ui-state`]},get config(){return[r(),`config`]},get agentConfig(){return[r(),`agent-config`]},agentConfigFile:e=>[r(),`agent-config`,`file`,e],get worktrees(){return[r(),`worktrees`]},github:(e={})=>[r(),`github`,e.limit??null],githubPages:(e=50)=>[r(),`github`,`pages`,e],githubChecks:e=>[r(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[r(),`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)=>[r(),`github`,`comments`,e,t],githubMergeState:e=>[r(),`github`,`merge-state`,e],get openTargets(){return[r(),`open-targets`]}},wl=6e4;function Tl(){return M({queryKey:Y.secrets.list(),queryFn:({signal:e})=>Qa({signal:e})})}function El(){return M({queryKey:X.secrets,queryFn:({signal:e})=>$a({signal:e})})}function Dl(){return M({queryKey:Y.e2e.status(),queryFn:({signal:e})=>ao({signal:e})})}function Ol(){return M({queryKey:Y.tracker.connection(),queryFn:({signal:e})=>Ya({signal:e})})}function kl(){return M({queryKey:Y.tracker.association(),queryFn:({signal:e})=>so({signal:e})})}function Al(e,t,n){return jt({queryKey:Y.tracker.candidates(e,t),staleTime:wl,queryFn:({pageParam:n,signal:r})=>co(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 jl=class extends Error{failure;constructor(e){super(e.reason),this.failure=e,this.name=`TrackerRefreshError`}};function Ml(e,t,n=!0){let i=t.query.trim(),a=j(),o=e?Y.tracker.items(e,{...t,query:i}):[`tracker`,r(),`items`,`unassociated`];return{...jt({queryKey:o,staleTime:1/0,queryFn:({pageParam:n,signal:r})=>i?mo(i,{association:e??void 0,cursor:n,limit:50,state:t.state,labels:t.labels,refresh:!0},{signal:r}):po({association:e??void 0,cursor:n,limit:50,state:t.state,labels:t.labels,refresh:!1},{signal:r}),initialPageParam:void 0,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,enabled:e!=null&&n}),queryKey:o,restart:async()=>{await a.cancelQueries({queryKey:o,exact:!0});try{await a.fetchInfiniteQuery({queryKey:o,initialPageParam:void 0,pages:1,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,staleTime:0,retry:!1,queryFn:async({signal:n})=>{let r={association:e??void 0,limit:50,state:t.state,labels:t.labels,refresh:!0},a=i?await mo(i,r,{signal:n}):await po(r,{signal:n});if(!a.available)throw new jl(a);return a}})}catch{}}}}function Nl(e,t){return M({staleTime:wl,queryKey:e&&t?Y.tracker.detail(e,t):[`tracker`,r(),`detail`,`disabled`],queryFn:({signal:n})=>ho(t,{signal:n,association:e??void 0}),enabled:e!=null&&t!=null&&t!==``})}var X={dashboard:[`workspace`,`dashboard`],models:e=>[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],projects:[`workspace`,`projects`],runsIndex:[`workspace`,`runs-index`],secrets:[`workspace`,`secrets`],uiState:[`workspace`,`ui-state`],config:[`workspace`,`config`],hostUsage:[`workspace`,`host-usage`],agentProfiles:[`workspace`,`agent-profiles`],agentAccountDetails:e=>[`workspace`,`agent-profiles`,`details`,e],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],skillsUpdate:e=>[`workspace`,`skills-update`,e],selfUpdate:[`workspace`,`self-update`],selfUpdateDevelopment:[`workspace`,`self-update`,`development`],starCount:[`workspace`,`star-count`],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...X.fsBrowseRoot,e,t]};function Z(e,t=!0){return M({queryKey:X.models(e),queryFn:({signal:t})=>h(e)?ha(e,{signal:t}):Promise.reject(Error(`${e} has no host model catalog`)),staleTime:300*1e3,enabled:t&&h(e)})}function Pl(e=!0){let t=Z(`claude`,e),n=Z(`codex`,e),r=Z(`opencode`,e),i=Z(`cursor`,e),a=Z(`pi`,e);return{claude:t,codex:n,junie:Z(`junie`,e),opencode:r,cursor:i,pi:a,copilot:Z(`copilot`,e)}}function Fl(){let e=j();return M({queryKey:X.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(X.providerStatus),r=await ga(!1,{signal:t});return Ki(n,e.getQueryData(X.providerStatus),r)},staleTime:5*6e4,refetchInterval:!1,refetchOnWindowFocus:!0})}function Il(){let e=j();return N({mutationFn:()=>ga(!0),onMutate:()=>e.getQueryData(X.providerStatus),onSuccess:(t,n,r)=>e.setQueryData(X.providerStatus,e=>Ki(r,e,t))})}function Ll(){let e=j();return N({mutationFn:({provider:e,authFailureId:t})=>jo(e,t),onMutate:()=>e.getQueryData(X.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(X.providerStatus,e=>Ki(r,e,t,n.authFailureId))}})}function Rl(){return M({queryKey:X.projects,queryFn:({signal:e})=>va({signal:e})})}function zl(e,t=!1){return M({queryKey:X.fsBrowse(e,t),queryFn:({signal:n})=>ya(e??void 0,{signal:n,showHidden:t}),retry:!1})}function Bl(){let e=j();return N({mutationFn:e=>Mo(e),onSuccess:()=>e.invalidateQueries({queryKey:X.projects})})}function Vl(){let e=j();return N({mutationFn:e=>Po(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:X.projects})}})}function Hl(){let e=j();return N({mutationFn:e=>{let{id:t,...n}=e;return Fo(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:X.projects});let r=e.getQueryData(X.projects);return e.setQueryData(X.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?Ul(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(X.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(X.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:X.projects})})}function Ul(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?[]:ml(s);return c.length>0&&(a.tags=c),a}function Wl(e){let t=j();return N({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:X.agentProfiles}),t.invalidateQueries({queryKey:X.projects})])}})}function Gl(){return Wl(e=>Ks(e))}function Kl(){return Wl(e=>{let{id:t,...n}=e;return Zs(t,n)})}function ql(){return Wl(e=>Qs(e))}function Jl(){return Wl(e=>Xs(e))}function Yl(e,t){return M({queryKey:X.agentAccountDetails(e),queryFn:({signal:t})=>Js(e,{signal:t}),enabled:t,staleTime:0,retry:!1})}function Xl(e,t){return M({queryKey:X.agentAccountStatus(e),queryFn:({signal:t})=>qs(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function Zl(){let e=j();return N({mutationFn:({provider:e,profileId:t})=>ko(e,t),retry:!1,onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:X.agentProfiles}),e.invalidateQueries({queryKey:X.providerStatus})])}})}function Ql(){let e=j();return N({mutationFn:e=>qs(e,{refresh:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(X.agentAccountStatus(n),t),e.invalidateQueries({queryKey:X.agentProfiles})}})}function $l(){return N({mutationFn:e=>{let{routeId:t,...n}=e;return Ys(t,n)},retry:!1})}function eu(){let e=j();return N({mutationFn:e=>No(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:X.projects})})}function tu(){let e=j();(0,k.useEffect)(()=>{let t,n=()=>{let n=e.getQueryData(Y.health)?.capabilities?.localHandoff===!0;n&&t===void 0?t=Cl(`health`,t=>{e.setQueryData(Y.health,t)}):!n&&t!==void 0&&(t(),t=void 0)};n();let r=e.getQueryCache().subscribe(n);return()=>{r(),t?.()}},[e])}function nu(){return M({queryKey:Y.health,queryFn:({signal:e})=>pa({signal:e})})}function ru(){let e=nu().data,t=Rl().data?.projects,{projectId:n}=_c(),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?el(e?.repo?.remote):void 0}function iu(){return M({queryKey:Y.openTargets,queryFn:({signal:e})=>is({signal:e}),staleTime:5*6e4})}function au(e){return M({queryKey:Y.runs.list(),queryFn:({signal:e})=>ba({signal:e}),select:e})}function ou(e=!0,t){return M({queryKey:X.runsIndex,queryFn:({signal:e})=>Sa({signal:e}),enabled:e,staleTime:3e4,...t===void 0?{}:{refetchInterval:t}})}function su(e,t=!0,n=!1,r){return M({queryKey:[n?`default`:e,`runs`,`list`],queryFn:({signal:t})=>xa(e,{signal:t}),enabled:t,select:r})}function cu(e,t,n){let r=e==="default"?null:e,i=r===null||t!=null&&r===t;return su(i?`default`:r??`default`,!0,i,n)}function lu(e){return{queryKey:Y.runs.detail(e),queryFn:({signal:t})=>Ca(e,{signal:t})}}function uu(e){return M({...lu(e??``),enabled:!!e})}function du(e,t,n=!0){return M({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>wa(e,t,{signal:n}),enabled:n&&!!e&&!!t})}function fu(e){return M({queryKey:Y.runs.diff(e??``),queryFn:({signal:t})=>Co(e,{signal:t}),enabled:!!e})}function pu(e,t=!1){return M({queryKey:Y.runs.changes(e??``),queryFn:({signal:t})=>To(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?4e3:!1,refetchOnWindowFocus:!0,staleTime:0})}function mu(e,t){return M({queryKey:Y.runs.file(e??``,t??``),queryFn:({signal:n})=>Eo(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function hu(e){return M({queryKey:Y.groups.detail(e??``),queryFn:({signal:t})=>Oo(e,{signal:t}),enabled:!!e})}function gu(e,t=!1){return M({queryKey:Y.runs.commits(e??``),queryFn:({signal:t})=>Ga(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?5e3:!1})}function _u(e,t){return M({queryKey:Y.runs.commit(e??``,t??``),queryFn:({signal:n})=>Ka(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function vu(e,t=!0){return M({queryKey:Y.runs.handoff(e??``),queryFn:({signal:t})=>wo(e,{signal:t}),enabled:!!e&&t})}function yu(e){return M({queryKey:Y.runs.drafts(e??``),queryFn:({signal:t})=>ms(e,{signal:t}),enabled:!!e,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1})}function bu(e=!0){return M({queryKey:Y.todos,queryFn:({signal:e})=>Pa({signal:e}),enabled:e})}function xu(){return M({queryKey:Y.workflowNodes,queryFn:({signal:e})=>Ns({signal:e}),staleTime:1/0})}function Su(e={}){return M({queryKey:Y.workflows,enabled:e.enabled??!0,queryFn:({signal:e})=>Oa({signal:e})})}function Cu(e=!0){let t=j(),n=Y.skills,r=n[0],i=M({queryKey:n,queryFn:({signal:e})=>ka({signal:e}),enabled:e}),a=M({queryKey:Y.skillsReady,queryFn:({signal:e})=>Aa({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 wu(e=!0){let t=j(),n=Y.importableSkills,r=n[0],i=M({queryKey:n,queryFn:({signal:e})=>Ma({signal:e}),enabled:e}),a=M({queryKey:Y.importableSkillsReady,queryFn:({signal:e})=>Na({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 Tu(){return M({queryKey:Y.launchKey,queryFn:({signal:e})=>_a({signal:e}),staleTime:1/0})}function Eu(){return M({queryKey:Y.repo,queryFn:({signal:e})=>Fa({signal:e})})}function Du(){return M({queryKey:Y.repoChanges,queryFn:({signal:e})=>Ba({signal:e}),retry:!1})}function Ou(){return M({queryKey:Y.repoTree,queryFn:({signal:e})=>Va({signal:e}),retry:!1,refetchOnWindowFocus:!0,staleTime:0})}function ku(e){return M({queryKey:Y.repoFile(e??``),queryFn:({signal:t})=>Ha(e,{signal:t}),enabled:e!==void 0&&e!==``,retry:!1,refetchOnWindowFocus:!0,staleTime:0})}function Au(e){return M({queryKey:Y.repoCommit(e??``),queryFn:({signal:t})=>Wa(e,{signal:t}),enabled:!!e,retry:!1})}function ju(){return M({queryKey:Y.config,queryFn:({signal:e})=>Ia({signal:e})})}function Mu(){return M({queryKey:Y.worktrees,queryFn:({signal:e})=>lc({signal:e})})}function Nu(){return M({queryKey:Y.uiState,queryFn:({signal:e})=>Da({signal:e})})}function Pu(){return M({queryKey:Y.agentConfig,queryFn:({signal:e})=>La({signal:e})})}function Fu(e){return M({queryKey:Y.agentConfigFile(e??``),queryFn:({signal:t})=>Ra(e,{signal:t}),enabled:e!==null})}function Iu(e){let t=j(),n=Y.agentConfig,r=Y.agentConfigFile(e);return N({mutationFn:t=>za(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}function Lu(){return M({queryKey:X.uiState,queryFn:({signal:e})=>zs({signal:e})})}function Ru(){return M({queryKey:X.config,queryFn:({signal:e})=>Vs({signal:e})})}function zu(){return M({queryKey:X.agentProfiles,queryFn:({signal:e})=>Gs({signal:e})})}function Bu(e=!0){return M({queryKey:X.starCount,queryFn:({signal:e})=>ma({signal:e}),enabled:e,staleTime:1/0,retry:!1,refetchOnMount:!1})}function Vu(e,t=!0){return M({queryKey:X.skillsUpdate(e),queryFn:({signal:t})=>$s(e,{signal:t}),enabled:t,refetchInterval:e=>{let t=e.state.data?.status;return t===void 0||t===`idle`||t===`checking`||t===`updating`?6e4:!1}})}function Hu(e=!0){return M({queryKey:X.selfUpdate,queryFn:({signal:e})=>nc({signal:e}),enabled:e,refetchInterval:e=>e.state.data?.job?.status===`running`&&1e3})}function Uu(e=!0){return M({queryKey:X.selfUpdateDevelopment,queryFn:({signal:e})=>ic({signal:e}),enabled:e,staleTime:3e4})}function Wu(){let e=j();return N({mutationFn:()=>ic({refresh:!0}),onSuccess:t=>e.setQueryData(X.selfUpdateDevelopment,t)})}function Gu(){let e=j();return N({mutationFn:()=>rc(),onSuccess:t=>e.setQueryData(X.selfUpdate,t)})}function Ku(){let e=j();return N({mutationFn:e=>ac(e),onSuccess:t=>e.setQueryData(X.selfUpdate,t)})}function qu(){let e=j();return N({mutationFn:e=>oc(e),onSuccess:t=>e.setQueryData(X.selfUpdate,t)})}function Ju(e){let t=j();return N({mutationFn:t=>Qo(e,t),onSuccess:e=>{Yu(t,e),t.invalidateQueries({queryKey:Y.runs.all})}})}function Yu(e,t){e.setQueryData(Y.runs.list(),e=>e?.map(e=>e.id===t.id?ta(e,t):e)),e.setQueryData(Y.runs.detail(t.id),e=>e?ta(e,t):t),Xu(e)}function Xu(e){e.invalidateQueries({queryKey:X.runsIndex})}function Zu(){let e=j();return N({mutationFn:e=>Go(e),onMutate:async t=>{await e.cancelQueries({queryKey:Y.runs.list()}),await e.cancelQueries({queryKey:Y.runs.detail(t)});let n=e.getQueryData(Y.runs.list()),r=e.getQueryData(Y.runs.detail(t)),i=new Date().toISOString();return e.setQueryData(Y.runs.list(),e=>e?.map(e=>e.id===t?{...e,seenAt:i}:e)),e.setQueryData(Y.runs.detail(t),e=>e&&{...e,seenAt:i}),{prevList:n,prevDetail:r,id:t}},onError:(t,n,r)=>{r?.prevList&&e.setQueryData(Y.runs.list(),r.prevList),r?.prevDetail&&e.setQueryData(Y.runs.detail(n),r.prevDetail)},onSuccess:t=>{let n=e=>e.id===t.id?{...e,seenAt:t.seenAt}:e;e.setQueryData(Y.runs.list(),e=>e?.map(n)),e.setQueryData(Y.runs.detail(t.id),e=>e?n(e):t),Xu(e)}})}function Qu(){let e=j();return N({mutationFn:e=>Ko(e),onMutate:async t=>{await e.cancelQueries({queryKey:Y.runs.list()}),await e.cancelQueries({queryKey:Y.runs.detail(t)});let n=e.getQueryData(Y.runs.list()),r=e.getQueryData(Y.runs.detail(t));return e.setQueryData(Y.runs.list(),e=>e?.map(e=>e.id===t?$u(e):e)),e.setQueryData(Y.runs.detail(t),e=>e&&$u(e)),{prevList:n,prevDetail:r,id:t}},onError:(t,n,r)=>{r?.prevList&&e.setQueryData(Y.runs.list(),r.prevList),r?.prevDetail&&e.setQueryData(Y.runs.detail(n),r.prevDetail)},onSuccess:t=>{let n=e=>e.id===t.id?$u(e):e;e.setQueryData(Y.runs.list(),e=>e?.map(n)),e.setQueryData(Y.runs.detail(t.id),e=>e?n(e):t),Xu(e)}})}function $u(e){let{seenAt:t,...n}=e;return n}function ed(e,t){let n=j();return N({mutationFn:({id:t,pinned:n})=>e===void 0?zo(t,n):Bo(e,t,n),onSuccess:()=>n.invalidateQueries({queryKey:t===void 0?Y.runs.all:[t,`runs`]})})}function td(e,t){let n=j();return N({mutationFn:n=>t===void 0?us(e,n):ds(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:Y.runs.all}),onError:e=>{e instanceof U&&e.status===409&&n.invalidateQueries({queryKey:Y.runs.all})}})}function nd(e,t){let n=j();return N({mutationFn:(n={})=>t===void 0?Yo(e,n):Xo(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:Y.runs.all})})}function rd(e){let t=j();return N({mutationFn:({msgId:t,message:n})=>fs(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function id(e){let t=j();return N({mutationFn:t=>ps(e,t),onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function ad(e={},t=!0){return M({queryKey:Y.github(e),queryFn:({signal:t})=>qa({limit:e.limit},{signal:t}),enabled:t})}function od(e=50,t=!0){return jt({queryKey:Y.githubPages(e),queryFn:({pageParam:t,signal:n})=>qa({limit:e,issuesCursor:t.issuesCursor,prsCursor:t.prsCursor},{signal:n}),initialPageParam:{issuesCursor:void 0,prsCursor:void 0},getNextPageParam:e=>{let t=e.issuesNextCursor??void 0,n=e.prsNextCursor??void 0;return t||n?{issuesCursor:t,prsCursor:n}:void 0},enabled:t,staleTime:6e4})}function sd(e,t=!0){return M({queryKey:Y.githubChecks(e),queryFn:({signal:t})=>go(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function cd(e,t,n=!0){return M({queryKey:Y.githubSearch(e,t),queryFn:({signal:n})=>_o(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var ld=100;function ud(e){return[...e].sort((e,t)=>t-e).slice(0,ld).sort((e,t)=>e-t)}var Q=new Map(gd()),dd=1e3;function fd(e,t){if(Q.get(e)!==t){for(Q.delete(e),Q.set(e,t);Q.size>dd;){let e=Q.keys().next().value;if(e===void 0)break;Q.delete(e)}yd()}}var $=new Set(_d());function pd(e,t){if($.has(e)!==t){if(t)for($.add(e);$.size>dd;){let e=$.values().next().value;if(e===void 0)break;$.delete(e)}else $.delete(e);yd()}}var md=`cez.reference-statuses.v1`,hd=`cez.reference-conflicts.v1`;function gd(){try{let e=globalThis.sessionStorage?.getItem(md);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`&&xc(e[1])):[]}catch{return[]}}function _d(){try{let e=globalThis.sessionStorage?.getItem(hd);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var vd;function yd(){vd===void 0&&(vd=setTimeout(()=>{vd=void 0;try{globalThis.sessionStorage?.setItem(md,JSON.stringify([...Q])),globalThis.sessionStorage?.setItem(hd,JSON.stringify([...$]))}catch{}},250))}function bd(){let e=_c(),t=nu();return e.projectId??t.data?.bootProject}function xd(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))fd(wd({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))fd(wd({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var Sd=5*6e4;function Cd(e){return e?e.recheckAfterMs:Sd}var wd=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function Td(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:ud(t.prs),issues:ud(t.issues)}))},[e.map(wd).sort().join(`|`)]),r=kt({queries:n.map(e=>({queryKey:Y.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>vo(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>Cd(e.state.data)??1/0,refetchInterval:e=>Cd(e.state.data)??!1,refetchOnWindowFocus:!0}))}),i=(0,k.useMemo)(()=>{let e=new Map;return r.forEach((t,r)=>{let i=n[r];if(!i)return;let a=[...i.prs.map(e=>({projectId:i.projectId,kind:`PR`,number:e})),...i.issues.map(e=>({projectId:i.projectId,kind:`Issue`,number:e}))],o=t.data;for(let n of a){let r=wd(n),i=Q.get(r),a=$.has(r)?!0:void 0;if(o?.available){let t=o.prs[n.number]??o.issues[n.number];if(t){let i=o.conflicts?o.conflicts.includes(n.number):void 0;fd(r,t),i!==void 0&&pd(r,i),e.set(r,{state:`ready`,status:t,...i??a?{conflicting:!0}:{}})}else e.set(r,{state:`unknown`,...i?{status:i}:{}})}else o?e.set(r,{state:`unavailable`,reason:o.reason,...i?{status:i}:{},...a?{conflicting:!0}:{}}):t.isError?e.set(r,{state:`unavailable`,reason:t.error instanceof Error?t.error.message:void 0,...i?{status:i}:{},...a?{conflicting:!0}:{}}):e.set(r,{state:`loading`,...i?{status:i}:{},...a?{conflicting:!0}:{}})}}),e},[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,k.useCallback)(e=>{let t=wd(e),n=i.get(t);if(n)return n;let r=Q.get(t);return{state:`idle`,...r?{status:r}:{},...$.has(t)?{conflicting:!0}:{}}},[i])}function Ed(e,t,n=!0){return M({queryKey:Y.githubComments(e,t),queryFn:({signal:n})=>yo(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Dd(e){return M({queryKey:[`github`,`pr-changes`,e??0],queryFn:({signal:t})=>So(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}var Od=/^\/p\/([^/]+)(?=\/|$)/;function kd(e){let t=Od.exec(e)?.[1];return t===void 0?null:decodeURIComponent(t)}function Ad(e){let t=Od.exec(e);if(!t)return e;let n=e.slice(t[0].length);return n===``?`/`:n}function jd(e,t){return!t.startsWith(`/`)||t===`/p`||t.startsWith(`/p/`)?t:`/p/${encodeURIComponent(e)}${t}`}function Md(e,t){return e===null?t:typeof t==`string`?jd(e,t):t.pathname===void 0?t:{...t,pathname:jd(e,t.pathname)}}function Nd(){let{projectId:e}=_c(),{pathname:t}=V();return e??kd(t)}function Pd(){let e=Nd();return(0,k.useCallback)(t=>Md(e,t),[e])}function Fd(e){let{pathname:t}=V();return(0,k.useMemo)(()=>cn(e,Ad(t)),[e,t])}function Id({to:e,...t}){let n=Pd();return(0,A.jsx)(yi,{...t,to:n(e)})}function Ld({to:e,...t}){let n=Pd();return(0,A.jsx)(bi,{...t,to:n(e)})}function Rd({to:e,...t}){let n=Pd();return(0,A.jsx)(wr,{...t,to:n(e)})}function zd(){let e=Xn(),t=Pd();return(0,k.useMemo)(()=>((n,r)=>typeof n==`number`?e(n):e(t(n),r)),[e,t])}var Bd=5e3,Vd=200,Hd=[],Ud=1,Wd=new Set,Gd=new Set;function Kd(e){Hd=e;for(let e of Wd)e()}function qd(e){return Wd.add(e),()=>Wd.delete(e)}function Jd(e,t){let n=setTimeout(()=>{Gd.delete(n),e()},t);Gd.add(n)}function Yd(e,t={}){let n={id:Ud++,message:e,tone:t.tone??`default`,...t.action?{action:t.action}:{},exiting:!1},r=t.durationMs??Bd;Kd([...Hd,n]),Jd(()=>{Kd(Hd.map(e=>e.id===n.id?{...e,exiting:!0}:e)),Jd(()=>Kd(Hd.filter(e=>e.id!==n.id)),Vd)},r)}function Xd(){let e=(0,k.useSyncExternalStore)(qd,()=>Hd);return e.length===0?null:(0,A.jsx)(`div`,{"data-slot":`toaster`,className:`pointer-events-none fixed top-[calc(61px+env(safe-area-inset-top))] right-[calc(16px+env(safe-area-inset-right))] z-[60] flex flex-col items-end gap-2 md:top-[calc(16px+env(safe-area-inset-top))]`,children:e.map(e=>(0,A.jsxs)(`div`,{role:`status`,"data-slot":`toast`,"data-tone":e.tone,"data-state":e.exiting?`closed`:`open`,className:g(`pointer-events-auto max-w-[min(360px,calc(100vw-32px))] rounded-md px-3.5 py-2.5 text-[13px] font-medium shadow-modal`,`motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-right-4 motion-safe:duration-200`,`motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:slide-out-to-right-4`,e.tone===`danger`?`bg-danger text-danger-foreground`:`bg-contrast text-contrast-foreground`),children:[e.message,e.action?(0,A.jsxs)(A.Fragment,{children:[` `,(0,A.jsx)(`a`,{"data-slot":`toast-action`,href:e.action.href,target:`_blank`,rel:`noopener noreferrer`,className:`font-semibold underline underline-offset-2 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:e.action.label})]}):null]},e.id))})}export{Fl as $,me as $i,bs as $n,es as $r,X as $t,zl as A,Yi as Ai,kc as An,xo as Ar,Jl as At,wu as B,V as Bi,Wo as Bn,_s as Br,Al as Bt,eu as C,ra as Ci,Bc as Cn,nc as Cr,mu as Ct,Gl as D,Gi as Di,Lc as Dn,Ws as Dr,au as Dt,nd as E,Ri as Ei,Vc as En,po as Er,Z as Et,Dd as F,wr as Fi,Sc as Fn,fc as Fr,Cu as Ft,iu as G,N as Gi,G as Gn,sc as Gr,Kl as Gt,Zu as H,er as Hi,Ro as Hn,cc as Hr,Nl as Ht,cd as I,Tr as Ii,vc as In,Is as Ir,Vu as It,ru as J,j as Ji,uo as Jn,uc as Jr,Su as Jt,Ju as K,M as Ki,Es as Kn,Bs as Kr,Hl as Kt,hu as L,Er as Li,_c as Ln,Qo as Lr,Bu as Lt,sd as M,_i as Mi,Oc as Mn,ss as Mr,Uu as Mt,Ed as N,yi as Ni,Ac as Nn,os as Nr,td as Nt,Dl as O,Hi as Oi,Cc as On,zs as Or,cu as Ot,od as P,bi as Pi,bc as Pn,rs as Pr,Ku as Pt,Rl as Q,O as Qi,Cs as Qn,dc as Qr,Mu as Qt,nu as R,Or as Ri,U as Rn,ns as Rr,bu as Rt,qu as S,$i as Si,Wc as Sn,Ea as Sr,yu as St,Zl as T,Xi as Ti,Ic as Tn,ho as Tr,Pl as Tt,Qu as U,Di as Ui,Uo as Un,gs as Ur,Ml as Ut,Tu as V,Xn as Vi,Vo as Vn,ls as Vr,Ol as Vt,$l as W,jt as Wi,Lo as Wn,Rs as Wr,Nu as Wt,su as X,Ze as Xi,ko as Xn,mc as Xr,El as Xt,du as Y,lt as Yi,cs as Yn,ja as Yr,Ru as Yt,Tl as Z,Be as Zi,Yo as Zn,no as Zr,Lu as Zt,Yl as _,ws as _i,ul as _n,_a as _r,uu as _t,Rd as a,xe as aa,Do as ai,dl as an,ys as ar,Gu as at,Fu as b,na as bi,Hc as bn,Eo as br,gu as bt,Ad as c,ue as ca,Xa as ci,Yc as cn,Jo as cr,ql as ct,Fd as d,Ts as di,al as dn,Ss as dr,Eu as dt,be as ea,Za as ei,Yu as en,Io as er,Iu as et,wl as f,Ho as fi,Xc as fn,qa as fr,Du as ft,lu as g,q as gi,ol as gn,pa as gr,Ll as gt,xd as h,ts as hi,cl as hn,bo as hr,Ou as ht,Ld as i,T as ia,ks as ii,Kc as in,$o as ir,Il as it,ad as j,Ji as ji,Dc as jn,as as jr,Hu as jt,rd as k,Wi as ki,Ec as kn,qo as kr,ou as kt,Nd as l,C as la,Fs as li,Jc as ln,Ds as lr,Vl as lt,Y as m,oo as mi,tl as mn,So as mr,ku as mt,Yd as n,ve as na,Ua as ni,fl as nn,Ms as nr,bd as nt,kd as o,E as oa,to as oi,Qc as on,Ls as or,Wu as ot,jl as p,Ao as pi,il as pn,yo as pr,Au as pt,ed as q,gt as qi,ec as qn,pc as qr,xu as qt,Id as r,_e as ra,Os as ri,pl as rn,As as rr,Td as rt,Md as s,Me as sa,lo as si,$c as sn,Us as sr,Bl as st,Xd as t,ye as ta,io as ti,Cl as tn,Zo as tr,Ql as tt,zd as u,ro as ui,ll as un,js as ur,id as ut,Xl as v,Hs as vi,Zc as vn,vs as vr,pu as vt,ju as w,ta as wi,Rc as wn,Ja as wr,vu as wt,zu as x,ea as xi,zc as xn,Ta as xr,fu as xt,Pu as y,Ps as yi,Uc as yn,ms as yr,_u as yt,tu as z,cn as zi,tc as zn,xs as zr,kl as zt};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{C as i,D as a,E as o,N as s,S as c,T as l,_ as u,b as d,j as f,r as p,w as m,x as h,y as g}from"./button-CjSjKnkd.js";var _=e(n(),1),v=e(t(),1),y=r(),b=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),x=`VisuallyHidden`,S=v.forwardRef((e,t)=>(0,y.jsx)(a.span,{...e,ref:t,style:{...b,...e.style}}));S.displayName=x;var C=S;function w(e){let[t,n]=v.useState(void 0);return m(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var T=[`top`,`right`,`bottom`,`left`],E=Math.min,D=Math.max,O=Math.round,k=Math.floor,A=e=>({x:e,y:e}),j={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function M(e,t,n){return D(e,E(t,n))}function N(e,t){return typeof e==`function`?e(t):e}function P(e){return e.split(`-`)[0]}function F(e){return e.split(`-`)[1]}function I(e){return e===`x`?`y`:`x`}function ee(e){return e===`y`?`height`:`width`}function L(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function R(e){return I(L(e))}function te(e,t,n){n===void 0&&(n=!1);let r=F(e),i=R(e),a=ee(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ce(o)),[o,ce(o)]}function z(e){let t=ce(e);return[B(e),t,B(t)]}function B(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ne=[`left`,`right`],re=[`right`,`left`],ie=[`top`,`bottom`],ae=[`bottom`,`top`];function oe(e,t,n){switch(e){case`top`:case`bottom`:return n?t?re:ne:t?ne:re;case`left`:case`right`:return t?ie:ae;default:return[]}}function se(e,t,n,r){let i=F(e),a=oe(P(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(B)))),a}function ce(e){let t=P(e);return j[t]+e.slice(t.length)}function le(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ue(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:le(e)}function de(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function fe(e,t,n){let{reference:r,floating:i}=e,a=L(t),o=R(t),s=ee(o),c=P(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=F(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function pe(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=N(t,e),p=ue(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=de(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=de(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var me=50,he=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:pe},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=fe(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<me&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=fe(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ge=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=N(e,t)||{};if(l==null)return{};let d=ue(u),f={x:n,y:r},p=R(i),m=ee(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,D=E(d[_],T),O=E(d[v],T),k=C-h[m]-O,A=C/2-h[m]/2+w,j=M(D,A,k),P=!c.arrow&&F(i)!=null&&A!==j&&a.reference[m]/2-(A<D?D:O)-h[m]/2<0,I=P?A<D?A-D:A-k:0;return{[p]:f[p]+I,data:{[p]:j,centerOffset:A-j-I,...P&&{alignmentOffset:I}},reset:P}}}),_e=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=N(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=P(r),_=L(o),v=P(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ce(o)]:z(o)),x=p!==`none`;!d&&x&&b.push(...se(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=te(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==L(t))||T.every(e=>L(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=L(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function ve(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ye(e){return T.some(t=>e[t]>=0)}var be=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=N(e,t);switch(i){case`referenceHidden`:{let e=ve(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ye(e)}}}case`escaped`:{let e=ve(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ye(e)}}}default:return{}}}}},xe=new Set([`left`,`top`]);async function Se(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=P(n),s=F(n),c=L(n)===`y`,l=xe.has(o)?-1:1,u=a&&c?-1:1,d=N(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Ce=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Se(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},we=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=N(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=L(i),p=I(f),m=u[p],h=u[f],g=(e,t)=>M(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Te=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=N(e,t),u={x:n,y:r},d=L(i),f=I(d),p=u[f],m=u[d],h=N(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=xe.has(P(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Ee=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=N(e,t),c=await i.detectOverflow(t,s),l=P(n),u=F(n),d=L(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=E(p-c[m],g),y=E(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*D(c.left,c.right):S=p-2*D(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function De(){return typeof window<`u`}function V(e){return Oe(e)?(e.nodeName||``).toLowerCase():`#document`}function H(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function U(e){return((Oe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Oe(e){return De()?e instanceof Node||e instanceof H(e).Node:!1}function W(e){return De()?e instanceof Element||e instanceof H(e).Element:!1}function G(e){return De()?e instanceof HTMLElement||e instanceof H(e).HTMLElement:!1}function ke(e){return!De()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof H(e).ShadowRoot}function Ae(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=J(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function je(e){return/^(table|td|th)$/.test(V(e))}function Me(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ne=/transform|translate|scale|rotate|perspective|filter/,Pe=/paint|layout|strict|content/,K=e=>!!e&&e!==`none`,Fe;function Ie(e){let t=W(e)?J(e):e;return K(t.transform)||K(t.translate)||K(t.scale)||K(t.rotate)||K(t.perspective)||!Re()&&(K(t.backdropFilter)||K(t.filter))||Ne.test(t.willChange||``)||Pe.test(t.contain||``)}function Le(e){let t=Y(e);for(;G(t)&&!q(t);){if(Ie(t))return t;if(Me(t))return null;t=Y(t)}return null}function Re(){return Fe??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Fe}function q(e){return/^(html|body|#document)$/.test(V(e))}function J(e){return H(e).getComputedStyle(e)}function ze(e){return W(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Y(e){if(V(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ke(e)&&e.host||U(e);return ke(t)?t.host:t}function Be(e){let t=Y(e);return q(t)?(e.ownerDocument||e).body:G(t)&&Ae(t)?t:Be(t)}function X(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Be(e),i=r===e.ownerDocument?.body,a=H(r);if(i){let e=Ve(a);return t.concat(a,a.visualViewport||[],Ae(r)?r:[],e&&n?X(e):[])}else return t.concat(r,X(r,[],n))}function Ve(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function He(e){let t=J(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=G(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=O(n)!==a||O(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Ue(e){return W(e)?e:e.contextElement}function Z(e){let t=Ue(e);if(!G(t))return A(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=He(t),o=(a?O(n.width):n.width)/r,s=(a?O(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var We=A(0);function Ge(e){let t=H(e);return!Re()||!t.visualViewport?We:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ke(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===H(e)}function Q(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Ue(e),o=A(1);t&&(r?W(r)&&(o=Z(r)):o=Z(e));let s=Ke(a,n,r)?Ge(a):A(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=H(a),t=W(r)?H(r):r,n=e,i=Ve(n);for(;i&&t!==n;){let e=Z(i),t=i.getBoundingClientRect(),r=J(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=H(i),i=Ve(n)}}return de({width:u,height:d,x:c,y:l})}function qe(e,t){let n=ze(e).scrollLeft;return t?t.left+n:Q(U(e)).left+n}function Je(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-qe(e,n),y:n.top+t.scrollTop}}function Ye(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=U(r),s=t?Me(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=A(1),u=A(0),d=G(r);if((d||!a)&&((V(r)!==`body`||Ae(o))&&(c=ze(r)),d)){let e=Q(r);l=Z(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Je(o,c):A(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Xe(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ze(e){let t=ze(e),n=e.ownerDocument.body,r=D(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=D(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+qe(e),o=-t.scrollTop;return J(n).direction===`rtl`&&(a+=D(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Qe=25;function $e(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=H(e),a=U(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Re()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(qe(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Qe&&(s-=o)}return{width:s,height:c,x:l,y:u}}function et(e,t){let n=Q(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Z(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function tt(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=$e(e,n,t);else if(t===`document`)r=Ze(U(e));else if(W(t))r=et(t,n);else{let n=Ge(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return de(r)}function nt(e,t){let n=t.get(e);if(n)return n;let r=X(e,[],!1).filter(e=>W(e)&&V(e)!==`body`),i=null,a=J(e).position===`fixed`,o=a?Y(e):e;for(;W(o)&&!q(o);){let e=J(o),t=Ie(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Y(o)}return t.set(e,r),r}function rt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Me(t)?[]:nt(t,this._c):[].concat(n),r],o=tt(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=tt(t,a[e],i);s=D(n.top,s),c=E(n.right,c),l=E(n.bottom,l),u=D(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function it(e){let{width:t,height:n}=He(e);return{width:t,height:n}}function at(e,t,n){let r=G(t),i=U(t),a=n===`fixed`,o=Q(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=A(0);if((r||!a)&&((V(t)!==`body`||Ae(i))&&(s=ze(t)),r)){let e=Q(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=qe(i));let l=i&&!r&&!a?Je(i,s):A(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function ot(e){return J(e).position===`static`}function st(e,t){if(!G(e)||J(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return U(e)===n&&(n=n.ownerDocument.body),n}function ct(e,t){let n=H(e);if(Me(e))return n;if(!G(e)){let t=Y(e);for(;t&&!q(t);){if(W(t)&&!ot(t))return t;t=Y(t)}return n}let r=st(e,t);for(;r&&je(r)&&ot(r);)r=st(r,t);return r&&q(r)&&ot(r)&&!Ie(r)?n:r||Le(e)||n}var lt=async function(e){let t=this.getOffsetParent||ct,n=this.getDimensions,r=await n(e.floating);return{reference:at(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ut(e){return J(e).direction===`rtl`}var dt={convertOffsetParentRelativeRectToViewportRelativeRect:Ye,getDocumentElement:U,getClippingRect:rt,getOffsetParent:ct,getElementRects:lt,getClientRects:Xe,getDimensions:it,getScale:Z,isElement:W,isRTL:ut};function ft(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function pt(e,t,n){let r=null,i,a=U(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=k(d),h=k(a.clientWidth-(u+f)),g=k(a.clientHeight-(d+p)),_=k(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:D(0,E(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!ft(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=H(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function mt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Ue(e),u=i||a?[...l?X(l):[],...t?X(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?pt(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Q(e):null;c&&g();function g(){let t=Q(e);h&&!ft(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var ht=Ce,gt=we,_t=_e,vt=Ee,yt=be,bt=ge,xt=Te,St=(e,t,n)=>{let r=new Map,i=n??{},a={...dt,...i.platform,_c:r};return he(e,t,{...i,platform:a})},Ct=typeof document<`u`?v.useLayoutEffect:function(){};function wt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!wt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!wt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Tt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Et(e,t){let n=Tt(e);return Math.round(t*n)/n}function Dt(e){let t=v.useRef(e);return Ct(()=>{t.current=e}),t}function Ot(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(r);wt(f,r)||p(r);let[m,h]=v.useState(null),[g,y]=v.useState(null),b=v.useCallback(e=>{e!==w.current&&(w.current=e,h(e))},[]),x=v.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=a||m,C=o||g,w=v.useRef(null),T=v.useRef(null),E=v.useRef(u),D=c!=null,O=Dt(c),k=Dt(i),A=Dt(l),j=v.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),St(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!wt(E.current,t)&&(E.current=t,_.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);Ct(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=v.useRef(!1);Ct(()=>(M.current=!0,()=>{M.current=!1}),[]),Ct(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=v.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=v.useMemo(()=>({reference:S,floating:C}),[S,C]),F=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Et(P.floating,u.x),r=Et(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Tt(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var kt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:bt({element:r.current,padding:i}).fn(n):r?bt({element:r,padding:i}).fn(n):{}}}},At=(e,t)=>{let n=ht(e);return{name:n.name,fn:n.fn,options:[e,t]}},jt=(e,t)=>{let n=gt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mt=(e,t)=>({fn:xt(e).fn,options:[e,t]}),Nt=(e,t)=>{let n=_t(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pt=(e,t)=>{let n=vt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ft=(e,t)=>{let n=yt(e);return{name:n.name,fn:n.fn,options:[e,t]}},It=(e,t)=>{let n=kt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Lt=`Arrow`,Rt=v.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...o}=e;return(0,y.jsx)(a.svg,{...o,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,y.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Rt.displayName=Lt;var zt=Rt,Bt=`Popper`,[Vt,Ht]=o(Bt),[Ut,Wt]=Vt(Bt),Gt=e=>{let{__scopePopper:t,children:n}=e,[r,i]=v.useState(null),[a,o]=v.useState(void 0);return(0,y.jsx)(Ut,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};Gt.displayName=Bt;var Kt=`PopperAnchor`,qt=v.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,o=Wt(Kt,n),c=v.useRef(null),l=o.onAnchorChange,u=s(t,v.useCallback(e=>{c.current=e,e&&l(e)},[l])),d=v.useRef(null);v.useEffect(()=>{if(!r)return;let e=d.current;d.current=r.current,e!==d.current&&l(d.current)});let f=o.placementState&&rn(o.placementState),p=f?.[0],m=f?.[1];return r?null:(0,y.jsx)(a.div,{"data-radix-popper-side":p,"data-radix-popper-align":m,...i,ref:u})});qt.displayName=Kt;var Jt=`PopperContent`,[Yt,Xt]=Vt(Jt),Zt=v.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:o=`center`,alignOffset:c=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:h=`partial`,hideWhenDetached:g=!1,updatePositionStrategy:_=`optimized`,onPlaced:b,...x}=e,S=Wt(Jt,n),[C,T]=v.useState(null),E=s(t,T),[D,O]=v.useState(null),k=w(D),A=k?.width??0,j=k?.height??0,M=r+(o===`center`?``:`-`+o),N=typeof p==`number`?p:{top:0,right:0,bottom:0,left:0,...p},P=Array.isArray(f)?f:[f],F=P.length>0,I={padding:N,boundary:P.filter(tn),altBoundary:F},{refs:ee,floatingStyles:L,placement:R,isPositioned:te,middlewareData:z}=Ot({strategy:`fixed`,placement:M,whileElementsMounted:(...e)=>mt(...e,{animationFrame:_===`always`}),elements:{reference:S.anchor},middleware:[At({mainAxis:i+j,alignmentAxis:c}),u&&jt({mainAxis:!0,crossAxis:!1,limiter:h===`partial`?Mt():void 0,...I}),u&&Nt({...I}),Pt({...I,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),D&&It({element:D,padding:l}),nn({arrowWidth:A,arrowHeight:j}),g&&Ft({strategy:`referenceHidden`,...I,boundary:F?I.boundary:void 0})]}),B=S.setPlacementState;m(()=>(B(R),()=>{B(void 0)}),[R,B]);let[ne,re]=rn(R),ie=d(b);m(()=>{te&&ie?.()},[te,ie]);let ae=z.arrow?.x,oe=z.arrow?.y,se=z.arrow?.centerOffset!==0,[ce,le]=v.useState();return m(()=>{C&&le(window.getComputedStyle(C).zIndex)},[C]),(0,y.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...L,transform:te?L.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ce,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,y.jsx)(Yt,{scope:n,placedSide:ne,placedAlign:re,onArrowChange:O,arrowX:ae,arrowY:oe,shouldHideArrow:se,children:(0,y.jsx)(a.div,{"data-side":ne,"data-align":re,...x,ref:E,style:{...x.style,animation:te?void 0:`none`}})})})});Zt.displayName=Jt;var Qt=`PopperArrow`,$t={top:`bottom`,right:`left`,bottom:`top`,left:`right`},en=v.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Xt(Qt,n),a=$t[i.placedSide];return(0,y.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,y.jsx)(zt,{...r,ref:t,style:{...r.style,display:`block`}})})});en.displayName=Qt;function tn(e){return e!==null}var nn=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=rn(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function rn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var an=Gt,on=qt,sn=Zt,cn=en,[ln,un]=o(`Tooltip`,[Ht]),dn=Ht(),fn=`TooltipProvider`,pn=700,mn=`tooltip.open`,[hn,gn]=ln(fn),_n=e=>{let{__scopeTooltip:t,delayDuration:n=pn,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=v.useRef(!0),s=v.useRef(!1),c=v.useRef(0);return v.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,y.jsx)(hn,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:v.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:v.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:v.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};_n.displayName=fn;var vn=`Tooltip`,[yn,bn]=ln(vn),xn=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:a,onOpenChange:o,disableHoverableContent:s,delayDuration:c}=e,l=gn(vn,e.__scopeTooltip),u=dn(t),[d,f]=v.useState(null),p=h(),m=v.useRef(0),g=s??l.disableHoverableContent,_=c??l.delayDuration,b=v.useRef(!1),[x,S]=i({prop:r,defaultProp:a??!1,onChange:e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(mn))):l.onClose(),o?.(e)},caller:vn}),C=v.useMemo(()=>x?b.current?`delayed-open`:`instant-open`:`closed`,[x]),w=v.useCallback(()=>{window.clearTimeout(m.current),m.current=0,b.current=!1,S(!0)},[S]),T=v.useCallback(()=>{window.clearTimeout(m.current),m.current=0,S(!1)},[S]),E=v.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{b.current=!0,S(!0),m.current=0},_)},[_,S]);return v.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,y.jsx)(an,{...u,children:(0,y.jsx)(yn,{scope:t,contentId:p,open:x,stateAttribute:C,trigger:d,onTriggerChange:f,onTriggerEnter:v.useCallback(()=>{l.isOpenDelayedRef.current?E():w()},[l.isOpenDelayedRef,E,w]),onTriggerLeave:v.useCallback(()=>{g?T():(window.clearTimeout(m.current),m.current=0)},[T,g]),onOpen:w,onClose:T,disableHoverableContent:g,children:n})})};xn.displayName=vn;var Sn=`TooltipTrigger`,Cn=v.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=bn(Sn,n),o=gn(Sn,n),c=dn(n),u=s(t,v.useRef(null),i.onTriggerChange),d=v.useRef(!1),f=v.useRef(!1),p=v.useCallback(()=>d.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener(`pointerup`,p),[p]),(0,y.jsx)(on,{asChild:!0,...c,children:(0,y.jsx)(a.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:u,onPointerMove:l(e.onPointerMove,e=>{e.pointerType!==`touch`&&!f.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:l(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:l(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener(`pointerup`,p,{once:!0})}),onFocus:l(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:l(e.onBlur,i.onClose),onClick:l(e.onClick,i.onClose)})})});Cn.displayName=Sn;var wn=`TooltipPortal`,[Tn,En]=ln(wn,{forceMount:void 0}),Dn=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=bn(wn,t);return(0,y.jsx)(Tn,{scope:t,forceMount:n,children:(0,y.jsx)(c,{present:n||a.open,children:(0,y.jsx)(u,{asChild:!0,container:i,children:r})})})};Dn.displayName=wn;var $=`TooltipContent`,On=v.forwardRef((e,t)=>{let n=En($,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=bn($,e.__scopeTooltip);return(0,y.jsx)(c,{present:r||o.open,children:o.disableHoverableContent?(0,y.jsx)(Nn,{side:i,...a,ref:t}):(0,y.jsx)(kn,{side:i,...a,ref:t})})}),kn=v.forwardRef((e,t)=>{let n=bn($,e.__scopeTooltip),r=gn($,e.__scopeTooltip),i=v.useRef(null),a=s(t,i),[o,c]=v.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,p=v.useCallback(()=>{c(null),f(!1)},[f]),m=v.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Ln(r,In(r,n.getBoundingClientRect())),a=Rn(t.getBoundingClientRect()),o=Bn([...i,...a]);c(o),f(!0)},[f]);return v.useEffect(()=>()=>p(),[p]),v.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),v.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!zn(n,o);r?p():i&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,o,u,p]),(0,y.jsx)(Nn,{...e,ref:a})}),[An,jn]=ln(vn,{isInside:!1}),Mn=f(`TooltipContent`),Nn=v.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=bn($,n),l=dn(n),{onClose:u}=c;return v.useEffect(()=>(document.addEventListener(mn,u),()=>document.removeEventListener(mn,u)),[u]),v.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,y.jsx)(g,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,y.jsxs)(sn,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,y.jsx)(Mn,{children:r}),(0,y.jsx)(An,{scope:n,isInside:!0,children:(0,y.jsx)(C,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});On.displayName=$;var Pn=`TooltipArrow`,Fn=v.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=dn(n);return jn(Pn,n).isInside?null:(0,y.jsx)(cn,{...i,...r,ref:t})});Fn.displayName=Pn;function In(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Ln(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Rn(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function zn(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Bn(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Vn(t)}function Vn(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Hn=_n,Un=xn,Wn=Cn,Gn=Dn,Kn=On,qn=Fn;function Jn({delayDuration:e=0,...t}){return(0,y.jsx)(Hn,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Yn({...e}){return(0,y.jsx)(Un,{"data-slot":`tooltip`,...e})}function Xn({...e}){return(0,y.jsx)(Wn,{"data-slot":`tooltip-trigger`,...e})}function Zn({className:e,sideOffset:t=0,children:n,...r}){return(0,y.jsx)(Gn,{children:(0,y.jsxs)(Kn,{"data-slot":`tooltip-content`,sideOffset:t,className:p(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-contrast px-3 py-1.5 text-xs text-balance text-contrast-foreground fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,y.jsx)(qn,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-contrast fill-contrast`})]})})}export{on as a,an as c,b as d,Xn as i,Ht as l,Zn as n,cn as o,Jn as r,sn as s,Yn as t,w as u};
@@ -1,4 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$t as r,Fr as i,Ft as a,Gi as o,Hi as s,Ht as c,Ji as l,Jt as u,Ln as d,R as f,Tr as p,Ut as m,Vt as h,Xr as g,er as _,f as v,m as y,n as b,p as x,qr as S,r as C,tn as w,zt as T}from"./toaster-Hj_czp_o.js";import{B as E,Dt as D,r as O,t as k}from"./button-CjSjKnkd.js";import{R as A}from"./editable-title-CJSWyCcL.js";import{t as j}from"./arrow-left-BxBdc5DC.js";import{a as M,o as N,p as P,r as F}from"./reference-chip-Bx_mG9QG.js";import{n as I}from"./trash-2-EdjdGvEo.js";import{t as L}from"./check-DAAMuI4o.js";import{t as R}from"./external-link-DPKRidDg.js";import{t as z}from"./triangle-alert-DpH3QFz6.js";import{t as ee}from"./centered-state-T0J7VmBb.js";import{t as B}from"./refresh-cw-BaFyjVUz.js";import{_ as V,c as H,n as U,o as W,s as G}from"./use-now-CrM50BFB.js";import{t as te}from"./tag-DLwUkUsN.js";import{t as ne}from"./x-BkwTUDpG.js";import{r as K}from"./token-metrics-C149OWmd.js";import{t as re}from"./textarea-Bb0_Hz53.js";import{n as ie,t as ae}from"./use-submit-shortcut-BJ10ZshV.js";import{t as oe}from"./markdown-Bmfy_1Ll.js";import{L as se,P as ce,U as le,g as ue,j as de,m as fe,p as pe}from"./index-CiQrbvAq.js";import{c as me,n as he,r as ge,s as _e,t as ve}from"./agent-task-pickers-C3ydGatB.js";var q=e(t(),1),ye=(e,t)=>e?.available&&JSON.stringify([e.items,e.truncated])===JSON.stringify([t.items,t.truncated]);function be(e,t,n=!0){let a=l(),o=f(),s=E(),c=JSON.stringify([s,e,t]),[u,d]=(0,q.useState)({identity:c,snapshot:null,error:null,pending:null}),p=(0,q.useRef)({refresh:async()=>{},applyChanges:async()=>{}}),m=o.data?o.data.capabilities.localHandoff?`local`:`remote`:null;(0,q.useEffect)(()=>{if(d({identity:c,snapshot:null,error:null,pending:null}),!m||!n)return;let o=t,l=!1,u=()=>{},f=null,h=null,_=null,v=(e=null)=>{l||d({identity:c,snapshot:f,error:e,pending:h})},y=(e,t=!1)=>{let n=a.getQueryData(o),r=a.getQueryState(o)?.fetchStatus===`fetching`;!t&&((n?.pages.length??0)>1||r)?(r&&(_=e),h=ye(n?.pages[0],e)?null:e):(h=null,_=null,a.setQueryData(o,{pages:[e],pageParams:[void 0]}))},b=e=>{if(f&&e.version<f.version)return!1;let t=e.result?.available&&!e.checking&&e.checkedAt!==f?.checkedAt;return f=e,t&&e.result?.available&&y(e.result),e.result&&!e.result.available&&[`source_changed`,`credentials_missing`,`not_configured`].includes(e.result.code)&&(h=null,_=null,Promise.all([a.invalidateQueries({queryKey:[`tracker`,s,`association`]}),a.invalidateQueries({queryKey:[`tracker`,s,`connection`]}),a.invalidateQueries({queryKey:r.projects})])),v(),!0},x=a.getQueryCache().subscribe(e=>{if(l||!_||JSON.stringify(e.query.queryKey)!==JSON.stringify(o)||e.query.state.fetchStatus!==`idle`)return;let t=_;_=null,y(t),v()}),C=()=>{if(u(),p.current={refresh:async()=>{},applyChanges:async()=>{}},l||document.visibilityState===`hidden`)return;let t=new AbortController,n=()=>{},r,c=null,d=!1,_=!1,x=()=>!l&&!t.signal.aborted;u=()=>{t.abort(),n(),clearTimeout(r)};let T=e=>x()&&b(e),E=()=>{x()&&(v(`Automatic checking is temporarily unavailable. Retrying…`),n(),clearTimeout(r),r=setTimeout(()=>{x()&&C()},5e3))},O=async()=>{if(!(!x()||!c)){if(d){_=!0;return}d=!0;try{do _=!1,T(await S(s,c.id,t.signal));while(_&&x())}catch{E()}finally{d=!1}}};p.current={refresh:async()=>{if(!(!c||!x()))try{let e=await g(s,c.id,t.signal);if(!x()||f&&e.version<f.version||(await a.cancelQueries({queryKey:o,exact:!0}),!x())||!T(e))return;e.result?.available&&(y(e.result,!0),v())}catch{E()}},applyChanges:async()=>{!h||!x()||(await a.cancelQueries({queryKey:o,exact:!0}),x()&&h&&(y(h,!0),v()))}},(async()=>{try{if(c=await i(s,e,t.signal),!x())return;if(f=null,m===`local`)n=w(c.topic,e=>{D.safeParse(e).success&&O()},E),await O();else{let e=-1;for(;x();){let n=await S(s,c.id,t.signal,Math.max(0,e));if(T(n),e=n.version,n.result&&!n.result.available&&n.result.code===`source_changed`)break}}}catch{E()}})()};return C(),document.addEventListener(`visibilitychange`,C),()=>{l=!0,u(),x(),document.removeEventListener(`visibilitychange`,C)}},[a,c,m,n]);let h=u.identity===c?u:null,_=h?.snapshot;return{ready:_!=null,checkedAt:_?.checkedAt??null,checking:_?.checking??!1,error:h?.error??(_?.result&&!_.result.available?_.result.reason:null),hasChanges:!!h?.pending,refresh:()=>p.current.refresh(),applyChanges:()=>p.current.applyChanges()}}var xe=1e5;function J(e){let t=[];return e.bodyTruncated&&t.push(`The tracker description was truncated by the provider snapshot.`),e.unsupportedContent&&t.push(`The tracker item contains unsupported content that is absent from this snapshot.`),t}function Y(e,t={}){let n=[`Work on tracker ticket [${e.id}]: ${e.title}`,`Source: ${e.url}`,`Status: ${e.status}\nAuthor: ${e.author}\nLabels: ${e.labels.length?e.labels.join(`, `):`(none)`}`,`Description:\n${e.body.trim()||`(No description was provided.)`}`,`Tracker snapshot scope: description only; comments, attachments, and custom fields are not included.`],r=J(e);r.length&&n.push(`Snapshot limitations:\n${r.map(e=>`- ${e}`).join(`
2
- `)}`),t.skills?.length&&n.push(`Use these skills where relevant: ${t.skills.join(`, `)}.`),t.supplemental?.trim()&&n.push(`Supplemental context:\n${t.supplemental.trim()}`),t.instruction?.trim()&&n.push(t.instruction.trim());let i=n.join(`
3
-
4
- `);if(i.length>1e5)throw Error(`The final task exceeds the 100,000 character limit. Shorten the supplemental context or instruction.`);return i}function Se(e,t,n,r,i){if(!t&&n.length>8)throw Error(`A skill chain can contain at most 8 skills. Remove a skill before launching.`);if(J(e).length>0&&!i.acknowledgeLoss)throw Error(`Acknowledge the snapshot limitations before handing this issue to an agent.`);let a=Y(e,{...i,skills:t?n:[]});return t?{...r,workflow:t,task:a}:n.length?{...r,steps:_e(n),task:a}:{...r,workflow:`quick-task`,task:a}}var X=n();function Ce({item:e,workflows:t,skills:n,selection:r,onSelectionChange:i,drafts:a,scopePending:s=!1,detailUnavailable:c=!1}){let u=l(),[d,f]=(0,q.useState)({workflow:null,selectedSkills:[],engine:{runner:null,model:null,account:null}}),{workflow:p,selectedSkills:m,engine:h}=r??d,g=i??f,v=e=>g(t=>({...t,workflow:e})),x=e=>g(t=>({...t,engine:e})),S=e=>g(t=>({...t,selectedSkills:e(t.selectedSkills)})),[w,T]=(0,q.useState)(a?.get(e.url)?.instruction??``),[E,D]=(0,q.useState)(a?.get(e.url)?.supplemental??``),[O,j]=(0,q.useState)(a?.get(e.url)?.acknowledgedSnapshot??null);(0,q.useEffect)(()=>{a?.set(e.url,{instruction:w,supplemental:E,acknowledgedSnapshot:O})},[a,e.url,w,E,O]);let M=JSON.stringify([e.id,e.body,e.bodyTruncated,e.unsupportedContent]),N=O===M,[P,F]=(0,q.useState)(null),R=ue(h),z=J(e),ee=e.body.trim()===``,B=m.filter(e=>n.some(t=>t.name===e)),V=p===null&&B.length>8,H=(0,q.useMemo)(()=>{try{return{task:Y(e,{skills:p?B:[],instruction:w,supplemental:E}),error:null}}catch(e){return{task:``,error:e.message}}},[e,p,B.join(`\0`),w,E]),U=o({mutationFn:()=>_(Se(e,p,B,fe(R),{instruction:w,supplemental:E,acknowledgeLoss:N})),onSuccess:t=>{let n=`runs`in t?t.runs[0]:t;F(n?.id??null),u.invalidateQueries({queryKey:y.runs.all}),b(`Added ${e.id} to the queue`)},onError:e=>b(e.message,{tone:`danger`})}),W=e=>S(t=>t.includes(e)?t.filter(t=>t!==e):p===null&&B.length>=8?t:[...t,e]),G=!s&&!c&&!U.isPending&&R.canRun&&H.error===null&&!V&&(z.length===0||N);return(0,X.jsxs)(`section`,{className:`mt-7 rounded-lg border border-border bg-card p-4`,"data-slot":`tracker-handoff`,children:[(0,X.jsxs)(`h2`,{className:`flex items-center gap-1.5 text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:[(0,X.jsx)(A,{className:`size-3.5 text-violet`}),` Hand this to the agent`]}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(he,{workflows:t,value:p,onChange:v,slotPrefix:`tracker`}),(0,X.jsx)(ve,{skills:n,skillUsage:void 0,selected:B,onToggle:W,maxSelections:p===null?8:void 0,slotPrefix:`tracker`}),(0,X.jsx)(pe,{pick:h,onChange:x,accounts:!0,disabled:U.isPending||!R.canRun}),(0,X.jsx)(ge,{resolved:R,dataSlot:`tracker-provider-gate`})]}),B.length?(0,X.jsx)(`div`,{className:`mt-2.5 flex flex-wrap gap-1.5`,children:B.map(e=>(0,X.jsxs)(`button`,{type:`button`,"aria-label":`Remove skill ${e}`,onClick:()=>W(e),className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,X.jsx)(ne,{"aria-hidden":`true`,className:`size-3`})]},e))}):null,p===null&&B.length>=8?(0,X.jsxs)(`p`,{className:`mt-2 text-xs ${V?`text-danger`:`text-muted-foreground`}`,children:[`Skill chains support at most `,8,` skills. Remove one before selecting another.`]}):null,z.length||ee?(0,X.jsxs)(`div`,{className:`mt-3 rounded-md border border-warning/50 bg-warning/10 p-3 text-sm`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:z.length?`This provider snapshot lost some issue content.`:`This issue has no description.`}),z.length?(0,X.jsx)(`ul`,{className:`mt-1 list-disc pl-5 text-xs`,children:z.map(e=>(0,X.jsx)(`li`,{children:e},e))}):(0,X.jsx)(`p`,{className:`mt-1 text-xs`,children:`Add any context the agent needs before starting.`}),z.length?(0,X.jsx)(`a`,{className:`mt-2 inline-block text-xs text-violet underline underline-offset-4`,href:e.url,target:`_blank`,rel:`noreferrer`,children:`Review the source issue`}):null,(0,X.jsx)(`label`,{className:`mt-3 block text-xs font-medium`,htmlFor:`tracker-supplemental`,children:`Supplemental context`}),(0,X.jsx)(re,{id:`tracker-supplemental`,value:E,onChange:e=>D(e.target.value),placeholder:`Paste any missing context here…`,className:`mt-1 min-h-20 bg-background`}),z.length?(0,X.jsxs)(`label`,{className:`mt-2 flex items-start gap-2 text-xs`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:N,onChange:e=>j(e.target.checked?M:null)}),`I understand the agent receives this snapshot and the supplemental context above.`]}):null]}):null,(0,X.jsx)(`label`,{className:`mt-3 block text-xs font-medium`,htmlFor:`tracker-instruction`,children:`Custom instruction`}),(0,X.jsx)(re,{id:`tracker-instruction`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,onKeyDown:e=>{ae(e.nativeEvent)&&(e.preventDefault(),G&&U.mutate())},value:w,onChange:e=>T(e.target.value),placeholder:`Optional instructions; these are placed last in the task.`,className:`mt-1 min-h-20 text-[13px]`}),(0,X.jsxs)(`div`,{className:`mt-1 flex justify-between text-[11px] text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:H.error??`Full tracker detail and source link are included. Comments, attachments, and custom fields are outside the snapshot.`}),(0,X.jsxs)(`span`,{children:[H.task.length.toLocaleString(),` / `,xe.toLocaleString()]})]}),s?(0,X.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:`Verifying tracker connection…`}):null,c?(0,X.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-danger`,children:`Issue detail could not be verified. Retry successfully before starting the agent; your draft is preserved.`}):null,(0,X.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2.5`,children:[(0,X.jsxs)(k,{variant:`contrast`,onClick:()=>U.mutate(),disabled:!G,children:[(0,X.jsx)(I,{className:`size-3.5`}),` Run agent on this issue`]}),(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:ie()}),P?(0,X.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-success`,children:[(0,X.jsx)(L,{className:`size-3`}),` queued · `,(0,X.jsx)(C,{className:`text-violet hover:underline`,to:`/tasks/${P}`,children:`View task →`})]}):null]})]})}function we({options:e,selected:t,onChange:n}){let[r,i]=(0,q.useState)(``),a=[...new Set([...t,...e])].sort(),o=e=>n(t.includes(e)?t.filter(t=>t!==e):[...t,e]),s=r.trim();return(0,X.jsxs)(F,{onOpenChange:e=>{e||i(``)},children:[(0,X.jsx)(N,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"aria-label":`Filter labels`,className:O(`flex shrink-0 items-center gap-1 rounded-md border border-border px-2 py-1.5 text-xs text-soft-foreground hover:bg-muted`,t.length>0&&`border-primary/60 text-foreground`),children:[(0,X.jsx)(te,{"aria-hidden":`true`,className:`size-3.5`}),`Labels`,t.length?` · ${t.length}`:``]})}),(0,X.jsx)(M,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,X.jsxs)(U,{label:`Find or add label`,shouldFilter:!1,children:[(0,X.jsx)(W,{"aria-label":`Find or add label`,placeholder:`Find or add label…`,value:r,onValueChange:i,maxLength:256}),(0,X.jsxs)(H,{className:`max-h-64`,children:[t.length?(0,X.jsx)(G,{onSelect:()=>n([]),children:`Clear filters`}):null,a.filter(e=>e.toLowerCase().includes(s.toLowerCase())).map(e=>(0,X.jsxs)(G,{value:e,disabled:!t.includes(e)&&t.length>=20,onSelect:()=>o(e),children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),t.includes(e)?(0,X.jsx)(L,{className:`size-3.5 text-primary`}):null]},e)),s&&!a.includes(s)?(0,X.jsxs)(G,{disabled:t.length>=20,onSelect:()=>{o(s),i(``)},children:[`Use label “`,s,`”`]}):null,(0,X.jsx)(`p`,{className:`px-3 py-2 text-[11px] text-soft-foreground`,children:`Suggestions come from loaded issues. Type any exact label to filter.`})]})]})})]})}var Te=()=>({workflow:null,selectedSkills:[],engine:{runner:null,model:null,account:null}});function Ee(){let{id:e}=s(),{projectId:t}=d(),n=T(),r=h(),i=`${t??`default`}:${n.data?.association?Z(n.data.association):`none`}`,a=(0,q.useMemo)(()=>new Map,[i]),[o,c]=(0,q.useState)(null),l=o?.key===i?o.value:Te(),u=e=>c(t=>{let n=t?.key===i?t.value:Te();return{key:i,value:typeof e==`function`?e(n):e}});if(n.isPending)return(0,X.jsx)($,{text:`Loading tracker…`});if(n.isError)return(0,X.jsxs)(`div`,{className:`p-8 text-center text-sm text-danger`,children:[(0,X.jsx)(`p`,{children:n.error.message}),(0,X.jsx)(C,{className:`mt-3 inline-block text-violet underline underline-offset-4`,to:`/settings/tracker`,children:`Open tracker settings`})]});if(!n.data.association)return(0,X.jsx)(De,{});if(n.data.association.connectionId){if(r.isPending)return(0,X.jsx)($,{text:`Loading tracker…`});if(r.isError)return(0,X.jsxs)(`div`,{role:`alert`,className:`p-8 text-center text-sm`,children:[(0,X.jsx)(`p`,{children:`Could not verify the tracker connection.`}),(0,X.jsx)(k,{className:`mt-3`,variant:`outline`,onClick:()=>void r.refetch(),children:`Retry connection`})]});if(!r.data.demo&&(r.data.connection?.id!==n.data.association.connectionId||r.data.connection?.kind!==n.data.association.kind))return(0,X.jsx)(De,{})}return(0,X.jsx)(Oe,{scopePending:n.isFetching||!!n.data.association.connectionId&&r.isFetching,association:n.data.association,selectedId:e,drafts:a,selection:l,setSelection:u},i)}function Z(e){return`${e.kind}:${e.source.id}:${e.source.webUrl}:${e.externalId}:${e.connectionId??`legacy`}`}function De(){return(0,X.jsxs)(`div`,{className:`mx-auto flex min-h-[55vh] max-w-lg flex-col items-center justify-center p-6 text-center`,children:[(0,X.jsx)(ce,{className:`size-8 text-muted-foreground`}),(0,X.jsx)(`h1`,{className:`mt-3 text-lg font-semibold`,children:`Connect an issue tracker`}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Choose a project or team from your issue tracker in project settings.`}),(0,X.jsx)(C,{className:`mt-4 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground`,to:`/settings/tracker`,children:`Open tracker settings`})]})}function Oe({scopePending:e,association:t,selectedId:n,drafts:r,selection:i,setSelection:a}){let o=l(),s=le(),c=s||n===void 0,[u,d]=(0,q.useState)(null),[f,p]=(0,q.useState)(``),[h,g]=(0,q.useState)(``),[_,v]=(0,q.useState)(`active`),[b,S]=(0,q.useState)(!1),[w,T]=(0,q.useState)([]),E=m(t,{state:_,labels:w,query:h},c),D=be({association:t,state:_,labels:w,query:h},E.queryKey,c),A=E.data?.pages??[],j=A.find(e=>!e.available),M=A.flatMap(e=>e.available?e.items:[]),N=JSON.stringify([h,_,w]),F=u?.filter===N?u.id:null;(0,q.useEffect)(()=>{F===null&&M[0]&&d({filter:N,id:M[0].id})},[F,M,N]);let I=n??(s?F:null),L=de[t.kind].label,R=async()=>{await(D.ready?D.refresh():E.restart()),I&&o.invalidateQueries({queryKey:y.tracker.detail(t,I)})};return(0,X.jsx)(me,{name:`tracker`,route:`tracker`,selected:n!==void 0,list:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`header`,{"data-slot":`tracker-header`,className:`sticky top-0 z-10 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,X.jsx)(`h1`,{className:`text-lg font-semibold`,children:L}),(0,X.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,title:t.externalName,children:t.externalName}),(0,X.jsx)(C,{to:`/settings/tracker`,"aria-label":`Connection settings`,title:`Connection settings`,className:`ml-auto shrink-0 text-soft-foreground hover:text-foreground`,children:(0,X.jsx)(se,{className:`size-3.5`})}),(0,X.jsxs)(`button`,{type:`button`,"aria-label":`Refresh`,title:`Refresh from ${L}`,disabled:D.checking||E.isFetching,onClick:()=>void R(),className:`flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px text-[10px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,X.jsx)(B,{"aria-hidden":`true`,className:O(`size-[9px]`,(D.checking||E.isFetching)&&`motion-safe:animate-spin`)}),D.checkedAt?`synced ${K(D.checkedAt)} ago`:`refresh`]})]}),(0,X.jsxs)(`div`,{className:`mt-2.5 flex items-center justify-between border-b border-border pb-2`,children:[(0,X.jsxs)(`h2`,{className:`text-[13px] font-medium`,children:[`Issues · `,M.length,E.hasNextPage?`+`:``]}),(0,X.jsxs)(`select`,{"aria-label":`Issue state`,className:`min-w-0 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,value:_,onChange:e=>{v(e.target.value),S(!0)},children:[(0,X.jsx)(`option`,{value:`active`,children:`Active`}),(0,X.jsx)(`option`,{value:`all`,children:`All states`})]})]}),(0,X.jsxs)(`form`,{className:`mt-2.5 flex items-center gap-2 pb-3`,onSubmit:e=>{e.preventDefault();let t=f.trim(),n=b?_:t?`all`:`active`;t===h&&n===_?R():(g(t),v(n))},children:[(0,X.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,X.jsx)(V,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,X.jsx)(`input`,{type:`search`,"aria-label":`Search tracker`,maxLength:256,className:`w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,value:f,onChange:e=>p(e.target.value),placeholder:`Search issues…`})]}),(0,X.jsx)(k,{type:`submit`,variant:`outline`,size:`sm`,disabled:E.isFetching,children:`Search`}),(0,X.jsx)(we,{options:M.flatMap(e=>e.labels),selected:w,onChange:T})]})]}),D.error?(0,X.jsxs)(`p`,{role:`status`,className:`px-4 py-2 text-xs text-danger`,children:[D.error,` The displayed list may be outdated.`]}):null,D.hasChanges?(0,X.jsxs)(`div`,{className:`m-2 rounded-md border border-border bg-muted/40 p-3 text-xs`,children:[(0,X.jsx)(`p`,{children:`New changes are available. Your loaded pages have been preserved.`}),(0,X.jsx)(k,{size:`sm`,className:`mt-2`,variant:`outline`,onClick:()=>void D.applyChanges(),children:`Show changes`})]}):null,E.isPending&&c?(0,X.jsx)($,{text:`Loading issues…`}):null,E.isError?(0,X.jsx)(Q,{reason:E.error.message,generation:E.errorUpdatedAt,retryAfterSeconds:E.error instanceof x&&E.error.failure.code===`rate_limited`?E.error.failure.retryAfterSeconds:void 0,retry:()=>void E.restart()}):null,j&&!j.available?(0,X.jsx)(Q,{reason:j.reason,generation:E.dataUpdatedAt,retryAfterSeconds:j.code===`rate_limited`?j.retryAfterSeconds:void 0,retry:()=>void E.restart()}):null,!E.isPending&&!E.isError&&!j&&M.length===0?(0,X.jsx)($,{text:h.trim()?`No issues match this search.`:`No issues in this view.`}):null,(0,X.jsx)(`ul`,{"data-slot":`tracker-rows`,className:`flex flex-col gap-0.5 px-2 py-2`,children:M.map(n=>(0,X.jsx)(ke,{scopePending:e,association:t,item:n,active:I===n.id},n.id))}),E.hasNextPage?(0,X.jsx)(k,{className:`mx-4 mb-4 shrink-0`,variant:`outline`,onClick:()=>void E.fetchNextPage(),disabled:E.isFetchingNextPage,children:`Load more`}):null]}),detail:I?(0,X.jsx)(je,{scopePending:e,association:t,id:I,drafts:r,selection:i,onSelectionChange:a},`${Z(t)}:${I}`):(0,X.jsx)(ee,{icon:(0,X.jsx)(P,{}),tone:`neutral`,heading:`h2`,title:`Nothing selected`,subtitle:`Choose an issue from the list.`})})}function ke({scopePending:e,association:t,item:n,active:r}){let i=l(),a=y.tracker.detail(t,n.id),o=()=>void i.prefetchQuery({queryKey:a,queryFn:({signal:e})=>p(n.id,{signal:e,association:t}),staleTime:v});return(0,X.jsx)(`li`,{children:(0,X.jsxs)(C,{to:`/tracker/${encodeURIComponent(n.id)}`,draggable:!0,onMouseEnter:o,onFocus:o,onDragStart:t=>{if(e){t.preventDefault();return}let n=i.getQueryState(a),r=Ae(i,a);if(!r){t.preventDefault(),o(),b(n?.status===`error`?`Full issue detail failed to load. Open the issue to retry.`:`Loading fresh issue detail. Drag again when it is ready.`,n?.status===`error`?{tone:`danger`}:void 0);return}if(J(r.item).length){t.preventDefault(),b(`Open this issue to acknowledge snapshot limitations before handoff.`,{tone:`danger`});return}t.dataTransfer.setData(`text/plain`,Y(r.item)),t.dataTransfer.effectAllowed=`copy`},"data-slot":`tracker-row`,"aria-current":r?`page`:void 0,title:`Drag into the composer to prefill a task`,className:O(`flex flex-col gap-1 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,r&&`bg-muted`),children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(P,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-violet`}),(0,X.jsx)(`span`,{className:O(`min-w-0 truncate text-[13px] font-medium`,r&&`font-semibold`),children:n.title})]}),(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 pl-[22px] font-mono text-[10.5px] text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:n.id}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:n.author}),(0,X.jsx)(`span`,{className:`shrink-0`,title:new Date(n.updatedAt).toLocaleString(),children:K(n.updatedAt)})]}),(0,X.jsxs)(`span`,{className:`flex flex-wrap gap-1 pl-[22px]`,children:[(0,X.jsx)(`span`,{className:`rounded border border-border px-1.5 py-px text-[10px] text-muted-foreground`,children:n.status}),n.labels.map(e=>(0,X.jsx)(`span`,{className:`rounded-full border border-border px-1.5 py-px text-[10px] text-muted-foreground`,children:e},e))]})]})})}function Ae(e,t,n=Date.now()){let r=e.getQueryState(t);return r?.status!==`success`||r.fetchStatus!==`idle`||r.isInvalidated||r.dataUpdatedAt<=0||n-r.dataUpdatedAt>=6e4||!r.data?.available?null:r.data}function je({scopePending:e,association:t,id:n,selection:r,onSelectionChange:i,drafts:o}){let s=c(t,n),l=u(),d=a(),[f,p]=(0,q.useState)(null);(0,q.useEffect)(()=>{s.data?.available&&p(s.data.item)},[s.data]);let m=s.isError?(0,X.jsx)(Q,{reason:s.error.message,generation:s.errorUpdatedAt,retry:()=>void s.refetch()}):s.data&&!s.data.available?(0,X.jsx)(Q,{reason:s.data.reason,generation:s.dataUpdatedAt,retryAfterSeconds:s.data.code===`rate_limited`?s.data.retryAfterSeconds:void 0,retry:()=>void s.refetch()}):null,h=s.data?.available?s.data.item:f;return h?(0,X.jsxs)(`article`,{"data-slot":`tracker-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,X.jsx)(Me,{}),(0,X.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[10.5px] text-soft-foreground`,children:[(0,X.jsx)(`span`,{children:h.id}),`·`,(0,X.jsx)(`span`,{children:`issue`}),`·`,(0,X.jsxs)(`span`,{children:[`opened by `,h.author]}),`·`,(0,X.jsxs)(`span`,{title:new Date(h.createdAt).toLocaleString(),children:[K(h.createdAt),` ago`]}),`·`,(0,X.jsxs)(`a`,{className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,href:h.url,target:`_blank`,rel:`noopener noreferrer`,children:[`open on `,de[t.kind].label,(0,X.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]})]}),(0,X.jsx)(`h2`,{className:`mt-2 text-xl leading-snug font-semibold`,children:h.title}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`rounded border border-border px-1.5 py-px text-[10px] text-muted-foreground`,children:h.status}),h.labels.map(e=>(0,X.jsx)(`span`,{className:`rounded-full border border-border px-1.5 py-px text-[10px] text-muted-foreground`,children:e},e))]}),m,J(h).length?(0,X.jsxs)(`div`,{className:`mt-4 rounded-md border border-warning/50 bg-warning/10 p-3 text-sm`,children:[(0,X.jsx)(z,{className:`mr-2 inline size-4`}),`This snapshot is incomplete. Review the limitations in the handoff panel.`]}):null,(0,X.jsx)(`section`,{"data-slot":`tracker-body`,className:`mt-5 text-sm`,children:(0,X.jsx)(oe,{children:h.body.trim()||`*No description was provided.*`})}),(0,X.jsx)(Ce,{scopePending:e,item:h,detailUnavailable:s.isError||!s.data?.available,drafts:o,selection:r,onSelectionChange:i,workflows:l.data?.workflows??[],skills:d.data??[]},`${Z(t)}:${h.id}`)]}):(0,X.jsxs)(`div`,{className:`p-4`,children:[(0,X.jsx)(Me,{}),s.isPending?(0,X.jsx)($,{text:`Loading full issue detail…`}):m]})}function Q({reason:e,retry:t,retryAfterSeconds:n=0,generation:r}){let[i,a]=(0,q.useState)(n);return(0,q.useEffect)(()=>a(n),[e,n,r]),(0,q.useEffect)(()=>{if(i<=0)return;let e=window.setInterval(()=>a(e=>Math.max(0,e-1)),1e3);return()=>window.clearInterval(e)},[i>0]),(0,X.jsxs)(`div`,{className:`mt-5 rounded-md border border-danger/30 bg-danger/5 p-4 text-sm`,children:[(0,X.jsx)(`p`,{className:`text-danger`,children:e}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,X.jsxs)(k,{variant:`outline`,disabled:i>0,onClick:t,children:[(0,X.jsx)(B,{className:`size-3.5`}),i>0?`Retry in ${i}s`:`Retry`]}),(0,X.jsx)(C,{className:`text-xs text-violet underline underline-offset-4`,to:`/settings/tracker`,children:`Tracker settings`})]})]})}function $({text:e,danger:t=!1}){return(0,X.jsx)(`div`,{className:`p-8 text-center text-sm ${t?`text-danger`:`text-muted-foreground`}`,children:e})}function Me(){return(0,X.jsxs)(C,{className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,to:`/tracker`,children:[(0,X.jsx)(j,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]})}export{Ee as TrackerRoute};
@@ -1 +0,0 @@
1
- import{F as e}from"./button-CjSjKnkd.js";var t=e(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),n=e(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),r=e(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]);export{n,t as r,r as t};
@@ -1 +0,0 @@
1
- import{F as e}from"./button-CjSjKnkd.js";var t=e(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),n=e(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);export{t as n,n as t};