dorkos 0.110.0 → 0.111.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.
Files changed (173) hide show
  1. package/dist/bin/cli.js +57 -17
  2. package/dist/browser/native/package-manifest.json +1 -1
  3. package/dist/browser/source-manifest.json +1 -1
  4. package/dist/client/assets/{AboutPage-C4kqKgU6.js → AboutPage-BKzqcz_A.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-DiSxgHLa.js → ActivityErrorState-BXOZg9ve.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-BQneQ83b.js → ActivityPage-CFN2MEAV.js} +1 -1
  7. package/dist/client/assets/{ActivityRow-BEKcGUIZ.js → ActivityRow-CujXx04u.js} +1 -1
  8. package/dist/client/assets/{AdapterIcon-CyEZ9jER.js → AdapterIcon-BdM7K69W.js} +1 -1
  9. package/dist/client/assets/{AdapterSetupWizard-DpnW23lt.js → AdapterSetupWizard-3Bt9HEWF.js} +1 -1
  10. package/dist/client/assets/{AgentRequestCard-DosR0AYu.js → AgentRequestCard-CAaBGC0L.js} +1 -1
  11. package/dist/client/assets/{AppearancePage-DIeNtC-G.js → AppearancePage-BEe-Gssu.js} +1 -1
  12. package/dist/client/assets/{AttentionSignalRow-B0nSHLwZ.js → AttentionSignalRow-Cp0AJs73.js} +1 -1
  13. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-BXMeIZyY.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-CN1iW2cB.js} +1 -1
  14. package/dist/client/assets/{BlintzCanvas-D-7b_-SG.js → BlintzCanvas-B7qs2dxW.js} +1 -1
  15. package/dist/client/assets/{CanvasCsvContent-iBvH55TS.js → CanvasCsvContent-DiB5zXOC.js} +1 -1
  16. package/dist/client/assets/{CanvasFileContent-C4LA1NRl.js → CanvasFileContent-CDNfnWMW.js} +2 -2
  17. package/dist/client/assets/{CanvasModel3dContent-BqLPKItZ.js → CanvasModel3dContent-C7EINmuq.js} +2 -2
  18. package/dist/client/assets/{CodeMirrorDiff-BfF4jWmG.js → CodeMirrorDiff-BJhflpbC.js} +1 -1
  19. package/dist/client/assets/{CodeMirrorEditor-gShkyo4u.js → CodeMirrorEditor-SkdXRKSN.js} +1 -1
  20. package/dist/client/assets/{CommitmentList-Bz1qfyAm.js → CommitmentList-DsEn6iK1.js} +1 -1
  21. package/dist/client/assets/{CommitmentsPage-BFnrzM5F.js → CommitmentsPage-W5h0GjRr.js} +1 -1
  22. package/dist/client/assets/{ConnectionAccessLists-C5dmaUUD.js → ConnectionAccessLists-DVFqelmV.js} +1 -1
  23. package/dist/client/assets/{ConnectionsPage-BX_hUzvu.js → ConnectionsPage-CZhSh2mO.js} +1 -1
  24. package/dist/client/assets/{ConventionPage-DHtiOJYZ.js → ConventionPage-DcDBP-vR.js} +1 -1
  25. package/dist/client/assets/{ExtensionPageRoute-DluAWT6h.js → ExtensionPageRoute-mKN8Jqyx.js} +1 -1
  26. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-IBBeJf7u.js → FloatingTanStackRouterDevtools-CqogiFob-CGXG-x9g.js} +1 -1
  27. package/dist/client/assets/HandlePage-Bun58ePo.js +1 -0
  28. package/dist/client/assets/{HeartbeatPage-DcispKV9.js → HeartbeatPage-DFf7Udem.js} +1 -1
  29. package/dist/client/assets/{LexicalField-CvW19ipK.js → LexicalField-vJ284m2H.js} +1 -1
  30. package/dist/client/assets/{ManagesPage-Dru8_kTd.js → ManagesPage-mDuaA2JT.js} +1 -1
  31. package/dist/client/assets/{Marketplace-UEST-d72.js → Marketplace-BoiupH2Z.js} +1 -1
  32. package/dist/client/assets/{MarketplaceSourcesView-2XwWS0fF.js → MarketplaceSourcesView-krw9hUyu.js} +1 -1
  33. package/dist/client/assets/{McpAppFrame-DcPNmy1o.js → McpAppFrame-DmHduNgp.js} +1 -1
  34. package/dist/client/assets/{McpSigninBody-YXQtYFSW.js → McpSigninBody-DoY09n4J.js} +1 -1
  35. package/dist/client/assets/{Model3dViewer-D9HznL8w.js → Model3dViewer-BZEdR7-9.js} +1 -1
  36. package/dist/client/assets/NamePage-CXyClUPJ.js +1 -0
  37. package/dist/client/assets/{NewDirectMessageMenu-DNd6s2qQ.js → NewDirectMessageMenu-BjqYwnXW.js} +1 -1
  38. package/dist/client/assets/{NotificationsPage-Dg7_d0Fo.js → NotificationsPage-CybW1eIb.js} +1 -1
  39. package/dist/client/assets/{OpenMeshSwitch-Dw8ylRP7.js → OpenMeshSwitch-DrmjsCDY.js} +1 -1
  40. package/dist/client/assets/{OperatorIdentityForm-DtA4qIAR.js → OperatorIdentityForm-byU2FeSU.js} +1 -1
  41. package/dist/client/assets/{PermissionsPage-ZEO9Crz4.js → PermissionsPage-CP3kbqyJ.js} +1 -1
  42. package/dist/client/assets/{PersonalityPopover-Cv26YoDX.js → PersonalityPopover-BLsjgaum.js} +1 -1
  43. package/dist/client/assets/PhotoPage-hn5b42qN.js +1 -0
  44. package/dist/client/assets/{PreviewRefusedNotice-CLOum_3D.js → PreviewRefusedNotice-fTN8MJ1h.js} +1 -1
  45. package/dist/client/assets/{PromptSuggestionChips-BMFNtxGR.js → PromptSuggestionChips-BZOaY5Tx.js} +1 -1
  46. package/dist/client/assets/{ReportsToPopover-CR7Exvh7.js → ReportsToPopover-B6JvfRt3.js} +1 -1
  47. package/dist/client/assets/{RoomSurface-Bq7667r4.js → RoomSurface-BM0QO_av.js} +3 -3
  48. package/dist/client/assets/{RoomsPage-DGOvUZFv.js → RoomsPage-B-NOCLXC.js} +1 -1
  49. package/dist/client/assets/{RunsOnPopover-CpS43xkI.js → RunsOnPopover-D1jQQatj.js} +1 -1
  50. package/dist/client/assets/{RuntimeSetupDialog-Bh0jopL-.js → RuntimeSetupDialog-ufwCvCJB.js} +1 -1
  51. package/dist/client/assets/{SessionsPage-Zfpi_q-8.js → SessionsPage-CBE1KHYg.js} +1 -1
  52. package/dist/client/assets/{SkillsPage-cjkbMED1.js → SkillsPage-CPTFjEUe.js} +1 -1
  53. package/dist/client/assets/{TasksPage-HQqmMSc-.js → TasksPage-BRUqs3v5.js} +1 -1
  54. package/dist/client/assets/{ToolsPage-Bo2_xjXO.js → ToolsPage-C25kL822.js} +1 -1
  55. package/dist/client/assets/{TopologyGraph-Is22VGxs.js → TopologyGraph-of6Cp5Kj.js} +1 -1
  56. package/dist/client/assets/{TourHost-DxBh58jt.js → TourHost-zwSilkjm.js} +1 -1
  57. package/dist/client/assets/{UnlinkDialog-B70UThXm.js → UnlinkDialog-BgwHAqdW.js} +1 -1
  58. package/dist/client/assets/{WidgetErrorCard-l8cP9oJc.js → WidgetErrorCard-BQwrR6PJ.js} +6 -6
  59. package/dist/client/assets/{_shell-pedi36wq.js → _shell-bcx2y7VT.js} +1 -1
  60. package/dist/client/assets/{_shell._home-9g2nykRD.js → _shell._home-BkP0NafS.js} +1 -1
  61. package/dist/client/assets/{_shell._home.activity-M0V2vwFy.js → _shell._home.activity-BO_2ciGK.js} +1 -1
  62. package/dist/client/assets/{_shell._home.index-8qVMuOhT.js → _shell._home.index-B-OFwU9u.js} +1 -1
  63. package/dist/client/assets/{_shell._home.tasks-fGzbxCP4.js → _shell._home.tasks-jAQczH7j.js} +1 -1
  64. package/dist/client/assets/{_shell._home.workspaces-BSeaYQDz.js → _shell._home.workspaces-B34Uk1SP.js} +1 -1
  65. package/dist/client/assets/{_shell.channels-DwyPOJGL.js → _shell.channels-CGzsxvXD.js} +1 -1
  66. package/dist/client/assets/_shell.connections-BNbeBrxQ.js +1 -0
  67. package/dist/client/assets/{_shell.feedback-requests-BPwtAQNY.js → _shell.feedback-requests-B71l48KB.js} +1 -1
  68. package/dist/client/assets/_shell.marketplace-3YAsNaRk.js +1 -0
  69. package/dist/client/assets/_shell.marketplace_.sources-cI3nNBXr.js +1 -0
  70. package/dist/client/assets/_shell.session-ybAc0bwn.js +66 -0
  71. package/dist/client/assets/{_shell.team-DKZ4y6kn.js → _shell.team-BE_60YS4.js} +3 -3
  72. package/dist/client/assets/_shell.x._extensionId-jiyP599c.js +1 -0
  73. package/dist/client/assets/_shell.x._extensionId_._-jiyP599c.js +1 -0
  74. package/dist/client/assets/{agent-browser-CSBlgMiw.js → agent-browser-Cs8abkZs.js} +1 -1
  75. package/dist/client/assets/{banner-D26eekSD.js → banner-CU2Nh3Kv.js} +1 -1
  76. package/dist/client/assets/{card-CTGm0Blo.js → card-BTgwskmX.js} +1 -1
  77. package/dist/client/assets/{file-B6neiwXF.js → file-DlQX-hKl.js} +1 -1
  78. package/dist/client/assets/{file-exclamation-point-B-iziRzy.js → file-exclamation-point-Dg2iCyPM.js} +1 -1
  79. package/dist/client/assets/{find-latest-widget-fence-Dw4BJ_cR.js → find-latest-widget-fence-BGiexm6r.js} +1 -1
  80. package/dist/client/assets/{git-branch-D9jctpSd.js → git-branch-Dq_w3Iyx.js} +1 -1
  81. package/dist/client/assets/{heart-cgLUdSV5.js → heart-Bp14wOx6.js} +1 -1
  82. package/dist/client/assets/{highlighted-body-KPVGNVTW-CEOricmN.js → highlighted-body-KPVGNVTW-kD1HK_wk.js} +1 -1
  83. package/dist/client/assets/{index-DcqBUr0N.js → index--3UwFg2s.js} +1 -1
  84. package/dist/client/assets/{index-CVzwL_3n.js → index-5OyUurJr.js} +1 -1
  85. package/dist/client/assets/{index-CUu6WsiU.js → index-B0OZehWe.js} +1 -1
  86. package/dist/client/assets/{index-BWnfydnq.js → index-B2JJZXsq.js} +1 -1
  87. package/dist/client/assets/{index-ZNJbhnlq.js → index-B6_ikFYj.js} +1 -1
  88. package/dist/client/assets/{index-1flHw44u.js → index-B8R78Nnj.js} +2 -2
  89. package/dist/client/assets/{index-bHlg-Jp8.js → index-BA-nPsLw.js} +1 -1
  90. package/dist/client/assets/{index-jD4A_p4E.js → index-BAjUSKoJ.js} +1 -1
  91. package/dist/client/assets/{index-CiIZQZuK.js → index-BHsZlKfx.js} +1 -1
  92. package/dist/client/assets/{index-BO2LMWbR.js → index-BeBmUxo_.js} +1 -1
  93. package/dist/client/assets/index-BpDY3eoD.js +1 -0
  94. package/dist/client/assets/{index-CqHifKay.js → index-BxUoa3yn.js} +1 -1
  95. package/dist/client/assets/{index-CLuxURdA.js → index-BxrZwUJp.js} +1 -1
  96. package/dist/client/assets/{index-vkTtWH-G.js → index-C-DN0Vg_.js} +1 -1
  97. package/dist/client/assets/{index-ClIP6HHR.js → index-C99173Ze.js} +1 -1
  98. package/dist/client/assets/{index-DKjP63zN.js → index-CAhJGlSW.js} +1 -1
  99. package/dist/client/assets/{index-CeCuaX5y.js → index-CDWsIVX7.js} +1 -1
  100. package/dist/client/assets/{index-tf4Y0hYZ.js → index-CKCMjqcu.js} +1 -1
  101. package/dist/client/assets/{index-K2hqr6x6.js → index-C_uYJzKi.js} +3 -3
  102. package/dist/client/assets/{index-CupP-VJi.js → index-Cc280M3V.js} +1 -1
  103. package/dist/client/assets/{index-D4em25Xt.js → index-CcV9S7cO.js} +1 -1
  104. package/dist/client/assets/{index-Bkfi8Myj.js → index-DHUToGjI.js} +1 -1
  105. package/dist/client/assets/{index-LP8S5WuT.js → index-DKQDBIWq.js} +1 -1
  106. package/dist/client/assets/{index-BfgOj4sK.js → index-DKlxz3u7.js} +1 -1
  107. package/dist/client/assets/{index-CBQqdBKL.js → index-DNglWRBB.js} +1 -1
  108. package/dist/client/assets/{index-CbDB1su1.js → index-DO6a5Hey.js} +1 -1
  109. package/dist/client/assets/{index-DQDCxGNh.js → index-DS-thlE8.js} +1 -1
  110. package/dist/client/assets/{index-CsjcT6BA.js → index-DSPs6GF4.js} +1 -1
  111. package/dist/client/assets/{index-DMmU6ZLq.js → index-DW6zqLoM.js} +1 -1
  112. package/dist/client/assets/{index-_nhqr_iZ.js → index-Dm53S0up.js} +1 -1
  113. package/dist/client/assets/{index-DckajKF2.js → index-DnmtTIUB.js} +1 -1
  114. package/dist/client/assets/{index-BZKMWkth.js → index-Dr-0P6rd.js} +239 -234
  115. package/dist/client/assets/{index-CGLE5zMG.js → index-F7Lcwnfm.js} +1 -1
  116. package/dist/client/assets/{index-B38pxhxw.js → index-LszRbEbX.js} +1 -1
  117. package/dist/client/assets/{index-lKqCjbqn.js → index-PxSRtDpP.js} +1 -1
  118. package/dist/client/assets/{index-BkYvXnXR.js → index-aDNEGBTK.js} +1 -1
  119. package/dist/client/assets/{index-C3tcDwG6.js → index-gu2JYnOq.js} +1 -1
  120. package/dist/client/assets/{index-BfDqp5Sv.js → index-kHXlTLUx.js} +7 -7
  121. package/dist/client/assets/{index-CSQHKTvU.js → index-knGXyHhh.js} +1 -1
  122. package/dist/client/assets/{kickoff-D-oHin9P.js → kickoff-Btbza7bw.js} +1 -1
  123. package/dist/client/assets/{layers-BpMm7sp6.js → layers-B0oCOfxz.js} +1 -1
  124. package/dist/client/assets/{lightbulb-CxP8HLlU.js → lightbulb-D80IzMqz.js} +1 -1
  125. package/dist/client/assets/{markdown-content-plNIomQc.js → markdown-content-aNzh-54y.js} +1 -1
  126. package/dist/client/assets/{mention-pill-B9c_KFvY.js → mention-pill-BxMK0xuY.js} +1 -1
  127. package/dist/client/assets/{message-square-off-8wAP6cRG.js → message-square-off-D-CJXmTq.js} +1 -1
  128. package/dist/client/assets/{owner-notice-CopwUeso.js → owner-notice-BkrTEMDm.js} +1 -1
  129. package/dist/client/assets/{package-B7amjGSw.js → package-CoTlAnXZ.js} +1 -1
  130. package/dist/client/assets/{page-container-DMx2f-Ca.js → page-container-CPxW5T9E.js} +1 -1
  131. package/dist/client/assets/{paperclip-CA9pcNn6.js → paperclip-Cj1P85mz.js} +1 -1
  132. package/dist/client/assets/{radio-B4GY45ie.js → radio-DICkTr_p.js} +1 -1
  133. package/dist/client/assets/{room-files-source-91oNy8mM.js → room-files-source-BywWQPBN.js} +1 -1
  134. package/dist/client/assets/{rotate-ccw-clock-C-ftj_rU.js → rotate-ccw-clock-cx5RyP4l.js} +1 -1
  135. package/dist/client/assets/{rotate-cw-TrlUqVdq.js → rotate-cw-DrGRGSwy.js} +1 -1
  136. package/dist/client/assets/{scroll-area-DKse0rZa.js → scroll-area-XlDz8u4m.js} +1 -1
  137. package/dist/client/assets/{search-x-DvMuhABO.js → search-x-LIKnWE64.js} +1 -1
  138. package/dist/client/assets/{shield-x-ZcQ8NB0Z.js → shield-x-DioB6qH_.js} +1 -1
  139. package/dist/client/assets/{soul-file-B_MwZHvh.js → soul-file-C7YgkNET.js} +1 -1
  140. package/dist/client/assets/{table-BJDpTBxJ.js → table-P4N5xQn2.js} +1 -1
  141. package/dist/client/assets/{use-connector-management-BZ-sfu8O.js → use-connector-management-pgVHbXoO.js} +1 -1
  142. package/dist/client/assets/{use-delete-binding-XWrr4lIB.js → use-delete-binding-DxEiOjjh.js} +1 -1
  143. package/dist/client/assets/{use-dev-links-daERqZ4e.js → use-dev-links-BImQrE6g.js} +1 -1
  144. package/dist/client/assets/{use-external-adapter-catalog-DE5zmChu.js → use-external-adapter-catalog-D8KHMSZU.js} +1 -1
  145. package/dist/client/assets/{use-full-activity-feed-DkDB2i0G.js → use-full-activity-feed-2o7GNAMe.js} +1 -1
  146. package/dist/client/assets/use-is-below-desktop-DBet5zg_.js +1 -0
  147. package/dist/client/assets/{use-jump-back-in-Dm-2B4la.js → use-jump-back-in-D9tBJ4v5.js} +1 -1
  148. package/dist/client/assets/{use-mesh-topology-DXFAk9hJ.js → use-mesh-topology-DBeqzUoy.js} +1 -1
  149. package/dist/client/assets/use-pending-read-DmrlNHS0.js +1 -0
  150. package/dist/client/assets/{use-personality-commit-CgQm9Y7m.js → use-personality-commit-Gfoi__sT.js} +1 -1
  151. package/dist/client/assets/{use-promo-activation-CZMwcIvl.js → use-promo-activation-Bv1gnqKq.js} +1 -1
  152. package/dist/client/assets/{use-pulse-freshness-CKzRoyfz.js → use-pulse-freshness-SFRdnugS.js} +1 -1
  153. package/dist/client/assets/{use-room-follow-claim-TvE0bgPq.js → use-room-follow-claim-Cf20JiJ_.js} +1 -1
  154. package/dist/client/assets/{use-roving-tab-list-DlrB639e.js → use-roving-tab-list-3Pb7ps4E.js} +1 -1
  155. package/dist/client/assets/{use-session-canvas-8hTR83y8.js → use-session-canvas-BaXuEhw8.js} +4 -4
  156. package/dist/client/assets/{use-session-diagnostics-DAd4CfKM.js → use-session-diagnostics-7xxJ6zQQ.js} +1 -1
  157. package/dist/client/assets/{use-unclaimed-chats-DKLFamqB.js → use-unclaimed-chats-D4k-EK_f.js} +1 -1
  158. package/dist/client/index.html +1 -1
  159. package/dist/server/index.js +865 -216
  160. package/dist/server/index.js.map +2 -2
  161. package/package.json +3 -3
  162. package/dist/client/assets/HandlePage-CjinTYw3.js +0 -1
  163. package/dist/client/assets/NamePage-D5q8YN0G.js +0 -1
  164. package/dist/client/assets/PhotoPage-BYtfMHJD.js +0 -1
  165. package/dist/client/assets/_shell.connections-DQ8AztAx.js +0 -6
  166. package/dist/client/assets/_shell.marketplace-CiM3PSqV.js +0 -1
  167. package/dist/client/assets/_shell.marketplace_.sources-C5u-WJmL.js +0 -1
  168. package/dist/client/assets/_shell.session-DYCz4inz.js +0 -66
  169. package/dist/client/assets/_shell.x._extensionId-C1fzIfH4.js +0 -1
  170. package/dist/client/assets/_shell.x._extensionId_._-C1fzIfH4.js +0 -1
  171. package/dist/client/assets/index-AYHwV9IU.js +0 -1
  172. package/dist/client/assets/use-is-below-desktop-B-Dt4c9S.js +0 -1
  173. package/dist/client/assets/use-pending-read-CH_0XPYp.js +0 -1
