@openchamber/web 2.7.0 → 2.7.1-canary.20261108.12

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 (115) hide show
  1. package/dist/assets/{AboutDialog-Bbu8cDW8.js → AboutDialog-uNKjHvzl.js} +1 -1
  2. package/dist/assets/{AboutLogo-sAyRFbrm.js → AboutLogo-BhyG0ENm.js} +1 -1
  3. package/dist/assets/{ArchiveView-DvLmQllR.js → ArchiveView-Jt6Qj8Ry.js} +1 -1
  4. package/dist/assets/{ChangeRequestDiffUnavailable-Ctc-P6zi.js → ChangeRequestDiffUnavailable-CNIWdYRx.js} +1 -1
  5. package/dist/assets/{ChangedPathLabel-CQOXgkIF.js → ChangedPathLabel-CCsE-8p4.js} +1 -1
  6. package/dist/assets/{CommandPalette-DHk0MqYi.js → CommandPalette-DrsFSbmk.js} +1 -1
  7. package/dist/assets/{DiffView-DPpu52DA.js → DiffView-DwaJOPUe.js} +1 -1
  8. package/dist/assets/{FilesView-CPrroDyU.js → FilesView-Hvxe_KqA.js} +4 -4
  9. package/dist/assets/{GitView-wWoZ95Yt.js → GitView-ZI_EafL9.js} +1 -1
  10. package/dist/assets/{GuestSurfacePane-BsMH8QjU.js → GuestSurfacePane-Ds8luSO0.js} +1 -1
  11. package/dist/assets/{HelpDialog-BZtzVj6Z.js → HelpDialog-DtZKoPZE.js} +1 -1
  12. package/dist/assets/{IntegrationsCatalogView-DJAOTlcc.js → IntegrationsCatalogView-DgdYlI3Z.js} +1 -1
  13. package/dist/assets/{JsonTreeView-BXv2HzlC.js → JsonTreeView-zAv-pn0X.js} +1 -1
  14. package/dist/assets/{MarkdownDiffPreview-CseaChSt.js → MarkdownDiffPreview-Bf9-WPy9.js} +1 -1
  15. package/dist/assets/{MarkdownRendererImpl-CyXOMsMS.js → MarkdownRendererImpl-w7LnAwp_.js} +4 -4
  16. package/dist/assets/{MemoryDebugPanel-xYvjTjLG.js → MemoryDebugPanel-ylQytlyw.js} +1 -1
  17. package/dist/assets/{NoteEditor-Bbrtl8rq.js → NoteEditor-0HEW8KrY.js} +1 -1
  18. package/dist/assets/{OfficeDocumentDiff-DXsfJnFq.js → OfficeDocumentDiff-BFr4rAHy.js} +1 -1
  19. package/dist/assets/{OnboardingScreen-DuWvo16v.js → OnboardingScreen-Bpj6hpDe.js} +1 -1
  20. package/dist/assets/{OpenCodeStatusDialog-9WRgjgWL.js → OpenCodeStatusDialog-CX3oxFSb.js} +1 -1
  21. package/dist/assets/{OverviewView-BzA9rGEs.js → OverviewView-UfIFJ3mf.js} +1 -1
  22. package/dist/assets/{PatchDiff-DVcyjZVm.js → PatchDiff-DC4ydsOW.js} +1 -1
  23. package/dist/assets/{PlanView-BGdba90K.js → PlanView-CgoTn3HJ.js} +1 -1
  24. package/dist/assets/{ProjectActionsDialog-ByPMdwFG.js → ProjectActionsDialog-B16N4lqs.js} +1 -1
  25. package/dist/assets/{ReplyCommand-pviKPDT8.js → ReplyCommand-CnDNvFmd.js} +1 -1
  26. package/dist/assets/{ReplyUiBlock-D7HPBgmq.js → ReplyUiBlock-BsOTgv8M.js} +1 -1
  27. package/dist/assets/{ReviewCards-CU1YHZkQ.js → ReviewCards-BkpTYy_a.js} +1 -1
  28. package/dist/assets/{RunOverview-uFEfusCK.js → RunOverview-DsffX3fI.js} +1 -1
  29. package/dist/assets/{ScheduledTasksDialog-J8i_b433.js → ScheduledTasksDialog-DgrAfpeX.js} +1 -1
  30. package/dist/assets/{SettingsView-CaUgulkI.js → SettingsView-B804XZvl.js} +1 -1
  31. package/dist/assets/{SettingsWindow-BVEVntuV.js → SettingsWindow-k5FSMAzV.js} +1 -1
  32. package/dist/assets/{SidebarSectionsManager-CIXOcE0-.js → SidebarSectionsManager-DH61-mRe.js} +1 -1
  33. package/dist/assets/{SourceBoardView-BW1OSOo1.js → SourceBoardView-BvGoSNer.js} +1 -1
  34. package/dist/assets/{SpaceAccessDialog-6GhzlMD8.js → SpaceAccessDialog-DHNqUzKD.js} +1 -1
  35. package/dist/assets/{SpaceApplyDialog-zB4jAExK.js → SpaceApplyDialog-DEOTeEjy.js} +1 -1
  36. package/dist/assets/{SpaceRow-C6QD41XF.js → SpaceRow-CBva6ofM.js} +1 -1
  37. package/dist/assets/{SpaceSetupOutput-6GuKiRed.js → SpaceSetupOutput-C4NhRkjl.js} +1 -1
  38. package/dist/assets/{SpacesView-BgncMV45.js → SpacesView-BGevrpQp.js} +1 -1
  39. package/dist/assets/{SubmoduleDiffSummary-BwVdGw0c.js → SubmoduleDiffSummary-Bebhaz7n.js} +1 -1
  40. package/dist/assets/{ToolOutputDialog-CC9hcX2C.js → ToolOutputDialog-B1gU22Tz.js} +1 -1
  41. package/dist/assets/{ToolPartDiffPreview-D15Ja459.js → ToolPartDiffPreview-CVy_zn_m.js} +1 -1
  42. package/dist/assets/{UiBlock-pyLxOJr6.js → UiBlock-C11qZK5T.js} +2 -2
  43. package/dist/assets/{UsageStatsView-CMf29PeL.js → UsageStatsView-CNm8WPSk.js} +1 -1
  44. package/dist/assets/{WalkthroughView-DeuNxpZ7.js → WalkthroughView-Bbwyk6rg.js} +1 -1
  45. package/dist/assets/{WorktreesView-jHcQwWBH.js → WorktreesView-BGIfERNs.js} +1 -1
  46. package/dist/assets/{appThemeRegistry-BwyM6n38.js → appThemeRegistry-DYzVI9tX.js} +1 -1
  47. package/dist/assets/{ar-DnPStsLU.js → ar-CT3AuXVj.js} +1 -1
  48. package/dist/assets/{codeHighlight-C7ZRQ5-2.js → codeHighlight-BcDjh6yS.js} +1 -1
  49. package/dist/assets/{columnWidthMemory-Cbfh5HD5.js → columnWidthMemory-BA6h4J11.js} +1 -1
  50. package/dist/assets/{computeVirtualFileMetrics-DVynfSBh.js → computeVirtualFileMetrics-DVfKKHny.js} +2 -2
  51. package/dist/assets/{contextFileOpenGuard-CKnYjgFC.js → contextFileOpenGuard-BC79wuu1.js} +1 -1
  52. package/dist/assets/{date-time-qS8d5iiz.js → date-time-DhfjtTnp.js} +1 -1
  53. package/dist/assets/{de-SUU4F7Nt.js → de-BdVTH897.js} +1 -1
  54. package/dist/assets/{documentClient-B0iRikhq.js → documentClient-JcxJ7vyh.js} +2 -2
  55. package/dist/assets/{documentExport-Cf0gMwM0.js → documentExport-C830mU4N.js} +1 -1
  56. package/dist/assets/{documentHost-cOykm7qf.js → documentHost-DKm0U_q_.js} +1 -1
  57. package/dist/assets/{es-BWlkhnKy.js → es-BFk4dosu.js} +1 -1
  58. package/dist/assets/{fileContentPoller-CKcqqhzG.js → fileContentPoller-BmcApnk-.js} +1 -1
  59. package/dist/assets/{flexokiTheme-deI9tWCZ.js → flexokiTheme-BMYGLHbL.js} +1 -1
  60. package/dist/assets/{fr-DN3Tx1EV.js → fr-CeExWqT9.js} +1 -1
  61. package/dist/assets/{he-B-7jIB_R.js → he-C_O5IfNH.js} +1 -1
  62. package/dist/assets/{highlights-B2Re-VTM.js → highlights-CIuWBj_n.js} +1 -1
  63. package/dist/assets/{index-D5Ed7hon.js → index-bD6u6GDm.js} +1 -1
  64. package/dist/assets/{initializeSharedPreferences-D5FLPdpI.js → initializeSharedPreferences-BcnhlF3e.js} +1 -1
  65. package/dist/assets/{install-sOrZWWGd.js → install-CSoRI5iX.js} +1 -1
  66. package/dist/assets/{install-request-C-zhz88k.js → install-request-EHX4ORhb.js} +1 -1
  67. package/dist/assets/{isDiffPlainText-DpcjRlB-.js → isDiffPlainText-saKoOWJx.js} +1 -1
  68. package/dist/assets/{isFilePlainText-DJ_bXU7C.js → isFilePlainText-DOjSDWo3.js} +1 -1
  69. package/dist/assets/{ja-DE4Yf-rX.js → ja-BlUqUBMY.js} +1 -1
  70. package/dist/assets/{katex.min-g52ii4Gs.js → katex.min-Bs5OLoA1.js} +4 -4
  71. package/dist/assets/{ko-CETaCyB8.js → ko-CGv47dWq.js} +1 -1
  72. package/dist/assets/{main-QRYvDkRZ.js → main-064y5MQB.js} +4 -4
  73. package/dist/assets/{main-89VT8Kff.js → main-D8yzv2tL.js} +2 -2
  74. package/dist/assets/{miniChat-CgHPqY7Z.js → miniChat-X7g2IHQj.js} +2 -2
  75. package/dist/assets/{mobile-BQrjPA_e.js → mobile-B5efB3tI.js} +2 -2
  76. package/dist/assets/{moveWorkspacePath-C4_JgpNC.js → moveWorkspacePath-BaEfuU4S.js} +1 -1
  77. package/dist/assets/{nl-CL94_9kf.js → nl-CavtTtNf.js} +1 -1
  78. package/dist/assets/{officeDocument-COfYG-XF.js → officeDocument-CQScRmC1.js} +1 -1
  79. package/dist/assets/{parseDiffFromFile-CD1h9Yf5.js → parseDiffFromFile-By5H8w4y.js} +1 -1
  80. package/dist/assets/{pierreDiffTint-Cg024Eeg.js → pierreDiffTint-CVm_qZm-.js} +1 -1
  81. package/dist/assets/{pl-Bk1GuZBm.js → pl-BQZVI44N.js} +1 -1
  82. package/dist/assets/{pt-BR-Bfrsw-GS.js → pt-BR-iqkU-MRA.js} +1 -1
  83. package/dist/assets/{relocateRestoredSession-C79EVzC-.js → relocateRestoredSession-CsK2RUM_.js} +2 -2
  84. package/dist/assets/{renderElectronMiniChatApp-lMVP5gEt.js → renderElectronMiniChatApp-DzVezwky.js} +2 -2
  85. package/dist/assets/{renderMarkdownForExport-DTutihQz.js → renderMarkdownForExport-BM19JOji.js} +1 -1
  86. package/dist/assets/{renderMobileApp-CmYW0oos.js → renderMobileApp-CiTrtu6R.js} +3 -3
  87. package/dist/assets/{resolveLanguages-lTTkQHer.js → resolveLanguages-DQXSOQcc.js} +1 -1
  88. package/dist/assets/{runtimeEndpointReset-BJm_77m2.js → runtimeEndpointReset-DiTyBUwe.js} +5 -5
  89. package/dist/assets/{scheduledTasksApi-CKPLiwD-.js → scheduledTasksApi-Z7dc8sXS.js} +1 -1
  90. package/dist/assets/{shiki-CQYsk6Az.js → shiki-DW-V1SDr.js} +1 -1
  91. package/dist/assets/{space-apply-BT-PjBF5.js → space-apply-8YUOtYvk.js} +1 -1
  92. package/dist/assets/{space-close-C1Qs6EK6.js → space-close-D7zK_obq.js} +1 -1
  93. package/dist/assets/{spaceNetwork-C14OnxrT.js → spaceNetwork-XStNVwJo.js} +1 -1
  94. package/dist/assets/{stream-tokenizer-xdyY_PEd.js → stream-tokenizer-BfPOSMyw.js} +1 -1
  95. package/dist/assets/{textMateThemeFromAppTheme-CRhUx8P-.js → textMateThemeFromAppTheme-CVOJt2hL.js} +1 -1
  96. package/dist/assets/{tr-Cgg3eQb7.js → tr-CYfLfxAg.js} +1 -1
  97. package/dist/assets/{uk-zPAKOL1d.js → uk-Bm__l5YX.js} +1 -1
  98. package/dist/assets/{useAppFontEffects-D9nf8G19.js → useAppFontEffects-3RimJo4B.js} +15 -15
  99. package/dist/assets/{useBranchPullRequestRequest-CaGsp4wW.js → useBranchPullRequestRequest-CMvepZei.js} +1 -1
  100. package/dist/assets/{useCallableModelProviders-B1YBs2FN.js → useCallableModelProviders-DpMos2Hl.js} +1 -1
  101. package/dist/assets/{useDiffFindSurface-DiINVOLu.js → useDiffFindSurface-Dy5ZvPrH.js} +1 -1
  102. package/dist/assets/{useGitCleanLine-BK-o3SG6.js → useGitCleanLine-COG7MPwc.js} +1 -1
  103. package/dist/assets/{useInlineCommentController-CzeMiLCm.js → useInlineCommentController-_L6_JHZ6.js} +1 -1
  104. package/dist/assets/{useMarkdownLocalAssets-wPn7MXUN.js → useMarkdownLocalAssets-CH5Ekvbl.js} +1 -1
  105. package/dist/assets/{useRootScrollLock-BvsNFl90.js → useRootScrollLock-DdknBCBa.js} +2 -2
  106. package/dist/assets/{useWalkthroughReview-CEo_4ZLc.js → useWalkthroughReview-Bi8eB9_G.js} +1 -1
  107. package/dist/assets/{useWholeFileComment-BexRzYws.js → useWholeFileComment-CqHAJ2YU.js} +1 -1
  108. package/dist/assets/{useWorktreeArchiveActions-DaRx6tMV.js → useWorktreeArchiveActions-D1kaQEP9.js} +1 -1
  109. package/dist/assets/{vendor-codemirror-language-data-z3n6zAAT.js → vendor-codemirror-language-data-DRsX0PKK.js} +2 -2
  110. package/dist/assets/{zh-CN-BPcuR4-K.js → zh-CN-Db0Y0Ij-.js} +1 -1
  111. package/dist/assets/{zh-TW-CmPAjna9.js → zh-TW-CuzqmROB.js} +1 -1
  112. package/dist/index.html +2 -2
  113. package/dist/mini-chat.html +2 -2
  114. package/dist/mobile.html +2 -2
  115. package/package.json +3 -3
