dorkos 0.114.1 → 0.115.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +38561 -38244
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-BRHiWrvg.js → AboutPage-Cz8ijNrK.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-DGwKpdjB.js → ActivityErrorState-BzmfwxSZ.js} +1 -1
- package/dist/client/assets/ActivityPage-BK7T3OiI.js +1 -0
- package/dist/client/assets/{ActivityRow-TjAMUrcU.js → ActivityRow-Ig5atv15.js} +1 -1
- package/dist/client/assets/{AdapterIcon-B-NJfk_R.js → AdapterIcon-BXPv5J8h.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-CrdiWINL.js → AdapterSetupWizard-BEziztL3.js} +2 -2
- package/dist/client/assets/AgentOptionRow-BqFQvFeN.js +1 -0
- package/dist/client/assets/AgentPicker-dCfEIsU-.js +1 -0
- package/dist/client/assets/{AgentRequestCard-BRINjair.js → AgentRequestCard-BAhfGJxx.js} +3 -3
- package/dist/client/assets/AppearancePage-7qHhFeEv.js +1 -0
- package/dist/client/assets/ApplyToOverridesDialog-jqOFh0d1.js +1 -0
- package/dist/client/assets/AttentionSignalRow-3CgglXkd.js +1 -0
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-C-BpNthi.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BMKtHI0D.js} +3 -3
- package/dist/client/assets/BindingDialog-DSBxRyzA.js +1 -0
- package/dist/client/assets/{BlintzCanvas-DCU4iOtF.js → BlintzCanvas-CyRuqAJV.js} +1 -1
- package/dist/client/assets/{CanvasCsvContent-oayJjsGq.js → CanvasCsvContent-Bd1c6TGx.js} +4 -4
- package/dist/client/assets/CanvasFileContent-DelYwSH8.js +2 -0
- package/dist/client/assets/CanvasModel3dContent-BExIu4RY.js +2 -0
- package/dist/client/assets/ChatAppsOff-SWemSaUp.js +6 -0
- package/dist/client/assets/{CodeMirrorDiff-j0jAFw_i.js → CodeMirrorDiff-0WF4ITRZ.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-DWgnGEHZ.js → CodeMirrorEditor-Bg7wC_Q8.js} +1 -1
- package/dist/client/assets/CommitmentList-CTvEGUV3.js +1 -0
- package/dist/client/assets/{CommitmentsPage-_vCusfuJ.js → CommitmentsPage-C68etoLe.js} +1 -1
- package/dist/client/assets/ConnectionAccessLists-9oeVn_GK.js +1 -0
- package/dist/client/assets/ConnectionsPage-CJOY4-kp.js +6 -0
- package/dist/client/assets/ConventionPage-DD-f5o6y.js +11 -0
- package/dist/client/assets/{ExtensionPageRoute-XXcMwrQY.js → ExtensionPageRoute-C6fW17AG.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-C8yf1gK7.js → FloatingTanStackRouterDevtools-CqogiFob-Zccd0fv6.js} +1 -1
- package/dist/client/assets/HandlePage-DOxlquWl.js +1 -0
- package/dist/client/assets/HeartbeatPage-cJM6NuTD.js +1 -0
- package/dist/client/assets/KeyEntry-K5k_3TfU.js +6 -0
- package/dist/client/assets/{LexicalField-Dr5vnDVn.js → LexicalField-DB5V20zv.js} +2 -2
- package/dist/client/assets/{ManagesPage-Dj_UOeFQ.js → ManagesPage-Cj0-hwfr.js} +1 -1
- package/dist/client/assets/{Marketplace-RwZrKU4O.js → Marketplace-eWEtLmd9.js} +2 -2
- package/dist/client/assets/{MarketplaceSourcesView-xSimTjA0.js → MarketplaceSourcesView-B1h70C20.js} +1 -1
- package/dist/client/assets/{McpAppFrame-Er6EX82b.js → McpAppFrame-BaJ_r-QR.js} +2 -2
- package/dist/client/assets/McpSigninBody-Coaq5Fkf.js +1 -0
- package/dist/client/assets/{Model3dViewer-D5xu-FCi.js → Model3dViewer-cKa-Jnbl.js} +1 -1
- package/dist/client/assets/NamePage-W7Frb1yy.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-DiI_GTiE.js → NewDirectMessageMenu-C4zNIv9x.js} +1 -1
- package/dist/client/assets/{NotificationsPage-B_XMIlHt.js → NotificationsPage-gKNClvNU.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-BjiejioP.js → OpenMeshSwitch-RzB2u6-Q.js} +2 -2
- package/dist/client/assets/OperatorIdentityForm-B_78Vqh8.js +1 -0
- package/dist/client/assets/PermissionHistory-DrtlA4YM.js +1 -0
- package/dist/client/assets/PermissionsPage-O7kUVaQv.js +1 -0
- package/dist/client/assets/{PersonalityPopover-BT-aQ65s.js → PersonalityPopover-DiNuuoWu.js} +1 -1
- package/dist/client/assets/PhotoPage-DdBke3yj.js +1 -0
- package/dist/client/assets/PresetPicker-BUFwg8RS.js +19 -0
- package/dist/client/assets/{PreviewRefusedNotice-DJyQxUFv.js → PreviewRefusedNotice-DXZp669C.js} +1 -1
- package/dist/client/assets/ProfileFields-BCfMzNcT.js +1 -0
- package/dist/client/assets/ProfilePanelContainer-BzC2MGdi.js +1 -0
- package/dist/client/assets/ProfileRolePicker-f0FKXLtu.js +1 -0
- package/dist/client/assets/PromptSuggestionChips-EgeMFibt.js +1 -0
- package/dist/client/assets/ReportsToPopover-CQ4Xxslu.js +1 -0
- package/dist/client/assets/RoomSurface-oDbc6jnO.js +44 -0
- package/dist/client/assets/{RoomsPage-D0795GTq.js → RoomsPage-D_EbiSZ3.js} +1 -1
- package/dist/client/assets/RunsOnPopover-LtmmbIsD.js +1 -0
- package/dist/client/assets/RuntimeConnectFlow-Kv2ytk2m.js +1 -0
- package/dist/client/assets/RuntimeSetupDialog-CiWxlcPc.js +1 -0
- package/dist/client/assets/{SessionsPage-DbIKrtbg.js → SessionsPage-1rDO0SGV.js} +1 -1
- package/dist/client/assets/SettingsDialog-_ctp2AfE.js +12 -0
- package/dist/client/assets/SkillsPage-gPuQHKps.js +1 -0
- package/dist/client/assets/TaskDialogWrapper-BPFpCgsN.js +1 -0
- package/dist/client/assets/TasksEmptyState-D0Jlzmed.js +3 -0
- package/dist/client/assets/TasksPage-DvGfg5Bk.js +1 -0
- package/dist/client/assets/{ToolsPage-gUYaNA1-.js → ToolsPage-B0qZ85pR.js} +2 -2
- package/dist/client/assets/{TopologyGraph-KPxRfshp.js → TopologyGraph-q1ammgpG.js} +3 -3
- package/dist/client/assets/TourHost-Dc8qw1Ef.js +1 -0
- package/dist/client/assets/{UnlinkDialog-RuuQUyOF.js → UnlinkDialog-DXdrLsGV.js} +1 -1
- package/dist/client/assets/{WidgetErrorCard-BojvLOeP.js → WidgetErrorCard-ChDNC060.js} +23 -23
- package/dist/client/assets/_shell-BxPza3Lx.js +88 -0
- package/dist/client/assets/{_shell._home-C-OJaDmg.js → _shell._home-DjGunhLV.js} +1 -1
- package/dist/client/assets/_shell._home.activity-B014dET1.js +1 -0
- package/dist/client/assets/_shell._home.index-DEmtTHZg.js +3 -0
- package/dist/client/assets/_shell._home.tasks-CnDEbUOd.js +1 -0
- package/dist/client/assets/_shell._home.workspaces-AQtMUWuu.js +1 -0
- package/dist/client/assets/{_shell.channels-Cpde6Iix.js → _shell.channels-C8NOhmJd.js} +4 -4
- package/dist/client/assets/_shell.connections-Bxe0wxOB.js +1 -0
- package/dist/client/assets/{_shell.feedback-requests-BBEuotuF.js → _shell.feedback-requests-C6ku9F5_.js} +2 -2
- package/dist/client/assets/_shell.marketplace-CEnzWFmI.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-BZq1d2ih.js +1 -0
- package/dist/client/assets/_shell.session-Dn0C0mEZ.js +66 -0
- package/dist/client/assets/{_shell.team-4bF5Nn4_.js → _shell.team-DoLdOMoC.js} +5 -5
- package/dist/client/assets/_shell.x._extensionId-DhE3OYMF.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-DhE3OYMF.js +1 -0
- package/dist/client/assets/access-copy-CBGtcTk0.js +1 -0
- package/dist/client/assets/{agent-browser-BIsnzdje.js → agent-browser-DbcLtsAx.js} +1 -1
- package/dist/client/assets/{banner-Dll8KWyW.js → banner-rPsz3suJ.js} +2 -2
- package/dist/client/assets/{card-5POMzMJ6.js → card-BqN3lfJn.js} +1 -1
- package/dist/client/assets/command-ZTLTCj0l.js +1 -0
- package/dist/client/assets/cpu-D70xMHl2.js +11 -0
- package/dist/client/assets/dead-letter-reasons-DtBHju9v.js +1 -0
- package/dist/client/assets/empty-state-yl1dLwLN.js +1 -0
- package/dist/client/assets/execution-config-BbBEe6FO.js +1 -0
- package/dist/client/assets/{file-CY9v6yos.js → file-CGg2M6ED.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-DNS4eVZR.js → file-exclamation-point-DZrVsShR.js} +1 -1
- package/dist/client/assets/{file-text-BQ5NBk6w.js → file-text-BYq_4IAt.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-BC8zM39x.js → find-latest-widget-fence-CWs9nr10.js} +4 -4
- package/dist/client/assets/form-vPuXuaYT.js +1 -0
- package/dist/client/assets/format-cron-D02Tnupo.js +1 -0
- package/dist/client/assets/{git-branch-34CUrn_R.js → git-branch-DbjXDO_F.js} +1 -1
- package/dist/client/assets/{heart-B5oPCBeT.js → heart-Dblp_miM.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-DeDxlHr7.js → highlighted-body-KPVGNVTW-CaMXMak-.js} +1 -1
- package/dist/client/assets/{index-Cdi4wcy2.js → index-B-WvQ24u.js} +7 -7
- package/dist/client/assets/{index-Bvr-_HFb.js → index-BKuzoeSn.js} +1 -1
- package/dist/client/assets/{index-CfPs0N2z.js → index-BOL391En.js} +1 -1
- package/dist/client/assets/{index-C6XffNP5.js → index-BPqkuMIa.js} +1 -1
- package/dist/client/assets/{index-Svn7q7Oq.js → index-BPwUl0Bz.js} +1 -1
- package/dist/client/assets/{index-CkfVcaGE.js → index-BV0tZnYg.js} +1 -1
- package/dist/client/assets/{index-obtMBZBo.js → index-BW98owO8.js} +1 -1
- package/dist/client/assets/{index-Cw1lCYXU.js → index-Bd23EYYT.js} +2 -2
- package/dist/client/assets/{index-hw9zI0x5.js → index-BdVOtoFr.js} +1 -1
- package/dist/client/assets/{index-C_nYZwKl.js → index-Bi7Um5RU.js} +1 -1
- package/dist/client/assets/{index-DvSjlchr.js → index-BiIbMZ6d.js} +36 -36
- package/dist/client/assets/{index-DipT3Tl7.js → index-BxqUb-n7.js} +1 -1
- package/dist/client/assets/{index-BfY2tknC.js → index-BzczIyv5.js} +1 -1
- package/dist/client/assets/index-C6NUjpzQ.js +38 -0
- package/dist/client/assets/{index-BCJdsNmC.js → index-C88NZagl.js} +1 -1
- package/dist/client/assets/{index-BM9_nnxH.js → index-CHvi6xUU.js} +1 -1
- package/dist/client/assets/{index-BWj2VXUd.js → index-CMWMhbec.js} +1 -1
- package/dist/client/assets/{index-HmNnK1_1.js → index-CN9fywRC.js} +1 -1
- package/dist/client/assets/{index-yDaSJS2Z.js → index-CRZXSh_q.js} +1 -1
- package/dist/client/assets/{index-sLuAyJv-.js → index-CWNsRK97.js} +1 -1
- package/dist/client/assets/index-CaLw69VE.js +1 -0
- package/dist/client/assets/index-CdKpQ1hI.js +1018 -0
- package/dist/client/assets/{index-CiOdQLWf.js → index-CrK4rKAq.js} +1 -1
- package/dist/client/assets/{index-B_LR9e6q.js → index-D16KF-iC.js} +3 -3
- package/dist/client/assets/index-D6m2SWHr.js +1 -0
- package/dist/client/assets/index-DDYi817r.js +1 -0
- package/dist/client/assets/{index-DjQZM7xU.js → index-Db2EOzA3.js} +1 -1
- package/dist/client/assets/index-DdbHrvr0.js +1 -0
- package/dist/client/assets/{index-D1AN47IZ.js → index-Dg_bax15.js} +3 -3
- package/dist/client/assets/index-DwUdUliR.js +1 -0
- package/dist/client/assets/{index-Dl3NBIFK.js → index-DzeYt-GT.js} +1 -1
- package/dist/client/assets/{index-D6QoZ_JK.js → index-Gq3gqBhY.js} +1 -1
- package/dist/client/assets/index-O_HMols_.js +1 -0
- package/dist/client/assets/{index-juObjGCH.js → index-P5j6zmcN.js} +1 -1
- package/dist/client/assets/{index-BeH3ljiU.js → index-XE46wAj9.js} +1 -1
- package/dist/client/assets/{index-BZYcFunZ.js → index-Z8YcKwIB.js} +1 -1
- package/dist/client/assets/{index-DFEF2MFy.css → index-kktlr1TJ.css} +1 -1
- package/dist/client/assets/{index-BfoRyh9U.js → index-lNMJBFB0.js} +1 -1
- package/dist/client/assets/{index-CFakjglG.js → index-oWLYcpm4.js} +1 -1
- package/dist/client/assets/{index-CbUkmP4v.js → index-vRc1D4KI.js} +1 -1
- package/dist/client/assets/inline-code-Cvn43Gqu.js +1 -0
- package/dist/client/assets/{layers-5nJbTYJI.js → layers-Bmz62WF4.js} +1 -1
- package/dist/client/assets/{lightbulb-CTbrj6Bh.js → lightbulb-CAd6slmc.js} +1 -1
- package/dist/client/assets/link-2-C0mn8T24.js +6 -0
- package/dist/client/assets/list-runtime-types-DxwGcKLx.js +1 -0
- package/dist/client/assets/{markdown-content-BWVUF3Ll.js → markdown-content-1-B7PdbY.js} +1 -1
- package/dist/client/assets/{mention-pill-DlZf_ikY.js → mention-pill-D_-KXznh.js} +1 -1
- package/dist/client/assets/{message-square-off-DwAOErT_.js → message-square-off-Di7kQvfe.js} +1 -1
- package/dist/client/assets/more-details-C6UGVeDE.js +1 -0
- package/dist/client/assets/{owner-notice-De98Vj3z.js → owner-notice-CudDDBX4.js} +1 -1
- package/dist/client/assets/{package-B1hSUoIL.js → package-D2eMoFCI.js} +1 -1
- package/dist/client/assets/{page-container-DTyW7UJt.js → page-container-CDHAACRA.js} +1 -1
- package/dist/client/assets/{paperclip-CoxP50ae.js → paperclip-p0W24D54.js} +1 -1
- package/dist/client/assets/path-input-j04LMj9z.js +1 -0
- package/dist/client/assets/primer-trigger-DkCcHf2Q.js +3 -0
- package/dist/client/assets/profile-errors-CqflLCzu.js +1 -0
- package/dist/client/assets/progress-BcuH4Eod.js +6 -0
- package/dist/client/assets/query-error-state-CEZs7dhg.js +1 -0
- package/dist/client/assets/{radio-WZhvBdvS.js → radio-DGWfQ5Rf.js} +1 -1
- package/dist/client/assets/registry-ChxwU0f4.js +1 -0
- package/dist/client/assets/relay-trace-schemas-y0nd8fzi.js +6 -0
- package/dist/client/assets/{room-files-source-B2H-CIeN.js → room-files-source-C1TCg4W_.js} +2 -2
- package/dist/client/assets/{rotate-ccw-clock-DFGhE-_C.js → rotate-ccw-clock-DcBojy-0.js} +1 -1
- package/dist/client/assets/{rotate-cw-DiWMKflx.js → rotate-cw-D0vUyeR2.js} +1 -1
- package/dist/client/assets/runtime-connect-Dn0T5YWv.js +1 -0
- package/dist/client/assets/{scroll-area-BJrXoUrS.js → scroll-area-CQ9lO56h.js} +1 -1
- package/dist/client/assets/{search-x-CPf5yiSS.js → search-x-EJGj73JB.js} +2 -2
- package/dist/client/assets/settings-for-runtime-BoOa-ZFG.js +1 -0
- package/dist/client/assets/shield-check-Bp58y9u7.js +6 -0
- package/dist/client/assets/{shield-x-D-yr2n7H.js → shield-x-jF_NCCvp.js} +1 -1
- package/dist/client/assets/soul-file-Cag2i87x.js +1 -0
- package/dist/client/assets/{table-B3kRSRyK.js → table-D89CWVJX.js} +1 -1
- package/dist/client/assets/terminal-BUhNMZAt.js +6 -0
- package/dist/client/assets/trust-posture-15DMDZTA.js +1 -0
- package/dist/client/assets/unplug-opnrSXAi.js +6 -0
- package/dist/client/assets/unverified-catalog-notice-DHM5Coia.js +1 -0
- package/dist/client/assets/use-adapter-catalog-ClMqVelU.js +1 -0
- package/dist/client/assets/use-bindings-Ch6UUBvz.js +1 -0
- package/dist/client/assets/use-composer-prefs-Qn7KRpYe.js +1 -0
- package/dist/client/assets/{use-connector-management-2rrubqr1.js → use-connector-management-dX_4x0d3.js} +1 -1
- package/dist/client/assets/use-deep-link-scroll-BV2fY4gy.js +1 -0
- package/dist/client/assets/use-delete-binding-BklxjB_c.js +1 -0
- package/dist/client/assets/{use-dev-links-BIxj0Pjl.js → use-dev-links-D4Bqam6F.js} +1 -1
- package/dist/client/assets/use-external-adapter-catalog-nHiD8BKZ.js +1 -0
- package/dist/client/assets/use-full-activity-feed-vYU7wQWT.js +1 -0
- package/dist/client/assets/use-is-below-desktop-G-mTu2Ga.js +1 -0
- package/dist/client/assets/{use-jump-back-in-CD5wYoFA.js → use-jump-back-in-BVunjzyr.js} +3 -3
- package/dist/client/assets/{use-mesh-topology-3LbL6yfa.js → use-mesh-topology-NaUKSKol.js} +1 -1
- package/dist/client/assets/use-mounted-ref-BWpQ8f91.js +1 -0
- package/dist/client/assets/use-notification-prefs-qO1zRRFN.js +1 -0
- package/dist/client/assets/{use-panel-tab-placements-CTNXdvC6.js → use-panel-tab-placements-Db6p2vLD.js} +1 -1
- package/dist/client/assets/use-pending-read-DUqJZUza.js +1 -0
- package/dist/client/assets/use-personality-commit-DUEKxHt_.js +1 -0
- package/dist/client/assets/{use-promo-activation-DCy9ROgP.js → use-promo-activation-CnGaw39P.js} +2 -2
- package/dist/client/assets/use-promo-dismissals-bkSHhGhj.js +1 -0
- package/dist/client/assets/{use-pulse-freshness-CRHnQO_-.js → use-pulse-freshness-Oc_1gs-Y.js} +1 -1
- package/dist/client/assets/use-relay-config-Ba-S4wxY.js +1 -0
- package/dist/client/assets/{use-room-follow-claim-FWatOD5-.js → use-room-follow-claim-DqE5b95Z.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-C56ygMxj.js → use-roving-tab-list-DnMqliqf.js} +1 -1
- package/dist/client/assets/{use-session-canvas-Dsmt92or.js → use-session-canvas-OdljtBE8.js} +4 -4
- package/dist/client/assets/{use-session-diagnostics-ypmmhIlN.js → use-session-diagnostics-CtjxsM8_.js} +4 -4
- package/dist/client/assets/use-unclaimed-chats-5RCD5wIp.js +1 -0
- package/dist/client/assets/use-update-config-xkznZMHr.js +1 -0
- package/dist/client/assets/useMutationState-Mjr_y4xX.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/index.js +7086 -6336
- package/dist/server/index.js.map +2 -2
- package/package.json +5 -5
- package/dist/client/assets/ActivityPage-C-lpXfva.js +0 -1
- package/dist/client/assets/AppearancePage-COdpfn1g.js +0 -1
- package/dist/client/assets/AttentionSignalRow-Dc8laCri.js +0 -1
- package/dist/client/assets/CanvasFileContent-C-aDKKws.js +0 -2
- package/dist/client/assets/CanvasModel3dContent-Dnx6oUx2.js +0 -2
- package/dist/client/assets/CommitmentList-CCsDbGY2.js +0 -1
- package/dist/client/assets/ConnectionAccessLists-umV6IbYS.js +0 -1
- package/dist/client/assets/ConnectionsPage-2iGwApEi.js +0 -6
- package/dist/client/assets/ConventionPage-Bucu3-TK.js +0 -11
- package/dist/client/assets/HandlePage-BotSAp8X.js +0 -1
- package/dist/client/assets/HeartbeatPage-CVAZeDqg.js +0 -1
- package/dist/client/assets/McpSigninBody-DMK94EGx.js +0 -1
- package/dist/client/assets/NamePage-NZ40HlPR.js +0 -1
- package/dist/client/assets/OperatorIdentityForm-H7l8r2VC.js +0 -1
- package/dist/client/assets/PermissionsPage-DVV9vtoW.js +0 -1
- package/dist/client/assets/PhotoPage-DKgOQCBH.js +0 -1
- package/dist/client/assets/PromptSuggestionChips-Dw7RA2P1.js +0 -1
- package/dist/client/assets/ReportsToPopover-fxu1r9iw.js +0 -1
- package/dist/client/assets/RoomSurface-D4Etqadg.js +0 -44
- package/dist/client/assets/RunsOnPopover-Cp8EMGHD.js +0 -1
- package/dist/client/assets/RuntimeSetupDialog-Cxtz9b_r.js +0 -1
- package/dist/client/assets/SkillsPage-DYSIGciZ.js +0 -1
- package/dist/client/assets/TasksPage-DoEP7ZsZ.js +0 -1
- package/dist/client/assets/TourHost-BIozl4IA.js +0 -1
- package/dist/client/assets/_shell-BMQyJ7r4.js +0 -88
- package/dist/client/assets/_shell._home.activity-Bvsxue6y.js +0 -1
- package/dist/client/assets/_shell._home.index-DXnd_q3h.js +0 -3
- package/dist/client/assets/_shell._home.tasks-Mz-iO--x.js +0 -1
- package/dist/client/assets/_shell._home.workspaces-ChuVp2dK.js +0 -1
- package/dist/client/assets/_shell.connections-CxgvSPjQ.js +0 -1
- package/dist/client/assets/_shell.marketplace-Hk6n4nNt.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-B8f38K6K.js +0 -1
- package/dist/client/assets/_shell.session-DsF1tXPP.js +0 -66
- package/dist/client/assets/_shell.x._extensionId-B6J6mDaT.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-B6J6mDaT.js +0 -1
- package/dist/client/assets/index-BTkflOTk.js +0 -1
- package/dist/client/assets/index-BqtFX8p5.js +0 -1
- package/dist/client/assets/index-C-DMBd4V.js +0 -1
- package/dist/client/assets/index-C4ZJEVQG.js +0 -1
- package/dist/client/assets/index-C9NjdeaX.js +0 -38
- package/dist/client/assets/index-d-DK54t2.js +0 -1099
- package/dist/client/assets/index-tdK5EJaB.js +0 -1
- package/dist/client/assets/index-wx8w6kby.js +0 -1
- package/dist/client/assets/kickoff-BwvlCy0n.js +0 -3
- package/dist/client/assets/soul-file-D0y7QIBL.js +0 -1
- package/dist/client/assets/use-delete-binding-BKhK3a7C.js +0 -1
- package/dist/client/assets/use-external-adapter-catalog-XS0vyTlS.js +0 -1
- package/dist/client/assets/use-full-activity-feed-CwqKSvpf.js +0 -1
- package/dist/client/assets/use-is-below-desktop-Dzs5i_TM.js +0 -1
- package/dist/client/assets/use-pending-read-sDmA-i7r.js +0 -1
- package/dist/client/assets/use-personality-commit-B13DSXxo.js +0 -1
- package/dist/client/assets/use-unclaimed-chats-C_bsrJFb.js +0 -1
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{mV as zn,mW as Wn,mX as Pn,mY as Bn,mZ as Fn,m_ as At,m$ as _t,n0 as Vn,n1 as Un,n2 as Gn,n3 as Kn,n4 as Hn,n5 as Yn,n6 as qn,n7 as Xn,n8 as Qn,n9 as Jn,na as Zn,nb as Ne,nc as es,nd as ts,ne as ns,nf as ss,a2 as D,r as g,z as y,G as h,K as _,ng as as,nh as z,kg as Be,J as L,fx as ae,fB as Ae,F as Fe,fA as Mt,_ as K,D as Se,ni as rs,nj as re,nk as is,nl as os,fC as cs,nm as ls,kq as ds,ko as us,nn as fs,iz as ps,a8 as ms,no as Te,np as hs,nq as Et,b0 as gs,iC as xs,j as n,fp as ys,fq as bs,dD as vs,nr as js,h1 as It,k9 as ks,kJ as Ns,W as b,Q as E,cf as Ss,es as De,aU as ws,ck as Cs,bU as As,et as _s,ns as Ms,jv as Tt,db as Es,dp as Is,fW as Ts,ft as $s,nt as Ds,bg as Ls,nu as Os,bE as Rs,hl as zs,d$ as Ws,bf as Ps,R as Ve,nv as Bs,hk as Fs,lX as Vs,a7 as $t,bV as Us,B as Dt,e1 as Ue,dW as Gs,dX as Ks,dY as Hs,dZ as Ys,d_ as qs,I as Xs,x as Qs,k5 as Lt,cU as Ot,cV as Rt,cW as zt,nw as Wt,ae as Pt,g8 as Js,X as Zs,nx as ea,C as ta}from"./index-CdKpQ1hI.js";import{C as Bt,a as na,b as sa,c as aa,d as ra,e as ia}from"./card-BqN3lfJn.js";import{P as oa,S as ca}from"./progress-BcuH4Eod.js";import{M as la}from"./markdown-content-1-B7PdbY.js";import{T as Ft,d as Vt,b as _e,e as Le,c as Oe,a as Ut}from"./table-D89CWVJX.js";import{T as da}from"./terminal-BUhNMZAt.js";import{P as ua}from"./package-D2eMoFCI.js";import{H as fa}from"./heart-Dblp_miM.js";import{G as pa}from"./git-branch-DbjXDO_F.js";import{F as ma}from"./file-text-BYq_4IAt.js";import{F as ha}from"./file-CGg2M6ED.js";const ga=(e,t,s)=>{const a=t-e;return((s-e)%a+a)%a+e};function Gt(e,t){return zn(e)?e[ga(0,e.length,t)]:e}class xa{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>t.finished))}getAll(t){return this.animations[0][t]}setAll(t,s){for(let a=0;a<this.animations.length;a++)this.animations[a][t]=s}attachTimeline(t){const s=this.animations.map(a=>a.attachTimeline(t));return()=>{s.forEach((a,r)=>{a&&a(),this.animations[r].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return ot(this.animations,"duration")}get iterationDuration(){return ot(this.animations,"iterationDuration")}runAll(t){this.animations.forEach(s=>s[t]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function ot(e,t){let s=0;for(let a=0;a<e.length;a++){const r=e[a][t];r!==null&&r>s&&(s=r)}return s}class ya extends xa{then(t,s){return this.finished.finally(t).then(()=>{})}}function ba(e,t){return e in t}class va extends Wn{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,s){if(ba(s,t)){const a=t[s];if(typeof a=="string"||typeof a=="number")return a}}getBaseTargetFromProps(){}removeValueFromRenderState(t,s){delete s.output[t]}measureInstanceViewportBox(){return Pn()}build(t,s){Object.assign(t.output,s)}renderInstance(t,{output:s}){Object.assign(t,s)}sortInstanceNodePosition(){return 0}}function Ge(e){return typeof e=="object"&&!Array.isArray(e)}function Kt(e,t,s,a){return e==null?[]:typeof e=="string"&&Ge(t)?Bn(e,s,a):e instanceof NodeList?Array.from(e):Array.isArray(e)?e.filter(r=>r!=null):[e]}function ja(e,t,s){return e*(t+1)+s*t}function ct(e,t,s,a){return typeof t=="number"?t:t.startsWith("-")||t.startsWith("+")?Math.max(0,e+parseFloat(t)):t==="<"?s:t.startsWith("<")?Math.max(0,s+parseFloat(t.slice(1))):a.get(t)??e}function ka(e,t,s){for(let a=0;a<e.length;a++){const r=e[a];r.at>t&&r.at<s&&(At(e,r),a--)}}function Na(e,t,s,a,r,o){ka(e,r,o);for(let i=0;i<t.length;i++)e.push({value:t[i],at:Fn(r,o,a[i]),easing:Gt(s,i)})}function Sa(e,t,s=0){const a=t+1+t*s;for(let r=0;r<e.length;r++)e[r]=e[r]/a}function wa(e,t){return e.at===t.at?e.value===null?1:t.value===null?-1:0:e.at-t.at}const Ca="easeInOut",Aa=20;function _a(e,{defaultTransition:t={},...s}={},a,r){const o=t.duration||.3,i=new Map,c=new Map,d={},u=new Map;let m=0,p=0,v=0;for(let k=0;k<e.length;k++){const S=e[k];if(typeof S=="string"){u.set(S,p);continue}else if(!Array.isArray(S)){u.set(S.name,ct(p,S.at,m,u));continue}let[j,A,M={}]=S;M.at!==void 0&&(p=ct(p,M.at,m,u));let N=0;const C=(l,f,x,T=0,R=0)=>{const w=Ma(l),{delay:O=0,times:I=Vn(w),type:B=t.type||"keyframes",repeat:Y,repeatType:V,repeatDelay:U=0,...G}=f;let{ease:$=t.ease||"easeOut",duration:F}=f;const ye=typeof O=="function"?O(T,R):O,Xe=w.length,Qe=Hn(B)?B:r==null?void 0:r[B||"keyframes"];if(Xe<=2&&Qe){let ne=100;if(Xe===2&&Ta(w)){const ue=w[1]-w[0];ne=Math.abs(ue)}const se={...t,...G};F!==void 0&&(se.duration=Yn(F));const be=Un(se,ne,Qe);$=be.ease,F=be.duration}F??(F=o);const Je=p+ye;I.length===1&&I[0]===0&&(I[1]=1);const Ze=I.length-w.length;if(Ze>0&&Gn(I,Ze),w.length===1&&w.unshift(null),Y&&Y<Aa){const ne=F>0?U/F:0;F=ja(F,Y,U);const se=[...w],be=[...I];$=Array.isArray($)?[...$]:[$];const ue=[...$],tt=V==="reverse"||V==="mirror";let nt=se,st=ue;tt&&(nt=[...se].reverse(),V==="reverse"&&(st=[...ue].reverse().map(X=>typeof X=="function"?Kn(X):X)));for(let X=0;X<Y;X++){const at=tt&&X%2===0,rt=at?nt:se,Rn=at?st:ue,it=(X+1)*(1+ne);ne>0&&(w.push(w[w.length-1]),I.push(it),$.push("linear")),w.push(...rt);for(let fe=0;fe<rt.length;fe++)I.push(be[fe]+it),$.push(fe===0?"linear":Gt(Rn,fe-1))}Sa(I,Y,ne)}const et=Je+F;Na(x,w,$,I,Je,et),N=Math.max(ye+F,N),v=Math.max(et,v)};if(_t(j)){const l=lt(j,c);C(A,M,dt("default",l))}else{const l=Kt(j,A,a,d),f=l.length;for(let x=0;x<f;x++){A=A,M=M;const T=l[x],R=lt(T,c);for(const w in A)C(A[w],Ea(M,w),dt(w,R),x,f)}}m=p,p+=N}return c.forEach((k,S)=>{for(const j in k){const A=k[j];A.sort(wa);const M=[],N=[],C=[];for(let T=0;T<A.length;T++){const{at:R,value:w,easing:O}=A[T];M.push(w),N.push(qn(0,v,R)),C.push(O||"easeOut")}N[0]!==0&&(N.unshift(0),M.unshift(M[0]),C.unshift(Ca)),N[N.length-1]!==1&&(N.push(1),M.push(null)),i.has(S)||i.set(S,{keyframes:{},transition:{}});const l=i.get(S);l.keyframes[j]=M;const{type:f,...x}=t;l.transition[j]={...x,duration:v,ease:C,times:N,...s}}}),i}function lt(e,t){return!t.has(e)&&t.set(e,{}),t.get(e)}function dt(e,t){return t[e]||(t[e]=[]),t[e]}function Ma(e){return Array.isArray(e)?e:[e]}function Ea(e,t){return e&&e[t]?{...e,...e[t]}:{...e}}const Ia=e=>typeof e=="number",Ta=e=>e.every(Ia);function $a(e){const t={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},s=Xn(e)&&!Qn(e)?new Jn(t):new Zn(t);s.mount(e),Ne.set(e,s)}function Da(e){const t={presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}},s=new va(t);s.mount(e),Ne.set(e,s)}function La(e,t){return _t(e)||typeof e=="number"||typeof e=="string"&&!Ge(t)}function Ht(e,t,s,a){const r=[];if(La(e,t))r.push(es(e,Ge(t)&&t.default||t,s&&(s.default||s)));else{if(e==null)return r;const o=Kt(e,t,a),i=o.length;for(let c=0;c<i;c++){const d=o[c],u=d instanceof Element?$a:Da;Ne.has(d)||u(d);const m=Ne.get(d),p={...s};"delay"in p&&typeof p.delay=="function"&&(p.delay=p.delay(c,i)),r.push(...ts(m,{...t,transition:p},{}))}}return r}function Oa(e,t,s){const a=[],r=e.map(i=>{if(Array.isArray(i)&&typeof i[0]=="function"){const c=i[0],d=ns(0);return d.on("change",c),i.length===1?[d,[0,1]]:i.length===2?[d,[0,1],i[1]]:[d,i[1],i[2]]}return i});return _a(r,t,s,{spring:ss}).forEach(({keyframes:i,transition:c},d)=>{a.push(...Ht(d,i,c))}),a}function Ra(e){return Array.isArray(e)&&e.some(Array.isArray)}function za(e={}){const{scope:t,reduceMotion:s,skipAnimations:a}=e;function r(o,i,c){let d=[],u;const m={};if(s!==void 0&&(m.reduceMotion=s),a!==void 0&&(m.skipAnimations=a),Ra(o)){const{onComplete:v,...k}=i||{};typeof v=="function"&&(u=v),d=Oa(o,{...m,...k},t)}else{const{onComplete:v,...k}=c||{};typeof v=="function"&&(u=v),d=Ht(o,i,{...m,...k},t)}const p=new ya(d);return u&&p.finished.then(u),t&&(t.animations.push(p),p.finished.then(()=>{At(t.animations,p)})),p}return r}const Wa=za();/**
|
|
2
2
|
* @license lucide-react v1.48.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const Yt={name:"bookmark",size:24,node:[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]]};Yt.node;const Pa=
|
|
6
|
+
*/const Yt={name:"bookmark",size:24,node:[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]]};Yt.node;const Pa=D(Yt);/**
|
|
7
7
|
* @license lucide-react v1.48.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const qt={name:"circle-check-big",size:24,node:[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],aliases:["check-circle"]};qt.node;const
|
|
11
|
+
*/const qt={name:"circle-check-big",size:24,node:[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],aliases:["check-circle"]};qt.node;const Ba=D(qt);/**
|
|
12
12
|
* @license lucide-react v1.48.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const
|
|
16
|
+
*/const Xt={name:"cloud",size:24,node:[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]};Xt.node;const Fa=D(Xt);/**
|
|
17
17
|
* @license lucide-react v1.48.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const
|
|
21
|
+
*/const Qt={name:"code",size:24,node:[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]};Qt.node;const Va=D(Qt);/**
|
|
22
22
|
* @license lucide-react v1.48.0 - ISC
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the ISC license.
|
|
25
25
|
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const Jt={name:"cog",size:24,node:[["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}]]};Jt.node;const Ua=
|
|
26
|
+
*/const Jt={name:"cog",size:24,node:[["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}]]};Jt.node;const Ua=D(Jt);/**
|
|
27
27
|
* @license lucide-react v1.48.0 - ISC
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the ISC license.
|
|
30
30
|
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const Zt={name:"coins",size:24,node:[["path",{d:"M13.744 17.736a6 6 0 1 1-7.48-7.48",key:"bq4yh3"}],["path",{d:"M15 6h1v4",key:"11y1tn"}],["path",{d:"m6.134 14.768.866-.5 2 3.464",key:"17snzx"}],["circle",{cx:"16",cy:"8",r:"6",key:"14bfc9"}]]};Zt.node;const Ga=
|
|
31
|
+
*/const Zt={name:"coins",size:24,node:[["path",{d:"M13.744 17.736a6 6 0 1 1-7.48-7.48",key:"bq4yh3"}],["path",{d:"M15 6h1v4",key:"11y1tn"}],["path",{d:"m6.134 14.768.866-.5 2 3.464",key:"17snzx"}],["circle",{cx:"16",cy:"8",r:"6",key:"14bfc9"}]]};Zt.node;const Ga=D(Zt);/**
|
|
32
32
|
* @license lucide-react v1.48.0 - ISC
|
|
33
33
|
*
|
|
34
34
|
* This source code is licensed under the ISC license.
|
|
35
35
|
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const en={name:"database",size:24,node:[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]};en.node;const Ka=
|
|
36
|
+
*/const en={name:"database",size:24,node:[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]};en.node;const Ka=D(en);/**
|
|
37
37
|
* @license lucide-react v1.48.0 - ISC
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the ISC license.
|
|
40
40
|
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const tn={name:"dice-1",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]};tn.node;const Ha=
|
|
41
|
+
*/const tn={name:"dice-1",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]};tn.node;const Ha=D(tn);/**
|
|
42
42
|
* @license lucide-react v1.48.0 - ISC
|
|
43
43
|
*
|
|
44
44
|
* This source code is licensed under the ISC license.
|
|
45
45
|
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const nn={name:"dice-2",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M15 9h.01",key:"x1ddxp"}],["path",{d:"M9 15h.01",key:"fzyn71"}]]};nn.node;const Ya=
|
|
46
|
+
*/const nn={name:"dice-2",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M15 9h.01",key:"x1ddxp"}],["path",{d:"M9 15h.01",key:"fzyn71"}]]};nn.node;const Ya=D(nn);/**
|
|
47
47
|
* @license lucide-react v1.48.0 - ISC
|
|
48
48
|
*
|
|
49
49
|
* This source code is licensed under the ISC license.
|
|
50
50
|
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const sn={name:"dice-3",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]};sn.node;const qa=
|
|
51
|
+
*/const sn={name:"dice-3",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]};sn.node;const qa=D(sn);/**
|
|
52
52
|
* @license lucide-react v1.48.0 - ISC
|
|
53
53
|
*
|
|
54
54
|
* This source code is licensed under the ISC license.
|
|
55
55
|
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/const an={name:"dice-4",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 16h.01",key:"18s6g9"}],["path",{d:"M16 16h.01",key:"1f9h7w"}]]};an.node;const
|
|
56
|
+
*/const an={name:"dice-4",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 16h.01",key:"18s6g9"}],["path",{d:"M16 16h.01",key:"1f9h7w"}]]};an.node;const Xa=D(an);/**
|
|
57
57
|
* @license lucide-react v1.48.0 - ISC
|
|
58
58
|
*
|
|
59
59
|
* This source code is licensed under the ISC license.
|
|
60
60
|
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/const rn={name:"dice-5",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 16h.01",key:"18s6g9"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]};rn.node;const
|
|
61
|
+
*/const rn={name:"dice-5",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 16h.01",key:"18s6g9"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]};rn.node;const Qa=D(rn);/**
|
|
62
62
|
* @license lucide-react v1.48.0 - ISC
|
|
63
63
|
*
|
|
64
64
|
* This source code is licensed under the ISC license.
|
|
65
65
|
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/const on={name:"dice-6",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]};on.node;const Ja=
|
|
66
|
+
*/const on={name:"dice-6",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]};on.node;const Ja=D(on);/**
|
|
67
67
|
* @license lucide-react v1.48.0 - ISC
|
|
68
68
|
*
|
|
69
69
|
* This source code is licensed under the ISC license.
|
|
70
70
|
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
-
*/const cn={name:"dices",size:24,node:[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]]};cn.node;const Za=
|
|
71
|
+
*/const cn={name:"dices",size:24,node:[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]]};cn.node;const Za=D(cn);/**
|
|
72
72
|
* @license lucide-react v1.48.0 - ISC
|
|
73
73
|
*
|
|
74
74
|
* This source code is licensed under the ISC license.
|
|
75
75
|
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/const ln={name:"flag",size:24,node:[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]]};ln.node;const er=
|
|
76
|
+
*/const ln={name:"flag",size:24,node:[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]]};ln.node;const er=D(ln);/**
|
|
77
77
|
* @license lucide-react v1.48.0 - ISC
|
|
78
78
|
*
|
|
79
79
|
* This source code is licensed under the ISC license.
|
|
80
80
|
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
-
*/const dn={name:"house",size:24,node:[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],aliases:["home"]};dn.node;const tr=
|
|
81
|
+
*/const dn={name:"house",size:24,node:[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],aliases:["home"]};dn.node;const tr=D(dn);/**
|
|
82
82
|
* @license lucide-react v1.48.0 - ISC
|
|
83
83
|
*
|
|
84
84
|
* This source code is licensed under the ISC license.
|
|
85
85
|
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
-
*/const un={name:"map-pin",size:24,node:[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]};un.node;const nr=
|
|
86
|
+
*/const un={name:"map-pin",size:24,node:[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]};un.node;const nr=D(un);/**
|
|
87
87
|
* @license lucide-react v1.48.0 - ISC
|
|
88
88
|
*
|
|
89
89
|
* This source code is licensed under the ISC license.
|
|
90
90
|
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
-
*/const fn={name:"rocket",size:24,node:[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]]};fn.node;const sr=
|
|
91
|
+
*/const fn={name:"rocket",size:24,node:[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]]};fn.node;const sr=D(fn);/**
|
|
92
92
|
* @license lucide-react v1.48.0 - ISC
|
|
93
93
|
*
|
|
94
94
|
* This source code is licensed under the ISC license.
|
|
95
95
|
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
-
*/const pn={name:"tag",size:24,node:[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]};pn.node;const ar=
|
|
96
|
+
*/const pn={name:"tag",size:24,node:[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]};pn.node;const ar=D(pn);/**
|
|
97
97
|
* @license lucide-react v1.48.0 - ISC
|
|
98
98
|
*
|
|
99
99
|
* This source code is licensed under the ISC license.
|
|
100
100
|
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
-
*/const mn={name:"trending-down",size:24,node:[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]]};mn.node;const rr=
|
|
101
|
+
*/const mn={name:"trending-down",size:24,node:[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]]};mn.node;const rr=D(mn);/**
|
|
102
102
|
* @license lucide-react v1.48.0 - ISC
|
|
103
103
|
*
|
|
104
104
|
* This source code is licensed under the ISC license.
|
|
105
105
|
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
-
*/const hn={name:"trending-up",size:24,node:[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]};hn.node;const ir=
|
|
106
|
+
*/const hn={name:"trending-up",size:24,node:[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]};hn.node;const ir=D(hn),gn=g.createContext(void 0),or=gn.Provider;function cr(){return g.useContext(gn)}const lr=/[\u0000-\u001f\u007f-\u009f]+/g;function xn(e,t){const s=new RegExp(`<\\s*/\\s*${t}`,"gi");return e.replace(s,`<\\/${t}`)}function $e(e,t){return xn(e.replace(lr," ").trim(),t)}const ie="ui_action";function dr(e){const t=e.widgetTitle?$e(e.widgetTitle,ie):"",s=[`<${ie}>`,"The user interacted with a widget you rendered.",`Widget: ${t||"(untitled)"}`,`Action: ${$e(e.actionId,ie)}`];e.widgetId&&s.push(`Widget ID: ${$e(e.widgetId,ie)}`);const a=e.payload&&Object.keys(e.payload).length>0;return s.push(a?`Payload:
|
|
107
107
|
${xn(JSON.stringify(e.payload,null,2),ie)}`:"Payload: (none)"),s.push("Respond to this interaction now. If the widget represents ongoing state (a game, a checklist), re-emit exactly ONE updated widget reflecting it — trust this payload over your memory of prior turns."),s.push(`</${ie}>`),s.join(`
|
|
108
|
-
`)}const ur=K(["default","success","warning","error","info"]),yn=y({kind:M("agent"),id:h().min(1),label:h().optional(),payload:_t(h(),cs()).optional()}),bn=y({kind:M("emit"),type:ls,payload:ds.optional(),coalesceKey:h().min(1).max(128).optional()}).strict(),ut=Fe("kind",[yn,bn]),Re=Fe("kind",[yn,bn,y({kind:M("ui"),command:os}),y({kind:M("url"),href:h().url().refine(e=>e.startsWith("https://"),{message:"Widget URLs must be https"})})]),ft=Ae([h(),Be(),Se(),is()]),fr=["sm","md","lg"],pt={sm:4,md:12};function pr(e){const t=typeof e=="number"?e:typeof e=="string"&&e.trim()!==""&&!Number.isNaN(Number(e))?Number(e):null;if(t!==null)return t<=pt.sm?"sm":t<=pt.md?"md":"lg";if(typeof e=="string"){const s=e.trim().toLowerCase();if(s==="none"||s==="xs"||s==="small"||s==="sm")return"sm";if(s==="medium"||s==="normal"||s==="md")return"md";if(s==="large"||s==="xl"||s==="xxl"||s==="lg")return"lg"}return e}const mr=z(pr,K(fr));function J(e){return t=>{if(typeof t!="string")return t;const s=t.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(e,s)?e[s]:t}}const Ke=z(J({default:"default",neutral:"default",muted:"default",normal:"default",gray:"default",grey:"default",success:"success",ok:"success",okay:"success",good:"success",positive:"success",done:"success",complete:"success",completed:"success",green:"success",warning:"warning",warn:"warning",caution:"warning",pending:"warning",yellow:"warning",orange:"warning",error:"error",danger:"error",critical:"error",fail:"error",failed:"error",failure:"error",negative:"error",blocked:"error",red:"error",info:"info",information:"info",note:"info",blue:"info"}),ur),hr=z(J({vertical:"vertical",vert:"vertical",column:"vertical",col:"vertical",stack:"vertical",horizontal:"horizontal",horiz:"horizontal",row:"horizontal",inline:"horizontal"}),K(["vertical","horizontal"])),gr=z(J({default:"default",primary:"default",secondary:"secondary",destructive:"destructive",danger:"destructive",delete:"destructive",outline:"outline",ghost:"outline",link:"outline"}),K(["default","secondary","destructive","outline"])),xr=z(J({bar:"bar",bars:"bar",column:"bar",columns:"bar",histogram:"bar",line:"line",lines:"line",area:"area",pie:"pie",donut:"pie",doughnut:"pie"}),K(["bar","line","area","pie"])),yr=z(J({up:"up",increase:"up",increased:"up",positive:"up",rise:"up",rising:"up",gain:"up",down:"down",decrease:"down",decreased:"down",negative:"down",fall:"down",falling:"down",drop:"down",loss:"down",flat:"flat",none:"flat",neutral:"flat",same:"flat",unchanged:"flat",steady:"flat"}),K(["up","down","flat"])),br=z(e=>{const t=typeof e=="number"?e:typeof e=="string"&&e.trim()!==""&&!Number.isNaN(Number(e))?Number(e):null;return t===null?e:Math.min(3,Math.max(1,Math.round(t)))},Ae([M(1),M(2),M(3)])),vr=z(e=>typeof e=="string"?{value:e,direction:"flat"}:typeof e=="number"?{value:e,direction:e>0?"up":e<0?"down":"flat"}:e,y({value:Ae([h(),Be()]),direction:yr.default("flat")})),jr=z(e=>typeof e=="string"?{text:e}:e,y({text:h(),tone:Ke.optional()})),kr=z(J({done:"done",complete:"done",completed:"done",finished:"done",past:"done",active:"active",current:"active",now:"active","in-progress":"active",in_progress:"active",inprogress:"active",ongoing:"active",upcoming:"upcoming",pending:"upcoming",next:"upcoming",todo:"upcoming",future:"upcoming",planned:"upcoming"}),K(["done","active","upcoming"])),mt=z(e=>{if(typeof e=="number")return e===1?!0:e===0?!1:e;if(typeof e=="string"){const t=e.trim().toLowerCase();if(t==="true"||t==="yes"||t==="checked")return!0;if(t==="false"||t==="no"||t==="unchecked")return!1}return e},Se()),Nr=z(J({happy:"happy",proud:"happy",joy:"happy",joyful:"happy",glad:"happy",thinking:"thinking",confused:"thinking",pondering:"thinking",curious:"thinking",hmm:"thinking",celebrating:"celebrating",excited:"celebrating",party:"celebrating",hyped:"celebrating",sheepish:"sheepish",embarrassed:"sheepish",oops:"sheepish",awkward:"sheepish",shy:"sheepish",determined:"determined",focused:"determined",serious:"determined",resolute:"determined",surprised:"surprised",shocked:"surprised",wow:"surprised",amazed:"surprised","mind-blown":"surprised",sad:"sad",unhappy:"sad",disappointed:"sad",down:"sad",love:"love",heart:"love",hearts:"love",adore:"love"}),K(["happy","thinking","celebrating","sheepish","determined","surprised","sad","love"])),Sr=z(J({coin:"coin",flip:"coin",coinflip:"coin",d6:"d6",dice:"d6",die:"d6",d20:"d20","8ball":"8ball",magic8ball:"8ball","8-ball":"8ball",eightball:"8ball","magic-8-ball":"8ball"}),K(["coin","d6","d20","8ball"])),wr=z(e=>typeof e=="number"?String(e):e,h()),ht=12;function Cr(e){return typeof e!="string"?e:e.trim()===""?{}:{glyph:e}}const Ar=h().max(8).optional().transform(e=>{const t=e==null?void 0:e.trim();return t||void 0}),Mr=z(Cr,y({glyph:Ar,icon:h().optional(),tone:Ke.optional(),action:Re.optional()})),_r=z(e=>Array.isArray(e)?e.slice(0,ht).map(t=>Array.isArray(t)?t.slice(0,ht):t):e,D(D(Mr))),ee={text:y({text:re.optional()}).strict(),stat:y({value:re.optional()}).strict(),progress:y({value:re.optional(),label:re.optional()}).strict(),table:y({rows:re.optional()}).strict(),chart:y({data:re.optional()}).strict()},pe=as(()=>z((e,t)=>{if(typeof e=="object"&&e!==null&&Object.hasOwn(e,"bind")){const s=e,a=typeof s.type=="string"&&Object.hasOwn(ee,s.type)?ee[s.type]:void 0;if(!a||!a.safeParse(s.bind).success)return t.addIssue({code:"custom",path:["bind"],message:"This element needs a supported display field and a safe state path."}),rs}return e},Fe("type",[y({type:M("stack"),direction:hr,gap:mr.optional(),children:D(pe)}),y({type:M("card"),title:h().optional(),description:h().optional(),children:D(pe),footer:D(pe).optional()}),y({type:M("divider")}),y({type:M("heading"),text:h(),level:br.optional()}),y({type:M("text"),text:h(),bind:ee.text.optional()}),y({type:M("badge"),text:h(),tone:Ke.optional()}),y({type:M("stat"),bind:ee.stat.optional(),label:h(),value:Ae([h(),Be()]),delta:vr.optional(),hint:h().optional(),trend:D(ae().finite()).max(50).optional()}),y({type:M("keyValue"),items:D(y({key:h(),value:h()}))}),y({type:M("image"),src:h().refine(e=>e.startsWith("https://")||e.startsWith("data:"),{message:"Widget image sources must be https or data URIs"}),alt:h(),caption:h().optional()}),y({type:M("progress"),bind:ee.progress.optional(),value:ae().finite().transform(e=>Math.min(100,Math.max(0,e))),label:h().optional()}),y({type:M("table"),bind:ee.table.optional(),columns:D(y({key:h(),label:h(),align:K(["left","center","right"]).optional()})),rows:D(_t(h(),ft))}),y({type:M("list"),items:D(y({title:h(),subtitle:h().optional(),icon:h().optional(),image:h().refine(e=>e.startsWith("https://")||e.startsWith("data:"),{message:"Widget image sources must be https or data URIs"}).optional(),meta:h().optional(),badge:jr.optional(),actions:D(Re).optional()}))}),y({type:M("chart"),bind:ee.chart.optional(),kind:xr,data:D(y({label:h(),value:ae().finite().min(0)})),height:ae().finite().positive().optional()}),y({type:M("button"),label:h(),variant:gr.optional(),action:Re}),y({type:M("input"),name:h().min(1),label:h().optional(),placeholder:h().optional(),kind:K(["text","number"]).optional(),required:Se().optional()}),y({type:M("select"),required:Se().optional(),name:h().min(1),label:h().optional(),options:D(y({label:h(),value:h()}))}),y({type:M("form"),children:D(pe),submit:y({label:h(),action:ut})}),y({type:M("timeline"),items:D(y({time:h().optional(),title:h(),subtitle:h().optional(),icon:h().optional(),status:kr.optional()})).min(1)}),y({type:M("checklist"),items:D(y({label:h(),checked:mt.optional(),note:h().optional()})),action:ut.optional(),submitLabel:h().optional()}),y({type:M("compare"),options:D(y({name:h(),recommended:mt.optional()})).min(1),rows:D(y({label:h(),values:D(ft)}))}),y({type:M("rating"),value:ae().finite().transform(e=>Math.min(5,Math.max(0,e))),count:ae().int().nonnegative().optional(),label:h().optional()}),y({type:M("mood"),emotion:Nr,message:h().optional()}),y({type:M("board"),rows:_r,label:h().optional()}),y({type:M("reveal"),kind:Sr,result:wr,label:h().optional()})]))),Er=y({version:M(1),title:h().optional(),root:pe});function ze(e){return e.some(t=>fs(t,"widget.action"))}const Ir=100,Tr=3e4;function vn(e){if(e!==null&&typeof e=="object"){for(const t of Object.values(e))vn(t);Object.freeze(e)}return e}function $r(e,t){var C;const[s,a]=g.useState([]),r=g.useRef(new Map),o=g.useRef(e),i=g.useRef({documentId:e==null?void 0:e.documentId,owner:e==null?void 0:e.submissionOwner}),c=g.useRef(!0),d=g.useRef(0),u=g.useCallback(()=>{const l=++d.current,f=[...r.current.values()].map(x=>x.value);a(x=>d.current===l?f:x)},[]),m=g.useCallback(l=>{const f=l.operation;l.operation=void 0,f&&(f.active=!1,clearTimeout(f.timer),f.controller.abort())},[]),p=g.useCallback(l=>{l.retired=!0,l.start=void 0,++d.current,m(l)},[m]),v=g.useCallback(l=>c.current&&!l.retired&&r.current.get(l.value.event.id)===l,[]),k=g.useCallback(l=>{const f=o.current;return i.current.documentId===l.value.documentId&&i.current.owner===l.owner&&(f==null?void 0:f.documentId)===l.value.documentId&&(f==null?void 0:f.submissionOwner)===l.owner},[]),S=g.useCallback((l,f)=>{if(!v(l)||!k(l))return!1;const x=o.current;return!(l.host.current?l.host.current(f):x.enabled)||!v(l)||!k(l)?!1:l.original.current(f)&&v(l)&&k(l)},[v,k]);g.useLayoutEffect(()=>{const l={documentId:e==null?void 0:e.documentId,owner:e==null?void 0:e.submissionOwner};o.current=e,i.current=l;for(const f of r.current.values())k(f)||p(f)},[e,e==null?void 0:e.documentId,e==null?void 0:e.submissionOwner,k,p]),g.useEffect(()=>{c.current=!0;const l=r.current;return()=>{c.current=!1;for(const f of l.values())p(f)}},[p]);const j=g.useCallback((l,f)=>{l.value={...l.value,...f},u()},[u]);g.useEffect(()=>{var l;for(const f of r.current.values()){if(!v(f)||!k(f)||f.value.phase==="refused")continue;const x=f.start,T=f.operation;if(!S(f,"read")||f.start!==x||f.operation!==T)continue;const R=(l=e==null?void 0:e.snapshot)==null?void 0:l.receipts.find(w=>w.receipt.id===f.value.event.id);!S(f,"read")||f.start!==x||f.operation!==T||R&&R!==f.value.receipt&&(f.start=void 0,f.value={...f.value,phase:"accepted",receipt:R},m(f),u())}},[(C=e==null?void 0:e.snapshot)==null?void 0:C.receipts,e==null?void 0:e.submissionOwner,v,k,S,m,u]);const A=l=>[...r.current.values()].some(f=>f.value.controlId===l&&!f.retired&&["sending","retry","review"].includes(f.value.phase)),_=async(l,f=!1)=>{var Y;if(!v(l)||!k(l))return;const x=Object.freeze({});l.start=x,++d.current,m(l);const T=()=>v(l)&&k(l)&&l.start===x&&l.operation===void 0;if(!T())return;const R=S(l,f?"read":"submit");if(!T())return;if(!R){j(l,{phase:f?"retry":"refused",message:f?"Save not confirmed. Review the document before trying again.":"Document actions are unavailable. Review this action before trying again."});return}const w=new AbortController;if(!T()){w.abort();return}const O={token:Object.freeze({}),controller:w,active:!0};l.operation=O,l.start=void 0;const I=()=>v(l)&&k(l)&&l.operation===O&&O.active&&!w.signal.aborted,F=V=>I()?S(l,V)&&I():!1;if(O.timer=setTimeout(()=>{I()&&(O.active=!1,l.operation=void 0,l.uncertain=!0,j(l,{phase:"retry",message:"Save not confirmed. Check your network and try again."}),w.abort())},Tr),!I()){clearTimeout(O.timer),w.abort();return}j(l,{phase:"sending",message:void 0});try{if(f)try{if(!F("read")){I()&&j(l,{phase:"retry",message:"Save not confirmed. Review the document before trying again."});return}const $=await l.original.inspect(w.signal);if(!F("read")){I()&&j(l,{phase:"retry",message:"Save not confirmed. Review the document before trying again."});return}j(l,{phase:"accepted",receipt:$});return}catch($){if(!I()||!I())return;throw $}if(!F("submit")){I()&&j(l,{phase:"review",message:"Document approval changed. Review this action before trying again."});return}const V=[...((Y=o.current)==null?void 0:Y.approvedEventTypes)??[]],U=!l.value.normalized||ze(V);if(!I())return;if(!U){j(l,{phase:"review",message:"Document approval changed. Review this action before trying again."});return}if(!F("submit"))return;l.uncertain=!0;const G=await l.original.submit(w.signal);if(!F("read")){I()&&j(l,{phase:"retry",message:"Save not confirmed. Review the document before trying again."});return}j(l,{phase:"accepted",receipt:G})}catch(V){if(!I())return;const U=V.status;if(!I())return;const G=U!==void 0&&[400,401,403,404,409,413,422].includes(U),$=!f&&G;l.uncertain=f||!$,j(l,{phase:$?"refused":G?"review":"retry",message:$?"This action could not be saved. Review the document before trying again.":G?"Save not confirmed. Review this action before trying again.":"Save not confirmed. Check your network and try again."})}finally{l.operation===O&&(l.operation=void 0,O.active=!1,clearTimeout(O.timer),w.abort())}};return{dispatch:async(l,f)=>{var U;const x=o.current;if(!(x!=null&&x.enabled)||A(f))return;const T=l.kind==="agent";if(T&&!ze(x.approvedEventTypes)||l.kind!=="emit"&&!T)return;const R=us.parse({v:1,id:crypto.randomUUID(),type:T?"widget.action":l.type,payload:T?{actionId:l.id,payload:l.payload??{},widget:{documentId:x.documentId,nodeId:f,...t?{title:t}:{}}}:{...l.payload??{},widget:{documentId:x.documentId,nodeId:f,...t?{title:t}:{}}},...!T&&l.coalesceKey?{coalesceKey:l.coalesceKey}:{}}),w=JSON.stringify(R),O=x.documentId,I=x.submissionOwner,F=(U=x.captureOriginal)==null?void 0:U.call(x,R);if(!F||F.id!==R.id||F.bytes!==w||!c.current||o.current!==x||x.documentId!==O||x.submissionOwner!==I||!F.current("submit")||!c.current||o.current!==x||x.documentId!==O||x.submissionOwner!==I)return;const Y={...x.current?{current:x.current.bind(x)}:{}};if(!c.current||o.current!==x||A(f))return;if(r.current.size>=Ir){const G=[...r.current.values()].find($=>{var B;return $.value.phase==="refused"||$.value.phase==="accepted"&&((B=$.value.receipt)==null?void 0:B.deliveries.every(ye=>["handled","rejected","turn_done","expired","failed","cancelled","superseded","unavailable"].includes(ye.status)))});if(!G)throw new Error("Too many actions are waiting. Try again after they finish.");if(r.current.delete(G.value.event.id),p(G),!c.current||o.current!==x||A(f))return}const V={host:Y,owner:x.submissionOwner,original:F,retired:!1,uncertain:!1,value:{controlId:f,documentId:x.documentId,normalized:T,event:vn(JSON.parse(w)),phase:"sending"}};r.current.set(R.id,V),u(),await _(V)},pending:A,records:s,retry:l=>{const f=r.current.get(l);return f&&f.uncertain&&(f.value.phase==="retry"||f.value.phase==="sending")?_(f,!0):Promise.resolve()}}}const jn=g.createContext("root"),Lr=jn.Provider;function Z(){return g.useContext(jn)}function kn(e){return e.id+":"+JSON.stringify(e.payload??null)}const gt=()=>Promise.resolve(),Nn=g.createContext({onAction:gt,hasSession:!1,channelRecords:[],channelPending:()=>!1,retryChannel:gt,superseded:!1,latched:!1,dispatchedActionKey:null,dispatchStatus:"idle"});function Dr({children:e,channel:t,sessionId:s,widgetTitle:a,isLatestMessage:r=!0}){const{setTheme:o}=ps(),i=ms(),c=$r(t,a),[d,u]=g.useState(null),[m,p]=g.useState(null),v=g.useRef(!1),k=g.useCallback(async(j,A)=>{if(j.kind==="emit"||t&&j.kind==="agent"){await c.dispatch(j,(A==null?void 0:A.controlId)??"root");return}switch(j.kind){case"ui":{if(!s&&!Et(j.command))return;const _={getStore:gs.getState,setTheme:o,supportsTerminal:i.supportsTerminal,celebrationOrigin:A==null?void 0:A.origin,sessionId:s};xs(_,j.command,"user");return}case"url":u(j.href);return;case"agent":{if(!s||v.current)return;v.current=!0;const _={actionId:j.id,payload:j.payload,widgetTitle:a},N=Te.getState();N.setOptimisticUserMessage(s,{id:crypto.randomUUID(),content:dr(_)}),N.setTriggerPending(s,!0);const C=kn(j);p({key:C,status:"pending"});try{await i.sendUiAction(s,_),p({key:C,status:"sent"}),setTimeout(()=>{var f;const l=Te.getState().getSession(s);l.triggerPending&&((f=l.status)==null?void 0:f.lifecycle)!=="streaming"&&Te.getState().setTriggerPending(s,!1)},hs.TRIGGER_PENDING_TIMEOUT_MS)}catch(l){throw v.current=!1,N.setOptimisticUserMessage(s,null),N.setTriggerPending(s,!1),p(null),l}return}}},[o,i,s,a,t,c]),S=g.useMemo(()=>({onAction:k,channel:t,channelRecords:c.records,channelPending:c.pending,retryChannel:c.retry,hasSession:!!s,superseded:!r,latched:m!==null,dispatchedActionKey:(m==null?void 0:m.key)??null,dispatchStatus:(m==null?void 0:m.status)??"idle"}),[k,s,r,m,t,c]);return n.jsxs(Nn.Provider,{value:S,children:[e,n.jsx(ys,{url:d??"",isOpen:d!==null,onClose:()=>u(null),onConfirm:()=>{d&&bs(d),u(null)}})]})}function ge(){return g.useContext(Nn)}function Sn(e,t){var N;const s=Z(),a=ge();if(e.kind==="emit"||e.kind==="agent"&&a.channel!==void 0){const C=!((N=a.channel)!=null&&N.enabled)||e.kind==="agent"&&!ze(a.channel.approvedEventTypes),l=a.channelPending(t??s);return{isAgent:!1,unavailable:C,superseded:!1,latched:!1,isDispatched:l,dispatchStatus:l?"pending":"idle",interactive:!C&&!l}}const{hasSession:o,superseded:i,latched:c,dispatchedActionKey:d,dispatchStatus:u}=a,m=e.kind==="agent",p=e.kind==="agent"?kn(e):null,v=p!==null&&p===d,S=(m||e.kind==="ui"&&!Et(e.command))&&!o,j=m&&i;return{isAgent:m,unavailable:S,superseded:j,latched:m&&c&&!v,isDispatched:v,dispatchStatus:v?u:"idle",interactive:m?!S&&!j&&!c:!S}}const H={type:"spring",stiffness:400,damping:32,mass:.8},le=[.22,1,.36,1],He=.05,Ye=.9,xe={hidden:{opacity:0,y:6,scale:.985},visible:{opacity:1,y:0,scale:1,transition:H}},_e={hidden:{},visible:{transition:{staggerChildren:He}}};function W(){return!vs()}function wn(e,t,s=Ye*1e3){const[a,r]=g.useState(()=>t?0:e),o=g.useRef(t?0:e);return g.useEffect(()=>{if(!t){o.current=e;return}const i=Wa(o.current,e,{duration:s/1e3,ease:le,onUpdate:c=>{o.current=c,r(c)}});return()=>i.stop()},[e,t,s]),t?a:e}const Cn=new Set(["__proto__","prototype","constructor"]),Or={text:["text"],stat:["value"],progress:["value","label"],table:["rows"],chart:["data"]},Rr=100,xt=50,zr=16384;function oe(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function X(e,t){const s=Object.getOwnPropertyDescriptor(e,t);if(!s||!("value"in s))throw new Error("missing");return s.value}function Wr(e,t){if(!oe(e)||!js.safeParse(t).success)throw new Error("path");let s=e;if(t==="")return s;for(const a of t.slice(1).split("/")){const r=a.replaceAll("~1","/").replaceAll("~0","~");if(Cn.has(r))throw new Error("path");if(Array.isArray(s)){if(!/^(0|[1-9]\d*)$/u.test(r)||Number(r)>=s.length)throw new Error("index")}else if(!oe(s))throw new Error("object");s=X(s,r)}return s}function me(e,t=zr){return typeof e=="string"&&e.length<=t}function ke(e){return typeof e=="number"&&Number.isFinite(e)}function Pr(e){return e===null||typeof e=="boolean"||ke(e)||me(e)}function Fr(e,t,s){if(e.type==="text"&&t==="text"&&me(s)||e.type==="stat"&&t==="value"&&(me(s,1024)||ke(s))||e.type==="progress"&&(t==="label"&&me(s,1024)||t==="value"&&ke(s)&&s>=0&&s<=100))return s;if(!Array.isArray(s)||s.length>Rr)throw new Error("type");if(e.type==="table"&&t==="rows"){if(e.columns.length>xt)throw new Error("columns");const a=new Set(e.columns.map(r=>r.key));return Array.from({length:s.length},(r,o)=>{const i=X(s,String(o));if(!oe(i))throw new Error("row");const c=Object.keys(i);if(c.length>xt)throw new Error("columns");const d=Object.create(null);for(const u of c){if(Cn.has(u)||!a.has(u))throw new Error("column");const m=X(i,u);if(!Pr(m))throw new Error("cell");d[u]=m}return d})}if(e.type==="chart"&&t==="data")return Array.from({length:s.length},(a,r)=>{const o=X(s,String(r));if(!oe(o)||Object.keys(o).some(d=>d!=="label"&&d!=="value"))throw new Error("point");const i=X(o,"label"),c=X(o,"value");if(!me(i,1024)||!ke(c)||c<0)throw new Error("point");return{label:i,value:c}});throw new Error("type")}function Br(e,t){if(!("bind"in e)||e.bind===void 0)return{node:e};const s=Or[e.type],a=e.bind;if(!s||!oe(a))return{error:"This element has an unsupported state binding."};const r=Object.keys(a);if(r.length===0)return{node:e};const o={};for(const i of r)try{if(!s.includes(i))throw new Error("field");const c=X(a,i);if(!oe(c)||Object.keys(c).length!==1||!Object.hasOwn(c,"path"))throw new Error("binding");const d=X(c,"path");if(typeof d!="string")throw new Error("path");const u=Fr(e,i,Wr(t,d));if(new TextEncoder().encode(JSON.stringify(u)).byteLength>65536)throw new Error("size");o[i]=u}catch{return{error:`Cannot show ${i}: its state value is missing or has the wrong type.`}}return{node:{...e,...o}}}const An=g.createContext(null),Vr=An.Provider;function Mn(){return g.useContext(An)}const Ur={default:"bg-secondary text-secondary-foreground border-transparent",success:"bg-status-success-bg text-status-success-fg border-status-success-border",warning:"bg-status-warning-bg text-status-warning-fg border-status-warning-border",error:"bg-status-error-bg text-status-error-fg border-status-error-border",info:"bg-status-info-bg text-status-info-fg border-status-info-border"};function Ee(e){return Ur[e??"default"]}function Gr(e){var c;if(typeof e=="number")return Number.isFinite(e)?{prefix:"",suffix:"",decimals:0,grouped:!1,value:e}:null;const t=e.match(/^(.*?)(-?\d[\d,]*(?:\.\d+)?)(.*)$/s);if(!t)return null;const[,s,a,r]=t,o=Number(a.replace(/,/g,""));if(!Number.isFinite(o))return null;const i=a.includes(".")?((c=a.split(".")[1])==null?void 0:c.length)??0:0;return{prefix:s,suffix:r,decimals:i,grouped:a.includes(","),value:o}}function Kr(e,t){const s=t.toFixed(e.decimals),a=e.grouped?Number(s).toLocaleString("en-US",{minimumFractionDigits:e.decimals,maximumFractionDigits:e.decimals}):s;return`${e.prefix}${a}${e.suffix}`}const Hr={1:"text-lg font-semibold",2:"text-base font-semibold",3:"text-sm font-semibold"};function Yr({node:e}){const t=e.level??3,s=E(Hr[t],"text-foreground");return t===1?n.jsx("h1",{className:s,children:e.text}):t===2?n.jsx("h2",{className:s,children:e.text}):n.jsx("h3",{className:s,children:e.text})}function qr({node:e}){return n.jsx(da,{content:e.text,className:"text-sm"})}function Qr({node:e}){const t=W();return n.jsx(b.span,{className:E("inline-flex w-fit items-center rounded-md border px-2 py-0.5 text-xs font-medium",Ee(e.tone)),initial:t?{opacity:0,scale:.8}:!1,animate:t?{opacity:1,scale:1}:!1,transition:H,children:e.text})}function Xr(){return n.jsx(ws,{})}const Jr={up:Ss,down:Ns,flat:It},Zr={up:"text-status-success",down:"text-status-error",flat:"text-muted-foreground"};function ei({node:e}){const t=W(),s=Gr(e.value),a=wn((s==null?void 0:s.value)??0,t&&s!==null),r=s?Kr(s,a):String(e.value),o=e.delta?Jr[e.delta.direction]:null;return n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:e.label}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-baseline gap-2",children:[n.jsx("span",{className:"text-foreground text-2xl font-semibold tabular-nums",children:r}),e.delta&&o&&n.jsxs(b.span,{className:E("inline-flex items-center gap-0.5 text-xs font-medium",Zr[e.delta.direction]),initial:t?{opacity:0,x:-4}:!1,animate:t?{opacity:1,x:0}:!1,transition:{...H,delay:.25},children:[n.jsx(o,{className:"size-3","aria-hidden":!0}),e.delta.value]})]}),e.trend&&e.trend.length>=2&&n.jsx(ti,{values:e.trend})]}),e.hint&&n.jsx("span",{className:"text-muted-foreground text-xs",children:e.hint})]})}function ti({values:e}){const t=W(),s=`spark-wipe-${g.useId().replace(/:/g,"")}`,a=Math.min(...e),r=Math.max(...e),o=r-a||1,i=e.map((c,d)=>{const u=d/(e.length-1)*100,m=r===a?50:100-(c-a)/o*100;return`${u},${m}`}).join(" ");return n.jsxs("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none",className:"h-5 w-16 shrink-0 overflow-visible","aria-hidden":!0,children:[t&&n.jsx("defs",{children:n.jsx("clipPath",{id:s,children:n.jsx(b.rect,{x:-4,y:-12,height:124,initial:{width:0},animate:{width:108},transition:{duration:Ye,ease:le}})})}),n.jsx("g",{clipPath:t?`url(#${s})`:void 0,children:n.jsx("polyline",{points:i,fill:"none",stroke:"hsl(var(--chart-1))",strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"})})]})}function ni({node:e}){return n.jsx("dl",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm",children:e.items.map((t,s)=>n.jsxs("div",{className:"contents",children:[n.jsx("dt",{className:"text-muted-foreground",children:t.key}),n.jsx("dd",{className:"text-foreground text-right break-words",children:t.value})]},`${t.key}-${s}`))})}function si({node:e}){const t=W(),s=wn(e.value,t);return n.jsxs("div",{className:"flex flex-col gap-1",children:[(e.label||e.label==="")&&n.jsxs("div",{className:"text-muted-foreground flex items-center justify-between text-xs",children:[n.jsx("span",{children:e.label}),n.jsxs("span",{className:"tabular-nums",children:[Math.round(s),"%"]})]}),n.jsx(ks,{value:s})]})}function ai({node:e}){return n.jsxs("figure",{className:"flex flex-col gap-1",children:[n.jsx("img",{src:e.src,alt:e.alt,className:"max-h-80 w-full rounded-md border object-contain",loading:"lazy"}),e.caption&&n.jsx("figcaption",{className:"text-muted-foreground text-xs",children:e.caption})]})}const ri=b.create(Ut),ii=b.create(Me),yt={left:"text-left",center:"text-center",right:"text-right"};function oi(e){return e===null?"—":typeof e=="boolean"?e?"Yes":"No":String(e)}function ci({node:e}){const t=W();return n.jsx("div",{className:"overflow-x-auto",children:n.jsxs(Bt,{children:[n.jsx(Vt,{children:n.jsx(Me,{children:e.columns.map(s=>n.jsx(De,{className:E(s.align&&yt[s.align]),children:s.label},s.key))})}),n.jsx(ri,{variants:t?_e:void 0,initial:t?"hidden":!1,animate:t?"visible":!1,children:e.rows.map((s,a)=>n.jsx(ii,{variants:t?xe:void 0,children:e.columns.map(r=>n.jsx(Oe,{className:E("tabular-nums",r.align&&yt[r.align]),children:oi(s[r.key]??null)},r.key))},a))})]})})}const li={"alert-circle":Hs,"alert-triangle":$t,archive:Ks,"arrow-right":It,bell:Gs,bookmark:Pa,calendar:Us,check:Ve,"check-circle":Fa,circle:Le,clock:Vs,cloud:Ba,code:Va,cog:Ua,database:Ka,file:ha,"file-text":ma,flag:er,folder:Bs,"git-branch":pa,globe:Fs,heart:fa,home:tr,info:Ps,link:Ws,lock:zs,mail:Rs,"map-pin":nr,"message-square":Os,package:ua,play:Ds,rocket:sr,search:Ls,server:$s,settings:Ts,star:Tt,tag:ar,terminal:Is,"thumbs-up":Es,trash:_s,"trending-down":rr,"trending-up":ir,user:Ms,users:As,zap:Cs};function qe(e){if(!e)return Le;const t=e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/\s+/g,"-").toLowerCase();return li[t]??Le}function di(e,t){var a;if(e.phase==="sending")return"Saving…";if(e.phase!=="accepted")return e.message??"This action could not be saved.";const s=((a=e.receipt)==null?void 0:a.deliveries)??[];return s.length?s.map(r=>{if(r.ackOutcome==="handled"||r.status==="handled")return`${t} reported that it handled this action.`;if(r.ackOutcome==="rejected"||r.status==="rejected")return`${t} could not handle this action.`;switch(r.status){case"turn_started":return`${t} started working.`;case"turn_done":return`${t} finished. Handling is not confirmed yet.`;case"in_doubt":return"Saved; outcome unknown. Review before replaying.";case"failed":return"Saved; the agent request failed.";case"expired":return"Saved; expired before the agent started.";case"superseded":return"Saved; replaced by a newer change.";case"cancelled":return"Saved; the agent request was cancelled.";case"unavailable":return"Saved; the destination is not available.";default:return`Saved; waiting for ${t}.`}}).join(" "):"Saved to the document."}function _n({controlId:e,descendants:t=!1}){const{channel:s,channelRecords:a,retryChannel:r}=ge();if(!s)return null;const o=a.filter(i=>i.controlId===e||t&&i.controlId.startsWith(`${e}.`));return o.length?n.jsx("ul",{className:"text-muted-foreground mt-2 flex max-h-32 flex-col gap-1.5 overflow-y-auto text-xs","aria-live":"polite","aria-relevant":"additions text","data-testid":"widget-action-statuses",children:o.map((i,c)=>n.jsxs("li",{"data-testid":"widget-action-status","data-event-id":i.event.id,className:"flex flex-wrap items-center gap-2",children:[n.jsxs("span",{children:[o.length>1?`Action ${c+1}: `:"",di(i,s.destinationLabel)]}),i.phase==="retry"&&n.jsx(Lt,{size:"sm",variant:"ghost",onClick:()=>void r(i.event.id),"data-testid":"widget-action-retry",children:"Try again"})]},i.event.id))}):null}function Ie({action:e,label:t,variant:s,fullWidth:a,controlId:r,submit:o}){const{onAction:i,channel:c}=ge(),d=Z(),u=r??d,m=e.kind==="emit"||e.kind==="agent"&&c!==void 0,p=Sn(e,u),v=W(),k=p.isDispatched&&p.dispatchStatus==="pending",S=p.isDispatched&&p.dispatchStatus==="sent",j=!p.interactive,A=v&&p.interactive,_=l=>{var T;if(j){l.preventDefault();return}if(o&&!((T=l.currentTarget.form)!=null&&T.reportValidity())){l.preventDefault();return}const f=Wt(l.currentTarget.getBoundingClientRect()),x=i(e,{origin:f,controlId:u});e.kind!=="agent"&&e.kind!=="emit"||x.catch(()=>{Pt.error(m?"This action could not be saved.":"Couldn’t send the action",{description:m?"Check the action size and document permissions, then try again.":"Your agent may be busy. Try again."})})};let N=null;p.superseded?N="This one’s from an earlier message.":p.unavailable?N=m?e.kind==="agent"&&(c!=null&&c.enabled)?"This action needs an approved document route.":"Document actions are not available here.":"Interactions aren’t available here":p.latched&&(N="Sent. Waiting for the agent’s reply");const C=n.jsxs(Lt,{type:o?"submit":"button","data-testid":m?"widget-channel-action":void 0,size:"sm",variant:s??"default","aria-disabled":j||void 0,disabled:k,onClick:j?void 0:_,className:E(a&&"w-full",j&&"cursor-default",(p.unavailable||p.superseded)&&"opacity-50",S&&"opacity-70"),children:[k&&n.jsx(ea,{size:"xs"}),S&&n.jsx(Ve,{className:"size-(--size-icon-xs)","aria-hidden":!0}),t]});return m?n.jsxs("div",{className:E(a&&"w-full"),children:[n.jsx("div",{className:"text-muted-foreground mb-1 text-xs",children:c!=null&&c.destinationLabel?`To ${c.destinationLabel}`:"Document action"}),C,N&&n.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:N}),n.jsx(_n,{controlId:u})]}):N?n.jsx(Dt,{children:n.jsxs(Ot,{children:[n.jsx(Rt,{asChild:!0,children:C}),n.jsx(zt,{children:N})]})}):!A&&!m?C:n.jsx(b.div,{className:E("inline-flex",a&&"w-full"),whileHover:{scale:1.02},transition:H,children:C})}function ui({node:e}){return n.jsx(Ie,{action:e.action,label:e.label,variant:e.variant})}function fi({node:e}){const t=Mn(),s=g.useId(),[a,r]=g.useState(!1),[o,i]=g.useState(""),c=t?t.values[e.name]??"":o,d=u=>t?t.setValue(e.name,u):i(u);return n.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.label&&n.jsx(Ue,{htmlFor:s,children:e.label}),n.jsx(Zs,{id:s,name:e.name,type:e.kind==="number"?"number":"text",required:e.required,"aria-label":e.label??e.name,placeholder:e.placeholder,value:c,"aria-invalid":a||void 0,"aria-describedby":a?`${s}-error`:void 0,onInvalid:u=>{u.preventDefault(),r(!0),u.currentTarget.focus()},onChange:u=>{r(!1),d(u.target.value)}}),a&&n.jsxs("p",{id:`${s}-error`,className:"text-destructive text-xs",role:"alert",children:["Enter ",e.label??e.name,"."]})]})}function pi({node:e}){const t=g.useRef(null),s=Mn(),a=g.useId(),[r,o]=g.useState(!1),[i,c]=g.useState(""),d=s?s.values[e.name]??"":i,u=m=>s?s.setValue(e.name,m):c(m);return n.jsxs("div",{className:"flex flex-col gap-1.5",onInvalidCapture:m=>{var p;m.preventDefault(),o(!0),(p=t.current)==null||p.focus()},children:[e.label&&n.jsx(Ue,{htmlFor:a,children:e.label}),n.jsxs(Ys,{name:e.name,required:e.required,value:d||void 0,onValueChange:m=>{o(!1),u(m)},children:[n.jsx(qs,{ref:t,"aria-invalid":r||void 0,"aria-describedby":r?`${a}-error`:void 0,id:a,"aria-label":e.label??e.name,children:n.jsx(Qs,{placeholder:"Select…"})}),n.jsx(Xs,{children:e.options.map(m=>n.jsx(Js,{value:m.value,children:m.label},m.value))})]}),r&&n.jsxs("p",{id:`${a}-error`,className:"text-destructive text-xs",role:"alert",children:["Choose ",e.label??e.name,"."]})]})}function mi({node:e}){const t=W(),s=Z();return n.jsx(b.ul,{className:"divide-border divide-y",variants:t?_e:void 0,initial:t?"hidden":!1,animate:t?"visible":!1,children:e.items.map((a,r)=>{const o=qe(a.icon);return n.jsxs(b.li,{className:"hover:bg-muted/40 -mx-2 flex items-center gap-3 rounded-md px-2 py-2 transition-colors first:pt-0 last:pb-0",variants:t?xe:void 0,children:[a.image&&n.jsx("img",{src:a.image,alt:"",className:"size-10 shrink-0 rounded-md border object-cover",loading:"lazy"}),a.icon&&n.jsx(o,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":!0}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:"text-foreground truncate text-sm font-medium",children:a.title}),a.subtitle&&n.jsx("p",{className:"text-muted-foreground truncate text-xs",children:a.subtitle})]}),a.meta&&n.jsx("span",{className:"text-muted-foreground shrink-0 text-sm tabular-nums",children:a.meta}),a.badge&&n.jsx("span",{className:E("inline-flex shrink-0 items-center rounded-md border px-2 py-0.5 text-xs font-medium",Ee(a.badge.tone)),children:a.badge.text}),a.actions&&a.actions.length>0&&n.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:a.actions.map((i,c)=>n.jsx(Ie,{action:i,controlId:`${s}.items.${r}.actions.${c}`,label:i.kind==="agent"?i.label??"Action":i.kind==="emit"?"Send":hi(i)},c))})]},r)})})}function hi(e){return e.kind==="url"?"Open":"Run"}const te=["hsl(var(--chart-1))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))"],gi=180,xi=.15;function yi({node:e}){const t=e.height??gi,s=`${e.kind} chart`;return e.data.length===0?n.jsx("p",{className:"text-muted-foreground text-xs",children:"No data to chart."}):e.kind==="bar"?n.jsx(vi,{data:e.data,height:t,label:s}):e.kind==="pie"?n.jsx(Ni,{data:e.data,height:t,label:s}):n.jsx(ji,{data:e.data,height:t,area:e.kind==="area",label:s})}const bi=18;function vi({data:e,height:t,label:s}){const a=W(),r=Math.max(...e.map(i=>i.value),0)||1,o=Math.max(0,t-bi);return n.jsxs("div",{role:"img","aria-label":s,className:"flex flex-col gap-1",children:[n.jsx("div",{className:"flex items-end gap-2",style:{height:t},children:e.map((i,c)=>n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col items-center justify-end gap-1",children:[n.jsx("span",{className:"text-muted-foreground text-2xs tabular-nums",children:i.value}),n.jsx(b.div,{className:"w-full origin-bottom rounded-t-sm",style:{height:i.value/r*o,backgroundColor:te[c%te.length]},initial:a?{scaleY:0}:!1,animate:a?{scaleY:1}:!1,transition:{...H,delay:c*He}})]},c))}),n.jsx(En,{data:e})]})}function ji({data:e,height:t,area:s,label:a}){const r=Math.max(...e.map(v=>v.value),0)||1,o=e.length,c=e.map((v,k)=>{const S=o===1?50:k/(o-1)*100,j=100-v.value/r*100;return{x:S,y:j}}).map(v=>`${v.x},${v.y}`).join(" "),d=`0,100 ${c} 100,100`,u=te[0],m=W(),p=`chart-wipe-${g.useId().replace(/:/g,"")}`;return n.jsxs("div",{role:"img","aria-label":a,className:"flex flex-col gap-1",children:[n.jsxs("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none",style:{height:t},className:"w-full overflow-visible",children:[m&&n.jsx("defs",{children:n.jsx("clipPath",{id:p,children:n.jsx(b.rect,{x:-4,y:-12,height:124,initial:{width:0},animate:{width:108},transition:{duration:Ye,ease:le}})})}),n.jsxs("g",{clipPath:m?`url(#${p})`:void 0,children:[s&&n.jsx("polygon",{points:d,fill:u,opacity:xi}),n.jsx("polyline",{points:c,fill:"none",stroke:u,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"})]})]}),n.jsx(En,{data:e})]})}const ki=359.99;function Ni({data:e,height:t,label:s}){const a=W(),r=e.reduce((i,c)=>i+c.value,0)||1,o=e.map((i,c)=>{const u=-90+e.slice(0,c).reduce((v,k)=>v+k.value,0)/r*360,m=i.value/r*360,p=m>=ki;return{d:i,full:p,path:p?"":Si(u,u+m)}});return n.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[n.jsx("svg",{viewBox:"0 0 100 100",role:"img","aria-label":s,style:{height:t,width:t},children:o.map((i,c)=>{const d=te[c%te.length],u={initial:a?{opacity:0,scale:.6}:!1,animate:a?{opacity:1,scale:1}:!1,transition:{...H,delay:c*He},style:{transformOrigin:"50px 50px"}};return i.full?n.jsx(b.circle,{cx:50,cy:50,r:50,fill:d,...u},c):n.jsx(b.path,{d:i.path,fill:d,...u},c)})}),n.jsx("ul",{className:"flex flex-col gap-1 text-xs",children:e.map((i,c)=>n.jsxs("li",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"size-2.5 shrink-0 rounded-sm",style:{backgroundColor:te[c%te.length]},"aria-hidden":!0}),n.jsx("span",{className:"text-foreground",children:i.label}),n.jsx("span",{className:"text-muted-foreground tabular-nums",children:i.value})]},c))})]})}function En({data:e}){return n.jsx("div",{className:"flex gap-2",children:e.map((t,s)=>n.jsx("span",{className:E("text-muted-foreground text-2xs min-w-0 flex-1 truncate text-center"),title:t.label,children:t.label},s))})}function Si(e,t){const o=bt(50,50,50,e),i=bt(50,50,50,t),c=t-e>180?1:0;return`M 50 50 L ${o.x} ${o.y} A 50 50 0 ${c} 1 ${i.x} ${i.y} Z`}function bt(e,t,s,a){const r=a*Math.PI/180;return{x:e+s*Math.cos(r),y:t+s*Math.sin(r)}}const wi={done:"border-status-success bg-status-success text-white dark:text-status-success-bg",active:"border-primary bg-primary text-primary-foreground",upcoming:"border-border bg-background text-muted-foreground"};function Ci({node:e}){const t=W();return n.jsx(b.ol,{className:"flex flex-col",variants:t?_e:void 0,initial:t?"hidden":!1,animate:t?"visible":!1,children:e.items.map((s,a)=>{const r=s.status??"upcoming",o=a===e.items.length-1,i=s.icon?qe(s.icon):null;return n.jsxs(b.li,{className:"flex gap-3",variants:t?xe:void 0,children:[n.jsxs("div",{className:"flex flex-col items-center",children:[n.jsxs("span",{className:"relative flex size-5 shrink-0 items-center justify-center",children:[r==="active"&&t&&n.jsx(b.span,{className:"border-primary absolute inset-0 rounded-full border",initial:{opacity:.6,scale:1},animate:{opacity:0,scale:1.8},transition:{duration:1.6,repeat:1/0,ease:"easeOut"},"aria-hidden":!0}),n.jsx("span",{className:E("flex size-3 items-center justify-center rounded-full border",wi[r],r==="active"&&"ring-primary/30 ring-2"),children:i&&n.jsx(i,{className:"size-2.5","aria-hidden":!0})})]}),!o&&n.jsx("span",{className:"bg-border w-px flex-1","aria-hidden":!0})]}),n.jsxs("div",{className:E("min-w-0 flex-1",!o&&"pb-4"),children:[s.time&&n.jsx("p",{className:"text-muted-foreground text-xs tabular-nums",children:s.time}),n.jsx("p",{className:E("text-foreground text-sm",r==="active"?"font-semibold":"font-medium"),children:s.title}),s.subtitle&&n.jsx("p",{className:"text-muted-foreground text-xs",children:s.subtitle})]})]},a)})})}function Ai({node:e}){const t=g.useId(),[s,a]=g.useState(()=>e.items.map(o=>o.checked??!1)),r=g.useMemo(()=>{if(!e.action)return null;const o=e.items.filter((d,u)=>s[u]).map(d=>d.label),i=e.items.filter((d,u)=>!s[u]).map(d=>d.label),c={checked:o,unchecked:i};return e.action.kind==="emit"?{...e.action,payload:{...e.action.payload??{},...c}}:{...e.action,payload:{...e.action.payload??{},...c}}},[e.action,e.items,s]);return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("ul",{className:"flex flex-col gap-2",children:e.items.map((o,i)=>{const c=`${t}-${i}`;return n.jsxs("li",{className:"flex items-start gap-2.5",children:[n.jsx(ta,{id:c,checked:s[i],onCheckedChange:d=>a(u=>u.map((m,p)=>p===i?d===!0:m)),className:"mt-0.5"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx(Ue,{htmlFor:c,className:E("text-sm font-normal transition-colors",s[i]&&"text-muted-foreground line-through"),children:o.label}),o.note&&n.jsx("p",{className:"text-muted-foreground text-xs",children:o.note})]})]},i)})}),r&&n.jsx(Ie,{action:r,label:e.submitLabel??"Send",fullWidth:!0})]})}const Mi=b.create(Ut),_i=b.create(Me);function Ei({value:e}){return e==null?n.jsx("span",{className:"text-muted-foreground",children:"—"}):typeof e=="boolean"?e?n.jsx(Ve,{className:"text-status-success mx-auto size-4","aria-label":"Yes"}):n.jsx(na,{className:"text-muted-foreground mx-auto size-4","aria-label":"No"}):n.jsx("span",{className:"tabular-nums",children:String(e)})}function Ii({node:e}){const t=W();return n.jsx("div",{className:"overflow-x-auto",children:n.jsxs(Bt,{children:[n.jsx(Vt,{children:n.jsxs(Me,{children:[n.jsx(De,{}),e.options.map((s,a)=>n.jsxs(De,{className:E("text-center",s.recommended&&"bg-primary/5"),children:[n.jsx("span",{className:"text-foreground font-medium",children:s.name}),s.recommended&&n.jsx("span",{className:E("text-2xs mt-1 flex w-fit items-center justify-center rounded-md border px-1.5 py-0.5 font-medium","mx-auto",Ee("success")),children:"Recommended"})]},a))]})}),n.jsx(Mi,{variants:t?_e:void 0,initial:t?"hidden":!1,animate:t?"visible":!1,children:e.rows.map((s,a)=>n.jsxs(_i,{variants:t?xe:void 0,children:[n.jsx(Oe,{className:"text-muted-foreground font-medium",children:s.label}),e.options.map((r,o)=>n.jsx(Oe,{className:E("text-center",r.recommended&&"bg-primary/5"),children:n.jsx(Ei,{value:s.values[o]??null})},o))]},a))})]})})}const We=5,Ti=Array.from({length:We});function vt({className:e}){return n.jsx("div",{className:"flex","aria-hidden":!0,children:Ti.map((t,s)=>n.jsx(Tt,{className:E("size-4",e)},s))})}function $i({node:e}){const t=W(),s=e.value/We*100;return n.jsxs(b.div,{className:"flex items-center gap-2",initial:t?{opacity:0,y:4}:!1,animate:t?{opacity:1,y:0}:!1,transition:H,children:[n.jsxs("div",{className:"relative w-fit",role:"img","aria-label":`Rated ${e.value.toFixed(1)} out of ${We}`,children:[n.jsx(vt,{className:"text-muted-foreground"}),n.jsx("div",{className:"absolute inset-y-0 left-0 overflow-hidden",style:{width:`${s}%`},children:n.jsx(vt,{className:"fill-status-warning text-status-warning"})})]}),n.jsx("span",{className:"text-foreground text-sm font-medium tabular-nums",children:e.value.toFixed(1)}),e.count!==void 0&&n.jsxs("span",{className:"text-muted-foreground text-sm tabular-nums",children:["(",e.count.toLocaleString(),")"]}),e.label&&n.jsx("span",{className:"text-muted-foreground text-sm",children:e.label})]})}const Li=7.4,Di=[1,.1,1,1,.1,1,.1,1,1],Oi=[0,.02,.045,.52,.54,.565,.585,.61,1];function q({cx:e,cy:t,r:s=3,openness:a=1,active:r=!0,popIn:o=!1,motionOn:i}){const c=i&&r,d=a;return n.jsx(b.circle,{cx:e,cy:t,r:s,fill:"currentColor",style:{transformOrigin:`${e}px ${t}px`,scaleY:i?void 0:d},initial:i&&o?{scale:.2}:void 0,animate:i?{scale:1,...c?{scaleY:Di.map(u=>u*d)}:{scaleY:d}}:void 0,transition:i?{scale:{type:"spring",stiffness:500,damping:15},...c?{scaleY:{duration:Li,times:Oi,repeat:1/0,ease:"easeInOut"}}:{}}:void 0})}function jt({cx:e,cy:t}){return n.jsx("path",{d:`M ${e-4.5} ${t+1.5} Q ${e} ${t-4.5} ${e+4.5} ${t+1.5}`,fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round"})}function kt({cx:e,cy:t,motionOn:s,pulseDuration:a,delay:r=0,wobble:o=3}){const i=`M ${e} ${t+4} C ${e-8} ${t-2}, ${e-4} ${t-8}, ${e} ${t-4} C ${e+4} ${t-8}, ${e+8} ${t-2}, ${e} ${t+4} Z`;return n.jsx(b.path,{d:i,fill:"currentColor",className:"text-status-error",style:{transformOrigin:`${e}px ${t}px`},animate:s?{scale:[1,1.16,1],rotate:[-o,o,-o]}:void 0,transition:s?{scale:{duration:a,repeat:1/0,ease:"easeInOut",delay:r},rotate:{duration:a*2.1,repeat:1/0,ease:"easeInOut",delay:r}}:void 0})}function P({d:e}){return n.jsx("path",{d:e,fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round"})}function ce({cx:e,cy:t,opacity:s=.3}){return n.jsx("ellipse",{cx:e,cy:t,rx:3.6,ry:2.1,className:"text-status-error",fill:"currentColor",fillOpacity:s})}const Nt="M 0 -3.2 C 2.2 -0.6, 2.6 1.4, 0 3.2 C -2.6 1.4, -2.2 -0.6, 0 -3.2 Z";function In({x:e,y:t,motionOn:s,duration:a,repeatDelay:r}){return s?n.jsx(b.g,{style:{x:e,y:t},animate:{y:[t,t+2,t+9,t+11],opacity:[0,.85,.85,0],scale:[.5,1,1,.85]},transition:{duration:a,times:[0,.3,.85,1],repeat:1/0,repeatDelay:r,ease:"easeIn"},children:n.jsx("path",{d:Nt,className:"text-status-info",fill:"currentColor"})}):n.jsx("g",{transform:`translate(${e} ${t+4})`,opacity:.5,children:n.jsx("path",{d:Nt,className:"text-status-info",fill:"currentColor"})})}function Ri({motionOn:e}){return n.jsx(In,{x:47,y:13,motionOn:e,duration:3.4,repeatDelay:2.6})}function zi({motionOn:e}){return n.jsx(In,{x:24,y:30,motionOn:e,duration:3.6,repeatDelay:3.2})}function Wi({motionOn:e}){return e?n.jsx(n.Fragment,{children:[{x:49,y:15,delay:0},{x:53.5,y:19,delay:.9}].map((t,s)=>n.jsx(b.circle,{cx:t.x,cy:t.y,r:2,fill:"currentColor",style:{transformOrigin:`${t.x}px ${t.y}px`},animate:{opacity:[0,.45,0],y:[0,-3,-6],scale:[.6,1,1.4]},transition:{duration:2,repeat:1/0,repeatDelay:1.4,delay:t.delay,ease:"easeOut"}},s))}):null}const de={fill:"none",stroke:"currentColor",strokeLinecap:"round"};function Pi({motionOn:e}){const t={scaleY:[1,.1,1,1,.15,.15,1],times:[0,.03,.06,.84,.87,.96,1]},s={opacity:[0,0,.4,.4,0],times:[0,.84,.88,.96,1]},a={duration:8,repeat:1/0,ease:"easeInOut"};return n.jsxs(n.Fragment,{children:[n.jsx(P,{d:"M18 18 Q24 14.5 30 18"}),n.jsx(P,{d:"M34 18 Q40 14.5 46 18"}),[24,40].map(r=>n.jsx(b.circle,{cx:r,cy:26,r:3,fill:"currentColor",style:{transformOrigin:`${r}px 26px`},animate:e?{scaleY:t.scaleY}:void 0,transition:e?{...a,times:t.times}:void 0},r)),e&&n.jsxs(b.g,{animate:{opacity:s.opacity},transition:{...a,times:s.times},children:[n.jsx(ce,{cx:16.5,cy:33,opacity:1}),n.jsx(ce,{cx:47.5,cy:33,opacity:1})]}),n.jsx("path",{d:"M19 38 Q32 51 45 38",...de,strokeWidth:3})]})}function Fi({motionOn:e}){return n.jsxs(n.Fragment,{children:[n.jsx(P,{d:"M20 20 L29 20"}),n.jsx(b.g,{animate:e?{y:[0,-1.2,0]}:void 0,transition:e?{duration:3.4,repeat:1/0,ease:"easeInOut"}:void 0,children:n.jsx(P,{d:"M36 16 Q41 13 46 16"})}),n.jsxs(b.g,{animate:e?{x:[0,0,-3.5,-3.5,0,0,2,0]}:void 0,transition:e?{duration:7,times:[0,.3,.36,.52,.58,.78,.84,1],repeat:1/0,ease:"easeInOut"}:void 0,children:[n.jsx(q,{cx:27,cy:23,motionOn:e}),n.jsx(q,{cx:43,cy:23,motionOn:e})]}),n.jsx("path",{d:"M27 43 L37 41.5",...de,strokeWidth:2.5})]})}function Bi(){return n.jsxs(n.Fragment,{children:[n.jsx(P,{d:"M18 16 Q24 12.5 30 16"}),n.jsx(P,{d:"M34 16 Q40 12.5 46 16"}),n.jsx(jt,{cx:24,cy:26}),n.jsx(jt,{cx:40,cy:26}),n.jsx("path",{d:"M19 37 Q32 54 45 37 Q32 44 19 37 Z",fill:"currentColor",stroke:"currentColor",strokeWidth:1,strokeLinejoin:"round"})]})}function Vi({motionOn:e}){return n.jsxs(n.Fragment,{children:[n.jsx(P,{d:"M17 20 L27 17"}),n.jsx(P,{d:"M33 17 L43 20"}),n.jsx(q,{cx:21,cy:30,motionOn:e}),n.jsx(q,{cx:37,cy:30,motionOn:e}),n.jsx(ce,{cx:14.5,cy:36}),n.jsx(ce,{cx:44.5,cy:36}),n.jsx(Ri,{motionOn:e}),n.jsx("path",{d:"M23 42 Q27.5 39.5 32 42 T41 42",...de,strokeWidth:2.5})]})}function Ui({motionOn:e}){return n.jsxs(n.Fragment,{children:[n.jsxs(b.g,{animate:e?{y:[0,1.4,1.4,0]}:void 0,transition:e?{duration:5,times:[0,.12,.5,.62],repeat:1/0,ease:"easeInOut"}:void 0,children:[n.jsx(P,{d:"M18 15 L29 19.5"}),n.jsx(P,{d:"M35 19.5 L46 15"})]}),n.jsx(q,{cx:24,cy:27,openness:.8,motionOn:e}),n.jsx(q,{cx:40,cy:27,openness:.8,motionOn:e}),n.jsx(Wi,{motionOn:e}),n.jsx("path",{d:"M23 42 L41 42",...de,strokeWidth:3})]})}function Gi({motionOn:e}){return n.jsxs(n.Fragment,{children:[n.jsxs(b.g,{initial:e?{y:7}:void 0,animate:e?{y:0}:void 0,transition:e?{type:"spring",stiffness:420,damping:11,delay:.08}:void 0,children:[n.jsx(P,{d:"M18 14 Q24 10.5 30 14"}),n.jsx(P,{d:"M34 14 Q40 10.5 46 14"})]}),n.jsx(q,{cx:24,cy:26,r:4.5,popIn:!0,motionOn:e}),n.jsx(q,{cx:40,cy:26,r:4.5,popIn:!0,motionOn:e}),n.jsx(b.circle,{cx:32,cy:44,r:4,fill:"none",stroke:"currentColor",strokeWidth:2.5,style:{transformOrigin:"32px 44px"},initial:e?{scale:.2}:void 0,animate:e?{scale:1}:void 0,transition:e?{type:"spring",stiffness:500,damping:12,delay:.14}:void 0})]})}function Ki({motionOn:e}){return n.jsxs(n.Fragment,{children:[n.jsx(P,{d:"M19 20.5 L29 16.5"}),n.jsx(P,{d:"M35 16.5 L45 20.5"}),n.jsx(q,{cx:24,cy:26,motionOn:e}),n.jsx(q,{cx:40,cy:26,motionOn:e}),n.jsx(zi,{motionOn:e}),n.jsx("path",{d:"M20 47 Q32 37.5 44 47",...de,strokeWidth:3})]})}function Hi({motionOn:e}){return n.jsxs(n.Fragment,{children:[n.jsx(P,{d:"M18 17.5 Q24 15 30 17.5"}),n.jsx(P,{d:"M34 17.5 Q40 15 46 17.5"}),n.jsx(kt,{cx:24,cy:27,motionOn:e,pulseDuration:1.5,wobble:3}),n.jsx(kt,{cx:40,cy:27,motionOn:e,pulseDuration:1.9,delay:.35,wobble:-3}),n.jsx(ce,{cx:15,cy:35,opacity:.25}),n.jsx(ce,{cx:49,cy:35,opacity:.25}),n.jsx("path",{d:"M21 40 Q32 48 43 40",...de,strokeWidth:2.5})]})}function Yi({emotion:e,motionOn:t}){switch(e){case"happy":return n.jsx(Pi,{motionOn:t});case"thinking":return n.jsx(Fi,{motionOn:t});case"celebrating":return n.jsx(Bi,{});case"sheepish":return n.jsx(Vi,{motionOn:t});case"determined":return n.jsx(Ui,{motionOn:t});case"surprised":return n.jsx(Gi,{motionOn:t});case"sad":return n.jsx(Ki,{motionOn:t});case"love":return n.jsx(Hi,{motionOn:t})}}const qi={initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1},transition:{type:"spring",stiffness:380,damping:16,mass:.9}},Qi={surprised:{initial:{opacity:0,scale:.4},animate:{opacity:1,scale:[.4,1.14,.94,1.03,1]},transition:{duration:.65,times:[0,.4,.62,.82,1],ease:"easeOut"}},sad:{initial:{opacity:0,scale:.92,y:-3},animate:{opacity:1,scale:1,y:0},transition:{duration:.7,ease:"easeOut"}}},Xi={happy:{animate:{y:[0,-1.5,0]},transition:{duration:2.8,repeat:1/0,ease:"easeInOut"}},thinking:{animate:{rotate:[0,-1.2,0,1.2,0]},transition:{duration:6,repeat:1/0,ease:"easeInOut"}},celebrating:{animate:{y:[0,-4,0,0],scaleY:[1,1.06,.9,1],scaleX:[1,.96,1.08,1]},transition:{duration:1.3,times:[0,.35,.7,1],repeat:1/0,ease:"easeInOut"}},sheepish:{animate:{rotate:[0,-2.5,-2.5,0]},transition:{duration:5,times:[0,.2,.7,1],repeat:1/0,ease:"easeInOut"}},determined:{animate:{scale:[1,1.02,1]},transition:{duration:2.4,repeat:1/0,ease:"easeInOut"}},sad:{animate:{y:[0,2,0],rotate:[0,-1.5,0]},transition:{duration:5,repeat:1/0,ease:"easeInOut"}},love:{animate:{rotate:[0,2.5,0,-2.5,0]},transition:{duration:4,repeat:1/0,ease:"easeInOut"}}};function Ji({node:e}){const t=W(),s=g.useRef(!1),a=g.useRef(null);g.useEffect(()=>{var c;if(e.emotion!=="celebrating"||!t||s.current)return;s.current=!0;const i=(c=a.current)==null?void 0:c.getBoundingClientRect();sa({origin:i?Wt(i):void 0})},[e.emotion,t]);const r=Qi[e.emotion]??qi,o=Xi[e.emotion];return n.jsxs("div",{className:"flex items-center gap-3",role:"img","aria-label":`Mood: ${e.emotion}`,children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(b.div,{initial:t?r.initial:!1,animate:t?r.animate:!1,transition:t?r.transition:void 0,children:n.jsx(b.div,{ref:a,className:"bg-muted text-foreground relative flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-full",animate:t&&o?o.animate:void 0,transition:t&&o?o.transition:void 0,children:n.jsx("svg",{viewBox:"0 0 64 64",className:"size-full","aria-hidden":!0,children:n.jsx(Yi,{emotion:e.emotion,motionOn:t})})})}),e.emotion==="thinking"&&n.jsx(Zi,{motionOn:t})]}),e.message&&n.jsx(b.div,{className:"bg-muted/40 rounded-lg border px-3 py-2 text-sm",initial:t?{opacity:0,x:-4}:!1,animate:t?{opacity:1,x:0}:!1,transition:t?{duration:.3,delay:.15,ease:"easeOut"}:void 0,children:e.message})]})}function Zi({motionOn:e}){return n.jsx("div",{className:"flex items-end gap-1","aria-hidden":!0,children:[0,1,2].map(t=>n.jsx(b.span,{className:"bg-muted-foreground/60 size-1.5 rounded-full",animate:e?{y:[0,-3.5,0],opacity:[.3,1,.3]}:void 0,transition:e?{duration:1.3,repeat:1/0,repeatDelay:.4,delay:t*.16,ease:"easeInOut"}:void 0},t))})}const eo=2,to=5;function St(e){var s;const t=(s=e==null?void 0:e.glyph)==null?void 0:s.trim();return t||null}function no(e,t){var a,r;const s=St((a=e[t[0].row])==null?void 0:a[t[0].col]);if(!s)return null;for(const{row:o,col:i}of t)if(St((r=e[o])==null?void 0:r[i])!==s)return null;return s}function so(e){const t=e.length;if(t<eo||t>to||e.some(a=>a.length!==t))return null;const s=[];for(let a=0;a<t;a++)s.push(Array.from({length:t},(r,o)=>({row:a,col:o}))),s.push(Array.from({length:t},(r,o)=>({row:o,col:a})));s.push(Array.from({length:t},(a,r)=>({row:r,col:r}))),s.push(Array.from({length:t},(a,r)=>({row:r,col:t-1-r})));for(const a of s){const r=no(e,a);if(r)return{glyph:r,cells:a}}return null}function ao(e,t,s){return e!==null&&e.cells.some(a=>a.row===t&&a.col===s)}const ro=new Set(["."," ","-","_"]),Tn=".";function io(e,t){const s=o=>o.map(i=>ro.has(i)?Tn:i),a=[...e];if(a.length===t)return s(a);const r=[...e.trim()];return r.length===t?s(r):null}function oo(e,t){const s=e.split("/");if(s.length!==t.length)return null;const a=[];for(let r=0;r<s.length;r++){const o=io(s[r],t[r].length);if(!o)return null;a.push(o)}return a}function co(e){var s,a;const t=[];for(const r of e)for(const o of r){if(((s=o.action)==null?void 0:s.kind)!=="agent")continue;const i=(a=o.action.payload)==null?void 0:a.state;typeof i=="string"&&i.trim()!==""&&t.push(i)}return t}function lo(e,t){const s=new Map;for(const r of e){const o=oo(r,t);if(!o)continue;const i=o.map(d=>d.join("")).join("/"),c=s.get(i);c?c.count+=1:s.set(i,{parsed:o,count:1})}if(s.size===0)return null;const a=[...s.values()].sort((r,o)=>o.count-r.count);return a.length>1&&a[0].count===a[1].count?null:a[0].parsed}function uo(e){const t=co(e);if(t.length===0)return e;const s=lo(t,e);if(!s)return e;let a=!1;const r=e.map((o,i)=>o.map((c,d)=>{const u=s[i][d];if(c.glyph||c.icon||u===Tn)return c;a=!0;const{action:m,...p}=c;return{...p,glyph:u}}));return a?r:e}const wt=.12,fo=.2,$n="0 0 24 24";function Ln(e){const t=e.trim().toLowerCase();return t==="x"?"x":t==="o"||t==="0"||t==="⭕"||t==="◯"?"o":"glyph"}function po(e){const t=Ln(e);return t==="x"?"text-status-info":t==="o"?"text-status-warning":null}const Pe={className:"stroke-current",fill:"none",strokeWidth:2.75,strokeLinecap:"round"};function mo({motionOn:e,colorClass:t}){const s=a=>({duration:wt,ease:le,delay:a});return n.jsxs("svg",{viewBox:$n,className:E("size-[1.15em]",t),"aria-hidden":!0,focusable:"false",children:[n.jsx(b.path,{...Pe,d:"M7 7 L17 17",initial:e?{pathLength:0}:!1,animate:e?{pathLength:1}:!1,transition:e?s(0):void 0}),n.jsx(b.path,{...Pe,d:"M17 7 L7 17",initial:e?{pathLength:0}:!1,animate:e?{pathLength:1}:!1,transition:e?s(wt):void 0})]})}function ho({motionOn:e,colorClass:t}){return n.jsx("svg",{viewBox:$n,className:E("size-[1.15em]",t),"aria-hidden":!0,focusable:"false",children:n.jsx(b.circle,{...Pe,cx:12,cy:12,r:6.5,transform:"rotate(-90 12 12)",initial:e?{pathLength:0}:!1,animate:e?{pathLength:1}:!1,transition:e?{duration:fo,ease:le}:void 0})})}function go({motionOn:e}){return n.jsx(b.span,{"aria-hidden":!0,className:"bg-foreground/70 block size-[0.5em] rounded-full",initial:e?{scale:0,opacity:0}:!1,animate:e?{scale:1,opacity:1}:!1,transition:e?H:void 0})}function we({mark:e,motionOn:t,colorClass:s}){if(!e.trim())return n.jsx(go,{motionOn:t});const a=Ln(e);return a==="x"?n.jsx(mo,{motionOn:t,colorClass:s}):a==="o"?n.jsx(ho,{motionOn:t,colorClass:s}):n.jsx(b.span,{"aria-hidden":!0,className:E("block leading-none",s),initial:t?{scale:.4,opacity:0}:!1,animate:t?{scale:1,opacity:1}:!1,transition:t?H:void 0,children:e})}function ve(e){if(!e||e.kind!=="agent")return"";const t=e.payload,s=(t==null?void 0:t.glyph)??(t==null?void 0:t.mark);return typeof s=="string"?s:""}function Dn(e){return e.glyph?e.glyph:e.icon?e.icon:"filled"}function On(e){return E("relative flex aspect-square items-center justify-center rounded-md border text-2xl leading-none",e.tone&&Ee(e.tone))}function Ce(e,t){if(!t.tone)return po(e)??void 0}function xo({cell:e,icon:t,motionOn:s,row:a,col:r,winRole:o}){const i=!!(e.glyph||e.icon);return n.jsxs(b.div,{role:"gridcell","aria-label":i?`Row ${a+1}, column ${r+1}: ${Dn(e)}`:void 0,className:E(On(e),o==="loser"&&"opacity-60"),animate:s&&o==="winner"?{scale:[1,1.08,1]}:void 0,transition:s&&o==="winner"?{duration:1.4,repeat:1/0,ease:"easeInOut",delay:.6}:void 0,children:[e.glyph&&n.jsx(we,{mark:e.glyph,motionOn:s,colorClass:Ce(e.glyph,e)}),!e.glyph&&t&&n.jsx(t,{className:"size-6","aria-hidden":!0})]})}function yo({cell:e,icon:t,motionOn:s,row:a,col:r,winRole:o}){const{onAction:i,channel:c}=ge(),u=`${Z()}.rows.${a}.${r}`,m=e.action.kind==="emit"||e.action.kind==="agent"&&c!==void 0,p=Sn(e.action,u),v=p.isDispatched?ve(e.action):null,k=p.interactive&&e.action.kind==="agent"&&!!ve(e.action),S=!p.interactive,j=()=>{if(!p.interactive)return;const C=i(e.action,{controlId:u});e.action.kind!=="agent"&&e.action.kind!=="emit"||C.catch(()=>{Pt.error("Couldn’t send the move",{description:m?"Check the action size and document permissions, then try again.":"Your agent may be busy. Try again."})})},A=(()=>{const C=`Row ${a+1}, column ${r+1}`;return p.isDispatched?`${C}: ${v||"played"}`:e.glyph||e.icon?`${C}: ${Dn(e)}`:p.interactive?`${C}: empty, play here`:`${C}: empty`})();let _=null;p.superseded?_="This board is from an earlier turn. Play on the newest one.":p.unavailable?_=m?"This document action is not available or needs approval.":"Interactions aren’t available here":p.latched&&(_="Move sent. Waiting for the agent’s reply");const N=n.jsxs(b.button,{type:"button","aria-label":A,"aria-disabled":S||void 0,onClick:S?void 0:j,className:E(On(e),"group focus-ring w-full transition-colors",p.interactive&&"hover:bg-muted/60 cursor-pointer",S&&"cursor-default",o==="loser"&&"opacity-60"),whileHover:p.interactive?{scale:1.05}:void 0,whileTap:p.interactive?{scale:.95}:void 0,transition:H,children:[k&&n.jsx("span",{className:"pointer-events-none absolute inset-0 flex items-center justify-center text-2xl opacity-0 transition-opacity duration-150 group-hover:opacity-20",children:n.jsx(we,{mark:ve(e.action),motionOn:!1,colorClass:Ce(ve(e.action),e)})}),n.jsx(bo,{cell:e,optimisticMark:v,icon:t,motionOn:s})]});return n.jsx(b.div,{role:"gridcell",animate:s&&o==="winner"?{scale:[1,1.08,1]}:void 0,transition:s&&o==="winner"?{duration:1.4,repeat:1/0,ease:"easeInOut",delay:.6}:void 0,children:_?n.jsx(Dt,{children:n.jsxs(Ot,{children:[n.jsx(Rt,{asChild:!0,children:N}),n.jsx(zt,{children:_})]})}):N})}function bo({cell:e,optimisticMark:t,icon:s,motionOn:a}){return t!==null?n.jsx(we,{mark:t,motionOn:a,colorClass:Ce(t,e)}):e.glyph?n.jsx(we,{mark:e.glyph,motionOn:a,colorClass:Ce(e.glyph,e)}):s?n.jsx(s,{className:"size-6","aria-hidden":!0}):null}function vo(e){return e.cell.action?n.jsx(yo,{...e,cell:e.cell}):n.jsx(xo,{...e})}const Ct=.28,jo=.3,ko=.12,No=.8;function je(e,t,s){return e*(t+s)+t/2}function So({win:e,size:t,cellUnit:s,gapUnit:a,colorClass:r,motionOn:o}){const i=t*s+(t-1)*a,c=e.cells[0],d=e.cells[e.cells.length-1],u=je(c.col,s,a),m=je(c.row,s,a),p=je(d.col,s,a),v=je(d.row,s,a);return n.jsx("svg",{viewBox:`0 0 ${i} ${i}`,className:E("pointer-events-none absolute inset-0 h-full w-full",r),"aria-hidden":!0,focusable:"false",children:n.jsx(b.line,{x1:u,y1:m,x2:p,y2:v,className:"stroke-current",strokeWidth:s*ko,strokeOpacity:No,strokeLinecap:"round",initial:o?{pathLength:0,opacity:0}:!1,animate:o?{pathLength:1,opacity:1}:!1,transition:o?{pathLength:{duration:jo,ease:le,delay:Ct},opacity:{duration:.12,delay:Ct}}:void 0})})}const wo={},Co=.02,Ao={hidden:{},visible:{transition:{staggerChildren:Co}}};function Mo(e,t,s,a){return e?ao(e,t,s)?"winner":a.glyph?"loser":"none":"none"}const _o=4,Eo=3.25,Io=2.5,To=.25,$o={default:"text-status-success",success:"text-status-success",warning:"text-status-warning",error:"text-status-error",info:"text-status-info"};function Lo({node:e}){var k,S;const t=W(),{latched:s,superseded:a,channel:r}=ge(),o=Z(),i=uo(e.rows),c=Math.max(1,...i.map(j=>j.length)),d=c<=_o?Eo:Io,u=so(i),m=u?((S=(k=i[u.cells[0].row])==null?void 0:k[u.cells[0].col])==null?void 0:S.tone)??"default":"default",p=$o[m],v=s&&!a;return n.jsxs("div",{className:"flex flex-col gap-1.5",children:[r&&n.jsxs("p",{className:"text-muted-foreground text-xs",children:["To ",r.destinationLabel]}),e.label&&n.jsx("p",{className:"text-muted-foreground text-xs",children:e.label}),n.jsxs("div",{className:E("relative w-fit",a&&"saturate-[0.9]"),children:[v&&n.jsx(b.div,{"aria-hidden":!0,className:"ring-primary/40 pointer-events-none absolute -inset-1 rounded-lg ring-2",initial:t?{opacity:.25}:!1,animate:t?{opacity:[.25,.6,.25]}:{opacity:.4},transition:t?{duration:2,repeat:1/0,ease:"easeInOut"}:void 0}),n.jsx(b.div,{role:"grid","aria-label":e.label??"Board",className:"grid w-fit gap-1",style:{gridTemplateColumns:`repeat(${c}, minmax(0, ${d}rem))`},variants:t?Ao:void 0,initial:t?"hidden":!1,animate:t?"visible":!1,children:i.map((j,A)=>n.jsx("div",{role:"row",className:"contents",children:Array.from({length:c},(_,N)=>{const C=j[N]??wo,l=!C.glyph&&C.icon?qe(C.icon):null,f=Mo(u,A,N,C);return n.jsx(vo,{cell:C,icon:l,motionOn:t,row:A,col:N,winRole:f},`${A}-${N}`)})},A))}),u&&n.jsx(So,{win:u,size:c,cellUnit:d,gapUnit:To,colorClass:p,motionOn:t})]}),n.jsx(_n,{controlId:o,descendants:!0})]})}const Do=1.2,Oo={coin:"rounded-full bg-status-warning-bg border-status-warning-border text-status-warning-fg",d6:"rounded-xl bg-muted border-border text-foreground",d20:"rounded-xl bg-muted border-border text-foreground","8ball":"rounded-full bg-foreground border-foreground text-background"},Ro=[Ha,Ya,qa,Qa,Xa,Ja];function zo(e){const t={duration:Do,ease:"easeOut"};switch(e){case"coin":return{animate:{rotateY:[0,360,720,1080]},transition:t};case"d6":case"d20":return{animate:{rotate:[0,-15,15,-10,10,0],x:[0,-2,2,-2,2,0]},transition:t};case"8ball":return{animate:{x:[0,-6,6,-4,4,-2,2,0]},transition:t}}}function Wo({kind:e,result:t}){switch(e){case"coin":return n.jsx(Ga,{className:"size-7","aria-hidden":!0});case"8ball":return n.jsx("span",{"aria-hidden":!0,children:"8"});case"d20":return n.jsx("svg",{viewBox:"0 0 24 24",className:"size-7","aria-hidden":!0,children:n.jsx("polygon",{points:"12,2 21,8 21,16 12,22 3,16 3,8",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round"})});case"d6":{const s=Number(t),a=Number.isInteger(s)&&s>=1&&s<=6?Ro[s-1]:Za;return n.jsx(a,{className:"size-7","aria-hidden":!0})}}}function Po({node:e}){const t=W(),[s,a]=g.useState(0),[r,o]=g.useState(!t),{animate:i,transition:c}=zo(e.kind);return n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{type:"button","aria-label":`Replay the ${e.kind} reveal`,onClick:()=>{t&&(o(!1),a(d=>d+1))},className:E("focus-ring flex size-16 shrink-0 items-center justify-center border-2 text-lg font-bold",Oo[e.kind]),children:n.jsx(b.span,{className:"flex items-center justify-center",initial:t?{rotate:0,x:0,rotateY:0}:!1,animate:t?i:!1,transition:t?c:void 0,onAnimationComplete:()=>o(!0),children:n.jsx(Wo,{kind:e.kind,result:e.result})},s)}),n.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.label&&n.jsx("span",{className:"text-muted-foreground text-xs",children:e.label}),n.jsx(b.span,{"aria-live":"polite",className:"text-foreground text-lg font-semibold tabular-nums",initial:t?{opacity:0,scale:1.3}:!1,animate:r?{opacity:1,scale:1}:{opacity:0,scale:1.3},transition:H,children:r?e.result:""})]})]})}const Fo={sm:"gap-2",md:"gap-3",lg:"gap-5"};function he({node:e,path:t="root"}){return n.jsx(Lr,{value:t,children:n.jsx(Bo,{node:e})})}function Bo({node:e}){const t=cr();if(t===void 0&&"bind"in e&&e.bind!==void 0&&Object.keys(e.bind).length>0)return n.jsx("p",{role:"status",className:"text-muted-foreground text-xs",children:"Waiting for document state."});const s=Br(e,t==null?void 0:t.state);if(s.error!==void 0)return n.jsx("p",{role:"status",className:"text-muted-foreground text-xs",children:s.error});const a=s.node;switch(a.type){case"stack":return n.jsx(Vo,{node:a});case"card":return n.jsx(Uo,{node:a});case"form":return n.jsx(Go,{node:a});case"divider":return n.jsx(Xr,{});case"heading":return n.jsx(Yr,{node:a});case"text":return n.jsx(qr,{node:a});case"badge":return n.jsx(Qr,{node:a});case"stat":return n.jsx(ei,{node:a});case"keyValue":return n.jsx(ni,{node:a});case"progress":return n.jsx(si,{node:a});case"image":return n.jsx(ai,{node:a});case"table":return n.jsx(ci,{node:a});case"list":return n.jsx(mi,{node:a});case"chart":return n.jsx(yi,{node:a});case"timeline":return n.jsx(Ci,{node:a});case"checklist":return n.jsx(Ai,{node:a});case"compare":return n.jsx(Ii,{node:a});case"rating":return n.jsx($i,{node:a});case"mood":return n.jsx(Ji,{node:a});case"board":return n.jsx(Lo,{node:a});case"reveal":return n.jsx(Po,{node:a});case"button":return n.jsx(ui,{node:a});case"input":return n.jsx(fi,{node:a});case"select":return n.jsx(pi,{node:a});default:return n.jsx(Ko,{nodeType:a.type})}}function Vo({node:e}){const t=Z();return n.jsx("div",{className:E("flex",e.direction==="horizontal"?"flex-row flex-wrap items-start":"flex-col",Fo[e.gap??"md"]),children:e.children.map((s,a)=>n.jsx(he,{path:`${t}.children.${a}`,node:s},a))})}function Uo({node:e}){const t=Z(),s=!!(e.title||e.description);return n.jsxs(Ft,{className:"shadow-soft",children:[s&&n.jsxs(ra,{children:[e.title&&n.jsx(ia,{children:e.title}),e.description&&n.jsx(oa,{children:e.description})]}),n.jsx(ca,{children:e.children.map((a,r)=>n.jsx(he,{path:`${t}.children.${r}`,node:a},r))}),e.footer&&e.footer.length>0&&n.jsx(la,{children:e.footer.map((a,r)=>n.jsx(he,{path:`${t}.footer.${r}`,node:a},r))})]})}function Go({node:e}){const t=Z(),[s,a]=g.useState({}),r=g.useCallback((c,d)=>{a(u=>({...u,[c]:d}))},[]),o=g.useMemo(()=>({values:s,setValue:r}),[s,r]),i=g.useMemo(()=>e.submit.action.kind==="emit"?{...e.submit.action,payload:{...e.submit.action.payload??{},...s}}:{...e.submit.action,payload:{...e.submit.action.payload??{},...s}},[e.submit.action,s]);return n.jsxs("form",{onSubmit:c=>c.preventDefault(),className:"flex flex-col gap-3",children:[n.jsx(Vr,{value:o,children:e.children.map((c,d)=>n.jsx(he,{path:`${t}.children.${d}`,node:c},d))}),n.jsx(Ie,{action:i,label:e.submit.label,controlId:`${t}.submit`,submit:!0,fullWidth:!0})]})}function Ko({nodeType:e}){return n.jsxs("div",{className:"text-muted-foreground rounded-md border border-dashed p-2 text-xs",children:["Unsupported widget element",e?`: ${e}`:""]})}function ac({document:e,sessionId:t,isLatestMessage:s,channel:a}){const r=W();return n.jsx(Dr,{channel:a,sessionId:t,widgetTitle:e.title,isLatestMessage:s,children:n.jsx(or,{value:a==null?void 0:a.snapshot,children:n.jsx(b.section,{"aria-label":e.title??"Widget",className:"text-sm",variants:r?xe:void 0,initial:r?"hidden":!1,animate:r?"visible":!1,children:n.jsx(he,{node:e.root})})})})}function Ho(e,t){const s=Er.safeParse(e);if(!s.success){const a=s.error.issues[0],r=(a==null?void 0:a.path.join("."))??"";return{ok:!1,error:a?`${r?`${r}: `:""}${a.message}`:"The widget isn’t in a shape DorkOS knows",raw:t??Yo(e)}}return{ok:!0,document:s.data}}function rc(e){let t;try{t=JSON.parse(e)}catch(s){return{ok:!1,error:s instanceof Error?s.message:"The widget isn’t readable JSON",raw:e}}return Ho(t,e)}function Yo(e){try{return JSON.stringify(e,null,2)??String(e)}catch{return String(e)}}function ic({error:e,raw:t}){const[s,a]=g.useState(!1);return n.jsx(Ft,{gap:"none",className:"p-3 text-sm",children:n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx($t,{className:"text-muted-foreground mt-0.5 size-4 shrink-0","aria-hidden":!0}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:"font-medium",children:"Couldn’t show this widget"}),n.jsx("p",{className:"text-muted-foreground mt-0.5 text-xs break-words",children:e}),n.jsxs("button",{type:"button",onClick:()=>a(r=>!r),"aria-expanded":s,className:"text-muted-foreground hover:text-foreground focus-visible:ring-ring mt-2 inline-flex items-center gap-1 rounded text-xs focus-visible:ring-2 focus-visible:outline-none",children:[n.jsx(aa,{className:E("size-3 transition-transform",s&&"rotate-90")}),s?"Hide":"Show"," raw JSON"]}),s&&n.jsx("pre",{className:"bg-muted text-muted-foreground mt-2 max-h-64 overflow-auto rounded-md p-2 text-xs",children:n.jsx("code",{children:t})})]})]})})}export{ic as W,ac as a,H as b,rc as p,W as u,Ho as v};
|
|
108
|
+
`)}const ur=K(["default","success","warning","error","info"]),yn=y({kind:_("agent"),id:h().min(1),label:h().optional(),payload:Mt(h(),cs()).optional()}),bn=y({kind:_("emit"),type:ls,payload:ds.optional(),coalesceKey:h().min(1).max(128).optional()}).strict(),ut=Be("kind",[yn,bn]),Re=Be("kind",[yn,bn,y({kind:_("ui"),command:os}),y({kind:_("url"),href:h().url().refine(e=>e.startsWith("https://"),{message:"Widget URLs must be https"})})]),ft=Ae([h(),Fe(),Se(),is()]),fr=["sm","md","lg"],pt={sm:4,md:12};function pr(e){const t=typeof e=="number"?e:typeof e=="string"&&e.trim()!==""&&!Number.isNaN(Number(e))?Number(e):null;if(t!==null)return t<=pt.sm?"sm":t<=pt.md?"md":"lg";if(typeof e=="string"){const s=e.trim().toLowerCase();if(s==="none"||s==="xs"||s==="small"||s==="sm")return"sm";if(s==="medium"||s==="normal"||s==="md")return"md";if(s==="large"||s==="xl"||s==="xxl"||s==="lg")return"lg"}return e}const mr=z(pr,K(fr));function J(e){return t=>{if(typeof t!="string")return t;const s=t.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(e,s)?e[s]:t}}const Ke=z(J({default:"default",neutral:"default",muted:"default",normal:"default",gray:"default",grey:"default",success:"success",ok:"success",okay:"success",good:"success",positive:"success",done:"success",complete:"success",completed:"success",green:"success",warning:"warning",warn:"warning",caution:"warning",pending:"warning",yellow:"warning",orange:"warning",error:"error",danger:"error",critical:"error",fail:"error",failed:"error",failure:"error",negative:"error",blocked:"error",red:"error",info:"info",information:"info",note:"info",blue:"info"}),ur),hr=z(J({vertical:"vertical",vert:"vertical",column:"vertical",col:"vertical",stack:"vertical",horizontal:"horizontal",horiz:"horizontal",row:"horizontal",inline:"horizontal"}),K(["vertical","horizontal"])),gr=z(J({default:"default",primary:"default",secondary:"secondary",destructive:"destructive",danger:"destructive",delete:"destructive",outline:"outline",ghost:"outline",link:"outline"}),K(["default","secondary","destructive","outline"])),xr=z(J({bar:"bar",bars:"bar",column:"bar",columns:"bar",histogram:"bar",line:"line",lines:"line",area:"area",pie:"pie",donut:"pie",doughnut:"pie"}),K(["bar","line","area","pie"])),yr=z(J({up:"up",increase:"up",increased:"up",positive:"up",rise:"up",rising:"up",gain:"up",down:"down",decrease:"down",decreased:"down",negative:"down",fall:"down",falling:"down",drop:"down",loss:"down",flat:"flat",none:"flat",neutral:"flat",same:"flat",unchanged:"flat",steady:"flat"}),K(["up","down","flat"])),br=z(e=>{const t=typeof e=="number"?e:typeof e=="string"&&e.trim()!==""&&!Number.isNaN(Number(e))?Number(e):null;return t===null?e:Math.min(3,Math.max(1,Math.round(t)))},Ae([_(1),_(2),_(3)])),vr=z(e=>typeof e=="string"?{value:e,direction:"flat"}:typeof e=="number"?{value:e,direction:e>0?"up":e<0?"down":"flat"}:e,y({value:Ae([h(),Fe()]),direction:yr.default("flat")})),jr=z(e=>typeof e=="string"?{text:e}:e,y({text:h(),tone:Ke.optional()})),kr=z(J({done:"done",complete:"done",completed:"done",finished:"done",past:"done",active:"active",current:"active",now:"active","in-progress":"active",in_progress:"active",inprogress:"active",ongoing:"active",upcoming:"upcoming",pending:"upcoming",next:"upcoming",todo:"upcoming",future:"upcoming",planned:"upcoming"}),K(["done","active","upcoming"])),mt=z(e=>{if(typeof e=="number")return e===1?!0:e===0?!1:e;if(typeof e=="string"){const t=e.trim().toLowerCase();if(t==="true"||t==="yes"||t==="checked")return!0;if(t==="false"||t==="no"||t==="unchecked")return!1}return e},Se()),Nr=z(J({happy:"happy",proud:"happy",joy:"happy",joyful:"happy",glad:"happy",thinking:"thinking",confused:"thinking",pondering:"thinking",curious:"thinking",hmm:"thinking",celebrating:"celebrating",excited:"celebrating",party:"celebrating",hyped:"celebrating",sheepish:"sheepish",embarrassed:"sheepish",oops:"sheepish",awkward:"sheepish",shy:"sheepish",determined:"determined",focused:"determined",serious:"determined",resolute:"determined",surprised:"surprised",shocked:"surprised",wow:"surprised",amazed:"surprised","mind-blown":"surprised",sad:"sad",unhappy:"sad",disappointed:"sad",down:"sad",love:"love",heart:"love",hearts:"love",adore:"love"}),K(["happy","thinking","celebrating","sheepish","determined","surprised","sad","love"])),Sr=z(J({coin:"coin",flip:"coin",coinflip:"coin",d6:"d6",dice:"d6",die:"d6",d20:"d20","8ball":"8ball",magic8ball:"8ball","8-ball":"8ball",eightball:"8ball","magic-8-ball":"8ball"}),K(["coin","d6","d20","8ball"])),wr=z(e=>typeof e=="number"?String(e):e,h()),ht=12;function Cr(e){return typeof e!="string"?e:e.trim()===""?{}:{glyph:e}}const Ar=h().max(8).optional().transform(e=>{const t=e==null?void 0:e.trim();return t||void 0}),_r=z(Cr,y({glyph:Ar,icon:h().optional(),tone:Ke.optional(),action:Re.optional()})),Mr=z(e=>Array.isArray(e)?e.slice(0,ht).map(t=>Array.isArray(t)?t.slice(0,ht):t):e,L(L(_r))),ee={text:y({text:re.optional()}).strict(),stat:y({value:re.optional()}).strict(),progress:y({value:re.optional(),label:re.optional()}).strict(),table:y({rows:re.optional()}).strict(),chart:y({data:re.optional()}).strict()},pe=as(()=>z((e,t)=>{if(typeof e=="object"&&e!==null&&Object.hasOwn(e,"bind")){const s=e,a=typeof s.type=="string"&&Object.hasOwn(ee,s.type)?ee[s.type]:void 0;if(!a||!a.safeParse(s.bind).success)return t.addIssue({code:"custom",path:["bind"],message:"This element needs a supported display field and a safe state path."}),rs}return e},Be("type",[y({type:_("stack"),direction:hr,gap:mr.optional(),children:L(pe)}),y({type:_("card"),title:h().optional(),description:h().optional(),children:L(pe),footer:L(pe).optional()}),y({type:_("divider")}),y({type:_("heading"),text:h(),level:br.optional()}),y({type:_("text"),text:h(),bind:ee.text.optional()}),y({type:_("badge"),text:h(),tone:Ke.optional()}),y({type:_("stat"),bind:ee.stat.optional(),label:h(),value:Ae([h(),Fe()]),delta:vr.optional(),hint:h().optional(),trend:L(ae().finite()).max(50).optional()}),y({type:_("keyValue"),items:L(y({key:h(),value:h()}))}),y({type:_("image"),src:h().refine(e=>e.startsWith("https://")||e.startsWith("data:"),{message:"Widget image sources must be https or data URIs"}),alt:h(),caption:h().optional()}),y({type:_("progress"),bind:ee.progress.optional(),value:ae().finite().transform(e=>Math.min(100,Math.max(0,e))),label:h().optional()}),y({type:_("table"),bind:ee.table.optional(),columns:L(y({key:h(),label:h(),align:K(["left","center","right"]).optional()})),rows:L(Mt(h(),ft))}),y({type:_("list"),items:L(y({title:h(),subtitle:h().optional(),icon:h().optional(),image:h().refine(e=>e.startsWith("https://")||e.startsWith("data:"),{message:"Widget image sources must be https or data URIs"}).optional(),meta:h().optional(),badge:jr.optional(),actions:L(Re).optional()}))}),y({type:_("chart"),bind:ee.chart.optional(),kind:xr,data:L(y({label:h(),value:ae().finite().min(0)})),height:ae().finite().positive().optional()}),y({type:_("button"),label:h(),variant:gr.optional(),action:Re}),y({type:_("input"),name:h().min(1),label:h().optional(),placeholder:h().optional(),kind:K(["text","number"]).optional(),required:Se().optional()}),y({type:_("select"),required:Se().optional(),name:h().min(1),label:h().optional(),options:L(y({label:h(),value:h()}))}),y({type:_("form"),children:L(pe),submit:y({label:h(),action:ut})}),y({type:_("timeline"),items:L(y({time:h().optional(),title:h(),subtitle:h().optional(),icon:h().optional(),status:kr.optional()})).min(1)}),y({type:_("checklist"),items:L(y({label:h(),checked:mt.optional(),note:h().optional()})),action:ut.optional(),submitLabel:h().optional()}),y({type:_("compare"),options:L(y({name:h(),recommended:mt.optional()})).min(1),rows:L(y({label:h(),values:L(ft)}))}),y({type:_("rating"),value:ae().finite().transform(e=>Math.min(5,Math.max(0,e))),count:ae().int().nonnegative().optional(),label:h().optional()}),y({type:_("mood"),emotion:Nr,message:h().optional()}),y({type:_("board"),rows:Mr,label:h().optional()}),y({type:_("reveal"),kind:Sr,result:wr,label:h().optional()})]))),Er=y({version:_(1),title:h().optional(),root:pe});function ze(e){return e.some(t=>fs(t,"widget.action"))}const Ir=100,Tr=3e4;function vn(e){if(e!==null&&typeof e=="object"){for(const t of Object.values(e))vn(t);Object.freeze(e)}return e}function $r(e,t){var C;const[s,a]=g.useState([]),r=g.useRef(new Map),o=g.useRef(e),i=g.useRef({documentId:e==null?void 0:e.documentId,owner:e==null?void 0:e.submissionOwner}),c=g.useRef(!0),d=g.useRef(0),u=g.useCallback(()=>{const l=++d.current,f=[...r.current.values()].map(x=>x.value);a(x=>d.current===l?f:x)},[]),m=g.useCallback(l=>{const f=l.operation;l.operation=void 0,f&&(f.active=!1,clearTimeout(f.timer),f.controller.abort())},[]),p=g.useCallback(l=>{l.retired=!0,l.start=void 0,++d.current,m(l)},[m]),v=g.useCallback(l=>c.current&&!l.retired&&r.current.get(l.value.event.id)===l,[]),k=g.useCallback(l=>{const f=o.current;return i.current.documentId===l.value.documentId&&i.current.owner===l.owner&&(f==null?void 0:f.documentId)===l.value.documentId&&(f==null?void 0:f.submissionOwner)===l.owner},[]),S=g.useCallback((l,f)=>{if(!v(l)||!k(l))return!1;const x=o.current;return!(l.host.current?l.host.current(f):x.enabled)||!v(l)||!k(l)?!1:l.original.current(f)&&v(l)&&k(l)},[v,k]);g.useLayoutEffect(()=>{const l={documentId:e==null?void 0:e.documentId,owner:e==null?void 0:e.submissionOwner};o.current=e,i.current=l;for(const f of r.current.values())k(f)||p(f)},[e,e==null?void 0:e.documentId,e==null?void 0:e.submissionOwner,k,p]),g.useEffect(()=>{c.current=!0;const l=r.current;return()=>{c.current=!1;for(const f of l.values())p(f)}},[p]);const j=g.useCallback((l,f)=>{l.value={...l.value,...f},u()},[u]);g.useEffect(()=>{var l;for(const f of r.current.values()){if(!v(f)||!k(f)||f.value.phase==="refused")continue;const x=f.start,T=f.operation;if(!S(f,"read")||f.start!==x||f.operation!==T)continue;const R=(l=e==null?void 0:e.snapshot)==null?void 0:l.receipts.find(w=>w.receipt.id===f.value.event.id);!S(f,"read")||f.start!==x||f.operation!==T||R&&R!==f.value.receipt&&(f.start=void 0,f.value={...f.value,phase:"accepted",receipt:R},m(f),u())}},[(C=e==null?void 0:e.snapshot)==null?void 0:C.receipts,e==null?void 0:e.submissionOwner,v,k,S,m,u]);const A=l=>[...r.current.values()].some(f=>f.value.controlId===l&&!f.retired&&["sending","retry","review"].includes(f.value.phase)),M=async(l,f=!1)=>{var Y;if(!v(l)||!k(l))return;const x=Object.freeze({});l.start=x,++d.current,m(l);const T=()=>v(l)&&k(l)&&l.start===x&&l.operation===void 0;if(!T())return;const R=S(l,f?"read":"submit");if(!T())return;if(!R){j(l,{phase:f?"retry":"refused",message:f?"Save not confirmed. Review the document before trying again.":"Document actions are unavailable. Review this action before trying again."});return}const w=new AbortController;if(!T()){w.abort();return}const O={token:Object.freeze({}),controller:w,active:!0};l.operation=O,l.start=void 0;const I=()=>v(l)&&k(l)&&l.operation===O&&O.active&&!w.signal.aborted,B=V=>I()?S(l,V)&&I():!1;if(O.timer=setTimeout(()=>{I()&&(O.active=!1,l.operation=void 0,l.uncertain=!0,j(l,{phase:"retry",message:"Save not confirmed. Check your network and try again."}),w.abort())},Tr),!I()){clearTimeout(O.timer),w.abort();return}j(l,{phase:"sending",message:void 0});try{if(f)try{if(!B("read")){I()&&j(l,{phase:"retry",message:"Save not confirmed. Review the document before trying again."});return}const $=await l.original.inspect(w.signal);if(!B("read")){I()&&j(l,{phase:"retry",message:"Save not confirmed. Review the document before trying again."});return}j(l,{phase:"accepted",receipt:$});return}catch($){if(!I()||!I())return;throw $}if(!B("submit")){I()&&j(l,{phase:"review",message:"Document approval changed. Review this action before trying again."});return}const V=[...((Y=o.current)==null?void 0:Y.approvedEventTypes)??[]],U=!l.value.normalized||ze(V);if(!I())return;if(!U){j(l,{phase:"review",message:"Document approval changed. Review this action before trying again."});return}if(!B("submit"))return;l.uncertain=!0;const G=await l.original.submit(w.signal);if(!B("read")){I()&&j(l,{phase:"retry",message:"Save not confirmed. Review the document before trying again."});return}j(l,{phase:"accepted",receipt:G})}catch(V){if(!I())return;const U=V.status;if(!I())return;const G=U!==void 0&&[400,401,403,404,409,413,422].includes(U),$=!f&&G;l.uncertain=f||!$,j(l,{phase:$?"refused":G?"review":"retry",message:$?"This action could not be saved. Review the document before trying again.":G?"Save not confirmed. Review this action before trying again.":"Save not confirmed. Check your network and try again."})}finally{l.operation===O&&(l.operation=void 0,O.active=!1,clearTimeout(O.timer),w.abort())}};return{dispatch:async(l,f)=>{var U;const x=o.current;if(!(x!=null&&x.enabled)||A(f))return;const T=l.kind==="agent";if(T&&!ze(x.approvedEventTypes)||l.kind!=="emit"&&!T)return;const R=us.parse({v:1,id:crypto.randomUUID(),type:T?"widget.action":l.type,payload:T?{actionId:l.id,payload:l.payload??{},widget:{documentId:x.documentId,nodeId:f,...t?{title:t}:{}}}:{...l.payload??{},widget:{documentId:x.documentId,nodeId:f,...t?{title:t}:{}}},...!T&&l.coalesceKey?{coalesceKey:l.coalesceKey}:{}}),w=JSON.stringify(R),O=x.documentId,I=x.submissionOwner,B=(U=x.captureOriginal)==null?void 0:U.call(x,R);if(!B||B.id!==R.id||B.bytes!==w||!c.current||o.current!==x||x.documentId!==O||x.submissionOwner!==I||!B.current("submit")||!c.current||o.current!==x||x.documentId!==O||x.submissionOwner!==I)return;const Y={...x.current?{current:x.current.bind(x)}:{}};if(!c.current||o.current!==x||A(f))return;if(r.current.size>=Ir){const G=[...r.current.values()].find($=>{var F;return $.value.phase==="refused"||$.value.phase==="accepted"&&((F=$.value.receipt)==null?void 0:F.deliveries.every(ye=>["handled","rejected","turn_done","expired","failed","cancelled","superseded","unavailable"].includes(ye.status)))});if(!G)throw new Error("Too many actions are waiting. Try again after they finish.");if(r.current.delete(G.value.event.id),p(G),!c.current||o.current!==x||A(f))return}const V={host:Y,owner:x.submissionOwner,original:B,retired:!1,uncertain:!1,value:{controlId:f,documentId:x.documentId,normalized:T,event:vn(JSON.parse(w)),phase:"sending"}};r.current.set(R.id,V),u(),await M(V)},pending:A,records:s,retry:l=>{const f=r.current.get(l);return f&&f.uncertain&&(f.value.phase==="retry"||f.value.phase==="sending")?M(f,!0):Promise.resolve()}}}const jn=g.createContext("root"),Dr=jn.Provider;function Z(){return g.useContext(jn)}function kn(e){return e.id+":"+JSON.stringify(e.payload??null)}const gt=()=>Promise.resolve(),Nn=g.createContext({onAction:gt,hasSession:!1,channelRecords:[],channelPending:()=>!1,retryChannel:gt,superseded:!1,latched:!1,dispatchedActionKey:null,dispatchStatus:"idle"});function Lr({children:e,channel:t,sessionId:s,widgetTitle:a,isLatestMessage:r=!0}){const{setTheme:o}=ps(),i=ms(),c=$r(t,a),[d,u]=g.useState(null),[m,p]=g.useState(null),v=g.useRef(!1),k=g.useCallback(async(j,A)=>{if(j.kind==="emit"||t&&j.kind==="agent"){await c.dispatch(j,(A==null?void 0:A.controlId)??"root");return}switch(j.kind){case"ui":{if(!s&&!Et(j.command))return;const M={getStore:gs.getState,setTheme:o,supportsTerminal:i.supportsTerminal,celebrationOrigin:A==null?void 0:A.origin,sessionId:s};xs(M,j.command,"user");return}case"url":u(j.href);return;case"agent":{if(!s||v.current)return;v.current=!0;const M={actionId:j.id,payload:j.payload,widgetTitle:a},N=Te.getState();N.setOptimisticUserMessage(s,{id:crypto.randomUUID(),content:dr(M)}),N.setTriggerPending(s,!0);const C=kn(j);p({key:C,status:"pending"});try{await i.sendUiAction(s,M),p({key:C,status:"sent"}),setTimeout(()=>{var f;const l=Te.getState().getSession(s);l.triggerPending&&((f=l.status)==null?void 0:f.lifecycle)!=="streaming"&&Te.getState().setTriggerPending(s,!1)},hs.TRIGGER_PENDING_TIMEOUT_MS)}catch(l){throw v.current=!1,N.setOptimisticUserMessage(s,null),N.setTriggerPending(s,!1),p(null),l}return}}},[o,i,s,a,t,c]),S=g.useMemo(()=>({onAction:k,channel:t,channelRecords:c.records,channelPending:c.pending,retryChannel:c.retry,hasSession:!!s,superseded:!r,latched:m!==null,dispatchedActionKey:(m==null?void 0:m.key)??null,dispatchStatus:(m==null?void 0:m.status)??"idle"}),[k,s,r,m,t,c]);return n.jsxs(Nn.Provider,{value:S,children:[e,n.jsx(ys,{url:d??"",isOpen:d!==null,onClose:()=>u(null),onConfirm:()=>{d&&bs(d),u(null)}})]})}function ge(){return g.useContext(Nn)}function Sn(e,t){var N;const s=Z(),a=ge();if(e.kind==="emit"||e.kind==="agent"&&a.channel!==void 0){const C=!((N=a.channel)!=null&&N.enabled)||e.kind==="agent"&&!ze(a.channel.approvedEventTypes),l=a.channelPending(t??s);return{isAgent:!1,unavailable:C,superseded:!1,latched:!1,isDispatched:l,dispatchStatus:l?"pending":"idle",interactive:!C&&!l}}const{hasSession:o,superseded:i,latched:c,dispatchedActionKey:d,dispatchStatus:u}=a,m=e.kind==="agent",p=e.kind==="agent"?kn(e):null,v=p!==null&&p===d,S=(m||e.kind==="ui"&&!Et(e.command))&&!o,j=m&&i;return{isAgent:m,unavailable:S,superseded:j,latched:m&&c&&!v,isDispatched:v,dispatchStatus:v?u:"idle",interactive:m?!S&&!j&&!c:!S}}const H={type:"spring",stiffness:400,damping:32,mass:.8},le=[.22,1,.36,1],He=.05,Ye=.9,xe={hidden:{opacity:0,y:6,scale:.985},visible:{opacity:1,y:0,scale:1,transition:H}},Me={hidden:{},visible:{transition:{staggerChildren:He}}};function W(){return!vs()}function wn(e,t,s=Ye*1e3){const[a,r]=g.useState(()=>t?0:e),o=g.useRef(t?0:e);return g.useEffect(()=>{if(!t){o.current=e;return}const i=Wa(o.current,e,{duration:s/1e3,ease:le,onUpdate:c=>{o.current=c,r(c)}});return()=>i.stop()},[e,t,s]),t?a:e}const Cn=new Set(["__proto__","prototype","constructor"]),Or={text:["text"],stat:["value"],progress:["value","label"],table:["rows"],chart:["data"]},Rr=100,xt=50,zr=16384;function oe(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Q(e,t){const s=Object.getOwnPropertyDescriptor(e,t);if(!s||!("value"in s))throw new Error("missing");return s.value}function Wr(e,t){if(!oe(e)||!js.safeParse(t).success)throw new Error("path");let s=e;if(t==="")return s;for(const a of t.slice(1).split("/")){const r=a.replaceAll("~1","/").replaceAll("~0","~");if(Cn.has(r))throw new Error("path");if(Array.isArray(s)){if(!/^(0|[1-9]\d*)$/u.test(r)||Number(r)>=s.length)throw new Error("index")}else if(!oe(s))throw new Error("object");s=Q(s,r)}return s}function me(e,t=zr){return typeof e=="string"&&e.length<=t}function ke(e){return typeof e=="number"&&Number.isFinite(e)}function Pr(e){return e===null||typeof e=="boolean"||ke(e)||me(e)}function Br(e,t,s){if(e.type==="text"&&t==="text"&&me(s)||e.type==="stat"&&t==="value"&&(me(s,1024)||ke(s))||e.type==="progress"&&(t==="label"&&me(s,1024)||t==="value"&&ke(s)&&s>=0&&s<=100))return s;if(!Array.isArray(s)||s.length>Rr)throw new Error("type");if(e.type==="table"&&t==="rows"){if(e.columns.length>xt)throw new Error("columns");const a=new Set(e.columns.map(r=>r.key));return Array.from({length:s.length},(r,o)=>{const i=Q(s,String(o));if(!oe(i))throw new Error("row");const c=Object.keys(i);if(c.length>xt)throw new Error("columns");const d=Object.create(null);for(const u of c){if(Cn.has(u)||!a.has(u))throw new Error("column");const m=Q(i,u);if(!Pr(m))throw new Error("cell");d[u]=m}return d})}if(e.type==="chart"&&t==="data")return Array.from({length:s.length},(a,r)=>{const o=Q(s,String(r));if(!oe(o)||Object.keys(o).some(d=>d!=="label"&&d!=="value"))throw new Error("point");const i=Q(o,"label"),c=Q(o,"value");if(!me(i,1024)||!ke(c)||c<0)throw new Error("point");return{label:i,value:c}});throw new Error("type")}function Fr(e,t){if(!("bind"in e)||e.bind===void 0)return{node:e};const s=Or[e.type],a=e.bind;if(!s||!oe(a))return{error:"This element has an unsupported state binding."};const r=Object.keys(a);if(r.length===0)return{node:e};const o={};for(const i of r)try{if(!s.includes(i))throw new Error("field");const c=Q(a,i);if(!oe(c)||Object.keys(c).length!==1||!Object.hasOwn(c,"path"))throw new Error("binding");const d=Q(c,"path");if(typeof d!="string")throw new Error("path");const u=Br(e,i,Wr(t,d));if(new TextEncoder().encode(JSON.stringify(u)).byteLength>65536)throw new Error("size");o[i]=u}catch{return{error:`Cannot show ${i}: its state value is missing or has the wrong type.`}}return{node:{...e,...o}}}const An=g.createContext(null),Vr=An.Provider;function _n(){return g.useContext(An)}const Ur={default:"bg-secondary text-secondary-foreground border-transparent",success:"bg-status-success-bg text-status-success-fg border-status-success-border",warning:"bg-status-warning-bg text-status-warning-fg border-status-warning-border",error:"bg-status-error-bg text-status-error-fg border-status-error-border",info:"bg-status-info-bg text-status-info-fg border-status-info-border"};function Ee(e){return Ur[e??"default"]}function Gr(e){var c;if(typeof e=="number")return Number.isFinite(e)?{prefix:"",suffix:"",decimals:0,grouped:!1,value:e}:null;const t=e.match(/^(.*?)(-?\d[\d,]*(?:\.\d+)?)(.*)$/s);if(!t)return null;const[,s,a,r]=t,o=Number(a.replace(/,/g,""));if(!Number.isFinite(o))return null;const i=a.includes(".")?((c=a.split(".")[1])==null?void 0:c.length)??0:0;return{prefix:s,suffix:r,decimals:i,grouped:a.includes(","),value:o}}function Kr(e,t){const s=t.toFixed(e.decimals),a=e.grouped?Number(s).toLocaleString("en-US",{minimumFractionDigits:e.decimals,maximumFractionDigits:e.decimals}):s;return`${e.prefix}${a}${e.suffix}`}const Hr={1:"text-lg font-semibold",2:"text-base font-semibold",3:"text-sm font-semibold"};function Yr({node:e}){const t=e.level??3,s=E(Hr[t],"text-foreground");return t===1?n.jsx("h1",{className:s,children:e.text}):t===2?n.jsx("h2",{className:s,children:e.text}):n.jsx("h3",{className:s,children:e.text})}function qr({node:e}){return n.jsx(la,{content:e.text,className:"text-sm"})}function Xr({node:e}){const t=W();return n.jsx(b.span,{className:E("inline-flex w-fit items-center rounded-md border px-2 py-0.5 text-xs font-medium",Ee(e.tone)),initial:t?{opacity:0,scale:.8}:!1,animate:t?{opacity:1,scale:1}:!1,transition:H,children:e.text})}function Qr(){return n.jsx(Ss,{})}const Jr={up:Ns,down:ks,flat:It},Zr={up:"text-status-success",down:"text-status-error",flat:"text-muted-foreground"};function ei({node:e}){const t=W(),s=Gr(e.value),a=wn((s==null?void 0:s.value)??0,t&&s!==null),r=s?Kr(s,a):String(e.value),o=e.delta?Jr[e.delta.direction]:null;return n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:e.label}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-baseline gap-2",children:[n.jsx("span",{className:"text-foreground text-2xl font-semibold tabular-nums",children:r}),e.delta&&o&&n.jsxs(b.span,{className:E("inline-flex items-center gap-0.5 text-xs font-medium",Zr[e.delta.direction]),initial:t?{opacity:0,x:-4}:!1,animate:t?{opacity:1,x:0}:!1,transition:{...H,delay:.25},children:[n.jsx(o,{className:"size-3","aria-hidden":!0}),e.delta.value]})]}),e.trend&&e.trend.length>=2&&n.jsx(ti,{values:e.trend})]}),e.hint&&n.jsx("span",{className:"text-muted-foreground text-xs",children:e.hint})]})}function ti({values:e}){const t=W(),s=`spark-wipe-${g.useId().replace(/:/g,"")}`,a=Math.min(...e),r=Math.max(...e),o=r-a||1,i=e.map((c,d)=>{const u=d/(e.length-1)*100,m=r===a?50:100-(c-a)/o*100;return`${u},${m}`}).join(" ");return n.jsxs("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none",className:"h-5 w-16 shrink-0 overflow-visible","aria-hidden":!0,children:[t&&n.jsx("defs",{children:n.jsx("clipPath",{id:s,children:n.jsx(b.rect,{x:-4,y:-12,height:124,initial:{width:0},animate:{width:108},transition:{duration:Ye,ease:le}})})}),n.jsx("g",{clipPath:t?`url(#${s})`:void 0,children:n.jsx("polyline",{points:i,fill:"none",stroke:"hsl(var(--chart-1))",strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"})})]})}function ni({node:e}){return n.jsx("dl",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm",children:e.items.map((t,s)=>n.jsxs("div",{className:"contents",children:[n.jsx("dt",{className:"text-muted-foreground",children:t.key}),n.jsx("dd",{className:"text-foreground text-right break-words",children:t.value})]},`${t.key}-${s}`))})}function si({node:e}){const t=W(),s=wn(e.value,t);return n.jsxs("div",{className:"flex flex-col gap-1",children:[(e.label||e.label==="")&&n.jsxs("div",{className:"text-muted-foreground flex items-center justify-between text-xs",children:[n.jsx("span",{children:e.label}),n.jsxs("span",{className:"tabular-nums",children:[Math.round(s),"%"]})]}),n.jsx(oa,{value:s})]})}function ai({node:e}){return n.jsxs("figure",{className:"flex flex-col gap-1",children:[n.jsx("img",{src:e.src,alt:e.alt,className:"max-h-80 w-full rounded-md border object-contain",loading:"lazy"}),e.caption&&n.jsx("figcaption",{className:"text-muted-foreground text-xs",children:e.caption})]})}const ri=b.create(Ut),ii=b.create(_e),yt={left:"text-left",center:"text-center",right:"text-right"};function oi(e){return e===null?"—":typeof e=="boolean"?e?"Yes":"No":String(e)}function ci({node:e}){const t=W();return n.jsx("div",{className:"overflow-x-auto",children:n.jsxs(Ft,{children:[n.jsx(Vt,{children:n.jsx(_e,{children:e.columns.map(s=>n.jsx(Le,{className:E(s.align&&yt[s.align]),children:s.label},s.key))})}),n.jsx(ri,{variants:t?Me:void 0,initial:t?"hidden":!1,animate:t?"visible":!1,children:e.rows.map((s,a)=>n.jsx(ii,{variants:t?xe:void 0,children:e.columns.map(r=>n.jsx(Oe,{className:E("tabular-nums",r.align&&yt[r.align]),children:oi(s[r.key]??null)},r.key))},a))})]})})}const li={"alert-circle":Us,"alert-triangle":$t,archive:Vs,"arrow-right":It,bell:Fs,bookmark:Pa,calendar:Bs,check:Ve,"check-circle":Ba,circle:De,clock:Ps,cloud:Fa,code:Va,cog:Ua,database:Ka,file:ha,"file-text":ma,flag:er,folder:Ws,"git-branch":pa,globe:zs,heart:fa,home:tr,info:Rs,link:Os,lock:Ls,mail:Ds,"map-pin":nr,"message-square":$s,package:ua,play:Ts,rocket:sr,search:Is,server:ca,settings:Es,star:Tt,tag:ar,terminal:da,"thumbs-up":Ms,trash:_s,"trending-down":rr,"trending-up":ir,user:As,users:Cs,zap:ws};function qe(e){if(!e)return De;const t=e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/\s+/g,"-").toLowerCase();return li[t]??De}function di(e,t){var a;if(e.phase==="sending")return"Saving…";if(e.phase!=="accepted")return e.message??"This action could not be saved.";const s=((a=e.receipt)==null?void 0:a.deliveries)??[];return s.length?s.map(r=>{if(r.ackOutcome==="handled"||r.status==="handled")return`${t} reported that it handled this action.`;if(r.ackOutcome==="rejected"||r.status==="rejected")return`${t} could not handle this action.`;switch(r.status){case"turn_started":return`${t} started working.`;case"turn_done":return`${t} finished. Handling is not confirmed yet.`;case"in_doubt":return"Saved; outcome unknown. Review before replaying.";case"failed":return"Saved; the agent request failed.";case"expired":return"Saved; expired before the agent started.";case"superseded":return"Saved; replaced by a newer change.";case"cancelled":return"Saved; the agent request was cancelled.";case"unavailable":return"Saved; the destination is not available.";default:return`Saved; waiting for ${t}.`}}).join(" "):"Saved to the document."}function Mn({controlId:e,descendants:t=!1}){const{channel:s,channelRecords:a,retryChannel:r}=ge();if(!s)return null;const o=a.filter(i=>i.controlId===e||t&&i.controlId.startsWith(`${e}.`));return o.length?n.jsx("ul",{className:"text-muted-foreground mt-2 flex max-h-32 flex-col gap-1.5 overflow-y-auto text-xs","aria-live":"polite","aria-relevant":"additions text","data-testid":"widget-action-statuses",children:o.map((i,c)=>n.jsxs("li",{"data-testid":"widget-action-status","data-event-id":i.event.id,className:"flex flex-wrap items-center gap-2",children:[n.jsxs("span",{children:[o.length>1?`Action ${c+1}: `:"",di(i,s.destinationLabel)]}),i.phase==="retry"&&n.jsx(Dt,{size:"sm",variant:"ghost",onClick:()=>void r(i.event.id),"data-testid":"widget-action-retry",children:"Try again"})]},i.event.id))}):null}function Ie({action:e,label:t,variant:s,fullWidth:a,controlId:r,submit:o}){const{onAction:i,channel:c}=ge(),d=Z(),u=r??d,m=e.kind==="emit"||e.kind==="agent"&&c!==void 0,p=Sn(e,u),v=W(),k=p.isDispatched&&p.dispatchStatus==="pending",S=p.isDispatched&&p.dispatchStatus==="sent",j=!p.interactive,A=v&&p.interactive,M=l=>{var T;if(j){l.preventDefault();return}if(o&&!((T=l.currentTarget.form)!=null&&T.reportValidity())){l.preventDefault();return}const f=Wt(l.currentTarget.getBoundingClientRect()),x=i(e,{origin:f,controlId:u});e.kind!=="agent"&&e.kind!=="emit"||x.catch(()=>{Pt.error(m?"This action could not be saved.":"Couldn’t send the action",{description:m?"Check the action size and document permissions, then try again.":"Your agent may be busy. Try again."})})};let N=null;p.superseded?N="This one’s from an earlier message.":p.unavailable?N=m?e.kind==="agent"&&(c!=null&&c.enabled)?"This action needs an approved document route.":"Document actions are not available here.":"Interactions aren’t available here":p.latched&&(N="Sent. Waiting for the agent’s reply");const C=n.jsxs(Dt,{type:o?"submit":"button","data-testid":m?"widget-channel-action":void 0,size:"sm",variant:s??"default","aria-disabled":j||void 0,disabled:k,onClick:j?void 0:M,className:E(a&&"w-full",j&&"cursor-default",(p.unavailable||p.superseded)&&"opacity-50",S&&"opacity-70"),children:[k&&n.jsx(Qs,{size:"xs"}),S&&n.jsx(Ve,{className:"size-(--size-icon-xs)","aria-hidden":!0}),t]});return m?n.jsxs("div",{className:E(a&&"w-full"),children:[n.jsx("div",{className:"text-muted-foreground mb-1 text-xs",children:c!=null&&c.destinationLabel?`To ${c.destinationLabel}`:"Document action"}),C,N&&n.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:N}),n.jsx(Mn,{controlId:u})]}):N?n.jsx(Lt,{children:n.jsxs(Ot,{children:[n.jsx(Rt,{asChild:!0,children:C}),n.jsx(zt,{children:N})]})}):!A&&!m?C:n.jsx(b.div,{className:E("inline-flex",a&&"w-full"),whileHover:{scale:1.02},transition:H,children:C})}function ui({node:e}){return n.jsx(Ie,{action:e.action,label:e.label,variant:e.variant})}function fi({node:e}){const t=_n(),s=g.useId(),[a,r]=g.useState(!1),[o,i]=g.useState(""),c=t?t.values[e.name]??"":o,d=u=>t?t.setValue(e.name,u):i(u);return n.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.label&&n.jsx(Ue,{htmlFor:s,children:e.label}),n.jsx(Xs,{id:s,name:e.name,type:e.kind==="number"?"number":"text",required:e.required,"aria-label":e.label??e.name,placeholder:e.placeholder,value:c,"aria-invalid":a||void 0,"aria-describedby":a?`${s}-error`:void 0,onInvalid:u=>{u.preventDefault(),r(!0),u.currentTarget.focus()},onChange:u=>{r(!1),d(u.target.value)}}),a&&n.jsxs("p",{id:`${s}-error`,className:"text-destructive text-xs",role:"alert",children:["Enter ",e.label??e.name,"."]})]})}function pi({node:e}){const t=g.useRef(null),s=_n(),a=g.useId(),[r,o]=g.useState(!1),[i,c]=g.useState(""),d=s?s.values[e.name]??"":i,u=m=>s?s.setValue(e.name,m):c(m);return n.jsxs("div",{className:"flex flex-col gap-1.5",onInvalidCapture:m=>{var p;m.preventDefault(),o(!0),(p=t.current)==null||p.focus()},children:[e.label&&n.jsx(Ue,{htmlFor:a,children:e.label}),n.jsxs(Gs,{name:e.name,required:e.required,value:d||void 0,onValueChange:m=>{o(!1),u(m)},children:[n.jsx(Ks,{ref:t,"aria-invalid":r||void 0,"aria-describedby":r?`${a}-error`:void 0,id:a,"aria-label":e.label??e.name,children:n.jsx(Hs,{placeholder:"Select…"})}),n.jsx(Ys,{children:e.options.map(m=>n.jsx(qs,{value:m.value,children:m.label},m.value))})]}),r&&n.jsxs("p",{id:`${a}-error`,className:"text-destructive text-xs",role:"alert",children:["Choose ",e.label??e.name,"."]})]})}function mi({node:e}){const t=W(),s=Z();return n.jsx(b.ul,{className:"divide-border divide-y",variants:t?Me:void 0,initial:t?"hidden":!1,animate:t?"visible":!1,children:e.items.map((a,r)=>{const o=qe(a.icon);return n.jsxs(b.li,{className:"hover:bg-muted/40 -mx-2 flex items-center gap-3 rounded-md px-2 py-2 transition-colors first:pt-0 last:pb-0",variants:t?xe:void 0,children:[a.image&&n.jsx("img",{src:a.image,alt:"",className:"size-10 shrink-0 rounded-md border object-cover",loading:"lazy"}),a.icon&&n.jsx(o,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":!0}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:"text-foreground truncate text-sm font-medium",children:a.title}),a.subtitle&&n.jsx("p",{className:"text-muted-foreground truncate text-xs",children:a.subtitle})]}),a.meta&&n.jsx("span",{className:"text-muted-foreground shrink-0 text-sm tabular-nums",children:a.meta}),a.badge&&n.jsx("span",{className:E("inline-flex shrink-0 items-center rounded-md border px-2 py-0.5 text-xs font-medium",Ee(a.badge.tone)),children:a.badge.text}),a.actions&&a.actions.length>0&&n.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:a.actions.map((i,c)=>n.jsx(Ie,{action:i,controlId:`${s}.items.${r}.actions.${c}`,label:i.kind==="agent"?i.label??"Action":i.kind==="emit"?"Send":hi(i)},c))})]},r)})})}function hi(e){return e.kind==="url"?"Open":"Run"}const te=["hsl(var(--chart-1))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))"],gi=180,xi=.15;function yi({node:e}){const t=e.height??gi,s=`${e.kind} chart`;return e.data.length===0?n.jsx("p",{className:"text-muted-foreground text-xs",children:"No data to chart."}):e.kind==="bar"?n.jsx(vi,{data:e.data,height:t,label:s}):e.kind==="pie"?n.jsx(Ni,{data:e.data,height:t,label:s}):n.jsx(ji,{data:e.data,height:t,area:e.kind==="area",label:s})}const bi=18;function vi({data:e,height:t,label:s}){const a=W(),r=Math.max(...e.map(i=>i.value),0)||1,o=Math.max(0,t-bi);return n.jsxs("div",{role:"img","aria-label":s,className:"flex flex-col gap-1",children:[n.jsx("div",{className:"flex items-end gap-2",style:{height:t},children:e.map((i,c)=>n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col items-center justify-end gap-1",children:[n.jsx("span",{className:"text-muted-foreground text-2xs tabular-nums",children:i.value}),n.jsx(b.div,{className:"w-full origin-bottom rounded-t-sm",style:{height:i.value/r*o,backgroundColor:te[c%te.length]},initial:a?{scaleY:0}:!1,animate:a?{scaleY:1}:!1,transition:{...H,delay:c*He}})]},c))}),n.jsx(En,{data:e})]})}function ji({data:e,height:t,area:s,label:a}){const r=Math.max(...e.map(v=>v.value),0)||1,o=e.length,c=e.map((v,k)=>{const S=o===1?50:k/(o-1)*100,j=100-v.value/r*100;return{x:S,y:j}}).map(v=>`${v.x},${v.y}`).join(" "),d=`0,100 ${c} 100,100`,u=te[0],m=W(),p=`chart-wipe-${g.useId().replace(/:/g,"")}`;return n.jsxs("div",{role:"img","aria-label":a,className:"flex flex-col gap-1",children:[n.jsxs("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none",style:{height:t},className:"w-full overflow-visible",children:[m&&n.jsx("defs",{children:n.jsx("clipPath",{id:p,children:n.jsx(b.rect,{x:-4,y:-12,height:124,initial:{width:0},animate:{width:108},transition:{duration:Ye,ease:le}})})}),n.jsxs("g",{clipPath:m?`url(#${p})`:void 0,children:[s&&n.jsx("polygon",{points:d,fill:u,opacity:xi}),n.jsx("polyline",{points:c,fill:"none",stroke:u,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"})]})]}),n.jsx(En,{data:e})]})}const ki=359.99;function Ni({data:e,height:t,label:s}){const a=W(),r=e.reduce((i,c)=>i+c.value,0)||1,o=e.map((i,c)=>{const u=-90+e.slice(0,c).reduce((v,k)=>v+k.value,0)/r*360,m=i.value/r*360,p=m>=ki;return{d:i,full:p,path:p?"":Si(u,u+m)}});return n.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[n.jsx("svg",{viewBox:"0 0 100 100",role:"img","aria-label":s,style:{height:t,width:t},children:o.map((i,c)=>{const d=te[c%te.length],u={initial:a?{opacity:0,scale:.6}:!1,animate:a?{opacity:1,scale:1}:!1,transition:{...H,delay:c*He},style:{transformOrigin:"50px 50px"}};return i.full?n.jsx(b.circle,{cx:50,cy:50,r:50,fill:d,...u},c):n.jsx(b.path,{d:i.path,fill:d,...u},c)})}),n.jsx("ul",{className:"flex flex-col gap-1 text-xs",children:e.map((i,c)=>n.jsxs("li",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"size-2.5 shrink-0 rounded-sm",style:{backgroundColor:te[c%te.length]},"aria-hidden":!0}),n.jsx("span",{className:"text-foreground",children:i.label}),n.jsx("span",{className:"text-muted-foreground tabular-nums",children:i.value})]},c))})]})}function En({data:e}){return n.jsx("div",{className:"flex gap-2",children:e.map((t,s)=>n.jsx("span",{className:E("text-muted-foreground text-2xs min-w-0 flex-1 truncate text-center"),title:t.label,children:t.label},s))})}function Si(e,t){const o=bt(50,50,50,e),i=bt(50,50,50,t),c=t-e>180?1:0;return`M 50 50 L ${o.x} ${o.y} A 50 50 0 ${c} 1 ${i.x} ${i.y} Z`}function bt(e,t,s,a){const r=a*Math.PI/180;return{x:e+s*Math.cos(r),y:t+s*Math.sin(r)}}const wi={done:"border-status-success bg-status-success text-white dark:text-status-success-bg",active:"border-primary bg-primary text-primary-foreground",upcoming:"border-border bg-background text-muted-foreground"};function Ci({node:e}){const t=W();return n.jsx(b.ol,{className:"flex flex-col",variants:t?Me:void 0,initial:t?"hidden":!1,animate:t?"visible":!1,children:e.items.map((s,a)=>{const r=s.status??"upcoming",o=a===e.items.length-1,i=s.icon?qe(s.icon):null;return n.jsxs(b.li,{className:"flex gap-3",variants:t?xe:void 0,children:[n.jsxs("div",{className:"flex flex-col items-center",children:[n.jsxs("span",{className:"relative flex size-5 shrink-0 items-center justify-center",children:[r==="active"&&t&&n.jsx(b.span,{className:"border-primary absolute inset-0 rounded-full border",initial:{opacity:.6,scale:1},animate:{opacity:0,scale:1.8},transition:{duration:1.6,repeat:1/0,ease:"easeOut"},"aria-hidden":!0}),n.jsx("span",{className:E("flex size-3 items-center justify-center rounded-full border",wi[r],r==="active"&&"ring-primary/30 ring-2"),children:i&&n.jsx(i,{className:"size-2.5","aria-hidden":!0})})]}),!o&&n.jsx("span",{className:"bg-border w-px flex-1","aria-hidden":!0})]}),n.jsxs("div",{className:E("min-w-0 flex-1",!o&&"pb-4"),children:[s.time&&n.jsx("p",{className:"text-muted-foreground text-xs tabular-nums",children:s.time}),n.jsx("p",{className:E("text-foreground text-sm",r==="active"?"font-semibold":"font-medium"),children:s.title}),s.subtitle&&n.jsx("p",{className:"text-muted-foreground text-xs",children:s.subtitle})]})]},a)})})}function Ai({node:e}){const t=g.useId(),[s,a]=g.useState(()=>e.items.map(o=>o.checked??!1)),r=g.useMemo(()=>{if(!e.action)return null;const o=e.items.filter((d,u)=>s[u]).map(d=>d.label),i=e.items.filter((d,u)=>!s[u]).map(d=>d.label),c={checked:o,unchecked:i};return e.action.kind==="emit"?{...e.action,payload:{...e.action.payload??{},...c}}:{...e.action,payload:{...e.action.payload??{},...c}}},[e.action,e.items,s]);return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("ul",{className:"flex flex-col gap-2",children:e.items.map((o,i)=>{const c=`${t}-${i}`;return n.jsxs("li",{className:"flex items-start gap-2.5",children:[n.jsx(Js,{id:c,checked:s[i],onCheckedChange:d=>a(u=>u.map((m,p)=>p===i?d===!0:m)),className:"mt-0.5"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx(Ue,{htmlFor:c,className:E("text-sm font-normal transition-colors",s[i]&&"text-muted-foreground line-through"),children:o.label}),o.note&&n.jsx("p",{className:"text-muted-foreground text-xs",children:o.note})]})]},i)})}),r&&n.jsx(Ie,{action:r,label:e.submitLabel??"Send",fullWidth:!0})]})}const _i=b.create(Ut),Mi=b.create(_e);function Ei({value:e}){return e==null?n.jsx("span",{className:"text-muted-foreground",children:"—"}):typeof e=="boolean"?e?n.jsx(Ve,{className:"text-status-success mx-auto size-4","aria-label":"Yes"}):n.jsx(Zs,{className:"text-muted-foreground mx-auto size-4","aria-label":"No"}):n.jsx("span",{className:"tabular-nums",children:String(e)})}function Ii({node:e}){const t=W();return n.jsx("div",{className:"overflow-x-auto",children:n.jsxs(Ft,{children:[n.jsx(Vt,{children:n.jsxs(_e,{children:[n.jsx(Le,{}),e.options.map((s,a)=>n.jsxs(Le,{className:E("text-center",s.recommended&&"bg-primary/5"),children:[n.jsx("span",{className:"text-foreground font-medium",children:s.name}),s.recommended&&n.jsx("span",{className:E("text-2xs mt-1 flex w-fit items-center justify-center rounded-md border px-1.5 py-0.5 font-medium","mx-auto",Ee("success")),children:"Recommended"})]},a))]})}),n.jsx(_i,{variants:t?Me:void 0,initial:t?"hidden":!1,animate:t?"visible":!1,children:e.rows.map((s,a)=>n.jsxs(Mi,{variants:t?xe:void 0,children:[n.jsx(Oe,{className:"text-muted-foreground font-medium",children:s.label}),e.options.map((r,o)=>n.jsx(Oe,{className:E("text-center",r.recommended&&"bg-primary/5"),children:n.jsx(Ei,{value:s.values[o]??null})},o))]},a))})]})})}const We=5,Ti=Array.from({length:We});function vt({className:e}){return n.jsx("div",{className:"flex","aria-hidden":!0,children:Ti.map((t,s)=>n.jsx(Tt,{className:E("size-4",e)},s))})}function $i({node:e}){const t=W(),s=e.value/We*100;return n.jsxs(b.div,{className:"flex items-center gap-2",initial:t?{opacity:0,y:4}:!1,animate:t?{opacity:1,y:0}:!1,transition:H,children:[n.jsxs("div",{className:"relative w-fit",role:"img","aria-label":`Rated ${e.value.toFixed(1)} out of ${We}`,children:[n.jsx(vt,{className:"text-muted-foreground"}),n.jsx("div",{className:"absolute inset-y-0 left-0 overflow-hidden",style:{width:`${s}%`},children:n.jsx(vt,{className:"fill-status-warning text-status-warning"})})]}),n.jsx("span",{className:"text-foreground text-sm font-medium tabular-nums",children:e.value.toFixed(1)}),e.count!==void 0&&n.jsxs("span",{className:"text-muted-foreground text-sm tabular-nums",children:["(",e.count.toLocaleString(),")"]}),e.label&&n.jsx("span",{className:"text-muted-foreground text-sm",children:e.label})]})}const Di=7.4,Li=[1,.1,1,1,.1,1,.1,1,1],Oi=[0,.02,.045,.52,.54,.565,.585,.61,1];function q({cx:e,cy:t,r:s=3,openness:a=1,active:r=!0,popIn:o=!1,motionOn:i}){const c=i&&r,d=a;return n.jsx(b.circle,{cx:e,cy:t,r:s,fill:"currentColor",style:{transformOrigin:`${e}px ${t}px`,scaleY:i?void 0:d},initial:i&&o?{scale:.2}:void 0,animate:i?{scale:1,...c?{scaleY:Li.map(u=>u*d)}:{scaleY:d}}:void 0,transition:i?{scale:{type:"spring",stiffness:500,damping:15},...c?{scaleY:{duration:Di,times:Oi,repeat:1/0,ease:"easeInOut"}}:{}}:void 0})}function jt({cx:e,cy:t}){return n.jsx("path",{d:`M ${e-4.5} ${t+1.5} Q ${e} ${t-4.5} ${e+4.5} ${t+1.5}`,fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round"})}function kt({cx:e,cy:t,motionOn:s,pulseDuration:a,delay:r=0,wobble:o=3}){const i=`M ${e} ${t+4} C ${e-8} ${t-2}, ${e-4} ${t-8}, ${e} ${t-4} C ${e+4} ${t-8}, ${e+8} ${t-2}, ${e} ${t+4} Z`;return n.jsx(b.path,{d:i,fill:"currentColor",className:"text-status-error",style:{transformOrigin:`${e}px ${t}px`},animate:s?{scale:[1,1.16,1],rotate:[-o,o,-o]}:void 0,transition:s?{scale:{duration:a,repeat:1/0,ease:"easeInOut",delay:r},rotate:{duration:a*2.1,repeat:1/0,ease:"easeInOut",delay:r}}:void 0})}function P({d:e}){return n.jsx("path",{d:e,fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round"})}function ce({cx:e,cy:t,opacity:s=.3}){return n.jsx("ellipse",{cx:e,cy:t,rx:3.6,ry:2.1,className:"text-status-error",fill:"currentColor",fillOpacity:s})}const Nt="M 0 -3.2 C 2.2 -0.6, 2.6 1.4, 0 3.2 C -2.6 1.4, -2.2 -0.6, 0 -3.2 Z";function In({x:e,y:t,motionOn:s,duration:a,repeatDelay:r}){return s?n.jsx(b.g,{style:{x:e,y:t},animate:{y:[t,t+2,t+9,t+11],opacity:[0,.85,.85,0],scale:[.5,1,1,.85]},transition:{duration:a,times:[0,.3,.85,1],repeat:1/0,repeatDelay:r,ease:"easeIn"},children:n.jsx("path",{d:Nt,className:"text-status-info",fill:"currentColor"})}):n.jsx("g",{transform:`translate(${e} ${t+4})`,opacity:.5,children:n.jsx("path",{d:Nt,className:"text-status-info",fill:"currentColor"})})}function Ri({motionOn:e}){return n.jsx(In,{x:47,y:13,motionOn:e,duration:3.4,repeatDelay:2.6})}function zi({motionOn:e}){return n.jsx(In,{x:24,y:30,motionOn:e,duration:3.6,repeatDelay:3.2})}function Wi({motionOn:e}){return e?n.jsx(n.Fragment,{children:[{x:49,y:15,delay:0},{x:53.5,y:19,delay:.9}].map((t,s)=>n.jsx(b.circle,{cx:t.x,cy:t.y,r:2,fill:"currentColor",style:{transformOrigin:`${t.x}px ${t.y}px`},animate:{opacity:[0,.45,0],y:[0,-3,-6],scale:[.6,1,1.4]},transition:{duration:2,repeat:1/0,repeatDelay:1.4,delay:t.delay,ease:"easeOut"}},s))}):null}const de={fill:"none",stroke:"currentColor",strokeLinecap:"round"};function Pi({motionOn:e}){const t={scaleY:[1,.1,1,1,.15,.15,1],times:[0,.03,.06,.84,.87,.96,1]},s={opacity:[0,0,.4,.4,0],times:[0,.84,.88,.96,1]},a={duration:8,repeat:1/0,ease:"easeInOut"};return n.jsxs(n.Fragment,{children:[n.jsx(P,{d:"M18 18 Q24 14.5 30 18"}),n.jsx(P,{d:"M34 18 Q40 14.5 46 18"}),[24,40].map(r=>n.jsx(b.circle,{cx:r,cy:26,r:3,fill:"currentColor",style:{transformOrigin:`${r}px 26px`},animate:e?{scaleY:t.scaleY}:void 0,transition:e?{...a,times:t.times}:void 0},r)),e&&n.jsxs(b.g,{animate:{opacity:s.opacity},transition:{...a,times:s.times},children:[n.jsx(ce,{cx:16.5,cy:33,opacity:1}),n.jsx(ce,{cx:47.5,cy:33,opacity:1})]}),n.jsx("path",{d:"M19 38 Q32 51 45 38",...de,strokeWidth:3})]})}function Bi({motionOn:e}){return n.jsxs(n.Fragment,{children:[n.jsx(P,{d:"M20 20 L29 20"}),n.jsx(b.g,{animate:e?{y:[0,-1.2,0]}:void 0,transition:e?{duration:3.4,repeat:1/0,ease:"easeInOut"}:void 0,children:n.jsx(P,{d:"M36 16 Q41 13 46 16"})}),n.jsxs(b.g,{animate:e?{x:[0,0,-3.5,-3.5,0,0,2,0]}:void 0,transition:e?{duration:7,times:[0,.3,.36,.52,.58,.78,.84,1],repeat:1/0,ease:"easeInOut"}:void 0,children:[n.jsx(q,{cx:27,cy:23,motionOn:e}),n.jsx(q,{cx:43,cy:23,motionOn:e})]}),n.jsx("path",{d:"M27 43 L37 41.5",...de,strokeWidth:2.5})]})}function Fi(){return n.jsxs(n.Fragment,{children:[n.jsx(P,{d:"M18 16 Q24 12.5 30 16"}),n.jsx(P,{d:"M34 16 Q40 12.5 46 16"}),n.jsx(jt,{cx:24,cy:26}),n.jsx(jt,{cx:40,cy:26}),n.jsx("path",{d:"M19 37 Q32 54 45 37 Q32 44 19 37 Z",fill:"currentColor",stroke:"currentColor",strokeWidth:1,strokeLinejoin:"round"})]})}function Vi({motionOn:e}){return n.jsxs(n.Fragment,{children:[n.jsx(P,{d:"M17 20 L27 17"}),n.jsx(P,{d:"M33 17 L43 20"}),n.jsx(q,{cx:21,cy:30,motionOn:e}),n.jsx(q,{cx:37,cy:30,motionOn:e}),n.jsx(ce,{cx:14.5,cy:36}),n.jsx(ce,{cx:44.5,cy:36}),n.jsx(Ri,{motionOn:e}),n.jsx("path",{d:"M23 42 Q27.5 39.5 32 42 T41 42",...de,strokeWidth:2.5})]})}function Ui({motionOn:e}){return n.jsxs(n.Fragment,{children:[n.jsxs(b.g,{animate:e?{y:[0,1.4,1.4,0]}:void 0,transition:e?{duration:5,times:[0,.12,.5,.62],repeat:1/0,ease:"easeInOut"}:void 0,children:[n.jsx(P,{d:"M18 15 L29 19.5"}),n.jsx(P,{d:"M35 19.5 L46 15"})]}),n.jsx(q,{cx:24,cy:27,openness:.8,motionOn:e}),n.jsx(q,{cx:40,cy:27,openness:.8,motionOn:e}),n.jsx(Wi,{motionOn:e}),n.jsx("path",{d:"M23 42 L41 42",...de,strokeWidth:3})]})}function Gi({motionOn:e}){return n.jsxs(n.Fragment,{children:[n.jsxs(b.g,{initial:e?{y:7}:void 0,animate:e?{y:0}:void 0,transition:e?{type:"spring",stiffness:420,damping:11,delay:.08}:void 0,children:[n.jsx(P,{d:"M18 14 Q24 10.5 30 14"}),n.jsx(P,{d:"M34 14 Q40 10.5 46 14"})]}),n.jsx(q,{cx:24,cy:26,r:4.5,popIn:!0,motionOn:e}),n.jsx(q,{cx:40,cy:26,r:4.5,popIn:!0,motionOn:e}),n.jsx(b.circle,{cx:32,cy:44,r:4,fill:"none",stroke:"currentColor",strokeWidth:2.5,style:{transformOrigin:"32px 44px"},initial:e?{scale:.2}:void 0,animate:e?{scale:1}:void 0,transition:e?{type:"spring",stiffness:500,damping:12,delay:.14}:void 0})]})}function Ki({motionOn:e}){return n.jsxs(n.Fragment,{children:[n.jsx(P,{d:"M19 20.5 L29 16.5"}),n.jsx(P,{d:"M35 16.5 L45 20.5"}),n.jsx(q,{cx:24,cy:26,motionOn:e}),n.jsx(q,{cx:40,cy:26,motionOn:e}),n.jsx(zi,{motionOn:e}),n.jsx("path",{d:"M20 47 Q32 37.5 44 47",...de,strokeWidth:3})]})}function Hi({motionOn:e}){return n.jsxs(n.Fragment,{children:[n.jsx(P,{d:"M18 17.5 Q24 15 30 17.5"}),n.jsx(P,{d:"M34 17.5 Q40 15 46 17.5"}),n.jsx(kt,{cx:24,cy:27,motionOn:e,pulseDuration:1.5,wobble:3}),n.jsx(kt,{cx:40,cy:27,motionOn:e,pulseDuration:1.9,delay:.35,wobble:-3}),n.jsx(ce,{cx:15,cy:35,opacity:.25}),n.jsx(ce,{cx:49,cy:35,opacity:.25}),n.jsx("path",{d:"M21 40 Q32 48 43 40",...de,strokeWidth:2.5})]})}function Yi({emotion:e,motionOn:t}){switch(e){case"happy":return n.jsx(Pi,{motionOn:t});case"thinking":return n.jsx(Bi,{motionOn:t});case"celebrating":return n.jsx(Fi,{});case"sheepish":return n.jsx(Vi,{motionOn:t});case"determined":return n.jsx(Ui,{motionOn:t});case"surprised":return n.jsx(Gi,{motionOn:t});case"sad":return n.jsx(Ki,{motionOn:t});case"love":return n.jsx(Hi,{motionOn:t})}}const qi={initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1},transition:{type:"spring",stiffness:380,damping:16,mass:.9}},Xi={surprised:{initial:{opacity:0,scale:.4},animate:{opacity:1,scale:[.4,1.14,.94,1.03,1]},transition:{duration:.65,times:[0,.4,.62,.82,1],ease:"easeOut"}},sad:{initial:{opacity:0,scale:.92,y:-3},animate:{opacity:1,scale:1,y:0},transition:{duration:.7,ease:"easeOut"}}},Qi={happy:{animate:{y:[0,-1.5,0]},transition:{duration:2.8,repeat:1/0,ease:"easeInOut"}},thinking:{animate:{rotate:[0,-1.2,0,1.2,0]},transition:{duration:6,repeat:1/0,ease:"easeInOut"}},celebrating:{animate:{y:[0,-4,0,0],scaleY:[1,1.06,.9,1],scaleX:[1,.96,1.08,1]},transition:{duration:1.3,times:[0,.35,.7,1],repeat:1/0,ease:"easeInOut"}},sheepish:{animate:{rotate:[0,-2.5,-2.5,0]},transition:{duration:5,times:[0,.2,.7,1],repeat:1/0,ease:"easeInOut"}},determined:{animate:{scale:[1,1.02,1]},transition:{duration:2.4,repeat:1/0,ease:"easeInOut"}},sad:{animate:{y:[0,2,0],rotate:[0,-1.5,0]},transition:{duration:5,repeat:1/0,ease:"easeInOut"}},love:{animate:{rotate:[0,2.5,0,-2.5,0]},transition:{duration:4,repeat:1/0,ease:"easeInOut"}}};function Ji({node:e}){const t=W(),s=g.useRef(!1),a=g.useRef(null);g.useEffect(()=>{var c;if(e.emotion!=="celebrating"||!t||s.current)return;s.current=!0;const i=(c=a.current)==null?void 0:c.getBoundingClientRect();ea({origin:i?Wt(i):void 0})},[e.emotion,t]);const r=Xi[e.emotion]??qi,o=Qi[e.emotion];return n.jsxs("div",{className:"flex items-center gap-3",role:"img","aria-label":`Mood: ${e.emotion}`,children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(b.div,{initial:t?r.initial:!1,animate:t?r.animate:!1,transition:t?r.transition:void 0,children:n.jsx(b.div,{ref:a,className:"bg-muted text-foreground relative flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-full",animate:t&&o?o.animate:void 0,transition:t&&o?o.transition:void 0,children:n.jsx("svg",{viewBox:"0 0 64 64",className:"size-full","aria-hidden":!0,children:n.jsx(Yi,{emotion:e.emotion,motionOn:t})})})}),e.emotion==="thinking"&&n.jsx(Zi,{motionOn:t})]}),e.message&&n.jsx(b.div,{className:"bg-muted/40 rounded-lg border px-3 py-2 text-sm",initial:t?{opacity:0,x:-4}:!1,animate:t?{opacity:1,x:0}:!1,transition:t?{duration:.3,delay:.15,ease:"easeOut"}:void 0,children:e.message})]})}function Zi({motionOn:e}){return n.jsx("div",{className:"flex items-end gap-1","aria-hidden":!0,children:[0,1,2].map(t=>n.jsx(b.span,{className:"bg-muted-foreground/60 size-1.5 rounded-full",animate:e?{y:[0,-3.5,0],opacity:[.3,1,.3]}:void 0,transition:e?{duration:1.3,repeat:1/0,repeatDelay:.4,delay:t*.16,ease:"easeInOut"}:void 0},t))})}const eo=2,to=5;function St(e){var s;const t=(s=e==null?void 0:e.glyph)==null?void 0:s.trim();return t||null}function no(e,t){var a,r;const s=St((a=e[t[0].row])==null?void 0:a[t[0].col]);if(!s)return null;for(const{row:o,col:i}of t)if(St((r=e[o])==null?void 0:r[i])!==s)return null;return s}function so(e){const t=e.length;if(t<eo||t>to||e.some(a=>a.length!==t))return null;const s=[];for(let a=0;a<t;a++)s.push(Array.from({length:t},(r,o)=>({row:a,col:o}))),s.push(Array.from({length:t},(r,o)=>({row:o,col:a})));s.push(Array.from({length:t},(a,r)=>({row:r,col:r}))),s.push(Array.from({length:t},(a,r)=>({row:r,col:t-1-r})));for(const a of s){const r=no(e,a);if(r)return{glyph:r,cells:a}}return null}function ao(e,t,s){return e!==null&&e.cells.some(a=>a.row===t&&a.col===s)}const ro=new Set(["."," ","-","_"]),Tn=".";function io(e,t){const s=o=>o.map(i=>ro.has(i)?Tn:i),a=[...e];if(a.length===t)return s(a);const r=[...e.trim()];return r.length===t?s(r):null}function oo(e,t){const s=e.split("/");if(s.length!==t.length)return null;const a=[];for(let r=0;r<s.length;r++){const o=io(s[r],t[r].length);if(!o)return null;a.push(o)}return a}function co(e){var s,a;const t=[];for(const r of e)for(const o of r){if(((s=o.action)==null?void 0:s.kind)!=="agent")continue;const i=(a=o.action.payload)==null?void 0:a.state;typeof i=="string"&&i.trim()!==""&&t.push(i)}return t}function lo(e,t){const s=new Map;for(const r of e){const o=oo(r,t);if(!o)continue;const i=o.map(d=>d.join("")).join("/"),c=s.get(i);c?c.count+=1:s.set(i,{parsed:o,count:1})}if(s.size===0)return null;const a=[...s.values()].sort((r,o)=>o.count-r.count);return a.length>1&&a[0].count===a[1].count?null:a[0].parsed}function uo(e){const t=co(e);if(t.length===0)return e;const s=lo(t,e);if(!s)return e;let a=!1;const r=e.map((o,i)=>o.map((c,d)=>{const u=s[i][d];if(c.glyph||c.icon||u===Tn)return c;a=!0;const{action:m,...p}=c;return{...p,glyph:u}}));return a?r:e}const wt=.12,fo=.2,$n="0 0 24 24";function Dn(e){const t=e.trim().toLowerCase();return t==="x"?"x":t==="o"||t==="0"||t==="⭕"||t==="◯"?"o":"glyph"}function po(e){const t=Dn(e);return t==="x"?"text-status-info":t==="o"?"text-status-warning":null}const Pe={className:"stroke-current",fill:"none",strokeWidth:2.75,strokeLinecap:"round"};function mo({motionOn:e,colorClass:t}){const s=a=>({duration:wt,ease:le,delay:a});return n.jsxs("svg",{viewBox:$n,className:E("size-[1.15em]",t),"aria-hidden":!0,focusable:"false",children:[n.jsx(b.path,{...Pe,d:"M7 7 L17 17",initial:e?{pathLength:0}:!1,animate:e?{pathLength:1}:!1,transition:e?s(0):void 0}),n.jsx(b.path,{...Pe,d:"M17 7 L7 17",initial:e?{pathLength:0}:!1,animate:e?{pathLength:1}:!1,transition:e?s(wt):void 0})]})}function ho({motionOn:e,colorClass:t}){return n.jsx("svg",{viewBox:$n,className:E("size-[1.15em]",t),"aria-hidden":!0,focusable:"false",children:n.jsx(b.circle,{...Pe,cx:12,cy:12,r:6.5,transform:"rotate(-90 12 12)",initial:e?{pathLength:0}:!1,animate:e?{pathLength:1}:!1,transition:e?{duration:fo,ease:le}:void 0})})}function go({motionOn:e}){return n.jsx(b.span,{"aria-hidden":!0,className:"bg-foreground/70 block size-[0.5em] rounded-full",initial:e?{scale:0,opacity:0}:!1,animate:e?{scale:1,opacity:1}:!1,transition:e?H:void 0})}function we({mark:e,motionOn:t,colorClass:s}){if(!e.trim())return n.jsx(go,{motionOn:t});const a=Dn(e);return a==="x"?n.jsx(mo,{motionOn:t,colorClass:s}):a==="o"?n.jsx(ho,{motionOn:t,colorClass:s}):n.jsx(b.span,{"aria-hidden":!0,className:E("block leading-none",s),initial:t?{scale:.4,opacity:0}:!1,animate:t?{scale:1,opacity:1}:!1,transition:t?H:void 0,children:e})}function ve(e){if(!e||e.kind!=="agent")return"";const t=e.payload,s=(t==null?void 0:t.glyph)??(t==null?void 0:t.mark);return typeof s=="string"?s:""}function Ln(e){return e.glyph?e.glyph:e.icon?e.icon:"filled"}function On(e){return E("relative flex aspect-square items-center justify-center rounded-md border text-2xl leading-none",e.tone&&Ee(e.tone))}function Ce(e,t){if(!t.tone)return po(e)??void 0}function xo({cell:e,icon:t,motionOn:s,row:a,col:r,winRole:o}){const i=!!(e.glyph||e.icon);return n.jsxs(b.div,{role:"gridcell","aria-label":i?`Row ${a+1}, column ${r+1}: ${Ln(e)}`:void 0,className:E(On(e),o==="loser"&&"opacity-60"),animate:s&&o==="winner"?{scale:[1,1.08,1]}:void 0,transition:s&&o==="winner"?{duration:1.4,repeat:1/0,ease:"easeInOut",delay:.6}:void 0,children:[e.glyph&&n.jsx(we,{mark:e.glyph,motionOn:s,colorClass:Ce(e.glyph,e)}),!e.glyph&&t&&n.jsx(t,{className:"size-6","aria-hidden":!0})]})}function yo({cell:e,icon:t,motionOn:s,row:a,col:r,winRole:o}){const{onAction:i,channel:c}=ge(),u=`${Z()}.rows.${a}.${r}`,m=e.action.kind==="emit"||e.action.kind==="agent"&&c!==void 0,p=Sn(e.action,u),v=p.isDispatched?ve(e.action):null,k=p.interactive&&e.action.kind==="agent"&&!!ve(e.action),S=!p.interactive,j=()=>{if(!p.interactive)return;const C=i(e.action,{controlId:u});e.action.kind!=="agent"&&e.action.kind!=="emit"||C.catch(()=>{Pt.error("Couldn’t send the move",{description:m?"Check the action size and document permissions, then try again.":"Your agent may be busy. Try again."})})},A=(()=>{const C=`Row ${a+1}, column ${r+1}`;return p.isDispatched?`${C}: ${v||"played"}`:e.glyph||e.icon?`${C}: ${Ln(e)}`:p.interactive?`${C}: empty, play here`:`${C}: empty`})();let M=null;p.superseded?M="This board is from an earlier turn. Play on the newest one.":p.unavailable?M=m?"This document action is not available or needs approval.":"Interactions aren’t available here":p.latched&&(M="Move sent. Waiting for the agent’s reply");const N=n.jsxs(b.button,{type:"button","aria-label":A,"aria-disabled":S||void 0,onClick:S?void 0:j,className:E(On(e),"group focus-ring w-full transition-colors",p.interactive&&"hover:bg-muted/60 cursor-pointer",S&&"cursor-default",o==="loser"&&"opacity-60"),whileHover:p.interactive?{scale:1.05}:void 0,whileTap:p.interactive?{scale:.95}:void 0,transition:H,children:[k&&n.jsx("span",{className:"pointer-events-none absolute inset-0 flex items-center justify-center text-2xl opacity-0 transition-opacity duration-150 group-hover:opacity-20",children:n.jsx(we,{mark:ve(e.action),motionOn:!1,colorClass:Ce(ve(e.action),e)})}),n.jsx(bo,{cell:e,optimisticMark:v,icon:t,motionOn:s})]});return n.jsx(b.div,{role:"gridcell",animate:s&&o==="winner"?{scale:[1,1.08,1]}:void 0,transition:s&&o==="winner"?{duration:1.4,repeat:1/0,ease:"easeInOut",delay:.6}:void 0,children:M?n.jsx(Lt,{children:n.jsxs(Ot,{children:[n.jsx(Rt,{asChild:!0,children:N}),n.jsx(zt,{children:M})]})}):N})}function bo({cell:e,optimisticMark:t,icon:s,motionOn:a}){return t!==null?n.jsx(we,{mark:t,motionOn:a,colorClass:Ce(t,e)}):e.glyph?n.jsx(we,{mark:e.glyph,motionOn:a,colorClass:Ce(e.glyph,e)}):s?n.jsx(s,{className:"size-6","aria-hidden":!0}):null}function vo(e){return e.cell.action?n.jsx(yo,{...e,cell:e.cell}):n.jsx(xo,{...e})}const Ct=.28,jo=.3,ko=.12,No=.8;function je(e,t,s){return e*(t+s)+t/2}function So({win:e,size:t,cellUnit:s,gapUnit:a,colorClass:r,motionOn:o}){const i=t*s+(t-1)*a,c=e.cells[0],d=e.cells[e.cells.length-1],u=je(c.col,s,a),m=je(c.row,s,a),p=je(d.col,s,a),v=je(d.row,s,a);return n.jsx("svg",{viewBox:`0 0 ${i} ${i}`,className:E("pointer-events-none absolute inset-0 h-full w-full",r),"aria-hidden":!0,focusable:"false",children:n.jsx(b.line,{x1:u,y1:m,x2:p,y2:v,className:"stroke-current",strokeWidth:s*ko,strokeOpacity:No,strokeLinecap:"round",initial:o?{pathLength:0,opacity:0}:!1,animate:o?{pathLength:1,opacity:1}:!1,transition:o?{pathLength:{duration:jo,ease:le,delay:Ct},opacity:{duration:.12,delay:Ct}}:void 0})})}const wo={},Co=.02,Ao={hidden:{},visible:{transition:{staggerChildren:Co}}};function _o(e,t,s,a){return e?ao(e,t,s)?"winner":a.glyph?"loser":"none":"none"}const Mo=4,Eo=3.25,Io=2.5,To=.25,$o={default:"text-status-success",success:"text-status-success",warning:"text-status-warning",error:"text-status-error",info:"text-status-info"};function Do({node:e}){var k,S;const t=W(),{latched:s,superseded:a,channel:r}=ge(),o=Z(),i=uo(e.rows),c=Math.max(1,...i.map(j=>j.length)),d=c<=Mo?Eo:Io,u=so(i),m=u?((S=(k=i[u.cells[0].row])==null?void 0:k[u.cells[0].col])==null?void 0:S.tone)??"default":"default",p=$o[m],v=s&&!a;return n.jsxs("div",{className:"flex flex-col gap-1.5",children:[r&&n.jsxs("p",{className:"text-muted-foreground text-xs",children:["To ",r.destinationLabel]}),e.label&&n.jsx("p",{className:"text-muted-foreground text-xs",children:e.label}),n.jsxs("div",{className:E("relative w-fit",a&&"saturate-[0.9]"),children:[v&&n.jsx(b.div,{"aria-hidden":!0,className:"ring-primary/40 pointer-events-none absolute -inset-1 rounded-lg ring-2",initial:t?{opacity:.25}:!1,animate:t?{opacity:[.25,.6,.25]}:{opacity:.4},transition:t?{duration:2,repeat:1/0,ease:"easeInOut"}:void 0}),n.jsx(b.div,{role:"grid","aria-label":e.label??"Board",className:"grid w-fit gap-1",style:{gridTemplateColumns:`repeat(${c}, minmax(0, ${d}rem))`},variants:t?Ao:void 0,initial:t?"hidden":!1,animate:t?"visible":!1,children:i.map((j,A)=>n.jsx("div",{role:"row",className:"contents",children:Array.from({length:c},(M,N)=>{const C=j[N]??wo,l=!C.glyph&&C.icon?qe(C.icon):null,f=_o(u,A,N,C);return n.jsx(vo,{cell:C,icon:l,motionOn:t,row:A,col:N,winRole:f},`${A}-${N}`)})},A))}),u&&n.jsx(So,{win:u,size:c,cellUnit:d,gapUnit:To,colorClass:p,motionOn:t})]}),n.jsx(Mn,{controlId:o,descendants:!0})]})}const Lo=1.2,Oo={coin:"rounded-full bg-status-warning-bg border-status-warning-border text-status-warning-fg",d6:"rounded-xl bg-muted border-border text-foreground",d20:"rounded-xl bg-muted border-border text-foreground","8ball":"rounded-full bg-foreground border-foreground text-background"},Ro=[Ha,Ya,qa,Xa,Qa,Ja];function zo(e){const t={duration:Lo,ease:"easeOut"};switch(e){case"coin":return{animate:{rotateY:[0,360,720,1080]},transition:t};case"d6":case"d20":return{animate:{rotate:[0,-15,15,-10,10,0],x:[0,-2,2,-2,2,0]},transition:t};case"8ball":return{animate:{x:[0,-6,6,-4,4,-2,2,0]},transition:t}}}function Wo({kind:e,result:t}){switch(e){case"coin":return n.jsx(Ga,{className:"size-7","aria-hidden":!0});case"8ball":return n.jsx("span",{"aria-hidden":!0,children:"8"});case"d20":return n.jsx("svg",{viewBox:"0 0 24 24",className:"size-7","aria-hidden":!0,children:n.jsx("polygon",{points:"12,2 21,8 21,16 12,22 3,16 3,8",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round"})});case"d6":{const s=Number(t),a=Number.isInteger(s)&&s>=1&&s<=6?Ro[s-1]:Za;return n.jsx(a,{className:"size-7","aria-hidden":!0})}}}function Po({node:e}){const t=W(),[s,a]=g.useState(0),[r,o]=g.useState(!t),{animate:i,transition:c}=zo(e.kind);return n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{type:"button","aria-label":`Replay the ${e.kind} reveal`,onClick:()=>{t&&(o(!1),a(d=>d+1))},className:E("focus-ring flex size-16 shrink-0 items-center justify-center border-2 text-lg font-bold",Oo[e.kind]),children:n.jsx(b.span,{className:"flex items-center justify-center",initial:t?{rotate:0,x:0,rotateY:0}:!1,animate:t?i:!1,transition:t?c:void 0,onAnimationComplete:()=>o(!0),children:n.jsx(Wo,{kind:e.kind,result:e.result})},s)}),n.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.label&&n.jsx("span",{className:"text-muted-foreground text-xs",children:e.label}),n.jsx(b.span,{"aria-live":"polite",className:"text-foreground text-lg font-semibold tabular-nums",initial:t?{opacity:0,scale:1.3}:!1,animate:r?{opacity:1,scale:1}:{opacity:0,scale:1.3},transition:H,children:r?e.result:""})]})]})}const Bo={sm:"gap-2",md:"gap-3",lg:"gap-5"};function he({node:e,path:t="root"}){return n.jsx(Dr,{value:t,children:n.jsx(Fo,{node:e})})}function Fo({node:e}){const t=cr();if(t===void 0&&"bind"in e&&e.bind!==void 0&&Object.keys(e.bind).length>0)return n.jsx("p",{role:"status",className:"text-muted-foreground text-xs",children:"Waiting for document state."});const s=Fr(e,t==null?void 0:t.state);if(s.error!==void 0)return n.jsx("p",{role:"status",className:"text-muted-foreground text-xs",children:s.error});const a=s.node;switch(a.type){case"stack":return n.jsx(Vo,{node:a});case"card":return n.jsx(Uo,{node:a});case"form":return n.jsx(Go,{node:a});case"divider":return n.jsx(Qr,{});case"heading":return n.jsx(Yr,{node:a});case"text":return n.jsx(qr,{node:a});case"badge":return n.jsx(Xr,{node:a});case"stat":return n.jsx(ei,{node:a});case"keyValue":return n.jsx(ni,{node:a});case"progress":return n.jsx(si,{node:a});case"image":return n.jsx(ai,{node:a});case"table":return n.jsx(ci,{node:a});case"list":return n.jsx(mi,{node:a});case"chart":return n.jsx(yi,{node:a});case"timeline":return n.jsx(Ci,{node:a});case"checklist":return n.jsx(Ai,{node:a});case"compare":return n.jsx(Ii,{node:a});case"rating":return n.jsx($i,{node:a});case"mood":return n.jsx(Ji,{node:a});case"board":return n.jsx(Do,{node:a});case"reveal":return n.jsx(Po,{node:a});case"button":return n.jsx(ui,{node:a});case"input":return n.jsx(fi,{node:a});case"select":return n.jsx(pi,{node:a});default:return n.jsx(Ko,{nodeType:a.type})}}function Vo({node:e}){const t=Z();return n.jsx("div",{className:E("flex",e.direction==="horizontal"?"flex-row flex-wrap items-start":"flex-col",Bo[e.gap??"md"]),children:e.children.map((s,a)=>n.jsx(he,{path:`${t}.children.${a}`,node:s},a))})}function Uo({node:e}){const t=Z(),s=!!(e.title||e.description);return n.jsxs(Bt,{className:"shadow-soft",children:[s&&n.jsxs(na,{children:[e.title&&n.jsx(sa,{children:e.title}),e.description&&n.jsx(aa,{children:e.description})]}),n.jsx(ra,{children:e.children.map((a,r)=>n.jsx(he,{path:`${t}.children.${r}`,node:a},r))}),e.footer&&e.footer.length>0&&n.jsx(ia,{children:e.footer.map((a,r)=>n.jsx(he,{path:`${t}.footer.${r}`,node:a},r))})]})}function Go({node:e}){const t=Z(),[s,a]=g.useState({}),r=g.useCallback((c,d)=>{a(u=>({...u,[c]:d}))},[]),o=g.useMemo(()=>({values:s,setValue:r}),[s,r]),i=g.useMemo(()=>e.submit.action.kind==="emit"?{...e.submit.action,payload:{...e.submit.action.payload??{},...s}}:{...e.submit.action,payload:{...e.submit.action.payload??{},...s}},[e.submit.action,s]);return n.jsxs("form",{onSubmit:c=>c.preventDefault(),className:"flex flex-col gap-3",children:[n.jsx(Vr,{value:o,children:e.children.map((c,d)=>n.jsx(he,{path:`${t}.children.${d}`,node:c},d))}),n.jsx(Ie,{action:i,label:e.submit.label,controlId:`${t}.submit`,submit:!0,fullWidth:!0})]})}function Ko({nodeType:e}){return n.jsxs("div",{className:"text-muted-foreground rounded-md border border-dashed p-2 text-xs",children:["Unsupported widget element",e?`: ${e}`:""]})}function ic({document:e,sessionId:t,isLatestMessage:s,channel:a}){const r=W();return n.jsx(Lr,{channel:a,sessionId:t,widgetTitle:e.title,isLatestMessage:s,children:n.jsx(or,{value:a==null?void 0:a.snapshot,children:n.jsx(b.section,{"aria-label":e.title??"Widget",className:"text-sm",variants:r?xe:void 0,initial:r?"hidden":!1,animate:r?"visible":!1,children:n.jsx(he,{node:e.root})})})})}function Ho(e,t){const s=Er.safeParse(e);if(!s.success){const a=s.error.issues[0],r=(a==null?void 0:a.path.join("."))??"";return{ok:!1,error:a?`${r?`${r}: `:""}${a.message}`:"The widget isn’t in a shape DorkOS knows",raw:t??Yo(e)}}return{ok:!0,document:s.data}}function oc(e){let t;try{t=JSON.parse(e)}catch(s){return{ok:!1,error:s instanceof Error?s.message:"The widget isn’t readable JSON",raw:e}}return Ho(t,e)}function Yo(e){try{return JSON.stringify(e,null,2)??String(e)}catch{return String(e)}}function cc({error:e,raw:t}){const[s,a]=g.useState(!1);return n.jsx(Bt,{gap:"none",className:"p-3 text-sm",children:n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx($t,{className:"text-muted-foreground mt-0.5 size-4 shrink-0","aria-hidden":!0}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:"font-medium",children:"Couldn’t show this widget"}),n.jsx("p",{className:"text-muted-foreground mt-0.5 text-xs break-words",children:e}),n.jsxs("button",{type:"button",onClick:()=>a(r=>!r),"aria-expanded":s,className:"text-muted-foreground hover:text-foreground focus-visible:ring-ring mt-2 inline-flex items-center gap-1 rounded text-xs focus-visible:ring-2 focus-visible:outline-none",children:[n.jsx(ta,{className:E("size-3 transition-transform",s&&"rotate-90")}),s?"Hide":"Show"," raw JSON"]}),s&&n.jsx("pre",{className:"bg-muted text-muted-foreground mt-2 max-h-64 overflow-auto rounded-md p-2 text-xs",children:n.jsx("code",{children:t})})]})]})})}export{cc as W,ic as a,H as b,oc as p,W as u,Ho as v};
|