@pi-outpost/embed 0.60.0 → 0.61.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.
@@ -1,12 +1,12 @@
1
- import { C as e, S as t, b as n, f as r, g as i, h as a, m as o, n as s, o as c, p as l, v as u, w as d, x as f, y as p } from "./conversationHistory-DXpSCV87.js";
2
- import { g as m, i as ee, n as te, r as h, t as ne, u as re } from "./lib-CSMo4o20.js";
3
- import { t as ie } from "./download-DVJ5QY85.js";
4
- import { a as ae, l as oe, n as se, o as ce, s as le, u as g } from "./mermaidToImage-CViP9wx2.js";
5
- import { n as _ } from "./loadReferencedImage-VNYxXIzB.js";
1
+ import { C as e, E as t, S as n, T as r, _ as i, a, b as o, c as s, g as c, h as l, m as u, n as d, v as f, w as ee, x as p } from "./conversationHistory-CRkCClAn.js";
2
+ import { g as m, i as h, n as g, r as _, t as te, u as ne } from "./lib-CSMo4o20.js";
3
+ import { n as re } from "./download-C9gupL_X.js";
4
+ import { a as ie, l as ae, n as oe, o as se, s as ce, u as le } from "./mermaidToImage-CViP9wx2.js";
5
+ import { n as ue } from "./loadReferencedImage-VNYxXIzB.js";
6
6
  //#region ../node_modules/stringify-entities/lib/core.js
