@liip/liipgpt 3.10.0 → 3.11.0

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 (40) hide show
  1. package/chat/liipgpt-chat.iife.js +1 -1
  2. package/chat/liipgpt-chat.js +1 -1
  3. package/config/index.cjs +1 -0
  4. package/config/index.d.ts +30 -0
  5. package/config/index.js +1 -0
  6. package/configurator/_app/env.js +1 -1
  7. package/configurator/_app/immutable/chunks/{DoB1D_8H.js → B1_pfFrT.js} +1 -1
  8. package/configurator/_app/immutable/chunks/{CQKQgM16.js → B7XnzOtp.js} +1 -1
  9. package/configurator/_app/immutable/chunks/{C3nFRFkd.js → BCwS08XI.js} +2 -2
  10. package/configurator/_app/immutable/chunks/{DkBX8x2a.js → BJUZhA68.js} +1 -1
  11. package/configurator/_app/immutable/chunks/{IH_3DU1Z.js → CMvCHhSP.js} +1 -1
  12. package/configurator/_app/immutable/chunks/{BE15eIcX.js → Ck-AVw0N.js} +2 -2
  13. package/configurator/_app/immutable/chunks/{DGoyvn3J.js → CzUbCS7s.js} +1 -1
  14. package/configurator/_app/immutable/chunks/{Bp2fQKa2.js → D-JCQPQm.js} +1 -1
  15. package/configurator/_app/immutable/chunks/D3wB30_g.js +1 -0
  16. package/configurator/_app/immutable/chunks/{cTsTcg30.js → DjnNQ9cM.js} +1 -1
  17. package/configurator/_app/immutable/chunks/{N6jOC-pH.js → ZTjVhqEP.js} +1 -1
  18. package/configurator/_app/immutable/chunks/{cZD35eXJ.js → _oGHvI2z.js} +1 -1
  19. package/configurator/_app/immutable/chunks/{C5-Xjgie.js → avJin-Fq.js} +1 -1
  20. package/configurator/_app/immutable/chunks/{DCaDs1kM.js → eDqi3535.js} +1 -1
  21. package/configurator/_app/immutable/chunks/{CehiXGW0.js → pHVM4a9g.js} +1 -1
  22. package/configurator/_app/immutable/chunks/s8dY_eYY.js +1 -0
  23. package/configurator/_app/immutable/entry/{app.C8tlSXPA.js → app.J7WXZUmQ.js} +2 -2
  24. package/configurator/_app/immutable/entry/start.BqxvRB3w.js +1 -0
  25. package/configurator/_app/immutable/nodes/{0.DCB0I300.js → 0.RUKKNLNS.js} +1 -1
  26. package/configurator/_app/immutable/nodes/{1.B1zFGe7K.js → 1.QacfMzbd.js} +1 -1
  27. package/configurator/_app/immutable/nodes/{2.CrdD7F_a.js → 2.B9VbxGZZ.js} +3 -3
  28. package/configurator/_app/immutable/nodes/{3.W2IWRGSL.js → 3.CIoPlU9V.js} +1 -1
  29. package/configurator/_app/version.json +1 -1
  30. package/configurator/index.html +6 -6
  31. package/configurator/sidebar.html +6 -6
  32. package/index.cjs +286 -281
  33. package/index.d.ts +114 -0
  34. package/index.js +285 -280
  35. package/package.json +1 -1
  36. package/search-summary/liipgpt-search-summary.iife.js +1 -1
  37. package/search-summary/liipgpt-search-summary.js +1 -1
  38. package/configurator/_app/immutable/chunks/BDBbhPa3.js +0 -1
  39. package/configurator/_app/immutable/chunks/Dgkk1Fhx.js +0 -1
  40. package/configurator/_app/immutable/entry/start.CuNeX-jt.js +0 -1
package/index.cjs CHANGED
@@ -18,7 +18,7 @@ var __toESM = (mod, isNodeMode, target) => {
18
18
  return cached;
19
19
  }
