mastra 1.40.2-alpha.8 → 1.40.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/factory/assets/{AlertDialog.es-Dd0j0SAo.js → AlertDialog.es-Dkf8ZLsq.js} +1 -1
- package/dist/factory/assets/BoardConfigPage-CbGjRoKd.js +1 -0
- package/dist/factory/assets/{BoardIcons-BZwAAPO8.js → BoardIcons-ChSrt-Ky.js} +1 -1
- package/dist/factory/assets/BoardIntakePage-lNVbdWDh.js +1 -0
- package/dist/factory/assets/BoardRulesPage-DWDWpS0z.js +1 -0
- package/dist/factory/assets/{Breadcrumb.es-CVW-e0jJ.js → Breadcrumb.es-DRA_fT-0.js} +1 -1
- package/dist/factory/assets/{Card-C1AF3dS4-gxDCT3SZ.js → Card-C1AF3dS4-D5nc4nsO.js} +1 -1
- package/dist/factory/assets/CodeBlock.es-CSnUNCvE.js +6 -0
- package/dist/factory/assets/{CodeEditor-DKVZX8c1-D3tFx8Wi.js → CodeEditor-DE69mZsU-DhkPbKOd.js} +1 -1
- package/dist/factory/assets/{Command.es-DYk0Ffqt.js → Command.es-CJWc6UXm.js} +1 -1
- package/dist/factory/assets/{CompositeItem-CSfZykYZ.js → CompositeItem-DXJX9-KR.js} +1 -1
- package/dist/factory/assets/{CompositeRoot-BDBckJr1.js → CompositeRoot-COSYbRmu.js} +1 -1
- package/dist/factory/assets/ConditionRows-mhryClJA.js +1 -0
- package/dist/factory/assets/CreateFactoryPage-BJVsA5mX.js +1 -0
- package/dist/factory/assets/{DescriptionMarkdown-CPlbpMmD.js → DescriptionMarkdown-iotpUxXF.js} +1 -1
- package/dist/factory/assets/{FactorySkillPage-KcjxsEs4.js → FactorySkillPage-D9qzT8bU.js} +3 -3
- package/dist/factory/assets/{FactorySkillsPage-7FrLl5uh.js → FactorySkillsPage-PMfXgYDo.js} +1 -1
- package/dist/factory/assets/{Field.es-C1w4lsXS.js → Field.es-BgoAtL-2.js} +1 -1
- package/dist/factory/assets/GithubIcon-CAP9GMMO.css +1 -0
- package/dist/factory/assets/GithubIcon.es-CIm0nGDf.js +55 -0
- package/dist/factory/assets/{HrefLink-y54gg66e.js → HrefLink-1sjfHRy7.js} +1 -1
- package/dist/factory/assets/{IconArrowRotateClockwise.es-DeFmTuQG.js → IconArrowRotateClockwise.es-INXo4MVi.js} +1 -1
- package/dist/factory/assets/{IconFormCircle.es-Dl8N58Cl.js → IconFormCircle.es-DNm0NK7A.js} +1 -1
- package/dist/factory/assets/IconLoadingCircle.es-Cj4Y7rb5.js +1 -0
- package/dist/factory/assets/{IconPencil.es-DqPc7VYz.js → IconPencil.es-DLEsNj2e.js} +1 -1
- package/dist/factory/assets/{IconScript.es-D3hL2fC9.js → IconScript.es-CPO1Fq6Z.js} +1 -1
- package/dist/factory/assets/{IconSettingsSliderHor.es-CWhsvZzL.js → IconSettingsSliderHor.es-VS_Cfpz8.js} +1 -1
- package/dist/factory/assets/{Input-BWp76snh.js → Input-9DXuotFV.js} +1 -1
- package/dist/factory/assets/{InputNumber.es-DuTGd35f.js → InputNumber.es-Bho-MKtp.js} +1 -1
- package/dist/factory/assets/KnowledgePage-CmdlrOqT.js +13 -0
- package/dist/factory/assets/{LoadErrorState-B6WrspsB.js → LoadErrorState-w5i-jqQO.js} +1 -1
- package/dist/factory/assets/{MarkdownRenderer-Dp2g3gxh-CfibLUrr.js → MarkdownRenderer-Ca7UVGTG-D9IuJEv9.js} +1 -1
- package/dist/factory/assets/MastraGatewayBilling-D2xarOnv.js +1 -0
- package/dist/factory/assets/{NewBoardPage-CZSKsKqc.js → NewBoardPage-Co58G3u-.js} +2 -2
- package/dist/factory/assets/{NewPage-B2FRg0re.js → NewPage-B4lBGEFC.js} +1 -1
- package/dist/factory/assets/{OnboardingPage-D3oyT1ph.js → OnboardingPage-D1AJcuIq.js} +1 -1
- package/dist/factory/assets/{ProviderBrandIcon-DG3b_E_A.js → ProviderBrandIcon-CKq3WaGZ.js} +1 -1
- package/dist/factory/assets/{RadioGroup-B980sx1z.js → RadioGroup-CvTRwRir.js} +1 -1
- package/dist/factory/assets/{RadioGroup.es-BfW3ErPZ.js → RadioGroup.es-DQfIiNtD.js} +1 -1
- package/dist/factory/assets/RootGuards-CZvggXIb.js +1 -0
- package/dist/factory/assets/{RulesPage-X6M3Ywua.js → RulesPage-Bu80TWNE.js} +1 -1
- package/dist/factory/assets/{SearchInput.es-B6oIv0hQ.js → SearchInput.es-BRVlUePH.js} +1 -1
- package/dist/factory/assets/SessionLayout-DeleDrJs.js +4 -0
- package/dist/factory/assets/SessionPage-BAz6O4wl.js +1 -0
- package/dist/factory/assets/SessionSharingPopover-CX69d1UJ.js +1 -0
- package/dist/factory/assets/SettingsPage-9wgvYj6_.js +3 -0
- package/dist/factory/assets/{SettingsSubsection-B_X_u0Kt.js → SettingsSubsection-D1Yp4Ujt.js} +1 -1
- package/dist/factory/assets/Sidebar.es-B464rGRm.js +1 -0
- package/dist/factory/assets/{SignInPage-BloSA2lI.js → SignInPage-BBl3lfcN.js} +1 -1
- package/dist/factory/assets/{SkillBadges-IJt3Rano.js → SkillBadges-DuFvl4d8.js} +1 -1
- package/dist/factory/assets/{SlackConnectionPage-CPfQws3c.js → SlackConnectionPage-6H6OccOz.js} +1 -1
- package/dist/factory/assets/{StackedDiffs-BlNEFzj-.js → StackedDiffs-DtoTOL9C.js} +1 -1
- package/dist/factory/assets/{TabsRoot-DNjGHnQQ.js → TabsRoot-MM_4fh4A.js} +1 -1
- package/dist/factory/assets/{ThinkingLevel.es-DUHMUmiq.js → ThinkingLevel.es-Q1cgMAQj.js} +1 -1
- package/dist/factory/assets/{Tree-B90XgTY4-DiRKznbx.js → Tree-B90XgTY4-DvEdNAwi.js} +1 -1
- package/dist/factory/assets/{buttons-group-DA_wORqQ-87uBfszt.js → buttons-group-DA_wORqQ-tI0OhQlr.js} +1 -1
- package/dist/factory/assets/combobox-parts-BVuRAhY6-ClaPtI8E.js +1 -0
- package/dist/factory/assets/{copy-button-BPysC9gu-Ce9_m0Wu.js → copy-button-C3L1ZoAD-DpbBeGOv.js} +1 -1
- package/dist/factory/assets/{esm-KJWZ33y-.js → esm-C7YFnOq6.js} +1 -1
- package/dist/factory/assets/index-Btp5jnxM.js +125 -0
- package/dist/factory/assets/index-CK3K8ZRd.css +1 -0
- package/dist/factory/assets/{input-DqReKX0A-ScC7s6sY.js → input-DqReKX0A-D66C6dWr.js} +3 -3
- package/dist/factory/assets/{input-group-C64rGEu8-tF1AZfiZ.js → input-group-BXqgO3Q2-BNrm-udR.js} +1 -1
- package/dist/factory/assets/{onboardingFlow-DTVR_ThV.js → onboardingFlow-C89nSzO4.js} +1 -1
- package/dist/factory/assets/relative-time.es-2U7OUie-.js +1 -0
- package/dist/factory/assets/{ruleLanes-zac0HQwn.js → ruleLanes-CB6XWPZ9.js} +1 -1
- package/dist/factory/assets/{select-jT0h_BBB-6ji8g_rW.js → select-BPzTS5dZ-BGYcBcgg.js} +1 -1
- package/dist/factory/assets/{settings-C5r2ThW9-D7BpEINa.js → settings-C5r2ThW9-DgHKaQxx.js} +1 -1
- package/dist/factory/assets/{use-keydown.es-Celupa-_.js → use-keydown.es-BFnOTORr.js} +1 -1
- package/dist/factory/assets/{useBoardCatalog-C-gXjA-g.js → useBoardCatalog-DC55UfJd.js} +1 -1
- package/dist/factory/assets/{useBoardEditor-Bn11vS5Q.js → useBoardEditor-DFyQuLCD.js} +1 -1
- package/dist/factory/assets/{useChatSessionContext-CAxNkdHm.js → useChatSessionContext--lCmFMPT.js} +1 -1
- package/dist/factory/assets/useDraftModelGuards-BRcs4Wdl.js +29 -0
- package/dist/factory/assets/{useFactoryDecisions-600qQ62i.js → useFactoryDecisions-O_sajSic.js} +1 -1
- package/dist/factory/assets/{useGlobalSearchControls-CDvuBRkd.js → useGlobalSearchControls-BOmC11Gr.js} +1 -1
- package/dist/factory/assets/{useInfiniteQuery-BqXR1JQ-.js → useInfiniteQuery-D1T5yb8L.js} +1 -1
- package/dist/factory/assets/{useIntakeRoutes-OObHoZos.js → useIntakeRoutes-C2h717K6.js} +1 -1
- package/dist/factory/assets/{useLinearData-Bbyd0L4b.js → useLinearData-D6cSKZs3.js} +1 -1
- package/dist/factory/assets/{useRouteSessionId-0WFT82oQ.js → useRouteSessionId-BYStxtYL.js} +1 -1
- package/dist/factory/assets/{useRowDrag-0taus7Yi.js → useRowDrag-B2rvWAzw.js} +1 -1
- package/dist/factory/assets/{useSessionCard-bQ1xW_Go.js → useSessionCard-mjrTpVMe.js} +1 -1
- package/dist/factory/assets/{useSessionRepository-Bw24ik7O.js → useSessionRepository-CCb1tcZg.js} +1 -1
- package/dist/factory/assets/{useSessionRows-CnLoToLZ.js → useSessionRows-CIakAaqj.js} +1 -1
- package/dist/factory/assets/{useThreadWorkspacePath-BZmjtdux.js → useThreadWorkspacePath-BmtxcrV6.js} +1 -1
- package/dist/factory/assets/workspaces-DYc-hvkC.js +2 -0
- package/dist/factory/index.html +44 -46
- package/dist/index.js +1 -1
- package/dist/studio/assets/{index-CzTSJmoH.js → index-y7atQeWR.js} +2 -2
- package/dist/studio/assets/{main-cRrOk30z.js → main-BhWoo2De.js} +263 -260
- package/dist/studio/assets/style-CLhrNGTk.css +3 -0
- package/dist/studio/index.html +2 -2
- package/package.json +7 -7
- package/dist/factory/assets/BoardConfigPage-CxuB8oe8.js +0 -1
- package/dist/factory/assets/BoardIntakePage-CsKxBduq.js +0 -1
- package/dist/factory/assets/BoardRulesPage-6fKznTV0.js +0 -1
- package/dist/factory/assets/CodeBlock.es-BJ0-aeYG.js +0 -6
- package/dist/factory/assets/ConditionRows-gvlUEEY7.js +0 -1
- package/dist/factory/assets/CreateFactoryPage-CTflXXet.js +0 -1
- package/dist/factory/assets/GithubIcon-C0PmZadW.css +0 -1
- package/dist/factory/assets/GithubIcon.es-BmZS8JQG.js +0 -55
- package/dist/factory/assets/KnowledgePage-B7yyr3vo.js +0 -13
- package/dist/factory/assets/MastraGatewayBilling-CeKTtQZ3.js +0 -1
- package/dist/factory/assets/RootGuards-BNlIx3jH.js +0 -1
- package/dist/factory/assets/SessionLayout-DAfEeZWD.js +0 -4
- package/dist/factory/assets/SessionPage-BXT65bS8.js +0 -1
- package/dist/factory/assets/SessionSharingPopover-DRKk_u9-.js +0 -1
- package/dist/factory/assets/SettingsPage-tkiXsO19.js +0 -3
- package/dist/factory/assets/Sidebar.es-CFLW5bYW.js +0 -1
- package/dist/factory/assets/combobox-parts-DhYtFSRV-BZqyW5dv.js +0 -1
- package/dist/factory/assets/index-B4UKgiu6.css +0 -1
- package/dist/factory/assets/index-C7vLhvAL.js +0 -125
- package/dist/factory/assets/relative-time.es-DP-qvaLv.js +0 -1
- package/dist/factory/assets/spinner-B9ykw74u-DYljVQkq.js +0 -1
- package/dist/factory/assets/spinner-B9ykw74u-zThqnDlE.css +0 -1
- package/dist/factory/assets/useDraftModelGuards-CI7E0Q5e.js +0 -29
- package/dist/factory/assets/usePlatformConnections-C4XGXSRe.js +0 -1
- package/dist/factory/assets/workspaces-DlGQ_R_W.js +0 -2
- package/dist/studio/assets/style-Bk6CooWr.css +0 -3
- /package/dist/factory/assets/{MarkdownRenderer-Dp2g3gxh-C04mQel5.css → MarkdownRenderer-Ca7UVGTG-C04mQel5.css} +0 -0
- /package/dist/factory/assets/{combobox-parts-DhYtFSRV-CYlMQsMB.css → combobox-parts-BVuRAhY6-CYlMQsMB.css} +0 -0
package/dist/docs/SKILL.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{At as e,Dt as t,Et as n,Mt as r,Nt as i,Ot as a,Pt as o,St as s,Tt as c,jt as l,kt as u,ni as d,wt as f}from"./GithubIcon.es-
|
|
1
|
+
import{At as e,Dt as t,Et as n,Mt as r,Nt as i,Ot as a,Pt as o,St as s,Tt as c,jt as l,kt as u,ni as d,wt as f}from"./GithubIcon.es-CIm0nGDf.js";import{O as p,T as m}from"./IconChevronRightMedium.es-BkPdzxSm.js";var h=p();function g(e){return(0,h.jsx)(s,{...e,modal:!0,disablePointerDismissal:!0})}function _({size:e=`sm`,...n}){return(0,h.jsx)(t,{"data-slot":`alert-dialog-content`,size:e,showCloseButton:!1,...n,role:`alertdialog`})}function v({children:e,loading:t,...r}){return(0,h.jsx)(n,{render:(0,h.jsx)(d,{variant:`primary`,size:`md`,loading:t,className:m(i,o.md),children:e}),...r})}g.Trigger=r,g.Content=_,g.Header=e,g.Footer=u,g.Body=f,g.Title=l,g.Description=a,g.Action=v,g.Cancel=c;export{g as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./Breadcrumb.es-DRA_fT-0.js";import{t as r}from"./EmptyState-DJaZF543-BTdobX9X.js";import{$n as i,Cr as a,D as o,Fr as s,Gn as c,Nr as l,O as u,Pr as d,Qn as f,Tr as p,Wn as m,Xn as h,Zn as g,_r as _,ar as v,br as y,dr as b,en as x,er as ee,fn as te,fr as S,gr as C,ir as w,mr as T,nn as E,nr as D,pr as O,rn as k,rr as A,sr as j,tn as M,tr as N,ur as P,wr as ne,xr as re}from"./index-Btp5jnxM.js";import{a as F}from"./Sidebar.es-B464rGRm.js";import{d as I,f as L,i as ie,t as R,u as ae}from"./settings-C5r2ThW9-DgHKaQxx.js";import{O as oe,T as z,k as se,n as B,s as V,t as ce}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{$n as H,Fi as le,Li as ue,Pi as de,Qr as fe,cr as pe,dr as me,n as U,ni as W,r as he,rr as ge,zt as _e}from"./GithubIcon.es-CIm0nGDf.js";import{c as ve,o as ye,r as be,s as xe,t as Se}from"./useBoardEditor-DFyQuLCD.js";import{i as Ce,t as we}from"./SkillBadges-DuFvl4d8.js";import{a as G,c as Te,f as Ee,l as De,s as Oe}from"./boardConfigPaths-Btimpi_r.js";import{t as K}from"./AlertDialog.es-Dkf8ZLsq.js";import{t as q}from"./SettingsSubsection-D1Yp4Ujt.js";import{r as ke}from"./CompositeItem-DXJX9-KR.js";import{n as Ae}from"./useBoardCatalog-DC55UfJd.js";import{h as je,o as Me}from"./useIntakeRoutes-C2h717K6.js";import{a as Ne,d as Pe,t as Fe}from"./BoardIcons-ChSrt-Ky.js";import{i as Ie,n as Le,r as Re,t as ze}from"./IconPencil.es-DLEsNj2e.js";import{r as Be}from"./overlays-B4T3HdBk.js";import{t as Ve}from"./DescriptionMarkdown-iotpUxXF.js";import{h as He,w as Ue,y as We}from"./ruleLanes-CB6XWPZ9.js";import{k as Ge}from"./TabsRoot-MM_4fh4A.js";import{t as Ke}from"./CodeEditor-DE69mZsU-DhkPbKOd.js";import{a as qe,n as Je,r as Ye,t as Xe}from"./Field.es-BgoAtL-2.js";import{t as Ze}from"./input-DqReKX0A-D66C6dWr.js";import{a as Qe,n as $e}from"./input-group-BXqgO3Q2-BNrm-udR.js";import{a as et,i as tt,n as nt,r as rt,t as it}from"./InputNumber.es-Bho-MKtp.js";import{i as at,n as ot,r as st,t as ct}from"./select-BPzTS5dZ-BGYcBcgg.js";import{E as lt}from"./combobox-parts-BVuRAhY6-ClaPtI8E.js";import{n as ut,t as dt}from"./ConditionRows-mhryClJA.js";import{n as ft}from"./IconUserDuo.es-CJ2yCPc7.js";import{_t as pt}from"./useSessionRows-CIakAaqj.js";import{t as mt}from"./IconPlusMedium.es-BOotRziY.js";import{t as ht}from"./TrashIcon.es-DoCvaCDh.js";import{n as gt,t as _t}from"./boardCatalog-y-s19dQU.js";import{t as vt}from"./IconArrowRotateCounterClockwise.es-Dxk4yi6B.js";import{t as yt}from"./InlineText-tcMMASWp.js";import{t as bt}from"./LoadErrorState-w5i-jqQO.js";var J=e(se(),1),xt=`mx-auto w-full max-w-2xl`,St=`[container-type:inline-size] h-full min-h-0 overflow-auto overscroll-x-contain [scrollbar-gutter:stable]`,Ct=`sticky left-0 w-[100cqw] px-4`,Y=oe();function X({pinned:e,sticky:t,className:n,children:r}){let i=t&&`sticky bottom-4 z-10`;return e?(0,Y.jsx)(`div`,{className:z(Ct,i),children:(0,Y.jsx)(`div`,{className:z(xt,n),children:r})}):(0,Y.jsx)(`div`,{className:z(xt,i,n),children:r})}function wt({factoryId:e,boardId:t,phase:n,skills:r}){let i=n.runner;if(!i)return null;let a=i.skill,s=a?r?.find(e=>e.name===a):void 0,c=a!==void 0&&r!==void 0&&s===void 0,l=c||s?.error!==void 0,u=a&&!c?Te(e,t,a):G(e,t,n.key),d=a?o:Be;return(0,Y.jsxs)(Le,{children:[(0,Y.jsxs)(Ie,{delay:0,closeDelay:100,render:(0,Y.jsx)(H,{to:u}),className:z(V,`border-border bg-fill-subtle hover:bg-fill flex w-fit max-w-full min-w-0 items-center gap-1.5 rounded-md border px-1.5 py-0.5 transition-colors`,l&&`border-destructive-foreground text-destructive-foreground`),children:[(0,Y.jsx)(d,{"aria-hidden":!0,className:`size-icon-sm shrink-0 opacity-70`}),(0,Y.jsx)(`span`,{className:`truncate`,children:a??`Agent`}),l&&(0,Y.jsx)(`span`,{className:`sr-only`,children:c?`, skill not found`:`, skill failed to load`})]}),(0,Y.jsxs)(Re,{side:`right`,align:`start`,sideOffset:8,collisionPadding:8,showArrow:!1,className:`flex w-96 max-w-[calc(100vw-2rem)] flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsx)(d,{"aria-hidden":!0,className:`text-muted-foreground size-icon-md shrink-0`}),(0,Y.jsx)(B,{as:`span`,variant:`label`,tone:`ink`,className:`truncate`,children:a??`${n.name} agent`}),s&&(0,Y.jsx)(we,{skill:s})]}),c?(0,Y.jsxs)(B,{as:`p`,variant:`caption`,role:`alert`,className:`text-destructive-foreground`,children:[`This factory has no `,a,` skill, so cards entering `,n.name,` fail to start.`]}):s?.error?(0,Y.jsxs)(B,{as:`p`,variant:`caption`,role:`alert`,className:`text-destructive-foreground`,children:[`Agents can't load this skill: `,s.error]}):s?.description&&(0,Y.jsx)(B,{as:`p`,variant:`caption`,tone:`muted`,children:s.description}),a&&!r&&(0,Y.jsx)(f,{children:`Loading the skill…`}),s?.content.trim()&&(0,Y.jsx)(Tt,{title:`Skill instructions`,children:(0,Y.jsx)(Ve,{titleLevel:`h3`,children:s.content})}),i.instructions?.trim()&&(0,Y.jsx)(Tt,{title:`${n.name} adds`,children:(0,Y.jsx)(Ve,{titleLevel:`h3`,children:i.instructions})}),i.goal?.objective&&(0,Y.jsx)(Tt,{title:i.goal.maxRuns?`Goal, up to ${i.goal.maxRuns} runs`:`Goal`,children:(0,Y.jsx)(B,{as:`p`,variant:`body-sm`,className:`whitespace-pre-wrap`,children:i.goal.objective})}),(0,Y.jsxs)(B,{as:`p`,variant:`caption`,tone:`muted`,children:[`Session `,i.context||`work`,`, shared with phases that name it too.`]})]})]})}function Tt({title:e,children:t}){return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(B,{as:`span`,variant:`caption`,tone:`faint`,children:e}),(0,Y.jsx)(`div`,{className:`bg-fill-subtle max-h-56 overflow-y-auto rounded-md px-2.5 py-2`,children:t})]})}function Et({rules:e,title:t,to:n,boardId:r,boards:i}){return(0,Y.jsxs)(Le,{children:[(0,Y.jsx)(Ie,{delay:0,closeDelay:100,render:(0,Y.jsx)(H,{to:n}),className:z(V,`w-fit rounded-sm underline decoration-dotted underline-offset-2`),children:He(e.length)}),(0,Y.jsxs)(Re,{side:`right`,align:`start`,sideOffset:8,collisionPadding:8,showArrow:!1,className:`flex w-80 max-w-[calc(100vw-2rem)] flex-col gap-2`,children:[(0,Y.jsx)(B,{as:`span`,variant:`caption`,tone:`faint`,children:t}),(0,Y.jsx)(`ul`,{"aria-label":t,className:`flex max-h-80 flex-col gap-1.5 overflow-y-auto`,children:e.map(e=>(0,Y.jsx)(c,{rule:e,boardId:r,boards:i},e.id))})]})]})}var Dt=`px-[max(0.75rem,calc((100cqw_-_42rem)/2_-_1.25rem))]`;function Ot({factoryId:e,boardId:t,phases:n,skills:r,action:a,onAutoStart:o}){let s=Ae(e),c=Me(e),l=s.isPending||c.isPending,u=s.data?.find(e=>e.id===t)?.initialPhase??n[0]?.key,d=n.map(e=>g(e,n)),p=c.data&&u?i(c.data.intakeRoutes,{key:t,initialPhase:u}):void 0;return(0,Y.jsxs)(`section`,{"aria-label":`Board map`,className:`flex flex-col gap-3`,children:[a&&(0,Y.jsx)(X,{pinned:!0,className:`flex justify-end`,children:a}),c.isError&&(0,Y.jsx)(X,{pinned:!0,children:(0,Y.jsx)(U,{variant:`warning`,children:(0,Y.jsx)(U.Message,{children:`Rules didn’t load, so the map doesn’t count them.`})})}),p&&p.leaving.length>0&&(0,Y.jsx)(X,{pinned:!0,className:`mb-4`,children:(0,Y.jsxs)(B,{as:`p`,variant:`caption`,tone:`muted`,children:[(0,Y.jsx)(Et,{rules:p.leaving,title:`Rules that send cards to other boards`,to:Oe(e,t,`leaving`),boardId:t,boards:s.data}),` `,p.leaving.length===1?`sends`:`send`,` cards from here to other boards.`]})}),(0,Y.jsx)(`ol`,{"aria-label":`Phases`,className:z(`mx-auto flex w-max`,Dt),children:n.map(i=>{let a=Ne(t,i.kind),c=p?.into.get(i.key)??[];return(0,Y.jsxs)(`li`,{"aria-label":i.name,className:`before:via-border-strong relative flex w-64 shrink-0 flex-col px-2 not-first:before:absolute not-first:before:inset-y-0 not-first:before:left-0 not-first:before:w-px not-first:before:bg-linear-to-b not-first:before:from-transparent not-first:before:to-transparent`,children:[(0,Y.jsx)(`div`,{className:`flex items-center gap-2 px-3 pt-3 pb-1`,children:(0,Y.jsxs)(H,{to:G(e,t,i.key),className:`flex min-w-0 items-center gap-2 hover:underline focus-visible:underline focus-visible:outline-hidden`,children:[(0,Y.jsx)(Fe,{stage:i.key,kind:a,decorative:!0}),(0,Y.jsx)(B,{as:`span`,variant:`label`,tone:`ink`,className:`truncate`,children:i.name})]})}),(0,Y.jsx)(`div`,{className:`px-3 py-3`,children:(0,Y.jsx)(h,{boardId:t,phase:g(i,n),phases:d,arrivals:(0,Y.jsxs)(Y.Fragment,{children:[l?(0,Y.jsx)(ke,{className:`h-4 w-20`}):p?c.length>0?(0,Y.jsx)(Et,{rules:c,title:`Rules that move cards into ${i.name}`,to:Oe(e,t,{into:i.key}),boardId:t,boards:s.data}):(0,Y.jsx)(f,{children:`No rule moves cards here`}):(0,Y.jsx)(f,{children:`Rules didn’t load`}),i.key===u&&(0,Y.jsx)(f,{children:`New cards start here`})]}),starts:(0,Y.jsx)(m,{label:i.name,autoStart:i.autoStart??!1,autoStartWhen:i.autoStartWhen,onChange:o&&(e=>o(i.key,e))}),agent:(0,Y.jsx)(wt,{factoryId:e,boardId:t,phase:i,skills:r})})})]},i.key)})})]})}var kt=`Finish or remove unfinished conditions to save.`;function At({label:e,description:t,rule:n,disabled:r,facts:i=We,options:o,schema:s,json:c,onChange:l,onUnfinished:u}){let[d,f]=(0,J.useState)(void 0),p=c?c.text:d,m=c?c.onChange:f,h=(0,J.useId)(),g=p===void 0?a(s,n):y(s,p),_=e=>{m(e);let t=re(s,e);`problem`in t?l(n??null,t.problem):l(t.rule,void 0)};return(0,Y.jsxs)(Xe,{invalid:g!==void 0,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(qe,{htmlFor:h,children:e}),(0,Y.jsx)(W,{size:`sm`,variant:`ghost`,disabled:r,onClick:()=>{p===void 0?m(n?JSON.stringify(n,null,2):``):(m(void 0),l(n??null,a(s,n)))},children:p===void 0?`Edit as JSON`:`Edit as conditions`})]}),(0,Y.jsx)(Je,{children:t}),p===void 0?r?(0,Y.jsx)(B,{id:h,as:`p`,variant:`caption`,tone:`muted`,children:Ue(n,o)}):(0,Y.jsx)(`div`,{id:h,children:(0,Y.jsx)(dt,{label:e,rule:n,facts:i,options:o,onChange:(e,t)=>{u?.(t),t?l(n??null,kt):l(e,a(s,e))}})}):(0,Y.jsx)(x,{id:h,"aria-label":`${e} JSON`,value:p,disabled:r,rows:6,onChange:e=>_(e.target.value)}),g&&(0,Y.jsx)(Ye,{children:g})]})}var jt=`inline-flex h-8 max-w-48 min-w-0 items-center gap-1.5 rounded-lg border px-2.5`;function Mt({phase:e,phases:t,next:n,required:r,boardId:i,disabled:a,onChange:o}){let s=e=>o(n.includes(e)?n.filter(t=>t!==e):t.filter(t=>t.key===e||n.includes(t.key)).map(e=>e.key));return(0,Y.jsx)(`ul`,{"aria-label":`Allowed moves from ${e.name}`,className:`flex flex-wrap gap-1.5`,children:t.map(t=>{let o=(0,Y.jsx)(Fe,{stage:t.key,kind:Ne(i,t.kind),decorative:!0});if(t.key===e.key)return(0,Y.jsxs)(`li`,{className:z(jt,`border-border-strong bg-card shadow-raised dark:bg-muted`),children:[o,(0,Y.jsx)(Nt,{children:t.name}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`(this phase)`})]},t.key);let c=n.includes(t.key),l=c&&r.has(t.key),u=l||a,d=(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":c,"aria-label":l?`${t.name} (locked)`:void 0,"aria-disabled":u||void 0,onClick:u?void 0:()=>s(t.key),className:z(jt,`group/move transition-colors`,c?`bg-fill text-foreground border-transparent`:`border-border text-muted-foreground border-dashed`,!u&&(c?`hover:bg-fill-hover`:`hover:text-foreground hover:border-border-strong`),u&&!l&&`cursor-default`,V),children:[(0,Y.jsx)(`span`,{className:z(`grid place-items-center`,!c&&`opacity-50`),children:o}),(0,Y.jsx)(Nt,{children:t.name}),(0,Y.jsx)(`span`,{className:`text-muted-foreground grid size-3.5 shrink-0 place-items-center`,children:l?(0,Y.jsx)(ft,{className:`size-icon-sm`,"aria-hidden":!0}):c?(0,Y.jsx)(pt,{className:`size-icon-sm`,"aria-hidden":!0}):!a&&(0,Y.jsx)(mt,{className:`size-icon-sm invisible group-hover/move:visible group-focus-visible/move:visible`,"aria-hidden":!0})})]});return(0,Y.jsx)(`li`,{className:`min-w-0`,children:l?(0,Y.jsxs)(de,{children:[(0,Y.jsx)(ue,{render:d}),(0,Y.jsx)(le,{children:`Factory's code makes this move`})]}):d},t.key)})})}function Nt({children:e}){return(0,Y.jsx)(B,{as:`span`,variant:`label`,className:`truncate`,children:e})}function Pt({label:e,children:t}){return(0,Y.jsx)(`ol`,{"aria-label":e,className:`flex flex-col`,children:t})}function Z({icon:e,title:t,description:n,children:r}){let i=(0,J.useId)();return(0,Y.jsxs)(`li`,{"aria-labelledby":i,className:`before:bg-border relative grid grid-cols-[--spacing(7)_minmax(0,1fr)] gap-x-3 pb-8 before:absolute before:top-9 before:bottom-1 before:left-[calc(--spacing(3.5)-0.5px)] before:w-px last:pb-0 last:before:hidden`,children:[(0,Y.jsx)(`span`,{className:`border-border bg-card text-muted-foreground [&_svg]:size-icon-sm flex size-7 items-center justify-center rounded-full border`,children:e}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-h-7 flex-col justify-center`,children:[(0,Y.jsx)(B,{as:`h2`,id:i,variant:`subheading`,tone:`ink`,children:t}),n&&(0,Y.jsx)(B,{as:`p`,variant:`caption`,tone:`muted`,children:n})]}),r]})]})}var Ft=`__none__`,It=`sm:max-w-xs`,Lt=(e,t)=>e>=t-200?` ${e}/${t}`:``;function Q({title:e,description:t,error:n,disabled:r,children:i,after:a}){return(0,Y.jsxs)(ie,{children:[(0,Y.jsxs)(Xe,{invalid:!!n,disabled:r,children:[(0,Y.jsx)(I,{children:e}),(0,Y.jsx)(Je,{children:t}),i,n&&(0,Y.jsx)(Ye,{children:n})]}),a]})}function Rt({label:e,value:t,placeholder:n,disabled:r,onChange:i}){return(0,Y.jsx)(R,{children:(0,Y.jsx)(`div`,{className:`px-4 py-3`,children:(0,Y.jsx)(Ke,{"aria-label":e,value:t,placeholder:n,editable:!r,onChange:i,language:`markdown`,font:`body`,variant:`inline`,lineNumbers:!1,showCopyButton:!1})})})}function zt({phase:e,phases:t,requiredNextPhases:n,skills:r,skillsEditable:i,factoryId:a,boardId:s,disabled:c,rawRules:l,onChange:u,onRawRule:d,onUnfinished:f,onRemove:p}){let m=ut(a),h=e.kind===`working`,g=b(e,t),_=e.runner?.instructions??``,v=e.runner?.goal,y=v?.objective??``,x=e.tools??[],S=e.exitTool?.id??``,w=e.runner?.skill,T=w?r?.find(e=>e.name===w):void 0,E=w!==void 0&&r!==void 0&&T===void 0,O=t=>{let n={...e.runner,...t},r=Object.fromEntries(Object.entries(n).filter(([,e])=>e!=null&&e!==``));u({...e,runner:Object.keys(r).length>0?r:null})},k=e=>({text:l[e],onChange:t=>d(e,t)}),M=(0,Y.jsx)(Mt,{phase:e,phases:t,next:g,required:new Set(n),boardId:s,disabled:c,onChange:t=>u({...e,nextPhases:t})}),P=p&&(0,Y.jsx)(`div`,{children:(0,Y.jsxs)(W,{variant:`ghost`,icon:(0,Y.jsx)(ht,{}),onClick:p,children:[`Remove `,e.name]})});return h?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Y.jsxs)(Pt,{label:`How ${e.name} runs`,children:[(0,Y.jsx)(Z,{icon:(0,Y.jsx)(Pe,{}),title:`Starts`,children:(0,Y.jsxs)(R,{children:[(0,Y.jsx)(L,{label:`Start on its own`,disabled:c,children:(0,Y.jsx)(lt,{"aria-label":`${e.name}: start on its own`,checked:e.autoStart??!1,disabled:c,onCheckedChange:t=>{u(C(e,t)),t||d(`autoStartWhen`,void 0)}})}),e.autoStart&&(0,Y.jsx)(`div`,{className:`px-4 py-3`,children:(0,Y.jsx)(At,{label:`${e.name}: start only when`,description:`Leave empty to start every card on its own.`,rule:e.autoStartWhen,schema:je,options:{"source.repository":m},disabled:c,json:k(`autoStartWhen`),onUnfinished:e=>f(`autoStartWhen`,e),onChange:t=>u({...e,autoStartWhen:t})})})]})}),(0,Y.jsxs)(Z,{icon:(0,Y.jsx)(Be,{}),title:`Agent runs`,children:[(0,Y.jsx)(Q,{title:`Instructions`,description:`Added to the agent's prompt when the phase starts.${Lt(_.length,N)}`,error:_.length>1e3?`Too long to save.`:void 0,disabled:c,children:(0,Y.jsx)(Rt,{label:`${e.name} instructions`,value:_,placeholder:`Tell the agent what to do, in Markdown`,disabled:c,onChange:e=>O({instructions:e})})}),(0,Y.jsx)(Q,{title:`Goal`,description:`The agent keeps working until a judge finds this objective met. Leave empty for a single run.${Lt(y.length,D)}`,error:y.length>2e3?`Too long to save.`:void 0,disabled:c,after:v&&(0,Y.jsxs)(Xe,{invalid:!j(v.maxRuns),disabled:c,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(qe,{info:`After this many runs without meeting the goal, the card waits for a person. From 1 to 50; leave empty for Factory's default.`,children:`Pause goal after`}),(0,Y.jsx)(it,{className:`w-36`,min:1,max:50,allowOutOfRange:!0,value:v.maxRuns??null,disabled:c,onValueChange:e=>{let{maxRuns:t,...n}=v;O({goal:e===null?n:{...n,maxRuns:e}})},children:(0,Y.jsxs)(rt,{size:`sm`,children:[(0,Y.jsx)(et,{placeholder:`Default`}),(0,Y.jsxs)($e,{align:`inline-end`,variant:`flush`,children:[(0,Y.jsx)(Qe,{className:`mr-1`,children:`runs`}),(0,Y.jsx)(nt,{}),(0,Y.jsx)(tt,{})]})]})})]}),!j(v.maxRuns)&&(0,Y.jsxs)(Ye,{children:[`Use a whole number from 1 to `,50,`.`]})]}),children:(0,Y.jsx)(Rt,{label:`${e.name} goal`,value:y,placeholder:`Describe what done looks like`,disabled:c,onChange:e=>O({goal:e.trim()?{...v,objective:e}:void 0})})}),(0,Y.jsx)(Q,{title:`Session`,description:`Phases with the same session share one agent session per card.`,disabled:c,children:(0,Y.jsx)(Ze,{className:It,"aria-label":`${e.name} session`,value:e.runner?.context??``,placeholder:ee,disabled:c,onChange:e=>O({context:e.target.value})})}),(0,Y.jsx)(q,{title:`Skill`,children:(0,Y.jsx)(R,{children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1 px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsxs)(ct,{value:w??Ft,disabled:c,onValueChange:e=>O({skill:e===Ft?void 0:String(e)}),children:[(0,Y.jsx)(at,{variant:`ghost`,size:`sm`,"aria-label":`${e.name} skill`,className:`-ml-2 w-fit`,children:(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(o,{"aria-hidden":!0,className:`text-muted-foreground size-icon-md shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate`,children:w??`No skill`})]})}),(0,Y.jsxs)(ot,{children:[(0,Y.jsx)(st,{value:Ft,children:`None`}),(r??[]).map(e=>(0,Y.jsx)(st,{value:e.name,children:e.name},e.name))]})]}),E&&(0,Y.jsx)(Ge,{variant:`destructive`,children:`Not found`}),T?.error&&(0,Y.jsx)(Ge,{variant:`destructive`,children:`Failed to load`}),T&&(0,Y.jsx)(we,{skill:T}),T&&(0,Y.jsx)(W,{size:`sm`,variant:`ghost`,icon:i?(0,Y.jsx)(ze,{}):(0,Y.jsx)(he,{}),"aria-label":`${i?`Edit`:`View`} ${T.name}`,className:`ml-auto`,render:(0,Y.jsx)(H,{to:Te(a,s,T.name)}),children:i?`Edit`:`View`})]}),T?.error?(0,Y.jsxs)(B,{as:`p`,variant:`caption`,role:`alert`,className:`text-destructive-foreground`,children:[`Agents can't load this skill: `,T.error]}):E?(0,Y.jsxs)(B,{as:`p`,variant:`caption`,role:`alert`,className:`text-destructive-foreground`,children:[`This factory has no `,w,` skill, so cards entering `,e.name,` fail to start.`]}):T?.description&&(0,Y.jsx)(B,{as:`p`,variant:`caption`,tone:`muted`,children:T.description})]})})}),(0,Y.jsx)(q,{title:`Factory tools`,description:`Given to the session that works the card in this phase.`,children:(0,Y.jsx)(R,{children:A.map(t=>(0,Y.jsx)(L,{label:t.label,disabled:c,children:(0,Y.jsx)(lt,{"aria-label":`${e.name}: ${t.label}`,checked:x.includes(t.id),disabled:c,onCheckedChange:n=>{let r=A.map(({id:e})=>e).filter(e=>e===t.id?n:x.includes(e));u({...e,tools:r.length>0?r:null})}})},t.id))})})]}),(0,Y.jsxs)(Z,{icon:(0,Y.jsx)(ne,{}),title:`Ends`,children:[(0,Y.jsx)(Q,{title:`Exit tool`,description:`Ends the phase when it succeeds. Leave empty for none.`,disabled:c,children:(0,Y.jsx)(Ze,{className:It,"aria-label":`${e.name} exit tool`,value:S,disabled:c,onChange:t=>{let n=t.target.value.trim();u({...e,exitTool:n?{...e.exitTool,id:n}:null}),n||d(`autoApproveWhen`,void 0)}})}),S!==``&&(0,Y.jsxs)(R,{children:[(0,Y.jsx)(L,{label:`Approve on its own`,disabled:c,children:(0,Y.jsx)(lt,{"aria-label":`${e.name}: approve ${S} on its own`,checked:e.exitTool?.autoApprove??!1,disabled:c,onCheckedChange:t=>{u({...e,exitTool:{...e.exitTool,id:S,autoApprove:t,autoApproveWhen:t?e.exitTool?.autoApproveWhen:void 0}}),t||d(`autoApproveWhen`,void 0)}})}),e.exitTool?.autoApprove&&(0,Y.jsx)(`div`,{className:`px-4 py-3`,children:(0,Y.jsx)(At,{label:`${e.name}: approve only when`,description:`Leave empty to approve for every card.`,rule:e.exitTool.autoApproveWhen,schema:je,options:{"source.repository":m},disabled:c,json:k(`autoApproveWhen`),onUnfinished:e=>f(`autoApproveWhen`,e),onChange:t=>u({...e,exitTool:{...e.exitTool,id:S,autoApprove:!0,autoApproveWhen:t??void 0}})})})]})]}),(0,Y.jsx)(Z,{icon:(0,Y.jsx)(te,{}),title:`Allowed moves`,children:M})]}),P]}):(0,Y.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Y.jsx)(q,{title:`Allowed moves`,children:M}),P]})}var Bt=[`autoStartWhen`,`autoApproveWhen`];function Vt({factory:e,boardId:t,phaseKey:n,response:i,skills:a,skillsEditable:s,sidebarHidden:c,onReload:l}){let{board:d,canEdit:f}=i,{draft:p,rawRules:m,locked:h,setDraft:g,setRawRule:_,discard:y}=E(e.id,t,d),[b,x]=(0,J.useState)(0),ee=()=>{y(),x(e=>e+1)},te=me(),D=ve(e.id,t),k=fe(),A=!f||!d.editable,j=n?p.phases.find(e=>e.key===n):void 0,M=j&&`${j.key}:${d.revision??`code`}:${b}`,[N,P]=(0,J.useState)({page:M,fields:[]});N.page!==M&&P({page:M,fields:[]});let ne=N.page===M?N.fields:[],re=(e,t)=>P(n=>{let r=n.fields.filter(t=>t!==e);return{...n,fields:t?[...r,e]:r}}),F=!A&&(v(p,d)||Object.keys(m).length>0||ne.length>0),I=p.phases.filter(e=>S(e,m)||e===j&&ne.length>0),L=p.name.trim()===``,ie=D.error?.code===`revision_mismatch`,ae=pe(({nextLocation:n})=>{let r=k.getQueryData(_e.boardCatalog(e.id))?.boards.some(e=>e.id===t);if(!F||r===!1)return!1;let i=Ee(n.pathname);return i?.factoryId!==e.id||i.boardId!==t||i.skills===!0||i.rules===!0||i.intake===!0});ge(e=>{F&&e.preventDefault()});let oe=G(e.id,t),se;return se=n&&!j?(0,Y.jsx)(r,{titleSlot:(0,Y.jsxs)(`span`,{role:`alert`,children:[d.name,` has no such phase.`]}),actionSlot:(0,Y.jsx)(W,{size:`sm`,render:(0,Y.jsx)(H,{to:oe}),children:`Back to general`})}):j?(0,Y.jsx)(zt,{phase:j,phases:p.phases,requiredNextPhases:d.codeBehaviour?.[j.key]?.requiredNextPhases??[],skills:a,skillsEditable:s,factoryId:e.id,boardId:t,disabled:A||h,rawRules:{autoStartWhen:m[O(j.key,`autoStartWhen`)],autoApproveWhen:m[O(j.key,`autoApproveWhen`)]},onRawRule:(e,t)=>{_(O(j.key,e),t),re(e,!1)},onUnfinished:re,onRemove:A||h||!w(p.phases,j.key,d.codeBehaviour)?void 0:()=>{for(let e of Bt)_(O(j.key,e),void 0);g(e=>({...e,phases:T(e.phases,j.key)})),te(oe)},onChange:e=>g(t=>({...t,phases:t.phases.map(t=>t.key===e.key?e:t)}))},M):(0,Y.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Y.jsx)(Ot,{factoryId:e.id,boardId:t,phases:p.phases,skills:a,onAutoStart:A||h?void 0:(e,t)=>{g(n=>({...n,phases:n.phases.map(n=>n.key===e?C(n,t):n)})),t||_(O(e,`autoStartWhen`),void 0)},action:c&&!A?(0,Y.jsx)(u,{factoryId:e.id,boardId:t,board:d,disabled:h}):void 0}),(0,Y.jsx)(X,{pinned:!0,className:`flex flex-col gap-8 empty:hidden`,children:c&&(0,Y.jsx)(q,{title:`Factory`,children:(0,Y.jsx)(R,{children:(0,Y.jsxs)(H,{to:De(e.id,t),className:`hover:bg-fill focus-visible:bg-fill flex items-center gap-3 px-4 py-3 focus-visible:outline-hidden`,children:[(0,Y.jsx)(o,{className:`text-muted-foreground size-icon-md`,"aria-hidden":!0}),(0,Y.jsx)(B,{as:`span`,variant:`label`,className:`min-w-0 flex-1 truncate`,children:`Skills`}),(0,Y.jsx)(ce,{className:`text-muted-foreground size-icon-md`,"aria-hidden":!0})]})})})})]}),(0,Y.jsxs)(`div`,{className:z(`flex flex-col gap-8 pb-4`,!j&&`w-max min-w-full`),children:[d.editable?!f&&(0,Y.jsx)(X,{pinned:!j,children:(0,Y.jsx)(U,{variant:`info`,children:`Only organization admins can change this board.`})}):(0,Y.jsx)(X,{pinned:!j,children:(0,Y.jsx)(U,{variant:`info`,children:`This board is defined in code, so it can't be changed here.`})}),!j&&d.problems.length>0&&(0,Y.jsx)(X,{pinned:!0,children:(0,Y.jsx)(U,{variant:`warning`,title:`This board has problems`,children:(0,Y.jsx)(U.Message,{children:d.problems.join(` `)})})}),se,F&&(0,Y.jsxs)(X,{pinned:!j,sticky:!0,className:`rounded-card bg-card shadow-overlay dark:bg-muted flex flex-col gap-3 p-3`,children:[ie&&(0,Y.jsx)(U,{variant:`warning`,title:`Someone else changed this board`,action:(0,Y.jsx)(U.Button,{onClick:l,children:`Reload`}),children:(0,Y.jsx)(U.Message,{children:`Reload to see their version. Your unsaved changes will be lost.`})}),D.error&&!ie&&(0,Y.jsx)(U,{variant:`destructive`,role:`alert`,children:(0,Y.jsxs)(U.Message,{children:[`The board was not saved. `,D.error.reasons]})}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(B,{variant:`body-sm`,tone:`muted`,className:`min-w-0 flex-1`,role:`status`,children:L?`Name the board to save.`:I.length>0?`Fix ${I.map(e=>e.name||e.key).join(`, `)} to save.`:`Unsaved changes`}),(0,Y.jsx)(W,{size:`sm`,variant:`ghost`,disabled:D.isPending,onClick:ee,children:`Discard`}),(0,Y.jsx)(W,{size:`sm`,variant:`primary`,disabled:L||I.length>0,onClick:()=>D.mutate({name:p.name,description:p.description,phases:p.phases,expectedRevision:d.revision??0}),loading:D.isPending,children:`Save`})]})]}),(0,Y.jsx)(K,{open:ae.state===`blocked`,onOpenChange:e=>!e&&ae.reset?.(),children:(0,Y.jsxs)(K.Content,{children:[(0,Y.jsxs)(K.Header,{children:[(0,Y.jsxs)(K.Title,{children:[`Discard changes to `,d.name,`?`]}),(0,Y.jsx)(K.Description,{children:`Your unsaved changes to this board will be lost.`})]}),(0,Y.jsxs)(K.Footer,{children:[(0,Y.jsx)(K.Cancel,{children:`Keep editing`}),(0,Y.jsx)(W,{variant:`destructive`,size:`md`,onClick:()=>{y(),ae.proceed?.()},children:`Discard`})]})]})})]})}function Ht({name:e,disabled:t,loading:n,onDelete:r}){return(0,Y.jsxs)(K,{children:[(0,Y.jsx)(K.Trigger,{render:(0,Y.jsx)(W,{variant:`ghost`,size:`sm`,icon:(0,Y.jsx)(ht,{}),disabled:t,loading:n,children:`Delete`})}),(0,Y.jsxs)(K.Content,{children:[(0,Y.jsxs)(K.Header,{children:[(0,Y.jsxs)(K.Title,{children:[`Delete `,e,`?`]}),(0,Y.jsx)(K.Description,{children:`The board and its phases are removed from this project. A board that still has cards can’t be deleted.`})]}),(0,Y.jsxs)(K.Footer,{children:[(0,Y.jsx)(K.Cancel,{children:`Cancel`}),(0,Y.jsx)(K.Action,{onClick:r,children:`Delete`})]})]})]})}function Ut({name:e,disabled:t,loading:n,onReset:r}){return(0,Y.jsxs)(K,{children:[(0,Y.jsx)(K.Trigger,{render:(0,Y.jsx)(W,{variant:`ghost`,size:`sm`,icon:(0,Y.jsx)(vt,{}),tooltip:`Go back to Factory's version of this board`,tooltipPosition:`bottom`,disabled:t,loading:n,children:`Reset`})}),(0,Y.jsxs)(K.Content,{children:[(0,Y.jsxs)(K.Header,{children:[(0,Y.jsxs)(K.Title,{children:[`Reset `,e,` to default?`]}),(0,Y.jsx)(K.Description,{children:`Every change made to this board's name and phases is replaced with Factory's version.`})]}),(0,Y.jsxs)(K.Footer,{children:[(0,Y.jsx)(K.Cancel,{children:`Cancel`}),(0,Y.jsx)(K.Action,{onClick:r,children:`Reset`})]})]})]})}var $={resting:{label:`Resting`,meaning:`No agent works here. Cards wait for a person or an event to move them.`},working:{label:`Working`,meaning:`An agent works on each card here, following the steps below.`},terminal:{label:`Terminal`,meaning:`Cards are finished here. Their agent sessions stop.`}},Wt=[`resting`,`working`,`terminal`];function Gt({label:e,meaning:t,children:n}){return(0,Y.jsxs)(de,{children:[(0,Y.jsx)(ue,{render:(0,Y.jsx)(`span`,{role:`img`,tabIndex:0,"aria-label":`${e}. ${t}`,className:z(`inline-flex rounded-sm`,V),children:n})}),(0,Y.jsx)(le,{side:`bottom`,className:`max-w-72`,children:t})]})}function Kt({factoryId:e,boardId:t,phaseKey:n,response:r}){let{board:i,canEdit:a}=r,{draft:o,locked:c,setDraft:l,setRawRule:u,discard:d}=E(e,t,i),f=Ae(e),p=me(),m=!a||!i.editable||c,h=xe(e,t),g=ye(e,t,()=>{d();let n=gt(f.data??[]).find(e=>e.id!==t);p(n?_t(e,n.id):`/factories/${e}`,{replace:!0})}),v=!n&&a&&i.editable,y=v&&i.source!==`stored`,b=v&&i.source!==`builtin`,x=n?o.phases.find(e=>e.key===n):void 0;if(n&&!x)return null;let ee=e=>l(t=>({...t,phases:t.phases.map(t=>t.key===n?{...t,...e}:t)})),te=e=>{x&&(u(O(x.key,`autoStartWhen`),void 0),u(O(x.key,`autoApproveWhen`),void 0),l(t=>({...t,phases:t.phases.map(n=>n.key===x.key?_(n,e,t.phases):n)})))},S=x?x.name:o.name,C=(x?x.description:o.description)??``,w=x!==void 0&&!m&&!P(o.phases,x.key,i.codeBehaviour);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(s,{children:[(0,Y.jsxs)(s.Title,{className:`gap-2.5`,children:[x&&(0,Y.jsx)(Fe,{stage:x.key,kind:Ne(t,x.kind),decorative:!0}),(0,Y.jsx)(yt,{value:S,label:x?`Phase name`:`Board name`,required:!0,readOnly:m,variant:`heading`,tone:`ink`,onChange:e=>x?ee({name:e}):l(t=>({...t,name:e}))})]}),x&&(0,Y.jsx)(s.Meta,{beside:!0,children:w?(0,Y.jsxs)(ct,{value:x.kind,onValueChange:e=>{let t=Wt.find(t=>t===e);t&&te(t)},children:[(0,Y.jsx)(at,{size:`sm`,"aria-label":`Phase kind`,children:$[x.kind].label}),(0,Y.jsx)(ot,{children:Wt.map(e=>(0,Y.jsx)(st,{value:e,children:$[e].label},e))})]}):(0,Y.jsx)(Gt,{label:$[x.kind].label,meaning:$[x.kind].meaning,children:(0,Y.jsx)(Ge,{children:$[x.kind].label})})}),(C||!m)&&(0,Y.jsx)(s.Description,{children:(0,Y.jsx)(yt,{value:C,label:x?`Phase description`:`Board description`,placeholder:`Add a description`,multiline:!0,readOnly:m,variant:`caption`,tone:`muted`,className:`zoom-safe-text w-full`,onChange:e=>x?ee({description:e||null}):l(t=>({...t,description:e||null}))})}),(y||b)&&(0,Y.jsxs)(s.Action,{className:`gap-1`,children:[y&&(0,Y.jsx)(Ut,{name:i.name,disabled:c,loading:h.isPending,onReset:()=>h.mutate(i.revision??0)}),b&&(0,Y.jsx)(Ht,{name:i.name,disabled:c,loading:g.isPending,onDelete:()=>g.mutate(i.revision??0)})]})]}),h.error&&(0,Y.jsx)(U,{variant:`destructive`,role:`alert`,className:`mt-4`,children:(0,Y.jsxs)(U.Message,{children:[`The board was not reset. `,h.error.reasons]})}),g.error&&(0,Y.jsx)(U,{variant:`destructive`,role:`alert`,className:`mt-4`,children:(0,Y.jsxs)(U.Message,{children:[`The board was not deleted. `,g.error.reasons]})})]})}function qt(){let e=p(),i=M(),a=i?.boardId??``,o=i?.phaseKey,{isMobile:s,desktopState:c}=F(),u=s||c===`collapsed`,f=be(e.id,a),m=Ce(e.id),h=f.data?.board,g=k(e.id,a,h),_=o?g?.phases.find(e=>e.key===o):void 0,v=G(e.id,a),y=l({breadcrumbs:u&&h?(0,Y.jsxs)(n,{label:`Breadcrumb`,className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Y.jsx)(t,{as:H,to:_t(e.id,a),children:g?.name||h.name}),o?(0,Y.jsx)(t,{as:H,to:v,children:`Configure`}):(0,Y.jsx)(t,{as:`span`,isCurrent:!0,children:`Configure`}),_&&(0,Y.jsx)(t,{as:`span`,isCurrent:!0,children:_.name})]}):void 0}),b=f.isSuccess&&(!o||_)?(0,Y.jsx)(Kt,{factoryId:e.id,boardId:a,phaseKey:o,response:f.data},`${a}:${f.data.board.revision??`code`}`):void 0,x=f.isPending?(0,Y.jsx)(R,{children:(0,Y.jsx)(ae,{label:`Loading board`,rows:3})}):f.isError&&f.error instanceof Se&&f.error.code===`board_not_found`?(0,Y.jsx)(r,{variant:`fill`,titleSlot:(0,Y.jsx)(`span`,{role:`alert`,children:`Board unavailable: this board is not installed.`})}):f.isError?(0,Y.jsx)(bt,{title:`Couldn’t load this board`,error:f.error,onRetry:()=>void f.refetch(),retrying:f.isFetching}):(0,Y.jsx)(Vt,{factory:e,boardId:a,phaseKey:o,response:f.data,skills:m.data?.skills,skillsEditable:m.data?.canEdit??!1,sidebarHidden:u,onReload:()=>void f.refetch()},`${a}:${f.data.board.revision??`code`}`);return o?(0,Y.jsx)(d,{variant:`settings`,header:b,...y,children:x}):(0,Y.jsx)(d,{variant:`page`,body:`fixed`,header:b&&(0,Y.jsx)(`div`,{className:`mx-auto w-full max-w-2xl`,children:b}),...y,children:(0,Y.jsx)(`div`,{className:f.isSuccess?St:z(xt,`px-4`),children:x})})}export{qt as BoardConfigPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{O as e,T as t,f as n}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{s as r}from"./useBoardCatalog-
|
|
1
|
+
import{O as e,T as t,f as n}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{s as r}from"./useBoardCatalog-DC55UfJd.js";import{B as i}from"./useSessionRows-CIakAaqj.js";import{i as a,n as o,o as s,r as c}from"./TrashIcon.es-DoCvaCDh.js";import{t as l}from"./IconCircleDashed.es-CrssFpNj.js";import{t as u}from"./IconCircleX.es-Bah9f48z.js";import{n as d}from"./IconSettingsSliderHor.es-VS_Cfpz8.js";import{t as f}from"./IconCircleCheck.es-D6u0E19o.js";var p=e();function m({size:e=16,className:t}){return(0,p.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,className:t,"aria-hidden":!0,children:(0,p.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8 14.67C11.68 14.67 14.67 11.68 14.67 8C14.67 4.32 11.68 1.33 8 1.33C4.32 1.33 1.33 4.32 1.33 8C1.33 11.68 4.32 14.67 8 14.67ZM9.14 5.53C8.88 5.27 8.46 5.27 8.2 5.53C7.93 5.79 7.93 6.21 8.2 6.47L9.06 7.33H5.33C4.97 7.33 4.67 7.63 4.67 8C4.67 8.37 4.97 8.67 5.33 8.67H9.06L8.2 9.53C7.93 9.79 7.93 10.21 8.2 10.47C8.46 10.73 8.88 10.73 9.14 10.47L11.14 8.47C11.4 8.21 11.4 7.79 11.14 7.53L9.14 5.53Z`,fill:`currentColor`})})}var h=n(`IconPlay`,()=>(0,p.jsx)(`path`,{d:`M20.245 10.2984L9.05099 3.38443C7.71854 2.56145 6 3.51992 6 5.08603V18.914C6 20.4801 7.71854 21.4385 9.05098 20.6156L20.245 13.7016C21.5104 12.9201 21.5104 11.0799 20.245 10.2984Z`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`})),g=n(`IconHammer`,()=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`path`,{d:`M6.70694 14.7929C6.31641 15.1834 5.68325 15.1834 5.29272 14.7929L2.45696 11.9571C2.06643 11.5666 2.06643 10.9334 2.45696 10.5429L9.70694 3.29289C9.89447 3.10536 10.1488 3 10.414 3L14.0857 3C14.3509 3 14.6052 3.10536 14.7928 3.29289L15.7927 4.29286C16.1832 4.68338 16.1832 5.31655 15.7927 5.70707L6.70694 14.7929Z`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,p.jsx)(`path`,{d:`M9.5 12.5L16.3358 19.3358C17.1168 20.1168 18.3832 20.1168 19.1642 19.3358L19.3358 19.1642C20.1168 18.3832 20.1168 17.1168 19.3358 16.3358L12.5 9.5`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})]}));function _({source:e,className:n}){let{Icon:r,iconClassName:a}=i[e];return(0,p.jsx)(r,{"data-source":e,className:t(`size-4 shrink-0`,a,n),"aria-hidden":!0})}var v={Investigate:d,Build:g,"Prepare approval":o,Review:c};function y(e){let t=v[e]??h;return(0,p.jsx)(t,{"aria-hidden":!0})}var b={resting:`neutral`,working:`info`,terminal:`success`},x={neutral:{icon:`text-muted-foreground`,tint:`bg-fill-subtle`,strongTint:`bg-fill-strong`,gradientFrom:`from-fill-subtle`},orange:{icon:`text-(--orange-500) dark:text-(--orange-400)`,tint:`bg-badge-orange-subtle`,strongTint:`bg-badge-orange-strong`,gradientFrom:`from-badge-orange-subtle`},cyan:{icon:`text-(--cyan-500) dark:text-(--cyan-400)`,tint:`bg-badge-cyan-subtle`,strongTint:`bg-badge-cyan-strong`,gradientFrom:`from-badge-cyan-subtle`},info:{icon:`text-info-indicator`,tint:`bg-info-subtle`,strongTint:`bg-badge-blue-strong`,gradientFrom:`from-badge-blue-subtle`},green:{icon:`text-badge-green-indicator`,tint:`bg-badge-green-subtle`,strongTint:`bg-badge-green-strong`,gradientFrom:`from-badge-green-subtle`},purple:{icon:`text-badge-purple-indicator`,tint:`bg-badge-purple-subtle`,strongTint:`bg-badge-purple-strong`,gradientFrom:`from-badge-purple-subtle`},success:{icon:`text-(--green-500) dark:text-(--green-400)`,tint:`bg-success-subtle`,strongTint:`bg-badge-green-strong`,gradientFrom:`from-badge-green-subtle`},destructive:{icon:`text-destructive-indicator`,tint:`bg-destructive-subtle`,strongTint:`bg-badge-red-strong`,gradientFrom:`from-badge-red-subtle`}};function S({source:e,className:n}){return(0,p.jsx)(`span`,{"aria-hidden":!0,style:{maskImage:`url(${e})`},className:t(`size-4 shrink-0 bg-current mask-center mask-no-repeat mask-contain`,n)})}var C=2.25,w=2*Math.PI*C;function T({progress:e,className:n}){return(0,p.jsxs)(`svg`,{width:16,height:16,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,className:t(`shrink-0`,n),children:[(0,p.jsx)(`circle`,{cx:8,cy:8,r:6,stroke:`currentColor`,strokeWidth:1.5}),(0,p.jsx)(`circle`,{cx:8,cy:8,r:C,stroke:`currentColor`,strokeWidth:C*2,strokeDasharray:`${e*w} ${w}`,transform:`rotate(-90 8 8)`})]})}function E(e,t){return t?void 0:a(e)}function D(e,t){return e===`work`||e===`review`?void 0:t}function O(e,t){let n=r(e,t);return e&&n?D(e.id,n):void 0}function k(e,t){let n=E(e,t);return n?s(n):b[t??`resting`]}function A({stage:e,kind:n,className:r}){let i=t(`shrink-0`,r);switch(E(e,n)??n??`resting`){case`intake`:return(0,p.jsx)(m,{className:i});case`triage`:return(0,p.jsx)(S,{source:`/factory-stage-icons/triage.svg`,className:r});case`planning`:return(0,p.jsx)(T,{progress:.25,className:r});case`execute`:case`working`:return(0,p.jsx)(T,{progress:.5,className:r});case`review`:case`pr-review`:return(0,p.jsx)(S,{source:`/factory-stage-icons/review.svg`,className:r});case`done`:case`terminal`:return(0,p.jsx)(f,{"aria-hidden":!0,className:t(`size-icon-md`,i)});case`canceled`:return(0,p.jsx)(u,{"aria-hidden":!0,className:t(`size-icon-md`,i)});case`resting`:return(0,p.jsx)(l,{"aria-hidden":!0,className:t(`size-icon-md`,i)})}}function j(e,t){return x[k(e,t)].tint}function M(e,n){return t(`bg-fill-subtle dark:bg-card bg-linear-to-r to-transparent`,x[k(e,n)].gradientFrom)}function N(e,t){return x[k(e,t)].strongTint}function P(e,t){return x[k(e,t)].icon}var F=`opacity-30`;function I({stage:e,kind:t,decorative:n=!1}){let r=(0,p.jsx)(A,{stage:e,kind:t,className:x[k(e,t)].icon});return n||!t?r:(0,p.jsx)(`span`,{role:`img`,"aria-label":`${t} phase`,className:`inline-flex shrink-0`,children:r})}export{D as a,N as c,h as d,m as f,O as i,j as l,_ as n,P as o,y as r,M as s,I as t,F as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Fr as t,Nr as n,Pr as r,Tr as i,tn as a}from"./index-Btp5jnxM.js";import{n as o,t as s}from"./Breadcrumb.es-DRA_fT-0.js";import{a as c}from"./Sidebar.es-B464rGRm.js";import{$n as l,n as u,ni as d}from"./GithubIcon.es-CIm0nGDf.js";import{r as f}from"./useBoardEditor-DFyQuLCD.js";import{a as p,n as m,s as h,t as g}from"./boardConfigPaths-Btimpi_r.js";import{k as _}from"./TabsRoot-MM_4fh4A.js";import{yt as v}from"./useSessionRows-CIakAaqj.js";import{O as y,T as b,k as x,n as S}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{o as C,s as w,t as T,u as E}from"./settings-C5r2ThW9-DgHKaQxx.js";import{a as D,c as O,d as k,i as A,l as j,n as M,o as N,r as P,t as F,u as I}from"./useRowDrag-B2rvWAzw.js";import{o as L}from"./useIntakeRoutes-C2h717K6.js";import{h as R,p as z}from"./ruleLanes-CB6XWPZ9.js";import{s as B}from"./Field.es-BgoAtL-2.js";import{n as V}from"./useBoardCatalog-DC55UfJd.js";import{t as H}from"./SettingsSubsection-D1Yp4Ujt.js";import{s as U}from"./settingsSections-XZPX_pR6.js";var W=e(x(),1),G=y();function K({factoryId:e}){let t=A(e),n=D(e),r=new Map((V(e).data??[]).map(e=>[e.id,e.name])),i=t.data?.pages??[],a=i.flatMap(e=>e.notRouted),o=i[0]?.canEdit??!1,s=e=>n.mutate(e.id,{onSuccess:t=>v.success(`Filing “${e.title}” on ${r.get(t.boardKey)??t.boardKey}.`),onError:e=>v.error(e.message)}),c=t.isPending?`Loading…`:t.isError?`Items not routed didn’t load.`:t.hasNextPage?`${a.length>0?`${a.length}+`:`More`} waiting for a board.`:a.length===0?`Every new issue and pull request found a board.`:`${a.length} waiting for a board.`;return(0,G.jsxs)(`section`,{id:m,"aria-label":`Not routed`,className:`flex scroll-mt-4 flex-col gap-3 px-3.5 pt-3 pb-3.5`,children:[(0,G.jsx)(C,{media:(0,G.jsx)(w,{children:(0,G.jsx)(j,{})}),title:(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[`Not routed`,(0,G.jsx)(B,{"aria-label":`When an item is not routed`,children:`A new issue or pull request ends up here when no board’s rules take it. Change a board’s rules, then route it again.`})]}),description:c}),(a.length>0||t.hasNextPage)&&(0,G.jsxs)(`ul`,{"aria-label":`Items not routed`,className:`ml-11 flex flex-col`,children:[a.map(t=>(0,G.jsx)(`li`,{className:`border-border border-t py-3`,children:(0,G.jsxs)(C,{title:t.url?(0,G.jsx)(`a`,{href:t.url,target:`_blank`,rel:`noreferrer`,className:`hover:underline`,children:t.title}):t.title,description:(0,G.jsxs)(`span`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:[t.sourceKey&&(0,G.jsx)(`span`,{children:t.sourceKey}),(0,G.jsx)(`span`,{children:t.reason??`No board’s rules match it.`}),(0,G.jsx)(`time`,{dateTime:t.decidedAt,children:q(t.decidedAt)})]}),children:[(0,G.jsx)(M,{factoryProjectId:e,itemId:t.id,label:`Why?`}),o&&(0,G.jsx)(d,{size:`sm`,variant:`ghost`,onClick:()=>s(t),loading:n.isPending&&n.variables===t.id,children:`Route again`})]})},t.id)),t.hasNextPage&&(0,G.jsx)(`li`,{className:`border-border flex justify-center border-t pt-3`,children:(0,G.jsx)(d,{size:`sm`,variant:`ghost`,onClick:()=>void t.fetchNextPage(),loading:t.isFetchingNextPage,children:`Load more`})})]})]})}function q(e){return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}var J=b(`relative before:pointer-events-none before:absolute before:right-0 before:left-0 before:z-20 before:hidden before:h-0.5 before:rounded-full before:bg-border-focus`,`data-[drop=before]:before:top-0 data-[drop=before]:before:block data-[drop=after]:before:bottom-0 data-[drop=after]:before:block`);function Y({factoryId:e}){let t=P(e);return(0,G.jsx)(H,{id:g,scope:`factory`,title:`Intake order`,description:`A new issue or pull request is offered to each board in this order. The first board whose rules take it keeps it.`,children:t.isPending?(0,G.jsx)(T,{children:(0,G.jsx)(E,{label:`Loading intake order`,variant:`item`,rows:3})}):t.isError?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(u,{variant:`destructive`,children:`The intake order didn’t load.`}),(0,G.jsx)(`div`,{className:`border-border rounded-xl border`,children:(0,G.jsx)(K,{factoryId:e})})]}):(0,G.jsx)(X,{factoryId:e,order:t.data},e)})}function X({factoryId:e,order:t}){let n=L(e),r=N(e),[i,a]=(0,W.useState)(),o=t.boards.map(e=>e.boardKey),s=i&&$(i,o)?i:void 0,c=s??o,f=new Map(t.boards.map(e=>[e.boardKey,e.name])),p=s!==void 0&&s.some((e,t)=>e!==o[t]),m=(e,t)=>{let n=[...c],[r]=n.splice(e,1);r!==void 0&&(n.splice(t,0,r),a(n))},g=F({min:0,max:c.length-1,onDrop:m}),_=()=>r.mutate(c,{onSuccess:()=>{a(void 0),v.success(`Intake order saved.`)},onError:e=>v.error(e.message)}),y=t.canEdit&&c.length>1,x=y&&!r.isPending;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(Q,{order:t,changed:p}),n.isError&&(0,G.jsx)(u,{variant:`warning`,children:`Rule counts didn’t load.`}),(0,G.jsxs)(`div`,{className:`border-border flex flex-col rounded-xl border`,children:[(0,G.jsx)(T,{role:`list`,"aria-label":`Intake order`,children:c.map((t,r)=>{let i=g.drag?.from===r,a=f.get(t)??t;return(0,G.jsx)(C,{role:`listitem`,"data-drop":g.dropAt(r),style:i?{transform:`translateY(${g.drag?.offset??0}px)`}:void 0,onPointerDown:x?e=>g.onPointerDown(e,r):void 0,onKeyDown:x?e=>g.onKeyDown(e,r):void 0,className:b(`group/row`,J,i&&`z-10 opacity-90`),media:(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{as:`span`,variant:`caption`,className:b(`tabular-nums`,y&&`pointer-fine:group-hover/row:hidden`,i&&`hidden`),children:r+1}),y&&(0,G.jsx)(`span`,{"data-grip":!0,"aria-hidden":!0,className:b(`text-icon3 hidden cursor-grab touch-none pointer-fine:group-hover/row:inline-flex`,i&&`inline-flex`),children:(0,G.jsx)(O,{className:`size-icon-md`})})]}),title:a,description:(0,G.jsx)(Z,{routes:n.data?.intakeRoutes,boardKey:t}),children:(0,G.jsxs)(`div`,{className:`flex items-center gap-1 transition-opacity pointer-fine:opacity-0 pointer-fine:group-focus-within/row:opacity-100 pointer-fine:group-hover/row:opacity-100`,children:[y&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(d,{size:`icon-sm`,variant:`ghost`,tooltip:`Check earlier`,disabled:!x||r===0,onClick:()=>m(r,r-1),children:(0,G.jsx)(I,{})}),(0,G.jsx)(d,{size:`icon-sm`,variant:`ghost`,tooltip:`Check later`,disabled:!x||r===c.length-1,onClick:()=>m(r,r+1),children:(0,G.jsx)(k,{})})]}),(0,G.jsx)(d,{size:`sm`,variant:`ghost`,render:(0,G.jsx)(l,{to:h(e,t)}),children:`Edit rules`})]})},t)})}),(0,G.jsx)(K,{factoryId:e})]}),t.canEdit&&p&&(0,G.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(d,{size:`sm`,variant:`ghost`,onClick:()=>a(void 0),disabled:r.isPending,children:`Discard`}),(0,G.jsx)(d,{size:`sm`,variant:`primary`,onClick:_,loading:r.isPending,children:`Save order`})]})]})}function Z({routes:e,boardKey:t}){if(!e)return null;let{count:n,catchesAll:r}=z(e.filter(e=>e.target.boardKey===t));return(0,G.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{children:n===0?`No rules for new issues and pull requests`:`${R(n)} for new issues and pull requests`}),r&&(0,G.jsx)(_,{children:`Ends in catch-all`})]})}function Q({order:e,changed:t}){let{compared:n,differing:r,notRouted:i}=e.comparison,a=[];if(e.origin===`derived`&&a.push(`Worked out from the old route list until someone saves an order.`),n>0){let e=i>0?`, ${i} of them Not routed`:``;a.push(r===0?`The last ${n} cards land on the same boards as with the old route list.`:`Of the last ${n} cards, ${r} would land on another board than with the old route list${e}.`)}return e.evaluator===`route-list`&&a.push(`Intake still files cards by the old route list.`),t&&a.push(`Not saved yet. The comparison is for the saved order.`),a.length===0?null:(0,G.jsx)(u,{variant:`info`,children:(0,G.jsx)(`span`,{className:`flex flex-col gap-1`,children:a.map(e=>(0,G.jsx)(`span`,{children:e},e))})})}function $(e,t){let n=new Set(t);return e.length===t.length&&e.every(e=>n.has(e))}function ee(){let e=i(),u=a()?.boardId??``,{isMobile:d,desktopState:m}=c(),h=d||m===`collapsed`,g=f(e.id,u).data?.board,_=n({breadcrumbs:h&&g?(0,G.jsxs)(s,{label:`Breadcrumb`,className:`min-w-0 flex-1 overflow-hidden`,children:[(0,G.jsx)(o,{as:l,to:p(e.id,u),children:g.name}),(0,G.jsx)(o,{as:`span`,isCurrent:!0,children:`Routing`})]}):void 0});return(0,G.jsx)(r,{variant:`settings`,header:(0,G.jsxs)(t,{children:[(0,G.jsx)(t.Title,{children:`Routing`}),(0,G.jsx)(t.Description,{children:(0,G.jsxs)(`span`,{children:[`The order boards are offered new issues and pull requests. What comes in is chosen in`,` `,(0,G.jsx)(l,{to:U(e.id,`intake`),className:`underline`,children:`Settings → Work Intake`}),`.`]})})]}),..._,children:(0,G.jsx)(Y,{factoryId:e.id})})}export{ee as BoardIntakePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$n as t,Fr as n,Jn as r,Kn as i,Nr as a,Pr as o,Tr as s,Yn as c,qn as l,tn as u}from"./index-Btp5jnxM.js";import{n as d,t as f}from"./Breadcrumb.es-DRA_fT-0.js";import{a as p}from"./Sidebar.es-B464rGRm.js";import{$n as m,At as h,Dt as ee,St as g,ir as _,jt as v,kt as y,n as b,ni as x,t as S,wt as C}from"./GithubIcon.es-CIm0nGDf.js";import{r as w,t as T}from"./useBoardEditor-DFyQuLCD.js";import{a as E,i as D,o as O,s as k,t as A}from"./boardConfigPaths-Btimpi_r.js";import{r as j}from"./CompositeItem-DXJX9-KR.js";import{yt as M}from"./useSessionRows-CIakAaqj.js";import{d as N,n as te}from"./settings-C5r2ThW9-DgHKaQxx.js";import{O as P,T as F,k as I,n as L}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{n as R}from"./useBoardCatalog-DC55UfJd.js";import{c as ne,d as re,l as z,n as B,r as ie,s as V,t as H,u as U}from"./useRowDrag-B2rvWAzw.js";import{a as ae,d as oe,f as se,g as W,o as ce,r as G,s as le}from"./useIntakeRoutes-C2h717K6.js";import{C as ue,E as de,_ as fe,a as pe,c as K,d as me,f as he,g as ge,i as _e,l as q,m as ve,n as ye,o as be,s as xe,u as J,w as Se}from"./ruleLanes-CB6XWPZ9.js";import{t as Y}from"./createLucideIcon-BHFyd0LL.js";import{a as Ce,t as we}from"./BoardIcons-ChSrt-Ky.js";import{t as Te}from"./input-DqReKX0A-D66C6dWr.js";import{n as Ee,t as De}from"./RadioGroup.es-DQfIiNtD.js";import{n as Oe,t as ke}from"./ConditionRows-mhryClJA.js";import{i as X,k as Ae}from"./TabsRoot-MM_4fh4A.js";import{E as je}from"./combobox-parts-BVuRAhY6-ClaPtI8E.js";var Me={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};Me.node;var Ne=Y(Me),Pe={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};Pe.node;var Fe=Y(Pe),Ie={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Ie.node;var Le=Y(Ie),Re={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};Re.node;var ze=Y(Re),Be={name:`funnel`,size:24,node:[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]],aliases:[`filter`]};Be.node;var Ve=Y(Be),He={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};He.node;var Ue=Y(He),We={name:`list-ordered`,size:24,node:[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]};We.node;var Ge=Y(We),Ke={name:`log-in`,size:24,node:[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]};Ke.node;var qe=Y(Ke),Je={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Je.node;var Ye=Y(Je),Xe={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};Xe.node;var Ze=Y(Xe),Qe={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};Qe.node;var $e=Y(Qe),Z=e(I(),1),Q=P();function et({when:e,options:t,everything:n}){let r=ue(e,t);return!e||!r?(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,children:n}):(0,Q.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:r.parts.map((t,n)=>{let i=e.conditions[n],a=i&&`conditions`in i?i:void 0;return(0,Q.jsxs)(`span`,{className:`contents`,children:[n>0&&(0,Q.jsx)(L,{as:`span`,variant:`meta`,tone:`muted`,children:r.join}),a?(0,Q.jsxs)(`span`,{className:`border-border inline-flex max-w-full items-center gap-1 rounded-md border border-dashed px-1 py-0.5`,children:[(0,Q.jsx)(L,{as:`span`,variant:`meta`,tone:`muted`,children:a.operator===`OR`?`any of`:`all of`}),(0,Q.jsx)(tt,{children:t.replace(/^\((.*)\)$/,`$1`)})]}):(0,Q.jsx)(tt,{children:t})]},n)})})}function tt({children:e}){return(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`bg-fill max-w-full truncate rounded-sm px-1.5 py-0.5`,children:e})}function nt({boards:e,ownBoard:t,boardKey:n,phaseKey:r}){let a=e.find(e=>e.id===n);if(!a)return(0,Q.jsxs)(L,{as:`span`,variant:`caption`,tone:`muted`,children:[n,` (not installed)`]});let o=r??a.initialPhase,s=a.phases.find(e=>e.id===o);return(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[a.id!==t&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(L,{as:`span`,variant:`caption`,className:`truncate`,children:i(a)}),(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,children:`›`})]}),s&&(0,Q.jsx)(we,{stage:s.id,kind:Ce(a.id,s.kind),decorative:!0}),(0,Q.jsx)(L,{as:`span`,variant:`caption`,className:`truncate`,children:l(a,o)??o})]})}function rt({factoryId:e,rules:t,board:n,boards:a}){return(0,Q.jsxs)(`section`,{"aria-label":`From other boards`,className:`border-border mt-3 flex flex-col gap-1.5 border-t pt-3`,children:[(0,Q.jsxs)(L,{as:`h4`,variant:`meta`,tone:`muted`,className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(qe,{className:`size-icon-xs shrink-0`,"aria-hidden":!0}),`From other boards`]}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:t.map(t=>{let o=a.find(e=>e.id===t.target.boardKey);return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(m,{to:k(e,t.target.boardKey),"aria-label":`${t.name}, on ${o?i(o):t.target.boardKey}`,className:F(`group flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,!t.enabled&&`opacity-50`),children:[(0,Q.jsxs)(`span`,{className:`border-border group-hover:border-border-hover flex w-full min-w-0 flex-col gap-1 rounded-lg border border-dashed px-3 py-2 sm:flex-1`,children:[(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`ink`,className:`truncate font-medium`,children:o?i(o):`${t.target.boardKey} (not installed)`}),(0,Q.jsx)(et,{when:t.when,options:r(o),everything:`Every card`})]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 shrink-0 items-center`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`border-border-strong h-0 w-8 shrink-0 border-t border-dashed`}),(0,Q.jsx)(Ne,{"aria-hidden":!0,className:`text-muted-foreground size-icon-sm mr-2 -ml-1.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`flex w-44 shrink-0 items-center px-3 py-2`,children:(0,Q.jsx)(nt,{boards:a,ownBoard:n.id,boardKey:n.id,phaseKey:t.target.phaseKey})})]}),!t.enabled&&(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,children:`Off`})]})},t.id)})})]})}function it({factoryId:e,boardKey:t,order:n,evaluator:r}){let i=n.some(e=>e.boardKey===t);return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[r===`route-list`?(0,Q.jsx)(L,{as:`p`,variant:`caption`,tone:`muted`,children:`Intake still files new issues and pull requests by the old route list, not by board.`}):i?(0,Q.jsxs)(`ol`,{"aria-label":`Intake order`,className:`flex flex-wrap items-center gap-1`,children:[n.map(n=>(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(`li`,{children:n.boardKey===t?(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`ink`,"aria-current":`step`,className:`bg-surface3 rounded-md px-2 py-0.5 font-medium`,children:n.name}):(0,Q.jsx)(m,{to:k(e,n.boardKey),className:`text-muted-foreground hover:text-foreground rounded-md px-2 py-0.5`,children:(0,Q.jsx)(L,{as:`span`,variant:`caption`,children:n.name})})}),(0,Q.jsx)(Le,{"aria-hidden":!0,className:`text-muted-foreground size-icon-xs shrink-0`})]},n.boardKey)),(0,Q.jsx)(`li`,{children:(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`px-2 py-0.5`,children:`Not routed`})})]}):(0,Q.jsx)(L,{as:`p`,variant:`caption`,tone:`muted`,children:`Not in the intake order: new issues and pull requests never reach these rules.`}),(0,Q.jsxs)(m,{to:O(e,t,A),className:`text-muted-foreground hover:text-foreground flex items-center gap-1.5`,children:[(0,Q.jsx)(Ge,{className:`size-icon-xs shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(L,{as:`span`,variant:`caption`,className:`underline decoration-dotted underline-offset-2`,children:`Reorder`})]})]})}var at=`flex w-full items-start gap-3 rounded-lg border p-3 text-left transition-colors`,ot=`border-border-focus bg-fill-hover`,st=`border-border bg-fill-subtle hover:border-border-hover hover:bg-fill-hover`;function ct({selected:e,disabled:t,onClick:n,children:r}){return(0,Q.jsx)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,onClick:n,className:F(at,`disabled:opacity-50`,e?ot:st),children:r})}function lt({value:e,selected:t,disabled:n,onClick:r,children:i}){let a=(0,Z.useId)();return(0,Q.jsxs)(`label`,{onClick:r,className:F(at,`has-[[role=radio]:focus-visible]:outline-border-focus has-[[role=radio]:focus-visible]:outline-1 has-[[role=radio]:focus-visible]:outline-solid`,t?ot:st,n?`cursor-not-allowed opacity-50`:`cursor-pointer`),children:[(0,Q.jsx)(Ee,{value:e,disabled:n,"aria-labelledby":a,className:`sr-only`}),(0,Q.jsx)(`span`,{id:a,className:`flex min-w-0 items-start gap-3`,children:i})]})}function ut(){return(0,Q.jsx)(Ae,{size:`xs`,variant:`neutral`,emphasis:`subtle`,icon:(0,Q.jsx)(S,{"aria-hidden":`true`}),children:`GitHub only`})}var dt=120,ft=W(le),$=[{id:`trigger`,title:`Trigger`,question:`What should this rule listen for?`},{id:`conditions`,title:`Only if`,question:`Which items should it apply to?`},{id:`action`,title:`Move to`,question:`Where should it go?`},{id:`review`,title:`Review`,question:`Name and check your rule`}];function pt(e,t){let n=e?.phases??[];return t?n.filter(e=>e.kind!==`terminal`):n}function mt(e,t){if(t){let e=ft.safeParse(t);if(!e.success)return e.error.issues[0]?.message}return se(e,t)??void 0}function ht(e,t,n){let r=`When ${e.map(e=>J(e).label.toLowerCase()).join(` or `)}${t?`, ${Se(t).charAt(0).toLowerCase()}${Se(t).slice(1)}`:``}, move to ${n}`;return r.length>dt?`${r.slice(0,119)}…`:r}function gt({factoryId:e,board:t,boards:n,initial:a,initialEvent:o,initialStep:s,readOnly:c,saving:u,error:d,onSave:f,onClose:p}){let m=Oe(e),[_,S]=(0,Z.useState)(()=>a?.on??(o?[o]:[])),[w,T]=(0,Z.useState)(()=>a?.when??null),[E,D]=(0,Z.useState)(()=>(a?.when?.conditions.length??0)>0),[O,k]=(0,Z.useState)(!1),[A,j]=(0,Z.useState)(()=>a?.target.moveToBoardKey??t.id),[M,N]=(0,Z.useState)(()=>a?a.target.phaseKey??void 0:void 0),[te,P]=(0,Z.useState)(()=>a?.name),[I,R]=(0,Z.useState)(s),[ne,re]=(0,Z.useState)(0),z=ve(_),B=n.find(e=>e.id===A),ie=pt(B,z),V=ie.find(e=>e.id===(M??B?.initialPhase)),H=E?w:null,U=_.length?mt(_,H):void 0,ae=V&&B?`${i(B)} › ${l(B,V.id)}`:``,se=te??(V?ht(_,H,ae):``),W={trigger:_.length>0,conditions:_.length>0&&!(E&&O)&&!U,action:V!==void 0,review:se.trim().length>0},ce=!c&&W.trigger&&W.conditions&&W.action&&W.review,G=$.findIndex(e=>e.id===I),le=$[G]??$[0],ue=e=>{S(e),ve(e)&&A!==t.id&&(j(t.id),N(void 0))},fe=()=>{ce&&V&&f({name:se.trim(),on:_,when:H,target:{phaseKey:V.id,moveToBoardKey:A===t.id?null:A}})},pe=()=>{let e={field:`pullRequest.trusted`,operator:`equals`,value:!0};T(H===null?{operator:`AND`,conditions:[e]}:H.operator===`AND`?{...H,conditions:[...H.conditions,e]}:{operator:`AND`,conditions:[H,e]}),D(!0),k(!1),re(e=>e+1)},K={trigger:_.length?_.map(e=>J(e).label).join(`, `):void 0,conditions:_.length?Se(H,r(t)):void 0,action:V?(0,Q.jsx)(nt,{boards:n,ownBoard:t.id,boardKey:A,phaseKey:V.id}):void 0,review:void 0};return(0,Q.jsx)(g,{open:!0,onOpenChange:e=>!e&&p(),children:(0,Q.jsxs)(ee,{size:`xl`,children:[(0,Q.jsx)(h,{children:(0,Q.jsx)(v,{children:c?`Rule`:a?`Edit rule`:`Add rule`})}),(0,Q.jsx)(C,{children:(0,Q.jsxs)(`div`,{className:`grid min-h-105 grid-cols-1 gap-6 sm:grid-cols-[12rem_1fr]`,children:[(0,Q.jsx)(`nav`,{"aria-label":`Rule steps`,className:`sm:border-border flex gap-1 overflow-x-auto sm:flex-col sm:border-r sm:pr-4`,children:$.map((e,t)=>{let n=t===0||$.slice(0,t).every(e=>W[e.id]),r=W[e.id]&&e.id!==`review`;return(0,Q.jsxs)(`button`,{type:`button`,disabled:!n,"aria-current":I===e.id?`step`:void 0,onClick:()=>R(e.id),className:F(`flex shrink-0 items-start gap-2.5 rounded-lg px-2 py-2 text-left transition-colors disabled:opacity-40`,I===e.id?`bg-fill-hover`:`hover:bg-fill-subtle`),children:[(0,Q.jsx)(L,{as:`span`,variant:`meta`,className:F(`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full border`,r?`border-transparent bg-fill-inverse text-background`:`border-border-strong`),children:r?(0,Q.jsx)(Fe,{className:`size-icon-xs`,"aria-hidden":!0}):t+1}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(L,{as:`span`,variant:`label`,tone:`ink`,className:`block`,children:e.title}),K[e.id]&&(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`hidden truncate sm:block`,children:K[e.id]})]})]},e.id)})}),(0,Q.jsxs)(`section`,{"aria-label":le.title,className:`flex min-w-0 flex-col gap-4`,children:[(0,Q.jsx)(L,{as:`h3`,variant:`heading`,children:le.question}),I===`trigger`&&(0,Q.jsx)(yt,{value:_,disabled:c,onChange:ue}),I===`conditions`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(De,{"aria-label":`Which ones`,value:E?`matching`:`every`,disabled:c,onValueChange:e=>{D(e===`matching`),k(!1)},className:`grid-cols-1 sm:grid-cols-2`,children:[(0,Q.jsx)(lt,{value:`every`,selected:!E,disabled:c,children:(0,Q.jsx)(_t,{title:z?`Every new one`:`Every card`,hint:`Run whenever this happens.`})}),(0,Q.jsx)(lt,{value:`matching`,selected:E,disabled:c,children:(0,Q.jsx)(_t,{title:`Only ones that match`,hint:`Narrow it down by repository, label, author and more.`})})]}),E&&(0,Q.jsx)(`div`,{className:`border-border bg-fill-subtle rounded-xl border p-3`,children:(0,Q.jsx)(ke,{label:`Conditions`,rule:w,facts:de(_),options:{...r(t),"source.repository":m},onChange:(e,t)=>{T(e),k(t)}},ne)}),U&&(0,Q.jsx)(b,{variant:`warning`,children:U}),!a?.outsiderPullRequestsGated&&oe(_,H)&&(0,Q.jsx)(b,{variant:`info`,children:(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,Q.jsx)(`span`,{children:`Also matches pull requests from outside authors.`}),!c&&(0,Q.jsx)(`button`,{type:`button`,onClick:pe,className:`shrink-0 underline`,children:`Add: Pull request trusted is yes`})]})})]}),I===`action`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[z?(0,Q.jsx)(L,{as:`p`,variant:`caption`,tone:`muted`,children:`An item with no card yet can only be filed on this board.`}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(L,{as:`span`,variant:`eyebrow`,tone:`muted`,children:`Board`}),(0,Q.jsx)(De,{"aria-label":`Board`,value:A,disabled:c,onValueChange:e=>{typeof e==`string`&&e!==A&&(j(e),N(void 0))},className:`grid-cols-1 sm:grid-cols-3`,children:n.map(e=>(0,Q.jsx)(lt,{value:e.id,selected:e.id===A,disabled:c,children:(0,Q.jsxs)(L,{as:`span`,variant:`label`,tone:`ink`,children:[i(e),e.id===t.id?` (this board)`:``]})},e.id))})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(L,{as:`span`,variant:`eyebrow`,tone:`muted`,children:`Phase`}),(0,Q.jsx)(De,{"aria-label":`Phase`,value:V?.id??null,disabled:c,onValueChange:e=>typeof e==`string`&&N(e),className:`grid-cols-1 sm:grid-cols-2`,children:B&&ie.map(e=>(0,Q.jsx)(lt,{value:e.id,selected:e.id===V?.id,disabled:c,onClick:()=>{N(e.id),R(`review`)},children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(we,{stage:e.id,kind:Ce(B.id,e.kind),decorative:!0}),(0,Q.jsx)(L,{as:`span`,variant:`label`,tone:`ink`,children:l(B,e.id)})]})},e.id))})]})]}),I===`review`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(L,{as:`span`,variant:`label`,tone:`muted`,children:`Name`}),(0,Q.jsx)(Te,{value:se,maxLength:dt,disabled:c,onChange:e=>P(e.target.value)})]}),(0,Q.jsxs)(`div`,{className:`border-border bg-fill-subtle rounded-xl border p-4`,children:[(0,Q.jsx)(L,{as:`span`,variant:`eyebrow`,tone:`muted`,className:`mb-3 block`,children:`This rule reads as`}),(0,Q.jsxs)(`ol`,{className:`flex flex-col gap-3`,children:[(0,Q.jsx)(vt,{label:`When`,children:K.trigger}),(0,Q.jsx)(vt,{label:`Only if`,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(Ve,{className:`text-muted-foreground size-icon-sm`,"aria-hidden":!0}),K.conditions]})}),(0,Q.jsx)(vt,{label:`Then`,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Move to `,(0,Q.jsx)(Ne,{className:`size-icon-sm`,"aria-hidden":!0}),` `,K.action]})})]})]})]}),d&&(0,Q.jsx)(b,{variant:`destructive`,role:`alert`,children:d})]})]})}),(0,Q.jsxs)(y,{children:[(0,Q.jsx)(x,{variant:`ghost`,onClick:p,children:c?`Close`:`Cancel`}),(0,Q.jsx)(`div`,{className:`flex-1`}),G>0&&(0,Q.jsx)(x,{variant:`default`,onClick:()=>R($[G-1].id),children:`Back`}),!c&&(I===`review`||a&&ce?(0,Q.jsx)(x,{variant:`primary`,disabled:!ce,onClick:fe,loading:u,children:a?`Save rule`:`Create rule`}):(0,Q.jsx)(x,{variant:`primary`,disabled:!W[I],onClick:()=>R($[G+1]?.id??`review`),children:`Continue`}))]})]})})}function _t({title:e,hint:t}){return(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(L,{as:`span`,variant:`label`,tone:`ink`,className:`block`,children:e}),(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`block`,children:t})]})}function vt({label:e,children:t}){return(0,Q.jsxs)(`li`,{className:`grid grid-cols-[4.5rem_1fr] items-start gap-3`,children:[(0,Q.jsx)(L,{as:`span`,variant:`body-sm`,tone:`muted`,children:e}),(0,Q.jsx)(L,{as:`span`,variant:`body-sm`,children:t})]})}function yt({value:e,disabled:t,onChange:n}){return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[e.includes(`work_item.created`)&&(0,Q.jsxs)(b,{variant:`info`,children:[`Also listens on “`,J(`work_item.created`).label,`”, which takes new issues and pull requests. Saving keeps it.`]}),ye.map(r=>(0,Q.jsxs)(`div`,{role:`group`,"aria-label":r.title,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(L,{as:`span`,variant:`eyebrow`,tone:`muted`,children:r.title}),(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2`,children:r.events.map(r=>{let i=J(r),a=i.icon,o=e.includes(r);return(0,Q.jsxs)(ct,{selected:o,disabled:t||o&&e.length===1,onClick:()=>n(o?e.filter(e=>e!==r):[...e,r]),children:[(0,Q.jsx)(a,{className:`text-badge-amber-indicator mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(_t,{title:i.label,hint:i.description}),i.githubOnly&&(0,Q.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,Q.jsx)(ut,{})})]},r)})})]},r.title))]})}function bt({count:e,into:t,leaving:n,showAll:r}){let i=n?`sending cards to ${t}`:`moving cards into ${t}`;return(0,Q.jsxs)(`div`,{className:`border-border flex items-center gap-2 rounded-lg border px-3 py-2`,children:[(0,Q.jsx)(Ue,{className:`size-icon-md text-muted-foreground shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(L,{as:`p`,variant:`body-sm`,tone:e===void 0?`muted`:`ink`,className:`flex-1`,children:e===void 0?`Couldn’t pick out the rules ${i}, so every rule is shown.`:e===0?`No rule is ${i}.`:`Only the ${e===1?`rule`:`${e} rules`} ${i}.`}),(0,Q.jsx)(x,{size:`sm`,variant:`ghost`,render:(0,Q.jsx)(m,{to:r}),children:`Show all`})]})}var xt=F(`relative before:pointer-events-none before:absolute before:right-0 before:left-0 before:z-20 before:hidden before:h-0.5 before:rounded-full before:bg-border-focus`,`data-[drop=before]:before:-top-1 data-[drop=before]:before:block data-[drop=after]:before:-bottom-1 data-[drop=after]:before:block`);function St({event:e,rules:t,board:n,boards:r,phaseOptions:a,canEdit:o,skips:s,footer:c,incoming:u,only:d,onEdit:f,onAdd:p,onMove:m,onToggle:h,onDelete:ee,onUngate:g}){let _=J(e),v=_.icon,y=pe(t,e),b=K(e),S=be(e),C=H({min:0,max:t.length-1,onDrop:m}),w=o&&t.length>1&&!d,T=c??(t.length?`Otherwise, the card stays where it is`:u?`No rules: this board’s cards stay where they are`:`No rules: the card stays where it is`);return(0,Q.jsxs)(`section`,{"aria-label":_.label,className:F(`flex flex-col gap-3 rounded-xl border border-border bg-card p-4`,!t.length&&!u&&`opacity-60 focus-within:opacity-100 hover:opacity-100`),children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(v,{className:`text-badge-amber-indicator size-3.5 shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(L,{as:`h3`,variant:`label`,tone:`ink`,children:_.label}),_.githubOnly&&(0,Q.jsx)(ut,{})]}),_.description&&(0,Q.jsx)(L,{as:`p`,variant:`caption`,tone:`muted`,children:_.description})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsxs)(`ol`,{"aria-label":`${_.label} rules`,className:`flex min-w-0 flex-col`,children:[t.map((c,u)=>{if(d&&!d.has(c.id))return null;let p=ge(t,e,u),v=p>=0,T=!c.enabled||v,E=C.drag?.from===u,D=s?.get(c.id),O=r.find(e=>e.id===(c.target.moveToBoardKey??c.target.boardKey)),k=!he(c.name,[_.label,Se(c.when,a),O&&i(O),l(O,c.target.phaseKey)].join(` `));return(0,Q.jsxs)(`li`,{"aria-label":c.name,"data-drop":C.dropAt(u),style:E?{transform:`translateY(${C.drag?.offset??0}px)`}:void 0,onPointerDown:w?e=>C.onPointerDown(e,u):void 0,className:F(`group/rule flex flex-col`,xt,E&&`z-10 opacity-90`),children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[(0,Q.jsxs)(`div`,{className:`relative min-w-0 sm:flex-1`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Edit conditions of ${c.name}`,onClick:()=>f(c,`conditions`),onKeyDown:w?e=>C.onKeyDown(e,u):void 0,className:F(`flex w-full items-start gap-2.5 rounded-lg border bg-fill-subtle px-3 py-2 text-left transition-colors hover:border-border-hover`,T?`border-dashed border-border opacity-50`:`border-border`),children:[(0,Q.jsxs)(L,{as:`span`,variant:`meta`,tone:`muted`,className:`bg-fill mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full tabular-nums`,children:[(0,Q.jsx)(`span`,{className:F(w&&`pointer-fine:group-hover/rule:hidden`,E&&`hidden`),children:u+1}),w&&(0,Q.jsx)(`span`,{"data-grip":!0,"aria-hidden":!0,className:F(`hidden cursor-grab touch-none pointer-fine:group-hover/rule:flex`,E&&`flex`),children:(0,Q.jsx)(ne,{className:`size-icon-sm`})})]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[k&&(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`ink`,className:`truncate font-medium`,children:c.name}),(0,Q.jsx)(et,{when:c.when,options:a,everything:S})]})]}),w&&(0,Q.jsxs)(`div`,{className:`border-border bg-card absolute top-0 right-2 flex -translate-y-1/2 rounded-md border shadow-sm transition-opacity pointer-fine:opacity-0 pointer-fine:group-focus-within/rule:opacity-100 pointer-fine:group-hover/rule:opacity-100`,children:[(0,Q.jsx)(x,{variant:`ghost`,size:`icon-sm`,tooltip:`Check earlier`,disabled:u===0,onClick:()=>m(u,u-1),children:(0,Q.jsx)(U,{})}),(0,Q.jsx)(x,{variant:`ghost`,size:`icon-sm`,tooltip:`Check later`,disabled:u===t.length-1,onClick:()=>m(u,u+1),children:(0,Q.jsx)(re,{})})]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 sm:shrink-0`,children:[(0,Q.jsxs)(`div`,{className:F(`flex min-w-0 items-center`,T&&`opacity-40`),children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:F(`h-px w-8 shrink-0`,T?`border-t border-dashed border-border-strong`:`bg-muted-foreground`)}),(0,Q.jsx)(Ne,{"aria-hidden":!0,className:`text-muted-foreground size-icon-sm mr-2 -ml-1.5 shrink-0`}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Edit where ${c.name} moves the card`,onClick:()=>f(c,`action`),className:`border-border bg-fill-subtle hover:border-border-hover flex w-44 shrink-0 rounded-lg border px-3 py-2 text-left`,children:(0,Q.jsx)(nt,{boards:r,ownBoard:n.id,boardKey:c.target.moveToBoardKey??c.target.boardKey,phaseKey:c.target.phaseKey})})]}),o&&(0,Q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5`,children:[(0,Q.jsx)(je,{"aria-label":`${c.name} on`,checked:c.enabled,onCheckedChange:e=>h(c,e)}),(0,Q.jsxs)(X,{children:[(0,Q.jsx)(X.Trigger,{render:(0,Q.jsx)(x,{variant:`ghost`,size:`icon-sm`,tooltip:`More for ${c.name}`,children:(0,Q.jsx)(ze,{})})}),(0,Q.jsx)(X.Content,{align:`end`,children:(0,Q.jsxs)(X.Item,{variant:`destructive`,onClick:()=>ee(c),children:[(0,Q.jsx)(Ze,{}),`Delete rule`]})})]})]})]})]}),T&&(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3 flex items-center gap-1.5`,children:v?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($e,{className:`text-warning-indicator size-icon-xs`,"aria-hidden":!0}),`Never reached: rule `,p+1,` above matches `,S.toLowerCase(),`.`]}):`Off, skipped`}),c.problems.map(e=>(0,Q.jsxs)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3 flex items-center gap-1.5`,children:[(0,Q.jsx)($e,{className:`text-warning-indicator size-icon-xs shrink-0`,"aria-hidden":!0}),e]},e)),D&&(0,Q.jsx)(wt,{skips:D}),fe(c,e)&&(0,Q.jsxs)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3 flex flex-wrap items-center gap-x-1.5 gap-y-1`,children:[`Skips outside authors’ pull requests (older rule).`,o&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>g(c),className:`underline`,children:`Let outside authors match`})]}),me(c,e)&&(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3`,children:`Moves cards only: files no new pull requests`}),b&&xe(c)&&(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3`,children:J(`work_item.created`).label}),u!==y&&!d&&(0,Q.jsxs)(`div`,{"aria-hidden":!0,className:`flex h-7 items-center pl-5.5`,children:[(0,Q.jsx)(`span`,{className:`bg-border-strong h-full w-px`}),(0,Q.jsx)(L,{as:`span`,variant:`meta`,tone:`muted`,className:`ml-2`,children:`no`})]})]},c.id)}),!d&&(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3`,children:[y<0&&(0,Q.jsxs)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`flex flex-1 items-center gap-2.5 px-3 py-1.5`,children:[(0,Q.jsx)(z,{className:`size-icon-md shrink-0`,"aria-hidden":!0}),T]}),o&&(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(Ye,{}),onClick:p,children:`Add rule`})]})]}),u]})]})}function Ct(e){return e?.match(/was skipped: (.+?)\.?$/)?.[1]??e??`its target couldn’t take the card`}function wt({skips:e}){let{count:t,latest:n}=e;return(0,Q.jsxs)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3 flex flex-wrap items-center gap-x-1.5 gap-y-1`,children:[(0,Q.jsx)($e,{className:`text-warning-indicator size-icon-xs shrink-0`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[`Skipped `,t===1?`once`:`${t} times`,` in the last 30 days: `,Ct(n.reason),`.`]}),n.url?(0,Q.jsxs)(`a`,{href:n.url,target:`_blank`,rel:`noreferrer`,className:`underline`,children:[`Latest: `,n.title]}):(0,Q.jsxs)(`span`,{children:[`Latest: `,n.title]})]})}var Tt=new Set([`revision_mismatch`,`intake_route_set_mismatch`,`intake_route_not_found`]);function Et(e){return e instanceof T&&e.code!==void 0&&Tt.has(e.code)}function Dt(e){return Et(e)?`Someone else changed these rules first. They have been reloaded; try again.`:e instanceof Error?e.message:`The change didn’t save.`}function Ot({factoryId:e,boardId:t}){let n=R(e),r=n.data?.find(e=>e.id===t);return n.isPending?(0,Q.jsx)(j,{className:`h-64 w-full`}):n.isError?(0,Q.jsx)(b,{variant:`destructive`,children:`Boards didn’t load.`}):r?(0,Q.jsx)(kt,{factoryId:e,board:r,boards:n.data},`${e}:${r.id}`):(0,Q.jsx)(b,{variant:`warning`,children:`This board isn’t installed.`})}function kt({factoryId:e,board:n,boards:i}){let a=G(e,n.id),o=ce(e),s=ie(e),u=V(e),d=ae(e),[f,p]=(0,Z.useState)(),m=(0,Z.useRef)(void 0),h=e=>{m.current=e,p(e)},[ee,g]=(0,Z.useState)(),v=a.data?.intakeRoutes??[],y=a.data?.canEdit??!1,x=r(n),S=(o.data?.intakeRoutes??[]).filter(e=>e.target.moveToBoardKey===n.id&&e.target.boardKey!==n.id),C=new Map(u.data?.skipped.map(e=>[e.routeId,e])),[w]=_(),T=w.get(`into`)??void 0,E=w.has(D),O=E||T!==void 0,A=O&&o.data?t(o.data.intakeRoutes,{key:n.id,initialPhase:n.initialPhase}):void 0,P=A&&new Set((E?A.leaving:A.into.get(T??``)??[]).map(e=>e.id)),F=e=>!P||e.some(e=>P.has(e.id));if(a.isPending||O&&o.isPending)return(0,Q.jsx)(j,{className:`h-64 w-full`});if(a.isError)return(0,Q.jsx)(b,{variant:`destructive`,children:`This board’s rules didn’t load.`});let I=e=>d.mutateAsync(e).catch(e=>M.error(Dt(e))),L=(e,t,r)=>{let i=q(v,e).map(e=>e.id);I([{kind:`reorder`,boardKey:n.id,ids:c(v,i,t,r)}])},R=e=>{g(void 0),h(e)},ne=async e=>{let t=m.current,r=t?.rule,i=()=>t!==void 0&&m.current===t;g(void 0);try{if(r)await d.mutateAsync([{kind:`update`,id:r.id,patch:{name:e.name,on:e.on,when:e.when,target:{boardKey:r.target.boardKey,...e.target,joinClosedIssue:r.target.joinClosedIssue},expectedRevision:r.revision}}]);else{let[t]=await d.mutateAsync([{kind:`create`,route:{...e,target:{boardKey:n.id,...e.target}}}]);i()&&h(void 0),t&&await z(t,e.on).catch(e=>M.error(Dt(e)));return}i()&&h(void 0)}catch(e){if(!i())return;if(r&&Et(e))return re(r);g(Dt(e))}},re=async e=>{let t=m.current,n=(await a.refetch()).data?.intakeRoutes.find(t=>t.id===e.id);t&&m.current===t&&(n?(h({...t,rule:n}),g(`Someone else changed this rule first. It now shows their version; make your change again.`)):(h(void 0),M.error(`Someone else deleted this rule first.`)))},z=async(e,t)=>{if(e.target.boardKey!==n.id)return;let r=(await a.refetch()).data?.intakeRoutes??[],i=r.map(e=>e.id),o=i.indexOf(e.id),s=t.flatMap(t=>{let n=q(r,t),a=n[ge(n,t,n.findIndex(t=>t.id===e.id))];return a?[i.indexOf(a.id)]:[]}),l=Math.min(...s);o<0||!(l<o)||await d.mutateAsync([{kind:`reorder`,boardKey:n.id,ids:c(r,i,o,l)}])},B=s.data?.evaluator===`route-list`?`Otherwise: the old route list decides`:_e(s.data?.boards,n.id);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[o.isError&&(0,Q.jsx)(b,{variant:`warning`,children:`Rules on other boards that move cards here didn’t load, so they aren’t shown.`}),O&&(0,Q.jsx)(bt,{count:P?.size,into:E||!T?`other boards`:l(n,T)??T,leaving:E,showAll:k(e,n.id)}),ye.filter(e=>e.events.some(e=>F([...q(v,e),...q(S,e)]))).map(t=>(0,Q.jsxs)(`section`,{"aria-label":t.title,className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(N,{children:t.title}),t.events.some(K)?s.data&&(0,Q.jsx)(it,{factoryId:e,boardKey:n.id,order:s.data.boards,evaluator:s.data.evaluator}):(0,Q.jsx)(te,{children:`Only cards already on this board; other boards never see them.`})]}),t.events.map(t=>{let r=K(t),a=q(v,t),o=q(S,t).filter(e=>!P||P.has(e.id));return F([...a,...o])?(0,Q.jsx)(St,{event:t,rules:a,board:n,boards:i,phaseOptions:x,canEdit:y,skips:C,footer:r?B:void 0,only:P,incoming:o.length?(0,Q.jsx)(rt,{factoryId:e,rules:o,board:n,boards:i}):void 0,onEdit:(e,t)=>R({rule:e,step:t}),onAdd:()=>R({event:t,step:`conditions`}),onMove:(e,n)=>L(t,e,n),onToggle:(e,t)=>void I([{kind:`update`,id:e.id,patch:{enabled:t,expectedRevision:e.revision}}]),onDelete:e=>void I([{kind:`delete`,id:e.id,expectedRevision:e.revision}]).then(t=>t&&M.success(`Deleted “${e.name}”`)),onUngate:e=>void I([{kind:`update`,id:e.id,patch:{outsiderPullRequestsGated:!1,expectedRevision:e.revision}}]).then(t=>t&&M.success(`“${e.name}” now matches outside authors’ pull requests`))},t):null})]},t.title)),f&&(0,Q.jsx)(gt,{factoryId:e,board:n,boards:i,initial:f.rule,initialEvent:f.event,initialStep:f.step,readOnly:!y,saving:d.isPending,error:ee,onSave:e=>void ne(e),onClose:()=>h(void 0)},f.rule?`${f.rule.id}:${f.rule.revision}`:`new-${f.event}`)]})}function At(){let e=s(),t=u()?.boardId??``,{isMobile:r,desktopState:i}=p(),c=r||i===`collapsed`,l=w(e.id,t).data?.board,h=a({breadcrumbs:c&&l?(0,Q.jsxs)(f,{label:`Breadcrumb`,className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(d,{as:m,to:E(e.id,t),children:l.name}),(0,Q.jsx)(d,{as:`span`,isCurrent:!0,children:`Rules`})]}):void 0});return(0,Q.jsx)(o,{variant:`settings`,header:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(n,{children:[(0,Q.jsx)(n.Title,{children:`Rules`}),(0,Q.jsx)(n.Description,{children:`What happens to issues and pull requests on this board. In each lane the first matching rule wins.`})]}),(0,Q.jsx)(`div`,{className:`mt-3`,children:(0,Q.jsx)(B,{factoryProjectId:e.id,label:`Test an issue or pull request`})})]}),...h,children:(0,Q.jsx)(Ot,{factoryId:e.id,boardId:t})})}export{At as BoardRulesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Ei as t,Jt as n,Mi as r,qt as i}from"./GithubIcon.es-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Ei as t,Jt as n,Mi as r,qt as i}from"./GithubIcon.es-CIm0nGDf.js";import{O as a,T as o,k as s,o as c}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{r as l}from"./CompositeItem-DXJX9-KR.js";import{t as u}from"./popup-anchor.es-g9MI9mVW.js";var d=e(s(),1),f=a(),p=e=>(0,f.jsx)(`svg`,{width:`19.125`,height:`18`,viewBox:`-1.0625 -1 19.125 18`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,f.jsx)(`path`,{d:`M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z`,fill:`currentColor`})}),m=({children:e,label:t,className:n,listClassName:r})=>(0,f.jsx)(`nav`,{"aria-label":t,className:n,children:(0,f.jsx)(`ol`,{className:o(`flex items-center gap-0.5`,r),children:e})}),h=e=>(0,f.jsx)(l,{className:`h-3 w-24`,...e}),g=({className:e,as:a,to:s,href:l,isCurrent:m,action:g,switcher:_,icon:v,isLoading:y,children:b,...x})=>{let S=a||`span`,C=!(!_||!m&&(s||l)),w=d.useRef(null);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`li`,{ref:w,className:o(`group flex h-control-sm min-w-0 items-center`,m?`shrink`:`shrink-0`,C&&`relative rounded-full has-[[data-slot=crumb-switcher]_[data-popup-open]]:bg-fill-subtle has-[[data-slot=crumb-switcher]_button:enabled]:hover:bg-fill-subtle has-[[data-slot=crumb-switcher]_button:enabled]:active:bg-fill`),children:[(0,f.jsxs)(S,{"aria-current":m?`page`:void 0,className:o(`inline-flex min-w-0 items-center gap-2 overflow-hidden rounded-full px-[.9em]`,t.sm,c,m?`max-w-xs cursor-default text-foreground`:C?o(n,`max-w-48`):o(i,`max-w-48 cursor-pointer hover:bg-fill-subtle active:bg-fill`),e),to:s,href:l,...x,children:[v&&(0,f.jsx)(r,{className:o(`ml-[-.3em] shrink-0 opacity-50 group-hover:opacity-100`,`transition-opacity duration-normal ease-out-custom`),children:v}),y?(0,f.jsx)(h,{}):(0,f.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:b})]}),_&&(0,f.jsx)(`span`,{"data-slot":`crumb-switcher`,className:o(`-ml-1 flex h-control-sm shrink-0 items-center`,C&&`[&_button]:bg-transparent! [&_button:enabled]:after:absolute [&_button:enabled]:after:inset-0 [&_button:enabled]:after:rounded-full`),children:(0,f.jsx)(u,{value:w,children:_})}),g&&(0,f.jsx)(`span`,{className:`-ml-1 flex h-control-sm shrink-0 items-center`,children:g})]}),!m&&(0,f.jsx)(`li`,{role:`separator`,className:`flex h-full items-center`,children:(0,f.jsx)(r,{className:`text-subtle-foreground`,children:(0,f.jsx)(p,{})})})]})};export{g as n,m as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Bs as t,Is as n,Ls as r,Si as i,js as a}from"./GithubIcon.es-CIm0nGDf.js";import{O as o,T as s,c,k as l}from"./IconChevronRightMedium.es-BkPdzxSm.js";var u=e(l(),1),d=o(),f=s(`motion-safe:not-disabled:not-aria-disabled:hover:[&_[data-emphasis=grow-y]]:scale-y-125`,`motion-safe:not-disabled:not-aria-disabled:hover:[&_[data-emphasis=grow-x]]:scale-x-125`,`motion-safe:not-disabled:not-aria-disabled:hover:[&_[data-emphasis=pop]]:scale-110`,`motion-safe:not-disabled:not-aria-disabled:focus-visible:[&_[data-emphasis=grow-y]]:scale-y-125`,`motion-safe:not-disabled:not-aria-disabled:focus-visible:[&_[data-emphasis=grow-x]]:scale-x-125`,`motion-safe:not-disabled:not-aria-disabled:focus-visible:[&_[data-emphasis=pop]]:scale-110`),p=t(s(n,`rounded-xl transition-all duration-normal ease-out-custom motion-reduce:transition-none`),{variants:{elevation:{flat:`shadow-none`,raised:``},interactive:{true:s(r,i,f,`cursor-pointer active:scale-99 aria-[current=true]:[--surface-rim:var(--border-focus)]`),false:``}},compoundVariants:[{elevation:`flat`,interactive:!0,class:s(c,`aria-[current=true]:outline-1 aria-[current=true]:-outline-offset-1 aria-[current=true]:outline-border-focus aria-[current=true]:outline-solid`)}],defaultVariants:{elevation:`raised`,interactive:!1}}),m=u.forwardRef(({className:e,elevation:t,interactive:n,as:r,...i},a)=>{let o=r||(n?`button`:`div`);return(0,d.jsx)(o,{ref:a,type:o===`button`?`button`:void 0,className:s(p({elevation:t,interactive:n}),e),...i})});m.displayName=`Card`;function h({className:e,elevation:t,LinkComponent:n=`a`,...r}){return(0,d.jsx)(n,{className:s(p({elevation:t,interactive:!0}),e),...r})}var g=u.forwardRef(({className:e,...t},n)=>(0,d.jsx)(`div`,{ref:n,className:s(`flex flex-col space-y-1.5 px-3 py-1`,e),...t}));g.displayName=`CardHeader`;var _=u.forwardRef(({className:e,...t},n)=>(0,d.jsx)(`h3`,{ref:n,className:s(`text-subheading text-foreground`,e),...t}));_.displayName=`CardTitle`;var v=u.forwardRef(({className:e,...t},n)=>(0,d.jsx)(`p`,{ref:n,className:s(`text-caption text-muted-foreground`,e),...t}));v.displayName=`CardDescription`;var y=t(``,{variants:{density:{default:`p-3`,compact:`p-2`}},defaultVariants:{density:`default`}}),b=u.forwardRef(({className:e,density:t,...n},r)=>(0,d.jsx)(`div`,{ref:r,className:s(y({density:t}),e),...n}));b.displayName=`CardContent`;var x=u.forwardRef(({className:e,...t},n)=>(0,d.jsx)(`div`,{ref:n,className:s(`flex items-center p-3 pt-0`,e),...t}));x.displayName=`CardFooter`;var S=u.forwardRef(({className:e,as:t=`div`,...n},r)=>(0,d.jsx)(t,{ref:r,className:s(a,`overflow-hidden rounded-lg bg-nested px-3 *:py-3 [&>*+*]:border-t [&>*+*]:border-separator`,e),...n}));S.displayName=`CardInset`;export{b as n,h as r,m as t};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-Sr6WSEaV.js","assets/rolldown-runtime-XKyaHtl9.js","assets/dist-6WNNvkM4.js","assets/dist-B5wMYzWI.js","assets/dist-D1JI_ikE.js","assets/dist-DtnqB3m_.js","assets/dist-CMX7_OjZ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{O as t,T as n,b as r,d as i,f as a,k as o,m as s,o as c,s as l,u,v as d}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{Bs as f,Ds as p,Fi as m,Gt as h,Ii as g,Li as _,Lo as v,Oo as y,Os as b,Pi as x,Qa as S,Ra as C,Ti as w,Tn as T,Wi as E,ao as D,ci as O,cs as k,di as ee,ds as A,fs as j,is as M,ls as N,no as P,ns as te,oi as F,os as I,qn as L,qt as ne,ra as re}from"./GithubIcon.es-CIm0nGDf.js";import{a as ie,i as R,n as z,r as B,t as ae}from"./select-BPzTS5dZ-BGYcBcgg.js";import{n as oe}from"./CompositeItem-DXJX9-KR.js";import{i as V,n as H,r as U,t as se}from"./TabsRoot-MM_4fh4A.js";import{n as ce,t as le}from"./CompositeRoot-COSYbRmu.js";import{t as ue}from"./copy-button-C3L1ZoAD-DpbBeGOv.js";import{n as de}from"./index.module-Dtojw6Gd.js";import{a as W,i as fe,m as pe,n as me}from"./dist-6WNNvkM4.js";import{t as G}from"./preload-helper-BLdHbfdN.js";var K=e(o(),1),q=t(),he=re();function ge(e){let t=I(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=A(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(S(n)!==a||S(r)!==o)&&(n=a,r=o),{width:n,height:r}}var _e=K.createContext(void 0);function ve(){let e=K.useContext(_e);if(e===void 0)throw Error(p(65));return e}var ye=K.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:o,nativeButton:c=!0,style:l,...u}=e,{value:d,getTabPanelIdByValue:f,onValueChange:p,orientation:m,tabActivationDirection:h}=U(),{activateOnFocus:g,registerTabResizeObserverElement:_,tabsListElement:x}=ve(),{highlightedIndex:S,onHighlightedIndexChange:C}=ee(),w=E(o),T=K.useMemo(()=>({disabled:r,id:w,value:a}),[r,w,a]),{compositeProps:k,compositeRef:A,index:j}=oe({metadata:T}),N=a===d,F=K.useRef(!1),I=K.useRef(null),L=D(e=>{I.current?.(),I.current=e?_(e):null});b(()=>{if(F.current){F.current=!1;return}if(!(N&&j>-1&&S!==j))return;let e=x;if(e!=null){let t=te(P(e));if(t&&M(e,t))return}r||C(j)},[N,j,S,C,r,x]);let{getButtonProps:ne,buttonRef:re}=O({disabled:r,native:c,focusableWhenDisabled:!0}),ie=f(a),R=K.useRef(!1),z=K.useRef(!1);function B(e){p(a,v(y,e.nativeEvent,void 0,{activationDirection:`none`}))}function ae(e){N||r||B(e)}function V(e){N||r||g&&(!R.current||z.current)&&B(e)}function se(e){if(N||r)return;R.current=!0,z.current=e.button===0;let t=P(e.currentTarget);function n(){R.current=!1,z.current=!1,t.removeEventListener(`pointerup`,n),t.removeEventListener(`pointercancel`,n)}t.addEventListener(`pointerup`,n),t.addEventListener(`pointercancel`,n)}return s(`button`,e,{state:{disabled:r,active:N,orientation:m,tabActivationDirection:h},ref:[t,re,A,L],props:[k,{role:`tab`,"aria-controls":ie,"aria-selected":N,id:w,onClick:ae,onFocus:V,onPointerDown:se,[ce]:N?``:void 0,onKeyDownCapture(){F.current=!0}},u,ne],stateAttributesMapping:H})}),be=()=>()=>{},xe=()=>!0,Se=()=>!1;function Ce(){return(0,he.useSyncExternalStore)(be,xe,Se)}function we(){let[e,t]=K.useState(!1);return K.useEffect(()=>{t(!0)},[]),e}var Te=d(18)?Ce:we;function Ee(){return!Te()}function De(e){let{script:t}=e,{nonce:n}=h();return Ee()?(0,q.jsx)(`script`,{nonce:n,dangerouslySetInnerHTML:{__html:t},suppressHydrationWarning:!0}):null}var Oe=`--active-tab-left`,ke=`--active-tab-right`,Ae=`--active-tab-top`,je=`--active-tab-bottom`,Me=`--active-tab-width`,Ne=`--active-tab-height`,Pe,Fe={...H,activeTabPosition:()=>null,activeTabSize:()=>null},Ie=2,Le=K.forwardRef(function(e,t){let{className:n,render:r,renderBeforeHydration:i=!1,style:a,...o}=e,{getTabElementBySelectedValue:c,orientation:l,tabActivationDirection:u,value:d}=U(),{tabsListElement:f,registerIndicatorUpdateListener:p}=ve(),m=C();K.useEffect(()=>p(m),[p,m]);let h=0,g=0,_=0,v=0,y=0,b=0,x=!1;if(d!=null&&f!=null){let e=c(d);if(e!=null){x=!0;let{width:t,height:n}=ge(e),{width:r,height:i}=ge(f),a=e.getBoundingClientRect(),o=f.getBoundingClientRect(),s=r>0?o.width/r:1,c=i>0?o.height/i:1,l=Re(e,f);h=l.left,_=l.top;let u=(a.left-o.left)/s+f.scrollLeft-f.clientLeft,d=(a.top-o.top)/c+f.scrollTop-f.clientTop,p=Be(e);Math.abs(u-p.x-h)<=Ie&&Math.abs(d-p.y-_)<=Ie&&(h=u,_=d),y=t,b=n,g=f.scrollWidth-h-y,v=f.scrollHeight-_-b}}let S=x?{left:h,right:g,top:_,bottom:v}:null,w=x?{width:y,height:b}:null,T=x?{[Oe]:`${h}px`,[ke]:`${g}px`,[Ae]:`${_}px`,[je]:`${v}px`,[Me]:`${y}px`,[Ne]:`${b}px`}:void 0,E=s(`span`,e,{state:{orientation:l,activeTabPosition:S,activeTabSize:w,tabActivationDirection:u},ref:t,props:[{role:`presentation`,style:T,hidden:!(x&&y>0&&b>0)},o,{suppressHydrationWarning:!0}],stateAttributesMapping:Fe});return d==null?null:(0,q.jsxs)(K.Fragment,{children:[E,i&&(Pe||=(0,q.jsx)(De,{script:``}))]})});function Re(e,t){let n=ze(e),r=ze(t),i=n.left-r.left-t.clientLeft,a=n.top-r.top-t.clientTop,o=k(e);for(;A(o)&&o!==t&&!j(o);)i-=o.scrollLeft,a-=o.scrollTop,o=k(o);return{left:i,top:a}}function ze(e){let t=0,n=0,r=e;for(;r!=null;){t+=r.offsetLeft,n+=r.offsetTop;let e=r.offsetParent;e!=null&&(t+=e.clientLeft,n+=e.clientTop),r=e}return{left:t,top:n}}function Be(e){let t=N(e).getComputedStyle(e),{x:n,y:r}=T(e,t),i=n,a=r,{translate:o}=t;if(o&&o!==`none`){let t=o.split(` `);i+=Ve(t[0],e.offsetWidth),a+=Ve(t[1],e.offsetHeight)}return{x:i,y:a}}function Ve(e,t){if(!e)return 0;let n=parseFloat(e);return Number.isFinite(n)?e.endsWith(`%`)?n/100*t:n:0}var He=K.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:i,loopFocus:a=!0,render:o,style:s,...c}=e,{orientation:l,setTabMap:u,tabActivationDirection:d}=U(),[f,p]=K.useState(0),[m,h]=K.useState(null),g=K.useRef(new Set),_=K.useRef(new Set),v=K.useRef(null);b(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{g.current.forEach(e=>{e()})});return v.current=e,m&&e.observe(m),_.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),v.current=null}},[m]);let y=D(e=>(g.current.add(e),()=>{g.current.delete(e)})),x=D(e=>(_.current.add(e),v.current?.observe(e),()=>{_.current.delete(e),v.current?.unobserve(e)})),S={orientation:l,tabActivationDirection:d},C={"aria-orientation":l===`vertical`?`vertical`:void 0,role:`tablist`},w=K.useMemo(()=>({activateOnFocus:n,registerIndicatorUpdateListener:y,registerTabResizeObserverElement:x,tabsListElement:m}),[n,y,x,m]);return(0,q.jsx)(_e.Provider,{value:w,children:(0,q.jsx)(le,{render:o,className:i,style:s,state:S,refs:[t,h],props:[C,c],stateAttributesMapping:H,highlightedIndex:f,enableHomeAndEndKeys:!0,loopFocus:a,orientation:l,onHighlightedIndexChange:p,onMapChange:u,disabledIndices:r})})}),Ue=a(`IconArrowInbox`,()=>(0,q.jsx)(`path`,{d:`M20 15V18C20 19.1046 19.1046 20 18 20H6C4.89543 20 4 19.1046 4 18V15M12 14.5V4M12 14.5L8.5 11M12 14.5L15.5 11`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})),J=(0,K.createContext)(null),We=(0,K.createContext)(null),Ge=f(`relative flex items-center text-body`,{variants:{variant:{pill:`w-fit gap-1 rounded-full bg-fill-subtle p-1`,"pill-ghost":`w-fit gap-0.5 rounded-full`}},defaultVariants:{variant:`pill`}});function Ke(e,t){return e===`pill`?t?`h-[calc(100%-0.5rem)]`:`h-[calc(100%-0.25rem)]`:`h-full`}var qe=({children:e,className:t,variant:r,size:a=`md`,sticky:o,style:s,overflow:c=`scroll`})=>{let l=r??`pill`,d=(0,K.useContext)(J),f=(0,K.useRef)(null),p=(0,K.useRef)(new Map),h=(0,K.useRef)(new Map),v=(0,K.useRef)(d?.value),[y,b]=(0,K.useState)(null),[S,C]=(0,K.useState)([]),T=(0,K.useCallback)(e=>{C(t=>{let n=t.find(t=>t.value===e.value);return n&&n.element===e.element&&n.width===e.width&&n.label===e.label&&n.disabled===e.disabled&&n.onClick===e.onClick&&n.onClose===e.onClose?t:(n?t.map(t=>t.value===e.value?e:t):[...t,e]).sort((e,t)=>e.element===t.element?0:e.element.compareDocumentPosition(t.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)})},[]),E=(0,K.useCallback)(e=>C(t=>t.filter(t=>t.value!==e)),[]),D=d?.appearance===`contained`,O=D||c===`menu`,k=l===`pill`&&!D,ee=Ke(l,D);(0,K.useLayoutEffect)(()=>{let e=f.current;if(!e||!O)return;let t=()=>b(e.clientWidth);if(t(),!(`ResizeObserver`in globalThis))return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[O]);let A=D||k?4:l===`pill-ghost`?2:0,j=D?30:k?4:0,M=D?48:72,N=(0,K.useMemo)(()=>{let e=new Set;if(!O||y===null||S.reduce((e,t)=>e+t.width,0)+A*Math.max(S.length-1,0)+j<=y)return e;let t=y-j-M,n=S.find(e=>e.value===d?.value);n&&(t-=n.width+A);let r=!1;for(let i of S)i!==n&&(r||i.width+A>t?(r=!0,e.add(i.value)):t-=i.width+A);return e},[O,y,S,A,j,M,d?.value]),P=S.filter(e=>N.has(e.value)),te=S.filter(e=>!N.has(e.value)).reduce((e,t)=>e+t.width+A,D?4:0),F=S.filter(e=>!N.has(e.value)&&e.onClose),I=(0,K.useMemo)(()=>({variant:l,size:a,hiddenValues:N,register:T,unregister:E}),[l,a,N,T,E]);return(0,K.useLayoutEffect)(()=>{let e=new Map(h.current),t=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1;for(let n of S){if(N.has(n.value))continue;let r=n.element.offsetLeft,i=h.current.get(n.value),a=p.current.get(n.value);a&&(a.style.left=`${r}px`,a.style.top=`${n.element.offsetTop}px`,a.style.width=`${n.element.offsetWidth}px`,a.style.height=`${n.element.offsetHeight}px`);let o=i===void 0?0:i-r,s=n.value!==d?.value&&Math.abs(o)<=32;!t&&s&&o!==0&&`animate`in n.element&&n.element.animate([{transform:`translateX(${o}px)`},{transform:`translateX(0)`}],{duration:180,easing:`cubic-bezier(0.32, 0.72, 0, 1)`}),e.set(n.value,r)}for(let t of e.keys())S.some(e=>e.value===t)||e.delete(t);h.current=e},[N,S,d?.value]),(0,K.useLayoutEffect)(()=>{let e=v.current;v.current=d?.value;let t=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1;if(!D||e===d?.value||t)return;let n=f.current?.querySelector(`[data-slot="tabs-indicator"]`);n&&`animate`in n&&n.animate([{opacity:.72,scale:`0.97`},{opacity:1,scale:`1`}],{duration:140,easing:`cubic-bezier(0.32, 0.72, 0, 1)`})},[D,d?.value]),(0,q.jsx)(We.Provider,{value:I,children:(0,q.jsx)(g,{delay:200,children:(0,q.jsxs)(`div`,{ref:f,"data-slot":`tabs-list-scroll`,className:n(`relative w-full`,O&&!D?`flex items-center gap-1`:`overflow-x-auto`,o&&`sticky top-0 z-10 bg-background`),children:[(0,q.jsxs)(He,{"data-slot":`tabs-list`,"data-overflow":P.length>0||void 0,"data-variant":l,"data-size":a,className:n(`group/tabs-list`,Ge({variant:l}),k&&n(w[a],`items-stretch p-0.5`),t),style:s,children:[e,(0,q.jsx)(Le,{className:n(`absolute top-1/2 left-0 z-0 rounded-full bg-[var(--tab-indicator-color,var(--fill-hover))]`,ee,`w-[var(--active-tab-width)]`,`transition-[width,transform] duration-200 ease-in-out motion-reduce:transition-none`),"data-slot":`tabs-indicator`,style:{transform:`translateY(var(--tabs-indicator-y, -50%)) translateX(var(--active-tab-left))`}})]}),(0,q.jsx)(`div`,{"data-slot":`tabs-close-actions`,children:F.map(e=>(0,q.jsx)(`div`,{ref:t=>{t?p.current.set(e.value,t):p.current.delete(e.value)},"data-slot":`tab-close-item`,"data-visible":d?.value===e.value||void 0,children:(0,q.jsxs)(x,{children:[(0,q.jsxs)(_,{render:(0,q.jsx)(`button`,{type:`button`,tabIndex:d?.value===e.value?0:-1,"data-slot":`tab-close`,onClick:e.onClose,className:n(`rounded p-0.5 hover:bg-fill-hover hover:text-destructive-foreground`,u.colors)}),children:[(0,q.jsxs)(`span`,{className:`sr-only`,children:[`Close `,e.label]}),(0,q.jsx)(L,{"aria-hidden":`true`,className:`size-icon-xs`})]}),(0,q.jsxs)(m,{children:[`Close `,e.label]})]})},e.value))}),P.length>0&&(0,q.jsx)(`div`,{"data-slot":`tabs-overflow`,style:D?{transform:`translateX(${te}px)`}:void 0,className:D?`tabs-overflow`:void 0,children:(0,q.jsxs)(V,{children:[(0,q.jsxs)(V.Trigger,{"aria-label":`${P.length} more tabs`,variant:`ghost`,size:`sm`,className:`tabular-nums`,children:[`+`,P.length,(0,q.jsx)(i,{"aria-hidden":`true`,className:`size-icon-xs`})]}),(0,q.jsx)(V.Content,{children:P.map((e,t)=>(0,q.jsxs)(K.Fragment,{children:[(0,q.jsx)(V.Item,{"data-slot":`tabs-overflow-tab`,disabled:e.disabled,className:e.onClose?`pr-9`:void 0,style:{gridArea:`${t+1} / 1`},onClick:()=>{d?.select(e.value),e.onClick?.()},children:e.label}),e.onClose?(0,q.jsxs)(x,{children:[(0,q.jsxs)(_,{render:(0,q.jsx)(V.Item,{"data-slot":`tabs-overflow-close`,className:`pointer-events-none z-10 m-1 size-6 self-center justify-self-end p-0 opacity-0 hover:text-destructive-foreground data-[highlighted]:text-destructive-foreground`,style:{gridArea:`${t+1} / 1`},onClick:e.onClose}),children:[(0,q.jsxs)(`span`,{className:`sr-only`,children:[`Close `,e.label]}),(0,q.jsx)(L,{"aria-hidden":`true`,className:`size-icon-xs`})]}),(0,q.jsxs)(m,{side:`right`,children:[`Close `,e.label]})]}):null]},e.value))})]})})]})})})},Je=({children:e,defaultTab:t,value:r,onValueChange:i,appearance:a=`default`,frame:o=`inset`,className:s,...c})=>{let[l,u]=(0,K.useState)(t),d=r??l,f=e=>{u(e),i?.(e)};return(0,q.jsx)(J.Provider,{value:{appearance:a,value:d,select:f},children:(0,q.jsx)(se,{defaultValue:t,value:d,onValueChange:f,"data-slot":`tabs`,"data-appearance":a,"data-frame":o,className:n(`group/tabs`,a==="default"?`overflow-y-auto`:`w-full min-w-0`,s),...c,children:e})})},Ye=({children:e,value:t,onClick:r,onClose:i,disabled:a,disabledTooltip:o,tooltip:s,attention:u=!1,className:d})=>{let f=(0,K.useContext)(We),p=(0,K.useRef)(null),h=f?.register,g=f?.unregister,v=f?.hiddenValues.has(t)??!1;(0,K.useEffect)(()=>{let n=p.current;if(!n||!h)return;let o=()=>h({value:t,label:e,disabled:a??!1,width:n.getBoundingClientRect().width,element:n,onClick:r,onClose:i});if(o(),!(`ResizeObserver`in globalThis))return;let s=new ResizeObserver(o);return s.observe(n),()=>s.disconnect()},[h,t,e,a,r,i]),(0,K.useEffect)(()=>()=>g?.(t),[g,t]);let y=f?.size??`md`,b=f?.variant===`pill-ghost`?n(F({variant:`ghost`,size:y}),`relative z-10 whitespace-nowrap`,`data-[active]:text-foreground`,`aria-disabled:cursor-not-allowed aria-disabled:opacity-50`,`data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,d):n(`text-label`,ne,u&&`relative`,`flex cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap outline-none`,c,l,`data-[active]:text-foreground`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:text-muted-foreground`,`aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:hover:text-muted-foreground`,`data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[disabled]:hover:text-muted-foreground`,d),S=(0,q.jsxs)(ye,{ref:p,render:(0,q.jsx)(`div`,{}),nativeButton:!1,"data-overflowed":v||void 0,"aria-hidden":v||void 0,value:t,disabled:a||v,"data-slot":`tab`,"data-base-ui-swipe-ignore":``,"data-closable":i?``:void 0,className:b,onClick:r,children:[e,u&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`tab-attention`}),(0,q.jsx)(`span`,{className:`sr-only`,children:` Needs attention`})]})]});return a&&o?(0,q.jsxs)(x,{children:[(0,q.jsx)(_,{render:(0,q.jsx)(`span`,{tabIndex:0,className:`inline-flex`}),children:S}),(0,q.jsx)(m,{children:o})]}):s&&!a?(0,q.jsxs)(x,{children:[(0,q.jsx)(_,{render:S}),(0,q.jsx)(m,{children:s})]}):S},Xe={js:`javascript`,javascript:`javascript`,mjs:`javascript`,cjs:`javascript`,node:`javascript`,ts:`typescript`,typescript:`typescript`,mts:`typescript`,cts:`typescript`,tsx:`tsx`,jsx:`jsx`,json:`json`,json5:`json`,md:`markdown`,markdown:`markdown`,py:`python`,python:`python`,sh:`bash`,bash:`bash`,shell:`bash`,zsh:`bash`,yml:`yaml`,yaml:`yaml`,diff:`diff`,patch:`diff`,css:`css`,scss:`css`,html:`html`,htm:`html`,xml:`xml`,svg:`xml`,sql:`sql`};async function Y(e){let[{StreamLanguage:t},n]=await Promise.all([G(()=>import(`./dist-Sr6WSEaV.js`).then(e=>e.h),__vite__mapDeps([0,1,2])),e]);return t.define(n).parser}async function X(e){let{javascript:t}=await G(async()=>{let{javascript:e}=await import(`./dist-B5wMYzWI.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([3,1,4,2,0]));return t(e).language.parser}var Ze={javascript:()=>X({}),jsx:()=>X({jsx:!0}),typescript:()=>X({typescript:!0}),tsx:()=>X({jsx:!0,typescript:!0}),json:()=>G(()=>import(`./dist-DtnqB3m_.js`).then(e=>e.t).then(e=>e.jsonLanguage.parser),__vite__mapDeps([5,1,4,2,0])),markdown:()=>G(()=>import(`./dist-CMX7_OjZ.js`).then(e=>e.t).then(e=>e.markdownLanguage.parser),__vite__mapDeps([6,1,0,2,3,4])),bash:()=>Y(G(()=>import(`./shell-DwuoZtxw.js`).then(e=>e.shell),[])),python:()=>Y(G(()=>import(`./python-DIWH3FmR.js`).then(e=>e.python),[])),yaml:()=>Y(G(()=>import(`./yaml-BEzOWJ7L.js`).then(e=>e.yaml),[])),diff:()=>Y(G(()=>import(`./diff-ChtP43wD.js`).then(e=>e.diff),[])),css:()=>Y(G(()=>import(`./css-CIHhKeSF.js`).then(e=>e.css),[])),html:()=>Y(G(()=>import(`./xml-aKzObEic.js`).then(e=>e.html),[])),xml:()=>Y(G(()=>import(`./xml-aKzObEic.js`).then(e=>e.xml),[])),sql:()=>Y(G(()=>import(`./sql-DrH7SW3s.js`).then(e=>e.standardSQL),[]))},Z=new Map;function Qe(e){let t=Z.get(e);return t||(t=Ze[e](),t.catch(()=>Z.delete(e)),Z.set(e,t)),t}var $e=[{tag:[W.comment,W.bracket],class:`syntax-comment`},{tag:[W.string,W.meta,W.regexp,W.name,W.quote,W.standard(W.tagName)],class:`syntax-string`},{tag:[W.atom,W.bool,W.special(W.variableName)],class:`syntax-literal`},{tag:[W.keyword,W.operator,W.tagName,W.deleted],class:`syntax-keyword`},{tag:[W.function(W.propertyName),W.propertyName,W.variableName,W.number],class:`syntax-name`},{tag:[W.definition(W.variableName),W.function(W.variableName),W.className,W.attributeName,W.url],class:`syntax-definition`},{tag:W.link,class:`syntax-link`},{tag:W.heading,class:`syntax-heading`},{tag:W.emphasis,class:`syntax-emphasis`},{tag:W.strong,class:`syntax-strong`},{tag:W.strikethrough,class:`syntax-strike`},{tag:W.invalid,class:`syntax-invalid`}],et=fe($e);function tt(e,t){if(!t||!e.startsWith(t.code))return;let n=t.code.length;return pe.applyChanges(pe.addTree(t.tree),[{fromA:n,toA:n,fromB:n,toB:e.length}])}async function nt(e,t,n){let r=Xe[t?.toLowerCase()];if(!r)return null;let i=(await Qe(r)).parse(e,tt(e,n)),a=[],o=[a],s=(e,t)=>{e.split(`
|
|
3
|
+
`).forEach((e,n)=>{n>0&&o.push(a=[]),e&&a.push(t?{content:e,className:t}:{content:e})})},c=0;return me(i,et,(t,n,r)=>{t>c&&s(e.slice(c,t)),s(e.slice(t,n),r),c=n}),c<e.length&&s(e.slice(c)),{code:e,tokens:o,tree:i}}function rt(e){let t=e?.split(`.`).pop()?.toLowerCase();return t?Xe[t]:void 0}var Q=75;function it(e,t){let[n,r]=(0,K.useState)(null),i=(0,K.useRef)(null),[a,o]=de(e,Q,{leading:!0,maxWait:Q});return(0,K.useEffect)(()=>()=>o.cancel(),[o]),(0,K.useEffect)(()=>{if(!t)return;let e=!1,n=i.current?.lang===t?i.current:void 0;return nt(a,t,n).then(n=>{!e&&n?.tokens.length&&(i.current={...n,lang:t},r(i.current))}).catch(()=>{}),()=>{e=!0}},[a,t]),t?n:null}function at(e,t,n){return!e||e.lang!==n?null:t.startsWith(e.code)?e:null}var $=K.memo(function({code:e,lang:t,lineClassName:n,...r}){let i=at(it(e,t),e,t);if(!i){if(!n)return(0,q.jsx)(`pre`,{...r,children:e});let t=e.split(`
|
|
4
|
+
`);return(0,q.jsx)(`pre`,{...r,children:t.map((e,r)=>(0,q.jsxs)(K.Fragment,{children:[(0,q.jsx)(`span`,{"data-line":r,className:n(r,e),children:e}),r!==t.length-1&&`
|
|
5
|
+
`]},r))})}let a=e.slice(i.code.length),o=0;return(0,q.jsx)(`pre`,{...r,children:(0,q.jsxs)(`code`,{className:`font-[inherit]`,children:[i.tokens.map((e,t)=>{let r=o,a=r,s=e.map(e=>{let t=a;return a+=e.content.length,(0,q.jsx)(`span`,{className:e.className,children:e.content},t)});return o=a+1,(0,q.jsxs)(K.Fragment,{children:[n?(0,q.jsx)(`span`,{"data-line":t,className:n(t,e.map(e=>e.content).join(``)),children:s}):(0,q.jsx)(`span`,{children:s}),t!==i.tokens.length-1&&`
|
|
6
|
+
`]},r)}),a]})})});function ot({code:e,options:t,value:r,onValueChange:i,selector:a=`select`,fileName:o,lang:s,overflow:c=`wrap`,copyMessage:l,copyTooltip:d,actions:f,className:p}){let m=t&&t.length>0,h=m&&a===`tabs`,g=m&&a===`select`,_=t?.[0],v=r??_?.value;return(0,q.jsxs)(`figure`,{className:n(`group relative flex w-full flex-col overflow-hidden rounded-2xl bg-nested [contain:inline-size]`,p),children:[h&&_&&(0,q.jsx)(Je,{defaultTab:_.value,value:v,onValueChange:i??(()=>{}),children:(0,q.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,q.jsx)(qe,{children:t.map(e=>(0,q.jsx)(Ye,{value:e.value,children:e.label},e.value))})}),f&&(0,q.jsx)(`div`,{className:`flex shrink-0 items-center border-b border-border pr-2 pl-3`,children:f})]})}),g&&t&&(0,q.jsxs)(`div`,{className:`flex items-center border-b border-border px-2 py-1.5`,children:[(0,q.jsxs)(ae,{value:v,onValueChange:i,children:[(0,q.jsx)(R,{size:`sm`,variant:`ghost`,className:`w-auto`,children:(0,q.jsx)(ie,{})}),(0,q.jsx)(z,{children:t.map(e=>(0,q.jsx)(B,{value:e.value,children:e.label},e.value))})]}),f&&(0,q.jsx)(`div`,{className:`ml-auto flex items-center`,children:f})]}),!m&&o&&(0,q.jsxs)(`div`,{className:`flex items-center border-b border-border px-4 py-2`,children:[(0,q.jsx)(`figcaption`,{className:`font-mono text-caption text-muted-foreground`,children:o}),f&&(0,q.jsx)(`div`,{className:`ml-auto flex items-center`,children:f})]}),!m&&!o&&f&&(0,q.jsx)(`div`,{className:`flex items-center justify-end border-b border-border px-2 py-1.5`,children:f}),(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)($,{code:e,lang:s,className:n(`px-4 py-3 font-mono text-caption text-foreground`,c===`scroll`?`overflow-x-auto whitespace-pre`:`break-all whitespace-pre-wrap`)}),(0,q.jsx)(ue,{content:e,copyMessage:l,tooltip:d,className:n(`absolute top-2 right-2 opacity-100 group-focus-within:opacity-100 group-hover:opacity-100 pointer-fine:opacity-0`,u.opacity)})]})]})}export{et as a,qe as c,Ue as d,rt as i,Je as l,$ as n,$e as o,it as r,Ye as s,ot as t,J as u};
|
package/dist/factory/assets/{CodeEditor-DKVZX8c1-D3tFx8Wi.js → CodeEditor-DE69mZsU-DhkPbKOd.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Bs as t,mi as n,ni as r,vi as i}from"./GithubIcon.es-CIm0nGDf.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./esm-C7YFnOq6.js";import{a as d}from"./CodeBlock.es-CSnUNCvE.js";import{t as f}from"./copy-button-C3L1ZoAD-DpbBeGOv.js";import{t as p}from"./IconCodeBrackets.es-CuUuf_Z9.js";import{t as m}from"./preload-helper-BLdHbfdN.js";import{yt as h}from"./useSessionRows-CIakAaqj.js";import{O as g,T as _,k as v}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{n as y}from"./dist-DtnqB3m_.js";import{n as b,r as x}from"./dist-CMX7_OjZ.js";import{F as S,I as C,L as w,N as T,_ as E,dt as D,j as O}from"./dist-Sr6WSEaV.js";import{c as k}from"./dist-B5wMYzWI.js";var A,j=()=>A??=Promise.all([m(()=>import(`./standalone-YobQElH8.js`),[]),m(()=>import(`./babel-BaOs8qJH.js`),[]),m(()=>import(`./estree-Cw-tQG5d.js`),[])]).catch(e=>{throw A=void 0,e}),M=async e=>{let[t,n,r]=await j();return await t.format(e,{semi:!1,parser:`json`,printWidth:80,tabWidth:2,plugins:[n,r]})},N=e(v(),1),P=g(),F=S.theme({".cm-foldGutter .cm-gutterElement":{display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`0 4px`},".cm-fold-marker":{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:`12px`,height:`12px`,boxSizing:`border-box`,border:`1px solid var(--border)`,borderRadius:`2px`,color:`var(--muted-foreground)`,fontSize:`var(--text-caption)`,lineHeight:`1`,cursor:`pointer`,userSelect:`none`},".cm-fold-marker:hover":{background:`var(--fill-hover)`,color:`var(--foreground)`},".cm-foldPlaceholder":{background:`var(--fill-hover)`,border:`1px solid var(--border)`,color:`var(--muted-foreground)`,borderRadius:`2px`,padding:`0 4px`,margin:`0 2px`}}),I=[E({markerDOM:e=>{let t=document.createElement(`span`);return t.className=`cm-fold-marker`,t.dataset.state=e?`open`:`closed`,t.title=e?`Fold`:`Unfold`,t.textContent=e?`−`:`+`,t}}),F];function L(e,t=5){if(!e?.properties)return[];let n=[];function r(e,i,a){if(a>t)return;let o=Array.isArray(e.type)?e.type.join(` | `):e.type;if(n.push({path:i,label:i,description:e.description??e.title,type:o}),e.properties)for(let[t,n]of Object.entries(e.properties))r(n,`${i}.${t}`,a+1);if(e.items?.properties)for(let[t,n]of Object.entries(e.items.properties))r(n,`${i}[].${t}`,a+1)}for(let[t,n]of Object.entries(e.properties))r(n,t,1);return n}function R(e){let t=L(e);return k({override:[z(t)],defaultKeymap:!0,closeOnBlur:!0,icons:!1})}function z(e){return t=>{let n=t.state.sliceDoc(Math.max(0,t.pos-50),t.pos).match(/\{\{([a-zA-Z0-9_.\[\]]*)?$/);if(!n)return null;let r=n[1]??``,i=t.pos-r.length,a=r?e.filter(e=>e.path.toLowerCase().startsWith(r.toLowerCase())):e;return a.length===0?null:{from:i,options:a.map(e=>({label:e.path,displayLabel:e.path,detail:e.type,info:e.description,apply:(e,t,n,r)=>{let i=r+(e.state.sliceDoc(r).match(/^[a-zA-Z0-9_.\[\]]*/)?.[0].length??0),a=e.state.sliceDoc(i,i+2)===`}}`,o=a?i:r,s=a?t.label:`${t.label}}}`;e.dispatch({changes:{from:n,to:o,insert:s},selection:{anchor:n+s.length}})}})),validFor:/^[a-zA-Z0-9_.\[\]]*$/}}}var B=/\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g,V=T.mark({class:`cm-variable-highlight`}),H=new C({regexp:B,decoration:()=>V}),U=w.fromClass(class{decorations;constructor(e){this.decorations=H.createDeco(e)}update(e){this.decorations=H.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}),W=(e=`mono`)=>(0,N.useMemo)(()=>[l(e),O(d)],[e]),G=t(_(`relative overflow-hidden font-mono outline-hidden focus-within:outline-hidden focus:outline-hidden`,`transition-colors duration-normal ease-out-custom`),{variants:{variant:{default:_(i,`rounded-md p-1`,n),embedded:`rounded-none border-none bg-transparent p-0`,inline:`rounded-none border-none bg-transparent p-0`}},defaultVariants:{variant:`default`}}),K=(0,N.forwardRef)(({data:e,value:t,onChange:n,showCopyButton:i=!0,showFormatButton:l=!1,className:d,language:m=`json`,font:g=`mono`,highlightVariables:v=!1,placeholder:C,schema:w,autoFocus:T,lineNumbers:E=!0,lineWrapping:O=!0,editable:k,extensions:A,variant:j,id:F,"aria-label":L,"aria-labelledby":z,"aria-describedby":B,"aria-invalid":V,...H},K)=>{let{ariaLabel:q,contentAttributes:J}=c({id:F,"aria-label":L,"aria-labelledby":z,"aria-describedby":B,"aria-invalid":V},`Code editor`),Y=W(g),X=e?JSON.stringify(e,null,2):t??``,Z=l&&m===`json`&&k!==!1&&!!n,Q=async()=>{try{n?.((await M(X)).trimEnd())}catch{h.error(`Can’t format: the JSON is invalid`)}},$=(0,N.useMemo)(()=>{let e=[...o,J,j===`inline`?a:I];return O&&e.push(S.lineWrapping),m===`json`?e.push(y):m===`markdown`&&e.push(b({base:x,codeLanguages:s})),v&&m===`markdown`&&e.push(U),w&&m===`markdown`&&e.push(R(w)),k===!1&&e.push(D.readOnly.of(!0)),A&&e.push(...A),e},[A,j,m,v,w,k,O,J]);return(0,P.jsxs)(`div`,{className:_(G({variant:j}),d),...H,children:[(i||Z)&&(0,P.jsxs)(`div`,{className:`absolute top-2 right-2 z-20 flex gap-1`,children:[Z&&(0,P.jsx)(r,{type:`button`,size:`icon-sm`,tooltip:`Format JSON`,"aria-label":`Format JSON`,onClick:Q,children:(0,P.jsx)(p,{})}),i&&(0,P.jsx)(f,{content:X})]}),(0,P.jsx)(u,{ref:K,value:X,theme:Y,extensions:$,onChange:n,editable:k,"aria-label":q,placeholder:C,height:`100%`,style:{height:`100%`},autoFocus:T,basicSetup:{lineNumbers:E,foldGutter:!1}})]})});export{K as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Bt as t,Dt as n,Ot as r,St as i,Vt as a,ji as o,jt as s,za as c}from"./GithubIcon.es-BmZS8JQG.js";import{o as l}from"./CompositeItem-CSfZykYZ.js";import{O as u,T as d,k as f,n as p,u as m}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{a as h,i as g,n as _,o as v,r as y,s as b}from"./IconSettingsSliderHor.es-CWhsvZzL.js";import{t as x}from"./password-manager-autofill.es-Cs1VH0JI.js";var S=e(f(),1),C=u(),w=1,T=.9,E=.8,ee=.17,D=.1,O=.999,k=.9999,te=.99,A=/[\\\/_+.#"@\[\(\{&]/,j=/[\\\/_+.#"@\[\(\{&]/g,ne=/[\s-]/,re=/[\s-]/g;function ie(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?w:te;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=ie(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=w:A.test(e.charAt(l-1))?(d*=E,p=e.slice(i,l-1).match(j),p&&i>0&&(d*=O**+p.length)):ne.test(e.charAt(l-1))?(d*=T,m=e.slice(i,l-1).match(re),m&&i>0&&(d*=O**+m.length)):(d*=ee,i>0&&(d*=O**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=k)),(d<D&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=ie(e,t,n,r,l+1,a+2,o),f*D>d&&(d=f*D)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function ae(e){return e.toLowerCase().replace(re,` `)}function oe(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,ie(e,t,ae(e),ae(t),0,0,{})}var se=Object.defineProperty,M=(e,t)=>se(e,`name`,{value:t,configurable:!0}),ce=!!(typeof window<`u`&&window.document&&window.document.createElement);function N(e,t,{checkForDefaultPrevented:n=!0}={}){return M(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}M(N,`composeEventHandlers`);function le(e){if(!ce)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}M(le,`getOwnerWindow`);function ue(e){if(!ce)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}M(ue,`getOwnerDocument`);function de(e,t=!1){let{activeElement:n}=ue(e);if(!n?.nodeName)return null;if(fe(n)&&n.contentDocument)return de(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=ue(n).getElementById(e);if(t)return t}}return n}M(de,`getActiveElement`);function fe(e){return e.tagName===`IFRAME`}M(fe,`isFrame`);var pe=Object.defineProperty,P=(e,t)=>pe(e,`name`,{value:t,configurable:!0});function me(e,t){let n=S.createContext(t);n.displayName=e+`Context`;let r=P(e=>{let{children:t,...r}=e,i=S.useMemo(()=>r,Object.values(r));return(0,C.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=S.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return P(i,`useContext`),[r,i]}P(me,`createContext`);function he(e,t=[]){let n=[];function r(t,r){let i=S.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=P(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=S.useMemo(()=>o,Object.values(o));return(0,C.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=S.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return P(s,`useContext`),[o,s]}P(r,`createContext`);let i=P(()=>{let t=n.map(e=>S.createContext(e));return P(function(n){let r=n?.[e]||t;return S.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,ge(i,...t)]}P(he,`createContextScope`);function ge(...e){let t=e[0];if(e.length===1)return t;let n=P(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return P(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return S.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}P(ge,`composeContextScopes`);var F=globalThis?.document?S.useLayoutEffect:()=>{},_e=Object.defineProperty,ve=(e,t)=>_e(e,`name`,{value:t,configurable:!0}),ye=S.useId||(()=>void 0),be=0;function I(e){let[t,n]=S.useState(ye());return F(()=>{e||n(e=>e??String(be++))},[e]),e||(t?`radix-${t}`:``)}ve(I,`useId`);var xe=Object.defineProperty,Se=(e,t)=>xe(e,`name`,{value:t,configurable:!0}),Ce=S.useEffectEvent,we=S.useInsertionEffect;function Te(e){if(typeof Ce==`function`)return Ce(e);let t=S.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof we==`function`?we(()=>{t.current=e}):F(()=>{t.current=e}),S.useMemo(()=>((...e)=>t.current?.(...e)),[])}Se(Te,`useEffectEvent`);var Ee=Object.defineProperty,De=(e,t)=>Ee(e,`name`,{value:t,configurable:!0}),Oe=S.useInsertionEffect||F;function ke({prop:e,defaultProp:t,onChange:n=De(()=>{},`onChange`),caller:r}){let[i,a,o]=Ae({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,S.useCallback(t=>{if(s){let n=je(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}De(ke,`useControllableState`);function Ae({defaultProp:e,onChange:t}){let[n,r]=S.useState(e),i=S.useRef(n),a=S.useRef(t);return Oe(()=>{a.current=t},[t]),S.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}De(Ae,`useUncontrolledState`);function je(e){return typeof e==`function`}De(je,`isFunction`);var Me=Symbol(`RADIX:SYNC_STATE`);function Ne(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=Te(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=S.useReducer((t,n)=>{if(n.type===Me)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=S.useRef(p);S.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=S.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return S.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:Me,state:i})},[i,d.state,c]),[h,f]}De(Ne,`useControllableStateReducer`);var Pe=Object.defineProperty,Fe=(e,t)=>Pe(e,`name`,{value:t,configurable:!0}),Ie=S.useInsertionEffect;function L(e){let t=S.useRef(e);return typeof Ie==`function`?Ie(()=>{t.current=e}):F(()=>{t.current=e}),S.useMemo(()=>((...e)=>t.current?.(...e)),[])}Fe(L,`useCallbackRef`);var Le=Object.defineProperty,R=(e,t)=>Le(e,`name`,{value:t,configurable:!0}),Re=`dismissableLayer.update`,ze=`dismissableLayer.pointerDownOutside`,Be=`dismissableLayer.focusOutside`,Ve,He=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Ue=S.forwardRef(R(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=S.useContext(He),[d,f]=S.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=S.useState({}),h=b(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,x=d?g.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,T=x>=v,E=S.useRef(!1),ee=Ke(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:E,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:S.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return T&&!t},[u.branches,T])}),D=qe(e=>{if(r&&E.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),O=d?x===g.length-1:!1,k=L(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return S.useEffect(()=>{if(O)return p.addEventListener(`keydown`,k,{capture:!0}),()=>p.removeEventListener(`keydown`,k,{capture:!0})},[p,O,k]),S.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Ve=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Je(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Ve))}},[d,p,n,u]),S.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Je())},[d,u]),S.useEffect(()=>{let e=R(()=>m({}),`handleUpdate`);return document.addEventListener(Re,e),()=>document.removeEventListener(Re,e)},[]),(0,C.jsx)(y.div,{...l,ref:h,style:{pointerEvents:w?T?`auto`:`none`:void 0,...e.style},onFocusCapture:N(e.onFocusCapture,D.onFocusCapture),onBlurCapture:N(e.onBlurCapture,D.onBlurCapture),onPointerDownCapture:N(e.onPointerDownCapture,ee.onPointerDownCapture)})},`DismissableLayer`));function We(){let e=S.useContext(He),[t,n]=S.useState(null);return S.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}R(We,`useDismissableLayerSurface`);var Ge=R(()=>!0,`IS_TRUE`);function Ke(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Ge}=t,s=L(e),c=S.useRef(!1),l=S.useRef(!1),u=S.useRef(new Map),d=S.useRef(()=>{});return S.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}R(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}R(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)}R(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}R(p,`handleInteractionBubble`);let m=R(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||Ye(ze,s,p,{discrete:!0})};if(R(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:R(()=>c.current=!0,`onPointerDownCapture`)}}R(Ke,`usePointerDownOutside`);function qe(e,t=globalThis?.document){let n=L(e),r=S.useRef(!1);return S.useEffect(()=>{let e=R(e=>{e.target&&!r.current&&Ye(Be,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:R(()=>r.current=!0,`onFocusCapture`),onBlurCapture:R(()=>r.current=!1,`onBlurCapture`)}}R(qe,`useFocusOutside`);function Je(){let e=new CustomEvent(Re);document.dispatchEvent(e)}R(Je,`dispatchUpdate`);function Ye(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?g(i,a):i.dispatchEvent(a)}R(Ye,`handleAndDispatchCustomEvent`);var Xe=Object.defineProperty,z=(e,t)=>Xe(e,`name`,{value:t,configurable:!0}),Ze=`focusScope.autoFocusOnMount`,Qe=`focusScope.autoFocusOnUnmount`,$e={bubbles:!1,cancelable:!0},et=S.forwardRef(z(function(e,t){let{loop:n=!1,trapped:r=!1,branches:i,onMountAutoFocus:a,onUnmountAutoFocus:o,...s}=e,[c,l]=S.useState(null),u=L(a),d=L(o),f=S.useRef(null),p=b(t,l),m=S.useRef(i);S.useEffect(()=>{m.current=i});let h=S.useCallback(e=>e?c?.contains(e)?!0:!!m.current?.some(t=>t.contains(e)):!1,[c]),g=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(r){let e=function(e){if(g.paused||!c)return;let t=e.target;h(t)?f.current=t:B(f.current,{select:!0})},t=function(e){if(g.paused||!c)return;let t=e.relatedTarget;t!==null&&(h(t)||B(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&B(c)};z(e,`handleFocusIn`),z(t,`handleFocusOut`),z(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]),S.useEffect(()=>{if(c){dt.add(g);let e=document.activeElement;if(!c.contains(e)){let t=new CustomEvent(Ze,$e);c.addEventListener(Ze,u),c.dispatchEvent(t),t.defaultPrevented||(at(mt(st(c)),{select:!0}),document.activeElement===e&&B(c))}return()=>{c.removeEventListener(Ze,u);let t=c.ownerDocument,n=CustomEvent;setTimeout(()=>{let r=new n(Qe,$e);c.addEventListener(Qe,d),c.dispatchEvent(r),r.defaultPrevented||B(e??t.body,{select:!0}),c.removeEventListener(Qe,d),dt.remove(g)},0)}}},[c,u,d,g]);let _=S.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]=ot(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&B(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&B(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,C.jsx)(y.div,{tabIndex:-1,...s,ref:p,onKeyDown:_})},`FocusScope`)),tt=S.createContext(null);function nt({registry:e,children:t}){return e?(0,C.jsx)(tt.Provider,{value:e,children:t}):t}z(nt,`FocusScopeBranchProvider`);function rt(){let[e,t]=S.useState([]);return{nodes:e,registry:S.useMemo(()=>({add:z(e=>t(t=>t.includes(e)?t:[...t,e]),`add`),remove:z(e=>t(t=>t.filter(t=>t!==e)),`remove`)}),[])}}z(rt,`useFocusScopeBranchRegistry`);function it(e){let t=S.useContext(tt);S.useEffect(()=>{if(e&&t)return t.add(e),()=>t.remove(e)},[e,t])}z(it,`useFocusScopeBranch`);function at(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(B(r,{select:t}),document.activeElement!==n)return}z(at,`focusFirst`);function ot(e){let t=st(e);return[ct(t,e),ct(t.reverse(),e)]}z(ot,`getTabbableEdges`);function st(e){let t=[],n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:z(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}z(st,`getTabbableCandidates`);function ct(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):lt(r,{upTo:t})))return r}z(ct,`findVisible`);function lt(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}z(lt,`isHidden`);function ut(e){return e.tagName===`INPUT`&&typeof e.select==`function`}z(ut,`isSelectableInput`);function B(e,{select:t=!1}={}){if(e&&e.focus){let n=(e.ownerDocument??document).activeElement;e.focus({preventScroll:!0}),e!==n&&ut(e)&&t&&e.select()}}z(B,`focus`);var dt=ft();function ft(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=pt(e,t),e.unshift(t)},remove(t){e=pt(e,t),e[0]?.resume()}}}z(ft,`createFocusScopesStack`);function pt(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}z(pt,`arrayRemove`);function mt(e){return e.filter(e=>e.tagName!==`A`)}z(mt,`removeLinks`);var ht=e(c(),1),gt=Object.defineProperty,_t=S.forwardRef(((e,t)=>gt(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=S.useState(!1);F(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?ht.createPortal((0,C.jsx)(y.div,{...r,ref:t}),o):null},`Portal`)),vt=Object.defineProperty,V=(e,t)=>vt(e,`name`,{value:t,configurable:!0});function yt(e,t){return S.useReducer((e,n)=>t[e][n]??e,e)}V(yt,`useStateMachine`);var bt=V(e=>{let{present:t,children:n}=e,r=xt(t),i=typeof n==`function`?n({present:r.isPresent}):S.Children.only(n),a=Ct(r.ref,wt(i));return typeof n==`function`||r.isPresent?S.cloneElement(i,{ref:a}):null},`Presence`);function xt(e){let[t,n]=S.useState(),r=S.useRef(null),i=S.useRef(e),a=S.useRef(`none`),o=S.useRef(void 0),[s,c]=yt(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return S.useEffect(()=>{s===`mounted`?(a.current=o.current??H(r.current),o.current=void 0):a.current=`none`},[s]),F(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=H(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]),F(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=V(a=>{let o=H(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=V(e=>{e.target===t&&(a.current=H(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:S.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=H(t)}else r.current=null;n(e)},[])}}V(xt,`usePresence`);function St(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}V(St,`setRef`);function Ct(...e){let t=S.useRef(e);return t.current=e,S.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=St(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():St(n[e],null)}}},[])}V(Ct,`useStableComposedRefs`);function H(e){return e?.animationName||`none`}V(H,`getAnimationName`);function wt(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)}V(wt,`getElementRef`);var Tt=Object.defineProperty,Et=(e,t)=>Tt(e,`name`,{value:t,configurable:!0}),Dt=0,Ot=null;function kt(e){return At(),e.children}Et(kt,`FocusGuards`);function At(){S.useEffect(()=>{Ot||={start:jt(),end:jt()};let{start:e,end:t}=Ot;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Dt++,()=>{Dt===1&&(Ot?.start.remove(),Ot?.end.remove(),Ot=null),Dt=Math.max(0,Dt-1)}},[])}Et(At,`useFocusGuards`);function jt(){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}Et(jt,`createFocusGuard`);var U=function(){return U=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},U.apply(this,arguments)};function Mt(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 Nt(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 Pt=`right-scroll-bar-position`,Ft=`width-before-scroll-bar`,It=`with-scroll-bars-hidden`,Lt=`--removed-body-scroll-bar-size`;function Rt(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function zt(e,t){var n=(0,S.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 Bt=typeof window<`u`?S.useLayoutEffect:S.useEffect,Vt=new WeakMap;function Ht(e,t){var n=zt(t||null,function(t){return e.forEach(function(e){return Rt(e,t)})});return Bt(function(){var t=Vt.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Rt(e,null)}),i.forEach(function(e){r.has(e)||Rt(e,a)})}Vt.set(n,e)},[e]),n}function Ut(e){return e}function Wt(e,t){t===void 0&&(t=Ut);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 Gt(e){e===void 0&&(e={});var t=Wt(null);return t.options=U({async:!0,ssr:!1},e),t}var Kt=function(e){var t=e.sideCar,n=Mt(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 S.createElement(r,U({},n))};Kt.isSideCarExport=!0;function qt(e,t){return e.useMedium(t),Kt}var Jt=Gt(),Yt=function(){},Xt=S.forwardRef(function(e,t){var n=S.useRef(null),r=S.useState({onScrollCapture:Yt,onWheelCapture:Yt,onTouchMoveCapture:Yt}),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=Mt(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,C=Ht([n,t]),w=U(U({},b),i);return S.createElement(S.Fragment,null,u&&S.createElement(x,{sideCar:Jt,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?S.cloneElement(S.Children.only(s),U(U({},w),{ref:C})):S.createElement(v,U({},w,{className:c,ref:C}),s))});Xt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Xt.classNames={fullWidth:Ft,zeroRight:Pt};var Zt=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Qt(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Zt();return t&&e.setAttribute(`nonce`,t),e}function $t(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function en(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var tn=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Qt())&&($t(t,n),en(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},nn=function(){var e=tn();return function(t,n){S.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},rn=function(){var e=nn();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},an={left:0,top:0,right:0,gap:0},on=function(e){return parseInt(e||``,10)||0},sn=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[on(n),on(r),on(i)]},cn=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return an;var t=sn(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])}},ln=rn(),un=`data-scroll-locked`,dn=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{Bt as t,Dt as n,Ot as r,St as i,Vt as a,ji as o,jt as s,za as c}from"./GithubIcon.es-CIm0nGDf.js";import{o as l}from"./CompositeItem-DXJX9-KR.js";import{O as u,T as d,k as f,n as p,u as m}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{a as h,i as g,n as _,o as v,r as y,s as b}from"./IconSettingsSliderHor.es-VS_Cfpz8.js";import{t as x}from"./password-manager-autofill.es-Cs1VH0JI.js";var S=e(f(),1),C=u(),w=1,T=.9,E=.8,ee=.17,D=.1,O=.999,k=.9999,te=.99,A=/[\\\/_+.#"@\[\(\{&]/,j=/[\\\/_+.#"@\[\(\{&]/g,ne=/[\s-]/,re=/[\s-]/g;function ie(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?w:te;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=ie(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=w:A.test(e.charAt(l-1))?(d*=E,p=e.slice(i,l-1).match(j),p&&i>0&&(d*=O**+p.length)):ne.test(e.charAt(l-1))?(d*=T,m=e.slice(i,l-1).match(re),m&&i>0&&(d*=O**+m.length)):(d*=ee,i>0&&(d*=O**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=k)),(d<D&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=ie(e,t,n,r,l+1,a+2,o),f*D>d&&(d=f*D)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function ae(e){return e.toLowerCase().replace(re,` `)}function oe(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,ie(e,t,ae(e),ae(t),0,0,{})}var se=Object.defineProperty,M=(e,t)=>se(e,`name`,{value:t,configurable:!0}),ce=!!(typeof window<`u`&&window.document&&window.document.createElement);function N(e,t,{checkForDefaultPrevented:n=!0}={}){return M(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}M(N,`composeEventHandlers`);function le(e){if(!ce)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}M(le,`getOwnerWindow`);function ue(e){if(!ce)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}M(ue,`getOwnerDocument`);function de(e,t=!1){let{activeElement:n}=ue(e);if(!n?.nodeName)return null;if(fe(n)&&n.contentDocument)return de(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=ue(n).getElementById(e);if(t)return t}}return n}M(de,`getActiveElement`);function fe(e){return e.tagName===`IFRAME`}M(fe,`isFrame`);var pe=Object.defineProperty,P=(e,t)=>pe(e,`name`,{value:t,configurable:!0});function me(e,t){let n=S.createContext(t);n.displayName=e+`Context`;let r=P(e=>{let{children:t,...r}=e,i=S.useMemo(()=>r,Object.values(r));return(0,C.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=S.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return P(i,`useContext`),[r,i]}P(me,`createContext`);function he(e,t=[]){let n=[];function r(t,r){let i=S.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=P(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=S.useMemo(()=>o,Object.values(o));return(0,C.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=S.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return P(s,`useContext`),[o,s]}P(r,`createContext`);let i=P(()=>{let t=n.map(e=>S.createContext(e));return P(function(n){let r=n?.[e]||t;return S.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,ge(i,...t)]}P(he,`createContextScope`);function ge(...e){let t=e[0];if(e.length===1)return t;let n=P(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return P(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return S.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}P(ge,`composeContextScopes`);var F=globalThis?.document?S.useLayoutEffect:()=>{},_e=Object.defineProperty,ve=(e,t)=>_e(e,`name`,{value:t,configurable:!0}),ye=S.useId||(()=>void 0),be=0;function I(e){let[t,n]=S.useState(ye());return F(()=>{e||n(e=>e??String(be++))},[e]),e||(t?`radix-${t}`:``)}ve(I,`useId`);var xe=Object.defineProperty,Se=(e,t)=>xe(e,`name`,{value:t,configurable:!0}),Ce=S.useEffectEvent,we=S.useInsertionEffect;function Te(e){if(typeof Ce==`function`)return Ce(e);let t=S.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof we==`function`?we(()=>{t.current=e}):F(()=>{t.current=e}),S.useMemo(()=>((...e)=>t.current?.(...e)),[])}Se(Te,`useEffectEvent`);var Ee=Object.defineProperty,De=(e,t)=>Ee(e,`name`,{value:t,configurable:!0}),Oe=S.useInsertionEffect||F;function ke({prop:e,defaultProp:t,onChange:n=De(()=>{},`onChange`),caller:r}){let[i,a,o]=Ae({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,S.useCallback(t=>{if(s){let n=je(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}De(ke,`useControllableState`);function Ae({defaultProp:e,onChange:t}){let[n,r]=S.useState(e),i=S.useRef(n),a=S.useRef(t);return Oe(()=>{a.current=t},[t]),S.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}De(Ae,`useUncontrolledState`);function je(e){return typeof e==`function`}De(je,`isFunction`);var Me=Symbol(`RADIX:SYNC_STATE`);function Ne(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=Te(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=S.useReducer((t,n)=>{if(n.type===Me)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=S.useRef(p);S.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=S.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return S.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:Me,state:i})},[i,d.state,c]),[h,f]}De(Ne,`useControllableStateReducer`);var Pe=Object.defineProperty,Fe=(e,t)=>Pe(e,`name`,{value:t,configurable:!0}),Ie=S.useInsertionEffect;function L(e){let t=S.useRef(e);return typeof Ie==`function`?Ie(()=>{t.current=e}):F(()=>{t.current=e}),S.useMemo(()=>((...e)=>t.current?.(...e)),[])}Fe(L,`useCallbackRef`);var Le=Object.defineProperty,R=(e,t)=>Le(e,`name`,{value:t,configurable:!0}),Re=`dismissableLayer.update`,ze=`dismissableLayer.pointerDownOutside`,Be=`dismissableLayer.focusOutside`,Ve,He=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Ue=S.forwardRef(R(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=S.useContext(He),[d,f]=S.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=S.useState({}),h=b(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,x=d?g.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,T=x>=v,E=S.useRef(!1),ee=Ke(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:E,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:S.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return T&&!t},[u.branches,T])}),D=qe(e=>{if(r&&E.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),O=d?x===g.length-1:!1,k=L(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return S.useEffect(()=>{if(O)return p.addEventListener(`keydown`,k,{capture:!0}),()=>p.removeEventListener(`keydown`,k,{capture:!0})},[p,O,k]),S.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Ve=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Je(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Ve))}},[d,p,n,u]),S.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Je())},[d,u]),S.useEffect(()=>{let e=R(()=>m({}),`handleUpdate`);return document.addEventListener(Re,e),()=>document.removeEventListener(Re,e)},[]),(0,C.jsx)(y.div,{...l,ref:h,style:{pointerEvents:w?T?`auto`:`none`:void 0,...e.style},onFocusCapture:N(e.onFocusCapture,D.onFocusCapture),onBlurCapture:N(e.onBlurCapture,D.onBlurCapture),onPointerDownCapture:N(e.onPointerDownCapture,ee.onPointerDownCapture)})},`DismissableLayer`));function We(){let e=S.useContext(He),[t,n]=S.useState(null);return S.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}R(We,`useDismissableLayerSurface`);var Ge=R(()=>!0,`IS_TRUE`);function Ke(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Ge}=t,s=L(e),c=S.useRef(!1),l=S.useRef(!1),u=S.useRef(new Map),d=S.useRef(()=>{});return S.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}R(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}R(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)}R(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}R(p,`handleInteractionBubble`);let m=R(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||Ye(ze,s,p,{discrete:!0})};if(R(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:R(()=>c.current=!0,`onPointerDownCapture`)}}R(Ke,`usePointerDownOutside`);function qe(e,t=globalThis?.document){let n=L(e),r=S.useRef(!1);return S.useEffect(()=>{let e=R(e=>{e.target&&!r.current&&Ye(Be,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:R(()=>r.current=!0,`onFocusCapture`),onBlurCapture:R(()=>r.current=!1,`onBlurCapture`)}}R(qe,`useFocusOutside`);function Je(){let e=new CustomEvent(Re);document.dispatchEvent(e)}R(Je,`dispatchUpdate`);function Ye(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?g(i,a):i.dispatchEvent(a)}R(Ye,`handleAndDispatchCustomEvent`);var Xe=Object.defineProperty,z=(e,t)=>Xe(e,`name`,{value:t,configurable:!0}),Ze=`focusScope.autoFocusOnMount`,Qe=`focusScope.autoFocusOnUnmount`,$e={bubbles:!1,cancelable:!0},et=S.forwardRef(z(function(e,t){let{loop:n=!1,trapped:r=!1,branches:i,onMountAutoFocus:a,onUnmountAutoFocus:o,...s}=e,[c,l]=S.useState(null),u=L(a),d=L(o),f=S.useRef(null),p=b(t,l),m=S.useRef(i);S.useEffect(()=>{m.current=i});let h=S.useCallback(e=>e?c?.contains(e)?!0:!!m.current?.some(t=>t.contains(e)):!1,[c]),g=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(r){let e=function(e){if(g.paused||!c)return;let t=e.target;h(t)?f.current=t:B(f.current,{select:!0})},t=function(e){if(g.paused||!c)return;let t=e.relatedTarget;t!==null&&(h(t)||B(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&B(c)};z(e,`handleFocusIn`),z(t,`handleFocusOut`),z(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]),S.useEffect(()=>{if(c){dt.add(g);let e=document.activeElement;if(!c.contains(e)){let t=new CustomEvent(Ze,$e);c.addEventListener(Ze,u),c.dispatchEvent(t),t.defaultPrevented||(at(mt(st(c)),{select:!0}),document.activeElement===e&&B(c))}return()=>{c.removeEventListener(Ze,u);let t=c.ownerDocument,n=CustomEvent;setTimeout(()=>{let r=new n(Qe,$e);c.addEventListener(Qe,d),c.dispatchEvent(r),r.defaultPrevented||B(e??t.body,{select:!0}),c.removeEventListener(Qe,d),dt.remove(g)},0)}}},[c,u,d,g]);let _=S.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]=ot(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&B(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&B(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,C.jsx)(y.div,{tabIndex:-1,...s,ref:p,onKeyDown:_})},`FocusScope`)),tt=S.createContext(null);function nt({registry:e,children:t}){return e?(0,C.jsx)(tt.Provider,{value:e,children:t}):t}z(nt,`FocusScopeBranchProvider`);function rt(){let[e,t]=S.useState([]);return{nodes:e,registry:S.useMemo(()=>({add:z(e=>t(t=>t.includes(e)?t:[...t,e]),`add`),remove:z(e=>t(t=>t.filter(t=>t!==e)),`remove`)}),[])}}z(rt,`useFocusScopeBranchRegistry`);function it(e){let t=S.useContext(tt);S.useEffect(()=>{if(e&&t)return t.add(e),()=>t.remove(e)},[e,t])}z(it,`useFocusScopeBranch`);function at(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(B(r,{select:t}),document.activeElement!==n)return}z(at,`focusFirst`);function ot(e){let t=st(e);return[ct(t,e),ct(t.reverse(),e)]}z(ot,`getTabbableEdges`);function st(e){let t=[],n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:z(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}z(st,`getTabbableCandidates`);function ct(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):lt(r,{upTo:t})))return r}z(ct,`findVisible`);function lt(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}z(lt,`isHidden`);function ut(e){return e.tagName===`INPUT`&&typeof e.select==`function`}z(ut,`isSelectableInput`);function B(e,{select:t=!1}={}){if(e&&e.focus){let n=(e.ownerDocument??document).activeElement;e.focus({preventScroll:!0}),e!==n&&ut(e)&&t&&e.select()}}z(B,`focus`);var dt=ft();function ft(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=pt(e,t),e.unshift(t)},remove(t){e=pt(e,t),e[0]?.resume()}}}z(ft,`createFocusScopesStack`);function pt(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}z(pt,`arrayRemove`);function mt(e){return e.filter(e=>e.tagName!==`A`)}z(mt,`removeLinks`);var ht=e(c(),1),gt=Object.defineProperty,_t=S.forwardRef(((e,t)=>gt(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=S.useState(!1);F(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?ht.createPortal((0,C.jsx)(y.div,{...r,ref:t}),o):null},`Portal`)),vt=Object.defineProperty,V=(e,t)=>vt(e,`name`,{value:t,configurable:!0});function yt(e,t){return S.useReducer((e,n)=>t[e][n]??e,e)}V(yt,`useStateMachine`);var bt=V(e=>{let{present:t,children:n}=e,r=xt(t),i=typeof n==`function`?n({present:r.isPresent}):S.Children.only(n),a=Ct(r.ref,wt(i));return typeof n==`function`||r.isPresent?S.cloneElement(i,{ref:a}):null},`Presence`);function xt(e){let[t,n]=S.useState(),r=S.useRef(null),i=S.useRef(e),a=S.useRef(`none`),o=S.useRef(void 0),[s,c]=yt(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return S.useEffect(()=>{s===`mounted`?(a.current=o.current??H(r.current),o.current=void 0):a.current=`none`},[s]),F(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=H(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]),F(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=V(a=>{let o=H(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=V(e=>{e.target===t&&(a.current=H(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:S.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=H(t)}else r.current=null;n(e)},[])}}V(xt,`usePresence`);function St(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}V(St,`setRef`);function Ct(...e){let t=S.useRef(e);return t.current=e,S.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=St(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():St(n[e],null)}}},[])}V(Ct,`useStableComposedRefs`);function H(e){return e?.animationName||`none`}V(H,`getAnimationName`);function wt(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)}V(wt,`getElementRef`);var Tt=Object.defineProperty,Et=(e,t)=>Tt(e,`name`,{value:t,configurable:!0}),Dt=0,Ot=null;function kt(e){return At(),e.children}Et(kt,`FocusGuards`);function At(){S.useEffect(()=>{Ot||={start:jt(),end:jt()};let{start:e,end:t}=Ot;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Dt++,()=>{Dt===1&&(Ot?.start.remove(),Ot?.end.remove(),Ot=null),Dt=Math.max(0,Dt-1)}},[])}Et(At,`useFocusGuards`);function jt(){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}Et(jt,`createFocusGuard`);var U=function(){return U=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},U.apply(this,arguments)};function Mt(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 Nt(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 Pt=`right-scroll-bar-position`,Ft=`width-before-scroll-bar`,It=`with-scroll-bars-hidden`,Lt=`--removed-body-scroll-bar-size`;function Rt(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function zt(e,t){var n=(0,S.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 Bt=typeof window<`u`?S.useLayoutEffect:S.useEffect,Vt=new WeakMap;function Ht(e,t){var n=zt(t||null,function(t){return e.forEach(function(e){return Rt(e,t)})});return Bt(function(){var t=Vt.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Rt(e,null)}),i.forEach(function(e){r.has(e)||Rt(e,a)})}Vt.set(n,e)},[e]),n}function Ut(e){return e}function Wt(e,t){t===void 0&&(t=Ut);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 Gt(e){e===void 0&&(e={});var t=Wt(null);return t.options=U({async:!0,ssr:!1},e),t}var Kt=function(e){var t=e.sideCar,n=Mt(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 S.createElement(r,U({},n))};Kt.isSideCarExport=!0;function qt(e,t){return e.useMedium(t),Kt}var Jt=Gt(),Yt=function(){},Xt=S.forwardRef(function(e,t){var n=S.useRef(null),r=S.useState({onScrollCapture:Yt,onWheelCapture:Yt,onTouchMoveCapture:Yt}),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=Mt(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,C=Ht([n,t]),w=U(U({},b),i);return S.createElement(S.Fragment,null,u&&S.createElement(x,{sideCar:Jt,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?S.cloneElement(S.Children.only(s),U(U({},w),{ref:C})):S.createElement(v,U({},w,{className:c,ref:C}),s))});Xt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Xt.classNames={fullWidth:Ft,zeroRight:Pt};var Zt=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Qt(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Zt();return t&&e.setAttribute(`nonce`,t),e}function $t(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function en(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var tn=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Qt())&&($t(t,n),en(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},nn=function(){var e=tn();return function(t,n){S.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},rn=function(){var e=nn();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},an={left:0,top:0,right:0,gap:0},on=function(e){return parseInt(e||``,10)||0},sn=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[on(n),on(r),on(i)]},cn=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return an;var t=sn(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])}},ln=rn(),un=`data-scroll-locked`,dn=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
|
.${It} {
|
|
3
3
|
overflow: hidden ${r};
|
|
4
4
|
padding-right: ${s}px ${r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{O as t,T as n,b as r,k as i,m as a,u as o,x as s,y as c}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{di as l}from"./GithubIcon.es-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{O as t,T as n,b as r,k as i,m as a,u as o,x as s,y as c}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{di as l}from"./GithubIcon.es-CIm0nGDf.js";import{pt as u}from"./useSessionRows-CIakAaqj.js";var d=e(i(),1),f=t(),p={name:`Enter`,width:18,path:`M17 2V8.5A3 3 0 0 1 14 11.5H1M5.5 7L1 11.5L5.5 16`},m={"⌘":{name:`Command`,width:18,path:`M14.25 1A2.75 2.75 0 0 0 11.5 3.75V14.25A2.75 2.75 0 1 0 14.25 11.5H3.75A2.75 2.75 0 1 0 6.5 14.25V3.75A2.75 2.75 0 1 0 3.75 6.5H14.25A2.75 2.75 0 0 0 14.25 1Z`},"⇧":{name:`Shift`,width:18,path:`M9 1L1 9.25H5.25V17H12.75V9.25H17Z`},"⌥":{name:`Option`,width:18,path:`M1 1H5.5L12.5 17H17M11.5 1H17`},"⌃":{name:`Control`,width:16,path:`M1 12.5L8 5.5L15 12.5`},"↵":p,"⏎":p,"⌫":{name:`Backspace`,width:22,path:`M7 2H18A3 3 0 0 1 21 5V13A3 3 0 0 1 18 16H7L1 9ZM10.5 6.5L15.5 11.5M15.5 6.5L10.5 11.5`},"⌦":{name:`Forward delete`,width:22,path:`M15 2H4A3 3 0 0 0 1 5V13A3 3 0 0 0 4 16H15L21 9ZM11.5 6.5L6.5 11.5M6.5 6.5L11.5 11.5`},"⎋":{name:`Escape`,width:18,path:`M9 1A8 8 0 1 1 1 9M9 9L1 1M5 1H1V5`},"⇥":{name:`Tab`,width:19,path:`M1 9H14M9 4L14 9L9 14M18 2V16`},"␣":{name:`Space`,width:18,path:`M1 11V16H17V11`},"↑":{name:`Up arrow`,width:14,path:`M7 17V1M1 7L7 1L13 7`},"↓":{name:`Down arrow`,width:14,path:`M7 1V17M1 11L7 17L13 11`},"←":{name:`Left arrow`,width:18,path:`M17 9H1M7 3L1 9L7 15`},"→":{name:`Right arrow`,width:18,path:`M1 9H17M11 3L17 9L11 15`}},h=Object.keys(m).join(``),g=RegExp(`([${h}])`),_=RegExp(`(?<=\\S)\\s*(?=[${h}])|(?<=[${h}])\\s*(?=\\S)`,`g`);function v({symbol:e}){let{name:t,width:n,path:r}=m[e]??{};return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`svg`,{role:`img`,"aria-label":t,viewBox:`0 0 ${n} 18`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`mx-[0.06em] inline-block h-[1cap]! w-auto! overflow-visible [stroke-width:var(--key-stroke,2)] align-baseline`,children:(0,f.jsx)(`path`,{d:r})}),(0,f.jsx)(`span`,{"aria-hidden":!0,style:{font:`0/0 a`},children:e})]})}function y({children:e}){let t=d.Children.toArray(e).reduce((e,t)=>{let n=e.at(-1);return typeof n==`string`&&typeof t==`string`?[...e.slice(0,-1),n+t]:[...e,t]},[]);return d.Children.map(t,e=>{if(typeof e!=`string`||!g.test(e))return e;let t=e.replace(_,` `).split(g);return(0,f.jsx)(`span`,{className:`whitespace-nowrap`,children:t.map((e,t)=>t%2?(0,f.jsx)(v,{symbol:e},t):e)})})}var b={default:`h-6 min-w-6 rounded-md px-1.5 text-caption`,sm:`h-5 min-w-5 rounded-md px-1 text-meta [--key-stroke:2.5]`,xs:`h-4 min-w-4 rounded px-1 text-meta leading-none [--key-stroke:2.5]`},x=({children:e,size:t=`default`,className:r})=>(0,f.jsx)(`kbd`,{className:n(`inline-flex items-center justify-center bg-card font-mono text-foreground shadow-raised`,b[t],o.transform,`active:scale-95 active:shadow-none`,r),children:(0,f.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic] [word-spacing:-0.3em]`,children:(0,f.jsx)(y,{children:e})})}),S=2e3;function C(){let[e]=(0,d.useState)(()=>typeof performance>`u`?`0ms`:`${-Math.round(performance.now()%S)}ms`);return e}function w({className:e,style:t,...r}){let i=C();return(0,f.jsx)(`div`,{className:n(`relative overflow-hidden rounded-md bg-muted`,`before:absolute before:inset-0`,`before:-translate-x-full`,`before:animate-[shimmer_2s_infinite] before:[animation-delay:var(--shimmer-delay)]`,`before:bg-linear-to-r before:from-transparent before:via-fill-subtle before:to-transparent`,e),style:{"--shimmer-delay":i,...t},...r})}function T({line:e=`text-body-sm`,className:t}){return(0,f.jsxs)(`span`,{className:n(`flex items-center`,e),children:[(0,f.jsx)(`span`,{"aria-hidden":!0,children:``}),(0,f.jsx)(w,{className:n(`h-3.5`,t)})]})}function E(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=l(),{ref:i,index:a}=u(e),o=n===a,s=d.useRef(null),f=c(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:f,index:a}}function D(e){let{render:t,className:n,style:i,state:o=s,props:c=r,refs:l=r,metadata:u,stateAttributesMapping:d,tag:f=`div`,...p}=e,{compositeProps:m,compositeRef:h}=E({metadata:u});return a(f,e,{state:o,ref:[h,...l],props:[m,...c,p],stateAttributesMapping:d})}export{x as a,T as i,E as n,y as o,w as r,D as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{O as t,b as n,k as r,m as i,x as a,y as o}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{gt as s,mt as c}from"./useSessionRows-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{O as t,b as n,k as r,m as i,x as a,y as o}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{gt as s,mt as c}from"./useSessionRows-CIakAaqj.js";import{Bn as l,Fn as u,Ga as d,Hi as f,Hn as p,In as m,Ka as h,Ln as g,Os as _,Pn as v,Rn as y,Ua as b,Un as x,Xa as S,Ya as C,ao as w,as as T,ui as E}from"./GithubIcon.es-CIm0nGDf.js";var D=e(r(),1),O=`data-composite-item-active`;function k(e){let{loopFocus:t=!0,orientation:r=`both`,grid:i,onLoop:a,direction:c,highlightedIndex:l,onHighlightedIndexChange:f,rootRef:E,enableHomeAndEndKeys:O=!1,stopEventPropagation:k,disabledIndices:M,modifierKeys:N=n}=e,[P,F]=D.useState(0),I=i!=null,L=D.useRef(null),R=o(L,E),z=D.useRef([]),B=D.useRef(!1),V=D.useRef(null),H=l??P,U=w((e,t=!1)=>{if(V.current=z.current[e]??null,(f??F)(e),t){let t=z.current[e];x(L.current,t,c,r)}}),W=w(e=>{if(e.size===0)return;if(B.current){let e=z.current,t=e.indexOf(V.current);if(t===-1){let t=e[H];!t||S(e,H,M)?U(A(e,M)):V.current=t}else t!==H&&U(t);return}B.current=!0;let t=Array.from(e.keys()),n=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=n?e.get(n)?.index??-1:-1;if(i!==-1)U(i);else if(S(t,H,M)){let e=b(t,{disabledIndices:M});C(t,e)||U(e)}x(L.current,n,c,r)});_(()=>{if(M==null||l!=null||!B.current)return;let e=z.current;if(S(e,H,M)){let t=b(e,{disabledIndices:M});C(e,t)||U(t)}},[M,l,H,z,U]);let G=w((e,t,n)=>a?a(e,t,n,z):n),K=w(e=>{let n=e.key===`Home`||e.key===`End`;if(!y.has(e.key)||!O&&n||j(e,N)||!L.current)return;let o=c===`rtl`,l=o?u:m,f=o?m:u,_=r===`vertical`?v:l,x=r===`vertical`?g:f,S=T(e.nativeEvent);if(S!=null&&p(S)&&!s(S)){let t=S.selectionStart,n=S.selectionEnd,r=S.value;if(t==null||e.shiftKey||t!==n||e.key!==x&&t<r.length||e.key!==_&&t>0)return}let w=H,E=h(z,M),D=d(z,M);i!=null&&(w=i({disabledIndices:M,elementsRef:z,event:e,highlightedIndex:H,loopFocus:t,maxIndex:D,minIndex:E,onLoop:G,orientation:r,rtl:o}));let A=r!==`vertical`&&e.key===l||r!==`horizontal`&&e.key===`ArrowDown`,P=r!==`vertical`&&e.key===f||r!==`horizontal`&&e.key===`ArrowUp`;O&&(e.key===`Home`?w=E:e.key===`End`&&(w=D)),w===H&&(A||P)&&(t&&w===D&&A?(w=E,a&&(w=a(e,H,w,z))):t&&w===E&&P?(w=D,a&&(w=a(e,H,w,z))):w=b(z.current,{startingIndex:w,decrement:P,disabledIndices:M})),w!==H&&!C(z.current,w)&&(k&&e.stopPropagation(),(I||n||A||P)&&e.preventDefault(),U(w,!0),queueMicrotask(()=>{z.current[w]?.focus()}))});return{props:{ref:R,onFocus(e){let t=L.current,n=T(e.nativeEvent);t&&n!=null&&p(n)&&n.setSelectionRange(0,n.value.length)},onKeyDown:K},highlightedIndex:H,onHighlightedIndexChange:U,elementsRef:z,onMapChange:W,relayKeyboardEvent:K}}function A(e,t){let n=-1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i&&!S(e,r,t)){if(i.hasAttribute(`data-composite-item-active`))return r;n===-1&&(n=r)}}return Math.max(n,0)}function j(e,t){for(let n of l)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}var M=t();function N(e){let{render:t,className:r,style:o,refs:s=n,props:l=n,state:u=a,stateAttributesMapping:d,highlightedIndex:p,onHighlightedIndexChange:m,orientation:h,grid:g,loopFocus:_,onLoop:v,enableHomeAndEndKeys:y,onMapChange:b,stopEventPropagation:x=!0,rootRef:S,disabledIndices:C,modifierKeys:w,highlightItemOnHover:T=!1,tag:O=`div`,...A}=e,{props:j,highlightedIndex:N,onHighlightedIndexChange:P,elementsRef:F,onMapChange:I,relayKeyboardEvent:L}=k({grid:g,loopFocus:_,onLoop:v,orientation:h,highlightedIndex:p,onHighlightedIndexChange:m,rootRef:S,stopEventPropagation:x,enableHomeAndEndKeys:y,direction:f(),disabledIndices:C,modifierKeys:w}),R=i(O,e,{state:u,ref:s,props:[j,...l,A],stateAttributesMapping:d}),z=D.useMemo(()=>({highlightedIndex:N,onHighlightedIndexChange:P,highlightItemOnHover:T,relayKeyboardEvent:L}),[N,P,T,L]);return(0,M.jsx)(E.Provider,{value:z,children:(0,M.jsx)(c,{elementsRef:F,onMapChange:e=>{b?.(e),I(e)},children:R})})}export{O as n,N as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{O as t,T as n,f as r,i,k as a,n as o,s}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{c,h as l,ni as u,qn as d}from"./GithubIcon.es-CIm0nGDf.js";import{i as f,n as p,r as m,t as h}from"./select-BPzTS5dZ-BGYcBcgg.js";import{J as g,q as _}from"./useSessionRows-CIakAaqj.js";import{t as ee}from"./IconPlusMedium.es-BOotRziY.js";import{a as v,c as y,d as b,i as x,l as S,s as C,u as w}from"./combobox-parts-BVuRAhY6-ClaPtI8E.js";import{t as te}from"./IconUser.es-ZvgkqymT.js";import{t as ne}from"./IconCircleCheck.es-D6u0E19o.js";import{D as re,O as ie,S as ae,b as T,x as E}from"./ruleLanes-CB6XWPZ9.js";import{m as oe}from"./useIntakeRoutes-C2h717K6.js";import{t as se}from"./createLucideIcon-BHFyd0LL.js";import{t as ce}from"./TrashIcon.es-DoCvaCDh.js";import{t as le}from"./IconUserDuo.es-CJ2yCPc7.js";import{t as ue}from"./input-DqReKX0A-D66C6dWr.js";import{d as de,o as fe,r as pe}from"./useLinearData-D6cSKZs3.js";import{Bn as D,En as me,Sr as he,Tn as O,kn as ge,vr as _e,yr as ve,zn as k}from"./index-Btp5jnxM.js";import{t as ye}from"./IconHashtag.es-CFMCiJRV.js";import{t as A}from"./IconPlugin1.es-D6CUXlu_.js";var j={name:`folder-git-2`,size:24,node:[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]};j.node;var be=se(j);function xe({factoryProjectId:e,repositories:t=[],bindings:n=[],linearProjects:r=[],linearTeams:i=[],jiraProjects:a=[]}){let o=t=>new Set(n.filter(n=>n.integrationId===t&&n.factoryProjectId===e).map(e=>e.sourceId)),s=o(`linear`),c=o(`jira`),l=[...t.map(e=>({value:e.slug,provider:e.provider??`github`})),...r.filter(e=>s.has(e.id)).flatMap(e=>e.teams.map(e=>({value:e.key,provider:`linear`}))),...i.filter(e=>s.has(de(e))).map(e=>({value:e.key,provider:`linear`})),...a.filter(e=>c.has(e.id)).map(e=>({value:e.key,provider:`jira`}))],u=new Set;return l.filter(e=>{let t=`${e.provider}\0${e.value.toLowerCase()}`;return!u.has(t)&&(u.add(t),!0)})}var M=e=>`provider`in e&&typeof e.provider==`string`;function Se(e,t){if(!Array.isArray(e.suggestions))return e;let n=ve(t),r=new Set;return{...e,suggestions:e.suggestions.filter(e=>{if(n&&M(e)&&!n.has(e.provider))return!1;let t=e.value.toLowerCase();return!r.has(t)&&(r.add(t),!0)})}}function Ce(e){let t=c(e),n=l(),r=t=>(n.data??[]).some(n=>n.integrationId===t&&n.factoryProjectId===e),i=pe(r(`linear`)),a=fe(r(`linear`)),o=ge(r(`jira`));return xe({factoryProjectId:e,repositories:t.data?.repositories,bindings:n.data,linearProjects:i.data?.projects,linearTeams:a.data?.teams,jiraProjects:o.data})}var N=t(),P=`flex h-control-sm w-14 shrink-0 items-center`;function F({className:e,...t}){return(0,N.jsx)(`div`,{"data-slot":`rule-lines`,className:n(`flex flex-col gap-2`,e),...t})}function I({className:e,...t}){return(0,N.jsx)(`div`,{"data-slot":`rule-line`,className:n(`flex items-start gap-2`,e),...t})}function L({className:e,children:t,...r}){return(0,N.jsx)(`span`,{"data-slot":`rule-line-keyword`,"aria-hidden":t===void 0||void 0,className:n(P,i({variant:`caption`,tone:`muted`}),e),...r,children:t})}function we({value:e,onValueChange:t,"aria-label":n=`Match all or any`}){return(0,N.jsx)(`div`,{"data-slot":`rule-line-logic`,className:P,children:(0,N.jsxs)(h,{value:e,onValueChange:e=>e&&t(e),children:[(0,N.jsx)(f,{size:`sm`,variant:`ghost`,"aria-label":n,className:`-ml-2 w-fit px-2`,children:(0,N.jsx)(`span`,{className:i({variant:`caption`,tone:`ink`}),children:e===`AND`?`and`:`or`})}),(0,N.jsxs)(p,{children:[(0,N.jsx)(m,{value:`AND`,children:`and`}),(0,N.jsx)(m,{value:`OR`,children:`or`})]})]})})}function R({className:e,...t}){return(0,N.jsx)(`div`,{"data-slot":`rule-line-content`,className:n(`flex min-h-control-sm min-w-0 flex-1 flex-wrap items-center gap-1.5`,e),...t})}function Te({depth:e,className:t,...r}){return(0,N.jsx)(`div`,{role:`group`,"data-slot":`rule-line-group`,className:n(`flex min-w-0 flex-1 items-start gap-2 rounded-lg border border-border p-2`,e%2==0?`bg-fill-subtle`:`bg-card`,`[&>[data-slot=rule-lines]]:min-w-0 [&>[data-slot=rule-lines]]:flex-1`,t),...r})}function Ee({className:e,...t}){return(0,N.jsx)(u,{variant:`ghost`,size:`icon-sm`,className:n(`ml-auto`,e),...t,children:(0,N.jsx)(d,{})})}function De({className:e,children:t,...r}){return(0,N.jsx)(u,{icon:(0,N.jsx)(ce,{}),variant:`ghost`,size:`sm`,className:n(`ml-auto`,e),...r,children:t})}function Oe({className:e,...t}){return(0,N.jsx)(`span`,{"data-slot":`rule-line-hint`,className:n(i({variant:`caption`,tone:`muted`}),`px-1`,e),...t})}function z({icon:e,className:t,children:r,...a}){return(0,N.jsxs)(`button`,{type:`button`,"data-slot":`rule-add-button`,className:n(i({variant:`caption`,tone:`muted`}),`inline-flex h-control-sm items-center gap-1.5 rounded-full border border-dashed border-border px-3 hover:border-border-strong hover:text-foreground [&_svg]:size-icon-sm`,s,t),...a,children:[e,r]})}var ke=r(`IconColumns3`,()=>(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`path`,{d:`M18 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V6C20 4.89543 19.1046 4 18 4Z`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`}),(0,N.jsx)(`path`,{d:`M9.33984 4V20`,stroke:`currentColor`,strokeWidth:`2`}),(0,N.jsx)(`path`,{d:`M14.6602 4V20`,stroke:`currentColor`,strokeWidth:`2`})]})),Ae=r(`IconFontStyle`,()=>(0,N.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M19.4639 19H20C20.5523 19 21 19.4477 21 20C21 20.5523 20.5523 21 20 21H14.5C13.9477 21 13.5 20.5523 13.5 20C13.5 19.4477 13.9477 19 14.5 19H15.2578L13.9551 15H8.15625L6.85449 19H7.5C8.05228 19 8.5 19.4477 8.5 20C8.5 20.5523 8.05228 21 7.5 21H4.5C3.94772 21 3.5 20.5523 3.5 20C3.5 19.4477 3.94772 19 4.5 19H4.75L9.29418 5.04203C9.69064 3.82426 10.8258 3 12.1065 3C13.3871 3 14.5223 3.82418 14.9188 5.04188L19.4639 19ZM8.80762 13H13.3037L11.3409 6.97096C11.251 6.69479 10.8603 6.69479 10.7704 6.97096L8.80762 13Z`,fill:`currentColor`})),je=r(`IconMerged`,()=>(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`circle`,{cx:`6`,cy:`6`,r:`2`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,N.jsx)(`circle`,{cx:`6`,cy:`18`,r:`2`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,N.jsx)(`circle`,{cx:`18`,cy:`18`,r:`2`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,N.jsx)(`path`,{d:`M6 8V16`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,N.jsx)(`path`,{d:`M8 6H16C17.1046 6 18 6.89543 18 8V16`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})]})),Me=r(`IconZap`,()=>(0,N.jsx)(`path`,{d:`M19.5657 9H13.5C13.2239 9 13 8.77614 13 8.5V2.40139C13 1.90668 12.3584 1.71242 12.084 2.12404L4.01823 14.2226C3.79672 14.5549 4.03491 15 4.43426 15H10.5C10.7761 15 11 15.2239 11 15.5V21.5986C11 22.0933 11.6416 22.2876 11.916 21.876L19.9818 9.77735C20.2033 9.44507 19.9651 9 19.5657 9Z`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`})),B=e(a(),1),V=new Set([`exists`,`not_exists`]),H=new Set([`in`,`not_in`]),U=e=>`items`in e,Ne=0,W=()=>`condition-${++Ne}`,G=()=>({key:W(),field:``,operator:``}),Pe=e=>e+2<=3;function Fe(e){let t=e=>`conditions`in e?{key:W(),logic:e.operator,items:e.conditions.map(t)}:{key:W(),field:e.field,operator:e.operator,value:e.value};return{key:`root`,logic:e?.operator??`AND`,items:e?.conditions.map(t)??[]}}var Ie=e=>oe.some(t=>t===e);function Le(e){if(!e.field)return!1;if(V.has(e.operator))return!0;let{value:t}=e;return t===void 0?!1:Array.isArray(t)?t.length>0:typeof t!=`string`||t.trim()!==``}function K(e){let t=!1,n=e=>{if(U(e)){let t=e.items.map(n).filter(e=>e!==void 0);return t.length>0?{operator:e.logic,conditions:t}:void 0}let{operator:r}=e;if(!Ie(r)||!Le(e))t=!0;else return V.has(r)?{field:e.field,operator:r}:{field:e.field,operator:r,value:e.value}},r=e.items.map(n).filter(e=>e!==void 0);return{rule:r.length>0?{operator:e.logic,conditions:r}:null,incomplete:t}}function q(e,t,n){if(!V.has(t))return e.type===`boolean`?typeof n!=`boolean`||n:H.has(t)?Array.isArray(n)?n:n===void 0||n===``?[]:[n]:Array.isArray(n)?n[0]:n}var Re=r(`IconListAdd`,()=>(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`path`,{d:`M4 6H20`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,N.jsx)(`path`,{d:`M4 12H10`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,N.jsx)(`path`,{d:`M15 15L21 15`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,N.jsx)(`path`,{d:`M18 12V18`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,N.jsx)(`path`,{d:`M4 18H10`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})]})),ze={"item.labels":me,"item.title":Ae,"item.author":te,"item.key":ye,"item.state":_,"item.assignees":le,"item.pullRequest":g,"item.trusted":O,"pullRequest.trusted":O,"source.kind":g,"source.integration":A,"source.provider":A,"source.repository":be,"pullRequest.closesIssue":je,"closedIssue.phase":ke,"closedIssue.hasPullRequest":g,"event.type":Me,"event.reason":ne},Be=ie();function J(e,t){return e?.operatorLabels?.[t]??T.find(e=>e.id===t)?.label??t}function Y(e){return Array.isArray(e?.suggestions)&&e.suggestions.length>0?e.suggestions:void 0}function X({label:e,rule:t,facts:n,options:r,emptyHint:i,onChange:a}){let s=ae(n,r),[c,l]=(0,B.useState)(()=>Fe(t)),{rule:u,incomplete:d}=K(c),f=he(u);return(0,N.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,N.jsx)(Z,{role:`group`,"aria-label":e,group:c,depth:0,fields:s,emptyHint:i,onChange:e=>{l(e);let{rule:t,incomplete:n}=K(e);a(t,n)}}),d&&(0,N.jsx)(o,{as:`p`,variant:`caption`,tone:`muted`,children:`Finish or remove unfinished conditions to save.`}),f&&(0,N.jsx)(o,{as:`p`,variant:`caption`,tone:`muted`,children:f})]})}function Z({role:e,"aria-label":t,group:n,depth:r,fields:i,limits:a=[],emptyHint:o,onChange:s,onRemove:c}){let l=(e,t)=>s({...n,items:t===void 0?n.items.filter((t,n)=>n!==e):n.items.with(e,t)}),u=e=>s({...n,items:[...n.items,e]}),d=(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z,{icon:(0,N.jsx)(ee,{}),onClick:()=>u(G()),children:`Add condition`}),Pe(r)&&(0,N.jsx)(z,{icon:(0,N.jsx)(Re,{}),onClick:()=>u({key:W(),logic:n.logic===`AND`?`OR`:`AND`,items:[G()]}),children:`Add group`}),c&&(0,N.jsx)(De,{onClick:c,children:`Remove group`})]});if(n.items.length===0)return(0,N.jsx)(F,{role:e,"aria-label":t,children:(0,N.jsxs)(I,{children:[(0,N.jsx)(L,{children:`Where`}),(0,N.jsxs)(R,{children:[d,o&&(0,N.jsx)(Oe,{children:o})]})]})});let f=n.logic===`AND`?`and`:`or`,p=_e(n.logic,a,n.items.filter(e=>!U(e)));return(0,N.jsxs)(F,{role:e,"aria-label":t,children:[n.items.map((e,t)=>(0,N.jsxs)(I,{children:[t===1?(0,N.jsx)(we,{value:n.logic,onValueChange:e=>s({...n,logic:e})}):(0,N.jsx)(L,{children:t===0?`Where`:f}),U(e)?(0,N.jsx)(Te,{depth:r,"aria-label":e.logic===`AND`?`All of these`:`Any of these`,children:(0,N.jsx)(Z,{group:e,depth:r+1,fields:i,limits:p,onChange:e=>l(t,e.items.length>0?e:void 0),onRemove:()=>l(t,void 0)})}):(0,N.jsx)(Ve,{row:e,fields:i,limits:p.filter(t=>t!==e),onChange:e=>l(t,e),onRemove:()=>l(t,void 0)})]},e.key)),(0,N.jsxs)(I,{children:[(0,N.jsx)(L,{}),(0,N.jsx)(R,{children:d})]})]})}function Q({id:e}){let t=ze[e]??_;return(0,N.jsx)(t,{"aria-hidden":`true`,className:`text-muted-foreground size-3.5 shrink-0`})}function Ve({row:e,fields:t,limits:n,onChange:r,onRemove:i}){let a=Be.find(t=>t.id===e.field),s=a&&!t.some(e=>e.id===a.id)?[a,...t]:t,c=s.find(t=>t.id===e.field),l=c&&Se(c,n),u=!!l&&re(l.id)&&(!e.operator||e.operator===`exists`||e.operator===`not_exists`);return(0,N.jsxs)(R,{children:[(0,N.jsxs)(h,{value:e.field||null,onValueChange:t=>{let n=s.find(e=>e.id===t);if(!n)return;let i=n.operators?.[0]??`equals`;r({...e,field:n.id,operator:i,value:q(n,i,void 0)})},children:[(0,N.jsx)(f,{size:`sm`,"aria-label":`Field`,className:`w-fit max-w-full`,children:(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[l&&(0,N.jsx)(Q,{id:l.id}),(0,N.jsx)(o,{as:`span`,variant:`caption`,className:`truncate`,children:l?.label??(e.field||`Choose a field`)})]})}),(0,N.jsx)(p,{children:s.map(e=>(0,N.jsx)(m,{value:e.id,children:(0,N.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(Q,{id:e.id}),e.label]})},e.id))})]}),l?.type===`boolean`&&(0,N.jsx)(He,{row:e,field:l,onChange:r}),l&&u&&(0,N.jsx)(Ue,{row:e,field:l,onChange:r}),l&&l.type!==`boolean`&&!u&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(h,{value:e.operator,onValueChange:t=>t&&r({...e,operator:t,value:q(l,t,e.value)}),children:[(0,N.jsx)(f,{size:`sm`,variant:`ghost`,"aria-label":`Operator`,className:`w-fit`,children:(0,N.jsx)(o,{as:`span`,variant:`caption`,children:J(l,e.operator)})}),(0,N.jsx)(p,{children:(l.operators??[]).map(e=>(0,N.jsx)(m,{value:e,children:J(l,e)},e))})]}),!V.has(e.operator)&&(0,N.jsx)(We,{row:e,field:l,onChange:r})]}),(0,N.jsx)(Ee,{"aria-label":`Remove condition`,onClick:i})]})}function He({row:e,field:t,onChange:n}){let r=Y(t)??[{value:`true`,label:`Yes`},{value:`false`,label:`No`}],i=e.operator!==`not_equals`==(e.value!==!1);return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(o,{as:`span`,variant:`caption`,tone:`muted`,children:`is`}),(0,N.jsx)(k,{size:`sm`,"aria-label":t.label,value:String(i),onValueChange:t=>n({...e,operator:`equals`,value:t===`true`}),children:r.map(e=>(0,N.jsx)(D,{value:e.value,children:e.label},e.value))})]})}function Ue({row:e,field:t,onChange:n}){return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(o,{as:`span`,variant:`caption`,tone:`muted`,children:`is`}),(0,N.jsxs)(k,{size:`sm`,"aria-label":t.label,value:e.operator===`not_exists`?`false`:`true`,onValueChange:t=>n({...e,operator:t===`true`?`exists`:`not_exists`,value:void 0}),children:[(0,N.jsx)(D,{value:`true`,children:`Yes`}),(0,N.jsx)(D,{value:`false`,children:`No`})]})]})}function We({row:e,field:t,onChange:n}){let r=Y(t),i=H.has(e.operator),a=T.find(t=>t.id===e.operator)?.freeText===!0;if(t.strict===!1&&!a){let a=Array.isArray(e.value)?e.value.map(String):e.value===void 0?[]:[String(e.value)];return(0,N.jsx)(Ke,{options:(r??[]).map(e=>({value:e.value,label:e.label??e.value})),values:a,many:i,placeholder:E[t.id]??`Search or type a value`,onChange:t=>n({...e,value:i?t:t[0]})})}if(r&&i){let t=Array.isArray(e.value)?e.value.map(String):[];return(0,N.jsx)(Ge,{options:r.map(e=>({value:e.value,label:e.label??e.value})),values:t,onChange:t=>n({...e,value:t})})}if(r){let t=r.find(t=>t.value===String(e.value??``));return(0,N.jsxs)(h,{value:e.value===void 0?null:String(e.value),onValueChange:t=>t!==null&&n({...e,value:t}),children:[(0,N.jsx)(f,{size:`sm`,"aria-label":`Value`,className:`w-fit`,children:(0,N.jsx)(o,{as:`span`,variant:`caption`,className:`font-medium`,children:t?.label??(e.value===void 0?`Choose a value`:String(e.value))})}),(0,N.jsx)(p,{children:r.map(e=>(0,N.jsx)(m,{value:e.value,children:e.label},e.value))})]})}return(0,N.jsx)(Je,{row:e,field:t,many:i,onChange:n})}function $(e){return e.length===0?`Choose values`:e.length>3?`${e.slice(0,2).join(`, `)} +${e.length-2}`:e.length===1?e[0]:`${e.slice(0,-1).join(`, `)} or ${e.at(-1)}`}function Ge({options:e,values:t,onChange:r}){let i=t.map(t=>e.find(e=>e.value===t)??{value:t,label:t}),a=[...e,...i.filter(t=>!e.includes(t))],s=i.map(e=>e.label);return(0,N.jsxs)(S,{multiple:!0,autoHighlight:!0,items:a,value:i,itemToStringLabel:e=>e.label,isItemEqualToValue:(e,t)=>e.value===t.value,onValueChange:e=>r(e.map(e=>e.value)),children:[(0,N.jsx)(b,{size:`sm`,"aria-label":`Values`,title:s.join(`, `),className:`w-fit max-w-64`,children:(0,N.jsx)(o,{as:`span`,variant:`caption`,className:n(`font-medium`,s.length===0&&`text-muted-foreground`),children:$(s)})}),(0,N.jsxs)(x,{children:[(0,N.jsx)(w,{placeholder:`Search`}),(0,N.jsx)(v,{children:`No option found.`}),(0,N.jsx)(y,{children:e=>(0,N.jsx)(C,{value:e,children:e.label},e.value)})]})]})}function Ke({options:e,values:t,many:r,placeholder:i,onChange:a}){let[s,c]=(0,B.useState)(``),l=s.trim(),u=t=>e.some(e=>e.value.toLowerCase()===t.toLowerCase()),d=t.map(t=>e.find(e=>e.value===t)??{value:t,label:t}),f=[...e,...d.filter(t=>!e.includes(t)),...l&&!u(l)&&!t.includes(l)?[{value:l,label:`Use “${l}”`}]:[]],p=d.map(e=>e.value),m={autoHighlight:!0,items:f,inputValue:s,onInputValueChange:c,itemToStringLabel:e=>e.label,isItemEqualToValue:(e,t)=>e.value===t.value},h=(0,N.jsxs)(x,{children:[(0,N.jsx)(w,{placeholder:i}),(0,N.jsx)(v,{children:`Type a value to use it.`}),(0,N.jsx)(y,{children:e=>(0,N.jsx)(C,{value:e,children:e.label},e.value)})]}),g=(0,N.jsx)(o,{as:`span`,variant:`caption`,className:n(`font-medium`,p.length===0&&`text-muted-foreground`),children:p.length===0?i:$(p)});return r?(0,N.jsxs)(S,{...m,multiple:!0,value:d,onValueChange:e=>a(e.map(e=>e.value)),children:[(0,N.jsx)(b,{size:`sm`,"aria-label":`Values`,title:p.join(`, `),className:`w-fit max-w-64`,children:g}),h]}):(0,N.jsxs)(S,{...m,value:d[0]??null,onValueChange:e=>e&&a([e.value]),children:[(0,N.jsx)(b,{size:`sm`,"aria-label":`Value`,title:p[0],className:`w-fit max-w-64`,children:g}),h]})}function qe(e){return Array.isArray(e)?e.join(`, `):e===void 0?``:String(e)}function Je({row:e,field:t,many:n,onChange:r}){let[i,a]=(0,B.useState)(),o=(0,B.useRef)(void 0),s=i??qe(e.value),c=e=>{if(n)return e.split(`,`).map(e=>e.trim()).filter(e=>e!==``);if(t.type!==`number`)return e.trim();let r=Number(e.trim());return e.trim()!==``&&Number.isFinite(r)?r:void 0},l=t=>{i===void 0&&(o.current=e.value),a(t),r({...e,value:c(t)})};return(0,N.jsx)(ue,{size:`sm`,"aria-label":`Value`,type:t.type===`number`&&!n?`number`:`text`,placeholder:E[t.id]??(n?`Values, comma separated`:`Value`),value:s,className:`w-48`,onChange:e=>l(e.target.value),onBlur:()=>a(void 0),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),a(void 0)):t.key===`Escape`&&i!==void 0&&(a(void 0),r({...e,value:o.current}))}})}export{Ce as n,X as t};
|