@opensystemslab/map 0.8.2 → 1.0.0-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.html CHANGED
@@ -41,11 +41,20 @@
41
41
 
42
42
  <body style="font-family:Inter,Helvetica,sans-serif;">
43
43
  <div style="display:flex;flex-direction:column;">
44
- <h1 style="color:red;font-size:16px;">*** This is a testing sandbox - these components are unaware of each other!
45
- ***</h1>
44
+ <h1 style="color:red;font-size:16px;">
45
+ *** This is a testing sandbox - these components are unaware of each other!***
46
+ </h1>
46
47
  <div style="margin-bottom:1em">
47
- <my-map zoom="20" maxZoom="23" id="example-map" drawMode useScaleBarStyle showScale showNorthArrow showPrint
48
- osProxyEndpoint="https://api.editor.planx.dev/proxy/ordnance-survey" ariaLabelOlFixedOverlay="Interactive example map" />
48
+ <my-map
49
+ id="example-map"
50
+ ariaLabelOlFixedOverlay="Interactive example map"
51
+ zoom="20"
52
+ maxZoom="23"
53
+ drawMode
54
+ drawMany
55
+ osCopyright="© Crown copyright and database rights 2024 OS (0)100024857"
56
+ osProxyEndpoint="https://api.editor.planx.dev/proxy/ordnance-survey"
57
+ />
49
58
  </div>
50
59
  <div style="margin-bottom:1em">
51
60
  <postcode-search hintText="Optional hint text shows up here" id="example-postcode" />
@@ -67,7 +76,6 @@
67
76
  <script>
68
77
  // --- MAP --- //
69
78
  const map = document.querySelector("my-map");
70
- map.geojsonDataCopyright = `<a href="https://www.planning.data.gov.uk/dataset/title-boundary" target="_blank">Title boundary</a> subject to Crown copyright and database rights ${new Date().getFullYear()} OS (0)100026316`;
71
79
  map.clipGeojsonData = {
72
80
  "type": "Feature",
73
81
  "geometry": {
@@ -104,9 +112,6 @@
104
112
  });
105
113
 
106
114
  // applicable when drawMode is enabled
107
- map.addEventListener("areaChange", ({ detail: area }) => {
108
- console.debug({ area });
109
- });
110
115
  map.addEventListener("geojsonChange", ({ detail: geojson }) => {
111
116
  console.debug({ geojson });
112
117
  });
