UNPKG

@digital-blueprint/esign-app

Version:

[GitHub Repository](https://github.com/digital-blueprint/esign-app) | [npmjs package](https://www.npmjs.com/package/@digital-blueprint/esign-app) | [Unpkg CDN](https://unpkg.com/browse/@digital-blueprint/esign-app/) | [Esign Bundle](https://gitlab.tugraz.

39 lines 21.4 kB
/*! * License: LGPL-2.1-or-later * Dependencies: * * @webcomponents/scoped-custom-element-registry: BSD-3-Clause * @dbp-toolkit/app-shell: LGPL-2.1-or-later * @dbp-toolkit/language-select: LGPL-2.1-or-later * @dbp-toolkit/auth: LGPL-2.1-or-later * @dbp-toolkit/notification: LGPL-2.1-or-later * @dbp-toolkit/theme-switcher: LGPL-2.1-or-later * universal-router: MIT * @dbp-toolkit/matomo: LGPL-2.1-or-later * @tugraz/web-components: LGPL-2.1-or-later * exceljs: MIT * fabric: MIT * jspdf-autotable: MIT * keycloak-js: Apache-2.0 * jszip: (MIT OR GPL-3.0-or-later) * pdfjs-dist: Apache-2.0 * path2d: MIT * fflate: MIT * @babel/runtime: MIT * iobuffer: MIT * pako: (MIT AND Zlib) * fast-png: MIT * jspdf: MIT * core-js: MIT * performance-now: MIT * raf: MIT * rgbcolor: MIT OR SEE LICENSE IN FEEL-FREE.md * svg-pathdata: MIT * stackblur-canvas: MIT * canvg: MIT * dompurify: (MPL-2.0 OR Apache-2.0) */ /*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */ const{entries:e,setPrototypeOf:t,isFrozen:n,getPrototypeOf:r,getOwnPropertyDescriptor:i}=Object;let{freeze:a,seal:o,create:s}=Object,{apply:c,construct:l}=typeof Reflect<`u`&&Reflect;a||=function(e){return e},o||=function(e){return e},c||=function(e,t,n){return e.apply(t,n)},l||=function(e,t){return new e(...t)};const u=_(Array.prototype.forEach),d=_(Array.prototype.lastIndexOf),ee=_(Array.prototype.pop),f=_(Array.prototype.push),te=_(Array.prototype.splice),ne=_(String.prototype.toLowerCase),re=_(String.prototype.toString),ie=_(String.prototype.match),p=_(String.prototype.replace),ae=_(String.prototype.indexOf),oe=_(String.prototype.trim),m=_(Object.prototype.hasOwnProperty),h=_(RegExp.prototype.test),g=se(TypeError);function _(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return c(e,t,n)}}function se(e){return function(){return l(e,[...arguments])}}function v(e,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ne;t&&t(e,null);let a=r.length;for(;a--;){let t=r[a];if(typeof t==`string`){let e=i(t);e!==t&&(n(r)||(r[a]=e),t=e)}e[t]=!0}return e}function y(e){for(let t=0;t<e.length;t++)m(e,t)||(e[t]=null);return e}function b(t){let n=s(null);for(let[r,i]of e(t))m(t,r)&&(Array.isArray(i)?n[r]=y(i):i&&typeof i==`object`&&i.constructor===Object?n[r]=b(i):n[r]=i);return n}function x(e,t){for(;e!==null;){let n=i(e,t);if(n){if(n.get)return _(n.get);if(typeof n.value==`function`)return _(n.value)}e=r(e)}function n(){return null}return n}const ce=a(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.section.select.shadow.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),le=a(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.filter.font.g.glyph.glyphref.hkern.image.line.lineargradient.marker.mask.metadata.mpath.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),ue=a([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),de=a([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),fe=a(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),pe=a([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),me=a([`#text`]),he=a(`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.face.for.headers.height.hidden.high.href.hreflang.id.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.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns.slot`.split(`.`)),ge=a(`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.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(`.`)),_e=a(`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(`.`)),S=a([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),ve=o(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ye=o(/<%[\w\W]*|[\w\W]*%>/gm),be=o(/\$\{[\w\W]*/gm),C=o(/^data-[\-\w.\u00B7-\uFFFF]+$/),w=o(/^aria-[\-\w]+$/),xe=o(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Se=o(/^(?:\w+script|data):/i),Ce=o(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),we=o(/^html$/i),Te=o(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ee=Object.freeze({__proto__:null,ARIA_ATTR:w,ATTR_WHITESPACE:Ce,CUSTOM_ELEMENT:Te,DATA_ATTR:C,DOCTYPE_NAME:we,ERB_EXPR:ye,IS_ALLOWED_URI:xe,IS_SCRIPT_OR_DATA:Se,MUSTACHE_EXPR:ve,TMPLIT_EXPR:be});const T={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},De=function(){return typeof window>`u`?null:window},Oe=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},ke=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ae(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:De(),n=e=>Ae(e);if(n.version=`3.2.6`,n.removed=[],!t||!t.document||t.document.nodeType!==T.document||!t.Element)return n.isSupported=!1,n;let{document:r}=t,i=r,o=i.currentScript,{DocumentFragment:c,HTMLTemplateElement:l,Node:_,Element:se,NodeFilter:y,NamedNodeMap:ve=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:ye,DOMParser:be,trustedTypes:C}=t,w=se.prototype,Se=x(w,`cloneNode`),Ce=x(w,`remove`),Te=x(w,`nextSibling`),je=x(w,`childNodes`),E=x(w,`parentNode`);if(typeof l==`function`){let e=r.createElement(`template`);e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let D,O=``,{implementation:Me,createNodeIterator:Ne,createDocumentFragment:Pe,getElementsByTagName:Fe}=r,{importNode:Ie}=i,k=ke();n.isSupported=typeof e==`function`&&typeof E==`function`&&Me&&Me.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:Le,ERB_EXPR:Re,TMPLIT_EXPR:ze,DATA_ATTR:Be,ARIA_ATTR:Ve,IS_SCRIPT_OR_DATA:He,ATTR_WHITESPACE:Ue,CUSTOM_ELEMENT:We}=Ee,{IS_ALLOWED_URI:Ge}=Ee,A=null,Ke=v({},[...ce,...le,...ue,...fe,...me]),j=null,qe=v({},[...he,...ge,..._e,...S]),M=Object.seal(s(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),N=null,Je=null,Ye=!0,Xe=!0,Ze=!1,Qe=!0,P=!1,F=!0,I=!1,$e=!1,et=!1,L=!1,R=!1,z=!1,tt=!0,nt=!1,rt=!0,B=!1,V={},H=null,it=v({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),at=null,ot=v({},[`audio`,`video`,`img`,`source`,`image`,`track`]),st=null,ct=v({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),U=`http://www.w3.org/1998/Math/MathML`,W=`http://www.w3.org/2000/svg`,G=`http://www.w3.org/1999/xhtml`,K=G,lt=!1,ut=null,dt=v({},[U,W,G],re),q=v({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),ft=v({},[`annotation-xml`]),pt=v({},[`title`,`style`,`font`,`a`,`script`]),J=null,mt=[`application/xhtml+xml`,`text/html`],Y=null,X=null,ht=r.createElement(`form`),gt=function(e){return e instanceof RegExp||e instanceof Function},_t=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(X&&X===e)){if((!e||typeof e!=`object`)&&(e={}),e=b(e),J=mt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Y=J===`application/xhtml+xml`?re:ne,A=m(e,`ALLOWED_TAGS`)?v({},e.ALLOWED_TAGS,Y):Ke,j=m(e,`ALLOWED_ATTR`)?v({},e.ALLOWED_ATTR,Y):qe,ut=m(e,`ALLOWED_NAMESPACES`)?v({},e.ALLOWED_NAMESPACES,re):dt,st=m(e,`ADD_URI_SAFE_ATTR`)?v(b(ct),e.ADD_URI_SAFE_ATTR,Y):ct,at=m(e,`ADD_DATA_URI_TAGS`)?v(b(ot),e.ADD_DATA_URI_TAGS,Y):ot,H=m(e,`FORBID_CONTENTS`)?v({},e.FORBID_CONTENTS,Y):it,N=m(e,`FORBID_TAGS`)?v({},e.FORBID_TAGS,Y):b({}),Je=m(e,`FORBID_ATTR`)?v({},e.FORBID_ATTR,Y):b({}),V=m(e,`USE_PROFILES`)?e.USE_PROFILES:!1,Ye=e.ALLOW_ARIA_ATTR!==!1,Xe=e.ALLOW_DATA_ATTR!==!1,Ze=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Qe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,P=e.SAFE_FOR_TEMPLATES||!1,F=e.SAFE_FOR_XML!==!1,I=e.WHOLE_DOCUMENT||!1,L=e.RETURN_DOM||!1,R=e.RETURN_DOM_FRAGMENT||!1,z=e.RETURN_TRUSTED_TYPE||!1,et=e.FORCE_BODY||!1,tt=e.SANITIZE_DOM!==!1,nt=e.SANITIZE_NAMED_PROPS||!1,rt=e.KEEP_CONTENT!==!1,B=e.IN_PLACE||!1,Ge=e.ALLOWED_URI_REGEXP||xe,K=e.NAMESPACE||G,q=e.MATHML_TEXT_INTEGRATION_POINTS||q,ft=e.HTML_INTEGRATION_POINTS||ft,M=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&gt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(M.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&gt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(M.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==`boolean`&&(M.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),P&&(Xe=!1),R&&(L=!0),V&&(A=v({},me),j=[],V.html===!0&&(v(A,ce),v(j,he)),V.svg===!0&&(v(A,le),v(j,ge),v(j,S)),V.svgFilters===!0&&(v(A,ue),v(j,ge),v(j,S)),V.mathMl===!0&&(v(A,fe),v(j,_e),v(j,S))),e.ADD_TAGS&&(A===Ke&&(A=b(A)),v(A,e.ADD_TAGS,Y)),e.ADD_ATTR&&(j===qe&&(j=b(j)),v(j,e.ADD_ATTR,Y)),e.ADD_URI_SAFE_ATTR&&v(st,e.ADD_URI_SAFE_ATTR,Y),e.FORBID_CONTENTS&&(H===it&&(H=b(H)),v(H,e.FORBID_CONTENTS,Y)),rt&&(A[`#text`]=!0),I&&v(A,[`html`,`head`,`body`]),A.table&&(v(A,[`tbody`]),delete N.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw g(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw g(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);D=e.TRUSTED_TYPES_POLICY,O=D.createHTML(``)}else D===void 0&&(D=Oe(C,o)),D!==null&&typeof O==`string`&&(O=D.createHTML(``));a&&a(e),X=e}},vt=v({},[...le,...ue,...de]),yt=v({},[...fe,...pe]),bt=function(e){let t=E(e);(!t||!t.tagName)&&(t={namespaceURI:K,tagName:`template`});let n=ne(e.tagName),r=ne(t.tagName);return ut[e.namespaceURI]?e.namespaceURI===W?t.namespaceURI===G?n===`svg`:t.namespaceURI===U?n===`svg`&&(r===`annotation-xml`||q[r]):!!vt[n]:e.namespaceURI===U?t.namespaceURI===G?n===`math`:t.namespaceURI===W?n===`math`&&ft[r]:!!yt[n]:e.namespaceURI===G?t.namespaceURI===W&&!ft[r]||t.namespaceURI===U&&!q[r]?!1:!yt[n]&&(pt[n]||!vt[n]):!!(J===`application/xhtml+xml`&&ut[e.namespaceURI]):!1},Z=function(e){f(n.removed,{element:e});try{E(e).removeChild(e)}catch{Ce(e)}},Q=function(e,t){try{f(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch{f(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e===`is`)if(L||R)try{Z(t)}catch{}else try{t.setAttribute(e,``)}catch{}},xt=function(e){let t=null,n=null;if(et)e=`<remove></remove>`+e;else{let t=ie(e,/^[\r\n\t ]+/);n=t&&t[0]}J===`application/xhtml+xml`&&K===G&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=D?D.createHTML(e):e;if(K===G)try{t=new be().parseFromString(i,J)}catch{}if(!t||!t.documentElement){t=Me.createDocument(K,`template`,null);try{t.documentElement.innerHTML=lt?O:i}catch{}}let a=t.body||t.documentElement;return e&&n&&a.insertBefore(r.createTextNode(n),a.childNodes[0]||null),K===G?Fe.call(t,I?`html`:`body`)[0]:I?t.documentElement:a},St=function(e){return Ne.call(e.ownerDocument||e,e,y.SHOW_ELEMENT|y.SHOW_COMMENT|y.SHOW_TEXT|y.SHOW_PROCESSING_INSTRUCTION|y.SHOW_CDATA_SECTION,null)},Ct=function(e){return e instanceof ye&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof ve)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},wt=function(e){return typeof _==`function`&&e instanceof _};function $(e,t,r){u(e,e=>{e.call(n,t,r,X)})}let Tt=function(e){let t=null;if($(k.beforeSanitizeElements,e,null),Ct(e))return Z(e),!0;let r=Y(e.nodeName);if($(k.uponSanitizeElement,e,{tagName:r,allowedTags:A}),F&&e.hasChildNodes()&&!wt(e.firstElementChild)&&h(/<[/\w!]/g,e.innerHTML)&&h(/<[/\w!]/g,e.textContent)||e.nodeType===T.progressingInstruction||F&&e.nodeType===T.comment&&h(/<[/\w]/g,e.data))return Z(e),!0;if(!A[r]||N[r]){if(!N[r]&&Dt(r)&&(M.tagNameCheck instanceof RegExp&&h(M.tagNameCheck,r)||M.tagNameCheck instanceof Function&&M.tagNameCheck(r)))return!1;if(rt&&!H[r]){let t=E(e)||e.parentNode,n=je(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=Se(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,Te(e))}}}return Z(e),!0}return e instanceof se&&!bt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&h(/<\/no(script|embed|frames)/i,e.innerHTML)?(Z(e),!0):(P&&e.nodeType===T.text&&(t=e.textContent,u([Le,Re,ze],e=>{t=p(t,e,` `)}),e.textContent!==t&&(f(n.removed,{element:e.cloneNode()}),e.textContent=t)),$(k.afterSanitizeElements,e,null),!1)},Et=function(e,t,n){if(tt&&(t===`id`||t===`name`)&&(n in r||n in ht))return!1;if(!(Xe&&!Je[t]&&h(Be,t))&&!(Ye&&h(Ve,t))){if(!j[t]||Je[t]){if(!(Dt(e)&&(M.tagNameCheck instanceof RegExp&&h(M.tagNameCheck,e)||M.tagNameCheck instanceof Function&&M.tagNameCheck(e))&&(M.attributeNameCheck instanceof RegExp&&h(M.attributeNameCheck,t)||M.attributeNameCheck instanceof Function&&M.attributeNameCheck(t))||t===`is`&&M.allowCustomizedBuiltInElements&&(M.tagNameCheck instanceof RegExp&&h(M.tagNameCheck,n)||M.tagNameCheck instanceof Function&&M.tagNameCheck(n))))return!1}else if(!st[t]&&!h(Ge,p(n,Ue,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&ae(n,`data:`)===0&&at[e])&&!(Ze&&!h(He,p(n,Ue,``)))&&n)return!1}return!0},Dt=function(e){return e!==`annotation-xml`&&ie(e,We)},Ot=function(e){$(k.beforeSanitizeAttributes,e,null);let{attributes:t}=e;if(!t||Ct(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:j,forceKeepAttr:void 0},i=t.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=t[i],c=Y(a),l=s,d=a===`value`?l:oe(l);if(r.attrName=c,r.attrValue=d,r.keepAttr=!0,r.forceKeepAttr=void 0,$(k.uponSanitizeAttribute,e,r),d=r.attrValue,nt&&(c===`id`||c===`name`)&&(Q(a,e),d=`user-content-`+d),F&&h(/((--!?|])>)|<\/(style|title)/i,d)){Q(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Q(a,e);continue}if(!Qe&&h(/\/>/i,d)){Q(a,e);continue}P&&u([Le,Re,ze],e=>{d=p(d,e,` `)});let f=Y(e.nodeName);if(!Et(f,c,d)){Q(a,e);continue}if(D&&typeof C==`object`&&typeof C.getAttributeType==`function`&&!o)switch(C.getAttributeType(f,c)){case`TrustedHTML`:d=D.createHTML(d);break;case`TrustedScriptURL`:d=D.createScriptURL(d);break}if(d!==l)try{o?e.setAttributeNS(o,a,d):e.setAttribute(a,d),Ct(e)?Z(e):ee(n.removed)}catch{Q(a,e)}}$(k.afterSanitizeAttributes,e,null)},kt=function e(t){let n=null,r=St(t);for($(k.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)$(k.uponSanitizeShadowNode,n,null),Tt(n),Ot(n),n.content instanceof c&&e(n.content);$(k.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=null,a=null,o=null,s=null;if(lt=!e,lt&&(e=`<!-->`),typeof e!=`string`&&!wt(e))if(typeof e.toString==`function`){if(e=e.toString(),typeof e!=`string`)throw g(`dirty is not a string, aborting`)}else throw g(`toString is not a function`);if(!n.isSupported)return e;if($e||_t(t),n.removed=[],typeof e==`string`&&(B=!1),B){if(e.nodeName){let t=Y(e.nodeName);if(!A[t]||N[t])throw g(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof _)r=xt(`<!---->`),a=r.ownerDocument.importNode(e,!0),a.nodeType===T.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?r=a:r.appendChild(a);else{if(!L&&!P&&!I&&e.indexOf(`<`)===-1)return D&&z?D.createHTML(e):e;if(r=xt(e),!r)return L?null:z?O:``}r&&et&&Z(r.firstChild);let l=St(B?e:r);for(;o=l.nextNode();)Tt(o),Ot(o),o.content instanceof c&&kt(o.content);if(B)return e;if(L){if(R)for(s=Pe.call(r.ownerDocument);r.firstChild;)s.appendChild(r.firstChild);else s=r;return(j.shadowroot||j.shadowrootmode)&&(s=Ie.call(i,s,!0)),s}let d=I?r.outerHTML:r.innerHTML;return I&&A[`!doctype`]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&h(we,r.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+r.ownerDocument.doctype.name+`> `+d),P&&u([Le,Re,ze],e=>{d=p(d,e,` `)}),D&&z?D.createHTML(d):d},n.setConfig=function(){_t(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),$e=!0},n.clearConfig=function(){X=null,$e=!1},n.isValidAttribute=function(e,t,n){return X||_t({}),Et(Y(e),Y(t),n)},n.addHook=function(e,t){typeof t==`function`&&f(k[e],t)},n.removeHook=function(e,t){if(t!==void 0){let n=d(k[e],t);return n===-1?void 0:te(k[e],n,1)[0]}return ee(k[e])},n.removeHooks=function(e){k[e]=[]},n.removeAllHooks=function(){k=ke()},n}var je=Ae();export{je as default}; //# sourceMappingURL=purify.es.Dbi_3ORQ.js.map