@p4code/cli 0.9.25 → 0.9.26

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 (288) hide show
  1. package/dist/{TraceDiagnostics-BHUn_HS7.mjs → TraceDiagnostics-D1Qz3qce.mjs} +3 -3
  2. package/dist/bin.mjs +1 -1
  3. package/dist/{binCli-DzJr0M8f.mjs → binCli-CcEaWLAR.mjs} +6 -6
  4. package/dist/client/.vite/manifest.json +2130 -2130
  5. package/dist/client/assets/{2NI2N5EU-DU0Cg_Lb.js → 2NI2N5EU--LXjbTE-.js} +2 -2
  6. package/dist/client/assets/{4UO7MD6I-B38qXGVF.js → 4UO7MD6I-D_jr6_IV.js} +2 -2
  7. package/dist/client/assets/{5B3SVYGG-FTIXhvjJ.js → 5B3SVYGG-tThUTA_S.js} +2 -2
  8. package/dist/client/assets/{5GK6JWQ2-H3C8D_6P.js → 5GK6JWQ2-BCuuAhKJ.js} +2 -2
  9. package/dist/client/assets/{5N7A7DKN-CozSLHAy.js → 5N7A7DKN-rdPMRoZL.js} +2 -2
  10. package/dist/client/assets/{5OC2THR4-CEpIVrtv.js → 5OC2THR4-gvpm3IL0.js} +2 -2
  11. package/dist/client/assets/{5S6HY5KT-BJiBcrC3.js → 5S6HY5KT-CWanNmdR.js} +2 -2
  12. package/dist/client/assets/{6IMQ5BUJ-Bc6nCKkc.js → 6IMQ5BUJ-1sguTKZ9.js} +2 -2
  13. package/dist/client/assets/{6OLKWJ4F-BQObFAo6.js → 6OLKWJ4F-9loy41nw.js} +2 -2
  14. package/dist/client/assets/{74OO7NKP-Bf7mJdAJ.js → 74OO7NKP-ukQR6jKi.js} +2 -2
  15. package/dist/client/assets/{75O6YZUN-CW0D2fdL.js → 75O6YZUN-BjBd5LQ0.js} +2 -2
  16. package/dist/client/assets/{77XECAW3-DYpoU6GE.js → 77XECAW3-Ccw2Y7VD.js} +2 -2
  17. package/dist/client/assets/{ABYRPUBD-DspDYvjC.js → ABYRPUBD-CvqVJLPf.js} +2 -2
  18. package/dist/client/assets/AlertDialogRoot-CimqRgXh.js +2 -0
  19. package/dist/client/assets/{AnimatedHeight-baWnHH74.js → AnimatedHeight-Dwarin_V.js} +2 -2
  20. package/dist/client/assets/{AuthSurfaceShell-DpXUdirf.js → AuthSurfaceShell-BvGaTutU.js} +2 -2
  21. package/dist/client/assets/{BB2UYUI2-DBvVdzXq.js → BB2UYUI2-Drnmium_.js} +2 -2
  22. package/dist/client/assets/{BUM34MOA-DD8_qVgf.js → BUM34MOA-AkPmeijf.js} +2 -2
  23. package/dist/client/assets/{CEQABKGZ-CVQF1BSd.js → CEQABKGZ-BNUlDSIK.js} +2 -2
  24. package/dist/client/assets/{CXAC5362-D-ErUdji.js → CXAC5362-Bmar3Iii.js} +2 -2
  25. package/dist/client/assets/{ChatGptUsageButton-CQGToDEF.js → ChatGptUsageButton-D6Iy8SVv.js} +2 -2
  26. package/dist/client/assets/{ChatMarkdown-LJASbkfc.js → ChatMarkdown-DHhJpg3q.js} +7 -7
  27. package/dist/client/assets/{CheckboxIndicator-C1r4pplS.js → CheckboxIndicator-DbA95VlZ.js} +2 -2
  28. package/dist/client/assets/{ClippedText-DfXsEQeG.js → ClippedText-UM8CaEu4.js} +2 -2
  29. package/dist/client/assets/{CodexSetupSection.logic-Bc4DfjCh.js → CodexSetupSection.logic-kKJPABQZ.js} +2 -2
  30. package/dist/client/assets/{CollapsiblePanel-BXH3rQRh.js → CollapsiblePanel-C1iRr4kZ.js} +2 -2
  31. package/dist/client/assets/{ComboboxClear-CVernRAh.js → ComboboxClear-DaifQLU5.js} +2 -2
  32. package/dist/client/assets/{ComboboxGroupLabel-DvjyoFJL.js → ComboboxGroupLabel-C03JGZRD.js} +2 -2
  33. package/dist/client/assets/{CommandBlock-WsIIEStK.js → CommandBlock-DH_L_Tgo.js} +2 -2
  34. package/dist/client/assets/{CompositeRoot-ByiP4GnC.js → CompositeRoot-B1DTZCNU.js} +2 -2
  35. package/dist/client/assets/{ConnectAgentSurface-DvJ8PBIx.js → ConnectAgentSurface-C5bZc2ZR.js} +2 -2
  36. package/dist/client/assets/{ConnectionStatusDot-K3y7Ct8v.js → ConnectionStatusDot-CCTiSlHA.js} +2 -2
  37. package/dist/client/assets/{DRLTVNUE-31JTQ6nY.js → DRLTVNUE-BqWUfmRf.js} +2 -2
  38. package/dist/client/assets/{DYY6UVD2-D_ZDUMtR.js → DYY6UVD2-CyRsghfa.js} +2 -2
  39. package/dist/client/assets/{DevicePanel-DZK0y5Ap.js → DevicePanel-DocID7hH.js} +2 -2
  40. package/dist/client/assets/{DeviceSetup-D3E85Zrd.js → DeviceSetup-CX2OWVB9.js} +2 -2
  41. package/dist/client/assets/{DialogRoot-CNtnfAJy.js → DialogRoot-D64NsaiW.js} +2 -2
  42. package/dist/client/assets/{DialogTitle-DV_YdpJC.js → DialogTitle-CYefNdHm.js} +2 -2
  43. package/dist/client/assets/{DiffCommentAnnotation-BOVXuQGc.js → DiffCommentAnnotation-ChKqFxt5.js} +2 -2
  44. package/dist/client/assets/{DiffFileTree-B5NHhHgk.js → DiffFileTree-B6AgzOXX.js} +2 -2
  45. package/dist/client/assets/{DiffPanel-Iu14e7z4.js → DiffPanel-DKAHtq5x.js} +2 -2
  46. package/dist/client/assets/{DiffWorkerPoolProvider-Dwi-pu0V.js → DiffWorkerPoolProvider-CK3y5UA1.js} +2 -2
  47. package/dist/client/assets/{EmbeddedDesign-B7W3XrYS.js → EmbeddedDesign-Bj-kkArq.js} +5 -5
  48. package/dist/client/assets/{EnvironmentMachineIcon-CXBfI2NX.js → EnvironmentMachineIcon-CJ30kzSK.js} +2 -2
  49. package/dist/client/assets/{ExpandableText-DfUAVk6K.js → ExpandableText-CBPvhWvZ.js} +2 -2
  50. package/dist/client/assets/{FNOVOB4O-uinkA45N.js → FNOVOB4O-DYXYw-b1.js} +2 -2
  51. package/dist/client/assets/{FieldControl-CIowDCcv.js → FieldControl-CkgERQaU.js} +2 -2
  52. package/dist/client/assets/{FileDiff-BmQX_G3I.js → FileDiff-BLuBewdN.js} +2 -2
  53. package/dist/client/assets/{FilePreviewPanel-X0C-_bsa.js → FilePreviewPanel-DWNimHTU.js} +5 -5
  54. package/dist/client/assets/{FoldedSettingsSection-veJCJBGN.js → FoldedSettingsSection-C3cuD_W9.js} +2 -2
  55. package/dist/client/assets/{HDGCDEEZ-C-FshFnT.js → HDGCDEEZ-7WPyPcLr.js} +2 -2
  56. package/dist/client/assets/{HSJLKHB7-DkWuWTFm.js → HSJLKHB7-t8_OkffK.js} +2 -2
  57. package/dist/client/assets/{Icons-CzUirT4o.js → Icons-BUrn1Fzo.js} +2 -2
  58. package/dist/client/assets/Input-Gb8KV9DV.js +2 -0
  59. package/dist/client/assets/{IntervalSecondsField-jhisp3XJ.js → IntervalSecondsField-D9JXVV-s.js} +2 -2
  60. package/dist/client/assets/JZOYTAAL-BzA5Kg5m.js +1 -0
  61. package/dist/client/assets/{K3MD6TGW-a8yr5Ewj.js → K3MD6TGW-DoqPvoaq.js} +2 -2
  62. package/dist/client/assets/{K7RP3OMA-B0CXNed1.js → K7RP3OMA--ZFOkyEG.js} +2 -2
  63. package/dist/client/assets/{KeybindingsSettings.logic-BJLp2hK6.js → KeybindingsSettings.logic-CMs7OPcH.js} +2 -2
  64. package/dist/client/assets/{LHDIQX7Q-CkhjJ70Y.js → LHDIQX7Q-hUqw2I9B.js} +2 -2
  65. package/dist/client/assets/{LUXOKEGN-DhYrChjL.js → LUXOKEGN-Dvu_mp-q.js} +2 -2
  66. package/dist/client/assets/{LinkMachineSelect-rWCX7r86.js → LinkMachineSelect-SHXPDP_g.js} +2 -2
  67. package/dist/client/assets/{MathTypeset-C9x0hMF0.js → MathTypeset-TM-3r0WA.js} +2 -2
  68. package/dist/client/assets/{ModelLiveLayer-Dv_jCIXj.js → ModelLiveLayer-Bb-7OhJ9.js} +3 -3
  69. package/dist/client/assets/{N3JZAHOW-B97FAWso.js → N3JZAHOW-LjhhJ-00.js} +2 -2
  70. package/dist/client/assets/{NUIALGQ3-Dq5lVW3w.js → NUIALGQ3-Dg1KXz02.js} +2 -2
  71. package/dist/client/assets/{NoProjectsHero-BsinbzdV.js → NoProjectsHero-D0OPZtzO.js} +2 -2
  72. package/dist/client/assets/{O65XPQGZ-D4-546m0.js → O65XPQGZ-BxaJR80d.js} +2 -2
  73. package/dist/client/assets/{O7XIQ6OM-BPEf7K4J.js → O7XIQ6OM-CCXPxMuU.js} +2 -2
  74. package/dist/client/assets/{OFQON5FD-ANLB_eks.js → OFQON5FD-WUMBXQkX.js} +2 -2
  75. package/dist/client/assets/{P4ConnectAccountPages-BkUG1cNj.js → P4ConnectAccountPages-BNK6s-RS.js} +2 -2
  76. package/dist/client/assets/{P4ConnectSidebarSignIn-Bd8SD-N2.js → P4ConnectSidebarSignIn-CWW40SMl.js} +2 -2
  77. package/dist/client/assets/{PJQHF43J-U5Qjv9uU.js → PJQHF43J-BrNjCaLl.js} +2 -2
  78. package/dist/client/assets/{PanelLayoutControls-BiOzQEUj.js → PanelLayoutControls-DiXjRWIw.js} +7 -7
  79. package/dist/client/assets/{PierreEntryIcon-C3yCp-3j.js → PierreEntryIcon-D29_Ylm_.js} +2 -2
  80. package/dist/client/assets/{PopoverHandle-BOG8GZW9.js → PopoverHandle-BgggGdpn.js} +2 -2
  81. package/dist/client/assets/PreviewPanel-DutKwWE7.js +2 -0
  82. package/dist/client/assets/{ProjectDefaultsSettings-BNoHUxLB.js → ProjectDefaultsSettings-DMfJN66D.js} +2 -2
  83. package/dist/client/assets/{ProjectFavicon-DJihy670.js → ProjectFavicon-DFI1NI3D.js} +3 -3
  84. package/dist/client/assets/{ProjectIconPickerDialog-B64NU333.js → ProjectIconPickerDialog-BqGWzrTc.js} +2 -2
  85. package/dist/client/assets/{ProjectMonogram-Bm8g4eoe.js → ProjectMonogram-D4xxVtw8.js} +2 -2
  86. package/dist/client/assets/{ProviderAuthTerminal-ep_3vQXs.js → ProviderAuthTerminal-CRSvI-Og.js} +2 -2
  87. package/dist/client/assets/ProviderModelPicker-D73G0AKf.js +2 -0
  88. package/dist/client/assets/{ProviderSettingsForm-DdzTiAwr.js → ProviderSettingsForm-DchD8HSN.js} +2 -2
  89. package/dist/client/assets/{PullRequestCodeTab-DxIVyifS.js → PullRequestCodeTab-BdXdTg-d.js} +3 -3
  90. package/dist/client/assets/{RHNBAITX-Ca700xaA.js → RHNBAITX-PsYrngSs.js} +2 -2
  91. package/dist/client/assets/{ReadOnlySourcePreview-DwbQjZ6S.js → ReadOnlySourcePreview-8jLKmc3M.js} +2 -2
  92. package/dist/client/assets/{RedactedSensitiveText-CKBxO8RE.js → RedactedSensitiveText-DhV2Jdu8.js} +2 -2
  93. package/dist/client/assets/{RenderErrorBoundary-Ds0CLe6f.js → RenderErrorBoundary-56lc2IQ3.js} +2 -2
  94. package/dist/client/assets/{RightPanelResizeHandle-kgBW_OmO.js → RightPanelResizeHandle-ClzdYxWw.js} +2 -2
  95. package/dist/client/assets/{SLD4V6NK-DHgBQG4y.js → SLD4V6NK-CxidvPXU.js} +2 -2
  96. package/dist/client/assets/{ScheduledTasksSettings-G10yO5DO.js → ScheduledTasksSettings-BdMCgBm5.js} +5 -5
  97. package/dist/client/assets/{ScopedSwitch-DGi7EZuF.js → ScopedSwitch-CwnjCta_.js} +2 -2
  98. package/dist/client/assets/{ScrollAreaCorner-sEIv5sN-.js → ScrollAreaCorner-CfTQYjCW.js} +2 -2
  99. package/dist/client/assets/{SecretInput-C8mfkoqW.js → SecretInput-BYfVbTLh.js} +2 -2
  100. package/dist/client/assets/{SelectScrollUpArrow-BBy8ExJB.js → SelectScrollUpArrow-BE0-tVtP.js} +2 -2
  101. package/dist/client/assets/{SelfImproveSettingsSection-CJpzoxZq.js → SelfImproveSettingsSection-DsqFeICK.js} +2 -2
  102. package/dist/client/assets/{SettingsPanels-CKuvIEcT.js → SettingsPanels-D_rJsyjt.js} +7 -7
  103. package/dist/client/assets/{SettingsPanels.logic-mWhM0JKq.js → SettingsPanels.logic-BTJUBh-T.js} +2 -2
  104. package/dist/client/assets/{SettingsScopeNotice-CYlVOS9U.js → SettingsScopeNotice-CAVvn3pQ.js} +2 -2
  105. package/dist/client/assets/{SidebarStageBackdrop-CcJgZb4i.js → SidebarStageBackdrop-DdxWuxIk.js} +2 -2
  106. package/dist/client/assets/{T3PCR2KE-sETS2BfN.js → T3PCR2KE-BtQsKjM5.js} +2 -2
  107. package/dist/client/assets/{TKWO2OVW-DOxrph0T.js → TKWO2OVW-CeYF-suq.js} +2 -2
  108. package/dist/client/assets/{TSHNXIZL-LkLzenBL.js → TSHNXIZL-FQ7ZWHEn.js} +2 -2
  109. package/dist/client/assets/{ThemeEditorPanel-BSPkdhmj.js → ThemeEditorPanel-BJucNhy-.js} +2 -2
  110. package/dist/client/assets/{ThreadDetailsItemsMenu-8anoK4Or.js → ThreadDetailsItemsMenu-CRBBIuc7.js} +8 -8
  111. package/dist/client/assets/{ThreadTerminalDrawer-Wd-He1GI.js → ThreadTerminalDrawer-Ci0mbLzJ.js} +4 -4
  112. package/dist/client/assets/{TooltipProvider-DMrkN3Xd.js → TooltipProvider-BH5ni_Lo.js} +2 -2
  113. package/dist/client/assets/{UQJE5E4I-DbEWChzq.js → UQJE5E4I-CeqBk-r6.js} +2 -2
  114. package/dist/client/assets/{USNYFO5S-D2NfvkZx.js → USNYFO5S-_1m41tJt.js} +2 -2
  115. package/dist/client/assets/{Virtualizer-C2gQRrRy.js → Virtualizer-DLB0FYm-.js} +2 -2
  116. package/dist/client/assets/{WEVWDWVA-CWLLvNnc.js → WEVWDWVA-DmSV8HLL.js} +2 -2
  117. package/dist/client/assets/{WorkspaceBreadcrumb-DDBBo54L.js → WorkspaceBreadcrumb-DQkeBQUl.js} +2 -2
  118. package/dist/client/assets/{WorkspacePageContainer-D-b_7VnU.js → WorkspacePageContainer-D2rx9iDg.js} +2 -2
  119. package/dist/client/assets/{WorkspacePageHeader-C8bAlMLy.js → WorkspacePageHeader-D8-RIRjQ.js} +2 -2
  120. package/dist/client/assets/{X5RFHQXM-B_4xBer1.js → X5RFHQXM-BUdDYXox.js} +2 -2
  121. package/dist/client/assets/{X62E3GBT-DH4DDJbS.js → X62E3GBT-BbQ7FmNB.js} +2 -2
  122. package/dist/client/assets/{XBNEOJTC-CH0FX2u2.js → XBNEOJTC-BLEZA-vx.js} +2 -2
  123. package/dist/client/assets/{YHV2MVVZ-vkFosclt.js → YHV2MVVZ-DM2RTtkR.js} +2 -2
  124. package/dist/client/assets/{YURCZMG2-CflztzI6.js → YURCZMG2-D5w6cPMY.js} +2 -2
  125. package/dist/client/assets/{YVG2LODB-BU5mIo0f.js → YVG2LODB-BkLbsaCo.js} +2 -2
  126. package/dist/client/assets/{_chat-rr4Pa6Jr.js → _chat-CKMs-ajx.js} +19 -19
  127. package/dist/client/assets/{_chat.design-DcTokS2n.js → _chat.design-CpqXODBn.js} +2 -2
  128. package/dist/client/assets/{_chat.index-Cx2rD23U.js → _chat.index-B0eOfZAf.js} +2 -2
  129. package/dist/client/assets/{_chat.new-Bef-dZPa.js → _chat.new-CqLuDynd.js} +2 -2
  130. package/dist/client/assets/{_chat.pull-requests-CEwED8fj.js → _chat.pull-requests-C4Eo8GDQ.js} +2 -2
  131. package/dist/client/assets/{alert-iNR43-xr.js → alert-D1O9oex3.js} +2 -2
  132. package/dist/client/assets/{alert-dialog-B7VzBOev.js → alert-dialog-3XDceRWv.js} +2 -2
  133. package/dist/client/assets/{assetUrls-BMHkXryh.js → assetUrls-Dq0gsqWs.js} +2 -2
  134. package/dist/client/assets/{assets-C96oF_eX.js → assets-C3_UZib9.js} +2 -2
  135. package/dist/client/assets/{browserHistoryStore-DcyxHvEZ.js → browserHistoryStore-CVCo7qfb.js} +2 -2
  136. package/dist/client/assets/{browserLinkTarget-5NDfBwMZ.js → browserLinkTarget-CopcRHna.js} +2 -2
  137. package/dist/client/assets/{checkbox-BnoBa5Yw.js → checkbox-CxRqp4sO.js} +2 -2
  138. package/dist/client/assets/{color-picker-DGBwf4df.js → color-picker-CvbP7BS3.js} +2 -2
  139. package/dist/client/assets/{combobox-BViCCYpe.js → combobox-CuyUAuiC.js} +2 -2
  140. package/dist/client/assets/{command-DD9AbES_.js → command-4bqVdX0m.js} +2 -2
  141. package/dist/client/assets/{connect-B3_KXIyQ.js → connect-DFGquf-O.js} +2 -2
  142. package/dist/client/assets/connect-agent-Db5rxxY1.js +2 -0
  143. package/dist/client/assets/{design-BwQ33zDs.js → design-DzoN9JgQ.js} +2 -2
  144. package/dist/client/assets/{device-CAueNfph.js → device-H2MyT_kA.js} +2 -2
  145. package/dist/client/assets/{dialog-DvBVJIw1.js → dialog-CrLVN_m6.js} +2 -2
  146. package/dist/client/assets/{diffPanelStore-B43kjSer.js → diffPanelStore-CxnPNigi.js} +2 -2
  147. package/dist/client/assets/{diffRendering-DwbgLJaq.js → diffRendering-cyTQV5bk.js} +2 -2
  148. package/dist/client/assets/{dist-B-8eHEk-.js → dist-J7s-H61h.js} +3 -3
  149. package/dist/client/assets/{draft-input-CBmbOI5j.js → draft-input-UuEBPJE8.js} +2 -2
  150. package/dist/client/assets/{duoViewer-Dml9fvvm.js → duoViewer-C3DQnADY.js} +2 -2
  151. package/dist/client/assets/{dynamic-C2hTfNo4.js → dynamic-PDa6LTqb.js} +2 -2
  152. package/dist/client/assets/{embeddedScripts-DmobRpxc.js → embeddedScripts-BDzRNXSL.js} +2 -2
  153. package/dist/client/assets/{empty-CGA6iTo1.js → empty-YMXgQbNI.js} +2 -2
  154. package/dist/client/assets/{entities-ygRGujH7.js → entities-HOBDIiHK.js} +2 -2
  155. package/dist/client/assets/{fileLinks-COT45KrB.js → fileLinks-BlT4My6t.js} +2 -2
  156. package/dist/client/assets/{fileTreeExpansion-t42YM2NT.js → fileTreeExpansion-D5nN-Oqd.js} +2 -2
  157. package/dist/client/assets/{getDiffFileInput-BRoo9f7T.js → getDiffFileInput-4gToQuSl.js} +2 -2
  158. package/dist/client/assets/{htmlRender-w5A35V7p.js → htmlRender-CUGVJXGf.js} +2 -2
  159. package/dist/client/assets/{index-BfU6cQrF.js → index-C04a0SKq.js} +3 -3
  160. package/dist/client/assets/{input-L7UBCORX.js → input-DxHa9qj5.js} +2 -2
  161. package/dist/client/assets/{input-group-B4A2yaVX.js → input-group-_rAbDbys.js} +2 -2
  162. package/dist/client/assets/{kbd-CNvVBYtE.js → kbd-DjUfNaix.js} +2 -2
  163. package/dist/client/assets/{keybindings-DoiXiZn5.js → keybindings-8_1sqf8s.js} +2 -2
  164. package/dist/client/assets/{lazy-BYuTmsKJ.js → lazy-C1dqAep6.js} +4 -4
  165. package/dist/client/assets/{lazyRouteComponent-DlaI8YOu.js → lazyRouteComponent-DLamKhHF.js} +2 -2
  166. package/dist/client/assets/{link-Vg2garcH.js → link-D1nkgCv7.js} +2 -2
  167. package/dist/client/assets/{linkedPrompt-Bg0S0srn.js → linkedPrompt-Quysf0mk.js} +2 -2
  168. package/dist/client/assets/main-BFdCLmkY.js +39 -0
  169. package/dist/client/assets/{mediaReference-BGHvhhnE.js → mediaReference-D19Dzoh3.js} +2 -2
  170. package/dist/client/assets/{mediaSource-CeGNee1z.js → mediaSource-DfsR3T70.js} +2 -2
  171. package/dist/client/assets/{modelScene-DtBAQ8-k.js → modelScene-CcF-Uii-.js} +2 -2
  172. package/dist/client/assets/{number-field-BRlzUJEB.js → number-field-CALZZPio.js} +2 -2
  173. package/dist/client/assets/{observeResize-CNiPL-bo.js → observeResize-DLmefMqO.js} +2 -2
  174. package/dist/client/assets/{onboarding-9Isl06ny.js → onboarding-plATuZco.js} +2 -2
  175. package/dist/client/assets/{openFileInPreview-CgNdFzHq.js → openFileInPreview-BCGQQ_Ia.js} +2 -2
  176. package/dist/client/assets/{p4ProjectFile-kzawDum5.js → p4ProjectFile-DCNJ4pTp.js} +2 -2
  177. package/dist/client/assets/{pair-ClGrg_fl.js → pair-umv6-haX.js} +2 -2
  178. package/dist/client/assets/{pendingSendStore-Kz-cNs4v.js → pendingSendStore-CgfQk4GV.js} +2 -2
  179. package/dist/client/assets/{phoneViewer-B5Ue7Mj_.js → phoneViewer-DJWjzgFc.js} +2 -2
  180. package/dist/client/assets/{pierre-icons-cxD685IX.js → pierre-icons-fv1goMS6.js} +2 -2
  181. package/dist/client/assets/{popover-DYDa4qjy.js → popover-DxCAIK62.js} +2 -2
  182. package/dist/client/assets/{preview-BypB2j7r.js → preview-Ce5ECOHv.js} +2 -2
  183. package/dist/client/assets/{preview-BPJ2QBFC.js → preview-x1tmlUez.js} +2 -2
  184. package/dist/client/assets/{previewMiniPlayerStore-C_zTFBAY.js → previewMiniPlayerStore-CEd7VI6J.js} +2 -2
  185. package/dist/client/assets/{primary-BP9P8Pte.js → primary-DcnaBKM0.js} +2 -2
  186. package/dist/client/assets/{primaryCloudLinkState-DRbP1pee.js → primaryCloudLinkState-TS0IW37f.js} +2 -2
  187. package/dist/client/assets/{projectFilesQueryState-DodSPNTI.js → projectFilesQueryState-DKw9S3nn.js} +2 -2
  188. package/dist/client/assets/{projectScriptEditor-DxYgPh8M.js → projectScriptEditor-DT7-Ivvb.js} +2 -2
  189. package/dist/client/assets/{providerSkills-DA9qtjVM.js → providerSkills-G8ld9nNp.js} +2 -2
  190. package/dist/client/assets/{pullRequestDetail.logic-Car0C0YH.js → pullRequestDetail.logic-Dm3mx1US.js} +2 -2
  191. package/dist/client/assets/{pullRequestIcons-CJzQ9q45.js → pullRequestIcons-D8rnFTkk.js} +2 -2
  192. package/dist/client/assets/{pullRequestReviewStore-CWrDaNh_.js → pullRequestReviewStore-C45fih_P.js} +2 -2
  193. package/dist/client/assets/{pullRequests-Dx8h1wyx.js → pullRequests-euX1Ch2G.js} +2 -2
  194. package/dist/client/assets/{queries-DY1lhLYl.js → queries-DNRXml7d.js} +2 -2
  195. package/dist/client/assets/{query-C-5C8CaD.js → query-Bw8YoCbO.js} +2 -2
  196. package/dist/client/assets/{radio-group-DpsCw8_-.js → radio-group-DpD3XHAp.js} +2 -2
  197. package/dist/client/assets/{relay-Bjm0weca.js → relay-YiJpGyaO.js} +2 -2
  198. package/dist/client/assets/{relayFailureReason-1tQ1xfnE.js → relayFailureReason-Baxcpnas.js} +2 -2
  199. package/dist/client/assets/{renderScheduler-Bza_olpQ.js → renderScheduler-BuGbk7RK.js} +2 -2
  200. package/dist/client/assets/{rightPanelStore-BNvdVe0q.js → rightPanelStore-BF1zmmXM.js} +2 -2
  201. package/dist/client/assets/{runtime-DGtwOpiP.js → runtime-DIAcbMTc.js} +5 -5
  202. package/dist/client/assets/{runtimeModeConfig-DicWhVdl.js → runtimeModeConfig-4g_-_dE2.js} +2 -2
  203. package/dist/client/assets/{scheduledTasksSettings.logic-u5XriP_U.js → scheduledTasksSettings.logic-BOrkdeD3.js} +2 -2
  204. package/dist/client/assets/{scroll-area-Ct6TrgZr.js → scroll-area-CokPD3-i.js} +2 -2
  205. package/dist/client/assets/{select-B3jSTp6e.js → select-CxYi0YMi.js} +2 -2
  206. package/dist/client/assets/{selfImproveFindings-Bw954UOu.js → selfImproveFindings-CE-lxRTw.js} +2 -2
  207. package/dist/client/assets/{server-BjY-vKW2.js → server-BNjk2K1j.js} +2 -2
  208. package/dist/client/assets/{session-CkASndp1.js → session-DMNo4Bh3.js} +2 -2
  209. package/dist/client/assets/{session-logic-C3HuEav7.js → session-logic-CELyWJ1v.js} +2 -2
  210. package/dist/client/assets/{settings-DpDhgaUs.js → settings-Bt6o5coA.js} +2 -2
  211. package/dist/client/assets/{settings.appearance-BMBe1DlC.js → settings.appearance-pkRxkhgs.js} +2 -2
  212. package/dist/client/assets/settings.archived-OjOh5b0A.js +2 -0
  213. package/dist/client/assets/{settings.computer-use-dlKT7XFQ.js → settings.computer-use-Dh6Z2-Jg.js} +2 -2
  214. package/dist/client/assets/{settings.connections-BaU6DQRh.js → settings.connections-F3LWiK8-.js} +2 -2
  215. package/dist/client/assets/{settings.data-controls-DrInQbPq.js → settings.data-controls-DgOo9a4b.js} +2 -2
  216. package/dist/client/assets/{settings.decisions-Dibz4qNv.js → settings.decisions-lQFEkC9t.js} +2 -2
  217. package/dist/client/assets/{settings.designs-BGdZiNGp.js → settings.designs-C1tyiETD.js} +2 -2
  218. package/dist/client/assets/settings.diagnostics-kp_wJw6e.js +2 -0
  219. package/dist/client/assets/{settings.general-rsdZzWCJ.js → settings.general-B5Kke4t3.js} +2 -2
  220. package/dist/client/assets/{settings.integrations-DK-S9Pa1.js → settings.integrations-CjiKCDy_.js} +2 -2
  221. package/dist/client/assets/{settings.keybindings-Coe8Ydce.js → settings.keybindings-CouYSmxE.js} +2 -2
  222. package/dist/client/assets/{settings.open-source-licenses--xUZ68RR.js → settings.open-source-licenses-CHFTLx1q.js} +2 -2
  223. package/dist/client/assets/{settings.plugins-DXoF7IBB.js → settings.plugins-StUBBho3.js} +3 -3
  224. package/dist/client/assets/{settings.projects-ChEJ7uSA.js → settings.projects-B_SxK9Cl.js} +3 -3
  225. package/dist/client/assets/{settings.providers-BYwf6_Ds.js → settings.providers-Ch16WkgV.js} +3 -3
  226. package/dist/client/assets/{settings.scheduled-tasks-Cu69dh_-.js → settings.scheduled-tasks-KNcUc94O.js} +2 -2
  227. package/dist/client/assets/{settings.secrets-CdyzqqJR.js → settings.secrets-2aMmfgKR.js} +2 -2
  228. package/dist/client/assets/{settings.snap-shot-DdYHf8Q5.js → settings.snap-shot-B5cEBXZD.js} +2 -2
  229. package/dist/client/assets/settings.source-control-G_TX95re.js +2 -0
  230. package/dist/client/assets/{settings.storage-CuUZoWfT.js → settings.storage-BdNNKm9m.js} +2 -2
  231. package/dist/client/assets/{settingsLayout-DbyBB8ZI.js → settingsLayout-CzGbLP4v.js} +2 -2
  232. package/dist/client/assets/{sidebar-Do4Myy34.js → sidebar-ovj9EiR4.js} +2 -2
  233. package/dist/client/assets/{sidebarProjectGrouping-Ks0H3W1r.js → sidebarProjectGrouping-DT6LCDEX.js} +2 -2
  234. package/dist/client/assets/{skeleton-M5MIqTy6.js → skeleton-0IEb3e4e.js} +2 -2
  235. package/dist/client/assets/{sourceControl-gpSCT1i6.js → sourceControl-CPobWWHq.js} +2 -2
  236. package/dist/client/assets/{sourceControlClients-YDf1HZkJ.js → sourceControlClients-4PlkytxQ.js} +2 -2
  237. package/dist/client/assets/{spinner-89SWutMk.js → spinner-7CSKKESP.js} +2 -2
  238. package/dist/client/assets/{src-upZEL2qH.js → src-BVovWpja.js} +2 -2
  239. package/dist/client/assets/{terminal-links-ztYtKVge.js → terminal-links-BTdovUFa.js} +2 -2
  240. package/dist/client/assets/{terminalSessions-DuQL-Su5.js → terminalSessions-EUiRWJti.js} +2 -2
  241. package/dist/client/assets/{textarea-Dk6r4lQ8.js → textarea-DMmmmGA1.js} +2 -2
  242. package/dist/client/assets/{themePalette-CwTOEe8R.js → themePalette-C7ZOgucT.js} +2 -2
  243. package/dist/client/assets/{threadCheckpoints-BBbnkFJd.js → threadCheckpoints-DjIk4Kvg.js} +2 -2
  244. package/dist/client/assets/{toggle-CzhtG7Ix.js → toggle-4vFx94TS.js} +2 -2
  245. package/dist/client/assets/{toggle-group-DVojM2PG.js → toggle-group-d6H735Xi.js} +2 -2
  246. package/dist/client/assets/{tooltip-CZBiwhnV.js → tooltip-CGvxq8k3.js} +2 -2
  247. package/dist/client/assets/{uiStateStore-DbqU-t2g.js → uiStateStore-MbQdhAPp.js} +2 -2
  248. package/dist/client/assets/{usage-CvKBHOpJ.js → usage-Da_tm2dn.js} +2 -2
  249. package/dist/client/assets/{usageAccess-12EW-JWb.js → usageAccess-B-HGPPkp.js} +2 -2
  250. package/dist/client/assets/{usageFormat-Bpgdmf94.js → usageFormat-DcON9Kz_.js} +2 -2
  251. package/dist/client/assets/{usageShortcuts-BK6jQ69t.js → usageShortcuts-B_o9XxKX.js} +2 -2
  252. package/dist/client/assets/{use-atom-command-Dv8zTjOp.js → use-atom-command-C4Tyb1VL.js} +2 -2
  253. package/dist/client/assets/{useAriaLabelledBy-CLMjXrdj.js → useAriaLabelledBy-CcwjH1QH.js} +2 -2
  254. package/dist/client/assets/useHandleNewThread-Qb_yy6KY.js +2 -0
  255. package/dist/client/assets/{useLocation-DsTBGqgr.js → useLocation-CIvcNoeU.js} +2 -2
  256. package/dist/client/assets/{useNavigate-DeDarx0_.js → useNavigate-DVrOlf8m.js} +2 -2
  257. package/dist/client/assets/{useNavigateBack-nU9Xh3KX.js → useNavigateBack-Dmf0SIc3.js} +2 -2
  258. package/dist/client/assets/{useP4ConnectAuthPrompt-wImG3qls.js → useP4ConnectAuthPrompt-BPXqJdyY.js} +2 -2
  259. package/dist/client/assets/{useParams-D8m5ONq0.js → useParams-BeJIRxxE.js} +2 -2
  260. package/dist/client/assets/{usePermissionStatus-DPEHxlfG.js → usePermissionStatus-Cx1Wuwk0.js} +2 -2
  261. package/dist/client/assets/{usePopupViewport-DDPbext7.js → usePopupViewport-OR_PF2s-.js} +2 -2
  262. package/dist/client/assets/{usePullRequestActions-Bk-wSv5o.js → usePullRequestActions-B_Nrg846.js} +2 -2
  263. package/dist/client/assets/{useRegisterFieldControl-By1bF-jd.js → useRegisterFieldControl-B72Afmil.js} +2 -2
  264. package/dist/client/assets/{useScopedModelAvailability-CTzd1AsV.js → useScopedModelAvailability-DVQ42jT4.js} +2 -2
  265. package/dist/client/assets/{useSettings-DwDYuiOf.js → useSettings-BWMcQzC-.js} +2 -2
  266. package/dist/client/assets/{utils-sVhLpEl6.js → utils-DFNDxNZi.js} +2 -2
  267. package/dist/client/assets/{vcsRefInvalidation-9bbPf9DL.js → vcsRefInvalidation-CV8dYgi0.js} +2 -2
  268. package/dist/client/assets/{welcome-D36q57wJ.js → welcome-BxhPM21H.js} +2 -2
  269. package/dist/client/index.html +1 -1
  270. package/dist/{preview-D0Bi2g4U.mjs → preview-BGylKXB6.mjs} +5 -3
  271. package/dist/{renderer-Cq4PzLVY.mjs → renderer-CQkeNW9b.mjs} +2 -2
  272. package/dist/{runtime-Cy8_QlEa.mjs → runtime-O5AWAEzD.mjs} +2 -2
  273. package/dist/{runtimeLayer-DUru7wpz.mjs → runtimeLayer-C-Fo4HWH.mjs} +1 -1
  274. package/dist/{runtimeLayer-DZa24xtO.mjs → runtimeLayer-ChPBglJB.mjs} +535 -481
  275. package/dist/{server-BK48ByhE.mjs → server-CsS0d2BE.mjs} +116 -15
  276. package/dist/{sha2-D9ocDAIA.mjs → sha2-BjjJcoUu.mjs} +4 -1
  277. package/package.json +1 -1
  278. package/dist/client/assets/AlertDialogRoot-3k-2cSKF.js +0 -2
  279. package/dist/client/assets/Input-DRxcOIy1.js +0 -2
  280. package/dist/client/assets/JZOYTAAL-CaZB6S8Y.js +0 -1
  281. package/dist/client/assets/PreviewPanel-DzlmHQZw.js +0 -2
  282. package/dist/client/assets/ProviderModelPicker-Dj26-4yu.js +0 -2
  283. package/dist/client/assets/connect-agent-CX7YZ3cf.js +0 -2
  284. package/dist/client/assets/main-CNs583QD.js +0 -39
  285. package/dist/client/assets/settings.archived-UyT8Vo2k.js +0 -2
  286. package/dist/client/assets/settings.diagnostics-30yarj2c.js +0 -2
  287. package/dist/client/assets/settings.source-control-x5yuK078.js +0 -2
  288. package/dist/client/assets/useHandleNewThread-Do-y1VVt.js +0 -2
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MathTypeset-C9x0hMF0.js","assets/react-BUfh6y28.js","assets/jsx-runtime-DJeoFXNw.js","assets/katex-B940_AAO.js","assets/MathTypeset-C02HYdjx.css","assets/lazy-BYuTmsKJ.js","assets/index-BfU6cQrF.js"])))=>i.map(i=>d[i]);
2
- import{a as e,n as t,t as n}from"./react-BUfh6y28.js";import{t as r}from"./index-BfU6cQrF.js";import{n as i,t as a}from"./jsx-runtime-DJeoFXNw.js";import{$d as o,$u as s,Ai as c,Al as l,At as u,Bi as d,Co as f,Ea as p,Ei as m,Ff as h,Fi as g,Hf as _,Hr as v,Ir as y,Jd as b,Ji as x,Jo as S,Js as C,Ju as w,Ku as T,Lr as E,Mt as D,Na as O,Ni as k,Nr as A,Os as j,Ri as M,Sf as N,Si as P,Ti as F,To as ee,Ua as te,Ud as ne,Wa as re,Wo as ie,Ys as I,Zl as L,Zn as ae,_i as oe,_u as se,bd as ce,bi as le,dd as ue,fi as de,fr as fe,gi as pe,go as R,gs as me,hi as z,hu as he,iu as ge,ja as _e,jd as ve,jl as ye,ki as be,kr as xe,li as Se,mi as Ce,mr as we,mu as Te,n as Ee,nf as De,no as Oe,np as ke,oi as Ae,op as je,ou as Me,pl as Ne,qa as Pe,rp as Fe,rr as Ie,sf as Le,sl as Re,t as B,tr as ze,ui as Be,un as Ve,vd as He,vi as Ue,wa as We,wc as Ge,wi as Ke,ws as qe,xd as Je,xi as Ye,xo as Xe,xt as Ze,yi as Qe,zi as $e,zl as et,zu as tt}from"./utils-sVhLpEl6.js";import{Ec as nt,K as rt,Sc as it,W as at,Y as ot,aa as st,gn as ct,hc as lt,hl as ut,q as dt,ra as ft,rn as pt,va as mt,vg as ht,xm as gt}from"./src-upZEL2qH.js";import{Ar as _t,Tr as vt,Xn as yt,Zn as bt,_ as xt,er as St,h as Ct,mr as wt,or as Tt,p as Et,pr as Dt,ri as Ot,rr as kt,rt as At}from"./runtime-DGtwOpiP.js";import{C as jt,D as Mt,G as Nt,O as Pt,S as Ft,Y as It,d as Lt}from"./entities-ygRGujH7.js";import{f as Rt,h as zt,i as Bt,n as Vt,s as Ht,t as Ut}from"./useRender-BP5vR6yH.js";import{A as Wt,C as Gt,G as Kt,d as qt,f as Jt,u as Yt}from"./TooltipProvider-DMrkN3Xd.js";import{t as Xt}from"./link-Vg2garcH.js";import{t as Zt}from"./useNavigate-DeDarx0_.js";import{a as Qt,h as $t}from"./relay-Bjm0weca.js";import{J as en,K as tn,Y as nn,at as rn,r as an,s as on}from"./useSettings-DwDYuiOf.js";import{f as sn}from"./server-BjY-vKW2.js";import{i as cn,n as ln,r as un,s as dn,t as fn}from"./session-CkASndp1.js";import{n as pn}from"./query-C-5C8CaD.js";import{t as mn}from"./use-atom-command-Dv8zTjOp.js";import{u as hn}from"./rightPanelStore-BNvdVe0q.js";import{a as gn,i as _n,n as vn,o as yn,r as bn,t as xn}from"./fileLinks-COT45KrB.js";import{t as Sn}from"./toastHelpers-DxXYm50b.js";import{A as Cn,B as wn,D as Tn,F as En,I as Dn,L as On,M as kn,O as An,P as jn,R as Mn,a as Nn,j as Pn,k as Fn,l as In,z as Ln}from"./diffRendering-DwbgLJaq.js";import{a as Rn,c as zn,d as Bn,f as Vn,i as Hn,l as Un,n as Wn,o as Gn,r as Kn,s as qn,t as Jn,u as Yn}from"./mediaReference-BGHvhhnE.js";import{n as Xn,r as Zn,t as Qn}from"./mediaSource-CeGNee1z.js";import{o as $n}from"./timestampFormat-Dq7sHZpd.js";import{t as er}from"./env-BfPir1X4.js";import{a as tr,n as nr,t as rr}from"./tooltip-CZBiwhnV.js";import{i as ir,o as ar}from"./pierre-icons-cxD685IX.js";import{n as or,t as sr}from"./scroll-area-Ct6TrgZr.js";import{c as cr,s as lr,t as ur}from"./dialog-DvBVJIw1.js";import{a as dr,i as fr,n as pr,o as mr,t as hr}from"./popover-DYDa4qjy.js";import{t as gr}from"./observeResize-CNiPL-bo.js";import{s as _r,t as vr,u as yr}from"./assets-C96oF_eX.js";import{i as br,n as xr,t as Sr}from"./assetUrls-BMHkXryh.js";import{n as Cr,x as wr}from"./browserHistoryStore-DcyxHvEZ.js";import{a as Tr,i as Er,n as Dr,r as Or,t as kr}from"./openFileInPreview-CgNdFzHq.js";import{p as Ar}from"./Icons-CzUirT4o.js";import{t as jr}from"./preview-BypB2j7r.js";import{o as Mr,t as Nr}from"./PierreEntryIcon-C3yCp-3j.js";import{$ as Pr,F as Fr,G as Ir,H as Lr,I as Rr,J as zr,K as Br,O as Vr,Q as Hr,U as Ur,V as Wr,W as Gr,X as Kr,Y as qr,Z as Jr,a as Yr,et as Xr,ft as Zr,i as Qr,j as $r,k as ei,lt as ti,nt as ni,ot as ri,pt as ii,q as ai,r as oi,rt as si,t as ci,tt as li,ut as ui,w as di,z as fi}from"./RenderErrorBoundary-Ds0CLe6f.js";import{i as pi}from"./browserLinkTarget-5NDfBwMZ.js";import{t as mi}from"./pullRequestIcons-CJzQ9q45.js";import{r as hi}from"./pullRequests-Dx8h1wyx.js";import{t as gi}from"./ProjectFavicon-DJihy670.js";import{o as _i,r as vi}from"./terminal-links-ztYtKVge.js";import{Ho as yi,Lo as bi,Mo as xi,No as Si,Po as Ci,Uo as wi,Vo as Ti}from"./main-CNs583QD.js";function Ei(e,t,n,r){return{left:e,top:t,right:n,bottom:r,x:e,y:t,width:n-e,height:r-t}}function Di(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}function Oi(e){let t=[],n,r=1/0,i=1/0,a=-1/0,o=-1/0;for(let s of Array.from(e).sort((e,t)=>e.top-t.top)){if(r=Math.min(r,s.left),i=Math.min(i,s.top),a=Math.max(a,s.right),o=Math.max(o,s.bottom),!n||s.top-n.top>n.height/2)t.push(Di(s));else{let e=t[t.length-1];e.left=Math.min(e.left,s.left),e.right=Math.max(e.right,s.right),e.bottom=Math.max(e.bottom,s.bottom),e.width=e.right-e.left,e.height=e.bottom-e.top}n=s}return{lines:t,fallback:Ei(r,i,a,o)}}function ki(e,t,n){return e.findIndex(e=>t>e.left-2&&t<e.right+2&&n>e.top-2&&n<e.bottom+2)}function Ai(e){return Ei(e.left,e.top,e.right,e.bottom)}function ji(e,t,n){let{lines:r}=Oi(e.getClientRects());if(r.length<2)return;let i=ki(r,t,n);return{x:t,y:n,lineIndex:i===-1?void 0:i,element:e}}function Mi(e,t,n){let{lines:r,fallback:i}=Oi(e.getClientRects());if(r.length<2)return null;let a=n?.x,o=n?.y,s=t[0];if(n?.lineIndex!=null&&r[n.lineIndex])return Ai(r[n.lineIndex]);if(a!=null&&o!=null){let e=ki(r,a,o);if(e!==-1)return Ai(r[e])}if(r.length===2&&r[0].left>r[1].right&&a!=null&&o!=null)return i;if(s===`t`||s===`b`){let e=r[0],t=r[r.length-1],n=s===`t`?e:t;return Ei(n.left,e.top,n.right,t.bottom)}let c=s===`l`,l=r[0].left,u=r[0].right,d=c?1/0:-1/0,f=r[0],p=r[0];for(let e of r){l=Math.min(l,e.left),u=Math.max(u,e.right);let t=c?e.left:e.right;c&&t<d||!c&&t>d?(d=t,f=e,p=e):t===d&&(p=e)}return Ei(l,f.top,u,p.bottom)}function Ni(e){return`contextElement`in e&&e.contextElement?e.contextElement:Pe(e)?e:void 0}function Pi(e,t){function n(t){Fi(e,t.currentTarget,t.clientX,t.clientY)}function r(e){t||n(e)}return{onFocus(){e.current=void 0},onMouseEnter:n,onMouseMove:r}}function Fi(e,t,n,r){let i=ji(t,n,r);return e.current=i,i}function Ii(e){return{name:`inline`,async fn(t){let n=t.elements.reference;if(typeof n?.getClientRects!=`function`)return{};let r=Ni(n),i=e.current,a=i?.element===n||i?.element===r?i:void 0,o=Mi(n,t.placement,a);if(!o||typeof t.platform.getElementRects!=`function`)return{};let s=await t.platform.getElementRects({reference:{contextElement:r,getBoundingClientRect(){return o}},floating:t.elements.floating,strategy:t.strategy});return t.rects.reference.x===s.reference.x&&t.rects.reference.y===s.reference.y&&t.rects.reference.width===s.reference.width&&t.rects.reference.height===s.reference.height?{}:{reset:{rects:s}}}}}var V=e(n(),1),H=i(),U=e(a(),1),Li=e(p());function Ri(e){let t=e.toLowerCase();return t.includes(`mac`)?`Reveal in Finder`:t.includes(`win`)?`Reveal in File Explorer`:`Reveal in Files`}function zi(e){return e===`darwin`?`Reveal in Finder`:e===`windows`?`Reveal in File Explorer`:`Reveal in Files`}function Bi(e){return e===`finder`?`Reveal in Finder`:e===`file-explorer`?`Reveal in File Explorer`:`Reveal in Files`}var Vi={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Hi=class{maxEntries;maxMemoryBytes;cache=new Map;totalSize=0;constructor(e,t){this.maxEntries=e,this.maxMemoryBytes=t}get(e){let t=this.cache.get(e);return t?(this.promote(e,t),t.value):null}set(e,t,n){if(n>this.maxMemoryBytes)return;let r=this.cache.get(e);r&&(this.totalSize-=r.approximateSize,this.cache.delete(e)),this.evictIfNeeded(n),this.cache.set(e,{value:t,approximateSize:n}),this.totalSize+=n}clear(){this.cache.clear(),this.totalSize=0}promote(e,t){this.cache.delete(e),this.cache.set(e,t)}evictIfNeeded(e){for(;(this.cache.size>=this.maxEntries||this.totalSize+e>this.maxMemoryBytes)&&this.cache.size>0;){let e=this.cache.keys().next().value;if(e===void 0)break;let t=this.cache.get(e);t&&(this.totalSize-=t.approximateSize),this.cache.delete(e)}}},Ui=new Map(at.map(e=>[e.id,e.label]));function Wi(e,t){return e===`file-manager`?Ee(t):Ui.get(e)??`Editor`}function Gi(e){return e===null||e===`file-manager`?`Open in editor`:`Open in ${Ui.get(e)??`Editor`}`}var Ki={mode:`local-exec`},qi={mode:`remote-unavailable`},Ji={state:Ki,isResolved:!1};function Yi(e){try{return new URL(e).hostname}catch{return null}}function Xi(e){let{target:t}=e;if(t===null)return Ki;if(t._tag===`PrimaryConnectionTarget`){if(e.isDesktopRenderer)return Ki;let n=Yi(t.httpBaseUrl);if(n!==null&&At(n))return Ki}else if(xt(t))return Ki;if(e.sshAlias!==null&&e.sshAlias.length>0)return{mode:`remote-links`,host:{kind:`ssh-alias`,host:e.sshAlias}};let n=e.remoteOpenTargets?.[0];return n===void 0?qi:{mode:`remote-links`,host:n}}function Zi(e){let t=(0,H.c)(6),{presentation:n}=rn(e),r;bb0:{if(n===null){r=Ji;break bb0}let e;if(t[0]!==n.entry.profile||t[1]!==n.entry.target||t[2]!==n.serverConfig?.remoteOpenTargets){let r=ht(n.entry.profile),i=r!==null&&r._tag===`SshConnectionProfile`?r.target.alias:null;e=Xi({target:n.entry.target,sshAlias:i,remoteOpenTargets:n.serverConfig?.remoteOpenTargets,isDesktopRenderer:window.desktopBridge!==void 0}),t[0]=n.entry.profile,t[1]=n.entry.target,t[2]=n.serverConfig?.remoteOpenTargets,t[3]=e}else e=t[3];let i;t[4]===e?i=t[5]:(i={state:e,isResolved:!0},t[4]=e,t[5]=i),r=i}return r}function Qi(e){return Zi(e).state}var $i=[`vscode`],ea=null;function ta(){let e=(0,H.c)(2),[t,n]=(0,V.useState)(ia),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(ea!==null)return;let e=window.desktopBridge?.probeRemoteEditors;if(e===void 0){ea=$i;return}let t=!1;return e().then(e=>{let r=e.filter(ra);ea=r.length>0?r:$i,t||n(ea)},na),()=>{t=!0}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,V.useEffect)(r,i),t}function na(){ea=$i}function ra(e){return dt.includes(e)}function ia(){return ea??$i}async function aa(e){let t=window.desktopBridge;if(t!==void 0)try{return await t.openExternal(e)}catch{return!1}return window.location.assign(e),!0}var oa=`p4code:remote-open-hint-seen`;function sa(){let e=(0,H.c)(5),[t,n]=j(oa,!1,nt),r;e[0]===n?r=e[1]:(r=()=>n(!0),e[0]=n,e[1]=r);let i;return e[2]!==t||e[3]!==r?(i=[t,r],e[2]=t,e[3]=r,e[4]=i):i=e[4],i}function ca(e){if(e.autoplay||!e.paused||e.seeking||e.currentTime!==0||e.played.length>0||!Number.isFinite(e.duration)||e.duration<=0)return;let t=e.src.split(`#`,2)[1];if(!(t&&new URLSearchParams(t).has(`t`)))try{e.currentTime=Math.min(.1,e.duration/2)}catch{}}var la={"open-in-preview":`open-link-in-preview`,"open-external":`open-link-external`,"copy-link":`copy-link`,"link-to-thread":`link-pull-request-to-thread`,"unlink-from-thread":`unlink-pull-request-from-thread`},ua=[{id:`open-in-preview`,label:`Open in integrated browser`},{id:`open-external`,label:`Open in system browser`},{id:`copy-link`,label:`Copy Link`}];function da(e){let t=e.canOpenInPreview?ua:ua.filter(e=>e.id!==`open-in-preview`);return e.threadLinkAction===void 0?t:[{id:e.threadLinkAction,label:e.threadLinkAction===`link-to-thread`?`Link to thread`:`Unlink from thread`},...t]}function fa(e){if(!e)return null;try{let t=new URL(e.startsWith(`//`)?`https:${e}`:e);return t.protocol!==`http:`&&t.protocol!==`https:`?null:t}catch{return null}}function pa(e){return fa(e)?.href??null}function ma(e){return fa(e)?.hostname||null}async function ha({href:e,position:t,canOpenInPreview:n=!0,threadLinkAction:r,showContextMenu:i,openInPreview:a,openExternal:o,copyLink:s,updateThreadLink:c,reportFailure:l}){let u;try{u=await i(da({canOpenInPreview:n,threadLinkAction:r}),t)}catch(e){l(`show-link-context-menu`,e);return}try{u===`open-in-preview`?await a(e):u===`open-external`?await o(e):u===`copy-link`?await s(e):(u===`link-to-thread`||u===`unlink-from-thread`)&&await c?.(e,u===`link-to-thread`)}catch(e){u&&l(la[u],e)}}function ga(e){return e.startsWith(`//`)?`${typeof window<`u`&&window.location.protocol===`http:`?`http:`:`https:`}${e}`:e}function _a(e){let t=new TextEncoder;return Uint8Array.from(e.split(/(%[0-9a-f]{2})/i).flatMap(e=>/^%[0-9a-f]{2}$/i.test(e)?[Number.parseInt(e.slice(1),16)]:[...t.encode(e)]))}function va(e){let t=e.split(`#`,1)[0]??e,n=t.indexOf(`,`),[r=``,...i]=t.slice(5,n).split(`;`),a=t.slice(n+1);try{if(n<0)throw Error(`Missing data URL payload.`);let e=i.some(e=>e.trim().toLowerCase()===`base64`)?Uint8Array.from(atob(decodeURIComponent(a)),e=>e.charCodeAt(0)):_a(a);return new Blob([e],{type:r||`text/plain`})}catch(e){throw Error(`This inline media could not be decoded.`,{cause:e})}}async function ya(e){let t=await fetch(e).catch(()=>null);if(t?.ok)return t.blob();let n=typeof window>`u`?void 0:window.desktopBridge,r=n?.readMedia&&/^https?:/i.test(e)?await n.readMedia(e).catch(()=>null):null;if(r&&r.status>=200&&r.status<300)return new Blob([new Uint8Array(r.data)],{type:r.mimeType});let i=r?.status??t?.status;throw Error(i===void 0?n?.readMedia?`The file could not be fetched. Check the connection and try again.`:`The file could not be fetched. The host may block browser access (CORS), or the connection may be unavailable.`:`The file could not be fetched (HTTP ${i}).`)}async function ba(e){if(/^data:/i.test(e))return va(e);let t=await ya(e);if(t.type.split(`;`,1)[0]===`text/html`)throw Error(`This link returned a web page instead of media. Open the original URL.`);return t}async function xa(e,t){let n=URL.createObjectURL(await ba(e));try{let e=document.createElement(`a`);e.href=n,e.download=t,e.click()}finally{setTimeout(()=>URL.revokeObjectURL(n),3e4)}}async function Sa(e){let t=await ba(e);if(t.type.split(`;`,1)[0]===`image/png`)return t;let n=URL.createObjectURL(t),r=new Image;r.src=n;try{try{await r.decode()}catch(e){throw Error(`The browser could not decode this image for copying. Try saving it instead.`,{cause:e})}let{naturalWidth:e,naturalHeight:t}=r;if(e<=0||t<=0||e*t>64e6)throw Error(`This image is too large or has no usable dimensions. Try saving it instead.`);let n=document.createElement(`canvas`);n.width=e,n.height=t;let i=n.getContext(`2d`);if(!i)throw Error(`Image copying is unavailable in this browser.`);return i.drawImage(r,0,0),await new Promise((e,t)=>{n.toBlob(n=>n?e(n):t(Error(`The image could not be converted to PNG.`)),`image/png`)})}finally{URL.revokeObjectURL(n)}}function Ca(e){let t=ma(e.originalUrl)===null?void 0:e.originalUrl,n=t??e.src;if(!n)return null;let r=ga(n),i=!1;try{let e=new URL(r).protocol;if(e!==`http:`&&e!==`https:`&&e!==`blob:`)return null;i=e===`blob:`}catch{return null}return(0,U.jsxs)(we,{size:`sm`,variant:`secondary`,className:e.className,render:(0,U.jsx)(`a`,{href:r,target:i?void 0:`_blank`,download:i?e.fileName||!0:void 0,rel:`noopener noreferrer`}),children:[i?(0,U.jsx)(ge,{}):(0,U.jsx)(Me,{}),t?`Open original`:i?`Download video`:`Open in browser`]})}function wa(e){return e.reference&&Wn(e.reference)||e.name||e.kind}function Ta(e){return e===null||mt(e,`filesystem:read`)}function Ea(e){if(e===null)return!0;let t=ie.get(fn.sessionStateAtom(e));return t._tag!==`Failure`&&Ta(ht(qe(t)))}function Da(e){let t=(0,H.c)(24),n=e.asset&&(e.asset.resource._tag===`workspace-file`||e.asset.resource._tag===`media-file`)?e.asset.environmentId:null,r;t[0]===n?r=t[1]:(r=n===null?null:fn.sessionStateAtom(n),t[0]=n,t[1]=r);let i=pn(r),a;t[2]!==i||t[3]!==n?(a=n===null||i.error===null&&i.data!==null&&Ta(i.data),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o=a,s;t[5]===n?s=t[6]:(s=()=>{if(!Ea(n))throw Error(`This connection cannot read host files.`)},t[5]=n,t[6]=s);let c=s,l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1,refresh:!0},t[7]=l):l=t[7];let u=br(vr.createUrl,l),d;t[8]!==c||t[9]!==u||t[10]!==e.asset||t[11]!==e.src?(d=async()=>{if(c(),!e.asset){if(!e.src)throw Error(`This media is unavailable. Try reopening the preview.`);return e.src}let{environmentId:t,resource:n}=e.asset,r=un(t);if(!r)throw Error(`Reconnect to this environment and try again.`);let i=await u({environmentId:t,input:{resource:n}});if(i._tag===`Failure`)throw _t(i);c();let a=yr(r.httpBaseUrl,i.value.relativeUrl);if(!a)throw Error(`The environment returned an invalid media URL.`);return a},t[8]=c,t[9]=u,t[10]=e.asset,t[11]=e.src,t[12]=d):d=t[12];let f=d,p;t[13]!==f||t[14]!==e?(p=async()=>{await xa(await f(),wa(e))},t[13]=f,t[14]=e,t[15]=p):p=t[15];let m=p,h;t[16]!==f||t[17]!==c?(h=async()=>{if(c(),!navigator.clipboard?.write||typeof ClipboardItem>`u`)throw Error(`Image copying is unavailable. Use a secure browser connection or save the image.`);await navigator.clipboard.write([new ClipboardItem({"image/png":f().then(Sa)})])},t[16]=f,t[17]=c,t[18]=h):h=t[18];let g=h,_;return t[19]!==c||t[20]!==o||t[21]!==g||t[22]!==m?(_={save:m,copyImage:g,canReadMedia:o,assertCanReadMedia:c},t[19]=c,t[20]=o,t[21]=g,t[22]=m,t[23]=_):_=t[23],_}function Oa({source:e,children:t,showTooltip:n=!0}){let{save:r,copyImage:i,canReadMedia:a,assertCanReadMedia:o}=Da(e),[s,c]=(0,V.useState)(!1),l=(0,V.useRef)(!1),u=e.reference,d=u?.kind===`file`?u.path:u?.url??e.name,f=async t=>{let n=en();if(!n||l.current)return;l.current=!0,c(!1);let s=`Could not open media menu`,d;try{let c=e.kind===`image`?`image`:`video`,l=!a||e.src===null&&e.asset===void 0,f=typeof navigator<`u`&&!!navigator.clipboard?.write&&typeof ClipboardItem<`u`,p=[];u?.kind===`file`?(p.push({id:`copy-full-path`,label:`Copy full path`}),u.relativePath&&p.push({id:`copy-relative-path`,label:`Copy relative path`})):u?.kind===`url`&&p.push({id:`copy-url`,label:`Copy URL`}),e.onOpenFile&&p.push({id:`open-file`,label:`Open in file viewer`,disabled:!a}),p.push({id:`save`,label:`Save ${c}`,disabled:l}),e.kind===`image`&&p.push({id:`copy-image`,label:`Copy image`,disabled:l||!f});let m=await n.contextMenu.show(p,t);if(!m)return;s=`Could not ${p.find(e=>e.id===m)?.label.toLowerCase()??`complete media action`}`;let h=m===`copy-full-path`&&u?.kind===`file`?u.path:m===`copy-relative-path`&&u?.kind===`file`?u.relativePath:m===`copy-url`&&u?.kind===`url`?u.url:void 0;h===void 0?m===`open-file`?(o(),e.onOpenFile?.()):(m===`save`||m===`copy-image`)&&(d=Qt.add({type:`loading`,title:m===`save`?`Preparing ${c} download…`:`Copying image…`}),await(m===`save`?r():i()),Qt.update(d,{type:`success`,title:m===`save`?`Download started`:`Image copied`})):(await $t(h,u?.kind===`file`?`file path`:`URL`),Qt.add({type:`success`,title:m===`copy-url`?`URL copied`:`Path copied`}))}catch(e){let t=Sn({type:`error`,title:s,description:e instanceof Error?e.message:`The media action failed.`});d?Qt.update(d,t):Qt.add(t)}finally{l.current=!1}};return(0,U.jsxs)(rr,{disabled:!n,open:s,onOpenChange:c,children:[(0,U.jsx)(tr,{render:t,tabIndex:0,onContextMenu:e=>{if(e.defaultPrevented)return;e.preventDefault(),e.stopPropagation();let t=e.currentTarget.getBoundingClientRect();f(e.clientX===0&&e.clientY===0?{x:t.left,y:t.bottom}:{x:e.clientX,y:e.clientY})},onKeyDown:e=>{if(e.defaultPrevented||!(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`))return;e.preventDefault(),e.stopPropagation();let t=e.currentTarget.getBoundingClientRect();f({x:t.left,y:t.bottom})}}),(0,U.jsx)(nr,{variant:`code`,children:d})]})}function ka({src:e,label:t,sourceFailed:n=!1,originalUrl:r,revision:i=null,preload:a=`visible`,autoPlay:o=!1,onOpen:s,className:c,videoClassName:l,stateClassName:u,style:d,copyMarkdown:f,onRetry:p,actionsSource:m}){let h=(0,V.useRef)(null),[g,v]=(0,V.useState)(null),[y,x]=(0,V.useState)(null),[S,C]=(0,V.useState)(!1),[w,T]=(0,V.useState)(0),[E,D]=(0,V.useState)(null),O=g?.src??e,k=g===null?i:g.revision,A=O===null?n:y===O,j=(0,V.useCallback)(()=>{let e=h.current;(e===null||e.paused||e.ended)&&v(e=>e!==null&&e.revision!==i?null:e)},[i]);(0,V.useEffect)(j,[j]),(0,V.useEffect)(()=>{let e=h.current;if(!e||a===`metadata`||E===O)return;if(typeof IntersectionObserver>`u`){D(O);return}let t=!0,n=new IntersectionObserver(e=>{t&&e.some(e=>e.isIntersecting)&&(D(O),n.disconnect())},{rootMargin:`200px`});return n.observe(e),()=>{t=!1,n.disconnect()}},[O,a,E,A,w]),(0,V.useEffect)(()=>{let e=h.current;if(!e)return;let t=()=>{let t=document.fullscreenElement?.contains(e)||`webkitDisplayingFullscreen`in e&&e.webkitDisplayingFullscreen===!0;document.hidden&&!t&&e.pause()};return document.addEventListener(`visibilitychange`,t),document.addEventListener(`fullscreenchange`,t),e.addEventListener(`webkitendfullscreen`,t),()=>{document.removeEventListener(`visibilitychange`,t),document.removeEventListener(`fullscreenchange`,t),e.removeEventListener(`webkitendfullscreen`,t),e.pause()}},[O,A,w]);let M=async()=>{if(!S){C(!0);try{await p?.(),v(null),x(null),T(e=>e+1)}catch{x(O)}finally{C(!1)}}},N=(0,U.jsxs)(`span`,{className:B(`relative inline-block align-middle`,c),style:d,"data-markdown-copy":f,children:[A&&!s?(0,U.jsxs)(`span`,{role:`alert`,className:B(`flex aspect-video max-h-full min-h-28 w-full flex-col items-center justify-center gap-3 rounded-lg border border-border/40 bg-muted/40 p-4 text-center text-sm text-muted-foreground`,u),children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsx)(_,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),`Video unavailable`,t?` · ${t}`:``]}),(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[e!==null||p?(0,U.jsxs)(we,{size:`sm`,variant:`secondary`,disabled:S,onClick:()=>void M(),children:[(0,U.jsx)(Le,{}),S?`Retrying…`:`Retry video`]}):null,(0,U.jsx)(Ca,{originalUrl:r,src:e??O,fileName:t})]})]}):O!==null&&!A?(0,U.jsx)(`video`,{ref:h,src:O,"aria-label":t||`Video preview`,"aria-hidden":s?!0:void 0,autoPlay:!s&&o,controls:!s,muted:s?!0:void 0,playsInline:!0,preload:a===`metadata`||E===O?`metadata`:`none`,className:B(`aspect-video max-h-full w-full bg-black object-contain`,s&&`pointer-events-none`,l),style:d,onLoadedMetadata:e=>ca(e.currentTarget),onPlay:()=>v({src:O,revision:k}),onPause:j,onEnded:j,onError:()=>{e!==null&&O!==e?v(null):x(O)}},w):(0,U.jsx)(`span`,{role:`status`,"aria-label":A?`Video preview unavailable`:`Loading video`,className:B(`block aspect-video w-full rounded-lg bg-muted/60`,u),style:d}),s?(0,U.jsx)(`button`,{type:`button`,"aria-label":t?`Play ${t}`:`Play video`,onClick:s,className:`absolute inset-0 flex cursor-pointer items-center justify-center rounded-lg focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring`,children:(0,U.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full bg-black/50 text-white`,children:(0,U.jsx)(b,{"aria-hidden":!0,className:`size-4 fill-current`})})}):null]});return m?(0,U.jsx)(Oa,{source:m,children:N}):N}var Aa=(0,V.createContext)(!1);function ja(e){let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>{if(t)return t.addEventListener(`beforematch`,e),()=>t.removeEventListener(`beforematch`,e)},t[0]=e,t[1]=n),n}function Ma(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&zr(e.charCodeAt(n+1))&&zr(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Na(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Pa(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MathTypeset-TM-3r0WA.js","assets/react-BUfh6y28.js","assets/jsx-runtime-DJeoFXNw.js","assets/katex-B940_AAO.js","assets/MathTypeset-C02HYdjx.css","assets/lazy-C1dqAep6.js","assets/index-C04a0SKq.js"])))=>i.map(i=>d[i]);
2
+ import{a as e,n as t,t as n}from"./react-BUfh6y28.js";import{t as r}from"./index-C04a0SKq.js";import{n as i,t as a}from"./jsx-runtime-DJeoFXNw.js";import{$d as o,$u as s,Ai as c,Al as l,At as u,Bi as d,Co as f,Ea as p,Ei as m,Ff as h,Fi as g,Hf as _,Hr as v,Ir as y,Jd as b,Ji as x,Jo as S,Js as C,Ju as w,Ku as T,Lr as E,Mt as D,Na as O,Ni as k,Nr as A,Os as j,Ri as M,Sf as N,Si as P,Ti as F,To as ee,Ua as te,Ud as ne,Wa as re,Wo as ie,Ys as I,Zl as L,Zn as ae,_i as oe,_u as se,bd as ce,bi as le,dd as ue,fi as de,fr as fe,gi as pe,go as R,gs as me,hi as z,hu as he,iu as ge,ja as _e,jd as ve,jl as ye,ki as be,kr as xe,li as Se,mi as Ce,mr as we,mu as Te,n as Ee,nf as De,no as Oe,np as ke,oi as Ae,op as je,ou as Me,pl as Ne,qa as Pe,rp as Fe,rr as Ie,sf as Le,sl as Re,t as B,tr as ze,ui as Be,un as Ve,vd as He,vi as Ue,wa as We,wc as Ge,wi as Ke,ws as qe,xd as Je,xi as Ye,xo as Xe,xt as Ze,yi as Qe,zi as $e,zl as et,zu as tt}from"./utils-DFNDxNZi.js";import{Ec as nt,K as rt,Sc as it,W as at,Y as ot,aa as st,gn as ct,hc as lt,hl as ut,q as dt,ra as ft,rn as pt,va as mt,vg as ht,xm as gt}from"./src-BVovWpja.js";import{Ar as _t,Tr as vt,Xn as yt,Zn as bt,_ as xt,er as St,h as Ct,mr as wt,or as Tt,p as Et,pr as Dt,ri as Ot,rr as kt,rt as At}from"./runtime-DIAcbMTc.js";import{C as jt,D as Mt,G as Nt,O as Pt,S as Ft,Y as It,d as Lt}from"./entities-HOBDIiHK.js";import{f as Rt,h as zt,i as Bt,n as Vt,s as Ht,t as Ut}from"./useRender-BP5vR6yH.js";import{A as Wt,C as Gt,G as Kt,d as qt,f as Jt,u as Yt}from"./TooltipProvider-BH5ni_Lo.js";import{t as Xt}from"./link-D1nkgCv7.js";import{t as Zt}from"./useNavigate-DVrOlf8m.js";import{a as Qt,h as $t}from"./relay-YiJpGyaO.js";import{J as en,K as tn,Y as nn,at as rn,r as an,s as on}from"./useSettings-BWMcQzC-.js";import{f as sn}from"./server-BNjk2K1j.js";import{i as cn,n as ln,r as un,s as dn,t as fn}from"./session-DMNo4Bh3.js";import{n as pn}from"./query-Bw8YoCbO.js";import{t as mn}from"./use-atom-command-C4Tyb1VL.js";import{u as hn}from"./rightPanelStore-BF1zmmXM.js";import{a as gn,i as _n,n as vn,o as yn,r as bn,t as xn}from"./fileLinks-BlT4My6t.js";import{t as Sn}from"./toastHelpers-DxXYm50b.js";import{A as Cn,B as wn,D as Tn,F as En,I as Dn,L as On,M as kn,O as An,P as jn,R as Mn,a as Nn,j as Pn,k as Fn,l as In,z as Ln}from"./diffRendering-cyTQV5bk.js";import{a as Rn,c as zn,d as Bn,f as Vn,i as Hn,l as Un,n as Wn,o as Gn,r as Kn,s as qn,t as Jn,u as Yn}from"./mediaReference-D19Dzoh3.js";import{n as Xn,r as Zn,t as Qn}from"./mediaSource-DfsR3T70.js";import{o as $n}from"./timestampFormat-Dq7sHZpd.js";import{t as er}from"./env-BfPir1X4.js";import{a as tr,n as nr,t as rr}from"./tooltip-CGvxq8k3.js";import{i as ir,o as ar}from"./pierre-icons-fv1goMS6.js";import{n as or,t as sr}from"./scroll-area-CokPD3-i.js";import{c as cr,s as lr,t as ur}from"./dialog-CrLVN_m6.js";import{a as dr,i as fr,n as pr,o as mr,t as hr}from"./popover-DxCAIK62.js";import{t as gr}from"./observeResize-DLmefMqO.js";import{s as _r,t as vr,u as yr}from"./assets-C3_UZib9.js";import{i as br,n as xr,t as Sr}from"./assetUrls-Dq0gsqWs.js";import{n as Cr,x as wr}from"./browserHistoryStore-CVCo7qfb.js";import{a as Tr,i as Er,n as Dr,r as Or,t as kr}from"./openFileInPreview-BCGQQ_Ia.js";import{p as Ar}from"./Icons-BUrn1Fzo.js";import{t as jr}from"./preview-Ce5ECOHv.js";import{o as Mr,t as Nr}from"./PierreEntryIcon-D29_Ylm_.js";import{$ as Pr,F as Fr,G as Ir,H as Lr,I as Rr,J as zr,K as Br,O as Vr,Q as Hr,U as Ur,V as Wr,W as Gr,X as Kr,Y as qr,Z as Jr,a as Yr,et as Xr,ft as Zr,i as Qr,j as $r,k as ei,lt as ti,nt as ni,ot as ri,pt as ii,q as ai,r as oi,rt as si,t as ci,tt as li,ut as ui,w as di,z as fi}from"./RenderErrorBoundary-56lc2IQ3.js";import{i as pi}from"./browserLinkTarget-CopcRHna.js";import{t as mi}from"./pullRequestIcons-D8rnFTkk.js";import{r as hi}from"./pullRequests-euX1Ch2G.js";import{t as gi}from"./ProjectFavicon-DFI1NI3D.js";import{o as _i,r as vi}from"./terminal-links-BTdovUFa.js";import{Do as yi,Eo as bi,Fo as xi,Io as Si,Lo as Ci,Oo as wi,jo as Ti}from"./main-BFdCLmkY.js";function Ei(e,t,n,r){return{left:e,top:t,right:n,bottom:r,x:e,y:t,width:n-e,height:r-t}}function Di(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}function Oi(e){let t=[],n,r=1/0,i=1/0,a=-1/0,o=-1/0;for(let s of Array.from(e).sort((e,t)=>e.top-t.top)){if(r=Math.min(r,s.left),i=Math.min(i,s.top),a=Math.max(a,s.right),o=Math.max(o,s.bottom),!n||s.top-n.top>n.height/2)t.push(Di(s));else{let e=t[t.length-1];e.left=Math.min(e.left,s.left),e.right=Math.max(e.right,s.right),e.bottom=Math.max(e.bottom,s.bottom),e.width=e.right-e.left,e.height=e.bottom-e.top}n=s}return{lines:t,fallback:Ei(r,i,a,o)}}function ki(e,t,n){return e.findIndex(e=>t>e.left-2&&t<e.right+2&&n>e.top-2&&n<e.bottom+2)}function Ai(e){return Ei(e.left,e.top,e.right,e.bottom)}function ji(e,t,n){let{lines:r}=Oi(e.getClientRects());if(r.length<2)return;let i=ki(r,t,n);return{x:t,y:n,lineIndex:i===-1?void 0:i,element:e}}function Mi(e,t,n){let{lines:r,fallback:i}=Oi(e.getClientRects());if(r.length<2)return null;let a=n?.x,o=n?.y,s=t[0];if(n?.lineIndex!=null&&r[n.lineIndex])return Ai(r[n.lineIndex]);if(a!=null&&o!=null){let e=ki(r,a,o);if(e!==-1)return Ai(r[e])}if(r.length===2&&r[0].left>r[1].right&&a!=null&&o!=null)return i;if(s===`t`||s===`b`){let e=r[0],t=r[r.length-1],n=s===`t`?e:t;return Ei(n.left,e.top,n.right,t.bottom)}let c=s===`l`,l=r[0].left,u=r[0].right,d=c?1/0:-1/0,f=r[0],p=r[0];for(let e of r){l=Math.min(l,e.left),u=Math.max(u,e.right);let t=c?e.left:e.right;c&&t<d||!c&&t>d?(d=t,f=e,p=e):t===d&&(p=e)}return Ei(l,f.top,u,p.bottom)}function Ni(e){return`contextElement`in e&&e.contextElement?e.contextElement:Pe(e)?e:void 0}function Pi(e,t){function n(t){Fi(e,t.currentTarget,t.clientX,t.clientY)}function r(e){t||n(e)}return{onFocus(){e.current=void 0},onMouseEnter:n,onMouseMove:r}}function Fi(e,t,n,r){let i=ji(t,n,r);return e.current=i,i}function Ii(e){return{name:`inline`,async fn(t){let n=t.elements.reference;if(typeof n?.getClientRects!=`function`)return{};let r=Ni(n),i=e.current,a=i?.element===n||i?.element===r?i:void 0,o=Mi(n,t.placement,a);if(!o||typeof t.platform.getElementRects!=`function`)return{};let s=await t.platform.getElementRects({reference:{contextElement:r,getBoundingClientRect(){return o}},floating:t.elements.floating,strategy:t.strategy});return t.rects.reference.x===s.reference.x&&t.rects.reference.y===s.reference.y&&t.rects.reference.width===s.reference.width&&t.rects.reference.height===s.reference.height?{}:{reset:{rects:s}}}}}var V=e(n(),1),H=i(),U=e(a(),1),Li=e(p());function Ri(e){let t=e.toLowerCase();return t.includes(`mac`)?`Reveal in Finder`:t.includes(`win`)?`Reveal in File Explorer`:`Reveal in Files`}function zi(e){return e===`darwin`?`Reveal in Finder`:e===`windows`?`Reveal in File Explorer`:`Reveal in Files`}function Bi(e){return e===`finder`?`Reveal in Finder`:e===`file-explorer`?`Reveal in File Explorer`:`Reveal in Files`}var Vi={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Hi=class{maxEntries;maxMemoryBytes;cache=new Map;totalSize=0;constructor(e,t){this.maxEntries=e,this.maxMemoryBytes=t}get(e){let t=this.cache.get(e);return t?(this.promote(e,t),t.value):null}set(e,t,n){if(n>this.maxMemoryBytes)return;let r=this.cache.get(e);r&&(this.totalSize-=r.approximateSize,this.cache.delete(e)),this.evictIfNeeded(n),this.cache.set(e,{value:t,approximateSize:n}),this.totalSize+=n}clear(){this.cache.clear(),this.totalSize=0}promote(e,t){this.cache.delete(e),this.cache.set(e,t)}evictIfNeeded(e){for(;(this.cache.size>=this.maxEntries||this.totalSize+e>this.maxMemoryBytes)&&this.cache.size>0;){let e=this.cache.keys().next().value;if(e===void 0)break;let t=this.cache.get(e);t&&(this.totalSize-=t.approximateSize),this.cache.delete(e)}}},Ui=new Map(at.map(e=>[e.id,e.label]));function Wi(e,t){return e===`file-manager`?Ee(t):Ui.get(e)??`Editor`}function Gi(e){return e===null||e===`file-manager`?`Open in editor`:`Open in ${Ui.get(e)??`Editor`}`}var Ki={mode:`local-exec`},qi={mode:`remote-unavailable`},Ji={state:Ki,isResolved:!1};function Yi(e){try{return new URL(e).hostname}catch{return null}}function Xi(e){let{target:t}=e;if(t===null)return Ki;if(t._tag===`PrimaryConnectionTarget`){if(e.isDesktopRenderer)return Ki;let n=Yi(t.httpBaseUrl);if(n!==null&&At(n))return Ki}else if(xt(t))return Ki;if(e.sshAlias!==null&&e.sshAlias.length>0)return{mode:`remote-links`,host:{kind:`ssh-alias`,host:e.sshAlias}};let n=e.remoteOpenTargets?.[0];return n===void 0?qi:{mode:`remote-links`,host:n}}function Zi(e){let t=(0,H.c)(6),{presentation:n}=rn(e),r;bb0:{if(n===null){r=Ji;break bb0}let e;if(t[0]!==n.entry.profile||t[1]!==n.entry.target||t[2]!==n.serverConfig?.remoteOpenTargets){let r=ht(n.entry.profile),i=r!==null&&r._tag===`SshConnectionProfile`?r.target.alias:null;e=Xi({target:n.entry.target,sshAlias:i,remoteOpenTargets:n.serverConfig?.remoteOpenTargets,isDesktopRenderer:window.desktopBridge!==void 0}),t[0]=n.entry.profile,t[1]=n.entry.target,t[2]=n.serverConfig?.remoteOpenTargets,t[3]=e}else e=t[3];let i;t[4]===e?i=t[5]:(i={state:e,isResolved:!0},t[4]=e,t[5]=i),r=i}return r}function Qi(e){return Zi(e).state}var $i=[`vscode`],ea=null;function ta(){let e=(0,H.c)(2),[t,n]=(0,V.useState)(ia),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(ea!==null)return;let e=window.desktopBridge?.probeRemoteEditors;if(e===void 0){ea=$i;return}let t=!1;return e().then(e=>{let r=e.filter(ra);ea=r.length>0?r:$i,t||n(ea)},na),()=>{t=!0}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,V.useEffect)(r,i),t}function na(){ea=$i}function ra(e){return dt.includes(e)}function ia(){return ea??$i}async function aa(e){let t=window.desktopBridge;if(t!==void 0)try{return await t.openExternal(e)}catch{return!1}return window.location.assign(e),!0}var oa=`p4code:remote-open-hint-seen`;function sa(){let e=(0,H.c)(5),[t,n]=j(oa,!1,nt),r;e[0]===n?r=e[1]:(r=()=>n(!0),e[0]=n,e[1]=r);let i;return e[2]!==t||e[3]!==r?(i=[t,r],e[2]=t,e[3]=r,e[4]=i):i=e[4],i}function ca(e){if(e.autoplay||!e.paused||e.seeking||e.currentTime!==0||e.played.length>0||!Number.isFinite(e.duration)||e.duration<=0)return;let t=e.src.split(`#`,2)[1];if(!(t&&new URLSearchParams(t).has(`t`)))try{e.currentTime=Math.min(.1,e.duration/2)}catch{}}var la={"open-in-preview":`open-link-in-preview`,"open-external":`open-link-external`,"copy-link":`copy-link`,"link-to-thread":`link-pull-request-to-thread`,"unlink-from-thread":`unlink-pull-request-from-thread`},ua=[{id:`open-in-preview`,label:`Open in integrated browser`},{id:`open-external`,label:`Open in system browser`},{id:`copy-link`,label:`Copy Link`}];function da(e){let t=e.canOpenInPreview?ua:ua.filter(e=>e.id!==`open-in-preview`);return e.threadLinkAction===void 0?t:[{id:e.threadLinkAction,label:e.threadLinkAction===`link-to-thread`?`Link to thread`:`Unlink from thread`},...t]}function fa(e){if(!e)return null;try{let t=new URL(e.startsWith(`//`)?`https:${e}`:e);return t.protocol!==`http:`&&t.protocol!==`https:`?null:t}catch{return null}}function pa(e){return fa(e)?.href??null}function ma(e){return fa(e)?.hostname||null}async function ha({href:e,position:t,canOpenInPreview:n=!0,threadLinkAction:r,showContextMenu:i,openInPreview:a,openExternal:o,copyLink:s,updateThreadLink:c,reportFailure:l}){let u;try{u=await i(da({canOpenInPreview:n,threadLinkAction:r}),t)}catch(e){l(`show-link-context-menu`,e);return}try{u===`open-in-preview`?await a(e):u===`open-external`?await o(e):u===`copy-link`?await s(e):(u===`link-to-thread`||u===`unlink-from-thread`)&&await c?.(e,u===`link-to-thread`)}catch(e){u&&l(la[u],e)}}function ga(e){return e.startsWith(`//`)?`${typeof window<`u`&&window.location.protocol===`http:`?`http:`:`https:`}${e}`:e}function _a(e){let t=new TextEncoder;return Uint8Array.from(e.split(/(%[0-9a-f]{2})/i).flatMap(e=>/^%[0-9a-f]{2}$/i.test(e)?[Number.parseInt(e.slice(1),16)]:[...t.encode(e)]))}function va(e){let t=e.split(`#`,1)[0]??e,n=t.indexOf(`,`),[r=``,...i]=t.slice(5,n).split(`;`),a=t.slice(n+1);try{if(n<0)throw Error(`Missing data URL payload.`);let e=i.some(e=>e.trim().toLowerCase()===`base64`)?Uint8Array.from(atob(decodeURIComponent(a)),e=>e.charCodeAt(0)):_a(a);return new Blob([e],{type:r||`text/plain`})}catch(e){throw Error(`This inline media could not be decoded.`,{cause:e})}}async function ya(e){let t=await fetch(e).catch(()=>null);if(t?.ok)return t.blob();let n=typeof window>`u`?void 0:window.desktopBridge,r=n?.readMedia&&/^https?:/i.test(e)?await n.readMedia(e).catch(()=>null):null;if(r&&r.status>=200&&r.status<300)return new Blob([new Uint8Array(r.data)],{type:r.mimeType});let i=r?.status??t?.status;throw Error(i===void 0?n?.readMedia?`The file could not be fetched. Check the connection and try again.`:`The file could not be fetched. The host may block browser access (CORS), or the connection may be unavailable.`:`The file could not be fetched (HTTP ${i}).`)}async function ba(e){if(/^data:/i.test(e))return va(e);let t=await ya(e);if(t.type.split(`;`,1)[0]===`text/html`)throw Error(`This link returned a web page instead of media. Open the original URL.`);return t}async function xa(e,t){let n=URL.createObjectURL(await ba(e));try{let e=document.createElement(`a`);e.href=n,e.download=t,e.click()}finally{setTimeout(()=>URL.revokeObjectURL(n),3e4)}}async function Sa(e){let t=await ba(e);if(t.type.split(`;`,1)[0]===`image/png`)return t;let n=URL.createObjectURL(t),r=new Image;r.src=n;try{try{await r.decode()}catch(e){throw Error(`The browser could not decode this image for copying. Try saving it instead.`,{cause:e})}let{naturalWidth:e,naturalHeight:t}=r;if(e<=0||t<=0||e*t>64e6)throw Error(`This image is too large or has no usable dimensions. Try saving it instead.`);let n=document.createElement(`canvas`);n.width=e,n.height=t;let i=n.getContext(`2d`);if(!i)throw Error(`Image copying is unavailable in this browser.`);return i.drawImage(r,0,0),await new Promise((e,t)=>{n.toBlob(n=>n?e(n):t(Error(`The image could not be converted to PNG.`)),`image/png`)})}finally{URL.revokeObjectURL(n)}}function Ca(e){let t=ma(e.originalUrl)===null?void 0:e.originalUrl,n=t??e.src;if(!n)return null;let r=ga(n),i=!1;try{let e=new URL(r).protocol;if(e!==`http:`&&e!==`https:`&&e!==`blob:`)return null;i=e===`blob:`}catch{return null}return(0,U.jsxs)(we,{size:`sm`,variant:`secondary`,className:e.className,render:(0,U.jsx)(`a`,{href:r,target:i?void 0:`_blank`,download:i?e.fileName||!0:void 0,rel:`noopener noreferrer`}),children:[i?(0,U.jsx)(ge,{}):(0,U.jsx)(Me,{}),t?`Open original`:i?`Download video`:`Open in browser`]})}function wa(e){return e.reference&&Wn(e.reference)||e.name||e.kind}function Ta(e){return e===null||mt(e,`filesystem:read`)}function Ea(e){if(e===null)return!0;let t=ie.get(fn.sessionStateAtom(e));return t._tag!==`Failure`&&Ta(ht(qe(t)))}function Da(e){let t=(0,H.c)(24),n=e.asset&&(e.asset.resource._tag===`workspace-file`||e.asset.resource._tag===`media-file`)?e.asset.environmentId:null,r;t[0]===n?r=t[1]:(r=n===null?null:fn.sessionStateAtom(n),t[0]=n,t[1]=r);let i=pn(r),a;t[2]!==i||t[3]!==n?(a=n===null||i.error===null&&i.data!==null&&Ta(i.data),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o=a,s;t[5]===n?s=t[6]:(s=()=>{if(!Ea(n))throw Error(`This connection cannot read host files.`)},t[5]=n,t[6]=s);let c=s,l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1,refresh:!0},t[7]=l):l=t[7];let u=br(vr.createUrl,l),d;t[8]!==c||t[9]!==u||t[10]!==e.asset||t[11]!==e.src?(d=async()=>{if(c(),!e.asset){if(!e.src)throw Error(`This media is unavailable. Try reopening the preview.`);return e.src}let{environmentId:t,resource:n}=e.asset,r=un(t);if(!r)throw Error(`Reconnect to this environment and try again.`);let i=await u({environmentId:t,input:{resource:n}});if(i._tag===`Failure`)throw _t(i);c();let a=yr(r.httpBaseUrl,i.value.relativeUrl);if(!a)throw Error(`The environment returned an invalid media URL.`);return a},t[8]=c,t[9]=u,t[10]=e.asset,t[11]=e.src,t[12]=d):d=t[12];let f=d,p;t[13]!==f||t[14]!==e?(p=async()=>{await xa(await f(),wa(e))},t[13]=f,t[14]=e,t[15]=p):p=t[15];let m=p,h;t[16]!==f||t[17]!==c?(h=async()=>{if(c(),!navigator.clipboard?.write||typeof ClipboardItem>`u`)throw Error(`Image copying is unavailable. Use a secure browser connection or save the image.`);await navigator.clipboard.write([new ClipboardItem({"image/png":f().then(Sa)})])},t[16]=f,t[17]=c,t[18]=h):h=t[18];let g=h,_;return t[19]!==c||t[20]!==o||t[21]!==g||t[22]!==m?(_={save:m,copyImage:g,canReadMedia:o,assertCanReadMedia:c},t[19]=c,t[20]=o,t[21]=g,t[22]=m,t[23]=_):_=t[23],_}function Oa({source:e,children:t,showTooltip:n=!0}){let{save:r,copyImage:i,canReadMedia:a,assertCanReadMedia:o}=Da(e),[s,c]=(0,V.useState)(!1),l=(0,V.useRef)(!1),u=e.reference,d=u?.kind===`file`?u.path:u?.url??e.name,f=async t=>{let n=en();if(!n||l.current)return;l.current=!0,c(!1);let s=`Could not open media menu`,d;try{let c=e.kind===`image`?`image`:`video`,l=!a||e.src===null&&e.asset===void 0,f=typeof navigator<`u`&&!!navigator.clipboard?.write&&typeof ClipboardItem<`u`,p=[];u?.kind===`file`?(p.push({id:`copy-full-path`,label:`Copy full path`}),u.relativePath&&p.push({id:`copy-relative-path`,label:`Copy relative path`})):u?.kind===`url`&&p.push({id:`copy-url`,label:`Copy URL`}),e.onOpenFile&&p.push({id:`open-file`,label:`Open in file viewer`,disabled:!a}),p.push({id:`save`,label:`Save ${c}`,disabled:l}),e.kind===`image`&&p.push({id:`copy-image`,label:`Copy image`,disabled:l||!f});let m=await n.contextMenu.show(p,t);if(!m)return;s=`Could not ${p.find(e=>e.id===m)?.label.toLowerCase()??`complete media action`}`;let h=m===`copy-full-path`&&u?.kind===`file`?u.path:m===`copy-relative-path`&&u?.kind===`file`?u.relativePath:m===`copy-url`&&u?.kind===`url`?u.url:void 0;h===void 0?m===`open-file`?(o(),e.onOpenFile?.()):(m===`save`||m===`copy-image`)&&(d=Qt.add({type:`loading`,title:m===`save`?`Preparing ${c} download…`:`Copying image…`}),await(m===`save`?r():i()),Qt.update(d,{type:`success`,title:m===`save`?`Download started`:`Image copied`})):(await $t(h,u?.kind===`file`?`file path`:`URL`),Qt.add({type:`success`,title:m===`copy-url`?`URL copied`:`Path copied`}))}catch(e){let t=Sn({type:`error`,title:s,description:e instanceof Error?e.message:`The media action failed.`});d?Qt.update(d,t):Qt.add(t)}finally{l.current=!1}};return(0,U.jsxs)(rr,{disabled:!n,open:s,onOpenChange:c,children:[(0,U.jsx)(tr,{render:t,tabIndex:0,onContextMenu:e=>{if(e.defaultPrevented)return;e.preventDefault(),e.stopPropagation();let t=e.currentTarget.getBoundingClientRect();f(e.clientX===0&&e.clientY===0?{x:t.left,y:t.bottom}:{x:e.clientX,y:e.clientY})},onKeyDown:e=>{if(e.defaultPrevented||!(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`))return;e.preventDefault(),e.stopPropagation();let t=e.currentTarget.getBoundingClientRect();f({x:t.left,y:t.bottom})}}),(0,U.jsx)(nr,{variant:`code`,children:d})]})}function ka({src:e,label:t,sourceFailed:n=!1,originalUrl:r,revision:i=null,preload:a=`visible`,autoPlay:o=!1,onOpen:s,className:c,videoClassName:l,stateClassName:u,style:d,copyMarkdown:f,onRetry:p,actionsSource:m}){let h=(0,V.useRef)(null),[g,v]=(0,V.useState)(null),[y,x]=(0,V.useState)(null),[S,C]=(0,V.useState)(!1),[w,T]=(0,V.useState)(0),[E,D]=(0,V.useState)(null),O=g?.src??e,k=g===null?i:g.revision,A=O===null?n:y===O,j=(0,V.useCallback)(()=>{let e=h.current;(e===null||e.paused||e.ended)&&v(e=>e!==null&&e.revision!==i?null:e)},[i]);(0,V.useEffect)(j,[j]),(0,V.useEffect)(()=>{let e=h.current;if(!e||a===`metadata`||E===O)return;if(typeof IntersectionObserver>`u`){D(O);return}let t=!0,n=new IntersectionObserver(e=>{t&&e.some(e=>e.isIntersecting)&&(D(O),n.disconnect())},{rootMargin:`200px`});return n.observe(e),()=>{t=!1,n.disconnect()}},[O,a,E,A,w]),(0,V.useEffect)(()=>{let e=h.current;if(!e)return;let t=()=>{let t=document.fullscreenElement?.contains(e)||`webkitDisplayingFullscreen`in e&&e.webkitDisplayingFullscreen===!0;document.hidden&&!t&&e.pause()};return document.addEventListener(`visibilitychange`,t),document.addEventListener(`fullscreenchange`,t),e.addEventListener(`webkitendfullscreen`,t),()=>{document.removeEventListener(`visibilitychange`,t),document.removeEventListener(`fullscreenchange`,t),e.removeEventListener(`webkitendfullscreen`,t),e.pause()}},[O,A,w]);let M=async()=>{if(!S){C(!0);try{await p?.(),v(null),x(null),T(e=>e+1)}catch{x(O)}finally{C(!1)}}},N=(0,U.jsxs)(`span`,{className:B(`relative inline-block align-middle`,c),style:d,"data-markdown-copy":f,children:[A&&!s?(0,U.jsxs)(`span`,{role:`alert`,className:B(`flex aspect-video max-h-full min-h-28 w-full flex-col items-center justify-center gap-3 rounded-lg border border-border/40 bg-muted/40 p-4 text-center text-sm text-muted-foreground`,u),children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsx)(_,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),`Video unavailable`,t?` · ${t}`:``]}),(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[e!==null||p?(0,U.jsxs)(we,{size:`sm`,variant:`secondary`,disabled:S,onClick:()=>void M(),children:[(0,U.jsx)(Le,{}),S?`Retrying…`:`Retry video`]}):null,(0,U.jsx)(Ca,{originalUrl:r,src:e??O,fileName:t})]})]}):O!==null&&!A?(0,U.jsx)(`video`,{ref:h,src:O,"aria-label":t||`Video preview`,"aria-hidden":s?!0:void 0,autoPlay:!s&&o,controls:!s,muted:s?!0:void 0,playsInline:!0,preload:a===`metadata`||E===O?`metadata`:`none`,className:B(`aspect-video max-h-full w-full bg-black object-contain`,s&&`pointer-events-none`,l),style:d,onLoadedMetadata:e=>ca(e.currentTarget),onPlay:()=>v({src:O,revision:k}),onPause:j,onEnded:j,onError:()=>{e!==null&&O!==e?v(null):x(O)}},w):(0,U.jsx)(`span`,{role:`status`,"aria-label":A?`Video preview unavailable`:`Loading video`,className:B(`block aspect-video w-full rounded-lg bg-muted/60`,u),style:d}),s?(0,U.jsx)(`button`,{type:`button`,"aria-label":t?`Play ${t}`:`Play video`,onClick:s,className:`absolute inset-0 flex cursor-pointer items-center justify-center rounded-lg focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring`,children:(0,U.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full bg-black/50 text-white`,children:(0,U.jsx)(b,{"aria-hidden":!0,className:`size-4 fill-current`})})}):null]});return m?(0,U.jsx)(Oa,{source:m,children:N}):N}var Aa=(0,V.createContext)(!1);function ja(e){let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>{if(t)return t.addEventListener(`beforematch`,e),()=>t.removeEventListener(`beforematch`,e)},t[0]=e,t[1]=n),n}function Ma(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&zr(e.charCodeAt(n+1))&&zr(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Na(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Pa(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
3
3
  `}]}function Fa(e,t){let n=t.value?t.value+`
4
4
  `:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function Ia(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function La(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ra(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Ma(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function za(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ba(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Va(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function Ha(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Va(e,t);let i={src:Ma(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function Ua(e,t){let n={src:Ma(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Wa(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Ga(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Va(e,t);let i={href:Ma(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Ka(e,t){let n={href:Ma(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function qa(e,t,n){let r=e.all(t),i=n?Ja(n):Ya(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
5
5
  `}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
@@ -38,12 +38,12 @@ import{a as e,n as t,t as n}from"./react-BUfh6y28.js";import{t as r}from"./index
38
38
  `)}function Rg(e){let t=document.createElement(`pre`),n=document.createElement(`code`);return n.textContent=e.trim(),t.appendChild(n),t}function zg(e){let t=document.createElement(`code`);if(t.textContent=e.getAttribute(`data-markdown-copy`)?.trim()??``,e.getAttribute(`data-markdown-math`)!==`display`)return t;let n=document.createElement(`pre`);return n.append(t),n}function Bg(e){for(let t of e.querySelectorAll(`[data-markdown-mermaid]`)){let e=t.getAttribute(`data-markdown-copy`);e!==null&&t.replaceChildren(Rg(e))}for(let t of e.querySelectorAll(Ng))t.replaceWith(zg(t));for(let t of e.querySelectorAll(sg))t.classList.contains(`chat-markdown-file-link`)||t.closest(`.chat-markdown-file-link`)?(t.getAttribute(`aria-hidden`)===`true`||t.localName===`svg`)&&t.remove():t.remove();return`<meta charset="utf-8">${e.innerHTML}`}function Vg(e){let t=[],n=[];for(let r=0;r<e.rangeCount;r+=1){let i=e.getRangeAt(r);if(i.collapsed)continue;let a=document.createElement(`div`);a.appendChild(i.cloneContents());let o=i.commonAncestorContainer,s=o.nodeType===Node.ELEMENT_NODE?o:o.parentElement,c=s?.closest(`[data-markdown-mermaid]`)?.getAttribute(`data-markdown-copy`);if(c!=null){let e=c.trim();if(!e)continue;t.push(e),a.replaceChildren(Rg(c)),n.push(Bg(a));continue}let l=Pg(s);if(l){t.push(l.getAttribute(`data-markdown-copy`)?.trim()??``),n.push(`<meta charset="utf-8">${zg(l).outerHTML}`);continue}if(s?.closest(`pre`)){let e=i.toString();e&&(t.push(e),n.push(Bg(a)));continue}let u=jg(a);u&&(t.push(u),n.push(Bg(a)))}return t.length===0?null:{text:t.join(`
39
39
 
40
40
  `),html:n.join(``)}}function Hg(e,t){let n=[...e.querySelectorAll(`[data-assistant-citation-source]`)].find(e=>e.dataset.assistantCitationSource===t.messageId&&e.dataset.assistantCitationEnvironment===t.environmentId&&e.dataset.assistantCitationThread===t.threadId),r=n?.closest(`[data-assistant-citation-viewport]`);if(!n||!r)return null;let i=r_(n,t);return i?{source:n,range:i,viewport:r}:null}var Ug=`button, input, textarea, select, [role=button], [contenteditable], [hidden], [aria-hidden=true], script, style, template, noscript, svg`,Wg=`address, article, aside, blockquote, dd, div, dl, dt, figcaption, figure, footer, h1, h2, h3, h4, h5, h6, header, hr, li, main, nav, ol, p, pre, section, table, td, th, tr, ul`;function Gg(e){return e.replace(/\s+/g,` `)}function Kg(e,t){let n=e.charCodeAt(t-1),r=e.charCodeAt(t);return n>=55296&&n<=56319&&r>=56320&&r<=57343}function qg(e,t,n){let r=e.slice(t,n);if(r.trim().length===0)return null;let i=Gg(e),a=Gg(e.slice(0,t)).length;t>0&&/\s/.test(e[t-1])&&/\s/.test(e[t])&&--a;let o=Gg(e.slice(0,n)).length,s=Math.max(0,a-32),c=Math.min(i.length,o+32);return Kg(i,s)&&(s+=1),Kg(i,c)&&--c,{text:r,start:a,end:o,prefix:i.slice(s,a),suffix:i.slice(o,c)}}function Jg(e,t){let n=Gg(e),r=Gg(t.text);if(r.trim().length===0)return null;let i=Gg(t.prefix),a=Gg(t.suffix),o=(e,t)=>n.slice(Math.max(0,e-i.length),e)===i&&n.slice(t,t+a.length)===a,s=Number.isSafeInteger(t.start)&&Number.isSafeInteger(t.end)&&t.start>=0&&t.end-t.start===r.length&&n.slice(t.start,t.end)===r&&o(t.start,t.end)?{start:t.start,end:t.end}:null,c=null,l=0;for(let e=n.indexOf(r);e!==-1;e=n.indexOf(r,e+1)){let t=e+r.length;if(l+=1,c={start:e,end:t},o(e,t)){if(s!==null&&s.start!==e)return null;s={start:e,end:t}}}return s??(l===1?c:null)}var Yg=e=>e.nodeType===3;function Xg(e){let t=[],n=[],r=0,i=!1,a=(e,a)=>{i&&r>0&&(t.push(`
41
- `),r+=1),i=!1,n.push({node:e,start:r,end:r+a.length}),t.push(a),r+=a.length},o=e=>{if(e.nodeType===3){let t=e;t.length>0&&a(t,t.data);return}if(e.nodeType!==1)return;let t=e;if(t.matches(Ug))return;let n=t.matches(Wg);if((n||t.tagName===`BR`)&&(i=!0),t.matches(`[data-markdown-math]`))a(t,t.getAttribute(`data-markdown-copy`)?.trim()??``);else for(let e of t.childNodes)o(e);n&&(i=!0)};return o(e),{text:t.join(``),chunks:n}}function Zg(e){return(e.nodeType===1?e:e.parentElement)?.closest(Ug)??null}function Qg(e,t){return!(t.collapsed||!e.contains(t.startContainer)||!e.contains(t.endContainer)||Zg(t.startContainer)!==null||Zg(t.endContainer)!==null)}function $g(e){let t=Pg(e.parentElement)??e.parentElement,n=t?.ownerDocument?.defaultView;return!!t&&!!n&&n.getComputedStyle(t).userSelect===`none`}function e_(e,t,n){if(!e.intersectsNode(t))return null;if(t.nodeType===3){let n=t;return(t===e.startContainer?e.startOffset:0)<(t===e.endContainer?e.endOffset:n.length)&&!$g(n)?n:null}for(let r=n?t.lastChild:t.firstChild;r!==null;r=n?r.previousSibling:r.nextSibling){let t=e_(e,r,n);if(t!==null)return t}return null}function t_(e,t){if(t===null||t.isCollapsed||t.rangeCount!==1)return null;let n=t.getRangeAt(0).cloneRange(),r=e_(n,n.commonAncestorContainer,!1),i=e_(n,n.commonAncestorContainer,!0);if(r===null||i===null)return null;let a=r.parentElement?.closest(`[data-assistant-citation-source]`);if(!a||!e.contains(a))return null;let o=Pg(r.parentElement),s=Pg(i.parentElement);if(o?n.setStartBefore(o):n.setStart(r,r===n.startContainer?n.startOffset:0),s?n.setEndAfter(s):n.setEnd(i,i===n.endContainer?n.endOffset:i.length),!Qg(a,n))return null;let c=Xg(a),l=null,u=0;for(let e of c.chunks){if(!n.intersectsNode(e.node))continue;let t=n.startContainer===e.node?n.startOffset:0,r=n.endContainer===e.node?n.endOffset:e.end-e.start;t!==r&&(l??=e.start+t,u=e.start+r)}if(l===null)return null;let d=qg(c.text,l,u);return d===null?null:{source:a,selector:d,range:n}}function n_(e,t){let n=0;for(let r of e.matchAll(/\s+|\S+/g)){let e=/\s/.test(r[0][0]),i=e?1:r[0].length;if(t<=n+i)return r.index+(e&&t>n?r[0].length:t-n);n+=i}return e.length}function r_(e,t){if(Zg(e)!==null)return null;let n=Xg(e),r=Jg(n.text,t);if(r===null)return null;let i=n_(n.text,r.start),a=n_(n.text,r.end),o=n.chunks.find(e=>e.end>i),s=n.chunks.findLast(e=>e.start<a);if(o===void 0||s===void 0)return null;let c=e.ownerDocument.createRange();return Yg(o.node)?c.setStart(o.node,Math.max(0,i-o.start)):c.setStartBefore(o.node),Yg(s.node)?c.setEnd(s.node,Math.min(s.node.length,a-s.start)):c.setEndAfter(s.node),Qg(e,c)?c:null}var i_=zt(`inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] border px-[0.5em] align-middle font-medium text-[0.86em] leading-none [&_svg]:block [&_svg]:size-[1.17em] [&_svg]:shrink-0 [&_svg]:self-center [button&,a&,[data-popup-open]&]:cursor-pointer [button&,a&]:transition-colors [button&,a&]:motion-reduce:transition-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-foreground disabled:cursor-default`,{defaultVariants:{kind:`neutral`},variants:{kind:{neutral:`border-border/70 bg-accent/40 text-foreground`,image:`[--context-chip-accent:oklch(0.62_0.16_16)]`,video:`[--context-chip-accent:oklch(0.62_0.16_48)]`,file:`[--context-chip-accent:oklch(0.62_0.136_237)]`,mention:`[--context-chip-accent:oklch(0.62_0.11_215)]`,terminal:`[--context-chip-accent:oklch(0.62_0.134_163)]`,element:`[--context-chip-accent:oklch(0.62_0.134_70)]`,"preview-annotation":`[--context-chip-accent:oklch(0.62_0.134_70)]`,"review-comment":`[--context-chip-accent:oklch(0.62_0.16_292)]`,"pull-request":`[--context-chip-accent:oklch(0.62_0.16_277)]`,"pr-open":`[--context-chip-accent:oklch(0.62_0.134_163)]`,"pr-draft":`[--context-chip-accent:oklch(0.62_0.02_259)]`,"pr-merged":`[--context-chip-accent:oklch(0.62_0.16_292)]`,"pr-closed":`[--context-chip-accent:oklch(0.62_0.16_16)]`,skill:`[--context-chip-accent:oklch(0.62_0.16_322)]`,thread:`[--context-chip-accent:oklch(0.62_0.12_190)]`,environment:`[--context-chip-accent:oklch(0.62_0.11_145)]`,citation:`[--context-chip-accent:oklch(0.62_0.16_259)]`},state:{unresolved:`border-dashed`,invalid:``}},compoundVariants:[{kind:[`image`,`video`,`file`,`mention`,`terminal`,`element`,`preview-annotation`,`review-comment`,`pull-request`,`pr-open`,`pr-draft`,`pr-merged`,`pr-closed`,`skill`,`thread`,`citation`],className:`[--context-chip-border:color-mix(in_oklab,var(--context-chip-accent)_34%,var(--contrast-border))] [--context-chip-border-hover:color-mix(in_oklab,var(--context-chip-accent)_48%,var(--contrast-border))] [--context-chip-foreground:color-mix(in_oklab,var(--context-chip-accent)_22%,var(--contrast-foreground))] border-(--context-chip-border) bg-(--context-chip-accent)/11 text-(--context-chip-foreground) [button:enabled&,a&]:hover:border-(--context-chip-border-hover) [button:enabled&,a&]:hover:bg-(--context-chip-accent)/17`},{state:`unresolved`,className:`text-foreground`},{state:`invalid`,className:`border-destructive/35 bg-destructive/8 text-destructive`}]});function a_(e){let t=(0,H.c)(9),n,r,i,a;if(t[0]!==e){let{className:o,kind:s,state:c,render:l,...u}=e;n=l;let d={className:B(i_({kind:s,state:c}),o),"data-slot":`context-chip`,"data-state":c};a=Ut,r=`span`,i=Bt(d,u),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a}else n=t[1],r=t[2],i=t[3],a=t[4];let o;return t[5]!==n||t[6]!==r||t[7]!==i?(o={defaultTagName:r,props:i,render:n},t[5]=n,t[6]=r,t[7]=i,t[8]=o):o=t[8],a(o)}function o_(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=B(`block min-w-0 self-center truncate leading-tight`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,U.jsx)(`span`,{className:i,"data-slot":`context-chip-label`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function s_(e){let t=(0,H.c)(9),n,r,i,a;if(t[0]!==e){let{className:o,render:s,...c}=e;n=s;let l={className:B(`ml-[0.17em] inline-flex size-[1.17em] shrink-0 cursor-pointer items-center justify-center rounded-sm text-current transition-colors hover:bg-(--context-chip-accent,var(--color-foreground))/17 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring motion-reduce:transition-none [&_svg]:size-[0.85em]`,o),"data-slot":`context-chip-action`,type:n?void 0:`button`};a=Ut,r=`button`,i=Bt(l,c),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a}else n=t[1],r=t[2],i=t[3],a=t[4];let o;return t[5]!==n||t[6]!==r||t[7]!==i?(o={defaultTagName:r,props:i,render:n},t[5]=n,t[6]=r,t[7]=i,t[8]=o):o=t[8],a(o)}var c_=`<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>`;function l_(e,t=36){let n=Array.from(e);if(n.length<=t)return e;if(t<=0)return``;if(t===1)return`…`;let r=t-1,i=Math.min(r-1,r>=18?14:Math.ceil(r/2)),a=r-i,o=i===0?``:n.slice(-i).join(``);return`${n.slice(0,a).join(``)}…${o}`}function u_(e){let t=(0,H.c)(34),{metadata:n}=e,r,i,a,o,s;t[0]===n?(r=t[1],i=t[2],a=t[3],o=t[4],s=t[5]):(i=di(n),s=`max-w-80 space-y-1 overflow-hidden py-0.5 text-left`,o=`flex items-center gap-1.5 text-xs font-medium`,r=i.Icon,a=B(`size-3.5 shrink-0`,i.toneClassName),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s);let c;t[6]!==r||t[7]!==a?(c=(0,U.jsx)(r,{className:a}),t[6]=r,t[7]=a,t[8]=c):c=t[8];let l;t[9]===n.number?l=t[10]:(l=(0,U.jsxs)(`span`,{className:`text-foreground`,children:[`Pull request #`,n.number]}),t[9]=n.number,t[10]=l);let u;t[11]!==i.label||t[12]!==i.toneClassName?(u=(0,U.jsx)(`span`,{className:i.toneClassName,children:i.label}),t[11]=i.label,t[12]=i.toneClassName,t[13]=u):u=t[13];let d;t[14]!==o||t[15]!==c||t[16]!==l||t[17]!==u?(d=(0,U.jsxs)(`div`,{className:o,children:[c,l,u]}),t[14]=o,t[15]=c,t[16]=l,t[17]=u,t[18]=d):d=t[18];let f;t[19]===n.title?f=t[20]:(f=(0,U.jsx)(`div`,{className:`wrap-break-word text-foreground`,children:n.title}),t[19]=n.title,t[20]=f);let p;t[21]===n.headBranch?p=t[22]:(p=(0,U.jsx)(`code`,{className:`truncate`,children:n.headBranch}),t[21]=n.headBranch,t[22]=p);let m;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,U.jsx)(Re,{className:`size-3 shrink-0`,"aria-hidden":`true`}),t[23]=m):m=t[23];let h;t[24]===n.baseBranch?h=t[25]:(h=(0,U.jsx)(`code`,{className:`truncate`,children:n.baseBranch}),t[24]=n.baseBranch,t[25]=h);let g;t[26]!==h||t[27]!==p?(g=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 text-secondary-label text-3xs`,children:[p,m,h]}),t[26]=h,t[27]=p,t[28]=g):g=t[28];let _;return t[29]!==g||t[30]!==s||t[31]!==d||t[32]!==f?(_=(0,U.jsxs)(`div`,{className:s,children:[d,f,g]}),t[29]=g,t[30]=s,t[31]=d,t[32]=f,t[33]=_):_=t[33],_}var d_=V.createContext(void 0);function f_(e){let t=V.useContext(d_);if(t===void 0&&!e)throw Error(Rt(50));return t}var p_={...pe,instantType:k(e=>e.instantType),hasViewport:k(e=>e.hasViewport)},m_=class e extends m{constructor(e,t,n=!1){let r=new oe,i={...h_(),...e};i.floatingRootContext=z(r,t,n),super(i,{popupRef:V.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:r,closeDelayRef:{current:300},inlineRectCoordsRef:{current:void 0}},p_)}setOpen=(e,t)=>{let n=t.reason,r=n===R,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;let o=t.event;e&&r&&t.trigger&&`clientX`in o&&`clientY`in o&&this.context.inlineRectCoordsRef.current?.element!==t.trigger&&Fi(this.context.inlineRectCoordsRef,t.trigger,o.clientX,o.clientY),this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let r={open:e};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0),Qe(r,e,t.trigger),this.update(r)};r?Li.flushSync(s):s()};static useStore(t,n){return Ke(t,(t,r)=>new e(n,t,r)).store}};function h_(){return{...Ce(),instantType:void 0,hasViewport:!1}}function g_(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,onOpenChangeComplete:i,actionsRef:a,handle:o,triggerId:s,defaultTriggerId:c=null,children:l}=e,u=m_.useStore(o?.store,{open:n,openProp:t,activeTriggerId:c,triggerIdProp:s});xe(()=>{t===void 0&&u.state.open===!1&&n===!0&&u.update({open:!0,activeTriggerId:c})}),u.useControlledProp(`openProp`,t),u.useControlledProp(`triggerIdProp`,s),u.useContextCallback(`onOpenChange`,r),u.useContextCallback(`onOpenChangeComplete`,i);let d=u.useState(`open`),f=u.useState(`activeTriggerId`),p=u.useState(`mounted`),m=u.useState(`payload`);le(u);let{forceUnmount:h}=Ye(d,u,()=>{u.context.inlineRectCoordsRef.current=void 0});te(()=>{d&&(f??u.set(`payload`,void 0))},[u,f,d]);let g=V.useCallback(()=>{u.setOpen(!1,_e(Oe))},[u]);V.useImperativeHandle(a,()=>({unmount:h,close:g}),[h,g]);let _=d||p;return(0,U.jsxs)(d_.Provider,{value:u,children:[_&&(0,U.jsx)(__,{store:u}),typeof l==`function`?l({payload:m}):l]})}function __({store:e}){let t=e.useState(`floatingRootContext`),n=g(t),r=n.reference??Ht,i=n.trigger??Ht,a=V.useMemo(()=>Bt(Ue,n.floating),[n.floating]);return P(e,{activeTriggerProps:r,inactiveTriggerProps:i,popupProps:a}),null}var v_=be(function(e){return f_(!0)?(0,U.jsx)(g_,{...e}):(0,U.jsx)($e,{children:(0,U.jsx)(g_,{...e})})}),y_=V.createContext(void 0);function b_(){let e=V.useContext(y_);if(e===void 0)throw Error(Rt(48));return e}var x_=V.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return f_().useState(`mounted`)||n?(0,U.jsx)(y_.Provider,{value:n,children:(0,U.jsx)(qt,{ref:t,...r})}):null}),S_=c(function(e,t){let{render:n,className:r,delay:i,closeDelay:a,id:o,payload:s,handle:c,style:l,...u}=e,d=f_(!0),p=c?.store??d;if(!p)throw Error(Rt(89));let m=O(o),h=p.useState(`isTriggerActive`,m),g=p.useState(`isOpenedByTrigger`,m),_=p.useState(`floatingRootContext`),v=p.context.inlineRectCoordsRef,y=V.useRef(null),b=i??600,x=a??300,{registerTrigger:S,isMountedByThisTrigger:C}=F(m,y,p,{payload:s});te(()=>{C&&(p.context.closeDelayRef.current=x)},[p,C,x]);let w=Se(_,{mouseOnly:!0,move:!1,handleClose:Ae(),delay:()=>({open:b,close:x}),triggerElementRef:y,isActiveTrigger:h,isClosing:()=>p.select(`transitionStatus`)===`ending`}),T=de(_,{delay:b}),E={open:g},D=p.useState(`triggerProps`,C),k=Pi(v,g);return Vt(`a`,e,{state:E,ref:[t,S,y],props:[w,T.reference,D,k,{id:m},u],stateAttributesMapping:f})}),C_=V.createContext(void 0);function w_(){let e=V.useContext(C_);if(e===void 0)throw Error(Rt(49));return e}var T_=V.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=x,style:_,...v}=e,b=f_(),S=b_(),C=d(),w=b.useState(`open`),T=b.useState(`mounted`),D=b.useState(`floatingRootContext`),O=b.useState(`instantType`),k=b.useState(`transitionStatus`),j=b.useState(`hasViewport`),N=b.context.inlineRectCoordsRef,P=y({anchor:i,floatingRootContext:D,positionMethod:a,mounted:T,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:p,collisionBoundary:u,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:S,nodeId:C,collisionAvoidance:g,adaptiveOrigin:j?E:void 0,inline:Ii(N)}),F=P.update;te(()=>{w&&T&&F()},[w,T,F]);let ee={open:w,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:O},ne=A(e,ee,{styles:P.positionerStyles,transitionStatus:k,props:v,refs:[t,b.useStateSetter(`positionerElement`)],hidden:!T,inert:!w});return(0,U.jsx)(C_.Provider,{value:P,children:(0,U.jsx)(M,{id:C,children:ne})})}),E_={...Xe,...ee},D_=V.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=f_(),{side:s,align:c}=w_(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`);We({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}});let m=re(()=>o.context.closeDelayRef.current);return Be(p,{closeDelay:m}),Vt(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[f,v(d),a],stateAttributesMapping:E_})}),O_=v_;function k_(e){let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=(0,U.jsx)(S_,{"data-slot":`preview-card-trigger`,...e}),t[0]=e,t[1]=n),n}function A_(e){let t=(0,H.c)(16),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,align:i,side:a,sideOffset:o,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?`start`:i,c=a===void 0?`top`:a,l=o===void 0?6:o,u;t[6]===n?u=t[7]:(u=B(`origin-(--transform-origin) rounded-lg border bg-popover text-popover-foreground shadow-lg outline-none transition-[scale,opacity] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0`,n),t[6]=n,t[7]=u);let d;t[8]!==r||t[9]!==u?(d=(0,U.jsx)(D_,{className:u,"data-slot":`preview-card-popup`,...r}),t[8]=r,t[9]=u,t[10]=d):d=t[10];let f;return t[11]!==s||t[12]!==c||t[13]!==l||t[14]!==d?(f=(0,U.jsx)(x_,{children:(0,U.jsx)(T_,{align:s,className:`z-[140] max-w-(--available-width)`,"data-slot":`preview-card-positioner`,side:c,sideOffset:l,children:d})}),t[11]=s,t[12]=c,t[13]=l,t[14]=d,t[15]=f):f=t[15],f}function j_(e){let t=(0,H.c)(36),{link:n,originalUrl:r,target:i,confirmBeforeOpen:a,onOpenPullRequest:o,onOpenFallback:s,fallback:c}=e,[l,u]=(0,V.useState)(!1),d=(0,V.useRef)(null),[f,p]=(0,V.useState)(!1),m;t[0]!==l||t[1]!==i?(m=l?hi.detail({environmentId:i.environmentId,input:i.input}):null,t[0]=l,t[1]=i,t[2]=m):m=t[2];let h=pn(m),g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g={reportFailure:!1,reportDefect:!1},t[3]=g):g=t[3];let _=br(hi.preview,g),v;t[4]!==a||t[5]!==n||t[6]!==s||t[7]!==o||t[8]!==r||t[9]!==_||t[10]!==f||t[11]!==i?(v=a===!0?(0,V.cloneElement)(n,{onClick:e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),e.stopPropagation(),!f&&(u(!1),p(!0),_(i).then(async e=>{vt(e)||e._tag===`Success`&&o?.(e.value.url)||await s?.(r)}).catch(M_).finally(()=>p(!1))))}}):n,t[4]=a,t[5]=n,t[6]=s,t[7]=o,t[8]=r,t[9]=_,t[10]=f,t[11]=i,t[12]=v):v=t[12];let y=v,b=h.data,x=b!==null||h.error!==null&&c!==void 0,S=l&&h.error!==null&&!x,C;t[13]===b?C=t[14]:(C=b===null?null:di({state:b.state,isDraft:b.isDraft}),t[13]=b,t[14]=C);let w=C,T=b?.author===null?`ghost`:b?.author.name&&b.author.name!==b.author.login?`${b.author.name} (@${b.author.login})`:b?.author.login??null,E;t[15]===x?E=t[16]:(E=e=>{!e&&!x&&d.current?.close()},t[15]=x,t[16]=E);let D;t[17]===y?D=t[18]:(D=(0,U.jsx)(k_,{render:(0,U.jsx)(tr,{render:y}),delay:350,closeDelay:120}),t[17]=y,t[18]=D);let O;t[19]===r?O=t[20]:(O=(0,U.jsx)(nr,{side:`top`,children:r}),t[19]=r,t[20]=O);let k;t[21]!==S||t[22]!==E||t[23]!==D||t[24]!==O?(k=(0,U.jsxs)(rr,{open:S,onOpenChange:E,children:[D,O]}),t[21]=S,t[22]=E,t[23]=D,t[24]=O,t[25]=k):k=t[25];let A;t[26]!==T||t[27]!==b||t[28]!==c||t[29]!==x||t[30]!==w?(A=x?(0,U.jsx)(A_,{align:`center`,className:`w-80 max-w-[calc(100vw-2rem)]`,children:(0,U.jsx)(`div`,{className:`p-3`,children:b===null?c:(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-2xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:b.repository}),(0,U.jsxs)(`span`,{className:`shrink-0`,children:[`#`,b.number]}),(0,U.jsx)(`span`,{"aria-hidden":!0,children:`·`}),w===null?null:(0,U.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1`,children:[(0,U.jsx)(w.Icon,{"aria-hidden":!0,className:`size-3 ${w.toneClassName}`}),w.label]})]}),(0,U.jsx)(`p`,{className:`mt-1 text-sm font-medium leading-snug text-foreground text-pretty`,children:b.title}),(0,U.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(Yr,{actor:b.author,className:`size-4`}),(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:T}),(0,U.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,U.jsxs)(`span`,{className:`shrink-0`,children:[`opened `,$n(b.createdAt)]})]})]})})}):null,t[26]=T,t[27]=b,t[28]=c,t[29]=x,t[30]=w,t[31]=A):A=t[31];let j;return t[32]!==l||t[33]!==k||t[34]!==A?(j=(0,U.jsxs)(O_,{open:l,onOpenChange:u,actionsRef:d,children:[k,A]}),t[32]=l,t[33]=k,t[34]=A,t[35]=j):j=t[35],j}function M_(e){console.error(`[pull-request-link-preview] failed to open link`,e)}var N_={open:`pr-open`,draft:`pr-draft`,merged:`pr-merged`,closed:`pr-closed`,unknown:`pull-request`};function P_(e){let t=(0,H.c)(20),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({icon:n,label:r,tooltip:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i.state===`unresolved`?`true`:void 0,s=a?0:void 0,c;t[5]===r?c=t[6]:(c=(0,U.jsx)(o_,{children:r}),t[5]=r,t[6]=c);let l;t[7]!==n||t[8]!==i||t[9]!==o||t[10]!==s||t[11]!==c?(l=(0,U.jsxs)(a_,{"data-context-unresolved":o,tabIndex:s,...i,children:[n,c]}),t[7]=n,t[8]=i,t[9]=o,t[10]=s,t[11]=c,t[12]=l):l=t[12];let u=l;if(!a)return u;let d;t[13]===u?d=t[14]:(d=(0,U.jsx)(tr,{render:u}),t[13]=u,t[14]=d);let f;t[15]===a?f=t[16]:(f=(0,U.jsx)(nr,{side:`top`,className:`whitespace-pre-wrap`,children:a}),t[15]=a,t[16]=f);let p;return t[17]!==d||t[18]!==f?(p=(0,U.jsxs)(rr,{children:[d,f]}),t[17]=d,t[18]=f,t[19]=p):p=t[19],p}function F_(e){let t=(0,H.c)(19),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,U.jsx)(`button`,{type:`button`}),t[0]=n):n=t[0];let r=`${e.accessibleLabel}. Show details`,i;t[1]!==e.copyMarkdown||t[2]!==e.kind||t[3]!==r?(i=(0,U.jsx)(a_,{kind:e.kind,render:n,"aria-label":r,"data-markdown-copy":e.copyMarkdown}),t[1]=e.copyMarkdown,t[2]=e.kind,t[3]=r,t[4]=i):i=t[4];let a;t[5]===e.label?a=t[6]:(a=(0,U.jsx)(o_,{children:e.label}),t[5]=e.label,t[6]=a);let o;t[7]!==e.icon||t[8]!==i||t[9]!==a?(o=(0,U.jsxs)(mr,{render:i,children:[e.icon,a]}),t[7]=e.icon,t[8]=i,t[9]=a,t[10]=o):o=t[10];let s;t[11]===e.accessibleLabel?s=t[12]:(s=(0,U.jsx)(dr,{className:`sr-only`,children:e.accessibleLabel}),t[11]=e.accessibleLabel,t[12]=s);let c;t[13]!==e.children||t[14]!==s?(c=(0,U.jsxs)(fr,{side:`top`,width:`lg`,padding:`compact`,children:[s,e.children]}),t[13]=e.children,t[14]=s,t[15]=c):c=t[15];let l;return t[16]!==o||t[17]!==c?(l=(0,U.jsxs)(hr,{children:[o,c]}),t[16]=o,t[17]=c,t[18]=l):l=t[18],l}function I_(e){let t=(0,H.c)(28),n=Zr(e.environmentId,e.metadata.url),r=e.metadata.state===`open`&&e.metadata.isDraft?`draft`:e.metadata.state,i=mi[r].Icon,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,U.jsx)(`button`,{type:`button`}),t[0]=a):a=t[0];let o=`Open ${e.kindLabel} ${e.label}: ${e.metadata.title}`,s;t[1]===e?s=t[2]:(s=t=>e.onOpen(t,e.metadata.url),t[1]=e,t[2]=s);let c;t[3]===i?c=t[4]:(c=(0,U.jsx)(i,{}),t[3]=i,t[4]=c);let l;t[5]===e.label?l=t[6]:(l=(0,U.jsx)(o_,{children:e.label}),t[5]=e.label,t[6]=l);let u;t[7]!==e.copyMarkdown||t[8]!==e.kind||t[9]!==o||t[10]!==s||t[11]!==c||t[12]!==l?(u=(0,U.jsxs)(a_,{kind:e.kind,render:a,"aria-label":o,"data-markdown-copy":e.copyMarkdown,onClick:s,children:[c,l]}),t[7]=e.copyMarkdown,t[8]=e.kind,t[9]=o,t[10]=s,t[11]=c,t[12]=l,t[13]=u):u=t[13];let d=u;if(n!==null){let r;t[14]===e.metadata?r=t[15]:(r=(0,U.jsx)(u_,{metadata:e.metadata}),t[14]=e.metadata,t[15]=r);let i;return t[16]!==d||t[17]!==n||t[18]!==e.metadata.url||t[19]!==r?(i=(0,U.jsx)(j_,{link:d,originalUrl:e.metadata.url,target:n,confirmBeforeOpen:!1,fallback:r}),t[16]=d,t[17]=n,t[18]=e.metadata.url,t[19]=r,t[20]=i):i=t[20],i}let f;t[21]===d?f=t[22]:(f=(0,U.jsx)(tr,{render:d}),t[21]=d,t[22]=f);let p;t[23]===e.metadata?p=t[24]:(p=(0,U.jsx)(nr,{side:`top`,children:(0,U.jsx)(u_,{metadata:e.metadata})}),t[23]=e.metadata,t[24]=p);let m;return t[25]!==f||t[26]!==p?(m=(0,U.jsxs)(rr,{children:[f,p]}),t[25]=f,t[26]=p,t[27]=m):m=t[27],m}function L_(e){try{let t=document.createElement(`canvas`);t.width=t.height=16;let n=t.getContext(`2d`);if(!n)return;n.drawImage(e,0,0,16,16);let{data:r}=n.getImageData(0,0,16,16),i=0,a=0,o=0,s=0;for(let e=0;e<r.length;e+=4){let t=r[e+3];i+=r[e]*t,a+=r[e+1]*t,o+=r[e+2]*t,s+=t}return s===0?void 0:`rgb(${Math.round(i/s)} ${Math.round(a/s)} ${Math.round(o/s)})`}catch{return}}function R_(e){let t=(0,H.c)(32),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({name:n,previewUrl:r,size:a,suffix:s,style:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let[c,l]=(0,V.useState)(),[u,d]=(0,V.useState)(),f=c?.url===r?c?.color:void 0,p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,U.jsx)(`button`,{type:`button`}),t[7]=p):p=t[7];let m=`Image attachment, ${n}, ${a}`,h;t[8]===f?h=t[9]:(h=f?{"--context-chip-accent":f}:{},t[8]=f,t[9]=h);let g;t[10]!==o||t[11]!==h?(g={...o,...h},t[10]=o,t[11]=h,t[12]=g):g=t[12];let _=g,v;t[13]!==u||t[14]!==r?(v=r?(0,U.jsx)(`img`,{crossOrigin:u===r?void 0:`anonymous`,src:r,alt:``,className:`size-[1.17em] shrink-0 rounded-sm object-cover`,onError:()=>d(r),onLoad:e=>l({url:r,color:L_(e.currentTarget)})},r):(0,U.jsx)(T,{}),t[13]=u,t[14]=r,t[15]=v):v=t[15];let y;t[16]===n?y=t[17]:(y=l_(n),t[16]=n,t[17]=y);let b;t[18]===y?b=t[19]:(b=(0,U.jsx)(o_,{className:`max-w-72`,children:y}),t[18]=y,t[19]=b);let x;t[20]===a?x=t[21]:(x=(0,U.jsx)(`span`,{className:`shrink-0 text-3xs text-current`,children:a}),t[20]=a,t[21]=x);let S;t[22]===s?S=t[23]:(S=s?(0,U.jsx)(`span`,{className:`text-3xs text-current`,children:s}):null,t[22]=s,t[23]=S);let C;return t[24]!==i||t[25]!==S||t[26]!==m||t[27]!==_||t[28]!==v||t[29]!==b||t[30]!==x?(C=(0,U.jsxs)(a_,{kind:`image`,render:p,"aria-label":m,style:_,...i,children:[v,b,x,S]}),t[24]=i,t[25]=S,t[26]=m,t[27]=_,t[28]=v,t[29]=b,t[30]=x,t[31]=C):C=t[31],C}function z_(e){let t=(0,H.c)(23),n;t[0]===e?n=t[1]:(n=(0,U.jsx)(B_,{...e}),t[0]=e,t[1]=n);let r=n,i=e.unresolved?`unresolved`:e.error?`invalid`:null,a=e.isVideo?`video`:`file`,o;t[2]===i?o=t[3]:(o=i?{state:i}:{},t[2]=i,t[3]=o);let s;t[4]!==e.accessibleLabel||t[5]!==e.suffix?(s=[e.accessibleLabel,e.suffix].filter(Boolean),t[4]=e.accessibleLabel,t[5]=e.suffix,t[6]=s):s=t[6];let c=s.join(`, `),l=e.unresolved?`true`:void 0,u;t[7]!==e.copyMarkdown||t[8]!==a||t[9]!==o||t[10]!==c||t[11]!==l?(u={kind:a,...o,"aria-label":c,"data-markdown-copy":e.copyMarkdown,"data-context-unresolved":l},t[7]=e.copyMarkdown,t[8]=a,t[9]=o,t[10]=c,t[11]=l,t[12]=u):u=t[12];let d=u,f;t[13]!==d||t[14]!==r||t[15]!==e.disabled||t[16]!==e.onOpen?(f=(0,U.jsx)(tr,{render:e.onOpen?(0,U.jsx)(a_,{render:(0,U.jsx)(`button`,{type:`button`,disabled:e.disabled}),onClick:e.onOpen,...d,children:r}):(0,U.jsx)(a_,{tabIndex:0,...d,children:r})}),t[13]=d,t[14]=r,t[15]=e.disabled,t[16]=e.onOpen,t[17]=f):f=t[17];let p;t[18]===e.tooltip?p=t[19]:(p=(0,U.jsx)(nr,{side:`top`,className:`whitespace-pre-wrap`,children:e.tooltip}),t[18]=e.tooltip,t[19]=p);let m;return t[20]!==f||t[21]!==p?(m=(0,U.jsxs)(rr,{children:[f,p]}),t[20]=f,t[21]=p,t[22]=m):m=t[22],m}function B_(e){let t=(0,H.c)(17),n;t[0]!==e.isVideo||t[1]!==e.name||t[2]!==e.theme?(n=e.isVideo?(0,U.jsx)(se,{}):(0,U.jsx)(Nr,{pathValue:e.name,kind:`file`,theme:e.theme}),t[0]=e.isVideo,t[1]=e.name,t[2]=e.theme,t[3]=n):n=t[3];let r;t[4]===e.name?r=t[5]:(r=l_(e.name),t[4]=e.name,t[5]=r);let i;t[6]===r?i=t[7]:(i=(0,U.jsx)(o_,{className:`max-w-72`,children:r}),t[6]=r,t[7]=i);let a;t[8]===e.size?a=t[9]:(a=(0,U.jsx)(`span`,{className:`shrink-0 text-3xs text-current`,children:e.size}),t[8]=e.size,t[9]=a);let o;t[10]===e.suffix?o=t[11]:(o=e.suffix?(0,U.jsx)(`span`,{className:`text-3xs text-current`,children:e.suffix}):null,t[10]=e.suffix,t[11]=o);let s;return t[12]!==n||t[13]!==i||t[14]!==a||t[15]!==o?(s=(0,U.jsxs)(U.Fragment,{children:[n,i,a,o]}),t[12]=n,t[13]=i,t[14]=a,t[15]=o,t[16]=s):s=t[16],s}function V_(e){let t=(0,H.c)(6),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,U.jsx)(et,{}),t[0]=n):n=t[0];let r=`Unavailable context, ${e.label}`,i;return t[1]!==e.copyMarkdown||t[2]!==e.label||t[3]!==e.tooltip||t[4]!==r?(i=(0,U.jsx)(P_,{icon:n,label:e.label,state:`unresolved`,"aria-label":r,"data-markdown-copy":e.copyMarkdown,tooltip:e.tooltip}),t[1]=e.copyMarkdown,t[2]=e.label,t[3]=e.tooltip,t[4]=r,t[5]=i):i=t[5],i}function H_(e){let t=(0,H.c)(38),{citation:n,inputRef:r,onSubmit:i,onSubmitAndSend:a,onCancel:o,onDraftChange:s}=e,[c,l]=(0,V.useState)(n.comment??``),u=c.length>ct,d;t[0]!==c||t[1]!==u||t[2]!==i?(d=()=>{u||i(c)},t[0]=c,t[1]=u,t[2]=i,t[3]=d):d=t[3];let f=d,p;t[4]!==c||t[5]!==u||t[6]!==i||t[7]!==a?(p=()=>{u||(a?a(c):i(c))},t[4]=c,t[5]=u,t[6]=i,t[7]=a,t[8]=p):p=t[8];let m=p,h;t[9]===o?h=t[10]:(h=e=>{e.stopPropagation(),!(e.nativeEvent.isComposing||e.keyCode===229)&&e.key===`Escape`&&(e.preventDefault(),o())},t[9]=o,t[10]=h);let g=u||void 0,_;t[11]===s?_=t[12]:(_=e=>{l(e.currentTarget.value),s?.(e.currentTarget.value)},t[11]=s,t[12]=_);let v;t[13]!==f||t[14]!==m?(v=e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&e.keyCode!==229&&(e.preventDefault(),e.metaKey||e.ctrlKey?m():f())},t[13]=f,t[14]=m,t[15]=v):v=t[15];let y;t[16]!==c||t[17]!==r||t[18]!==g||t[19]!==_||t[20]!==v?(y=(0,U.jsx)(`textarea`,{ref:r,"aria-label":`Comment on selected text`,"aria-description":`Enter to save the citation comment; Command/Ctrl+Enter to save and send; Shift+Enter for a new line.`,"aria-invalid":g,placeholder:`Add an optional comment...`,rows:2,className:`field-sizing-content block max-h-40 min-h-16 w-full resize-none bg-transparent px-1 py-1.5 text-base outline-none placeholder:text-muted-foreground sm:text-sm`,value:c,onChange:_,onKeyDown:v}),t[16]=c,t[17]=r,t[18]=g,t[19]=_,t[20]=v,t[21]=y):y=t[21];let b;t[22]===u?b=t[23]:(b=u?(0,U.jsxs)(`p`,{role:`status`,className:`pt-1 text-xs text-destructive`,children:[`Comments can contain up to `,ct.toLocaleString(),` `,`characters.`]}):null,t[22]=u,t[23]=b);let x;t[24]===o?x=t[25]:(x=(0,U.jsx)(we,{variant:`outline`,size:`xs`,onPointerDown:W_,onClick:o,children:`Cancel`}),t[24]=o,t[25]=x);let S=u?`Shorten comment`:`Save`,C;t[26]!==u||t[27]!==f||t[28]!==S?(C=(0,U.jsx)(we,{size:`xs`,disabled:u,onPointerDown:U_,onClick:f,children:S}),t[26]=u,t[27]=f,t[28]=S,t[29]=C):C=t[29];let w;t[30]!==C||t[31]!==x?(w=(0,U.jsxs)(`div`,{className:`mt-2 flex items-center justify-end gap-2`,children:[x,C]}),t[30]=C,t[31]=x,t[32]=w):w=t[32];let T;return t[33]!==w||t[34]!==h||t[35]!==y||t[36]!==b?(T=(0,U.jsxs)(`div`,{"data-citation-comment-editor":`true`,onKeyDown:h,children:[y,b,w]}),t[33]=w,t[34]=h,t[35]=y,t[36]=b,t[37]=T):T=t[37],T}function U_(e){return e.preventDefault()}function W_(e){return e.preventDefault()}function G_({reason:e,draft:t,savedComment:n}){return e===`escape-key`||t===null||t.trim()===(n??``).trim()?{kind:`close`}:t.length>8e3?{kind:`keep-open`}:{kind:`commit`,comment:t}}var K_=650,q_=3e3,J_=`--assistant-citation-highlight-opacity`,Y_=.45,X_=`p4-assistant-citation-comment`;function Z_({anchor:e,citation:t,onUnavailable:n}){let{source:r,range:i,viewport:a}=e,o=typeof CSS<`u`?CSS.highlights:void 0,s=null,c=!1,l=new MutationObserver(e=>{if(c)return;let t=e.some(e=>r.contains(e.target));f(t)}),u=()=>{c||(c=!0,l.disconnect(),s&&(s.delete(i),s.size===0&&o?.get(X_)===s&&o.delete(X_)))},d=()=>{c||(u(),n())},f=e=>{if(!r.isConnected||!a.contains(r))return d(),!1;if(e||i.collapsed||!r.contains(i.startContainer)||!r.contains(i.endContainer)){let e=r_(r,t);if(!e)return d(),!1;i.setStart(e.startContainer,e.startOffset),i.setEnd(e.endContainer,e.endOffset)}return!0};if(!f(!1))return u;if(typeof Highlight<`u`&&o){let e=o.get(X_);s=e??new Highlight,s.add(i),e||o.set(X_,s)}return l.observe(a,{childList:!0,subtree:!0,characterData:!0}),u}function Q_({root:e,itemKey:t,request:n,list:r}){let i=n.activationRef.current;if(i.dismissed)return;let a=r.getScrollableNode();if(!(a instanceof HTMLElement))return;let o=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,s=null,c=null,l=null,u=null,d=!1,f=!1,p=null,m=!i.scrolled,h=e=>l!==null&&e?.rangeCount===1&&e.getRangeAt(0)===l.range&&l.range.startContainer===l.snapshot.startContainer&&l.range.startOffset===l.snapshot.startOffset&&l.range.endContainer===l.snapshot.endContainer&&l.range.endOffset===l.snapshot.endOffset,g=()=>{s&&CSS.highlights.get(`p4-assistant-citation`)===s&&CSS.highlights.delete(`p4-assistant-citation`),s=null,c=null;let t=l?e.ownerDocument.getSelection():null;l&&h(t)&&t?.removeRange(l.range),l=null,delete e.dataset.citationHighlighted},_=()=>{f||(i.dismissed=!0,T())},v=()=>{if(u=null,f||i.dismissed||!e.isConnected||!a.contains(e)){g();return}if(i.pulse&&performance.now()-i.pulse.startedAt>=q_){_();return}let v=r.getState(),b=v.indexByKey(t);if(b===void 0||!(v.sizeAtIndex(b)>0))return;let x=r_(e,n.citation),S=(x??e).getBoundingClientRect();if(S.height<=0||a.clientHeight<=0)g();else{if(!i.scrolled){if(d)return;let e=a.getBoundingClientRect(),t=Math.max(0,Math.min(a.scrollHeight-a.clientHeight,v.scroll+S.top-e.top-Math.min(120,a.clientHeight/3)));if(Math.abs(t-v.scroll)>1){d=!0,r.scrollToOffset({offset:t,animated:!o}).then(()=>{d=!1,!f&&!i.dismissed&&y()},()=>{d=!1,!(f||i.dismissed)&&(i.dismissed=!0,g(),n.onComplete(),Qt.add({type:`warning`,title:`Could not open the cited response`,description:`Click the citation to try again.`}))});return}if(S.bottom<=e.top||S.top>=e.bottom)return;i.scrolled=!0,n.onComplete(),x||Qt.add({type:`warning`,title:`The quoted text has changed`,description:`Showing the source response. The saved quote is unchanged.`})}if(!x)_();else{if(typeof Highlight<`u`&&typeof CSS<`u`&&CSS.highlights)s=new Highlight(x),CSS.highlights.set(`p4-assistant-citation`,s),c=x,e.dataset.citationHighlighted=`true`;else{let t=e.ownerDocument.getSelection();if(t&&(m||h(t)))t.removeAllRanges(),t.addRange(x),l={range:t.getRangeAt(0),snapshot:x.cloneRange()},m=!1,c=x,e.dataset.citationHighlighted=`true`;else{_();return}}if(!p){let t=i.pulse??={startedAt:performance.now(),reducedMotion:o},n=e=>e/q_,r=n(2550);p=e.animate(t.reducedMotion?[{offset:0,[J_]:Y_},{offset:r,[J_]:Y_},{offset:1,[J_]:0}]:[{offset:0,[J_]:0},{offset:n(K_*.5),[J_]:Y_},{offset:n(K_),[J_]:0},{offset:n(K_*1.5),[J_]:Y_},{offset:r,[J_]:Y_},{offset:1,[J_]:0}],{duration:q_,easing:`ease-in-out`}),p.id=`p4-assistant-citation-pulse`,p.currentTime=Math.max(0,performance.now()-t.startedAt),p.finished.then(_,()=>{})}}}},y=()=>{u!==null&&cancelAnimationFrame(u),u=requestAnimationFrame(v)},b=new MutationObserver(t=>{let n=c!==null&&(c.collapsed||!e.contains(c.startContainer)||!e.contains(c.endContainer));n&&(m||=l!==null&&h(e.ownerDocument.getSelection()),g()),(n||t.some(t=>e.contains(t.target)||[...t.addedNodes,...t.removedNodes].some(t=>t.contains(e))))&&y()});b.observe(a,{childList:!0,characterData:!0,subtree:!0});let x=gr([e,a],y),S=r.getState(),C=[S.listenToPosition(t,y),S.listen(`totalSize`,y),S.listen(`headerSize`,y)],w=()=>{d&&(d=!1,r.scrollToOffset({get offset(){return a.scrollTop},animated:!1}))};i.cancelScroll=w,y();let T=()=>{if(!f){f=!0,w(),p?.cancel(),u!==null&&cancelAnimationFrame(u),b.disconnect(),x();for(let e of C)e();i.cancelScroll===w&&delete i.cancelScroll,g()}};return T}function $_(e){let t=(0,H.c)(11),{messageId:n,threadRef:r,itemKey:i,request:a,listRef:o,children:s}=e,c=(0,V.useRef)(null),l,u;t[0]!==i||t[1]!==o||t[2]!==n||t[3]!==a?(l=()=>{let e=c.current,t=o.current;if(e&&t&&a&&a.citation.messageId===n)return Q_({root:e,itemKey:i,request:a,list:t})},u=[i,o,n,a],t[0]=i,t[1]=o,t[2]=n,t[3]=a,t[4]=l,t[5]=u):(l=t[4],u=t[5]),(0,V.useEffect)(l,u);let d=r?.environmentId,f=r?.threadId,p;return t[6]!==s||t[7]!==n||t[8]!==d||t[9]!==f?(p=(0,U.jsx)(`div`,{ref:c,"data-assistant-citation-source":n,"data-assistant-citation-environment":d,"data-assistant-citation-thread":f,children:s}),t[6]=s,t[7]=n,t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function ev(e){let t=(0,H.c)(77),{citation:n,composer:r,commentEditor:i}=e,a=r!==void 0&&r,o=Zt(),s=(0,V.useRef)(null),c=(0,V.useRef)(null),l=(0,V.useRef)(null),[u,d]=(0,V.useState)(null),f=i?.open??!1,p=i?.sourceAnchor,m=p===u?void 0:p,h,g;t[0]===f?(h=t[1],g=t[2]):(h=()=>{f||(l.current=null)},g=[f],t[0]=f,t[1]=h,t[2]=g),(0,V.useEffect)(h,g);let _;t[3]!==n.comment||t[4]!==i?(_=e=>{let t=G_({reason:e,draft:l.current,savedComment:n.comment});return t.kind===`commit`?i?.onSave(t.comment)??!0:t.kind!==`keep-open`},t[3]=n.comment,t[4]=i,t[5]=_):_=t[5];let v=_,y;t[6]!==i||t[7]!==v||t[8]!==p?(y=()=>{p&&(v(`none`)?i?.onOpenChange(!1):d(p))},t[6]=i,t[7]=v,t[8]=p,t[9]=y):y=t[9];let b=(0,V.useEffectEvent)(y),x;t[10]!==n||t[11]!==f||t[12]!==b||t[13]!==p||t[14]!==u?(x=()=>{if(!f||p===u)return;let e=p??Hg(document,n);if(e)return Z_({anchor:e,citation:n,onUnavailable:b})},t[10]=n,t[11]=f,t[12]=b,t[13]=p,t[14]=u,t[15]=x):x=t[15];let S;t[16]!==n||t[17]!==f||t[18]!==p||t[19]!==u?(S=[n,f,p,u],t[16]=n,t[17]=f,t[18]=p,t[19]=u,t[20]=S):S=t[20],(0,V.useEffect)(x,S);let C;t[21]===m?C=t[22]:(C=m?{contextElement:m.source,getBoundingClientRect:()=>{let e=m.range.getClientRects(),t=e.item(e.length-1)??m.range.getBoundingClientRect(),n=m.source.getBoundingClientRect(),r=Math.min(Math.max(t.left,n.left),n.right),i=Math.max(Math.min(t.right,n.right),r);return new DOMRect(r,t.top,i-r,t.height)}}:void 0,t[21]=m,t[22]=C);let w=C,T;t[23]===n?T=t[24]:(T=$r(n),t[23]=n,t[24]=T);let E=T,D;t[25]!==n.environmentId||t[26]!==n.threadId?(D={environmentId:n.environmentId,threadId:n.threadId},t[25]=n.environmentId,t[26]=n.threadId,t[27]=D):D=t[27];let O;t[28]===n?O=t[29]:(O=Vr(n),t[28]=n,t[29]=O);let k;t[30]===n?k=t[31]:(k=Rr(n),t[30]=n,t[31]=k);let A;t[32]!==n||t[33]!==o?(A=e=>{e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),o(ei(n)))},t[32]=n,t[33]=o,t[34]=A):A=t[34];let j;t[35]!==D||t[36]!==O||t[37]!==k||t[38]!==A?(j={to:`/$environmentId/$threadId`,params:D,hash:O,"data-markdown-copy":k,resetScroll:!1,onClick:A},t[35]=D,t[36]=O,t[37]=k,t[38]=A,t[39]=j):j=t[39];let M=j,N=`View cited assistant text: ${E}`,P;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,U.jsx)(De,{"aria-hidden":`true`}),t[40]=P):P=t[40];let F;t[41]===E?F=t[42]:(F=(0,U.jsx)(o_,{className:`max-w-[16em]`,children:E}),t[41]=E,t[42]=F);let ee;t[43]!==M||t[44]!==N||t[45]!==F?(ee=(0,U.jsxs)(Xt,{...M,className:`inline-flex h-full min-w-0 items-center gap-[0.33em] rounded-sm text-inherit no-underline focus-visible:outline-2 focus-visible:outline-foreground`,"aria-label":N,children:[P,F]}),t[43]=M,t[44]=N,t[45]=F,t[46]=ee):ee=t[46];let te=ee;if(!a){let e;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(De,{}),t[47]=e):e=t[47];let r=`Quoted assistant text: ${E}`,i;t[48]===n?i=t[49]:(i=Rr(n),t[48]=n,t[49]=i);let a;t[50]===n?a=t[51]:(a=(0,U.jsx)(nv,{citation:n}),t[50]=n,t[51]=a);let o;t[52]===M?o=t[53]:(o=(0,U.jsx)(we,{variant:`outline`,size:`sm`,render:(0,U.jsx)(Xt,{...M})}),t[52]=M,t[53]=o);let s;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,U.jsx)(Ne,{"aria-hidden":`true`}),t[54]=s):s=t[54];let c;t[55]===o?c=t[56]:(c=(0,U.jsxs)(pr,{render:o,children:[s,`Go to source`]}),t[55]=o,t[56]=c);let l;t[57]!==a||t[58]!==c?(l=(0,U.jsxs)(`div`,{className:`flex max-h-[calc(var(--available-height)_-_1rem_-_2px)] flex-col items-start gap-3 p-1 text-sm`,children:[a,c]}),t[57]=a,t[58]=c,t[59]=l):l=t[59];let u;return t[60]!==E||t[61]!==r||t[62]!==i||t[63]!==l?(u=(0,U.jsx)(F_,{kind:`citation`,icon:e,label:E,accessibleLabel:r,copyMarkdown:i,children:l}),t[60]=E,t[61]=r,t[62]=i,t[63]=l,t[64]=u):u=t[64],u}let re;t[65]===n?re=t[66]:(re=Rr(n),t[65]=n,t[66]=re);let ie;t[67]!==m||t[68]!==n||t[69]!==i||t[70]!==w||t[71]!==v?(ie=i?(0,U.jsxs)(hr,{open:i.open,onOpenChange:(e,t)=>{!e&&!v(t.reason)?t.cancel():i.onOpenChange(e)},children:[(0,U.jsx)(mr,{"aria-label":n.comment?`Edit citation comment`:`Add comment to citation`,"data-citation-comment-trigger":`true`,render:(0,U.jsx)(s_,{}),children:(0,U.jsx)(ne,{"aria-hidden":`true`})}),i.open?(0,U.jsx)(fr,{...Ve,side:m?`bottom`:`top`,align:`end`,anchor:w,initialFocus:()=>{let e=s.current;return e&&(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length),e.scrollTop=e.scrollHeight),!1},finalFocus:i.onRestoreFocus?()=>{let e=document.activeElement;return(e===document.body||e!==null&&c.current?.contains(e))&&i.onRestoreFocus?.(),!1}:void 0,ref:c,"aria-label":`Edit citation comment`,width:`md`,padding:`compact`,onPointerDown:tv,children:(0,U.jsx)(H_,{citation:n,inputRef:s,onDraftChange:e=>{l.current=e,i.onDraftChange?.(e)},onSubmit:e=>i.onSave(e)?(i.onOpenChange(!1),!0):!1,...i.onSaveAndSend?{onSubmitAndSend:e=>i.onSaveAndSend?.(e)?(i.onOpenChange(!1),!0):!1}:{},onCancel:()=>{i.onCancel?i.onCancel():i.onOpenChange(!1)}},Rr(n))}):null]}):null,t[67]=m,t[68]=n,t[69]=i,t[70]=w,t[71]=v,t[72]=ie):ie=t[72];let I;return t[73]!==te||t[74]!==re||t[75]!==ie?(I=(0,U.jsxs)(a_,{kind:`citation`,contentEditable:!1,"data-assistant-citation-chip":`true`,"data-markdown-copy":re,children:[te,ie]}),t[73]=te,t[74]=re,t[75]=ie,t[76]=I):I=t[76],I}function tv(e){return e.stopPropagation()}function nv(e){let t=(0,H.c)(14),{citation:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={top:!1,bottom:!1},t[0]=r):r=t[0];let[i,a]=(0,V.useState)(r),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{let t=e.scrollTop>1,n=e.scrollHeight-e.clientHeight-e.scrollTop>1;a(e=>e.top===t&&e.bottom===n?e:{top:t,bottom:n})},t[1]=o):o=t[1];let s=o,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>e?gr(e,()=>s(e)):void 0,t[2]=c):c=t[2];let l=c,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>s(e.currentTarget),t[3]=u):u=t[3];let d;t[4]===i?d=t[5]:(d=B(`max-h-64 min-h-0 space-y-3 self-stretch overflow-y-auto whitespace-pre-wrap wrap-break-word`,or(i)),t[4]=i,t[5]=d);let f;t[6]===n.text?f=t[7]:(f=(0,U.jsx)(`blockquote`,{className:`border-l-2 border-border pl-3 text-muted-foreground`,children:n.text}),t[6]=n.text,t[7]=f);let p;t[8]===n.comment?p=t[9]:(p=n.comment?(0,U.jsx)(`p`,{children:n.comment}):null,t[8]=n.comment,t[9]=p);let m;return t[10]!==d||t[11]!==f||t[12]!==p?(m=(0,U.jsxs)(`div`,{ref:l,onScroll:u,className:d,children:[f,p]}),t[10]=d,t[11]=f,t[12]=p,t[13]=m):m=t[13],m}function rv(e){let t=(0,H.c)(36),n=e.link.environmentId??e.environmentId,r=bm(e.link.threadId),i;t[0]!==n||t[1]!==e.link.threadId?(i=I(n,e.link.threadId),t[0]=n,t[1]=e.link.threadId,t[2]=i):i=t[2];let a=Pt(i),o=Pt(a===null&&r!==null?I(n,r):null),s=a??o,c=s===null&&e.link.environmentId===null,l=Mt(c),u;t[3]!==c||t[4]!==e.link||t[5]!==l?(u=c?xm(e.link,l):null,t[3]=c,t[4]=e.link,t[5]=l,t[6]=u):u=t[6];let d=Pt(u),f=s??d,p=f?.environmentId??n,m=f?.id??e.link.threadId,h;t[7]!==p||t[8]!==f?(h=f===null?null:C(p,f.projectId),t[7]=p,t[8]=f,t[9]=h):h=t[9];let g=Ft(h),_;t[10]!==e.environmentId||t[11]!==e.link?(_=wm(e.link,e.environmentId),t[10]=e.environmentId,t[11]=e.link,t[12]=_):_=t[12];let v=_,y;t[13]!==e.label||t[14]!==f||t[15]!==m||t[16]!==v?(y=f?.title.trim()||e.label||(f===null?v:m),t[13]=e.label,t[14]=f,t[15]=m,t[16]=v,t[17]=y):y=t[17];let b=y,x;t[18]!==p||t[19]!==m?(x={environmentId:p,threadId:m},t[18]=p,t[19]=m,t[20]=x):x=t[20];let S=f===null?v:g?.title,w;t[21]!==p||t[22]!==e.label||t[23]!==e.link||t[24]!==f||t[25]!==m||t[26]!==b?(w=f===null?Cm(e.link,e.label??void 0):Cm({environmentId:p,threadId:m},b),t[21]=p,t[22]=e.label,t[23]=e.link,t[24]=f,t[25]=m,t[26]=b,t[27]=w):w=t[27];let T;t[28]===g?T=t[29]:(T=(0,U.jsx)(`span`,{className:`ms-[0.25em] me-[0.2em] inline-flex size-[14px] [vertical-align:-0.125em]`,"aria-hidden":!0,children:g===null?(0,U.jsx)(ce,{className:`block size-full shrink-0`}):(0,U.jsx)(gi,{project:g,className:`size-full`})}),t[28]=g,t[29]=T);let E;return t[30]!==x||t[31]!==S||t[32]!==w||t[33]!==T||t[34]!==b?(E=(0,U.jsxs)(Xt,{to:`/$environmentId/$threadId`,params:x,title:S,"data-markdown-copy":w,children:[T,b]}),t[30]=x,t[31]=S,t[32]=w,t[33]=T,t[34]=b,t[35]=E):E=t[35],E}function iv(e){return e.displayName?.trim()||e.name}var av=/(^|\s)\p{Sc}(?![0-9][0-9_]*(?:[kKmMbBtT]|[eE][0-9]+)?(?:\s|$))(?=[a-zA-Z0-9:_-]*[a-zA-Z])([a-zA-Z0-9][a-zA-Z0-9:_-]*)(?=\s|$)/gu;function*ov(e,t){let n=new Map;for(let r of e.matchAll(av)){let e=r[2]??``;n.has(e)||n.set(e,t.find(t=>t.name===e));let i=n.get(e);i&&(yield{start:r.index+(r[1]?.length??0),end:r.index+r[0].length,skill:i,rawText:`$${e}`})}}function sv(e){let t=(0,H.c)(6),n,r;if(t[0]!==e.skills||t[1]!==e.text){r=Symbol.for(`react.early_return_sentinel`);bb0:{let i=[],a=0;for(let{start:t,end:n,skill:r,rawText:o}of ov(e.text,e.skills))t>a&&i.push(e.text.slice(a,t)),i.push((0,U.jsx)(lv,{skill:r,rawText:o},`${t}:${r.name}`)),a=n;if(a===0){let n;t[4]===e.text?n=t[5]:(n=(0,U.jsx)(U.Fragment,{children:e.text}),t[4]=e.text,t[5]=n),r=n;break bb0}a<e.text.length&&i.push(e.text.slice(a)),n=(0,U.jsx)(U.Fragment,{children:i})}t[0]=e.skills,t[1]=e.text,t[2]=n,t[3]=r}else n=t[2],r=t[3];return r===Symbol.for(`react.early_return_sentinel`)?n:r}function cv(e,t){return V.Children.map(e,e=>{if(typeof e==`string`)return(0,U.jsx)(sv,{text:e,skills:t});if(!(0,V.isValidElement)(e))return e;let n=typeof e.type==`string`?e.type:e.props.node?.tagName;return n===`code`||n===`a`||!(`children`in e.props)?e:(0,V.cloneElement)(e,void 0,cv(e.props.children,t))})}function lv(e){let t=(0,H.c)(8),n=e.rawText,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,U.jsx)(uv,{}),t[0]=r):r=t[0];let i;t[1]===e.skill?i=t[2]:(i=iv(e.skill),t[1]=e.skill,t[2]=i);let a;t[3]===i?a=t[4]:(a=(0,U.jsx)(o_,{children:i}),t[3]=i,t[4]=a);let o;return t[5]!==e.rawText||t[6]!==a?(o=(0,U.jsxs)(a_,{kind:`skill`,"data-markdown-copy":n,children:[r,a]}),t[5]=e.rawText,t[6]=a,t[7]=o):o=t[7],o}function uv(){let e=(0,H.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`contents`,dangerouslySetInnerHTML:{__html:c_}}),e[0]=t):t=e[0],t}var dv=(0,V.lazy)(()=>r(()=>import(`./MathTypeset-C9x0hMF0.js`),__vite__mapDeps([0,1,2,3,4]))),fv=(0,V.memo)(function(e){let t=(0,H.c)(34),n=(0,V.useRef)(null),r=(0,V.useRef)(null),[i,a]=(0,V.useState)(!1),o,s;t[0]===e.focusable?(o=t[1],s=t[2]):(o=()=>{let t=n.current,i=r.current;if(!t||!i||e.focusable===!1)return;let o=()=>a(t.scrollWidth>t.clientWidth);return o(),gr([t,i],o)},s=[e.focusable],t[0]=e.focusable,t[1]=o,t[2]=s),(0,V.useLayoutEffect)(o,s);let c=e.focusable!==!1&&i,l;t[3]===e.tex?l=t[4]:(l=e.tex.trim(),t[3]=e.tex,t[4]=l);let u=l,d=e.display?`\\[\n${u}\n\\]`:`\\(${u}\\)`,f;t[5]===d?f=t[6]:(f=(0,U.jsx)(`span`,{className:`whitespace-pre-wrap`,children:d}),t[5]=d,t[6]=f);let p=f,m=e.display?`chat-markdown-math-display my-[0.65rem] block in-[.chat-markdown-table-container]:max-w-none in-[.chat-markdown-table-container]:overflow-visible`:`inline-block max-w-full align-middle whitespace-nowrap wrap-normal break-normal in-[.chat-markdown-table-container]:max-w-none in-[.chat-markdown-table-container]:overflow-visible`,h=e.display?`display`:`inline`,g=e.display?`${d}\n\n`:d,_=e.focusable===!1?void 0:`group`,v=e.focusable===!1?void 0:e.display?`Display equation`:`Inline equation`,y=c?0:-1,b=c?e.display?`Scroll display equation`:`Scroll inline equation`:void 0,x=e.display?`inline-block w-max min-w-full`:`inline-block w-max`,S;t[7]===u?S=t[8]:(S=[u],t[7]=u,t[8]=S);let C;t[9]!==p||t[10]!==e.display||t[11]!==u?(C=(0,U.jsx)(dv,{tex:u,display:e.display,fallback:p}),t[9]=p,t[10]=e.display,t[11]=u,t[12]=C):C=t[12];let w;t[13]!==p||t[14]!==C?(w=(0,U.jsx)(V.Suspense,{fallback:p,children:C}),t[13]=p,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==p||t[17]!==S||t[18]!==w?(T=(0,U.jsx)(ci,{resetKeys:S,fallback:p,children:w}),t[16]=p,t[17]=S,t[18]=w,t[19]=T):T=t[19];let E;t[20]!==x||t[21]!==T?(E=(0,U.jsx)(`span`,{ref:r,className:x,children:T}),t[20]=x,t[21]=T,t[22]=E):E=t[22];let D;t[23]!==b||t[24]!==E||t[25]!==y?(D=(0,U.jsx)(`span`,{ref:n,className:`block max-w-full overflow-x-auto overflow-y-hidden in-[.chat-markdown-table-container]:max-w-none in-[.chat-markdown-table-container]:overflow-visible px-0.5 py-0.75 focus-visible:outline-1 focus-visible:outline-solid focus-visible:-outline-offset-1 focus-visible:outline-border [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-thumb]:rounded [&::-webkit-scrollbar-thumb]:border [&::-webkit-scrollbar-thumb]:border-transparent [&::-webkit-scrollbar-thumb]:bg-clip-content`,tabIndex:y,"aria-label":b,children:E}),t[23]=b,t[24]=E,t[25]=y,t[26]=D):D=t[26];let O;return t[27]!==D||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_||t[32]!==v?(O=(0,U.jsx)(`span`,{className:m,"data-markdown-math":h,"data-markdown-copy":g,role:_,"aria-label":v,children:D}),t[27]=D,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=v,t[33]=O):O=t[33],O}),pv=/^[.,:;!?…)\]}"'’”]+/;function mv(){let e=t=>{if(t.tagName===`pre`||!t.children)return;let n=[];for(let r of t.children){e(r);let t=n.at(-1),i=r.type===`text`&&(t?.tagName===`a`||t?.tagName===`code`)?pv.exec(r.value??``)?.[0]:void 0;if(!t||!i){n.push(r);continue}n[n.length-1]={type:`element`,tagName:`span`,properties:{className:[`has-[[data-slot=context-chip-label]]:whitespace-nowrap`]},children:[t,{type:`text`,value:i}]};let a=(r.value??``).slice(i.length);a&&n.push({...r,value:a})}t.children=n};return e}async function hv(e){let t=Qn(e.source,{threadId:e.threadRef?.threadId,workspaceRoot:e.cwd,resolvedFilePath:e.resolvedFilePath});if(t===null)return null;let{kind:n,name:r,reference:i}=t,a=i?.kind===`file`?i.relativePath:void 0,o,s;if(t.access===`direct`)o=ga(t.uri);else{if(t.access===`unavailable`||!e.threadRef||!e.httpBaseUrl)throw Error(`Reconnect to this environment and open the media again.`);s={environmentId:e.threadRef.environmentId,resource:t.resource};let n=await e.createAssetUrl({environmentId:s.environmentId,input:{resource:s.resource}});if(n._tag===`Failure`)throw _t(n);let r=yr(e.httpBaseUrl,n.value.relativeUrl);if(r===null)throw Error(`The environment returned an invalid media URL.`);o=r+t.srcFragment}return{images:[{src:o,name:r,...n===`video`?{type:`video`,autoPlay:!1}:{},...t.access===`direct`&&ma(t.uri)!==null?{originalUrl:t.uri}:{},...t.srcFragment?{srcFragment:t.srcFragment}:{},actionsSource:{kind:n,name:r,src:o,...i?{reference:i}:{},...s?{asset:s}:{},...a&&e.onOpenFile?{onOpenFile:()=>e.onOpenFile?.(a)}:{}}}],index:0}}function gv(e,t){return{environmentId:e,resource:{_tag:`attachment`,attachmentId:t.id,fileName:t.name,mimeType:D(t)??t.mimeType}}}function _v(e,t){if(!u(t))return null;let n=t.previewUrl??null,r=t.downloadable===!1?void 0:gv(e,t);return n===null&&r===void 0?null:{images:[{src:n,name:t.name,type:`video`,actionsSource:{kind:`video`,name:t.name,src:n,...r?{asset:r}:{}}}],index:0}}function vv(e){let t=e.images[e.index],n=t?.actionsSource?.asset;return`${t?.src??(n?JSON.stringify([n.environmentId,n.resource]):`image`)}:${e.index}`}function yv(e,t){let n=URL.createObjectURL(t);return e.src=n,()=>URL.revokeObjectURL(n)}function bv(e,t){let n=e.find(e=>e.id===t);if(n?.type===`file`&&n.file&&u(n))return{images:[{src:URL.createObjectURL(n.file),name:n.name,type:`video`}],index:0};let r=e.flatMap(e=>e.type===`image`&&e.previewUrl?[{id:e.id,src:e.previewUrl,name:e.name,source:e.source}]:[]);if(r.length===0)return null;let i=r.findIndex(e=>e.id===t);return i<0?null:{images:r.map(e=>({src:e.src,name:e.name,...e.source?.kind===`snap-shot`?{source:e.source}:{}})),index:i}}var xv=[];function Sv(e){let t=e.fontStyle??0;return{...e.color?{color:e.color}:{},...t&1?{fontStyle:`italic`}:{},...t&2?{fontWeight:700}:{},...t&4?{textDecoration:`underline`}:{}}}function Cv(e){let t=(0,H.c)(13),{code:n,language:r,embedded:i,theme:a,wordClassName:o}=e,s=i===void 0?xv:i,c;t[0]===r?c=t[1]:(c=bi(r),t[0]=r,t[1]=c);let l=(0,V.use)(c);for(let e of s)(0,V.use)(bi(e.language));let u;if(t[2]!==n||t[3]!==s||t[4]!==l||t[5]!==r||t[6]!==a){let e=In(a),i=(t,n)=>l.codeToTokens(t,{lang:n,theme:e}).tokens;u=Ov(n,Ev(n,i(n,r),s,i)),t[2]=n,t[3]=s,t[4]=l,t[5]=r,t[6]=a,t[7]=u}else u=t[7];let d=u,f;if(t[8]!==d||t[9]!==o){let e;t[11]===o?e=t[12]:(e=e=>{let{key:t,tokens:n,ending:r}=e;return(0,U.jsxs)(`span`,{children:[o?kv(n).map(e=>typeof e==`string`?e:(0,U.jsx)(`span`,{className:o,children:e.pieces.map(Tv)},e.key)):n.map(wv),r]},t)},t[11]=o,t[12]=e),f=d.map(e),t[8]=d,t[9]=o,t[10]=f}else f=t[10];return f}function wv(e){return(0,U.jsx)(`span`,{style:Sv(e),children:e.content},`${e.offset}:${e.content}`)}function Tv(e){return(0,U.jsx)(`span`,{style:Sv(e.token),children:e.text},e.key)}function Ev(e,t,n,r){if(n.length===0)return t;let i=Array.from({length:e.length});for(let e of t.flat())i.fill(e,e.offset,e.offset+e.content.length);for(let e of n){let t;try{t=r(e.text,e.language)}catch{continue}for(let n of t.flat()){if(n.content===``)continue;let t=n.offset+n.content.length-1;i.fill(n,e.starts[n.offset],e.ends[t])}}return Dv(e,i)}function Dv(e,t){let n=[],r=0;for(let i of[...e.matchAll(/\r?\n/gu),void 0]){let a=i?.index??e.length,o=[];for(let n=r;n<a;){let r=t[n],i=n+1;for(;i<a&&t[i]?.color===r?.color&&t[i]?.fontStyle===r?.fontStyle;)i+=1;o.push({content:e.slice(n,i),offset:n,...r?.color?{color:r.color}:{},...r?.fontStyle?{fontStyle:r.fontStyle}:{}}),n=i}n.push(o),i&&(r=i.index+i[0].length)}return n}function Ov(e,t){let n=e.match(/\r?\n/gu)??[],r=0;return t.map((e,t)=>{let i=e.map(e=>e.content).join(``),a=`${r}:${i}`,o=n[t]??``;return r+=i.length+o.length,{key:a,tokens:e,ending:o}})}function kv(e){let t=[],n=null;for(let r of e){let e=r.offset;for(let i of r.content.split(/(\s+)/u))i!==``&&(/^\s/u.test(i)?(t.push(i),n=null):(n||(n={key:String(e),pieces:[]},t.push(n)),n.pieces.push({key:String(e),text:i,token:r})),e+=i.length)}return t}var Av=`relative h-28 w-52 max-w-full overflow-hidden rounded-lg border border-border/80`;function jv(e){let t=(0,H.c)(9),{details:n,className:r}=e,{resolvedTheme:i}=tn(),a;t[0]!==n.content||t[1]!==n.format||t[2]!==i?(a=n.format===`json`?(0,U.jsx)(ci,{fallback:n.content,children:(0,U.jsx)(V.Suspense,{fallback:n.content,children:(0,U.jsx)(Cv,{code:n.content,language:`json`,theme:i})})}):n.content,t[0]=n.content,t[1]=n.format,t[2]=i,t[3]=a):a=t[3];let o=a,s;t[4]===r?s=t[5]:(s=B(`overflow-auto whitespace-pre-wrap break-words font-mono focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/70`,r),t[4]=r,t[5]=s);let c;return t[6]!==o||t[7]!==s?(c=(0,U.jsx)(`pre`,{className:s,tabIndex:0,children:o}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function Mv(e){if(e.accessibility?.format===`element-tree`)return{content:JSON.stringify(e.accessibility,null,2),format:`json`};let t=e.accessibility?.format===`flat-text`?e.accessibility.text.trim():e.accessibleText?.trim();return t?{content:t,format:`text`}:void 0}function Nv(e){return!!(e.accessibility||e.accessibleText?.trim())}function Pv(e){let t=(0,H.c)(28),{source:n,className:r,side:i}=e,a=i===void 0?`top`:i,o;t[0]===n?o=t[1]:(o=Nv(n),t[0]=n,t[1]=o);let s=o,c=s?h:T,l;t[2]===n?l=t[3]:(l=Mv(n),t[2]=n,t[3]=l);let u=l,d=s?`Accessibility data`:`No accessibility data`,f=s?`View accessibility data`:`No accessibility data`,p;t[4]!==r||t[5]!==f?(p=(0,U.jsx)(mr,{render:(0,U.jsx)(we,{"aria-label":f,className:r,onClick:Fv,size:`icon-micro`,variant:`overlay`})}),t[4]=r,t[5]=f,t[6]=p):p=t[6];let m;t[7]===c?m=t[8]:(m=(0,U.jsx)(c,{className:`size-3`,"aria-hidden":`true`}),t[7]=c,t[8]=m);let g;t[9]!==p||t[10]!==m?(g=(0,U.jsx)(tr,{render:p,children:m}),t[9]=p,t[10]=m,t[11]=g):g=t[11];let _;t[12]!==a||t[13]!==d?(_=(0,U.jsx)(nr,{side:a,children:d}),t[12]=a,t[13]=d,t[14]=_):_=t[14];let v;t[15]!==g||t[16]!==_?(v=(0,U.jsxs)(rr,{children:[g,_]}),t[15]=g,t[16]=_,t[17]=v):v=t[17];let y;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,U.jsx)(dr,{children:`Accessibility data`}),t[18]=y):y=t[18];let b;t[19]!==u||t[20]!==s?(b=(0,U.jsxs)(`div`,{className:`max-h-[min(28rem,70vh)] space-y-2 overflow-y-auto`,children:[y,u?(0,U.jsx)(jv,{details:u,className:`max-h-64 rounded-md border border-border/70 bg-muted/45 p-2.5 text-2xs leading-4`}):s?(0,U.jsx)(`div`,{className:`rounded-md border border-border/70 bg-muted/45 p-2.5 text-muted-foreground text-xs leading-4`,children:`Structured accessibility elements were included, but they have no readable names or values.`}):(0,U.jsx)(`div`,{className:`rounded-md border border-border/70 bg-muted/45 p-2.5 text-muted-foreground text-xs leading-4`,children:`The app or capture backend did not provide verified accessibility data.`})]}),t[19]=u,t[20]=s,t[21]=b):b=t[21];let x;t[22]!==a||t[23]!==b?(x=(0,U.jsx)(fr,{side:a,align:`center`,width:`md`,children:b}),t[22]=a,t[23]=b,t[24]=x):x=t[24];let S;return t[25]!==x||t[26]!==v?(S=(0,U.jsxs)(hr,{children:[v,x]}),t[25]=x,t[26]=v,t[27]=S):S=t[27],S}function Fv(e){return e.stopPropagation()}function Iv(e){let t=(0,H.c)(21),{source:n,className:r}=e,i;t[0]===r?i=t[1]:(i=B(`pointer-events-none absolute inset-x-0 bottom-0 flex min-w-0 items-center gap-1.5 bg-linear-to-t from-black/85 via-black/55 to-transparent px-2.5 pb-2 pt-6`,r),t[0]=r,t[1]=i);let a;t[2]!==n.appIconDataUrl||t[3]!==n.appName?(a=n.appIconDataUrl?(0,U.jsx)(`img`,{src:n.appIconDataUrl,alt:``,className:`size-7 shrink-0 rounded-md`}):(0,U.jsx)(`div`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md bg-white/20 text-3xs font-medium text-white uppercase`,children:n.appName.slice(0,1)}),t[2]=n.appIconDataUrl,t[3]=n.appName,t[4]=a):a=t[4];let o;t[5]===n.appName?o=t[6]:(o=(0,U.jsx)(`span`,{className:`truncate`,children:n.appName}),t[5]=n.appName,t[6]=o);let s;t[7]===n?s=t[8]:(s=(0,U.jsx)(Pv,{source:n,className:`pointer-events-auto`}),t[7]=n,t[8]=s);let c;t[9]!==o||t[10]!==s?(c=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-2xs font-medium leading-3.5 text-white`,children:[o,s]}),t[9]=o,t[10]=s,t[11]=c):c=t[11];let l=n.windowTitle||`Captured window`,u;t[12]===l?u=t[13]:(u=(0,U.jsx)(`div`,{className:`truncate text-3xs leading-3.5 text-white/70`,children:l}),t[12]=l,t[13]=u);let d;t[14]!==c||t[15]!==u?(d=(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[c,u]}),t[14]=c,t[15]=u,t[16]=d):d=t[16];let f;return t[17]!==i||t[18]!==a||t[19]!==d?(f=(0,U.jsxs)(`div`,{className:i,children:[a,d]}),t[17]=i,t[18]=a,t[19]=d,t[20]=f):f=t[20],f}var Lv=8;function Rv(e){let t=(0,H.c)(44),{src:n,name:r,onError:i,ref:a}=e,o=(0,V.useRef)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={width:0,height:0},t[0]=s):s=t[0];let[c,l]=(0,V.useState)(s),[u,d]=(0,V.useState)(zv),[f,p]=(0,V.useState)(1),m=(0,V.useRef)(1),h=(0,V.useRef)(null),g=(0,V.useRef)(null),_=(0,V.useRef)(!1),[v,y]=(0,V.useState)(!1),b=Math.max(1,Math.min(u.height*.86,u.height-160)),x=Math.min(1,(u.width*.92-(u.width>=640?96:0))/(c.width||1),b/(c.height||1)),S=c.width*x*f,C=c.height*x*f,w,T;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>({pan(e){let t=o.current;if(!t||m.current<=1||(e===`ArrowLeft`||e===`ArrowRight`)&&t.scrollWidth<=t.offsetWidth)return!1;bb36:switch(e){case`ArrowLeft`:t.scrollLeft-=40;break bb36;case`ArrowRight`:t.scrollLeft+=40;break bb36;case`ArrowUp`:t.scrollTop-=40;break bb36;case`ArrowDown`:t.scrollTop+=40;break bb36;default:return!1}return!0}}),T=[],t[1]=w,t[2]=T):(w=t[1],T=t[2]),(0,V.useImperativeHandle)(a,w,T);let E;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(E=(e,t)=>{let n=o.current,r=m.current,i=Math.min(Lv,Math.max(1,e));if(!n||r===i)return;let a=n.getBoundingClientRect(),s=t?t.x-a.left:n.clientWidth/2,c=t?t.y-a.top:n.clientHeight/2;h.current={x:(n.scrollLeft+s)/r,y:(n.scrollTop+c)/r,clientX:a.left+s,clientY:a.top+c},m.current=i,p(i)},t[3]=E):E=t[3];let D=E,O,k;t[4]===f?(O=t[5],k=t[6]):(O=()=>{let e=o.current,t=h.current;if(!e||!t)return;let n=e.getBoundingClientRect();e.scrollLeft=t.x*f-(t.clientX-n.left),e.scrollTop=t.y*f-(t.clientY-n.top),h.current=null},k=[f],t[4]=f,t[5]=O,t[6]=k),(0,V.useLayoutEffect)(O,k);let A,j;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{let e=()=>{d({width:window.innerWidth,height:window.innerHeight}),D(1)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},j=[D],t[7]=A,t[8]=j):(A=t[7],j=t[8]),(0,V.useEffect)(A,j);let M,N;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>{let e=o.current;if(!e)return;let t=t=>{if(!t.ctrlKey||t.deltaY===0)return;t.preventDefault();let n=t.deltaY*(t.deltaMode===1?16:t.deltaMode===2?e.clientHeight:1);D(m.current*Math.exp(-n*.01),{x:t.clientX,y:t.clientY})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},M=[D],t[9]=M,t[10]=N):(M=t[9],N=t[10]),(0,V.useEffect)(N,M);let P=`${r}, zoomable image`,F=S||void 0,ee=C||void 0,te=f>1?v?`grabbing`:`grab`:`zoom-in`,ne;t[11]!==b||t[12]!==F||t[13]!==ee||t[14]!==te?(ne={width:F,height:ee,maxHeight:b,cursor:te},t[11]=b,t[12]=F,t[13]=ee,t[14]=te,t[15]=ne):ne=t[15];let re,ie,I,L,ae,oe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(re=e=>{_.current||e.detail>1||D(m.current>1?1:2,{x:e.clientX,y:e.clientY})},ie=e=>{e.ctrlKey||e.metaKey||e.altKey||(e.key===`Enter`||e.key===` `?(e.preventDefault(),e.repeat||D(m.current>1?1:2)):e.key===`+`||e.key===`=`?(e.preventDefault(),D(m.current*1.5)):e.key===`-`?(e.preventDefault(),D(m.current/1.5)):e.key===`0`&&(e.preventDefault(),D(1)))},I=e=>{if(g.current||(_.current=!1,e.pointerType!==`mouse`||e.button!==0||m.current<=1))return;let t=e.currentTarget,n=t.getBoundingClientRect();e.clientX-n.left>=t.clientWidth||e.clientY-n.top>=t.clientHeight||(g.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY,left:t.scrollLeft,top:t.scrollTop},t.setPointerCapture(e.pointerId),y(!0))},L=e=>{let t=g.current;t&&t.pointerId===e.pointerId&&(Math.hypot(e.clientX-t.x,e.clientY-t.y)>4&&(_.current=!0),e.currentTarget.scrollLeft=t.left-(e.clientX-t.x),e.currentTarget.scrollTop=t.top-(e.clientY-t.y))},ae=e=>{g.current?.pointerId===e.pointerId&&(e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),g.current=null,y(!1))},oe=e=>{g.current?.pointerId===e.pointerId&&(g.current=null,y(!1))},t[16]=re,t[17]=ie,t[18]=I,t[19]=L,t[20]=ae,t[21]=oe):(re=t[16],ie=t[17],I=t[18],L=t[19],ae=t[20],oe=t[21]);let se;t[22]!==C||t[23]!==b||t[24]!==c.width||t[25]!==S?(se=c.width?{width:S,height:C}:{maxWidth:`var(--media-width)`,maxHeight:b},t[22]=C,t[23]=b,t[24]=c.width,t[25]=S,t[26]=se):se=t[26];let ce;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ce=e=>{l({width:e.currentTarget.naturalWidth,height:e.currentTarget.naturalHeight})},t[27]=ce):ce=t[27];let le;t[28]!==r||t[29]!==i||t[30]!==n||t[31]!==se?(le=(0,U.jsx)(`img`,{src:n,alt:r,draggable:!1,className:`block max-w-none select-none`,style:se,onLoad:ce,onError:i}),t[28]=r,t[29]=i,t[30]=n,t[31]=se,t[32]=le):le=t[32];let ue;t[33]!==P||t[34]!==ne||t[35]!==le?(ue=(0,U.jsx)(`div`,{ref:o,role:`region`,"aria-label":P,"aria-description":`Click to zoom in or return to fit. Pinch or Ctrl+scroll to zoom, scroll or drag to pan. Use Enter to toggle zoom, plus or minus to zoom, and 0 to fit.`,tabIndex:0,className:`max-w-[var(--media-width)] overflow-auto overscroll-contain rounded-lg bg-background shadow-2xl ring-1 ring-border/70 outline-none focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-ring`,style:ne,onClick:re,onKeyDown:ie,onPointerDown:I,onPointerMove:L,onPointerUp:ae,onLostPointerCapture:oe,children:le}),t[33]=P,t[34]=ne,t[35]=le,t[36]=ue):ue=t[36];let de;t[37]===f?de=t[38]:(de=Math.round(f*100),t[37]=f,t[38]=de);let fe;t[39]===de?fe=t[40]:(fe=(0,U.jsxs)(`span`,{className:`sr-only`,"aria-live":`polite`,children:[de,`% zoom`]}),t[39]=de,t[40]=fe);let pe;return t[41]!==ue||t[42]!==fe?(pe=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[ue,fe]}),t[41]=ue,t[42]=fe,t[43]=pe):pe=t[43],pe}function zv(){return{width:window.innerWidth,height:window.innerHeight}}var Bv=`flex aspect-auto h-48 min-h-0 w-[min(var(--media-width),32rem)] flex-col items-center justify-center gap-3 rounded-lg border border-border/70 bg-black p-6 text-center text-sm text-white shadow-2xl`;function Vv(e){let t=(0,H.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,U.jsx)(`div`,{role:`alert`,className:Bv,children:n}),t[0]=n,t[1]=r),r}function Hv(e){let t=(0,H.c)(7),{item:n}=e,r=n.actionsSource?.asset,i=xr(r?.environmentId??null,r?.resource??null),a=Sr(r?.environmentId??null,r?.resource??null),o=r?i._tag===`Success`?i.url+(n.srcFragment??``):null:n.src,s=i._tag===`Failure`,c=n.autoPlay??!0,l=r?a:void 0,u;return t[0]!==n.name||t[1]!==n.originalUrl||t[2]!==o||t[3]!==s||t[4]!==c||t[5]!==l?(u=(0,U.jsx)(ka,{src:o,label:n.name,sourceFailed:s,originalUrl:n.originalUrl,preload:`metadata`,autoPlay:c,className:`block max-h-[var(--media-height)] max-w-[var(--media-width)] text-center`,videoClassName:`aspect-auto max-h-[var(--media-height)] w-auto max-w-[var(--media-width)] rounded-lg border border-border/70 shadow-2xl`,stateClassName:Bv,onRetry:l}),t[0]=n.name,t[1]=n.originalUrl,t[2]=o,t[3]=s,t[4]=c,t[5]=l,t[6]=u):u=t[6],u}var Uv=(0,V.memo)(function(e){let t=(0,H.c)(74),{preview:n,onClose:r}=e,[i,a]=(0,V.useState)(0),[o,s]=(0,V.useState)(null),[c,u]=(0,V.useState)(null),d=(0,V.useRef)(null),[f]=(0,V.useState)(Wv),p=(0,V.useRef)(null),m=n.images.length,h=m>0?((n.index+i)%m+m)%m:0,g=n.images[h],_;t[0]!==g?.actionsSource||t[1]!==g?.name||t[2]!==g?.src||t[3]!==g?.type?(_=g?.actionsSource??{kind:g?.type===`video`?`video`:`image`,name:g?.name??`Media`,src:g?.src??null},t[0]=g?.actionsSource,t[1]=g?.name,t[2]=g?.src,t[3]=g?.type,t[4]=_):_=t[4];let v=_,y=v.onOpenFile,b;t[5]!==r||t[6]!==y||t[7]!==v?(b=y?{...v,onOpenFile:()=>{y(),r()}}:v,t[5]=r,t[6]=y,t[7]=v,t[8]=b):b=t[8];let x=b,S;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{a(t=>t+e)},t[9]=S):S=t[9];let C=S,w=(0,V.useRef)(null),T,E;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>(w.current=document.activeElement,()=>{let e=w.current;e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:!0})}),E=[],t[10]=T,t[11]=E):(T=t[10],E=t[11]),(0,V.useEffect)(T,E);let D;t[12]===n.images.length?D=t[13]:(D=e=>{e.defaultPrevented||nn()||e.target instanceof HTMLVideoElement||(d.current?.pan(e.key)?(e.preventDefault(),e.stopPropagation()):n.images.length<=1||(e.key===`ArrowLeft`?(e.preventDefault(),e.stopPropagation(),C(-1)):e.key===`ArrowRight`&&(e.preventDefault(),e.stopPropagation(),C(1))))},t[12]=n.images.length,t[13]=D);let O=D,k,A;if(t[14]===r?(k=t[15],A=t[16]):(k=()=>{let e=e=>{e.key!==`Escape`||nn()||(e.preventDefault(),e.stopPropagation(),r())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},A=[r],t[14]=r,t[15]=k,t[16]=A),(0,V.useEffect)(k,A),!g)return null;let j=g.type===`video`?`video`:`image`,M;t[17]===g.originalUrl?M=t[18]:(M=g.originalUrl&&ma(g.originalUrl)!==null?(0,U.jsx)(Ca,{originalUrl:g.originalUrl}):null,t[17]=g.originalUrl,t[18]=M);let N=M,P;t[19]===g.source?P=t[20]:(P=g.source?Mv(g.source):void 0,t[19]=g.source,t[20]=P);let F=P,ee=!!F&&c===g.src,te=ee?`Show screenshot`:F?.format===`json`?`Show accessibility JSON`:`Show extracted text`,ne;t[21]===r?ne=t[22]:(ne=e=>{e||r()},t[21]=r,t[22]=ne);let re;t[23]===f?re=t[24]:(re=()=>f,t[23]=f,t[24]=re);let ie;t[25]===r?ie=t[26]:(ie=e=>{e.target===e.currentTarget&&r()},t[25]=r,t[26]=ie);let I;t[27]===j?I=t[28]:(I=(0,U.jsxs)(cr,{className:`sr-only`,children:[`Expanded `,j,` preview`]}),t[27]=j,t[28]=I);let L=`Close ${j} preview`,ae;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,U.jsx)(je,{}),t[29]=ae):ae=t[29];let oe;t[30]!==r||t[31]!==L?(oe=(0,U.jsx)(we,{type:`button`,ref:p,size:`icon-sm`,variant:`media-close`,className:`absolute right-0 top-0 z-20`,onClick:r,"aria-label":L,children:ae}),t[30]=r,t[31]=L,t[32]=oe):oe=t[32];let se;t[33]===n.images.length?se=t[34]:(se=n.images.length>1&&(0,U.jsx)(we,{type:`button`,size:`icon`,variant:`media-navigation`,className:`left-0 top-auto bottom-0 translate-y-0 sm:top-1/2 sm:bottom-auto sm:-translate-y-1/2`,"aria-label":`Previous media`,onClick:()=>C(-1),children:(0,U.jsx)(l,{className:`size-5`})}),t[33]=n.images.length,t[34]=se);let ce;t[35]!==F||t[36]!==o||t[37]!==h||t[38]!==g||t[39]!==N||t[40]!==ee?(ce=g.type===`video`?(0,U.jsx)(Hv,{item:g},h):ee?F?(0,U.jsx)(jv,{details:F,className:`h-[min(var(--media-height),40rem)] w-[min(var(--media-width),42rem)] transition-opacity duration-140 ease-out starting:opacity-0 rounded-lg border border-border/70 bg-background p-4 text-xs leading-5 shadow-2xl motion-reduce:transition-none`}):null:g.src===null||o===g.src?(0,U.jsxs)(Vv,{children:[(0,U.jsx)(`p`,{children:N?`This image could not be loaded.`:`Image unavailable. The file may have been moved or deleted.`}),N]}):(0,U.jsx)(Rv,{ref:d,src:g.src,name:g.name,onError:()=>s(g.src)},`${h}:${g.src}`),t[35]=F,t[36]=o,t[37]=h,t[38]=g,t[39]=N,t[40]=ee,t[41]=ce):ce=t[41];let le=n.images.length>1?` (${h+1}/${n.images.length})`:``,ue;t[42]!==g.name||t[43]!==le?(ue=(0,U.jsxs)(`span`,{className:`truncate`,"aria-live":`polite`,"aria-atomic":`true`,children:[g.name,le]}),t[42]=g.name,t[43]=le,t[44]=ue):ue=t[44];let de;t[45]!==F||t[46]!==te||t[47]!==g.source||t[48]!==g.src||t[49]!==ee?(de=F&&g.source?(0,U.jsx)(we,{"aria-label":te,"aria-pressed":ee,onClick:()=>u(ee?null:g.src),size:`icon-micro`,variant:`overlay`,children:(0,U.jsx)(Yt,{className:`size-3`,"aria-hidden":`true`,icon:ee?Wt:Kt})}):g.source?(0,U.jsx)(Pv,{source:g.source,side:`top`}):null,t[45]=F,t[46]=te,t[47]=g.source,t[48]=g.src,t[49]=ee,t[50]=de):de=t[50];let fe;t[51]!==ue||t[52]!==de?(fe=(0,U.jsxs)(`div`,{className:`mt-2 flex max-w-[var(--media-width)] items-center justify-center gap-1.5 text-xs text-white/80 max-sm:px-10`,children:[ue,de]}),t[51]=ue,t[52]=de,t[53]=fe):fe=t[53];let pe;t[54]!==ce||t[55]!==fe?(pe=(0,U.jsxs)(`div`,{className:`relative isolate z-10 flex max-h-full max-w-[var(--media-width)] flex-col items-center`,children:[ce,fe]}),t[54]=ce,t[55]=fe,t[56]=pe):pe=t[56];let R;t[57]!==x||t[58]!==pe?(R=(0,U.jsx)(Oa,{source:x,showTooltip:!1,children:pe}),t[57]=x,t[58]=pe,t[59]=R):R=t[59];let me;t[60]===n.images.length?me=t[61]:(me=n.images.length>1&&(0,U.jsx)(we,{type:`button`,size:`icon`,variant:`media-navigation`,className:`right-0 top-auto bottom-0 translate-y-0 sm:top-1/2 sm:bottom-auto sm:-translate-y-1/2`,"aria-label":`Next media`,onClick:()=>C(1),children:(0,U.jsx)(ye,{className:`size-5`})}),t[60]=n.images.length,t[61]=me);let z;t[62]!==O||t[63]!==re||t[64]!==ie||t[65]!==I||t[66]!==oe||t[67]!==se||t[68]!==R||t[69]!==me?(z=(0,U.jsxs)(lr,{...Ve,variant:`media`,showCloseButton:!1,bottomStickOnMobile:!1,className:`row-start-1 h-full max-h-[92vh] w-[92vw] max-w-[92vw] items-center justify-center overflow-visible [--media-width:92vw] [--media-height:min(86vh,calc(100vh-160px))] sm:[--media-width:calc(92vw-96px)]`,onKeyDown:O,initialFocus:p,finalFocus:re,onClick:ie,children:[I,oe,se,R,me]}),t[62]=O,t[63]=re,t[64]=ie,t[65]=I,t[66]=oe,t[67]=se,t[68]=R,t[69]=me,t[70]=z):z=t[70];let he;return t[71]!==ne||t[72]!==z?(he=(0,U.jsx)(ur,{open:!0,onOpenChange:ne,children:z}),t[71]=ne,t[72]=z,t[73]=he):he=t[73],he});function Wv(){return document.activeElement instanceof HTMLElement?document.activeElement:null}var Gv=new WeakMap;function Kv(e,t){let n=e.closest(`[data-image-gallery]`)??e.closest(`.chat-markdown`),r=[],i=-1;for(let a of n?.querySelectorAll(`img`)??[]){let n=Gv.get(a);if(!n)continue;let o=a.closest(`a`),s=o?.getAttribute(`href`)??``;if(o&&Et(s)!==`image`)continue;let c=ma(s)===null?null:ga(s),l=Kn(s),u=c?{...n,src:c,originalUrl:s,actionsSource:{kind:`image`,name:n.name,src:c,...l?{reference:l}:{}}}:n;a===e||!Gv.has(e)&&i<0&&u.src===t.src?(i=r.length,r.push(t)):r.push(u)}return i<0?{images:[t],index:0}:{images:r,index:i}}function qv(e){let t=(0,H.c)(5),n=_i(e.environmentId,e.path,e.cwd),r=n?.kind===`directory`?`directory`:`file`,i=n?.mimeType,a;return t[0]!==e.path||t[1]!==e.theme||t[2]!==r||t[3]!==i?(a=(0,U.jsx)(Nr,{pathValue:e.path,kind:r,mimeType:i,theme:e.theme}),t[0]=e.path,t[1]=e.theme,t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function Jv(e){let t=(0,H.c)(5),n=_i(e.environmentId,e.path,e.cwd),r=e.label??e.path,i;t[0]===n?i=t[1]:(i=n?.byteLength===void 0?null:` · ${Mr(n.byteLength)}`,t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,U.jsxs)(U.Fragment,{children:[r,i]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function Yv(e){let t=(0,H.c)(10),n;t[0]!==e.cwd||t[1]!==e.environmentId||t[2]!==e.path||t[3]!==e.theme?(n=(0,U.jsx)(qv,{path:e.path,environmentId:e.environmentId,cwd:e.cwd,theme:e.theme}),t[0]=e.cwd,t[1]=e.environmentId,t[2]=e.path,t[3]=e.theme,t[4]=n):n=t[4];let r;t[5]===e.label?r=t[6]:(r=(0,U.jsx)(o_,{children:e.label}),t[5]=e.label,t[6]=r);let i;return t[7]!==n||t[8]!==r?(i=(0,U.jsxs)(U.Fragment,{children:[n,r]}),t[7]=n,t[8]=r,t[9]=i):i=t[9],i}function Xv(e){let t=e.children.find(e=>e.type===`element`&&e.tagName===`pre`);if(t?.type!==`element`)throw Error(`Missing highlighted pre element`);let n=t.children.find(e=>e.type===`element`&&e.tagName===`code`);if(n?.type!==`element`)throw Error(`Missing highlighted code element`);return n.children}function Zv(e,t,n){let r={lang:t,theme:n},i={type:`text`,value:`
41
+ `),r+=1),i=!1,n.push({node:e,start:r,end:r+a.length}),t.push(a),r+=a.length},o=e=>{if(e.nodeType===3){let t=e;t.length>0&&a(t,t.data);return}if(e.nodeType!==1)return;let t=e;if(t.matches(Ug))return;let n=t.matches(Wg);if((n||t.tagName===`BR`)&&(i=!0),t.matches(`[data-markdown-math]`))a(t,t.getAttribute(`data-markdown-copy`)?.trim()??``);else for(let e of t.childNodes)o(e);n&&(i=!0)};return o(e),{text:t.join(``),chunks:n}}function Zg(e){return(e.nodeType===1?e:e.parentElement)?.closest(Ug)??null}function Qg(e,t){return!(t.collapsed||!e.contains(t.startContainer)||!e.contains(t.endContainer)||Zg(t.startContainer)!==null||Zg(t.endContainer)!==null)}function $g(e){let t=Pg(e.parentElement)??e.parentElement,n=t?.ownerDocument?.defaultView;return!!t&&!!n&&n.getComputedStyle(t).userSelect===`none`}function e_(e,t,n){if(!e.intersectsNode(t))return null;if(t.nodeType===3){let n=t;return(t===e.startContainer?e.startOffset:0)<(t===e.endContainer?e.endOffset:n.length)&&!$g(n)?n:null}for(let r=n?t.lastChild:t.firstChild;r!==null;r=n?r.previousSibling:r.nextSibling){let t=e_(e,r,n);if(t!==null)return t}return null}function t_(e,t){if(t===null||t.isCollapsed||t.rangeCount!==1)return null;let n=t.getRangeAt(0).cloneRange(),r=e_(n,n.commonAncestorContainer,!1),i=e_(n,n.commonAncestorContainer,!0);if(r===null||i===null)return null;let a=r.parentElement?.closest(`[data-assistant-citation-source]`);if(!a||!e.contains(a))return null;let o=Pg(r.parentElement),s=Pg(i.parentElement);if(o?n.setStartBefore(o):n.setStart(r,r===n.startContainer?n.startOffset:0),s?n.setEndAfter(s):n.setEnd(i,i===n.endContainer?n.endOffset:i.length),!Qg(a,n))return null;let c=Xg(a),l=null,u=0;for(let e of c.chunks){if(!n.intersectsNode(e.node))continue;let t=n.startContainer===e.node?n.startOffset:0,r=n.endContainer===e.node?n.endOffset:e.end-e.start;t!==r&&(l??=e.start+t,u=e.start+r)}if(l===null)return null;let d=qg(c.text,l,u);return d===null?null:{source:a,selector:d,range:n}}function n_(e,t){let n=0;for(let r of e.matchAll(/\s+|\S+/g)){let e=/\s/.test(r[0][0]),i=e?1:r[0].length;if(t<=n+i)return r.index+(e&&t>n?r[0].length:t-n);n+=i}return e.length}function r_(e,t){if(Zg(e)!==null)return null;let n=Xg(e),r=Jg(n.text,t);if(r===null)return null;let i=n_(n.text,r.start),a=n_(n.text,r.end),o=n.chunks.find(e=>e.end>i),s=n.chunks.findLast(e=>e.start<a);if(o===void 0||s===void 0)return null;let c=e.ownerDocument.createRange();return Yg(o.node)?c.setStart(o.node,Math.max(0,i-o.start)):c.setStartBefore(o.node),Yg(s.node)?c.setEnd(s.node,Math.min(s.node.length,a-s.start)):c.setEndAfter(s.node),Qg(e,c)?c:null}var i_=zt(`inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] border px-[0.5em] align-middle font-medium text-[0.86em] leading-none [&_svg]:block [&_svg]:size-[1.17em] [&_svg]:shrink-0 [&_svg]:self-center [button&,a&,[data-popup-open]&]:cursor-pointer [button&,a&]:transition-colors [button&,a&]:motion-reduce:transition-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-foreground disabled:cursor-default`,{defaultVariants:{kind:`neutral`},variants:{kind:{neutral:`border-border/70 bg-accent/40 text-foreground`,image:`[--context-chip-accent:oklch(0.62_0.16_16)]`,video:`[--context-chip-accent:oklch(0.62_0.16_48)]`,file:`[--context-chip-accent:oklch(0.62_0.136_237)]`,mention:`[--context-chip-accent:oklch(0.62_0.11_215)]`,terminal:`[--context-chip-accent:oklch(0.62_0.134_163)]`,element:`[--context-chip-accent:oklch(0.62_0.134_70)]`,"preview-annotation":`[--context-chip-accent:oklch(0.62_0.134_70)]`,"review-comment":`[--context-chip-accent:oklch(0.62_0.16_292)]`,"pull-request":`[--context-chip-accent:oklch(0.62_0.16_277)]`,"pr-open":`[--context-chip-accent:oklch(0.62_0.134_163)]`,"pr-draft":`[--context-chip-accent:oklch(0.62_0.02_259)]`,"pr-merged":`[--context-chip-accent:oklch(0.62_0.16_292)]`,"pr-closed":`[--context-chip-accent:oklch(0.62_0.16_16)]`,skill:`[--context-chip-accent:oklch(0.62_0.16_322)]`,thread:`[--context-chip-accent:oklch(0.62_0.12_190)]`,environment:`[--context-chip-accent:oklch(0.62_0.11_145)]`,citation:`[--context-chip-accent:oklch(0.62_0.16_259)]`},state:{unresolved:`border-dashed`,invalid:``}},compoundVariants:[{kind:[`image`,`video`,`file`,`mention`,`terminal`,`element`,`preview-annotation`,`review-comment`,`pull-request`,`pr-open`,`pr-draft`,`pr-merged`,`pr-closed`,`skill`,`thread`,`citation`],className:`[--context-chip-border:color-mix(in_oklab,var(--context-chip-accent)_34%,var(--contrast-border))] [--context-chip-border-hover:color-mix(in_oklab,var(--context-chip-accent)_48%,var(--contrast-border))] [--context-chip-foreground:color-mix(in_oklab,var(--context-chip-accent)_22%,var(--contrast-foreground))] border-(--context-chip-border) bg-(--context-chip-accent)/11 text-(--context-chip-foreground) [button:enabled&,a&]:hover:border-(--context-chip-border-hover) [button:enabled&,a&]:hover:bg-(--context-chip-accent)/17`},{state:`unresolved`,className:`text-foreground`},{state:`invalid`,className:`border-destructive/35 bg-destructive/8 text-destructive`}]});function a_(e){let t=(0,H.c)(9),n,r,i,a;if(t[0]!==e){let{className:o,kind:s,state:c,render:l,...u}=e;n=l;let d={className:B(i_({kind:s,state:c}),o),"data-slot":`context-chip`,"data-state":c};a=Ut,r=`span`,i=Bt(d,u),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a}else n=t[1],r=t[2],i=t[3],a=t[4];let o;return t[5]!==n||t[6]!==r||t[7]!==i?(o={defaultTagName:r,props:i,render:n},t[5]=n,t[6]=r,t[7]=i,t[8]=o):o=t[8],a(o)}function o_(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=B(`block min-w-0 self-center truncate leading-tight`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,U.jsx)(`span`,{className:i,"data-slot":`context-chip-label`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function s_(e){let t=(0,H.c)(9),n,r,i,a;if(t[0]!==e){let{className:o,render:s,...c}=e;n=s;let l={className:B(`ml-[0.17em] inline-flex size-[1.17em] shrink-0 cursor-pointer items-center justify-center rounded-sm text-current transition-colors hover:bg-(--context-chip-accent,var(--color-foreground))/17 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring motion-reduce:transition-none [&_svg]:size-[0.85em]`,o),"data-slot":`context-chip-action`,type:n?void 0:`button`};a=Ut,r=`button`,i=Bt(l,c),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a}else n=t[1],r=t[2],i=t[3],a=t[4];let o;return t[5]!==n||t[6]!==r||t[7]!==i?(o={defaultTagName:r,props:i,render:n},t[5]=n,t[6]=r,t[7]=i,t[8]=o):o=t[8],a(o)}var c_=`<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>`;function l_(e,t=36){let n=Array.from(e);if(n.length<=t)return e;if(t<=0)return``;if(t===1)return`…`;let r=t-1,i=Math.min(r-1,r>=18?14:Math.ceil(r/2)),a=r-i,o=i===0?``:n.slice(-i).join(``);return`${n.slice(0,a).join(``)}…${o}`}function u_(e){let t=(0,H.c)(34),{metadata:n}=e,r,i,a,o,s;t[0]===n?(r=t[1],i=t[2],a=t[3],o=t[4],s=t[5]):(i=di(n),s=`max-w-80 space-y-1 overflow-hidden py-0.5 text-left`,o=`flex items-center gap-1.5 text-xs font-medium`,r=i.Icon,a=B(`size-3.5 shrink-0`,i.toneClassName),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s);let c;t[6]!==r||t[7]!==a?(c=(0,U.jsx)(r,{className:a}),t[6]=r,t[7]=a,t[8]=c):c=t[8];let l;t[9]===n.number?l=t[10]:(l=(0,U.jsxs)(`span`,{className:`text-foreground`,children:[`Pull request #`,n.number]}),t[9]=n.number,t[10]=l);let u;t[11]!==i.label||t[12]!==i.toneClassName?(u=(0,U.jsx)(`span`,{className:i.toneClassName,children:i.label}),t[11]=i.label,t[12]=i.toneClassName,t[13]=u):u=t[13];let d;t[14]!==o||t[15]!==c||t[16]!==l||t[17]!==u?(d=(0,U.jsxs)(`div`,{className:o,children:[c,l,u]}),t[14]=o,t[15]=c,t[16]=l,t[17]=u,t[18]=d):d=t[18];let f;t[19]===n.title?f=t[20]:(f=(0,U.jsx)(`div`,{className:`wrap-break-word text-foreground`,children:n.title}),t[19]=n.title,t[20]=f);let p;t[21]===n.headBranch?p=t[22]:(p=(0,U.jsx)(`code`,{className:`truncate`,children:n.headBranch}),t[21]=n.headBranch,t[22]=p);let m;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,U.jsx)(Re,{className:`size-3 shrink-0`,"aria-hidden":`true`}),t[23]=m):m=t[23];let h;t[24]===n.baseBranch?h=t[25]:(h=(0,U.jsx)(`code`,{className:`truncate`,children:n.baseBranch}),t[24]=n.baseBranch,t[25]=h);let g;t[26]!==h||t[27]!==p?(g=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 text-secondary-label text-3xs`,children:[p,m,h]}),t[26]=h,t[27]=p,t[28]=g):g=t[28];let _;return t[29]!==g||t[30]!==s||t[31]!==d||t[32]!==f?(_=(0,U.jsxs)(`div`,{className:s,children:[d,f,g]}),t[29]=g,t[30]=s,t[31]=d,t[32]=f,t[33]=_):_=t[33],_}var d_=V.createContext(void 0);function f_(e){let t=V.useContext(d_);if(t===void 0&&!e)throw Error(Rt(50));return t}var p_={...pe,instantType:k(e=>e.instantType),hasViewport:k(e=>e.hasViewport)},m_=class e extends m{constructor(e,t,n=!1){let r=new oe,i={...h_(),...e};i.floatingRootContext=z(r,t,n),super(i,{popupRef:V.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:r,closeDelayRef:{current:300},inlineRectCoordsRef:{current:void 0}},p_)}setOpen=(e,t)=>{let n=t.reason,r=n===R,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;let o=t.event;e&&r&&t.trigger&&`clientX`in o&&`clientY`in o&&this.context.inlineRectCoordsRef.current?.element!==t.trigger&&Fi(this.context.inlineRectCoordsRef,t.trigger,o.clientX,o.clientY),this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let r={open:e};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0),Qe(r,e,t.trigger),this.update(r)};r?Li.flushSync(s):s()};static useStore(t,n){return Ke(t,(t,r)=>new e(n,t,r)).store}};function h_(){return{...Ce(),instantType:void 0,hasViewport:!1}}function g_(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,onOpenChangeComplete:i,actionsRef:a,handle:o,triggerId:s,defaultTriggerId:c=null,children:l}=e,u=m_.useStore(o?.store,{open:n,openProp:t,activeTriggerId:c,triggerIdProp:s});xe(()=>{t===void 0&&u.state.open===!1&&n===!0&&u.update({open:!0,activeTriggerId:c})}),u.useControlledProp(`openProp`,t),u.useControlledProp(`triggerIdProp`,s),u.useContextCallback(`onOpenChange`,r),u.useContextCallback(`onOpenChangeComplete`,i);let d=u.useState(`open`),f=u.useState(`activeTriggerId`),p=u.useState(`mounted`),m=u.useState(`payload`);le(u);let{forceUnmount:h}=Ye(d,u,()=>{u.context.inlineRectCoordsRef.current=void 0});te(()=>{d&&(f??u.set(`payload`,void 0))},[u,f,d]);let g=V.useCallback(()=>{u.setOpen(!1,_e(Oe))},[u]);V.useImperativeHandle(a,()=>({unmount:h,close:g}),[h,g]);let _=d||p;return(0,U.jsxs)(d_.Provider,{value:u,children:[_&&(0,U.jsx)(__,{store:u}),typeof l==`function`?l({payload:m}):l]})}function __({store:e}){let t=e.useState(`floatingRootContext`),n=g(t),r=n.reference??Ht,i=n.trigger??Ht,a=V.useMemo(()=>Bt(Ue,n.floating),[n.floating]);return P(e,{activeTriggerProps:r,inactiveTriggerProps:i,popupProps:a}),null}var v_=be(function(e){return f_(!0)?(0,U.jsx)(g_,{...e}):(0,U.jsx)($e,{children:(0,U.jsx)(g_,{...e})})}),y_=V.createContext(void 0);function b_(){let e=V.useContext(y_);if(e===void 0)throw Error(Rt(48));return e}var x_=V.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return f_().useState(`mounted`)||n?(0,U.jsx)(y_.Provider,{value:n,children:(0,U.jsx)(qt,{ref:t,...r})}):null}),S_=c(function(e,t){let{render:n,className:r,delay:i,closeDelay:a,id:o,payload:s,handle:c,style:l,...u}=e,d=f_(!0),p=c?.store??d;if(!p)throw Error(Rt(89));let m=O(o),h=p.useState(`isTriggerActive`,m),g=p.useState(`isOpenedByTrigger`,m),_=p.useState(`floatingRootContext`),v=p.context.inlineRectCoordsRef,y=V.useRef(null),b=i??600,x=a??300,{registerTrigger:S,isMountedByThisTrigger:C}=F(m,y,p,{payload:s});te(()=>{C&&(p.context.closeDelayRef.current=x)},[p,C,x]);let w=Se(_,{mouseOnly:!0,move:!1,handleClose:Ae(),delay:()=>({open:b,close:x}),triggerElementRef:y,isActiveTrigger:h,isClosing:()=>p.select(`transitionStatus`)===`ending`}),T=de(_,{delay:b}),E={open:g},D=p.useState(`triggerProps`,C),k=Pi(v,g);return Vt(`a`,e,{state:E,ref:[t,S,y],props:[w,T.reference,D,k,{id:m},u],stateAttributesMapping:f})}),C_=V.createContext(void 0);function w_(){let e=V.useContext(C_);if(e===void 0)throw Error(Rt(49));return e}var T_=V.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=x,style:_,...v}=e,b=f_(),S=b_(),C=d(),w=b.useState(`open`),T=b.useState(`mounted`),D=b.useState(`floatingRootContext`),O=b.useState(`instantType`),k=b.useState(`transitionStatus`),j=b.useState(`hasViewport`),N=b.context.inlineRectCoordsRef,P=y({anchor:i,floatingRootContext:D,positionMethod:a,mounted:T,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:p,collisionBoundary:u,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:S,nodeId:C,collisionAvoidance:g,adaptiveOrigin:j?E:void 0,inline:Ii(N)}),F=P.update;te(()=>{w&&T&&F()},[w,T,F]);let ee={open:w,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:O},ne=A(e,ee,{styles:P.positionerStyles,transitionStatus:k,props:v,refs:[t,b.useStateSetter(`positionerElement`)],hidden:!T,inert:!w});return(0,U.jsx)(C_.Provider,{value:P,children:(0,U.jsx)(M,{id:C,children:ne})})}),E_={...Xe,...ee},D_=V.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=f_(),{side:s,align:c}=w_(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`);We({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}});let m=re(()=>o.context.closeDelayRef.current);return Be(p,{closeDelay:m}),Vt(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[f,v(d),a],stateAttributesMapping:E_})}),O_=v_;function k_(e){let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=(0,U.jsx)(S_,{"data-slot":`preview-card-trigger`,...e}),t[0]=e,t[1]=n),n}function A_(e){let t=(0,H.c)(16),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,align:i,side:a,sideOffset:o,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?`start`:i,c=a===void 0?`top`:a,l=o===void 0?6:o,u;t[6]===n?u=t[7]:(u=B(`origin-(--transform-origin) rounded-lg border bg-popover text-popover-foreground shadow-lg outline-none transition-[scale,opacity] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0`,n),t[6]=n,t[7]=u);let d;t[8]!==r||t[9]!==u?(d=(0,U.jsx)(D_,{className:u,"data-slot":`preview-card-popup`,...r}),t[8]=r,t[9]=u,t[10]=d):d=t[10];let f;return t[11]!==s||t[12]!==c||t[13]!==l||t[14]!==d?(f=(0,U.jsx)(x_,{children:(0,U.jsx)(T_,{align:s,className:`z-[140] max-w-(--available-width)`,"data-slot":`preview-card-positioner`,side:c,sideOffset:l,children:d})}),t[11]=s,t[12]=c,t[13]=l,t[14]=d,t[15]=f):f=t[15],f}function j_(e){let t=(0,H.c)(36),{link:n,originalUrl:r,target:i,confirmBeforeOpen:a,onOpenPullRequest:o,onOpenFallback:s,fallback:c}=e,[l,u]=(0,V.useState)(!1),d=(0,V.useRef)(null),[f,p]=(0,V.useState)(!1),m;t[0]!==l||t[1]!==i?(m=l?hi.detail({environmentId:i.environmentId,input:i.input}):null,t[0]=l,t[1]=i,t[2]=m):m=t[2];let h=pn(m),g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g={reportFailure:!1,reportDefect:!1},t[3]=g):g=t[3];let _=br(hi.preview,g),v;t[4]!==a||t[5]!==n||t[6]!==s||t[7]!==o||t[8]!==r||t[9]!==_||t[10]!==f||t[11]!==i?(v=a===!0?(0,V.cloneElement)(n,{onClick:e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),e.stopPropagation(),!f&&(u(!1),p(!0),_(i).then(async e=>{vt(e)||e._tag===`Success`&&o?.(e.value.url)||await s?.(r)}).catch(M_).finally(()=>p(!1))))}}):n,t[4]=a,t[5]=n,t[6]=s,t[7]=o,t[8]=r,t[9]=_,t[10]=f,t[11]=i,t[12]=v):v=t[12];let y=v,b=h.data,x=b!==null||h.error!==null&&c!==void 0,S=l&&h.error!==null&&!x,C;t[13]===b?C=t[14]:(C=b===null?null:di({state:b.state,isDraft:b.isDraft}),t[13]=b,t[14]=C);let w=C,T=b?.author===null?`ghost`:b?.author.name&&b.author.name!==b.author.login?`${b.author.name} (@${b.author.login})`:b?.author.login??null,E;t[15]===x?E=t[16]:(E=e=>{!e&&!x&&d.current?.close()},t[15]=x,t[16]=E);let D;t[17]===y?D=t[18]:(D=(0,U.jsx)(k_,{render:(0,U.jsx)(tr,{render:y}),delay:350,closeDelay:120}),t[17]=y,t[18]=D);let O;t[19]===r?O=t[20]:(O=(0,U.jsx)(nr,{side:`top`,children:r}),t[19]=r,t[20]=O);let k;t[21]!==S||t[22]!==E||t[23]!==D||t[24]!==O?(k=(0,U.jsxs)(rr,{open:S,onOpenChange:E,children:[D,O]}),t[21]=S,t[22]=E,t[23]=D,t[24]=O,t[25]=k):k=t[25];let A;t[26]!==T||t[27]!==b||t[28]!==c||t[29]!==x||t[30]!==w?(A=x?(0,U.jsx)(A_,{align:`center`,className:`w-80 max-w-[calc(100vw-2rem)]`,children:(0,U.jsx)(`div`,{className:`p-3`,children:b===null?c:(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-2xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:b.repository}),(0,U.jsxs)(`span`,{className:`shrink-0`,children:[`#`,b.number]}),(0,U.jsx)(`span`,{"aria-hidden":!0,children:`·`}),w===null?null:(0,U.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1`,children:[(0,U.jsx)(w.Icon,{"aria-hidden":!0,className:`size-3 ${w.toneClassName}`}),w.label]})]}),(0,U.jsx)(`p`,{className:`mt-1 text-sm font-medium leading-snug text-foreground text-pretty`,children:b.title}),(0,U.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(Yr,{actor:b.author,className:`size-4`}),(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:T}),(0,U.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,U.jsxs)(`span`,{className:`shrink-0`,children:[`opened `,$n(b.createdAt)]})]})]})})}):null,t[26]=T,t[27]=b,t[28]=c,t[29]=x,t[30]=w,t[31]=A):A=t[31];let j;return t[32]!==l||t[33]!==k||t[34]!==A?(j=(0,U.jsxs)(O_,{open:l,onOpenChange:u,actionsRef:d,children:[k,A]}),t[32]=l,t[33]=k,t[34]=A,t[35]=j):j=t[35],j}function M_(e){console.error(`[pull-request-link-preview] failed to open link`,e)}var N_={open:`pr-open`,draft:`pr-draft`,merged:`pr-merged`,closed:`pr-closed`,unknown:`pull-request`};function P_(e){let t=(0,H.c)(20),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({icon:n,label:r,tooltip:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i.state===`unresolved`?`true`:void 0,s=a?0:void 0,c;t[5]===r?c=t[6]:(c=(0,U.jsx)(o_,{children:r}),t[5]=r,t[6]=c);let l;t[7]!==n||t[8]!==i||t[9]!==o||t[10]!==s||t[11]!==c?(l=(0,U.jsxs)(a_,{"data-context-unresolved":o,tabIndex:s,...i,children:[n,c]}),t[7]=n,t[8]=i,t[9]=o,t[10]=s,t[11]=c,t[12]=l):l=t[12];let u=l;if(!a)return u;let d;t[13]===u?d=t[14]:(d=(0,U.jsx)(tr,{render:u}),t[13]=u,t[14]=d);let f;t[15]===a?f=t[16]:(f=(0,U.jsx)(nr,{side:`top`,className:`whitespace-pre-wrap`,children:a}),t[15]=a,t[16]=f);let p;return t[17]!==d||t[18]!==f?(p=(0,U.jsxs)(rr,{children:[d,f]}),t[17]=d,t[18]=f,t[19]=p):p=t[19],p}function F_(e){let t=(0,H.c)(19),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,U.jsx)(`button`,{type:`button`}),t[0]=n):n=t[0];let r=`${e.accessibleLabel}. Show details`,i;t[1]!==e.copyMarkdown||t[2]!==e.kind||t[3]!==r?(i=(0,U.jsx)(a_,{kind:e.kind,render:n,"aria-label":r,"data-markdown-copy":e.copyMarkdown}),t[1]=e.copyMarkdown,t[2]=e.kind,t[3]=r,t[4]=i):i=t[4];let a;t[5]===e.label?a=t[6]:(a=(0,U.jsx)(o_,{children:e.label}),t[5]=e.label,t[6]=a);let o;t[7]!==e.icon||t[8]!==i||t[9]!==a?(o=(0,U.jsxs)(mr,{render:i,children:[e.icon,a]}),t[7]=e.icon,t[8]=i,t[9]=a,t[10]=o):o=t[10];let s;t[11]===e.accessibleLabel?s=t[12]:(s=(0,U.jsx)(dr,{className:`sr-only`,children:e.accessibleLabel}),t[11]=e.accessibleLabel,t[12]=s);let c;t[13]!==e.children||t[14]!==s?(c=(0,U.jsxs)(fr,{side:`top`,width:`lg`,padding:`compact`,children:[s,e.children]}),t[13]=e.children,t[14]=s,t[15]=c):c=t[15];let l;return t[16]!==o||t[17]!==c?(l=(0,U.jsxs)(hr,{children:[o,c]}),t[16]=o,t[17]=c,t[18]=l):l=t[18],l}function I_(e){let t=(0,H.c)(28),n=Zr(e.environmentId,e.metadata.url),r=e.metadata.state===`open`&&e.metadata.isDraft?`draft`:e.metadata.state,i=mi[r].Icon,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,U.jsx)(`button`,{type:`button`}),t[0]=a):a=t[0];let o=`Open ${e.kindLabel} ${e.label}: ${e.metadata.title}`,s;t[1]===e?s=t[2]:(s=t=>e.onOpen(t,e.metadata.url),t[1]=e,t[2]=s);let c;t[3]===i?c=t[4]:(c=(0,U.jsx)(i,{}),t[3]=i,t[4]=c);let l;t[5]===e.label?l=t[6]:(l=(0,U.jsx)(o_,{children:e.label}),t[5]=e.label,t[6]=l);let u;t[7]!==e.copyMarkdown||t[8]!==e.kind||t[9]!==o||t[10]!==s||t[11]!==c||t[12]!==l?(u=(0,U.jsxs)(a_,{kind:e.kind,render:a,"aria-label":o,"data-markdown-copy":e.copyMarkdown,onClick:s,children:[c,l]}),t[7]=e.copyMarkdown,t[8]=e.kind,t[9]=o,t[10]=s,t[11]=c,t[12]=l,t[13]=u):u=t[13];let d=u;if(n!==null){let r;t[14]===e.metadata?r=t[15]:(r=(0,U.jsx)(u_,{metadata:e.metadata}),t[14]=e.metadata,t[15]=r);let i;return t[16]!==d||t[17]!==n||t[18]!==e.metadata.url||t[19]!==r?(i=(0,U.jsx)(j_,{link:d,originalUrl:e.metadata.url,target:n,confirmBeforeOpen:!1,fallback:r}),t[16]=d,t[17]=n,t[18]=e.metadata.url,t[19]=r,t[20]=i):i=t[20],i}let f;t[21]===d?f=t[22]:(f=(0,U.jsx)(tr,{render:d}),t[21]=d,t[22]=f);let p;t[23]===e.metadata?p=t[24]:(p=(0,U.jsx)(nr,{side:`top`,children:(0,U.jsx)(u_,{metadata:e.metadata})}),t[23]=e.metadata,t[24]=p);let m;return t[25]!==f||t[26]!==p?(m=(0,U.jsxs)(rr,{children:[f,p]}),t[25]=f,t[26]=p,t[27]=m):m=t[27],m}function L_(e){try{let t=document.createElement(`canvas`);t.width=t.height=16;let n=t.getContext(`2d`);if(!n)return;n.drawImage(e,0,0,16,16);let{data:r}=n.getImageData(0,0,16,16),i=0,a=0,o=0,s=0;for(let e=0;e<r.length;e+=4){let t=r[e+3];i+=r[e]*t,a+=r[e+1]*t,o+=r[e+2]*t,s+=t}return s===0?void 0:`rgb(${Math.round(i/s)} ${Math.round(a/s)} ${Math.round(o/s)})`}catch{return}}function R_(e){let t=(0,H.c)(32),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({name:n,previewUrl:r,size:a,suffix:s,style:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let[c,l]=(0,V.useState)(),[u,d]=(0,V.useState)(),f=c?.url===r?c?.color:void 0,p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,U.jsx)(`button`,{type:`button`}),t[7]=p):p=t[7];let m=`Image attachment, ${n}, ${a}`,h;t[8]===f?h=t[9]:(h=f?{"--context-chip-accent":f}:{},t[8]=f,t[9]=h);let g;t[10]!==o||t[11]!==h?(g={...o,...h},t[10]=o,t[11]=h,t[12]=g):g=t[12];let _=g,v;t[13]!==u||t[14]!==r?(v=r?(0,U.jsx)(`img`,{crossOrigin:u===r?void 0:`anonymous`,src:r,alt:``,className:`size-[1.17em] shrink-0 rounded-sm object-cover`,onError:()=>d(r),onLoad:e=>l({url:r,color:L_(e.currentTarget)})},r):(0,U.jsx)(T,{}),t[13]=u,t[14]=r,t[15]=v):v=t[15];let y;t[16]===n?y=t[17]:(y=l_(n),t[16]=n,t[17]=y);let b;t[18]===y?b=t[19]:(b=(0,U.jsx)(o_,{className:`max-w-72`,children:y}),t[18]=y,t[19]=b);let x;t[20]===a?x=t[21]:(x=(0,U.jsx)(`span`,{className:`shrink-0 text-3xs text-current`,children:a}),t[20]=a,t[21]=x);let S;t[22]===s?S=t[23]:(S=s?(0,U.jsx)(`span`,{className:`text-3xs text-current`,children:s}):null,t[22]=s,t[23]=S);let C;return t[24]!==i||t[25]!==S||t[26]!==m||t[27]!==_||t[28]!==v||t[29]!==b||t[30]!==x?(C=(0,U.jsxs)(a_,{kind:`image`,render:p,"aria-label":m,style:_,...i,children:[v,b,x,S]}),t[24]=i,t[25]=S,t[26]=m,t[27]=_,t[28]=v,t[29]=b,t[30]=x,t[31]=C):C=t[31],C}function z_(e){let t=(0,H.c)(23),n;t[0]===e?n=t[1]:(n=(0,U.jsx)(B_,{...e}),t[0]=e,t[1]=n);let r=n,i=e.unresolved?`unresolved`:e.error?`invalid`:null,a=e.isVideo?`video`:`file`,o;t[2]===i?o=t[3]:(o=i?{state:i}:{},t[2]=i,t[3]=o);let s;t[4]!==e.accessibleLabel||t[5]!==e.suffix?(s=[e.accessibleLabel,e.suffix].filter(Boolean),t[4]=e.accessibleLabel,t[5]=e.suffix,t[6]=s):s=t[6];let c=s.join(`, `),l=e.unresolved?`true`:void 0,u;t[7]!==e.copyMarkdown||t[8]!==a||t[9]!==o||t[10]!==c||t[11]!==l?(u={kind:a,...o,"aria-label":c,"data-markdown-copy":e.copyMarkdown,"data-context-unresolved":l},t[7]=e.copyMarkdown,t[8]=a,t[9]=o,t[10]=c,t[11]=l,t[12]=u):u=t[12];let d=u,f;t[13]!==d||t[14]!==r||t[15]!==e.disabled||t[16]!==e.onOpen?(f=(0,U.jsx)(tr,{render:e.onOpen?(0,U.jsx)(a_,{render:(0,U.jsx)(`button`,{type:`button`,disabled:e.disabled}),onClick:e.onOpen,...d,children:r}):(0,U.jsx)(a_,{tabIndex:0,...d,children:r})}),t[13]=d,t[14]=r,t[15]=e.disabled,t[16]=e.onOpen,t[17]=f):f=t[17];let p;t[18]===e.tooltip?p=t[19]:(p=(0,U.jsx)(nr,{side:`top`,className:`whitespace-pre-wrap`,children:e.tooltip}),t[18]=e.tooltip,t[19]=p);let m;return t[20]!==f||t[21]!==p?(m=(0,U.jsxs)(rr,{children:[f,p]}),t[20]=f,t[21]=p,t[22]=m):m=t[22],m}function B_(e){let t=(0,H.c)(17),n;t[0]!==e.isVideo||t[1]!==e.name||t[2]!==e.theme?(n=e.isVideo?(0,U.jsx)(se,{}):(0,U.jsx)(Nr,{pathValue:e.name,kind:`file`,theme:e.theme}),t[0]=e.isVideo,t[1]=e.name,t[2]=e.theme,t[3]=n):n=t[3];let r;t[4]===e.name?r=t[5]:(r=l_(e.name),t[4]=e.name,t[5]=r);let i;t[6]===r?i=t[7]:(i=(0,U.jsx)(o_,{className:`max-w-72`,children:r}),t[6]=r,t[7]=i);let a;t[8]===e.size?a=t[9]:(a=(0,U.jsx)(`span`,{className:`shrink-0 text-3xs text-current`,children:e.size}),t[8]=e.size,t[9]=a);let o;t[10]===e.suffix?o=t[11]:(o=e.suffix?(0,U.jsx)(`span`,{className:`text-3xs text-current`,children:e.suffix}):null,t[10]=e.suffix,t[11]=o);let s;return t[12]!==n||t[13]!==i||t[14]!==a||t[15]!==o?(s=(0,U.jsxs)(U.Fragment,{children:[n,i,a,o]}),t[12]=n,t[13]=i,t[14]=a,t[15]=o,t[16]=s):s=t[16],s}function V_(e){let t=(0,H.c)(6),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,U.jsx)(et,{}),t[0]=n):n=t[0];let r=`Unavailable context, ${e.label}`,i;return t[1]!==e.copyMarkdown||t[2]!==e.label||t[3]!==e.tooltip||t[4]!==r?(i=(0,U.jsx)(P_,{icon:n,label:e.label,state:`unresolved`,"aria-label":r,"data-markdown-copy":e.copyMarkdown,tooltip:e.tooltip}),t[1]=e.copyMarkdown,t[2]=e.label,t[3]=e.tooltip,t[4]=r,t[5]=i):i=t[5],i}function H_(e){let t=(0,H.c)(38),{citation:n,inputRef:r,onSubmit:i,onSubmitAndSend:a,onCancel:o,onDraftChange:s}=e,[c,l]=(0,V.useState)(n.comment??``),u=c.length>ct,d;t[0]!==c||t[1]!==u||t[2]!==i?(d=()=>{u||i(c)},t[0]=c,t[1]=u,t[2]=i,t[3]=d):d=t[3];let f=d,p;t[4]!==c||t[5]!==u||t[6]!==i||t[7]!==a?(p=()=>{u||(a?a(c):i(c))},t[4]=c,t[5]=u,t[6]=i,t[7]=a,t[8]=p):p=t[8];let m=p,h;t[9]===o?h=t[10]:(h=e=>{e.stopPropagation(),!(e.nativeEvent.isComposing||e.keyCode===229)&&e.key===`Escape`&&(e.preventDefault(),o())},t[9]=o,t[10]=h);let g=u||void 0,_;t[11]===s?_=t[12]:(_=e=>{l(e.currentTarget.value),s?.(e.currentTarget.value)},t[11]=s,t[12]=_);let v;t[13]!==f||t[14]!==m?(v=e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&e.keyCode!==229&&(e.preventDefault(),e.metaKey||e.ctrlKey?m():f())},t[13]=f,t[14]=m,t[15]=v):v=t[15];let y;t[16]!==c||t[17]!==r||t[18]!==g||t[19]!==_||t[20]!==v?(y=(0,U.jsx)(`textarea`,{ref:r,"aria-label":`Comment on selected text`,"aria-description":`Enter to save the citation comment; Command/Ctrl+Enter to save and send; Shift+Enter for a new line.`,"aria-invalid":g,placeholder:`Add an optional comment...`,rows:2,className:`field-sizing-content block max-h-40 min-h-16 w-full resize-none bg-transparent px-1 py-1.5 text-base outline-none placeholder:text-muted-foreground sm:text-sm`,value:c,onChange:_,onKeyDown:v}),t[16]=c,t[17]=r,t[18]=g,t[19]=_,t[20]=v,t[21]=y):y=t[21];let b;t[22]===u?b=t[23]:(b=u?(0,U.jsxs)(`p`,{role:`status`,className:`pt-1 text-xs text-destructive`,children:[`Comments can contain up to `,ct.toLocaleString(),` `,`characters.`]}):null,t[22]=u,t[23]=b);let x;t[24]===o?x=t[25]:(x=(0,U.jsx)(we,{variant:`outline`,size:`xs`,onPointerDown:W_,onClick:o,children:`Cancel`}),t[24]=o,t[25]=x);let S=u?`Shorten comment`:`Save`,C;t[26]!==u||t[27]!==f||t[28]!==S?(C=(0,U.jsx)(we,{size:`xs`,disabled:u,onPointerDown:U_,onClick:f,children:S}),t[26]=u,t[27]=f,t[28]=S,t[29]=C):C=t[29];let w;t[30]!==C||t[31]!==x?(w=(0,U.jsxs)(`div`,{className:`mt-2 flex items-center justify-end gap-2`,children:[x,C]}),t[30]=C,t[31]=x,t[32]=w):w=t[32];let T;return t[33]!==w||t[34]!==h||t[35]!==y||t[36]!==b?(T=(0,U.jsxs)(`div`,{"data-citation-comment-editor":`true`,onKeyDown:h,children:[y,b,w]}),t[33]=w,t[34]=h,t[35]=y,t[36]=b,t[37]=T):T=t[37],T}function U_(e){return e.preventDefault()}function W_(e){return e.preventDefault()}function G_({reason:e,draft:t,savedComment:n}){return e===`escape-key`||t===null||t.trim()===(n??``).trim()?{kind:`close`}:t.length>8e3?{kind:`keep-open`}:{kind:`commit`,comment:t}}var K_=650,q_=3e3,J_=`--assistant-citation-highlight-opacity`,Y_=.45,X_=`p4-assistant-citation-comment`;function Z_({anchor:e,citation:t,onUnavailable:n}){let{source:r,range:i,viewport:a}=e,o=typeof CSS<`u`?CSS.highlights:void 0,s=null,c=!1,l=new MutationObserver(e=>{if(c)return;let t=e.some(e=>r.contains(e.target));f(t)}),u=()=>{c||(c=!0,l.disconnect(),s&&(s.delete(i),s.size===0&&o?.get(X_)===s&&o.delete(X_)))},d=()=>{c||(u(),n())},f=e=>{if(!r.isConnected||!a.contains(r))return d(),!1;if(e||i.collapsed||!r.contains(i.startContainer)||!r.contains(i.endContainer)){let e=r_(r,t);if(!e)return d(),!1;i.setStart(e.startContainer,e.startOffset),i.setEnd(e.endContainer,e.endOffset)}return!0};if(!f(!1))return u;if(typeof Highlight<`u`&&o){let e=o.get(X_);s=e??new Highlight,s.add(i),e||o.set(X_,s)}return l.observe(a,{childList:!0,subtree:!0,characterData:!0}),u}function Q_({root:e,itemKey:t,request:n,list:r}){let i=n.activationRef.current;if(i.dismissed)return;let a=r.getScrollableNode();if(!(a instanceof HTMLElement))return;let o=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,s=null,c=null,l=null,u=null,d=!1,f=!1,p=null,m=!i.scrolled,h=e=>l!==null&&e?.rangeCount===1&&e.getRangeAt(0)===l.range&&l.range.startContainer===l.snapshot.startContainer&&l.range.startOffset===l.snapshot.startOffset&&l.range.endContainer===l.snapshot.endContainer&&l.range.endOffset===l.snapshot.endOffset,g=()=>{s&&CSS.highlights.get(`p4-assistant-citation`)===s&&CSS.highlights.delete(`p4-assistant-citation`),s=null,c=null;let t=l?e.ownerDocument.getSelection():null;l&&h(t)&&t?.removeRange(l.range),l=null,delete e.dataset.citationHighlighted},_=()=>{f||(i.dismissed=!0,T())},v=()=>{if(u=null,f||i.dismissed||!e.isConnected||!a.contains(e)){g();return}if(i.pulse&&performance.now()-i.pulse.startedAt>=q_){_();return}let v=r.getState(),b=v.indexByKey(t);if(b===void 0||!(v.sizeAtIndex(b)>0))return;let x=r_(e,n.citation),S=(x??e).getBoundingClientRect();if(S.height<=0||a.clientHeight<=0)g();else{if(!i.scrolled){if(d)return;let e=a.getBoundingClientRect(),t=Math.max(0,Math.min(a.scrollHeight-a.clientHeight,v.scroll+S.top-e.top-Math.min(120,a.clientHeight/3)));if(Math.abs(t-v.scroll)>1){d=!0,r.scrollToOffset({offset:t,animated:!o}).then(()=>{d=!1,!f&&!i.dismissed&&y()},()=>{d=!1,!(f||i.dismissed)&&(i.dismissed=!0,g(),n.onComplete(),Qt.add({type:`warning`,title:`Could not open the cited response`,description:`Click the citation to try again.`}))});return}if(S.bottom<=e.top||S.top>=e.bottom)return;i.scrolled=!0,n.onComplete(),x||Qt.add({type:`warning`,title:`The quoted text has changed`,description:`Showing the source response. The saved quote is unchanged.`})}if(!x)_();else{if(typeof Highlight<`u`&&typeof CSS<`u`&&CSS.highlights)s=new Highlight(x),CSS.highlights.set(`p4-assistant-citation`,s),c=x,e.dataset.citationHighlighted=`true`;else{let t=e.ownerDocument.getSelection();if(t&&(m||h(t)))t.removeAllRanges(),t.addRange(x),l={range:t.getRangeAt(0),snapshot:x.cloneRange()},m=!1,c=x,e.dataset.citationHighlighted=`true`;else{_();return}}if(!p){let t=i.pulse??={startedAt:performance.now(),reducedMotion:o},n=e=>e/q_,r=n(2550);p=e.animate(t.reducedMotion?[{offset:0,[J_]:Y_},{offset:r,[J_]:Y_},{offset:1,[J_]:0}]:[{offset:0,[J_]:0},{offset:n(K_*.5),[J_]:Y_},{offset:n(K_),[J_]:0},{offset:n(K_*1.5),[J_]:Y_},{offset:r,[J_]:Y_},{offset:1,[J_]:0}],{duration:q_,easing:`ease-in-out`}),p.id=`p4-assistant-citation-pulse`,p.currentTime=Math.max(0,performance.now()-t.startedAt),p.finished.then(_,()=>{})}}}},y=()=>{u!==null&&cancelAnimationFrame(u),u=requestAnimationFrame(v)},b=new MutationObserver(t=>{let n=c!==null&&(c.collapsed||!e.contains(c.startContainer)||!e.contains(c.endContainer));n&&(m||=l!==null&&h(e.ownerDocument.getSelection()),g()),(n||t.some(t=>e.contains(t.target)||[...t.addedNodes,...t.removedNodes].some(t=>t.contains(e))))&&y()});b.observe(a,{childList:!0,characterData:!0,subtree:!0});let x=gr([e,a],y),S=r.getState(),C=[S.listenToPosition(t,y),S.listen(`totalSize`,y),S.listen(`headerSize`,y)],w=()=>{d&&(d=!1,r.scrollToOffset({get offset(){return a.scrollTop},animated:!1}))};i.cancelScroll=w,y();let T=()=>{if(!f){f=!0,w(),p?.cancel(),u!==null&&cancelAnimationFrame(u),b.disconnect(),x();for(let e of C)e();i.cancelScroll===w&&delete i.cancelScroll,g()}};return T}function $_(e){let t=(0,H.c)(11),{messageId:n,threadRef:r,itemKey:i,request:a,listRef:o,children:s}=e,c=(0,V.useRef)(null),l,u;t[0]!==i||t[1]!==o||t[2]!==n||t[3]!==a?(l=()=>{let e=c.current,t=o.current;if(e&&t&&a&&a.citation.messageId===n)return Q_({root:e,itemKey:i,request:a,list:t})},u=[i,o,n,a],t[0]=i,t[1]=o,t[2]=n,t[3]=a,t[4]=l,t[5]=u):(l=t[4],u=t[5]),(0,V.useEffect)(l,u);let d=r?.environmentId,f=r?.threadId,p;return t[6]!==s||t[7]!==n||t[8]!==d||t[9]!==f?(p=(0,U.jsx)(`div`,{ref:c,"data-assistant-citation-source":n,"data-assistant-citation-environment":d,"data-assistant-citation-thread":f,children:s}),t[6]=s,t[7]=n,t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function ev(e){let t=(0,H.c)(77),{citation:n,composer:r,commentEditor:i}=e,a=r!==void 0&&r,o=Zt(),s=(0,V.useRef)(null),c=(0,V.useRef)(null),l=(0,V.useRef)(null),[u,d]=(0,V.useState)(null),f=i?.open??!1,p=i?.sourceAnchor,m=p===u?void 0:p,h,g;t[0]===f?(h=t[1],g=t[2]):(h=()=>{f||(l.current=null)},g=[f],t[0]=f,t[1]=h,t[2]=g),(0,V.useEffect)(h,g);let _;t[3]!==n.comment||t[4]!==i?(_=e=>{let t=G_({reason:e,draft:l.current,savedComment:n.comment});return t.kind===`commit`?i?.onSave(t.comment)??!0:t.kind!==`keep-open`},t[3]=n.comment,t[4]=i,t[5]=_):_=t[5];let v=_,y;t[6]!==i||t[7]!==v||t[8]!==p?(y=()=>{p&&(v(`none`)?i?.onOpenChange(!1):d(p))},t[6]=i,t[7]=v,t[8]=p,t[9]=y):y=t[9];let b=(0,V.useEffectEvent)(y),x;t[10]!==n||t[11]!==f||t[12]!==b||t[13]!==p||t[14]!==u?(x=()=>{if(!f||p===u)return;let e=p??Hg(document,n);if(e)return Z_({anchor:e,citation:n,onUnavailable:b})},t[10]=n,t[11]=f,t[12]=b,t[13]=p,t[14]=u,t[15]=x):x=t[15];let S;t[16]!==n||t[17]!==f||t[18]!==p||t[19]!==u?(S=[n,f,p,u],t[16]=n,t[17]=f,t[18]=p,t[19]=u,t[20]=S):S=t[20],(0,V.useEffect)(x,S);let C;t[21]===m?C=t[22]:(C=m?{contextElement:m.source,getBoundingClientRect:()=>{let e=m.range.getClientRects(),t=e.item(e.length-1)??m.range.getBoundingClientRect(),n=m.source.getBoundingClientRect(),r=Math.min(Math.max(t.left,n.left),n.right),i=Math.max(Math.min(t.right,n.right),r);return new DOMRect(r,t.top,i-r,t.height)}}:void 0,t[21]=m,t[22]=C);let w=C,T;t[23]===n?T=t[24]:(T=$r(n),t[23]=n,t[24]=T);let E=T,D;t[25]!==n.environmentId||t[26]!==n.threadId?(D={environmentId:n.environmentId,threadId:n.threadId},t[25]=n.environmentId,t[26]=n.threadId,t[27]=D):D=t[27];let O;t[28]===n?O=t[29]:(O=Vr(n),t[28]=n,t[29]=O);let k;t[30]===n?k=t[31]:(k=Rr(n),t[30]=n,t[31]=k);let A;t[32]!==n||t[33]!==o?(A=e=>{e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),o(ei(n)))},t[32]=n,t[33]=o,t[34]=A):A=t[34];let j;t[35]!==D||t[36]!==O||t[37]!==k||t[38]!==A?(j={to:`/$environmentId/$threadId`,params:D,hash:O,"data-markdown-copy":k,resetScroll:!1,onClick:A},t[35]=D,t[36]=O,t[37]=k,t[38]=A,t[39]=j):j=t[39];let M=j,N=`View cited assistant text: ${E}`,P;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,U.jsx)(De,{"aria-hidden":`true`}),t[40]=P):P=t[40];let F;t[41]===E?F=t[42]:(F=(0,U.jsx)(o_,{className:`max-w-[16em]`,children:E}),t[41]=E,t[42]=F);let ee;t[43]!==M||t[44]!==N||t[45]!==F?(ee=(0,U.jsxs)(Xt,{...M,className:`inline-flex h-full min-w-0 items-center gap-[0.33em] rounded-sm text-inherit no-underline focus-visible:outline-2 focus-visible:outline-foreground`,"aria-label":N,children:[P,F]}),t[43]=M,t[44]=N,t[45]=F,t[46]=ee):ee=t[46];let te=ee;if(!a){let e;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(De,{}),t[47]=e):e=t[47];let r=`Quoted assistant text: ${E}`,i;t[48]===n?i=t[49]:(i=Rr(n),t[48]=n,t[49]=i);let a;t[50]===n?a=t[51]:(a=(0,U.jsx)(nv,{citation:n}),t[50]=n,t[51]=a);let o;t[52]===M?o=t[53]:(o=(0,U.jsx)(we,{variant:`outline`,size:`sm`,render:(0,U.jsx)(Xt,{...M})}),t[52]=M,t[53]=o);let s;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,U.jsx)(Ne,{"aria-hidden":`true`}),t[54]=s):s=t[54];let c;t[55]===o?c=t[56]:(c=(0,U.jsxs)(pr,{render:o,children:[s,`Go to source`]}),t[55]=o,t[56]=c);let l;t[57]!==a||t[58]!==c?(l=(0,U.jsxs)(`div`,{className:`flex max-h-[calc(var(--available-height)_-_1rem_-_2px)] flex-col items-start gap-3 p-1 text-sm`,children:[a,c]}),t[57]=a,t[58]=c,t[59]=l):l=t[59];let u;return t[60]!==E||t[61]!==r||t[62]!==i||t[63]!==l?(u=(0,U.jsx)(F_,{kind:`citation`,icon:e,label:E,accessibleLabel:r,copyMarkdown:i,children:l}),t[60]=E,t[61]=r,t[62]=i,t[63]=l,t[64]=u):u=t[64],u}let re;t[65]===n?re=t[66]:(re=Rr(n),t[65]=n,t[66]=re);let ie;t[67]!==m||t[68]!==n||t[69]!==i||t[70]!==w||t[71]!==v?(ie=i?(0,U.jsxs)(hr,{open:i.open,onOpenChange:(e,t)=>{!e&&!v(t.reason)?t.cancel():i.onOpenChange(e)},children:[(0,U.jsx)(mr,{"aria-label":n.comment?`Edit citation comment`:`Add comment to citation`,"data-citation-comment-trigger":`true`,render:(0,U.jsx)(s_,{}),children:(0,U.jsx)(ne,{"aria-hidden":`true`})}),i.open?(0,U.jsx)(fr,{...Ve,side:m?`bottom`:`top`,align:`end`,anchor:w,initialFocus:()=>{let e=s.current;return e&&(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length),e.scrollTop=e.scrollHeight),!1},finalFocus:i.onRestoreFocus?()=>{let e=document.activeElement;return(e===document.body||e!==null&&c.current?.contains(e))&&i.onRestoreFocus?.(),!1}:void 0,ref:c,"aria-label":`Edit citation comment`,width:`md`,padding:`compact`,onPointerDown:tv,children:(0,U.jsx)(H_,{citation:n,inputRef:s,onDraftChange:e=>{l.current=e,i.onDraftChange?.(e)},onSubmit:e=>i.onSave(e)?(i.onOpenChange(!1),!0):!1,...i.onSaveAndSend?{onSubmitAndSend:e=>i.onSaveAndSend?.(e)?(i.onOpenChange(!1),!0):!1}:{},onCancel:()=>{i.onCancel?i.onCancel():i.onOpenChange(!1)}},Rr(n))}):null]}):null,t[67]=m,t[68]=n,t[69]=i,t[70]=w,t[71]=v,t[72]=ie):ie=t[72];let I;return t[73]!==te||t[74]!==re||t[75]!==ie?(I=(0,U.jsxs)(a_,{kind:`citation`,contentEditable:!1,"data-assistant-citation-chip":`true`,"data-markdown-copy":re,children:[te,ie]}),t[73]=te,t[74]=re,t[75]=ie,t[76]=I):I=t[76],I}function tv(e){return e.stopPropagation()}function nv(e){let t=(0,H.c)(14),{citation:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={top:!1,bottom:!1},t[0]=r):r=t[0];let[i,a]=(0,V.useState)(r),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{let t=e.scrollTop>1,n=e.scrollHeight-e.clientHeight-e.scrollTop>1;a(e=>e.top===t&&e.bottom===n?e:{top:t,bottom:n})},t[1]=o):o=t[1];let s=o,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>e?gr(e,()=>s(e)):void 0,t[2]=c):c=t[2];let l=c,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>s(e.currentTarget),t[3]=u):u=t[3];let d;t[4]===i?d=t[5]:(d=B(`max-h-64 min-h-0 space-y-3 self-stretch overflow-y-auto whitespace-pre-wrap wrap-break-word`,or(i)),t[4]=i,t[5]=d);let f;t[6]===n.text?f=t[7]:(f=(0,U.jsx)(`blockquote`,{className:`border-l-2 border-border pl-3 text-muted-foreground`,children:n.text}),t[6]=n.text,t[7]=f);let p;t[8]===n.comment?p=t[9]:(p=n.comment?(0,U.jsx)(`p`,{children:n.comment}):null,t[8]=n.comment,t[9]=p);let m;return t[10]!==d||t[11]!==f||t[12]!==p?(m=(0,U.jsxs)(`div`,{ref:l,onScroll:u,className:d,children:[f,p]}),t[10]=d,t[11]=f,t[12]=p,t[13]=m):m=t[13],m}function rv(e){let t=(0,H.c)(36),n=e.link.environmentId??e.environmentId,r=bm(e.link.threadId),i;t[0]!==n||t[1]!==e.link.threadId?(i=I(n,e.link.threadId),t[0]=n,t[1]=e.link.threadId,t[2]=i):i=t[2];let a=Pt(i),o=Pt(a===null&&r!==null?I(n,r):null),s=a??o,c=s===null&&e.link.environmentId===null,l=Mt(c),u;t[3]!==c||t[4]!==e.link||t[5]!==l?(u=c?xm(e.link,l):null,t[3]=c,t[4]=e.link,t[5]=l,t[6]=u):u=t[6];let d=Pt(u),f=s??d,p=f?.environmentId??n,m=f?.id??e.link.threadId,h;t[7]!==p||t[8]!==f?(h=f===null?null:C(p,f.projectId),t[7]=p,t[8]=f,t[9]=h):h=t[9];let g=Ft(h),_;t[10]!==e.environmentId||t[11]!==e.link?(_=wm(e.link,e.environmentId),t[10]=e.environmentId,t[11]=e.link,t[12]=_):_=t[12];let v=_,y;t[13]!==e.label||t[14]!==f||t[15]!==m||t[16]!==v?(y=f?.title.trim()||e.label||(f===null?v:m),t[13]=e.label,t[14]=f,t[15]=m,t[16]=v,t[17]=y):y=t[17];let b=y,x;t[18]!==p||t[19]!==m?(x={environmentId:p,threadId:m},t[18]=p,t[19]=m,t[20]=x):x=t[20];let S=f===null?v:g?.title,w;t[21]!==p||t[22]!==e.label||t[23]!==e.link||t[24]!==f||t[25]!==m||t[26]!==b?(w=f===null?Cm(e.link,e.label??void 0):Cm({environmentId:p,threadId:m},b),t[21]=p,t[22]=e.label,t[23]=e.link,t[24]=f,t[25]=m,t[26]=b,t[27]=w):w=t[27];let T;t[28]===g?T=t[29]:(T=(0,U.jsx)(`span`,{className:`ms-[0.25em] me-[0.2em] inline-flex size-[14px] [vertical-align:-0.125em]`,"aria-hidden":!0,children:g===null?(0,U.jsx)(ce,{className:`block size-full shrink-0`}):(0,U.jsx)(gi,{project:g,className:`size-full`})}),t[28]=g,t[29]=T);let E;return t[30]!==x||t[31]!==S||t[32]!==w||t[33]!==T||t[34]!==b?(E=(0,U.jsxs)(Xt,{to:`/$environmentId/$threadId`,params:x,title:S,"data-markdown-copy":w,children:[T,b]}),t[30]=x,t[31]=S,t[32]=w,t[33]=T,t[34]=b,t[35]=E):E=t[35],E}function iv(e){return e.displayName?.trim()||e.name}var av=/(^|\s)\p{Sc}(?![0-9][0-9_]*(?:[kKmMbBtT]|[eE][0-9]+)?(?:\s|$))(?=[a-zA-Z0-9:_-]*[a-zA-Z])([a-zA-Z0-9][a-zA-Z0-9:_-]*)(?=\s|$)/gu;function*ov(e,t){let n=new Map;for(let r of e.matchAll(av)){let e=r[2]??``;n.has(e)||n.set(e,t.find(t=>t.name===e));let i=n.get(e);i&&(yield{start:r.index+(r[1]?.length??0),end:r.index+r[0].length,skill:i,rawText:`$${e}`})}}function sv(e){let t=(0,H.c)(6),n,r;if(t[0]!==e.skills||t[1]!==e.text){r=Symbol.for(`react.early_return_sentinel`);bb0:{let i=[],a=0;for(let{start:t,end:n,skill:r,rawText:o}of ov(e.text,e.skills))t>a&&i.push(e.text.slice(a,t)),i.push((0,U.jsx)(lv,{skill:r,rawText:o},`${t}:${r.name}`)),a=n;if(a===0){let n;t[4]===e.text?n=t[5]:(n=(0,U.jsx)(U.Fragment,{children:e.text}),t[4]=e.text,t[5]=n),r=n;break bb0}a<e.text.length&&i.push(e.text.slice(a)),n=(0,U.jsx)(U.Fragment,{children:i})}t[0]=e.skills,t[1]=e.text,t[2]=n,t[3]=r}else n=t[2],r=t[3];return r===Symbol.for(`react.early_return_sentinel`)?n:r}function cv(e,t){return V.Children.map(e,e=>{if(typeof e==`string`)return(0,U.jsx)(sv,{text:e,skills:t});if(!(0,V.isValidElement)(e))return e;let n=typeof e.type==`string`?e.type:e.props.node?.tagName;return n===`code`||n===`a`||!(`children`in e.props)?e:(0,V.cloneElement)(e,void 0,cv(e.props.children,t))})}function lv(e){let t=(0,H.c)(8),n=e.rawText,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,U.jsx)(uv,{}),t[0]=r):r=t[0];let i;t[1]===e.skill?i=t[2]:(i=iv(e.skill),t[1]=e.skill,t[2]=i);let a;t[3]===i?a=t[4]:(a=(0,U.jsx)(o_,{children:i}),t[3]=i,t[4]=a);let o;return t[5]!==e.rawText||t[6]!==a?(o=(0,U.jsxs)(a_,{kind:`skill`,"data-markdown-copy":n,children:[r,a]}),t[5]=e.rawText,t[6]=a,t[7]=o):o=t[7],o}function uv(){let e=(0,H.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`contents`,dangerouslySetInnerHTML:{__html:c_}}),e[0]=t):t=e[0],t}var dv=(0,V.lazy)(()=>r(()=>import(`./MathTypeset-TM-3r0WA.js`),__vite__mapDeps([0,1,2,3,4]))),fv=(0,V.memo)(function(e){let t=(0,H.c)(34),n=(0,V.useRef)(null),r=(0,V.useRef)(null),[i,a]=(0,V.useState)(!1),o,s;t[0]===e.focusable?(o=t[1],s=t[2]):(o=()=>{let t=n.current,i=r.current;if(!t||!i||e.focusable===!1)return;let o=()=>a(t.scrollWidth>t.clientWidth);return o(),gr([t,i],o)},s=[e.focusable],t[0]=e.focusable,t[1]=o,t[2]=s),(0,V.useLayoutEffect)(o,s);let c=e.focusable!==!1&&i,l;t[3]===e.tex?l=t[4]:(l=e.tex.trim(),t[3]=e.tex,t[4]=l);let u=l,d=e.display?`\\[\n${u}\n\\]`:`\\(${u}\\)`,f;t[5]===d?f=t[6]:(f=(0,U.jsx)(`span`,{className:`whitespace-pre-wrap`,children:d}),t[5]=d,t[6]=f);let p=f,m=e.display?`chat-markdown-math-display my-[0.65rem] block in-[.chat-markdown-table-container]:max-w-none in-[.chat-markdown-table-container]:overflow-visible`:`inline-block max-w-full align-middle whitespace-nowrap wrap-normal break-normal in-[.chat-markdown-table-container]:max-w-none in-[.chat-markdown-table-container]:overflow-visible`,h=e.display?`display`:`inline`,g=e.display?`${d}\n\n`:d,_=e.focusable===!1?void 0:`group`,v=e.focusable===!1?void 0:e.display?`Display equation`:`Inline equation`,y=c?0:-1,b=c?e.display?`Scroll display equation`:`Scroll inline equation`:void 0,x=e.display?`inline-block w-max min-w-full`:`inline-block w-max`,S;t[7]===u?S=t[8]:(S=[u],t[7]=u,t[8]=S);let C;t[9]!==p||t[10]!==e.display||t[11]!==u?(C=(0,U.jsx)(dv,{tex:u,display:e.display,fallback:p}),t[9]=p,t[10]=e.display,t[11]=u,t[12]=C):C=t[12];let w;t[13]!==p||t[14]!==C?(w=(0,U.jsx)(V.Suspense,{fallback:p,children:C}),t[13]=p,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==p||t[17]!==S||t[18]!==w?(T=(0,U.jsx)(ci,{resetKeys:S,fallback:p,children:w}),t[16]=p,t[17]=S,t[18]=w,t[19]=T):T=t[19];let E;t[20]!==x||t[21]!==T?(E=(0,U.jsx)(`span`,{ref:r,className:x,children:T}),t[20]=x,t[21]=T,t[22]=E):E=t[22];let D;t[23]!==b||t[24]!==E||t[25]!==y?(D=(0,U.jsx)(`span`,{ref:n,className:`block max-w-full overflow-x-auto overflow-y-hidden in-[.chat-markdown-table-container]:max-w-none in-[.chat-markdown-table-container]:overflow-visible px-0.5 py-0.75 focus-visible:outline-1 focus-visible:outline-solid focus-visible:-outline-offset-1 focus-visible:outline-border [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-thumb]:rounded [&::-webkit-scrollbar-thumb]:border [&::-webkit-scrollbar-thumb]:border-transparent [&::-webkit-scrollbar-thumb]:bg-clip-content`,tabIndex:y,"aria-label":b,children:E}),t[23]=b,t[24]=E,t[25]=y,t[26]=D):D=t[26];let O;return t[27]!==D||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_||t[32]!==v?(O=(0,U.jsx)(`span`,{className:m,"data-markdown-math":h,"data-markdown-copy":g,role:_,"aria-label":v,children:D}),t[27]=D,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=v,t[33]=O):O=t[33],O}),pv=/^[.,:;!?…)\]}"'’”]+/;function mv(){let e=t=>{if(t.tagName===`pre`||!t.children)return;let n=[];for(let r of t.children){e(r);let t=n.at(-1),i=r.type===`text`&&(t?.tagName===`a`||t?.tagName===`code`)?pv.exec(r.value??``)?.[0]:void 0;if(!t||!i){n.push(r);continue}n[n.length-1]={type:`element`,tagName:`span`,properties:{className:[`has-[[data-slot=context-chip-label]]:whitespace-nowrap`]},children:[t,{type:`text`,value:i}]};let a=(r.value??``).slice(i.length);a&&n.push({...r,value:a})}t.children=n};return e}async function hv(e){let t=Qn(e.source,{threadId:e.threadRef?.threadId,workspaceRoot:e.cwd,resolvedFilePath:e.resolvedFilePath});if(t===null)return null;let{kind:n,name:r,reference:i}=t,a=i?.kind===`file`?i.relativePath:void 0,o,s;if(t.access===`direct`)o=ga(t.uri);else{if(t.access===`unavailable`||!e.threadRef||!e.httpBaseUrl)throw Error(`Reconnect to this environment and open the media again.`);s={environmentId:e.threadRef.environmentId,resource:t.resource};let n=await e.createAssetUrl({environmentId:s.environmentId,input:{resource:s.resource}});if(n._tag===`Failure`)throw _t(n);let r=yr(e.httpBaseUrl,n.value.relativeUrl);if(r===null)throw Error(`The environment returned an invalid media URL.`);o=r+t.srcFragment}return{images:[{src:o,name:r,...n===`video`?{type:`video`,autoPlay:!1}:{},...t.access===`direct`&&ma(t.uri)!==null?{originalUrl:t.uri}:{},...t.srcFragment?{srcFragment:t.srcFragment}:{},actionsSource:{kind:n,name:r,src:o,...i?{reference:i}:{},...s?{asset:s}:{},...a&&e.onOpenFile?{onOpenFile:()=>e.onOpenFile?.(a)}:{}}}],index:0}}function gv(e,t){return{environmentId:e,resource:{_tag:`attachment`,attachmentId:t.id,fileName:t.name,mimeType:D(t)??t.mimeType}}}function _v(e,t){if(!u(t))return null;let n=t.previewUrl??null,r=t.downloadable===!1?void 0:gv(e,t);return n===null&&r===void 0?null:{images:[{src:n,name:t.name,type:`video`,actionsSource:{kind:`video`,name:t.name,src:n,...r?{asset:r}:{}}}],index:0}}function vv(e){let t=e.images[e.index],n=t?.actionsSource?.asset;return`${t?.src??(n?JSON.stringify([n.environmentId,n.resource]):`image`)}:${e.index}`}function yv(e,t){let n=URL.createObjectURL(t);return e.src=n,()=>URL.revokeObjectURL(n)}function bv(e,t){let n=e.find(e=>e.id===t);if(n?.type===`file`&&n.file&&u(n))return{images:[{src:URL.createObjectURL(n.file),name:n.name,type:`video`}],index:0};let r=e.flatMap(e=>e.type===`image`&&e.previewUrl?[{id:e.id,src:e.previewUrl,name:e.name,source:e.source}]:[]);if(r.length===0)return null;let i=r.findIndex(e=>e.id===t);return i<0?null:{images:r.map(e=>({src:e.src,name:e.name,...e.source?.kind===`snap-shot`?{source:e.source}:{}})),index:i}}var xv=[];function Sv(e){let t=e.fontStyle??0;return{...e.color?{color:e.color}:{},...t&1?{fontStyle:`italic`}:{},...t&2?{fontWeight:700}:{},...t&4?{textDecoration:`underline`}:{}}}function Cv(e){let t=(0,H.c)(13),{code:n,language:r,embedded:i,theme:a,wordClassName:o}=e,s=i===void 0?xv:i,c;t[0]===r?c=t[1]:(c=Ti(r),t[0]=r,t[1]=c);let l=(0,V.use)(c);for(let e of s)(0,V.use)(Ti(e.language));let u;if(t[2]!==n||t[3]!==s||t[4]!==l||t[5]!==r||t[6]!==a){let e=In(a),i=(t,n)=>l.codeToTokens(t,{lang:n,theme:e}).tokens;u=Ov(n,Ev(n,i(n,r),s,i)),t[2]=n,t[3]=s,t[4]=l,t[5]=r,t[6]=a,t[7]=u}else u=t[7];let d=u,f;if(t[8]!==d||t[9]!==o){let e;t[11]===o?e=t[12]:(e=e=>{let{key:t,tokens:n,ending:r}=e;return(0,U.jsxs)(`span`,{children:[o?kv(n).map(e=>typeof e==`string`?e:(0,U.jsx)(`span`,{className:o,children:e.pieces.map(Tv)},e.key)):n.map(wv),r]},t)},t[11]=o,t[12]=e),f=d.map(e),t[8]=d,t[9]=o,t[10]=f}else f=t[10];return f}function wv(e){return(0,U.jsx)(`span`,{style:Sv(e),children:e.content},`${e.offset}:${e.content}`)}function Tv(e){return(0,U.jsx)(`span`,{style:Sv(e.token),children:e.text},e.key)}function Ev(e,t,n,r){if(n.length===0)return t;let i=Array.from({length:e.length});for(let e of t.flat())i.fill(e,e.offset,e.offset+e.content.length);for(let e of n){let t;try{t=r(e.text,e.language)}catch{continue}for(let n of t.flat()){if(n.content===``)continue;let t=n.offset+n.content.length-1;i.fill(n,e.starts[n.offset],e.ends[t])}}return Dv(e,i)}function Dv(e,t){let n=[],r=0;for(let i of[...e.matchAll(/\r?\n/gu),void 0]){let a=i?.index??e.length,o=[];for(let n=r;n<a;){let r=t[n],i=n+1;for(;i<a&&t[i]?.color===r?.color&&t[i]?.fontStyle===r?.fontStyle;)i+=1;o.push({content:e.slice(n,i),offset:n,...r?.color?{color:r.color}:{},...r?.fontStyle?{fontStyle:r.fontStyle}:{}}),n=i}n.push(o),i&&(r=i.index+i[0].length)}return n}function Ov(e,t){let n=e.match(/\r?\n/gu)??[],r=0;return t.map((e,t)=>{let i=e.map(e=>e.content).join(``),a=`${r}:${i}`,o=n[t]??``;return r+=i.length+o.length,{key:a,tokens:e,ending:o}})}function kv(e){let t=[],n=null;for(let r of e){let e=r.offset;for(let i of r.content.split(/(\s+)/u))i!==``&&(/^\s/u.test(i)?(t.push(i),n=null):(n||(n={key:String(e),pieces:[]},t.push(n)),n.pieces.push({key:String(e),text:i,token:r})),e+=i.length)}return t}var Av=`relative h-28 w-52 max-w-full overflow-hidden rounded-lg border border-border/80`;function jv(e){let t=(0,H.c)(9),{details:n,className:r}=e,{resolvedTheme:i}=tn(),a;t[0]!==n.content||t[1]!==n.format||t[2]!==i?(a=n.format===`json`?(0,U.jsx)(ci,{fallback:n.content,children:(0,U.jsx)(V.Suspense,{fallback:n.content,children:(0,U.jsx)(Cv,{code:n.content,language:`json`,theme:i})})}):n.content,t[0]=n.content,t[1]=n.format,t[2]=i,t[3]=a):a=t[3];let o=a,s;t[4]===r?s=t[5]:(s=B(`overflow-auto whitespace-pre-wrap break-words font-mono focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/70`,r),t[4]=r,t[5]=s);let c;return t[6]!==o||t[7]!==s?(c=(0,U.jsx)(`pre`,{className:s,tabIndex:0,children:o}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function Mv(e){if(e.accessibility?.format===`element-tree`)return{content:JSON.stringify(e.accessibility,null,2),format:`json`};let t=e.accessibility?.format===`flat-text`?e.accessibility.text.trim():e.accessibleText?.trim();return t?{content:t,format:`text`}:void 0}function Nv(e){return!!(e.accessibility||e.accessibleText?.trim())}function Pv(e){let t=(0,H.c)(28),{source:n,className:r,side:i}=e,a=i===void 0?`top`:i,o;t[0]===n?o=t[1]:(o=Nv(n),t[0]=n,t[1]=o);let s=o,c=s?h:T,l;t[2]===n?l=t[3]:(l=Mv(n),t[2]=n,t[3]=l);let u=l,d=s?`Accessibility data`:`No accessibility data`,f=s?`View accessibility data`:`No accessibility data`,p;t[4]!==r||t[5]!==f?(p=(0,U.jsx)(mr,{render:(0,U.jsx)(we,{"aria-label":f,className:r,onClick:Fv,size:`icon-micro`,variant:`overlay`})}),t[4]=r,t[5]=f,t[6]=p):p=t[6];let m;t[7]===c?m=t[8]:(m=(0,U.jsx)(c,{className:`size-3`,"aria-hidden":`true`}),t[7]=c,t[8]=m);let g;t[9]!==p||t[10]!==m?(g=(0,U.jsx)(tr,{render:p,children:m}),t[9]=p,t[10]=m,t[11]=g):g=t[11];let _;t[12]!==a||t[13]!==d?(_=(0,U.jsx)(nr,{side:a,children:d}),t[12]=a,t[13]=d,t[14]=_):_=t[14];let v;t[15]!==g||t[16]!==_?(v=(0,U.jsxs)(rr,{children:[g,_]}),t[15]=g,t[16]=_,t[17]=v):v=t[17];let y;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,U.jsx)(dr,{children:`Accessibility data`}),t[18]=y):y=t[18];let b;t[19]!==u||t[20]!==s?(b=(0,U.jsxs)(`div`,{className:`max-h-[min(28rem,70vh)] space-y-2 overflow-y-auto`,children:[y,u?(0,U.jsx)(jv,{details:u,className:`max-h-64 rounded-md border border-border/70 bg-muted/45 p-2.5 text-2xs leading-4`}):s?(0,U.jsx)(`div`,{className:`rounded-md border border-border/70 bg-muted/45 p-2.5 text-muted-foreground text-xs leading-4`,children:`Structured accessibility elements were included, but they have no readable names or values.`}):(0,U.jsx)(`div`,{className:`rounded-md border border-border/70 bg-muted/45 p-2.5 text-muted-foreground text-xs leading-4`,children:`The app or capture backend did not provide verified accessibility data.`})]}),t[19]=u,t[20]=s,t[21]=b):b=t[21];let x;t[22]!==a||t[23]!==b?(x=(0,U.jsx)(fr,{side:a,align:`center`,width:`md`,children:b}),t[22]=a,t[23]=b,t[24]=x):x=t[24];let S;return t[25]!==x||t[26]!==v?(S=(0,U.jsxs)(hr,{children:[v,x]}),t[25]=x,t[26]=v,t[27]=S):S=t[27],S}function Fv(e){return e.stopPropagation()}function Iv(e){let t=(0,H.c)(21),{source:n,className:r}=e,i;t[0]===r?i=t[1]:(i=B(`pointer-events-none absolute inset-x-0 bottom-0 flex min-w-0 items-center gap-1.5 bg-linear-to-t from-black/85 via-black/55 to-transparent px-2.5 pb-2 pt-6`,r),t[0]=r,t[1]=i);let a;t[2]!==n.appIconDataUrl||t[3]!==n.appName?(a=n.appIconDataUrl?(0,U.jsx)(`img`,{src:n.appIconDataUrl,alt:``,className:`size-7 shrink-0 rounded-md`}):(0,U.jsx)(`div`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md bg-white/20 text-3xs font-medium text-white uppercase`,children:n.appName.slice(0,1)}),t[2]=n.appIconDataUrl,t[3]=n.appName,t[4]=a):a=t[4];let o;t[5]===n.appName?o=t[6]:(o=(0,U.jsx)(`span`,{className:`truncate`,children:n.appName}),t[5]=n.appName,t[6]=o);let s;t[7]===n?s=t[8]:(s=(0,U.jsx)(Pv,{source:n,className:`pointer-events-auto`}),t[7]=n,t[8]=s);let c;t[9]!==o||t[10]!==s?(c=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-2xs font-medium leading-3.5 text-white`,children:[o,s]}),t[9]=o,t[10]=s,t[11]=c):c=t[11];let l=n.windowTitle||`Captured window`,u;t[12]===l?u=t[13]:(u=(0,U.jsx)(`div`,{className:`truncate text-3xs leading-3.5 text-white/70`,children:l}),t[12]=l,t[13]=u);let d;t[14]!==c||t[15]!==u?(d=(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[c,u]}),t[14]=c,t[15]=u,t[16]=d):d=t[16];let f;return t[17]!==i||t[18]!==a||t[19]!==d?(f=(0,U.jsxs)(`div`,{className:i,children:[a,d]}),t[17]=i,t[18]=a,t[19]=d,t[20]=f):f=t[20],f}var Lv=8;function Rv(e){let t=(0,H.c)(44),{src:n,name:r,onError:i,ref:a}=e,o=(0,V.useRef)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={width:0,height:0},t[0]=s):s=t[0];let[c,l]=(0,V.useState)(s),[u,d]=(0,V.useState)(zv),[f,p]=(0,V.useState)(1),m=(0,V.useRef)(1),h=(0,V.useRef)(null),g=(0,V.useRef)(null),_=(0,V.useRef)(!1),[v,y]=(0,V.useState)(!1),b=Math.max(1,Math.min(u.height*.86,u.height-160)),x=Math.min(1,(u.width*.92-(u.width>=640?96:0))/(c.width||1),b/(c.height||1)),S=c.width*x*f,C=c.height*x*f,w,T;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>({pan(e){let t=o.current;if(!t||m.current<=1||(e===`ArrowLeft`||e===`ArrowRight`)&&t.scrollWidth<=t.offsetWidth)return!1;bb36:switch(e){case`ArrowLeft`:t.scrollLeft-=40;break bb36;case`ArrowRight`:t.scrollLeft+=40;break bb36;case`ArrowUp`:t.scrollTop-=40;break bb36;case`ArrowDown`:t.scrollTop+=40;break bb36;default:return!1}return!0}}),T=[],t[1]=w,t[2]=T):(w=t[1],T=t[2]),(0,V.useImperativeHandle)(a,w,T);let E;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(E=(e,t)=>{let n=o.current,r=m.current,i=Math.min(Lv,Math.max(1,e));if(!n||r===i)return;let a=n.getBoundingClientRect(),s=t?t.x-a.left:n.clientWidth/2,c=t?t.y-a.top:n.clientHeight/2;h.current={x:(n.scrollLeft+s)/r,y:(n.scrollTop+c)/r,clientX:a.left+s,clientY:a.top+c},m.current=i,p(i)},t[3]=E):E=t[3];let D=E,O,k;t[4]===f?(O=t[5],k=t[6]):(O=()=>{let e=o.current,t=h.current;if(!e||!t)return;let n=e.getBoundingClientRect();e.scrollLeft=t.x*f-(t.clientX-n.left),e.scrollTop=t.y*f-(t.clientY-n.top),h.current=null},k=[f],t[4]=f,t[5]=O,t[6]=k),(0,V.useLayoutEffect)(O,k);let A,j;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{let e=()=>{d({width:window.innerWidth,height:window.innerHeight}),D(1)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},j=[D],t[7]=A,t[8]=j):(A=t[7],j=t[8]),(0,V.useEffect)(A,j);let M,N;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>{let e=o.current;if(!e)return;let t=t=>{if(!t.ctrlKey||t.deltaY===0)return;t.preventDefault();let n=t.deltaY*(t.deltaMode===1?16:t.deltaMode===2?e.clientHeight:1);D(m.current*Math.exp(-n*.01),{x:t.clientX,y:t.clientY})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},M=[D],t[9]=M,t[10]=N):(M=t[9],N=t[10]),(0,V.useEffect)(N,M);let P=`${r}, zoomable image`,F=S||void 0,ee=C||void 0,te=f>1?v?`grabbing`:`grab`:`zoom-in`,ne;t[11]!==b||t[12]!==F||t[13]!==ee||t[14]!==te?(ne={width:F,height:ee,maxHeight:b,cursor:te},t[11]=b,t[12]=F,t[13]=ee,t[14]=te,t[15]=ne):ne=t[15];let re,ie,I,L,ae,oe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(re=e=>{_.current||e.detail>1||D(m.current>1?1:2,{x:e.clientX,y:e.clientY})},ie=e=>{e.ctrlKey||e.metaKey||e.altKey||(e.key===`Enter`||e.key===` `?(e.preventDefault(),e.repeat||D(m.current>1?1:2)):e.key===`+`||e.key===`=`?(e.preventDefault(),D(m.current*1.5)):e.key===`-`?(e.preventDefault(),D(m.current/1.5)):e.key===`0`&&(e.preventDefault(),D(1)))},I=e=>{if(g.current||(_.current=!1,e.pointerType!==`mouse`||e.button!==0||m.current<=1))return;let t=e.currentTarget,n=t.getBoundingClientRect();e.clientX-n.left>=t.clientWidth||e.clientY-n.top>=t.clientHeight||(g.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY,left:t.scrollLeft,top:t.scrollTop},t.setPointerCapture(e.pointerId),y(!0))},L=e=>{let t=g.current;t&&t.pointerId===e.pointerId&&(Math.hypot(e.clientX-t.x,e.clientY-t.y)>4&&(_.current=!0),e.currentTarget.scrollLeft=t.left-(e.clientX-t.x),e.currentTarget.scrollTop=t.top-(e.clientY-t.y))},ae=e=>{g.current?.pointerId===e.pointerId&&(e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),g.current=null,y(!1))},oe=e=>{g.current?.pointerId===e.pointerId&&(g.current=null,y(!1))},t[16]=re,t[17]=ie,t[18]=I,t[19]=L,t[20]=ae,t[21]=oe):(re=t[16],ie=t[17],I=t[18],L=t[19],ae=t[20],oe=t[21]);let se;t[22]!==C||t[23]!==b||t[24]!==c.width||t[25]!==S?(se=c.width?{width:S,height:C}:{maxWidth:`var(--media-width)`,maxHeight:b},t[22]=C,t[23]=b,t[24]=c.width,t[25]=S,t[26]=se):se=t[26];let ce;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ce=e=>{l({width:e.currentTarget.naturalWidth,height:e.currentTarget.naturalHeight})},t[27]=ce):ce=t[27];let le;t[28]!==r||t[29]!==i||t[30]!==n||t[31]!==se?(le=(0,U.jsx)(`img`,{src:n,alt:r,draggable:!1,className:`block max-w-none select-none`,style:se,onLoad:ce,onError:i}),t[28]=r,t[29]=i,t[30]=n,t[31]=se,t[32]=le):le=t[32];let ue;t[33]!==P||t[34]!==ne||t[35]!==le?(ue=(0,U.jsx)(`div`,{ref:o,role:`region`,"aria-label":P,"aria-description":`Click to zoom in or return to fit. Pinch or Ctrl+scroll to zoom, scroll or drag to pan. Use Enter to toggle zoom, plus or minus to zoom, and 0 to fit.`,tabIndex:0,className:`max-w-[var(--media-width)] overflow-auto overscroll-contain rounded-lg bg-background shadow-2xl ring-1 ring-border/70 outline-none focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-ring`,style:ne,onClick:re,onKeyDown:ie,onPointerDown:I,onPointerMove:L,onPointerUp:ae,onLostPointerCapture:oe,children:le}),t[33]=P,t[34]=ne,t[35]=le,t[36]=ue):ue=t[36];let de;t[37]===f?de=t[38]:(de=Math.round(f*100),t[37]=f,t[38]=de);let fe;t[39]===de?fe=t[40]:(fe=(0,U.jsxs)(`span`,{className:`sr-only`,"aria-live":`polite`,children:[de,`% zoom`]}),t[39]=de,t[40]=fe);let pe;return t[41]!==ue||t[42]!==fe?(pe=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[ue,fe]}),t[41]=ue,t[42]=fe,t[43]=pe):pe=t[43],pe}function zv(){return{width:window.innerWidth,height:window.innerHeight}}var Bv=`flex aspect-auto h-48 min-h-0 w-[min(var(--media-width),32rem)] flex-col items-center justify-center gap-3 rounded-lg border border-border/70 bg-black p-6 text-center text-sm text-white shadow-2xl`;function Vv(e){let t=(0,H.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,U.jsx)(`div`,{role:`alert`,className:Bv,children:n}),t[0]=n,t[1]=r),r}function Hv(e){let t=(0,H.c)(7),{item:n}=e,r=n.actionsSource?.asset,i=xr(r?.environmentId??null,r?.resource??null),a=Sr(r?.environmentId??null,r?.resource??null),o=r?i._tag===`Success`?i.url+(n.srcFragment??``):null:n.src,s=i._tag===`Failure`,c=n.autoPlay??!0,l=r?a:void 0,u;return t[0]!==n.name||t[1]!==n.originalUrl||t[2]!==o||t[3]!==s||t[4]!==c||t[5]!==l?(u=(0,U.jsx)(ka,{src:o,label:n.name,sourceFailed:s,originalUrl:n.originalUrl,preload:`metadata`,autoPlay:c,className:`block max-h-[var(--media-height)] max-w-[var(--media-width)] text-center`,videoClassName:`aspect-auto max-h-[var(--media-height)] w-auto max-w-[var(--media-width)] rounded-lg border border-border/70 shadow-2xl`,stateClassName:Bv,onRetry:l}),t[0]=n.name,t[1]=n.originalUrl,t[2]=o,t[3]=s,t[4]=c,t[5]=l,t[6]=u):u=t[6],u}var Uv=(0,V.memo)(function(e){let t=(0,H.c)(74),{preview:n,onClose:r}=e,[i,a]=(0,V.useState)(0),[o,s]=(0,V.useState)(null),[c,u]=(0,V.useState)(null),d=(0,V.useRef)(null),[f]=(0,V.useState)(Wv),p=(0,V.useRef)(null),m=n.images.length,h=m>0?((n.index+i)%m+m)%m:0,g=n.images[h],_;t[0]!==g?.actionsSource||t[1]!==g?.name||t[2]!==g?.src||t[3]!==g?.type?(_=g?.actionsSource??{kind:g?.type===`video`?`video`:`image`,name:g?.name??`Media`,src:g?.src??null},t[0]=g?.actionsSource,t[1]=g?.name,t[2]=g?.src,t[3]=g?.type,t[4]=_):_=t[4];let v=_,y=v.onOpenFile,b;t[5]!==r||t[6]!==y||t[7]!==v?(b=y?{...v,onOpenFile:()=>{y(),r()}}:v,t[5]=r,t[6]=y,t[7]=v,t[8]=b):b=t[8];let x=b,S;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{a(t=>t+e)},t[9]=S):S=t[9];let C=S,w=(0,V.useRef)(null),T,E;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>(w.current=document.activeElement,()=>{let e=w.current;e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:!0})}),E=[],t[10]=T,t[11]=E):(T=t[10],E=t[11]),(0,V.useEffect)(T,E);let D;t[12]===n.images.length?D=t[13]:(D=e=>{e.defaultPrevented||nn()||e.target instanceof HTMLVideoElement||(d.current?.pan(e.key)?(e.preventDefault(),e.stopPropagation()):n.images.length<=1||(e.key===`ArrowLeft`?(e.preventDefault(),e.stopPropagation(),C(-1)):e.key===`ArrowRight`&&(e.preventDefault(),e.stopPropagation(),C(1))))},t[12]=n.images.length,t[13]=D);let O=D,k,A;if(t[14]===r?(k=t[15],A=t[16]):(k=()=>{let e=e=>{e.key!==`Escape`||nn()||(e.preventDefault(),e.stopPropagation(),r())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},A=[r],t[14]=r,t[15]=k,t[16]=A),(0,V.useEffect)(k,A),!g)return null;let j=g.type===`video`?`video`:`image`,M;t[17]===g.originalUrl?M=t[18]:(M=g.originalUrl&&ma(g.originalUrl)!==null?(0,U.jsx)(Ca,{originalUrl:g.originalUrl}):null,t[17]=g.originalUrl,t[18]=M);let N=M,P;t[19]===g.source?P=t[20]:(P=g.source?Mv(g.source):void 0,t[19]=g.source,t[20]=P);let F=P,ee=!!F&&c===g.src,te=ee?`Show screenshot`:F?.format===`json`?`Show accessibility JSON`:`Show extracted text`,ne;t[21]===r?ne=t[22]:(ne=e=>{e||r()},t[21]=r,t[22]=ne);let re;t[23]===f?re=t[24]:(re=()=>f,t[23]=f,t[24]=re);let ie;t[25]===r?ie=t[26]:(ie=e=>{e.target===e.currentTarget&&r()},t[25]=r,t[26]=ie);let I;t[27]===j?I=t[28]:(I=(0,U.jsxs)(cr,{className:`sr-only`,children:[`Expanded `,j,` preview`]}),t[27]=j,t[28]=I);let L=`Close ${j} preview`,ae;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,U.jsx)(je,{}),t[29]=ae):ae=t[29];let oe;t[30]!==r||t[31]!==L?(oe=(0,U.jsx)(we,{type:`button`,ref:p,size:`icon-sm`,variant:`media-close`,className:`absolute right-0 top-0 z-20`,onClick:r,"aria-label":L,children:ae}),t[30]=r,t[31]=L,t[32]=oe):oe=t[32];let se;t[33]===n.images.length?se=t[34]:(se=n.images.length>1&&(0,U.jsx)(we,{type:`button`,size:`icon`,variant:`media-navigation`,className:`left-0 top-auto bottom-0 translate-y-0 sm:top-1/2 sm:bottom-auto sm:-translate-y-1/2`,"aria-label":`Previous media`,onClick:()=>C(-1),children:(0,U.jsx)(l,{className:`size-5`})}),t[33]=n.images.length,t[34]=se);let ce;t[35]!==F||t[36]!==o||t[37]!==h||t[38]!==g||t[39]!==N||t[40]!==ee?(ce=g.type===`video`?(0,U.jsx)(Hv,{item:g},h):ee?F?(0,U.jsx)(jv,{details:F,className:`h-[min(var(--media-height),40rem)] w-[min(var(--media-width),42rem)] transition-opacity duration-140 ease-out starting:opacity-0 rounded-lg border border-border/70 bg-background p-4 text-xs leading-5 shadow-2xl motion-reduce:transition-none`}):null:g.src===null||o===g.src?(0,U.jsxs)(Vv,{children:[(0,U.jsx)(`p`,{children:N?`This image could not be loaded.`:`Image unavailable. The file may have been moved or deleted.`}),N]}):(0,U.jsx)(Rv,{ref:d,src:g.src,name:g.name,onError:()=>s(g.src)},`${h}:${g.src}`),t[35]=F,t[36]=o,t[37]=h,t[38]=g,t[39]=N,t[40]=ee,t[41]=ce):ce=t[41];let le=n.images.length>1?` (${h+1}/${n.images.length})`:``,ue;t[42]!==g.name||t[43]!==le?(ue=(0,U.jsxs)(`span`,{className:`truncate`,"aria-live":`polite`,"aria-atomic":`true`,children:[g.name,le]}),t[42]=g.name,t[43]=le,t[44]=ue):ue=t[44];let de;t[45]!==F||t[46]!==te||t[47]!==g.source||t[48]!==g.src||t[49]!==ee?(de=F&&g.source?(0,U.jsx)(we,{"aria-label":te,"aria-pressed":ee,onClick:()=>u(ee?null:g.src),size:`icon-micro`,variant:`overlay`,children:(0,U.jsx)(Yt,{className:`size-3`,"aria-hidden":`true`,icon:ee?Wt:Kt})}):g.source?(0,U.jsx)(Pv,{source:g.source,side:`top`}):null,t[45]=F,t[46]=te,t[47]=g.source,t[48]=g.src,t[49]=ee,t[50]=de):de=t[50];let fe;t[51]!==ue||t[52]!==de?(fe=(0,U.jsxs)(`div`,{className:`mt-2 flex max-w-[var(--media-width)] items-center justify-center gap-1.5 text-xs text-white/80 max-sm:px-10`,children:[ue,de]}),t[51]=ue,t[52]=de,t[53]=fe):fe=t[53];let pe;t[54]!==ce||t[55]!==fe?(pe=(0,U.jsxs)(`div`,{className:`relative isolate z-10 flex max-h-full max-w-[var(--media-width)] flex-col items-center`,children:[ce,fe]}),t[54]=ce,t[55]=fe,t[56]=pe):pe=t[56];let R;t[57]!==x||t[58]!==pe?(R=(0,U.jsx)(Oa,{source:x,showTooltip:!1,children:pe}),t[57]=x,t[58]=pe,t[59]=R):R=t[59];let me;t[60]===n.images.length?me=t[61]:(me=n.images.length>1&&(0,U.jsx)(we,{type:`button`,size:`icon`,variant:`media-navigation`,className:`right-0 top-auto bottom-0 translate-y-0 sm:top-1/2 sm:bottom-auto sm:-translate-y-1/2`,"aria-label":`Next media`,onClick:()=>C(1),children:(0,U.jsx)(ye,{className:`size-5`})}),t[60]=n.images.length,t[61]=me);let z;t[62]!==O||t[63]!==re||t[64]!==ie||t[65]!==I||t[66]!==oe||t[67]!==se||t[68]!==R||t[69]!==me?(z=(0,U.jsxs)(lr,{...Ve,variant:`media`,showCloseButton:!1,bottomStickOnMobile:!1,className:`row-start-1 h-full max-h-[92vh] w-[92vw] max-w-[92vw] items-center justify-center overflow-visible [--media-width:92vw] [--media-height:min(86vh,calc(100vh-160px))] sm:[--media-width:calc(92vw-96px)]`,onKeyDown:O,initialFocus:p,finalFocus:re,onClick:ie,children:[I,oe,se,R,me]}),t[62]=O,t[63]=re,t[64]=ie,t[65]=I,t[66]=oe,t[67]=se,t[68]=R,t[69]=me,t[70]=z):z=t[70];let he;return t[71]!==ne||t[72]!==z?(he=(0,U.jsx)(ur,{open:!0,onOpenChange:ne,children:z}),t[71]=ne,t[72]=z,t[73]=he):he=t[73],he});function Wv(){return document.activeElement instanceof HTMLElement?document.activeElement:null}var Gv=new WeakMap;function Kv(e,t){let n=e.closest(`[data-image-gallery]`)??e.closest(`.chat-markdown`),r=[],i=-1;for(let a of n?.querySelectorAll(`img`)??[]){let n=Gv.get(a);if(!n)continue;let o=a.closest(`a`),s=o?.getAttribute(`href`)??``;if(o&&Et(s)!==`image`)continue;let c=ma(s)===null?null:ga(s),l=Kn(s),u=c?{...n,src:c,originalUrl:s,actionsSource:{kind:`image`,name:n.name,src:c,...l?{reference:l}:{}}}:n;a===e||!Gv.has(e)&&i<0&&u.src===t.src?(i=r.length,r.push(t)):r.push(u)}return i<0?{images:[t],index:0}:{images:r,index:i}}function qv(e){let t=(0,H.c)(5),n=_i(e.environmentId,e.path,e.cwd),r=n?.kind===`directory`?`directory`:`file`,i=n?.mimeType,a;return t[0]!==e.path||t[1]!==e.theme||t[2]!==r||t[3]!==i?(a=(0,U.jsx)(Nr,{pathValue:e.path,kind:r,mimeType:i,theme:e.theme}),t[0]=e.path,t[1]=e.theme,t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function Jv(e){let t=(0,H.c)(5),n=_i(e.environmentId,e.path,e.cwd),r=e.label??e.path,i;t[0]===n?i=t[1]:(i=n?.byteLength===void 0?null:` · ${Mr(n.byteLength)}`,t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,U.jsxs)(U.Fragment,{children:[r,i]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function Yv(e){let t=(0,H.c)(10),n;t[0]!==e.cwd||t[1]!==e.environmentId||t[2]!==e.path||t[3]!==e.theme?(n=(0,U.jsx)(qv,{path:e.path,environmentId:e.environmentId,cwd:e.cwd,theme:e.theme}),t[0]=e.cwd,t[1]=e.environmentId,t[2]=e.path,t[3]=e.theme,t[4]=n):n=t[4];let r;t[5]===e.label?r=t[6]:(r=(0,U.jsx)(o_,{children:e.label}),t[5]=e.label,t[6]=r);let i;return t[7]!==n||t[8]!==r?(i=(0,U.jsxs)(U.Fragment,{children:[n,r]}),t[7]=n,t[8]=r,t[9]=i):i=t[9],i}function Xv(e){let t=e.children.find(e=>e.type===`element`&&e.tagName===`pre`);if(t?.type!==`element`)throw Error(`Missing highlighted pre element`);let n=t.children.find(e=>e.type===`element`&&e.tagName===`code`);if(n?.type!==`element`)throw Error(`Missing highlighted code element`);return n.children}function Zv(e,t,n){let r={lang:t,theme:n},i={type:`text`,value:`
42
42
  `},a;return n=>{if(!t||[`text`,`plaintext`,`plain`,`txt`,`ansi`].includes(t)||n.includes(`\r`))return e.codeToHast(n,r);a&&!n.startsWith(a.prefix)&&(a=void 0);let o=n.lastIndexOf(`
43
43
  `)+1;if(o>(a?.prefix.length??0)){let t=e.codeToHast(n.slice(a?.prefix.length??0,o-1),{...r,...a?{grammarState:a.state}:{}}),s=e.getLastGrammarState(t);if(!s)return a=void 0,e.codeToHast(n,r);a={prefix:n.slice(0,o),state:s,children:[...a?[...a.children,i]:[],...Xv(t)]}}let s=a;return s?e.codeToHast(n.slice(s.prefix.length),{...r,grammarState:s.state,transformers:[{code:e=>({...e,children:[...s.children,i,...e.children]})}]}):e.codeToHast(n,r)}}var Qv={Fragment:U.Fragment,jsx:U.jsx,jsxs:U.jsxs};function $v(e){let t=Dh({...e,children:[]},Qv);if(!(0,V.isValidElement)(t))throw Error(`Expected a highlighted code element`);return t}var ey=(0,V.memo)(function({node:e}){return e.type===`element`?(0,V.cloneElement)($v(e),{dangerouslySetInnerHTML:{__html:Tn({type:`root`,children:e.children})}}):Dh(e,Qv)});function ty({root:e}){let t=e.children[0];if(t?.type!==`element`||t.tagName!==`pre`)return Dh(e,Qv);let n=t.children[0];return n?.type!==`element`||n.tagName!==`code`?Dh(e,Qv):(0,V.cloneElement)($v(t),void 0,(0,V.cloneElement)($v(n),void 0,n.children.map((e,t)=>(0,U.jsx)(ey,{node:e},t))))}function ny(e,t){this.v=e,this.k=t}function ry(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function iy(e){if(Array.isArray(e))return e}function ay(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function oy(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
44
44
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sy(e,t){return iy(e)||ay(e,t)||cy(e,t)||oy()}function cy(e,t){if(e){if(typeof e==`string`)return ry(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ry(e,t):void 0}}function ly(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof ny;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}ly.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},ly.prototype.next=function(e){return this._invoke(`next`,e)},ly.prototype.throw=function(e){return this._invoke(`throw`,e)},ly.prototype.return=function(e){return this._invoke(`return`,e)};var uy=Object.entries,dy=Object.setPrototypeOf,fy=Object.isFrozen,py=Object.getPrototypeOf,my=Object.getOwnPropertyDescriptor,hy=Object.freeze,gy=Object.seal,_y=Object.create,vy=typeof Reflect<`u`&&Reflect,yy=vy.apply,by=vy.construct;hy||=function(e){return e},gy||=function(e){return e},yy||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},by||=function(e){return new e(...[...arguments].slice(1))};var xy=Gy(Array.prototype.forEach);Array.prototype.indexOf;var Sy=Gy(Array.prototype.lastIndexOf),Cy=Gy(Array.prototype.pop),wy=Gy(Array.prototype.push),Ty=Gy(Array.prototype.slice),Ey=Gy(Array.prototype.splice),Dy=Array.isArray,Oy=Ky(Set),ky=Gy(Set.prototype.add),Ay=Gy(Set.prototype.has),jy=Gy(String.prototype.toLowerCase),My=Gy(String.prototype.toString),Ny=Gy(String.prototype.match),Py=Gy(String.prototype.replace),Fy=Gy(String.prototype.indexOf),Iy=Gy(String.prototype.trim),Ly=Gy(Number.prototype.toString),Ry=Gy(Boolean.prototype.toString),zy=typeof BigInt>`u`?null:Gy(BigInt.prototype.toString),By=typeof Symbol>`u`?null:Gy(Symbol.prototype.toString),Vy=Gy(Object.prototype.hasOwnProperty),Hy=Gy(Object.prototype.toString),Uy=Gy(RegExp.prototype.test),Wy=Ky(TypeError);function Gy(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return yy(e,t,n)}}function Ky(e){return function(){return by(e,[...arguments])}}function $(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:jy;if(dy&&dy(e,null),!Dy(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(fy(t)||(t[r]=e),i=e)}e[i]=!0}return e}function qy(e){for(let t=0;t<e.length;t++)Vy(e,t)||(e[t]=null);return e}function Jy(e){let t=_y(null);for(let r of uy(e)){var n=sy(r,2);let i=n[0],a=n[1];Vy(e,i)&&(t[i]=Dy(a)?qy(a):a&&typeof a==`object`&&a.constructor===Object?Jy(a):a)}return t}function Yy(e){switch(typeof e){case`string`:return e;case`number`:return Ly(e);case`boolean`:return Ry(e);case`bigint`:return zy?zy(e):`0`;case`symbol`:return By?By(e):`Symbol()`;case`undefined`:return Hy(e);case`function`:case`object`:{if(e===null)return Hy(e);let t=e,n=Xy(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Hy(e)}return Hy(e)}default:return Hy(e)}}function Xy(e,t){for(;e!==null;){let n=my(e,t);if(n){if(n.get)return Gy(n.get);if(typeof n.value==`function`)return Gy(n.value)}e=py(e)}function n(){return null}return n}function Zy(e,t){for(;e!==null;){let n=my(e,t);if(n)return n.get?Gy(n.get):null;e=py(e)}return null}function Qy(e){try{return Uy(e,``),!0}catch{return!1}}var $y=hy(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),eb=hy(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),tb=hy([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),nb=hy([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),rb=hy(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),ib=hy([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),ab=hy([`#text`]),ob=hy(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),sb=hy(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),cb=hy(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),lb=hy([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),ub=gy(/{{[\w\W]*|^[\w\W]*}}/g),db=gy(/<%[\w\W]*|^[\w\W]*%>/g),fb=gy(/\${[\w\W]*/g),pb=gy(/^data-[\-\w.\u00B7-\uFFFF]+$/),mb=gy(/^aria-[\-\w]+$/),hb=gy(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),gb=gy(/^(?:\w+script|data):/i),_b=gy(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),vb=gy(/^html$/i),yb=gy(/^[a-z][.\w]*(-[.\w]+)+$/i),bb=gy(/<[/\w!]/g),xb=gy(/<[/\w]/g),Sb=gy(/<\/no(script|embed|frames)/i),Cb=gy(/\/>/i),wb={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Tb=hy($({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),Eb=function(){return typeof window>`u`?null:window},Db=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Ob=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},kb=function(e,t,n,r){return Vy(e,t)&&Dy(e[t])?$(r.base?Jy(r.base):{},e[t],r.transform):n},Ab=function(e,t,n){let r=Vy(e,t)?e[t]:void 0;return r&&typeof r==`object`?Jy(r):n()};function jb(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Eb(),t=e=>jb(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==wb.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Xy(d,`cloneNode`),p=Xy(d,`remove`),m=Xy(d,`removeAttributeNode`),h=Xy(d,`nextSibling`),g=Xy(d,`childNodes`),_=Xy(d,`parentNode`),v=Xy(d,`shadowRoot`),y=Xy(d,`attributes`),b=o&&o.prototype?Xy(o.prototype,`nodeType`):null,x=o&&o.prototype?Xy(o.prototype,`nodeName`):null,S=o&&o.prototype?Xy(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName},T=Zy(d,`namespaceURI`),E=function(e){return T?T(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let D,O=``,k,A=!1,j=0,M=function(){if(j>0)throw Wy(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},N=function(e){M(),j++;try{return D.createHTML(e)}finally{j--}},P=function(e){M(),j++;try{return D.createScriptURL(e)}finally{j--}},F=function(){return A||=(k=Db(u,i),!0),k},ee=n,te=ee.implementation,ne=ee.createNodeIterator,re=ee.createDocumentFragment,ie=ee.getElementsByTagName,I=r.importNode,L=Ob();t.isSupported=typeof uy==`function`&&typeof _==`function`&&te&&te.createHTMLDocument!==void 0;let ae=ub,oe=db,se=fb,ce=pb,le=mb,ue=gb,de=_b,fe=yb,pe=hb,R=null,me=$({},[...$y,...eb,...tb,...rb,...ab]),z=null,he=$({},[...ob,...sb,...cb,...lb]),ge=Object.seal(_y(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),_e=null,ve=null,ye=Object.seal(_y(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),be=!0,xe=!0,Se=!1,Ce=!0,we=!1,Te=!0,Ee=!1,De=!1,Oe=null,ke=null,Ae=!1,je=!1,Me=!1,Ne=!1,Pe=!0,Fe=!1,Ie=`user-content-`,Le=!0,Re=!1,B=null,ze={},Be=null,Ve=$({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),He=null,Ue=$({},[`audio`,`video`,`img`,`source`,`image`,`track`]),We=null,Ge=$({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ke=`http://www.w3.org/1998/Math/MathML`,qe=`http://www.w3.org/2000/svg`,Je=`http://www.w3.org/1999/xhtml`,Ye=Je,Xe=!1,Ze=null,Qe=$({},[Ke,qe,Je],My),$e=hy([`mi`,`mo`,`mn`,`ms`,`mtext`]),et=$({},$e),tt=hy([`annotation-xml`]),nt=$({},tt),rt=$({},[`title`,`style`,`font`,`a`,`script`]),it=null,at=[`application/xhtml+xml`,`text/html`],ot=null,st=null,ct=n.createElement(`form`),lt=function(e){return e instanceof RegExp||e instanceof Function},ut=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(st&&st===e)return;e&&typeof e==`object`||(e={}),e=Jy(e),it=at.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,ot=it===`application/xhtml+xml`?My:jy,R=kb(e,`ALLOWED_TAGS`,me,{transform:ot}),z=kb(e,`ALLOWED_ATTR`,he,{transform:ot}),Ze=kb(e,`ALLOWED_NAMESPACES`,Qe,{transform:My}),We=kb(e,`ADD_URI_SAFE_ATTR`,Ge,{transform:ot,base:Ge}),He=kb(e,`ADD_DATA_URI_TAGS`,Ue,{transform:ot,base:Ue}),Be=kb(e,`FORBID_CONTENTS`,Ve,{transform:ot}),_e=kb(e,`FORBID_TAGS`,Jy({}),{transform:ot}),ve=kb(e,`FORBID_ATTR`,Jy({}),{transform:ot}),ze=Vy(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Jy(e.USE_PROFILES):e.USE_PROFILES:!1,be=e.ALLOW_ARIA_ATTR!==!1,xe=e.ALLOW_DATA_ATTR!==!1,Se=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ce=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,we=e.SAFE_FOR_TEMPLATES||!1,Te=e.SAFE_FOR_XML!==!1,Ee=e.WHOLE_DOCUMENT||!1,je=e.RETURN_DOM||!1,Me=e.RETURN_DOM_FRAGMENT||!1,Ne=e.RETURN_TRUSTED_TYPE||!1,Ae=e.FORCE_BODY||!1,Pe=e.SANITIZE_DOM!==!1,Fe=e.SANITIZE_NAMED_PROPS||!1,Le=e.KEEP_CONTENT!==!1,Re=e.IN_PLACE||!1,pe=Qy(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:hb,Ye=typeof e.NAMESPACE==`string`?e.NAMESPACE:Je,et=Ab(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>$({},$e)),nt=Ab(e,`HTML_INTEGRATION_POINTS`,()=>$({},tt));let t=Ab(e,`CUSTOM_ELEMENT_HANDLING`,()=>_y(null));if(ge=_y(null),Vy(t,`tagNameCheck`)&&lt(t.tagNameCheck)&&(ge.tagNameCheck=t.tagNameCheck),Vy(t,`attributeNameCheck`)&&lt(t.attributeNameCheck)&&(ge.attributeNameCheck=t.attributeNameCheck),Vy(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(ge.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),gy(ge),we&&(xe=!1),Me&&(je=!0),ze&&(R=$({},ab),z=_y(null),ze.html===!0&&($(R,$y),$(z,ob)),ze.svg===!0&&($(R,eb),$(z,sb),$(z,lb)),ze.svgFilters===!0&&($(R,tb),$(z,sb),$(z,lb)),ze.mathMl===!0&&($(R,rb),$(z,cb),$(z,lb))),ye.tagCheck=null,ye.attributeCheck=null,Vy(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?ye.tagCheck=e.ADD_TAGS:Dy(e.ADD_TAGS)&&(R===me&&(R=Jy(R)),$(R,e.ADD_TAGS,ot))),Vy(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?ye.attributeCheck=e.ADD_ATTR:Dy(e.ADD_ATTR)&&(z===he&&(z=Jy(z)),$(z,e.ADD_ATTR,ot))),Vy(e,`ADD_FORBID_CONTENTS`)&&Dy(e.ADD_FORBID_CONTENTS)&&(Be===Ve&&(Be=Jy(Be)),$(Be,e.ADD_FORBID_CONTENTS,ot)),Le&&(R[`#text`]=!0),Ee&&$(R,[`html`,`head`,`body`]),R.table&&($(R,[`tbody`]),delete _e.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Wy(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Wy(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=D;D=e.TRUSTED_TYPES_POLICY;try{O=N(``)}catch(e){throw D=t,e}}else e.TRUSTED_TYPES_POLICY===null?(D=void 0,O=``):(D===void 0&&(D=F()),D&&typeof O==`string`&&(O=N(``)));hy&&hy(e),st=e},dt=$({},[...eb,...tb,...nb]),ft=$({},[...rb,...ib]),pt=function(e,t,n){return t.namespaceURI===Je?e===`svg`:t.namespaceURI===Ke?e===`svg`&&(n===`annotation-xml`||et[n]):!!dt[e]},mt=function(e,t,n){return t.namespaceURI===Je?e===`math`:t.namespaceURI===qe?e===`math`&&nt[n]:!!ft[e]},ht=function(e,t,n){return t.namespaceURI===qe&&!nt[n]||t.namespaceURI===Ke&&!et[n]?!1:!ft[e]&&(rt[e]||!dt[e])},gt=function(e){let t=E(e),n=jy(w(e)),r=_(e),i,a;return r&&C(r)===wb.element?(i={namespaceURI:E(r)},a=jy(w(r))):(i={namespaceURI:Ye},a=`template`),Ze[t]?t===qe?pt(n,i,a):t===Ke?mt(n,i,a):t===Je?ht(n,i,a):!!(it===`application/xhtml+xml`&&Ze[t]):!1},_t=function(e){wy(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw Wy(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},vt=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},yt=function(e){Ct(e);let t=g(e);t&&xy(Ty(t),e=>{try{p(e)}catch{}});let n=C(e)===wb.element?y(e):null;if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&vt(e,r,i)}},bt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}wy(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(je||Me)try{_t(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},xt=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||z[ot(i)]||vt(e,r,i)}},St=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&C(e)===wb.element){let t=v(e);Rt(t)&&r.push(t)}let i=g(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},Ct=function(e){St(e,e=>{C(e)===wb.element&&xt(e)})},wt=function(e){let t=[];return St(e,e=>{t.push(e)},!0),t},Tt=function(e,t){let n=Oy();xy(wt(e),e=>{C(e)===wb.element&&ky(n,e)}),xy(t,e=>{C(e)===wb.element&&!Ay(n,e)&&xt(e)})},Et=function(e,n){let r=!1;return xy(t.removed,t=>{t.element&&(r||=t.element===e,Ct(t.element))}),Tt(e,n),r},Dt=function(e,t){let n=B,r=null,i=()=>(r||(r=Oy(),xy(t,e=>{ky(r,e)})),r);for(let t=0;;t++){let r=wt(e),a=[e],o=!1;if(xy(r,e=>{C(e)===wb.documentFragment?wy(a,e):!o&&!Ay(n,e)&&(o=Ay(i(),e))}),!o)return;if(t>=8)throw Wy(`the tree kept changing during in-place sanitization; refusing to return it`);xy(a,(t,n)=>{Ot(t,n>0,e,i())})}},Ot=function(e,t,n,r){let i=Nt(e),a;for(;a=i.nextNode();)Ay(r,a)&&!Ay(B,a)&&(t&&Bt(L.uponSanitizeShadowNode,a,null),Kt(a,n),$t(a,n),Rt(a.content)&&en(a.content))},kt=function(e){B&&ky(B,e)},At=function(e,t){return Te?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},jt=function(e){Te&&St(e,e=>{let t=C(e);if(t===wb.processingInstruction||t===wb.comment&&Uy(xb,e.data)){try{p(e)}catch{}return!1}if(t===wb.element){let t=e,n=ot(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&At(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},Mt=function(e){let t=null,r=null;if(Ae)e=`<remove></remove>`+e;else{let t=Ny(e,/^[\r\n\t ]+/);r=t&&t[0]}it===`application/xhtml+xml`&&Ye===Je&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=D?N(e):e;if(Ye===Je)try{t=new l().parseFromString(i,it)}catch{}if(!t||!t.documentElement){t=te.createDocument(Ye,`template`,null);try{t.documentElement.innerHTML=Xe?O:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ye===Je?ie.call(t,Ee?`html`:`body`)[0]:Ee?t.documentElement:a},Nt=function(e){let t=S?S(e):e.ownerDocument;return ne.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Pt=function(e){return e=Py(e,ae,` `),e=Py(e,oe,` `),e=Py(e,se,` `),e},Ft=function(e){It(e);let t=e.querySelectorAll?.call(e,`template`);t&&xy(t,e=>{Rt(e.content)&&Ft(e.content)})},It=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=ne.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=Pt(r.data),r=n.nextNode()},Lt=function(e){let t=x?x(e):null;return typeof t!=`string`||ot(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},Rt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===wb.documentFragment}catch{return!1}},zt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Bt(e,n,r){e.length!==0&&xy(e,e=>{e.call(t,n,r,st)})}let Vt=function(e,t){return!!(Te&&e.hasChildNodes()&&!zt(e.firstElementChild)&&Uy(bb,e.textContent)&&Uy(bb,e.innerHTML)||Te&&Tb[t]&&C(e)===wb.element&&E(e)===Je&&(zt(e.firstElementChild)||typeof e.textContent==`string`&&Uy(bb,e.textContent))||e.nodeType===wb.processingInstruction||Te&&e.nodeType===wb.comment&&Uy(xb,e.data))},Ht=function(e,t){return e instanceof RegExp?Uy(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Ut=function(e,t,n){if(!_e[t]&&Yt(t)&&Ht(ge.tagNameCheck,t))return!1;if(Le&&!Be[t]&&!Be[jy(t)]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return _t(e),!0},Wt=function(e,t,n,r){return e.length===0?t:t===n||t===r?Jy(t):t},Gt=function(e,t){return e===t||_(e)!==null?!1:(Re&&Ct(e),!0)},Kt=function(e,n){if(kt(e),Bt(L.beforeSanitizeElements,e,null),Gt(e,n))return!0;if(Lt(e))return _t(e),!0;let r=ot(w(e));if(R=Wt(L.uponSanitizeElement,R,me,Oe),Bt(L.uponSanitizeElement,e,{tagName:r,allowedTags:R}),Gt(e,n))return!0;if(Vt(e,r))return _t(e),!0;if(_e[r]||!(ye.tagCheck instanceof Function&&ye.tagCheck(r))&&!R[r]){let t=Ut(e,r,n);return t===!1&&(Bt(L.afterSanitizeElements,e,null),Gt(e,n))?!0:t}if(C(e)===wb.element&&!gt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Uy(Sb,e.innerHTML))return _t(e),!0;if(we&&e.nodeType===wb.text){let n=Pt(e.textContent);e.textContent!==n&&(wy(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Bt(L.afterSanitizeElements,e,null),Gt(e,n)},qt=function(e,t,r){if(ve[t]||At(t,e)||Pe&&(t===`id`||t===`name`)&&(r in n||r in ct))return!1;let i=z[t]||ye.attributeCheck instanceof Function&&ye.attributeCheck(t,e);return xe&&Uy(ce,t)||be&&Uy(le,t)?!0:i?We[t]||Uy(pe,Py(r,de,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Fy(r,`data:`)===0&&He[e]||Se&&!Uy(ue,Py(r,de,``))?!0:!r:Yt(e)&&Ht(ge.tagNameCheck,e)&&Ht(ge.attributeNameCheck,t,e)||t===`is`&&ge.allowCustomizedBuiltInElements&&Ht(ge.tagNameCheck,r)},Jt=$({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Yt=function(e){return!Jt[jy(e)]&&Uy(fe,e)},Xt=function(e,t,n,r){if(D&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return N(r);case`TrustedScriptURL`:return P(r)}return r},Zt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Lt(e)||(_t(e),!1)}catch{return bt(t,e),!1}},Qt=function(e,t){return Te&&Uy(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:jy(e)===`attributename`&&Ny(t,`href`)!==null},$t=function(e,n){if(Bt(L.beforeSanitizeAttributes,e,null),Gt(e,n))return;let r=e.attributes;if(!r||Lt(e))return;z=Wt(L.uponSanitizeAttribute,z,he,ke);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:z,forceKeepAttr:void 0},a=r.length,o=ot(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=ot(s),d=l,f=s===`value`?d:Iy(d),p=!1;i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,Bt(L.uponSanitizeAttribute,e,i),f=i.attrValue,Fe&&(u===`id`||u===`name`)&&Fy(f,Ie)!==0&&(bt(s,e,n),f=Ie+f,p=!0),Qt(s,f)?bt(s,e,n):i.forceKeepAttr||(i.keepAttr?!Ce&&Uy(Cb,f)?bt(s,e,n):(we&&(f=Pt(f)),qt(o,u,f)?(f=Xt(o,u,c,f),f!==d&&Zt(e,s,c,f)&&p&&Cy(t.removed)):bt(s,e,n)):bt(s,e,n))}Bt(L.afterSanitizeAttributes,e,null),Gt(e,n)},en=function(e){let t=null,n=Nt(e);for(Bt(L.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Bt(L.uponSanitizeShadowNode,t,null),Kt(t,e),$t(t,e),Rt(t.content)&&en(t.content),C(t)===wb.element){let e=v(t);Rt(e)&&(tn(e),en(e))}we&&It(e),Bt(L.afterSanitizeShadowDOM,e,null)},tn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){en(e.shadow);continue}let n=e.node,r=C(n)===wb.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&ot(e)===`template`){let e=n.content;Rt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Rt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Xe=!e,Xe&&(e=`<!-->`),typeof e!=`string`&&!zt(e)&&(e=Yy(e),typeof e!=`string`))throw Wy(`dirty is not a string, aborting`);if(!t.isSupported)return e;De?(R=Oe,z=ke):ut(n),(L.uponSanitizeElement.length>0||L.uponSanitizeAttribute.length>0)&&(R=Jy(R)),L.uponSanitizeAttribute.length>0&&(z=Jy(z)),t.removed=[];let c=Re&&typeof e!=`string`&&zt(e),l=[],u=B;if(c){jt(e);let t=w(e);if(typeof t==`string`){let n=ot(t);if(!R[n]||_e[n])throw yt(e),Wy(`root node is forbidden and cannot be sanitized in-place`)}if(Lt(e))throw yt(e),Wy(`root node is clobbered and cannot be sanitized in-place`);l=wt(e),B=Oy()}else if(zt(e))i=Mt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===wb.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),tn(i);else{if(!je&&!we&&!Ee&&e.indexOf(`<`)===-1)return D&&Ne?N(e):e;if(i=Mt(e),!i)return je?null:Ne?O:``}i&&Ae&&_t(i.firstChild);let d=c?e:i;try{c&&tn(e);let t=Nt(d);for(;o=t.nextNode();)Kt(o,d),$t(o,d),Rt(o.content)&&en(o.content);c&&Dt(e,l)}catch(t){throw c&&(yt(e),Et(e,l)),t}finally{B=u}if(c){if(Et(e,l))throw Wy(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return we&&Ft(e),e}if(je){if(we&&Ft(i),Me)for(s=re.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(z.shadowroot||z.shadowrootmode)&&(s=I.call(r,s,!0)),s}let f=Ee?i.outerHTML:i.innerHTML;return Ee&&R[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Uy(vb,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
45
- `+f),we&&(f=Pt(f)),D&&Ne?N(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ut(e),De=!0,Oe=R,ke=z},t.clearConfig=function(){st=null,De=!1,Oe=null,ke=null,D=k,O=``},t.isValidAttribute=function(e,t,n){st||ut({});let r=ot(e),i=ot(t);return typeof n==`string`&&(Qt(t,n)||!Ce&&Uy(Cb,n))?!1:qt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Vy(L,e)&&wy(L[e],t)},t.removeHook=function(e,t){if(Vy(L,e)){if(t!==void 0){let n=Sy(L[e],t);return n===-1?void 0:Ey(L[e],n,1)[0]}return Cy(L[e])}},t.removeHooks=function(e){Vy(L,e)&&(L[e]=[])},t.removeAllHooks=function(){L=Ob()},t}var Mb=jb(),Nb=null,Pb=new Map;function Fb(){return Nb??=r(()=>import(`./lazy-BYuTmsKJ.js`).then(e=>e.t).then(e=>({status:`loaded`,pele:e}),()=>({status:`failed`})),__vite__mapDeps([5,1,6])),Nb}function Ib(e,t){let n=Pb.get(t);return n||(n=e.load(t).then(()=>({status:`loaded`,pele:e}),()=>({status:`failed`})),Pb.set(t,n)),n}function Lb(e,t){try{return e.detectType(t)}catch{return null}}var Rb=null;function zb(){return Rb??=r(async()=>{let{default:e}=await import(`./katex-B940_AAO.js`);return{default:e}},[]).then(({default:e})=>{let t=new Map,n=null;return(r,i)=>{let a=`${i}:${r}`;if(t.has(a))return t.get(a);let o=null;try{n||(n=document.createElement(`div`),n.style.cssText=`position:absolute;left:-9999px;visibility:hidden;display:inline-block;white-space:nowrap`,document.body.append(n)),n.style.fontSize=`${i}px`,n.innerHTML=e.renderToString(r,{displayMode:!0,output:`mathml`,throwOnError:!0,trust:!1,strict:`ignore`,maxSize:20,maxExpand:1e3});let t=n.querySelector(`math`);if(t?.querySelector(`annotation`)?.remove(),t){let{width:e,height:n}=t.getBoundingClientRect();o={html:t.outerHTML,width:e,height:n}}}catch{}return t.set(a,o),o}},()=>null),Rb}var Bb=new Set([`math`,`menclose`,`mfrac`,`mi`,`mlabeledtr`,`mn`,`mo`,`mover`,`mpadded`,`mphantom`,`mroot`,`mrow`,`mspace`,`msqrt`,`mstyle`,`msub`,`msubsup`,`msup`,`mtable`,`mtd`,`mtext`,`mtr`,`munder`,`munderover`]),Vb=new Set(`accent.accentunder.columnalign.columnlines.columnspacing.depth.displaystyle.fence.largeop.linebreak.linethickness.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.notation.rowlines.rowspacing.rspace.scriptlevel.separator.stretchy.voffset`.split(`.`)),Hb=null;function Ub(e){return Hb??=Mb(window),Hb.sanitize(e,{FORBID_ATTR:[`href`,`xlink:href`,`src`,`srcset`],FORBID_TAGS:[`a`,`image`,`foreignObject`,`style`],USE_PROFILES:{svg:!0,svgFilters:!0},RETURN_DOM_FRAGMENT:!0})}function Wb(e){return Hb??=Mb(window),Hb.sanitize(e,{ADD_TAGS:[`foreignObject`,...Bb],ADD_ATTR:(e,t)=>Bb.has(t)&&Vb.has(e),HTML_INTEGRATION_POINTS:{foreignobject:!0},FORBID_ATTR:[`href`,`xlink:href`,`src`,`srcset`],FORBID_TAGS:[`a`,`img`,`image`,`script`,`style`],USE_PROFILES:{svg:!0,svgFilters:!0,html:!0},RETURN_DOM_FRAGMENT:!0})}var Gb=[`--pele-bg`,`--pele-fg`,`--pele-muted`,`--pele-line`,`--pele-surface`,`--pele-surface-alt`,`--pele-border`,`--pele-accent`,`--pele-critical`,...Array.from({length:8},(e,t)=>`--pele-series-${t+1}`)],Kb=null;function qb(e){let t=e.cloneNode(!0),n=getComputedStyle(e);for(let e of Gb){let r=n.getPropertyValue(e).trim();r&&t.style.setProperty(e,r)}return t.style.maxWidth=`none`,t.style.backgroundColor=getComputedStyle(document.body).backgroundColor,Kb&&URL.revokeObjectURL(Kb),Kb=URL.createObjectURL(new Blob([new XMLSerializer().serializeToString(t)],{type:`image/svg+xml`})),Kb}function Jb(e){let t=(0,H.c)(32),{source:n,onExpand:r}=e,[,i]=(0,V.useState)(0),[a,o]=(0,V.useState)(null),s=(0,V.useRef)(null),c=n.trim(),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=Fb(),t[0]=l):l=t[0];let u=(0,V.use)(l),d=u.status===`loaded`?Lb(u.pele,c):null,f=u.status===`loaded`&&d?(0,V.use)(Ib(u.pele,d)):u,p=c.includes(`$$`)?(0,V.use)(zb()):null,m;t[1]!==f.pele||t[2]!==f.status||t[3]!==p||t[4]!==c?(m=()=>{let e=s.current;if(f.status!==`loaded`||!e)return;let t=f.pele.mount(e,c,{links:!1,images:!1,zoom:!1,autoDirection:!1,...p?{math:p,sanitize:Wb}:{sanitize:Ub},onRender:()=>o(null),onError:e=>o(e instanceof Error?e.message:`The diagram could not be rendered.`)});return()=>t.destroy()},t[1]=f.pele,t[2]=f.status,t[3]=p,t[4]=c,t[5]=m):m=t[5];let h;if(t[6]!==f||t[7]!==p||t[8]!==c?(h=[f,p,c],t[6]=f,t[7]=p,t[8]=c,t[9]=h):h=t[9],(0,V.useLayoutEffect)(m,h),f.status===`failed`){let e;t[10]!==u.status||t[11]!==i||t[12]!==d?(e=()=>{u.status===`failed`&&(Nb=null),d&&Pb.delete(d),i(Yb)},t[10]=u.status,t[11]=i,t[12]=d,t[13]=e):e=t[13];let r;return t[14]!==n||t[15]!==e?(r=(0,U.jsx)(Xb,{message:`The diagram renderer failed to load.`,source:n,onRetry:e}),t[14]=n,t[15]=e,t[16]=r):r=t[16],r}let g;t[17]===n?g=t[18]:(g=hg(n,`mermaid`),t[17]=n,t[18]=g);let _;t[19]!==a||t[20]!==n?(_=a?(0,U.jsx)(Xb,{message:a,source:n}):null,t[19]=a,t[20]=n,t[21]=_):_=t[21];let v=a!==null,y;t[22]===r?y=t[23]:(y=()=>{let e=s.current?.querySelector(`svg`);e&&r(qb(e))},t[22]=r,t[23]=y);let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,U.jsx)(`span`,{ref:s,className:`flex w-full justify-center`}),t[24]=b):b=t[24];let x;t[25]!==v||t[26]!==y?(x=(0,U.jsx)(`button`,{type:`button`,"aria-label":`Expand diagram`,hidden:v,className:`block w-full cursor-zoom-in rounded-md focus-visible:outline-2 focus-visible:outline-ring`,onClick:y,children:b}),t[25]=v,t[26]=y,t[27]=x):x=t[27];let S;return t[28]!==g||t[29]!==_||t[30]!==x?(S=(0,U.jsxs)(`div`,{className:`chat-markdown-mermaid overflow-x-auto`,"data-markdown-mermaid":``,"data-markdown-copy":g,children:[_,x]}),t[28]=g,t[29]=_,t[30]=x,t[31]=S):S=t[31],S}function Yb(e){return e+1}function Xb(e){let t=(0,H.c)(12),{message:n,source:r,onRetry:i}=e,a;t[0]===n?a=t[1]:(a=(0,U.jsxs)(`p`,{className:`m-0 text-xs text-destructive`,children:[`Unable to render diagram: `,n]}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=i?(0,U.jsx)(we,{type:`button`,variant:`ghost`,size:`xs`,onClick:i,children:`Retry`}):null,t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=(0,U.jsx)(`pre`,{"data-thread-find-ignore":!0,className:`mt-2 mb-0 overflow-auto font-mono text-xs whitespace-pre-wrap`,children:r}),t[7]=r,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,U.jsxs)(`div`,{children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function Zb(e){return e.replaceAll(`\\`,`/`)}function Qb(e){return e.replace(/[\\/]+$/,``)}function $b(e){return e.replace(/^\.\/+/,``).replace(/^\/+/,``)}function ex(e,t){let n=yn(e),r=Dt(Zb(n.path)),i=r;if(t){let e=Dt(Zb(Qb(t))),n=St(e),a=Tt(Dt(t)),o=a?r.toLowerCase():r,s=a?e.toLowerCase():e,c=`${s}/`,l=`${a?n.toLowerCase():n}/`;if(o===s)i=n;else if(o.startsWith(c))i=`${n}/${r.slice(e.length+1)}`;else if(!r.startsWith(`/`)){let e=$b(r);i=o.startsWith(l)?r:`${n}/${e}`}}return bn({...n,path:i})}function tx(e,t){return vi(e,t)}function nx(e){return/\.pdf$/i.test(e.split(/[?#]/,1)[0]??``)}function rx(e){if(!e)return null;let t=_n(Yn(e));return t?`${t.path}${t.hash}`:null}function ix(e){try{return ot(new URL(e))}catch{return!1}}function ax(e,t,n=t){let r=Gn(e);return r===null?null:sx(r,t,ox(r,t,n)?t:n)}function ox(e,t,n){return!t||!n||!zn(e)||/^(?:~|\.{1,2})\//.test(e)||!yn(e).path.includes(`/`)?!1:wt(n,t)!==null}function sx(e,t,n=t){let r=Vn(e,t,n);if(!r)return null;let i=e?Bn(e)?.endLine:void 0;return{...cx(r,t),...i===void 0?{}:{endLine:i}}}function cx(e,t){let{path:n,line:r,column:i}=yn(e);return{filePath:n,targetPath:e,displayPath:ex(e,t),workspaceRelativePath:wt(n,t),basename:St(n),...r===void 0?{}:{line:r},...i===void 0?{}:{column:i}}}var lx=0;function ux(){lx+=1;let e=lx;return()=>e===lx}function dx(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t>=0?e.slice(t+1):e}function fx(e){let t=e.trim();return t!==`.`&&t!==`..`&&t.length>0&&!t.includes(`/`)&&!t.includes(`\\`)}function px(e,t){let n=e.trim();if(!n)return null;let r=t.filter(e=>e.kind===`file`),i=r.find(e=>dx(e.path)===n);if(i)return i.path;let a=n.toLowerCase(),o=r.filter(e=>dx(e.path).toLowerCase()===a);return o.length===1?o[0]?.path??null:null}var mx=5e5,hx=new Map,gx=0,_x=0,vx=200,yx=e=>e.length+vx;function bx(e,t){if(!(yx(e)>mx/4)){hx.set(e,t),gx+=yx(e);for(let e of hx.keys()){if(gx<=mx)break;hx.delete(e),gx-=yx(e)}}}function xx({remarkPlugins:e,rehypePlugins:t,components:n,urlTransform:r}){let i=li().use(Ir).use(e).use(Bo,{allowDangerousHtml:!0}).use(t).freeze(),a=`${_x++}\u0000`,o=e=>{`children`in e&&e.children.forEach((t,n)=>{if(t.type===`raw`)e.children[n]={type:`text`,value:t.value};else{if(t.type===`element`)for(let[e,n]of Object.entries(Yh))Object.hasOwn(t.properties,e)&&(n===null||n.includes(t.tagName))&&(t.properties[e]=r(String(t.properties[e]||``),e,t));o(t)}})};return(e,t)=>{let r=a+e,s=hx.get(r);if(s!==void 0)return hx.delete(r),hx.set(r,s),s;let c=new ni(e),l=i.runSync(i.parse(c),c);o(l);let u=Dh(l,{Fragment:U.Fragment,components:n,ignoreInvalidStyle:!0,jsx:U.jsx,jsxs:U.jsxs,passKeys:!0,passNode:!0});return t&&bx(r,u),u}}var Sx=/^ {0,3}(?:\[[^\]\n]+\]:|<[A-Za-z!?/]|:::|\$\$)|\[\^/m,Cx=/^ {0,3}(`{3,}|~{3,})/,wx=/^(?:[ \t]|(?:[-*+]|\d{1,9}[.)])(?:[ \t]|$))/;function Tx(e){if(e.includes(`\r`)||Sx.test(e))return null;let t=[],n=0,r=0,i=null,a=0,o=!1;for(let s of e.split(`
45
+ `+f),we&&(f=Pt(f)),D&&Ne?N(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ut(e),De=!0,Oe=R,ke=z},t.clearConfig=function(){st=null,De=!1,Oe=null,ke=null,D=k,O=``},t.isValidAttribute=function(e,t,n){st||ut({});let r=ot(e),i=ot(t);return typeof n==`string`&&(Qt(t,n)||!Ce&&Uy(Cb,n))?!1:qt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Vy(L,e)&&wy(L[e],t)},t.removeHook=function(e,t){if(Vy(L,e)){if(t!==void 0){let n=Sy(L[e],t);return n===-1?void 0:Ey(L[e],n,1)[0]}return Cy(L[e])}},t.removeHooks=function(e){Vy(L,e)&&(L[e]=[])},t.removeAllHooks=function(){L=Ob()},t}var Mb=jb(),Nb=null,Pb=new Map;function Fb(){return Nb??=r(()=>import(`./lazy-C1dqAep6.js`).then(e=>e.t).then(e=>({status:`loaded`,pele:e}),()=>({status:`failed`})),__vite__mapDeps([5,1,6])),Nb}function Ib(e,t){let n=Pb.get(t);return n||(n=e.load(t).then(()=>({status:`loaded`,pele:e}),()=>({status:`failed`})),Pb.set(t,n)),n}function Lb(e,t){try{return e.detectType(t)}catch{return null}}var Rb=null;function zb(){return Rb??=r(async()=>{let{default:e}=await import(`./katex-B940_AAO.js`);return{default:e}},[]).then(({default:e})=>{let t=new Map,n=null;return(r,i)=>{let a=`${i}:${r}`;if(t.has(a))return t.get(a);let o=null;try{n||(n=document.createElement(`div`),n.style.cssText=`position:absolute;left:-9999px;visibility:hidden;display:inline-block;white-space:nowrap`,document.body.append(n)),n.style.fontSize=`${i}px`,n.innerHTML=e.renderToString(r,{displayMode:!0,output:`mathml`,throwOnError:!0,trust:!1,strict:`ignore`,maxSize:20,maxExpand:1e3});let t=n.querySelector(`math`);if(t?.querySelector(`annotation`)?.remove(),t){let{width:e,height:n}=t.getBoundingClientRect();o={html:t.outerHTML,width:e,height:n}}}catch{}return t.set(a,o),o}},()=>null),Rb}var Bb=new Set([`math`,`menclose`,`mfrac`,`mi`,`mlabeledtr`,`mn`,`mo`,`mover`,`mpadded`,`mphantom`,`mroot`,`mrow`,`mspace`,`msqrt`,`mstyle`,`msub`,`msubsup`,`msup`,`mtable`,`mtd`,`mtext`,`mtr`,`munder`,`munderover`]),Vb=new Set(`accent.accentunder.columnalign.columnlines.columnspacing.depth.displaystyle.fence.largeop.linebreak.linethickness.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.notation.rowlines.rowspacing.rspace.scriptlevel.separator.stretchy.voffset`.split(`.`)),Hb=null;function Ub(e){return Hb??=Mb(window),Hb.sanitize(e,{FORBID_ATTR:[`href`,`xlink:href`,`src`,`srcset`],FORBID_TAGS:[`a`,`image`,`foreignObject`,`style`],USE_PROFILES:{svg:!0,svgFilters:!0},RETURN_DOM_FRAGMENT:!0})}function Wb(e){return Hb??=Mb(window),Hb.sanitize(e,{ADD_TAGS:[`foreignObject`,...Bb],ADD_ATTR:(e,t)=>Bb.has(t)&&Vb.has(e),HTML_INTEGRATION_POINTS:{foreignobject:!0},FORBID_ATTR:[`href`,`xlink:href`,`src`,`srcset`],FORBID_TAGS:[`a`,`img`,`image`,`script`,`style`],USE_PROFILES:{svg:!0,svgFilters:!0,html:!0},RETURN_DOM_FRAGMENT:!0})}var Gb=[`--pele-bg`,`--pele-fg`,`--pele-muted`,`--pele-line`,`--pele-surface`,`--pele-surface-alt`,`--pele-border`,`--pele-accent`,`--pele-critical`,...Array.from({length:8},(e,t)=>`--pele-series-${t+1}`)],Kb=null;function qb(e){let t=e.cloneNode(!0),n=getComputedStyle(e);for(let e of Gb){let r=n.getPropertyValue(e).trim();r&&t.style.setProperty(e,r)}return t.style.maxWidth=`none`,t.style.backgroundColor=getComputedStyle(document.body).backgroundColor,Kb&&URL.revokeObjectURL(Kb),Kb=URL.createObjectURL(new Blob([new XMLSerializer().serializeToString(t)],{type:`image/svg+xml`})),Kb}function Jb(e){let t=(0,H.c)(32),{source:n,onExpand:r}=e,[,i]=(0,V.useState)(0),[a,o]=(0,V.useState)(null),s=(0,V.useRef)(null),c=n.trim(),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=Fb(),t[0]=l):l=t[0];let u=(0,V.use)(l),d=u.status===`loaded`?Lb(u.pele,c):null,f=u.status===`loaded`&&d?(0,V.use)(Ib(u.pele,d)):u,p=c.includes(`$$`)?(0,V.use)(zb()):null,m;t[1]!==f.pele||t[2]!==f.status||t[3]!==p||t[4]!==c?(m=()=>{let e=s.current;if(f.status!==`loaded`||!e)return;let t=f.pele.mount(e,c,{links:!1,images:!1,zoom:!1,autoDirection:!1,...p?{math:p,sanitize:Wb}:{sanitize:Ub},onRender:()=>o(null),onError:e=>o(e instanceof Error?e.message:`The diagram could not be rendered.`)});return()=>t.destroy()},t[1]=f.pele,t[2]=f.status,t[3]=p,t[4]=c,t[5]=m):m=t[5];let h;if(t[6]!==f||t[7]!==p||t[8]!==c?(h=[f,p,c],t[6]=f,t[7]=p,t[8]=c,t[9]=h):h=t[9],(0,V.useLayoutEffect)(m,h),f.status===`failed`){let e;t[10]!==u.status||t[11]!==i||t[12]!==d?(e=()=>{u.status===`failed`&&(Nb=null),d&&Pb.delete(d),i(Yb)},t[10]=u.status,t[11]=i,t[12]=d,t[13]=e):e=t[13];let r;return t[14]!==n||t[15]!==e?(r=(0,U.jsx)(Xb,{message:`The diagram renderer failed to load.`,source:n,onRetry:e}),t[14]=n,t[15]=e,t[16]=r):r=t[16],r}let g;t[17]===n?g=t[18]:(g=hg(n,`mermaid`),t[17]=n,t[18]=g);let _;t[19]!==a||t[20]!==n?(_=a?(0,U.jsx)(Xb,{message:a,source:n}):null,t[19]=a,t[20]=n,t[21]=_):_=t[21];let v=a!==null,y;t[22]===r?y=t[23]:(y=()=>{let e=s.current?.querySelector(`svg`);e&&r(qb(e))},t[22]=r,t[23]=y);let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,U.jsx)(`span`,{ref:s,className:`flex w-full justify-center`}),t[24]=b):b=t[24];let x;t[25]!==v||t[26]!==y?(x=(0,U.jsx)(`button`,{type:`button`,"aria-label":`Expand diagram`,hidden:v,className:`block w-full cursor-zoom-in rounded-md focus-visible:outline-2 focus-visible:outline-ring`,onClick:y,children:b}),t[25]=v,t[26]=y,t[27]=x):x=t[27];let S;return t[28]!==g||t[29]!==_||t[30]!==x?(S=(0,U.jsxs)(`div`,{className:`chat-markdown-mermaid overflow-x-auto`,"data-markdown-mermaid":``,"data-markdown-copy":g,children:[_,x]}),t[28]=g,t[29]=_,t[30]=x,t[31]=S):S=t[31],S}function Yb(e){return e+1}function Xb(e){let t=(0,H.c)(12),{message:n,source:r,onRetry:i}=e,a;t[0]===n?a=t[1]:(a=(0,U.jsxs)(`p`,{className:`m-0 text-xs text-destructive`,children:[`Unable to render diagram: `,n]}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=i?(0,U.jsx)(we,{type:`button`,variant:`ghost`,size:`xs`,onClick:i,children:`Retry`}):null,t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=(0,U.jsx)(`pre`,{"data-thread-find-ignore":!0,className:`mt-2 mb-0 overflow-auto font-mono text-xs whitespace-pre-wrap`,children:r}),t[7]=r,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,U.jsxs)(`div`,{children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function Zb(e){return e.replaceAll(`\\`,`/`)}function Qb(e){return e.replace(/[\\/]+$/,``)}function $b(e){return e.replace(/^\.\/+/,``).replace(/^\/+/,``)}function ex(e,t){let n=yn(e),r=Dt(Zb(n.path)),i=r;if(t){let e=Dt(Zb(Qb(t))),n=St(e),a=Tt(Dt(t)),o=a?r.toLowerCase():r,s=a?e.toLowerCase():e,c=`${s}/`,l=`${a?n.toLowerCase():n}/`;if(o===s)i=n;else if(o.startsWith(c))i=`${n}/${r.slice(e.length+1)}`;else if(!r.startsWith(`/`)){let e=$b(r);i=o.startsWith(l)?r:`${n}/${e}`}}return bn({...n,path:i})}function tx(e,t){return vi(e,t)}function nx(e){return/\.pdf$/i.test(e.split(/[?#]/,1)[0]??``)}function rx(e){if(!e)return null;let t=_n(Yn(e));return t?`${t.path}${t.hash}`:null}function ix(e){try{return ot(new URL(e))}catch{return!1}}function ax(e,t,n=t){let r=Gn(e);return r===null?null:sx(r,t,ox(r,t,n)?t:n)}function ox(e,t,n){return!t||!n||!zn(e)||/^(?:~|\.{1,2})\//.test(e)||!yn(e).path.includes(`/`)?!1:wt(n,t)!==null}function sx(e,t,n=t){let r=Vn(e,t,n);if(!r)return null;let i=e?Bn(e)?.endLine:void 0;return{...cx(r,t),...i===void 0?{}:{endLine:i}}}function cx(e,t){let{path:n,line:r,column:i}=yn(e);return{filePath:n,targetPath:e,displayPath:ex(e,t),workspaceRelativePath:wt(n,t),basename:St(n),...r===void 0?{}:{line:r},...i===void 0?{}:{column:i}}}var lx=0;function ux(){lx+=1;let e=lx;return()=>e===lx}function dx(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t>=0?e.slice(t+1):e}function fx(e){let t=e.trim();return t!==`.`&&t!==`..`&&t.length>0&&!t.includes(`/`)&&!t.includes(`\\`)}function px(e,t){let n=e.trim();if(!n)return null;let r=t.filter(e=>e.kind===`file`),i=r.find(e=>dx(e.path)===n);if(i)return i.path;let a=n.toLowerCase(),o=r.filter(e=>dx(e.path).toLowerCase()===a);return o.length===1?o[0]?.path??null:null}var mx=5e5,hx=new Map,gx=0,_x=0,vx=200,yx=e=>e.length+vx;function bx(e,t){if(!(yx(e)>mx/4)){hx.set(e,t),gx+=yx(e);for(let e of hx.keys()){if(gx<=mx)break;hx.delete(e),gx-=yx(e)}}}function xx({remarkPlugins:e,rehypePlugins:t,components:n,urlTransform:r}){let i=li().use(Ir).use(e).use(Bo,{allowDangerousHtml:!0}).use(t).freeze(),a=`${_x++}\u0000`,o=e=>{`children`in e&&e.children.forEach((t,n)=>{if(t.type===`raw`)e.children[n]={type:`text`,value:t.value};else{if(t.type===`element`)for(let[e,n]of Object.entries(Yh))Object.hasOwn(t.properties,e)&&(n===null||n.includes(t.tagName))&&(t.properties[e]=r(String(t.properties[e]||``),e,t));o(t)}})};return(e,t)=>{let r=a+e,s=hx.get(r);if(s!==void 0)return hx.delete(r),hx.set(r,s),s;let c=new ni(e),l=i.runSync(i.parse(c),c);o(l);let u=Dh(l,{Fragment:U.Fragment,components:n,ignoreInvalidStyle:!0,jsx:U.jsx,jsxs:U.jsxs,passKeys:!0,passNode:!0});return t&&bx(r,u),u}}var Sx=/^ {0,3}(?:\[[^\]\n]+\]:|<[A-Za-z!?/]|:::|\$\$)|\[\^/m,Cx=/^ {0,3}(`{3,}|~{3,})/,wx=/^(?:[ \t]|(?:[-*+]|\d{1,9}[.)])(?:[ \t]|$))/;function Tx(e){if(e.includes(`\r`)||Sx.test(e))return null;let t=[],n=0,r=0,i=null,a=0,o=!1;for(let s of e.split(`
46
46
  `)){let c=Cx.exec(s)?.[1];if(i!==null){if(/\S/.test(s.slice(0,a)))break;c&&c[0]===i[0]&&c.length>=i.length&&s.trim()===c&&(i=null)}else s.trim()===``?o=!0:(o&&r>n&&!wx.test(s)&&(t.push(e.slice(n,r)),n=r),o=!1,i=c??null,c&&(a=s.indexOf(c)));r+=s.length+1}return t.push(e.slice(n)),t}function Ex(e,t,n){return e!==null&&n&&t===`local-exec`}function Dx(e){return e.canOpenInEditor||e.canOpenInBrowser||e.canOpenInPanel||e.canOpenMedia===!0}function Ox(e){return e.canOpenInBrowser&&(nx(e.iconPath)||!e.canOpenInEditor&&!e.canOpenInPanel)}var kx=[],Ax=[],jx={document:he,presentation:o,spreadsheet:Te,site:tt,"google-docs":he,"google-slides":o,"google-sheets":Te,image:T,email:ue,slack:He};function Mx(e){let t=(0,H.c)(26),n=jx[e.template.artifactKind],r;t[0]===e.template.artifactKind?r=t[1]:(r=fi(e.template.artifactKind),t[0]=e.template.artifactKind,t[1]=r);let i=r,a=`${e.template.displayName} template`,o=`${e.template.displayName} (${i})\n\n`,s;t[2]===n?s=t[3]:(s=(0,U.jsx)(n,{"aria-hidden":!0,className:`size-5`}),t[2]=n,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,U.jsx)(`span`,{className:`absolute -right-1 -bottom-1 flex size-4 items-center justify-center rounded-full border border-background bg-primary text-primary-foreground shadow-xs`,children:(0,U.jsx)(N,{"aria-hidden":!0,className:`size-2.5`})}),t[4]=c):c=t[4];let l;t[5]===s?l=t[6]:(l=(0,U.jsxs)(`span`,{className:`relative flex size-9 shrink-0 items-center justify-center rounded-lg border border-border/70 bg-background text-muted-foreground shadow-xs`,children:[s,c]}),t[5]=s,t[6]=l);let u;t[7]===e.template.displayName?u=t[8]:(u=(0,U.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.template.displayName}),t[7]=e.template.displayName,t[8]=u);let d;t[9]===i?d=t[10]:(d=(0,U.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:i}),t[9]=i,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;t[14]!==l||t[15]!==f?(p=(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[l,f]}),t[14]=l,t[15]=f,t[16]=p):p=t[16];let m;t[17]===e?m=t[18]:(m=e.onUse?(0,U.jsx)(we,{"data-thread-find-ignore":!0,type:`button`,size:`sm`,variant:`outline`,className:`shrink-0`,onClick:()=>e.onUse?.(e.template),children:`Use template`}):null,t[17]=e,t[18]=m);let h;return t[19]!==e.template.artifactKind||t[20]!==e.template.skillName||t[21]!==a||t[22]!==m||t[23]!==o||t[24]!==p?(h=(0,U.jsxs)(`div`,{role:`group`,"aria-label":a,"data-chat-markdown-artifact-template":!0,className:`my-[0.65rem] flex w-full min-w-0 items-center gap-3 rounded-xl border border-border/70 bg-card/60 px-3 py-2.5 text-foreground shadow-xs`,"data-artifact-kind":e.template.artifactKind,"data-markdown-copy":o,"data-skill-name":e.template.skillName,children:[p,m]}),t[19]=e.template.artifactKind,t[20]=e.template.skillName,t[21]=a,t[22]=m,t[23]=o,t[24]=p,t[25]=h):h=t[25],h}var Nx=/(?:^|\s)language-([^\s]+)/,Px=/^[A-Za-z]:[\\/]/,Fx=500,Ix=52428800;function Lx(e,t){console.error(`[chat-markdown] action failed`,e,t)}var Rx=new Hi(Fx,Ix);function zx(e,t){let n=e.indexOf(`
47
- `,t),r=e.slice(t,n===-1?e.length:n),i=r.match(/^(?:\s*(?:[-+*]|\d+[.)])\s+)(\[[ xX]\])/);return i?.[1]?t+r.indexOf(i[1]):null}function Bx(e,t){let n=Number.parseInt(String(t??1),10),r=Number.isNaN(n)?1:n,i=String(r).length;for(let t of e){let e=Number.parseInt(String(t??``),10);Number.isNaN(e)||(r=e),i=Math.max(i,String(r).length),r+=1}if(!(i<=1))return{"--list-gutter":`${i+2}ch`}}var Vx={note:{label:`Note`,Icon:w,borderClassName:`border-blue-500/70`,titleClassName:`text-blue-600 dark:text-blue-400`},tip:{label:`Tip`,Icon:s,borderClassName:`border-emerald-500/70`,titleClassName:`text-emerald-600 dark:text-emerald-400`},important:{label:`Important`,Icon:Je,borderClassName:`border-purple-500/70`,titleClassName:`text-purple-600 dark:text-purple-400`},warning:{label:`Warning`,Icon:_,borderClassName:`border-amber-500/70`,titleClassName:`text-amber-600 dark:text-amber-500`},caution:{label:`Caution`,Icon:ve,borderClassName:`border-red-500/70`,titleClassName:`text-red-600 dark:text-red-400`}};function Hx(e){let t=e?.match(Nx)?.[1]??`text`;return t===`gitignore`?`ini`:t}var Ux=/(?:^|\s)(?:title|file(?:name)?)=(?:"([^"]+)"|'([^']+)'|(\S+))/i,Wx=/^[\w@][\w@./-]*\.[A-Za-z0-9]+$/;function Gx(e){if(!e)return null;let t=Ux.exec(e);return(t?.[1]??t?.[2]??t?.[3])||(e.split(/\s+/).find(e=>Wx.test(e))??null)}function Kx(e){let t=(e?.children)?.find(e=>e?.type===`element`&&e.tagName===`code`),n=t?.properties?.dataCodeMeta??t?.data?.meta;return typeof n==`string`&&n.trim().length>0?n.trim():void 0}function qx(e,t){let n=e?.position?.start.offset,r=e?.position?.end.offset;if(n===void 0||r===void 0)return!1;let i=t.slice(n,r),a=/^(?:`{3,}|~{3,})/.exec(i)?.[0],o=/(?:^|\n)[ \t>]*(`{3,}|~{3,})[ \t\r]*$/.exec(i)?.[1];return a!==void 0&&o!==void 0&&a[0]===o[0]&&o.length>=a.length}function Jx(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(e=>Jx(e)).join(``):(0,V.isValidElement)(e)?Jx(e.props.children):``}function Yx(e){let t=V.Children.toArray(e);if(t.length!==1)return null;let n=t[0];return!(0,V.isValidElement)(n)||n.type!==`code`&&n.props.node?.tagName!==`code`?null:{className:n.props.className,code:Jx(n.props.children)}}function Xx(e,t,n){return`${Nn(e).toString(36)}:${e.length}:${t}:${n}`}function Zx(e,t){return Math.max(e.length*2,t.length*3)}function Qx(){return an().wordWrap}function $x(e){let t=(0,H.c)(23),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=(0,V.useRef)(null),[a,o]=(0,V.useState)(!1),s=(0,V.useRef)(null),c=a?`Copied`:`Copy table`,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=e=>{let t=i.current?.querySelector(`table`);if(!t||typeof navigator>`u`||navigator.clipboard==null)return;let n=e===`markdown`?Mg(t):Lg(t);navigator.clipboard.writeText(n).then(()=>{s.current!=null&&clearTimeout(s.current),o(!0),s.current=setTimeout(()=>{o(!1),s.current=null},1200)}).catch(t=>{Lx({operation:`copy-table`,format:e},t)})},t[3]=l):l=t[3];let u=l,d,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{s.current!=null&&(clearTimeout(s.current),s.current=null)},f=[],t[4]=d,t[5]=f):(d=t[4],f=t[5]),(0,V.useEffect)(d,f);let p;t[6]!==n||t[7]!==r?(p=(0,U.jsx)(sr,{radius:`none`,chainVerticalScroll:!0,scrollFade:!0,className:`w-full max-w-full`,children:(0,U.jsx)(`table`,{...r,children:n})}),t[6]=n,t[7]=r,t[8]=p):p=t[8];let m;t[9]===c?m=t[10]:(m=(0,U.jsx)(we,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":c}),t[9]=c,t[10]=m);let h=a?Jt:Gt,g;t[11]===h?g=t[12]:(g=(0,U.jsx)(Yt,{className:`size-3`,icon:h}),t[11]=h,t[12]=g);let _;t[13]!==m||t[14]!==g?(_=(0,U.jsx)(fe,{render:m,children:g}),t[13]=m,t[14]=g,t[15]=_):_=t[15];let v;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,U.jsx)(ze,{onClick:()=>u(`markdown`),children:`Copy as Markdown`}),t[16]=v):v=t[16];let y;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,U.jsxs)(Ie,{align:`end`,children:[v,(0,U.jsx)(ze,{onClick:()=>u(`csv`),children:`Copy as CSV`})]}),t[17]=y):y=t[17];let b;t[18]===_?b=t[19]:(b=(0,U.jsx)(`div`,{className:`mt-0.5 flex items-center justify-end select-none`,children:(0,U.jsxs)(ae,{children:[_,y]})}),t[18]=_,t[19]=b);let x;return t[20]!==b||t[21]!==p?(x=(0,U.jsxs)(`div`,{ref:i,className:`chat-markdown-table-container`,children:[p,b]}),t[20]=b,t[21]=p,t[22]=x):x=t[22],x}function eS(e){let t=(0,H.c)(20),{children:n,open:r}=e,[i,a]=(0,V.useState)(r!==void 0&&r),o=(0,V.use)(Aa),s=i,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>a(!0),t[0]=c):c=t[0];let l=ja(c),u,d;if(t[1]!==n){let e=V.Children.toArray(n),r=e.findIndex(tS),i=r>=0?e[r]:null;u=(0,V.isValidElement)(i)&&i.props.children?i.props.children:`Details`;let a;t[4]===r?a=t[5]:(a=(e,t)=>t!==r,t[4]=r,t[5]=a),d=e.filter(a),t[1]=n,t[2]=u,t[3]=d}else u=t[2],d=t[3];let f=d,p=s?`true`:`false`,m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,U.jsx)(ye,{className:`size-4 shrink-0 text-muted-foreground transition-transform`,"aria-hidden":!0}),t[6]=m):m=t[6];let h;t[7]===u?h=t[8]:(h=(0,U.jsxs)(Ci,{className:`flex w-full items-center gap-2 py-2 text-left text-sm font-medium text-foreground data-panel-open:[&_svg]:rotate-90`,"data-markdown-details-summary":``,children:[m,(0,U.jsx)(`span`,{children:u})]}),t[7]=u,t[8]=h);let g;t[9]===f?g=t[10]:(g=(0,U.jsx)(`div`,{className:`pb-3 ps-6 text-foreground/[calc(80%+var(--appearance-contrast-boost)/5)]`,"data-markdown-details-content":``,children:f}),t[9]=f,t[10]=g);let _;t[11]!==l||t[12]!==o||t[13]!==g?(_=(0,U.jsx)(Si,{ref:l,hiddenUntilFound:o,children:g}),t[11]=l,t[12]=o,t[13]=g,t[14]=_):_=t[14];let v;return t[15]!==s||t[16]!==p||t[17]!==h||t[18]!==_?(v=(0,U.jsx)(`div`,{className:`my-2 border-y border-border/60`,children:(0,U.jsxs)(xi,{open:s,onOpenChange:a,"data-markdown-details":``,"data-markdown-details-open":p,children:[h,_]})}),t[15]=s,t[16]=p,t[17]=h,t[18]=_,t[19]=v):v=t[19],v}function tS(e){return(0,V.isValidElement)(e)&&e.type===`summary`}var nS={"data-thread-find-ignore":``};function rS(e){let t=(0,H.c)(18),{as:n,language:r,fenceTitle:i,theme:a,wrapped:o,title:s,actions:c,headerProps:l,children:u}=e,d=n===void 0?`div`:n,f=o===void 0||o?`true`:`false`,p=l?.className,m;t[0]===p?m=t[1]:(m=B(`chat-markdown-codeblock-header flex items-center justify-between gap-2 pt-1.5 pr-1.5 pb-0 pl-3 select-none`,p),t[0]=p,t[1]=m);let h;t[2]!==i||t[3]!==r||t[4]!==a||t[5]!==s?(h=s??(0,U.jsx)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5 font-mono text-2xs`,children:(0,U.jsx)(iS,{fenceTitle:i,language:r,theme:a})}),t[2]=i,t[3]=r,t[4]=a,t[5]=s,t[6]=h):h=t[6];let g;t[7]!==c||t[8]!==l||t[9]!==m||t[10]!==h?(g=(0,U.jsxs)(`div`,{...l,className:m,children:[h,c]}),t[7]=c,t[8]=l,t[9]=m,t[10]=h,t[11]=g):g=t[11];let _;return t[12]!==d||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==g?(_=(0,U.jsxs)(d,{className:`chat-markdown-codeblock my-[0.65rem] overflow-hidden rounded-lg border border-border/70 bg-secondary leading-snug dark:border-transparent dark:bg-input/32`,"data-language":r,"data-wrap":f,children:[g,u]}),t[12]=d,t[13]=u,t[14]=r,t[15]=f,t[16]=g,t[17]=_):_=t[17],_}function iS(e){let t=(0,H.c)(26),{fenceTitle:n,language:r,theme:i}=e;if(n){let e;t[0]!==n||t[1]!==i?(e=(0,U.jsx)(Nr,{pathValue:n,kind:`file`,theme:i,className:`size-3.5`}),t[0]=n,t[1]=i,t[2]=e):e=t[2];let r;t[3]===n?r=t[4]:(r=(0,U.jsx)(`span`,{className:`truncate`,children:n}),t[3]=n,t[4]=r);let a;return t[5]!==e||t[6]!==r?(a=(0,U.jsxs)(U.Fragment,{children:[e,r]}),t[5]=e,t[6]=r,t[7]=a):a=t[7],a}let a,o;if(t[8]===r?(a=t[9],o=t[10]):(a=ar(r),o=ir(a),t[8]=r,t[9]=a,t[10]=o),!o){let e;return t[11]===r?e=t[12]:(e=(0,U.jsx)(`span`,{className:`truncate`,children:r}),t[11]=r,t[12]=e),e}let s=`Language: ${r}`,c;t[13]===s?c=t[14]:(c=(0,U.jsx)(`span`,{className:`inline-flex shrink-0 rounded-sm`,"aria-label":s}),t[13]=s,t[14]=c);let l;t[15]!==a||t[16]!==i?(l=(0,U.jsx)(Nr,{pathValue:a,kind:`file`,theme:i,className:`size-3.5`}),t[15]=a,t[16]=i,t[17]=l):l=t[17];let u;t[18]!==c||t[19]!==l?(u=(0,U.jsx)(tr,{render:c,children:l}),t[18]=c,t[19]=l,t[20]=u):u=t[20];let d;t[21]===r?d=t[22]:(d=(0,U.jsx)(nr,{side:`top`,children:r}),t[21]=r,t[22]=d);let f;return t[23]!==u||t[24]!==d?(f=(0,U.jsxs)(rr,{children:[u,d]}),t[23]=u,t[24]=d,t[25]=f):f=t[25],f}function aS(e){let t=(0,H.c)(45),{code:n,language:r,fenceTitle:i,theme:a,onRunShellCommand:o,isStreaming:s,viewToggle:c,canWrap:l,diagram:u,children:d}=e,f=l===void 0||l,p=u!==void 0&&u,[m,h]=(0,V.useState)(!1),[g,_]=(0,V.useState)(Qx),v=(0,V.useRef)(null),y=g?`Disable line wrap`:`Wrap lines`,x=m?`Copied`:`Copy code`,S,C;t[0]!==n||t[1]!==s||t[2]!==r||t[3]!==o?(S=n.trim(),C=o!==void 0&&!s&&/^(?:sh|bash|zsh|fish|shell|powershell|pwsh)$/.test(r)&&n.endsWith(`
48
- `)&&S.length>0&&!S.endsWith(`\\`)&&!/[\p{Cc}\p{Cf}]/u.test(n.slice(0,-1)),t[0]=n,t[1]=s,t[2]=r,t[3]=o,t[4]=S,t[5]=C):(S=t[4],C=t[5]);let w=C,T;t[6]!==n||t[7]!==i||t[8]!==r?(T=()=>{typeof navigator<`u`&&navigator.clipboard!=null&&navigator.clipboard.writeText(n).then(()=>{v.current!=null&&clearTimeout(v.current),h(!0),v.current=setTimeout(()=>{h(!1),v.current=null},1200)}).catch(e=>{Lx({operation:`copy-code-block`,language:r,...i?{fenceTitle:i}:{}},e)})},t[6]=n,t[7]=i,t[8]=r,t[9]=T):T=t[9];let E=T,D,O;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>()=>{v.current!=null&&(clearTimeout(v.current),v.current=null)},O=[],t[10]=D,t[11]=O):(D=t[10],O=t[11]),(0,V.useEffect)(D,O);let k=m?Jt:Gt,A;t[12]===k?A=t[13]:(A=(0,U.jsx)(Yt,{className:`size-3`,icon:k}),t[12]=k,t[13]=A);let j;t[14]!==x||t[15]!==E||t[16]!==A?(j=(0,U.jsx)(we,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,onClick:E,"aria-label":x,children:A}),t[14]=x,t[15]=E,t[16]=A,t[17]=j):j=t[17];let M=j;if(p){let e;t[18]!==M||t[19]!==c?(e=(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5 pt-1.5 pr-1.5 select-none`,children:[c,M]}),t[18]=M,t[19]=c,t[20]=e):e=t[20];let n;return t[21]!==d||t[22]!==r||t[23]!==e?(n=(0,U.jsxs)(`div`,{className:`my-[0.65rem] border border-transparent`,"data-language":r,children:[e,d]}),t[21]=d,t[22]=r,t[23]=e,t[24]=n):n=t[24],n}let N;t[25]!==f||t[26]!==y||t[27]!==g?(N=f?(0,U.jsx)(we,{type:`button`,variant:g?`secondary`:`ghost-muted`,size:`icon-xs`,"aria-pressed":g,onClick:()=>_(oS),"aria-label":y,children:(0,U.jsx)(Fe,{className:`size-3`})}):null,t[25]=f,t[26]=y,t[27]=g,t[28]=N):N=t[28];let P;t[29]!==w||t[30]!==S||t[31]!==o?(P=w?(0,U.jsx)(we,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,onClick:()=>o(S),"aria-label":`Run in terminal`,children:(0,U.jsx)(b,{className:`size-3`})}):null,t[29]=w,t[30]=S,t[31]=o,t[32]=P):P=t[32];let F;t[33]!==M||t[34]!==N||t[35]!==P||t[36]!==c?(F=(0,U.jsxs)(`span`,{className:`flex items-center gap-0.5`,role:`toolbar`,"aria-label":`Code block actions`,children:[N,P,c,M]}),t[33]=M,t[34]=N,t[35]=P,t[36]=c,t[37]=F):F=t[37];let ee;return t[38]!==d||t[39]!==i||t[40]!==r||t[41]!==F||t[42]!==a||t[43]!==g?(ee=(0,U.jsx)(rS,{language:r,fenceTitle:i,theme:a,wrapped:g,headerProps:nS,actions:F,children:d}),t[38]=d,t[39]=i,t[40]=r,t[41]=F,t[42]=a,t[43]=g,t[44]=ee):ee=t[44],ee}function oS(e){return!e}function sS(e){let t=(0,H.c)(26),{code:n,fenceTitle:r,theme:i,isStreaming:a,onExpand:o,children:s}=e,[c,l]=(0,V.useState)(!1),u=(0,V.use)(Aa),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>l(!0),t[0]=d):d=t[0];let f=ja(d),p;t[1]!==n||t[2]!==a||t[3]!==c?(p=!c&&!a&&n.trim().length>0,t[1]=n,t[2]=a,t[3]=c,t[4]=p):p=t[4];let m=p,h=c?`Show diagram`:`Show code`,g=!m,_;t[5]!==a||t[6]!==c||t[7]!==h?(_=a?null:(0,U.jsx)(we,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,onClick:()=>l(cS),"aria-label":h,children:c?(0,U.jsx)(ke,{className:`size-3`}):(0,U.jsx)(L,{className:`size-3`})}),t[5]=a,t[6]=c,t[7]=h,t[8]=_):_=t[8];let v;t[9]!==s||t[10]!==n||t[11]!==o||t[12]!==u||t[13]!==m||t[14]!==f||t[15]!==i?(v=m?(0,U.jsxs)(ci,{resetKeys:[n,i],fallback:s,children:[(0,U.jsx)(V.Suspense,{fallback:(0,U.jsx)(`div`,{className:`flex min-h-36 items-center justify-center text-xs text-muted-foreground`,children:`Rendering diagram`}),children:(0,U.jsx)(Jb,{source:n,onExpand:o})}),u?(0,U.jsx)(`pre`,{ref:f,hidden:!0,"aria-hidden":!0,children:n}):null]}):s,t[9]=s,t[10]=n,t[11]=o,t[12]=u,t[13]=m,t[14]=f,t[15]=i,t[16]=v):v=t[16];let y;return t[17]!==n||t[18]!==r||t[19]!==a||t[20]!==m||t[21]!==g||t[22]!==_||t[23]!==v||t[24]!==i?(y=(0,U.jsx)(aS,{code:n,language:`mermaid`,fenceTitle:r,theme:i,isStreaming:a,canWrap:g,diagram:m,viewToggle:_,children:v}),t[17]=n,t[18]=r,t[19]=a,t[20]=m,t[21]=g,t[22]=_,t[23]=v,t[24]=i,t[25]=y):y=t[25],y}function cS(e){return!e}function lS(e){let t=(0,H.c)(17),{className:n,code:r,themeName:i,isStreaming:a}=e,[o,s]=(0,V.useState)(a);a&&!o&&s(!0);let c,l,u;t[0]!==n||t[1]!==r||t[2]!==o||t[3]!==a||t[4]!==i?(l=Hx(n),c=Xx(r,l,i),u=!a&&!o?Rx.get(c):null,t[0]=n,t[1]=r,t[2]=o,t[3]=a,t[4]=i,t[5]=c,t[6]=l,t[7]=u):(c=t[5],l=t[6],u=t[7]);let d=u;if(d!=null){let e;return t[8]===d?e=t[9]:(e=(0,U.jsx)(`div`,{className:`chat-markdown-shiki`,dangerouslySetInnerHTML:{__html:d}}),t[8]=d,t[9]=e),e}let f=a||o,p;return t[10]!==c||t[11]!==r||t[12]!==a||t[13]!==l||t[14]!==f||t[15]!==i?(p=(0,U.jsx)(uS,{code:r,language:l,themeName:i,cacheKey:c,isStreaming:a,preserveLines:f}),t[10]=c,t[11]=r,t[12]=a,t[13]=l,t[14]=f,t[15]=i,t[16]=p):p=t[16],p}function uS({code:e,language:t,themeName:n,cacheKey:r,isStreaming:i,preserveLines:a}){let o=(0,V.use)(bi(t)),s=(0,V.useMemo)(()=>a?Zv(o,t,n):null,[o,a,t,n]),c=(0,V.useMemo)(()=>{try{return s?s(e):a?o.codeToHast(e,{lang:t,theme:n}):o.codeToHtml(e,{lang:t,theme:n})}catch(r){return console.warn(`Code highlighting failed for language "${t}", falling back to plain text.`,r instanceof Error?r.message:r),a?o.codeToHast(e,{lang:`text`,theme:n}):o.codeToHtml(e,{lang:`text`,theme:n})}},[e,o,s,t,a,n]);return(0,V.useEffect)(()=>{if(!i){let t=typeof c==`string`?c:Tn(c);Rx.set(r,t,Zx(t,e))}},[r,e,c,i]),typeof c==`string`?(0,U.jsx)(`div`,{className:`chat-markdown-shiki`,dangerouslySetInnerHTML:{__html:c}}):(0,U.jsx)(`div`,{className:`chat-markdown-shiki`,children:(0,U.jsx)(ty,{root:c})})}var dS=`chat-markdown-file-link`;function fS(e){let t=Yn(e),n=rx(t)??t;return Px.test(n)?n.replaceAll(`\\`,`/`):n}var pS=`block size-full shrink-0 select-none`,mS=new Set;function hS(e){let t=e.toLowerCase();return t===`github.com`||t.endsWith(`.github.com`)?Ar:null}var gS=(0,V.memo)(function(e){let t=(0,H.c)(10),{host:n}=e,[r,i]=(0,V.useState)(null),a;t[0]===n?a=t[1]:(a=hS(n),t[0]=n,t[1]=a);let o=a,s;t[2]!==o||t[3]!==n?(s=o?null:th(`https://${n}`),t[2]=o,t[3]=n,t[4]=s):s=t[4];let c=s,l;return t[5]!==o||t[6]!==r||t[7]!==c||t[8]!==n?(l=(0,U.jsx)(`span`,{className:`ms-[0.25em] me-[0.2em] inline-flex size-[14px] [vertical-align:-0.125em]`,"aria-hidden":!0,children:o?(0,U.jsx)(o,{className:pS}):c===null||r===n||mS.has(n)?(0,U.jsx)(tt,{className:pS}):(0,U.jsx)(`img`,{src:c,alt:``,loading:`lazy`,draggable:!1,className:B(pS,`rounded-sm`),onError:()=>{mS.add(n),i(n)}})}),t[5]=o,t[6]=r,t[7]=c,t[8]=n,t[9]=l):l=t[9],l}),_S=`max-w-[min(100%,30rem)]`,vS=B(`max-h-[30rem]`,_S),yS=`inline-block!`,bS=`rounded-lg border border-border/40`,xS=B(`h-auto w-auto object-contain`,vS);function SS(e,t,n){return`![${e.replaceAll(`\\`,`\\\\`).replaceAll(`[`,`\\[`).replaceAll(`]`,`\\]`)}](${t}${n===void 0?``:` "${n.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"`})`}function CS(e,t,n=30){let r=Number(e),i=Number(t),a=Number.isFinite(r)&&r>0,o=Number.isFinite(i)&&i>0;if(a&&o)return{width:r,height:`auto`,aspectRatio:`${r} / ${i}`,maxWidth:`min(100%, 30rem, ${n*r/i}rem)`};if(a)return{maxWidth:`min(100%, 30rem, ${r}px)`};if(o)return{maxHeight:`min(30rem, ${i}px)`}}var wS=B(yS,bS),TS=V.createContext(!1);function ES(e,t){if(!e)return{};let n=t.trim()||`image`,r=t=>{if(t.currentTarget.closest(`a`))return;t.preventDefault(),t.stopPropagation();let n=Gv.get(t.currentTarget);n&&e(Kv(t.currentTarget,n))};return{role:`button`,tabIndex:0,"aria-label":`Preview ${n}`,onClick:r,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&r(e)}}}function DS(e){let t=(0,H.c)(7),n=e.kind===`video`?`Video unavailable`:`Image unavailable`,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,U.jsx)(_,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),t[0]=r):r=t[0];let i;t[1]!==n||t[2]!==e.alt||t[3]!==e.detail?(i=[n,e.alt,e.detail].filter(Boolean),t[1]=n,t[2]=e.alt,t[3]=e.detail,t[4]=i):i=t[4];let a=i.join(` · `),o;return t[5]===a?o=t[6]:(o=(0,U.jsxs)(`span`,{"data-thread-find-ignore":!0,className:`inline-flex items-center gap-1.5`,children:[r,a]}),t[5]=a,t[6]=o),o}function OS(e){let t=(0,H.c)(11),n=e.copyMarkdown,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=B(yS,`rounded-md border border-border/40 bg-muted/40 px-2 py-1 text-xs text-muted-foreground`),t[0]=r):r=t[0];let i;t[1]!==e.alt||t[2]!==e.detail||t[3]!==e.kind?(i=(0,U.jsx)(DS,{alt:e.alt,kind:e.kind,detail:e.detail}),t[1]=e.alt,t[2]=e.detail,t[3]=e.kind,t[4]=i):i=t[4];let a;t[5]!==e.copyMarkdown||t[6]!==i?(a=(0,U.jsx)(`span`,{"data-markdown-copy":n,className:r,children:i}),t[5]=e.copyMarkdown,t[6]=i,t[7]=a):a=t[7];let o=a,s;return t[8]!==o||t[9]!==e.actionsSource?(s=e.actionsSource?(0,U.jsx)(Oa,{source:e.actionsSource,children:o}):o,t[8]=o,t[9]=e.actionsSource,t[10]=s):s=t[10],s}var kS=B(`aspect-video w-full overflow-hidden bg-muted/60`,_S,bS);function AS(e){let t=(0,H.c)(52),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),o=e.src??n,s=e.sourceFailed===!0||o!==null&&i===o,c=o!==null&&!s&&(!e.standalone||n!==null),l;t[0]!==e.actionsSource||t[1]!==e.alt||t[2]!==e.originalUrl||t[3]!==o?(l=t=>{t&&(t.complete&&t.naturalWidth>0&&r(t.currentSrc||t.src),Gv.set(t,{src:o,name:e.alt.trim()||`image`,actionsSource:e.actionsSource,...e.originalUrl?{originalUrl:e.originalUrl}:{}}))},t[0]=e.actionsSource,t[1]=e.alt,t[2]=e.originalUrl,t[3]=o,t[4]=l):l=t[4];let u=l,d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>({onLoad:()=>{r(e),a(null)},onError:()=>{a(e),r(null)}}),t[5]=d):d=t[5];let f=d;if(c){let n=e.actionsSource,r=e.imageProps,i=e.alt,a=e.copyMarkdown,s=e.onImageExpand&&`cursor-zoom-in`,c;t[6]!==e.className||t[7]!==s?(c=B(xS,e.className,s),t[6]=e.className,t[7]=s,t[8]=c):c=t[8];let l=e.style,d;t[9]!==e.alt||t[10]!==e.onImageExpand?(d=ES(e.onImageExpand,e.alt),t[9]=e.alt,t[10]=e.onImageExpand,t[11]=d):d=t[11];let p;t[12]===o?p=t[13]:(p=f(o),t[12]=o,t[13]=p);let m;t[14]!==u||t[15]!==e.alt||t[16]!==e.copyMarkdown||t[17]!==e.imageProps||t[18]!==e.style||t[19]!==o||t[20]!==p||t[21]!==c||t[22]!==d?(m=(0,U.jsx)(`img`,{...r,ref:u,src:o,alt:i,"data-markdown-copy":a,decoding:`async`,draggable:!1,className:c,style:l,...d,...p}),t[14]=u,t[15]=e.alt,t[16]=e.copyMarkdown,t[17]=e.imageProps,t[18]=e.style,t[19]=o,t[20]=p,t[21]=c,t[22]=d,t[23]=m):m=t[23];let h;return t[24]!==e.actionsSource||t[25]!==m?(h=(0,U.jsx)(Oa,{source:n,children:m}),t[24]=e.actionsSource,t[25]=m,t[26]=h):h=t[26],h}if(!e.standalone){let n;return t[27]!==s||t[28]!==e.actionsSource||t[29]!==e.alt||t[30]!==e.copyMarkdown||t[31]!==e.imageProps?.id||t[32]!==e.unavailableDetail?(n=s?(0,U.jsx)(OS,{alt:e.alt,copyMarkdown:e.copyMarkdown,actionsSource:e.actionsSource,detail:e.unavailableDetail}):(0,U.jsx)(`span`,{id:e.imageProps?.id,"data-markdown-copy":e.copyMarkdown,role:`status`,"aria-label":`Loading image`,className:yS}),t[27]=s,t[28]=e.actionsSource,t[29]=e.alt,t[30]=e.copyMarkdown,t[31]=e.imageProps?.id,t[32]=e.unavailableDetail,t[33]=n):n=t[33],n}let p=e.actionsSource,m=e.imageProps?.id,h=e.copyMarkdown,g;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(g=B(yS,kS,`relative`),t[34]=g):g=t[34];let _;t[35]===s?_=t[36]:(_=s?{role:`alert`}:{role:`status`,"aria-label":`Loading image`},t[35]=s,t[36]=_);let v;t[37]!==s||t[38]!==u||t[39]!==e.alt||t[40]!==e.unavailableDetail||t[41]!==o?(v=s?(0,U.jsx)(`span`,{className:`flex size-full items-center justify-center p-2 text-center text-xs text-muted-foreground`,children:(0,U.jsx)(DS,{alt:e.alt,detail:e.unavailableDetail})}):o===null?null:(0,U.jsx)(`img`,{ref:u,src:o,alt:e.alt,decoding:`async`,draggable:!1,className:`invisible absolute inset-0 size-full`,...f(o)}),t[37]=s,t[38]=u,t[39]=e.alt,t[40]=e.unavailableDetail,t[41]=o,t[42]=v):v=t[42];let y;t[43]!==e.copyMarkdown||t[44]!==e.style||t[45]!==m||t[46]!==_||t[47]!==v?(y=(0,U.jsx)(`span`,{id:m,"data-markdown-copy":h,className:g,style:e.style,..._,children:v}),t[43]=e.copyMarkdown,t[44]=e.style,t[45]=m,t[46]=_,t[47]=v,t[48]=y):y=t[48];let b;return t[49]!==e.actionsSource||t[50]!==y?(b=(0,U.jsx)(Oa,{source:p,children:y}),t[49]=e.actionsSource,t[50]=y,t[51]=b):b=t[51],b}function jS(e){let t=(0,H.c)(12),n=e.mediaIdentity??e.copyMarkdown??e.src,r=e.src,i=e.sourceFailed,a=e.alt,o=e.originalUrl,s=e.style,c=e.copyMarkdown,l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=B(yS,_S,`w-full`),u=B(vS,bS),t[0]=l,t[1]=u):(l=t[0],u=t[1]);let d;return t[2]!==e.actionsSource||t[3]!==e.alt||t[4]!==e.copyMarkdown||t[5]!==e.onRetry||t[6]!==e.originalUrl||t[7]!==e.sourceFailed||t[8]!==e.src||t[9]!==e.style||t[10]!==n?(d=(0,U.jsx)(ka,{src:r,sourceFailed:i,label:a,originalUrl:o,style:s,copyMarkdown:c,className:l,videoClassName:u,onRetry:e.onRetry,actionsSource:e.actionsSource},n),t[2]=e.actionsSource,t[3]=e.alt,t[4]=e.copyMarkdown,t[5]=e.onRetry,t[6]=e.originalUrl,t[7]=e.sourceFailed,t[8]=e.src,t[9]=e.style,t[10]=n,t[11]=d):d=t[11],d}var MS=(0,V.memo)(function(e){let t=(0,H.c)(65),n=xr(e.environmentId,e.resource),r=Sr(e.environmentId,e.resource),i=e.resource,a;t[0]!==e.workspaceRoot||t[1]!==i._tag||t[2]!==i.path?(a=i._tag===`media-file`?i.path:i._tag===`workspace-file`&&e.workspaceRoot?`${e.workspaceRoot.replace(/[\\/]+$/,``)}/${i.path}`:void 0,t[0]=e.workspaceRoot,t[1]=i._tag,t[2]=i.path,t[3]=a):a=t[3];let o=a,s;t[4]!==o||t[5]!==e.originalUrl||t[6]!==e.workspaceRoot?(s=o?Jn(o,e.workspaceRoot):e.originalUrl?Kn(e.originalUrl):void 0,t[4]=o,t[5]=e.originalUrl,t[6]=e.workspaceRoot,t[7]=s):s=t[7];let c=s,l=c?.kind===`file`?c.relativePath:void 0,u=n._tag===`Failure`?e.fallbackSrc:void 0,d=n._tag===`Success`?n.url+(e.srcFragment??``):u===void 0?null:u+(e.srcFragment??``),f=n._tag===`Success`?n.imageDimensions:void 0,p=e.maxHeightRem??30,m;t[8]!==f||t[9]!==p||t[10]!==e.style?(m=e.style??(f?CS(f.width,f.height,p):p===30?void 0:{maxHeight:`${p}rem`}),t[8]=f,t[9]=p,t[10]=e.style,t[11]=m):m=t[11];let h=m,g=e.kind??`image`,_=e.alt||(e.kind??`image`),v;t[12]!==u||t[13]!==e.environmentId||t[14]!==i?(v=u===void 0?{asset:{environmentId:e.environmentId,resource:i}}:{},t[12]=u,t[13]=e.environmentId,t[14]=i,t[15]=v):v=t[15];let y;t[16]===c?y=t[17]:(y=c?{reference:c}:{},t[16]=c,t[17]=y);let b;t[18]!==e.environmentId||t[19]!==l||t[20]!==i._tag||t[21]!==i.threadId?(b=l&&(i._tag===`media-file`||i._tag===`workspace-file`)?{onOpenFile:()=>hn.getState().openFile({environmentId:e.environmentId,threadId:i.threadId},l)}:{},t[18]=e.environmentId,t[19]=l,t[20]=i._tag,t[21]=i.threadId,t[22]=b):b=t[22];let x;t[23]!==d||t[24]!==g||t[25]!==_||t[26]!==v||t[27]!==y||t[28]!==b?(x={kind:g,name:_,src:d,...v,...y,...b},t[23]=d,t[24]=g,t[25]=_,t[26]=v,t[27]=y,t[28]=b,t[29]=x):x=t[29];let S=x;if(e.kind===`video`){let i=n._tag===`Failure`&&u===void 0,a=e.alt,o=e.copyMarkdown,s=e.originalUrl,c=e.style,l;t[30]!==e.environmentId||t[31]!==e.resource||t[32]!==e.srcFragment?(l=JSON.stringify([e.environmentId,e.resource,e.srcFragment]),t[30]=e.environmentId,t[31]=e.resource,t[32]=e.srcFragment,t[33]=l):l=t[33];let f;return t[34]!==S||t[35]!==e.alt||t[36]!==e.copyMarkdown||t[37]!==e.originalUrl||t[38]!==e.style||t[39]!==r||t[40]!==d||t[41]!==l||t[42]!==i?(f=(0,U.jsx)(jS,{src:d,sourceFailed:i,alt:a,copyMarkdown:o,originalUrl:s,style:c,mediaIdentity:l,onRetry:r,actionsSource:S}),t[34]=S,t[35]=e.alt,t[36]=e.copyMarkdown,t[37]=e.originalUrl,t[38]=e.style,t[39]=r,t[40]=d,t[41]=l,t[42]=i,t[43]=f):f=t[43],f}let C;t[44]!==e.environmentId||t[45]!==e.resource||t[46]!==e.srcFragment?(C=JSON.stringify([e.environmentId,e.resource,e.srcFragment]),t[44]=e.environmentId,t[45]=e.resource,t[46]=e.srcFragment,t[47]=C):C=t[47];let w=n._tag===`Failure`&&u===void 0,T=n._tag===`Failure`&&n.reason===`missing-file-access`&&u===void 0?_r:void 0,E=e.alt,D=e.copyMarkdown,O=e.standalone??!0,k=e.framed===!1?void 0:wS,A;t[48]!==e.className||t[49]!==k?(A=B(k,e.className),t[48]=e.className,t[49]=k,t[50]=A):A=t[50];let j;return t[51]!==S||t[52]!==e.alt||t[53]!==e.copyMarkdown||t[54]!==e.imageProps||t[55]!==e.onImageExpand||t[56]!==e.originalUrl||t[57]!==d||t[58]!==h||t[59]!==w||t[60]!==T||t[61]!==O||t[62]!==A||t[63]!==C?(j=(0,U.jsx)(AS,{src:d,sourceFailed:w,unavailableDetail:T,alt:E,copyMarkdown:D,standalone:O,className:A,style:h,imageProps:e.imageProps,actionsSource:S,originalUrl:e.originalUrl,onImageExpand:e.onImageExpand},C),t[51]=S,t[52]=e.alt,t[53]=e.copyMarkdown,t[54]=e.imageProps,t[55]=e.onImageExpand,t[56]=e.originalUrl,t[57]=d,t[58]=h,t[59]=w,t[60]=T,t[61]=O,t[62]=A,t[63]=C,t[64]=j):j=t[64],j});function NS(e){let t=/^(?:https?:\/\/)/i.exec(e)?.[0];return t?t.length:Math.min(e.length,1)}function PS(e){return Array.from(e.matchAll(/\s+|\S+/g),({0:e,index:t})=>e.length<=16?e:(0,U.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e},t))}function FS(e){if(!e||typeof e!=`object`||!(`children`in e)||!Array.isArray(e.children))return null;let t=e.children.map(e=>e&&typeof e==`object`&&`type`in e&&e.type===`text`&&`value`in e&&typeof e.value==`string`?e.value:null);return t.every(e=>e!==null)?t.join(``):null}function IS(e){return!e||typeof e!=`object`?``:`type`in e&&e.type===`text`&&`value`in e&&typeof e.value==`string`?e.value:!(`children`in e)||!Array.isArray(e.children)?``:e.children.map(IS).join(``)}function LS(e){return!e||typeof e!=`object`?!1:`type`in e&&e.type===`text`&&`value`in e&&typeof e.value==`string`&&e.value.trim().length>0||`children`in e&&Array.isArray(e.children)&&e.children.some(LS)}var RS=`user-content-`;function zS(e){let t=e.slice(1);try{return decodeURIComponent(t)}catch{return t}}function BS(e){let t=e;for(;t.startsWith(RS);)t=t.slice(13);return t}function VS(e,t){let n=zS(t),r=BS(n),i=e=>e.id===n||BS(e.id)===r,a=e.closest(`.chat-markdown`);if(a){let e=Array.from(a.querySelectorAll(`[id]`)).find(i);if(e)return e}return document.getElementById(n)??Array.from(document.querySelectorAll(`[id]`)).find(i)??null}function HS(e,t){e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),VS(e.currentTarget,t)?.scrollIntoView({block:`start`}))}function US(e){return e.trim().toLowerCase().replace(/[^\p{L}\p{M}\p{N}\p{Pc} -]/gu,``).replace(/ /g,`-`)}function WS(){return e=>{let t=new Set,n=e=>{let r=e.properties?.id;typeof r==`string`&&t.add(r),e.children?.forEach(n)};n(e);let r=new Map,i=e=>{if(e.type===`element`&&e.tagName&&/^h[1-6]$/.test(e.tagName)){let n=US(IS(e));if(e.properties?.id===void 0&&n){let i=r.get(n)??0,a=`${RS}${n}`;for(;t.has(a);)i+=1,a=`${RS}${n}-${i}`;r.set(n,i),t.add(a),e.properties={...e.properties,id:a}}}else e.children?.forEach(i)};i(e)}}var GS=[...Um,WS,mv],KS=[WS,mv];function qS(e){return Fr(e)||Ge(e)||ym(e)||Un(e)||ix(e)?e:rx(e)??ig(e)}function JS(e){let t=(0,H.c)(13),{host:n,plainText:r,children:i}=e;if(r){let e;if(t[0]!==n||t[1]!==r){let i=NS(r),a;t[3]===n?a=t[4]:(a=(0,U.jsx)(gS,{host:n}),t[3]=n,t[4]=a),e=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`whitespace-nowrap`,children:[a,r.slice(0,i)]}),PS(r.slice(i))]}),t[0]=n,t[1]=r,t[2]=e}else e=t[2];return e}let a,o;if(t[5]!==i||t[6]!==n){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=V.Children.toArray(i),r=e[0];if(typeof r==`string`&&r.length>0){let i=NS(r),a;t[9]===n?a=t[10]:(a=(0,U.jsx)(gS,{host:n}),t[9]=n,t[10]=a),o=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`whitespace-nowrap`,children:[a,r.slice(0,i)]}),PS(r.slice(i)),e.slice(1)]});break bb0}let s;t[11]===n?s=t[12]:(s=(0,U.jsx)(gS,{host:n}),t[11]=n,t[12]=s),a=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[s,r]}),e.slice(1)]})}t[5]=i,t[6]=n,t[7]=a,t[8]=o}else a=t[7],o=t[8];return o===Symbol.for(`react.early_return_sentinel`)?a:o}var YS=(0,V.memo)(function({environmentId:e,href:t,targetPath:n,iconPath:r,displayPath:i,panelPath:a,line:o,label:s,copyMarkdown:c,theme:l,threadRef:u,onOpen:d,onOpenInPanel:f,openInEditorMenuLabel:p,onOpenInBrowser:m,onOpenMedia:h,onReveal:g,revealLabel:_}){let v=(0,V.useCallback)(()=>{d&&(async()=>{try{let e=await d(n);if(e._tag===`Success`||vt(e))return;Lx({operation:`open-file-in-editor`,target:n},e.cause);let t=_t(e);Qt.add(Sn({type:`error`,title:`Unable to open file`,description:t instanceof Error?t.message:`An error occurred.`}))}catch(e){Lx({operation:`open-file-in-editor`,target:n},e),Qt.add(Sn({type:`error`,title:`Unable to open file`,description:e instanceof Error?e.message:`An error occurred.`}))}})()},[d,n]),y=(0,V.useCallback)(()=>{u&&a?f(a,o):h?h():v()},[v,o,f,h,a,u]),b=(0,V.useCallback)(()=>{m&&(async()=>{try{let e=await m();if(e._tag===`Success`||vt(e))return;Lx({operation:`open-file-in-browser`,target:n},e.cause);let t=_t(e);Qt.add(Sn({type:`error`,title:`Unable to open file in browser`,description:t instanceof Error?t.message:`An error occurred.`}))}catch(e){Lx({operation:`open-file-in-browser`,target:n},e),Qt.add(Sn({type:`error`,title:`Unable to open file in browser`,description:e instanceof Error?e.message:`An error occurred.`}))}})()},[m,n]),x=(0,V.useCallback)(()=>{g&&(async()=>{try{let e=await g();if(e._tag===`Success`||vt(e))return;Lx({operation:`reveal-file-in-file-manager`,target:n},e.cause);let t=_t(e);Qt.add(Sn({type:`error`,title:`Unable to reveal file`,description:t instanceof Error?t.message:`An error occurred.`}))}catch(e){Lx({operation:`reveal-file-in-file-manager`,target:n},e),Qt.add(Sn({type:`error`,title:`Unable to reveal file`,description:e instanceof Error?e.message:`An error occurred.`}))}})()},[g,n]),S=(0,V.useCallback)((e,t)=>{typeof window>`u`||!navigator.clipboard?.writeText?Qt.add(Sn({type:`error`,title:`Failed to copy ${t.toLowerCase()}`,description:`Clipboard API unavailable.`})):navigator.clipboard.writeText(e).then(()=>{Qt.add({type:`success`,title:`${t} copied`,description:e})},e=>{Lx({operation:`copy-file-path`,target:n,copyTarget:t},e),Qt.add(Sn({type:`error`,title:`Failed to copy ${t.toLowerCase()}`,description:e instanceof Error?e.message:`An error occurred.`}))})},[n]),C=(0,V.useCallback)(async e=>{let t=en();if(t)try{let r=await t.contextMenu.show([...h?[{id:`preview-media`,label:`Preview media`}]:[],...d?[{id:`open`,label:p}]:[],...m?[{id:`open-in-browser`,label:`Open in integrated browser`}]:[],...g&&_?[{id:`reveal`,label:_}]:[],{id:`copy-relative`,label:`Copy relative path`},{id:`copy-full`,label:`Copy full path`}],e);if(r===`preview-media`){h?.();return}if(r===`open`){v();return}if(r===`open-in-browser`){b();return}if(r===`reveal`){x();return}if(r===`copy-relative`){S(i,`Relative path`);return}r===`copy-full`&&S(n,`Full path`)}catch(e){Lx({operation:`show-file-context-menu`,target:n},e)}},[i,S,b,v,x,m,h,d,g,p,_,n]),w=(0,V.useCallback)(e=>{e.preventDefault(),e.stopPropagation();let t=e.clientX===0&&e.clientY===0?(()=>{let t=e.currentTarget.getBoundingClientRect();return{x:t.left,y:t.bottom}})():{x:e.clientX,y:e.clientY};C(t)},[C]),T=d!==void 0,E=m!==void 0,D=u!==void 0&&!!a,O=Dx({canOpenInEditor:T,canOpenInBrowser:E,canOpenInPanel:D,canOpenMedia:h!==void 0}),k=Ox({iconPath:r,canOpenInEditor:T,canOpenInBrowser:E,canOpenInPanel:D});return(0,U.jsxs)(rr,{children:[(0,U.jsx)(tr,{render:O?(0,U.jsx)(a_,{kind:`mention`,render:(0,U.jsx)(`a`,{href:t}),className:dS,"data-markdown-copy":c,onClick:e=>{e.preventDefault(),e.stopPropagation(),d&&tx(e)?v():k?b():y()},onContextMenu:w,children:(0,U.jsx)(Yv,{path:r,environmentId:e,label:s,theme:l})}):(0,U.jsx)(a_,{kind:`mention`,render:(0,U.jsx)(`button`,{type:`button`}),"aria-label":`File options for ${s}`,"aria-haspopup":`menu`,className:B(dS,`select-text`),"data-markdown-copy":c,onClick:w,onContextMenu:w,children:(0,U.jsx)(Yv,{path:r,environmentId:e,label:s,theme:l})})}),(0,U.jsx)(nr,{side:`top`,variant:`code`,children:(0,U.jsx)(Jv,{path:r,label:n,environmentId:e})})]})},XS);function XS(e,t){return e.href===t.href&&e.targetPath===t.targetPath&&e.iconPath===t.iconPath&&e.environmentId===t.environmentId&&e.displayPath===t.displayPath&&e.panelPath===t.panelPath&&e.line===t.line&&e.label===t.label&&e.copyMarkdown===t.copyMarkdown&&e.theme===t.theme&&e.threadRef===t.threadRef&&e.onOpen===t.onOpen&&e.onOpenInPanel===t.onOpenInPanel&&e.openInEditorMenuLabel===t.openInEditorMenuLabel&&e.onOpenInBrowser===t.onOpenInBrowser&&e.onOpenMedia===t.onOpenMedia&&e.onReveal===t.onReveal&&e.revealLabel===t.revealLabel}function ZS(e,t,n){let r=Rn(dm(e)).filter(e=>!Ge(e)).map(fS).filter(e=>sx(e,t,n??t)),i=Hn(e).filter(e=>ax(e,t,n??t));return JSON.stringify([[...new Set(r)],[...new Set(i)]])}function QS(e,t,n){let[r,i]=JSON.parse(e),a=new Map;for(let e of r){let r=sx(e,t,n??t);r&&a.set(e,r)}let o=new Map;for(let e of i){let r=ax(e,t,n??t);r&&o.set(e,r)}return{markdownFileLinkMetaByHref:a,inlineCodeFileLinkMetaByText:o,fileLinkParentSuffixByPath:xn([...[...a.values()].map(e=>e.filePath),...[...o.values()].map(e=>e.filePath)])}}function $S(e){let t=(0,H.c)(126),{text:n,inline:r,cwd:i,threadRef:a,pullRequestPanelRef:o,environmentId:s,onTaskListChange:c,isStreaming:l,skills:u,onUseArtifactTemplate:d,onRunShellCommand:f,imageBaseDir:p,onImageExpand:m,renderContextReference:h,headingLevelOffset:g,githubMedia:_}=e,v=r!==void 0&&r,y=l!==void 0&&l,b=u===void 0?kx:u,x=g===void 0?0:g,C=_!==void 0&&_,{resolvedTheme:w}=tn(),[T,E]=(0,V.useState)(null),D=(0,V.useRef)(null),O=m??E,k=(0,V.useRef)(0),A;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>(E(null),()=>{k.current+=1}),t[0]=A):A=t[0];let j=a?.environmentId,M=a?.threadId,N;t[1]!==i||t[2]!==s||t[3]!==p||t[4]!==j||t[5]!==M?(N=[j,M,s,i,p],t[1]=i,t[2]=s,t[3]=p,t[4]=j,t[5]=M,t[6]=N):N=t[6],(0,V.useEffect)(A,N);let P;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(P={reportFailure:!1,refresh:!0},t[7]=P):P=t[7];let F=br(vr.createUrl,P),ee;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(ee={reportFailure:!1},t[8]=ee):ee=t[8];let te=br(Nt.searchEntries,ee),ne;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(ne={reportFailure:!1},t[9]=ne):ne=t[9];let re=mn(jr.open,ne),ie=ri(a?.environmentId),I=a?.environmentId??s??null,L=cn(I,ft),ae=cn(I,st),oe=Zi(I),se;t[10]!==L||t[11]!==I||t[12]!==oe?(se=L&&Ex(I,oe.state.mode,oe.isResolved),t[10]=L,t[11]=I,t[12]=oe,t[13]=se):se=t[13];let ce=se,le=dn(I),ue;t[14]!==F||t[15]!==i||t[16]!==O||t[17]!==le||t[18]!==a?(ue=(e,t,n)=>{let r=k.current+=1;hv({source:e,resolvedFilePath:t,cwd:i,threadRef:a,httpBaseUrl:le._tag===`Some`?le.value.httpBaseUrl:void 0,createAssetUrl:F,onOpenFile:a?e=>hn.getState().openFile(a,e):void 0}).then(e=>{if(e&&k.current===r){let t=e.images[e.index];O(t&&t.type!==`video`&&D.current?Kv(n??D.current,t):e)}},e=>{k.current===r&&Qt.add(Sn({type:`error`,title:`Media unavailable`,description:e instanceof Error?e.message:`The file could not be loaded. It may have been moved or deleted.`}))})},t[14]=F,t[15]=i,t[16]=O,t[17]=le,t[18]=a,t[19]=ue):ue=t[19];let de=ue,fe;t[20]===I?fe=t[21]:(fe=sn.configValueAtom(I),t[20]=I,t[21]=fe);let pe=S(fe),R=jt(),z;t[22]===pe?.availableEditors?z=t[23]:(z=pe?.availableEditors??[],t[22]=pe?.availableEditors,t[23]=z);let he=z,[ge]=wi(he),_e;t[24]===ge?_e=t[25]:(_e=Gi(ge),t[24]=ge,t[25]=_e);let ve=_e,ye=yi(I,he),be;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(be={reportFailure:!1},t[26]=be):be=t[26];let xe=mn(It.openInEditor,be),Se;t[27]!==I||t[28]!==pe?(Se=I!==null&&pe?.shellRevealInFileManager===!0&&pe.availableEditors.includes(`file-manager`)?pe.shellRevealInFileManagerKind===void 0?zi(pe.environment.platform.os):Bi(pe.shellRevealInFileManagerKind):void 0,t[27]=I,t[28]=pe,t[29]=Se):Se=t[29];let Ce=Se,we;t[30]!==I||t[31]!==xe?(we=e=>I===null?Promise.resolve(me(gt(new Ti({targetPath:e})))):ln(I,`orchestration:operate`)?xe({environmentId:I,input:{cwd:e,editor:`file-manager`,reveal:!0}}):Promise.resolve(me(gt(Error(`This connection cannot reveal files on this environment.`)))),t[30]=I,t[31]=xe,t[32]=we):we=t[32];let Te=we,Ee;t[33]===w?Ee=t[34]:(Ee=In(w),t[33]=w,t[34]=Ee);let De=Ee,Oe;t[35]!==i||t[36]!==p||t[37]!==n?(Oe=ZS(n,i,p),t[35]=i,t[36]=p,t[37]=n,t[38]=Oe):Oe=t[38];let ke=Oe,Ae;t[39]!==i||t[40]!==ke||t[41]!==p?(Ae=QS(ke,i,p),t[39]=i,t[40]=ke,t[41]=p,t[42]=Ae):Ae=t[42];let{markdownFileLinkMetaByHref:je,inlineCodeFileLinkMetaByText:Me,fileLinkParentSuffixByPath:Ne}=Ae,Pe=nC,Fe=ui(a,o),Ie=ii(a),Le=on(tC),Re=on(eC),B;t[43]!==ie||t[44]!==a?(B=e=>{if(a===void 0||Lt(a)===null||!ie.canLink(e))return null;let t=yt(e);return t===null?null:{...t,url:e}},t[43]=ie,t[44]=a,t[45]=B):B=t[45];let ze=B,Be;t[46]!==ie||t[47]!==a?(Be=e=>{if(a===void 0||!ie.isLinked(Lt(a),e))return null;let t=yt(e);return t===null?null:{...t,url:e}},t[46]=ie,t[47]=a,t[48]=Be):Be=t[48];let Ve=Be,He;t[49]!==Ve||t[50]!==ie||t[51]!==a?(He=async(e,t)=>{a===void 0||!t&&Ve(e)===null||ln(a.environmentId,`orchestration:operate`)&&await ie.changeLink(a,e,t)},t[49]=Ve,t[50]=ie,t[51]=a,t[52]=He):He=t[52];let Ue=He,We;t[53]!==ae||t[54]!==re||t[55]!==a?(We=e=>!a||!ae?Promise.resolve(me(gt(new kr({message:`Preview access is unavailable for this client.`})))):Tr({threadRef:a,url:e,openPreview:re}).then(t=>{if(t._tag===`Success`)Cr(a,e);else if(!vt(t)){let e=_t(t);e instanceof Dr&&Qt.add(Sn({type:`error`,title:`Unable to open link in browser`,description:e.message}))}return t}),t[53]=ae,t[54]=re,t[55]=a,t[56]=We):We=t[56];let Ge=We,Ke;t[57]!==ae||t[58]!==F||t[59]!==i||t[60]!==re||t[61]!==le||t[62]!==a?(Ke=e=>!a||!ae||le._tag===`None`?Promise.resolve(me(gt(new kr({message:`Environment is not connected.`})))):Er({threadRef:a,filePath:e,workspaceRoot:i,httpBaseUrl:le.value.httpBaseUrl,createAssetUrl:F,openPreview:re}),t[57]=ae,t[58]=F,t[59]=i,t[60]=re,t[61]=le,t[62]=a,t[63]=Ke):Ke=t[63];let qe=Ke,Je;t[64]!==i||t[65]!==I||t[66]!==te?(Je=async e=>{if(!i||I===null||!ln(I,`filesystem:read`)||!fx(e))return null;let t=await te({environmentId:I,input:{cwd:i,query:e,limit:25,kind:`file`}});return t._tag===`Success`?px(e,t.value.entries):null},t[64]=i,t[65]=I,t[66]=te,t[67]=Je):Je=t[67];let Ye=Je,Xe;t[68]!==i||t[69]!==Ye||t[70]!==a?(Xe=(e,t)=>{if(!a)return;let n=ux(),r=e=>hn.getState().openFile(a,e,t);!i||!fx(e)?r(e):(async()=>{let t=await Ye(e);n()&&r(t??e)})()},t[68]=i,t[69]=Ye,t[70]=a,t[71]=Xe):Xe=t[71];let Ze=Xe,Qe;t[72]!==i||t[73]!==Ye||t[74]!==Te?(Qe=async e=>{let t=e.workspaceRelativePath,n=t?await Ye(t):null,r=n&&i?gn(n,i):e.filePath;return Te(r)},t[72]=i,t[73]=Ye,t[74]=Te,t[75]=Qe):Qe=t[75];let $e=Qe,et;t[76]!==ae||t[77]!==ce||t[78]!==I||t[79]!==Ne||t[80]!==Ze||t[81]!==ye||t[82]!==qe||t[83]!==de||t[84]!==ve||t[85]!==w||t[86]!==Ce||t[87]!==$e||t[88]!==a?(et=(e,t,n)=>{let r=n??e.filePath,i=Ct(e.basename.slice(e.basename.lastIndexOf(`.`)))!==null,o=e.workspaceRelativePath??(!i&&kt(e.filePath)?e.filePath:null);return(0,U.jsx)(YS,{environmentId:I,href:e.targetPath,targetPath:e.targetPath,iconPath:e.filePath,displayPath:e.displayPath,panelPath:o,line:e.line,label:vn({path:e.filePath,...e.line===void 0?{}:{line:e.line},...e.column===void 0?{}:{column:e.column},...e.endLine===void 0?{}:{endLine:e.endLine}},Ne),copyMarkdown:t,theme:w,threadRef:a,...ce?{onOpen:ye}:{},onOpenInPanel:Ze,onOpenMedia:a&&i?()=>de(r,e.filePath):void 0,openInEditorMenuLabel:ve,onReveal:ce&&Ce!==void 0?()=>$e(e):void 0,revealLabel:Ce,onOpenInBrowser:a&&ae&&wr(a.environmentId)&&Or(e.filePath)?()=>qe(e.filePath):void 0})},t[76]=ae,t[77]=ce,t[78]=I,t[79]=Ne,t[80]=Ze,t[81]=ye,t[82]=qe,t[83]=de,t[84]=ve,t[85]=w,t[86]=Ce,t[87]=$e,t[88]=a,t[89]=et):et=t[89];let tt=et,nt;t[90]!==L||t[91]!==ae||t[92]!==i||t[93]!==De||t[94]!==I||t[95]!==O||t[96]!==tt||t[97]!==C||t[98]!==x||t[99]!==p||t[100]!==v||t[101]!==Me||t[102]!==y||t[103]!==Le||t[104]!==Ve||t[105]!==je||t[106]!==Re||t[107]!==f||t[108]!==c||t[109]!==d||t[110]!==Fe||t[111]!==Ie||t[112]!==Ge||t[113]!==de||t[114]!==R||t[115]!==h||t[116]!==ze||t[117]!==w||t[118]!==pe||t[119]!==b||t[120]!==a||t[121]!==Ue?(nt={canOperateHost:L,canOperatePreview:ae,cwd:i,diffThemeName:De,environmentId:I,expandMedia:O,fileLinkChip:tt,githubMedia:C,renderContextReference:h,headingLevelOffset:x,imageBaseDir:p,inlineCodeFileLinkMetaByText:Me,inline:v,mathEnabled:Re,isStreaming:y,linkTargetPreference:Le,markdownFileLinkMetaByHref:je,onTaskListChange:c,onUseArtifactTemplate:d,onRunShellCommand:f,openChangeRequestLink:Fe,openDeferredMarkdownLink:Ie,openExternalLinkInPreview:Ge,openMarkdownMedia:de,projects:R,linkedThreadPullRequestFor:Ve,resolveThreadPullRequest:ze,resolvedTheme:w,serverConfig:pe,skills:b,threadRef:a,updateThreadPullRequestLink:Ue},t[90]=L,t[91]=ae,t[92]=i,t[93]=De,t[94]=I,t[95]=O,t[96]=tt,t[97]=C,t[98]=x,t[99]=p,t[100]=v,t[101]=Me,t[102]=y,t[103]=Le,t[104]=Ve,t[105]=je,t[106]=Re,t[107]=f,t[108]=c,t[109]=d,t[110]=Fe,t[111]=Ie,t[112]=Ge,t[113]=de,t[114]=R,t[115]=h,t[116]=ze,t[117]=w,t[118]=pe,t[119]=b,t[120]=a,t[121]=Ue,t[122]=nt):nt=t[122];let rt=nt,it;return t[123]!==rt||t[124]!==T?(it={componentState:rt,handleCopy:Pe,markdownRef:D,localMediaPreview:T,setLocalMediaPreview:E},t[123]=rt,t[124]=T,t[125]=it):it=t[125],it}function eC(e){return e.mathRenderingEnabled}function tC(e){return e.browserLinkTarget}function nC(e){let t=window.getSelection();if(!t||t.isCollapsed||!e.clipboardData)return;let n=Vg(t);if(!n)return;e.preventDefault(),e.clipboardData.setData(`text/plain`,n.text);let r=e.clipboardData.getData(pt);e.clipboardData.setData(`text/html`,r?Ze(n.text,r,n.html):n.html)}var rC=V.createContext(null),iC=V.createContext(``);function aC(e){let t=`h${e}`;return function({node:n,...r}){let{headingLevelOffset:i}=(0,V.use)(rC);return(0,U.jsx)(t,{...r,"aria-level":i>0?Math.min(e+i,6):void 0})}}function oC(e){window.getSelection()?.selectAllChildren(e.currentTarget)}var sC={h1:aC(1),h2:aC(2),h3:aC(3),h4:aC(4),h5:aC(5),h6:aC(6),div:function({node:e,children:t,...n}){let{onUseArtifactTemplate:r}=(0,V.use)(rC),i=pm(e?.properties);return i?(0,U.jsx)(Mx,{template:i,onUse:r}):(0,U.jsx)(`div`,{...n,children:t})},p:function({node:e,children:t,...n}){let{skills:r}=(0,V.use)(rC);return(0,U.jsx)(`p`,{...n,children:cv(t,r)})},blockquote:function({node:e,children:t,...n}){let r=Vx[String(n[`data-alert`]??``)];return r?(0,U.jsxs)(`div`,{role:`note`,className:B(`my-1 border-l-2 pl-3`,r.borderClassName),children:[(0,U.jsxs)(`p`,{"data-thread-find-ignore":`true`,className:B(`flex items-center gap-1.5 font-medium`,r.titleClassName),children:[(0,U.jsx)(r.Icon,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),r.label]}),t]}):(0,U.jsx)(`blockquote`,{...n,children:t})},ol:function({node:e,start:t,style:n,...r}){let i=Bx(e?.children?.flatMap(e=>e.type===`element`&&e.tagName===`li`?[e.properties.value]:[])??[],t);return(0,U.jsx)(`ol`,{...r,start:t,style:i?{...n,...i}:n})},li:function({node:e,children:t,...n}){let{skills:r}=(0,V.use)(rC),i=(0,V.use)(iC),a=e?.position?.start.offset,o=typeof a==`number`?zx(i,a):null;return(0,U.jsx)(`li`,{...n,"data-task-marker-offset":o??void 0,children:cv(t,r)})},input:function({node:e,type:t,checked:n,disabled:r,...i}){let{onTaskListChange:a}=(0,V.use)(rC);return t!==`checkbox`||!a?(0,U.jsx)(`input`,{...i,type:t,checked:n,disabled:r,readOnly:t===`checkbox`}):(0,U.jsx)(`input`,{...i,type:`checkbox`,name:`markdown-task`,"aria-label":`Toggle task`,checked:n,onChange:e=>{let t=Number(e.currentTarget.closest(`li`)?.dataset.taskMarkerOffset);Number.isSafeInteger(t)&&a({markerOffset:t,checked:e.currentTarget.checked})}})},a:function({node:e,href:t,children:n,title:r,...i}){let{canOperateHost:a,canOperatePreview:o,cwd:s,environmentId:c,imageBaseDir:l,markdownFileLinkMetaByHref:u,threadRef:d,openMarkdownMedia:f,openChangeRequestLink:p,openDeferredMarkdownLink:m,linkTargetPreference:h,openExternalLinkInPreview:g,projects:_,linkedThreadPullRequestFor:v,resolveThreadPullRequest:y,serverConfig:b,updateThreadPullRequestLink:x,fileLinkChip:S,renderContextReference:C}=(0,V.use)(rC),w=(0,V.use)(iC),T=t?Fr(t):null;if(T)return(0,U.jsx)(ev,{citation:T});let E=t?ym(t):null;if(E){let t=IS(e),n=t&&ym(t)===null?t:null;return c?(0,U.jsx)(rv,{environmentId:c,link:E,label:n}):(0,U.jsx)(`span`,{children:n??`Thread`})}let D=t?Ge(t):null;if(D){let t=IS(e)||D.contextId;return C?C({...D,label:t}):(0,U.jsx)(`span`,{children:t})}let O=t?fS(t):``,k=O?u.get(O)??sx(O,s,l??s):null;if(!k){let r=ma(t),s=LS(e),l=String(i[`data-pull-request-autolink`]??``),u=l===`commit`?/\/commit\/([0-9a-f]{40})$/iu.exec(t??``)?.[1]:l===`reference`?FS(e):void 0,S=u!==void 0,C=l===`reference`,w=C&&t?bt(t):t,T=w?ti({environmentId:c,projects:_,pullRequestsEnabled:b?.environment.capabilities.pullRequests===!0,url:w}):null,E=t?.startsWith(`#`)??!1,D=i.onClick,O=o&&!!(d&&wr(d.environmentId)),k=(0,U.jsx)(TS,{value:!0,children:n}),A=(0,U.jsx)(`a`,{...i,className:B(i.className,l===`commit`&&`font-mono`),"data-markdown-copy":u,"data-markdown-image-link":!s||void 0,href:t,target:E?void 0:`_blank`,rel:E?void 0:`noopener noreferrer`,onClick:e=>{D?.(e),E&&t?HS(e,t):t&&r!==null&&Et(t)!==null&&!e.defaultPrevented&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey?(e.preventDefault(),e.stopPropagation(),f(t,void 0,e.target instanceof HTMLImageElement?e.target:e.currentTarget.querySelector(`img`))):t&&!p(e,t,void 0,c??void 0)&&(e.defaultPrevented||(pi({url:t,event:e,preference:h,canOpenInApp:O})===`app`?(e.preventDefault(),e.stopPropagation(),g(t).then(e=>{e._tag===`Success`||vt(e)||(Lx({operation:`open-link-in-preview`,target:t},e.cause),!(_t(e)instanceof Dr)&&en()?.shell.openExternal(t))})):er&&e.altKey&&(e.preventDefault(),e.stopPropagation(),en()?.shell.openExternal(t).catch(e=>Lx({operation:`open-link-external`,target:t},e)))))},onContextMenu:e=>{if(!t||!r)return;e.preventDefault(),e.stopPropagation();let n=en();if(!n)return;let i=a?v(t)===null?y(t)===null?void 0:`link-to-thread`:`unlink-from-thread`:void 0;ha({href:t,canOpenInPreview:O,threadLinkAction:i,position:{x:e.clientX,y:e.clientY},showContextMenu:(e,t)=>n.contextMenu.show(e,t),openInPreview:async e=>{let t=await g(e);t._tag===`Failure`&&!vt(t)&&Lx({operation:`open-link-in-preview`,target:e},t.cause)},openExternal:e=>n.shell.openExternal(e),copyLink:e=>$t(e,`link`),updateThreadLink:x,reportFailure:(e,n)=>{Lx({operation:e,target:t},n),(e===`link-pull-request-to-thread`||e===`unlink-pull-request-from-thread`)&&Qt.add(Sn({type:`error`,title:e===`link-pull-request-to-thread`?`Unable to link pull request`:`Unable to unlink pull request`,description:n instanceof Error?n.message:`The request failed.`}))}})},children:r&&s&&!S?(0,U.jsx)(JS,{host:r,plainText:FS(e),children:k}):k});return!r||!t?A:T===null?(0,U.jsxs)(rr,{children:[(0,U.jsx)(tr,{render:A}),(0,U.jsx)(nr,{side:`top`,children:t})]}):(0,U.jsx)(j_,{link:A,originalUrl:t,target:T,confirmBeforeOpen:C,onOpenPullRequest:e=>p({metaKey:!1,ctrlKey:!1,preventDefault:()=>void 0,stopPropagation:()=>void 0},e,void 0,c??void 0),onOpenFallback:m})}let A=Jx(n),j=e?.position?.start.offset,M=e?.position?.end.offset,N=j!==void 0&&M!==void 0?w.slice(j,M):``,P=N.startsWith(`[`)&&N.includes(`](`)?N:`[${(A||k.basename).replace(/[\\[\]]/g,`\\$&`)}](${O})`,F=S(k,P,O);return qn(A,O)?F:(0,U.jsxs)(`span`,{"data-markdown-copy":P,children:[(0,U.jsxs)(`span`,{className:`whitespace-normal`,children:[n,` `]}),F]})},code:function({node:e,children:t,className:n,...r}){let{cwd:i,imageBaseDir:a,inlineCodeFileLinkMetaByText:o,fileLinkChip:s,mathEnabled:c,inline:l}=(0,V.use)(rC),u=c?oi(n):null;if(u)return(0,U.jsx)(fv,{tex:Jx(t),display:u===`display`,focusable:!l});if(e?.properties?.dataInlineCode!=null){let e=Jx(t),c=o.get(e.trim())??ax(e,i,a??i);return c?s(c,`\`${e}\``,Gn(e)??e.trim()):(0,U.jsx)(`code`,{...r,className:n,onDoubleClick:oC,children:t})}return(0,U.jsx)(`code`,{...r,className:n,children:t})},img:function({node:e,title:t,src:n,alt:r,...i}){let{expandMedia:a,cwd:o,environmentId:s,githubMedia:c,imageBaseDir:l,threadRef:u,renderContextReference:d,resolvedTheme:f}=(0,V.use)(rC),p=(0,V.use)(TS)?void 0:a,m=typeof n==`string`?Ge(n):null;if(m){let e=r||m.contextId;return d?d({...m,label:e}):(0,U.jsx)(`span`,{children:e})}let h=e?.properties?.[f===`dark`?`dataDarkSrc`:`dataLightSrc`],g=typeof h==`string`?void 0:e?.properties?.dataLocalSrc,_=e?.properties?.dataMarkdownTitle,v=e?.properties?.dataStandalone===!0,y=typeof h==`string`?h:typeof g==`string`?g:n,b=typeof _==`string`?_:t,x=typeof y==`string`?Yn(y):``,S=typeof g==`string`?x.replaceAll(`\\`,`/`):x,C=r??``,w=SS(C,x,b),{className:T,style:E,width:D,height:O,...k}=i,A=CS(D,O),j=Xn(S,l??o),M=Et(S)??`image`,N=j._tag===`Direct`?j.uri:null,P=N===null?null:ch(ga(N));if(c&&o!==void 0&&s!==null&&N!==null&&P!==null)return(0,U.jsx)(MS,{environmentId:s,resource:{_tag:`github-media`,cwd:o,url:P},alt:C,kind:M,copyMarkdown:w,standalone:v,className:T,style:A,imageProps:k,srcFragment:Zn(S),originalUrl:ga(N),framed:!1,fallbackSrc:P,onImageExpand:p});if(j._tag===`Direct`){let e=ga(j.uri),t=ma(j.uri)===null?void 0:j.uri,n=Kn(j.uri),r={kind:M,name:C||M,src:e,...n?{reference:n}:{}};return M===`video`?(0,U.jsx)(jS,{src:e,alt:C,copyMarkdown:w,originalUrl:t,style:A,actionsSource:r}):(0,U.jsx)(AS,{src:e,alt:C,copyMarkdown:w,standalone:v,className:T,style:A,imageProps:k,actionsSource:r,originalUrl:t,onImageExpand:p},e)}return j._tag===`WorkspaceFile`&&u?(0,U.jsx)(MS,{environmentId:u.environmentId,resource:{_tag:`media-file`,threadId:u.threadId,path:j.path},alt:C,kind:M,copyMarkdown:w,srcFragment:Zn(S),standalone:v,style:A,workspaceRoot:o,onImageExpand:p}):(0,U.jsx)(OS,{alt:C,copyMarkdown:w,kind:M})},table:function({node:e,...t}){return(0,U.jsx)($x,{...t})},details:function({node:e,children:t,open:n}){return(0,U.jsx)(eS,{open:n,children:t})},pre:function({node:e,children:t,...n}){let{resolvedTheme:r,diffThemeName:i,expandMedia:a,isStreaming:o,onRunShellCommand:s,inline:c,mathEnabled:l}=(0,V.use)(rC),u=(0,V.use)(iC),d=Yx(t);if(!d)return(0,U.jsx)(`pre`,{...n,children:t});let f=Hx(d.className);if(l&&f===`math`&&(!o||oi(d.className)===`display`||qx(e,u)))return(0,U.jsx)(fv,{tex:d.code,display:!0,focusable:!c});let p=Gx(Kx(e)),m=(0,U.jsx)(ci,{resetKeys:[d.code,f,i,o],fallback:(0,U.jsx)(`pre`,{...n,children:t}),children:(0,U.jsx)(V.Suspense,{fallback:(0,U.jsx)(`pre`,{...n,className:`invisible`,"aria-hidden":!0,children:t}),children:(0,U.jsx)(lS,{className:d.className,code:d.code,themeName:i,isStreaming:o})})});return f===`mermaid`?(0,U.jsx)(sS,{code:d.code,fenceTitle:p,theme:r,isStreaming:o,onExpand:e=>a({images:[{src:e,name:`Mermaid diagram`}],index:0}),children:m}):(0,U.jsx)(aS,{code:d.code,language:f,fenceTitle:p,theme:r,onRunShellCommand:s&&!o&&qx(e,u)?s:void 0,isStreaming:o,children:m})}},cC=[Qr,{singleDollarTextMath:!0}],lC={plain:Im,breaks:Lm,math:[cC,...Im],mathBreaks:[cC,...Lm]},uC=new WeakMap;function dC(e,t){if(t.length===0)return e;let n=uC.get(t);n||uC.set(t,n=new WeakMap);let r=n.get(e);return r||n.set(e,r=[...e,...t]),r}var fC=new WeakMap;function pC(e,t){let n=fC.get(e);n||fC.set(e,n=new WeakMap);let r=n.get(t);return r||(r=xx({remarkPlugins:e,rehypePlugins:t,components:sC,urlTransform:qS}),n.set(t,r)),r}var mC=(0,V.memo)(function(e){let t=(0,H.c)(12),{text:n,remarkPlugins:r,rehypePlugins:i,shared:a,cache:o}=e,s,c,l;if(t[0]!==o||t[1]!==i||t[2]!==r||t[3]!==a||t[4]!==n){let e=a?pC(r,i):xx({remarkPlugins:r,rehypePlugins:i,components:sC,urlTransform:qS});s=iC,c=n,l=e(n,a&&o),t[0]=o,t[1]=i,t[2]=r,t[3]=a,t[4]=n,t[5]=s,t[6]=c,t[7]=l}else s=t[5],c=t[6],l=t[7];let u;return t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,U.jsx)(s,{value:c,children:l}),t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11],u});function hC(e){let t=(0,H.c)(55),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({text:c,className:n,inline:i,lineBreaks:a,parseRawHtml:o,extraRemarkPlugins:s,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i!==void 0&&i,u=a!==void 0&&a,d=o===void 0||o,f=s===void 0?Ax:s,p;t[8]!==l||t[9]!==r||t[10]!==c?(p={text:c,inline:l,...r},t[8]=l,t[9]=r,t[10]=c,t[11]=p):p=t[11];let{componentState:m,handleCopy:h,markdownRef:g,localMediaPreview:_,setLocalMediaPreview:v}=$S(p),y,b,x,S,C,w,T,E;if(t[12]!==n||t[13]!==m||t[14]!==f||t[15]!==h||t[16]!==l||t[17]!==u||t[18]!==g||t[19]!==d||t[20]!==r.isStreaming||t[21]!==r.onTaskListChange||t[22]!==c){let e=r.isStreaming===!0&&!l&&f.length===0&&!r.onTaskListChange?Tx(c):null,i=r.isStreaming===!0&&e===null&&f.length===0&&/(?:^|\n) {0,3}(?:`{3}|~{3})/.test(c),a=l?`span`:`div`,o;t[31]===g?o=t[32]:(o=e=>{g.current=e},t[31]=g,t[32]=o);let s=o,p=lC[m.mathEnabled?u?`mathBreaks`:`math`:u?`breaks`:`plain`],_=i,v;t[33]!==f||t[34]!==i||t[35]!==p?(v=i?[...p,...f,fh()]:dC(p,f),t[33]=f,t[34]=i,t[35]=p,t[36]=v):v=t[36];let D=v,O=e??[c];b=a,T=s;let k=!l&&`text-sm leading-relaxed text-foreground/[calc(80%+var(--appearance-contrast-boost)/5)]`;t[37]!==n||t[38]!==k?(E=B(`chat-markdown w-full min-w-0 [overflow-wrap:anywhere] [word-break:break-word]`,k,n),t[37]=n,t[38]=k,t[39]=E):E=t[39],x=m.isStreaming?``:void 0,S=h,y=rC,C=m,w=O.map((e,t)=>(0,U.jsx)(mC,{text:e,remarkPlugins:D,rehypePlugins:d?GS:KS,shared:!_,cache:!r.isStreaming||t<O.length-1},t)),t[12]=n,t[13]=m,t[14]=f,t[15]=h,t[16]=l,t[17]=u,t[18]=g,t[19]=d,t[20]=r.isStreaming,t[21]=r.onTaskListChange,t[22]=c,t[23]=y,t[24]=b,t[25]=x,t[26]=S,t[27]=C,t[28]=w,t[29]=T,t[30]=E}else y=t[23],b=t[24],x=t[25],S=t[26],C=t[27],w=t[28],T=t[29],E=t[30];let D;t[40]!==y||t[41]!==C||t[42]!==w?(D=(0,U.jsx)(y,{value:C,children:w}),t[40]=y,t[41]=C,t[42]=w,t[43]=D):D=t[43];let O;t[44]!==_||t[45]!==v?(O=_?(0,U.jsx)(Uv,{preview:_,onClose:()=>v(null)}):null,t[44]=_,t[45]=v,t[46]=O):O=t[46];let k;return t[47]!==b||t[48]!==x||t[49]!==S||t[50]!==D||t[51]!==O||t[52]!==T||t[53]!==E?(k=(0,U.jsxs)(b,{ref:T,className:E,"data-streaming":x,onCopy:S,children:[D,O]}),t[47]=b,t[48]=x,t[49]=S,t[50]=D,t[51]=O,t[52]=T,t[53]=E,t[54]=k):k=t[54],k}var gC=(0,V.memo)(hC);export{sa as $,o_ as A,Ym as B,P_ as C,I_ as D,N_ as E,th as F,Aa as G,fm as H,eh as I,Oa as J,ja as K,Um as L,Vg as M,eg as N,V_ as O,ch as P,ta as Q,Im as R,F_ as S,R_ as T,Tf as U,Cm as V,Bo as W,ca as X,pa as Y,aa as Z,uv as _,Yv as a,zi as at,$_ as b,Uv as c,Cv as d,Qi as et,yv as f,vv as g,bv as h,ex as i,Bi as it,t_ as j,a_ as k,Av as l,_v as m,gC as n,Hi as nt,qv as o,gv as p,ka as q,rS as r,Ri as rt,Jv as s,MS as t,Wi as tt,Iv as u,iv as v,z_ as w,G_ as x,ev as y,Lm as z};
49
- //# sourceMappingURL=ChatMarkdown-LJASbkfc.js.map
47
+ `,t),r=e.slice(t,n===-1?e.length:n),i=r.match(/^(?:\s*(?:[-+*]|\d+[.)])\s+)(\[[ xX]\])/);return i?.[1]?t+r.indexOf(i[1]):null}function Bx(e,t){let n=Number.parseInt(String(t??1),10),r=Number.isNaN(n)?1:n,i=String(r).length;for(let t of e){let e=Number.parseInt(String(t??``),10);Number.isNaN(e)||(r=e),i=Math.max(i,String(r).length),r+=1}if(!(i<=1))return{"--list-gutter":`${i+2}ch`}}var Vx={note:{label:`Note`,Icon:w,borderClassName:`border-blue-500/70`,titleClassName:`text-blue-600 dark:text-blue-400`},tip:{label:`Tip`,Icon:s,borderClassName:`border-emerald-500/70`,titleClassName:`text-emerald-600 dark:text-emerald-400`},important:{label:`Important`,Icon:Je,borderClassName:`border-purple-500/70`,titleClassName:`text-purple-600 dark:text-purple-400`},warning:{label:`Warning`,Icon:_,borderClassName:`border-amber-500/70`,titleClassName:`text-amber-600 dark:text-amber-500`},caution:{label:`Caution`,Icon:ve,borderClassName:`border-red-500/70`,titleClassName:`text-red-600 dark:text-red-400`}};function Hx(e){let t=e?.match(Nx)?.[1]??`text`;return t===`gitignore`?`ini`:t}var Ux=/(?:^|\s)(?:title|file(?:name)?)=(?:"([^"]+)"|'([^']+)'|(\S+))/i,Wx=/^[\w@][\w@./-]*\.[A-Za-z0-9]+$/;function Gx(e){if(!e)return null;let t=Ux.exec(e);return(t?.[1]??t?.[2]??t?.[3])||(e.split(/\s+/).find(e=>Wx.test(e))??null)}function Kx(e){let t=(e?.children)?.find(e=>e?.type===`element`&&e.tagName===`code`),n=t?.properties?.dataCodeMeta??t?.data?.meta;return typeof n==`string`&&n.trim().length>0?n.trim():void 0}function qx(e,t){let n=e?.position?.start.offset,r=e?.position?.end.offset;if(n===void 0||r===void 0)return!1;let i=t.slice(n,r),a=/^(?:`{3,}|~{3,})/.exec(i)?.[0],o=/(?:^|\n)[ \t>]*(`{3,}|~{3,})[ \t\r]*$/.exec(i)?.[1];return a!==void 0&&o!==void 0&&a[0]===o[0]&&o.length>=a.length}function Jx(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(e=>Jx(e)).join(``):(0,V.isValidElement)(e)?Jx(e.props.children):``}function Yx(e){let t=V.Children.toArray(e);if(t.length!==1)return null;let n=t[0];return!(0,V.isValidElement)(n)||n.type!==`code`&&n.props.node?.tagName!==`code`?null:{className:n.props.className,code:Jx(n.props.children)}}function Xx(e,t,n){return`${Nn(e).toString(36)}:${e.length}:${t}:${n}`}function Zx(e,t){return Math.max(e.length*2,t.length*3)}function Qx(){return an().wordWrap}function $x(e){let t=(0,H.c)(23),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=(0,V.useRef)(null),[a,o]=(0,V.useState)(!1),s=(0,V.useRef)(null),c=a?`Copied`:`Copy table`,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=e=>{let t=i.current?.querySelector(`table`);if(!t||typeof navigator>`u`||navigator.clipboard==null)return;let n=e===`markdown`?Mg(t):Lg(t);navigator.clipboard.writeText(n).then(()=>{s.current!=null&&clearTimeout(s.current),o(!0),s.current=setTimeout(()=>{o(!1),s.current=null},1200)}).catch(t=>{Lx({operation:`copy-table`,format:e},t)})},t[3]=l):l=t[3];let u=l,d,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{s.current!=null&&(clearTimeout(s.current),s.current=null)},f=[],t[4]=d,t[5]=f):(d=t[4],f=t[5]),(0,V.useEffect)(d,f);let p;t[6]!==n||t[7]!==r?(p=(0,U.jsx)(sr,{radius:`none`,chainVerticalScroll:!0,scrollFade:!0,className:`w-full max-w-full`,children:(0,U.jsx)(`table`,{...r,children:n})}),t[6]=n,t[7]=r,t[8]=p):p=t[8];let m;t[9]===c?m=t[10]:(m=(0,U.jsx)(we,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":c}),t[9]=c,t[10]=m);let h=a?Jt:Gt,g;t[11]===h?g=t[12]:(g=(0,U.jsx)(Yt,{className:`size-3`,icon:h}),t[11]=h,t[12]=g);let _;t[13]!==m||t[14]!==g?(_=(0,U.jsx)(fe,{render:m,children:g}),t[13]=m,t[14]=g,t[15]=_):_=t[15];let v;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,U.jsx)(ze,{onClick:()=>u(`markdown`),children:`Copy as Markdown`}),t[16]=v):v=t[16];let y;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,U.jsxs)(Ie,{align:`end`,children:[v,(0,U.jsx)(ze,{onClick:()=>u(`csv`),children:`Copy as CSV`})]}),t[17]=y):y=t[17];let b;t[18]===_?b=t[19]:(b=(0,U.jsx)(`div`,{className:`mt-0.5 flex items-center justify-end select-none`,children:(0,U.jsxs)(ae,{children:[_,y]})}),t[18]=_,t[19]=b);let x;return t[20]!==b||t[21]!==p?(x=(0,U.jsxs)(`div`,{ref:i,className:`chat-markdown-table-container`,children:[p,b]}),t[20]=b,t[21]=p,t[22]=x):x=t[22],x}function eS(e){let t=(0,H.c)(20),{children:n,open:r}=e,[i,a]=(0,V.useState)(r!==void 0&&r),o=(0,V.use)(Aa),s=i,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>a(!0),t[0]=c):c=t[0];let l=ja(c),u,d;if(t[1]!==n){let e=V.Children.toArray(n),r=e.findIndex(tS),i=r>=0?e[r]:null;u=(0,V.isValidElement)(i)&&i.props.children?i.props.children:`Details`;let a;t[4]===r?a=t[5]:(a=(e,t)=>t!==r,t[4]=r,t[5]=a),d=e.filter(a),t[1]=n,t[2]=u,t[3]=d}else u=t[2],d=t[3];let f=d,p=s?`true`:`false`,m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,U.jsx)(ye,{className:`size-4 shrink-0 text-muted-foreground transition-transform`,"aria-hidden":!0}),t[6]=m):m=t[6];let h;t[7]===u?h=t[8]:(h=(0,U.jsxs)(wi,{className:`flex w-full items-center gap-2 py-2 text-left text-sm font-medium text-foreground data-panel-open:[&_svg]:rotate-90`,"data-markdown-details-summary":``,children:[m,(0,U.jsx)(`span`,{children:u})]}),t[7]=u,t[8]=h);let g;t[9]===f?g=t[10]:(g=(0,U.jsx)(`div`,{className:`pb-3 ps-6 text-foreground/[calc(80%+var(--appearance-contrast-boost)/5)]`,"data-markdown-details-content":``,children:f}),t[9]=f,t[10]=g);let _;t[11]!==l||t[12]!==o||t[13]!==g?(_=(0,U.jsx)(yi,{ref:l,hiddenUntilFound:o,children:g}),t[11]=l,t[12]=o,t[13]=g,t[14]=_):_=t[14];let v;return t[15]!==s||t[16]!==p||t[17]!==h||t[18]!==_?(v=(0,U.jsx)(`div`,{className:`my-2 border-y border-border/60`,children:(0,U.jsxs)(bi,{open:s,onOpenChange:a,"data-markdown-details":``,"data-markdown-details-open":p,children:[h,_]})}),t[15]=s,t[16]=p,t[17]=h,t[18]=_,t[19]=v):v=t[19],v}function tS(e){return(0,V.isValidElement)(e)&&e.type===`summary`}var nS={"data-thread-find-ignore":``};function rS(e){let t=(0,H.c)(18),{as:n,language:r,fenceTitle:i,theme:a,wrapped:o,title:s,actions:c,headerProps:l,children:u}=e,d=n===void 0?`div`:n,f=o===void 0||o?`true`:`false`,p=l?.className,m;t[0]===p?m=t[1]:(m=B(`chat-markdown-codeblock-header flex items-center justify-between gap-2 pt-1.5 pr-1.5 pb-0 pl-3 select-none`,p),t[0]=p,t[1]=m);let h;t[2]!==i||t[3]!==r||t[4]!==a||t[5]!==s?(h=s??(0,U.jsx)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5 font-mono text-2xs`,children:(0,U.jsx)(iS,{fenceTitle:i,language:r,theme:a})}),t[2]=i,t[3]=r,t[4]=a,t[5]=s,t[6]=h):h=t[6];let g;t[7]!==c||t[8]!==l||t[9]!==m||t[10]!==h?(g=(0,U.jsxs)(`div`,{...l,className:m,children:[h,c]}),t[7]=c,t[8]=l,t[9]=m,t[10]=h,t[11]=g):g=t[11];let _;return t[12]!==d||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==g?(_=(0,U.jsxs)(d,{className:`chat-markdown-codeblock my-[0.65rem] overflow-hidden rounded-lg border border-border/70 bg-secondary leading-snug dark:border-transparent dark:bg-input/32`,"data-language":r,"data-wrap":f,children:[g,u]}),t[12]=d,t[13]=u,t[14]=r,t[15]=f,t[16]=g,t[17]=_):_=t[17],_}function iS(e){let t=(0,H.c)(26),{fenceTitle:n,language:r,theme:i}=e;if(n){let e;t[0]!==n||t[1]!==i?(e=(0,U.jsx)(Nr,{pathValue:n,kind:`file`,theme:i,className:`size-3.5`}),t[0]=n,t[1]=i,t[2]=e):e=t[2];let r;t[3]===n?r=t[4]:(r=(0,U.jsx)(`span`,{className:`truncate`,children:n}),t[3]=n,t[4]=r);let a;return t[5]!==e||t[6]!==r?(a=(0,U.jsxs)(U.Fragment,{children:[e,r]}),t[5]=e,t[6]=r,t[7]=a):a=t[7],a}let a,o;if(t[8]===r?(a=t[9],o=t[10]):(a=ar(r),o=ir(a),t[8]=r,t[9]=a,t[10]=o),!o){let e;return t[11]===r?e=t[12]:(e=(0,U.jsx)(`span`,{className:`truncate`,children:r}),t[11]=r,t[12]=e),e}let s=`Language: ${r}`,c;t[13]===s?c=t[14]:(c=(0,U.jsx)(`span`,{className:`inline-flex shrink-0 rounded-sm`,"aria-label":s}),t[13]=s,t[14]=c);let l;t[15]!==a||t[16]!==i?(l=(0,U.jsx)(Nr,{pathValue:a,kind:`file`,theme:i,className:`size-3.5`}),t[15]=a,t[16]=i,t[17]=l):l=t[17];let u;t[18]!==c||t[19]!==l?(u=(0,U.jsx)(tr,{render:c,children:l}),t[18]=c,t[19]=l,t[20]=u):u=t[20];let d;t[21]===r?d=t[22]:(d=(0,U.jsx)(nr,{side:`top`,children:r}),t[21]=r,t[22]=d);let f;return t[23]!==u||t[24]!==d?(f=(0,U.jsxs)(rr,{children:[u,d]}),t[23]=u,t[24]=d,t[25]=f):f=t[25],f}function aS(e){let t=(0,H.c)(45),{code:n,language:r,fenceTitle:i,theme:a,onRunShellCommand:o,isStreaming:s,viewToggle:c,canWrap:l,diagram:u,children:d}=e,f=l===void 0||l,p=u!==void 0&&u,[m,h]=(0,V.useState)(!1),[g,_]=(0,V.useState)(Qx),v=(0,V.useRef)(null),y=g?`Disable line wrap`:`Wrap lines`,x=m?`Copied`:`Copy code`,S,C;t[0]!==n||t[1]!==s||t[2]!==r||t[3]!==o?(S=n.trim(),C=o!==void 0&&!s&&/^(?:sh|bash|zsh|fish|shell|powershell|pwsh)$/.test(r)&&n.endsWith(`
48
+ `)&&S.length>0&&!S.endsWith(`\\`)&&!/[\p{Cc}\p{Cf}]/u.test(n.slice(0,-1)),t[0]=n,t[1]=s,t[2]=r,t[3]=o,t[4]=S,t[5]=C):(S=t[4],C=t[5]);let w=C,T;t[6]!==n||t[7]!==i||t[8]!==r?(T=()=>{typeof navigator<`u`&&navigator.clipboard!=null&&navigator.clipboard.writeText(n).then(()=>{v.current!=null&&clearTimeout(v.current),h(!0),v.current=setTimeout(()=>{h(!1),v.current=null},1200)}).catch(e=>{Lx({operation:`copy-code-block`,language:r,...i?{fenceTitle:i}:{}},e)})},t[6]=n,t[7]=i,t[8]=r,t[9]=T):T=t[9];let E=T,D,O;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>()=>{v.current!=null&&(clearTimeout(v.current),v.current=null)},O=[],t[10]=D,t[11]=O):(D=t[10],O=t[11]),(0,V.useEffect)(D,O);let k=m?Jt:Gt,A;t[12]===k?A=t[13]:(A=(0,U.jsx)(Yt,{className:`size-3`,icon:k}),t[12]=k,t[13]=A);let j;t[14]!==x||t[15]!==E||t[16]!==A?(j=(0,U.jsx)(we,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,onClick:E,"aria-label":x,children:A}),t[14]=x,t[15]=E,t[16]=A,t[17]=j):j=t[17];let M=j;if(p){let e;t[18]!==M||t[19]!==c?(e=(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5 pt-1.5 pr-1.5 select-none`,children:[c,M]}),t[18]=M,t[19]=c,t[20]=e):e=t[20];let n;return t[21]!==d||t[22]!==r||t[23]!==e?(n=(0,U.jsxs)(`div`,{className:`my-[0.65rem] border border-transparent`,"data-language":r,children:[e,d]}),t[21]=d,t[22]=r,t[23]=e,t[24]=n):n=t[24],n}let N;t[25]!==f||t[26]!==y||t[27]!==g?(N=f?(0,U.jsx)(we,{type:`button`,variant:g?`secondary`:`ghost-muted`,size:`icon-xs`,"aria-pressed":g,onClick:()=>_(oS),"aria-label":y,children:(0,U.jsx)(Fe,{className:`size-3`})}):null,t[25]=f,t[26]=y,t[27]=g,t[28]=N):N=t[28];let P;t[29]!==w||t[30]!==S||t[31]!==o?(P=w?(0,U.jsx)(we,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,onClick:()=>o(S),"aria-label":`Run in terminal`,children:(0,U.jsx)(b,{className:`size-3`})}):null,t[29]=w,t[30]=S,t[31]=o,t[32]=P):P=t[32];let F;t[33]!==M||t[34]!==N||t[35]!==P||t[36]!==c?(F=(0,U.jsxs)(`span`,{className:`flex items-center gap-0.5`,role:`toolbar`,"aria-label":`Code block actions`,children:[N,P,c,M]}),t[33]=M,t[34]=N,t[35]=P,t[36]=c,t[37]=F):F=t[37];let ee;return t[38]!==d||t[39]!==i||t[40]!==r||t[41]!==F||t[42]!==a||t[43]!==g?(ee=(0,U.jsx)(rS,{language:r,fenceTitle:i,theme:a,wrapped:g,headerProps:nS,actions:F,children:d}),t[38]=d,t[39]=i,t[40]=r,t[41]=F,t[42]=a,t[43]=g,t[44]=ee):ee=t[44],ee}function oS(e){return!e}function sS(e){let t=(0,H.c)(26),{code:n,fenceTitle:r,theme:i,isStreaming:a,onExpand:o,children:s}=e,[c,l]=(0,V.useState)(!1),u=(0,V.use)(Aa),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>l(!0),t[0]=d):d=t[0];let f=ja(d),p;t[1]!==n||t[2]!==a||t[3]!==c?(p=!c&&!a&&n.trim().length>0,t[1]=n,t[2]=a,t[3]=c,t[4]=p):p=t[4];let m=p,h=c?`Show diagram`:`Show code`,g=!m,_;t[5]!==a||t[6]!==c||t[7]!==h?(_=a?null:(0,U.jsx)(we,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,onClick:()=>l(cS),"aria-label":h,children:c?(0,U.jsx)(ke,{className:`size-3`}):(0,U.jsx)(L,{className:`size-3`})}),t[5]=a,t[6]=c,t[7]=h,t[8]=_):_=t[8];let v;t[9]!==s||t[10]!==n||t[11]!==o||t[12]!==u||t[13]!==m||t[14]!==f||t[15]!==i?(v=m?(0,U.jsxs)(ci,{resetKeys:[n,i],fallback:s,children:[(0,U.jsx)(V.Suspense,{fallback:(0,U.jsx)(`div`,{className:`flex min-h-36 items-center justify-center text-xs text-muted-foreground`,children:`Rendering diagram`}),children:(0,U.jsx)(Jb,{source:n,onExpand:o})}),u?(0,U.jsx)(`pre`,{ref:f,hidden:!0,"aria-hidden":!0,children:n}):null]}):s,t[9]=s,t[10]=n,t[11]=o,t[12]=u,t[13]=m,t[14]=f,t[15]=i,t[16]=v):v=t[16];let y;return t[17]!==n||t[18]!==r||t[19]!==a||t[20]!==m||t[21]!==g||t[22]!==_||t[23]!==v||t[24]!==i?(y=(0,U.jsx)(aS,{code:n,language:`mermaid`,fenceTitle:r,theme:i,isStreaming:a,canWrap:g,diagram:m,viewToggle:_,children:v}),t[17]=n,t[18]=r,t[19]=a,t[20]=m,t[21]=g,t[22]=_,t[23]=v,t[24]=i,t[25]=y):y=t[25],y}function cS(e){return!e}function lS(e){let t=(0,H.c)(17),{className:n,code:r,themeName:i,isStreaming:a}=e,[o,s]=(0,V.useState)(a);a&&!o&&s(!0);let c,l,u;t[0]!==n||t[1]!==r||t[2]!==o||t[3]!==a||t[4]!==i?(l=Hx(n),c=Xx(r,l,i),u=!a&&!o?Rx.get(c):null,t[0]=n,t[1]=r,t[2]=o,t[3]=a,t[4]=i,t[5]=c,t[6]=l,t[7]=u):(c=t[5],l=t[6],u=t[7]);let d=u;if(d!=null){let e;return t[8]===d?e=t[9]:(e=(0,U.jsx)(`div`,{className:`chat-markdown-shiki`,dangerouslySetInnerHTML:{__html:d}}),t[8]=d,t[9]=e),e}let f=a||o,p;return t[10]!==c||t[11]!==r||t[12]!==a||t[13]!==l||t[14]!==f||t[15]!==i?(p=(0,U.jsx)(uS,{code:r,language:l,themeName:i,cacheKey:c,isStreaming:a,preserveLines:f}),t[10]=c,t[11]=r,t[12]=a,t[13]=l,t[14]=f,t[15]=i,t[16]=p):p=t[16],p}function uS({code:e,language:t,themeName:n,cacheKey:r,isStreaming:i,preserveLines:a}){let o=(0,V.use)(Ti(t)),s=(0,V.useMemo)(()=>a?Zv(o,t,n):null,[o,a,t,n]),c=(0,V.useMemo)(()=>{try{return s?s(e):a?o.codeToHast(e,{lang:t,theme:n}):o.codeToHtml(e,{lang:t,theme:n})}catch(r){return console.warn(`Code highlighting failed for language "${t}", falling back to plain text.`,r instanceof Error?r.message:r),a?o.codeToHast(e,{lang:`text`,theme:n}):o.codeToHtml(e,{lang:`text`,theme:n})}},[e,o,s,t,a,n]);return(0,V.useEffect)(()=>{if(!i){let t=typeof c==`string`?c:Tn(c);Rx.set(r,t,Zx(t,e))}},[r,e,c,i]),typeof c==`string`?(0,U.jsx)(`div`,{className:`chat-markdown-shiki`,dangerouslySetInnerHTML:{__html:c}}):(0,U.jsx)(`div`,{className:`chat-markdown-shiki`,children:(0,U.jsx)(ty,{root:c})})}var dS=`chat-markdown-file-link`;function fS(e){let t=Yn(e),n=rx(t)??t;return Px.test(n)?n.replaceAll(`\\`,`/`):n}var pS=`block size-full shrink-0 select-none`,mS=new Set;function hS(e){let t=e.toLowerCase();return t===`github.com`||t.endsWith(`.github.com`)?Ar:null}var gS=(0,V.memo)(function(e){let t=(0,H.c)(10),{host:n}=e,[r,i]=(0,V.useState)(null),a;t[0]===n?a=t[1]:(a=hS(n),t[0]=n,t[1]=a);let o=a,s;t[2]!==o||t[3]!==n?(s=o?null:th(`https://${n}`),t[2]=o,t[3]=n,t[4]=s):s=t[4];let c=s,l;return t[5]!==o||t[6]!==r||t[7]!==c||t[8]!==n?(l=(0,U.jsx)(`span`,{className:`ms-[0.25em] me-[0.2em] inline-flex size-[14px] [vertical-align:-0.125em]`,"aria-hidden":!0,children:o?(0,U.jsx)(o,{className:pS}):c===null||r===n||mS.has(n)?(0,U.jsx)(tt,{className:pS}):(0,U.jsx)(`img`,{src:c,alt:``,loading:`lazy`,draggable:!1,className:B(pS,`rounded-sm`),onError:()=>{mS.add(n),i(n)}})}),t[5]=o,t[6]=r,t[7]=c,t[8]=n,t[9]=l):l=t[9],l}),_S=`max-w-[min(100%,30rem)]`,vS=B(`max-h-[30rem]`,_S),yS=`inline-block!`,bS=`rounded-lg border border-border/40`,xS=B(`h-auto w-auto object-contain`,vS);function SS(e,t,n){return`![${e.replaceAll(`\\`,`\\\\`).replaceAll(`[`,`\\[`).replaceAll(`]`,`\\]`)}](${t}${n===void 0?``:` "${n.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"`})`}function CS(e,t,n=30){let r=Number(e),i=Number(t),a=Number.isFinite(r)&&r>0,o=Number.isFinite(i)&&i>0;if(a&&o)return{width:r,height:`auto`,aspectRatio:`${r} / ${i}`,maxWidth:`min(100%, 30rem, ${n*r/i}rem)`};if(a)return{maxWidth:`min(100%, 30rem, ${r}px)`};if(o)return{maxHeight:`min(30rem, ${i}px)`}}var wS=B(yS,bS),TS=V.createContext(!1);function ES(e,t){if(!e)return{};let n=t.trim()||`image`,r=t=>{if(t.currentTarget.closest(`a`))return;t.preventDefault(),t.stopPropagation();let n=Gv.get(t.currentTarget);n&&e(Kv(t.currentTarget,n))};return{role:`button`,tabIndex:0,"aria-label":`Preview ${n}`,onClick:r,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&r(e)}}}function DS(e){let t=(0,H.c)(7),n=e.kind===`video`?`Video unavailable`:`Image unavailable`,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,U.jsx)(_,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),t[0]=r):r=t[0];let i;t[1]!==n||t[2]!==e.alt||t[3]!==e.detail?(i=[n,e.alt,e.detail].filter(Boolean),t[1]=n,t[2]=e.alt,t[3]=e.detail,t[4]=i):i=t[4];let a=i.join(` · `),o;return t[5]===a?o=t[6]:(o=(0,U.jsxs)(`span`,{"data-thread-find-ignore":!0,className:`inline-flex items-center gap-1.5`,children:[r,a]}),t[5]=a,t[6]=o),o}function OS(e){let t=(0,H.c)(11),n=e.copyMarkdown,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=B(yS,`rounded-md border border-border/40 bg-muted/40 px-2 py-1 text-xs text-muted-foreground`),t[0]=r):r=t[0];let i;t[1]!==e.alt||t[2]!==e.detail||t[3]!==e.kind?(i=(0,U.jsx)(DS,{alt:e.alt,kind:e.kind,detail:e.detail}),t[1]=e.alt,t[2]=e.detail,t[3]=e.kind,t[4]=i):i=t[4];let a;t[5]!==e.copyMarkdown||t[6]!==i?(a=(0,U.jsx)(`span`,{"data-markdown-copy":n,className:r,children:i}),t[5]=e.copyMarkdown,t[6]=i,t[7]=a):a=t[7];let o=a,s;return t[8]!==o||t[9]!==e.actionsSource?(s=e.actionsSource?(0,U.jsx)(Oa,{source:e.actionsSource,children:o}):o,t[8]=o,t[9]=e.actionsSource,t[10]=s):s=t[10],s}var kS=B(`aspect-video w-full overflow-hidden bg-muted/60`,_S,bS);function AS(e){let t=(0,H.c)(52),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),o=e.src??n,s=e.sourceFailed===!0||o!==null&&i===o,c=o!==null&&!s&&(!e.standalone||n!==null),l;t[0]!==e.actionsSource||t[1]!==e.alt||t[2]!==e.originalUrl||t[3]!==o?(l=t=>{t&&(t.complete&&t.naturalWidth>0&&r(t.currentSrc||t.src),Gv.set(t,{src:o,name:e.alt.trim()||`image`,actionsSource:e.actionsSource,...e.originalUrl?{originalUrl:e.originalUrl}:{}}))},t[0]=e.actionsSource,t[1]=e.alt,t[2]=e.originalUrl,t[3]=o,t[4]=l):l=t[4];let u=l,d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>({onLoad:()=>{r(e),a(null)},onError:()=>{a(e),r(null)}}),t[5]=d):d=t[5];let f=d;if(c){let n=e.actionsSource,r=e.imageProps,i=e.alt,a=e.copyMarkdown,s=e.onImageExpand&&`cursor-zoom-in`,c;t[6]!==e.className||t[7]!==s?(c=B(xS,e.className,s),t[6]=e.className,t[7]=s,t[8]=c):c=t[8];let l=e.style,d;t[9]!==e.alt||t[10]!==e.onImageExpand?(d=ES(e.onImageExpand,e.alt),t[9]=e.alt,t[10]=e.onImageExpand,t[11]=d):d=t[11];let p;t[12]===o?p=t[13]:(p=f(o),t[12]=o,t[13]=p);let m;t[14]!==u||t[15]!==e.alt||t[16]!==e.copyMarkdown||t[17]!==e.imageProps||t[18]!==e.style||t[19]!==o||t[20]!==p||t[21]!==c||t[22]!==d?(m=(0,U.jsx)(`img`,{...r,ref:u,src:o,alt:i,"data-markdown-copy":a,decoding:`async`,draggable:!1,className:c,style:l,...d,...p}),t[14]=u,t[15]=e.alt,t[16]=e.copyMarkdown,t[17]=e.imageProps,t[18]=e.style,t[19]=o,t[20]=p,t[21]=c,t[22]=d,t[23]=m):m=t[23];let h;return t[24]!==e.actionsSource||t[25]!==m?(h=(0,U.jsx)(Oa,{source:n,children:m}),t[24]=e.actionsSource,t[25]=m,t[26]=h):h=t[26],h}if(!e.standalone){let n;return t[27]!==s||t[28]!==e.actionsSource||t[29]!==e.alt||t[30]!==e.copyMarkdown||t[31]!==e.imageProps?.id||t[32]!==e.unavailableDetail?(n=s?(0,U.jsx)(OS,{alt:e.alt,copyMarkdown:e.copyMarkdown,actionsSource:e.actionsSource,detail:e.unavailableDetail}):(0,U.jsx)(`span`,{id:e.imageProps?.id,"data-markdown-copy":e.copyMarkdown,role:`status`,"aria-label":`Loading image`,className:yS}),t[27]=s,t[28]=e.actionsSource,t[29]=e.alt,t[30]=e.copyMarkdown,t[31]=e.imageProps?.id,t[32]=e.unavailableDetail,t[33]=n):n=t[33],n}let p=e.actionsSource,m=e.imageProps?.id,h=e.copyMarkdown,g;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(g=B(yS,kS,`relative`),t[34]=g):g=t[34];let _;t[35]===s?_=t[36]:(_=s?{role:`alert`}:{role:`status`,"aria-label":`Loading image`},t[35]=s,t[36]=_);let v;t[37]!==s||t[38]!==u||t[39]!==e.alt||t[40]!==e.unavailableDetail||t[41]!==o?(v=s?(0,U.jsx)(`span`,{className:`flex size-full items-center justify-center p-2 text-center text-xs text-muted-foreground`,children:(0,U.jsx)(DS,{alt:e.alt,detail:e.unavailableDetail})}):o===null?null:(0,U.jsx)(`img`,{ref:u,src:o,alt:e.alt,decoding:`async`,draggable:!1,className:`invisible absolute inset-0 size-full`,...f(o)}),t[37]=s,t[38]=u,t[39]=e.alt,t[40]=e.unavailableDetail,t[41]=o,t[42]=v):v=t[42];let y;t[43]!==e.copyMarkdown||t[44]!==e.style||t[45]!==m||t[46]!==_||t[47]!==v?(y=(0,U.jsx)(`span`,{id:m,"data-markdown-copy":h,className:g,style:e.style,..._,children:v}),t[43]=e.copyMarkdown,t[44]=e.style,t[45]=m,t[46]=_,t[47]=v,t[48]=y):y=t[48];let b;return t[49]!==e.actionsSource||t[50]!==y?(b=(0,U.jsx)(Oa,{source:p,children:y}),t[49]=e.actionsSource,t[50]=y,t[51]=b):b=t[51],b}function jS(e){let t=(0,H.c)(12),n=e.mediaIdentity??e.copyMarkdown??e.src,r=e.src,i=e.sourceFailed,a=e.alt,o=e.originalUrl,s=e.style,c=e.copyMarkdown,l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=B(yS,_S,`w-full`),u=B(vS,bS),t[0]=l,t[1]=u):(l=t[0],u=t[1]);let d;return t[2]!==e.actionsSource||t[3]!==e.alt||t[4]!==e.copyMarkdown||t[5]!==e.onRetry||t[6]!==e.originalUrl||t[7]!==e.sourceFailed||t[8]!==e.src||t[9]!==e.style||t[10]!==n?(d=(0,U.jsx)(ka,{src:r,sourceFailed:i,label:a,originalUrl:o,style:s,copyMarkdown:c,className:l,videoClassName:u,onRetry:e.onRetry,actionsSource:e.actionsSource},n),t[2]=e.actionsSource,t[3]=e.alt,t[4]=e.copyMarkdown,t[5]=e.onRetry,t[6]=e.originalUrl,t[7]=e.sourceFailed,t[8]=e.src,t[9]=e.style,t[10]=n,t[11]=d):d=t[11],d}var MS=(0,V.memo)(function(e){let t=(0,H.c)(65),n=xr(e.environmentId,e.resource),r=Sr(e.environmentId,e.resource),i=e.resource,a;t[0]!==e.workspaceRoot||t[1]!==i._tag||t[2]!==i.path?(a=i._tag===`media-file`?i.path:i._tag===`workspace-file`&&e.workspaceRoot?`${e.workspaceRoot.replace(/[\\/]+$/,``)}/${i.path}`:void 0,t[0]=e.workspaceRoot,t[1]=i._tag,t[2]=i.path,t[3]=a):a=t[3];let o=a,s;t[4]!==o||t[5]!==e.originalUrl||t[6]!==e.workspaceRoot?(s=o?Jn(o,e.workspaceRoot):e.originalUrl?Kn(e.originalUrl):void 0,t[4]=o,t[5]=e.originalUrl,t[6]=e.workspaceRoot,t[7]=s):s=t[7];let c=s,l=c?.kind===`file`?c.relativePath:void 0,u=n._tag===`Failure`?e.fallbackSrc:void 0,d=n._tag===`Success`?n.url+(e.srcFragment??``):u===void 0?null:u+(e.srcFragment??``),f=n._tag===`Success`?n.imageDimensions:void 0,p=e.maxHeightRem??30,m;t[8]!==f||t[9]!==p||t[10]!==e.style?(m=e.style??(f?CS(f.width,f.height,p):p===30?void 0:{maxHeight:`${p}rem`}),t[8]=f,t[9]=p,t[10]=e.style,t[11]=m):m=t[11];let h=m,g=e.kind??`image`,_=e.alt||(e.kind??`image`),v;t[12]!==u||t[13]!==e.environmentId||t[14]!==i?(v=u===void 0?{asset:{environmentId:e.environmentId,resource:i}}:{},t[12]=u,t[13]=e.environmentId,t[14]=i,t[15]=v):v=t[15];let y;t[16]===c?y=t[17]:(y=c?{reference:c}:{},t[16]=c,t[17]=y);let b;t[18]!==e.environmentId||t[19]!==l||t[20]!==i._tag||t[21]!==i.threadId?(b=l&&(i._tag===`media-file`||i._tag===`workspace-file`)?{onOpenFile:()=>hn.getState().openFile({environmentId:e.environmentId,threadId:i.threadId},l)}:{},t[18]=e.environmentId,t[19]=l,t[20]=i._tag,t[21]=i.threadId,t[22]=b):b=t[22];let x;t[23]!==d||t[24]!==g||t[25]!==_||t[26]!==v||t[27]!==y||t[28]!==b?(x={kind:g,name:_,src:d,...v,...y,...b},t[23]=d,t[24]=g,t[25]=_,t[26]=v,t[27]=y,t[28]=b,t[29]=x):x=t[29];let S=x;if(e.kind===`video`){let i=n._tag===`Failure`&&u===void 0,a=e.alt,o=e.copyMarkdown,s=e.originalUrl,c=e.style,l;t[30]!==e.environmentId||t[31]!==e.resource||t[32]!==e.srcFragment?(l=JSON.stringify([e.environmentId,e.resource,e.srcFragment]),t[30]=e.environmentId,t[31]=e.resource,t[32]=e.srcFragment,t[33]=l):l=t[33];let f;return t[34]!==S||t[35]!==e.alt||t[36]!==e.copyMarkdown||t[37]!==e.originalUrl||t[38]!==e.style||t[39]!==r||t[40]!==d||t[41]!==l||t[42]!==i?(f=(0,U.jsx)(jS,{src:d,sourceFailed:i,alt:a,copyMarkdown:o,originalUrl:s,style:c,mediaIdentity:l,onRetry:r,actionsSource:S}),t[34]=S,t[35]=e.alt,t[36]=e.copyMarkdown,t[37]=e.originalUrl,t[38]=e.style,t[39]=r,t[40]=d,t[41]=l,t[42]=i,t[43]=f):f=t[43],f}let C;t[44]!==e.environmentId||t[45]!==e.resource||t[46]!==e.srcFragment?(C=JSON.stringify([e.environmentId,e.resource,e.srcFragment]),t[44]=e.environmentId,t[45]=e.resource,t[46]=e.srcFragment,t[47]=C):C=t[47];let w=n._tag===`Failure`&&u===void 0,T=n._tag===`Failure`&&n.reason===`missing-file-access`&&u===void 0?_r:void 0,E=e.alt,D=e.copyMarkdown,O=e.standalone??!0,k=e.framed===!1?void 0:wS,A;t[48]!==e.className||t[49]!==k?(A=B(k,e.className),t[48]=e.className,t[49]=k,t[50]=A):A=t[50];let j;return t[51]!==S||t[52]!==e.alt||t[53]!==e.copyMarkdown||t[54]!==e.imageProps||t[55]!==e.onImageExpand||t[56]!==e.originalUrl||t[57]!==d||t[58]!==h||t[59]!==w||t[60]!==T||t[61]!==O||t[62]!==A||t[63]!==C?(j=(0,U.jsx)(AS,{src:d,sourceFailed:w,unavailableDetail:T,alt:E,copyMarkdown:D,standalone:O,className:A,style:h,imageProps:e.imageProps,actionsSource:S,originalUrl:e.originalUrl,onImageExpand:e.onImageExpand},C),t[51]=S,t[52]=e.alt,t[53]=e.copyMarkdown,t[54]=e.imageProps,t[55]=e.onImageExpand,t[56]=e.originalUrl,t[57]=d,t[58]=h,t[59]=w,t[60]=T,t[61]=O,t[62]=A,t[63]=C,t[64]=j):j=t[64],j});function NS(e){let t=/^(?:https?:\/\/)/i.exec(e)?.[0];return t?t.length:Math.min(e.length,1)}function PS(e){return Array.from(e.matchAll(/\s+|\S+/g),({0:e,index:t})=>e.length<=16?e:(0,U.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e},t))}function FS(e){if(!e||typeof e!=`object`||!(`children`in e)||!Array.isArray(e.children))return null;let t=e.children.map(e=>e&&typeof e==`object`&&`type`in e&&e.type===`text`&&`value`in e&&typeof e.value==`string`?e.value:null);return t.every(e=>e!==null)?t.join(``):null}function IS(e){return!e||typeof e!=`object`?``:`type`in e&&e.type===`text`&&`value`in e&&typeof e.value==`string`?e.value:!(`children`in e)||!Array.isArray(e.children)?``:e.children.map(IS).join(``)}function LS(e){return!e||typeof e!=`object`?!1:`type`in e&&e.type===`text`&&`value`in e&&typeof e.value==`string`&&e.value.trim().length>0||`children`in e&&Array.isArray(e.children)&&e.children.some(LS)}var RS=`user-content-`;function zS(e){let t=e.slice(1);try{return decodeURIComponent(t)}catch{return t}}function BS(e){let t=e;for(;t.startsWith(RS);)t=t.slice(13);return t}function VS(e,t){let n=zS(t),r=BS(n),i=e=>e.id===n||BS(e.id)===r,a=e.closest(`.chat-markdown`);if(a){let e=Array.from(a.querySelectorAll(`[id]`)).find(i);if(e)return e}return document.getElementById(n)??Array.from(document.querySelectorAll(`[id]`)).find(i)??null}function HS(e,t){e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),VS(e.currentTarget,t)?.scrollIntoView({block:`start`}))}function US(e){return e.trim().toLowerCase().replace(/[^\p{L}\p{M}\p{N}\p{Pc} -]/gu,``).replace(/ /g,`-`)}function WS(){return e=>{let t=new Set,n=e=>{let r=e.properties?.id;typeof r==`string`&&t.add(r),e.children?.forEach(n)};n(e);let r=new Map,i=e=>{if(e.type===`element`&&e.tagName&&/^h[1-6]$/.test(e.tagName)){let n=US(IS(e));if(e.properties?.id===void 0&&n){let i=r.get(n)??0,a=`${RS}${n}`;for(;t.has(a);)i+=1,a=`${RS}${n}-${i}`;r.set(n,i),t.add(a),e.properties={...e.properties,id:a}}}else e.children?.forEach(i)};i(e)}}var GS=[...Um,WS,mv],KS=[WS,mv];function qS(e){return Fr(e)||Ge(e)||ym(e)||Un(e)||ix(e)?e:rx(e)??ig(e)}function JS(e){let t=(0,H.c)(13),{host:n,plainText:r,children:i}=e;if(r){let e;if(t[0]!==n||t[1]!==r){let i=NS(r),a;t[3]===n?a=t[4]:(a=(0,U.jsx)(gS,{host:n}),t[3]=n,t[4]=a),e=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`whitespace-nowrap`,children:[a,r.slice(0,i)]}),PS(r.slice(i))]}),t[0]=n,t[1]=r,t[2]=e}else e=t[2];return e}let a,o;if(t[5]!==i||t[6]!==n){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=V.Children.toArray(i),r=e[0];if(typeof r==`string`&&r.length>0){let i=NS(r),a;t[9]===n?a=t[10]:(a=(0,U.jsx)(gS,{host:n}),t[9]=n,t[10]=a),o=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`whitespace-nowrap`,children:[a,r.slice(0,i)]}),PS(r.slice(i)),e.slice(1)]});break bb0}let s;t[11]===n?s=t[12]:(s=(0,U.jsx)(gS,{host:n}),t[11]=n,t[12]=s),a=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[s,r]}),e.slice(1)]})}t[5]=i,t[6]=n,t[7]=a,t[8]=o}else a=t[7],o=t[8];return o===Symbol.for(`react.early_return_sentinel`)?a:o}var YS=(0,V.memo)(function({environmentId:e,href:t,targetPath:n,iconPath:r,displayPath:i,panelPath:a,line:o,label:s,copyMarkdown:c,theme:l,threadRef:u,onOpen:d,onOpenInPanel:f,openInEditorMenuLabel:p,onOpenInBrowser:m,onOpenMedia:h,onReveal:g,revealLabel:_}){let v=(0,V.useCallback)(()=>{d&&(async()=>{try{let e=await d(n);if(e._tag===`Success`||vt(e))return;Lx({operation:`open-file-in-editor`,target:n},e.cause);let t=_t(e);Qt.add(Sn({type:`error`,title:`Unable to open file`,description:t instanceof Error?t.message:`An error occurred.`}))}catch(e){Lx({operation:`open-file-in-editor`,target:n},e),Qt.add(Sn({type:`error`,title:`Unable to open file`,description:e instanceof Error?e.message:`An error occurred.`}))}})()},[d,n]),y=(0,V.useCallback)(()=>{u&&a?f(a,o):h?h():v()},[v,o,f,h,a,u]),b=(0,V.useCallback)(()=>{m&&(async()=>{try{let e=await m();if(e._tag===`Success`||vt(e))return;Lx({operation:`open-file-in-browser`,target:n},e.cause);let t=_t(e);Qt.add(Sn({type:`error`,title:`Unable to open file in browser`,description:t instanceof Error?t.message:`An error occurred.`}))}catch(e){Lx({operation:`open-file-in-browser`,target:n},e),Qt.add(Sn({type:`error`,title:`Unable to open file in browser`,description:e instanceof Error?e.message:`An error occurred.`}))}})()},[m,n]),x=(0,V.useCallback)(()=>{g&&(async()=>{try{let e=await g();if(e._tag===`Success`||vt(e))return;Lx({operation:`reveal-file-in-file-manager`,target:n},e.cause);let t=_t(e);Qt.add(Sn({type:`error`,title:`Unable to reveal file`,description:t instanceof Error?t.message:`An error occurred.`}))}catch(e){Lx({operation:`reveal-file-in-file-manager`,target:n},e),Qt.add(Sn({type:`error`,title:`Unable to reveal file`,description:e instanceof Error?e.message:`An error occurred.`}))}})()},[g,n]),S=(0,V.useCallback)((e,t)=>{typeof window>`u`||!navigator.clipboard?.writeText?Qt.add(Sn({type:`error`,title:`Failed to copy ${t.toLowerCase()}`,description:`Clipboard API unavailable.`})):navigator.clipboard.writeText(e).then(()=>{Qt.add({type:`success`,title:`${t} copied`,description:e})},e=>{Lx({operation:`copy-file-path`,target:n,copyTarget:t},e),Qt.add(Sn({type:`error`,title:`Failed to copy ${t.toLowerCase()}`,description:e instanceof Error?e.message:`An error occurred.`}))})},[n]),C=(0,V.useCallback)(async e=>{let t=en();if(t)try{let r=await t.contextMenu.show([...h?[{id:`preview-media`,label:`Preview media`}]:[],...d?[{id:`open`,label:p}]:[],...m?[{id:`open-in-browser`,label:`Open in integrated browser`}]:[],...g&&_?[{id:`reveal`,label:_}]:[],{id:`copy-relative`,label:`Copy relative path`},{id:`copy-full`,label:`Copy full path`}],e);if(r===`preview-media`){h?.();return}if(r===`open`){v();return}if(r===`open-in-browser`){b();return}if(r===`reveal`){x();return}if(r===`copy-relative`){S(i,`Relative path`);return}r===`copy-full`&&S(n,`Full path`)}catch(e){Lx({operation:`show-file-context-menu`,target:n},e)}},[i,S,b,v,x,m,h,d,g,p,_,n]),w=(0,V.useCallback)(e=>{e.preventDefault(),e.stopPropagation();let t=e.clientX===0&&e.clientY===0?(()=>{let t=e.currentTarget.getBoundingClientRect();return{x:t.left,y:t.bottom}})():{x:e.clientX,y:e.clientY};C(t)},[C]),T=d!==void 0,E=m!==void 0,D=u!==void 0&&!!a,O=Dx({canOpenInEditor:T,canOpenInBrowser:E,canOpenInPanel:D,canOpenMedia:h!==void 0}),k=Ox({iconPath:r,canOpenInEditor:T,canOpenInBrowser:E,canOpenInPanel:D});return(0,U.jsxs)(rr,{children:[(0,U.jsx)(tr,{render:O?(0,U.jsx)(a_,{kind:`mention`,render:(0,U.jsx)(`a`,{href:t}),className:dS,"data-markdown-copy":c,onClick:e=>{e.preventDefault(),e.stopPropagation(),d&&tx(e)?v():k?b():y()},onContextMenu:w,children:(0,U.jsx)(Yv,{path:r,environmentId:e,label:s,theme:l})}):(0,U.jsx)(a_,{kind:`mention`,render:(0,U.jsx)(`button`,{type:`button`}),"aria-label":`File options for ${s}`,"aria-haspopup":`menu`,className:B(dS,`select-text`),"data-markdown-copy":c,onClick:w,onContextMenu:w,children:(0,U.jsx)(Yv,{path:r,environmentId:e,label:s,theme:l})})}),(0,U.jsx)(nr,{side:`top`,variant:`code`,children:(0,U.jsx)(Jv,{path:r,label:n,environmentId:e})})]})},XS);function XS(e,t){return e.href===t.href&&e.targetPath===t.targetPath&&e.iconPath===t.iconPath&&e.environmentId===t.environmentId&&e.displayPath===t.displayPath&&e.panelPath===t.panelPath&&e.line===t.line&&e.label===t.label&&e.copyMarkdown===t.copyMarkdown&&e.theme===t.theme&&e.threadRef===t.threadRef&&e.onOpen===t.onOpen&&e.onOpenInPanel===t.onOpenInPanel&&e.openInEditorMenuLabel===t.openInEditorMenuLabel&&e.onOpenInBrowser===t.onOpenInBrowser&&e.onOpenMedia===t.onOpenMedia&&e.onReveal===t.onReveal&&e.revealLabel===t.revealLabel}function ZS(e,t,n){let r=Rn(dm(e)).filter(e=>!Ge(e)).map(fS).filter(e=>sx(e,t,n??t)),i=Hn(e).filter(e=>ax(e,t,n??t));return JSON.stringify([[...new Set(r)],[...new Set(i)]])}function QS(e,t,n){let[r,i]=JSON.parse(e),a=new Map;for(let e of r){let r=sx(e,t,n??t);r&&a.set(e,r)}let o=new Map;for(let e of i){let r=ax(e,t,n??t);r&&o.set(e,r)}return{markdownFileLinkMetaByHref:a,inlineCodeFileLinkMetaByText:o,fileLinkParentSuffixByPath:xn([...[...a.values()].map(e=>e.filePath),...[...o.values()].map(e=>e.filePath)])}}function $S(e){let t=(0,H.c)(126),{text:n,inline:r,cwd:i,threadRef:a,pullRequestPanelRef:o,environmentId:s,onTaskListChange:c,isStreaming:l,skills:u,onUseArtifactTemplate:d,onRunShellCommand:f,imageBaseDir:p,onImageExpand:m,renderContextReference:h,headingLevelOffset:g,githubMedia:_}=e,v=r!==void 0&&r,y=l!==void 0&&l,b=u===void 0?kx:u,x=g===void 0?0:g,C=_!==void 0&&_,{resolvedTheme:w}=tn(),[T,E]=(0,V.useState)(null),D=(0,V.useRef)(null),O=m??E,k=(0,V.useRef)(0),A;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>(E(null),()=>{k.current+=1}),t[0]=A):A=t[0];let j=a?.environmentId,M=a?.threadId,N;t[1]!==i||t[2]!==s||t[3]!==p||t[4]!==j||t[5]!==M?(N=[j,M,s,i,p],t[1]=i,t[2]=s,t[3]=p,t[4]=j,t[5]=M,t[6]=N):N=t[6],(0,V.useEffect)(A,N);let P;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(P={reportFailure:!1,refresh:!0},t[7]=P):P=t[7];let F=br(vr.createUrl,P),ee;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(ee={reportFailure:!1},t[8]=ee):ee=t[8];let te=br(Nt.searchEntries,ee),ne;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(ne={reportFailure:!1},t[9]=ne):ne=t[9];let re=mn(jr.open,ne),ie=ri(a?.environmentId),I=a?.environmentId??s??null,L=cn(I,ft),ae=cn(I,st),oe=Zi(I),se;t[10]!==L||t[11]!==I||t[12]!==oe?(se=L&&Ex(I,oe.state.mode,oe.isResolved),t[10]=L,t[11]=I,t[12]=oe,t[13]=se):se=t[13];let ce=se,le=dn(I),ue;t[14]!==F||t[15]!==i||t[16]!==O||t[17]!==le||t[18]!==a?(ue=(e,t,n)=>{let r=k.current+=1;hv({source:e,resolvedFilePath:t,cwd:i,threadRef:a,httpBaseUrl:le._tag===`Some`?le.value.httpBaseUrl:void 0,createAssetUrl:F,onOpenFile:a?e=>hn.getState().openFile(a,e):void 0}).then(e=>{if(e&&k.current===r){let t=e.images[e.index];O(t&&t.type!==`video`&&D.current?Kv(n??D.current,t):e)}},e=>{k.current===r&&Qt.add(Sn({type:`error`,title:`Media unavailable`,description:e instanceof Error?e.message:`The file could not be loaded. It may have been moved or deleted.`}))})},t[14]=F,t[15]=i,t[16]=O,t[17]=le,t[18]=a,t[19]=ue):ue=t[19];let de=ue,fe;t[20]===I?fe=t[21]:(fe=sn.configValueAtom(I),t[20]=I,t[21]=fe);let pe=S(fe),R=jt(),z;t[22]===pe?.availableEditors?z=t[23]:(z=pe?.availableEditors??[],t[22]=pe?.availableEditors,t[23]=z);let he=z,[ge]=Ci(he),_e;t[24]===ge?_e=t[25]:(_e=Gi(ge),t[24]=ge,t[25]=_e);let ve=_e,ye=Si(I,he),be;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(be={reportFailure:!1},t[26]=be):be=t[26];let xe=mn(It.openInEditor,be),Se;t[27]!==I||t[28]!==pe?(Se=I!==null&&pe?.shellRevealInFileManager===!0&&pe.availableEditors.includes(`file-manager`)?pe.shellRevealInFileManagerKind===void 0?zi(pe.environment.platform.os):Bi(pe.shellRevealInFileManagerKind):void 0,t[27]=I,t[28]=pe,t[29]=Se):Se=t[29];let Ce=Se,we;t[30]!==I||t[31]!==xe?(we=e=>I===null?Promise.resolve(me(gt(new xi({targetPath:e})))):ln(I,`orchestration:operate`)?xe({environmentId:I,input:{cwd:e,editor:`file-manager`,reveal:!0}}):Promise.resolve(me(gt(Error(`This connection cannot reveal files on this environment.`)))),t[30]=I,t[31]=xe,t[32]=we):we=t[32];let Te=we,Ee;t[33]===w?Ee=t[34]:(Ee=In(w),t[33]=w,t[34]=Ee);let De=Ee,Oe;t[35]!==i||t[36]!==p||t[37]!==n?(Oe=ZS(n,i,p),t[35]=i,t[36]=p,t[37]=n,t[38]=Oe):Oe=t[38];let ke=Oe,Ae;t[39]!==i||t[40]!==ke||t[41]!==p?(Ae=QS(ke,i,p),t[39]=i,t[40]=ke,t[41]=p,t[42]=Ae):Ae=t[42];let{markdownFileLinkMetaByHref:je,inlineCodeFileLinkMetaByText:Me,fileLinkParentSuffixByPath:Ne}=Ae,Pe=nC,Fe=ui(a,o),Ie=ii(a),Le=on(tC),Re=on(eC),B;t[43]!==ie||t[44]!==a?(B=e=>{if(a===void 0||Lt(a)===null||!ie.canLink(e))return null;let t=yt(e);return t===null?null:{...t,url:e}},t[43]=ie,t[44]=a,t[45]=B):B=t[45];let ze=B,Be;t[46]!==ie||t[47]!==a?(Be=e=>{if(a===void 0||!ie.isLinked(Lt(a),e))return null;let t=yt(e);return t===null?null:{...t,url:e}},t[46]=ie,t[47]=a,t[48]=Be):Be=t[48];let Ve=Be,He;t[49]!==Ve||t[50]!==ie||t[51]!==a?(He=async(e,t)=>{a===void 0||!t&&Ve(e)===null||ln(a.environmentId,`orchestration:operate`)&&await ie.changeLink(a,e,t)},t[49]=Ve,t[50]=ie,t[51]=a,t[52]=He):He=t[52];let Ue=He,We;t[53]!==ae||t[54]!==re||t[55]!==a?(We=e=>!a||!ae?Promise.resolve(me(gt(new kr({message:`Preview access is unavailable for this client.`})))):Tr({threadRef:a,url:e,openPreview:re}).then(t=>{if(t._tag===`Success`)Cr(a,e);else if(!vt(t)){let e=_t(t);e instanceof Dr&&Qt.add(Sn({type:`error`,title:`Unable to open link in browser`,description:e.message}))}return t}),t[53]=ae,t[54]=re,t[55]=a,t[56]=We):We=t[56];let Ge=We,Ke;t[57]!==ae||t[58]!==F||t[59]!==i||t[60]!==re||t[61]!==le||t[62]!==a?(Ke=e=>!a||!ae||le._tag===`None`?Promise.resolve(me(gt(new kr({message:`Environment is not connected.`})))):Er({threadRef:a,filePath:e,workspaceRoot:i,httpBaseUrl:le.value.httpBaseUrl,createAssetUrl:F,openPreview:re}),t[57]=ae,t[58]=F,t[59]=i,t[60]=re,t[61]=le,t[62]=a,t[63]=Ke):Ke=t[63];let qe=Ke,Je;t[64]!==i||t[65]!==I||t[66]!==te?(Je=async e=>{if(!i||I===null||!ln(I,`filesystem:read`)||!fx(e))return null;let t=await te({environmentId:I,input:{cwd:i,query:e,limit:25,kind:`file`}});return t._tag===`Success`?px(e,t.value.entries):null},t[64]=i,t[65]=I,t[66]=te,t[67]=Je):Je=t[67];let Ye=Je,Xe;t[68]!==i||t[69]!==Ye||t[70]!==a?(Xe=(e,t)=>{if(!a)return;let n=ux(),r=e=>hn.getState().openFile(a,e,t);!i||!fx(e)?r(e):(async()=>{let t=await Ye(e);n()&&r(t??e)})()},t[68]=i,t[69]=Ye,t[70]=a,t[71]=Xe):Xe=t[71];let Ze=Xe,Qe;t[72]!==i||t[73]!==Ye||t[74]!==Te?(Qe=async e=>{let t=e.workspaceRelativePath,n=t?await Ye(t):null,r=n&&i?gn(n,i):e.filePath;return Te(r)},t[72]=i,t[73]=Ye,t[74]=Te,t[75]=Qe):Qe=t[75];let $e=Qe,et;t[76]!==ae||t[77]!==ce||t[78]!==I||t[79]!==Ne||t[80]!==Ze||t[81]!==ye||t[82]!==qe||t[83]!==de||t[84]!==ve||t[85]!==w||t[86]!==Ce||t[87]!==$e||t[88]!==a?(et=(e,t,n)=>{let r=n??e.filePath,i=Ct(e.basename.slice(e.basename.lastIndexOf(`.`)))!==null,o=e.workspaceRelativePath??(!i&&kt(e.filePath)?e.filePath:null);return(0,U.jsx)(YS,{environmentId:I,href:e.targetPath,targetPath:e.targetPath,iconPath:e.filePath,displayPath:e.displayPath,panelPath:o,line:e.line,label:vn({path:e.filePath,...e.line===void 0?{}:{line:e.line},...e.column===void 0?{}:{column:e.column},...e.endLine===void 0?{}:{endLine:e.endLine}},Ne),copyMarkdown:t,theme:w,threadRef:a,...ce?{onOpen:ye}:{},onOpenInPanel:Ze,onOpenMedia:a&&i?()=>de(r,e.filePath):void 0,openInEditorMenuLabel:ve,onReveal:ce&&Ce!==void 0?()=>$e(e):void 0,revealLabel:Ce,onOpenInBrowser:a&&ae&&wr(a.environmentId)&&Or(e.filePath)?()=>qe(e.filePath):void 0})},t[76]=ae,t[77]=ce,t[78]=I,t[79]=Ne,t[80]=Ze,t[81]=ye,t[82]=qe,t[83]=de,t[84]=ve,t[85]=w,t[86]=Ce,t[87]=$e,t[88]=a,t[89]=et):et=t[89];let tt=et,nt;t[90]!==L||t[91]!==ae||t[92]!==i||t[93]!==De||t[94]!==I||t[95]!==O||t[96]!==tt||t[97]!==C||t[98]!==x||t[99]!==p||t[100]!==v||t[101]!==Me||t[102]!==y||t[103]!==Le||t[104]!==Ve||t[105]!==je||t[106]!==Re||t[107]!==f||t[108]!==c||t[109]!==d||t[110]!==Fe||t[111]!==Ie||t[112]!==Ge||t[113]!==de||t[114]!==R||t[115]!==h||t[116]!==ze||t[117]!==w||t[118]!==pe||t[119]!==b||t[120]!==a||t[121]!==Ue?(nt={canOperateHost:L,canOperatePreview:ae,cwd:i,diffThemeName:De,environmentId:I,expandMedia:O,fileLinkChip:tt,githubMedia:C,renderContextReference:h,headingLevelOffset:x,imageBaseDir:p,inlineCodeFileLinkMetaByText:Me,inline:v,mathEnabled:Re,isStreaming:y,linkTargetPreference:Le,markdownFileLinkMetaByHref:je,onTaskListChange:c,onUseArtifactTemplate:d,onRunShellCommand:f,openChangeRequestLink:Fe,openDeferredMarkdownLink:Ie,openExternalLinkInPreview:Ge,openMarkdownMedia:de,projects:R,linkedThreadPullRequestFor:Ve,resolveThreadPullRequest:ze,resolvedTheme:w,serverConfig:pe,skills:b,threadRef:a,updateThreadPullRequestLink:Ue},t[90]=L,t[91]=ae,t[92]=i,t[93]=De,t[94]=I,t[95]=O,t[96]=tt,t[97]=C,t[98]=x,t[99]=p,t[100]=v,t[101]=Me,t[102]=y,t[103]=Le,t[104]=Ve,t[105]=je,t[106]=Re,t[107]=f,t[108]=c,t[109]=d,t[110]=Fe,t[111]=Ie,t[112]=Ge,t[113]=de,t[114]=R,t[115]=h,t[116]=ze,t[117]=w,t[118]=pe,t[119]=b,t[120]=a,t[121]=Ue,t[122]=nt):nt=t[122];let rt=nt,it;return t[123]!==rt||t[124]!==T?(it={componentState:rt,handleCopy:Pe,markdownRef:D,localMediaPreview:T,setLocalMediaPreview:E},t[123]=rt,t[124]=T,t[125]=it):it=t[125],it}function eC(e){return e.mathRenderingEnabled}function tC(e){return e.browserLinkTarget}function nC(e){let t=window.getSelection();if(!t||t.isCollapsed||!e.clipboardData)return;let n=Vg(t);if(!n)return;e.preventDefault(),e.clipboardData.setData(`text/plain`,n.text);let r=e.clipboardData.getData(pt);e.clipboardData.setData(`text/html`,r?Ze(n.text,r,n.html):n.html)}var rC=V.createContext(null),iC=V.createContext(``);function aC(e){let t=`h${e}`;return function({node:n,...r}){let{headingLevelOffset:i}=(0,V.use)(rC);return(0,U.jsx)(t,{...r,"aria-level":i>0?Math.min(e+i,6):void 0})}}function oC(e){window.getSelection()?.selectAllChildren(e.currentTarget)}var sC={h1:aC(1),h2:aC(2),h3:aC(3),h4:aC(4),h5:aC(5),h6:aC(6),div:function({node:e,children:t,...n}){let{onUseArtifactTemplate:r}=(0,V.use)(rC),i=pm(e?.properties);return i?(0,U.jsx)(Mx,{template:i,onUse:r}):(0,U.jsx)(`div`,{...n,children:t})},p:function({node:e,children:t,...n}){let{skills:r}=(0,V.use)(rC);return(0,U.jsx)(`p`,{...n,children:cv(t,r)})},blockquote:function({node:e,children:t,...n}){let r=Vx[String(n[`data-alert`]??``)];return r?(0,U.jsxs)(`div`,{role:`note`,className:B(`my-1 border-l-2 pl-3`,r.borderClassName),children:[(0,U.jsxs)(`p`,{"data-thread-find-ignore":`true`,className:B(`flex items-center gap-1.5 font-medium`,r.titleClassName),children:[(0,U.jsx)(r.Icon,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),r.label]}),t]}):(0,U.jsx)(`blockquote`,{...n,children:t})},ol:function({node:e,start:t,style:n,...r}){let i=Bx(e?.children?.flatMap(e=>e.type===`element`&&e.tagName===`li`?[e.properties.value]:[])??[],t);return(0,U.jsx)(`ol`,{...r,start:t,style:i?{...n,...i}:n})},li:function({node:e,children:t,...n}){let{skills:r}=(0,V.use)(rC),i=(0,V.use)(iC),a=e?.position?.start.offset,o=typeof a==`number`?zx(i,a):null;return(0,U.jsx)(`li`,{...n,"data-task-marker-offset":o??void 0,children:cv(t,r)})},input:function({node:e,type:t,checked:n,disabled:r,...i}){let{onTaskListChange:a}=(0,V.use)(rC);return t!==`checkbox`||!a?(0,U.jsx)(`input`,{...i,type:t,checked:n,disabled:r,readOnly:t===`checkbox`}):(0,U.jsx)(`input`,{...i,type:`checkbox`,name:`markdown-task`,"aria-label":`Toggle task`,checked:n,onChange:e=>{let t=Number(e.currentTarget.closest(`li`)?.dataset.taskMarkerOffset);Number.isSafeInteger(t)&&a({markerOffset:t,checked:e.currentTarget.checked})}})},a:function({node:e,href:t,children:n,title:r,...i}){let{canOperateHost:a,canOperatePreview:o,cwd:s,environmentId:c,imageBaseDir:l,markdownFileLinkMetaByHref:u,threadRef:d,openMarkdownMedia:f,openChangeRequestLink:p,openDeferredMarkdownLink:m,linkTargetPreference:h,openExternalLinkInPreview:g,projects:_,linkedThreadPullRequestFor:v,resolveThreadPullRequest:y,serverConfig:b,updateThreadPullRequestLink:x,fileLinkChip:S,renderContextReference:C}=(0,V.use)(rC),w=(0,V.use)(iC),T=t?Fr(t):null;if(T)return(0,U.jsx)(ev,{citation:T});let E=t?ym(t):null;if(E){let t=IS(e),n=t&&ym(t)===null?t:null;return c?(0,U.jsx)(rv,{environmentId:c,link:E,label:n}):(0,U.jsx)(`span`,{children:n??`Thread`})}let D=t?Ge(t):null;if(D){let t=IS(e)||D.contextId;return C?C({...D,label:t}):(0,U.jsx)(`span`,{children:t})}let O=t?fS(t):``,k=O?u.get(O)??sx(O,s,l??s):null;if(!k){let r=ma(t),s=LS(e),l=String(i[`data-pull-request-autolink`]??``),u=l===`commit`?/\/commit\/([0-9a-f]{40})$/iu.exec(t??``)?.[1]:l===`reference`?FS(e):void 0,S=u!==void 0,C=l===`reference`,w=C&&t?bt(t):t,T=w?ti({environmentId:c,projects:_,pullRequestsEnabled:b?.environment.capabilities.pullRequests===!0,url:w}):null,E=t?.startsWith(`#`)??!1,D=i.onClick,O=o&&!!(d&&wr(d.environmentId)),k=(0,U.jsx)(TS,{value:!0,children:n}),A=(0,U.jsx)(`a`,{...i,className:B(i.className,l===`commit`&&`font-mono`),"data-markdown-copy":u,"data-markdown-image-link":!s||void 0,href:t,target:E?void 0:`_blank`,rel:E?void 0:`noopener noreferrer`,onClick:e=>{D?.(e),E&&t?HS(e,t):t&&r!==null&&Et(t)!==null&&!e.defaultPrevented&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey?(e.preventDefault(),e.stopPropagation(),f(t,void 0,e.target instanceof HTMLImageElement?e.target:e.currentTarget.querySelector(`img`))):t&&!p(e,t,void 0,c??void 0)&&(e.defaultPrevented||(pi({url:t,event:e,preference:h,canOpenInApp:O})===`app`?(e.preventDefault(),e.stopPropagation(),g(t).then(e=>{e._tag===`Success`||vt(e)||(Lx({operation:`open-link-in-preview`,target:t},e.cause),!(_t(e)instanceof Dr)&&en()?.shell.openExternal(t))})):er&&e.altKey&&(e.preventDefault(),e.stopPropagation(),en()?.shell.openExternal(t).catch(e=>Lx({operation:`open-link-external`,target:t},e)))))},onContextMenu:e=>{if(!t||!r)return;e.preventDefault(),e.stopPropagation();let n=en();if(!n)return;let i=a?v(t)===null?y(t)===null?void 0:`link-to-thread`:`unlink-from-thread`:void 0;ha({href:t,canOpenInPreview:O,threadLinkAction:i,position:{x:e.clientX,y:e.clientY},showContextMenu:(e,t)=>n.contextMenu.show(e,t),openInPreview:async e=>{let t=await g(e);t._tag===`Failure`&&!vt(t)&&Lx({operation:`open-link-in-preview`,target:e},t.cause)},openExternal:e=>n.shell.openExternal(e),copyLink:e=>$t(e,`link`),updateThreadLink:x,reportFailure:(e,n)=>{Lx({operation:e,target:t},n),(e===`link-pull-request-to-thread`||e===`unlink-pull-request-from-thread`)&&Qt.add(Sn({type:`error`,title:e===`link-pull-request-to-thread`?`Unable to link pull request`:`Unable to unlink pull request`,description:n instanceof Error?n.message:`The request failed.`}))}})},children:r&&s&&!S?(0,U.jsx)(JS,{host:r,plainText:FS(e),children:k}):k});return!r||!t?A:T===null?(0,U.jsxs)(rr,{children:[(0,U.jsx)(tr,{render:A}),(0,U.jsx)(nr,{side:`top`,children:t})]}):(0,U.jsx)(j_,{link:A,originalUrl:t,target:T,confirmBeforeOpen:C,onOpenPullRequest:e=>p({metaKey:!1,ctrlKey:!1,preventDefault:()=>void 0,stopPropagation:()=>void 0},e,void 0,c??void 0),onOpenFallback:m})}let A=Jx(n),j=e?.position?.start.offset,M=e?.position?.end.offset,N=j!==void 0&&M!==void 0?w.slice(j,M):``,P=N.startsWith(`[`)&&N.includes(`](`)?N:`[${(A||k.basename).replace(/[\\[\]]/g,`\\$&`)}](${O})`,F=S(k,P,O);return qn(A,O)?F:(0,U.jsxs)(`span`,{"data-markdown-copy":P,children:[(0,U.jsxs)(`span`,{className:`whitespace-normal`,children:[n,` `]}),F]})},code:function({node:e,children:t,className:n,...r}){let{cwd:i,imageBaseDir:a,inlineCodeFileLinkMetaByText:o,fileLinkChip:s,mathEnabled:c,inline:l}=(0,V.use)(rC),u=c?oi(n):null;if(u)return(0,U.jsx)(fv,{tex:Jx(t),display:u===`display`,focusable:!l});if(e?.properties?.dataInlineCode!=null){let e=Jx(t),c=o.get(e.trim())??ax(e,i,a??i);return c?s(c,`\`${e}\``,Gn(e)??e.trim()):(0,U.jsx)(`code`,{...r,className:n,onDoubleClick:oC,children:t})}return(0,U.jsx)(`code`,{...r,className:n,children:t})},img:function({node:e,title:t,src:n,alt:r,...i}){let{expandMedia:a,cwd:o,environmentId:s,githubMedia:c,imageBaseDir:l,threadRef:u,renderContextReference:d,resolvedTheme:f}=(0,V.use)(rC),p=(0,V.use)(TS)?void 0:a,m=typeof n==`string`?Ge(n):null;if(m){let e=r||m.contextId;return d?d({...m,label:e}):(0,U.jsx)(`span`,{children:e})}let h=e?.properties?.[f===`dark`?`dataDarkSrc`:`dataLightSrc`],g=typeof h==`string`?void 0:e?.properties?.dataLocalSrc,_=e?.properties?.dataMarkdownTitle,v=e?.properties?.dataStandalone===!0,y=typeof h==`string`?h:typeof g==`string`?g:n,b=typeof _==`string`?_:t,x=typeof y==`string`?Yn(y):``,S=typeof g==`string`?x.replaceAll(`\\`,`/`):x,C=r??``,w=SS(C,x,b),{className:T,style:E,width:D,height:O,...k}=i,A=CS(D,O),j=Xn(S,l??o),M=Et(S)??`image`,N=j._tag===`Direct`?j.uri:null,P=N===null?null:ch(ga(N));if(c&&o!==void 0&&s!==null&&N!==null&&P!==null)return(0,U.jsx)(MS,{environmentId:s,resource:{_tag:`github-media`,cwd:o,url:P},alt:C,kind:M,copyMarkdown:w,standalone:v,className:T,style:A,imageProps:k,srcFragment:Zn(S),originalUrl:ga(N),framed:!1,fallbackSrc:P,onImageExpand:p});if(j._tag===`Direct`){let e=ga(j.uri),t=ma(j.uri)===null?void 0:j.uri,n=Kn(j.uri),r={kind:M,name:C||M,src:e,...n?{reference:n}:{}};return M===`video`?(0,U.jsx)(jS,{src:e,alt:C,copyMarkdown:w,originalUrl:t,style:A,actionsSource:r}):(0,U.jsx)(AS,{src:e,alt:C,copyMarkdown:w,standalone:v,className:T,style:A,imageProps:k,actionsSource:r,originalUrl:t,onImageExpand:p},e)}return j._tag===`WorkspaceFile`&&u?(0,U.jsx)(MS,{environmentId:u.environmentId,resource:{_tag:`media-file`,threadId:u.threadId,path:j.path},alt:C,kind:M,copyMarkdown:w,srcFragment:Zn(S),standalone:v,style:A,workspaceRoot:o,onImageExpand:p}):(0,U.jsx)(OS,{alt:C,copyMarkdown:w,kind:M})},table:function({node:e,...t}){return(0,U.jsx)($x,{...t})},details:function({node:e,children:t,open:n}){return(0,U.jsx)(eS,{open:n,children:t})},pre:function({node:e,children:t,...n}){let{resolvedTheme:r,diffThemeName:i,expandMedia:a,isStreaming:o,onRunShellCommand:s,inline:c,mathEnabled:l}=(0,V.use)(rC),u=(0,V.use)(iC),d=Yx(t);if(!d)return(0,U.jsx)(`pre`,{...n,children:t});let f=Hx(d.className);if(l&&f===`math`&&(!o||oi(d.className)===`display`||qx(e,u)))return(0,U.jsx)(fv,{tex:d.code,display:!0,focusable:!c});let p=Gx(Kx(e)),m=(0,U.jsx)(ci,{resetKeys:[d.code,f,i,o],fallback:(0,U.jsx)(`pre`,{...n,children:t}),children:(0,U.jsx)(V.Suspense,{fallback:(0,U.jsx)(`pre`,{...n,className:`invisible`,"aria-hidden":!0,children:t}),children:(0,U.jsx)(lS,{className:d.className,code:d.code,themeName:i,isStreaming:o})})});return f===`mermaid`?(0,U.jsx)(sS,{code:d.code,fenceTitle:p,theme:r,isStreaming:o,onExpand:e=>a({images:[{src:e,name:`Mermaid diagram`}],index:0}),children:m}):(0,U.jsx)(aS,{code:d.code,language:f,fenceTitle:p,theme:r,onRunShellCommand:s&&!o&&qx(e,u)?s:void 0,isStreaming:o,children:m})}},cC=[Qr,{singleDollarTextMath:!0}],lC={plain:Im,breaks:Lm,math:[cC,...Im],mathBreaks:[cC,...Lm]},uC=new WeakMap;function dC(e,t){if(t.length===0)return e;let n=uC.get(t);n||uC.set(t,n=new WeakMap);let r=n.get(e);return r||n.set(e,r=[...e,...t]),r}var fC=new WeakMap;function pC(e,t){let n=fC.get(e);n||fC.set(e,n=new WeakMap);let r=n.get(t);return r||(r=xx({remarkPlugins:e,rehypePlugins:t,components:sC,urlTransform:qS}),n.set(t,r)),r}var mC=(0,V.memo)(function(e){let t=(0,H.c)(12),{text:n,remarkPlugins:r,rehypePlugins:i,shared:a,cache:o}=e,s,c,l;if(t[0]!==o||t[1]!==i||t[2]!==r||t[3]!==a||t[4]!==n){let e=a?pC(r,i):xx({remarkPlugins:r,rehypePlugins:i,components:sC,urlTransform:qS});s=iC,c=n,l=e(n,a&&o),t[0]=o,t[1]=i,t[2]=r,t[3]=a,t[4]=n,t[5]=s,t[6]=c,t[7]=l}else s=t[5],c=t[6],l=t[7];let u;return t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,U.jsx)(s,{value:c,children:l}),t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11],u});function hC(e){let t=(0,H.c)(55),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({text:c,className:n,inline:i,lineBreaks:a,parseRawHtml:o,extraRemarkPlugins:s,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i!==void 0&&i,u=a!==void 0&&a,d=o===void 0||o,f=s===void 0?Ax:s,p;t[8]!==l||t[9]!==r||t[10]!==c?(p={text:c,inline:l,...r},t[8]=l,t[9]=r,t[10]=c,t[11]=p):p=t[11];let{componentState:m,handleCopy:h,markdownRef:g,localMediaPreview:_,setLocalMediaPreview:v}=$S(p),y,b,x,S,C,w,T,E;if(t[12]!==n||t[13]!==m||t[14]!==f||t[15]!==h||t[16]!==l||t[17]!==u||t[18]!==g||t[19]!==d||t[20]!==r.isStreaming||t[21]!==r.onTaskListChange||t[22]!==c){let e=r.isStreaming===!0&&!l&&f.length===0&&!r.onTaskListChange?Tx(c):null,i=r.isStreaming===!0&&e===null&&f.length===0&&/(?:^|\n) {0,3}(?:`{3}|~{3})/.test(c),a=l?`span`:`div`,o;t[31]===g?o=t[32]:(o=e=>{g.current=e},t[31]=g,t[32]=o);let s=o,p=lC[m.mathEnabled?u?`mathBreaks`:`math`:u?`breaks`:`plain`],_=i,v;t[33]!==f||t[34]!==i||t[35]!==p?(v=i?[...p,...f,fh()]:dC(p,f),t[33]=f,t[34]=i,t[35]=p,t[36]=v):v=t[36];let D=v,O=e??[c];b=a,T=s;let k=!l&&`text-sm leading-relaxed text-foreground/[calc(80%+var(--appearance-contrast-boost)/5)]`;t[37]!==n||t[38]!==k?(E=B(`chat-markdown w-full min-w-0 [overflow-wrap:anywhere] [word-break:break-word]`,k,n),t[37]=n,t[38]=k,t[39]=E):E=t[39],x=m.isStreaming?``:void 0,S=h,y=rC,C=m,w=O.map((e,t)=>(0,U.jsx)(mC,{text:e,remarkPlugins:D,rehypePlugins:d?GS:KS,shared:!_,cache:!r.isStreaming||t<O.length-1},t)),t[12]=n,t[13]=m,t[14]=f,t[15]=h,t[16]=l,t[17]=u,t[18]=g,t[19]=d,t[20]=r.isStreaming,t[21]=r.onTaskListChange,t[22]=c,t[23]=y,t[24]=b,t[25]=x,t[26]=S,t[27]=C,t[28]=w,t[29]=T,t[30]=E}else y=t[23],b=t[24],x=t[25],S=t[26],C=t[27],w=t[28],T=t[29],E=t[30];let D;t[40]!==y||t[41]!==C||t[42]!==w?(D=(0,U.jsx)(y,{value:C,children:w}),t[40]=y,t[41]=C,t[42]=w,t[43]=D):D=t[43];let O;t[44]!==_||t[45]!==v?(O=_?(0,U.jsx)(Uv,{preview:_,onClose:()=>v(null)}):null,t[44]=_,t[45]=v,t[46]=O):O=t[46];let k;return t[47]!==b||t[48]!==x||t[49]!==S||t[50]!==D||t[51]!==O||t[52]!==T||t[53]!==E?(k=(0,U.jsxs)(b,{ref:T,className:E,"data-streaming":x,onCopy:S,children:[D,O]}),t[47]=b,t[48]=x,t[49]=S,t[50]=D,t[51]=O,t[52]=T,t[53]=E,t[54]=k):k=t[54],k}var gC=(0,V.memo)(hC);export{sa as $,o_ as A,Ym as B,P_ as C,I_ as D,N_ as E,th as F,Aa as G,fm as H,eh as I,Oa as J,ja as K,Um as L,Vg as M,eg as N,V_ as O,ch as P,ta as Q,Im as R,F_ as S,R_ as T,Tf as U,Cm as V,Bo as W,ca as X,pa as Y,aa as Z,uv as _,Yv as a,zi as at,$_ as b,Uv as c,Cv as d,Qi as et,yv as f,vv as g,bv as h,ex as i,Bi as it,t_ as j,a_ as k,Av as l,_v as m,gC as n,Hi as nt,qv as o,gv as p,ka as q,rS as r,Ri as rt,Jv as s,MS as t,Wi as tt,Iv as u,iv as v,z_ as w,G_ as x,ev as y,Lm as z};
49
+ //# sourceMappingURL=ChatMarkdown-DHhJpg3q.js.map