zerocodejs 1.0.1-beta.20 → 1.0.1-beta.21
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/dist/core/utils/dom-utils.d.ts.map +1 -1
- package/dist/zerocode-ssr.es.js +414 -409
- package/dist/zerocode.es.js +2899 -2894
- package/dist/zerocode.umd.js +43 -43
- package/package.json +1 -1
package/dist/zerocode-ssr.es.js
CHANGED
|
@@ -1,41 +1,46 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Mt = "[ZeroCode]", de = {
|
|
2
2
|
warn(r, ...t) {
|
|
3
|
-
console.warn(`${
|
|
3
|
+
console.warn(`${Mt} ${r}`, ...t);
|
|
4
4
|
},
|
|
5
5
|
error(r, ...t) {
|
|
6
|
-
console.error(`${
|
|
6
|
+
console.error(`${Mt} ${r}`, ...t);
|
|
7
7
|
}
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
}, at = 1, st = 3;
|
|
9
|
+
let Ge;
|
|
10
|
+
function or() {
|
|
11
|
+
if (Ge)
|
|
12
|
+
return Ge;
|
|
13
|
+
if (typeof require > "u")
|
|
14
|
+
throw new Error("DOMParser is not available in this environment");
|
|
15
|
+
try {
|
|
16
|
+
const { JSDOM: r } = require("jsdom");
|
|
17
|
+
return Ge = new r("").window.DOMParser, Ge;
|
|
18
|
+
} catch {
|
|
19
|
+
throw new Error(
|
|
20
|
+
"jsdom is required for server-side rendering. Please install it: npm install jsdom"
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function Vt() {
|
|
21
25
|
if (typeof DOMParser < "u")
|
|
22
26
|
return DOMParser;
|
|
23
|
-
|
|
27
|
+
const r = globalThis;
|
|
28
|
+
return r.window?.DOMParser ? r.window.DOMParser : or();
|
|
24
29
|
}
|
|
25
30
|
const {
|
|
26
|
-
entries:
|
|
27
|
-
setPrototypeOf:
|
|
28
|
-
isFrozen:
|
|
29
|
-
getPrototypeOf:
|
|
30
|
-
getOwnPropertyDescriptor:
|
|
31
|
+
entries: Xt,
|
|
32
|
+
setPrototypeOf: Pt,
|
|
33
|
+
isFrozen: ar,
|
|
34
|
+
getPrototypeOf: sr,
|
|
35
|
+
getOwnPropertyDescriptor: lr
|
|
31
36
|
} = Object;
|
|
32
37
|
let {
|
|
33
38
|
freeze: J,
|
|
34
39
|
seal: oe,
|
|
35
40
|
create: dt
|
|
36
41
|
} = Object, {
|
|
37
|
-
apply:
|
|
38
|
-
construct:
|
|
42
|
+
apply: gt,
|
|
43
|
+
construct: Tt
|
|
39
44
|
} = typeof Reflect < "u" && Reflect;
|
|
40
45
|
J || (J = function(t) {
|
|
41
46
|
return t;
|
|
@@ -43,92 +48,92 @@ J || (J = function(t) {
|
|
|
43
48
|
oe || (oe = function(t) {
|
|
44
49
|
return t;
|
|
45
50
|
});
|
|
46
|
-
|
|
47
|
-
for (var o = arguments.length,
|
|
48
|
-
|
|
49
|
-
return t.apply(i,
|
|
51
|
+
gt || (gt = function(t, i) {
|
|
52
|
+
for (var o = arguments.length, m = new Array(o > 2 ? o - 2 : 0), R = 2; R < o; R++)
|
|
53
|
+
m[R - 2] = arguments[R];
|
|
54
|
+
return t.apply(i, m);
|
|
50
55
|
});
|
|
51
|
-
|
|
52
|
-
for (var i = arguments.length, o = new Array(i > 1 ? i - 1 : 0),
|
|
53
|
-
o[
|
|
56
|
+
Tt || (Tt = function(t) {
|
|
57
|
+
for (var i = arguments.length, o = new Array(i > 1 ? i - 1 : 0), m = 1; m < i; m++)
|
|
58
|
+
o[m - 1] = arguments[m];
|
|
54
59
|
return new t(...o);
|
|
55
60
|
});
|
|
56
|
-
const
|
|
61
|
+
const We = Q(Array.prototype.forEach), cr = Q(Array.prototype.lastIndexOf), Ft = Q(Array.prototype.pop), Oe = Q(Array.prototype.push), ur = Q(Array.prototype.splice), Xe = Q(String.prototype.toLowerCase), lt = Q(String.prototype.toString), ct = Q(String.prototype.match), xe = Q(String.prototype.replace), fr = Q(String.prototype.indexOf), pr = Q(String.prototype.trim), ae = Q(Object.prototype.hasOwnProperty), K = Q(RegExp.prototype.test), Ne = mr(TypeError);
|
|
57
62
|
function Q(r) {
|
|
58
63
|
return function(t) {
|
|
59
64
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
60
|
-
for (var i = arguments.length, o = new Array(i > 1 ? i - 1 : 0),
|
|
61
|
-
o[
|
|
62
|
-
return
|
|
65
|
+
for (var i = arguments.length, o = new Array(i > 1 ? i - 1 : 0), m = 1; m < i; m++)
|
|
66
|
+
o[m - 1] = arguments[m];
|
|
67
|
+
return gt(r, t, o);
|
|
63
68
|
};
|
|
64
69
|
}
|
|
65
|
-
function
|
|
70
|
+
function mr(r) {
|
|
66
71
|
return function() {
|
|
67
72
|
for (var t = arguments.length, i = new Array(t), o = 0; o < t; o++)
|
|
68
73
|
i[o] = arguments[o];
|
|
69
|
-
return
|
|
74
|
+
return Tt(r, i);
|
|
70
75
|
};
|
|
71
76
|
}
|
|
72
|
-
function
|
|
73
|
-
let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] :
|
|
74
|
-
|
|
77
|
+
function L(r, t) {
|
|
78
|
+
let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Xe;
|
|
79
|
+
Pt && Pt(r, null);
|
|
75
80
|
let o = t.length;
|
|
76
81
|
for (; o--; ) {
|
|
77
|
-
let
|
|
78
|
-
if (typeof
|
|
79
|
-
const R = i(
|
|
80
|
-
R !==
|
|
82
|
+
let m = t[o];
|
|
83
|
+
if (typeof m == "string") {
|
|
84
|
+
const R = i(m);
|
|
85
|
+
R !== m && (ar(t) || (t[o] = R), m = R);
|
|
81
86
|
}
|
|
82
|
-
r[
|
|
87
|
+
r[m] = !0;
|
|
83
88
|
}
|
|
84
89
|
return r;
|
|
85
90
|
}
|
|
86
|
-
function
|
|
91
|
+
function dr(r) {
|
|
87
92
|
for (let t = 0; t < r.length; t++)
|
|
88
93
|
ae(r, t) || (r[t] = null);
|
|
89
94
|
return r;
|
|
90
95
|
}
|
|
91
96
|
function ce(r) {
|
|
92
97
|
const t = dt(null);
|
|
93
|
-
for (const [i, o] of
|
|
94
|
-
ae(r, i) && (Array.isArray(o) ? t[i] =
|
|
98
|
+
for (const [i, o] of Xt(r))
|
|
99
|
+
ae(r, i) && (Array.isArray(o) ? t[i] = dr(o) : o && typeof o == "object" && o.constructor === Object ? t[i] = ce(o) : t[i] = o);
|
|
95
100
|
return t;
|
|
96
101
|
}
|
|
97
102
|
function Ce(r, t) {
|
|
98
103
|
for (; r !== null; ) {
|
|
99
|
-
const o =
|
|
104
|
+
const o = lr(r, t);
|
|
100
105
|
if (o) {
|
|
101
106
|
if (o.get)
|
|
102
107
|
return Q(o.get);
|
|
103
108
|
if (typeof o.value == "function")
|
|
104
109
|
return Q(o.value);
|
|
105
110
|
}
|
|
106
|
-
r =
|
|
111
|
+
r = sr(r);
|
|
107
112
|
}
|
|
108
113
|
function i() {
|
|
109
114
|
return null;
|
|
110
115
|
}
|
|
111
116
|
return i;
|
|
112
117
|
}
|
|
113
|
-
const
|
|
118
|
+
const Ut = J(["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", "search", "section", "select", "shadow", "slot", "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"]), ut = J(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), ft = J(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), gr = J(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), pt = J(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), Tr = J(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Ht = J(["#text"]), zt = J(["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", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "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", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), mt = J(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), kt = J(["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"]), Be = J(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), hr = oe(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Er = oe(/<%[\w\W]*|[\w\W]*%>/gm), _r = oe(/\$\{[\w\W]*/gm), Ar = oe(/^data-[\-\w.\u00B7-\uFFFF]+$/), yr = oe(/^aria-[\-\w]+$/), jt = oe(
|
|
114
119
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
115
120
|
// eslint-disable-line no-useless-escape
|
|
116
|
-
),
|
|
121
|
+
), Sr = oe(/^(?:\w+script|data):/i), Rr = oe(
|
|
117
122
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
118
123
|
// eslint-disable-line no-control-regex
|
|
119
|
-
),
|
|
120
|
-
var
|
|
124
|
+
), Yt = oe(/^html$/i), Ir = oe(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
125
|
+
var $t = /* @__PURE__ */ Object.freeze({
|
|
121
126
|
__proto__: null,
|
|
122
|
-
ARIA_ATTR:
|
|
123
|
-
ATTR_WHITESPACE:
|
|
124
|
-
CUSTOM_ELEMENT:
|
|
125
|
-
DATA_ATTR:
|
|
126
|
-
DOCTYPE_NAME:
|
|
127
|
-
ERB_EXPR:
|
|
128
|
-
IS_ALLOWED_URI:
|
|
129
|
-
IS_SCRIPT_OR_DATA:
|
|
130
|
-
MUSTACHE_EXPR:
|
|
131
|
-
TMPLIT_EXPR:
|
|
127
|
+
ARIA_ATTR: yr,
|
|
128
|
+
ATTR_WHITESPACE: Rr,
|
|
129
|
+
CUSTOM_ELEMENT: Ir,
|
|
130
|
+
DATA_ATTR: Ar,
|
|
131
|
+
DOCTYPE_NAME: Yt,
|
|
132
|
+
ERB_EXPR: Er,
|
|
133
|
+
IS_ALLOWED_URI: jt,
|
|
134
|
+
IS_SCRIPT_OR_DATA: Sr,
|
|
135
|
+
MUSTACHE_EXPR: hr,
|
|
136
|
+
TMPLIT_EXPR: _r
|
|
132
137
|
});
|
|
133
138
|
const ve = {
|
|
134
139
|
element: 1,
|
|
@@ -137,14 +142,14 @@ const ve = {
|
|
|
137
142
|
progressingInstruction: 7,
|
|
138
143
|
comment: 8,
|
|
139
144
|
document: 9
|
|
140
|
-
},
|
|
145
|
+
}, wr = function() {
|
|
141
146
|
return typeof window > "u" ? null : window;
|
|
142
|
-
},
|
|
147
|
+
}, Dr = function(t, i) {
|
|
143
148
|
if (typeof t != "object" || typeof t.createPolicy != "function")
|
|
144
149
|
return null;
|
|
145
150
|
let o = null;
|
|
146
|
-
const
|
|
147
|
-
i && i.hasAttribute(
|
|
151
|
+
const m = "data-tt-policy-suffix";
|
|
152
|
+
i && i.hasAttribute(m) && (o = i.getAttribute(m));
|
|
148
153
|
const R = "dompurify" + (o ? "#" + o : "");
|
|
149
154
|
try {
|
|
150
155
|
return t.createPolicy(R, {
|
|
@@ -158,7 +163,7 @@ const ve = {
|
|
|
158
163
|
} catch {
|
|
159
164
|
return console.warn("TrustedTypes policy " + R + " could not be created."), null;
|
|
160
165
|
}
|
|
161
|
-
},
|
|
166
|
+
}, Gt = function() {
|
|
162
167
|
return {
|
|
163
168
|
afterSanitizeAttributes: [],
|
|
164
169
|
afterSanitizeElements: [],
|
|
@@ -171,25 +176,25 @@ const ve = {
|
|
|
171
176
|
uponSanitizeShadowNode: []
|
|
172
177
|
};
|
|
173
178
|
};
|
|
174
|
-
function
|
|
175
|
-
let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
176
|
-
const t = (A) =>
|
|
179
|
+
function qt() {
|
|
180
|
+
let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : wr();
|
|
181
|
+
const t = (A) => qt(A);
|
|
177
182
|
if (t.version = "3.3.1", t.removed = [], !r || !r.document || r.document.nodeType !== ve.document || !r.Element)
|
|
178
183
|
return t.isSupported = !1, t;
|
|
179
184
|
let {
|
|
180
185
|
document: i
|
|
181
186
|
} = r;
|
|
182
|
-
const o = i,
|
|
187
|
+
const o = i, m = o.currentScript, {
|
|
183
188
|
DocumentFragment: R,
|
|
184
189
|
HTMLTemplateElement: I,
|
|
185
190
|
Node: C,
|
|
186
191
|
Element: k,
|
|
187
|
-
NodeFilter:
|
|
192
|
+
NodeFilter: P,
|
|
188
193
|
NamedNodeMap: re = r.NamedNodeMap || r.MozNamedAttrMap,
|
|
189
194
|
HTMLFormElement: ne,
|
|
190
195
|
DOMParser: ie,
|
|
191
|
-
trustedTypes:
|
|
192
|
-
} = r, W = k.prototype, he = Ce(W, "cloneNode"), Me = Ce(W, "remove"),
|
|
196
|
+
trustedTypes: v
|
|
197
|
+
} = r, W = k.prototype, he = Ce(W, "cloneNode"), Me = Ce(W, "remove"), Ye = Ce(W, "nextSibling"), qe = Ce(W, "childNodes"), Ee = Ce(W, "parentNode");
|
|
193
198
|
if (typeof I == "function") {
|
|
194
199
|
const A = i.createElement("template");
|
|
195
200
|
A.content && A.content.ownerDocument && (i = A.content.ownerDocument);
|
|
@@ -199,12 +204,12 @@ function Yt() {
|
|
|
199
204
|
implementation: l,
|
|
200
205
|
createNodeIterator: x,
|
|
201
206
|
createDocumentFragment: h,
|
|
202
|
-
getElementsByTagName:
|
|
207
|
+
getElementsByTagName: w
|
|
203
208
|
} = i, {
|
|
204
|
-
importNode:
|
|
209
|
+
importNode: d
|
|
205
210
|
} = o;
|
|
206
|
-
let n =
|
|
207
|
-
t.isSupported = typeof
|
|
211
|
+
let n = Gt();
|
|
212
|
+
t.isSupported = typeof Xt == "function" && typeof Ee == "function" && l && l.createHTMLDocument !== void 0;
|
|
208
213
|
const {
|
|
209
214
|
MUSTACHE_EXPR: S,
|
|
210
215
|
ERB_EXPR: f,
|
|
@@ -212,15 +217,15 @@ function Yt() {
|
|
|
212
217
|
DATA_ATTR: u,
|
|
213
218
|
ARIA_ATTR: p,
|
|
214
219
|
IS_SCRIPT_OR_DATA: g,
|
|
215
|
-
ATTR_WHITESPACE:
|
|
220
|
+
ATTR_WHITESPACE: D,
|
|
216
221
|
CUSTOM_ELEMENT: y
|
|
217
|
-
} =
|
|
222
|
+
} = $t;
|
|
218
223
|
let {
|
|
219
|
-
IS_ALLOWED_URI:
|
|
220
|
-
} =
|
|
221
|
-
const O =
|
|
224
|
+
IS_ALLOWED_URI: b
|
|
225
|
+
} = $t, E = null;
|
|
226
|
+
const O = L({}, [...Ut, ...ut, ...ft, ...pt, ...Ht]);
|
|
222
227
|
let _ = null;
|
|
223
|
-
const F =
|
|
228
|
+
const F = L({}, [...zt, ...mt, ...kt, ...Be]);
|
|
224
229
|
let N = Object.seal(dt(null, {
|
|
225
230
|
tagNameCheck: {
|
|
226
231
|
writable: !0,
|
|
@@ -255,45 +260,45 @@ function Yt() {
|
|
|
255
260
|
value: null
|
|
256
261
|
}
|
|
257
262
|
}));
|
|
258
|
-
let q = !0,
|
|
259
|
-
const
|
|
260
|
-
let
|
|
261
|
-
const
|
|
262
|
-
let
|
|
263
|
-
const
|
|
264
|
-
let
|
|
265
|
-
const
|
|
266
|
-
let Se = ue,
|
|
267
|
-
const
|
|
268
|
-
let ke =
|
|
269
|
-
const
|
|
270
|
-
let
|
|
271
|
-
const
|
|
263
|
+
let q = !0, me = !0, we = !1, De = !0, _e = !1, Pe = !0, ge = !1, Ke = !1, Ze = !1, Ae = !1, Fe = !1, Ue = !1, ht = !0, Et = !1;
|
|
264
|
+
const Zt = "user-content-";
|
|
265
|
+
let Je = !0, Le = !1, ye = {}, se = null;
|
|
266
|
+
const Qe = 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"]);
|
|
267
|
+
let _t = null;
|
|
268
|
+
const At = L({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
269
|
+
let et = null;
|
|
270
|
+
const yt = L({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), He = "http://www.w3.org/1998/Math/MathML", ze = "http://www.w3.org/2000/svg", ue = "http://www.w3.org/1999/xhtml";
|
|
271
|
+
let Se = ue, tt = !1, rt = null;
|
|
272
|
+
const Jt = L({}, [He, ze, ue], lt);
|
|
273
|
+
let ke = L({}, ["mi", "mo", "mn", "ms", "mtext"]), $e = L({}, ["annotation-xml"]);
|
|
274
|
+
const Qt = L({}, ["title", "style", "font", "a", "script"]);
|
|
275
|
+
let be = null;
|
|
276
|
+
const er = ["application/xhtml+xml", "text/html"], tr = "text/html";
|
|
272
277
|
let $ = null, Re = null;
|
|
273
|
-
const
|
|
278
|
+
const rr = i.createElement("form"), St = function(e) {
|
|
274
279
|
return e instanceof RegExp || e instanceof Function;
|
|
275
|
-
},
|
|
280
|
+
}, nt = function() {
|
|
276
281
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
277
282
|
if (!(Re && Re === e)) {
|
|
278
|
-
if ((!e || typeof e != "object") && (e = {}), e = ce(e),
|
|
279
|
-
|
|
283
|
+
if ((!e || typeof e != "object") && (e = {}), e = ce(e), be = // eslint-disable-next-line unicorn/prefer-includes
|
|
284
|
+
er.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? tr : e.PARSER_MEDIA_TYPE, $ = be === "application/xhtml+xml" ? lt : Xe, E = ae(e, "ALLOWED_TAGS") ? L({}, e.ALLOWED_TAGS, $) : O, _ = ae(e, "ALLOWED_ATTR") ? L({}, e.ALLOWED_ATTR, $) : F, rt = ae(e, "ALLOWED_NAMESPACES") ? L({}, e.ALLOWED_NAMESPACES, lt) : Jt, et = ae(e, "ADD_URI_SAFE_ATTR") ? L(ce(yt), e.ADD_URI_SAFE_ATTR, $) : yt, _t = ae(e, "ADD_DATA_URI_TAGS") ? L(ce(At), e.ADD_DATA_URI_TAGS, $) : At, se = ae(e, "FORBID_CONTENTS") ? L({}, e.FORBID_CONTENTS, $) : Qe, V = ae(e, "FORBID_TAGS") ? L({}, e.FORBID_TAGS, $) : ce({}), Y = ae(e, "FORBID_ATTR") ? L({}, e.FORBID_ATTR, $) : ce({}), ye = ae(e, "USE_PROFILES") ? e.USE_PROFILES : !1, q = e.ALLOW_ARIA_ATTR !== !1, me = e.ALLOW_DATA_ATTR !== !1, we = e.ALLOW_UNKNOWN_PROTOCOLS || !1, De = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, _e = e.SAFE_FOR_TEMPLATES || !1, Pe = e.SAFE_FOR_XML !== !1, ge = e.WHOLE_DOCUMENT || !1, Ae = e.RETURN_DOM || !1, Fe = e.RETURN_DOM_FRAGMENT || !1, Ue = e.RETURN_TRUSTED_TYPE || !1, Ze = e.FORCE_BODY || !1, ht = e.SANITIZE_DOM !== !1, Et = e.SANITIZE_NAMED_PROPS || !1, Je = e.KEEP_CONTENT !== !1, Le = e.IN_PLACE || !1, b = e.ALLOWED_URI_REGEXP || jt, Se = e.NAMESPACE || ue, ke = e.MATHML_TEXT_INTEGRATION_POINTS || ke, $e = e.HTML_INTEGRATION_POINTS || $e, N = e.CUSTOM_ELEMENT_HANDLING || {}, e.CUSTOM_ELEMENT_HANDLING && St(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (N.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && St(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (N.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (N.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), _e && (me = !1), Fe && (Ae = !0), ye && (E = L({}, Ht), _ = [], ye.html === !0 && (L(E, Ut), L(_, zt)), ye.svg === !0 && (L(E, ut), L(_, mt), L(_, Be)), ye.svgFilters === !0 && (L(E, ft), L(_, mt), L(_, Be)), ye.mathMl === !0 && (L(E, pt), L(_, kt), L(_, Be))), e.ADD_TAGS && (typeof e.ADD_TAGS == "function" ? H.tagCheck = e.ADD_TAGS : (E === O && (E = ce(E)), L(E, e.ADD_TAGS, $))), e.ADD_ATTR && (typeof e.ADD_ATTR == "function" ? H.attributeCheck = e.ADD_ATTR : (_ === F && (_ = ce(_)), L(_, e.ADD_ATTR, $))), e.ADD_URI_SAFE_ATTR && L(et, e.ADD_URI_SAFE_ATTR, $), e.FORBID_CONTENTS && (se === Qe && (se = ce(se)), L(se, e.FORBID_CONTENTS, $)), e.ADD_FORBID_CONTENTS && (se === Qe && (se = ce(se)), L(se, e.ADD_FORBID_CONTENTS, $)), Je && (E["#text"] = !0), ge && L(E, ["html", "head", "body"]), E.table && (L(E, ["tbody"]), delete V.tbody), e.TRUSTED_TYPES_POLICY) {
|
|
280
285
|
if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
281
286
|
throw Ne('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
282
287
|
if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
283
288
|
throw Ne('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
284
289
|
B = e.TRUSTED_TYPES_POLICY, c = B.createHTML("");
|
|
285
290
|
} else
|
|
286
|
-
B === void 0 && (B =
|
|
291
|
+
B === void 0 && (B = Dr(v, m)), B !== null && typeof c == "string" && (c = B.createHTML(""));
|
|
287
292
|
J && J(e), Re = e;
|
|
288
293
|
}
|
|
289
|
-
},
|
|
294
|
+
}, Rt = L({}, [...ut, ...ft, ...gr]), It = L({}, [...pt, ...Tr]), nr = function(e) {
|
|
290
295
|
let a = Ee(e);
|
|
291
296
|
(!a || !a.tagName) && (a = {
|
|
292
297
|
namespaceURI: Se,
|
|
293
298
|
tagName: "template"
|
|
294
299
|
});
|
|
295
|
-
const T =
|
|
296
|
-
return
|
|
300
|
+
const T = Xe(e.tagName), U = Xe(a.tagName);
|
|
301
|
+
return rt[e.namespaceURI] ? e.namespaceURI === ze ? a.namespaceURI === ue ? T === "svg" : a.namespaceURI === He ? T === "svg" && (U === "annotation-xml" || ke[U]) : !!Rt[T] : e.namespaceURI === He ? a.namespaceURI === ue ? T === "math" : a.namespaceURI === ze ? T === "math" && $e[U] : !!It[T] : e.namespaceURI === ue ? a.namespaceURI === ze && !$e[U] || a.namespaceURI === He && !ke[U] ? !1 : !It[T] && (Qt[T] || !Rt[T]) : !!(be === "application/xhtml+xml" && rt[e.namespaceURI]) : !1;
|
|
297
302
|
}, le = function(e) {
|
|
298
303
|
Oe(t.removed, {
|
|
299
304
|
element: e
|
|
@@ -326,82 +331,82 @@ function Yt() {
|
|
|
326
331
|
a.setAttribute(e, "");
|
|
327
332
|
} catch {
|
|
328
333
|
}
|
|
329
|
-
},
|
|
334
|
+
}, wt = function(e) {
|
|
330
335
|
let a = null, T = null;
|
|
331
|
-
if (
|
|
336
|
+
if (Ze)
|
|
332
337
|
e = "<remove></remove>" + e;
|
|
333
338
|
else {
|
|
334
|
-
const z =
|
|
339
|
+
const z = ct(e, /^[\r\n\t ]+/);
|
|
335
340
|
T = z && z[0];
|
|
336
341
|
}
|
|
337
|
-
|
|
342
|
+
be === "application/xhtml+xml" && Se === ue && (e = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + e + "</body></html>");
|
|
338
343
|
const U = B ? B.createHTML(e) : e;
|
|
339
344
|
if (Se === ue)
|
|
340
345
|
try {
|
|
341
|
-
a = new ie().parseFromString(U,
|
|
346
|
+
a = new ie().parseFromString(U, be);
|
|
342
347
|
} catch {
|
|
343
348
|
}
|
|
344
349
|
if (!a || !a.documentElement) {
|
|
345
350
|
a = l.createDocument(Se, "template", null);
|
|
346
351
|
try {
|
|
347
|
-
a.documentElement.innerHTML =
|
|
352
|
+
a.documentElement.innerHTML = tt ? c : U;
|
|
348
353
|
} catch {
|
|
349
354
|
}
|
|
350
355
|
}
|
|
351
356
|
const j = a.body || a.documentElement;
|
|
352
|
-
return e && T && j.insertBefore(i.createTextNode(T), j.childNodes[0] || null), Se === ue ?
|
|
353
|
-
},
|
|
357
|
+
return e && T && j.insertBefore(i.createTextNode(T), j.childNodes[0] || null), Se === ue ? w.call(a, ge ? "html" : "body")[0] : ge ? a.documentElement : j;
|
|
358
|
+
}, Dt = function(e) {
|
|
354
359
|
return x.call(
|
|
355
360
|
e.ownerDocument || e,
|
|
356
361
|
e,
|
|
357
362
|
// eslint-disable-next-line no-bitwise
|
|
358
|
-
|
|
363
|
+
P.SHOW_ELEMENT | P.SHOW_COMMENT | P.SHOW_TEXT | P.SHOW_PROCESSING_INSTRUCTION | P.SHOW_CDATA_SECTION,
|
|
359
364
|
null
|
|
360
365
|
);
|
|
361
|
-
},
|
|
366
|
+
}, it = function(e) {
|
|
362
367
|
return e instanceof ne && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof re) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
|
|
363
|
-
},
|
|
368
|
+
}, Lt = function(e) {
|
|
364
369
|
return typeof C == "function" && e instanceof C;
|
|
365
370
|
};
|
|
366
371
|
function fe(A, e, a) {
|
|
367
|
-
|
|
372
|
+
We(A, (T) => {
|
|
368
373
|
T.call(t, e, a, Re);
|
|
369
374
|
});
|
|
370
375
|
}
|
|
371
|
-
const
|
|
376
|
+
const bt = function(e) {
|
|
372
377
|
let a = null;
|
|
373
|
-
if (fe(n.beforeSanitizeElements, e, null),
|
|
378
|
+
if (fe(n.beforeSanitizeElements, e, null), it(e))
|
|
374
379
|
return le(e), !0;
|
|
375
380
|
const T = $(e.nodeName);
|
|
376
381
|
if (fe(n.uponSanitizeElement, e, {
|
|
377
382
|
tagName: T,
|
|
378
383
|
allowedTags: E
|
|
379
|
-
}), Pe && e.hasChildNodes() && !
|
|
384
|
+
}), Pe && e.hasChildNodes() && !Lt(e.firstElementChild) && K(/<[/\w!]/g, e.innerHTML) && K(/<[/\w!]/g, e.textContent) || e.nodeType === ve.progressingInstruction || Pe && e.nodeType === ve.comment && K(/<[/\w]/g, e.data))
|
|
380
385
|
return le(e), !0;
|
|
381
386
|
if (!(H.tagCheck instanceof Function && H.tagCheck(T)) && (!E[T] || V[T])) {
|
|
382
|
-
if (!V[T] &&
|
|
387
|
+
if (!V[T] && xt(T) && (N.tagNameCheck instanceof RegExp && K(N.tagNameCheck, T) || N.tagNameCheck instanceof Function && N.tagNameCheck(T)))
|
|
383
388
|
return !1;
|
|
384
|
-
if (
|
|
385
|
-
const U = Ee(e) || e.parentNode, j =
|
|
389
|
+
if (Je && !se[T]) {
|
|
390
|
+
const U = Ee(e) || e.parentNode, j = qe(e) || e.childNodes;
|
|
386
391
|
if (j && U) {
|
|
387
392
|
const z = j.length;
|
|
388
393
|
for (let ee = z - 1; ee >= 0; --ee) {
|
|
389
394
|
const pe = he(j[ee], !0);
|
|
390
|
-
pe.__removalCount = (e.__removalCount || 0) + 1, U.insertBefore(pe,
|
|
395
|
+
pe.__removalCount = (e.__removalCount || 0) + 1, U.insertBefore(pe, Ye(e));
|
|
391
396
|
}
|
|
392
397
|
}
|
|
393
398
|
}
|
|
394
399
|
return le(e), !0;
|
|
395
400
|
}
|
|
396
|
-
return e instanceof k && !
|
|
401
|
+
return e instanceof k && !nr(e) || (T === "noscript" || T === "noembed" || T === "noframes") && K(/<\/no(script|embed|frames)/i, e.innerHTML) ? (le(e), !0) : (_e && e.nodeType === ve.text && (a = e.textContent, We([S, f, s], (U) => {
|
|
397
402
|
a = xe(a, U, " ");
|
|
398
403
|
}), e.textContent !== a && (Oe(t.removed, {
|
|
399
404
|
element: e.cloneNode()
|
|
400
405
|
}), e.textContent = a)), fe(n.afterSanitizeElements, e, null), !1);
|
|
401
|
-
},
|
|
402
|
-
if (
|
|
406
|
+
}, Ot = function(e, a, T) {
|
|
407
|
+
if (ht && (a === "id" || a === "name") && (T in i || T in rr))
|
|
403
408
|
return !1;
|
|
404
|
-
if (!(
|
|
409
|
+
if (!(me && !Y[a] && K(u, a))) {
|
|
405
410
|
if (!(q && K(p, a))) {
|
|
406
411
|
if (!(H.attributeCheck instanceof Function && H.attributeCheck(a, e))) {
|
|
407
412
|
if (!_[a] || Y[a]) {
|
|
@@ -409,14 +414,14 @@ function Yt() {
|
|
|
409
414
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
410
415
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
411
416
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
412
|
-
!(
|
|
417
|
+
!(xt(e) && (N.tagNameCheck instanceof RegExp && K(N.tagNameCheck, e) || N.tagNameCheck instanceof Function && N.tagNameCheck(e)) && (N.attributeNameCheck instanceof RegExp && K(N.attributeNameCheck, a) || N.attributeNameCheck instanceof Function && N.attributeNameCheck(a, e)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
413
418
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
414
419
|
a === "is" && N.allowCustomizedBuiltInElements && (N.tagNameCheck instanceof RegExp && K(N.tagNameCheck, T) || N.tagNameCheck instanceof Function && N.tagNameCheck(T)))
|
|
415
420
|
) return !1;
|
|
416
|
-
} else if (!
|
|
417
|
-
if (!K(
|
|
418
|
-
if (!((a === "src" || a === "xlink:href" || a === "href") && e !== "script" &&
|
|
419
|
-
if (!(
|
|
421
|
+
} else if (!et[a]) {
|
|
422
|
+
if (!K(b, xe(T, D, ""))) {
|
|
423
|
+
if (!((a === "src" || a === "xlink:href" || a === "href") && e !== "script" && fr(T, "data:") === 0 && _t[e])) {
|
|
424
|
+
if (!(we && !K(g, xe(T, D, "")))) {
|
|
420
425
|
if (T)
|
|
421
426
|
return !1;
|
|
422
427
|
}
|
|
@@ -427,14 +432,14 @@ function Yt() {
|
|
|
427
432
|
}
|
|
428
433
|
}
|
|
429
434
|
return !0;
|
|
430
|
-
}, Ot = function(e) {
|
|
431
|
-
return e !== "annotation-xml" && lt(e, y);
|
|
432
435
|
}, xt = function(e) {
|
|
436
|
+
return e !== "annotation-xml" && ct(e, y);
|
|
437
|
+
}, Nt = function(e) {
|
|
433
438
|
fe(n.beforeSanitizeAttributes, e, null);
|
|
434
439
|
const {
|
|
435
440
|
attributes: a
|
|
436
441
|
} = e;
|
|
437
|
-
if (!a ||
|
|
442
|
+
if (!a || it(e))
|
|
438
443
|
return;
|
|
439
444
|
const T = {
|
|
440
445
|
attrName: "",
|
|
@@ -449,13 +454,13 @@ function Yt() {
|
|
|
449
454
|
name: z,
|
|
450
455
|
namespaceURI: ee,
|
|
451
456
|
value: pe
|
|
452
|
-
} = j, Ie = $(z),
|
|
453
|
-
let X = z === "value" ?
|
|
454
|
-
if (T.attrName = Ie, T.attrValue = X, T.keepAttr = !0, T.forceKeepAttr = void 0, fe(n.uponSanitizeAttribute, e, T), X = T.attrValue,
|
|
457
|
+
} = j, Ie = $(z), ot = pe;
|
|
458
|
+
let X = z === "value" ? ot : pr(ot);
|
|
459
|
+
if (T.attrName = Ie, T.attrValue = X, T.keepAttr = !0, T.forceKeepAttr = void 0, fe(n.uponSanitizeAttribute, e, T), X = T.attrValue, Et && (Ie === "id" || Ie === "name") && (Te(z, e), X = Zt + X), Pe && K(/((--!?|])>)|<\/(style|title|textarea)/i, X)) {
|
|
455
460
|
Te(z, e);
|
|
456
461
|
continue;
|
|
457
462
|
}
|
|
458
|
-
if (Ie === "attributename" &&
|
|
463
|
+
if (Ie === "attributename" && ct(X, "href")) {
|
|
459
464
|
Te(z, e);
|
|
460
465
|
continue;
|
|
461
466
|
}
|
|
@@ -465,20 +470,20 @@ function Yt() {
|
|
|
465
470
|
Te(z, e);
|
|
466
471
|
continue;
|
|
467
472
|
}
|
|
468
|
-
if (!
|
|
473
|
+
if (!De && K(/\/>/i, X)) {
|
|
469
474
|
Te(z, e);
|
|
470
475
|
continue;
|
|
471
476
|
}
|
|
472
|
-
_e &&
|
|
473
|
-
X = xe(X,
|
|
477
|
+
_e && We([S, f, s], (vt) => {
|
|
478
|
+
X = xe(X, vt, " ");
|
|
474
479
|
});
|
|
475
|
-
const
|
|
476
|
-
if (!
|
|
480
|
+
const Ct = $(e.nodeName);
|
|
481
|
+
if (!Ot(Ct, Ie, X)) {
|
|
477
482
|
Te(z, e);
|
|
478
483
|
continue;
|
|
479
484
|
}
|
|
480
|
-
if (B && typeof
|
|
481
|
-
switch (
|
|
485
|
+
if (B && typeof v == "object" && typeof v.getAttributeType == "function" && !ee)
|
|
486
|
+
switch (v.getAttributeType(Ct, Ie)) {
|
|
482
487
|
case "TrustedHTML": {
|
|
483
488
|
X = B.createHTML(X);
|
|
484
489
|
break;
|
|
@@ -488,24 +493,24 @@ function Yt() {
|
|
|
488
493
|
break;
|
|
489
494
|
}
|
|
490
495
|
}
|
|
491
|
-
if (X !==
|
|
496
|
+
if (X !== ot)
|
|
492
497
|
try {
|
|
493
|
-
ee ? e.setAttributeNS(ee, z, X) : e.setAttribute(z, X),
|
|
498
|
+
ee ? e.setAttributeNS(ee, z, X) : e.setAttribute(z, X), it(e) ? le(e) : Ft(t.removed);
|
|
494
499
|
} catch {
|
|
495
500
|
Te(z, e);
|
|
496
501
|
}
|
|
497
502
|
}
|
|
498
503
|
fe(n.afterSanitizeAttributes, e, null);
|
|
499
|
-
},
|
|
504
|
+
}, ir = function A(e) {
|
|
500
505
|
let a = null;
|
|
501
|
-
const T =
|
|
506
|
+
const T = Dt(e);
|
|
502
507
|
for (fe(n.beforeSanitizeShadowDOM, e, null); a = T.nextNode(); )
|
|
503
|
-
fe(n.uponSanitizeShadowNode, a, null),
|
|
508
|
+
fe(n.uponSanitizeShadowNode, a, null), bt(a), Nt(a), a.content instanceof R && A(a.content);
|
|
504
509
|
fe(n.afterSanitizeShadowDOM, e, null);
|
|
505
510
|
};
|
|
506
511
|
return t.sanitize = function(A) {
|
|
507
512
|
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = null, T = null, U = null, j = null;
|
|
508
|
-
if (
|
|
513
|
+
if (tt = !A, tt && (A = "<!-->"), typeof A != "string" && !Lt(A))
|
|
509
514
|
if (typeof A.toString == "function") {
|
|
510
515
|
if (A = A.toString(), typeof A != "string")
|
|
511
516
|
throw Ne("dirty is not a string, aborting");
|
|
@@ -513,26 +518,26 @@ function Yt() {
|
|
|
513
518
|
throw Ne("toString is not a function");
|
|
514
519
|
if (!t.isSupported)
|
|
515
520
|
return A;
|
|
516
|
-
if (
|
|
521
|
+
if (Ke || nt(e), t.removed = [], typeof A == "string" && (Le = !1), Le) {
|
|
517
522
|
if (A.nodeName) {
|
|
518
523
|
const pe = $(A.nodeName);
|
|
519
524
|
if (!E[pe] || V[pe])
|
|
520
525
|
throw Ne("root node is forbidden and cannot be sanitized in-place");
|
|
521
526
|
}
|
|
522
527
|
} else if (A instanceof C)
|
|
523
|
-
a =
|
|
528
|
+
a = wt("<!---->"), T = a.ownerDocument.importNode(A, !0), T.nodeType === ve.element && T.nodeName === "BODY" || T.nodeName === "HTML" ? a = T : a.appendChild(T);
|
|
524
529
|
else {
|
|
525
530
|
if (!Ae && !_e && !ge && // eslint-disable-next-line unicorn/prefer-includes
|
|
526
531
|
A.indexOf("<") === -1)
|
|
527
532
|
return B && Ue ? B.createHTML(A) : A;
|
|
528
|
-
if (a =
|
|
533
|
+
if (a = wt(A), !a)
|
|
529
534
|
return Ae ? null : Ue ? c : "";
|
|
530
535
|
}
|
|
531
|
-
a &&
|
|
532
|
-
const z =
|
|
536
|
+
a && Ze && le(a.firstChild);
|
|
537
|
+
const z = Dt(Le ? A : a);
|
|
533
538
|
for (; U = z.nextNode(); )
|
|
534
|
-
|
|
535
|
-
if (
|
|
539
|
+
bt(U), Nt(U), U.content instanceof R && ir(U.content);
|
|
540
|
+
if (Le)
|
|
536
541
|
return A;
|
|
537
542
|
if (Ae) {
|
|
538
543
|
if (Fe)
|
|
@@ -540,38 +545,38 @@ function Yt() {
|
|
|
540
545
|
j.appendChild(a.firstChild);
|
|
541
546
|
else
|
|
542
547
|
j = a;
|
|
543
|
-
return (_.shadowroot || _.shadowrootmode) && (j =
|
|
548
|
+
return (_.shadowroot || _.shadowrootmode) && (j = d.call(o, j, !0)), j;
|
|
544
549
|
}
|
|
545
550
|
let ee = ge ? a.outerHTML : a.innerHTML;
|
|
546
|
-
return ge && E["!doctype"] && a.ownerDocument && a.ownerDocument.doctype && a.ownerDocument.doctype.name && K(
|
|
547
|
-
` + ee), _e &&
|
|
551
|
+
return ge && E["!doctype"] && a.ownerDocument && a.ownerDocument.doctype && a.ownerDocument.doctype.name && K(Yt, a.ownerDocument.doctype.name) && (ee = "<!DOCTYPE " + a.ownerDocument.doctype.name + `>
|
|
552
|
+
` + ee), _e && We([S, f, s], (pe) => {
|
|
548
553
|
ee = xe(ee, pe, " ");
|
|
549
554
|
}), B && Ue ? B.createHTML(ee) : ee;
|
|
550
555
|
}, t.setConfig = function() {
|
|
551
556
|
let A = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
552
|
-
|
|
557
|
+
nt(A), Ke = !0;
|
|
553
558
|
}, t.clearConfig = function() {
|
|
554
|
-
Re = null,
|
|
559
|
+
Re = null, Ke = !1;
|
|
555
560
|
}, t.isValidAttribute = function(A, e, a) {
|
|
556
|
-
Re ||
|
|
561
|
+
Re || nt({});
|
|
557
562
|
const T = $(A), U = $(e);
|
|
558
|
-
return
|
|
563
|
+
return Ot(T, U, a);
|
|
559
564
|
}, t.addHook = function(A, e) {
|
|
560
565
|
typeof e == "function" && Oe(n[A], e);
|
|
561
566
|
}, t.removeHook = function(A, e) {
|
|
562
567
|
if (e !== void 0) {
|
|
563
|
-
const a =
|
|
564
|
-
return a === -1 ? void 0 :
|
|
568
|
+
const a = cr(n[A], e);
|
|
569
|
+
return a === -1 ? void 0 : ur(n[A], a, 1)[0];
|
|
565
570
|
}
|
|
566
|
-
return
|
|
571
|
+
return Ft(n[A]);
|
|
567
572
|
}, t.removeHooks = function(A) {
|
|
568
573
|
n[A] = [];
|
|
569
574
|
}, t.removeAllHooks = function() {
|
|
570
|
-
n =
|
|
575
|
+
n = Gt();
|
|
571
576
|
}, t;
|
|
572
577
|
}
|
|
573
|
-
var Lr =
|
|
574
|
-
function
|
|
578
|
+
var Lr = qt();
|
|
579
|
+
function Wt(r) {
|
|
575
580
|
return Lr.sanitize(r, {
|
|
576
581
|
ALLOWED_TAGS: ["p", "br", "strong", "em", "s", "u", "ul", "ol", "li", "a", "hr"],
|
|
577
582
|
ALLOWED_ATTR: ["href", "target", "rel"],
|
|
@@ -589,7 +594,7 @@ function Z(r) {
|
|
|
589
594
|
const t = r.trim(), i = t.toLowerCase();
|
|
590
595
|
return i.startsWith("javascript:") || i.startsWith("vbscript:") || i.startsWith("file:") ? "" : i.startsWith("data:") ? i.startsWith("data:image/") ? t : "" : t;
|
|
591
596
|
}
|
|
592
|
-
const
|
|
597
|
+
const M = {
|
|
593
598
|
// グループ付きテキストフィールド: {$field.group:default}
|
|
594
599
|
TEXT_FIELD_WITH_GROUP: /\{\$(\w+)\.(\w+):([^}]+)\}/g,
|
|
595
600
|
// テキストフィールド: {$field:default}
|
|
@@ -640,7 +645,7 @@ function br(r) {
|
|
|
640
645
|
return t;
|
|
641
646
|
}
|
|
642
647
|
function te(r) {
|
|
643
|
-
const t = r.split(":"), i = [], o = (
|
|
648
|
+
const t = r.split(":"), i = [], o = (m) => m === "required" || m === "readonly" || m === "disabled" || /^max=\d+$/.test(m);
|
|
644
649
|
for (; t.length > 0 && o(t[t.length - 1]); )
|
|
645
650
|
i.unshift(t.pop());
|
|
646
651
|
return {
|
|
@@ -648,21 +653,21 @@ function te(r) {
|
|
|
648
653
|
validation: br(i)
|
|
649
654
|
};
|
|
650
655
|
}
|
|
651
|
-
function
|
|
652
|
-
const o =
|
|
656
|
+
function Or(r, t, i) {
|
|
657
|
+
const o = Vt(), I = new o().parseFromString(`<template>${r}</template>`, "text/html").querySelector("template");
|
|
653
658
|
if (!I || !I.content.firstElementChild)
|
|
654
|
-
return
|
|
659
|
+
return de.warn("Failed to parse HTML:", r), r;
|
|
655
660
|
const C = I.content.firstElementChild;
|
|
656
|
-
if (Object.entries(t).forEach(([k,
|
|
657
|
-
C.setAttribute(k,
|
|
661
|
+
if (Object.entries(t).forEach(([k, P]) => {
|
|
662
|
+
C.setAttribute(k, P);
|
|
658
663
|
}), i?.addClass) {
|
|
659
|
-
const k = C.getAttribute("class")?.trim() || "",
|
|
660
|
-
C.setAttribute("class",
|
|
664
|
+
const k = C.getAttribute("class")?.trim() || "", P = k ? `${k} ${i.addClass}` : i.addClass;
|
|
665
|
+
C.setAttribute("class", P);
|
|
661
666
|
}
|
|
662
667
|
return C.outerHTML;
|
|
663
668
|
}
|
|
664
|
-
function
|
|
665
|
-
const R = [...i, ...o, ...
|
|
669
|
+
function Ve(r, t, i, o, m = []) {
|
|
670
|
+
const R = [...i, ...o, ...m];
|
|
666
671
|
if (r) {
|
|
667
672
|
const I = R.find((C) => C.id === r);
|
|
668
673
|
if (I)
|
|
@@ -671,14 +676,14 @@ function Be(r, t, i, o, d = []) {
|
|
|
671
676
|
if (t) {
|
|
672
677
|
const I = R.find((C) => C.id === t);
|
|
673
678
|
if (I)
|
|
674
|
-
return
|
|
679
|
+
return de.warn(`Image not found: ${r}, using default: ${t}`), I.url;
|
|
675
680
|
}
|
|
676
|
-
return
|
|
681
|
+
return de.warn(`Image not found: ${r}, default: ${t}`), "";
|
|
677
682
|
}
|
|
678
|
-
function
|
|
683
|
+
function xr(r) {
|
|
679
684
|
return typeof r == "object" && r !== null;
|
|
680
685
|
}
|
|
681
|
-
function
|
|
686
|
+
function Bt(r, t) {
|
|
682
687
|
if (!r || !t) return "";
|
|
683
688
|
try {
|
|
684
689
|
const i = [];
|
|
@@ -688,32 +693,32 @@ function Wt(r, t) {
|
|
|
688
693
|
I === "[" || I === "]" || I === "." ? o && (i.push(o), o = "") : o += I;
|
|
689
694
|
}
|
|
690
695
|
o && i.push(o);
|
|
691
|
-
let
|
|
696
|
+
let m = r;
|
|
692
697
|
for (let R = 0; R < i.length; R++) {
|
|
693
698
|
const I = i[R];
|
|
694
699
|
if (I.match(/^\d+$/)) {
|
|
695
700
|
const C = parseInt(I, 10);
|
|
696
|
-
if (Array.isArray(
|
|
697
|
-
|
|
701
|
+
if (Array.isArray(m) && C >= 0 && C < m.length)
|
|
702
|
+
m = m[C];
|
|
698
703
|
else
|
|
699
704
|
return "";
|
|
700
|
-
} else if (
|
|
701
|
-
|
|
705
|
+
} else if (xr(m) && I in m)
|
|
706
|
+
m = m[I];
|
|
702
707
|
else
|
|
703
708
|
return "";
|
|
704
709
|
}
|
|
705
|
-
return
|
|
710
|
+
return m == null ? "" : String(m);
|
|
706
711
|
} catch (i) {
|
|
707
|
-
return
|
|
712
|
+
return de.warn(`Failed to resolve backend data path: ${t}`, i), "";
|
|
708
713
|
}
|
|
709
714
|
}
|
|
710
|
-
function
|
|
715
|
+
function Nr(r, t) {
|
|
711
716
|
return !r || !t ? r : r.replace(/\{(\w+)\}/g, (i, o) => {
|
|
712
|
-
const
|
|
713
|
-
return
|
|
717
|
+
const m = t[o];
|
|
718
|
+
return m == null ? i : String(m);
|
|
714
719
|
});
|
|
715
720
|
}
|
|
716
|
-
const
|
|
721
|
+
const Cr = [
|
|
717
722
|
"h1",
|
|
718
723
|
"h2",
|
|
719
724
|
"h3",
|
|
@@ -745,21 +750,21 @@ const xr = [
|
|
|
745
750
|
"th",
|
|
746
751
|
"td"
|
|
747
752
|
];
|
|
748
|
-
function
|
|
753
|
+
function vr(r, t) {
|
|
749
754
|
r.querySelectorAll("[z-if]").forEach((i) => {
|
|
750
755
|
const o = i.getAttribute("z-if");
|
|
751
756
|
o ? (t[o] !== void 0 ? t[o] : !0) ? i.removeAttribute("z-if") : i.remove() : i.removeAttribute("z-if");
|
|
752
757
|
});
|
|
753
758
|
}
|
|
754
|
-
function
|
|
759
|
+
function Mr(r, t, i) {
|
|
755
760
|
r.querySelectorAll("[z-tag]").forEach((o) => {
|
|
756
|
-
const
|
|
757
|
-
if (
|
|
758
|
-
const R =
|
|
761
|
+
const m = o.getAttribute("z-tag");
|
|
762
|
+
if (m) {
|
|
763
|
+
const R = m.match(/^\$(\w+)(?::(.+))?$/);
|
|
759
764
|
if (R) {
|
|
760
|
-
const I = R[1], C = t[I], k = typeof C == "string" ? C : o.tagName.toLowerCase(),
|
|
761
|
-
if (typeof
|
|
762
|
-
const re = i.createElement(
|
|
765
|
+
const I = R[1], C = t[I], k = typeof C == "string" ? C : o.tagName.toLowerCase(), P = typeof k == "string" ? k.toLowerCase() : k;
|
|
766
|
+
if (typeof P == "string" && Cr.includes(P)) {
|
|
767
|
+
const re = i.createElement(P);
|
|
763
768
|
Array.from(o.attributes).forEach((ne) => {
|
|
764
769
|
ne.name !== "z-tag" && re.setAttribute(ne.name, ne.value);
|
|
765
770
|
}), Array.from(o.childNodes).forEach((ne) => {
|
|
@@ -770,7 +775,7 @@ function Cr(r, t, i) {
|
|
|
770
775
|
}
|
|
771
776
|
});
|
|
772
777
|
}
|
|
773
|
-
function
|
|
778
|
+
function Pr(r) {
|
|
774
779
|
if (r == null || r === "")
|
|
775
780
|
return !0;
|
|
776
781
|
if (typeof r == "string") {
|
|
@@ -780,151 +785,151 @@ function vr(r) {
|
|
|
780
785
|
}
|
|
781
786
|
return !1;
|
|
782
787
|
}
|
|
783
|
-
function
|
|
788
|
+
function Fr(r, t) {
|
|
784
789
|
r.querySelectorAll("[z-empty]").forEach((i) => {
|
|
785
790
|
const o = i.getAttribute("z-empty");
|
|
786
791
|
if (o) {
|
|
787
|
-
const
|
|
788
|
-
if (
|
|
789
|
-
const R =
|
|
790
|
-
|
|
792
|
+
const m = o.match(/^\$(\w+)$/);
|
|
793
|
+
if (m) {
|
|
794
|
+
const R = m[1], I = t[R];
|
|
795
|
+
Pr(I) ? i.remove() : i.removeAttribute("z-empty");
|
|
791
796
|
} else
|
|
792
797
|
i.removeAttribute("z-empty");
|
|
793
798
|
} else
|
|
794
799
|
i.removeAttribute("z-empty");
|
|
795
800
|
});
|
|
796
801
|
}
|
|
797
|
-
function
|
|
798
|
-
const ne =
|
|
802
|
+
function Kt(r, t, i, o, m, R = !0, I = [], C = [], k = [], P, re) {
|
|
803
|
+
const ne = Vt(), ie = new ne(), v = ie.parseFromString(`<template>${r}</template>`, "text/html"), W = v.querySelector("template");
|
|
799
804
|
if (!W || !W.content)
|
|
800
|
-
return
|
|
805
|
+
return de.error("Failed to parse template HTML"), r;
|
|
801
806
|
const he = (c) => {
|
|
802
|
-
if (c.nodeType ===
|
|
807
|
+
if (c.nodeType === st) {
|
|
803
808
|
let l = c.textContent || "";
|
|
804
|
-
|
|
805
|
-
let h = /\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(l),
|
|
806
|
-
if (h && c.parentNode ?
|
|
807
|
-
const y = h[1],
|
|
809
|
+
P && (l = l.replace(M.BACKEND_DATA, (y, b) => Bt(P, b)));
|
|
810
|
+
let h = /\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(l), w = !1;
|
|
811
|
+
if (h && c.parentNode ? w = !0 : h = /\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(l), h && c.parentNode) {
|
|
812
|
+
const y = h[1], b = w ? h[3] : h[2], { defaultValue: E } = te(b), O = t[y];
|
|
808
813
|
if (typeof O == "boolean") {
|
|
809
|
-
const q = c.parentNode,
|
|
810
|
-
|
|
814
|
+
const q = c.parentNode, me = h.index || 0, we = l.substring(0, me), De = l.substring(me + h[0].length);
|
|
815
|
+
we && q.insertBefore(v.createTextNode(we), c), De && q.insertBefore(v.createTextNode(De), c), c.parentNode && c.parentNode.removeChild(c);
|
|
811
816
|
return;
|
|
812
817
|
}
|
|
813
818
|
let _ = O === void 0 ? "" : typeof O == "string" ? O : String(O || E);
|
|
814
|
-
R || (_ =
|
|
819
|
+
R || (_ = Wt(_));
|
|
815
820
|
const F = c.parentNode, N = h.index || 0, V = l.substring(0, N), Y = l.substring(N + h[0].length);
|
|
816
821
|
_ ? _.trim().startsWith("<p") || (_ = `<p>${_}</p>`) : _ = "";
|
|
817
|
-
const H =
|
|
818
|
-
H.innerHTML = _, V && F.insertBefore(
|
|
822
|
+
const H = v.createElement("div");
|
|
823
|
+
H.innerHTML = _, V && F.insertBefore(v.createTextNode(V), c), Array.from(H.childNodes).forEach((q) => {
|
|
819
824
|
F.insertBefore(q.cloneNode(!0), c);
|
|
820
|
-
}), Y && F.insertBefore(
|
|
825
|
+
}), Y && F.insertBefore(v.createTextNode(Y), c), c.parentNode && c.parentNode.removeChild(c);
|
|
821
826
|
return;
|
|
822
827
|
}
|
|
823
828
|
let n = new RegExp(
|
|
824
|
-
|
|
825
|
-
|
|
829
|
+
M.RICH_TEXT_FIELD_WITH_GROUP.source,
|
|
830
|
+
M.RICH_TEXT_FIELD_WITH_GROUP.flags
|
|
826
831
|
).exec(l), S = !1;
|
|
827
832
|
if (n && c.parentNode ? S = !0 : n = new RegExp(
|
|
828
|
-
|
|
829
|
-
|
|
833
|
+
M.RICH_TEXT_FIELD.source,
|
|
834
|
+
M.RICH_TEXT_FIELD.flags
|
|
830
835
|
).exec(l), n && c.parentNode) {
|
|
831
|
-
const y = n[1],
|
|
832
|
-
let O = E === void 0 ? "" : typeof E == "string" ? E : String(E ||
|
|
833
|
-
R || (O =
|
|
836
|
+
const y = n[1], b = S ? n[3] : n[2], E = t[y];
|
|
837
|
+
let O = E === void 0 ? "" : typeof E == "string" ? E : String(E || b);
|
|
838
|
+
R || (O = Wt(O));
|
|
834
839
|
const _ = c.parentNode, F = n.index || 0, N = l.substring(0, F), V = l.substring(F + n[0].length);
|
|
835
840
|
O ? O.trim().startsWith("<p") || (O = `<p>${O}</p>`) : O = "<p></p>";
|
|
836
|
-
const Y =
|
|
837
|
-
Y.innerHTML = O, N && _.insertBefore(
|
|
841
|
+
const Y = v.createElement("div");
|
|
842
|
+
Y.innerHTML = O, N && _.insertBefore(v.createTextNode(N), c), Array.from(Y.childNodes).forEach((H) => {
|
|
838
843
|
_.insertBefore(H.cloneNode(!0), c);
|
|
839
|
-
}), V && _.insertBefore(
|
|
844
|
+
}), V && _.insertBefore(v.createTextNode(V), c), c.parentNode && c.parentNode.removeChild(c);
|
|
840
845
|
return;
|
|
841
846
|
}
|
|
842
847
|
let s = /\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(l), u = !1;
|
|
843
848
|
if (s && c.parentNode ? u = !0 : s = /\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(l), s && c.parentNode) {
|
|
844
|
-
const y = s[1],
|
|
845
|
-
V && F.insertBefore(
|
|
849
|
+
const y = s[1], b = u ? s[3] : s[2], { defaultValue: E } = te(b), O = t[y], _ = O === void 0 ? "" : String(O || E), F = c.parentNode, N = s.index || 0, V = l.substring(0, N), Y = l.substring(N + s[0].length);
|
|
850
|
+
V && F.insertBefore(v.createTextNode(V), c);
|
|
846
851
|
const H = _.split(`
|
|
847
852
|
`);
|
|
848
|
-
if (H.forEach((q,
|
|
849
|
-
q && F.insertBefore(
|
|
853
|
+
if (H.forEach((q, me) => {
|
|
854
|
+
q && F.insertBefore(v.createTextNode(q), c), me < H.length - 1 && F.insertBefore(v.createElement("br"), c);
|
|
850
855
|
}), Y) {
|
|
851
|
-
const q =
|
|
856
|
+
const q = v.createTextNode(Y);
|
|
852
857
|
F.insertBefore(q, c), he(q);
|
|
853
858
|
}
|
|
854
859
|
c.parentNode && c.parentNode.removeChild(c);
|
|
855
860
|
return;
|
|
856
861
|
}
|
|
857
862
|
let g = new RegExp(
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
).exec(l),
|
|
861
|
-
if (g && c.parentNode ?
|
|
862
|
-
|
|
863
|
-
|
|
863
|
+
M.TEXTAREA_FIELD_WITH_GROUP.source,
|
|
864
|
+
M.TEXTAREA_FIELD_WITH_GROUP.flags
|
|
865
|
+
).exec(l), D = !1;
|
|
866
|
+
if (g && c.parentNode ? D = !0 : g = new RegExp(
|
|
867
|
+
M.TEXTAREA_FIELD.source,
|
|
868
|
+
M.TEXTAREA_FIELD.flags
|
|
864
869
|
).exec(l), g && c.parentNode) {
|
|
865
|
-
const y = g[1],
|
|
866
|
-
N && _.insertBefore(
|
|
870
|
+
const y = g[1], b = D ? g[3] : g[2], E = t[y] ?? b ?? "", O = String(E), _ = c.parentNode, F = g.index || 0, N = l.substring(0, F), V = l.substring(F + g[0].length);
|
|
871
|
+
N && _.insertBefore(v.createTextNode(N), c);
|
|
867
872
|
const Y = O.split(`
|
|
868
873
|
`);
|
|
869
874
|
if (Y.forEach((H, q) => {
|
|
870
|
-
H && _.insertBefore(
|
|
875
|
+
H && _.insertBefore(v.createTextNode(H), c), q < Y.length - 1 && _.insertBefore(v.createElement("br"), c);
|
|
871
876
|
}), V) {
|
|
872
|
-
const H =
|
|
877
|
+
const H = v.createTextNode(V);
|
|
873
878
|
_.insertBefore(H, c), he(H);
|
|
874
879
|
}
|
|
875
880
|
c.parentNode && c.parentNode.removeChild(c);
|
|
876
881
|
return;
|
|
877
882
|
}
|
|
878
|
-
l = l.replace(/\{\$(\w+)\?:([^}]+)\}/g, (y,
|
|
883
|
+
l = l.replace(/\{\$(\w+)\?:([^}]+)\}/g, (y, b, E) => {
|
|
879
884
|
if (/:textarea(?::[^}]*)?$/.test(y))
|
|
880
885
|
return y;
|
|
881
|
-
const O = t[
|
|
886
|
+
const O = t[b];
|
|
882
887
|
if (O === void 0 || typeof O == "boolean")
|
|
883
888
|
return "";
|
|
884
889
|
const { defaultValue: _ } = te(E);
|
|
885
890
|
return String(O || _);
|
|
886
891
|
}), l = l.replace(
|
|
887
892
|
/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,
|
|
888
|
-
(y,
|
|
893
|
+
(y, b, E, O) => {
|
|
889
894
|
if (/:textarea(?::[^}]*)?$/.test(y))
|
|
890
895
|
return y;
|
|
891
|
-
const _ = t[
|
|
896
|
+
const _ = t[b];
|
|
892
897
|
if (_ === void 0 || typeof _ == "boolean")
|
|
893
898
|
return "";
|
|
894
899
|
const { defaultValue: F } = te(O);
|
|
895
900
|
return String(_ || F);
|
|
896
901
|
}
|
|
897
902
|
), l = l.replace(
|
|
898
|
-
|
|
899
|
-
(y,
|
|
900
|
-
const _ = t[
|
|
903
|
+
M.TEXT_FIELD_WITH_GROUP,
|
|
904
|
+
(y, b, E, O) => {
|
|
905
|
+
const _ = t[b];
|
|
901
906
|
if (_ === void 0)
|
|
902
907
|
return "";
|
|
903
908
|
const { defaultValue: F } = te(O);
|
|
904
909
|
return String(_ || F);
|
|
905
910
|
}
|
|
906
|
-
), l = l.replace(
|
|
907
|
-
const O = t[
|
|
911
|
+
), l = l.replace(M.TEXT_FIELD, (y, b, E) => {
|
|
912
|
+
const O = t[b];
|
|
908
913
|
if (O === void 0)
|
|
909
914
|
return "";
|
|
910
915
|
const { defaultValue: _ } = te(E);
|
|
911
916
|
return String(O || _);
|
|
912
917
|
}), c.textContent = l;
|
|
913
|
-
} else if (c.nodeType ===
|
|
918
|
+
} else if (c.nodeType === at) {
|
|
914
919
|
const l = c, x = [];
|
|
915
920
|
Array.from(l.attributes).forEach((h) => {
|
|
916
|
-
const
|
|
917
|
-
let
|
|
921
|
+
const w = h.value;
|
|
922
|
+
let d = h.value;
|
|
918
923
|
const n = h.name.toLowerCase();
|
|
919
924
|
if (n === "z-if" || n === "z-for" || n === "z-slot" || n === "z-empty" || n === "z-tag" || n.startsWith("data-zcode-"))
|
|
920
925
|
return;
|
|
921
926
|
const S = /^\{\$[\w.]+?\?:[^}]+\}(?::(rich|image|textarea))?$/.test(
|
|
922
|
-
|
|
927
|
+
w.trim()
|
|
923
928
|
);
|
|
924
|
-
|
|
925
|
-
const u =
|
|
929
|
+
P && ((n === "href" || n === "src" || n === "action") && (d = Nr(d, P)), d = d.replace(M.BACKEND_DATA, (f, s) => {
|
|
930
|
+
const u = Bt(P, s);
|
|
926
931
|
return n === "href" || n === "src" || n === "action" ? Z(u) : G(u);
|
|
927
|
-
})),
|
|
932
|
+
})), d = d.replace(
|
|
928
933
|
/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,
|
|
929
934
|
(f, s, u) => {
|
|
930
935
|
const p = t[s];
|
|
@@ -933,74 +938,74 @@ function qt(r, t, i, o, d, R = !0, I = [], C = [], k = [], M, re) {
|
|
|
933
938
|
const { defaultValue: g } = te(u);
|
|
934
939
|
return G(String(p || g));
|
|
935
940
|
}
|
|
936
|
-
),
|
|
941
|
+
), d = d.replace(
|
|
937
942
|
/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,
|
|
938
943
|
(f, s, u, p) => {
|
|
939
944
|
const g = t[s];
|
|
940
945
|
if (g === void 0 || typeof g == "boolean")
|
|
941
946
|
return "";
|
|
942
|
-
const { defaultValue:
|
|
943
|
-
return G(String(g ||
|
|
947
|
+
const { defaultValue: D } = te(p);
|
|
948
|
+
return G(String(g || D));
|
|
944
949
|
}
|
|
945
|
-
),
|
|
950
|
+
), d = d.replace(
|
|
946
951
|
/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g,
|
|
947
952
|
(f, s, u) => {
|
|
948
953
|
const p = t[s];
|
|
949
954
|
if (p === void 0)
|
|
950
955
|
return "";
|
|
951
|
-
const { defaultValue: g } = te(u),
|
|
952
|
-
|
|
956
|
+
const { defaultValue: g } = te(u), D = typeof p == "string" ? p : String(p || g), y = Ve(
|
|
957
|
+
D,
|
|
953
958
|
g,
|
|
954
959
|
I,
|
|
955
960
|
C,
|
|
956
961
|
k
|
|
957
|
-
),
|
|
958
|
-
return n === "href" || n === "src" ? Z(
|
|
962
|
+
), b = typeof y == "string" ? y : String(y || g);
|
|
963
|
+
return n === "href" || n === "src" ? Z(b) : G(b);
|
|
959
964
|
}
|
|
960
|
-
),
|
|
965
|
+
), d = d.replace(
|
|
961
966
|
/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g,
|
|
962
967
|
(f, s, u, p) => {
|
|
963
968
|
const g = t[s];
|
|
964
969
|
if (g === void 0)
|
|
965
970
|
return "";
|
|
966
|
-
const { defaultValue:
|
|
971
|
+
const { defaultValue: D } = te(p), y = typeof g == "string" ? g : String(g || D), b = Ve(
|
|
967
972
|
y,
|
|
968
|
-
|
|
973
|
+
D,
|
|
969
974
|
I,
|
|
970
975
|
C,
|
|
971
976
|
k
|
|
972
|
-
), E = typeof
|
|
977
|
+
), E = typeof b == "string" ? b : String(b || D);
|
|
973
978
|
return n === "href" || n === "src" ? Z(E) : G(E);
|
|
974
979
|
}
|
|
975
|
-
),
|
|
976
|
-
|
|
980
|
+
), d = d.replace(
|
|
981
|
+
M.RICH_TEXT_FIELD_WITH_GROUP,
|
|
977
982
|
(f, s, u, p) => {
|
|
978
983
|
const g = t[s];
|
|
979
984
|
return g === void 0 ? "" : G(String(g || p));
|
|
980
985
|
}
|
|
981
|
-
),
|
|
986
|
+
), d = d.replace(M.RICH_TEXT_FIELD, (f, s, u) => {
|
|
982
987
|
const p = t[s];
|
|
983
988
|
return p === void 0 ? "" : G(String(p || u));
|
|
984
|
-
}),
|
|
985
|
-
|
|
989
|
+
}), d = d.replace(
|
|
990
|
+
M.IMAGE_FIELD_WITH_GROUP,
|
|
986
991
|
(f, s, u, p) => {
|
|
987
992
|
const g = t[s];
|
|
988
993
|
if (g === void 0)
|
|
989
994
|
return "";
|
|
990
|
-
const
|
|
995
|
+
const D = Ve(
|
|
991
996
|
g || p,
|
|
992
997
|
p,
|
|
993
998
|
I,
|
|
994
999
|
C,
|
|
995
1000
|
k
|
|
996
1001
|
);
|
|
997
|
-
return n === "href" || n === "src" ? Z(
|
|
1002
|
+
return n === "href" || n === "src" ? Z(D || p) : G(D || p);
|
|
998
1003
|
}
|
|
999
|
-
),
|
|
1004
|
+
), d = d.replace(M.IMAGE_FIELD, (f, s, u) => {
|
|
1000
1005
|
const p = t[s];
|
|
1001
1006
|
if (p === void 0)
|
|
1002
1007
|
return "";
|
|
1003
|
-
const g =
|
|
1008
|
+
const g = Ve(
|
|
1004
1009
|
p || u,
|
|
1005
1010
|
u,
|
|
1006
1011
|
I,
|
|
@@ -1008,37 +1013,37 @@ function qt(r, t, i, o, d, R = !0, I = [], C = [], k = [], M, re) {
|
|
|
1008
1013
|
k
|
|
1009
1014
|
);
|
|
1010
1015
|
return n === "href" || n === "src" ? Z(g || u) : G(g || u);
|
|
1011
|
-
}),
|
|
1016
|
+
}), d = d.replace(/\{\$(\w+)\?:([^}]+)\}/g, (f, s, u) => {
|
|
1012
1017
|
const p = t[s];
|
|
1013
1018
|
if (p === void 0 || typeof p == "boolean")
|
|
1014
1019
|
return "";
|
|
1015
|
-
const { defaultValue: g } = te(u),
|
|
1016
|
-
return n === "href" || n === "src" || n === "action" ? Z(
|
|
1017
|
-
}),
|
|
1020
|
+
const { defaultValue: g } = te(u), D = String(p || g);
|
|
1021
|
+
return n === "href" || n === "src" || n === "action" ? Z(D) : G(D);
|
|
1022
|
+
}), d = d.replace(
|
|
1018
1023
|
/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,
|
|
1019
1024
|
(f, s, u, p) => {
|
|
1020
1025
|
const g = t[s];
|
|
1021
1026
|
if (g === void 0 || typeof g == "boolean")
|
|
1022
1027
|
return "";
|
|
1023
|
-
const { defaultValue:
|
|
1028
|
+
const { defaultValue: D } = te(p), y = String(g || D);
|
|
1024
1029
|
return n === "href" || n === "src" || n === "action" ? Z(y) : G(y);
|
|
1025
1030
|
}
|
|
1026
|
-
),
|
|
1027
|
-
|
|
1031
|
+
), d = d.replace(
|
|
1032
|
+
M.TEXT_FIELD_WITH_GROUP,
|
|
1028
1033
|
(f, s, u, p) => {
|
|
1029
1034
|
const g = t[s];
|
|
1030
1035
|
if (g === void 0)
|
|
1031
1036
|
return "";
|
|
1032
|
-
const { defaultValue:
|
|
1037
|
+
const { defaultValue: D } = te(p), y = String(g || D);
|
|
1033
1038
|
return n === "href" || n === "src" || n === "action" ? Z(y) : G(y);
|
|
1034
1039
|
}
|
|
1035
|
-
),
|
|
1040
|
+
), d = d.replace(M.TEXT_FIELD, (f, s, u) => {
|
|
1036
1041
|
const p = t[s];
|
|
1037
1042
|
if (p === void 0)
|
|
1038
1043
|
return "";
|
|
1039
|
-
const { defaultValue: g } = te(u),
|
|
1040
|
-
return n === "href" || n === "src" || n === "action" ? Z(
|
|
1041
|
-
}), S &&
|
|
1044
|
+
const { defaultValue: g } = te(u), D = String(p || g);
|
|
1045
|
+
return n === "href" || n === "src" || n === "action" ? Z(D) : G(D);
|
|
1046
|
+
}), S && d.trim() === "" ? x.push(h.name) : h.value = d;
|
|
1042
1047
|
}), x.forEach((h) => {
|
|
1043
1048
|
l.removeAttribute(h);
|
|
1044
1049
|
});
|
|
@@ -1047,72 +1052,72 @@ function qt(r, t, i, o, d, R = !0, I = [], C = [], k = [], M, re) {
|
|
|
1047
1052
|
};
|
|
1048
1053
|
he(W.content);
|
|
1049
1054
|
const Me = (c) => {
|
|
1050
|
-
if (c.nodeType ===
|
|
1055
|
+
if (c.nodeType === st) {
|
|
1051
1056
|
let l = c.textContent || "";
|
|
1052
1057
|
l = l.replace(
|
|
1053
|
-
|
|
1054
|
-
(x, h,
|
|
1055
|
-
if (
|
|
1056
|
-
return t[h] ||
|
|
1057
|
-
if (
|
|
1058
|
-
const n = t[h], S = Array.isArray(n) ? n : [], f =
|
|
1058
|
+
M.SELECT_FIELD_WITH_GROUP,
|
|
1059
|
+
(x, h, w, d) => {
|
|
1060
|
+
if (d.includes("|"))
|
|
1061
|
+
return t[h] || d.split("|")[0];
|
|
1062
|
+
if (d.includes(",")) {
|
|
1063
|
+
const n = t[h], S = Array.isArray(n) ? n : [], f = d.split(",");
|
|
1059
1064
|
return S.filter((s) => typeof s == "string" && f.includes(s)).join(" ");
|
|
1060
1065
|
}
|
|
1061
|
-
return t[h] ||
|
|
1066
|
+
return t[h] || d;
|
|
1062
1067
|
}
|
|
1063
|
-
), l = l.replace(
|
|
1064
|
-
if (
|
|
1068
|
+
), l = l.replace(M.SELECT_FIELD, (x, h, w) => {
|
|
1069
|
+
if (w.includes("|")) {
|
|
1065
1070
|
const n = t[h];
|
|
1066
|
-
return typeof n == "string" ? n :
|
|
1067
|
-
} else if (
|
|
1068
|
-
const n = t[h], S = Array.isArray(n) ? n : [], f =
|
|
1071
|
+
return typeof n == "string" ? n : w.split("|")[0];
|
|
1072
|
+
} else if (w.includes(",")) {
|
|
1073
|
+
const n = t[h], S = Array.isArray(n) ? n : [], f = w.split(",");
|
|
1069
1074
|
return S.filter((s) => typeof s == "string" && f.includes(s)).join(" ");
|
|
1070
1075
|
}
|
|
1071
|
-
const
|
|
1072
|
-
return typeof
|
|
1076
|
+
const d = t[h];
|
|
1077
|
+
return typeof d == "string" ? d : w;
|
|
1073
1078
|
}), l = l.replace(
|
|
1074
|
-
|
|
1075
|
-
(x, h,
|
|
1076
|
-
if (
|
|
1079
|
+
M.RADIO_CHECKBOX_FIELD_WITH_GROUP,
|
|
1080
|
+
(x, h, w, d) => {
|
|
1081
|
+
if (d.includes("|")) {
|
|
1077
1082
|
const S = t[h];
|
|
1078
|
-
return typeof S == "string" ? S :
|
|
1079
|
-
} else if (
|
|
1080
|
-
const S = t[h], f = Array.isArray(S) ? S : [], s =
|
|
1083
|
+
return typeof S == "string" ? S : d.split("|")[0];
|
|
1084
|
+
} else if (d.includes(",")) {
|
|
1085
|
+
const S = t[h], f = Array.isArray(S) ? S : [], s = d.split(",");
|
|
1081
1086
|
return f.filter((u) => typeof u == "string" && s.includes(u)).join(" ");
|
|
1082
1087
|
}
|
|
1083
1088
|
const n = t[h];
|
|
1084
|
-
return typeof n == "string" ? n :
|
|
1089
|
+
return typeof n == "string" ? n : d;
|
|
1085
1090
|
}
|
|
1086
|
-
), l = l.replace(
|
|
1087
|
-
if (
|
|
1091
|
+
), l = l.replace(M.RADIO_FIELD, (x, h, w) => {
|
|
1092
|
+
if (w.includes("|")) {
|
|
1088
1093
|
const n = t[h];
|
|
1089
|
-
return typeof n == "string" ? n :
|
|
1090
|
-
} else if (
|
|
1091
|
-
const n = t[h], S = Array.isArray(n) ? n : [], f =
|
|
1094
|
+
return typeof n == "string" ? n : w.split("|")[0];
|
|
1095
|
+
} else if (w.includes(",")) {
|
|
1096
|
+
const n = t[h], S = Array.isArray(n) ? n : [], f = w.split(",");
|
|
1092
1097
|
return S.filter((s) => typeof s == "string" && f.includes(s)).join(" ");
|
|
1093
1098
|
}
|
|
1094
|
-
const
|
|
1095
|
-
return typeof
|
|
1099
|
+
const d = t[h];
|
|
1100
|
+
return typeof d == "string" ? d : w;
|
|
1096
1101
|
}), c.textContent = l;
|
|
1097
|
-
} else c.nodeType ===
|
|
1102
|
+
} else c.nodeType === at && Array.from(c.attributes).forEach((x) => {
|
|
1098
1103
|
let h = x.value;
|
|
1099
|
-
const
|
|
1104
|
+
const w = x.name.toLowerCase();
|
|
1100
1105
|
h = h.replace(
|
|
1101
|
-
|
|
1102
|
-
(
|
|
1106
|
+
M.SELECT_FIELD_WITH_GROUP,
|
|
1107
|
+
(d, n, S, f) => {
|
|
1103
1108
|
let s;
|
|
1104
1109
|
if (f.includes("|"))
|
|
1105
1110
|
s = t[n] || f.split("|")[0];
|
|
1106
1111
|
else if (f.includes(",")) {
|
|
1107
1112
|
const u = t[n], p = Array.isArray(u) ? u : [], g = f.split(",");
|
|
1108
|
-
s = p.filter((
|
|
1113
|
+
s = p.filter((D) => typeof D == "string" && g.includes(D)).join(" ");
|
|
1109
1114
|
} else {
|
|
1110
1115
|
const u = t[n];
|
|
1111
1116
|
s = typeof u == "string" ? u : f;
|
|
1112
1117
|
}
|
|
1113
|
-
return
|
|
1118
|
+
return w === "href" || w === "src" || w === "action" ? Z(String(s)) : G(String(s));
|
|
1114
1119
|
}
|
|
1115
|
-
), h = h.replace(
|
|
1120
|
+
), h = h.replace(M.SELECT_FIELD, (d, n, S) => {
|
|
1116
1121
|
let f;
|
|
1117
1122
|
if (S.includes("|"))
|
|
1118
1123
|
f = t[n] || S.split("|")[0];
|
|
@@ -1123,23 +1128,23 @@ function qt(r, t, i, o, d, R = !0, I = [], C = [], k = [], M, re) {
|
|
|
1123
1128
|
const s = t[n];
|
|
1124
1129
|
f = typeof s == "string" ? s : S;
|
|
1125
1130
|
}
|
|
1126
|
-
return
|
|
1131
|
+
return w === "href" || w === "src" || w === "action" ? Z(String(f)) : G(String(f));
|
|
1127
1132
|
}), h = h.replace(
|
|
1128
|
-
|
|
1129
|
-
(
|
|
1133
|
+
M.RADIO_CHECKBOX_FIELD_WITH_GROUP,
|
|
1134
|
+
(d, n, S, f) => {
|
|
1130
1135
|
let s;
|
|
1131
1136
|
if (f.includes("|"))
|
|
1132
1137
|
s = t[n] || f.split("|")[0];
|
|
1133
1138
|
else if (f.includes(",")) {
|
|
1134
1139
|
const u = t[n], p = Array.isArray(u) ? u : [], g = f.split(",");
|
|
1135
|
-
s = p.filter((
|
|
1140
|
+
s = p.filter((D) => typeof D == "string" && g.includes(D)).join(" ");
|
|
1136
1141
|
} else {
|
|
1137
1142
|
const u = t[n];
|
|
1138
1143
|
s = typeof u == "string" ? u : f;
|
|
1139
1144
|
}
|
|
1140
|
-
return
|
|
1145
|
+
return w === "href" || w === "src" || w === "action" ? Z(String(s)) : G(String(s));
|
|
1141
1146
|
}
|
|
1142
|
-
), h = h.replace(
|
|
1147
|
+
), h = h.replace(M.RADIO_FIELD, (d, n, S) => {
|
|
1143
1148
|
let f;
|
|
1144
1149
|
if (S.includes("|"))
|
|
1145
1150
|
f = t[n] || S.split("|")[0];
|
|
@@ -1150,13 +1155,13 @@ function qt(r, t, i, o, d, R = !0, I = [], C = [], k = [], M, re) {
|
|
|
1150
1155
|
const s = t[n];
|
|
1151
1156
|
f = typeof s == "string" ? s : S;
|
|
1152
1157
|
}
|
|
1153
|
-
return
|
|
1158
|
+
return w === "href" || w === "src" || w === "action" ? Z(String(f)) : G(String(f));
|
|
1154
1159
|
}), x.value = h;
|
|
1155
1160
|
});
|
|
1156
1161
|
c.childNodes.forEach((l) => Me(l));
|
|
1157
1162
|
};
|
|
1158
|
-
Me(W.content),
|
|
1159
|
-
const
|
|
1163
|
+
Me(W.content), vr(W.content, t), Mr(W.content, t, v), Fr(W.content, t);
|
|
1164
|
+
const Ye = () => {
|
|
1160
1165
|
Array.from(W.content.querySelectorAll("[z-for]")).forEach((l) => {
|
|
1161
1166
|
const x = l.getAttribute("z-for");
|
|
1162
1167
|
if (!x) {
|
|
@@ -1165,23 +1170,23 @@ function qt(r, t, i, o, d, R = !0, I = [], C = [], k = [], M, re) {
|
|
|
1165
1170
|
}
|
|
1166
1171
|
const h = x.match(/^(\w+)\s+in\s+(.+)$/);
|
|
1167
1172
|
if (!h) {
|
|
1168
|
-
|
|
1173
|
+
de.warn(`Invalid z-for syntax: ${x}`), l.removeAttribute("z-for");
|
|
1169
1174
|
return;
|
|
1170
1175
|
}
|
|
1171
|
-
const [,
|
|
1172
|
-
if (!
|
|
1173
|
-
|
|
1176
|
+
const [, w, d] = h;
|
|
1177
|
+
if (!d.startsWith("{@") || !d.endsWith("}")) {
|
|
1178
|
+
de.warn(`z-for only supports backend data: ${d}`), l.removeAttribute("z-for");
|
|
1174
1179
|
return;
|
|
1175
1180
|
}
|
|
1176
|
-
const n =
|
|
1177
|
-
if (!
|
|
1181
|
+
const n = d.slice(2, -1);
|
|
1182
|
+
if (!P) {
|
|
1178
1183
|
l.remove();
|
|
1179
1184
|
return;
|
|
1180
1185
|
}
|
|
1181
1186
|
let S;
|
|
1182
1187
|
try {
|
|
1183
1188
|
const u = n.split(".");
|
|
1184
|
-
let p =
|
|
1189
|
+
let p = P;
|
|
1185
1190
|
for (const g of u)
|
|
1186
1191
|
if (p && typeof p == "object" && g in p)
|
|
1187
1192
|
p = p[g];
|
|
@@ -1191,39 +1196,39 @@ function qt(r, t, i, o, d, R = !0, I = [], C = [], k = [], M, re) {
|
|
|
1191
1196
|
}
|
|
1192
1197
|
S = p;
|
|
1193
1198
|
} catch (u) {
|
|
1194
|
-
|
|
1199
|
+
de.warn(`Failed to resolve data source: ${n}`, u), l.remove();
|
|
1195
1200
|
return;
|
|
1196
1201
|
}
|
|
1197
1202
|
if (!Array.isArray(S) || S.length === 0) {
|
|
1198
1203
|
l.remove();
|
|
1199
1204
|
return;
|
|
1200
1205
|
}
|
|
1201
|
-
const f = l.ownerDocument ??
|
|
1206
|
+
const f = l.ownerDocument ?? v;
|
|
1202
1207
|
if (!f) throw new Error("Document not available for createDocumentFragment");
|
|
1203
1208
|
const s = f.createDocumentFragment();
|
|
1204
1209
|
S.forEach((u) => {
|
|
1205
1210
|
const p = l.cloneNode(!0);
|
|
1206
|
-
p.removeAttribute("z-for"),
|
|
1211
|
+
p.removeAttribute("z-for"), qe(p, w, u, t, P), s.appendChild(p);
|
|
1207
1212
|
}), l.parentNode && l.parentNode.replaceChild(s, l);
|
|
1208
1213
|
});
|
|
1209
|
-
},
|
|
1214
|
+
}, qe = (c, l, x, h, w, d) => {
|
|
1210
1215
|
const n = (f) => {
|
|
1211
|
-
if (f.nodeType ===
|
|
1216
|
+
if (f.nodeType === st) {
|
|
1212
1217
|
let s = f.textContent || "";
|
|
1213
1218
|
const u = new RegExp(`\\{${l}\\.([\\w\\.\\[\\]]+)\\}`, "g");
|
|
1214
1219
|
s = s.replace(u, (p, g) => {
|
|
1215
1220
|
try {
|
|
1216
|
-
const
|
|
1221
|
+
const D = g.split(/[.[\]]/).filter((b) => b);
|
|
1217
1222
|
let y = x;
|
|
1218
|
-
for (const
|
|
1219
|
-
if (
|
|
1220
|
-
const E = parseInt(
|
|
1223
|
+
for (const b of D)
|
|
1224
|
+
if (b.match(/^\d+$/)) {
|
|
1225
|
+
const E = parseInt(b, 10);
|
|
1221
1226
|
if (Array.isArray(y) && E >= 0 && E < y.length)
|
|
1222
1227
|
y = y[E];
|
|
1223
1228
|
else
|
|
1224
1229
|
return "";
|
|
1225
|
-
} else if (y && typeof y == "object" &&
|
|
1226
|
-
y = y[
|
|
1230
|
+
} else if (y && typeof y == "object" && b in y)
|
|
1231
|
+
y = y[b];
|
|
1227
1232
|
else
|
|
1228
1233
|
return "";
|
|
1229
1234
|
return y == null ? "" : String(y);
|
|
@@ -1231,16 +1236,16 @@ function qt(r, t, i, o, d, R = !0, I = [], C = [], k = [], M, re) {
|
|
|
1231
1236
|
return "";
|
|
1232
1237
|
}
|
|
1233
1238
|
}), s = s.replace(new RegExp(`\\{${l}\\}`, "g"), () => typeof x == "object" && x !== null ? JSON.stringify(x) : String(x)), f.textContent = s;
|
|
1234
|
-
} else if (f.nodeType ===
|
|
1239
|
+
} else if (f.nodeType === at) {
|
|
1235
1240
|
const s = f;
|
|
1236
1241
|
Array.from(s.attributes).forEach((u) => {
|
|
1237
1242
|
let p = u.value;
|
|
1238
1243
|
const g = new RegExp(`\\{${l}\\.([\\w\\.\\[\\]]+)\\}`, "g");
|
|
1239
|
-
p = p.replace(g, (
|
|
1244
|
+
p = p.replace(g, (D, y) => {
|
|
1240
1245
|
try {
|
|
1241
|
-
const
|
|
1246
|
+
const b = y.split(/[.[\]]/).filter((_) => _);
|
|
1242
1247
|
let E = x;
|
|
1243
|
-
for (const _ of
|
|
1248
|
+
for (const _ of b)
|
|
1244
1249
|
if (_.match(/^\d+$/)) {
|
|
1245
1250
|
const F = parseInt(_, 10);
|
|
1246
1251
|
if (Array.isArray(E) && F >= 0 && F < E.length)
|
|
@@ -1257,8 +1262,8 @@ function qt(r, t, i, o, d, R = !0, I = [], C = [], k = [], M, re) {
|
|
|
1257
1262
|
return "";
|
|
1258
1263
|
}
|
|
1259
1264
|
}), p = p.replace(new RegExp(`\\{${l}\\}`, "g"), () => {
|
|
1260
|
-
const
|
|
1261
|
-
return u.name === "href" || u.name === "src" || u.name === "action" ? Z(
|
|
1265
|
+
const D = typeof x == "object" && x !== null ? JSON.stringify(x) : String(x);
|
|
1266
|
+
return u.name === "href" || u.name === "src" || u.name === "action" ? Z(D) : G(D);
|
|
1262
1267
|
}), u.value = p;
|
|
1263
1268
|
}), Array.from(s.childNodes).forEach((u) => n(u));
|
|
1264
1269
|
}
|
|
@@ -1266,27 +1271,27 @@ function qt(r, t, i, o, d, R = !0, I = [], C = [], k = [], M, re) {
|
|
|
1266
1271
|
Array.from(c.childNodes).forEach((f) => n(f));
|
|
1267
1272
|
const S = c.innerHTML;
|
|
1268
1273
|
if (S) {
|
|
1269
|
-
const f =
|
|
1274
|
+
const f = Kt(
|
|
1270
1275
|
S,
|
|
1271
1276
|
h,
|
|
1272
1277
|
i,
|
|
1273
1278
|
o,
|
|
1274
|
-
|
|
1279
|
+
m,
|
|
1275
1280
|
R,
|
|
1276
1281
|
I,
|
|
1277
1282
|
C,
|
|
1278
1283
|
k,
|
|
1279
|
-
|
|
1284
|
+
w
|
|
1280
1285
|
);
|
|
1281
1286
|
c.innerHTML = f;
|
|
1282
1287
|
}
|
|
1283
1288
|
};
|
|
1284
|
-
|
|
1289
|
+
Ye();
|
|
1285
1290
|
const Ee = (c) => {
|
|
1286
1291
|
c.forEach((l) => {
|
|
1287
1292
|
const x = l.getAttribute("z-slot") || "default", h = t.slots?.[x];
|
|
1288
|
-
let
|
|
1289
|
-
if (Array.isArray(h) ?
|
|
1293
|
+
let w = [];
|
|
1294
|
+
if (Array.isArray(h) ? w = h : h && typeof h == "object" && h.children && (w = h.children || []), w.length === 0) {
|
|
1290
1295
|
if (l.removeAttribute("z-slot"), R) {
|
|
1291
1296
|
l.setAttribute("data-zcode-empty-slot", x), l.setAttribute(
|
|
1292
1297
|
"data-zcode-slot-path",
|
|
@@ -1300,48 +1305,48 @@ function qt(r, t, i, o, d, R = !0, I = [], C = [], k = [], M, re) {
|
|
|
1300
1305
|
l.innerHTML = "";
|
|
1301
1306
|
return;
|
|
1302
1307
|
}
|
|
1303
|
-
const
|
|
1308
|
+
const d = w.map((f, s) => {
|
|
1304
1309
|
const u = i ? `${i}.slots.${x}.${s}` : `slots.${x}.${s}`;
|
|
1305
|
-
return
|
|
1310
|
+
return m(f, u);
|
|
1306
1311
|
}).join("");
|
|
1307
1312
|
l.removeAttribute("z-slot");
|
|
1308
|
-
const S = ie.parseFromString(`<template>${
|
|
1313
|
+
const S = ie.parseFromString(`<template>${d}</template>`, "text/html").querySelector("template");
|
|
1309
1314
|
if (S && S.content)
|
|
1310
1315
|
for (l.innerHTML = ""; S.content.firstChild; )
|
|
1311
1316
|
l.appendChild(S.content.firstChild);
|
|
1312
1317
|
else
|
|
1313
|
-
l.innerHTML =
|
|
1318
|
+
l.innerHTML = d;
|
|
1314
1319
|
});
|
|
1315
1320
|
}, B = Array.from(W.content.querySelectorAll("[z-slot]"));
|
|
1316
1321
|
return Ee(B), W.innerHTML;
|
|
1317
1322
|
}
|
|
1318
|
-
function
|
|
1323
|
+
function Ur(r, t) {
|
|
1319
1324
|
const i = [...t.common, ...t.individual, ...t.special];
|
|
1320
1325
|
for (const o of i) {
|
|
1321
|
-
const
|
|
1322
|
-
if (
|
|
1323
|
-
return
|
|
1326
|
+
const m = o.parts.find((R) => R.id === r);
|
|
1327
|
+
if (m)
|
|
1328
|
+
return m;
|
|
1324
1329
|
}
|
|
1325
1330
|
return null;
|
|
1326
1331
|
}
|
|
1327
|
-
class
|
|
1332
|
+
class je extends Error {
|
|
1328
1333
|
constructor(t, i, o) {
|
|
1329
1334
|
super(o), this.code = t, this.path = i, this.name = "RenderError";
|
|
1330
1335
|
}
|
|
1331
1336
|
}
|
|
1332
|
-
function
|
|
1337
|
+
function Hr(r, t, i, o, m) {
|
|
1333
1338
|
if (i.has(t))
|
|
1334
|
-
throw new
|
|
1339
|
+
throw new je("CIRCULAR_REFERENCE", t, `循環参照が検出されました: ${t}`);
|
|
1335
1340
|
i.add(t);
|
|
1336
1341
|
const R = r.part_id, I = o.findPart(R);
|
|
1337
1342
|
if (!I)
|
|
1338
|
-
throw new
|
|
1339
|
-
const C =
|
|
1343
|
+
throw new je("PART_NOT_FOUND", t, `パーツが見つかりません: ${R}`);
|
|
1344
|
+
const C = Kt(
|
|
1340
1345
|
I.body,
|
|
1341
1346
|
r,
|
|
1342
1347
|
t,
|
|
1343
1348
|
o.findPart,
|
|
1344
|
-
|
|
1349
|
+
m,
|
|
1345
1350
|
o.enableEditorAttributes,
|
|
1346
1351
|
o.imagesCommon,
|
|
1347
1352
|
o.imagesIndividual,
|
|
@@ -1349,7 +1354,7 @@ function Fr(r, t, i, o, d) {
|
|
|
1349
1354
|
o.backendData,
|
|
1350
1355
|
o.options
|
|
1351
1356
|
);
|
|
1352
|
-
return o.enableEditorAttributes ?
|
|
1357
|
+
return o.enableEditorAttributes ? Or(
|
|
1353
1358
|
C,
|
|
1354
1359
|
{
|
|
1355
1360
|
"data-zcode-id": r.id,
|
|
@@ -1359,21 +1364,21 @@ function Fr(r, t, i, o, d) {
|
|
|
1359
1364
|
I.outlinePosition === "inner" ? { addClass: "zcode-outline-inner" } : void 0
|
|
1360
1365
|
) : C;
|
|
1361
1366
|
}
|
|
1362
|
-
const
|
|
1363
|
-
function
|
|
1364
|
-
return r ?
|
|
1367
|
+
const zr = ["common", "individual", "special"];
|
|
1368
|
+
function kr(r) {
|
|
1369
|
+
return r ? zr.filter((t) => r[t]?.trim()).map((t) => {
|
|
1365
1370
|
const i = r[t].replace(/<\/style/gi, "<\\/style");
|
|
1366
1371
|
return `<style id="zcode-css-style-${t}" data-zcode-css="true" data-zcode-css-category="${t}">${i}</style>`;
|
|
1367
1372
|
}).join(`
|
|
1368
1373
|
`) : "";
|
|
1369
1374
|
}
|
|
1370
|
-
function
|
|
1375
|
+
function $r(r, t = {}) {
|
|
1371
1376
|
const { enableEditorAttributes: i = !1 } = t, o = r.backendData;
|
|
1372
1377
|
if (!r)
|
|
1373
|
-
throw new
|
|
1374
|
-
const
|
|
1378
|
+
throw new je("PARSE_ERROR", "", "データが提供されていません");
|
|
1379
|
+
const m = r.parts || { common: [], individual: [], special: [] }, R = r.images || { common: [], individual: [], special: [] }, I = r.page || [];
|
|
1375
1380
|
function C(re) {
|
|
1376
|
-
return
|
|
1381
|
+
return Ur(re, m);
|
|
1377
1382
|
}
|
|
1378
1383
|
const k = {
|
|
1379
1384
|
findPart: C,
|
|
@@ -1383,27 +1388,27 @@ function zr(r, t = {}) {
|
|
|
1383
1388
|
imagesSpecial: R.special,
|
|
1384
1389
|
backendData: o
|
|
1385
1390
|
};
|
|
1386
|
-
function
|
|
1387
|
-
return
|
|
1391
|
+
function P(re, ne, ie) {
|
|
1392
|
+
return Hr(
|
|
1388
1393
|
re,
|
|
1389
1394
|
ne,
|
|
1390
1395
|
ie,
|
|
1391
1396
|
k,
|
|
1392
|
-
(
|
|
1397
|
+
(v, W) => P(v, W, ie)
|
|
1393
1398
|
);
|
|
1394
1399
|
}
|
|
1395
1400
|
return I.map((re, ne) => {
|
|
1396
1401
|
try {
|
|
1397
|
-
return
|
|
1402
|
+
return P(re, `page.${ne}`, /* @__PURE__ */ new Set());
|
|
1398
1403
|
} catch (ie) {
|
|
1399
|
-
if (ie instanceof
|
|
1404
|
+
if (ie instanceof je)
|
|
1400
1405
|
return `<div class="zcode-error-message" data-error-code="${ie.code}">${ie.message}</div>`;
|
|
1401
1406
|
throw ie;
|
|
1402
1407
|
}
|
|
1403
1408
|
}).join("");
|
|
1404
1409
|
}
|
|
1405
1410
|
export {
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1411
|
+
je as RenderError,
|
|
1412
|
+
kr as renderCssToHtml,
|
|
1413
|
+
$r as renderToHtml
|
|
1409
1414
|
};
|