@syntrologie/runtime-sdk 2.8.0-canary.4 → 2.8.0-canary.40

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 (45) hide show
  1. package/CAPABILITIES.md +44 -0
  2. package/dist/actions/schema.d.ts +1 -1
  3. package/dist/actions/schema.js +1 -1
  4. package/dist/actions/validation-core.d.ts +24 -0
  5. package/dist/actions/validation-rules.d.ts +74 -0
  6. package/dist/actions/validation.d.ts +5 -11
  7. package/dist/bootstrap-init.d.ts +33 -0
  8. package/dist/bootstrap-runtime.d.ts +7 -0
  9. package/dist/bootstrap-types.d.ts +90 -0
  10. package/dist/bootstrap.d.ts +17 -83
  11. package/dist/{chunk-5GTCL2IH.js → chunk-ESLIWC3T.js} +1506 -599
  12. package/dist/chunk-ESLIWC3T.js.map +7 -0
  13. package/dist/{chunk-R5DNAIRI.js → chunk-TN5BLBPU.js} +1 -1
  14. package/dist/{chunk-R5DNAIRI.js.map → chunk-TN5BLBPU.js.map} +1 -1
  15. package/dist/components/TileIcon.d.ts +2 -2
  16. package/dist/components/emojiToIcon.d.ts +24 -0
  17. package/dist/events/EventBus.d.ts +27 -1
  18. package/dist/events/history.d.ts +9 -0
  19. package/dist/events/index.d.ts +3 -0
  20. package/dist/events/normalizers/posthog.d.ts +4 -50
  21. package/dist/events/types.d.ts +30 -23
  22. package/dist/events/validation.d.ts +7 -0
  23. package/dist/index.d.ts +0 -2
  24. package/dist/index.js +1479 -180
  25. package/dist/index.js.map +4 -4
  26. package/dist/overlays/runtime/overlay/overlay-runner.d.ts +4 -0
  27. package/dist/overlays/runtime/overlay/overlay-state.d.ts +21 -0
  28. package/dist/overlays/types.d.ts +3 -1
  29. package/dist/react.js +4 -2
  30. package/dist/react.js.map +2 -2
  31. package/dist/smart-canvas.esm.js +123 -54
  32. package/dist/smart-canvas.esm.js.map +4 -4
  33. package/dist/smart-canvas.js +5607 -2962
  34. package/dist/smart-canvas.js.map +4 -4
  35. package/dist/smart-canvas.min.js +123 -54
  36. package/dist/smart-canvas.min.js.map +4 -4
  37. package/dist/telemetry/adapters/posthog.d.ts +30 -4
  38. package/dist/test/setup.d.ts +1 -0
  39. package/dist/token.d.ts +2 -0
  40. package/dist/version.d.ts +1 -1
  41. package/package.json +23 -28
  42. package/schema/canvas-config.schema.json +100 -2
  43. package/scripts/syntroReactPlugin.mjs +3 -0
  44. package/scripts/validate-config.mjs +42 -0
  45. package/dist/chunk-5GTCL2IH.js.map +0 -7
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  DEFAULT_TTL,
8
8
  EVENT_SCHEMA_VERSION,
9
9
  EventBus,
10
+ EventHistory,
10
11
  ExecutorRegistry,
11
12
  MAX_VISIBLE_TOASTS,
12
13
  NavigationMonitor,
@@ -99,8 +100,10 @@ import {
99
100
  useViewportContext,
100
101
  validateAction,
101
102
  validateActions,
103
+ validateEventName,
104
+ validateProps,
102
105
  widgetRegistry
103
- } from "./chunk-5GTCL2IH.js";
106
+ } from "./chunk-ESLIWC3T.js";
104
107
  import {
105
108
  AddClassZ,
106
109
  AnchorIdZ,
@@ -134,7 +137,7 @@ import {
134
137
  WaitZ,
135
138
  WidgetConfigZ,
136
139
  coreActionStepSchemas
137
- } from "./chunk-R5DNAIRI.js";
140
+ } from "./chunk-TN5BLBPU.js";
138
141
  import "./chunk-XDYJ64IN.js";
