codeharden 2026.1122.2133 → 2026.1122.2302
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -3
- package/dist/{args-B0i5tyjE.js → args-BJ0ric8X.js} +5 -5
- package/dist/args-BJ0ric8X.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/{commands-CvAvyECH.js → commands-BPobEsBP.js} +33 -14
- package/dist/commands-BPobEsBP.js.map +1 -0
- package/dist/{env-wDgRchH9.js → env-CMkse2o0.js} +2 -2
- package/dist/{env-wDgRchH9.js.map → env-CMkse2o0.js.map} +1 -1
- package/dist/{harden-channel-2IT0Y7p3.js → harden-channel-D7h06kQ_.js} +41 -3
- package/dist/harden-channel-D7h06kQ_.js.map +1 -0
- package/dist/{launcher-D17oQovS.js → launcher-CvQZcEIC.js} +3 -3
- package/dist/launcher-CvQZcEIC.js.map +1 -0
- package/dist/{lock-DxXcNd2w.js → lock-iovTSSb0.js} +2 -2
- package/dist/{lock-DxXcNd2w.js.map → lock-iovTSSb0.js.map} +1 -1
- package/dist/{main-BRHfJHGf.js → main-BFo94KOF.js} +6 -6
- package/dist/{main-BRHfJHGf.js.map → main-BFo94KOF.js.map} +1 -1
- package/dist/{main-CJdbWeA_.js → main-B_ui4G93.js} +3 -3
- package/dist/{main-CJdbWeA_.js.map → main-B_ui4G93.js.map} +1 -1
- package/dist/{mediaType-e66mt7Cb.js → mediaType-DHbUOwRj.js} +2 -2
- package/dist/{mediaType-e66mt7Cb.js.map → mediaType-DHbUOwRj.js.map} +1 -1
- package/dist/{runner-CKo8zFVx.js → runner-agAgr2qn.js} +5 -5
- package/dist/{runner-CKo8zFVx.js.map → runner-agAgr2qn.js.map} +1 -1
- package/dist/{runner-link-CGefyJ5U.js → runner-link-B7SsTYaz.js} +3 -3
- package/dist/{runner-link-CGefyJ5U.js.map → runner-link-B7SsTYaz.js.map} +1 -1
- package/dist/runner.js +1 -1
- package/dist/{server-test-aa-ENBUk.js → server-test-Cad_bM68.js} +4 -4
- package/dist/{server-test-aa-ENBUk.js.map → server-test-Cad_bM68.js.map} +1 -1
- package/dist/{src-CwV8i4Mj.js → src-BPcdaWEw.js} +4 -6
- package/dist/{src-CwV8i4Mj.js.map → src-BPcdaWEw.js.map} +1 -1
- package/dist/web/assets/{add-project-dialog-VBi3WXnh.js → add-project-dialog-BHbgORVh.js} +1 -1
- package/dist/web/assets/{agent-tabs-BNgrQWDq.js → agent-tabs-B6uUKAXD.js} +1 -1
- package/dist/web/assets/{agents-Ir1aHz-I.js → agents-NbcZbVrc.js} +1 -1
- package/dist/web/assets/{api-jkvqht5P.js → api-B9OffDXw.js} +1 -1
- package/dist/web/assets/{api-B620HpC2.js → api-yvn34iKU.js} +27 -27
- package/dist/web/assets/{archived-sessions-D4fJHB37.js → archived-sessions-C1-stU7x.js} +1 -1
- package/dist/web/assets/{automation-B91XTDIM.js → automation-Co7V1tcW.js} +1 -1
- package/dist/web/assets/{automation-new-CN7YhryW.js → automation-new-hCV8HoK1.js} +1 -1
- package/dist/web/assets/{automations-CLzVG-zc.js → automations-7GJxGbPp.js} +1 -1
- package/dist/web/assets/{composer-Dd8joSgj.js → composer-B1tdNGSi.js} +1 -1
- package/dist/web/assets/{conflict-card-BN9kNMVL.js → conflict-card-Bx8tT_d5.js} +1 -1
- package/dist/web/assets/{dialog-Dyw3b_Tu.js → dialog-Cvj_lHPY.js} +1 -1
- package/dist/web/assets/{diff-panel-CQ2XZMk2.js → diff-panel-BHhM9z93.js} +1 -1
- package/dist/web/assets/{draft-BmnE6-7J.js → draft-JkaN3nCS.js} +1 -1
- package/dist/web/assets/{dropdown-menu-C4XI7F63.js → dropdown-menu-Bflkx6wY.js} +1 -1
- package/dist/web/assets/{engines-Chq2ih3x.js → engines-pLQJYIu_.js} +1 -1
- package/dist/web/assets/{factory-BBYEYI9i.js → factory-DVCs5zxg.js} +1 -1
- package/dist/web/assets/{factory-columns-CtJOpFim.js → factory-columns-DExb6gW2.js} +1 -1
- package/dist/web/assets/{factory-item-BjydL6AH.js → factory-item-efMFkxnv.js} +1 -1
- package/dist/web/assets/{factory-view-BU2AKcD8.js → factory-view-Cot7flHA.js} +1 -1
- package/dist/web/assets/{files-panel-B6_6pSo9.js → files-panel-BIkR_seN.js} +1 -1
- package/dist/web/assets/{floor-scene-DCpEq0j7.js → floor-scene-DGy8i_5R.js} +1 -1
- package/dist/web/assets/{form-bits-BSfnSmQ7.js → form-bits-5XojWhBG.js} +1 -1
- package/dist/web/assets/{format-D1ma_o2D.js → format-D3kairnQ.js} +1 -1
- package/dist/web/assets/{home-_m_Aihwv.js → home-BtFPGjza.js} +1 -1
- package/dist/web/assets/{inbox-FDD5FMWW.js → inbox-CUPkJ4WC.js} +1 -1
- package/dist/web/assets/{index-BkpVvQrC.js → index-C0C9GyeX.js} +4 -4
- package/dist/web/assets/{item-parts-BhDFWsT1.js → item-parts-DZ3TQad4.js} +1 -1
- package/dist/web/assets/{kill-switch-Dvqaozhz.js → kill-switch-BDAFCjui.js} +1 -1
- package/dist/web/assets/{label-DcWfyglU.js → label-Bm_8Eqe2.js} +1 -1
- package/dist/web/assets/{local-whisper-test-DPTOEA1M.js → local-whisper-test-CqGlAOvK.js} +1 -1
- package/dist/web/assets/{markdown-ad2jia51.js → markdown-DGHfubu-.js} +1 -1
- package/dist/web/assets/{mobile-nav-D8FZcJzG.js → mobile-nav-CrjrDJZ5.js} +1 -1
- package/dist/web/assets/{model-picker-4yoJPkRY.js → model-picker-DnKv2cbc.js} +1 -1
- package/dist/web/assets/{new-session-ddLbjOoZ.js → new-session-Bc93-xJK.js} +1 -1
- package/dist/web/assets/{new-session-GpxXZWbB.js → new-session-CUpOffXI.js} +1 -1
- package/dist/web/assets/{new-session-CwbgcYzY.js → new-session-DVYesr8z.js} +1 -1
- package/dist/web/assets/{now-next-D-6j1g_S.js → now-next-x8fwFm7p.js} +1 -1
- package/dist/web/assets/{on-demand-Cvu5D9uT.js → on-demand-Cvi90jRi.js} +2 -2
- package/dist/web/assets/{open-pr-controls--EtUvzD2.js → open-pr-controls-CYypJCKQ.js} +1 -1
- package/dist/web/assets/{orchestration-pknfiYFr.js → orchestration-BZj0HlxR.js} +1 -1
- package/dist/web/assets/{page-header-BqPf-jRo.js → page-header-t9HzSrxd.js} +1 -1
- package/dist/web/assets/{pm-fMuSJMPP.js → pm-DJfHcB90.js} +1 -1
- package/dist/web/assets/{popover-OrzLEhHL.js → popover-BqwWmyWQ.js} +1 -1
- package/dist/web/assets/{pr-details-BBVM9Kll.js → pr-details-1hhbiFWa.js} +1 -1
- package/dist/web/assets/{project-ws85aDq4.js → project-dy2_DT0H.js} +1 -1
- package/dist/web/assets/{question-card-4aNx5IRX.js → question-card-ldxLXNS_.js} +1 -1
- package/dist/web/assets/{remote-check-BAPXUznK.js → remote-check-CQktPgyp.js} +2 -2
- package/dist/web/assets/{reports-BZj5_wsp.js → reports-D0GAsXFv.js} +1 -1
- package/dist/web/assets/{role-chat-CeJXMsYB.js → role-chat-nIyzM-vQ.js} +1 -1
- package/dist/web/assets/{run-conflict-CPr9OWa3.js → run-conflict-BlgKVpOG.js} +1 -1
- package/dist/web/assets/{runs-table-DpBJ4ZeQ.js → runs-table-DMPF5_D6.js} +1 -1
- package/dist/web/assets/{search-BFTvT67N.js → search-gwjIEGis.js} +1 -1
- package/dist/web/assets/{search-Da3B5-lr.js → search-hK5b8Xwb.js} +1 -1
- package/dist/web/assets/{select-B4LGxZQI.js → select-B1ES0hhy.js} +1 -1
- package/dist/web/assets/{session-_62x2rSZ.js → session-CPUTlq1O.js} +1 -1
- package/dist/web/assets/{settings-CUYuBL-5.js → settings-DRd0b0Kz.js} +1 -1
- package/dist/web/assets/{settings-ui-Ux8rPFol.js → settings-ui-Bc6ymtc_.js} +1 -1
- package/dist/web/assets/{setup-BKOOV6vX.js → setup-Bn2CFYAt.js} +1 -1
- package/dist/web/assets/{shallow-CbfSRfYC.js → shallow-BUNpybIA.js} +1 -1
- package/dist/web/assets/{spec-approval-9S-jPMrI.js → spec-approval-CmC6QBSh.js} +1 -1
- package/dist/web/assets/{spot-check-actions-5CmYjt8A.js → spot-check-actions-DzMUED1O.js} +1 -1
- package/dist/web/assets/{spot-checks-BadmkHuG.js → spot-checks-CDZxwwu0.js} +1 -1
- package/dist/web/assets/{storeys-OlWmOmqA.js → storeys-BEgFUsix.js} +1 -1
- package/dist/web/assets/{switch-DuBpF2_h.js → switch-BHplnCdo.js} +1 -1
- package/dist/web/assets/{terminal-view-ChO1pNp0.js → terminal-view-WNT8FI6K.js} +1 -1
- package/dist/web/assets/{theme-DsW-i9mD.js → theme-3eeE0sp4.js} +1 -1
- package/dist/web/assets/{thread-view-CPlJsMhl.js → thread-view-AQKzJlKb.js} +1 -1
- package/dist/web/assets/{update-banner-CNYd8gAf.js → update-banner-CZGRgiG8.js} +1 -1
- package/dist/web/assets/{updates-CQZDqpFF.js → updates-4l7pwDq1.js} +1 -1
- package/dist/web/assets/{use-retry-item-CWwb3JGo.js → use-retry-item-3n4BD_3J.js} +1 -1
- package/dist/web/assets/{vision-7gkgZ-Ap.js → vision-Z1sLHr_c.js} +1 -1
- package/dist/web/assets/{wip-chip-D5-cZcfN.js → wip-chip-DXwuAo3A.js} +1 -1
- package/dist/web/index.html +34 -34
- package/package.json +1 -1
- package/dist/args-B0i5tyjE.js.map +0 -1
- package/dist/commands-CvAvyECH.js.map +0 -1
- package/dist/harden-channel-2IT0Y7p3.js.map +0 -1
- package/dist/launcher-D17oQovS.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{rr as e}from"./icons-COCLuOtb.js";import{F as t,I as n,R as r}from"./mobile-nav-
|
|
1
|
+
import{rr as e}from"./icons-COCLuOtb.js";import{F as t,I as n,R as r}from"./mobile-nav-CrjrDJZ5.js";import{t as i}from"./dist-wxbqfqV1.js";import{t as a}from"./tap-tooltip-Pz23Abjm.js";import{t as o}from"./jsx-runtime-C3cWAN_r.js";import{t as s}from"./label-Bm_8Eqe2.js";var c=o();function l({label:o,term:s,children:l,side:u=`top`,className:d}){let f=a();return(0,c.jsxs)(t,{...f.root,children:[(0,c.jsx)(r,{asChild:!0,children:(0,c.jsx)(`button`,{type:`button`,"aria-label":s?void 0:`About ${o}`,"data-testid":`info-hint`,...f.trigger,className:i(`cursor-help rounded-sm transition-colors focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none`,s?`underline decoration-muted-foreground/50 decoration-dotted underline-offset-[3px] hover:decoration-foreground`:`relative inline-flex size-3.5 shrink-0 items-center justify-center rounded-full align-middle text-muted-foreground/70 after:absolute after:-inset-1.5 hover:text-foreground focus-visible:text-foreground pointer-coarse:after:-inset-3 [&_svg]:size-3`,d),children:s??(0,c.jsx)(e,{"aria-hidden":!0})})}),(0,c.jsx)(n,{side:u,className:`max-w-64 text-left leading-snug font-normal`,children:l})]})}function u({label:e,htmlFor:t,help:n,hint:r,children:a,className:o}){return(0,c.jsxs)(`div`,{className:i(`space-y-1.5`,o),children:[r?(0,c.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,c.jsx)(s,{htmlFor:t,className:`text-xs`,children:e}),(0,c.jsx)(l,{label:e,children:r})]}):(0,c.jsx)(s,{htmlFor:t,className:`text-xs`,children:e}),a,n&&(0,c.jsx)(`p`,{className:`text-3xs leading-relaxed text-muted-foreground`,children:n})]})}function d({value:e,options:t,onChange:n,disabled:r,label:a}){return(0,c.jsx)(`fieldset`,{"aria-label":a,className:`flex w-fit min-w-0 items-center gap-0.5 rounded-lg border border-border bg-surface p-0.5 text-xs`,children:t.map(t=>(0,c.jsxs)(`button`,{type:`button`,"aria-pressed":e===t.id,disabled:r,onClick:()=>n(t.id),className:i(`flex h-7 items-center gap-1.5 rounded-md px-2.5 text-muted-foreground transition-colors hover:text-foreground disabled:pointer-events-none [&_svg]:size-3.5`,e===t.id&&`bg-card text-foreground shadow-xs`),children:[t.icon,t.label]},t.id))})}function f({title:e,description:t,children:n,aside:r}){return(0,c.jsxs)(`section`,{className:`rounded-xl border border-border bg-card`,children:[(0,c.jsxs)(`header`,{className:`flex items-start gap-3 border-b border-border px-4 py-2.5`,children:[(0,c.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,c.jsx)(`h2`,{className:`text-[13px] font-medium`,children:e}),t&&(0,c.jsx)(`p`,{className:`text-3xs text-muted-foreground`,children:t})]}),r]}),(0,c.jsx)(`div`,{className:`space-y-4 p-4`,children:n})]})}export{l as i,u as n,d as r,f as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{g as t,i as n,jt as r,m as i,p as a}from"./api-B620HpC2.js";import{n as o,t as s}from"./jsx-runtime-C3cWAN_r.js";import{D as c,F as l,M as u,S as d,a as f,b as p,c as m,d as h,g,h as _,i as v,j as y,k as b,l as x,o as S,r as C,s as w,t as T,u as E,v as D}from"./useQuery-VSotSwry.js";import{n as ee,t as O}from"./clsx-BxLRjTE8.js";import{t as k}from"./dist-wxbqfqV1.js";var A=class extends _{#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||j(),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.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=g({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)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),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:a})}this.state.isPaused&&r.canStart()&&t();let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}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.#r===r&&(this.#r=void 0),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),D.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function j(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var M=class extends p{#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),y(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&d(t.mutationKey)!==d(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}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??j();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){D.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function N(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var te=class extends p{#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,D.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||!y(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(N(e,n).forEach(e=>{e.destroy()}),N(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){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(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.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=b(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||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 h(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&D.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},P=e(o(),1);function F({queries:e,...t},n){let r=l(n),i=E(),a=x(),o=t.subscribed!==!1,s=P.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{C(e);let t=r.getQueryCache().get(e.queryHash);S(e,a,t)}),m(a);let[u]=P.useState(()=>new te(r,s,t)),[d,p,g]=u.getOptimisticResult(s,t.combine);P.useEffect(()=>{u.setQueries(s,t)},[s,t,u]);let _=!i&&o;P.useSyncExternalStore(P.useCallback(e=>_?u.subscribe(D.batchCalls(e)):c,[u,_]),()=>u.getCurrentResult(),()=>u.getCurrentResult());let y=d.some((e,t)=>f(s[t],e))?d.flatMap((e,t)=>{let n=s[t];if(n&&f(n,e)){let e=new h(r,n);return v(n,e,a)}return[]}):[];if(y.length>0)throw Promise.all(y);let b=d.find((e,t)=>{let n=s[t];return n&&w({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(b)throw b.error;return p(g())}function I(e,t){let n=l(t),[r]=P.useState(()=>new M(n,e));P.useEffect(()=>{r.setOptions(e)},[r,e]);let i=P.useSyncExternalStore(P.useCallback(e=>r.subscribe(D.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=P.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(c)},[r]);if(i.error&&u(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var ne=P.createContext(null);function re(e){return P.useContext(ne)}var L=s(),ie=Object.defineProperty,ae=(e,t)=>ie(e,`name`,{value:t,configurable:!0});function oe(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}ae(oe,`setRef`);function se(...e){return t=>{let n=!1,r=e.map(e=>{let r=oe(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():oe(e[t],null)}}}}ae(se,`composeRefs`);function R(...e){return P.useCallback(se(...e),e)}ae(R,`useComposedRefs`);var z=Object.defineProperty,B=(e,t)=>z(e,`name`,{value:t,configurable:!0});function ce(e){let t=P.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];r=ve(r),P.Children.forEach(r,e=>{if(me(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;for(;ge(n)&&typeof Se==`function`;)n=Se(n._payload);a=de(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=P.cloneElement(a,void 0,s):!o&&P.Children.count(r)===1&&P.isValidElement(r)&&(a=r);let c=a?pe(a):void 0,l=R(n,c);if(!a){if(r||r===0)throw Error(o?xe(e):be(e));return r}let u=fe(i,a.props??{});return a.type!==P.Fragment&&(u.ref=n?l:c),P.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}B(ce,`createSlot`);var V=ce(`Slot`),le=Symbol.for(`radix.slottable`);function ue(e){let t=B(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=le,t}B(ue,`createSlottable`);var de=B((e,t)=>`child`in e.props?P.isValidElement(t)?P.cloneElement(t,void 0,e.props.children(t.props.children)):null:P.isValidElement(t)?t:null,`getSlottableElementFromSlottable`);function fe(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`?n[r]=[i,a].filter(Boolean).join(` `):r===`aria-describedby`&&(n[r]=ye(a,i))}return{...e,...n}}B(fe,`mergeProps`);function pe(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}B(pe,`getElementRef`);function me(e){return P.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===le}B(me,`isSlottable`);var he=Symbol.for(`react.lazy`);function ge(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===he&&`_payload`in e&&_e(e._payload)}B(ge,`isLazyComponent`);function _e(e){return typeof e==`object`&&!!e&&`then`in e}B(_e,`isPromiseLike`);function ve(e){let t=e;for(;ge(t)&&typeof Se==`function`;)t=Se(t._payload);return t}B(ve,`useUnwrappedLazy`);function ye(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}B(ye,`concatAriaDescribedby`);var be=B(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),xe=B(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),Se=P.use,Ce=e(ee(),1),H=Object.defineProperty,we=(e,t)=>H(e,`name`,{value:t,configurable:!0}),U=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ce(`Primitive.${t}`),r=P.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,L.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function W(e,t){e&&Ce.flushSync(()=>e.dispatchEvent(t))}we(W,`dispatchDiscreteCustomEvent`);var Te=Object.defineProperty,G=(e,t)=>Te(e,`name`,{value:t,configurable:!0});function Ee(e,t){let n=P.createContext(t);n.displayName=e+`Context`;let r=G(e=>{let{children:t,...r}=e,i=P.useMemo(()=>r,Object.values(r));return(0,L.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=P.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return G(i,`useContext`),[r,i]}G(Ee,`createContext`);function De(e,t=[]){let n=[];function r(t,r){let i=P.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=G(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=P.useMemo(()=>o,Object.values(o));return(0,L.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=P.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return G(s,`useContext`),[o,s]}G(r,`createContext`);let i=G(()=>{let t=n.map(e=>P.createContext(e));return G(function(n){let r=n?.[e]||t;return P.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,Oe(i,...t)]}G(De,`createContextScope`);function Oe(...e){let t=e[0];if(e.length===1)return t;let n=G(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return G(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return P.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}G(Oe,`composeContextScopes`);var K=globalThis?.document?P.useLayoutEffect:()=>{},ke=Object.defineProperty,q=(e,t)=>ke(e,`name`,{value:t,configurable:!0});function Ae(e){let t=e+`CollectionProvider`,[n,r]=De(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=q(e=>{let{scope:t,children:n}=e,r=P.useRef(null),a=P.useRef(new Map).current;return(0,L.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=ce(s),l=P.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=R(t,a(s,n).collectionRef);return(0,L.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=ce(u),p=P.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=P.useRef(null),s=R(t,o),c=a(u,n);return P.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,L.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return P.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return q(m,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},m,r]}q(Ae,`createCollection`);var je=new WeakMap,Me=class e extends Map{static{q(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],je.set(this,!0)}set(e,t){return je.get(this)&&!this.has(e)&&this.#e.push(e),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=r?this.size:this.size+1,a=Fe(e),o=a>=0?Math.min(a,i-1):Math.max(i+a,0);if(r?this.#e.indexOf(t)===o:o===this.size)return this.set(t,n),this;let s=this.#e.filter(e=>e!==t);s.splice(o,0,t);let c=s.map(e=>[e,e===t?n:this.get(e)]);this.clear();for(let[e,t]of c)this.set(e,t);return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);if(r===-1)return this;let i=this.#e.indexOf(t),a=i!==-1&&i<r?r-1:r;return this.insert(a,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);if(r===-1)return this;let i=this.#e.indexOf(t),a=i!==-1&&i<=r?r:r+1;return this.insert(a,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=Ne(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=Ne(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return Ne(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=e.length>1;if(!r&&this.size===0)throw TypeError(`Reduce of empty OrderedDict with no initial value`);let i=0,a=n;for(let e of this)a=i===0&&!r?e:Reflect.apply(t,this,[a,e,i,this]),i++;return a}reduceRight(...e){let[t,n]=e,r=e.length>1;if(!r&&this.size===0)throw TypeError(`Reduce of empty OrderedDict with no initial value`);let i=n;for(let e=this.size-1;e>=0;e--){let n=this.entryAt(e);i=e===this.size-1&&!r?n:Reflect.apply(t,this,[i,n,e,this])}return i}sort(e){if(typeof e!=`function`)throw TypeError(`OrderedDict.sort requires a compare function`);let t=[...this.entries()].sort(e);this.clear();for(let[e,n]of t)this.set(e,n);return this}toSorted(t){if(typeof t!=`function`)throw TypeError(`OrderedDict.toSorted requires a compare function`);let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e;for(let e of this.#e.slice(t,n))r.set(e,this.get(e));return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function Ne(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=Pe(e,t);return n===-1?void 0:e[n]}q(Ne,`at`);function Pe(e,t){let n=e.length,r=Fe(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}q(Pe,`toSafeIndex`);function Fe(e){return e!==e||e===0?0:Math.trunc(e)}q(Fe,`toSafeInteger`);function Ie(e){let t=e+`CollectionProvider`,[n,r]=De(t),[i,a]=n(t);i.displayName=e+`CollectionStableContextProvider`;let[o,s]=n(t);o.displayName=e+`CollectionStatefulContextProvider`;let c=q(({state:e,...t})=>e?(0,L.jsx)(u,{...t,state:e}):(0,L.jsx)(l,{...t}),`CollectionProvider`);c.displayName=t;let l=q(e=>{let t=_();return(0,L.jsx)(u,{...e,state:t})},`CollectionInit`);l.displayName=e+`CollectionInit`;let u=q(e=>{let{scope:t,children:n,state:r}=e,a=P.useRef(null),[s,c]=P.useState(null),l=R(a,c),[u,d]=r,f=P.useRef(new Me),p=P.useCallback(()=>{let e=f.current;return ze(e)||e.sort(Be),e},[]);return P.useEffect(()=>{if(!s)return;let e=Ve(()=>{d(e=>{let t=e.toSorted(Be);return t.some(([t],n)=>e.keyAt(n)!==t)?t:e})});return e.observe(s,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[s,d]),(0,L.jsx)(i,{scope:t,collectionElementRef:l,collectionElementRefObject:a,getCollection:p,setCollection:d,registryRef:f,children:(0,L.jsx)(o,{scope:t,collectionElement:s,collection:u,children:n})})},`CollectionProviderImpl`);u.displayName=e+`CollectionProviderImpl`;let d=e+`CollectionSlot`,f=ce(d),p=P.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=R(t,a(d,n).collectionElementRef);return(0,L.jsx)(f,{ref:i,children:r})});p.displayName=d;let m=e+`CollectionItemSlot`,h=ce(m),g=P.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=P.useRef(null),{setCollection:s,registryRef:c}=a(m,n),l=P.useRef(i);Le(l.current,i)||(l.current=i);let u=l.current,d=R(t,P.useCallback(e=>{let t=c.current;e?t.set(e,{...l.current,element:e}):o.current&&t.delete(o.current)},[c]),o);K(()=>{let e=o.current,t=c.current;e&&t.has(e)&&t.set(e,{...u,element:e})},[u,c]);let f=P.useRef(null);return P.useEffect(()=>{let e=o.current,t=f.current;((t?.element??null)!==e||e&&t?.itemData!==u)&&(f.current=e?{element:e,itemData:u}:null,s(n=>{let r=new Me(n);return t&&t.element!==e&&r.delete(t.element),e&&r.set(e,{...u,element:e}),r.sort(Be)}))}),P.useEffect(()=>()=>{let e=f.current;f.current=null,e&&s(t=>{if(!t.has(e.element))return t;let n=new Me(t);return n.delete(e.element),n})},[s]),(0,L.jsx)(h,{"data-radix-collection-item":``,ref:d,children:r})});g.displayName=m;function _(){return P.useState(new Me)}q(_,`useInitCollection`);function v(t){let{collection:n}=s(e+`CollectionConsumer`,t);return n}q(v,`useCollection`);function y(t){let{getCollection:n}=a(e+`CollectionConsumer`,t);return n}return q(y,`useGetCollection`),[{Provider:c,Slot:p,ItemSlot:g},{createCollectionScope:r,useCollection:v,useGetCollection:y,useInitCollection:_}]}q(Ie,`createCollection`);function Le(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}q(Le,`shallowEqual`);function Re(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}q(Re,`isElementPreceding`);function ze(e){let t;for(let n of e.keys()){if(t){let e=t.compareDocumentPosition(n);if(!(e&Node.DOCUMENT_POSITION_DISCONNECTED)&&e&Node.DOCUMENT_POSITION_PRECEDING)return!1}t=n}return!0}q(ze,`isInDocumentOrder`);function Be(e,t){return!e[1].element||!t[1].element?0:Re(e[1].element,t[1].element)?-1:1}q(Be,`sortByDocumentPosition`);function Ve(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}q(Ve,`getChildListObserver`);var He=Object.defineProperty,Ue=(e,t)=>He(e,`name`,{value:t,configurable:!0}),We=!!(typeof window<`u`&&window.document&&window.document.createElement);function Ge(e,t,{checkForDefaultPrevented:n=!0}={}){return Ue(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}Ue(Ge,`composeEventHandlers`);function Ke(e){if(!We)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}Ue(Ke,`getOwnerWindow`);function qe(e){if(!We)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}Ue(qe,`getOwnerDocument`);function Je(e,t=!1){let{activeElement:n}=qe(e);if(!n?.nodeName)return null;if(Ye(n)&&n.contentDocument)return Je(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=qe(n).getElementById(e);if(t)return t}}return n}Ue(Je,`getActiveElement`);function Ye(e){return e.tagName===`IFRAME`}Ue(Ye,`isFrame`);var Xe=Object.defineProperty,Ze=(e,t)=>Xe(e,`name`,{value:t,configurable:!0}),Qe=P.useEffectEvent,$e=P.useInsertionEffect;function et(e){if(typeof Qe==`function`)return Qe(e);let t=P.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof $e==`function`?$e(()=>{t.current=e}):K(()=>{t.current=e}),P.useMemo(()=>((...e)=>t.current?.(...e)),[])}Ze(et,`useEffectEvent`);var tt=Object.defineProperty,nt=(e,t)=>tt(e,`name`,{value:t,configurable:!0}),rt=P.useInsertionEffect||K;function it({prop:e,defaultProp:t,onChange:n=nt(()=>{},`onChange`),caller:r}){let[i,a,o]=at({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,P.useCallback(t=>{if(s){let n=ot(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}nt(it,`useControllableState`);function at({defaultProp:e,onChange:t}){let[n,r]=P.useState(e),i=P.useRef(n),a=P.useRef(t);return rt(()=>{a.current=t},[t]),P.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}nt(at,`useUncontrolledState`);function ot(e){return typeof e==`function`}nt(ot,`isFunction`);var st=Symbol(`RADIX:SYNC_STATE`);function ct(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=et(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=P.useReducer((t,n)=>{if(n.type===st)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=P.useRef(p);P.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=P.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return P.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:st,state:i})},[i,d.state,c]),[h,f]}nt(ct,`useControllableStateReducer`);var lt=Object.defineProperty,ut=(e,t)=>lt(e,`name`,{value:t,configurable:!0});function dt(e,t){return P.useReducer((e,n)=>t[e][n]??e,e)}ut(dt,`useStateMachine`);var ft=ut(e=>{let{present:t,children:n}=e,r=pt(t),i=typeof n==`function`?n({present:r.isPresent}):P.Children.only(n),a=ht(r.ref,_t(i));return typeof n==`function`||r.isPresent?P.cloneElement(i,{ref:a}):null},`Presence`);function pt(e){let[t,n]=P.useState(),r=P.useRef(null),i=P.useRef(e),a=P.useRef(`none`),o=P.useRef(void 0),[s,c]=dt(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return P.useEffect(()=>{s===`mounted`?(a.current=o.current??gt(r.current),o.current=void 0):a.current=`none`},[s]),K(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=gt(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),K(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=ut(a=>{let o=gt(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=ut(e=>{e.target===t&&(a.current=gt(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:P.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=gt(t)}else r.current=null;n(e)},[])}}ut(pt,`usePresence`);function mt(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}ut(mt,`setRef`);function ht(...e){let t=P.useRef(e);return t.current=e,P.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=mt(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():mt(n[e],null)}}},[])}ut(ht,`useStableComposedRefs`);function gt(e){return e?.animationName||`none`}ut(gt,`getAnimationName`);function _t(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}ut(_t,`getElementRef`);var vt=Object.defineProperty,yt=(e,t)=>vt(e,`name`,{value:t,configurable:!0}),bt=P.useId||(()=>void 0),xt=0;function St(e){let[t,n]=P.useState(bt());return K(()=>{e||n(e=>e??String(xt++))},[e]),e||(t?`radix-${t}`:``)}yt(St,`useId`);var Ct=Object.defineProperty,wt=(e,t)=>Ct(e,`name`,{value:t,configurable:!0}),Tt={LTR:`ltr`,RTL:`rtl`},Et=P.createContext(void 0);function Dt(e){let t=P.useContext(Et);return e||t||Tt.LTR}wt(Dt,`useDirection`);var Ot=Object.defineProperty,kt=(e,t)=>Ot(e,`name`,{value:t,configurable:!0}),At=P.useInsertionEffect;function jt(e){let t=P.useRef(e);return typeof At==`function`?At(()=>{t.current=e}):K(()=>{t.current=e}),P.useMemo(()=>((...e)=>t.current?.(...e)),[])}kt(jt,`useCallbackRef`);var Mt=Object.defineProperty,J=(e,t)=>Mt(e,`name`,{value:t,configurable:!0}),Nt=`dismissableLayer.update`,Pt=`dismissableLayer.pointerDownOutside`,Ft=`dismissableLayer.focusOutside`,It,Lt=P.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Rt=P.forwardRef(J(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=P.useContext(Lt),[d,f]=P.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=P.useState({}),h=R(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=P.useRef(!1),C=Vt(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:P.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=Ht(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=jt(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return P.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),P.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(It=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Ut(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=It))}},[d,p,n,u]),P.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Ut())},[d,u]),P.useEffect(()=>{let e=J(()=>m({}),`handleUpdate`);return document.addEventListener(Nt,e),()=>document.removeEventListener(Nt,e)},[]),(0,L.jsx)(U.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:Ge(e.onFocusCapture,w.onFocusCapture),onBlurCapture:Ge(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:Ge(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function zt(){let e=P.useContext(Lt),[t,n]=P.useState(null);return P.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}J(zt,`useDismissableLayerSurface`);var Bt=J(()=>!0,`IS_TRUE`);function Vt(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Bt}=t,s=jt(e),c=P.useRef(!1),l=P.useRef(!1),u=P.useRef(new Map),d=P.useRef(()=>{});return P.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}J(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}J(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}J(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}J(p,`handleInteractionBubble`);let m=J(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||Wt(Pt,s,p,{discrete:!0})};if(J(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:J(()=>c.current=!0,`onPointerDownCapture`)}}J(Vt,`usePointerDownOutside`);function Ht(e,t=globalThis?.document){let n=jt(e),r=P.useRef(!1);return P.useEffect(()=>{let e=J(e=>{e.target&&!r.current&&Wt(Ft,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:J(()=>r.current=!0,`onFocusCapture`),onBlurCapture:J(()=>r.current=!1,`onBlurCapture`)}}J(Ht,`useFocusOutside`);function Ut(){let e=new CustomEvent(Nt);document.dispatchEvent(e)}J(Ut,`dispatchUpdate`);function Wt(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?W(i,a):i.dispatchEvent(a)}J(Wt,`handleAndDispatchCustomEvent`);var Gt=Object.defineProperty,Y=(e,t)=>Gt(e,`name`,{value:t,configurable:!0}),Kt=`focusScope.autoFocusOnMount`,qt=`focusScope.autoFocusOnUnmount`,Jt={bubbles:!1,cancelable:!0},Yt=P.forwardRef(Y(function(e,t){let{loop:n=!1,trapped:r=!1,branches:i,onMountAutoFocus:a,onUnmountAutoFocus:o,...s}=e,[c,l]=P.useState(null),u=jt(a),d=jt(o),f=P.useRef(null),p=R(t,l),m=P.useRef(i);P.useEffect(()=>{m.current=i});let h=P.useCallback(e=>e?c?.contains(e)?!0:!!m.current?.some(t=>t.contains(e)):!1,[c]),g=P.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;P.useEffect(()=>{if(r){let e=function(e){if(g.paused||!c)return;let t=e.target;h(t)?f.current=t:sn(f.current,{select:!0})},t=function(e){if(g.paused||!c)return;let t=e.relatedTarget;t!==null&&(h(t)||sn(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&sn(c)};Y(e,`handleFocusIn`),Y(t,`handleFocusOut`),Y(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,c,g.paused,h]),P.useEffect(()=>{if(c){cn.add(g);let e=document.activeElement;if(!c.contains(e)){let t=new CustomEvent(Kt,Jt);c.addEventListener(Kt,u),c.dispatchEvent(t),t.defaultPrevented||(en(dn(nn(c)),{select:!0}),document.activeElement===e&&sn(c))}return()=>{c.removeEventListener(Kt,u);let t=c.ownerDocument,n=CustomEvent;setTimeout(()=>{let r=new n(qt,Jt);c.addEventListener(qt,d),c.dispatchEvent(r),r.defaultPrevented||sn(e??t.body,{select:!0}),c.removeEventListener(qt,d),cn.remove(g)},0)}}},[c,u,d,g]);let _=P.useCallback(e=>{if(!n&&!r||g.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=tn(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&sn(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&sn(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,L.jsx)(U.div,{tabIndex:-1,...s,ref:p,onKeyDown:_})},`FocusScope`)),Xt=P.createContext(null);function Zt({registry:e,children:t}){return e?(0,L.jsx)(Xt.Provider,{value:e,children:t}):t}Y(Zt,`FocusScopeBranchProvider`);function Qt(){let[e,t]=P.useState([]);return{nodes:e,registry:P.useMemo(()=>({add:Y(e=>t(t=>t.includes(e)?t:[...t,e]),`add`),remove:Y(e=>t(t=>t.filter(t=>t!==e)),`remove`)}),[])}}Y(Qt,`useFocusScopeBranchRegistry`);function $t(e){let t=P.useContext(Xt);P.useEffect(()=>{if(e&&t)return t.add(e),()=>t.remove(e)},[e,t])}Y($t,`useFocusScopeBranch`);function en(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(sn(r,{select:t}),document.activeElement!==n)return}Y(en,`focusFirst`);function tn(e){let t=nn(e);return[rn(t,e),rn(t.reverse(),e)]}Y(tn,`getTabbableEdges`);function nn(e){let t=[],n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Y(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}Y(nn,`getTabbableCandidates`);function rn(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):an(r,{upTo:t})))return r}Y(rn,`findVisible`);function an(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}Y(an,`isHidden`);function on(e){return e.tagName===`INPUT`&&typeof e.select==`function`}Y(on,`isSelectableInput`);function sn(e,{select:t=!1}={}){if(e&&e.focus){let n=(e.ownerDocument??document).activeElement;e.focus({preventScroll:!0}),e!==n&&on(e)&&t&&e.select()}}Y(sn,`focus`);var cn=ln();function ln(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=un(e,t),e.unshift(t)},remove(t){e=un(e,t),e[0]?.resume()}}}Y(ln,`createFocusScopesStack`);function un(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Y(un,`arrayRemove`);function dn(e){return e.filter(e=>e.tagName!==`A`)}Y(dn,`removeLinks`);var fn=Object.defineProperty,pn=P.forwardRef(((e,t)=>fn(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=P.useState(!1);K(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Ce.createPortal((0,L.jsx)(U.div,{...r,ref:t}),o):null},`Portal`)),mn=Object.defineProperty,hn=(e,t)=>mn(e,`name`,{value:t,configurable:!0}),gn=0,_n=null;function vn(e){return yn(),e.children}hn(vn,`FocusGuards`);function yn(){P.useEffect(()=>{_n||={start:bn(),end:bn()};let{start:e,end:t}=_n;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),gn++,()=>{gn===1&&(_n?.start.remove(),_n?.end.remove(),_n=null),gn=Math.max(0,gn-1)}},[])}hn(yn,`useFocusGuards`);function bn(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}hn(bn,`createFocusGuard`);var xn=function(){return xn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},xn.apply(this,arguments)};function Sn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Cn(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var wn=`right-scroll-bar-position`,Tn=`width-before-scroll-bar`,En=`with-scroll-bars-hidden`,Dn=`--removed-body-scroll-bar-size`;function On(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function kn(e,t){var n=(0,P.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var An=typeof window<`u`?P.useLayoutEffect:P.useEffect,jn=new WeakMap;function Mn(e,t){var n=kn(t||null,function(t){return e.forEach(function(e){return On(e,t)})});return An(function(){var t=jn.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||On(e,null)}),i.forEach(function(e){r.has(e)||On(e,a)})}jn.set(n,e)},[e]),n}function Nn(e){return e}function Pn(e,t){t===void 0&&(t=Nn);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Fn(e){e===void 0&&(e={});var t=Pn(null);return t.options=xn({async:!0,ssr:!1},e),t}var In=function(e){var t=e.sideCar,n=Sn(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return P.createElement(r,xn({},n))};In.isSideCarExport=!0;function Ln(e,t){return e.useMedium(t),In}var Rn=Fn(),zn=function(){},Bn=P.forwardRef(function(e,t){var n=P.useRef(null),r=P.useState({onScrollCapture:zn,onWheelCapture:zn,onTouchMoveCapture:zn}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=Sn(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Mn([n,t]),C=xn(xn({},b),i);return P.createElement(P.Fragment,null,u&&P.createElement(x,{sideCar:Rn,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?P.cloneElement(P.Children.only(s),xn(xn({},C),{ref:S})):P.createElement(v,xn({},C,{className:c,ref:S}),s))});Bn.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Bn.classNames={fullWidth:Tn,zeroRight:wn};var Vn=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Hn(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Vn();return t&&e.setAttribute(`nonce`,t),e}function Un(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Wn(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Gn=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Hn())&&(Un(t,n),Wn(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Kn=function(){var e=Gn();return function(t,n){P.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},qn=function(){var e=Kn();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Jn={left:0,top:0,right:0,gap:0},Yn=function(e){return parseInt(e||``,10)||0},Xn=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Yn(n),Yn(r),Yn(i)]},Zn=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Jn;var t=Xn(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Qn=qn(),$n=`data-scroll-locked`,er=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{g as t,i as n,jt as r,m as i,p as a}from"./api-yvn34iKU.js";import{n as o,t as s}from"./jsx-runtime-C3cWAN_r.js";import{D as c,F as l,M as u,S as d,a as f,b as p,c as m,d as h,g,h as _,i as v,j as y,k as b,l as x,o as S,r as C,s as w,t as T,u as E,v as D}from"./useQuery-VSotSwry.js";import{n as ee,t as O}from"./clsx-BxLRjTE8.js";import{t as k}from"./dist-wxbqfqV1.js";var A=class extends _{#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||j(),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.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=g({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)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),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:a})}this.state.isPaused&&r.canStart()&&t();let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}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.#r===r&&(this.#r=void 0),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),D.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function j(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var M=class extends p{#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),y(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&d(t.mutationKey)!==d(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}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??j();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){D.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function N(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var te=class extends p{#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,D.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||!y(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(N(e,n).forEach(e=>{e.destroy()}),N(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){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(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.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=b(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||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 h(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&D.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},P=e(o(),1);function F({queries:e,...t},n){let r=l(n),i=E(),a=x(),o=t.subscribed!==!1,s=P.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{C(e);let t=r.getQueryCache().get(e.queryHash);S(e,a,t)}),m(a);let[u]=P.useState(()=>new te(r,s,t)),[d,p,g]=u.getOptimisticResult(s,t.combine);P.useEffect(()=>{u.setQueries(s,t)},[s,t,u]);let _=!i&&o;P.useSyncExternalStore(P.useCallback(e=>_?u.subscribe(D.batchCalls(e)):c,[u,_]),()=>u.getCurrentResult(),()=>u.getCurrentResult());let y=d.some((e,t)=>f(s[t],e))?d.flatMap((e,t)=>{let n=s[t];if(n&&f(n,e)){let e=new h(r,n);return v(n,e,a)}return[]}):[];if(y.length>0)throw Promise.all(y);let b=d.find((e,t)=>{let n=s[t];return n&&w({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(b)throw b.error;return p(g())}function I(e,t){let n=l(t),[r]=P.useState(()=>new M(n,e));P.useEffect(()=>{r.setOptions(e)},[r,e]);let i=P.useSyncExternalStore(P.useCallback(e=>r.subscribe(D.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=P.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(c)},[r]);if(i.error&&u(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var ne=P.createContext(null);function re(e){return P.useContext(ne)}var L=s(),ie=Object.defineProperty,ae=(e,t)=>ie(e,`name`,{value:t,configurable:!0});function oe(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}ae(oe,`setRef`);function se(...e){return t=>{let n=!1,r=e.map(e=>{let r=oe(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():oe(e[t],null)}}}}ae(se,`composeRefs`);function R(...e){return P.useCallback(se(...e),e)}ae(R,`useComposedRefs`);var z=Object.defineProperty,B=(e,t)=>z(e,`name`,{value:t,configurable:!0});function ce(e){let t=P.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];r=ve(r),P.Children.forEach(r,e=>{if(me(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;for(;ge(n)&&typeof Se==`function`;)n=Se(n._payload);a=de(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=P.cloneElement(a,void 0,s):!o&&P.Children.count(r)===1&&P.isValidElement(r)&&(a=r);let c=a?pe(a):void 0,l=R(n,c);if(!a){if(r||r===0)throw Error(o?xe(e):be(e));return r}let u=fe(i,a.props??{});return a.type!==P.Fragment&&(u.ref=n?l:c),P.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}B(ce,`createSlot`);var V=ce(`Slot`),le=Symbol.for(`radix.slottable`);function ue(e){let t=B(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=le,t}B(ue,`createSlottable`);var de=B((e,t)=>`child`in e.props?P.isValidElement(t)?P.cloneElement(t,void 0,e.props.children(t.props.children)):null:P.isValidElement(t)?t:null,`getSlottableElementFromSlottable`);function fe(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`?n[r]=[i,a].filter(Boolean).join(` `):r===`aria-describedby`&&(n[r]=ye(a,i))}return{...e,...n}}B(fe,`mergeProps`);function pe(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}B(pe,`getElementRef`);function me(e){return P.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===le}B(me,`isSlottable`);var he=Symbol.for(`react.lazy`);function ge(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===he&&`_payload`in e&&_e(e._payload)}B(ge,`isLazyComponent`);function _e(e){return typeof e==`object`&&!!e&&`then`in e}B(_e,`isPromiseLike`);function ve(e){let t=e;for(;ge(t)&&typeof Se==`function`;)t=Se(t._payload);return t}B(ve,`useUnwrappedLazy`);function ye(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}B(ye,`concatAriaDescribedby`);var be=B(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),xe=B(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),Se=P.use,Ce=e(ee(),1),H=Object.defineProperty,we=(e,t)=>H(e,`name`,{value:t,configurable:!0}),U=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ce(`Primitive.${t}`),r=P.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,L.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function W(e,t){e&&Ce.flushSync(()=>e.dispatchEvent(t))}we(W,`dispatchDiscreteCustomEvent`);var Te=Object.defineProperty,G=(e,t)=>Te(e,`name`,{value:t,configurable:!0});function Ee(e,t){let n=P.createContext(t);n.displayName=e+`Context`;let r=G(e=>{let{children:t,...r}=e,i=P.useMemo(()=>r,Object.values(r));return(0,L.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=P.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return G(i,`useContext`),[r,i]}G(Ee,`createContext`);function De(e,t=[]){let n=[];function r(t,r){let i=P.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=G(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=P.useMemo(()=>o,Object.values(o));return(0,L.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=P.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return G(s,`useContext`),[o,s]}G(r,`createContext`);let i=G(()=>{let t=n.map(e=>P.createContext(e));return G(function(n){let r=n?.[e]||t;return P.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,Oe(i,...t)]}G(De,`createContextScope`);function Oe(...e){let t=e[0];if(e.length===1)return t;let n=G(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return G(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return P.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}G(Oe,`composeContextScopes`);var K=globalThis?.document?P.useLayoutEffect:()=>{},ke=Object.defineProperty,q=(e,t)=>ke(e,`name`,{value:t,configurable:!0});function Ae(e){let t=e+`CollectionProvider`,[n,r]=De(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=q(e=>{let{scope:t,children:n}=e,r=P.useRef(null),a=P.useRef(new Map).current;return(0,L.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=ce(s),l=P.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=R(t,a(s,n).collectionRef);return(0,L.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=ce(u),p=P.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=P.useRef(null),s=R(t,o),c=a(u,n);return P.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,L.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return P.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return q(m,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},m,r]}q(Ae,`createCollection`);var je=new WeakMap,Me=class e extends Map{static{q(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],je.set(this,!0)}set(e,t){return je.get(this)&&!this.has(e)&&this.#e.push(e),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=r?this.size:this.size+1,a=Fe(e),o=a>=0?Math.min(a,i-1):Math.max(i+a,0);if(r?this.#e.indexOf(t)===o:o===this.size)return this.set(t,n),this;let s=this.#e.filter(e=>e!==t);s.splice(o,0,t);let c=s.map(e=>[e,e===t?n:this.get(e)]);this.clear();for(let[e,t]of c)this.set(e,t);return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);if(r===-1)return this;let i=this.#e.indexOf(t),a=i!==-1&&i<r?r-1:r;return this.insert(a,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);if(r===-1)return this;let i=this.#e.indexOf(t),a=i!==-1&&i<=r?r:r+1;return this.insert(a,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=Ne(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=Ne(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return Ne(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=e.length>1;if(!r&&this.size===0)throw TypeError(`Reduce of empty OrderedDict with no initial value`);let i=0,a=n;for(let e of this)a=i===0&&!r?e:Reflect.apply(t,this,[a,e,i,this]),i++;return a}reduceRight(...e){let[t,n]=e,r=e.length>1;if(!r&&this.size===0)throw TypeError(`Reduce of empty OrderedDict with no initial value`);let i=n;for(let e=this.size-1;e>=0;e--){let n=this.entryAt(e);i=e===this.size-1&&!r?n:Reflect.apply(t,this,[i,n,e,this])}return i}sort(e){if(typeof e!=`function`)throw TypeError(`OrderedDict.sort requires a compare function`);let t=[...this.entries()].sort(e);this.clear();for(let[e,n]of t)this.set(e,n);return this}toSorted(t){if(typeof t!=`function`)throw TypeError(`OrderedDict.toSorted requires a compare function`);let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e;for(let e of this.#e.slice(t,n))r.set(e,this.get(e));return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function Ne(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=Pe(e,t);return n===-1?void 0:e[n]}q(Ne,`at`);function Pe(e,t){let n=e.length,r=Fe(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}q(Pe,`toSafeIndex`);function Fe(e){return e!==e||e===0?0:Math.trunc(e)}q(Fe,`toSafeInteger`);function Ie(e){let t=e+`CollectionProvider`,[n,r]=De(t),[i,a]=n(t);i.displayName=e+`CollectionStableContextProvider`;let[o,s]=n(t);o.displayName=e+`CollectionStatefulContextProvider`;let c=q(({state:e,...t})=>e?(0,L.jsx)(u,{...t,state:e}):(0,L.jsx)(l,{...t}),`CollectionProvider`);c.displayName=t;let l=q(e=>{let t=_();return(0,L.jsx)(u,{...e,state:t})},`CollectionInit`);l.displayName=e+`CollectionInit`;let u=q(e=>{let{scope:t,children:n,state:r}=e,a=P.useRef(null),[s,c]=P.useState(null),l=R(a,c),[u,d]=r,f=P.useRef(new Me),p=P.useCallback(()=>{let e=f.current;return ze(e)||e.sort(Be),e},[]);return P.useEffect(()=>{if(!s)return;let e=Ve(()=>{d(e=>{let t=e.toSorted(Be);return t.some(([t],n)=>e.keyAt(n)!==t)?t:e})});return e.observe(s,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[s,d]),(0,L.jsx)(i,{scope:t,collectionElementRef:l,collectionElementRefObject:a,getCollection:p,setCollection:d,registryRef:f,children:(0,L.jsx)(o,{scope:t,collectionElement:s,collection:u,children:n})})},`CollectionProviderImpl`);u.displayName=e+`CollectionProviderImpl`;let d=e+`CollectionSlot`,f=ce(d),p=P.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=R(t,a(d,n).collectionElementRef);return(0,L.jsx)(f,{ref:i,children:r})});p.displayName=d;let m=e+`CollectionItemSlot`,h=ce(m),g=P.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=P.useRef(null),{setCollection:s,registryRef:c}=a(m,n),l=P.useRef(i);Le(l.current,i)||(l.current=i);let u=l.current,d=R(t,P.useCallback(e=>{let t=c.current;e?t.set(e,{...l.current,element:e}):o.current&&t.delete(o.current)},[c]),o);K(()=>{let e=o.current,t=c.current;e&&t.has(e)&&t.set(e,{...u,element:e})},[u,c]);let f=P.useRef(null);return P.useEffect(()=>{let e=o.current,t=f.current;((t?.element??null)!==e||e&&t?.itemData!==u)&&(f.current=e?{element:e,itemData:u}:null,s(n=>{let r=new Me(n);return t&&t.element!==e&&r.delete(t.element),e&&r.set(e,{...u,element:e}),r.sort(Be)}))}),P.useEffect(()=>()=>{let e=f.current;f.current=null,e&&s(t=>{if(!t.has(e.element))return t;let n=new Me(t);return n.delete(e.element),n})},[s]),(0,L.jsx)(h,{"data-radix-collection-item":``,ref:d,children:r})});g.displayName=m;function _(){return P.useState(new Me)}q(_,`useInitCollection`);function v(t){let{collection:n}=s(e+`CollectionConsumer`,t);return n}q(v,`useCollection`);function y(t){let{getCollection:n}=a(e+`CollectionConsumer`,t);return n}return q(y,`useGetCollection`),[{Provider:c,Slot:p,ItemSlot:g},{createCollectionScope:r,useCollection:v,useGetCollection:y,useInitCollection:_}]}q(Ie,`createCollection`);function Le(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}q(Le,`shallowEqual`);function Re(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}q(Re,`isElementPreceding`);function ze(e){let t;for(let n of e.keys()){if(t){let e=t.compareDocumentPosition(n);if(!(e&Node.DOCUMENT_POSITION_DISCONNECTED)&&e&Node.DOCUMENT_POSITION_PRECEDING)return!1}t=n}return!0}q(ze,`isInDocumentOrder`);function Be(e,t){return!e[1].element||!t[1].element?0:Re(e[1].element,t[1].element)?-1:1}q(Be,`sortByDocumentPosition`);function Ve(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}q(Ve,`getChildListObserver`);var He=Object.defineProperty,Ue=(e,t)=>He(e,`name`,{value:t,configurable:!0}),We=!!(typeof window<`u`&&window.document&&window.document.createElement);function Ge(e,t,{checkForDefaultPrevented:n=!0}={}){return Ue(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}Ue(Ge,`composeEventHandlers`);function Ke(e){if(!We)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}Ue(Ke,`getOwnerWindow`);function qe(e){if(!We)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}Ue(qe,`getOwnerDocument`);function Je(e,t=!1){let{activeElement:n}=qe(e);if(!n?.nodeName)return null;if(Ye(n)&&n.contentDocument)return Je(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=qe(n).getElementById(e);if(t)return t}}return n}Ue(Je,`getActiveElement`);function Ye(e){return e.tagName===`IFRAME`}Ue(Ye,`isFrame`);var Xe=Object.defineProperty,Ze=(e,t)=>Xe(e,`name`,{value:t,configurable:!0}),Qe=P.useEffectEvent,$e=P.useInsertionEffect;function et(e){if(typeof Qe==`function`)return Qe(e);let t=P.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof $e==`function`?$e(()=>{t.current=e}):K(()=>{t.current=e}),P.useMemo(()=>((...e)=>t.current?.(...e)),[])}Ze(et,`useEffectEvent`);var tt=Object.defineProperty,nt=(e,t)=>tt(e,`name`,{value:t,configurable:!0}),rt=P.useInsertionEffect||K;function it({prop:e,defaultProp:t,onChange:n=nt(()=>{},`onChange`),caller:r}){let[i,a,o]=at({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,P.useCallback(t=>{if(s){let n=ot(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}nt(it,`useControllableState`);function at({defaultProp:e,onChange:t}){let[n,r]=P.useState(e),i=P.useRef(n),a=P.useRef(t);return rt(()=>{a.current=t},[t]),P.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}nt(at,`useUncontrolledState`);function ot(e){return typeof e==`function`}nt(ot,`isFunction`);var st=Symbol(`RADIX:SYNC_STATE`);function ct(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=et(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=P.useReducer((t,n)=>{if(n.type===st)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=P.useRef(p);P.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=P.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return P.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:st,state:i})},[i,d.state,c]),[h,f]}nt(ct,`useControllableStateReducer`);var lt=Object.defineProperty,ut=(e,t)=>lt(e,`name`,{value:t,configurable:!0});function dt(e,t){return P.useReducer((e,n)=>t[e][n]??e,e)}ut(dt,`useStateMachine`);var ft=ut(e=>{let{present:t,children:n}=e,r=pt(t),i=typeof n==`function`?n({present:r.isPresent}):P.Children.only(n),a=ht(r.ref,_t(i));return typeof n==`function`||r.isPresent?P.cloneElement(i,{ref:a}):null},`Presence`);function pt(e){let[t,n]=P.useState(),r=P.useRef(null),i=P.useRef(e),a=P.useRef(`none`),o=P.useRef(void 0),[s,c]=dt(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return P.useEffect(()=>{s===`mounted`?(a.current=o.current??gt(r.current),o.current=void 0):a.current=`none`},[s]),K(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=gt(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),K(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=ut(a=>{let o=gt(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=ut(e=>{e.target===t&&(a.current=gt(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:P.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=gt(t)}else r.current=null;n(e)},[])}}ut(pt,`usePresence`);function mt(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}ut(mt,`setRef`);function ht(...e){let t=P.useRef(e);return t.current=e,P.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=mt(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():mt(n[e],null)}}},[])}ut(ht,`useStableComposedRefs`);function gt(e){return e?.animationName||`none`}ut(gt,`getAnimationName`);function _t(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}ut(_t,`getElementRef`);var vt=Object.defineProperty,yt=(e,t)=>vt(e,`name`,{value:t,configurable:!0}),bt=P.useId||(()=>void 0),xt=0;function St(e){let[t,n]=P.useState(bt());return K(()=>{e||n(e=>e??String(xt++))},[e]),e||(t?`radix-${t}`:``)}yt(St,`useId`);var Ct=Object.defineProperty,wt=(e,t)=>Ct(e,`name`,{value:t,configurable:!0}),Tt={LTR:`ltr`,RTL:`rtl`},Et=P.createContext(void 0);function Dt(e){let t=P.useContext(Et);return e||t||Tt.LTR}wt(Dt,`useDirection`);var Ot=Object.defineProperty,kt=(e,t)=>Ot(e,`name`,{value:t,configurable:!0}),At=P.useInsertionEffect;function jt(e){let t=P.useRef(e);return typeof At==`function`?At(()=>{t.current=e}):K(()=>{t.current=e}),P.useMemo(()=>((...e)=>t.current?.(...e)),[])}kt(jt,`useCallbackRef`);var Mt=Object.defineProperty,J=(e,t)=>Mt(e,`name`,{value:t,configurable:!0}),Nt=`dismissableLayer.update`,Pt=`dismissableLayer.pointerDownOutside`,Ft=`dismissableLayer.focusOutside`,It,Lt=P.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Rt=P.forwardRef(J(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=P.useContext(Lt),[d,f]=P.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=P.useState({}),h=R(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=P.useRef(!1),C=Vt(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:P.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=Ht(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=jt(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return P.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),P.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(It=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Ut(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=It))}},[d,p,n,u]),P.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Ut())},[d,u]),P.useEffect(()=>{let e=J(()=>m({}),`handleUpdate`);return document.addEventListener(Nt,e),()=>document.removeEventListener(Nt,e)},[]),(0,L.jsx)(U.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:Ge(e.onFocusCapture,w.onFocusCapture),onBlurCapture:Ge(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:Ge(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function zt(){let e=P.useContext(Lt),[t,n]=P.useState(null);return P.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}J(zt,`useDismissableLayerSurface`);var Bt=J(()=>!0,`IS_TRUE`);function Vt(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Bt}=t,s=jt(e),c=P.useRef(!1),l=P.useRef(!1),u=P.useRef(new Map),d=P.useRef(()=>{});return P.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}J(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}J(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}J(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}J(p,`handleInteractionBubble`);let m=J(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||Wt(Pt,s,p,{discrete:!0})};if(J(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:J(()=>c.current=!0,`onPointerDownCapture`)}}J(Vt,`usePointerDownOutside`);function Ht(e,t=globalThis?.document){let n=jt(e),r=P.useRef(!1);return P.useEffect(()=>{let e=J(e=>{e.target&&!r.current&&Wt(Ft,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:J(()=>r.current=!0,`onFocusCapture`),onBlurCapture:J(()=>r.current=!1,`onBlurCapture`)}}J(Ht,`useFocusOutside`);function Ut(){let e=new CustomEvent(Nt);document.dispatchEvent(e)}J(Ut,`dispatchUpdate`);function Wt(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?W(i,a):i.dispatchEvent(a)}J(Wt,`handleAndDispatchCustomEvent`);var Gt=Object.defineProperty,Y=(e,t)=>Gt(e,`name`,{value:t,configurable:!0}),Kt=`focusScope.autoFocusOnMount`,qt=`focusScope.autoFocusOnUnmount`,Jt={bubbles:!1,cancelable:!0},Yt=P.forwardRef(Y(function(e,t){let{loop:n=!1,trapped:r=!1,branches:i,onMountAutoFocus:a,onUnmountAutoFocus:o,...s}=e,[c,l]=P.useState(null),u=jt(a),d=jt(o),f=P.useRef(null),p=R(t,l),m=P.useRef(i);P.useEffect(()=>{m.current=i});let h=P.useCallback(e=>e?c?.contains(e)?!0:!!m.current?.some(t=>t.contains(e)):!1,[c]),g=P.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;P.useEffect(()=>{if(r){let e=function(e){if(g.paused||!c)return;let t=e.target;h(t)?f.current=t:sn(f.current,{select:!0})},t=function(e){if(g.paused||!c)return;let t=e.relatedTarget;t!==null&&(h(t)||sn(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&sn(c)};Y(e,`handleFocusIn`),Y(t,`handleFocusOut`),Y(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,c,g.paused,h]),P.useEffect(()=>{if(c){cn.add(g);let e=document.activeElement;if(!c.contains(e)){let t=new CustomEvent(Kt,Jt);c.addEventListener(Kt,u),c.dispatchEvent(t),t.defaultPrevented||(en(dn(nn(c)),{select:!0}),document.activeElement===e&&sn(c))}return()=>{c.removeEventListener(Kt,u);let t=c.ownerDocument,n=CustomEvent;setTimeout(()=>{let r=new n(qt,Jt);c.addEventListener(qt,d),c.dispatchEvent(r),r.defaultPrevented||sn(e??t.body,{select:!0}),c.removeEventListener(qt,d),cn.remove(g)},0)}}},[c,u,d,g]);let _=P.useCallback(e=>{if(!n&&!r||g.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=tn(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&sn(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&sn(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,L.jsx)(U.div,{tabIndex:-1,...s,ref:p,onKeyDown:_})},`FocusScope`)),Xt=P.createContext(null);function Zt({registry:e,children:t}){return e?(0,L.jsx)(Xt.Provider,{value:e,children:t}):t}Y(Zt,`FocusScopeBranchProvider`);function Qt(){let[e,t]=P.useState([]);return{nodes:e,registry:P.useMemo(()=>({add:Y(e=>t(t=>t.includes(e)?t:[...t,e]),`add`),remove:Y(e=>t(t=>t.filter(t=>t!==e)),`remove`)}),[])}}Y(Qt,`useFocusScopeBranchRegistry`);function $t(e){let t=P.useContext(Xt);P.useEffect(()=>{if(e&&t)return t.add(e),()=>t.remove(e)},[e,t])}Y($t,`useFocusScopeBranch`);function en(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(sn(r,{select:t}),document.activeElement!==n)return}Y(en,`focusFirst`);function tn(e){let t=nn(e);return[rn(t,e),rn(t.reverse(),e)]}Y(tn,`getTabbableEdges`);function nn(e){let t=[],n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Y(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}Y(nn,`getTabbableCandidates`);function rn(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):an(r,{upTo:t})))return r}Y(rn,`findVisible`);function an(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}Y(an,`isHidden`);function on(e){return e.tagName===`INPUT`&&typeof e.select==`function`}Y(on,`isSelectableInput`);function sn(e,{select:t=!1}={}){if(e&&e.focus){let n=(e.ownerDocument??document).activeElement;e.focus({preventScroll:!0}),e!==n&&on(e)&&t&&e.select()}}Y(sn,`focus`);var cn=ln();function ln(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=un(e,t),e.unshift(t)},remove(t){e=un(e,t),e[0]?.resume()}}}Y(ln,`createFocusScopesStack`);function un(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Y(un,`arrayRemove`);function dn(e){return e.filter(e=>e.tagName!==`A`)}Y(dn,`removeLinks`);var fn=Object.defineProperty,pn=P.forwardRef(((e,t)=>fn(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=P.useState(!1);K(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Ce.createPortal((0,L.jsx)(U.div,{...r,ref:t}),o):null},`Portal`)),mn=Object.defineProperty,hn=(e,t)=>mn(e,`name`,{value:t,configurable:!0}),gn=0,_n=null;function vn(e){return yn(),e.children}hn(vn,`FocusGuards`);function yn(){P.useEffect(()=>{_n||={start:bn(),end:bn()};let{start:e,end:t}=_n;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),gn++,()=>{gn===1&&(_n?.start.remove(),_n?.end.remove(),_n=null),gn=Math.max(0,gn-1)}},[])}hn(yn,`useFocusGuards`);function bn(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}hn(bn,`createFocusGuard`);var xn=function(){return xn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},xn.apply(this,arguments)};function Sn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Cn(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var wn=`right-scroll-bar-position`,Tn=`width-before-scroll-bar`,En=`with-scroll-bars-hidden`,Dn=`--removed-body-scroll-bar-size`;function On(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function kn(e,t){var n=(0,P.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var An=typeof window<`u`?P.useLayoutEffect:P.useEffect,jn=new WeakMap;function Mn(e,t){var n=kn(t||null,function(t){return e.forEach(function(e){return On(e,t)})});return An(function(){var t=jn.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||On(e,null)}),i.forEach(function(e){r.has(e)||On(e,a)})}jn.set(n,e)},[e]),n}function Nn(e){return e}function Pn(e,t){t===void 0&&(t=Nn);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Fn(e){e===void 0&&(e={});var t=Pn(null);return t.options=xn({async:!0,ssr:!1},e),t}var In=function(e){var t=e.sideCar,n=Sn(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return P.createElement(r,xn({},n))};In.isSideCarExport=!0;function Ln(e,t){return e.useMedium(t),In}var Rn=Fn(),zn=function(){},Bn=P.forwardRef(function(e,t){var n=P.useRef(null),r=P.useState({onScrollCapture:zn,onWheelCapture:zn,onTouchMoveCapture:zn}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=Sn(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Mn([n,t]),C=xn(xn({},b),i);return P.createElement(P.Fragment,null,u&&P.createElement(x,{sideCar:Rn,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?P.cloneElement(P.Children.only(s),xn(xn({},C),{ref:S})):P.createElement(v,xn({},C,{className:c,ref:S}),s))});Bn.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Bn.classNames={fullWidth:Tn,zeroRight:wn};var Vn=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Hn(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Vn();return t&&e.setAttribute(`nonce`,t),e}function Un(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Wn(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Gn=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Hn())&&(Un(t,n),Wn(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Kn=function(){var e=Gn();return function(t,n){P.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},qn=function(){var e=Kn();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Jn={left:0,top:0,right:0,gap:0},Yn=function(e){return parseInt(e||``,10)||0},Xn=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Yn(n),Yn(r),Yn(i)]},Zn=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Jn;var t=Xn(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Qn=qn(),$n=`data-scroll-locked`,er=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
2
2
|
.${En} {
|
|
3
3
|
overflow: hidden ${r};
|
|
4
4
|
padding-right: ${s}px ${r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L as e}from"./dropdown-menu-
|
|
1
|
+
import{L as e}from"./dropdown-menu-Bflkx6wY.js";import{Cr as t,Ht as n,O as r,P as i,bn as a,cn as o}from"./icons-COCLuOtb.js";import{t as s}from"./role-chat-nIyzM-vQ.js";import{a as c}from"./mobile-nav-CrjrDJZ5.js";import{D as l}from"./format-D3kairnQ.js";import{r as u}from"./composer-B1tdNGSi.js";import{r as d}from"./switch-BHplnCdo.js";import{t as f}from"./jsx-runtime-C3cWAN_r.js";var p=f(),m=[{icon:r,text:`What's going on across my projects?`},{icon:n,text:`Triage the open issues in my main project`},{icon:i,text:`Run a security audit across all projects`},{icon:o,text:`Which pull requests are waiting on me?`}];function h({draftKey:e,items:t}){let n=u(e=>e.setText),r=u(e=>e.focus);return(0,p.jsx)(`div`,{className:`relative mt-8 grid w-full max-w-2xl grid-cols-2 gap-2`,children:t.map(t=>(0,p.jsxs)(`button`,{type:`button`,onClick:()=>{n(e,t.text),r()},className:`flex items-center gap-3 rounded-xl border border-border bg-card/60 px-3.5 py-3 text-left text-[13px] text-muted-foreground transition-colors hover:border-primary/30 hover:bg-card hover:text-foreground`,children:[(0,p.jsx)(t.icon,{className:`size-4 shrink-0 text-primary/80`}),t.text]},t.text))})}function g(){let t=l(e=>e.projects,[]),n=d(e=>e.setAddProjectOpen);return(0,p.jsxs)(`div`,{className:`relative mt-6 flex max-w-2xl flex-wrap items-center justify-center gap-1.5`,children:[t.map(t=>(0,p.jsxs)(e,{to:`/projects/$projectId`,params:{projectId:t.id},className:`inline-flex h-7 items-center gap-1.5 rounded-full border border-border bg-card/60 px-2.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,p.jsx)(c,{project:t}),` `,t.name]},t.id)),(0,p.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`inline-flex h-7 items-center gap-1.5 rounded-full border border-dashed border-border px-2.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,p.jsx)(a,{className:`size-3.5`}),` Add project`]})]})}function _({draftKey:e}){return(0,p.jsxs)(`div`,{className:`relative flex flex-1 flex-col items-center justify-center px-6 py-10`,children:[(0,p.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 top-0 h-80 bg-[radial-gradient(60%_100%_at_50%_0%,var(--glow),transparent)]`}),(0,p.jsx)(`div`,{className:`relative mb-5 flex size-12 items-center justify-center rounded-2xl border border-border bg-card shadow-sm`,children:(0,p.jsx)(t,{className:`size-6 text-primary`})}),(0,p.jsx)(`h2`,{className:`relative text-2xl font-semibold tracking-tight`,children:`What should we build?`}),(0,p.jsx)(`p`,{className:`relative mt-2 max-w-md text-center text-sm text-muted-foreground`,children:`Talk to the orchestrator. It knows what's running in every project, hands work to project managers and keeps every step visible in GitHub.`}),(0,p.jsx)(h,{draftKey:e,items:m}),(0,p.jsx)(g,{})]})}function v(){return(0,p.jsx)(s,{kind:`orchestrator`,projectId:null,empty:e=>(0,p.jsx)(_,{draftKey:e})})}export{v as HomePage,h as SuggestionGrid};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{F as t,t as n}from"./useQuery-VSotSwry.js";import{Ar as r,In as i,Or as a,P as o,Rn as s,Vn as c,Xt as l,ar as u,cn as d,gn as f,ht as p,m,mr as h,n as g,pr as _,q as v,rt as y,un as b,zn as x}from"./icons-COCLuOtb.js";import{n as S,t as C}from"./jsx-runtime-C3cWAN_r.js";import{o as w,t as T}from"./bits-B2GRjm37.js";import{R as E,Y as ee,dt as te,ft as ne,i as D,pt as re,v as ie}from"./api-B620HpC2.js";import{D as ae,E as oe,O as se,S as ce,T as le,j as O,m as k,n as A,y as ue,yt as j}from"./format-D1ma_o2D.js";import{C as de,S as fe,_ as pe,a as me,b as he,v as ge,w as _e,x as ve,y as ye}from"./mobile-nav-D8FZcJzG.js";import{L as M,v as be}from"./dropdown-menu-C4XI7F63.js";import{n as xe,t as Se}from"./question-card-4aNx5IRX.js";import{t as N}from"./markdown-ad2jia51.js";import{t as P}from"./skeleton-D8Sbd2jT.js";import{d as F,o as I,r as Ce}from"./switch-DuBpF2_h.js";import{t as L}from"./dist-wxbqfqV1.js";import{n as we}from"./spec-approval-9S-jPMrI.js";import"./spot-checks-BadmkHuG.js";import{r as Te,s as Ee}from"./github-bits-BLf93Pkz.js";import{c as De,d as Oe}from"./logic-BTt00I9b.js";import{t as ke}from"./input-CPpbtC2H.js";import{t as Ae}from"./conflict-card-BN9kNMVL.js";import{t as je}from"./page-header-BqPf-jRo.js";var R=e(S(),1),Me=[{id:`approval`,title:`Approvals`,filter:`asks`},{id:`question`,title:`Questions`,filter:`asks`},{id:`spec_approval`,title:`Specs to approve`,filter:`asks`},{id:`setup_change`,title:`Setup changes`,filter:`asks`},{id:`pr_review`,title:`Pull requests ready`,filter:`reviews`},{id:`spot_check`,title:`Spot-checks`,filter:`reviews`},{id:`run_failed`,title:`Failed runs`,filter:`problems`},{id:`cleanup_failed`,title:`Worktrees not removed`,filter:`problems`},{id:`triage`,title:`Triage decisions`,filter:`asks`},{id:`automation_result`,title:`Automation results`,filter:`reviews`},{id:`message`,title:`Messages`,filter:`reviews`}],z={high:0,normal:1,low:2};function B(e,t=`all`){let n=e.filter(e=>e.status===`open`);return Me.filter(e=>t===`all`||e.filter===t).map(e=>({id:e.id,title:e.title,items:n.filter(t=>t.kind===e.id).sort((e,t)=>z[e.priority]-z[t.priority]||Date.parse(t.createdAt)-Date.parse(e.createdAt))})).filter(e=>e.items.length>0)}function V(e){let t=[],n=[];for(let r of e)r.status===`open`&&(re(r)?n:t).push(r);return{dismiss:t,stay:n}}function Ne(e,t){let n=t=>B(e,t).reduce((e,t)=>e+t.items.length,0);return{all:n(`all`)+t,asks:n(`asks`)+t,reviews:n(`reviews`),problems:n(`problems`)}}var H=C(),U=1e4,Pe=5,Fe=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,W=e=>Fe(e,`notice`);function G(e){return e===1?`1 item that waits on you stays`:`${e} items that wait on you stay`}function Ie(e){return e>0?`${G(e)}.`:void 0}function Le(e){return/[.!?]$/.test(e)?e:`${e}.`}function K(e){let t=[];for(let n=0;n<e.length;n+=E)t.push(e.slice(n,n+E));return t}async function Re(e,t,n){let r=0;try{for(let n of K(t))r+=(await e.restoreInbox(n)).restored;O.success(`Restored ${n(r)}`)}catch(e){let t=r>0?`Restored ${n(r)}, then couldn't restore the rest`:`Couldn't undo the dismiss`;O.error(t,{description:e.message})}}function q(e){let t=D();return j({mutationFn:async e=>{let n={dismissed:0,ids:[],kept:0};for(let r of K(e.map(e=>e.id)))try{let e=await t.dismissInbox(r);n.dismissed+=e.dismissed,n.ids.push(...e.ids),n.kept+=e.kept}catch(e){if(n.ids.length===0)throw e;return{...n,error:e}}return n},onError:e=>O.error(`Couldn't dismiss them`,{description:e.message}),onSuccess:n=>{let r=Ie(n.kept);if(n.dismissed===0){O.warning(`Nothing was dismissed`,{description:r});return}let i={label:`Undo`,onClick:()=>void Re(t,n.ids,e)};if(n.error){let t=n.error.message;O.error(`Dismissed ${e(n.dismissed)}, then couldn't dismiss the rest`,{description:r?`${Le(t)} ${r}`:t,action:i,duration:U})}else O.success(`Dismissed ${e(n.dismissed)}`,{description:r,action:i,duration:U})}})}function ze({items:e,alsoStaying:t=[]}){let[n,r]=(0,R.useState)(!1),i=q(W),{dismiss:a,stay:o}=V(e),s=[...t,...o],c=a.length;if(c===0)return null;let l=s.slice(0,Pe),u=s.length-l.length;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{size:`sm`,variant:`ghost`,className:`text-muted-foreground`,title:`Dismiss the ${W(c)} in this view`,onClick:()=>r(!0),disabled:i.isPending,children:[(0,H.jsx)(h,{}),` Dismiss `,c]}),(0,H.jsx)(pe,{open:n,onOpenChange:r,children:(0,H.jsxs)(he,{children:[(0,H.jsxs)(de,{children:[(0,H.jsxs)(_e,{children:[`Dismiss `,W(c),`?`]}),(0,H.jsxs)(ve,{children:[W(c),` will be dismissed`,s.length>0?`; ${G(s.length)}.`:`.`,` You can undo it for a few seconds.`]})]}),l.length>0&&(0,H.jsxs)(`div`,{className:`min-w-0 text-[13px]`,"data-testid":`dismiss-staying`,children:[(0,H.jsx)(`div`,{className:`mb-1.5 text-2xs text-muted-foreground`,children:`Staying`}),(0,H.jsx)(`ul`,{className:`space-y-1`,children:l.map(e=>(0,H.jsx)(`li`,{className:`truncate`,children:e.title},e.id))}),u>0&&(0,H.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`and `,u,` more`]})]}),(0,H.jsxs)(fe,{children:[(0,H.jsx)(ye,{children:`Cancel`}),(0,H.jsxs)(ge,{onClick:()=>i.mutate(a),children:[`Dismiss `,c]})]})]})})]})}function Be(e,t){return!t||t.ready?null:{text:`${e} is ${De(t.reason??`Not ready`)}`,detail:t.detail,command:t.command}}function Ve({item:e,busy:t,dismissButton:n}){let i=D(),a=ce(e.sessionId??void 0)??null,o=ae(e=>e.runner.providers,[]),s=le({staleTime:6e4}).data?.checks,c=Be(o.find(e=>e.id===a?.provider)?.displayName??a?.provider??`Its provider`,a?Oe(a.provider,s):null),l=()=>a&&Ce.getState().setHandoff({sessionId:a.id,provider:null}),u=j({mutationFn:()=>i.retryInbox(e.id),onError:e=>O.error(`Retry failed`,{description:e.message,...e instanceof ie&&e.code===`provider_unavailable`&&a?{action:{label:`Continue on another provider`,onClick:l}}:{}}),onSuccess:()=>O.success(`Retrying`)}),d=ne(e);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{size:`sm`,onClick:()=>u.mutate(),disabled:t||u.isPending||c!==null,title:c?.text,children:[(0,H.jsx)(v,{}),` `,u.isPending?`Retrying…`:`Retry`]}),c&&a&&(0,H.jsxs)(k,{size:`sm`,variant:`outline`,onClick:l,children:[(0,H.jsx)(r,{}),` Continue on another provider`]}),n,d>1&&(0,H.jsxs)(`span`,{className:`text-2xs text-muted-foreground`,children:[`Failed `,d,` times`]}),c&&(0,H.jsxs)(`p`,{className:`w-full text-2xs text-status-failed`,"data-testid":`retry-blocked`,title:c.detail??void 0,children:[`Retry is off: `,c.text,`.`,c.command&&(0,H.jsxs)(H.Fragment,{children:[` `,`Fix it with `,(0,H.jsx)(`code`,{className:`font-mono`,children:c.command}),`.`]})]})]})}var J=e=>e.projectId&&e.pr?ee(e.projectId,e.pr.number):null;function Y({item:e}){let t=D(),r=J(e),{data:i}=n({queryKey:[`github`,`pr`,r],queryFn:()=>t.github.pr(r??``),enabled:!!r});return i?(0,H.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-2xs text-muted-foreground`,children:[(0,H.jsx)(Te,{checks:i.checks}),(0,H.jsx)(Ee,{decision:i.reviewDecision}),(0,H.jsxs)(`span`,{className:`text-diff-add`,children:[`+`,i.additions]}),(0,H.jsxs)(`span`,{className:`text-diff-del`,children:[`−`,i.deletions]}),(0,H.jsxs)(`span`,{children:[i.files.length,` files`]}),i.mergeable===`conflicting`&&(0,H.jsx)(`span`,{className:`text-status-failed`,children:`Merge conflicts`})]}):null}function X({item:e}){let n=D(),r=t(),i=F(),a=be(e=>e.openRightTab),o=e=>O.error(`Couldn't update the item`,{description:e.message}),s=j({mutationFn:()=>n.resolveInbox(e.id,{status:`dismissed`}),onError:o,onSuccess:()=>O.success(`Dismissed`)}),l=j({mutationFn:()=>n.resolveInbox(e.id,{status:`resolved`}),onError:o,onSuccess:()=>O.success(`New worktrees run these setup commands from now on`)}),u=j({mutationFn:async()=>{let t=J(e);if(!t)throw Error(`This item has no pull request`);let r=await n.github.merge(t,{method:`squash`});if(!r.merged)throw Error(`GitHub did not merge the pull request`);return r},onError:e=>O.error(`Couldn't merge`,{description:e.message}),onSuccess:()=>{O.success(`Merged #${e.pr?.number}`),r.invalidateQueries({queryKey:[`github`]})}}),f=j({mutationFn:async t=>{if(!e.sessionId)throw Error(`This item has no session`);return n.archiveSession(e.sessionId,{force:t})},onError:o,onSuccess:e=>{let{status:t,message:n,unpushed:r}=e.worktree;t===`removed`?O.success(r?`Container deleted`:`Worktree removed`,{description:n??void 0}):t===`kept_changes`&&r?O.warning(`The container was kept: it holds work that isn't pushed`,{description:[n,`Delete anyway deletes this work for good.`].filter(Boolean).join(`. `),action:{label:`Delete anyway`,onClick:()=>f.mutate(!0)},duration:2e4}):O.error(`Couldn't remove the worktree`,{description:n??void 0})}}),p=s.isPending||u.isPending||f.isPending||l.isPending,m=(0,H.jsx)(k,{size:`sm`,variant:`ghost`,className:`text-muted-foreground`,onClick:()=>s.mutate(),disabled:p,children:`Dismiss`});switch(e.kind){case`pr_review`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{size:`sm`,onClick:()=>u.mutate(),disabled:p||!J(e),children:[(0,H.jsx)(b,{}),` `,u.isPending?`Merging…`:`Merge`]}),(0,H.jsxs)(k,{size:`sm`,variant:`outline`,onClick:()=>{e.sessionId?(a(`github`),i({to:`/sessions/$sessionId`,params:{sessionId:e.sessionId}})):e.pr&&I.openExternal(e.pr.url)},children:[(0,H.jsx)(d,{}),` Open PR`]}),e.pr&&(0,H.jsxs)(k,{size:`sm`,variant:`ghost`,onClick:()=>e.pr&&I.openExternal(e.pr.url),children:[(0,H.jsx)(c,{}),` GitHub`]})]});case`run_failed`:return(0,H.jsx)(Ve,{item:e,busy:p,dismissButton:m});case`cleanup_failed`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{size:`sm`,onClick:()=>f.mutate(!1),disabled:p,children:[(0,H.jsx)(v,{}),` `,f.isPending?`Removing…`:`Try again`]}),m]});case`spot_check`:return(0,H.jsxs)(H.Fragment,{children:[e.projectId&&(0,H.jsxs)(k,{size:`sm`,onClick:()=>void i({to:`/projects/$projectId`,params:{projectId:e.projectId},hash:`spot-checks`}),children:[(0,H.jsx)(x,{}),` Open spot-checks`]}),m]});case`setup_change`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{size:`sm`,onClick:()=>l.mutate(),disabled:p,children:[(0,H.jsx)(y,{}),` `,l.isPending?`Allowing…`:`Run them`]}),(0,H.jsx)(k,{size:`sm`,variant:`ghost`,onClick:()=>s.mutate(),disabled:p,children:`Don't run`})]});case`automation_result`:case`message`:return m;default:return null}}var He=`inbox:factory-digest:`,Ue=`inbox:factory-escalated:`,We=`inbox:factory-spec:`;function Z(e){return e.id.startsWith(He)?`digest`:e.id.startsWith(Ue)?`escalated`:e.id.startsWith(We)?`spec`:null}function Q({icon:e,label:t,tone:n}){return(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b px-4 py-2 text-2xs ${n}`,children:[e,(0,H.jsx)(`span`,{className:`font-semibold tracking-wider uppercase`,children:t})]})}function Ge({item:e}){let t=D(),n=e.status===`open`,r=j({mutationFn:()=>t.resolveInbox(e.id,{status:`resolved`}),onSuccess:()=>O.success(`Digest read`)});return(0,H.jsxs)(`div`,{className:`rounded-xl border border-border bg-card`,"data-testid":`factory-digest`,children:[(0,H.jsx)(Q,{icon:(0,H.jsx)(p,{className:`size-3.5`}),label:`Factory digest`,tone:`border-border text-muted-foreground`}),(0,H.jsxs)(`div`,{className:`space-y-3 px-4 py-3`,children:[(0,H.jsx)(`h3`,{className:`text-[14px] font-medium`,children:e.title.replace(/^Factory digest: /,``)}),e.body&&(0,H.jsx)(`div`,{className:`max-h-80 overflow-y-auto rounded-lg border border-border bg-surface px-3 py-2 text-[13px] scroll-thin`,children:(0,H.jsx)(N,{children:e.body})}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[e.projectId&&(0,H.jsx)(k,{size:`sm`,variant:`outline`,asChild:!0,children:(0,H.jsxs)(M,{to:`/projects/$projectId`,params:{projectId:e.projectId},children:[(0,H.jsx)(s,{}),` Factory panel`]})}),n&&(0,H.jsx)(k,{size:`sm`,variant:`ghost`,onClick:()=>r.mutate(),disabled:r.isPending,children:`Mark read`})]})]})]})}function Ke({item:e}){let t=e.id.slice(24),n=e.status===`open`;return(0,H.jsxs)(`div`,{className:`rounded-xl border border-status-waiting/35 bg-card`,"data-testid":`factory-escalation`,children:[(0,H.jsx)(Q,{icon:(0,H.jsx)(o,{className:`size-3.5`}),label:`Protected area · needs you`,tone:`border-status-waiting/20 bg-status-waiting/[0.06] text-status-waiting`}),(0,H.jsxs)(`div`,{className:`space-y-3 px-4 py-3`,children:[(0,H.jsx)(`h3`,{className:`text-[14px] font-medium`,children:e.title.replace(/^Factory PR needs you: /,``)}),e.body&&(0,H.jsx)(`p`,{className:`text-[13px] leading-relaxed text-muted-foreground`,children:e.body}),n&&(0,H.jsx)(Y,{item:e}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[n&&(0,H.jsx)(X,{item:e}),e.projectId&&(0,H.jsx)(k,{size:`sm`,variant:`ghost`,asChild:!0,children:(0,H.jsx)(M,{to:`/projects/$projectId/factory/$itemId`,params:{projectId:e.projectId,itemId:t},children:`Merge checks`})})]})]})]})}function qe({item:e}){let t=e.id.slice(19),n=e.status===`open`;return(0,H.jsxs)(`div`,{className:`rounded-xl border border-status-waiting/35 bg-card`,"data-testid":`factory-spec-approval`,children:[(0,H.jsx)(Q,{icon:(0,H.jsx)(i,{className:`size-3.5`}),label:`Spec to approve · needs you`,tone:`border-status-waiting/20 bg-status-waiting/[0.06] text-status-waiting`}),(0,H.jsxs)(`div`,{className:`space-y-3 px-4 py-3`,children:[(0,H.jsx)(`h3`,{className:`text-[14px] font-medium`,children:e.title.replace(/^Approve the spec: /,``)}),e.body&&(0,H.jsx)(`div`,{className:`max-h-80 overflow-y-auto rounded-lg border border-border bg-surface px-3 py-2 text-[13px] scroll-thin`,children:(0,H.jsx)(N,{children:e.body})}),n&&e.projectId&&(0,H.jsx)(we,{projectId:e.projectId,itemId:t,version:e.updatedAt,compact:!0}),e.projectId&&(0,H.jsx)(k,{size:`sm`,variant:`ghost`,asChild:!0,children:(0,H.jsx)(M,{to:`/projects/$projectId/factory/$itemId`,params:{projectId:e.projectId,itemId:t},children:`Open the work item`})})]})]})}function Je({item:e}){let t=Z(e);return t===`digest`?(0,H.jsx)(Ge,{item:e}):t===`spec`?(0,H.jsx)(qe,{item:e}):(0,H.jsx)(Ke,{item:e})}function Ye(e){return e.title.replace(/^Should I take this on\?\s*/,``)||e.title}function Xe({item:e}){let n=D(),r=t(),i=F(),[a,o]=(0,R.useState)(!1),[s,l]=(0,R.useState)(``),d=e.status===`open`,p=e=>O.error(`Couldn't record the decision`,{description:e.message}),m=j({mutationFn:()=>n.automations.acceptTriage(e.id),onSuccess:e=>{let t=e.start;if(t?.status===`conflict`){r.invalidateQueries({queryKey:[`conflicts`]}),O.warning(`Matching work is already running`,{description:`Decide on the conflict card in your inbox.`});return}let n=t&&`sessionId`in t?t.sessionId:null;O.success(t?.status===`queued`?`Queued behind running work`:`Taking it on`,{action:n?{label:`Open session`,onClick:()=>void i({to:`/sessions/$sessionId`,params:{sessionId:n}})}:void 0})},onError:p}),h=j({mutationFn:()=>n.automations.declineTriage(e.id,s.trim()?{reason:s.trim()}:{}),onSuccess:()=>O.success(`Declined; the issue keeps its triage labels`),onError:p}),v=m.isPending||h.isPending;return(0,H.jsxs)(`div`,{className:`rounded-xl border border-border bg-card`,"data-testid":`triage-card`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-4 py-2 text-2xs`,children:[(0,H.jsx)(f,{className:`size-3.5 text-primary`}),(0,H.jsx)(`span`,{className:`font-semibold tracking-wider text-primary uppercase`,children:`Should I take this on?`}),(0,H.jsx)(`span`,{className:`ml-auto rounded-full bg-status-done/12 px-2 py-px font-medium text-status-done`,"data-testid":`triage-classification`,title:`The PM's triage classification`,children:`PM: Ready`})]}),(0,H.jsxs)(`div`,{className:`space-y-3 px-4 py-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,H.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-status-done`}),(0,H.jsx)(`h3`,{className:`min-w-0 flex-1 text-[14px] font-medium`,children:Ye(e)}),e.issue&&(0,H.jsxs)(k,{size:`xs`,variant:`ghost`,className:`shrink-0 text-muted-foreground`,onClick:()=>e.issue&&I.openExternal(e.issue.url),children:[(0,H.jsx)(c,{}),` Issue`]})]}),e.body&&(0,H.jsxs)(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-3xs font-medium tracking-wider text-muted-foreground uppercase`,children:`PM's rationale`}),(0,H.jsx)(`p`,{className:`mt-1 text-[13px] leading-relaxed`,"data-testid":`triage-rationale`,children:e.body})]}),d?a?(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(ke,{autoFocus:!0,value:s,onChange:e=>l(e.target.value),placeholder:`Why not? (optional, kept with the decision)`,"aria-label":`Reason to decline`,className:`h-8 text-[13px]`}),(0,H.jsx)(k,{size:`sm`,variant:`destructive`,disabled:v,onClick:()=>h.mutate(),children:`Decline`}),(0,H.jsx)(k,{size:`sm`,variant:`ghost`,onClick:()=>o(!1),children:`Cancel`})]}):(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,H.jsxs)(k,{size:`sm`,onClick:()=>m.mutate(),disabled:v,children:[(0,H.jsx)(_,{}),` `,m.isPending?`Starting…`:`Take it on`]}),(0,H.jsxs)(k,{size:`sm`,variant:`ghost`,className:`text-muted-foreground`,onClick:()=>o(!0),disabled:v,children:[(0,H.jsx)(g,{}),` Decline…`]}),(0,H.jsx)(`span`,{className:`ml-auto text-3xs text-muted-foreground`,children:`Take it on starts an agent session for the issue`})]}):(0,H.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:e.status===`resolved`?`Accepted`:`Declined`})]})]})}function Ze(e,t){let n=e.items[t];if(!n)return;let r=e.threads[n.threadId]?.itemIds??[];for(let i=r.indexOf(t)-1;i>=0;i--){let t=e.items[r[i]??``];if(!t||t.turnId!==n.turnId)return;if(t.item.kind===`plan`)return t.item.text}}function Qe({item:e}){let{transcript:t}=se(e.sessionId??void 0,{turns:1,...e.itemId?{item:e.itemId}:{}}),n=e.itemId?t?.items[e.itemId]?.item:void 0;if(!e.sessionId)return null;if(!t)return(0,H.jsx)(P,{className:`h-24 w-full rounded-xl`});if(n?.kind===`approval_request`){let r=n.action===`plan`&&e.itemId?Ze(t,e.itemId):void 0;return(0,H.jsx)(xe,{item:n,sessionId:e.sessionId,compact:!0,plan:r})}return n?.kind===`user_question`?(0,H.jsx)(Se,{item:n,sessionId:e.sessionId}):(0,H.jsxs)(`div`,{className:`rounded-xl border border-border bg-card px-4 py-3`,children:[(0,H.jsx)(`h3`,{className:`text-[14px] font-medium`,children:e.title}),e.body&&(0,H.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:e.body})]})}function $e(e){let t=te.safeParse(e.resolution);return t.success?t.data.note:null}function $(e){return`inbox-item-${e}`}function et({item:e,focused:t=!1}){let n=ue(e.projectId),r=e.status!==`open`,i=e.kind===`approval`||e.kind===`question`;return(0,H.jsxs)(`article`,{id:$(e.id),className:L(r?`opacity-60`:`animate-rise`,t&&`rounded-xl ring-2 ring-primary/50 ring-offset-4 ring-offset-background`),"data-kind":e.kind,"data-focused":t||void 0,children:[(0,H.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2 text-2xs text-muted-foreground`,children:[n&&(0,H.jsx)(me,{project:n}),(0,H.jsx)(`span`,{children:n?.name??`Global`}),(0,H.jsx)(`span`,{className:`text-muted-foreground/40`,children:`·`}),(0,H.jsx)(`span`,{children:A(e.createdAt)}),e.priority===`high`&&(0,H.jsx)(`span`,{className:`rounded-full bg-status-failed/12 px-1.5 text-3xs font-medium text-status-failed`,children:`high`}),(0,H.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[e.issue&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>e.issue&&I.openExternal(e.issue.url),className:`flex items-center gap-1 hover:text-foreground`,children:[(0,H.jsx)(u,{className:`size-3 text-status-done`}),`#`,e.issue.number]}),e.pr&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>e.pr&&I.openExternal(e.pr.url),className:`flex items-center gap-1 hover:text-foreground`,children:[(0,H.jsx)(d,{className:`size-3 text-status-done`}),`#`,e.pr.number]}),e.sessionId&&(0,H.jsxs)(M,{to:`/sessions/$sessionId`,params:{sessionId:e.sessionId},className:`flex items-center gap-0.5 hover:text-foreground`,children:[`Session `,(0,H.jsx)(a,{className:`size-3`})]})]})]}),i&&!r?(0,H.jsx)(Qe,{item:e}):e.kind===`triage`?(0,H.jsx)(Xe,{item:e}):Z(e)?(0,H.jsx)(Je,{item:e}):(0,H.jsxs)(`div`,{className:`rounded-xl border border-border bg-card px-4 py-3`,children:[(0,H.jsx)(`h3`,{className:`text-[14px] font-medium`,children:e.title}),e.body&&(e.kind===`setup_change`?(0,H.jsx)(`div`,{className:`mt-2 text-[13px]`,children:(0,H.jsx)(N,{children:e.body})}):(0,H.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-[13px] leading-relaxed text-muted-foreground`,children:e.body})),e.kind===`pr_review`&&!r&&(0,H.jsx)(Y,{item:e}),!r&&(0,H.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:(0,H.jsx)(X,{item:e})}),r&&(0,H.jsxs)(`p`,{className:`mt-2 text-2xs text-status-done`,children:[`Resolved `,e.resolvedAt?A(e.resolvedAt):``,$e(e)&&` · ${$e(e)}`]})]})]})}var tt=[],nt=new Set([`all`,`asks`]),rt=[{id:`all`,label:`All`},{id:`asks`,label:`Needs an answer`},{id:`reviews`,label:`Reviews`},{id:`problems`,label:`Problems`}],it=e=>`${e} failed run${e===1?``:`s`}`;function at({items:e}){let t=q(it),n=V(e).dismiss;return n.length<2?null:(0,H.jsx)(k,{size:`sm`,variant:`ghost`,className:`ml-auto h-6 px-2 text-2xs text-muted-foreground`,onClick:()=>t.mutate(n),disabled:t.isPending,children:`Dismiss all`})}function ot(){return(0,H.jsxs)(`div`,{role:`status`,"aria-label":`Loading the inbox`,"aria-busy":!0,className:`space-y-5`,children:[(0,H.jsx)(P,{className:`h-3 w-28`}),(0,H.jsx)(P,{className:`h-24 w-full rounded-xl`}),(0,H.jsx)(P,{className:`h-24 w-full rounded-xl`}),(0,H.jsx)(P,{className:`h-24 w-full rounded-xl`})]})}function st({focusItemId:e}){let t=D(),{data:r}=oe(),i=r!==void 0,a=r?.inbox??tt,[o,s]=(0,R.useState)(`all`),c=n({queryKey:[`conflicts`],queryFn:()=>t.listConflicts()}),u=c.data??[],d=B(a,o),f=Ne(a,u.length),p=a.filter(e=>e.status!==`open`).slice(0,5),g=e=>i&&!(nt.has(e)&&c.isPending),_=nt.has(o),v=_&&u.length>0,y=d.length===0&&!v,b=!i||y&&_&&c.isPending?`loading`:y?_&&c.isError?`conflicts-error`:`empty`:`list`;(0,R.useEffect)(()=>{e&&s(`all`)},[e]);let x=e!==void 0&&[...b===`list`&&v?u.map(e=>e.id):[],...b===`list`?d.flatMap(e=>e.items.map(e=>e.id)):[],...p.map(e=>e.id)].includes(e);(0,R.useEffect)(()=>{if(!e||!x)return;let t=requestAnimationFrame(()=>document.getElementById($(e))?.scrollIntoView({block:`center`,behavior:`smooth`}));return()=>cancelAnimationFrame(t)},[e,x]);let S=b===`list`?d.flatMap(e=>e.items):tt,C=b===`list`&&v?u.map(e=>({id:e.id,title:`Already running: ${e.request.purpose}`})):[];return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(je,{icon:(0,H.jsx)(l,{}),title:`Inbox`,meta:g(`all`)?`${f.all} waiting on you`:`Loading…`,actions:(0,H.jsx)(ze,{items:S,alsoStaying:C})}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scroll-thin`,children:(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl px-4 py-5 sm:px-6 sm:py-6`,children:[(0,H.jsx)(`div`,{className:`mb-6 flex w-fit max-w-full flex-wrap items-center gap-1 rounded-lg border border-border bg-card/50 p-0.5 text-xs`,children:rt.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>s(e.id),className:L(`flex h-7 items-center gap-1.5 rounded-md px-2.5 whitespace-nowrap text-muted-foreground transition-colors hover:text-foreground pointer-coarse:h-10`,o===e.id&&`bg-accent text-foreground`),children:[e.label,g(e.id)&&(0,H.jsx)(`span`,{className:`text-3xs tabular-nums opacity-70`,children:f[e.id]})]},e.id))}),b===`loading`?(0,H.jsx)(ot,{}):b===`conflicts-error`?(0,H.jsx)(T,{icon:(0,H.jsx)(m,{}),title:`Couldn't check for merge conflicts`,className:`py-24`,action:(0,H.jsx)(k,{size:`sm`,variant:`outline`,onClick:()=>void c.refetch(),disabled:c.isFetching,children:`Try again`}),children:c.error?.message}):b===`empty`?(0,H.jsx)(T,{icon:(0,H.jsx)(h,{}),title:`You're all caught up`,className:`py-24`,children:`Questions, approvals, PRs ready for review and failed runs show up here.`}):(0,H.jsxs)(`div`,{className:`space-y-9`,children:[v&&(0,H.jsxs)(`section`,{children:[(0,H.jsxs)(w,{className:`mb-3`,children:[`Conflicts · `,u.length]}),(0,H.jsx)(`div`,{className:`space-y-4`,children:u.map(t=>(0,H.jsx)(`div`,{id:$(t.id),className:L(t.id===e&&`rounded-xl ring-2 ring-primary/50 ring-offset-4 ring-offset-background`),"data-focused":t.id===e||void 0,children:(0,H.jsx)(Ae,{conflict:t})},t.id))})]}),d.map(t=>(0,H.jsxs)(`section`,{children:[(0,H.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,H.jsxs)(w,{children:[t.title,` · `,t.items.length]}),t.id===`run_failed`&&(0,H.jsx)(at,{items:t.items})]}),(0,H.jsx)(`div`,{className:`space-y-5`,children:t.items.map(t=>(0,H.jsx)(et,{item:t,focused:t.id===e},t.id))})]},t.id))]}),p.length>0&&(0,H.jsxs)(`section`,{className:`mt-12`,children:[(0,H.jsx)(w,{className:`mb-3`,children:`Recently resolved`}),(0,H.jsx)(`div`,{className:`space-y-3`,children:p.map(t=>(0,H.jsx)(et,{item:t,focused:t.id===e},t.id))})]})]})})]})}export{st as InboxPage};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{F as t,t as n}from"./useQuery-VSotSwry.js";import{Ar as r,In as i,Or as a,P as o,Rn as s,Vn as c,Xt as l,ar as u,cn as d,gn as f,ht as p,m,mr as h,n as g,pr as _,q as v,rt as y,un as b,zn as x}from"./icons-COCLuOtb.js";import{n as S,t as C}from"./jsx-runtime-C3cWAN_r.js";import{o as w,t as T}from"./bits-B2GRjm37.js";import{R as E,Y as ee,dt as te,ft as ne,i as D,pt as re,v as ie}from"./api-yvn34iKU.js";import{D as ae,E as oe,O as se,S as ce,T as le,j as O,m as k,n as A,y as ue,yt as j}from"./format-D3kairnQ.js";import{C as de,S as fe,_ as pe,a as me,b as he,v as ge,w as _e,x as ve,y as ye}from"./mobile-nav-CrjrDJZ5.js";import{L as M,v as be}from"./dropdown-menu-Bflkx6wY.js";import{n as xe,t as Se}from"./question-card-ldxLXNS_.js";import{t as N}from"./markdown-DGHfubu-.js";import{t as P}from"./skeleton-D8Sbd2jT.js";import{d as F,o as I,r as Ce}from"./switch-BHplnCdo.js";import{t as L}from"./dist-wxbqfqV1.js";import{n as we}from"./spec-approval-CmC6QBSh.js";import"./spot-checks-CDZxwwu0.js";import{r as Te,s as Ee}from"./github-bits-BLf93Pkz.js";import{c as De,d as Oe}from"./logic-BTt00I9b.js";import{t as ke}from"./input-CPpbtC2H.js";import{t as Ae}from"./conflict-card-Bx8tT_d5.js";import{t as je}from"./page-header-t9HzSrxd.js";var R=e(S(),1),Me=[{id:`approval`,title:`Approvals`,filter:`asks`},{id:`question`,title:`Questions`,filter:`asks`},{id:`spec_approval`,title:`Specs to approve`,filter:`asks`},{id:`setup_change`,title:`Setup changes`,filter:`asks`},{id:`pr_review`,title:`Pull requests ready`,filter:`reviews`},{id:`spot_check`,title:`Spot-checks`,filter:`reviews`},{id:`run_failed`,title:`Failed runs`,filter:`problems`},{id:`cleanup_failed`,title:`Worktrees not removed`,filter:`problems`},{id:`triage`,title:`Triage decisions`,filter:`asks`},{id:`automation_result`,title:`Automation results`,filter:`reviews`},{id:`message`,title:`Messages`,filter:`reviews`}],z={high:0,normal:1,low:2};function B(e,t=`all`){let n=e.filter(e=>e.status===`open`);return Me.filter(e=>t===`all`||e.filter===t).map(e=>({id:e.id,title:e.title,items:n.filter(t=>t.kind===e.id).sort((e,t)=>z[e.priority]-z[t.priority]||Date.parse(t.createdAt)-Date.parse(e.createdAt))})).filter(e=>e.items.length>0)}function V(e){let t=[],n=[];for(let r of e)r.status===`open`&&(re(r)?n:t).push(r);return{dismiss:t,stay:n}}function Ne(e,t){let n=t=>B(e,t).reduce((e,t)=>e+t.items.length,0);return{all:n(`all`)+t,asks:n(`asks`)+t,reviews:n(`reviews`),problems:n(`problems`)}}var H=C(),U=1e4,Pe=5,Fe=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,W=e=>Fe(e,`notice`);function G(e){return e===1?`1 item that waits on you stays`:`${e} items that wait on you stay`}function Ie(e){return e>0?`${G(e)}.`:void 0}function Le(e){return/[.!?]$/.test(e)?e:`${e}.`}function K(e){let t=[];for(let n=0;n<e.length;n+=E)t.push(e.slice(n,n+E));return t}async function Re(e,t,n){let r=0;try{for(let n of K(t))r+=(await e.restoreInbox(n)).restored;O.success(`Restored ${n(r)}`)}catch(e){let t=r>0?`Restored ${n(r)}, then couldn't restore the rest`:`Couldn't undo the dismiss`;O.error(t,{description:e.message})}}function q(e){let t=D();return j({mutationFn:async e=>{let n={dismissed:0,ids:[],kept:0};for(let r of K(e.map(e=>e.id)))try{let e=await t.dismissInbox(r);n.dismissed+=e.dismissed,n.ids.push(...e.ids),n.kept+=e.kept}catch(e){if(n.ids.length===0)throw e;return{...n,error:e}}return n},onError:e=>O.error(`Couldn't dismiss them`,{description:e.message}),onSuccess:n=>{let r=Ie(n.kept);if(n.dismissed===0){O.warning(`Nothing was dismissed`,{description:r});return}let i={label:`Undo`,onClick:()=>void Re(t,n.ids,e)};if(n.error){let t=n.error.message;O.error(`Dismissed ${e(n.dismissed)}, then couldn't dismiss the rest`,{description:r?`${Le(t)} ${r}`:t,action:i,duration:U})}else O.success(`Dismissed ${e(n.dismissed)}`,{description:r,action:i,duration:U})}})}function ze({items:e,alsoStaying:t=[]}){let[n,r]=(0,R.useState)(!1),i=q(W),{dismiss:a,stay:o}=V(e),s=[...t,...o],c=a.length;if(c===0)return null;let l=s.slice(0,Pe),u=s.length-l.length;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{size:`sm`,variant:`ghost`,className:`text-muted-foreground`,title:`Dismiss the ${W(c)} in this view`,onClick:()=>r(!0),disabled:i.isPending,children:[(0,H.jsx)(h,{}),` Dismiss `,c]}),(0,H.jsx)(pe,{open:n,onOpenChange:r,children:(0,H.jsxs)(he,{children:[(0,H.jsxs)(de,{children:[(0,H.jsxs)(_e,{children:[`Dismiss `,W(c),`?`]}),(0,H.jsxs)(ve,{children:[W(c),` will be dismissed`,s.length>0?`; ${G(s.length)}.`:`.`,` You can undo it for a few seconds.`]})]}),l.length>0&&(0,H.jsxs)(`div`,{className:`min-w-0 text-[13px]`,"data-testid":`dismiss-staying`,children:[(0,H.jsx)(`div`,{className:`mb-1.5 text-2xs text-muted-foreground`,children:`Staying`}),(0,H.jsx)(`ul`,{className:`space-y-1`,children:l.map(e=>(0,H.jsx)(`li`,{className:`truncate`,children:e.title},e.id))}),u>0&&(0,H.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`and `,u,` more`]})]}),(0,H.jsxs)(fe,{children:[(0,H.jsx)(ye,{children:`Cancel`}),(0,H.jsxs)(ge,{onClick:()=>i.mutate(a),children:[`Dismiss `,c]})]})]})})]})}function Be(e,t){return!t||t.ready?null:{text:`${e} is ${De(t.reason??`Not ready`)}`,detail:t.detail,command:t.command}}function Ve({item:e,busy:t,dismissButton:n}){let i=D(),a=ce(e.sessionId??void 0)??null,o=ae(e=>e.runner.providers,[]),s=le({staleTime:6e4}).data?.checks,c=Be(o.find(e=>e.id===a?.provider)?.displayName??a?.provider??`Its provider`,a?Oe(a.provider,s):null),l=()=>a&&Ce.getState().setHandoff({sessionId:a.id,provider:null}),u=j({mutationFn:()=>i.retryInbox(e.id),onError:e=>O.error(`Retry failed`,{description:e.message,...e instanceof ie&&e.code===`provider_unavailable`&&a?{action:{label:`Continue on another provider`,onClick:l}}:{}}),onSuccess:()=>O.success(`Retrying`)}),d=ne(e);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{size:`sm`,onClick:()=>u.mutate(),disabled:t||u.isPending||c!==null,title:c?.text,children:[(0,H.jsx)(v,{}),` `,u.isPending?`Retrying…`:`Retry`]}),c&&a&&(0,H.jsxs)(k,{size:`sm`,variant:`outline`,onClick:l,children:[(0,H.jsx)(r,{}),` Continue on another provider`]}),n,d>1&&(0,H.jsxs)(`span`,{className:`text-2xs text-muted-foreground`,children:[`Failed `,d,` times`]}),c&&(0,H.jsxs)(`p`,{className:`w-full text-2xs text-status-failed`,"data-testid":`retry-blocked`,title:c.detail??void 0,children:[`Retry is off: `,c.text,`.`,c.command&&(0,H.jsxs)(H.Fragment,{children:[` `,`Fix it with `,(0,H.jsx)(`code`,{className:`font-mono`,children:c.command}),`.`]})]})]})}var J=e=>e.projectId&&e.pr?ee(e.projectId,e.pr.number):null;function Y({item:e}){let t=D(),r=J(e),{data:i}=n({queryKey:[`github`,`pr`,r],queryFn:()=>t.github.pr(r??``),enabled:!!r});return i?(0,H.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-2xs text-muted-foreground`,children:[(0,H.jsx)(Te,{checks:i.checks}),(0,H.jsx)(Ee,{decision:i.reviewDecision}),(0,H.jsxs)(`span`,{className:`text-diff-add`,children:[`+`,i.additions]}),(0,H.jsxs)(`span`,{className:`text-diff-del`,children:[`−`,i.deletions]}),(0,H.jsxs)(`span`,{children:[i.files.length,` files`]}),i.mergeable===`conflicting`&&(0,H.jsx)(`span`,{className:`text-status-failed`,children:`Merge conflicts`})]}):null}function X({item:e}){let n=D(),r=t(),i=F(),a=be(e=>e.openRightTab),o=e=>O.error(`Couldn't update the item`,{description:e.message}),s=j({mutationFn:()=>n.resolveInbox(e.id,{status:`dismissed`}),onError:o,onSuccess:()=>O.success(`Dismissed`)}),l=j({mutationFn:()=>n.resolveInbox(e.id,{status:`resolved`}),onError:o,onSuccess:()=>O.success(`New worktrees run these setup commands from now on`)}),u=j({mutationFn:async()=>{let t=J(e);if(!t)throw Error(`This item has no pull request`);let r=await n.github.merge(t,{method:`squash`});if(!r.merged)throw Error(`GitHub did not merge the pull request`);return r},onError:e=>O.error(`Couldn't merge`,{description:e.message}),onSuccess:()=>{O.success(`Merged #${e.pr?.number}`),r.invalidateQueries({queryKey:[`github`]})}}),f=j({mutationFn:async t=>{if(!e.sessionId)throw Error(`This item has no session`);return n.archiveSession(e.sessionId,{force:t})},onError:o,onSuccess:e=>{let{status:t,message:n,unpushed:r}=e.worktree;t===`removed`?O.success(r?`Container deleted`:`Worktree removed`,{description:n??void 0}):t===`kept_changes`&&r?O.warning(`The container was kept: it holds work that isn't pushed`,{description:[n,`Delete anyway deletes this work for good.`].filter(Boolean).join(`. `),action:{label:`Delete anyway`,onClick:()=>f.mutate(!0)},duration:2e4}):O.error(`Couldn't remove the worktree`,{description:n??void 0})}}),p=s.isPending||u.isPending||f.isPending||l.isPending,m=(0,H.jsx)(k,{size:`sm`,variant:`ghost`,className:`text-muted-foreground`,onClick:()=>s.mutate(),disabled:p,children:`Dismiss`});switch(e.kind){case`pr_review`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{size:`sm`,onClick:()=>u.mutate(),disabled:p||!J(e),children:[(0,H.jsx)(b,{}),` `,u.isPending?`Merging…`:`Merge`]}),(0,H.jsxs)(k,{size:`sm`,variant:`outline`,onClick:()=>{e.sessionId?(a(`github`),i({to:`/sessions/$sessionId`,params:{sessionId:e.sessionId}})):e.pr&&I.openExternal(e.pr.url)},children:[(0,H.jsx)(d,{}),` Open PR`]}),e.pr&&(0,H.jsxs)(k,{size:`sm`,variant:`ghost`,onClick:()=>e.pr&&I.openExternal(e.pr.url),children:[(0,H.jsx)(c,{}),` GitHub`]})]});case`run_failed`:return(0,H.jsx)(Ve,{item:e,busy:p,dismissButton:m});case`cleanup_failed`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{size:`sm`,onClick:()=>f.mutate(!1),disabled:p,children:[(0,H.jsx)(v,{}),` `,f.isPending?`Removing…`:`Try again`]}),m]});case`spot_check`:return(0,H.jsxs)(H.Fragment,{children:[e.projectId&&(0,H.jsxs)(k,{size:`sm`,onClick:()=>void i({to:`/projects/$projectId`,params:{projectId:e.projectId},hash:`spot-checks`}),children:[(0,H.jsx)(x,{}),` Open spot-checks`]}),m]});case`setup_change`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{size:`sm`,onClick:()=>l.mutate(),disabled:p,children:[(0,H.jsx)(y,{}),` `,l.isPending?`Allowing…`:`Run them`]}),(0,H.jsx)(k,{size:`sm`,variant:`ghost`,onClick:()=>s.mutate(),disabled:p,children:`Don't run`})]});case`automation_result`:case`message`:return m;default:return null}}var He=`inbox:factory-digest:`,Ue=`inbox:factory-escalated:`,We=`inbox:factory-spec:`;function Z(e){return e.id.startsWith(He)?`digest`:e.id.startsWith(Ue)?`escalated`:e.id.startsWith(We)?`spec`:null}function Q({icon:e,label:t,tone:n}){return(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b px-4 py-2 text-2xs ${n}`,children:[e,(0,H.jsx)(`span`,{className:`font-semibold tracking-wider uppercase`,children:t})]})}function Ge({item:e}){let t=D(),n=e.status===`open`,r=j({mutationFn:()=>t.resolveInbox(e.id,{status:`resolved`}),onSuccess:()=>O.success(`Digest read`)});return(0,H.jsxs)(`div`,{className:`rounded-xl border border-border bg-card`,"data-testid":`factory-digest`,children:[(0,H.jsx)(Q,{icon:(0,H.jsx)(p,{className:`size-3.5`}),label:`Factory digest`,tone:`border-border text-muted-foreground`}),(0,H.jsxs)(`div`,{className:`space-y-3 px-4 py-3`,children:[(0,H.jsx)(`h3`,{className:`text-[14px] font-medium`,children:e.title.replace(/^Factory digest: /,``)}),e.body&&(0,H.jsx)(`div`,{className:`max-h-80 overflow-y-auto rounded-lg border border-border bg-surface px-3 py-2 text-[13px] scroll-thin`,children:(0,H.jsx)(N,{children:e.body})}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[e.projectId&&(0,H.jsx)(k,{size:`sm`,variant:`outline`,asChild:!0,children:(0,H.jsxs)(M,{to:`/projects/$projectId`,params:{projectId:e.projectId},children:[(0,H.jsx)(s,{}),` Factory panel`]})}),n&&(0,H.jsx)(k,{size:`sm`,variant:`ghost`,onClick:()=>r.mutate(),disabled:r.isPending,children:`Mark read`})]})]})]})}function Ke({item:e}){let t=e.id.slice(24),n=e.status===`open`;return(0,H.jsxs)(`div`,{className:`rounded-xl border border-status-waiting/35 bg-card`,"data-testid":`factory-escalation`,children:[(0,H.jsx)(Q,{icon:(0,H.jsx)(o,{className:`size-3.5`}),label:`Protected area · needs you`,tone:`border-status-waiting/20 bg-status-waiting/[0.06] text-status-waiting`}),(0,H.jsxs)(`div`,{className:`space-y-3 px-4 py-3`,children:[(0,H.jsx)(`h3`,{className:`text-[14px] font-medium`,children:e.title.replace(/^Factory PR needs you: /,``)}),e.body&&(0,H.jsx)(`p`,{className:`text-[13px] leading-relaxed text-muted-foreground`,children:e.body}),n&&(0,H.jsx)(Y,{item:e}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[n&&(0,H.jsx)(X,{item:e}),e.projectId&&(0,H.jsx)(k,{size:`sm`,variant:`ghost`,asChild:!0,children:(0,H.jsx)(M,{to:`/projects/$projectId/factory/$itemId`,params:{projectId:e.projectId,itemId:t},children:`Merge checks`})})]})]})]})}function qe({item:e}){let t=e.id.slice(19),n=e.status===`open`;return(0,H.jsxs)(`div`,{className:`rounded-xl border border-status-waiting/35 bg-card`,"data-testid":`factory-spec-approval`,children:[(0,H.jsx)(Q,{icon:(0,H.jsx)(i,{className:`size-3.5`}),label:`Spec to approve · needs you`,tone:`border-status-waiting/20 bg-status-waiting/[0.06] text-status-waiting`}),(0,H.jsxs)(`div`,{className:`space-y-3 px-4 py-3`,children:[(0,H.jsx)(`h3`,{className:`text-[14px] font-medium`,children:e.title.replace(/^Approve the spec: /,``)}),e.body&&(0,H.jsx)(`div`,{className:`max-h-80 overflow-y-auto rounded-lg border border-border bg-surface px-3 py-2 text-[13px] scroll-thin`,children:(0,H.jsx)(N,{children:e.body})}),n&&e.projectId&&(0,H.jsx)(we,{projectId:e.projectId,itemId:t,version:e.updatedAt,compact:!0}),e.projectId&&(0,H.jsx)(k,{size:`sm`,variant:`ghost`,asChild:!0,children:(0,H.jsx)(M,{to:`/projects/$projectId/factory/$itemId`,params:{projectId:e.projectId,itemId:t},children:`Open the work item`})})]})]})}function Je({item:e}){let t=Z(e);return t===`digest`?(0,H.jsx)(Ge,{item:e}):t===`spec`?(0,H.jsx)(qe,{item:e}):(0,H.jsx)(Ke,{item:e})}function Ye(e){return e.title.replace(/^Should I take this on\?\s*/,``)||e.title}function Xe({item:e}){let n=D(),r=t(),i=F(),[a,o]=(0,R.useState)(!1),[s,l]=(0,R.useState)(``),d=e.status===`open`,p=e=>O.error(`Couldn't record the decision`,{description:e.message}),m=j({mutationFn:()=>n.automations.acceptTriage(e.id),onSuccess:e=>{let t=e.start;if(t?.status===`conflict`){r.invalidateQueries({queryKey:[`conflicts`]}),O.warning(`Matching work is already running`,{description:`Decide on the conflict card in your inbox.`});return}let n=t&&`sessionId`in t?t.sessionId:null;O.success(t?.status===`queued`?`Queued behind running work`:`Taking it on`,{action:n?{label:`Open session`,onClick:()=>void i({to:`/sessions/$sessionId`,params:{sessionId:n}})}:void 0})},onError:p}),h=j({mutationFn:()=>n.automations.declineTriage(e.id,s.trim()?{reason:s.trim()}:{}),onSuccess:()=>O.success(`Declined; the issue keeps its triage labels`),onError:p}),v=m.isPending||h.isPending;return(0,H.jsxs)(`div`,{className:`rounded-xl border border-border bg-card`,"data-testid":`triage-card`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-4 py-2 text-2xs`,children:[(0,H.jsx)(f,{className:`size-3.5 text-primary`}),(0,H.jsx)(`span`,{className:`font-semibold tracking-wider text-primary uppercase`,children:`Should I take this on?`}),(0,H.jsx)(`span`,{className:`ml-auto rounded-full bg-status-done/12 px-2 py-px font-medium text-status-done`,"data-testid":`triage-classification`,title:`The PM's triage classification`,children:`PM: Ready`})]}),(0,H.jsxs)(`div`,{className:`space-y-3 px-4 py-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,H.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-status-done`}),(0,H.jsx)(`h3`,{className:`min-w-0 flex-1 text-[14px] font-medium`,children:Ye(e)}),e.issue&&(0,H.jsxs)(k,{size:`xs`,variant:`ghost`,className:`shrink-0 text-muted-foreground`,onClick:()=>e.issue&&I.openExternal(e.issue.url),children:[(0,H.jsx)(c,{}),` Issue`]})]}),e.body&&(0,H.jsxs)(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-3xs font-medium tracking-wider text-muted-foreground uppercase`,children:`PM's rationale`}),(0,H.jsx)(`p`,{className:`mt-1 text-[13px] leading-relaxed`,"data-testid":`triage-rationale`,children:e.body})]}),d?a?(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(ke,{autoFocus:!0,value:s,onChange:e=>l(e.target.value),placeholder:`Why not? (optional, kept with the decision)`,"aria-label":`Reason to decline`,className:`h-8 text-[13px]`}),(0,H.jsx)(k,{size:`sm`,variant:`destructive`,disabled:v,onClick:()=>h.mutate(),children:`Decline`}),(0,H.jsx)(k,{size:`sm`,variant:`ghost`,onClick:()=>o(!1),children:`Cancel`})]}):(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,H.jsxs)(k,{size:`sm`,onClick:()=>m.mutate(),disabled:v,children:[(0,H.jsx)(_,{}),` `,m.isPending?`Starting…`:`Take it on`]}),(0,H.jsxs)(k,{size:`sm`,variant:`ghost`,className:`text-muted-foreground`,onClick:()=>o(!0),disabled:v,children:[(0,H.jsx)(g,{}),` Decline…`]}),(0,H.jsx)(`span`,{className:`ml-auto text-3xs text-muted-foreground`,children:`Take it on starts an agent session for the issue`})]}):(0,H.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:e.status===`resolved`?`Accepted`:`Declined`})]})]})}function Ze(e,t){let n=e.items[t];if(!n)return;let r=e.threads[n.threadId]?.itemIds??[];for(let i=r.indexOf(t)-1;i>=0;i--){let t=e.items[r[i]??``];if(!t||t.turnId!==n.turnId)return;if(t.item.kind===`plan`)return t.item.text}}function Qe({item:e}){let{transcript:t}=se(e.sessionId??void 0,{turns:1,...e.itemId?{item:e.itemId}:{}}),n=e.itemId?t?.items[e.itemId]?.item:void 0;if(!e.sessionId)return null;if(!t)return(0,H.jsx)(P,{className:`h-24 w-full rounded-xl`});if(n?.kind===`approval_request`){let r=n.action===`plan`&&e.itemId?Ze(t,e.itemId):void 0;return(0,H.jsx)(xe,{item:n,sessionId:e.sessionId,compact:!0,plan:r})}return n?.kind===`user_question`?(0,H.jsx)(Se,{item:n,sessionId:e.sessionId}):(0,H.jsxs)(`div`,{className:`rounded-xl border border-border bg-card px-4 py-3`,children:[(0,H.jsx)(`h3`,{className:`text-[14px] font-medium`,children:e.title}),e.body&&(0,H.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:e.body})]})}function $e(e){let t=te.safeParse(e.resolution);return t.success?t.data.note:null}function $(e){return`inbox-item-${e}`}function et({item:e,focused:t=!1}){let n=ue(e.projectId),r=e.status!==`open`,i=e.kind===`approval`||e.kind===`question`;return(0,H.jsxs)(`article`,{id:$(e.id),className:L(r?`opacity-60`:`animate-rise`,t&&`rounded-xl ring-2 ring-primary/50 ring-offset-4 ring-offset-background`),"data-kind":e.kind,"data-focused":t||void 0,children:[(0,H.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2 text-2xs text-muted-foreground`,children:[n&&(0,H.jsx)(me,{project:n}),(0,H.jsx)(`span`,{children:n?.name??`Global`}),(0,H.jsx)(`span`,{className:`text-muted-foreground/40`,children:`·`}),(0,H.jsx)(`span`,{children:A(e.createdAt)}),e.priority===`high`&&(0,H.jsx)(`span`,{className:`rounded-full bg-status-failed/12 px-1.5 text-3xs font-medium text-status-failed`,children:`high`}),(0,H.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[e.issue&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>e.issue&&I.openExternal(e.issue.url),className:`flex items-center gap-1 hover:text-foreground`,children:[(0,H.jsx)(u,{className:`size-3 text-status-done`}),`#`,e.issue.number]}),e.pr&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>e.pr&&I.openExternal(e.pr.url),className:`flex items-center gap-1 hover:text-foreground`,children:[(0,H.jsx)(d,{className:`size-3 text-status-done`}),`#`,e.pr.number]}),e.sessionId&&(0,H.jsxs)(M,{to:`/sessions/$sessionId`,params:{sessionId:e.sessionId},className:`flex items-center gap-0.5 hover:text-foreground`,children:[`Session `,(0,H.jsx)(a,{className:`size-3`})]})]})]}),i&&!r?(0,H.jsx)(Qe,{item:e}):e.kind===`triage`?(0,H.jsx)(Xe,{item:e}):Z(e)?(0,H.jsx)(Je,{item:e}):(0,H.jsxs)(`div`,{className:`rounded-xl border border-border bg-card px-4 py-3`,children:[(0,H.jsx)(`h3`,{className:`text-[14px] font-medium`,children:e.title}),e.body&&(e.kind===`setup_change`?(0,H.jsx)(`div`,{className:`mt-2 text-[13px]`,children:(0,H.jsx)(N,{children:e.body})}):(0,H.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-[13px] leading-relaxed text-muted-foreground`,children:e.body})),e.kind===`pr_review`&&!r&&(0,H.jsx)(Y,{item:e}),!r&&(0,H.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:(0,H.jsx)(X,{item:e})}),r&&(0,H.jsxs)(`p`,{className:`mt-2 text-2xs text-status-done`,children:[`Resolved `,e.resolvedAt?A(e.resolvedAt):``,$e(e)&&` · ${$e(e)}`]})]})]})}var tt=[],nt=new Set([`all`,`asks`]),rt=[{id:`all`,label:`All`},{id:`asks`,label:`Needs an answer`},{id:`reviews`,label:`Reviews`},{id:`problems`,label:`Problems`}],it=e=>`${e} failed run${e===1?``:`s`}`;function at({items:e}){let t=q(it),n=V(e).dismiss;return n.length<2?null:(0,H.jsx)(k,{size:`sm`,variant:`ghost`,className:`ml-auto h-6 px-2 text-2xs text-muted-foreground`,onClick:()=>t.mutate(n),disabled:t.isPending,children:`Dismiss all`})}function ot(){return(0,H.jsxs)(`div`,{role:`status`,"aria-label":`Loading the inbox`,"aria-busy":!0,className:`space-y-5`,children:[(0,H.jsx)(P,{className:`h-3 w-28`}),(0,H.jsx)(P,{className:`h-24 w-full rounded-xl`}),(0,H.jsx)(P,{className:`h-24 w-full rounded-xl`}),(0,H.jsx)(P,{className:`h-24 w-full rounded-xl`})]})}function st({focusItemId:e}){let t=D(),{data:r}=oe(),i=r!==void 0,a=r?.inbox??tt,[o,s]=(0,R.useState)(`all`),c=n({queryKey:[`conflicts`],queryFn:()=>t.listConflicts()}),u=c.data??[],d=B(a,o),f=Ne(a,u.length),p=a.filter(e=>e.status!==`open`).slice(0,5),g=e=>i&&!(nt.has(e)&&c.isPending),_=nt.has(o),v=_&&u.length>0,y=d.length===0&&!v,b=!i||y&&_&&c.isPending?`loading`:y?_&&c.isError?`conflicts-error`:`empty`:`list`;(0,R.useEffect)(()=>{e&&s(`all`)},[e]);let x=e!==void 0&&[...b===`list`&&v?u.map(e=>e.id):[],...b===`list`?d.flatMap(e=>e.items.map(e=>e.id)):[],...p.map(e=>e.id)].includes(e);(0,R.useEffect)(()=>{if(!e||!x)return;let t=requestAnimationFrame(()=>document.getElementById($(e))?.scrollIntoView({block:`center`,behavior:`smooth`}));return()=>cancelAnimationFrame(t)},[e,x]);let S=b===`list`?d.flatMap(e=>e.items):tt,C=b===`list`&&v?u.map(e=>({id:e.id,title:`Already running: ${e.request.purpose}`})):[];return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(je,{icon:(0,H.jsx)(l,{}),title:`Inbox`,meta:g(`all`)?`${f.all} waiting on you`:`Loading…`,actions:(0,H.jsx)(ze,{items:S,alsoStaying:C})}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scroll-thin`,children:(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl px-4 py-5 sm:px-6 sm:py-6`,children:[(0,H.jsx)(`div`,{className:`mb-6 flex w-fit max-w-full flex-wrap items-center gap-1 rounded-lg border border-border bg-card/50 p-0.5 text-xs`,children:rt.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>s(e.id),className:L(`flex h-7 items-center gap-1.5 rounded-md px-2.5 whitespace-nowrap text-muted-foreground transition-colors hover:text-foreground pointer-coarse:h-10`,o===e.id&&`bg-accent text-foreground`),children:[e.label,g(e.id)&&(0,H.jsx)(`span`,{className:`text-3xs tabular-nums opacity-70`,children:f[e.id]})]},e.id))}),b===`loading`?(0,H.jsx)(ot,{}):b===`conflicts-error`?(0,H.jsx)(T,{icon:(0,H.jsx)(m,{}),title:`Couldn't check for merge conflicts`,className:`py-24`,action:(0,H.jsx)(k,{size:`sm`,variant:`outline`,onClick:()=>void c.refetch(),disabled:c.isFetching,children:`Try again`}),children:c.error?.message}):b===`empty`?(0,H.jsx)(T,{icon:(0,H.jsx)(h,{}),title:`You're all caught up`,className:`py-24`,children:`Questions, approvals, PRs ready for review and failed runs show up here.`}):(0,H.jsxs)(`div`,{className:`space-y-9`,children:[v&&(0,H.jsxs)(`section`,{children:[(0,H.jsxs)(w,{className:`mb-3`,children:[`Conflicts · `,u.length]}),(0,H.jsx)(`div`,{className:`space-y-4`,children:u.map(t=>(0,H.jsx)(`div`,{id:$(t.id),className:L(t.id===e&&`rounded-xl ring-2 ring-primary/50 ring-offset-4 ring-offset-background`),"data-focused":t.id===e||void 0,children:(0,H.jsx)(Ae,{conflict:t})},t.id))})]}),d.map(t=>(0,H.jsxs)(`section`,{children:[(0,H.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,H.jsxs)(w,{children:[t.title,` · `,t.items.length]}),t.id===`run_failed`&&(0,H.jsx)(at,{items:t.items})]}),(0,H.jsx)(`div`,{className:`space-y-5`,children:t.items.map(t=>(0,H.jsx)(et,{item:t,focused:t.id===e},t.id))})]},t.id))]}),p.length>0&&(0,H.jsxs)(`section`,{className:`mt-12`,children:[(0,H.jsx)(w,{className:`mb-3`,children:`Recently resolved`}),(0,H.jsx)(`div`,{className:`space-y-3`,children:p.map(t=>(0,H.jsx)(et,{item:t,focused:t.id===e},t.id))})]})]})})]})}export{st as InboxPage};
|