zerocodejs 1.0.1-beta.2 → 1.0.1-beta.20

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.
Files changed (131) hide show
  1. package/README.ja.md +199 -0
  2. package/README.md +128 -102
  3. package/dist/components/ZeroCodeCMS.vue.d.ts +7 -0
  4. package/dist/components/ZeroCodeCMS.vue.d.ts.map +1 -1
  5. package/dist/components/ZeroCodeEditor.vue.d.ts +60 -1
  6. package/dist/components/ZeroCodeEditor.vue.d.ts.map +1 -1
  7. package/dist/components/ZeroCodeStudio.vue.d.ts +398 -0
  8. package/dist/components/ZeroCodeStudio.vue.d.ts.map +1 -0
  9. package/dist/core/composables/useZeroCodeData.d.ts +3 -0
  10. package/dist/core/composables/useZeroCodeData.d.ts.map +1 -1
  11. package/dist/core/composables/useZeroCodeRenderer.d.ts.map +1 -1
  12. package/dist/core/renderer/renderer.d.ts +30 -1
  13. package/dist/core/renderer/renderer.d.ts.map +1 -1
  14. package/dist/core/utils/css-manager.d.ts.map +1 -1
  15. package/dist/core/utils/dom-utils.d.ts +3 -0
  16. package/dist/core/utils/dom-utils.d.ts.map +1 -1
  17. package/dist/core/utils/edit-panel-fields.d.ts +17 -0
  18. package/dist/core/utils/edit-panel-fields.d.ts.map +1 -0
  19. package/dist/core/utils/field-extractor.d.ts.map +1 -1
  20. package/dist/core/utils/i18n-setup.d.ts.map +1 -1
  21. package/dist/core/utils/image-utils.d.ts.map +1 -1
  22. package/dist/core/utils/logger.d.ts +5 -0
  23. package/dist/core/utils/logger.d.ts.map +1 -0
  24. package/dist/core/utils/path-utils.d.ts +5 -1
  25. package/dist/core/utils/path-utils.d.ts.map +1 -1
  26. package/dist/core/utils/sanitize.d.ts +6 -0
  27. package/dist/core/utils/sanitize.d.ts.map +1 -1
  28. package/dist/core/utils/storage.d.ts +0 -1
  29. package/dist/core/utils/storage.d.ts.map +1 -1
  30. package/dist/core/utils/template-processor.d.ts +6 -1
  31. package/dist/core/utils/template-processor.d.ts.map +1 -1
  32. package/dist/core/utils/template-regex.d.ts +0 -1
  33. package/dist/core/utils/template-regex.d.ts.map +1 -1
  34. package/dist/core/utils/template-utils.d.ts +3 -1
  35. package/dist/core/utils/template-utils.d.ts.map +1 -1
  36. package/dist/features/add/components/AddPanel.vue.d.ts.map +1 -1
  37. package/dist/features/add/composables/useAddMode.d.ts +7 -1
  38. package/dist/features/add/composables/useAddMode.d.ts.map +1 -1
  39. package/dist/features/data-viewer/components/DataViewer.vue.d.ts +1 -0
  40. package/dist/features/data-viewer/components/DataViewer.vue.d.ts.map +1 -1
  41. package/dist/features/delete/components/DeletePanel.vue.d.ts.map +1 -1
  42. package/dist/features/delete/composables/useDeleteMode.d.ts.map +1 -1
  43. package/dist/features/editor/components/ContextMenu.vue.d.ts.map +1 -1
  44. package/dist/features/editor/components/EditPanel.vue.d.ts +1 -4
  45. package/dist/features/editor/components/EditPanel.vue.d.ts.map +1 -1
  46. package/dist/features/editor/components/ImageSelectModal.vue.d.ts +1 -7
  47. package/dist/features/editor/components/ImageSelectModal.vue.d.ts.map +1 -1
  48. package/dist/features/editor/components/RichTextEditor.vue.d.ts.map +1 -1
  49. package/dist/features/editor/components/SettingsPanel.vue.d.ts.map +1 -1
  50. package/dist/features/editor/components/Toolbar.vue.d.ts.map +1 -1
  51. package/dist/features/editor/composables/useClickHandlers.d.ts.map +1 -1
  52. package/dist/features/editor/composables/useEditMode.d.ts +4 -16
  53. package/dist/features/editor/composables/useEditMode.d.ts.map +1 -1
  54. package/dist/features/editor/composables/useOutlineManager.d.ts.map +1 -1
  55. package/dist/features/images-manager/components/ImagesManagerPanel.vue.d.ts +2 -0
  56. package/dist/features/images-manager/components/ImagesManagerPanel.vue.d.ts.map +1 -1
  57. package/dist/features/parts-manager/components/MonacoEditor.vue.d.ts +3 -1
  58. package/dist/features/parts-manager/components/MonacoEditor.vue.d.ts.map +1 -1
  59. package/dist/features/parts-manager/components/PartsManagerPanel.vue.d.ts +44 -1
  60. package/dist/features/parts-manager/components/PartsManagerPanel.vue.d.ts.map +1 -1
  61. package/dist/features/parts-manager/composables/usePartsManager.d.ts +15 -1
  62. package/dist/features/parts-manager/composables/usePartsManager.d.ts.map +1 -1
  63. package/dist/features/preview/PreviewArea.vue.d.ts.map +1 -1
  64. package/dist/features/reorder/components/ReorderPanel.vue.d.ts.map +1 -1
  65. package/dist/features/reorder/composables/useReorderMode.d.ts +3 -1
  66. package/dist/features/reorder/composables/useReorderMode.d.ts.map +1 -1
  67. package/dist/i18n/index.d.ts +36 -2
  68. package/dist/i18n/index.d.ts.map +1 -1
  69. package/dist/i18n/locales/en.d.ts +18 -1
  70. package/dist/i18n/locales/en.d.ts.map +1 -1
  71. package/dist/i18n/locales/ja.d.ts +18 -1
  72. package/dist/i18n/locales/ja.d.ts.map +1 -1
  73. package/dist/index.d.ts +3 -1
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/ssr-entry.d.ts +6 -0
  76. package/dist/ssr-entry.d.ts.map +1 -0
  77. package/dist/types/index.d.ts +7 -5
  78. package/dist/types/index.d.ts.map +1 -1
  79. package/dist/web-components/zcode-cms.d.ts.map +1 -1
  80. package/dist/web-components/zcode-editor.d.ts.map +1 -1
  81. package/dist/web-components/zcode-studio.d.ts +28 -0
  82. package/dist/web-components/zcode-studio.d.ts.map +1 -0
  83. package/dist/zerocode-ssr.es.js +1409 -0
  84. package/dist/zerocode.es.js +15764 -15347
  85. package/dist/zerocode.umd.js +68 -72
  86. package/dist/zerocodejs.css +1 -1
  87. package/package.json +27 -7
  88. package/dist/__tests__/fixtures/sample-data.d.ts +0 -23
  89. package/dist/__tests__/fixtures/sample-data.d.ts.map +0 -1
  90. package/dist/__tests__/fixtures/sample-templates.d.ts +0 -25
  91. package/dist/__tests__/fixtures/sample-templates.d.ts.map +0 -1
  92. package/dist/core/utils/component-initializer.test.d.ts +0 -2
  93. package/dist/core/utils/component-initializer.test.d.ts.map +0 -1
  94. package/dist/core/utils/field-extractor.test.d.ts +0 -2
  95. package/dist/core/utils/field-extractor.test.d.ts.map +0 -1
  96. package/dist/core/utils/image-utils.test.d.ts +0 -2
  97. package/dist/core/utils/image-utils.test.d.ts.map +0 -1
  98. package/dist/core/utils/path-utils.test.d.ts +0 -2
  99. package/dist/core/utils/path-utils.test.d.ts.map +0 -1
  100. package/dist/core/utils/storage.test.d.ts +0 -2
  101. package/dist/core/utils/storage.test.d.ts.map +0 -1
  102. package/dist/core/utils/template-processor.test.d.ts +0 -2
  103. package/dist/core/utils/template-processor.test.d.ts.map +0 -1
  104. package/dist/core/utils/template-utils.test.d.ts +0 -2
  105. package/dist/core/utils/template-utils.test.d.ts.map +0 -1
  106. package/dist/core/utils/validation.test.d.ts +0 -2
  107. package/dist/core/utils/validation.test.d.ts.map +0 -1
  108. package/dist/css/common.css +0 -677
  109. package/dist/css/docs.css +0 -396
  110. package/dist/css/index.css +0 -1039
  111. package/dist/css/page.css +0 -290
  112. package/dist/css/sample.css +0 -26
  113. package/dist/css/site-common.css +0 -218
  114. package/dist/footer.html +0 -10
  115. package/dist/header.html +0 -10
  116. package/dist/images/customer-avatar.jpg +0 -0
  117. package/dist/images/default-avatar.jpg +0 -0
  118. package/dist/images/default.jpg +0 -0
  119. package/dist/images/hero-bg.jpg +0 -0
  120. package/dist/images/kv_image.jpg +0 -0
  121. package/dist/images/page-specific-hero.jpg +0 -0
  122. package/dist/images/sample-1.jpg +0 -0
  123. package/dist/images/sample-2.jpg +0 -0
  124. package/dist/images/sample-3.jpg +0 -0
  125. package/dist/images/zcode_top_01.png +0 -0
  126. package/dist/js/accordion.js +0 -24
  127. package/dist/js/common.js +0 -1093
  128. package/dist/web-component.d.ts +0 -14
  129. package/dist/web-component.d.ts.map +0 -1
  130. package/dist/zerocode.es.js.map +0 -1
  131. package/dist/zerocode.umd.js.map +0 -1