@@ -1,4 +1,4 @@
1
- import{nl as Wn,nm as Pn,nn as Bn,no as Fn,np as Vn,nq as At,nr as Mt,ns as Gn,nt as Un,nu as Kn,nv as Hn,nw as Yn,nx as qn,ny as Qn,nz as Xn,nA as Zn,nB as Jn,nC as es,nD as Ne,nE as ts,nF as ns,nG as ss,nH as as,a4 as $,r as g,L as y,Q as h,T as M,nI as rs,nJ as z,kn as Be,R as L,ft as ae,nK as Ae,O as Fe,nL as _t,_ as K,N as Se,nM as is,nN as re,nO as os,nP as cs,nQ as ls,nR as ds,kx as us,kv as fs,nS as ps,ic as ms,ae as hs,nT as Te,nU as gs,nV as Et,aN as xs,ih as ys,j as n,fm as bs,fn as vs,dc as js,nW as ks,nX as Ns,gV as It,ke as Ss,kS as ws,a3 as b,Z as E,bX as Cs,eW as De,g_ as As,c0 as Ms,bv as _s,eX as Es,nY as Is,lW as Ts,iD as Tt,cR as $s,nZ as Ds,iY as Ls,fP as Os,fp as Rs,n_ as zs,b3 as Ws,n$ as Ps,bk as Bs,g$ as Fs,e1 as Vs,b2 as Gs,$ as Ve,o0 as Us,gZ as Ks,mm as Hs,at as $t,bw as Ys,B as Dt,e3 as Ge,dY as qs,dZ as Qs,d_ as Xs,d$ as Zs,e0 as Js,I as ea,F as ta,k5 as Lt,cr as Ot,cs as Rt,ct as zt,o1 as Wt,cQ as Pt,ix as na,X as sa,o2 as aa,C as ra}from"./index-BZKMWkth.js";import{C as Bt,a as ia,b as oa,c as ca,d as la,e as da}from"./card-CTGm0Blo.js";import{M as ua}from"./markdown-content-plNIomQc.js";import{T as Ft,d as Vt,b as Me,e as Le,c as Oe,a as Gt}from"./table-BJDpTBxJ.js";import{P as fa}from"./package-B7amjGSw.js";import{H as pa}from"./heart-cgLUdSV5.js";import{G as ma}from"./git-branch-D9jctpSd.js";import{F as ha}from"./file-B6neiwXF.js";const ga=(e,t,s)=>{const a=t-e;return((s-e)%a+a)%a+e};function Ut(e,t){return Wn(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 Pn{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 Bn()}build(t,s){Object.assign(t.output,s)}renderInstance(t,{output:s}){Object.assign(t,s)}sortInstanceNodePosition(){return 0}}function Ue(e){return typeof e=="object"&&!Array.isArray(e)}function Kt(e,t,s,a){return e==null?[]:typeof e=="string"&&Ue(t)?Fn(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:Vn(r,o,a[i]),easing:Ut(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 Ma(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,_={}]=S;_.at!==void 0&&(p=ct(p,_.at,m,u));let N=0;const C=(l,f,x,T=0,R=0)=>{const w=_a(l),{delay:O=0,times:I=Gn(w),type:B=t.type||"keyframes",repeat:Y,repeatType:V,repeatDelay:G=0,...U}=f;let{ease:D=t.ease||"easeOut",duration:F}=f;const ye=typeof O=="function"?O(T,R):O,Qe=w.length,Xe=Yn(B)?B:r==null?void 0:r[B||"keyframes"];if(Qe<=2&&Xe){let ne=100;if(Qe===2&&Ta(w)){const ue=w[1]-w[0];ne=Math.abs(ue)}const se={...t,...U};F!==void 0&&(se.duration=qn(F));const be=Un(se,ne,Xe);D=be.ease,F=be.duration}F??(F=o);const Ze=p+ye;I.length===1&&I[0]===0&&(I[1]=1);const Je=I.length-w.length;if(Je>0&&Kn(I,Je),w.length===1&&w.unshift(null),Y&&Y<Aa){const ne=F>0?G/F:0;F=ja(F,Y,G);const se=[...w],be=[...I];D=Array.isArray(D)?[...D]:[D];const ue=[...D],tt=V==="reverse"||V==="mirror";let nt=se,st=ue;tt&&(nt=[...se].reverse(),V==="reverse"&&(st=[...ue].reverse().map(Q=>typeof Q=="function"?Hn(Q):Q)));for(let Q=0;Q<Y;Q++){const at=tt&&Q%2===0,rt=at?nt:se,zn=at?st:ue,it=(Q+1)*(1+ne);ne>0&&(w.push(w[w.length-1]),I.push(it),D.push("linear")),w.push(...rt);for(let fe=0;fe<rt.length;fe++)I.push(be[fe]+it),D.push(fe===0?"linear":Ut(zn,fe-1))}Sa(I,Y,ne)}const et=Ze+F;Na(x,w,D,I,Ze,et),N=Math.max(ye+F,N),v=Math.max(et,v)};if(Mt(j)){const l=lt(j,c);C(A,_,dt("default",l))}else{const l=Kt(j,A,a,d),f=l.length;for(let x=0;x<f;x++){A=A,_=_;const T=l[x],R=lt(T,c);for(const w in A)C(A[w],Ea(_,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 _=[],N=[],C=[];for(let T=0;T<A.length;T++){const{at:R,value:w,easing:O}=A[T];_.push(w),N.push(Qn(0,v,R)),C.push(O||"easeOut")}N[0]!==0&&(N.unshift(0),_.unshift(_[0]),C.unshift(Ca)),N[N.length-1]!==1&&(N.push(1),_.push(null)),i.has(S)||i.set(S,{keyframes:{},transition:{}});const l=i.get(S);l.keyframes[j]=_;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 _a(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)&&!Zn(e)?new Jn(t):new es(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 Mt(e)||typeof e=="number"||typeof e=="string"&&!Ue(t)}function Ht(e,t,s,a){const r=[];if(La(e,t))r.push(ts(e,Ue(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(...ns(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=ss(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 Ma(r,t,s,{spring:as}).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();/**
1
+ import{nm as Wn,nn as Pn,no as Bn,np as Fn,nq as Vn,nr as At,ns as Mt,nt as Gn,nu as Un,nv as Kn,nw as Hn,nx as Yn,ny as qn,nz as Xn,nA as Qn,nB as Zn,nC as Jn,nD as es,nE as Ne,nF as ts,nG as ns,nH as ss,nI as as,a4 as $,r as g,L as y,Q as h,T as M,nJ as rs,nK as z,ko as Be,R as L,ft as ae,nL as Ae,O as Fe,nM as _t,_ as K,N as Se,nN as is,nO as re,nP as os,nQ as cs,nR as ls,nS as ds,ky as us,kw as fs,nT as ps,ic as ms,ae as hs,nU as Te,nV as gs,nW as Et,aN as xs,ih as ys,j as n,fm as bs,fn as vs,dc as js,nX as ks,nY as Ns,gV as It,kf as Ss,kT as ws,a3 as b,Z as E,bX as Cs,eW as De,g_ as As,c0 as Ms,bv as _s,eX as Es,nZ as Is,lX as Ts,iD as Tt,cR as $s,n_ as Ds,iY as Ls,fP as Os,fp as Rs,n$ as zs,b3 as Ws,o0 as Ps,bk as Bs,g$ as Fs,e1 as Vs,b2 as Gs,$ as Ve,o1 as Us,gZ as Ks,mn as Hs,at as $t,bw as Ys,B as Dt,e3 as Ge,dY as qs,dZ as Xs,d_ as Qs,d$ as Zs,e0 as Js,I as ea,F as ta,k5 as Lt,cr as Ot,cs as Rt,ct as zt,o2 as Wt,cQ as Pt,ix as na,X as sa,o3 as aa,C as ra}from"./index-Dr-0P6rd.js";import{C as Bt,a as ia,b as oa,c as ca,d as la,e as da}from"./card-BTgwskmX.js";import{M as ua}from"./markdown-content-aNzh-54y.js";import{T as Ft,d as Vt,b as Me,e as Le,c as Oe,a as Gt}from"./table-P4N5xQn2.js";import{P as fa}from"./package-CoTlAnXZ.js";import{H as pa}from"./heart-Bp14wOx6.js";import{G as ma}from"./git-branch-Dq_w3Iyx.js";import{F as ha}from"./file-DlQX-hKl.js";const ga=(e,t,s)=>{const a=t-e;return((s-e)%a+a)%a+e};function Ut(e,t){return Wn(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 Pn{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 Bn()}build(t,s){Object.assign(t.output,s)}renderInstance(t,{output:s}){Object.assign(t,s)}sortInstanceNodePosition(){return 0}}function Ue(e){return typeof e=="object"&&!Array.isArray(e)}function Kt(e,t,s,a){return e==null?[]:typeof e=="string"&&Ue(t)?Fn(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:Vn(r,o,a[i]),easing:Ut(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 Ma(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,_={}]=S;_.at!==void 0&&(p=ct(p,_.at,m,u));let N=0;const C=(l,f,x,T=0,R=0)=>{const w=_a(l),{delay:O=0,times:I=Gn(w),type:B=t.type||"keyframes",repeat:Y,repeatType:V,repeatDelay:G=0,...U}=f;let{ease:D=t.ease||"easeOut",duration:F}=f;const ye=typeof O=="function"?O(T,R):O,Xe=w.length,Qe=Yn(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,...U};F!==void 0&&(se.duration=qn(F));const be=Un(se,ne,Qe);D=be.ease,F=be.duration}F??(F=o);const Ze=p+ye;I.length===1&&I[0]===0&&(I[1]=1);const Je=I.length-w.length;if(Je>0&&Kn(I,Je),w.length===1&&w.unshift(null),Y&&Y<Aa){const ne=F>0?G/F:0;F=ja(F,Y,G);const se=[...w],be=[...I];D=Array.isArray(D)?[...D]:[D];const ue=[...D],tt=V==="reverse"||V==="mirror";let nt=se,st=ue;tt&&(nt=[...se].reverse(),V==="reverse"&&(st=[...ue].reverse().map(X=>typeof X=="function"?Hn(X):X)));for(let X=0;X<Y;X++){const at=tt&&X%2===0,rt=at?nt:se,zn=at?st:ue,it=(X+1)*(1+ne);ne>0&&(w.push(w[w.length-1]),I.push(it),D.push("linear")),w.push(...rt);for(let fe=0;fe<rt.length;fe++)I.push(be[fe]+it),D.push(fe===0?"linear":Ut(zn,fe-1))}Sa(I,Y,ne)}const et=Ze+F;Na(x,w,D,I,Ze,et),N=Math.max(ye+F,N),v=Math.max(et,v)};if(Mt(j)){const l=lt(j,c);C(A,_,dt("default",l))}else{const l=Kt(j,A,a,d),f=l.length;for(let x=0;x<f;x++){A=A,_=_;const T=l[x],R=lt(T,c);for(const w in A)C(A[w],Ea(_,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 _=[],N=[],C=[];for(let T=0;T<A.length;T++){const{at:R,value:w,easing:O}=A[T];_.push(w),N.push(Xn(0,v,R)),C.push(O||"easeOut")}N[0]!==0&&(N.unshift(0),_.unshift(_[0]),C.unshift(Ca)),N[N.length-1]!==1&&(N.push(1),_.push(null)),i.has(S)||i.set(S,{keyframes:{},transition:{}});const l=i.get(S);l.keyframes[j]=_;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 _a(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=Qn(e)&&!Zn(e)?new Jn(t):new es(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 Mt(e)||typeof e=="number"||typeof e=="string"&&!Ue(t)}function Ht(e,t,s,a){const r=[];if(La(e,t))r.push(ts(e,Ue(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(...ns(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=ss(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 Ma(r,t,s,{spring:as}).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.
@@ -13,12 +13,12 @@ import{nl as Wn,nm as Pn,nn as Bn,no as Fn,np as Vn,nq as At,nr as Mt,ns as Gn,n
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 Qt={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"}]]};Qt.node;const Fa=$(Qt);/**
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=$(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 Xt={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"}]]};Xt.node;const Va=$(Xt);/**
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=$(Qt);/**
22
22
  * @license lucide-react v1.48.0 - ISC
23
23
  *
24
24
  * This source code is licensed under the ISC license.
@@ -53,12 +53,12 @@ import{nl as Wn,nm as Pn,nn as Bn,no as Fn,np as Vn,nq as At,nr as Mt,ns as Gn,n
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 Qa=$(an);/**
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=$(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 Xa=$(rn);/**
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=$(rn);/**
62
62
  * @license lucide-react v1.48.0 - ISC
63
63
  *
64
64
  * This source code is licensed under the ISC license.
@@ -110,4 +110,4 @@ import{nl as Wn,nm as Pn,nn as Bn,no as Fn,np as Vn,nq as At,nr as Mt,ns as Gn,n
110
110
  * See the LICENSE file in the root directory of this source tree.
111
111
  */const gn={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"}]]};gn.node;const or=$(gn),xn=g.createContext(void 0),cr=xn.Provider;function lr(){return g.useContext(xn)}const dr=/[\u0000-\u001f\u007f-\u009f]+/g;function yn(e,t){const s=new RegExp(`<\\s*/\\s*${t}`,"gi");return e.replace(s,`<\\/${t}`)}function $e(e,t){return yn(e.replace(dr," ").trim(),t)}const ie="ui_action";function ur(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:
112
112
  ${yn(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(`
113
- `)}const fr=K(["default","success","warning","error","info"]),bn=y({kind:M("agent"),id:h().min(1),label:h().optional(),payload:_t(h(),ls()).optional()}),vn=y({kind:M("emit"),type:ds,payload:us.optional(),coalesceKey:h().min(1).max(128).optional()}).strict(),ut=Be("kind",[bn,vn]),Re=Be("kind",[bn,vn,y({kind:M("ui"),command:cs}),y({kind:M("url"),href:h().url().refine(e=>e.startsWith("https://"),{message:"Widget URLs must be https"})})]),ft=Ae([h(),Fe(),Se(),os()]),pr=["sm","md","lg"],pt={sm:4,md:12};function mr(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 hr=z(mr,K(pr));function Z(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(Z({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"}),fr),gr=z(Z({vertical:"vertical",vert:"vertical",column:"vertical",col:"vertical",stack:"vertical",horizontal:"horizontal",horiz:"horizontal",row:"horizontal",inline:"horizontal"}),K(["vertical","horizontal"])),xr=z(Z({default:"default",primary:"default",secondary:"secondary",destructive:"destructive",danger:"destructive",delete:"destructive",outline:"outline",ghost:"outline",link:"outline"}),K(["default","secondary","destructive","outline"])),yr=z(Z({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"])),br=z(Z({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"])),vr=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)])),jr=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:br.default("flat")})),kr=z(e=>typeof e=="string"?{text:e}:e,y({text:h(),tone:Ke.optional()})),Nr=z(Z({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()),Sr=z(Z({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"])),wr=z(Z({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"])),Cr=z(e=>typeof e=="number"?String(e):e,h()),ht=12;function Ar(e){return typeof e!="string"?e:e.trim()===""?{}:{glyph:e}}const Mr=h().max(8).optional().transform(e=>{const t=e==null?void 0:e.trim();return t||void 0}),_r=z(Ar,y({glyph:Mr,icon:h().optional(),tone:Ke.optional(),action:Re.optional()})),Er=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=rs(()=>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."}),is}return e},Be("type",[y({type:M("stack"),direction:gr,gap:hr.optional(),children:L(pe)}),y({type:M("card"),title:h().optional(),description:h().optional(),children:L(pe),footer:L(pe).optional()}),y({type:M("divider")}),y({type:M("heading"),text:h(),level:vr.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(),Fe()]),delta:jr.optional(),hint:h().optional(),trend:L(ae().finite()).max(50).optional()}),y({type:M("keyValue"),items:L(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:L(y({key:h(),label:h(),align:K(["left","center","right"]).optional()})),rows:L(_t(h(),ft))}),y({type:M("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:kr.optional(),actions:L(Re).optional()}))}),y({type:M("chart"),bind:ee.chart.optional(),kind:yr,data:L(y({label:h(),value:ae().finite().min(0)})),height:ae().finite().positive().optional()}),y({type:M("button"),label:h(),variant:xr.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:L(y({label:h(),value:h()}))}),y({type:M("form"),children:L(pe),submit:y({label:h(),action:ut})}),y({type:M("timeline"),items:L(y({time:h().optional(),title:h(),subtitle:h().optional(),icon:h().optional(),status:Nr.optional()})).min(1)}),y({type:M("checklist"),items:L(y({label:h(),checked:mt.optional(),note:h().optional()})),action:ut.optional(),submitLabel:h().optional()}),y({type:M("compare"),options:L(y({name:h(),recommended:mt.optional()})).min(1),rows:L(y({label:h(),values:L(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:Sr,message:h().optional()}),y({type:M("board"),rows:Er,label:h().optional()}),y({type:M("reveal"),kind:wr,result:Cr,label:h().optional()})]))),Ir=y({version:M(1),title:h().optional(),root:pe});function ze(e){return e.some(t=>ps(t,"widget.action"))}const Tr=100,$r=3e4;function jn(e){if(e!==null&&typeof e=="object"){for(const t of Object.values(e))jn(t);Object.freeze(e)}return e}function Dr(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,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())},$r),!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 D=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:D});return}catch(D){if(!I()||!I())return;throw D}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)??[]],G=!l.value.normalized||ze(V);if(!I())return;if(!G){j(l,{phase:"review",message:"Document approval changed. Review this action before trying again."});return}if(!B("submit"))return;l.uncertain=!0;const U=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:U})}catch(V){if(!I())return;const G=V.status;if(!I())return;const U=G!==void 0&&[400,401,403,404,409,413,422].includes(G),D=!f&&U;l.uncertain=f||!D,j(l,{phase:D?"refused":U?"review":"retry",message:D?"This action could not be saved. Review the document before trying again.":U?"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 G;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=fs.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=(G=x.captureOriginal)==null?void 0:G.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>=Tr){const U=[...r.current.values()].find(D=>{var F;return D.value.phase==="refused"||D.value.phase==="accepted"&&((F=D.value.receipt)==null?void 0:F.deliveries.every(ye=>["handled","rejected","turn_done","expired","failed","cancelled","superseded","unavailable"].includes(ye.status)))});if(!U)throw new Error("Too many actions are waiting. Try again after they finish.");if(r.current.delete(U.value.event.id),p(U),!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:jn(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 kn=g.createContext("root"),Lr=kn.Provider;function J(){return g.useContext(kn)}function Nn(e){return e.id+":"+JSON.stringify(e.payload??null)}const gt=()=>Promise.resolve(),Sn=g.createContext({onAction:gt,hasSession:!1,channelRecords:[],channelPending:()=>!1,retryChannel:gt,superseded:!1,latched:!1,dispatchedActionKey:null,dispatchStatus:"idle"});function Or({children:e,channel:t,sessionId:s,widgetTitle:a,isLatestMessage:r=!0}){const{setTheme:o}=ms(),i=hs(),c=Dr(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:xs.getState,setTheme:o,supportsTerminal:i.supportsTerminal,celebrationOrigin:A==null?void 0:A.origin,sessionId:s};ys(_,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:ur(_)}),N.setTriggerPending(s,!0);const C=Nn(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)},gs.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(Sn.Provider,{value:S,children:[e,n.jsx(bs,{url:d??"",isOpen:d!==null,onClose:()=>u(null),onConfirm:()=>{d&&vs(d),u(null)}})]})}function ge(){return g.useContext(Sn)}function wn(e,t){var N;const s=J(),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"?Nn(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!js()}function Cn(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 An=new Set(["__proto__","prototype","constructor"]),Rr={text:["text"],stat:["value"],progress:["value","label"],table:["rows"],chart:["data"]},zr=100,xt=50,Wr=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 Pr(e,t){if(!oe(e)||!ks.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(An.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=Wr){return typeof e=="string"&&e.length<=t}function ke(e){return typeof e=="number"&&Number.isFinite(e)}function Br(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>zr)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(An.has(u)||!a.has(u))throw new Error("column");const m=X(i,u);if(!Br(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 Vr(e,t){if(!("bind"in e)||e.bind===void 0)return{node:e};const s=Rr[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,Pr(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 Mn=g.createContext(null),Gr=Mn.Provider;function _n(){return g.useContext(Mn)}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 Kr(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 Hr(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 Yr={1:"text-lg font-semibold",2:"text-base font-semibold",3:"text-sm font-semibold"};function qr({node:e}){const t=e.level??3,s=E(Yr[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(ua,{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 Zr(){return n.jsx(Cs,{})}const Jr={up:ws,down:Ss,flat:It},ei={up:"text-status-success",down:"text-status-error",flat:"text-muted-foreground"};function ti({node:e}){const t=W(),s=Kr(e.value),a=Cn((s==null?void 0:s.value)??0,t&&s!==null),r=s?Hr(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",ei[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(ni,{values:e.trend})]}),e.hint&&n.jsx("span",{className:"text-muted-foreground text-xs",children:e.hint})]})}function ni({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 si({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 ai({node:e}){const t=W(),s=Cn(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(Ns,{value:s})]})}function ri({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 ii=b.create(Gt),oi=b.create(Me),yt={left:"text-left",center:"text-center",right:"text-right"};function ci(e){return e===null?"—":typeof e=="boolean"?e?"Yes":"No":String(e)}function li({node:e}){const t=W();return n.jsx("div",{className:"overflow-x-auto",children:n.jsxs(Ft,{children:[n.jsx(Vt,{children:n.jsx(Me,{children:e.columns.map(s=>n.jsx(Le,{className:E(s.align&&yt[s.align]),children:s.label},s.key))})}),n.jsx(ii,{variants:t?_e:void 0,initial:t?"hidden":!1,animate:t?"visible":!1,children:e.rows.map((s,a)=>n.jsx(oi,{variants:t?xe:void 0,children:e.columns.map(r=>n.jsx(Oe,{className:E("tabular-nums",r.align&&yt[r.align]),children:ci(s[r.key]??null)},r.key))},a))})]})})}const di={"alert-circle":Ys,"alert-triangle":$t,archive:Hs,"arrow-right":It,bell:Ks,bookmark:Pa,calendar:Us,check:Ve,"check-circle":Ba,circle:De,clock:Gs,cloud:Fa,code:Va,cog:Ga,database:Ka,file:ha,"file-text":er,flag:tr,folder:Vs,"git-branch":ma,globe:Fs,heart:pa,home:nr,info:Bs,link:Ps,lock:Ws,mail:zs,"map-pin":sr,"message-square":Rs,package:fa,play:Os,rocket:ar,search:Ls,server:Ds,settings:$s,star:Tt,tag:rr,terminal:Ts,"thumbs-up":Is,trash:Es,"trending-down":ir,"trending-up":or,user:_s,users:Ms,zap:As};function qe(e){if(!e)return De;const t=e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/\s+/g,"-").toLowerCase();return di[t]??De}function ui(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 En({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}: `:"",ui(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=J(),u=r??d,m=e.kind==="emit"||e.kind==="agent"&&c!==void 0,p=wn(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(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:_,className:E(a&&"w-full",j&&"cursor-default",(p.unavailable||p.superseded)&&"opacity-50",S&&"opacity-70"),children:[k&&n.jsx(ta,{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(En,{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 fi({node:e}){return n.jsx(Ie,{action:e.action,label:e.label,variant:e.variant})}function pi({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(Ge,{htmlFor:s,children:e.label}),n.jsx(ea,{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 mi({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(Ge,{htmlFor:a,children:e.label}),n.jsxs(qs,{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(Xs,{placeholder:"Select…"})}),n.jsx(Zs,{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 hi({node:e}){const t=W(),s=J();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":gi(i)},c))})]},r)})})}function gi(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))"],xi=180,yi=.15;function bi({node:e}){const t=e.height??xi,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(ji,{data:e.data,height:t,label:s}):e.kind==="pie"?n.jsx(Si,{data:e.data,height:t,label:s}):n.jsx(ki,{data:e.data,height:t,area:e.kind==="area",label:s})}const vi=18;function ji({data:e,height:t,label:s}){const a=W(),r=Math.max(...e.map(i=>i.value),0)||1,o=Math.max(0,t-vi);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(In,{data:e})]})}function ki({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:yi}),n.jsx("polyline",{points:c,fill:"none",stroke:u,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"})]})]}),n.jsx(In,{data:e})]})}const Ni=359.99;function Si({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>=Ni;return{d:i,full:p,path:p?"":wi(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 In({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 wi(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 Ci={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 Ai({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",Ci[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 Mi({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(na,{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(Ge,{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(Gt),Ei=b.create(Me);function Ii({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(sa,{className:"text-muted-foreground mx-auto size-4","aria-label":"No"}):n.jsx("span",{className:"tabular-nums",children:String(e)})}function Ti({node:e}){const t=W();return n.jsx("div",{className:"overflow-x-auto",children:n.jsxs(Ft,{children:[n.jsx(Vt,{children:n.jsxs(Me,{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?_e:void 0,initial:t?"hidden":!1,animate:t?"visible":!1,children:e.rows.map((s,a)=>n.jsxs(Ei,{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(Ii,{value:s.values[o]??null})},o))]},a))})]})})}const We=5,$i=Array.from({length:We});function vt({className:e}){return n.jsx("div",{className:"flex","aria-hidden":!0,children:$i.map((t,s)=>n.jsx(Tt,{className:E("size-4",e)},s))})}function Di({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,Oi=[1,.1,1,1,.1,1,.1,1,1],Ri=[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:Oi.map(u=>u*d)}:{scaleY:d}}:void 0,transition:i?{scale:{type:"spring",stiffness:500,damping:15},...c?{scaleY:{duration:Li,times:Ri,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 Tn({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 zi({motionOn:e}){return n.jsx(Tn,{x:47,y:13,motionOn:e,duration:3.4,repeatDelay:2.6})}function Wi({motionOn:e}){return n.jsx(Tn,{x:24,y:30,motionOn:e,duration:3.6,repeatDelay:3.2})}function Pi({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 Bi({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 Vi(){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 Gi({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(zi,{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(Pi,{motionOn:e}),n.jsx("path",{d:"M23 42 L41 42",...de,strokeWidth:3})]})}function Ki({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 Hi({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(Wi,{motionOn:e}),n.jsx("path",{d:"M20 47 Q32 37.5 44 47",...de,strokeWidth:3})]})}function Yi({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 qi({emotion:e,motionOn:t}){switch(e){case"happy":return n.jsx(Bi,{motionOn:t});case"thinking":return n.jsx(Fi,{motionOn:t});case"celebrating":return n.jsx(Vi,{});case"sheepish":return n.jsx(Gi,{motionOn:t});case"determined":return n.jsx(Ui,{motionOn:t});case"surprised":return n.jsx(Ki,{motionOn:t});case"sad":return n.jsx(Hi,{motionOn:t});case"love":return n.jsx(Yi,{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"}}},Zi={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();aa({origin:i?Wt(i):void 0})},[e.emotion,t]);const r=Xi[e.emotion]??Qi,o=Zi[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(qi,{emotion:e.emotion,motionOn:t})})})}),e.emotion==="thinking"&&n.jsx(eo,{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 eo({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 to=2,no=5;function St(e){var s;const t=(s=e==null?void 0:e.glyph)==null?void 0:s.trim();return t||null}function so(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 ao(e){const t=e.length;if(t<to||t>no||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=so(e,a);if(r)return{glyph:r,cells:a}}return null}function ro(e,t,s){return e!==null&&e.cells.some(a=>a.row===t&&a.col===s)}const io=new Set(["."," ","-","_"]),$n=".";function oo(e,t){const s=o=>o.map(i=>io.has(i)?$n:i),a=[...e];if(a.length===t)return s(a);const r=[...e.trim()];return r.length===t?s(r):null}function co(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=oo(s[r],t[r].length);if(!o)return null;a.push(o)}return a}function lo(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 uo(e,t){const s=new Map;for(const r of e){const o=co(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 fo(e){const t=lo(e);if(t.length===0)return e;const s=uo(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===$n)return c;a=!0;const{action:m,...p}=c;return{...p,glyph:u}}));return a?r:e}const wt=.12,po=.2,Dn="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 mo(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 ho({motionOn:e,colorClass:t}){const s=a=>({duration:wt,ease:le,delay:a});return n.jsxs("svg",{viewBox:Dn,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 go({motionOn:e,colorClass:t}){return n.jsx("svg",{viewBox:Dn,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:po,ease:le}:void 0})})}function xo({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(xo,{motionOn:t});const a=Ln(e);return a==="x"?n.jsx(ho,{motionOn:t,colorClass:s}):a==="o"?n.jsx(go,{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 On(e){return e.glyph?e.glyph:e.icon?e.icon:"filled"}function Rn(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 mo(e)??void 0}function yo({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}: ${On(e)}`:void 0,className:E(Rn(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 bo({cell:e,icon:t,motionOn:s,row:a,col:r,winRole:o}){const{onAction:i,channel:c}=ge(),u=`${J()}.rows.${a}.${r}`,m=e.action.kind==="emit"||e.action.kind==="agent"&&c!==void 0,p=wn(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}: ${On(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(Rn(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(vo,{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(Lt,{children:n.jsxs(Ot,{children:[n.jsx(Rt,{asChild:!0,children:N}),n.jsx(zt,{children:_})]})}):N})}function vo({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 jo(e){return e.cell.action?n.jsx(bo,{...e,cell:e.cell}):n.jsx(yo,{...e})}const Ct=.28,ko=.3,No=.12,So=.8;function je(e,t,s){return e*(t+s)+t/2}function wo({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*No,strokeOpacity:So,strokeLinecap:"round",initial:o?{pathLength:0,opacity:0}:!1,animate:o?{pathLength:1,opacity:1}:!1,transition:o?{pathLength:{duration:ko,ease:le,delay:Ct},opacity:{duration:.12,delay:Ct}}:void 0})})}const Co={},Ao=.02,Mo={hidden:{},visible:{transition:{staggerChildren:Ao}}};function _o(e,t,s,a){return e?ro(e,t,s)?"winner":a.glyph?"loser":"none":"none"}const Eo=4,Io=3.25,To=2.5,$o=.25,Do={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=J(),i=fo(e.rows),c=Math.max(1,...i.map(j=>j.length)),d=c<=Eo?Io:To,u=ao(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=Do[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?Mo: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]??Co,l=!C.glyph&&C.icon?qe(C.icon):null,f=_o(u,A,N,C);return n.jsx(jo,{cell:C,icon:l,motionOn:t,row:A,col:N,winRole:f},`${A}-${N}`)})},A))}),u&&n.jsx(wo,{win:u,size:c,cellUnit:d,gapUnit:$o,colorClass:p,motionOn:t})]}),n.jsx(En,{controlId:o,descendants:!0})]})}const Oo=1.2,Ro={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"},zo=[Ha,Ya,qa,Qa,Xa,Za];function Wo(e){const t={duration:Oo,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 Po({kind:e,result:t}){switch(e){case"coin":return n.jsx(Ua,{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?zo[s-1]:Ja;return n.jsx(a,{className:"size-7","aria-hidden":!0})}}}function Bo({node:e}){const t=W(),[s,a]=g.useState(0),[r,o]=g.useState(!t),{animate:i,transition:c}=Wo(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",Ro[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(Po,{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(Vo,{node:e})})}function Vo({node:e}){const t=lr();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=Vr(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(Go,{node:a});case"card":return n.jsx(Uo,{node:a});case"form":return n.jsx(Ko,{node:a});case"divider":return n.jsx(Zr,{});case"heading":return n.jsx(qr,{node:a});case"text":return n.jsx(Qr,{node:a});case"badge":return n.jsx(Xr,{node:a});case"stat":return n.jsx(ti,{node:a});case"keyValue":return n.jsx(si,{node:a});case"progress":return n.jsx(ai,{node:a});case"image":return n.jsx(ri,{node:a});case"table":return n.jsx(li,{node:a});case"list":return n.jsx(hi,{node:a});case"chart":return n.jsx(bi,{node:a});case"timeline":return n.jsx(Ai,{node:a});case"checklist":return n.jsx(Mi,{node:a});case"compare":return n.jsx(Ti,{node:a});case"rating":return n.jsx(Di,{node:a});case"mood":return n.jsx(Ji,{node:a});case"board":return n.jsx(Lo,{node:a});case"reveal":return n.jsx(Bo,{node:a});case"button":return n.jsx(fi,{node:a});case"input":return n.jsx(pi,{node:a});case"select":return n.jsx(mi,{node:a});default:return n.jsx(Ho,{nodeType:a.type})}}function Go({node:e}){const t=J();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=J(),s=!!(e.title||e.description);return n.jsxs(Bt,{className:"shadow-soft",children:[s&&n.jsxs(ia,{children:[e.title&&n.jsx(oa,{children:e.title}),e.description&&n.jsx(ca,{children:e.description})]}),n.jsx(la,{children:e.children.map((a,r)=>n.jsx(he,{path:`${t}.children.${r}`,node:a},r))}),e.footer&&e.footer.length>0&&n.jsx(da,{children:e.footer.map((a,r)=>n.jsx(he,{path:`${t}.footer.${r}`,node:a},r))})]})}function Ko({node:e}){const t=J(),[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(Gr,{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 Ho({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(Or,{channel:a,sessionId:t,widgetTitle:e.title,isLatestMessage:s,children:n.jsx(cr,{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 Yo(e,t){const s=Ir.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??qo(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 Yo(t,e)}function qo(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(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(ra,{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{er as F,ic as W,ac as a,H as b,rc as p,W as u,Yo as v};
113
+ `)}const fr=K(["default","success","warning","error","info"]),bn=y({kind:M("agent"),id:h().min(1),label:h().optional(),payload:_t(h(),ls()).optional()}),vn=y({kind:M("emit"),type:ds,payload:us.optional(),coalesceKey:h().min(1).max(128).optional()}).strict(),ut=Be("kind",[bn,vn]),Re=Be("kind",[bn,vn,y({kind:M("ui"),command:cs}),y({kind:M("url"),href:h().url().refine(e=>e.startsWith("https://"),{message:"Widget URLs must be https"})})]),ft=Ae([h(),Fe(),Se(),os()]),pr=["sm","md","lg"],pt={sm:4,md:12};function mr(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 hr=z(mr,K(pr));function Z(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(Z({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"}),fr),gr=z(Z({vertical:"vertical",vert:"vertical",column:"vertical",col:"vertical",stack:"vertical",horizontal:"horizontal",horiz:"horizontal",row:"horizontal",inline:"horizontal"}),K(["vertical","horizontal"])),xr=z(Z({default:"default",primary:"default",secondary:"secondary",destructive:"destructive",danger:"destructive",delete:"destructive",outline:"outline",ghost:"outline",link:"outline"}),K(["default","secondary","destructive","outline"])),yr=z(Z({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"])),br=z(Z({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"])),vr=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)])),jr=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:br.default("flat")})),kr=z(e=>typeof e=="string"?{text:e}:e,y({text:h(),tone:Ke.optional()})),Nr=z(Z({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()),Sr=z(Z({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"])),wr=z(Z({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"])),Cr=z(e=>typeof e=="number"?String(e):e,h()),ht=12;function Ar(e){return typeof e!="string"?e:e.trim()===""?{}:{glyph:e}}const Mr=h().max(8).optional().transform(e=>{const t=e==null?void 0:e.trim();return t||void 0}),_r=z(Ar,y({glyph:Mr,icon:h().optional(),tone:Ke.optional(),action:Re.optional()})),Er=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=rs(()=>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."}),is}return e},Be("type",[y({type:M("stack"),direction:gr,gap:hr.optional(),children:L(pe)}),y({type:M("card"),title:h().optional(),description:h().optional(),children:L(pe),footer:L(pe).optional()}),y({type:M("divider")}),y({type:M("heading"),text:h(),level:vr.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(),Fe()]),delta:jr.optional(),hint:h().optional(),trend:L(ae().finite()).max(50).optional()}),y({type:M("keyValue"),items:L(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:L(y({key:h(),label:h(),align:K(["left","center","right"]).optional()})),rows:L(_t(h(),ft))}),y({type:M("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:kr.optional(),actions:L(Re).optional()}))}),y({type:M("chart"),bind:ee.chart.optional(),kind:yr,data:L(y({label:h(),value:ae().finite().min(0)})),height:ae().finite().positive().optional()}),y({type:M("button"),label:h(),variant:xr.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:L(y({label:h(),value:h()}))}),y({type:M("form"),children:L(pe),submit:y({label:h(),action:ut})}),y({type:M("timeline"),items:L(y({time:h().optional(),title:h(),subtitle:h().optional(),icon:h().optional(),status:Nr.optional()})).min(1)}),y({type:M("checklist"),items:L(y({label:h(),checked:mt.optional(),note:h().optional()})),action:ut.optional(),submitLabel:h().optional()}),y({type:M("compare"),options:L(y({name:h(),recommended:mt.optional()})).min(1),rows:L(y({label:h(),values:L(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:Sr,message:h().optional()}),y({type:M("board"),rows:Er,label:h().optional()}),y({type:M("reveal"),kind:wr,result:Cr,label:h().optional()})]))),Ir=y({version:M(1),title:h().optional(),root:pe});function ze(e){return e.some(t=>ps(t,"widget.action"))}const Tr=100,$r=3e4;function jn(e){if(e!==null&&typeof e=="object"){for(const t of Object.values(e))jn(t);Object.freeze(e)}return e}function Dr(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,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())},$r),!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 D=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:D});return}catch(D){if(!I()||!I())return;throw D}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)??[]],G=!l.value.normalized||ze(V);if(!I())return;if(!G){j(l,{phase:"review",message:"Document approval changed. Review this action before trying again."});return}if(!B("submit"))return;l.uncertain=!0;const U=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:U})}catch(V){if(!I())return;const G=V.status;if(!I())return;const U=G!==void 0&&[400,401,403,404,409,413,422].includes(G),D=!f&&U;l.uncertain=f||!D,j(l,{phase:D?"refused":U?"review":"retry",message:D?"This action could not be saved. Review the document before trying again.":U?"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 G;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=fs.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=(G=x.captureOriginal)==null?void 0:G.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>=Tr){const U=[...r.current.values()].find(D=>{var F;return D.value.phase==="refused"||D.value.phase==="accepted"&&((F=D.value.receipt)==null?void 0:F.deliveries.every(ye=>["handled","rejected","turn_done","expired","failed","cancelled","superseded","unavailable"].includes(ye.status)))});if(!U)throw new Error("Too many actions are waiting. Try again after they finish.");if(r.current.delete(U.value.event.id),p(U),!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:jn(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 kn=g.createContext("root"),Lr=kn.Provider;function J(){return g.useContext(kn)}function Nn(e){return e.id+":"+JSON.stringify(e.payload??null)}const gt=()=>Promise.resolve(),Sn=g.createContext({onAction:gt,hasSession:!1,channelRecords:[],channelPending:()=>!1,retryChannel:gt,superseded:!1,latched:!1,dispatchedActionKey:null,dispatchStatus:"idle"});function Or({children:e,channel:t,sessionId:s,widgetTitle:a,isLatestMessage:r=!0}){const{setTheme:o}=ms(),i=hs(),c=Dr(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:xs.getState,setTheme:o,supportsTerminal:i.supportsTerminal,celebrationOrigin:A==null?void 0:A.origin,sessionId:s};ys(_,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:ur(_)}),N.setTriggerPending(s,!0);const C=Nn(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)},gs.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(Sn.Provider,{value:S,children:[e,n.jsx(bs,{url:d??"",isOpen:d!==null,onClose:()=>u(null),onConfirm:()=>{d&&vs(d),u(null)}})]})}function ge(){return g.useContext(Sn)}function wn(e,t){var N;const s=J(),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"?Nn(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!js()}function Cn(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 An=new Set(["__proto__","prototype","constructor"]),Rr={text:["text"],stat:["value"],progress:["value","label"],table:["rows"],chart:["data"]},zr=100,xt=50,Wr=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 Pr(e,t){if(!oe(e)||!ks.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(An.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=Wr){return typeof e=="string"&&e.length<=t}function ke(e){return typeof e=="number"&&Number.isFinite(e)}function Br(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>zr)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(An.has(u)||!a.has(u))throw new Error("column");const m=Q(i,u);if(!Br(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 Vr(e,t){if(!("bind"in e)||e.bind===void 0)return{node:e};const s=Rr[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=Fr(e,i,Pr(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 Mn=g.createContext(null),Gr=Mn.Provider;function _n(){return g.useContext(Mn)}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 Kr(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 Hr(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 Yr={1:"text-lg font-semibold",2:"text-base font-semibold",3:"text-sm font-semibold"};function qr({node:e}){const t=e.level??3,s=E(Yr[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 Xr({node:e}){return n.jsx(ua,{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 Zr(){return n.jsx(Cs,{})}const Jr={up:ws,down:Ss,flat:It},ei={up:"text-status-success",down:"text-status-error",flat:"text-muted-foreground"};function ti({node:e}){const t=W(),s=Kr(e.value),a=Cn((s==null?void 0:s.value)??0,t&&s!==null),r=s?Hr(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",ei[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(ni,{values:e.trend})]}),e.hint&&n.jsx("span",{className:"text-muted-foreground text-xs",children:e.hint})]})}function ni({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 si({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 ai({node:e}){const t=W(),s=Cn(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(Ns,{value:s})]})}function ri({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 ii=b.create(Gt),oi=b.create(Me),yt={left:"text-left",center:"text-center",right:"text-right"};function ci(e){return e===null?"—":typeof e=="boolean"?e?"Yes":"No":String(e)}function li({node:e}){const t=W();return n.jsx("div",{className:"overflow-x-auto",children:n.jsxs(Ft,{children:[n.jsx(Vt,{children:n.jsx(Me,{children:e.columns.map(s=>n.jsx(Le,{className:E(s.align&&yt[s.align]),children:s.label},s.key))})}),n.jsx(ii,{variants:t?_e:void 0,initial:t?"hidden":!1,animate:t?"visible":!1,children:e.rows.map((s,a)=>n.jsx(oi,{variants:t?xe:void 0,children:e.columns.map(r=>n.jsx(Oe,{className:E("tabular-nums",r.align&&yt[r.align]),children:ci(s[r.key]??null)},r.key))},a))})]})})}const di={"alert-circle":Ys,"alert-triangle":$t,archive:Hs,"arrow-right":It,bell:Ks,bookmark:Pa,calendar:Us,check:Ve,"check-circle":Ba,circle:De,clock:Gs,cloud:Fa,code:Va,cog:Ga,database:Ka,file:ha,"file-text":er,flag:tr,folder:Vs,"git-branch":ma,globe:Fs,heart:pa,home:nr,info:Bs,link:Ps,lock:Ws,mail:zs,"map-pin":sr,"message-square":Rs,package:fa,play:Os,rocket:ar,search:Ls,server:Ds,settings:$s,star:Tt,tag:rr,terminal:Ts,"thumbs-up":Is,trash:Es,"trending-down":ir,"trending-up":or,user:_s,users:Ms,zap:As};function qe(e){if(!e)return De;const t=e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/\s+/g,"-").toLowerCase();return di[t]??De}function ui(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 En({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}: `:"",ui(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=J(),u=r??d,m=e.kind==="emit"||e.kind==="agent"&&c!==void 0,p=wn(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(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:_,className:E(a&&"w-full",j&&"cursor-default",(p.unavailable||p.superseded)&&"opacity-50",S&&"opacity-70"),children:[k&&n.jsx(ta,{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(En,{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 fi({node:e}){return n.jsx(Ie,{action:e.action,label:e.label,variant:e.variant})}function pi({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(Ge,{htmlFor:s,children:e.label}),n.jsx(ea,{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 mi({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(Ge,{htmlFor:a,children:e.label}),n.jsxs(qs,{name:e.name,required:e.required,value:d||void 0,onValueChange:m=>{o(!1),u(m)},children:[n.jsx(Xs,{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(Zs,{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 hi({node:e}){const t=W(),s=J();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":gi(i)},c))})]},r)})})}function gi(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))"],xi=180,yi=.15;function bi({node:e}){const t=e.height??xi,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(ji,{data:e.data,height:t,label:s}):e.kind==="pie"?n.jsx(Si,{data:e.data,height:t,label:s}):n.jsx(ki,{data:e.data,height:t,area:e.kind==="area",label:s})}const vi=18;function ji({data:e,height:t,label:s}){const a=W(),r=Math.max(...e.map(i=>i.value),0)||1,o=Math.max(0,t-vi);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(In,{data:e})]})}function ki({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:yi}),n.jsx("polyline",{points:c,fill:"none",stroke:u,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"})]})]}),n.jsx(In,{data:e})]})}const Ni=359.99;function Si({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>=Ni;return{d:i,full:p,path:p?"":wi(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 In({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 wi(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 Ci={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 Ai({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",Ci[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 Mi({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(na,{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(Ge,{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(Gt),Ei=b.create(Me);function Ii({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(sa,{className:"text-muted-foreground mx-auto size-4","aria-label":"No"}):n.jsx("span",{className:"tabular-nums",children:String(e)})}function Ti({node:e}){const t=W();return n.jsx("div",{className:"overflow-x-auto",children:n.jsxs(Ft,{children:[n.jsx(Vt,{children:n.jsxs(Me,{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?_e:void 0,initial:t?"hidden":!1,animate:t?"visible":!1,children:e.rows.map((s,a)=>n.jsxs(Ei,{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(Ii,{value:s.values[o]??null})},o))]},a))})]})})}const We=5,$i=Array.from({length:We});function vt({className:e}){return n.jsx("div",{className:"flex","aria-hidden":!0,children:$i.map((t,s)=>n.jsx(Tt,{className:E("size-4",e)},s))})}function Di({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,Oi=[1,.1,1,1,.1,1,.1,1,1],Ri=[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:Oi.map(u=>u*d)}:{scaleY:d}}:void 0,transition:i?{scale:{type:"spring",stiffness:500,damping:15},...c?{scaleY:{duration:Li,times:Ri,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 Tn({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 zi({motionOn:e}){return n.jsx(Tn,{x:47,y:13,motionOn:e,duration:3.4,repeatDelay:2.6})}function Wi({motionOn:e}){return n.jsx(Tn,{x:24,y:30,motionOn:e,duration:3.6,repeatDelay:3.2})}function Pi({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 Bi({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 Vi(){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 Gi({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(zi,{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(Pi,{motionOn:e}),n.jsx("path",{d:"M23 42 L41 42",...de,strokeWidth:3})]})}function Ki({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 Hi({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(Wi,{motionOn:e}),n.jsx("path",{d:"M20 47 Q32 37.5 44 47",...de,strokeWidth:3})]})}function Yi({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 qi({emotion:e,motionOn:t}){switch(e){case"happy":return n.jsx(Bi,{motionOn:t});case"thinking":return n.jsx(Fi,{motionOn:t});case"celebrating":return n.jsx(Vi,{});case"sheepish":return n.jsx(Gi,{motionOn:t});case"determined":return n.jsx(Ui,{motionOn:t});case"surprised":return n.jsx(Ki,{motionOn:t});case"sad":return n.jsx(Hi,{motionOn:t});case"love":return n.jsx(Yi,{motionOn:t})}}const Xi={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"}}},Zi={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();aa({origin:i?Wt(i):void 0})},[e.emotion,t]);const r=Qi[e.emotion]??Xi,o=Zi[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(qi,{emotion:e.emotion,motionOn:t})})})}),e.emotion==="thinking"&&n.jsx(eo,{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 eo({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 to=2,no=5;function St(e){var s;const t=(s=e==null?void 0:e.glyph)==null?void 0:s.trim();return t||null}function so(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 ao(e){const t=e.length;if(t<to||t>no||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=so(e,a);if(r)return{glyph:r,cells:a}}return null}function ro(e,t,s){return e!==null&&e.cells.some(a=>a.row===t&&a.col===s)}const io=new Set(["."," ","-","_"]),$n=".";function oo(e,t){const s=o=>o.map(i=>io.has(i)?$n:i),a=[...e];if(a.length===t)return s(a);const r=[...e.trim()];return r.length===t?s(r):null}function co(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=oo(s[r],t[r].length);if(!o)return null;a.push(o)}return a}function lo(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 uo(e,t){const s=new Map;for(const r of e){const o=co(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 fo(e){const t=lo(e);if(t.length===0)return e;const s=uo(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===$n)return c;a=!0;const{action:m,...p}=c;return{...p,glyph:u}}));return a?r:e}const wt=.12,po=.2,Dn="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 mo(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 ho({motionOn:e,colorClass:t}){const s=a=>({duration:wt,ease:le,delay:a});return n.jsxs("svg",{viewBox:Dn,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 go({motionOn:e,colorClass:t}){return n.jsx("svg",{viewBox:Dn,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:po,ease:le}:void 0})})}function xo({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(xo,{motionOn:t});const a=Ln(e);return a==="x"?n.jsx(ho,{motionOn:t,colorClass:s}):a==="o"?n.jsx(go,{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 On(e){return e.glyph?e.glyph:e.icon?e.icon:"filled"}function Rn(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 mo(e)??void 0}function yo({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}: ${On(e)}`:void 0,className:E(Rn(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 bo({cell:e,icon:t,motionOn:s,row:a,col:r,winRole:o}){const{onAction:i,channel:c}=ge(),u=`${J()}.rows.${a}.${r}`,m=e.action.kind==="emit"||e.action.kind==="agent"&&c!==void 0,p=wn(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}: ${On(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(Rn(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(vo,{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(Lt,{children:n.jsxs(Ot,{children:[n.jsx(Rt,{asChild:!0,children:N}),n.jsx(zt,{children:_})]})}):N})}function vo({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 jo(e){return e.cell.action?n.jsx(bo,{...e,cell:e.cell}):n.jsx(yo,{...e})}const Ct=.28,ko=.3,No=.12,So=.8;function je(e,t,s){return e*(t+s)+t/2}function wo({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*No,strokeOpacity:So,strokeLinecap:"round",initial:o?{pathLength:0,opacity:0}:!1,animate:o?{pathLength:1,opacity:1}:!1,transition:o?{pathLength:{duration:ko,ease:le,delay:Ct},opacity:{duration:.12,delay:Ct}}:void 0})})}const Co={},Ao=.02,Mo={hidden:{},visible:{transition:{staggerChildren:Ao}}};function _o(e,t,s,a){return e?ro(e,t,s)?"winner":a.glyph?"loser":"none":"none"}const Eo=4,Io=3.25,To=2.5,$o=.25,Do={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=J(),i=fo(e.rows),c=Math.max(1,...i.map(j=>j.length)),d=c<=Eo?Io:To,u=ao(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=Do[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?Mo: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]??Co,l=!C.glyph&&C.icon?qe(C.icon):null,f=_o(u,A,N,C);return n.jsx(jo,{cell:C,icon:l,motionOn:t,row:A,col:N,winRole:f},`${A}-${N}`)})},A))}),u&&n.jsx(wo,{win:u,size:c,cellUnit:d,gapUnit:$o,colorClass:p,motionOn:t})]}),n.jsx(En,{controlId:o,descendants:!0})]})}const Oo=1.2,Ro={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"},zo=[Ha,Ya,qa,Xa,Qa,Za];function Wo(e){const t={duration:Oo,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 Po({kind:e,result:t}){switch(e){case"coin":return n.jsx(Ua,{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?zo[s-1]:Ja;return n.jsx(a,{className:"size-7","aria-hidden":!0})}}}function Bo({node:e}){const t=W(),[s,a]=g.useState(0),[r,o]=g.useState(!t),{animate:i,transition:c}=Wo(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",Ro[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(Po,{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(Vo,{node:e})})}function Vo({node:e}){const t=lr();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=Vr(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(Go,{node:a});case"card":return n.jsx(Uo,{node:a});case"form":return n.jsx(Ko,{node:a});case"divider":return n.jsx(Zr,{});case"heading":return n.jsx(qr,{node:a});case"text":return n.jsx(Xr,{node:a});case"badge":return n.jsx(Qr,{node:a});case"stat":return n.jsx(ti,{node:a});case"keyValue":return n.jsx(si,{node:a});case"progress":return n.jsx(ai,{node:a});case"image":return n.jsx(ri,{node:a});case"table":return n.jsx(li,{node:a});case"list":return n.jsx(hi,{node:a});case"chart":return n.jsx(bi,{node:a});case"timeline":return n.jsx(Ai,{node:a});case"checklist":return n.jsx(Mi,{node:a});case"compare":return n.jsx(Ti,{node:a});case"rating":return n.jsx(Di,{node:a});case"mood":return n.jsx(Ji,{node:a});case"board":return n.jsx(Lo,{node:a});case"reveal":return n.jsx(Bo,{node:a});case"button":return n.jsx(fi,{node:a});case"input":return n.jsx(pi,{node:a});case"select":return n.jsx(mi,{node:a});default:return n.jsx(Ho,{nodeType:a.type})}}function Go({node:e}){const t=J();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=J(),s=!!(e.title||e.description);return n.jsxs(Bt,{className:"shadow-soft",children:[s&&n.jsxs(ia,{children:[e.title&&n.jsx(oa,{children:e.title}),e.description&&n.jsx(ca,{children:e.description})]}),n.jsx(la,{children:e.children.map((a,r)=>n.jsx(he,{path:`${t}.children.${r}`,node:a},r))}),e.footer&&e.footer.length>0&&n.jsx(da,{children:e.footer.map((a,r)=>n.jsx(he,{path:`${t}.footer.${r}`,node:a},r))})]})}function Ko({node:e}){const t=J(),[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(Gr,{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 Ho({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(Or,{channel:a,sessionId:t,widgetTitle:e.title,isLatestMessage:s,children:n.jsx(cr,{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 Yo(e,t){const s=Ir.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??qo(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 Yo(t,e)}function qo(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(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(ra,{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{er as F,ic as W,ac as a,H as b,rc as p,W as u,Yo as v};
@@ -1,4 +1,4 @@
1
- var pu=Object.defineProperty;var gu=(e,t,s)=>t in e?pu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var en=(e,t,s)=>gu(e,typeof t!="symbol"?t+"":t,s);import{q9 as xu,r as l,oB as Bo,qa as bu,oA as zr,j as n,qb as yu,qc as Mi,oC as vu,ae as se,aj as ge,hE as ke,eT as ve,ef as gn,qd as _s,he as wu,qe as ju,qf as ku,af as oe,an as ce,o$ as Su,qg as Cu,a4 as Se,e8 as ms,a3 as Y,B as M,X as Te,Z as z,ic as _i,qh as Nu,F as we,at as Pi,bk as Li,b7 as hs,h2 as Re,aQ as Au,qi as zo,qj as Eu,br as Iu,kD as Fi,bV as Ce,dK as De,x as vt,iJ as Ru,iK as $i,cQ as ae,qk as Cn,hJ as rt,ql as Bi,ag as Ct,hF as zi,fe as Ur,ci as Kr,ar as Bt,qm as Uo,qn as Tu,qo as Ui,qp as Du,qq as Hr,i3 as Nn,$ as Nt,mq as Wr,e7 as _t,l as ue,k$ as An,dj as Ki,d7 as Hi,d8 as Wi,dL as qi,d9 as Ou,qr as Mu,db as Ke,dE as En,dF as In,df as At,dG as Rn,dH as Tn,C as zt,e3 as Ie,e4 as _u,qs as Gi,a9 as Ko,qt as Pu,ki as Yi,qu as Vi,qv as qr,aN as B,pS as Lu,eN as ot,kr as es,hy as Ut,qw as Fu,eJ as Ae,qx as $u,qy as Bu,bs as zu,qz as fs,V as Gr,dc as ze,h9 as We,g4 as ps,fp as gs,iA as Yr,f as Kt,b2 as Qi,nZ as Xi,qA as Ji,eM as xs,qB as Vr,e1 as Uu,aa as xn,cr as Ht,cs as Wt,ct as qt,g7 as Ne,ii as bs,l$ as Zi,qC as Ku,qD as Hu,dw as Wu,iY as ts,bl as Le,iP as bn,cV as Ze,cW as et,cX as Ve,cY as Fe,cZ as Qe,da as at,c_ as Ot,cT as qu,ah as Gu,qE as Yu,qF as ys,qG as Vu,hv as Qu,qH as Xu,dJ as je,hz as vs,gL as Ju,kf as Zu,gN as em,gO as tm,gP as nm,mS as ec,fd as ws,eG as sm,qI as rm,qJ as tc,qK as pe,qL as om,qM as nc,qN as ur,qO as sc,qP as Qr,qQ as Xr,b1 as js,qR as Jr,qS as am,qT as im,qU as cm,qV as lm,qW as dm,qX as um,qY as tn,hf as mm,hg as hm,n$ as fm,qZ as pm,b6 as gm,q_ as xm,fo as rc,bH as Mt,q$ as oc,r0 as ns,r1 as ac,r2 as bm,r3 as ym,r4 as Pt,r5 as ic,r6 as cc,r7 as yn,r8 as vm,r9 as wm,gU as lc,gV as dc,fI as uc,fJ as mc,fL as hc,ra as wt,fM as jm,eC as km,rb as vn,rc as Sm,aS as fc,rd as Cm,re as Nm,rf as Am,rg as Em,rh as Im,ri as pc,rj as ft,rk as Ue,fn as it,rl as gc,rm as Rm,Q as me,nK as Tm,L as re,R as Gt,_ as Yt,O as de,N as gt,rn as Dm,ro as xc,I as Je,nX as Om,rp as bc,rq as yc,rr as Mm,rs as _m,rt as Pm,fA as jt,fz as Lt,fB as ks,jt as Lm,fx as vc,eO as wc,ly as jc,m$ as Fm,fw as $m,ru as Bm,rv as Ho,rw as zm,rx as Ft,ry as kc,bz as Ss,h0 as Sc,rz as Um,rA as Cc,rB as Nc,rC as Km,rD as Hm,fy as Wm,aR as Zr,fC as eo,rE as qm,gf as Dn,rF as ln,rG as to,w as ss,v as Ac,rH as Gm,iL as Wo,l1 as Ym,nh as Vm,rI as Qm,rJ as Xm,bN as Jm,iC as no,iB as so,mD as Ec,mC as Ic,rK as Zm,dB as Rc,rL as Pe,kc as he,rM as qo,cR as Cs,rN as eh,j7 as Tc,rO as th,rP as nh,rQ as sh,rR as rh,rS as oh,rT as ah,rU as ih,gB as ro,rV as ch,rW as Dc,m2 as lh,g$ as Oc,rX as Mc,j8 as _c,p$ as oo,rY as dh,rZ as On,my as ao,r_ as Vt,r$ as uh,s0 as mh,s1 as hh,s2 as fh,s3 as ph,s4 as gh,s5 as xh,fD as bh,s6 as yh,jv as io,s7 as vh,mz as Pc,mB as wh,s8 as jh,s9 as Lc,sa as Fc,sb as Go,sc as Yo,sd as kh,se as Sh,sf as Ch,sg as Nh,sh as Ah,si as Eh,sj as Vo,sk as Ih,sl as Rh,sm as Th,sn as Ps,hV as Ns,hW as Dh,so as Oh,jL as Mh,e as xt,sp as _h,sq as Ph,sr as Lh,a$ as Fh,ir as $h,ss as Bh,st as zh,a_ as Uh,su as Kh,sv as Hh,ge as Qt,a0 as Wh,sw as qh,sx as rs,i4 as $c,sy as Gh,sz as Bc,sA as Yh,sB as Vh,sC as Qh,sD as zc,sE as zn,sF as Xh,sG as Jh,sH as Zh,sI as Uc,sJ as mr,sK as ef,c0 as nn,H as co,aJ as tf,oP as Kc,dd as Qo,ls as Hc,iE as lo,fa as nf,t as sf,g as rf,sL as hr,h5 as fr,gK as of,aL as uo,sM as af,kS as cf,ke as lf,mj as df,sN as uf,sO as mf,sP as hf,sQ as ff,sR as Xo,i0 as Wc,fR as pf,fS as gf,fT as xf,fU as bf,fV as yf,fW as vf,fX as wf,sS as jf,sT as pr,sU as kf,sV as Ls,sW as Sf,sX as Cf,sY as wn,sZ as Nf,s_ as Jo,kl as Af,hX as Ef,s$ as If,hi as Rf,hj as Tf,hl as Df,hm as Zo,lb as ea,l9 as Of,la as ta,t0 as Mf,t1 as _f,t2 as Pf,t3 as Lf,eU as Ff,t4 as $f,t5 as Bf,t6 as zf,k8 as qc,k9 as Gc,ka as Yc,kb as Uf,bC as Kf,t7 as Hf,t8 as Wf,t9 as Vc,ta as Qc,cA as mo,cB as ho,cC as fo,tb as qf,tc as Gf,bw as Yf,fG as Vf,td as Fs,aO as Qf,te as Xf,tf as Jf,tg as Zf,th as ep,ti as tp,tj as np,tk as sp,tl as rp,tm as op,tn as na,b3 as Xc,hk as ap,bv as ip,to as Jc,tp as cp,fq as lp,tq as sa,gJ as dp,tr as up,ts as mp,tt as hp,tu as fp,tv as pp,oT as gp,gi as xp,h as po,tw as bp,tx as yp,ty as vp,eA as wp,ho as jp,tz as kp,tA as ra,tB as Sp,tC as Cp,lc as Np,tD as Ap,tE as Ep,tF as Ip,p8 as Rp,dk as Zc,pm as Tp,tG as Dp,tH as Op,tI as Mp,pq as _p,g_ as $t,j9 as Pp,e_ as gr,e$ as xr,f0 as br,tJ as Lp,tK as Fp,f1 as yr,tL as $p,k_ as Bp,eY as zp,eZ as Up,je as Kp,jf as Hp,jg as Wp,jj as qp,jh as Gp,tM as Yp,tN as Vp,jd as Qp,jb as Xp,jc as Jp,hc as Zp,tO as el,hD as eg,tP as tg,tQ as ng,tR as tl,tS as sg,tT as As,tU as nl,ad as sl,tV as rl,tW as rg,cw as og,cx as ag,eR as oa,tX as aa,tY as ig,b8 as cg,g2 as lg,tZ as dg,kT as $s,kU as Bs,t_ as ug,t$ as mg,u0 as hg,e5 as fg,u1 as go,n as pg,lr as gg,u2 as xg,lw as bg,u3 as ol,u4 as al,u5 as il,u6 as cl,u7 as ll,u8 as yg,u9 as vg,ua as ia,ub as wg,uc as jg,ud as kg,ue as Dt,cD as Sg,uf as ca,lG as Cg,lI as dl,cU as Ng,iy as Ag,ng as Eg,l_ as Ig,ug as vr,uh as Rg,ec as Tg,h4 as Dg,lT as Ge,lV as Og,pR as Mg,nT as la,pT as _g,ui as Pg,bW as Lg,gg as Fg,uj as $g,uk as Bg,ul as zg,um as Ug,un as Kg,uo as Hg,up as Wg,kN as qg,i_ as Gg,k5 as Yg,uq as Vg,ur as Qg,us as Xg,ut as Jg,uu as Zg,uv as ex,bX as tx,uw as nx,ux as sx,mR as rx,ch as ox}from"./index-BZKMWkth.js";import{f as ax,g as ix}from"./use-connector-management-BZ-sfu8O.js";import{D as He,a as cx}from"./TourHost-DxBh58jt.js";import{O as lx,B as xo}from"./banner-D26eekSD.js";import{u as dx}from"./use-dev-links-daERqZ4e.js";import{d as ux}from"./untrusted-text-pHjcUwfI.js";import{S as mn}from"./scroll-area-DKse0rZa.js";import{T as ul,a as ml,b as Vn,c as zs,u as mx,i as hx,d as fx,P as hl}from"./PreviewRefusedNotice-CLOum_3D.js";import{P as px}from"./paperclip-CA9pcNn6.js";import{L as gx}from"./lightbulb-CxP8HLlU.js";import{i as xx,O as fl,b as bx,u as yx,a as vx}from"./OperatorIdentityForm-DtA4qIAR.js";import{b as wx,u as jx,c as kx,O as Sx,d as Cx}from"./OpenMeshSwitch-Dw8ylRP7.js";import{a as Nx}from"./use-pulse-freshness-CKzRoyfz.js";import{c as Ax,B as Ex,b as Ix,a as Rx,w as Tx,e as Dx}from"./kickoff-D-oHin9P.js";import{M as Ox,u as Mx,s as _x,P as Px,a as Lx}from"./use-promo-activation-CZMwcIvl.js";import{u as pl}from"./use-pending-read-CH_0XPYp.js";import{a as Xe}from"./dorkbot-templates-8Yu9POWJ.js";import{A as gl,P as Fx,u as $x,a as Bx}from"./use-jump-back-in-Dm-2B4la.js";import{R as zx}from"./rotate-cw-TrlUqVdq.js";import{u as Ux,a as Kx,C as Hx,N as Wx}from"./NewDirectMessageMenu-DNd6s2qQ.js";import{P as qx,C as Gx,f as Yx,a as Vx}from"./find-latest-widget-fence-Dw4BJ_cR.js";import{o as Qx}from"./owner-notice-CopwUeso.js";import{c as Xx,H as xl,a as bl,b as yl}from"./RuntimeSetupDialog-Bh0jopL-.js";import{P as Us}from"./page-container-DMx2f-Ca.js";import{u as Jx}from"./use-roving-tab-list-DlrB639e.js";import{R as Zx}from"./rotate-ccw-clock-C-ftj_rU.js";import{A as eb,M as tb}from"./McpAppFrame-DcPNmy1o.js";import{L as nb}from"./layers-BpMm7sp6.js";import{R as sb}from"./radio-B4GY45ie.js";import{a as rb}from"./sound-D3r8dGFH.js";import"./WidgetErrorCard-l8cP9oJc.js";import{u as ob}from"./use-is-below-desktop-B-Dt4c9S.js";import"./use-external-adapter-catalog-DE5zmChu.js";import"./shield-x-ZcQ8NB0Z.js";import"./use-mesh-topology-DXFAk9hJ.js";import"./use-full-activity-feed-DkDB2i0G.js";import"./card-CTGm0Blo.js";import"./markdown-content-plNIomQc.js";import"./table-BJDpTBxJ.js";import"./package-B7amjGSw.js";import"./heart-cgLUdSV5.js";import"./git-branch-D9jctpSd.js";import"./file-B6neiwXF.js";function ab({children:e,isValidProp:t,...s}){t&&xu(t);const r=l.useContext(Bo);s={...r,...s},s.transition=bu(s.transition,r.transition),s.isStatic=zr(()=>s.isStatic);const o=l.useMemo(()=>s,[JSON.stringify(s.transition),s.transformPagePoint,s.reducedMotion,s.skipAnimations]);return n.jsx(Bo.Provider,{value:o,children:e})}function ib(e){e.values.forEach(t=>t.stop())}function wr(e,t){[...t].reverse().forEach(r=>{const o=e.getVariant(r);o&&Mi(e,o),e.variantChildren&&e.variantChildren.forEach(a=>{wr(a,t)})})}function cb(e,t){if(Array.isArray(t))return wr(e,t);if(typeof t=="string")return wr(e,[t]);Mi(e,t)}function lb(){const e=new Set,t={subscribe(s){return e.add(s),()=>void e.delete(s)},start(s,r){const o=[];return e.forEach(a=>{o.push(yu(a,s,{transitionOverride:r}))}),Promise.all(o)},set(s){return e.forEach(r=>{cb(r,s)})},stop(){e.forEach(s=>{ib(s)})},mount(){return()=>{t.stop()}}};return t}function db(){const e=zr(lb);return vu(e.mount,[]),e}class ub{constructor(){this.componentControls=new Set}subscribe(t){return this.componentControls.add(t),()=>this.componentControls.delete(t)}start(t,s){this.componentControls.forEach(r=>{r.start(t.nativeEvent||t,s)})}cancel(){this.componentControls.forEach(t=>{t.cancel()})}stop(){this.componentControls.forEach(t=>{t.stop()})}}const mb=()=>new ub;function hb(){return zr(mb)}const fb="dork-labs/dorkos",pb=`https://github.com/${fb}/issues/new`,gb={"tunnel.enabled":"boolean","tasks.enabled":"boolean","relay.enabled":"boolean","scheduler.enabled":"boolean","mesh.enabled":"boolean","mcp.enabled":"boolean","telemetry.install":"boolean","telemetry.heartbeat":"boolean","telemetry.errorReporting":"boolean","auth.enabled":"boolean","workspace.enabled":"boolean","harness.autoSync":"boolean","harness.autoAdopt":"boolean","runtimes.codex.enabled":"boolean","runtimes.opencode.enabled":"boolean","runtimes.default":"enum","logging.level":"enum","ui.theme":"enum"},xb={"runtimes.default":["claude-code","codex","opencode","doe"],"logging.level":["fatal","error","warn","info","debug","trace"],"ui.theme":["light","dark","system"]},bb=/^[a-z0-9][a-z0-9._-]{0,31}$/,yb={bug:["bug"],feature:["enhancement"],runtime:["bug"]},vb={bug:"Bug: (describe what went wrong)",feature:"Feature: (describe what you want)",runtime:"Runtime issue: (describe what went wrong)"};function wb(e){return e.replace(/\b(?:sk-|pk-|rk-|ghp_|gho_|ghu_|ghs_|github_pat_|glpat-|npm_|xox[baprsc]-)[A-Za-z0-9._-]+/g,"[redacted]").replace(/\b(?:AKIA|ASIA|AGPA|AIDA|AROA|ANPA)[0-9A-Z]{16}\b/g,"[redacted]").replace(/\bBearer\s+[A-Za-z0-9._-]+/gi,"[redacted]")}function bo(e){return wb(e).replace(/[^\s/@]+@[^\s/@]+\.[^\s/@]+/g,"[email]").replace(/\b\d{1,3}(?:\.\d{1,3}){3}\b/g,"[ip]").replace(/\b(?:[A-Fa-f0-9]{1,4}:){2,7}[A-Fa-f0-9]{1,4}\b/g,"[ip]").replace(new RegExp("(?<![\\w:.])(?:[A-Fa-f0-9]{1,4})?(?::[A-Fa-f0-9]{0,4}){2,}(?![\\w:.])","g"),"[ip]").replace(/\\\\[^\s\\]+(?:\\[^\s\\]+)+/g,"[path]").replace(/(^|[\s"'`(<[{])\/\/[^\s"'`)>\]}/]+\/[^\s"'`)>\]}]+/g,"$1[path]").replace(/\b[A-Za-z]:\\[^\r\n]*/g,"[path]").replace(/(^|[\s"'`(<[{/:])(~|\/(?:Users|home))\/[^\s"'`)>\]}]+/g,"$1[home]").replace(/(^|[\s"'`(<[{])\/[\w.-]+(?:\/[\w.-]*)+/g,"$1[path]").replace(/\b(?=[A-Za-z0-9_-]*\d)[A-Za-z0-9_-]{24,}\b/g,"[redacted]")}function jb(e,t){const s=xb[e];return s?s.includes(t):bb.test(t)&&bo(t)===t}function kb(e){const t={};for(const[s,r]of Object.entries(gb)){const o=e[s];o!=null&&(r==="boolean"&&typeof o=="boolean"||r==="number"&&typeof o=="number"&&Number.isFinite(o)||r==="enum"&&typeof o=="string"&&jb(s,o))&&(t[s]=o)}return t}const Sb=["details","summary"];function yo(e){return ux(bo(e),Sb)}function Cb(e){const t=e.runtimes.length>0?e.runtimes.join(", "):"none configured",s=Object.entries(e.flags).map(([o,a])=>`- ${o}: ${String(a)}`).join(`
1
+ var pu=Object.defineProperty;var gu=(e,t,s)=>t in e?pu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var en=(e,t,s)=>gu(e,typeof t!="symbol"?t+"":t,s);import{qa as xu,r as l,oC as Bo,qb as bu,oB as zr,j as n,qc as yu,qd as Mi,oD as vu,ae as se,aj as ge,hE as ke,eT as ve,ef as gn,qe as _s,he as wu,qf as ju,qg as ku,af as oe,an as ce,p0 as Su,qh as Cu,a4 as Se,e8 as ms,a3 as Y,B as M,X as Te,Z as z,ic as _i,qi as Nu,F as we,at as Pi,bk as Li,b7 as hs,h2 as Re,aQ as Au,qj as zo,qk as Eu,br as Iu,kE as Fi,bV as Ce,dK as De,x as vt,iJ as Ru,iK as $i,cQ as ae,ql as Cn,hJ as rt,qm as Bi,ag as Ct,hF as zi,fe as Ur,ci as Kr,ar as Bt,qn as Uo,qo as Tu,qp as Ui,qq as Du,qr as Hr,i3 as Nn,$ as Nt,mr as Wr,e7 as _t,l as ue,l0 as An,dj as Ki,d7 as Hi,d8 as Wi,dL as qi,d9 as Ou,qs as Mu,db as Ke,dE as En,dF as In,df as At,dG as Rn,dH as Tn,C as zt,e3 as Ie,e4 as _u,qt as Gi,a9 as Ko,qu as Pu,kj as Yi,qv as Vi,qw as qr,aN as B,pT as Lu,eN as ot,ks as es,hy as Ut,qx as Fu,eJ as Ae,qy as $u,qz as Bu,bs as zu,qA as fs,V as Gr,dc as ze,h9 as We,g4 as ps,fp as gs,iA as Yr,f as Kt,b2 as Qi,n_ as Xi,qB as Ji,eM as xs,qC as Vr,e1 as Uu,aa as xn,cr as Ht,cs as Wt,ct as qt,g7 as Ne,ii as bs,m0 as Zi,qD as Ku,qE as Hu,dw as Wu,iY as ts,bl as Le,iP as bn,cV as Ze,cW as et,cX as Ve,cY as Fe,cZ as Qe,da as at,c_ as Ot,cT as qu,ah as Gu,qF as Yu,qG as ys,qH as Vu,hv as Qu,qI as Xu,dJ as je,hz as vs,gL as Ju,kg as Zu,gN as em,gO as tm,gP as nm,mT as ec,fd as ws,eG as sm,qJ as rm,qK as tc,qL as pe,qM as om,qN as nc,qO as ur,qP as sc,qQ as Qr,qR as Xr,b1 as js,qS as Jr,qT as am,qU as im,qV as cm,qW as lm,qX as dm,qY as um,qZ as tn,hf as mm,hg as hm,o0 as fm,q_ as pm,b6 as gm,q$ as xm,fo as rc,bH as Mt,r0 as oc,r1 as ns,r2 as ac,r3 as bm,r4 as ym,r5 as Pt,r6 as ic,r7 as cc,r8 as yn,r9 as vm,ra as wm,gU as lc,gV as dc,fI as uc,fJ as mc,fL as hc,rb as wt,fM as jm,eC as km,rc as vn,rd as Sm,aS as fc,re as Cm,rf as Nm,rg as Am,rh as Em,ri as Im,rj as pc,rk as ft,rl as Ue,fn as it,rm as gc,rn as Rm,Q as me,nL as Tm,L as re,R as Gt,_ as Yt,O as de,N as gt,ro as Dm,rp as xc,I as Je,nY as Om,rq as bc,rr as yc,rs as Mm,rt as _m,ru as Pm,fA as jt,fz as Lt,fB as ks,jt as Lm,fx as vc,eO as wc,lz as jc,n0 as Fm,fw as $m,rv as Bm,rw as Ho,rx as zm,ry as Ft,rz as kc,bz as Ss,h0 as Sc,rA as Um,rB as Cc,rC as Nc,rD as Km,rE as Hm,fy as Wm,aR as Zr,fC as eo,rF as qm,gf as Dn,rG as ln,rH as to,w as ss,v as Ac,rI as Gm,iL as Wo,l2 as Ym,ni as Vm,rJ as Qm,rK as Xm,bN as Jm,iC as no,iB as so,mE as Ec,mD as Ic,rL as Zm,dB as Rc,rM as Pe,kd as he,rN as qo,cR as Cs,rO as eh,j7 as Tc,rP as th,rQ as nh,rR as sh,rS as rh,rT as oh,rU as ah,rV as ih,gB as ro,rW as ch,rX as Dc,m3 as lh,g$ as Oc,rY as Mc,j8 as _c,q0 as oo,rZ as dh,r_ as On,mz as ao,r$ as Vt,s0 as uh,s1 as mh,s2 as hh,s3 as fh,s4 as ph,s5 as gh,s6 as xh,fD as bh,s7 as yh,jv as io,s8 as vh,mA as Pc,mC as wh,s9 as jh,sa as Lc,sb as Fc,sc as Go,sd as Yo,se as kh,sf as Sh,sg as Ch,sh as Nh,si as Ah,sj as Eh,sk as Vo,sl as Ih,sm as Rh,sn as Th,so as Ps,hV as Ns,hW as Dh,sp as Oh,jL as Mh,e as xt,sq as _h,sr as Ph,ss as Lh,a$ as Fh,ir as $h,st as Bh,su as zh,a_ as Uh,sv as Kh,sw as Hh,ge as Qt,a0 as Wh,sx as qh,sy as rs,i4 as $c,sz as Gh,sA as Bc,sB as Yh,sC as Vh,sD as Qh,sE as zc,sF as zn,sG as Xh,sH as Jh,sI as Zh,sJ as Uc,sK as mr,sL as ef,c0 as nn,H as co,aJ as tf,oQ as Kc,dd as Qo,lt as Hc,iE as lo,fa as nf,t as sf,g as rf,sM as hr,h5 as fr,gK as of,aL as uo,sN as af,kT as cf,kf as lf,mk as df,sO as uf,sP as mf,sQ as hf,sR as ff,sS as Xo,i0 as Wc,fR as pf,fS as gf,fT as xf,fU as bf,fV as yf,fW as vf,fX as wf,sT as jf,sU as pr,sV as kf,sW as Ls,sX as Sf,sY as Cf,sZ as wn,s_ as Nf,s$ as Jo,km as Af,hX as Ef,t0 as If,hi as Rf,hj as Tf,hl as Df,hm as Zo,lc as ea,la as Of,lb as ta,t1 as Mf,t2 as _f,t3 as Pf,t4 as Lf,eU as Ff,t5 as $f,t6 as Bf,t7 as zf,k9 as qc,ka as Gc,kb as Yc,kc as Uf,bC as Kf,t8 as Hf,t9 as Wf,ta as Vc,tb as Qc,cA as mo,cB as ho,cC as fo,tc as qf,td as Gf,bw as Yf,fG as Vf,te as Fs,aO as Qf,tf as Xf,tg as Jf,th as Zf,ti as ep,tj as tp,tk as np,tl as sp,tm as rp,tn as op,to as na,b3 as Xc,hk as ap,bv as ip,tp as Jc,tq as cp,fq as lp,tr as sa,gJ as dp,ts as up,tt as mp,tu as hp,tv as fp,tw as pp,oU as gp,gi as xp,h as po,tx as bp,ty as yp,tz as vp,eA as wp,ho as jp,tA as kp,tB as ra,tC as Sp,tD as Cp,ld as Np,tE as Ap,tF as Ep,tG as Ip,p9 as Rp,dk as Zc,pn as Tp,tH as Dp,tI as Op,tJ as Mp,pr as _p,g_ as $t,j9 as Pp,e_ as gr,e$ as xr,f0 as br,tK as Lp,tL as Fp,f1 as yr,tM as $p,k$ as Bp,eY as zp,eZ as Up,je as Kp,jf as Hp,jg as Wp,jj as qp,jh as Gp,tN as Yp,tO as Vp,jd as Qp,jb as Xp,jc as Jp,hc as Zp,tP as el,hD as eg,tQ as tg,tR as ng,tS as tl,tT as sg,tU as As,tV as nl,ad as sl,tW as rl,tX as rg,cw as og,cx as ag,eR as oa,tY as aa,tZ as ig,b8 as cg,g2 as lg,t_ as dg,kU as $s,kV as Bs,t$ as ug,u0 as mg,u1 as hg,e5 as fg,u2 as go,n as pg,ls as gg,u3 as xg,lx as bg,u4 as ol,u5 as al,u6 as il,u7 as cl,u8 as ll,u9 as yg,ua as vg,ub as ia,uc as wg,ud as jg,ue as kg,uf as Dt,cD as Sg,ug as ca,lH as Cg,lJ as dl,cU as Ng,iy as Ag,nh as Eg,l$ as Ig,uh as vr,ui as Rg,ec as Tg,h4 as Dg,lU as Ge,lW as Og,pS as Mg,nU as la,pU as _g,uj as Pg,bW as Lg,gg as Fg,uk as $g,ul as Bg,um as zg,un as Ug,uo as Kg,up as Hg,uq as Wg,kO as qg,i_ as Gg,k5 as Yg,ur as Vg,us as Qg,ut as Xg,uu as Jg,uv as Zg,uw as ex,bX as tx,ux as nx,uy as sx,mS as rx,ch as ox}from"./index-Dr-0P6rd.js";import{f as ax,g as ix}from"./use-connector-management-pgVHbXoO.js";import{D as He,a as cx}from"./TourHost-zwSilkjm.js";import{O as lx,B as xo}from"./banner-CU2Nh3Kv.js";import{u as dx}from"./use-dev-links-BImQrE6g.js";import{d as ux}from"./untrusted-text-pHjcUwfI.js";import{S as mn}from"./scroll-area-XlDz8u4m.js";import{T as ul,a as ml,b as Vn,c as zs,u as mx,i as hx,d as fx,P as hl}from"./PreviewRefusedNotice-fTN8MJ1h.js";import{P as px}from"./paperclip-Cj1P85mz.js";import{L as gx}from"./lightbulb-D80IzMqz.js";import{i as xx,O as fl,b as bx,u as yx,a as vx}from"./OperatorIdentityForm-byU2FeSU.js";import{b as wx,u as jx,c as kx,O as Sx,d as Cx}from"./OpenMeshSwitch-DrmjsCDY.js";import{a as Nx}from"./use-pulse-freshness-SFRdnugS.js";import{c as Ax,B as Ex,b as Ix,a as Rx,w as Tx,e as Dx}from"./kickoff-Btbza7bw.js";import{M as Ox,u as Mx,s as _x,P as Px,a as Lx}from"./use-promo-activation-Bv1gnqKq.js";import{u as pl}from"./use-pending-read-DmrlNHS0.js";import{a as Xe}from"./dorkbot-templates-8Yu9POWJ.js";import{A as gl,P as Fx,u as $x,a as Bx}from"./use-jump-back-in-D9tBJ4v5.js";import{R as zx}from"./rotate-cw-DrGRGSwy.js";import{u as Ux,a as Kx,C as Hx,N as Wx}from"./NewDirectMessageMenu-BjqYwnXW.js";import{P as qx,C as Gx,f as Yx,a as Vx}from"./find-latest-widget-fence-BGiexm6r.js";import{o as Qx}from"./owner-notice-BkrTEMDm.js";import{c as Xx,H as xl,a as bl,b as yl}from"./RuntimeSetupDialog-ufwCvCJB.js";import{P as Us}from"./page-container-CPxW5T9E.js";import{u as Jx}from"./use-roving-tab-list-3Pb7ps4E.js";import{R as Zx}from"./rotate-ccw-clock-cx5RyP4l.js";import{A as eb,M as tb}from"./McpAppFrame-DmHduNgp.js";import{L as nb}from"./layers-B0oCOfxz.js";import{R as sb}from"./radio-DICkTr_p.js";import{a as rb}from"./sound-D3r8dGFH.js";import"./WidgetErrorCard-BQwrR6PJ.js";import{u as ob}from"./use-is-below-desktop-DBet5zg_.js";import"./use-external-adapter-catalog-D8KHMSZU.js";import"./shield-x-DioB6qH_.js";import"./use-mesh-topology-DBeqzUoy.js";import"./use-full-activity-feed-2o7GNAMe.js";import"./card-BTgwskmX.js";import"./markdown-content-aNzh-54y.js";import"./table-P4N5xQn2.js";import"./package-CoTlAnXZ.js";import"./heart-Bp14wOx6.js";import"./git-branch-Dq_w3Iyx.js";import"./file-DlQX-hKl.js";function ab({children:e,isValidProp:t,...s}){t&&xu(t);const r=l.useContext(Bo);s={...r,...s},s.transition=bu(s.transition,r.transition),s.isStatic=zr(()=>s.isStatic);const o=l.useMemo(()=>s,[JSON.stringify(s.transition),s.transformPagePoint,s.reducedMotion,s.skipAnimations]);return n.jsx(Bo.Provider,{value:o,children:e})}function ib(e){e.values.forEach(t=>t.stop())}function wr(e,t){[...t].reverse().forEach(r=>{const o=e.getVariant(r);o&&Mi(e,o),e.variantChildren&&e.variantChildren.forEach(a=>{wr(a,t)})})}function cb(e,t){if(Array.isArray(t))return wr(e,t);if(typeof t=="string")return wr(e,[t]);Mi(e,t)}function lb(){const e=new Set,t={subscribe(s){return e.add(s),()=>void e.delete(s)},start(s,r){const o=[];return e.forEach(a=>{o.push(yu(a,s,{transitionOverride:r}))}),Promise.all(o)},set(s){return e.forEach(r=>{cb(r,s)})},stop(){e.forEach(s=>{ib(s)})},mount(){return()=>{t.stop()}}};return t}function db(){const e=zr(lb);return vu(e.mount,[]),e}class ub{constructor(){this.componentControls=new Set}subscribe(t){return this.componentControls.add(t),()=>this.componentControls.delete(t)}start(t,s){this.componentControls.forEach(r=>{r.start(t.nativeEvent||t,s)})}cancel(){this.componentControls.forEach(t=>{t.cancel()})}stop(){this.componentControls.forEach(t=>{t.stop()})}}const mb=()=>new ub;function hb(){return zr(mb)}const fb="dork-labs/dorkos",pb=`https://github.com/${fb}/issues/new`,gb={"tunnel.enabled":"boolean","tasks.enabled":"boolean","relay.enabled":"boolean","scheduler.enabled":"boolean","mesh.enabled":"boolean","mcp.enabled":"boolean","telemetry.install":"boolean","telemetry.heartbeat":"boolean","telemetry.errorReporting":"boolean","auth.enabled":"boolean","workspace.enabled":"boolean","harness.autoSync":"boolean","harness.autoAdopt":"boolean","runtimes.codex.enabled":"boolean","runtimes.opencode.enabled":"boolean","runtimes.default":"enum","logging.level":"enum","ui.theme":"enum"},xb={"runtimes.default":["claude-code","codex","opencode","doe"],"logging.level":["fatal","error","warn","info","debug","trace"],"ui.theme":["light","dark","system"]},bb=/^[a-z0-9][a-z0-9._-]{0,31}$/,yb={bug:["bug"],feature:["enhancement"],runtime:["bug"]},vb={bug:"Bug: (describe what went wrong)",feature:"Feature: (describe what you want)",runtime:"Runtime issue: (describe what went wrong)"};function wb(e){return e.replace(/\b(?:sk-|pk-|rk-|ghp_|gho_|ghu_|ghs_|github_pat_|glpat-|npm_|xox[baprsc]-)[A-Za-z0-9._-]+/g,"[redacted]").replace(/\b(?:AKIA|ASIA|AGPA|AIDA|AROA|ANPA)[0-9A-Z]{16}\b/g,"[redacted]").replace(/\bBearer\s+[A-Za-z0-9._-]+/gi,"[redacted]")}function bo(e){return wb(e).replace(/[^\s/@]+@[^\s/@]+\.[^\s/@]+/g,"[email]").replace(/\b\d{1,3}(?:\.\d{1,3}){3}\b/g,"[ip]").replace(/\b(?:[A-Fa-f0-9]{1,4}:){2,7}[A-Fa-f0-9]{1,4}\b/g,"[ip]").replace(new RegExp("(?<![\\w:.])(?:[A-Fa-f0-9]{1,4})?(?::[A-Fa-f0-9]{0,4}){2,}(?![\\w:.])","g"),"[ip]").replace(/\\\\[^\s\\]+(?:\\[^\s\\]+)+/g,"[path]").replace(/(^|[\s"'`(<[{])\/\/[^\s"'`)>\]}/]+\/[^\s"'`)>\]}]+/g,"$1[path]").replace(/\b[A-Za-z]:\\[^\r\n]*/g,"[path]").replace(/(^|[\s"'`(<[{/:])(~|\/(?:Users|home))\/[^\s"'`)>\]}]+/g,"$1[home]").replace(/(^|[\s"'`(<[{])\/[\w.-]+(?:\/[\w.-]*)+/g,"$1[path]").replace(/\b(?=[A-Za-z0-9_-]*\d)[A-Za-z0-9_-]{24,}\b/g,"[redacted]")}function jb(e,t){const s=xb[e];return s?s.includes(t):bb.test(t)&&bo(t)===t}function kb(e){const t={};for(const[s,r]of Object.entries(gb)){const o=e[s];o!=null&&(r==="boolean"&&typeof o=="boolean"||r==="number"&&typeof o=="number"&&Number.isFinite(o)||r==="enum"&&typeof o=="string"&&jb(s,o))&&(t[s]=o)}return t}const Sb=["details","summary"];function yo(e){return ux(bo(e),Sb)}function Cb(e){const t=e.runtimes.length>0?e.runtimes.join(", "):"none configured",s=Object.entries(e.flags).map(([o,a])=>`- ${o}: ${String(a)}`).join(`
2
2
  `),r=[`- DorkOS version: ${e.version}`,`- OS / arch: ${e.platform}`,`- Runtimes configured: ${t}`,`- Reported from: ${e.surface}`,"","Settings (on/off values only, no secrets or file paths):",s.length>0?s:"- (none available)"];return bo(r.join(`
3
3
  `))}function Nb(e){var s;const t=(s=e.body)==null?void 0:s.trim();return t?[yo(t)]:e.kind==="feature"?["## What do you want DorkOS to do?","","","## Why would it help?","",""]:["## What happened?","","","## What did you expect?","","","## Steps to reproduce","","1. ","2. ","3. "]}function Ab(e){return["<details><summary>Environment</summary>","",Cb(e),"","</details>","","DorkOS filled in the details above. Please check them and remove anything you do not want to share.","","---","",...Nb(e)].join(`
4
4
  `)}function Ks(e){var r;const t=(r=e.title)==null?void 0:r.trim(),s=new URLSearchParams({title:yo(t||vb[e.kind]),body:Ab(e),labels:yb[e.kind].join(",")});return`${pb}?${s.toString()}`}const Eb=6e3,da=`
@@ -1 +1 @@
1
- import{j as o,ch as t}from"./index-BZKMWkth.js";function e(){return o.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:o.jsx(t,{})})}const s=e;export{s as component};
1
+ import{j as o,ch as t}from"./index-Dr-0P6rd.js";function e(){return o.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:o.jsx(t,{})})}const s=e;export{s as component};