@flamingo-stack/openframe-frontend-core 0.0.626 → 0.0.627

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 (191) hide show
  1. package/dist/{chunk-2CCIF5QV.js → chunk-25UWKNII.js} +10 -8
  2. package/dist/{chunk-2CCIF5QV.js.map → chunk-25UWKNII.js.map} +1 -1
  3. package/dist/{chunk-BVCWBA2U.js → chunk-2J7EFH4V.js} +817 -395
  4. package/dist/chunk-2J7EFH4V.js.map +1 -0
  5. package/dist/{chunk-X3LC6R37.js → chunk-32P6KUZP.js} +2 -2
  6. package/dist/{chunk-3LKJ6JWZ.cjs → chunk-4E3UZZ2J.cjs} +34 -34
  7. package/dist/{chunk-3LKJ6JWZ.cjs.map → chunk-4E3UZZ2J.cjs.map} +1 -1
  8. package/dist/{chunk-EHAYNUOL.cjs → chunk-4E7XCEV3.cjs} +77 -2
  9. package/dist/chunk-4E7XCEV3.cjs.map +1 -0
  10. package/dist/{chunk-KK7YEVTQ.js → chunk-4PIHIFJM.js} +4 -4
  11. package/dist/{chunk-VOBOO7EF.cjs → chunk-4SXZT7JP.cjs} +83 -83
  12. package/dist/{chunk-VOBOO7EF.cjs.map → chunk-4SXZT7JP.cjs.map} +1 -1
  13. package/dist/{chunk-ESSHEVZQ.cjs → chunk-53ARMJHM.cjs} +38 -38
  14. package/dist/chunk-53ARMJHM.cjs.map +1 -0
  15. package/dist/{chunk-Q5XGBLT5.cjs → chunk-55X46LKR.cjs} +509 -87
  16. package/dist/chunk-55X46LKR.cjs.map +1 -0
  17. package/dist/{chunk-DLZFFGQ7.js → chunk-5E55S5SI.js} +4 -4
  18. package/dist/{chunk-U7TTQV4N.cjs → chunk-6I3KNDBF.cjs} +3 -3
  19. package/dist/{chunk-U7TTQV4N.cjs.map → chunk-6I3KNDBF.cjs.map} +1 -1
  20. package/dist/{chunk-S6WBBSII.js → chunk-76HB456V.js} +5 -5
  21. package/dist/{chunk-Z42VU7HF.cjs → chunk-BC726XIQ.cjs} +49 -47
  22. package/dist/chunk-BC726XIQ.cjs.map +1 -0
  23. package/dist/{chunk-LJ7KMQRM.cjs → chunk-BJGAFPG5.cjs} +42 -42
  24. package/dist/{chunk-LJ7KMQRM.cjs.map → chunk-BJGAFPG5.cjs.map} +1 -1
  25. package/dist/{chunk-F4TAUCHQ.js → chunk-CAQ5MNLJ.js} +3 -3
  26. package/dist/{chunk-QR2FJE2C.js → chunk-CK2CPZXB.js} +12 -12
  27. package/dist/{chunk-YQCA4ZEJ.js → chunk-CMUNJZWN.js} +2 -2
  28. package/dist/{chunk-H7KQM3VI.js → chunk-DH3YH3TV.js} +8 -8
  29. package/dist/{chunk-E7YNDGRN.cjs → chunk-FR6EDA3P.cjs} +105 -105
  30. package/dist/{chunk-E7YNDGRN.cjs.map → chunk-FR6EDA3P.cjs.map} +1 -1
  31. package/dist/{chunk-QPQCQWAW.cjs → chunk-G46NJNTL.cjs} +28 -26
  32. package/dist/chunk-G46NJNTL.cjs.map +1 -0
  33. package/dist/{chunk-RQQAPCOU.js → chunk-G47XRVZA.js} +3 -3
  34. package/dist/{chunk-QJ6BCSFQ.cjs → chunk-GQ7267OV.cjs} +5 -5
  35. package/dist/{chunk-QJ6BCSFQ.cjs.map → chunk-GQ7267OV.cjs.map} +1 -1
  36. package/dist/{chunk-RVK3CL5S.js → chunk-HIZAMJPT.js} +12 -12
  37. package/dist/{chunk-DZ7CEES3.js → chunk-J6ATJUEE.js} +5 -5
  38. package/dist/{chunk-DZ7CEES3.js.map → chunk-J6ATJUEE.js.map} +1 -1
  39. package/dist/{chunk-5LIDR7HL.js → chunk-JRYS4VMV.js} +4 -79
  40. package/dist/{chunk-5LIDR7HL.js.map → chunk-JRYS4VMV.js.map} +1 -1
  41. package/dist/{chunk-RGMUA4XB.js → chunk-KXDYBRRR.js} +7 -7
  42. package/dist/{chunk-IJYP2DMW.js → chunk-L5FEAOGJ.js} +8 -354
  43. package/dist/chunk-L5FEAOGJ.js.map +1 -0
  44. package/dist/{chunk-L54LFB6V.cjs → chunk-N6XNJX25.cjs} +15 -15
  45. package/dist/{chunk-L54LFB6V.cjs.map → chunk-N6XNJX25.cjs.map} +1 -1
  46. package/dist/{chunk-WEDSYUSR.js → chunk-NLADJ4IX.js} +6 -6
  47. package/dist/{chunk-HTIDXF43.cjs → chunk-OAXASIVG.cjs} +7 -7
  48. package/dist/{chunk-HTIDXF43.cjs.map → chunk-OAXASIVG.cjs.map} +1 -1
  49. package/dist/{chunk-3IXDZI3R.cjs → chunk-P7UT2YSC.cjs} +3 -3
  50. package/dist/{chunk-3IXDZI3R.cjs.map → chunk-P7UT2YSC.cjs.map} +1 -1
  51. package/dist/{chunk-P7KIFYZI.js → chunk-PKSH6PAK.js} +10 -8
  52. package/dist/{chunk-P7KIFYZI.js.map → chunk-PKSH6PAK.js.map} +1 -1
  53. package/dist/{chunk-MZWSJPDZ.js → chunk-PTP5LSYM.js} +16 -28
  54. package/dist/{chunk-MZWSJPDZ.js.map → chunk-PTP5LSYM.js.map} +1 -1
  55. package/dist/{chunk-CPO5KPW6.cjs → chunk-QCSWM3VU.cjs} +9 -9
  56. package/dist/{chunk-CPO5KPW6.cjs.map → chunk-QCSWM3VU.cjs.map} +1 -1
  57. package/dist/{chunk-JJUV7Z4L.cjs → chunk-QIVX7F3N.cjs} +27 -27
  58. package/dist/{chunk-JJUV7Z4L.cjs.map → chunk-QIVX7F3N.cjs.map} +1 -1
  59. package/dist/{chunk-NZJNXGU2.cjs → chunk-R3SJ6PMI.cjs} +280 -292
  60. package/dist/chunk-R3SJ6PMI.cjs.map +1 -0
  61. package/dist/{chunk-2MMEPNSX.cjs → chunk-RAPPN6MN.cjs} +3 -3
  62. package/dist/{chunk-2MMEPNSX.cjs.map → chunk-RAPPN6MN.cjs.map} +1 -1
  63. package/dist/{chunk-S43SLJIN.cjs → chunk-SLT5C3PQ.cjs} +25 -25
  64. package/dist/{chunk-S43SLJIN.cjs.map → chunk-SLT5C3PQ.cjs.map} +1 -1
  65. package/dist/{chunk-FKBM6U43.js → chunk-USIRWQJ3.js} +76 -1
  66. package/dist/{chunk-FKBM6U43.js.map → chunk-USIRWQJ3.js.map} +1 -1
  67. package/dist/{chunk-CCWI3622.cjs → chunk-VOZZQ6HQ.cjs} +4 -4
  68. package/dist/{chunk-CCWI3622.cjs.map → chunk-VOZZQ6HQ.cjs.map} +1 -1
  69. package/dist/{chunk-3POP5WWC.cjs → chunk-VUAEDAUN.cjs} +6 -6
  70. package/dist/{chunk-3POP5WWC.cjs.map → chunk-VUAEDAUN.cjs.map} +1 -1
  71. package/dist/{chunk-34GEH24Y.cjs → chunk-VZQ3VVFH.cjs} +22 -20
  72. package/dist/chunk-VZQ3VVFH.cjs.map +1 -0
  73. package/dist/{chunk-ZIEYC6ZB.js → chunk-WZ6CUZMM.js} +4 -4
  74. package/dist/{chunk-F2KBCLUG.js → chunk-X5NN4NJM.js} +2 -2
  75. package/dist/{chunk-IZG3VYDV.js → chunk-Y3MIFC5M.js} +4 -4
  76. package/dist/{chunk-63F2UQDW.cjs → chunk-ZCQVUIPH.cjs} +18 -18
  77. package/dist/{chunk-63F2UQDW.cjs.map → chunk-ZCQVUIPH.cjs.map} +1 -1
  78. package/dist/{chunk-NLVBO3IR.js → chunk-ZGZ7YAJH.js} +10 -8
  79. package/dist/{chunk-NLVBO3IR.js.map → chunk-ZGZ7YAJH.js.map} +1 -1
  80. package/dist/{chunk-YXWGSDK4.cjs → chunk-ZI27ALYX.cjs} +5 -80
  81. package/dist/chunk-ZI27ALYX.cjs.map +1 -0
  82. package/dist/{chunk-BVQEU5JB.js → chunk-ZOMGXH7C.js} +2 -2
  83. package/dist/{chunk-MSVEZB5D.cjs → chunk-ZYDNPUSH.cjs} +279 -625
  84. package/dist/chunk-ZYDNPUSH.cjs.map +1 -0
  85. package/dist/components/case-studies/index.cjs +14 -14
  86. package/dist/components/case-studies/index.js +8 -8
  87. package/dist/components/chat/entity-cards/ai-prompt-card.d.ts +2 -1
  88. package/dist/components/chat/entity-cards/ai-prompt-card.d.ts.map +1 -1
  89. package/dist/components/chat/entity-cards/employee-entry-card.d.ts +3 -3
  90. package/dist/components/chat/entity-cards/employee-entry-card.d.ts.map +1 -1
  91. package/dist/components/chat/entity-cards/entity-author-card.d.ts +8 -6
  92. package/dist/components/chat/entity-cards/entity-author-card.d.ts.map +1 -1
  93. package/dist/components/chat/index.cjs +5 -5
  94. package/dist/components/chat/index.js +4 -4
  95. package/dist/components/contact/index.cjs +9 -9
  96. package/dist/components/contact/index.js +8 -8
  97. package/dist/components/docs/index.cjs +12 -12
  98. package/dist/components/docs/index.js +11 -11
  99. package/dist/components/embeds/index.cjs +9 -9
  100. package/dist/components/embeds/index.js +8 -8
  101. package/dist/components/faq/index.cjs +10 -10
  102. package/dist/components/faq/index.js +9 -9
  103. package/dist/components/features/index.cjs +8 -8
  104. package/dist/components/features/index.js +7 -7
  105. package/dist/components/help-center-pages/index.cjs +31 -31
  106. package/dist/components/help-center-pages/index.js +22 -22
  107. package/dist/components/index.cjs +75 -69
  108. package/dist/components/index.cjs.map +1 -1
  109. package/dist/components/index.js +30 -24
  110. package/dist/components/index.js.map +1 -1
  111. package/dist/components/meeting-scheduler/index.cjs +49 -49
  112. package/dist/components/meeting-scheduler/index.js +9 -9
  113. package/dist/components/navigation/index.cjs +11 -11
  114. package/dist/components/navigation/index.js +10 -10
  115. package/dist/components/onboarding-guides/index.cjs +12 -12
  116. package/dist/components/onboarding-guides/index.js +11 -11
  117. package/dist/components/related-content/card-registry.d.ts.map +1 -1
  118. package/dist/components/related-content/index.cjs +6 -6
  119. package/dist/components/related-content/index.js +5 -5
  120. package/dist/components/tickets/index.cjs +13 -13
  121. package/dist/components/tickets/index.js +12 -12
  122. package/dist/components/ui/color-preset-select.d.ts +4 -5
  123. package/dist/components/ui/color-preset-select.d.ts.map +1 -1
  124. package/dist/components/ui/department-badge.d.ts +21 -0
  125. package/dist/components/ui/department-badge.d.ts.map +1 -0
  126. package/dist/components/ui/index.cjs +14 -8
  127. package/dist/components/ui/index.cjs.map +1 -1
  128. package/dist/components/ui/index.d.ts +2 -0
  129. package/dist/components/ui/index.d.ts.map +1 -1
  130. package/dist/components/ui/index.js +13 -7
  131. package/dist/components/ui/palette-badge.d.ts +22 -0
  132. package/dist/components/ui/palette-badge.d.ts.map +1 -0
  133. package/dist/hooks/index.cjs +5 -5
  134. package/dist/hooks/index.js +4 -4
  135. package/dist/index.cjs +28 -18
  136. package/dist/index.cjs.map +1 -1
  137. package/dist/index.js +50 -40
  138. package/dist/index.js.map +1 -1
  139. package/dist/types/department.d.ts +4 -0
  140. package/dist/types/department.d.ts.map +1 -1
  141. package/dist/utils/color-presets.d.ts +24 -0
  142. package/dist/utils/color-presets.d.ts.map +1 -0
  143. package/dist/utils/index.cjs +32 -0
  144. package/dist/utils/index.cjs.map +1 -1
  145. package/dist/utils/index.d.ts +1 -0
  146. package/dist/utils/index.d.ts.map +1 -1
  147. package/dist/utils/index.js +30 -1
  148. package/dist/utils/index.js.map +1 -1
  149. package/package.json +1 -1
  150. package/src/components/chat/entity-cards/ai-prompt-card.tsx +7 -4
  151. package/src/components/chat/entity-cards/employee-entry-card.tsx +21 -24
  152. package/src/components/chat/entity-cards/entity-author-card.tsx +10 -4
  153. package/src/components/related-content/card-registry.tsx +3 -1
  154. package/src/components/ui/.department-badge.md +2 -0
  155. package/src/components/ui/.palette-badge.md +2 -0
  156. package/src/components/ui/__tests__/department-badge.test.tsx +47 -0
  157. package/src/components/ui/color-preset-select.tsx +5 -21
  158. package/src/components/ui/department-badge.tsx +35 -0
  159. package/src/components/ui/index.ts +2 -0
  160. package/src/components/ui/palette-badge.tsx +39 -0
  161. package/src/types/department.ts +4 -0
  162. package/src/utils/.color-presets.md +2 -0
  163. package/src/utils/color-presets.ts +48 -0
  164. package/src/utils/index.ts +1 -0
  165. package/dist/chunk-34GEH24Y.cjs.map +0 -1
  166. package/dist/chunk-BVCWBA2U.js.map +0 -1
  167. package/dist/chunk-EHAYNUOL.cjs.map +0 -1
  168. package/dist/chunk-ESSHEVZQ.cjs.map +0 -1
  169. package/dist/chunk-IJYP2DMW.js.map +0 -1
  170. package/dist/chunk-MSVEZB5D.cjs.map +0 -1
  171. package/dist/chunk-NZJNXGU2.cjs.map +0 -1
  172. package/dist/chunk-Q5XGBLT5.cjs.map +0 -1
  173. package/dist/chunk-QPQCQWAW.cjs.map +0 -1
  174. package/dist/chunk-YXWGSDK4.cjs.map +0 -1
  175. package/dist/chunk-Z42VU7HF.cjs.map +0 -1
  176. /package/dist/{chunk-X3LC6R37.js.map → chunk-32P6KUZP.js.map} +0 -0
  177. /package/dist/{chunk-KK7YEVTQ.js.map → chunk-4PIHIFJM.js.map} +0 -0
  178. /package/dist/{chunk-DLZFFGQ7.js.map → chunk-5E55S5SI.js.map} +0 -0
  179. /package/dist/{chunk-S6WBBSII.js.map → chunk-76HB456V.js.map} +0 -0
  180. /package/dist/{chunk-F4TAUCHQ.js.map → chunk-CAQ5MNLJ.js.map} +0 -0
  181. /package/dist/{chunk-QR2FJE2C.js.map → chunk-CK2CPZXB.js.map} +0 -0
  182. /package/dist/{chunk-YQCA4ZEJ.js.map → chunk-CMUNJZWN.js.map} +0 -0
  183. /package/dist/{chunk-H7KQM3VI.js.map → chunk-DH3YH3TV.js.map} +0 -0
  184. /package/dist/{chunk-RQQAPCOU.js.map → chunk-G47XRVZA.js.map} +0 -0
  185. /package/dist/{chunk-RVK3CL5S.js.map → chunk-HIZAMJPT.js.map} +0 -0
  186. /package/dist/{chunk-RGMUA4XB.js.map → chunk-KXDYBRRR.js.map} +0 -0
  187. /package/dist/{chunk-WEDSYUSR.js.map → chunk-NLADJ4IX.js.map} +0 -0
  188. /package/dist/{chunk-ZIEYC6ZB.js.map → chunk-WZ6CUZMM.js.map} +0 -0
  189. /package/dist/{chunk-F2KBCLUG.js.map → chunk-X5NN4NJM.js.map} +0 -0
  190. /package/dist/{chunk-IZG3VYDV.js.map → chunk-Y3MIFC5M.js.map} +0 -0
  191. /package/dist/{chunk-BVQEU5JB.js.map → chunk-ZOMGXH7C.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-QPQCQWAW.cjs","../src/components/platform/SoftwareInfo.tsx","../src/components/platform/SoftwareSourceBadge.tsx","../src/components/platform/CveLink.tsx","../src/components/platform/ToolBadge.tsx","../src/components/platform/ShellTypeBadge.tsx","../src/components/platform/ScriptInfoSection.tsx","../src/components/platform/ScriptArguments.tsx","../src/components/shared/onboarding/onboarding-step-card.tsx","../src/components/shared/onboarding/onboarding-walkthrough.tsx"],"names":["jsx","jsxs","cn"],"mappings":"AAAA,6xBAAY;AACZ;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACzBM,+CAAA;AAHC,IAAM,aAAA,EAA4C,CAAC,EAAE,IAAA,EAAM,MAAA,EAAQ,OAAA,EAAS,UAAU,CAAA,EAAA,GAAM;AACjG,EAAA,uBACE,8BAAA,KAAC,EAAA,EAAI,SAAA,EAAW,kCAAA,qBAAG,EAAuB,SAAS,CAAA,EACjD,QAAA,EAAA;AAAA,oBAAA,8BAAA,KAAC,EAAA,EAAI,SAAA,EAAU,yBAAA,EACb,QAAA,EAAA;AAAA,sBAAA,6BAAA,KAAC,EAAA,EAAI,SAAA,EAAU,+BAAA,EAAiC,QAAA,EAAA,KAAA,CAAK,CAAA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AA;AACZ,QAAA;AACF,MAAA;AAGuC,MAAA;AAEnC,MAAA;AACkB,QAAA;AAGwB,QAAA;AACZ,UAAA;AAC9B,UAAA;AACF,QAAA;AAGkC,QAAA;AACpB,UAAA;AACQ,UAAA;AACpB,UAAA;AACF,QAAA;AAGwB,QAAA;AAClB,UAAA;AAC0C,YAAA;AACH,YAAA;AAGD,YAAA;AAClB,cAAA;AACtB,YAAA;AACc,UAAA;AACkC,YAAA;AAClD,UAAA;AACF,QAAA;AACA,MAAA;AAE0C,QAAA;AAC5C,MAAA;AACF,IAAA;AACmC,IAAA;AACrC,EAAA;AAEuD,EAAA;AACvC,oBAAA;AACK,IAAA;AACrB,EAAA;AAE4B,EAAA;AACR,IAAA;AACN,oBAAA;AACd,EAAA;AAIqB,EAAA;AACZ,IAAA;AACT,EAAA;AAE4C,EAAA;AAGvB,EAAA;AAEF,oBAAA;AACE,sBAAA;AAGR,MAAA;AAUT,IAAA;AAIG,oBAAA;AACE,MAAA;AAAA,MAAA;AAEC,QAAA;AACmC,QAAA;AACH,QAAA;AACV,QAAA;AACe,QAAA;AACJ,QAAA;AAAA,MAAA;AANvB,MAAA;AAShB,IAAA;AACF,EAAA;AAEJ;ATkT4D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-QPQCQWAW.cjs","sourcesContent":[null,"/**\n * SoftwareInfo Component\n *\n * Displays software name with optional vendor information below it.\n * Part of the ODS (OpenFrame Design System) platform components.\n *\n * @example\n * ```tsx\n * <SoftwareInfo name=\"Visual Studio Code\" vendor=\"Microsoft\" />\n * <SoftwareInfo name=\"Chrome\" /> // Without vendor\n * ```\n */\n\nimport type React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport interface SoftwareInfoProps {\n /** Software name (required) */\n name: string;\n /** Software vendor (optional) */\n vendor?: string;\n /** Software version (optional) */\n version?: string;\n /** Additional CSS classes */\n className?: string;\n}\n\nexport const SoftwareInfo: React.FC<SoftwareInfoProps> = ({ name, vendor, version, className }) => {\n return (\n <div className={cn('flex flex-col gap-1', className)}>\n <div className=\"flex items-center gap-2\">\n <div className=\"text-ods-text-primary text-h4\">{name}</div>\n {version && (\n <div className=\"rounded bg-ods-bg-surface px-2 py-1 text-ods-text-secondary text-h6\">{version}</div>\n )}\n </div>\n {vendor && <div className=\"text-ods-text-secondary text-h6\">{vendor}</div>}\n </div>\n );\n};\n\nSoftwareInfo.displayName = 'SoftwareInfo';\n","/**\n * SoftwareSourceBadge Component\n *\n * Displays a badge for software source types from Fleet MDM.\n * Supports all osquery software source types with appropriate styling.\n *\n * Fleet MDM Software Sources:\n * - apps: macOS Applications\n * - chrome_extensions: Chrome Browser Extensions\n * - firefox_addons: Firefox Browser Extensions\n * - safari_extensions: Safari Browser Extensions\n * - ie_extensions: Internet Explorer Extensions\n * - vscode_extensions: VS Code Extensions\n * - atom_packages: Atom Packages\n * - homebrew_packages: Homebrew Packages (macOS)\n * - npm_packages: NPM Packages\n * - python_packages: Python Packages\n * - apt_sources: APT Packages (Debian/Ubuntu)\n * - deb_packages: DEB Packages\n * - rpm_packages: RPM Packages (Red Hat/CentOS)\n * - yum_sources: YUM Packages\n * - portage_packages: Portage Packages (Gentoo)\n * - chocolatey_packages: Chocolatey Packages (Windows)\n * - programs: Windows Programs\n * - pkg_packages: PKG Packages\n *\n * @example\n * ```tsx\n * <SoftwareSourceBadge source=\"apps\" />\n * <SoftwareSourceBadge source=\"chrome_extensions\" />\n * <SoftwareSourceBadge source=\"python_packages\" />\n * ```\n */\n\nimport type React from 'react';\nimport { cn } from '../../utils/common';\nimport { PackageIcon, WindowsIcon, MacOSIcon, LinuxIcon } from '../icons';\n\nexport type SoftwareSource =\n | 'apps'\n | 'chrome_extensions'\n | 'firefox_addons'\n | 'safari_extensions'\n | 'ie_extensions'\n | 'vscode_extensions'\n | 'atom_packages'\n | 'homebrew_packages'\n | 'npm_packages'\n | 'python_packages'\n | 'apt_sources'\n | 'deb_packages'\n | 'rpm_packages'\n | 'yum_sources'\n | 'portage_packages'\n | 'chocolatey_packages'\n | 'programs'\n | 'pkg_packages';\n\nexport interface SoftwareSourceBadgeProps {\n /** Software source type from Fleet MDM */\n source: SoftwareSource;\n /** Additional CSS classes */\n className?: string;\n}\n\n/**\n * Maps source types to human-readable labels and icons\n */\nconst sourceConfig: Record<SoftwareSource, { label: string; icon: React.ReactNode }> = {\n apps: { label: 'App', icon: <MacOSIcon className=\"h-4 w-4\" /> },\n chrome_extensions: { label: 'Chrome', icon: <PackageIcon className=\"h-4 w-4\" /> },\n firefox_addons: { label: 'Firefox', icon: <PackageIcon className=\"h-4 w-4\" /> },\n safari_extensions: { label: 'Safari', icon: <PackageIcon className=\"h-4 w-4\" /> },\n ie_extensions: { label: 'IE', icon: <PackageIcon className=\"h-4 w-4\" /> },\n vscode_extensions: { label: 'VS Code', icon: <PackageIcon className=\"h-4 w-4\" /> },\n atom_packages: { label: 'Atom', icon: <PackageIcon className=\"h-4 w-4\" /> },\n homebrew_packages: { label: 'Homebrew', icon: <MacOSIcon className=\"h-4 w-4\" /> },\n npm_packages: { label: 'NPM', icon: <PackageIcon className=\"h-4 w-4\" /> },\n python_packages: { label: 'Python', icon: <PackageIcon className=\"h-4 w-4\" /> },\n apt_sources: { label: 'APT', icon: <LinuxIcon className=\"h-4 w-4\" /> },\n deb_packages: { label: 'DEB', icon: <LinuxIcon className=\"h-4 w-4\" /> },\n rpm_packages: { label: 'RPM', icon: <LinuxIcon className=\"h-4 w-4\" /> },\n yum_sources: { label: 'YUM', icon: <LinuxIcon className=\"h-4 w-4\" /> },\n portage_packages: { label: 'Portage', icon: <LinuxIcon className=\"h-4 w-4\" /> },\n chocolatey_packages: { label: 'Chocolatey', icon: <WindowsIcon className=\"h-4 w-4\" /> },\n programs: { label: 'Windows', icon: <WindowsIcon className=\"h-4 w-4\" /> },\n pkg_packages: { label: 'PKG', icon: <PackageIcon className=\"h-4 w-4\" /> },\n};\n\nexport const SoftwareSourceBadge: React.FC<SoftwareSourceBadgeProps> = ({ source, className }) => {\n const config = sourceConfig[source] || { label: source, icon: <PackageIcon className=\"h-4 w-4\" /> };\n\n return (\n <span className={cn('inline-flex items-center gap-2 text-ods-text-primary', className)}>\n {config.icon}\n {config.label}\n </span>\n );\n};\n\nSoftwareSourceBadge.displayName = 'SoftwareSourceBadge';\n","/**\n * CveLink Component\n *\n * Displays a CVE ID with an external link icon that links to the NIST NVD database.\n * Part of the ODS (OpenFrame Design System) platform components.\n *\n * @example\n * ```tsx\n * <CveLink cveId=\"CVE-2024-1234\" />\n * ```\n */\n\nimport type React from 'react';\nimport { cn } from '../../utils/cn';\nimport { CustomExternalLinkIcon } from '../icons';\n\nexport interface CveLinkProps {\n /** CVE ID (e.g., \"CVE-2024-1234\") */\n cveId: string;\n /** Additional CSS classes */\n className?: string;\n}\n\nexport const CveLink: React.FC<CveLinkProps> = ({ cveId, className }) => {\n const nistUrl = `https://nvd.nist.gov/vuln/detail/${cveId}`;\n\n return (\n <a\n href={nistUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={cn(\n 'group inline-flex items-center gap-2 text-ods-text-primary transition-colors text-code hover:text-ods-accent',\n className,\n )}\n >\n <span>{cveId}</span>\n <CustomExternalLinkIcon className=\"h-4 w-4 text-ods-text-secondary transition-colors group-hover:text-ods-accent\" />\n </a>\n );\n};\n\nCveLink.displayName = 'CveLink';\n","/**\n * ToolBadge Component\n *\n * Displays a tool type badge with icon for OpenFrame integrated tools.\n * Used in tables to show tool sources like Fleet MDM, MeshCentral, etc.\n *\n * @example\n * ```tsx\n * <ToolBadge toolType=\"OPENFRAME_RMM\" />\n * <ToolBadge toolType=\"FLEET\" />\n * <ToolBadge toolType=\"MESHCENTRAL\" />\n * ```\n */\n\nimport type React from 'react';\nimport type { ToolType } from '../../types/tool.types';\nimport { cn } from '../../utils/cn';\nimport { getToolLabel } from '../../utils/tool-utils';\nimport { ToolIcon } from '../tool-icon';\n\nexport type { ToolType } from '../../types/tool.types';\n\nexport interface ToolBadgeProps {\n /** Tool type */\n toolType: ToolType;\n /** Additional CSS classes */\n className?: string;\n iconClassName?: string;\n}\n\nexport const ToolBadge: React.FC<ToolBadgeProps> = ({ toolType, className, iconClassName }) => {\n const label = getToolLabel(toolType);\n\n return (\n <div className={cn('flex items-center gap-1 text-ods-text-secondary', className)}>\n <ToolIcon toolType={toolType} className={iconClassName} size={16} />\n <span className=\"text-ods-text-primary text-h4\">{label}</span>\n </div>\n );\n};\n\nToolBadge.displayName = 'ToolBadge';\n","/**\n * ShellTypeBadge Component\n *\n * Displays a badge for shell/script types with appropriate icon and label.\n * Supports all RMM shell types.\n */\n\nimport type React from 'react';\nimport { type ShellType, ShellTypeValues } from '../../types/shell.types';\nimport { cn } from '../../utils/cn';\nimport { getShellLabel } from '../../utils/shell-utils';\nimport { BashIcon, CmdIcon, DenoIcon, NushellIcon, ShellIcon } from '../icons';\nimport { PowershellLogoGreyIcon } from '../icons-v2-generated/brand-logos/powershell-logo-grey-icon';\nimport { PythonLogoIcon } from '../icons-v2-generated/brand-logos/python-logo-icon';\n\n/**\n * Shell icon configuration with typed mapping\n */\ninterface ShellIconConfig {\n icon: React.ComponentType<{ size?: number; color?: string; className?: string }>;\n props: { size: number } & ({ className: string } | { color: string });\n}\n\n/**\n * Typed mapping of shell types to their icon configurations\n * Using Record<ShellType, ...> ensures all shell types are covered\n */\nconst shellIconMap: Record<ShellType, ShellIconConfig> = {\n [ShellTypeValues.POWERSHELL]: {\n icon: PowershellLogoGreyIcon,\n props: { size: 16, className: 'text-ods-text-secondary' },\n },\n [ShellTypeValues.CMD]: {\n icon: CmdIcon,\n props: { size: 16, color: 'var(--color-text-secondary)' },\n },\n [ShellTypeValues.BASH]: {\n icon: BashIcon,\n props: { size: 16, color: 'var(--color-text-secondary)' },\n },\n [ShellTypeValues.PYTHON]: {\n icon: PythonLogoIcon,\n props: { size: 16, className: 'text-ods-text-secondary' },\n },\n [ShellTypeValues.NUSHELL]: {\n icon: NushellIcon,\n props: { size: 16, color: 'var(--color-text-secondary)' },\n },\n [ShellTypeValues.DENO]: {\n icon: DenoIcon,\n props: { size: 16, color: 'var(--color-text-secondary)' },\n },\n [ShellTypeValues.SHELL]: {\n icon: ShellIcon,\n props: { size: 16, color: 'var(--color-text-secondary)' },\n },\n} as const;\n\nconst defaultIconConfig: ShellIconConfig = {\n icon: ShellIcon,\n props: { size: 16, color: 'var(--color-text-secondary)' },\n};\n\nexport interface ShellTypeBadgeProps {\n shellType: ShellType;\n className?: string;\n iconClassName?: string;\n}\n\nexport const ShellTypeBadge: React.FC<ShellTypeBadgeProps> = ({ shellType, className, iconClassName }) => {\n const normalizedType = shellType?.toUpperCase() as ShellType;\n const label = getShellLabel(normalizedType);\n const { icon: IconComponent, props: iconProps } = shellIconMap[normalizedType] ?? defaultIconConfig;\n const defaultIconClassName = 'className' in iconProps ? iconProps.className : undefined;\n\n return (\n <div className={cn('flex items-center gap-1', className)}>\n <IconComponent size={16} className={cn(defaultIconClassName, iconClassName)} />\n <span className=\"text-ods-text-primary text-h4\">{label}</span>\n </div>\n );\n};\n\nShellTypeBadge.displayName = 'ShellTypeBadge';\n","/**\n * ScriptInfoSection Component\n *\n * Displays script information in a card with header (title, description)\n * and detail cells (shell type, supported platforms, category, author).\n * Responsive layout: stacks cells on mobile, shows grid on desktop.\n */\n\nimport type React from 'react';\nimport Image from '../../embed-shims/next-image';\nimport { cn } from '../../utils/cn';\nimport { nameInitials } from '../../utils/format';\nimport { getOSLabel } from '../../utils/os-utils';\nimport { getShellLabel } from '../../utils/shell-utils';\n\n/**\n * Props for author avatar display\n */\nexport interface ScriptAuthor {\n /** Author name */\n name: string;\n /** Author initials (used when no photo) */\n initials?: string;\n /** URL to author's photo */\n photoUrl?: string;\n}\n\n/**\n * Props for ScriptInfoSection component\n */\nexport interface ScriptInfoSectionProps {\n /** Script title/name */\n headline: string;\n /** Script description */\n subheadline?: string;\n /** Shell type (POWERSHELL, BASH, CMD, etc.) */\n shellType?: string;\n /** Array of supported platform strings (windows, darwin, linux, etc.) */\n supportedPlatforms?: string[];\n /** Script category */\n category: string;\n /** Author information */\n author?: ScriptAuthor;\n /** Additional CSS classes */\n className?: string;\n}\n\n/**\n * Formats supported platforms array into a display string\n * @param platforms - Array of platform strings (e.g., ['windows', 'darwin', 'linux'])\n * @returns Formatted string (e.g., 'Windows, macOS, Linux')\n */\nfunction formatSupportedPlatforms(platforms?: string[]): string {\n if (!platforms || platforms.length === 0) {\n return 'All Platforms';\n }\n return platforms.map(platform => getOSLabel(platform)).join(', ');\n}\n\n/**\n * InfoCell - Single info cell with label and value\n */\ninterface InfoCellProps {\n label: string;\n value: string;\n avatar?: ScriptAuthor;\n className?: string;\n}\n\nfunction InfoCell({ label, value, avatar, className }: InfoCellProps) {\n return (\n <div className={cn('flex min-w-0 items-center gap-2', className)}>\n {/* Avatar for author cell */}\n {avatar && (\n <div className=\"relative size-8 shrink-0 overflow-hidden rounded-full border border-ods-border bg-ods-bg\">\n {avatar.photoUrl ? (\n <Image src={avatar.photoUrl} alt={avatar.name} className=\"object-cover\" fill sizes=\"32px\" unoptimized />\n ) : (\n <div className=\"flex size-full items-center justify-center text-ods-text-secondary text-h6\">\n {avatar.initials || nameInitials(avatar.name)}\n </div>\n )}\n </div>\n )}\n\n {/* Text content */}\n <div className=\"flex min-w-0 flex-col\">\n <span className=\"truncate text-ods-text-primary text-h4\" title={value}>\n {value}\n </span>\n <span className=\"truncate text-ods-text-secondary text-h6\">{label}</span>\n </div>\n </div>\n );\n}\n\n/**\n * ScriptInfoSection - Displays script information in a structured card\n *\n * @example\n * ```tsx\n * <ScriptInfoSection\n * title=\"System Backup Script\"\n * description=\"Comprehensive Linux system backup script...\"\n * shellType=\"BASH\"\n * supportedPlatforms={['linux']}\n * category=\"System Maintenance\"\n * author={{ name: 'John Doe', photoUrl: '/avatars/john.jpg' }}\n * />\n * ```\n */\nexport const ScriptInfoSection: React.FC<ScriptInfoSectionProps> = ({\n headline,\n subheadline,\n shellType,\n supportedPlatforms,\n category,\n author,\n className,\n}) => {\n const shellLabel = getShellLabel(shellType);\n const platformsLabel = formatSupportedPlatforms(supportedPlatforms);\n\n return (\n <div className={cn('overflow-hidden rounded-[6px] border border-ods-border bg-ods-card', className)}>\n {/* Header row with title and description */}\n <div className=\"border-b border-ods-border p-4\">\n <div className=\"flex flex-col gap-1\">\n <h3 className=\"text-ods-text-primary text-h4\">{headline}</h3>\n {subheadline && <p className=\"break-words text-ods-text-secondary text-h6\">{subheadline}</p>}\n </div>\n </div>\n\n {/* Details section with info cells\n - Mobile/Tablet (<lg): 2x2 grid with divider between rows\n - Desktop (lg+): 4 columns in single row\n */}\n {/* First row: Shell Type, Supported Platforms */}\n <div className=\"grid grid-cols-2 gap-4 border-b border-ods-border px-4 py-4 lg:grid-cols-4 lg:border-b-0\">\n <InfoCell label=\"Shell Type\" value={shellLabel} />\n <InfoCell label=\"Supported Platforms\" value={platformsLabel} />\n {/* Desktop only: Category and Author in same row */}\n <InfoCell label=\"Category\" value={category} className=\"hidden lg:flex\" />\n {author && <InfoCell label=\"Added by\" value={author.name} avatar={author} className=\"hidden lg:flex\" />}\n </div>\n {/* Second row (mobile/tablet only): Category, Author */}\n <div className=\"grid grid-cols-2 gap-4 px-4 py-4 lg:hidden\">\n <InfoCell label=\"Category\" value={category} />\n {author && <InfoCell label=\"Added by\" value={author.name} avatar={author} />}\n </div>\n </div>\n );\n};\n\nScriptInfoSection.displayName = 'ScriptInfoSection';\n","/**\n * ScriptArguments Component\n *\n * Displays and manages script arguments as key-value pairs.\n * Each argument has a name (key) and value input field with delete button.\n * Includes an \"Add Script Argument\" button to add new entries.\n */\n\nimport { Trash2 } from 'lucide-react';\nimport type React from 'react';\nimport { cn } from '../../utils/cn';\nimport { PlusCircleIcon } from '../icons-v2-generated';\nimport { Button } from '../ui/button';\nimport { Input } from '../ui/input';\nimport { Label } from '../ui/label';\n\n/**\n * Single script argument with key and value\n */\nexport interface ScriptArgument {\n /** Unique identifier for the argument */\n id: string;\n /** Argument name/key */\n key: string;\n /** Argument value (empty string for flag-type arguments) */\n value: string;\n}\n\n/**\n * Props for ScriptArguments component\n */\nexport interface ScriptArgumentsProps {\n /** Array of script arguments */\n arguments: ScriptArgument[];\n /** Callback when arguments change */\n onArgumentsChange?: (args: ScriptArgument[]) => void;\n /** Placeholder for key input */\n keyPlaceholder?: string;\n /** Placeholder for value input */\n valuePlaceholder?: string;\n /** Label for the add button */\n addButtonLabel?: string;\n /** Whether the component is disabled */\n disabled?: boolean;\n /** Additional CSS classes */\n className?: string;\n /** Label for the title input */\n titleLabel: string;\n}\n\n/**\n * ScriptArguments - Displays and manages script arguments\n *\n * @example\n * ```tsx\n * <ScriptArguments\n * arguments={[\n * { id: '1', key: 'port', value: '3000' },\n * { id: '2', key: 'verbose', value: '' },\n * ]}\n * onArgumentsChange={(args) => setArguments(args)}\n * />\n * ```\n */\nexport const ScriptArguments: React.FC<ScriptArgumentsProps> = ({\n arguments: args,\n onArgumentsChange,\n keyPlaceholder = 'Enter Key',\n valuePlaceholder = 'Enter Value (empty=flag)',\n addButtonLabel = 'Add Script Argument',\n disabled = false,\n className,\n titleLabel,\n}) => {\n const handleKeyChange = (id: string, newKey: string) => {\n if (!onArgumentsChange) return;\n const updated = args.map(arg => (arg.id === id ? { ...arg, key: newKey } : arg));\n onArgumentsChange(updated);\n };\n\n const handleValueChange = (id: string, newValue: string) => {\n if (!onArgumentsChange) return;\n const updated = args.map(arg => (arg.id === id ? { ...arg, value: newValue } : arg));\n onArgumentsChange(updated);\n };\n\n const handleDelete = (id: string) => {\n if (!onArgumentsChange) return;\n const updated = args.filter(arg => arg.id !== id);\n onArgumentsChange(updated);\n };\n\n const handleAdd = () => {\n if (!onArgumentsChange) return;\n const newArg: ScriptArgument = {\n id: crypto.randomUUID(),\n key: '',\n value: '',\n };\n onArgumentsChange([...args, newArg]);\n };\n\n const isFirstRow = (index: number) => index === 0;\n\n return (\n <div className={cn('flex flex-col gap-2', className)}>\n {args.map((arg, index) => (\n <div key={arg.id} className=\"flex w-full items-end gap-2\">\n {/* Key input - with label only on first row */}\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n {isFirstRow(index) && <Label spacing=\"tight\">{titleLabel}</Label>}\n <Input\n value={arg.key}\n onChange={e => handleKeyChange(arg.id, e.target.value)}\n placeholder={keyPlaceholder}\n disabled={disabled}\n />\n </div>\n\n {/* Value input with delete button */}\n {/* Value input with delete button */}\n <div className=\"flex min-w-0 flex-1 items-center gap-2\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <Input\n value={arg.value}\n onChange={e => handleValueChange(arg.id, e.target.value)}\n placeholder={valuePlaceholder}\n disabled={disabled}\n className={cn(!arg.value && 'placeholder:text-ods-text-muted')}\n />\n </div>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n onClick={() => handleDelete(arg.id)}\n disabled={disabled}\n aria-label=\"Delete argument\"\n leftIcon={<Trash2 className=\"size-4 md:size-6\" color=\"var(--color-error)\" />}\n />\n </div>\n </div>\n ))}\n\n {/* Add button - aligned left */}\n <div className=\"flex justify-start\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"small\"\n onClick={handleAdd}\n disabled={disabled}\n className=\"self-start\"\n leftIcon={<PlusCircleIcon className=\"text-ods-text-secondary\" />}\n >\n {addButtonLabel}\n </Button>\n </div>\n </div>\n );\n};\n\nScriptArguments.displayName = 'ScriptArguments';\n","'use client';\n\nimport React from 'react';\nimport { cn } from '../../../utils/cn';\nimport { Button } from '../../ui/button';\nimport { InteractiveCard } from '../../ui/interactive-card';\nimport { StatusBadge } from '../../ui/status-badge';\n\nexport interface OnboardingStepCardProps {\n step: {\n id: string;\n title: string;\n description: string;\n actionIcon: (color?: string) => React.ReactNode;\n actionText: string;\n completedText: string;\n onAction: () => void | Promise<void>;\n onSkip?: () => void;\n };\n isCompleted: boolean;\n isSkipped: boolean;\n isCheckingCompletion: boolean;\n onAction: () => void | Promise<void>;\n onSkip: () => void;\n className?: string;\n}\n\nexport function OnboardingStepCard({\n step,\n isCompleted,\n isSkipped,\n isCheckingCompletion,\n onAction,\n onSkip,\n className,\n}: OnboardingStepCardProps) {\n const [isProcessing, setIsProcessing] = React.useState(false);\n\n const handleAction = async (e: React.MouseEvent) => {\n e.stopPropagation();\n setIsProcessing(true);\n try {\n await onAction();\n } finally {\n setIsProcessing(false);\n }\n };\n\n const handleSkip = (e: React.MouseEvent) => {\n e.stopPropagation();\n onSkip();\n };\n\n return (\n <InteractiveCard\n clickable={false}\n className={cn(\n 'rounded-[6px] border border-ods-border bg-ods-card',\n 'flex flex-col md:flex-row',\n 'min-h-[80px] md:h-[80px]',\n 'items-start md:items-center',\n 'gap-3 md:gap-4',\n 'px-4 py-4 md:py-0',\n className,\n )}\n >\n {/* Left column - content */}\n <div className=\"flex w-full min-w-0 flex-1 flex-col justify-center gap-1 md:w-auto\">\n <h3 className=\"truncate text-ods-text-primary text-h4\" title={step.title}>\n {step.title}\n </h3>\n <p className=\"h-[20px] truncate text-ods-text-secondary text-h6\" title={step.description}>\n {step.description}\n </p>\n </div>\n\n {/* Right column - action buttons, completed badge, or skipped badge */}\n <div\n className=\"flex w-full shrink-0 items-center justify-start gap-2 md:w-auto md:justify-end\"\n onClick={e => e.stopPropagation()}\n >\n {isCheckingCompletion ? (\n <>\n <div className=\"h-[32px] w-[100px] animate-pulse rounded-[6px] bg-ods-border\" />\n <div className=\"h-[32px] w-[120px] animate-pulse rounded-[6px] bg-ods-border\" />\n </>\n ) : isCompleted ? (\n <>\n <StatusBadge text=\"COMPLETED\" variant=\"card\" colorScheme=\"success\" />\n <Button\n variant=\"outline\"\n onClick={handleAction}\n disabled={isProcessing}\n leftIcon={step.actionIcon('white')}\n >\n {step.completedText}\n </Button>\n </>\n ) : isSkipped ? (\n <>\n <StatusBadge text=\"SKIPPED\" variant=\"card\" colorScheme=\"default\" />\n </>\n ) : (\n <>\n <Button variant=\"outline\" onClick={handleSkip}>\n Skip Step\n </Button>\n <Button variant=\"accent\" onClick={handleAction} disabled={isProcessing} leftIcon={step.actionIcon('black')}>\n {step.actionText}\n </Button>\n </>\n )}\n </div>\n </InteractiveCard>\n );\n}\n","'use client';\n\nimport React, { useRef, useCallback } from 'react';\nimport { useOnboardingState, type OnboardingStepConfig } from '../../../hooks/ui/use-onboarding-state';\nimport { cn } from '../../../utils/cn';\nimport { SECTION_HEADING_CLASS } from '../../layout/page-heading';\nimport { Button } from '../../ui/button';\nimport { OnboardingStepCard } from './onboarding-step-card';\n\nexport interface OnboardingWalkthroughProps {\n steps: OnboardingStepConfig[];\n onDismiss?: () => void;\n storageKey?: string;\n className?: string;\n spacing?: string;\n /**\n * Completion status from hook-based checks (e.g., useOnboardingCompletion)\n * Object mapping step IDs to boolean completion status\n */\n completionStatus?: Record<string, boolean>;\n /**\n * Whether completion checks are still loading\n */\n isLoadingCompletion?: boolean;\n}\n\nexport function OnboardingWalkthrough({\n steps,\n onDismiss,\n storageKey = 'openframe-onboarding-state',\n className,\n spacing = 'space-y-4',\n completionStatus,\n isLoadingCompletion = false,\n}: OnboardingWalkthroughProps) {\n const {\n state,\n markComplete,\n markSkipped,\n dismissOnboarding,\n isStepComplete,\n isStepSkipped,\n allStepsComplete,\n markMultipleComplete,\n } = useOnboardingState(storageKey);\n\n // Refs to prevent race conditions - ALL refs must be declared before any conditional returns\n const hasAutoMarkedRef = useRef(false);\n const autoMarkingInProgressRef = useRef(false);\n const lastCompletionStatusRef = useRef<string | null>(null);\n // Ref to track in-flight action handlers - moved here to be before conditional return\n const actionInProgressRef = useRef<Set<string>>(new Set());\n\n // Sync completion status from hooks to localStorage\n // Uses refs to prevent duplicate calls and race conditions\n React.useEffect(() => {\n // Skip if still loading\n if (isLoadingCompletion) {\n hasAutoMarkedRef.current = false; // Reset when loading starts\n return;\n }\n\n // Skip if no completion status\n if (!completionStatus) return;\n\n // Create a stable key from completion status to detect actual changes\n const statusKey = JSON.stringify(completionStatus);\n\n // Skip if we've already processed this exact status\n if (lastCompletionStatusRef.current === statusKey) return;\n\n // Skip if auto-marking is currently in progress\n if (autoMarkingInProgressRef.current) return;\n\n // Find steps that need to be marked complete\n // Read directly from state to avoid stale closure issues\n const completedStepIds = Object.entries(completionStatus)\n .filter(([stepId, isComplete]) => {\n if (!isComplete) return false;\n // Check against current state, not the callback\n return !state.completedSteps.includes(stepId);\n })\n .map(([stepId]) => stepId);\n\n if (completedStepIds.length > 0) {\n // Mark as in progress to prevent concurrent calls\n autoMarkingInProgressRef.current = true;\n\n console.log('📊 Auto-marking steps as complete from hook data:', completedStepIds);\n markMultipleComplete(completedStepIds);\n\n // Update the last processed status key\n lastCompletionStatusRef.current = statusKey;\n\n // Reset the in-progress flag after a short delay\n // This prevents rapid successive calls while allowing future updates\n setTimeout(() => {\n autoMarkingInProgressRef.current = false;\n }, 100);\n } else {\n // Even if no steps to mark, update the status key to prevent re-processing\n lastCompletionStatusRef.current = statusKey;\n }\n }, [completionStatus, isLoadingCompletion, state.completedSteps, markMultipleComplete]);\n\n // useCallback must be called unconditionally (before any early returns)\n const handleStepAction = useCallback(\n async (step: OnboardingStepConfig) => {\n // Prevent duplicate action handling for the same step\n if (actionInProgressRef.current.has(step.id)) {\n console.log(`⏳ Action already in progress for \"${step.id}\", skipping`);\n return;\n }\n\n // Mark as in progress\n actionInProgressRef.current.add(step.id);\n\n try {\n await step.onAction();\n\n // Skip if already completed (could have been auto-marked while action was running)\n if (state.completedSteps.includes(step.id)) {\n console.log(`✓ Step \"${step.id}\" already completed, skipping mark`);\n return;\n }\n\n // Auto-mark Knowledge Base as complete (no verification needed)\n if (step.id === 'knowledge-base') {\n console.log(`🎯 Auto-completing Knowledge Base`);\n markComplete(step.id);\n return;\n }\n\n // For other steps, re-check completion after action\n if (step.checkComplete) {\n try {\n const isComplete = await step.checkComplete();\n console.log(`🔍 Post-action check for \"${step.id}\": isComplete=${isComplete}`);\n\n // Double-check it wasn't completed while we were checking\n if (isComplete && !state.completedSteps.includes(step.id)) {\n markComplete(step.id);\n }\n } catch (error) {\n console.error(`Error checking completion for \"${step.id}\":`, error);\n }\n }\n } finally {\n // Remove from in-progress set\n actionInProgressRef.current.delete(step.id);\n }\n },\n [state.completedSteps, markComplete],\n );\n\n const handleStepSkip = (step: OnboardingStepConfig) => {\n step.onSkip?.();\n markSkipped(step.id);\n };\n\n const handleDismiss = () => {\n dismissOnboarding();\n onDismiss?.();\n };\n\n // ALL hooks have been called above - now safe to do conditional returns\n // Don't render if dismissed\n if (state.dismissed) {\n return null;\n }\n\n const isAllComplete = allStepsComplete(steps);\n\n return (\n <div className={cn('w-full space-y-4', className)}>\n {/* Header - responsive: stacks on mobile */}\n <div className=\"flex flex-col items-start justify-between gap-3 md:flex-row md:items-center md:gap-0\">\n <h2 className={SECTION_HEADING_CLASS}>Get Started</h2>\n\n {isLoadingCompletion ? (\n <div className=\"h-[48px] w-full animate-pulse rounded-[6px] bg-ods-border md:w-[160px]\" />\n ) : isAllComplete ? (\n <Button variant=\"accent\" onClick={handleDismiss} className=\"w-full md:w-auto\">\n Close Onboarding\n </Button>\n ) : (\n <Button variant=\"outline\" onClick={handleDismiss} className=\"w-full md:w-auto\">\n Skip Onboarding\n </Button>\n )}\n </div>\n\n {/* Step cards - no wrapper, direct rendering */}\n <div className={cn(spacing)}>\n {steps.map(step => (\n <OnboardingStepCard\n key={step.id}\n step={step}\n isCompleted={isStepComplete(step.id)}\n isSkipped={isStepSkipped(step.id)}\n isCheckingCompletion={isLoadingCompletion}\n onAction={() => handleStepAction(step)}\n onSkip={() => handleStepSkip(step)}\n />\n ))}\n </div>\n </div>\n );\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-YXWGSDK4.cjs","../src/hooks/ui/use-is-truncated.ts","../src/hooks/ui/use-debounce.ts","../src/hooks/ui/use-isomorphic-layout-effect.ts","../src/hooks/ui/use-media-query.ts","../src/hooks/ui/use-header-height.ts","../src/hooks/ui/use-marquee-engine.ts","../src/hooks/ui/use-reset-on-page-hidden.ts","../src/hooks/ui/use-suppress-clone-focus.ts","../src/types/tool.types.ts","../src/components/tool-icon.tsx","../src/utils/common.ts","../src/hooks/use-near-viewport.ts","../src/utils/markdown-fences.ts","../src/utils/markdown-heading-id.ts","../src/utils/anchor-id.ts","../src/utils/scroll-into-view.ts","../src/utils/same-page-hash-nav.ts"],"names":["delay","useState","useEffect","header","bar","useCallback","useRef"],"mappings":"AAAA,6rBAAY;AACZ;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACTA,8BAAiD;AA+B1C,SAAS,cAAA,CAAsC,KAAA,EAAgB,OAAA,EAAiC;AACrG,EAAA,MAAM,UAAA,mCAAY,OAAA,2BAAS,WAAA,UAAa,OAAA;AACxC,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,EAAA,EAAI,6BAAA,IAAuB,CAAA;AACrD,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,EAAA,EAAI,6BAAA,KAAc,CAAA;AAKpD,EAAA,MAAM,IAAA,EAAM,gCAAA,CAAa,IAAA,EAAA,GAAmB,UAAA,CAAW,IAAI,CAAA,EAAG,CAAC,CAAC,CAAA;AAEhE,EAAA,8BAAA,CAAU,EAAA,GAAM;AACd,IAAA,GAAA,CAAI,CAAC,OAAA,EAAS,OAAO,KAAA,CAAA;AAIrB,IAAA,MAAM,MAAA,EAAQ,CAAA,EAAA,GAAM;AAClB,MAAA,cAAA;AAAA,QACE,UAAA,EAAY,OAAA,CAAQ,aAAA,EAAe,OAAA,CAAQ,aAAA,EAAe,EAAA,EAAI,OAAA,CAAQ,YAAA,EAAc,OAAA,CAAQ,YAAA,EAAc;AAAA,MAC5G,CAAA;AAAA,IACF,CAAA;AACA,IAAA,KAAA,CAAM,CAAA;AACN,IAAA,MAAM,SAAA,EAAW,IAAI,cAAA,CAAe,KAAK,CAAA;AACzC,IAA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A;AAED,EAAA;AACD,EAAA;AACI,IAAA;AACF,IAAA;AACF,MAAA;AACF,IAAA;AACE,MAAA;AACF,IAAA;AAGA,IAAA;AACM,MAAA;AACF,QAAA;AACA,QAAA;AACD,MAAA;AACH,IAAA;AACF,EAAA;AACM,EAAA;AACF,EAAA;AACF,IAAA;AACF,EAAA;AAGA,EAAA;AACE,IAAA;AACA,IAAA;AACD,EAAA;AACM,EAAA;AACT;AjB8kBU;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-YXWGSDK4.cjs","sourcesContent":[null,"'use client';\n\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface UseIsTruncatedOptions {\n /** Measure vertical clipping (`line-clamp-N`) instead of the single-line ellipsis. */\n multiline?: boolean;\n}\n\n/**\n * Tracks whether an element's text is ACTUALLY clipped — the condition for\n * offering a \"full value\" tooltip. Text that fits needs no tooltip, and showing\n * one anyway just repeats what the user is already reading.\n *\n * Three things can change the answer, and all three are watched: the box\n * resizing (`ResizeObserver`), the text itself changing, and the measured\n * ELEMENT changing. None of them implies the others — new text inside a\n * width-constrained box leaves the box exactly as it was, so the observer never\n * fires; and a caller that swaps between render branches (adornment vs plain)\n * mounts a different node under the same text, which a `useRef` would leave\n * measured against the old, detached node. Pass the rendered value as `value`.\n *\n * `ref` is a CALLBACK ref, not a `RefObject` — that is what makes the element\n * itself a dependency. Attach it exactly like a normal ref; there is no\n * `.current` to read.\n *\n * ```tsx\n * const { ref, isTruncated } = useIsTruncated<HTMLHeadingElement>(title)\n * <FloatingTooltip content={title} disabled={!isTruncated}>\n * <h1 ref={ref} className=\"truncate\">{title}</h1>\n * </FloatingTooltip>\n * ```\n */\nexport function useIsTruncated<T extends HTMLElement>(value: unknown, options?: UseIsTruncatedOptions) {\n const multiline = options?.multiline ?? false;\n const [element, setElement] = useState<T | null>(null);\n const [isTruncated, setIsTruncated] = useState(false);\n\n // Wrapped so the identity stays stable across renders: passing the raw\n // `useState` setter as a ref would be stable too, but this keeps the public\n // shape a plain `RefCallback<T>` instead of a state dispatcher.\n const ref = useCallback((node: T | null) => setElement(node), []);\n\n useEffect(() => {\n if (!element) return undefined;\n // The 1px tolerance absorbs sub-pixel layout rounding, which otherwise\n // reports a permanent fractional \"overflow\" at some zoom levels / DPRs and\n // leaves a tooltip armed on text that is fully visible.\n const check = () => {\n setIsTruncated(\n multiline ? element.scrollHeight > element.clientHeight + 1 : element.scrollWidth > element.clientWidth + 1,\n );\n };\n check();\n const observer = new ResizeObserver(check);\n observer.observe(element);\n return () => observer.disconnect();\n }, [element, value, multiline]);\n\n // Masked rather than reset from the effect: with no element there is nothing\n // to clip, and deriving that during render avoids a second render pass every\n // time the measured node unmounts.\n return { ref, isTruncated: element ? isTruncated : false };\n}\n","'use client';\n\nimport { useState, useEffect } from 'react';\n\n/**\n * Hook to debounce a value\n * @param value - Value to debounce\n * @param delay - Delay in milliseconds\n * @returns Debounced value\n */\nexport function useDebounce<T>(value: T, delay = 500): T {\n const [debouncedValue, setDebouncedValue] = useState<T>(value);\n\n useEffect(() => {\n // Set up timeout to update debounced value\n const timer = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n\n // Clean up timeout on value change or unmount\n return () => {\n clearTimeout(timer);\n };\n }, [value, delay]);\n\n return debouncedValue;\n}\n","'use client';\n\nimport { useEffect, useLayoutEffect } from 'react';\n\n/**\n * `useLayoutEffect` in the browser, `useEffect` on the server.\n *\n * `useLayoutEffect` never runs during server rendering — React cannot measure or\n * mutate a layout that has not been laid out — so calling it in a component that\n * SSRs logs a warning on every render pass. Client components still render on the\n * server in Next.js, so `'use client'` alone does not avoid it.\n *\n * Use this wherever the effect writes something the FIRST paint depends on (a CSS\n * custom property, a scroll position, a measured size). A plain `useEffect` there\n * runs after paint, which shows one frame of the pre-effect value; a plain\n * `useLayoutEffect` gets the timing right and pays for it with the warning. This\n * gets both: paint-blocking where there is a paint, a no-op where there is not.\n */\nexport const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n","'use client';\n\nimport { useState } from 'react';\nimport { useIsomorphicLayoutEffect } from './use-isomorphic-layout-effect';\n\n/**\n * Hook to check if a media query matches\n * @param query - Media query to check\n * @returns Whether the media query matches, or undefined during SSR/initial render\n */\nexport function useMediaQuery(query: string): boolean | undefined {\n const [matches, setMatches] = useState<boolean | undefined>(undefined);\n\n useIsomorphicLayoutEffect(() => {\n const matchMedia = window.matchMedia(query);\n\n const handleChange = () => {\n setMatches(matchMedia.matches);\n };\n\n // Set initial value\n handleChange();\n\n matchMedia.addEventListener('change', handleChange);\n\n return () => {\n matchMedia.removeEventListener('change', handleChange);\n };\n }, [query]);\n\n return matches;\n}\n\n/**\n * Predefined breakpoints for common screen sizes\n */\nexport const breakpoints = {\n md: '(min-width: 800px)', // Tablet: 50rem\n lg: '(min-width: 1280px)', // Desktop: 80rem\n};\n\n/** @deprecated Use useMdUp instead */\nexport function useSmUp(): boolean | undefined {\n return useMdUp();\n}\n\nexport function useMdUp(): boolean | undefined {\n const matches = useMediaQuery(breakpoints.md);\n return matches === undefined ? undefined : matches;\n}\n\nexport function useLgUp(): boolean | undefined {\n const matches = useMediaQuery(breakpoints.lg);\n return matches === undefined ? undefined : matches;\n}\n","'use client';\n\nimport { useEffect, useState } from 'react';\n\n/**\n * Returns the combined height (px) of the sticky page header and announcement\n * bar (if present), updated live via ResizeObserver / MutationObserver.\n * Useful for offsetting fixed/absolute-positioned panels so they don't\n * overlap the header.\n */\nexport function useHeaderHeight(\n // First-paint fallback = the unified top-navigation `big` bar (72px), the\n // size every hub/marketing site renders; replaced by the live measurement.\n defaultHeight = 72,\n options: {\n /**\n * When false, no observers are attached and the default height is\n * returned — for consumers that stay mounted on every page but only need\n * the measurement while an overlay is open (avoids an always-on\n * document-wide MutationObserver + forced reflow).\n * @default true\n */\n enabled?: boolean;\n } = {},\n): number {\n const { enabled = true } = options;\n const [height, setHeight] = useState(defaultHeight);\n\n useEffect(() => {\n if (!enabled) return undefined;\n\n const measure = () => {\n let total = 0;\n const header = document.querySelector('header');\n if (header) total += header.offsetHeight;\n const bar = document.querySelector('[data-announcement-bar]');\n if (bar instanceof HTMLElement) total += bar.offsetHeight;\n setHeight(total > 0 ? total : defaultHeight);\n };\n\n measure();\n\n const resizeObserver = new ResizeObserver(measure);\n const header = document.querySelector('header');\n if (header) resizeObserver.observe(header);\n const bar = document.querySelector('[data-announcement-bar]');\n if (bar) resizeObserver.observe(bar);\n\n const mutationObserver = new MutationObserver(mutations => {\n for (const mutation of mutations) {\n if (mutation.type === 'childList' || mutation.type === 'attributes') {\n measure();\n const newBar = document.querySelector('[data-announcement-bar]');\n if (newBar) resizeObserver.observe(newBar);\n }\n }\n });\n mutationObserver.observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['data-announcement-bar'],\n });\n\n return () => {\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n };\n }, [defaultHeight, enabled]);\n\n return height;\n}\n","'use client';\n\nimport { useCallback, useEffect, useRef, type MutableRefObject } from 'react';\n\n/**\n * THE marquee animation core (single source of truth) — extracted verbatim\n * from <CardsStrip> so every endless-scroll surface (card strips, logo strips,\n * quick-action walls, chip marquees) shares ONE rAF position engine (\"unify\n * means delete variations\").\n *\n * The engine is axis- and driver-agnostic: it owns a FLOAT position ref, a\n * velocity envelope, seam wrapping, and an optional chevron-style glide; the\n * caller decides what a position \"means\" via `apply` — writing\n * `scroller.scrollLeft` (CardsStrip: a real scroller the user can also drag)\n * or a `translate` transform (MarqueeWall: decorative tracks, incl. vertical —\n * mandatory inside surfaces that forbid inner scrollers, e.g. the deck's\n * mobile single-fold panels).\n *\n * Engine semantics (do not \"simplify\"):\n * - Position lives in a FLOAT ref, never read-modify-write from the DOM:\n * scrollLeft reads back rounded values, so sub-pixel increments\n * (speed/fps < 1px) get eaten by rounding — stutter + measurably slower\n * than the configured speed.\n * - Velocity envelope (~250ms time constant) eases between 0 and `speed`\n * instead of binary stop/start — pause decelerates, resume accelerates from\n * the current position (GSAP-marquee behavior; hard cuts read as jank).\n * - Glide consumes a signed remaining-distance, wrapping modulo the copy size\n * each frame, so seam warps are invisible to it (browser smooth-scroll\n * animates toward an ABSOLUTE target and lunges after a warp).\n * - `isPaused` is evaluated every frame — the caller owns the pause-reason\n * set (hover, viewport, tab visibility, suppress windows); the engine only\n * turns it into a smooth velocity target.\n */\nexport interface MarqueeEngineOptions {\n /** Master switch — the rAF runs only while true. On (re)activation the\n * position resyncs from `readBack` when provided. */\n active: boolean;\n /** Cruise speed in px/s. */\n speed: number;\n /** Per-frame pause verdict (caller-owned reason set). `now` is the rAF\n * timestamp, for suppress-until comparisons. */\n isPaused: (now: number) => boolean;\n /** Single-copy size in px (the wrap modulus). Return <= 0 to disable\n * wrapping (position advances unwrapped — callers should size tracks so\n * this never happens while active). */\n getWrapSize: () => number;\n /** Lower bound of the wrap range: positions stay in\n * [wrapMin, wrapMin + wrapSize). Default 0. Scroller drivers with USER\n * scrolling pass their seam-warp buffer here so engine-written positions\n * never enter the re-center zones — an exact-edge warp check is racy\n * against the rAF (the engine nudges the scroller off the edge before the\n * scroll handler samples it → \"stuck at the left edge\"). */\n getWrapMin?: () => number;\n /** Write the position to the DOM (scrollLeft assignment or transform). */\n apply: (pos: number) => void;\n /** Read the externally-mutated position back (real scrollers: user drag /\n * native smooth scroll move scrollLeft under the engine). Omit for\n * transform drivers — nothing external can move them. */\n readBack?: () => number;\n /** Called at the end of every frame (e.g. hover re-resolution after the\n * track moved under a stationary pointer). */\n onAfterFrame?: () => void;\n}\n\nexport interface MarqueeEngineHandle {\n /** The engine's float position (px along the axis, 0 ≤ pos < wrap while\n * wrapping). Callers may write it together with their own DOM write (seam\n * warp on manual scroll). */\n posRef: MutableRefObject<number>;\n /** Accumulate a signed glide distance (chevron navigation). Runs through\n * the engine's own tween — never native smooth scroll while wrapping. */\n glideBy: (px: number) => void;\n /** Wrap an arbitrary position into [0, wrapSize). */\n wrap: (pos: number) => number;\n}\n\n// Resync threshold (px): external movement beyond this adopts the DOM value.\nconst RESYNC_EPSILON = 1.5;\n\nexport function useMarqueeEngine(options: MarqueeEngineOptions): MarqueeEngineHandle {\n const posRef = useRef(0);\n const glideRemainingRef = useRef(0);\n const speedEnvRef = useRef(0);\n\n // Latest-options ref: the rAF loop always reads current values without the\n // effect restarting on every render. Refreshed in an unconditional effect,\n // declared before every effect that starts the loop, rather than in the\n // render body — a render attempt React discards must not be able to hand the\n // loop options that were never committed.\n const optsRef = useRef(options);\n useEffect(() => {\n optsRef.current = options;\n });\n\n const wrap = useCallback((pos: number) => {\n const half = optsRef.current.getWrapSize();\n if (half <= 0) return pos;\n const min = optsRef.current.getWrapMin?.() ?? 0;\n let wrapped = pos;\n while (wrapped >= min + half) wrapped -= half;\n while (wrapped < min) wrapped += half;\n return wrapped;\n }, []);\n\n const glideBy = useCallback((px: number) => {\n glideRemainingRef.current += px;\n }, []);\n\n const active = options.active;\n useEffect(() => {\n if (!active) return undefined;\n let raf = 0;\n let last = performance.now();\n const readBack = optsRef.current.readBack;\n if (readBack) posRef.current = readBack();\n\n const tick = (now: number) => {\n const opts = optsRef.current;\n const dt = Math.min(now - last, 100) / 1000; // clamp tab-wake jumps\n last = now;\n\n const paused = opts.isPaused(now);\n // Ease the velocity toward its target (0 when paused) — smooth decel on\n // pause, smooth accel on resume, always from the CURRENT position.\n const targetSpeed = paused ? 0 : opts.speed;\n speedEnvRef.current += (targetSpeed - speedEnvRef.current) * Math.min(1, dt / 0.25);\n if (targetSpeed === 0 && speedEnvRef.current < 0.5) speedEnvRef.current = 0;\n\n const external = opts.readBack ? opts.readBack() : null;\n const resync = () => {\n if (external !== null && Math.abs(external - posRef.current) > RESYNC_EPSILON) {\n posRef.current = external;\n }\n };\n\n const glide = glideRemainingRef.current;\n if (glide !== 0) {\n // Ease-out toward the glide target; runs even while \"paused\" (the\n // interaction that queued it sets its own suppress window).\n resync();\n const speed = Math.max(Math.abs(glide) * 6, 240); // px/s, proportional\n const step = Math.sign(glide) * Math.min(Math.abs(glide), speed * dt);\n glideRemainingRef.current = Math.abs(glide - step) < 0.5 ? 0 : glide - step;\n posRef.current = wrap(posRef.current + step);\n opts.apply(posRef.current);\n } else if (speedEnvRef.current > 0) {\n // Resync after external movement (user scroll, seam warp).\n resync();\n posRef.current = wrap(posRef.current + speedEnvRef.current * dt);\n opts.apply(posRef.current);\n } else if (external !== null) {\n // Idle: follow external movement so resumes start from where the\n // user left the scroller.\n posRef.current = external;\n }\n opts.onAfterFrame?.();\n raf = requestAnimationFrame(tick);\n };\n raf = requestAnimationFrame(tick);\n return () => cancelAnimationFrame(raf);\n }, [active, wrap]);\n\n return { posRef, glideBy, wrap };\n}\n","import { useEffect } from 'react';\n\n/**\n * Runs `reset` whenever the tab is hidden or the window loses focus — exactly the\n * moments a `pointerleave` / `pointercancel` can be SWALLOWED (tab blur, an\n * overlay mounting under the cursor, an interrupted pointer), which otherwise\n * leaves a hover/\"inside\" flag stuck `true` and freezes a marquee FOREVER. The\n * next real pointer/hover re-arms the flag.\n *\n * SSOT self-heal for every marquee surface (MarqueeWall, CardsStrip) so the\n * blur + `visibilitychange` wiring lives in one place. `reset` almost always\n * only UN-sticks state. The one edge: on `blur` WITHOUT the tab hiding (a second\n * window focused beside this one), clearing the hover-pause can let the marquee\n * resume under a still-stationary cursor in the now-unfocused window — it\n * re-pauses on the next `pointermove`/`pointerenter`. We keep the `blur` reset\n * anyway because it's the only signal that catches a tab-blur that swallows the\n * `pointerleave` without a `visibilitychange`. Pass a STABLE `reset` (memoize\n * with `useCallback`) — the listeners re-attach whenever its identity changes.\n */\nexport function useResetOnPageHidden(reset: () => void): void {\n useEffect(() => {\n const onVisibility = () => {\n if (document.visibilityState === 'hidden') reset();\n };\n window.addEventListener('blur', reset);\n document.addEventListener('visibilitychange', onVisibility);\n return () => {\n window.removeEventListener('blur', reset);\n document.removeEventListener('visibilitychange', onVisibility);\n };\n }, [reset]);\n}\n","'use client';\n\nimport { useEffect, useRef } from 'react';\n\n// Every focusable a clone might contain — matched so it can be pulled out of the\n// keyboard tab order (see useSuppressCloneFocus). `[contenteditable]:not(\n// [contenteditable=\"false\"])` catches the empty/`\"true\"`/`\"plaintext-only\"`\n// editable forms; `summary` is focusable inside a <details>.\nconst CLONE_FOCUSABLE_SELECTOR =\n 'a[href],button,input,select,textarea,iframe,summary,audio[controls],video[controls],[tabindex],[contenteditable]:not([contenteditable=\"false\"])';\n\n/**\n * Keep a marquee clone's content pointer-CLICKABLE while taking it out of the\n * accessibility tree and the keyboard tab order. Shared by every endless-loop\n * surface that renders a second track copy (<CardsStrip> managed cells,\n * <MarqueeWall> clone copies).\n *\n * `inert` (the previous approach) does all three at once: a11y-hidden,\n * un-focusable AND un-clickable. That third effect was the \"news marquee stops\n * being clickable after you scroll it for a while\" bug — the 2-copy endless\n * loop ALWAYS paints clone cards inside the viewport near the copy seam, so a\n * user who manually scrolls and parks there is looking at real-looking cards\n * that silently swallow every click. Clones must therefore stay clickable (a\n * click on ANY visible card must open its link — mouse, ⌘-click, middle-click\n * and context-menu all handled natively by the clone's own anchor).\n *\n * The a11y contract is still met without `inert`: the caller keeps\n * `aria-hidden` on the clone wrapper (out of the a11y tree) and this hook\n * forces every focusable descendant to `tabindex=\"-1\"` (out of the tab order →\n * no duplicate tab stops, no aria-hidden-focus violation). Re-applied on\n * subtree mutation. This is the standard loop-clone treatment used by\n * Swiper/Splide.\n */\nexport function useSuppressCloneFocus(active: boolean) {\n const ref = useRef<HTMLDivElement | null>(null);\n useEffect(() => {\n const root = ref.current;\n if (!root || !active) return undefined;\n const suppress = () => {\n root.querySelectorAll<HTMLElement>(CLONE_FOCUSABLE_SELECTOR).forEach(el => {\n // Only stamp the ones not already stamped — avoids touching the DOM (and\n // clobbering an intentional tabindex) on every mutation.\n if (el.getAttribute('tabindex') !== '-1') el.setAttribute('tabindex', '-1');\n });\n };\n suppress();\n // Watch structure AND the attributes that can turn a descendant tabbable\n // (an anchor gaining `href`, React restoring `tabindex=\"0\"`, an element\n // becoming editable, media gaining `controls`). The `!== '-1'` guard above\n // makes our own tabindex writes a no-op, so the observer never loops.\n const mo = new MutationObserver(suppress);\n mo.observe(root, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['href', 'tabindex', 'contenteditable', 'controls'],\n });\n return () => mo.disconnect();\n }, [active]);\n return ref;\n}\n","/**\n * Centralized Tool Types\n *\n * Single source of truth for all tool-related types across the entire platform.\n * Used by ToolBadge, ToolIcon, and any component that needs tool type information.\n */\n\nexport const ToolTypeValues = {\n FLEET_MDM: 'FLEET_MDM',\n MESHCENTRAL: 'MESHCENTRAL',\n AUTHENTIK: 'AUTHENTIK',\n OPENFRAME: 'OPENFRAME',\n OPENFRAME_CHAT: 'OPENFRAME_CHAT',\n OPENFRAME_CLIENT: 'OPENFRAME_CLIENT',\n OPENFRAME_RMM: 'OPENFRAME_RMM',\n OSQUERY: 'OSQUERY',\n SYSTEM: 'SYSTEM',\n} as const;\n\nexport type ToolType = (typeof ToolTypeValues)[keyof typeof ToolTypeValues];\n\n/**\n * Maps tool types to display labels\n */\nexport const toolLabels: Record<ToolType, string> = {\n FLEET_MDM: 'Fleet',\n MESHCENTRAL: 'MeshCentral',\n AUTHENTIK: 'Authentik',\n OPENFRAME: 'OpenFrame',\n OPENFRAME_CHAT: 'OpenFrame Chat',\n OPENFRAME_CLIENT: 'OpenFrame Client',\n OPENFRAME_RMM: 'RMM',\n OSQUERY: 'Osquery',\n SYSTEM: 'System',\n};\n","import type { FC, ReactNode } from 'react';\nimport { type ToolType, ToolTypeValues } from '../types/tool.types';\nimport { OpenFrameLogo } from './icons';\nimport {\n OsqueryLogoGreyIcon,\n MeshcentralLogoGreyIcon,\n FleetMdmLogoGreyIcon,\n AuthentikLogoGreyIcon,\n} from './icons-v2-generated';\n\nconst renderOpenFrameLogo = (_size: number, className?: string) => (\n <OpenFrameLogo\n className={className ?? 'h-4 w-auto'}\n lowerPathColor=\"var(--color-accent-primary)\"\n upperPathColor=\"var(--color-text-primary)\"\n />\n);\n\nconst toolIconMap: Record<ToolType, (size: number, className?: string) => ReactNode> = {\n [ToolTypeValues.FLEET_MDM]: (size, className) => <FleetMdmLogoGreyIcon size={size} className={className} />,\n [ToolTypeValues.MESHCENTRAL]: (size, className) => <MeshcentralLogoGreyIcon size={size} className={className} />,\n [ToolTypeValues.OPENFRAME]: renderOpenFrameLogo,\n [ToolTypeValues.OPENFRAME_CHAT]: renderOpenFrameLogo,\n [ToolTypeValues.OPENFRAME_CLIENT]: renderOpenFrameLogo,\n [ToolTypeValues.OPENFRAME_RMM]: renderOpenFrameLogo,\n [ToolTypeValues.AUTHENTIK]: (size, className) => <AuthentikLogoGreyIcon size={size} className={className} />,\n [ToolTypeValues.OSQUERY]: (size, className) => <OsqueryLogoGreyIcon size={size} className={className} />,\n [ToolTypeValues.SYSTEM]: () => null,\n};\n\nexport interface ToolIconProps {\n toolType: ToolType;\n size?: number;\n className?: string;\n}\n\nexport const ToolIcon: FC<ToolIconProps> = ({ toolType, size = 16, className }) => (\n <>{toolIconMap[toolType]?.(size, className) ?? null}</>\n);\n\nToolIcon.displayName = 'ToolIcon';\n","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * Utility functions for common operations\n */\n\n/**\n * Merge class names with Tailwind CSS\n * @param inputs - Class names to merge\n * @returns Merged class names\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n/**\n * Human-readable message for a caught value.\n *\n * `catch (e)` binds `unknown` under this tsconfig, and a thrown value is not\n * guaranteed to be an `Error`. Use this instead of `catch (e: any)` +\n * `e.message`, which crashes on a thrown string/object with no `message`.\n *\n * @param error - The caught value\n * @param fallback - Returned when the value carries no usable message\n */\nexport function errorMessage(error: unknown, fallback = 'Something went wrong'): string {\n if (error instanceof Error && error.message) return error.message;\n if (typeof error === 'string' && error) return error;\n if (typeof error === 'object' && error !== null) {\n const message = (error as { message?: unknown }).message;\n if (typeof message === 'string' && message) return message;\n }\n return fallback;\n}\n\n/**\n * Human-readable message for a FAILED API response body.\n *\n * `Response.json()` is typed `any`, so `body.error` used to be read off an\n * `any` at every call site. The platform's route helpers answer errors with\n * `{ error, code, details }` (see `errorResponse` in the hub's\n * `lib/api/route-base.ts`); a few endpoints answer `{ message }` instead, so\n * both are accepted before giving up.\n *\n * @param payload - The parsed response body (or whatever came back)\n * @param fallback - Returned when the body carries no usable message\n */\nexport function apiErrorMessage(payload: unknown, fallback: string): string {\n if (typeof payload === 'object' && payload !== null && 'error' in payload) {\n const { error } = payload;\n if (typeof error === 'string' && error) return error;\n }\n return errorMessage(payload, fallback);\n}\n\n/**\n * Delay execution for a specified time\n * @param ms - Milliseconds to delay\n * @returns Promise that resolves after the delay\n */\nexport function delay(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n\n/**\n * Generate a random string of specified length\n * @param length - Length of the string\n * @returns Random string\n */\nexport function generateRandomString(length = 8): string {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n for (let i = 0; i < length; i++) {\n result += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n return result;\n}\n\n/**\n * Truncate a string to a specified length\n * @param str - String to truncate\n * @param maxLength - Maximum length\n * @param suffix - Suffix to add to truncated string\n * @returns Truncated string\n */\nexport function truncateString(str: string, maxLength: number, suffix = '...'): string {\n if (str.length <= maxLength) return str;\n return str.substring(0, maxLength - suffix.length) + suffix;\n}\n\n/**\n * Serialize a JSON-LD schema for a `<script type=\"application/ld+json\">`\n * block — THE one home of the escape rule (the hub re-exports this from\n * lib/utils/breadcrumbs). JSON.stringify does NOT HTML-escape: a stored\n * \"</script>\" inside any admin/user-entered field would terminate the tag\n * early (stored XSS). Every \"<\" becomes the JSON escape sequence\n * backslash-u003c — still valid JSON, inert in HTML.\n */\nexport function serializeJsonLd(schema: unknown): string {\n return JSON.stringify(schema).replace(/</g, '\\\\u003c');\n}\n\n/**\n * Deep clone an object through a JSON round-trip.\n *\n * Lossy by construction, and deliberately so — this is the JSON projection of\n * `T`: `undefined` members and functions are dropped, `Date` becomes an ISO\n * string, `Map`/`Set` become `{}`, and a cyclic graph throws. Reach for\n * `structuredClone` when any of that matters.\n *\n * `JSON.parse` is typed `any`; the assertion states the contract above, which\n * is the closest a JSON clone can get to \"still a `T`\".\n *\n * @param obj - Object to clone (must be JSON-serializable)\n * @returns Cloned object\n */\nexport function deepClone<T>(obj: T): T {\n return JSON.parse(JSON.stringify(obj)) as T;\n}\n\n/**\n * Get the Slack community join URL from environment variables\n * @returns Slack community join URL or fallback URL\n */\nexport function getSlackCommunityJoinUrl(): string {\n const url = process.env.NEXT_PUBLIC_SLACK_COMMUNITY_JOIN_URL;\n if (!url) {\n console.warn('NEXT_PUBLIC_SLACK_COMMUNITY_JOIN_URL is not defined in environment variables');\n return 'https://join.slack.com/t/openmsp/shared_invite/zt-36bl7mx0h-3~U2nFH6nqHqoTPXMaHEHA';\n }\n return url;\n}\n\n/**\n * Clamp a number into an inclusive range. THE one clamp for the lib and the hub\n * (step/page/contrast math all bottom out here).\n */\nexport function clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\n/**\n * Typed key-subset of an object. Keys whose value is `undefined` on the source\n * are still copied when present, so `pick(params, dropped)` writes explicit\n * `null`s (the URL-state writer's \"remove this key\" signal).\n */\nexport function pick<T extends object, K extends keyof T>(source: T, keys: readonly K[]): Pick<T, K> {\n const out = {} as Pick<T, K>;\n for (const key of keys) {\n if (key in source) out[key] = source[key];\n }\n return out;\n}\n\n/**\n * React Query options for data that MUST NOT be served from the client cache.\n *\n * The rule (hub memory `feedback_no_client_query_cache_for_mutable_entities`):\n * anything a user can mutate, or a cron can rewrite under them, is refetched on\n * mount. Spread this instead of retyping `staleTime: 0` — it is also the hub\n * QueryClient's default, so a hook that spreads it is explicit rather than\n * silently inheriting.\n */\nexport const NO_CLIENT_CACHE = { staleTime: 0 } as const;\n","/**\n * useNearViewport — module-level shared IntersectionObserver in hook form.\n *\n * Single IO instance per `rootMargin` value, shared across every component\n * that mounts the hook. Reduces overhead vs. one IO per component on\n * grid/list pages where many subscribers observe the viewport with the same\n * margin. Promoted from the inline singleton at\n * `multi-platform-hub/components/shared/video-bites-display.tsx:21-43`,\n * which is the only IO pattern in either repo today.\n *\n * Usage:\n * ```tsx\n * function MyCard() {\n * const { ref, isNear } = useNearViewport('500px');\n * return <div ref={ref}>{isNear ? <HeavyChild /> : <Placeholder />}</div>;\n * }\n * ```\n *\n * StrictMode safety: cleanup uses an identity check on the registered\n * callback so React's dev double-mount (mount → cleanup → re-mount) does\n * not drop the second mount's freshly-set subscription. The IO callback\n * also checks `subscribers.get(target)` before invoking so a fire that\n * races with unmount cannot crash on a torn-down component.\n *\n * The hook fires once — on first intersection it sets `isNear=true` and\n * unobserves the element. Callers that need re-observation should\n * unmount and remount (or fork the hook for two-way behavior).\n */\n\nimport { useEffect, useRef, useState, useCallback } from 'react';\n\n// Per-(rootMargin, threshold) IO map. Multiple call sites with different\n// margins/thresholds each get their own singleton observer.\nconst observers = new Map<string, IntersectionObserver>();\nconst subscribers = new WeakMap<Element, () => void>();\n\n// Slack for the explicit ratio check: an element sized to exactly meet the\n// threshold can report a ratio a hair under it (sub-pixel / float rounding), so\n// accept `ratio >= threshold - EPSILON`. With `threshold: 0` this is a no-op\n// (ratio is always ≥ 0 > -EPSILON) — the `isIntersecting` check alone gates.\nconst THRESHOLD_EPSILON = 0.01;\n\n/** Stable map key for an observer config. */\nfunction observerKey(rootMargin: string, threshold: number): string {\n return `${rootMargin}|${threshold}`;\n}\n\nfunction getObserverFor(rootMargin: string, threshold: number): IntersectionObserver {\n const key = observerKey(rootMargin, threshold);\n const existing = observers.get(key);\n if (existing) return existing;\n\n const io = new IntersectionObserver(\n entries => {\n entries.forEach(entry => {\n // Enforce the threshold EXPLICITLY. `isIntersecting` is spec-defined as\n // `intersectionRatio > 0` (any overlap), so the initial `observe()`\n // firing can report `true` at, say, 20% visible even with\n // `threshold: 0.5` — which would prematurely pass the gate. Require both\n // an intersection AND the ratio to actually meet the threshold (minus a\n // small epsilon for the float rounding where the ratio lands a hair\n // under the exact value).\n if (!entry.isIntersecting) return;\n if (entry.intersectionRatio < threshold - THRESHOLD_EPSILON) return;\n // Race-safe: re-read the callback at fire time. A late IO firing\n // after cleanup must not invoke a stale callback.\n const cb = subscribers.get(entry.target);\n if (cb) {\n cb();\n io.unobserve(entry.target);\n subscribers.delete(entry.target);\n }\n });\n },\n { rootMargin, threshold },\n );\n observers.set(key, io);\n return io;\n}\n\n/**\n * Default near-viewport lookahead — the SSOT for \"mount media on approach\".\n * Shared by this hook's default AND the raw two-way IntersectionObservers in\n * `cards-strip.tsx` / `video-bites-strip.tsx` (which need mount+unmount, not\n * this hook's fire-once semantics, but must agree on the distance).\n */\nexport const NEAR_VIEWPORT_ROOT_MARGIN = '500px';\n\nexport interface UseNearViewportResult<T extends Element = HTMLElement> {\n /** Ref to attach to the element you want to gate on visibility. */\n ref: (node: T | null) => void;\n /** Flips to `true` once the element enters within `rootMargin` of the viewport. Never flips back. */\n isNear: boolean;\n}\n\n/**\n * @param rootMargin Margin around the viewport (CSS-style string).\n * '500px' = element starts mounting 500px before scroll-in.\n * '1000px' = a full viewport's worth of lookahead.\n * '0px' = strict on-screen detection.\n * @param threshold Fraction of the element that must be visible before firing\n * (0 = any pixel — the default; 0.5 = at least half on-screen).\n */\nexport function useNearViewport<T extends Element = HTMLElement>(\n rootMargin: string = NEAR_VIEWPORT_ROOT_MARGIN,\n threshold: number = 0,\n): UseNearViewportResult<T> {\n const [isNear, setIsNear] = useState(false);\n const elRef = useRef<T | null>(null);\n const key = observerKey(rootMargin, threshold);\n\n // Subscribe/unsubscribe on element change.\n const ref = useCallback(\n (node: T | null) => {\n const prev = elRef.current;\n\n // Unsubscribe previous, if any. Identity-check the callback so a\n // StrictMode re-mount that has already re-registered keeps its sub.\n if (prev) {\n const stillOurs = subscribers.get(prev);\n if (stillOurs) {\n subscribers.delete(prev);\n observers.get(key)?.unobserve(prev);\n }\n }\n\n elRef.current = node;\n if (!node) return;\n\n const cb = () => setIsNear(true);\n subscribers.set(node, cb);\n getObserverFor(rootMargin, threshold).observe(node);\n },\n [key, rootMargin, threshold],\n );\n\n // Unsubscribe on unmount. Identity check guards the StrictMode race.\n useEffect(() => {\n return () => {\n const el = elRef.current;\n if (!el) return;\n if (subscribers.get(el)) {\n subscribers.delete(el);\n observers.get(key)?.unobserve(el);\n }\n };\n }, [key]);\n\n return { ref, isNear };\n}\n","/**\n * Fenced-code tracker — THE definition of \"am I inside a code fence\".\n * Server-safe: no React, no DOM.\n *\n * Lives in its own module because it is a GENERAL CommonMark fence machine\n * with two unrelated consumers: the heading scanner\n * (`utils/markdown-heading-id`) and the streaming block splitter\n * (`components/ui/markdown/streaming`). It used to live inside\n * `markdown-heading-id`, which meant a streaming renderer imported its fence\n * state machine from a module named after heading slugs. `markdown-heading-id`\n * re-exports these names so the public `utils` surface is unchanged.\n */\n\n/**\n * CommonMark fenced-code opener/closer. Fence indent is capped at 3 spaces\n * (4+ is an indented code block, whose backticks are literal content), and the\n * run length is captured so a closer can be required to be at least as long as\n * its opener. Matched on the RAW line — `trimStart()` would let a fence inside\n * 4-space-indented code toggle the state.\n *\n * `\\r`-TOLERANT BY CONSTRUCTION. The previous spelling ended `(.*)$`, and `.`\n * excludes `\\r` while `$` (no `m` flag) anchors at end of input — so on a CRLF\n * document, split on `\\n`, NO line ever matched and the tracker was completely\n * fence-blind: `['```js\\r','const a = 1\\r','```\\r','after\\r']` classified as\n * four `text` lines where the LF spelling gives `open/inside/close/text`. The\n * sanitizer's closer haystack then never blanked the fenced region, so a\n * `</textarea>` written as a CRLF code sample satisfied `hasLaterCloser` and a\n * prose `<textarea>` above it stayed LIVE (reproduced in the DOM; the LF twin\n * of the same fixture escapes correctly). The `\\r` is absorbed by `\\r?$` rather\n * than normalized out of the text, because the sanitizer's mask is\n * LENGTH-PRESERVING and every offset in it is an index into the original\n * string — stripping `\\r` would shift them all.\n *\n * THE ONLY COPY. This constant plus its open/close state machine used to be\n * duplicated verbatim in `components/ui/markdown/streaming.ts`, kept in sync\n * by a code comment — which is exactly how the `~~~`-blind extractor drifted\n * in the first place. Both consumers now instantiate `createFenceTracker()`.\n */\nconst FENCE_RE = /^ {0,3}(`{3,}|~{3,})([^\\n]*?)\\r?$/;\n\n/**\n * CommonMark's BLANK LINE — spaces and tabs only. The single definition, shared\n * by every consumer of this module (the sanitizer's mask passes, the heading\n * scanner, the HTML-block range walk).\n *\n * NOT `String.prototype.trim()`. JS `trim()` strips the full Unicode\n * White_Space set — U+00A0 NBSP, U+000B VT, U+000C FF, U+2028/9, U+FEFF BOM —\n * none of which CommonMark (or remark) treats as blank. Every place that meant\n * \"is this a CommonMark blank line?\" and asked `trim() === ''` therefore\n * TERMINATED a construct one line early while remark kept it open. Verified\n * end-to-end: `<div>\\n\\u00A0\\n\\`<textarea>\\`\\n\\nrest\\n` left a LIVE `<textarea>`\n * in the DOM (`escapeUnknownHtmlTags` returned the input byte-identical),\n * because the tracked HTML-block range ended at the NBSP filler line and the\n * inline-code shelter below it stopped being inside a tracked block. Same for\n * VT / FF / BOM, for `<pre>` / `<details>` wrappers, and for a live third-party\n * `<iframe>`.\n *\n * `\\r` IS accepted: a CRLF document split on `\\n` spells its blank lines\n * `\"\\r\"`, and the mask is length-preserving so stripping `\\r` from the source\n * is not an option (see `FENCE_RE`'s `\\r?$`).\n */\nconst BLANK_LINE_RE = /^[ \\t\\r]*$/;\n\n/** True when `line` is a CommonMark blank line (spaces/tabs only, `\\r`-tolerant). */\nexport function isBlankLine(line: string): boolean {\n return BLANK_LINE_RE.test(line);\n}\n\n/**\n * What one source line is, relative to fenced code:\n * - `open` — this line opened a fence\n * - `close` — this line closed the open fence\n * - `inside`— this line is fence content (including a would-be delimiter that\n * does NOT close the open fence: wrong marker char, too short, or\n * carrying an info string)\n * - `text` — this line is ordinary markdown outside any fence\n *\n * NOTE: no consumer discriminates the three non-`text` roles today — both the\n * heading scanner and the streaming splitter only test `!== 'text'`, and the\n * closer-haystack mask below only tests `=== 'open'` / `=== 'close'`. The\n * four-value union is kept because the state machine already computes the\n * distinction for free and a future consumer (e.g. fence-aware syntax\n * post-processing) would otherwise have to re-derive it.\n */\nexport type FenceLineRole = 'open' | 'close' | 'inside' | 'text';\n\nexport interface FenceTracker {\n /** Advance across one raw source line (mutates) and classify it. */\n push(line: string): FenceLineRole;\n /** Marker CHARACTER of the currently open fence (`` ` `` / `~`), or null. */\n openChar(): string | null;\n /** Run length of the currently open fence (a closer must be ≥ this). */\n openLength(): number;\n}\n\n/** A fresh fenced-code state machine. Server-safe: no React, no DOM. */\nexport function createFenceTracker(): FenceTracker {\n let fenceChar: string | null = null;\n let fenceLength = 0;\n return {\n push(line: string): FenceLineRole {\n const fence = FENCE_RE.exec(line);\n if (fence) {\n const run = fence[1];\n if (fenceChar === null) {\n fenceChar = run[0];\n fenceLength = run.length;\n return 'open';\n }\n // A closer must use the SAME marker char, be at least as long as the\n // opener, and (per CommonMark) carry no info string. \"No info string\"\n // means spaces/tabs only — `trim()` would accept an NBSP tail and close\n // a fence CommonMark keeps open, i.e. blank LESS of the haystack\n // (fail-OPEN). Hence `isBlankLine`, not `trim()`.\n if (run[0] === fenceChar && run.length >= fenceLength && isBlankLine(fence[2])) {\n fenceChar = null;\n fenceLength = 0;\n return 'close';\n }\n return 'inside';\n }\n return fenceChar === null ? 'text' : 'inside';\n },\n openChar: () => fenceChar,\n openLength: () => fenceLength,\n };\n}\n","/**\n * Markdown heading-id slug SSOT (server-safe: no React, no DOM).\n *\n * This algorithm previously existed in THREE byte-identical copies:\n * - `components/ui/simple-markdown-renderer.tsx` (generateHeadingId)\n * - `components/ui/rich-markdown-renderer.tsx` (generateHeadingId)\n * - `utils/markdown-section-extractor.ts` (extractSections)\n *\n * The extractor is the PRODUCER of `sectionIds` and the renderers are the\n * CONSUMERS — if the two ever drift, deep-link anchors and scroll-spy\n * targets silently diverge. All three now call these helpers; the parity\n * test `components/ui/__tests__/markdown-parity.test.tsx` asserts\n * extractor-vs-renderer ID agreement over the fixture corpus.\n */\n\n/** Emoji ranges stripped from heading text before slugification. */\nexport const HEADING_EMOJI_RE = /[\\u{1F300}-\\u{1F9FF}]|[\\u{2600}-\\u{26FF}]|[\\u{2700}-\\u{27BF}]/gu;\n\n/** Remove emoji characters and trim. */\nexport function stripHeadingEmojis(text: string): string {\n return text.replace(HEADING_EMOJI_RE, '').trim();\n}\n\n/**\n * Core slug chain WITHOUT the emoji strip (the extractor exposes emoji\n * stripping as an option, so the two steps are kept separable):\n * lowercase → drop non-word/space/hyphen chars → spaces to hyphens →\n * trim leading/trailing hyphens. May return `''` for symbol-only input —\n * callers apply their own fallback (`section-N`).\n */\nexport function slugifyHeadingBase(text: string): string {\n return text\n .trim()\n .toLowerCase()\n .replace(/[^\\w\\s-]/g, '')\n .replace(/\\s+/g, '-')\n .replace(/^-+|-+$/g, '');\n}\n\n/** The full default chain used by the renderers: emoji strip + slugify. */\nexport function slugifyHeadingText(text: string): string {\n return slugifyHeadingBase(stripHeadingEmojis(text));\n}\n\n// ---------------------------------------------------------------------------\n// Heading SCANNER + DEDUPER (the other half of the producer/consumer contract)\n// ---------------------------------------------------------------------------\n/**\n * Sharing the slug chain alone was not enough. The PRODUCER\n * (`utils/markdown-section-extractor`) and the CONSUMER\n * (`components/ui/markdown/heading-ids`) each carried their own copy of\n * \"which lines are headings\" and \"how do duplicates get suffixed\", and the\n * copies drifted:\n * - the extractor toggled its code-block state on a bare\n * `line.startsWith('```')`, so a `~~~`-fenced (or wider-backtick, or\n * indented) block containing `## Setup` produced a SECTION from the\n * extractor and NO id from the renderer — `sectionIdMap` then missed\n * silently and the deep-link anchor pointed nowhere;\n * - the extractor anchored ATX at column 0 while the renderer allowed the\n * CommonMark 0..3-space indent;\n * - the dedupe counter was hand-copied in both files, each with a comment\n * saying \"the two must agree\".\n * Both now call `scanHeadings` + `createHeadingIdDeduper`. Server-safe: no\n * React, no DOM.\n */\n\n// The CommonMark fence machine used to live in THIS file, which meant a\n// streaming renderer imported its fence state from a module named after\n// heading slugs. It now lives in `./markdown-fences`; re-exported here so the\n// public `utils` surface (and every existing import) is unchanged.\nexport { createFenceTracker, isBlankLine, type FenceTracker, type FenceLineRole } from './markdown-fences';\nimport { createFenceTracker, isBlankLine } from './markdown-fences';\n\n/** A heading the renderer will emit, located in the source. */\nexport interface ScannedHeading {\n /** 1-based line of the heading's FIRST line (setext: the title line). */\n line: number;\n level: number;\n /** Raw title text, before `stripInlineMarkdown` / slugification. */\n text: string;\n}\n\nexport interface ScanHeadingsOptions {\n /**\n * Skip a leading YAML frontmatter block (`---` on line 1 through the next\n * `---`). Only a DOCUMENT-LEADING block counts: a bare `---` mid-document\n * is a thematic break or a setext underline, and treating it as a\n * frontmatter toggle (what the extractor used to do) silently swallowed\n * every heading until the next one.\n */\n skipFrontmatter?: boolean;\n /** Include raw-HTML headings (`<h2>Title</h2>`). Default true. */\n includeRawHtml?: boolean;\n /**\n * Skip fenced-code blocks. Default true — a `##` inside a code fence is\n * code, not a heading, and the renderer emits no id for it.\n */\n skipFences?: boolean;\n}\n\n/**\n * EVERY line-anchored regex in this module ends `\\r?$`, not `$`.\n *\n * Lines here come from `content.split('\\n')`, so on a CRLF document each one\n * carries a trailing `\\r`. `$` (no `m` flag) anchors at end of string and `\\r`\n * is not in `[ \\t]`, so a `$`-anchored pattern matches NOTHING on such a\n * document. That was a live REGRESSION: `main`'s looser `^(#{1,6})\\s+(.+)`\n * had no end anchor at all and tolerated the `\\r` (the title was `.trim()`ed\n * afterwards), so `'# Real\\r\\n\\r\\nbody\\r\\n\\r\\n## Second\\r\\n'` yielded\n * `[\"Real\",\"Second\"]` on `main` and `[]` here — every CRLF-stored doc / blog /\n * release body silently lost its TOC, its in-page anchors and its doc-SEO\n * heading links.\n *\n * The `\\r` is ABSORBED, not normalized away: `scanHeadings` reports 1-based\n * LINE numbers that the renderer's id map is keyed by, and the sanitizer's mask\n * (which shares `markdown-fences`) is length-preserving — neither may be fed a\n * rewritten source.\n */\n/** CommonMark ATX heading (closing `#` run is not part of the title). */\nconst ATX_HEADING_RE = /^ {0,3}(#{1,6})[ \\t]+(.*?)(?:[ \\t]+#+)?[ \\t]*\\r?$/;\n/** ATX with no title at all (`###`, `## ###`) — still a heading, empty text. */\nconst ATX_EMPTY_RE = /^ {0,3}(#{1,6})[ \\t]*#*[ \\t]*\\r?$/;\n/**\n * Raw-HTML heading (`<h2 id=\"x\">Title</h2>`) — rehype-raw renders these too.\n * GLOBAL: two `<h3>`s on one line are two headings, and a non-global scan\n * silently dropped the second (it then fell through to the renderer's\n * suffix-free fallback and emitted a DUPLICATE DOM id).\n */\nconst RAW_HEADING_RE = /<h([1-6])\\b[^>]*>([\\s\\S]*?)(?:<\\/h\\1>|$)/gi;\n/**\n * Blockquote markers and list-item markers preceding an ATX heading\n * (`> ## Setup`, `- ## Setup`, `1. ## Setup`). mdast emits a REAL `<h2>` for\n * these; scanning only column-0..3 missed them entirely, so two identical\n * `> ## Setup` headings both hit the suffix-free fallback and emitted the\n * duplicate DOM ids this whole module exists to prevent.\n */\nconst CONTAINER_PREFIX_RE = /^ {0,3}(?:(?:>[ \\t]?)+|(?:[-+*]|\\d{1,9}[.)])[ \\t]+)+/;\n/** Setext underline (`===` → h1, `---` → h2), AFTER container-prefix strip. */\nconst SETEXT_UNDERLINE_RE = /^ {0,3}(=+|-+)[ \\t]*\\r?$/;\n/** Thematic break — ends a paragraph run, never underlines it. */\nconst THEMATIC_BREAK_RE = /^ {0,3}(\\*|_){3,}[ \\t]*\\r?$/;\n/**\n * CommonMark HTML-block type 6 tag names — these open a raw HTML block no\n * matter what follows them on the line.\n */\nconst HTML_BLOCK_TAGS =\n 'address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul';\n\n/**\n * A line that OPENS a raw HTML block. mdast hands the whole block to the HTML\n * parser, so a `---` inside it is not a setext underline and the lines above\n * it are not a paragraph: `<div>\\nText\\n---\\n</div>` emits NO heading. The\n * scanner used to publish a phantom `Text` h2 there.\n *\n * The naive `^ {0,3}<` this replaced disqualified any run whose first line\n * merely STARTED with a tag, so `<span>x</span> more text` + `---` (a plain\n * paragraph in mdast, yielding an h2) was missed. The alternatives are spelled\n * out per CommonMark:\n * - types 1-5: `<script|pre|style|textarea`, `<!--`, `<?`, `<!X`, `<![CDATA[`\n * - type 6: a `HTML_BLOCK_TAGS` name, whatever follows it\n * - type 7: ANY complete open/closing tag ALONE on the line (trailing\n * whitespace only) — this is the clause the old regex got wrong\n * Attribute soup inside a type-7 tag is approximated with `[^>]*` rather than\n * a full attribute grammar; the error bias is unchanged (a missed run costs a\n * TOC entry, never a wrong id — the same direction as the documented\n * list-item-indent gap in `SetextRun.prefix`).\n */\nconst HTML_BLOCK_OPENER_RE = new RegExp(\n '^ {0,3}(?:' +\n // types 1-5\n '<(?:script|pre|style|textarea)(?:[\\\\s>]|$)|<!--|<\\\\?|<![a-zA-Z]|<!\\\\[CDATA\\\\[' +\n // type 6\n `|</?(?:${HTML_BLOCK_TAGS})(?:[\\\\s/>]|$)` +\n // type 7 — a complete tag standing alone on the line\n '|<[a-zA-Z][a-zA-Z0-9-]*(?:\\\\s[^>]*)?/?>[ \\\\t]*\\\\r?$' +\n '|</[a-zA-Z][a-zA-Z0-9-]*[ \\\\t]*>[ \\\\t]*\\\\r?$' +\n ')',\n 'i',\n);\n\n/**\n * The paragraph RUN that a setext underline would convert into a heading.\n *\n * mdast positions a setext heading at the FIRST line of the paragraph and its\n * text is the WHOLE run (`Foo\\nbar\\n===` → `{line:1, text:\"Foo\\nbar\"}`). The\n * scanner used to remember only the LAST line, so the renderer's line-keyed\n * lookup missed the heading entirely (falling back to a slug of the rendered\n * children, `foo-bar`) while the extractor published `bar` — a dead deep\n * link, plus a phantom TOC entry at the wrong line.\n */\ninterface SetextRun {\n /** 1-based line of the run's FIRST line — where mdast puts the heading. */\n line: number;\n /**\n * Container prefix (`> `, `- `, …) every line of the run shares. The\n * underline must carry the IDENTICAL prefix, which is why `> Quote` +\n * `> ---` scans as an h2 while `> Quote` + a bare `---` does not.\n *\n * KNOWN, DELIBERATE GAP: a setext underline indented to a LIST ITEM's\n * content column (`- item` / ` ---`) is a heading in mdast but has no\n * container prefix at all, so this equality test misses it. Closing that\n * would mean re-deriving list-item content columns here — the scanner\n * simply emits nothing (the pre-existing behavior), which costs a TOC entry\n * and never produces a WRONG id.\n */\n prefix: string;\n /** Run lines with the container prefix stripped, in order. */\n lines: string[];\n /** Run opened with a raw-HTML block line — mdast emits no heading for it. */\n disqualified: boolean;\n}\n\n/**\n * Collect every heading the markdown renderer will emit, in document order.\n * THE single definition of \"which lines are headings\" for both the extractor\n * and the renderer's id map.\n */\nexport function scanHeadings(content: string, options: ScanHeadingsOptions = {}): ScannedHeading[] {\n const { skipFrontmatter = true, includeRawHtml = true, skipFences = true } = options;\n const out: ScannedHeading[] = [];\n const lines = content.split('\\n');\n // ONE fenced-code state machine (utils/markdown-fences), shared with\n // markdown/streaming.ts.\n const fences = skipFences ? createFenceTracker() : null;\n\n let start = 0;\n if (skipFrontmatter && lines[0]?.trim() === '---') {\n for (let i = 1; i < lines.length; i++) {\n if (lines[i].trim() === '---' || lines[i].trim() === '...') {\n start = i + 1;\n break;\n }\n }\n }\n\n // The paragraph run a setext underline would convert (see SetextRun).\n let setextRun: SetextRun | null = null;\n\n for (let i = start; i < lines.length; i++) {\n const line = lines[i];\n if (fences) {\n const role = fences.push(line);\n if (role !== 'text') {\n setextRun = null;\n continue;\n }\n }\n\n // Container prefix (`> `, `- `, `1. `) is stripped from EVERY construct\n // below, so a blockquote/list-nested heading is scanned in both its ATX\n // (`> ## Setup`) and setext (`> Quote title` / `> ---`) spellings.\n const prefix = CONTAINER_PREFIX_RE.exec(line)?.[0] ?? '';\n const body = prefix ? line.slice(prefix.length) : line;\n\n // --- setext (`Title` / `===`): a REAL h1/h2 in mdast, positioned at the\n // run's FIRST line — which is the line the heading-id map is keyed by.\n // The underline must carry the SAME container prefix as the run it\n // closes; `> Quote` followed by a bare `---` is a quote and a thematic\n // break, not a heading.\n const setext = SETEXT_UNDERLINE_RE.exec(body);\n if (setext) {\n if (setextRun && !setextRun.disqualified && setextRun.prefix === prefix) {\n out.push({\n line: setextRun.line,\n level: setext[1][0] === '=' ? 1 : 2,\n text: setextRun.lines.join('\\n'),\n });\n }\n setextRun = null;\n continue;\n }\n\n // --- ATX, including inside a blockquote / list item.\n const atx = ATX_HEADING_RE.exec(body) ?? ATX_EMPTY_RE.exec(body);\n if (atx) {\n out.push({ line: i + 1, level: atx[1].length, text: (atx[2] ?? '').trim() });\n setextRun = null;\n continue;\n }\n\n if (includeRawHtml && line.indexOf('<') !== -1) {\n RAW_HEADING_RE.lastIndex = 0;\n let raw: RegExpExecArray | null;\n let matched = false;\n while ((raw = RAW_HEADING_RE.exec(line)) !== null) {\n matched = true;\n out.push({\n line: i + 1,\n level: Number(raw[1]),\n text: raw[2].replace(/<[^>]*>/g, '').trim(),\n });\n }\n if (matched) {\n setextRun = null;\n continue;\n }\n }\n\n // Paragraph accumulation. A blank line or a thematic break ends the run;\n // a change of container prefix starts a new block (a list or blockquote\n // interrupts a paragraph in CommonMark).\n // CommonMark's blank line (spaces/tabs), NOT `trim()` — an NBSP-only line\n // is paragraph CONTENT to remark, so ending the run there would move a\n // setext heading's reported line off the run's first line.\n if (isBlankLine(body) || THEMATIC_BREAK_RE.test(body)) {\n setextRun = null;\n continue;\n }\n if (setextRun && setextRun.prefix === prefix) {\n setextRun.lines.push(body.trim());\n } else {\n setextRun = {\n line: i + 1,\n prefix,\n lines: [body.trim()],\n disqualified: HTML_BLOCK_OPENER_RE.test(body),\n };\n }\n }\n\n return out;\n}\n\n/**\n * The duplicate-id suffix counter, as ONE closure both sides instantiate.\n * First occurrence keeps the bare slug; the Nth gets `-N`. Extractor and\n * renderer MUST use the same counter or `#anchor` deep links diverge.\n */\nexport function createHeadingIdDeduper(): (cleanId: string) => string {\n const counts: Record<string, number> = {};\n return (cleanId: string): string => {\n if (counts[cleanId]) {\n counts[cleanId]++;\n return `${cleanId}-${counts[cleanId]}`;\n }\n counts[cleanId] = 1;\n return cleanId;\n };\n}\n","/**\n * GitHub-compatible anchor resolution for in-page `#hash` links.\n *\n * ## The mismatch this exists to bridge\n *\n * Doc authors write their table of contents against GitHub's slugger, which\n * keeps the separator left behind by a stripped emoji:\n *\n * `## 📚 Table of Contents` → GitHub anchor `#-table-of-contents`\n *\n * Our heading ids come from the shared slug SSOT (`markdown-heading-id`),\n * whose `slugifyHeadingBase` trims leading and trailing hyphens — so the same\n * heading renders as `id=\"table-of-contents\"`. The \"On this page\" rail\n * navigates by those ids and works; the in-body TOC link points at an id that\n * does not exist and the browser silently does nothing.\n *\n * Rather than change the id shape (it is already baked into shared URLs and\n * the rail), resolution is made tolerant: compare a *normalized* form of both\n * sides. This module owns ONLY that tolerance — the slug chain itself is\n * imported, never re-implemented, so a change to the id shape lands in one\n * place and both sides move together.\n *\n * Callers do not reach for this directly: `getHashTargetElement`\n * (`utils/same-page-hash-nav`) is the ONE resolver every hash consumer goes\n * through, and it applies this as its last pass.\n */\nimport { slugifyHeadingText } from './markdown-heading-id';\n\n/**\n * Reduce an anchor id (ours or GitHub's) to a comparable form.\n *\n * Everything but the final hyphen-run collapse is the shared heading-slug\n * chain: emoji strip → lowercase → drop non-word chars → spaces to hyphens →\n * trim edge hyphens. The collapse is this module's own addition, covering\n * GitHub's *interior* divergence — `## 💬 Community & Support` slugs to\n * `#-community--support` (a double hyphen around the dropped `&`) against our\n * `community-support`.\n *\n * `'-getting-started'` → `'getting-started'`\n * `'-community--support'` → `'community-support'`\n * `'Getting Started'` → `'getting-started'`\n */\nexport function normalizeAnchorId(raw: string): string {\n return slugifyHeadingText(raw)\n .replace(/-+/g, '-')\n .replace(/^-+|-+$/g, '');\n}\n\n/** Heading elements carrying an id — the candidate set for the fuzzy pass. */\nconst HEADING_SELECTOR = 'h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]';\n\n/** A `base-N` id, split into its base and ordinal. */\nconst DUPLICATE_SUFFIX_RE = /^(.+)-(\\d+)$/;\n\n/**\n * The two sides also disagree on where duplicate-heading numbering STARTS.\n * For a document with two `## Setup` headings GitHub emits `setup` and\n * `setup-1`, while `createHeadingIdDeduper` emits `setup` and `setup-2` (its\n * suffix is the occurrence COUNT, not the offset). So a GitHub `#setup-1`\n * needs our `setup-2` — every duplicate is off by exactly one.\n *\n * Runs LAST, after the exact lookup and the heading scan have both missed: a\n * heading that genuinely slugs to `step-2` is resolved long before this, and\n * the shift is the one pass that can match an id it was not asked for.\n */\nfunction findDuplicateShifted(normalized: string, doc: Document): HTMLElement | null {\n const parts = DUPLICATE_SUFFIX_RE.exec(normalized);\n if (!parts) return null;\n const ordinal = Number(parts[2]);\n if (!Number.isSafeInteger(ordinal)) return null;\n return doc.getElementById(`${parts[1]}-${ordinal + 1}`);\n}\n\n/**\n * Resolve a `#hash` id that no exact lookup matched, by comparing normalized\n * forms. Returns `null` when nothing in the document matches, so the caller\n * can leave the browser's default behavior alone rather than hijacking a\n * click that was never ours to handle.\n *\n * Three passes, in order of how much they assume:\n * 1. a single `getElementById` on the normalized id — catches the whole\n * emoji-hyphen family without walking the DOM;\n * 2. a heading scan — catches ids whose own raw form normalizes differently\n * (e.g. `a---b`, from a title containing a literal ` - `);\n * 3. the duplicate-heading shift (see `findDuplicateShifted`) — last,\n * because it is the only pass that resolves to an id the fragment did\n * not name.\n */\nexport function findAnchorElementByNormalizedId(rawId: string, doc: Document): HTMLElement | null {\n const normalized = normalizeAnchorId(rawId);\n if (!normalized) return null;\n\n if (normalized !== rawId) {\n const direct = doc.getElementById(normalized);\n if (direct) return direct;\n }\n\n for (const heading of Array.from(doc.querySelectorAll<HTMLElement>(HEADING_SELECTOR))) {\n if (normalizeAnchorId(heading.id) === normalized) return heading;\n }\n\n // Last: the shift would happily match an unrelated `x-3` for a `x-2` that\n // has no heading at all, so it runs only once the scan has come up empty.\n return findDuplicateShifted(normalized, doc);\n}\n","/**\n * `scrollElementIntoView` — canonical \"scroll an element to the top of the\n * viewport, account for sticky chrome, survive layout shifts\" helper.\n *\n * One shared implementation so every caller (the ticket drawer expand, the\n * hub's `useUnifiedNav` / `use-nav-link` hash scroll, doc-tree, delivery\n * `?focus=`, sticky-section-nav, …) inherits the SAME cancellation-proof\n * motion.\n *\n * WHY A SELF-DRIVEN rAF TWEEN INSTEAD OF `window.scrollTo({behavior:'smooth'})`:\n * the native smooth scroll is CANCELLABLE, and in real pages it gets cancelled\n * constantly:\n *\n * - Browser SCROLL ANCHORING: when content is inserted/removed above or\n * around the target (a collapsible drawer expanding, an async image\n * loading, a list re-rendering) the browser issues a synchronous scrollTop\n * correction to keep the anchored element stable. Per CSSOM-View \"perform a\n * scroll\" step 1 (\"abort any ongoing smooth scroll\"), that correction\n * ABORTS an in-flight native smooth scroll — so it lands as an instant jump.\n * Anchoring is suppressed when the scroll offset is 0, which is exactly why\n * a native smooth scroll appears to work the FIRST time (page at top) and\n * jumps on every repeat (page already scrolled). This was a multi-day\n * \"smooth only works once\" bug on the /tickets drawer.\n * - A second programmatic scroll on the same frame, or a `focus()` without\n * `{preventScroll:true}`, cancels it the same way.\n *\n * A tween that re-asserts the position with INSTANT writes every frame is\n * immune: there is no \"ongoing native smooth scroll\" for anchoring/focus to\n * abort, and any correction that lands between our frames is overwritten on the\n * next frame. We also RECOMPUTE the target each frame, so an element whose\n * final position is still settling (drawer still expanding, images loading)\n * is tracked to its resting place instead of animating to a stale pixel.\n *\n * Honors `prefers-reduced-motion` (jumps instantly) and cancels on genuine user\n * scroll intent (wheel / touch) so we never fight the user.\n *\n * WINDOW *OR* A SCROLLABLE ANCESTOR: the helper is not hard-wired to the window\n * scroller. It walks up from the target to the nearest ancestor that is an\n * actual scroll container (`overflow-y: auto | scroll | overlay` AND\n * `scrollHeight > clientHeight`) and drives THAT element; only when none exists\n * does it fall back to `window`. This is what makes it work inside app shells\n * that put page content in a fixed-height `<main class=\"overflow-y-auto\">`\n * (e.g. OpenFrame's `AppLayout`) where the document/window never scrolls — the\n * old window-only version was a silent no-op there. Note `overflow: clip` /\n * `hidden` are deliberately NOT treated as scroll containers, so a list wrapper\n * that uses `overflow-clip` only to round its corners still bubbles the scroll\n * up to the real container (matches the `<HelpCenterCard>` list intent).\n */\n\nexport interface ScrollElementIntoViewOptions {\n /** Pixels to subtract from the target element's `top` so it lands BELOW\n * sticky chrome. Defaults to 0. Pass `96` for the standard hub header. */\n headerOffset?: number;\n /** `'smooth'` (default) runs the self-driven tween; `'instant'` / `'auto'`\n * jump in one synchronous write (deep-link land, programmatic focus moves). */\n behavior?: ScrollBehavior;\n /** Optional adjustment applied to the computed pixel target each frame. The\n * callback receives the \"raw\" Y (`element.top + scrollY - headerOffset`) and\n * returns the FINAL target. Use when the caller knows about a layout shift\n * (e.g. a sibling drawer collapsing) the geometry can't yet reflect. */\n adjustTargetY?: (rawTargetY: number) => number;\n /** Tween duration in ms (smooth only). Default 320. */\n durationMs?: number;\n}\n\n/** Module-level handle to the in-flight tween so a new call (or a user\n * gesture) cancels the previous one — only ever one page-scroll animation at\n * a time. */\nlet activeRaf = 0;\nlet teardownActive: (() => void) | null = null;\n\nfunction cancelActiveScroll(): void {\n if (activeRaf) {\n cancelAnimationFrame(activeRaf);\n activeRaf = 0;\n }\n if (teardownActive) {\n teardownActive();\n teardownActive = null;\n }\n}\n\nconst easeOutCubic = (t: number): number => 1 - Math.pow(1 - t, 3);\n\n/** Nearest ancestor that is a *real* scroll container, or `null` when the\n * window/document is the scroller. Only `auto | scroll | overlay` count —\n * `clip` / `hidden` are intentionally excluded (a wrapper using `overflow-clip`\n * purely to round corners must let the scroll bubble to the page). */\nfunction getScrollableAncestor(el: HTMLElement): HTMLElement | null {\n for (let node = el.parentElement; node; node = node.parentElement) {\n const overflowY = getComputedStyle(node).overflowY;\n if (\n (overflowY === 'auto' || overflowY === 'scroll' || overflowY === 'overlay') &&\n node.scrollHeight > node.clientHeight\n ) {\n return node;\n }\n }\n return null;\n}\n\n/**\n * Scroll the page so `target` lands at the top of the viewport (below sticky\n * chrome via `headerOffset`). SSR-safe; `null`/`undefined` target is a no-op so\n * callers can pass refs without defensive branching.\n */\nexport function scrollElementIntoView(\n target: HTMLElement | null | undefined,\n options: ScrollElementIntoViewOptions = {},\n): void {\n if (typeof window === 'undefined' || !target) return;\n const { headerOffset = 0, behavior = 'smooth', adjustTargetY, durationMs = 320 } = options;\n\n // Pick the scroller ONCE: a fixed-height `<main overflow-y-auto>` shell scrolls\n // the element, a plain document scrolls the window. The choice can't change\n // mid-tween, so resolve it up front and route every read/write through it.\n const container = getScrollableAncestor(target);\n const readCurrent = (): number => (container ? container.scrollTop : window.scrollY);\n const writeTo = (y: number): void => {\n if (container) container.scrollTop = y;\n else window.scrollTo(0, y);\n };\n\n // Target is recomputed every frame: the row's absolute position can move as\n // the page reflows (a sibling drawer collapsing) and the reachable max grows\n // as the just-opened drawer expands. Clamp to the LIVE max each frame.\n const computeTarget = (): number => {\n const raw = container\n ? container.scrollTop +\n (target.getBoundingClientRect().top - container.getBoundingClientRect().top) -\n headerOffset\n : target.getBoundingClientRect().top + window.scrollY - headerOffset;\n const adjusted = adjustTargetY ? adjustTargetY(raw) : raw;\n const maxScroll = container\n ? Math.max(0, container.scrollHeight - container.clientHeight)\n : Math.max(0, document.documentElement.scrollHeight - window.innerHeight);\n return Math.min(Math.max(0, adjusted), maxScroll);\n };\n\n // Any prior animation loses — one page scroll at a time.\n cancelActiveScroll();\n\n const prefersReduced =\n typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n\n // Instant paths: a single synchronous write. No tween, no anchoring race.\n if (behavior === 'instant' || behavior === 'auto' || prefersReduced) {\n writeTo(computeTarget());\n return;\n }\n\n // Smooth: self-driven tween with instant per-frame writes (anchoring-proof).\n let startY: number | null = null;\n let startTime = 0;\n\n // Bail the moment the user takes over with a real scroll gesture — we must\n // never fight them. (Not keydown: the ticket composer auto-focuses on open,\n // and typing there should not abort the scroll.)\n const onUserGesture = () => cancelActiveScroll();\n window.addEventListener('wheel', onUserGesture, { passive: true });\n window.addEventListener('touchmove', onUserGesture, { passive: true });\n teardownActive = () => {\n window.removeEventListener('wheel', onUserGesture);\n window.removeEventListener('touchmove', onUserGesture);\n };\n\n const step = (now: number) => {\n if (startY === null) {\n startY = readCurrent();\n startTime = now;\n }\n const targetY = computeTarget();\n const t = Math.min(1, (now - startTime) / durationMs);\n const y = startY + (targetY - startY) * easeOutCubic(t);\n writeTo(y);\n if (t < 1) {\n activeRaf = requestAnimationFrame(step);\n } else {\n // Final exact write in case easing left a sub-pixel gap, then teardown.\n writeTo(computeTarget());\n activeRaf = 0;\n if (teardownActive) {\n teardownActive();\n teardownActive = null;\n }\n }\n };\n activeRaf = requestAnimationFrame(step);\n}\n","import { findAnchorElementByNormalizedId } from './anchor-id';\nimport { scrollElementIntoView } from './scroll-into-view';\n\n/** Pages with a section-nav STRIP on top of the global hub header\n * (dev-center roadmap/delivery/tickets, FAQ category-pill nav).\n * Anchor lands BELOW both layers. */\nexport const STICKY_HEADER_OFFSET_PX = 96;\n\n/** Pages with only the global hub header (docs, blog, vendor detail).\n * Anchor lands BELOW the header bar. */\nexport const HUB_HEADER_OFFSET_PX = 80;\n\n/**\n * Take only the FIRST hash segment from a fragment that may contain extra\n * `#` characters. `'' → ''`, `'#a' → '#a'`, `'#a#b' → '#a'`.\n *\n * No real DOM id contains `#`, so a multi-fragment hash is always a bug at\n * the composer site; `navigateSamePageHash` + `useScrollToHash` both call\n * this so URL bar and `getElementById` stay in sync.\n */\nexport function normalizeHashFragment(hash: string): string {\n if (!hash) return '';\n const second = hash.indexOf('#', 1);\n return second < 0 ? hash : hash.slice(0, second);\n}\n\n/**\n * Resolve the DOM element a hash fragment id points at — THE hash resolver;\n * `navigateSamePageHash`, `useScrollToHash` and the markdown link renderer\n * all go through this one, so a fragment that resolves for a deep link\n * resolves for an in-body click too.\n *\n * Three passes, cheapest first:\n * 1. the raw id (ordinary anchors — the overwhelming common case);\n * 2. the percent-decoded form — href composers like `buildTicketOpenHref`\n * encode the id into the fragment while rows render the raw id, so\n * `#ticket-a%2Fb` must still find `id=\"ticket-a/b\"`. A malformed escape\n * sequence just falls through;\n * 3. a NORMALIZED match against the document's headings — doc bodies are\n * authored on GitHub, whose slugger keeps the hyphen left behind by a\n * stripped emoji (`## 📚 Table of Contents` → `#-table-of-contents`)\n * while our ids trim it. Without this every in-body TOC link in every\n * GitHub-authored doc resolves to nothing and clicking one does nothing.\n * See `utils/anchor-id`.\n */\nexport function getHashTargetElement(id: string): HTMLElement | null {\n if (!id) return null;\n const direct = document.getElementById(id);\n if (direct) return direct;\n\n let decoded = id;\n try {\n decoded = decodeURIComponent(id);\n if (decoded !== id) {\n const decodedEl = document.getElementById(decoded);\n if (decodedEl) return decodedEl;\n }\n } catch {\n // malformed escape — the raw lookup above already covered it\n decoded = id;\n }\n\n return findAnchorElementByNormalizedId(decoded, document);\n}\n\nexport interface NavigateSamePageHashOptions {\n /** Pixels to subtract for sticky chrome. */\n headerOffset?: number;\n /** `'push'` (default) — new history entry; `'replace'` — overwrite\n * current entry (use for TOC-style in-page navigators). */\n history?: 'push' | 'replace';\n}\n\n/**\n * Same-page hash navigation primitive: pushState + synthetic `hashchange`\n * + anchoring-proof smooth scroll. Replaces `router.push` for hash CTAs\n * (Next.js suppresses smooth-scroll during navigation; `router.push` on\n * an exact-URL match is a no-op). Returns `true` when the helper claimed\n * the nav (same pathname + search); `false` for cross-page targets so\n * callers fall through to `router.push`.\n *\n * `target` accepts an origin-stripped path (`/x#anchor`) or a bare hash\n * (`#anchor`); bare-hash callers don't need to reconstruct `pathname +\n * search` themselves.\n */\nexport function navigateSamePageHash(target: string, options: NavigateSamePageHashOptions = {}): boolean {\n if (typeof window === 'undefined') return false;\n const { headerOffset = 0, history: historyMode = 'push' } = options;\n const normalizedTarget = target.startsWith('#') ? window.location.pathname + window.location.search + target : target;\n // `new URL(absoluteUrl, base)` ignores `base` per RFC 3986; an absolute\n // cross-origin target sharing pathname/search would otherwise pass the\n // check below and trip pushState's same-origin enforcement. Parse with\n // an explicit base so malformed inputs cleanly fall through.\n let url: URL;\n try {\n url = new URL(normalizedTarget, window.location.href);\n } catch {\n return false;\n }\n if (\n url.origin !== window.location.origin ||\n url.pathname !== window.location.pathname ||\n url.search !== window.location.search\n ) {\n return false;\n }\n const current = window.location.pathname + window.location.search + window.location.hash;\n // Heal a malformed multi-fragment hash so the URL bar is clean and\n // `getElementById` resolves. Dev-warn fingers the upstream composer.\n const normalizedHash = normalizeHashFragment(url.hash);\n if (process.env.NODE_ENV === 'development' && normalizedHash !== url.hash) {\n console.warn(\n `[navigateSamePageHash] malformed fragment \"${url.hash}\" → normalizing to \"${normalizedHash}\". Fix the upstream composer.`,\n );\n }\n const next = url.pathname + url.search + normalizedHash;\n const id = normalizedHash && normalizedHash !== '#' ? normalizedHash.slice(1) : '';\n // Hash-less targets are only ours on an EXACT URL re-click.\n if (!id && next !== current) return false;\n if (next !== current) {\n const oldURL = window.location.href;\n if (historyMode === 'replace') {\n window.history.replaceState(null, '', next);\n } else {\n window.history.pushState(null, '', next);\n }\n // Synthetic `hashchange` — `pushState` doesn't fire it (HTML spec),\n // so URL-hash-bound listeners (FAQ auto-expand, etc.) wouldn't react.\n window.dispatchEvent(\n new HashChangeEvent('hashchange', {\n oldURL,\n newURL: window.location.href,\n }),\n );\n }\n const el = id ? getHashTargetElement(id) : null;\n if (id && !el && process.env.NODE_ENV === 'development') {\n console.warn(`[navigateSamePageHash] anchor \"#${id}\" not found — scrolling to top.`);\n }\n // Missing anchor → tween to page top. `documentElement` is at 0 by\n // definition, so one tween covers both branches.\n scrollElementIntoView(el ?? document.documentElement, {\n behavior: 'smooth',\n headerOffset,\n });\n return true;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-Z42VU7HF.cjs","../src/components/docs/doc-viewer.tsx","../src/components/persistent-filter-controls.tsx","../src/components/docs/doc-navigation-context.tsx","../src/components/docs/use-docs-resolve-link.ts","../src/components/docs/use-document-tree.ts","../src/components/docs/use-scroll-spy.ts","../src/components/docs/skeletons.tsx","../src/components/docs/docs-hub-page.tsx"],"names":["jsx","useCallback","readString","useRef","pathParts","currentPath","useState","useMemo","jsxs"],"mappings":"AAAA,6xBAAY;AACZ;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACzCA,4EAAwB;AD2CxB;AACA;AEgBI,+CAAA;AATG,SAAS,wBAAA,CAAyB;AAAA,EACvC,SAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,gBAAA,EAAkB,GAAA;AAAA,EAClB,mBAAA,EAAqB,GAAA;AAAA,EACrB,mBAAA,EAAqB;AACvB,CAAA,EAAkC;AAChC,EAAA,uBACE,8BAAA;AAAA,IAAC,KAAA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","file":"/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-Z42VU7HF.cjs","sourcesContent":[null,"'use client';\n\nimport type React from 'react';\nimport { useMemo } from 'react';\nimport { useRouter } from '../../embed-shims/next-navigation';\nimport type { DocContent, DocNode, DocRenderHandlers, DocSourceId } from '../../types/doc-source';\nimport { findDocNodeByPath } from '../../utils/doc-tree-nav';\nimport { PageShell } from '../layout/article-detail-layout';\nimport { PageLayout } from '../layout/page-layout';\nimport { CategorySidebarSkeleton } from '../loading/page-layout-skeleton';\nimport { MultiLevelNavigation, MobileNavigationDropdown } from '../navigation/multi-level-navigation';\nimport { StickySectionNav } from '../navigation/sticky-section-nav';\nimport { PersistentSidebar, PersistentMobileDropdown } from '../persistent-filter-controls';\nimport { DocSearchBar, useDocSearch } from '../shared/doc-search';\nimport { useDocNavigation } from './doc-navigation-context';\nimport { useDocsResolveLink } from './use-docs-resolve-link';\nimport { useDocumentTree } from './use-document-tree';\nimport { useScrollSpy } from './use-scroll-spy';\n\n/** Color tokens for the doc-viewer chrome. Hub-side `DocViewer` callers share\n * this constant; no need to override per source — the palette is intentionally\n * uniform across knowledge-base + data-room (both use ODS dark tokens). */\nexport const DEFAULT_DOC_VIEWER_PALETTE = {\n background: 'bg-ods-bg',\n containerBackground: 'transparent',\n headerText: 'text-ods-text-primary',\n primaryText: 'text-ods-text-primary',\n secondaryText: 'text-ods-text-secondary',\n accent: 'var(--ods-accent)',\n border: 'border-ods-border',\n cardBackground: 'bg-ods-card',\n} as const;\n\nexport interface DocViewerProps {\n /**\n * Registry source id (`'openframe-docs'`, `'data-room-docs'`, …). Flowed through\n * `renderContent`'s handlers for `/api/docs/resolve-link` POSTs.\n */\n sourceId: DocSourceId;\n\n /**\n * Render the content body. The page shell owns this — it picks the markdown\n * renderer, dispatches PDF/Figma/Sheets/file branches, etc. No renderer\n * interface in between.\n */\n renderContent: (content: DocContent, handlers: DocRenderHandlers) => React.ReactNode;\n\n /**\n * Render the loading skeleton. Receives the selected node's `documentType`\n * (undefined while structure is still loading) so the caller can return a\n * markdown-shaped skeleton vs an embed-shaped skeleton.\n */\n renderSkeleton: (documentType: DocNode['documentType']) => React.ReactNode;\n\n /**\n * Chat-source identifier — passed in by the page shell from server-side\n * `currentPlatform()`. Lib has no platform context; the page shell is the\n * trusted boundary that wires this. NEVER pass user input here.\n */\n chatSource: string;\n\n /** Page title — rendered as the inline hero `<h1>` (same DOM\n * `<DevSectionView>`'s hero uses) so the doc-viewer chrome matches the\n * dev-section pages. ReactNode is intentionally not supported here —\n * every consumer renders the same typography. */\n title?: string;\n /** Optional icon rendered inline before the title text — same slot\n * `<DevSectionView>`'s hero uses (Map for Roadmap, Rocket for Releases,\n * etc.). Pass a pre-rendered React element styled with\n * `SECTION_HERO_ICON_CLASS` (`h-10 w-10 text-ods-accent`) for visual\n * parity with other lib pages. */\n titleIcon?: React.ReactNode;\n /** Subtitle (h6, secondary text) rendered beneath the title. */\n subtitle?: string;\n /** Render a yellow accent dot (`.`) after the title — same flag as\n * the hub's legacy `<AdminPageHeader accentDot>` so the docs-hub\n * surface keeps its existing accent styling after the migration. */\n accentDot?: boolean;\n /** Override the default ODS palette. Optional — most callers should omit. */\n colorPalette?: typeof DEFAULT_DOC_VIEWER_PALETTE;\n className?: string;\n /** Render the standalone `<PageShell>` (own `<main>` + bg + max-width). Default\n * true. Pass false when the host layout already provides the page container —\n * only the padding box renders, avoiding a nested `<main>`. */\n shell?: boolean;\n\n /** Initial doc path (URL `[...path]`). */\n docPath?: string;\n\n /** Sidebar header copy (`'DOCUMENTATION'`, `'DATA ROOM'`). */\n sidebarLabel?: string;\n\n /**\n * API endpoint for fetching the document tree structure. Defaults to the\n * dispatcher path `/api/docs/sources/${sourceId}/structure`. Override only\n * if hosting the viewer behind a different route.\n */\n structureEndpoint?: string;\n /** Same shape as `structureEndpoint`. Defaults to `/api/docs/sources/${sourceId}/content`. */\n contentEndpoint?: string;\n /** RAG-search endpoint that backs the in-source search bar (when `showAIChat`\n * is on). Defaults to `/api/docs/search`. Override for proxy-prefix embeds —\n * same injectability pattern as `structureEndpoint` / `contentEndpoint`. */\n searchEndpoint?: string;\n /** POST internal-link resolver. The viewer threads an async `onResolveLink`\n * into `renderContent`'s `handlers` that posts `{ link, currentPath, source }`\n * here. Defaults to `/api/docs/resolve-link`. Override for proxy-prefix embeds —\n * same injectability pattern as `structureEndpoint` / `contentEndpoint` /\n * `searchEndpoint`, with `ChatRuntime.endpoints.docsResolveLinkUrl` as a\n * runtime fallback (prop → runtime → default). */\n resolveLinkEndpoint?: string;\n /** Base route path for URL navigation. */\n baseRoute: string;\n\n /** Empty state copy when no doc is selected. */\n emptyStateText?: string;\n\n /** Whether to render the doc-search bar (bound to chat). */\n showAIChat?: boolean;\n\n /** Folder-index filename (default `'README.md'`). */\n folderIndexFile?: string;\n\n /** Back-button shown above the title. Mirrors `<DevSectionPage>` /\n * `<HelpCenterList>` / `<LegalDocumentPage>` so every embeddable surface\n * shares the same chrome. Defaults to `{ label: 'Back to home', href: '/' }`.\n * Pass `false` to hide; pass `{ href: '/docs' }` etc. when the embed's\n * home isn't `/`. */\n backButton?: { label?: string; href?: string } | false;\n}\n\nexport function DocViewer(props: DocViewerProps) {\n return <DocViewerContent {...props} />;\n}\n\nfunction DocViewerContent({\n sourceId,\n renderContent,\n renderSkeleton,\n chatSource,\n title,\n subtitle,\n colorPalette = DEFAULT_DOC_VIEWER_PALETTE,\n className = '',\n shell = true,\n docPath,\n sidebarLabel = 'DOCUMENTATION',\n structureEndpoint,\n contentEndpoint,\n searchEndpoint,\n resolveLinkEndpoint,\n baseRoute,\n emptyStateText,\n showAIChat = false,\n folderIndexFile,\n backButton,\n}: DocViewerProps) {\n // Default endpoints derived from sourceId. Hub callers omit the props in 99%\n // of cases; the override is for embed contexts where the doc-viewer sits\n // behind a non-standard route.\n const resolvedStructureEndpoint = structureEndpoint ?? `/api/docs/sources/${sourceId}/structure`;\n const resolvedContentEndpoint = contentEndpoint ?? `/api/docs/sources/${sourceId}/content`;\n // Resolve-link endpoint chain (prop → ChatRuntime.endpoints → hub default)\n // + the full fetch + JSON-parse pipeline live in `useDocsResolveLink`.\n // Keeping it factored out as a proper hook makes the contract reusable\n // by any embedder rendering doc content outside `<DocViewer>` (custom\n // markdown renderers, link-resolver previews, etc.) and keeps this\n // component focused on layout + state.\n const resolveLink = useDocsResolveLink(sourceId, resolveLinkEndpoint);\n const {\n structure,\n selectedPath,\n content,\n isLoadingStructure,\n isLoadingContent,\n error,\n expandedNodes,\n selectNode,\n toggleNode,\n navigateToDoc,\n } = useDocumentTree(\n {\n structureEndpoint: resolvedStructureEndpoint,\n contentEndpoint: resolvedContentEndpoint,\n baseRoute,\n folderIndexFile,\n },\n docPath,\n );\n\n const { activeSection, handleSectionClick } = useScrollSpy(content?.sections);\n\n const docNav = useDocNavigation();\n\n // Back-button config — mirrors `<DevSectionPage>` so the docs surface\n // matches every other embeddable page's chrome. Default target is `/`\n // (the embed's home); pass `backButton: false` to hide entirely, or\n // override the href when the embed's home isn't `/`.\n const router = useRouter();\n const backCfg =\n backButton === false\n ? null\n : {\n label: backButton?.label ?? 'Back to home',\n onClick: () => router.push(backButton?.href ?? '/'),\n };\n const docSearch = useDocSearch({\n source: chatSource,\n baseRoute,\n searchEndpoint,\n onNavigate: path => navigateToDoc(path, { fromInternalLink: true }),\n onInPageSwap: path => docNav.navigate(path),\n });\n\n const renderedContent = useMemo(() => {\n if (!content) return null;\n return renderContent(content, {\n onInternalLinkClick: navigateToDoc,\n // Relative-link base = the RENDERED document's path, NOT `selectedPath`.\n // They diverge for a no-README folder: selection stays on the folder\n // (e.g. `repo/diagrams`) while the body is its first descendant doc\n // (e.g. `repo/diagrams/architecture/README.md`, via `findFirstDocPath`).\n // Resolving `./sibling.mmd` against the folder would 404; resolving it\n // against `content.path` lands in the descendant's directory. The DAL\n // sets `content.path` to the served doc in all cases (file / README\n // folder / first-child fallback), so this is correct everywhere.\n currentPath: content.path,\n sourceId,\n onResolveLink: resolveLink,\n });\n }, [content, renderContent, navigateToDoc, sourceId, resolveLink]);\n\n // Selected node's documentType drives:\n // - which skeleton the caller renders during fetch (markdown vs embed)\n // - the article max-width + sticky-nav visibility (markdown only)\n // `undefined` documentType is treated as `'markdown'` (per the DocNode\n // discriminator's documented default).\n const selectedNodeDocType =\n selectedPath && structure.length > 0 ? findDocNodeByPath(selectedPath, structure)?.documentType : undefined;\n // During loading, the in-flight content's type isn't known yet — fall back\n // to the selected node's type (or markdown if neither is set).\n const activeDocType = content?.documentType ?? selectedNodeDocType;\n const isMarkdownContent = !activeDocType || activeDocType === 'markdown';\n const showStickyNav = isMarkdownContent;\n\n const stickyNavSections = content?.sections?.map(s => ({ id: s.id, label: s.title })) ?? [];\n\n const isColorValue =\n colorPalette.background.startsWith('#') ||\n colorPalette.background.startsWith('rgb') ||\n colorPalette.background.startsWith('var(');\n\n const bgStyle = isColorValue ? { backgroundColor: colorPalette.background } : {};\n const bgClass = !isColorValue ? colorPalette.background : '';\n const containerBgStyle =\n colorPalette.containerBackground !== 'transparent' ? { backgroundColor: colorPalette.containerBackground } : {};\n\n const defaultEmptyText =\n structure.length > 0\n ? 'Select a document from the sidebar to view'\n : 'No documents yet. Add content from the admin panel.';\n const resolvedEmptyText = emptyStateText || defaultEmptyText;\n\n // Unified header: title/subtitle route through the canonical (frozen)\n // `PageLayout` `TitleBlock` (text-h2) — same as every other help-center page —\n // so the docs hub shares one header. The `gap-10` column then holds the search\n // bar + content grid. `colorPalette` / `className` / `bgStyle` flow through the\n // shell's contentClassName + an inner style-passthrough wrapper.\n const inner = (\n <div style={{ ...bgStyle, ...containerBgStyle }}>\n <PageLayout title={title} subtitle={subtitle} titleSize=\"h1\" titleWrap backButton={backCfg ?? undefined}>\n <div className=\"flex w-full flex-col gap-10\">\n {showAIChat && (\n <DocSearchBar\n placeholder={`Search ${sidebarLabel?.toLowerCase() || 'documents'}...`}\n query={docSearch.query}\n onQueryChange={docSearch.setQuery}\n results={docSearch.results}\n isLoading={docSearch.isLoading}\n onResultSelect={docSearch.handleResultSelect}\n showDropdown={docSearch.keepDropdownOpen}\n />\n )}\n\n {error && (\n <div className=\"flex justify-center\">\n <div className=\"max-w-md rounded-lg border border-ods-border bg-ods-card p-8 text-center\">\n <h2 className=\"text-ods-text-primary text-h3\">Error Loading Documents</h2>\n <p className=\"mt-2 text-ods-text-secondary\">{error}. Please try again later.</p>\n </div>\n </div>\n )}\n\n {!error && (\n <div className=\"flex flex-1 flex-col items-start gap-6 lg:flex-row lg:gap-10\">\n <div className=\"w-full lg:w-[320px] lg:shrink-0\">\n <div className=\"lg:sticky lg:top-20\">\n {isLoadingStructure ? (\n <CategorySidebarSkeleton />\n ) : (\n <>\n <PersistentMobileDropdown isLoading={false}>\n <MobileNavigationDropdown\n nodes={structure}\n selectedPath={selectedPath}\n expandedNodes={expandedNodes}\n onNodeClick={selectNode}\n onToggleExpand={toggleNode}\n isLoading={false}\n folderIndexFile={folderIndexFile}\n />\n </PersistentMobileDropdown>\n\n <PersistentSidebar isLoading={false}>\n <div className=\"hidden lg:block\">\n <div className=\"space-y-4\">\n <h3 className=\"font-semibold text-ods-text-secondary text-h5\">{sidebarLabel}</h3>\n <MultiLevelNavigation\n nodes={structure}\n selectedPath={selectedPath}\n expandedNodes={expandedNodes}\n onNodeClick={selectNode}\n onToggleExpand={toggleNode}\n isLoading={false}\n folderIndexFile={folderIndexFile}\n />\n </div>\n </div>\n </PersistentSidebar>\n </>\n )}\n </div>\n </div>\n\n <div className=\"w-full min-w-0 flex-1\">\n <div\n className={`grid grid-cols-1 ${\n // \"On this page\" right column only makes sense for\n // MARKDOWN content (PDFs / Sheets / Figma / file have no\n // sections to navigate to). Gating the grid template on\n // `isMarkdownContent` also suppresses the section-skeleton\n // bars during embed loads — the user-reported \"skeleton\n // shouldn't be on file pages\" bug.\n isMarkdownContent &&\n ((showStickyNav && stickyNavSections.length > 0) || isLoadingContent || isLoadingStructure)\n ? 'lg:grid-cols-[1fr_280px]'\n : ''\n } gap-8`}\n >\n {/* min-w-0: grid items default to min-width:auto, which would\n let a long unbreakable token push this column past the\n track width. Pair with the inherited overflow-wrap:anywhere\n (app-globals.css) so content wraps instead of overflowing. */}\n <div className={`w-full min-w-0 ${isMarkdownContent ? 'mx-auto max-w-4xl' : ''}`}>\n <article className=\"space-y-2\">\n {isLoadingContent || isLoadingStructure ? (\n renderSkeleton(selectedNodeDocType)\n ) : !content ? (\n <div className=\"py-16 text-center\">\n <p className=\"text-ods-text-secondary text-h4\">{resolvedEmptyText}</p>\n </div>\n ) : (\n renderedContent\n )}\n </article>\n </div>\n\n {isMarkdownContent && (isLoadingContent || isLoadingStructure) && (\n <div className=\"hidden lg:block\">\n <div className=\"sticky top-24\">\n <div className=\"mb-5 h-[14px] w-28 animate-pulse rounded bg-ods-border\" />\n <div className=\"space-y-0\">\n {[130, 170, 190, 220, 110, 200, 80, 100, 120, 140, 90].map((w, i) => (\n <div\n key={i}\n className={`border-l-2 py-[13px] pl-3 ${\n i === 0 ? 'border-ods-accent' : 'border-transparent'\n }`}\n >\n <div className=\"h-[13px] animate-pulse rounded bg-ods-border\" style={{ width: w }} />\n </div>\n ))}\n </div>\n </div>\n </div>\n )}\n\n {showStickyNav && content && stickyNavSections.length > 0 && !isLoadingContent && (\n <div className=\"hidden lg:block\">\n <div className=\"sticky top-24\">\n <h3 className=\"mb-4 font-semibold text-ods-text-secondary text-h5\">ON THIS PAGE</h3>\n <StickySectionNav\n sections={stickyNavSections}\n activeSection={activeSection}\n onSectionClick={handleSectionClick}\n ribbonPosition=\"left\"\n ribbonColor=\"var(--ods-accent)\"\n />\n </div>\n </div>\n )}\n </div>\n </div>\n </div>\n )}\n </div>\n </PageLayout>\n </div>\n );\n\n // `shell` true → standalone `<PageShell>`; false → padding-only box (no nested\n // <main>) for hosts whose layout already provides the container. Both carry the\n // palette/className via the same `page-shell-content` styling hook.\n return shell ? (\n <PageShell contentClassName={`${bgClass} ${className}`}>{inner}</PageShell>\n ) : (\n <div className={`page-shell-content ${bgClass} ${className}`.trim()}>{inner}</div>\n );\n}\n","'use client';\n\nimport type { ReactNode } from 'react';\nimport { cn } from '../utils/cn';\n\ninterface PersistentFilterControlsProps {\n /**\n * Whether the filters are currently in a loading state\n */\n isLoading: boolean;\n /**\n * The filter control components (search, sidebar, mobile dropdown)\n */\n children: ReactNode;\n /**\n * Additional CSS classes\n */\n className?: string;\n /**\n * Disabled opacity (0-1)\n */\n disabledOpacity?: number;\n /**\n * Transition duration in milliseconds\n */\n transitionDuration?: number;\n /**\n * Whether to prevent pointer events during loading\n */\n preventInteraction?: boolean;\n}\n\n/**\n * PersistentFilterControls\n *\n * A wrapper component that keeps filter controls visible during loading states\n * but provides visual feedback that they are temporarily disabled.\n *\n * Features:\n * - Reduces opacity and disables pointer events during loading\n * - Maintains layout and accessibility during loading states\n * - Provides smooth transitions between enabled/disabled states\n * - Preserves keyboard navigation and screen reader functionality\n * - Applies consistent disabled styling across all filter types\n *\n * Usage:\n * ```tsx\n * <PersistentFilterControls isLoading={isLoadingVendors}>\n * <SearchContainer />\n * <CategoryFilterSidebar />\n * <MobileDropdown />\n * </PersistentFilterControls>\n * ```\n */\nexport function PersistentFilterControls({\n isLoading,\n children,\n className,\n disabledOpacity = 0.6,\n transitionDuration = 300,\n preventInteraction = true,\n}: PersistentFilterControlsProps) {\n return (\n <div\n className={cn(\n 'relative transition-all ease-in-out',\n isLoading && preventInteraction && 'pointer-events-none',\n className,\n )}\n style={{\n opacity: isLoading ? disabledOpacity : 1,\n transitionDuration: `${transitionDuration}ms`,\n }}\n role=\"region\"\n aria-label=\"Filter controls\"\n aria-busy={isLoading}\n data-loading={isLoading}\n >\n {/* Loading indicator overlay for screen readers */}\n {isLoading && (\n <div className=\"sr-only\" role=\"status\" aria-live=\"polite\">\n Filters temporarily disabled while loading content\n </div>\n )}\n\n {/* Filter controls with disabled state styling */}\n <div\n className={cn('transition-all ease-in-out', isLoading && 'cursor-not-allowed')}\n style={{\n transitionDuration: `${transitionDuration}ms`,\n }}\n >\n {children}\n </div>\n\n {/* Visual loading indicator */}\n {isLoading && (\n <div className=\"absolute right-2 top-2 z-10\" role=\"status\" aria-label=\"Loading filters\">\n <div className=\"h-4 w-4 animate-spin rounded-full border-2 border-ods-border border-t-ods-accent\" />\n </div>\n )}\n </div>\n );\n}\n\n/**\n * Enhanced SearchContainer wrapper that integrates with persistent loading\n */\ninterface PersistentSearchContainerProps {\n isLoading: boolean;\n children: ReactNode;\n className?: string;\n}\n\nexport function PersistentSearchContainer({ isLoading, children, className }: PersistentSearchContainerProps) {\n return (\n <PersistentFilterControls\n isLoading={isLoading}\n preventInteraction={false} // Keep search interactive during loading\n className={className}\n >\n {children}\n </PersistentFilterControls>\n );\n}\n\n/**\n * Enhanced sidebar wrapper for desktop filter controls\n */\ninterface PersistentSidebarProps {\n isLoading: boolean;\n children: ReactNode;\n className?: string;\n}\n\nexport function PersistentSidebar({ isLoading, children, className }: PersistentSidebarProps) {\n return (\n <PersistentFilterControls\n isLoading={isLoading}\n disabledOpacity={0.5}\n className={cn('lg:sticky lg:top-20', className)}\n >\n {children}\n </PersistentFilterControls>\n );\n}\n\n/**\n * Enhanced mobile dropdown wrapper\n */\ninterface PersistentMobileDropdownProps {\n isLoading: boolean;\n children: ReactNode;\n className?: string;\n}\n\nexport function PersistentMobileDropdown({ isLoading, children, className }: PersistentMobileDropdownProps) {\n return (\n <PersistentFilterControls isLoading={isLoading} disabledOpacity={0.7} className={cn('lg:hidden', className)}>\n {children}\n </PersistentFilterControls>\n );\n}\n","'use client';\n\nimport React, { createContext, useCallback, useContext, useRef, type ReactNode } from 'react';\nimport type { DocNode } from '../../types/doc-source';\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport interface DocNavigator {\n /** Base route this navigator owns (e.g., '/knowledge-base', '/data-room'). */\n baseRoute: string;\n /** Look up a node in the tree by its storage path (e.g., 'openframe-cli/README.md'). */\n findNodeByPath: (path: string) => DocNode | null;\n /** Navigate to a node using the same flow as a sidebar menu click. */\n selectNode: (node: DocNode) => void;\n}\n\ninterface DocNavigationContextValue {\n /**\n * Register a navigator for a `baseRoute`. Returns a cleanup function that\n * removes the navigator from the map IF the slot still owns it (StrictMode-safe).\n * Duplicate registration for the same baseRoute logs a console.warn and replaces.\n */\n register: (nav: DocNavigator) => () => void;\n /**\n * Navigate to a path inside whichever registered navigator owns its baseRoute prefix.\n * Returns true if handled, false otherwise (caller falls back to opening in a new tab).\n */\n navigate: (path: string) => boolean;\n /** Whether ANY navigator is currently mounted. */\n isAvailable: () => boolean;\n}\n\n// =============================================================================\n// Context\n// =============================================================================\n\nconst DocNavigationContext = createContext<DocNavigationContextValue | null>(null);\n\n/**\n * Bridges `useDocumentTree` instances (deep in the page tree) to `GlobalAskAI`\n * (high up near the root) without global events or URL parsing.\n *\n * Multi-navigator design: a `Map<baseRoute, DocNavigator>` lets multiple\n * viewers coexist (nested viewers, dual-pane scenarios). Today only one\n * viewer mounts at a time, so behavior is unchanged.\n */\nexport function DocNavigationProvider({ children }: { children: ReactNode }) {\n const navMap = useRef<Map<string, DocNavigator>>(new Map());\n\n const register = useCallback((nav: DocNavigator) => {\n const existing = navMap.current.get(nav.baseRoute);\n if (existing && existing !== nav) {\n console.warn(`[DocNavigationContext] duplicate registration for ${nav.baseRoute}; replacing`);\n }\n navMap.current.set(nav.baseRoute, nav);\n return () => {\n // StrictMode-safe identity check: only delete if THIS nav still owns the slot.\n if (navMap.current.get(nav.baseRoute) === nav) {\n navMap.current.delete(nav.baseRoute);\n }\n };\n }, []);\n\n const findOwningNavigator = useCallback((path: string): DocNavigator | null => {\n // First try: a navigator whose baseRoute is a prefix of `path`. Walks the\n // longest match first so nested routes win over a parent.\n const baseRoutes = Array.from(navMap.current.keys()).sort((a, b) => b.length - a.length);\n for (const baseRoute of baseRoutes) {\n if (path === baseRoute || path.startsWith(`${baseRoute}/`)) {\n return navMap.current.get(baseRoute) ?? null;\n }\n }\n // Fallback: a single navigator handles any path (existing behavior — chat\n // chips emit storage paths, not absolute URLs, so prefix matching misses).\n if (navMap.current.size === 1) {\n return navMap.current.values().next().value ?? null;\n }\n return null;\n }, []);\n\n const navigate = useCallback(\n (path: string): boolean => {\n const nav = findOwningNavigator(path);\n if (!nav) return false;\n const node = nav.findNodeByPath(path);\n if (!node) return false;\n nav.selectNode(node);\n return true;\n },\n [findOwningNavigator],\n );\n\n const isAvailable = useCallback(() => navMap.current.size > 0, []);\n\n const value = React.useMemo(() => ({ register, navigate, isAvailable }), [register, navigate, isAvailable]);\n\n return <DocNavigationContext.Provider value={value}>{children}</DocNavigationContext.Provider>;\n}\n\n// =============================================================================\n// Hooks\n// =============================================================================\n\nexport function useDocNavigation(): DocNavigationContextValue {\n const ctx = useContext(DocNavigationContext);\n if (!ctx) {\n // Safe no-op fallback when used outside the provider.\n return {\n register: () => () => {},\n navigate: () => false,\n isAvailable: () => false,\n };\n }\n return ctx;\n}\n","import { useCallback } from 'react';\nimport { useChatRuntime } from '../../contexts/chat-runtime-context';\nimport type { ResolveLinkResult } from '../../types/doc-source';\nimport { contentFetch } from '../../utils/embed-content-fetch';\n\n/**\n * `useDocsResolveLink(sourceId, override?)` — POST `/api/docs/resolve-link`\n * (or the override / `ChatRuntime.endpoints.docsResolveLinkUrl`) for a\n * relative href inside a doc body, returning a `ResolveLinkResult`\n * envelope.\n *\n * The endpoint chain (`override ?? runtime.endpoints.docsResolveLinkUrl\n * ?? '/api/docs/resolve-link'`) mirrors `searchEndpoint` resolution in\n * `<DocViewer>` so embedders configure both the same way: per-instance\n * prop OR ambient `ChatRuntimeProvider`.\n *\n * The full fetch + JSON-parse pipeline is wrapped in try/catch so a\n * network throw (DNS / CORS / offline) or a non-JSON response surfaces\n * as `{ success: false, error }` — the markdown renderer's broken-link\n * badge handles that branch instead of swallowing an unhandled rejection\n * past the click handler.\n */\n/**\n * Narrow the endpoint's answer to a `ResolveLinkResult`.\n *\n * `Response.json()` hands back `any`, and the route answers either the bare\n * result or a `{ data: … }` envelope — so the shape is checked instead of\n * trusted: a non-object body, or a field of the wrong primitive type, degrades\n * to `{ success: false }`, which is the \"leave the link alone\" branch the\n * markdown renderer already handles.\n *\n * Mirrors `toResolveLinkResult` in `ui/markdown/rich/rich-markdown-renderer`,\n * which narrows the same wire shape for the renderer's own fetch (that copy\n * cannot be imported here — it would pull the whole rich renderer chunk into\n * this hook).\n */\nfunction toResolveLinkResult(body: unknown): ResolveLinkResult {\n if (typeof body !== 'object' || body === null) {\n return { success: false };\n }\n const envelope: Record<string, unknown> = { ...body };\n const inner = envelope.data;\n const fields: Record<string, unknown> = typeof inner === 'object' && inner !== null ? { ...inner } : envelope;\n const readString = (key: string): string | undefined => (typeof fields[key] === 'string' ? fields[key] : undefined);\n\n return {\n success: fields.success === true,\n resolvedPath: readString('resolvedPath'),\n type: readString('type'),\n action: readString('action'),\n error: readString('error'),\n message: readString('message'),\n };\n}\n\nexport function useDocsResolveLink(sourceId: string, resolveLinkEndpoint?: string | null) {\n const chatRuntime = useChatRuntime();\n const resolvedResolveLinkEndpoint =\n resolveLinkEndpoint ?? chatRuntime?.endpoints.docsResolveLinkUrl ?? '/api/docs/resolve-link';\n\n return useCallback(\n async (href: string, currentPath: string): Promise<ResolveLinkResult> => {\n try {\n const response = await contentFetch(resolvedResolveLinkEndpoint, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ link: href, currentPath, source: sourceId }),\n });\n if (!response.ok) {\n return { success: false, error: `Resolve failed: ${response.status}` };\n }\n const json: unknown = await response.json();\n return toResolveLinkResult(json);\n } catch (error) {\n return {\n success: false,\n error: error instanceof Error ? error.message : 'Resolve failed',\n };\n }\n },\n [resolvedResolveLinkEndpoint, sourceId],\n );\n}\n","'use client';\n\nimport { useState, useEffect, useCallback, useMemo, useRef } from 'react';\nimport type { DocNode, DocContent, DocumentType } from '../../types/doc-source';\nimport { apiErrorMessage } from '../../utils/common';\nimport {\n stripFolderIndexFromPath,\n findDocNodeByPath,\n getDocAncestorNodeIds,\n DEFAULT_FOLDER_INDEX_FILE,\n} from '../../utils/doc-tree-nav';\nimport { contentFetch } from '../../utils/embed-content-fetch';\nimport { navigateSamePageHash, HUB_HEADER_OFFSET_PX } from '../../utils/same-page-hash-nav';\nimport { scrollElementIntoView } from '../../utils/scroll-into-view';\nimport { useDocNavigation } from './doc-navigation-context';\n\nfunction scrollToContent() {\n const article = document.querySelector('article');\n if (article) {\n scrollElementIntoView(article, { headerOffset: HUB_HEADER_OFFSET_PX });\n } else {\n // Same anchoring-proof tween for the no-article fallback — native smooth\n // scrollTo is cancelled by scroll anchoring while the new doc renders in.\n scrollElementIntoView(document.documentElement);\n }\n}\n\n/**\n * First displayable document inside a folder (depth-first): a direct non-Mermaid\n * file, else the first doc found in a subfolder. Used so a folder WITHOUT a\n * README shows its first child's content (mirroring how a README folder shows\n * its README) instead of a blank panel or a redundant in-page listing — the\n * sidebar tree is the directory browser. Returns null for a folder with no docs.\n */\nfunction findFirstDocPath(folder: DocNode): string | null {\n const children = folder.children ?? [];\n for (const child of children) {\n if (child.type === 'file' && !child.path.toLowerCase().endsWith('.mmd')) {\n return child.path;\n }\n }\n for (const child of children) {\n if (child.type === 'folder') {\n const nested = findFirstDocPath(child);\n if (nested) return nested;\n }\n }\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Wire decoding for the two doc-source endpoints\n//\n// `Response.json()` is typed `any`, so every field of both envelopes used to be\n// read off an `any` and the whole tree walk below inherited it. Both endpoints\n// are untrusted input — an embedder's reverse proxy answers them — so the shape\n// is validated once here instead of being trusted at ~30 read sites.\n//\n// Mirrors the narrowing `toResolveLinkResult` does for the resolve-link\n// envelope in `use-docs-resolve-link.ts`; that decoder covers a different\n// endpoint and is not reusable here.\n// ---------------------------------------------------------------------------\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/** `Array.isArray` narrows `unknown` to `any[]`; this keeps the elements `unknown`. */\nfunction isUnknownArray(value: unknown): value is readonly unknown[] {\n return Array.isArray(value);\n}\n\nfunction readString(source: Record<string, unknown>, key: string): string | undefined {\n const value = source[key];\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction isDocumentType(value: unknown): value is DocumentType {\n return value === 'markdown' || value === 'pdf' || value === 'google_sheet' || value === 'figma' || value === 'file';\n}\n\n/**\n * One tree node, or null when the row cannot be rendered.\n *\n * `id`, `name`, `path` and `type` are load-bearing: the sidebar calls\n * `node.name.endsWith('.md')` and every nav helper keys off `id`/`path`, so a\n * row missing one of them throws while rendering the tree rather than merely\n * looking wrong. Dropping the row keeps the rest of the tree browsable.\n *\n * `slug` is declared on `DocNode` but read nowhere in the lib, and the shared\n * `TreeNodeBase` producer contract does not carry it — so it is derived from\n * the path (the derivation the doc-source DALs use) when the payload omits it.\n */\nfunction toDocNode(value: unknown): DocNode | null {\n if (!isRecord(value)) return null;\n\n const id = readString(value, 'id');\n const name = readString(value, 'name');\n const path = readString(value, 'path');\n const type = value.type;\n if (id === undefined || name === undefined || path === undefined) return null;\n if (type !== 'file' && type !== 'folder') return null;\n\n const sortOrder = value.sortOrder;\n const hasReadme = value.hasReadme;\n\n return {\n id,\n name,\n slug: readString(value, 'slug') ?? path.split('/').pop() ?? '',\n path,\n type,\n hasReadme: typeof hasReadme === 'boolean' ? hasReadme : undefined,\n sortOrder: typeof sortOrder === 'number' ? sortOrder : undefined,\n documentType: isDocumentType(value.documentType) ? value.documentType : undefined,\n children: toDocNodes(value.children) ?? undefined,\n };\n}\n\n/** The tree, or null when the payload is not an array at all (a failed load). */\nfunction toDocNodes(value: unknown): DocNode[] | null {\n if (!isUnknownArray(value)) return null;\n const nodes: DocNode[] = [];\n for (const entry of value) {\n const node = toDocNode(entry);\n if (node) nodes.push(node);\n }\n return nodes;\n}\n\nfunction toDocSections(value: unknown): DocContent['sections'] {\n if (!isUnknownArray(value)) return [];\n const sections: DocContent['sections'] = [];\n for (const entry of value) {\n if (!isRecord(entry)) continue;\n const id = readString(entry, 'id');\n const title = readString(entry, 'title');\n const level = entry.level;\n if (id === undefined || title === undefined || typeof level !== 'number') continue;\n sections.push({ id, title, level });\n }\n return sections;\n}\n\nfunction toStringArray(value: unknown): string[] | undefined {\n if (!isUnknownArray(value)) return undefined;\n return value.filter((entry): entry is string => typeof entry === 'string');\n}\n\n/**\n * One document body, or null when the payload is not an object.\n *\n * `content` is declared required but is empty by nature for the rich document\n * types — a `pdf` / `google_sheet` / `figma` doc renders purely from `fileUrl`\n * / `externalUrl` (see `docs-hub-page.tsx`) — so a missing `content` is\n * normalized to `''` rather than treated as a failed load.\n *\n * `sections` and `path` are also declared required, and both leak when absent:\n * `path` feeds `DocRenderHandlers.currentPath`, which is what every relative\n * link inside the body is resolved against. `requestedPath` is the path this\n * fetch asked for, which is the correct value whenever the server omits it.\n */\nfunction toDocContent(value: unknown, requestedPath: string): DocContent | null {\n if (!isRecord(value)) return null;\n\n const fileSize = value.fileSize;\n\n return {\n content: readString(value, 'content') ?? '',\n sections: toDocSections(value.sections),\n path: readString(value, 'path') ?? requestedPath,\n documentType: isDocumentType(value.documentType) ? value.documentType : undefined,\n brokenLinks: toStringArray(value.brokenLinks),\n fileUrl: readString(value, 'fileUrl'),\n externalUrl: readString(value, 'externalUrl'),\n mimeType: readString(value, 'mimeType'),\n fileName: readString(value, 'fileName'),\n fileSize: typeof fileSize === 'number' ? fileSize : undefined,\n publishedAt: readString(value, 'publishedAt'),\n updatedAt: readString(value, 'updatedAt'),\n };\n}\n\nexport interface UseDocumentTreeConfig {\n /** API endpoint for fetching the document tree structure */\n structureEndpoint: string;\n /** API endpoint for fetching document content */\n contentEndpoint: string;\n /** Base route path for URL navigation (e.g., '/knowledge-base', '/data-room') */\n baseRoute: string;\n /** Folder-index filename (defaults to 'README.md'). */\n folderIndexFile?: string;\n}\n\n/**\n * Generic hook for document tree navigation and content fetching.\n * Drives DocViewer across all doc-source consumers.\n *\n * Client-only: structure + content fetches run in parallel on first mount.\n * No SSR pre-population — the previous SSR path required a Supabase admin\n * client (service role key) and silently fell back to client fetches on\n * envs where the key wasn't set; the parallel client fetches keep behavior\n * uniform across local + prod (latency ~= max(structure, content), not sum).\n */\nexport function useDocumentTree(config: UseDocumentTreeConfig, initialPath?: string) {\n const { structureEndpoint, contentEndpoint, baseRoute } = config;\n const folderIndexFile = config.folderIndexFile ?? DEFAULT_FOLDER_INDEX_FILE;\n\n const cleanInitialPath = stripFolderIndexFromPath(initialPath?.replace(/\\/$/, '') || '', folderIndexFile);\n\n const [structure, setStructure] = useState<DocNode[]>([]);\n const [selectedPath, setSelectedPath] = useState<string>(cleanInitialPath);\n const [content, setContent] = useState<DocContent | null>(null);\n const [isLoadingStructure, setIsLoadingStructure] = useState(true);\n const [isLoadingContent, setIsLoadingContent] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [expandedNodes, setExpandedNodes] = useState<Set<string>>(new Set());\n const lastFetchedPath = useRef<string | null>(null);\n\n const normalizedBaseRoute = baseRoute.replace(/\\/$/, '');\n\n // Refreshed after every commit rather than in the render body: the reader is\n // a popstate listener, which cannot fire before a commit, and a discarded\n // render attempt must not leave a path behind that was never navigated to.\n const selectedPathRef = useRef(selectedPath);\n useEffect(() => {\n selectedPathRef.current = selectedPath;\n });\n\n const docNavigation = useDocNavigation();\n\n useEffect(() => {\n const handlePopState = () => {\n const pathname = window.location.pathname;\n let pathFromUrl = '';\n\n if (pathname === normalizedBaseRoute || pathname === `${normalizedBaseRoute}/`) {\n pathFromUrl = '';\n } else if (pathname.startsWith(`${normalizedBaseRoute}/`)) {\n pathFromUrl = pathname.substring(`${normalizedBaseRoute}/`.length);\n }\n\n pathFromUrl = stripFolderIndexFromPath(pathFromUrl, folderIndexFile);\n\n if (pathFromUrl !== selectedPathRef.current) {\n setSelectedPath(pathFromUrl);\n if (pathFromUrl) {\n const parentPath = pathFromUrl.includes('/')\n ? pathFromUrl.substring(0, pathFromUrl.lastIndexOf('/'))\n : pathFromUrl;\n setExpandedNodes(new Set(getDocAncestorNodeIds(parentPath)));\n }\n setTimeout(() => {\n scrollToContent();\n }, 150);\n }\n };\n\n window.addEventListener('popstate', handlePopState);\n return () => window.removeEventListener('popstate', handlePopState);\n }, [normalizedBaseRoute, folderIndexFile]);\n\n // External-URL → state sync. The popstate listener above catches browser\n // back/forward, but client-side routers (react-router, Next App Router…)\n // change the URL via `history.pushState` which does NOT fire popstate.\n // The host re-renders the viewer with a new `initialPath` prop instead, so\n // we mirror the popstate logic here against the (memoized) `cleanInitialPath`.\n // Without this, a chat-card click that soft-navigates via react-router\n // updates the URL but the viewer stays on the previously-selected doc.\n //\n // Adjusted while rendering — React's documented pattern for a prop-driven\n // sync — rather than from an effect: the viewer renders `selectedPath` and\n // `expandedNodes` in THIS render, so an effect painted a full frame of the\n // previous document (and the previous expanded branch) before swapping. The\n // guard compares against the `selectedPath` STATE rather than the popstate\n // listener's ref, both because a ref must not be read during render and\n // because at this point the two hold the same value.\n const [syncedInitialPath, setSyncedInitialPath] = useState(cleanInitialPath);\n const [externalNavCount, setExternalNavCount] = useState(0);\n if (syncedInitialPath !== cleanInitialPath) {\n setSyncedInitialPath(cleanInitialPath);\n if (cleanInitialPath !== selectedPath) {\n setSelectedPath(cleanInitialPath);\n if (cleanInitialPath) {\n const parentPath = cleanInitialPath.includes('/')\n ? cleanInitialPath.substring(0, cleanInitialPath.lastIndexOf('/'))\n : cleanInitialPath;\n setExpandedNodes(new Set(getDocAncestorNodeIds(parentPath)));\n }\n // Counter rather than a flag: it makes the scroll below fire once per\n // ACTUAL external navigation, which is exactly when the old effect\n // reached its `setTimeout` — a bare `cleanInitialPath` dep would also\n // fire for the host mirroring a sidebar click back into the URL.\n setExternalNavCount(n => n + 1);\n }\n }\n\n // Match popstate's scroll-to-content delay; the targeted content fetch\n // dispatched by the selectedPath effect lands before this fires.\n useEffect(() => {\n if (externalNavCount === 0) return undefined;\n const timer = setTimeout(scrollToContent, 150);\n return () => clearTimeout(timer);\n }, [externalNavCount]);\n\n const fetchStructure = async () => {\n try {\n setIsLoadingStructure(true);\n setError(null);\n\n const response = await contentFetch(structureEndpoint);\n\n if (!response.ok) {\n throw new Error('Failed to load documentation structure');\n }\n\n const payload: unknown = await response.json();\n // A non-array `data` used to be handed straight to `setStructure`, and\n // every later `findDocNodeByPath` then tried to iterate it — a hard\n // \"nodes is not iterable\" throw instead of the error banner below.\n const nodes = isRecord(payload) && payload.success ? toDocNodes(payload.data) : null;\n\n if (nodes) {\n setStructure(nodes);\n\n if (cleanInitialPath) {\n const pathForExpansion = cleanInitialPath.includes('.')\n ? cleanInitialPath.substring(0, cleanInitialPath.lastIndexOf('/'))\n : cleanInitialPath;\n if (pathForExpansion) {\n setExpandedNodes(new Set(getDocAncestorNodeIds(pathForExpansion)));\n }\n } else if (nodes.length > 0) {\n const hasRootReadme = nodes.some(node => node.type === 'file' && node.path === folderIndexFile);\n\n if (!hasRootReadme) {\n const firstNode = nodes[0];\n if (firstNode.type === 'folder') {\n setExpandedNodes(new Set([firstNode.id]));\n if (firstNode.hasReadme) {\n setSelectedPath(firstNode.path);\n window.history.replaceState({}, '', `${normalizedBaseRoute}/${firstNode.path}`);\n }\n }\n }\n }\n } else {\n setError(apiErrorMessage(payload, 'Failed to load documentation structure'));\n }\n } catch (err) {\n console.error('Error fetching documentation structure:', err);\n setError(err instanceof Error ? err.message : 'Failed to load documentation');\n } finally {\n setIsLoadingStructure(false);\n }\n };\n\n const fetchContent = async (path: string) => {\n try {\n setIsLoadingContent(true);\n // Don't clear `error` here — if a previous fetch set an error and this\n // is a stale/speculative call that gets superseded, the guard below\n // returns early without writing to state. Clearing error here would\n // briefly flicker the user-visible error message.\n\n const response = await contentFetch(`${contentEndpoint}?path=${encodeURIComponent(path)}`);\n\n // Request-id guard: between awaits, `lastFetchedPath.current` may have\n // been bumped by a newer fetch (the structure-arrives auto-select issues\n // a more-targeted fetch while the speculative one is in flight). Bail\n // BEFORE writing to state — otherwise the late 404 of the speculative\n // fetch overwrites the targeted fetch's good content with null.\n if (path !== lastFetchedPath.current) return;\n\n if (!response.ok) {\n if (response.status === 404) {\n const errorPayload: unknown = await response.json().catch(() => null);\n if (path !== lastFetchedPath.current) return;\n // Landing-page silent fallback: when the user lands on the source's\n // root URL and there's no root `README.md` (knowledge-base case),\n // the speculative fetch 404s — surface an empty state instead of\n // an error banner. The structure-arrives auto-select will fire\n // a targeted fetch for the first-folder README on the next render.\n if (path === folderIndexFile && selectedPath === '') {\n // Superseded by the auto-select fetch the structure effect fires.\n // Null the request id so the `finally` does NOT drop the spinner —\n // otherwise there's a 1-frame gap (isLoadingContent false, content\n // null) where the empty state flashes before the real fetch starts.\n lastFetchedPath.current = null;\n setError(null);\n setContent(null);\n return;\n }\n // No-README FOLDER → stay silent: the content effect resolves it to\n // the folder's first child, so the folder-path 404 from the direct-\n // load speculative fetch is expected, not an error to flash.\n const probe = findDocNodeByPath(stripFolderIndexFromPath(path, folderIndexFile), structure);\n const probeIsNoReadmeFolder = !!probe && probe.type === 'folder' && !probe.hasReadme;\n // Before the structure has loaded to classify the path (`structure`\n // is [] in the speculative call's closure), only silence FOLDER-LIKE\n // paths (no `.md`) — a genuinely missing `*.md` leaf must still error.\n const preStructureFolderLike = structure.length === 0 && !path.endsWith('.md');\n if (probeIsNoReadmeFolder || preStructureFolderLike) {\n // Superseded by the targeted fetch (first-child / reclassified path)\n // the structure effect fires. Null the request id so the `finally`\n // keeps the spinner up instead of flashing an empty state for a\n // frame before that fetch starts.\n lastFetchedPath.current = null;\n setError(null);\n setContent(null);\n return;\n }\n setError(apiErrorMessage(errorPayload, 'Documentation file not found'));\n setContent(null);\n return;\n }\n throw new Error('Failed to load documentation content');\n }\n\n const payload: unknown = await response.json();\n if (path !== lastFetchedPath.current) return;\n setError(null);\n\n const doc = isRecord(payload) && payload.success ? toDocContent(payload.data, path) : null;\n\n if (doc) {\n // `correctPath` is only honored when it is actually a string. The old\n // `!== undefined` check also admitted `null`, which `setSelectedPath`\n // then stored as the selection: the URL became `${baseRoute}/null` and\n // the content effect's `selectedPath === null` guard bailed on every\n // subsequent run, freezing the viewer on that document.\n const correctPath = isRecord(payload) && payload.redirect ? readString(payload, 'correctPath') : undefined;\n if (correctPath !== undefined) {\n setSelectedPath(correctPath);\n window.history.replaceState({}, '', `${normalizedBaseRoute}/${correctPath}`);\n }\n setContent(doc);\n } else {\n setError(apiErrorMessage(payload, 'Failed to load content'));\n setContent(null);\n }\n } catch (err) {\n if (path !== lastFetchedPath.current) return;\n console.error('Error fetching documentation content:', err);\n setError(err instanceof Error ? err.message : 'Failed to load content');\n setContent(null);\n } finally {\n // Only clear loading state if THIS fetch is still the active one — a\n // superseded speculative shouldn't flip the spinner off while the\n // targeted fetch is still in flight.\n if (path === lastFetchedPath.current) setIsLoadingContent(false);\n }\n };\n // `fetchStructure` / `fetchContent` are plain async functions rebuilt on\n // every render, so neither effect below can take them as dependencies: the\n // init effect would re-fire its speculative fetch and the path effect would\n // refetch the same document on every parent render. Read through a ref that\n // is refreshed after every commit, so both always call the current closures.\n const latestRef = useRef({ fetchContent, fetchStructure, cleanInitialPath, folderIndexFile });\n useEffect(() => {\n latestRef.current = { fetchContent, fetchStructure, cleanInitialPath, folderIndexFile };\n });\n\n // Mount-only. The `isInitialized` state this used to latch on was read\n // NOWHERE else: it was a run-once guard that cost a setState in an effect\n // body (and a second, no-op run of this effect) to say what empty deps say\n // directly.\n useEffect(() => {\n // Kick off the speculative content fetch IN PARALLEL with the structure\n // fetch — the two endpoints are independent and most landing pages have\n // a root README (the default folder-index). If the structure ends up\n // pointing at a different path (e.g. knowledge-base falls back to the\n // first-folder README because there's no root README), the content\n // useEffect issues the correct fetch after structure arrives — the\n // speculative result silently no-ops (the content state update gets\n // overwritten by the targeted fetch).\n const latest = latestRef.current;\n const speculativeContentPath = latest.cleanInitialPath || latest.folderIndexFile;\n lastFetchedPath.current = speculativeContentPath;\n // Both settle their own failures into `error` state via try/catch/finally,\n // so neither can reject; they are deliberately NOT awaited so the two\n // independent endpoints stay in parallel.\n void latest.fetchContent(speculativeContentPath);\n void latest.fetchStructure();\n }, []);\n\n useEffect(() => {\n if (selectedPath === null || selectedPath === undefined) return;\n if (!structure || structure.length === 0) return;\n\n let pathToFetch: string | null = null;\n\n if (selectedPath === '') {\n pathToFetch = folderIndexFile;\n } else {\n const node = findDocNodeByPath(selectedPath, structure);\n\n if (node && node.type === 'folder' && !node.hasReadme) {\n // No-README folder has no body of its own — show its FIRST child doc\n // (mirrors a README folder showing its README). selectedPath stays the\n // folder, so the sidebar keeps it highlighted/expanded; the sidebar is\n // the directory browser, so we render NO separate in-page listing.\n const firstDocPath = findFirstDocPath(node);\n if (!firstDocPath) {\n // Genuinely empty folder — nothing to fetch. The empty state itself\n // is DERIVED (see `isEmptyFolder` below); clearing content/error/\n // loading from here would be a second render pass to publish\n // something `structure` + `selectedPath` already say.\n lastFetchedPath.current = null;\n return;\n }\n pathToFetch = firstDocPath;\n } else if (node && node.type === 'folder' && node.hasReadme) {\n // `getContent(folder)` already resolves a README folder to its README,\n // so the initial speculative fetch (which uses the bare folder path)\n // ALREADY loaded this content. Re-fetching the `${folder}/README.md`\n // variant is a redundant 2nd request whose in-flight `isLoadingContent`\n // flashes the skeleton — content → skeleton → content — on first load.\n // Skip it when the folder path was already the (speculatively) fetched\n // path; the result (or its in-flight request) covers the README.\n if (lastFetchedPath.current === selectedPath) {\n return;\n }\n pathToFetch = `${selectedPath}/${folderIndexFile}`;\n } else {\n pathToFetch = selectedPath;\n }\n }\n\n if (pathToFetch === lastFetchedPath.current) {\n return;\n }\n\n if (pathToFetch) {\n lastFetchedPath.current = pathToFetch;\n // Never rejects — settles its own failures into `error` state.\n void latestRef.current.fetchContent(pathToFetch);\n }\n }, [selectedPath, structure, folderIndexFile]);\n\n const toggleNode = useCallback((nodeId: string) => {\n setExpandedNodes(prev => {\n const next = new Set(prev);\n if (next.has(nodeId)) {\n next.delete(nodeId);\n } else {\n next.add(nodeId);\n }\n return next;\n });\n }, []);\n\n // Structural minimum the body uses — `id`, `path`, `type`, `hasReadme`.\n // Widening from `DocNode` lets the navigation components (which carry the\n // narrower `NavigationNode` row shape) pass their own node back without the\n // cross-type `as` cast. Both DocNode and NavigationNode satisfy this.\n const selectNode = useCallback(\n (node: Pick<DocNode, 'id' | 'path' | 'type' | 'hasReadme'>) => {\n // Expansion only: clicking a folder toggles its own subtree; clicking a file\n // reveals its ancestor chain.\n if (node.type === 'folder') {\n setExpandedNodes(prev => {\n if (prev.has(node.id)) {\n const ancestorIds = getDocAncestorNodeIds(node.path);\n ancestorIds.pop(); // collapse self, keep ancestors open\n return new Set(ancestorIds);\n }\n return new Set(getDocAncestorNodeIds(node.path));\n });\n } else {\n const lastSlash = node.path.lastIndexOf('/');\n if (lastSlash > 0) {\n setExpandedNodes(new Set(getDocAncestorNodeIds(node.path.substring(0, lastSlash))));\n }\n }\n\n // Every node is a navigable destination — a file shows its body, a README\n // folder its README, a no-README folder its first child doc (the content\n // effect resolves which). So selection + URL + scroll are identical for all\n // node types; no per-type special-casing.\n lastFetchedPath.current = null;\n setSelectedPath(node.path);\n window.history.pushState({}, '', `${normalizedBaseRoute}/${node.path}`);\n setTimeout(scrollToContent, 150);\n },\n [normalizedBaseRoute],\n );\n\n const navigateToDoc = useCallback(\n (path: string, options?: { expandFolder?: boolean; fromInternalLink?: boolean }) => {\n const hashIndex = path.indexOf('#');\n const anchor = hashIndex !== -1 ? path.substring(hashIndex) : '';\n const cleanPath = path.replace(/\\/$/, '').split('#')[0];\n\n // Same-doc-different-anchor shortcut. Content is already mounted, so we\n // don't need the 300ms \"wait-for-fetch\" bandaid — the canonical helper\n // owns pushState + synthetic `hashchange` (so any in-doc TOC / accordion\n // bound to the URL hash re-renders) + the anchoring-proof tween in one\n // sync call. `headerOffset: HUB_HEADER_OFFSET_PX` matches the cross-doc path below so\n // anchors land BELOW the docs sticky header on every same-doc internal\n // link click. Cross-doc nav (different cleanPath) falls through to the\n // existing fetch-then-scroll path below.\n //\n // We pass the BARE-hash form to the helper rather than reconstructing\n // a full `${normalizedBaseRoute}/${cleanPath}${anchor}` path: the\n // helper's pathname check compares against `window.location.pathname`,\n // which carries the FOLDER-INDEX-STRIPPED form (`/docs/foo` for\n // `foo/README.md`, `/docs` for the root index). Handing it `cleanPath`\n // — the raw resolved path — produces e.g. `/docs/foo/README.md` and\n // the compare fails → helper returns false → silent dead-click. The\n // bare-hash form sidesteps that entirely: the helper reconstructs\n // `pathname + search + hash` from `window.location`, so the compare\n // is trivially equal. Covers bare `#anchor` links (resolve to\n // `cleanPath=''`) AND folder-index links (`foo/README.md` resolving\n // to the current `/docs/foo`).\n // Bare-hash internal links (`[Click](#section)`) come in as\n // `path === '#section'`, so `cleanPath` becomes `''` and the naive\n // strip-then-compare misses the same-doc shortcut on every NON-root\n // doc (selectedPath is e.g. `'foo/bar'`, not `''`). For that case the\n // current doc IS the same-doc target by definition — short-circuit\n // pathForSelection to the current selection so the shortcut fires.\n const pathForSelection =\n anchor && options?.fromInternalLink && cleanPath === ''\n ? selectedPathRef.current\n : stripFolderIndexFromPath(cleanPath, folderIndexFile);\n if (anchor && options?.fromInternalLink && pathForSelection === selectedPathRef.current) {\n navigateSamePageHash(anchor, { headerOffset: HUB_HEADER_OFFSET_PX });\n return;\n }\n\n const scrollAfterNav = () => {\n if (anchor) {\n setTimeout(() => {\n const el = document.getElementById(anchor.substring(1));\n if (el) {\n scrollElementIntoView(el, { headerOffset: HUB_HEADER_OFFSET_PX });\n } else {\n scrollToContent();\n }\n }, 300);\n } else {\n setTimeout(() => {\n scrollToContent();\n }, 150);\n }\n };\n\n if (options?.expandFolder) {\n lastFetchedPath.current = null;\n setSelectedPath(cleanPath);\n window.history.pushState({}, '', `${normalizedBaseRoute}/${cleanPath}${anchor}`);\n\n const pathParts = cleanPath.split('/');\n const nodeIdsToExpand: string[] = [];\n let currentPath = '';\n\n for (const part of pathParts) {\n currentPath = currentPath ? `${currentPath}-${part}` : part;\n nodeIdsToExpand.push(currentPath.toLowerCase());\n }\n\n setExpandedNodes(new Set(nodeIdsToExpand));\n\n if (options?.fromInternalLink) {\n scrollAfterNav();\n }\n\n setError(null);\n return;\n }\n\n // `pathForSelection` was already computed above (inside the\n // same-doc-anchor shortcut check); reuse it here for cross-doc nav.\n const urlPath = pathForSelection;\n\n lastFetchedPath.current = null;\n setSelectedPath(pathForSelection);\n window.history.pushState({}, '', `${normalizedBaseRoute}/${urlPath}${anchor}`);\n\n if (options?.fromInternalLink) {\n scrollAfterNav();\n }\n\n const pathParts = cleanPath.split('/');\n const parentIds: string[] = [];\n let currentPath = '';\n const partsToProcess = cleanPath.includes('.') ? pathParts.slice(0, -1) : pathParts;\n\n for (const part of partsToProcess) {\n currentPath = currentPath ? `${currentPath}-${part}` : part;\n parentIds.push(currentPath.toLowerCase());\n }\n\n if (parentIds.length > 0) {\n setExpandedNodes(new Set(parentIds));\n }\n },\n [normalizedBaseRoute, folderIndexFile],\n );\n\n useEffect(() => {\n return docNavigation.register({\n baseRoute: normalizedBaseRoute,\n findNodeByPath: path => {\n const clean = stripFolderIndexFromPath(path.replace(/\\/$/, '').split('#')[0], folderIndexFile);\n return findDocNodeByPath(clean, structure) ?? null;\n },\n selectNode,\n });\n }, [docNavigation, normalizedBaseRoute, structure, selectNode, folderIndexFile]);\n\n // A folder with no README and no documents anywhere under it has no body at\n // all, and that is a pure fact about `structure` + `selectedPath` — both\n // available while rendering. Derived here rather than written into state from\n // the content effect, which reached the same conclusion one commit later and\n // meanwhile left the PREVIOUS document's body on screen.\n const isEmptyFolder = useMemo(() => {\n if (!selectedPath || structure.length === 0) return false;\n const node = findDocNodeByPath(selectedPath, structure);\n return !!node && node.type === 'folder' && !node.hasReadme && !findFirstDocPath(node);\n }, [selectedPath, structure]);\n\n return {\n structure,\n selectedPath,\n setSelectedPath,\n content: isEmptyFolder ? null : content,\n isLoadingStructure,\n isLoadingContent: isEmptyFolder ? false : isLoadingContent,\n error: isEmptyFolder ? null : error,\n expandedNodes,\n toggleNode,\n selectNode,\n navigateToDoc,\n refetch: fetchStructure,\n setExpandedNodes,\n };\n}\n\nexport type { DocNode, DocContent };\n","'use client';\n\nimport { useState, useRef, useCallback, useEffect, useMemo } from 'react';\nimport { scrollElementIntoView } from '../../utils/scroll-into-view';\n\n// Single source for the sticky-chrome height. Used for BOTH the scroll target\n// offset (where a clicked section lands) AND the active-section detection\n// threshold (where the scroll listener flips highlight). They must match —\n// previously 100 vs 150 caused a 50px window where the indicator jumped to\n// the next section even though that section's top was still below the\n// clicked one's resting offset.\nconst SCROLL_OFFSET = 100;\n\n// Separator for the section-id key. A newline cannot occur inside an HTML id,\n// so the join is unambiguous and the key can be split back apart.\nconst ID_SEPARATOR = '\\n';\n\ninterface ScrollSpySection {\n id: string;\n title?: string;\n level?: number;\n}\n\ninterface UseScrollSpyReturn {\n activeSection: string;\n handleSectionClick: (sectionId: string) => void;\n}\n\n/**\n * Shared scroll spy hook for tracking active section based on scroll position.\n * Used by DocViewer for sticky section navigation.\n */\nexport function useScrollSpy(sections: ScrollSpySection[] | undefined): UseScrollSpyReturn {\n const [activeSection, setActiveSection] = useState('');\n const isScrollingFromClick = useRef(false);\n\n // The scroll listener only ever needs the section IDS, and callers rebuild\n // the `sections` array on every render — so the value-stable joined key IS\n // the input, and the effect unpacks it again. That replaces a ref written\n // during render whose only job was to keep the array's churning identity out\n // of the dependency array.\n const sectionIdsKey = useMemo(() => sections?.map(s => s.id).join(ID_SEPARATOR) ?? '', [sections]);\n\n const handleSectionClick = useCallback((sectionId: string) => {\n const targetElement = document.getElementById(sectionId);\n if (!targetElement) return;\n\n isScrollingFromClick.current = true;\n setActiveSection(sectionId);\n\n scrollElementIntoView(targetElement, { headerOffset: SCROLL_OFFSET });\n\n setTimeout(() => {\n isScrollingFromClick.current = false;\n }, 800);\n }, []);\n\n useEffect(() => {\n const sectionIds = sectionIdsKey === '' ? [] : sectionIdsKey.split(ID_SEPARATOR);\n if (sectionIds.length === 0) return undefined;\n\n const handleScroll = () => {\n if (isScrollingFromClick.current) return;\n\n const scrollPosition = window.scrollY + SCROLL_OFFSET;\n let currentSection = sectionIds[0] ?? '';\n\n for (let i = sectionIds.length - 1; i >= 0; i--) {\n const element = document.getElementById(sectionIds[i]);\n if (element && scrollPosition >= element.offsetTop) {\n currentSection = sectionIds[i];\n break;\n }\n }\n\n setActiveSection(prev => (prev !== currentSection ? currentSection : prev));\n };\n\n let scrollTimer: ReturnType<typeof setTimeout>;\n const throttledScroll = () => {\n clearTimeout(scrollTimer);\n scrollTimer = setTimeout(handleScroll, 100);\n };\n\n window.addEventListener('scroll', throttledScroll);\n handleScroll();\n\n return () => {\n window.removeEventListener('scroll', throttledScroll);\n clearTimeout(scrollTimer);\n };\n }, [sectionIdsKey]);\n\n return { activeSection, handleSectionClick };\n}\n","/**\n * Text-style skeleton — matches a rendered markdown article layout.\n * Used by `<DocsHubPage>` as the default for `markdown` (and unknown\n * document types). Embedders can override via `renderSkeleton`.\n */\nexport function MarkdownSkeleton() {\n return (\n <div className=\"mt-6 space-y-7\">\n <div className=\"space-y-[14px]\">\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-3/4 animate-pulse rounded bg-ods-border\" />\n </div>\n <div className=\"space-y-[14px]\">\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-5/6 animate-pulse rounded bg-ods-border\" />\n </div>\n <div className=\"space-y-[14px]\">\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-2/3 animate-pulse rounded bg-ods-border\" />\n </div>\n <div className=\"h-[88px] animate-pulse rounded-lg border border-ods-border bg-ods-card\" />\n <div className=\"h-7 w-1/3 animate-pulse rounded bg-ods-border\" />\n <div className=\"space-y-[14px]\">\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-[72%] animate-pulse rounded bg-ods-border\" />\n </div>\n <div className=\"space-y-[14px]\">\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-[58%] animate-pulse rounded bg-ods-border\" />\n </div>\n <div className=\"h-7 w-2/5 animate-pulse rounded bg-ods-border\" />\n <div className=\"space-y-[14px]\">\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-[90%] animate-pulse rounded bg-ods-border\" />\n </div>\n <div className=\"space-y-[14px]\">\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-full animate-pulse rounded bg-ods-border\" />\n <div className=\"h-[16px] w-[70%] animate-pulse rounded bg-ods-border\" />\n </div>\n <div className=\"h-[88px] animate-pulse rounded-lg border border-ods-border bg-ods-card\" />\n </div>\n );\n}\n\n/**\n * Embed-style skeleton — matches the iframe loading state for `pdf`,\n * `google_sheet`, `figma`, and `file` document types. Used by\n * `<DocsHubPage>` as the default for non-markdown documentTypes.\n *\n * The skeleton is documentType-aware so its layout matches the actual\n * viewer that will replace it:\n * - `pdf` → header with title + TWO buttons (Preview, Download)\n * - `google_sheet`/`figma` → header with title + ONE button/toggle\n * - `file` → centered FileDownloadCard-style box\n * - undefined / others → generic (1-button header)\n *\n * IMPORTANT: bars use `bg-ods-border` (NOT `bg-ods-skeleton`). The\n * `--ods-skeleton` token resolves to TRANSPARENT in this build, leaving\n * the skeleton box visually empty — the embed skeleton was the loudest\n * surface affected (a full-height iframe area showing nothing). Same fix\n * the chat-message-row skeleton already documents in its inline comment.\n */\nexport interface EmbedSkeletonProps {\n /** When provided, the header layout matches the eventual viewer's\n * button count + arrangement, so the layout doesn't shift on load. */\n documentType?: 'pdf' | 'google_sheet' | 'figma' | 'file' | string;\n}\n\nexport function EmbedSkeleton({ documentType }: EmbedSkeletonProps = {}) {\n // Centered card shape for the `file` documentType — matches\n // `<FileDownloadCard>`'s `flex flex-col items-center justify-center py-16`\n // + bordered card with icon, name, type/size row, Download button.\n if (documentType === 'file') {\n return (\n <div className=\"flex flex-col items-center justify-center py-16\">\n <div className=\"w-full max-w-md space-y-4 rounded-xl border border-ods-border bg-ods-card p-8 text-center\">\n <div className=\"mx-auto h-16 w-16 animate-pulse rounded bg-ods-border\" />\n <div className=\"space-y-2\">\n <div className=\"mx-auto h-5 w-2/3 animate-pulse rounded bg-ods-border\" />\n <div className=\"mx-auto h-4 w-1/2 animate-pulse rounded bg-ods-border\" />\n </div>\n <div className=\"h-10 w-full animate-pulse rounded bg-ods-border\" />\n </div>\n </div>\n );\n }\n\n // PDF viewer has TWO buttons (Preview + Download); Sheets / Figma\n // render ONE (Open / view-toggle). Default to one for unknown types.\n const buttonCount = documentType === 'pdf' ? 2 : 1;\n\n return (\n <div className=\"space-y-4\">\n {/* Header — matches the actual viewer's\n * `flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`\n * (mobile-stacked, desktop-row). */}\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n {/* Left: icon + title */}\n <div className=\"flex min-w-0 flex-1 items-center gap-2\">\n <div className=\"h-5 w-5 shrink-0 animate-pulse rounded bg-ods-border\" />\n <div className=\"h-6 w-2/3 animate-pulse rounded bg-ods-border\" />\n </div>\n {/* Right: 1 or 2 buttons. Mobile = full-width; desktop = auto. */}\n <div className=\"flex w-full items-center gap-2 sm:w-auto\">\n {Array.from({ length: buttonCount }).map((_, i) => (\n <div key={i} className=\"h-10 w-full flex-1 animate-pulse rounded bg-ods-border sm:w-32 sm:flex-initial\" />\n ))}\n </div>\n </div>\n {/* Body — clean iframe-sized rectangle, no fake inner placeholder\n * cruft. Matches the viewer's default `calc(100vh - 250px)` height. */}\n <div\n className=\"w-full animate-pulse rounded-lg border border-ods-border bg-ods-card\"\n style={{ height: 'calc(100vh - 250px)' }}\n />\n </div>\n );\n}\n","import type React from 'react';\nimport type { DocContent, DocRenderHandlers, DocumentType } from '../../types/doc-source';\nimport { FigmaEmbed } from '../embeds/figma-embed';\nimport { FileDownloadCard } from '../embeds/file-download-card';\nimport { GoogleSheetsViewer } from '../embeds/google-sheets-viewer';\nimport { PdfViewer } from '../embeds/pdf-viewer';\nimport { DocViewer, type DocViewerProps } from './doc-viewer';\nimport { MarkdownSkeleton, EmbedSkeleton } from './skeletons';\n\ntype DocRenderer = (content: DocContent, handlers: DocRenderHandlers) => React.ReactNode;\n\n/**\n * Per-document-type renderer map. `markdown` is required (the lib does NOT\n * ship a default markdown renderer — embedders pick their own library +\n * sanitization to avoid an XSS surface in the lib).\n *\n * `pdf` / `google_sheet` / `figma` / `file` are optional — the lib provides\n * defaults from `components/embeds`. Override only when you want different\n * props than the default (e.g. a custom PDF toolbar, embedded credentials).\n */\nexport type DocumentTypeRenderers = { markdown: DocRenderer } & Partial<Record<DocumentType, DocRenderer>>;\n\nexport interface DocsHubPageProps extends Omit<DocViewerProps, 'renderContent' | 'renderSkeleton' | 'showAIChat'> {\n /** Per-document-type renderer map. `markdown` is REQUIRED. */\n documentTypeRenderers: DocumentTypeRenderers;\n\n /** Renderer for unknown / future document types. Defaults to a lib-styled\n * \"Unsupported document type\" message. */\n fallbackRenderer?: DocRenderer;\n\n /** Loading skeleton picker. Defaults: `markdown` / `undefined` →\n * `<MarkdownSkeleton>`, everything else → `<EmbedSkeleton>`. */\n renderSkeleton?: (documentType: DocumentType | undefined) => React.ReactNode;\n\n /** Defaults to `true` (the embeddable wrapper favors the chat-enabled\n * experience). Only mounts the in-source RAG search bar\n * (`<DocSearchBar>`) — does NOT require `ChatRuntimeContext`. */\n showAIChat?: boolean;\n}\n\nconst DEFAULT_TITLE = 'Documents';\n\nconst defaultFallbackRenderer: DocRenderer = () => (\n <div className=\"py-16 text-center\">\n <p className=\"text-ods-text-secondary\">Unsupported document type</p>\n </div>\n);\n\n// When the DAL hasn't populated the URL field for a rich-content type, the\n// embed-viewer components render a broken iframe (empty src). Fall back to\n// the same lib-styled \"Unsupported document type\" panel the explicit\n// fallback uses — the surface is honest about the missing data instead of\n// pretending to load. `FileDownloadCard` handles its own missing-URL state\n// (hides the Download button), so it doesn't need this guard.\nconst defaultPdfRenderer: DocRenderer = (content, handlers) =>\n content.fileUrl ? (\n <PdfViewer src={content.fileUrl} fileName={content.fileName} />\n ) : (\n defaultFallbackRenderer(content, handlers)\n );\n\nconst defaultGoogleSheetRenderer: DocRenderer = (content, handlers) =>\n content.externalUrl ? (\n <GoogleSheetsViewer externalUrl={content.externalUrl} fileName={content.fileName} />\n ) : (\n defaultFallbackRenderer(content, handlers)\n );\n\nconst defaultFigmaRenderer: DocRenderer = (content, handlers) =>\n content.externalUrl ? (\n <FigmaEmbed url={content.externalUrl} title={content.fileName} loading=\"eager\" />\n ) : (\n defaultFallbackRenderer(content, handlers)\n );\n\nconst defaultFileRenderer: DocRenderer = content => (\n <FileDownloadCard\n fileName={content.fileName}\n mimeType={content.mimeType}\n fileSize={content.fileSize}\n fileUrl={content.fileUrl}\n />\n);\n\nconst defaultRenderSkeleton = (documentType: DocumentType | undefined) =>\n !documentType || documentType === 'markdown' ? (\n <MarkdownSkeleton />\n ) : (\n // Forward the documentType so the embed skeleton renders the right\n // shape (PDF=2 buttons, sheets/figma=1 button, file=centered card).\n <EmbedSkeleton documentType={documentType} />\n );\n\n/**\n * Embeddable docs-hub page. Bundles `<DocViewer>` with safe defaults so the\n * minimum embed is a one-line mount (consumer only has to supply\n * `documentTypeRenderers.markdown`).\n *\n * Used by the hub at `/knowledge-base` and `/data-room`, and by third-party\n * React apps that embed the docs experience behind their own proxy. See\n * `docs/EMBEDDING_DOCS_HUB.md` for the embedder setup.\n *\n * SEO note: this component is `'use client'` (via the docs barrel) — server-\n * side SEO is the host's responsibility. The hub's `<DocSeoContent>` is the\n * canonical implementation embedders can reference.\n */\nexport function DocsHubPage({\n title = DEFAULT_TITLE,\n documentTypeRenderers,\n fallbackRenderer = defaultFallbackRenderer,\n renderSkeleton = defaultRenderSkeleton,\n showAIChat = true,\n className = 'min-h-screen',\n sidebarLabel = 'DOCUMENTATION',\n ...docViewerProps\n}: DocsHubPageProps) {\n const resolvedRenderers: DocumentTypeRenderers = {\n markdown: documentTypeRenderers.markdown,\n pdf: documentTypeRenderers.pdf ?? defaultPdfRenderer,\n google_sheet: documentTypeRenderers.google_sheet ?? defaultGoogleSheetRenderer,\n figma: documentTypeRenderers.figma ?? defaultFigmaRenderer,\n file: documentTypeRenderers.file ?? defaultFileRenderer,\n };\n\n const renderContent: DocViewerProps['renderContent'] = (content, handlers) => {\n const type = content.documentType ?? 'markdown';\n const renderer = resolvedRenderers[type] ?? fallbackRenderer;\n return renderer(content, handlers);\n };\n\n return (\n <DocViewer\n {...docViewerProps}\n title={title}\n showAIChat={showAIChat}\n className={className}\n sidebarLabel={sidebarLabel}\n renderContent={renderContent}\n renderSkeleton={renderSkeleton}\n />\n );\n}\n"]}