@vantran-se/openchamber-web 2.4.2 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AboutDialog-Dz_8z7Rq.js → AboutDialog-C8mAGhnz.js} +1 -1
- package/dist/assets/{ArchiveView-BoMjLD0N.js → ArchiveView-4-LVDLmf.js} +1 -1
- package/dist/assets/{ChangedPathLabel-BirEUxH2.js → ChangedPathLabel-BCiU4QDF.js} +1 -1
- package/dist/assets/{CommandPalette-DkLX-AKB.js → CommandPalette-DEcmPHdC.js} +1 -1
- package/dist/assets/{DiffView-DwyXDHsF.js → DiffView-CaDZ4gTk.js} +3 -3
- package/dist/assets/{FilesView-BFi9HBg1.js → FilesView-Csrs_BGv.js} +1 -1
- package/dist/assets/{GitView-BzWRNg_F.js → GitView-DvxCZgCW.js} +3 -3
- package/dist/assets/{GuestSurfacePane-zDcKyz78.js → GuestSurfacePane-DNg0xBTD.js} +1 -1
- package/dist/assets/{HelpDialog-DZVlv3x2.js → HelpDialog-CLyz3_xd.js} +1 -1
- package/dist/assets/{InProgressOperationBanner-BiEntIfh.js → InProgressOperationBanner-BVDKUDqn.js} +2 -2
- package/dist/assets/{IntegrationsCatalogView-CCHFMcZP.js → IntegrationsCatalogView-u1gS0Vk8.js} +1 -1
- package/dist/assets/{JsonTreeView-BwELoub1.js → JsonTreeView-BpJU14WJ.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-DxBYkSKd.js → MarkdownRendererImpl-t3OoYn_0.js} +1 -1
- package/dist/assets/{MemoryDebugPanel-C9zpPXVo.js → MemoryDebugPanel-9z1jGWze.js} +1 -1
- package/dist/assets/{OnboardingScreen-Cnzzs_TQ.js → OnboardingScreen-xzT7ckY0.js} +1 -1
- package/dist/assets/{OpenCodeStatusDialog-DizE9xAy.js → OpenCodeStatusDialog-skpJZSjK.js} +1 -1
- package/dist/assets/{PatchDiff-Cz_UxB-k.js → PatchDiff-BWW_8bob.js} +1 -1
- package/dist/assets/{PierreDiffViewer-BT3MrXwN.js → PierreDiffViewer-BZDNV4Uj.js} +1 -1
- package/dist/assets/{PlanView-B-SCCd7M.js → PlanView-D7wshtfZ.js} +1 -1
- package/dist/assets/{ProjectActionsDialog-4OSNuzpG.js → ProjectActionsDialog-BPh74BCt.js} +1 -1
- package/dist/assets/{PullRequestComparisonSelector-lp98DrYm.js → PullRequestComparisonSelector-BBdU2rL1.js} +3 -3
- package/dist/assets/{RunOverview-DJhjR9uR.js → RunOverview-Cngm2OOp.js} +2 -2
- package/dist/assets/{ScheduledTasksDialog-Dwil7zsx.js → ScheduledTasksDialog-DUjDdkw2.js} +1 -1
- package/dist/assets/{SettingsView-DVcV2Rk9.js → SettingsView-CCZOw018.js} +2 -2
- package/dist/assets/{SettingsWindow-DbbAS4Se.js → SettingsWindow-Cndsj5Vu.js} +1 -1
- package/dist/assets/{SourceBoardView-BVcmYpvE.js → SourceBoardView-8Wp0oUvB.js} +1 -1
- package/dist/assets/{SpaceAccessDialog-DxjFUcHZ.js → SpaceAccessDialog-CxfCzTpe.js} +1 -1
- package/dist/assets/{SpaceApplyDialog-Dbrbh-j4.js → SpaceApplyDialog-CYp0A76N.js} +1 -1
- package/dist/assets/{SpaceRow-Cwam4mHh.js → SpaceRow-CQp4PkPJ.js} +1 -1
- package/dist/assets/{SpaceSetupOutput-B_w02jDi.js → SpaceSetupOutput-RNo0mWrR.js} +1 -1
- package/dist/assets/{SpacesView-CGrFWnO-.js → SpacesView-BwcDCv3D.js} +1 -1
- package/dist/assets/{SubmoduleDiffSummary-DFL-m_eu.js → SubmoduleDiffSummary-BQduif5s.js} +1 -1
- package/dist/assets/{ToolOutputDialog-Co0VXa0y.js → ToolOutputDialog-BVCvqYsK.js} +1 -1
- package/dist/assets/{ToolPartDiffPreview-CBSzwkat.js → ToolPartDiffPreview-BXpCHBW9.js} +1 -1
- package/dist/assets/{UsageStatsView-BjtTNSt8.js → UsageStatsView-CsC_RzAH.js} +1 -1
- package/dist/assets/{Virtualizer-Cmng0Q1E.js → Virtualizer-nenVQKi3.js} +1 -1
- package/dist/assets/{WalkthroughView-C7AkVuHQ.js → WalkthroughView-CdIYpttA.js} +1 -1
- package/dist/assets/{WorktreesView-CYU2KJ6E.js → WorktreesView-D102xE1o.js} +1 -1
- package/dist/assets/{appThemeRegistry-CDGE1wtP.js → appThemeRegistry-BWap7OfW.js} +1 -1
- package/dist/assets/{ar-BlEU--PN.js → ar-9CiK5cuu.js} +3 -3
- package/dist/assets/{computeVirtualFileMetrics-BgqasG86.js → computeVirtualFileMetrics-DDyA16hp.js} +1 -1
- package/dist/assets/{de-DWs4Mcjc.js → de-Drq6oIkP.js} +3 -3
- package/dist/assets/{decorate-CpxLqoVw.js → decorate-CemSwkUs.js} +1 -1
- package/dist/assets/{es-k5T7CE97.js → es-0bkFr34F.js} +3 -3
- package/dist/assets/{flexokiTheme-BG4cSAMb.js → flexokiTheme-PoX6Vqyn.js} +1 -1
- package/dist/assets/{fr-CzmypgZ8.js → fr-CjgWVupK.js} +3 -3
- package/dist/assets/{he-DdkxJnUn.js → he-BrJa9oPB.js} +4 -4
- package/dist/assets/{index-BrL960j-.js → index-B2WHEal3.js} +1 -1
- package/dist/assets/{initializeSharedPreferences-CrnmmfFs.js → initializeSharedPreferences-1Vo6G7CM.js} +1 -1
- package/dist/assets/{install-DvRQsTjX.js → install-FletzeYD.js} +1 -1
- package/dist/assets/{isDiffPlainText-KGYbp86N.js → isDiffPlainText-yXcpftjI.js} +1 -1
- package/dist/assets/{isFilePlainText-D7rclQrA.js → isFilePlainText-Dpm-_Qu8.js} +1 -1
- package/dist/assets/{ja-Qqkyglaf.js → ja-cfyrqWPa.js} +3 -3
- package/dist/assets/katex.min-F4TD1ekM.js +69 -0
- package/dist/assets/{ko-B8idPK2d.js → ko-herKAlGO.js} +3 -3
- package/dist/assets/{main-D4-y6PQ0.js → main-CO7wKNtS.js} +2 -2
- package/dist/assets/{main-Cmc8m6dZ.js → main-DN47yDMe.js} +19 -19
- package/dist/assets/markdownCore-BY21GJ_M.js +10 -0
- package/dist/assets/{miniChat-CjJ77DDL.js → miniChat-BmFJFQph.js} +2 -2
- package/dist/assets/{mobile-DlFdLxjR.js → mobile-DTi98S93.js} +2 -2
- package/dist/assets/{moveWorkspacePath-CVdEBQ6v.js → moveWorkspacePath-CENAo75W.js} +1 -1
- package/dist/assets/{nl-CFXZKHp7.js → nl-mZ4VCoiQ.js} +3 -3
- package/dist/assets/{parseDiffFromFile-DWemyyqU.js → parseDiffFromFile-BSmRvd3V.js} +1 -1
- package/dist/assets/{pierreDiffTint-B7qPTZmL.js → pierreDiffTint-cyYFR1bm.js} +1 -1
- package/dist/assets/{pl-slLgZWDu.js → pl-C98lvkcZ.js} +4 -4
- package/dist/assets/{pt-BR-C319g_nn.js → pt-BR-CB63WPLS.js} +3 -3
- package/dist/assets/{relocateRestoredSession-cOuWlgWB.js → relocateRestoredSession-D8Sf_FG_.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-DFnEi5Tr.js → renderElectronMiniChatApp-DmQ8i5jp.js} +2 -2
- package/dist/assets/{renderMobileApp-C2TYqVOV.js → renderMobileApp-CND9CafV.js} +3 -3
- package/dist/assets/{restartOpenCode-Dvk4CWW7.js → restartOpenCode-D8ExMl55.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-D7viEboD.js → runtimeEndpointReset-lg1O2gVX.js} +3 -3
- package/dist/assets/{scheduledTasksApi-FZ9stPNl.js → scheduledTasksApi-CJBNpwgy.js} +1 -1
- package/dist/assets/{selectionMarkdown-CCursbAw.js → selectionMarkdown-B_3WTOUr.js} +1 -1
- package/dist/assets/{shikiHighlight-CLj7Oan9.js → shikiHighlight-DBj_a_TN.js} +1 -1
- package/dist/assets/{space-apply-DdhqZWNy.js → space-apply-COMscpEL.js} +1 -1
- package/dist/assets/{space-close-KXdazynX.js → space-close-DDLvYCUc.js} +1 -1
- package/dist/assets/{spaceNetwork-DzU3SK9K.js → spaceNetwork-CNxs51y4.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-C-jxkZJj.js → textMateThemeFromAppTheme-tYpAceV3.js} +1 -1
- package/dist/assets/{tr-DNnJ5oqk.js → tr-C5KUa-8X.js} +3 -3
- package/dist/assets/{uk-Bw0BJwHw.js → uk-D44Grdmc.js} +3 -3
- package/dist/assets/{useAppFontEffects-DAUhSLPu.js → useAppFontEffects-Dm6zEvrf.js} +200 -199
- package/dist/assets/{useCallableModelProviders-B-UCRuyn.js → useCallableModelProviders-BK3j8Sde.js} +1 -1
- package/dist/assets/{useDiffFindSurface-CU_63uoI.js → useDiffFindSurface-CaCh-qt2.js} +1 -1
- package/dist/assets/{useInlineCommentController-bYCeqE6r.js → useInlineCommentController-a2JepiF3.js} +1 -1
- package/dist/assets/{useMarkdownLocalAssets-CnMxnDdI.js → useMarkdownLocalAssets-BEApAshz.js} +2 -2
- package/dist/assets/{useRootScrollLock-DNYaZ34X.js → useRootScrollLock-mqVhK2HB.js} +2 -2
- package/dist/assets/{useWalkthroughReview-DGPyQ634.js → useWalkthroughReview-BspAr9Aa.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-KulAIuMz.js → vendor-codemirror-language-data-VzNDjH03.js} +2 -2
- package/dist/assets/{zh-CN-Brx5Btej.js → zh-CN-DwBC4Qtd.js} +3 -3
- package/dist/assets/{zh-TW-WokiutLA.js → zh-TW-DXEqDBAm.js} +3 -3
- package/dist/index.html +2 -2
- package/dist/mini-chat.html +2 -2
- package/dist/mobile.html +2 -2
- package/package.json +2 -2
- package/server/lib/git/service.test.js +1 -1
- package/server/lib/opencode/openchamber-routes.test.js +1 -0
- package/server/lib/opencode/settings-helpers.js +2 -2
- package/server/lib/opencode/settings-helpers.test.js +1 -1
- package/server/lib/opencode/settings-registry.json +1 -1
- package/server/lib/outbound-proxy.test.js +2 -2
- package/server/lib/spaces/tools.test.js +2 -2
- package/dist/assets/katex.min-u4DtE8E5.js +0 -69
- package/dist/assets/markdownCore-D_5e0Wl7.js +0 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as H,R as E,j as t}from"./vendor-react-BUCujlKS.js";import{u as L,aq as T,ar as V,as as M,at as W,au as z,av as F,I as U,aw as $,ax as J,l as K,F as Q,D as X,ay as Y,q as Z,az as ee,t as te}from"./useAppFontEffects-
|
|
1
|
+
import{f as H,R as E,j as t}from"./vendor-react-BUCujlKS.js";import{u as L,aq as T,ar as V,as as M,at as W,au as z,av as F,I as U,aw as $,ax as J,l as K,F as Q,D as X,ay as Y,q as Z,az as ee,t as te}from"./useAppFontEffects-Dm6zEvrf.js";import{u as q}from"./katex.min-F4TD1ekM.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CPKyhvxM.js";import"./vendor-floating-ui-utils-D6FqdtJt.js";import"./vendor-floating-ui-dom-BTvzWks8.js";import"./vendor-floating-ui-core-PuGzNPnN.js";import"./vendor-floating-ui-react-dom-DxYCWdHj.js";import"./vendor-use-sync-external-store-D6wYuSt-.js";import"./vendor-zod-DDir2TeQ.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-BAGL70zf.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-dnd-kit-core-BZknOX2w.js";import"./vendor-dnd-kit-utilities-B_MdXhJC.js";import"./vendor-dnd-kit-accessibility-BHxJPORy.js";import"./vendor-dnd-kit-sortable-CsEagZ81.js";import"./vendor-tanstack-react-virtual-Bmi0tTrf.js";import"./vendor-tanstack-virtual-core-CdGDGrnp.js";import"./vendor-framer-motion-DxDVhOLc.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-codemirror-commands-dar6chwA.js";import"./vendor-codemirror-state-Dek9sMtw.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-B66jUSmE.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-DyL0aCoH.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-Cem6LjJ8.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-CIqXJolH.js";import"./vendor-codemirror-lang-json-C9rLLO0q.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-9qjxcVkg.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-D7VQUxeE.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-Cikh4w2I.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-VzNDjH03.js";import"./vendor-codemirror-lang-python-DVl8-2Op.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-sonner-DFyL3AvE.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-cmdk-DgLInKvT.js";import"./vendor-radix-ui-react-dialog-B94Bt2qq.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-DcAh5WdT.js";import"./vendor-radix-ui-react-context-Czxm7Z62.js";import"./vendor-radix-ui-react-id-f5BLKEVw.js";import"./vendor-radix-ui-react-use-layout-effect-D_3IhJdJ.js";import"./vendor-radix-ui-react-use-controllable-state-BFT5YmkA.js";import"./vendor-radix-ui-react-dismissable-layer-D7kXcwgJ.js";import"./vendor-radix-ui-react-primitive-DhVoX9SD.js";import"./vendor-radix-ui-react-slot-BQgQOasS.js";import"./vendor-radix-ui-react-use-callback-ref-BZPnuXAC.js";import"./vendor-radix-ui-react-use-escape-keydown-oph88g-F.js";import"./vendor-radix-ui-react-focus-scope-CiaxW4dD.js";import"./vendor-radix-ui-react-portal-BMJYHWck.js";import"./vendor-radix-ui-react-presence-CNxf-uq4.js";import"./vendor-radix-ui-react-focus-guards-B6qJXYua.js";import"./vendor-react-remove-scroll-DO7dCTnK.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-BcFYyj3E.js";import"./vendor-react-style-singleton-q6EMHnwf.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-zDC0RhA3.js";import"./vendor-use-callback-ref-D3RC8gqK.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-D2O6oUGf.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-opencode-client-h8RufjAw.js";const oe="__configure_project_actions__",Rt=()=>{const e=H.c(55),{t:o}=L(),a=q(ie),r=q(se),i=T();V(a);const[D,R]=E.useState(""),[B,G]=E.useState(!1);a!==B&&(G(a),a&&R(i?.shown?.id??""));let v;e[0]!==i||e[1]!==r?(v=s=>{i&&(r(!1),i.select(s),i.toggle(s))},e[0]=i,e[1]=r,e[2]=v):v=e[2];const O=v;let y;e[3]!==i||e[4]!==r?(y=()=>{r(!1),i?.openSettings()},e[3]=i,e[4]=r,e[5]=y):y=e[5];const P=y;let m;e[6]!==o?(m=o("projectActions.dialog.title"),e[6]=o,e[7]=m):m=e[7];let n;e[8]!==m?(n=t.jsx(K,{children:m}),e[8]=m,e[9]=n):n=e[9];let p;e[10]!==o?(p=o("projectActions.dialog.description"),e[10]=o,e[11]=p):p=e[11];let l;e[12]!==p?(l=t.jsx(Q,{children:p}),e[12]=p,e[13]=l):l=e[13];let c;e[14]!==n||e[15]!==l?(c=t.jsxs(X,{className:"sr-only",children:[n,l]}),e[14]=n,e[15]=l,e[16]=c):c=e[16];let d;e[17]!==o?(d=o("projectActions.dialog.placeholder"),e[17]=o,e[18]=d):d=e[18];let f;e[19]!==d?(f=t.jsx(Y,{placeholder:d}),e[19]=d,e[20]=f):f=e[20];let u;e[21]!==O||e[22]!==P||e[23]!==i||e[24]!==o?(u=t.jsx(M,{children:i?.available?t.jsxs(t.Fragment,{children:[t.jsx(W,{children:o("projectActions.dialog.empty")}),t.jsx(z,{children:i.actions.map(s=>{const S=i.runOf(s);return t.jsxs(F,{value:s.id,keywords:[s.name],disabled:S?.status==="stopping",onSelect:()=>O(s),"aria-label":S?o("projectActions.actions.stopNamedAria",{name:s.name}):o("projectActions.actions.runNamedAria",{name:s.name}),children:[t.jsx(U,{name:$(s),className:"size-4"}),t.jsx("span",{className:"min-w-0 truncate",children:s.name}),s.source==="shared"?t.jsx("span",{className:"shrink-0 typography-micro px-1 rounded leading-none pb-px text-muted-foreground bg-[var(--surface-subtle)]",children:o("projectActions.menu.sharedBadge")}):null,t.jsx(J,{run:S,showIdle:!0,className:"ms-auto"})]},s.id)})}),t.jsx(z,{children:t.jsxs(F,{value:oe,keywords:[o("projectActions.dialog.configure")],onSelect:P,children:[t.jsx(U,{name:"settings-3",className:"size-4"}),t.jsx("span",{className:"truncate",children:o("projectActions.dialog.configure")})]})})]}):t.jsx("div",{className:"px-4 py-6 text-center typography-meta text-muted-foreground",children:o("projectActions.dialog.noProject")})}),e[21]=O,e[22]=P,e[23]=i,e[24]=o,e[25]=u):u=e[25];let C;e[26]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx("kbd",{className:"font-sans",children:"↑↓"}),e[26]=C):C=e[26];let j;e[27]!==o?(j=o("commandPalette.footer.navigate"),e[27]=o,e[28]=j):j=e[28];let h;e[29]!==j?(h=t.jsxs("span",{children:[C," ",j]}),e[29]=j,e[30]=h):h=e[30];let w;e[31]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("kbd",{className:"font-sans",children:"↵"}),e[31]=w):w=e[31];let g;e[32]!==o?(g=o("projectActions.dialog.footer.toggle"),e[32]=o,e[33]=g):g=e[33];let x;e[34]!==g?(x=t.jsxs("span",{children:[w," ",g]}),e[34]=g,e[35]=x):x=e[35];let I;e[36]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("kbd",{className:"font-sans",children:"esc"}),e[36]=I):I=e[36];let A;e[37]!==o?(A=o("commandPalette.footer.close"),e[37]=o,e[38]=A):A=e[38];let _;e[39]!==A?(_=t.jsxs("span",{children:[I," ",A]}),e[39]=A,e[40]=_):_=e[40];let N;e[41]!==h||e[42]!==x||e[43]!==_?(N=t.jsxs("div",{className:"flex items-center gap-4 border-t border-border px-3 py-1.5 typography-micro text-muted-foreground","aria-hidden":"true",children:[h,x,_]}),e[41]=h,e[42]=x,e[43]=_,e[44]=N):N=e[44];let b;e[45]!==D||e[46]!==N||e[47]!==f||e[48]!==u?(b=t.jsx(Z,{className:"gap-0 overflow-hidden p-0 max-w-[min(480px,calc(100vw-2rem))]",layerClassName:"items-start pt-[12vh]",showCloseButton:!1,children:t.jsxs(ee,{value:D,onValueChange:R,className:"[&_[cmdk-group]]:px-2 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-1.5 [&_[cmdk-item]]:typography-meta",children:[f,u,N]})}),e[45]=D,e[46]=N,e[47]=f,e[48]=u,e[49]=b):b=e[49];let k;return e[50]!==a||e[51]!==r||e[52]!==b||e[53]!==c?(k=t.jsxs(te,{open:a,onOpenChange:r,children:[c,b]}),e[50]=a,e[51]=r,e[52]=b,e[53]=c,e[54]=k):k=e[54],k};function ie(e){return e.isProjectActionsDialogOpen}function se(e){return e.setProjectActionsDialogOpen}export{Rt as ProjectActionsDialog};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{eW as Te,ez as We,eh as Ve,u as le,eX as we,N as pe,be as Ne,au as ge,av as xe,I as Z,L as Ae,B as re,ay as Se,at as be,as as Pe,az as ke,k as Re,aS as Le,aT as $e,aR as Ee,c6 as ze,aD as ye,ah as ae,eY as He,eZ as Ge,b7 as Me,e_ as Je,e$ as ve,eA as Qe,f0 as Ue,d9 as Xe,b9 as Ye,ba as Ze,bb as et,bh as tt,bc as fe,f1 as st,f2 as nt}from"./useAppFontEffects-Dm6zEvrf.js";import{p as rt}from"./parseDiffFromFile-BSmRvd3V.js";import{e as qe}from"./computeVirtualFileMetrics-DDyA16hp.js";import{f as Ce,r as O,j as o}from"./vendor-react-BUCujlKS.js";import{u as ot,aZ as it,a5 as ee}from"./katex.min-F4TD1ekM.js";import{O as De,P as at,K as me}from"./runtimeEndpointReset-lg1O2gVX.js";import{c as lt,p as ct}from"./vendor-zustand-BAGL70zf.js";function ut(t,e=10){const n=[];let r;for(const c of t.split(`
|
|
2
2
|
`)){const p=c.match(Te);if(p!=null){r!=null&&(r.hunkLines.length>0&&(de(r,e,"trailing"),je(r,n)),r=void 0);const i=parseInt(p[3]),y=parseInt(p[1]),m=parseInt(p[4]??"1"),a=parseInt(p[2]??"1");isNaN(i)||isNaN(y)||isNaN(m)||isNaN(a)?n.push(c):r={additionStart:i,deletionStart:y,additionCount:0,deletionCount:0,hunkLines:[],contextLines:[]};continue}if(r==null){n.push(c);continue}if(c.startsWith(" "))r.contextLines.push(c);else if(c!==""){if(r.hunkLines.length>0&&r.contextLines.length>e*2){const i=r.contextLines.length-e*2,y=r.contextLines.slice(-e);de(r,e,"trailing");const{additionCount:m,deletionCount:a}=r;je(r,n),r={additionStart:r.additionStart+m+i,deletionStart:r.deletionStart+a+i,deletionCount:0,additionCount:0,contextLines:y,hunkLines:[]}}de(r,e,r.hunkLines.length===0?"leading":"before-change"),r.hunkLines.push(c),c.startsWith("+")?r.additionCount+=1:c.startsWith("-")&&(r.deletionCount+=1)}}r!=null&&r.hunkLines.length>0&&(de(r,e,"trailing"),je(r,n));const s=n.join(`
|
|
3
3
|
`);return t.endsWith(`
|
|
4
4
|
`)?`${s}
|
|
5
|
-
`:s}function de(t,e,n){if(n==="leading"&&t.contextLines.length>e){const r=t.contextLines.length-e;t.contextLines.splice(0,r),t.additionStart+=r,t.deletionStart+=r}return n==="trailing"&&t.contextLines.length>e&&(t.contextLines.length=e),t.contextLines.length>0&&(qe(t.hunkLines,t.contextLines),t.additionCount+=t.contextLines.length,t.deletionCount+=t.contextLines.length,t.contextLines.length=0),t}function je(t,e){e.push(`@@ -${Be(t.deletionStart,t.deletionCount)} +${Be(t.additionStart,t.additionCount)} @@`),qe(e,t.hunkLines)}function Be(t,e){return e===1?`${t}`:`${t},${e}`}const mt=64,dt=3,ne=new Map,
|
|
5
|
+
`:s}function de(t,e,n){if(n==="leading"&&t.contextLines.length>e){const r=t.contextLines.length-e;t.contextLines.splice(0,r),t.additionStart+=r,t.deletionStart+=r}return n==="trailing"&&t.contextLines.length>e&&(t.contextLines.length=e),t.contextLines.length>0&&(qe(t.hunkLines,t.contextLines),t.additionCount+=t.contextLines.length,t.deletionCount+=t.contextLines.length,t.contextLines.length=0),t}function je(t,e){e.push(`@@ -${Be(t.deletionStart,t.deletionCount)} +${Be(t.additionStart,t.additionCount)} @@`),qe(e,t.hunkLines)}function Be(t,e){return e===1?`${t}`:`${t},${e}`}const mt=64,dt=3,ne=new Map,Wt=t=>/^Binary files .+ differ$/m.test(t)||/^GIT binary patch$/m.test(t),Ie=t=>{const e=t.search(/^@@\s/m);if(e<0)return null;const n=t.slice(0,e);return/^index (?:[a-f0-9]{40}|[a-f0-9]{64})\.\.(?:[a-f0-9]{40}|[a-f0-9]{64})(?: [0-7]+)?$/m.test(n)?n:null},Vt=(t,e)=>{const n=Ie(t);return n!==null&&n===Ie(e)},zt=(t,e,n=dt)=>{const r=`${t}\0${n}\0${e}`,s=ne.get(r);if(s)return ne.delete(r),ne.set(r,s),s;const c=ht(e),p=c?We(ut(e,n),{oldFile:{name:t,contents:c.before},newFile:{name:t,contents:c.after}})??Fe(t):Ve(ft(t,e))[0]?.files[0]??Fe(t);for(ne.set(r,p);ne.size>mt;){const i=ne.keys().next().value;if(!i)break;ne.delete(i)}return p},ft=(t,e)=>!e.trim()||e.startsWith("diff --git ")||/^--- [^\n]*\r?\n\+\+\+ /m.test(e)?e:`Index: ${t}
|
|
6
6
|
===================================================================
|
|
7
7
|
--- ${t}
|
|
8
8
|
+++ ${t}
|
|
@@ -10,4 +10,4 @@ ${e}`,ht=t=>{if(!t.startsWith("diff --git ")&&!/^--- [^\n]*\t?\r?\n\+\+\+ [^\n]*
|
|
|
10
10
|
`:"")).join(""),Fe=t=>rt({name:t,contents:""},{name:t,contents:""}),Ke=t=>{if(!t)return[];const e=[...t.matchAll(/^@@\s/gm)].map(r=>r.index);if(e.length===0)return[];const n=t.slice(0,e[0]);return e.map((r,s)=>{const c=n+t.slice(r,e[s+1]??t.length);return c.endsWith(`
|
|
11
11
|
`)?c:`${c}
|
|
12
12
|
`})},Gt=(t,e)=>!Number.isInteger(e)||e<0?null:Ke(t)[e]??null,Jt=t=>{const e=[];for(const[n,r]of Ke(t).entries()){const s=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@[^\n]*(?:\n|$)/m.exec(r);if(!s)continue;let c=Number(s[1]),p=Number(s[3]),i;for(const y of r.slice(s.index+s[0].length).split(`
|
|
13
|
-
`))y.startsWith("-")?i={index:n,side:"deletions",lineNumber:c++}:y.startsWith("+")?i={index:n,side:"additions",lineNumber:p++}:y.startsWith(" ")&&(c+=1,p+=1);i&&Number.isSafeInteger(i.lineNumber)&&i.lineNumber>0&&e.push(i)}return e};function Qt(t){const e=Ce.c(82),{branches:n,currentBranch:r,base:s,onSelect:c,automatic:p,onSelectAutomatic:i,mobile:y}=t,m=p===void 0?!1:p,a=y===void 0?!1:y,{t:u}=le(),N=we(),j=a&&!N.enabled,[d,K]=O.useState(!1),[g,P]=O.useState("");let B;e[0]!==s||e[1]!==u?(B=s?De(s):u("gitView.pr.field.baseBranch"),e[0]=s,e[1]=u,e[2]=B):B=e[2];const x=B;let C;e[3]===Symbol.for("react.memo_cache_sentinel")?(C=z=>{K(z),z||P("")},e[3]=C):C=e[3];const A=C;let H;e[4]!==a?(H=pe(Ne({size:a?"mobile":"default"}),"min-w-0 max-w-48"),e[4]=a,e[5]=H):H=e[5];const w=a||void 0;let q;e[6]!==u?(q=u("gitView.pr.field.baseBranch"),e[6]=u,e[7]=q):q=e[7];const D=j?"dialog":void 0,k=j?d:void 0,T=!r;let L;e[8]!==j?(L=j?()=>A(!0):void 0,e[8]=j,e[9]=L):L=e[9];let F;e[10]===Symbol.for("react.memo_cache_sentinel")?(F=o.jsx(Z,{name:"git-branch",className:"size-3.5"}),e[10]=F):F=e[10];let $;e[11]!==x?($=o.jsx("span",{className:"truncate",children:x}),e[11]=x,e[12]=$):$=e[12];let V;e[13]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(Z,{name:"arrow-down-s",className:"size-3.5"}),e[13]=V):V=e[13];let b;e[14]!==x||e[15]!==T||e[16]!==L||e[17]!==$||e[18]!==H||e[19]!==w||e[20]!==q||e[21]!==D||e[22]!==k?(b=o.jsxs(re,{variant:"outline",className:H,"data-mobile-comparison-trigger":w,"aria-label":q,"aria-haspopup":D,"aria-expanded":k,title:x,disabled:T,onClick:L,children:[F,$,V]}),e[14]=x,e[15]=T,e[16]=L,e[17]=$,e[18]=H,e[19]=w,e[20]=q,e[21]=D,e[22]=k,e[23]=b):b=e[23];const W=b,Q=a?"[&_[data-slot=command-input-wrapper]]:h-11":void 0,S=!j,I=a?"h-11":void 0;let R;e[24]!==u?(R=u("gitView.branch.searchPlaceholder"),e[24]=u,e[25]=R):R=e[25];let E;e[26]!==u?(E=u("gitView.branch.searchPlaceholder"),e[26]=u,e[27]=E):E=e[27];let _;e[28]!==g||e[29]!==S||e[30]!==I||e[31]!==R||e[32]!==E?(_=o.jsx(Se,{autoFocus:S,className:I,value:g,onValueChange:P,placeholder:R,"aria-label":E}),e[28]=g,e[29]=S,e[30]=I,e[31]=R,e[32]=E,e[33]=_):_=e[33];const J=a?"max-h-[min(45dvh,24rem)]":void 0;let v;e[34]!==u?(v=u("gitView.branch.empty"),e[34]=u,e[35]=v):v=e[35];let l;e[36]!==v?(l=o.jsx(be,{children:v}),e[36]=v,e[37]=l):l=e[37];let M;e[38]!==m||e[39]!==a||e[40]!==i||e[41]!==g||e[42]!==u?(M=i&&!g.trim()&&o.jsx(ge,{children:o.jsxs(xe,{value:"automatic",className:a?"min-h-11":void 0,onSelect:()=>{i(),A(!1)},children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:u("gitView.branch.comparisonBaseAutomatic")}),m&&o.jsx(Z,{name:"check",className:"size-3.5"})]})}),e[38]=m,e[39]=a,e[40]=i,e[41]=g,e[42]=u,e[43]=M):M=e[43];let f;e[44]!==m||e[45]!==s||e[46]!==n||e[47]!==r||e[48]!==a||e[49]!==c||e[50]!==d||e[51]!==g?(f=d&&He([...new Set(n)].filter(z=>z!==r).sort().map(gt),g,pt).map(z=>o.jsxs(xe,{value:z.ref,className:a?"min-h-11":void 0,onSelect:()=>{c(z.ref),A(!1)},children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",title:z.ref,children:z.label}),!m&&(z.ref===s||z.label===s)&&o.jsx(Z,{name:"check",className:"size-3.5"})]},z.ref)),e[44]=m,e[45]=s,e[46]=n,e[47]=r,e[48]=a,e[49]=c,e[50]=d,e[51]=g,e[52]=f):f=e[52];let h;e[53]!==f?(h=o.jsx(ge,{children:f}),e[53]=f,e[54]=h):h=e[54];let G;e[55]!==J||e[56]!==l||e[57]!==M||e[58]!==h?(G=o.jsxs(Pe,{className:J,children:[l,M,h]}),e[55]=J,e[56]=l,e[57]=M,e[58]=h,e[59]=G):G=e[59];let X;e[60]!==Q||e[61]!==_||e[62]!==G?(X=o.jsxs(ke,{shouldFilter:!1,className:Q,onKeyDown:xt,children:[_,G]}),e[60]=Q,e[61]=_,e[62]=G,e[63]=X):X=e[63];const U=X;if(j){let z;e[64]!==u?(z=u("gitView.pr.field.baseBranch"),e[64]=u,e[65]=z):z=e[65];let ce;e[66]===Symbol.for("react.memo_cache_sentinel")?(ce=()=>A(!1),e[66]=ce):ce=e[66];let ie;e[67]!==d||e[68]!==U||e[69]!==z?(ie=o.jsx(Re,{open:d,title:z,onClose:ce,children:U}),e[67]=d,e[68]=U,e[69]=z,e[70]=ie):ie=e[70];let ue;return e[71]!==ie||e[72]!==W?(ue=o.jsxs(o.Fragment,{children:[W,ie]}),e[71]=ie,e[72]=W,e[73]=ue):ue=e[73],ue}let Y;e[74]!==W?(Y=o.jsx(Le,{asChild:!0,children:W}),e[74]=W,e[75]=Y):Y=e[75];let te;e[76]!==U?(te=o.jsx($e,{align:"start",className:"w-72 max-w-[calc(100vw-2rem)] p-0",children:U}),e[76]=U,e[77]=te):te=e[77];let oe;return e[78]!==d||e[79]!==Y||e[80]!==te?(oe=o.jsxs(Ee,{open:d,onOpenChange:A,children:[Y,te]}),e[78]=d,e[79]=Y,e[80]=te,e[81]=oe):oe=e[81],oe}function pt(t){return[t.label]}function gt(t){return{ref:t.startsWith("remotes/")?`refs/${t}`:`refs/heads/${t}`,label:De(t)}}function xt(t){t.key!=="Escape"&&t.stopPropagation()}function Ut(t){const e=Ce.c(77),{commits:n,selectedHash:r,loading:s,error:c,onSelect:p,onRefresh:i,mobile:y}=t,m=y===void 0?!1:y,{t:a}=le(),u=we(),N=m&&!u.enabled,j=ot(vt),[d,K]=O.useState(!1),[g,P]=O.useState("");let B;e[0]!==s||e[1]!==i?(B=h=>{K(h),h?s||i():P("")},e[0]=s,e[1]=i,e[2]=B):B=e[2];const x=B;let C;e[3]!==m?(C=pe(Ne({size:m?"mobile":"default"}),"min-w-0 max-w-48"),e[3]=m,e[4]=C):C=e[4];const A=m||void 0;let H;e[5]!==x||e[6]!==N?(H=N?()=>x(!0):void 0,e[5]=x,e[6]=N,e[7]=H):H=e[7];const w=N?"dialog":void 0,q=N?d:void 0;let D;e[8]!==a?(D=a("commitComparison.select"),e[8]=a,e[9]=D):D=e[9];let k;e[10]!==r||e[11]!==a?(k=r??a("commitComparison.select"),e[10]=r,e[11]=a,e[12]=k):k=e[12];let T;e[13]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(Z,{name:"git-commit",className:"size-3.5"}),e[13]=T):T=e[13];let L;e[14]!==r||e[15]!==a?(L=r?.slice(0,8)??a("commitComparison.select"),e[14]=r,e[15]=a,e[16]=L):L=e[16];let F;e[17]!==L?(F=o.jsx("span",{className:"truncate",children:L}),e[17]=L,e[18]=F):F=e[18];let $;e[19]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(Z,{name:"arrow-down-s",className:"size-3.5"}),e[19]=$):$=e[19];let V;e[20]!==F||e[21]!==C||e[22]!==A||e[23]!==H||e[24]!==w||e[25]!==q||e[26]!==D||e[27]!==k?(V=o.jsxs(re,{variant:"ghost",className:C,"data-mobile-comparison-trigger":A,onClick:H,"aria-haspopup":w,"aria-expanded":q,"aria-label":D,title:k,children:[T,F,$]}),e[20]=F,e[21]=C,e[22]=A,e[23]=H,e[24]=w,e[25]=q,e[26]=D,e[27]=k,e[28]=V):V=e[28];const b=V,W=m?"[&_[data-slot=command-input-wrapper]]:h-11":void 0,Q=!N,S=m?"h-11":void 0;let I;e[29]!==a?(I=a("commitComparison.search"),e[29]=a,e[30]=I):I=e[30];let R;e[31]!==a?(R=a("commitComparison.search"),e[31]=a,e[32]=R):R=e[32];let E;e[33]!==g||e[34]!==Q||e[35]!==S||e[36]!==I||e[37]!==R?(E=o.jsx(Se,{autoFocus:Q,className:S,value:g,onValueChange:P,placeholder:I,"aria-label":R}),e[33]=g,e[34]=Q,e[35]=S,e[36]=I,e[37]=R,e[38]=E):E=e[38];let _;e[39]!==x||e[40]!==n||e[41]!==c||e[42]!==s||e[43]!==m||e[44]!==i||e[45]!==p||e[46]!==d||e[47]!==g||e[48]!==r||e[49]!==a||e[50]!==j?(_=s?o.jsxs("div",{className:"flex items-center justify-center gap-2 p-4 typography-meta text-muted-foreground",children:[o.jsx(Z,{name:"loader-4",className:"size-4 animate-spin"}),a("diffView.state.loadingChanges")]}):c?o.jsxs("div",{className:"flex flex-col items-center gap-2 p-4 typography-meta text-muted-foreground",children:[o.jsx("span",{children:a("commitComparison.loadError")}),o.jsx("span",{className:"max-w-full break-words",children:c}),o.jsx(re,{variant:"outline",size:m?"lg":"sm",onClick:i,children:a("diffView.actions.retry")})]}):o.jsxs(Pe,{className:m?"max-h-[min(45dvh,24rem)]":void 0,children:[o.jsx(be,{children:a("commitComparison.noCommits")}),o.jsx(ge,{children:d&&He(n,g,yt).map(h=>o.jsxs(xe,{value:h.hash,className:m?"min-h-11":void 0,onSelect:()=>{p(h),x(!1)},children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"truncate typography-ui-label font-semibold",title:h.message,children:h.message}),o.jsxs("div",{className:"flex min-w-0 gap-1 typography-meta text-muted-foreground",children:[o.jsxs("span",{className:"min-w-0 truncate",children:[h.author_name," · ",Number.isNaN(new Date(h.date).getTime())?h.date:ze(new Date(h.date),j,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]}),o.jsxs("span",{className:"shrink-0",children:["· ",h.hash.slice(0,8)]})]})]}),h.hash===r&&o.jsx(Z,{name:"check",className:"size-3.5"})]},h.hash))})]}),e[39]=x,e[40]=n,e[41]=c,e[42]=s,e[43]=m,e[44]=i,e[45]=p,e[46]=d,e[47]=g,e[48]=r,e[49]=a,e[50]=j,e[51]=_):_=e[51];let J;e[52]!==W||e[53]!==E||e[54]!==_?(J=o.jsxs(ke,{shouldFilter:!1,className:W,onKeyDown:Ct,children:[E,_]}),e[52]=W,e[53]=E,e[54]=_,e[55]=J):J=e[55];const v=J;if(N){let h;e[56]!==a?(h=a("commitComparison.select"),e[56]=a,e[57]=h):h=e[57];let G;e[58]!==x?(G=()=>x(!1),e[58]=x,e[59]=G):G=e[59];let X;e[60]!==d||e[61]!==v||e[62]!==h||e[63]!==G?(X=o.jsx(Re,{open:d,title:h,onClose:G,children:v}),e[60]=d,e[61]=v,e[62]=h,e[63]=G,e[64]=X):X=e[64];let U;return e[65]!==X||e[66]!==b?(U=o.jsxs(o.Fragment,{children:[b,X]}),e[65]=X,e[66]=b,e[67]=U):U=e[67],U}let l;e[68]!==b?(l=o.jsx(Le,{asChild:!0,children:b}),e[68]=b,e[69]=l):l=e[69];let M;e[70]!==v?(M=o.jsx($e,{align:"start",className:"w-[32rem] max-w-[calc(100vw-2rem)] p-0",children:v}),e[70]=v,e[71]=M):M=e[71];let f;return e[72]!==x||e[73]!==d||e[74]!==l||e[75]!==M?(f=o.jsxs(Ee,{open:d,onOpenChange:x,children:[l,M]}),e[72]=x,e[73]=d,e[74]=l,e[75]=M,e[76]=f):f=e[76],f}function yt(t){return[t.message,t.author_name,t.hash]}function Ct(t){t.key!=="Escape"&&t.stopPropagation()}function vt(t){return t.timeFormatPreference}const jt="openchamber.git-base-branch",wt=100,he=(t,e)=>JSON.stringify([ee(),t,e]),Nt=lt()(ct((t,e)=>({overrides:{},getOverride:(n,r)=>!n||!r?null:e().overrides[he(n,r)]??null,setOverride:(n,r,s)=>{!n||!r||!s||t(c=>{const p=he(n,r),i=Object.entries({...c.overrides,[p]:s});for(;i.length>wt;)i.shift();return{overrides:Object.fromEntries(i)}})},clearOverride:(n,r)=>{!n||!r||t(s=>{const c=he(n,r);if(!(c in s.overrides))return s;const p={...s.overrides};return delete p[c],{overrides:p}})}}),{name:jt,storage:it(),partialize:t=>({overrides:t.overrides})}));function Xt(t,e,n,r){const s=Ce.c(44),{branches:c,remoteNames:p,primaryRemote:i,readContext:y}=r,m=ye(kt);let a;s[0]!==t||s[1]!==n?(a=S=>n&&t?S.directories.get(t)?.lastStatusFetch??0:0,s[0]=t,s[1]=n,s[2]=a):a=s[2];const u=ye(a);let N;s[3]!==e||s[4]!==t||s[5]!==m?(N=JSON.stringify([m,t,e]),s[3]=e,s[4]=t,s[5]=m,s[6]=N):N=s[6];const j=N;let d;s[7]!==e||s[8]!==t?(d=t&&e?he(t,e):null,s[7]=e,s[8]=t,s[9]=d):d=s[9];const K=d;let g;s[10]!==K?(g=S=>K?S.overrides[K]??null:null,s[10]=K,s[11]=g):g=s[11];const P=Nt(g);let B;s[12]!==e||s[13]!==y?(B=S=>y&&e?Me(S.entries,y,e):null,s[12]=e,s[13]=y,s[14]=B):B=s[14];const x=ae(B),C=x?.changeRequest??x?.pr??null,A=C?.state==="open"?C.base:null,[H,w]=O.useState(null);let q;s[15]!==e||s[16]!==t||s[17]!==n||s[18]!==j?(q=()=>{if(!n||!t||!e)return;let S=!1;const I=ee();return Ge(t,e).then(R=>{const{base:E}=R;S||ee()!==I||w(_=>_?.key===j&&_.base===E?_:{key:j,base:E})}).catch(()=>{S||ee()!==I||w(R=>R?.key===j?R:{key:j,base:null})}),()=>{S=!0}},s[15]=e,s[16]=t,s[17]=n,s[18]=j,s[19]=q):q=s[19];let D;s[20]!==e||s[21]!==t||s[22]!==n||s[23]!==j||s[24]!==u?(D=[e,t,n,j,u],s[20]=e,s[21]=t,s[22]=n,s[23]=j,s[24]=u,s[25]=D):D=s[25],O.useEffect(q,D);const k=H?.key===j,T=k?H.base:null;let L;e:{if(!e||!c){L=null;break e}let S;if(s[26]!==e||s[27]!==c.all||s[28]!==c.defaultBranches||s[29]!==T||s[30]!==k||s[31]!==P||s[32]!==i||s[33]!==A||s[34]!==p){const I=c.all??[];S=at({chosen:P,pullRequest:A,createdFrom:T,defaultBranch:k&&i?c.defaultBranches?.[i]??null:null},{localBranches:I.filter(Pt),remoteBranches:I.filter(bt).map(St),remoteNames:p,primaryRemote:i,headBranch:e}),s[26]=e,s[27]=c.all,s[28]=c.defaultBranches,s[29]=T,s[30]=k,s[31]=P,s[32]=i,s[33]=A,s[34]=p,s[35]=S}else S=s[35];L=S}const F=L,$=F?.source??null,V=F?.ref??null,b=!!F||k&&c!==null;let W;s[36]!==m||s[37]!==u?(W=JSON.stringify([m,u]),s[36]=m,s[37]=u,s[38]=W):W=s[38];let Q;return s[39]!==$||s[40]!==W||s[41]!==V||s[42]!==b?(Q={base:V,source:$,resolved:b,revision:W},s[39]=$,s[40]=W,s[41]=V,s[42]=b,s[43]=Q):Q=s[43],Q}function St(t){return t.slice(8)}function bt(t){return t.startsWith("remotes/")}function Pt(t){return!t.startsWith("remotes/")}function kt(t){return t.runtimeKey}const Rt=[];function Yt(t,e,n,r){const{git:s}=Ae(),{t:c}=le(),p=ye(g=>g.runtimeKey),i=Je(t??"",e,p),y=ve(g=>g.selections.get(i)??null),m=ve(g=>g.select),[a,u]=O.useState(null),N=O.useRef(0),j=O.useRef(r);j.current=r;const d=O.useCallback(async()=>{if(!t||!n)return;const g=++N.current,P=ee();u({key:i,status:"loading"});try{const B=await s.getGitLog(t,{maxCount:50,to:e?`refs/heads/${e}`:"HEAD"});if(N.current!==g||ee()!==P)return;const x=B.all.slice(0,50);if(u({key:i,status:"ready",commits:x}),!ve.getState().selections.has(i)){const C=j.current?x.find(A=>A.hash===j.current):x[0];C&&m(i,C)}}catch(B){if(N.current!==g||ee()!==P)return;u({key:i,status:"error",message:B instanceof Error?B.message:c("commitComparison.loadError")})}},[e,t,n,s,i,m,c]);O.useEffect(()=>(d(),()=>{N.current+=1}),[d]);const K=a?.key===i?a:null;return{selectedCommit:y,commits:K?.status==="ready"?K.commits:Rt,loading:n&&(!K||K.status==="loading"),error:K?.status==="error"?K.message:null,refresh:d,select:g=>m(i,g)}}const Oe=[],Lt=[],$t=6e4,Et=30,se=new Map,Bt=t=>{for(se.delete(t.key),se.set(t.key,{list:t,readAt:Date.now()});se.size>Et;)se.delete(se.keys().next().value??"")},It=t=>({kind:"pr",number:t.number,sourceRepo:{owner:t.project.owner,repo:t.project.name}}),_t=t=>`${t.project.owner}/${t.project.name}#${t.number}`,Ft=(t,e,n)=>{const r=st(t,e);return{prs:[...new Map([...n?t:[],...r].map(c=>[_t(c),c])).values()],incompleteProjectIds:e.incompleteProjectIds??[]}};function Zt(t,e,n,r,s){const{sourceControl:c}=Ae(),{t:p}=le(),i=ye(l=>l.runtimeKey),y=n?.provider==="github"||n?.provider==="gitlab"?n:null,m=y?JSON.stringify(Qe(y)):"",a=O.useRef(y);a.current=y;const u=y,N=Ue(t)?.provider,j=u?.provider??N??null,d=JSON.stringify([i,t,e,u?.repositoryId??null]),K=me(l=>l.selections.get(d)??null),g=K?.source??null,P=me(l=>l.select),B=me(l=>l.acceptHandoff),x=s&&K?.handoff!==s?s:null,[C,A]=O.useState(""),H=Xe(C,350).trim(),w=JSON.stringify([d,H,m]),[q,D]=O.useState(()=>se.get(w)?.list??null),k=O.useRef(q);k.current=q;const[T,L]=O.useState(!1),F=O.useRef(0),$=O.useRef({key:w,enabled:r});$.current={key:w,enabled:r};const V=Ye(l=>u?l.entries[Ze(u)]:void 0),b=u?et(V,u):{authChecked:!1,connected:!1},W=ae(l=>l.ensureEntry),Q=ae(l=>l.setParams),S=ae(l=>l.refreshTargets),I=ae(l=>u&&e?Me(l.entries,u,e):null);O.useEffect(()=>{const l=a.current;if(!r||!l||!e||g||!b.authChecked||!b.connected)return;const M=tt(l,e);W(M),Q(M,{directory:l.directory,branch:e,remoteName:l.primaryRemote,canShow:!0,identity:l,readContext:l,sourceControl:c,authChecked:b.authChecked,connected:b.connected}),S([{context:l,branch:e}])},[b.authChecked,b.connected,e,m,r,W,S,g,Q,c]);const R=I?.changeRequest??I?.pr??null,E=I?.project??null;O.useEffect(()=>{!r||!b.connected||!R||!E||me.getState().selections.has(d)||P(d,{kind:"pr",number:R.number,sourceRepo:{owner:E.owner,repo:E.name}})},[b.connected,R,E,r,P,d]),O.useEffect(()=>{s&&B(d,s)},[B,s,d]);const _=O.useCallback(async l=>{if(!t||!r||$.current.key!==w||!$.current.enabled)return;const M=++F.current,f=ee(),h=k.current,G=h?.key===w&&h.status==="ready"?h:null,X=l?.prs??G?.prs??Oe;l?L(!0):(L(!1),G||D({key:w,status:"loading"}));try{const U=a.current;if(!c)throw new Error(p(fe("session.githubPrPicker.error.runtimeUnavailable",j)));if(!U||!b.connected)throw new Error(p(fe("session.githubPrPicker.empty.notConnected",j)));const Y=l?l.page+1:1,te=await c.changeRequestsList(U,{page:Y,query:H||void 0});if(F.current!==M||ee()!==f||$.current.key!==w||!$.current.enabled)return;const oe=Ft(X,te,!!l),z={key:w,status:"ready",...oe,page:Y,hasMore:te.hasMore,error:null};Bt(z),D(z)}catch(U){if(F.current===M&&ee()===f&&$.current.key===w&&$.current.enabled){const Y=U instanceof Error?U.message:p(fe("session.githubPrPicker.toast.loadMoreFailed",j));D(l?{...l,error:Y}:{key:w,status:"error",message:Y})}}finally{F.current===M&&L(!1)}},[b.connected,t,r,w,j,H,c,p]),J=O.useCallback(()=>{const l=se.get(w);return l&&k.current!==l.list&&D(l.list),l&&Date.now()-l.readAt<$t?Promise.resolve():_()},[w,_]);O.useEffect(()=>((k.current?.key!==w||k.current.status!=="ready"||se.has(w))&&J(),()=>{F.current+=1}),[w,J]);const v=q?.key===w?q:null;return{enabled:r,readContext:u,provider:j,selectedSource:x??g,prs:v?.status==="ready"?v.prs:Oe,query:C,setQuery:A,loading:r&&(!v||v.status==="loading"||H!==C.trim()),loadingMore:T,hasMore:v?.status==="ready"&&v.hasMore,incompleteProjectIds:v?.status==="ready"?v.incompleteProjectIds:Lt,error:v?.status==="error"?v.message:v?.status==="ready"?v.error:null,refresh:()=>_(),revalidate:J,loadMore:()=>v?.status==="ready"&&v.hasMore&&!T?_(v):Promise.resolve(),select:l=>P(d,It(l))}}function es(t){const e=Ce.c(77),{comparison:n,mobile:r}=t,s=r===void 0?!1:r,{t:c}=le();let p;e[0]!==n.provider||e[1]!==c?(p=f=>c(fe(f,n.provider)),e[0]=n.provider,e[1]=c,e[2]=p):p=e[2];const i=p;let y;e[3]!==n.provider?(y=f=>nt(n.provider,f),e[3]=n.provider,e[4]=y):y=e[4];const m=y,a=we(),u=s&&!a.enabled,[N,j]=O.useState(!1);let d,K;e[5]!==n.enabled?(d=()=>{n.enabled||j(!1)},K=[n.enabled],e[5]=n.enabled,e[6]=d,e[7]=K):(d=e[6],K=e[7]),O.useEffect(d,K);let g;e[8]!==i?(g=i("pullRequestComparison.select"),e[8]=i,e[9]=g):g=e[9];const P=g;let B;e[10]!==n?(B=f=>{j(f),f&&!n.loading&&n.revalidate(),f||n.setQuery("")},e[10]=n,e[11]=B):B=e[11];const x=B,C=n.selectedSource;let A;e[12]!==s?(A=pe(Ne({size:s?"mobile":"default"}),"min-w-0 max-w-48"),e[12]=s,e[13]=A):A=e[13];const H=s||void 0;let w;e[14]!==x||e[15]!==u?(w=u?()=>x(!0):void 0,e[14]=x,e[15]=u,e[16]=w):w=e[16];const q=u?"dialog":void 0,D=u?N:void 0;let k;e[17]!==P||e[18]!==m||e[19]!==C?(k=C?.sourceRepo?`${C.sourceRepo.owner}/${C.sourceRepo.repo} ${m(C.number)}`:P,e[17]=P,e[18]=m,e[19]=C,e[20]=k):k=e[20];let T;e[21]!==P||e[22]!==m||e[23]!==C?(T=C?m(C.number):P,e[21]=P,e[22]=m,e[23]=C,e[24]=T):T=e[24];let L;e[25]!==T?(L=o.jsx("span",{className:"truncate",children:T}),e[25]=T,e[26]=L):L=e[26];let F;e[27]===Symbol.for("react.memo_cache_sentinel")?(F=o.jsx(Z,{name:"arrow-down-s",className:"size-3.5"}),e[27]=F):F=e[27];let $;e[28]!==P||e[29]!==w||e[30]!==q||e[31]!==D||e[32]!==k||e[33]!==L||e[34]!==A||e[35]!==H?($=o.jsxs(re,{variant:"ghost",className:A,"data-mobile-comparison-trigger":H,onClick:w,"aria-haspopup":q,"aria-expanded":D,"aria-label":P,title:k,children:[L,F]}),e[28]=P,e[29]=w,e[30]=q,e[31]=D,e[32]=k,e[33]=L,e[34]=A,e[35]=H,e[36]=$):$=e[36];const V=$,b=!u,W=n.query,Q=n.setQuery;let S;e[37]!==i?(S=i("session.githubPrPicker.searchPlaceholder"),e[37]=i,e[38]=S):S=e[38];let I;e[39]!==i?(I=i("session.githubPrPicker.searchPlaceholder"),e[39]=i,e[40]=I):I=e[40];let R;e[41]!==n.query||e[42]!==n.setQuery||e[43]!==b||e[44]!==S||e[45]!==I?(R=o.jsx(Se,{autoFocus:b,value:W,onValueChange:Q,placeholder:S,"aria-label":I}),e[41]=n.query,e[42]=n.setQuery,e[43]=b,e[44]=S,e[45]=I,e[46]=R):R=e[46];let E;e[47]!==x||e[48]!==n||e[49]!==s||e[50]!==N||e[51]!==m||e[52]!==C||e[53]!==i?(E=n.loading?o.jsxs("div",{className:"flex items-center gap-2 p-4 typography-meta text-muted-foreground",children:[o.jsx(Z,{name:"loader-4",className:"size-4 animate-spin"}),i("session.githubPrPicker.loading.pullRequests")]}):n.error&&n.prs.length===0?o.jsxs("div",{className:"flex flex-col items-center gap-2 p-4 typography-meta text-muted-foreground",children:[o.jsx("span",{children:n.error}),o.jsx(re,{variant:"outline",size:"sm",onClick:()=>{n.refresh()},children:i("diffView.actions.retry")})]}):o.jsxs(Pe,{className:pe("min-h-0",s&&"max-h-[min(45dvh,24rem)]"),children:[o.jsx(be,{children:i("session.githubPrPicker.empty.noPullRequestsFound")}),o.jsx(ge,{children:N&&n.prs.map(f=>{const h=`${f.project.owner}/${f.project.name}#${f.number}`;return o.jsxs(xe,{value:h,className:s?"min-h-11":void 0,onSelect:()=>{n.select(f),x(!1)},children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"truncate typography-ui-label",title:f.title,children:[m(f.number)," ",f.title]}),o.jsxs("div",{className:"truncate typography-meta text-muted-foreground",children:[f.project.owner,"/",f.project.name," · ",f.head," → ",f.base]})]}),C?.number===f.number&&C.sourceRepo?.owner===f.project.owner&&C.sourceRepo?.repo===f.project.name&&o.jsx(Z,{name:"check",className:"size-3.5"})]},h)})}),n.error&&o.jsx("p",{className:"px-3 py-2 typography-meta text-muted-foreground",children:n.error}),!n.error&&n.incompleteProjectIds.length>0&&o.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 typography-meta text-muted-foreground",children:[o.jsx("span",{children:i("pullRequestComparison.partial")}),o.jsx(re,{variant:"outline",size:"sm",onClick:()=>{n.refresh()},children:i("diffView.actions.retry")})]}),n.hasMore&&o.jsx(re,{variant:"ghost",size:"sm",disabled:n.loadingMore,onClick:()=>{n.loadMore()},children:n.error?i("diffView.actions.retry"):i("session.githubPrPicker.actions.loadMore")})]}),e[47]=x,e[48]=n,e[49]=s,e[50]=N,e[51]=m,e[52]=C,e[53]=i,e[54]=E):E=e[54];let _;e[55]!==R||e[56]!==E?(_=o.jsxs(ke,{className:"min-h-0",shouldFilter:!1,onKeyDown:Ot,children:[R,E]}),e[55]=R,e[56]=E,e[57]=_):_=e[57];const J=_;if(u){let f;e[58]!==x?(f=()=>x(!1),e[58]=x,e[59]=f):f=e[59];let h;e[60]!==P||e[61]!==N||e[62]!==J||e[63]!==f?(h=o.jsx(Re,{open:N,title:P,onClose:f,children:J}),e[60]=P,e[61]=N,e[62]=J,e[63]=f,e[64]=h):h=e[64];let G;return e[65]!==h||e[66]!==V?(G=o.jsxs(o.Fragment,{children:[V,h]}),e[65]=h,e[66]=V,e[67]=G):G=e[67],G}let v;e[68]!==V?(v=o.jsx(Le,{asChild:!0,children:V}),e[68]=V,e[69]=v):v=e[69];let l;e[70]!==J?(l=o.jsx($e,{align:"start",className:"flex max-h-[min(var(--available-height),32rem)] w-[32rem] max-w-[calc(100vw-2rem)] flex-col overflow-hidden p-0",children:J}),e[70]=J,e[71]=l):l=e[71];let M;return e[72]!==x||e[73]!==N||e[74]!==v||e[75]!==l?(M=o.jsxs(Ee,{open:N,onOpenChange:x,children:[v,l]}),e[72]=x,e[73]=N,e[74]=v,e[75]=l,e[76]=M):M=e[76],M}function Ot(t){t.key!=="Escape"&&t.stopPropagation()}export{Qt as B,Ut as C,es as P,Yt as a,Xt as b,Zt as c,Gt as e,zt as f,Jt as g,Wt as h,Vt as i,Nt as u};
|
|
13
|
+
`))y.startsWith("-")?i={index:n,side:"deletions",lineNumber:c++}:y.startsWith("+")?i={index:n,side:"additions",lineNumber:p++}:y.startsWith(" ")&&(c+=1,p+=1);i&&Number.isSafeInteger(i.lineNumber)&&i.lineNumber>0&&e.push(i)}return e};function Qt(t){const e=Ce.c(82),{branches:n,currentBranch:r,base:s,onSelect:c,automatic:p,onSelectAutomatic:i,mobile:y}=t,m=p===void 0?!1:p,a=y===void 0?!1:y,{t:u}=le(),N=we(),j=a&&!N.enabled,[d,K]=O.useState(!1),[g,P]=O.useState("");let B;e[0]!==s||e[1]!==u?(B=s?De(s):u("gitView.pr.field.baseBranch"),e[0]=s,e[1]=u,e[2]=B):B=e[2];const x=B;let C;e[3]===Symbol.for("react.memo_cache_sentinel")?(C=z=>{K(z),z||P("")},e[3]=C):C=e[3];const M=C;let A;e[4]!==a?(A=pe(Ne({size:a?"mobile":"default"}),"min-w-0 max-w-48"),e[4]=a,e[5]=A):A=e[5];const w=a||void 0;let q;e[6]!==u?(q=u("gitView.pr.field.baseBranch"),e[6]=u,e[7]=q):q=e[7];const D=j?"dialog":void 0,k=j?d:void 0,T=!r;let L;e[8]!==j?(L=j?()=>M(!0):void 0,e[8]=j,e[9]=L):L=e[9];let F;e[10]===Symbol.for("react.memo_cache_sentinel")?(F=o.jsx(Z,{name:"git-branch",className:"size-3.5"}),e[10]=F):F=e[10];let $;e[11]!==x?($=o.jsx("span",{className:"truncate",children:x}),e[11]=x,e[12]=$):$=e[12];let W;e[13]===Symbol.for("react.memo_cache_sentinel")?(W=o.jsx(Z,{name:"arrow-down-s",className:"size-3.5"}),e[13]=W):W=e[13];let b;e[14]!==x||e[15]!==T||e[16]!==L||e[17]!==$||e[18]!==A||e[19]!==w||e[20]!==q||e[21]!==D||e[22]!==k?(b=o.jsxs(re,{variant:"outline",className:A,"data-mobile-comparison-trigger":w,"aria-label":q,"aria-haspopup":D,"aria-expanded":k,title:x,disabled:T,onClick:L,children:[F,$,W]}),e[14]=x,e[15]=T,e[16]=L,e[17]=$,e[18]=A,e[19]=w,e[20]=q,e[21]=D,e[22]=k,e[23]=b):b=e[23];const V=b,Q=a?"[&_[data-slot=command-input-wrapper]]:h-11":void 0,S=!j,I=a?"h-11":void 0;let R;e[24]!==u?(R=u("gitView.branch.searchPlaceholder"),e[24]=u,e[25]=R):R=e[25];let E;e[26]!==u?(E=u("gitView.branch.searchPlaceholder"),e[26]=u,e[27]=E):E=e[27];let _;e[28]!==g||e[29]!==S||e[30]!==I||e[31]!==R||e[32]!==E?(_=o.jsx(Se,{autoFocus:S,className:I,value:g,onValueChange:P,placeholder:R,"aria-label":E}),e[28]=g,e[29]=S,e[30]=I,e[31]=R,e[32]=E,e[33]=_):_=e[33];const J=a?"max-h-[min(45dvh,24rem)]":void 0;let v;e[34]!==u?(v=u("gitView.branch.empty"),e[34]=u,e[35]=v):v=e[35];let l;e[36]!==v?(l=o.jsx(be,{children:v}),e[36]=v,e[37]=l):l=e[37];let H;e[38]!==m||e[39]!==a||e[40]!==i||e[41]!==g||e[42]!==u?(H=i&&!g.trim()&&o.jsx(ge,{children:o.jsxs(xe,{value:"automatic",className:a?"min-h-11":void 0,onSelect:()=>{i(),M(!1)},children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:u("gitView.branch.comparisonBaseAutomatic")}),m&&o.jsx(Z,{name:"check",className:"size-3.5"})]})}),e[38]=m,e[39]=a,e[40]=i,e[41]=g,e[42]=u,e[43]=H):H=e[43];let f;e[44]!==m||e[45]!==s||e[46]!==n||e[47]!==r||e[48]!==a||e[49]!==c||e[50]!==d||e[51]!==g?(f=d&&Ae([...new Set(n)].filter(z=>z!==r).sort().map(gt),g,pt).map(z=>o.jsxs(xe,{value:z.ref,className:a?"min-h-11":void 0,onSelect:()=>{c(z.ref),M(!1)},children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",title:z.ref,children:z.label}),!m&&(z.ref===s||z.label===s)&&o.jsx(Z,{name:"check",className:"size-3.5"})]},z.ref)),e[44]=m,e[45]=s,e[46]=n,e[47]=r,e[48]=a,e[49]=c,e[50]=d,e[51]=g,e[52]=f):f=e[52];let h;e[53]!==f?(h=o.jsx(ge,{children:f}),e[53]=f,e[54]=h):h=e[54];let G;e[55]!==J||e[56]!==l||e[57]!==H||e[58]!==h?(G=o.jsxs(Pe,{className:J,children:[l,H,h]}),e[55]=J,e[56]=l,e[57]=H,e[58]=h,e[59]=G):G=e[59];let X;e[60]!==Q||e[61]!==_||e[62]!==G?(X=o.jsxs(ke,{shouldFilter:!1,className:Q,onKeyDown:xt,children:[_,G]}),e[60]=Q,e[61]=_,e[62]=G,e[63]=X):X=e[63];const U=X;if(j){let z;e[64]!==u?(z=u("gitView.pr.field.baseBranch"),e[64]=u,e[65]=z):z=e[65];let ce;e[66]===Symbol.for("react.memo_cache_sentinel")?(ce=()=>M(!1),e[66]=ce):ce=e[66];let ie;e[67]!==d||e[68]!==U||e[69]!==z?(ie=o.jsx(Re,{open:d,title:z,onClose:ce,children:U}),e[67]=d,e[68]=U,e[69]=z,e[70]=ie):ie=e[70];let ue;return e[71]!==ie||e[72]!==V?(ue=o.jsxs(o.Fragment,{children:[V,ie]}),e[71]=ie,e[72]=V,e[73]=ue):ue=e[73],ue}let Y;e[74]!==V?(Y=o.jsx(Le,{asChild:!0,children:V}),e[74]=V,e[75]=Y):Y=e[75];let te;e[76]!==U?(te=o.jsx($e,{align:"start",className:"w-72 max-w-[calc(100vw-2rem)] p-0",children:U}),e[76]=U,e[77]=te):te=e[77];let oe;return e[78]!==d||e[79]!==Y||e[80]!==te?(oe=o.jsxs(Ee,{open:d,onOpenChange:M,children:[Y,te]}),e[78]=d,e[79]=Y,e[80]=te,e[81]=oe):oe=e[81],oe}function pt(t){return[t.label]}function gt(t){return{ref:t.startsWith("remotes/")?`refs/${t}`:`refs/heads/${t}`,label:De(t)}}function xt(t){t.key!=="Escape"&&t.stopPropagation()}function Ut(t){const e=Ce.c(77),{commits:n,selectedHash:r,loading:s,error:c,onSelect:p,onRefresh:i,mobile:y}=t,m=y===void 0?!1:y,{t:a}=le(),u=we(),N=m&&!u.enabled,j=ot(vt),[d,K]=O.useState(!1),[g,P]=O.useState("");let B;e[0]!==s||e[1]!==i?(B=h=>{K(h),h?s||i():P("")},e[0]=s,e[1]=i,e[2]=B):B=e[2];const x=B;let C;e[3]!==m?(C=pe(Ne({size:m?"mobile":"default"}),"min-w-0 max-w-48"),e[3]=m,e[4]=C):C=e[4];const M=m||void 0;let A;e[5]!==x||e[6]!==N?(A=N?()=>x(!0):void 0,e[5]=x,e[6]=N,e[7]=A):A=e[7];const w=N?"dialog":void 0,q=N?d:void 0;let D;e[8]!==a?(D=a("commitComparison.select"),e[8]=a,e[9]=D):D=e[9];let k;e[10]!==r||e[11]!==a?(k=r??a("commitComparison.select"),e[10]=r,e[11]=a,e[12]=k):k=e[12];let T;e[13]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(Z,{name:"git-commit",className:"size-3.5"}),e[13]=T):T=e[13];let L;e[14]!==r||e[15]!==a?(L=r?.slice(0,8)??a("commitComparison.select"),e[14]=r,e[15]=a,e[16]=L):L=e[16];let F;e[17]!==L?(F=o.jsx("span",{className:"truncate",children:L}),e[17]=L,e[18]=F):F=e[18];let $;e[19]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(Z,{name:"arrow-down-s",className:"size-3.5"}),e[19]=$):$=e[19];let W;e[20]!==F||e[21]!==C||e[22]!==M||e[23]!==A||e[24]!==w||e[25]!==q||e[26]!==D||e[27]!==k?(W=o.jsxs(re,{variant:"ghost",className:C,"data-mobile-comparison-trigger":M,onClick:A,"aria-haspopup":w,"aria-expanded":q,"aria-label":D,title:k,children:[T,F,$]}),e[20]=F,e[21]=C,e[22]=M,e[23]=A,e[24]=w,e[25]=q,e[26]=D,e[27]=k,e[28]=W):W=e[28];const b=W,V=m?"[&_[data-slot=command-input-wrapper]]:h-11":void 0,Q=!N,S=m?"h-11":void 0;let I;e[29]!==a?(I=a("commitComparison.search"),e[29]=a,e[30]=I):I=e[30];let R;e[31]!==a?(R=a("commitComparison.search"),e[31]=a,e[32]=R):R=e[32];let E;e[33]!==g||e[34]!==Q||e[35]!==S||e[36]!==I||e[37]!==R?(E=o.jsx(Se,{autoFocus:Q,className:S,value:g,onValueChange:P,placeholder:I,"aria-label":R}),e[33]=g,e[34]=Q,e[35]=S,e[36]=I,e[37]=R,e[38]=E):E=e[38];let _;e[39]!==x||e[40]!==n||e[41]!==c||e[42]!==s||e[43]!==m||e[44]!==i||e[45]!==p||e[46]!==d||e[47]!==g||e[48]!==r||e[49]!==a||e[50]!==j?(_=s?o.jsxs("div",{className:"flex items-center justify-center gap-2 p-4 typography-meta text-muted-foreground",children:[o.jsx(Z,{name:"loader-4",className:"size-4 animate-spin"}),a("diffView.state.loadingChanges")]}):c?o.jsxs("div",{className:"flex flex-col items-center gap-2 p-4 typography-meta text-muted-foreground",children:[o.jsx("span",{children:a("commitComparison.loadError")}),o.jsx("span",{className:"max-w-full break-words",children:c}),o.jsx(re,{variant:"outline",size:m?"lg":"sm",onClick:i,children:a("diffView.actions.retry")})]}):o.jsxs(Pe,{className:m?"max-h-[min(45dvh,24rem)]":void 0,children:[o.jsx(be,{children:a("commitComparison.noCommits")}),o.jsx(ge,{children:d&&Ae(n,g,yt).map(h=>o.jsxs(xe,{value:h.hash,className:m?"min-h-11":void 0,onSelect:()=>{p(h),x(!1)},children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"truncate typography-ui-label font-semibold",title:h.message,children:h.message}),o.jsxs("div",{className:"flex min-w-0 gap-1 typography-meta text-muted-foreground",children:[o.jsxs("span",{className:"min-w-0 truncate",children:[h.author_name," · ",Number.isNaN(new Date(h.date).getTime())?h.date:ze(new Date(h.date),j,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]}),o.jsxs("span",{className:"shrink-0",children:["· ",h.hash.slice(0,8)]})]})]}),h.hash===r&&o.jsx(Z,{name:"check",className:"size-3.5"})]},h.hash))})]}),e[39]=x,e[40]=n,e[41]=c,e[42]=s,e[43]=m,e[44]=i,e[45]=p,e[46]=d,e[47]=g,e[48]=r,e[49]=a,e[50]=j,e[51]=_):_=e[51];let J;e[52]!==V||e[53]!==E||e[54]!==_?(J=o.jsxs(ke,{shouldFilter:!1,className:V,onKeyDown:Ct,children:[E,_]}),e[52]=V,e[53]=E,e[54]=_,e[55]=J):J=e[55];const v=J;if(N){let h;e[56]!==a?(h=a("commitComparison.select"),e[56]=a,e[57]=h):h=e[57];let G;e[58]!==x?(G=()=>x(!1),e[58]=x,e[59]=G):G=e[59];let X;e[60]!==d||e[61]!==v||e[62]!==h||e[63]!==G?(X=o.jsx(Re,{open:d,title:h,onClose:G,children:v}),e[60]=d,e[61]=v,e[62]=h,e[63]=G,e[64]=X):X=e[64];let U;return e[65]!==X||e[66]!==b?(U=o.jsxs(o.Fragment,{children:[b,X]}),e[65]=X,e[66]=b,e[67]=U):U=e[67],U}let l;e[68]!==b?(l=o.jsx(Le,{asChild:!0,children:b}),e[68]=b,e[69]=l):l=e[69];let H;e[70]!==v?(H=o.jsx($e,{align:"start",className:"w-[32rem] max-w-[calc(100vw-2rem)] p-0",children:v}),e[70]=v,e[71]=H):H=e[71];let f;return e[72]!==x||e[73]!==d||e[74]!==l||e[75]!==H?(f=o.jsxs(Ee,{open:d,onOpenChange:x,children:[l,H]}),e[72]=x,e[73]=d,e[74]=l,e[75]=H,e[76]=f):f=e[76],f}function yt(t){return[t.message,t.author_name,t.hash]}function Ct(t){t.key!=="Escape"&&t.stopPropagation()}function vt(t){return t.timeFormatPreference}const jt="openchamber.git-base-branch",wt=100,he=(t,e)=>JSON.stringify([ee(),t,e]),Nt=lt()(ct((t,e)=>({overrides:{},getOverride:(n,r)=>!n||!r?null:e().overrides[he(n,r)]??null,setOverride:(n,r,s)=>{!n||!r||!s||t(c=>{const p=he(n,r),i=Object.entries({...c.overrides,[p]:s});for(;i.length>wt;)i.shift();return{overrides:Object.fromEntries(i)}})},clearOverride:(n,r)=>{!n||!r||t(s=>{const c=he(n,r);if(!(c in s.overrides))return s;const p={...s.overrides};return delete p[c],{overrides:p}})}}),{name:jt,storage:it(),partialize:t=>({overrides:t.overrides})}));function Xt(t,e,n,r){const s=Ce.c(44),{branches:c,remoteNames:p,primaryRemote:i,readContext:y}=r,m=ye(kt);let a;s[0]!==t||s[1]!==n?(a=S=>n&&t?S.directories.get(t)?.lastStatusFetch??0:0,s[0]=t,s[1]=n,s[2]=a):a=s[2];const u=ye(a);let N;s[3]!==e||s[4]!==t||s[5]!==m?(N=JSON.stringify([m,t,e]),s[3]=e,s[4]=t,s[5]=m,s[6]=N):N=s[6];const j=N;let d;s[7]!==e||s[8]!==t?(d=t&&e?he(t,e):null,s[7]=e,s[8]=t,s[9]=d):d=s[9];const K=d;let g;s[10]!==K?(g=S=>K?S.overrides[K]??null:null,s[10]=K,s[11]=g):g=s[11];const P=Nt(g);let B;s[12]!==e||s[13]!==y?(B=S=>y&&e?He(S.entries,y,e):null,s[12]=e,s[13]=y,s[14]=B):B=s[14];const x=ae(B),C=x?.changeRequest??x?.pr??null,M=C?.state==="open"?C.base:null,[A,w]=O.useState(null);let q;s[15]!==e||s[16]!==t||s[17]!==n||s[18]!==j?(q=()=>{if(!n||!t||!e)return;let S=!1;const I=ee();return Ge(t,e).then(R=>{const{base:E}=R;S||ee()!==I||w(_=>_?.key===j&&_.base===E?_:{key:j,base:E})}).catch(()=>{S||ee()!==I||w(R=>R?.key===j?R:{key:j,base:null})}),()=>{S=!0}},s[15]=e,s[16]=t,s[17]=n,s[18]=j,s[19]=q):q=s[19];let D;s[20]!==e||s[21]!==t||s[22]!==n||s[23]!==j||s[24]!==u?(D=[e,t,n,j,u],s[20]=e,s[21]=t,s[22]=n,s[23]=j,s[24]=u,s[25]=D):D=s[25],O.useEffect(q,D);const k=A?.key===j,T=k?A.base:null;let L;e:{if(!e||!c){L=null;break e}let S;if(s[26]!==e||s[27]!==c.all||s[28]!==c.defaultBranches||s[29]!==T||s[30]!==k||s[31]!==P||s[32]!==i||s[33]!==M||s[34]!==p){const I=c.all??[];S=at({chosen:P,pullRequest:M,createdFrom:T,defaultBranch:k&&i?c.defaultBranches?.[i]??null:null},{localBranches:I.filter(Pt),remoteBranches:I.filter(bt).map(St),remoteNames:p,primaryRemote:i,headBranch:e}),s[26]=e,s[27]=c.all,s[28]=c.defaultBranches,s[29]=T,s[30]=k,s[31]=P,s[32]=i,s[33]=M,s[34]=p,s[35]=S}else S=s[35];L=S}const F=L,$=F?.source??null,W=F?.ref??null,b=!!F||k&&c!==null;let V;s[36]!==m||s[37]!==u?(V=JSON.stringify([m,u]),s[36]=m,s[37]=u,s[38]=V):V=s[38];let Q;return s[39]!==$||s[40]!==V||s[41]!==W||s[42]!==b?(Q={base:W,source:$,resolved:b,revision:V},s[39]=$,s[40]=V,s[41]=W,s[42]=b,s[43]=Q):Q=s[43],Q}function St(t){return t.slice(8)}function bt(t){return t.startsWith("remotes/")}function Pt(t){return!t.startsWith("remotes/")}function kt(t){return t.runtimeKey}const Rt=[];function Yt(t,e,n,r){const{git:s}=Me(),{t:c}=le(),p=ye(g=>g.runtimeKey),i=Je(t??"",e,p),y=ve(g=>g.selections.get(i)??null),m=ve(g=>g.select),[a,u]=O.useState(null),N=O.useRef(0),j=O.useRef(r);j.current=r;const d=O.useCallback(async()=>{if(!t||!n)return;const g=++N.current,P=ee();u({key:i,status:"loading"});try{const B=await s.getGitLog(t,{maxCount:50,to:e?`refs/heads/${e}`:"HEAD"});if(N.current!==g||ee()!==P)return;const x=B.all.slice(0,50);if(u({key:i,status:"ready",commits:x}),!ve.getState().selections.has(i)){const C=j.current?x.find(M=>M.hash===j.current):x[0];C&&m(i,C)}}catch(B){if(N.current!==g||ee()!==P)return;u({key:i,status:"error",message:B instanceof Error?B.message:c("commitComparison.loadError")})}},[e,t,n,s,i,m,c]);O.useEffect(()=>(d(),()=>{N.current+=1}),[d]);const K=a?.key===i?a:null;return{selectedCommit:y,commits:K?.status==="ready"?K.commits:Rt,loading:n&&(!K||K.status==="loading"),error:K?.status==="error"?K.message:null,refresh:d,select:g=>m(i,g)}}const Oe=[],Lt=[],$t=6e4,Et=30,se=new Map,Bt=t=>{for(se.delete(t.key),se.set(t.key,{list:t,readAt:Date.now()});se.size>Et;)se.delete(se.keys().next().value??"")},It=t=>({kind:"pr",number:t.number,sourceRepo:{owner:t.project.owner,repo:t.project.name}}),_t=t=>`${t.project.owner}/${t.project.name}#${t.number}`,Ft=(t,e,n)=>{const r=st(t,e);return{prs:[...new Map([...n?t:[],...r].map(c=>[_t(c),c])).values()],incompleteProjectIds:e.incompleteProjectIds??[]}};function Zt(t,e,n,r,s){const{sourceControl:c}=Me(),{t:p}=le(),i=ye(l=>l.runtimeKey),y=n?.provider==="github"||n?.provider==="gitlab"?n:null,m=y?JSON.stringify(Qe(y)):"",a=O.useRef(y);a.current=y;const u=y,N=Ue(t)?.provider,j=u?.provider??N??null,d=JSON.stringify([i,t,e,u?.repositoryId??null]),K=me(l=>l.selections.get(d)??null),g=K?.source??null,P=me(l=>l.select),B=me(l=>l.acceptHandoff),x=s&&K?.handoff!==s?s:null,[C,M]=O.useState(""),A=Xe(C,350).trim(),w=JSON.stringify([d,A,m]),[q,D]=O.useState(()=>se.get(w)?.list??null),k=O.useRef(q);k.current=q;const[T,L]=O.useState(!1),F=O.useRef(0),$=O.useRef({key:w,enabled:r});$.current={key:w,enabled:r};const W=Ye(l=>u?l.entries[Ze(u)]:void 0),b=u?et(W,u):{authChecked:!1,connected:!1},V=ae(l=>l.ensureEntry),Q=ae(l=>l.setParams),S=ae(l=>l.refreshTargets),I=ae(l=>u&&e?He(l.entries,u,e):null);O.useEffect(()=>{const l=a.current;if(!r||!l||!e||g||!b.authChecked||!b.connected)return;const H=tt(l,e);V(H),Q(H,{directory:l.directory,branch:e,remoteName:l.primaryRemote,canShow:!0,identity:l,readContext:l,sourceControl:c,authChecked:b.authChecked,connected:b.connected}),S([{context:l,branch:e}])},[b.authChecked,b.connected,e,m,r,V,S,g,Q,c]);const R=I?.changeRequest??I?.pr??null,E=I?.project??null;O.useEffect(()=>{!r||!b.connected||!R||!E||me.getState().selections.has(d)||P(d,{kind:"pr",number:R.number,sourceRepo:{owner:E.owner,repo:E.name}})},[b.connected,R,E,r,P,d]),O.useEffect(()=>{s&&B(d,s)},[B,s,d]);const _=O.useCallback(async l=>{if(!t||!r||$.current.key!==w||!$.current.enabled)return;const H=++F.current,f=ee(),h=k.current,G=h?.key===w&&h.status==="ready"?h:null,X=l?.prs??G?.prs??Oe;l?L(!0):(L(!1),G||D({key:w,status:"loading"}));try{const U=a.current;if(!c)throw new Error(p(fe("session.githubPrPicker.error.runtimeUnavailable",j)));if(!U||!b.connected)throw new Error(p(fe("session.githubPrPicker.empty.notConnected",j)));const Y=l?l.page+1:1,te=await c.changeRequestsList(U,{page:Y,query:A||void 0});if(F.current!==H||ee()!==f||$.current.key!==w||!$.current.enabled)return;const oe=Ft(X,te,!!l),z={key:w,status:"ready",...oe,page:Y,hasMore:te.hasMore,error:null};Bt(z),D(z)}catch(U){if(F.current===H&&ee()===f&&$.current.key===w&&$.current.enabled){const Y=U instanceof Error?U.message:p(fe("session.githubPrPicker.toast.loadMoreFailed",j));D(l?{...l,error:Y}:{key:w,status:"error",message:Y})}}finally{F.current===H&&L(!1)}},[b.connected,t,r,w,j,A,c,p]),J=O.useCallback(()=>{const l=se.get(w);return l&&k.current!==l.list&&D(l.list),l&&Date.now()-l.readAt<$t?Promise.resolve():_()},[w,_]);O.useEffect(()=>((k.current?.key!==w||k.current.status!=="ready"||se.has(w))&&J(),()=>{F.current+=1}),[w,J]);const v=q?.key===w?q:null;return{enabled:r,readContext:u,provider:j,selectedSource:x??g,prs:v?.status==="ready"?v.prs:Oe,query:C,setQuery:M,loading:r&&(!v||v.status==="loading"||A!==C.trim()),loadingMore:T,hasMore:v?.status==="ready"&&v.hasMore,incompleteProjectIds:v?.status==="ready"?v.incompleteProjectIds:Lt,error:v?.status==="error"?v.message:v?.status==="ready"?v.error:null,refresh:()=>_(),revalidate:J,loadMore:()=>v?.status==="ready"&&v.hasMore&&!T?_(v):Promise.resolve(),select:l=>P(d,It(l))}}function es(t){const e=Ce.c(77),{comparison:n,mobile:r}=t,s=r===void 0?!1:r,{t:c}=le();let p;e[0]!==n.provider||e[1]!==c?(p=f=>c(fe(f,n.provider)),e[0]=n.provider,e[1]=c,e[2]=p):p=e[2];const i=p;let y;e[3]!==n.provider?(y=f=>nt(n.provider,f),e[3]=n.provider,e[4]=y):y=e[4];const m=y,a=we(),u=s&&!a.enabled,[N,j]=O.useState(!1);let d,K;e[5]!==n.enabled?(d=()=>{n.enabled||j(!1)},K=[n.enabled],e[5]=n.enabled,e[6]=d,e[7]=K):(d=e[6],K=e[7]),O.useEffect(d,K);let g;e[8]!==i?(g=i("pullRequestComparison.select"),e[8]=i,e[9]=g):g=e[9];const P=g;let B;e[10]!==n?(B=f=>{j(f),f&&!n.loading&&n.revalidate(),f||n.setQuery("")},e[10]=n,e[11]=B):B=e[11];const x=B,C=n.selectedSource;let M;e[12]!==s?(M=pe(Ne({size:s?"mobile":"default"}),"min-w-0 max-w-48"),e[12]=s,e[13]=M):M=e[13];const A=s||void 0;let w;e[14]!==x||e[15]!==u?(w=u?()=>x(!0):void 0,e[14]=x,e[15]=u,e[16]=w):w=e[16];const q=u?"dialog":void 0,D=u?N:void 0;let k;e[17]!==P||e[18]!==m||e[19]!==C?(k=C?.sourceRepo?`${C.sourceRepo.owner}/${C.sourceRepo.repo} ${m(C.number)}`:P,e[17]=P,e[18]=m,e[19]=C,e[20]=k):k=e[20];let T;e[21]!==P||e[22]!==m||e[23]!==C?(T=C?m(C.number):P,e[21]=P,e[22]=m,e[23]=C,e[24]=T):T=e[24];let L;e[25]!==T?(L=o.jsx("span",{className:"truncate",children:T}),e[25]=T,e[26]=L):L=e[26];let F;e[27]===Symbol.for("react.memo_cache_sentinel")?(F=o.jsx(Z,{name:"arrow-down-s",className:"size-3.5"}),e[27]=F):F=e[27];let $;e[28]!==P||e[29]!==w||e[30]!==q||e[31]!==D||e[32]!==k||e[33]!==L||e[34]!==M||e[35]!==A?($=o.jsxs(re,{variant:"ghost",className:M,"data-mobile-comparison-trigger":A,onClick:w,"aria-haspopup":q,"aria-expanded":D,"aria-label":P,title:k,children:[L,F]}),e[28]=P,e[29]=w,e[30]=q,e[31]=D,e[32]=k,e[33]=L,e[34]=M,e[35]=A,e[36]=$):$=e[36];const W=$,b=!u,V=n.query,Q=n.setQuery;let S;e[37]!==i?(S=i("session.githubPrPicker.searchPlaceholder"),e[37]=i,e[38]=S):S=e[38];let I;e[39]!==i?(I=i("session.githubPrPicker.searchPlaceholder"),e[39]=i,e[40]=I):I=e[40];let R;e[41]!==n.query||e[42]!==n.setQuery||e[43]!==b||e[44]!==S||e[45]!==I?(R=o.jsx(Se,{autoFocus:b,value:V,onValueChange:Q,placeholder:S,"aria-label":I}),e[41]=n.query,e[42]=n.setQuery,e[43]=b,e[44]=S,e[45]=I,e[46]=R):R=e[46];let E;e[47]!==x||e[48]!==n||e[49]!==s||e[50]!==N||e[51]!==m||e[52]!==C||e[53]!==i?(E=n.loading?o.jsxs("div",{className:"flex items-center gap-2 p-4 typography-meta text-muted-foreground",children:[o.jsx(Z,{name:"loader-4",className:"size-4 animate-spin"}),i("session.githubPrPicker.loading.pullRequests")]}):n.error&&n.prs.length===0?o.jsxs("div",{className:"flex flex-col items-center gap-2 p-4 typography-meta text-muted-foreground",children:[o.jsx("span",{children:n.error}),o.jsx(re,{variant:"outline",size:"sm",onClick:()=>{n.refresh()},children:i("diffView.actions.retry")})]}):o.jsxs(Pe,{className:pe("min-h-0",s&&"max-h-[min(45dvh,24rem)]"),children:[o.jsx(be,{children:i("session.githubPrPicker.empty.noPullRequestsFound")}),o.jsx(ge,{children:N&&n.prs.map(f=>{const h=`${f.project.owner}/${f.project.name}#${f.number}`;return o.jsxs(xe,{value:h,className:s?"min-h-11":void 0,onSelect:()=>{n.select(f),x(!1)},children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"truncate typography-ui-label",title:f.title,children:[m(f.number)," ",f.title]}),o.jsxs("div",{className:"truncate typography-meta text-muted-foreground",children:[f.project.owner,"/",f.project.name," · ",f.head," → ",f.base]})]}),C?.number===f.number&&C.sourceRepo?.owner===f.project.owner&&C.sourceRepo?.repo===f.project.name&&o.jsx(Z,{name:"check",className:"size-3.5"})]},h)})}),n.error&&o.jsx("p",{className:"px-3 py-2 typography-meta text-muted-foreground",children:n.error}),!n.error&&n.incompleteProjectIds.length>0&&o.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 typography-meta text-muted-foreground",children:[o.jsx("span",{children:i("pullRequestComparison.partial")}),o.jsx(re,{variant:"outline",size:"sm",onClick:()=>{n.refresh()},children:i("diffView.actions.retry")})]}),n.hasMore&&o.jsx(re,{variant:"ghost",size:"sm",disabled:n.loadingMore,onClick:()=>{n.loadMore()},children:n.error?i("diffView.actions.retry"):i("session.githubPrPicker.actions.loadMore")})]}),e[47]=x,e[48]=n,e[49]=s,e[50]=N,e[51]=m,e[52]=C,e[53]=i,e[54]=E):E=e[54];let _;e[55]!==R||e[56]!==E?(_=o.jsxs(ke,{className:"min-h-0",shouldFilter:!1,onKeyDown:Ot,children:[R,E]}),e[55]=R,e[56]=E,e[57]=_):_=e[57];const J=_;if(u){let f;e[58]!==x?(f=()=>x(!1),e[58]=x,e[59]=f):f=e[59];let h;e[60]!==P||e[61]!==N||e[62]!==J||e[63]!==f?(h=o.jsx(Re,{open:N,title:P,onClose:f,children:J}),e[60]=P,e[61]=N,e[62]=J,e[63]=f,e[64]=h):h=e[64];let G;return e[65]!==h||e[66]!==W?(G=o.jsxs(o.Fragment,{children:[W,h]}),e[65]=h,e[66]=W,e[67]=G):G=e[67],G}let v;e[68]!==W?(v=o.jsx(Le,{asChild:!0,children:W}),e[68]=W,e[69]=v):v=e[69];let l;e[70]!==J?(l=o.jsx($e,{align:"start",className:"flex max-h-[min(var(--available-height),32rem)] w-[32rem] max-w-[calc(100vw-2rem)] flex-col overflow-hidden p-0",children:J}),e[70]=J,e[71]=l):l=e[71];let H;return e[72]!==x||e[73]!==N||e[74]!==v||e[75]!==l?(H=o.jsxs(Ee,{open:N,onOpenChange:x,children:[v,l]}),e[72]=x,e[73]=N,e[74]=v,e[75]=l,e[76]=H):H=e[76],H}function Ot(t){t.key!=="Escape"&&t.stopPropagation()}export{Qt as B,Ut as C,es as P,Yt as a,Xt as b,Zt as c,Gt as e,zt as f,Jt as g,Vt as h,Wt as i,Nt as u};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{f as ie,R as I,j as s}from"./vendor-react-BUCujlKS.js";import{dY as Ee,dZ as $e,d_ as Te,u as pe,a1 as le,N as _,d$ as Be,cK as Oe,c3 as qe,cY as Ue,c9 as Ke,ca as Ge,cb as Ve,cc as _e,z as We,I as F,e0 as Ye,B as z,V as Se,W as Ie,X as Ce,c8 as be,a5 as He,Y as Je,e1 as Xe,e2 as Ze,e3 as Qe,e4 as et,n as tt,e5 as ge,e6 as je,e7 as De,e8 as Me,e9 as st,A as V,ea as nt,eb as rt,ec as it,G as Re,ed as ot,ee as at}from"./useAppFontEffects-DAUhSLPu.js";import{u as ae,n as ze}from"./katex.min-u4DtE8E5.js";import{D as lt,E as ct,F as Ae,G as ut,H as dt}from"./runtimeEndpointReset-D7viEboD.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CPKyhvxM.js";import"./vendor-floating-ui-utils-D6FqdtJt.js";import"./vendor-floating-ui-dom-BTvzWks8.js";import"./vendor-floating-ui-core-PuGzNPnN.js";import"./vendor-floating-ui-react-dom-DxYCWdHj.js";import"./vendor-use-sync-external-store-D6wYuSt-.js";import"./vendor-zod-DDir2TeQ.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-BAGL70zf.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-dnd-kit-core-BZknOX2w.js";import"./vendor-dnd-kit-utilities-B_MdXhJC.js";import"./vendor-dnd-kit-accessibility-BHxJPORy.js";import"./vendor-dnd-kit-sortable-CsEagZ81.js";import"./vendor-tanstack-react-virtual-Bmi0tTrf.js";import"./vendor-tanstack-virtual-core-CdGDGrnp.js";import"./vendor-framer-motion-DxDVhOLc.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-codemirror-commands-dar6chwA.js";import"./vendor-codemirror-state-Dek9sMtw.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-B66jUSmE.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-DyL0aCoH.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-Cem6LjJ8.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-CIqXJolH.js";import"./vendor-codemirror-lang-json-C9rLLO0q.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-9qjxcVkg.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-D7VQUxeE.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-Cikh4w2I.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-KulAIuMz.js";import"./vendor-codemirror-lang-python-DVl8-2Op.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-sonner-DFyL3AvE.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-cmdk-DgLInKvT.js";import"./vendor-radix-ui-react-dialog-B94Bt2qq.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-DcAh5WdT.js";import"./vendor-radix-ui-react-context-Czxm7Z62.js";import"./vendor-radix-ui-react-id-f5BLKEVw.js";import"./vendor-radix-ui-react-use-layout-effect-D_3IhJdJ.js";import"./vendor-radix-ui-react-use-controllable-state-BFT5YmkA.js";import"./vendor-radix-ui-react-dismissable-layer-D7kXcwgJ.js";import"./vendor-radix-ui-react-primitive-DhVoX9SD.js";import"./vendor-radix-ui-react-slot-BQgQOasS.js";import"./vendor-radix-ui-react-use-callback-ref-BZPnuXAC.js";import"./vendor-radix-ui-react-use-escape-keydown-oph88g-F.js";import"./vendor-radix-ui-react-focus-scope-CiaxW4dD.js";import"./vendor-radix-ui-react-portal-BMJYHWck.js";import"./vendor-radix-ui-react-presence-CNxf-uq4.js";import"./vendor-radix-ui-react-focus-guards-B6qJXYua.js";import"./vendor-react-remove-scroll-DO7dCTnK.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-BcFYyj3E.js";import"./vendor-react-style-singleton-q6EMHnwf.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-zDC0RhA3.js";import"./vendor-use-callback-ref-D3RC8gqK.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-D2O6oUGf.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-opencode-client-h8RufjAw.js";const ye=Te(),Fe=Te(),mt={reply:{state:"loading"},diff:{state:"loading"}};function ft(a,e){const n=ie.c(8);let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o=new Map,n[0]=o):o=n[0];const[w,x]=I.useState(o);let b;n[1]===Symbol.for("react.memo_cache_sentinel")?(b=new Map,n[1]=b):b=n[1];const j=I.useRef(b),f=I.useRef(!0);let p,y;n[2]===Symbol.for("react.memo_cache_sentinel")?(p=()=>(f.current=!0,()=>{f.current=!1}),y=[],n[2]=p,n[3]=y):(p=n[2],y=n[3]),I.useEffect(p,y);let l,g;return n[4]!==e||n[5]!==a?(l=()=>{const d=(u,h,v)=>{!f.current||j.current.get(u)!==h||x(N=>new Map(N).set(u,{...N.get(u)??mt,...v}))};for(const u of a){const h=u.session;if(!h||e.has(u.sessionId))continue;const v=ye.tokenFor(u.sessionId,`${h.time.idle??0}:${u.worktreePath??""}`);if(j.current.get(u.sessionId)===v)continue;j.current.set(u.sessionId,v);const N=ye.get(u.sessionId,v);N!==void 0?d(u.sessionId,v,{reply:{state:"ready",...N}}):Ee(u.sessionId,h.directory).then(c=>{ye.set(u.sessionId,v,c),d(u.sessionId,v,{reply:{state:"ready",...c}})},()=>d(u.sessionId,v,{reply:{state:"error"}}));const M=u.worktreePath;if(!M){d(u.sessionId,v,{diff:{state:"none"}});continue}const A=Fe.get(u.sessionId,v);A?d(u.sessionId,v,{diff:{state:"ready",stat:A}}):$e(M).then(c=>{Fe.set(u.sessionId,v,c),d(u.sessionId,v,{diff:{state:"ready",stat:c}})},()=>d(u.sessionId,v,{diff:{state:"error"}}))}},g=[e,a],n[4]=e,n[5]=a,n[6]=l,n[7]=g):(l=n[6],g=n[7]),I.useEffect(l,g),w}const pt=a=>{const e=ie.c(36),{value:n,onChange:o,className:w,disabled:x,id:b,portalToBody:j}=a,{t:f}=pe(),p=le(vt),y=le(ht),l=le(gt);let g;e[0]!==p?(g=p(),e[0]=p,e[1]=g):g=e[1];const d=g;let u;e[2]!==d?(u=d.filter(xt),e[2]=d,e[3]=u):u=e[3];const h=u;let v,N;e[4]!==d.length||e[5]!==y?(v=()=>{d.length===0&&y()},N=[d.length,y],e[4]=d.length,e[5]=y,e[6]=v,e[7]=N):(v=e[6],N=e[7]),I.useEffect(v,N);let M,A;e[8]!==l||e[9]!==x||e[10]!==o||e[11]!==h||e[12]!==n?(M=()=>{if(x)return;const U=n.trim();if(U.length>0&&h.some(L=>L.name===U))return;const B=typeof l=="string"&&l.trim().length>0?l.trim():null;if(B&&h.some(L=>L.name===B)){o(B);return}const O=h[0]?.name;O&&o(O)},A=[l,x,o,h,n],e[8]=l,e[9]=x,e[10]=o,e[11]=h,e[12]=n,e[13]=M,e[14]=A):(M=e[13],A=e[14]),I.useEffect(M,A);const c=n.trim().length>0?n:void 0;let D;e[15]!==w?(D=_("max-w-full",w),e[15]=w,e[16]=D):D=e[16];let S;e[17]!==f?(S=f("multirun.agentSelector.placeholder"),e[17]=f,e[18]=S):S=e[18];let q;e[19]!==S?(q=s.jsx(Ke,{placeholder:S}),e[19]=S,e[20]=q):q=e[20];let E;e[21]!==b||e[22]!==D||e[23]!==q?(E=s.jsx(Ge,{id:b,className:D,children:q}),e[21]=b,e[22]=D,e[23]=q,e[24]=E):E=e[24];let C;e[25]!==h?(C=h.length>0&&s.jsx(Be,{children:h.map(wt)}),e[25]=h,e[26]=C):C=e[26];let R;e[27]!==j||e[28]!==C?(R=s.jsx(Ve,{fitContent:!0,portalToBody:j,children:C}),e[27]=j,e[28]=C,e[29]=R):R=e[29];let $;return e[30]!==x||e[31]!==o||e[32]!==c||e[33]!==E||e[34]!==R?($=s.jsxs(_e,{value:c,onValueChange:o,disabled:x,children:[E,R]}),e[30]=x,e[31]=o,e[32]=c,e[33]=E,e[34]=R,e[35]=$):$=e[35],$};function vt(a){return a.getVisibleAgents}function ht(a){return a.loadAgents}function gt(a){return a.currentAgentName}function xt(a){return Oe(a.mode)}function wt(a){return s.jsx(qe,{value:a.name,className:"w-auto whitespace-nowrap",children:Ue(a)},a.name)}function yt(a){return a.blocking?a.blocking:a.busy?"working":a.session.outcome==="failed"?"failed":a.session.outcome==="interrupted"?"stopped":a.session.time.idle?a.reply?.state==="ready"&&!a.reply.text?"noReply":"finished":"notStarted"}const bt=["permission","question","failed","working","noReply","stopped","notStarted","finished"],jt={permission:"multirun.overview.status.count.permission",question:"multirun.overview.status.count.question",working:"multirun.overview.status.count.working",failed:"multirun.overview.status.count.failed",stopped:"multirun.overview.status.count.stopped",notStarted:"multirun.overview.status.count.notStarted",noReply:"multirun.overview.status.count.noReply",finished:"multirun.overview.status.count.finished"},Nt={permission:"multirun.overview.status.permission",question:"multirun.overview.status.question",working:"multirun.overview.status.working",failed:"multirun.overview.status.failed",stopped:"multirun.overview.status.stopped",notStarted:"multirun.overview.status.notStarted",noReply:"multirun.overview.status.noReply",finished:"multirun.overview.status.finished"},kt={permission:{name:"shield",className:"text-destructive"},question:{name:"question",className:"text-status-info"},working:{name:"loader-4",className:"text-[var(--status-warning)]"},failed:{name:"error-warning",className:"text-[var(--status-error)]"},stopped:{name:"stop",className:"text-muted-foreground"},notStarted:{name:"time",className:"text-muted-foreground"},noReply:{name:"alert",className:"text-[var(--status-warning)]"},finished:{name:"checkbox-circle",className:"text-muted-foreground"}};function Pe(a){const e=ie.c(12),{status:n,className:o}=a,{t:w}=pe(),x=kt[n],b=Nt[n];let j;e[0]!==w||e[1]!==b?(j=w(b),e[0]=w,e[1]=b,e[2]=j):j=e[2];const f=j;let p;e[3]!==o||e[4]!==x.className||e[5]!==x.name||e[6]!==f||e[7]!==n?(p=n==="working"?s.jsx(We,{className:_("size-3.5",x.className,o),"aria-label":f}):s.jsx(F,{name:x.name,className:_("size-3.5",x.className,o),"aria-label":f}),e[3]=o,e[4]=x.className,e[5]=x.name,e[6]=f,e[7]=n,e[8]=p):p=e[8];let y;return e[9]!==f||e[10]!==p?(y=s.jsx("span",{className:"inline-flex shrink-0",title:f,children:p}),e[9]=f,e[10]=p,e[11]=y):y=e[11],y}const St=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}),It=a=>{const e=Math.max(0,Math.round(a/1e3)),n=Math.floor(e/60),o=Math.floor(n/60);return o>0?`${o}h ${n%60}m`:n>0?`${n}m ${e%60}s`:`${e}s`};function Ct(a){const e=ie.c(8),{session:n,busy:o}=a,[w,x]=I.useState(Dt);let b,j;e[0]!==o?(b=()=>{if(!o)return;x(Date.now());const d=window.setInterval(()=>x(Date.now()),1e3);return()=>window.clearInterval(d)},j=[o],e[0]=o,e[1]=b,e[2]=j):(b=e[1],j=e[2]),I.useEffect(b,j);const f=o?w:n.time.idle;if(!f)return null;let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(F,{name:"time",className:"size-3"}),e[3]=p):p=e[3];const y=f-n.time.created;let l;e[4]!==y?(l=It(y),e[4]=y,e[5]=l):l=e[5];let g;return e[6]!==l?(g=s.jsxs("span",{className:"inline-flex items-center gap-1",children:[p,l]}),e[6]=l,e[7]=g):g=e[7],g}function Dt(){return Date.now()}function Mt(a){const e=ie.c(105),{session:n,providerID:o,modelLabel:w,variantLabel:x,isFusion:b,busy:j,status:f,unread:p,summary:y,fuseSource:l,hasWorktree:g,onToggleFuseSource:d,onKeep:u,onDetach:h,onArchive:v,actionsDisabled:N,onOpenChat:M,onOpenDiff:A}=a,{t:c}=pe(),D=y?.reply,S=y?.diff,q=l!==null&&!l.checked,E=D?.state==="ready"?D.text:"";let C;if(f==="permission"){let r;e[0]!==c?(r=c("multirun.overview.card.body.permission"),e[0]=c,e[1]=r):r=e[1];let m;e[2]!==r?(m=s.jsx("span",{className:"text-foreground",children:r}),e[2]=r,e[3]=m):m=e[3],C=m}else if(f==="question"){let r;e[4]!==c?(r=c("multirun.overview.card.body.question"),e[4]=c,e[5]=r):r=e[5];let m;e[6]!==r?(m=s.jsx("span",{className:"text-foreground",children:r}),e[6]=r,e[7]=m):m=e[7],C=m}else if(j){let r;e[8]!==c?(r=c("multirun.overview.card.working"),e[8]=c,e[9]=r):r=e[9];let m;e[10]!==r?(m=s.jsx("span",{className:"text-muted-foreground italic",children:r}),e[10]=r,e[11]=m):m=e[11],C=m}else if(f==="failed"){const r=D?.state==="ready"?D.error:null;let m;e[12]!==r||e[13]!==c?(m=r??c("multirun.overview.card.body.failed"),e[12]=r,e[13]=c,e[14]=m):m=e[14];let oe;e[15]!==m?(oe=s.jsx("span",{className:"text-[var(--status-error)]",children:m}),e[15]=m,e[16]=oe):oe=e[16],C=oe}else if(f==="notStarted"){let r;e[17]!==c?(r=c("multirun.overview.card.body.notStarted"),e[17]=c,e[18]=r):r=e[18];let m;e[19]!==r?(m=s.jsx("span",{className:"text-muted-foreground",children:r}),e[19]=r,e[20]=m):m=e[20],C=m}else if(!D||D.state==="loading"){let r;e[21]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("span",{className:"text-muted-foreground",children:"…"}),e[21]=r):r=e[21],C=r}else if(D.state==="error"){let r;e[22]!==c?(r=c("multirun.overview.card.replyUnavailable"),e[22]=c,e[23]=r):r=e[23];let m;e[24]!==r?(m=s.jsx("span",{className:"text-muted-foreground",children:r}),e[24]=r,e[25]=m):m=e[25],C=m}else if(E)C=E;else{let r;e[26]!==f||e[27]!==c?(r=c(f==="stopped"?"multirun.overview.card.body.stopped":"multirun.overview.card.noReply"),e[26]=f,e[27]=c,e[28]=r):r=e[28];let m;e[29]!==r?(m=s.jsx("span",{className:"text-muted-foreground",children:r}),e[29]=r,e[30]=m):m=e[30],C=m}let R=null;if(S?.state==="ready"){let r;e[31]!==S.stat.deletions||e[32]!==S.stat.files||e[33]!==S.stat.insertions||e[34]!==c?(r=S.stat.files===0?s.jsx("span",{children:c("multirun.overview.card.noChanges")}):s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsxs("span",{className:"text-[var(--status-success)]",children:["+",S.stat.insertions]}),s.jsxs("span",{className:"text-[var(--status-error)]",children:["−",S.stat.deletions]}),s.jsxs("span",{children:["· ",S.stat.files===1?c("multirun.overview.card.filesSingle",{count:S.stat.files}):c("multirun.overview.card.filesPlural",{count:S.stat.files})]})]}),e[31]=S.stat.deletions,e[32]=S.stat.files,e[33]=S.stat.insertions,e[34]=c,e[35]=r):r=e[35],R=r}else if(S?.state==="error"){let r;e[36]!==c?(r=c("multirun.overview.card.changesUnavailable"),e[36]=c,e[37]=r):r=e[37];let m;e[38]!==r?(m=s.jsx("span",{children:r}),e[38]=r,e[39]=m):m=e[39],R=m}const $=l?"checkbox":void 0,U=l?0:void 0,B=l?l.checked:void 0;let O;e[40]!==l||e[41]!==w||e[42]!==c?(O=l?c("multirun.overview.card.selectAria",{name:w}):void 0,e[40]=l,e[41]=w,e[42]=c,e[43]=O):O=e[43];const L=l?d:void 0;let T;e[44]!==l||e[45]!==d?(T=l?r=>{r.target===r.currentTarget&&(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),d())}:void 0,e[44]=l,e[45]=d,e[46]=T):T=e[46];const W=b&&"col-span-full min-h-0 border-[color-mix(in_srgb,var(--primary-base)_35%,transparent)]",ce=l&&"cursor-pointer",ue=l?.checked&&"border-[var(--primary-base)]",fe=q&&"opacity-50",X=l&&!l.selectable&&"cursor-not-allowed";let Z;e[47]!==fe||e[48]!==X||e[49]!==W||e[50]!==ce||e[51]!==ue?(Z=_("relative flex min-h-[184px] flex-col gap-2 rounded-xl border p-3 text-start transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","bg-[var(--surface-elevated)] border-border hover:border-[var(--interactive-border-hover)]",W,ce,ue,fe,X),e[47]=fe,e[48]=X,e[49]=W,e[50]=ce,e[51]=ue,e[52]=Z):Z=e[52];let Y;e[53]!==o?(Y=s.jsx(be,{providerId:o,className:"h-4 w-4 shrink-0"}),e[53]=o,e[54]=Y):Y=e[54];let P;e[55]!==w?(P=s.jsx("span",{className:"min-w-0 truncate typography-ui-label font-semibold text-foreground",children:w}),e[55]=w,e[56]=P):P=e[56];let K;e[57]!==x?(K=x?s.jsx("span",{className:"shrink-0 rounded border border-border px-1 typography-micro text-muted-foreground",children:x}):null,e[57]=x,e[58]=K):K=e[58];let G;e[59]!==l||e[60]!==f||e[61]!==p?(G=s.jsx("span",{className:"ms-auto inline-flex shrink-0 items-center",children:l?s.jsx("span",{"aria-hidden":"true",className:_("inline-flex size-4 items-center justify-center rounded border",l.checked?"border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--primary-foreground)]":"border-[var(--interactive-border-hover)]"),children:l.checked?s.jsx(F,{name:"check",className:"size-3"}):null}):s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[p&&f!=="working"?s.jsx(Ye,{state:"unread"}):null,s.jsx(Pe,{status:f})]})}),e[59]=l,e[60]=f,e[61]=p,e[62]=G):G=e[62];let Q;e[63]!==Y||e[64]!==P||e[65]!==K||e[66]!==G?(Q=s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[Y,P,K,G]}),e[63]=Y,e[64]=P,e[65]=K,e[66]=G,e[67]=Q):Q=e[67];const H=b?"line-clamp-4":"line-clamp-5 flex-1";let ee;e[68]!==H?(ee=_("typography-meta text-foreground",H,"whitespace-pre-line break-words"),e[68]=H,e[69]=ee):ee=e[69];let te;e[70]!==C||e[71]!==ee?(te=s.jsx("div",{className:ee,children:C}),e[70]=C,e[71]=ee,e[72]=te):te=e[72];let se;e[73]!==j||e[74]!==n?(se=s.jsx(Ct,{session:n,busy:j}),e[73]=j,e[74]=n,e[75]=se):se=e[75];let ne;e[76]!==n.cost?(ne=n.cost>0?s.jsx("span",{children:St.format(n.cost)}):null,e[76]=n.cost,e[77]=ne):ne=e[77];let re;e[78]!==R||e[79]!==se||e[80]!==ne?(re=s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 typography-micro text-muted-foreground",children:[R,se,ne]}),e[78]=R,e[79]=se,e[80]=ne,e[81]=re):re=e[81];let J;e[82]!==N||e[83]!==S||e[84]!==l||e[85]!==g||e[86]!==v||e[87]!==h||e[88]!==u||e[89]!==M||e[90]!==A||e[91]!==c?(J=l?null:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs(z,{variant:"outline",size:"xs",onClick:r=>{r.stopPropagation(),M()},children:[s.jsx(F,{name:"chat-3",className:"size-3.5"}),c("multirun.overview.card.openChat")]}),u?s.jsxs(z,{variant:"outline",size:"xs",onClick:u,children:[s.jsx(F,{name:"check",className:"size-3.5"}),c("multirun.overview.card.keep")]}):null,g&&S?.state==="ready"&&S.stat.files>0?s.jsxs(z,{variant:"ghost",size:"xs",onClick:r=>{r.stopPropagation(),A()},children:[s.jsx(F,{name:"arrow-left-right",className:"size-3.5"}),c("multirun.overview.card.diff")]}):null,s.jsxs("span",{className:"ms-auto inline-flex items-center gap-0.5",children:[s.jsxs(Se,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx(z,{variant:"ghost",size:"icon",className:"size-6 text-muted-foreground hover:text-foreground",disabled:N,"aria-label":c("multirun.overview.card.detach"),onClick:h,children:s.jsx(F,{name:"external-link",className:"size-3.5"})})}),s.jsx(Ce,{side:"top",children:c("multirun.overview.card.detachHint")})]}),s.jsxs(Se,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx(z,{variant:"ghost",size:"icon",className:"size-6 text-muted-foreground hover:text-foreground",disabled:N,"aria-label":c("multirun.overview.card.archive"),onClick:v,children:s.jsx(F,{name:"inbox-archive",className:"size-3.5"})})}),s.jsx(Ce,{side:"top",children:c("multirun.overview.card.archive")})]})]})]}),e[82]=N,e[83]=S,e[84]=l,e[85]=g,e[86]=v,e[87]=h,e[88]=u,e[89]=M,e[90]=A,e[91]=c,e[92]=J):J=e[92];let de;return e[93]!==$||e[94]!==Z||e[95]!==Q||e[96]!==U||e[97]!==te||e[98]!==re||e[99]!==J||e[100]!==B||e[101]!==O||e[102]!==L||e[103]!==T?(de=s.jsxs("div",{role:$,tabIndex:U,"aria-checked":B,"aria-label":O,onClick:L,onKeyDown:T,className:Z,children:[Q,te,re,J]}),e[93]=$,e[94]=Z,e[95]=Q,e[96]=U,e[97]=te,e[98]=re,e[99]=J,e[100]=B,e[101]=O,e[102]=L,e[103]=T,e[104]=de):de=e[104],de}const Le=(a,e)=>{const o=e.find(w=>w.id===a.identity.providerID)?.models.find(w=>w.id===a.identity.modelID)?.name||a.identity.modelID;return a.identity.index&&a.identity.index>1?`${o} #${a.identity.index}`:o};function Rt(a,e){const n=ie.c(9);let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o=new Map,n[0]=o):o=n[0];const[w,x]=I.useState(o);a?.lanes;let b;if(n[1]!==a?.lanes){b=new Map;for(const y of a?.lanes??[]){const l=je(y.identity.runGroup);b.has(l)||b.set(l,y.sessionId)}n[1]=a?.lanes,n[2]=b}else b=n[2];const j=b;let f;n[3]!==j||n[4]!==w||n[5]!==e?(f=()=>{let y=!1;for(const[l,g]of j){const d=e.get(g);!d||w.has(l)||at(g,d.directory).then(u=>{y||!u?.text||x(h=>new Map(h).set(l,u.text))},zt)}return()=>{y=!0}},n[3]=j,n[4]=w,n[5]=e,n[6]=f):f=n[6];let p;return n[7]!==j?(p=[j],n[7]=j,n[8]=p):p=n[8],I.useEffect(f,p),w}function zt(){}function At(a){const e=ie.c(15),{prompt:n,expanded:o,onToggle:w}=a,{t:x}=pe(),b=I.useRef(null),[j,f]=I.useState(!1);let p,y;e[0]!==o||e[1]!==n?(p=()=>{const h=b.current;if(!h||o)return;const v=()=>f(h.scrollWidth>h.clientWidth+1||n.includes(`
|
|
2
|
-
`));v();const N=new ResizeObserver(v);return N.observe(h),()=>N.disconnect()},y=[o,n],e[0]=o,e[1]=n,e[2]=p,e[3]=y):(p=e[2],y=e[3]),I.useLayoutEffect(p,y);const l=j||o;let g;e[4]!==o||e[5]!==n?(g=o?s.jsx("div",{className:"max-h-64 min-w-0 flex-1 overflow-y-auto whitespace-pre-wrap break-words rounded-md bg-[var(--surface-muted)] px-2 py-1.5 typography-meta text-foreground",children:n}):s.jsx("span",{ref:b,className:"min-w-0 flex-1 truncate typography-meta text-muted-foreground",children:n}),e[4]=o,e[5]=n,e[6]=g):g=e[6];let d;e[7]!==l||e[8]!==o||e[9]!==w||e[10]!==x?(d=l?s.jsxs("button",{type:"button",onClick:w,"aria-expanded":o,className:"inline-flex shrink-0 items-center gap-0.5 rounded px-1 typography-meta text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[x(o?"multirun.overview.prompt.collapse":"multirun.overview.prompt.expand"),s.jsx(F,{name:o?"arrow-up-s":"arrow-down-s",className:"size-3.5"})]}):null,e[7]=l,e[8]=o,e[9]=w,e[10]=x,e[11]=d):d=e[11];let u;return e[12]!==g||e[13]!==d?(u=s.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-1",children:[g,d]}),e[12]=g,e[13]=d,e[14]=u):u=e[14],u}function Ft({runKey:a}){const{t:e}=pe(),{run:n,sessionById:o}=lt(a),w=le(t=>t.providers),x=le(t=>t.currentProviderId),b=le(t=>t.currentModelId),j=le(t=>t.currentAgentName),f=He(t=>t.projects),p=Je(t=>t.activeSessionIds),y=Xe(t=>t.bySession),l=Ze(t=>t.index.session.unseenCount),g=ae(t=>t.isMobile),[d,u]=I.useState({kind:"idle"}),[h,v]=I.useState(null),[N,M]=I.useState([]),[A,c]=I.useState(j??""),[D,S]=I.useState(null),[q,E]=I.useState(()=>new Set),[C,R]=I.useState(null),$=I.useMemo(()=>new Set(f.map(t=>ze(t.path)).filter(t=>!!t)),[f]),U=I.useMemo(()=>(n?.memberIds??[]).map(t=>{const i=o.get(t),k=ze(i?.directory);return{sessionId:t,session:i,worktreePath:k&&!$.has(k)?k:null}}),[$,n?.memberIds,o]),B=ft(U,p),O=Rt(n,o),L=I.useMemo(()=>new Map(U.map(t=>[t.sessionId,t.worktreePath])),[U]);if(I.useEffect(()=>{if(N.length>0)return;const t=n?.autoFusion,i=t?.providerID??x,k=t?.modelID??b;i&&k&&M([{providerID:i,modelID:k,variant:t?.variant,instanceId:Qe()}])},[b,x,N.length,n?.autoFusion]),!n)return s.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-8 text-center typography-meta text-muted-foreground",children:[e("multirun.overview.missing"),s.jsx(z,{variant:"outline",size:"sm",onClick:()=>ae.getState().closeMainSurfaces(),children:e("header.mainSurface.backToChat")})]});const T=n.lanes.map(t=>t.sessionId),W=T.filter(t=>!p.has(t)&&o.get(t)?.time.idle),ce=T.filter(t=>p.has(t)).length,ue=n.lanes.some(t=>L.get(t.sessionId)),fe=new Map([...n.lanes,...n.fusions].map(t=>[t.sessionId,t])),X=t=>{const i=fe.get(t);return i?Le(i,w):""},Z=n.autoFusion?.launcherId===et&&n.fusions.length===0,Y=t=>{const i=o.get(t);if(!i)return null;const k=y.get(t);return yt({session:i,busy:p.has(t),blocking:k?.permissions.length?"permission":k?.forms.length||k?.pages.length?"question":null,reply:B.get(t)?.reply})},P=new Map;for(const t of T){const i=Y(t);i&&P.set(i,(P.get(i)??0)+1)}const K=(P.get("permission")??0)+(P.get("question")??0),G=t=>{const i=o.get(t);ae.getState().closeMainSurfaces(),Re.getState().setCurrentSession(t,i?.directory??null)},Q=t=>{const i=L.get(t);G(t),i&&ae.getState().openContextPanelTab(i,{mode:"diff"})},H=d.kind==="fuse"?W.filter(t=>!d.excluded.has(t)):[],ee=ct(H.map(t=>{const i=B.get(t)?.diff;return{hasWorktree:!!L.get(t),diff:i?.state==="ready"?i.stat:null}})),te=t=>{if(d.kind!=="fuse"||!W.includes(t))return;const i=new Set(d.excluded);i.has(t)?i.delete(t):i.add(t),u({kind:"fuse",excluded:i})},se=async t=>{v("keep");try{const i=X(t),k=await rt(n,t,o);k.failures.length>0?V.error(k.failures.length===1?e("multirun.overview.keep.partialSingle",{name:i,count:k.failures.length}):e("multirun.overview.keep.partialPlural",{name:i,count:k.failures.length})):V.success(e("multirun.overview.keep.done",{name:i})),G(t)}catch(i){console.error("[MultiRun] Keep failed",i),V.error(e("multirun.overview.keep.failed"))}finally{v(null),u({kind:"idle"})}},ne=async()=>{const t=N[0];if(!(!t||H.length<2)){v("fuse");try{await ut({run:n,sourceIds:H,judge:Ae({providerID:t.providerID,modelID:t.modelID,variant:t.variant,agent:A||void 0}),sessionById:o}),u({kind:"idle"})}catch(i){console.error("[MultiRun] Fusion failed to start",i),V.error(i instanceof dt?e("multirun.fusion.toast.noOutputs"):e("multirun.fusion.toast.failed"))}finally{v(null)}}},re=async(t,i)=>{v("ask");try{await it({run:n,runGroup:i,model:t,sessionById:o})}catch(k){console.error("[MultiRun] Could not add a lane",k),V.error(e("multirun.overview.ask.failed"))}finally{v(null)}},J=async t=>{if(S(null),!t.trim()||t.trim()===n.title)return;(await st(n,t,o)).length>0&&V.error(e("multirun.overview.rename.failed"))},de=async t=>{const i=o.get(t);if(i){v("member");try{await ot(i,n.title),V.success(e("multirun.overview.card.detachDone",{name:X(t)}))}catch(k){console.error("[MultiRun] Could not detach a session",k),V.error(e("multirun.overview.card.detachFailed"))}finally{v(null)}}},r=async t=>{v("member");try{(await Re.getState().archiveSessions([t])).failedIds.length>0&&V.error(e("multirun.overview.archive.failed"))}finally{v(null)}},m=async()=>{v("archive");try{(await nt(n)).failedIds.length>0?V.error(e("multirun.overview.archive.failed")):ae.getState().closeMainSurfaces()}finally{v(null)}},oe=t=>{const i=o.get(t.sessionId);if(!i)return null;const k=t.identity.role==="fusion",me=W.includes(t.sessionId);return s.jsx(Mt,{session:i,providerID:t.identity.providerID,modelLabel:Le(t,w),variantLabel:!k&&n.variants.length>1?je(t.identity.runGroup):null,isFusion:k,busy:p.has(t.sessionId),status:Y(t.sessionId)??"notStarted",unread:(l[t.sessionId]??0)>0,summary:B.get(t.sessionId),fuseSource:d.kind==="fuse"&&!k?{checked:me&&!d.excluded.has(t.sessionId),selectable:me}:null,hasWorktree:!!L.get(t.sessionId),onToggleFuseSource:()=>te(t.sessionId),onKeep:ue&&me&&d.kind==="idle"&&(!k||L.get(t.sessionId))?()=>u({kind:"keep",sessionId:t.sessionId}):void 0,onDetach:()=>{de(t.sessionId)},onArchive:()=>{r(t.sessionId)},actionsDisabled:h!==null||d.kind!=="idle",onOpenChat:()=>G(t.sessionId),onOpenDiff:()=>Q(t.sessionId)},t.sessionId)},Ne=t=>{const i=C&&C.runGroup===t?C.model:null;return i?s.jsxs("span",{className:"inline-flex flex-wrap items-center gap-1.5",children:[s.jsxs("span",{className:"inline-flex h-8 items-center gap-1.5 rounded-[9px] border border-border px-2.5 typography-meta text-foreground",children:[s.jsx(be,{providerId:i.providerID,className:"size-3.5"}),i.displayName||i.modelID]}),s.jsx(Me,{appearance:"trigger",providerID:i.providerID,modelID:i.modelID,variant:i.variant,onChange:k=>R({runGroup:t,model:{...i,variant:k}})}),s.jsx(z,{size:"sm",disabled:h!==null,onClick:()=>{R(null),re(i,t)},children:e("multirun.overview.addModel.confirm")}),s.jsx(z,{variant:"ghost",size:"icon",className:"size-8","aria-label":e("multirun.overview.cancel"),onClick:()=>R(null),children:s.jsx(F,{name:"close",className:"size-3.5"})})]}):s.jsx("span",{title:e("multirun.overview.addModel.hint"),children:s.jsx(De,{selectedModels:[],onAdd:k=>R({runGroup:t,model:k}),onRemove:()=>{},maxModels:1,showChips:!1,dropdownSide:"bottom",portal:!0,addButtonClassName:"h-8 min-h-8 px-2.5 typography-meta",addButtonLabel:e(h==="ask"?"multirun.overview.ask.working":"multirun.overview.addModel.action")})})},ke=g?"grid grid-cols-1 gap-2.5":"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-2.5",ve=d.kind==="keep"?d.sessionId:null,xe=n.memberIds.length-1;return s.jsxs("div",{className:"relative flex h-full flex-col",children:[s.jsx(tt,{outerClassName:"flex-1 min-h-0",className:"h-full",children:s.jsxs("div",{className:_("mx-auto w-full max-w-5xl pt-5",g?"px-4":"px-6",g&&d.kind==="fuse"?"pb-56":"pb-32"),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[g?s.jsx(z,{variant:"ghost",size:"icon",className:"-ms-2 shrink-0","aria-label":e("header.mainSurface.backToChat"),onClick:()=>ae.getState().closeMainSurfaces(),children:s.jsx(F,{name:"arrow-left",className:"size-[18px]"})}):null,s.jsxs("div",{className:"min-w-0 flex-1",children:[D!==null?s.jsx("form",{onSubmit:t=>{t.preventDefault(),J(D)},children:s.jsx("input",{autoFocus:!0,value:D,onChange:t=>S(t.target.value),onBlur:()=>{J(D)},onKeyDown:t=>{t.key==="Escape"&&S(null)},"aria-label":e("multirun.overview.rename.aria"),className:"w-full rounded-md border border-border bg-transparent px-1.5 py-0.5 typography-heading-lg text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring"})}):s.jsx("button",{type:"button",onClick:()=>S(n.title),dir:"auto",className:"max-w-full truncate oc-ui-start-align typography-heading-lg text-foreground hover:underline decoration-dotted underline-offset-4",title:e("multirun.overview.rename.aria"),children:n.title}),s.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 typography-meta text-muted-foreground",children:[s.jsxs("span",{children:[n.lanes.length===1?e("multirun.overview.meta.runsSingle",{count:n.lanes.length}):e("multirun.overview.meta.runsPlural",{count:n.lanes.length}),n.variants.length>1?` · ${e("multirun.overview.meta.variants",{count:n.variants.length})}`:""]}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(F,{name:"git-branch",className:"size-3.5"}),e(ue?"multirun.overview.meta.worktrees":"multirun.overview.meta.sharedDirectory")]}),bt.map(t=>{const i=P.get(t)??0;return i===0?null:s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(Pe,{status:t}),e(jt[t],{count:i})]},t)}),Z&&n.autoFusion?s.jsxs("span",{className:"inline-flex items-center gap-1 text-foreground",children:[s.jsx(ge,{className:"size-3.5 text-[var(--primary-base)]"}),e("multirun.overview.meta.autoFusion",{model:Ae(n.autoFusion).modelName??n.autoFusion.modelID})]}):null]})]}),!g&&n.variants.length===1?Ne(n.variants[0]):null,s.jsxs(z,{variant:"ghost",size:g?"icon":"sm",className:"shrink-0",disabled:h!==null,"aria-label":e("multirun.overview.archive.action"),onClick:()=>{m()},children:[s.jsx(F,{name:"inbox-archive",className:"size-4"}),g?null:e("multirun.overview.archive.action")]})]}),n.fusions.length>0?s.jsxs("section",{className:"mt-6",children:[s.jsxs("h2",{className:"mb-2 inline-flex items-center gap-1.5 typography-ui-label font-semibold text-foreground",children:[s.jsx(ge,{className:"size-4 text-[var(--primary-base)]"}),e("multirun.overview.fusedResult")]}),s.jsx("div",{className:ke,children:n.fusions.map(oe)})]}):null,n.variants.map(t=>{const i=je(t),k=n.lanes.filter(we=>we.identity.runGroup===t),me=O.get(i);return s.jsxs("section",{className:"mt-6",children:[s.jsxs("div",{className:"mb-2 flex min-w-0 items-start gap-2",children:[n.variants.length>1?s.jsx("span",{className:"shrink-0 rounded border border-border px-1.5 typography-meta font-semibold text-foreground",children:i}):null,me?s.jsx(At,{prompt:me,expanded:q.has(i),onToggle:()=>E(we=>{const he=new Set(we);return he.has(i)?he.delete(i):he.add(i),he})}):null,!g&&n.variants.length>1?s.jsx("span",{className:"ms-auto shrink-0",children:Ne(t)}):null]}),s.jsx("div",{className:ke,children:k.map(oe)})]},i)})]})}),s.jsx("div",{className:_("pointer-events-none absolute inset-x-0 bottom-4 flex justify-center",g?"px-3":"px-6"),children:s.jsx("div",{className:"pointer-events-auto flex w-full max-w-4xl flex-wrap items-center gap-2 rounded-xl border border-[var(--interactive-border-hover)] bg-[var(--surface-elevated)] px-3 py-2 shadow-lg",children:ve?s.jsxs(s.Fragment,{children:[s.jsx(F,{name:"git-branch",className:"size-4 text-muted-foreground"}),s.jsx("span",{className:"min-w-0 flex-1 typography-meta text-foreground",children:xe===1?e("multirun.overview.keep.confirmSingle",{name:X(ve),count:xe}):e("multirun.overview.keep.confirmPlural",{name:X(ve),count:xe})}),s.jsx(z,{variant:"ghost",size:"sm",disabled:h!==null,onClick:()=>u({kind:"idle"}),children:e("multirun.overview.cancel")}),s.jsx(z,{size:"sm",disabled:h!==null,onClick:()=>{se(ve)},children:e(h==="keep"?"multirun.overview.keep.working":"multirun.overview.keep.confirm")})]}):d.kind==="fuse"?s.jsxs(s.Fragment,{children:[s.jsx(ge,{className:"size-4 text-[var(--primary-base)]"}),s.jsx("span",{className:"typography-meta text-foreground",children:e("multirun.overview.fuse.with")}),s.jsx(De,{selectedModels:N,onAdd:t=>M([t]),onUpdate:(t,i)=>M([i]),onRemove:()=>M([]),maxModels:1,showChips:!1,dropdownSide:"top",addButtonLabel:N[0]?N[0].displayName||N[0].modelID:e("multirun.fusion.model.placeholder"),triggerIcon:N[0]?s.jsx(be,{providerId:N[0].providerID,className:"me-1 size-3.5"}):void 0}),N[0]?s.jsx(Me,{appearance:"trigger",providerID:N[0].providerID,modelID:N[0].modelID,variant:N[0].variant,onChange:t=>M(i=>i.map(k=>({...k,variant:t})))}):null,s.jsx(pt,{value:A,onChange:c,className:"w-fit"}),s.jsx("span",{className:"typography-micro text-muted-foreground",children:e(ee==="code"?"multirun.overview.fuse.modeCode":"multirun.overview.fuse.modeAnswers")}),s.jsx("span",{className:"flex-1"}),s.jsx("span",{className:"typography-micro text-muted-foreground",children:e("multirun.overview.fuse.selected",{count:H.length,total:W.length})}),s.jsx(z,{variant:"ghost",size:"sm",disabled:h!==null,onClick:()=>u({kind:"idle"}),children:e("multirun.overview.cancel")}),s.jsx(z,{size:"sm",disabled:h!==null||H.length<2||N.length===0,onClick:()=>{ne()},children:e(h==="fuse"?"multirun.fusion.actions.starting":"multirun.fusion.actions.start")})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:_("min-w-0 flex-1 truncate typography-meta",K>0?"text-foreground":"text-muted-foreground"),children:K>0?e("multirun.overview.bar.waiting",{count:K}):ce>0?e("multirun.overview.meta.progress",{done:T.length-ce,total:T.length}):e("multirun.overview.bar.hint")}),s.jsxs(z,{size:"sm",disabled:W.length<2||h!==null,onClick:()=>u({kind:"fuse",excluded:new Set}),children:[s.jsx(ge,{className:"size-4"}),e("multirun.overview.bar.fuse")]})]})})})]})}function dn(){const a=ie.c(3),e=ae(Lt);if(!e)return null;let n;a[0]===Symbol.for("react.memo_cache_sentinel")?(n=_("absolute inset-0 z-10 bg-background"),a[0]=n):n=a[0];let o;return a[1]!==e?(o=s.jsx("div",{className:n,children:s.jsx(Ft,{runKey:e},e)}),a[1]=e,a[2]=o):o=a[2],o}function Lt(a){return a.runOverviewKey}export{dn as RunOverview};
|
|
1
|
+
import{f as ie,R as I,j as s}from"./vendor-react-BUCujlKS.js";import{dZ as Ee,d_ as $e,d$ as Te,u as pe,a1 as le,N as _,e0 as Be,cL as Oe,c4 as qe,cZ as Ue,ca as Ge,cb as Ke,cc as Ve,cd as _e,z as We,I as L,e1 as He,B as z,V as Se,W as Ie,X as Ce,c9 as be,a5 as Je,Y as Ye,e2 as Ze,e3 as Xe,e4 as Qe,e5 as et,n as tt,e6 as ge,e7 as je,e8 as De,e9 as Me,ea as st,A as V,eb as nt,ec as rt,ed as it,G as Re,ee as ot,ef as at}from"./useAppFontEffects-Dm6zEvrf.js";import{u as ae,n as ze}from"./katex.min-F4TD1ekM.js";import{D as lt,E as ct,F as Ae,G as ut,H as dt}from"./runtimeEndpointReset-lg1O2gVX.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CPKyhvxM.js";import"./vendor-floating-ui-utils-D6FqdtJt.js";import"./vendor-floating-ui-dom-BTvzWks8.js";import"./vendor-floating-ui-core-PuGzNPnN.js";import"./vendor-floating-ui-react-dom-DxYCWdHj.js";import"./vendor-use-sync-external-store-D6wYuSt-.js";import"./vendor-zod-DDir2TeQ.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-BAGL70zf.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-dnd-kit-core-BZknOX2w.js";import"./vendor-dnd-kit-utilities-B_MdXhJC.js";import"./vendor-dnd-kit-accessibility-BHxJPORy.js";import"./vendor-dnd-kit-sortable-CsEagZ81.js";import"./vendor-tanstack-react-virtual-Bmi0tTrf.js";import"./vendor-tanstack-virtual-core-CdGDGrnp.js";import"./vendor-framer-motion-DxDVhOLc.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-codemirror-commands-dar6chwA.js";import"./vendor-codemirror-state-Dek9sMtw.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-B66jUSmE.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-DyL0aCoH.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-Cem6LjJ8.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-CIqXJolH.js";import"./vendor-codemirror-lang-json-C9rLLO0q.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-9qjxcVkg.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-D7VQUxeE.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-Cikh4w2I.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-VzNDjH03.js";import"./vendor-codemirror-lang-python-DVl8-2Op.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-sonner-DFyL3AvE.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-cmdk-DgLInKvT.js";import"./vendor-radix-ui-react-dialog-B94Bt2qq.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-DcAh5WdT.js";import"./vendor-radix-ui-react-context-Czxm7Z62.js";import"./vendor-radix-ui-react-id-f5BLKEVw.js";import"./vendor-radix-ui-react-use-layout-effect-D_3IhJdJ.js";import"./vendor-radix-ui-react-use-controllable-state-BFT5YmkA.js";import"./vendor-radix-ui-react-dismissable-layer-D7kXcwgJ.js";import"./vendor-radix-ui-react-primitive-DhVoX9SD.js";import"./vendor-radix-ui-react-slot-BQgQOasS.js";import"./vendor-radix-ui-react-use-callback-ref-BZPnuXAC.js";import"./vendor-radix-ui-react-use-escape-keydown-oph88g-F.js";import"./vendor-radix-ui-react-focus-scope-CiaxW4dD.js";import"./vendor-radix-ui-react-portal-BMJYHWck.js";import"./vendor-radix-ui-react-presence-CNxf-uq4.js";import"./vendor-radix-ui-react-focus-guards-B6qJXYua.js";import"./vendor-react-remove-scroll-DO7dCTnK.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-BcFYyj3E.js";import"./vendor-react-style-singleton-q6EMHnwf.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-zDC0RhA3.js";import"./vendor-use-callback-ref-D3RC8gqK.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-D2O6oUGf.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-opencode-client-h8RufjAw.js";const ye=Te(),Le=Te(),mt={reply:{state:"loading"},diff:{state:"loading"}};function ft(a,e){const n=ie.c(8);let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o=new Map,n[0]=o):o=n[0];const[w,x]=I.useState(o);let b;n[1]===Symbol.for("react.memo_cache_sentinel")?(b=new Map,n[1]=b):b=n[1];const j=I.useRef(b),f=I.useRef(!0);let p,y;n[2]===Symbol.for("react.memo_cache_sentinel")?(p=()=>(f.current=!0,()=>{f.current=!1}),y=[],n[2]=p,n[3]=y):(p=n[2],y=n[3]),I.useEffect(p,y);let l,g;return n[4]!==e||n[5]!==a?(l=()=>{const d=(u,h,v)=>{!f.current||j.current.get(u)!==h||x(N=>new Map(N).set(u,{...N.get(u)??mt,...v}))};for(const u of a){const h=u.session;if(!h||e.has(u.sessionId))continue;const v=ye.tokenFor(u.sessionId,`${h.time.idle??0}:${u.worktreePath??""}`);if(j.current.get(u.sessionId)===v)continue;j.current.set(u.sessionId,v);const N=ye.get(u.sessionId,v);N!==void 0?d(u.sessionId,v,{reply:{state:"ready",...N}}):Ee(u.sessionId,h.directory).then(c=>{ye.set(u.sessionId,v,c),d(u.sessionId,v,{reply:{state:"ready",...c}})},()=>d(u.sessionId,v,{reply:{state:"error"}}));const M=u.worktreePath;if(!M){d(u.sessionId,v,{diff:{state:"none"}});continue}const A=Le.get(u.sessionId,v);A?d(u.sessionId,v,{diff:{state:"ready",stat:A}}):$e(M).then(c=>{Le.set(u.sessionId,v,c),d(u.sessionId,v,{diff:{state:"ready",stat:c}})},()=>d(u.sessionId,v,{diff:{state:"error"}}))}},g=[e,a],n[4]=e,n[5]=a,n[6]=l,n[7]=g):(l=n[6],g=n[7]),I.useEffect(l,g),w}const pt=a=>{const e=ie.c(36),{value:n,onChange:o,className:w,disabled:x,id:b,portalToBody:j}=a,{t:f}=pe(),p=le(vt),y=le(ht),l=le(gt);let g;e[0]!==p?(g=p(),e[0]=p,e[1]=g):g=e[1];const d=g;let u;e[2]!==d?(u=d.filter(xt),e[2]=d,e[3]=u):u=e[3];const h=u;let v,N;e[4]!==d.length||e[5]!==y?(v=()=>{d.length===0&&y()},N=[d.length,y],e[4]=d.length,e[5]=y,e[6]=v,e[7]=N):(v=e[6],N=e[7]),I.useEffect(v,N);let M,A;e[8]!==l||e[9]!==x||e[10]!==o||e[11]!==h||e[12]!==n?(M=()=>{if(x)return;const U=n.trim();if(U.length>0&&h.some(F=>F.name===U))return;const B=typeof l=="string"&&l.trim().length>0?l.trim():null;if(B&&h.some(F=>F.name===B)){o(B);return}const O=h[0]?.name;O&&o(O)},A=[l,x,o,h,n],e[8]=l,e[9]=x,e[10]=o,e[11]=h,e[12]=n,e[13]=M,e[14]=A):(M=e[13],A=e[14]),I.useEffect(M,A);const c=n.trim().length>0?n:void 0;let D;e[15]!==w?(D=_("max-w-full",w),e[15]=w,e[16]=D):D=e[16];let S;e[17]!==f?(S=f("multirun.agentSelector.placeholder"),e[17]=f,e[18]=S):S=e[18];let q;e[19]!==S?(q=s.jsx(Ge,{placeholder:S}),e[19]=S,e[20]=q):q=e[20];let E;e[21]!==b||e[22]!==D||e[23]!==q?(E=s.jsx(Ke,{id:b,className:D,children:q}),e[21]=b,e[22]=D,e[23]=q,e[24]=E):E=e[24];let C;e[25]!==h?(C=h.length>0&&s.jsx(Be,{children:h.map(wt)}),e[25]=h,e[26]=C):C=e[26];let R;e[27]!==j||e[28]!==C?(R=s.jsx(Ve,{fitContent:!0,portalToBody:j,children:C}),e[27]=j,e[28]=C,e[29]=R):R=e[29];let $;return e[30]!==x||e[31]!==o||e[32]!==c||e[33]!==E||e[34]!==R?($=s.jsxs(_e,{value:c,onValueChange:o,disabled:x,children:[E,R]}),e[30]=x,e[31]=o,e[32]=c,e[33]=E,e[34]=R,e[35]=$):$=e[35],$};function vt(a){return a.getVisibleAgents}function ht(a){return a.loadAgents}function gt(a){return a.currentAgentName}function xt(a){return Oe(a.mode)}function wt(a){return s.jsx(qe,{value:a.name,className:"w-auto whitespace-nowrap",children:Ue(a)},a.name)}function yt(a){return a.blocking?a.blocking:a.busy?"working":a.session.outcome==="failed"?"failed":a.session.outcome==="interrupted"?"stopped":a.session.time.idle?a.reply?.state==="ready"&&!a.reply.text?"noReply":"finished":"notStarted"}const bt=["permission","question","failed","working","noReply","stopped","notStarted","finished"],jt={permission:"multirun.overview.status.count.permission",question:"multirun.overview.status.count.question",working:"multirun.overview.status.count.working",failed:"multirun.overview.status.count.failed",stopped:"multirun.overview.status.count.stopped",notStarted:"multirun.overview.status.count.notStarted",noReply:"multirun.overview.status.count.noReply",finished:"multirun.overview.status.count.finished"},Nt={permission:"multirun.overview.status.permission",question:"multirun.overview.status.question",working:"multirun.overview.status.working",failed:"multirun.overview.status.failed",stopped:"multirun.overview.status.stopped",notStarted:"multirun.overview.status.notStarted",noReply:"multirun.overview.status.noReply",finished:"multirun.overview.status.finished"},kt={permission:{name:"shield",className:"text-destructive"},question:{name:"question",className:"text-status-info"},working:{name:"loader-4",className:"text-[var(--status-warning)]"},failed:{name:"error-warning",className:"text-[var(--status-error)]"},stopped:{name:"stop",className:"text-muted-foreground"},notStarted:{name:"time",className:"text-muted-foreground"},noReply:{name:"alert",className:"text-[var(--status-warning)]"},finished:{name:"checkbox-circle",className:"text-muted-foreground"}};function Pe(a){const e=ie.c(12),{status:n,className:o}=a,{t:w}=pe(),x=kt[n],b=Nt[n];let j;e[0]!==w||e[1]!==b?(j=w(b),e[0]=w,e[1]=b,e[2]=j):j=e[2];const f=j;let p;e[3]!==o||e[4]!==x.className||e[5]!==x.name||e[6]!==f||e[7]!==n?(p=n==="working"?s.jsx(We,{className:_("size-3.5",x.className,o),"aria-label":f}):s.jsx(L,{name:x.name,className:_("size-3.5",x.className,o),"aria-label":f}),e[3]=o,e[4]=x.className,e[5]=x.name,e[6]=f,e[7]=n,e[8]=p):p=e[8];let y;return e[9]!==f||e[10]!==p?(y=s.jsx("span",{className:"inline-flex shrink-0",title:f,children:p}),e[9]=f,e[10]=p,e[11]=y):y=e[11],y}const St=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}),It=a=>{const e=Math.max(0,Math.round(a/1e3)),n=Math.floor(e/60),o=Math.floor(n/60);return o>0?`${o}h ${n%60}m`:n>0?`${n}m ${e%60}s`:`${e}s`};function Ct(a){const e=ie.c(8),{session:n,busy:o}=a,[w,x]=I.useState(Dt);let b,j;e[0]!==o?(b=()=>{if(!o)return;x(Date.now());const d=window.setInterval(()=>x(Date.now()),1e3);return()=>window.clearInterval(d)},j=[o],e[0]=o,e[1]=b,e[2]=j):(b=e[1],j=e[2]),I.useEffect(b,j);const f=o?w:n.time.idle;if(!f)return null;let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(L,{name:"time",className:"size-3"}),e[3]=p):p=e[3];const y=f-n.time.created;let l;e[4]!==y?(l=It(y),e[4]=y,e[5]=l):l=e[5];let g;return e[6]!==l?(g=s.jsxs("span",{className:"inline-flex items-center gap-1",children:[p,l]}),e[6]=l,e[7]=g):g=e[7],g}function Dt(){return Date.now()}function Mt(a){const e=ie.c(105),{session:n,providerID:o,modelLabel:w,variantLabel:x,isFusion:b,busy:j,status:f,unread:p,summary:y,fuseSource:l,hasWorktree:g,onToggleFuseSource:d,onKeep:u,onDetach:h,onArchive:v,actionsDisabled:N,onOpenChat:M,onOpenDiff:A}=a,{t:c}=pe(),D=y?.reply,S=y?.diff,q=l!==null&&!l.checked,E=D?.state==="ready"?D.text:"";let C;if(f==="permission"){let r;e[0]!==c?(r=c("multirun.overview.card.body.permission"),e[0]=c,e[1]=r):r=e[1];let m;e[2]!==r?(m=s.jsx("span",{className:"text-foreground",children:r}),e[2]=r,e[3]=m):m=e[3],C=m}else if(f==="question"){let r;e[4]!==c?(r=c("multirun.overview.card.body.question"),e[4]=c,e[5]=r):r=e[5];let m;e[6]!==r?(m=s.jsx("span",{className:"text-foreground",children:r}),e[6]=r,e[7]=m):m=e[7],C=m}else if(j){let r;e[8]!==c?(r=c("multirun.overview.card.working"),e[8]=c,e[9]=r):r=e[9];let m;e[10]!==r?(m=s.jsx("span",{className:"text-muted-foreground italic",children:r}),e[10]=r,e[11]=m):m=e[11],C=m}else if(f==="failed"){const r=D?.state==="ready"?D.error:null;let m;e[12]!==r||e[13]!==c?(m=r??c("multirun.overview.card.body.failed"),e[12]=r,e[13]=c,e[14]=m):m=e[14];let oe;e[15]!==m?(oe=s.jsx("span",{className:"text-[var(--status-error)]",children:m}),e[15]=m,e[16]=oe):oe=e[16],C=oe}else if(f==="notStarted"){let r;e[17]!==c?(r=c("multirun.overview.card.body.notStarted"),e[17]=c,e[18]=r):r=e[18];let m;e[19]!==r?(m=s.jsx("span",{className:"text-muted-foreground",children:r}),e[19]=r,e[20]=m):m=e[20],C=m}else if(!D||D.state==="loading"){let r;e[21]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("span",{className:"text-muted-foreground",children:"…"}),e[21]=r):r=e[21],C=r}else if(D.state==="error"){let r;e[22]!==c?(r=c("multirun.overview.card.replyUnavailable"),e[22]=c,e[23]=r):r=e[23];let m;e[24]!==r?(m=s.jsx("span",{className:"text-muted-foreground",children:r}),e[24]=r,e[25]=m):m=e[25],C=m}else if(E)C=E;else{let r;e[26]!==f||e[27]!==c?(r=c(f==="stopped"?"multirun.overview.card.body.stopped":"multirun.overview.card.noReply"),e[26]=f,e[27]=c,e[28]=r):r=e[28];let m;e[29]!==r?(m=s.jsx("span",{className:"text-muted-foreground",children:r}),e[29]=r,e[30]=m):m=e[30],C=m}let R=null;if(S?.state==="ready"){let r;e[31]!==S.stat.deletions||e[32]!==S.stat.files||e[33]!==S.stat.insertions||e[34]!==c?(r=S.stat.files===0?s.jsx("span",{children:c("multirun.overview.card.noChanges")}):s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsxs("span",{className:"text-[var(--status-success)]",children:["+",S.stat.insertions]}),s.jsxs("span",{className:"text-[var(--status-error)]",children:["−",S.stat.deletions]}),s.jsxs("span",{children:["· ",S.stat.files===1?c("multirun.overview.card.filesSingle",{count:S.stat.files}):c("multirun.overview.card.filesPlural",{count:S.stat.files})]})]}),e[31]=S.stat.deletions,e[32]=S.stat.files,e[33]=S.stat.insertions,e[34]=c,e[35]=r):r=e[35],R=r}else if(S?.state==="error"){let r;e[36]!==c?(r=c("multirun.overview.card.changesUnavailable"),e[36]=c,e[37]=r):r=e[37];let m;e[38]!==r?(m=s.jsx("span",{children:r}),e[38]=r,e[39]=m):m=e[39],R=m}const $=l?"checkbox":void 0,U=l?0:void 0,B=l?l.checked:void 0;let O;e[40]!==l||e[41]!==w||e[42]!==c?(O=l?c("multirun.overview.card.selectAria",{name:w}):void 0,e[40]=l,e[41]=w,e[42]=c,e[43]=O):O=e[43];const F=l?d:void 0;let T;e[44]!==l||e[45]!==d?(T=l?r=>{r.target===r.currentTarget&&(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),d())}:void 0,e[44]=l,e[45]=d,e[46]=T):T=e[46];const W=b&&"col-span-full min-h-0 border-[color-mix(in_srgb,var(--primary-base)_35%,transparent)]",ce=l&&"cursor-pointer",ue=l?.checked&&"border-[var(--primary-base)]",fe=q&&"opacity-50",Z=l&&!l.selectable&&"cursor-not-allowed";let X;e[47]!==fe||e[48]!==Z||e[49]!==W||e[50]!==ce||e[51]!==ue?(X=_("relative flex min-h-[184px] flex-col gap-2 rounded-xl border p-3 text-start transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","bg-[var(--surface-elevated)] border-border hover:border-[var(--interactive-border-hover)]",W,ce,ue,fe,Z),e[47]=fe,e[48]=Z,e[49]=W,e[50]=ce,e[51]=ue,e[52]=X):X=e[52];let H;e[53]!==o?(H=s.jsx(be,{providerId:o,className:"h-4 w-4 shrink-0"}),e[53]=o,e[54]=H):H=e[54];let P;e[55]!==w?(P=s.jsx("span",{className:"min-w-0 truncate typography-ui-label font-semibold text-foreground",children:w}),e[55]=w,e[56]=P):P=e[56];let G;e[57]!==x?(G=x?s.jsx("span",{className:"shrink-0 rounded border border-border px-1 typography-micro text-muted-foreground",children:x}):null,e[57]=x,e[58]=G):G=e[58];let K;e[59]!==l||e[60]!==f||e[61]!==p?(K=s.jsx("span",{className:"ms-auto inline-flex shrink-0 items-center",children:l?s.jsx("span",{"aria-hidden":"true",className:_("inline-flex size-4 items-center justify-center rounded border",l.checked?"border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--primary-foreground)]":"border-[var(--interactive-border-hover)]"),children:l.checked?s.jsx(L,{name:"check",className:"size-3"}):null}):s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[p&&f!=="working"?s.jsx(He,{state:"unread"}):null,s.jsx(Pe,{status:f})]})}),e[59]=l,e[60]=f,e[61]=p,e[62]=K):K=e[62];let Q;e[63]!==H||e[64]!==P||e[65]!==G||e[66]!==K?(Q=s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[H,P,G,K]}),e[63]=H,e[64]=P,e[65]=G,e[66]=K,e[67]=Q):Q=e[67];const J=b?"line-clamp-4":"line-clamp-5 flex-1";let ee;e[68]!==J?(ee=_("typography-meta text-foreground",J,"whitespace-pre-line break-words"),e[68]=J,e[69]=ee):ee=e[69];let te;e[70]!==C||e[71]!==ee?(te=s.jsx("div",{className:ee,children:C}),e[70]=C,e[71]=ee,e[72]=te):te=e[72];let se;e[73]!==j||e[74]!==n?(se=s.jsx(Ct,{session:n,busy:j}),e[73]=j,e[74]=n,e[75]=se):se=e[75];let ne;e[76]!==n.cost?(ne=n.cost>0?s.jsx("span",{children:St.format(n.cost)}):null,e[76]=n.cost,e[77]=ne):ne=e[77];let re;e[78]!==R||e[79]!==se||e[80]!==ne?(re=s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 typography-micro text-muted-foreground",children:[R,se,ne]}),e[78]=R,e[79]=se,e[80]=ne,e[81]=re):re=e[81];let Y;e[82]!==N||e[83]!==S||e[84]!==l||e[85]!==g||e[86]!==v||e[87]!==h||e[88]!==u||e[89]!==M||e[90]!==A||e[91]!==c?(Y=l?null:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs(z,{variant:"outline",size:"xs",onClick:r=>{r.stopPropagation(),M()},children:[s.jsx(L,{name:"chat-3",className:"size-3.5"}),c("multirun.overview.card.openChat")]}),u?s.jsxs(z,{variant:"outline",size:"xs",onClick:u,children:[s.jsx(L,{name:"check",className:"size-3.5"}),c("multirun.overview.card.keep")]}):null,g&&S?.state==="ready"&&S.stat.files>0?s.jsxs(z,{variant:"ghost",size:"xs",onClick:r=>{r.stopPropagation(),A()},children:[s.jsx(L,{name:"arrow-left-right",className:"size-3.5"}),c("multirun.overview.card.diff")]}):null,s.jsxs("span",{className:"ms-auto inline-flex items-center gap-0.5",children:[s.jsxs(Se,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx(z,{variant:"ghost",size:"icon",className:"size-6 text-muted-foreground hover:text-foreground",disabled:N,"aria-label":c("multirun.overview.card.detach"),onClick:h,children:s.jsx(L,{name:"external-link",className:"size-3.5"})})}),s.jsx(Ce,{side:"top",children:c("multirun.overview.card.detachHint")})]}),s.jsxs(Se,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx(z,{variant:"ghost",size:"icon",className:"size-6 text-muted-foreground hover:text-foreground",disabled:N,"aria-label":c("multirun.overview.card.archive"),onClick:v,children:s.jsx(L,{name:"inbox-archive",className:"size-3.5"})})}),s.jsx(Ce,{side:"top",children:c("multirun.overview.card.archive")})]})]})]}),e[82]=N,e[83]=S,e[84]=l,e[85]=g,e[86]=v,e[87]=h,e[88]=u,e[89]=M,e[90]=A,e[91]=c,e[92]=Y):Y=e[92];let de;return e[93]!==$||e[94]!==X||e[95]!==Q||e[96]!==U||e[97]!==te||e[98]!==re||e[99]!==Y||e[100]!==B||e[101]!==O||e[102]!==F||e[103]!==T?(de=s.jsxs("div",{role:$,tabIndex:U,"aria-checked":B,"aria-label":O,onClick:F,onKeyDown:T,className:X,children:[Q,te,re,Y]}),e[93]=$,e[94]=X,e[95]=Q,e[96]=U,e[97]=te,e[98]=re,e[99]=Y,e[100]=B,e[101]=O,e[102]=F,e[103]=T,e[104]=de):de=e[104],de}const Fe=(a,e)=>{const o=e.find(w=>w.id===a.identity.providerID)?.models.find(w=>w.id===a.identity.modelID)?.name||a.identity.modelID;return a.identity.index&&a.identity.index>1?`${o} #${a.identity.index}`:o};function Rt(a,e){const n=ie.c(9);let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o=new Map,n[0]=o):o=n[0];const[w,x]=I.useState(o);a?.lanes;let b;if(n[1]!==a?.lanes){b=new Map;for(const y of a?.lanes??[]){const l=je(y.identity.runGroup);b.has(l)||b.set(l,y.sessionId)}n[1]=a?.lanes,n[2]=b}else b=n[2];const j=b;let f;n[3]!==j||n[4]!==w||n[5]!==e?(f=()=>{let y=!1;for(const[l,g]of j){const d=e.get(g);!d||w.has(l)||at(g,d.directory).then(u=>{y||!u?.text||x(h=>new Map(h).set(l,u.text))},zt)}return()=>{y=!0}},n[3]=j,n[4]=w,n[5]=e,n[6]=f):f=n[6];let p;return n[7]!==j?(p=[j],n[7]=j,n[8]=p):p=n[8],I.useEffect(f,p),w}function zt(){}function At(a){const e=ie.c(15),{prompt:n,expanded:o,onToggle:w}=a,{t:x}=pe(),b=I.useRef(null),[j,f]=I.useState(!1);let p,y;e[0]!==o||e[1]!==n?(p=()=>{const h=b.current;if(!h||o)return;const v=()=>f(h.scrollWidth>h.clientWidth+1||n.includes(`
|
|
2
|
+
`));v();const N=new ResizeObserver(v);return N.observe(h),()=>N.disconnect()},y=[o,n],e[0]=o,e[1]=n,e[2]=p,e[3]=y):(p=e[2],y=e[3]),I.useLayoutEffect(p,y);const l=j||o;let g;e[4]!==o||e[5]!==n?(g=o?s.jsx("div",{className:"max-h-64 min-w-0 flex-1 overflow-y-auto whitespace-pre-wrap break-words rounded-md bg-[var(--surface-muted)] px-2 py-1.5 typography-meta text-foreground",children:n}):s.jsx("span",{ref:b,className:"min-w-0 flex-1 truncate typography-meta text-muted-foreground",children:n}),e[4]=o,e[5]=n,e[6]=g):g=e[6];let d;e[7]!==l||e[8]!==o||e[9]!==w||e[10]!==x?(d=l?s.jsxs("button",{type:"button",onClick:w,"aria-expanded":o,className:"inline-flex shrink-0 items-center gap-0.5 rounded px-1 typography-meta text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[x(o?"multirun.overview.prompt.collapse":"multirun.overview.prompt.expand"),s.jsx(L,{name:o?"arrow-up-s":"arrow-down-s",className:"size-3.5"})]}):null,e[7]=l,e[8]=o,e[9]=w,e[10]=x,e[11]=d):d=e[11];let u;return e[12]!==g||e[13]!==d?(u=s.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-1",children:[g,d]}),e[12]=g,e[13]=d,e[14]=u):u=e[14],u}function Lt({runKey:a}){const{t:e}=pe(),{run:n,sessionById:o}=lt(a),w=le(t=>t.providers),x=le(t=>t.currentProviderId),b=le(t=>t.currentModelId),j=le(t=>t.currentAgentName),f=Je(t=>t.projects),p=Ye(t=>t.activeSessionIds),y=Ze(t=>t.bySession),l=Xe(t=>t.index.session.unseenCount),g=ae(t=>t.isMobile),[d,u]=I.useState({kind:"idle"}),[h,v]=I.useState(null),[N,M]=I.useState([]),[A,c]=I.useState(j??""),[D,S]=I.useState(null),[q,E]=I.useState(()=>new Set),[C,R]=I.useState(null),$=I.useMemo(()=>new Set(f.map(t=>ze(t.path)).filter(t=>!!t)),[f]),U=I.useMemo(()=>(n?.memberIds??[]).map(t=>{const i=o.get(t),k=ze(i?.directory);return{sessionId:t,session:i,worktreePath:k&&!$.has(k)?k:null}}),[$,n?.memberIds,o]),B=ft(U,p),O=Rt(n,o),F=I.useMemo(()=>new Map(U.map(t=>[t.sessionId,t.worktreePath])),[U]);if(I.useEffect(()=>{if(N.length>0)return;const t=n?.autoFusion,i=t?.providerID??x,k=t?.modelID??b;i&&k&&M([{providerID:i,modelID:k,variant:t?.variant,instanceId:Qe()}])},[b,x,N.length,n?.autoFusion]),!n)return s.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-8 text-center typography-meta text-muted-foreground",children:[e("multirun.overview.missing"),s.jsx(z,{variant:"outline",size:"sm",onClick:()=>ae.getState().closeMainSurfaces(),children:e("header.mainSurface.backToChat")})]});const T=n.lanes.map(t=>t.sessionId),W=T.filter(t=>!p.has(t)&&o.get(t)?.time.idle),ce=T.filter(t=>p.has(t)).length,ue=n.lanes.some(t=>F.get(t.sessionId)),fe=new Map([...n.lanes,...n.fusions].map(t=>[t.sessionId,t])),Z=t=>{const i=fe.get(t);return i?Fe(i,w):""},X=n.autoFusion?.launcherId===et&&n.fusions.length===0,H=t=>{const i=o.get(t);if(!i)return null;const k=y.get(t);return yt({session:i,busy:p.has(t),blocking:k?.permissions.length?"permission":k?.forms.length||k?.pages.length?"question":null,reply:B.get(t)?.reply})},P=new Map;for(const t of T){const i=H(t);i&&P.set(i,(P.get(i)??0)+1)}const G=(P.get("permission")??0)+(P.get("question")??0),K=t=>{const i=o.get(t);ae.getState().closeMainSurfaces(),Re.getState().setCurrentSession(t,i?.directory??null)},Q=t=>{const i=F.get(t);K(t),i&&ae.getState().openContextPanelTab(i,{mode:"diff"})},J=d.kind==="fuse"?W.filter(t=>!d.excluded.has(t)):[],ee=ct(J.map(t=>{const i=B.get(t)?.diff;return{hasWorktree:!!F.get(t),diff:i?.state==="ready"?i.stat:null}})),te=t=>{if(d.kind!=="fuse"||!W.includes(t))return;const i=new Set(d.excluded);i.has(t)?i.delete(t):i.add(t),u({kind:"fuse",excluded:i})},se=async t=>{v("keep");try{const i=Z(t),k=await rt(n,t,o);k.failures.length>0?V.error(k.failures.length===1?e("multirun.overview.keep.partialSingle",{name:i,count:k.failures.length}):e("multirun.overview.keep.partialPlural",{name:i,count:k.failures.length})):V.success(e("multirun.overview.keep.done",{name:i})),K(t)}catch(i){console.error("[MultiRun] Keep failed",i),V.error(e("multirun.overview.keep.failed"))}finally{v(null),u({kind:"idle"})}},ne=async()=>{const t=N[0];if(!(!t||J.length<2)){v("fuse");try{await ut({run:n,sourceIds:J,judge:Ae({providerID:t.providerID,modelID:t.modelID,variant:t.variant,agent:A||void 0}),sessionById:o}),u({kind:"idle"})}catch(i){console.error("[MultiRun] Fusion failed to start",i),V.error(i instanceof dt?e("multirun.fusion.toast.noOutputs"):e("multirun.fusion.toast.failed"))}finally{v(null)}}},re=async(t,i)=>{v("ask");try{await it({run:n,runGroup:i,model:t,sessionById:o})}catch(k){console.error("[MultiRun] Could not add a lane",k),V.error(e("multirun.overview.ask.failed"))}finally{v(null)}},Y=async t=>{if(S(null),!t.trim()||t.trim()===n.title)return;(await st(n,t,o)).length>0&&V.error(e("multirun.overview.rename.failed"))},de=async t=>{const i=o.get(t);if(i){v("member");try{await ot(i,n.title),V.success(e("multirun.overview.card.detachDone",{name:Z(t)}))}catch(k){console.error("[MultiRun] Could not detach a session",k),V.error(e("multirun.overview.card.detachFailed"))}finally{v(null)}}},r=async t=>{v("member");try{(await Re.getState().archiveSessions([t])).failedIds.length>0&&V.error(e("multirun.overview.archive.failed"))}finally{v(null)}},m=async()=>{v("archive");try{(await nt(n)).failedIds.length>0?V.error(e("multirun.overview.archive.failed")):ae.getState().closeMainSurfaces()}finally{v(null)}},oe=t=>{const i=o.get(t.sessionId);if(!i)return null;const k=t.identity.role==="fusion",me=W.includes(t.sessionId);return s.jsx(Mt,{session:i,providerID:t.identity.providerID,modelLabel:Fe(t,w),variantLabel:!k&&n.variants.length>1?je(t.identity.runGroup):null,isFusion:k,busy:p.has(t.sessionId),status:H(t.sessionId)??"notStarted",unread:(l[t.sessionId]??0)>0,summary:B.get(t.sessionId),fuseSource:d.kind==="fuse"&&!k?{checked:me&&!d.excluded.has(t.sessionId),selectable:me}:null,hasWorktree:!!F.get(t.sessionId),onToggleFuseSource:()=>te(t.sessionId),onKeep:ue&&me&&d.kind==="idle"&&(!k||F.get(t.sessionId))?()=>u({kind:"keep",sessionId:t.sessionId}):void 0,onDetach:()=>{de(t.sessionId)},onArchive:()=>{r(t.sessionId)},actionsDisabled:h!==null||d.kind!=="idle",onOpenChat:()=>K(t.sessionId),onOpenDiff:()=>Q(t.sessionId)},t.sessionId)},Ne=t=>{const i=C&&C.runGroup===t?C.model:null;return i?s.jsxs("span",{className:"inline-flex flex-wrap items-center gap-1.5",children:[s.jsxs("span",{className:"inline-flex h-8 items-center gap-1.5 rounded-[9px] border border-border px-2.5 typography-meta text-foreground",children:[s.jsx(be,{providerId:i.providerID,className:"size-3.5"}),i.displayName||i.modelID]}),s.jsx(Me,{appearance:"trigger",providerID:i.providerID,modelID:i.modelID,variant:i.variant,onChange:k=>R({runGroup:t,model:{...i,variant:k}})}),s.jsx(z,{size:"sm",disabled:h!==null,onClick:()=>{R(null),re(i,t)},children:e("multirun.overview.addModel.confirm")}),s.jsx(z,{variant:"ghost",size:"icon",className:"size-8","aria-label":e("multirun.overview.cancel"),onClick:()=>R(null),children:s.jsx(L,{name:"close",className:"size-3.5"})})]}):s.jsx("span",{title:e("multirun.overview.addModel.hint"),children:s.jsx(De,{selectedModels:[],onAdd:k=>R({runGroup:t,model:k}),onRemove:()=>{},maxModels:1,showChips:!1,dropdownSide:"bottom",portal:!0,addButtonClassName:"h-8 min-h-8 px-2.5 typography-meta",addButtonLabel:e(h==="ask"?"multirun.overview.ask.working":"multirun.overview.addModel.action")})})},ke=g?"grid grid-cols-1 gap-2.5":"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-2.5",ve=d.kind==="keep"?d.sessionId:null,xe=n.memberIds.length-1;return s.jsxs("div",{className:"relative flex h-full flex-col",children:[s.jsx(tt,{outerClassName:"flex-1 min-h-0",className:"h-full",children:s.jsxs("div",{className:_("mx-auto w-full max-w-5xl pt-5",g?"px-4":"px-6",g&&d.kind==="fuse"?"pb-56":"pb-32"),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[g?s.jsx(z,{variant:"ghost",size:"icon",className:"-ms-2 shrink-0","aria-label":e("header.mainSurface.backToChat"),onClick:()=>ae.getState().closeMainSurfaces(),children:s.jsx(L,{name:"arrow-left",className:"size-[18px]"})}):null,s.jsxs("div",{className:"min-w-0 flex-1",children:[D!==null?s.jsx("form",{onSubmit:t=>{t.preventDefault(),Y(D)},children:s.jsx("input",{autoFocus:!0,value:D,onChange:t=>S(t.target.value),onBlur:()=>{Y(D)},onKeyDown:t=>{t.key==="Escape"&&S(null)},"aria-label":e("multirun.overview.rename.aria"),className:"w-full rounded-md border border-border bg-transparent px-1.5 py-0.5 typography-heading-lg text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring"})}):s.jsx("button",{type:"button",onClick:()=>S(n.title),dir:"auto",className:"max-w-full truncate oc-ui-start-align typography-heading-lg text-foreground hover:underline decoration-dotted underline-offset-4",title:e("multirun.overview.rename.aria"),children:n.title}),s.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 typography-meta text-muted-foreground",children:[s.jsxs("span",{children:[n.lanes.length===1?e("multirun.overview.meta.runsSingle",{count:n.lanes.length}):e("multirun.overview.meta.runsPlural",{count:n.lanes.length}),n.variants.length>1?` · ${e("multirun.overview.meta.variants",{count:n.variants.length})}`:""]}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(L,{name:"git-branch",className:"size-3.5"}),e(ue?"multirun.overview.meta.worktrees":"multirun.overview.meta.sharedDirectory")]}),bt.map(t=>{const i=P.get(t)??0;return i===0?null:s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(Pe,{status:t}),e(jt[t],{count:i})]},t)}),X&&n.autoFusion?s.jsxs("span",{className:"inline-flex items-center gap-1 text-foreground",children:[s.jsx(ge,{className:"size-3.5 text-[var(--primary-base)]"}),e("multirun.overview.meta.autoFusion",{model:Ae(n.autoFusion).modelName??n.autoFusion.modelID})]}):null]})]}),!g&&n.variants.length===1?Ne(n.variants[0]):null,s.jsxs(z,{variant:"ghost",size:g?"icon":"sm",className:"shrink-0",disabled:h!==null,"aria-label":e("multirun.overview.archive.action"),onClick:()=>{m()},children:[s.jsx(L,{name:"inbox-archive",className:"size-4"}),g?null:e("multirun.overview.archive.action")]})]}),n.fusions.length>0?s.jsxs("section",{className:"mt-6",children:[s.jsxs("h2",{className:"mb-2 inline-flex items-center gap-1.5 typography-ui-label font-semibold text-foreground",children:[s.jsx(ge,{className:"size-4 text-[var(--primary-base)]"}),e("multirun.overview.fusedResult")]}),s.jsx("div",{className:ke,children:n.fusions.map(oe)})]}):null,n.variants.map(t=>{const i=je(t),k=n.lanes.filter(we=>we.identity.runGroup===t),me=O.get(i);return s.jsxs("section",{className:"mt-6",children:[s.jsxs("div",{className:"mb-2 flex min-w-0 items-start gap-2",children:[n.variants.length>1?s.jsx("span",{className:"shrink-0 rounded border border-border px-1.5 typography-meta font-semibold text-foreground",children:i}):null,me?s.jsx(At,{prompt:me,expanded:q.has(i),onToggle:()=>E(we=>{const he=new Set(we);return he.has(i)?he.delete(i):he.add(i),he})}):null,!g&&n.variants.length>1?s.jsx("span",{className:"ms-auto shrink-0",children:Ne(t)}):null]}),s.jsx("div",{className:ke,children:k.map(oe)})]},i)})]})}),s.jsx("div",{className:_("pointer-events-none absolute inset-x-0 bottom-4 flex justify-center",g?"px-3":"px-6"),children:s.jsx("div",{className:"pointer-events-auto flex w-full max-w-4xl flex-wrap items-center gap-2 rounded-xl border border-[var(--interactive-border-hover)] bg-[var(--surface-elevated)] px-3 py-2 shadow-lg",children:ve?s.jsxs(s.Fragment,{children:[s.jsx(L,{name:"git-branch",className:"size-4 text-muted-foreground"}),s.jsx("span",{className:"min-w-0 flex-1 typography-meta text-foreground",children:xe===1?e("multirun.overview.keep.confirmSingle",{name:Z(ve),count:xe}):e("multirun.overview.keep.confirmPlural",{name:Z(ve),count:xe})}),s.jsx(z,{variant:"ghost",size:"sm",disabled:h!==null,onClick:()=>u({kind:"idle"}),children:e("multirun.overview.cancel")}),s.jsx(z,{size:"sm",disabled:h!==null,onClick:()=>{se(ve)},children:e(h==="keep"?"multirun.overview.keep.working":"multirun.overview.keep.confirm")})]}):d.kind==="fuse"?s.jsxs(s.Fragment,{children:[s.jsx(ge,{className:"size-4 text-[var(--primary-base)]"}),s.jsx("span",{className:"typography-meta text-foreground",children:e("multirun.overview.fuse.with")}),s.jsx(De,{selectedModels:N,onAdd:t=>M([t]),onUpdate:(t,i)=>M([i]),onRemove:()=>M([]),maxModels:1,showChips:!1,dropdownSide:"top",addButtonLabel:N[0]?N[0].displayName||N[0].modelID:e("multirun.fusion.model.placeholder"),triggerIcon:N[0]?s.jsx(be,{providerId:N[0].providerID,className:"me-1 size-3.5"}):void 0}),N[0]?s.jsx(Me,{appearance:"trigger",providerID:N[0].providerID,modelID:N[0].modelID,variant:N[0].variant,onChange:t=>M(i=>i.map(k=>({...k,variant:t})))}):null,s.jsx(pt,{value:A,onChange:c,className:"w-fit"}),s.jsx("span",{className:"typography-micro text-muted-foreground",children:e(ee==="code"?"multirun.overview.fuse.modeCode":"multirun.overview.fuse.modeAnswers")}),s.jsx("span",{className:"flex-1"}),s.jsx("span",{className:"typography-micro text-muted-foreground",children:e("multirun.overview.fuse.selected",{count:J.length,total:W.length})}),s.jsx(z,{variant:"ghost",size:"sm",disabled:h!==null,onClick:()=>u({kind:"idle"}),children:e("multirun.overview.cancel")}),s.jsx(z,{size:"sm",disabled:h!==null||J.length<2||N.length===0,onClick:()=>{ne()},children:e(h==="fuse"?"multirun.fusion.actions.starting":"multirun.fusion.actions.start")})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:_("min-w-0 flex-1 truncate typography-meta",G>0?"text-foreground":"text-muted-foreground"),children:G>0?e("multirun.overview.bar.waiting",{count:G}):ce>0?e("multirun.overview.meta.progress",{done:T.length-ce,total:T.length}):e("multirun.overview.bar.hint")}),s.jsxs(z,{size:"sm",disabled:W.length<2||h!==null,onClick:()=>u({kind:"fuse",excluded:new Set}),children:[s.jsx(ge,{className:"size-4"}),e("multirun.overview.bar.fuse")]})]})})})]})}function dn(){const a=ie.c(3),e=ae(Ft);if(!e)return null;let n;a[0]===Symbol.for("react.memo_cache_sentinel")?(n=_("absolute inset-0 z-10 bg-background"),a[0]=n):n=a[0];let o;return a[1]!==e?(o=s.jsx("div",{className:n,children:s.jsx(Lt,{runKey:e},e)}),a[1]=e,a[2]=o):o=a[2],o}function Ft(a){return a.runOverviewKey}export{dn as RunOverview};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as m,j as s,f as Pe}from"./vendor-react-BUCujlKS.js";import{u as ze,H as Ue,cE as Ls,cF as qe,a1 as Ce,cG as $s,A as de,cH as es,cc as ve,ca as Ne,c9 as ue,cb as Se,c3 as q,B as me,y as bs,I as D,N as fe,be as Os,C as Oe,cI as zs,cJ as Bs,cK as Vs,cL as Hs,cM as Ws,cN as Ks,cO as qs,cP as Ys,V as ss,W as ts,X as ns,k as Us,t as Gs,q as Qs,F as Xs,l as Zs,cQ as Js,a5 as os,c2 as _s,aG as et,U as st,cR as tt,cS as nt,cT as ot,cU as it,cV as is,G as rt,z as at,c4 as lt,cW as ct,cX as dt,cY as ut,c8 as mt}from"./useAppFontEffects-DAUhSLPu.js";import{u as Re,e as ht,l as pt,a6 as Be,ao as xt}from"./katex.min-u4DtE8E5.js";import{f as ft,a as gt,u as rs,s as yt,d as bt,b as jt,r as Tt,S as kt}from"./scheduledTasksApi-FZ9stPNl.js";import{d as js}from"./vendor-cron-parser-CjvYVigk.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CPKyhvxM.js";import"./vendor-floating-ui-utils-D6FqdtJt.js";import"./vendor-floating-ui-dom-BTvzWks8.js";import"./vendor-floating-ui-core-PuGzNPnN.js";import"./vendor-floating-ui-react-dom-DxYCWdHj.js";import"./vendor-use-sync-external-store-D6wYuSt-.js";import"./vendor-zod-DDir2TeQ.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-BAGL70zf.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-dnd-kit-core-BZknOX2w.js";import"./vendor-dnd-kit-utilities-B_MdXhJC.js";import"./vendor-dnd-kit-accessibility-BHxJPORy.js";import"./vendor-dnd-kit-sortable-CsEagZ81.js";import"./vendor-tanstack-react-virtual-Bmi0tTrf.js";import"./vendor-tanstack-virtual-core-CdGDGrnp.js";import"./vendor-framer-motion-DxDVhOLc.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-codemirror-commands-dar6chwA.js";import"./vendor-codemirror-state-Dek9sMtw.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-B66jUSmE.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-DyL0aCoH.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-Cem6LjJ8.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-CIqXJolH.js";import"./vendor-codemirror-lang-json-C9rLLO0q.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-9qjxcVkg.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-D7VQUxeE.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-Cikh4w2I.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-KulAIuMz.js";import"./vendor-codemirror-lang-python-DVl8-2Op.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-sonner-DFyL3AvE.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-cmdk-DgLInKvT.js";import"./vendor-radix-ui-react-dialog-B94Bt2qq.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-DcAh5WdT.js";import"./vendor-radix-ui-react-context-Czxm7Z62.js";import"./vendor-radix-ui-react-id-f5BLKEVw.js";import"./vendor-radix-ui-react-use-layout-effect-D_3IhJdJ.js";import"./vendor-radix-ui-react-use-controllable-state-BFT5YmkA.js";import"./vendor-radix-ui-react-dismissable-layer-D7kXcwgJ.js";import"./vendor-radix-ui-react-primitive-DhVoX9SD.js";import"./vendor-radix-ui-react-slot-BQgQOasS.js";import"./vendor-radix-ui-react-use-callback-ref-BZPnuXAC.js";import"./vendor-radix-ui-react-use-escape-keydown-oph88g-F.js";import"./vendor-radix-ui-react-focus-scope-CiaxW4dD.js";import"./vendor-radix-ui-react-portal-BMJYHWck.js";import"./vendor-radix-ui-react-presence-CNxf-uq4.js";import"./vendor-radix-ui-react-focus-guards-B6qJXYua.js";import"./vendor-react-remove-scroll-DO7dCTnK.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-BcFYyj3E.js";import"./vendor-react-style-singleton-q6EMHnwf.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-zDC0RhA3.js";import"./vendor-use-callback-ref-D3RC8gqK.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-D2O6oUGf.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-opencode-client-h8RufjAw.js";import"./vendor-luxon-BZ0puJYg.js";function Ts(n){if(!n||!n.trim())return{valid:!1,error:"required"};try{return js.CronExpressionParser.parse(n),{valid:!0}}catch(e){return{valid:!1,error:e instanceof Error?e.message:"Invalid cron expression"}}}function wt(n,e,i=4){try{const a=e?{tz:e,currentDate:new Date}:{currentDate:new Date},u=js.CronExpressionParser.parse(n,a),o=[];for(let h=0;h<i;h+=1){const g=u.next();g&&o.push(g.toDate())}return o}catch{return[]}}const vt=[{expression:"*/5 * * * *",labelKey:"sessions.scheduledTasks.editor.cronExpression.examples.every5min"},{expression:"0 * * * *",labelKey:"sessions.scheduledTasks.editor.cronExpression.examples.everyHour"},{expression:"0 9 * * 1",labelKey:"sessions.scheduledTasks.editor.cronExpression.examples.monday9am"},{expression:"0 9,17 * * *",labelKey:"sessions.scheduledTasks.editor.cronExpression.examples.9am5pm"},{expression:"0 0 1 * *",labelKey:"sessions.scheduledTasks.editor.cronExpression.examples.firstOfMonth"}],Nt={"Europe/Kiev":"Europe/Kyiv","Asia/Calcutta":"Asia/Kolkata","Asia/Saigon":"Asia/Ho_Chi_Minh","Asia/Rangoon":"Asia/Yangon","Asia/Katmandu":"Asia/Kathmandu","America/Godthab":"America/Nuuk","Atlantic/Faeroe":"Atlantic/Faroe","Pacific/Enderbury":"Pacific/Kanton"},Fe=n=>Nt[n]??n,ks=[0,1,2,3,4,5,6],as="flex h-6 w-6 cursor-pointer items-center justify-center text-foreground transition-none outline-none focus:outline-none flex-shrink-0",Ye=typeof Intl<"u"&&typeof Intl.supportedValuesOf=="function"?[...new Set(Intl.supportedValuesOf("timeZone").map(Fe))]:["UTC","Europe/Kyiv","Europe/London","Europe/Berlin","America/New_York","America/Los_Angeles","Asia/Tokyo"],ls=()=>{const n=new Date,e=n.getFullYear(),i=String(n.getMonth()+1).padStart(2,"0"),a=String(n.getDate()).padStart(2,"0");return`${e}-${i}-${a}`},He=n=>{const e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(n);if(!e)return null;const i=Number(e[1]),a=Number(e[2]),u=Number(e[3]),o=new Date(i,a-1,u);return Number.isNaN(o.getTime())||o.getFullYear()!==i||o.getMonth()!==a-1||o.getDate()!==u?null:o},cs=n=>{const e=n.getFullYear(),i=String(n.getMonth()+1).padStart(2,"0"),a=String(n.getDate()).padStart(2,"0");return`${e}-${i}-${a}`},St=(n,e,i)=>{const a=He(n);return a?new Intl.DateTimeFormat(i,{month:"short",day:"numeric",year:"numeric"}).format(a):e},ds=(n,e)=>new Date(n.getFullYear(),n.getMonth()+e,1),Dt=(n,e)=>{const i=n.getFullYear(),a=n.getMonth(),h=(new Date(i,a,1).getDay()-e+7)%7,g=new Date(i,a+1,0).getDate(),T=new Date(i,a,0).getDate(),p=[];for(let A=0;A<42;A+=1){const d=A-h+1;if(d<=0){const j=T+d;p.push({date:new Date(i,a-1,j),inCurrentMonth:!1});continue}if(d>g){p.push({date:new Date(i,a+1,d-g),inCurrentMonth:!1});continue}p.push({date:new Date(i,a,d),inCurrentMonth:!0})}return p},At=n=>{const e=/^([01]\d|2[0-3]):([0-5]\d)$/.exec(n);if(!e)return{hour24:"00",hour12:"12",minute:"00",meridiem:"AM"};const i=Number(e[1]),a=e[2],u=i>=12?"PM":"AM",o=i%12===0?12:i%12;return{hour24:String(i).padStart(2,"0"),hour12:String(o).padStart(2,"0"),minute:a,meridiem:u}},Ee=(n,e,i)=>{const a=Number(n),u=Number(e),o=Number.isFinite(a)?Math.min(12,Math.max(1,a)):12,h=Number.isFinite(u)?Math.min(59,Math.max(0,u)):0;let g=o%12;return i==="PM"&&(g+=12),`${String(g).padStart(2,"0")}:${String(h).padStart(2,"0")}`},$e=(n,e)=>{const{max:i,min:a=0,loop:u=!1}=e;let o=Number.parseInt(n,10);return Number.isFinite(o)?(u?(o>i&&(o=a),o<a&&(o=i)):(o>i&&(o=i),o<a&&(o=a)),String(o).padStart(2,"0")):"00"},us=n=>/^(0[1-9]|1[0-2])$/.test(n)?n:$e(n,{min:1,max:12}),Ve=n=>/^[0-5][0-9]$/.test(n)?n:$e(n,{max:59}),Ct=(n,e)=>$e(String(Number.parseInt(n,10)+e),{min:1,max:12,loop:!0}),ms=(n,e)=>$e(String(Number.parseInt(n,10)+e),{min:0,max:59,loop:!0}),It=n=>{try{const e=Intl.Locale;if(typeof e!="function")return 1;const a=new e(n).weekInfo?.firstDay;return typeof a!="number"?1:a%7}catch{return 1}},Mt=n=>{try{const e=new Intl.DateTimeFormat(n,{hour:"numeric"}).resolvedOptions();return typeof e.hour12=="boolean"?!e.hour12:e.hourCycle==="h23"||e.hourCycle==="h24"}catch{return!0}},Et=n=>{const e=new Intl.DateTimeFormat(n,{weekday:"short"}),i=new Date(2023,0,1);return ks.map(a=>e.format(new Date(i.getFullYear(),i.getMonth(),i.getDate()+a)))},Ft=(n,e)=>[...n.slice(e),...n.slice(0,e)],se=n=>{const e=Pe.c(6),{htmlFor:i,required:a,children:u}=n;let o;e[0]!==a?(o=a&&s.jsx("span",{className:"ms-0.5 text-destructive",children:"*"}),e[0]=a,e[1]=o):o=e[1];let h;return e[2]!==u||e[3]!==i||e[4]!==o?(h=s.jsx("div",{className:"flex items-center gap-1.5",children:s.jsxs("label",{htmlFor:i,className:"typography-meta font-medium text-foreground",children:[u,o]})}),e[2]=u,e[3]=i,e[4]=o,e[5]=h):h=e[5],h},hs=n=>{const e=Pe.c(84),{value:i,onChange:a,use24Hour:u,hourAriaLabel:o,minuteAriaLabel:h,periodAriaLabel:g,amLabel:T,pmLabel:p}=n;let A;e[0]!==i?(A=At(i),e[0]=i,e[1]=A):A=e[1];const d=A,j=m.useRef(null),S=m.useRef(null),[O,z]=m.useState(null),[P,W]=m.useState(null),B=m.useRef(null),V=m.useRef(null);let C;e[2]===Symbol.for("react.memo_cache_sentinel")?(C=x=>{B.current=x,z(x)},e[2]=C):C=e[2];const E=C;let F;e[3]===Symbol.for("react.memo_cache_sentinel")?(F=x=>{V.current=x,W(x)},e[3]=F):F=e[3];const $=F,N=Bt,ee=Vt,Y=Ht;let c;e[4]!==a||e[5]!==d.meridiem||e[6]!==d.minute||e[7]!==u?(c=x=>{const ce=x.replace(/\D/g,"").slice(0,2);E(ce),ce.length===2&&(a(u?Y(N(ce),d.minute):Ee(us(ce),d.minute,d.meridiem)),E(null),S.current?.focus())},e[4]=a,e[5]=d.meridiem,e[6]=d.minute,e[7]=u,e[8]=c):c=e[8];const k=c;let U;e[9]!==a||e[10]!==d.meridiem||e[11]!==d.minute||e[12]!==u?(U=()=>{const x=B.current;if(x!==null&&(E(null),x.length!==0)){if(u){a(Y(N(x.padStart(2,"0")),d.minute));return}a(Ee(us(x.padStart(2,"0")),d.minute,d.meridiem))}},e[9]=a,e[10]=d.meridiem,e[11]=d.minute,e[12]=u,e[13]=U):U=e[13];const Q=U;let H;e[14]!==a||e[15]!==d.hour12||e[16]!==d.hour24||e[17]!==d.meridiem||e[18]!==u?(H=x=>{const ce=x.replace(/\D/g,"").slice(0,2);$(ce),ce.length===2&&(a(u?Y(d.hour24,Ve(ce)):Ee(d.hour12,Ve(ce),d.meridiem)),$(null))},e[14]=a,e[15]=d.hour12,e[16]=d.hour24,e[17]=d.meridiem,e[18]=u,e[19]=H):H=e[19];const K=H;let Z;e[20]!==a||e[21]!==d.hour12||e[22]!==d.hour24||e[23]!==d.meridiem||e[24]!==u?(Z=()=>{const x=V.current;x!==null&&($(null),x.length!==0&&a(u?Y(d.hour24,Ve(x.padStart(2,"0"))):Ee(d.hour12,Ve(x.padStart(2,"0")),d.meridiem)))},e[20]=a,e[21]=d.hour12,e[22]=d.hour24,e[23]=d.meridiem,e[24]=u,e[25]=Z):Z=e[25];const w=Z;let R;e[26]!==a||e[27]!==d.hour12||e[28]!==d.hour24||e[29]!==d.meridiem||e[30]!==d.minute||e[31]!==u?(R=x=>a(u?Y(ee(d.hour24,x),d.minute):Ee(Ct(d.hour12,x),d.minute,d.meridiem)),e[26]=a,e[27]=d.hour12,e[28]=d.hour24,e[29]=d.meridiem,e[30]=d.minute,e[31]=u,e[32]=R):R=e[32];const re=R;let ae;e[33]!==a||e[34]!==d.hour12||e[35]!==d.hour24||e[36]!==d.meridiem||e[37]!==d.minute||e[38]!==u?(ae=x=>a(u?Y(d.hour24,ms(d.minute,x)):Ee(d.hour12,ms(d.minute,x),d.meridiem)),e[33]=a,e[34]=d.hour12,e[35]=d.hour24,e[36]=d.meridiem,e[37]=d.minute,e[38]=u,e[39]=ae):ae=e[39];const oe=ae;let r;e[40]!==a||e[41]!==d.hour12||e[42]!==d.meridiem||e[43]!==d.minute?(r=x=>{x!==d.meridiem&&a(Ee(d.hour12,d.minute,x))},e[40]=a,e[41]=d.hour12,e[42]=d.meridiem,e[43]=d.minute,e[44]=r):r=e[44];const y=r;let b;e[45]!==Q||e[46]!==re?(b=x=>{if(x.key==="ArrowRight"){x.preventDefault(),Q(),S.current?.focus();return}(x.key==="ArrowUp"||x.key==="ArrowDown")&&(x.preventDefault(),E(null),re(x.key==="ArrowUp"?1:-1))},e[45]=Q,e[46]=re,e[47]=b):b=e[47];const v=b;let G;e[48]!==w||e[49]!==oe?(G=x=>{if(x.key==="ArrowLeft"&&(x.currentTarget.selectionStart??0)===0){x.preventDefault(),w(),j.current?.focus();return}(x.key==="ArrowUp"||x.key==="ArrowDown")&&(x.preventDefault(),$(null),oe(x.key==="ArrowUp"?1:-1))},e[48]=w,e[49]=oe,e[50]=G):G=e[50];const J=G,le=u?"px-2":"ps-2 pe-1";let te;e[51]!==le?(te=fe("oc-surface-elevated oc-raised oc-field inline-flex h-8 w-fit items-center gap-1 rounded-md bg-surface-elevated",le),e[51]=le,e[52]=te):te=e[52];const Ie=O??(u?d.hour24:d.hour12);let _;e[53]!==k?(_=x=>k(x.target.value),e[53]=k,e[54]=_):_=e[54];let De;e[55]===Symbol.for("react.memo_cache_sentinel")?(De=()=>E(""),e[55]=De):De=e[55];let he;e[56]!==Q||e[57]!==o||e[58]!==v||e[59]!==Ie||e[60]!==_?(he=s.jsx("input",{ref:j,inputMode:"numeric",value:Ie,onChange:_,onKeyDown:v,onFocus:De,onBlur:Q,maxLength:2,"aria-label":o,className:"h-7 w-7 shrink-0 rounded-sm bg-transparent text-center font-mono text-sm tabular-nums text-foreground outline-none caret-transparent focus:bg-interactive-hover"}),e[56]=Q,e[57]=o,e[58]=v,e[59]=Ie,e[60]=_,e[61]=he):he=e[61];let Ae;e[62]===Symbol.for("react.memo_cache_sentinel")?(Ae=s.jsx("span",{className:"font-mono text-sm text-muted-foreground",children:":"}),e[62]=Ae):Ae=e[62];const Le=P??d.minute;let ge;e[63]!==K?(ge=x=>K(x.target.value),e[63]=K,e[64]=ge):ge=e[64];let Me;e[65]===Symbol.for("react.memo_cache_sentinel")?(Me=()=>$(""),e[65]=Me):Me=e[65];let pe;e[66]!==w||e[67]!==h||e[68]!==J||e[69]!==Le||e[70]!==ge?(pe=s.jsx("input",{ref:S,inputMode:"numeric",value:Le,onChange:ge,onKeyDown:J,onFocus:Me,onBlur:w,maxLength:2,"aria-label":h,className:"h-7 w-7 shrink-0 rounded-sm bg-transparent text-center font-mono text-sm tabular-nums text-foreground outline-none caret-transparent focus:bg-interactive-hover"}),e[66]=w,e[67]=h,e[68]=J,e[69]=Le,e[70]=ge,e[71]=pe):pe=e[71];let xe;e[72]!==T||e[73]!==d.meridiem||e[74]!==g||e[75]!==p||e[76]!==y||e[77]!==u?(xe=u?null:s.jsxs(ve,{value:d.meridiem,onValueChange:x=>y(x),children:[s.jsx(Ne,{"aria-label":g,className:"ms-1 h-7 w-fit bg-transparent dark:bg-transparent ps-2 pe-1 shadow-none hover:bg-interactive-hover",children:s.jsx(ue,{})}),s.jsxs(Se,{children:[s.jsx(q,{value:"AM",children:T}),s.jsx(q,{value:"PM",children:p})]})]}),e[72]=T,e[73]=d.meridiem,e[74]=g,e[75]=p,e[76]=y,e[77]=u,e[78]=xe):xe=e[78];let ye;return e[79]!==te||e[80]!==he||e[81]!==pe||e[82]!==xe?(ye=s.jsxs("div",{className:te,children:[he,Ae,pe,xe]}),e[79]=te,e[80]=he,e[81]=pe,e[82]=xe,e[83]=ye):ye=e[83],ye},ps=n=>new Date(n.getFullYear(),n.getMonth(),1),Rt=()=>{const n=new Date;return new Date(n.getFullYear(),n.getMonth(),n.getDate())},xs=(n,e)=>n.getFullYear()===e.getFullYear()&&n.getMonth()===e.getMonth()&&n.getDate()===e.getDate(),Pt=n=>{if(!n)return["09:00"];const i=(Array.isArray(n.schedule.times)?n.schedule.times:n.schedule.time?[n.schedule.time]:[]).filter(u=>typeof u=="string"&&/^([01]\d|2[0-3]):([0-5]\d)$/.test(u)).map(u=>u.trim()),a=Array.from(new Set(i)).sort((u,o)=>u.localeCompare(o));return a.length>0?a:["09:00"]},fs=(n,e)=>{const i=Fe(Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC");return n?{id:n.id,sessionMode:n.targetSessionId?"existing":"new",targetSessionId:n.targetSessionId||"",name:n.name,enabled:n.enabled,schedule:{kind:n.schedule.kind==="cron"?"cron":n.schedule.kind==="once"?"once":n.schedule.kind==="weekly"?"weekly":"daily",times:Pt(n),onceDate:typeof n.schedule.date=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(n.schedule.date)?n.schedule.date:ls(),onceTime:typeof n.schedule.time=="string"&&/^([01]\d|2[0-3]):([0-5]\d)$/.test(n.schedule.time)?n.schedule.time:"09:00",weekdays:Array.isArray(n.schedule.weekdays)?n.schedule.weekdays:[1],timezone:Fe(n.schedule.timezone||i),cronExpression:n.schedule.kind==="cron"&&typeof n.schedule.cron=="string"?n.schedule.cron:""},execution:{prompt:n.execution.prompt,providerID:n.execution.providerID||e.providerID,modelID:n.execution.modelID||e.modelID,variant:n.execution.variant||"",agent:n.execution.agent||"",useDefaults:n.execution.useDefaults===!0,goalEnabled:n.execution.goalEnabled===!0,goalTokenBudget:typeof n.execution.goalTokenBudget=="number"&&n.execution.goalTokenBudget>0?n.execution.goalTokenBudget:null,permissionAutoAccept:n.execution.permissionAutoAccept===!0},state:n.state}:{name:"",sessionMode:"new",targetSessionId:"",enabled:!0,schedule:{kind:"daily",times:["09:00"],onceDate:ls(),onceTime:"09:00",weekdays:[1],timezone:i,cronExpression:""},execution:{prompt:"",providerID:e.providerID,modelID:e.modelID,variant:e.variant,agent:e.agent,useDefaults:!1,goalEnabled:!1,goalTokenBudget:null,permissionAutoAccept:!1}}},Lt=(n,e)=>{if(n.sessionMode==="existing"&&!n.targetSessionId)return e("sessions.scheduledTasks.editor.targetRequired");if(!n.name.trim())return e("sessions.scheduledTasks.editor.validation.taskNameRequired");if(!n.execution.prompt.trim())return e("sessions.scheduledTasks.editor.validation.promptRequired");if(!n.execution.useDefaults&&(!n.execution.providerID.trim()||!n.execution.modelID.trim()))return e("sessions.scheduledTasks.editor.validation.modelRequired");if(n.schedule.kind==="once"){if(!/^\d{4}-\d{2}-\d{2}$/.test(n.schedule.onceDate))return e("sessions.scheduledTasks.editor.validation.dateFormat");if(!/^([01]\d|2[0-3]):([0-5]\d)$/.test(n.schedule.onceTime))return e("sessions.scheduledTasks.editor.validation.timeFormat")}else if(n.schedule.kind==="cron"){if(!n.schedule.cronExpression.trim())return e("sessions.scheduledTasks.editor.validation.cronRequired");if(!Ts(n.schedule.cronExpression).valid)return e("sessions.scheduledTasks.editor.validation.cronInvalid")}else if(n.schedule.times.filter(a=>/^([01]\d|2[0-3]):([0-5]\d)$/.test(a)).length===0)return e("sessions.scheduledTasks.editor.validation.atLeastOneTime");return n.schedule.kind==="weekly"&&n.schedule.weekdays.length===0?e("sessions.scheduledTasks.editor.validation.atLeastOneWeekday"):n.schedule.timezone.trim()?null:e("sessions.scheduledTasks.editor.validation.timezoneRequired")},$t=n=>{const e=n.filter(i=>/^([01]\d|2[0-3]):([0-5]\d)$/.test(i));return Array.from(new Set(e)).sort((i,a)=>i.localeCompare(a))},Ot=n=>{const e=Pe.c(64),{draft:i,setDraft:a,locale:u,t:o}=n,h=i.schedule.cronExpression;let g;e[0]!==h?(g=h.trim()?Ts(h):null,e[0]=h,e[1]=g):g=e[1];const T=g;let p;e:{if(!T?.valid||!h.trim()){let R;e[2]===Symbol.for("react.memo_cache_sentinel")?(R=[],e[2]=R):R=e[2],p=R;break e}let w;e[3]!==h||e[4]!==i.schedule.timezone?(w=wt(h,i.schedule.timezone),e[3]=h,e[4]=i.schedule.timezone,e[5]=w):w=e[5],p=w}const A=p;let d;e[6]!==i.schedule.timezone||e[7]!==u?(d=w=>new Intl.DateTimeFormat(u,{timeZone:i.schedule.timezone,month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(w),e[6]=i.schedule.timezone,e[7]=u,e[8]=d):d=e[8];const j=d;let S;e[9]!==o?(S=o("sessions.scheduledTasks.editor.cronExpression.label"),e[9]=o,e[10]=S):S=e[10];let O;e[11]!==S?(O=s.jsx(se,{htmlFor:"sched-cron",required:!0,children:S}),e[11]=S,e[12]=O):O=e[12];let z;e[13]!==a?(z=w=>a(R=>({...R,schedule:{...R.schedule,cronExpression:w.target.value}})),e[13]=a,e[14]=z):z=e[14];let P;e[15]!==o?(P=o("sessions.scheduledTasks.editor.cronExpression.placeholder"),e[15]=o,e[16]=P):P=e[16];let W;e[17]!==h||e[18]!==z||e[19]!==P?(W=s.jsx(bs,{id:"sched-cron",value:h,onChange:z,placeholder:P,className:"w-full max-w-xs font-mono"}),e[17]=h,e[18]=z,e[19]=P,e[20]=W):W=e[20];let B;e[21]!==h||e[22]!==T||e[23]!==o?(B=T&&!T.valid&&h.trim()?s.jsx("span",{className:"typography-micro text-destructive",children:o("sessions.scheduledTasks.editor.validation.cronInvalid")}):null,e[21]=h,e[22]=T,e[23]=o,e[24]=B):B=e[24];let V;e[25]!==O||e[26]!==W||e[27]!==B?(V=s.jsxs("div",{className:"flex flex-col gap-1",children:[O,W,B]}),e[25]=O,e[26]=W,e[27]=B,e[28]=V):V=e[28];let C;e[29]!==j||e[30]!==A||e[31]!==o?(C=A.length>0?s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"typography-meta text-muted-foreground",children:o("sessions.scheduledTasks.editor.cronExpression.nextRuns")}),s.jsx("span",{className:"typography-micro text-foreground",children:A.map(j).join(", ")})]}):null,e[29]=j,e[30]=A,e[31]=o,e[32]=C):C=e[32];let E;e[33]!==o?(E=o("sessions.scheduledTasks.editor.cronExpression.examples"),e[33]=o,e[34]=E):E=e[34];let F;e[35]!==E?(F=s.jsx("span",{className:"typography-meta text-muted-foreground",children:E}),e[35]=E,e[36]=F):F=e[36];let $;e[37]!==a||e[38]!==o?($=vt.map(w=>s.jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2 py-1 typography-micro text-foreground hover:bg-interactive-hover",onClick:()=>a(R=>({...R,schedule:{...R.schedule,cronExpression:w.expression}})),children:[s.jsx("span",{className:"font-mono",children:w.expression}),s.jsx("span",{className:"text-muted-foreground",children:o(w.labelKey)})]},w.expression)),e[37]=a,e[38]=o,e[39]=$):$=e[39];let N;e[40]!==$?(N=s.jsx("div",{className:"flex flex-wrap gap-1.5",children:$}),e[40]=$,e[41]=N):N=e[41];let ee;e[42]!==F||e[43]!==N?(ee=s.jsxs("div",{className:"flex flex-col gap-1",children:[F,N]}),e[42]=F,e[43]=N,e[44]=ee):ee=e[44];let Y;e[45]!==o?(Y=o("sessions.scheduledTasks.editor.timezone.label"),e[45]=o,e[46]=Y):Y=e[46];let c;e[47]!==Y?(c=s.jsx(se,{children:Y}),e[47]=Y,e[48]=c):c=e[48];let k;e[49]!==a?(k=w=>{a(R=>({...R,schedule:{...R.schedule,timezone:w}}))},e[49]=a,e[50]=k):k=e[50];let U;e[51]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx(Ne,{className:"w-fit max-w-full",children:s.jsx(ue,{})}),e[51]=U):U=e[51];let Q;e[52]===Symbol.for("react.memo_cache_sentinel")?(Q=s.jsx(Se,{children:Ye.map(Wt)}),e[52]=Q):Q=e[52];let H;e[53]!==i.schedule.timezone||e[54]!==k?(H=s.jsxs(ve,{value:i.schedule.timezone,onValueChange:k,children:[U,Q]}),e[53]=i.schedule.timezone,e[54]=k,e[55]=H):H=e[55];let K;e[56]!==c||e[57]!==H?(K=s.jsxs("div",{className:"flex flex-col gap-1",children:[c,H]}),e[56]=c,e[57]=H,e[58]=K):K=e[58];let Z;return e[59]!==V||e[60]!==C||e[61]!==ee||e[62]!==K?(Z=s.jsxs("div",{className:"flex flex-col gap-3",children:[V,C,ee,K]}),e[59]=V,e[60]=C,e[61]=ee,e[62]=K,e[63]=Z):Z=e[63],Z};function zt(n){const{open:e,task:i,onOpenChange:a,onSave:u}=n,{t:o,locale:h}=ze(),g=Ue(t=>t.activeSessions),T=Ls(),p=m.useMemo(()=>{const t=new Map(g.map(l=>[l.id,l]));for(const l of T)t.set(l.id,l);return[...t.values()].filter(l=>!l.time?.archived)},[g,T]),A=m.useMemo(()=>p.map(t=>`${t.id}:${t.directory??""}`).sort().join(`
|
|
1
|
+
import{r as m,j as s,f as Pe}from"./vendor-react-BUCujlKS.js";import{u as ze,H as Ue,cF as Ls,cG as qe,a1 as Ce,cH as $s,A as de,cI as es,cd as ve,cb as Ne,ca as ue,cc as Se,c4 as q,B as me,y as bs,I as D,N as fe,be as Os,C as Oe,cJ as zs,cK as Bs,cL as Vs,cM as Hs,cN as Ws,cO as Ks,cP as qs,cQ as Ys,V as ss,W as ts,X as ns,k as Us,t as Gs,q as Qs,F as Xs,l as Zs,cR as Js,a5 as os,c3 as _s,aG as et,U as st,cS as tt,cT as nt,cU as ot,cV as it,cW as is,G as rt,z as at,c5 as lt,cX as ct,cY as dt,cZ as ut,c9 as mt}from"./useAppFontEffects-Dm6zEvrf.js";import{u as Re,e as ht,l as pt,a6 as Be,ao as xt}from"./katex.min-F4TD1ekM.js";import{f as ft,a as gt,u as rs,s as yt,d as bt,b as jt,r as Tt,S as kt}from"./scheduledTasksApi-CJBNpwgy.js";import{d as js}from"./vendor-cron-parser-CjvYVigk.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CPKyhvxM.js";import"./vendor-floating-ui-utils-D6FqdtJt.js";import"./vendor-floating-ui-dom-BTvzWks8.js";import"./vendor-floating-ui-core-PuGzNPnN.js";import"./vendor-floating-ui-react-dom-DxYCWdHj.js";import"./vendor-use-sync-external-store-D6wYuSt-.js";import"./vendor-zod-DDir2TeQ.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-BAGL70zf.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-dnd-kit-core-BZknOX2w.js";import"./vendor-dnd-kit-utilities-B_MdXhJC.js";import"./vendor-dnd-kit-accessibility-BHxJPORy.js";import"./vendor-dnd-kit-sortable-CsEagZ81.js";import"./vendor-tanstack-react-virtual-Bmi0tTrf.js";import"./vendor-tanstack-virtual-core-CdGDGrnp.js";import"./vendor-framer-motion-DxDVhOLc.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-codemirror-commands-dar6chwA.js";import"./vendor-codemirror-state-Dek9sMtw.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-B66jUSmE.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-DyL0aCoH.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-Cem6LjJ8.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-CIqXJolH.js";import"./vendor-codemirror-lang-json-C9rLLO0q.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-9qjxcVkg.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-D7VQUxeE.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-Cikh4w2I.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-VzNDjH03.js";import"./vendor-codemirror-lang-python-DVl8-2Op.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-sonner-DFyL3AvE.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-cmdk-DgLInKvT.js";import"./vendor-radix-ui-react-dialog-B94Bt2qq.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-DcAh5WdT.js";import"./vendor-radix-ui-react-context-Czxm7Z62.js";import"./vendor-radix-ui-react-id-f5BLKEVw.js";import"./vendor-radix-ui-react-use-layout-effect-D_3IhJdJ.js";import"./vendor-radix-ui-react-use-controllable-state-BFT5YmkA.js";import"./vendor-radix-ui-react-dismissable-layer-D7kXcwgJ.js";import"./vendor-radix-ui-react-primitive-DhVoX9SD.js";import"./vendor-radix-ui-react-slot-BQgQOasS.js";import"./vendor-radix-ui-react-use-callback-ref-BZPnuXAC.js";import"./vendor-radix-ui-react-use-escape-keydown-oph88g-F.js";import"./vendor-radix-ui-react-focus-scope-CiaxW4dD.js";import"./vendor-radix-ui-react-portal-BMJYHWck.js";import"./vendor-radix-ui-react-presence-CNxf-uq4.js";import"./vendor-radix-ui-react-focus-guards-B6qJXYua.js";import"./vendor-react-remove-scroll-DO7dCTnK.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-BcFYyj3E.js";import"./vendor-react-style-singleton-q6EMHnwf.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-zDC0RhA3.js";import"./vendor-use-callback-ref-D3RC8gqK.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-D2O6oUGf.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-opencode-client-h8RufjAw.js";import"./vendor-luxon-BZ0puJYg.js";function Ts(n){if(!n||!n.trim())return{valid:!1,error:"required"};try{return js.CronExpressionParser.parse(n),{valid:!0}}catch(e){return{valid:!1,error:e instanceof Error?e.message:"Invalid cron expression"}}}function wt(n,e,i=4){try{const a=e?{tz:e,currentDate:new Date}:{currentDate:new Date},u=js.CronExpressionParser.parse(n,a),o=[];for(let h=0;h<i;h+=1){const g=u.next();g&&o.push(g.toDate())}return o}catch{return[]}}const vt=[{expression:"*/5 * * * *",labelKey:"sessions.scheduledTasks.editor.cronExpression.examples.every5min"},{expression:"0 * * * *",labelKey:"sessions.scheduledTasks.editor.cronExpression.examples.everyHour"},{expression:"0 9 * * 1",labelKey:"sessions.scheduledTasks.editor.cronExpression.examples.monday9am"},{expression:"0 9,17 * * *",labelKey:"sessions.scheduledTasks.editor.cronExpression.examples.9am5pm"},{expression:"0 0 1 * *",labelKey:"sessions.scheduledTasks.editor.cronExpression.examples.firstOfMonth"}],Nt={"Europe/Kiev":"Europe/Kyiv","Asia/Calcutta":"Asia/Kolkata","Asia/Saigon":"Asia/Ho_Chi_Minh","Asia/Rangoon":"Asia/Yangon","Asia/Katmandu":"Asia/Kathmandu","America/Godthab":"America/Nuuk","Atlantic/Faeroe":"Atlantic/Faroe","Pacific/Enderbury":"Pacific/Kanton"},Fe=n=>Nt[n]??n,ks=[0,1,2,3,4,5,6],as="flex h-6 w-6 cursor-pointer items-center justify-center text-foreground transition-none outline-none focus:outline-none flex-shrink-0",Ye=typeof Intl<"u"&&typeof Intl.supportedValuesOf=="function"?[...new Set(Intl.supportedValuesOf("timeZone").map(Fe))]:["UTC","Europe/Kyiv","Europe/London","Europe/Berlin","America/New_York","America/Los_Angeles","Asia/Tokyo"],ls=()=>{const n=new Date,e=n.getFullYear(),i=String(n.getMonth()+1).padStart(2,"0"),a=String(n.getDate()).padStart(2,"0");return`${e}-${i}-${a}`},He=n=>{const e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(n);if(!e)return null;const i=Number(e[1]),a=Number(e[2]),u=Number(e[3]),o=new Date(i,a-1,u);return Number.isNaN(o.getTime())||o.getFullYear()!==i||o.getMonth()!==a-1||o.getDate()!==u?null:o},cs=n=>{const e=n.getFullYear(),i=String(n.getMonth()+1).padStart(2,"0"),a=String(n.getDate()).padStart(2,"0");return`${e}-${i}-${a}`},St=(n,e,i)=>{const a=He(n);return a?new Intl.DateTimeFormat(i,{month:"short",day:"numeric",year:"numeric"}).format(a):e},ds=(n,e)=>new Date(n.getFullYear(),n.getMonth()+e,1),Dt=(n,e)=>{const i=n.getFullYear(),a=n.getMonth(),h=(new Date(i,a,1).getDay()-e+7)%7,g=new Date(i,a+1,0).getDate(),T=new Date(i,a,0).getDate(),p=[];for(let A=0;A<42;A+=1){const d=A-h+1;if(d<=0){const j=T+d;p.push({date:new Date(i,a-1,j),inCurrentMonth:!1});continue}if(d>g){p.push({date:new Date(i,a+1,d-g),inCurrentMonth:!1});continue}p.push({date:new Date(i,a,d),inCurrentMonth:!0})}return p},At=n=>{const e=/^([01]\d|2[0-3]):([0-5]\d)$/.exec(n);if(!e)return{hour24:"00",hour12:"12",minute:"00",meridiem:"AM"};const i=Number(e[1]),a=e[2],u=i>=12?"PM":"AM",o=i%12===0?12:i%12;return{hour24:String(i).padStart(2,"0"),hour12:String(o).padStart(2,"0"),minute:a,meridiem:u}},Ee=(n,e,i)=>{const a=Number(n),u=Number(e),o=Number.isFinite(a)?Math.min(12,Math.max(1,a)):12,h=Number.isFinite(u)?Math.min(59,Math.max(0,u)):0;let g=o%12;return i==="PM"&&(g+=12),`${String(g).padStart(2,"0")}:${String(h).padStart(2,"0")}`},$e=(n,e)=>{const{max:i,min:a=0,loop:u=!1}=e;let o=Number.parseInt(n,10);return Number.isFinite(o)?(u?(o>i&&(o=a),o<a&&(o=i)):(o>i&&(o=i),o<a&&(o=a)),String(o).padStart(2,"0")):"00"},us=n=>/^(0[1-9]|1[0-2])$/.test(n)?n:$e(n,{min:1,max:12}),Ve=n=>/^[0-5][0-9]$/.test(n)?n:$e(n,{max:59}),Ct=(n,e)=>$e(String(Number.parseInt(n,10)+e),{min:1,max:12,loop:!0}),ms=(n,e)=>$e(String(Number.parseInt(n,10)+e),{min:0,max:59,loop:!0}),It=n=>{try{const e=Intl.Locale;if(typeof e!="function")return 1;const a=new e(n).weekInfo?.firstDay;return typeof a!="number"?1:a%7}catch{return 1}},Mt=n=>{try{const e=new Intl.DateTimeFormat(n,{hour:"numeric"}).resolvedOptions();return typeof e.hour12=="boolean"?!e.hour12:e.hourCycle==="h23"||e.hourCycle==="h24"}catch{return!0}},Et=n=>{const e=new Intl.DateTimeFormat(n,{weekday:"short"}),i=new Date(2023,0,1);return ks.map(a=>e.format(new Date(i.getFullYear(),i.getMonth(),i.getDate()+a)))},Ft=(n,e)=>[...n.slice(e),...n.slice(0,e)],se=n=>{const e=Pe.c(6),{htmlFor:i,required:a,children:u}=n;let o;e[0]!==a?(o=a&&s.jsx("span",{className:"ms-0.5 text-destructive",children:"*"}),e[0]=a,e[1]=o):o=e[1];let h;return e[2]!==u||e[3]!==i||e[4]!==o?(h=s.jsx("div",{className:"flex items-center gap-1.5",children:s.jsxs("label",{htmlFor:i,className:"typography-meta font-medium text-foreground",children:[u,o]})}),e[2]=u,e[3]=i,e[4]=o,e[5]=h):h=e[5],h},hs=n=>{const e=Pe.c(84),{value:i,onChange:a,use24Hour:u,hourAriaLabel:o,minuteAriaLabel:h,periodAriaLabel:g,amLabel:T,pmLabel:p}=n;let A;e[0]!==i?(A=At(i),e[0]=i,e[1]=A):A=e[1];const d=A,j=m.useRef(null),S=m.useRef(null),[O,z]=m.useState(null),[P,W]=m.useState(null),B=m.useRef(null),V=m.useRef(null);let C;e[2]===Symbol.for("react.memo_cache_sentinel")?(C=x=>{B.current=x,z(x)},e[2]=C):C=e[2];const E=C;let F;e[3]===Symbol.for("react.memo_cache_sentinel")?(F=x=>{V.current=x,W(x)},e[3]=F):F=e[3];const $=F,N=Bt,ee=Vt,Y=Ht;let c;e[4]!==a||e[5]!==d.meridiem||e[6]!==d.minute||e[7]!==u?(c=x=>{const ce=x.replace(/\D/g,"").slice(0,2);E(ce),ce.length===2&&(a(u?Y(N(ce),d.minute):Ee(us(ce),d.minute,d.meridiem)),E(null),S.current?.focus())},e[4]=a,e[5]=d.meridiem,e[6]=d.minute,e[7]=u,e[8]=c):c=e[8];const k=c;let U;e[9]!==a||e[10]!==d.meridiem||e[11]!==d.minute||e[12]!==u?(U=()=>{const x=B.current;if(x!==null&&(E(null),x.length!==0)){if(u){a(Y(N(x.padStart(2,"0")),d.minute));return}a(Ee(us(x.padStart(2,"0")),d.minute,d.meridiem))}},e[9]=a,e[10]=d.meridiem,e[11]=d.minute,e[12]=u,e[13]=U):U=e[13];const Q=U;let H;e[14]!==a||e[15]!==d.hour12||e[16]!==d.hour24||e[17]!==d.meridiem||e[18]!==u?(H=x=>{const ce=x.replace(/\D/g,"").slice(0,2);$(ce),ce.length===2&&(a(u?Y(d.hour24,Ve(ce)):Ee(d.hour12,Ve(ce),d.meridiem)),$(null))},e[14]=a,e[15]=d.hour12,e[16]=d.hour24,e[17]=d.meridiem,e[18]=u,e[19]=H):H=e[19];const K=H;let Z;e[20]!==a||e[21]!==d.hour12||e[22]!==d.hour24||e[23]!==d.meridiem||e[24]!==u?(Z=()=>{const x=V.current;x!==null&&($(null),x.length!==0&&a(u?Y(d.hour24,Ve(x.padStart(2,"0"))):Ee(d.hour12,Ve(x.padStart(2,"0")),d.meridiem)))},e[20]=a,e[21]=d.hour12,e[22]=d.hour24,e[23]=d.meridiem,e[24]=u,e[25]=Z):Z=e[25];const w=Z;let R;e[26]!==a||e[27]!==d.hour12||e[28]!==d.hour24||e[29]!==d.meridiem||e[30]!==d.minute||e[31]!==u?(R=x=>a(u?Y(ee(d.hour24,x),d.minute):Ee(Ct(d.hour12,x),d.minute,d.meridiem)),e[26]=a,e[27]=d.hour12,e[28]=d.hour24,e[29]=d.meridiem,e[30]=d.minute,e[31]=u,e[32]=R):R=e[32];const re=R;let ae;e[33]!==a||e[34]!==d.hour12||e[35]!==d.hour24||e[36]!==d.meridiem||e[37]!==d.minute||e[38]!==u?(ae=x=>a(u?Y(d.hour24,ms(d.minute,x)):Ee(d.hour12,ms(d.minute,x),d.meridiem)),e[33]=a,e[34]=d.hour12,e[35]=d.hour24,e[36]=d.meridiem,e[37]=d.minute,e[38]=u,e[39]=ae):ae=e[39];const oe=ae;let r;e[40]!==a||e[41]!==d.hour12||e[42]!==d.meridiem||e[43]!==d.minute?(r=x=>{x!==d.meridiem&&a(Ee(d.hour12,d.minute,x))},e[40]=a,e[41]=d.hour12,e[42]=d.meridiem,e[43]=d.minute,e[44]=r):r=e[44];const y=r;let b;e[45]!==Q||e[46]!==re?(b=x=>{if(x.key==="ArrowRight"){x.preventDefault(),Q(),S.current?.focus();return}(x.key==="ArrowUp"||x.key==="ArrowDown")&&(x.preventDefault(),E(null),re(x.key==="ArrowUp"?1:-1))},e[45]=Q,e[46]=re,e[47]=b):b=e[47];const v=b;let G;e[48]!==w||e[49]!==oe?(G=x=>{if(x.key==="ArrowLeft"&&(x.currentTarget.selectionStart??0)===0){x.preventDefault(),w(),j.current?.focus();return}(x.key==="ArrowUp"||x.key==="ArrowDown")&&(x.preventDefault(),$(null),oe(x.key==="ArrowUp"?1:-1))},e[48]=w,e[49]=oe,e[50]=G):G=e[50];const J=G,le=u?"px-2":"ps-2 pe-1";let te;e[51]!==le?(te=fe("oc-surface-elevated oc-raised oc-field inline-flex h-8 w-fit items-center gap-1 rounded-md bg-surface-elevated",le),e[51]=le,e[52]=te):te=e[52];const Ie=O??(u?d.hour24:d.hour12);let _;e[53]!==k?(_=x=>k(x.target.value),e[53]=k,e[54]=_):_=e[54];let De;e[55]===Symbol.for("react.memo_cache_sentinel")?(De=()=>E(""),e[55]=De):De=e[55];let he;e[56]!==Q||e[57]!==o||e[58]!==v||e[59]!==Ie||e[60]!==_?(he=s.jsx("input",{ref:j,inputMode:"numeric",value:Ie,onChange:_,onKeyDown:v,onFocus:De,onBlur:Q,maxLength:2,"aria-label":o,className:"h-7 w-7 shrink-0 rounded-sm bg-transparent text-center font-mono text-sm tabular-nums text-foreground outline-none caret-transparent focus:bg-interactive-hover"}),e[56]=Q,e[57]=o,e[58]=v,e[59]=Ie,e[60]=_,e[61]=he):he=e[61];let Ae;e[62]===Symbol.for("react.memo_cache_sentinel")?(Ae=s.jsx("span",{className:"font-mono text-sm text-muted-foreground",children:":"}),e[62]=Ae):Ae=e[62];const Le=P??d.minute;let ge;e[63]!==K?(ge=x=>K(x.target.value),e[63]=K,e[64]=ge):ge=e[64];let Me;e[65]===Symbol.for("react.memo_cache_sentinel")?(Me=()=>$(""),e[65]=Me):Me=e[65];let pe;e[66]!==w||e[67]!==h||e[68]!==J||e[69]!==Le||e[70]!==ge?(pe=s.jsx("input",{ref:S,inputMode:"numeric",value:Le,onChange:ge,onKeyDown:J,onFocus:Me,onBlur:w,maxLength:2,"aria-label":h,className:"h-7 w-7 shrink-0 rounded-sm bg-transparent text-center font-mono text-sm tabular-nums text-foreground outline-none caret-transparent focus:bg-interactive-hover"}),e[66]=w,e[67]=h,e[68]=J,e[69]=Le,e[70]=ge,e[71]=pe):pe=e[71];let xe;e[72]!==T||e[73]!==d.meridiem||e[74]!==g||e[75]!==p||e[76]!==y||e[77]!==u?(xe=u?null:s.jsxs(ve,{value:d.meridiem,onValueChange:x=>y(x),children:[s.jsx(Ne,{"aria-label":g,className:"ms-1 h-7 w-fit bg-transparent dark:bg-transparent ps-2 pe-1 shadow-none hover:bg-interactive-hover",children:s.jsx(ue,{})}),s.jsxs(Se,{children:[s.jsx(q,{value:"AM",children:T}),s.jsx(q,{value:"PM",children:p})]})]}),e[72]=T,e[73]=d.meridiem,e[74]=g,e[75]=p,e[76]=y,e[77]=u,e[78]=xe):xe=e[78];let ye;return e[79]!==te||e[80]!==he||e[81]!==pe||e[82]!==xe?(ye=s.jsxs("div",{className:te,children:[he,Ae,pe,xe]}),e[79]=te,e[80]=he,e[81]=pe,e[82]=xe,e[83]=ye):ye=e[83],ye},ps=n=>new Date(n.getFullYear(),n.getMonth(),1),Rt=()=>{const n=new Date;return new Date(n.getFullYear(),n.getMonth(),n.getDate())},xs=(n,e)=>n.getFullYear()===e.getFullYear()&&n.getMonth()===e.getMonth()&&n.getDate()===e.getDate(),Pt=n=>{if(!n)return["09:00"];const i=(Array.isArray(n.schedule.times)?n.schedule.times:n.schedule.time?[n.schedule.time]:[]).filter(u=>typeof u=="string"&&/^([01]\d|2[0-3]):([0-5]\d)$/.test(u)).map(u=>u.trim()),a=Array.from(new Set(i)).sort((u,o)=>u.localeCompare(o));return a.length>0?a:["09:00"]},fs=(n,e)=>{const i=Fe(Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC");return n?{id:n.id,sessionMode:n.targetSessionId?"existing":"new",targetSessionId:n.targetSessionId||"",name:n.name,enabled:n.enabled,schedule:{kind:n.schedule.kind==="cron"?"cron":n.schedule.kind==="once"?"once":n.schedule.kind==="weekly"?"weekly":"daily",times:Pt(n),onceDate:typeof n.schedule.date=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(n.schedule.date)?n.schedule.date:ls(),onceTime:typeof n.schedule.time=="string"&&/^([01]\d|2[0-3]):([0-5]\d)$/.test(n.schedule.time)?n.schedule.time:"09:00",weekdays:Array.isArray(n.schedule.weekdays)?n.schedule.weekdays:[1],timezone:Fe(n.schedule.timezone||i),cronExpression:n.schedule.kind==="cron"&&typeof n.schedule.cron=="string"?n.schedule.cron:""},execution:{prompt:n.execution.prompt,providerID:n.execution.providerID||e.providerID,modelID:n.execution.modelID||e.modelID,variant:n.execution.variant||"",agent:n.execution.agent||"",useDefaults:n.execution.useDefaults===!0,goalEnabled:n.execution.goalEnabled===!0,goalTokenBudget:typeof n.execution.goalTokenBudget=="number"&&n.execution.goalTokenBudget>0?n.execution.goalTokenBudget:null,permissionAutoAccept:n.execution.permissionAutoAccept===!0},state:n.state}:{name:"",sessionMode:"new",targetSessionId:"",enabled:!0,schedule:{kind:"daily",times:["09:00"],onceDate:ls(),onceTime:"09:00",weekdays:[1],timezone:i,cronExpression:""},execution:{prompt:"",providerID:e.providerID,modelID:e.modelID,variant:e.variant,agent:e.agent,useDefaults:!1,goalEnabled:!1,goalTokenBudget:null,permissionAutoAccept:!1}}},Lt=(n,e)=>{if(n.sessionMode==="existing"&&!n.targetSessionId)return e("sessions.scheduledTasks.editor.targetRequired");if(!n.name.trim())return e("sessions.scheduledTasks.editor.validation.taskNameRequired");if(!n.execution.prompt.trim())return e("sessions.scheduledTasks.editor.validation.promptRequired");if(!n.execution.useDefaults&&(!n.execution.providerID.trim()||!n.execution.modelID.trim()))return e("sessions.scheduledTasks.editor.validation.modelRequired");if(n.schedule.kind==="once"){if(!/^\d{4}-\d{2}-\d{2}$/.test(n.schedule.onceDate))return e("sessions.scheduledTasks.editor.validation.dateFormat");if(!/^([01]\d|2[0-3]):([0-5]\d)$/.test(n.schedule.onceTime))return e("sessions.scheduledTasks.editor.validation.timeFormat")}else if(n.schedule.kind==="cron"){if(!n.schedule.cronExpression.trim())return e("sessions.scheduledTasks.editor.validation.cronRequired");if(!Ts(n.schedule.cronExpression).valid)return e("sessions.scheduledTasks.editor.validation.cronInvalid")}else if(n.schedule.times.filter(a=>/^([01]\d|2[0-3]):([0-5]\d)$/.test(a)).length===0)return e("sessions.scheduledTasks.editor.validation.atLeastOneTime");return n.schedule.kind==="weekly"&&n.schedule.weekdays.length===0?e("sessions.scheduledTasks.editor.validation.atLeastOneWeekday"):n.schedule.timezone.trim()?null:e("sessions.scheduledTasks.editor.validation.timezoneRequired")},$t=n=>{const e=n.filter(i=>/^([01]\d|2[0-3]):([0-5]\d)$/.test(i));return Array.from(new Set(e)).sort((i,a)=>i.localeCompare(a))},Ot=n=>{const e=Pe.c(64),{draft:i,setDraft:a,locale:u,t:o}=n,h=i.schedule.cronExpression;let g;e[0]!==h?(g=h.trim()?Ts(h):null,e[0]=h,e[1]=g):g=e[1];const T=g;let p;e:{if(!T?.valid||!h.trim()){let R;e[2]===Symbol.for("react.memo_cache_sentinel")?(R=[],e[2]=R):R=e[2],p=R;break e}let w;e[3]!==h||e[4]!==i.schedule.timezone?(w=wt(h,i.schedule.timezone),e[3]=h,e[4]=i.schedule.timezone,e[5]=w):w=e[5],p=w}const A=p;let d;e[6]!==i.schedule.timezone||e[7]!==u?(d=w=>new Intl.DateTimeFormat(u,{timeZone:i.schedule.timezone,month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(w),e[6]=i.schedule.timezone,e[7]=u,e[8]=d):d=e[8];const j=d;let S;e[9]!==o?(S=o("sessions.scheduledTasks.editor.cronExpression.label"),e[9]=o,e[10]=S):S=e[10];let O;e[11]!==S?(O=s.jsx(se,{htmlFor:"sched-cron",required:!0,children:S}),e[11]=S,e[12]=O):O=e[12];let z;e[13]!==a?(z=w=>a(R=>({...R,schedule:{...R.schedule,cronExpression:w.target.value}})),e[13]=a,e[14]=z):z=e[14];let P;e[15]!==o?(P=o("sessions.scheduledTasks.editor.cronExpression.placeholder"),e[15]=o,e[16]=P):P=e[16];let W;e[17]!==h||e[18]!==z||e[19]!==P?(W=s.jsx(bs,{id:"sched-cron",value:h,onChange:z,placeholder:P,className:"w-full max-w-xs font-mono"}),e[17]=h,e[18]=z,e[19]=P,e[20]=W):W=e[20];let B;e[21]!==h||e[22]!==T||e[23]!==o?(B=T&&!T.valid&&h.trim()?s.jsx("span",{className:"typography-micro text-destructive",children:o("sessions.scheduledTasks.editor.validation.cronInvalid")}):null,e[21]=h,e[22]=T,e[23]=o,e[24]=B):B=e[24];let V;e[25]!==O||e[26]!==W||e[27]!==B?(V=s.jsxs("div",{className:"flex flex-col gap-1",children:[O,W,B]}),e[25]=O,e[26]=W,e[27]=B,e[28]=V):V=e[28];let C;e[29]!==j||e[30]!==A||e[31]!==o?(C=A.length>0?s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"typography-meta text-muted-foreground",children:o("sessions.scheduledTasks.editor.cronExpression.nextRuns")}),s.jsx("span",{className:"typography-micro text-foreground",children:A.map(j).join(", ")})]}):null,e[29]=j,e[30]=A,e[31]=o,e[32]=C):C=e[32];let E;e[33]!==o?(E=o("sessions.scheduledTasks.editor.cronExpression.examples"),e[33]=o,e[34]=E):E=e[34];let F;e[35]!==E?(F=s.jsx("span",{className:"typography-meta text-muted-foreground",children:E}),e[35]=E,e[36]=F):F=e[36];let $;e[37]!==a||e[38]!==o?($=vt.map(w=>s.jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2 py-1 typography-micro text-foreground hover:bg-interactive-hover",onClick:()=>a(R=>({...R,schedule:{...R.schedule,cronExpression:w.expression}})),children:[s.jsx("span",{className:"font-mono",children:w.expression}),s.jsx("span",{className:"text-muted-foreground",children:o(w.labelKey)})]},w.expression)),e[37]=a,e[38]=o,e[39]=$):$=e[39];let N;e[40]!==$?(N=s.jsx("div",{className:"flex flex-wrap gap-1.5",children:$}),e[40]=$,e[41]=N):N=e[41];let ee;e[42]!==F||e[43]!==N?(ee=s.jsxs("div",{className:"flex flex-col gap-1",children:[F,N]}),e[42]=F,e[43]=N,e[44]=ee):ee=e[44];let Y;e[45]!==o?(Y=o("sessions.scheduledTasks.editor.timezone.label"),e[45]=o,e[46]=Y):Y=e[46];let c;e[47]!==Y?(c=s.jsx(se,{children:Y}),e[47]=Y,e[48]=c):c=e[48];let k;e[49]!==a?(k=w=>{a(R=>({...R,schedule:{...R.schedule,timezone:w}}))},e[49]=a,e[50]=k):k=e[50];let U;e[51]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx(Ne,{className:"w-fit max-w-full",children:s.jsx(ue,{})}),e[51]=U):U=e[51];let Q;e[52]===Symbol.for("react.memo_cache_sentinel")?(Q=s.jsx(Se,{children:Ye.map(Wt)}),e[52]=Q):Q=e[52];let H;e[53]!==i.schedule.timezone||e[54]!==k?(H=s.jsxs(ve,{value:i.schedule.timezone,onValueChange:k,children:[U,Q]}),e[53]=i.schedule.timezone,e[54]=k,e[55]=H):H=e[55];let K;e[56]!==c||e[57]!==H?(K=s.jsxs("div",{className:"flex flex-col gap-1",children:[c,H]}),e[56]=c,e[57]=H,e[58]=K):K=e[58];let Z;return e[59]!==V||e[60]!==C||e[61]!==ee||e[62]!==K?(Z=s.jsxs("div",{className:"flex flex-col gap-3",children:[V,C,ee,K]}),e[59]=V,e[60]=C,e[61]=ee,e[62]=K,e[63]=Z):Z=e[63],Z};function zt(n){const{open:e,task:i,onOpenChange:a,onSave:u}=n,{t:o,locale:h}=ze(),g=Ue(t=>t.activeSessions),T=Ls(),p=m.useMemo(()=>{const t=new Map(g.map(l=>[l.id,l]));for(const l of T)t.set(l.id,l);return[...t.values()].filter(l=>!l.time?.archived)},[g,T]),A=m.useMemo(()=>p.map(t=>`${t.id}:${t.directory??""}`).sort().join(`
|
|
2
2
|
`),[p]),d=m.useRef(p);d.current=p;const[j,S]=m.useState({status:"idle"}),[O,z]=m.useState(0);m.useEffect(()=>{if(!e||!n.projectId||!A){S({status:"idle"});return}const t=new AbortController;return S(l=>l.status==="ready"?l:{status:"loading"}),ft(n.projectId,d.current.map(l=>({sessionId:l.id,directory:l.directory??""})),t.signal).then(l=>S({status:"ready",ids:l}),()=>{t.signal.aborted||S({status:"error"})}),()=>t.abort()},[e,n.projectId,A,O]);const P=m.useMemo(()=>j.status==="ready"?p.filter(t=>j.ids.has(t.id)):[],[p,j]);m.useEffect(()=>{e&&qe().catch(()=>{})},[e]);const W=Ce(t=>t.loadProviders),B=Ce(t=>t.loadAgents),V=Ce(t=>t.providers),C=Ce(t=>t.currentProviderId),E=Ce(t=>t.currentModelId),F=Ce(t=>t.currentVariant||""),$=Ce(t=>t.currentAgentName||""),N=Re(t=>t.timeFormatPreference),ee=Re(t=>t.weekStartPreference),Y=Re(t=>t.isMobile),[c,k]=m.useState(()=>fs(i,{providerID:C,modelID:E,variant:F,agent:$})),[U,Q]=m.useState(!1),[H,K]=m.useState(!1),[Z,w]=m.useState(!1),[R,re]=m.useState(""),[ae,oe]=m.useState(!1),[r,y]=m.useState(""),[b,v]=m.useState(!1),[G,J]=m.useState(""),[le,te]=m.useState(()=>{const t=He(i?.schedule?.date||"")||new Date;return new Date(t.getFullYear(),t.getMonth(),1)}),Ie=m.useRef(null),_=m.useRef(null),De=m.useRef(null),he=m.useRef(null),Ae=m.useRef(null),Le=m.useMemo(()=>Mt(h),[h]),ge=m.useMemo(()=>It(h),[h]),Me=m.useMemo(()=>N==="24h"?!0:N==="12h"?!1:Le,[N,Le]),pe=m.useMemo(()=>ee==="sunday"?0:ee==="monday"?1:ge,[ee,ge]),xe=m.useMemo(()=>{const t=Et(h);return Ft(ks.map(l=>({value:l,label:t[l]||""})),pe)},[h,pe]);m.useEffect(()=>{e&&(W({source:"scheduledTaskEditor"}),B({source:"scheduledTaskEditor"}))},[e,W,B]),m.useEffect(()=>{if(!e)return;k(fs(i,{providerID:C,modelID:E,variant:F,agent:$}));const t=He(i?.schedule?.date||"")||new Date;te(new Date(t.getFullYear(),t.getMonth(),1)),K(!1),oe(!1),w(!1),y(""),re("")},[e,i,C,E,F,$]),m.useEffect(()=>{if(!H)return;const t=l=>{Ie.current&&!Ie.current.contains(l.target)&&K(!1)};return document.addEventListener("mousedown",t),()=>{document.removeEventListener("mousedown",t)}},[H]);const ye=m.useMemo(()=>{const l=V.find(f=>f.id===c.execution.providerID)?.models?.find(f=>f.id===c.execution.modelID);return $s(l?.variants)},[V,c.execution.providerID,c.execution.modelID]),x=ye.length>0,ce=m.useMemo(()=>!x||!c.execution.variant?"__default":ye.includes(c.execution.variant)?c.execution.variant:"__default",[c.execution.variant,x,ye]);m.useEffect(()=>{x||!c.execution.variant||k(t=>({...t,execution:{...t.execution,variant:""}}))},[x,c.execution.variant]);const Ge=m.useCallback((t,l)=>{k(f=>{const I=new Set(f.schedule.weekdays);return l?I.add(t):I.delete(t),{...f,schedule:{...f.schedule,weekdays:Array.from(I).sort((X,M)=>X-M)}}})},[]),ws=m.useCallback((t,l)=>{k(f=>{const I=f.schedule.times.slice();return I[t]=l,{...f,schedule:{...f.schedule,times:I}}})},[]),vs=m.useCallback(t=>{k(l=>{const f=l.schedule.times.filter((I,X)=>X!==t);return{...l,schedule:{...l.schedule,times:f.length>0?f:["09:00"]}}})},[]),Ns=m.useCallback(()=>{k(t=>({...t,schedule:{...t.schedule,times:[...t.schedule.times,"12:00"]}}))},[]),be=m.useMemo(()=>Rt(),[]),Qe=m.useMemo(()=>ps(be),[be]),Ss=m.useMemo(()=>{const t=He(c.schedule.onceDate);return t?xs(t,be)?o("sessions.scheduledTasks.editor.date.today"):new Intl.DateTimeFormat(h,{weekday:"short"}).format(t):null},[c.schedule.onceDate,h,o,be]),Ds=m.useMemo(()=>ps(le).getTime()<=Qe.getTime(),[le,Qe]),As=m.useMemo(()=>xe.map(t=>t.label),[xe]),Xe=m.useCallback(t=>{k(l=>({...l,schedule:{...l.schedule,onceDate:t}}))},[]),je=m.useCallback((t,l)=>{if(t.startsWith("/")){const M=t.indexOf(" "),L=t.indexOf(`
|
|
3
3
|
`),ne=Math.min(M===-1?t.length:M,L===-1?t.length:L);if(l<=ne&&M===-1){y(t.substring(1,ne)),oe(!0),w(!1),v(!1);return}}oe(!1);const f=t.substring(0,l),I=f.lastIndexOf("#");if(I!==-1){const M=I>0?f[I-1]:null,L=f.substring(I+1);if((!M||/\s/.test(M))&&!L.includes(" ")&&!L.includes(`
|
|
4
4
|
`)){J(L),v(!0),w(!1);return}}v(!1);const X=f.lastIndexOf("@");if(X!==-1){const M=X>0?f[X-1]:null,L=f.substring(X+1);(!M||/\s/.test(M))&&!L.includes(" ")&&!L.includes(`
|