dorkos 0.101.0 → 0.103.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/README.md +10 -10
- package/dist/bin/cli.js +2935 -1738
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-CwxCTicf.js → AboutPage-BNVLNd3q.js} +1 -1
- package/dist/client/assets/{ActivityRow-D0QQ0SFu.js → ActivityRow-CvjAfRBM.js} +1 -1
- package/dist/client/assets/AdapterIcon-wGSXBn-k.js +1 -0
- package/dist/client/assets/AdapterSetupWizard-CmSJ2sno.js +2 -0
- package/dist/client/assets/{AgentRequestCard-BLLmoAES.js → AgentRequestCard-D62XQXBM.js} +4 -4
- package/dist/client/assets/{AppearancePage-GqrWckTQ.js → AppearancePage-Bds0L-wm.js} +1 -1
- package/dist/client/assets/{AttentionSignalRow-sEhnIPBB.js → AttentionSignalRow-C6RkjCWK.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-BXjzhT_D.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-CerNarG-.js} +24 -24
- package/dist/client/assets/{BlintzCanvas-CXi0fvcM.js → BlintzCanvas-CUqethk_.js} +24 -24
- package/dist/client/assets/{CanvasCsvContent-QhDSf8Pd.js → CanvasCsvContent-DdbIUPMJ.js} +1 -1
- package/dist/client/assets/CanvasFileContent-CX2VNF4o.js +2 -0
- package/dist/client/assets/CanvasModel3dContent-OprkQsgq.js +2 -0
- package/dist/client/assets/{CodeMirrorDiff-BMG7DBg2.js → CodeMirrorDiff-BnMdmI0K.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-BYdz0ipX.js → CodeMirrorEditor-C7T-DaVA.js} +1 -1
- package/dist/client/assets/ConnectionAccessLists-B3QGnSxM.js +1 -0
- package/dist/client/assets/ConnectionsPage-E3br6maQ.js +11 -0
- package/dist/client/assets/{ConventionPage-y-Zq3Klp.js → ConventionPage-vMN5qEwP.js} +3 -3
- package/dist/client/assets/{ExtensionPageRoute-gZKKPhaj.js → ExtensionPageRoute-DFkPAzjs.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-CbKIa11X.js → FloatingTanStackRouterDevtools-CqogiFob-BP4itJWW.js} +1 -1
- package/dist/client/assets/HandlePage-De4D_IVs.js +1 -0
- package/dist/client/assets/{LexicalField-Ceoa9flp.js → LexicalField-BbUXXxTw.js} +1 -1
- package/dist/client/assets/{ManagesPage-Dcqdm6I8.js → ManagesPage-DsNSZHug.js} +1 -1
- package/dist/client/assets/Marketplace-D4zHIIak.js +36 -0
- package/dist/client/assets/MarketplaceSourcesView-DILS8-ca.js +1 -0
- package/dist/client/assets/{McpAppFrame-B1ThSf2U.js → McpAppFrame-Cl_2azg-.js} +2 -2
- package/dist/client/assets/McpSigninBody-TpoSImsV.js +1 -0
- package/dist/client/assets/{Model3dViewer-DlcQ3-LS.js → Model3dViewer-C-iyu5eV.js} +1 -1
- package/dist/client/assets/NamePage-C-3w8oeg.js +1 -0
- package/dist/client/assets/NewDirectMessageMenu-bJE7b4lX.js +1 -0
- package/dist/client/assets/{NotificationsPage-CQQIdLtI.js → NotificationsPage-CL23qwVw.js} +1 -1
- package/dist/client/assets/OperatorIdentityForm-ixaqUfIO.js +1 -0
- package/dist/client/assets/{PermissionsPage-TX-d7aVQ.js → PermissionsPage-D4xbxTkc.js} +1 -1
- package/dist/client/assets/{PersonalityPicker-C_9JVOva.js → PersonalityPicker-CTvPlN-k.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-BoTED73t.js → PersonalityPopover-Coy0eaIg.js} +1 -1
- package/dist/client/assets/PhotoPage-DpEEXO3e.js +1 -0
- package/dist/client/assets/PreviewRefusedNotice-B2GLqLYi.js +1 -0
- package/dist/client/assets/{PromptSuggestionChips-B_oUtFMI.js → PromptSuggestionChips-YdKEWyNT.js} +1 -1
- package/dist/client/assets/RoomSurface-BwIBBvYq.js +44 -0
- package/dist/client/assets/{RoomsPage-zOjjpHdA.js → RoomsPage-DaEXPz65.js} +1 -1
- package/dist/client/assets/RunsOnPopover-tvbVPKVf.js +1 -0
- package/dist/client/assets/SessionsPage-CAdV_XBY.js +1 -0
- package/dist/client/assets/SkillsPage-B4F19LmV.js +1 -0
- package/dist/client/assets/{TasksPage-BZapA_v6.js → TasksPage-BXcaEx3V.js} +1 -1
- package/dist/client/assets/ToolsPage-BYBwPql_.js +2 -0
- package/dist/client/assets/{TopologyGraph-BMcPxZsA.js → TopologyGraph-CZ2Y5I2e.js} +1 -1
- package/dist/client/assets/TourHost-BNpDrN0O.js +1 -0
- package/dist/client/assets/UnlinkDialog-Zyuh5qZY.js +1 -0
- package/dist/client/assets/{UnreadDivider-KSqqcHKN.js → UnreadDivider-Dh67_mAz.js} +1 -1
- package/dist/client/assets/_shell-lcu5vkQ7.js +98 -0
- package/dist/client/assets/{_shell._home-Bp_p1VUv.js → _shell._home-CPV1Z64k.js} +1 -1
- package/dist/client/assets/_shell._home.activity-CEvkKYBD.js +1 -0
- package/dist/client/assets/_shell._home.index-tGnRLvY-.js +3 -0
- package/dist/client/assets/{_shell._home.tasks-BsBH_4tZ.js → _shell._home.tasks-CtpZNevK.js} +1 -1
- package/dist/client/assets/_shell._home.workspaces-D6tkWdS8.js +1 -0
- package/dist/client/assets/{_shell.channels-DWAHkDPV.js → _shell.channels-DbrQXIVv.js} +4 -4
- package/dist/client/assets/_shell.connections-C3Ho4S8R.js +6 -0
- package/dist/client/assets/{_shell.feedback-requests-Hjv640j9.js → _shell.feedback-requests-D9l7SJi1.js} +1 -1
- package/dist/client/assets/_shell.marketplace-BfY-kBJk.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-B0km_EUs.js +1 -0
- package/dist/client/assets/_shell.session-O8MC-USm.js +54 -0
- package/dist/client/assets/{_shell.team-ctLQztjw.js → _shell.team-DvJK7irE.js} +4 -4
- package/dist/client/assets/_shell.x._extensionId-_-fII74H.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-_-fII74H.js +1 -0
- package/dist/client/assets/agent-attention-BvnWcLpc.js +5 -0
- package/dist/client/assets/{agent-browser-CCN16ZOz.js → agent-browser-DsDp0cSX.js} +1 -1
- package/dist/client/assets/{banner-DOm9_4l-.js → banner-Cja2VfwN.js} +2 -2
- package/dist/client/assets/{file-exclamation-point-BKzL0QhY.js → file-exclamation-point-D8KYFYSh.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-DTxMTVdP.js → highlighted-body-KPVGNVTW-Chp5pHWq.js} +1 -1
- package/dist/client/assets/{hover-card-qzuFUCaR.js → hover-card-FvX18DHP.js} +1 -1
- package/dist/client/assets/{index-Dcs6e-U_.js → index-BFPRILKF.js} +1 -1
- package/dist/client/assets/{index-CtOB9fS3.js → index-BKCteC7q.js} +1 -1
- package/dist/client/assets/index-Bbffv0TQ.js +1247 -0
- package/dist/client/assets/{index-BMOfHKE0.js → index-BhatJcNc.js} +1 -1
- package/dist/client/assets/index-BroohPSu.js +1 -0
- package/dist/client/assets/{index-DT_v3O-B.js → index-Bt4vTnDj.js} +1 -1
- package/dist/client/assets/{index-DwzSdOh3.js → index-BwkmCRvO.js} +1 -1
- package/dist/client/assets/{index-CTai_TxZ.js → index-BzS1K2wS.js} +1 -1
- package/dist/client/assets/{index-C3XnoXTY.js → index-C6F5gzX-.js} +1 -1
- package/dist/client/assets/{index-BaB-skF0.js → index-CIzSi3tA.js} +3 -3
- package/dist/client/assets/{index-BPcwoJoz.js → index-CLCbHvV5.js} +1 -1
- package/dist/client/assets/{index-DA-i3I4q.js → index-CXjobHw0.js} +1 -1
- package/dist/client/assets/{index-DgH_dl1a.js → index-CYcJ7ENW.js} +2 -2
- package/dist/client/assets/{index-3lQkXKcq.js → index-CeqzGl3y.js} +1 -1
- package/dist/client/assets/{index-DgtF-nBt.js → index-CknNaeS2.js} +1 -1
- package/dist/client/assets/{index-Bk98IpMn.js → index-CtK6WJzD.js} +1 -1
- package/dist/client/assets/{index-C8ZMfyGc.js → index-CvxLe-_3.js} +1 -1
- package/dist/client/assets/{index-CF9fqPef.js → index-D24Ttd-y.js} +4 -4
- package/dist/client/assets/{index-CIPHHziB.js → index-D6Jn2eBq.js} +1 -1
- package/dist/client/assets/{index-D3DXMH4x.js → index-DDibi3-x.js} +1 -1
- package/dist/client/assets/{index-C7B2uRgo.js → index-DElGMXW8.js} +2 -2
- package/dist/client/assets/{index-CmlaXay_.js → index-DGNJkiFb.js} +1 -1
- package/dist/client/assets/{index-WjW-NUCp.js → index-DI2T-dXr.js} +1 -1
- package/dist/client/assets/{index-CLhD0Bno.js → index-DZf_utaG.js} +1 -1
- package/dist/client/assets/{index-CTXNRyRE.js → index-D_XtXoLp.js} +1 -1
- package/dist/client/assets/{index-CDTumWMC.js → index-DjdQaKwP.js} +1 -1
- package/dist/client/assets/index-Do18O9VZ.js +1 -0
- package/dist/client/assets/{index-CVl132_4.js → index-Do1vOFrm.js} +1 -1
- package/dist/client/assets/{index-BIMClIrX.js → index-Dv1DkyeB.js} +1 -1
- package/dist/client/assets/{index-IgIVF9T_.js → index-DyvLJ_Z5.js} +1 -1
- package/dist/client/assets/index-HgvJwMGi.js +5 -0
- package/dist/client/assets/{index-DR1JT9Uz.js → index-OxwtxTFo.js} +3 -3
- package/dist/client/assets/index-QSDTjavn.js +1 -0
- package/dist/client/assets/{index-DOxEmnH2.js → index-ZLdoJdwS.js} +1 -1
- package/dist/client/assets/index-_GlgFH88.css +1 -0
- package/dist/client/assets/{index-CScfHuKF.js → index-euarUu2E.js} +1 -1
- package/dist/client/assets/{index-B-z7hA9x.js → index-jYh6X22t.js} +1 -1
- package/dist/client/assets/{index-CIfwPLXd.js → index-uQ1vTS05.js} +1 -1
- package/dist/client/assets/{index-CejezM4U.js → index-xfBvKz-h.js} +1 -1
- package/dist/client/assets/{index-BW5ce4t8.js → index-znQ5q2gV.js} +1 -1
- package/dist/client/assets/{layers-CJHXSEKK.js → layers-8-cbYlfw.js} +1 -1
- package/dist/client/assets/{lightbulb-DWjxw7lb.js → lightbulb-DoB0IKly.js} +1 -1
- package/dist/client/assets/{mention-pill-akMU3IVs.js → mention-pill-BHC6tMG9.js} +1 -1
- package/dist/client/assets/{message-square-off-DEagHpQY.js → message-square-off-CEHuZJtY.js} +1 -1
- package/dist/client/assets/{owner-notice-CLsx0s7q.js → owner-notice-dtDSKfGs.js} +1 -1
- package/dist/client/assets/{page-container-W7byjRmk.js → page-container-BOrdASM1.js} +1 -1
- package/dist/client/assets/primer-trigger-CC-cR5zN.js +3 -0
- package/dist/client/assets/{radio-B8Ozjv9U.js → radio-BfZPhctR.js} +1 -1
- package/dist/client/assets/{room-files-source-Bsc3YA91.js → room-files-source-BHupFaLE.js} +2 -2
- package/dist/client/assets/{rotate-ccw-clock-CNcDcTvq.js → rotate-ccw-clock-BvzfP8lR.js} +1 -1
- package/dist/client/assets/{rotate-cw-xvfipJLN.js → rotate-cw-BDweizfR.js} +1 -1
- package/dist/client/assets/{scroll-area-C95q3ss7.js → scroll-area-Dph6w3a6.js} +1 -1
- package/dist/client/assets/{search-x-C6SAxw7a.js → search-x-CoFJOP2l.js} +2 -2
- package/dist/client/assets/{shield-x-DxOGc0dW.js → shield-x-BZ6rhiT0.js} +1 -1
- package/dist/client/assets/{soul-file-pg0ShYy3.js → soul-file-H8fwhgiL.js} +1 -1
- package/dist/client/assets/use-delete-binding-CUsepFIL.js +1 -0
- package/dist/client/assets/use-dev-links-DYYe0vvP.js +1 -0
- package/dist/client/assets/{use-external-adapter-catalog-B0gcY-k7.js → use-external-adapter-catalog-CAl3MNq-.js} +1 -1
- package/dist/client/assets/use-full-activity-feed-Bb7BUusp.js +1 -0
- package/dist/client/assets/use-is-below-desktop-CIgGSgoL.js +1 -0
- package/dist/client/assets/use-jump-back-in-BdLBzvDr.js +11 -0
- package/dist/client/assets/use-mesh-topology-wYtCBbF_.js +1 -0
- package/dist/client/assets/use-pending-read-9UcfnDwF.js +1 -0
- package/dist/client/assets/{use-personality-commit-OH7d0xl_.js → use-personality-commit-CaxUHrX5.js} +1 -1
- package/dist/client/assets/{use-promo-activation-BgdGasXE.js → use-promo-activation-rNaAOdoh.js} +2 -2
- package/dist/client/assets/use-pulse-freshness-CygG3s-S.js +1 -0
- package/dist/client/assets/use-room-follow-claim-BIK37Iy3.js +1 -0
- package/dist/client/assets/{use-roving-tab-list-Be60AWK3.js → use-roving-tab-list-DQgkKGzc.js} +1 -1
- package/dist/client/assets/{use-session-canvas-Bqs6IQO7.js → use-session-canvas-Dpy5BEId.js} +5 -5
- package/dist/client/assets/use-session-diagnostics-atu9cfgr.js +16 -0
- package/dist/client/assets/use-unclaimed-chats-qUI5vY5K.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/drizzle/20261008170031_session_touches.sql +5 -0
- package/dist/drizzle/20261009171311_chat_messages.sql +41 -0
- package/dist/drizzle/20261009173712_started_by_report_back.sql +1 -0
- package/dist/drizzle/meta/20261008170031_snapshot.json +12642 -0
- package/dist/drizzle/meta/20261009171311_snapshot.json +12906 -0
- package/dist/drizzle/meta/20261009173712_snapshot.json +12914 -0
- package/dist/drizzle/meta/_journal.json +21 -0
- package/dist/server/index.js +23608 -19236
- package/dist/server/index.js.map +2 -2
- package/package.json +6 -6
- package/dist/client/assets/AdapterIcon-CL-MyyKy.js +0 -1
- package/dist/client/assets/AdapterSetupWizard-C8HOvHLF.js +0 -2
- package/dist/client/assets/CanvasFileContent-ZZhdofR4.js +0 -2
- package/dist/client/assets/CanvasModel3dContent-DMMMZh4o.js +0 -2
- package/dist/client/assets/ConnectionAccessLists-PW1uzcGU.js +0 -1
- package/dist/client/assets/ConnectionsPage-EwitZwOE.js +0 -11
- package/dist/client/assets/HandlePage-CL3_n1CI.js +0 -1
- package/dist/client/assets/Marketplace-DsU-q1ZZ.js +0 -36
- package/dist/client/assets/MarketplaceSourcesView-D72YoKNR.js +0 -1
- package/dist/client/assets/McpSigninBody-Btg3PnYN.js +0 -1
- package/dist/client/assets/NamePage-Bzqj4Eob.js +0 -1
- package/dist/client/assets/NewDirectMessageMenu-89yeGqvy.js +0 -1
- package/dist/client/assets/OperatorIdentityForm-BhiB9tQp.js +0 -1
- package/dist/client/assets/PhotoPage-C3fMlebQ.js +0 -1
- package/dist/client/assets/PreviewRefusedNotice-ChCgdKWN.js +0 -1
- package/dist/client/assets/RoomSurface-CgtNuYhl.js +0 -39
- package/dist/client/assets/RunsOnPopover-JTm1cYuw.js +0 -1
- package/dist/client/assets/SessionsPage-D4kyvHQf.js +0 -6
- package/dist/client/assets/SkillsPage-KYUVzuVa.js +0 -1
- package/dist/client/assets/ToolsPage-CWpHMlrR.js +0 -2
- package/dist/client/assets/TourHost-VY1-sy1Y.js +0 -1
- package/dist/client/assets/UnlinkDialog-3p38G_9q.js +0 -1
- package/dist/client/assets/_shell-DAjwimLg.js +0 -93
- package/dist/client/assets/_shell._home.activity-tk-XApvX.js +0 -1
- package/dist/client/assets/_shell._home.index-BNVhSN0y.js +0 -3
- package/dist/client/assets/_shell._home.workspaces-DuXnjQh0.js +0 -1
- package/dist/client/assets/_shell.connections-DIm3mUHy.js +0 -6
- package/dist/client/assets/_shell.marketplace-DF6Y7mc0.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-Do8cm7kq.js +0 -1
- package/dist/client/assets/_shell.session-DlN8iOl-.js +0 -43
- package/dist/client/assets/_shell.x._extensionId-0Q1rJtud.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-0Q1rJtud.js +0 -1
- package/dist/client/assets/agent-attention-Dn__3LQE.js +0 -5
- package/dist/client/assets/hand-DLUdsiuR.js +0 -6
- package/dist/client/assets/index-CQWqpw_G.js +0 -1
- package/dist/client/assets/index-D5uYwabS.js +0 -1
- package/dist/client/assets/index-DFMDv6qR.js +0 -1
- package/dist/client/assets/index-DMYBI16t.js +0 -1252
- package/dist/client/assets/index-DbbZNAKk.js +0 -5
- package/dist/client/assets/index-Dgp1LmEk.css +0 -1
- package/dist/client/assets/primer-trigger-DuM9vVnV.js +0 -3
- package/dist/client/assets/use-delete-binding-CZVeHqn0.js +0 -1
- package/dist/client/assets/use-dev-links-Df2WkCic.js +0 -1
- package/dist/client/assets/use-full-activity-feed-SYcgdMZu.js +0 -1
- package/dist/client/assets/use-is-below-desktop-C5_YenEp.js +0 -1
- package/dist/client/assets/use-jump-back-in-DWUPb1gi.js +0 -11
- package/dist/client/assets/use-mesh-topology-HLzZIgis.js +0 -1
- package/dist/client/assets/use-pending-read-BuJknrxG.js +0 -1
- package/dist/client/assets/use-pulse-freshness-BlD-dM_g.js +0 -1
- package/dist/client/assets/use-rename-session-D3MuyK-F.js +0 -1
- package/dist/client/assets/use-room-follow-claim-CyjhzbRJ.js +0 -1
- package/dist/client/assets/use-session-diagnostics-CfKdB2iY.js +0 -16
- package/dist/client/assets/use-unclaimed-chats-lqMhotUB.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as b,j as n,b2 as S,b5 as p,b6 as _,eR as k,ba as E,ca as I,eS as R,eT as N,eU as A,b3 as T,bb as h,eV as M,eW as $,eX as D,eY as O,a5 as F,ae as V,af as G}from"./index-Bbffv0TQ.js";import{S as L}from"./shield-x-BZ6rhiT0.js";var K=Object.defineProperty,g=(e,t)=>K(e,"name",{value:t,configurable:!0}),x="Tabs",[U,oe]=_(x,[k]),C=k(),[q,y]=U(x),H=b.forwardRef(g(function(t,a){const{__scopeTabs:r,value:s,onValueChange:o,defaultValue:d,orientation:i="horizontal",dir:l,activationMode:v="automatic",...m}=t,u=E(l),[c,f]=I({prop:s,onChange:o,defaultProp:d??"",caller:x});return n.jsx(q,{scope:r,baseId:R(),value:c,onValueChange:f,orientation:i,dir:u,activationMode:v,children:n.jsx(p.div,{dir:u,"data-orientation":i,...m,ref:a})})},"Tabs")),z="TabsList",B=b.forwardRef(g(function(t,a){const{__scopeTabs:r,loop:s=!0,...o}=t,d=y(z,r),i=C(r);return n.jsx(N,{asChild:!0,...i,orientation:d.orientation,dir:d.dir,loop:s,children:n.jsx(p.div,{role:"tablist","aria-orientation":d.orientation,...o,ref:a})})},"TabsList")),W="TabsTrigger",X=b.forwardRef(g(function(t,a){const{__scopeTabs:r,value:s,disabled:o=!1,...d}=t,i=y(W,r),l=C(r),v=w(i.baseId,s),m=j(i.baseId,s),u=s===i.value;return n.jsx(A,{asChild:!0,...l,focusable:!o,active:u,children:n.jsx(p.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":m,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:v,...d,ref:a,onMouseDown:T(t.onMouseDown,c=>{!o&&c.button===0&&c.ctrlKey===!1?i.onValueChange(s):c.preventDefault()}),onKeyDown:T(t.onKeyDown,c=>{o||c.target!==c.currentTarget||[" ","Enter"].includes(c.key)&&i.onValueChange(s)}),onFocus:T(t.onFocus,()=>{const c=i.activationMode!=="manual";!u&&!o&&c&&i.onValueChange(s)})})})},"TabsTrigger")),Q="TabsContent",Y=b.forwardRef(g(function(t,a){const{__scopeTabs:r,value:s,forceMount:o,children:d,...i}=t,l=y(Q,r),v=w(l.baseId,s),m=j(l.baseId,s),u=s===l.value,c=b.useRef(u);return b.useEffect(()=>{const f=requestAnimationFrame(()=>c.current=!1);return()=>cancelAnimationFrame(f)},[]),n.jsx(S,{present:o||u,children:({present:f})=>n.jsx(p.div,{"data-state":u?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":v,hidden:!f,id:m,tabIndex:0,...i,ref:a,style:{...t.style,animationDuration:c.current?"0s":void 0},children:f&&d})})},"TabsContent"));function w(e,t){return`${e}-trigger-${t}`}g(w,"makeTriggerId");function j(e,t){return`${e}-content-${t}`}g(j,"makeContentId");var J=H,Z=B,ee=X,te=Y;function ie({...e}){return n.jsx(J,{"data-slot":"tabs",...e})}function ce({className:e,responsive:t=!0,...a}){return n.jsx(Z,{"data-slot":"tabs-list",className:h("bg-dui-muted text-dui-muted-foreground inline-flex items-center justify-center rounded-lg p-1",t?M:"h-9",e),...a})}function ue({className:e,...t}){return n.jsx(ee,{"data-slot":"tabs-trigger",className:h("ring-offset-dui-background inline-flex items-center justify-center rounded-md px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-[color,background-color,box-shadow,opacity] motion-reduce:transition-none! md:py-1","focus-visible:ring-dui-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none","disabled:pointer-events-none disabled:opacity-50","data-[state=active]:bg-dui-background data-[state=active]:text-dui-foreground data-[state=active]:shadow",e),...t})}function de({className:e,...t}){return n.jsx(te,{"data-slot":"tabs-content",className:h("ring-offset-dui-background mt-2","data-[state=active]:animate-in data-[state=active]:fade-in-0 data-[state=active]:duration-150 motion-reduce:animate-none!","focus-visible:ring-dui-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",e),...t})}const ae={default:!1,plan:!1,acceptEdits:!1,dontAsk:!0,bypassPermissions:!0,auto:!0};function le(e){return ae[e]??!1}function se(e){try{return O.toString(e)}catch{return`On the schedule ${e}`}}function fe(e){const t=e.cron?se(e.cron):"Runs only when you ask",a=$(e.startsEnabled);return`${t}, ${a}. This job ${D(e.permissionMode)}.`}function be(e,t){const a=F(),{enabled:r=!0,...s}=t??{},o=Object.keys(s).length>0;return V({queryKey:G.permissionPreview(e??"",o?s:void 0),queryFn:()=>a.previewMarketplacePackage(e,o?s:void 0),enabled:r&&e!==null,staleTime:3e4,networkMode:"always"})}function P(e){const t=e==null?void 0:e.body,a=Array.isArray(t==null?void 0:t.errors)?t.errors.filter(r=>typeof r=="string"):[];return a.length>0?{reasons:a,checked:!0}:{reasons:e instanceof Error&&e.message?[e.message]:[],checked:!1}}function ge(e){return P(e).checked}function ve({error:e}){const{reasons:t,checked:a}=P(e);return n.jsxs("div",{role:"alert",className:"border-destructive/40 bg-destructive/5 space-y-2 rounded-md border p-3 text-sm",children:[n.jsxs("p",{className:"text-destructive flex items-center gap-2 font-medium",children:[n.jsx(L,{className:"size-4 shrink-0","aria-hidden":!0}),"DorkOS won’t install this package"]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:a?"What it found:":"It couldn’t check what this package does."}),t.length>0&&n.jsx("ul",{className:"text-muted-foreground list-disc space-y-1 pl-5 text-xs [overflow-wrap:anywhere]",children:t.map(r=>n.jsx("li",{children:r},r))})]})}export{ve as P,ie as T,ce as a,ue as b,de as c,fe as d,ge as i,le as r,be as u};
|
package/dist/client/assets/{PromptSuggestionChips-B_oUtFMI.js → PromptSuggestionChips-YdKEWyNT.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as
|
|
1
|
+
import{j as e,U as c,aC as l,ab as i}from"./index-Bbffv0TQ.js";const p=4,m={compact:"max-w-[200px] gap-1.5 px-2.5 py-1 text-xs",comfortable:"min-h-9 max-w-[280px] gap-2 px-3 py-1.5 text-sm"};function u({suggestions:o,onChipClick:s,ariaLabel:r="Suggested follow-ups",size:a="compact"}){const n=o.slice(0,p);return e.jsx(c.div,{"data-slot":"prompt-suggestion-chips",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},role:"group","aria-label":r,className:"mt-1.5 flex flex-wrap items-center gap-2",children:n.map(t=>e.jsxs("button",{type:"button","aria-label":t,title:t,onClick:()=>s(t),className:i("bg-secondary text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:ring-ring inline-flex items-center truncate rounded-md transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-offset-2",m[a]),children:[e.jsx(l,{className:i("shrink-0",a==="compact"?"size-3":"size-3.5")}),e.jsx("span",{className:"truncate",children:t})]},t))})}export{u as P};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D24Ttd-y.js","assets/index-Bbffv0TQ.js","assets/index-_GlgFH88.css","assets/room-files-source-BHupFaLE.js","assets/file-exclamation-point-D8KYFYSh.js","assets/composer-insert-BpyATrmR.js","assets/index-xfBvKz-h.js","assets/file-drag-GDx2qhdk.js","assets/rotate-cw-BDweizfR.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{V as ee,r as a,mm as Kt,j as i,g as Gt,hj as Vt,ab as Y,a5 as te,ae as Yt,ew as K,a6 as ye,kC as Ke,aE as ne,mn as oe,mo as Qt,mp as Jt,ay as Xt,mq as re,mr as Ie,k1 as Zt,ms as en,a7 as le,mt as Ge,mu as tn,mv as ke,mw as Ve,mx as nn,my as sn,mz as on,lE as rn,mA as an,mB as ln,lI as cn,mC as dn,e8 as un,mD as mn,mE as fn,an as pn,bd as hn,mF as gn,mG as xn,da as yn,kj as it,gX as bn,mH as vn,mI as Rn,hv as Q,iV as Ye,mJ as lt,bm as kn,iU as ue,mK as wn,mL as Sn,iY as ct,mM as Nn,iZ as dt,gb as In,bq as ut,j2 as mt,B as Ee,aV as Cn,mN as jn,mO as An,bN as Oe,mP as Mn,x as fe,mQ as Tn,ib as ft,mR as pt,fv as En,aI as On,e as ae,mS as be,iX as ht,j4 as gt,n as _n,w as Ce,mT as Pn,mU as xt,fi as se,cP as yt,f1 as Dn,mV as $n,mW as Ln,mX as Fn,mY as Bn,l as bt,U as _e,iI as qn,gd as zn,mZ as Hn,m_ as Un,m$ as Wn,aW as Kn,bz as Gn,n0 as Vn,n1 as Yn,n2 as Qn,n3 as Jn,be as je,d5 as Xn,iO as Zn,iT as es,iM as ts,n4 as ns,n5 as ss,n6 as os,n7 as rs,fl as as,iP as is,n8 as ls,n9 as cs,na as ds,nb as us,X as ms,nc as fs,nd as Qe,ne as ps,ds as hs,nf as gs,hu as xs,ng as ys,nh as bs,aw as vs}from"./index-Bbffv0TQ.js";import{R as Rs,A as ks,u as ws,P as Ss,a as Ns}from"./use-jump-back-in-BdLBzvDr.js";import{a as Is}from"./use-room-follow-claim-BIK37Iy3.js";import{f as Pe,a as vt,b as Rt,c as Cs,M as V,d as js,C as X,u as As,e as Ms,g as Ts}from"./index-HgvJwMGi.js";import{f as De,u as Es,b as Os,D as _s,U as Ps}from"./UnreadDivider-Dh67_mAz.js";import{f as Ds}from"./format-duration-BCr6uzby.js";import{H as $s,a as Ls,b as Fs}from"./hover-card-FvX18DHP.js";import{M as Je}from"./mention-pill-BHC6tMG9.js";import{R as Bs}from"./rotate-ccw-clock-BvzfP8lR.js";import{M as qs}from"./message-square-off-CEHuZJtY.js";import{m as zs,A as Hs}from"./AgentRequestCard-D62XQXBM.js";/**
|
|
3
|
+
* @license lucide-react v1.48.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/const kt={name:"hand",size:24,node:[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]};kt.node;const Us=ee(kt);/**
|
|
8
|
+
* @license lucide-react v1.48.0 - ISC
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the ISC license.
|
|
11
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/const wt={name:"link-2-off",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]};wt.node;const Ws=ee(wt);/**
|
|
13
|
+
* @license lucide-react v1.48.0 - ISC
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the ISC license.
|
|
16
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/const St={name:"megaphone",size:24,node:[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]]};St.node;const Ks=ee(St);/**
|
|
18
|
+
* @license lucide-react v1.48.0 - ISC
|
|
19
|
+
*
|
|
20
|
+
* This source code is licensed under the ISC license.
|
|
21
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
+
*/const Nt={name:"power-off",size:24,node:[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};Nt.node;const Gs=ee(Nt);/**
|
|
23
|
+
* @license lucide-react v1.48.0 - ISC
|
|
24
|
+
*
|
|
25
|
+
* This source code is licensed under the ISC license.
|
|
26
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
+
*/const It={name:"reply",size:24,node:[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]};It.node;const Vs=ee(It);/**
|
|
28
|
+
* @license lucide-react v1.48.0 - ISC
|
|
29
|
+
*
|
|
30
|
+
* This source code is licensed under the ISC license.
|
|
31
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
32
|
+
*/const Ct={name:"timer",size:24,node:[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]};Ct.node;const Ys=ee(Ct);/**
|
|
33
|
+
* @license lucide-react v1.48.0 - ISC
|
|
34
|
+
*
|
|
35
|
+
* This source code is licensed under the ISC license.
|
|
36
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
+
*/const jt={name:"user-minus",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]};jt.node;const Xe=ee(jt);/**
|
|
38
|
+
* @license lucide-react v1.48.0 - ISC
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the ISC license.
|
|
41
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/const At={name:"user-x",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]};At.node;const Qs=ee(At),Js=300;function ce({className:e,children:t}){return i.jsx("span",{className:Y("bg-muted text-muted-foreground text-2xs inline-flex max-w-full items-center gap-1 truncate rounded-full px-2 py-0.5",e),children:t})}function Mt({identity:e,children:t,onViewProfile:s,className:n}){const{kind:o,displayName:r,handle:l,color:c,emoji:h,imageUrl:p,origin:u,agent:d}=e,k=c??"hsl(var(--muted-foreground))",f=typeof u=="object"&&u!==null,g=o==="agent"&&(d==null?void 0:d.working)!=null?d.working:null,[y,x]=a.useState(!1),N=a.useRef(!1),m=a.useRef(null),b=Kt({onLongPress:()=>{N.current&&x(!0)}});return i.jsxs($s,{open:y,onOpenChange:x,openDelay:Js,children:[i.jsx(Ls,{asChild:!0,ref:m,"data-gesture-priority":"",...b,onPointerDown:T=>{N.current=T.pointerType==="touch"||T.pointerType==="pen",b.onPointerDown(T)},children:t}),i.jsxs(Fs,{"data-slot":"identity-hover-card",align:"start",className:Y("flex w-64 flex-col gap-0 overflow-hidden p-0",n),children:[i.jsxs("div",{className:"flex items-center gap-3 p-3",children:[i.jsx(Gt,{"aria-hidden":!0,color:k,emoji:h,imageUrl:p,fallback:Vt(r),kind:o,origin:u,status:g?"working":"idle",size:"md"}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-foreground truncate text-sm font-semibold",children:r}),l&&i.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",l]})]})]}),i.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[o==="agent"&&((d==null?void 0:d.runtime)||(d==null?void 0:d.model))&&i.jsx(ce,{children:[d.runtime,d.model].filter(Boolean).join(" · ")}),g&&i.jsxs(ce,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",Ds(g.forMs)]}),o==="human"&&i.jsx(ce,{children:f?u.platform:"On this machine"}),o==="agent"&&(d==null?void 0:d.managedBy)&&i.jsxs(ce,{children:["Managed by"," ",d.managedBy.handle?`@${d.managedBy.handle}`:d.managedBy.displayName]})]}),s?i.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var T;(T=m.current)==null||T.focus(),s()},className:"border-border hover:bg-accent focus-visible:ring-ring text-brand mt-auto flex w-full items-center border-t px-3 py-2 text-left text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none",children:"View profile"}):i.jsxs("div",{className:"border-border mt-auto flex items-center justify-between border-t px-3 py-2",children:[i.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:"View profile"}),i.jsx("span",{className:"text-muted-foreground text-3xs tracking-wide uppercase",children:"soon"})]})]})]})}function Tt(e,t={}){const s=te();return Yt({queryKey:K.sessions(e??""),queryFn:()=>s.listRoomSessions(e),enabled:e!==null&&t.enabled===!0})}function Xs(e,t){const s=e??[];return s.some(n=>n.seq===t.seq)?s:s.length===0||s[s.length-1].seq<t.seq?[...s,t]:[...s,t].sort((n,o)=>n.seq-o.seq)}function Zs(e,t){const s=e??[],n=s.findIndex(c=>c.id===t.id);if(n===-1)return s;const o=s[n];if(o.seq!==t.seq||o.roomId!==t.roomId||JSON.stringify(o.body)===JSON.stringify(t.body)&&JSON.stringify(o.mentions)===JSON.stringify(t.mentions)&&JSON.stringify(o.mentionSpans)===JSON.stringify(t.mentionSpans))return s;const l=[...s];return l[n]={...o,body:t.body,mentions:t.mentions,mentionSpans:t.mentionSpans},l}function eo(e,t){if(t.kind!=="notice"||t.body.notice!=="turn_failed")return;const s=t.body.subjectAuthorId;s!==void 0&&re.getState().clearAuthor(e,s)}function to(e,t){const s=e.getQueryData(K.entries(t));return s&&s.length>0?s[s.length-1].seq:0}function no(e,t){var s;return((s=e.getQueryData(K.detail(t)))==null?void 0:s.viewerAuthorId)??null}const so=2e3;function oo(){const e=a.useRef(null),t=a.useCallback(()=>{e.current!==null&&(clearTimeout(e.current),e.current=null)},[]),s=a.useCallback(o=>{t(),ne.getState().endRoomCanvasCycle(o)},[t]),n=a.useCallback(o=>{t(),e.current=setTimeout(()=>{e.current=null,ne.getState().endRoomCanvasCycle(o)},so)},[t]);return a.useEffect(()=>t,[t]),{arm:n,now:s}}function ro(e){const t=Math.min(oe.BACKOFF_CAP_MS,oe.BACKOFF_BASE_MS*2**e);return Math.random()*t}const ao=50;function io(e,t){return new Promise(s=>{if(t.aborted)return s();const n=()=>{clearTimeout(o),t.removeEventListener("abort",n),s()},o=setTimeout(n,e);t.addEventListener("abort",n,{once:!0})})}function lo(e,t){const s=te(),n=ye(),[o,r]=a.useState(null),[l,c]=a.useState(null),[h,p]=a.useState(0),u=a.useRef(!1),d=oo(),k=a.useCallback(()=>p(y=>y+1),[]),f=a.useRef(null),g=a.useCallback(()=>{f.current===null&&(f.current=setTimeout(()=>{f.current=null,p(y=>y+1)},ao))},[]);return a.useEffect(()=>{if(e===null)return;const y=()=>g();let x=null;const N=()=>{if(document.visibilityState!=="visible"){x=Date.now();return}const T=x===null?0:Date.now()-x;x=null,(u.current||T>=oe.VISIBILITY_GRACE_MS)&&g()};let m=Ke.getListConnectionState();const b=Ke.subscribeListConnectionState(T=>{const E=T==="connected"&&m==="reconnecting";m=T,E&&g()});return window.addEventListener("online",y),document.addEventListener("visibilitychange",N),()=>{window.removeEventListener("online",y),document.removeEventListener("visibilitychange",N),b(),f.current!==null&&(clearTimeout(f.current),f.current=null)}},[e,g]),a.useEffect(()=>(ne.getState().setRoomCanvasLiveRoom(e),()=>ne.getState().setRoomCanvasLiveRoom(null)),[e]),a.useEffect(()=>{if(e===null||!t)return;const y=new AbortController;let x=!0,N;return(async()=>{r(null),c(null),u.current=!1;let m=0,b=!1;const T=()=>{m=0,u.current=!1,b&&(b=!1,r(E=>E===e?null:E))};for(;x&&!y.signal.aborted;){const E=Date.now();u.current=!1,ne.getState().beginRoomCanvasCycle(e),d.arm(e);const D=setTimeout(T,oe.STABILITY_WINDOW_MS);let C;try{if(C=Qt(s,e,to(n,e),y.signal),N=C,!x||y.signal.aborted){C.retire();return}for await(const S of C.stream){if(!x||y.signal.aborted||(T(),!C.current()))return;if(S.type==="canvas_event"||S.type==="canvas_channel_snapshot"){if(C.publish(S),!C.current())return;continue}if(S.type==="signal"){Jt(S)?Xt.getState().observe(e,S):(re.getState().observe(e,S),ne.getState().applyRoomCanvasPresence(e,S));continue}if(S.type==="reaction"){n.setQueryData(K.entries(e),_=>Ie(_,S.entryId,S.reactions));continue}if(S.type==="revision"){if(S.entry.roomId!==e)continue;n.setQueryData(K.entries(e),_=>Zs(_,S.entry));continue}if(S.type==="canvas"){ne.getState().applyRoomCanvasFrame(e,S,no(n,e)),S.change!==void 0?d.now(e):d.arm(e);continue}re.getState().clearAuthor(e,S.entry.authorId),eo(e,S.entry),Zt.getState().settle(e,S.entry.id),n.setQueryData(K.entries(e),_=>Xs(_,S.entry))}}catch(S){if(y.signal.aborted)return;if(console.warn("[rooms] live stream dropped",{roomId:e,err:S}),en(S)){re.getState().clearRoom(e),c(e),r(e),clearTimeout(D);return}}finally{try{C==null||C.retire()}finally{clearTimeout(D)}}if(y.signal.aborted)return;Date.now()-E>=oe.STABILITY_WINDOW_MS&&(m=0),m+=1,u.current=!0,m>=oe.DISCONNECTED_THRESHOLD&&!b&&(re.getState().clearRoom(e),r(e),b=!0),await io(ro(m),y.signal)}})(),()=>{x=!1;try{N==null||N.retire()}finally{y.abort()}}},[e,t,s,n,h]),{stalled:o!==null&&o===e,unavailable:l!==null&&l===e,retry:k}}function co(){const e=te();return le({mutationFn:({roomId:t,authorId:s})=>e.haltRoomAgent(t,s),meta:{errorLabel:"Couldn’t stop this agent"}})}function uo(){const e=te();return le({mutationFn:({roomId:t,authorId:s})=>e.promoteHold(t,s),meta:{errorLabel:"Couldn’t ask to be answered first"}})}function mo(){const e=te(),t=ye();return le({onMutate:({roomId:s,entryId:n,emoji:o,viewerAuthorId:r})=>{var u;const l=t.getQueryData(K.entries(s)),c=(u=l==null?void 0:l.find(d=>d.id===n))==null?void 0:u.reactions,{reactions:h,on:p}=Ge(c,o,r);return t.setQueryData(K.entries(s),d=>Ie(d,n,h)),{on:p}},mutationFn:({roomId:s,entryId:n,emoji:o,viewerAuthorId:r})=>{var h,p;const l=t.getQueryData(K.entries(s)),c=((p=(h=l==null?void 0:l.find(u=>u.id===n))==null?void 0:h.reactions)==null?void 0:p.some(u=>u.emoji===o&&u.authorIds.includes(r)))??!1;return e.toggleReaction(s,n,{emoji:o,on:c})},onError:(s,{roomId:n,entryId:o,emoji:r,viewerAuthorId:l},c)=>{c!==void 0&&t.setQueryData(K.entries(n),h=>{var d;const p=(d=h==null?void 0:h.find(k=>k.id===o))==null?void 0:d.reactions,{reactions:u}=Ge(p,r,l,!c.on);return Ie(h,o,u)})},onSuccess:({frequents:s},{roomId:n})=>{t.setQueryData(K.detail(n),o=>o&&{...o,reactionFrequents:s})},meta:{errorLabel:"Couldn’t add your reaction",errorToastId:"room-reaction"}})}function Z(e){return e.threadRootEntryId??e.parentEntryId}function Et(e){return Z(e)??e.id}function $e(e,t){return Math.max(t??0,e)}function fo(e,t,s){let n=e[0],o=0;for(const r of e)r.seq>n.seq&&(n=r),t!==null&&r.seq>t&&(o+=1);return{count:$e(e.length,s),lastAt:n.createdAt,unread:o}}function po(e){const t=te(),s=ye(),n=tn(e),o=ke(u=>{var d;return e===null?null:((d=u.paging[e])==null?void 0:d.cursor)??null}),r=le({mutationFn:async u=>{var x;const d=(x=ke.getState().paging[u])==null?void 0:x.cursor;if(d==null)return;const k=await t.listRoomEntries(u,{before:d,limit:Ve}),f=K.entries(u),g=s.getQueryData(f),y=nn(g,k);s.setQueryData(f,y),ke.getState().notePage(u,sn(k)??d,on(k,Ve)||y.length===((g==null?void 0:g.length)??0))},meta:{errorLabel:"Couldn't load older messages"}}),{mutateAsync:l,isPending:c}=r,h=a.useRef(!1),p=a.useCallback(async()=>{if(!(e===null||h.current)){h.current=!0;try{await l(e).catch(()=>{})}finally{h.current=!1}}},[e,l]);return{canLoadOlder:n,isLoadingOlder:c,cursor:o,loadOlder:p}}const ho={turn_failed:{Icon:pn,tone:"text-status-warning"},agent_busy:{Icon:fn},agent_gone:{Icon:Qs,tone:"text-status-warning"},agent_left:{Icon:Xe,tone:"text-status-warning"},room_archived:{Icon:mn},runtime_gone:{Icon:Gs,tone:"text-status-warning"},agent_declined:{Icon:qs},agent_unavailable:{Icon:un},awaiting_approval:{Icon:Us,tone:"text-status-warning"},halted:{Icon:dn},budget_reached:{Icon:cn},cascade_stopped:{Icon:ln},addressing_changed:{Icon:Ks},bridge_blocked:{Icon:an,tone:"text-status-warning"},bridge_undelivered:{Icon:rn,tone:"text-status-warning"},bridge_rate_limited:{Icon:Ys},bridge_second_agent_refused:{Icon:Xe},bridge_disconnected:{Icon:Ws},bridge_agent_swapped:{Icon:Rs},bridge_history_note:{Icon:Bs}},go={Icon:hn},we=80;function xo(e){const t=e.trim();if(t.length<=we)return t;const s=t.slice(0,we),n=s.lastIndexOf(" ");return`${(n>we/2?s.slice(0,n):s).trimEnd()}…`}function yo(e,t,s){const n=bo(e,s),o=r=>i.jsx("a",{href:t.href,onClick:t.onOpen,"data-testid":"room-notice-session-link",className:"focus-ring hover:text-foreground rounded py-2 font-medium underline underline-offset-2",children:r});return n===null?i.jsxs(i.Fragment,{children:[e," ",o("Open chat")]}):i.jsxs(i.Fragment,{children:[e.slice(0,n.index),o(n.words),e.slice(n.index+n.words.length)]})}function bo(e,t){if(t!==void 0){const n=gn(t),o=e.lastIndexOf(n);if(o!==-1)return{index:o,words:n}}const s=xn.exec(e);return s===null?null:{index:s.index,words:s[0]}}function vo({entry:e,feedPosition:t,rowId:s,sessionLink:n,subjectName:o}){const{Icon:r,tone:l}=(e.body.notice&&ho[e.body.notice])??go;return i.jsxs("p",{id:s,"data-slot":"notice-row","data-testid":"room-notice","data-notice":e.body.notice??"unknown",...t&&{role:"article","aria-label":xo(e.body.text)},...De(t),className:Y("focus-visible:ring-ring flex items-start gap-2 px-[var(--msg-padding-x)] py-2 text-xs outline-none focus-visible:ring-2",l??"text-muted-foreground"),children:[i.jsx(r,{"aria-hidden":!0,className:"mt-px size-3.5 shrink-0"}),i.jsx("span",{children:n?yo(e.body.text,n,o):e.body.text})]})}const Ro=yn.moment;function ko({entry:e,moment:t,subject:s,subjectIdentity:n,feedPosition:o,rowId:r}){const l=Pe(e.createdAt);return i.jsx("div",{id:r,"data-slot":"moment-row","data-testid":"room-moment","data-moment":t.kind,role:"article","aria-label":`Moment: ${e.body.text}`,...De(o),className:"focus-visible:ring-ring px-[var(--msg-padding-x)] py-1 outline-none focus-visible:ring-2",children:i.jsxs("div",{className:"border-border/60 bg-muted/40 flex items-center gap-2.5 rounded-lg border px-3 py-2",children:[i.jsx(Mt,{identity:{kind:s.kind,displayName:s.displayName,handle:n==null?void 0:n.handle,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl,origin:n==null?void 0:n.origin,agent:n==null?void 0:n.agent},children:i.jsxs("span",{"data-testid":"room-moment-identity",className:"flex shrink-0 items-center",children:[i.jsx(vt,{author:s}),i.jsx("span",{className:"sr-only",children:s.displayName})]})}),i.jsx(Ro,{"data-testid":"room-moment-mark","aria-hidden":!0,className:"text-muted-foreground size-3.5 shrink-0"}),i.jsx("p",{className:"min-w-0 flex-1 text-sm",children:e.body.text}),l.length>0&&i.jsx("time",{dateTime:e.createdAt,title:Rt(e.createdAt),className:"text-msg-timestamp shrink-0 text-xs",children:l})]})})}function wo({id:e,summary:t,open:s,onOpen:n}){const{capabilities:o}=it(),{count:r,lastAt:l,unread:c}=t,h=Pe(l),[p,u]=a.useState({count:r,bumped:!1});p.count!==r&&u({count:r,bumped:!0});const d=p.count===r&&p.bumped;return o.threads?i.jsxs("button",{type:"button",id:e,"data-slot":"thread-reply-row","data-testid":"room-thread-replies","data-unread":c>0?"":void 0,"aria-expanded":s,onClick:n,className:Y("focus-ring ml-[calc(var(--msg-padding-x)_+_var(--msg-gutter-width)_+_var(--msg-gap))]","mb-1 w-fit rounded text-left text-xs transition-colors","px-2 py-2 md:px-1 md:py-0.5",c>0?"text-primary hover:text-primary/80 font-medium":"text-muted-foreground hover:text-foreground"),children:[i.jsx("span",{"aria-hidden":!0,className:"mr-1",children:"↳"}),i.jsx("span",{className:Y(d&&"motion-safe:animate-count-flip"),"data-testid":"room-thread-reply-count",children:r},r),r===1?" reply":" replies",h.length>0&&i.jsxs(i.Fragment,{children:[" · last ",i.jsx("time",{dateTime:l,title:Rt(l),children:h})]}),c>0&&` · ${c} new`]}):null}function So(e,t){const s=ue.getState(),n=s.drafts[e]??"",o=n===""||n.endsWith(" ")||n.endsWith(`
|
|
43
|
+
`)?"":" ";s.set(e,`${n}${o}@${t} `)}function No({roomId:e,entry:t,author:s,viewerAuthorId:n,onViewProfile:o}){const r=Et(t),l=t.body.text,c=(s==null?void 0:s.id)===n?void 0:(s==null?void 0:s.handle)??void 0,h=s==null?void 0:s.displayName,{copy:p}=bn({toastOnSettle:!0});return a.useMemo(()=>{const u={reply:{id:"reply",label:"Reply in thread",icon:Vs,run:()=>{Q.getState().openThread(e,r,!0),Ye.getState().requestFocus(lt(e,r))}},copy:{id:"copy",label:"Copy text",icon:Rn,run:()=>void p(l)}};return o!==void 0&&(u.profile={id:"profile",label:"View profile",icon:kn,run:o}),c!==void 0&&(u.mention={id:"mention",label:h===void 0?"Mention author":`Mention ${h}`,icon:ks,run:()=>{So(e,c),Ye.getState().requestFocus(e)}}),vn.map(d=>u[d]).filter(d=>d!==void 0)},[e,r,l,c,h,o,p])}function Io(e){return i.jsx(Sn,{code:e.code,isIncomplete:e.isIncomplete})}const Co=[{language:wn,component:Io}];function jo(e){if(e.kind==="notice")return{kind:"notice"};const t=e.body.moment;return t?{kind:"moment",moment:t}:{kind:"message"}}function Le(e,t=[]){return new Map([...t.map(s=>[s.author.id,{...s.author,origin:s.origin}]),...e.map(s=>[s.author.id,{...s.author,origin:s.origin}])])}function pe(e,t){const s=e.body.subjectAuthorId;return s===void 0||t.has(e.authorId)?e.authorId:s}function J(e,t,s){const n=t.get(e),o=ct({record:{kind:(n==null?void 0:n.kind)??"system",id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:n==null?void 0:n.emoji,color:n==null?void 0:n.color,imageUrl:n==null?void 0:n.imageUrl},override:(n==null?void 0:n.agentRef)===void 0?null:s==null?void 0:s.get(n.agentRef)});return{kind:o.kind,id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:o.emoji,imageUrl:o.imageUrl,color:o.color,isExternal:typeof(n==null?void 0:n.origin)=="object"&&(n==null?void 0:n.origin)!==null,...(n==null?void 0:n.retired)===!0?{retired:!0}:{}}}function Ao(e){const t=new Set;for(const r of e)Z(r)===null&&t.add(r.id);const s=[],n=new Map,o=new Set;for(const r of e){const l=Z(r);if(l===null){s.push(r);continue}if(!t.has(l)){s.push(r),o.add(r.id);continue}const c=n.get(l);c?c.push(r):n.set(l,[r])}return{topLevel:s,repliesByRoot:n,orphaned:o}}function Ot(e){return`thread-${e}`}function he(e){return`thread-row-${e}`}function Ae(e){return`thread-panel-entry-${e}`}function ge(e){return`room-entry-${e}`}function Fe(e,t){const s=e.find(c=>c.id===t);if(s===void 0)return null;const n=Z(s)??null,o={rowId:t,domId:ge(t)};if(n===null)return o;const r=e.find(c=>c.id===n);return r!==void 0&&(Z(r)??null)===null?{rowId:Ot(n),domId:he(n)}:o}function Mo(e,t){if(t===null)return null;const s=e.find(n=>n.seq===t);return s===void 0?null:Fe(e,s.id)}const Ze=48;function _t(e,t,s){const n=e.body.answersEntryId;if(n===void 0||n===e.id||t!==void 0&&t.id===n)return null;const o=s(n);if(o===void 0)return null;const r=o.body.text.replace(/\s+/gu," ").trim();return r.length===0?null:{entryId:n,excerpt:r.length>Ze?`${r.slice(0,Ze).trimEnd()}…`:r}}function To(e,t){const s=new Map;for(const n of e){const o=t[n.projectPath];if(!o)continue;const r=Nn({runtime:o.runtime,model:o.model});s.set(dt(n.projectPath),{memberId:n.id,visual:In(o),runtime:r.label,...r.modelLabel!==null&&{model:r.modelLabel}})}return s}function Eo(e){const t=new Map;for(const[s,n]of e)t.set(s,n.visual);return t}const Oo={info:new Map,faces:new Map},Be=a.createContext(Oo);function Pt({known:e,children:t}){return i.jsx(Be.Provider,{value:e,children:t})}function qe(){const e=ut(),t=a.useMemo(()=>{var l;return((l=e.data)==null?void 0:l.agents)??[]},[e.data]),s=a.useMemo(()=>t.map(l=>l.projectPath),[t]),n=mt(s),o=a.useMemo(()=>To(t,n.data??{}),[t,n.data]),r=a.useMemo(()=>Eo(o),[o]);return a.useMemo(()=>({info:o,faces:r}),[o,r])}function Me(e){const t=a.useContext(Be);return e===void 0?void 0:t.info.get(e)}function _o(){return a.useContext(Be).faces}function Po({loading:e,onLoad:t}){return i.jsx("div",{className:"flex justify-center px-4 py-3",children:i.jsxs(Ee,{type:"button",variant:"ghost",size:"sm",onClick:t,disabled:e,"data-testid":"room-load-older",className:"text-muted-foreground hover:text-foreground h-7 gap-2 text-xs",children:[e&&i.jsx(Cn,{size:"xs"}),e?"Loading older messages…":"Older messages"]})})}function Do({showAuthorHeader:e,headerId:t,displayName:s,time:n,summary:o,contentId:r,summaryId:l,feedPosition:c}){return{...e?{"aria-labelledby":t}:{"aria-label":n.length>0?`${s}, ${n}`:s},"aria-describedby":o===null?r:l,...De(c)}}const me=120,$o="code block";function Lo(e){if(e.length<=me&&!e.includes("```"))return null;const t=Fo(e);return t.length===0?null:t}function Fo(e){const t=e.replace(/```[\s\S]*?(?:```|$)/g,` ${$o} `).replace(/`([^`]*)`/g,"$1").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s{0,3}(?:#{1,6}\s+|>\s?|[-*+]\s+)/gm,"").replace(/^\s{0,3}\|?[\s:|-]*\|[\s:|-]*$/gm," ").replace(/\|/g," ").replace(/[*_~]{1,3}/g,"").replace(/\s+/g," ").trim();if(t.length<=me)return t;const s=Bo(t,me),n=s.lastIndexOf(" ");return`${(n>me/2?s.slice(0,n):s).trimEnd()}…`}function Bo(e,t){if(typeof Intl.Segmenter=="function"){const n=new Intl.Segmenter(void 0,{granularity:"grapheme"});let o="";for(const{segment:r}of n.segment(e)){if(o.length+r.length>t)break;o+=r}return o}let s="";for(const n of e){if(s.length+n.length>t)break;s+=n}return s}function qo({roomId:e,entry:t,viewerAuthorId:s,reactionFrequents:n,streamStalled:o,isMember:r=!0}){const l=mo(),c=o===!0||!r,h=a.useMemo(()=>t.reactions??[],[t.reactions]),p=a.useMemo(()=>h.filter(k=>jn(k,s)).map(k=>k.emoji),[h,s]),u=a.useCallback(k=>l.mutate({roomId:e,entryId:t.id,emoji:k,viewerAuthorId:s}),[l,e,t.id,s]),d=a.useMemo(()=>({quick:n,mine:p,onToggle:u,disabled:c}),[n,p,u,c]);return{reactions:h,toggle:u,quickRow:d}}function zo({barRef:e,pillsRef:t,hasReactions:s}){return n=>{var r,l;if(n.target!==n.currentTarget)return;const{key:o}=n;if(o==="ArrowDown"&&s){n.preventDefault(),(r=t.current)==null||r.focusFirst();return}o!=="ArrowRight"&&o!=="Enter"||(n.preventDefault(),(l=e.current)==null||l.focusFirst())}}function Ho(e,t){var d,k;const s=t.body.subjectAuthorId,n=t.body.notice,o=t.kind==="notice"&&n!==void 0&&s!==void 0&&An.includes(n),r=Tt(e,{enabled:o}),l=Oe(),c=ye(),h=te(),p=o?((k=(d=r.data)==null?void 0:d.bindings.find(f=>f.authorId===s))==null?void 0:k.sessionId)??null:null,u=a.useCallback(f=>{f.button!==0||f.metaKey||f.ctrlKey||f.shiftKey||f.altKey||(f.preventDefault(),!(p===null||s===void 0)&&Mn({queryClient:c,transport:h},e,s).then(g=>{g.kind!=="none"&&l(fe({session:g.kind==="bound"?g.sessionId:p}))}))},[s,l,c,e,p,h]);return a.useMemo(()=>p===null?null:{href:Tn({session:p}),onOpen:u},[u,p])}const xe="mention",ze="author_id",Uo={[xe]:[ze]},Wo=[xe];function Ko(e,t){if(!t||t.length===0)return e;const s=Go(e,t);if(s.length===0)return e;let n=e;for(let o=s.length-1;o>=0;o--){const{offset:r,length:l,authorId:c}=s[o],h=n.slice(0,r),p=n.slice(r,r+l),u=n.slice(r+l);n=`${h}<${xe} ${ze}="${c}">${p}</${xe}>${u}`}return n}function Go(e,t){const s=[...t].sort((r,l)=>r.offset-l.offset),n=[];let o=0;for(const r of s)r.offset<o||r.offset+r.length>e.length||(n.push(r),o=r.offset+r.length);return n}const Vo=new Map,Dt=a.createContext(Vo);function Yo({authors:e,children:t}){return i.jsx(Dt.Provider,{value:e,children:t})}function Qo(e){const t=a.useContext(Dt);return e===void 0?void 0:t.get(e)}function Jo(e){return typeof e=="string"?e.replace(/^@/,""):""}function Xo({authorId:e,children:t}){const s=Qo(e),n=Me(s==null?void 0:s.agentRef),{open:o}=ft();if(!s)return i.jsx(Je,{kind:"human",label:Jo(t),resolved:!1});const r=ct({record:s,override:n==null?void 0:n.visual}),l=pt(s,n==null?void 0:n.memberId),c=l===void 0?void 0:()=>o(l),h=c?{role:"button",tabIndex:0,"aria-label":`View ${s.displayName}’s profile`,onClick:c,onKeyDown:p=>{p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),c())}}:{};return i.jsx(Mt,{onViewProfile:c,identity:{kind:s.kind,displayName:s.displayName,handle:s.handle??void 0,color:r.color,emoji:r.emoji,imageUrl:r.imageUrl,origin:s.origin,agent:n&&{runtime:n.runtime,...n.model&&{model:n.model}}},children:i.jsx(Je,{kind:s.kind,label:s.displayName,handle:s.handle??void 0,color:s.color,origin:s.origin,resolved:!0,interactive:c!==void 0,...h})})}function Zo(e){return{mention:t=>{const s=t[ze],n=typeof s=="string"?s:void 0;return!n||!e.has(n)?i.jsx(i.Fragment,{children:t.children}):i.jsx(Xo,{authorId:n,children:t.children})}}}function er({entry:e,authors:t}){const s=a.useMemo(()=>Ko(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),n=a.useMemo(()=>{var r;return new Set(((r=e.mentionSpans)==null?void 0:r.map(l=>l.authorId))??[])},[e.mentionSpans]),o=a.useMemo(()=>Zo(n),[n]);return i.jsx(Yo,{authors:t,children:i.jsx(En,{content:s,className:"msg-prose",allowedTags:Uo,literalTagContent:Wo,components:o,renderers:Co})})}function tr(e){return function(s){return i.jsx(er,{entry:s,authors:e})}}const $t="the top folder";function et(e){return e.slice(e.lastIndexOf("/")+1)}function nr(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function sr(e){return e===""?$t:`${e}/`}function Se(e){return e.target!==void 0?e.target===""?$t:e.target:sr(nr(e.paths[0]??""))}function or(e,t){const s=e.paths[0]??"",n=e.target;switch(e.kind){case"edit":return`${t} edited ${n??s}`;case"add":return`${t} added ${n??s}`;case"upload":return e.pathCount===1?`${t} uploaded ${et(s)} to ${Se(e)}`:`${t} uploaded ${e.pathCount} files to ${Se(e)}`;case"rename":{const o=e.from??"";return n!==void 0?`${t} renamed ${o} to ${n}`:o.endsWith("/")?`${t} renamed ${o}`:`${t} renamed ${o} to ${s}`}case"delete":return n!==void 0?`${t} deleted ${n}`:e.pathCount===1?`${t} deleted ${s}`:`${t} deleted ${e.pathCount} files`;case"from-attachment":return`${t} saved ${et(s)} from the chat to ${Se(e)}`}}const rr=a.lazy(()=>On(()=>import("./index-D24Ttd-y.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(e=>({default:e.SaveToRoomFilesButton})));function Lt({roomId:e,entry:t,author:s,authorRef:n,authors:o,viewerAuthorId:r,authorNames:l,reactionFrequents:c,streamStalled:h,isMember:p=!0,grouping:u,orphanedReply:d,answers:k,feedPosition:f,rowId:g}){const y=Pe(t.createdAt),x=a.useMemo(()=>{const G=Lo(t.body.text),Re=Cs(t.attachments??[]);if(Re===null)return G;const We=G??t.body.text.trim();return We.length>0?`${We} ${Re}`:Re},[t.body.text,t.attachments]),N=a.useId(),m=`${N}-author`,b=`${N}-content`,T=`${N}-summary`,E=a.useRef(null),D=a.useRef(null),C=a.useRef(null),{reactions:S,toggle:_,quickRow:I}=qo({roomId:e,entry:t,viewerAuthorId:r,reactionFrequents:c,streamStalled:h,isMember:p}),L=Me(n==null?void 0:n.agentRef),{open:$}=ft(),O=n===void 0?void 0:pt(n,L==null?void 0:L.memberId),q=a.useCallback(()=>{O!==void 0&&$(O)},[$,O]),F=O===void 0?void 0:q,z=No({roomId:e,entry:t,author:n,viewerAuthorId:r,onViewProfile:F}),W=zo({barRef:D,pillsRef:C,hasReactions:S.length>0}),B=a.useCallback(()=>{var G;return(G=E.current)==null?void 0:G.focus()},[]),H=a.useMemo(()=>tr(o),[o]),w=a.useCallback(G=>i.jsx(a.Suspense,{fallback:null,children:i.jsx(rr,{roomId:e,attachment:G})}),[e]),v=_o(),P=t.body.subjectAuthorId??t.authorId,M=o.get(P),R=Me(M==null?void 0:M.agentRef),A=Ho(e,t),j=jo(t);if(j.kind==="notice")return i.jsx(vo,{entry:t,feedPosition:f,rowId:g,sessionLink:A,subjectName:M==null?void 0:M.displayName});if(j.kind==="moment")return i.jsx(ko,{entry:t,moment:j.moment,subject:P===t.authorId?s:J(P,o,v),subjectIdentity:{handle:(M==null?void 0:M.handle)??void 0,origin:M==null?void 0:M.origin,agent:R&&{runtime:R.runtime,...R.model&&{model:R.model}}},feedPosition:f,rowId:g});const U=u.position==="first"||u.position==="only";return i.jsxs(V.Root,{ref:E,id:g,position:u.position,actions:z,reactions:I,"data-testid":"room-entry",tabIndex:0,...Do({showAuthorHeader:U,headerId:m,displayName:s.displayName,time:y,summary:x,contentId:b,summaryId:T,feedPosition:f}),onKeyDown:W,children:[i.jsx(V.Gutter,{author:s,at:t.createdAt,onViewProfile:F,isSelf:t.authorId===r}),i.jsxs(V.Body,{children:[i.jsx(V.Author,{id:m,author:s,at:t.createdAt,origin:n==null?void 0:n.origin}),d===!0&&i.jsx("p",{"data-testid":"room-entry-orphan",className:"text-muted-foreground text-xs italic",children:"Replying to an earlier message"}),k!=null&&i.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs italic",children:`Answering “${k.excerpt}”`}),i.jsx(V.Content,{id:b,className:"[&_:not(pre)>code]:wrap-anywhere [&_pre]:overflow-x-auto",children:t.body.fileChange?i.jsx("p",{"data-testid":"room-entry-file-change",className:"wrap-anywhere",children:or(t.body.fileChange,(M==null?void 0:M.displayName)??"Somebody")}):H(t,{rowId:t.id,isStreaming:!1})}),x!==null&&i.jsx("span",{id:T,className:"hidden",children:x}),i.jsx(V.Attachments,{items:t.attachments??[],renderAction:p?w:void 0}),i.jsx(V.Reactions,{ref:C,reactions:S,viewerAuthorId:r,names:l,frequents:c,onToggle:_,disabled:h===!0||!p,onExit:B}),i.jsx(V.Actions,{actions:z,reactions:I,barRef:D,onExit:B})]})]})}const ar="room-load-older",ir=4;function Ft({roomName:e}){return i.jsx(js,{label:e===void 0?"Messages":`Messages in ${e}`,busy:!0,className:"flex flex-col gap-4 p-4","data-testid":"room-timeline-loading",children:Array.from({length:ir},(t,s)=>i.jsxs("div",{className:"flex gap-3",children:[i.jsx(ae,{className:"size-7 shrink-0 rounded-full"}),i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[i.jsx(ae,{className:"h-3 w-24"}),i.jsx(ae,{className:"h-3 w-full max-w-md"})]})]},`room-skeleton-${s}`))})}function lr({roomId:e,roomName:t,viewerAuthorId:s,entries:n,members:o,formerAuthors:r,lastReadSeq:l,reactionFrequents:c,streamStalled:h,isLoading:p,error:u,onAddAgents:d,openThreadId:k,onOpenThread:f,resumeRow:g,landOnRow:y,onTopRow:x,canLoadOlder:N=!1,isLoadingOlder:m=!1,onLoadOlder:b,ref:T}){const E=a.useMemo(()=>Le(o,r),[o,r]),D=be(o,s),C=qe(),S=a.useMemo(()=>new Map([...E].map(([v,P])=>[v,P.displayName])),[E]),_=ht(),I=gt(e,null),{topLevel:L,repliesByRoot:$,orphaned:O}=a.useMemo(()=>Ao(n),[n]),q=a.useMemo(()=>new Map(n.map(v=>[v.id,v])),[n]),F=a.useMemo(()=>{const v=Es(L,l),P=Os(L.map(R=>({id:R.id,authorId:R.body.moment?`moment:${R.id}`:R.authorId,timestamp:R.createdAt})),{now:_,lastSeenId:v.lastSeenId,unreadFromStart:v.fromStart}),M=[];N&&!p&&M.push({kind:"load-older",id:ar});for(const R of P){if(R.kind==="day-divider"){M.push({kind:"day-divider",id:R.key,label:R.label});continue}if(R.kind==="unread-divider"){M.push({kind:"unread-divider",id:R.key});continue}const A=L[R.index];M.push({kind:"message",id:A.id,entry:A,grouping:R.grouping,position:R.index+1,answers:_t(A,L[R.index-1],q.get.bind(q))});const j=$.get(A.id);j&&M.push({kind:"thread-reply",id:Ot(A.id),rootId:A.id,replies:j,totalReplies:A.threadReplyCount})}return M},[L,$,q,l,_,N,p]),z=a.useMemo(()=>F.map(v=>v.kind==="load-older"?{kind:"notice",id:v.id,at:"",body:null}:v.kind==="day-divider"?{kind:"day-divider",id:v.id,label:v.label}:v.kind==="unread-divider"?{kind:"unread-divider",id:v.id}:v.kind==="thread-reply"?{kind:"thread-reply",id:v.id,rootId:v.rootId,replyCount:$e(v.replies.length,v.totalReplies),lastAt:v.replies[v.replies.length-1].createdAt}:{kind:"message",id:v.id,payload:v.entry,grouping:v.grouping,author:J(pe(v.entry,E),E,C.faces),at:v.entry.createdAt}),[F,E,C.faces]),W=a.useCallback((v,P)=>{const M=F[P.index];if(M.kind==="load-older")return b===void 0?null:i.jsx(Po,{loading:m,onLoad:b});if(M.kind==="day-divider")return i.jsx(_s,{label:M.label});if(M.kind==="unread-divider")return i.jsx(Ps,{});if(M.kind==="thread-reply"){if(P.onOpenThread===void 0)return null;const A=P.onOpenThread;return i.jsx(wo,{id:he(M.rootId),summary:fo(M.replies,l,M.totalReplies),open:k===M.rootId,onOpen:()=>A(M.rootId)})}const R=pe(M.entry,E);return i.jsx(Lt,{roomId:e,entry:M.entry,author:J(R,E,C.faces),authorRef:E.get(R),authors:E,viewerAuthorId:s,authorNames:S,reactionFrequents:c,streamStalled:h,isMember:D,grouping:M.grouping,orphanedReply:O.has(M.entry.id),answers:M.answers,feedPosition:{index:M.position,total:-1},rowId:ge(M.entry.id)})},[F,e,E,C.faces,s,S,c,h,D,O,l,k,m,b]),B=a.useCallback(v=>{if(v.kind==="message")return ge(v.id);if(v.kind==="thread-reply")return he(v.rootId)},[]);if(u)return i.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[i.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load these messages"}),i.jsx("p",{className:"max-w-sm",children:"Nothing was lost. Reload to try again."})]});const H=o.some(v=>v.author.kind==="agent"),w=i.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[i.jsx(_n,{className:"text-muted-foreground/50 size-8","aria-hidden":!0}),i.jsx("p",{className:"text-foreground font-medium",children:"Nothing said here yet"}),i.jsx("p",{className:"max-w-sm",children:H?"Say something to get it going.":"Nothing answers until you add an agent."}),i.jsx(Ee,{type:"button",size:"sm",variant:H?"ghost":"default",onClick:d,className:"mt-1",children:H?"Add more agents":"Add agents"})]});return i.jsx(Pt,{known:C,children:i.jsx(X.Timeline,{ref:T,conversationId:e,label:`Messages in ${t}`,rows:z,renderRow:W,onOpenThread:f,domIdOf:B,...g===void 0?{}:{resumeRow:g},...y===void 0?{}:{landOnRow:y},...x===void 0?{}:{onTopRow:x},pending:I,viewerAuthorId:s,loading:p?i.jsx(Ft,{roomName:t}):void 0,empty:w,feedTestId:"room-timeline"})})}const He={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function cr(e){const t=te(),[s,n]=a.useState([]),o=a.useRef(new Map),r=a.useCallback(f=>{const g=f.map(y=>({id:crypto.randomUUID(),file:y,status:"pending",progress:0}));n(y=>[...y,...g])},[]),l=a.useCallback(f=>{o.current.delete(f),n(g=>g.filter(y=>y.id!==f))},[]),c=a.useCallback(f=>{if(!f){o.current.clear(),n([]);return}const g=new Set(f);for(const y of g)o.current.delete(y);n(y=>y.filter(x=>!g.has(x.id)))},[]),h=a.useCallback(f=>{o.current.delete(f),n(g=>g.map(y=>y.id===f&&y.status==="error"?{...y,status:"pending",progress:0,error:void 0}:y))},[]),p=a.useRef(null),u=le({meta:{suppressErrorToast:!0},mutationFn:async f=>{n(N=>N.map(m=>f.some(b=>b.id===m.id)?{...m,status:"uploading"}:m));const g=N=>{n(m=>m.map(b=>b.status==="uploading"?{...b,progress:N.percentage}:b))},y=new AbortController;p.current=y;const x=f.map(N=>N.file);return t.uploadRoomAttachments(e,x,g,y.signal)},onSettled:()=>{p.current=null},onSuccess:(f,g)=>{g.forEach((y,x)=>{const N=f[x];N&&o.current.set(y.id,N.id)}),n(y=>y.map(x=>g.findIndex(m=>m.id===x.id)===-1?x:{...x,status:"uploaded",progress:100}))},onError:f=>{n(g=>g.map(y=>y.status==="uploading"?{...y,status:"error",error:f.message}:y))}}),d=a.useCallback(()=>{var f;(f=p.current)==null||f.abort()},[]),k=a.useCallback(async()=>{const f=s.filter(y=>y.status==="error");if(f.length>0)throw new Error(f.length===1?`${f[0].file.name} didn’t upload. Try again or remove it.`:`${f.length} files didn’t upload. Try again or remove them.`);const g=s.filter(y=>y.status==="pending");return g.length>0&&await u.mutateAsync(g),s.map(y=>o.current.get(y.id)).filter(y=>y!==void 0)},[s,u]);return{pendingFiles:s,addFiles:r,removeFile:l,retryFile:h,clearFiles:c,cancelUpload:d,uploadAndGetIds:k,hasPendingFiles:s.length>0,hasFailedUpload:s.some(f=>f.status==="error"),isUploading:u.isPending}}function Bt(e){const{room:t,threadRootId:s}=e,n=As(),o=Ms(),r=cr((t==null?void 0:t.id)??""),l=t!==void 0&&be(t.members,t.viewerAuthorId),c=a.useRef({attachments:r,post:n,reply:o,room:t,threadRootId:s});a.useEffect(()=>{c.current={attachments:r,post:n,reply:o,room:t,threadRootId:s}});const h=a.useCallback(m=>c.current.attachments.addFiles(m),[]),p=a.useCallback(m=>c.current.attachments.removeFile(m),[]),u=a.useCallback(m=>c.current.attachments.retryFile(m),[]),d=a.useCallback(()=>c.current.attachments.cancelUpload(),[]),{pendingFiles:k,hasFailedUpload:f,isUploading:g}=r,y=a.useMemo(()=>({staged:k,add:h,remove:p,retry:u,cancel:d,hasFailed:f,isUploading:g,holdsSendWhileUploading:!1}),[k,f,g,h,p,u,d]),x=a.useCallback(async m=>{const{attachments:b,post:T,reply:E,room:D,threadRootId:C}=c.current;if(D===void 0)throw new Error("That room isn’t loaded yet.");if(D.archived)throw new Error("This room is archived.");Ce.getState().recordOpened("room",D.id);const S=Pn(),_=b.pendingFiles.map(O=>O.file.name),I=b.pendingFiles.map(O=>O.id),L=await b.uploadAndGetIds();b.clearFiles(I);const $=m.parentEntryId??C;if($!==void 0){E.mutate({roomId:D.id,rootEntryId:$,text:m.text,clientId:S,attachmentIds:L,attachmentNames:_});return}T.mutate({roomId:D.id,text:m.text,clientId:S,attachmentIds:L,attachmentNames:_})},[]);return{target:a.useMemo(()=>({kind:"room",id:(t==null?void 0:t.id)??"",placeholder:t===void 0?"Message…":s===void 0?`Message ${se(t)}…`:"Reply in this thread…",canSend:t!==void 0&&!t.archived&&l,...t===void 0?{canSendReason:"Still opening this room…"}:t.archived?{canSendReason:"This room is archived. You can read it, but not add to it."}:l?{}:{canSendReason:xt},send:x,attachments:y}),[t,s,l,y,x]),attachments:r}}function dr(e){const{roomId:t,entrySeq:s,entries:n,historyLoaded:o}=e,r=s===void 0?null:`${t}:${s}`,l=a.useMemo(()=>{if(s===void 0)return null;const g=n.find(m=>m.seq===s);if(g===void 0)return null;const y=Fe(n,g.id);if(y===null)return null;const x=Z(g)??null,N=x!==null&&y.rowId!==g.id;return{roomRowId:y.rowId,threadRootId:N?x:null,entryId:g.id}},[n,s]),c=a.useRef(null),h=(l==null?void 0:l.threadRootId)??null;a.useEffect(()=>{r===null||h===null||c.current!==r&&(c.current=r,Q.getState().openThread(t,h))},[r,t,h]);const p=a.useRef(null);a.useEffect(()=>{r===null||!o||l===null&&p.current!==r&&(p.current=r,yt.info("That message isn’t in the loaded history",{description:"Only recent messages are open. Nothing was lost."}))},[r,o,l]);const u=a.useRef(null),d=a.useCallback(()=>{if(!(r===null||u.current===r))return u.current=r,l==null?void 0:l.roomRowId},[r,l]),k=a.useRef(null),f=a.useCallback(()=>{if(!(r===null||k.current===r))return k.current=r,(l==null?void 0:l.threadRootId)===null||l==null?void 0:l.entryId},[r,l]);return{roomRow:s===void 0?void 0:d,threadRow:s===void 0?void 0:f}}function ur(e,t){const[s,n]=a.useState({roomId:null,seq:null});return s.roomId===e?s.seq:e===null?(n({roomId:null,seq:null}),null):t===null?null:(n({roomId:e,seq:t}),t)}const mr=600;function fr(e){return document.getElementById(he(e))??document.getElementById(ge(e))}function pr(){const e=a.useRef(null);return a.useEffect(()=>()=>{var s;return(s=e.current)==null?void 0:s.call(e)},[]),{arm:a.useCallback(s=>{var c;(c=e.current)==null||c.call(e);let n=0;const o=Date.now()+mr;let r=!1;const l=()=>{if(r)return;const h=document.activeElement;if(h===null||h===document.body||!h.isConnected){const u=fr(s);if(u!==null){u.focus();return}}Date.now()>=o||(n=requestAnimationFrame(l))};n=requestAnimationFrame(l),e.current=()=>{r=!0,cancelAnimationFrame(n)}},[])}}function hr({roomId:e,route:t,urlThreadId:s,openThreadId:n,entries:o,historyLoaded:r}){const l=Dn(),c=a.useRef(null);a.useEffect(()=>{if(e!==null){if(c.current!==e&&(c.current=e,s!==void 0)){Q.getState().openThread(e,s);return}if(r&&n!==void 0){const h=o.find(u=>u.id===n),p=h===void 0?void 0:Et(h);if(p!==void 0&&p!==n){const u=Q.getState().open[e];Q.getState().openThread(e,p,(u==null?void 0:u.focusComposer)??!1);return}}n!==s&&(l==null||l({to:t,search:h=>({...h,thread:n}),replace:!0}))}},[e,t,n,s,o,r,l])}const gr=6,qt="jump-back-in-listbox";function Ue(e){return`jump-back-in-item-${e}`}const xr='[role="combobox"]';function ie(e){return e instanceof Element&&e.matches(xr)}function yr({value:e,yieldToPalette:t=!1,enabled:s=!0}){const n=Oe(),o=$n(),[r,l]=a.useState(!1),[c,h]=a.useState({stamp:"",index:0}),[p,u]=a.useState(!1),[d,k]=a.useState(!1);e.length>0&&!d&&k(!0);const f=a.useRef(!1);a.useEffect(()=>{f.current=!0},[]);const{data:g}=ut({enabled:s}),y=a.useMemo(()=>((g==null?void 0:g.agents)??[]).map(w=>w.projectPath),[g]),{data:x}=mt(y,{enabled:s}),N=a.useMemo(()=>x??{},[x]),m=a.useMemo(()=>Ln(y,N),[y,N]),b=a.useMemo(()=>new Map(y.map(w=>[dt(w),w])),[y]),T=a.useCallback(w=>Fn({room:w,agentsByPath:N,pathByAgentRef:b}),[N,b]),E=a.useMemo(()=>Bn(o.muted),[o.muted]),{items:D}=ws({mutedRoomIds:E,enabled:s}),C=a.useMemo(()=>D.slice(0,gr),[D]),S=s&&r&&!p&&!d&&!t&&e.length===0&&C.length>0,_=`${S}:${C.length}`,I=c.stamp===_?c.index:0,L=a.useCallback(w=>{f.current&&ie(w.target)&&(u(!1),k(!1),l(!0))},[]),$=a.useCallback(w=>{ie(w.target)&&l(!0)},[]),O=a.useCallback(w=>{ie(w.target)&&l(!1)},[]),q=a.useCallback(w=>{C.length!==0&&h(v=>{const P=v.stamp===_?v.index:0;return{stamp:_,index:(P+w+C.length)%C.length}})},[C.length,_]),F=a.useCallback(()=>q(1),[q]),z=a.useCallback(()=>q(-1),[q]),W=a.useCallback(()=>{u(!0)},[]),B=a.useCallback(w=>{if(u(!0),w.kind==="session"){w.session.cwd&&Ce.getState().recordOpened("agent",w.session.cwd),n(fe({dir:w.session.cwd??void 0,session:w.session.id}));return}Ce.getState().recordOpened("room",w.room.id),n({...bt.channels(),search:{id:w.room.id}})},[n]),H=a.useCallback(()=>{const w=C[I];!S||!w||B(w)},[S,C,I,B]);return{isOpen:S,hasRows:C.length>0,rows:C,agents:N,displayNames:m,visualOf:T,selectedIndex:I,activeDescendantId:S&&C[I]!==void 0?Ue(I):void 0,listboxId:S?qt:void 0,handleFocus:L,handleBlur:O,handlePointerDown:$,moveDown:F,moveUp:z,selectHighlighted:H,selectRow:B,dismiss:W}}function zt({mark:e,label:t,title:s,summary:n,lastActivityAt:o,index:r,isSelected:l,now:c,onSelect:h}){const p=a.useMemo(()=>Number.isNaN(Date.parse(o))?null:Kn(o),[o,c]);return i.jsxs("div",{id:Ue(r),role:"option","aria-selected":l,"data-selected":l,title:s,onClick:h,className:"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-start gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[i.jsx("span",{className:"mt-px flex shrink-0 items-center",children:e}),i.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[i.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[i.jsx("span",{className:"text-foreground min-w-0 flex-1 truncate text-sm",children:t}),p!==null&&i.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:p})]}),n!==null&&i.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:n})]})]})}function br({item:e,agent:t,displayName:s,index:n,isSelected:o,now:r,onSelect:l}){const c=qn(t,e.session.cwd??s);return i.jsx(zt,{mark:i.jsx(zn,{color:c.color,emoji:c.emoji,size:"xs"}),label:e.name,title:`${s} · ${e.name}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:n,isSelected:o,now:r,onSelect:l})}function vr({item:e,visual:t,index:s,isSelected:n,now:o,onSelect:r}){return i.jsx(zt,{mark:i.jsx(Un,{room:e.room,participants:e.room.participants,visuals:Wn(t)}),label:i.jsx(Hn,{room:e.room}),title:e.summary===null?e.name:`${e.name} · ${e.summary}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:s,isSelected:n,now:o,onSelect:r})}function Rr({rows:e,selectedIndex:t,agents:s={},displayNames:n={},visualOf:o,onSelect:r}){const l=ht(6e4);return a.useEffect(()=>{var c,h;(h=(c=document.getElementById(Ue(t)))==null?void 0:c.scrollIntoView)==null||h.call(c,{block:"nearest"})},[t]),i.jsx(_e.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:c=>c.preventDefault(),children:i.jsx("div",{id:qt,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((c,h)=>{var p;return c.kind==="session"?i.jsx(br,{item:c,agent:c.session.cwd&&s[c.session.cwd]||null,displayName:c.session.cwd&&n[c.session.cwd]||((p=c.session.cwd)==null?void 0:p.split("/").pop())||"Agent",index:h,isSelected:h===t,now:l,onSelect:()=>r(c)},`session-${c.id}`):i.jsx(vr,{item:c,visual:o(c.room),index:h,isSelected:h===t,now:l,onSelect:()=>r(c)},`room-${c.id}`)})})})}const tt={people:"People",agents:"Agents"},kr=["people","agents"];function wr(e,t){const s=[];for(const{author:n}of e){if(n.kind==="system"||n.id===t||n.retired)continue;const o=n.handle;s.push({section:n.kind==="agent"?"agents":"people",authorId:n.id,label:n.displayName,...o?{handle:o}:{},...n.emoji?{emoji:n.emoji}:{},...n.color?{color:n.color}:{},disabled:!o,...o?{}:{disabledReason:"No @name"}})}return s}function Sr(e,t,s){const n=t.trim().toLowerCase(),o=e.map((r,l)=>({row:r,position:l,tier:Nr(r,n)})).filter(r=>r.tier!==null).sort((r,l)=>r.tier-l.tier||r.position-l.position);return s.flatMap(r=>o.filter(l=>l.row.section===r).map(({row:l})=>l))}function Nr(e,t){var o;if(t==="")return 0;const s=[(o=e.handle)==null?void 0:o.toLowerCase(),e.label.toLowerCase()].filter(r=>r!==void 0);let n=null;for(const r of s){const l=r===t?0:r.startsWith(t)?1:r.includes(t)?2:null;l!==null&&(n===null||l<n)&&(n=l)}return n}function de(e,t,s){var r;const n=e.length;if(n===0)return 0;let o=(t%n+n)%n;for(let l=0;l<n;l++){if(!((r=e[o])!=null&&r.disabled))return o;o=(o+s+n)%n}return 0}function Ir(e,t,s,n){const o=e.slice(0,t),r=e.slice(t+1+s.length),l=`@${n}`,c=r.startsWith(" ")?"":" ";return{value:o+l+c+r,cursorPos:o.length+l.length+1}}const Cr=/(^|\s)@([A-Za-z0-9_.-]*)$/,Ht="mention-palette-listbox";function Te(e){return`mention-item-${e}`}function jr({members:e,viewerAuthorId:t,text:s,sectionOrder:n=kr}){var $;const[o,r]=a.useState(!1),[l,c]=a.useState(""),[h,p]=a.useState(-1),u=Gn(s),d=a.useRef(!1),k=a.useMemo(()=>wr(e,t),[e,t]),f=a.useMemo(()=>o?Sr(k,l,n):[],[k,l,o,n]),[g,y]=a.useState(null),x=g!==null&&g.query===l&&g.open===o?g.index:de(f,0,1),N=f[x],m=f.length===0||N!==void 0&&!N.disabled?x:de(f,0,1),b=a.useCallback((O,q)=>{const F=O.slice(0,q).match(Cr);if(!F){r(!1);return}r(!0),c(F[2]),p((F.index??0)+F[1].length)},[]),T=a.useCallback(O=>{u.write(O),d.current=!1},[u]),E=a.useCallback(O=>{d.current||b(u.read(),O)},[b,u]),D=a.useCallback(()=>{y({query:l,open:o,index:de(f,m+1,1)})},[f,m,l,o]),C=a.useCallback(()=>{y({query:l,open:o,index:de(f,m-1,-1)})},[f,m,l,o]),S=a.useCallback(O=>O.disabled||O.handle===void 0?null:(d.current=!0,r(!1),Ir(u.read(),h,l,O.handle)),[h,l,u]),_=a.useCallback(()=>{const O=f[m];return O?S(O):(r(!1),null)},[f,m,S]),I=a.useCallback(()=>{d.current=!0,r(!1)},[]),L=f.some(O=>!O.disabled);return{isOpen:o,hasSelectableRows:L,rows:f,selectedIndex:m,activeDescendantId:o&&(($=f[m])==null?void 0:$.disabled)===!1?Te(m):void 0,listboxId:o?Ht:void 0,noteTextChange:T,handleCursorChange:E,moveDown:D,moveUp:C,selectHighlighted:_,selectRow:S,dismiss:I}}function Ar({rows:e,selectedIndex:t,onSelect:s}){const n=a.useMemo(()=>{const o=[];return e.forEach((r,l)=>{const c=o[o.length-1];c&&c.section===r.section?c.items.push({row:r,index:l}):o.push({section:r.section,items:[{row:r,index:l}]})}),o},[e]);return a.useEffect(()=>{var o;(o=document.getElementById(Te(t)))==null||o.scrollIntoView({block:"nearest"})},[t]),i.jsx(_e.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:o=>o.preventDefault(),children:i.jsx("div",{id:Ht,role:"listbox","aria-label":"Mentions",className:"max-h-72 overflow-y-auto p-1.5",children:e.length===0?i.jsx("div",{className:"text-muted-foreground px-2 py-4 text-center text-sm",children:"No one by that name."}):n.map(({section:o,items:r},l)=>i.jsxs("div",{role:"group","aria-label":tt[o],children:[l>0&&i.jsx("div",{className:"bg-border mx-2 my-1.5 h-px"}),i.jsx("div",{"aria-hidden":!0,className:"text-muted-foreground/70 text-2xs px-2 pt-1.5 pb-1 font-medium tracking-wide uppercase",children:tt[o]}),r.map(({row:c,index:h})=>{const p=h===t;return i.jsxs("div",{id:Te(h),role:"option","aria-selected":p,"aria-disabled":c.disabled,"data-selected":p,"data-disabled":c.disabled,onClick:()=>{c.disabled||s(c)},className:c.disabled?"flex cursor-not-allowed items-center gap-2 rounded-md px-2 py-1.5 opacity-45":"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[i.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:c.emoji}),i.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:c.label}),c.handle!==void 0&&i.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",c.handle]}),c.disabledReason!==void 0&&i.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:c.disabledReason})]},c.authorId)})]},o))})})}function Ut({room:e,threadRootId:t,focusOnMount:s,offerJumpBackIn:n,onFocusChange:o,attachments:r}){const l=t===void 0?e.id:lt(e.id,t),c=Vn(l),{target:h}=it(),p=Yn(),u=Qn(l),d=a.useRef(null),k=be(e.members,e.viewerAuthorId),f=a.useRef(!1),g=jr({members:e.members,viewerAuthorId:e.viewerAuthorId,text:c}),y=n===!0,x=yr({value:c,yieldToPalette:g.isOpen,enabled:y}),N=a.useRef(u);a.useEffect(()=>{var I;u!==N.current&&(N.current=u,(I=d.current)==null||I.focus())},[u]),a.useEffect(()=>{var I;s===!0&&((I=d.current)==null||I.focusUnlessTouch())},[]);const m=a.useCallback(I=>ue.getState().set(l,I),[l]),[b,T]=a.useState(null);a.useLayoutEffect(()=>{var I;b!==null&&((I=d.current)==null||I.focusAt(b.pos))},[b]);const E=a.useCallback(I=>{I&&(m(I.value),T({pos:I.cursorPos}))},[m]),D=a.useCallback(I=>E(g.selectRow(I)),[g,E]),C=a.useCallback(()=>E(g.selectHighlighted()),[g,E]),S=()=>{if(h===null||!h.canSend||f.current)return;g.dismiss();const I=ue.getState().take(l).trim();if(I==="")return;const L=r.pendingFiles.length>0;L&&(f.current=!0),h.send({text:I}).catch(()=>{const $=ue.getState(),O=$.drafts[l]??"";$.set(l,O===""?I:`${I}
|
|
44
|
+
${O}`)}).finally(()=>{L&&(f.current=!1)})};if(!k)return i.jsxs("div",{className:"flex items-center justify-between gap-3 border-t px-4 py-3",children:[i.jsx("p",{className:"text-muted-foreground text-sm",children:xt}),i.jsx(Ee,{type:"button",size:"sm",variant:"outline",disabled:p.isPending,onClick:()=>p.mutate({roomId:e.id,authorId:e.viewerAuthorId},{onSuccess:()=>yt.success(`You joined ${se(e)}`)}),children:Jn})]});const _=i.jsx(X.Composer,{inputRef:d,value:c,onChange:I=>{m(I),g.noteTextChange(I)},onSubmit:S,head:i.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:g.isOpen&&g.rows.length===0?"No one by that name.":""}),mentionPicker:i.jsx(je,{children:g.isOpen&&i.jsx(Ar,{rows:g.rows,selectedIndex:g.selectedIndex,onSelect:D})}),overlays:i.jsx(i.Fragment,{children:i.jsx(je,{children:x.isOpen&&i.jsx(Rr,{rows:x.rows,selectedIndex:x.selectedIndex,agents:x.agents,displayNames:x.displayNames,visualOf:x.visualOf,onSelect:x.selectRow})})}),input:{onCursorChange:g.handleCursorChange,isStreaming:!1,isPaletteOpen:g.isOpen||x.isOpen,paletteHasResults:x.isOpen?x.hasRows:g.hasSelectableRows,onArrowUp:x.isOpen?x.moveUp:g.moveUp,onArrowDown:x.isOpen?x.moveDown:g.moveDown,onCommandSelect:x.isOpen?x.selectHighlighted:C,onEscape:x.isOpen?x.dismiss:g.dismiss,tabPicks:!x.isOpen,onClear:()=>{m(""),g.dismiss()},activeDescendantId:x.isOpen?x.activeDescendantId:g.activeDescendantId,paletteListboxId:x.isOpen?x.listboxId:g.listboxId,contextKey:l,...r.hasFailedUpload?{canSubmitReason:"A file didn’t upload. Try it again or remove it, then send."}:{}}});return!y&&o===void 0?_:i.jsx("section",{className:"flex flex-col","data-testid":Xn.homeComposer,onFocus:I=>{x.handleFocus(I),ie(I.target)&&(o==null||o(!0))},onBlur:I=>{x.handleBlur(I),ie(I.target)&&(o==null||o(!1))},onPointerDown:x.handlePointerDown,children:_})}function Mr({roomId:e}){const{approvals:t}=Zn(),s=es(t).filter(n=>n.roomId===e);return s.length===0?null:i.jsx("section",{"data-slot":"room-approvals","aria-label":"Requests waiting on you",className:"shrink-0 px-3 pb-2 md:px-4",children:i.jsx(ts,{approvals:s})})}function Tr({roomId:e}){const{data:t}=zs("pending"),s=(t??[]).filter(n=>n.roomId===e);return s.length===0?null:i.jsx("section",{"data-slot":"room-agent-requests","aria-label":"Apps agents are asking for",className:"shrink-0 space-y-2 px-3 pb-2 md:px-4",children:s.map(n=>i.jsx(Hs,{request:n},n.requestId))})}const Er="An agent",nt=64,Ne=3,Or=new Set;function Wt({room:e,entries:t,scope:s,laneScope:n,stalled:o,unavailable:r=!1,onRetry:l,onScrollToRow:c}){const h=Oe(),p=ns(e.id,s),u=ss(e.id,s),d=os(e.id,s),[k,f]=a.useState(!1),g=Tt(e.id,{enabled:k}),y=rs(),{mutate:x}=co(),[N,m]=a.useState(Or),b=a.useCallback(R=>{m(A=>new Set(A).add(R)),x({roomId:e.id,authorId:R},{onSettled:()=>m(A=>{const j=new Set(A);return j.delete(R),j})})},[x,e.id]),T=uo(),[E,D]=a.useState(()=>new Map),C=as(),S=qe(),_=a.useMemo(()=>Le(e.members,e.formerAuthors),[e.members,e.formerAuthors]),I=a.useCallback(R=>{var A;return((A=_.get(R))==null?void 0:A.displayName)??Er},[_]),{interactions:L}=is(),$=a.useMemo(()=>L.filter(R=>R.roomId===e.id),[L,e.id]),O=a.useMemo(()=>{var A;const R={};for(const j of $){if(j.roomAuthorId===void 0)continue;const U=(A=_.get(j.roomAuthorId))==null?void 0:A.displayName;U!==void 0&&(R[j.sessionId]=U)}return R},[$,_]),q=a.useMemo(()=>p.map(R=>({authorId:R.authorId,name:I(R.authorId),state:R.state,since:R.since,activity:R.activity??null})),[p,I]),F=a.useMemo(()=>u.map(R=>{var j;const A=(j=C.data)==null?void 0:j.find(U=>U.id===R.behindRoomId);return{authorId:R.authorId,name:I(R.authorId),since:R.since,behind:{roomId:R.behindRoomId,title:A===void 0?null:se(A)},othersWaiting:R.othersWaiting,severalInTheWay:R.severalInTheWay}}),[u,I,C.data]),z=a.useMemo(()=>{const R=new Set;for(const A of u)E.get(A.authorId)===A.entryId&&R.add(A.authorId);return R},[u,E]),W=a.useMemo(()=>d===null?null:{authorId:d.authorId,name:I(d.authorId)},[d,I]),B=a.useMemo(()=>Ts({capabilities:He,asks:$,agentNames:O,stalled:o,presence:q,held:F,silentFinish:W,turn:null}),[$,O,q,F,W,o]),H=a.useMemo(()=>{var A;const R=new Map;for(const j of((A=g.data)==null?void 0:A.bindings)??[])R.set(j.authorId,j.sessionId);return R},[g.data]),w=a.useCallback(R=>{const A=t.find(U=>U.id===R);if(A===void 0)return null;const j=A.body.text.replace(/\s+/gu," ").trim();return j.length===0?null:j.length>nt?`${j.slice(0,nt).trimEnd()}…`:j},[t]),v=a.useCallback(R=>{var A;return n==="thread"?Ae(R):((A=Fe(t,R))==null?void 0:A.domId)??null},[t,n]),P=a.useMemo(()=>{const R=p.map(j=>{const U=w(j.entryId),G=v(j.entryId);return{authorId:j.authorId,author:J(j.authorId,_,S.faces),state:j.state,since:j.since,doing:ls(j.activity),replyingTo:U===null||G===null?null:{entryId:j.entryId,excerpt:U,rowId:G},sessionId:H.get(j.authorId)??null}}),A=F.map(j=>({authorId:j.authorId,author:J(j.authorId,_,S.faces),state:"held",since:j.since,doing:null,replyingTo:null,sessionId:null,behind:j.behind,othersWaiting:j.othersWaiting}));return[...R,...A]},[p,F,_,S.faces,w,v,H]),M=a.useMemo(()=>{if(p.length===0)return null;const R=p.slice(0,Ne);return i.jsxs("span",{"aria-hidden":"true",className:"flex shrink-0 -space-x-1",children:[R.map(A=>i.jsx(vt,{author:J(A.authorId,_,S.faces),className:"ring-background size-4 ring-2"},A.authorId)),p.length>Ne&&i.jsx("span",{className:"bg-muted text-muted-foreground ring-background text-3xs flex size-4 items-center justify-center rounded-full ring-2",children:`+${p.length-Ne}`})]})},[p,_,S.faces]);return i.jsx(X.LiveLane,{state:B,scope:n,onRetry:l,unavailable:r,faces:M,onPeekOpenChange:f,askCard:B.kind==="ask"?i.jsx(cs,{ask:B.ask,...O[B.ask.sessionId]?{agentName:O[B.ask.sessionId]}:{},onOpenSession:R=>{h(fe({session:R}))},className:"border-l-0"}):void 0,peek:i.jsx(X.LivePeek,{rows:P,onScrollToRow:c,onOpenSession:R=>{h(fe({session:R}))},onOpenRoom:R=>{h({...bt.channels(),search:{id:R}})},onAnswerFirst:R=>{const A=u.find(j=>j.authorId===R);A!==void 0&&D(j=>new Map(j).set(R,A.entryId)),T.mutate({roomId:e.id,authorId:R})},promoted:z,onStopAll:()=>y.mutate({roomId:e.id}),stopping:y.isPending,onStopAgent:b,stoppingAgents:N})})}const st=3e3;function _r(e,t,s,n=Date.now){const o=a.useRef(null),r=a.useRef(new Map),l=a.useRef(new Map),c=o.current,h=r.current,p=l.current,u=n();for(const d of e){if(p.has(d.id))continue;if(c===null){p.set(d.id,"at-rest");continue}const k=h.get(d.authorId);p.set(d.id,k!==void 0&&u-k<st?"handed-off":"dropped")}return a.useEffect(()=>{if(!s)return;o.current=new Set(e.map(k=>k.id));const d=n();for(const k of t)r.current.set(k,d);for(const[k,f]of r.current)d-f>st&&r.current.delete(k);for(const k of l.current.keys())o.current.has(k)||l.current.delete(k)}),p}function Pr({kind:e}){return e==="thread-error"?i.jsxs("div",{"data-slot":"thread-notice","data-testid":"room-thread-error",className:"text-muted-foreground flex flex-col items-center gap-2 px-[var(--msg-padding-x)] py-6 text-center text-sm",children:[i.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load this thread"}),i.jsx("p",{className:"max-w-sm text-xs",children:"Nothing was lost. Reload to try again."})]}):e==="thread-waiting"?i.jsxs("div",{"data-slot":"thread-notice",className:"flex flex-col gap-2 px-[var(--msg-padding-x)]",children:[i.jsx(ae,{className:"h-3 w-24"}),i.jsx(ae,{className:"h-3 w-full max-w-sm"})]}):i.jsx("p",{"data-slot":"thread-notice","data-testid":"room-thread-orphan",className:"text-muted-foreground border-b px-[var(--msg-padding-x)] pb-3 text-xs italic",children:"This thread’s first message is gone. Its replies remain."})}function Dr({room:e,rootEntryId:t,focusComposer:s,entries:n,reactionFrequents:o,streamStalled:r,streamUnavailable:l,onRetryStream:c,historyLoaded:h,historyFailed:p=!1,landOnRow:u,pushed:d,onClose:k}){const f=a.useMemo(()=>Le(e.members,e.formerAuthors),[e.members,e.formerAuthors]),g=Bt({room:e,threadRootId:t}),y=be(e.members,e.viewerAuthorId),x=qe(),N=a.useMemo(()=>new Map([...f].map(([w,v])=>[w,v.displayName])),[f]),{root:m,replies:b}=a.useMemo(()=>{let w;const v=[];for(const P of n)P.id===t?w=P:Z(P)===t&&v.push(P);return{root:w,replies:v}},[n,t]),T=m==null?void 0:m.threadReplyCount,E=T!==void 0&&T>b.length,D=m===void 0||E?-1:1+b.length,C=$e(b.length,T),S=a.useMemo(()=>new Set(b.map(w=>w.id)),[b]),_=a.useMemo(()=>({replyIds:S,inside:!0}),[S]),I=ds(e.id,_),L=gt(e.id,t),$=_r(b,I,h),O=a.useRef(null),q=a.useCallback(w=>{var v;(v=O.current)==null||v.scrollToRow(w)},[]),F=a.useRef(null);a.useEffect(()=>{var w;s||(w=F.current)==null||w.focus()},[t,s]);const z=w=>{w.key!=="Escape"||w.defaultPrevented||(w.stopPropagation(),k())},W=a.useMemo(()=>{const w=[];if(m===void 0){const v=p?"thread-error":h?"thread-orphan":"thread-waiting";w.push({kind:"notice",id:v,at:"",body:null})}else w.push({kind:"message",id:m.id,payload:m,grouping:{position:"only"},author:J(pe(m,f),f,x.faces),at:m.createdAt});for(const v of b)w.push({kind:"message",id:v.id,payload:v,grouping:{position:"only"},author:J(pe(v,f),f,x.faces),at:v.createdAt});return w},[m,b,f,x.faces,p,h]),B=a.useCallback(w=>{if(w.kind==="notice")return i.jsx(Pr,{kind:w.id});if(w.kind!=="message")return null;const v=w.payload,P=m!==void 0&&v.id===m.id,M=b.findIndex(j=>j.id===v.id),R=i.jsx(Lt,{roomId:e.id,entry:v,rowId:Ae(v.id),author:w.author,authorRef:f.get(v.authorId),authors:f,viewerAuthorId:e.viewerAuthorId,authorNames:N,reactionFrequents:o,streamStalled:r,isMember:y,grouping:{position:"only"},answers:_t(v,M<=0?m:b[M-1],j=>(m==null?void 0:m.id)===j?m:b.find(U=>U.id===j)),feedPosition:{index:P?1:(m===void 0?0:1)+M+1,total:D}});if(P)return C===0?R:i.jsxs(i.Fragment,{children:[R,i.jsxs("div",{"aria-hidden":!0,"data-testid":"room-thread-divider",className:"flex items-center gap-2 px-[var(--msg-padding-x)] pt-1 pb-2",children:[i.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:C===1?"1 reply":`${C} replies`}),i.jsx("span",{className:"bg-border h-px flex-1"})]})]});const A=$.get(v.id)??"at-rest";return i.jsx("div",{className:Y(A==="dropped"&&"motion-safe:animate-thread-reply-in",A==="handed-off"&&"motion-safe:animate-reply-settle"),children:R})},[m,b,C,$,e.id,e.viewerAuthorId,f,N,o,r,y,D]),H=a.useCallback(w=>w.kind==="message"?Ae(w.id):void 0,[]);return i.jsx(Pt,{known:x,children:i.jsx(X.Root,{surface:"room",capabilities:He,target:g.target,anchor:"rail",children:i.jsxs("section",{ref:F,"aria-label":"Thread","data-testid":"room-thread-panel",tabIndex:-1,onKeyDown:z,className:Y("bg-card flex min-h-0 flex-col outline-none",d?"h-full w-full":"w-full border-l"),children:[i.jsxs("header",{className:"flex items-center gap-2 border-b px-3 py-2",children:[i.jsx("button",{type:"button",onClick:k,"aria-label":d?`Back to ${se(e)}`:"Close thread",className:Y("focus-ring text-muted-foreground hover:text-foreground relative -ml-1 rounded p-1","after:absolute after:-inset-2.5 md:after:hidden"),children:d?i.jsx(us,{"aria-hidden":!0,className:"size-4"}):i.jsx(ms,{"aria-hidden":!0,className:"size-4"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"text-sm font-medium",children:"Thread"}),i.jsx("p",{className:"text-muted-foreground truncate text-xs",children:se(e)})]})]}),i.jsx(X.Timeline,{ref:O,conversationId:`thread-${t}`,label:`Thread in ${se(e)}`,busy:!h&&!p,rows:W,renderRow:B,domIdOf:H,...u===void 0?{}:{landOnRow:u},pending:L,viewerAuthorId:e.viewerAuthorId,className:"py-3",feedTestId:"room-thread-feed"}),i.jsx(Wt,{room:e,entries:n,scope:_,laneScope:"thread",stalled:d&&r===!0,unavailable:l,onRetry:d?c:void 0,onScrollToRow:q}),i.jsx(Ut,{room:e,threadRootId:t,attachments:g.attachments,focusOnMount:s},t)]})})})}const ve="room-thread-split",$r=320,Lr=360,Fr=40,Br=50,qr=25;function ot(e,t){return t<=0?qr:Math.min(Math.round(e/t*1e3)/10,Br)}function zr(e){const t=ot($r,e),s=Math.round((100-ot(Lr,e))*10)/10;return{minPct:t,maxPct:s,defaultPct:Math.min(Math.max(Fr,t),s)}}function Hr(e,t,s){if(e===null||t===null||t<=0)return s.defaultPct;const n=e/t*100;return Math.round(Math.min(Math.max(n,s.minPct),s.maxPct)*10)/10}function Ur(e){try{const t=localStorage.getItem(e),s=t===null?NaN:Number(t);return Number.isFinite(s)&&s>0?s:null}catch{return null}}function Wr(e,t){try{localStorage.setItem(e,String(Math.round(t)))}catch{}}const Kr="react-resizable-panels:room-thread-split";function Gr(){try{localStorage.removeItem(Kr)}catch{}}function Vr(){const[e,t]=a.useState(null),[s,n]=a.useState(null);return{ref:a.useCallback(r=>{if(r===null)return;t(r);const l=()=>n(r.offsetWidth);l();const c=new ResizeObserver(l);return c.observe(r),()=>{c.disconnect(),t(null),n(null)}},[]),element:e,width:s,sizing:zr(s??0)}}const Yr=`${ve}-room`,rt=`${ve}-thread`,at=`${ve}-handle`,Qr=4;function Jr({room:e,thread:t,storageKey:s=ps.ROOM_THREAD_WIDTH}){const{ref:n,element:o,width:r,sizing:l}=Vr(),[c,h]=a.useState(()=>Ur(s)),[p,u]=a.useState(null),d=a.useRef(null),k=Hr(c,r,l),f=r===null||(l.maxPct-l.minPct)/100*r<Qr,g=t!==!1;a.useEffect(Gr,[]);const y=a.useRef(!1);a.useLayoutEffect(()=>{var b;y.current&&((b=d.current)==null||b.resize(k))},[k,g]);const x=a.useRef(null),N=()=>{var D;const b=(D=d.current)==null?void 0:D.getSize(),T=x.current;if(x.current=null,b===void 0||r===null||r<=0||T===b)return;const E=Math.round(b/100*r);h(E),Wr(s,E)},m=p??k;return a.useLayoutEffect(()=>{const b=o==null?void 0:o.querySelector(`[data-panel-resize-handle-id="${at}"]`);b&&(b.setAttribute("aria-controls",rt),b.setAttribute("aria-valuenow",String(Math.round(m))),b.setAttribute("aria-valuemin",String(Math.round(l.minPct))),b.setAttribute("aria-valuemax",String(Math.round(l.maxPct))))}),i.jsx("div",{ref:n,className:"h-full overflow-hidden",children:i.jsxs(fs,{direction:"horizontal",id:ve,onLayout:b=>{y.current=b.length>1,u(y.current?b[1]:null)},children:[i.jsx(Qe,{id:Yr,order:1,className:"flex",children:e}),g&&i.jsxs(i.Fragment,{children:[i.jsx(Ss,{id:at,"aria-label":"Resize thread","data-testid":"room-thread-resize-handle",disabled:f,onDragging:b=>{var T;b&&(x.current=((T=d.current)==null?void 0:T.getSize())??null)},onKeyDownCapture:b=>{var T,E;f||(x.current=((T=d.current)==null?void 0:T.getSize())??null,!(b.key!=="Home"&&b.key!=="End")&&(b.preventDefault(),(E=d.current)==null||E.resize(b.key==="Home"?l.minPct:l.maxPct)))},onResizeEnd:N}),i.jsx(Qe,{ref:d,id:rt,order:2,defaultSize:k,minSize:l.minPct,maxSize:l.maxPct,className:"flex",children:t})]})]})})}function ca({roomId:e,threadId:t,entrySeq:s,threadRoute:n,aboveTimeline:o,aboveComposer:r,offerJumpBackIn:l,onComposerFocusChange:c}){const h=hs(),p=Ns(),u=gs(e),d=u==null?void 0:u.rootEntryId,k=pr(),f=a.useCallback(()=>{var P;const v=(P=Q.getState().open[e])==null?void 0:P.rootEntryId;Q.getState().closeThread(e),v!==void 0&&k.arm(v)},[e,k]),g=a.useCallback(v=>{Q.getState().openThread(e,v)},[e]),y=xs(e),x=ys(e),N=lo(e,x.isSuccess);Is(e);const m=y.data,b=a.useMemo(()=>x.data??[],[x.data]),T=Bt({room:m});hr({roomId:e,route:n,urlThreadId:t,openThreadId:d,entries:b,historyLoaded:x.isSuccess});const E=a.useMemo(()=>{var v;return((v=m==null?void 0:m.members.find(P=>P.author.id===m.viewerAuthorId))==null?void 0:v.lastReadSeq)??null},[m]),D=ur(e,E);bs(m,b);const C=a.useRef(null),S=a.useRef(void 0),_=a.useCallback(v=>{S.current=v},[]),I=a.useCallback(()=>S.current,[]);a.useLayoutEffect(()=>{S.current=void 0},[e]);const L=a.useCallback(v=>{var P;(P=C.current)==null||P.scrollToRow(v)},[]),$=po(e),{loadOlder:O,cursor:q}=$,F=a.useCallback(()=>{const v=Mo(b,q);O().then(()=>{v!==null&&requestAnimationFrame(()=>{var P;return(P=C.current)==null?void 0:P.scrollToRow(v.domId)})})},[b,q,O]),z=dr({roomId:e,entrySeq:s,entries:b,historyLoaded:x.isSuccess}),W=a.useMemo(()=>d===void 0?void 0:{replyIds:new Set(b.filter(P=>Z(P)===d).map(P=>P.id)),inside:!1},[b,d]);if(y.isLoading)return i.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:i.jsx(Ft,{})});if(y.isError||!m)return i.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[i.jsx("p",{className:"text-foreground font-medium",children:"That channel or DM isn’t here"}),i.jsx("p",{className:"max-w-sm",children:"It may be archived, or the link is old."})]});const B=u!==void 0&&i.jsx(Dr,{room:m,rootEntryId:u.rootEntryId,focusComposer:u.focusComposer,entries:b,reactionFrequents:m.reactionFrequents,streamStalled:N.stalled,streamUnavailable:N.unavailable,onRetryStream:N.retry,historyLoaded:x.isSuccess,historyFailed:x.isError,...z.threadRow===void 0?{}:{landOnRow:z.threadRow},pushed:h,onClose:f},u.rootEntryId),H=i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[o,i.jsx(lr,{ref:C,roomId:m.id,roomName:se(m),viewerAuthorId:m.viewerAuthorId,entries:b,members:m.members,formerAuthors:m.formerAuthors,lastReadSeq:D,reactionFrequents:m.reactionFrequents,streamStalled:N.stalled,isLoading:x.isLoading,error:x.error,onAddAgents:()=>vs("add",m.id),openThreadId:d,onOpenThread:g,resumeRow:I,...z.roomRow===void 0?{}:{landOnRow:z.roomRow},onTopRow:_,canLoadOlder:$.canLoadOlder,isLoadingOlder:$.isLoadingOlder,onLoadOlder:F}),r,i.jsx(Mr,{roomId:m.id}),i.jsx(Tr,{roomId:m.id}),i.jsx(Wt,{room:m,entries:b,scope:W,laneScope:"room",stalled:N.stalled,unavailable:N.unavailable,onRetry:N.retry,onScrollToRow:L}),i.jsx(Ut,{room:m,attachments:T.attachments,offerJumpBackIn:l,onFocusChange:c},m.id)]}),w={surface:"room",capabilities:He,target:T.target,anchor:"rail"};return h?i.jsx(X.Root,{...w,children:i.jsx(je,{initial:!1,mode:"wait",children:i.jsx(_e.div,{initial:{opacity:0,x:16},animate:{opacity:1,x:0},exit:{opacity:0,x:16},transition:{duration:.15,ease:[0,0,.2,1]},style:{paddingBottom:p},"data-testid":"room-surface",className:"flex h-full flex-col overflow-hidden",children:B===!1?H:B},B?`thread-${d}`:"room")})}):i.jsx(X.Root,{...w,children:i.jsx(Jr,{room:H,thread:B})})}export{Mt as I,Ft as R,wo as T,ca as a,ie as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as d,i as l,j as e,e as m,k as u,C as c,l as x,n as h,H as f}from"./index-
|
|
1
|
+
import{h as d,i as l,j as e,e as m,k as u,C as c,l as x,n as h,H as f}from"./index-Bbffv0TQ.js";function g({kind:s}){const r="text-muted-foreground size-3.5 shrink-0";return s==="dm"?e.jsx(h,{"aria-hidden":!0,className:r}):e.jsx(f,{"aria-hidden":!0,className:r})}function p(s){return s===1?"1 member":`${s} members`}function N({member:s}){var i;const r=d(),n=l(s.id);if(n.isPending)return e.jsx(m,{className:"h-16 w-full"});if(n.isError)return e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this member’s rooms."});const a=((i=n.data)==null?void 0:i.rooms)??[];return a.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.isSelf?"You aren’t":`${s.displayName} isn’t`," in any rooms yet."]}):e.jsx("div",{className:"flex flex-col",children:a.map(t=>{const o=e.jsxs(e.Fragment,{children:[e.jsx(g,{kind:t.kind}),e.jsx("span",{className:"min-w-0 truncate text-sm",children:u({kind:t.kind,slug:t.slug,title:t.name})}),e.jsx("span",{className:"text-muted-foreground ml-auto shrink-0 text-xs",children:p(t.memberCount)})]});return r?e.jsxs("button",{type:"button","data-slot":"profile-room-row",onClick:()=>void r({...x.channels(),search:{id:t.id}}),className:"focus-ring hover:bg-muted/50 flex h-9 items-center gap-2 rounded-md px-2 text-left transition-colors",children:[o,e.jsx(c,{"aria-hidden":!0,className:"text-muted-foreground/70 size-3.5 shrink-0"})]},t.id):e.jsx("div",{"data-slot":"profile-room-row",className:"flex h-9 items-center gap-2 rounded-md px-2",children:o},t.id)})})}export{N as RoomsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as k,j as e,an as Ce,be as Se,U as Ee,ab as N,dl as de,dm as ie,dn as ce,dp as ue,dq as fe,dr as ye,a5 as we,a6 as Ae,a7 as Te,ds as me,dt as ke,du as xe,dv as Le,dw as Ie,dx as De,dy as Oe,dz as Pe,dA as j,dB as Ue,dC as _e,dD as $e,dE as R,dF as He,dG as T,dH as Re,dd as pe,B as Me,dI as Be,b as ze,e as Ke,dJ as qe,dK as Fe,dL as Qe,dM as Ve,dN as Ge,dO as We}from"./index-Bbffv0TQ.js";const Xe={duration:.12,ease:"easeOut"},Je={type:"spring",stiffness:320,damping:28};function he({isSetHere:a,serverDefault:l,onUseServerDefault:i,warning:r,className:s,"data-testid":d}){const[u,f]=k.useState(!1),o=a?"Set here":`Server default · ${l??"none"}`,n=a&&!!i,x=e.jsxs("span",{className:N("text-3xs inline-flex h-5 items-center gap-1 rounded-full px-2 leading-none whitespace-nowrap",r?de.warning:de.neutral,n&&"hover:bg-accent hover:text-accent-foreground transition-colors",s),"data-testid":d,children:[r&&e.jsx(Ce,{className:"size-2.5 shrink-0","aria-hidden":!0}),e.jsx(Se,{mode:"wait",initial:!1,children:e.jsx(Ee.span,{initial:{opacity:0,y:2},animate:{opacity:1,y:0,transition:Je},exit:{opacity:0},transition:Xe,children:o},o)})]});return n?e.jsxs(ie,{open:u,onOpenChange:f,children:[e.jsx(ce,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Set here${r?`: ${r}`:""}`,children:x})}),e.jsxs(ue,{className:"w-64 p-2",align:"start",children:[e.jsx(fe,{children:"Where this value comes from"}),r&&e.jsx("p",{className:N("px-2 pt-1 text-xs",ye.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{i(),f(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":d?`${d}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["Currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Not set. Uses the built-in default."})]})]})]}):r?e.jsx("span",{title:r,"aria-label":`${o}: ${r}`,children:x}):x}const Ye=["agents"];function Ze(a){const l=we(),i=Ae();return Te({...a!=null&&a.errorLabel?{meta:{errorLabel:a.errorLabel}}:{},mutationFn:r=>l.updateMeshAgent(r.id,r.updates),onSuccess:()=>{i.invalidateQueries({queryKey:["mesh","agents"]})},onSettled:()=>{i.invalidateQueries({queryKey:Ye})}})}const be="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function $({label:a,valueLabel:l,options:i,selected:r,isSetHere:s,serverDefault:d,warning:u,onSelect:f,onInherit:o,testId:n,showHeader:x=!0,className:C,describedBy:m,inheritText:L}){const I=me(),[S,b]=k.useState(!1);return e.jsxs("div",{className:N("space-y-1",C),children:[x&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:be,children:a}),!I&&e.jsx(he,{isSetHere:s,serverDefault:d,warning:u,onUseServerDefault:o,"data-testid":`${n}-chip`})]}),e.jsxs(ie,{open:S,onOpenChange:b,children:[e.jsx(ce,{asChild:!0,children:e.jsxs("button",{type:"button",className:"border-input hover:bg-accent flex h-8 w-full items-center gap-1 rounded-md border px-2 text-sm transition-colors",...m?{"aria-describedby":m}:{},"data-testid":n,children:[e.jsx("span",{className:N("truncate",u?"text-status-warning-fg":s?"md:text-foreground text-status-warning-fg":"md:text-foreground text-status-success-fg"),children:l}),e.jsx(Be,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(ue,{className:"w-64 p-1",align:"start",children:[e.jsx(fe,{children:a}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:i.map(c=>e.jsxs("button",{type:"button","data-testid":`${n}-option-${c.value}`,onClick:()=>{f(c.value),b(!1)},className:N("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",c.value===r&&"bg-accent"),children:[c.label,c.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:c.hint})]},c.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),b(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${n}-inherit`,children:L??(d?`Use server default: ${d}`:"Use server default")})]})]})]})}function et({agent:a,onUpdate:l,className:i}){var Z,ee,te,se,ae,ne,le,oe,re;const r=me(),{data:s}=ke(),{data:d,isPending:u}=xe(),f=((Z=s==null?void 0:s.executionDefaults)==null?void 0:Z.runtime)??"claude-code",o=a.runtime??f,n=(ee=s==null?void 0:s.executionDefaults)==null?void 0:ee.perRuntime.find(t=>t.runtime===o),{data:x}=Le(),C=Ie(a,{defaultRuntime:f,runtimeDeclaresCredits:t=>{var h;return((h=d==null?void 0:d.capabilities[t])==null?void 0:h.credits)!==void 0},credits:(te=s==null?void 0:s.claudeCode)==null?void 0:te.credits,runtimeDefaultsToCredits:t=>{var h,A;return((A=(h=x==null?void 0:x.defaults)==null?void 0:h[t])==null?void 0:A.runsOn)==="credits"}}),{data:m,isError:L}=De({runtime:o,...C?{account:j}:{}}),I=a.model!=null,S=a.effort!=null,b=(n==null?void 0:n.model)??null,c=C&&(m??[]).some(t=>t.paidFromCredits),E=c?(m??[]).find(t=>t.isDefault):void 0,w=a.model??b??(E==null?void 0:E.value)??null,p=w?(m??[]).find(t=>t.value===w):void 0,D=(n==null?void 0:n.supportsEffort)??((se=Oe(d,o))==null?void 0:se.supportsEffort),M=D===void 0&&u,B=D!==!1,z=p?p.supportsEffort??!1:void 0,K=(ae=s==null?void 0:s.claudeCode)==null?void 0:ae.accounts,{nameFor:q,creditsEntry:ve,resolvedAccount:F}=Pe(),Q=ve??(a.account===j&&((ne=s==null?void 0:s.claudeCode)!=null&&ne.credits)?{path:s.claudeCode.credits.path}:null),v=K&&[...K.flatMap(t=>t.id===null?[]:[{id:t.id,label:q(t.path),path:t.path}]),...Q?[{id:j,label:Ue,path:Q.path}]:[]],g=a.account??null,V=g!==null,G=o==="claude-code"&&g===j&&((le=s==null?void 0:s.claudeCode)==null?void 0:le.credits)!==void 0&&!s.claudeCode.credits.allowedAgents.includes(a.id),O=s!=null&&s.claudeCode&&F?q(F):null,P=Ze({errorLabel:"Couldn’t change this agent’s account"}),U=k.useCallback(t=>{P.mutate({id:a.id,updates:{account:t}})},[a.id,P]),ge=_e({agent:{runtime:a.runtime,model:a.model,effort:a.effort,account:a.account},defaultRuntime:f,serverDefaultModel:b,knownModels:$e(m),knownAccounts:v,accountsUnavailable:(oe=s==null?void 0:s.claudeCode)==null?void 0:oe.accountsUnavailable,modelSupportsEffort:z,runtimeSupportsEffort:D,runtimeLabel:t=>R(t).label}),y=t=>{var h;return((h=ge.breakages.find(A=>t.includes(A.kind)))==null?void 0:h.message)??null},_=!M&&B&&z!==!1,W=a.effort??(n==null?void 0:n.effort)??null,X=R(o).label,je=o==="claude-code"&&v!==void 0&&(v.length>1||V),Ne=y(["account-unregistered"]),J=(m??[]).some(t=>t.unverified),Y=k.useId();return e.jsxs("div",{className:N("grid grid-cols-2 gap-3",i),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{label:"Model",valueLabel:(p==null?void 0:p.displayName)??w??(c?"Default":"Automatic"),options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:w,isSetHere:I,serverDefault:(n==null?void 0:n.model)??null,warning:y(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:J?Y:void 0,inheritText:c&&!b?E?`Use the suggested model: ${E.displayName}`:"Use the default model":void 0}),J&&e.jsx(He,{id:Y}),c&&(m??[]).some(t=>t.creditsListOutOfDate)&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-out-of-date",children:"The models your DorkOS credits cover may be out of date."}),C&&L&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-unavailable",children:"Couldn’t load the models DorkOS credits cover. Try again in a moment."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:be,children:"Effort"}),(!r||!_)&&(S||_)&&e.jsx(he,{isSetHere:S,serverDefault:n!=null&&n.effort?T(n.effort):null,warning:y(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),M?e.jsx(H,{testId:"agent-effort-pending",text:`Checking what ${X} supports`,warning:null}):B?_?e.jsx($,{label:"Effort",valueLabel:T(W),options:Re.filter(t=>!(p!=null&&p.supportedEffortLevels)||p.supportedEffortLevels.includes(t)).map(t=>({value:t,label:T(t)})),selected:W,isSetHere:S,serverDefault:n!=null&&n.effort?T(n.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(H,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:y(["effort-unsupported-model"])}):e.jsx(H,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${X}`,warning:y(["effort-unsupported-runtime"])})]}),je&&e.jsx($,{label:"Account",valueLabel:G?O??"Default":g!==null?((re=v==null?void 0:v.find(t=>t.id===g))==null?void 0:re.label)??g:O??"Default",options:(v??[]).map(t=>({value:t.id,label:t.label,hint:t.id===j?"Paid from your DorkOS account":pe(t.path)})),selected:g,isSetHere:V,serverDefault:O,warning:Ne,onSelect:t=>U(t),onInherit:()=>U(null),testId:"agent-account-row",className:"col-span-full"}),G&&e.jsxs("div",{className:"text-muted-foreground col-span-full flex flex-wrap items-center gap-2 text-xs","data-testid":"agent-credits-not-allowed",children:[e.jsx("span",{children:"This agent’s settings name DorkOS credits. It uses your default until you allow it."}),e.jsx(Me,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",disabled:P.isPending,onClick:()=>U(j),children:"Allow"})]})]})}function H({text:a,warning:l,testId:i}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":i,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:a}),l&&e.jsx("p",{className:"text-status-warning-fg text-xs",children:l})]})}const tt="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function at({member:a}){const{agent:l,projectPath:i,isPending:r,update:s}=ze(a),{data:d}=xe();if(r)return e.jsx(Ke,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const u=d?Object.keys(d.capabilities):[l.runtime],f=u.includes(l.runtime)?u:[l.runtime,...u];return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-runs-on",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:tt,children:"Runs on"}),e.jsxs(qe,{value:l.runtime??"claude-code",onValueChange:o=>s({runtime:o}),children:[e.jsx(Fe,{className:"h-8 text-sm",responsive:!1,children:e.jsx(Qe,{})}),e.jsx(Ve,{children:f.map(o=>e.jsx(Ge,{value:o,responsive:!1,children:R(o).label},o))})]})]}),e.jsx(et,{agent:l,onUpdate:s,className:"grid-cols-1"}),i&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(We,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:pe(i)})]})]})}export{at as RunsOnPopover};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as u,v as p,r as o,w as r,x as g,j as S,y as h}from"./index-Bbffv0TQ.js";function d({member:a}){var n;const e=((n=a.agent)==null?void 0:n.projectPath)??null,t=u(),s=p(),i=o.useCallback(l=>{!t||e===null||(r.getState().recordOpened("agent",e),t(g({dir:e,session:l})))},[t,e]),c=o.useCallback(()=>{e!==null&&(r.getState().recordOpened("agent",e),s(e))},[e,s]);return S.jsx(h,{agentPath:e,agentName:a.displayName,onOpenChat:i,onNewChat:c,searchable:!0,className:"flex-1"})}export{d as SessionsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a5 as b,ae as z,gA as h,gB as g,a6 as C,a7 as $,cP as M,ai as I,j as e,r as d,dI as O,ab as N,B as j,an as K,dl as y,df as w,fI as q,fJ as W,fK as Q,fL as U,fM as G,fN as J,fO as Y,fP as V,h as H,gC as E,l as R,er as X,a4 as Z,e as A,et as ee,gD as L,a1 as P}from"./index-Bbffv0TQ.js";import{B as _}from"./banner-Cja2VfwN.js";function D(s){const t=b();return z({queryKey:h.status(s),queryFn:()=>t.getHarnessStatus(s),staleTime:3e4,refetchOnMount:"always"})}const se={native:"reads it",projected:"shared",drifted:"out of date",dropped:"can’t see it",warned:"may not work",conflict:"blocked","pending-approval":"needs your OK"},te={native:"neutral",projected:"neutral",drifted:"info",dropped:"muted",warned:"warning",conflict:"warning","pending-approval":"warning"},k="\0",ne=new Set(["native","projected"]);function B(s){return`${s.scope??"project"}${k}${s.artifact}${k}${s.source??""}${k}${s.name}`}function ae(s,t){return`${g[s]} ${se[t]}`}function re(s){return s.reason??s.target}function T(s,t){return t.flatMap(n=>{const a=s.cells[n];return a===void 0?[]:[{harness:n,cell:a}]})}function le(s,t){if(t.length===0)return!1;const n=T(s,t);return n.length===t.length&&n.every(({cell:a})=>{var r;return ne.has(a.state)&&!((r=a.warnings)!=null&&r.length)})}function S(s){return`${s} ${s===1?"file":"files"}`}function ie(s){return s===1?"One package is waiting for your approval.":`${s} packages are waiting for your approval.`}function oe(s){return`Shared with all ${s}`}function ce(s){return s===1?"1 agent file":`${s} agent files`}function de(s){return`Agent files ${s} can’t see: skills, rules, commands and more.`}function ue(s){return s===1?"1 entry":`${s} entries`}function xe(s,t){return t.flatMap(n=>{const a=s.flatMap(r=>{const l=r.cells[n];return l===void 0||l.state!=="dropped"?[]:[{key:B(r),artifact:r.artifact,name:r.name,...l.reason===void 0?{}:{reason:l.reason}}]});return a.length===0?[]:[{harness:n,label:g[n],entries:a}]})}const fe={drop:"Not shared",warning:"Couldn’t read",write:"Will be written",notice:"Notice"};function me(s){return`${fe[s.kind]} · ${s.artifact} ${s.name}`}function pe(s){const t=b(),n=C();return $({mutationFn:()=>t.syncHarness(s),meta:{errorLabel:"Couldn’t share your agent files"},onSuccess:a=>{n.setQueryData(h.status(s),a.status),M.success("Agent files updated.")}})}function he(s){const t=C();I("approval_resolved",()=>{t.invalidateQueries({queryKey:h.status(s)})})}function ge({result:s,onDismiss:t}){const{applied:n,removals:a,askedAbout:r}=s;return e.jsx(_,{variant:"neutral",onDismiss:t,dismissLabel:"Dismiss what changed","data-slot":"harness-sync-summary",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-medium",children:"Agent files updated."}),n>0&&e.jsxs(e.Fragment,{children:[" ",S(n)," written."]})]}),a.length>0&&e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("p",{className:"font-medium",children:["Removed ",S(a.length)," DorkOS put here:"]}),e.jsx("ul",{className:"flex flex-col gap-0.5",children:a.map(({path:l,reason:c})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:l}),e.jsx("span",{className:"opacity-80",children:c})]},l))})]}),r.length>0&&e.jsx("p",{children:ie(r.length)})]})})}function je(s){const{counts:t,sweepPreview:n}=s;return t.drifted>0||n.length>0?{message:"Some agent files are out of date.",variant:n.length>0?"warning":"info",actionable:!0}:t.conflicts>0?{message:"DorkOS can’t update some files. Something blocks them.",variant:"warning",actionable:!1}:t.adoptable>0?{message:"Some skills only reach a few of your agents.",variant:"info",actionable:!1}:null}function ve({projectPath:s}){return he(s),null}function Ne({projectPath:s}){const{data:t}=D(s),n=pe(s),[a,r]=d.useState(!1),[l,c]=d.useState(!1);if(t===void 0||t.state!=="ready")return null;const u=e.jsx(ve,{projectPath:s});if(n.data!==void 0&&!l)return e.jsxs(e.Fragment,{children:[u,e.jsx(ge,{result:n.data,onDismiss:()=>c(!0)})]});const o=je(t);if(o===null)return u;const{removals:x,sweepPreview:m}=t,i=m.length;return e.jsxs(e.Fragment,{children:[u,e.jsx(_,{variant:o.variant,"data-slot":"harness-drift-banner",detailsOpen:a,details:i===0?void 0:e.jsx("ul",{className:"flex flex-col gap-0.5",children:x.map(({path:f,reason:v})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:f}),e.jsx("span",{className:"opacity-80",children:v})]},f))}),actions:o.actionable?e.jsx(j,{size:"sm",variant:"outline",className:"h-6 text-xs",disabled:n.isPending,onClick:()=>{c(!1),n.mutate()},children:n.isPending?"Syncing…":"Sync now"}):void 0,children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("p",{children:o.message}),i>0&&e.jsxs("button",{type:"button","aria-expanded":a,onClick:()=>r(f=>!f),className:"text-3xs flex w-fit items-center gap-1 underline underline-offset-2 opacity-90 hover:opacity-100",children:["Syncing also removes ",S(i)," DorkOS put here",e.jsx(O,{"aria-hidden":!0,className:N("size-3 transition-transform",a&&"rotate-180")})]})]})})]})}function ye(s){const t=b(),n=C();return $({mutationFn:a=>t.adoptHarness(s,a),meta:{errorLabel:"Couldn’t move that skill"},onSuccess:a=>{n.setQueryData(h.status(s),a.status),n.setQueriesData({queryKey:h.all,predicate:r=>{var l;return((l=r.state.data)==null?void 0:l.projectPath)===a.status.projectPath}},a.status)}})}const ke={neutral:y.neutral,info:y.info,warning:y.warning,muted:"border border-dashed border-border text-muted-foreground"};function Se({harness:s,cell:t}){var l;const n=ae(s,t.state),a=re(t),r=(l=t.warnings)!=null&&l.length?t.warnings.join(" · "):void 0;return e.jsxs("li",{"aria-label":n,...a===void 0?{}:{title:a},className:N("text-3xs inline-flex items-center gap-1 rounded-full px-2 py-0.5 leading-tight",ke[te[t.state]]),children:[n,r!==void 0&&e.jsx("span",{role:"img","aria-label":"May not work",title:r,className:"inline-flex",children:e.jsx(K,{"aria-hidden":!0,className:"text-status-warning-fg size-2.5"})})]})}function be(s){const t=s===void 0?-1:s.lastIndexOf("/"),n=t>0?s==null?void 0:s.slice(0,t):void 0;return n===void 0?"Only some agents can see it. Move it to .agents/skills to share it.":`Lives in ${n}. Move it to .agents/skills to share it.`}function Ce(s,t){return`dorkos harness adopt ${s} --project ${t}`}const we="Share with every agent";function De(s,t,n){const a=`It moves from ${t} to .agents/skills/${s}`;return n?`${a}. A link stays behind for Claude Code.`:`${a}, where every agent reads it.`}const Ae="for all your projects";function $e({row:s,enabled:t,projectPath:n,showEveryHarness:a}){var v;const[r,l]=d.useState(!1),[c,u]=d.useState(!1),o=ye(n),x=T(s,t),m=le(s,t)&&!a,i=m&&!r,f=(v=o.data)==null?void 0:v.refusals[0];return e.jsxs("div",{role:"group","aria-label":s.name,className:"flex flex-col gap-1 py-1.5",children:[e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"min-w-0 shrink truncate text-xs font-medium",children:s.name}),s.scope==="global"&&e.jsx("span",{className:"text-muted-foreground text-3xs shrink-0",children:Ae}),s.source!==void 0&&e.jsx("span",{dir:"rtl",title:s.source,className:"text-muted-foreground text-3xs ml-auto min-w-0 truncate text-left font-mono",children:e.jsx("bdi",{dir:"ltr",children:s.source})})]}),e.jsxs("ul",{"aria-label":"Agent tools",className:"flex flex-wrap items-center gap-1",children:[m&&e.jsx("li",{children:e.jsxs("button",{type:"button","aria-expanded":!i,title:x.map(({harness:p})=>g[p]).join(" · "),onClick:()=>l(p=>!p),className:"bg-muted text-muted-foreground hover:bg-accent hover:text-accent-foreground text-3xs focus-visible:ring-ring inline-flex items-center gap-1 rounded-full px-2 py-0.5 leading-tight transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[oe(x.length),e.jsx(O,{"aria-hidden":!0,className:N("size-2.5 transition-transform",i&&"-rotate-90")})]})}),!i&&x.map(({harness:p,cell:F})=>e.jsx(Se,{harness:p,cell:F},p))]}),s.adoptable&&e.jsxs(e.Fragment,{children:[e.jsx("p",{role:"status","aria-live":"polite",className:"text-muted-foreground text-3xs",children:(f==null?void 0:f.reason)||be(s.source)}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run: ",e.jsx(w,{children:Ce(s.name,n)})]}),e.jsx("div",{children:e.jsx(j,{size:"sm",variant:"outline",className:"h-6 text-xs",disabled:o.isPending,onClick:()=>u(!0),children:we})}),e.jsx(q,{open:c,onOpenChange:u,children:e.jsxs(W,{children:[e.jsxs(Q,{children:[e.jsxs(U,{children:["Move ",s.name," so every agent can read it?"]}),e.jsx(G,{children:De(s.name,s.source??"",t.includes("claude-code"))})]}),e.jsxs(J,{children:[e.jsx(Y,{children:"Cancel"}),e.jsx(V,{onClick:()=>o.mutate(s.name),children:"Move it"})]})]})})]})]})}const Oe="https://dorkos.ai/docs/guides/cli-usage#agent-files";function He(){return e.jsxs(e.Fragment,{children:[e.jsx("span",{role:"status",className:"sr-only",children:"Loading skills…"}),e.jsx("div",{"aria-hidden":!0,className:"flex flex-col gap-3 py-1",children:[0,1,2].map(s=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{className:"h-3 w-32"}),e.jsx(A,{className:"h-3 w-48"})]},s))})]})}function Ee({projectPath:s,showBrowseLink:t=!0}){const{data:n,isPending:a,error:r,refetch:l}=D(s),[c,u]=d.useState(!1),o=d.useId(),x=H();if(a)return e.jsx(He,{});if(r)return e.jsxs("div",{className:"flex items-center gap-2 py-2",children:[e.jsx("p",{className:"text-destructive text-xs",children:"Couldn’t load skills."}),e.jsx(j,{variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>void l(),children:"Retry"})]});if(n.state!=="ready")return e.jsx(Re,{status:n});const m=n.rows.filter(i=>i.artifact==="skill");return m.length===0?e.jsxs("div",{className:"flex flex-col items-start gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"No skills here yet."}),t&&x&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground h-6 px-1 text-xs",onClick:()=>void x({...R.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(E,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]}):e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 pb-1",children:[e.jsx(X,{htmlFor:o,className:"text-muted-foreground text-3xs",children:"Show every agent tool"}),e.jsx(Z,{id:o,size:"sm",checked:c,onCheckedChange:u})]}),e.jsx("div",{className:"divide-border divide-y",children:m.map(i=>e.jsx($e,{row:i,enabled:n.enabled,projectPath:n.projectPath,showEveryHarness:c},B(i)))})]})}function Re({status:s}){return s.state==="not-set-up"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS isn’t sharing agent files for this folder yet."}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(w,{children:"dorkos harness sync --fix"})," in this folder to set it up."]}),e.jsx(ee,{href:Oe,className:"text-3xs text-muted-foreground hover:text-foreground underline underline-offset-2",children:"How agent file sharing works"})]}):s.state==="unreadable"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS can’t read this folder’s agent file settings."}),s.detail!==void 0&&e.jsx("p",{className:"text-muted-foreground text-3xs",children:s.detail})]}):e.jsx("p",{className:"text-muted-foreground py-2 text-xs",children:"Agent file sharing runs in the DorkOS app."})}function Le({group:s}){const[t,n]=d.useState(!1);return e.jsxs(L,{open:t,onOpenChange:n,trigger:e.jsxs("span",{className:"text-xs",children:["Not shared with ",s.label]}),badge:e.jsx(P,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:ce(s.entries.length)}),children:[e.jsx("p",{className:"text-muted-foreground text-3xs px-4 pt-3",children:de(s.label)}),e.jsx("ul",{className:"space-y-2 px-4 pt-2 pb-3",children:s.entries.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{className:"text-3xs font-medium",children:[a.artifact," ",a.name]}),a.reason!==void 0&&e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},a.key))})]})}function Pe({rows:s,enabled:t}){const n=xe(s,t);return n.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5",children:n.map(a=>e.jsx(Le,{group:a},a.harness))})}function _e({entries:s}){const[t,n]=d.useState(!1);return s.length===0?null:e.jsx(L,{open:t,onOpenChange:n,trigger:e.jsx("span",{className:"text-xs",children:"Project-level notices"}),badge:e.jsx(P,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:ue(s.length)}),children:e.jsx("ul",{className:"space-y-2 px-4 pb-3",children:s.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:N("text-3xs font-medium",a.kind==="notice"&&"text-muted-foreground font-normal"),children:me(a)}),e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},`${a.kind} ${a.artifact} ${a.source??""} ${a.name}`))})})}function Be({command:s}){return e.jsx(w,{className:"break-normal",children:s.split(" ").map((t,n)=>e.jsxs(d.Fragment,{children:[n>0&&" ",e.jsx("span",{className:"whitespace-nowrap",children:t})]},`${n}-${t}`))})}function Te({notEnabled:s}){return s.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5 py-1",children:s.map(({harness:t,why:n,signal:a})=>e.jsxs("div",{title:a,className:"flex flex-col gap-0.5",children:[e.jsx("p",{className:"text-xs font-medium",children:n==="dorkos-runtime"?`DorkOS runs ${g[t]} here, but isn’t sharing to it.`:`${g[t]} files are here, but DorkOS isn’t sharing to it.`}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(Be,{command:`dorkos harness sync --fix --enable ${t}`})," in this folder to turn it on."]})]},t))})}function Fe({projectPath:s}){const t=H(),{data:n}=D(s),a=(n==null?void 0:n.state)==="ready"?n:null;return e.jsxs("div",{className:"flex flex-col gap-2","data-slot":"profile-skills",children:[e.jsx(Ne,{projectPath:s}),a&&e.jsx(Te,{notEnabled:a.notEnabled}),e.jsx(Ee,{projectPath:s,showBrowseLink:!1}),a&&e.jsx(Pe,{rows:a.rows,enabled:a.enabled}),a&&e.jsx(_e,{entries:a.projectLevel}),t&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground w-full",onClick:()=>void t({...R.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(E,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]})}function Ie({member:s}){var n;const t=((n=s.agent)==null?void 0:n.projectPath)??null;return t===null?e.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent’s folder isn’t known here."}):e.jsx(Fe,{projectPath:t})}export{Ie as SkillsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aJ as U,aE as E,aK as F,aL as L,aM as D,aN as $,aO as O,r as o,j as e,aP as P,aQ as p,aR as f,aS as j,aT as g,aU as k,aV as w,aW as N,aX as X,aY as _,aZ as B,a_ as G,a$ as V,b0 as W,b1 as J}from"./index-Bbffv0TQ.js";import{S as K}from"./scroll-area-Dph6w3a6.js";const Q=5;function Y({status:t}){switch(t){case"running":return e.jsx(w,{size:"xs",className:"text-status-info shrink-0"});case"completed":return e.jsx(W,{className:"text-status-success size-3 shrink-0","aria-hidden":!0});case"failed":return e.jsx(V,{className:"text-destructive size-3 shrink-0","aria-hidden":!0});case"cancelled":return e.jsx(G,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0});case"skipped":return e.jsx(B,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0});case"blocked":return e.jsx(_,{className:"text-status-warning-dot size-3 shrink-0","aria-hidden":!0});default:return null}}function Z(t){if(t===null)return"";if(t<1e3)return"< 1s";const n=Math.floor(t/1e3);if(n<60)return`${n}s`;const a=Math.floor(n/60),i=n%60;return`${a}m ${i}s`}function q({run:t,scheduleName:n}){return e.jsx(g,{children:e.jsxs(k,{className:"text-sm",children:[e.jsx(w,{size:"xs",className:"text-status-info shrink-0"}),e.jsx("span",{className:"truncate",children:n}),t.startedAt&&e.jsx("span",{className:"text-muted-foreground/50 ml-auto shrink-0 text-xs",children:N(t.startedAt)})]})})}function H({schedule:t,onEdit:n}){return e.jsx(g,{children:e.jsxs(k,{onClick:()=>n(t.id),className:"text-sm",children:[e.jsx(X,{className:"text-muted-foreground/50 size-3 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:t.name}),t.nextRun&&e.jsx("span",{className:"text-muted-foreground/50 ml-auto shrink-0 text-xs",children:N(t.nextRun)})]})})}function ee({run:t,scheduleName:n}){const a=t.status==="running"&&t.finishedAt?t.error?"failed":"completed":t.status;return e.jsx(g,{children:e.jsxs(k,{className:"text-sm",children:[e.jsx(Y,{status:a}),e.jsx("span",{className:"truncate",children:n}),e.jsxs("span",{className:"text-muted-foreground/50 ml-auto flex shrink-0 items-center gap-1.5 text-xs",children:[t.durationMs!==null&&e.jsx("span",{children:Z(t.durationMs)}),t.finishedAt&&e.jsx("span",{children:N(t.finishedAt)})]})]})})}function se({available:t,agentId:n}){const a=U(),i=E(s=>s.setTasksAgentFilter),R=E(s=>s.setTasksEditScheduleId),u=t,{data:x=[]}=F(u),{data:I=0}=L(u),{data:T=[]}=D(void 0,u),{data:S=[]}=$(),{openWithTemplate:y}=O(),b=[S[0],S[2]].filter(Boolean),l=o.useMemo(()=>n?x.filter(s=>s.agentId===n):x,[n,x]),d=o.useMemo(()=>{const s=new Map;for(const r of l)s.set(r.id,r.name);return s},[l]),v=o.useMemo(()=>T.filter(s=>d.has(s.scheduleId)),[T,d]),{runningRuns:M,recentRuns:A}=o.useMemo(()=>{const s=[],r=[];for(const c of v)c.finishedAt!=null||c.status!=="running"?r.push(c):s.push(c);return r.sort((c,h)=>(h.finishedAt??h.createdAt).localeCompare(c.finishedAt??c.createdAt)),{runningRuns:s,recentRuns:r.slice(0,Q)}},[v]),C=o.useMemo(()=>l.filter(s=>s.enabled&&s.status==="active"&&s.nextRun).sort((s,r)=>(s.nextRun??"").localeCompare(r.nextRun??"")),[l]),m=()=>{n&&(i(n),R(null)),a.open()},z=s=>{R(s),i(null),a.open()};return l.length===0?e.jsxs("div",{className:"flex flex-col gap-3 px-3 py-4",children:[e.jsx("p",{className:"text-muted-foreground/70 text-xs",children:"No schedules yet."}),b.length>0&&e.jsx("div",{className:"space-y-2",children:b.map(s=>e.jsxs("div",{className:"rounded-lg border p-3 text-sm",children:[e.jsx("div",{className:"font-medium",children:s.name}),e.jsx("p",{className:"text-muted-foreground text-xs",children:P(s.cron)}),e.jsx("button",{type:"button",onClick:()=>{y(s),m()},className:"text-primary mt-2 text-xs hover:underline",children:"+ Use preset"})]},s.id))}),e.jsx("button",{onClick:m,className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open schedules →"})]}):e.jsx(K,{type:"scroll",className:"h-full",children:e.jsxs("div",{className:"pr-1",children:[M.length>0&&e.jsxs(p,{children:[e.jsxs(f,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:["Running",e.jsx("span",{className:"text-muted-foreground/50 ml-auto text-xs font-normal normal-case",children:I})]}),e.jsx(j,{children:M.map(s=>e.jsx(q,{run:s,scheduleName:d.get(s.scheduleId)??"Unknown"},s.id))})]}),C.length>0&&e.jsxs(p,{children:[e.jsx(f,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Upcoming"}),e.jsx(j,{children:C.map(s=>e.jsx(H,{schedule:s,onEdit:z},s.id))})]}),A.length>0&&e.jsxs(p,{children:[e.jsx(f,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Recent runs"}),e.jsx(j,{children:A.map(s=>e.jsx(ee,{run:s,scheduleName:d.get(s.scheduleId)??"Unknown"},s.id))})]}),e.jsx("div",{className:"px-3 py-2",children:e.jsx("button",{onClick:m,className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open schedules →"})})]})})}function ae({member:t}){var i;const n=J(),a=((i=t.agent)==null?void 0:i.manifestId)??null;return e.jsx("div",{className:"min-h-0 flex-1","data-slot":"profile-tasks",children:e.jsx(se,{available:n,agentId:a})})}export{ae as TasksPage};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a5 as W,ae as Fe,a7 as se,a6 as ge,eq as De,r as l,j as n,cw as F,cx as D,B as f,f as pe,h7 as te,er as L,I as G,dJ as Le,dK as _e,dL as $e,dM as Ke,dN as Be,gn as ce,bP as Ue,h8 as Ve,C as X,ab as le,aa as ae,cr as fe,cs as xe,a1 as qe,ct as je,bQ as _,dZ as He,h9 as de,aV as ee,fA as Ye,fB as Ge,fC as Qe,fD as We,fE as J,fG as Ze,a4 as Je,ha as Xe,h2 as en,hb as nn,hc as sn,A as tn,e as ne,hd as an,b as rn}from"./index-Bbffv0TQ.js";import{a as on}from"./agent-browser-DsDp0cSX.js";import{u as ve,M as Ne}from"./McpSigninBody-TpoSImsV.js";import{R as cn}from"./rotate-cw-BDweizfR.js";function ln(e,s){const t=W();return Fe({queryKey:["mcp-config",e,s??null],queryFn:()=>t.getMcpConfig(e,{runtime:s??void 0}),enabled:!!e,staleTime:3e4})}function be(e,s){e.invalidateQueries({queryKey:De.mcpServers(s)}),e.invalidateQueries({queryKey:["mcp-config"]})}function Se(e){const s=W(),t=ge();return se({mutationFn:async({input:i,approval:a})=>a?(await s.grantApproval(a.approvalId),e(s,i,a.approvalToken)):e(s,i),onSuccess:(i,{input:a})=>{i.status==="ok"&&be(t,a.agentId)}})}function ye(){return Se((e,s,t)=>e.addAgentMcpServer(s,t?{approvalToken:t}:void 0))}function dn(){return Se((e,s,t)=>e.importAgentMcpServer(s,t?{approvalToken:t}:void 0))}function re(e){const s=W(),t=ge();return se({mutationFn:({agentId:i,name:a})=>e(s,i,a),onSuccess:(i,{agentId:a})=>be(t,a)})}function un(){return re((e,s,t)=>e.removeAgentMcpServer(s,t))}function mn(){return re((e,s,t)=>e.enableAgentMcpServer(s,t))}function hn(){return re((e,s,t)=>e.disableAgentMcpServer(s,t))}function gn(){const e=W();return se({mutationFn:({agentId:s,name:t})=>e.testAgentMcpServer(s,t)})}function pn({agentId:e,serverName:s,onDone:t}){const i=ve(e,s),{start:a}=i,r=l.useRef(!1);return l.useEffect(()=>{r.current||(r.current=!0,a())},[a]),n.jsx(F,{children:n.jsxs(D,{className:"space-y-2",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Sign in to ",s]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:"Sign in so your agent can use this server."}),n.jsx(Ne,{flow:i,serverName:s,failedActions:n.jsxs(n.Fragment,{children:[n.jsx(f,{variant:"secondary",size:"sm",onClick:()=>i.start(),className:"focus-visible:ring-2",children:"Try again"}),n.jsx(f,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Later"})]}),connectedActions:n.jsx(f,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Done"})}),i.state.step!=="failed"&&i.state.step!=="connected"&&n.jsx(f,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Later"})]})})}const fn=["stdio","http","sse"],xn=/^[a-zA-Z0-9_-]+$/;function ue(e){const s={};for(const t of e.split(`
|
|
2
|
+
`)){const i=t.trim();if(!i)continue;const a=i.indexOf("=");if(a===-1)continue;const r=i.slice(0,a).trim();r&&(s[r]=i.slice(a+1).trim())}return s}function me(e){return e.trim().length?e.trim().split(/\s+/):[]}function jn(e,s){if(e.status!=="ok")return!1;const t=e.servers.find(a=>a.name===s),i=t==null?void 0:t.connection;return i!==void 0&&"authKind"in i&&i.authKind==="oauth2"}function vn({agentId:e,agentLabel:s,supportedTransports:t,onAdded:i,oauthDetectedFor:a=null}){const r=ye(),[c,u]=l.useState(!1),[h,x]=l.useState(""),[p,m]=l.useState(t[0]??"stdio"),o=t.includes(p)?p:t[0]??"stdio",[j,C]=l.useState(""),[b,k]=l.useState(""),[v,z]=l.useState(""),[y,M]=l.useState(""),[P,A]=l.useState(""),[E,R]=l.useState(null),[T,I]=l.useState(null),[Z,U]=l.useState(null),[K,V]=l.useState(null),B=xn.test(h)&&h.length<=64,q=o==="stdio"?j.trim().length>0:y.trim().length>0,d=B&&q&&!r.isPending,N=l.useCallback(()=>o==="stdio"?{transport:"stdio",command:j.trim(),args:me(b),env:ue(v)}:{transport:o,url:y.trim(),headers:ue(P)},[o,j,b,v,y,P]),w=l.useCallback(()=>({agentId:e,name:h.trim(),connection:N()}),[e,h,N]),O=l.useCallback(()=>{u(!1),R(null),I(null),x(""),m(t[0]??"stdio"),C(""),k(""),z(""),M(""),A("")},[t]),oe=l.useCallback(g=>{i({name:g.name,transport:g.connection.transport}),O()},[i,O]),H=l.useCallback((g,S)=>{const Ie=jn(g,S.name);oe(S),Ie&&U(S.name)},[oe]),Oe=l.useCallback(async()=>{I(null);const g=w();try{const S=await r.mutateAsync({input:g});S.status==="approval_required"?R(S.approval):H(S,g)}catch(S){I(S instanceof Error?S.message:"Couldn’t add the server.")}},[r,w,H]),ze=l.useCallback(async()=>{if(!E)return;I(null);const g=w();try{const S=await r.mutateAsync({input:g,approval:E});S.status==="ok"?H(S,g):I("The server still needs approval. Try again.")}catch(S){I(S instanceof Error?S.message:"Couldn’t add the server.")}},[r,w,E,H]),Y=Z??(a&&a!==K?a:null),Pe=l.useCallback(()=>{V(Y),U(null)},[Y]),Re=l.useMemo(()=>[j.trim(),...me(b)].filter(Boolean).join(" "),[j,b]);return Y?n.jsx(pn,{agentId:e,serverName:Y,onDone:Pe}):c?E?n.jsx(F,{children:n.jsxs(D,{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(te,{className:"text-status-warning-dot mt-0.5 size-4 shrink-0"}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Add this server to ",s,"?"]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:o==="stdio"?"Runs on this computer when a chat starts.":"The agent connects here when a chat starts."})]})]}),n.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded-md px-3 py-2 font-mono text-xs",children:o==="stdio"?Re:y.trim()}),T&&n.jsx("p",{className:"text-destructive text-xs",children:T}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>R(null),disabled:r.isPending,className:"focus-visible:ring-2",children:"Back"}),n.jsx(f,{size:"sm",onClick:ze,disabled:r.isPending,className:"focus-visible:ring-2",children:r.isPending?"Adding…":"Add server"})]})]})}):n.jsx(F,{children:n.jsxs(D,{className:"space-y-3",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(L,{htmlFor:"mcp-name",children:"Name"}),n.jsx(G,{id:"mcp-name",value:h,onChange:g=>x(g.target.value),placeholder:"my-server","aria-invalid":h.length>0&&!B}),h.length>0&&!B&&n.jsx("p",{className:"text-destructive text-xs",children:"Letters, numbers, dashes, underscores only."})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(L,{htmlFor:"mcp-transport",children:"Transport"}),n.jsxs(Le,{value:o,onValueChange:g=>m(g),children:[n.jsx(_e,{id:"mcp-transport",className:"w-full",children:n.jsx($e,{})}),n.jsx(Ke,{children:t.map(g=>n.jsx(Be,{value:g,children:g},g))})]})]}),o==="stdio"?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(L,{htmlFor:"mcp-command",children:"Command"}),n.jsx(G,{id:"mcp-command",value:j,onChange:g=>C(g.target.value),placeholder:"npx",className:"font-mono"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(L,{htmlFor:"mcp-args",children:"Arguments"}),n.jsx(G,{id:"mcp-args",value:b,onChange:g=>k(g.target.value),placeholder:"-y @modelcontextprotocol/server-filesystem",className:"font-mono"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(L,{htmlFor:"mcp-env",children:"Environment (KEY=VALUE per line)"}),n.jsx(ce,{id:"mcp-env",value:v,onChange:g=>z(g.target.value),placeholder:"API_KEY=…",rows:2,className:"font-mono text-xs"})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(L,{htmlFor:"mcp-url",children:"URL"}),n.jsx(G,{id:"mcp-url",value:y,onChange:g=>M(g.target.value),placeholder:"https://example.com/mcp",className:"font-mono"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(L,{htmlFor:"mcp-headers",children:"Headers (KEY=VALUE per line)"}),n.jsx(ce,{id:"mcp-headers",value:P,onChange:g=>A(g.target.value),placeholder:"Authorization=Bearer …",rows:2,className:"font-mono text-xs"})]})]}),T&&n.jsx("p",{className:"text-destructive text-xs",children:T}),n.jsx(Ue,{}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(f,{variant:"ghost",size:"sm",onClick:O,className:"focus-visible:ring-2",children:"Cancel"}),n.jsx(f,{size:"sm",onClick:Oe,disabled:!d,className:"focus-visible:ring-2",children:"Continue"})]})]})}):n.jsxs(f,{variant:"outline",size:"sm",onClick:()=>u(!0),className:"focus-visible:ring-2",children:[n.jsx(pe,{className:"size-4"}),"Add server"]})}const Nn={connected:"connected","needs-auth":"needs-sign-in",pending:"connecting",disabled:"off"},bn=["validation","invalid config","invalid configuration","missing required","command not found","enoent"];function ie(e){if(!e)return"cant-reach";const s=e.toLowerCase();return bn.some(t=>s.includes(t))?"setup-problem":"cant-reach"}function Ce(e){return e.transport==="stdio"||e.authKind==="oauth2"?!1:Object.keys(e.headers).some(s=>s.toLowerCase()==="authorization")}function Sn(e){const{connection:s,authStatus:t}=e;return s.transport!=="stdio"&&s.authKind==="oauth2"?!0:t!==void 0}function we(e){const{enabled:s,testedOk:t,signedInNow:i,runtimeStatus:a,runtimeError:r,authStatus:c,ownKey:u}=e;return s?t?"connected":i?"signed-in":a==="failed"?ie(r):c==="connected"&&a==="needs-auth"?"signed-in":c==="needs-auth"&&(a==="connected"||a==="pending")?"needs-sign-in":a?Nn[a]:c==="connected"?"signed-in":c==="needs-auth"?"needs-sign-in":u?"uses-your-key":"not-checked":"off"}function yn(e){const{statusKey:s,testResult:t,signedInNow:i}=e;return s==="off"||i?!1:(t==null?void 0:t.needsAuth)===!0?!0:s==="needs-sign-in"}function Cn(e){const{stamped:s,signedInNow:t,authStatus:i,rosterUpdatedAt:a}=e;if(!s)return;const{result:r}=s;if(!(t&&r.needsAuth===!0)&&!(s.at<=a&&(i==="needs-auth"&&r.ok||i==="connected"&&r.needsAuth===!0)))return r}function wn(e){const{status:s,probe:t}=e;return s==="off"||!t||t.ok?s:t.needsAuth===!0?"needs-sign-in":ie(t.error)}const Q={attention:0,working:1,elsewhere:2,off:3};function kn(e){return e==="off"?Q.off:e==="needs-sign-in"||e==="cant-reach"||e==="setup-problem"?Q.attention:Q.working}function An(e){const{managed:s,live:t,discovered:i}=e;return[...s.map(r=>{var c,u;return{name:r.name,band:kn(we({enabled:r.enabled,testedOk:!1,signedInNow:!1,runtimeStatus:(c=t.get(r.name))==null?void 0:c.status,runtimeError:(u=t.get(r.name))==null?void 0:u.error,authStatus:r.authStatus,ownKey:Ce(r.connection)}))}}),...i.map(r=>({name:r.name,band:Q.elsewhere}))].map((r,c)=>({entry:r,index:c})).sort((r,c)=>r.entry.band-c.entry.band||r.index-c.index).map(({entry:r})=>r.name)}function Tn(e){const{frozen:s,present:t}=e,i=new Set(t),a=new Set(s);return{ordered:s.filter(r=>i.has(r)),added:t.filter(r=>!a.has(r))}}function Mn(){const e=Ve(null);return({bothSettled:s,managed:t,live:i,discovered:a,present:r})=>{e.read()===null&&s&&r.length>0&&e.write(An({managed:t,live:i,discovered:a}));const{ordered:c,added:u}=Tn({frozen:e.read()??[],present:r});return u.length>0&&e.read()!==null&&e.write([...c,...u]),[...c,...u]}}const ke={"needs-sign-in":{label:"Needs sign-in",tooltip:"Sign in to use it.",tone:"attention"},"signing-in":{label:"Signing in…",tooltip:"Finish in the new tab.",tone:"attention"},connected:{label:"Connected",tooltip:"It answered. Its tools are ready.",tone:"calm"},"signed-in":{label:"Signed in",tooltip:"Signed in, not tested yet.",tone:"calm"},"uses-your-key":{label:"Uses your key",tooltip:"Uses a key you added.",tone:"calm"},"cant-reach":{label:"Can’t reach",tooltip:"No answer. See Details.",tone:"error"},"setup-problem":{label:"Setup problem",tooltip:"Couldn’t start. See Details.",tone:"error"},connecting:{label:"Connecting…",tooltip:"Connecting to this server.",tone:"calm"},"not-checked":{label:"Not checked yet",tooltip:"Nothing has checked it yet.",tone:"calm"},off:{label:"Off",tooltip:"Hidden from the agent.",tone:"calm"}},En={"needs-sign-in":"sign-in","signing-in":"none",connected:"none","signed-in":"test","uses-your-key":"test","cant-reach":"try-again","setup-problem":"try-again",connecting:"none","not-checked":"test",off:"none"};function On(e){return En[e]}function zn({toolCount:e,justSignedIn:s}){const t=s?"Signed in just now. ":"";return e===null?`${t||"This server answered. "}Its tools are available.`:`${t}${e} tool${e===1?"":"s"} available.`}function Pn(e,s){switch(e){case"needs-sign-in":return`Sign in to ${s.displayName} to use its tools.`;case"signing-in":return null;case"connected":return zn(s);case"signed-in":return s.justSignedIn?"Signed in just now. Test to check it answers.":"Signed in. Test to check it answers.";case"uses-your-key":return"You added an access key when setting this up.";case"cant-reach":return"This server didn’t answer. It may be down.";case"setup-problem":return"This server’s setup has a problem.";case"connecting":return"Connecting to this server.";case"not-checked":return"Nothing has checked this server yet.";case"off":return"Turned off. The agent doesn’t see this server."}}function Rn(e){const{connection:s,authStatus:t,clientOrigin:i}=e;return s.transport==="stdio"?"None. This server doesn’t need one.":s.authKind==="oauth2"?i==="manual"?`Your own app credentials, ${t==="connected"?"signed in, renews automatically":"not signed in yet"}. DorkOS holds the key, not the agent.`:t==="connected"?"Signed in, and it renews automatically. DorkOS holds the key, not the agent.":"DorkOS will hold the key, not the agent.":Object.keys(s.headers).some(r=>r.toLowerCase()==="authorization")?"Access key: you added a key when setting this up.":t===void 0?"Nothing has checked this yet.":"None. This server doesn’t need one."}function In(e){if(e.transport==="stdio")return`Runs \`${e.command}\` on this computer`;const s=Fn(e.url);return s?`${s} (web service)`:`${e.url} (web service)`}function Fn(e){try{return new URL(e).host}catch{return null}}const Dn={agent:"Added to this agent through DorkOS",project:"From this project’s config files",plugin:"Comes with a plugin",computer:"From your computer-wide config"},Ln={agent:"Added to this agent through DorkOS.",project:"From this project’s config. Add it to manage it here.",plugin:"Comes with a plugin. Add it to manage it here.",computer:"From your computer-wide config. Add it to manage it here."},_n=[{runtime:"claude-code",pattern:/^plugin:([^:]+):(.+)$/,read:e=>({pluginName:e[1],displayName:e[2]})},{runtime:"claude-code",pattern:/^plugin:(.+)$/,read:e=>({pluginName:e[1],displayName:e[1]})}];function Ae(e){for(const s of _n){const t=e.match(s.pattern);if(!t)continue;const{displayName:i,pluginName:a}=s.read(t);if(!(!i||!a))return{displayName:i,pluginName:a,rawName:e}}return{displayName:e,pluginName:null,rawName:e}}function $n(e,s){return s.pluginName?"plugin":e.scope==="project"||e.scope==="local"?"project":e.scope==="user"?"computer":null}const Kn="Loaded from outside DorkOS. Add it to manage it here.";function Te(e,s){return e==="plugin"&&s?`Comes with the ${s} plugin`:Dn[e]}function Bn(e,s){return e===null?Kn:e==="plugin"&&s?`Comes with the ${s} plugin. Add it to manage it here.`:Ln[e]}const Un=ae("border-border/60 relative overflow-hidden rounded-md border px-3 py-2.5 transition-colors",{variants:{managed:{true:"bg-card",false:"bg-muted/30"},dimmed:{true:"opacity-65",false:""}},defaultVariants:{managed:!0,dimmed:!1}}),Vn=ae("pointer-events-none absolute inset-y-0 left-0 w-0.5",{variants:{tone:{calm:"hidden",attention:"bg-status-warning",error:"bg-status-error"}},defaultVariants:{tone:"calm"}}),qn=ae("shrink-0 rounded-full px-2 py-0.5 text-2xs leading-4 font-medium whitespace-nowrap",{variants:{chip:{success:"bg-status-success-bg text-status-success-fg",info:"bg-status-info-bg text-status-info-fg",warning:"bg-status-warning-bg text-status-warning-fg",error:"bg-status-error-bg text-status-error-fg",neutral:"bg-muted text-muted-foreground"}},defaultVariants:{chip:"neutral"}}),Hn={connected:"success","signed-in":"info","needs-sign-in":"warning","signing-in":"warning","cant-reach":"error","setup-problem":"error","uses-your-key":"neutral",connecting:"neutral","not-checked":"neutral",off:"neutral"};function Yn({status:e}){const s=ke[e];return n.jsxs(fe,{children:[n.jsx(xe,{asChild:!0,children:n.jsx("span",{className:qn({chip:Hn[e]}),children:s.label})}),n.jsx(je,{children:s.tooltip})]})}function Gn({scope:e,pluginName:s}){return n.jsxs(fe,{children:[n.jsx(xe,{asChild:!0,children:n.jsx(qe,{size:"xs",tone:"neutral",variant:"secondary",className:"shrink-0 font-normal",children:e})}),n.jsx(je,{children:Te(e,s)})]})}function Me({displayName:e,rawName:s,scope:t,pluginName:i,status:a,sentence:r,managed:c,toggle:u,actions:h,children:x,details:p,defaultDetailsOpen:m=!1}){const[o,j]=l.useState(m),C=l.useId(),b=ke[a].tone;return n.jsxs("div",{"data-mcp-server":s,className:le(Un({managed:c,dimmed:a==="off"}),"mb-2 last:mb-0"),children:[n.jsx("span",{className:Vn({tone:b}),"aria-hidden":!0}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:e}),t&&n.jsx(Gn,{scope:t,pluginName:i}),n.jsx(Yn,{status:a}),u]}),r&&n.jsx("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:r}),x,h&&n.jsx("div",{className:"mt-2 flex items-center gap-1",children:h}),p&&n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",onClick:()=>j(k=>!k),"aria-expanded":o,"aria-controls":C,className:"text-muted-foreground hover:text-foreground mt-2 flex items-center gap-1 text-xs focus-visible:ring-2",children:[n.jsx(X,{className:le("size-3 transition-transform",o&&"rotate-90"),"aria-hidden":!0}),"Details"]}),o&&n.jsxs("div",{id:C,children:[p,n.jsxs("button",{type:"button",onClick:()=>j(!1),className:"text-muted-foreground hover:text-foreground mt-2 flex items-center gap-1 text-xs focus-visible:ring-2",children:[n.jsx(X,{className:"size-3 -rotate-90","aria-hidden":!0}),"Collapse details"]})]})]})]})}const Qn=3,$="text-muted-foreground/70";function Wn({tools:e}){const[s,t]=l.useState(!1),i=s?e:e.slice(0,Qn),a=e.length-i.length;return n.jsxs("div",{className:"mt-1.5",children:[i.map(r=>n.jsxs("div",{className:"border-border/40 flex items-baseline gap-2 border-b py-1 last:border-b-0",children:[n.jsx("code",{className:"text-foreground text-2xs shrink-0 font-mono",children:r.name}),r.description&&n.jsx("span",{className:"text-muted-foreground text-2xs truncate",children:r.description})]},r.name)),a>0&&n.jsxs("button",{type:"button",onClick:()=>t(!0),className:"text-muted-foreground hover:text-foreground mt-1 flex items-center gap-1 text-xs focus-visible:ring-2",children:[n.jsx(X,{className:"size-3","aria-hidden":!0}),"Show ",a," more"]})]})}function Zn(e){const{scope:s,pluginName:t,connection:i}=e;return s==="plugin"&&t?`Comes with the ${t} plugin`:i?In(i):s?Te(s,t):null}function Ee({connection:e,authStatus:s,authClientOrigin:t,scope:i,pluginName:a,rawName:r,displayName:c,toolCount:u,tools:h,serverInfo:x,alsoUsedBy:p,error:m}){const o=Zn({scope:i,pluginName:a,connection:e});return n.jsxs("div",{className:"border-border/60 text-muted-foreground mt-2 space-y-1 border-t pt-2 text-xs leading-relaxed",children:[e&&n.jsx(_,{label:"Sign-in",align:"start",wrap:!0,labelClassName:$,children:n.jsxs("span",{className:"inline-flex items-start gap-1.5",children:[n.jsx(He,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),Rn({connection:e,authStatus:s,clientOrigin:t})]})}),o&&n.jsx(_,{label:"Source",align:"start",wrap:!0,labelClassName:$,children:o}),r!==c&&n.jsx(_,{label:"Raw id",align:"start",wrap:!0,labelClassName:$,children:n.jsx("code",{className:"text-2xs font-mono",children:r})}),x&&n.jsx(_,{label:"Server",align:"start",wrap:!0,labelClassName:$,children:x}),p&&n.jsx(_,{label:"Also used by",align:"start",wrap:!0,labelClassName:$,children:p}),typeof u=="number"&&n.jsx(_,{label:"Tools",align:"start",labelClassName:$,children:u}),h&&h.length>0&&n.jsx(Wn,{tools:h}),m&&n.jsx(_,{label:"Error",align:"start",wrap:!0,labelClassName:$,children:n.jsx("code",{className:"text-2xs font-mono break-all",children:m})})]})}function Jn({flow:e,serverName:s}){return n.jsxs(n.Fragment,{children:[n.jsx(Ne,{flow:e,serverName:s,failedActions:n.jsxs(n.Fragment,{children:[n.jsx(f,{variant:"secondary",size:"sm",onClick:()=>e.start(),className:"focus-visible:ring-2",children:"Try again"}),n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>e.reset(),className:"focus-visible:ring-2",children:"Dismiss"})]}),connectedActions:n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>e.reset(),className:"focus-visible:ring-2",children:"Dismiss"})}),(e.state.step==="disclosure"||e.state.step==="waiting")&&n.jsx("div",{className:"mt-2",children:n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>e.reset(),"aria-label":`Cancel signing in to ${s}`,className:"focus-visible:ring-2",children:"Cancel"})})]})}function Xn({server:e,agentId:s,live:t,testResult:i,rosterUpdatedAt:a,testing:r,busy:c,onToggle:u,onTest:h,onRemove:x}){const p=ve(s,e.name),m=p.state.step==="connected",o=Cn({stamped:i,signedInNow:m,authStatus:e.authStatus,rosterUpdatedAt:a}),j=Ce(e.connection),C=we({enabled:e.enabled,testedOk:(o==null?void 0:o.ok)===!0,signedInNow:m,runtimeStatus:t==null?void 0:t.status,runtimeError:t==null?void 0:t.error,authStatus:e.authStatus,ownKey:j}),b=p.state.step==="starting",k=p.state.step==="disclosure"||p.state.step==="waiting"||b,v=k?"signing-in":C,z=yn({statusKey:C,testResult:o,signedInNow:m})&&(p.state.step==="idle"||b),y=Ae(e.name),M=o!=null&&o.ok?o.toolCount??null:p.state.toolCount,P=k?v:wn({status:v,probe:o}),A=Pn(P,{displayName:y.displayName,toolCount:M,justSignedIn:m}),E=k?"none":On(P),R=Sn({connection:e.connection,authStatus:e.authStatus});return n.jsx(Me,{displayName:y.displayName,rawName:e.name,scope:"agent",pluginName:y.pluginName,status:v,sentence:A,managed:!0,toggle:n.jsx(Je,{checked:e.enabled,onCheckedChange:T=>u(e.name,T),disabled:c,"aria-label":`Enable ${e.name}`}),actions:n.jsxs(n.Fragment,{children:[z&&n.jsxs(f,{variant:"default",size:"sm",onClick:()=>p.start(),disabled:c||b,"aria-label":`Sign in to ${e.name}`,className:"gap-1.5 focus-visible:ring-2",children:[n.jsx(de,{className:"size-3.5","aria-hidden":!0}),"Sign in"]}),!z&&E==="try-again"&&n.jsxs(f,{variant:"outline",size:"sm",onClick:()=>h(e.name),disabled:r||c,"aria-label":`Try ${e.name} again`,className:"gap-1.5 focus-visible:ring-2",children:[r?n.jsx(ee,{size:"xs"}):null,"Try again"]}),!z&&E==="test"&&n.jsx(f,{variant:"outline",size:"sm",onClick:()=>h(e.name),disabled:r||c,className:"focus-visible:ring-2",children:r?n.jsx(ee,{size:"xs"}):"Test"}),n.jsxs(Ye,{children:[n.jsx(Ge,{asChild:!0,children:n.jsx(f,{variant:"ghost",size:"sm","aria-label":`More actions for ${e.name}`,className:"ml-auto focus-visible:ring-2",children:n.jsx(Qe,{className:"size-4","aria-hidden":!0})})}),n.jsxs(We,{align:"end",children:[n.jsxs(J,{onSelect:()=>h(e.name),disabled:r||c,children:[n.jsx(cn,{className:"size-3.5","aria-hidden":!0}),"Test"]}),R&&n.jsxs(J,{onSelect:()=>p.start(),disabled:c,children:[n.jsx(de,{className:"size-3.5","aria-hidden":!0}),"Sign in again"]}),n.jsx(Ze,{}),n.jsx(J,{variant:"destructive",onSelect:()=>x(e.name),disabled:c,children:"Remove"})]})]})]}),details:n.jsx(Ee,{connection:e.connection,authStatus:e.authStatus,authClientOrigin:e.authClientOrigin,scope:"agent",pluginName:y.pluginName,rawName:y.rawName,displayName:y.displayName,toolCount:M,error:(o==null?void 0:o.ok)===!1?o.error:t==null?void 0:t.error}),children:n.jsx(Jn,{flow:p,serverName:y.displayName})})}function es(e){switch(e.status){case"connected":return"connected";case"failed":return ie(e.error);case"needs-auth":return"needs-sign-in";case"pending":return"connecting";case"disabled":return"off";default:return"not-checked"}}function ns(e){const{displayName:s,scope:t,pluginName:i}=e,a=ss(t,i);return`${s} ${a}. Manage it here to enable, disable, or sign in from DorkOS.`}function ss(e,s){return e==="plugin"&&s?`comes with the ${s} plugin`:e==="project"?"comes from this project’s own config":e==="computer"?"comes from your computer-wide config":"is loaded from outside DorkOS"}function ts({entry:e,agentId:s,agentLabel:t,canImport:i}){const a=dn(),[r,c]=l.useState(null),[u,h]=l.useState(null),x=l.useCallback(async()=>{h(null);try{const v=await a.mutateAsync({input:{agentId:s,name:e.name}});v.status==="approval_required"&&c(v.approval)}catch(v){h(v instanceof Error?v.message:"Couldn’t add the server.")}},[a,s,e.name]),p=l.useCallback(async()=>{if(r){h(null);try{(await a.mutateAsync({input:{agentId:s,name:e.name},approval:r})).status!=="ok"&&h("Adding it still needs approval. Try again.")}catch(v){h(v instanceof Error?v.message:"Couldn’t add the server.")}}},[a,s,e.name,r]),m=Ae(e.name),o=$n(e,m),j=o!==null,C=m.rawName!==m.displayName,b=e.error!==void 0,k=j||C||b;return r?n.jsxs("div",{className:"border-border/60 mb-2 space-y-3 rounded-md border p-3 last:mb-0",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(te,{className:"text-status-warning mt-0.5 size-4 shrink-0","aria-hidden":!0}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Add “",m.displayName,"” to ",t,"?"]}),n.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:ns({displayName:m.displayName,scope:o,pluginName:m.pluginName})})]})]}),u&&n.jsx("p",{className:"text-destructive text-xs",children:u}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>c(null),disabled:a.isPending,className:"focus-visible:ring-2",children:"Cancel"}),n.jsx(f,{size:"sm",onClick:p,disabled:a.isPending,className:"focus-visible:ring-2",children:a.isPending?"Adding…":"Add to agent"})]})]}):n.jsx(Me,{displayName:m.displayName,rawName:e.name,scope:o,pluginName:m.pluginName,status:es(e),sentence:Bn(o,m.pluginName),managed:!1,actions:i?n.jsxs(n.Fragment,{children:[n.jsxs(f,{variant:"outline",size:"sm",onClick:x,disabled:a.isPending,"aria-label":`Add ${e.name} to agent`,className:"gap-1.5 focus-visible:ring-2",children:[a.isPending?n.jsx(ee,{size:"xs"}):n.jsx(pe,{className:"size-(--size-icon-xs)","aria-hidden":!0}),"Add to agent"]}),u&&n.jsx("p",{className:"text-destructive text-xs",children:u})]}):void 0,details:k?n.jsx(Ee,{scope:o,pluginName:m.pluginName,rawName:m.rawName,displayName:m.displayName,error:e.error}):void 0})}function as(e,s){return{agentId:e,name:s.server.name,connection:s.server.connection}}function rs(e){const s=e.sites.filter(t=>!t.expired).map(t=>t.site);return s.length<=3?s.join(", "):`${s.slice(0,3).join(", ")} and ${s.length-3} more`}function is({agentId:e,agentLabel:s}){const t=Xe(),i=ye(),[a,r]=l.useState(null),[c,u]=l.useState(null),h=l.useCallback(async o=>{if(t.data){u(null);try{const j=await i.mutateAsync({input:as(e,t.data),...o?{approval:o}:{}});j.status!=="approval_required"?r(null):o?u("The browser still needs approval. Try again."):r(j.approval)}catch(j){u(j instanceof Error?j.message:"Couldn’t add the browser.")}}},[i,e,t.data]);if(!t.data)return null;const x=t.data,p=rs(x),m=`${x.loginCommand} <site>`;return n.jsx(F,{children:n.jsxs(D,{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[a?n.jsx(te,{className:"text-status-warning-dot mt-0.5 size-4 shrink-0"}):n.jsx(en,{className:"text-muted-foreground mt-0.5 size-4 shrink-0"}),n.jsxs("div",{className:"min-w-0 space-y-1",children:[n.jsx("p",{className:"text-sm font-medium",children:a?`Give ${s} the signed-in browser?`:"Signed-in browser"}),a?n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-muted-foreground text-xs",children:"Runs on this computer when a chat starts."}),n.jsx("p",{className:"text-muted-foreground text-xs",children:"Each chat gets its own browser."})]}):n.jsx("p",{className:"text-muted-foreground text-xs",children:"Starts signed in to your saved sites. The agent never sees your passwords."}),x.saved?n.jsxs("p",{className:"text-xs",children:["Signed in to ",p,"."]}):n.jsxs("p",{className:"text-status-warning-fg text-xs",children:["Starts signed out. Run ",n.jsx("code",{className:"font-mono",children:m}),n.jsx(nn,{value:m,label:"Copy the sign-in command",size:"xs",className:"mx-0.5 inline-flex align-middle"})," ","in a terminal first."]})]})]}),a&&n.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded-md px-3 py-2 font-mono text-xs",children:[x.server.connection.command,...x.server.connection.args].join(" ")}),c&&n.jsx("p",{className:"text-destructive text-xs",children:c}),n.jsxs("div",{className:"flex justify-end gap-2",children:[a&&n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>r(null),disabled:i.isPending,className:"focus-visible:ring-2",children:"Back"}),n.jsx(f,{variant:a?"default":"outline",size:"sm",onClick:()=>void h(a??void 0),disabled:i.isPending,className:"focus-visible:ring-2",children:i.isPending?"Adding…":a?"Add browser":"Give it the browser"})]})]})})}const os={codex:["stdio","http"],opencode:["stdio","http"]};function he(e){return os[e]??fn}function cs(){const{open:e}=an();return n.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Want other apps to use DorkOS’s tools?"," ",n.jsx(f,{variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>e("tools","external-mcp"),children:"See Settings → Advanced → Tools"})]})}function ls({agent:e,projectPath:s}){var q;const t=sn(e.id),i=ln(s,e.runtime),a=i.data,r=tn(e.runtime),c=(r==null?void 0:r.supportsManagedMcpServers)??!0,u=mn(),h=hn(),x=un(),p=gn(),[m,o]=l.useState({}),[j,C]=l.useState(null),[b,k]=l.useState(null),v=Mn(),z=l.useCallback((d,N)=>{(N?u:h).mutate({agentId:e.id,name:d})},[e.id,u,h]),y=l.useCallback(d=>{x.mutate({agentId:e.id,name:d}),o(N=>{const w={...N};return delete w[d],w})},[e.id,x]),M=l.useCallback(async d=>{C(d);try{const N=await p.mutateAsync({agentId:e.id,name:d});o(w=>({...w,[d]:{result:N,at:Date.now()}}))}finally{C(null)}},[e.id,p]),P=l.useCallback(({name:d,transport:N})=>{k(d),N!=="stdio"&&M(d).catch(()=>{})},[M]),A=t.data??[],E=new Set(A.map(d=>d.name)),R=new Map(((a==null?void 0:a.servers)??[]).map(d=>[d.name,d])),T=((a==null?void 0:a.servers)??[]).filter(d=>!E.has(d.name)),I=u.isPending||h.isPending||x.isPending,Z=A.some(d=>on(d.connection)!==void 0),U=c&&!t.isPending&&!Z&&he(e.runtime).includes("stdio"),K=new Map;A.forEach((d,N)=>K.set(d.name,{kind:"managed",index:N})),T.forEach((d,N)=>K.set(d.name,{kind:"discovered",index:N}));const V=v({bothSettled:!t.isPending&&!i.isPending,managed:A,live:R,discovered:T,present:[...A.map(d=>d.name),...T.map(d=>d.name)]});function B(d){const N=K.get(d);if(!N)return null;if(N.kind==="managed"){const O=A[N.index];return n.jsx(Xn,{server:O,agentId:e.id,live:R.get(O.name),testResult:m[O.name],rosterUpdatedAt:t.dataUpdatedAt,testing:j===O.name,busy:I,onToggle:z,onTest:M,onRemove:y},O.name)}const w=T[N.index];return n.jsx(ts,{entry:w,agentId:e.id,agentLabel:e.displayName??e.name,canImport:c},w.name)}return n.jsxs("section",{className:"space-y-3","aria-label":"MCP servers",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-sm font-semibold",children:"MCP Servers"}),c&&n.jsx(vn,{agentId:e.id,agentLabel:e.displayName??e.name,supportedTransports:he(e.runtime),onAdded:P,oauthDetectedFor:b&&((q=m[b])==null?void 0:q.result.needsAuth)===!0?b:null})]}),n.jsx(cs,{}),U&&n.jsx(is,{agentId:e.id,agentLabel:e.displayName??e.name}),!c&&n.jsx("p",{className:"text-muted-foreground text-xs",children:"This agent can’t use added servers yet. View only."}),t.isLoading?n.jsx(F,{children:n.jsxs(D,{className:"space-y-2",children:[n.jsx(ne,{className:"h-5 w-full"}),n.jsx(ne,{className:"h-5 w-3/4"})]})}):t.isError?n.jsx(F,{children:n.jsxs(D,{className:"flex items-center justify-between gap-2",children:[n.jsx("p",{className:"text-destructive text-sm",children:"Couldn’t load managed servers."}),n.jsx(f,{variant:"outline",size:"sm",onClick:()=>t.refetch(),className:"focus-visible:ring-2",children:"Try again"})]})}):V.length===0?n.jsx(F,{children:n.jsx(D,{children:n.jsxs("p",{className:"text-muted-foreground text-sm",children:["No MCP servers yet."," ",c?"Add one for more tools.":"This agent can’t use them yet."]})})}):n.jsx(F,{children:n.jsx(D,{children:V.map(B)})})]})}function gs({member:e}){const{agent:s,projectPath:t,isPending:i}=rn(e);return i?n.jsx(ne,{className:"h-32 w-full"}):!s||t===null?n.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s MCP servers."}):n.jsx(ls,{agent:s,projectPath:t})}export{gs as ToolsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{V as PRn,nG as ORn,hA as NRn,r as sn,j as de,ev as Kan,gX as $Rn,i9 as DRn,nH as LRn,mI as _Rn,U as MN,be as A2e,B as Wan,gd as Van,ab as r2,h1 as M2e,aX as C2e,aW as FRn,a1 as jN,f as RRn,hC as BRn,X as JRn,nI as GRn,nJ as Fhn,eH as HRn,jU as qRn,gb as zRn,ai as URn,nK as XRn,fU as KRn,h4 as WRn,fV as VRn,fW as QRn,bz as VX,h8 as YRn,aV as Rhn,Y as ZRn,fr as eBn,h2 as nBn,lL as tBn,fZ as iBn,fI as rBn,fJ as cBn,fK as uBn,fL as oBn,fM as sBn,fN as fBn,fO as lBn,fP as hBn,nL as aBn}from"./index-Bbffv0TQ.js";import{H as wK}from"./_shell.team-DvJK7irE.js";import{a as e2e,A as dBn}from"./AdapterIcon-wGSXBn-k.js";import{s as bBn}from"./session-strategy-labels-C7Wduch3.js";import{u as wBn}from"./use-mesh-topology-wYtCBbF_.js";import{u as gBn}from"./use-delete-binding-CUsepFIL.js";import"./use-pending-read-9UcfnDwF.js";import"./search-x-CoFJOP2l.js";import"./scroll-area-Dph6w3a6.js";import"./agent-attention-BvnWcLpc.js";import"./page-container-BOrdASM1.js";/**
|
|
2
2
|
* @license lucide-react v1.48.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as d,hA as b,j as L,B as ve,ab as Ye,hB as Ce,ds as Ze,ev as Xe,d5 as Y,l as Q,hC as Qe,a5 as Je,a6 as et,ae as tt,g$ as me,a7 as nt,hD as rt,eD as ot,fU as it,b1 as st,aK as at,d8 as lt,bN as ct,eI as ut,aE as ge}from"./index-Bbffv0TQ.js";import{D as z}from"./dorkbot-templates-cu4wApxb.js";import{u as ft}from"./use-external-adapter-catalog-CAl3MNq-.js";var dt={attributes:!0,characterData:!0,subtree:!0,childList:!0};function ht(e,t,n=dt){d.useEffect(()=>{if(e.current){const r=new MutationObserver(t);return r.observe(e.current,n),()=>{r.disconnect()}}},[t,n])}var Le=(function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(o,s){return o[0]===n?(r=s,!0):!1}),r}return(function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(n){var r=e(this.__entries__,n),o=this.__entries__[r];return o&&o[1]},t.prototype.set=function(n,r){var o=e(this.__entries__,n);~o?this.__entries__[o][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,o=e(r,n);~o&&r.splice(o,1)},t.prototype.has=function(n){return!!~e(this.__entries__,n)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var o=0,s=this.__entries__;o<s.length;o++){var i=s[o];n.call(r,i[1],i[0])}},t})()})(),ue=typeof window<"u"&&typeof document<"u"&&window.document===document,te=(function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()})(),pt=(function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(te):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}})(),vt=2;function mt(e,t){var n=!1,r=!1,o=0;function s(){n&&(n=!1,e()),r&&a()}function i(){pt(s)}function a(){var c=Date.now();if(n){if(c-o<vt)return;r=!0}else n=!0,r=!1,setTimeout(i,t);o=c}return a}var gt=20,bt=["top","right","bottom","left","width","height","size","weight"],yt=typeof MutationObserver<"u",wt=(function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=mt(this.refresh.bind(this),gt)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var n=this.observers_,r=n.indexOf(t);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return t.forEach(function(n){return n.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!ue||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),yt?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!ue||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,o=bt.some(function(s){return!!~r.indexOf(s)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e})(),Me=(function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e}),B=(function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||te}),Te=ie(0,0,0,0);function ne(e){return parseFloat(e)||0}function be(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,o){var s=e["border-"+o+"-width"];return r+ne(s)},0)}function _t(e){for(var t=["top","right","bottom","left"],n={},r=0,o=t;r<o.length;r++){var s=o[r],i=e["padding-"+s];n[s]=ne(i)}return n}function Et(e){var t=e.getBBox();return ie(0,0,t.width,t.height)}function Ot(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return Te;var r=B(e).getComputedStyle(e),o=_t(r),s=o.left+o.right,i=o.top+o.bottom,a=ne(r.width),c=ne(r.height);if(r.boxSizing==="border-box"&&(Math.round(a+s)!==t&&(a-=be(r,"left","right")+s),Math.round(c+i)!==n&&(c-=be(r,"top","bottom")+i)),!Rt(e)){var u=Math.round(a+s)-t,l=Math.round(c+i)-n;Math.abs(u)!==1&&(a-=u),Math.abs(l)!==1&&(c-=l)}return ie(o.left,o.top,a,c)}var xt=(function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof B(e).SVGGraphicsElement}:function(e){return e instanceof B(e).SVGElement&&typeof e.getBBox=="function"}})();function Rt(e){return e===B(e).document.documentElement}function St(e){return ue?xt(e)?Et(e):Ot(e):Te}function kt(e){var t=e.x,n=e.y,r=e.width,o=e.height,s=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,i=Object.create(s.prototype);return Me(i,{x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:o+n,left:t}),i}function ie(e,t,n,r){return{x:e,y:t,width:n,height:r}}var Ct=(function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=ie(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=St(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e})(),Lt=(function(){function e(t,n){var r=kt(n);Me(this,{target:t,contentRect:r})}return e})(),Mt=(function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new Le,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=n,this.callbackCtx_=r}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof B(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new Ct(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof B(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)&&(n.delete(t),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&t.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new Lt(r.target,r.broadcastRect())});this.callback_.call(t,n,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e})(),Ae=typeof WeakMap<"u"?new WeakMap:new Le,Ie=(function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=wt.getInstance(),r=new Mt(t,n,this);Ae.set(this,r)}return e})();["observe","unobserve","disconnect"].forEach(function(e){Ie.prototype[e]=function(){var t;return(t=Ae.get(this))[e].apply(t,arguments)}});var Tt=(function(){return typeof te.ResizeObserver<"u"?te.ResizeObserver:Ie})(),At=({mutationObservables:e,resizeObservables:t,refresh:n})=>{const[r,o]=d.useState(0),s=d.useRef(document.documentElement||document.body);function i(c){const u=Array.from(c);for(const l of u)if(e){if(!l.attributes)continue;e.find(v=>l.matches(v))&&n(!0)}}function a(c){const u=Array.from(c);for(const l of u)if(t){if(!l.attributes)continue;t.find(v=>l.matches(v))&&o(r+1)}}return ht(s,c=>{for(const u of c)u.addedNodes.length!==0&&(i(u.addedNodes),a(u.addedNodes)),u.removedNodes.length!==0&&(i(u.removedNodes),a(u.removedNodes))},{childList:!0,subtree:!0}),d.useEffect(()=>{if(!t)return;const c=new Tt(()=>{n()});for(const u of t){const l=document.querySelector(u);l&&c.observe(l)}return()=>{c.disconnect()}},[t,r]),null},It=At;function ee(e){let t=Pe;return e&&(t=e.getBoundingClientRect()),t}function Pt(e,t){const[n,r]=d.useState(Pe),o=d.useCallback(()=>{e!=null&&e.current&&r(ee(e==null?void 0:e.current))},[e==null?void 0:e.current]);return d.useEffect(()=>(o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)),[e==null?void 0:e.current,t]),n}var Pe={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Dt(e,t){return new Promise(n=>{if(!(e instanceof Element))throw new TypeError("Argument 1 must be an Element");let r=0,o=null;const s=Object.assign({behavior:"smooth"},t);e.scrollIntoView(s),requestAnimationFrame(i);function i(){const a=e==null?void 0:e.getBoundingClientRect().top;if(a===o){if(r++>2)return n(null)}else r=0,o=a;requestAnimationFrame(i)}})}function J(e){return e<0?0:e}function Nt(e){return typeof e=="object"&&e!==null?{thresholdX:e.x||0,thresholdY:e.y||0}:{thresholdX:e||0,thresholdY:e||0}}function se(){const e=Math.max(document.documentElement.clientWidth,window.innerWidth||0),t=Math.max(document.documentElement.clientHeight,window.innerHeight||0);return{w:e,h:t}}function Ht({top:e,right:t,bottom:n,left:r,threshold:o}){const{w:s,h:i}=se(),{thresholdX:a,thresholdY:c}=Nt(o);return e<0&&n-e>i?!0:e>=0+c&&r>=0+a&&n<=i-c&&t<=s-a}var ye=(e,t)=>e>t,we=(e,t)=>e>t;function jt(e,t=[]){const n=(r,o)=>t.includes(r)?1:t.includes(o)?-1:0;return Object.keys(e).map(r=>({position:r,value:e[r]})).sort((r,o)=>o.value-r.value).sort((r,o)=>n(r.position,o.position)).filter(r=>r.value>0).map(r=>r.position)}var ce=10;function fe(e=ce){return Array.isArray(e)?e.length===1?[e[0],e[0],e[0],e[0]]:e.length===2?[e[1],e[0],e[1],e[0]]:e.length===3?[e[0],e[1],e[2],e[1]]:e.length>3?[e[0],e[1],e[2],e[3]]:[ce,ce]:[e,e,e,e]}var $t={maskWrapper:()=>({opacity:.7,left:0,top:0,position:"fixed",zIndex:99999,pointerEvents:"none",color:"#000"}),svgWrapper:({windowWidth:e,windowHeight:t,wpt:n,wpl:r})=>({width:e,height:t,left:Number(r),top:Number(n),position:"fixed"}),maskArea:({x:e,y:t,width:n,height:r})=>({x:e,y:t,width:n,height:r,fill:"black",rx:0}),maskRect:({windowWidth:e,windowHeight:t,maskID:n})=>({x:0,y:0,width:e,height:t,fill:"currentColor",mask:`url(#${n})`}),clickArea:({windowWidth:e,windowHeight:t,clipID:n})=>({x:0,y:0,width:e,height:t,fill:"currentcolor",pointerEvents:"auto",clipPath:`url(#${n})`}),highlightedArea:({x:e,y:t,width:n,height:r})=>({x:e,y:t,width:n,height:r,pointerEvents:"auto",fill:"transparent",display:"none"})};function zt(e){return(t,n)=>{const r=$t[t](n),o=e[t];return o?o(r,n):r}}var Ft=({padding:e=10,wrapperPadding:t=0,onClick:n,onClickHighlighted:r,styles:o={},sizes:s,className:i,highlightedAreaClassName:a,maskId:c,clipId:u})=>{const l=c||_e("mask__"),f=u||_e("clip__"),v=zt(o),[g,_,O,y]=fe(e),[p,E,x,k]=fe(t),{w:h,h:T}=se(),M=J((s==null?void 0:s.width)+y+_),C=J((s==null?void 0:s.height)+g+O),w=J((s==null?void 0:s.top)-g-p),R=J((s==null?void 0:s.left)-y-k),A=h-k-E,S=T-p-x,j=v("maskArea",{x:R,y:w,width:M,height:C}),$=v("highlightedArea",{x:R,y:w,width:M,height:C});return b.createElement("div",{style:v("maskWrapper",{}),onClick:n,className:i},b.createElement("svg",{width:A,height:S,xmlns:"http://www.w3.org/2000/svg",style:v("svgWrapper",{windowWidth:A,windowHeight:S,wpt:p,wpl:k})},b.createElement("defs",null,b.createElement("mask",{id:l},b.createElement("rect",{x:0,y:0,width:A,height:S,fill:"white"}),b.createElement("rect",{style:j,rx:j.rx?1:void 0})),b.createElement("clipPath",{id:f},b.createElement("polygon",{points:`0 0, 0 ${S}, ${R} ${S}, ${R} ${w}, ${R+M} ${w}, ${R+M} ${w+C}, ${R} ${w+C}, ${R} ${S}, ${A} ${S}, ${A} 0`}))),b.createElement("rect",{style:v("maskRect",{windowWidth:A,windowHeight:S,maskID:l})}),b.createElement("rect",{style:v("clickArea",{windowWidth:A,windowHeight:S,top:w,left:R,width:M,height:C,clipID:f})}),b.createElement("rect",{style:$,className:a,onClick:r,rx:$.rx?1:void 0})))},Vt=Ft;function _e(e){return e+Math.random().toString(36).substring(2,16)}var Wt=Object.defineProperty,re=Object.getOwnPropertySymbols,De=Object.prototype.hasOwnProperty,Ne=Object.prototype.propertyIsEnumerable,Ee=(e,t,n)=>t in e?Wt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oe=(e,t)=>{for(var n in t||(t={}))De.call(t,n)&&Ee(e,n,t[n]);if(re)for(var n of re(t))Ne.call(t,n)&&Ee(e,n,t[n]);return e},Bt=(e,t)=>{var n={};for(var r in e)De.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&re)for(var r of re(e))t.indexOf(r)<0&&Ne.call(e,r)&&(n[r]=e[r]);return n},qt={popover:()=>({position:"fixed",maxWidth:353,backgroundColor:"#fff",padding:"24px 30px",boxShadow:"0 0.5em 3em rgba(0, 0, 0, 0.3)",color:"inherit",zIndex:1e5,transition:"transform 0.3s",top:0,left:0})};function Gt(e){return(t,n)=>{const r=qt[t](n),o=e[t];return o?o(r,n):r}}var Kt=e=>{var t=e,{children:n,position:r="bottom",padding:o=10,styles:s={},sizes:i,refresher:a}=t,c=Bt(t,["children","position","padding","styles","sizes","refresher"]);const u=d.useRef(null),l=d.useRef(""),f=d.useRef(""),v=d.useRef(""),{w:g,h:_}=se(),O=Gt(s),y=Pt(u,a),{width:p,height:E}=y,[x,k,h,T]=fe(o),M=(i==null?void 0:i.left)-T,C=(i==null?void 0:i.top)-x,w=(i==null?void 0:i.right)+k,R=(i==null?void 0:i.bottom)+h,A=r&&typeof r=="function"?r({width:p,height:E,windowWidth:g,windowHeight:_,top:C,left:M,right:w,bottom:R,x:i.x,y:i.y},y):r,S={left:M,right:g-w,top:C,bottom:_-R},j=(I,D,N)=>{switch(I){case"top":return S.top>E+h;case"right":return D?!1:S.right>p+T;case"bottom":return N?!1:S.bottom>E+x;case"left":return S.left>p+k;default:return!1}},$=(I,D,N)=>{const m=jt(S,N?["right","left"]:D?["top","bottom"]:[]);for(let H=0;H<m.length;H++)if(j(m[H],D,N))return l.current=m[H],I[m[H]];return l.current="center",I.center},G=(I=>{if(Array.isArray(I)){const V=ye(I[0],g),le=we(I[1],_);return l.current="custom",[V?g/2-p/2:I[0],le?_/2-E/2:I[1]]}const D=ye(M+p,g),N=we(R+E,_),m=D?Math.min(M,g-p):Math.max(M,0),H=N?E>S.bottom?Math.max(R-E,0):Math.max(C,0):C;N&&E>S.bottom?f.current="bottom":f.current="top",D?v.current="left":v.current="right";const K={top:[m-T,C-E-h],right:[w+T,H-x],bottom:[m-T,R+x],left:[M-p-k,H-x],center:[g/2-p/2,_/2-E/2]};return I==="center"||j(I,D,N)&&!D&&!N?(l.current=I,K[I]):$(K,D,N)})(A);return b.createElement("div",Oe({className:"reactour__popover",style:Oe({transform:`translate(${Math.round(G[0])}px, ${Math.round(G[1])}px)`},O("popover",{position:l.current,verticalAlign:f.current,horizontalAlign:v.current,helperRect:y,targetRect:i})),ref:u},c),n)},Ut=Kt,Yt=Object.defineProperty,Zt=Object.defineProperties,Xt=Object.getOwnPropertyDescriptors,oe=Object.getOwnPropertySymbols,He=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,xe=(e,t,n)=>t in e?Yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,P=(e,t)=>{for(var n in t||(t={}))He.call(t,n)&&xe(e,n,t[n]);if(oe)for(var n of oe(t))je.call(t,n)&&xe(e,n,t[n]);return e},he=(e,t)=>Zt(e,Xt(t)),Z=(e,t)=>{var n={};for(var r in e)He.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&oe)for(var r of oe(e))t.indexOf(r)<0&&je.call(e,r)&&(n[r]=e[r]);return n},Qt={bottom:0,height:0,left:0,right:0,top:0,width:0,windowWidth:0,windowHeight:0,x:0,y:0};function Jt(e,t={block:"center",behavior:"smooth",inViewThreshold:0}){const[n,r]=d.useState(!1),[o,s]=d.useState(!1),[i,a]=d.useState(!1),[c,u]=d.useState(null),[l,f]=d.useState(Qt),v=(e==null?void 0:e.selector)instanceof Element?e==null?void 0:e.selector:document.querySelector(e==null?void 0:e.selector),g=d.useCallback(()=>{const O=Re(v,e==null?void 0:e.highlightedSelectors,e==null?void 0:e.bypassElem),{hasHighligtedElems:y}=O,p=Z(O,["hasHighligtedElems"]);Object.entries(l).some(([E,x])=>p[E]!==x)&&f(p)},[v,e==null?void 0:e.highlightedSelectors,l]);d.useEffect(()=>(g(),window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)),[v,e==null?void 0:e.highlightedSelectors,c]),d.useEffect(()=>{!Ht(he(P({},l),{threshold:t.inViewThreshold}))&&v&&(r(!0),Dt(v,t).then(()=>{o||u(Date.now())}).finally(()=>{r(!1)}))},[l]);const _=d.useCallback(()=>{s(!0);const O=Re(v,e==null?void 0:e.highlightedSelectors,e==null?void 0:e.bypassElem),{hasHighligtedElems:y}=O,p=Z(O,["hasHighligtedElems"]);a(y),f(p),s(!1)},[v,e==null?void 0:e.highlightedSelectors,l]);return{sizes:l,transition:n,target:v,observableRefresher:_,isHighlightingObserved:i}}function Re(e,t=[],n=!0){let r=!1;const{w:o,h:s}=se();if(!t)return he(P({},ee(e)),{windowWidth:o,windowHeight:s,hasHighligtedElems:!1});let i=ee(e),a={bottom:0,height:0,left:o,right:0,top:s,width:0};for(const u of t){const l=document.querySelector(u);if(!l||l.style.display==="none"||l.style.visibility==="hidden")continue;const f=ee(l);r=!0,n||!e?(f.top<a.top&&(a.top=f.top),f.right>a.right&&(a.right=f.right),f.bottom>a.bottom&&(a.bottom=f.bottom),f.left<a.left&&(a.left=f.left),a.width=a.right-a.left,a.height=a.bottom-a.top):(f.top<i.top&&(i.top=f.top),f.right>i.right&&(i.right=f.right),f.bottom>i.bottom&&(i.bottom=f.bottom),f.left<i.left&&(i.left=f.left),i.width=i.right-i.left,i.height=i.bottom-i.top)}const c=n||!e?a.width>0&&a.height>0:!1;return{left:(c?a:i).left,top:(c?a:i).top,right:(c?a:i).right,bottom:(c?a:i).bottom,width:(c?a:i).width,height:(c?a:i).height,windowWidth:o,windowHeight:s,hasHighligtedElems:r,x:i.x,y:i.y}}var en=({disableKeyboardNavigation:e,setCurrentStep:t,currentStep:n,setIsOpen:r,stepsLength:o,disable:s,rtl:i,clickProps:a,keyboardHandler:c})=>{function u(l){if(l.stopPropagation(),e===!0||s)return;let f,v,g;e&&(f=e.includes("esc"),v=e.includes("right"),g=e.includes("left"));function _(){t(Math.min(n+1,o-1))}function O(){t(Math.max(n-1,0))}c&&typeof c=="function"?c(l,a,{isEscDisabled:f,isRightDisabled:v,isLeftDisabled:g}):(l.keyCode===27&&!f&&(l.preventDefault(),r(!1)),l.keyCode===39&&!v&&(l.preventDefault(),i?O():_()),l.keyCode===37&&!g&&(l.preventDefault(),i?_():O()))}return d.useEffect(()=>(window.addEventListener("keydown",u,!1),()=>{window.removeEventListener("keydown",u)}),[s,t,n]),null},tn=en,nn={badge:()=>({position:"absolute",fontFamily:"monospace",background:"var(--reactour-accent,#007aff)",height:"1.875em",lineHeight:2,paddingLeft:"0.8125em",paddingRight:"0.8125em",fontSize:"1em",borderRadius:"1.625em",color:"white",textAlign:"center",boxShadow:"0 0.25em 0.5em rgba(0, 0, 0, 0.3)",top:"-0.8125em",left:"-0.8125em"}),controls:()=>({display:"flex",marginTop:24,alignItems:"center",justifyContent:"space-between"}),navigation:()=>({counterReset:"dot",display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap"}),button:({disabled:e})=>({display:"block",padding:0,border:0,background:"none",cursor:e?"not-allowed":"pointer"}),arrow:({disabled:e})=>({color:e?"#caccce":"#646464",width:16,height:12,flex:"0 0 16px"}),dot:({current:e,disabled:t,showNumber:n})=>({counterIncrement:"dot",width:8,height:8,border:e?"0":"1px solid #caccce",borderRadius:"100%",padding:0,display:"block",margin:4,transition:"opacity 0.3s, transform 0.3s",cursor:t?"not-allowed":"pointer",transform:`scale(${e?1.25:1})`,color:e?"var(--reactour-accent, #007aff)":"#caccce",background:e?"var(--reactour-accent, #007aff)":"none"}),close:({disabled:e})=>({position:"absolute",top:22,right:22,width:9,height:9,"--rt-close-btn":e?"#caccce":"#5e5e5e","--rt-close-btn-disabled":e?"#caccce":"#000"}),svg:()=>({display:"block"})};function ae(e){return(t,n)=>{const r=nn[t](n),o=e[t];return o?o(r,n):r}}var rn=({styles:e={},children:t})=>{const n=ae(e);return b.createElement("span",{style:n("badge",{})},t)},on=rn,sn=e=>{var t=e,{styles:n={},onClick:r,disabled:o}=t,s=Z(t,["styles","onClick","disabled"]);const i=ae(n);return b.createElement("button",P({className:"reactour__close-button",style:P(P({},i("button",{})),i("close",{disabled:o})),onClick:r},s),b.createElement("svg",{viewBox:"0 0 9.1 9.1","aria-hidden":!0,role:"presentation",style:P({},i("svg",{}))},b.createElement("path",{fill:"currentColor",d:"M5.9 4.5l2.8-2.8c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0L4.5 3.1 1.7.3C1.3-.1.7-.1.3.3c-.4.4-.4 1 0 1.4l2.8 2.8L.3 7.4c-.4.4-.4 1 0 1.4.2.2.4.3.7.3s.5-.1.7-.3L4.5 6l2.8 2.8c.3.2.5.3.8.3s.5-.1.7-.3c.4-.4.4-1 0-1.4L5.9 4.5z"})))},an=sn,ln=({content:e,setCurrentStep:t,transition:n,isHighlightingObserved:r,currentStep:o,setIsOpen:s})=>typeof e=="function"?e({setCurrentStep:t,transition:n,isHighlightingObserved:r,currentStep:o,setIsOpen:s}):e,cn=ln,un=({styles:e={},steps:t,setCurrentStep:n,currentStep:r,setIsOpen:o,nextButton:s,prevButton:i,disableDots:a,hideDots:c,hideButtons:u,disableAll:l,rtl:f,Arrow:v=$e})=>{const g=t.length,_=ae(e),O=({onClick:y,kind:p="next",children:E,hideArrow:x})=>{function k(){l||(y&&typeof y=="function"?y():n(p==="next"?Math.min(r+1,g-1):Math.max(r-1,0)))}return b.createElement("button",{style:_("button",{kind:p,disabled:l||(p==="next"?g-1===r:r===0)}),onClick:k,"aria-label":`Go to ${p} step`},x?null:b.createElement(v,{styles:e,inverted:f?p==="prev":p==="next",disabled:l||(p==="next"?g-1===r:r===0)}),E)};return b.createElement("div",{style:_("controls",{}),dir:f?"rtl":"ltr"},u?null:i&&typeof i=="function"?i({Button:O,setCurrentStep:n,currentStep:r,stepsLength:g,setIsOpen:o,steps:t}):b.createElement(O,{kind:"prev"}),c?null:b.createElement("div",{style:_("navigation",{})},Array.from({length:g},(y,p)=>p).map(y=>{var p;return b.createElement("button",{style:_("dot",{current:y===r,disabled:a||l}),onClick:()=>{!a&&!l&&n(y)},key:`navigation_dot_${y}`,"aria-label":((p=t[y])==null?void 0:p.navDotAriaLabel)||`Go to step ${y+1}`})})),u?null:s&&typeof s=="function"?s({Button:O,setCurrentStep:n,currentStep:r,stepsLength:g,setIsOpen:o,steps:t}):b.createElement(O,null))},fn=un,$e=({styles:e={},inverted:t=!1,disabled:n})=>{const r=ae(e);return b.createElement("svg",{viewBox:"0 0 18.4 14.4",style:r("arrow",{inverted:t,disabled:n})},b.createElement("path",{d:t?"M17 7.2H1M10.8 1L17 7.2l-6.2 6.2":"M1.4 7.2h16M7.6 1L1.4 7.2l6.2 6.2",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeMiterlimit:"10"}))},dn={Badge:on,Close:an,Content:cn,Navigation:fn,Arrow:$e},hn=e=>P(P({},dn),e),pn=({styles:e,components:t={},badgeContent:n,accessibilityOptions:r,disabledActions:o,onClickClose:s,steps:i,setCurrentStep:a,currentStep:c,transition:u,isHighlightingObserved:l,setIsOpen:f,nextButton:v,prevButton:g,disableDotsNavigation:_,rtl:O,showPrevNextButtons:y=!0,showCloseButton:p=!0,showNavigation:E=!0,showBadge:x=!0,showDots:k=!0,meta:h,setMeta:T,setSteps:M})=>{const C=i[c],{Badge:w,Close:R,Content:A,Navigation:S,Arrow:j}=hn(t),$=n&&typeof n=="function"?n({currentStep:c,totalSteps:i.length,transition:u}):c+1;function q(){o||(s&&typeof s=="function"?s({setCurrentStep:a,setIsOpen:f,currentStep:c,steps:i,meta:h,setMeta:T,setSteps:M}):f(!1))}return b.createElement(b.Fragment,null,x?b.createElement(w,{styles:e},$):null,p?b.createElement(R,{styles:e,"aria-label":r==null?void 0:r.closeButtonAriaLabel,disabled:o,onClick:q}):null,b.createElement(A,{content:C==null?void 0:C.content,setCurrentStep:a,currentStep:c,transition:u,isHighlightingObserved:l,setIsOpen:f}),E?b.createElement(S,{setCurrentStep:a,currentStep:c,setIsOpen:f,steps:i,styles:e,"aria-hidden":!(r!=null&&r.showNavigationScreenReaders),nextButton:v,prevButton:g,disableDots:_,hideButtons:!y,hideDots:!k,disableAll:o,rtl:O,Arrow:j}):null)},vn=pn,mn=e=>{var t=e,{currentStep:n,setCurrentStep:r,setIsOpen:o,steps:s=[],setSteps:i,styles:a={},scrollSmooth:c,afterOpen:u,beforeClose:l,padding:f=10,position:v,onClickMask:g,onClickHighlighted:_,keyboardHandler:O,className:y="reactour__popover",maskClassName:p="reactour__mask",highlightedMaskClassName:E,clipId:x,maskId:k,disableInteraction:h,disableKeyboardNavigation:T,inViewThreshold:M,disabledActions:C,setDisabledActions:w,disableWhenSelectorFalsy:R,rtl:A,accessibilityOptions:S={closeButtonAriaLabel:"Close Tour",showNavigationScreenReaders:!0},ContentComponent:j,Wrapper:$,meta:q,setMeta:G,onTransition:I=()=>"center"}=t,D=Z(t,["currentStep","setCurrentStep","setIsOpen","steps","setSteps","styles","scrollSmooth","afterOpen","beforeClose","padding","position","onClickMask","onClickHighlighted","keyboardHandler","className","maskClassName","highlightedMaskClassName","clipId","maskId","disableInteraction","disableKeyboardNavigation","inViewThreshold","disabledActions","setDisabledActions","disableWhenSelectorFalsy","rtl","accessibilityOptions","ContentComponent","Wrapper","meta","setMeta","onTransition"]),N;const m=s[n],H=P(P({},a),m==null?void 0:m.styles),{sizes:K,transition:V,observableRefresher:le,isHighlightingObserved:pe,target:W}=Jt(m,{block:"center",behavior:c?"smooth":"auto",inViewThreshold:M});d.useEffect(()=>(u&&typeof u=="function"&&u(W),()=>{l&&typeof l=="function"&&l(W)}),[]);const{maskPadding:Ve,popoverPadding:We,wrapperPadding:Be}=bn((N=m==null?void 0:m.padding)!=null?N:f),X={setCurrentStep:r,setIsOpen:o,currentStep:n,setSteps:i,steps:s,setMeta:G,meta:q};function qe(){C||(g&&typeof g=="function"?g(X):o(!1))}const Ge=typeof(m==null?void 0:m.stepInteraction)=="boolean"?!(m!=null&&m.stepInteraction):h?typeof h=="boolean"?h:h(X):!1;d.useEffect(()=>(m!=null&&m.action&&typeof(m==null?void 0:m.action)=="function"&&(m==null||m.action(W)),(m==null?void 0:m.disableActions)!==void 0&&w(m==null?void 0:m.disableActions),()=>{m!=null&&m.actionAfter&&typeof(m==null?void 0:m.actionAfter)=="function"&&(m==null||m.actionAfter(W))}),[m]);const Ke=V?I:m!=null&&m.position?m==null?void 0:m.position:v,Ue=$||b.Fragment;return m?b.createElement(Ue,null,b.createElement(It,{mutationObservables:m==null?void 0:m.mutationObservables,resizeObservables:m==null?void 0:m.resizeObservables,refresh:le}),b.createElement(tn,{setCurrentStep:r,currentStep:n,setIsOpen:o,stepsLength:s.length,disableKeyboardNavigation:T,disable:C,rtl:A,clickProps:X,keyboardHandler:O}),(!R||W)&&b.createElement(Vt,{sizes:V?yn:K,onClick:qe,styles:P({highlightedArea:U=>he(P({},U),{display:Ge?"block":"none"})},H),padding:V?0:Ve,highlightedAreaClassName:E,className:p,onClickHighlighted:U=>{U.preventDefault(),U.stopPropagation(),_&&_(U,X)},wrapperPadding:Be,clipId:x,maskId:k}),(!R||W)&&b.createElement(Ut,{sizes:K,styles:H,position:Ke,padding:We,"aria-labelledby":S==null?void 0:S.ariaLabelledBy,className:y,refresher:n},j?b.createElement(j,P({styles:H,setCurrentStep:r,currentStep:n,setIsOpen:o,steps:s,accessibilityOptions:S,disabledActions:C,transition:V,isHighlightingObserved:pe,rtl:A},D)):b.createElement(vn,P({styles:H,setCurrentStep:r,currentStep:n,setIsOpen:o,steps:s,setSteps:i,accessibilityOptions:S,disabledActions:C,transition:V,isHighlightingObserved:pe,rtl:A,meta:q,setMeta:G},D)))):null},gn=mn;function bn(e){return typeof e=="object"&&e!==null?{maskPadding:e.mask,popoverPadding:e.popover,wrapperPadding:e.wrapper}:{maskPadding:e,popoverPadding:e,wrapperPadding:0}}var yn={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0},wn={isOpen:!1,setIsOpen:()=>!1,currentStep:0,setCurrentStep:()=>0,steps:[],setSteps:()=>[],setMeta:()=>"",disabledActions:!1,setDisabledActions:()=>!1,components:{}},_n=b.createContext(wn),En=e=>{var t=e,{children:n,defaultOpen:r=!1,startAt:o=0,steps:s,setCurrentStep:i,currentStep:a}=t,c=Z(t,["children","defaultOpen","startAt","steps","setCurrentStep","currentStep"]);const[u,l]=d.useState(r),[f,v]=d.useState(o),[g,_]=d.useState(s),[O,y]=d.useState(""),[p,E]=d.useState(!1),x=P({isOpen:u,setIsOpen:l,currentStep:a||f,setCurrentStep:i&&typeof i=="function"?i:v,steps:g,setSteps:_,disabledActions:p,setDisabledActions:E,meta:O,setMeta:y},c);return b.createElement(_n.Provider,{value:x},n,u?b.createElement(gn,P({},x)):null)};const On={default:"#1A1A1A",white:"#FFFFFF",orange:"#CE2021",current:"currentColor"};function Se({variant:e="default",size:t=40,className:n,style:r}){const o=On[e],s=t*(799/2325);return L.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:s,viewBox:"0 0 2325 799",fill:"none",className:n,style:r,"aria-hidden":"true",children:[L.jsx("rect",{x:"50",y:"50",width:"2225",height:"699",stroke:o,strokeWidth:"100"}),L.jsx("path",{d:"M492.333 199.627L599.833 295.627L600 295.776V491.707L492.207 599.5H199.5V199.5H492.19L492.333 199.627ZM334 347.5V448.5H435V347.5H334Z",fill:o}),L.jsx("path",{d:"M1108.5 497.715L1108.34 497.862L1001.34 599.362L1001.2 599.5H699V296.283L699.158 296.135L802.158 199.635L802.303 199.5H1108.5V497.715ZM855 347.5V448.5H956V347.5H855Z",fill:o}),L.jsx("path",{d:"M1616.94 200.24L1510.07 395.005L1616.94 598.768L1617.64 600.103L1616.28 599.451L1409 500.056L1208.22 599.448L1207.5 599.806V199.5H1617.34L1616.94 200.24ZM1332 337.5V439.207L1433.71 337.5H1332Z",fill:o}),L.jsx("path",{d:"M1716.5 599V200L1841 291.5L2125 200L2017.5 400L2125 599L1841 501L1716.5 599Z",fill:o,stroke:o})]})}function xn({caption:e,chipLabel:t,isLast:n,onAdvance:r,onEnd:o}){const s=t??(n?"Got it":"Next");return L.jsxs("div",{className:Ye("flex max-w-[min(20rem,calc(100vw-2rem))] flex-col gap-3 rounded-lg border","bg-popover text-popover-foreground shadow-floating p-4"),children:[L.jsxs("div",{className:"flex items-start gap-3",children:[L.jsxs("span",{className:"mt-0.5 shrink-0",children:[L.jsx(Se,{size:28,className:"dark:hidden"}),L.jsx(Se,{variant:"white",size:28,className:"hidden dark:block"})]}),L.jsx("p",{className:"text-sm leading-relaxed",children:e})]}),L.jsxs("div",{className:"flex items-center justify-end gap-2",children:[L.jsx(ve,{variant:"ghost",size:"sm",onClick:o,children:"Done"}),L.jsx(ve,{variant:"default",size:"sm",onClick:r,children:s})]})]})}const Rn=4e3,Sn=100;function kn(e){const[t,n]=d.useState({element:null,status:"resolving",anchor:e}),[r,o]=d.useState(e);return e!==r&&(o(e),n({element:null,status:"resolving",anchor:e})),d.useEffect(()=>{if(e===null)return;const s=Ce(e);let i=null,a=!1;const c=Date.now()+Rn,u=()=>{const f=document.querySelector(s);return f?(f!==i&&(f.scrollIntoView({block:"center",inline:"center"}),i=f,a=!0,n({element:f,status:"found",anchor:e})),!1):a?!1:Date.now()>=c?(n({element:null,status:"timeout",anchor:e}),!0):!1},l=setInterval(()=>{u()&&clearInterval(l)},Sn);return()=>clearInterval(l)},[e]),t}const Cn=".reactour__popover",Ln=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function ke(e){return Array.from(e.querySelectorAll(Ln))}function Mn(e,t){d.useEffect(()=>{var o;if(!e)return;const n=document.querySelector(Cn);if(!n)return;(o=ke(n)[0])==null||o.focus();const r=s=>{if(s.key!=="Tab")return;const i=ke(n);if(i.length===0)return;const a=i[0],c=i[i.length-1],u=document.activeElement;n.contains(u)?s.shiftKey&&u===a?(s.preventDefault(),c.focus()):!s.shiftKey&&u===c&&(s.preventDefault(),a.focus()):(s.preventDefault(),a.focus())};return document.addEventListener("keydown",r,!0),()=>document.removeEventListener("keydown",r,!0)},[e,t])}const ze="(prefers-reduced-motion: reduce)";function Tn(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(ze).matches}function An(){const[e,t]=d.useState(Tn);return d.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia(ze),r=o=>t(o.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const In="dork-tour-mask--reduced-motion",Pn={mask:8,popover:10},Dn="x 280ms ease, y 280ms ease, width 280ms ease, height 280ms ease";function Nn({steps:e,activeIndex:t,onAdvance:n,onEnd:r}){const o=e[t],s=t>=e.length-1,i=Ze(),a=An(),c=kn((o==null?void 0:o.anchor)??null),[u,l]=d.useState(null);c.status==="found"&&c.element!==null&&c.anchor===(o==null?void 0:o.anchor)&&u!==t?l(t):!o&&u!==null&&l(null);const f=u!==null,v=u!==null?e[u]:void 0,g=d.useCallback(()=>{s?r():n()},[s,r,n]),_=d.useRef(g);d.useEffect(()=>{_.current=g},[g]),d.useEffect(()=>{c.status==="timeout"&&_.current()},[c.status]);const O=d.useRef(n),y=d.useRef(r);d.useEffect(()=>{O.current=n,y.current=r},[n,r]);const p=d.useRef(!1);d.useEffect(()=>{p.current=u===t},[u,t]);const[E,x]=d.useState(!1);d.useEffect(()=>{if(f&&!E){const w=requestAnimationFrame(()=>x(!0));return()=>cancelAnimationFrame(w)}},[f,E]),d.useEffect(()=>{if(!f)return;const w=document.getElementById("root");if(w)return w.inert=!0,()=>{w.inert=!1}},[f]),Mn(f,u??-1);const k=d.useMemo(()=>w=>{const R={...w,backgroundColor:"transparent",padding:0,boxShadow:"none",maxWidth:"none",color:"inherit"};return i?{...R,position:"fixed",top:"auto",left:0,right:0,bottom:0,transform:"none",display:"flex",justifyContent:"center",padding:"0 1rem 1rem"}:R},[i]),h=d.useCallback(w=>E?{...w,transition:Dn}:w,[E]),T=d.useMemo(()=>({popover:k,maskArea:h}),[k,h]),M=d.useMemo(()=>e.map((w,R)=>{const A=R===e.length-1;return{selector:Ce(w.anchor),stepInteraction:!1,content:L.jsx(xn,{caption:w.caption,chipLabel:w.chipLabel,isLast:A,onAdvance:()=>A?y.current():O.current(),onEnd:()=>y.current()})}}),[e]),C=d.useMemo(()=>e.map(w=>w.anchor).join("|"),[e]);return o?Xe.createPortal(L.jsxs(L.Fragment,{children:[L.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:f?(v==null?void 0:v.caption)??"":""}),f&&L.jsx(En,{steps:M,currentStep:u??0,defaultOpen:!0,showNavigation:!1,showPrevNextButtons:!1,showCloseButton:!1,showBadge:!1,showDots:!1,disableInteraction:!0,padding:Pn,styles:T,maskClassName:a?In:void 0,onClickMask:()=>r(),keyboardHandler:w=>{w.key==="Escape"?(w.preventDefault(),y.current()):w.key==="ArrowRight"&&p.current&&_.current()},children:L.jsx("span",{className:"hidden","aria-hidden":!0})},C)]}),document.body):null}const de={general:{id:"general",deepLink:{kind:"route",...Q.home()},steps:[{anchor:Y.homeComposer,caption:z.general.composer,chipLabel:"Next"},{anchor:Y.homeTabs,caption:z.general.homeTabs,chipLabel:"Got it"}]},tasks:{id:"tasks",occasion:"tasks",offerLine:z.offers.tasks,deepLink:{kind:"route",...Q.tasks()},steps:[{anchor:Y.tasksList,caption:z.tasks.tasksList,chipLabel:"Got it"}]},relay:{id:"relay",occasion:"relay",offerLine:z.offers.relay,deepLink:{kind:"route",...Q.connections()},steps:[{anchor:Y.relayIntegrations,caption:z.relay.relayIntegrations,chipLabel:"Got it"}]},mesh:{id:"mesh",occasion:"mesh",offerLine:z.offers.mesh,deepLink:{kind:"route",...Q.team()},steps:[{anchor:Y.teamRoster,caption:z.mesh.teamRoster,chipLabel:"Got it"}]}},F=Qe()(e=>({runningTourId:null,activeIndex:0,pendingOfferId:null,startTour:t=>e({runningTourId:t,activeIndex:0,pendingOfferId:null}),advanceStep:()=>e(t=>({activeIndex:t.activeIndex+1})),endTour:()=>e({runningTourId:null,activeIndex:0}),setPendingOffer:t=>e({pendingOfferId:t}),clearPendingOffer:()=>e({pendingOfferId:null})}));function Fe(){var x,k;const e=Je(),t=et(),{data:n}=tt({queryKey:me.current(),queryFn:()=>e.getConfig(),staleTime:rt}),r=((x=n==null?void 0:n.tours)==null?void 0:x.seen)??[],o=((k=n==null?void 0:n.tours)==null?void 0:k.declined)??[],s=F(h=>h.runningTourId),i=F(h=>h.activeIndex),a=F(h=>h.pendingOfferId),c=F(h=>h.startTour),u=F(h=>h.advanceStep),l=F(h=>h.endTour),f=F(h=>h.setPendingOffer),v=F(h=>h.clearPendingOffer),g=nt({mutationFn:h=>e.updateConfig({tours:h}),onSuccess:()=>t.invalidateQueries({queryKey:me.all}),meta:{errorLabel:"Couldn’t save your tour progress"}});function _(h){r.includes(h)||g.mutate({seen:[...r,h]})}function O(h){o.includes(h)||g.mutate({declined:[...o,h]})}function y(h){return r.includes(h)||o.includes(h)}function p(h){_(h),c(h)}function E(h){O(h),v()}return{seen:r,declined:o,isSuppressed:y,runningDefinition:s?de[s]:null,activeIndex:i,pendingOffer:a?de[a]:null,pendingOfferId:a,runTour:c,acceptOffer:p,declineOffer:E,setPendingOffer:f,advanceStep:u,endTour:l}}const Hn=1,jn=1,$n=2;function zn(){const{isSuppressed:e,setPendingOffer:t,pendingOfferId:n,runningDefinition:r}=Fe(),o=ot(y=>Object.values(y.statuses).some(p=>p.lifecycle==="streaming")),s=it(),i=st(),{data:a}=at(i),{data:c}=ft(s),{data:u}=lt(),l=a==null?void 0:a.length,f=s&&c?c.reduce((y,p)=>y+p.instances.length,0):void 0,v=u==null?void 0:u.agents.length,g=d.useRef(void 0),_=d.useRef(void 0),O=d.useRef(void 0);d.useEffect(()=>{const y=(E,x,k,h,T)=>{if(x===void 0)return T;const M=h.current;return M===void 0||!(M<k&&x>=k)?(h.current=x,T):o||T||(h.current=x,e(E))?T:(t(E),!0)};let p=n!==null||r!==null;p=y("tasks",l,Hn,g,p),p=y("relay",f,jn,_,p),y("mesh",v,$n,O,p)},[l,f,v,o,n,r,e,t])}function Bn(){zn();const{runningDefinition:e,activeIndex:t,advanceStep:n,endTour:r,runTour:o}=Fe(),s=ct(),i=ut({select:l=>l.location.pathname}),a=ge(l=>l.requestedTour),c=ge(l=>l.clearRequestedTour),u=(e==null?void 0:e.id)??null;return d.useEffect(()=>{if(a!==null){if(!(a in de)){c();return}if(u===a){c();return}o(a)}},[a,u,o,c]),d.useEffect(()=>{if(!e)return;const{to:l}=e.deepLink;i!==l&&s({to:l})},[e,i,s]),e?L.jsx(Nn,{steps:e.steps,activeIndex:t,onAdvance:n,onEnd:r}):null}export{Se as D,de as T,Bn as a,zn as b,Fe as u};
|