@opensystemslab/map 0.8.1 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensystemslab/map",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "license": "MPL-2.0",
5
5
  "private": false,
6
6
  "repository": {
@@ -32,9 +32,9 @@
32
32
  "govuk-frontend": "^5.0.0",
33
33
  "jspdf": "^2.5.1",
34
34
  "lit": "^3.0.1",
35
- "ol": "^7.5.1",
36
- "ol-ext": "^4.0.11",
37
- "ol-mapbox-style": "^12.0.0",
35
+ "ol": "^9.1.0",
36
+ "ol-ext": "^4.0.17",
37
+ "ol-mapbox-style": "^12.3.0",
38
38
  "postcode": "^5.1.0",
39
39
  "proj4": "^2.9.2",
40
40
  "rambda": "^8.6.0"
@@ -45,7 +45,7 @@
45
45
  "@testing-library/user-event": "^14.5.2",
46
46
  "@types/file-saver": "^2.0.7",
47
47
  "@types/node": "18.19.21",
48
- "@types/ol-ext": "npm:@siedlerchr/types-ol-ext@^3.0.9",
48
+ "@types/ol-ext": "npm:@siedlerchr/types-ol-ext@^3.3.0",
49
49
  "@types/proj4": "^2.5.5",
50
50
  "@vitest/ui": "^0.34.7",
51
51
  "happy-dom": "^9.1.9",
@@ -55,7 +55,7 @@
55
55
  "rollup-plugin-postcss-lit": "^2.1.0",
56
56
  "sass": "^1.69.5",
57
57
  "typescript": "^5.3.3",
58
- "vite": "^5.1.6",
58
+ "vite": "^5.1.7",
59
59
  "vitest": "0.34.6",
60
60
  "wait-for-expect": "^3.0.2"
61
61
  },
@@ -65,5 +65,10 @@
65
65
  "stackblitz": {
66
66
  "startCommand": "npm run test:ui"
67
67
  },
68
- "packageManager": "pnpm@7.13.4"
68
+ "packageManager": "pnpm@8.6.6",
69
+ "pnpm": {
70
+ "overrides": {
71
+ "braces@<3.0.3": ">=3.0.3"
72
+ }
73
+ }
69
74
  }
@@ -3,8 +3,8 @@ import { Vector as VectorLayer } from "ol/layer";
3
3
  import { Vector as VectorSource } from "ol/source";
4
4
  export type DrawTypeEnum = "Polygon" | "Point";
5
5
  export type DrawPointerEnum = "crosshair" | "dot";
6
- export declare const drawingSource: VectorSource<import("ol/geom/Geometry").default>;
7
- export declare function configureDrawingLayer(drawType: DrawTypeEnum, pointColor: string, drawColor: string, drawFillColor: string): VectorLayer<VectorSource<import("ol/geom/Geometry").default>>;
6
+ export declare const drawingSource: VectorSource<import("ol/Feature").default<import("ol/geom/Geometry").default>>;
7
+ export declare function configureDrawingLayer(drawType: DrawTypeEnum, pointColor: string, drawColor: string, drawFillColor: string): VectorLayer<VectorSource<import("ol/Feature").default<import("ol/geom/Geometry").default>>>;
8
8
  export declare function configureDraw(drawType: DrawTypeEnum, pointerStyle: DrawPointerEnum, pointColor: string, drawColor: string, drawFillColor: string): Draw;
9
9
  export declare const snap: Snap;
10
10
  export declare function configureModify(pointerStyle: DrawPointerEnum, drawColor: string): Modify;
@@ -66,6 +66,7 @@ export declare class MyMap extends LitElement {
66
66
  coordinates: never[];
67
67
  };
68
68
  };
69
+ ariaLabelOlFixedOverlay: string;
69
70
  map?: Map;
70
71
  constructor();
71
72
  firstUpdated(): void;
@@ -1,7 +1,7 @@
1
1
  import { Vector as VectorLayer } from "ol/layer";
2
2
  import { Vector as VectorSource } from "ol/source";
