@flamingo-stack/openframe-frontend-core 0.0.510 → 0.0.511

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 (208) hide show
  1. package/dist/{chunk-GE3JUTW2.js → chunk-27OKD7ZV.js} +44 -14
  2. package/dist/chunk-27OKD7ZV.js.map +1 -0
  3. package/dist/{chunk-2RLI5XVI.cjs → chunk-2CE725NN.cjs} +16 -16
  4. package/dist/{chunk-2RLI5XVI.cjs.map → chunk-2CE725NN.cjs.map} +1 -1
  5. package/dist/{chunk-Q4K3TGNP.cjs → chunk-3NECEXDF.cjs} +74 -44
  6. package/dist/chunk-3NECEXDF.cjs.map +1 -0
  7. package/dist/{chunk-RJ3D3PE2.cjs → chunk-4SG55XVA.cjs} +9 -9
  8. package/dist/{chunk-RJ3D3PE2.cjs.map → chunk-4SG55XVA.cjs.map} +1 -1
  9. package/dist/{chunk-SYZFFRVD.cjs → chunk-5BAGE7AI.cjs} +13 -13
  10. package/dist/{chunk-SYZFFRVD.cjs.map → chunk-5BAGE7AI.cjs.map} +1 -1
  11. package/dist/{chunk-6FIDTXYC.js → chunk-7AQSXQEL.js} +3 -3
  12. package/dist/{chunk-6TL5XIAW.cjs → chunk-7YV67K3I.cjs} +119 -119
  13. package/dist/{chunk-6TL5XIAW.cjs.map → chunk-7YV67K3I.cjs.map} +1 -1
  14. package/dist/{chunk-5CDPRCPS.cjs → chunk-A5YZUV6B.cjs} +23 -23
  15. package/dist/{chunk-5CDPRCPS.cjs.map → chunk-A5YZUV6B.cjs.map} +1 -1
  16. package/dist/{chunk-WSAPKKDU.cjs → chunk-C4EUXZSA.cjs} +9 -9
  17. package/dist/{chunk-WSAPKKDU.cjs.map → chunk-C4EUXZSA.cjs.map} +1 -1
  18. package/dist/{chunk-5AZZQQYS.cjs → chunk-DPLXHG7H.cjs} +40 -40
  19. package/dist/{chunk-5AZZQQYS.cjs.map → chunk-DPLXHG7H.cjs.map} +1 -1
  20. package/dist/{chunk-BTUHMCYW.js → chunk-FS3YSNSU.js} +193 -6
  21. package/dist/chunk-FS3YSNSU.js.map +1 -0
  22. package/dist/{chunk-RB2EW6IZ.cjs → chunk-GHXTF35X.cjs} +3231 -3165
  23. package/dist/chunk-GHXTF35X.cjs.map +1 -0
  24. package/dist/{chunk-7VUKIWF6.cjs → chunk-HIV2GIFP.cjs} +3 -3
  25. package/dist/{chunk-7VUKIWF6.cjs.map → chunk-HIV2GIFP.cjs.map} +1 -1
  26. package/dist/{chunk-R4HKB3YD.cjs → chunk-IIPBTWQR.cjs} +22 -22
  27. package/dist/{chunk-R4HKB3YD.cjs.map → chunk-IIPBTWQR.cjs.map} +1 -1
  28. package/dist/{chunk-JMBIGH4H.cjs → chunk-IUZMWMVX.cjs} +83 -83
  29. package/dist/{chunk-JMBIGH4H.cjs.map → chunk-IUZMWMVX.cjs.map} +1 -1
  30. package/dist/{chunk-XJVRAKEX.cjs → chunk-IXCBVJRU.cjs} +56 -33
  31. package/dist/chunk-IXCBVJRU.cjs.map +1 -0
  32. package/dist/{chunk-TBGSQTJK.js → chunk-J4VB4EHW.js} +6 -6
  33. package/dist/{chunk-UWPT23SA.js → chunk-JXMNLH7F.js} +3 -3
  34. package/dist/{chunk-A62C4C4V.cjs → chunk-KI4EGKNV.cjs} +3 -2
  35. package/dist/chunk-KI4EGKNV.cjs.map +1 -0
  36. package/dist/{chunk-RHQ7BJKK.cjs → chunk-LEWQRAZ4.cjs} +73 -73
  37. package/dist/{chunk-RHQ7BJKK.cjs.map → chunk-LEWQRAZ4.cjs.map} +1 -1
  38. package/dist/{chunk-DBR5JLX3.js → chunk-LVAJK2U2.js} +46 -23
  39. package/dist/chunk-LVAJK2U2.js.map +1 -0
  40. package/dist/{chunk-OB7YDOTK.cjs → chunk-NJADHL2G.cjs} +8 -8
  41. package/dist/{chunk-OB7YDOTK.cjs.map → chunk-NJADHL2G.cjs.map} +1 -1
  42. package/dist/{chunk-HCZJZMU7.js → chunk-NKA3O4L6.js} +3 -3
  43. package/dist/{chunk-SRYV4H3M.js → chunk-NNWSGOUP.js} +3 -3
  44. package/dist/{chunk-EYTXD62B.cjs → chunk-OGVIGAMZ.cjs} +232 -45
  45. package/dist/chunk-OGVIGAMZ.cjs.map +1 -0
  46. package/dist/{chunk-EJ3EBYNV.cjs → chunk-OMN7A6RP.cjs} +32 -32
  47. package/dist/{chunk-EJ3EBYNV.cjs.map → chunk-OMN7A6RP.cjs.map} +1 -1
  48. package/dist/{chunk-WNOGR5AA.js → chunk-PRMR6WKC.js} +3 -3
  49. package/dist/{chunk-J2JUAS4C.cjs → chunk-PXQQFRUD.cjs} +11 -11
  50. package/dist/{chunk-J2JUAS4C.cjs.map → chunk-PXQQFRUD.cjs.map} +1 -1
  51. package/dist/{chunk-VDJF4ZAU.js → chunk-RU3SCECX.js} +3 -3
  52. package/dist/{chunk-53JKCFFE.cjs → chunk-RXFBW2EJ.cjs} +12 -12
  53. package/dist/{chunk-53JKCFFE.cjs.map → chunk-RXFBW2EJ.cjs.map} +1 -1
  54. package/dist/{chunk-JOCFPAS6.js → chunk-TNZOUHHN.js} +6 -6
  55. package/dist/{chunk-HX4CJYXL.js → chunk-TR7AMHGB.js} +10 -10
  56. package/dist/{chunk-MLGGF24T.js → chunk-TYVHM67X.js} +8 -8
  57. package/dist/{chunk-Z35QWWJH.cjs → chunk-U4WPFX5K.cjs} +34 -34
  58. package/dist/{chunk-Z35QWWJH.cjs.map → chunk-U4WPFX5K.cjs.map} +1 -1
  59. package/dist/{chunk-M4MKQKFF.js → chunk-UBTOOE55.js} +2 -2
  60. package/dist/{chunk-FEGEC6FY.js → chunk-X7AJ3J42.js} +5170 -5104
  61. package/dist/chunk-X7AJ3J42.js.map +1 -0
  62. package/dist/{chunk-SZMA65OW.js → chunk-XURRAFIB.js} +2 -2
  63. package/dist/{chunk-CTMLY2GN.js → chunk-YGS7BLSN.js} +5 -5
  64. package/dist/{chunk-RG2WRBPT.js → chunk-Z3ADCYC5.js} +2 -2
  65. package/dist/{chunk-2AASLY6D.js → chunk-ZBQV7WH7.js} +3 -3
  66. package/dist/{chunk-4GPWLGKT.js → chunk-ZRILYK5U.js} +2 -1
  67. package/dist/{chunk-LBOWSKGM.js → chunk-ZSIEM7CL.js} +5 -5
  68. package/dist/components/calendar.cjs +4 -4
  69. package/dist/components/calendar.js +3 -3
  70. package/dist/components/case-studies/index.cjs +17 -17
  71. package/dist/components/case-studies/index.js +7 -7
  72. package/dist/components/chat/chat-message-enhanced.d.ts.map +1 -1
  73. package/dist/components/chat/chat-message-list.d.ts.map +1 -1
  74. package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
  75. package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts.map +1 -1
  76. package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts.map +1 -1
  77. package/dist/components/chat/index.cjs +13 -7
  78. package/dist/components/chat/index.cjs.map +1 -1
  79. package/dist/components/chat/index.js +12 -6
  80. package/dist/components/chat/remark-mention-chips.d.ts +5 -2
  81. package/dist/components/chat/remark-mention-chips.d.ts.map +1 -1
  82. package/dist/components/chat/utils/discuss-ref-prompt.d.ts +48 -0
  83. package/dist/components/chat/utils/discuss-ref-prompt.d.ts.map +1 -0
  84. package/dist/components/chat/utils/index.d.ts +2 -0
  85. package/dist/components/chat/utils/index.d.ts.map +1 -1
  86. package/dist/components/chat/utils/resolve-fetched-card-href.d.ts +63 -0
  87. package/dist/components/chat/utils/resolve-fetched-card-href.d.ts.map +1 -0
  88. package/dist/components/chat/utils/source-row-cta.d.ts.map +1 -1
  89. package/dist/components/contact/index.cjs +8 -8
  90. package/dist/components/contact/index.js +7 -7
  91. package/dist/components/docs/index.cjs +10 -10
  92. package/dist/components/docs/index.js +9 -9
  93. package/dist/components/embeds/index.cjs +8 -8
  94. package/dist/components/embeds/index.js +7 -7
  95. package/dist/components/faq/index.cjs +9 -9
  96. package/dist/components/faq/index.js +8 -8
  97. package/dist/components/features/index.cjs +7 -7
  98. package/dist/components/features/index.js +6 -6
  99. package/dist/components/help-center-pages/index.cjs +28 -28
  100. package/dist/components/help-center-pages/index.js +19 -19
  101. package/dist/components/icons/index.cjs +3 -3
  102. package/dist/components/icons/index.js +2 -2
  103. package/dist/components/index.cjs +253 -247
  104. package/dist/components/index.cjs.map +1 -1
  105. package/dist/components/index.js +23 -17
  106. package/dist/components/index.js.map +1 -1
  107. package/dist/components/meeting-scheduler/index.cjs +92 -92
  108. package/dist/components/meeting-scheduler/index.js +9 -9
  109. package/dist/components/navigation/index.cjs +7 -7
  110. package/dist/components/navigation/index.js +6 -6
  111. package/dist/components/onboarding-guides/index.cjs +11 -11
  112. package/dist/components/onboarding-guides/index.js +10 -10
  113. package/dist/components/related-content/index.cjs +9 -9
  114. package/dist/components/related-content/index.js +8 -8
  115. package/dist/components/shared/doc-search/resolve-search-result-action.d.ts +11 -3
  116. package/dist/components/shared/doc-search/resolve-search-result-action.d.ts.map +1 -1
  117. package/dist/components/shared/doc-search/use-doc-search.d.ts +7 -0
  118. package/dist/components/shared/doc-search/use-doc-search.d.ts.map +1 -1
  119. package/dist/components/tickets/index.cjs +11 -11
  120. package/dist/components/tickets/index.js +10 -10
  121. package/dist/components/ui/actions-menu.d.ts.map +1 -1
  122. package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
  123. package/dist/components/ui/file-manager/index.cjs +70 -70
  124. package/dist/components/ui/file-manager/index.js +3 -3
  125. package/dist/components/ui/index.cjs +13 -7
  126. package/dist/components/ui/index.cjs.map +1 -1
  127. package/dist/components/ui/index.js +12 -6
  128. package/dist/components/ui/markdown/base-components.d.ts.map +1 -1
  129. package/dist/components/ui/overlay-open-registry.d.ts +50 -0
  130. package/dist/components/ui/overlay-open-registry.d.ts.map +1 -0
  131. package/dist/components/ui/portal-container.d.ts +24 -0
  132. package/dist/components/ui/portal-container.d.ts.map +1 -1
  133. package/dist/hooks/index.cjs +4 -4
  134. package/dist/hooks/index.js +3 -3
  135. package/dist/index.cjs +20 -10
  136. package/dist/index.cjs.map +1 -1
  137. package/dist/index.js +24 -14
  138. package/dist/utils/anchor-id.d.ts +32 -0
  139. package/dist/utils/anchor-id.d.ts.map +1 -0
  140. package/dist/utils/content-href.d.ts +27 -6
  141. package/dist/utils/content-href.d.ts.map +1 -1
  142. package/dist/utils/index.cjs +213 -152
  143. package/dist/utils/index.cjs.map +1 -1
  144. package/dist/utils/index.d.ts +1 -0
  145. package/dist/utils/index.d.ts.map +1 -1
  146. package/dist/utils/index.js +212 -153
  147. package/dist/utils/index.js.map +1 -1
  148. package/dist/utils/list-url.d.ts.map +1 -1
  149. package/dist/utils/same-page-hash-nav.d.ts +17 -6
  150. package/dist/utils/same-page-hash-nav.d.ts.map +1 -1
  151. package/package.json +1 -1
  152. package/src/components/chat/__tests__/remark-mention-chips.test.ts +67 -0
  153. package/src/components/chat/chat-message-enhanced.tsx +3 -2
  154. package/src/components/chat/chat-message-list.tsx +49 -5
  155. package/src/components/chat/embeddable-chat.tsx +19 -2
  156. package/src/components/chat/entity-cards/dispatch.tsx +65 -4
  157. package/src/components/chat/hooks/use-nats-chat-adapter.ts +28 -4
  158. package/src/components/chat/hooks/use-sse-chat-adapter.ts +5 -3
  159. package/src/components/chat/remark-mention-chips.ts +6 -3
  160. package/src/components/chat/utils/__tests__/discuss-ref-prompt.test.ts +67 -0
  161. package/src/components/chat/utils/__tests__/resolve-fetched-card-href.test.ts +156 -0
  162. package/src/components/chat/utils/discuss-ref-prompt.ts +63 -0
  163. package/src/components/chat/utils/index.ts +16 -0
  164. package/src/components/chat/utils/resolve-fetched-card-href.ts +104 -0
  165. package/src/components/chat/utils/source-row-cta.ts +5 -1
  166. package/src/components/shared/doc-search/__tests__/resolve-search-result-action.test.ts +145 -0
  167. package/src/components/shared/doc-search/resolve-search-result-action.ts +46 -10
  168. package/src/components/shared/doc-search/use-doc-search.ts +50 -14
  169. package/src/components/ui/__tests__/overlay-open-registry.test.tsx +87 -0
  170. package/src/components/ui/actions-menu.tsx +65 -2
  171. package/src/components/ui/dropdown-menu.tsx +62 -12
  172. package/src/components/ui/markdown/base-components.tsx +26 -0
  173. package/src/components/ui/overlay-open-registry.tsx +99 -0
  174. package/src/components/ui/portal-container.tsx +31 -0
  175. package/src/utils/__tests__/anchor-id.test.ts +139 -0
  176. package/src/utils/__tests__/content-href.test.ts +74 -0
  177. package/src/utils/__tests__/list-url.test.ts +11 -1
  178. package/src/utils/anchor-id.ts +106 -0
  179. package/src/utils/content-href.ts +113 -13
  180. package/src/utils/index.ts +8 -0
  181. package/src/utils/list-url.ts +6 -1
  182. package/src/utils/same-page-hash-nav.ts +28 -9
  183. package/dist/chunk-A62C4C4V.cjs.map +0 -1
  184. package/dist/chunk-BTUHMCYW.js.map +0 -1
  185. package/dist/chunk-DBR5JLX3.js.map +0 -1
  186. package/dist/chunk-EYTXD62B.cjs.map +0 -1
  187. package/dist/chunk-FEGEC6FY.js.map +0 -1
  188. package/dist/chunk-GE3JUTW2.js.map +0 -1
  189. package/dist/chunk-Q4K3TGNP.cjs.map +0 -1
  190. package/dist/chunk-RB2EW6IZ.cjs.map +0 -1
  191. package/dist/chunk-XJVRAKEX.cjs.map +0 -1
  192. /package/dist/{chunk-6FIDTXYC.js.map → chunk-7AQSXQEL.js.map} +0 -0
  193. /package/dist/{chunk-TBGSQTJK.js.map → chunk-J4VB4EHW.js.map} +0 -0
  194. /package/dist/{chunk-UWPT23SA.js.map → chunk-JXMNLH7F.js.map} +0 -0
  195. /package/dist/{chunk-HCZJZMU7.js.map → chunk-NKA3O4L6.js.map} +0 -0
  196. /package/dist/{chunk-SRYV4H3M.js.map → chunk-NNWSGOUP.js.map} +0 -0
  197. /package/dist/{chunk-WNOGR5AA.js.map → chunk-PRMR6WKC.js.map} +0 -0
  198. /package/dist/{chunk-VDJF4ZAU.js.map → chunk-RU3SCECX.js.map} +0 -0
  199. /package/dist/{chunk-JOCFPAS6.js.map → chunk-TNZOUHHN.js.map} +0 -0
  200. /package/dist/{chunk-HX4CJYXL.js.map → chunk-TR7AMHGB.js.map} +0 -0
  201. /package/dist/{chunk-MLGGF24T.js.map → chunk-TYVHM67X.js.map} +0 -0
  202. /package/dist/{chunk-M4MKQKFF.js.map → chunk-UBTOOE55.js.map} +0 -0
  203. /package/dist/{chunk-SZMA65OW.js.map → chunk-XURRAFIB.js.map} +0 -0
  204. /package/dist/{chunk-CTMLY2GN.js.map → chunk-YGS7BLSN.js.map} +0 -0
  205. /package/dist/{chunk-RG2WRBPT.js.map → chunk-Z3ADCYC5.js.map} +0 -0
  206. /package/dist/{chunk-2AASLY6D.js.map → chunk-ZBQV7WH7.js.map} +0 -0
  207. /package/dist/{chunk-4GPWLGKT.js.map → chunk-ZRILYK5U.js.map} +0 -0
  208. /package/dist/{chunk-LBOWSKGM.js.map → chunk-ZSIEM7CL.js.map} +0 -0