@@ -0,0 +1,1409 @@
1
+ const vt = "[ZeroCode]", me = {
2
+ warn(r, ...t) {
3
+ console.warn(`${vt} ${r}`, ...t);
4
+ },
5
+ error(r, ...t) {
6
+ console.error(`${vt} ${r}`, ...t);
7
+ }
8
+ }, ot = 1, at = 3;
9
+ function Bt() {
10
+ if (typeof window < "u" && typeof DOMParser < "u")
11
+ return DOMParser;
12
+ if (typeof require < "u")
13
+ try {
14
+ const { JSDOM: r } = require("jsdom");
15
+ return new r().window.DOMParser;
16
+ } catch {
17
+ throw new Error(
18
+ "jsdom is required for server-side rendering. Please install it: npm install jsdom"
19
+ );
20
+ }
21
+ if (typeof DOMParser < "u")
22
+ return DOMParser;
23
+ throw new Error("DOMParser is not available in this environment");
24
+ }
25
+ const {
26
+ entries: Vt,
27
+ setPrototypeOf: Mt,
28
+ isFrozen: ir,
29
+ getPrototypeOf: or,
30
+ getOwnPropertyDescriptor: ar
31
+ } = Object;
32
+ let {
33
+ freeze: J,
34
+ seal: oe,
35
+ create: dt
36
+ } = Object, {
37
+ apply: mt,
38
+ construct: gt
39
+ } = typeof Reflect < "u" && Reflect;
40
+ J || (J = function(t) {
41
+ return t;
42
+ });
43
+ oe || (oe = function(t) {
44
+ return t;
45
+ });
46
+ mt || (mt = function(t, i) {
47
+ for (var o = arguments.length, d = new Array(o > 2 ? o - 2 : 0), R = 2; R < o; R++)
48
+ d[R - 2] = arguments[R];
49
+ return t.apply(i, d);
50
+ });
51
+ gt || (gt = function(t) {
52
+ for (var i = arguments.length, o = new Array(i > 1 ? i - 1 : 0), d = 1; d < i; d++)
53
+ o[d - 1] = arguments[d];
54
+ return new t(...o);
55
+ });
56
+ const Ge = Q(Array.prototype.forEach), sr = Q(Array.prototype.lastIndexOf), Pt = Q(Array.prototype.pop), Oe = Q(Array.prototype.push), lr = Q(Array.prototype.splice), Ve = Q(String.prototype.toLowerCase), st = Q(String.prototype.toString), lt = Q(String.prototype.match), xe = Q(String.prototype.replace), cr = Q(String.prototype.indexOf), ur = Q(String.prototype.trim), ae = Q(Object.prototype.hasOwnProperty), K = Q(RegExp.prototype.test), Ne = fr(TypeError);
57
+ function Q(r) {
58
+ return function(t) {
59
+ t instanceof RegExp && (t.lastIndex = 0);
60
+ for (var i = arguments.length, o = new Array(i > 1 ? i - 1 : 0), d = 1; d < i; d++)
61
+ o[d - 1] = arguments[d];
62
+ return mt(r, t, o);
63
+ };
64
+ }
65
+ function fr(r) {
66
+ return function() {
67
+ for (var t = arguments.length, i = new Array(t), o = 0; o < t; o++)
68
+ i[o] = arguments[o];
69
+ return gt(r, i);
70
+ };
71
+ }
72
+ function w(r, t) {
73
+ let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Ve;
74
+ Mt && Mt(r, null);
75
+ let o = t.length;
76
+ for (; o--; ) {
77
+ let d = t[o];
78
+ if (typeof d == "string") {
79
+ const R = i(d);
80
+ R !== d && (ir(t) || (t[o] = R), d = R);
81
+ }
82
+ r[d] = !0;
83
+ }
84
+ return r;
85
+ }
86
+ function pr(r) {
87
+ for (let t = 0; t < r.length; t++)
88
+ ae(r, t) || (r[t] = null);
89
+ return r;
90
+ }
91
+ function ce(r) {
92
+ const t = dt(null);
93
+ for (const [i, o] of Vt(r))
94
+ ae(r, i) && (Array.isArray(o) ? t[i] = pr(o) : o && typeof o == "object" && o.constructor === Object ? t[i] = ce(o) : t[i] = o);
95
+ return t;
96
+ }
97
+ function Ce(r, t) {
98
+ for (; r !== null; ) {
99
+ const o = ar(r, t);
100
+ if (o) {
101
+ if (o.get)
102
+ return Q(o.get);
103
+ if (typeof o.value == "function")
104
+ return Q(o.value);
105
+ }
106
+ r = or(r);
107
+ }
108
+ function i() {
109
+ return null;
110
+ }
111
+ return i;
112
+ }
113
+ const Ft = 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"]), ct = 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"]), ut = 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"]), dr = 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"]), ft = 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"]), mr = J(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Ut = J(["#text"]), Ht = 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"]), pt = 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"]), zt = 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"]), We = J(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), gr = oe(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Tr = oe(/<%[\w\W]*|[\w\W]*%>/gm), hr = oe(/\$\{[\w\W]*/gm), Er = oe(/^data-[\-\w.\u00B7-\uFFFF]+$/), _r = oe(/^aria-[\-\w]+$/), Xt = oe(
114
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
115
+ // eslint-disable-line no-useless-escape
116
+ ), Ar = oe(/^(?:\w+script|data):/i), yr = oe(
117
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
118
+ // eslint-disable-line no-control-regex
119
+ ), jt = oe(/^html$/i), Sr = oe(/^[a-z][.\w]*(-[.\w]+)+$/i);
120
+ var kt = /* @__PURE__ */ Object.freeze({
121
+ __proto__: null,
122
+ ARIA_ATTR: _r,
123
+ ATTR_WHITESPACE: yr,
124
+ CUSTOM_ELEMENT: Sr,
125
+ DATA_ATTR: Er,
126
+ DOCTYPE_NAME: jt,
127
+ ERB_EXPR: Tr,
128
+ IS_ALLOWED_URI: Xt,
129
+ IS_SCRIPT_OR_DATA: Ar,
130
+ MUSTACHE_EXPR: gr,
131
+ TMPLIT_EXPR: hr
132
+ });
133
+ const ve = {
134
+ element: 1,
135
+ text: 3,
136
+ // Deprecated
137
+ progressingInstruction: 7,
138
+ comment: 8,
139
+ document: 9
140
+ }, Rr = function() {
141
+ return typeof window > "u" ? null : window;
142
+ }, Ir = function(t, i) {
143
+ if (typeof t != "object" || typeof t.createPolicy != "function")
144
+ return null;
145
+ let o = null;
146
+ const d = "data-tt-policy-suffix";
147
+ i && i.hasAttribute(d) && (o = i.getAttribute(d));
148
+ const R = "dompurify" + (o ? "#" + o : "");
149
+ try {
150
+ return t.createPolicy(R, {
151
+ createHTML(I) {
152
+ return I;
153
+ },
154
+ createScriptURL(I) {
155
+ return I;
156
+ }
157
+ });
158
+ } catch {
159
+ return console.warn("TrustedTypes policy " + R + " could not be created."), null;
160
+ }
161
+ }, $t = function() {
162
+ return {
163
+ afterSanitizeAttributes: [],
164
+ afterSanitizeElements: [],
165
+ afterSanitizeShadowDOM: [],
166
+ beforeSanitizeAttributes: [],
167
+ beforeSanitizeElements: [],
168
+ beforeSanitizeShadowDOM: [],
169
+ uponSanitizeAttribute: [],
170
+ uponSanitizeElement: [],
171
+ uponSanitizeShadowNode: []
172
+ };
173
+ };
174
+ function Yt() {
175
+ let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Rr();
176
+ const t = (A) => Yt(A);
177
+ if (t.version = "3.3.1", t.removed = [], !r || !r.document || r.document.nodeType !== ve.document || !r.Element)
178
+ return t.isSupported = !1, t;
179
+ let {
180
+ document: i
181
+ } = r;
182
+ const o = i, d = o.currentScript, {
183
+ DocumentFragment: R,
184
+ HTMLTemplateElement: I,
185
+ Node: C,
186
+ Element: k,
187
+ NodeFilter: M,
188
+ NamedNodeMap: re = r.NamedNodeMap || r.MozNamedAttrMap,
189
+ HTMLFormElement: ne,
190
+ DOMParser: ie,
191
+ trustedTypes: P
192
+ } = r, W = k.prototype, he = Ce(W, "cloneNode"), Me = Ce(W, "remove"), je = Ce(W, "nextSibling"), Ye = Ce(W, "childNodes"), Ee = Ce(W, "parentNode");
193
+ if (typeof I == "function") {
194
+ const A = i.createElement("template");
195
+ A.content && A.content.ownerDocument && (i = A.content.ownerDocument);
196
+ }
197
+ let B, c = "";
198
+ const {
199
+ implementation: l,
200
+ createNodeIterator: x,
201
+ createDocumentFragment: h,
202
+ getElementsByTagName: L
203
+ } = i, {
204
+ importNode: m
205
+ } = o;
206
+ let n = $t();
207
+ t.isSupported = typeof Vt == "function" && typeof Ee == "function" && l && l.createHTMLDocument !== void 0;
208
+ const {
209
+ MUSTACHE_EXPR: S,
210
+ ERB_EXPR: f,
211
+ TMPLIT_EXPR: s,
212
+ DATA_ATTR: u,
213
+ ARIA_ATTR: p,
214
+ IS_SCRIPT_OR_DATA: g,
215
+ ATTR_WHITESPACE: b,
216
+ CUSTOM_ELEMENT: y
217
+ } = kt;
218
+ let {
219
+ IS_ALLOWED_URI: D
220
+ } = kt, E = null;
221
+ const O = w({}, [...Ft, ...ct, ...ut, ...ft, ...Ut]);
222
+ let _ = null;
223
+ const F = w({}, [...Ht, ...pt, ...zt, ...We]);
224
+ let N = Object.seal(dt(null, {
225
+ tagNameCheck: {
226
+ writable: !0,
227
+ configurable: !1,
228
+ enumerable: !0,
229
+ value: null
230
+ },
231
+ attributeNameCheck: {
232
+ writable: !0,
233
+ configurable: !1,
234
+ enumerable: !0,
235
+ value: null
236
+ },
237
+ allowCustomizedBuiltInElements: {
238
+ writable: !0,
239
+ configurable: !1,
240
+ enumerable: !0,
241
+ value: !1
242
+ }
243
+ })), V = null, Y = null;
244
+ const H = Object.seal(dt(null, {
245
+ tagCheck: {
246
+ writable: !0,
247
+ configurable: !1,
248
+ enumerable: !0,
249
+ value: null
250
+ },
251
+ attributeCheck: {
252
+ writable: !0,
253
+ configurable: !1,
254
+ enumerable: !0,
255
+ value: null
256
+ }
257
+ }));
258
+ let q = !0, de = !0, Le = !1, be = !0, _e = !1, Pe = !0, ge = !1, qe = !1, Ke = !1, Ae = !1, Fe = !1, Ue = !1, Tt = !0, ht = !1;
259
+ const Kt = "user-content-";
260
+ let Ze = !0, we = !1, ye = {}, se = null;
261
+ const Je = w({}, ["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"]);
262
+ let Et = null;
263
+ const _t = w({}, ["audio", "video", "img", "source", "image", "track"]);
264
+ let Qe = null;
265
+ const At = w({}, ["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";
266
+ let Se = ue, et = !1, tt = null;
267
+ const Zt = w({}, [He, ze, ue], st);
268
+ let ke = w({}, ["mi", "mo", "mn", "ms", "mtext"]), $e = w({}, ["annotation-xml"]);
269
+ const Jt = w({}, ["title", "style", "font", "a", "script"]);
270
+ let De = null;
271
+ const Qt = ["application/xhtml+xml", "text/html"], er = "text/html";
272
+ let $ = null, Re = null;
273
+ const tr = i.createElement("form"), yt = function(e) {
274
+ return e instanceof RegExp || e instanceof Function;
275
+ }, rt = function() {
276
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
277
+ if (!(Re && Re === e)) {
278
+ if ((!e || typeof e != "object") && (e = {}), e = ce(e), De = // eslint-disable-next-line unicorn/prefer-includes
279
+ Qt.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? er : e.PARSER_MEDIA_TYPE, $ = De === "application/xhtml+xml" ? st : Ve, E = ae(e, "ALLOWED_TAGS") ? w({}, e.ALLOWED_TAGS, $) : O, _ = ae(e, "ALLOWED_ATTR") ? w({}, e.ALLOWED_ATTR, $) : F, tt = ae(e, "ALLOWED_NAMESPACES") ? w({}, e.ALLOWED_NAMESPACES, st) : Zt, Qe = ae(e, "ADD_URI_SAFE_ATTR") ? w(ce(At), e.ADD_URI_SAFE_ATTR, $) : At, Et = ae(e, "ADD_DATA_URI_TAGS") ? w(ce(_t), e.ADD_DATA_URI_TAGS, $) : _t, se = ae(e, "FORBID_CONTENTS") ? w({}, e.FORBID_CONTENTS, $) : Je, V = ae(e, "FORBID_TAGS") ? w({}, e.FORBID_TAGS, $) : ce({}), Y = ae(e, "FORBID_ATTR") ? w({}, e.FORBID_ATTR, $) : ce({}), ye = ae(e, "USE_PROFILES") ? e.USE_PROFILES : !1, q = e.ALLOW_ARIA_ATTR !== !1, de = e.ALLOW_DATA_ATTR !== !1, Le = e.ALLOW_UNKNOWN_PROTOCOLS || !1, be = 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, Ke = e.FORCE_BODY || !1, Tt = e.SANITIZE_DOM !== !1, ht = e.SANITIZE_NAMED_PROPS || !1, Ze = e.KEEP_CONTENT !== !1, we = e.IN_PLACE || !1, D = e.ALLOWED_URI_REGEXP || Xt, 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 && yt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (N.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && yt(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 && (de = !1), Fe && (Ae = !0), ye && (E = w({}, Ut), _ = [], ye.html === !0 && (w(E, Ft), w(_, Ht)), ye.svg === !0 && (w(E, ct), w(_, pt), w(_, We)), ye.svgFilters === !0 && (w(E, ut), w(_, pt), w(_, We)), ye.mathMl === !0 && (w(E, ft), w(_, zt), w(_, We))), e.ADD_TAGS && (typeof e.ADD_TAGS == "function" ? H.tagCheck = e.ADD_TAGS : (E === O && (E = ce(E)), w(E, e.ADD_TAGS, $))), e.ADD_ATTR && (typeof e.ADD_ATTR == "function" ? H.attributeCheck = e.ADD_ATTR : (_ === F && (_ = ce(_)), w(_, e.ADD_ATTR, $))), e.ADD_URI_SAFE_ATTR && w(Qe, e.ADD_URI_SAFE_ATTR, $), e.FORBID_CONTENTS && (se === Je && (se = ce(se)), w(se, e.FORBID_CONTENTS, $)), e.ADD_FORBID_CONTENTS && (se === Je && (se = ce(se)), w(se, e.ADD_FORBID_CONTENTS, $)), Ze && (E["#text"] = !0), ge && w(E, ["html", "head", "body"]), E.table && (w(E, ["tbody"]), delete V.tbody), e.TRUSTED_TYPES_POLICY) {
280
+ if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function")
281
+ throw Ne('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
282
+ if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function")
283
+ throw Ne('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
284
+ B = e.TRUSTED_TYPES_POLICY, c = B.createHTML("");
285
+ } else
286
+ B === void 0 && (B = Ir(P, d)), B !== null && typeof c == "string" && (c = B.createHTML(""));
287
+ J && J(e), Re = e;
288
+ }
289
+ }, St = w({}, [...ct, ...ut, ...dr]), Rt = w({}, [...ft, ...mr]), rr = function(e) {
290
+ let a = Ee(e);
291
+ (!a || !a.tagName) && (a = {
292
+ namespaceURI: Se,
293
+ tagName: "template"
294
+ });
295
+ const T = Ve(e.tagName), U = Ve(a.tagName);
296
+ return tt[e.namespaceURI] ? e.namespaceURI === ze ? a.namespaceURI === ue ? T === "svg" : a.namespaceURI === He ? T === "svg" && (U === "annotation-xml" || ke[U]) : !!St[T] : e.namespaceURI === He ? a.namespaceURI === ue ? T === "math" : a.namespaceURI === ze ? T === "math" && $e[U] : !!Rt[T] : e.namespaceURI === ue ? a.namespaceURI === ze && !$e[U] || a.namespaceURI === He && !ke[U] ? !1 : !Rt[T] && (Jt[T] || !St[T]) : !!(De === "application/xhtml+xml" && tt[e.namespaceURI]) : !1;
297
+ }, le = function(e) {
298
+ Oe(t.removed, {
299
+ element: e
300
+ });
301
+ try {
302
+ Ee(e).removeChild(e);
303
+ } catch {
304
+ Me(e);
305
+ }
306
+ }, Te = function(e, a) {
307
+ try {
308
+ Oe(t.removed, {
309
+ attribute: a.getAttributeNode(e),
310
+ from: a
311
+ });
312
+ } catch {
313
+ Oe(t.removed, {
314
+ attribute: null,
315
+ from: a
316
+ });
317
+ }
318
+ if (a.removeAttribute(e), e === "is")
319
+ if (Ae || Fe)
320
+ try {
321
+ le(a);
322
+ } catch {
323
+ }
324
+ else
325
+ try {
326
+ a.setAttribute(e, "");
327
+ } catch {
328
+ }
329
+ }, It = function(e) {
330
+ let a = null, T = null;
331
+ if (Ke)
332
+ e = "<remove></remove>" + e;
333
+ else {
334
+ const z = lt(e, /^[\r\n\t ]+/);
335
+ T = z && z[0];
336
+ }
337
+ De === "application/xhtml+xml" && Se === ue && (e = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + e + "</body></html>");
338
+ const U = B ? B.createHTML(e) : e;
339
+ if (Se === ue)
340
+ try {
341
+ a = new ie().parseFromString(U, De);
342
+ } catch {
343
+ }
344
+ if (!a || !a.documentElement) {
345
+ a = l.createDocument(Se, "template", null);
346
+ try {
347
+ a.documentElement.innerHTML = et ? c : U;
348
+ } catch {
349
+ }
350
+ }
351
+ const j = a.body || a.documentElement;
352
+ return e && T && j.insertBefore(i.createTextNode(T), j.childNodes[0] || null), Se === ue ? L.call(a, ge ? "html" : "body")[0] : ge ? a.documentElement : j;
353
+ }, Lt = function(e) {
354
+ return x.call(
355
+ e.ownerDocument || e,
356
+ e,
357
+ // eslint-disable-next-line no-bitwise
358
+ M.SHOW_ELEMENT | M.SHOW_COMMENT | M.SHOW_TEXT | M.SHOW_PROCESSING_INSTRUCTION | M.SHOW_CDATA_SECTION,
359
+ null
360
+ );
361
+ }, nt = function(e) {
362
+ 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
+ }, bt = function(e) {
364
+ return typeof C == "function" && e instanceof C;
365
+ };
366
+ function fe(A, e, a) {
367
+ Ge(A, (T) => {
368
+ T.call(t, e, a, Re);
369
+ });
370
+ }
371
+ const wt = function(e) {
372
+ let a = null;
373
+ if (fe(n.beforeSanitizeElements, e, null), nt(e))
374
+ return le(e), !0;
375
+ const T = $(e.nodeName);
376
+ if (fe(n.uponSanitizeElement, e, {
377
+ tagName: T,
378
+ allowedTags: E
379
+ }), Pe && e.hasChildNodes() && !bt(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
+ return le(e), !0;
381
+ if (!(H.tagCheck instanceof Function && H.tagCheck(T)) && (!E[T] || V[T])) {
382
+ if (!V[T] && Ot(T) && (N.tagNameCheck instanceof RegExp && K(N.tagNameCheck, T) || N.tagNameCheck instanceof Function && N.tagNameCheck(T)))
383
+ return !1;
384
+ if (Ze && !se[T]) {
385
+ const U = Ee(e) || e.parentNode, j = Ye(e) || e.childNodes;
386
+ if (j && U) {
387
+ const z = j.length;
388
+ for (let ee = z - 1; ee >= 0; --ee) {
389
+ const pe = he(j[ee], !0);
390
+ pe.__removalCount = (e.__removalCount || 0) + 1, U.insertBefore(pe, je(e));
391
+ }
392
+ }
393
+ }
394
+ return le(e), !0;
395
+ }
396
+ return e instanceof k && !rr(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, Ge([S, f, s], (U) => {
397
+ a = xe(a, U, " ");
398
+ }), e.textContent !== a && (Oe(t.removed, {
399
+ element: e.cloneNode()
400
+ }), e.textContent = a)), fe(n.afterSanitizeElements, e, null), !1);
401
+ }, Dt = function(e, a, T) {
402
+ if (Tt && (a === "id" || a === "name") && (T in i || T in tr))
403
+ return !1;
404
+ if (!(de && !Y[a] && K(u, a))) {
405
+ if (!(q && K(p, a))) {
406
+ if (!(H.attributeCheck instanceof Function && H.attributeCheck(a, e))) {
407
+ if (!_[a] || Y[a]) {
408
+ if (
409
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
410
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
411
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
412
+ !(Ot(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
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
414
+ a === "is" && N.allowCustomizedBuiltInElements && (N.tagNameCheck instanceof RegExp && K(N.tagNameCheck, T) || N.tagNameCheck instanceof Function && N.tagNameCheck(T)))
415
+ ) return !1;
416
+ } else if (!Qe[a]) {
417
+ if (!K(D, xe(T, b, ""))) {
418
+ if (!((a === "src" || a === "xlink:href" || a === "href") && e !== "script" && cr(T, "data:") === 0 && Et[e])) {
419
+ if (!(Le && !K(g, xe(T, b, "")))) {
420
+ if (T)
421
+ return !1;
422
+ }
423
+ }
424
+ }
425
+ }
426
+ }
427
+ }
428
+ }
429
+ return !0;
430
+ }, Ot = function(e) {
431
+ return e !== "annotation-xml" && lt(e, y);
432
+ }, xt = function(e) {
433
+ fe(n.beforeSanitizeAttributes, e, null);
434
+ const {
435
+ attributes: a
436
+ } = e;
437
+ if (!a || nt(e))
438
+ return;
439
+ const T = {
440
+ attrName: "",
441
+ attrValue: "",
442
+ keepAttr: !0,
443
+ allowedAttributes: _,
444
+ forceKeepAttr: void 0
445
+ };
446
+ let U = a.length;
447
+ for (; U--; ) {
448
+ const j = a[U], {
449
+ name: z,
450
+ namespaceURI: ee,
451
+ value: pe
452
+ } = j, Ie = $(z), it = pe;
453
+ let X = z === "value" ? it : ur(it);
454
+ if (T.attrName = Ie, T.attrValue = X, T.keepAttr = !0, T.forceKeepAttr = void 0, fe(n.uponSanitizeAttribute, e, T), X = T.attrValue, ht && (Ie === "id" || Ie === "name") && (Te(z, e), X = Kt + X), Pe && K(/((--!?|])>)|<\/(style|title|textarea)/i, X)) {
455
+ Te(z, e);
456
+ continue;
457
+ }
458
+ if (Ie === "attributename" && lt(X, "href")) {
459
+ Te(z, e);
460
+ continue;
461
+ }
462
+ if (T.forceKeepAttr)
463
+ continue;
464
+ if (!T.keepAttr) {
465
+ Te(z, e);
466
+ continue;
467
+ }
468
+ if (!be && K(/\/>/i, X)) {
469
+ Te(z, e);
470
+ continue;
471
+ }
472
+ _e && Ge([S, f, s], (Ct) => {
473
+ X = xe(X, Ct, " ");
474
+ });
475
+ const Nt = $(e.nodeName);
476
+ if (!Dt(Nt, Ie, X)) {
477
+ Te(z, e);
478
+ continue;
479
+ }
480
+ if (B && typeof P == "object" && typeof P.getAttributeType == "function" && !ee)
481
+ switch (P.getAttributeType(Nt, Ie)) {
482
+ case "TrustedHTML": {
483
+ X = B.createHTML(X);
484
+ break;
485
+ }
486
+ case "TrustedScriptURL": {
487
+ X = B.createScriptURL(X);
488
+ break;
489
+ }
490
+ }
491
+ if (X !== it)
492
+ try {
493
+ ee ? e.setAttributeNS(ee, z, X) : e.setAttribute(z, X), nt(e) ? le(e) : Pt(t.removed);
494
+ } catch {
495
+ Te(z, e);
496
+ }
497
+ }
498
+ fe(n.afterSanitizeAttributes, e, null);
499
+ }, nr = function A(e) {
500
+ let a = null;
501
+ const T = Lt(e);
502
+ for (fe(n.beforeSanitizeShadowDOM, e, null); a = T.nextNode(); )
503
+ fe(n.uponSanitizeShadowNode, a, null), wt(a), xt(a), a.content instanceof R && A(a.content);
504
+ fe(n.afterSanitizeShadowDOM, e, null);
505
+ };
506
+ return t.sanitize = function(A) {
507
+ let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = null, T = null, U = null, j = null;
508
+ if (et = !A, et && (A = "<!-->"), typeof A != "string" && !bt(A))
509
+ if (typeof A.toString == "function") {
510
+ if (A = A.toString(), typeof A != "string")
511
+ throw Ne("dirty is not a string, aborting");
512
+ } else
513
+ throw Ne("toString is not a function");
514
+ if (!t.isSupported)
515
+ return A;
516
+ if (qe || rt(e), t.removed = [], typeof A == "string" && (we = !1), we) {
517
+ if (A.nodeName) {
518
+ const pe = $(A.nodeName);
519
+ if (!E[pe] || V[pe])
520
+ throw Ne("root node is forbidden and cannot be sanitized in-place");
521
+ }
522
+ } else if (A instanceof C)
523
+ a = It("<!---->"), T = a.ownerDocument.importNode(A, !0), T.nodeType === ve.element && T.nodeName === "BODY" || T.nodeName === "HTML" ? a = T : a.appendChild(T);
524
+ else {
525
+ if (!Ae && !_e && !ge && // eslint-disable-next-line unicorn/prefer-includes
526
+ A.indexOf("<") === -1)
527
+ return B && Ue ? B.createHTML(A) : A;
528
+ if (a = It(A), !a)
529
+ return Ae ? null : Ue ? c : "";
530
+ }
531
+ a && Ke && le(a.firstChild);
532
+ const z = Lt(we ? A : a);
533
+ for (; U = z.nextNode(); )
534
+ wt(U), xt(U), U.content instanceof R && nr(U.content);
535
+ if (we)
536
+ return A;
537
+ if (Ae) {
538
+ if (Fe)
539
+ for (j = h.call(a.ownerDocument); a.firstChild; )
540
+ j.appendChild(a.firstChild);
541
+ else
542
+ j = a;
543
+ return (_.shadowroot || _.shadowrootmode) && (j = m.call(o, j, !0)), j;
544
+ }
545
+ let ee = ge ? a.outerHTML : a.innerHTML;
546
+ return ge && E["!doctype"] && a.ownerDocument && a.ownerDocument.doctype && a.ownerDocument.doctype.name && K(jt, a.ownerDocument.doctype.name) && (ee = "<!DOCTYPE " + a.ownerDocument.doctype.name + `>
547
+ ` + ee), _e && Ge([S, f, s], (pe) => {
548
+ ee = xe(ee, pe, " ");
549
+ }), B && Ue ? B.createHTML(ee) : ee;
550
+ }, t.setConfig = function() {
551
+ let A = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
552
+ rt(A), qe = !0;
553
+ }, t.clearConfig = function() {
554
+ Re = null, qe = !1;
555
+ }, t.isValidAttribute = function(A, e, a) {
556
+ Re || rt({});
557
+ const T = $(A), U = $(e);
558
+ return Dt(T, U, a);
559
+ }, t.addHook = function(A, e) {
560
+ typeof e == "function" && Oe(n[A], e);
561
+ }, t.removeHook = function(A, e) {
562
+ if (e !== void 0) {
563
+ const a = sr(n[A], e);
564
+ return a === -1 ? void 0 : lr(n[A], a, 1)[0];
565
+ }
566
+ return Pt(n[A]);
567
+ }, t.removeHooks = function(A) {
568
+ n[A] = [];
569
+ }, t.removeAllHooks = function() {
570
+ n = $t();
571
+ }, t;
572
+ }
573
+ var Lr = Yt();
574
+ function Gt(r) {
575
+ return Lr.sanitize(r, {
576
+ ALLOWED_TAGS: ["p", "br", "strong", "em", "s", "u", "ul", "ol", "li", "a", "hr"],
577
+ ALLOWED_ATTR: ["href", "target", "rel"],
578
+ ALLOW_DATA_ATTR: !1,
579
+ FORBID_TAGS: ["script", "iframe", "object", "embed", "form", "input", "button", "style"],
580
+ FORBID_ATTR: ["onerror", "onload", "onclick", "onmouseover", "onfocus", "onblur"]
581
+ });
582
+ }
583
+ function G(r) {
584
+ return typeof r != "string" ? "" : r.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
585
+ }
586
+ function Z(r) {
587
+ if (!r || typeof r != "string")
588
+ return "";
589
+ const t = r.trim(), i = t.toLowerCase();
590
+ return i.startsWith("javascript:") || i.startsWith("vbscript:") || i.startsWith("file:") ? "" : i.startsWith("data:") ? i.startsWith("data:image/") ? t : "" : t;
591
+ }
592
+ const v = {
593
+ // グループ付きテキストフィールド: {$field.group:default}
594
+ TEXT_FIELD_WITH_GROUP: /\{\$(\w+)\.(\w+):([^}]+)\}/g,
595
+ // テキストフィールド: {$field:default}
596
+ TEXT_FIELD: /\{\$(\w+):([^}]+)\}/g,
597
+ // グループ付きリッチテキストフィールド: {$field.group:default:rich(:required:max=100...)}
598
+ RICH_TEXT_FIELD_WITH_GROUP: /\{\$(\w+)\.(\w+):(.+?):rich(?::[^}]+)?\}/g,
599
+ // リッチテキストフィールド: {$field:default:rich(:required:max=100...)}
600
+ RICH_TEXT_FIELD: /\{\$(\w+):(.+?):rich(?::[^}]+)?\}/g,
601
+ // グループ付きテキストエリアフィールド: {$field.group:default:textarea(:required:max=100...)}
602
+ TEXTAREA_FIELD_WITH_GROUP: /\{\$(\w+)\.(\w+):(.+?):textarea(?::[^}]+)?\}/g,
603
+ // テキストエリアフィールド: {$field:default:textarea(:required:max=100...)}
604
+ TEXTAREA_FIELD: /\{\$(\w+):(.+?):textarea(?::[^}]+)?\}/g,
605
+ // グループ付き画像フィールド: {$field.group:default:image(:required:max=100...)}
606
+ IMAGE_FIELD_WITH_GROUP: /\{\$(\w+)\.(\w+):(.+?):image(?::[^}]+)?\}/g,
607
+ // 画像フィールド: {$field:default:image(:required:max=100...)}
608
+ IMAGE_FIELD: /\{\$(\w+):(.+?):image(?::[^}]+)?\}/g,
609
+ // グループ付きセレクトボックス: ($field.group@:option1|option2) または ($field.group@:option1,option2)
610
+ SELECT_FIELD_WITH_GROUP: /\(\$(\w+)\.(\w+)@:([^)]+)\)/g,
611
+ // セレクトボックス: ($field@:option1|option2) または ($field@:option1,option2)
612
+ SELECT_FIELD: /\(\$(\w+)@:([^)]+)\)/g,
613
+ // グループ付きラジオボタン/チェックボックス: ($field.group:option1|option2) または ($field.group:option1,option2)
614
+ RADIO_CHECKBOX_FIELD_WITH_GROUP: /\(\$(\w+)\.(\w+):([^)]+)\)/g,
615
+ // ラジオボタン: ($field:option1|option2) / チェックボックス: ($field:option1,option2)
616
+ RADIO_FIELD: /\(\$(\w+):([^)]+)\)/g,
617
+ // バックエンドデータ参照: {@fieldName}, {@items[0]}, {@items[0].name}
618
+ BACKEND_DATA: /\{@([\w.[\]]+)\}/g
619
+ };
620
+ function br(r) {
621
+ const t = {};
622
+ for (const i of r) {
623
+ if (i === "required") {
624
+ t.required = !0;
625
+ continue;
626
+ }
627
+ if (i === "readonly") {
628
+ t.readonly = !0;
629
+ continue;
630
+ }
631
+ if (i === "disabled") {
632
+ t.disabled = !0;
633
+ continue;
634
+ }
635
+ if (i.startsWith("max=")) {
636
+ const o = Number(i.slice(4));
637
+ Number.isFinite(o) && (t.maxLength = o);
638
+ }
639
+ }
640
+ return t;
641
+ }
642
+ function te(r) {
643
+ const t = r.split(":"), i = [], o = (d) => d === "required" || d === "readonly" || d === "disabled" || /^max=\d+$/.test(d);
644
+ for (; t.length > 0 && o(t[t.length - 1]); )
645
+ i.unshift(t.pop());
646
+ return {
647
+ defaultValue: t.join(":"),
648
+ validation: br(i)
649
+ };
650
+ }
651
+ function wr(r, t, i) {
652
+ const o = Bt(), I = new o().parseFromString(`<template>${r}</template>`, "text/html").querySelector("template");
653
+ if (!I || !I.content.firstElementChild)
654
+ return me.warn("Failed to parse HTML:", r), r;
655
+ const C = I.content.firstElementChild;
656
+ if (Object.entries(t).forEach(([k, M]) => {
657
+ C.setAttribute(k, M);
658
+ }), i?.addClass) {
659
+ const k = C.getAttribute("class")?.trim() || "", M = k ? `${k} ${i.addClass}` : i.addClass;
660
+ C.setAttribute("class", M);
661
+ }
662
+ return C.outerHTML;
663
+ }
664
+ function Be(r, t, i, o, d = []) {
665
+ const R = [...i, ...o, ...d];
666
+ if (r) {
667
+ const I = R.find((C) => C.id === r);
668
+ if (I)
669
+ return I.url;
670
+ }
671
+ if (t) {
672
+ const I = R.find((C) => C.id === t);
673
+ if (I)
674
+ return me.warn(`Image not found: ${r}, using default: ${t}`), I.url;
675
+ }
676
+ return me.warn(`Image not found: ${r}, default: ${t}`), "";
677
+ }
678
+ function Dr(r) {
679
+ return typeof r == "object" && r !== null;
680
+ }
681
+ function Wt(r, t) {
682
+ if (!r || !t) return "";
683
+ try {
684
+ const i = [];
685
+ let o = "";
686
+ for (let R = 0; R < t.length; R++) {
687
+ const I = t[R];
688
+ I === "[" || I === "]" || I === "." ? o && (i.push(o), o = "") : o += I;
689
+ }
690
+ o && i.push(o);
691
+ let d = r;
692
+ for (let R = 0; R < i.length; R++) {
693
+ const I = i[R];
694
+ if (I.match(/^\d+$/)) {
695
+ const C = parseInt(I, 10);
696
+ if (Array.isArray(d) && C >= 0 && C < d.length)
697
+ d = d[C];
698
+ else
699
+ return "";
700
+ } else if (Dr(d) && I in d)
701
+ d = d[I];
702
+ else
703
+ return "";
704
+ }
705
+ return d == null ? "" : String(d);
706
+ } catch (i) {
707
+ return me.warn(`Failed to resolve backend data path: ${t}`, i), "";
708
+ }
709
+ }
710
+ function Or(r, t) {
711
+ return !r || !t ? r : r.replace(/\{(\w+)\}/g, (i, o) => {
712
+ const d = t[o];
713
+ return d == null ? i : String(d);
714
+ });
715
+ }
716
+ const xr = [
717
+ "h1",
718
+ "h2",
719
+ "h3",
720
+ "h4",
721
+ "h5",
722
+ "h6",
723
+ "div",
724
+ "p",
725
+ "span",
726
+ "li",
727
+ "ul",
728
+ "ol",
729
+ "section",
730
+ "article",
731
+ "aside",
732
+ "nav",
733
+ "header",
734
+ "footer",
735
+ "main",
736
+ "figure",
737
+ "figcaption",
738
+ "blockquote",
739
+ "pre",
740
+ "code",
741
+ "table",
742
+ "thead",
743
+ "tbody",
744
+ "tr",
745
+ "th",
746
+ "td"
747
+ ];
748
+ function Nr(r, t) {
749
+ r.querySelectorAll("[z-if]").forEach((i) => {
750
+ const o = i.getAttribute("z-if");
751
+ o ? (t[o] !== void 0 ? t[o] : !0) ? i.removeAttribute("z-if") : i.remove() : i.removeAttribute("z-if");
752
+ });
753
+ }
754
+ function Cr(r, t, i) {
755
+ r.querySelectorAll("[z-tag]").forEach((o) => {
756
+ const d = o.getAttribute("z-tag");
757
+ if (d) {
758
+ const R = d.match(/^\$(\w+)(?::(.+))?$/);
759
+ if (R) {
760
+ const I = R[1], C = t[I], k = typeof C == "string" ? C : o.tagName.toLowerCase(), M = typeof k == "string" ? k.toLowerCase() : k;
761
+ if (typeof M == "string" && xr.includes(M)) {
762
+ const re = i.createElement(M);
763
+ Array.from(o.attributes).forEach((ne) => {
764
+ ne.name !== "z-tag" && re.setAttribute(ne.name, ne.value);
765
+ }), Array.from(o.childNodes).forEach((ne) => {
766
+ re.appendChild(ne.cloneNode(!0));
767
+ }), o.parentNode?.replaceChild(re, o);
768
+ }
769
+ }
770
+ }
771
+ });
772
+ }
773
+ function vr(r) {
774
+ if (r == null || r === "")
775
+ return !0;
776
+ if (typeof r == "string") {
777
+ const t = r.trim();
778
+ if (t === "" || t === "<p></p>" || t === "<p> </p>" || /^<p>\s*<\/p>$/i.test(t) || /^<p>\s*<br\s*\/?>\s*<\/p>$/i.test(t))
779
+ return !0;
780
+ }
781
+ return !1;
782
+ }
783
+ function Mr(r, t) {
784
+ r.querySelectorAll("[z-empty]").forEach((i) => {
785
+ const o = i.getAttribute("z-empty");
786
+ if (o) {
787
+ const d = o.match(/^\$(\w+)$/);
788
+ if (d) {
789
+ const R = d[1], I = t[R];
790
+ vr(I) ? i.remove() : i.removeAttribute("z-empty");
791
+ } else
792
+ i.removeAttribute("z-empty");
793
+ } else
794
+ i.removeAttribute("z-empty");
795
+ });
796
+ }
797
+ function qt(r, t, i, o, d, R = !0, I = [], C = [], k = [], M, re) {
798
+ const ne = Bt(), ie = new ne(), P = ie.parseFromString(`<template>${r}</template>`, "text/html"), W = P.querySelector("template");
799
+ if (!W || !W.content)
800
+ return me.error("Failed to parse template HTML"), r;
801
+ const he = (c) => {
802
+ if (c.nodeType === at) {
803
+ let l = c.textContent || "";
804
+ M && (l = l.replace(v.BACKEND_DATA, (y, D) => Wt(M, D)));
805
+ let h = /\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(l), L = !1;
806
+ if (h && c.parentNode ? L = !0 : h = /\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(l), h && c.parentNode) {
807
+ const y = h[1], D = L ? h[3] : h[2], { defaultValue: E } = te(D), O = t[y];
808
+ if (typeof O == "boolean") {
809
+ const q = c.parentNode, de = h.index || 0, Le = l.substring(0, de), be = l.substring(de + h[0].length);
810
+ Le && q.insertBefore(P.createTextNode(Le), c), be && q.insertBefore(P.createTextNode(be), c), c.parentNode && c.parentNode.removeChild(c);
811
+ return;
812
+ }
813
+ let _ = O === void 0 ? "" : typeof O == "string" ? O : String(O || E);
814
+ R || (_ = Gt(_));
815
+ const F = c.parentNode, N = h.index || 0, V = l.substring(0, N), Y = l.substring(N + h[0].length);
816
+ _ ? _.trim().startsWith("<p") || (_ = `<p>${_}</p>`) : _ = "";
817
+ const H = P.createElement("div");
818
+ H.innerHTML = _, V && F.insertBefore(P.createTextNode(V), c), Array.from(H.childNodes).forEach((q) => {
819
+ F.insertBefore(q.cloneNode(!0), c);
820
+ }), Y && F.insertBefore(P.createTextNode(Y), c), c.parentNode && c.parentNode.removeChild(c);
821
+ return;
822
+ }
823
+ let n = new RegExp(
824
+ v.RICH_TEXT_FIELD_WITH_GROUP.source,
825
+ v.RICH_TEXT_FIELD_WITH_GROUP.flags
826
+ ).exec(l), S = !1;
827
+ if (n && c.parentNode ? S = !0 : n = new RegExp(
828
+ v.RICH_TEXT_FIELD.source,
829
+ v.RICH_TEXT_FIELD.flags
830
+ ).exec(l), n && c.parentNode) {
831
+ const y = n[1], D = S ? n[3] : n[2], E = t[y];
832
+ let O = E === void 0 ? "" : typeof E == "string" ? E : String(E || D);
833
+ R || (O = Gt(O));
834
+ const _ = c.parentNode, F = n.index || 0, N = l.substring(0, F), V = l.substring(F + n[0].length);
835
+ O ? O.trim().startsWith("<p") || (O = `<p>${O}</p>`) : O = "<p></p>";
836
+ const Y = P.createElement("div");
837
+ Y.innerHTML = O, N && _.insertBefore(P.createTextNode(N), c), Array.from(Y.childNodes).forEach((H) => {
838
+ _.insertBefore(H.cloneNode(!0), c);
839
+ }), V && _.insertBefore(P.createTextNode(V), c), c.parentNode && c.parentNode.removeChild(c);
840
+ return;
841
+ }
842
+ let s = /\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(l), u = !1;
843
+ if (s && c.parentNode ? u = !0 : s = /\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(l), s && c.parentNode) {
844
+ const y = s[1], D = u ? s[3] : s[2], { defaultValue: E } = te(D), 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);
845
+ V && F.insertBefore(P.createTextNode(V), c);
846
+ const H = _.split(`
847
+ `);
848
+ if (H.forEach((q, de) => {
849
+ q && F.insertBefore(P.createTextNode(q), c), de < H.length - 1 && F.insertBefore(P.createElement("br"), c);
850
+ }), Y) {
851
+ const q = P.createTextNode(Y);
852
+ F.insertBefore(q, c), he(q);
853
+ }
854
+ c.parentNode && c.parentNode.removeChild(c);
855
+ return;
856
+ }
857
+ let g = new RegExp(
858
+ v.TEXTAREA_FIELD_WITH_GROUP.source,
859
+ v.TEXTAREA_FIELD_WITH_GROUP.flags
860
+ ).exec(l), b = !1;
861
+ if (g && c.parentNode ? b = !0 : g = new RegExp(
862
+ v.TEXTAREA_FIELD.source,
863
+ v.TEXTAREA_FIELD.flags
864
+ ).exec(l), g && c.parentNode) {
865
+ const y = g[1], D = b ? g[3] : g[2], E = t[y] ?? D ?? "", O = String(E), _ = c.parentNode, F = g.index || 0, N = l.substring(0, F), V = l.substring(F + g[0].length);
866
+ N && _.insertBefore(P.createTextNode(N), c);
867
+ const Y = O.split(`
868
+ `);
869
+ if (Y.forEach((H, q) => {
870
+ H && _.insertBefore(P.createTextNode(H), c), q < Y.length - 1 && _.insertBefore(P.createElement("br"), c);
871
+ }), V) {
872
+ const H = P.createTextNode(V);
873
+ _.insertBefore(H, c), he(H);
874
+ }
875
+ c.parentNode && c.parentNode.removeChild(c);
876
+ return;
877
+ }
878
+ l = l.replace(/\{\$(\w+)\?:([^}]+)\}/g, (y, D, E) => {
879
+ if (/:textarea(?::[^}]*)?$/.test(y))
880
+ return y;
881
+ const O = t[D];
882
+ if (O === void 0 || typeof O == "boolean")
883
+ return "";
884
+ const { defaultValue: _ } = te(E);
885
+ return String(O || _);
886
+ }), l = l.replace(
887
+ /\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,
888
+ (y, D, E, O) => {
889
+ if (/:textarea(?::[^}]*)?$/.test(y))
890
+ return y;
891
+ const _ = t[D];
892
+ if (_ === void 0 || typeof _ == "boolean")
893
+ return "";
894
+ const { defaultValue: F } = te(O);
895
+ return String(_ || F);
896
+ }
897
+ ), l = l.replace(
898
+ v.TEXT_FIELD_WITH_GROUP,
899
+ (y, D, E, O) => {
900
+ const _ = t[D];
901
+ if (_ === void 0)
902
+ return "";
903
+ const { defaultValue: F } = te(O);
904
+ return String(_ || F);
905
+ }
906
+ ), l = l.replace(v.TEXT_FIELD, (y, D, E) => {
907
+ const O = t[D];
908
+ if (O === void 0)
909
+ return "";
910
+ const { defaultValue: _ } = te(E);
911
+ return String(O || _);
912
+ }), c.textContent = l;
913
+ } else if (c.nodeType === ot) {
914
+ const l = c, x = [];
915
+ Array.from(l.attributes).forEach((h) => {
916
+ const L = h.value;
917
+ let m = h.value;
918
+ const n = h.name.toLowerCase();
919
+ if (n === "z-if" || n === "z-for" || n === "z-slot" || n === "z-empty" || n === "z-tag" || n.startsWith("data-zcode-"))
920
+ return;
921
+ const S = /^\{\$[\w.]+?\?:[^}]+\}(?::(rich|image|textarea))?$/.test(
922
+ L.trim()
923
+ );
924
+ M && ((n === "href" || n === "src" || n === "action") && (m = Or(m, M)), m = m.replace(v.BACKEND_DATA, (f, s) => {
925
+ const u = Wt(M, s);
926
+ return n === "href" || n === "src" || n === "action" ? Z(u) : G(u);
927
+ })), m = m.replace(
928
+ /\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,
929
+ (f, s, u) => {
930
+ const p = t[s];
931
+ if (p === void 0 || typeof p == "boolean")
932
+ return "";
933
+ const { defaultValue: g } = te(u);
934
+ return G(String(p || g));
935
+ }
936
+ ), m = m.replace(
937
+ /\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,
938
+ (f, s, u, p) => {
939
+ const g = t[s];
940
+ if (g === void 0 || typeof g == "boolean")
941
+ return "";
942
+ const { defaultValue: b } = te(p);
943
+ return G(String(g || b));
944
+ }
945
+ ), m = m.replace(
946
+ /\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g,
947
+ (f, s, u) => {
948
+ const p = t[s];
949
+ if (p === void 0)
950
+ return "";
951
+ const { defaultValue: g } = te(u), b = typeof p == "string" ? p : String(p || g), y = Be(
952
+ b,
953
+ g,
954
+ I,
955
+ C,
956
+ k
957
+ ), D = typeof y == "string" ? y : String(y || g);
958
+ return n === "href" || n === "src" ? Z(D) : G(D);
959
+ }
960
+ ), m = m.replace(
961
+ /\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g,
962
+ (f, s, u, p) => {
963
+ const g = t[s];
964
+ if (g === void 0)
965
+ return "";
966
+ const { defaultValue: b } = te(p), y = typeof g == "string" ? g : String(g || b), D = Be(
967
+ y,
968
+ b,
969
+ I,
970
+ C,
971
+ k
972
+ ), E = typeof D == "string" ? D : String(D || b);
973
+ return n === "href" || n === "src" ? Z(E) : G(E);
974
+ }
975
+ ), m = m.replace(
976
+ v.RICH_TEXT_FIELD_WITH_GROUP,
977
+ (f, s, u, p) => {
978
+ const g = t[s];
979
+ return g === void 0 ? "" : G(String(g || p));
980
+ }
981
+ ), m = m.replace(v.RICH_TEXT_FIELD, (f, s, u) => {
982
+ const p = t[s];
983
+ return p === void 0 ? "" : G(String(p || u));
984
+ }), m = m.replace(
985
+ v.IMAGE_FIELD_WITH_GROUP,
986
+ (f, s, u, p) => {
987
+ const g = t[s];
988
+ if (g === void 0)
989
+ return "";
990
+ const b = Be(
991
+ g || p,
992
+ p,
993
+ I,
994
+ C,
995
+ k
996
+ );
997
+ return n === "href" || n === "src" ? Z(b || p) : G(b || p);
998
+ }
999
+ ), m = m.replace(v.IMAGE_FIELD, (f, s, u) => {
1000
+ const p = t[s];
1001
+ if (p === void 0)
1002
+ return "";
1003
+ const g = Be(
1004
+ p || u,
1005
+ u,
1006
+ I,
1007
+ C,
1008
+ k
1009
+ );
1010
+ return n === "href" || n === "src" ? Z(g || u) : G(g || u);
1011
+ }), m = m.replace(/\{\$(\w+)\?:([^}]+)\}/g, (f, s, u) => {
1012
+ const p = t[s];
1013
+ if (p === void 0 || typeof p == "boolean")
1014
+ return "";
1015
+ const { defaultValue: g } = te(u), b = String(p || g);
1016
+ return n === "href" || n === "src" || n === "action" ? Z(b) : G(b);
1017
+ }), m = m.replace(
1018
+ /\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,
1019
+ (f, s, u, p) => {
1020
+ const g = t[s];
1021
+ if (g === void 0 || typeof g == "boolean")
1022
+ return "";
1023
+ const { defaultValue: b } = te(p), y = String(g || b);
1024
+ return n === "href" || n === "src" || n === "action" ? Z(y) : G(y);
1025
+ }
1026
+ ), m = m.replace(
1027
+ v.TEXT_FIELD_WITH_GROUP,
1028
+ (f, s, u, p) => {
1029
+ const g = t[s];
1030
+ if (g === void 0)
1031
+ return "";
1032
+ const { defaultValue: b } = te(p), y = String(g || b);
1033
+ return n === "href" || n === "src" || n === "action" ? Z(y) : G(y);
1034
+ }
1035
+ ), m = m.replace(v.TEXT_FIELD, (f, s, u) => {
1036
+ const p = t[s];
1037
+ if (p === void 0)
1038
+ return "";
1039
+ const { defaultValue: g } = te(u), b = String(p || g);
1040
+ return n === "href" || n === "src" || n === "action" ? Z(b) : G(b);
1041
+ }), S && m.trim() === "" ? x.push(h.name) : h.value = m;
1042
+ }), x.forEach((h) => {
1043
+ l.removeAttribute(h);
1044
+ });
1045
+ }
1046
+ Array.from(c.childNodes).forEach((l) => he(l));
1047
+ };
1048
+ he(W.content);
1049
+ const Me = (c) => {
1050
+ if (c.nodeType === at) {
1051
+ let l = c.textContent || "";
1052
+ l = l.replace(
1053
+ v.SELECT_FIELD_WITH_GROUP,
1054
+ (x, h, L, m) => {
1055
+ if (m.includes("|"))
1056
+ return t[h] || m.split("|")[0];
1057
+ if (m.includes(",")) {
1058
+ const n = t[h], S = Array.isArray(n) ? n : [], f = m.split(",");
1059
+ return S.filter((s) => typeof s == "string" && f.includes(s)).join(" ");
1060
+ }
1061
+ return t[h] || m;
1062
+ }
1063
+ ), l = l.replace(v.SELECT_FIELD, (x, h, L) => {
1064
+ if (L.includes("|")) {
1065
+ const n = t[h];
1066
+ return typeof n == "string" ? n : L.split("|")[0];
1067
+ } else if (L.includes(",")) {
1068
+ const n = t[h], S = Array.isArray(n) ? n : [], f = L.split(",");
1069
+ return S.filter((s) => typeof s == "string" && f.includes(s)).join(" ");
1070
+ }
1071
+ const m = t[h];
1072
+ return typeof m == "string" ? m : L;
1073
+ }), l = l.replace(
1074
+ v.RADIO_CHECKBOX_FIELD_WITH_GROUP,
1075
+ (x, h, L, m) => {
1076
+ if (m.includes("|")) {
1077
+ const S = t[h];
1078
+ return typeof S == "string" ? S : m.split("|")[0];
1079
+ } else if (m.includes(",")) {
1080
+ const S = t[h], f = Array.isArray(S) ? S : [], s = m.split(",");
1081
+ return f.filter((u) => typeof u == "string" && s.includes(u)).join(" ");
1082
+ }
1083
+ const n = t[h];
1084
+ return typeof n == "string" ? n : m;
1085
+ }
1086
+ ), l = l.replace(v.RADIO_FIELD, (x, h, L) => {
1087
+ if (L.includes("|")) {
1088
+ const n = t[h];
1089
+ return typeof n == "string" ? n : L.split("|")[0];
1090
+ } else if (L.includes(",")) {
1091
+ const n = t[h], S = Array.isArray(n) ? n : [], f = L.split(",");
1092
+ return S.filter((s) => typeof s == "string" && f.includes(s)).join(" ");
1093
+ }
1094
+ const m = t[h];
1095
+ return typeof m == "string" ? m : L;
1096
+ }), c.textContent = l;
1097
+ } else c.nodeType === ot && Array.from(c.attributes).forEach((x) => {
1098
+ let h = x.value;
1099
+ const L = x.name.toLowerCase();
1100
+ h = h.replace(
1101
+ v.SELECT_FIELD_WITH_GROUP,
1102
+ (m, n, S, f) => {
1103
+ let s;
1104
+ if (f.includes("|"))
1105
+ s = t[n] || f.split("|")[0];
1106
+ else if (f.includes(",")) {
1107
+ const u = t[n], p = Array.isArray(u) ? u : [], g = f.split(",");
1108
+ s = p.filter((b) => typeof b == "string" && g.includes(b)).join(" ");
1109
+ } else {
1110
+ const u = t[n];
1111
+ s = typeof u == "string" ? u : f;
1112
+ }
1113
+ return L === "href" || L === "src" || L === "action" ? Z(String(s)) : G(String(s));
1114
+ }
1115
+ ), h = h.replace(v.SELECT_FIELD, (m, n, S) => {
1116
+ let f;
1117
+ if (S.includes("|"))
1118
+ f = t[n] || S.split("|")[0];
1119
+ else if (S.includes(",")) {
1120
+ const s = t[n], u = Array.isArray(s) ? s : [], p = S.split(",");
1121
+ f = u.filter((g) => typeof g == "string" && p.includes(g)).join(" ");
1122
+ } else {
1123
+ const s = t[n];
1124
+ f = typeof s == "string" ? s : S;
1125
+ }
1126
+ return L === "href" || L === "src" || L === "action" ? Z(String(f)) : G(String(f));
1127
+ }), h = h.replace(
1128
+ v.RADIO_CHECKBOX_FIELD_WITH_GROUP,
1129
+ (m, n, S, f) => {
1130
+ let s;
1131
+ if (f.includes("|"))
1132
+ s = t[n] || f.split("|")[0];
1133
+ else if (f.includes(",")) {
1134
+ const u = t[n], p = Array.isArray(u) ? u : [], g = f.split(",");
1135
+ s = p.filter((b) => typeof b == "string" && g.includes(b)).join(" ");
1136
+ } else {
1137
+ const u = t[n];
1138
+ s = typeof u == "string" ? u : f;
1139
+ }
1140
+ return L === "href" || L === "src" || L === "action" ? Z(String(s)) : G(String(s));
1141
+ }
1142
+ ), h = h.replace(v.RADIO_FIELD, (m, n, S) => {
1143
+ let f;
1144
+ if (S.includes("|"))
1145
+ f = t[n] || S.split("|")[0];
1146
+ else if (S.includes(",")) {
1147
+ const s = t[n], u = Array.isArray(s) ? s : [], p = S.split(",");
1148
+ f = u.filter((g) => typeof g == "string" && p.includes(g)).join(" ");
1149
+ } else {
1150
+ const s = t[n];
1151
+ f = typeof s == "string" ? s : S;
1152
+ }
1153
+ return L === "href" || L === "src" || L === "action" ? Z(String(f)) : G(String(f));
1154
+ }), x.value = h;
1155
+ });
1156
+ c.childNodes.forEach((l) => Me(l));
1157
+ };
1158
+ Me(W.content), Nr(W.content, t), Cr(W.content, t, P), Mr(W.content, t);
1159
+ const je = () => {
1160
+ Array.from(W.content.querySelectorAll("[z-for]")).forEach((l) => {
1161
+ const x = l.getAttribute("z-for");
1162
+ if (!x) {
1163
+ l.removeAttribute("z-for");
1164
+ return;
1165
+ }
1166
+ const h = x.match(/^(\w+)\s+in\s+(.+)$/);
1167
+ if (!h) {
1168
+ me.warn(`Invalid z-for syntax: ${x}`), l.removeAttribute("z-for");
1169
+ return;
1170
+ }
1171
+ const [, L, m] = h;
1172
+ if (!m.startsWith("{@") || !m.endsWith("}")) {
1173
+ me.warn(`z-for only supports backend data: ${m}`), l.removeAttribute("z-for");
1174
+ return;
1175
+ }
1176
+ const n = m.slice(2, -1);
1177
+ if (!M) {
1178
+ l.remove();
1179
+ return;
1180
+ }
1181
+ let S;
1182
+ try {
1183
+ const u = n.split(".");
1184
+ let p = M;
1185
+ for (const g of u)
1186
+ if (p && typeof p == "object" && g in p)
1187
+ p = p[g];
1188
+ else {
1189
+ p = null;
1190
+ break;
1191
+ }
1192
+ S = p;
1193
+ } catch (u) {
1194
+ me.warn(`Failed to resolve data source: ${n}`, u), l.remove();
1195
+ return;
1196
+ }
1197
+ if (!Array.isArray(S) || S.length === 0) {
1198
+ l.remove();
1199
+ return;
1200
+ }
1201
+ const f = l.ownerDocument ?? (typeof document < "u" ? document : null);
1202
+ if (!f) throw new Error("Document not available for createDocumentFragment");
1203
+ const s = f.createDocumentFragment();
1204
+ S.forEach((u) => {
1205
+ const p = l.cloneNode(!0);
1206
+ p.removeAttribute("z-for"), Ye(p, L, u, t, M), s.appendChild(p);
1207
+ }), l.parentNode && l.parentNode.replaceChild(s, l);
1208
+ });
1209
+ }, Ye = (c, l, x, h, L, m) => {
1210
+ const n = (f) => {
1211
+ if (f.nodeType === at) {
1212
+ let s = f.textContent || "";
1213
+ const u = new RegExp(`\\{${l}\\.([\\w\\.\\[\\]]+)\\}`, "g");
1214
+ s = s.replace(u, (p, g) => {
1215
+ try {
1216
+ const b = g.split(/[.[\]]/).filter((D) => D);
1217
+ let y = x;
1218
+ for (const D of b)
1219
+ if (D.match(/^\d+$/)) {
1220
+ const E = parseInt(D, 10);
1221
+ if (Array.isArray(y) && E >= 0 && E < y.length)
1222
+ y = y[E];
1223
+ else
1224
+ return "";
1225
+ } else if (y && typeof y == "object" && D in y)
1226
+ y = y[D];
1227
+ else
1228
+ return "";
1229
+ return y == null ? "" : String(y);
1230
+ } catch {
1231
+ return "";
1232
+ }
1233
+ }), 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 === ot) {
1235
+ const s = f;
1236
+ Array.from(s.attributes).forEach((u) => {
1237
+ let p = u.value;
1238
+ const g = new RegExp(`\\{${l}\\.([\\w\\.\\[\\]]+)\\}`, "g");
1239
+ p = p.replace(g, (b, y) => {
1240
+ try {
1241
+ const D = y.split(/[.[\]]/).filter((_) => _);
1242
+ let E = x;
1243
+ for (const _ of D)
1244
+ if (_.match(/^\d+$/)) {
1245
+ const F = parseInt(_, 10);
1246
+ if (Array.isArray(E) && F >= 0 && F < E.length)
1247
+ E = E[F];
1248
+ else
1249
+ return "";
1250
+ } else if (E && typeof E == "object" && _ in E)
1251
+ E = E[_];
1252
+ else
1253
+ return "";
1254
+ const O = E == null ? "" : String(E);
1255
+ return u.name === "href" || u.name === "src" || u.name === "action" ? Z(O) : G(O);
1256
+ } catch {
1257
+ return "";
1258
+ }
1259
+ }), p = p.replace(new RegExp(`\\{${l}\\}`, "g"), () => {
1260
+ const b = typeof x == "object" && x !== null ? JSON.stringify(x) : String(x);
1261
+ return u.name === "href" || u.name === "src" || u.name === "action" ? Z(b) : G(b);
1262
+ }), u.value = p;
1263
+ }), Array.from(s.childNodes).forEach((u) => n(u));
1264
+ }
1265
+ };
1266
+ Array.from(c.childNodes).forEach((f) => n(f));
1267
+ const S = c.innerHTML;
1268
+ if (S) {
1269
+ const f = qt(
1270
+ S,
1271
+ h,
1272
+ i,
1273
+ o,
1274
+ d,
1275
+ R,
1276
+ I,
1277
+ C,
1278
+ k,
1279
+ L
1280
+ );
1281
+ c.innerHTML = f;
1282
+ }
1283
+ };
1284
+ je();
1285
+ const Ee = (c) => {
1286
+ c.forEach((l) => {
1287
+ const x = l.getAttribute("z-slot") || "default", h = t.slots?.[x];
1288
+ let L = [];
1289
+ if (Array.isArray(h) ? L = h : h && typeof h == "object" && h.children && (L = h.children || []), L.length === 0) {
1290
+ if (l.removeAttribute("z-slot"), R) {
1291
+ l.setAttribute("data-zcode-empty-slot", x), l.setAttribute(
1292
+ "data-zcode-slot-path",
1293
+ i ? `${i}.slots.${x}` : `slots.${x}`
1294
+ );
1295
+ const f = re?.translations?.addSlotButton ?? "+ Add Part";
1296
+ l.innerHTML = `<div class="zcode-empty-slot" data-zcode-empty-slot-content>
1297
+ <button class="zcode-add-slot-btn" data-zcode-add-slot>${f}</button>
1298
+ </div>`;
1299
+ } else
1300
+ l.innerHTML = "";
1301
+ return;
1302
+ }
1303
+ const m = L.map((f, s) => {
1304
+ const u = i ? `${i}.slots.${x}.${s}` : `slots.${x}.${s}`;
1305
+ return d(f, u);
1306
+ }).join("");
1307
+ l.removeAttribute("z-slot");
1308
+ const S = ie.parseFromString(`<template>${m}</template>`, "text/html").querySelector("template");
1309
+ if (S && S.content)
1310
+ for (l.innerHTML = ""; S.content.firstChild; )
1311
+ l.appendChild(S.content.firstChild);
1312
+ else
1313
+ l.innerHTML = m;
1314
+ });
1315
+ }, B = Array.from(W.content.querySelectorAll("[z-slot]"));
1316
+ return Ee(B), W.innerHTML;
1317
+ }
1318
+ function Pr(r, t) {
1319
+ const i = [...t.common, ...t.individual, ...t.special];
1320
+ for (const o of i) {
1321
+ const d = o.parts.find((R) => R.id === r);
1322
+ if (d)
1323
+ return d;
1324
+ }
1325
+ return null;
1326
+ }
1327
+ class Xe extends Error {
1328
+ constructor(t, i, o) {
1329
+ super(o), this.code = t, this.path = i, this.name = "RenderError";
1330
+ }
1331
+ }
1332
+ function Fr(r, t, i, o, d) {
1333
+ if (i.has(t))
1334
+ throw new Xe("CIRCULAR_REFERENCE", t, `循環参照が検出されました: ${t}`);
1335
+ i.add(t);
1336
+ const R = r.part_id, I = o.findPart(R);
1337
+ if (!I)
1338
+ throw new Xe("PART_NOT_FOUND", t, `パーツが見つかりません: ${R}`);
1339
+ const C = qt(
1340
+ I.body,
1341
+ r,
1342
+ t,
1343
+ o.findPart,
1344
+ d,
1345
+ o.enableEditorAttributes,
1346
+ o.imagesCommon,
1347
+ o.imagesIndividual,
1348
+ o.imagesSpecial,
1349
+ o.backendData,
1350
+ o.options
1351
+ );
1352
+ return o.enableEditorAttributes ? wr(
1353
+ C,
1354
+ {
1355
+ "data-zcode-id": r.id,
1356
+ "data-zcode-path": t,
1357
+ "data-zcode-part": R
1358
+ },
1359
+ I.outlinePosition === "inner" ? { addClass: "zcode-outline-inner" } : void 0
1360
+ ) : C;
1361
+ }
1362
+ const Ur = ["common", "individual", "special"];
1363
+ function Hr(r) {
1364
+ return r ? Ur.filter((t) => r[t]?.trim()).map((t) => {
1365
+ const i = r[t].replace(/<\/style/gi, "<\\/style");
1366
+ return `<style id="zcode-css-style-${t}" data-zcode-css="true" data-zcode-css-category="${t}">${i}</style>`;
1367
+ }).join(`
1368
+ `) : "";
1369
+ }
1370
+ function zr(r, t = {}) {
1371
+ const { enableEditorAttributes: i = !1 } = t, o = r.backendData;
1372
+ if (!r)
1373
+ throw new Xe("PARSE_ERROR", "", "データが提供されていません");
1374
+ const d = r.parts || { common: [], individual: [], special: [] }, R = r.images || { common: [], individual: [], special: [] }, I = r.page || [];
1375
+ function C(re) {
1376
+ return Pr(re, d);
1377
+ }
1378
+ const k = {
1379
+ findPart: C,
1380
+ enableEditorAttributes: i,
1381
+ imagesCommon: R.common,
1382
+ imagesIndividual: R.individual,
1383
+ imagesSpecial: R.special,
1384
+ backendData: o
1385
+ };
1386
+ function M(re, ne, ie) {
1387
+ return Fr(
1388
+ re,
1389
+ ne,
1390
+ ie,
1391
+ k,
1392
+ (P, W) => M(P, W, ie)
1393
+ );
1394
+ }
1395
+ return I.map((re, ne) => {
1396
+ try {
1397
+ return M(re, `page.${ne}`, /* @__PURE__ */ new Set());
1398
+ } catch (ie) {
1399
+ if (ie instanceof Xe)
1400
+ return `<div class="zcode-error-message" data-error-code="${ie.code}">${ie.message}</div>`;
1401
+ throw ie;
1402
+ }
1403
+ }).join("");
1404
+ }
1405
+ export {
1406
+ Xe as RenderError,
1407
+ Hr as renderCssToHtml,
1408
+ zr as renderToHtml
1409
+ };