7
- var ue = /["&'<>`]/g, de = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, fe = /[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g, pe = /[|\\{}()[\]^$+*?.]/g, v = /* @__PURE__ */ new WeakMap();
8
- function me(e, t) {
9
- return e = e.replace(t.subset ? he(t.subset) : ue, r), t.subset || t.escapeOnly ? e : e.replace(de, n).replace(fe, r);
7
+ var de = /["&'<>`]/g, fe = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, pe = /[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g, me = /[|\\{}()[\]^$+*?.]/g, v = /* @__PURE__ */ new WeakMap();
8
+ function he(e, t) {
9
+ return e = e.replace(t.subset ? ge(t.subset) : de, r), t.subset || t.escapeOnly ? e : e.replace(fe, n).replace(pe, r);
10
10
  function n(e, n, r) {
11
11
  return t.format((e.charCodeAt(0) - 55296) * 1024 + e.charCodeAt(1) - 56320 + 65536, r.charCodeAt(n + 2), t);
12
12
  }
@@ -14,32 +14,32 @@ function me(e, t) {
14
14
  return t.format(e.charCodeAt(0), r.charCodeAt(n + 1), t);
15
15
  }
16
16
  }
17
- function he(e) {
17
+ function ge(e) {
18
18
  let t = v.get(e);
19
- return t || (t = ge(e), v.set(e, t)), t;
19
+ return t || (t = _e(e), v.set(e, t)), t;
20
20
  }
21
- function ge(e) {
21
+ function _e(e) {
22
22
  let t = [], n = -1;
23
- for (; ++n < e.length;) t.push(e[n].replace(pe, "\\$&"));
23
+ for (; ++n < e.length;) t.push(e[n].replace(me, "\\$&"));
24
24
  return RegExp("(?:" + t.join("|") + ")", "g");
25
25
  }
26
26
  //#endregion
27
27
  //#region ../node_modules/stringify-entities/lib/util/to-hexadecimal.js
28
- var _e = /[\dA-Fa-f]/;
29
- function ve(e, t, n) {
28
+ var ve = /[\dA-Fa-f]/;
29
+ function y(e, t, n) {
30
30
  let r = "&#x" + e.toString(16).toUpperCase();
31
- return n && t && !_e.test(String.fromCharCode(t)) ? r : r + ";";
31
+ return n && t && !ve.test(String.fromCharCode(t)) ? r : r + ";";
32
32
  }
33
33
  //#endregion
34
34
  //#region ../node_modules/stringify-entities/lib/util/to-decimal.js
35
- var y = /\d/;
36
- function b(e, t, n) {
35
+ var b = /\d/;
36
+ function x(e, t, n) {
37
37
  let r = "&#" + String(e);
38
- return n && t && !y.test(String.fromCharCode(t)) ? r : r + ";";
38
+ return n && t && !b.test(String.fromCharCode(t)) ? r : r + ";";
39
39
  }
40
40
  //#endregion
41
41
  //#region ../node_modules/character-entities-legacy/index.js
42
- var x = /* @__PURE__ */ "AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml".split("."), S = {
42
+ var S = /* @__PURE__ */ "AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml".split("."), C = {
43
43
  nbsp: "\xA0",
44
44
  iexcl: "¡",
45
45
  cent: "¢",
@@ -292,7 +292,7 @@ var x = /* @__PURE__ */ "AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Cc
292
292
  lsaquo: "‹",
293
293
  rsaquo: "›",
294
294
  euro: "€"
295
- }, C = [
295
+ }, w = [
296
296
  "cent",
297
297
  "copy",
298
298
  "divide",
@@ -301,114 +301,114 @@ var x = /* @__PURE__ */ "AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Cc
301
301
  "not",
302
302
  "para",
303
303
  "times"
304
- ], w = {}.hasOwnProperty, T = {}, E;
305
- for (E in S) w.call(S, E) && (T[S[E]] = E);
306
- var D = /[^\dA-Za-z]/;
307
- function O(e, t, n, r) {
304
+ ], T = {}.hasOwnProperty, E = {}, D;
305
+ for (D in C) T.call(C, D) && (E[C[D]] = D);
306
+ var O = /[^\dA-Za-z]/;
307
+ function k(e, t, n, r) {
308
308
  let i = String.fromCharCode(e);
309
- if (w.call(T, i)) {
310
- let e = T[i], a = "&" + e;
311
- return n && x.includes(e) && !C.includes(e) && (!r || t && t !== 61 && D.test(String.fromCharCode(t))) ? a : a + ";";
309
+ if (T.call(E, i)) {
310
+ let e = E[i], a = "&" + e;
311
+ return n && S.includes(e) && !w.includes(e) && (!r || t && t !== 61 && O.test(String.fromCharCode(t))) ? a : a + ";";
312
312
  }
313
313
  return "";
314
314
  }
315
315
  //#endregion
316
316
  //#region ../node_modules/stringify-entities/lib/util/format-smart.js
317
- function k(e, t, n) {
318
- let r = ve(e, t, n.omitOptionalSemicolons), i;
319
- if ((n.useNamedReferences || n.useShortestReferences) && (i = O(e, t, n.omitOptionalSemicolons, n.attribute)), (n.useShortestReferences || !i) && n.useShortestReferences) {
320
- let i = b(e, t, n.omitOptionalSemicolons);
317
+ function A(e, t, n) {
318
+ let r = y(e, t, n.omitOptionalSemicolons), i;
319
+ if ((n.useNamedReferences || n.useShortestReferences) && (i = k(e, t, n.omitOptionalSemicolons, n.attribute)), (n.useShortestReferences || !i) && n.useShortestReferences) {
320
+ let i = x(e, t, n.omitOptionalSemicolons);
321
321
  i.length < r.length && (r = i);
322
322
  }
323
323
  return i && (!n.useShortestReferences || i.length < r.length) ? i : r;
324
324
  }
325
325
  //#endregion
326
326
  //#region ../node_modules/stringify-entities/lib/index.js
327
- function A(e, t) {
328
- return me(e, Object.assign({ format: k }, t));
327
+ function j(e, t) {
328
+ return he(e, Object.assign({ format: A }, t));
329
329
  }
330
330
  //#endregion
331
331
  //#region ../node_modules/hast-util-to-html/lib/handle/comment.js
332
- var j = /^>|^->|<!--|-->|--!>|<!-$/g, M = [">"], N = ["<", ">"];
333
- function P(e, t, n, r) {
334
- return r.settings.bogusComments ? "<?" + A(e.value, Object.assign({}, r.settings.characterReferences, { subset: M })) + ">" : "<!--" + e.value.replace(j, i) + "-->";
332
+ var M = /^>|^->|<!--|-->|--!>|<!-$/g, N = [">"], P = ["<", ">"];
333
+ function F(e, t, n, r) {
334
+ return r.settings.bogusComments ? "<?" + j(e.value, Object.assign({}, r.settings.characterReferences, { subset: N })) + ">" : "<!--" + e.value.replace(M, i) + "-->";
335
335
  function i(e) {
336
- return A(e, Object.assign({}, r.settings.characterReferences, { subset: N }));
336
+ return j(e, Object.assign({}, r.settings.characterReferences, { subset: P }));
337
337
  }
338
338
  }
339
339
  //#endregion
340
340
  //#region ../node_modules/hast-util-to-html/lib/handle/doctype.js
341
- function F(e, t, n, r) {
341
+ function ye(e, t, n, r) {
342
342
  return "<!" + (r.settings.upperDoctype ? "DOCTYPE" : "doctype") + (r.settings.tightDoctype ? "" : " ") + "html>";
343
343
  }
344
344
  //#endregion
345
345
  //#region ../node_modules/hast-util-to-html/lib/omission/util/siblings.js
346
- var I = R(1), L = R(-1), ye = [];
347
- function R(t) {
348
- return n;
349
- function n(n, r, i) {
350
- let a = n ? n.children : ye, o = (r || 0) + t, s = a[o];
351
- if (!i) for (; s && e(s);) o += t, s = a[o];
346
+ var I = R(1), L = R(-1), be = [];
347
+ function R(e) {
348
+ return t;
349
+ function t(t, n, i) {
350
+ let a = t ? t.children : be, o = (n || 0) + e, s = a[o];
351
+ if (!i) for (; s && r(s);) o += e, s = a[o];
352
352
  return s;
353
353
  }
354
354
  }
355
355
  //#endregion
356
356
  //#region ../node_modules/hast-util-to-html/lib/omission/omission.js
357
- var be = {}.hasOwnProperty;
357
+ var xe = {}.hasOwnProperty;
358
358
  function z(e) {
359
359
  return t;
360
360
  function t(t, n, r) {
361
- return be.call(e, t.tagName) && e[t.tagName](t, n, r);
361
+ return xe.call(e, t.tagName) && e[t.tagName](t, n, r);
362
362
  }
363
363
  }
364
364
  //#endregion
365
365
  //#region ../node_modules/hast-util-to-html/lib/omission/closing.js
366
366
  var B = z({
367
- body: Se,
367
+ body: Ce,
368
368
  caption: V,
369
369
  colgroup: V,
370
- dd: Ee,
371
- dt: Te,
370
+ dd: De,
371
+ dt: Ee,
372
372
  head: V,
373
- html: xe,
374
- li: we,
375
- optgroup: De,
376
- option: U,
377
- p: Ce,
373
+ html: Se,
374
+ li: Te,
375
+ optgroup: Oe,
376
+ option: ke,
377
+ p: we,
378
378
  rp: H,
379
379
  rt: H,
380
- tbody: ke,
381
- td: W,
382
- tfoot: Ae,
383
- th: W,
384
- thead: Oe,
385
- tr: je
380
+ tbody: je,
381
+ td: U,
382
+ tfoot: Me,
383
+ th: U,
384
+ thead: Ae,
385
+ tr: Ne
386
386
  });
387
- function V(t, n, r) {
388
- let i = I(r, n, !0);
389
- return !i || i.type !== "comment" && !(i.type === "text" && e(i.value.charAt(0)));
387
+ function V(e, t, n) {
388
+ let i = I(n, t, !0);
389
+ return !i || i.type !== "comment" && !(i.type === "text" && r(i.value.charAt(0)));
390
390
  }
391
- function xe(e, t, n) {
391
+ function Se(e, t, n) {
392
392
  let r = I(n, t);
393
393
  return !r || r.type !== "comment";
394
394
  }
395
- function Se(e, t, n) {
395
+ function Ce(e, t, n) {
396
396
  let r = I(n, t);
397
397
  return !r || r.type !== "comment";
398
398
  }
399
- function Ce(e, t, n) {
399
+ function we(e, t, n) {
400
400
  let r = I(n, t);
401
401
  return r ? r.type === "element" && (r.tagName === "address" || r.tagName === "article" || r.tagName === "aside" || r.tagName === "blockquote" || r.tagName === "details" || r.tagName === "div" || r.tagName === "dl" || r.tagName === "fieldset" || r.tagName === "figcaption" || r.tagName === "figure" || r.tagName === "footer" || r.tagName === "form" || r.tagName === "h1" || r.tagName === "h2" || r.tagName === "h3" || r.tagName === "h4" || r.tagName === "h5" || r.tagName === "h6" || r.tagName === "header" || r.tagName === "hgroup" || r.tagName === "hr" || r.tagName === "main" || r.tagName === "menu" || r.tagName === "nav" || r.tagName === "ol" || r.tagName === "p" || r.tagName === "pre" || r.tagName === "section" || r.tagName === "table" || r.tagName === "ul") : !n || n.type !== "element" || n.tagName !== "a" && n.tagName !== "audio" && n.tagName !== "del" && n.tagName !== "ins" && n.tagName !== "map" && n.tagName !== "noscript" && n.tagName !== "video";
402
402
  }
403
- function we(e, t, n) {
403
+ function Te(e, t, n) {
404
404
  let r = I(n, t);
405
405
  return !r || r.type === "element" && r.tagName === "li";
406
406
  }
407
- function Te(e, t, n) {
407
+ function Ee(e, t, n) {
408
408
  let r = I(n, t);
409
409
  return !(!r || r.type !== "element" || r.tagName !== "dt" && r.tagName !== "dd");
410
410
  }
411
- function Ee(e, t, n) {
411
+ function De(e, t, n) {
412
412
  let r = I(n, t);
413
413
  return !r || r.type === "element" && (r.tagName === "dt" || r.tagName === "dd");
414
414
  }
@@ -416,47 +416,47 @@ function H(e, t, n) {
416
416
  let r = I(n, t);
417
417
  return !r || r.type === "element" && (r.tagName === "rp" || r.tagName === "rt");
418
418
  }
419
- function De(e, t, n) {
419
+ function Oe(e, t, n) {
420
420
  let r = I(n, t);
421
421
  return !r || r.type === "element" && r.tagName === "optgroup";
422
422
  }
423
- function U(e, t, n) {
423
+ function ke(e, t, n) {
424
424
  let r = I(n, t);
425
425
  return !r || r.type === "element" && (r.tagName === "option" || r.tagName === "optgroup");
426
426
  }
427
- function Oe(e, t, n) {
427
+ function Ae(e, t, n) {
428
428
  let r = I(n, t);
429
429
  return !(!r || r.type !== "element" || r.tagName !== "tbody" && r.tagName !== "tfoot");
430
430
  }
431
- function ke(e, t, n) {
431
+ function je(e, t, n) {
432
432
  let r = I(n, t);
433
433
  return !r || r.type === "element" && (r.tagName === "tbody" || r.tagName === "tfoot");
434
434
  }
435
- function Ae(e, t, n) {
435
+ function Me(e, t, n) {
436
436
  return !I(n, t);
437
437
  }
438
- function je(e, t, n) {
438
+ function Ne(e, t, n) {
439
439
  let r = I(n, t);
440
440
  return !r || r.type === "element" && r.tagName === "tr";
441
441
  }
442
- function W(e, t, n) {
442
+ function U(e, t, n) {
443
443
  let r = I(n, t);
444
444
  return !r || r.type === "element" && (r.tagName === "td" || r.tagName === "th");
445
445
  }
446
446
  //#endregion
447
447
  //#region ../node_modules/hast-util-to-html/lib/omission/opening.js
448
- var Me = z({
449
- body: Fe,
450
- colgroup: Ie,
451
- head: Pe,
452
- html: Ne,
453
- tbody: Le
448
+ var Pe = z({
449
+ body: Le,
450
+ colgroup: Re,
451
+ head: Ie,
452
+ html: Fe,
453
+ tbody: ze
454
454
  });
455
- function Ne(e) {
455
+ function Fe(e) {
456
456
  let t = I(e, -1);
457
457
  return !t || t.type !== "comment";
458
458
  }
459
- function Pe(e) {
459
+ function Ie(e) {
460
460
  let t = /* @__PURE__ */ new Set();
461
461
  for (let n of e.children) if (n.type === "element" && (n.tagName === "base" || n.tagName === "title")) {
462
462
  if (t.has(n.tagName)) return !1;
@@ -465,37 +465,37 @@ function Pe(e) {
465
465
  let n = e.children[0];
466
466
  return !n || n.type === "element";
467
467
  }
468
- function Fe(t) {
469
- let n = I(t, -1, !0);
470
- return !n || n.type !== "comment" && !(n.type === "text" && e(n.value.charAt(0))) && (n.type !== "element" || n.tagName !== "meta" && n.tagName !== "link" && n.tagName !== "script" && n.tagName !== "style" && n.tagName !== "template");
468
+ function Le(e) {
469
+ let t = I(e, -1, !0);
470
+ return !t || t.type !== "comment" && !(t.type === "text" && r(t.value.charAt(0))) && (t.type !== "element" || t.tagName !== "meta" && t.tagName !== "link" && t.tagName !== "script" && t.tagName !== "style" && t.tagName !== "template");
471
471
  }
472
- function Ie(e, t, n) {
472
+ function Re(e, t, n) {
473
473
  let r = L(n, t), i = I(e, -1, !0);
474
474
  return n && r && r.type === "element" && r.tagName === "colgroup" && B(r, n.children.indexOf(r), n) ? !1 : !!(i && i.type === "element" && i.tagName === "col");
475
475
  }
476
- function Le(e, t, n) {
476
+ function ze(e, t, n) {
477
477
  let r = L(n, t), i = I(e, -1);
478
478
  return n && r && r.type === "element" && (r.tagName === "thead" || r.tagName === "tbody") && B(r, n.children.indexOf(r), n) ? !1 : !!(i && i.type === "element" && i.tagName === "tr");
479
479
  }
480
480
  //#endregion
481
481
  //#region ../node_modules/hast-util-to-html/lib/handle/element.js
482
- var G = {
482
+ var W = {
483
483
  name: [[" \n\f\r &/=>".split(""), " \n\f\r \"&'/=>`".split("")], ["\0 \n\f\r \"&'/<=>".split(""), "\0 \n\f\r \"&'/<=>`".split("")]],
484
484
  unquoted: [[" \n\f\r &>".split(""), "\0 \n\f\r \"&'<=>`".split("")], ["\0 \n\f\r \"&'<=>`".split(""), "\0 \n\f\r \"&'<=>`".split("")]],
485
485
  single: [["&'".split(""), "\"&'`".split("")], ["\0&'".split(""), "\0\"&'`".split("")]],
486
486
  double: [["\"&".split(""), "\"&'`".split("")], ["\0\"&".split(""), "\0\"&'`".split("")]]
487
487
  };
488
- function Re(e, t, n, r) {
489
- let i = r.schema, a = i.space !== "svg" && r.settings.omitOptionalTags, o = i.space === "svg" ? r.settings.closeEmptyElements : r.settings.voids.includes(e.tagName.toLowerCase()), s = [], c;
490
- i.space === "html" && e.tagName === "svg" && (r.schema = f);
491
- let l = ze(r, e.properties), u = r.all(i.space === "html" && e.tagName === "template" ? e.content : e);
492
- return r.schema = i, u && (o = !1), (l || !a || !Me(e, t, n)) && (s.push("<", e.tagName, l ? " " + l : ""), o && (i.space === "svg" || r.settings.closeSelfClosing) && (c = l.charAt(l.length - 1), (!r.settings.tightSelfClosing || c === "/" || c && c !== "\"" && c !== "'") && s.push(" "), s.push("/")), s.push(">")), s.push(u), !o && (!a || !B(e, t, n)) && s.push("</" + e.tagName + ">"), s.join("");
488
+ function Be(t, n, r, i) {
489
+ let a = i.schema, o = a.space !== "svg" && i.settings.omitOptionalTags, s = a.space === "svg" ? i.settings.closeEmptyElements : i.settings.voids.includes(t.tagName.toLowerCase()), c = [], l;
490
+ a.space === "html" && t.tagName === "svg" && (i.schema = e);
491
+ let u = Ve(i, t.properties), d = i.all(a.space === "html" && t.tagName === "template" ? t.content : t);
492
+ return i.schema = a, d && (s = !1), (u || !o || !Pe(t, n, r)) && (c.push("<", t.tagName, u ? " " + u : ""), s && (a.space === "svg" || i.settings.closeSelfClosing) && (l = u.charAt(u.length - 1), (!i.settings.tightSelfClosing || l === "/" || l && l !== "\"" && l !== "'") && c.push(" "), c.push("/")), c.push(">")), c.push(d), !s && (!o || !B(t, n, r)) && c.push("</" + t.tagName + ">"), c.join("");
493
493
  }
494
- function ze(e, t) {
494
+ function Ve(e, t) {
495
495
  let n = [], r = -1, i;
496
496
  if (t) {
497
497
  for (i in t) if (t[i] !== null && t[i] !== void 0) {
498
- let r = Be(e, i, t[i]);
498
+ let r = He(e, i, t[i]);
499
499
  r && n.push(r);
500
500
  }
501
501
  }
@@ -505,115 +505,115 @@ function ze(e, t) {
505
505
  }
506
506
  return n.join("");
507
507
  }
508
- function Be(e, n, r) {
509
- let i = t(e.schema, n), a = e.settings.allowParseErrors && e.schema.space === "html" ? 0 : 1, o = +!e.settings.allowDangerousCharacters, s = e.quote, c;
508
+ function He(e, n, r) {
509
+ let i = ee(e.schema, n), a = e.settings.allowParseErrors && e.schema.space === "html" ? 0 : 1, o = +!e.settings.allowDangerousCharacters, s = e.quote, c;
510
510
  if (i.overloadedBoolean && (r === i.attribute || r === "") ? r = !0 : (i.boolean || i.overloadedBoolean) && (typeof r != "string" || r === i.attribute || r === "") && (r = !!r), r == null || r === !1 || typeof r == "number" && Number.isNaN(r)) return "";
511
- let l = A(i.attribute, Object.assign({}, e.settings.characterReferences, { subset: G.name[a][o] }));
512
- return r === !0 || (r = Array.isArray(r) ? (i.commaSeparated ? d : p)(r, { padLeft: !e.settings.tightCommaSeparatedLists }) : String(r), e.settings.collapseEmptyAttributes && !r) ? l : (e.settings.preferUnquoted && (c = A(r, Object.assign({}, e.settings.characterReferences, {
511
+ let l = j(i.attribute, Object.assign({}, e.settings.characterReferences, { subset: W.name[a][o] }));
512
+ return r === !0 || (r = Array.isArray(r) ? (i.commaSeparated ? t : p)(r, { padLeft: !e.settings.tightCommaSeparatedLists }) : String(r), e.settings.collapseEmptyAttributes && !r) ? l : (e.settings.preferUnquoted && (c = j(r, Object.assign({}, e.settings.characterReferences, {
513
513
  attribute: !0,
514
- subset: G.unquoted[a][o]
515
- }))), c !== r && (e.settings.quoteSmart && h(r, s) > h(r, e.alternative) && (s = e.alternative), c = s + A(r, Object.assign({}, e.settings.characterReferences, {
516
- subset: (s === "'" ? G.single : G.double)[a][o],
514
+ subset: W.unquoted[a][o]
515
+ }))), c !== r && (e.settings.quoteSmart && _(r, s) > _(r, e.alternative) && (s = e.alternative), c = s + j(r, Object.assign({}, e.settings.characterReferences, {
516
+ subset: (s === "'" ? W.single : W.double)[a][o],
517
517
  attribute: !0
518
518
  })) + s), l + (c && "=" + c));
519
519
  }
520
520
  //#endregion
521
521
  //#region ../node_modules/hast-util-to-html/lib/handle/text.js
522
- var Ve = ["<", "&"];
523
- function K(e, t, n, r) {
524
- return n && n.type === "element" && (n.tagName === "script" || n.tagName === "style") ? e.value : A(e.value, Object.assign({}, r.settings.characterReferences, { subset: Ve }));
522
+ var Ue = ["<", "&"];
523
+ function G(e, t, n, r) {
524
+ return n && n.type === "element" && (n.tagName === "script" || n.tagName === "style") ? e.value : j(e.value, Object.assign({}, r.settings.characterReferences, { subset: Ue }));
525
525
  }
526
526
  //#endregion
527
527
  //#region ../node_modules/hast-util-to-html/lib/handle/raw.js
528
- function He(e, t, n, r) {
529
- return r.settings.allowDangerousHtml ? e.value : K(e, t, n, r);
528
+ function We(e, t, n, r) {
529
+ return r.settings.allowDangerousHtml ? e.value : G(e, t, n, r);
530
530
  }
531
531
  //#endregion
532
532
  //#region ../node_modules/hast-util-to-html/lib/handle/root.js
533
- function Ue(e, t, n, r) {
533
+ function Ge(e, t, n, r) {
534
534
  return r.all(e);
535
535
  }
536
536
  //#endregion
537
537
  //#region ../node_modules/hast-util-to-html/lib/handle/index.js
538
- var We = a("type", {
539
- invalid: Ge,
540
- unknown: Ke,
538
+ var Ke = i("type", {
539
+ invalid: qe,
540
+ unknown: Je,
541
541
  handlers: {
542
- comment: P,
543
- doctype: F,
544
- element: Re,
545
- raw: He,
546
- root: Ue,
547
- text: K
542
+ comment: F,
543
+ doctype: ye,
544
+ element: Be,
545
+ raw: We,
546
+ root: Ge,
547
+ text: G
548
548
  }
549
549
  });
550
- function Ge(e) {
550
+ function qe(e) {
551
551
  throw Error("Expected node, not `" + e + "`");
552
552
  }
553
- function Ke(e) {
553
+ function Je(e) {
554
554
  throw Error("Cannot compile unknown node `" + e.type + "`");
555
555
  }
556
556
  //#endregion
557
557
  //#region ../node_modules/hast-util-to-html/lib/index.js
558
- var qe = {}, Je = {}, Ye = [];
559
- function Xe(e, t) {
560
- let r = t || qe, i = r.quote || "\"", a = i === "\"" ? "'" : "\"";
561
- if (i !== "\"" && i !== "'") throw Error("Invalid quote `" + i + "`, expected `'` or `\"`");
558
+ var Ye = {}, Xe = {}, Ze = [];
559
+ function Qe(t, r) {
560
+ let i = r || Ye, a = i.quote || "\"", o = a === "\"" ? "'" : "\"";
561
+ if (a !== "\"" && a !== "'") throw Error("Invalid quote `" + a + "`, expected `'` or `\"`");
562
562
  return {
563
- one: Ze,
564
- all: Qe,
563
+ one: $e,
564
+ all: et,
565
565
  settings: {
566
- omitOptionalTags: r.omitOptionalTags || !1,
567
- allowParseErrors: r.allowParseErrors || !1,
568
- allowDangerousCharacters: r.allowDangerousCharacters || !1,
569
- quoteSmart: r.quoteSmart || !1,
570
- preferUnquoted: r.preferUnquoted || !1,
571
- tightAttributes: r.tightAttributes || !1,
572
- upperDoctype: r.upperDoctype || !1,
573
- tightDoctype: r.tightDoctype || !1,
574
- bogusComments: r.bogusComments || !1,
575
- tightCommaSeparatedLists: r.tightCommaSeparatedLists || !1,
576
- tightSelfClosing: r.tightSelfClosing || !1,
577
- collapseEmptyAttributes: r.collapseEmptyAttributes || !1,
578
- allowDangerousHtml: r.allowDangerousHtml || !1,
579
- voids: r.voids || o,
580
- characterReferences: r.characterReferences || Je,
581
- closeSelfClosing: r.closeSelfClosing || !1,
582
- closeEmptyElements: r.closeEmptyElements || !1
566
+ omitOptionalTags: i.omitOptionalTags || !1,
567
+ allowParseErrors: i.allowParseErrors || !1,
568
+ allowDangerousCharacters: i.allowDangerousCharacters || !1,
569
+ quoteSmart: i.quoteSmart || !1,
570
+ preferUnquoted: i.preferUnquoted || !1,
571
+ tightAttributes: i.tightAttributes || !1,
572
+ upperDoctype: i.upperDoctype || !1,
573
+ tightDoctype: i.tightDoctype || !1,
574
+ bogusComments: i.bogusComments || !1,
575
+ tightCommaSeparatedLists: i.tightCommaSeparatedLists || !1,
576
+ tightSelfClosing: i.tightSelfClosing || !1,
577
+ collapseEmptyAttributes: i.collapseEmptyAttributes || !1,
578
+ allowDangerousHtml: i.allowDangerousHtml || !1,
579
+ voids: i.voids || c,
580
+ characterReferences: i.characterReferences || Xe,
581
+ closeSelfClosing: i.closeSelfClosing || !1,
582
+ closeEmptyElements: i.closeEmptyElements || !1
583
583
  },
584
- schema: r.space === "svg" ? f : n,
585
- quote: i,
586
- alternative: a
587
- }.one(Array.isArray(e) ? {
584
+ schema: i.space === "svg" ? e : n,
585
+ quote: a,
586
+ alternative: o
587
+ }.one(Array.isArray(t) ? {
588
588
  type: "root",
589
- children: e
590
- } : e, void 0, void 0);
589
+ children: t
590
+ } : t, void 0, void 0);
591
591
  }
592
- function Ze(e, t, n) {
593
- return We(e, t, n, this);
592
+ function $e(e, t, n) {
593
+ return Ke(e, t, n, this);
594
594
  }
595
- function Qe(e) {
596
- let t = [], n = e && e.children || Ye, r = -1;
595
+ function et(e) {
596
+ let t = [], n = e && e.children || Ze, r = -1;
597
597
  for (; ++r < n.length;) t[r] = this.one(n[r], r, e);
598
598
  return t.join("");
599
599
  }
600
600
  //#endregion
601
601
  //#region ../ui/src/export/conversationHtml.ts
602
- var $e = class extends Error {
602
+ var tt = class extends Error {
603
603
  bytes;
604
604
  budgetBytes;
605
605
  constructor(e, t) {
606
606
  super(`the conversation's images come to ${Math.round(e / 1024)} kB, over the ${Math.round(t / 1024)} kB this export embeds`), this.name = "ExportBudgetError", this.bytes = e, this.budgetBytes = t;
607
607
  }
608
- }, q = ee().use(re).use(te).use(ne).use(u, { allowDangerousHtml: !0 }).use(l).use(r, c).use(i, { output: "mathml" });
609
- function et(e) {
608
+ }, K = h().use(ne).use(g).use(te).use(o, { allowDangerousHtml: !0 }).use(l).use(u, s).use(f, { output: "mathml" });
609
+ function nt(e) {
610
610
  let t = e.properties?.className;
611
611
  return (Array.isArray(t) ? t.map(String) : typeof t == "string" ? [t] : []).find((e) => e.startsWith("language-"))?.slice(9);
612
612
  }
613
- async function J(e, t, n) {
613
+ async function q(e, t, n) {
614
614
  if (e.tagName === "img") {
615
615
  let r = typeof e.properties?.src == "string" ? e.properties.src : "";
616
- if (g(r)) {
616
+ if (le(r)) {
617
617
  let t = typeof e.properties?.alt == "string" ? e.properties.alt : "";
618
618
  return {
619
619
  type: "element",
@@ -621,7 +621,7 @@ async function J(e, t, n) {
621
621
  properties: { href: r },
622
622
  children: [{
623
623
  type: "text",
624
- value: oe(r, t)
624
+ value: ae(r, t)
625
625
  }]
626
626
  };
627
627
  }
@@ -637,7 +637,7 @@ async function J(e, t, n) {
637
637
  };
638
638
  n.bytes += i.bytes;
639
639
  let a = t.budgetBytes ?? 41943040;
640
- if (n.bytes > a) throw new $e(n.bytes, a);
640
+ if (n.bytes > a) throw new tt(n.bytes, a);
641
641
  return {
642
642
  ...e,
643
643
  properties: {
@@ -649,8 +649,8 @@ async function J(e, t, n) {
649
649
  }
650
650
  if (e.tagName === "pre" && e.children?.length === 1 && e.children[0].tagName === "code") {
651
651
  let r = e.children[0];
652
- if (et(r) === "mermaid" && t.renderDiagram) {
653
- let e = Y(r);
652
+ if (nt(r) === "mermaid" && t.renderDiagram) {
653
+ let e = J(r);
654
654
  n.diagrams += 1;
655
655
  let i = await t.renderDiagram(e, `pi-export-diagram-${n.diagrams}`);
656
656
  if (i) return {
@@ -666,78 +666,90 @@ async function J(e, t, n) {
666
666
  }
667
667
  if (!e.children) return e;
668
668
  let r = [];
669
- for (let i of e.children) r.push(await J(i, t, n));
669
+ for (let i of e.children) r.push(await q(i, t, n));
670
670
  return {
671
671
  ...e,
672
672
  children: r
673
673
  };
674
674
  }
675
- function Y(e) {
676
- return e.type === "text" ? e.value ?? "" : (e.children ?? []).map(Y).join("");
675
+ function J(e) {
676
+ return e.type === "text" ? e.value ?? "" : (e.children ?? []).map(J).join("");
677
677
  }
678
- async function X(e, t, n) {
679
- return Xe(await J(await q.run(q.parse(m(e))), t, n), { allowDangerousHtml: !0 });
678
+ async function Y(e, t, n) {
679
+ return Qe(await q(await K.run(K.parse(m(e))), t, n), { allowDangerousHtml: !0 });
680
680
  }
681
- function Z(e) {
681
+ function X(e) {
682
682
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
683
683
  }
684
- var tt = ":root {\n --bg: #ffffff; --fg: #18181b; --muted: #71717a; --line: #e4e4e7;\n --user-bg: #eff6ff; --tool-bg: #fafafa; --mark-bg: #fffbeb; --mark-fg: #92400e;\n}\n@media (prefers-color-scheme: dark) {\n :root {\n --bg: #18181b; --fg: #e4e4e7; --muted: #a1a1aa; --line: #3f3f46;\n --user-bg: #1e293b; --tool-bg: #27272a; --mark-bg: #292524; --mark-fg: #fcd34d;\n }\n}\n* { box-sizing: border-box; }\nbody {\n margin: 0; padding: 2rem 1rem; background: var(--bg); color: var(--fg);\n font: 16px/1.6 -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;\n}\nmain { max-width: 46rem; margin: 0 auto; }\nheader.doc { border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 2rem; }\nheader.doc h1 { font-size: 1.4rem; margin: 0 0 0.35rem; }\nheader.doc dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.15rem 0.75rem; margin: 0; font-size: 0.85rem; color: var(--muted); }\nheader.doc dt { font-weight: 600; }\nheader.doc dd { margin: 0; }\narticle { margin: 1.25rem 0; }\narticle > .who { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 0.3rem; }\narticle.user .body { background: var(--user-bg); border-radius: 0.6rem; padding: 0.6rem 0.9rem; }\narticle.reasoning .body { border-left: 2px solid var(--line); padding-left: 0.9rem; color: var(--muted); font-style: italic; }\ndetails.tool { background: var(--tool-bg); border: 1px solid var(--line); border-radius: 0.6rem; padding: 0.4rem 0.7rem; }\ndetails.tool > summary { cursor: pointer; font-size: 0.85rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }\ndetails.tool pre { white-space: pre-wrap; word-break: break-word; }\n.compaction { display: flex; align-items: center; gap: 0.6rem; margin: 2rem 0; color: var(--mark-fg); font-size: 0.8rem; }\n.compaction::before, .compaction::after { content: \"\"; flex: 1; height: 1px; background: currentColor; opacity: 0.4; }\n.compaction-summary { background: var(--mark-bg); color: var(--fg); border-radius: 0.6rem; padding: 0.6rem 0.9rem; font-size: 0.9rem; }\npre { background: var(--tool-bg); border-radius: 0.5rem; padding: 0.7rem; overflow-x: auto; }\ncode { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }\nimg, svg { max-width: 100%; height: auto; }\nfigure.diagram { margin: 1rem 0; overflow-x: auto; }\ntable { border-collapse: collapse; width: 100%; }\nth, td { border: 1px solid var(--line); padding: 0.3rem 0.5rem; text-align: left; }\nblockquote { margin: 0.8rem 0; padding-left: 0.9rem; border-left: 3px solid var(--line); color: var(--muted); }\nfooter.doc { margin-top: 3rem; border-top: 1px solid var(--line); padding-top: 0.8rem; font-size: 0.75rem; color: var(--muted); }", Q = {
684
+ function rt(e) {
685
+ return a(e).map((e) => {
686
+ let t = [
687
+ e.color ? `color:${e.color}` : "",
688
+ e.bold ? "font-weight:600" : "",
689
+ e.dim ? "opacity:0.7" : "",
690
+ e.italic ? "font-style:italic" : "",
691
+ e.underline ? "text-decoration:underline" : ""
692
+ ].filter(Boolean).join(";"), n = X(e.text);
693
+ return t ? `<span style="${X(t)}">${n}</span>` : n;
694
+ }).join("");
695
+ }
696
+ var it = ":root {\n --bg: #ffffff; --fg: #18181b; --muted: #71717a; --line: #e4e4e7;\n --user-bg: #eff6ff; --tool-bg: #fafafa; --mark-bg: #fffbeb; --mark-fg: #92400e;\n}\n@media (prefers-color-scheme: dark) {\n :root {\n --bg: #18181b; --fg: #e4e4e7; --muted: #a1a1aa; --line: #3f3f46;\n --user-bg: #1e293b; --tool-bg: #27272a; --mark-bg: #292524; --mark-fg: #fcd34d;\n }\n}\n* { box-sizing: border-box; }\nbody {\n margin: 0; padding: 2rem 1rem; background: var(--bg); color: var(--fg);\n font: 16px/1.6 -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;\n}\nmain { max-width: 46rem; margin: 0 auto; }\nheader.doc { border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 2rem; }\nheader.doc h1 { font-size: 1.4rem; margin: 0 0 0.35rem; }\nheader.doc dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.15rem 0.75rem; margin: 0; font-size: 0.85rem; color: var(--muted); }\nheader.doc dt { font-weight: 600; }\nheader.doc dd { margin: 0; }\narticle { margin: 1.25rem 0; }\narticle > .who { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 0.3rem; }\narticle.user .body { background: var(--user-bg); border-radius: 0.6rem; padding: 0.6rem 0.9rem; }\narticle.reasoning .body { border-left: 2px solid var(--line); padding-left: 0.9rem; color: var(--muted); font-style: italic; }\ndetails.tool { background: var(--tool-bg); border: 1px solid var(--line); border-radius: 0.6rem; padding: 0.4rem 0.7rem; }\ndetails.tool > summary { cursor: pointer; font-size: 0.85rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }\ndetails.tool pre { white-space: pre-wrap; word-break: break-word; }\n.compaction { display: flex; align-items: center; gap: 0.6rem; margin: 2rem 0; color: var(--mark-fg); font-size: 0.8rem; }\n.compaction::before, .compaction::after { content: \"\"; flex: 1; height: 1px; background: currentColor; opacity: 0.4; }\n.compaction-summary { background: var(--mark-bg); color: var(--fg); border-radius: 0.6rem; padding: 0.6rem 0.9rem; font-size: 0.9rem; }\npre { background: var(--tool-bg); border-radius: 0.5rem; padding: 0.7rem; overflow-x: auto; }\ncode { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }\nimg, svg { max-width: 100%; height: auto; }\nfigure.diagram { margin: 1rem 0; overflow-x: auto; }\ntable { border-collapse: collapse; width: 100%; }\nth, td { border: 1px solid var(--line); padding: 0.3rem 0.5rem; text-align: left; }\nblockquote { margin: 0.8rem 0; padding-left: 0.9rem; border-left: 3px solid var(--line); color: var(--muted); }\nfooter.doc { margin-top: 3rem; border-top: 1px solid var(--line); padding-top: 0.8rem; font-size: 0.75rem; color: var(--muted); }", Z = {
685
697
  user: "You",
686
698
  assistant: "Agent"
687
699
  };
688
- async function nt(e, t, n) {
700
+ async function at(e, t, n) {
689
701
  switch (e.kind) {
690
702
  case "user": {
691
- let r = (e.images ?? []).map((e) => `<img src="data:${Z(e.mimeType)};base64,${e.data}" alt="attached image" />`).join("\n"), i = await X(e.text, t, n);
692
- return `<article class="user"><p class="who">${Q.user}</p><div class="body">${i}${r}</div></article>`;
703
+ let r = (e.images ?? []).map((e) => `<img src="data:${X(e.mimeType)};base64,${e.data}" alt="attached image" />`).join("\n"), i = await Y(e.text, t, n);
704
+ return `<article class="user"><p class="who">${Z.user}</p><div class="body">${i}${r}</div></article>`;
693
705
  }
694
706
  case "assistant": {
695
707
  let r = [];
696
708
  for (let i of e.blocks) {
697
- let e = await X(i.text, t, n);
709
+ let e = await Y(i.text, t, n);
698
710
  r.push(i.type === "thinking" ? `<div class="body"><p class="who">reasoning</p>${e}</div>` : `<div class="body">${e}</div>`);
699
711
  }
700
- let i = e.errorMessage ? `<p class="body"><em>${Z(e.errorMessage)}</em></p>` : "";
701
- return `<article class="${e.blocks.every((e) => e.type === "thinking") ? "assistant reasoning" : "assistant"}"><p class="who">${Q.assistant}</p>${r.join("\n")}${i}</article>`;
712
+ let i = e.errorMessage ? `<p class="body"><em>${X(e.errorMessage)}</em></p>` : "";
713
+ return `<article class="${e.blocks.every((e) => e.type === "thinking") ? "assistant reasoning" : "assistant"}"><p class="who">${Z.assistant}</p>${r.join("\n")}${i}</article>`;
702
714
  }
703
715
  case "tool": {
704
716
  let t = typeof e.args == "string" ? e.args : JSON.stringify(e.args ?? {}, null, 2), n = e.isError ? " — failed" : "";
705
717
  return [
706
718
  "<article class=\"tool\"><details class=\"tool\">",
707
- `<summary>${Z(e.toolName)}${n}</summary>`,
708
- `<pre><code>${Z(t)}</code></pre>`,
709
- `<pre><code>${Z(e.output)}</code></pre>`,
719
+ `<summary>${X(e.toolName)}${n}</summary>`,
720
+ `<pre><code>${X(t)}</code></pre>`,
721
+ `<pre><code>${rt(e.output)}</code></pre>`,
710
722
  "</details></article>"
711
723
  ].join("");
712
724
  }
713
- case "custom": return `<article class="custom"><p class="who">${Z(e.customType)}</p><div class="body"><pre><code>${Z(e.text)}</code></pre></div></article>`;
725
+ case "custom": return `<article class="custom"><p class="who">${X(e.customType)}</p><div class="body"><pre><code>${X(e.text)}</code></pre></div></article>`;
714
726
  case "compaction": {
715
- let r = e.tokensBefore ? ` — ${Math.round(e.tokensBefore / 1e3)}k tokens summarised` : "", i = e.summary ? `<div class="compaction-summary">${await X(e.summary, t, n)}</div>` : "";
716
- return `<div class="compaction">conversation compacted here${Z(r)}</div>${i}`;
727
+ let r = e.tokensBefore ? ` — ${Math.round(e.tokensBefore / 1e3)}k tokens summarised` : "", i = e.summary ? `<div class="compaction-summary">${await Y(e.summary, t, n)}</div>` : "";
728
+ return `<div class="compaction">conversation compacted here${X(r)}</div>${i}`;
717
729
  }
718
730
  }
719
731
  }
720
- async function rt(e, t) {
732
+ async function Q(e, t) {
721
733
  let n = {
722
734
  bytes: 0,
723
735
  diagrams: 0
724
736
  }, r = [];
725
- for (let [i, a] of e.entries()) r.push(await nt(a, t, n)), t.onProgress?.(i + 1, e.length);
737
+ for (let [i, a] of e.entries()) r.push(await at(a, t, n)), t.onProgress?.(i + 1, e.length);
726
738
  let { meta: i } = t, a = i.project ? `${i.session} — ${i.project}` : i.session, o = [];
727
- return i.project && o.push(`<dt>Project</dt><dd>${Z(i.project)}</dd>`), o.push(`<dt>Session</dt><dd>${Z(i.session)}</dd>`), i.model && o.push(`<dt>Model</dt><dd>${Z(i.model)}</dd>`), o.push(`<dt>Exported</dt><dd>${Z(i.exportedAt.toISOString().slice(0, 10))}</dd>`), o.push(`<dt>Messages</dt><dd>${e.length}</dd>`), `<!doctype html>
739
+ return i.project && o.push(`<dt>Project</dt><dd>${X(i.project)}</dd>`), o.push(`<dt>Session</dt><dd>${X(i.session)}</dd>`), i.model && o.push(`<dt>Model</dt><dd>${X(i.model)}</dd>`), o.push(`<dt>Exported</dt><dd>${X(i.exportedAt.toISOString().slice(0, 10))}</dd>`), o.push(`<dt>Messages</dt><dd>${e.length}</dd>`), `<!doctype html>
728
740
  <html lang="en">
729
741
  <head>
730
742
  <meta charset="utf-8" />
731
743
  <meta name="viewport" content="width=device-width, initial-scale=1" />
732
- <title>${Z(a)}</title>
744
+ <title>${X(a)}</title>
733
745
  <style>
734
- ${tt}
746
+ ${it}
735
747
  </style>
736
748
  </head>
737
749
  <body>
738
750
  <main>
739
751
  <header class="doc">
740
- <h1>${Z(a)}</h1>
752
+ <h1>${X(a)}</h1>
741
753
  <dl>${o.join("")}</dl>
742
754
  </header>
743
755
  ${r.join("\n")}
@@ -754,17 +766,17 @@ var $ = class extends Error {
754
766
  super(e), this.name = "ConversationExportError";
755
767
  }
756
768
  };
757
- async function it(e) {
769
+ async function ot(e) {
758
770
  let t = /* @__PURE__ */ new Map();
759
771
  return async (n) => {
760
772
  if (t.has(n)) return t.get(n);
761
- let r = _("", n, e.serverUrl, e.token, e.workspace), i;
773
+ let r = ue("", n, e.serverUrl, e.token, e.workspace), i;
762
774
  if (r !== void 0) try {
763
775
  let e = await fetch(r);
764
776
  if (e.ok) {
765
777
  let t = new Uint8Array(await e.arrayBuffer());
766
778
  i = {
767
- dataUrl: `data:${e.headers.get("content-type") ?? "application/octet-stream"};base64,${at(t)}`,
779
+ dataUrl: `data:${e.headers.get("content-type") ?? "application/octet-stream"};base64,${st(t)}`,
768
780
  bytes: t.byteLength
769
781
  };
770
782
  }
@@ -774,45 +786,45 @@ async function it(e) {
774
786
  return t.set(n, i), i;
775
787
  };
776
788
  }
777
- function at(e) {
789
+ function st(e) {
778
790
  let t = "", n = 32768;
779
791
  for (let r = 0; r < e.length; r += n) t += String.fromCharCode(...e.subarray(r, r + n));
780
792
  return btoa(t);
781
793
  }
782
- async function ot(e, t) {
794
+ async function ct(e, t) {
783
795
  try {
784
- let { svg: n } = await ae(e, t), { width: r, height: i } = ce(n);
785
- return se(le(n, r, i));
796
+ let { svg: n } = await ie(e, t), { width: r, height: i } = se(n);
797
+ return oe(ce(n, r, i));
786
798
  } catch {
787
799
  return;
788
800
  }
789
801
  }
790
- function st(e, t) {
802
+ function lt(e, t) {
791
803
  let n = e.normalize("NFKD").replace(/[^\p{L}\p{N}\s-]/gu, "").trim().replace(/\s+/g, "-").slice(0, 60), r = t.toISOString().slice(0, 10);
792
804
  return `${n || "conversation"}-${r}.html`;
793
805
  }
794
- async function ct(e) {
806
+ async function ut(e) {
795
807
  if (e.items.length === 0) throw new $("there is no conversation to export yet");
796
808
  let t = [];
797
809
  if (e.olderItems > 0) {
798
810
  if (!e.fetchOlderItems) throw new $("this conversation has been compacted and the agent runtime cannot read back what it removed, so it cannot be exported in full");
799
811
  try {
800
- t = await s(e.fetchOlderItems, (t) => e.onProgress?.("collecting", t, e.olderItems));
812
+ t = await d(e.fetchOlderItems, (t) => e.onProgress?.("collecting", t, e.olderItems));
801
813
  } catch (e) {
802
814
  throw new $(`the earlier part of the conversation could not be read back, so nothing was exported: ${e instanceof Error ? e.message : String(e)}`);
803
815
  }
804
816
  }
805
- return rt([...t, ...e.items], {
817
+ return Q([...t, ...e.items], {
806
818
  meta: e.meta,
807
- loadImage: await it(e.connection),
808
- renderDiagram: ot,
819
+ loadImage: await ot(e.connection),
820
+ renderDiagram: ct,
809
821
  budgetBytes: e.budgetBytes ?? 41943040,
810
822
  onProgress: (t, n) => e.onProgress?.("rendering", t, n)
811
823
  });
812
824
  }
813
- async function lt(e) {
814
- let t = await ct(e);
815
- ie(new Blob([t], { type: "text/html;charset=utf-8" }), st(e.meta.session, e.meta.exportedAt));
825
+ async function dt(e) {
826
+ let t = await ut(e);
827
+ re(new Blob([t], { type: "text/html;charset=utf-8" }), lt(e.meta.session, e.meta.exportedAt));
816
828
  }
817
829
  //#endregion
818
- export { lt as exportConversation };
830
+ export { dt as exportConversation };