139
142
  import {
140
143
  ActivationConfigZ,
@@ -160,6 +163,7 @@ import {
160
163
  StateEqualsConditionZ,
161
164
  TriggerWhenZ,
162
165
  ViewportConditionZ,
166
+ __publicField,
163
167
  decisionSchemas,
164
168
  validateActivationConfig,
165
169
  validateCondition,
@@ -275,7 +279,7 @@ function useChat(options) {
275
279
  const [error, setError] = useState(null);
276
280
  const batchHandleRef = useRef(null);
277
281
  const send = useCallback(async (text) => {
278
- var _a;
282
+ var _a2;
279
283
  const trimmed = text.trim();
280
284
  if (!trimmed)
281
285
  return;
@@ -290,9 +294,9 @@ function useChat(options) {
290
294
  setIsLoading(true);
291
295
  try {
292
296
  const currentMessages = [...messages, userMessage];
293
- const historySlice = currentMessages.slice(-maxHistory).map((m) => ({
294
- role: m.role,
295
- content: m.text
297
+ const historySlice = currentMessages.slice(-maxHistory).map((m2) => ({
298
+ role: m2.role,
299
+ content: m2.text
296
300
  }));
297
301
  const response = await sendMessage(backendUrl, {
298
302
  message: trimmed,
@@ -309,7 +313,7 @@ function useChat(options) {
309
313
  };
310
314
  setMessages((prev) => [...prev, assistantMessage]);
311
315
  if (actions.length > 0) {
312
- if ((_a = batchHandleRef.current) == null ? void 0 : _a.isApplied()) {
316
+ if ((_a2 = batchHandleRef.current) == null ? void 0 : _a2.isApplied()) {
313
317
  await batchHandleRef.current.revertAll();
314
318
  }
315
319
  batchHandleRef.current = await runtime7.actions.applyBatch(actions);
@@ -327,10 +331,10 @@ function useChat(options) {
327
331
  }
328
332
  }, [backendUrl, messages, maxHistory, mlflowRunId, config, runtime7, tileId]);
329
333
  const clearMessages = useCallback(() => {
330
- var _a;
334
+ var _a2;
331
335
  setMessages([]);
332
336
  setError(null);
333
- if ((_a = batchHandleRef.current) == null ? void 0 : _a.isApplied()) {
337
+ if ((_a2 = batchHandleRef.current) == null ? void 0 : _a2.isApplied()) {
334
338
  batchHandleRef.current.revertAll();
335
339
  batchHandleRef.current = null;
336
340
  }
@@ -538,7 +542,7 @@ function resolveItem(store, itemId, itemQuestion) {
538
542
  throw new Error("FAQ item not found");
539
543
  }
540
544
  async function executeScrollToFaq(action, context, store) {
541
- var _a;
545
+ var _a2;
542
546
  const item = resolveItem(store, action.itemId, action.itemQuestion);
543
547
  const { id } = item.config;
544
548
  if (action.expand !== false) {
@@ -547,7 +551,7 @@ async function executeScrollToFaq(action, context, store) {
547
551
  const el = document.querySelector(`[data-faq-item-id="${id}"]`);
548
552
  if (el) {
549
553
  el.scrollIntoView({
550
- behavior: (_a = action.behavior) != null ? _a : "smooth"
554
+ behavior: (_a2 = action.behavior) != null ? _a2 : "smooth"
551
555
  });
552
556
  }
553
557
  context.publishEvent("faq:scroll_to", { itemId: id });
@@ -557,10 +561,10 @@ async function executeScrollToFaq(action, context, store) {
557
561
  };
558
562
  }
559
563
  async function executeToggleFaqItem(action, context, store) {
560
- var _a;
564
+ var _a2;
561
565
  const item = resolveItem(store, action.itemId, action.itemQuestion);
562
566
  const { id } = item.config;
563
- const desiredState = (_a = action.state) != null ? _a : "toggle";
567
+ const desiredState = (_a2 = action.state) != null ? _a2 : "toggle";
564
568
  let newState;
565
569
  switch (desiredState) {
566
570
  case "open":
@@ -585,10 +589,10 @@ async function executeToggleFaqItem(action, context, store) {
585
589
  };
586
590
  }
587
591
  async function executeUpdateFaq(action, context, store) {
588
- var _a, _b, _c;
592
+ var _a2, _b, _c;
589
593
  switch (action.operation) {
590
594
  case "add": {
591
- const items = (_a = action.items) != null ? _a : [];
595
+ const items = (_a2 = action.items) != null ? _a2 : [];
592
596
  const position = action.position === "prepend" ? "prepend" : "append";
593
597
  store.addItems(items, position);
594
598
  break;
@@ -629,35 +633,1226 @@ var executorDefinitions = [
629
633
 
630
634
  // ../adaptives/adaptive-faq/dist/FAQWidget.js
631
635
  import { jsx as _jsx2, jsxs as _jsxs2 } from "react/jsx-runtime";
632
- import React2, { useCallback as useCallback2, useEffect as useEffect2, useMemo, useReducer, useState as useState2 } from "react";
633
- import { createRoot as createRoot2 } from "react-dom/client";
634
- function getAnswerText(answer) {
635
- if (typeof answer === "string")
636
- return answer;
637
- if (answer.type === "rich")
638
- return answer.html;
639
- return answer.content;
636
+
637
+ // ../../node_modules/marked/lib/marked.esm.js
638
+ function M() {
639
+ return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
640
640
  }
641
- function renderAnswer(answer) {
642
- if (typeof answer === "string") {
643
- return _jsx2("p", { style: { margin: 0 }, children: answer });
644
- }
645
- if (answer.type === "rich") {
646
- return _jsx2("div", { style: { margin: 0 }, dangerouslySetInnerHTML: { __html: answer.html } });
641
+ var T = M();
642
+ function G(u3) {
643
+ T = u3;
644
+ }
645
+ var _ = { exec: () => null };
646
+ function k(u3, e = "") {
647
+ let t = typeof u3 == "string" ? u3 : u3.source, n = { replace: (r, i) => {
648
+ let s = typeof i == "string" ? i : i.source;
649
+ return s = s.replace(m.caret, "$1"), t = t.replace(r, s), n;
650
+ }, getRegex: () => new RegExp(t, e) };
651
+ return n;
652
+ }
653
+ var Re = (() => {
654
+ try {
655
+ return !!new RegExp("(?<=1)(?<!1)");
656
+ } catch {
657
+ return false;
647
658
  }
648
- return _jsx2("p", { style: { margin: 0 }, children: answer.content });
659
+ })();
660
+ var m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (u3) => new RegExp(`^( {0,3}${u3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}#`), htmlBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}<(?:[a-z].*>|!--)`, "i"), blockquoteBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}>`) };
661
+ var Te = /^(?:[ \t]*(?:\n|$))+/;
662
+ var Oe = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
663
+ var we = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
664
+ var A = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
665
+ var ye = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
666
+ var N = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
667
+ var re = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
668
+ var se = k(re).replace(/bull/g, N).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
669
+ var Pe = k(re).replace(/bull/g, N).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
670
+ var Q = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
671
+ var Se = /^[^\n]+/;
672
+ var j = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
673
+ var $e = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", j).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
674
+ var _e = k(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, N).getRegex();
675
+ var q = "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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
676
+ var F = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
677
+ var Le = k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", F).replace("tag", q).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
678
+ var ie = k(Q).replace("hr", A).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex();
679
+ var Me = k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ie).getRegex();
680
+ var U = { blockquote: Me, code: Oe, def: $e, fences: we, heading: ye, hr: A, html: Le, lheading: se, list: _e, newline: Te, paragraph: ie, table: _, text: Se };
681
+ var te = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", A).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex();
682
+ var ze = { ...U, lheading: Pe, table: te, paragraph: k(Q).replace("hr", A).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", te).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex() };
683
+ var Ee = { ...U, html: k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", F).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: _, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: k(Q).replace("hr", A).replace("heading", ` *#{1,6} *[^
684
+ ]`).replace("lheading", se).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
685
+ var Ie = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
686
+ var Ae = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
687
+ var oe = /^( {2,}|\\)\n(?!\s*$)/;
688
+ var Ce = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
689
+ var v = /[\p{P}\p{S}]/u;
690
+ var K = /[\s\p{P}\p{S}]/u;
691
+ var ae = /[^\s\p{P}\p{S}]/u;
692
+ var Be = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, K).getRegex();
693
+ var le = /(?!~)[\p{P}\p{S}]/u;
694
+ var De = /(?!~)[\s\p{P}\p{S}]/u;
695
+ var qe = /(?:[^\s\p{P}\p{S}]|~)/u;
696
+ var ue = /(?![*_])[\p{P}\p{S}]/u;
697
+ var ve = /(?![*_])[\s\p{P}\p{S}]/u;
698
+ var He = /(?:[^\s\p{P}\p{S}]|[*_])/u;
699
+ var Ge = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Re ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex();
700
+ var pe = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
701
+ var Ze = k(pe, "u").replace(/punct/g, v).getRegex();
702
+ var Ne = k(pe, "u").replace(/punct/g, le).getRegex();
703
+ var ce = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
704
+ var Qe = k(ce, "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, v).getRegex();
705
+ var je = k(ce, "gu").replace(/notPunctSpace/g, qe).replace(/punctSpace/g, De).replace(/punct/g, le).getRegex();
706
+ var Fe = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, v).getRegex();
707
+ var Ue = k(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, ue).getRegex();
708
+ var Ke = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";
709
+ var We = k(Ke, "gu").replace(/notPunctSpace/g, He).replace(/punctSpace/g, ve).replace(/punct/g, ue).getRegex();
710
+ var Xe = k(/\\(punct)/, "gu").replace(/punct/g, v).getRegex();
711
+ var Je = k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
712
+ var Ve = k(F).replace("(?:-->|$)", "-->").getRegex();
713
+ var Ye = k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Ve).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
714
+ var D = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/;
715
+ var et = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", D).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
716
+ var he = k(/^!?\[(label)\]\[(ref)\]/).replace("label", D).replace("ref", j).getRegex();
717
+ var ke = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", j).getRegex();
718
+ var tt = k("reflink|nolink(?!\\()", "g").replace("reflink", he).replace("nolink", ke).getRegex();
719
+ var ne = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
720
+ var W = { _backpedal: _, anyPunctuation: Xe, autolink: Je, blockSkip: Ge, br: oe, code: Ae, del: _, delLDelim: _, delRDelim: _, emStrongLDelim: Ze, emStrongRDelimAst: Qe, emStrongRDelimUnd: Fe, escape: Ie, link: et, nolink: ke, punctuation: Be, reflink: he, reflinkSearch: tt, tag: Ye, text: Ce, url: _ };
721
+ var nt = { ...W, link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", D).getRegex(), reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", D).getRegex() };
722
+ var Z = { ...W, emStrongRDelimAst: je, emStrongLDelim: Ne, delLDelim: Ue, delRDelim: We, url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ne).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ne).getRegex() };
723
+ var rt = { ...Z, br: k(oe).replace("{2,}", "*").getRegex(), text: k(Z.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
724
+ var C = { normal: U, gfm: ze, pedantic: Ee };
725
+ var z = { normal: W, gfm: Z, breaks: rt, pedantic: nt };
726
+ var st = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" };
727
+ var de = (u3) => st[u3];
728
+ function O(u3, e) {
729
+ if (e) {
730
+ if (m.escapeTest.test(u3)) return u3.replace(m.escapeReplace, de);
731
+ } else if (m.escapeTestNoEncode.test(u3)) return u3.replace(m.escapeReplaceNoEncode, de);
732
+ return u3;
649
733
  }
650
- function resolveFeedbackConfig(feedback) {
651
- if (!feedback)
734
+ function X(u3) {
735
+ try {
736
+ u3 = encodeURI(u3).replace(m.percentDecode, "%");
737
+ } catch {
652
738
  return null;
653
- if (feedback === true) {
654
- return { style: "thumbs" };
655
739
  }
656
- return feedback;
740
+ return u3;
657
741
  }
658
- function getFeedbackPrompt(feedbackConfig) {
659
- return feedbackConfig.prompt || "Was this helpful?";
742
+ function J(u3, e) {
743
+ var _a2;
744
+ let t = u3.replace(m.findPipe, (i, s, a) => {
745
+ let o = false, l = s;
746
+ for (; --l >= 0 && a[l] === "\\"; ) o = !o;
747
+ return o ? "|" : " |";
748
+ }), n = t.split(m.splitPipe), r = 0;
749
+ if (n[0].trim() || n.shift(), n.length > 0 && !((_a2 = n.at(-1)) == null ? void 0 : _a2.trim()) && n.pop(), e) if (n.length > e) n.splice(e);
750
+ else for (; n.length < e; ) n.push("");
751
+ for (; r < n.length; r++) n[r] = n[r].trim().replace(m.slashPipe, "|");
752
+ return n;
660
753
  }
754
+ function E(u3, e, t) {
755
+ let n = u3.length;
756
+ if (n === 0) return "";
757
+ let r = 0;
758
+ for (; r < n; ) {
759
+ let i = u3.charAt(n - r - 1);
760
+ if (i === e && !t) r++;
761
+ else if (i !== e && t) r++;
762
+ else break;
763
+ }
764
+ return u3.slice(0, n - r);
765
+ }
766
+ function ge(u3, e) {
767
+ if (u3.indexOf(e[1]) === -1) return -1;
768
+ let t = 0;
769
+ for (let n = 0; n < u3.length; n++) if (u3[n] === "\\") n++;
770
+ else if (u3[n] === e[0]) t++;
771
+ else if (u3[n] === e[1] && (t--, t < 0)) return n;
772
+ return t > 0 ? -2 : -1;
773
+ }
774
+ function fe(u3, e = 0) {
775
+ let t = e, n = "";
776
+ for (let r of u3) if (r === " ") {
777
+ let i = 4 - t % 4;
778
+ n += " ".repeat(i), t += i;
779
+ } else n += r, t++;
780
+ return n;
781
+ }
782
+ function me(u3, e, t, n, r) {
783
+ let i = e.href, s = e.title || null, a = u3[1].replace(r.other.outputLinkReplace, "$1");
784
+ n.state.inLink = true;
785
+ let o = { type: u3[0].charAt(0) === "!" ? "image" : "link", raw: t, href: i, title: s, text: a, tokens: n.inlineTokens(a) };
786
+ return n.state.inLink = false, o;
787
+ }
788
+ function it(u3, e, t) {
789
+ let n = u3.match(t.other.indentCodeCompensation);
790
+ if (n === null) return e;
791
+ let r = n[1];
792
+ return e.split(`
793
+ `).map((i) => {
794
+ let s = i.match(t.other.beginningSpace);
795
+ if (s === null) return i;
796
+ let [a] = s;
797
+ return a.length >= r.length ? i.slice(r.length) : i;
798
+ }).join(`
799
+ `);
800
+ }
801
+ var w = class {
802
+ constructor(e) {
803
+ __publicField(this, "options");
804
+ __publicField(this, "rules");
805
+ __publicField(this, "lexer");
806
+ this.options = e || T;
807
+ }
808
+ space(e) {
809
+ let t = this.rules.block.newline.exec(e);
810
+ if (t && t[0].length > 0) return { type: "space", raw: t[0] };
811
+ }
812
+ code(e) {
813
+ let t = this.rules.block.code.exec(e);
814
+ if (t) {
815
+ let n = t[0].replace(this.rules.other.codeRemoveIndent, "");
816
+ return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? n : E(n, `
817
+ `) };
818
+ }
819
+ }
820
+ fences(e) {
821
+ let t = this.rules.block.fences.exec(e);
822
+ if (t) {
823
+ let n = t[0], r = it(n, t[3] || "", this.rules);
824
+ return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: r };
825
+ }
826
+ }
827
+ heading(e) {
828
+ let t = this.rules.block.heading.exec(e);
829
+ if (t) {
830
+ let n = t[2].trim();
831
+ if (this.rules.other.endingHash.test(n)) {
832
+ let r = E(n, "#");
833
+ (this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
834
+ }
835
+ return { type: "heading", raw: t[0], depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
836
+ }
837
+ }
838
+ hr(e) {
839
+ let t = this.rules.block.hr.exec(e);
840
+ if (t) return { type: "hr", raw: E(t[0], `
841
+ `) };
842
+ }
843
+ blockquote(e) {
844
+ let t = this.rules.block.blockquote.exec(e);
845
+ if (t) {
846
+ let n = E(t[0], `
847
+ `).split(`
848
+ `), r = "", i = "", s = [];
849
+ for (; n.length > 0; ) {
850
+ let a = false, o = [], l;
851
+ for (l = 0; l < n.length; l++) if (this.rules.other.blockquoteStart.test(n[l])) o.push(n[l]), a = true;
852
+ else if (!a) o.push(n[l]);
853
+ else break;
854
+ n = n.slice(l);
855
+ let p = o.join(`
856
+ `), c = p.replace(this.rules.other.blockquoteSetextReplace, `
857
+ $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
858
+ r = r ? `${r}
859
+ ${p}` : p, i = i ? `${i}
860
+ ${c}` : c;
861
+ let d = this.lexer.state.top;
862
+ if (this.lexer.state.top = true, this.lexer.blockTokens(c, s, true), this.lexer.state.top = d, n.length === 0) break;
863
+ let h = s.at(-1);
864
+ if ((h == null ? void 0 : h.type) === "code") break;
865
+ if ((h == null ? void 0 : h.type) === "blockquote") {
866
+ let R = h, f = R.raw + `
867
+ ` + n.join(`
868
+ `), S = this.blockquote(f);
869
+ s[s.length - 1] = S, r = r.substring(0, r.length - R.raw.length) + S.raw, i = i.substring(0, i.length - R.text.length) + S.text;
870
+ break;
871
+ } else if ((h == null ? void 0 : h.type) === "list") {
872
+ let R = h, f = R.raw + `
873
+ ` + n.join(`
874
+ `), S = this.list(f);
875
+ s[s.length - 1] = S, r = r.substring(0, r.length - h.raw.length) + S.raw, i = i.substring(0, i.length - R.raw.length) + S.raw, n = f.substring(s.at(-1).raw.length).split(`
876
+ `);
877
+ continue;
878
+ }
879
+ }
880
+ return { type: "blockquote", raw: r, tokens: s, text: i };
881
+ }
882
+ }
883
+ list(e) {
884
+ var _a2, _b;
885
+ let t = this.rules.block.list.exec(e);
886
+ if (t) {
887
+ let n = t[1].trim(), r = n.length > 1, i = { type: "list", raw: "", ordered: r, start: r ? +n.slice(0, -1) : "", loose: false, items: [] };
888
+ n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
889
+ let s = this.rules.other.listItemRegex(n), a = false;
890
+ for (; e; ) {
891
+ let l = false, p = "", c = "";
892
+ if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
893
+ p = t[0], e = e.substring(p.length);
894
+ let d = fe(t[2].split(`
895
+ `, 1)[0], t[1].length), h = e.split(`
896
+ `, 1)[0], R = !d.trim(), f = 0;
897
+ if (this.options.pedantic ? (f = 2, c = d.trimStart()) : R ? f = t[1].length + 1 : (f = d.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = d.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (p += h + `
898
+ `, e = e.substring(h.length + 1), l = true), !l) {
899
+ let S = this.rules.other.nextBulletRegex(f), V = this.rules.other.hrRegex(f), Y = this.rules.other.fencesBeginRegex(f), ee = this.rules.other.headingBeginRegex(f), xe = this.rules.other.htmlBeginRegex(f), be = this.rules.other.blockquoteBeginRegex(f);
900
+ for (; e; ) {
901
+ let H = e.split(`
902
+ `, 1)[0], I;
903
+ if (h = H, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), I = h) : I = h.replace(this.rules.other.tabCharGlobal, " "), Y.test(h) || ee.test(h) || xe.test(h) || be.test(h) || S.test(h) || V.test(h)) break;
904
+ if (I.search(this.rules.other.nonSpaceChar) >= f || !h.trim()) c += `
905
+ ` + I.slice(f);
906
+ else {
907
+ if (R || d.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Y.test(d) || ee.test(d) || V.test(d)) break;
908
+ c += `
909
+ ` + h;
910
+ }
911
+ R = !h.trim(), p += H + `
912
+ `, e = e.substring(H.length + 1), d = I.slice(f);
913
+ }
914
+ }
915
+ i.loose || (a ? i.loose = true : this.rules.other.doubleBlankLine.test(p) && (a = true)), i.items.push({ type: "list_item", raw: p, task: !!this.options.gfm && this.rules.other.listIsTask.test(c), loose: false, text: c, tokens: [] }), i.raw += p;
916
+ }
917
+ let o = i.items.at(-1);
918
+ if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();
919
+ else return;
920
+ i.raw = i.raw.trimEnd();
921
+ for (let l of i.items) {
922
+ if (this.lexer.state.top = false, l.tokens = this.lexer.blockTokens(l.text, []), l.task) {
923
+ if (l.text = l.text.replace(this.rules.other.listReplaceTask, ""), ((_a2 = l.tokens[0]) == null ? void 0 : _a2.type) === "text" || ((_b = l.tokens[0]) == null ? void 0 : _b.type) === "paragraph") {
924
+ l.tokens[0].raw = l.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), l.tokens[0].text = l.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
925
+ for (let c = this.lexer.inlineQueue.length - 1; c >= 0; c--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)) {
926
+ this.lexer.inlineQueue[c].src = this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask, "");
927
+ break;
928
+ }
929
+ }
930
+ let p = this.rules.other.listTaskCheckbox.exec(l.raw);
931
+ if (p) {
932
+ let c = { type: "checkbox", raw: p[0] + " ", checked: p[0] !== "[ ]" };
933
+ l.checked = c.checked, i.loose ? l.tokens[0] && ["paragraph", "text"].includes(l.tokens[0].type) && "tokens" in l.tokens[0] && l.tokens[0].tokens ? (l.tokens[0].raw = c.raw + l.tokens[0].raw, l.tokens[0].text = c.raw + l.tokens[0].text, l.tokens[0].tokens.unshift(c)) : l.tokens.unshift({ type: "paragraph", raw: c.raw, text: c.raw, tokens: [c] }) : l.tokens.unshift(c);
934
+ }
935
+ }
936
+ if (!i.loose) {
937
+ let p = l.tokens.filter((d) => d.type === "space"), c = p.length > 0 && p.some((d) => this.rules.other.anyLine.test(d.raw));
938
+ i.loose = c;
939
+ }
940
+ }
941
+ if (i.loose) for (let l of i.items) {
942
+ l.loose = true;
943
+ for (let p of l.tokens) p.type === "text" && (p.type = "paragraph");
944
+ }
945
+ return i;
946
+ }
947
+ }
948
+ html(e) {
949
+ let t = this.rules.block.html.exec(e);
950
+ if (t) return { type: "html", block: true, raw: t[0], pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: t[0] };
951
+ }
952
+ def(e) {
953
+ let t = this.rules.block.def.exec(e);
954
+ if (t) {
955
+ let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
956
+ return { type: "def", tag: n, raw: t[0], href: r, title: i };
957
+ }
958
+ }
959
+ table(e) {
960
+ var _a2;
961
+ let t = this.rules.block.table.exec(e);
962
+ if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
963
+ let n = J(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = ((_a2 = t[3]) == null ? void 0 : _a2.trim()) ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
964
+ `) : [], s = { type: "table", raw: t[0], header: [], align: [], rows: [] };
965
+ if (n.length === r.length) {
966
+ for (let a of r) this.rules.other.tableAlignRight.test(a) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? s.align.push("left") : s.align.push(null);
967
+ for (let a = 0; a < n.length; a++) s.header.push({ text: n[a], tokens: this.lexer.inline(n[a]), header: true, align: s.align[a] });
968
+ for (let a of i) s.rows.push(J(a, s.header.length).map((o, l) => ({ text: o, tokens: this.lexer.inline(o), header: false, align: s.align[l] })));
969
+ return s;
970
+ }
971
+ }
972
+ lheading(e) {
973
+ let t = this.rules.block.lheading.exec(e);
974
+ if (t) return { type: "heading", raw: t[0], depth: t[2].charAt(0) === "=" ? 1 : 2, text: t[1], tokens: this.lexer.inline(t[1]) };
975
+ }
976
+ paragraph(e) {
977
+ let t = this.rules.block.paragraph.exec(e);
978
+ if (t) {
979
+ let n = t[1].charAt(t[1].length - 1) === `
980
+ ` ? t[1].slice(0, -1) : t[1];
981
+ return { type: "paragraph", raw: t[0], text: n, tokens: this.lexer.inline(n) };
982
+ }
983
+ }
984
+ text(e) {
985
+ let t = this.rules.block.text.exec(e);
986
+ if (t) return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) };
987
+ }
988
+ escape(e) {
989
+ let t = this.rules.inline.escape.exec(e);
990
+ if (t) return { type: "escape", raw: t[0], text: t[1] };
991
+ }
992
+ tag(e) {
993
+ let t = this.rules.inline.tag.exec(e);
994
+ if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t[0] };
995
+ }
996
+ link(e) {
997
+ let t = this.rules.inline.link.exec(e);
998
+ if (t) {
999
+ let n = t[2].trim();
1000
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
1001
+ if (!this.rules.other.endAngleBracket.test(n)) return;
1002
+ let s = E(n.slice(0, -1), "\\");
1003
+ if ((n.length - s.length) % 2 === 0) return;
1004
+ } else {
1005
+ let s = ge(t[2], "()");
1006
+ if (s === -2) return;
1007
+ if (s > -1) {
1008
+ let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
1009
+ t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, o).trim(), t[3] = "";
1010
+ }
1011
+ }
1012
+ let r = t[2], i = "";
1013
+ if (this.options.pedantic) {
1014
+ let s = this.rules.other.pedanticHrefTitle.exec(r);
1015
+ s && (r = s[1], i = s[3]);
1016
+ } else i = t[3] ? t[3].slice(1, -1) : "";
1017
+ return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), me(t, { href: r && r.replace(this.rules.inline.anyPunctuation, "$1"), title: i && i.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
1018
+ }
1019
+ }
1020
+ reflink(e, t) {
1021
+ let n;
1022
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
1023
+ let r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i = t[r.toLowerCase()];
1024
+ if (!i) {
1025
+ let s = n[0].charAt(0);
1026
+ return { type: "text", raw: s, text: s };
1027
+ }
1028
+ return me(n, i, n[0], this.lexer, this.rules);
1029
+ }
1030
+ }
1031
+ emStrong(e, t, n = "") {
1032
+ let r = this.rules.inline.emStrongLDelim.exec(e);
1033
+ if (!r || r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
1034
+ if (!(r[1] || r[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
1035
+ let s = [...r[0]].length - 1, a, o, l = s, p = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
1036
+ for (c.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = c.exec(t)) != null; ) {
1037
+ if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a) continue;
1038
+ if (o = [...a].length, r[3] || r[4]) {
1039
+ l += o;
1040
+ continue;
1041
+ } else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
1042
+ p += o;
1043
+ continue;
1044
+ }
1045
+ if (l -= o, l > 0) continue;
1046
+ o = Math.min(o, o + l + p);
1047
+ let d = [...r[0]][0].length, h = e.slice(0, s + r.index + d + o);
1048
+ if (Math.min(s, o) % 2) {
1049
+ let f = h.slice(1, -1);
1050
+ return { type: "em", raw: h, text: f, tokens: this.lexer.inlineTokens(f) };
1051
+ }
1052
+ let R = h.slice(2, -2);
1053
+ return { type: "strong", raw: h, text: R, tokens: this.lexer.inlineTokens(R) };
1054
+ }
1055
+ }
1056
+ }
1057
+ codespan(e) {
1058
+ let t = this.rules.inline.code.exec(e);
1059
+ if (t) {
1060
+ let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), r = this.rules.other.nonSpaceChar.test(n), i = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
1061
+ return r && i && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
1062
+ }
1063
+ }
1064
+ br(e) {
1065
+ let t = this.rules.inline.br.exec(e);
1066
+ if (t) return { type: "br", raw: t[0] };
1067
+ }
1068
+ del(e, t, n = "") {
1069
+ let r = this.rules.inline.delLDelim.exec(e);
1070
+ if (!r) return;
1071
+ if (!(r[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
1072
+ let s = [...r[0]].length - 1, a, o, l = s, p = this.rules.inline.delRDelim;
1073
+ for (p.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = p.exec(t)) != null; ) {
1074
+ if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a || (o = [...a].length, o !== s)) continue;
1075
+ if (r[3] || r[4]) {
1076
+ l += o;
1077
+ continue;
1078
+ }
1079
+ if (l -= o, l > 0) continue;
1080
+ o = Math.min(o, o + l);
1081
+ let c = [...r[0]][0].length, d = e.slice(0, s + r.index + c + o), h = d.slice(s, -s);
1082
+ return { type: "del", raw: d, text: h, tokens: this.lexer.inlineTokens(h) };
1083
+ }
1084
+ }
1085
+ }
1086
+ autolink(e) {
1087
+ let t = this.rules.inline.autolink.exec(e);
1088
+ if (t) {
1089
+ let n, r;
1090
+ return t[2] === "@" ? (n = t[1], r = "mailto:" + n) : (n = t[1], r = n), { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
1091
+ }
1092
+ }
1093
+ url(e) {
1094
+ var _a2, _b;
1095
+ let t;
1096
+ if (t = this.rules.inline.url.exec(e)) {
1097
+ let n, r;
1098
+ if (t[2] === "@") n = t[0], r = "mailto:" + n;
1099
+ else {
1100
+ let i;
1101
+ do
1102
+ i = t[0], t[0] = (_b = (_a2 = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : _a2[0]) != null ? _b : "";
1103
+ while (i !== t[0]);
1104
+ n = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
1105
+ }
1106
+ return { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
1107
+ }
1108
+ }
1109
+ inlineText(e) {
1110
+ let t = this.rules.inline.text.exec(e);
1111
+ if (t) {
1112
+ let n = this.lexer.state.inRawBlock;
1113
+ return { type: "text", raw: t[0], text: t[0], escaped: n };
1114
+ }
1115
+ }
1116
+ };
1117
+ var x = class u {
1118
+ constructor(e) {
1119
+ __publicField(this, "tokens");
1120
+ __publicField(this, "options");
1121
+ __publicField(this, "state");
1122
+ __publicField(this, "inlineQueue");
1123
+ __publicField(this, "tokenizer");
1124
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new w(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
1125
+ let t = { other: m, block: C.normal, inline: z.normal };
1126
+ this.options.pedantic ? (t.block = C.pedantic, t.inline = z.pedantic) : this.options.gfm && (t.block = C.gfm, this.options.breaks ? t.inline = z.breaks : t.inline = z.gfm), this.tokenizer.rules = t;
1127
+ }
1128
+ static get rules() {
1129
+ return { block: C, inline: z };
1130
+ }
1131
+ static lex(e, t) {
1132
+ return new u(t).lex(e);
1133
+ }
1134
+ static lexInline(e, t) {
1135
+ return new u(t).inlineTokens(e);
1136
+ }
1137
+ lex(e) {
1138
+ e = e.replace(m.carriageReturn, `
1139
+ `), this.blockTokens(e, this.tokens);
1140
+ for (let t = 0; t < this.inlineQueue.length; t++) {
1141
+ let n = this.inlineQueue[t];
1142
+ this.inlineTokens(n.src, n.tokens);
1143
+ }
1144
+ return this.inlineQueue = [], this.tokens;
1145
+ }
1146
+ blockTokens(e, t = [], n = false) {
1147
+ var _a2, _b, _c;
1148
+ for (this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e; ) {
1149
+ let r;
1150
+ if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.block) == null ? void 0 : _b.some((s) => (r = s.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false)) continue;
1151
+ if (r = this.tokenizer.space(e)) {
1152
+ e = e.substring(r.raw.length);
1153
+ let s = t.at(-1);
1154
+ r.raw.length === 1 && s !== void 0 ? s.raw += `
1155
+ ` : t.push(r);
1156
+ continue;
1157
+ }
1158
+ if (r = this.tokenizer.code(e)) {
1159
+ e = e.substring(r.raw.length);
1160
+ let s = t.at(-1);
1161
+ (s == null ? void 0 : s.type) === "paragraph" || (s == null ? void 0 : s.type) === "text" ? (s.raw += (s.raw.endsWith(`
1162
+ `) ? "" : `
1163
+ `) + r.raw, s.text += `
1164
+ ` + r.text, this.inlineQueue.at(-1).src = s.text) : t.push(r);
1165
+ continue;
1166
+ }
1167
+ if (r = this.tokenizer.fences(e)) {
1168
+ e = e.substring(r.raw.length), t.push(r);
1169
+ continue;
1170
+ }
1171
+ if (r = this.tokenizer.heading(e)) {
1172
+ e = e.substring(r.raw.length), t.push(r);
1173
+ continue;
1174
+ }
1175
+ if (r = this.tokenizer.hr(e)) {
1176
+ e = e.substring(r.raw.length), t.push(r);
1177
+ continue;
1178
+ }
1179
+ if (r = this.tokenizer.blockquote(e)) {
1180
+ e = e.substring(r.raw.length), t.push(r);
1181
+ continue;
1182
+ }
1183
+ if (r = this.tokenizer.list(e)) {
1184
+ e = e.substring(r.raw.length), t.push(r);
1185
+ continue;
1186
+ }
1187
+ if (r = this.tokenizer.html(e)) {
1188
+ e = e.substring(r.raw.length), t.push(r);
1189
+ continue;
1190
+ }
1191
+ if (r = this.tokenizer.def(e)) {
1192
+ e = e.substring(r.raw.length);
1193
+ let s = t.at(-1);
1194
+ (s == null ? void 0 : s.type) === "paragraph" || (s == null ? void 0 : s.type) === "text" ? (s.raw += (s.raw.endsWith(`
1195
+ `) ? "" : `
1196
+ `) + r.raw, s.text += `
1197
+ ` + r.raw, this.inlineQueue.at(-1).src = s.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }, t.push(r));
1198
+ continue;
1199
+ }
1200
+ if (r = this.tokenizer.table(e)) {
1201
+ e = e.substring(r.raw.length), t.push(r);
1202
+ continue;
1203
+ }
1204
+ if (r = this.tokenizer.lheading(e)) {
1205
+ e = e.substring(r.raw.length), t.push(r);
1206
+ continue;
1207
+ }
1208
+ let i = e;
1209
+ if ((_c = this.options.extensions) == null ? void 0 : _c.startBlock) {
1210
+ let s = 1 / 0, a = e.slice(1), o;
1211
+ this.options.extensions.startBlock.forEach((l) => {
1212
+ o = l.call({ lexer: this }, a), typeof o == "number" && o >= 0 && (s = Math.min(s, o));
1213
+ }), s < 1 / 0 && s >= 0 && (i = e.substring(0, s + 1));
1214
+ }
1215
+ if (this.state.top && (r = this.tokenizer.paragraph(i))) {
1216
+ let s = t.at(-1);
1217
+ n && (s == null ? void 0 : s.type) === "paragraph" ? (s.raw += (s.raw.endsWith(`
1218
+ `) ? "" : `
1219
+ `) + r.raw, s.text += `
1220
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
1221
+ continue;
1222
+ }
1223
+ if (r = this.tokenizer.text(e)) {
1224
+ e = e.substring(r.raw.length);
1225
+ let s = t.at(-1);
1226
+ (s == null ? void 0 : s.type) === "text" ? (s.raw += (s.raw.endsWith(`
1227
+ `) ? "" : `
1228
+ `) + r.raw, s.text += `
1229
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r);
1230
+ continue;
1231
+ }
1232
+ if (e) {
1233
+ let s = "Infinite loop on byte: " + e.charCodeAt(0);
1234
+ if (this.options.silent) {
1235
+ console.error(s);
1236
+ break;
1237
+ } else throw new Error(s);
1238
+ }
1239
+ }
1240
+ return this.state.top = true, t;
1241
+ }
1242
+ inline(e, t = []) {
1243
+ return this.inlineQueue.push({ src: e, tokens: t }), t;
1244
+ }
1245
+ inlineTokens(e, t = []) {
1246
+ var _a2, _b, _c, _d, _e2, _f;
1247
+ let n = e, r = null;
1248
+ if (this.tokens.links) {
1249
+ let o = Object.keys(this.tokens.links);
1250
+ if (o.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null; ) o.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
1251
+ }
1252
+ for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null; ) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
1253
+ let i;
1254
+ for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) != null; ) i = r[2] ? r[2].length : 0, n = n.slice(0, r.index + i) + "[" + "a".repeat(r[0].length - i - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1255
+ n = (_c = (_b = (_a2 = this.options.hooks) == null ? void 0 : _a2.emStrongMask) == null ? void 0 : _b.call({ lexer: this }, n)) != null ? _c : n;
1256
+ let s = false, a = "";
1257
+ for (; e; ) {
1258
+ s || (a = ""), s = false;
1259
+ let o;
1260
+ if ((_e2 = (_d = this.options.extensions) == null ? void 0 : _d.inline) == null ? void 0 : _e2.some((p) => (o = p.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
1261
+ if (o = this.tokenizer.escape(e)) {
1262
+ e = e.substring(o.raw.length), t.push(o);
1263
+ continue;
1264
+ }
1265
+ if (o = this.tokenizer.tag(e)) {
1266
+ e = e.substring(o.raw.length), t.push(o);
1267
+ continue;
1268
+ }
1269
+ if (o = this.tokenizer.link(e)) {
1270
+ e = e.substring(o.raw.length), t.push(o);
1271
+ continue;
1272
+ }
1273
+ if (o = this.tokenizer.reflink(e, this.tokens.links)) {
1274
+ e = e.substring(o.raw.length);
1275
+ let p = t.at(-1);
1276
+ o.type === "text" && (p == null ? void 0 : p.type) === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
1277
+ continue;
1278
+ }
1279
+ if (o = this.tokenizer.emStrong(e, n, a)) {
1280
+ e = e.substring(o.raw.length), t.push(o);
1281
+ continue;
1282
+ }
1283
+ if (o = this.tokenizer.codespan(e)) {
1284
+ e = e.substring(o.raw.length), t.push(o);
1285
+ continue;
1286
+ }
1287
+ if (o = this.tokenizer.br(e)) {
1288
+ e = e.substring(o.raw.length), t.push(o);
1289
+ continue;
1290
+ }
1291
+ if (o = this.tokenizer.del(e, n, a)) {
1292
+ e = e.substring(o.raw.length), t.push(o);
1293
+ continue;
1294
+ }
1295
+ if (o = this.tokenizer.autolink(e)) {
1296
+ e = e.substring(o.raw.length), t.push(o);
1297
+ continue;
1298
+ }
1299
+ if (!this.state.inLink && (o = this.tokenizer.url(e))) {
1300
+ e = e.substring(o.raw.length), t.push(o);
1301
+ continue;
1302
+ }
1303
+ let l = e;
1304
+ if ((_f = this.options.extensions) == null ? void 0 : _f.startInline) {
1305
+ let p = 1 / 0, c = e.slice(1), d;
1306
+ this.options.extensions.startInline.forEach((h) => {
1307
+ d = h.call({ lexer: this }, c), typeof d == "number" && d >= 0 && (p = Math.min(p, d));
1308
+ }), p < 1 / 0 && p >= 0 && (l = e.substring(0, p + 1));
1309
+ }
1310
+ if (o = this.tokenizer.inlineText(l)) {
1311
+ e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (a = o.raw.slice(-1)), s = true;
1312
+ let p = t.at(-1);
1313
+ (p == null ? void 0 : p.type) === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
1314
+ continue;
1315
+ }
1316
+ if (e) {
1317
+ let p = "Infinite loop on byte: " + e.charCodeAt(0);
1318
+ if (this.options.silent) {
1319
+ console.error(p);
1320
+ break;
1321
+ } else throw new Error(p);
1322
+ }
1323
+ }
1324
+ return t;
1325
+ }
1326
+ };
1327
+ var y = class {
1328
+ constructor(e) {
1329
+ __publicField(this, "options");
1330
+ __publicField(this, "parser");
1331
+ this.options = e || T;
1332
+ }
1333
+ space(e) {
1334
+ return "";
1335
+ }
1336
+ code({ text: e, lang: t, escaped: n }) {
1337
+ var _a2;
1338
+ let r = (_a2 = (t || "").match(m.notSpaceStart)) == null ? void 0 : _a2[0], i = e.replace(m.endingNewline, "") + `
1339
+ `;
1340
+ return r ? '<pre><code class="language-' + O(r) + '">' + (n ? i : O(i, true)) + `</code></pre>
1341
+ ` : "<pre><code>" + (n ? i : O(i, true)) + `</code></pre>
1342
+ `;
1343
+ }
1344
+ blockquote({ tokens: e }) {
1345
+ return `<blockquote>
1346
+ ${this.parser.parse(e)}</blockquote>
1347
+ `;
1348
+ }
1349
+ html({ text: e }) {
1350
+ return e;
1351
+ }
1352
+ def(e) {
1353
+ return "";
1354
+ }
1355
+ heading({ tokens: e, depth: t }) {
1356
+ return `<h${t}>${this.parser.parseInline(e)}</h${t}>
1357
+ `;
1358
+ }
1359
+ hr(e) {
1360
+ return `<hr>
1361
+ `;
1362
+ }
1363
+ list(e) {
1364
+ let t = e.ordered, n = e.start, r = "";
1365
+ for (let a = 0; a < e.items.length; a++) {
1366
+ let o = e.items[a];
1367
+ r += this.listitem(o);
1368
+ }
1369
+ let i = t ? "ol" : "ul", s = t && n !== 1 ? ' start="' + n + '"' : "";
1370
+ return "<" + i + s + `>
1371
+ ` + r + "</" + i + `>
1372
+ `;
1373
+ }
1374
+ listitem(e) {
1375
+ return `<li>${this.parser.parse(e.tokens)}</li>
1376
+ `;
1377
+ }
1378
+ checkbox({ checked: e }) {
1379
+ return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
1380
+ }
1381
+ paragraph({ tokens: e }) {
1382
+ return `<p>${this.parser.parseInline(e)}</p>
1383
+ `;
1384
+ }
1385
+ table(e) {
1386
+ let t = "", n = "";
1387
+ for (let i = 0; i < e.header.length; i++) n += this.tablecell(e.header[i]);
1388
+ t += this.tablerow({ text: n });
1389
+ let r = "";
1390
+ for (let i = 0; i < e.rows.length; i++) {
1391
+ let s = e.rows[i];
1392
+ n = "";
1393
+ for (let a = 0; a < s.length; a++) n += this.tablecell(s[a]);
1394
+ r += this.tablerow({ text: n });
1395
+ }
1396
+ return r && (r = `<tbody>${r}</tbody>`), `<table>
1397
+ <thead>
1398
+ ` + t + `</thead>
1399
+ ` + r + `</table>
1400
+ `;
1401
+ }
1402
+ tablerow({ text: e }) {
1403
+ return `<tr>
1404
+ ${e}</tr>
1405
+ `;
1406
+ }
1407
+ tablecell(e) {
1408
+ let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
1409
+ return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
1410
+ `;
1411
+ }
1412
+ strong({ tokens: e }) {
1413
+ return `<strong>${this.parser.parseInline(e)}</strong>`;
1414
+ }
1415
+ em({ tokens: e }) {
1416
+ return `<em>${this.parser.parseInline(e)}</em>`;
1417
+ }
1418
+ codespan({ text: e }) {
1419
+ return `<code>${O(e, true)}</code>`;
1420
+ }
1421
+ br(e) {
1422
+ return "<br>";
1423
+ }
1424
+ del({ tokens: e }) {
1425
+ return `<del>${this.parser.parseInline(e)}</del>`;
1426
+ }
1427
+ link({ href: e, title: t, tokens: n }) {
1428
+ let r = this.parser.parseInline(n), i = X(e);
1429
+ if (i === null) return r;
1430
+ e = i;
1431
+ let s = '<a href="' + e + '"';
1432
+ return t && (s += ' title="' + O(t) + '"'), s += ">" + r + "</a>", s;
1433
+ }
1434
+ image({ href: e, title: t, text: n, tokens: r }) {
1435
+ r && (n = this.parser.parseInline(r, this.parser.textRenderer));
1436
+ let i = X(e);
1437
+ if (i === null) return O(n);
1438
+ e = i;
1439
+ let s = `<img src="${e}" alt="${O(n)}"`;
1440
+ return t && (s += ` title="${O(t)}"`), s += ">", s;
1441
+ }
1442
+ text(e) {
1443
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : O(e.text);
1444
+ }
1445
+ };
1446
+ var $ = class {
1447
+ strong({ text: e }) {
1448
+ return e;
1449
+ }
1450
+ em({ text: e }) {
1451
+ return e;
1452
+ }
1453
+ codespan({ text: e }) {
1454
+ return e;
1455
+ }
1456
+ del({ text: e }) {
1457
+ return e;
1458
+ }
1459
+ html({ text: e }) {
1460
+ return e;
1461
+ }
1462
+ text({ text: e }) {
1463
+ return e;
1464
+ }
1465
+ link({ text: e }) {
1466
+ return "" + e;
1467
+ }
1468
+ image({ text: e }) {
1469
+ return "" + e;
1470
+ }
1471
+ br() {
1472
+ return "";
1473
+ }
1474
+ checkbox({ raw: e }) {
1475
+ return e;
1476
+ }
1477
+ };
1478
+ var b = class u2 {
1479
+ constructor(e) {
1480
+ __publicField(this, "options");
1481
+ __publicField(this, "renderer");
1482
+ __publicField(this, "textRenderer");
1483
+ this.options = e || T, this.options.renderer = this.options.renderer || new y(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
1484
+ }
1485
+ static parse(e, t) {
1486
+ return new u2(t).parse(e);
1487
+ }
1488
+ static parseInline(e, t) {
1489
+ return new u2(t).parseInline(e);
1490
+ }
1491
+ parse(e) {
1492
+ var _a2, _b;
1493
+ let t = "";
1494
+ for (let n = 0; n < e.length; n++) {
1495
+ let r = e[n];
1496
+ if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[r.type]) {
1497
+ let s = r, a = this.options.extensions.renderers[s.type].call({ parser: this }, s);
1498
+ if (a !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(s.type)) {
1499
+ t += a || "";
1500
+ continue;
1501
+ }
1502
+ }
1503
+ let i = r;
1504
+ switch (i.type) {
1505
+ case "space": {
1506
+ t += this.renderer.space(i);
1507
+ break;
1508
+ }
1509
+ case "hr": {
1510
+ t += this.renderer.hr(i);
1511
+ break;
1512
+ }
1513
+ case "heading": {
1514
+ t += this.renderer.heading(i);
1515
+ break;
1516
+ }
1517
+ case "code": {
1518
+ t += this.renderer.code(i);
1519
+ break;
1520
+ }
1521
+ case "table": {
1522
+ t += this.renderer.table(i);
1523
+ break;
1524
+ }
1525
+ case "blockquote": {
1526
+ t += this.renderer.blockquote(i);
1527
+ break;
1528
+ }
1529
+ case "list": {
1530
+ t += this.renderer.list(i);
1531
+ break;
1532
+ }
1533
+ case "checkbox": {
1534
+ t += this.renderer.checkbox(i);
1535
+ break;
1536
+ }
1537
+ case "html": {
1538
+ t += this.renderer.html(i);
1539
+ break;
1540
+ }
1541
+ case "def": {
1542
+ t += this.renderer.def(i);
1543
+ break;
1544
+ }
1545
+ case "paragraph": {
1546
+ t += this.renderer.paragraph(i);
1547
+ break;
1548
+ }
1549
+ case "text": {
1550
+ t += this.renderer.text(i);
1551
+ break;
1552
+ }
1553
+ default: {
1554
+ let s = 'Token with "' + i.type + '" type was not found.';
1555
+ if (this.options.silent) return console.error(s), "";
1556
+ throw new Error(s);
1557
+ }
1558
+ }
1559
+ }
1560
+ return t;
1561
+ }
1562
+ parseInline(e, t = this.renderer) {
1563
+ var _a2, _b;
1564
+ let n = "";
1565
+ for (let r = 0; r < e.length; r++) {
1566
+ let i = e[r];
1567
+ if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[i.type]) {
1568
+ let a = this.options.extensions.renderers[i.type].call({ parser: this }, i);
1569
+ if (a !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
1570
+ n += a || "";
1571
+ continue;
1572
+ }
1573
+ }
1574
+ let s = i;
1575
+ switch (s.type) {
1576
+ case "escape": {
1577
+ n += t.text(s);
1578
+ break;
1579
+ }
1580
+ case "html": {
1581
+ n += t.html(s);
1582
+ break;
1583
+ }
1584
+ case "link": {
1585
+ n += t.link(s);
1586
+ break;
1587
+ }
1588
+ case "image": {
1589
+ n += t.image(s);
1590
+ break;
1591
+ }
1592
+ case "checkbox": {
1593
+ n += t.checkbox(s);
1594
+ break;
1595
+ }
1596
+ case "strong": {
1597
+ n += t.strong(s);
1598
+ break;
1599
+ }
1600
+ case "em": {
1601
+ n += t.em(s);
1602
+ break;
1603
+ }
1604
+ case "codespan": {
1605
+ n += t.codespan(s);
1606
+ break;
1607
+ }
1608
+ case "br": {
1609
+ n += t.br(s);
1610
+ break;
1611
+ }
1612
+ case "del": {
1613
+ n += t.del(s);
1614
+ break;
1615
+ }
1616
+ case "text": {
1617
+ n += t.text(s);
1618
+ break;
1619
+ }
1620
+ default: {
1621
+ let a = 'Token with "' + s.type + '" type was not found.';
1622
+ if (this.options.silent) return console.error(a), "";
1623
+ throw new Error(a);
1624
+ }
1625
+ }
1626
+ }
1627
+ return n;
1628
+ }
1629
+ };
1630
+ var _a;
1631
+ var P = (_a = class {
1632
+ constructor(e) {
1633
+ __publicField(this, "options");
1634
+ __publicField(this, "block");
1635
+ this.options = e || T;
1636
+ }
1637
+ preprocess(e) {
1638
+ return e;
1639
+ }
1640
+ postprocess(e) {
1641
+ return e;
1642
+ }
1643
+ processAllTokens(e) {
1644
+ return e;
1645
+ }
1646
+ emStrongMask(e) {
1647
+ return e;
1648
+ }
1649
+ provideLexer() {
1650
+ return this.block ? x.lex : x.lexInline;
1651
+ }
1652
+ provideParser() {
1653
+ return this.block ? b.parse : b.parseInline;
1654
+ }
1655
+ }, __publicField(_a, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), __publicField(_a, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _a);
1656
+ var B = class {
1657
+ constructor(...e) {
1658
+ __publicField(this, "defaults", M());
1659
+ __publicField(this, "options", this.setOptions);
1660
+ __publicField(this, "parse", this.parseMarkdown(true));
1661
+ __publicField(this, "parseInline", this.parseMarkdown(false));
1662
+ __publicField(this, "Parser", b);
1663
+ __publicField(this, "Renderer", y);
1664
+ __publicField(this, "TextRenderer", $);
1665
+ __publicField(this, "Lexer", x);
1666
+ __publicField(this, "Tokenizer", w);
1667
+ __publicField(this, "Hooks", P);
1668
+ this.use(...e);
1669
+ }
1670
+ walkTokens(e, t) {
1671
+ var _a2, _b;
1672
+ let n = [];
1673
+ for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
1674
+ case "table": {
1675
+ let i = r;
1676
+ for (let s of i.header) n = n.concat(this.walkTokens(s.tokens, t));
1677
+ for (let s of i.rows) for (let a of s) n = n.concat(this.walkTokens(a.tokens, t));
1678
+ break;
1679
+ }
1680
+ case "list": {
1681
+ let i = r;
1682
+ n = n.concat(this.walkTokens(i.items, t));
1683
+ break;
1684
+ }
1685
+ default: {
1686
+ let i = r;
1687
+ ((_b = (_a2 = this.defaults.extensions) == null ? void 0 : _a2.childTokens) == null ? void 0 : _b[i.type]) ? this.defaults.extensions.childTokens[i.type].forEach((s) => {
1688
+ let a = i[s].flat(1 / 0);
1689
+ n = n.concat(this.walkTokens(a, t));
1690
+ }) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t)));
1691
+ }
1692
+ }
1693
+ return n;
1694
+ }
1695
+ use(...e) {
1696
+ let t = this.defaults.extensions || { renderers: {}, childTokens: {} };
1697
+ return e.forEach((n) => {
1698
+ let r = { ...n };
1699
+ if (r.async = this.defaults.async || r.async || false, n.extensions && (n.extensions.forEach((i) => {
1700
+ if (!i.name) throw new Error("extension name required");
1701
+ if ("renderer" in i) {
1702
+ let s = t.renderers[i.name];
1703
+ s ? t.renderers[i.name] = function(...a) {
1704
+ let o = i.renderer.apply(this, a);
1705
+ return o === false && (o = s.apply(this, a)), o;
1706
+ } : t.renderers[i.name] = i.renderer;
1707
+ }
1708
+ if ("tokenizer" in i) {
1709
+ if (!i.level || i.level !== "block" && i.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
1710
+ let s = t[i.level];
1711
+ s ? s.unshift(i.tokenizer) : t[i.level] = [i.tokenizer], i.start && (i.level === "block" ? t.startBlock ? t.startBlock.push(i.start) : t.startBlock = [i.start] : i.level === "inline" && (t.startInline ? t.startInline.push(i.start) : t.startInline = [i.start]));
1712
+ }
1713
+ "childTokens" in i && i.childTokens && (t.childTokens[i.name] = i.childTokens);
1714
+ }), r.extensions = t), n.renderer) {
1715
+ let i = this.defaults.renderer || new y(this.defaults);
1716
+ for (let s in n.renderer) {
1717
+ if (!(s in i)) throw new Error(`renderer '${s}' does not exist`);
1718
+ if (["options", "parser"].includes(s)) continue;
1719
+ let a = s, o = n.renderer[a], l = i[a];
1720
+ i[a] = (...p) => {
1721
+ let c = o.apply(i, p);
1722
+ return c === false && (c = l.apply(i, p)), c || "";
1723
+ };
1724
+ }
1725
+ r.renderer = i;
1726
+ }
1727
+ if (n.tokenizer) {
1728
+ let i = this.defaults.tokenizer || new w(this.defaults);
1729
+ for (let s in n.tokenizer) {
1730
+ if (!(s in i)) throw new Error(`tokenizer '${s}' does not exist`);
1731
+ if (["options", "rules", "lexer"].includes(s)) continue;
1732
+ let a = s, o = n.tokenizer[a], l = i[a];
1733
+ i[a] = (...p) => {
1734
+ let c = o.apply(i, p);
1735
+ return c === false && (c = l.apply(i, p)), c;
1736
+ };
1737
+ }
1738
+ r.tokenizer = i;
1739
+ }
1740
+ if (n.hooks) {
1741
+ let i = this.defaults.hooks || new P();
1742
+ for (let s in n.hooks) {
1743
+ if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
1744
+ if (["options", "block"].includes(s)) continue;
1745
+ let a = s, o = n.hooks[a], l = i[a];
1746
+ P.passThroughHooks.has(s) ? i[a] = (p) => {
1747
+ if (this.defaults.async && P.passThroughHooksRespectAsync.has(s)) return (async () => {
1748
+ let d = await o.call(i, p);
1749
+ return l.call(i, d);
1750
+ })();
1751
+ let c = o.call(i, p);
1752
+ return l.call(i, c);
1753
+ } : i[a] = (...p) => {
1754
+ if (this.defaults.async) return (async () => {
1755
+ let d = await o.apply(i, p);
1756
+ return d === false && (d = await l.apply(i, p)), d;
1757
+ })();
1758
+ let c = o.apply(i, p);
1759
+ return c === false && (c = l.apply(i, p)), c;
1760
+ };
1761
+ }
1762
+ r.hooks = i;
1763
+ }
1764
+ if (n.walkTokens) {
1765
+ let i = this.defaults.walkTokens, s = n.walkTokens;
1766
+ r.walkTokens = function(a) {
1767
+ let o = [];
1768
+ return o.push(s.call(this, a)), i && (o = o.concat(i.call(this, a))), o;
1769
+ };
1770
+ }
1771
+ this.defaults = { ...this.defaults, ...r };
1772
+ }), this;
1773
+ }
1774
+ setOptions(e) {
1775
+ return this.defaults = { ...this.defaults, ...e }, this;
1776
+ }
1777
+ lexer(e, t) {
1778
+ return x.lex(e, t != null ? t : this.defaults);
1779
+ }
1780
+ parser(e, t) {
1781
+ return b.parse(e, t != null ? t : this.defaults);
1782
+ }
1783
+ parseMarkdown(e) {
1784
+ return (n, r) => {
1785
+ let i = { ...r }, s = { ...this.defaults, ...i }, a = this.onError(!!s.silent, !!s.async);
1786
+ if (this.defaults.async === true && i.async === false) return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
1787
+ if (typeof n > "u" || n === null) return a(new Error("marked(): input parameter is undefined or null"));
1788
+ if (typeof n != "string") return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
1789
+ if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
1790
+ let o = s.hooks ? await s.hooks.preprocess(n) : n, p = await (s.hooks ? await s.hooks.provideLexer() : e ? x.lex : x.lexInline)(o, s), c = s.hooks ? await s.hooks.processAllTokens(p) : p;
1791
+ s.walkTokens && await Promise.all(this.walkTokens(c, s.walkTokens));
1792
+ let h = await (s.hooks ? await s.hooks.provideParser() : e ? b.parse : b.parseInline)(c, s);
1793
+ return s.hooks ? await s.hooks.postprocess(h) : h;
1794
+ })().catch(a);
1795
+ try {
1796
+ s.hooks && (n = s.hooks.preprocess(n));
1797
+ let l = (s.hooks ? s.hooks.provideLexer() : e ? x.lex : x.lexInline)(n, s);
1798
+ s.hooks && (l = s.hooks.processAllTokens(l)), s.walkTokens && this.walkTokens(l, s.walkTokens);
1799
+ let c = (s.hooks ? s.hooks.provideParser() : e ? b.parse : b.parseInline)(l, s);
1800
+ return s.hooks && (c = s.hooks.postprocess(c)), c;
1801
+ } catch (o) {
1802
+ return a(o);
1803
+ }
1804
+ };
1805
+ }
1806
+ onError(e, t) {
1807
+ return (n) => {
1808
+ if (n.message += `
1809
+ Please report this to https://github.com/markedjs/marked.`, e) {
1810
+ let r = "<p>An error occurred:</p><pre>" + O(n.message + "", true) + "</pre>";
1811
+ return t ? Promise.resolve(r) : r;
1812
+ }
1813
+ if (t) return Promise.reject(n);
1814
+ throw n;
1815
+ };
1816
+ }
1817
+ };
1818
+ var L = new B();
1819
+ function g(u3, e) {
1820
+ return L.parse(u3, e);
1821
+ }
1822
+ g.options = g.setOptions = function(u3) {
1823
+ return L.setOptions(u3), g.defaults = L.defaults, G(g.defaults), g;
1824
+ };
1825
+ g.getDefaults = M;
1826
+ g.defaults = T;
1827
+ g.use = function(...u3) {
1828
+ return L.use(...u3), g.defaults = L.defaults, G(g.defaults), g;
1829
+ };
1830
+ g.walkTokens = function(u3, e) {
1831
+ return L.walkTokens(u3, e);
1832
+ };
1833
+ g.parseInline = L.parseInline;
1834
+ g.Parser = b;
1835
+ g.parser = b.parse;
1836
+ g.Renderer = y;
1837
+ g.TextRenderer = $;
1838
+ g.Lexer = x;
1839
+ g.lexer = x.lex;
1840
+ g.Tokenizer = w;
1841
+ g.Hooks = P;
1842
+ g.parse = g;
1843
+ var Ut = g.options;
1844
+ var Kt = g.setOptions;
1845
+ var Wt = g.use;
1846
+ var Xt = g.walkTokens;
1847
+ var Jt = g.parseInline;
1848
+ var Yt = b.parse;
1849
+ var en = x.lex;
1850
+
1851
+ // ../adaptives/adaptive-faq/dist/FAQWidget.js
1852
+ import React2, { useCallback as useCallback2, useEffect as useEffect2, useMemo, useReducer, useState as useState2 } from "react";
1853
+ import { createRoot as createRoot2 } from "react-dom/client";
1854
+
1855
+ // ../adaptives/adaptive-faq/dist/faq-styles.js
661
1856
  var baseStyles = {
662
1857
  container: {
663
1858
  fontFamily: "var(--sc-font-family, system-ui, -apple-system, sans-serif)",
@@ -774,7 +1969,10 @@ var themeStyles = {
774
1969
  },
775
1970
  item: {
776
1971
  backgroundColor: "var(--sc-content-background)",
777
- border: "var(--sc-content-border)"
1972
+ borderTop: "var(--sc-content-border)",
1973
+ borderRight: "var(--sc-content-border)",
1974
+ borderBottom: "var(--sc-content-border)",
1975
+ borderLeft: "var(--sc-content-border)"
778
1976
  },
779
1977
  itemExpanded: {
780
1978
  boxShadow: "0 4px 12px rgba(0, 0, 0, 0.08)"
@@ -813,7 +2011,10 @@ var themeStyles = {
813
2011
  },
814
2012
  item: {
815
2013
  backgroundColor: "var(--sc-content-background)",
816
- border: "var(--sc-content-border)"
2014
+ borderTop: "var(--sc-content-border)",
2015
+ borderRight: "var(--sc-content-border)",
2016
+ borderBottom: "var(--sc-content-border)",
2017
+ borderLeft: "var(--sc-content-border)"
817
2018
  },
818
2019
  itemExpanded: {
819
2020
  boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)"
@@ -843,6 +2044,40 @@ var themeStyles = {
843
2044
  }
844
2045
  }
845
2046
  };
2047
+
2048
+ // ../adaptives/adaptive-faq/dist/FAQWidget.js
2049
+ var marked = new B({ async: false, gfm: true, breaks: true });
2050
+ function getAnswerText(answer) {
2051
+ if (typeof answer === "string")
2052
+ return answer;
2053
+ if (answer.type === "rich")
2054
+ return answer.html;
2055
+ return answer.content;
2056
+ }
2057
+ function renderAnswer(answer) {
2058
+ if (typeof answer === "string") {
2059
+ return _jsx2("p", { style: { margin: 0 }, children: answer });
2060
+ }
2061
+ if (answer.type === "rich") {
2062
+ return _jsx2("div", { style: { margin: 0 }, dangerouslySetInnerHTML: { __html: answer.html } });
2063
+ }
2064
+ const html = marked.parse(answer.content);
2065
+ return (
2066
+ // biome-ignore lint/security/noDangerouslySetInnerHtml: markdown content is CMS/config content, not user-controlled input
2067
+ _jsx2("div", { style: { margin: 0 }, "data-faq-markdown": "", dangerouslySetInnerHTML: { __html: html } })
2068
+ );
2069
+ }
2070
+ function resolveFeedbackConfig(feedback) {
2071
+ if (!feedback)
2072
+ return null;
2073
+ if (feedback === true) {
2074
+ return { style: "thumbs" };
2075
+ }
2076
+ return feedback;
2077
+ }
2078
+ function getFeedbackPrompt(feedbackConfig) {
2079
+ return feedbackConfig.prompt || "Was this helpful?";
2080
+ }
846
2081
  function FAQItem({ item, isExpanded, isHighlighted, isLast, onToggle, theme, feedbackConfig, feedbackValue, onFeedback }) {
847
2082
  const [isHovered, setIsHovered] = useState2(false);
848
2083
  const colors = themeStyles[theme];
@@ -885,7 +2120,7 @@ function FAQItem({ item, isExpanded, isHighlighted, isLast, onToggle, theme, fee
885
2120
  }, "aria-label": "Thumbs down", onClick: () => onFeedback(item.config.id, question, "down"), children: "\u{1F44E}" })] })] })] });
886
2121
  }
887
2122
  function FAQWidget({ config, runtime: runtime7, instanceId }) {
888
- const [renderTick, forceUpdate] = useReducer((x) => x + 1, 0);
2123
+ const [renderTick, forceUpdate] = useReducer((x2) => x2 + 1, 0);
889
2124
  const [expandedIds, setExpandedIds] = useState2(/* @__PURE__ */ new Set());
890
2125
  const [highlightId, setHighlightId] = useState2(null);
891
2126
  const [searchQuery, setSearchQuery] = useState2("");
@@ -898,8 +2133,8 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
898
2133
  return unsubscribe;
899
2134
  }, [runtime7.context]);
900
2135
  useEffect2(() => {
901
- var _a;
902
- if (!((_a = runtime7.accumulator) == null ? void 0 : _a.subscribe))
2136
+ var _a2;
2137
+ if (!((_a2 = runtime7.accumulator) == null ? void 0 : _a2.subscribe))
903
2138
  return;
904
2139
  return runtime7.accumulator.subscribe(() => {
905
2140
  forceUpdate();
@@ -911,8 +2146,8 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
911
2146
  if (runtime7.events.getRecent) {
912
2147
  const recentEvents = runtime7.events.getRecent({ patterns: ["^action\\.tooltip_cta_clicked$", "^action\\.modal_cta_clicked$"] }, 10);
913
2148
  const pendingEvent = recentEvents.filter((e) => {
914
- var _a;
915
- const actionId = (_a = e.props) == null ? void 0 : _a.actionId;
2149
+ var _a2;
2150
+ const actionId = (_a2 = e.props) == null ? void 0 : _a2.actionId;
916
2151
  return typeof actionId === "string" && actionId.startsWith("faq:open:");
917
2152
  }).pop();
918
2153
  if (pendingEvent && Date.now() - pendingEvent.ts < 1e4) {
@@ -926,8 +2161,8 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
926
2161
  }
927
2162
  }
928
2163
  const unsubscribe = runtime7.events.subscribe({ patterns: ["^action\\.tooltip_cta_clicked$", "^action\\.modal_cta_clicked$"] }, (event) => {
929
- var _a;
930
- const actionId = (_a = event.props) == null ? void 0 : _a.actionId;
2164
+ var _a2;
2165
+ const actionId = (_a2 = event.props) == null ? void 0 : _a2.actionId;
931
2166
  if (typeof actionId !== "string" || !actionId.startsWith("faq:open:"))
932
2167
  return;
933
2168
  const questionId = actionId.replace("faq:open:", "");
@@ -945,8 +2180,8 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
945
2180
  if (!runtime7.events.subscribe)
946
2181
  return;
947
2182
  const handleDeepLink = (event) => {
948
- var _a, _b;
949
- const tileId = (_a = event.props) == null ? void 0 : _a.tileId;
2183
+ var _a2, _b;
2184
+ const tileId = (_a2 = event.props) == null ? void 0 : _a2.tileId;
950
2185
  const itemId = (_b = event.props) == null ? void 0 : _b.itemId;
951
2186
  if (tileId !== instanceId)
952
2187
  return;
@@ -964,8 +2199,8 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
964
2199
  if (runtime7.events.getRecent) {
965
2200
  const recent = runtime7.events.getRecent({ names: ["notification.deep_link"] }, 5);
966
2201
  const pending = recent.filter((e) => {
967
- var _a, _b;
968
- return ((_a = e.props) == null ? void 0 : _a.tileId) === instanceId && ((_b = e.props) == null ? void 0 : _b.itemId);
2202
+ var _a2, _b;
2203
+ return ((_a2 = e.props) == null ? void 0 : _a2.tileId) === instanceId && ((_b = e.props) == null ? void 0 : _b.itemId);
969
2204
  }).pop();
970
2205
  if (pending && Date.now() - pending.ts < 1e4) {
971
2206
  handleDeepLink(pending);
@@ -974,17 +2209,20 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
974
2209
  const unsubscribe = runtime7.events.subscribe({ names: ["notification.deep_link"] }, handleDeepLink);
975
2210
  return unsubscribe;
976
2211
  }, [runtime7, instanceId]);
977
- const visibleQuestions = useMemo(() => config.actions.filter((q) => {
978
- if (!q.triggerWhen)
979
- return true;
980
- const result = runtime7.evaluateSync(q.triggerWhen);
981
- return result.value;
982
- }), [config.actions, runtime7, renderTick]);
2212
+ const visibleQuestions = useMemo(() => {
2213
+ var _a2;
2214
+ return ((_a2 = config.actions) != null ? _a2 : []).filter((q2) => {
2215
+ if (!q2.triggerWhen)
2216
+ return true;
2217
+ const result = runtime7.evaluateSync(q2.triggerWhen);
2218
+ return result.value;
2219
+ });
2220
+ }, [config.actions, runtime7, renderTick]);
983
2221
  const orderedQuestions = useMemo(() => {
984
2222
  if (config.ordering === "priority") {
985
- return [...visibleQuestions].sort((a, b) => {
986
- var _a, _b;
987
- return ((_a = b.config.priority) != null ? _a : 0) - ((_b = a.config.priority) != null ? _b : 0);
2223
+ return [...visibleQuestions].sort((a, b2) => {
2224
+ var _a2, _b;
2225
+ return ((_a2 = b2.config.priority) != null ? _a2 : 0) - ((_b = a.config.priority) != null ? _b : 0);
988
2226
  });
989
2227
  }
990
2228
  return visibleQuestions;
@@ -994,29 +2232,29 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
994
2232
  return orderedQuestions;
995
2233
  }
996
2234
  const query = searchQuery.toLowerCase();
997
- return orderedQuestions.filter((q) => {
998
- var _a;
999
- return q.config.question.toLowerCase().includes(query) || getAnswerText(q.config.answer).toLowerCase().includes(query) || ((_a = q.config.category) == null ? void 0 : _a.toLowerCase().includes(query));
2235
+ return orderedQuestions.filter((q2) => {
2236
+ var _a2;
2237
+ return q2.config.question.toLowerCase().includes(query) || getAnswerText(q2.config.answer).toLowerCase().includes(query) || ((_a2 = q2.config.category) == null ? void 0 : _a2.toLowerCase().includes(query));
1000
2238
  });
1001
2239
  }, [orderedQuestions, searchQuery, config.searchable]);
1002
2240
  const categoryGroups = useMemo(() => {
1003
2241
  const groups = /* @__PURE__ */ new Map();
1004
- for (const q of filteredQuestions) {
1005
- const cat = q.config.category;
2242
+ for (const q2 of filteredQuestions) {
2243
+ const cat = q2.config.category;
1006
2244
  if (!groups.has(cat)) {
1007
2245
  groups.set(cat, []);
1008
2246
  }
1009
- groups.get(cat).push(q);
2247
+ groups.get(cat).push(q2);
1010
2248
  }
1011
2249
  return groups;
1012
2250
  }, [filteredQuestions]);
1013
- const hasCategories = useMemo(() => filteredQuestions.some((q) => q.config.category), [filteredQuestions]);
2251
+ const hasCategories = useMemo(() => filteredQuestions.some((q2) => q2.config.category), [filteredQuestions]);
1014
2252
  const resolvedTheme = useMemo(() => {
1015
- var _a;
2253
+ var _a2;
1016
2254
  if (config.theme && config.theme !== "auto")
1017
2255
  return config.theme;
1018
2256
  if (typeof window !== "undefined") {
1019
- return ((_a = window.matchMedia) == null ? void 0 : _a.call(window, "(prefers-color-scheme: dark)").matches) ? "dark" : "light";
2257
+ return ((_a2 = window.matchMedia) == null ? void 0 : _a2.call(window, "(prefers-color-scheme: dark)").matches) ? "dark" : "light";
1020
2258
  }
1021
2259
  return "light";
1022
2260
  }, [config.theme]);
@@ -1071,7 +2309,7 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
1071
2309
  ...baseStyles.categoryHeader,
1072
2310
  ...themeStyles[resolvedTheme].categoryHeader
1073
2311
  };
1074
- const renderItems = (items) => items.map((q, index) => _jsx2(FAQItem, { item: q, isExpanded: expandedIds.has(q.config.id), isHighlighted: highlightId === q.config.id, isLast: index === items.length - 1, onToggle: () => handleToggle(q.config.id), theme: resolvedTheme, feedbackConfig, feedbackValue: feedbackState.get(q.config.id), onFeedback: handleFeedback }, q.config.id));
2312
+ const renderItems = (items) => items.map((q2, index) => _jsx2(FAQItem, { item: q2, isExpanded: expandedIds.has(q2.config.id), isHighlighted: highlightId === q2.config.id, isLast: index === items.length - 1, onToggle: () => handleToggle(q2.config.id), theme: resolvedTheme, feedbackConfig, feedbackValue: feedbackState.get(q2.config.id), onFeedback: handleFeedback }, q2.config.id));
1075
2313
  if (visibleQuestions.length === 0) {
1076
2314
  return _jsx2("div", { style: containerStyle, "data-adaptive-id": instanceId, "data-adaptive-type": "adaptive-faq", children: _jsx2("div", { style: emptyStateStyle, children: "You're all set for now! We'll surface answers here when they're relevant to what you're doing." }) });
1077
2315
  }
@@ -1099,10 +2337,10 @@ var FAQMountableWidget = {
1099
2337
  const questions = faqConfig.actions || [];
1100
2338
  container.innerHTML = `
1101
2339
  <div style="font-family: system-ui; max-width: 800px;">
1102
- ${questions.map((q) => `
2340
+ ${questions.map((q2) => `
1103
2341
  <div style="margin-bottom: 8px; padding: 16px; background: ${slateGrey[12]}; border-radius: 8px;">
1104
- <strong>${q.config.question}</strong>
1105
- <p style="margin-top: 8px; color: ${slateGrey[6]};">${getAnswerText(q.config.answer)}</p>
2342
+ <strong>${q2.config.question}</strong>
2343
+ <p style="margin-top: 8px; color: ${slateGrey[6]};">${getAnswerText(q2.config.answer)}</p>
1106
2344
  </div>
1107
2345
  `).join("")}
1108
2346
  </div>
@@ -1144,8 +2382,8 @@ var runtime4 = {
1144
2382
  * and publishes faq:question_revealed when triggerWhen transitions false → true.
1145
2383
  */
1146
2384
  notifyWatchers(props) {
1147
- var _a;
1148
- const actions = (_a = props.actions) != null ? _a : [];
2385
+ var _a2;
2386
+ const actions = (_a2 = props.actions) != null ? _a2 : [];
1149
2387
  return actions.filter((a) => a.notify && a.triggerWhen).map((a) => ({
1150
2388
  id: `faq:${a.config.id}`,
1151
2389
  strategy: a.triggerWhen,
@@ -1209,6 +2447,21 @@ var runtime5 = {
1209
2447
  import { jsx as _jsx3, jsxs as _jsxs3 } from "react/jsx-runtime";
1210
2448
  import React3, { useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo2, useReducer as useReducer2, useState as useState3 } from "react";
1211
2449
  import { createRoot as createRoot3 } from "react-dom/client";
2450
+ var EMOJI_SVG_MAP = {
2451
+ "\u{1F4B5}": '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="12" x="2" y="6" rx="2"/><circle cx="12" cy="12" r="2"/><path d="M6 12h.01M18 12h.01"/></svg>',
2452
+ "\u{1F3DB}\uFE0F": '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" x2="21" y1="22" y2="22"/><line x1="6" x2="6" y1="18" y2="11"/><line x1="10" x2="10" y1="18" y2="11"/><line x1="14" x2="14" y1="18" y2="11"/><line x1="18" x2="18" y1="18" y2="11"/><polygon points="12 2 20 7 4 7"/></svg>',
2453
+ "\u23ED\uFE0F": '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="5 4 15 12 5 20 5 4"/><line x1="19" x2="19" y1="5" y2="19"/></svg>',
2454
+ "\u27A1\uFE0F": '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg>',
2455
+ "\u{1F4A1}": '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/></svg>',
2456
+ "\u{1F4B0}": '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="12" x="2" y="6" rx="2"/><circle cx="12" cy="12" r="2"/><path d="M6 12h.01M18 12h.01"/></svg>',
2457
+ "\u{1F4CB}": '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><path d="M12 11h4"/><path d="M12 16h4"/><path d="M8 11h.01"/><path d="M8 16h.01"/></svg>',
2458
+ "\u2705": '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><path d="m9 11 3 3L22 4"/></svg>',
2459
+ "\u26A0\uFE0F": '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>'
2460
+ };
2461
+ function renderIcon(emoji) {
2462
+ var _a2;
2463
+ return (_a2 = EMOJI_SVG_MAP[emoji]) != null ? _a2 : escapeHtml(emoji);
2464
+ }
1212
2465
  function escapeHtml(str) {
1213
2466
  return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
1214
2467
  }
@@ -1358,10 +2611,29 @@ var themeStyles2 = {
1358
2611
  }
1359
2612
  }
1360
2613
  };
1361
- function NavTipItem({ item, isExpanded, isLast, onToggle, onNavigate, theme }) {
2614
+ function routeMatchesCurrent(routes) {
2615
+ if (typeof window === "undefined")
2616
+ return false;
2617
+ const current = window.location.pathname;
2618
+ return routes.some((route) => {
2619
+ const routePath = route.split("?")[0].split("#")[0];
2620
+ if (routePath.endsWith("/**")) {
2621
+ return current.startsWith(routePath.slice(0, -3));
2622
+ }
2623
+ return current === routePath;
2624
+ });
2625
+ }
2626
+ function pulseElement(el) {
2627
+ const keyframes = [
2628
+ { boxShadow: "0 0 0 0 rgba(13, 148, 136, 0.5)" },
2629
+ { boxShadow: "0 0 0 8px rgba(13, 148, 136, 0)" }
2630
+ ];
2631
+ el.animate(keyframes, { duration: 600, iterations: 3, easing: "ease-out" });
2632
+ }
2633
+ function NavTipItem({ item, isExpanded, isLast, onToggle, onNavigate, onFocusAnchor, theme }) {
1362
2634
  const [isHovered, setIsHovered] = useState3(false);
1363
2635
  const colors = themeStyles2[theme];
1364
- const { title, description, href, icon, external } = item.config;
2636
+ const { title, description, href, icon, external, anchor } = item.config;
1365
2637
  const itemStyle = {
1366
2638
  ...baseStyles2.item,
1367
2639
  ...colors.item,
@@ -1383,17 +2655,26 @@ function NavTipItem({ item, isExpanded, isLast, onToggle, onNavigate, theme }) {
1383
2655
  maxHeight: isExpanded ? "500px" : "0",
1384
2656
  paddingBottom: isExpanded ? "16px" : "0"
1385
2657
  };
2658
+ const effectiveHref = anchor ? Array.isArray(anchor.route) ? anchor.route[0] : anchor.route : href;
2659
+ const isSamePage = anchor ? routeMatchesCurrent(Array.isArray(anchor.route) ? anchor.route : [anchor.route]) : effectiveHref ? routeMatchesCurrent([effectiveHref]) : false;
2660
+ const hasSelector = (anchor == null ? void 0 : anchor.selector) && anchor.selector !== "*";
2661
+ const isFocusAction = isSamePage && hasSelector;
2662
+ const hasAction = !!effectiveHref || isFocusAction;
1386
2663
  const handleLinkClick = (e) => {
1387
2664
  e.preventDefault();
1388
2665
  e.stopPropagation();
1389
- if (href) {
1390
- onNavigate(href, external != null ? external : false);
2666
+ if (isFocusAction && anchor) {
2667
+ onFocusAnchor(anchor);
2668
+ } else if (effectiveHref) {
2669
+ onNavigate(effectiveHref, external != null ? external : false);
1391
2670
  }
1392
2671
  };
1393
- return _jsxs3("div", { style: itemStyle, "data-nav-tip-id": item.config.id, children: [_jsxs3("button", { type: "button", style: headerStyle, onClick: onToggle, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), "aria-expanded": isExpanded, children: [icon && _jsx3("span", { style: baseStyles2.icon, children: icon }), _jsx3("span", { children: title }), _jsx3("span", { style: chevronStyle, children: "\u203A" })] }), _jsxs3("div", { style: bodyStyle, "aria-hidden": !isExpanded, children: [_jsx3("p", { style: baseStyles2.description, children: description }), href && _jsxs3("a", { href, onClick: handleLinkClick, style: { ...baseStyles2.linkButton, ...colors.linkButton }, target: external ? "_blank" : void 0, rel: external ? "noopener noreferrer" : void 0, children: ["Go ", external ? "\u2197" : "\u2192"] })] })] });
2672
+ const ctaLabel = isFocusAction ? `Focus \u2192` : external ? `Go \u2197` : `Go \u2192`;
2673
+ return _jsxs3("div", { style: itemStyle, "data-nav-tip-id": item.config.id, children: [_jsxs3("button", { type: "button", style: headerStyle, onClick: onToggle, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), "aria-expanded": isExpanded, children: [icon && // biome-ignore lint/security/noDangerouslySetInnerHtml: renderIcon returns sanitized SVG from EMOJI_SVG_MAP or escapeHtml
2674
+ _jsx3("span", { style: baseStyles2.icon, dangerouslySetInnerHTML: { __html: renderIcon(icon) } }), _jsx3("span", { children: title }), _jsx3("span", { style: chevronStyle, children: "\u203A" })] }), _jsxs3("div", { style: bodyStyle, "aria-hidden": !isExpanded, children: [_jsx3("p", { style: baseStyles2.description, children: description }), hasAction && _jsx3("a", { href: effectiveHref || "#", onClick: handleLinkClick, style: { ...baseStyles2.linkButton, ...colors.linkButton }, target: external ? "_blank" : void 0, rel: external ? "noopener noreferrer" : void 0, children: ctaLabel })] })] });
1394
2675
  }
1395
2676
  function NavWidget({ config, runtime: runtime7, instanceId }) {
1396
- const [renderTick, forceUpdate] = useReducer2((x) => x + 1, 0);
2677
+ const [renderTick, forceUpdate] = useReducer2((x2) => x2 + 1, 0);
1397
2678
  const [expandedIds, setExpandedIds] = useState3(/* @__PURE__ */ new Set());
1398
2679
  useEffect3(() => {
1399
2680
  const unsubscribe = runtime7.context.subscribe(() => {
@@ -1402,8 +2683,8 @@ function NavWidget({ config, runtime: runtime7, instanceId }) {
1402
2683
  return unsubscribe;
1403
2684
  }, [runtime7.context]);
1404
2685
  useEffect3(() => {
1405
- var _a;
1406
- if (!((_a = runtime7.accumulator) == null ? void 0 : _a.subscribe))
2686
+ var _a2;
2687
+ if (!((_a2 = runtime7.accumulator) == null ? void 0 : _a2.subscribe))
1407
2688
  return;
1408
2689
  return runtime7.accumulator.subscribe(() => {
1409
2690
  forceUpdate();
@@ -1432,11 +2713,11 @@ function NavWidget({ config, runtime: runtime7, instanceId }) {
1432
2713
  }, [visibleTips]);
1433
2714
  const hasCategories = useMemo2(() => visibleTips.some((t) => t.config.category), [visibleTips]);
1434
2715
  const resolvedTheme = useMemo2(() => {
1435
- var _a;
2716
+ var _a2;
1436
2717
  if (config.theme && config.theme !== "auto")
1437
2718
  return config.theme;
1438
2719
  if (typeof window !== "undefined") {
1439
- return ((_a = window.matchMedia) == null ? void 0 : _a.call(window, "(prefers-color-scheme: dark)").matches) ? "dark" : "light";
2720
+ return ((_a2 = window.matchMedia) == null ? void 0 : _a2.call(window, "(prefers-color-scheme: dark)").matches) ? "dark" : "light";
1440
2721
  }
1441
2722
  return "light";
1442
2723
  }, [config.theme]);
@@ -1489,9 +2770,24 @@ function NavWidget({ config, runtime: runtime7, instanceId }) {
1489
2770
  } else {
1490
2771
  const url = new URL(href, window.location.origin);
1491
2772
  url.search = window.location.search;
1492
- window.location.href = url.toString();
2773
+ window.history.pushState(null, "", url.toString());
2774
+ window.dispatchEvent(new PopStateEvent("popstate"));
1493
2775
  }
1494
2776
  }, [runtime7.events, instanceId]);
2777
+ const handleFocusAnchor = useCallback3((anchor) => {
2778
+ const el = document.querySelector(anchor.selector);
2779
+ if (!(el instanceof HTMLElement))
2780
+ return;
2781
+ runtime7.events.publish("nav:tip_focused", {
2782
+ instanceId,
2783
+ selector: anchor.selector,
2784
+ route: anchor.route,
2785
+ timestamp: Date.now()
2786
+ });
2787
+ el.scrollIntoView({ behavior: "smooth", block: "center" });
2788
+ pulseElement(el);
2789
+ setTimeout(() => el.focus(), 400);
2790
+ }, [runtime7.events, instanceId]);
1495
2791
  const containerStyle = {
1496
2792
  ...baseStyles2.container,
1497
2793
  ...themeStyles2[resolvedTheme].container
@@ -1504,7 +2800,7 @@ function NavWidget({ config, runtime: runtime7, instanceId }) {
1504
2800
  ...baseStyles2.emptyState,
1505
2801
  ...themeStyles2[resolvedTheme].emptyState
1506
2802
  };
1507
- const renderItems = (items) => items.map((tip, index) => _jsx3(NavTipItem, { item: tip, isExpanded: expandedIds.has(tip.config.id), isLast: index === items.length - 1, onToggle: () => handleToggle(tip.config.id), onNavigate: handleNavigate, theme: resolvedTheme }, tip.config.id));
2803
+ const renderItems = (items) => items.map((tip, index) => _jsx3(NavTipItem, { item: tip, isExpanded: expandedIds.has(tip.config.id), isLast: index === items.length - 1, onToggle: () => handleToggle(tip.config.id), onNavigate: handleNavigate, onFocusAnchor: handleFocusAnchor, theme: resolvedTheme }, tip.config.id));
1508
2804
  if (visibleTips.length === 0) {
1509
2805
  return _jsx3("div", { style: containerStyle, "data-adaptive-id": instanceId, "data-adaptive-type": "adaptive-nav", children: _jsx3("div", { style: emptyStateStyle, children: "You're all set for now! We'll share helpful tips here when they're relevant to what you're doing." }) });
1510
2806
  }
@@ -1533,7 +2829,7 @@ var NavMountableWidget = {
1533
2829
  <div style="font-family: system-ui; max-width: 100%;">
1534
2830
  ${tips.map((tip) => `
1535
2831
  <div style="margin-bottom: 4px; padding: 12px 16px; background: ${slateGrey[12]}; border-radius: 8px;">
1536
- ${tip.config.icon ? `<span>${escapeHtml(tip.config.icon)}</span> ` : ""}<strong>${escapeHtml(tip.config.title)}</strong>
2832
+ ${tip.config.icon ? `<span>${renderIcon(tip.config.icon)}</span> ` : ""}<strong>${escapeHtml(tip.config.title)}</strong>
1537
2833
  <p style="margin-top: 8px; color: ${slateGrey[6]}; font-size: 13px;">${escapeHtml(tip.config.description)}</p>
1538
2834
  ${tip.config.href ? `<a href="${escapeHtml(tip.config.href)}" style="color: ${purple[2]}; font-size: 13px;">Go &rarr;</a>` : ""}
1539
2835
  </div>
@@ -1548,7 +2844,7 @@ var NavMountableWidget = {
1548
2844
 
1549
2845
  // ../adaptives/adaptive-nav/dist/runtime.js
1550
2846
  var executeScrollTo = async (action, context) => {
1551
- var _a, _b, _c, _d;
2847
+ var _a2, _b, _c, _d;
1552
2848
  const anchorEl = context.resolveAnchor(action.anchorId);
1553
2849
  if (!anchorEl) {
1554
2850
  console.error(`[adaptive-nav] Anchor not found for scrollTo, skipping: ${action.anchorId.selector}`);
@@ -1556,7 +2852,7 @@ var executeScrollTo = async (action, context) => {
1556
2852
  } };
1557
2853
  }
1558
2854
  anchorEl.scrollIntoView({
1559
- behavior: (_a = action.behavior) != null ? _a : "smooth",
2855
+ behavior: (_a2 = action.behavior) != null ? _a2 : "smooth",
1560
2856
  block: (_b = action.block) != null ? _b : "center",
1561
2857
  inline: (_c = action.inline) != null ? _c : "nearest"
1562
2858
  });
@@ -1580,12 +2876,12 @@ function isSameOrigin(url) {
1580
2876
  }
1581
2877
  }
1582
2878
  var executeNavigate = async (action, context) => {
1583
- var _a;
2879
+ var _a2;
1584
2880
  const url = action.url.trim();
1585
2881
  if (url.toLowerCase().startsWith("javascript:")) {
1586
2882
  throw new Error("javascript: URLs are not allowed");
1587
2883
  }
1588
- const target = (_a = action.target) != null ? _a : "_self";
2884
+ const target = (_a2 = action.target) != null ? _a2 : "_self";
1589
2885
  context.publishEvent("action.applied", {
1590
2886
  id: context.generateId(),
1591
2887
  kind: "navigation:navigate",
@@ -1638,8 +2934,8 @@ var runtime6 = {
1638
2934
  * and publishes nav:tip_revealed when triggerWhen transitions false → true.
1639
2935
  */
1640
2936
  notifyWatchers(props) {
1641
- var _a;
1642
- const actions = (_a = props.actions) != null ? _a : [];
2937
+ var _a2;
2938
+ const actions = (_a2 = props.actions) != null ? _a2 : [];
1643
2939
  return actions.filter((a) => a.notify && a.triggerWhen).map((a) => ({
1644
2940
  id: `nav:${a.config.id}`,
1645
2941
  strategy: a.triggerWhen,
@@ -1687,9 +2983,9 @@ import { jsx, jsxs } from "react/jsx-runtime";
1687
2983
  function TileWheel({ tiles, intervalMs = 7e3, telemetry }) {
1688
2984
  const [index, setIndex] = useState4(0);
1689
2985
  const ordered = useMemo3(
1690
- () => [...tiles].sort((a, b) => {
1691
- var _a, _b;
1692
- return ((_a = a.priority) != null ? _a : 0) - ((_b = b.priority) != null ? _b : 0);
2986
+ () => [...tiles].sort((a, b2) => {
2987
+ var _a2, _b;
2988
+ return ((_a2 = a.priority) != null ? _a2 : 0) - ((_b = b2.priority) != null ? _b : 0);
1693
2989
  }),
1694
2990
  [tiles]
1695
2991
  );
@@ -1857,50 +3153,50 @@ function needsMigration(config) {
1857
3153
  }
1858
3154
 
1859
3155
  // src/overlays/schema.ts
1860
- import { z } from "zod";
1861
- var SelectorZ = z.union([
1862
- z.object({ type: z.literal("data"), key: z.string(), value: z.string().optional() }),
1863
- z.object({ type: z.literal("css"), value: z.string() }),
1864
- z.object({ type: z.literal("aria"), role: z.string().optional(), label: z.string().optional() }),
1865
- z.object({ type: z.literal("shadow-css"), value: z.string() }),
1866
- z.object({ type: z.literal("ref"), el: z.any() })
3156
+ import { z as z2 } from "zod";
3157
+ var SelectorZ = z2.union([
3158
+ z2.object({ type: z2.literal("data"), key: z2.string(), value: z2.string().optional() }),
3159
+ z2.object({ type: z2.literal("css"), value: z2.string() }),
3160
+ z2.object({ type: z2.literal("aria"), role: z2.string().optional(), label: z2.string().optional() }),
3161
+ z2.object({ type: z2.literal("shadow-css"), value: z2.string() }),
3162
+ z2.object({ type: z2.literal("ref"), el: z2.any() })
1867
3163
  // runtime-only
1868
3164
  ]);
1869
- var TooltipStepZ = z.object({
1870
- kind: z.literal("tooltip"),
1871
- id: z.string(),
3165
+ var TooltipStepZ = z2.object({
3166
+ kind: z2.literal("tooltip"),
3167
+ id: z2.string(),
1872
3168
  anchor: SelectorZ,
1873
- content: z.object({ title: z.string().optional(), body: z.string() }),
1874
- placement: z.enum(["top", "bottom", "left", "right", "auto"]).optional(),
1875
- offsetPx: z.number().optional(),
1876
- blocking: z.boolean().optional(),
1877
- trigger: z.enum(["immediate", "hover", "click"]).optional(),
1878
- dismiss: z.object({
1879
- onEsc: z.boolean().optional(),
1880
- closeButton: z.boolean().optional(),
1881
- timeoutMs: z.number().optional()
3169
+ content: z2.object({ title: z2.string().optional(), body: z2.string() }),
3170
+ placement: z2.enum(["top", "bottom", "left", "right", "auto"]).optional(),
3171
+ offsetPx: z2.number().optional(),
3172
+ blocking: z2.boolean().optional(),
3173
+ trigger: z2.enum(["immediate", "hover", "click"]).optional(),
3174
+ dismiss: z2.object({
3175
+ onEsc: z2.boolean().optional(),
3176
+ closeButton: z2.boolean().optional(),
3177
+ timeoutMs: z2.number().optional()
1882
3178
  }).optional()
1883
3179
  });
1884
- var HighlightStepZ = z.object({
1885
- kind: z.literal("highlight"),
1886
- id: z.string(),
3180
+ var HighlightStepZ = z2.object({
3181
+ kind: z2.literal("highlight"),
3182
+ id: z2.string(),
1887
3183
  anchor: SelectorZ,
1888
- copy: z.string().optional(),
1889
- ring: z.object({ paddingPx: z.number().optional(), radiusPx: z.number().optional() }).optional(),
1890
- scrim: z.object({ opacity: z.number().optional() }).optional(),
1891
- ringColor: z.string().optional(),
1892
- blocking: z.boolean().optional(),
1893
- dismiss: z.object({
1894
- onClickOutside: z.boolean().optional(),
1895
- onEsc: z.boolean().optional(),
1896
- timeoutMs: z.number().optional()
3184
+ copy: z2.string().optional(),
3185
+ ring: z2.object({ paddingPx: z2.number().optional(), radiusPx: z2.number().optional() }).optional(),
3186
+ scrim: z2.object({ opacity: z2.number().optional() }).optional(),
3187
+ ringColor: z2.string().optional(),
3188
+ blocking: z2.boolean().optional(),
3189
+ dismiss: z2.object({
3190
+ onClickOutside: z2.boolean().optional(),
3191
+ onEsc: z2.boolean().optional(),
3192
+ timeoutMs: z2.number().optional()
1897
3193
  }).optional()
1898
3194
  });
1899
- var CanvasRecipeZ = z.object({
1900
- id: z.string(),
1901
- version: z.number(),
1902
- routes: z.array(z.string()).optional(),
1903
- steps: z.array(z.union([TooltipStepZ, HighlightStepZ]))
3195
+ var CanvasRecipeZ = z2.object({
3196
+ id: z2.string(),
3197
+ version: z2.number(),
3198
+ routes: z2.array(z2.string()).optional(),
3199
+ steps: z2.array(z2.union([TooltipStepZ, HighlightStepZ]))
1904
3200
  });
1905
3201
  function validateRecipe(json) {
1906
3202
  return CanvasRecipeZ.parse(json);
@@ -1943,47 +3239,47 @@ function SmartCanvasPortal({ element, children }) {
1943
3239
  }
1944
3240
 
1945
3241
  // src/context/schema.ts
1946
- import { z as z2 } from "zod";
1947
- var PageContextZ = z2.object({
1948
- url: z2.string(),
1949
- routeId: z2.string().optional(),
1950
- title: z2.string().optional(),
1951
- locale: z2.string().optional()
3242
+ import { z as z3 } from "zod";
3243
+ var PageContextZ = z3.object({
3244
+ url: z3.string(),
3245
+ routeId: z3.string().optional(),
3246
+ title: z3.string().optional(),
3247
+ locale: z3.string().optional()
1952
3248
  });
1953
- var PageHistoryEntryZ = z2.object({
1954
- url: z2.string(),
1955
- ts: z2.number()
3249
+ var PageHistoryEntryZ = z3.object({
3250
+ url: z3.string(),
3251
+ ts: z3.number()
1956
3252
  });
1957
- var SessionContextZ = z2.object({
1958
- sessionId: z2.string(),
1959
- startTs: z2.number(),
1960
- pageHistory: z2.array(PageHistoryEntryZ).optional()
3253
+ var SessionContextZ = z3.object({
3254
+ sessionId: z3.string(),
3255
+ startTs: z3.number(),
3256
+ pageHistory: z3.array(PageHistoryEntryZ).optional()
1961
3257
  });
1962
- var ViewportContextZ = z2.object({
1963
- width: z2.number(),
1964
- height: z2.number()
3258
+ var ViewportContextZ = z3.object({
3259
+ width: z3.number(),
3260
+ height: z3.number()
1965
3261
  });
1966
- var BoundingBoxZ = z2.object({
1967
- x: z2.number(),
1968
- y: z2.number(),
1969
- w: z2.number(),
1970
- h: z2.number()
3262
+ var BoundingBoxZ = z3.object({
3263
+ x: z3.number(),
3264
+ y: z3.number(),
3265
+ w: z3.number(),
3266
+ h: z3.number()
1971
3267
  });
1972
- var AnchorStateZ = z2.object({
1973
- anchorId: z2.string(),
1974
- present: z2.boolean(),
1975
- visible: z2.boolean().optional(),
3268
+ var AnchorStateZ = z3.object({
3269
+ anchorId: z3.string(),
3270
+ present: z3.boolean(),
3271
+ visible: z3.boolean().optional(),
1976
3272
  boundingBox: BoundingBoxZ.optional()
1977
3273
  });
1978
- var AugmentationZ = z2.record(
1979
- z2.string(),
1980
- z2.union([z2.number(), z2.string(), z2.boolean(), z2.undefined()])
3274
+ var AugmentationZ = z3.record(
3275
+ z3.string(),
3276
+ z3.union([z3.number(), z3.string(), z3.boolean(), z3.undefined()])
1981
3277
  );
1982
- var RuntimeContextZ = z2.object({
3278
+ var RuntimeContextZ = z3.object({
1983
3279
  page: PageContextZ,
1984
3280
  session: SessionContextZ,
1985
3281
  viewport: ViewportContextZ,
1986
- anchors: z2.array(AnchorStateZ).optional(),
3282
+ anchors: z3.array(AnchorStateZ).optional(),
1987
3283
  augmented: AugmentationZ.optional()
1988
3284
  });
1989
3285
  function validateRuntimeContext(data) {
@@ -1991,19 +3287,19 @@ function validateRuntimeContext(data) {
1991
3287
  }
1992
3288
 
1993
3289
  // src/events/schema.ts
1994
- import { z as z3 } from "zod";
1995
- var EventSourceZ = z3.enum(["posthog", "canvas", "derived"]);
1996
- var NormalizedEventZ = z3.object({
1997
- ts: z3.number(),
1998
- name: z3.string(),
3290
+ import { z as z4 } from "zod";
3291
+ var EventSourceZ = z4.enum(["posthog", "canvas", "derived"]);
3292
+ var NormalizedEventZ = z4.object({
3293
+ ts: z4.number(),
3294
+ name: z4.string(),
1999
3295
  source: EventSourceZ,
2000
- props: z3.record(z3.string(), z3.unknown()).optional(),
2001
- schemaVersion: z3.string()
3296
+ props: z4.record(z4.string(), z4.unknown()).optional(),
3297
+ schemaVersion: z4.string()
2002
3298
  });
2003
- var EventFilterZ = z3.object({
2004
- names: z3.array(z3.string()).optional(),
2005
- patterns: z3.array(z3.string()).optional(),
2006
- sources: z3.array(EventSourceZ).optional()
3299
+ var EventFilterZ = z4.object({
3300
+ names: z4.array(z4.string()).optional(),
3301
+ patterns: z4.array(z4.string()).optional(),
3302
+ sources: z4.array(EventSourceZ).optional()
2007
3303
  });
2008
3304
  function validateNormalizedEvent(data) {
2009
3305
  return NormalizedEventZ.safeParse(data);
@@ -2013,14 +3309,14 @@ function validateEventFilter(data) {
2013
3309
  }
2014
3310
 
2015
3311
  // src/state/schema.ts
2016
- import { z as z4 } from "zod";
2017
- var StoredValueZ = z4.object({
2018
- value: z4.unknown(),
2019
- expiresAt: z4.number().optional()
3312
+ import { z as z5 } from "zod";
3313
+ var StoredValueZ = z5.object({
3314
+ value: z5.unknown(),
3315
+ expiresAt: z5.number().optional()
2020
3316
  });
2021
- var FrequencyEntryZ = z4.object({
2022
- count: z4.number(),
2023
- resetAt: z4.number().optional()
3317
+ var FrequencyEntryZ = z5.object({
3318
+ count: z5.number(),
3319
+ resetAt: z5.number().optional()
2024
3320
  });
2025
3321
  function validateStoredValue(data) {
2026
3322
  return StoredValueZ.safeParse(data);
@@ -2071,6 +3367,7 @@ export {
2071
3367
  EventBus,
2072
3368
  EventCountConditionZ,
2073
3369
  EventFilterZ,
3370
+ EventHistory,
2074
3371
  EventOccurredConditionZ,
2075
3372
  EventSourceZ,
2076
3373
  ExecutorRegistry,
@@ -2224,8 +3521,10 @@ export {
2224
3521
  validateCondition,
2225
3522
  validateConfig,
2226
3523
  validateEventFilter,
3524
+ validateEventName,
2227
3525
  validateFrequencyEntry,
2228
3526
  validateNormalizedEvent,
3527
+ validateProps,
2229
3528
  validateRecipe,
2230
3529
  validateRuntimeContext,
2231
3530
  validateStoredValue,