3
- export declare const outlineSource: VectorSource<import("ol/geom/Geometry").default>;
4
- export declare function makeFeatureLayer(color: string, featureFill: boolean, borderNone: boolean): VectorLayer<VectorSource<import("ol/geom/Geometry").default>>;
3
+ export declare const outlineSource: VectorSource<import("ol/Feature").default<import("ol/geom/Geometry").default>>;
4
+ export declare function makeFeatureLayer(color: string, featureFill: boolean, borderNone: boolean): VectorLayer<VectorSource<import("ol/Feature").default<import("ol/geom/Geometry").default>>>;
5
5
  /**
6
6
  * Create an OGC XML filter parameter value which will select the TopographicArea
7
7
  * features containing the coordinates of the provided point
@@ -1,8 +1,8 @@
1
1
  import { Vector as VectorLayer } from "ol/layer";
2
2
  import VectorTileLayer from "ol/layer/VectorTile";
3
3
  import VectorSource from "ol/source/Vector";
4
- export declare const pointsSource: VectorSource<import("ol/geom/Geometry").default>;
5
- export declare const pointsLayer: VectorLayer<VectorSource<import("ol/geom/Geometry").default>>;
4
+ export declare const pointsSource: VectorSource<never>;
5
+ export declare const pointsLayer: VectorLayer<VectorSource<never>>;
6
6
  /**
7
7
  * Extract points that are available to snap to when a VectorTileLayer basemap is displayed
8
8
  * @param basemap - a VectorTileLayer
@@ -20,7 +20,7 @@ export declare function formatArea(polygon: Geometry, unit: AreaUnitEnum): strin
20
20
  * @param bufferValue - amount to buffer extent by, refer to https://openlayers.org/en/latest/apidoc/module-ol_extent.html#.buffer
21
21
  * @returns - a map view
22
22
  */
23
- export declare function fitToData(olMap: Map, olSource: Vector<Geometry>, bufferValue: number): void;
23
+ export declare function fitToData(olMap: Map, olSource: Vector<Feature<Geometry>>, bufferValue: number): void;
24
24
  /**
25
25
  * Translate a hex color to an rgba string with opacity
26
26
  * @param hexColor - a hex color string
@@ -34,4 +34,4 @@ export declare function hexToRgba(hexColor: string, alpha: number): string;
34
34
  * @param projection
35
35
  * @returns
36
36
  */