20
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
21
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
21
+ const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
22
  if (mod && typeof mod === "object" || typeof mod === "function") {
23
23
  for (let key of __getOwnPropNames(mod))
24
24
  if (!__hasOwnProp.call(to, key))
@@ -114,17 +114,17 @@ var {
114
114
  construct
115
115
  } = typeof Reflect !== "undefined" && Reflect;
116
116
  if (!freeze) {
117
- freeze = function freeze2(x) {
117
+ freeze = function freeze(x) {
118
118
  return x;
119
119
  };
120
120
  }
121
121
  if (!seal) {
122
- seal = function seal2(x) {
122
+ seal = function seal(x) {
123
123
  return x;
124
124
  };
125
125
  }
126
126
  if (!apply) {
127
- apply = function apply2(func, thisArg) {
127
+ apply = function apply(func, thisArg) {
128
128
  for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2;_key < _len; _key++) {
129
129
  args[_key - 2] = arguments[_key];
130
130
  }
@@ -132,7 +132,7 @@ if (!apply) {
132
132
  };
133
133
  }
134
134
  if (!construct) {
135
- construct = function construct2(Func) {
135
+ construct = function construct(Func) {
136
136
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1;_key2 < _len2; _key2++) {
137
137
  args[_key2 - 1] = arguments[_key2];
138
138
  }
@@ -284,10 +284,10 @@ var NODE_TYPE = {
284
284
  documentFragment: 11,
285
285
  notation: 12
286
286
  };
287
- var getGlobal = function getGlobal2() {
287
+ var getGlobal = function getGlobal() {
288
288
  return typeof window === "undefined" ? null : window;
289
289
  };
290
- var _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
290
+ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
291
291
  if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
292
292
  return null;
293
293
  }
@@ -299,8 +299,8 @@ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes
299
299
  const policyName = "dompurify" + (suffix ? "#" + suffix : "");
300
300
  try {
301
301
  return trustedTypes.createPolicy(policyName, {
302
- createHTML(html2) {
303
- return html2;
302
+ createHTML(html) {
303
+ return html;
304
304
  },
305
305
  createScriptURL(scriptUrl) {
306
306
  return scriptUrl;
@@ -311,7 +311,7 @@ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes
311
311
  return null;
312
312
  }
313
313
  };
314
- var _createHooksMap = function _createHooksMap2() {
314
+ var _createHooksMap = function _createHooksMap() {
315
315
  return {
316
316
  afterSanitizeAttributes: [],
317
317
  afterSanitizeElements: [],
@@ -375,14 +375,14 @@ function createDOMPurify() {
375
375
  let hooks = _createHooksMap();
376
376
  DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== undefined;
377
377
  const {
378
- MUSTACHE_EXPR: MUSTACHE_EXPR2,
379
- ERB_EXPR: ERB_EXPR2,
380
- TMPLIT_EXPR: TMPLIT_EXPR2,
381
- DATA_ATTR: DATA_ATTR2,
382
- ARIA_ATTR: ARIA_ATTR2,
383
- IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2,
384
- ATTR_WHITESPACE: ATTR_WHITESPACE2,
385
- CUSTOM_ELEMENT: CUSTOM_ELEMENT2
378
+ MUSTACHE_EXPR,
379
+ ERB_EXPR,
380
+ TMPLIT_EXPR,
381
+ DATA_ATTR,
382
+ ARIA_ATTR,
383
+ IS_SCRIPT_OR_DATA,
384
+ ATTR_WHITESPACE,
385
+ CUSTOM_ELEMENT
386
386
  } = EXPRESSIONS;
387
387
  let {
388
388
  IS_ALLOWED_URI: IS_ALLOWED_URI$1
@@ -467,10 +467,10 @@ function createDOMPurify() {
467
467
  let transformCaseFunc = null;
468
468
  let CONFIG = null;
469
469
  const formElement = document2.createElement("form");
470
- const isRegexOrFunction = function isRegexOrFunction2(testValue) {
470
+ const isRegexOrFunction = function isRegexOrFunction(testValue) {
471
471
  return testValue instanceof RegExp || testValue instanceof Function;
472
472
  };
473
- const _parseConfig = function _parseConfig2() {
473
+ const _parseConfig = function _parseConfig() {
474
474
  let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
475
475
  if (CONFIG && CONFIG === cfg) {
476
476
  return;
@@ -623,7 +623,7 @@ function createDOMPurify() {
623
623
  };
624
624
  const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
625
625
  const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
626
- const _checkValidNamespace = function _checkValidNamespace2(element) {
626
+ const _checkValidNamespace = function _checkValidNamespace(element) {
627
627
  let parent = getParentNode(element);
628
628
  if (!parent || !parent.tagName) {
629
629
  parent = {
@@ -668,7 +668,7 @@ function createDOMPurify() {
668
668
  }
669
669
  return false;
670
670
  };
671
- const _forceRemove = function _forceRemove2(node) {
671
+ const _forceRemove = function _forceRemove(node) {
672
672
  arrayPush(DOMPurify.removed, {
673
673
  element: node
674
674
  });
@@ -678,7 +678,7 @@ function createDOMPurify() {
678
678
  remove(node);
679
679
  }
680
680
  };
681
- const _removeAttribute = function _removeAttribute2(name, element) {
681
+ const _removeAttribute = function _removeAttribute(name, element) {
682
682
  try {
683
683
  arrayPush(DOMPurify.removed, {
684
684
  attribute: element.getAttributeNode(name),
@@ -703,7 +703,7 @@ function createDOMPurify() {
703
703
  }
704
704
  }
705
705
  };
706
- const _initDocument = function _initDocument2(dirty) {
706
+ const _initDocument = function _initDocument(dirty) {
707
707
  let doc = null;
708
708
  let leadingWhitespace = null;
709
709
  if (FORCE_BODY) {
@@ -736,21 +736,21 @@ function createDOMPurify() {
736
736
  }
737
737
  return WHOLE_DOCUMENT ? doc.documentElement : body;
738
738
  };
739
- const _createNodeIterator = function _createNodeIterator2(root) {
739
+ const _createNodeIterator = function _createNodeIterator(root) {
740
740
  return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
741
741
  };
742
- const _isClobbered = function _isClobbered2(element) {
742
+ const _isClobbered = function _isClobbered(element) {
743
743
  return element instanceof HTMLFormElement && (typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function");
744
744
  };
745
- const _isNode = function _isNode2(value) {
745
+ const _isNode = function _isNode(value) {
746
746
  return typeof Node2 === "function" && value instanceof Node2;
747
747
  };
748
- function _executeHooks(hooks2, currentNode, data) {
749
- arrayForEach(hooks2, (hook) => {
748
+ function _executeHooks(hooks, currentNode, data) {
749
+ arrayForEach(hooks, (hook) => {
750
750
  hook.call(DOMPurify, currentNode, data, CONFIG);
751
751
  });
752
752
  }
753
- const _sanitizeElements = function _sanitizeElements2(currentNode) {
753
+ const _sanitizeElements = function _sanitizeElements(currentNode) {
754
754
  let content = null;
755
755
  _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
756
756
  if (_isClobbered(currentNode)) {
@@ -808,7 +808,7 @@ function createDOMPurify() {
808
808
  }
809
809
  if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
810
810
  content = currentNode.textContent;
811
- arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
811
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], (expr) => {
812
812
  content = stringReplace(content, expr, " ");
813
813
  });
814
814
  if (currentNode.textContent !== content) {
@@ -821,16 +821,16 @@ function createDOMPurify() {
821
821
  _executeHooks(hooks.afterSanitizeElements, currentNode, null);
822
822
  return false;
823
823
  };
824
- const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
824
+ const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
825
825
  if (FORBID_ATTR[lcName]) {
826
826
  return false;
827
827
  }
828
828
  if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && ((value in document2) || (value in formElement))) {
829
829
  return false;
830
830
  }
831
- if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName))
831
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName))
832
832
  ;
833
- else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName))
833
+ else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName))
834
834
  ;
835
835
  else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag))
836
836
  ;
@@ -842,21 +842,21 @@ function createDOMPurify() {
842
842
  }
843
843
  } else if (URI_SAFE_ATTRIBUTES[lcName])
844
844
  ;
845
- else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE2, "")))
845
+ else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, "")))
846
846
  ;
847
847
  else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag])
848
848
  ;
849
- else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA2, stringReplace(value, ATTR_WHITESPACE2, "")))
849
+ else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, "")))
850
850
  ;
851
851
  else if (value) {
852
852
  return false;
853
853
  }
854
854
  return true;
855
855
  };
856
- const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
857
- return tagName !== "annotation-xml" && stringMatch(tagName, CUSTOM_ELEMENT2);
856
+ const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
857
+ return tagName !== "annotation-xml" && stringMatch(tagName, CUSTOM_ELEMENT);
858
858
  };
859
- const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
859
+ const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
860
860
  _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
861
861
  const {
862
862
  attributes
@@ -912,7 +912,7 @@ function createDOMPurify() {
912
912
  continue;
913
913
  }
914
914
  if (SAFE_FOR_TEMPLATES) {
915
- arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
915
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], (expr) => {
916
916
  value = stringReplace(value, expr, " ");
917
917
  });
918
918
  }
@@ -956,7 +956,7 @@ function createDOMPurify() {
956
956
  }
957
957
  _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
958
958
  };
959
- const _sanitizeShadowDOM = function _sanitizeShadowDOM2(fragment) {
959
+ const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
960
960
  let shadowNode = null;
961
961
  const shadowIterator = _createNodeIterator(fragment);
962
962
  _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
@@ -965,7 +965,7 @@ function createDOMPurify() {
965
965
  _sanitizeElements(shadowNode);
966
966
  _sanitizeAttributes(shadowNode);
967
967
  if (shadowNode.content instanceof DocumentFragment) {
968
- _sanitizeShadowDOM2(shadowNode.content);
968
+ _sanitizeShadowDOM(shadowNode.content);
969
969
  }
970
970
  }
971
971
  _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
@@ -1060,7 +1060,7 @@ function createDOMPurify() {
1060
1060
  ` + serializedHTML;
1061
1061
  }
1062
1062
  if (SAFE_FOR_TEMPLATES) {
1063
- arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
1063
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], (expr) => {
1064
1064
  serializedHTML = stringReplace(serializedHTML, expr, " ");
1065
1065
  });
1066
1066
  }
@@ -1337,17 +1337,17 @@ var escapeReplacements = {
1337
1337
  "'": "&#39;"
1338
1338
  };
1339
1339
  var getEscapeReplacement = (ch) => escapeReplacements[ch];
1340
- function escape2(html22, encode) {
1340
+ function escape2(html2, encode) {
1341
1341
  if (encode) {
1342
- if (other.escapeTest.test(html22)) {
1343
- return html22.replace(other.escapeReplace, getEscapeReplacement);
1342
+ if (other.escapeTest.test(html2)) {
1343
+ return html2.replace(other.escapeReplace, getEscapeReplacement);
1344
1344
  }
1345
1345
  } else {
1346
- if (other.escapeTestNoEncode.test(html22)) {
1347
- return html22.replace(other.escapeReplaceNoEncode, getEscapeReplacement);
1346
+ if (other.escapeTestNoEncode.test(html2)) {
1347
+ return html2.replace(other.escapeReplaceNoEncode, getEscapeReplacement);
1348
1348
  }
1349
1349
  }
1350
- return html22;
1350
+ return html2;
1351
1351
  }
1352
1352
  function cleanUrl(href) {
1353
1353
  try {
@@ -1432,26 +1432,26 @@ function findClosingBracket(str, b) {
1432
1432
  function outputLink(cap, link2, raw, lexer2, rules) {
1433
1433
  const href = link2.href;
1434
1434
  const title = link2.title || null;
1435
- const text2 = cap[1].replace(rules.other.outputLinkReplace, "$1");
1435
+ const text = cap[1].replace(rules.other.outputLinkReplace, "$1");
1436
1436
  lexer2.state.inLink = true;
1437
1437
  const token = {
1438
1438
  type: cap[0].charAt(0) === "!" ? "image" : "link",
1439
1439
  raw,
1440
1440
  href,
1441
1441
  title,
1442
- text: text2,
1443
- tokens: lexer2.inlineTokens(text2)
1442
+ text,
1443
+ tokens: lexer2.inlineTokens(text)
1444
1444
  };
1445
1445
  lexer2.state.inLink = false;
1446
1446
  return token;
1447
1447
  }
1448
- function indentCodeCompensation(raw, text2, rules) {
1448
+ function indentCodeCompensation(raw, text, rules) {
1449
1449
  const matchIndentToCode = raw.match(rules.other.indentCodeCompensation);
1450
1450
  if (matchIndentToCode === null) {
1451
- return text2;
1451
+ return text;
1452
1452
  }
1453
1453
  const indentToCode = matchIndentToCode[1];
1454
- return text2.split(`
1454
+ return text.split(`
1455
1455
  `).map((node) => {
1456
1456
  const matchIndentInNode = node.match(rules.other.beginningSpace);
1457
1457
  if (matchIndentInNode === null) {
@@ -1484,13 +1484,13 @@ var _Tokenizer = class {
1484
1484
  code(src) {
1485
1485
  const cap = this.rules.block.code.exec(src);
1486
1486
  if (cap) {
1487
- const text2 = cap[0].replace(this.rules.other.codeRemoveIndent, "");
1487
+ const text = cap[0].replace(this.rules.other.codeRemoveIndent, "");
1488
1488
  return {
1489
1489
  type: "code",
1490
1490
  raw: cap[0],
1491
1491
  codeBlockStyle: "indented",
1492
- text: !this.options.pedantic ? rtrim(text2, `
1493
- `) : text2
1492
+ text: !this.options.pedantic ? rtrim(text, `
1493
+ `) : text
1494
1494
  };
1495
1495
  }
1496
1496
  }
@@ -1498,33 +1498,33 @@ var _Tokenizer = class {
1498
1498
  const cap = this.rules.block.fences.exec(src);
1499
1499
  if (cap) {
1500
1500
  const raw = cap[0];
1501
- const text2 = indentCodeCompensation(raw, cap[3] || "", this.rules);
1501
+ const text = indentCodeCompensation(raw, cap[3] || "", this.rules);
1502
1502
  return {
1503
1503
  type: "code",
1504
1504
  raw,
1505
1505
  lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : cap[2],
1506
- text: text2
1506
+ text
1507
1507
  };
1508
1508
  }
1509
1509
  }
1510
1510
  heading(src) {
1511
1511
  const cap = this.rules.block.heading.exec(src);
1512
1512
  if (cap) {
1513
- let text2 = cap[2].trim();
1514
- if (this.rules.other.endingHash.test(text2)) {
1515
- const trimmed = rtrim(text2, "#");
1513
+ let text = cap[2].trim();
1514
+ if (this.rules.other.endingHash.test(text)) {
1515
+ const trimmed = rtrim(text, "#");
1516
1516
  if (this.options.pedantic) {
1517
- text2 = trimmed.trim();
1517
+ text = trimmed.trim();
1518
1518
  } else if (!trimmed || this.rules.other.endingSpaceChar.test(trimmed)) {
1519
- text2 = trimmed.trim();
1519
+ text = trimmed.trim();
1520
1520
  }
1521
1521
  }
1522
1522
  return {
1523
1523
  type: "heading",
1524
1524
  raw: cap[0],
1525
1525
  depth: cap[1].length,
1526
- text: text2,
1527
- tokens: this.lexer.inline(text2)
1526
+ text,
1527
+ tokens: this.lexer.inline(text)
1528
1528
  };
1529
1529
  }
1530
1530
  }
@@ -1545,7 +1545,7 @@ var _Tokenizer = class {
1545
1545
  `).split(`
1546
1546
  `);
1547
1547
  let raw = "";
1548
- let text2 = "";
1548
+ let text = "";
1549
1549
  const tokens = [];
1550
1550
  while (lines.length > 0) {
1551
1551
  let inBlockquote = false;
@@ -1568,7 +1568,7 @@ var _Tokenizer = class {
1568
1568
  $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
1569
1569
  raw = raw ? `${raw}
1570
1570
  ${currentRaw}` : currentRaw;
1571
- text2 = text2 ? `${text2}
1571
+ text = text ? `${text}
1572
1572
  ${currentText}` : currentText;
1573
1573
  const top = this.lexer.state.top;
1574
1574
  this.lexer.state.top = true;
@@ -1588,7 +1588,7 @@ ${currentText}` : currentText;
1588
1588
  const newToken = this.blockquote(newText);
1589
1589
  tokens[tokens.length - 1] = newToken;
1590
1590
  raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;
1591
- text2 = text2.substring(0, text2.length - oldToken.text.length) + newToken.text;
1591
+ text = text.substring(0, text.length - oldToken.text.length) + newToken.text;
1592
1592
  break;
1593
1593
  } else if (lastToken?.type === "list") {
1594
1594
  const oldToken = lastToken;
@@ -1598,7 +1598,7 @@ ${currentText}` : currentText;
1598
1598
  const newToken = this.list(newText);
1599
1599
  tokens[tokens.length - 1] = newToken;
1600
1600
  raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;
1601
- text2 = text2.substring(0, text2.length - oldToken.raw.length) + newToken.raw;
1601
+ text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;
1602
1602
  lines = newText.substring(tokens.at(-1).raw.length).split(`
1603
1603
  `);
1604
1604
  continue;
@@ -1608,7 +1608,7 @@ ${currentText}` : currentText;
1608
1608
  type: "blockquote",
1609
1609
  raw,
1610
1610
  tokens,
1611
- text: text2
1611
+ text
1612
1612
  };
1613
1613
  }
1614
1614
  }
@@ -1877,13 +1877,13 @@ ${currentText}` : currentText;
1877
1877
  paragraph(src) {
1878
1878
  const cap = this.rules.block.paragraph.exec(src);
1879
1879
  if (cap) {
1880
- const text2 = cap[1].charAt(cap[1].length - 1) === `
1880
+ const text = cap[1].charAt(cap[1].length - 1) === `
1881
1881
  ` ? cap[1].slice(0, -1) : cap[1];
1882
1882
  return {
1883
1883
  type: "paragraph",
1884
1884
  raw: cap[0],
1885
- text: text2,
1886
- tokens: this.lexer.inline(text2)
1885
+ text,
1886
+ tokens: this.lexer.inline(text)
1887
1887
  };
1888
1888
  }
1889
1889
  }
@@ -1987,11 +1987,11 @@ ${currentText}` : currentText;
1987
1987
  const linkString = (cap[2] || cap[1]).replace(this.rules.other.multipleSpaceGlobal, " ");
1988
1988
  const link2 = links[linkString.toLowerCase()];
1989
1989
  if (!link2) {
1990
- const text2 = cap[0].charAt(0);
1990
+ const text = cap[0].charAt(0);
1991
1991
  return {
1992
1992
  type: "text",
1993
- raw: text2,
1994
- text: text2
1993
+ raw: text,
1994
+ text
1995
1995
  };
1996
1996
  }
1997
1997
  return outputLink(cap, link2, cap[0], this.lexer, this.rules);
@@ -2031,20 +2031,20 @@ ${currentText}` : currentText;
2031
2031
  const lastCharLength = [...match[0]][0].length;
2032
2032
  const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
2033
2033
  if (Math.min(lLength, rLength) % 2) {
2034
- const text22 = raw.slice(1, -1);
2034
+ const text2 = raw.slice(1, -1);
2035
2035
  return {
2036
2036
  type: "em",
2037
2037
  raw,
2038
- text: text22,
2039
- tokens: this.lexer.inlineTokens(text22)
2038
+ text: text2,
2039
+ tokens: this.lexer.inlineTokens(text2)
2040
2040
  };
2041
2041
  }
2042
- const text2 = raw.slice(2, -2);
2042
+ const text = raw.slice(2, -2);
2043
2043
  return {
2044
2044
  type: "strong",
2045
2045
  raw,
2046
- text: text2,
2047
- tokens: this.lexer.inlineTokens(text2)
2046
+ text,
2047
+ tokens: this.lexer.inlineTokens(text)
2048
2048
  };
2049
2049
  }
2050
2050
  }
@@ -2052,16 +2052,16 @@ ${currentText}` : currentText;
2052
2052
  codespan(src) {
2053
2053
  const cap = this.rules.inline.code.exec(src);
2054
2054
  if (cap) {
2055
- let text2 = cap[2].replace(this.rules.other.newLineCharGlobal, " ");
2056
- const hasNonSpaceChars = this.rules.other.nonSpaceChar.test(text2);
2057
- const hasSpaceCharsOnBothEnds = this.rules.other.startingSpaceChar.test(text2) && this.rules.other.endingSpaceChar.test(text2);
2055
+ let text = cap[2].replace(this.rules.other.newLineCharGlobal, " ");
2056
+ const hasNonSpaceChars = this.rules.other.nonSpaceChar.test(text);
2057
+ const hasSpaceCharsOnBothEnds = this.rules.other.startingSpaceChar.test(text) && this.rules.other.endingSpaceChar.test(text);
2058
2058
  if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
2059
- text2 = text2.substring(1, text2.length - 1);
2059
+ text = text.substring(1, text.length - 1);
2060
2060
  }
2061
2061
  return {
2062
2062
  type: "codespan",
2063
2063
  raw: cap[0],
2064
- text: text2
2064
+ text
2065
2065
  };
2066
2066
  }
2067
2067
  }
@@ -2088,24 +2088,24 @@ ${currentText}` : currentText;
2088
2088
  autolink(src) {
2089
2089
  const cap = this.rules.inline.autolink.exec(src);
2090
2090
  if (cap) {
2091
- let text2, href;
2091
+ let text, href;
2092
2092
  if (cap[2] === "@") {
2093
- text2 = cap[1];
2094
- href = "mailto:" + text2;
2093
+ text = cap[1];
2094
+ href = "mailto:" + text;
2095
2095
  } else {
2096
- text2 = cap[1];
2097
- href = text2;
2096
+ text = cap[1];
2097
+ href = text;
2098
2098
  }
2099
2099
  return {
2100
2100
  type: "link",
2101
2101
  raw: cap[0],
2102
- text: text2,
2102
+ text,
2103
2103
  href,
2104
2104
  tokens: [
2105
2105
  {
2106
2106
  type: "text",
2107
- raw: text2,
2108
- text: text2
2107
+ raw: text,
2108
+ text
2109
2109
  }
2110
2110
  ]
2111
2111
  };
@@ -2114,17 +2114,17 @@ ${currentText}` : currentText;
2114
2114
  url(src) {
2115
2115
  let cap;
2116
2116
  if (cap = this.rules.inline.url.exec(src)) {
2117
- let text2, href;
2117
+ let text, href;
2118
2118
  if (cap[2] === "@") {
2119
- text2 = cap[0];
2120
- href = "mailto:" + text2;
2119
+ text = cap[0];
2120
+ href = "mailto:" + text;
2121
2121
  } else {
2122
2122
  let prevCapZero;
2123
2123
  do {
2124
2124
  prevCapZero = cap[0];
2125
2125
  cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? "";
2126
2126
  } while (prevCapZero !== cap[0]);
2127
- text2 = cap[0];
2127
+ text = cap[0];
2128
2128
  if (cap[1] === "www.") {
2129
2129
  href = "http://" + cap[0];
2130
2130
  } else {
@@ -2134,13 +2134,13 @@ ${currentText}` : currentText;
2134
2134
  return {
2135
2135
  type: "link",
2136
2136
  raw: cap[0],
2137
- text: text2,
2137
+ text,
2138
2138
  href,
2139
2139
  tokens: [
2140
2140
  {
2141
2141
  type: "text",
2142
- raw: text2,
2143
- text: text2
2142
+ raw: text,
2143
+ text
2144
2144
  }
2145
2145
  ]
2146
2146
  };
@@ -2528,9 +2528,9 @@ var _Renderer = class {
2528
2528
  space(token) {
2529
2529
  return "";
2530
2530
  }
2531
- code({ text: text2, lang, escaped }) {
2531
+ code({ text, lang, escaped }) {
2532
2532
  const langString = (lang || "").match(other.notSpaceStart)?.[0];
2533
- const code = text2.replace(other.endingNewline, "") + `
2533
+ const code = text.replace(other.endingNewline, "") + `
2534
2534
  `;
2535
2535
  if (!langString) {
2536
2536
  return "<pre><code>" + (escaped ? code : escape2(code, true)) + `</code></pre>
@@ -2545,8 +2545,8 @@ var _Renderer = class {
2545
2545
  ${body}</blockquote>
2546
2546
  `;
2547
2547
  }
2548
- html({ text: text2 }) {
2549
- return text2;
2548
+ html({ text }) {
2549
+ return text;
2550
2550
  }
2551
2551
  heading({ tokens, depth }) {
2552
2552
  return `<h${depth}>${this.parser.parseInline(tokens)}</h${depth}>
@@ -2628,9 +2628,9 @@ ${body}</blockquote>
2628
2628
  ` + body + `</table>
2629
2629
  `;
2630
2630
  }
2631
- tablerow({ text: text2 }) {
2631
+ tablerow({ text }) {
2632
2632
  return `<tr>
2633
- ${text2}</tr>
2633
+ ${text}</tr>
2634
2634
  `;
2635
2635
  }
2636
2636
  tablecell(token) {
@@ -2646,8 +2646,8 @@ ${text2}</tr>
2646
2646
  em({ tokens }) {
2647
2647
  return `<em>${this.parser.parseInline(tokens)}</em>`;
2648
2648
  }
2649
- codespan({ text: text2 }) {
2650
- return `<code>${escape2(text2, true)}</code>`;
2649
+ codespan({ text }) {
2650
+ return `<code>${escape2(text, true)}</code>`;
2651
2651
  }
2652
2652
  br(token) {
2653
2653
  return "<br>";
@@ -2656,29 +2656,29 @@ ${text2}</tr>
2656
2656
  return `<del>${this.parser.parseInline(tokens)}</del>`;
2657
2657
  }
2658
2658
  link({ href, title, tokens }) {
2659
- const text2 = this.parser.parseInline(tokens);
2659
+ const text = this.parser.parseInline(tokens);
2660
2660
  const cleanHref = cleanUrl(href);
2661
2661
  if (cleanHref === null) {
2662
- return text2;
2662
+ return text;
2663
2663
  }
2664
2664
  href = cleanHref;
2665
2665
  let out = '<a href="' + href + '"';
2666
2666
  if (title) {
2667
2667
  out += ' title="' + escape2(title) + '"';
2668
2668
  }
2669
- out += ">" + text2 + "</a>";
2669
+ out += ">" + text + "</a>";
2670
2670
  return out;
2671
2671
  }
2672
- image({ href, title, text: text2, tokens }) {
2672
+ image({ href, title, text, tokens }) {
2673
2673
  if (tokens) {
2674
- text2 = this.parser.parseInline(tokens, this.parser.textRenderer);
2674
+ text = this.parser.parseInline(tokens, this.parser.textRenderer);
2675
2675
  }
2676
2676
  const cleanHref = cleanUrl(href);
2677
2677
  if (cleanHref === null) {
2678
- return escape2(text2);
2678
+ return escape2(text);
2679
2679
  }
2680
2680
  href = cleanHref;
2681
- let out = `<img src="${href}" alt="${text2}"`;
2681
+ let out = `<img src="${href}" alt="${text}"`;
2682
2682
  if (title) {
2683
2683
  out += ` title="${escape2(title)}"`;
2684
2684
  }
@@ -2690,29 +2690,29 @@ ${text2}</tr>
2690
2690
  }
2691
2691
  };
2692
2692
  var _TextRenderer = class {
2693
- strong({ text: text2 }) {
2694
- return text2;
2693
+ strong({ text }) {
2694
+ return text;
2695
2695
  }
2696
- em({ text: text2 }) {
2697
- return text2;
2696
+ em({ text }) {
2697
+ return text;
2698
2698
  }
2699
- codespan({ text: text2 }) {
2700
- return text2;
2699
+ codespan({ text }) {
2700
+ return text;
2701
2701
  }
2702
- del({ text: text2 }) {
2703
- return text2;
2702
+ del({ text }) {
2703
+ return text;
2704
2704
  }
2705
- html({ text: text2 }) {
2706
- return text2;
2705
+ html({ text }) {
2706
+ return text;
2707
2707
  }
2708
- text({ text: text2 }) {
2709
- return text2;
2708
+ text({ text }) {
2709
+ return text;
2710
2710
  }
2711
- link({ text: text2 }) {
2712
- return "" + text2;
2711
+ link({ text }) {
2712
+ return "" + text;
2713
2713
  }
2714
- image({ text: text2 }) {
2715
- return "" + text2;
2714
+ image({ text }) {
2715
+ return "" + text;
2716
2716
  }
2717
2717
  br() {
2718
2718
  return "";
@@ -2902,8 +2902,8 @@ var _Hooks = class {
2902
2902
  preprocess(markdown) {
2903
2903
  return markdown;
2904
2904
  }
2905
- postprocess(html22) {
2906
- return html22;
2905
+ postprocess(html2) {
2906
+ return html2;
2907
2907
  }
2908
2908
  processAllTokens(tokens) {
2909
2909
  return tokens;
@@ -3147,7 +3147,7 @@ var Marked = class {
3147
3147
  const lexer2 = opt.hooks ? opt.hooks.provideLexer() : blockType ? _Lexer.lex : _Lexer.lexInline;
3148
3148
  const parser2 = opt.hooks ? opt.hooks.provideParser() : blockType ? _Parser.parse : _Parser.parseInline;
3149
3149
  if (opt.async) {
3150
- return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser2(tokens, opt)).then((html22) => opt.hooks ? opt.hooks.postprocess(html22) : html22).catch(throwError);
3150
+ return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser2(tokens, opt)).then((html2) => opt.hooks ? opt.hooks.postprocess(html2) : html2).catch(throwError);
3151
3151
  }
3152
3152
  try {
3153
3153
  if (opt.hooks) {
@@ -3160,11 +3160,11 @@ var Marked = class {
3160
3160
  if (opt.walkTokens) {
3161
3161
  this.walkTokens(tokens, opt.walkTokens);
3162
3162
  }
3163
- let html22 = parser2(tokens, opt);
3163
+ let html2 = parser2(tokens, opt);
3164
3164
  if (opt.hooks) {
3165
- html22 = opt.hooks.postprocess(html22);
3165
+ html2 = opt.hooks.postprocess(html2);
3166
3166
  }
3167
- return html22;
3167
+ return html2;
3168
3168
  } catch (e) {
3169
3169
  return throwError(e);
3170
3170
  }
@@ -3273,9 +3273,9 @@ class MarkdownRenderer {
3273
3273
  currentReferences = emptyChatReferences;
3274
3274
  lastUsedIndex = 0;
3275
3275
  DomPurity;
3276
- constructor(options2 = {}) {
3277
- this.marked = new Marked({ async: false, breaks: true }).use(this.createFootnoteExtension(), ...options2.extensions ?? []);
3278
- this.DomPurity = getDomPurify(options2.window, options2.newTabSrText);
3276
+ constructor(options = {}) {
3277
+ this.marked = new Marked({ async: false, breaks: true }).use(this.createFootnoteExtension(), ...options.extensions ?? []);
3278
+ this.DomPurity = getDomPurify(options.window, options.newTabSrText);
3279
3279
  }
3280
3280
  createFootnoteExtension = () => {
3281
3281
  const self = this;
@@ -3285,10 +3285,10 @@ class MarkdownRenderer {
3285
3285
  name: "footnote",
3286
3286
  level: "inline",
3287
3287
  start(src) {
3288
- return src.match(/\[\^(\d+)\]/)?.index;
3288
+ return src.match(/\[\^(\d+(?:\.\d+)?)\]/)?.index;
3289
3289
  },
3290
3290
  tokenizer(src) {
3291
- const rule = /^\[\^(\d+)\]/;
3291
+ const rule = /^\[\^(\d+(?:\.\d+)?)\]/;
3292
3292
  const match = rule.exec(src);
3293
3293
  if (match) {
3294
3294
  const [full, refNumber] = match;
@@ -3301,10 +3301,12 @@ class MarkdownRenderer {
3301
3301
  },
3302
3302
  renderer(token) {
3303
3303
  if (token.type === "footnote") {
3304
- const refIndex = parseInt(token.refNumber) - 1;
3304
+ const refs = self.currentReferences.all;
3305
+ const hasIds = refs.some((reference) => reference.citationId !== undefined);
3306
+ const refIndex = hasIds ? refs.findIndex((reference) => reference.citationId === token.refNumber) : /^\d+$/.test(token.refNumber) ? Number(token.refNumber) - 1 : -1;
3305
3307
  const currentReference = self.currentReferences.all[refIndex];
3306
3308
  if (!currentReference) {
3307
- console.error("Could not find ref with index:", refIndex);
3309
+ console.error("Could not find ref for citation:", token.refNumber);
3308
3310
  return "";
3309
3311
  }
3310
3312
  let usedIndex;
@@ -3332,9 +3334,9 @@ class MarkdownRenderer {
3332
3334
  }
3333
3335
  toHTML(markdown, references) {
3334
3336
  this.currentReferences = references;
3335
- const html3 = this.parse(markdown);
3337
+ const html = this.parse(markdown);
3336
3338
  this.currentReferences = emptyChatReferences;
3337
- return html3;
3339
+ return html;
3338
3340
  }
3339
3341
  }
3340
3342
  // node_modules/.bun/esm-env@1.2.2/node_modules/esm-env/true.js
@@ -3431,7 +3433,7 @@ var subscriber_queue = [];
3431
3433
  function writable(value, start = noop) {
3432
3434
  let stop = null;
3433
3435
  const subscribers = new Set;
3434
- function set2(new_value) {
3436
+ function set(new_value) {
3435
3437
  if (safe_not_equal(value, new_value)) {
3436
3438
  value = new_value;
3437
3439
  if (stop) {
@@ -3450,13 +3452,13 @@ function writable(value, start = noop) {
3450
3452
  }
3451
3453
  }
3452
3454
  function update(fn) {
3453
- set2(fn(value));
3455
+ set(fn(value));
3454
3456
  }
3455
3457
  function subscribe(run, invalidate = noop) {
3456
3458
  const subscriber = [run, invalidate];
3457
3459
  subscribers.add(subscriber);
3458
3460
  if (subscribers.size === 1) {
3459
- stop = start(set2, update) || noop;
3461
+ stop = start(set, update) || noop;
3460
3462
  }
3461
3463
  run(value);
3462
3464
  return () => {
@@ -3467,7 +3469,7 @@ function writable(value, start = noop) {
3467
3469
  }
3468
3470
  };
3469
3471
  }
3470
- return { set: set2, update, subscribe };
3472
+ return { set, update, subscribe };
3471
3473
  }
3472
3474
 
3473
3475
  // node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/store.js
@@ -3568,13 +3570,14 @@ var getDomainName = (url) => {
3568
3570
  };
3569
3571
 
3570
3572
  // src/lib/client/utils/html-to-text.ts
3571
- function htmlToText(html3) {
3572
- const text2 = html3.replace(/<[^>]*>/g, "").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"');
3573
- return text2;
3573
+ function htmlToText(html) {
3574
+ const text = html.replace(/<[^>]*>/g, "").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"');
3575
+ return text;
3574
3576
  }
3575
3577
 
3576
3578
  // src/lib/client/chat-result-builder.ts
3577
3579
  var mapSseReference = ({
3580
+ citationId,
3578
3581
  url,
3579
3582
  considered,
3580
3583
  title,
@@ -3584,6 +3587,7 @@ var mapSseReference = ({
3584
3587
  const domainName = getDomainName(url);
3585
3588
  const desc = description || summary;
3586
3589
  return {
3590
+ ...citationId ? { citationId } : {},
3587
3591
  url,
3588
3592
  considered,
3589
3593
  referenceIndex: {},
@@ -3608,17 +3612,17 @@ class ChatResultBuilder {
3608
3612
  store;
3609
3613
  content = new FutureValue;
3610
3614
  backendSendsMappedRefs = false;
3611
- constructor(options2) {
3612
- this.options = options2;
3615
+ constructor(options) {
3616
+ this.options = options;
3613
3617
  this.store = writable({
3614
- id: options2.id,
3618
+ id: options.id,
3615
3619
  state: "loading",
3616
3620
  errors: [],
3617
3621
  type: "bot",
3618
3622
  time: new Date().toISOString(),
3619
3623
  message: { markdown: "", html: "", text: "" },
3620
3624
  references: { all: [], used: [], unused: [] },
3621
- retrievalQuestion: options2.userQuestion
3625
+ retrievalQuestion: options.userQuestion
3622
3626
  });
3623
3627
  }
3624
3628
  pushError(error) {
@@ -3631,14 +3635,14 @@ class ChatResultBuilder {
3631
3635
  id
3632
3636
  }));
3633
3637
  }
3634
- updateText(text2) {
3638
+ updateText(text) {
3635
3639
  this.store.update((current) => {
3636
- const nextMarkdown = current.message.markdown + text2;
3637
- const html3 = this.options.markdownRenderer.toHTML(nextMarkdown, current.references);
3640
+ const nextMarkdown = current.message.markdown + text;
3641
+ const html = this.options.markdownRenderer.toHTML(nextMarkdown, current.references);
3638
3642
  return {
3639
3643
  ...current,
3640
3644
  state: "streaming",
3641
- message: { markdown: nextMarkdown, html: html3, text: "" }
3645
+ message: { markdown: nextMarkdown, html, text: "" }
3642
3646
  };
3643
3647
  });
3644
3648
  }
@@ -3773,8 +3777,8 @@ class Conversation {
3773
3777
  subscribe(callback) {
3774
3778
  return this.state.subscribe(callback);
3775
3779
  }
3776
- chat(question, options2 = {}) {
3777
- const chatResponse = this.clientPrimitive.chat(this.id, question, options2);
3780
+ chat(question, options = {}) {
3781
+ const chatResponse = this.clientPrimitive.chat(this.id, question, options);
3778
3782
  this.history.push(chatResponse);
3779
3783
  this.latestRequest.setValue({ question, response: chatResponse });
3780
3784
  return chatResponse;
@@ -4096,6 +4100,7 @@ var chatMessageUserSchema = import_mini4.z.object({
4096
4100
  var conversationStateSchema = import_mini4.z.enum(["idle", "searching", "answering"]);
4097
4101
  var metadataValueSchema2 = import_mini4.z.union([import_mini4.z.string(), import_mini4.z.number(), import_mini4.z.boolean(), import_mini4.z.array(import_mini4.z.string()), import_mini4.z.array(import_mini4.z.number()), import_mini4.z.array(import_mini4.z.boolean())]);
4098
4102
  var chatReferenceSchema = import_mini4.z.object({
4103
+ citationId: import_mini4.z.optional(import_mini4.z.string()),
4099
4104
  url: import_mini4.z.string(),
4100
4105
  score: import_mini4.z.number(),
4101
4106
  metadata: import_mini4.z.record(import_mini4.z.string(), metadataValueSchema2),
@@ -4552,10 +4557,10 @@ function unsafeStringify(arr, offset = 0) {
4552
4557
 
4553
4558
  // node_modules/.bun/uuid@13.0.0/node_modules/uuid/dist/v7.js
4554
4559
  var _state = {};
4555
- function v7(options2, buf, offset) {
4560
+ function v7(options, buf, offset) {
4556
4561
  let bytes;
4557
- if (options2) {
4558
- bytes = v7Bytes(options2.random ?? options2.rng?.() ?? rng(), options2.msecs, options2.seq, buf, offset);
4562
+ if (options) {
4563
+ bytes = v7Bytes(options.random ?? options.rng?.() ?? rng(), options.msecs, options.seq, buf, offset);
4559
4564
  } else {
4560
4565
  const now = Date.now();
4561
4566
  const rnds = rng();
@@ -4564,19 +4569,19 @@ function v7(options2, buf, offset) {
4564
4569
  }
4565
4570
  return buf ?? unsafeStringify(bytes);
4566
4571
  }
4567
- function updateV7State(state2, now, rnds) {
4568
- state2.msecs ??= -Infinity;
4569
- state2.seq ??= 0;
4570
- if (now > state2.msecs) {
4571
- state2.seq = rnds[6] << 23 | rnds[7] << 16 | rnds[8] << 8 | rnds[9];
4572
- state2.msecs = now;
4572
+ function updateV7State(state, now, rnds) {
4573
+ state.msecs ??= -Infinity;
4574
+ state.seq ??= 0;
4575
+ if (now > state.msecs) {
4576
+ state.seq = rnds[6] << 23 | rnds[7] << 16 | rnds[8] << 8 | rnds[9];
4577
+ state.msecs = now;
4573
4578
  } else {
4574
- state2.seq = state2.seq + 1 | 0;
4575
- if (state2.seq === 0) {
4576
- state2.msecs++;
4579
+ state.seq = state.seq + 1 | 0;
4580
+ if (state.seq === 0) {
4581
+ state.msecs++;
4577
4582
  }
4578
4583
  }
4579
- return state2;
4584
+ return state;
4580
4585
  }
4581
4586
  function v7Bytes(rnds, msecs, seq, buf, offset = 0) {
4582
4587
  if (rnds.length < 16) {
@@ -4674,23 +4679,23 @@ var getUserData = async (restClient, startParameters) => {
4674
4679
  };
4675
4680
 
4676
4681
  // node_modules/.bun/sse.js@2.8.0/node_modules/sse.js/lib/sse.js
4677
- var SSE = function(url, options2) {
4682
+ var SSE = function(url, options) {
4678
4683
  if (!(this instanceof SSE)) {
4679
- return new SSE(url, options2);
4684
+ return new SSE(url, options);
4680
4685
  }
4681
4686
  this.url = url;
4682
- options2 = options2 || {};
4683
- this.headers = options2.headers || {};
4684
- this.payload = options2.payload !== undefined ? options2.payload : "";
4685
- this.method = options2.method || this.payload && "POST" || "GET";
4686
- this.withCredentials = !!options2.withCredentials;
4687
- this.debug = !!options2.debug;
4688
- this.autoReconnect = options2.autoReconnect !== undefined ? options2.autoReconnect : false;
4689
- this.reconnectDelay = options2.reconnectDelay !== undefined ? options2.reconnectDelay : 3000;
4690
- this.maxRetries = options2.maxRetries !== undefined ? options2.maxRetries : null;
4687
+ options = options || {};
4688
+ this.headers = options.headers || {};
4689
+ this.payload = options.payload !== undefined ? options.payload : "";
4690
+ this.method = options.method || this.payload && "POST" || "GET";
4691
+ this.withCredentials = !!options.withCredentials;
4692
+ this.debug = !!options.debug;
4693
+ this.autoReconnect = options.autoReconnect !== undefined ? options.autoReconnect : false;
4694
+ this.reconnectDelay = options.reconnectDelay !== undefined ? options.reconnectDelay : 3000;
4695
+ this.maxRetries = options.maxRetries !== undefined ? options.maxRetries : null;
4691
4696
  this.retryCount = 0;
4692
4697
  this.reconnectTimer = null;
4693
- this.useLastEventId = options2.useLastEventId !== undefined ? options2.useLastEventId : true;
4698
+ this.useLastEventId = options.useLastEventId !== undefined ? options.useLastEventId : true;
4694
4699
  this.FIELD_SEPARATOR = ":";
4695
4700
  this.listeners = {};
4696
4701
  this.xhr = null;
@@ -4773,10 +4778,10 @@ var SSE = function(url, options2) {
4773
4778
  }, this.reconnectDelay);
4774
4779
  }
4775
4780
  };
4776
- this._setReadyState = function(state2) {
4781
+ this._setReadyState = function(state) {
4777
4782
  const event = new CustomEvent("readystatechange");
4778
- event.readyState = state2;
4779
- this.readyState = state2;
4783
+ event.readyState = state;
4784
+ this.readyState = state;
4780
4785
  this.dispatchEvent(event);
4781
4786
  };
4782
4787
  this._onStreamFailure = function(e) {
@@ -4920,7 +4925,7 @@ var SSE = function(url, options2) {
4920
4925
  this.xhr.abort();
4921
4926
  }
4922
4927
  };
4923
- if (options2.start === undefined || options2.start) {
4928
+ if (options.start === undefined || options.start) {
4924
4929
  this.stream();
4925
4930
  }
4926
4931
  };
@@ -4935,27 +4940,27 @@ class SseSubscription {
4935
4940
  payload;
4936
4941
  eventSource;
4937
4942
  triggeredOnClose = false;
4938
- constructor(url, options2, payload) {
4939
- this.options = options2;
4943
+ constructor(url, options, payload) {
4944
+ this.options = options;
4940
4945
  this.payload = payload;
4941
4946
  const sseoptions = { headers: { "content-type": "application/json" } };
4942
4947
  if (payload) {
4943
4948
  sseoptions.payload = JSON.stringify(payload);
4944
4949
  }
4945
- if (options2.apiKey) {
4946
- sseoptions.headers["api-key"] = options2.apiKey;
4950
+ if (options.apiKey) {
4951
+ sseoptions.headers["api-key"] = options.apiKey;
4947
4952
  }
4948
- this.eventSource = new (options2.EventSource ?? SSE)(url, sseoptions);
4953
+ this.eventSource = new (options.EventSource ?? SSE)(url, sseoptions);
4949
4954
  this.eventSource.onmessage = (event) => {
4950
4955
  try {
4951
4956
  const data = JSON.parse(event.data);
4952
- options2.onMessage(data);
4957
+ options.onMessage(data);
4953
4958
  } catch (error) {
4954
- options2.onError(new CustomEvent("parse-error", { detail: error }));
4959
+ options.onError(new CustomEvent("parse-error", { detail: error }));
4955
4960
  }
4956
4961
  };
4957
4962
  this.eventSource.onerror = (event) => {
4958
- options2.onError(event);
4963
+ options.onError(event);
4959
4964
  if (this.isClosed()) {
4960
4965
  this.close();
4961
4966
  }
@@ -4980,8 +4985,8 @@ var removeUndefinedValues = (obj) => Object.fromEntries(Object.entries(obj).filt
4980
4985
  // src/lib/client/api/rest-client.ts
4981
4986
  class RestClient {
4982
4987
  options;
4983
- constructor(options2) {
4984
- this.options = options2;
4988
+ constructor(options) {
4989
+ this.options = options;
4985
4990
  }
4986
4991
  getDefaultHeaders(additional = {}) {
4987
4992
  const headers = {
@@ -4995,17 +5000,17 @@ class RestClient {
4995
5000
  get speechRecognitionApiKey() {
4996
5001
  return this.options.speechRecognitionApiKey;
4997
5002
  }
4998
- async subscribeSse(path, params = {}, options2) {
5003
+ async subscribeSse(path, params = {}, options) {
4999
5004
  const payload = removeUndefinedValues(params);
5000
5005
  if (this.options.apiKey)
5001
- options2.apiKey = this.options.apiKey;
5002
- return new SseSubscription(`${this.options.apiUrl}${path}`, options2, payload);
5006
+ options.apiKey = this.options.apiKey;
5007
+ return new SseSubscription(`${this.options.apiUrl}${path}`, options, payload);
5003
5008
  }
5004
- async fetchData(path, validator, params = {}, options2 = {}) {
5009
+ async fetchData(path, validator, params = {}, options = {}) {
5005
5010
  const url = `${this.options.apiUrl}${path}?${new URLSearchParams(removeUndefinedValues(params)).toString()}`;
5006
5011
  const opts = {
5007
- ...options2,
5008
- headers: this.getDefaultHeaders(options2?.headers)
5012
+ ...options,
5013
+ headers: this.getDefaultHeaders(options?.headers)
5009
5014
  };
5010
5015
  const response = await fetch(url, opts);
5011
5016
  if (!response.ok) {
@@ -5078,30 +5083,30 @@ var linkSchema = import_mini8.z.union([linkLegacySchema, searchReferenceSchema])
5078
5083
  var searchEndpointSchema = import_mini8.z.object({
5079
5084
  links: import_mini8.z.array(linkSchema)
5080
5085
  });
5081
- var mapLinkToSearchReference = (link2) => {
5082
- if ("metadata" in link2)
5083
- return link2;
5086
+ var mapLinkToSearchReference = (link) => {
5087
+ if ("metadata" in link)
5088
+ return link;
5084
5089
  console.warn("Please upgrade your backend you are currently using an old api feature.");
5085
- const metadata = link2.orgMetadata ?? {};
5086
- if (link2?.fromFullTextSearch)
5087
- metadata.fromFullTextSearch = link2?.fromFullTextSearch;
5088
- if (link2?.rerank)
5089
- metadata.rerank = link2?.rerank;
5090
+ const metadata = link.orgMetadata ?? {};
5091
+ if (link?.fromFullTextSearch)
5092
+ metadata.fromFullTextSearch = link?.fromFullTextSearch;
5093
+ if (link?.rerank)
5094
+ metadata.rerank = link?.rerank;
5090
5095
  let breadcrumbs = [];
5091
- let title = link2.title ?? "";
5092
- if (link2.title && link2.title.includes(" > ")) {
5093
- const all = link2.title.split(" > ");
5096
+ let title = link.title ?? "";
5097
+ if (link.title && link.title.includes(" > ")) {
5098
+ const all = link.title.split(" > ");
5094
5099
  title = all.pop() ?? "";
5095
5100
  breadcrumbs = all;
5096
5101
  }
5097
5102
  return {
5098
- url: link2.url ?? "",
5103
+ url: link.url ?? "",
5099
5104
  title,
5100
- score: link2.similarity || 0,
5105
+ score: link.similarity || 0,
5101
5106
  breadcrumbs,
5102
5107
  metadata,
5103
- description: link2.content,
5104
- date: link2.date
5108
+ description: link.content,
5109
+ date: link.date
5105
5110
  };
5106
5111
  };
5107
5112
 
@@ -5146,37 +5151,37 @@ var MS_PER_CHAR = 7;
5146
5151
  var MIN_DELAY_MS = 8;
5147
5152
  var MAX_DELAY_MS = 160;
5148
5153
  var START_DELAY_MS = 750;
5149
- var tokenize = (text2) => {
5154
+ var tokenize = (text) => {
5150
5155
  const tokens = [];
5151
5156
  let i = 0;
5152
- while (i < text2.length) {
5153
- const ch = text2[i];
5157
+ while (i < text.length) {
5158
+ const ch = text[i];
5154
5159
  if (ch === "<") {
5155
- const end = text2.indexOf(">", i);
5160
+ const end = text.indexOf(">", i);
5156
5161
  if (end !== -1) {
5157
- tokens.push({ type: "tag", value: text2.slice(i, end + 1) });
5162
+ tokens.push({ type: "tag", value: text.slice(i, end + 1) });
5158
5163
  i = end + 1;
5159
5164
  continue;
5160
5165
  }
5161
5166
  }
5162
5167
  if (/\s/.test(ch)) {
5163
- let j2 = i;
5164
- while (j2 < text2.length && /\s/.test(text2[j2]))
5165
- j2++;
5166
- tokens.push({ type: "space", value: text2.slice(i, j2) });
5167
- i = j2;
5168
+ let j = i;
5169
+ while (j < text.length && /\s/.test(text[j]))
5170
+ j++;
5171
+ tokens.push({ type: "space", value: text.slice(i, j) });
5172
+ i = j;
5168
5173
  continue;
5169
5174
  }
5170
5175
  let j = i;
5171
- while (j < text2.length && !/\s/.test(text2[j]) && text2[j] !== "<")
5176
+ while (j < text.length && !/\s/.test(text[j]) && text[j] !== "<")
5172
5177
  j++;
5173
- tokens.push({ type: "word", value: text2.slice(i, j) });
5178
+ tokens.push({ type: "word", value: text.slice(i, j) });
5174
5179
  i = j;
5175
5180
  }
5176
5181
  return tokens;
5177
5182
  };
5178
- var splitForTyping = (text2) => {
5179
- const tokens = tokenize(text2);
5183
+ var splitForTyping = (text) => {
5184
+ const tokens = tokenize(text);
5180
5185
  const emissions = [];
5181
5186
  let current = "";
5182
5187
  let hasWord = false;
@@ -5205,8 +5210,8 @@ class FakeTypingQueue {
5205
5210
  constructor(onText) {
5206
5211
  this.onText = onText;
5207
5212
  }
5208
- ingestText(text2) {
5209
- const chunks = splitForTyping(text2);
5213
+ ingestText(text) {
5214
+ const chunks = splitForTyping(text);
5210
5215
  if (chunks.length >= TYPING_MIN_CHUNKS) {
5211
5216
  for (const chunk of chunks) {
5212
5217
  this.queue.push({ kind: "text", chunk, delayMs: delayForChunk(chunk) });
@@ -5214,7 +5219,7 @@ class FakeTypingQueue {
5214
5219
  this.kickoff();
5215
5220
  return;
5216
5221
  }
5217
- this.runAfterTyping(() => this.onText(text2));
5222
+ this.runAfterTyping(() => this.onText(text));
5218
5223
  }
5219
5224
  runAfterTyping(fn) {
5220
5225
  if (this.queue.length === 0 && !this.isProcessing) {
@@ -5281,19 +5286,19 @@ class LiipGPTClientPrimitive {
5281
5286
  markedExtensions = [];
5282
5287
  _newTabSrText;
5283
5288
  chatTimeout;
5284
- constructor(options2) {
5285
- this.chatTimeout = options2.chatTimeout ?? DEFAULT_CHAT_TIMEOUT;
5289
+ constructor(options) {
5290
+ this.chatTimeout = options.chatTimeout ?? DEFAULT_CHAT_TIMEOUT;
5286
5291
  const restOptions = {
5287
- apiUrl: options2.apiUrl,
5288
- apiKey: options2.apiKey,
5289
- speechRecognitionApiKey: options2.speechRecognitionApiKey,
5290
- strict: options2.strict ?? false,
5291
- EventSource: options2.EventSource ?? EventSource
5292
+ apiUrl: options.apiUrl,
5293
+ apiKey: options.apiKey,
5294
+ speechRecognitionApiKey: options.speechRecognitionApiKey,
5295
+ strict: options.strict ?? false,
5296
+ EventSource: options.EventSource ?? EventSource
5292
5297
  };
5293
5298
  const restClient = new RestClient(restOptions);
5294
5299
  this.internalData = {
5295
5300
  restClient,
5296
- metadata: getUserData(restClient, options2.startParameters),
5301
+ metadata: getUserData(restClient, options.startParameters),
5297
5302
  searchResponseMap: new Map,
5298
5303
  chatResponseMap: new Map,
5299
5304
  conversationMap: new Map
@@ -5302,8 +5307,8 @@ class LiipGPTClientPrimitive {
5302
5307
  setMarkedExtensions(...extensions) {
5303
5308
  this.markedExtensions = extensions;
5304
5309
  }
5305
- setNewTabSrText(text2) {
5306
- this._newTabSrText = text2;
5310
+ setNewTabSrText(text) {
5311
+ this._newTabSrText = text;
5307
5312
  }
5308
5313
  getMetadata() {
5309
5314
  return this.internalData.metadata;
@@ -5313,7 +5318,7 @@ class LiipGPTClientPrimitive {
5313
5318
  this.renderers.set(conversationId, new MarkdownRenderer({ extensions: this.markedExtensions, newTabSrText: this._newTabSrText }));
5314
5319
  return conversationId;
5315
5320
  }
5316
- chat(conversationId, question, options2 = {}) {
5321
+ chat(conversationId, question, options = {}) {
5317
5322
  const content = new FutureValue;
5318
5323
  const requestId = v7_default();
5319
5324
  const readyForFeedback = new Flag;
@@ -5321,7 +5326,7 @@ class LiipGPTClientPrimitive {
5321
5326
  const chatResultBuilder = new ChatResultBuilder({
5322
5327
  id: requestId,
5323
5328
  onError: (error) => {
5324
- options2.onError?.(error);
5329
+ options.onError?.(error);
5325
5330
  },
5326
5331
  onFinish: (message) => {
5327
5332
  content.setValue(message);
@@ -5337,7 +5342,7 @@ class LiipGPTClientPrimitive {
5337
5342
  };
5338
5343
  const subscription = new FutureValue;
5339
5344
  const typingQueue = new FakeTypingQueue((chunk) => chatResultBuilder.updateText(chunk));
5340
- const timeout = options2.timeout ?? this.chatTimeout;
5345
+ const timeout = options.timeout ?? this.chatTimeout;
5341
5346
  let timeoutId;
5342
5347
  let timedOut = false;
5343
5348
  const stopWatchdog = () => {
@@ -5375,15 +5380,15 @@ class LiipGPTClientPrimitive {
5375
5380
  uID: metadata.userId,
5376
5381
  cID: conversationId,
5377
5382
  rID: requestId,
5378
- lang: options2.lang,
5379
- feature: options2.features?.join(","),
5380
- referrer: options2.referrer,
5381
- source: options2.source,
5382
- ...options2.selectorValues ?? {},
5383
- ...options2.mode ? { mode: options2.mode } : {},
5384
- ...options2.cache ? { cache: true } : {},
5385
- ...options2.predefinedQuestionId ? { predefinedQuestionId: options2.predefinedQuestionId } : {},
5386
- ...options2.switchQuestionId ? { switchQuestionId: options2.switchQuestionId } : {},
5383
+ lang: options.lang,
5384
+ feature: options.features?.join(","),
5385
+ referrer: options.referrer,
5386
+ source: options.source,
5387
+ ...options.selectorValues ?? {},
5388
+ ...options.mode ? { mode: options.mode } : {},
5389
+ ...options.cache ? { cache: true } : {},
5390
+ ...options.predefinedQuestionId ? { predefinedQuestionId: options.predefinedQuestionId } : {},
5391
+ ...options.switchQuestionId ? { switchQuestionId: options.switchQuestionId } : {},
5387
5392
  chat: "true",
5388
5393
  version: "2"
5389
5394
  }, {
@@ -5425,7 +5430,7 @@ class LiipGPTClientPrimitive {
5425
5430
  typingQueue.runAfterTyping(() => {
5426
5431
  chatResultBuilder.finishMessage();
5427
5432
  readyForFeedback.resolve();
5428
- subscription.then((s2) => s2.close());
5433
+ subscription.then((s) => s.close());
5429
5434
  });
5430
5435
  break;
5431
5436
  case "unexpected-call":
@@ -5448,10 +5453,10 @@ class LiipGPTClientPrimitive {
5448
5453
  typingQueue.runAfterTyping(() => chatResultBuilder.setNoFeedback());
5449
5454
  break;
5450
5455
  case "component":
5451
- typingQueue.runWithWarmup(() => options2.onEmbed?.(data));
5456
+ typingQueue.runWithWarmup(() => options.onEmbed?.(data));
5452
5457
  break;
5453
5458
  }
5454
- typingQueue.runAfterTyping(() => options2.onMessage?.(data));
5459
+ typingQueue.runAfterTyping(() => options.onMessage?.(data));
5455
5460
  },
5456
5461
  onError: (event) => {
5457
5462
  console.error(" sse-error:", event);
@@ -5531,24 +5536,24 @@ class LiipGPTClientPrimitive {
5531
5536
  };
5532
5537
  await this.internalData.restClient.postData("/customform", answerFormRequest);
5533
5538
  }
5534
- async userAction(userAction, options2 = {}) {
5539
+ async userAction(userAction, options = {}) {
5535
5540
  const metadata = await this.internalData.metadata;
5536
5541
  if (metadata.mode !== "ready")
5537
5542
  throw new Error("Can not post user action unless we are in ready mode");
5538
5543
  const request = {
5539
5544
  uID: metadata.userId,
5540
- cID: options2.conversationId,
5541
- lang: options2.lang,
5545
+ cID: options.conversationId,
5546
+ lang: options.lang,
5542
5547
  userAction
5543
5548
  };
5544
5549
  await this.internalData.restClient.postData("/assistant/userAction", request);
5545
5550
  }
5546
- async search(query, options2 = {}) {
5551
+ async search(query, options = {}) {
5547
5552
  const metadata = await this.internalData.metadata;
5548
5553
  const uID = metadata.mode === "ready" ? metadata.userId : undefined;
5549
5554
  const { links } = await this.internalData.restClient.fetchData("/assistant/search", searchEndpointSchema, {
5550
- modelId: options2.model,
5551
- lang: options2.language,
5555
+ modelId: options.model,
5556
+ lang: options.language,
5552
5557
  query,
5553
5558
  mapResults: "true",
5554
5559
  uID
@@ -5573,9 +5578,9 @@ class LiipGPTClientPrimitive {
5573
5578
  const data = await this.internalData.restClient.fetchData("/topics/questions", predefinedQuestionsResponseSchema, params);
5574
5579
  return data.predefinedQuestions;
5575
5580
  }
5576
- async transcribeAudio(audioBlob, options2 = {}) {
5581
+ async transcribeAudio(audioBlob, options = {}) {
5577
5582
  const metadata = await this.internalData.metadata;
5578
- const language = options2.lang || "de-CH";
5583
+ const language = options.lang || "de-CH";
5579
5584
  if (metadata.mode === "maintenance") {
5580
5585
  throw new Error("Can not transcribe audio in maintenance mode");
5581
5586
  }
@@ -5613,8 +5618,8 @@ class LiipGPTClientPrimitive {
5613
5618
  // src/lib/client/liipgpt-client.ts
5614
5619
  class LiipGPTClient {
5615
5620
  clientPrimitive;
5616
- constructor(options2) {
5617
- this.clientPrimitive = new LiipGPTClientPrimitive(options2);
5621
+ constructor(options) {
5622
+ this.clientPrimitive = new LiipGPTClientPrimitive(options);
5618
5623
  }
5619
5624
  getMetadata() {
5620
5625
  return this.clientPrimitive.getMetadata();
@@ -5622,8 +5627,8 @@ class LiipGPTClient {
5622
5627
  createConversation() {
5623
5628
  return new Conversation(this.clientPrimitive);
5624
5629
  }
5625
- search(query, options2 = {}) {
5626
- return this.clientPrimitive.search(query, options2);
5630
+ search(query, options = {}) {
5631
+ return this.clientPrimitive.search(query, options);
5627
5632
  }
5628
5633
  getChatConfig() {
5629
5634
  return this.clientPrimitive.getChatConfig();