@@ -1,8 +1,8 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownDiffPreview-CseaChSt.js","assets/vendor-react--VO_rL_p.js","assets/vendor-scheduler-7OC5HNn7.js","assets/useAppFontEffects-D9nf8G19.js","assets/katex.min-g52ii4Gs.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-zustand-C9tWdk0j.js","assets/vendor-zod--raI7LhK.js","assets/vendor-opencode-client-CeybcDBQ.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/vendor-streamdown-BbSYZ3NF.js","assets/vendor-markdown-BTUqNk6W.js","assets/vendor-mdast-util-from-markdown-CZHjOE75.js","assets/vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js","assets/vendor-micromark-util-decode-string-fHsnqYdj.js","assets/vendor-decode-named-character-reference-C3-224fz.js","assets/vendor-micromark-util-normalize-identifier-C9ANKk3v.js","assets/vendor-micromark-AWM-NZXP.js","assets/vendor-micromark-util-combine-extensions-d8XJZrgA.js","assets/vendor-micromark-util-chunked-DrRIdSP-.js","assets/vendor-micromark-factory-space-PzSHLgmq.js","assets/vendor-micromark-util-character-CW3Cu1MS.js","assets/vendor-micromark-core-commonmark-kzTLNXAm.js","assets/vendor-micromark-util-classify-character-tcLuZZwM.js","assets/vendor-micromark-util-resolve-all-PQCKh0dx.js","assets/vendor-micromark-util-subtokenize-BF1Jf29a.js","assets/vendor-micromark-factory-destination-Sj0xfi0V.js","assets/vendor-micromark-factory-label-amyP0HdC.js","assets/vendor-micromark-factory-title-khnLkZK6.js","assets/vendor-micromark-factory-whitespace-eIB00uTl.js","assets/vendor-micromark-util-html-tag-name-DbKNfynz.js","assets/vendor-unist-util-stringify-position-Ch_qCilz.js","assets/vendor-mdast-util-to-string-C_aolqmU.js","assets/vendor-unist-util-visit-DhPeCsfG.js","assets/vendor-unist-util-visit-parents-DlviEg7Z.js","assets/vendor-unist-util-is-BPZGFiMU.js","assets/vendor-hast-util-raw-DvvLJg15.js","assets/vendor-ungap-structured-clone--gfxRhYI.js","assets/vendor-html-void-elements-CkdplsNl.js","assets/vendor-parse5-DwmzEj2o.js","assets/vendor-entities-wUUgTZDW.js","assets/vendor-web-namespaces-bsVAaBS1.js","assets/vendor-zwitch-C2o2j-tx.js","assets/vendor-unist-util-position-60F3QETU.js","assets/vendor-hast-util-from-parse5-Ba3T6RJI.js","assets/vendor-devlop-0Dp3JUBc.js","assets/vendor-property-information-Boo8Xpef.js","assets/vendor-hastscript-BrPNioaz.js","assets/vendor-comma-separated-tokens-CRUGqg4f.js","assets/vendor-space-separated-tokens-D7QSIrTI.js","assets/vendor-hast-util-parse-selector-TXfch5wI.js","assets/vendor-vfile-location-LfEFwJ2h.js","assets/vendor-hast-util-to-parse5-BoysVIPW.js","assets/vendor-hast-util-sanitize-2aGO5ay8.js","assets/vendor-micromark-extension-gfm-CsfPlnlB.js","assets/vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js","assets/vendor-micromark-extension-gfm-footnote-OFl1FCH2.js","assets/vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js","assets/vendor-micromark-extension-gfm-table-dgw4LfUw.js","assets/vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js","assets/vendor-mdast-util-gfm-CroMDYLM.js","assets/vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js","assets/vendor-ccount-c2V3InAJ.js","assets/vendor-mdast-util-find-and-replace-DB9iC-bx.js","assets/vendor-escape-string-regexp-BaJN9MlJ.js","assets/vendor-mdast-util-gfm-footnote-C-csI7OF.js","assets/vendor-mdast-util-gfm-strikethrough-BcskTdio.js","assets/vendor-mdast-util-gfm-table-DhPwQIyj.js","assets/vendor-markdown-table-DvhhVmnL.js","assets/vendor-mdast-util-to-markdown-Cl3qaiyc.js","assets/vendor-longest-streak-CtXnX3Xp.js","assets/vendor-mdast-util-phrasing-4oVbNLC3.js","assets/vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js","assets/vendor-mdast-util-to-hast-CWnLaQSO.js","assets/vendor-micromark-util-sanitize-uri-BbwQ7CLk.js","assets/vendor-trim-lines-D8znQY54.js","assets/vendor-micromark-extension-cjk-friendly-BzZDGrF5.js","assets/vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js","assets/vendor-get-east-asian-width-CPhS2cOv.js","assets/vendor-micromark-util-symbol-JJPacVTp.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js","assets/vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js","assets/vendor-hast-util-from-html-isomorphic-B0Kn01s9.js","assets/vendor-hast-util-from-dom-DeNf9aYW.js","assets/vendor-katex-DBqql0K7.js","assets/vendor-hast-util-to-text-0GXLnBvt.js","assets/vendor-hast-util-is-element-CuOmiqQi.js","assets/vendor-unist-util-find-after-CMaZmLxc.js","assets/vendor-micromark-extension-math-BRFoDziv.js","assets/vendor-mdast-util-math-wB-IJCL0.js","assets/vendor-remend-r8cP_t-e.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-marked-DN3zOnEe.js","assets/vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js","assets/vendor-style-to-js-CI2G4dgu.js","assets/vendor-style-to-object-BAv4SQXc.js","assets/vendor-inline-style-parser-BlqBsVO4.js","assets/vendor-hast-util-whitespace-D4Wp6AEg.js","assets/vendor-estree-util-is-identifier-name-BgBfM8ME.js","assets/vendor-vfile-message-DqhD22jI.js","assets/vendor-unified-1CQKw2_w.js","assets/vendor-bail-FqpXQuLt.js","assets/vendor-extend-B94qxKr5.js","assets/vendor-is-plain-obj-C1gvLhAf.js","assets/vendor-trough-B_b8ryxu.js","assets/vendor-vfile-BCWrK60u.js","assets/vendor-html-url-attributes-D46m5wfe.js","assets/vendor-capacitor-core-B4EWRrHz.js","assets/katex-7f7Y525Q.css","assets/vendor-base-ui-CqKCZJyd.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-floating-ui-react-dom-Cy8dRGoy.js","assets/vendor-use-sync-external-store-CfLJGVyr.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-dnd-kit-core-Br1Cs7RV.js","assets/vendor-dnd-kit-utilities-DZ9KbT5S.js","assets/vendor-dnd-kit-accessibility-CYclfhtC.js","assets/vendor-dnd-kit-sortable-DpfLEOLv.js","assets/vendor-tanstack-react-virtual-CqfECoM0.js","assets/vendor-tanstack-virtual-core-BdFnkr_2.js","assets/vendor-framer-motion-C_wK4GIM.js","assets/vendor-motion-dom-HXPOMxb7.js","assets/vendor-motion-utils-BGh8QBgx.js","assets/vendor-codemirror-commands-CjjsURR-.js","assets/vendor-codemirror-state-Cd8udR5z.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-codemirror-view-Ciie9ey-.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-codemirror-language-8HZTPOnt.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CZEcqU6G.js","assets/vendor-codemirror-streamparser-CmlTsbN2.js","assets/vendor-codemirror-lang-javascript-DmqaSK_j.js","assets/vendor-lezer-javascript-CWSwshuO.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-BGedy2gC.js","assets/vendor-codemirror-lang-json-DVAYKmoO.js","assets/vendor-lezer-json-Cn1mncjr.js","assets/vendor-codemirror-lang-css-BLpgXfL2.js","assets/vendor-lezer-css-B2Hx_Nps.js","assets/vendor-codemirror-lang-html-S3jxr3Mo.js","assets/vendor-lezer-html-Cr8K5DGw.js","assets/vendor-codemirror-lang-markdown-D1jveRI5.js","assets/vendor-lezer-markdown-TQKzBB8i.js","assets/vendor-codemirror-language-data-z3n6zAAT.js","assets/vendor-codemirror-lang-python-B-5UC9Ui.js","assets/vendor-lezer-python-BUoImtUb.js","assets/vendor-sonner-Dw26OnzC.js","assets/vendor-cmdk-BtSpU-Io.js","assets/vendor-radix-ui-react-dialog-OIW6VLWw.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-D4RvEbuR.js","assets/vendor-radix-ui-react-context-BbFoxCHu.js","assets/vendor-radix-ui-react-id-aGag8i_5.js","assets/vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js","assets/vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js","assets/vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js","assets/vendor-radix-ui-react-primitive-CrN9dRDb.js","assets/vendor-radix-ui-react-slot-BjbalUfz.js","assets/vendor-radix-ui-react-use-callback-ref-CcC_buIU.js","assets/vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js","assets/vendor-radix-ui-react-focus-scope-D1noLHmd.js","assets/vendor-radix-ui-react-portal-BlUEzfrF.js","assets/vendor-radix-ui-react-presence-BGqFfiW4.js","assets/vendor-radix-ui-react-focus-guards-CSS2IbZC.js","assets/vendor-react-remove-scroll-Der_cv-1.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-Clwl9llp.js","assets/vendor-react-style-singleton-D_xJlTqU.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-BdLl6ZIw.js","assets/vendor-use-callback-ref-CXJF1lEr.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-legendapp-list-CEhBoV5L.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/ToolPartDiffPreview-D15Ja459.js","assets/PatchDiff-DVcyjZVm.js","assets/parseDiffFromFile-CD1h9Yf5.js","assets/computeVirtualFileMetrics-DVynfSBh.js","assets/themeResolver-DXizngAV.js","assets/vendor-pierre-theming-D_TRfu0q.js","assets/hastToHtml-BHV14OWE.js","assets/vendor-hast-util-to-html-Jw3IXh58.js","assets/vendor-stringify-entities-CsH1VEn9.js","assets/vendor-character-entities-legacy-BpoLgcEt.js","assets/vendor-character-entities-html4-D7taRCQ7.js","assets/vendor-diff-C3JhlQdm.js","assets/useNextRenderData-CVFf78p9.js","assets/isDiffPlainText-DpcjRlB-.js","assets/getFiletypeFromFileName-BgI9McTw.js","assets/pierreDiffTint-Cg024Eeg.js","assets/appThemeRegistry-BwyM6n38.js","assets/textMateThemeFromAppTheme-CRhUx8P-.js","assets/diffsHighlighter-BsxkaI3Q.js","assets/ReplyCommand-pviKPDT8.js"])))=>i.map(i=>d[i]);
2
- import{R as b,f as U,j as h,a as er}from"./vendor-react--VO_rL_p.js";import{ij as fn,ik as tr,il as bt,im as nr,io as rr,ip as sr,iq as ir,ir as or,is as ar,bG as kt,it as lr,iu as cr,iv as dr,iw as ur,ix as fr,iy as At,iz as mr,iA as mn,iB as We,iC as ve,iD as hr,u as Se,iE as hn,iF as pr,Q as nt,B as be,z as gr,I as fe,iG as vt,bm as wr,iH as pn,iI as yr,iJ as gn,A as xr,iK as br,iL as kr,iM as vr,iN as Sr,iO as Mr,iP as Cr,iQ as Er,iR as jr,iS as Rr,iT as Nr,iU as Pr,iV as It,iW as _r,iX as Lt,iY as Ar,cb as Oe,fo as Ir,iZ as Tt,i_ as Lr,i$ as Tr,j0 as $r,an as Or,j1 as Fr,j2 as Dr,ef as zr,j3 as wn,j4 as Wr,j5 as Ur,j6 as Br,b6 as at,a4 as $t,a5 as Ot,a6 as Ft,a7 as Dt,n as Kr,df as Be,j7 as Vr,U as Hr,j8 as zt,j9 as qr,ja as Xr,jb as Te,jc as Zr,jd as Gr,W as Yr,je as Jr,jf as Qr,aO as yn,al as es,am as ts,d2 as ns,jg as rs,jh as ss,ji as is,jj as os,jk as as,ai as ls}from"./useAppFontEffects-D9nf8G19.js";import{o as Wt,X as rt,j as cs,w as He,D as ds,I as us,k as fs,W as ms,L as xn,U as hs}from"./vendor-streamdown-BbSYZ3NF.js";import{aX as ce,bc as Pe,m as ke,ba as ht,j as lt,aZ as bn,c6 as ps,c7 as gs,b2 as ws,c8 as ys,u as de,bz as xs,bu as kn}from"./katex.min-g52ii4Gs.js";import{B as st}from"./vendor-streamdown-cjk-CeadmtR2.js";import{g as bs}from"./vendor-streamdown-math-SFa9Faw2.js";import{s as vn,o as Sn,c as ks,e as vs}from"./vendor-zod--raI7LhK.js";import{a as Ss}from"./vendor-markdown-BTUqNk6W.js";import{i as Ms,r as Cs,o as Es,M as Mn,b as js,B as Ut,a as Bt,c as Rs}from"./useMarkdownLocalAssets-wPn7MXUN.js";import{r as Ns}from"./install-request-C-zhz88k.js";import{t as Kt}from"./contextFileOpenGuard-CKnYjgFC.js";import{_ as St}from"./vendor-vite-runtime-DD1OZmLC.js";import{l as Ps,s as _s,C as As}from"./columnWidthMemory-Cbfh5HD5.js";import{r as Is,a as Ls}from"./vendor-beautiful-mermaid-BFZosqFp.js";import{b as Cn}from"./vendor-shiki-BBVtYVEV.js";import{a as Ts}from"./textMateThemeFromAppTheme-CRhUx8P-.js";import{p as $s,i as Os,a as pt,b as Fs,s as En}from"./vendor-yaml-CE-D_49-.js";const jn=["note","tip","important","warning","caution"],Rn=n=>jn.find(e=>e===n)??null,Ds=/^\[!(note|tip|important|warning|caution)\][\t ]*(?:\r?\n|$)/i;function zs(n){const e=n.children[0];if(e?.type!=="paragraph")return;const t=e.children[0];if(t?.type!=="text")return;const r=Ds.exec(t.value),s=Rn(r?.[1].toLowerCase());if(!r||!s)return;t.value=t.value.slice(r[0].length),t.value||e.children.shift(),e.children[0]?.type==="break"&&e.children.shift(),e.children.length===0&&n.children.shift(),n.data={...n.data,hProperties:{...n.data?.hProperties,dataOcAlert:s}}}function Ws(){return n=>{const e=t=>{if(t.type==="blockquote"&&zs(t),"children"in t)for(const r of t.children)e(r)};e(n)}}function Us(n){return n.type==="root"}const Bs=/^ {0,3}<details(?:\s+(open(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?))?\s*>\s*<summary\s*>([\s\S]*?)<\/summary\s*>/i;function Ze(n,e,t){const r=e.slice(0,t).split(/\r\n|\r|\n/),s=r.length-1,i=r[r.length-1].length;function a(o){if(o.position)for(const l of[o.position.start,o.position.end])l&&(l.line===1&&(l.column+=i),l.line+=s,l.offset!==void 0&&(l.offset+=t));if("children"in o)for(const l of o.children)a(l)}a(n)}const Ks=/^(\s*<h([1-6])(?:\s+[^\s"'<>/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'<>=]+))?)*\s*>)([\s\S]*?)<\/h\2\s*>\s*$/i,Vs=[1,2,3,4,5,6];function Hs(n,e){const t=/(^ {0,3}(`{3,}|~{3,})[^\n]*(?:\n|$))|(`+)|(<\/?details\b[^>]*>)/gim;t.lastIndex=e;let r=1,s;for(;s=t.exec(n);)if(s[2]){const i=s[2],a=new RegExp(`^ {0,3}${i[0]}{${i.length},}[\\t ]*(?:\\r?\\n|$)`,"gm");if(a.lastIndex=t.lastIndex,!a.exec(n))break;t.lastIndex=a.lastIndex}else if(s[3]){const i=/`+/g;i.lastIndex=t.lastIndex;let a;for(;a=i.exec(n);)if(a[0].length===s[3].length){t.lastIndex=i.lastIndex;break}}else if(s[4]){const i=n.lastIndexOf(`
3
- `,s.index-1)+1,a=n.slice(i,s.index);if(/^(?: {4}|\t| {0,3}>)/.test(a)||/(?:^|[^\\])(?:\\\\)*\\$/.test(a))continue;if(r+=/^<\//.test(s[4])?-1:1,r===0)return{bodyEnd:s.index,end:t.lastIndex}}return{bodyEnd:n.length,end:n.length}}function qs(){const n=t=>{const r=this.parse(t);if(!Us(r))throw new Error("Disclosure parsing requires a Markdown root");return t.startsWith("\uFEFF")&&Ze(r,t,1),r},e=(t,r)=>{if(!("children"in t))return;const s=t.children;if(t.type==="blockquote"){const i=t.position?.start?.offset,a=t.position?.end?.offset;if(i===void 0||a===void 0)return;const o=[];let l="",c=i;for(const f of r.slice(i,a).split(new RegExp("(?<=\\n)"))){const u=/^ {0,3}> ?/.exec(f)?.[0].length??0;for(let p=u;p<f.length;p++)o.push(c+p),l+=f[p];c+=f.length}o.push(a);const d=n(l);e(d,l);const m=f=>{if(f.position)for(const u of[f.position.start,f.position.end]){if(!u||u.offset===void 0)continue;u.offset=o[u.offset]??a;const p=r.slice(0,u.offset).split(/\r\n|\r|\n/);u.line=p.length,u.column=p[p.length-1].length+1}if("children"in f)for(const u of f.children)m(u)};m(d),s.splice(0,s.length,...d.children);return}for(let i=0;i<s.length;i++){const a=s[i];if(a.type!=="html"){e(a,r);continue}const o=a.position?.start?.offset;if(o===void 0)continue;const l=Bs.exec(r.slice(o));if(!l)continue;const c=o+l[0].length,{bodyEnd:d,end:m}=Hs(r,c),f=r.slice(c,d),u=n(f);e(u,f),Ze(u,r,c);const p=/<summary\s*>/i.exec(l[0]),g=o+(p?.index??0)+(p?.[0].length??0),w=l[2]??"",C=Ks.exec(w),y=C?C[3]:w,x=n(y);Ze(x,r,g+(C?.[1].length??0));const v=x.children[0],S=v?.type==="paragraph"?v.children:[{type:"text",value:y}],M=Vs.find(F=>String(F)===C?.[2]),k={type:"ocDisclosureSummary",data:{hName:"summary"},children:M?[{type:"heading",depth:M,children:S}]:S},E={type:"ocDisclosure",data:{hName:"details",hProperties:l[1]?{open:!0}:{}},children:[k,...u.children]};let R=1,N=a.position?.end?.offset??m;for(;i+R<s.length;){const F=s[i+R];if((F.position?.start?.offset??r.length)>=m)break;N=F.position?.end?.offset??m,R++}const P=n(r.slice(m,N));Ze(P,r,m);const _=P.children;s.splice(i,R,E,..._)}};return(t,r)=>e(t,r.toString())}const Xs=function(n,e,t){const r=this.previous===null||this.previous<-2;let s=!1,i=!1;function a(u){return n.enter("ocMath"),n.enter("ocMathMarker"),n.consume(u),o}function o(u){return u!==40&&u!==91||(s=u===91,s&&!r)?t(u):(n.consume(u),n.exit("ocMathMarker"),n.enter("ocMathValue"),l)}function l(u){return u===null?t(u):u===92?n.check(d,m,c)(u):c(u)}function c(u){return i=!0,u!==null&&u<=-3?(n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),l):(n.consume(u),l)}const d={tokenize(u,p,g){return w;function w(x){return u.consume(x),C}function C(x){return!i||x!==(s?93:41)?g(x):(u.consume(x),s?y:p)}function y(x){return x===32||x===9?(u.consume(x),y):x===null||x<0?p(x):g(x)}}};function m(u){return n.exit("ocMathValue"),n.enter("ocMathMarker"),n.consume(u),f}function f(u){return n.consume(u),n.exit("ocMathMarker"),n.exit("ocMath"),e}return a},Zs=function(n,e,t){const r=this.previous,s=this.parser.constructs.text[60];let i="";return a;function a(d){return r!==null&&r>=48&&r<=57?t(d):(n.enter("ocMath"),n.consume(d),o)}function o(d){return d===null||d<0||d===34?t(d):d===60&&s?n.check(s,t,l)(d):d===40&&i.endsWith("]")||!i&&/\s/.test(String.fromCharCode(d))?t(d):d===36?!i||/^\s|\s$/.test(i)||/^[\d.,\s]+$/.test(i)||/^\d[\d.,]*(?:[;:]|\s+(?:and|to)\b)/.test(i)?t(d):(n.consume(d),c):l(d)}function l(d){return d===null?t(d):(i+=String.fromCharCode(d),n.consume(d),o)}function c(d){return d!==null&&d>=48&&d<=57?t(d):(n.exit("ocMath"),e(d))}},Gs={enter:{ocMath(n){const e=this.sliceSerialize(n).startsWith("\\[");this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math",e?"math-display":"math-inline"]},hChildren:[]}},n)}},exit:{ocMath(n){const e=this.sliceSerialize(n),t=e.startsWith("$")?1:2,r=e.slice(t,-t),s=this.stack[this.stack.length-1];s.type==="inlineMath"&&(s.value=r,s.data&&(s.data.hChildren=[{type:"text",value:r}])),this.exit(n)}}};function Ys(n,e){const t=n.position?.start?.offset,r=n.position?.end?.offset;if(t===void 0||r===void 0)return!0;const s=e.slice(t,r);return!s.startsWith("$")||s.startsWith("$$")?!0:!/^[\d.,\s]+$/.test(n.value)&&!/^\s|\s$/.test(n.value)&&!/\d/.test(e.slice(r,r+1))}function Js(){const n=this.data();return(n.micromarkExtensions??=[]).push({text:{92:{name:"ocMath",tokenize:Xs},36:{name:"ocDollarMath",tokenize:Zs}}}),(n.fromMarkdownExtensions??=[]).push(Gs),(e,t)=>{const r=t.toString();function s(i){if(!("children"in i))return;const a=i.children;if(i.type==="link"){const o=a.map(l=>l.type==="inlineMath"||l.type==="math"?r.slice(l.position?.start?.offset,l.position?.end?.offset):l.type==="text"?l.value:"").join("");if(o===i.url){i.children=[{type:"text",value:o}];return}}for(let o=0;o<a.length;o++){const l=a[o];if(l.type==="inlineMath"||l.type==="math"){const c=l.position?.start?.offset,d=l.position?.end?.offset;Ys(l,r)?l.type==="inlineMath"&&r.slice(c,d).startsWith("$$")&&(l.data??={},l.data.hProperties={className:["language-math","math-display"]}):a.splice(o,1,{type:"text",value:r.slice(c,d)})}else s(l)}}s(e)}}const Vt="openchamber://extensions/install?",Nn=n=>{if(!n.toLowerCase().startsWith(Vt))return null;const e=new URLSearchParams(n.slice(Vt.length)),t=e.get("path");if(t)return t.startsWith("/")||/^[a-z]:[\\/]/i.test(t)?{kind:"path",source:t}:null;const r=e.get("url");if(!r)return null;try{return new URL(r).protocol==="https:"?{kind:"url",source:r}:null}catch{return null}},Qs=new Set(["align","alt","checked","colSpan","controls","disabled","height","href","media","open","playsInline","preload","rel","rowSpan","src","srcSet","start","target","title","type","width"]),Ve=vn();function it(n){try{const e=new URL(n);return e.protocol==="file:"&&(!e.hostname||e.hostname==="localhost")}catch{return!1}}function gt(n){return/\s/.test(n)||/^[\s\\]*[/\\]{2}/.test(n)||n.includes("\\")?!1:/^https?:\/\//i.test(n)||!/^[a-z][a-z\d+.-]*:/i.test(n)}function ei(n,e){return n!==n.trim()||/\s/.test(n)?!1:gt(n)||it(n)||fn(n)||/^(?:mailto|tel|sms|callto|cid|xmpp|irc|ircs|news|nntp|feed|webcal):/i.test(n)||!e&&(tr(n)||Nn(n)!==null)}function ti({isVSCode:n}){return(e,t)=>{const r=t.toString();function s(i){const a=[];for(const o of i.children){if(o.type==="doctype")continue;if(o.type!=="element"){a.push(o);continue}if(["script","style","iframe","object","embed","svg","math","form"].includes(o.tagName))continue;const l=o.position?.start?.offset,c=l!==void 0&&r[l]==="<";if(!(o.tagName==="input"&&o.properties.type!=="checkbox")){for(const d of Object.keys(o.properties)){const f=c&&d==="className"&&o.tagName==="code"&&Array.isArray(o.properties.className)&&o.properties.className.every(u=>/^language-[\w#+.-]+$/.test(String(u)))||!c&&(d==="className"&&["code","li","ul","ol","section","h2","a"].includes(o.tagName)||d==="metastring"&&o.tagName==="code"||["id","ariaDescribedBy","ariaLabel","dataFootnoteRef","dataFootnoteBackref","dataFootnotes"].includes(d)||d==="dataOcAlert"&&o.tagName==="blockquote"||d==="dataOcReference"&&o.tagName==="a");!Qs.has(d)&&!f&&delete o.properties[d]}if(o.properties.href!==void 0){const d=Ve.safeParse(o.properties.href);d.success&&ei(d.data,n)?o.properties.dataOcLinkSource=d.data:delete o.properties.href}if(o.tagName==="a"&&(o.properties.href="#oc-link"),o.properties.src!==void 0){const d=Ve.safeParse(o.properties.src);if(d.success){const m=d.data,f=o.tagName==="img"&&/^data:image\/(?:png|jpeg|gif|webp);base64,(?:[a-z\d+/]{4})*(?:[a-z\d+/]{2}==|[a-z\d+/]{3}=)?$/i.test(m);m===m.trim()&&(gt(m)||it(m)||f)?(o.properties.dataOcMediaSource=m,it(m)&&delete o.properties.src):delete o.properties.src}else delete o.properties.src}if(o.tagName==="img"&&(o.properties.src="/__oc_markdown_media__"),o.properties.srcSet!==void 0){const d=Ve.safeParse(o.properties.srcSet);d.success&&d.data.split(",").every(f=>{const[u,p,...g]=f.trim().split(/\s+/);return!!u&&gt(u)&&g.length===0&&(!p||/^(?:\d+w|\d+(?:\.\d+)?x)$/.test(p))})||delete o.properties.srcSet}for(const d of["width","height"])o.properties[d]!==void 0&&!/^\d+(?:\.\d+)?%?$/.test(String(o.properties[d]))&&delete o.properties[d];o.tagName==="video"&&(o.properties.controls=!0,o.properties.playsInline=!0,o.properties.preload="none"),s(o),a.push(o)}}i.children=a}s(e)}}function ni(){return n=>{function e(t){for(const r of t.children)if(r.type==="element"){if(r.tagName==="a"){const s=Ve.safeParse(r.properties.dataOcLinkSource);s.success?r.properties.href=s.data:delete r.properties.href,delete r.properties.dataOcLinkSource}if(r.tagName==="img"){const s=Ve.safeParse(r.properties.dataOcMediaSource);s.success&&!it(s.data)&&!/^data:/i.test(s.data)?r.properties.src=s.data:delete r.properties.src}e(r)}}e(n)}}const Pn={singleTilde:!1},ri=rt.gfm,si=[[ri[0],Pn],...Object.values(rt).filter(n=>n!==rt.gfm)],ii=st.remarkPluginsAfter.at(-1),oi={...st,remarkPluginsAfter:[...st.remarkPluginsAfter.slice(0,-1),[ii,Pn]]};function ai(n=!1){return n?st:oi}const Ht=bs({singleDollarTextMath:!1}),li={...Ht,remarkPlugin:function(){return this.use([Ht.remarkPlugin]),Js.call(this)}},ci={tagNames:["a","abbr","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","mark","ol","p","picture","pre","q","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var","video"],strip:["script","style","iframe","object","embed","svg","math","form"],attributes:{"*":["align","alt","checked","colSpan","height","media","open","rowSpan","start","title","width"],a:["href","id","ariaDescribedBy","ariaLabel","dataFootnoteRef","dataFootnoteBackref","dataOcLinkSource","dataOcReference"],code:[["className",/^language-[\w#+.:-]+$/,"math-inline","math-display"],"metastring"],img:["src","srcSet","alt","dataOcMediaSource"],source:["src","srcSet","type","media","dataOcMediaSource"],video:["src","controls","playsInline","preload","dataOcMediaSource"],input:["type","checked","disabled"],li:[["className","task-list-item"]],ul:[["className","contains-task-list"]],ol:[["className","contains-task-list"]],section:["dataFootnotes",["className","footnotes"]],h2:["id",["className","sr-only"]],blockquote:[["dataOcAlert",...jn]]},protocols:{src:["http","https"]},clobberPrefix:"",required:{input:{type:"checkbox",disabled:!0}}};function di(){return n=>{function e(t){if(!("children"in t)||t.type==="link"||t.type==="linkReference")return;const r=t.children;for(let s=0;s<r.length;s++){const i=r[s];if(i.type!=="text"){e(i);continue}const a=Array.from(i.value.matchAll(/\bopenchamber:\/\/session\/[A-Za-z0-9_-]{1,128}(?:\?message=[A-Za-z0-9_-]{1,128})?/g));if(a.length===0)continue;const o=[];let l=0;for(const c of a)c.index>l&&o.push({type:"text",value:i.value.slice(l,c.index)}),o.push({type:"link",url:c[0],children:[{type:"text",value:c[0]}]}),l=c.index+c[0].length;l<i.value.length&&o.push({type:"text",value:i.value.slice(l)}),r.splice(s,1,...o),s+=o.length-1}}e(n)}}function ui(){return(n,e)=>{const t=String(e.value).replace(/^\uFEFF/,"");n.children=n.children.filter(r=>{const s=r.position?.start.offset,i=r.position?.end.offset;return s===void 0||i===void 0||!bt(t.slice(s,i))})}}function Ge(n,e,t){return{remarkPlugins:[...t?Object.values(rt):si,qs,Ws,ui,di],rehypePlugins:[...n?[Wt.raw]:[],[ti,{isVSCode:e}],[Ss,ci],Wt.harden,ni]}}const fi=[!1,!0].flatMap(n=>[Ge(!1,!1,n),Ge(!1,!0,n),Ge(!0,!1,n),Ge(!0,!0,n)]);function mi(n,e,t=!1){return fi[(t?4:0)+(n?2:0)+(e?1:0)]}const hi=new Set(["inlineCode","code","html","math","inlineMath"]);function pi(n){return e=>{const t=r=>{if(!hi.has(r.type)){if(r.type==="text"){r.value=nr(r.value,n);return}if("children"in r)for(const s of r.children)t(s)}};t(e)}}const gi=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),wi=n=>{const{issuePrefix:e,changeRequestPrefix:t}=n.descriptor.terminology,r=[...new Set([e,t])].sort((s,i)=>i.length-s.length).map(gi).join("|");return new RegExp([String.raw`(?<![\w/#!@&.-])(?<project>[\w.-]+(?:/[\w.-]+)+)?(?<prefix>${r})(?<number>\d+)(?![\w-])`,String.raw`(?<![\w@./+-])@(?<user>[A-Za-z0-9](?:[A-Za-z0-9_.-]*[A-Za-z0-9_])?)(?![\w@/-])`,String.raw`(?<![\w/@#.-])(?<sha>[0-9a-f]{7,40})(?![\w/-])`].join("|"),"g")},yi=(n,e,t)=>{const{issuePrefix:r,changeRequestPrefix:s}=n.descriptor.terminology;if(e.number&&e.prefix){const i=e.prefix===r?"issue":e.prefix===s?"pull":null,a=Number(e.number);if(!i||!Number.isSafeInteger(a)||a<1||e.project&&!n.descriptor.repository.nestedNamespaces&&e.project.split("/").length>2)return null;const o=rr(n,i,a,e.project?sr(e.project):n);return o?{url:o,children:[{type:"text",value:t}]}:null}if(e.user){const i=ir(n,e.user);return i?{url:i,children:[{type:"text",value:t}]}:null}if(e.sha&&/\d/.test(e.sha)&&/[a-f]/.test(e.sha)){const i=or(n,e.sha);return i?{url:i,children:[{type:"inlineCode",value:e.sha.slice(0,7)}]}:null}return null},xi=n=>{let e=0;for(const t of n.matchAll(/<(\/?)(a|code)\b[^>]*?(\/?)>/gi))t[3]||(e+=t[1]?-1:1);return e},bi=new Set(["link","linkReference","inlineCode","code","html","definition","math","inlineMath"]);function ki(n){const e=wi(n),t=r=>{const s=[];let i=0;for(const a of r.matchAll(e)){const o=a.groups?yi(n,a.groups,a[0]):null;if(!o)continue;a.index>i&&s.push({type:"text",value:r.slice(i,a.index)});const l={type:"link",url:o.url,children:o.children,data:{hProperties:{dataOcReference:""}}};s.push(l),i=a.index+a[0].length}return s.length===0?null:(i<r.length&&s.push({type:"text",value:r.slice(i)}),s)};return r=>{const s=i=>{if(bi.has(i.type)||!("children"in i))return;const a=i.children;let o=0;for(let l=0;l<a.length;l++){const c=a[l];if(c.type==="html"){o=Math.max(0,o+xi(c.value));continue}if(o>0)continue;if(c.type!=="text"){s(c);continue}const d=t(c.value);d&&(a.splice(l,1,...d),l+=d.length-1)}};s(r)}}const vi=/^\/api\/source-control\/[^/?#]+\/uploads\/[0-9a-f]{32}\/[^/?#]+\?/,Ye=new Map;class Si{constructor(e){this.options=e}options;controller=new AbortController;disposed=!1;sources=new Map;batch;refreshing;documentUrls=new Map;runtimeKey=ce();resolver=Pe();connect(){!this.disposed&&this.controller.signal.aborted&&(this.controller=new AbortController)}register(e){return this.sources.set(e,(this.sources.get(e)??0)+1),()=>{const t=(this.sources.get(e)??1)-1;t?this.sources.set(e,t):this.sources.delete(e)}}check(e){if(e.aborted||this.disposed||this.runtimeKey!==ce()||this.resolver!==Pe())throw new DOMException("Media owner changed","AbortError")}async resolve(e,t=!1,r=!1){const s=this.controller.signal;this.check(s);const{mode:i,directory:a,sessionId:o,messageId:l,documentAssets:c}=this.options;if(i==="assistant"&&(await Promise.resolve(),this.check(s),![...this.sources.keys()].slice(0,12).includes(e)))throw new Error("Message media limit");if(/^(?:https?:)?\/\//i.test(e)){if(i!=="document"&&!t)throw new Error("Remote chat image");return e}if(/^data:/i.test(e))return ar(e,s);if(i==="document"){if(!c){if(t||!vi.test(e))return e;const w=this.readDocumentImage(e,e,void 0,s);return w.catch(()=>{this.documentUrls.get(e)===w&&this.documentUrls.delete(e)}),w}if(!Ms(e))throw new Error("Document source is unavailable");const u=Cs(c.filePath,e),p=c.workspaceRoot,g={path:u,directory:p||void 0,allowOutsideWorkspace:p&&kt(u,p)?void 0:"true"};if(t){if(ke())throw new Error("Video bridge is unavailable");return await ht(),this.check(s),Pe().authenticatedAsset("/api/fs/raw",g)}return this.readDocumentImage(u,"/api/fs/raw",g,s)}if(i==="local")return e;if(ke()){if(t)throw new Error("Video bridge is unavailable");const u=await lr(e,a,s);return this.check(s),u}if(!o||!l)throw new Error("Missing media owner");await Promise.resolve(),this.check(s);const m=[...this.sources.keys()].slice(0,12);if(!m.includes(e))throw new Error("Message media limit");if(!this.batch||r){if(r&&this.refreshing)this.batch=this.refreshing;else if(this.batch=cr({sources:m.filter(At),directory:a,sessionId:o,messageId:l,signal:s}),r){const u=this.batch;this.refreshing=u,u.finally(()=>{this.refreshing===u&&(this.refreshing=void 0)}).catch(()=>{})}}const f=(await this.batch).get(e);if(this.check(s),f?.status!=="ready")throw new Error("Image is unavailable");if(!t&&dr()){const u=await ur(f,a,s);return this.check(s),u}return await ht(),this.check(s),fr(f,a)}readDocumentImage(e,t,r,s){const i=this.documentUrls.get(e);if(i)return i;const a=(async()=>{const o=await lt(t,{query:r,signal:AbortSignal.any([s,AbortSignal.timeout(3e4)])});if(!o.ok)throw new Error(`Image read failed (${o.status})`);const l=await o.blob();if(l.size>25*1024*1024)throw new Error("Image too large for preview");return this.check(s),URL.createObjectURL(l)})();return this.documentUrls.set(e,a),a}async load(e){const t=this.controller.signal,{mode:r,directory:s,sessionId:i,messageId:a}=this.options;if(r==="assistant"&&!ke()&&At(e)){if(!i||!a)throw new Error("Missing media owner");return mr({source:e,directory:s,sessionId:i,messageId:a,signal:t})}const o=await this.resolve(e);if(!/^(?:data|blob):/i.test(o))throw new Error("Image cannot be saved");return(await fetch(o,{signal:t})).blob()}addGallery(e){const t=`${this.runtimeKey}\0${this.options.sessionId??""}\0${this.options.messageId??""}`;let r=Ye.get(t);return r||(r=new Set,Ye.set(t,r)),r.add(e),()=>{r.delete(e),r.size||Ye.delete(t)}}async openGallery(e,t){const r=this.controller.signal;this.check(r);const s=`${this.runtimeKey}\0${this.options.sessionId??""}\0${this.options.messageId??""}`,i=[...Ye.get(s)??[]].filter(d=>d.element.isConnected).sort((d,m)=>d.element.compareDocumentPosition(m.element)&4?-1:1),a=await Promise.allSettled(i.map(d=>d.resolve()));this.check(r);const o=i.flatMap((d,m)=>{const f=a[m];return f?.status==="fulfilled"?[{url:f.value,filename:d.filename,element:d.element,load:d.load}]:[]}),l=o.findIndex(d=>d.element===e),c=o[l];c&&t({open:!0,title:c.filename,content:"",metadata:{tool:"markdown-image-preview",filename:c.filename},image:{url:c.url,filename:c.filename,load:c.load,gallery:o.map(({url:d,filename:m,load:f})=>({url:d,filename:m,load:f})),index:l}})}disconnect(){this.controller.abort();for(const e of this.documentUrls.values())e.then(t=>URL.revokeObjectURL(t),()=>{});this.documentUrls.clear(),this.batch=void 0,this.refreshing=void 0}dispose(){this.disposed=!0,this.disconnect()}}const _n=b.createContext(null),Ue=b.createContext(!1),he=()=>b.useContext(_n);function Mi(n){const e=U.c(23),{content:t,mode:r,sessionId:s,messageId:i,directory:a,settled:o,documentAssets:l,onShowPopup:c,children:d}=n,[m,f]=b.useReducer(Ci,0);let u,p;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=()=>bn(()=>f()),p=[],e[0]=u,e[1]=p):(u=e[0],p=e[1]),b.useEffect(u,p);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=ce(),e[2]=g):g=e[2];const w=g;let C;e[3]===Symbol.for("react.memo_cache_sentinel")?(C=Pe(),e[3]=C):C=e[3];const y=C,x=l?.filePath,v=l?.workspaceRoot;let S;e[4]!==a||e[5]!==x||e[6]!==i||e[7]!==r||e[8]!==s||e[9]!==v?(S=new Si({mode:r,directory:a,sessionId:s,messageId:i,documentAssets:x?{filePath:x,workspaceRoot:v??null}:void 0}),e[4]=a,e[5]=x,e[6]=i,e[7]=r,e[8]=s,e[9]=v,e[10]=S):S=e[10];const M=S;let k,E;e[11]!==M?(k=()=>{if(w!==ce()||y!==Pe()){M.dispose(),f();return}M.connect();const _=ps(()=>M.dispose());return()=>{_(),M.disconnect()}},E=[M,y,w],e[11]=M,e[12]=k,e[13]=E):(k=e[12],E=e[13]),b.useLayoutEffect(k,E);let R;e[14]!==l||e[15]!==r||e[16]!==c||e[17]!==M||e[18]!==o?(R={owner:M,mode:r,settled:o,documentAssets:l,onShowPopup:c},e[14]=l,e[15]=r,e[16]=c,e[17]=M,e[18]=o,e[19]=R):R=e[19];const N=R;let P;return e[20]!==d||e[21]!==N?(P=h.jsx(_n.Provider,{value:N,children:d}),e[20]=d,e[21]=N,e[22]=P):P=e[22],P}function Ci(n){return n+1}const Mt=b.createContext(null);function ie(){const n=b.useContext(Mt);if(!n)throw new Error("Markdown components require MarkdownContent");return n}const Ct=n=>/^(?:https?:)?\/\//i.test(n),An=n=>n==="streamdown:incomplete-image",In=(n,e)=>n["data-oc-media-source"]??e??"",Ln=b.createContext(null),Ei=n=>{const e=n.ownerDocument.defaultView;for(let t=n.parentElement;t&&e;t=t.parentElement)if(t.scrollHeight>t.clientHeight&&/auto|scroll/.test(e.getComputedStyle(t).overflowY))return t;return null};function Et(n,e){const t=U.c(7),r=e===void 0?!1:e,s=b.useRef(null);let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=u=>{s.current=u},t[0]=i):i=t[0];const a=i,[o,l]=b.useState(!1);let c,d;t[1]!==n||t[2]!==r?(c=()=>{if(!n||!s.current)return;const u=s.current.ownerDocument.defaultView?.IntersectionObserver;if(!u){l(!0);return}const p=new u(g=>{g.some(ji)&&(l(!0),p.disconnect())},r?{root:Ei(s.current),rootMargin:"100% 0px"}:{rootMargin:"200px"});return p.observe(s.current),()=>p.disconnect()},d=[n,r],t[1]=n,t[2]=r,t[3]=c,t[4]=d):(c=t[3],d=t[4]),b.useEffect(c,d);const m=!n||o;let f;return t[5]!==m?(f={ref:s,setRef:a,near:m},t[5]=m,t[6]=f):f=t[6],f}function ji(n){return n.isIntersecting}function Ri(n){const e=U.c(4);let t;e[0]!==n?(t=i=>{if(!n)return Pi;const a=window.matchMedia(n);return a.addEventListener("change",i),()=>a.removeEventListener("change",i)},e[0]=n,e[1]=t):t=e[1];const r=t;let s;return e[2]!==n?(s=()=>!n||window.matchMedia(n).matches,e[2]=n,e[3]=s):s=e[3],b.useSyncExternalStore(r,s,Ni)}function Ni(){return!0}function Pi(){}const jt=b.createContext(null);function qe(n){const e=U.c(23),{source:t,name:r,title:s,linked:i,state:a}=n,{t:o}=Se(),l=b.useContext(Mt),c=he(),d=hn(l?.directory??c?.owner?.options.directory??"");let m;e[0]!==a||e[1]!==o||e[2]!==s?(m=a==="failed"?o("common.image.loadFailed"):s,e[0]=a,e[1]=o,e[2]=s,e[3]=m):m=e[3];let f;e[4]!==t?(f=ve(t),e[4]=t,e[5]=f):f=e[5];let u;e[6]!==a?(u=a==="loading"?h.jsx(gr,{className:"size-3.5","aria-hidden":!0}):h.jsx(fe,{name:a==="failed"?"error-warning":"file-image",className:"size-3.5 shrink-0"}),e[6]=a,e[7]=u):u=e[7];let p;e[8]!==r||e[9]!==a||e[10]!==m||e[11]!==f||e[12]!==u?(p=h.jsxs("span",{title:m,"data-oc-media-source":f,"data-oc-media-label":"true","data-oc-media-state":a,className:"inline-flex items-center gap-1 align-text-bottom text-muted-foreground",children:[u,r]}),e[8]=r,e[9]=a,e[10]=m,e[11]=f,e[12]=u,e[13]=p):p=e[13];const g=p;if(!Ct(t)||i||pr(t))return g;let w;e[14]!==d||e[15]!==l?.disableLinkSafety||e[16]!==l?.purpose||e[17]!==t?(w=y=>{l?.purpose||l?.disableLinkSafety||y.metaKey||y.ctrlKey||y.shiftKey||y.altKey||(y.preventDefault(),y.stopPropagation(),d(t))},e[14]=d,e[15]=l?.disableLinkSafety,e[16]=l?.purpose,e[17]=t,e[18]=w):w=e[18];let C;return e[19]!==g||e[20]!==t||e[21]!==w?(C=h.jsx("a",{href:t,className:"external-link",target:"_blank",rel:"noopener noreferrer",onClick:w,children:g}),e[19]=g,e[20]=t,e[21]=w,e[22]=C):C=e[22],C}function Tn(n,e,t){const r=U.c(22),s=t===void 0?!1:t,i=he(),a=i?.owner,[o,l]=b.useState(null),[c,d]=b.useState(null);let m;r[0]!==i?.mode?(m=()=>{i?.mode==="document"&&l(_i)},r[0]=i?.mode,r[1]=m):m=r[1];const f=i?.mode;let u;r[2]!==f?(u=[f],r[2]=f,r[3]=u):u=r[3],b.useLayoutEffect(m,u);let p,g;r[4]!==e||r[5]!==a||r[6]!==n||r[7]!==s?(p=()=>{if(!a||!n||!e)return;const S=a.controller.signal;let M=!1;return a.resolve(n,s).then(k=>{!M&&!S.aborted&&(d(null),l({owner:a,signal:S,source:n,url:k}))},()=>{!M&&!S.aborted&&d({owner:a,signal:S,source:n,url:""})}),()=>{M=!0}},g=[a,n,e,s],r[4]=e,r[5]=a,r[6]=n,r[7]=s,r[8]=p,r[9]=g):(p=r[8],g=r[9]),b.useEffect(p,g);const w=c?.owner===a&&c?.source===n,C=o&&o.owner===a&&o.source===n&&(i?.mode!=="document"||!o.signal.aborted)&&!w?o.url:void 0;let y;r[10]!==a||r[11]!==n?(y=()=>{a&&d({owner:a,signal:a.controller.signal,source:n,url:""})},r[10]=a,r[11]=n,r[12]=y):y=r[12];let x;r[13]!==a||r[14]!==n||r[15]!==s?(x=async()=>{if(!a)throw new Error("Missing media owner");const S=a.controller.signal,M=await a.resolve(n,s,!0);S.aborted||(d(null),l({owner:a,signal:S,source:n,url:M}))},r[13]=a,r[14]=n,r[15]=s,r[16]=x):x=r[16];let v;return r[17]!==w||r[18]!==C||r[19]!==y||r[20]!==x?(v={url:C,failed:w,fail:y,retry:x},r[17]=w,r[18]=C,r[19]=y,r[20]=x,r[21]=v):v=r[21],v}function _i(n){return n?.signal.aborted?null:n}const Ai=(n,e)=>{const t=e===void 0?"":String(e).trim(),r=n===void 0?"":String(n).trim();return/^\d+$/.test(t)?/^\d+$/.test(r)&&Number(t)>0?{aspectRatio:`${r}/${t}`}:{height:`${t}px`}:{}};function Ii(n){const e=U.c(9),t=In(n,n.src),r=he(),s=b.useContext(Ue);if(An(t))return null;if(!s&&hr(t,n.alt??""))return h.jsx(Rt,{src:t,title:n.title||n.alt,node:n.node});if(!t){let a;return e[0]!==r?.mode||e[1]!==n.alt||e[2]!==n.height||e[3]!==n.title||e[4]!==n.width?(a=r?.mode==="document"?h.jsx("img",{alt:n.alt,title:n.title,width:n.width,height:n.height}):null,e[0]=r?.mode,e[1]=n.alt,e[2]=n.height,e[3]=n.title,e[4]=n.width,e[5]=a):a=e[5],a}if(r?.mode!=="document"&&(Ct(t)||s))return h.jsx(qe,{source:t,name:We(t,n.alt),title:n.title,linked:s});let i;return e[6]!==n||e[7]!==t?(i=h.jsx(Li,{...n,source:t}),e[6]=n,e[7]=t,e[8]=i):i=e[8],i}function Li(n){const e=U.c(92);let t,r,s,i,a,o,l,c,d,m,f;if(e[0]!==n){const{source:ee,node:le,src:Me,srcSet:ge,alt:we,title:Ie,className:$,style:se,width:ae,height:Le,onLoad:Ce,onError:ye,...xe}=n;o=ee,l=ge,d=we,m=Ie,t=$,c=se,f=ae,r=Le,i=Ce,s=ye,a=xe,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i,e[5]=a,e[6]=o,e[7]=l,e[8]=c,e[9]=d,e[10]=m,e[11]=f}else t=e[1],r=e[2],s=e[3],i=e[4],a=e[5],o=e[6],l=e[7],c=e[8],d=e[9],m=e[10],f=e[11];const u=d===void 0?"":d,p=he(),g=b.useContext(Ue),w=b.useContext(Ln),C=w?.report,y=b.useId();let x;e[12]!==u||e[13]!==o?(x=We(o,u),e[12]=u,e[13]=o,e[14]=x):x=e[14];const v=x,S=p?.mode==="assistant",M=p?.mode==="document",k=b.useContext(jt),{ref:E,setRef:R,near:N}=Et(S||M&&k===null,M),P=k??N,_=p?.owner,F=S&&!!p?.onShowPopup&&!g;let j,A;e[15]!==_||e[16]!==o?(j=()=>_?.register(o),A=[_,o],e[15]=_,e[16]=o,e[17]=j,e[18]=A):(j=e[17],A=e[18]),b.useEffect(j,A);const D=!!(p&&P&&(!S||p.settled)),{url:L,failed:I,fail:K}=Tn(o,D),W=$n(l,D),[q,V]=b.useState(null),O=!!(L&&q?.url===L),z=q&&q.url===L?q.size:void 0;let X,H;e[19]!==O||e[20]!==y||e[21]!==C||e[22]!==z?(X=()=>(C?.(y,O&&z?z:null),()=>C?.(y,null)),H=[C,y,O,z],e[19]=O,e[20]=y,e[21]=C,e[22]=z,e[23]=X,e[24]=H):(X=e[23],H=e[24]),b.useEffect(X,H);let Z,Y;e[25]!==O||e[26]!==F||e[27]!==v||e[28]!==_||e[29]!==E||e[30]!==o||e[31]!==L?(Z=()=>{const ee=E.current;if(!(!_||!O||!ee||!F))return _.addGallery({source:o,filename:v,element:ee,resolve:()=>L?.startsWith("data:")?Promise.resolve(L):_.resolve(o,!1,!0),load:()=>_.load(o)})},Y=[_,O,o,v,E,F,L],e[25]=O,e[26]=F,e[27]=v,e[28]=_,e[29]=E,e[30]=o,e[31]=L,e[32]=Z,e[33]=Y):(Z=e[32],Y=e[33]),b.useEffect(Z,Y);let Q;e[34]!==u||e[35]!==t||e[36]!==M||e[37]!==O||e[38]!==K||e[39]!==r||e[40]!==v||e[41]!==s||e[42]!==i||e[43]!==a||e[44]!==W||e[45]!==w?.ready||e[46]!==R||e[47]!==o||e[48]!==l||e[49]!==c||e[50]!==m||e[51]!==L||e[52]!==f?(Q=L||M?h.jsx("img",{...a,ref:M?R:void 0,src:L,srcSet:W,alt:u||v,title:m,width:f,height:r,className:nt(M?t:"block h-auto max-h-[30rem] w-auto max-w-full object-contain",M?!L&&"invisible":!O&&"hidden"),style:M?{...c,...Ai(f,r)}:{...c,width:w?.ready?"100%":c?.width},"data-oc-media-source":ve(o),"data-oc-media-srcset":l,decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:ee=>{const le=ee.currentTarget;L&&le.naturalWidth&&le.naturalHeight&&V({url:L,size:{width:le.naturalWidth,height:le.naturalHeight}}),i?.(ee)},onError:ee=>{K(),s?.(ee)}}):null,e[34]=u,e[35]=t,e[36]=M,e[37]=O,e[38]=K,e[39]=r,e[40]=v,e[41]=s,e[42]=i,e[43]=a,e[44]=W,e[45]=w?.ready,e[46]=R,e[47]=o,e[48]=l,e[49]=c,e[50]=m,e[51]=L,e[52]=f,e[53]=Q):Q=e[53];const te=Q,T=z?z.width/z.height:1;let B;e[54]!==T||e[55]!==w?.ready||e[56]!==z?(B=w?.ready&&z?{flex:`${T} 1 0px`,minWidth:`${8*T}rem`,maxWidth:`min(${z.width}px, ${30*T}rem)`,margin:0}:void 0,e[54]=T,e[55]=w?.ready,e[56]=z,e[57]=B):B=e[57];const re=B;if(M){let ee;return e[58]!==I||e[59]!==te||e[60]!==g||e[61]!==v||e[62]!==o||e[63]!==m?(ee=I?h.jsx(qe,{source:o,name:v,title:m,linked:g,state:"failed"}):te,e[58]=I,e[59]=te,e[60]=g,e[61]=v,e[62]=o,e[63]=m,e[64]=ee):ee=e[64],ee}const G=O?"inline-block max-w-[min(100%,30rem)] align-top my-1 me-1":void 0;let J;e[65]!==o?(J=ve(o),e[65]=o,e[66]=J):J=e[66];let oe;e[67]!==D||e[68]!==O||e[69]!==I||e[70]!==g||e[71]!==v||e[72]!==o||e[73]!==m?(oe=!O&&h.jsx(qe,{source:o,name:v,title:m,linked:g,state:I?"failed":D?"loading":void 0}),e[67]=D,e[68]=O,e[69]=I,e[70]=g,e[71]=v,e[72]=o,e[73]=m,e[74]=oe):oe=e[74];const pe=L&&!F&&te;let me;e[75]!==p||e[76]!==O||e[77]!==F||e[78]!==te||e[79]!==v||e[80]!==_||e[81]!==E||e[82]!==L?(me=L&&F&&h.jsx(be,{variant:"ghost",className:nt("block h-auto max-w-full overflow-hidden rounded-lg bg-muted/10 p-0 cursor-zoom-in",!O&&"hidden"),"aria-label":v,"data-oc-media-gallery":"true",onClick:()=>{const ee=E.current;ee&&p?.onShowPopup&&_?.openGallery(ee,p.onShowPopup).catch(Ti)},children:te}),e[75]=p,e[76]=O,e[77]=F,e[78]=te,e[79]=v,e[80]=_,e[81]=E,e[82]=L,e[83]=me):me=e[83];let ue;return e[84]!==re||e[85]!==R||e[86]!==G||e[87]!==J||e[88]!==oe||e[89]!==pe||e[90]!==me?(ue=h.jsxs("span",{ref:R,className:G,style:re,"data-oc-media-source":J,children:[oe,pe,me]}),e[84]=re,e[85]=R,e[86]=G,e[87]=J,e[88]=oe,e[89]=pe,e[90]=me,e[91]=ue):ue=e[91],ue}function Ti(){}function $n(n,e){const t=U.c(12),r=he(),s=r?.owner,[i,a]=b.useState(null);let o,l;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(Fi)},l=[],t[0]=o,t[1]=l):(o=t[0],l=t[1]),b.useLayoutEffect(o,l);let c;t[2]!==e||t[3]!==r?.mode||t[4]!==s||t[5]!==n?(c=()=>{if(!n||!s||!e||r?.mode!=="document")return;const f=s.controller.signal;let u=!1;const p=n.split(",").flatMap(Oi);return Promise.all(p.map(async g=>{const{source:w,descriptor:C}=g,y=await s.resolve(w);return C?`${y} ${C}`:y})).then(g=>{!u&&!f.aborted&&a({owner:s,signal:f,source:n,value:g.join(", ")})},$i),()=>{u=!0}},t[2]=e,t[3]=r?.mode,t[4]=s,t[5]=n,t[6]=c):c=t[6];const d=r?.mode;let m;return t[7]!==e||t[8]!==s||t[9]!==n||t[10]!==d?(m=[s,d,n,e],t[7]=e,t[8]=s,t[9]=n,t[10]=d,t[11]=m):m=t[11],b.useEffect(c,m),i&&i.owner===s&&!i.signal.aborted&&i.source===n?i.value:void 0}function $i(){}function Oi(n){const[e,...t]=n.trim().split(/\s+/);return e?[{source:e,descriptor:t.join(" ")}]:[]}function Fi(n){return n?.signal.aborted?null:n}function Di(n){const e=U.c(10);let t,r;if(e[0]!==n){const{node:d,children:m,...f}=n;t=m,r=f,e[0]=n,e[1]=t,e[2]=r}else t=e[1],r=e[2];const s=he()?.mode==="document",{setRef:i,near:a}=Et(s,!0),o=s?a:null;let l;e[3]!==t||e[4]!==o?(l=h.jsx(jt.Provider,{value:o,children:t}),e[3]=t,e[4]=o,e[5]=l):l=e[5];let c;return e[6]!==r||e[7]!==i||e[8]!==l?(c=h.jsx("picture",{...r,ref:i,children:l}),e[6]=r,e[7]=i,e[8]=l,e[9]=c):c=e[9],c}function zi(n){const e=U.c(13);let t,r,s;if(e[0]!==n){const{node:u,srcSet:p,media:g,...w}=n;s=p,t=g,r=w,e[0]=n,e[1]=t,e[2]=r,e[3]=s}else t=e[1],r=e[2],s=e[3];const i=he(),a=b.useContext(jt),o=i?.documentAssets?.colorScheme;let l;e[4]!==t||e[5]!==o?(l=o?t?.replace(/\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)/gi,(u,p)=>p.toLowerCase()===o?"(min-width: 0px)":"(max-width: -1px)"):t,e[4]=t,e[5]=o,e[6]=l):l=e[6];const c=l,d=Ri(i?.mode==="document"?c:void 0),m=$n(s,i?.mode==="document"&&a!==!1&&d);if(i?.mode!=="document")return null;let f;return e[7]!==t||e[8]!==r||e[9]!==m||e[10]!==s||e[11]!==c?(f=h.jsx("source",{...r,srcSet:m,media:c,"data-oc-media-srcset":s,"data-oc-media-query":t}),e[7]=t,e[8]=r,e[9]=m,e[10]=s,e[11]=c,e[12]=f):f=e[12],f}function Rt(n){const e=In(n,n.src),t=he(),r=t?.owner,s=b.useContext(Ue),i=Ct(e),{setRef:a,near:o}=Et(t?.mode==="assistant"&&!i);b.useEffect(()=>i?void 0:r?.register(e),[r,e,i]);const{url:l,fail:c,retry:d}=Tn(e,!!(t&&!i&&!s&&(t.mode!=="assistant"||t.settled&&o)),!0),[m,f]=b.useState(null),u=m?.owner===r&&m?.source===e?m:null,p=b.useMemo(()=>({lastRetry:0,resume:null}),[r,e]),g=b.useRef(p);g.current=p;const w=b.useRef(null),C=n.title||We(e),y=i?u?.failed?void 0:u?.url??e:l,x=!!(y&&(i||t?.mode!=="assistant"||u?.ready===y));return!e||An(e)?null:s?h.jsx(qe,{source:e,name:C,linked:!0}):h.jsxs("span",{ref:a,className:"inline-block max-w-full align-top","data-oc-media-source":ve(e),children:[!x&&h.jsx(qe,{source:e,name:C,linked:!1}),y&&h.jsx("video",{ref:w,src:y,title:C,controls:!0,playsInline:!0,hidden:!x,preload:i&&t?.mode!=="document"?"none":"metadata",className:n.className,"data-oc-media-source":ve(e),onLoadedMetadata:v=>{f({owner:r,source:e,url:u?.url,ready:y});const S=p.resume;S&&(v.currentTarget.currentTime=S.time,S.playing&&v.currentTarget.play().catch(()=>{}),p.resume=null),n.onLoadedMetadata?.(v)},onError:v=>{if(i){const M=Pe(),k=new URL(e,window.location.href),E=new URL(M.api("/api/fs/raw"),window.location.href);if(!(k.origin===E.origin&&k.pathname===E.pathname&&k.searchParams.has("oc_url_token"))||Date.now()-p.lastRetry<1e4){f({owner:r,source:e,failed:!0});return}p.lastRetry=Date.now(),p.resume={time:v.currentTarget.currentTime,playing:!v.currentTarget.paused};const N=r?.controller.signal;k.searchParams.delete("oc_url_token"),ht().then(()=>{N?.aborted||g.current!==p||M!==Pe()||f({owner:r,source:e,url:M.authenticatedAsset("/api/fs/raw",k.searchParams)})},()=>{!N?.aborted&&g.current===p&&f({owner:r,source:e,failed:!0})});return}if(Date.now()-p.lastRetry<1e4){c();return}p.lastRetry=Date.now(),p.resume={time:v.currentTarget.currentTime,playing:!v.currentTarget.paused};const S=r?.controller.signal;d().then(()=>{!S?.aborted&&g.current===p&&w.current?.load()},()=>{!S?.aborted&&g.current===p&&c()})}})]})}function Wi(n){const e=U.c(32);let t,r,s;e[0]!==n?({node:r,children:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=new Map,e[4]=i):i=e[4];const[a,o]=b.useState(i);let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=(P,_)=>{o(F=>{if(F.get(P)===_||!_&&!F.has(P))return F;const j=new Map(F);return _?j.set(P,_):j.delete(P),j})},e[5]=l):l=e[5];const c=l,d=r?.children.filter(Vi),m=d?.length===1?d[0]:void 0,f=m?.type==="element"&&m.tagName==="a"?m.properties.href:void 0,u=m?.type==="element"&&m.children.length===1&&m.children[0]?.type==="text"?m.children[0].value:"",p=d?.length??0,g=p>1&&d?.every(Ki),w=he()?.mode,C=!!(w==="assistant"&&g&&a.size===p);let y;e[6]!==C?(y={report:c,ready:C},e[6]=C,e[7]=y):y=e[7];const x=y;if(w==="document"&&u&&u===f&&mn(u)){let P;e[8]!==u?(P=h.jsx(Rt,{src:u}),e[8]=u,e[9]=P):P=e[9];let _;return e[10]!==s||e[11]!==P?(_=h.jsx("p",{...s,"data-streamdown":"paragraph",children:P}),e[10]=s,e[11]=P,e[12]=_):_=e[12],_}let v,S;e[13]!==a?(v=[...a.values()],S=v.reduce(Bi,0),e[13]=a,e[14]=v,e[15]=S):(v=e[14],S=e[15]);const M=S;let k;if(e[16]!==p||e[17]!==v||e[18]!==s.style||e[19]!==M||e[20]!==C){if(k={...s.style},C){k.display="flex",k.flexWrap="wrap",k.alignItems="flex-start",k.gap="0.5rem";let P;e[22]!==v?(P=v.map(Ui),e[22]=v,e[23]=P):P=e[23],k.maxWidth=`calc(min(30rem, ${Math.min(...P)}px) * ${M} + ${(p-1)*.5}rem)`}e[16]=p,e[17]=v,e[18]=s.style,e[19]=M,e[20]=C,e[21]=k}else k=e[21];const E=C?"true":void 0;let R;e[24]!==t||e[25]!==k||e[26]!==s||e[27]!==E?(R=h.jsx("p",{...s,"data-streamdown":"paragraph","data-oc-media-row":E,style:k,children:t}),e[24]=t,e[25]=k,e[26]=s,e[27]=E,e[28]=R):R=e[28];let N;return e[29]!==R||e[30]!==x?(N=h.jsx(Ln.Provider,{value:x,children:R}),e[29]=R,e[30]=x,e[31]=N):N=e[31],N}function Ui(n){return n.height}function Bi(n,e){return n+e.width/e.height}function Ki(n){return n.type==="element"&&n.tagName==="img"}function Vi(n){return n.type!=="text"||n.value.trim()}const Hi=new Set(["dockerfile","makefile","readme","license",".env",".gitignore",".npmrc"]),qt=Array.from(Hi).map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),qi=n=>vt(n),On=n=>{let e;try{e=new URL(n.trim())}catch{return null}if(e.protocol!=="file:"||e.hostname&&e.hostname!=="localhost")return null;try{const t=decodeURIComponent(e.pathname);return/^\/[A-Za-z]:\//.test(t)?t.slice(1):t.startsWith("/")?t:null}catch{return null}},ot=n=>{let e=(n||"").trim();return e?((e.startsWith("`")&&e.endsWith("`")||e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1).trim()),e=e.replace(/[.,;!?]+$/g,""),e.endsWith(")")&&!e.includes("(")&&(e=e.slice(0,-1)),e.endsWith("]")&&!e.includes("[")&&(e=e.slice(0,-1)),e):""},Je=n=>{let e=ot(n);if(!e)return"";const t=e.indexOf(";");t>=0&&(e=e.slice(0,t)),e=e.replace(/#.*$/,"");const r=e.match(/^(.*\.[A-Za-z0-9_-]{1,16}):.*$/);r&&(e=r[1]??e);const s=qt.length>0?e.match(new RegExp(`^(.*(?:/|^)(${qt})):.*$`,"i")):null;return s&&(e=s[1]??e),ot(e)},Xi=n=>{const e=ot(n);if(!e)return null;const t=e.indexOf(";"),r=t>=0?ot(e.slice(0,t)):e;if(!r)return null;const s=r.match(/^(.*?):(\d+)-(\d+)$/);if(s){const l=Je(s[1]??""),c=Number.parseInt(s[2]??"",10),d=Number.parseInt(s[3]??"",10);return!l||!Number.isFinite(c)||!Number.isFinite(d)||d<c?null:{path:l,line:c,endLine:d}}const i=r.match(/^(.*)#L(\d+)(?:C(\d+))?$/i);if(i){const l=Je(i[1]??""),c=Number.parseInt(i[2]??"",10),d=i[3]?Number.parseInt(i[3],10):void 0;return!l||!Number.isFinite(c)?null:{path:l,line:c,column:Number.isFinite(d??Number.NaN)?d:void 0}}const a=r.match(/^(.*?):(\d+)(?::(\d+))?$/);if(a){const l=Je(a[1]??""),c=Number.parseInt(a[2]??"",10),d=a[3]?Number.parseInt(a[3],10):void 0;return!l||!Number.isFinite(c)?null:{path:l,line:c,column:Number.isFinite(d??Number.NaN)?d:void 0}}const o=Je(r);return o?{path:o}:null},Zi=/(?:[A-Za-z]:[\\/])?[\w.\-/@+]*[\w\-/@+]\.[A-Za-z0-9]{1,8}(?::\d+(?:-\d+)?(?::\d+)?)?/g,Gi=4,Yi=1e3,Ji=200,Ee=new Map;let Qe=0;const Xt=[],Qi=()=>ke()?Ji:Yi,Fn=(n,e)=>`${n}\0${e}`,eo=(n,e)=>{const t=vt(n,{preserveWhitespace:!0});if(!t)return Promise.resolve(!1);const r=Fn(e,t),s=Ee.get(r);if(s)return Ee.delete(r),Ee.set(r,s),s;const i=new Promise(o=>{const l=()=>{Qe+=1,lt(`/api/fs/stat?path=${encodeURIComponent(t)}&optional=true`,{method:"GET",cache:"no-store",headers:e?{"x-opencode-directory":e}:void 0}).then(async c=>{if(!c.ok){o(!1);return}const d=await c.json().catch(()=>null);o(d?.exists!==!1)}).catch(()=>o(!1)).finally(()=>{Qe=Math.max(0,Qe-1),Xt.shift()?.()})};if(Qe<Gi){l();return}Xt.push(l)}),a=Qi();for(;Ee.size>=a;){const o=Ee.keys().next().value;if(typeof o!="string")break;Ee.delete(o)}return Ee.set(r,i),i},to=Sn({exists:vs().optional()}),no=async(n,e)=>{const t=new URLSearchParams({path:vt(n,{preserveWhitespace:!0}),optional:"true"});kt(n,e)||t.set("allowOutsideWorkspace","true");try{const r=await lt(`/api/fs/stat?${t.toString()}`,{method:"GET",cache:"no-store",headers:{"x-opencode-directory":e}});if(!r.ok)return"failed";const s=to.safeParse(await r.json().catch(()=>null));return s.success?s.data.exists===!1?"missing":"exists":"failed"}catch{return"failed"}},ro=Sn({paths:ks(vn())}),Ke=new Map,so=200,Dn=(n,e)=>lt(`/api/fs/find-by-name?name=${encodeURIComponent(n)}`,{method:"GET",cache:"no-store",headers:{"x-opencode-directory":e}}).then(async t=>{if(!t.ok)return null;const r=ro.safeParse(await t.json().catch(()=>null));return r.success?r.data.paths:null}).catch(()=>null),io=(n,e)=>{if(!n||!e||ke())return Promise.resolve(null);const t=Fn(e,n),r=Ke.get(t);if(r)return r;const s=Dn(n,e).then(i=>i?.length===1?i[0]:null);for(;Ke.size>=so;){const i=Ke.keys().next();if(i.done)break;Ke.delete(i.value)}return Ke.set(t,s),s};function Fe(n,e){if("key"in n&&n.key!=="Enter"&&n.key!==" "||(n.preventDefault(),n.stopPropagation(),!("key"in n)&&br(n.currentTarget.closest("[data-markdown-content]"))))return;const t=/Mac|iPhone|iPad/.test(navigator.platform);e(t?n.metaKey:n.ctrlKey)}const Zt=new gn({maxEntries:64,maxBytes:1024*1024});function ct(){const n=U.c(5),{directory:e}=ie(),t=b.useContext(pn),r=t?.editor,s=t?.runtime.isVSCode,i=yr();let a;return n[0]!==e||n[1]!==r||n[2]!==s||n[3]!==i?(a=async(o,l,c,d)=>{const m=c===void 0?!1:c,u=Ae(o,e,"click",d===void 0?"path":d);if(!u)return;const p=l??u.resolvedPath;if(m&&ws()&&await ys(p))return;if(s&&r){r.openFile(p,u.line,u.column);return}const g=de.getState();u.line?g.openContextFileAtLine(e,p,u.line,u.column??1):g.openContextFile(e,p),i?.openFiles()},n[0]=e,n[1]=r,n[2]=s,n[3]=i,n[4]=a):a=n[4],a}function oo(){const n=U.c(5),{directory:e}=ie(),t=ct(),r=b.useRef(!1);let s,i;n[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>(r.current=!0,()=>{r.current=!1}),i=[],n[0]=s,n[1]=i):(s=n[0],i=n[1]),b.useEffect(s,i);let a;return n[2]!==e||n[3]!==t?(a=async o=>{const l=Ae(o,e);if(!l)return;const c=ce(),d=await no(l.resolvedPath,e),m=d==="missing"&&!/[\\/]/.test(l.path)?await Dn(l.path,e):[];!r.current||ce()!==c||(d==="failed"||!m||m.length>1?Kt(l.resolvedPath,{reason:"unreadable",message:null}):d==="missing"&&m.length===0?Kt(l.resolvedPath,{reason:"missing"}):await t(o,m[0]??l.resolvedPath))},n[2]=e,n[3]=t,n[4]=a):a=n[4],a}function ao(){const n=U.c(5),e=b.useContext(pn),{t}=Se(),r=e?.files,s=e?.runtime.platform;let i;e:{let a;n[0]!==r?(a=r?.revealPath?.bind(r),n[0]=r,n[1]=a):a=n[1];const o=a;if(!o||!s||s==="vscode"||gs(s)){i=null;break e}let l;n[2]!==o||n[3]!==t?(l=c=>{o(c).catch(()=>{xr.error(t("sidebarFilesTree.toast.revealFailed"))})},n[2]=o,n[3]=t,n[4]=l):l=n[4],i=l}return i}const lo=new Set(["dockerfile","makefile","readme","license",".env",".gitignore",".npmrc"]),co=(n,e,t)=>{if(!n||!t&&(n.startsWith("--")||n.includes("://")||/[<>]/.test(n)||/\s{2,}/.test(n))||!t&&e==="probe"&&n.includes("@")&&!n.includes("/"))return!1;const s=qi(n).split("/").filter(Boolean).pop()??"";if(!s||s==="."||s==="..")return!1;const i=s.toLowerCase();return lo.has(i)||i.startsWith(".")&&i.length>1?!0:s.endsWith(".")?!1:e==="click"?/\.[A-Za-z0-9_-]{1,16}$/.test(s):/\.[A-Za-z][A-Za-z0-9_-]{0,15}$/.test(s)};function Ae(n,e,t="probe",r="path"){const s=/^\s*file:/i.test(n),i=Xi(s?On(n)??n:n),a=r==="href"&&!s;if(i&&a){if(i.path.startsWith("//")||/^[A-Za-z][A-Za-z\d+.-]*:/.test(i.path)&&!/^[A-Za-z]:[\\/]/.test(i.path))return null;try{i.path=decodeURIComponent(i.path)}catch{}}if(!i||!e||!co(i.path,t,a))return null;const o=wr(e,i.path,{preserveWhitespace:a});return o?{...i,resolvedPath:o}:null}async function zn(n,e,t="path"){const r=Ae(n,e,"probe",t);return r?!kt(r.resolvedPath,e)||await eo(r.resolvedPath,e)?r.resolvedPath:/[\\/]/.test(r.path)?null:io(r.path,e):null}async function uo(n,e,t,r=s=>zn(s,e)){if(n.length>2e5)return[];let s=Zt.get(n);if(!s){s=Array.from(n.matchAll(Zi),l=>({raw:l[0],start:l.index}));const o=n.length*2+s.reduce((l,c)=>l+c.raw.length*2+32,0);o<=1024*1024&&Zt.set(n,s,o)}const i=s.filter(o=>Ae(o.raw,e)).slice(0,t);return(await Promise.all(i.map(async o=>{const l=await r(o.raw);return l?{start:o.start,end:o.start+o.raw.length,raw:o.raw,path:l}:null}))).filter(o=>o!==null)}function Wn(n,e){const t=U.c(8),r=e===void 0?"path":e,{directory:s,fileReferences:i,confirmFile:a}=ie();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=ce(),t[0]=o):o=t[0];const l=o,[c,d]=b.useState(null);let m,f;return t[1]!==a||t[2]!==s||t[3]!==i||t[4]!==r||t[5]!==n?(m=()=>{if(!i)return;let u=!0;return a(n,r).then(p=>{u&&l===ce()&&d(p?{raw:n,inputKind:r,directory:s,runtimeKey:l,path:p}:null)}),()=>{u=!1}},f=[n,r,s,i,l,a],t[1]=a,t[2]=s,t[3]=i,t[4]=r,t[5]=n,t[6]=m,t[7]=f):(m=t[6],f=t[7]),b.useEffect(m,f),i&&c?.raw===n&&c.inputKind===r&&c.directory===s&&c.runtimeKey===l?c.path:null}function fo(n){const e=U.c(23);let t,r,s;e[0]!==n?({children:r,node:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let i;e[4]!==t?.children?(i=t?.children.map(mo).join("")??"",e[4]=t?.children,e[5]=i):i=e[5];const a=i,o=Wn(a),l=ct(),c=oo(),{directory:d,fileNavigation:m,fileReferences:f}=ie();let u;e[6]!==l||e[7]!==o||e[8]!==a?(u=N=>{o&&Fe(N,P=>{l(a,o,P)})},e[6]=l,e[7]=o,e[8]=a,e[9]=u):u=e[9];const p=u,g=m&&!f&&Ae(a,d)!==null;let w;e[10]!==c||e[11]!==a?(w=N=>{N.currentTarget.closest('a, button, [role="button"], summary')||Fe(N,()=>{c(a)})},e[10]=c,e[11]=a,e[12]=w):w=e[12];const C=w,y=o?"true":void 0,x=o?a:void 0,v=o??void 0,S=o?"button":void 0,M=o?0:void 0,k=o?p:g?C:void 0,E=o?p:void 0;let R;return e[13]!==r||e[14]!==s||e[15]!==E||e[16]!==y||e[17]!==x||e[18]!==v||e[19]!==S||e[20]!==M||e[21]!==k?(R=h.jsx("code",{...s,dir:"ltr","data-streamdown":"inline-code","data-openchamber-file-link":y,"data-openchamber-file-ref":x,"data-openchamber-file-path":v,role:S,tabIndex:M,onClick:k,onKeyDown:E,children:r}),e[13]=r,e[14]=s,e[15]=E,e[16]=y,e[17]=x,e[18]=v,e[19]=S,e[20]=M,e[21]=k,e[22]=R):R=e[22],R}function mo(n){return n.type==="text"?n.value:""}function ho(n){const e=U.c(10),{purpose:t}=ie();if(t){let s,i;if(e[0]!==n){const{node:l,children:c,...d}=n;s=c,i=d,e[0]=n,e[1]=s,e[2]=i}else s=e[1],i=e[2];let a;e[3]!==s?(a=h.jsx(Ue.Provider,{value:!0,children:s}),e[3]=s,e[4]=a):a=e[4];let o;return e[5]!==i||e[6]!==a?(o=h.jsx("a",{...i,children:a}),e[5]=i,e[6]=a,e[7]=o):o=e[7],o}let r;return e[8]!==n?(r=h.jsx(wo,{...n}),e[8]=n,e[9]=r):r=e[9],r}function po(n){const e=U.c(3),{src:t}=n,[r,s]=b.useState(!1);if(r)return null;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>s(!0),e[0]=i):i=e[0];let a;return e[1]!==t?(a=h.jsx("span",{"data-message-image-export-exclude":"true",className:"me-1 inline-flex size-[18px] items-center justify-center rounded border border-[var(--border)] bg-[var(--interactive-hover)] align-middle",children:h.jsx("img",{src:t,alt:"","aria-hidden":"true",loading:"lazy",decoding:"async",className:"size-3.5 rounded-sm",onError:i})}),e[1]=t,e[2]=a):a=e[2],a}const go=n=>{if(!n)return"";let e="";const t=r=>{r.type==="text"?e+=r.value:r.type==="element"&&r.children.forEach(t)};return n.children.forEach(t),e.trim()};function wo(n){const e=U.c(17);let t,r,s,i;if(e[0]!==n?({href:t,children:s,node:r,...i}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i):(t=e[1],r=e[2],s=e[3],i=e[4]),!t){let o;if(e[5]!==i){const{target:d,rel:m,...f}=i;o=f,e[5]=i,e[6]=o}else o=e[6];let l;e[7]!==s?(l=h.jsx(Ue.Provider,{value:!0,children:s}),e[7]=s,e[8]=l):l=e[8];let c;return e[9]!==o||e[10]!==l?(c=h.jsx("a",{...o,children:l}),e[9]=o,e[10]=l,e[11]=c):c=e[11],c}let a;return e[12]!==t||e[13]!==r||e[14]!==s||e[15]!==i?(a=h.jsx(yo,{href:t,node:r,...i,children:s}),e[12]=t,e[13]=r,e[14]=s,e[15]=i,e[16]=a):a=e[16],a}function yo(n){const e=U.c(113);let t,r,s,i;e[0]!==n?({href:t,children:s,node:r,...i}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i):(t=e[1],r=e[2],s=e[3],i=e[4]);let a;e[5]!==s?(a=h.jsx(Ue.Provider,{value:!0,children:s}),e[5]=s,e[6]=a):a=e[6];const o=a,l=ie(),{directory:c}=l,{t:d}=Se(),m=hn(c),f=ct(),u=he(),p=de(bo);let g;e[7]!==r?(g=go(r),e[7]=r,e[8]=g):g=e[8];const w=g;let C;e[9]!==t?(C=kr(t),e[9]=t,e[10]=C):C=e[10];const y=C,x=vr(t);let v;e[11]!==t?(v=Sr(t),e[11]=t,e[12]=v):v=e[12];const S=v,M=ke()?null:Mr(t,Cr());let k;e[13]!==t?(k=ke()?null:Nn(t),e[13]=t,e[14]=k):k=e[14];const E=k,R=b.useContext(Er),N=M?R.get(jr(M)):void 0;let P;e[15]!==t?(P=fn(t),e[15]=t,e[16]=P):P=e[16];const _=P;let F;e[17]!==c||e[18]!==t||e[19]!==l.fileNavigation?(F=l.fileNavigation&&Ae(t,c,"click","href"),e[17]=c,e[18]=t,e[19]=l.fileNavigation,e[20]=F):F=e[20];const j=F,A=ao();let D;e[21]!==j||e[22]!==t||e[23]!==l.fileNavigation||e[24]!==A?(D=l.fileNavigation&&!j&&A?On(t):null,e[21]=j,e[22]=t,e[23]=l.fileNavigation,e[24]=A,e[25]=D):D=e[25];const L=D,I=!!(j||L||_||M||y||x||S),K=I?t:w,W=Wn(K,I?"href":"path"),q=!!(W&&!I);let V;e[26]!==t?(V=Rr(t),e[26]=t,e[27]=V):V=e[27];const O=V,z=r?.properties.dataOcReference!==void 0;let X;e[28]!==O||e[29]!==t||e[30]!==W||e[31]!==z?(X=O&&!W&&!z?Nr(t):null,e[28]=O,e[29]=t,e[30]=W,e[31]=z,e[32]=X):X=e[32];const H=X;let Z;e[33]!==c||e[34]!==t||e[35]!==p||e[36]!==l.loopbackPreview?(Z=l.loopbackPreview&&Pr(t)&&c&&!(xs()&&p),e[33]=c,e[34]=t,e[35]=p,e[36]=l.loopbackPreview,e[37]=Z):Z=e[37];const Y=Z;let Q;e[38]!==_||e[39]!==O||e[40]!==j||e[41]!==L||e[42]!==t||e[43]!==u||e[44]!==m||e[45]!==f||e[46]!==W||e[47]!==l.disableLinkSafety||e[48]!==A||e[49]!==M||e[50]!==y||e[51]!==w||e[52]!==q?(Q=$=>{if(!(u?.documentAssets&&Es($,u.documentAssets))){if(q&&W){Fe($,se=>{f(w,W,se)});return}if(M&&(!O||!($.metaKey||$.ctrlKey||$.shiftKey||$.altKey))){$.preventDefault(),Ir(M.sessionId,M.messageId);return}if(_){$.preventDefault(),$.stopPropagation(),Tt(t);return}if(!y){if(j){Fe($,se=>{f(t,W??void 0,se,"href")});return}if(L&&A){Fe($,()=>A(L));return}if(t.startsWith("#")&&!u?.documentAssets){$.preventDefault();const se=decodeURIComponent(t.slice(1)),ae=$.currentTarget.closest("[data-markdown-content]");(ae?Array.from(ae.querySelectorAll("[id]")).find(Ce=>Ce.id===se):null)?.scrollIntoView({block:"nearest"});return}O&&!l.disableLinkSafety&&!($.metaKey||$.ctrlKey||$.shiftKey||$.altKey)&&($.preventDefault(),$.stopPropagation(),m(t))}}},e[38]=_,e[39]=O,e[40]=j,e[41]=L,e[42]=t,e[43]=u,e[44]=m,e[45]=f,e[46]=W,e[47]=l.disableLinkSafety,e[48]=A,e[49]=M,e[50]=y,e[51]=w,e[52]=q,e[53]=Q):Q=e[53];const te=Q;if(S){const $=S.openable?It:_r,se=S.openable?S.filename:void 0,ae=S.openable?"button":void 0,Le=S.openable?0:void 0,Ce=`#${S.iconId}`;let ye;e[54]!==Ce?(ye=h.jsx("svg",{className:"size-[1.1em] shrink-0","aria-hidden":"true",children:h.jsx("use",{href:Ce})}),e[54]=Ce,e[55]=ye):ye=e[55];let xe;e[56]!==S.filename?(xe=h.jsx("span",{className:Lt,children:S.filename}),e[56]=S.filename,e[57]=xe):xe=e[57];let Xe;return e[58]!==S.filename||e[59]!==S.iconId||e[60]!==$||e[61]!==se||e[62]!==ae||e[63]!==Le||e[64]!==ye||e[65]!==xe?(Xe=h.jsxs("span",{className:$,"data-attachment-citation":S.iconId,"data-attachment-open":se,role:ae,tabIndex:Le,title:S.filename,children:[ye,xe]}),e[58]=S.filename,e[59]=S.iconId,e[60]=$,e[61]=se,e[62]=ae,e[63]=Le,e[64]=ye,e[65]=xe,e[66]=Xe):Xe=e[66],Xe}if(E&&kn()){let $;return e[67]!==o?($=h.jsx("span",{children:o}),e[67]=o,e[68]=$):$=e[68],$}if(E){let $;e[69]!==E.kind||e[70]!==E.source?($=()=>Ns({source:E.source,confirmed:E.kind==="path"}),e[69]=E.kind,e[70]=E.source,e[71]=$):$=e[71];let se;e[72]===Symbol.for("react.memo_cache_sentinel")?(se=h.jsx(fe,{name:"download",className:"size-4"}),e[72]=se):se=e[72];let ae;return e[73]!==o||e[74]!==$?(ae=h.jsxs(be,{type:"button",variant:"outline",size:"sm",className:"my-1 align-middle",onClick:$,children:[se,o]}),e[73]=o,e[74]=$,e[75]=ae):ae=e[75],ae}if(M&&N){let $;return e[76]!==N||e[77]!==M?($=h.jsx(Lr,{chip:N,target:M}),e[76]=N,e[77]=M,e[78]=$):$=e[78],$}if(x)return h.jsx("a",{"data-openchamber-agent-mention":"true",className:"text-primary hover:underline",href:Ar(x),target:"_blank",rel:"noopener noreferrer",children:o});let T;e[79]!==H?(T=H&&h.jsx(po,{src:H}),e[79]=H,e[80]=T):T=e[80];const B=w===t?"ltr":i.dir,re=y?It:i.className,G=y??void 0,J=y?`$${y}`:i.title,oe=W?"true":void 0,pe=W?K:void 0,me=W??void 0;let ue;e[81]!==_||e[82]!==t?(ue=$=>{_&&($.preventDefault(),$.button===1&&Tt(t))},e[81]=_,e[82]=t,e[83]=ue):ue=e[83];const ee=_?xo:void 0;let le;e[84]!==y?(le=y&&h.jsx(fe,{name:"book-open",className:"size-[1.1em] shrink-0"}),e[84]=y,e[85]=le):le=e[85];let Me;e[86]!==o||e[87]!==y?(Me=y?h.jsx("span",{className:Lt,children:y}):o,e[86]=o,e[87]=y,e[88]=Me):Me=e[88];let ge;e[89]!==te||e[90]!==t||e[91]!==i||e[92]!==B||e[93]!==re||e[94]!==G||e[95]!==J||e[96]!==oe||e[97]!==pe||e[98]!==me||e[99]!==ue||e[100]!==ee||e[101]!==le||e[102]!==Me?(ge=h.jsxs("a",{...i,href:t,target:"_blank",rel:"noopener noreferrer",dir:B,className:re,"data-skill-name":G,title:J,"data-openchamber-file-link":oe,"data-openchamber-file-ref":pe,"data-openchamber-file-path":me,onClick:te,onAuxClick:ue,onDragStart:ee,children:[le,Me]}),e[89]=te,e[90]=t,e[91]=i,e[92]=B,e[93]=re,e[94]=G,e[95]=J,e[96]=oe,e[97]=pe,e[98]=me,e[99]=ue,e[100]=ee,e[101]=le,e[102]=Me,e[103]=ge):ge=e[103];let we;e[104]!==c||e[105]!==t||e[106]!==Y||e[107]!==d?(we=Y&&h.jsx(Oe,{label:d("terminalView.preview.openTitle"),children:h.jsx(be,{variant:"ghost",size:"xs",className:"ms-1 align-middle","data-export-ignore":!0,"aria-label":d("terminalView.preview.open"),onClick:()=>de.getState().openContextPreview(c,t),children:h.jsx(fe,{name:"global",className:"size-3.5"})})}),e[104]=c,e[105]=t,e[106]=Y,e[107]=d,e[108]=we):we=e[108];let Ie;return e[109]!==T||e[110]!==ge||e[111]!==we?(Ie=h.jsxs(h.Fragment,{children:[T,ge,we]}),e[109]=T,e[110]=ge,e[111]=we,e[112]=Ie):Ie=e[112],Ie}function xo(n){return n.preventDefault()}function bo(n){return n.openLinksInBrowserPanel}const ko=()=>St(()=>import("./MarkdownDiffPreview-CseaChSt.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199])).then(n=>n.default),vo=()=>{};function So(n){const e=U.c(7),{source:t,incomplete:r}=n;let s;e[0]!==r||e[1]!==t?(s=!r&&!Tr(t),e[0]=r,e[1]=t,e[2]=s):s=e[2];const i=s,a=$r(i,ko,vo);let o;return e[3]!==a||e[4]!==i||e[5]!==t?(o=h.jsx("div",{"data-streamdown":"code-block-body","data-language":"diff",children:i&&a?h.jsx(a,{source:t}):h.jsx(Or,{diff:t})}),e[3]=a,e[4]=i,e[5]=t,e[6]=o):o=e[6],o}const Mo=b.memo(function(e){const t=U.c(5),{tokens:r}=e,s=r.length===0||r.length===1&&r[0].content==="";let i;t[0]!==s||t[1]!==r?(i=s?`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownDiffPreview-Bf9-WPy9.js","assets/vendor-react--VO_rL_p.js","assets/vendor-scheduler-7OC5HNn7.js","assets/useAppFontEffects-3RimJo4B.js","assets/katex.min-Bs5OLoA1.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-zustand-C9tWdk0j.js","assets/vendor-zod--raI7LhK.js","assets/vendor-opencode-client-CeybcDBQ.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/vendor-streamdown-BbSYZ3NF.js","assets/vendor-markdown-BTUqNk6W.js","assets/vendor-mdast-util-from-markdown-CZHjOE75.js","assets/vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js","assets/vendor-micromark-util-decode-string-fHsnqYdj.js","assets/vendor-decode-named-character-reference-C3-224fz.js","assets/vendor-micromark-util-normalize-identifier-C9ANKk3v.js","assets/vendor-micromark-AWM-NZXP.js","assets/vendor-micromark-util-combine-extensions-d8XJZrgA.js","assets/vendor-micromark-util-chunked-DrRIdSP-.js","assets/vendor-micromark-factory-space-PzSHLgmq.js","assets/vendor-micromark-util-character-CW3Cu1MS.js","assets/vendor-micromark-core-commonmark-kzTLNXAm.js","assets/vendor-micromark-util-classify-character-tcLuZZwM.js","assets/vendor-micromark-util-resolve-all-PQCKh0dx.js","assets/vendor-micromark-util-subtokenize-BF1Jf29a.js","assets/vendor-micromark-factory-destination-Sj0xfi0V.js","assets/vendor-micromark-factory-label-amyP0HdC.js","assets/vendor-micromark-factory-title-khnLkZK6.js","assets/vendor-micromark-factory-whitespace-eIB00uTl.js","assets/vendor-micromark-util-html-tag-name-DbKNfynz.js","assets/vendor-unist-util-stringify-position-Ch_qCilz.js","assets/vendor-mdast-util-to-string-C_aolqmU.js","assets/vendor-unist-util-visit-DhPeCsfG.js","assets/vendor-unist-util-visit-parents-DlviEg7Z.js","assets/vendor-unist-util-is-BPZGFiMU.js","assets/vendor-hast-util-raw-DvvLJg15.js","assets/vendor-ungap-structured-clone--gfxRhYI.js","assets/vendor-html-void-elements-CkdplsNl.js","assets/vendor-parse5-DwmzEj2o.js","assets/vendor-entities-wUUgTZDW.js","assets/vendor-web-namespaces-bsVAaBS1.js","assets/vendor-zwitch-C2o2j-tx.js","assets/vendor-unist-util-position-60F3QETU.js","assets/vendor-hast-util-from-parse5-Ba3T6RJI.js","assets/vendor-devlop-0Dp3JUBc.js","assets/vendor-property-information-Boo8Xpef.js","assets/vendor-hastscript-BrPNioaz.js","assets/vendor-comma-separated-tokens-CRUGqg4f.js","assets/vendor-space-separated-tokens-D7QSIrTI.js","assets/vendor-hast-util-parse-selector-TXfch5wI.js","assets/vendor-vfile-location-LfEFwJ2h.js","assets/vendor-hast-util-to-parse5-BoysVIPW.js","assets/vendor-hast-util-sanitize-2aGO5ay8.js","assets/vendor-micromark-extension-gfm-CsfPlnlB.js","assets/vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js","assets/vendor-micromark-extension-gfm-footnote-OFl1FCH2.js","assets/vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js","assets/vendor-micromark-extension-gfm-table-dgw4LfUw.js","assets/vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js","assets/vendor-mdast-util-gfm-CroMDYLM.js","assets/vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js","assets/vendor-ccount-c2V3InAJ.js","assets/vendor-mdast-util-find-and-replace-DB9iC-bx.js","assets/vendor-escape-string-regexp-BaJN9MlJ.js","assets/vendor-mdast-util-gfm-footnote-C-csI7OF.js","assets/vendor-mdast-util-gfm-strikethrough-BcskTdio.js","assets/vendor-mdast-util-gfm-table-DhPwQIyj.js","assets/vendor-markdown-table-DvhhVmnL.js","assets/vendor-mdast-util-to-markdown-Cl3qaiyc.js","assets/vendor-longest-streak-CtXnX3Xp.js","assets/vendor-mdast-util-phrasing-4oVbNLC3.js","assets/vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js","assets/vendor-mdast-util-to-hast-CWnLaQSO.js","assets/vendor-micromark-util-sanitize-uri-BbwQ7CLk.js","assets/vendor-trim-lines-D8znQY54.js","assets/vendor-micromark-extension-cjk-friendly-BzZDGrF5.js","assets/vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js","assets/vendor-get-east-asian-width-CPhS2cOv.js","assets/vendor-micromark-util-symbol-JJPacVTp.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js","assets/vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js","assets/vendor-hast-util-from-html-isomorphic-B0Kn01s9.js","assets/vendor-hast-util-from-dom-DeNf9aYW.js","assets/vendor-katex-DBqql0K7.js","assets/vendor-hast-util-to-text-0GXLnBvt.js","assets/vendor-hast-util-is-element-CuOmiqQi.js","assets/vendor-unist-util-find-after-CMaZmLxc.js","assets/vendor-micromark-extension-math-BRFoDziv.js","assets/vendor-mdast-util-math-wB-IJCL0.js","assets/vendor-remend-r8cP_t-e.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-marked-DN3zOnEe.js","assets/vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js","assets/vendor-style-to-js-CI2G4dgu.js","assets/vendor-style-to-object-BAv4SQXc.js","assets/vendor-inline-style-parser-BlqBsVO4.js","assets/vendor-hast-util-whitespace-D4Wp6AEg.js","assets/vendor-estree-util-is-identifier-name-BgBfM8ME.js","assets/vendor-vfile-message-DqhD22jI.js","assets/vendor-unified-1CQKw2_w.js","assets/vendor-bail-FqpXQuLt.js","assets/vendor-extend-B94qxKr5.js","assets/vendor-is-plain-obj-C1gvLhAf.js","assets/vendor-trough-B_b8ryxu.js","assets/vendor-vfile-BCWrK60u.js","assets/vendor-html-url-attributes-D46m5wfe.js","assets/vendor-capacitor-core-B4EWRrHz.js","assets/katex-7f7Y525Q.css","assets/vendor-base-ui-CqKCZJyd.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-floating-ui-react-dom-Cy8dRGoy.js","assets/vendor-use-sync-external-store-CfLJGVyr.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-dnd-kit-core-Br1Cs7RV.js","assets/vendor-dnd-kit-utilities-DZ9KbT5S.js","assets/vendor-dnd-kit-accessibility-CYclfhtC.js","assets/vendor-dnd-kit-sortable-DpfLEOLv.js","assets/vendor-tanstack-react-virtual-CqfECoM0.js","assets/vendor-tanstack-virtual-core-BdFnkr_2.js","assets/vendor-framer-motion-C_wK4GIM.js","assets/vendor-motion-dom-HXPOMxb7.js","assets/vendor-motion-utils-BGh8QBgx.js","assets/vendor-codemirror-commands-CjjsURR-.js","assets/vendor-codemirror-state-Cd8udR5z.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-codemirror-view-Ciie9ey-.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-codemirror-language-8HZTPOnt.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CZEcqU6G.js","assets/vendor-codemirror-streamparser-CmlTsbN2.js","assets/vendor-codemirror-lang-javascript-DmqaSK_j.js","assets/vendor-lezer-javascript-CWSwshuO.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-BGedy2gC.js","assets/vendor-codemirror-lang-json-DVAYKmoO.js","assets/vendor-lezer-json-Cn1mncjr.js","assets/vendor-codemirror-lang-css-BLpgXfL2.js","assets/vendor-lezer-css-B2Hx_Nps.js","assets/vendor-codemirror-lang-html-S3jxr3Mo.js","assets/vendor-lezer-html-Cr8K5DGw.js","assets/vendor-codemirror-lang-markdown-D1jveRI5.js","assets/vendor-lezer-markdown-TQKzBB8i.js","assets/vendor-codemirror-language-data-DRsX0PKK.js","assets/vendor-codemirror-lang-python-B-5UC9Ui.js","assets/vendor-lezer-python-BUoImtUb.js","assets/vendor-sonner-Dw26OnzC.js","assets/vendor-cmdk-BtSpU-Io.js","assets/vendor-radix-ui-react-dialog-OIW6VLWw.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-D4RvEbuR.js","assets/vendor-radix-ui-react-context-BbFoxCHu.js","assets/vendor-radix-ui-react-id-aGag8i_5.js","assets/vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js","assets/vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js","assets/vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js","assets/vendor-radix-ui-react-primitive-CrN9dRDb.js","assets/vendor-radix-ui-react-slot-BjbalUfz.js","assets/vendor-radix-ui-react-use-callback-ref-CcC_buIU.js","assets/vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js","assets/vendor-radix-ui-react-focus-scope-D1noLHmd.js","assets/vendor-radix-ui-react-portal-BlUEzfrF.js","assets/vendor-radix-ui-react-presence-BGqFfiW4.js","assets/vendor-radix-ui-react-focus-guards-CSS2IbZC.js","assets/vendor-react-remove-scroll-Der_cv-1.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-Clwl9llp.js","assets/vendor-react-style-singleton-D_xJlTqU.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-BdLl6ZIw.js","assets/vendor-use-callback-ref-CXJF1lEr.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-legendapp-list-CEhBoV5L.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/ToolPartDiffPreview-CVy_zn_m.js","assets/PatchDiff-DC4ydsOW.js","assets/parseDiffFromFile-By5H8w4y.js","assets/computeVirtualFileMetrics-DVfKKHny.js","assets/themeResolver-DXizngAV.js","assets/vendor-pierre-theming-D_TRfu0q.js","assets/hastToHtml-BHV14OWE.js","assets/vendor-hast-util-to-html-Jw3IXh58.js","assets/vendor-stringify-entities-CsH1VEn9.js","assets/vendor-character-entities-legacy-BpoLgcEt.js","assets/vendor-character-entities-html4-D7taRCQ7.js","assets/vendor-diff-C3JhlQdm.js","assets/useNextRenderData-CVFf78p9.js","assets/isDiffPlainText-saKoOWJx.js","assets/getFiletypeFromFileName-BgI9McTw.js","assets/pierreDiffTint-CVm_qZm-.js","assets/appThemeRegistry-DYzVI9tX.js","assets/textMateThemeFromAppTheme-CVOJt2hL.js","assets/diffsHighlighter-BsxkaI3Q.js","assets/ReplyCommand-CnDNvFmd.js"])))=>i.map(i=>d[i]);
2
+ import{R as b,f as U,j as h,a as er}from"./vendor-react--VO_rL_p.js";import{ij as fn,ik as tr,il as bt,im as nr,io as rr,ip as sr,iq as ir,ir as or,is as ar,bG as kt,it as lr,iu as cr,iv as dr,iw as ur,ix as fr,iy as At,iz as mr,iA as mn,iB as We,iC as ve,iD as hr,u as Se,iE as hn,iF as pr,Q as nt,B as be,z as gr,I as fe,iG as vt,bm as wr,iH as pn,iI as yr,iJ as gn,A as xr,iK as br,iL as kr,iM as vr,iN as Sr,iO as Mr,iP as Cr,iQ as Er,iR as jr,iS as Rr,iT as Nr,iU as Pr,iV as It,iW as _r,iX as Lt,iY as Ar,cb as Oe,fo as Ir,iZ as Tt,i_ as Lr,i$ as Tr,j0 as $r,an as Or,j1 as Fr,j2 as Dr,ef as zr,j3 as wn,j4 as Wr,j5 as Ur,j6 as Br,b6 as at,a4 as $t,a5 as Ot,a6 as Ft,a7 as Dt,n as Kr,df as Be,j7 as Vr,U as Hr,j8 as zt,j9 as qr,ja as Xr,jb as Te,jc as Zr,jd as Gr,W as Yr,je as Jr,jf as Qr,aO as yn,al as es,am as ts,d2 as ns,jg as rs,jh as ss,ji as is,jj as os,jk as as,ai as ls}from"./useAppFontEffects-3RimJo4B.js";import{o as Wt,X as rt,j as cs,w as He,D as ds,I as us,k as fs,W as ms,L as xn,U as hs}from"./vendor-streamdown-BbSYZ3NF.js";import{aX as ce,bc as Pe,m as ke,ba as ht,j as lt,aZ as bn,c6 as ps,c7 as gs,b2 as ws,c8 as ys,u as de,bz as xs,bu as kn}from"./katex.min-Bs5OLoA1.js";import{B as st}from"./vendor-streamdown-cjk-CeadmtR2.js";import{g as bs}from"./vendor-streamdown-math-SFa9Faw2.js";import{s as vn,o as Sn,c as ks,e as vs}from"./vendor-zod--raI7LhK.js";import{a as Ss}from"./vendor-markdown-BTUqNk6W.js";import{i as Ms,r as Cs,o as Es,M as Mn,b as js,B as Ut,a as Bt,c as Rs}from"./useMarkdownLocalAssets-CH5Ekvbl.js";import{r as Ns}from"./install-request-EHX4ORhb.js";import{t as Kt}from"./contextFileOpenGuard-BC79wuu1.js";import{_ as St}from"./vendor-vite-runtime-DD1OZmLC.js";import{l as Ps,s as _s,C as As}from"./columnWidthMemory-BA6h4J11.js";import{r as Is,a as Ls}from"./vendor-beautiful-mermaid-BFZosqFp.js";import{b as Cn}from"./vendor-shiki-BBVtYVEV.js";import{a as Ts}from"./textMateThemeFromAppTheme-CVOJt2hL.js";import{p as $s,i as Os,a as pt,b as Fs,s as En}from"./vendor-yaml-CE-D_49-.js";const jn=["note","tip","important","warning","caution"],Rn=n=>jn.find(e=>e===n)??null,Ds=/^\[!(note|tip|important|warning|caution)\][\t ]*(?:\r?\n|$)/i;function zs(n){const e=n.children[0];if(e?.type!=="paragraph")return;const t=e.children[0];if(t?.type!=="text")return;const r=Ds.exec(t.value),s=Rn(r?.[1].toLowerCase());if(!r||!s)return;t.value=t.value.slice(r[0].length),t.value||e.children.shift(),e.children[0]?.type==="break"&&e.children.shift(),e.children.length===0&&n.children.shift(),n.data={...n.data,hProperties:{...n.data?.hProperties,dataOcAlert:s}}}function Ws(){return n=>{const e=t=>{if(t.type==="blockquote"&&zs(t),"children"in t)for(const r of t.children)e(r)};e(n)}}function Us(n){return n.type==="root"}const Bs=/^ {0,3}<details(?:\s+(open(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?))?\s*>\s*<summary\s*>([\s\S]*?)<\/summary\s*>/i;function Ze(n,e,t){const r=e.slice(0,t).split(/\r\n|\r|\n/),s=r.length-1,i=r[r.length-1].length;function a(o){if(o.position)for(const l of[o.position.start,o.position.end])l&&(l.line===1&&(l.column+=i),l.line+=s,l.offset!==void 0&&(l.offset+=t));if("children"in o)for(const l of o.children)a(l)}a(n)}const Ks=/^(\s*<h([1-6])(?:\s+[^\s"'<>/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'<>=]+))?)*\s*>)([\s\S]*?)<\/h\2\s*>\s*$/i,Vs=[1,2,3,4,5,6];function Hs(n,e){const t=/(^ {0,3}(`{3,}|~{3,})[^\n]*(?:\n|$))|(`+)|(<\/?details\b[^>]*>)/gim;t.lastIndex=e;let r=1,s;for(;s=t.exec(n);)if(s[2]){const i=s[2],a=new RegExp(`^ {0,3}${i[0]}{${i.length},}[\\t ]*(?:\\r?\\n|$)`,"gm");if(a.lastIndex=t.lastIndex,!a.exec(n))break;t.lastIndex=a.lastIndex}else if(s[3]){const i=/`+/g;i.lastIndex=t.lastIndex;let a;for(;a=i.exec(n);)if(a[0].length===s[3].length){t.lastIndex=i.lastIndex;break}}else if(s[4]){const i=n.lastIndexOf(`
3
+ `,s.index-1)+1,a=n.slice(i,s.index);if(/^(?: {4}|\t| {0,3}>)/.test(a)||/(?:^|[^\\])(?:\\\\)*\\$/.test(a))continue;if(r+=/^<\//.test(s[4])?-1:1,r===0)return{bodyEnd:s.index,end:t.lastIndex}}return{bodyEnd:n.length,end:n.length}}function qs(){const n=t=>{const r=this.parse(t);if(!Us(r))throw new Error("Disclosure parsing requires a Markdown root");return t.startsWith("\uFEFF")&&Ze(r,t,1),r},e=(t,r)=>{if(!("children"in t))return;const s=t.children;if(t.type==="blockquote"){const i=t.position?.start?.offset,a=t.position?.end?.offset;if(i===void 0||a===void 0)return;const o=[];let l="",c=i;for(const f of r.slice(i,a).split(new RegExp("(?<=\\n)"))){const u=/^ {0,3}> ?/.exec(f)?.[0].length??0;for(let p=u;p<f.length;p++)o.push(c+p),l+=f[p];c+=f.length}o.push(a);const d=n(l);e(d,l);const m=f=>{if(f.position)for(const u of[f.position.start,f.position.end]){if(!u||u.offset===void 0)continue;u.offset=o[u.offset]??a;const p=r.slice(0,u.offset).split(/\r\n|\r|\n/);u.line=p.length,u.column=p[p.length-1].length+1}if("children"in f)for(const u of f.children)m(u)};m(d),s.splice(0,s.length,...d.children);return}for(let i=0;i<s.length;i++){const a=s[i];if(a.type!=="html"){e(a,r);continue}const o=a.position?.start?.offset;if(o===void 0)continue;const l=Bs.exec(r.slice(o));if(!l)continue;const c=o+l[0].length,{bodyEnd:d,end:m}=Hs(r,c),f=r.slice(c,d),u=n(f);e(u,f),Ze(u,r,c);const p=/<summary\s*>/i.exec(l[0]),g=o+(p?.index??0)+(p?.[0].length??0),w=l[2]??"",C=Ks.exec(w),y=C?C[3]:w,x=n(y);Ze(x,r,g+(C?.[1].length??0));const v=x.children[0],S=v?.type==="paragraph"?v.children:[{type:"text",value:y}],M=Vs.find(F=>String(F)===C?.[2]),k={type:"ocDisclosureSummary",data:{hName:"summary"},children:M?[{type:"heading",depth:M,children:S}]:S},E={type:"ocDisclosure",data:{hName:"details",hProperties:l[1]?{open:!0}:{}},children:[k,...u.children]};let R=1,N=a.position?.end?.offset??m;for(;i+R<s.length;){const F=s[i+R];if((F.position?.start?.offset??r.length)>=m)break;N=F.position?.end?.offset??m,R++}const P=n(r.slice(m,N));Ze(P,r,m);const _=P.children;s.splice(i,R,E,..._)}};return(t,r)=>e(t,r.toString())}const Xs=function(n,e,t){const r=this.previous===null||this.previous<-2;let s=!1,i=!1;function a(u){return n.enter("ocMath"),n.enter("ocMathMarker"),n.consume(u),o}function o(u){return u!==40&&u!==91||(s=u===91,s&&!r)?t(u):(n.consume(u),n.exit("ocMathMarker"),n.enter("ocMathValue"),l)}function l(u){return u===null?t(u):u===92?n.check(d,m,c)(u):c(u)}function c(u){return i=!0,u!==null&&u<=-3?(n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),l):(n.consume(u),l)}const d={tokenize(u,p,g){return w;function w(x){return u.consume(x),C}function C(x){return!i||x!==(s?93:41)?g(x):(u.consume(x),s?y:p)}function y(x){return x===32||x===9?(u.consume(x),y):x===null||x<0?p(x):g(x)}}};function m(u){return n.exit("ocMathValue"),n.enter("ocMathMarker"),n.consume(u),f}function f(u){return n.consume(u),n.exit("ocMathMarker"),n.exit("ocMath"),e}return a},Zs=function(n,e,t){const r=this.previous,s=this.parser.constructs.text[60];let i="";return a;function a(d){return r!==null&&r>=48&&r<=57?t(d):(n.enter("ocMath"),n.consume(d),o)}function o(d){return d===null||d<0||d===34?t(d):d===60&&s?n.check(s,t,l)(d):d===40&&i.endsWith("]")||!i&&/\s/.test(String.fromCharCode(d))?t(d):d===36?!i||/^\s|\s$/.test(i)||/^[\d.,\s]+$/.test(i)||/^\d[\d.,]*(?:[;:]|\s+(?:and|to)\b)/.test(i)?t(d):(n.consume(d),c):l(d)}function l(d){return d===null?t(d):(i+=String.fromCharCode(d),n.consume(d),o)}function c(d){return d!==null&&d>=48&&d<=57?t(d):(n.exit("ocMath"),e(d))}},Gs={enter:{ocMath(n){const e=this.sliceSerialize(n).startsWith("\\[");this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math",e?"math-display":"math-inline"]},hChildren:[]}},n)}},exit:{ocMath(n){const e=this.sliceSerialize(n),t=e.startsWith("$")?1:2,r=e.slice(t,-t),s=this.stack[this.stack.length-1];s.type==="inlineMath"&&(s.value=r,s.data&&(s.data.hChildren=[{type:"text",value:r}])),this.exit(n)}}};function Ys(n,e){const t=n.position?.start?.offset,r=n.position?.end?.offset;if(t===void 0||r===void 0)return!0;const s=e.slice(t,r);return!s.startsWith("$")||s.startsWith("$$")?!0:!/^[\d.,\s]+$/.test(n.value)&&!/^\s|\s$/.test(n.value)&&!/\d/.test(e.slice(r,r+1))}function Js(){const n=this.data();return(n.micromarkExtensions??=[]).push({text:{92:{name:"ocMath",tokenize:Xs},36:{name:"ocDollarMath",tokenize:Zs}}}),(n.fromMarkdownExtensions??=[]).push(Gs),(e,t)=>{const r=t.toString();function s(i){if(!("children"in i))return;const a=i.children;if(i.type==="link"){const o=a.map(l=>l.type==="inlineMath"||l.type==="math"?r.slice(l.position?.start?.offset,l.position?.end?.offset):l.type==="text"?l.value:"").join("");if(o===i.url){i.children=[{type:"text",value:o}];return}}for(let o=0;o<a.length;o++){const l=a[o];if(l.type==="inlineMath"||l.type==="math"){const c=l.position?.start?.offset,d=l.position?.end?.offset;Ys(l,r)?l.type==="inlineMath"&&r.slice(c,d).startsWith("$$")&&(l.data??={},l.data.hProperties={className:["language-math","math-display"]}):a.splice(o,1,{type:"text",value:r.slice(c,d)})}else s(l)}}s(e)}}const Vt="openchamber://extensions/install?",Nn=n=>{if(!n.toLowerCase().startsWith(Vt))return null;const e=new URLSearchParams(n.slice(Vt.length)),t=e.get("path");if(t)return t.startsWith("/")||/^[a-z]:[\\/]/i.test(t)?{kind:"path",source:t}:null;const r=e.get("url");if(!r)return null;try{return new URL(r).protocol==="https:"?{kind:"url",source:r}:null}catch{return null}},Qs=new Set(["align","alt","checked","colSpan","controls","disabled","height","href","media","open","playsInline","preload","rel","rowSpan","src","srcSet","start","target","title","type","width"]),Ve=vn();function it(n){try{const e=new URL(n);return e.protocol==="file:"&&(!e.hostname||e.hostname==="localhost")}catch{return!1}}function gt(n){return/\s/.test(n)||/^[\s\\]*[/\\]{2}/.test(n)||n.includes("\\")?!1:/^https?:\/\//i.test(n)||!/^[a-z][a-z\d+.-]*:/i.test(n)}function ei(n,e){return n!==n.trim()||/\s/.test(n)?!1:gt(n)||it(n)||fn(n)||/^(?:mailto|tel|sms|callto|cid|xmpp|irc|ircs|news|nntp|feed|webcal):/i.test(n)||!e&&(tr(n)||Nn(n)!==null)}function ti({isVSCode:n}){return(e,t)=>{const r=t.toString();function s(i){const a=[];for(const o of i.children){if(o.type==="doctype")continue;if(o.type!=="element"){a.push(o);continue}if(["script","style","iframe","object","embed","svg","math","form"].includes(o.tagName))continue;const l=o.position?.start?.offset,c=l!==void 0&&r[l]==="<";if(!(o.tagName==="input"&&o.properties.type!=="checkbox")){for(const d of Object.keys(o.properties)){const f=c&&d==="className"&&o.tagName==="code"&&Array.isArray(o.properties.className)&&o.properties.className.every(u=>/^language-[\w#+.-]+$/.test(String(u)))||!c&&(d==="className"&&["code","li","ul","ol","section","h2","a"].includes(o.tagName)||d==="metastring"&&o.tagName==="code"||["id","ariaDescribedBy","ariaLabel","dataFootnoteRef","dataFootnoteBackref","dataFootnotes"].includes(d)||d==="dataOcAlert"&&o.tagName==="blockquote"||d==="dataOcReference"&&o.tagName==="a");!Qs.has(d)&&!f&&delete o.properties[d]}if(o.properties.href!==void 0){const d=Ve.safeParse(o.properties.href);d.success&&ei(d.data,n)?o.properties.dataOcLinkSource=d.data:delete o.properties.href}if(o.tagName==="a"&&(o.properties.href="#oc-link"),o.properties.src!==void 0){const d=Ve.safeParse(o.properties.src);if(d.success){const m=d.data,f=o.tagName==="img"&&/^data:image\/(?:png|jpeg|gif|webp);base64,(?:[a-z\d+/]{4})*(?:[a-z\d+/]{2}==|[a-z\d+/]{3}=)?$/i.test(m);m===m.trim()&&(gt(m)||it(m)||f)?(o.properties.dataOcMediaSource=m,it(m)&&delete o.properties.src):delete o.properties.src}else delete o.properties.src}if(o.tagName==="img"&&(o.properties.src="/__oc_markdown_media__"),o.properties.srcSet!==void 0){const d=Ve.safeParse(o.properties.srcSet);d.success&&d.data.split(",").every(f=>{const[u,p,...g]=f.trim().split(/\s+/);return!!u&&gt(u)&&g.length===0&&(!p||/^(?:\d+w|\d+(?:\.\d+)?x)$/.test(p))})||delete o.properties.srcSet}for(const d of["width","height"])o.properties[d]!==void 0&&!/^\d+(?:\.\d+)?%?$/.test(String(o.properties[d]))&&delete o.properties[d];o.tagName==="video"&&(o.properties.controls=!0,o.properties.playsInline=!0,o.properties.preload="none"),s(o),a.push(o)}}i.children=a}s(e)}}function ni(){return n=>{function e(t){for(const r of t.children)if(r.type==="element"){if(r.tagName==="a"){const s=Ve.safeParse(r.properties.dataOcLinkSource);s.success?r.properties.href=s.data:delete r.properties.href,delete r.properties.dataOcLinkSource}if(r.tagName==="img"){const s=Ve.safeParse(r.properties.dataOcMediaSource);s.success&&!it(s.data)&&!/^data:/i.test(s.data)?r.properties.src=s.data:delete r.properties.src}e(r)}}e(n)}}const Pn={singleTilde:!1},ri=rt.gfm,si=[[ri[0],Pn],...Object.values(rt).filter(n=>n!==rt.gfm)],ii=st.remarkPluginsAfter.at(-1),oi={...st,remarkPluginsAfter:[...st.remarkPluginsAfter.slice(0,-1),[ii,Pn]]};function ai(n=!1){return n?st:oi}const Ht=bs({singleDollarTextMath:!1}),li={...Ht,remarkPlugin:function(){return this.use([Ht.remarkPlugin]),Js.call(this)}},ci={tagNames:["a","abbr","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","mark","ol","p","picture","pre","q","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var","video"],strip:["script","style","iframe","object","embed","svg","math","form"],attributes:{"*":["align","alt","checked","colSpan","height","media","open","rowSpan","start","title","width"],a:["href","id","ariaDescribedBy","ariaLabel","dataFootnoteRef","dataFootnoteBackref","dataOcLinkSource","dataOcReference"],code:[["className",/^language-[\w#+.:-]+$/,"math-inline","math-display"],"metastring"],img:["src","srcSet","alt","dataOcMediaSource"],source:["src","srcSet","type","media","dataOcMediaSource"],video:["src","controls","playsInline","preload","dataOcMediaSource"],input:["type","checked","disabled"],li:[["className","task-list-item"]],ul:[["className","contains-task-list"]],ol:[["className","contains-task-list"]],section:["dataFootnotes",["className","footnotes"]],h2:["id",["className","sr-only"]],blockquote:[["dataOcAlert",...jn]]},protocols:{src:["http","https"]},clobberPrefix:"",required:{input:{type:"checkbox",disabled:!0}}};function di(){return n=>{function e(t){if(!("children"in t)||t.type==="link"||t.type==="linkReference")return;const r=t.children;for(let s=0;s<r.length;s++){const i=r[s];if(i.type!=="text"){e(i);continue}const a=Array.from(i.value.matchAll(/\bopenchamber:\/\/session\/[A-Za-z0-9_-]{1,128}(?:\?message=[A-Za-z0-9_-]{1,128})?/g));if(a.length===0)continue;const o=[];let l=0;for(const c of a)c.index>l&&o.push({type:"text",value:i.value.slice(l,c.index)}),o.push({type:"link",url:c[0],children:[{type:"text",value:c[0]}]}),l=c.index+c[0].length;l<i.value.length&&o.push({type:"text",value:i.value.slice(l)}),r.splice(s,1,...o),s+=o.length-1}}e(n)}}function ui(){return(n,e)=>{const t=String(e.value).replace(/^\uFEFF/,"");n.children=n.children.filter(r=>{const s=r.position?.start.offset,i=r.position?.end.offset;return s===void 0||i===void 0||!bt(t.slice(s,i))})}}function Ge(n,e,t){return{remarkPlugins:[...t?Object.values(rt):si,qs,Ws,ui,di],rehypePlugins:[...n?[Wt.raw]:[],[ti,{isVSCode:e}],[Ss,ci],Wt.harden,ni]}}const fi=[!1,!0].flatMap(n=>[Ge(!1,!1,n),Ge(!1,!0,n),Ge(!0,!1,n),Ge(!0,!0,n)]);function mi(n,e,t=!1){return fi[(t?4:0)+(n?2:0)+(e?1:0)]}const hi=new Set(["inlineCode","code","html","math","inlineMath"]);function pi(n){return e=>{const t=r=>{if(!hi.has(r.type)){if(r.type==="text"){r.value=nr(r.value,n);return}if("children"in r)for(const s of r.children)t(s)}};t(e)}}const gi=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),wi=n=>{const{issuePrefix:e,changeRequestPrefix:t}=n.descriptor.terminology,r=[...new Set([e,t])].sort((s,i)=>i.length-s.length).map(gi).join("|");return new RegExp([String.raw`(?<![\w/#!@&.-])(?<project>[\w.-]+(?:/[\w.-]+)+)?(?<prefix>${r})(?<number>\d+)(?![\w-])`,String.raw`(?<![\w@./+-])@(?<user>[A-Za-z0-9](?:[A-Za-z0-9_.-]*[A-Za-z0-9_])?)(?![\w@/-])`,String.raw`(?<![\w/@#.-])(?<sha>[0-9a-f]{7,40})(?![\w/-])`].join("|"),"g")},yi=(n,e,t)=>{const{issuePrefix:r,changeRequestPrefix:s}=n.descriptor.terminology;if(e.number&&e.prefix){const i=e.prefix===r?"issue":e.prefix===s?"pull":null,a=Number(e.number);if(!i||!Number.isSafeInteger(a)||a<1||e.project&&!n.descriptor.repository.nestedNamespaces&&e.project.split("/").length>2)return null;const o=rr(n,i,a,e.project?sr(e.project):n);return o?{url:o,children:[{type:"text",value:t}]}:null}if(e.user){const i=ir(n,e.user);return i?{url:i,children:[{type:"text",value:t}]}:null}if(e.sha&&/\d/.test(e.sha)&&/[a-f]/.test(e.sha)){const i=or(n,e.sha);return i?{url:i,children:[{type:"inlineCode",value:e.sha.slice(0,7)}]}:null}return null},xi=n=>{let e=0;for(const t of n.matchAll(/<(\/?)(a|code)\b[^>]*?(\/?)>/gi))t[3]||(e+=t[1]?-1:1);return e},bi=new Set(["link","linkReference","inlineCode","code","html","definition","math","inlineMath"]);function ki(n){const e=wi(n),t=r=>{const s=[];let i=0;for(const a of r.matchAll(e)){const o=a.groups?yi(n,a.groups,a[0]):null;if(!o)continue;a.index>i&&s.push({type:"text",value:r.slice(i,a.index)});const l={type:"link",url:o.url,children:o.children,data:{hProperties:{dataOcReference:""}}};s.push(l),i=a.index+a[0].length}return s.length===0?null:(i<r.length&&s.push({type:"text",value:r.slice(i)}),s)};return r=>{const s=i=>{if(bi.has(i.type)||!("children"in i))return;const a=i.children;let o=0;for(let l=0;l<a.length;l++){const c=a[l];if(c.type==="html"){o=Math.max(0,o+xi(c.value));continue}if(o>0)continue;if(c.type!=="text"){s(c);continue}const d=t(c.value);d&&(a.splice(l,1,...d),l+=d.length-1)}};s(r)}}const vi=/^\/api\/source-control\/[^/?#]+\/uploads\/[0-9a-f]{32}\/[^/?#]+\?/,Ye=new Map;class Si{constructor(e){this.options=e}options;controller=new AbortController;disposed=!1;sources=new Map;batch;refreshing;documentUrls=new Map;runtimeKey=ce();resolver=Pe();connect(){!this.disposed&&this.controller.signal.aborted&&(this.controller=new AbortController)}register(e){return this.sources.set(e,(this.sources.get(e)??0)+1),()=>{const t=(this.sources.get(e)??1)-1;t?this.sources.set(e,t):this.sources.delete(e)}}check(e){if(e.aborted||this.disposed||this.runtimeKey!==ce()||this.resolver!==Pe())throw new DOMException("Media owner changed","AbortError")}async resolve(e,t=!1,r=!1){const s=this.controller.signal;this.check(s);const{mode:i,directory:a,sessionId:o,messageId:l,documentAssets:c}=this.options;if(i==="assistant"&&(await Promise.resolve(),this.check(s),![...this.sources.keys()].slice(0,12).includes(e)))throw new Error("Message media limit");if(/^(?:https?:)?\/\//i.test(e)){if(i!=="document"&&!t)throw new Error("Remote chat image");return e}if(/^data:/i.test(e))return ar(e,s);if(i==="document"){if(!c){if(t||!vi.test(e))return e;const w=this.readDocumentImage(e,e,void 0,s);return w.catch(()=>{this.documentUrls.get(e)===w&&this.documentUrls.delete(e)}),w}if(!Ms(e))throw new Error("Document source is unavailable");const u=Cs(c.filePath,e),p=c.workspaceRoot,g={path:u,directory:p||void 0,allowOutsideWorkspace:p&&kt(u,p)?void 0:"true"};if(t){if(ke())throw new Error("Video bridge is unavailable");return await ht(),this.check(s),Pe().authenticatedAsset("/api/fs/raw",g)}return this.readDocumentImage(u,"/api/fs/raw",g,s)}if(i==="local")return e;if(ke()){if(t)throw new Error("Video bridge is unavailable");const u=await lr(e,a,s);return this.check(s),u}if(!o||!l)throw new Error("Missing media owner");await Promise.resolve(),this.check(s);const m=[...this.sources.keys()].slice(0,12);if(!m.includes(e))throw new Error("Message media limit");if(!this.batch||r){if(r&&this.refreshing)this.batch=this.refreshing;else if(this.batch=cr({sources:m.filter(At),directory:a,sessionId:o,messageId:l,signal:s}),r){const u=this.batch;this.refreshing=u,u.finally(()=>{this.refreshing===u&&(this.refreshing=void 0)}).catch(()=>{})}}const f=(await this.batch).get(e);if(this.check(s),f?.status!=="ready")throw new Error("Image is unavailable");if(!t&&dr()){const u=await ur(f,a,s);return this.check(s),u}return await ht(),this.check(s),fr(f,a)}readDocumentImage(e,t,r,s){const i=this.documentUrls.get(e);if(i)return i;const a=(async()=>{const o=await lt(t,{query:r,signal:AbortSignal.any([s,AbortSignal.timeout(3e4)])});if(!o.ok)throw new Error(`Image read failed (${o.status})`);const l=await o.blob();if(l.size>25*1024*1024)throw new Error("Image too large for preview");return this.check(s),URL.createObjectURL(l)})();return this.documentUrls.set(e,a),a}async load(e){const t=this.controller.signal,{mode:r,directory:s,sessionId:i,messageId:a}=this.options;if(r==="assistant"&&!ke()&&At(e)){if(!i||!a)throw new Error("Missing media owner");return mr({source:e,directory:s,sessionId:i,messageId:a,signal:t})}const o=await this.resolve(e);if(!/^(?:data|blob):/i.test(o))throw new Error("Image cannot be saved");return(await fetch(o,{signal:t})).blob()}addGallery(e){const t=`${this.runtimeKey}\0${this.options.sessionId??""}\0${this.options.messageId??""}`;let r=Ye.get(t);return r||(r=new Set,Ye.set(t,r)),r.add(e),()=>{r.delete(e),r.size||Ye.delete(t)}}async openGallery(e,t){const r=this.controller.signal;this.check(r);const s=`${this.runtimeKey}\0${this.options.sessionId??""}\0${this.options.messageId??""}`,i=[...Ye.get(s)??[]].filter(d=>d.element.isConnected).sort((d,m)=>d.element.compareDocumentPosition(m.element)&4?-1:1),a=await Promise.allSettled(i.map(d=>d.resolve()));this.check(r);const o=i.flatMap((d,m)=>{const f=a[m];return f?.status==="fulfilled"?[{url:f.value,filename:d.filename,element:d.element,load:d.load}]:[]}),l=o.findIndex(d=>d.element===e),c=o[l];c&&t({open:!0,title:c.filename,content:"",metadata:{tool:"markdown-image-preview",filename:c.filename},image:{url:c.url,filename:c.filename,load:c.load,gallery:o.map(({url:d,filename:m,load:f})=>({url:d,filename:m,load:f})),index:l}})}disconnect(){this.controller.abort();for(const e of this.documentUrls.values())e.then(t=>URL.revokeObjectURL(t),()=>{});this.documentUrls.clear(),this.batch=void 0,this.refreshing=void 0}dispose(){this.disposed=!0,this.disconnect()}}const _n=b.createContext(null),Ue=b.createContext(!1),he=()=>b.useContext(_n);function Mi(n){const e=U.c(23),{content:t,mode:r,sessionId:s,messageId:i,directory:a,settled:o,documentAssets:l,onShowPopup:c,children:d}=n,[m,f]=b.useReducer(Ci,0);let u,p;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=()=>bn(()=>f()),p=[],e[0]=u,e[1]=p):(u=e[0],p=e[1]),b.useEffect(u,p);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=ce(),e[2]=g):g=e[2];const w=g;let C;e[3]===Symbol.for("react.memo_cache_sentinel")?(C=Pe(),e[3]=C):C=e[3];const y=C,x=l?.filePath,v=l?.workspaceRoot;let S;e[4]!==a||e[5]!==x||e[6]!==i||e[7]!==r||e[8]!==s||e[9]!==v?(S=new Si({mode:r,directory:a,sessionId:s,messageId:i,documentAssets:x?{filePath:x,workspaceRoot:v??null}:void 0}),e[4]=a,e[5]=x,e[6]=i,e[7]=r,e[8]=s,e[9]=v,e[10]=S):S=e[10];const M=S;let k,E;e[11]!==M?(k=()=>{if(w!==ce()||y!==Pe()){M.dispose(),f();return}M.connect();const _=ps(()=>M.dispose());return()=>{_(),M.disconnect()}},E=[M,y,w],e[11]=M,e[12]=k,e[13]=E):(k=e[12],E=e[13]),b.useLayoutEffect(k,E);let R;e[14]!==l||e[15]!==r||e[16]!==c||e[17]!==M||e[18]!==o?(R={owner:M,mode:r,settled:o,documentAssets:l,onShowPopup:c},e[14]=l,e[15]=r,e[16]=c,e[17]=M,e[18]=o,e[19]=R):R=e[19];const N=R;let P;return e[20]!==d||e[21]!==N?(P=h.jsx(_n.Provider,{value:N,children:d}),e[20]=d,e[21]=N,e[22]=P):P=e[22],P}function Ci(n){return n+1}const Mt=b.createContext(null);function ie(){const n=b.useContext(Mt);if(!n)throw new Error("Markdown components require MarkdownContent");return n}const Ct=n=>/^(?:https?:)?\/\//i.test(n),An=n=>n==="streamdown:incomplete-image",In=(n,e)=>n["data-oc-media-source"]??e??"",Ln=b.createContext(null),Ei=n=>{const e=n.ownerDocument.defaultView;for(let t=n.parentElement;t&&e;t=t.parentElement)if(t.scrollHeight>t.clientHeight&&/auto|scroll/.test(e.getComputedStyle(t).overflowY))return t;return null};function Et(n,e){const t=U.c(7),r=e===void 0?!1:e,s=b.useRef(null);let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=u=>{s.current=u},t[0]=i):i=t[0];const a=i,[o,l]=b.useState(!1);let c,d;t[1]!==n||t[2]!==r?(c=()=>{if(!n||!s.current)return;const u=s.current.ownerDocument.defaultView?.IntersectionObserver;if(!u){l(!0);return}const p=new u(g=>{g.some(ji)&&(l(!0),p.disconnect())},r?{root:Ei(s.current),rootMargin:"100% 0px"}:{rootMargin:"200px"});return p.observe(s.current),()=>p.disconnect()},d=[n,r],t[1]=n,t[2]=r,t[3]=c,t[4]=d):(c=t[3],d=t[4]),b.useEffect(c,d);const m=!n||o;let f;return t[5]!==m?(f={ref:s,setRef:a,near:m},t[5]=m,t[6]=f):f=t[6],f}function ji(n){return n.isIntersecting}function Ri(n){const e=U.c(4);let t;e[0]!==n?(t=i=>{if(!n)return Pi;const a=window.matchMedia(n);return a.addEventListener("change",i),()=>a.removeEventListener("change",i)},e[0]=n,e[1]=t):t=e[1];const r=t;let s;return e[2]!==n?(s=()=>!n||window.matchMedia(n).matches,e[2]=n,e[3]=s):s=e[3],b.useSyncExternalStore(r,s,Ni)}function Ni(){return!0}function Pi(){}const jt=b.createContext(null);function qe(n){const e=U.c(23),{source:t,name:r,title:s,linked:i,state:a}=n,{t:o}=Se(),l=b.useContext(Mt),c=he(),d=hn(l?.directory??c?.owner?.options.directory??"");let m;e[0]!==a||e[1]!==o||e[2]!==s?(m=a==="failed"?o("common.image.loadFailed"):s,e[0]=a,e[1]=o,e[2]=s,e[3]=m):m=e[3];let f;e[4]!==t?(f=ve(t),e[4]=t,e[5]=f):f=e[5];let u;e[6]!==a?(u=a==="loading"?h.jsx(gr,{className:"size-3.5","aria-hidden":!0}):h.jsx(fe,{name:a==="failed"?"error-warning":"file-image",className:"size-3.5 shrink-0"}),e[6]=a,e[7]=u):u=e[7];let p;e[8]!==r||e[9]!==a||e[10]!==m||e[11]!==f||e[12]!==u?(p=h.jsxs("span",{title:m,"data-oc-media-source":f,"data-oc-media-label":"true","data-oc-media-state":a,className:"inline-flex items-center gap-1 align-text-bottom text-muted-foreground",children:[u,r]}),e[8]=r,e[9]=a,e[10]=m,e[11]=f,e[12]=u,e[13]=p):p=e[13];const g=p;if(!Ct(t)||i||pr(t))return g;let w;e[14]!==d||e[15]!==l?.disableLinkSafety||e[16]!==l?.purpose||e[17]!==t?(w=y=>{l?.purpose||l?.disableLinkSafety||y.metaKey||y.ctrlKey||y.shiftKey||y.altKey||(y.preventDefault(),y.stopPropagation(),d(t))},e[14]=d,e[15]=l?.disableLinkSafety,e[16]=l?.purpose,e[17]=t,e[18]=w):w=e[18];let C;return e[19]!==g||e[20]!==t||e[21]!==w?(C=h.jsx("a",{href:t,className:"external-link",target:"_blank",rel:"noopener noreferrer",onClick:w,children:g}),e[19]=g,e[20]=t,e[21]=w,e[22]=C):C=e[22],C}function Tn(n,e,t){const r=U.c(22),s=t===void 0?!1:t,i=he(),a=i?.owner,[o,l]=b.useState(null),[c,d]=b.useState(null);let m;r[0]!==i?.mode?(m=()=>{i?.mode==="document"&&l(_i)},r[0]=i?.mode,r[1]=m):m=r[1];const f=i?.mode;let u;r[2]!==f?(u=[f],r[2]=f,r[3]=u):u=r[3],b.useLayoutEffect(m,u);let p,g;r[4]!==e||r[5]!==a||r[6]!==n||r[7]!==s?(p=()=>{if(!a||!n||!e)return;const S=a.controller.signal;let M=!1;return a.resolve(n,s).then(k=>{!M&&!S.aborted&&(d(null),l({owner:a,signal:S,source:n,url:k}))},()=>{!M&&!S.aborted&&d({owner:a,signal:S,source:n,url:""})}),()=>{M=!0}},g=[a,n,e,s],r[4]=e,r[5]=a,r[6]=n,r[7]=s,r[8]=p,r[9]=g):(p=r[8],g=r[9]),b.useEffect(p,g);const w=c?.owner===a&&c?.source===n,C=o&&o.owner===a&&o.source===n&&(i?.mode!=="document"||!o.signal.aborted)&&!w?o.url:void 0;let y;r[10]!==a||r[11]!==n?(y=()=>{a&&d({owner:a,signal:a.controller.signal,source:n,url:""})},r[10]=a,r[11]=n,r[12]=y):y=r[12];let x;r[13]!==a||r[14]!==n||r[15]!==s?(x=async()=>{if(!a)throw new Error("Missing media owner");const S=a.controller.signal,M=await a.resolve(n,s,!0);S.aborted||(d(null),l({owner:a,signal:S,source:n,url:M}))},r[13]=a,r[14]=n,r[15]=s,r[16]=x):x=r[16];let v;return r[17]!==w||r[18]!==C||r[19]!==y||r[20]!==x?(v={url:C,failed:w,fail:y,retry:x},r[17]=w,r[18]=C,r[19]=y,r[20]=x,r[21]=v):v=r[21],v}function _i(n){return n?.signal.aborted?null:n}const Ai=(n,e)=>{const t=e===void 0?"":String(e).trim(),r=n===void 0?"":String(n).trim();return/^\d+$/.test(t)?/^\d+$/.test(r)&&Number(t)>0?{aspectRatio:`${r}/${t}`}:{height:`${t}px`}:{}};function Ii(n){const e=U.c(9),t=In(n,n.src),r=he(),s=b.useContext(Ue);if(An(t))return null;if(!s&&hr(t,n.alt??""))return h.jsx(Rt,{src:t,title:n.title||n.alt,node:n.node});if(!t){let a;return e[0]!==r?.mode||e[1]!==n.alt||e[2]!==n.height||e[3]!==n.title||e[4]!==n.width?(a=r?.mode==="document"?h.jsx("img",{alt:n.alt,title:n.title,width:n.width,height:n.height}):null,e[0]=r?.mode,e[1]=n.alt,e[2]=n.height,e[3]=n.title,e[4]=n.width,e[5]=a):a=e[5],a}if(r?.mode!=="document"&&(Ct(t)||s))return h.jsx(qe,{source:t,name:We(t,n.alt),title:n.title,linked:s});let i;return e[6]!==n||e[7]!==t?(i=h.jsx(Li,{...n,source:t}),e[6]=n,e[7]=t,e[8]=i):i=e[8],i}function Li(n){const e=U.c(92);let t,r,s,i,a,o,l,c,d,m,f;if(e[0]!==n){const{source:ee,node:le,src:Me,srcSet:ge,alt:we,title:Ie,className:$,style:se,width:ae,height:Le,onLoad:Ce,onError:ye,...xe}=n;o=ee,l=ge,d=we,m=Ie,t=$,c=se,f=ae,r=Le,i=Ce,s=ye,a=xe,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i,e[5]=a,e[6]=o,e[7]=l,e[8]=c,e[9]=d,e[10]=m,e[11]=f}else t=e[1],r=e[2],s=e[3],i=e[4],a=e[5],o=e[6],l=e[7],c=e[8],d=e[9],m=e[10],f=e[11];const u=d===void 0?"":d,p=he(),g=b.useContext(Ue),w=b.useContext(Ln),C=w?.report,y=b.useId();let x;e[12]!==u||e[13]!==o?(x=We(o,u),e[12]=u,e[13]=o,e[14]=x):x=e[14];const v=x,S=p?.mode==="assistant",M=p?.mode==="document",k=b.useContext(jt),{ref:E,setRef:R,near:N}=Et(S||M&&k===null,M),P=k??N,_=p?.owner,F=S&&!!p?.onShowPopup&&!g;let j,A;e[15]!==_||e[16]!==o?(j=()=>_?.register(o),A=[_,o],e[15]=_,e[16]=o,e[17]=j,e[18]=A):(j=e[17],A=e[18]),b.useEffect(j,A);const D=!!(p&&P&&(!S||p.settled)),{url:L,failed:I,fail:K}=Tn(o,D),W=$n(l,D),[q,V]=b.useState(null),O=!!(L&&q?.url===L),z=q&&q.url===L?q.size:void 0;let X,H;e[19]!==O||e[20]!==y||e[21]!==C||e[22]!==z?(X=()=>(C?.(y,O&&z?z:null),()=>C?.(y,null)),H=[C,y,O,z],e[19]=O,e[20]=y,e[21]=C,e[22]=z,e[23]=X,e[24]=H):(X=e[23],H=e[24]),b.useEffect(X,H);let Z,Y;e[25]!==O||e[26]!==F||e[27]!==v||e[28]!==_||e[29]!==E||e[30]!==o||e[31]!==L?(Z=()=>{const ee=E.current;if(!(!_||!O||!ee||!F))return _.addGallery({source:o,filename:v,element:ee,resolve:()=>L?.startsWith("data:")?Promise.resolve(L):_.resolve(o,!1,!0),load:()=>_.load(o)})},Y=[_,O,o,v,E,F,L],e[25]=O,e[26]=F,e[27]=v,e[28]=_,e[29]=E,e[30]=o,e[31]=L,e[32]=Z,e[33]=Y):(Z=e[32],Y=e[33]),b.useEffect(Z,Y);let Q;e[34]!==u||e[35]!==t||e[36]!==M||e[37]!==O||e[38]!==K||e[39]!==r||e[40]!==v||e[41]!==s||e[42]!==i||e[43]!==a||e[44]!==W||e[45]!==w?.ready||e[46]!==R||e[47]!==o||e[48]!==l||e[49]!==c||e[50]!==m||e[51]!==L||e[52]!==f?(Q=L||M?h.jsx("img",{...a,ref:M?R:void 0,src:L,srcSet:W,alt:u||v,title:m,width:f,height:r,className:nt(M?t:"block h-auto max-h-[30rem] w-auto max-w-full object-contain",M?!L&&"invisible":!O&&"hidden"),style:M?{...c,...Ai(f,r)}:{...c,width:w?.ready?"100%":c?.width},"data-oc-media-source":ve(o),"data-oc-media-srcset":l,decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:ee=>{const le=ee.currentTarget;L&&le.naturalWidth&&le.naturalHeight&&V({url:L,size:{width:le.naturalWidth,height:le.naturalHeight}}),i?.(ee)},onError:ee=>{K(),s?.(ee)}}):null,e[34]=u,e[35]=t,e[36]=M,e[37]=O,e[38]=K,e[39]=r,e[40]=v,e[41]=s,e[42]=i,e[43]=a,e[44]=W,e[45]=w?.ready,e[46]=R,e[47]=o,e[48]=l,e[49]=c,e[50]=m,e[51]=L,e[52]=f,e[53]=Q):Q=e[53];const te=Q,T=z?z.width/z.height:1;let B;e[54]!==T||e[55]!==w?.ready||e[56]!==z?(B=w?.ready&&z?{flex:`${T} 1 0px`,minWidth:`${8*T}rem`,maxWidth:`min(${z.width}px, ${30*T}rem)`,margin:0}:void 0,e[54]=T,e[55]=w?.ready,e[56]=z,e[57]=B):B=e[57];const re=B;if(M){let ee;return e[58]!==I||e[59]!==te||e[60]!==g||e[61]!==v||e[62]!==o||e[63]!==m?(ee=I?h.jsx(qe,{source:o,name:v,title:m,linked:g,state:"failed"}):te,e[58]=I,e[59]=te,e[60]=g,e[61]=v,e[62]=o,e[63]=m,e[64]=ee):ee=e[64],ee}const G=O?"inline-block max-w-[min(100%,30rem)] align-top my-1 me-1":void 0;let J;e[65]!==o?(J=ve(o),e[65]=o,e[66]=J):J=e[66];let oe;e[67]!==D||e[68]!==O||e[69]!==I||e[70]!==g||e[71]!==v||e[72]!==o||e[73]!==m?(oe=!O&&h.jsx(qe,{source:o,name:v,title:m,linked:g,state:I?"failed":D?"loading":void 0}),e[67]=D,e[68]=O,e[69]=I,e[70]=g,e[71]=v,e[72]=o,e[73]=m,e[74]=oe):oe=e[74];const pe=L&&!F&&te;let me;e[75]!==p||e[76]!==O||e[77]!==F||e[78]!==te||e[79]!==v||e[80]!==_||e[81]!==E||e[82]!==L?(me=L&&F&&h.jsx(be,{variant:"ghost",className:nt("block h-auto max-w-full overflow-hidden rounded-lg bg-muted/10 p-0 cursor-zoom-in",!O&&"hidden"),"aria-label":v,"data-oc-media-gallery":"true",onClick:()=>{const ee=E.current;ee&&p?.onShowPopup&&_?.openGallery(ee,p.onShowPopup).catch(Ti)},children:te}),e[75]=p,e[76]=O,e[77]=F,e[78]=te,e[79]=v,e[80]=_,e[81]=E,e[82]=L,e[83]=me):me=e[83];let ue;return e[84]!==re||e[85]!==R||e[86]!==G||e[87]!==J||e[88]!==oe||e[89]!==pe||e[90]!==me?(ue=h.jsxs("span",{ref:R,className:G,style:re,"data-oc-media-source":J,children:[oe,pe,me]}),e[84]=re,e[85]=R,e[86]=G,e[87]=J,e[88]=oe,e[89]=pe,e[90]=me,e[91]=ue):ue=e[91],ue}function Ti(){}function $n(n,e){const t=U.c(12),r=he(),s=r?.owner,[i,a]=b.useState(null);let o,l;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(Fi)},l=[],t[0]=o,t[1]=l):(o=t[0],l=t[1]),b.useLayoutEffect(o,l);let c;t[2]!==e||t[3]!==r?.mode||t[4]!==s||t[5]!==n?(c=()=>{if(!n||!s||!e||r?.mode!=="document")return;const f=s.controller.signal;let u=!1;const p=n.split(",").flatMap(Oi);return Promise.all(p.map(async g=>{const{source:w,descriptor:C}=g,y=await s.resolve(w);return C?`${y} ${C}`:y})).then(g=>{!u&&!f.aborted&&a({owner:s,signal:f,source:n,value:g.join(", ")})},$i),()=>{u=!0}},t[2]=e,t[3]=r?.mode,t[4]=s,t[5]=n,t[6]=c):c=t[6];const d=r?.mode;let m;return t[7]!==e||t[8]!==s||t[9]!==n||t[10]!==d?(m=[s,d,n,e],t[7]=e,t[8]=s,t[9]=n,t[10]=d,t[11]=m):m=t[11],b.useEffect(c,m),i&&i.owner===s&&!i.signal.aborted&&i.source===n?i.value:void 0}function $i(){}function Oi(n){const[e,...t]=n.trim().split(/\s+/);return e?[{source:e,descriptor:t.join(" ")}]:[]}function Fi(n){return n?.signal.aborted?null:n}function Di(n){const e=U.c(10);let t,r;if(e[0]!==n){const{node:d,children:m,...f}=n;t=m,r=f,e[0]=n,e[1]=t,e[2]=r}else t=e[1],r=e[2];const s=he()?.mode==="document",{setRef:i,near:a}=Et(s,!0),o=s?a:null;let l;e[3]!==t||e[4]!==o?(l=h.jsx(jt.Provider,{value:o,children:t}),e[3]=t,e[4]=o,e[5]=l):l=e[5];let c;return e[6]!==r||e[7]!==i||e[8]!==l?(c=h.jsx("picture",{...r,ref:i,children:l}),e[6]=r,e[7]=i,e[8]=l,e[9]=c):c=e[9],c}function zi(n){const e=U.c(13);let t,r,s;if(e[0]!==n){const{node:u,srcSet:p,media:g,...w}=n;s=p,t=g,r=w,e[0]=n,e[1]=t,e[2]=r,e[3]=s}else t=e[1],r=e[2],s=e[3];const i=he(),a=b.useContext(jt),o=i?.documentAssets?.colorScheme;let l;e[4]!==t||e[5]!==o?(l=o?t?.replace(/\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)/gi,(u,p)=>p.toLowerCase()===o?"(min-width: 0px)":"(max-width: -1px)"):t,e[4]=t,e[5]=o,e[6]=l):l=e[6];const c=l,d=Ri(i?.mode==="document"?c:void 0),m=$n(s,i?.mode==="document"&&a!==!1&&d);if(i?.mode!=="document")return null;let f;return e[7]!==t||e[8]!==r||e[9]!==m||e[10]!==s||e[11]!==c?(f=h.jsx("source",{...r,srcSet:m,media:c,"data-oc-media-srcset":s,"data-oc-media-query":t}),e[7]=t,e[8]=r,e[9]=m,e[10]=s,e[11]=c,e[12]=f):f=e[12],f}function Rt(n){const e=In(n,n.src),t=he(),r=t?.owner,s=b.useContext(Ue),i=Ct(e),{setRef:a,near:o}=Et(t?.mode==="assistant"&&!i);b.useEffect(()=>i?void 0:r?.register(e),[r,e,i]);const{url:l,fail:c,retry:d}=Tn(e,!!(t&&!i&&!s&&(t.mode!=="assistant"||t.settled&&o)),!0),[m,f]=b.useState(null),u=m?.owner===r&&m?.source===e?m:null,p=b.useMemo(()=>({lastRetry:0,resume:null}),[r,e]),g=b.useRef(p);g.current=p;const w=b.useRef(null),C=n.title||We(e),y=i?u?.failed?void 0:u?.url??e:l,x=!!(y&&(i||t?.mode!=="assistant"||u?.ready===y));return!e||An(e)?null:s?h.jsx(qe,{source:e,name:C,linked:!0}):h.jsxs("span",{ref:a,className:"inline-block max-w-full align-top","data-oc-media-source":ve(e),children:[!x&&h.jsx(qe,{source:e,name:C,linked:!1}),y&&h.jsx("video",{ref:w,src:y,title:C,controls:!0,playsInline:!0,hidden:!x,preload:i&&t?.mode!=="document"?"none":"metadata",className:n.className,"data-oc-media-source":ve(e),onLoadedMetadata:v=>{f({owner:r,source:e,url:u?.url,ready:y});const S=p.resume;S&&(v.currentTarget.currentTime=S.time,S.playing&&v.currentTarget.play().catch(()=>{}),p.resume=null),n.onLoadedMetadata?.(v)},onError:v=>{if(i){const M=Pe(),k=new URL(e,window.location.href),E=new URL(M.api("/api/fs/raw"),window.location.href);if(!(k.origin===E.origin&&k.pathname===E.pathname&&k.searchParams.has("oc_url_token"))||Date.now()-p.lastRetry<1e4){f({owner:r,source:e,failed:!0});return}p.lastRetry=Date.now(),p.resume={time:v.currentTarget.currentTime,playing:!v.currentTarget.paused};const N=r?.controller.signal;k.searchParams.delete("oc_url_token"),ht().then(()=>{N?.aborted||g.current!==p||M!==Pe()||f({owner:r,source:e,url:M.authenticatedAsset("/api/fs/raw",k.searchParams)})},()=>{!N?.aborted&&g.current===p&&f({owner:r,source:e,failed:!0})});return}if(Date.now()-p.lastRetry<1e4){c();return}p.lastRetry=Date.now(),p.resume={time:v.currentTarget.currentTime,playing:!v.currentTarget.paused};const S=r?.controller.signal;d().then(()=>{!S?.aborted&&g.current===p&&w.current?.load()},()=>{!S?.aborted&&g.current===p&&c()})}})]})}function Wi(n){const e=U.c(32);let t,r,s;e[0]!==n?({node:r,children:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=new Map,e[4]=i):i=e[4];const[a,o]=b.useState(i);let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=(P,_)=>{o(F=>{if(F.get(P)===_||!_&&!F.has(P))return F;const j=new Map(F);return _?j.set(P,_):j.delete(P),j})},e[5]=l):l=e[5];const c=l,d=r?.children.filter(Vi),m=d?.length===1?d[0]:void 0,f=m?.type==="element"&&m.tagName==="a"?m.properties.href:void 0,u=m?.type==="element"&&m.children.length===1&&m.children[0]?.type==="text"?m.children[0].value:"",p=d?.length??0,g=p>1&&d?.every(Ki),w=he()?.mode,C=!!(w==="assistant"&&g&&a.size===p);let y;e[6]!==C?(y={report:c,ready:C},e[6]=C,e[7]=y):y=e[7];const x=y;if(w==="document"&&u&&u===f&&mn(u)){let P;e[8]!==u?(P=h.jsx(Rt,{src:u}),e[8]=u,e[9]=P):P=e[9];let _;return e[10]!==s||e[11]!==P?(_=h.jsx("p",{...s,"data-streamdown":"paragraph",children:P}),e[10]=s,e[11]=P,e[12]=_):_=e[12],_}let v,S;e[13]!==a?(v=[...a.values()],S=v.reduce(Bi,0),e[13]=a,e[14]=v,e[15]=S):(v=e[14],S=e[15]);const M=S;let k;if(e[16]!==p||e[17]!==v||e[18]!==s.style||e[19]!==M||e[20]!==C){if(k={...s.style},C){k.display="flex",k.flexWrap="wrap",k.alignItems="flex-start",k.gap="0.5rem";let P;e[22]!==v?(P=v.map(Ui),e[22]=v,e[23]=P):P=e[23],k.maxWidth=`calc(min(30rem, ${Math.min(...P)}px) * ${M} + ${(p-1)*.5}rem)`}e[16]=p,e[17]=v,e[18]=s.style,e[19]=M,e[20]=C,e[21]=k}else k=e[21];const E=C?"true":void 0;let R;e[24]!==t||e[25]!==k||e[26]!==s||e[27]!==E?(R=h.jsx("p",{...s,"data-streamdown":"paragraph","data-oc-media-row":E,style:k,children:t}),e[24]=t,e[25]=k,e[26]=s,e[27]=E,e[28]=R):R=e[28];let N;return e[29]!==R||e[30]!==x?(N=h.jsx(Ln.Provider,{value:x,children:R}),e[29]=R,e[30]=x,e[31]=N):N=e[31],N}function Ui(n){return n.height}function Bi(n,e){return n+e.width/e.height}function Ki(n){return n.type==="element"&&n.tagName==="img"}function Vi(n){return n.type!=="text"||n.value.trim()}const Hi=new Set(["dockerfile","makefile","readme","license",".env",".gitignore",".npmrc"]),qt=Array.from(Hi).map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),qi=n=>vt(n),On=n=>{let e;try{e=new URL(n.trim())}catch{return null}if(e.protocol!=="file:"||e.hostname&&e.hostname!=="localhost")return null;try{const t=decodeURIComponent(e.pathname);return/^\/[A-Za-z]:\//.test(t)?t.slice(1):t.startsWith("/")?t:null}catch{return null}},ot=n=>{let e=(n||"").trim();return e?((e.startsWith("`")&&e.endsWith("`")||e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1).trim()),e=e.replace(/[.,;!?]+$/g,""),e.endsWith(")")&&!e.includes("(")&&(e=e.slice(0,-1)),e.endsWith("]")&&!e.includes("[")&&(e=e.slice(0,-1)),e):""},Je=n=>{let e=ot(n);if(!e)return"";const t=e.indexOf(";");t>=0&&(e=e.slice(0,t)),e=e.replace(/#.*$/,"");const r=e.match(/^(.*\.[A-Za-z0-9_-]{1,16}):.*$/);r&&(e=r[1]??e);const s=qt.length>0?e.match(new RegExp(`^(.*(?:/|^)(${qt})):.*$`,"i")):null;return s&&(e=s[1]??e),ot(e)},Xi=n=>{const e=ot(n);if(!e)return null;const t=e.indexOf(";"),r=t>=0?ot(e.slice(0,t)):e;if(!r)return null;const s=r.match(/^(.*?):(\d+)-(\d+)$/);if(s){const l=Je(s[1]??""),c=Number.parseInt(s[2]??"",10),d=Number.parseInt(s[3]??"",10);return!l||!Number.isFinite(c)||!Number.isFinite(d)||d<c?null:{path:l,line:c,endLine:d}}const i=r.match(/^(.*)#L(\d+)(?:C(\d+))?$/i);if(i){const l=Je(i[1]??""),c=Number.parseInt(i[2]??"",10),d=i[3]?Number.parseInt(i[3],10):void 0;return!l||!Number.isFinite(c)?null:{path:l,line:c,column:Number.isFinite(d??Number.NaN)?d:void 0}}const a=r.match(/^(.*?):(\d+)(?::(\d+))?$/);if(a){const l=Je(a[1]??""),c=Number.parseInt(a[2]??"",10),d=a[3]?Number.parseInt(a[3],10):void 0;return!l||!Number.isFinite(c)?null:{path:l,line:c,column:Number.isFinite(d??Number.NaN)?d:void 0}}const o=Je(r);return o?{path:o}:null},Zi=/(?:[A-Za-z]:[\\/])?[\w.\-/@+]*[\w\-/@+]\.[A-Za-z0-9]{1,8}(?::\d+(?:-\d+)?(?::\d+)?)?/g,Gi=4,Yi=1e3,Ji=200,Ee=new Map;let Qe=0;const Xt=[],Qi=()=>ke()?Ji:Yi,Fn=(n,e)=>`${n}\0${e}`,eo=(n,e)=>{const t=vt(n,{preserveWhitespace:!0});if(!t)return Promise.resolve(!1);const r=Fn(e,t),s=Ee.get(r);if(s)return Ee.delete(r),Ee.set(r,s),s;const i=new Promise(o=>{const l=()=>{Qe+=1,lt(`/api/fs/stat?path=${encodeURIComponent(t)}&optional=true`,{method:"GET",cache:"no-store",headers:e?{"x-opencode-directory":e}:void 0}).then(async c=>{if(!c.ok){o(!1);return}const d=await c.json().catch(()=>null);o(d?.exists!==!1)}).catch(()=>o(!1)).finally(()=>{Qe=Math.max(0,Qe-1),Xt.shift()?.()})};if(Qe<Gi){l();return}Xt.push(l)}),a=Qi();for(;Ee.size>=a;){const o=Ee.keys().next().value;if(typeof o!="string")break;Ee.delete(o)}return Ee.set(r,i),i},to=Sn({exists:vs().optional()}),no=async(n,e)=>{const t=new URLSearchParams({path:vt(n,{preserveWhitespace:!0}),optional:"true"});kt(n,e)||t.set("allowOutsideWorkspace","true");try{const r=await lt(`/api/fs/stat?${t.toString()}`,{method:"GET",cache:"no-store",headers:{"x-opencode-directory":e}});if(!r.ok)return"failed";const s=to.safeParse(await r.json().catch(()=>null));return s.success?s.data.exists===!1?"missing":"exists":"failed"}catch{return"failed"}},ro=Sn({paths:ks(vn())}),Ke=new Map,so=200,Dn=(n,e)=>lt(`/api/fs/find-by-name?name=${encodeURIComponent(n)}`,{method:"GET",cache:"no-store",headers:{"x-opencode-directory":e}}).then(async t=>{if(!t.ok)return null;const r=ro.safeParse(await t.json().catch(()=>null));return r.success?r.data.paths:null}).catch(()=>null),io=(n,e)=>{if(!n||!e||ke())return Promise.resolve(null);const t=Fn(e,n),r=Ke.get(t);if(r)return r;const s=Dn(n,e).then(i=>i?.length===1?i[0]:null);for(;Ke.size>=so;){const i=Ke.keys().next();if(i.done)break;Ke.delete(i.value)}return Ke.set(t,s),s};function Fe(n,e){if("key"in n&&n.key!=="Enter"&&n.key!==" "||(n.preventDefault(),n.stopPropagation(),!("key"in n)&&br(n.currentTarget.closest("[data-markdown-content]"))))return;const t=/Mac|iPhone|iPad/.test(navigator.platform);e(t?n.metaKey:n.ctrlKey)}const Zt=new gn({maxEntries:64,maxBytes:1024*1024});function ct(){const n=U.c(5),{directory:e}=ie(),t=b.useContext(pn),r=t?.editor,s=t?.runtime.isVSCode,i=yr();let a;return n[0]!==e||n[1]!==r||n[2]!==s||n[3]!==i?(a=async(o,l,c,d)=>{const m=c===void 0?!1:c,u=Ae(o,e,"click",d===void 0?"path":d);if(!u)return;const p=l??u.resolvedPath;if(m&&ws()&&await ys(p))return;if(s&&r){r.openFile(p,u.line,u.column);return}const g=de.getState();u.line?g.openContextFileAtLine(e,p,u.line,u.column??1):g.openContextFile(e,p),i?.openFiles()},n[0]=e,n[1]=r,n[2]=s,n[3]=i,n[4]=a):a=n[4],a}function oo(){const n=U.c(5),{directory:e}=ie(),t=ct(),r=b.useRef(!1);let s,i;n[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>(r.current=!0,()=>{r.current=!1}),i=[],n[0]=s,n[1]=i):(s=n[0],i=n[1]),b.useEffect(s,i);let a;return n[2]!==e||n[3]!==t?(a=async o=>{const l=Ae(o,e);if(!l)return;const c=ce(),d=await no(l.resolvedPath,e),m=d==="missing"&&!/[\\/]/.test(l.path)?await Dn(l.path,e):[];!r.current||ce()!==c||(d==="failed"||!m||m.length>1?Kt(l.resolvedPath,{reason:"unreadable",message:null}):d==="missing"&&m.length===0?Kt(l.resolvedPath,{reason:"missing"}):await t(o,m[0]??l.resolvedPath))},n[2]=e,n[3]=t,n[4]=a):a=n[4],a}function ao(){const n=U.c(5),e=b.useContext(pn),{t}=Se(),r=e?.files,s=e?.runtime.platform;let i;e:{let a;n[0]!==r?(a=r?.revealPath?.bind(r),n[0]=r,n[1]=a):a=n[1];const o=a;if(!o||!s||s==="vscode"||gs(s)){i=null;break e}let l;n[2]!==o||n[3]!==t?(l=c=>{o(c).catch(()=>{xr.error(t("sidebarFilesTree.toast.revealFailed"))})},n[2]=o,n[3]=t,n[4]=l):l=n[4],i=l}return i}const lo=new Set(["dockerfile","makefile","readme","license",".env",".gitignore",".npmrc"]),co=(n,e,t)=>{if(!n||!t&&(n.startsWith("--")||n.includes("://")||/[<>]/.test(n)||/\s{2,}/.test(n))||!t&&e==="probe"&&n.includes("@")&&!n.includes("/"))return!1;const s=qi(n).split("/").filter(Boolean).pop()??"";if(!s||s==="."||s==="..")return!1;const i=s.toLowerCase();return lo.has(i)||i.startsWith(".")&&i.length>1?!0:s.endsWith(".")?!1:e==="click"?/\.[A-Za-z0-9_-]{1,16}$/.test(s):/\.[A-Za-z][A-Za-z0-9_-]{0,15}$/.test(s)};function Ae(n,e,t="probe",r="path"){const s=/^\s*file:/i.test(n),i=Xi(s?On(n)??n:n),a=r==="href"&&!s;if(i&&a){if(i.path.startsWith("//")||/^[A-Za-z][A-Za-z\d+.-]*:/.test(i.path)&&!/^[A-Za-z]:[\\/]/.test(i.path))return null;try{i.path=decodeURIComponent(i.path)}catch{}}if(!i||!e||!co(i.path,t,a))return null;const o=wr(e,i.path,{preserveWhitespace:a});return o?{...i,resolvedPath:o}:null}async function zn(n,e,t="path"){const r=Ae(n,e,"probe",t);return r?!kt(r.resolvedPath,e)||await eo(r.resolvedPath,e)?r.resolvedPath:/[\\/]/.test(r.path)?null:io(r.path,e):null}async function uo(n,e,t,r=s=>zn(s,e)){if(n.length>2e5)return[];let s=Zt.get(n);if(!s){s=Array.from(n.matchAll(Zi),l=>({raw:l[0],start:l.index}));const o=n.length*2+s.reduce((l,c)=>l+c.raw.length*2+32,0);o<=1024*1024&&Zt.set(n,s,o)}const i=s.filter(o=>Ae(o.raw,e)).slice(0,t);return(await Promise.all(i.map(async o=>{const l=await r(o.raw);return l?{start:o.start,end:o.start+o.raw.length,raw:o.raw,path:l}:null}))).filter(o=>o!==null)}function Wn(n,e){const t=U.c(8),r=e===void 0?"path":e,{directory:s,fileReferences:i,confirmFile:a}=ie();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=ce(),t[0]=o):o=t[0];const l=o,[c,d]=b.useState(null);let m,f;return t[1]!==a||t[2]!==s||t[3]!==i||t[4]!==r||t[5]!==n?(m=()=>{if(!i)return;let u=!0;return a(n,r).then(p=>{u&&l===ce()&&d(p?{raw:n,inputKind:r,directory:s,runtimeKey:l,path:p}:null)}),()=>{u=!1}},f=[n,r,s,i,l,a],t[1]=a,t[2]=s,t[3]=i,t[4]=r,t[5]=n,t[6]=m,t[7]=f):(m=t[6],f=t[7]),b.useEffect(m,f),i&&c?.raw===n&&c.inputKind===r&&c.directory===s&&c.runtimeKey===l?c.path:null}function fo(n){const e=U.c(23);let t,r,s;e[0]!==n?({children:r,node:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let i;e[4]!==t?.children?(i=t?.children.map(mo).join("")??"",e[4]=t?.children,e[5]=i):i=e[5];const a=i,o=Wn(a),l=ct(),c=oo(),{directory:d,fileNavigation:m,fileReferences:f}=ie();let u;e[6]!==l||e[7]!==o||e[8]!==a?(u=N=>{o&&Fe(N,P=>{l(a,o,P)})},e[6]=l,e[7]=o,e[8]=a,e[9]=u):u=e[9];const p=u,g=m&&!f&&Ae(a,d)!==null;let w;e[10]!==c||e[11]!==a?(w=N=>{N.currentTarget.closest('a, button, [role="button"], summary')||Fe(N,()=>{c(a)})},e[10]=c,e[11]=a,e[12]=w):w=e[12];const C=w,y=o?"true":void 0,x=o?a:void 0,v=o??void 0,S=o?"button":void 0,M=o?0:void 0,k=o?p:g?C:void 0,E=o?p:void 0;let R;return e[13]!==r||e[14]!==s||e[15]!==E||e[16]!==y||e[17]!==x||e[18]!==v||e[19]!==S||e[20]!==M||e[21]!==k?(R=h.jsx("code",{...s,dir:"ltr","data-streamdown":"inline-code","data-openchamber-file-link":y,"data-openchamber-file-ref":x,"data-openchamber-file-path":v,role:S,tabIndex:M,onClick:k,onKeyDown:E,children:r}),e[13]=r,e[14]=s,e[15]=E,e[16]=y,e[17]=x,e[18]=v,e[19]=S,e[20]=M,e[21]=k,e[22]=R):R=e[22],R}function mo(n){return n.type==="text"?n.value:""}function ho(n){const e=U.c(10),{purpose:t}=ie();if(t){let s,i;if(e[0]!==n){const{node:l,children:c,...d}=n;s=c,i=d,e[0]=n,e[1]=s,e[2]=i}else s=e[1],i=e[2];let a;e[3]!==s?(a=h.jsx(Ue.Provider,{value:!0,children:s}),e[3]=s,e[4]=a):a=e[4];let o;return e[5]!==i||e[6]!==a?(o=h.jsx("a",{...i,children:a}),e[5]=i,e[6]=a,e[7]=o):o=e[7],o}let r;return e[8]!==n?(r=h.jsx(wo,{...n}),e[8]=n,e[9]=r):r=e[9],r}function po(n){const e=U.c(3),{src:t}=n,[r,s]=b.useState(!1);if(r)return null;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>s(!0),e[0]=i):i=e[0];let a;return e[1]!==t?(a=h.jsx("span",{"data-message-image-export-exclude":"true",className:"me-1 inline-flex size-[18px] items-center justify-center rounded border border-[var(--border)] bg-[var(--interactive-hover)] align-middle",children:h.jsx("img",{src:t,alt:"","aria-hidden":"true",loading:"lazy",decoding:"async",className:"size-3.5 rounded-sm",onError:i})}),e[1]=t,e[2]=a):a=e[2],a}const go=n=>{if(!n)return"";let e="";const t=r=>{r.type==="text"?e+=r.value:r.type==="element"&&r.children.forEach(t)};return n.children.forEach(t),e.trim()};function wo(n){const e=U.c(17);let t,r,s,i;if(e[0]!==n?({href:t,children:s,node:r,...i}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i):(t=e[1],r=e[2],s=e[3],i=e[4]),!t){let o;if(e[5]!==i){const{target:d,rel:m,...f}=i;o=f,e[5]=i,e[6]=o}else o=e[6];let l;e[7]!==s?(l=h.jsx(Ue.Provider,{value:!0,children:s}),e[7]=s,e[8]=l):l=e[8];let c;return e[9]!==o||e[10]!==l?(c=h.jsx("a",{...o,children:l}),e[9]=o,e[10]=l,e[11]=c):c=e[11],c}let a;return e[12]!==t||e[13]!==r||e[14]!==s||e[15]!==i?(a=h.jsx(yo,{href:t,node:r,...i,children:s}),e[12]=t,e[13]=r,e[14]=s,e[15]=i,e[16]=a):a=e[16],a}function yo(n){const e=U.c(113);let t,r,s,i;e[0]!==n?({href:t,children:s,node:r,...i}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i):(t=e[1],r=e[2],s=e[3],i=e[4]);let a;e[5]!==s?(a=h.jsx(Ue.Provider,{value:!0,children:s}),e[5]=s,e[6]=a):a=e[6];const o=a,l=ie(),{directory:c}=l,{t:d}=Se(),m=hn(c),f=ct(),u=he(),p=de(bo);let g;e[7]!==r?(g=go(r),e[7]=r,e[8]=g):g=e[8];const w=g;let C;e[9]!==t?(C=kr(t),e[9]=t,e[10]=C):C=e[10];const y=C,x=vr(t);let v;e[11]!==t?(v=Sr(t),e[11]=t,e[12]=v):v=e[12];const S=v,M=ke()?null:Mr(t,Cr());let k;e[13]!==t?(k=ke()?null:Nn(t),e[13]=t,e[14]=k):k=e[14];const E=k,R=b.useContext(Er),N=M?R.get(jr(M)):void 0;let P;e[15]!==t?(P=fn(t),e[15]=t,e[16]=P):P=e[16];const _=P;let F;e[17]!==c||e[18]!==t||e[19]!==l.fileNavigation?(F=l.fileNavigation&&Ae(t,c,"click","href"),e[17]=c,e[18]=t,e[19]=l.fileNavigation,e[20]=F):F=e[20];const j=F,A=ao();let D;e[21]!==j||e[22]!==t||e[23]!==l.fileNavigation||e[24]!==A?(D=l.fileNavigation&&!j&&A?On(t):null,e[21]=j,e[22]=t,e[23]=l.fileNavigation,e[24]=A,e[25]=D):D=e[25];const L=D,I=!!(j||L||_||M||y||x||S),K=I?t:w,W=Wn(K,I?"href":"path"),q=!!(W&&!I);let V;e[26]!==t?(V=Rr(t),e[26]=t,e[27]=V):V=e[27];const O=V,z=r?.properties.dataOcReference!==void 0;let X;e[28]!==O||e[29]!==t||e[30]!==W||e[31]!==z?(X=O&&!W&&!z?Nr(t):null,e[28]=O,e[29]=t,e[30]=W,e[31]=z,e[32]=X):X=e[32];const H=X;let Z;e[33]!==c||e[34]!==t||e[35]!==p||e[36]!==l.loopbackPreview?(Z=l.loopbackPreview&&Pr(t)&&c&&!(xs()&&p),e[33]=c,e[34]=t,e[35]=p,e[36]=l.loopbackPreview,e[37]=Z):Z=e[37];const Y=Z;let Q;e[38]!==_||e[39]!==O||e[40]!==j||e[41]!==L||e[42]!==t||e[43]!==u||e[44]!==m||e[45]!==f||e[46]!==W||e[47]!==l.disableLinkSafety||e[48]!==A||e[49]!==M||e[50]!==y||e[51]!==w||e[52]!==q?(Q=$=>{if(!(u?.documentAssets&&Es($,u.documentAssets))){if(q&&W){Fe($,se=>{f(w,W,se)});return}if(M&&(!O||!($.metaKey||$.ctrlKey||$.shiftKey||$.altKey))){$.preventDefault(),Ir(M.sessionId,M.messageId);return}if(_){$.preventDefault(),$.stopPropagation(),Tt(t);return}if(!y){if(j){Fe($,se=>{f(t,W??void 0,se,"href")});return}if(L&&A){Fe($,()=>A(L));return}if(t.startsWith("#")&&!u?.documentAssets){$.preventDefault();const se=decodeURIComponent(t.slice(1)),ae=$.currentTarget.closest("[data-markdown-content]");(ae?Array.from(ae.querySelectorAll("[id]")).find(Ce=>Ce.id===se):null)?.scrollIntoView({block:"nearest"});return}O&&!l.disableLinkSafety&&!($.metaKey||$.ctrlKey||$.shiftKey||$.altKey)&&($.preventDefault(),$.stopPropagation(),m(t))}}},e[38]=_,e[39]=O,e[40]=j,e[41]=L,e[42]=t,e[43]=u,e[44]=m,e[45]=f,e[46]=W,e[47]=l.disableLinkSafety,e[48]=A,e[49]=M,e[50]=y,e[51]=w,e[52]=q,e[53]=Q):Q=e[53];const te=Q;if(S){const $=S.openable?It:_r,se=S.openable?S.filename:void 0,ae=S.openable?"button":void 0,Le=S.openable?0:void 0,Ce=`#${S.iconId}`;let ye;e[54]!==Ce?(ye=h.jsx("svg",{className:"size-[1.1em] shrink-0","aria-hidden":"true",children:h.jsx("use",{href:Ce})}),e[54]=Ce,e[55]=ye):ye=e[55];let xe;e[56]!==S.filename?(xe=h.jsx("span",{className:Lt,children:S.filename}),e[56]=S.filename,e[57]=xe):xe=e[57];let Xe;return e[58]!==S.filename||e[59]!==S.iconId||e[60]!==$||e[61]!==se||e[62]!==ae||e[63]!==Le||e[64]!==ye||e[65]!==xe?(Xe=h.jsxs("span",{className:$,"data-attachment-citation":S.iconId,"data-attachment-open":se,role:ae,tabIndex:Le,title:S.filename,children:[ye,xe]}),e[58]=S.filename,e[59]=S.iconId,e[60]=$,e[61]=se,e[62]=ae,e[63]=Le,e[64]=ye,e[65]=xe,e[66]=Xe):Xe=e[66],Xe}if(E&&kn()){let $;return e[67]!==o?($=h.jsx("span",{children:o}),e[67]=o,e[68]=$):$=e[68],$}if(E){let $;e[69]!==E.kind||e[70]!==E.source?($=()=>Ns({source:E.source,confirmed:E.kind==="path"}),e[69]=E.kind,e[70]=E.source,e[71]=$):$=e[71];let se;e[72]===Symbol.for("react.memo_cache_sentinel")?(se=h.jsx(fe,{name:"download",className:"size-4"}),e[72]=se):se=e[72];let ae;return e[73]!==o||e[74]!==$?(ae=h.jsxs(be,{type:"button",variant:"outline",size:"sm",className:"my-1 align-middle",onClick:$,children:[se,o]}),e[73]=o,e[74]=$,e[75]=ae):ae=e[75],ae}if(M&&N){let $;return e[76]!==N||e[77]!==M?($=h.jsx(Lr,{chip:N,target:M}),e[76]=N,e[77]=M,e[78]=$):$=e[78],$}if(x)return h.jsx("a",{"data-openchamber-agent-mention":"true",className:"text-primary hover:underline",href:Ar(x),target:"_blank",rel:"noopener noreferrer",children:o});let T;e[79]!==H?(T=H&&h.jsx(po,{src:H}),e[79]=H,e[80]=T):T=e[80];const B=w===t?"ltr":i.dir,re=y?It:i.className,G=y??void 0,J=y?`$${y}`:i.title,oe=W?"true":void 0,pe=W?K:void 0,me=W??void 0;let ue;e[81]!==_||e[82]!==t?(ue=$=>{_&&($.preventDefault(),$.button===1&&Tt(t))},e[81]=_,e[82]=t,e[83]=ue):ue=e[83];const ee=_?xo:void 0;let le;e[84]!==y?(le=y&&h.jsx(fe,{name:"book-open",className:"size-[1.1em] shrink-0"}),e[84]=y,e[85]=le):le=e[85];let Me;e[86]!==o||e[87]!==y?(Me=y?h.jsx("span",{className:Lt,children:y}):o,e[86]=o,e[87]=y,e[88]=Me):Me=e[88];let ge;e[89]!==te||e[90]!==t||e[91]!==i||e[92]!==B||e[93]!==re||e[94]!==G||e[95]!==J||e[96]!==oe||e[97]!==pe||e[98]!==me||e[99]!==ue||e[100]!==ee||e[101]!==le||e[102]!==Me?(ge=h.jsxs("a",{...i,href:t,target:"_blank",rel:"noopener noreferrer",dir:B,className:re,"data-skill-name":G,title:J,"data-openchamber-file-link":oe,"data-openchamber-file-ref":pe,"data-openchamber-file-path":me,onClick:te,onAuxClick:ue,onDragStart:ee,children:[le,Me]}),e[89]=te,e[90]=t,e[91]=i,e[92]=B,e[93]=re,e[94]=G,e[95]=J,e[96]=oe,e[97]=pe,e[98]=me,e[99]=ue,e[100]=ee,e[101]=le,e[102]=Me,e[103]=ge):ge=e[103];let we;e[104]!==c||e[105]!==t||e[106]!==Y||e[107]!==d?(we=Y&&h.jsx(Oe,{label:d("terminalView.preview.openTitle"),children:h.jsx(be,{variant:"ghost",size:"xs",className:"ms-1 align-middle","data-export-ignore":!0,"aria-label":d("terminalView.preview.open"),onClick:()=>de.getState().openContextPreview(c,t),children:h.jsx(fe,{name:"global",className:"size-3.5"})})}),e[104]=c,e[105]=t,e[106]=Y,e[107]=d,e[108]=we):we=e[108];let Ie;return e[109]!==T||e[110]!==ge||e[111]!==we?(Ie=h.jsxs(h.Fragment,{children:[T,ge,we]}),e[109]=T,e[110]=ge,e[111]=we,e[112]=Ie):Ie=e[112],Ie}function xo(n){return n.preventDefault()}function bo(n){return n.openLinksInBrowserPanel}const ko=()=>St(()=>import("./MarkdownDiffPreview-Bf9-WPy9.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199])).then(n=>n.default),vo=()=>{};function So(n){const e=U.c(7),{source:t,incomplete:r}=n;let s;e[0]!==r||e[1]!==t?(s=!r&&!Tr(t),e[0]=r,e[1]=t,e[2]=s):s=e[2];const i=s,a=$r(i,ko,vo);let o;return e[3]!==a||e[4]!==i||e[5]!==t?(o=h.jsx("div",{"data-streamdown":"code-block-body","data-language":"diff",children:i&&a?h.jsx(a,{source:t}):h.jsx(Or,{diff:t})}),e[3]=a,e[4]=i,e[5]=t,e[6]=o):o=e[6],o}const Mo=b.memo(function(e){const t=U.c(5),{tokens:r}=e,s=r.length===0||r.length===1&&r[0].content==="";let i;t[0]!==s||t[1]!==r?(i=s?`
4
4
  `:r.map(_o),t[0]=s,t[1]=r,t[2]=i):i=t[2];let a;return t[3]!==i?(a=h.jsx("span",{className:"block before:content-[counter(line)] before:[counter-increment:line]",children:i}),t[3]=i,t[4]=a):a=t[4],a}),Co=b.memo(function({source:e,language:t,incomplete:r,plugin:s}){const i=b.useMemo(()=>({code:e,language:t,isIncomplete:r,themes:s.getThemes()}),[e,t,r,s]),a=b.useMemo(()=>s.cached(i),[s,i]),[o,l]=b.useState(null),c=b.useRef(null),d=b.useMemo(()=>{const f=c.current;return f?.plugin===s&&f.input.language===i.language&&i.code.startsWith(f.input.code)?f.lineage:Symbol()},[i,s]),m=b.useMemo(()=>{const f=o?.lineage===d?o:null;if(f?.input===i)return f;if(a)return{input:i,result:a};const u=c.current,p=u?.lineage===d?u.display:null;return f&&(!p||f.input.code.length>=p.input.code.length)?f:p||{input:i,result:{tokens:i.code.split(`
5
- `).map(g=>[{content:g}])}}},[i,a,d,o]);return b.useLayoutEffect(()=>(c.current={input:i,plugin:s,lineage:d,display:m,exact:a!==null},()=>{c.current=null}),[i,s,d,m,a]),b.useEffect(()=>{const f=p=>{const g=c.current;g?.lineage!==d||!g.input.code.startsWith(i.code)||g.exact&&g.input!==i||i.code.length<g.display.input.code.length||l(w=>w?.input===g.input&&i!==g.input||w?.lineage===d&&(w.input.code.length>i.code.length||w.input===i&&w.result===p)?w:{input:i,result:p,lineage:d})},u=s.highlight(i,f);u&&f(u)},[s,i,d]),h.jsx("div",{"data-streamdown":"code-block-body","data-language":t,children:h.jsx("pre",{children:h.jsx("code",{className:"[counter-increment:line_0] [counter-reset:line]",children:m.result.tokens.map((f,u)=>h.jsx(Mo,{tokens:f},u))})})})}),Un=n=>/language-([^\s]+)/.exec(n??"")?.[1]??"",Nt=n=>(n?.children.map(e=>e.type==="text"?e.value:"").join("")??"").replace(/\n$/,""),Eo=Ur(()=>St(()=>import("./ReplyCommand-pviKPDT8.js"),__vite__mapDeps([200,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180])).then(n=>n.ReplyCommandCode));function jo(n){const e=U.c(8),{reply:t,...r}=n,{directory:s}=ie(),i=Eo();if(!i)return h.jsx(wt,{...r,command:null});const a=Nt(r.node);let o;e[0]!==r?(o=c=>h.jsx(wt,{...r,command:c}),e[0]=r,e[1]=o):o=e[1];let l;return e[2]!==i||e[3]!==s||e[4]!==t||e[5]!==a||e[6]!==o?(l=h.jsx(i,{reply:t,directory:s,source:a,children:o}),e[2]=i,e[3]=s,e[4]=t,e[5]=a,e[6]=o,e[7]=l):l=e[7],l}function Ro(n){const e=U.c(9),{settledReply:t}=ie(),r=Fr();let s;e[0]!==n.className||e[1]!==n.node||e[2]!==t||e[3]!==r?(s=t!==null&&r!=="peek"&&Dr(Un(n.className))&&Nt(n.node).trim().length>0,e[0]=n.className,e[1]=n.node,e[2]=t,e[3]=r,e[4]=s):s=e[4];const i=s;let a;return e[5]!==n||e[6]!==i||e[7]!==t?(a=i?h.jsx(jo,{...n,reply:t}):h.jsx(wt,{...n,command:null}),e[5]=n,e[6]=i,e[7]=t,e[8]=a):a=e[8],a}function wt(n){const e=U.c(69);let t,r,s,i,a;e[0]!==n?({children:t,className:r,node:i,command:s,...a}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i,e[5]=a):(t=e[1],r=e[2],s=e[3],i=e[4],a=e[5]);const o=ie(),{t:l}=Se(),c=de(Po),d=cs(),m=ct(),[f,u]=b.useState(!1),p=b.useRef(null);let g,w;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=()=>()=>{p.current&&clearTimeout(p.current)},w=[],e[6]=g,e[7]=w):(g=e[6],w=e[7]),b.useEffect(g,w);const C=b.useContext(zr);let y,x,v;e[8]!==r||e[9]!==C?(y=Un(r),x=C!==null&&Br(y),v=y.toLowerCase()==="diff"||x,e[8]=r,e[9]=C,e[10]=y,e[11]=x,e[12]=v):(y=e[10],x=e[11],v=e[12]);const S=v;let M;e[13]!==i?.children?(M=i?.children.map(No).join("")??"",e[13]=i?.children,e[14]=M):M=e[14];const k=M;let E;e[15]!==i?(E=Nt(i),e[15]=i,e[16]=E):E=e[16];const R=E,{purpose:N,onExportCode:P}=o;let _,F;if(e[17]!==k||e[18]!==y||e[19]!==P||e[20]!==N?(_=()=>{N&&y!=="mermaid"&&P?.(k,y)},F=[N,P,k,y],e[17]=k,e[18]=y,e[19]=P,e[20]=N,e[21]=_,e[22]=F):(_=e[21],F=e[22]),b.useLayoutEffect(_,F),y==="mermaid"||y==="openui-lang"&&o.uiBlocks){let H;return e[23]!==t||e[24]!==r||e[25]!==i||e[26]!==a?(H=h.jsx(He.code,{...a,node:i,className:r,children:t}),e[23]=t,e[24]=r,e[25]=i,e[26]=a,e[27]=H):H=e[27],H}let j;e[28]!==m||e[29]!==o.fileNavigation?(j=H=>{if(!o.fileNavigation||!(H.target instanceof Element))return;const Z=H.target.closest('[data-openchamber-file-link="true"]'),Y=Z?.getAttribute("data-openchamber-file-ref");Y&&Fe(H,Q=>{m(Y,Z?.getAttribute("data-openchamber-file-path")??void 0,Q)})},e[28]=m,e[29]=o.fileNavigation,e[30]=j):j=e[30];const A=j;let D;e[31]!==R?(D=async()=>{(await at(R)).ok&&(u(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>u(!1),2e3))},e[31]=R,e[32]=D):D=e[32];const L=D,I=c?"true":"false";let K;e[33]!==y||e[34]!==S||e[35]!==x||e[36]!==l?(K=x?l("chat.markdown.suggestion.title"):S?l("markdownRenderer.code.proposal"):y.toLowerCase()||"text",e[33]=y,e[34]=S,e[35]=x,e[36]=l,e[37]=K):K=e[37];let W;e[38]!==K?(W=h.jsx(ds,{language:K}),e[38]=K,e[39]=W):W=e[39];let q;e[40]!==s?.button||e[41]!==f||e[42]!==L||e[43]!==S||e[44]!==N||e[45]!==l||e[46]!==c?(q=!N&&h.jsx("div",{className:"pointer-events-none absolute top-0 end-0 flex items-center",children:h.jsxs("div",{"data-streamdown":"code-block-actions",className:"pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur",children:[s?.button,!S&&h.jsx(Oe,{label:l(c?"markdownRenderer.code.actions.disableWrapTitle":"markdownRenderer.code.actions.enableWrapTitle"),children:h.jsx(be,{variant:"ghost",size:"xs","data-export-ignore":!0,className:c?wn:void 0,"aria-label":l(c?"markdownRenderer.code.actions.disableWrapTitle":"markdownRenderer.code.actions.enableWrapTitle"),"aria-pressed":c,onClick:()=>de.getState().setCodeBlockLineWrap(!c),children:h.jsx(fe,{name:"text-wrap",className:"size-3.5"})})}),h.jsx(Oe,{label:l(f?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.code.actions.copyTitle"),children:h.jsx(be,{variant:"ghost",size:"xs","data-export-ignore":!0,"aria-label":l(f?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.code.actions.copyTitle"),onClick:L,children:h.jsx(fe,{name:f?"check":"file-copy",className:"size-3.5"})})})]})}),e[40]=s?.button,e[41]=f,e[42]=L,e[43]=S,e[44]=N,e[45]=l,e[46]=c,e[47]=q):q=e[47];let V;e[48]!==R||e[49]!==d||e[50]!==y||e[51]!==o.code||e[52]!==S||e[53]!==N||e[54]!==x||e[55]!==C?(V=S&&!N?h.jsx(So,{source:x?Wr(R,C.excerpt):R,incomplete:d}):h.jsx(Co,{source:R,language:y,incomplete:d,plugin:o.code}),e[48]=R,e[49]=d,e[50]=y,e[51]=o.code,e[52]=S,e[53]=N,e[54]=x,e[55]=C,e[56]=V):V=e[56];const O=s?.output;let z;e[57]!==d||e[58]!==y||e[59]!==W||e[60]!==q||e[61]!==V||e[62]!==O?(z=h.jsxs(us,{language:y,isIncomplete:d,dir:"ltr",children:[W,q,V,O]}),e[57]=d,e[58]=y,e[59]=W,e[60]=q,e[61]=V,e[62]=O,e[63]=z):z=e[63];let X;return e[64]!==R||e[65]!==A||e[66]!==I||e[67]!==z?(X=h.jsx("div",{"data-code-wrap":I,"data-oc-code-source":R,onClick:A,onKeyDown:A,children:z}),e[64]=R,e[65]=A,e[66]=I,e[67]=z,e[68]=X):X=e[68],X}function No(n){return n.type==="text"?n.value:""}function Po(n){return n.codeBlockLineWrap}function _o(n,e){const t={...n.htmlStyle,color:n.color,backgroundColor:n.bgColor};return h.jsx("span",{style:t,...n.htmlAttrs,children:n.content},e)}const Ao=["csv","tsv","md"],Io=["csv","md"],Gt=n=>n==="md"?"Markdown":n.toUpperCase(),Yt=n=>n.replace(/\\/g,"\\\\").replace(/\|/g,"\\|"),Bn=b.createContext(new Map),Kn=b.createContext(null),Vn=n=>n.type==="text"?n.value:n.type==="element"?n.children.map(Vn).join(""):"",Lo=n=>{const e=n?.children.find(t=>t.type==="element"&&t.tagName==="thead");return e?Vn(e):""};function Jt(n){const e=U.c(36);let t,r,s;e[0]!==n?({node:t,style:s,...r}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);const i=b.useContext(Bn),a=t?i.get(t):void 0,o=b.useContext(Kn),{t:l}=Se(),c=t?.tagName==="th"?He.th:He.td,d=a?"normal":"nowrap";let m;e[4]!==s||e[5]!==d?(m={...s,"--oc-table-code-wrap":d},e[4]=s,e[5]=d,e[6]=m):m=e[6];const f=m;let u;e[7]!==t||e[8]!==o?.columnOf?(u=t?.tagName==="th"?o?.columnOf.get(t):void 0,e[7]=t,e[8]=o?.columnOf,e[9]=u):u=e[9];const p=u;if(!o||p===void 0){let E;return e[10]!==c||e[11]!==f||e[12]!==t||e[13]!==r?(E=h.jsx(c,{...r,node:t,style:f}),e[10]=c,e[11]=f,e[12]=t,e[13]=r,e[14]=E):E=e[14],E}let g;e[15]!==f?(g={...f,position:"relative"},e[15]=f,e[16]=g):g=e[16];const w=r.children,C=String(p+1);let y;e[17]!==l||e[18]!==C?(y=l("filesView.artifact.table.resizeColumn",{column:C}),e[17]=l,e[18]=C,e[19]=y):y=e[19];let x,v,S;e[20]!==p||e[21]!==o?(v=E=>o.onResize(p,E),S=E=>o.onResizeEnd(p,E),x=()=>o.onReset(p),e[20]=p,e[21]=o,e[22]=x,e[23]=v,e[24]=S):(x=e[22],v=e[23],S=e[24]);let M;e[25]!==x||e[26]!==y||e[27]!==v||e[28]!==S?(M=h.jsx(As,{label:y,onResize:v,onResizeEnd:S,onReset:x}),e[25]=x,e[26]=y,e[27]=v,e[28]=S,e[29]=M):M=e[29];let k;return e[30]!==c||e[31]!==t||e[32]!==r||e[33]!==M||e[34]!==g?(k=h.jsxs(c,{...r,node:t,style:g,children:[w,M]}),e[30]=c,e[31]=t,e[32]=r,e[33]=M,e[34]=g,e[35]=k):k=e[35],k}const et=120,To=280;function $o(n,e,t){const r=n.map(a=>Math.min(Math.max(et,e||320),a));if(!t||e<=0)return r;let s=r.map((a,o)=>o),i=e;for(;s.length;){const a=i/s.length,o=s.filter(l=>r[l]<=a);if(!o.length){const l=a<et?To:Math.floor(a);for(const c of s)r[c]=Math.max(Math.min(et,n[c]),Math.min(n[c],l));break}for(const l of o)i-=r[l];s=s.filter(l=>r[l]>a)}return r}function Oo(n,e){const t=e.ownerDocument.createElement("div");t.style.cssText="position:absolute;width:0;height:0;overflow:hidden;visibility:hidden";const r=n.map(a=>{const o=a.ownerDocument.createElement(a.localName);for(const{name:l,value:c}of Array.from(a.attributes))o.setAttribute(l,c);return o.append(...Array.from(a.childNodes,l=>l.cloneNode(!0))),o.style.cssText="display:block;width:max-content",t.append(o),o});e.append(t);const s=r.map(a=>a.getBoundingClientRect().width);for(const a of r)a.style.width="min-content";const i=r.map((a,o)=>Math.ceil(Math.max(Math.min(s[o],et),a.getBoundingClientRect().width))+1);return t.remove(),i}function Hn(n,e){if(n.nodeType===Node.TEXT_NODE){const t=n.textContent??"";return e?Yt(t):t}if(n instanceof HTMLAnchorElement){const t=n.getAttribute("href");if(t){const r=t.replace(/ /g,"%20");if(!e)return r;const s=Yt(n.textContent??"").replace(/\[/g,"\\[").replace(/\]/g,"\\]"),i=r.replace(/\|/g,"%7C"),a=/[()]/.test(i)?`<${i.replace(/</g,"%3C").replace(/>/g,"%3E")}>`:i;return`[${s}](${a})`}}return Array.from(n.childNodes).map(t=>Hn(t,e)).join("")}function Qt(n,e){const t=Array.from(n.rows).map(s=>Array.from(s.cells).map(i=>Hn(i,e==="md").trim())),r={headers:t[0]??[],rows:t.slice(1)};return e==="csv"?fs(r):e==="tsv"?ms(r):[r.headers,r.headers.map(()=>"---"),...r.rows].map(s=>`| ${s.join(" | ")} |`).join(`
5
+ `).map(g=>[{content:g}])}}},[i,a,d,o]);return b.useLayoutEffect(()=>(c.current={input:i,plugin:s,lineage:d,display:m,exact:a!==null},()=>{c.current=null}),[i,s,d,m,a]),b.useEffect(()=>{const f=p=>{const g=c.current;g?.lineage!==d||!g.input.code.startsWith(i.code)||g.exact&&g.input!==i||i.code.length<g.display.input.code.length||l(w=>w?.input===g.input&&i!==g.input||w?.lineage===d&&(w.input.code.length>i.code.length||w.input===i&&w.result===p)?w:{input:i,result:p,lineage:d})},u=s.highlight(i,f);u&&f(u)},[s,i,d]),h.jsx("div",{"data-streamdown":"code-block-body","data-language":t,children:h.jsx("pre",{children:h.jsx("code",{className:"[counter-increment:line_0] [counter-reset:line]",children:m.result.tokens.map((f,u)=>h.jsx(Mo,{tokens:f},u))})})})}),Un=n=>/language-([^\s]+)/.exec(n??"")?.[1]??"",Nt=n=>(n?.children.map(e=>e.type==="text"?e.value:"").join("")??"").replace(/\n$/,""),Eo=Ur(()=>St(()=>import("./ReplyCommand-CnDNvFmd.js"),__vite__mapDeps([200,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180])).then(n=>n.ReplyCommandCode));function jo(n){const e=U.c(8),{reply:t,...r}=n,{directory:s}=ie(),i=Eo();if(!i)return h.jsx(wt,{...r,command:null});const a=Nt(r.node);let o;e[0]!==r?(o=c=>h.jsx(wt,{...r,command:c}),e[0]=r,e[1]=o):o=e[1];let l;return e[2]!==i||e[3]!==s||e[4]!==t||e[5]!==a||e[6]!==o?(l=h.jsx(i,{reply:t,directory:s,source:a,children:o}),e[2]=i,e[3]=s,e[4]=t,e[5]=a,e[6]=o,e[7]=l):l=e[7],l}function Ro(n){const e=U.c(9),{settledReply:t}=ie(),r=Fr();let s;e[0]!==n.className||e[1]!==n.node||e[2]!==t||e[3]!==r?(s=t!==null&&r!=="peek"&&Dr(Un(n.className))&&Nt(n.node).trim().length>0,e[0]=n.className,e[1]=n.node,e[2]=t,e[3]=r,e[4]=s):s=e[4];const i=s;let a;return e[5]!==n||e[6]!==i||e[7]!==t?(a=i?h.jsx(jo,{...n,reply:t}):h.jsx(wt,{...n,command:null}),e[5]=n,e[6]=i,e[7]=t,e[8]=a):a=e[8],a}function wt(n){const e=U.c(69);let t,r,s,i,a;e[0]!==n?({children:t,className:r,node:i,command:s,...a}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=i,e[5]=a):(t=e[1],r=e[2],s=e[3],i=e[4],a=e[5]);const o=ie(),{t:l}=Se(),c=de(Po),d=cs(),m=ct(),[f,u]=b.useState(!1),p=b.useRef(null);let g,w;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=()=>()=>{p.current&&clearTimeout(p.current)},w=[],e[6]=g,e[7]=w):(g=e[6],w=e[7]),b.useEffect(g,w);const C=b.useContext(zr);let y,x,v;e[8]!==r||e[9]!==C?(y=Un(r),x=C!==null&&Br(y),v=y.toLowerCase()==="diff"||x,e[8]=r,e[9]=C,e[10]=y,e[11]=x,e[12]=v):(y=e[10],x=e[11],v=e[12]);const S=v;let M;e[13]!==i?.children?(M=i?.children.map(No).join("")??"",e[13]=i?.children,e[14]=M):M=e[14];const k=M;let E;e[15]!==i?(E=Nt(i),e[15]=i,e[16]=E):E=e[16];const R=E,{purpose:N,onExportCode:P}=o;let _,F;if(e[17]!==k||e[18]!==y||e[19]!==P||e[20]!==N?(_=()=>{N&&y!=="mermaid"&&P?.(k,y)},F=[N,P,k,y],e[17]=k,e[18]=y,e[19]=P,e[20]=N,e[21]=_,e[22]=F):(_=e[21],F=e[22]),b.useLayoutEffect(_,F),y==="mermaid"||y==="openui-lang"&&o.uiBlocks){let H;return e[23]!==t||e[24]!==r||e[25]!==i||e[26]!==a?(H=h.jsx(He.code,{...a,node:i,className:r,children:t}),e[23]=t,e[24]=r,e[25]=i,e[26]=a,e[27]=H):H=e[27],H}let j;e[28]!==m||e[29]!==o.fileNavigation?(j=H=>{if(!o.fileNavigation||!(H.target instanceof Element))return;const Z=H.target.closest('[data-openchamber-file-link="true"]'),Y=Z?.getAttribute("data-openchamber-file-ref");Y&&Fe(H,Q=>{m(Y,Z?.getAttribute("data-openchamber-file-path")??void 0,Q)})},e[28]=m,e[29]=o.fileNavigation,e[30]=j):j=e[30];const A=j;let D;e[31]!==R?(D=async()=>{(await at(R)).ok&&(u(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>u(!1),2e3))},e[31]=R,e[32]=D):D=e[32];const L=D,I=c?"true":"false";let K;e[33]!==y||e[34]!==S||e[35]!==x||e[36]!==l?(K=x?l("chat.markdown.suggestion.title"):S?l("markdownRenderer.code.proposal"):y.toLowerCase()||"text",e[33]=y,e[34]=S,e[35]=x,e[36]=l,e[37]=K):K=e[37];let W;e[38]!==K?(W=h.jsx(ds,{language:K}),e[38]=K,e[39]=W):W=e[39];let q;e[40]!==s?.button||e[41]!==f||e[42]!==L||e[43]!==S||e[44]!==N||e[45]!==l||e[46]!==c?(q=!N&&h.jsx("div",{className:"pointer-events-none absolute top-0 end-0 flex items-center",children:h.jsxs("div",{"data-streamdown":"code-block-actions",className:"pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur",children:[s?.button,!S&&h.jsx(Oe,{label:l(c?"markdownRenderer.code.actions.disableWrapTitle":"markdownRenderer.code.actions.enableWrapTitle"),children:h.jsx(be,{variant:"ghost",size:"xs","data-export-ignore":!0,className:c?wn:void 0,"aria-label":l(c?"markdownRenderer.code.actions.disableWrapTitle":"markdownRenderer.code.actions.enableWrapTitle"),"aria-pressed":c,onClick:()=>de.getState().setCodeBlockLineWrap(!c),children:h.jsx(fe,{name:"text-wrap",className:"size-3.5"})})}),h.jsx(Oe,{label:l(f?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.code.actions.copyTitle"),children:h.jsx(be,{variant:"ghost",size:"xs","data-export-ignore":!0,"aria-label":l(f?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.code.actions.copyTitle"),onClick:L,children:h.jsx(fe,{name:f?"check":"file-copy",className:"size-3.5"})})})]})}),e[40]=s?.button,e[41]=f,e[42]=L,e[43]=S,e[44]=N,e[45]=l,e[46]=c,e[47]=q):q=e[47];let V;e[48]!==R||e[49]!==d||e[50]!==y||e[51]!==o.code||e[52]!==S||e[53]!==N||e[54]!==x||e[55]!==C?(V=S&&!N?h.jsx(So,{source:x?Wr(R,C.excerpt):R,incomplete:d}):h.jsx(Co,{source:R,language:y,incomplete:d,plugin:o.code}),e[48]=R,e[49]=d,e[50]=y,e[51]=o.code,e[52]=S,e[53]=N,e[54]=x,e[55]=C,e[56]=V):V=e[56];const O=s?.output;let z;e[57]!==d||e[58]!==y||e[59]!==W||e[60]!==q||e[61]!==V||e[62]!==O?(z=h.jsxs(us,{language:y,isIncomplete:d,dir:"ltr",children:[W,q,V,O]}),e[57]=d,e[58]=y,e[59]=W,e[60]=q,e[61]=V,e[62]=O,e[63]=z):z=e[63];let X;return e[64]!==R||e[65]!==A||e[66]!==I||e[67]!==z?(X=h.jsx("div",{"data-code-wrap":I,"data-oc-code-source":R,onClick:A,onKeyDown:A,children:z}),e[64]=R,e[65]=A,e[66]=I,e[67]=z,e[68]=X):X=e[68],X}function No(n){return n.type==="text"?n.value:""}function Po(n){return n.codeBlockLineWrap}function _o(n,e){const t={...n.htmlStyle,color:n.color,backgroundColor:n.bgColor};return h.jsx("span",{style:t,...n.htmlAttrs,children:n.content},e)}const Ao=["csv","tsv","md"],Io=["csv","md"],Gt=n=>n==="md"?"Markdown":n.toUpperCase(),Yt=n=>n.replace(/\\/g,"\\\\").replace(/\|/g,"\\|"),Bn=b.createContext(new Map),Kn=b.createContext(null),Vn=n=>n.type==="text"?n.value:n.type==="element"?n.children.map(Vn).join(""):"",Lo=n=>{const e=n?.children.find(t=>t.type==="element"&&t.tagName==="thead");return e?Vn(e):""};function Jt(n){const e=U.c(36);let t,r,s;e[0]!==n?({node:t,style:s,...r}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);const i=b.useContext(Bn),a=t?i.get(t):void 0,o=b.useContext(Kn),{t:l}=Se(),c=t?.tagName==="th"?He.th:He.td,d=a?"normal":"nowrap";let m;e[4]!==s||e[5]!==d?(m={...s,"--oc-table-code-wrap":d},e[4]=s,e[5]=d,e[6]=m):m=e[6];const f=m;let u;e[7]!==t||e[8]!==o?.columnOf?(u=t?.tagName==="th"?o?.columnOf.get(t):void 0,e[7]=t,e[8]=o?.columnOf,e[9]=u):u=e[9];const p=u;if(!o||p===void 0){let E;return e[10]!==c||e[11]!==f||e[12]!==t||e[13]!==r?(E=h.jsx(c,{...r,node:t,style:f}),e[10]=c,e[11]=f,e[12]=t,e[13]=r,e[14]=E):E=e[14],E}let g;e[15]!==f?(g={...f,position:"relative"},e[15]=f,e[16]=g):g=e[16];const w=r.children,C=String(p+1);let y;e[17]!==l||e[18]!==C?(y=l("filesView.artifact.table.resizeColumn",{column:C}),e[17]=l,e[18]=C,e[19]=y):y=e[19];let x,v,S;e[20]!==p||e[21]!==o?(v=E=>o.onResize(p,E),S=E=>o.onResizeEnd(p,E),x=()=>o.onReset(p),e[20]=p,e[21]=o,e[22]=x,e[23]=v,e[24]=S):(x=e[22],v=e[23],S=e[24]);let M;e[25]!==x||e[26]!==y||e[27]!==v||e[28]!==S?(M=h.jsx(As,{label:y,onResize:v,onResizeEnd:S,onReset:x}),e[25]=x,e[26]=y,e[27]=v,e[28]=S,e[29]=M):M=e[29];let k;return e[30]!==c||e[31]!==t||e[32]!==r||e[33]!==M||e[34]!==g?(k=h.jsxs(c,{...r,node:t,style:g,children:[w,M]}),e[30]=c,e[31]=t,e[32]=r,e[33]=M,e[34]=g,e[35]=k):k=e[35],k}const et=120,To=280;function $o(n,e,t){const r=n.map(a=>Math.min(Math.max(et,e||320),a));if(!t||e<=0)return r;let s=r.map((a,o)=>o),i=e;for(;s.length;){const a=i/s.length,o=s.filter(l=>r[l]<=a);if(!o.length){const l=a<et?To:Math.floor(a);for(const c of s)r[c]=Math.max(Math.min(et,n[c]),Math.min(n[c],l));break}for(const l of o)i-=r[l];s=s.filter(l=>r[l]>a)}return r}function Oo(n,e){const t=e.ownerDocument.createElement("div");t.style.cssText="position:absolute;width:0;height:0;overflow:hidden;visibility:hidden";const r=n.map(a=>{const o=a.ownerDocument.createElement(a.localName);for(const{name:l,value:c}of Array.from(a.attributes))o.setAttribute(l,c);return o.append(...Array.from(a.childNodes,l=>l.cloneNode(!0))),o.style.cssText="display:block;width:max-content",t.append(o),o});e.append(t);const s=r.map(a=>a.getBoundingClientRect().width);for(const a of r)a.style.width="min-content";const i=r.map((a,o)=>Math.ceil(Math.max(Math.min(s[o],et),a.getBoundingClientRect().width))+1);return t.remove(),i}function Hn(n,e){if(n.nodeType===Node.TEXT_NODE){const t=n.textContent??"";return e?Yt(t):t}if(n instanceof HTMLAnchorElement){const t=n.getAttribute("href");if(t){const r=t.replace(/ /g,"%20");if(!e)return r;const s=Yt(n.textContent??"").replace(/\[/g,"\\[").replace(/\]/g,"\\]"),i=r.replace(/\|/g,"%7C"),a=/[()]/.test(i)?`<${i.replace(/</g,"%3C").replace(/>/g,"%3E")}>`:i;return`[${s}](${a})`}}return Array.from(n.childNodes).map(t=>Hn(t,e)).join("")}function Qt(n,e){const t=Array.from(n.rows).map(s=>Array.from(s.cells).map(i=>Hn(i,e==="md").trim())),r={headers:t[0]??[],rows:t.slice(1)};return e==="csv"?fs(r):e==="tsv"?ms(r):[r.headers,r.headers.map(()=>"---"),...r.rows].map(s=>`| ${s.join(" | ")} |`).join(`
6
6
  `)}function Fo({node:n,className:e,children:t,...r}){const{purpose:s,settled:i,tableWidthScope:a}=ie(),o=de(j=>j.tableCellWrap),l=b.useRef(null),c=b.useRef(null),[d,m]=b.useState(null),f=d?.node===n?d:null;b.useLayoutEffect(()=>{const j=l.current,A=c.current?.parentElement;if(!j||!A||!i)return;const D=j.ownerDocument.defaultView;if(!D)return;const L=()=>{const K=D.getComputedStyle(A),W=Math.max(0,A.clientWidth-(parseFloat(K.paddingInlineStart)||0)-(parseFloat(K.paddingInlineEnd)||0)-2),q=D.getComputedStyle(j).font;if(f&&f.font!==q){m(null);return}if(f){f.available!==W&&m({...f,available:W});return}if(W<=0)return;const V=[],O=Array.from(j.rows),z=O.filter(Z=>Z.parentElement?.tagName==="TBODY");for(const Z of z.length?z:O)Array.from(Z.cells).forEach((Y,Q)=>{V[Q]=Math.max(V[Q]??0,Math.ceil(Y.getBoundingClientRect().width))});const X=O.find(Z=>Z.parentElement?.tagName==="THEAD"),H=X?Array.from(X.cells):[];z.length&&H.length&&j.parentElement&&Oo(H,j.parentElement).forEach((Z,Y)=>{V[Y]=Math.max(V[Y]??0,Z)}),m({node:n,natural:V,available:W,font:q})};L();const I=new ResizeObserver(L);return I.observe(A),()=>I.disconnect()},[n,f,i]);const u=a&&!s?`${a}#${Lo(n)}`:null,[p,g]=b.useState(()=>u?Ps(u):{}),[w,C]=b.useState(null),y=b.useMemo(()=>f?$o(f.natural,f.available,o):null,[f,o]),x=b.useMemo(()=>{const j=w?{...p,[w.column]:w.width}:p;return y?.map((A,D)=>j[D]??A)??null},[y,p,w]),v=b.useMemo(()=>{if(!u||!y)return null;const j=I=>{g(I),C(null),_s(u,I)},L=n?.children.find(I=>I.type==="element"&&I.tagName==="thead")?.children.find(I=>I.type==="element"&&I.tagName==="tr")?.children.filter(I=>I.type==="element")??[];return{columnOf:new Map(L.map((I,K)=>[I,K])),onResize:(I,K)=>C({column:I,width:K}),onResizeEnd:(I,K)=>j({...p,[I]:K}),onReset:I=>{const{[I]:K,...W}=p;j(W)}}},[u,y,n,p]),S=x?.map((j,A)=>h.jsx("col",{style:{width:j}},A)),M=x&&f?x.map((j,A)=>f.natural[A]>j?"1":"0").join(""):"",k=b.useMemo(()=>{const j=new Map;for(const A of n?.children??[])if(A.type==="element")for(const D of A.children){if(D.type!=="element"||D.tagName!=="tr")continue;D.children.filter(I=>I.type==="element").forEach((I,K)=>j.set(I,M[K]==="1"))}return j},[n,M]),[E,R]=b.useState(!1),N=b.useRef(null),{t:P}=Se();b.useEffect(()=>()=>{N.current&&clearTimeout(N.current)},[]);const _=async j=>{!l.current||!(await at(Qt(l.current,j))).ok||(R(!0),N.current&&clearTimeout(N.current),N.current=setTimeout(()=>R(!1),2e3))},F=j=>{const A=l.current;if(!A)return;const D=URL.createObjectURL(new Blob([Qt(A,j)],{type:j==="csv"?"text/csv;charset=utf-8":"text/markdown;charset=utf-8"})),L=document.createElement("a");L.href=D,L.download=`table.${j}`,L.click(),URL.revokeObjectURL(D)};return h.jsxs("div",{ref:c,"data-streamdown":"table-wrapper","data-table-wrap":o?"true":"false",className:"group flex flex-col",children:[!s&&h.jsxs("div",{"data-streamdown":"table-controls","data-export-ignore":!0,className:"flex items-center justify-end gap-1",children:[h.jsx(Oe,{label:P(o?"markdownRenderer.table.actions.disableWrapTitle":"markdownRenderer.table.actions.enableWrapTitle"),children:h.jsx(be,{variant:"ghost",size:"xs",className:o?wn:void 0,"aria-label":P(o?"markdownRenderer.table.actions.disableWrapTitle":"markdownRenderer.table.actions.enableWrapTitle"),"aria-pressed":o,onClick:()=>de.getState().setTableCellWrap(!o),children:h.jsx(fe,{name:"text-wrap",className:"size-3.5"})})}),h.jsxs($t,{children:[h.jsx(Oe,{label:P(E?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.table.actions.copyTitle"),children:h.jsx(Ot,{asChild:!0,children:h.jsx(be,{variant:"ghost",size:"xs","aria-label":P(E?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.table.actions.copyTitle"),children:h.jsx(fe,{name:E?"check":"file-copy",className:"size-3.5"})})})}),h.jsx(Ft,{align:"end",children:Ao.map(j=>h.jsx(Dt,{onSelect:()=>{_(j)},children:Gt(j)},j))})]}),h.jsxs($t,{children:[h.jsx(Oe,{label:P("markdownRenderer.table.actions.downloadTitle"),children:h.jsx(Ot,{asChild:!0,children:h.jsx(be,{variant:"ghost",size:"xs","aria-label":P("markdownRenderer.table.actions.downloadTitle"),children:h.jsx(fe,{name:"download",className:"size-3.5"})})})}),h.jsx(Ft,{align:"end",children:Io.map(j=>h.jsx(Dt,{onSelect:()=>F(j),children:Gt(j)},j))})]})]}),h.jsx(Kr,{outerClassName:"overlay-scrollbar-wrapper--no-gutter min-w-0",fillContainer:!1,children:h.jsxs("table",{...r,ref:l,"data-streamdown":"table","data-oc-table-layout":x?"fixed":i?"natural":"pending",style:x?{...r.style,width:x.reduce((j,A)=>j+A,0),tableLayout:"fixed"}:r.style,className:nt("border-collapse",e),children:[S&&h.jsx("colgroup",{children:S}),h.jsx(Kn.Provider,{value:v,children:h.jsx(Bn.Provider,{value:k,children:t})})]})})]})}const ne=n=>Number.isFinite(n)&&n>0,en=n=>{if(n==null)return null;const e=String(n).trim().match(/^([+-]?(?:(?:\d+\.?\d*)|(?:\.\d+))(?:[eE][+-]?\d+)?)(?:px)?$/);if(!e)return null;const t=Number(e[1]);return ne(t)?t:null},dt=(n,e,t)=>Math.min(t,Math.max(e,n)),Do=6,tn=1.25,zo=1.0015,Wo=.5,Uo=12,nn=3,Bo=400,Ko='[data-streamdown="mermaid-block"]',rn=n=>[n.x,n.y,n.width,n.height].map(e=>{const t=Number(e.toFixed(Do));return Object.is(t,-0)?"0":String(t)}).join(" "),Vo=n=>{const e=n.viewBox?.trim().split(/[\s,]+/).map(s=>Number.parseFloat(s));if(e?.length===4){const[s,i,a,o]=e;if(Number.isFinite(s)&&Number.isFinite(i)&&ne(a)&&ne(o))return{x:s,y:i,width:a,height:o}}const t=en(n.width),r=en(n.height);return t===null||r===null?null:{x:0,y:0,width:t,height:r}},qn=(n,e)=>{if(!ne(e.width)||!ne(e.height))return n;const t=n.width/n.height,r=e.width/e.height;if(t>r){const i=n.width/r;return{x:n.x,y:n.y-(i-n.height)/2,width:n.width,height:i}}const s=n.height*r;return{x:n.x-(s-n.width)/2,y:n.y,width:s,height:n.height}},Ho=({currentBox:n,viewport:e,delta:t})=>!ne(e.width)||!ne(e.height)||!ne(n.width)||!ne(n.height)?n:{x:n.x-t.x/e.width*n.width,y:n.y-t.y/e.height*n.height,width:n.width,height:n.height},qo=(n,e)=>{const t=e.x-n.x,r=e.y-n.y;return t*t+r*r>nn*nn},ut=n=>{const[e,t]=n;return!e||!t?null:{distance:Math.hypot(t.x-e.x,t.y-e.y),center:{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}},Xo=({currentBox:n,contentBox:e,viewport:t,pointer:r,zoomFactor:s,minScale:i,maxScale:a})=>{if(!ne(t.width)||!ne(t.height)||!ne(s)||!ne(n.width)||!ne(n.height)||!ne(e.width)||!ne(e.height)||!ne(i)||!ne(a))return n;const o=Math.min(i,a),l=Math.max(i,a),c=qn(e,t),d=c.width/n.width,m=dt(d*s,o,l),f=c.width/m,u=f/(n.width/n.height),p=dt(r.x/t.width,0,1),g=dt(r.y/t.height,0,1),w=n.x+p*n.width,C=n.y+g*n.height;return{x:w-p*f,y:C-g*u,width:f,height:u}},Pt=new WeakMap,_e=new Set;let Re=null,De=null;const ze=new Set;let Ne=null;const Zo=n=>{ze.add(n),Ne===null&&(Ne=window.requestAnimationFrame(()=>{Ne=window.requestAnimationFrame(()=>{Ne=null;const e=Array.from(ze);ze.clear(),Xn(e);for(const t of e)Gn(t)})}))},sn=n=>{ze.delete(n),ze.size===0&&Ne!==null&&(window.cancelAnimationFrame(Ne),Ne=null)},Go=n=>n.querySelector('[data-streamdown="mermaid-viewport"]')??n.querySelector('[data-streamdown="mermaid"]'),$e=n=>{const e=n.getBoundingClientRect();return{width:e.width,height:e.height}},on=(n,e)=>{const t=e.getBoundingClientRect();return{x:n.clientX-t.left,y:n.clientY-t.top}},Yo=n=>n instanceof Element&&!!n.closest('button, a, [role="button"]'),Xn=n=>{const e=n.map(t=>$e(t.viewport));n.forEach((t,r)=>{const s=e[r];s&&t.fitToViewport(s)})},Zn=()=>{De!==null||_e.size===0||(De=window.requestAnimationFrame(()=>{De=null,Xn(Array.from(_e))}))},Jo=()=>{if(Re)return Re;const n=globalThis.ResizeObserver;return n?(Re=new n(e=>{for(const t of e)t.target instanceof HTMLElement&&Pt.get(t.target)?.fitToViewport({width:t.contentRect.width,height:t.contentRect.height})}),Re):null},Gn=n=>{if(_e.has(n))return;const e=_e.size===0;_e.add(n),Pt.set(n.viewport,n),Jo()?.observe(n.viewport),e&&window.addEventListener("resize",Zn)},Qo=n=>{_e.delete(n)&&(Re?.unobserve(n.viewport),Pt.delete(n.viewport),!(_e.size>0)&&(Re?.disconnect(),Re=null,window.removeEventListener("resize",Zn),De!==null&&(window.cancelAnimationFrame(De),De=null)))},ea=n=>{const e=Go(n),t=n.querySelector('[data-streamdown="mermaid"] svg');if(!e||!t)return null;const r=Vo({viewBox:t.getAttribute("data-oc-mermaid-original-viewbox")??t.getAttribute("viewBox"),width:t.getAttribute("width"),height:t.getAttribute("height")});if(!r)return t.setAttribute("data-oc-mermaid-fitted",""),null;t.setAttribute("data-oc-mermaid-original-viewbox",rn(r));let s=r,i=null,a=null,o=null,l=null;const c=new Map;let d=null;const m=k=>{s=k,t.setAttribute("viewBox",rn(k)),t.removeAttribute("width"),t.removeAttribute("height")},f=k=>{!ne(k.width)||!ne(k.height)||(m(qn(r,k)),t.setAttribute("data-oc-mermaid-fitted",""))},u=()=>{sn(M),f($e(e)),Gn(M)},p=()=>{ze.has(M)&&u()},g=(k,E)=>{p(),m(Xo({currentBox:s,contentBox:r,viewport:$e(e),pointer:k,zoomFactor:E,minScale:Wo,maxScale:Uo}))},w=()=>{const k=$e(e);g({x:k.width/2,y:k.height/2},tn)},C=()=>{const k=$e(e);g({x:k.width/2,y:k.height/2},1/tn)},y=k=>{!k.ctrlKey&&!k.metaKey||(k.preventDefault(),k.stopPropagation(),g(on(k,e),Math.pow(zo,-k.deltaY)))},x=k=>{if(!(k.button!==0||Yo(k.target))){if(p(),k.isPrimary&&(c.clear(),d=null),c.set(k.pointerId,{x:k.clientX,y:k.clientY}),c.size>1){i=null,d=ut(Array.from(c.values()))?.distance??null,e.setPointerCapture?.(k.pointerId),n.setAttribute("data-mermaid-suppress-click","true"),k.preventDefault();return}i=k.pointerId,a={x:k.clientX,y:k.clientY},o=a,l!==null&&(window.clearTimeout(l),l=null),n.removeAttribute("data-mermaid-suppress-click"),e.setPointerCapture?.(k.pointerId),n.setAttribute("data-mermaid-panning","true"),k.preventDefault()}},v=k=>{const E={x:k.clientX,y:k.clientY};if(d!==null&&c.has(k.pointerId)){c.set(k.pointerId,E);const R=ut(Array.from(c.values()));if(R){const N=on({clientX:R.center.x,clientY:R.center.y},e);g(N,R.distance/d),d=R.distance}k.preventDefault();return}i!==k.pointerId||!o||(m(Ho({currentBox:s,viewport:$e(e),delta:{x:E.x-o.x,y:E.y-o.y}})),o=E,a&&qo(a,E)&&n.setAttribute("data-mermaid-suppress-click","true"),k.preventDefault())},S=k=>{if(c.delete(k.pointerId)){if(e.releasePointerCapture?.(k.pointerId),c.size>0){i=null,d=c.size>1?ut(Array.from(c.values()))?.distance??null:null;return}d=null,i=null,a=null,o=null,n.removeAttribute("data-mermaid-panning"),n.hasAttribute("data-mermaid-suppress-click")&&(l=window.setTimeout(()=>{n.removeAttribute("data-mermaid-suppress-click"),l=null},Bo))}};e.addEventListener("wheel",y,{passive:!1}),e.addEventListener("pointerdown",x),e.addEventListener("pointermove",v),e.addEventListener("pointerup",S),e.addEventListener("pointercancel",S);const M={viewport:e,zoomIn:w,zoomOut:C,fit:u,fitToViewport:f,cleanup:()=>{sn(M),Qo(M),e.removeEventListener("wheel",y),e.removeEventListener("pointerdown",x),e.removeEventListener("pointermove",v),e.removeEventListener("pointerup",S),e.removeEventListener("pointercancel",S),l!==null&&window.clearTimeout(l),c.clear(),n.removeAttribute("data-mermaid-panning"),n.removeAttribute("data-mermaid-suppress-click")}};return Zo(M),M},je=new Map,ta={bg:"var(--surface-elevated)",fg:"var(--surface-foreground)",line:"var(--surface-muted-foreground)",accent:"var(--primary-base)",muted:"var(--surface-muted-foreground)",surface:"var(--surface-muted)",border:"var(--interactive-border)"};function na(n,e){const t=`${e}:${n}`,r=je.get(t);if(r)return je.delete(t),je.set(t,r),r;let s;try{s=e==="ascii"?{ascii:Is(n)}:{svg:Ls(n,{...ta,transparent:!0,font:"system-ui, sans-serif"})}}catch{s={}}if(je.set(t,s),je.size>100){const i=je.keys().next().value;i!==void 0&&je.delete(i)}return s}const ra=b.memo(function(e){const t=U.c(5),{svg:r,viewer:s}=e,i=s?"":void 0;let a;t[0]!==r?(a={__html:r},t[0]=r,t[1]=a):a=t[1];let o;return t[2]!==i||t[3]!==a?(o=h.jsx("div",{"data-streamdown":"mermaid","data-oc-mermaid-viewer":i,dangerouslySetInnerHTML:a}),t[2]=i,t[3]=a,t[4]=o):o=t[4],o});function sa(n){const e=U.c(70),{code:t,isIncomplete:r}=n,{theme:s,purpose:i,mermaidControls:a,onShowPopup:o}=ie(),l=de(ia),{t:c}=Se(),d=b.useRef(null),m=b.useRef(null),[f,u]=b.useState(!1),p=b.useRef(null);let g;e[0]!==t?(g=t.trimEnd(),e[0]=t,e[1]=g):g=e[1];const w=g;let C;e[2]!==r||e[3]!==l||e[4]!==w?(C=r?null:na(w,l),e[2]=r,e[3]=l,e[4]=w,e[5]=C):C=e[5];const y=C,x=y?.svg,v=y?.ascii||w;let S,M;e[6]!==i||e[7]!==x?(S=()=>{if(!d.current||!x||i)return;const T=ea(d.current);return m.current=T,()=>{T?.cleanup(),m.current=null}},M=[x,i],e[6]=i,e[7]=x,e[8]=S,e[9]=M):(S=e[8],M=e[9]),b.useEffect(S,M);let k,E;e[10]===Symbol.for("react.memo_cache_sentinel")?(k=()=>()=>{p.current&&clearTimeout(p.current)},E=[],e[10]=k,e[11]=E):(k=e[10],E=e[11]),b.useEffect(k,E);let R;e[12]!==x||e[13]!==s.colors.interactive.border||e[14]!==s.colors.primary.base||e[15]!==s.colors.surface.elevated||e[16]!==s.colors.surface.foreground||e[17]!==s.colors.surface.muted||e[18]!==s.colors.surface.mutedForeground?(R=()=>{const T={"var(--surface-elevated)":s.colors.surface.elevated,"var(--surface-foreground)":s.colors.surface.foreground,"var(--surface-muted-foreground)":s.colors.surface.mutedForeground,"var(--primary-base)":s.colors.primary.base,"var(--surface-muted)":s.colors.surface.muted,"var(--interactive-border)":s.colors.interactive.border};let B=x??"";for(const[re,G]of Object.entries(T))B=B.replaceAll(re,G);return B},e[12]=x,e[13]=s.colors.interactive.border,e[14]=s.colors.primary.base,e[15]=s.colors.surface.elevated,e[16]=s.colors.surface.foreground,e[17]=s.colors.surface.muted,e[18]=s.colors.surface.mutedForeground,e[19]=R):R=e[19];const N=R;let P;e[20]!==o||e[21]!==i||e[22]!==w||e[23]!==c?(P=T=>{if(i||!o||!w||!(T.target instanceof Element)||T.target.closest('button, a, [role="button"]'))return;const B=d.current;if(!B)return;if(B.hasAttribute("data-mermaid-suppress-click")){B.removeAttribute("data-mermaid-suppress-click");return}const re=Array.from(B.closest("[data-markdown-content]")?.querySelectorAll(Ko)??[]),G=`${c("layout.mainTab.diagram")} ${re.indexOf(B)+1}`;o({open:!0,title:G,content:"",metadata:{tool:"mermaid-preview",filename:G},mermaid:{source:w,url:`data:text/plain;charset=utf-8,${encodeURIComponent(w)}`,filename:G}})},e[20]=o,e[21]=i,e[22]=w,e[23]=c,e[24]=P):P=e[24];const _=P;let F;e[25]!==w||e[26]!==x||e[27]!==v?(F=async()=>{(await at(x?w:v)).ok&&(u(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>u(!1),2e3))},e[25]=w,e[26]=x,e[27]=v,e[28]=F):F=e[28];const j=F;let A;e[29]!==N||e[30]!==x?(A=()=>{if(!x)return;const T=URL.createObjectURL(new Blob([N()],{type:"image/svg+xml;charset=utf-8"})),B=document.createElement("a");B.href=T,B.download="diagram.svg",B.click(),URL.revokeObjectURL(T)},e[29]=N,e[30]=x,e[31]=A):A=e[31];const D=A,L=a.showPanZoomControls&&!!x,I=a.download&&!!x,K=!i&&(L||a.copy||I);let W;e[32]!==L||e[33]!==c?(W=L&&h.jsxs(h.Fragment,{children:[h.jsx(Be,{label:c("markdownRenderer.mermaid.actions.zoomInTitle"),icon:"zoom-in",onClick:()=>m.current?.zoomIn()}),h.jsx(Be,{label:c("markdownRenderer.mermaid.actions.zoomOutTitle"),icon:"zoom-out",onClick:()=>m.current?.zoomOut()}),h.jsx(Be,{label:c("markdownRenderer.mermaid.actions.resetViewTitle"),icon:"focus-3",onClick:()=>m.current?.fit()})]}),e[32]=L,e[33]=c,e[34]=W):W=e[34];let q;e[35]!==a.copy||e[36]!==f||e[37]!==j||e[38]!==c?(q=a.copy&&h.jsx(Be,{label:c(f?"markdownRenderer.code.actions.copiedTitle":"markdownRenderer.mermaid.actions.copyTitle"),icon:"file-copy",done:f,onClick:()=>{j()}}),e[35]=a.copy,e[36]=f,e[37]=j,e[38]=c,e[39]=q):q=e[39];let V;e[40]!==I||e[41]!==D||e[42]!==c?(V=I&&h.jsx(Be,{label:c("markdownRenderer.mermaid.actions.downloadSvgTitle"),icon:"download",onClick:D}),e[40]=I,e[41]=D,e[42]=c,e[43]=V):V=e[43];let O;e[44]!==W||e[45]!==q||e[46]!==V?(O=h.jsxs(h.Fragment,{children:[W,q,V]}),e[44]=W,e[45]=q,e[46]=V,e[47]=O):O=e[47];const z=O;let X;e[48]!==z||e[49]!==a.toolbarSlot||e[50]!==K?(X=K&&a.toolbarSlot?er.createPortal(z,a.toolbarSlot):null,e[48]=z,e[49]=a.toolbarSlot,e[50]=K,e[51]=X):X=e[51];let H;e[52]!==z||e[53]!==a.toolbarSlot||e[54]!==K?(H=K&&!a.toolbarSlot&&h.jsx("div",{"data-streamdown":"mermaid-toolbar","data-export-ignore":!0,className:"flex h-6 items-center justify-end gap-0.5 opacity-0 transition-opacity duration-150 focus-within:opacity-100 group-hover/mermaid:opacity-100 pointer-coarse:opacity-100",children:z}),e[52]=z,e[53]=a.toolbarSlot,e[54]=K,e[55]=H):H=e[55];const Z=x?"svg":"ascii";let Y;e[56]!==N||e[57]!==i||e[58]!==x||e[59]!==v?(Y=h.jsx("div",{"data-streamdown":"mermaid-scroll",children:x?h.jsx("div",{"data-streamdown":"mermaid-viewport",children:h.jsx(ra,{svg:i?N():x,viewer:!i})}):h.jsx("pre",{"data-streamdown":"mermaid-ascii",children:v})}),e[56]=N,e[57]=i,e[58]=x,e[59]=v,e[60]=Y):Y=e[60];let Q;e[61]!==_||e[62]!==w||e[63]!==Z||e[64]!==Y?(Q=h.jsx("div",{ref:d,dir:"ltr","data-streamdown":"mermaid-block","data-oc-mermaid-source":w,"data-mermaid-render":Z,onClick:_,children:Y}),e[61]=_,e[62]=w,e[63]=Z,e[64]=Y,e[65]=Q):Q=e[65];let te;return e[66]!==X||e[67]!==H||e[68]!==Q?(te=h.jsxs("div",{"data-streamdown":"mermaid-frame",className:"group/mermaid",children:[X,H,Q]}),e[66]=X,e[67]=H,e[68]=Q,e[69]=te):te=e[69],te}function ia(n){return n.mermaidRenderingMode}function oa(n){const e=U.c(8),{code:t,isIncomplete:r}=n,{settledReply:s,directory:i}=ie(),a=Vr();if(!a){let d;return e[0]!==t?(d=h.jsx("pre",{dir:"ltr",children:h.jsx("code",{children:t})}),e[0]=t,e[1]=d):d=e[1],d}const o=!r,l=i??"";let c;return e[2]!==a||e[3]!==t||e[4]!==s||e[5]!==o||e[6]!==l?(c=h.jsx(a,{code:t,complete:o,reply:s,directory:l}),e[2]=a,e[3]=t,e[4]=s,e[5]=o,e[6]=l,e[7]=c):c=e[7],c}const aa={note:"information",tip:"lightbulb",important:"feedback",warning:"alert",caution:"error-warning"},la={note:"chat.markdown.alert.note",tip:"chat.markdown.alert.tip",important:"chat.markdown.alert.important",warning:"chat.markdown.alert.warning",caution:"chat.markdown.alert.caution"},ca=n=>{const e=U.c(31);let t,r,s;e[0]!==n?({node:r,children:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);const{t:i}=Se();let a,o,l,c,d;if(e[4]!==t||e[5]!==r?.properties.dataOcAlert||e[6]!==s){d=Symbol.for("react.early_return_sentinel");e:{if(a=Rn(r?.properties.dataOcAlert),!a){let y;e[12]!==t||e[13]!==s?(y=h.jsx("blockquote",{...s,dir:"auto",children:t}),e[12]=t,e[13]=s,e[14]=y):y=e[14],d=y;break e}l=s,c="auto",o=a.toUpperCase()}e[4]=t,e[5]=r?.properties.dataOcAlert,e[6]=s,e[7]=a,e[8]=o,e[9]=l,e[10]=c,e[11]=d}else a=e[7],o=e[8],l=e[9],c=e[10],d=e[11];if(d!==Symbol.for("react.early_return_sentinel"))return d;const m=aa[a];let f;e[15]!==m?(f=h.jsx(fe,{name:m,className:"size-4 shrink-0"}),e[15]=m,e[16]=f):f=e[16];const u=la[a];let p;e[17]!==i||e[18]!==u?(p=i(u),e[17]=i,e[18]=u,e[19]=p):p=e[19];let g;e[20]!==p?(g=h.jsx("span",{children:p}),e[20]=p,e[21]=g):g=e[21];let w;e[22]!==o||e[23]!==f||e[24]!==g?(w=h.jsxs("p",{"data-oc-alert-title":o,children:[f,g]}),e[22]=o,e[23]=f,e[24]=g,e[25]=w):w=e[25];let C;return e[26]!==t||e[27]!==w||e[28]!==l||e[29]!==c?(C=h.jsxs("blockquote",{...l,dir:c,children:[w,t]}),e[26]=t,e[27]=w,e[28]=l,e[29]=c,e[30]=C):C=e[30],C},da="openchamber-md",tt={background:"transparent",foreground:"var(--md-syntax-foreground)",comment:"var(--md-syntax-comment)",keyword:"var(--md-syntax-keyword)",string:"var(--md-syntax-string)",number:"var(--md-syntax-number)",function:"var(--md-syntax-function)",variable:"var(--md-syntax-variable)",type:"var(--md-syntax-type)",operator:"var(--md-syntax-operator)"},ua=Object.fromEntries(Object.keys(Hr({base:tt})).map(n=>[n,`var(--md-token-${n})`])),an={name:da,colors:{"editor.background":"transparent","editor.foreground":tt.foreground},tokenColors:[...Ts({base:tt,tokens:ua}),{scope:["markup.bold","punctuation.definition.bold"],settings:{fontStyle:"bold"}},{scope:["markup.italic","punctuation.definition.italic"],settings:{fontStyle:"italic"}},{scope:["markup.heading","markup.heading entity.name"],settings:{foreground:tt.keyword,fontStyle:"bold"}},{scope:["markup.inserted","punctuation.definition.inserted"],settings:{foreground:"var(--md-syntax-inserted)"}},{scope:["markup.deleted","punctuation.definition.deleted","invalid","invalid.illegal"],settings:{foreground:"var(--md-syntax-deleted)"}}]};function fa(n){n=n.map(a=>{const o=[];for(const l of a){const c=o.at(-1);c&&/^\s+$/.test(c.content)&&c.offset+c.content.length===l.offset&&c.bgColor===l.bgColor&&(c.fontStyle??0)===(l.fontStyle??0)&&!((l.fontStyle??0)&12)?o[o.length-1]={...l,offset:c.offset,content:c.content+l.content}:o.push(l)}return o});const e=new Uint32Array(n.length+1),t=new Uint32Array(n.reduce((a,o)=>a+o.length,0)*3),r=[],s=new Map;let i=0;return n.forEach((a,o)=>{e[o]=i;for(const l of a){const c=Math.max(0,l.fontStyle??0),d=JSON.stringify([l.color,l.bgColor,c]);let m=s.get(d);m===void 0&&(m=r.length,s.set(d,m),r.push({color:l.color,bgColor:l.bgColor,fontStyle:c})),t[i++]=l.offset,t[i++]=l.content.length,t[i++]=m}}),e[n.length]=i,{lines:e,spans:t,styles:r}}function ft(n,e){const{lines:t,spans:r}=e,s=e.styles.map(({color:a,bgColor:o,fontStyle:l})=>{const c={};return l&1&&(c.fontStyle="italic"),l&2&&(c.fontWeight="bold"),l&12&&(c.textDecoration=[l&4?"underline":"",l&8?"line-through":""].filter(Boolean).join(" ")),{color:a,bgColor:o,htmlStyle:c}}),i=[];for(let a=0;a<t.length-1;a++){const o=[];for(let l=t[a];l<t[a+1];l+=3){const c=r[l];o.push({...s[r[l+2]],offset:c,content:n.slice(c,c+r[l+1])})}i.push(o)}return{tokens:i}}const ln=(n,e)=>`highlight:${e}:${Qr(n)}`;function cn(n,e){if(e.startsWith(n.code))return n.result.tokens.length-1;const t=Math.min(n.code.length,e.length);let r=0,s=0;for(;r<t&&n.code.charCodeAt(r)===e.charCodeAt(r);)e[r]===`
7
7
  `&&s++,r++;return s}const ma=(n,e)=>n.length===e.length&&n.every((t,r)=>{const s=e[r];return t.content===s.content&&t.offset===s.offset&&t.color===s.color&&t.bgColor===s.bgColor&&JSON.stringify(t.htmlStyle)===JSON.stringify(s.htmlStyle)});class ha{worker=null;workerUrl=null;creation=null;loading=null;pending=new Map;inflight=new Map;completed=new gn({maxEntries:2e3,maxBytes:24*1024*1024});recent=[];snapshots=[];disposed=!1;sequence=0;lineage=0;mainThreadPrevious=[];constructor(){zt()}cached(e,t,r=!1){const s=ln(e,t),i=this.completed.get(s);if(i)return"result"in i?i.result:void 0;const a=this.recent.find(o=>o.key===s)?.result;return a&&!r&&this.remember(s,a),a??this.highlightOnMainThread(s,e,t,r)}highlightOnMainThread(e,t,r,s){const i=qr(r);if(!i||this.disposed)return;const a=ft(t,fa(Xr(i,t)));let o,l=0;for(const c of this.mainThreadPrevious){if(c.language!==r)continue;const d=cn(c,t);d>l&&(l=d,o=c)}for(let c=0;o&&c<l;c++)ma(o.result.tokens[c],a.tokens[c])&&(a.tokens[c]=o.result.tokens[c]);return this.mainThreadPrevious=[{code:t,language:r,result:a},...this.mainThreadPrevious.filter(c=>c!==o)].slice(0,4),s?this.recent=[{key:e,result:a},...this.recent.filter(c=>c.key!==e)].slice(0,4):this.remember(e,a),a}remember(e,t){let r=Te(e);for(const s of t.tokens){r+=32;for(const i of s)r+=160+Te(i.content)+Te(i.color??"")+Te(i.bgColor??"")}this.completed.set(e,{result:t},r)}highlight(e,t,r){if(this.disposed)return Promise.resolve(null);const s=ln(e,t),i=this.cached(e,t,r);return i?Promise.resolve(i):Zr()?this.highlightInWorker(s,e,t,r):zt().then(()=>this.cached(e,t,r)??this.highlightInWorker(s,e,t,r))}highlightInWorker(e,t,r,s){if(this.disposed)return Promise.resolve(null);const i=this.completed.get(e);if(i&&"failed"in i)return Promise.resolve(null);if(s)return this.highlightSource(e,t,r,!0).catch(()=>null);const a=this.inflight.get(e);if(a)return a;const o=this.highlightSource(e,t,r,!1).catch(()=>null).finally(()=>{this.inflight.get(e)===o&&this.inflight.delete(e)});return this.inflight.set(e,o),o}async highlightSource(e,t,r,s){const i=Gr.incrementalHighlight(),a=s&&i&&t.length<=256*1024&&!t.includes("\r");let o,l=0;if(a)for(const u of this.snapshots){if(u.language!==r)continue;const p=cn(u,t);p>l&&(l=p,o=u)}const c=++this.sequence,d={id:c,code:t,language:r,fullPass:!i};a&&(d.fromLine=l);let m=await this.request(d);if(this.disposed||(m.status==="timeout"&&this.completed.set(e,{failed:!0},Te(e)),m.status!=="ok"||"error"in m.response))return null;let f=ft(t,m.response.result);if(o&&(f.tokens=o.result.tokens.slice(0,l).concat(f.tokens)),f.tokens.length!==t.split(/\r\n|\n|\r/).length){if(!a||(m=await this.request({id:++this.sequence,code:t,language:r,fullPass:!i}),this.disposed)||(m.status==="timeout"&&this.completed.set(e,{failed:!0},Te(e)),m.status!=="ok"||"error"in m.response)||(f=ft(t,m.response.result),f.tokens.length!==t.split(/\r\n|\n|\r/).length))return null}else if(a){const u=o?.lineage??this.lineage++,p=this.snapshots.find(g=>g.lineage===u);(!p||p.seq<c)&&(this.snapshots=[{code:t,language:r,result:f,lineage:u,seq:c},...this.snapshots.filter(g=>g.lineage!==u)].slice(0,4))}return s?this.recent=[{key:e,result:f},...this.recent.filter(u=>u.key!==e)].slice(0,4):this.remember(e,f),f}request(e){return new Promise(t=>{const r={request:e,resolve:t};this.pending.set(e.id,r),this.dispatch(r)})}async createWorker(){const e=globalThis.Worker;if(!e)return null;if(Yr(null)){const t=new AbortController;this.loading=t;const{default:r}=await St(async()=>{const{default:o}=await import("./streamdown-code.worker-Bj01ezrH.js");return{default:o}},[]),s=await fetch(r,{signal:t.signal});if(!s.ok)throw new Error("Code worker could not load");const i=await s.blob();if(this.disposed||t.signal.aborted)return null;const a=URL.createObjectURL(i);try{return{worker:new e(a,{type:"module",name:"streamdown-code"}),objectUrl:a}}catch(o){throw URL.revokeObjectURL(a),o}}return{worker:new Worker(new URL("/assets/streamdown-code.worker-DqkaXF01.js",import.meta.url),{type:"module",name:"streamdown-code"})}}getWorker(){return this.worker?Promise.resolve(this.worker):(this.creation??=this.createWorker().then(e=>{if(!e)return null;const{worker:t,objectUrl:r}=e;return this.disposed?(t.terminate(),r&&URL.revokeObjectURL(r),null):(this.worker=t,this.workerUrl=r??null,t.onmessage=({data:s})=>{if(this.worker!==t)return;const i=this.pending.get(s.id);i&&this.finish(i,{status:"ok",response:s})},t.onerror=t.onmessageerror=()=>{this.worker===t&&this.failAll()},t)}).catch(()=>null).finally(()=>{this.creation=null}),this.creation)}async dispatch(e){const t=await this.getWorker();if(!(this.disposed||this.pending.get(e.request.id)!==e)){if(!t){this.finish(e,{status:"failed"});return}e.timer=setTimeout(()=>this.timeout(e),Jr);try{t.postMessage(e.request)}catch{this.failAll()}}}timeout(e){if(this.pending.get(e.request.id)===e){for(const t of this.pending.values())clearTimeout(t.timer);this.stopWorker(),this.finish(e,{status:"timeout"});for(const t of this.pending.values())this.dispatch(t)}}finish(e,t){clearTimeout(e.timer),this.pending.delete(e.request.id),e.resolve(t)}failAll(){this.stopWorker();for(const e of this.pending.values())this.finish(e,{status:"failed"});this.inflight.clear()}stopWorker(){this.loading?.abort(),this.loading=null,this.worker?.terminate(),this.worker=null,this.workerUrl&&URL.revokeObjectURL(this.workerUrl),this.workerUrl=null}dispose(){this.disposed=!0,this.failAll(),this.completed.clear(),this.recent=[],this.snapshots=[],this.mainThreadPrevious=[]}}const dn=new ha,pa=Cn.map(n=>n.id),ga=new Set(Cn.flatMap(n=>[n.id,...n.aliases??[]])),wa=[an,an];function mt(n){return n.trim().toLowerCase()||"text"}function yt(n){return{tokens:n.split(`
8
8
  `).map(e=>[{content:e}])}}function ya(n,e){const t=e?200:n.isIncomplete?300:1200;let r=1;for(let s=0;s<n.code.length;s++)if(n.code.charCodeAt(s)===10&&++r>t)return!1;return!0}function xa(n,e){if(!e.length)return n;let t=0;const r=n.tokens.map(s=>{let i=t,a=!1;const o=s.flatMap(l=>{const c=l.offset??i,d=c+l.content.length;i=d;const m=e.filter(p=>p.start<d&&p.end>c);if(!m.length)return[l];a=!0;const f=new Set([c,d]);for(const p of m)p.start>c&&p.start<d&&f.add(p.start),p.end>c&&p.end<d&&f.add(p.end);const u=[...f].sort((p,g)=>p-g);return u.slice(0,-1).map((p,g)=>{const w=u[g+1],C=m.find(y=>y.start<=p&&y.end>=w);return{...l,offset:p,content:l.content.slice(p-c,w-c),htmlAttrs:C?{...l.htmlAttrs,"data-openchamber-file-link":"true","data-openchamber-file-ref":C.raw,"data-openchamber-file-path":C.path,role:"button",tabIndex:"0"}:l.htmlAttrs}})});return t=i+1,a?o:s});return{...n,tokens:r}}function Yn(n){const e=new WeakMap,t=new Map,r=s=>{const i=n.prepared?.get(s.language)?.get(s.code);if(i)return i;if(n.purpose==="copy"||!ya(s,n.isVSCode))return yt(s.code);const a=mt(s.language),o=dn.cached(s.code,a,s.isIncomplete??!1);return o?e.get(o)??o:null};return{name:"shiki",type:"code-highlighter",getSupportedLanguages:()=>pa,getThemes:()=>wa,supportsLanguage:s=>ga.has(mt(s)),cached:r,highlight(s,i){const a=c=>{const d=e.get(c);if(d)return d;if(n.resolvePaths){let m=t.get(s.code);m||(m=n.resolvePaths(s.code),t.set(s.code,m),m.finally(()=>t.delete(s.code)).catch(()=>{})),m.then(f=>{if(!f.length)return;const u=e.get(c)??xa(c,f);e.set(c,u),e.set(u,u),i?.(u)}).catch(()=>{})}return c},o=r(s);if(o)return n.prepared?.get(s.language)?.has(s.code)?o:a(o);const l=mt(s.language);return dn.highlight(s.code,l,s.isIncomplete??!1).then(c=>i?.(a(c??yt(s.code)))),null}}}async function fl(n,e){const t=Yn({isVSCode:!1});return new Promise(r=>{const s=setTimeout(()=>r(yt(n)),5e3),i=o=>{clearTimeout(s),r(o)},a=t.highlight({code:n,language:e,themes:t.getThemes()},i);a&&i(a)})}const ba=/^(?:\uFEFF)?(---|\+\+\+)[^\S\r\n]*\r?\n([\s\S]*?)\r?\n\1[^\S\r\n]*(?:\r?\n|$)/,xt=n=>pt(n)?String(n.value??""):En(n).trimEnd(),ka=n=>n?pt(n)?{kind:"text",text:xt(n)}:Fs(n)&&n.items.every(e=>pt(e))?{kind:"list",items:n.items.map(e=>xt(e))}:{kind:"code",text:En(n).trimEnd()}:{kind:"text",text:""},va=(n,e)=>{if(n!=="---")return{kind:"raw",text:e};const t=$s(e);return t.errors.length>0?{kind:"raw",text:e}:t.contents===null?null:Os(t.contents)?{kind:"properties",properties:t.contents.items.map(r=>({key:r.key?xt(r.key):"",value:ka(r.value)}))}:{kind:"raw",text:e}},Sa=n=>{const e=n.match(ba);return e?{frontmatter:va(e[1],e[2]),body:n.slice(e[0].length)}:{frontmatter:null,body:n}},Ma=24,Ca=(n,e)=>{let t=0;for(const r of n.split(`