37
- export declare function makeGeoJSON(source: VectorSource<Geometry> | Feature<Geometry>[], projection: ProjectionEnum): GeoJSONObject;
37
+ export declare function makeGeoJSON(source: VectorSource<Feature<Geometry>> | Feature<Geometry>[], projection: ProjectionEnum): GeoJSONObject;
@@ -1,471 +0,0 @@
1
- /*! @license DOMPurify 2.4.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.3/LICENSE */
2
- function C(r) {
3
- "@babel/helpers - typeof";
4
- return C = 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
- }, C(r);
9
- }
10
- function ke(r, n) {
11
- return ke = Object.setPrototypeOf || function(s, f) {
12
- return s.__proto__ = f, s;
13
- }, ke(r, n);
14
- }
15
- function Pt() {
16
- if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
17
- return !1;
18
- if (typeof Proxy == "function")
19
- return !0;
20
- try {
21
- return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
22
- })), !0;
23
- } catch {
24
- return !1;
25
- }
26
- }
27
- function oe(r, n, o) {
28
- return Pt() ? oe = Reflect.construct : oe = function(f, O, L) {
29
- var N = [null];
30
- N.push.apply(N, O);
31
- var W = Function.bind.apply(f, N), $ = new W();
32
- return L && ke($, L.prototype), $;
33
- }, oe.apply(null, arguments);
34
- }
35
- function S(r) {
36
- return Ft(r) || Ut(r) || Ht(r) || zt();
37
- }
38
- function Ft(r) {
39
- if (Array.isArray(r))
40
- return Pe(r);
41
- }
42
- function Ut(r) {
43
- if (typeof Symbol < "u" && r[Symbol.iterator] != null || r["@@iterator"] != null)
44
- return Array.from(r);
45
- }
46
- function Ht(r, n) {
47
- if (r) {
48
- if (typeof r == "string")
49
- return Pe(r, n);
50
- var o = Object.prototype.toString.call(r).slice(8, -1);
51
- if (o === "Object" && r.constructor && (o = r.constructor.name), o === "Map" || o === "Set")
52
- return Array.from(r);
53
- if (o === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))
54
- return Pe(r, n);
55
- }
56
- }
57
- function Pe(r, n) {
58
- (n == null || n > r.length) && (n = r.length);
59
- for (var o = 0, s = new Array(n); o < n; o++)
60
- s[o] = r[o];
61
- return s;
62
- }
63
- function zt() {
64
- throw new TypeError(`Invalid attempt to spread non-iterable instance.
65
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
66
- }
67
- var Gt = Object.hasOwnProperty, ot = Object.setPrototypeOf, Bt = Object.isFrozen, Wt = Object.getPrototypeOf, $t = Object.getOwnPropertyDescriptor, A = Object.freeze, R = Object.seal, jt = Object.create, mt = typeof Reflect < "u" && Reflect, se = mt.apply, Fe = mt.construct;
68
- se || (se = function(n, o, s) {
69
- return n.apply(o, s);
70
- });
71
- A || (A = function(n) {
72
- return n;
73
- });
74
- R || (R = function(n) {
75
- return n;
76
- });
77
- Fe || (Fe = function(n, o) {
78
- return oe(n, S(o));
79
- });
80
- var Yt = y(Array.prototype.forEach), lt = y(Array.prototype.pop), X = y(Array.prototype.push), le = y(String.prototype.toLowerCase), Le = y(String.prototype.toString), Vt = y(String.prototype.match), b = y(String.prototype.replace), Xt = y(String.prototype.indexOf), qt = y(String.prototype.trim), _ = y(RegExp.prototype.test), Me = Kt(TypeError);
81
- function y(r) {
82
- return function(n) {
83
- for (var o = arguments.length, s = new Array(o > 1 ? o - 1 : 0), f = 1; f < o; f++)
84
- s[f - 1] = arguments[f];
85
- return se(r, n, s);
86
- };
87
- }
88
- function Kt(r) {
89
- return function() {
90
- for (var n = arguments.length, o = new Array(n), s = 0; s < n; s++)
91
- o[s] = arguments[s];
92
- return Fe(r, o);
93
- };
94
- }
95
- function l(r, n, o) {
96
- o = o || le, ot && ot(r, null);
97
- for (var s = n.length; s--; ) {
98
- var f = n[s];
99
- if (typeof f == "string") {
100
- var O = o(f);
101
- O !== f && (Bt(n) || (n[s] = O), f = O);
102
- }
103
- r[f] = !0;
104
- }
105
- return r;
106
- }
107
- function P(r) {
108
- var n = jt(null), o;
109
- for (o in r)
110
- se(Gt, r, [o]) === !0 && (n[o] = r[o]);
111
- return n;
112
- }
113
- function ne(r, n) {
114
- for (; r !== null; ) {
115
- var o = $t(r, n);
116
- if (o) {
117
- if (o.get)
118
- return y(o.get);
119
- if (typeof o.value == "function")
120
- return y(o.value);
121
- }
122
- r = Wt(r);
123
- }
124
- function s(f) {
125
- return console.warn("fallback value for", f), null;
126
- }
127
- return s;
128
- }
129
- var st = A(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), we = A(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Ie = A(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), Zt = A(["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"]), Ce = A(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover"]), Jt = A(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), ut = A(["#text"]), ft = A(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "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"]), xe = A(["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"]), ct = A(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), ie = A(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Qt = R(/\{\{[\w\W]*|[\w\W]*\}\}/gm), er = R(/<%[\w\W]*|[\w\W]*%>/gm), tr = R(/\${[\w\W]*}/gm), rr = R(/^data-[\-\w.\u00B7-\uFFFF]/), ar = R(/^aria-[\-\w]+$/), nr = R(
130
- /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
131
- // eslint-disable-line no-useless-escape
132
- ), ir = R(/^(?:\w+script|data):/i), or = R(
133
- /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
134
- // eslint-disable-line no-control-regex
135
- ), lr = R(/^html$/i), sr = function() {
136
- return typeof window > "u" ? null : window;
137
- }, ur = function(n, o) {
138
- if (C(n) !== "object" || typeof n.createPolicy != "function")
139
- return null;
140
- var s = null, f = "data-tt-policy-suffix";
141
- o.currentScript && o.currentScript.hasAttribute(f) && (s = o.currentScript.getAttribute(f));
142
- var O = "dompurify" + (s ? "#" + s : "");
143
- try {
144
- return n.createPolicy(O, {
145
- createHTML: function(N) {
146
- return N;
147
- },
148
- createScriptURL: function(N) {
149
- return N;
150
- }
151
- });
152
- } catch {
153
- return console.warn("TrustedTypes policy " + O + " could not be created."), null;
154
- }
155
- };
156
- function pt() {
157
- var r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : sr(), n = function(e) {
158
- return pt(e);
159
- };
160
- if (n.version = "2.4.3", n.removed = [], !r || !r.document || r.document.nodeType !== 9)
161
- return n.isSupported = !1, n;
162
- var o = r.document, s = r.document, f = r.DocumentFragment, O = r.HTMLTemplateElement, L = r.Node, N = r.Element, W = r.NodeFilter, $ = r.NamedNodeMap, dt = $ === void 0 ? r.NamedNodeMap || r.MozNamedAttrMap : $, vt = r.HTMLFormElement, Tt = r.DOMParser, q = r.trustedTypes, K = N.prototype, ht = ne(K, "cloneNode"), _t = ne(K, "nextSibling"), At = ne(K, "childNodes"), ue = ne(K, "parentNode");
163
- if (typeof O == "function") {
164
- var fe = s.createElement("template");
165
- fe.content && fe.content.ownerDocument && (s = fe.content.ownerDocument);
166
- }
167
- var g = ur(q, o), ce = g ? g.createHTML("") : "", Z = s, me = Z.implementation, Et = Z.createNodeIterator, yt = Z.createDocumentFragment, gt = Z.getElementsByTagName, bt = o.importNode, Ue = {};
168
- try {
169
- Ue = P(s).documentMode ? s.documentMode : {};
170
- } catch {
171
- }
172
- var D = {};
173
- n.isSupported = typeof ue == "function" && me && typeof me.createHTMLDocument < "u" && Ue !== 9;
174
- var pe = Qt, de = er, ve = tr, St = rr, Rt = ar, Ot = ir, He = or, Te = nr, m = null, ze = l({}, [].concat(S(st), S(we), S(Ie), S(Ce), S(ut))), v = null, Ge = l({}, [].concat(S(ft), S(xe), S(ct), S(ie))), c = Object.seal(Object.create(null, {
175
- tagNameCheck: {
176
- writable: !0,
177
- configurable: !1,
178
- enumerable: !0,
179
- value: null
180
- },
181
- attributeNameCheck: {
182
- writable: !0,
183
- configurable: !1,
184
- enumerable: !0,
185
- value: null
186
- },
187
- allowCustomizedBuiltInElements: {
188
- writable: !0,
189
- configurable: !1,
190
- enumerable: !0,
191
- value: !1
192
- }
193
- })), j = null, he = null, Be = !0, _e = !0, We = !1, F = !1, x = !1, Ae = !1, Ee = !1, U = !1, J = !1, Q = !1, $e = !0, je = !1, Nt = "user-content-", ye = !0, Y = !1, H = {}, z = null, Ye = 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"]), Ve = null, Xe = l({}, ["audio", "video", "img", "source", "image", "track"]), ge = null, qe = l({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), ee = "http://www.w3.org/1998/Math/MathML", te = "http://www.w3.org/2000/svg", M = "http://www.w3.org/1999/xhtml", G = M, be = !1, Se = null, Dt = l({}, [ee, te, M], Le), k, Lt = ["application/xhtml+xml", "text/html"], Mt = "text/html", p, B = null, wt = s.createElement("form"), Ke = function(e) {
194
- return e instanceof RegExp || e instanceof Function;
195
- }, Re = function(e) {
196
- B && B === e || ((!e || C(e) !== "object") && (e = {}), e = P(e), k = // eslint-disable-next-line unicorn/prefer-includes
197
- Lt.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? k = Mt : k = e.PARSER_MEDIA_TYPE, p = k === "application/xhtml+xml" ? Le : le, m = "ALLOWED_TAGS" in e ? l({}, e.ALLOWED_TAGS, p) : ze, v = "ALLOWED_ATTR" in e ? l({}, e.ALLOWED_ATTR, p) : Ge, Se = "ALLOWED_NAMESPACES" in e ? l({}, e.ALLOWED_NAMESPACES, Le) : Dt, ge = "ADD_URI_SAFE_ATTR" in e ? l(
198
- P(qe),
199
- // eslint-disable-line indent
200
- e.ADD_URI_SAFE_ATTR,
201
- // eslint-disable-line indent
202
- p
203
- // eslint-disable-line indent
204
- ) : qe, Ve = "ADD_DATA_URI_TAGS" in e ? l(
205
- P(Xe),
206
- // eslint-disable-line indent
207
- e.ADD_DATA_URI_TAGS,
208
- // eslint-disable-line indent
209
- p
210
- // eslint-disable-line indent
211
- ) : Xe, z = "FORBID_CONTENTS" in e ? l({}, e.FORBID_CONTENTS, p) : Ye, j = "FORBID_TAGS" in e ? l({}, e.FORBID_TAGS, p) : {}, he = "FORBID_ATTR" in e ? l({}, e.FORBID_ATTR, p) : {}, H = "USE_PROFILES" in e ? e.USE_PROFILES : !1, Be = e.ALLOW_ARIA_ATTR !== !1, _e = e.ALLOW_DATA_ATTR !== !1, We = e.ALLOW_UNKNOWN_PROTOCOLS || !1, F = e.SAFE_FOR_TEMPLATES || !1, x = e.WHOLE_DOCUMENT || !1, U = e.RETURN_DOM || !1, J = e.RETURN_DOM_FRAGMENT || !1, Q = e.RETURN_TRUSTED_TYPE || !1, Ee = e.FORCE_BODY || !1, $e = e.SANITIZE_DOM !== !1, je = e.SANITIZE_NAMED_PROPS || !1, ye = e.KEEP_CONTENT !== !1, Y = e.IN_PLACE || !1, Te = e.ALLOWED_URI_REGEXP || Te, G = e.NAMESPACE || M, e.CUSTOM_ELEMENT_HANDLING && Ke(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (c.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && Ke(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (c.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (c.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), F && (_e = !1), J && (U = !0), H && (m = l({}, S(ut)), v = [], H.html === !0 && (l(m, st), l(v, ft)), H.svg === !0 && (l(m, we), l(v, xe), l(v, ie)), H.svgFilters === !0 && (l(m, Ie), l(v, xe), l(v, ie)), H.mathMl === !0 && (l(m, Ce), l(v, ct), l(v, ie))), e.ADD_TAGS && (m === ze && (m = P(m)), l(m, e.ADD_TAGS, p)), e.ADD_ATTR && (v === Ge && (v = P(v)), l(v, e.ADD_ATTR, p)), e.ADD_URI_SAFE_ATTR && l(ge, e.ADD_URI_SAFE_ATTR, p), e.FORBID_CONTENTS && (z === Ye && (z = P(z)), l(z, e.FORBID_CONTENTS, p)), ye && (m["#text"] = !0), x && l(m, ["html", "head", "body"]), m.table && (l(m, ["tbody"]), delete j.tbody), A && A(e), B = e);
212
- }, Ze = l({}, ["mi", "mo", "mn", "ms", "mtext"]), Je = l({}, ["foreignobject", "desc", "title", "annotation-xml"]), It = l({}, ["title", "style", "font", "a", "script"]), re = l({}, we);
213
- l(re, Ie), l(re, Zt);
214
- var Oe = l({}, Ce);
215
- l(Oe, Jt);
216
- var Ct = function(e) {
217
- var t = ue(e);
218
- (!t || !t.tagName) && (t = {
219
- namespaceURI: G,
220
- tagName: "template"
221
- });
222
- var a = le(e.tagName), u = le(t.tagName);
223
- return Se[e.namespaceURI] ? e.namespaceURI === te ? t.namespaceURI === M ? a === "svg" : t.namespaceURI === ee ? a === "svg" && (u === "annotation-xml" || Ze[u]) : !!re[a] : e.namespaceURI === ee ? t.namespaceURI === M ? a === "math" : t.namespaceURI === te ? a === "math" && Je[u] : !!Oe[a] : e.namespaceURI === M ? t.namespaceURI === te && !Je[u] || t.namespaceURI === ee && !Ze[u] ? !1 : !Oe[a] && (It[a] || !re[a]) : !!(k === "application/xhtml+xml" && Se[e.namespaceURI]) : !1;
224
- }, w = function(e) {
225
- X(n.removed, {
226
- element: e
227
- });
228
- try {
229
- e.parentNode.removeChild(e);
230
- } catch {
231
- try {
232
- e.outerHTML = ce;
233
- } catch {
234
- e.remove();
235
- }
236
- }
237
- }, Ne = function(e, t) {
238
- try {
239
- X(n.removed, {
240
- attribute: t.getAttributeNode(e),
241
- from: t
242
- });
243
- } catch {
244
- X(n.removed, {
245
- attribute: null,
246
- from: t
247
- });
248
- }
249
- if (t.removeAttribute(e), e === "is" && !v[e])
250
- if (U || J)
251
- try {
252
- w(t);
253
- } catch {
254
- }
255
- else
256
- try {
257
- t.setAttribute(e, "");
258
- } catch {
259
- }
260
- }, Qe = function(e) {
261
- var t, a;
262
- if (Ee)
263
- e = "<remove></remove>" + e;
264
- else {
265
- var u = Vt(e, /^[\r\n\t ]+/);
266
- a = u && u[0];
267
- }
268
- k === "application/xhtml+xml" && G === M && (e = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + e + "</body></html>");
269
- var E = g ? g.createHTML(e) : e;
270
- if (G === M)
271
- try {
272
- t = new Tt().parseFromString(E, k);
273
- } catch {
274
- }
275
- if (!t || !t.documentElement) {
276
- t = me.createDocument(G, "template", null);
277
- try {
278
- t.documentElement.innerHTML = be ? ce : E;
279
- } catch {
280
- }
281
- }
282
- var h = t.body || t.documentElement;
283
- return e && a && h.insertBefore(s.createTextNode(a), h.childNodes[0] || null), G === M ? gt.call(t, x ? "html" : "body")[0] : x ? t.documentElement : h;
284
- }, et = function(e) {
285
- return Et.call(
286
- e.ownerDocument || e,
287
- e,
288
- // eslint-disable-next-line no-bitwise
289
- W.SHOW_ELEMENT | W.SHOW_COMMENT | W.SHOW_TEXT,
290
- null,
291
- !1
292
- );
293
- }, xt = function(e) {
294
- return e instanceof vt && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof dt) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
295
- }, V = function(e) {
296
- return C(L) === "object" ? e instanceof L : e && C(e) === "object" && typeof e.nodeType == "number" && typeof e.nodeName == "string";
297
- }, I = function(e, t, a) {
298
- D[e] && Yt(D[e], function(u) {
299
- u.call(n, t, a, B);
300
- });
301
- }, tt = function(e) {
302
- var t;
303
- if (I("beforeSanitizeElements", e, null), xt(e) || _(/[\u0080-\uFFFF]/, e.nodeName))
304
- return w(e), !0;
305
- var a = p(e.nodeName);
306
- if (I("uponSanitizeElement", e, {
307
- tagName: a,
308
- allowedTags: m
309
- }), e.hasChildNodes() && !V(e.firstElementChild) && (!V(e.content) || !V(e.content.firstElementChild)) && _(/<[/\w]/g, e.innerHTML) && _(/<[/\w]/g, e.textContent) || a === "select" && _(/<template/i, e.innerHTML))
310
- return w(e), !0;
311
- if (!m[a] || j[a]) {
312
- if (!j[a] && at(a) && (c.tagNameCheck instanceof RegExp && _(c.tagNameCheck, a) || c.tagNameCheck instanceof Function && c.tagNameCheck(a)))
313
- return !1;
314
- if (ye && !z[a]) {
315
- var u = ue(e) || e.parentNode, E = At(e) || e.childNodes;
316
- if (E && u)
317
- for (var h = E.length, T = h - 1; T >= 0; --T)
318
- u.insertBefore(ht(E[T], !0), _t(e));
319
- }
320
- return w(e), !0;
321
- }
322
- return e instanceof N && !Ct(e) || (a === "noscript" || a === "noembed") && _(/<\/no(script|embed)/i, e.innerHTML) ? (w(e), !0) : (F && e.nodeType === 3 && (t = e.textContent, t = b(t, pe, " "), t = b(t, de, " "), t = b(t, ve, " "), e.textContent !== t && (X(n.removed, {
323
- element: e.cloneNode()
324
- }), e.textContent = t)), I("afterSanitizeElements", e, null), !1);
325
- }, rt = function(e, t, a) {
326
- if ($e && (t === "id" || t === "name") && (a in s || a in wt))
327
- return !1;
328
- if (!(_e && !he[t] && _(St, t))) {
329
- if (!(Be && _(Rt, t))) {
330
- if (!v[t] || he[t]) {
331
- if (
332
- // First condition does a very basic check if a) it's basically a valid custom element tagname AND
333
- // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
334
- // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
335
- !(at(e) && (c.tagNameCheck instanceof RegExp && _(c.tagNameCheck, e) || c.tagNameCheck instanceof Function && c.tagNameCheck(e)) && (c.attributeNameCheck instanceof RegExp && _(c.attributeNameCheck, t) || c.attributeNameCheck instanceof Function && c.attributeNameCheck(t)) || // Alternative, second condition checks if it's an `is`-attribute, AND
336
- // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
337
- t === "is" && c.allowCustomizedBuiltInElements && (c.tagNameCheck instanceof RegExp && _(c.tagNameCheck, a) || c.tagNameCheck instanceof Function && c.tagNameCheck(a)))
338
- )
339
- return !1;
340
- } else if (!ge[t]) {
341
- if (!_(Te, b(a, He, ""))) {
342
- if (!((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && Xt(a, "data:") === 0 && Ve[e])) {
343
- if (!(We && !_(Ot, b(a, He, "")))) {
344
- if (a)
345
- return !1;
346
- }
347
- }
348
- }
349
- }
350
- }
351
- }
352
- return !0;
353
- }, at = function(e) {
354
- return e.indexOf("-") > 0;
355
- }, nt = function(e) {
356
- var t, a, u, E;
357
- I("beforeSanitizeAttributes", e, null);
358
- var h = e.attributes;
359
- if (h) {
360
- var T = {
361
- attrName: "",
362
- attrValue: "",
363
- keepAttr: !0,
364
- allowedAttributes: v
365
- };
366
- for (E = h.length; E--; ) {
367
- t = h[E];
368
- var ae = t, d = ae.name, De = ae.namespaceURI;
369
- if (a = d === "value" ? t.value : qt(t.value), u = p(d), T.attrName = u, T.attrValue = a, T.keepAttr = !0, T.forceKeepAttr = void 0, I("uponSanitizeAttribute", e, T), a = T.attrValue, !T.forceKeepAttr && (Ne(d, e), !!T.keepAttr)) {
370
- if (_(/\/>/i, a)) {
371
- Ne(d, e);
372
- continue;
373
- }
374
- F && (a = b(a, pe, " "), a = b(a, de, " "), a = b(a, ve, " "));
375
- var it = p(e.nodeName);
376
- if (rt(it, u, a)) {
377
- if (je && (u === "id" || u === "name") && (Ne(d, e), a = Nt + a), g && C(q) === "object" && typeof q.getAttributeType == "function" && !De)
378
- switch (q.getAttributeType(it, u)) {
379
- case "TrustedHTML":
380
- a = g.createHTML(a);
381
- break;
382
- case "TrustedScriptURL":
383
- a = g.createScriptURL(a);
384
- break;
385
- }
386
- try {
387
- De ? e.setAttributeNS(De, d, a) : e.setAttribute(d, a), lt(n.removed);
388
- } catch {
389
- }
390
- }
391
- }
392
- }
393
- I("afterSanitizeAttributes", e, null);
394
- }
395
- }, kt = function i(e) {
396
- var t, a = et(e);
397
- for (I("beforeSanitizeShadowDOM", e, null); t = a.nextNode(); )
398
- I("uponSanitizeShadowNode", t, null), !tt(t) && (t.content instanceof f && i(t.content), nt(t));
399
- I("afterSanitizeShadowDOM", e, null);
400
- };
401
- return n.sanitize = function(i) {
402
- var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t, a, u, E, h;
403
- if (be = !i, be && (i = "<!-->"), typeof i != "string" && !V(i)) {
404
- if (typeof i.toString != "function")
405
- throw Me("toString is not a function");
406
- if (i = i.toString(), typeof i != "string")
407
- throw Me("dirty is not a string, aborting");
408
- }
409
- if (!n.isSupported) {
410
- if (C(r.toStaticHTML) === "object" || typeof r.toStaticHTML == "function") {
411
- if (typeof i == "string")
412
- return r.toStaticHTML(i);
413
- if (V(i))
414
- return r.toStaticHTML(i.outerHTML);
415
- }
416
- return i;
417
- }
418
- if (Ae || Re(e), n.removed = [], typeof i == "string" && (Y = !1), Y) {
419
- if (i.nodeName) {
420
- var T = p(i.nodeName);
421
- if (!m[T] || j[T])
422
- throw Me("root node is forbidden and cannot be sanitized in-place");
423
- }
424
- } else if (i instanceof L)
425
- t = Qe("<!---->"), a = t.ownerDocument.importNode(i, !0), a.nodeType === 1 && a.nodeName === "BODY" || a.nodeName === "HTML" ? t = a : t.appendChild(a);
426
- else {
427
- if (!U && !F && !x && // eslint-disable-next-line unicorn/prefer-includes
428
- i.indexOf("<") === -1)
429
- return g && Q ? g.createHTML(i) : i;
430
- if (t = Qe(i), !t)
431
- return U ? null : Q ? ce : "";
432
- }
433
- t && Ee && w(t.firstChild);
434
- for (var ae = et(Y ? i : t); u = ae.nextNode(); )
435
- u.nodeType === 3 && u === E || tt(u) || (u.content instanceof f && kt(u.content), nt(u), E = u);
436
- if (E = null, Y)
437
- return i;
438
- if (U) {
439
- if (J)
440
- for (h = yt.call(t.ownerDocument); t.firstChild; )
441
- h.appendChild(t.firstChild);
442
- else
443
- h = t;
444
- return v.shadowroot && (h = bt.call(o, h, !0)), h;
445
- }
446
- var d = x ? t.outerHTML : t.innerHTML;
447
- return x && m["!doctype"] && t.ownerDocument && t.ownerDocument.doctype && t.ownerDocument.doctype.name && _(lr, t.ownerDocument.doctype.name) && (d = "<!DOCTYPE " + t.ownerDocument.doctype.name + `>
448
- ` + d), F && (d = b(d, pe, " "), d = b(d, de, " "), d = b(d, ve, " ")), g && Q ? g.createHTML(d) : d;
449
- }, n.setConfig = function(i) {
450
- Re(i), Ae = !0;
451
- }, n.clearConfig = function() {
452
- B = null, Ae = !1;
453
- }, n.isValidAttribute = function(i, e, t) {
454
- B || Re({});
455
- var a = p(i), u = p(e);
456
- return rt(a, u, t);
457
- }, n.addHook = function(i, e) {
458
- typeof e == "function" && (D[i] = D[i] || [], X(D[i], e));
459
- }, n.removeHook = function(i) {
460
- if (D[i])
461
- return lt(D[i]);
462
- }, n.removeHooks = function(i) {
463
- D[i] && (D[i] = []);
464
- }, n.removeAllHooks = function() {
465
- D = {};
466
- }, n;
467
- }
468
- var cr = pt();
469
- export {
470
- cr as default
471
- };