Application Onboarding page changes
[portal.git] / ecomp-portal-FE-common / client / bower_components_external / utils / purify.js
1 (function (global, factory) {
2         typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3         typeof define === 'function' && define.amd ? define(factory) :
4         (global.DOMPurify = factory());
5 }(this, (function () { 'use strict';
6
7 var freeze$1 = Object.freeze || function (x) {
8   return x;
9 };
10
11 var html = freeze$1(['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', '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', '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']);
12
13 // SVG
14 var svg = freeze$1(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'audio', 'canvas', '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', 'video', 'view', 'vkern']);
15
16 var svgFilters = freeze$1(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
17
18 var mathMl = freeze$1(['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']);
19
20 var text = freeze$1(['#text']);
21
22 var freeze$2 = Object.freeze || function (x) {
23   return x;
24 };
25
26 var html$1 = freeze$2(['accept', 'action', 'align', 'alt', 'autocomplete', 'background', 'bgcolor', 'border', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'coords', 'crossorigin', 'datetime', 'default', 'dir', 'disabled', 'download', 'enctype', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'integrity', 'ismap', 'label', 'lang', 'list', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'multiple', 'name', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', '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', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns']);
27
28 var svg$1 = freeze$2(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', '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', 'fill', 'fill-opacity', 'fill-rule', 'filter', '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', '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', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'tabindex', 'targetx', 'targety', 'transform', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', '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']);
29
30 var mathMl$1 = freeze$2(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', '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']);
31
32 var xml = freeze$2(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
33
34 var hasOwnProperty = Object.hasOwnProperty;
35 var setPrototypeOf = Object.setPrototypeOf;
36
37 var _ref$1 = typeof Reflect !== 'undefined' && Reflect;
38 var apply$1 = _ref$1.apply;
39
40 if (!apply$1) {
41   apply$1 = function apply(fun, thisValue, args) {
42     return fun.apply(thisValue, args);
43   };
44 }
45
46 /* Add properties to a lookup table */
47 function addToSet(set, array) {
48   if (setPrototypeOf) {
49     // Make 'in' and truthy checks like Boolean(set.constructor)
50     // independent of any properties defined on Object.prototype.
51     // Prevent prototype setters from intercepting set as a this value.
52     setPrototypeOf(set, null);
53   }
54   var l = array.length;
55   while (l--) {
56     var element = array[l];
57     if (typeof element === 'string') {
58       var lcElement = element.toLowerCase();
59       if (lcElement !== element) {
60         array[l] = lcElement;
61         element = lcElement;
62       }
63     }
64     set[element] = true;
65   }
66   return set;
67 }
68
69 /* Shallow clone an object */
70 function clone(object) {
71   var newObject = {};
72   var property = void 0;
73   for (property in object) {
74     if (apply$1(hasOwnProperty, object, [property])) {
75       newObject[property] = object[property];
76     }
77   }
78   return newObject;
79 }
80
81 var seal = Object.seal || function (x) {
82   return x;
83 };
84
85 var MUSTACHE_EXPR = seal(/\{\{[\s\S]*|[\s\S]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
86 var ERB_EXPR = seal(/<%[\s\S]*|[\s\S]*%>/gm);
87 var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
88 var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
89 var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
90 );
91 var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
92 var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g // eslint-disable-line no-control-regex
93 );
94
95 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
96
97 function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
98
99 var _ref = typeof Reflect !== 'undefined' && Reflect;
100 var apply = _ref.apply;
101
102 var arraySlice = Array.prototype.slice;
103 var freeze = Object.freeze;
104
105 var getGlobal = function getGlobal() {
106   return typeof window === 'undefined' ? null : window;
107 };
108
109 if (!apply) {
110   apply = function apply(fun, thisValue, args) {
111     return fun.apply(thisValue, args);
112   };
113 }
114
115 /**
116  * Creates a no-op policy for internal use only.
117  * Don't export this function outside this module!
118  * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.
119  * @param {Document} document The document object (to determine policy name suffix)
120  * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types
121  * are not supported).
122  */
123 var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) {
124   if ((typeof trustedTypes === 'undefined' ? 'undefined' : _typeof(trustedTypes)) !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
125     return null;
126   }
127
128   // Allow the callers to control the unique policy name
129   // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
130   // Policy creation with duplicate names throws in Trusted Types.
131   var suffix = null;
132   var ATTR_NAME = 'data-tt-policy-suffix';
133   if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) {
134     suffix = document.currentScript.getAttribute(ATTR_NAME);
135   }
136
137   var policyName = 'dompurify' + (suffix ? '#' + suffix : '');
138
139   try {
140     return trustedTypes.createPolicy(policyName, {
141       createHTML: function createHTML(html$$1) {
142         return html$$1;
143       }
144     });
145   } catch (e) {
146     // Policy creation failed (most likely another DOMPurify script has
147     // already run). Skip creating the policy, as this will only cause errors
148     // if TT are enforced.
149     console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
150     return null;
151   }
152 };
153
154 function createDOMPurify() {
155   var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
156
157   var DOMPurify = function DOMPurify(root) {
158     return createDOMPurify(root);
159   };
160
161   /**
162    * Version label, exposed for easier checks
163    * if DOMPurify is up to date or not
164    */
165   DOMPurify.version = '1.0.8';
166
167   /**
168    * Array of elements that DOMPurify removed during sanitation.
169    * Empty if nothing was removed.
170    */
171   DOMPurify.removed = [];
172
173   if (!window || !window.document || window.document.nodeType !== 9) {
174     // Not running in a browser, provide a factory function
175     // so that you can pass your own Window
176     DOMPurify.isSupported = false;
177
178     return DOMPurify;
179   }
180
181   var originalDocument = window.document;
182   var useDOMParser = false;
183   var removeTitle = false;
184
185   var document = window.document;
186   var DocumentFragment = window.DocumentFragment,
187       HTMLTemplateElement = window.HTMLTemplateElement,
188       Node = window.Node,
189       NodeFilter = window.NodeFilter,
190       _window$NamedNodeMap = window.NamedNodeMap,
191       NamedNodeMap = _window$NamedNodeMap === undefined ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap,
192       Text = window.Text,
193       Comment = window.Comment,
194       DOMParser = window.DOMParser,
195       TrustedTypes = window.TrustedTypes;
196
197   // As per issue #47, the web-components registry is inherited by a
198   // new document created via createHTMLDocument. As per the spec
199   // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
200   // a new empty registry is used when creating a template contents owner
201   // document, so we use that as our parent document to ensure nothing
202   // is inherited.
203
204   if (typeof HTMLTemplateElement === 'function') {
205     var template = document.createElement('template');
206     if (template.content && template.content.ownerDocument) {
207       document = template.content.ownerDocument;
208     }
209   }
210
211   var trustedTypesPolicy = _createTrustedTypesPolicy(TrustedTypes, originalDocument);
212   var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : '';
213
214   var _document = document,
215       implementation = _document.implementation,
216       createNodeIterator = _document.createNodeIterator,
217       getElementsByTagName = _document.getElementsByTagName,
218       createDocumentFragment = _document.createDocumentFragment;
219   var importNode = originalDocument.importNode;
220
221
222   var hooks = {};
223
224   /**
225    * Expose whether this browser supports running the full DOMPurify.
226    */
227   DOMPurify.isSupported = implementation && typeof implementation.createHTMLDocument !== 'undefined' && document.documentMode !== 9;
228
229   var MUSTACHE_EXPR$$1 = MUSTACHE_EXPR,
230       ERB_EXPR$$1 = ERB_EXPR,
231       DATA_ATTR$$1 = DATA_ATTR,
232       ARIA_ATTR$$1 = ARIA_ATTR,
233       IS_SCRIPT_OR_DATA$$1 = IS_SCRIPT_OR_DATA,
234       ATTR_WHITESPACE$$1 = ATTR_WHITESPACE;
235   var IS_ALLOWED_URI$$1 = IS_ALLOWED_URI;
236   /**
237    * We consider the elements and attributes below to be safe. Ideally
238    * don't add any new ones but feel free to remove unwanted ones.
239    */
240
241   /* allowed element names */
242
243   var ALLOWED_TAGS = null;
244   var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(svgFilters), _toConsumableArray(mathMl), _toConsumableArray(text)));
245
246   /* Allowed attribute names */
247   var ALLOWED_ATTR = null;
248   var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(mathMl$1), _toConsumableArray(xml)));
249
250   /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
251   var FORBID_TAGS = null;
252
253   /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
254   var FORBID_ATTR = null;
255
256   /* Decide if ARIA attributes are okay */
257   var ALLOW_ARIA_ATTR = true;
258
259   /* Decide if custom data attributes are okay */
260   var ALLOW_DATA_ATTR = true;
261
262   /* Decide if unknown protocols are okay */
263   var ALLOW_UNKNOWN_PROTOCOLS = false;
264
265   /* Output should be safe for jQuery's $() factory? */
266   var SAFE_FOR_JQUERY = false;
267
268   /* Output should be safe for common template engines.
269    * This means, DOMPurify removes data attributes, mustaches and ERB
270    */
271   var SAFE_FOR_TEMPLATES = false;
272
273   /* Decide if document with <html>... should be returned */
274   var WHOLE_DOCUMENT = false;
275
276   /* Track whether config is already set on this instance of DOMPurify. */
277   var SET_CONFIG = false;
278
279   /* Decide if all elements (e.g. style, script) must be children of
280    * document.body. By default, browsers might move them to document.head */
281   var FORCE_BODY = false;
282
283   /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
284    * string (or a TrustedHTML object if Trusted Types are supported).
285    * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
286    */
287   var RETURN_DOM = false;
288
289   /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
290    * string  (or a TrustedHTML object if Trusted Types are supported) */
291   var RETURN_DOM_FRAGMENT = false;
292
293   /* If `RETURN_DOM` or `RETURN_DOM_FRAGMENT` is enabled, decide if the returned DOM
294    * `Node` is imported into the current `Document`. If this flag is not enabled the
295    * `Node` will belong (its ownerDocument) to a fresh `HTMLDocument`, created by
296    * DOMPurify. */
297   var RETURN_DOM_IMPORT = false;
298
299   /* Output should be free from DOM clobbering attacks? */
300   var SANITIZE_DOM = true;
301
302   /* Keep element content when removing element? */
303   var KEEP_CONTENT = true;
304
305   /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
306    * of importing it into a new Document and returning a sanitized copy */
307   var IN_PLACE = false;
308
309   /* Allow usage of profiles like html, svg and mathMl */
310   var USE_PROFILES = {};
311
312   /* Tags to ignore content of when KEEP_CONTENT is true */
313   var FORBID_CONTENTS = addToSet({}, ['audio', 'head', 'math', 'script', 'style', 'template', 'svg', 'video']);
314
315   /* Tags that are safe for data: URIs */
316   var DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image']);
317
318   /* Attributes safe for values like "javascript:" */
319   var URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'summary', 'title', 'value', 'style', 'xmlns']);
320
321   /* Keep a reference to config to pass to hooks */
322   var CONFIG = null;
323
324   /* Ideally, do not touch anything below this line */
325   /* ______________________________________________ */
326
327   var formElement = document.createElement('form');
328
329   /**
330    * _parseConfig
331    *
332    * @param  {Object} cfg optional config literal
333    */
334   // eslint-disable-next-line complexity
335   var _parseConfig = function _parseConfig(cfg) {
336     if (CONFIG && CONFIG === cfg) {
337       return;
338     }
339
340     /* Shield configuration object from tampering */
341     if (!cfg || (typeof cfg === 'undefined' ? 'undefined' : _typeof(cfg)) !== 'object') {
342       cfg = {};
343     }
344     /* Set configuration parameters */
345     ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS) : DEFAULT_ALLOWED_TAGS;
346     ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR) : DEFAULT_ALLOWED_ATTR;
347     FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS) : {};
348     FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR) : {};
349     USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
350     ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
351     ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
352     ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
353     SAFE_FOR_JQUERY = cfg.SAFE_FOR_JQUERY || false; // Default false
354     SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
355     WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
356     RETURN_DOM = cfg.RETURN_DOM || false; // Default false
357     RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
358     RETURN_DOM_IMPORT = cfg.RETURN_DOM_IMPORT || false; // Default false
359     FORCE_BODY = cfg.FORCE_BODY || false; // Default false
360     SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
361     KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
362     IN_PLACE = cfg.IN_PLACE || false; // Default false
363
364     IS_ALLOWED_URI$$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$$1;
365
366     if (SAFE_FOR_TEMPLATES) {
367       ALLOW_DATA_ATTR = false;
368     }
369
370     if (RETURN_DOM_FRAGMENT) {
371       RETURN_DOM = true;
372     }
373
374     /* Parse profile info */
375     if (USE_PROFILES) {
376       ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(text)));
377       ALLOWED_ATTR = [];
378       if (USE_PROFILES.html === true) {
379         addToSet(ALLOWED_TAGS, html);
380         addToSet(ALLOWED_ATTR, html$1);
381       }
382       if (USE_PROFILES.svg === true) {
383         addToSet(ALLOWED_TAGS, svg);
384         addToSet(ALLOWED_ATTR, svg$1);
385         addToSet(ALLOWED_ATTR, xml);
386       }
387       if (USE_PROFILES.svgFilters === true) {
388         addToSet(ALLOWED_TAGS, svgFilters);
389         addToSet(ALLOWED_ATTR, svg$1);
390         addToSet(ALLOWED_ATTR, xml);
391       }
392       if (USE_PROFILES.mathMl === true) {
393         addToSet(ALLOWED_TAGS, mathMl);
394         addToSet(ALLOWED_ATTR, mathMl$1);
395         addToSet(ALLOWED_ATTR, xml);
396       }
397     }
398
399     /* Merge configuration parameters */
400     if (cfg.ADD_TAGS) {
401       if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
402         ALLOWED_TAGS = clone(ALLOWED_TAGS);
403       }
404       addToSet(ALLOWED_TAGS, cfg.ADD_TAGS);
405     }
406     if (cfg.ADD_ATTR) {
407       if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
408         ALLOWED_ATTR = clone(ALLOWED_ATTR);
409       }
410       addToSet(ALLOWED_ATTR, cfg.ADD_ATTR);
411     }
412     if (cfg.ADD_URI_SAFE_ATTR) {
413       addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR);
414     }
415
416     /* Add #text in case KEEP_CONTENT is set to true */
417     if (KEEP_CONTENT) {
418       ALLOWED_TAGS['#text'] = true;
419     }
420
421     /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
422     if (WHOLE_DOCUMENT) {
423       addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
424     }
425
426     /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286 */
427     if (ALLOWED_TAGS.table) {
428       addToSet(ALLOWED_TAGS, ['tbody']);
429     }
430
431     // Prevent further manipulation of configuration.
432     // Not available in IE8, Safari 5, etc.
433     if (freeze) {
434       freeze(cfg);
435     }
436
437     CONFIG = cfg;
438   };
439
440   /**
441    * _forceRemove
442    *
443    * @param  {Node} node a DOM node
444    */
445   var _forceRemove = function _forceRemove(node) {
446     DOMPurify.removed.push({ element: node });
447     try {
448       node.parentNode.removeChild(node);
449     } catch (err) {
450       node.outerHTML = emptyHTML;
451     }
452   };
453
454   /**
455    * _removeAttribute
456    *
457    * @param  {String} name an Attribute name
458    * @param  {Node} node a DOM node
459    */
460   var _removeAttribute = function _removeAttribute(name, node) {
461     try {
462       DOMPurify.removed.push({
463         attribute: node.getAttributeNode(name),
464         from: node
465       });
466     } catch (err) {
467       DOMPurify.removed.push({
468         attribute: null,
469         from: node
470       });
471     }
472     node.removeAttribute(name);
473   };
474
475   /**
476    * _initDocument
477    *
478    * @param  {String} dirty a string of dirty markup
479    * @return {Document} a DOM, filled with the dirty markup
480    */
481   var _initDocument = function _initDocument(dirty) {
482     /* Create a HTML document */
483     var doc = void 0;
484     var leadingWhitespace = void 0;
485
486     if (FORCE_BODY) {
487       dirty = '<remove></remove>' + dirty;
488     } else {
489       /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
490       var matches = dirty.match(/^[\s]+/);
491       leadingWhitespace = matches && matches[0];
492       if (leadingWhitespace) {
493         dirty = dirty.slice(leadingWhitespace.length);
494       }
495     }
496
497     /* Use DOMParser to workaround Firefox bug (see comment below) */
498     if (useDOMParser) {
499       try {
500         doc = new DOMParser().parseFromString(dirty, 'text/html');
501       } catch (err) {}
502     }
503
504     /* Remove title to fix a mXSS bug in older MS Edge */
505     if (removeTitle) {
506       addToSet(FORBID_TAGS, ['title']);
507     }
508
509     /* Otherwise use createHTMLDocument, because DOMParser is unsafe in
510     Safari (see comment below) */
511     if (!doc || !doc.documentElement) {
512       doc = implementation.createHTMLDocument('');
513       var _doc = doc,
514           body = _doc.body;
515
516       body.parentNode.removeChild(body.parentNode.firstElementChild);
517       body.outerHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
518     }
519
520     if (leadingWhitespace) {
521       doc.body.insertBefore(document.createTextNode(leadingWhitespace), doc.body.childNodes[0] || null);
522     }
523
524     /* Work on whole document or just its body */
525     return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
526   };
527
528   // Firefox uses a different parser for innerHTML rather than
529   // DOMParser (see https://bugzilla.mozilla.org/show_bug.cgi?id=1205631)
530   // which means that you *must* use DOMParser, otherwise the output may
531   // not be safe if used in a document.write context later.
532   //
533   // So we feature detect the Firefox bug and use the DOMParser if necessary.
534   //
535   // MS Edge, in older versions, is affected by an mXSS behavior. The second
536   // check tests for the behavior and fixes it if necessary.
537   if (DOMPurify.isSupported) {
538     (function () {
539       try {
540         var doc = _initDocument('<svg><p><style><img src="</style><img src=x onerror=alert(1)//">');
541         if (doc.querySelector('svg img')) {
542           useDOMParser = true;
543         }
544       } catch (err) {}
545     })();
546     (function () {
547       try {
548         var doc = _initDocument('<x/><title>&lt;/title&gt;&lt;img&gt;');
549         if (doc.querySelector('title').innerHTML.match(/<\/title/)) {
550           removeTitle = true;
551         }
552       } catch (err) {}
553     })();
554   }
555
556   /**
557    * _createIterator
558    *
559    * @param  {Document} root document/fragment to create iterator for
560    * @return {Iterator} iterator instance
561    */
562   var _createIterator = function _createIterator(root) {
563     return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, function () {
564       return NodeFilter.FILTER_ACCEPT;
565     }, false);
566   };
567
568   /**
569    * _isClobbered
570    *
571    * @param  {Node} elm element to check for clobbering attacks
572    * @return {Boolean} true if clobbered, false if safe
573    */
574   var _isClobbered = function _isClobbered(elm) {
575     if (elm instanceof Text || elm instanceof Comment) {
576       return false;
577     }
578     if (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function') {
579       return true;
580     }
581     return false;
582   };
583
584   /**
585    * _isNode
586    *
587    * @param  {Node} obj object to check whether it's a DOM node
588    * @return {Boolean} true is object is a DOM node
589    */
590   var _isNode = function _isNode(obj) {
591     return (typeof Node === 'undefined' ? 'undefined' : _typeof(Node)) === 'object' ? obj instanceof Node : obj && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && typeof obj.nodeType === 'number' && typeof obj.nodeName === 'string';
592   };
593
594   /**
595    * _executeHook
596    * Execute user configurable hooks
597    *
598    * @param  {String} entryPoint  Name of the hook's entry point
599    * @param  {Node} currentNode node to work on with the hook
600    * @param  {Object} data additional hook parameters
601    */
602   var _executeHook = function _executeHook(entryPoint, currentNode, data) {
603     if (!hooks[entryPoint]) {
604       return;
605     }
606
607     hooks[entryPoint].forEach(function (hook) {
608       hook.call(DOMPurify, currentNode, data, CONFIG);
609     });
610   };
611
612   /**
613    * _sanitizeElements
614    *
615    * @protect nodeName
616    * @protect textContent
617    * @protect removeChild
618    *
619    * @param   {Node} currentNode to check for permission to exist
620    * @return  {Boolean} true if node was killed, false if left alive
621    */
622   var _sanitizeElements = function _sanitizeElements(currentNode) {
623     var content = void 0;
624
625     /* Execute a hook if present */
626     _executeHook('beforeSanitizeElements', currentNode, null);
627
628     /* Check if element is clobbered or can clobber */
629     if (_isClobbered(currentNode)) {
630       _forceRemove(currentNode);
631       return true;
632     }
633
634     /* Now let's check the element's type and name */
635     var tagName = currentNode.nodeName.toLowerCase();
636
637     /* Execute a hook if present */
638     _executeHook('uponSanitizeElement', currentNode, {
639       tagName: tagName,
640       allowedTags: ALLOWED_TAGS
641     });
642
643     /* Remove element if anything forbids its presence */
644     if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
645       /* Keep content except for black-listed elements */
646       if (KEEP_CONTENT && !FORBID_CONTENTS[tagName] && typeof currentNode.insertAdjacentHTML === 'function') {
647         try {
648           var htmlToInsert = currentNode.innerHTML;
649           currentNode.insertAdjacentHTML('AfterEnd', trustedTypesPolicy ? trustedTypesPolicy.createHTML(htmlToInsert) : htmlToInsert);
650         } catch (err) {}
651       }
652       _forceRemove(currentNode);
653       return true;
654     }
655
656     /* Convert markup to cover jQuery behavior */
657     if (SAFE_FOR_JQUERY && !currentNode.firstElementChild && (!currentNode.content || !currentNode.content.firstElementChild) && /</g.test(currentNode.textContent)) {
658       DOMPurify.removed.push({ element: currentNode.cloneNode() });
659       if (currentNode.innerHTML) {
660         currentNode.innerHTML = currentNode.innerHTML.replace(/</g, '&lt;');
661       } else {
662         currentNode.innerHTML = currentNode.textContent.replace(/</g, '&lt;');
663       }
664     }
665
666     /* Sanitize element content to be template-safe */
667     if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
668       /* Get the element's text content */
669       content = currentNode.textContent;
670       content = content.replace(MUSTACHE_EXPR$$1, ' ');
671       content = content.replace(ERB_EXPR$$1, ' ');
672       if (currentNode.textContent !== content) {
673         DOMPurify.removed.push({ element: currentNode.cloneNode() });
674         currentNode.textContent = content;
675       }
676     }
677
678     /* Execute a hook if present */
679     _executeHook('afterSanitizeElements', currentNode, null);
680
681     return false;
682   };
683
684   /**
685    * _isValidAttribute
686    *
687    * @param  {string} lcTag Lowercase tag name of containing element.
688    * @param  {string} lcName Lowercase attribute name.
689    * @param  {string} value Attribute value.
690    * @return {Boolean} Returns true if `value` is valid, otherwise false.
691    */
692   var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
693     /* Make sure attribute cannot clobber */
694     if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
695       return false;
696     }
697
698     /* Sanitize attribute content to be template-safe */
699     if (SAFE_FOR_TEMPLATES) {
700       value = value.replace(MUSTACHE_EXPR$$1, ' ');
701       value = value.replace(ERB_EXPR$$1, ' ');
702     }
703
704     /* Allow valid data-* attributes: At least one character after "-"
705         (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
706         XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
707         We don't need to check the value; it's always URI safe. */
708     if (ALLOW_DATA_ATTR && DATA_ATTR$$1.test(lcName)) {
709       // This attribute is safe
710     } else if (ALLOW_ARIA_ATTR && ARIA_ATTR$$1.test(lcName)) {
711       // This attribute is safe
712       /* Otherwise, check the name is permitted */
713     } else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
714       return false;
715
716       /* Check value is safe. First, is attr inert? If so, is safe */
717     } else if (URI_SAFE_ATTRIBUTES[lcName]) {
718       // This attribute is safe
719       /* Check no script, data or unknown possibly unsafe URI
720         unless we know URI values are safe for that attribute */
721     } else if (IS_ALLOWED_URI$$1.test(value.replace(ATTR_WHITESPACE$$1, ''))) {
722       // This attribute is safe
723       /* Keep image data URIs alive if src/xlink:href is allowed */
724       /* Further prevent gadget XSS for dynamically built script tags */
725     } else if ((lcName === 'src' || lcName === 'xlink:href') && lcTag !== 'script' && value.indexOf('data:') === 0 && DATA_URI_TAGS[lcTag]) {
726       // This attribute is safe
727       /* Allow unknown protocols: This provides support for links that
728         are handled by protocol handlers which may be unknown ahead of
729         time, e.g. fb:, spotify: */
730     } else if (ALLOW_UNKNOWN_PROTOCOLS && !IS_SCRIPT_OR_DATA$$1.test(value.replace(ATTR_WHITESPACE$$1, ''))) {
731       // This attribute is safe
732       /* Check for binary attributes */
733       // eslint-disable-next-line no-negated-condition
734     } else if (!value) {
735       // Binary attributes are safe at this point
736       /* Anything else, presume unsafe, do not add it back */
737     } else {
738       return false;
739     }
740     return true;
741   };
742
743   /**
744    * _sanitizeAttributes
745    *
746    * @protect attributes
747    * @protect nodeName
748    * @protect removeAttribute
749    * @protect setAttribute
750    *
751    * @param  {Node} node to sanitize
752    */
753   // eslint-disable-next-line complexity
754   var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
755     var attr = void 0;
756     var value = void 0;
757     var lcName = void 0;
758     var idAttr = void 0;
759     var l = void 0;
760     /* Execute a hook if present */
761     _executeHook('beforeSanitizeAttributes', currentNode, null);
762
763     var attributes = currentNode.attributes;
764
765     /* Check if we have attributes; if not we might have a text node */
766
767     if (!attributes) {
768       return;
769     }
770
771     var hookEvent = {
772       attrName: '',
773       attrValue: '',
774       keepAttr: true,
775       allowedAttributes: ALLOWED_ATTR
776     };
777     l = attributes.length;
778
779     /* Go backwards over all attributes; safely remove bad ones */
780     while (l--) {
781       attr = attributes[l];
782       var _attr = attr,
783           name = _attr.name,
784           namespaceURI = _attr.namespaceURI;
785
786       value = attr.value.trim();
787       lcName = name.toLowerCase();
788
789       /* Execute a hook if present */
790       hookEvent.attrName = lcName;
791       hookEvent.attrValue = value;
792       hookEvent.keepAttr = true;
793       _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
794       value = hookEvent.attrValue;
795
796       /* Remove attribute */
797       // Safari (iOS + Mac), last tested v8.0.5, crashes if you try to
798       // remove a "name" attribute from an <img> tag that has an "id"
799       // attribute at the time.
800       if (lcName === 'name' && currentNode.nodeName === 'IMG' && attributes.id) {
801         idAttr = attributes.id;
802         attributes = apply(arraySlice, attributes, []);
803         _removeAttribute('id', currentNode);
804         _removeAttribute(name, currentNode);
805         if (attributes.indexOf(idAttr) > l) {
806           currentNode.setAttribute('id', idAttr.value);
807         }
808       } else if (
809       // This works around a bug in Safari, where input[type=file]
810       // cannot be dynamically set after type has been removed
811       currentNode.nodeName === 'INPUT' && lcName === 'type' && value === 'file' && (ALLOWED_ATTR[lcName] || !FORBID_ATTR[lcName])) {
812         continue;
813       } else {
814         // This avoids a crash in Safari v9.0 with double-ids.
815         // The trick is to first set the id to be empty and then to
816         // remove the attribute
817         if (name === 'id') {
818           currentNode.setAttribute(name, '');
819         }
820         _removeAttribute(name, currentNode);
821       }
822
823       /* Did the hooks approve of the attribute? */
824       if (!hookEvent.keepAttr) {
825         continue;
826       }
827
828       /* Is `value` valid for this attribute? */
829       var lcTag = currentNode.nodeName.toLowerCase();
830       if (!_isValidAttribute(lcTag, lcName, value)) {
831         continue;
832       }
833
834       /* Handle invalid data-* attribute set by try-catching it */
835       try {
836         if (namespaceURI) {
837           currentNode.setAttributeNS(namespaceURI, name, value);
838         } else {
839           /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
840           currentNode.setAttribute(name, value);
841         }
842         DOMPurify.removed.pop();
843       } catch (err) {}
844     }
845
846     /* Execute a hook if present */
847     _executeHook('afterSanitizeAttributes', currentNode, null);
848   };
849
850   /**
851    * _sanitizeShadowDOM
852    *
853    * @param  {DocumentFragment} fragment to iterate over recursively
854    */
855   var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
856     var shadowNode = void 0;
857     var shadowIterator = _createIterator(fragment);
858
859     /* Execute a hook if present */
860     _executeHook('beforeSanitizeShadowDOM', fragment, null);
861
862     while (shadowNode = shadowIterator.nextNode()) {
863       /* Execute a hook if present */
864       _executeHook('uponSanitizeShadowNode', shadowNode, null);
865
866       /* Sanitize tags and elements */
867       if (_sanitizeElements(shadowNode)) {
868         continue;
869       }
870
871       /* Deep shadow DOM detected */
872       if (shadowNode.content instanceof DocumentFragment) {
873         _sanitizeShadowDOM(shadowNode.content);
874       }
875
876       /* Check attributes, sanitize if necessary */
877       _sanitizeAttributes(shadowNode);
878     }
879
880     /* Execute a hook if present */
881     _executeHook('afterSanitizeShadowDOM', fragment, null);
882   };
883
884   /**
885    * Sanitize
886    * Public method providing core sanitation functionality
887    *
888    * @param {String|Node} dirty string or DOM node
889    * @param {Object} configuration object
890    */
891   // eslint-disable-next-line complexity
892   DOMPurify.sanitize = function (dirty, cfg) {
893     var body = void 0;
894     var importedNode = void 0;
895     var currentNode = void 0;
896     var oldNode = void 0;
897     var returnNode = void 0;
898     /* Make sure we have a string to sanitize.
899       DO NOT return early, as this will return the wrong type if
900       the user has requested a DOM object rather than a string */
901     if (!dirty) {
902       dirty = '<!-->';
903     }
904
905     /* Stringify, in case dirty is an object */
906     if (typeof dirty !== 'string' && !_isNode(dirty)) {
907       // eslint-disable-next-line no-negated-condition
908       if (typeof dirty.toString !== 'function') {
909         throw new TypeError('toString is not a function');
910       } else {
911         dirty = dirty.toString();
912         if (typeof dirty !== 'string') {
913           throw new TypeError('dirty is not a string, aborting');
914         }
915       }
916     }
917
918     /* Check we can run. Otherwise fall back or ignore */
919     if (!DOMPurify.isSupported) {
920       if (_typeof(window.toStaticHTML) === 'object' || typeof window.toStaticHTML === 'function') {
921         if (typeof dirty === 'string') {
922           return window.toStaticHTML(dirty);
923         }
924         if (_isNode(dirty)) {
925           return window.toStaticHTML(dirty.outerHTML);
926         }
927       }
928       return dirty;
929     }
930
931     /* Assign config vars */
932     if (!SET_CONFIG) {
933       _parseConfig(cfg);
934     }
935
936     /* Clean up removed elements */
937     DOMPurify.removed = [];
938
939     if (IN_PLACE) {
940       /* No special handling necessary for in-place sanitization */
941     } else if (dirty instanceof Node) {
942       /* If dirty is a DOM element, append to an empty document to avoid
943          elements being stripped by the parser */
944       body = _initDocument('<!-->');
945       importedNode = body.ownerDocument.importNode(dirty, true);
946       if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
947         /* Node is already a body, use as is */
948         body = importedNode;
949       } else {
950         body.appendChild(importedNode);
951       }
952     } else {
953       /* Exit directly if we have nothing to do */
954       if (!RETURN_DOM && !WHOLE_DOCUMENT && dirty.indexOf('<') === -1) {
955         return trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
956       }
957
958       /* Initialize the document to work on */
959       body = _initDocument(dirty);
960
961       /* Check we have a DOM node from the data */
962       if (!body) {
963         return RETURN_DOM ? null : emptyHTML;
964       }
965     }
966
967     /* Remove first element node (ours) if FORCE_BODY is set */
968     if (body && FORCE_BODY) {
969       _forceRemove(body.firstChild);
970     }
971
972     /* Get node iterator */
973     var nodeIterator = _createIterator(IN_PLACE ? dirty : body);
974
975     /* Now start iterating over the created document */
976     while (currentNode = nodeIterator.nextNode()) {
977       /* Fix IE's strange behavior with manipulated textNodes #89 */
978       if (currentNode.nodeType === 3 && currentNode === oldNode) {
979         continue;
980       }
981
982       /* Sanitize tags and elements */
983       if (_sanitizeElements(currentNode)) {
984         continue;
985       }
986
987       /* Shadow DOM detected, sanitize it */
988       if (currentNode.content instanceof DocumentFragment) {
989         _sanitizeShadowDOM(currentNode.content);
990       }
991
992       /* Check attributes, sanitize if necessary */
993       _sanitizeAttributes(currentNode);
994
995       oldNode = currentNode;
996     }
997
998     oldNode = null;
999
1000     /* If we sanitized `dirty` in-place, return it. */
1001     if (IN_PLACE) {
1002       return dirty;
1003     }
1004
1005     /* Return sanitized string or DOM */
1006     if (RETURN_DOM) {
1007       if (RETURN_DOM_FRAGMENT) {
1008         returnNode = createDocumentFragment.call(body.ownerDocument);
1009
1010         while (body.firstChild) {
1011           returnNode.appendChild(body.firstChild);
1012         }
1013       } else {
1014         returnNode = body;
1015       }
1016
1017       if (RETURN_DOM_IMPORT) {
1018         /* AdoptNode() is not used because internal state is not reset
1019                (e.g. the past names map of a HTMLFormElement), this is safe
1020                in theory but we would rather not risk another attack vector.
1021                The state that is cloned by importNode() is explicitly defined
1022                by the specs. */
1023         returnNode = importNode.call(originalDocument, returnNode, true);
1024       }
1025
1026       return returnNode;
1027     }
1028
1029     var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1030     return trustedTypesPolicy ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1031   };
1032
1033   /**
1034    * Public method to set the configuration once
1035    * setConfig
1036    *
1037    * @param {Object} cfg configuration object
1038    */
1039   DOMPurify.setConfig = function (cfg) {
1040     _parseConfig(cfg);
1041     SET_CONFIG = true;
1042   };
1043
1044   /**
1045    * Public method to remove the configuration
1046    * clearConfig
1047    *
1048    */
1049   DOMPurify.clearConfig = function () {
1050     CONFIG = null;
1051     SET_CONFIG = false;
1052   };
1053
1054   /**
1055    * Public method to check if an attribute value is valid.
1056    * Uses last set config, if any. Otherwise, uses config defaults.
1057    * isValidAttribute
1058    *
1059    * @param  {string} tag Tag name of containing element.
1060    * @param  {string} attr Attribute name.
1061    * @param  {string} value Attribute value.
1062    * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
1063    */
1064   DOMPurify.isValidAttribute = function (tag, attr, value) {
1065     /* Initialize shared config vars if necessary. */
1066     if (!CONFIG) {
1067       _parseConfig({});
1068     }
1069     var lcTag = tag.toLowerCase();
1070     var lcName = attr.toLowerCase();
1071     return _isValidAttribute(lcTag, lcName, value);
1072   };
1073
1074   /**
1075    * AddHook
1076    * Public method to add DOMPurify hooks
1077    *
1078    * @param {String} entryPoint entry point for the hook to add
1079    * @param {Function} hookFunction function to execute
1080    */
1081   DOMPurify.addHook = function (entryPoint, hookFunction) {
1082     if (typeof hookFunction !== 'function') {
1083       return;
1084     }
1085     hooks[entryPoint] = hooks[entryPoint] || [];
1086     hooks[entryPoint].push(hookFunction);
1087   };
1088
1089   /**
1090    * RemoveHook
1091    * Public method to remove a DOMPurify hook at a given entryPoint
1092    * (pops it from the stack of hooks if more are present)
1093    *
1094    * @param {String} entryPoint entry point for the hook to remove
1095    */
1096   DOMPurify.removeHook = function (entryPoint) {
1097     if (hooks[entryPoint]) {
1098       hooks[entryPoint].pop();
1099     }
1100   };
1101
1102   /**
1103    * RemoveHooks
1104    * Public method to remove all DOMPurify hooks at a given entryPoint
1105    *
1106    * @param  {String} entryPoint entry point for the hooks to remove
1107    */
1108   DOMPurify.removeHooks = function (entryPoint) {
1109     if (hooks[entryPoint]) {
1110       hooks[entryPoint] = [];
1111     }
1112   };
1113
1114   /**
1115    * RemoveAllHooks
1116    * Public method to remove all DOMPurify hooks
1117    *
1118    */
1119   DOMPurify.removeAllHooks = function () {
1120     hooks = {};
1121   };
1122
1123   return DOMPurify;
1124 }
1125
1126 var purify = createDOMPurify();
1127
1128 return purify;
1129
1130 })));
1131 //# sourceMappingURL=purify.js.map