@loopstack/loopstack-studio 0.27.0 → 0.28.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.
@@ -59,12 +59,12 @@ const CodeBlock = (l) => {
59
59
  d[14] === p ? D = d[15] : (D = cn("group bg-background text-foreground relative w-full overflow-hidden rounded-md border", p), d[14] = p, d[15] = D);
60
60
  let O;
61
61
  d[16] === y ? O = d[17] : (O = /* @__PURE__ */ jsx("div", {
62
- className: "[&>pre]:bg-background! [&>pre]:text-foreground! overflow-hidden dark:hidden [&_code]:font-mono [&_code]:text-sm [&>pre]:m-0 [&>pre]:p-4 [&>pre]:text-sm",
62
+ className: "[&>pre]:bg-background! [&>pre]:text-foreground! overflow-x-auto dark:hidden [&_code]:font-mono [&_code]:text-sm [&>pre]:m-0 [&>pre]:p-4 [&>pre]:text-sm",
63
63
  dangerouslySetInnerHTML: { __html: y }
64
64
  }), d[16] = y, d[17] = O);
65
65
  let k;
66
66
  d[18] === x ? k = d[19] : (k = /* @__PURE__ */ jsx("div", {
67
- className: "[&>pre]:bg-background! [&>pre]:text-foreground! hidden overflow-hidden dark:block [&_code]:font-mono [&_code]:text-sm [&>pre]:m-0 [&>pre]:p-4 [&>pre]:text-sm",
67
+ className: "[&>pre]:bg-background! [&>pre]:text-foreground! hidden overflow-x-auto dark:block [&_code]:font-mono [&_code]:text-sm [&>pre]:m-0 [&>pre]:p-4 [&>pre]:text-sm",
68
68
  dangerouslySetInnerHTML: { __html: x }
69
69
  }), d[18] = x, d[19] = k);
70
70
  let A;
@@ -124,7 +124,16 @@ const ToolHeader = (i) => {
124
124
  ...l,
125
125
  children: [f, m]
126
126
  }), a[11] = l, a[12] = u, a[13] = m, a[14] = h) : h = a[14], h;
127
- }, ToolOutput = (i) => {
127
+ };
128
+ var VALUE_PREVIEW_CHARS = 150, truncateForDisplay = (e) => {
129
+ if (typeof e == "string") return e.length > VALUE_PREVIEW_CHARS ? e.slice(0, VALUE_PREVIEW_CHARS) + "..." : e;
130
+ if (Array.isArray(e)) {
131
+ let i = e.slice(0, 5).map(truncateForDisplay);
132
+ return e.length > 5 && i.push(`... (${e.length - 5} more)`), i;
133
+ }
134
+ return e && typeof e == "object" ? Object.fromEntries(Object.entries(e).map(([e, i]) => [e, truncateForDisplay(i)])) : e;
135
+ };
136
+ const ToolOutput = (i) => {
128
137
  let a = c(30), o, s, l, u;
129
138
  if (a[0] === i ? (o = a[1], s = a[2], l = a[3], u = a[4]) : ({className: o, output: l, errorText: s, ...u} = i, a[0] = i, a[1] = o, a[2] = s, a[3] = l, a[4] = u), !(l || s)) return null;
130
139
  let p = l, m;
@@ -132,18 +141,18 @@ const ToolHeader = (i) => {
132
141
  let h = m;
133
142
  if (typeof l == "object" && !isValidElement(l)) {
134
143
  let e;
135
- a[7] === l ? e = a[8] : (e = JSON.stringify(l, null, 2), a[7] = l, a[8] = e);
144
+ a[7] === l ? e = a[8] : (e = JSON.stringify(truncateForDisplay(l), null, 2), a[7] = l, a[8] = e);
136
145
  let i;
137
146
  a[9] === e ? i = a[10] : (i = /* @__PURE__ */ jsx(CodeBlock, {
138
147
  code: e,
139
148
  language: "json"
140
149
  }), a[9] = e, a[10] = i), h = i;
141
150
  } else if (typeof l == "string") {
142
- let e;
143
- a[11] === l ? e = a[12] : (e = /* @__PURE__ */ jsx(CodeBlock, {
144
- code: l,
151
+ let e = l.length > VALUE_PREVIEW_CHARS ? l.slice(0, VALUE_PREVIEW_CHARS) + "..." : l, i;
152
+ a[11] === e ? i = a[12] : (i = /* @__PURE__ */ jsx(CodeBlock, {
153
+ code: e,
145
154
  language: "json"
146
- }), a[11] = l, a[12] = e), h = e;
155
+ }), a[11] = e, a[12] = i), h = i;
147
156
  }
148
157
  let g;
149
158
  a[13] === o ? g = a[14] : (g = cn("space-y-2 py-2", o), a[13] = o, a[14] = g);
@@ -161,11 +170,11 @@ const ToolHeader = (i) => {
161
170
  className: b,
162
171
  children: [x, h]
163
172
  }), a[21] = h, a[22] = b, a[23] = x, a[24] = S) : S = a[24];
164
- let C;
165
- return a[25] !== u || a[26] !== g || a[27] !== v || a[28] !== S ? (C = /* @__PURE__ */ jsxs("div", {
173
+ let T;
174
+ return a[25] !== u || a[26] !== g || a[27] !== v || a[28] !== S ? (T = /* @__PURE__ */ jsxs("div", {
166
175
  className: g,
167
176
  ...u,
168
177
  children: [v, S]
169
- }), a[25] = u, a[26] = g, a[27] = v, a[28] = S, a[29] = C) : C = a[29], C;
178
+ }), a[25] = u, a[26] = g, a[27] = v, a[28] = S, a[29] = T) : T = a[29], T;
170
179
  };
171
180
  export { Tool, ToolContent, ToolHeader, ToolInput, ToolOutput };
@@ -5,13 +5,13 @@ import OAuthPromptRenderer_default from "../oauth/OAuthPromptRenderer.js";
5
5
  import "../oauth/index.js";
6
6
  import AiMessage_default from "./renderers/AiMessage.js";
7
7
  import ChoicesRenderer_default from "./renderers/ChoicesRenderer.js";
8
- import ClaudeMessage_default from "./renderers/ClaudeMessage.js";
9
8
  import ConfirmPromptRenderer_default from "./renderers/ConfirmPromptRenderer.js";
10
9
  import DocumentDebugRenderer_default from "./renderers/DocumentDebugRenderer.js";
11
10
  import DocumentFormRenderer_default from "./renderers/DocumentFormRenderer.js";
12
11
  import DocumentMessageRenderer_default from "./renderers/DocumentMessageRenderer.js";
