@loopstack/loopstack-studio 0.35.0 → 0.36.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.
- package/dist/features/documents/DocumentRenderer.js +7 -7
- package/dist/features/documents/renderers/DocumentFormRenderer.js +1 -1
- package/dist/features/oauth/OAuthCallbackPage.js +2 -0
- package/dist/features/run-view/RunView.js +153 -0
- package/dist/features/run-view/Transcript.js +127 -0
- package/dist/features/run-view/prompts/FormPrompt.js +129 -0
- package/dist/features/run-view/prompts/OAuthPrompt.js +94 -0
- package/dist/features/run-view/prompts/SandboxRunButton.js +35 -0
- package/dist/features/run-view/prompts/SecretPrompt.js +69 -0
- package/dist/features/run-view/prompts/SimplePrompts.js +196 -0
- package/dist/features/run-view/prompts/cards.js +90 -0
- package/dist/features/run-view/prompts/registry.js +16 -0
- package/dist/features/run-view/transcript.js +24 -0
- package/dist/features/run-view/useRunPrompts.js +111 -0
- package/dist/features/run-view/useRunTree.js +59 -0
- package/dist/features/run-view/useTreeLlmStreams.js +91 -0
- package/dist/features/secrets/components/WorkbenchSecretsPanel.js +1 -1
- package/dist/features/secrets/renderers/SecretInputRenderer.js +1 -1
- package/dist/features/workbench/WorkflowList.js +111 -52
- package/dist/features/workbench/components/NewRunDialog.js +1 -1
- package/dist/features/workbench/index.js +1 -1
- package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +4 -1
- package/dist/features/workspaces/components/WorkspaceHomePage.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/node_modules/dompurify/dist/purify.es.js +351 -228
- package/dist/packages/client/dist/resources/workflows.js +2 -1
- package/dist/packages/client/dist/stream/invalidations.js +9 -2
- package/dist/packages/client/dist/stream/stream.js +73 -28
- package/dist/packages/contracts/dist/park-view/index.js +2 -0
- package/dist/packages/contracts/dist/park-view/park-view.rules.js +102 -0
- package/dist/packages/contracts/dist/park-view/park-view.types.js +15 -0
- package/dist/pages/PreviewWorkbenchPage.js +23 -23
- package/dist/providers/LoopstackClientProvider.js +18 -14
- package/dist/providers/StudioPreferencesProvider.js +2 -1
- package/package.json +4 -4
|
@@ -195,18 +195,25 @@ var html$1 = freeze(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.a
|
|
|
195
195
|
"annotation-xml",
|
|
196
196
|
"mprescripts",
|
|
197
197
|
"none"
|
|
198
|
-
]), 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".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([
|
|
198
|
+
]), 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.command.commandfor.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".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.dominant-baseline.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-orientation.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([
|
|
199
199
|
"xlink:href",
|
|
200
200
|
"xml:id",
|
|
201
201
|
"xlink:title",
|
|
202
202
|
"xml:space",
|
|
203
203
|
"xmlns:xlink"
|
|
204
|
-
]), MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g), ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g), TMPLIT_EXPR = seal(/\${[\w\W]*/g), DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/), ARIA_ATTR = seal(/^aria-[\-\w]+$/), IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i), ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), DOCTYPE_NAME = seal(/^html$/i), CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i), NODE_TYPE = {
|
|
204
|
+
]), MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g), ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g), TMPLIT_EXPR = seal(/\${[\w\W]*/g), DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/), ARIA_ATTR = seal(/^aria-[\-\w]+$/), IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i), ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), DOCTYPE_NAME = seal(/^html$/i), CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i), ELEMENT_MARKUP_PROBE = seal(/<[/\w!]/g), COMMENT_MARKUP_PROBE = seal(/<[/\w]/g), FALLBACK_TAG_CLOSE = seal(/<\/no(script|embed|frames)/i), SELF_CLOSING_TAG = seal(/\/>/i), NODE_TYPE = {
|
|
205
205
|
element: 1,
|
|
206
|
+
attribute: 2,
|
|
206
207
|
text: 3,
|
|
207
|
-
|
|
208
|
+
cdataSection: 4,
|
|
209
|
+
entityReference: 5,
|
|
210
|
+
entityNode: 6,
|
|
211
|
+
processingInstruction: 7,
|
|
208
212
|
comment: 8,
|
|
209
|
-
document: 9
|
|
213
|
+
document: 9,
|
|
214
|
+
documentType: 10,
|
|
215
|
+
documentFragment: 11,
|
|
216
|
+
notation: 12
|
|
210
217
|
}, getGlobal = function() {
|
|
211
218
|
return typeof window > "u" ? null : window;
|
|
212
219
|
}, _createTrustedTypesPolicy = function(e, t) {
|
|
@@ -238,24 +245,48 @@ var html$1 = freeze(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.a
|
|
|
238
245
|
uponSanitizeElement: [],
|
|
239
246
|
uponSanitizeShadowNode: []
|
|
240
247
|
};
|
|
248
|
+
}, _resolveSetOption = function(e, t, n, r) {
|
|
249
|
+
return objectHasOwnProperty(e, t) && arrayIsArray(e[t]) ? addToSet(r.base ? clone(r.base) : {}, e[t], r.transform) : n;
|
|
241
250
|
};
|
|
242
251
|
function createDOMPurify() {
|
|
243
252
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal(), t = (e) => createDOMPurify(e);
|
|
244
|
-
if (t.version = "3.4.
|
|
245
|
-
let n = e.document, r = n, i = r.currentScript
|
|
246
|
-
|
|
253
|
+
if (t.version = "3.4.12", t.removed = [], !e || !e.document || e.document.nodeType !== NODE_TYPE.document || !e.Element) return t.isSupported = !1, t;
|
|
254
|
+
let n = e.document, r = n, i = r.currentScript;
|
|
255
|
+
e.DocumentFragment;
|
|
256
|
+
let a = e.HTMLTemplateElement, s = e.Node, c = e.Element, l = e.NodeFilter;
|
|
257
|
+
e.NamedNodeMap === void 0 && (e.NamedNodeMap || e.MozNamedAttrMap), e.HTMLFormElement;
|
|
258
|
+
let u = e.DOMParser, f = e.trustedTypes, p = c.prototype, $e = lookupGetter(p, "cloneNode"), et = lookupGetter(p, "remove"), tt = lookupGetter(p, "nextSibling"), m = lookupGetter(p, "childNodes"), h = lookupGetter(p, "parentNode"), nt = lookupGetter(p, "shadowRoot"), rt = lookupGetter(p, "attributes"), g = s && s.prototype ? lookupGetter(s.prototype, "nodeType") : null, _ = s && s.prototype ? lookupGetter(s.prototype, "nodeName") : null;
|
|
259
|
+
if (typeof a == "function") {
|
|
247
260
|
let e = n.createElement("template");
|
|
248
261
|
e.content && e.content.ownerDocument && (n = e.content.ownerDocument);
|
|
249
262
|
}
|
|
250
|
-
let
|
|
251
|
-
|
|
252
|
-
|
|
263
|
+
let v, y = "", it, at = !1, b = 0, ot = function() {
|
|
264
|
+
if (b > 0) throw typeErrorCreate("A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the \"DOMPurify and Trusted Types\" section of the README.");
|
|
265
|
+
}, x = function(e) {
|
|
266
|
+
ot(), b++;
|
|
267
|
+
try {
|
|
268
|
+
return v.createHTML(e);
|
|
269
|
+
} finally {
|
|
270
|
+
b--;
|
|
271
|
+
}
|
|
272
|
+
}, st = function(e) {
|
|
273
|
+
ot(), b++;
|
|
274
|
+
try {
|
|
275
|
+
return v.createScriptURL(e);
|
|
276
|
+
} finally {
|
|
277
|
+
b--;
|
|
278
|
+
}
|
|
279
|
+
}, ct = function() {
|
|
280
|
+
return at ||= (it = _createTrustedTypesPolicy(f, i), !0), it;
|
|
281
|
+
}, S = n, lt = S.implementation, ut = S.createNodeIterator, dt = S.createDocumentFragment, ft = S.getElementsByTagName, pt = r.importNode, C = _createHooksMap();
|
|
282
|
+
t.isSupported = typeof entries == "function" && typeof h == "function" && lt && lt.createHTMLDocument !== void 0;
|
|
283
|
+
let mt = MUSTACHE_EXPR, ht = ERB_EXPR, gt = TMPLIT_EXPR, _t = DATA_ATTR, vt = ARIA_ATTR, yt = IS_SCRIPT_OR_DATA, bt = ATTR_WHITESPACE, xt = CUSTOM_ELEMENT, St = IS_ALLOWED_URI, w = null, Ct = addToSet({}, [
|
|
253
284
|
...html$1,
|
|
254
285
|
...svg$1,
|
|
255
286
|
...svgFilters,
|
|
256
287
|
...mathMl$1,
|
|
257
288
|
...text
|
|
258
|
-
]), T = null,
|
|
289
|
+
]), T = null, wt = addToSet({}, [
|
|
259
290
|
...html,
|
|
260
291
|
...svg,
|
|
261
292
|
...mathMl,
|
|
@@ -279,7 +310,7 @@ function createDOMPurify() {
|
|
|
279
310
|
enumerable: !0,
|
|
280
311
|
value: !1
|
|
281
312
|
}
|
|
282
|
-
})), D = null,
|
|
313
|
+
})), D = null, Tt = null, O = Object.seal(create(null, {
|
|
283
314
|
tagCheck: {
|
|
284
315
|
writable: !0,
|
|
285
316
|
configurable: !1,
|
|
@@ -292,40 +323,14 @@ function createDOMPurify() {
|
|
|
292
323
|
enumerable: !0,
|
|
293
324
|
value: null
|
|
294
325
|
}
|
|
295
|
-
})),
|
|
296
|
-
"annotation-xml",
|
|
297
|
-
"audio",
|
|
298
|
-
"colgroup",
|
|
299
|
-
"desc",
|
|
300
|
-
"foreignobject",
|
|
301
|
-
"head",
|
|
302
|
-
"iframe",
|
|
303
|
-
"math",
|
|
304
|
-
"mi",
|
|
305
|
-
"mn",
|
|
306
|
-
"mo",
|
|
307
|
-
"ms",
|
|
308
|
-
"mtext",
|
|
309
|
-
"noembed",
|
|
310
|
-
"noframes",
|
|
311
|
-
"noscript",
|
|
312
|
-
"plaintext",
|
|
313
|
-
"script",
|
|
314
|
-
"style",
|
|
315
|
-
"svg",
|
|
316
|
-
"template",
|
|
317
|
-
"thead",
|
|
318
|
-
"title",
|
|
319
|
-
"video",
|
|
320
|
-
"xmp"
|
|
321
|
-
]), yt = null, bt = addToSet({}, [
|
|
326
|
+
})), Et = !0, Dt = !0, Ot = !1, kt = !0, k = !1, A = !0, j = !1, At = !1, jt = null, Mt = null, Nt = !1, M = !1, N = !1, P = !1, Pt = !0, Ft = !1, It = "user-content-", Lt = !0, Rt = !1, F = {}, I = null, zt = addToSet({}, /* @__PURE__ */ "annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp".split(".")), Bt = null, Vt = addToSet({}, [
|
|
322
327
|
"audio",
|
|
323
328
|
"video",
|
|
324
329
|
"img",
|
|
325
330
|
"source",
|
|
326
331
|
"image",
|
|
327
332
|
"track"
|
|
328
|
-
]),
|
|
333
|
+
]), Ht = null, Ut = addToSet({}, [
|
|
329
334
|
"alt",
|
|
330
335
|
"class",
|
|
331
336
|
"for",
|
|
@@ -340,65 +345,97 @@ function createDOMPurify() {
|
|
|
340
345
|
"value",
|
|
341
346
|
"style",
|
|
342
347
|
"xmlns"
|
|
343
|
-
]),
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
], stringToString),
|
|
348
|
+
]), L = "http://www.w3.org/1998/Math/MathML", R = "http://www.w3.org/2000/svg", z = "http://www.w3.org/1999/xhtml", B = z, Wt = !1, Gt = null, Kt = addToSet({}, [
|
|
349
|
+
L,
|
|
350
|
+
R,
|
|
351
|
+
z
|
|
352
|
+
], stringToString), qt = freeze([
|
|
348
353
|
"mi",
|
|
349
354
|
"mo",
|
|
350
355
|
"mn",
|
|
351
356
|
"ms",
|
|
352
357
|
"mtext"
|
|
353
|
-
]),
|
|
358
|
+
]), Jt = addToSet({}, qt), Yt = freeze(["annotation-xml"]), Xt = addToSet({}, Yt), Zt = addToSet({}, [
|
|
354
359
|
"title",
|
|
355
360
|
"style",
|
|
356
361
|
"font",
|
|
357
362
|
"a",
|
|
358
363
|
"script"
|
|
359
|
-
]),
|
|
364
|
+
]), V = null, Qt = ["application/xhtml+xml", "text/html"], H = null, U = null, $t = n.createElement("form"), en = function(e) {
|
|
360
365
|
return e instanceof RegExp || e instanceof Function;
|
|
361
|
-
},
|
|
366
|
+
}, tn = function() {
|
|
362
367
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
363
|
-
if (
|
|
364
|
-
(!e || typeof e != "object") && (e = {}), e = clone(e),
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
368
|
+
if (U && U === e) return;
|
|
369
|
+
(!e || typeof e != "object") && (e = {}), e = clone(e), V = Qt.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, H = V === "application/xhtml+xml" ? stringToString : stringToLowerCase, w = _resolveSetOption(e, "ALLOWED_TAGS", Ct, { transform: H }), T = _resolveSetOption(e, "ALLOWED_ATTR", wt, { transform: H }), Gt = _resolveSetOption(e, "ALLOWED_NAMESPACES", Kt, { transform: stringToString }), Ht = _resolveSetOption(e, "ADD_URI_SAFE_ATTR", Ut, {
|
|
370
|
+
transform: H,
|
|
371
|
+
base: Ut
|
|
372
|
+
}), Bt = _resolveSetOption(e, "ADD_DATA_URI_TAGS", Vt, {
|
|
373
|
+
transform: H,
|
|
374
|
+
base: Vt
|
|
375
|
+
}), I = _resolveSetOption(e, "FORBID_CONTENTS", zt, { transform: H }), D = _resolveSetOption(e, "FORBID_TAGS", clone({}), { transform: H }), Tt = _resolveSetOption(e, "FORBID_ATTR", clone({}), { transform: H }), F = objectHasOwnProperty(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? clone(e.USE_PROFILES) : e.USE_PROFILES : !1, Et = e.ALLOW_ARIA_ATTR !== !1, Dt = e.ALLOW_DATA_ATTR !== !1, Ot = e.ALLOW_UNKNOWN_PROTOCOLS || !1, kt = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, k = e.SAFE_FOR_TEMPLATES || !1, A = e.SAFE_FOR_XML !== !1, j = e.WHOLE_DOCUMENT || !1, M = e.RETURN_DOM || !1, N = e.RETURN_DOM_FRAGMENT || !1, P = e.RETURN_TRUSTED_TYPE || !1, Nt = e.FORCE_BODY || !1, Pt = e.SANITIZE_DOM !== !1, Ft = e.SANITIZE_NAMED_PROPS || !1, Lt = e.KEEP_CONTENT !== !1, Rt = e.IN_PLACE || !1, St = isRegex(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : IS_ALLOWED_URI, B = typeof e.NAMESPACE == "string" ? e.NAMESPACE : z, Jt = objectHasOwnProperty(e, "MATHML_TEXT_INTEGRATION_POINTS") && e.MATHML_TEXT_INTEGRATION_POINTS && typeof e.MATHML_TEXT_INTEGRATION_POINTS == "object" ? clone(e.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, qt), Xt = objectHasOwnProperty(e, "HTML_INTEGRATION_POINTS") && e.HTML_INTEGRATION_POINTS && typeof e.HTML_INTEGRATION_POINTS == "object" ? clone(e.HTML_INTEGRATION_POINTS) : addToSet({}, Yt);
|
|
371
376
|
let t = objectHasOwnProperty(e, "CUSTOM_ELEMENT_HANDLING") && e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING == "object" ? clone(e.CUSTOM_ELEMENT_HANDLING) : create(null);
|
|
372
|
-
if (E = create(null), objectHasOwnProperty(t, "tagNameCheck") &&
|
|
377
|
+
if (E = create(null), objectHasOwnProperty(t, "tagNameCheck") && en(t.tagNameCheck) && (E.tagNameCheck = t.tagNameCheck), objectHasOwnProperty(t, "attributeNameCheck") && en(t.attributeNameCheck) && (E.attributeNameCheck = t.attributeNameCheck), objectHasOwnProperty(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (E.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), seal(E), k && (Dt = !1), N && (M = !0), F && (w = addToSet({}, text), T = create(null), F.html === !0 && (addToSet(w, html$1), addToSet(T, html)), F.svg === !0 && (addToSet(w, svg$1), addToSet(T, svg), addToSet(T, xml)), F.svgFilters === !0 && (addToSet(w, svgFilters), addToSet(T, svg), addToSet(T, xml)), F.mathMl === !0 && (addToSet(w, mathMl$1), addToSet(T, mathMl), addToSet(T, xml))), O.tagCheck = null, O.attributeCheck = null, objectHasOwnProperty(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? O.tagCheck = e.ADD_TAGS : arrayIsArray(e.ADD_TAGS) && (w === Ct && (w = clone(w)), addToSet(w, e.ADD_TAGS, H))), objectHasOwnProperty(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? O.attributeCheck = e.ADD_ATTR : arrayIsArray(e.ADD_ATTR) && (T === wt && (T = clone(T)), addToSet(T, e.ADD_ATTR, H))), objectHasOwnProperty(e, "ADD_URI_SAFE_ATTR") && arrayIsArray(e.ADD_URI_SAFE_ATTR) && addToSet(Ht, e.ADD_URI_SAFE_ATTR, H), objectHasOwnProperty(e, "FORBID_CONTENTS") && arrayIsArray(e.FORBID_CONTENTS) && (I === zt && (I = clone(I)), addToSet(I, e.FORBID_CONTENTS, H)), objectHasOwnProperty(e, "ADD_FORBID_CONTENTS") && arrayIsArray(e.ADD_FORBID_CONTENTS) && (I === zt && (I = clone(I)), addToSet(I, e.ADD_FORBID_CONTENTS, H)), Lt && (w["#text"] = !0), j && addToSet(w, [
|
|
373
378
|
"html",
|
|
374
379
|
"head",
|
|
375
380
|
"body"
|
|
376
381
|
]), w.table && (addToSet(w, ["tbody"]), delete D.tbody), e.TRUSTED_TYPES_POLICY) {
|
|
377
382
|
if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
|
|
378
383
|
if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
384
|
+
let t = v;
|
|
385
|
+
v = e.TRUSTED_TYPES_POLICY;
|
|
386
|
+
try {
|
|
387
|
+
y = x("");
|
|
388
|
+
} catch (e) {
|
|
389
|
+
throw v = t, e;
|
|
390
|
+
}
|
|
391
|
+
} else e.TRUSTED_TYPES_POLICY === null ? (v = void 0, y = "") : (v === void 0 && (v = ct()), v && typeof y == "string" && (y = x("")));
|
|
392
|
+
freeze && freeze(e), U = e;
|
|
393
|
+
}, nn = addToSet({}, [
|
|
383
394
|
...svg$1,
|
|
384
395
|
...svgFilters,
|
|
385
396
|
...svgDisallowed
|
|
386
|
-
]),
|
|
397
|
+
]), rn = addToSet({}, [...mathMl$1, ...mathMlDisallowed]), an = function(e, t, n) {
|
|
398
|
+
return t.namespaceURI === z ? e === "svg" : t.namespaceURI === L ? e === "svg" && (n === "annotation-xml" || Jt[n]) : !!nn[e];
|
|
399
|
+
}, on = function(e, t, n) {
|
|
400
|
+
return t.namespaceURI === z ? e === "math" : t.namespaceURI === R ? e === "math" && Xt[n] : !!rn[e];
|
|
401
|
+
}, sn = function(e, t, n) {
|
|
402
|
+
return t.namespaceURI === R && !Xt[n] || t.namespaceURI === L && !Jt[n] ? !1 : !rn[e] && (Zt[e] || !nn[e]);
|
|
403
|
+
}, cn = function(e) {
|
|
387
404
|
let t = h(e);
|
|
388
405
|
(!t || !t.tagName) && (t = {
|
|
389
|
-
namespaceURI:
|
|
406
|
+
namespaceURI: B,
|
|
390
407
|
tagName: "template"
|
|
391
408
|
});
|
|
392
409
|
let n = stringToLowerCase(e.tagName), r = stringToLowerCase(t.tagName);
|
|
393
|
-
return
|
|
394
|
-
},
|
|
410
|
+
return Gt[e.namespaceURI] ? e.namespaceURI === R ? an(n, t, r) : e.namespaceURI === L ? on(n, t, r) : e.namespaceURI === z ? sn(n, t, r) : !!(V === "application/xhtml+xml" && Gt[e.namespaceURI]) : !1;
|
|
411
|
+
}, W = function(e) {
|
|
395
412
|
arrayPush(t.removed, { element: e });
|
|
396
413
|
try {
|
|
397
414
|
h(e).removeChild(e);
|
|
398
415
|
} catch {
|
|
399
|
-
|
|
416
|
+
if (et(e), !h(e)) throw typeErrorCreate("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
|
|
417
|
+
}
|
|
418
|
+
}, G = function(e) {
|
|
419
|
+
un(e);
|
|
420
|
+
let t = m(e);
|
|
421
|
+
if (t) {
|
|
422
|
+
let e = [];
|
|
423
|
+
arrayForEach(t, (t) => {
|
|
424
|
+
arrayPush(e, t);
|
|
425
|
+
}), arrayForEach(e, (e) => {
|
|
426
|
+
try {
|
|
427
|
+
et(e);
|
|
428
|
+
} catch {}
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
let n = rt(e);
|
|
432
|
+
if (n) for (let t = n.length - 1; t >= 0; --t) {
|
|
433
|
+
let r = n[t], i = r && r.name;
|
|
434
|
+
if (typeof i == "string") try {
|
|
435
|
+
e.removeAttribute(i);
|
|
436
|
+
} catch {}
|
|
400
437
|
}
|
|
401
|
-
},
|
|
438
|
+
}, K = function(e, n) {
|
|
402
439
|
try {
|
|
403
440
|
arrayPush(t.removed, {
|
|
404
441
|
attribute: n.getAttributeNode(e),
|
|
@@ -410,83 +447,147 @@ function createDOMPurify() {
|
|
|
410
447
|
from: n
|
|
411
448
|
});
|
|
412
449
|
}
|
|
413
|
-
if (n.removeAttribute(e), e === "is") if (
|
|
414
|
-
|
|
450
|
+
if (n.removeAttribute(e), e === "is") if (M || N) try {
|
|
451
|
+
W(n);
|
|
415
452
|
} catch {}
|
|
416
453
|
else try {
|
|
417
454
|
n.setAttribute(e, "");
|
|
418
455
|
} catch {}
|
|
419
|
-
},
|
|
456
|
+
}, ln = function(e) {
|
|
457
|
+
let t = rt(e);
|
|
458
|
+
if (t) for (let n = t.length - 1; n >= 0; --n) {
|
|
459
|
+
let r = t[n], i = r && r.name;
|
|
460
|
+
if (!(typeof i != "string" || T[H(i)])) try {
|
|
461
|
+
e.removeAttribute(i);
|
|
462
|
+
} catch {}
|
|
463
|
+
}
|
|
464
|
+
}, un = function(e) {
|
|
465
|
+
let t = [e];
|
|
466
|
+
for (; t.length > 0;) {
|
|
467
|
+
let e = t.pop();
|
|
468
|
+
(g ? g(e) : e.nodeType) === NODE_TYPE.element && ln(e);
|
|
469
|
+
let n = m(e);
|
|
470
|
+
if (n) for (let e = n.length - 1; e >= 0; --e) t.push(n[e]);
|
|
471
|
+
}
|
|
472
|
+
}, dn = function(e) {
|
|
473
|
+
if (!A) return;
|
|
474
|
+
let t = [e];
|
|
475
|
+
for (; t.length > 0;) {
|
|
476
|
+
let e = t.pop(), n = g ? g(e) : e.nodeType;
|
|
477
|
+
if (n === NODE_TYPE.processingInstruction || n === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, e.data)) {
|
|
478
|
+
try {
|
|
479
|
+
et(e);
|
|
480
|
+
} catch {}
|
|
481
|
+
continue;
|
|
482
|
+
}
|
|
483
|
+
if (n === NODE_TYPE.element) {
|
|
484
|
+
let t = e, n = H(_ ? _(e) : e.nodeName);
|
|
485
|
+
try {
|
|
486
|
+
t.hasAttribute && t.hasAttribute("patchsrc") && t.removeAttribute("patchsrc"), t.hasAttribute && t.hasAttribute("for") && n !== "label" && n !== "output" && t.removeAttribute("for");
|
|
487
|
+
} catch {}
|
|
488
|
+
}
|
|
489
|
+
let r = m(e);
|
|
490
|
+
if (r) for (let e = r.length - 1; e >= 0; --e) t.push(r[e]);
|
|
491
|
+
}
|
|
492
|
+
}, fn = function(e) {
|
|
420
493
|
let t = null, r = null;
|
|
421
|
-
if (
|
|
494
|
+
if (Nt) e = "<remove></remove>" + e;
|
|
422
495
|
else {
|
|
423
496
|
let t = stringMatch(e, /^[\r\n\t ]+/);
|
|
424
497
|
r = t && t[0];
|
|
425
498
|
}
|
|
426
|
-
|
|
427
|
-
let i =
|
|
428
|
-
if (
|
|
429
|
-
t = new
|
|
499
|
+
V === "application/xhtml+xml" && B === z && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
|
|
500
|
+
let i = v ? x(e) : e;
|
|
501
|
+
if (B === z) try {
|
|
502
|
+
t = new u().parseFromString(i, V);
|
|
430
503
|
} catch {}
|
|
431
504
|
if (!t || !t.documentElement) {
|
|
432
|
-
t =
|
|
505
|
+
t = lt.createDocument(B, "template", null);
|
|
433
506
|
try {
|
|
434
|
-
t.documentElement.innerHTML =
|
|
507
|
+
t.documentElement.innerHTML = Wt ? y : i;
|
|
435
508
|
} catch {}
|
|
436
509
|
}
|
|
437
510
|
let a = t.body || t.documentElement;
|
|
438
|
-
return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null),
|
|
439
|
-
},
|
|
440
|
-
return
|
|
441
|
-
},
|
|
442
|
-
return e
|
|
443
|
-
},
|
|
444
|
-
|
|
511
|
+
return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), B === z ? ft.call(t, j ? "html" : "body")[0] : j ? t.documentElement : a;
|
|
512
|
+
}, pn = function(e) {
|
|
513
|
+
return ut.call(e.ownerDocument || e, e, l.SHOW_ELEMENT | l.SHOW_COMMENT | l.SHOW_TEXT | l.SHOW_PROCESSING_INSTRUCTION | l.SHOW_CDATA_SECTION, null);
|
|
514
|
+
}, q = function(e) {
|
|
515
|
+
return e = stringReplace(e, mt, " "), e = stringReplace(e, ht, " "), e = stringReplace(e, gt, " "), e;
|
|
516
|
+
}, J = function(e) {
|
|
517
|
+
e.normalize();
|
|
518
|
+
let t = ut.call(e.ownerDocument || e, e, l.SHOW_TEXT | l.SHOW_COMMENT | l.SHOW_CDATA_SECTION | l.SHOW_PROCESSING_INSTRUCTION, null), n = t.nextNode();
|
|
519
|
+
for (; n;) n.data = q(n.data), n = t.nextNode();
|
|
520
|
+
let r = e.querySelectorAll?.call(e, "template");
|
|
521
|
+
r && arrayForEach(r, (e) => {
|
|
522
|
+
X(e.content) && J(e.content);
|
|
523
|
+
});
|
|
524
|
+
}, Y = function(e) {
|
|
525
|
+
let t = _ ? _(e) : null;
|
|
526
|
+
return typeof t != "string" || H(t) !== "form" ? !1 : typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || e.attributes !== rt(e) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function" || e.nodeType !== g(e) || e.childNodes !== m(e);
|
|
527
|
+
}, X = function(e) {
|
|
528
|
+
if (!g || typeof e != "object" || !e) return !1;
|
|
529
|
+
try {
|
|
530
|
+
return g(e) === NODE_TYPE.documentFragment;
|
|
531
|
+
} catch {
|
|
532
|
+
return !1;
|
|
533
|
+
}
|
|
534
|
+
}, Z = function(e) {
|
|
535
|
+
if (!g || typeof e != "object" || !e) return !1;
|
|
536
|
+
try {
|
|
537
|
+
return typeof g(e) == "number";
|
|
538
|
+
} catch {
|
|
539
|
+
return !1;
|
|
540
|
+
}
|
|
445
541
|
};
|
|
446
542
|
function Q(e, n, r) {
|
|
447
|
-
arrayForEach(e, (e) => {
|
|
448
|
-
e.call(t, n, r,
|
|
543
|
+
e.length !== 0 && arrayForEach(e, (e) => {
|
|
544
|
+
e.call(t, n, r, U);
|
|
449
545
|
});
|
|
450
546
|
}
|
|
451
|
-
let
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
if (
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
let t = h(e) || e.parentNode, n = $e(e) || e.childNodes;
|
|
463
|
-
if (n && t) {
|
|
464
|
-
let r = n.length;
|
|
465
|
-
for (let i = r - 1; i >= 0; --i) {
|
|
466
|
-
let r = Xe(n[i], !0);
|
|
467
|
-
t.insertBefore(r, Qe(e));
|
|
468
|
-
}
|
|
547
|
+
let mn = function(e, t) {
|
|
548
|
+
return !!(A && e.hasChildNodes() && !Z(e.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, e.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, e.innerHTML) || A && e.namespaceURI === z && t === "style" && Z(e.firstElementChild) || e.nodeType === NODE_TYPE.processingInstruction || A && e.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, e.data));
|
|
549
|
+
}, hn = function(e, t) {
|
|
550
|
+
if (!D[t] && yn(t) && (E.tagNameCheck instanceof RegExp && regExpTest(E.tagNameCheck, t) || E.tagNameCheck instanceof Function && E.tagNameCheck(t))) return !1;
|
|
551
|
+
if (Lt && !I[t]) {
|
|
552
|
+
let t = h(e), n = m(e);
|
|
553
|
+
if (n && t) {
|
|
554
|
+
let r = n.length;
|
|
555
|
+
for (let i = r - 1; i >= 0; --i) {
|
|
556
|
+
let r = Rt ? n[i] : $e(n[i], !0);
|
|
557
|
+
t.insertBefore(r, tt(e));
|
|
469
558
|
}
|
|
470
559
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
if (
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
560
|
+
}
|
|
561
|
+
return W(e), !0;
|
|
562
|
+
}, gn = function(e, n) {
|
|
563
|
+
if (Q(C.beforeSanitizeElements, e, null), e !== n && h(e) === null) return !0;
|
|
564
|
+
if (Y(e)) return W(e), !0;
|
|
565
|
+
let r = H(_ ? _(e) : e.nodeName);
|
|
566
|
+
if (Q(C.uponSanitizeElement, e, {
|
|
567
|
+
tagName: r,
|
|
568
|
+
allowedTags: w
|
|
569
|
+
}), e !== n && h(e) === null) return !0;
|
|
570
|
+
if (mn(e, r)) return W(e), !0;
|
|
571
|
+
if (D[r] || !(O.tagCheck instanceof Function && O.tagCheck(r)) && !w[r]) {
|
|
572
|
+
let t = hn(e, r);
|
|
573
|
+
return t === !1 && Q(C.afterSanitizeElements, e, null), t;
|
|
574
|
+
}
|
|
575
|
+
if ((g ? g(e) : e.nodeType) === NODE_TYPE.element && !cn(e) || (r === "noscript" || r === "noembed" || r === "noframes") && regExpTest(FALLBACK_TAG_CLOSE, e.innerHTML)) return W(e), !0;
|
|
576
|
+
if (k && e.nodeType === NODE_TYPE.text) {
|
|
577
|
+
let n = q(e.textContent);
|
|
578
|
+
e.textContent !== n && (arrayPush(t.removed, { element: e.cloneNode() }), e.textContent = n);
|
|
579
|
+
}
|
|
580
|
+
return Q(C.afterSanitizeElements, e, null), !1;
|
|
581
|
+
}, _n = function(e, t, r) {
|
|
582
|
+
if (Tt[t] || A && t === "patchsrc" || A && t === "for" && e !== "label" && e !== "output" || Pt && (t === "id" || t === "name") && (r in n || r in $t)) return !1;
|
|
583
|
+
let i = T[t] || O.attributeCheck instanceof Function && O.attributeCheck(t, e);
|
|
584
|
+
if (!(Dt && regExpTest(_t, t)) && !(Et && regExpTest(vt, t))) {
|
|
585
|
+
if (i) {
|
|
586
|
+
if (!Ht[t] && !regExpTest(St, stringReplace(r, bt, "")) && !((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && stringIndexOf(r, "data:") === 0 && Bt[e]) && !(Ot && !regExpTest(yt, stringReplace(r, bt, ""))) && r) return !1;
|
|
587
|
+
} else if (!(yn(e) && (E.tagNameCheck instanceof RegExp && regExpTest(E.tagNameCheck, e) || E.tagNameCheck instanceof Function && E.tagNameCheck(e)) && (E.attributeNameCheck instanceof RegExp && regExpTest(E.attributeNameCheck, t) || E.attributeNameCheck instanceof Function && E.attributeNameCheck(t, e)) || t === "is" && E.allowCustomizedBuiltInElements && (E.tagNameCheck instanceof RegExp && regExpTest(E.tagNameCheck, r) || E.tagNameCheck instanceof Function && E.tagNameCheck(r)))) return !1;
|
|
487
588
|
}
|
|
488
589
|
return !0;
|
|
489
|
-
},
|
|
590
|
+
}, vn = addToSet({}, [
|
|
490
591
|
"annotation-xml",
|
|
491
592
|
"color-profile",
|
|
492
593
|
"font-face",
|
|
@@ -495,144 +596,166 @@ function createDOMPurify() {
|
|
|
495
596
|
"font-face-src",
|
|
496
597
|
"font-face-uri",
|
|
497
598
|
"missing-glyph"
|
|
498
|
-
]),
|
|
499
|
-
return !
|
|
500
|
-
},
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
599
|
+
]), yn = function(e) {
|
|
600
|
+
return !vn[stringToLowerCase(e)] && regExpTest(xt, e);
|
|
601
|
+
}, bn = function(e, t, n, r) {
|
|
602
|
+
if (v && typeof f == "object" && typeof f.getAttributeType == "function" && !n) switch (f.getAttributeType(e, t)) {
|
|
603
|
+
case "TrustedHTML": return x(r);
|
|
604
|
+
case "TrustedScriptURL": return st(r);
|
|
605
|
+
}
|
|
606
|
+
return r;
|
|
607
|
+
}, xn = function(e, n, r, i) {
|
|
608
|
+
try {
|
|
609
|
+
r ? e.setAttributeNS(r, n, i) : e.setAttribute(n, i), Y(e) ? W(e) : arrayPop(t.removed);
|
|
610
|
+
} catch {
|
|
611
|
+
K(n, e);
|
|
612
|
+
}
|
|
613
|
+
}, Sn = function(e) {
|
|
614
|
+
Q(C.beforeSanitizeAttributes, e, null);
|
|
615
|
+
let t = e.attributes;
|
|
616
|
+
if (!t || Y(e)) return;
|
|
617
|
+
let n = {
|
|
505
618
|
attrName: "",
|
|
506
619
|
attrValue: "",
|
|
507
620
|
keepAttr: !0,
|
|
508
621
|
allowedAttributes: T,
|
|
509
622
|
forceKeepAttr: void 0
|
|
510
|
-
}, i =
|
|
511
|
-
for (;
|
|
512
|
-
let a =
|
|
513
|
-
if (
|
|
514
|
-
|
|
623
|
+
}, r = t.length, i = H(e.nodeName);
|
|
624
|
+
for (; r--;) {
|
|
625
|
+
let a = t[r], o = a.name, s = a.namespaceURI, c = a.value, l = H(o), u = c, d = o === "value" ? u : stringTrim(u);
|
|
626
|
+
if (n.attrName = l, n.attrValue = d, n.keepAttr = !0, n.forceKeepAttr = void 0, Q(C.uponSanitizeAttribute, e, n), d = n.attrValue, Ft && (l === "id" || l === "name") && stringIndexOf(d, It) !== 0 && (K(o, e), d = It + d), A && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, d)) {
|
|
627
|
+
K(o, e);
|
|
515
628
|
continue;
|
|
516
629
|
}
|
|
517
630
|
if (l === "attributename" && stringMatch(d, "href")) {
|
|
518
|
-
|
|
631
|
+
K(o, e);
|
|
519
632
|
continue;
|
|
520
633
|
}
|
|
521
|
-
if (
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
634
|
+
if (!n.forceKeepAttr) {
|
|
635
|
+
if (!n.keepAttr) {
|
|
636
|
+
K(o, e);
|
|
637
|
+
continue;
|
|
638
|
+
}
|
|
639
|
+
if (!kt && regExpTest(SELF_CLOSING_TAG, d)) {
|
|
640
|
+
K(o, e);
|
|
641
|
+
continue;
|
|
642
|
+
}
|
|
643
|
+
if (k && (d = q(d)), !_n(i, l, d)) {
|
|
644
|
+
K(o, e);
|
|
645
|
+
continue;
|
|
646
|
+
}
|
|
647
|
+
d = bn(i, l, s, d), d !== u && xn(e, o, s, d);
|
|
525
648
|
}
|
|
526
|
-
|
|
527
|
-
|
|
649
|
+
}
|
|
650
|
+
Q(C.afterSanitizeAttributes, e, null);
|
|
651
|
+
}, $ = function(e) {
|
|
652
|
+
let t = null, n = pn(e);
|
|
653
|
+
for (Q(C.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) if (Q(C.uponSanitizeShadowNode, t, null), gn(t, e), Sn(t), X(t.content) && $(t.content), (g ? g(t) : t.nodeType) === NODE_TYPE.element) {
|
|
654
|
+
let e = nt(t);
|
|
655
|
+
X(e) && (Cn(e), $(e));
|
|
656
|
+
}
|
|
657
|
+
Q(C.afterSanitizeShadowDOM, e, null);
|
|
658
|
+
}, Cn = function(e) {
|
|
659
|
+
let t = [{
|
|
660
|
+
node: e,
|
|
661
|
+
shadow: null
|
|
662
|
+
}];
|
|
663
|
+
for (; t.length > 0;) {
|
|
664
|
+
let e = t.pop();
|
|
665
|
+
if (e.shadow) {
|
|
666
|
+
$(e.shadow);
|
|
528
667
|
continue;
|
|
529
668
|
}
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
], (e) => {
|
|
535
|
-
d = stringReplace(d, e, " ");
|
|
669
|
+
let n = e.node, r = (g ? g(n) : n.nodeType) === NODE_TYPE.element, i = m(n);
|
|
670
|
+
if (i) for (let e = i.length - 1; e >= 0; --e) t.push({
|
|
671
|
+
node: i[e],
|
|
672
|
+
shadow: null
|
|
536
673
|
});
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
case "TrustedScriptURL":
|
|
547
|
-
d = g.createScriptURL(d);
|
|
548
|
-
break;
|
|
674
|
+
if (r) {
|
|
675
|
+
let e = _ ? _(n) : null;
|
|
676
|
+
if (typeof e == "string" && H(e) === "template") {
|
|
677
|
+
let e = n.content;
|
|
678
|
+
X(e) && t.push({
|
|
679
|
+
node: e,
|
|
680
|
+
shadow: null
|
|
681
|
+
});
|
|
682
|
+
}
|
|
549
683
|
}
|
|
550
|
-
if (
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
684
|
+
if (r) {
|
|
685
|
+
let e = nt(n);
|
|
686
|
+
X(e) && t.push({
|
|
687
|
+
node: null,
|
|
688
|
+
shadow: e
|
|
689
|
+
}, {
|
|
690
|
+
node: e,
|
|
691
|
+
shadow: null
|
|
692
|
+
});
|
|
554
693
|
}
|
|
555
694
|
}
|
|
556
|
-
Q(b.afterSanitizeAttributes, e, null);
|
|
557
|
-
}, Gt = function(e) {
|
|
558
|
-
let t = null, n = Lt(e);
|
|
559
|
-
for (Q(b.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) Q(b.uponSanitizeShadowNode, t, null), Bt(t), Wt(t), t.content instanceof a && Gt(t.content);
|
|
560
|
-
Q(b.afterSanitizeShadowDOM, e, null);
|
|
561
|
-
}, $ = function(e) {
|
|
562
|
-
if (e.nodeType === NODE_TYPE.element && e.shadowRoot instanceof a) {
|
|
563
|
-
let t = e.shadowRoot;
|
|
564
|
-
$(t), Gt(t);
|
|
565
|
-
}
|
|
566
|
-
let t = e.childNodes;
|
|
567
|
-
if (!t) return;
|
|
568
|
-
let n = [];
|
|
569
|
-
arrayForEach(t, (e) => {
|
|
570
|
-
arrayPush(n, e);
|
|
571
|
-
});
|
|
572
|
-
for (let e of n) $(e);
|
|
573
695
|
};
|
|
574
696
|
return t.sanitize = function(e) {
|
|
575
|
-
let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null,
|
|
576
|
-
if (
|
|
697
|
+
let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null, a = null, o = null, s = null;
|
|
698
|
+
if (Wt = !e, Wt && (e = "<!-->"), typeof e != "string" && !Z(e) && (e = stringifyValue(e), typeof e != "string")) throw typeErrorCreate("dirty is not a string, aborting");
|
|
577
699
|
if (!t.isSupported) return e;
|
|
578
|
-
|
|
579
|
-
|
|
700
|
+
At ? (w = jt, T = Mt) : tn(n), (C.uponSanitizeElement.length > 0 || C.uponSanitizeAttribute.length > 0) && (w = clone(w)), C.uponSanitizeAttribute.length > 0 && (T = clone(T)), t.removed = [];
|
|
701
|
+
let c = Rt && typeof e != "string" && Z(e);
|
|
702
|
+
if (c) {
|
|
703
|
+
dn(e);
|
|
704
|
+
let t = _ ? _(e) : e.nodeName;
|
|
580
705
|
if (typeof t == "string") {
|
|
581
|
-
let
|
|
582
|
-
if (!w[
|
|
706
|
+
let n = H(t);
|
|
707
|
+
if (!w[n] || D[n]) throw G(e), typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
|
|
583
708
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
}
|
|
590
|
-
i && F && X(i.firstChild);
|
|
591
|
-
let u = Lt(B ? e : i);
|
|
592
|
-
for (; s = u.nextNode();) Bt(s), Wt(s), s.content instanceof a && Gt(s.content);
|
|
593
|
-
if (B) return e;
|
|
594
|
-
if (I) {
|
|
595
|
-
if (j) {
|
|
596
|
-
i.normalize();
|
|
597
|
-
let e = i.innerHTML;
|
|
598
|
-
arrayForEach([
|
|
599
|
-
x,
|
|
600
|
-
S,
|
|
601
|
-
C
|
|
602
|
-
], (t) => {
|
|
603
|
-
e = stringReplace(e, t, " ");
|
|
604
|
-
}), i.innerHTML = e;
|
|
709
|
+
if (Y(e)) throw G(e), typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
|
|
710
|
+
try {
|
|
711
|
+
Cn(e);
|
|
712
|
+
} catch (t) {
|
|
713
|
+
throw G(e), t;
|
|
605
714
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
715
|
+
} else if (Z(e)) i = fn("<!---->"), a = i.ownerDocument.importNode(e, !0), a.nodeType === NODE_TYPE.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? i = a : i.appendChild(a), Cn(a);
|
|
716
|
+
else {
|
|
717
|
+
if (!M && !k && !j && e.indexOf("<") === -1) return v && P ? x(e) : e;
|
|
718
|
+
if (i = fn(e), !i) return M ? null : P ? y : "";
|
|
719
|
+
}
|
|
720
|
+
i && Nt && W(i.firstChild);
|
|
721
|
+
let l = c ? e : i, u = pn(l);
|
|
722
|
+
try {
|
|
723
|
+
for (; o = u.nextNode();) gn(o, l), Sn(o), X(o.content) && $(o.content);
|
|
724
|
+
} catch (n) {
|
|
725
|
+
throw c && (G(e), arrayForEach(t.removed, (e) => {
|
|
726
|
+
e.element && un(e.element);
|
|
727
|
+
})), n;
|
|
728
|
+
}
|
|
729
|
+
if (c) return arrayForEach(t.removed, (e) => {
|
|
730
|
+
e.element && un(e.element);
|
|
731
|
+
}), k && J(e), e;
|
|
732
|
+
if (M) {
|
|
733
|
+
if (k && J(i), N) for (s = dt.call(i.ownerDocument); i.firstChild;) s.appendChild(i.firstChild);
|
|
734
|
+
else s = i;
|
|
735
|
+
return (T.shadowroot || T.shadowrootmode) && (s = pt.call(r, s, !0)), s;
|
|
736
|
+
}
|
|
737
|
+
let d = j ? i.outerHTML : i.innerHTML;
|
|
738
|
+
return j && w["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, i.ownerDocument.doctype.name) && (d = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + d), k && (d = q(d)), v && P ? x(d) : d;
|
|
618
739
|
}, t.setConfig = function() {
|
|
619
|
-
|
|
740
|
+
tn(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), At = !0, jt = w, Mt = T;
|
|
620
741
|
}, t.clearConfig = function() {
|
|
621
|
-
|
|
742
|
+
U = null, At = !1, jt = null, Mt = null, v = it, y = "";
|
|
622
743
|
}, t.isValidAttribute = function(e, t, n) {
|
|
623
|
-
return
|
|
744
|
+
return U || tn({}), _n(H(e), H(t), n);
|
|
624
745
|
}, t.addHook = function(e, t) {
|
|
625
|
-
typeof t == "function" && arrayPush(
|
|
746
|
+
typeof t == "function" && objectHasOwnProperty(C, e) && arrayPush(C[e], t);
|
|
626
747
|
}, t.removeHook = function(e, t) {
|
|
627
|
-
if (
|
|
628
|
-
|
|
629
|
-
|
|
748
|
+
if (objectHasOwnProperty(C, e)) {
|
|
749
|
+
if (t !== void 0) {
|
|
750
|
+
let n = arrayLastIndexOf(C[e], t);
|
|
751
|
+
return n === -1 ? void 0 : arraySplice(C[e], n, 1)[0];
|
|
752
|
+
}
|
|
753
|
+
return arrayPop(C[e]);
|
|
630
754
|
}
|
|
631
|
-
return arrayPop(b[e]);
|
|
632
755
|
}, t.removeHooks = function(e) {
|
|
633
|
-
|
|
756
|
+
objectHasOwnProperty(C, e) && (C[e] = []);
|
|
634
757
|
}, t.removeAllHooks = function() {
|
|
635
|
-
|
|
758
|
+
C = _createHooksMap();
|
|
636
759
|
}, t;
|
|
637
760
|
}
|
|
638
761
|
var purify = createDOMPurify();
|