@@ -0,0 +1,471 @@
1
+ /*! @license DOMPurify 2.5.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.5.5/LICENSE */
2
+ function I(a) {
3
+ "@babel/helpers - typeof";
4
+ return I = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
5
+ return typeof n;
6
+ } : function(n) {
7
+ return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
8
+ }, I(a);
9
+ }
10
+ function Pe(a, n) {
11
+ return Pe = Object.setPrototypeOf || function(s, c) {
12
+ return s.__proto__ = c, s;
13
+ }, Pe(a, n);
14
+ }
15
+ function zt() {
16
+ if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
17
+ if (typeof Proxy == "function") return !0;
18
+ try {
19
+ return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
20
+ })), !0;
21
+ } catch {
22
+ return !1;
23
+ }
24
+ }
25
+ function le(a, n, o) {
26
+ return zt() ? le = Reflect.construct : le = function(c, g, y) {
27
+ var N = [null];
28
+ N.push.apply(N, g);
29
+ var x = Function.bind.apply(c, N), j = new x();
30
+ return y && Pe(j, y.prototype), j;
31
+ }, le.apply(null, arguments);
32
+ }
33
+ function M(a) {
34
+ return Gt(a) || Wt(a) || Bt(a) || $t();
35
+ }
36
+ function Gt(a) {
37
+ if (Array.isArray(a)) return Fe(a);
38
+ }
39
+ function Wt(a) {
40
+ if (typeof Symbol < "u" && a[Symbol.iterator] != null || a["@@iterator"] != null) return Array.from(a);
41
+ }
42
+ function Bt(a, n) {
43
+ if (a) {
44
+ if (typeof a == "string") return Fe(a, n);
45
+ var o = Object.prototype.toString.call(a).slice(8, -1);
46
+ if (o === "Object" && a.constructor && (o = a.constructor.name), o === "Map" || o === "Set") return Array.from(a);
47
+ if (o === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)) return Fe(a, n);
48
+ }
49
+ }
50
+ function Fe(a, n) {
51
+ (n == null || n > a.length) && (n = a.length);
52
+ for (var o = 0, s = new Array(n); o < n; o++) s[o] = a[o];
53
+ return s;
54
+ }
55
+ function $t() {
56
+ throw new TypeError(`Invalid attempt to spread non-iterable instance.
57
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
58
+ }
59
+ var jt = Object.hasOwnProperty, ut = Object.setPrototypeOf, Yt = Object.isFrozen, Xt = Object.getPrototypeOf, Vt = Object.getOwnPropertyDescriptor, E = Object.freeze, b = Object.seal, qt = Object.create, vt = typeof Reflect < "u" && Reflect, ue = vt.apply, Ue = vt.construct;
60
+ ue || (ue = function(n, o, s) {
61
+ return n.apply(o, s);
62
+ });
63
+ E || (E = function(n) {
64
+ return n;
65
+ });
66
+ b || (b = function(n) {
67
+ return n;
68
+ });
69
+ Ue || (Ue = function(n, o) {
70
+ return le(n, M(o));
71
+ });
72
+ var Kt = O(Array.prototype.forEach), ft = O(Array.prototype.pop), q = O(Array.prototype.push), se = O(String.prototype.toLowerCase), De = O(String.prototype.toString), ct = O(String.prototype.match), L = O(String.prototype.replace), Zt = O(String.prototype.indexOf), Jt = O(String.prototype.trim), _ = O(RegExp.prototype.test), we = Qt(TypeError);
73
+ function O(a) {
74
+ return function(n) {
75
+ for (var o = arguments.length, s = new Array(o > 1 ? o - 1 : 0), c = 1; c < o; c++)
76
+ s[c - 1] = arguments[c];
77
+ return ue(a, n, s);
78
+ };
79
+ }
80
+ function Qt(a) {
81
+ return function() {
82
+ for (var n = arguments.length, o = new Array(n), s = 0; s < n; s++)
83
+ o[s] = arguments[s];
84
+ return Ue(a, o);
85
+ };
86
+ }
87
+ function l(a, n, o) {
88
+ var s;
89
+ o = (s = o) !== null && s !== void 0 ? s : se, ut && ut(a, null);
90
+ for (var c = n.length; c--; ) {
91
+ var g = n[c];
92
+ if (typeof g == "string") {
93
+ var y = o(g);
94
+ y !== g && (Yt(n) || (n[c] = y), g = y);
95
+ }
96
+ a[g] = !0;
97
+ }
98
+ return a;
99
+ }
100
+ function U(a) {
101
+ var n = qt(null), o;
102
+ for (o in a)
103
+ ue(jt, a, [o]) === !0 && (n[o] = a[o]);
104
+ return n;
105
+ }
106
+ function ie(a, n) {
107
+ for (; a !== null; ) {
108
+ var o = Vt(a, n);
109
+ if (o) {
110
+ if (o.get)
111
+ return O(o.get);
112
+ if (typeof o.value == "function")
113
+ return O(o.value);
114
+ }
115
+ a = Xt(a);
116
+ }
117
+ function s(c) {
118
+ return console.warn("fallback value for", c), null;
119
+ }
120
+ return s;
121
+ }
122
+ var mt = E(["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"]), Ce = E(["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"]), Ie = E(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), er = E(["animate", "color-profile", "cursor", "discard", "fedropshadow", "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"]), xe = E(["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"]), tr = E(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), pt = E(["#text"]), dt = E(["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", "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", "xmlns", "slot"]), ke = E(["accent-height", "accumulate", "additive", "alignment-baseline", "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", "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", "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", "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", "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"]), Tt = E(["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"]), oe = E(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), rr = b(/\{\{[\w\W]*|[\w\W]*\}\}/gm), ar = b(/<%[\w\W]*|[\w\W]*%>/gm), nr = b(/\${[\w\W]*}/gm), ir = b(/^data-[\-\w.\u00B7-\uFFFF]/), or = b(/^aria-[\-\w]+$/), lr = b(
123
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
124
+ // eslint-disable-line no-useless-escape
125
+ ), sr = b(/^(?:\w+script|data):/i), ur = b(
126
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
127
+ // eslint-disable-line no-control-regex
128
+ ), fr = b(/^html$/i), cr = b(/^[a-z][.\w]*(-[.\w]+)+$/i), mr = function() {
129
+ return typeof window > "u" ? null : window;
130
+ }, pr = function(n, o) {
131
+ if (I(n) !== "object" || typeof n.createPolicy != "function")
132
+ return null;
133
+ var s = null, c = "data-tt-policy-suffix";
134
+ o.currentScript && o.currentScript.hasAttribute(c) && (s = o.currentScript.getAttribute(c));
135
+ var g = "dompurify" + (s ? "#" + s : "");
136
+ try {
137
+ return n.createPolicy(g, {
138
+ createHTML: function(N) {
139
+ return N;
140
+ },
141
+ createScriptURL: function(N) {
142
+ return N;
143
+ }
144
+ });
145
+ } catch {
146
+ return console.warn("TrustedTypes policy " + g + " could not be created."), null;
147
+ }
148
+ };
149
+ function _t() {
150
+ var a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : mr(), n = function(e) {
151
+ return _t(e);
152
+ };
153
+ if (n.version = "2.5.5", n.removed = [], !a || !a.document || a.document.nodeType !== 9)
154
+ return n.isSupported = !1, n;
155
+ var o = a.document, s = a.document, c = a.DocumentFragment, g = a.HTMLTemplateElement, y = a.Node, N = a.Element, x = a.NodeFilter, j = a.NamedNodeMap, ht = j === void 0 ? a.NamedNodeMap || a.MozNamedAttrMap : j, Et = a.HTMLFormElement, At = a.DOMParser, K = a.trustedTypes, Z = N.prototype, yt = ie(Z, "cloneNode"), gt = ie(Z, "nextSibling"), St = ie(Z, "childNodes"), fe = ie(Z, "parentNode");
156
+ if (typeof g == "function") {
157
+ var ce = s.createElement("template");
158
+ ce.content && ce.content.ownerDocument && (s = ce.content.ownerDocument);
159
+ }
160
+ var R = pr(K, o), me = R ? R.createHTML("") : "", J = s, pe = J.implementation, bt = J.createNodeIterator, Ot = J.createDocumentFragment, Rt = J.getElementsByTagName, Lt = o.importNode, He = {};
161
+ try {
162
+ He = U(s).documentMode ? s.documentMode : {};
163
+ } catch {
164
+ }
165
+ var D = {};
166
+ n.isSupported = typeof fe == "function" && pe && pe.createHTMLDocument !== void 0 && He !== 9;
167
+ var de = rr, Te = ar, ve = nr, Mt = ir, Nt = or, Dt = sr, ze = ur, wt = cr, _e = lr, p = null, Ge = l({}, [].concat(M(mt), M(Ce), M(Ie), M(xe), M(pt))), d = null, We = l({}, [].concat(M(dt), M(ke), M(Tt), M(oe))), f = Object.seal(Object.create(null, {
168
+ tagNameCheck: {
169
+ writable: !0,
170
+ configurable: !1,
171
+ enumerable: !0,
172
+ value: null
173
+ },
174
+ attributeNameCheck: {
175
+ writable: !0,
176
+ configurable: !1,
177
+ enumerable: !0,
178
+ value: null
179
+ },
180
+ allowCustomizedBuiltInElements: {
181
+ writable: !0,
182
+ configurable: !1,
183
+ enumerable: !0,
184
+ value: !1
185
+ }
186
+ })), Y = null, he = null, Be = !0, Ee = !0, $e = !1, je = !0, H = !1, Ae = !0, k = !1, ye = !1, ge = !1, z = !1, Q = !1, ee = !1, Ye = !0, Xe = !1, Ct = "user-content-", Se = !0, X = !1, G = {}, W = null, Ve = l({}, ["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"]), qe = null, Ke = l({}, ["audio", "video", "img", "source", "image", "track"]), be = null, Ze = l({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), te = "http://www.w3.org/1998/Math/MathML", re = "http://www.w3.org/2000/svg", w = "http://www.w3.org/1999/xhtml", B = w, Oe = !1, Re = null, It = l({}, [te, re, w], De), P, xt = ["application/xhtml+xml", "text/html"], kt = "text/html", T, $ = null, Pt = s.createElement("form"), Je = function(e) {
187
+ return e instanceof RegExp || e instanceof Function;
188
+ }, Le = function(e) {
189
+ $ && $ === e || ((!e || I(e) !== "object") && (e = {}), e = U(e), P = // eslint-disable-next-line unicorn/prefer-includes
190
+ xt.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? P = kt : P = e.PARSER_MEDIA_TYPE, T = P === "application/xhtml+xml" ? De : se, p = "ALLOWED_TAGS" in e ? l({}, e.ALLOWED_TAGS, T) : Ge, d = "ALLOWED_ATTR" in e ? l({}, e.ALLOWED_ATTR, T) : We, Re = "ALLOWED_NAMESPACES" in e ? l({}, e.ALLOWED_NAMESPACES, De) : It, be = "ADD_URI_SAFE_ATTR" in e ? l(
191
+ U(Ze),
192
+ // eslint-disable-line indent
193
+ e.ADD_URI_SAFE_ATTR,
194
+ // eslint-disable-line indent
195
+ T
196
+ // eslint-disable-line indent
197
+ ) : Ze, qe = "ADD_DATA_URI_TAGS" in e ? l(
198
+ U(Ke),
199
+ // eslint-disable-line indent
200
+ e.ADD_DATA_URI_TAGS,
201
+ // eslint-disable-line indent
202
+ T
203
+ // eslint-disable-line indent
204
+ ) : Ke, W = "FORBID_CONTENTS" in e ? l({}, e.FORBID_CONTENTS, T) : Ve, Y = "FORBID_TAGS" in e ? l({}, e.FORBID_TAGS, T) : {}, he = "FORBID_ATTR" in e ? l({}, e.FORBID_ATTR, T) : {}, G = "USE_PROFILES" in e ? e.USE_PROFILES : !1, Be = e.ALLOW_ARIA_ATTR !== !1, Ee = e.ALLOW_DATA_ATTR !== !1, $e = e.ALLOW_UNKNOWN_PROTOCOLS || !1, je = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, H = e.SAFE_FOR_TEMPLATES || !1, Ae = e.SAFE_FOR_XML !== !1, k = e.WHOLE_DOCUMENT || !1, z = e.RETURN_DOM || !1, Q = e.RETURN_DOM_FRAGMENT || !1, ee = e.RETURN_TRUSTED_TYPE || !1, ge = e.FORCE_BODY || !1, Ye = e.SANITIZE_DOM !== !1, Xe = e.SANITIZE_NAMED_PROPS || !1, Se = e.KEEP_CONTENT !== !1, X = e.IN_PLACE || !1, _e = e.ALLOWED_URI_REGEXP || _e, B = e.NAMESPACE || w, f = e.CUSTOM_ELEMENT_HANDLING || {}, e.CUSTOM_ELEMENT_HANDLING && Je(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (f.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && Je(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (f.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (f.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), H && (Ee = !1), Q && (z = !0), G && (p = l({}, M(pt)), d = [], G.html === !0 && (l(p, mt), l(d, dt)), G.svg === !0 && (l(p, Ce), l(d, ke), l(d, oe)), G.svgFilters === !0 && (l(p, Ie), l(d, ke), l(d, oe)), G.mathMl === !0 && (l(p, xe), l(d, Tt), l(d, oe))), e.ADD_TAGS && (p === Ge && (p = U(p)), l(p, e.ADD_TAGS, T)), e.ADD_ATTR && (d === We && (d = U(d)), l(d, e.ADD_ATTR, T)), e.ADD_URI_SAFE_ATTR && l(be, e.ADD_URI_SAFE_ATTR, T), e.FORBID_CONTENTS && (W === Ve && (W = U(W)), l(W, e.FORBID_CONTENTS, T)), Se && (p["#text"] = !0), k && l(p, ["html", "head", "body"]), p.table && (l(p, ["tbody"]), delete Y.tbody), E && E(e), $ = e);
205
+ }, Qe = l({}, ["mi", "mo", "mn", "ms", "mtext"]), et = l({}, ["foreignobject", "annotation-xml"]), Ft = l({}, ["title", "style", "font", "a", "script"]), ae = l({}, Ce);
206
+ l(ae, Ie), l(ae, er);
207
+ var Me = l({}, xe);
208
+ l(Me, tr);
209
+ var Ut = function(e) {
210
+ var t = fe(e);
211
+ (!t || !t.tagName) && (t = {
212
+ namespaceURI: B,
213
+ tagName: "template"
214
+ });
215
+ var r = se(e.tagName), u = se(t.tagName);
216
+ return Re[e.namespaceURI] ? e.namespaceURI === re ? t.namespaceURI === w ? r === "svg" : t.namespaceURI === te ? r === "svg" && (u === "annotation-xml" || Qe[u]) : !!ae[r] : e.namespaceURI === te ? t.namespaceURI === w ? r === "math" : t.namespaceURI === re ? r === "math" && et[u] : !!Me[r] : e.namespaceURI === w ? t.namespaceURI === re && !et[u] || t.namespaceURI === te && !Qe[u] ? !1 : !Me[r] && (Ft[r] || !ae[r]) : !!(P === "application/xhtml+xml" && Re[e.namespaceURI]) : !1;
217
+ }, S = function(e) {
218
+ q(n.removed, {
219
+ element: e
220
+ });
221
+ try {
222
+ e.parentNode.removeChild(e);
223
+ } catch {
224
+ try {
225
+ e.outerHTML = me;
226
+ } catch {
227
+ e.remove();
228
+ }
229
+ }
230
+ }, ne = function(e, t) {
231
+ try {
232
+ q(n.removed, {
233
+ attribute: t.getAttributeNode(e),
234
+ from: t
235
+ });
236
+ } catch {
237
+ q(n.removed, {
238
+ attribute: null,
239
+ from: t
240
+ });
241
+ }
242
+ if (t.removeAttribute(e), e === "is" && !d[e])
243
+ if (z || Q)
244
+ try {
245
+ S(t);
246
+ } catch {
247
+ }
248
+ else
249
+ try {
250
+ t.setAttribute(e, "");
251
+ } catch {
252
+ }
253
+ }, tt = function(e) {
254
+ var t, r;
255
+ if (ge)
256
+ e = "<remove></remove>" + e;
257
+ else {
258
+ var u = ct(e, /^[\r\n\t ]+/);
259
+ r = u && u[0];
260
+ }
261
+ P === "application/xhtml+xml" && B === w && (e = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + e + "</body></html>");
262
+ var A = R ? R.createHTML(e) : e;
263
+ if (B === w)
264
+ try {
265
+ t = new At().parseFromString(A, P);
266
+ } catch {
267
+ }
268
+ if (!t || !t.documentElement) {
269
+ t = pe.createDocument(B, "template", null);
270
+ try {
271
+ t.documentElement.innerHTML = Oe ? me : A;
272
+ } catch {
273
+ }
274
+ }
275
+ var h = t.body || t.documentElement;
276
+ return e && r && h.insertBefore(s.createTextNode(r), h.childNodes[0] || null), B === w ? Rt.call(t, k ? "html" : "body")[0] : k ? t.documentElement : h;
277
+ }, rt = function(e) {
278
+ return bt.call(
279
+ e.ownerDocument || e,
280
+ e,
281
+ // eslint-disable-next-line no-bitwise
282
+ x.SHOW_ELEMENT | x.SHOW_COMMENT | x.SHOW_TEXT | x.SHOW_PROCESSING_INSTRUCTION | x.SHOW_CDATA_SECTION,
283
+ null,
284
+ !1
285
+ );
286
+ }, at = function(e) {
287
+ return e instanceof Et && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof ht) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
288
+ }, V = function(e) {
289
+ return I(y) === "object" ? e instanceof y : e && I(e) === "object" && typeof e.nodeType == "number" && typeof e.nodeName == "string";
290
+ }, C = function(e, t, r) {
291
+ D[e] && Kt(D[e], function(u) {
292
+ u.call(n, t, r, $);
293
+ });
294
+ }, nt = function(e) {
295
+ var t;
296
+ if (C("beforeSanitizeElements", e, null), at(e) || _(/[\u0080-\uFFFF]/, e.nodeName))
297
+ return S(e), !0;
298
+ var r = T(e.nodeName);
299
+ if (C("uponSanitizeElement", e, {
300
+ tagName: r,
301
+ allowedTags: p
302
+ }), e.hasChildNodes() && !V(e.firstElementChild) && (!V(e.content) || !V(e.content.firstElementChild)) && _(/<[/\w]/g, e.innerHTML) && _(/<[/\w]/g, e.textContent) || r === "select" && _(/<template/i, e.innerHTML) || e.nodeType === 7 || Ae && e.nodeType === 8 && _(/<[/\w]/g, e.data))
303
+ return S(e), !0;
304
+ if (!p[r] || Y[r]) {
305
+ if (!Y[r] && ot(r) && (f.tagNameCheck instanceof RegExp && _(f.tagNameCheck, r) || f.tagNameCheck instanceof Function && f.tagNameCheck(r)))
306
+ return !1;
307
+ if (Se && !W[r]) {
308
+ var u = fe(e) || e.parentNode, A = St(e) || e.childNodes;
309
+ if (A && u)
310
+ for (var h = A.length, v = h - 1; v >= 0; --v) {
311
+ var F = yt(A[v], !0);
312
+ F.__removalCount = (e.__removalCount || 0) + 1, u.insertBefore(F, gt(e));
313
+ }
314
+ }
315
+ return S(e), !0;
316
+ }
317
+ return e instanceof N && !Ut(e) || (r === "noscript" || r === "noembed" || r === "noframes") && _(/<\/no(script|embed|frames)/i, e.innerHTML) ? (S(e), !0) : (H && e.nodeType === 3 && (t = e.textContent, t = L(t, de, " "), t = L(t, Te, " "), t = L(t, ve, " "), e.textContent !== t && (q(n.removed, {
318
+ element: e.cloneNode()
319
+ }), e.textContent = t)), C("afterSanitizeElements", e, null), !1);
320
+ }, it = function(e, t, r) {
321
+ if (Ye && (t === "id" || t === "name") && (r in s || r in Pt))
322
+ return !1;
323
+ if (!(Ee && !he[t] && _(Mt, t))) {
324
+ if (!(Be && _(Nt, t))) {
325
+ if (!d[t] || he[t]) {
326
+ if (
327
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
328
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
329
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
330
+ !(ot(e) && (f.tagNameCheck instanceof RegExp && _(f.tagNameCheck, e) || f.tagNameCheck instanceof Function && f.tagNameCheck(e)) && (f.attributeNameCheck instanceof RegExp && _(f.attributeNameCheck, t) || f.attributeNameCheck instanceof Function && f.attributeNameCheck(t)) || // Alternative, second condition checks if it's an `is`-attribute, AND
331
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
332
+ t === "is" && f.allowCustomizedBuiltInElements && (f.tagNameCheck instanceof RegExp && _(f.tagNameCheck, r) || f.tagNameCheck instanceof Function && f.tagNameCheck(r)))
333
+ ) return !1;
334
+ } else if (!be[t]) {
335
+ if (!_(_e, L(r, ze, ""))) {
336
+ if (!((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && Zt(r, "data:") === 0 && qe[e])) {
337
+ if (!($e && !_(Dt, L(r, ze, "")))) {
338
+ if (r)
339
+ return !1;
340
+ }
341
+ }
342
+ }
343
+ }
344
+ }
345
+ }
346
+ return !0;
347
+ }, ot = function(e) {
348
+ return e !== "annotation-xml" && ct(e, wt);
349
+ }, lt = function(e) {
350
+ var t, r, u, A;
351
+ C("beforeSanitizeAttributes", e, null);
352
+ var h = e.attributes;
353
+ if (h) {
354
+ var v = {
355
+ attrName: "",
356
+ attrValue: "",
357
+ keepAttr: !0,
358
+ allowedAttributes: d
359
+ };
360
+ for (A = h.length; A--; ) {
361
+ t = h[A];
362
+ var F = t, m = F.name, Ne = F.namespaceURI;
363
+ if (r = m === "value" ? t.value : Jt(t.value), u = T(m), v.attrName = u, v.attrValue = r, v.keepAttr = !0, v.forceKeepAttr = void 0, C("uponSanitizeAttribute", e, v), r = v.attrValue, !v.forceKeepAttr && (ne(m, e), !!v.keepAttr)) {
364
+ if (!je && _(/\/>/i, r)) {
365
+ ne(m, e);
366
+ continue;
367
+ }
368
+ if (Ae && _(/((--!?|])>)|<\/(style|title)/i, r)) {
369
+ ne(m, e);
370
+ continue;
371
+ }
372
+ H && (r = L(r, de, " "), r = L(r, Te, " "), r = L(r, ve, " "));
373
+ var st = T(e.nodeName);
374
+ if (it(st, u, r)) {
375
+ if (Xe && (u === "id" || u === "name") && (ne(m, e), r = Ct + r), R && I(K) === "object" && typeof K.getAttributeType == "function" && !Ne)
376
+ switch (K.getAttributeType(st, u)) {
377
+ case "TrustedHTML": {
378
+ r = R.createHTML(r);
379
+ break;
380
+ }
381
+ case "TrustedScriptURL": {
382
+ r = R.createScriptURL(r);
383
+ break;
384
+ }
385
+ }
386
+ try {
387
+ Ne ? e.setAttributeNS(Ne, m, r) : e.setAttribute(m, r), at(e) ? S(e) : ft(n.removed);
388
+ } catch {
389
+ }
390
+ }
391
+ }
392
+ }
393
+ C("afterSanitizeAttributes", e, null);
394
+ }
395
+ }, Ht = function i(e) {
396
+ var t, r = rt(e);
397
+ for (C("beforeSanitizeShadowDOM", e, null); t = r.nextNode(); )
398
+ C("uponSanitizeShadowNode", t, null), !nt(t) && (t.content instanceof c && i(t.content), lt(t));
399
+ C("afterSanitizeShadowDOM", e, null);
400
+ };
401
+ return n.sanitize = function(i) {
402
+ var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t, r, u, A, h;
403
+ if (Oe = !i, Oe && (i = "<!-->"), typeof i != "string" && !V(i))
404
+ if (typeof i.toString == "function") {
405
+ if (i = i.toString(), typeof i != "string")
406
+ throw we("dirty is not a string, aborting");
407
+ } else
408
+ throw we("toString is not a function");
409
+ if (!n.isSupported) {
410
+ if (I(a.toStaticHTML) === "object" || typeof a.toStaticHTML == "function") {
411
+ if (typeof i == "string")
412
+ return a.toStaticHTML(i);
413
+ if (V(i))
414
+ return a.toStaticHTML(i.outerHTML);
415
+ }
416
+ return i;
417
+ }
418
+ if (ye || Le(e), n.removed = [], typeof i == "string" && (X = !1), X) {
419
+ if (i.nodeName) {
420
+ var v = T(i.nodeName);
421
+ if (!p[v] || Y[v])
422
+ throw we("root node is forbidden and cannot be sanitized in-place");
423
+ }
424
+ } else if (i instanceof y)
425
+ t = tt("<!---->"), r = t.ownerDocument.importNode(i, !0), r.nodeType === 1 && r.nodeName === "BODY" || r.nodeName === "HTML" ? t = r : t.appendChild(r);
426
+ else {
427
+ if (!z && !H && !k && // eslint-disable-next-line unicorn/prefer-includes
428
+ i.indexOf("<") === -1)
429
+ return R && ee ? R.createHTML(i) : i;
430
+ if (t = tt(i), !t)
431
+ return z ? null : ee ? me : "";
432
+ }
433
+ t && ge && S(t.firstChild);
434
+ for (var F = rt(X ? i : t); u = F.nextNode(); )
435
+ u.nodeType === 3 && u === A || nt(u) || (u.content instanceof c && Ht(u.content), lt(u), A = u);
436
+ if (A = null, X)
437
+ return i;
438
+ if (z) {
439
+ if (Q)
440
+ for (h = Ot.call(t.ownerDocument); t.firstChild; )
441
+ h.appendChild(t.firstChild);
442
+ else
443
+ h = t;
444
+ return (d.shadowroot || d.shadowrootmod) && (h = Lt.call(o, h, !0)), h;
445
+ }
446
+ var m = k ? t.outerHTML : t.innerHTML;
447
+ return k && p["!doctype"] && t.ownerDocument && t.ownerDocument.doctype && t.ownerDocument.doctype.name && _(fr, t.ownerDocument.doctype.name) && (m = "<!DOCTYPE " + t.ownerDocument.doctype.name + `>
448
+ ` + m), H && (m = L(m, de, " "), m = L(m, Te, " "), m = L(m, ve, " ")), R && ee ? R.createHTML(m) : m;
449
+ }, n.setConfig = function(i) {
450
+ Le(i), ye = !0;
451
+ }, n.clearConfig = function() {
452
+ $ = null, ye = !1;
453
+ }, n.isValidAttribute = function(i, e, t) {
454
+ $ || Le({});
455
+ var r = T(i), u = T(e);
456
+ return it(r, u, t);
457
+ }, n.addHook = function(i, e) {
458
+ typeof e == "function" && (D[i] = D[i] || [], q(D[i], e));
459
+ }, n.removeHook = function(i) {
460
+ if (D[i])
461
+ return ft(D[i]);
462
+ }, n.removeHooks = function(i) {
463
+ D[i] && (D[i] = []);
464
+ }, n.removeAllHooks = function() {
465
+ D = {};
466
+ }, n;
467
+ }
468
+ var Tr = _t();
469
+ export {
470
+ Tr as default
471
+ };