@@ -3926,6 +3926,177 @@ function scrollElementIntoView(target, options = {}) {
3926
3926
  activeRaf = requestAnimationFrame(step);
3927
3927
  }
3928
3928
 
3929
+ // src/utils/markdown-fences.ts
3930
+ var FENCE_RE = /^ {0,3}(`{3,}|~{3,})([^\n]*?)\r?$/;
3931
+ var BLANK_LINE_RE = /^[ \t\r]*$/;
3932
+ function isBlankLine(line) {
3933
+ return BLANK_LINE_RE.test(line);
3934
+ }
3935
+ function createFenceTracker() {
3936
+ let fenceChar = null;
3937
+ let fenceLength = 0;
3938
+ return {
3939
+ push(line) {
3940
+ const fence = FENCE_RE.exec(line);
3941
+ if (fence) {
3942
+ const run = fence[1];
3943
+ if (fenceChar === null) {
3944
+ fenceChar = run[0];
3945
+ fenceLength = run.length;
3946
+ return "open";
3947
+ }
3948
+ if (run[0] === fenceChar && run.length >= fenceLength && isBlankLine(fence[2])) {
3949
+ fenceChar = null;
3950
+ fenceLength = 0;
3951
+ return "close";
3952
+ }
3953
+ return "inside";
3954
+ }
3955
+ return fenceChar === null ? "text" : "inside";
3956
+ },
3957
+ openChar: () => fenceChar,
3958
+ openLength: () => fenceLength
3959
+ };
3960
+ }
3961
+
3962
+ // src/utils/markdown-heading-id.ts
3963
+ var HEADING_EMOJI_RE = /[\u{1F300}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]/gu;
3964
+ function stripHeadingEmojis(text) {
3965
+ return text.replace(HEADING_EMOJI_RE, "").trim();
3966
+ }
3967
+ function slugifyHeadingBase(text) {
3968
+ return text.trim().toLowerCase().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").replace(/^-+|-+$/g, "");
3969
+ }
3970
+ function slugifyHeadingText(text) {
3971
+ return slugifyHeadingBase(stripHeadingEmojis(text));
3972
+ }
3973
+ var ATX_HEADING_RE = /^ {0,3}(#{1,6})[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*\r?$/;
3974
+ var ATX_EMPTY_RE = /^ {0,3}(#{1,6})[ \t]*#*[ \t]*\r?$/;
3975
+ var RAW_HEADING_RE = /<h([1-6])\b[^>]*>([\s\S]*?)(?:<\/h\1>|$)/gi;
3976
+ var CONTAINER_PREFIX_RE = /^ {0,3}(?:(?:>[ \t]?)+|(?:[-+*]|\d{1,9}[.)])[ \t]+)+/;
3977
+ var SETEXT_UNDERLINE_RE = /^ {0,3}(=+|-+)[ \t]*\r?$/;
3978
+ var THEMATIC_BREAK_RE = /^ {0,3}(\*|_){3,}[ \t]*\r?$/;
3979
+ var HTML_BLOCK_TAGS = "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";
3980
+ var HTML_BLOCK_OPENER_RE = new RegExp(
3981
+ `^ {0,3}(?:<(?:script|pre|style|textarea)(?:[\\s>]|$)|<!--|<\\?|<![a-zA-Z]|<!\\[CDATA\\[|</?(?:${HTML_BLOCK_TAGS})(?:[\\s/>]|$)|<[a-zA-Z][a-zA-Z0-9-]*(?:\\s[^>]*)?/?>[ \\t]*\\r?$|</[a-zA-Z][a-zA-Z0-9-]*[ \\t]*>[ \\t]*\\r?$)`,
3982
+ "i"
3983
+ );
3984
+ function scanHeadings(content, options = {}) {
3985
+ const { skipFrontmatter = true, includeRawHtml = true, skipFences = true } = options;
3986
+ const out = [];
3987
+ const lines = content.split("\n");
3988
+ const fences = skipFences ? createFenceTracker() : null;
3989
+ let start = 0;
3990
+ if (skipFrontmatter && lines[0]?.trim() === "---") {
3991
+ for (let i = 1; i < lines.length; i++) {
3992
+ if (lines[i].trim() === "---" || lines[i].trim() === "...") {
3993
+ start = i + 1;
3994
+ break;
3995
+ }
3996
+ }
3997
+ }
3998
+ let setextRun = null;
3999
+ for (let i = start; i < lines.length; i++) {
4000
+ const line = lines[i];
4001
+ if (fences) {
4002
+ const role = fences.push(line);
4003
+ if (role !== "text") {
4004
+ setextRun = null;
4005
+ continue;
4006
+ }
4007
+ }
4008
+ const prefix = CONTAINER_PREFIX_RE.exec(line)?.[0] ?? "";
4009
+ const body = prefix ? line.slice(prefix.length) : line;
4010
+ const setext = SETEXT_UNDERLINE_RE.exec(body);
4011
+ if (setext) {
4012
+ if (setextRun && !setextRun.disqualified && setextRun.prefix === prefix) {
4013
+ out.push({
4014
+ line: setextRun.line,
4015
+ level: setext[1][0] === "=" ? 1 : 2,
4016
+ text: setextRun.lines.join("\n")
4017
+ });
4018
+ }
4019
+ setextRun = null;
4020
+ continue;
4021
+ }
4022
+ const atx = ATX_HEADING_RE.exec(body) ?? ATX_EMPTY_RE.exec(body);
4023
+ if (atx) {
4024
+ out.push({ line: i + 1, level: atx[1].length, text: (atx[2] ?? "").trim() });
4025
+ setextRun = null;
4026
+ continue;
4027
+ }
4028
+ if (includeRawHtml && line.indexOf("<") !== -1) {
4029
+ RAW_HEADING_RE.lastIndex = 0;
4030
+ let raw;
4031
+ let matched = false;
4032
+ while ((raw = RAW_HEADING_RE.exec(line)) !== null) {
4033
+ matched = true;
4034
+ out.push({
4035
+ line: i + 1,
4036
+ level: Number(raw[1]),
4037
+ text: raw[2].replace(/<[^>]*>/g, "").trim()
4038
+ });
4039
+ }
4040
+ if (matched) {
4041
+ setextRun = null;
4042
+ continue;
4043
+ }
4044
+ }
4045
+ if (isBlankLine(body) || THEMATIC_BREAK_RE.test(body)) {
4046
+ setextRun = null;
4047
+ continue;
4048
+ }
4049
+ if (setextRun && setextRun.prefix === prefix) {
4050
+ setextRun.lines.push(body.trim());
4051
+ } else {
4052
+ setextRun = {
4053
+ line: i + 1,
4054
+ prefix,
4055
+ lines: [body.trim()],
4056
+ disqualified: HTML_BLOCK_OPENER_RE.test(body)
4057
+ };
4058
+ }
4059
+ }
4060
+ return out;
4061
+ }
4062
+ function createHeadingIdDeduper() {
4063
+ const counts = {};
4064
+ return (cleanId) => {
4065
+ if (counts[cleanId]) {
4066
+ counts[cleanId]++;
4067
+ return `${cleanId}-${counts[cleanId]}`;
4068
+ }
4069
+ counts[cleanId] = 1;
4070
+ return cleanId;
4071
+ };
4072
+ }
4073
+
4074
+ // src/utils/anchor-id.ts
4075
+ function normalizeAnchorId(raw) {
4076
+ return slugifyHeadingText(raw).replace(/-+/g, "-").replace(/^-+|-+$/g, "");
4077
+ }
4078
+ var HEADING_SELECTOR = "h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]";
4079
+ var DUPLICATE_SUFFIX_RE = /^(.+)-(\d+)$/;
4080
+ function findDuplicateShifted(normalized, doc) {
4081
+ const parts = DUPLICATE_SUFFIX_RE.exec(normalized);
4082
+ if (!parts) return null;
4083
+ const ordinal = Number(parts[2]);
4084
+ if (!Number.isSafeInteger(ordinal)) return null;
4085
+ return doc.getElementById(`${parts[1]}-${ordinal + 1}`);
4086
+ }
4087
+ function findAnchorElementByNormalizedId(rawId, doc) {
4088
+ const normalized = normalizeAnchorId(rawId);
4089
+ if (!normalized) return null;
4090
+ if (normalized !== rawId) {
4091
+ const direct = doc.getElementById(normalized);
4092
+ if (direct) return direct;
4093
+ }
4094
+ for (const heading of Array.from(doc.querySelectorAll(HEADING_SELECTOR))) {
4095
+ if (normalizeAnchorId(heading.id) === normalized) return heading;
4096
+ }
4097
+ return findDuplicateShifted(normalized, doc);
4098
+ }
4099
+
3929
4100
  // src/utils/same-page-hash-nav.ts
3930
4101
  var STICKY_HEADER_OFFSET_PX = 96;
3931
4102
  var HUB_HEADER_OFFSET_PX = 80;
@@ -3938,12 +4109,17 @@ function getHashTargetElement(id) {
3938
4109
  if (!id) return null;
3939
4110
  const direct = document.getElementById(id);
3940
4111
  if (direct) return direct;
4112
+ let decoded = id;
3941
4113
  try {
3942
- const decoded = decodeURIComponent(id);
3943
- if (decoded !== id) return document.getElementById(decoded);
4114
+ decoded = decodeURIComponent(id);
4115
+ if (decoded !== id) {
4116
+ const decodedEl = document.getElementById(decoded);
4117
+ if (decodedEl) return decodedEl;
4118
+ }
3944
4119
  } catch {
4120
+ decoded = id;
3945
4121
  }
3946
- return null;
4122
+ return findAnchorElementByNormalizedId(decoded, document);
3947
4123
  }
3948
4124
  function navigateSamePageHash(target, options = {}) {
3949
4125
  if (typeof window === "undefined") return false;
@@ -3996,7 +4172,7 @@ function navigateSamePageHash(target, options = {}) {
3996
4172
  // src/utils/list-url.ts
3997
4173
  var ALIASES = { blog_post_existing: "blog_post" };
3998
4174
  function canonicalContentRefType(contentRefType) {
3999
- return ALIASES[contentRefType] ?? contentRefType;
4175
+ return Object.prototype.hasOwnProperty.call(ALIASES, contentRefType) ? ALIASES[contentRefType] : contentRefType;
4000
4176
  }
4001
4177
  var BUILDERS = {
4002
4178
  roadmap_item: (ids, b) => `${b}/api/roadmap?task_ids=${ids.join(",")}`,
@@ -4129,6 +4305,15 @@ var DEFAULT_CONTENT_SUFFIXES = {
4129
4305
  // SSOT for the segment).
4130
4306
  author: "authors"
4131
4307
  };
4308
+ function primaryPlatformOf(platforms) {
4309
+ if (!Array.isArray(platforms)) return null;
4310
+ for (const entry of platforms) {
4311
+ const row = entry;
4312
+ const name = row?.platforms?.name ?? row?.platform_name ?? row?.name;
4313
+ if (typeof name === "string" && name.trim()) return name.trim();
4314
+ }
4315
+ return null;
4316
+ }
4132
4317
  function lastPathSegment(url) {
4133
4318
  try {
4134
4319
  const pathname = new URL(url, "https://_.local").pathname;
@@ -4140,16 +4325,35 @@ function lastPathSegment(url) {
4140
4325
  }
4141
4326
  function makeComposeContentUrl(opts) {
4142
4327
  const suffixes = opts.suffixes ?? DEFAULT_CONTENT_SUFFIXES;
4143
- return ({ type, identifier, externalUrl, targetPlatform }) => {
4328
+ return ({
4329
+ type: rawType,
4330
+ identifier,
4331
+ slug: slugHint,
4332
+ externalUrl,
4333
+ targetPlatform,
4334
+ platforms
4335
+ }) => {
4336
+ const type = canonicalContentRefType(rawType);
4144
4337
  const override = opts.overrides && Object.prototype.hasOwnProperty.call(opts.overrides, type) ? opts.overrides[type] : void 0;
4145
4338
  if (override) return override(identifier);
4146
4339
  const seg = (Object.prototype.hasOwnProperty.call(suffixes, type) ? suffixes[type] : void 0) ?? type;
4147
4340
  if (opts.hostedTypes.has(type)) {
4148
4341
  const recovered = externalUrl ? lastPathSegment(externalUrl) : null;
4149
- const slug = recovered && recovered !== seg ? recovered : identifier;
4342
+ const slug = recovered && recovered !== seg ? recovered : slugHint?.trim() || identifier;
4150
4343
  return { href: `/${seg}/${slug}`, targetPlatform: null };
4151
4344
  }
4152
- return externalUrl ? { href: externalUrl, targetPlatform: targetPlatform ?? null } : { href: `${opts.contentOrigin}/${seg}/${identifier}`, targetPlatform: null };
4345
+ if (externalUrl) return { href: externalUrl, targetPlatform: targetPlatform ?? null };
4346
+ const claimedOwner = targetPlatform ?? primaryPlatformOf(platforms);
4347
+ const owner = claimedOwner && byKey(claimedOwner) ? claimedOwner : null;
4348
+ const origin = owner ? getPlatformProductionUrl(owner) : opts.contentOrigin;
4349
+ return {
4350
+ href: `${origin.replace(/\/+$/, "")}/${seg}/${slugHint?.trim() || identifier}`,
4351
+ // Report the owner so `decideNewTab` can compare it against the current
4352
+ // app instead of falling back to an origin guess (which is unreliable in
4353
+ // dev, where every platform shares localhost). `null` whenever the href
4354
+ // came from `contentOrigin`, so the two never disagree.
4355
+ targetPlatform: owner
4356
+ };
4153
4357
  };
4154
4358
  }
4155
4359
  function buildDefaultHref(basePath, slug) {
@@ -4317,151 +4521,6 @@ function buildDocumentTree(docs, mapFn, getParentPath, getPath) {
4317
4521
  return sortTreeChildren(rootNodes);
4318
4522
  }
4319
4523
 
4320
- // src/utils/markdown-fences.ts
4321
- var FENCE_RE = /^ {0,3}(`{3,}|~{3,})([^\n]*?)\r?$/;
4322
- var BLANK_LINE_RE = /^[ \t\r]*$/;
4323
- function isBlankLine(line) {
4324
- return BLANK_LINE_RE.test(line);
4325
- }
4326
- function createFenceTracker() {
4327
- let fenceChar = null;
4328
- let fenceLength = 0;
4329
- return {
4330
- push(line) {
4331
- const fence = FENCE_RE.exec(line);
4332
- if (fence) {
4333
- const run = fence[1];
4334
- if (fenceChar === null) {
4335
- fenceChar = run[0];
4336
- fenceLength = run.length;
4337
- return "open";
4338
- }
4339
- if (run[0] === fenceChar && run.length >= fenceLength && isBlankLine(fence[2])) {
4340
- fenceChar = null;
4341
- fenceLength = 0;
4342
- return "close";
4343
- }
4344
- return "inside";
4345
- }
4346
- return fenceChar === null ? "text" : "inside";
4347
- },
4348
- openChar: () => fenceChar,
4349
- openLength: () => fenceLength
4350
- };
4351
- }
4352
-
4353
- // src/utils/markdown-heading-id.ts
4354
- var HEADING_EMOJI_RE = /[\u{1F300}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]/gu;
4355
- function stripHeadingEmojis(text) {
4356
- return text.replace(HEADING_EMOJI_RE, "").trim();
4357
- }
4358
- function slugifyHeadingBase(text) {
4359
- return text.trim().toLowerCase().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").replace(/^-+|-+$/g, "");
4360
- }
4361
- function slugifyHeadingText(text) {
4362
- return slugifyHeadingBase(stripHeadingEmojis(text));
4363
- }
4364
- var ATX_HEADING_RE = /^ {0,3}(#{1,6})[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*\r?$/;
4365
- var ATX_EMPTY_RE = /^ {0,3}(#{1,6})[ \t]*#*[ \t]*\r?$/;
4366
- var RAW_HEADING_RE = /<h([1-6])\b[^>]*>([\s\S]*?)(?:<\/h\1>|$)/gi;
4367
- var CONTAINER_PREFIX_RE = /^ {0,3}(?:(?:>[ \t]?)+|(?:[-+*]|\d{1,9}[.)])[ \t]+)+/;
4368
- var SETEXT_UNDERLINE_RE = /^ {0,3}(=+|-+)[ \t]*\r?$/;
4369
- var THEMATIC_BREAK_RE = /^ {0,3}(\*|_){3,}[ \t]*\r?$/;
4370
- var HTML_BLOCK_TAGS = "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";
4371
- var HTML_BLOCK_OPENER_RE = new RegExp(
4372
- `^ {0,3}(?:<(?:script|pre|style|textarea)(?:[\\s>]|$)|<!--|<\\?|<![a-zA-Z]|<!\\[CDATA\\[|</?(?:${HTML_BLOCK_TAGS})(?:[\\s/>]|$)|<[a-zA-Z][a-zA-Z0-9-]*(?:\\s[^>]*)?/?>[ \\t]*\\r?$|</[a-zA-Z][a-zA-Z0-9-]*[ \\t]*>[ \\t]*\\r?$)`,
4373
- "i"
4374
- );
4375
- function scanHeadings(content, options = {}) {
4376
- const { skipFrontmatter = true, includeRawHtml = true, skipFences = true } = options;
4377
- const out = [];
4378
- const lines = content.split("\n");
4379
- const fences = skipFences ? createFenceTracker() : null;
4380
- let start = 0;
4381
- if (skipFrontmatter && lines[0]?.trim() === "---") {
4382
- for (let i = 1; i < lines.length; i++) {
4383
- if (lines[i].trim() === "---" || lines[i].trim() === "...") {
4384
- start = i + 1;
4385
- break;
4386
- }
4387
- }
4388
- }
4389
- let setextRun = null;
4390
- for (let i = start; i < lines.length; i++) {
4391
- const line = lines[i];
4392
- if (fences) {
4393
- const role = fences.push(line);
4394
- if (role !== "text") {
4395
- setextRun = null;
4396
- continue;
4397
- }
4398
- }
4399
- const prefix = CONTAINER_PREFIX_RE.exec(line)?.[0] ?? "";
4400
- const body = prefix ? line.slice(prefix.length) : line;
4401
- const setext = SETEXT_UNDERLINE_RE.exec(body);
4402
- if (setext) {
4403
- if (setextRun && !setextRun.disqualified && setextRun.prefix === prefix) {
4404
- out.push({
4405
- line: setextRun.line,
4406
- level: setext[1][0] === "=" ? 1 : 2,
4407
- text: setextRun.lines.join("\n")
4408
- });
4409
- }
4410
- setextRun = null;
4411
- continue;
4412
- }
4413
- const atx = ATX_HEADING_RE.exec(body) ?? ATX_EMPTY_RE.exec(body);
4414
- if (atx) {
4415
- out.push({ line: i + 1, level: atx[1].length, text: (atx[2] ?? "").trim() });
4416
- setextRun = null;
4417
- continue;
4418
- }
4419
- if (includeRawHtml && line.indexOf("<") !== -1) {
4420
- RAW_HEADING_RE.lastIndex = 0;
4421
- let raw;
4422
- let matched = false;
4423
- while ((raw = RAW_HEADING_RE.exec(line)) !== null) {
4424
- matched = true;
4425
- out.push({
4426
- line: i + 1,
4427
- level: Number(raw[1]),
4428
- text: raw[2].replace(/<[^>]*>/g, "").trim()
4429
- });
4430
- }
4431
- if (matched) {
4432
- setextRun = null;
4433
- continue;
4434
- }
4435
- }
4436
- if (isBlankLine(body) || THEMATIC_BREAK_RE.test(body)) {
4437
- setextRun = null;
4438
- continue;
4439
- }
4440
- if (setextRun && setextRun.prefix === prefix) {
4441
- setextRun.lines.push(body.trim());
4442
- } else {
4443
- setextRun = {
4444
- line: i + 1,
4445
- prefix,
4446
- lines: [body.trim()],
4447
- disqualified: HTML_BLOCK_OPENER_RE.test(body)
4448
- };
4449
- }
4450
- }
4451
- return out;
4452
- }
4453
- function createHeadingIdDeduper() {
4454
- const counts = {};
4455
- return (cleanId) => {
4456
- if (counts[cleanId]) {
4457
- counts[cleanId]++;
4458
- return `${cleanId}-${counts[cleanId]}`;
4459
- }
4460
- counts[cleanId] = 1;
4461
- return cleanId;
4462
- };
4463
- }
4464
-
4465
4524
  // src/utils/markdown-to-plain.ts
4466
4525
  function stripInlineMarkdown(s) {
4467
4526
  return s.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1").replace(/`([^`]+)`/g, "$1");
@@ -4778,6 +4837,7 @@ exports.extractSections = extractSections;
4778
4837
  exports.faqItemAnchor = faqItemAnchor;
4779
4838
  exports.faqSectionSlug = faqSectionSlug;
4780
4839
  exports.fetchPriorityProp = fetchPriorityProp;
4840
+ exports.findAnchorElementByNormalizedId = findAnchorElementByNormalizedId;
4781
4841
  exports.findDocNodeByPath = findDocNodeByPath;
4782
4842
  exports.flattenAssistantContent = flattenAssistantContent;
4783
4843
  exports.formatAbbreviatedNumber = formatAbbreviatedNumber;
@@ -4897,6 +4957,7 @@ exports.markdownToPlainText = markdownToPlainText;
4897
4957
  exports.matchBiteElement = matchBiteElement;
4898
4958
  exports.nameInitials = nameInitials;
4899
4959
  exports.navigateSamePageHash = navigateSamePageHash;
4960
+ exports.normalizeAnchorId = normalizeAnchorId;
4900
4961
  exports.normalizeDocPath = normalizeDocPath;
4901
4962
  exports.normalizeDomain = normalizeDomain;
4902
4963
  exports.normalizeHashFragment = normalizeHashFragment;