13
12
  import ErrorMessageRenderer_default from "./renderers/ErrorMessageRenderer.js";
14
13
  import LinkMessageRenderer_default from "./renderers/LinkMessageRenderer.js";
14
+ import LlmMessage_default from "./renderers/LlmMessage.js";
15
15
  import MarkdownMessageRenderer_default from "./renderers/MarkdownMessageRenderer.js";
16
16
  import PlainMessageRenderer_default from "./renderers/PlainMessageRenderer.js";
17
17
  import TextPromptRenderer_default from "./renderers/TextPromptRenderer.js";
@@ -23,7 +23,7 @@ var coreRendererRegistry = new Map([
23
23
  document: e,
24
24
  isLastItem: _
25
25
  })],
26
- ["claude-message", ({ document: e, isLastItem: _ }) => /* @__PURE__ */ jsx(ClaudeMessage_default, {
26
+ ["llm-message", ({ document: e, isLastItem: _ }) => /* @__PURE__ */ jsx(LlmMessage_default, {
27
27
  document: e,
28
28
  isLastItem: _
29
29
  })],
@@ -0,0 +1,89 @@
1
+ import { Message, MessageAction, MessageActions, MessageContent, MessageResponse } from "../../../components/ai-elements/message.js";
2
+ import { Reasoning, ReasoningContent, ReasoningTrigger } from "../../../components/ai-elements/reasoning.js";
3
+ import { Tool, ToolContent, ToolHeader, ToolInput, ToolOutput } from "../../../components/loopstack-elements/tool.js";
4
+ import { c } from "react/compiler-runtime";
5
+ import { Fragment } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { CopyIcon } from "lucide-react";
8
+ var LlmMessage_default = (y) => {
9
+ let b = c(15), { document: x } = y, S = x.content, C = S.id ?? x.id;
10
+ if (typeof S.content == "string") {
11
+ let m;
12
+ b[0] === S.content ? m = b[1] : (m = /* @__PURE__ */ jsx(MessageContent, { children: /* @__PURE__ */ jsx(MessageResponse, { children: S.content }) }), b[0] = S.content, b[1] = m);
13
+ let h;
14
+ b[2] !== S.content || b[3] !== S.role ? (h = S.role === "assistant" && /* @__PURE__ */ jsx(MessageActions, { children: /* @__PURE__ */ jsx(MessageAction, {
15
+ onClick: () => void navigator.clipboard.writeText(S.content),
16
+ label: "Copy",
17
+ children: /* @__PURE__ */ jsx(CopyIcon, { className: "size-3" })
18
+ }) }), b[2] = S.content, b[3] = S.role, b[4] = h) : h = b[4];
19
+ let g;
20
+ return b[5] !== S.role || b[6] !== m || b[7] !== h ? (g = /* @__PURE__ */ jsxs(Message, {
21
+ from: S.role,
22
+ children: [m, h]
23
+ }), b[5] = S.role, b[6] = m, b[7] = h, b[8] = g) : g = b[8], g;
24
+ }
25
+ let w = S.content, T;
26
+ b[9] !== w || b[10] !== S.role || b[11] !== C ? (T = w.map((_, v) => {
27
+ switch (_.type) {
28
+ case "text": return /* @__PURE__ */ jsxs(Message, {
29
+ from: S.role,
30
+ children: [/* @__PURE__ */ jsx(MessageContent, { children: /* @__PURE__ */ jsx(MessageResponse, { children: _.text }) }), S.role === "assistant" && /* @__PURE__ */ jsx(MessageActions, { children: /* @__PURE__ */ jsx(MessageAction, {
31
+ onClick: () => void navigator.clipboard.writeText(_.text),
32
+ label: "Copy",
33
+ children: /* @__PURE__ */ jsx(CopyIcon, { className: "size-3" })
34
+ }) })]
35
+ }, `${C}-${v}`);
36
+ case "thinking": return /* @__PURE__ */ jsxs(Reasoning, {
37
+ className: "w-full",
38
+ isStreaming: !1,
39
+ children: [/* @__PURE__ */ jsx(ReasoningTrigger, {}), /* @__PURE__ */ jsx(ReasoningContent, { children: _.text })]
40
+ }, `${C}-${v}`);
41
+ case "tool_call": return /* @__PURE__ */ jsx(Message, {
42
+ from: "assistant",
43
+ children: /* @__PURE__ */ jsxs(Tool, { children: [/* @__PURE__ */ jsx(ToolHeader, {
44
+ state: "input-available",
45
+ title: _.name,
46
+ type: "tool-call"
47
+ }), /* @__PURE__ */ jsx(ToolContent, { children: /* @__PURE__ */ jsx(ToolInput, { input: _.args }) })] })
48
+ }, `${C}-${v}`);
49
+ case "tool_result": {
50
+ let p;
51
+ try {
52
+ p = JSON.parse(_.content);
53
+ } catch {
54
+ p = _.content;
55
+ }
56
+ return /* @__PURE__ */ jsx(Message, {
57
+ from: "assistant",
58
+ children: /* @__PURE__ */ jsxs(Tool, { children: [/* @__PURE__ */ jsx(ToolHeader, {
59
+ state: _.isError ? "output-error" : "output-available",
60
+ title: "Tool Result",
61
+ type: "tool-call"
62
+ }), /* @__PURE__ */ jsx(ToolContent, { children: /* @__PURE__ */ jsx(ToolOutput, {
63
+ output: p,
64
+ errorText: _.isError ? _.content : ""
65
+ }) })] })
66
+ }, `${C}-${v}`);
67
+ }
68
+ case "server_tool_use": {
69
+ let p = w.find((e) => e.type === "server_tool_result" && e.toolUseId === _.id);
70
+ return /* @__PURE__ */ jsx(Message, {
71
+ from: "assistant",
72
+ children: /* @__PURE__ */ jsxs(Tool, { children: [/* @__PURE__ */ jsx(ToolHeader, {
73
+ state: p ? "output-available" : "input-available",
74
+ title: _.name,
75
+ type: "tool-call"
76
+ }), /* @__PURE__ */ jsxs(ToolContent, { children: [/* @__PURE__ */ jsx(ToolInput, { input: _.input }), p && /* @__PURE__ */ jsx(ToolOutput, {
77
+ output: p.content,
78
+ errorText: ""
79
+ })] })] })
80
+ }, `${C}-${v}`);
81
+ }
82
+ case "server_tool_result": return null;
83
+ default: return null;
84
+ }
85
+ }), b[9] = w, b[10] = S.role, b[11] = C, b[12] = T) : T = b[12];
86
+ let E;
87
+ return b[13] === T ? E = b[14] : (E = /* @__PURE__ */ jsx(Fragment, { children: T }), b[13] = T, b[14] = E), E;
88
+ };
89
+ export { LlmMessage_default as default };
@@ -124,7 +124,7 @@ var html$1 = freeze(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.a
124
124
  "annotation-xml",
125
125
  "mprescripts",
126
126
  "none"
127
- ]), text = freeze(["#text"]), html = freeze(/* @__PURE__ */ "accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns.slot".split(".")), svg = freeze(/* @__PURE__ */ "accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan".split(".")), mathMl = freeze(/* @__PURE__ */ "accent.accentunder.align.bevelled.close.columnsalign.columnlines.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lspace.lquote.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns".split(".")), xml = freeze([
127
+ ]), text = freeze(["#text"]), html = freeze(/* @__PURE__ */ "accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns.slot".split(".")), svg = freeze(/* @__PURE__ */ "accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan".split(".")), mathMl = freeze(/* @__PURE__ */ "accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns".split(".")), xml = freeze([
128
128
  "xlink:href",
129
129
  "xml:id",
130
130
  "xlink:title",
@@ -144,17 +144,10 @@ var html$1 = freeze(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.a
144
144
  TMPLIT_EXPR
145
145
  }), NODE_TYPE = {
146
146
  element: 1,
147
- attribute: 2,
148
147
  text: 3,
149
- cdataSection: 4,
150
- entityReference: 5,
151
- entityNode: 6,
152
148
  progressingInstruction: 7,
153
149
  comment: 8,
154
- document: 9,
155
- documentType: 10,
156
- documentFragment: 11,
157
- notation: 12
150
+ document: 9
158
151
  }, getGlobal = function() {
159
152
  return typeof window > "u" ? null : window;
160
153
  }, _createTrustedTypesPolicy = function(e, t) {
@@ -189,7 +182,7 @@ var html$1 = freeze(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.a
189
182
  };
190
183
  function createDOMPurify() {
191
184
  let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal(), n = (e) => createDOMPurify(e);
192
- if (n.version = "3.3.3", n.removed = [], !t || !t.document || t.document.nodeType !== NODE_TYPE.document || !t.Element) return n.isSupported = !1, n;
185
+ if (n.version = "3.4.0", n.removed = [], !t || !t.document || t.document.nodeType !== NODE_TYPE.document || !t.Element) return n.isSupported = !1, n;
193
186
  let { document: r } = t, i = r, o = i.currentScript, { DocumentFragment: c, HTMLTemplateElement: l, Node: d, Element: Fe, NodeFilter: f, NamedNodeMap: Ie = t.NamedNodeMap || t.MozNamedAttrMap, HTMLFormElement: Le, DOMParser: Re, trustedTypes: p } = t, m = Fe.prototype, ze = lookupGetter(m, "cloneNode"), Be = lookupGetter(m, "remove"), Ve = lookupGetter(m, "nextSibling"), He = lookupGetter(m, "childNodes"), h = lookupGetter(m, "parentNode");
194
187
  if (typeof l == "function") {
195
188
  let e = r.createElement("template");
@@ -240,7 +233,7 @@ function createDOMPurify() {
240
233
  enumerable: !0,
241
234
  value: null
242
235
  }
243
- })), tt = !0, k = !0, nt = !1, rt = !0, A = !1, j = !0, M = !1, N = !1, it = !1, P = !1, F = !1, I = !1, at = !0, ot = !1, L = !0, R = !1, z = {}, B = null, V = addToSet({}, [
236
+ })), tt = !0, k = !0, nt = !1, rt = !0, A = !1, j = !0, M = !1, N = !1, P = !1, F = !1, I = !1, L = !1, it = !0, at = !1, ot = !0, R = !1, z = {}, B = null, st = addToSet({}, [
244
237
  "annotation-xml",
245
238
  "audio",
246
239
  "colgroup",
@@ -266,14 +259,14 @@ function createDOMPurify() {
266
259
  "title",
267
260
  "video",
268
261
  "xmp"
269
- ]), st = null, ct = addToSet({}, [
262
+ ]), ct = null, lt = addToSet({}, [
270
263
  "audio",
271
264
  "video",
272
265
  "img",
273
266
  "source",
274
267
  "image",
275
268
  "track"
276
- ]), lt = null, ut = addToSet({}, [
269
+ ]), ut = null, dt = addToSet({}, [
277
270
  "alt",
278
271
  "class",
279
272
  "for",
@@ -288,28 +281,28 @@ function createDOMPurify() {
288
281
  "value",
289
282
  "style",
290
283
  "xmlns"
291
- ]), H = "http://www.w3.org/1998/Math/MathML", U = "http://www.w3.org/2000/svg", W = "http://www.w3.org/1999/xhtml", G = W, dt = !1, ft = null, pt = addToSet({}, [
284
+ ]), V = "http://www.w3.org/1998/Math/MathML", H = "http://www.w3.org/2000/svg", U = "http://www.w3.org/1999/xhtml", W = U, ft = !1, pt = null, mt = addToSet({}, [
285
+ V,
292
286
  H,
293
- U,
294
- W
295
- ], stringToString), K = addToSet({}, [
287
+ U
288
+ ], stringToString), G = addToSet({}, [
296
289
  "mi",
297
290
  "mo",
298
291
  "mn",
299
292
  "ms",
300
293
  "mtext"
301
- ]), q = addToSet({}, ["annotation-xml"]), mt = addToSet({}, [
294
+ ]), K = addToSet({}, ["annotation-xml"]), ht = addToSet({}, [
302
295
  "title",
303
296
  "style",
304
297
  "font",
305
298
  "a",
306
299
  "script"
307
- ]), J = null, ht = ["application/xhtml+xml", "text/html"], Y = null, X = null, gt = r.createElement("form"), _t = function(e) {
300
+ ]), q = null, gt = ["application/xhtml+xml", "text/html"], J = null, Y = null, _t = r.createElement("form"), vt = function(e) {
308
301
  return e instanceof RegExp || e instanceof Function;
309
- }, vt = function() {
302
+ }, yt = function() {
310
303
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
311
- if (!(X && X === e)) {
312
- if ((!e || typeof e != "object") && (e = {}), e = clone(e), J = ht.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, Y = J === "application/xhtml+xml" ? stringToString : stringToLowerCase, C = objectHasOwnProperty(e, "ALLOWED_TAGS") ? addToSet({}, e.ALLOWED_TAGS, Y) : $e, w = objectHasOwnProperty(e, "ALLOWED_ATTR") ? addToSet({}, e.ALLOWED_ATTR, Y) : et, ft = objectHasOwnProperty(e, "ALLOWED_NAMESPACES") ? addToSet({}, e.ALLOWED_NAMESPACES, stringToString) : pt, lt = objectHasOwnProperty(e, "ADD_URI_SAFE_ATTR") ? addToSet(clone(ut), e.ADD_URI_SAFE_ATTR, Y) : ut, st = objectHasOwnProperty(e, "ADD_DATA_URI_TAGS") ? addToSet(clone(ct), e.ADD_DATA_URI_TAGS, Y) : ct, B = objectHasOwnProperty(e, "FORBID_CONTENTS") ? addToSet({}, e.FORBID_CONTENTS, Y) : V, E = objectHasOwnProperty(e, "FORBID_TAGS") ? addToSet({}, e.FORBID_TAGS, Y) : clone({}), D = objectHasOwnProperty(e, "FORBID_ATTR") ? addToSet({}, e.FORBID_ATTR, Y) : clone({}), z = objectHasOwnProperty(e, "USE_PROFILES") ? e.USE_PROFILES : !1, tt = e.ALLOW_ARIA_ATTR !== !1, k = e.ALLOW_DATA_ATTR !== !1, nt = e.ALLOW_UNKNOWN_PROTOCOLS || !1, rt = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, A = e.SAFE_FOR_TEMPLATES || !1, j = e.SAFE_FOR_XML !== !1, M = e.WHOLE_DOCUMENT || !1, P = e.RETURN_DOM || !1, F = e.RETURN_DOM_FRAGMENT || !1, I = e.RETURN_TRUSTED_TYPE || !1, it = e.FORCE_BODY || !1, at = e.SANITIZE_DOM !== !1, ot = e.SANITIZE_NAMED_PROPS || !1, L = e.KEEP_CONTENT !== !1, R = e.IN_PLACE || !1, Qe = e.ALLOWED_URI_REGEXP || IS_ALLOWED_URI, G = e.NAMESPACE || W, K = e.MATHML_TEXT_INTEGRATION_POINTS || K, q = e.HTML_INTEGRATION_POINTS || q, T = e.CUSTOM_ELEMENT_HANDLING || {}, e.CUSTOM_ELEMENT_HANDLING && _t(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (T.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && _t(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (T.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (T.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), A && (k = !1), F && (P = !0), z && (C = addToSet({}, text), w = create(null), z.html === !0 && (addToSet(C, html$1), addToSet(w, html)), z.svg === !0 && (addToSet(C, svg$1), addToSet(w, svg), addToSet(w, xml)), z.svgFilters === !0 && (addToSet(C, svgFilters), addToSet(w, svg), addToSet(w, xml)), z.mathMl === !0 && (addToSet(C, mathMl$1), addToSet(w, mathMl), addToSet(w, xml))), objectHasOwnProperty(e, "ADD_TAGS") || (O.tagCheck = null), objectHasOwnProperty(e, "ADD_ATTR") || (O.attributeCheck = null), e.ADD_TAGS && (typeof e.ADD_TAGS == "function" ? O.tagCheck = e.ADD_TAGS : (C === $e && (C = clone(C)), addToSet(C, e.ADD_TAGS, Y))), e.ADD_ATTR && (typeof e.ADD_ATTR == "function" ? O.attributeCheck = e.ADD_ATTR : (w === et && (w = clone(w)), addToSet(w, e.ADD_ATTR, Y))), e.ADD_URI_SAFE_ATTR && addToSet(lt, e.ADD_URI_SAFE_ATTR, Y), e.FORBID_CONTENTS && (B === V && (B = clone(B)), addToSet(B, e.FORBID_CONTENTS, Y)), e.ADD_FORBID_CONTENTS && (B === V && (B = clone(B)), addToSet(B, e.ADD_FORBID_CONTENTS, Y)), L && (C["#text"] = !0), M && addToSet(C, [
304
+ if (!(Y && Y === e)) {
305
+ if ((!e || typeof e != "object") && (e = {}), e = clone(e), q = gt.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, J = q === "application/xhtml+xml" ? stringToString : stringToLowerCase, C = objectHasOwnProperty(e, "ALLOWED_TAGS") ? addToSet({}, e.ALLOWED_TAGS, J) : $e, w = objectHasOwnProperty(e, "ALLOWED_ATTR") ? addToSet({}, e.ALLOWED_ATTR, J) : et, pt = objectHasOwnProperty(e, "ALLOWED_NAMESPACES") ? addToSet({}, e.ALLOWED_NAMESPACES, stringToString) : mt, ut = objectHasOwnProperty(e, "ADD_URI_SAFE_ATTR") ? addToSet(clone(dt), e.ADD_URI_SAFE_ATTR, J) : dt, ct = objectHasOwnProperty(e, "ADD_DATA_URI_TAGS") ? addToSet(clone(lt), e.ADD_DATA_URI_TAGS, J) : lt, B = objectHasOwnProperty(e, "FORBID_CONTENTS") ? addToSet({}, e.FORBID_CONTENTS, J) : st, E = objectHasOwnProperty(e, "FORBID_TAGS") ? addToSet({}, e.FORBID_TAGS, J) : clone({}), D = objectHasOwnProperty(e, "FORBID_ATTR") ? addToSet({}, e.FORBID_ATTR, J) : clone({}), z = objectHasOwnProperty(e, "USE_PROFILES") ? e.USE_PROFILES : !1, tt = e.ALLOW_ARIA_ATTR !== !1, k = e.ALLOW_DATA_ATTR !== !1, nt = e.ALLOW_UNKNOWN_PROTOCOLS || !1, rt = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, A = e.SAFE_FOR_TEMPLATES || !1, j = e.SAFE_FOR_XML !== !1, M = e.WHOLE_DOCUMENT || !1, F = e.RETURN_DOM || !1, I = e.RETURN_DOM_FRAGMENT || !1, L = e.RETURN_TRUSTED_TYPE || !1, P = e.FORCE_BODY || !1, it = e.SANITIZE_DOM !== !1, at = e.SANITIZE_NAMED_PROPS || !1, ot = e.KEEP_CONTENT !== !1, R = e.IN_PLACE || !1, Qe = e.ALLOWED_URI_REGEXP || IS_ALLOWED_URI, W = e.NAMESPACE || U, G = e.MATHML_TEXT_INTEGRATION_POINTS || G, K = e.HTML_INTEGRATION_POINTS || K, T = e.CUSTOM_ELEMENT_HANDLING || create(null), e.CUSTOM_ELEMENT_HANDLING && vt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (T.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && vt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (T.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (T.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), A && (k = !1), I && (F = !0), z && (C = addToSet({}, text), w = create(null), z.html === !0 && (addToSet(C, html$1), addToSet(w, html)), z.svg === !0 && (addToSet(C, svg$1), addToSet(w, svg), addToSet(w, xml)), z.svgFilters === !0 && (addToSet(C, svgFilters), addToSet(w, svg), addToSet(w, xml)), z.mathMl === !0 && (addToSet(C, mathMl$1), addToSet(w, mathMl), addToSet(w, xml))), O.tagCheck = null, O.attributeCheck = null, e.ADD_TAGS && (typeof e.ADD_TAGS == "function" ? O.tagCheck = e.ADD_TAGS : (C === $e && (C = clone(C)), addToSet(C, e.ADD_TAGS, J))), e.ADD_ATTR && (typeof e.ADD_ATTR == "function" ? O.attributeCheck = e.ADD_ATTR : (w === et && (w = clone(w)), addToSet(w, e.ADD_ATTR, J))), e.ADD_URI_SAFE_ATTR && addToSet(ut, e.ADD_URI_SAFE_ATTR, J), e.FORBID_CONTENTS && (B === st && (B = clone(B)), addToSet(B, e.FORBID_CONTENTS, J)), e.ADD_FORBID_CONTENTS && (B === st && (B = clone(B)), addToSet(B, e.ADD_FORBID_CONTENTS, J)), ot && (C["#text"] = !0), M && addToSet(C, [
313
306
  "html",
314
307
  "head",
315
308
  "body"
@@ -318,28 +311,28 @@ function createDOMPurify() {
318
311
  if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
319
312
  g = e.TRUSTED_TYPES_POLICY, _ = g.createHTML("");
320
313
  } else g === void 0 && (g = _createTrustedTypesPolicy(p, o)), g !== null && typeof _ == "string" && (_ = g.createHTML(""));
321
- freeze && freeze(e), X = e;
314
+ freeze && freeze(e), Y = e;
322
315
  }
323
- }, yt = addToSet({}, [
316
+ }, bt = addToSet({}, [
324
317
  ...svg$1,
325
318
  ...svgFilters,
326
319
  ...svgDisallowed
327
- ]), bt = addToSet({}, [...mathMl$1, ...mathMlDisallowed]), xt = function(e) {
320
+ ]), xt = addToSet({}, [...mathMl$1, ...mathMlDisallowed]), St = function(e) {
328
321
  let t = h(e);
329
322
  (!t || !t.tagName) && (t = {
330
- namespaceURI: G,
323
+ namespaceURI: W,
331
324
  tagName: "template"
332
325
  });
333
326
  let n = stringToLowerCase(e.tagName), r = stringToLowerCase(t.tagName);
334
- return ft[e.namespaceURI] ? e.namespaceURI === U ? t.namespaceURI === W ? n === "svg" : t.namespaceURI === H ? n === "svg" && (r === "annotation-xml" || K[r]) : !!yt[n] : e.namespaceURI === H ? t.namespaceURI === W ? n === "math" : t.namespaceURI === U ? n === "math" && q[r] : !!bt[n] : e.namespaceURI === W ? t.namespaceURI === U && !q[r] || t.namespaceURI === H && !K[r] ? !1 : !bt[n] && (mt[n] || !yt[n]) : !!(J === "application/xhtml+xml" && ft[e.namespaceURI]) : !1;
335
- }, Z = function(e) {
327
+ return pt[e.namespaceURI] ? e.namespaceURI === H ? t.namespaceURI === U ? n === "svg" : t.namespaceURI === V ? n === "svg" && (r === "annotation-xml" || G[r]) : !!bt[n] : e.namespaceURI === V ? t.namespaceURI === U ? n === "math" : t.namespaceURI === H ? n === "math" && K[r] : !!xt[n] : e.namespaceURI === U ? t.namespaceURI === H && !K[r] || t.namespaceURI === V && !G[r] ? !1 : !xt[n] && (ht[n] || !bt[n]) : !!(q === "application/xhtml+xml" && pt[e.namespaceURI]) : !1;
328
+ }, X = function(e) {
336
329
  arrayPush(n.removed, { element: e });
337
330
  try {
338
331
  h(e).removeChild(e);
339
332
  } catch {
340
333
  Be(e);
341
334
  }
342
- }, Q = function(e, t) {
335
+ }, Z = function(e, t) {
343
336
  try {
344
337
  arrayPush(n.removed, {
345
338
  attribute: t.getAttributeNode(e),
@@ -351,55 +344,55 @@ function createDOMPurify() {
351
344
  from: t
352
345
  });
353
346
  }
354
- if (t.removeAttribute(e), e === "is") if (P || F) try {
355
- Z(t);
347
+ if (t.removeAttribute(e), e === "is") if (F || I) try {
348
+ X(t);
356
349
  } catch {}
357
350
  else try {
358
351
  t.setAttribute(e, "");
359
352
  } catch {}
360
- }, St = function(e) {
353
+ }, Ct = function(e) {
361
354
  let t = null, n = null;
362
- if (it) e = "<remove></remove>" + e;
355
+ if (P) e = "<remove></remove>" + e;
363
356
  else {
364
357
  let t = stringMatch(e, /^[\r\n\t ]+/);
365
358
  n = t && t[0];
366
359
  }
367
- J === "application/xhtml+xml" && G === W && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
360
+ q === "application/xhtml+xml" && W === U && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
368
361
  let i = g ? g.createHTML(e) : e;
369
- if (G === W) try {
370
- t = new Re().parseFromString(i, J);
362
+ if (W === U) try {
363
+ t = new Re().parseFromString(i, q);
371
364
  } catch {}
372
365
  if (!t || !t.documentElement) {
373
- t = v.createDocument(G, "template", null);
366
+ t = v.createDocument(W, "template", null);
374
367
  try {
375
- t.documentElement.innerHTML = dt ? _ : i;
368
+ t.documentElement.innerHTML = ft ? _ : i;
376
369
  } catch {}
377
370
  }
378
371
  let a = t.body || t.documentElement;
379
- return e && n && a.insertBefore(r.createTextNode(n), a.childNodes[0] || null), G === W ? Ge.call(t, M ? "html" : "body")[0] : M ? t.documentElement : a;
380
- }, Ct = function(e) {
381
- return Ue.call(e.ownerDocument || e, e, f.SHOW_ELEMENT | f.SHOW_COMMENT | f.SHOW_TEXT | f.SHOW_PROCESSING_INSTRUCTION | f.SHOW_CDATA_SECTION, null);
372
+ return e && n && a.insertBefore(r.createTextNode(n), a.childNodes[0] || null), W === U ? Ge.call(t, M ? "html" : "body")[0] : M ? t.documentElement : a;
382
373
  }, wt = function(e) {
383
- return e instanceof Le && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof Ie) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
374
+ return Ue.call(e.ownerDocument || e, e, f.SHOW_ELEMENT | f.SHOW_COMMENT | f.SHOW_TEXT | f.SHOW_PROCESSING_INSTRUCTION | f.SHOW_CDATA_SECTION, null);
384
375
  }, Tt = function(e) {
376
+ return e instanceof Le && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof Ie) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
377
+ }, Q = function(e) {
385
378
  return typeof d == "function" && e instanceof d;
386
379
  };
387
380
  function $(e, t, r) {
388
381
  arrayForEach(e, (e) => {
389
- e.call(n, t, r, X);
382
+ e.call(n, t, r, Y);
390
383
  });
391
384
  }
392
385
  let Et = function(e) {
393
386
  let t = null;
394
- if ($(y.beforeSanitizeElements, e, null), wt(e)) return Z(e), !0;
395
- let r = Y(e.nodeName);
387
+ if ($(y.beforeSanitizeElements, e, null), Tt(e)) return X(e), !0;
388
+ let r = J(e.nodeName);
396
389
  if ($(y.uponSanitizeElement, e, {
397
390
  tagName: r,
398
391
  allowedTags: C
399
- }), j && e.hasChildNodes() && !Tt(e.firstElementChild) && regExpTest(/<[/\w!]/g, e.innerHTML) && regExpTest(/<[/\w!]/g, e.textContent) || e.nodeType === NODE_TYPE.progressingInstruction || j && e.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, e.data)) return Z(e), !0;
400
- if (!(O.tagCheck instanceof Function && O.tagCheck(r)) && (!C[r] || E[r])) {
392
+ }), j && e.hasChildNodes() && !Q(e.firstElementChild) && regExpTest(/<[/\w!]/g, e.innerHTML) && regExpTest(/<[/\w!]/g, e.textContent) || j && e.namespaceURI === U && r === "style" && Q(e.firstElementChild) || e.nodeType === NODE_TYPE.progressingInstruction || j && e.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, e.data)) return X(e), !0;
393
+ if (E[r] || !(O.tagCheck instanceof Function && O.tagCheck(r)) && !C[r]) {
401
394
  if (!E[r] && Ot(r) && (T.tagNameCheck instanceof RegExp && regExpTest(T.tagNameCheck, r) || T.tagNameCheck instanceof Function && T.tagNameCheck(r))) return !1;
402
- if (L && !B[r]) {
395
+ if (ot && !B[r]) {
403
396
  let t = h(e) || e.parentNode, n = He(e) || e.childNodes;
404
397
  if (n && t) {
405
398
  let r = n.length;
@@ -409,9 +402,9 @@ function createDOMPurify() {
409
402
  }
410
403
  }
411
404
  }
412
- return Z(e), !0;
405
+ return X(e), !0;
413
406
  }
414
- return e instanceof Fe && !xt(e) || (r === "noscript" || r === "noembed" || r === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, e.innerHTML) ? (Z(e), !0) : (A && e.nodeType === NODE_TYPE.text && (t = e.textContent, arrayForEach([
407
+ return e instanceof Fe && !St(e) || (r === "noscript" || r === "noembed" || r === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, e.innerHTML) ? (X(e), !0) : (A && e.nodeType === NODE_TYPE.text && (t = e.textContent, arrayForEach([
415
408
  b,
416
409
  x,
417
410
  S
@@ -419,11 +412,11 @@ function createDOMPurify() {
419
412
  t = stringReplace(t, e, " ");
420
413
  }), e.textContent !== t && (arrayPush(n.removed, { element: e.cloneNode() }), e.textContent = t)), $(y.afterSanitizeElements, e, null), !1);
421
414
  }, Dt = function(e, t, n) {
422
- if (D[t] || at && (t === "id" || t === "name") && (n in r || n in gt)) return !1;
415
+ if (D[t] || it && (t === "id" || t === "name") && (n in r || n in _t)) return !1;
423
416
  if (!(k && !D[t] && regExpTest(qe, t)) && !(tt && regExpTest(Je, t)) && !(O.attributeCheck instanceof Function && O.attributeCheck(t, e))) {
424
417
  if (!w[t] || D[t]) {
425
418
  if (!(Ot(e) && (T.tagNameCheck instanceof RegExp && regExpTest(T.tagNameCheck, e) || T.tagNameCheck instanceof Function && T.tagNameCheck(e)) && (T.attributeNameCheck instanceof RegExp && regExpTest(T.attributeNameCheck, t) || T.attributeNameCheck instanceof Function && T.attributeNameCheck(t, e)) || t === "is" && T.allowCustomizedBuiltInElements && (T.tagNameCheck instanceof RegExp && regExpTest(T.tagNameCheck, n) || T.tagNameCheck instanceof Function && T.tagNameCheck(n)))) return !1;
426
- } else if (!lt[t] && !regExpTest(Qe, stringReplace(n, Xe, "")) && !((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && stringIndexOf(n, "data:") === 0 && st[e]) && !(nt && !regExpTest(Ye, stringReplace(n, Xe, ""))) && n) return !1;
419
+ } else if (!ut[t] && !regExpTest(Qe, stringReplace(n, Xe, "")) && !((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && stringIndexOf(n, "data:") === 0 && ct[e]) && !(nt && !regExpTest(Ye, stringReplace(n, Xe, ""))) && n) return !1;
427
420
  }
428
421
  return !0;
429
422
  }, Ot = function(e) {
@@ -431,7 +424,7 @@ function createDOMPurify() {
431
424
  }, kt = function(e) {
432
425
  $(y.beforeSanitizeAttributes, e, null);
433
426
  let { attributes: t } = e;
434
- if (!t || wt(e)) return;
427
+ if (!t || Tt(e)) return;
435
428
  let r = {
436
429
  attrName: "",
437
430
  attrValue: "",
@@ -440,22 +433,22 @@ function createDOMPurify() {
440
433
  forceKeepAttr: void 0
441
434
  }, i = t.length;
442
435
  for (; i--;) {
443
- let { name: a, namespaceURI: o, value: s } = t[i], c = Y(a), l = s, u = a === "value" ? l : stringTrim(l);
444
- if (r.attrName = c, r.attrValue = u, r.keepAttr = !0, r.forceKeepAttr = void 0, $(y.uponSanitizeAttribute, e, r), u = r.attrValue, ot && (c === "id" || c === "name") && (Q(a, e), u = "user-content-" + u), j && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, u)) {
445
- Q(a, e);
436
+ let { name: a, namespaceURI: o, value: s } = t[i], c = J(a), l = s, u = a === "value" ? l : stringTrim(l);
437
+ if (r.attrName = c, r.attrValue = u, r.keepAttr = !0, r.forceKeepAttr = void 0, $(y.uponSanitizeAttribute, e, r), u = r.attrValue, at && (c === "id" || c === "name") && (Z(a, e), u = "user-content-" + u), j && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, u)) {
438
+ Z(a, e);
446
439
  continue;
447
440
  }
448
441
  if (c === "attributename" && stringMatch(u, "href")) {
449
- Q(a, e);
442
+ Z(a, e);
450
443
  continue;
451
444
  }
452
445
  if (r.forceKeepAttr) continue;
453
446
  if (!r.keepAttr) {
454
- Q(a, e);
447
+ Z(a, e);
455
448
  continue;
456
449
  }
457
450
  if (!rt && regExpTest(/\/>/i, u)) {
458
- Q(a, e);
451
+ Z(a, e);
459
452
  continue;
460
453
  }
461
454
  A && arrayForEach([
@@ -465,9 +458,9 @@ function createDOMPurify() {
465
458
  ], (e) => {
466
459
  u = stringReplace(u, e, " ");
467
460
  });
468
- let Pe = Y(e.nodeName);
461
+ let Pe = J(e.nodeName);
469
462
  if (!Dt(Pe, c, u)) {
470
- Q(a, e);
463
+ Z(a, e);
471
464
  continue;
472
465
  }
473
466
  if (g && typeof p == "object" && typeof p.getAttributeType == "function" && !o) switch (p.getAttributeType(Pe, c)) {
@@ -479,39 +472,50 @@ function createDOMPurify() {
479
472
  break;
480
473
  }
481
474
  if (u !== l) try {
482
- o ? e.setAttributeNS(o, a, u) : e.setAttribute(a, u), wt(e) ? Z(e) : arrayPop(n.removed);
475
+ o ? e.setAttributeNS(o, a, u) : e.setAttribute(a, u), Tt(e) ? X(e) : arrayPop(n.removed);
483
476
  } catch {
484
- Q(a, e);
477
+ Z(a, e);
485
478
  }
486
479
  }
487
480
  $(y.afterSanitizeAttributes, e, null);
488
- }, At = function e(t) {
489
- let n = null, r = Ct(t);
490
- for ($(y.beforeSanitizeShadowDOM, t, null); n = r.nextNode();) $(y.uponSanitizeShadowNode, n, null), Et(n), kt(n), n.content instanceof c && e(n.content);
491
- $(y.afterSanitizeShadowDOM, t, null);
481
+ }, At = function(e) {
482
+ let t = null, n = wt(e);
483
+ for ($(y.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) $(y.uponSanitizeShadowNode, t, null), Et(t), kt(t), t.content instanceof c && At(t.content);
484
+ $(y.afterSanitizeShadowDOM, e, null);
492
485
  };
493
486
  return n.sanitize = function(e) {
494
487
  let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = null, a = null, o = null, s = null;
495
- if (dt = !e, dt && (e = "<!-->"), typeof e != "string" && !Tt(e)) if (typeof e.toString == "function") {
488
+ if (ft = !e, ft && (e = "<!-->"), typeof e != "string" && !Q(e)) if (typeof e.toString == "function") {
496
489
  if (e = e.toString(), typeof e != "string") throw typeErrorCreate("dirty is not a string, aborting");
497
490
  } else throw typeErrorCreate("toString is not a function");
498
491
  if (!n.isSupported) return e;
499
- if (N || vt(t), n.removed = [], typeof e == "string" && (R = !1), R) {
492
+ if (N || yt(t), n.removed = [], typeof e == "string" && (R = !1), R) {
500
493
  if (e.nodeName) {
501
- let t = Y(e.nodeName);
494
+ let t = J(e.nodeName);
502
495
  if (!C[t] || E[t]) throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
503
496
  }
504
- } else if (e instanceof d) r = St("<!---->"), a = r.ownerDocument.importNode(e, !0), a.nodeType === NODE_TYPE.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? r = a : r.appendChild(a);
497
+ } else if (e instanceof d) r = Ct("<!---->"), a = r.ownerDocument.importNode(e, !0), a.nodeType === NODE_TYPE.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? r = a : r.appendChild(a);
505
498
  else {
506
- if (!P && !A && !M && e.indexOf("<") === -1) return g && I ? g.createHTML(e) : e;
507
- if (r = St(e), !r) return P ? null : I ? _ : "";
499
+ if (!F && !A && !M && e.indexOf("<") === -1) return g && L ? g.createHTML(e) : e;
500
+ if (r = Ct(e), !r) return F ? null : L ? _ : "";
508
501
  }
509
- r && it && Z(r.firstChild);
510
- let l = Ct(R ? e : r);
502
+ r && P && X(r.firstChild);
503
+ let l = wt(R ? e : r);
511
504
  for (; o = l.nextNode();) Et(o), kt(o), o.content instanceof c && At(o.content);
512
505
  if (R) return e;
513
- if (P) {
514
- if (F) for (s = We.call(r.ownerDocument); r.firstChild;) s.appendChild(r.firstChild);
506
+ if (F) {
507
+ if (A) {
508
+ r.normalize();
509
+ let e = r.innerHTML;
510
+ arrayForEach([
511
+ b,
512
+ x,
513
+ S
514
+ ], (t) => {
515
+ e = stringReplace(e, t, " ");
516
+ }), r.innerHTML = e;
517
+ }
518
+ if (I) for (s = We.call(r.ownerDocument); r.firstChild;) s.appendChild(r.firstChild);
515
519
  else s = r;
516
520
  return (w.shadowroot || w.shadowrootmode) && (s = Ke.call(i, s, !0)), s;
517
521
  }
@@ -522,13 +526,13 @@ function createDOMPurify() {
522
526
  S
523
527
  ], (e) => {
524
528
  u = stringReplace(u, e, " ");
525
- }), g && I ? g.createHTML(u) : u;
529
+ }), g && L ? g.createHTML(u) : u;
526
530
  }, n.setConfig = function() {
527
- vt(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), N = !0;
531
+ yt(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), N = !0;
528
532
  }, n.clearConfig = function() {
529
- X = null, N = !1;
533
+ Y = null, N = !1;
530
534
  }, n.isValidAttribute = function(e, t, n) {
531
- return X || vt({}), Dt(Y(e), Y(t), n);
535
+ return Y || yt({}), Dt(J(e), J(t), n);
532
536
  }, n.addHook = function(e, t) {
533
537
  typeof t == "function" && arrayPush(y[e], t);
534
538
  }, n.removeHook = function(e, t) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loopstack/loopstack-studio",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "repository": "loopstack-ai/loopstack-studio",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "@fontsource/roboto": "^5.2.10",
28
28
  "@hookform/resolvers": "^5.2.2",
29
- "@loopstack/contracts": "^0.28.0",
29
+ "@loopstack/contracts": "^0.29.0",
30
30
  "@radix-ui/react-accordion": "^1.2.12",
31
31
  "@radix-ui/react-alert-dialog": "^1.1.15",
32
32
  "@radix-ui/react-avatar": "^1.1.11",
@@ -1,96 +0,0 @@
1
- import { Message, MessageAction, MessageActions, MessageContent, MessageResponse } from "../../../components/ai-elements/message.js";
2
- import { Reasoning, ReasoningContent, ReasoningTrigger } from "../../../components/ai-elements/reasoning.js";
3
- import { Tool, ToolContent, ToolHeader, ToolInput, ToolOutput } from "../../../components/loopstack-elements/tool.js";
4
- import { c } from "react/compiler-runtime";
5
- import { Fragment } from "react";
6
- import { jsx, jsxs } from "react/jsx-runtime";
7
- import { CopyIcon } from "lucide-react";
8
- var ClaudeMessage_default = (y) => {
9
- let b = c(19), { document: x } = y, S = x.content, C = S.id ?? x.id, w, T, E;
10
- if (b[0] !== S.content || b[1] !== S.role || b[2] !== S.toolResults || b[3] !== C) {
11
- E = Symbol.for("react.early_return_sentinel");
12
- bb0: {
13
- let _ = /* @__PURE__ */ new Map();
14
- if (S.toolResults) for (let n of S.toolResults) _.set(n.tool_use_id, n);
15
- if (typeof S.content == "string") {
16
- let m;
17
- b[7] === S.content ? m = b[8] : (m = /* @__PURE__ */ jsx(MessageContent, { children: /* @__PURE__ */ jsx(MessageResponse, { children: S.content }) }), b[7] = S.content, b[8] = m);
18
- let h;
19
- b[9] !== S.content || b[10] !== S.role ? (h = S.role === "assistant" && /* @__PURE__ */ jsx(MessageActions, { children: /* @__PURE__ */ jsx(MessageAction, {
20
- onClick: () => void navigator.clipboard.writeText(S.content),
21
- label: "Copy",
22
- children: /* @__PURE__ */ jsx(CopyIcon, { className: "size-3" })
23
- }) }), b[9] = S.content, b[10] = S.role, b[11] = h) : h = b[11];
24
- let g;
25
- b[12] !== S.role || b[13] !== m || b[14] !== h ? (g = /* @__PURE__ */ jsxs(Message, {
26
- from: S.role,
27
- children: [m, h]
28
- }), b[12] = S.role, b[13] = m, b[14] = h, b[15] = g) : g = b[15], E = g;
29
- break bb0;
30
- }
31
- let y = S.content;
32
- w = Fragment, T = y.map((v, y) => {
33
- switch (v.type) {
34
- case "text": return /* @__PURE__ */ jsxs(Message, {
35
- from: S.role,
36
- children: [/* @__PURE__ */ jsx(MessageContent, { children: /* @__PURE__ */ jsx(MessageResponse, { children: v.text }) }), S.role === "assistant" && /* @__PURE__ */ jsx(MessageActions, { children: /* @__PURE__ */ jsx(MessageAction, {
37
- onClick: () => void navigator.clipboard.writeText(v.text),
38
- label: "Copy",
39
- children: /* @__PURE__ */ jsx(CopyIcon, { className: "size-3" })
40
- }) })]
41
- }, `${C}-${y}`);
42
- case "thinking": return /* @__PURE__ */ jsxs(Reasoning, {
43
- className: "w-full",
44
- isStreaming: !1,
45
- children: [/* @__PURE__ */ jsx(ReasoningTrigger, {}), /* @__PURE__ */ jsx(ReasoningContent, { children: v.thinking })]
46
- }, `${C}-${y}`);
47
- case "tool_use": {
48
- let f = _.get(v.id), p;
49
- if (f) try {
50
- p = JSON.parse(f.content);
51
- } catch {
52
- p = f.content;
53
- }
54
- return /* @__PURE__ */ jsx(Message, {
55
- from: "assistant",
56
- children: /* @__PURE__ */ jsxs(Tool, { children: [/* @__PURE__ */ jsx(ToolHeader, {
57
- state: f ? f.is_error ? "output-error" : "output-available" : "input-available",
58
- title: v.name,
59
- type: "tool-call"
60
- }), /* @__PURE__ */ jsxs(ToolContent, { children: [/* @__PURE__ */ jsx(ToolInput, { input: v.input }), f && /* @__PURE__ */ jsx(ToolOutput, {
61
- output: p,
62
- errorText: f.is_error ? f.content : ""
63
- })] })] })
64
- }, `${C}-${y}`);
65
- }
66
- case "tool_result": {
67
- if (_.size > 0) return null;
68
- let f;
69
- try {
70
- f = JSON.parse(v.content);
71
- } catch {
72
- f = v.content;
73
- }
74
- return /* @__PURE__ */ jsx(Message, {
75
- from: "assistant",
76
- children: /* @__PURE__ */ jsxs(Tool, { children: [/* @__PURE__ */ jsx(ToolHeader, {
77
- state: v.is_error ? "output-error" : "output-available",
78
- title: "Tool Result",
79
- type: "tool-result"
80
- }), /* @__PURE__ */ jsx(ToolContent, { children: /* @__PURE__ */ jsx(ToolOutput, {
81
- output: f,
82
- errorText: v.is_error ? v.content : ""
83
- }) })] })
84
- }, `${C}-${y}`);
85
- }
86
- default: return null;
87
- }
88
- });
89
- }
90
- b[0] = S.content, b[1] = S.role, b[2] = S.toolResults, b[3] = C, b[4] = w, b[5] = T, b[6] = E;
91
- } else w = b[4], T = b[5], E = b[6];
92
- if (E !== Symbol.for("react.early_return_sentinel")) return E;
93
- let D;
94
- return b[16] !== w || b[17] !== T ? (D = /* @__PURE__ */ jsx(w, { children: T }), b[16] = w, b[17] = T, b[18] = D) : D = b[18], D;
95
- };
96
- export { ClaudeMessage_default as default };