332 lines
442 KiB
JavaScript
332 lines
442 KiB
JavaScript
|
|
/**
|
||
|
|
* TinyMCE version 7.8.0 (TBD)
|
||
|
|
*/
|
||
|
|
!function(){"use strict";const e=Object.getPrototypeOf,t=(e,t,o)=>{var n;return!!o(e,t.prototype)||(null===(n=e.constructor)||void 0===n?void 0:n.name)===t.name},o=e=>o=>(e=>{const o=typeof e;return null===e?"null":"object"===o&&Array.isArray(e)?"array":"object"===o&&t(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":o})(o)===e,n=e=>t=>typeof t===e,s=e=>t=>e===t,r=o("string"),a=o("object"),i=o=>((o,n)=>a(o)&&t(o,n,((t,o)=>e(t)===o)))(o,Object),l=o("array"),c=s(null),d=n("boolean"),u=s(void 0),m=e=>null==e,g=e=>!m(e),p=n("function"),h=n("number"),f=(e,t)=>{if(l(e)){for(let o=0,n=e.length;o<n;++o)if(!t(e[o]))return!1;return!0}return!1},b=()=>{},v=e=>()=>e(),x=(e,t)=>(...o)=>e(t.apply(null,o)),y=e=>()=>e,w=e=>e,S=(e,t)=>e===t;function C(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const k=e=>t=>!e(t),O=e=>()=>{throw new Error(e)},_=e=>e(),T=y(!1),E=y(!0);class A{constructor(e,t){this.tag=e,this.value=t}static some(e){return new A(!0,e)}static none(){return A.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?A.some(e(this.value)):A.none()}bind(e){return this.tag?e(this.value):A.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:A.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return g(e)?A.some(e):A.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}A.singletonNone=new A(!1);const M=Array.prototype.slice,D=Array.prototype.indexOf,B=Array.prototype.push,I=(e,t)=>D.call(e,t),F=(e,t)=>I(e,t)>-1,R=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return!0;return!1},N=(e,t)=>{const o=[];for(let n=0;n<e;n++)o.push(t(n));return o},z=(e,t)=>{const o=[];for(let n=0;n<e.length;n+=t){const s=M.call(e,n,n+t);o.push(s)}return o},L=(e,t)=>{const o=e.length,n=new Array(o);for(let s=0;s<o;s++){const o=e[s];n[s]=t(o,s)}return n},V=(e,t)=>{for(let o=0,n=e.length;o<n;o++)t(e[o],o)},H=(e,t)=>{const o=[],n=[];for(let s=0,r=e.length;s<r;s++){const r=e[s];(t(r,s)?o:n).push(r)}return{pass:o,fail:n}},P=(e,t)=>{const o=[];for(let n=0,s=e.length;n<s;n++){const s=e[n];t(s,n)&&o.push(s)}return o},U=(e,t,o)=>(((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(e,((e,n)=>{o=t(o,e,n)})),o),W=(e,t,o)=>(V(e,((e,n)=>{o=t(o,e,n)})),o),$=(e,t)=>((e,t,o)=>{for(let n=0,s=e.length;n<s;n++){const s=e[n];if(t(s,n))return A.some(s);if(o(s,n))break}return A.none()})(e,t,T),G=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return A.some(o);return A.none()},j=e=>{const t=[];for(let o=0,n=e.length;o<n;++o){if(!l(e[o]))throw new Error("Arr.flatten item "+o+" was not an array, input: "+e);B.apply(t,e[o])}return t},q=(e,t)=>j(L(e,t)),X=(e,t)=>{for(let o=0,n=e.length;o<n;++o)if(!0!==t(e[o],o))return!1;return!0},Y=e=>{const t=M.call(e,0);return t.reverse(),t},K=(e,t)=>P(e,(e=>!F(t,e))),J=(e,t)=>{const o={};for(let n=0,s=e.length;n<s;n++){const s=e[n];o[String(s)]=t(s,n)}return o},Q=e=>[e],Z=(e,t)=>{const o=M.call(e,0);return o.sort(t),o},ee=(e,t)=>t>=0&&t<e.length?A.some(e[t]):A.none(),te=e=>ee(e,0),oe=e=>ee(e,e.length-1),ne=p(Array.from)?Array.from:e=>M.call(e),se=(e,t)=>{for(let o=0;o<e.length;o++){const n=t(e[o],o);if(n.isSome())return n}return A.none()},re=Object.keys,ae=Object.hasOwnProperty,ie=(e,t)=>{const o=re(e);for(let n=0,s=o.length;n<s;n++){const s=o[n];t(e[s],s)}},le=(e,t)=>ce(e,((e,o)=>({k:o,v:t(e,o)}))),ce=(e,t)=>{const o={};return ie(e,((e,n)=>{const s=t(e,n);o[s.k]=s.v})),o},de=e=>(t,o)=>{e[o]=t},ue=(e,t,o,n)=>{ie(e,((e,s)=>{(t(e,s)?o:n)(e,s)}))},me=(e,t)=>{const o={};return ue(e,t,de(o),b),o},ge=(e,t)=>{const o=[];return ie(e,((e,n)=>{o.push(t(e,n))})),o},pe=(e,t)=>{const o=re(e);for(let n=0,
|
||
|
|
/*! @license DOMPurify 3.2.4 | (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.4/LICENSE */let{freeze:av,seal:iv,create:lv}=Object,{apply:cv,construct:dv}="undefined"!=typeof Reflect&&Reflect;// eslint-disable-line import/no-mutable-exports
|
||
|
|
av||(av=function(e){return e}),iv||(iv=function(e){return e}),cv||(cv=function(e,t,o){return e.apply(t,o)}),dv||(dv=function(e,t){return new e(...t)});const uv=_v(Array.prototype.forEach),mv=_v(Array.prototype.lastIndexOf),gv=_v(Array.prototype.pop),pv=_v(Array.prototype.push),hv=_v(Array.prototype.splice),fv=_v(String.prototype.toLowerCase),bv=_v(String.prototype.toString),vv=_v(String.prototype.match),xv=_v(String.prototype.replace),yv=_v(String.prototype.indexOf),wv=_v(String.prototype.trim),Sv=_v(Object.prototype.hasOwnProperty),Cv=_v(RegExp.prototype.test),kv=(Ov=TypeError,function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return dv(Ov,t)});
|
||
|
|
/**
|
||
|
|
* Creates a new function that constructs an instance of the given constructor function with the provided arguments.
|
||
|
|
*
|
||
|
|
* @param func - The constructor function to be wrapped and called.
|
||
|
|
* @returns A new function that constructs an instance of the given constructor function with the provided arguments.
|
||
|
|
*/
|
||
|
|
var Ov;
|
||
|
|
/**
|
||
|
|
* Add properties to a lookup table
|
||
|
|
*
|
||
|
|
* @param set - The set to which elements will be added.
|
||
|
|
* @param array - The array containing elements to be added to the set.
|
||
|
|
* @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
|
||
|
|
* @returns The modified set with added elements.
|
||
|
|
*/
|
||
|
|
/**
|
||
|
|
* Creates a new function that calls the given function with a specified thisArg and arguments.
|
||
|
|
*
|
||
|
|
* @param func - The function to be wrapped and called.
|
||
|
|
* @returns A new function that calls the given function with a specified thisArg and arguments.
|
||
|
|
*/
|
||
|
|
function _v(e){return function(t){for(var o=arguments.length,n=new Array(o>1?o-1:0),s=1;s<o;s++)n[s-1]=arguments[s];return cv(e,t,n)}}function Tv(e,t){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:fv;ov&&
|
||
|
|
// Make 'in' and truthy checks like Boolean(set.constructor)
|
||
|
|
// independent of any properties defined on Object.prototype.
|
||
|
|
// Prevent prototype setters from intercepting set as a this value.
|
||
|
|
ov(e,null);let n=t.length;for(;n--;){let s=t[n];if("string"==typeof s){const e=o(s);e!==s&&(
|
||
|
|
// Config presets (e.g. tags.js, attrs.js) are immutable.
|
||
|
|
nv(t)||(t[n]=e),s=e)}e[s]=!0}return e}
|
||
|
|
/**
|
||
|
|
* Clean up an array to harden against CSPP
|
||
|
|
*
|
||
|
|
* @param array - The array to be cleaned.
|
||
|
|
* @returns The cleaned version of the array
|
||
|
|
*/function Ev(e){for(let t=0;t<e.length;t++)Sv(e,t)||(e[t]=null);return e}
|
||
|
|
/**
|
||
|
|
* Shallow clone an object
|
||
|
|
*
|
||
|
|
* @param object - The object to be cloned.
|
||
|
|
* @returns A new object that copies the original.
|
||
|
|
*/function Av(e){const t=lv(null);for(const[o,n]of tv(e))Sv(e,o)&&(Array.isArray(n)?t[o]=Ev(n):n&&"object"==typeof n&&n.constructor===Object?t[o]=Av(n):t[o]=n);return t}
|
||
|
|
/**
|
||
|
|
* This method automatically checks if the prop is function or getter and behaves accordingly.
|
||
|
|
*
|
||
|
|
* @param object - The object to look up the getter function in its prototype chain.
|
||
|
|
* @param prop - The property name for which to find the getter function.
|
||
|
|
* @returns The getter function found in the prototype chain or a fallback function.
|
||
|
|
*/function Mv(e,t){for(;null!==e;){const o=rv(e,t);if(o){if(o.get)return _v(o.get);if("function"==typeof o.value)return _v(o.value)}e=sv(e)}return function(){return null}}const Dv=av(["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"]),Bv=av(["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"]),Iv=av(["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"]),Fv=av(["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"]),Rv=av(["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"]),Nv=av(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),zv=av(["#text"]),Lv=av(["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"]),Vv=av(["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","direct
|
||
|
|
/* eslint-disable @typescript-eslint/indent */
|
||
|
|
// https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
|
||
|
|
const Zv=function(){return"undefined"==typeof window?null:window};var ex=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Zv();const o=t=>e(t);if(o.version="3.2.4",o.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)
|
||
|
|
// Not running in a browser, provide a factory function
|
||
|
|
// so that you can pass your own Window
|
||
|
|
return o.isSupported=!1,o;let{document:n}=t;const s=n,r=s.currentScript,{DocumentFragment:a,HTMLTemplateElement:i,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:m,DOMParser:g,trustedTypes:p}=t,h=c.prototype,f=Mv(h,"cloneNode"),b=Mv(h,"remove"),v=Mv(h,"nextSibling"),x=Mv(h,"childNodes"),y=Mv(h,"parentNode");
|
||
|
|
// As per issue #47, the web-components registry is inherited by a
|
||
|
|
// new document created via createHTMLDocument. As per the spec
|
||
|
|
// (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
|
||
|
|
// a new empty registry is used when creating a template contents owner
|
||
|
|
// document, so we use that as our parent document to ensure nothing
|
||
|
|
// is inherited.
|
||
|
|
if("function"==typeof i){const e=n.createElement("template");e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let w,S="";const{implementation:C,createNodeIterator:k,createDocumentFragment:O,getElementsByTagName:_}=n,{importNode:T}=s;let E={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};
|
||
|
|
/**
|
||
|
|
* Expose whether this browser supports running the full DOMPurify.
|
||
|
|
*/o.isSupported="function"==typeof tv&&"function"==typeof y&&C&&void 0!==C.createHTMLDocument;const{MUSTACHE_EXPR:A,ERB_EXPR:M,TMPLIT_EXPR:D,DATA_ATTR:B,ARIA_ATTR:I,IS_SCRIPT_OR_DATA:F,ATTR_WHITESPACE:R,CUSTOM_ELEMENT:N}=Qv;let{IS_ALLOWED_URI:z}=Qv,L=null;
|
||
|
|
/**
|
||
|
|
* We consider the elements and attributes below to be safe. Ideally
|
||
|
|
* don't add any new ones but feel free to remove unwanted ones.
|
||
|
|
*/
|
||
|
|
/* allowed element names */const V=Tv({},[...Dv,...Bv,...Iv,...Rv,...zv]);
|
||
|
|
/* Allowed attribute names */let H=null;const P=Tv({},[...Lv,...Vv,...Hv,...Pv]);
|
||
|
|
/*
|
||
|
|
* Configure how DOMPurify should handle custom elements and their attributes as well as customized built-in elements.
|
||
|
|
* @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
|
||
|
|
* @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
|
||
|
|
* @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
|
||
|
|
*/let U=Object.seal(lv(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}})),W=null,$=null,G=!0,j=!0,q=!1,X=!0,Y=!1,K=!0,J=!1,Q=!1,Z=!1,ee=!1,te=!1,oe=!1,ne=!0,se=!1,re=!0,ae=!1,ie={},le=null;
|
||
|
|
/* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */const ce=Tv({},["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"]);
|
||
|
|
/* Tags that are safe for data: URIs */let de=null;const ue=Tv({},["audio","video","img","source","image","track"]);
|
||
|
|
/* Attributes safe for values like "javascript:" */let me=null;const ge=Tv({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pe="http://www.w3.org/1998/Math/MathML",he="http://www.w3.org/2000/svg",fe="http://www.w3.org/1999/xhtml";
|
||
|
|
/* Document namespace */
|
||
|
|
let be=fe,ve=!1,xe=null;const ye=Tv({},[pe,he,fe],bv);let we=Tv({},["mi","mo","mn","ms","mtext"]),Se=Tv({},["annotation-xml"]);
|
||
|
|
// Certain elements are allowed in both SVG and HTML
|
||
|
|
// namespace. We need to specify them explicitly
|
||
|
|
// so that they don't get erroneously deleted from
|
||
|
|
// HTML namespace.
|
||
|
|
const Ce=Tv({},["title","style","font","a","script"]);
|
||
|
|
/* Parsing of strict XHTML documents */let ke=null;const Oe=["application/xhtml+xml","text/html"];let _e=null,Te=null;
|
||
|
|
/* Keep a reference to config to pass to hooks */
|
||
|
|
/* Ideally, do not touch anything below this line */
|
||
|
|
/* ______________________________________________ */
|
||
|
|
const Ee=n.createElement("form"),Ae=function(e){return e instanceof RegExp||e instanceof Function},Me=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Te||Te!==e){if(
|
||
|
|
/* Shield configuration object from tampering */
|
||
|
|
e&&"object"==typeof e||(e={})
|
||
|
|
/* Shield configuration object from prototype pollution */,e=Av(e),ke=
|
||
|
|
// eslint-disable-next-line unicorn/prefer-includes
|
||
|
|
-1===Oe.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,
|
||
|
|
// HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
|
||
|
|
_e="application/xhtml+xml"===ke?bv:fv,
|
||
|
|
/* Set configuration parameters */
|
||
|
|
L=Sv(e,"ALLOWED_TAGS")?Tv({},e.ALLOWED_TAGS,_e):V,H=Sv(e,"ALLOWED_ATTR")?Tv({},e.ALLOWED_ATTR,_e):P,xe=Sv(e,"ALLOWED_NAMESPACES")?Tv({},e.ALLOWED_NAMESPACES,bv):ye,me=Sv(e,"ADD_URI_SAFE_ATTR")?Tv(Av(ge),e.ADD_URI_SAFE_ATTR,_e):ge,de=Sv(e,"ADD_DATA_URI_TAGS")?Tv(Av(ue),e.ADD_DATA_URI_TAGS,_e):ue,le=Sv(e,"FORBID_CONTENTS")?Tv({},e.FORBID_CONTENTS,_e):ce,W=Sv(e,"FORBID_TAGS")?Tv({},e.FORBID_TAGS,_e):{},$=Sv(e,"FORBID_ATTR")?Tv({},e.FORBID_ATTR,_e):{},ie=!!Sv(e,"USE_PROFILES")&&e.USE_PROFILES,G=!1!==e.ALLOW_ARIA_ATTR,// Default true
|
||
|
|
j=!1!==e.ALLOW_DATA_ATTR,// Default true
|
||
|
|
q=e.ALLOW_UNKNOWN_PROTOCOLS||!1,// Default false
|
||
|
|
X=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,// Default true
|
||
|
|
Y=e.SAFE_FOR_TEMPLATES||!1,// Default false
|
||
|
|
K=!1!==e.SAFE_FOR_XML,// Default true
|
||
|
|
J=e.WHOLE_DOCUMENT||!1,// Default false
|
||
|
|
ee=e.RETURN_DOM||!1,// Default false
|
||
|
|
te=e.RETURN_DOM_FRAGMENT||!1,// Default false
|
||
|
|
oe=e.RETURN_TRUSTED_TYPE||!1,// Default false
|
||
|
|
Z=e.FORCE_BODY||!1,// Default false
|
||
|
|
ne=!1!==e.SANITIZE_DOM,// Default true
|
||
|
|
se=e.SANITIZE_NAMED_PROPS||!1,// Default false
|
||
|
|
re=!1!==e.KEEP_CONTENT,// Default true
|
||
|
|
ae=e.IN_PLACE||!1,// Default false
|
||
|
|
z=e.ALLOWED_URI_REGEXP||qv,be=e.NAMESPACE||fe,we=e.MATHML_TEXT_INTEGRATION_POINTS||we,Se=e.HTML_INTEGRATION_POINTS||Se,U=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ae(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(U.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ae(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(U.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(U.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(j=!1),te&&(ee=!0)
|
||
|
|
/* Parse profile info */,ie&&(L=Tv({},zv),H=[],!0===ie.html&&(Tv(L,Dv),Tv(H,Lv)),!0===ie.svg&&(Tv(L,Bv),Tv(H,Vv),Tv(H,Pv)),!0===ie.svgFilters&&(Tv(L,Iv),Tv(H,Vv),Tv(H,Pv)),!0===ie.mathMl&&(Tv(L,Rv),Tv(H,Hv),Tv(H,Pv)))
|
||
|
|
/* Merge configuration parameters */,e.ADD_TAGS&&(L===V&&(L=Av(L)),Tv(L,e.ADD_TAGS,_e)),e.ADD_ATTR&&(H===P&&(H=Av(H)),Tv(H,e.ADD_ATTR,_e)),e.ADD_URI_SAFE_ATTR&&Tv(me,e.ADD_URI_SAFE_ATTR,_e),e.FORBID_CONTENTS&&(le===ce&&(le=Av(le)),Tv(le,e.FORBID_CONTENTS,_e))
|
||
|
|
/* Add #text in case KEEP_CONTENT is set to true */,re&&(L["#text"]=!0)
|
||
|
|
/* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */,J&&Tv(L,["html","head","body"])
|
||
|
|
/* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */,L.table&&(Tv(L,["tbody"]),delete W.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw kv('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw kv('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
||
|
|
// Overwrite existing TrustedTypes policy.
|
||
|
|
w=e.TRUSTED_TYPES_POLICY,
|
||
|
|
// Sign local variables required by `sanitize`.
|
||
|
|
S=w.createHTML("")}else
|
||
|
|
// Uninitialized policy, attempt to initialize the internal dompurify policy.
|
||
|
|
void 0===w&&(w=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;
|
||
|
|
// Allow the callers to control the unique policy name
|
||
|
|
// by adding a data-tt-policy-suffix to the script element with the DOMPurify.
|
||
|
|
// Policy creation with duplicate names throws in Trusted Types.
|
||
|
|
let o=null;const n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(o=t.getAttribute(n));const s="dompurify"+(o?"#"+o:"");try{return e.createPolicy(s,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){
|
||
|
|
// Policy creation failed (most likely another DOMPurify script has
|
||
|
|
// already run). Skip creating the policy, as this will only cause errors
|
||
|
|
// if TT are enforced.
|
||
|
|
return console.warn("TrustedTypes policy "+s+" could not be created."),null}}(p,r)),
|
||
|
|
// If creating the internal policy succeeded sign internal variables.
|
||
|
|
null!==w&&"string"==typeof S&&(S=w.createHTML(""));
|
||
|
|
// Prevent further manipulation of configuration.
|
||
|
|
// Not available in IE8, Safari 5, etc.
|
||
|
|
av&&av(e),Te=e}},De=Tv({},[...Bv,...Iv,...Fv]),Be=Tv({},[...Rv,...Nv]),Ie=function(e){pv(o.removed,{element:e});try{
|
||
|
|
// eslint-disable-next-line unicorn/prefer-dom-node-remove
|
||
|
|
y(e).removeChild(e)}catch(t){b(e)}},Fe=function(e,t){try{pv(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){pv(o.removed,{attribute:null,from:t})}
|
||
|
|
// We void attribute values for unremovable "is" attributes
|
||
|
|
if(t.removeAttribute(e),"is"===e)if(ee||te)try{Ie(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Re=function(e){
|
||
|
|
/* Create a HTML document */
|
||
|
|
let t=null,o=null;if(Z)e="<remove></remove>"+e;else{
|
||
|
|
/* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
|
||
|
|
const t=vv(e,/^[\r\n\t ]+/);o=t&&t[0]}"application/xhtml+xml"===ke&&be===fe&&(
|
||
|
|
// Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
|
||
|
|
e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const s=w?w.createHTML(e):e;
|
||
|
|
/*
|
||
|
|
* Use the DOMParser API by default, fallback later if needs be
|
||
|
|
* DOMParser not work for svg when has multiple root element.
|
||
|
|
*/if(be===fe)try{t=(new g).parseFromString(s,ke)}catch(e){}
|
||
|
|
/* Use createHTMLDocument in case DOMParser is not available */if(!t||!t.documentElement){t=C.createDocument(be,"template",null);try{t.documentElement.innerHTML=ve?S:s}catch(e){
|
||
|
|
// Syntax error if dirtyPayload is invalid xml
|
||
|
|
}}const r=t.body||t.documentElement;
|
||
|
|
/* Work on whole document or just its body */
|
||
|
|
return e&&o&&r.insertBefore(n.createTextNode(o),r.childNodes[0]||null),be===fe?_.call(t,J?"html":"body")[0]:J?t.documentElement:r},Ne=function(e){return k.call(e.ownerDocument||e,e,
|
||
|
|
// eslint-disable-next-line no-bitwise
|
||
|
|
d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},ze=function(e){return e instanceof m&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Le=function(e){return"function"==typeof l&&e instanceof l};function Ve(e,t,n){uv(e,(e=>{e.call(o,t,n,Te)}))}
|
||
|
|
/**
|
||
|
|
* _sanitizeElements
|
||
|
|
*
|
||
|
|
* @protect nodeName
|
||
|
|
* @protect textContent
|
||
|
|
* @protect removeChild
|
||
|
|
* @param currentNode to check for permission to exist
|
||
|
|
* @return true if node was killed, false if left alive
|
||
|
|
*/const He=function(e){let t=null;
|
||
|
|
/* Execute a hook if present */
|
||
|
|
/* Check if element is clobbered or can clobber */
|
||
|
|
if(Ve(E.beforeSanitizeElements,e,null),ze(e))return Ie(e),!0;
|
||
|
|
/* Now let's check the element's type and name */const n=_e(e.nodeName);
|
||
|
|
/* Execute a hook if present */
|
||
|
|
/* Detect mXSS attempts abusing namespace confusion */
|
||
|
|
if(Ve(E.uponSanitizeElement,e,{tagName:n,allowedTags:L}),e.hasChildNodes()&&!Le(e.firstElementChild)&&Cv(/<[/\w]/g,e.innerHTML)&&Cv(/<[/\w]/g,e.textContent))return Ie(e),!0;
|
||
|
|
/* Remove any occurrence of processing instructions */if(7===e.nodeType)return Ie(e),!0;
|
||
|
|
/* Remove any kind of possibly harmful comments */if(K&&8===e.nodeType&&Cv(/<[/\w]/g,e.data))return Ie(e),!0;
|
||
|
|
/* Remove element if anything forbids its presence */if(!L[n]||W[n]){
|
||
|
|
/* Check if we have a custom element to handle */
|
||
|
|
if(!W[n]&&Ue(n)){if(U.tagNameCheck instanceof RegExp&&Cv(U.tagNameCheck,n))return!1;if(U.tagNameCheck instanceof Function&&U.tagNameCheck(n))return!1}
|
||
|
|
/* Keep content except for bad-listed elements */if(re&&!le[n]){const t=y(e)||e.parentNode,o=x(e)||e.childNodes;if(o&&t)for(let n=o.length-1;n>=0;--n){const s=f(o[n],!0);s.__removalCount=(e.__removalCount||0)+1,t.insertBefore(s,v(e))}}return Ie(e),!0}
|
||
|
|
/* Check whether element has a valid namespace */return e instanceof c&&!function(e){let t=y(e);
|
||
|
|
// In JSDOM, if we're inside shadow DOM, then parentNode
|
||
|
|
// can be null. We just simulate parent in this case.
|
||
|
|
t&&t.tagName||(t={namespaceURI:be,tagName:"template"});const o=fv(e.tagName),n=fv(t.tagName);return!!xe[e.namespaceURI]&&(e.namespaceURI===he?
|
||
|
|
// The only way to switch from HTML namespace to SVG
|
||
|
|
// is via <svg>. If it happens via any other tag, then
|
||
|
|
// it should be killed.
|
||
|
|
t.namespaceURI===fe?"svg"===o:
|
||
|
|
// The only way to switch from MathML to SVG is via`
|
||
|
|
// svg if parent is either <annotation-xml> or MathML
|
||
|
|
// text integration points.
|
||
|
|
t.namespaceURI===pe?"svg"===o&&("annotation-xml"===n||we[n]):Boolean(De[o]):e.namespaceURI===pe?
|
||
|
|
// The only way to switch from HTML namespace to MathML
|
||
|
|
// is via <math>. If it happens via any other tag, then
|
||
|
|
// it should be killed.
|
||
|
|
t.namespaceURI===fe?"math"===o:
|
||
|
|
// The only way to switch from SVG to MathML is via
|
||
|
|
// <math> and HTML integration points
|
||
|
|
t.namespaceURI===he?"math"===o&&Se[n]:Boolean(Be[o]):e.namespaceURI===fe?
|
||
|
|
// The only way to switch from SVG to HTML is via
|
||
|
|
// HTML integration points, and from MathML to HTML
|
||
|
|
// is via MathML text integration points
|
||
|
|
!(t.namespaceURI===he&&!Se[n])&&!(t.namespaceURI===pe&&!we[n])&&!Be[o]&&(Ce[o]||!De[o]):!("application/xhtml+xml"!==ke||!xe[e.namespaceURI]))}(e)?(Ie(e),!0):
|
||
|
|
/* Make sure that older browsers don't get fallback-tag mXSS */
|
||
|
|
"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!Cv(/<\/no(script|embed|frames)/i,e.innerHTML)?(
|
||
|
|
/* Sanitize element content to be template-safe */
|
||
|
|
Y&&3===e.nodeType&&(
|
||
|
|
/* Get the element's text content */
|
||
|
|
t=e.textContent,uv([A,M,D],(e=>{t=xv(t,e," ")})),e.textContent!==t&&(pv(o.removed,{element:e.cloneNode()}),e.textContent=t))
|
||
|
|
/* Execute a hook if present */,Ve(E.afterSanitizeElements,e,null),!1):(Ie(e),!0)},Pe=function(e,t,o){
|
||
|
|
/* Make sure attribute cannot clobber */
|
||
|
|
if(ne&&("id"===t||"name"===t)&&(o in n||o in Ee))return!1;
|
||
|
|
/* Allow valid data-* attributes: At least one character after "-"
|
||
|
|
(https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
|
||
|
|
XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
|
||
|
|
We don't need to check the value; it's always URI safe. */if(j&&!$[t]&&Cv(B,t));else if(G&&Cv(I,t));else if(!H[t]||$[t]){if(
|
||
|
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
||
|
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
||
|
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
||
|
|
!(Ue(e)&&(U.tagNameCheck instanceof RegExp&&Cv(U.tagNameCheck,e)||U.tagNameCheck instanceof Function&&U.tagNameCheck(e))&&(U.attributeNameCheck instanceof RegExp&&Cv(U.attributeNameCheck,t)||U.attributeNameCheck instanceof Function&&U.attributeNameCheck(t))||
|
||
|
|
// Alternative, second condition checks if it's an `is`-attribute, AND
|
||
|
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
||
|
|
"is"===t&&U.allowCustomizedBuiltInElements&&(U.tagNameCheck instanceof RegExp&&Cv(U.tagNameCheck,o)||U.tagNameCheck instanceof Function&&U.tagNameCheck(o))))return!1;
|
||
|
|
/* Check value is safe. First, is attr inert? If so, is safe */}else if(me[t]);else if(Cv(z,xv(o,R,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==yv(o,"data:")||!de[e])if(q&&!Cv(F,xv(o,R,"")));else if(o)return!1;return!0},Ue=function(e){return"annotation-xml"!==e&&vv(e,N)},We=function(e){
|
||
|
|
/* Execute a hook if present */
|
||
|
|
Ve(E.beforeSanitizeAttributes,e,null);const{attributes:t}=e;
|
||
|
|
/* Check if we have attributes; if not we might have a text node */if(!t||ze(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let s=t.length;
|
||
|
|
/* Go backwards over all attributes; safely remove bad ones */for(;s--;){const r=t[s],{name:a,namespaceURI:i,value:l}=r,c=_e(a);let d="value"===a?l:wv(l);const u=d;
|
||
|
|
/* Execute a hook if present */
|
||
|
|
/* Work around a security issue with comments inside attributes */
|
||
|
|
if(n.attrName=c,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,// Allows developers to see this is a property they can set
|
||
|
|
Ve(E.uponSanitizeAttribute,e,n),d=n.attrValue,
|
||
|
|
/* Full DOM Clobbering protection via namespace isolation,
|
||
|
|
* Prefix id and name attributes with `user-content-`
|
||
|
|
*/
|
||
|
|
!se||"id"!==c&&"name"!==c||(
|
||
|
|
// Remove the attribute with this value
|
||
|
|
Fe(a,e),
|
||
|
|
// Prefix the value and later re-create the attribute with the sanitized value
|
||
|
|
d="user-content-"+d),K&&Cv(/((--!?|])>)|<\/(style|title)/i,d)){Fe(a,e);continue}
|
||
|
|
/* Did the hooks approve of the attribute? */if(n.forceKeepAttr)continue;
|
||
|
|
/* Remove attribute */
|
||
|
|
/* Did the hooks approve of the attribute? */if(!n.keepAttr){Fe(a,e);continue}
|
||
|
|
/* Work around a security issue in jQuery 3.0 */if(!X&&Cv(/\/>/i,d)){Fe(a,e);continue}
|
||
|
|
/* Sanitize attribute content to be template-safe */Y&&uv([A,M,D],(e=>{d=xv(d,e," ")}))
|
||
|
|
/* Is `value` valid for this attribute? */;const m=_e(e.nodeName);if(Pe(m,c,d)){
|
||
|
|
/* Handle attributes that require Trusted Types */
|
||
|
|
if(w&&"object"==typeof p&&"function"==typeof p.getAttributeType)if(i);else switch(p.getAttributeType(m,c)){case"TrustedHTML":d=w.createHTML(d);break;case"TrustedScriptURL":d=w.createScriptURL(d)}
|
||
|
|
/* Handle invalid data-* attribute set by try-catching it */if(d!==u)try{i?e.setAttributeNS(i,a,d):
|
||
|
|
/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
|
||
|
|
e.setAttribute(a,d),ze(e)?Ie(e):gv(o.removed)}catch(e){}}else Fe(a,e)}
|
||
|
|
/* Execute a hook if present */Ve(E.afterSanitizeAttributes,e,null)},$e=function e(t){let o=null;const n=Ne(t);
|
||
|
|
/* Execute a hook if present */for(Ve(E.beforeSanitizeShadowDOM,t,null);o=n.nextNode();)
|
||
|
|
/* Execute a hook if present */
|
||
|
|
Ve(E.uponSanitizeShadowNode,o,null),
|
||
|
|
/* Sanitize tags and elements */
|
||
|
|
He(o),
|
||
|
|
/* Check attributes next */
|
||
|
|
We(o),
|
||
|
|
/* Deep shadow DOM detected */
|
||
|
|
o.content instanceof a&&e(o.content);
|
||
|
|
/* Execute a hook if present */Ve(E.afterSanitizeShadowDOM,t,null)};
|
||
|
|
/**
|
||
|
|
* _isValidAttribute
|
||
|
|
*
|
||
|
|
* @param lcTag Lowercase tag name of containing element.
|
||
|
|
* @param lcName Lowercase attribute name.
|
||
|
|
* @param value Attribute value.
|
||
|
|
* @return Returns true if `value` is valid, otherwise false.
|
||
|
|
*/
|
||
|
|
// eslint-disable-next-line complexity
|
||
|
|
// eslint-disable-next-line complexity
|
||
|
|
return o.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,r=null,i=null,c=null;
|
||
|
|
/* Stringify, in case dirty is an object */
|
||
|
|
if(
|
||
|
|
/* Make sure we have a string to sanitize.
|
||
|
|
DO NOT return early, as this will return the wrong type if
|
||
|
|
the user has requested a DOM object rather than a string */
|
||
|
|
ve=!e,ve&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Le(e)){if("function"!=typeof e.toString)throw kv("toString is not a function");if("string"!=typeof(e=e.toString()))throw kv("dirty is not a string, aborting")}
|
||
|
|
/* Return dirty HTML if DOMPurify cannot run */if(!o.isSupported)return e;
|
||
|
|
/* Assign config vars */if(Q||Me(t)
|
||
|
|
/* Clean up removed elements */,o.removed=[],
|
||
|
|
/* Check if dirty is correctly typed for IN_PLACE */
|
||
|
|
"string"==typeof e&&(ae=!1),ae){
|
||
|
|
/* Do some early pre-sanitization to avoid unsafe root nodes */
|
||
|
|
if(e.nodeName){const t=_e(e.nodeName);if(!L[t]||W[t])throw kv("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)
|
||
|
|
/* If dirty is a DOM element, append to an empty document to avoid
|
||
|
|
elements being stripped by the parser */
|
||
|
|
n=Re("\x3c!----\x3e"),r=n.ownerDocument.importNode(e,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?
|
||
|
|
/* Node is already a body, use as is */
|
||
|
|
n=r:
|
||
|
|
// eslint-disable-next-line unicorn/prefer-dom-node-append
|
||
|
|
n.appendChild(r);else{
|
||
|
|
/* Exit directly if we have nothing to do */
|
||
|
|
if(!ee&&!Y&&!J&&
|
||
|
|
// eslint-disable-next-line unicorn/prefer-includes
|
||
|
|
-1===e.indexOf("<"))return w&&oe?w.createHTML(e):e;
|
||
|
|
/* Initialize the document to work on */
|
||
|
|
/* Check we have a DOM node from the data */
|
||
|
|
if(n=Re(e),!n)return ee?null:oe?S:""}
|
||
|
|
/* Remove first element node (ours) if FORCE_BODY is set */n&&Z&&Ie(n.firstChild)
|
||
|
|
/* Get node iterator */;const d=Ne(ae?e:n);
|
||
|
|
/* Now start iterating over the created document */for(;i=d.nextNode();)
|
||
|
|
/* Sanitize tags and elements */
|
||
|
|
He(i),
|
||
|
|
/* Check attributes next */
|
||
|
|
We(i),
|
||
|
|
/* Shadow DOM detected, sanitize it */
|
||
|
|
i.content instanceof a&&$e(i.content);
|
||
|
|
/* If we sanitized `dirty` in-place, return it. */if(ae)return e;
|
||
|
|
/* Return sanitized string or DOM */if(ee){if(te)for(c=O.call(n.ownerDocument);n.firstChild;)
|
||
|
|
// eslint-disable-next-line unicorn/prefer-dom-node-append
|
||
|
|
c.appendChild(n.firstChild);else c=n;return(H.shadowroot||H.shadowrootmode)&&(
|
||
|
|
/*
|
||
|
|
AdoptNode() is not used because internal state is not reset
|
||
|
|
(e.g. the past names map of a HTMLFormElement), this is safe
|
||
|
|
in theory but we would rather not risk another attack vector.
|
||
|
|
The state that is cloned by importNode() is explicitly defined
|
||
|
|
by the specs.
|
||
|
|
*/
|
||
|
|
c=T.call(s,c,!0)),c}let u=J?n.outerHTML:n.innerHTML;
|
||
|
|
/* Serialize doctype if allowed */return J&&L["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&Cv(Kv,n.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+u)
|
||
|
|
/* Sanitize final string template-safe */,Y&&uv([A,M,D],(e=>{u=xv(u,e," ")})),w&&oe?w.createHTML(u):u},o.setConfig=function(){Me(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Q=!0},o.clearConfig=function(){Te=null,Q=!1},o.isValidAttribute=function(e,t,o){
|
||
|
|
/* Initialize shared config vars if necessary. */
|
||
|
|
Te||Me({});const n=_e(e),s=_e(t);return Pe(n,s,o)},o.addHook=function(e,t){"function"==typeof t&&pv(E[e],t)},o.removeHook=function(e,t){if(void 0!==t){const o=mv(E[e],t);return-1===o?void 0:hv(E[e],o,1)[0]}return gv(E[e])},o.removeHooks=function(e){E[e]=[]},o.removeAllHooks=function(){E={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},o}();const tx=e=>ex().sanitize(e);var ox=tinymce.util.Tools.resolve("tinymce.util.I18n");const nx={indent:!0,outdent:!0,"table-insert-column-after":!0,"table-insert-column-before":!0,"paste-column-after":!0,"paste-column-before":!0,"unordered-list":!0,"list-bull-circle":!0,"list-bull-default":!0,"list-bull-square":!0},sx="temporary-placeholder",rx=e=>()=>fe(e,sx).getOr("!not found!"),ax=(e,t)=>{const o=e.toLowerCase();if(ox.isRtl()){const e=((e,t)=>Ee(e,t)?e:((e,t)=>e+t)(e,t))(o,"-rtl");return be(t,e)?e:o}return o},ix=(e,t)=>fe(t,ax(e,t)),lx=(e,t)=>{const o=t();return ix(e,o).getOrThunk(rx(o))},cx=()=>Eh("add-focusable",[ia((e=>{un(e.element,"svg").each((e=>St(e,"focusable","false")))}))]),dx=(e,t,o,n)=>{var s,r;const a=(e=>!!ox.isRtl()&&be(nx,e))(t)?["tox-icon--flip"]:[],i=fe(o,ax(t,o)).or(n).getOrThunk(rx(o));return{dom:{tag:e.tag,attributes:null!==(s=e.attributes)&&void 0!==s?s:{},classes:e.classes.concat(a),innerHtml:i},behaviours:xa([...null!==(r=e.behaviours)&&void 0!==r?r:[],cx()])}},ux=(e,t,o,n=A.none())=>dx(t,e,o(),n),mx={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},gx=qm({name:"Notification",factory:e=>{const t=Pi("notification-text"),o=Hb({dom:Vb(`<p id=${t}>${tx(e.backstageProvider.translate(e.text))}</p>`),behaviours:xa([Th.config({})])}),n=e=>({dom:{tag:"div",classes:["tox-bar"],styles:{width:`${e}%`}}}),s=e=>({dom:{tag:"div",classes:["tox-text"],innerHtml:`${e}%`}}),r=Hb({dom:{tag:"div",classes:e.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[n(0)]},s(0)],behaviours:xa([Th.config({})])}),a={updateProgress:(e,t)=>{e.getSystem().isConnected()&&r.getOpt(e).each((e=>{Th.set(e,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[n(t)]},s(t)])}))},updateText:(e,t)=>{if(e.getSystem().isConnected()){const n=o.get(e);Th.set(n,[yl(t)])}}},i=j([e.icon.toArray(),[e.level],A.from(mx[e.level]).toArray()]),l=Hb(Lb.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"],attributes:{"aria-label":e.backstageProvider.translate("Close")}},components:[ux("close",{tag:"span",classes:["tox-icon"]},e.iconProvider)],buttonBehaviours:xa([Wb.config({}),ev.config({...e.backstageProvider.tooltips.getConfig({tooltipText:e.backstageProvider.translate("Close")})})]),action:t=>{e.onAction(t)}})),c=((e,t,o)=>{const n=o(),s=$(e,(e=>be(n,ax(e,n))));return dx({tag:"div",classes:["tox-notification__icon"]},s.getOr(sx),n,A.none())})(i,0,e.iconProvider),d=[c,{dom:{tag:"div",classes:["tox-notification__body"]},components:[o.asSpec()],behaviours:xa([Th.config({})])}];return{uid:e.uid,dom:{tag:"div",attributes:{role:"alert","aria-labelledby":t},classes:["tox-notification","tox-notification--in",`tox-notification--${e.level}`]},behaviours:xa([Wb.config({}),Ih.config({}),vh.config({mode:"special",onEscape:t=>(e.onAction(t),A.some(!0))})]),components:d.concat(e.progress?[r.asSpec()]:[]).concat([l.asSpec()]),apis:a}},configFields:[Rs("level","info",["success","error","warning","warn","info"]),ps("progress"),Cs("icon"),ps("onAction"),ps("text"),ps("iconProvider"),ps("backstageProvider")],apis:{updateProgress:(e,t,o)=>{e.updateProgress(t,o)},updateText:(e,t,o)=>{e.updateText(t,o)}}});var px=(e,t,o,n)=>{const s=t.backstage.shared,r=()=>ze(""===e.queryCommandValue("ToggleView")?e.getContentAreaContainer():e.getContainer()),a=()=>{const e=Ko(r());return A.some(e)},i=e=>{a().each((t=>{V(e,(e=>{Lt(e.element,"width"),Kt(e.element)>t
|