shopify
Version:
A CLI tool to build for the Shopify platform
1,223 lines (1,222 loc) • 206 kB
JavaScript
import {
__esm,
init_cjs_shims
} from "./chunk-PKR7KJ6P.js";
// ../../node_modules/.pnpm/prettier@3.7.4/node_modules/prettier/plugins/html.mjs
function Ns(e) {
return this[e < 0 ? this.length + e : e];
}
function Os(e) {
if (typeof e == "string") return Ye;
if (Array.isArray(e)) return je;
if (!e) return;
let { type: t } = e;
if (Tt.has(t)) return t;
}
function Rs(e) {
let t = e === null ? "null" : typeof e;
if (t !== "string" && t !== "object") return `Unexpected doc '${t}',
Expected it to be 'string' or 'object'.`;
if (bt(e)) throw new Error("doc is valid.");
let r = Object.prototype.toString.call(e);
if (r !== "[object Object]") return `Unexpected doc '${r}'.`;
let n = Ds([...Tt].map((i) => `'${i}'`));
return `Unexpected doc.type '${e.type}'.
Expected it to be ${n}.`;
}
function ar(e, t) {
if (typeof e == "string") return t(e);
let r = /* @__PURE__ */ new Map();
return n(e);
function n(s) {
if (r.has(s)) return r.get(s);
let a = i(s);
return r.set(s, a), a;
}
function i(s) {
switch (bt(s)) {
case je:
return t(s.map(n));
case Le:
return t({ ...s, parts: s.parts.map(n) });
case Pe:
return t({ ...s, breakContents: n(s.breakContents), flatContents: n(s.flatContents) });
case Ne: {
let { expandedStates: a, contents: o } = s;
return a ? (a = a.map(n), o = a[0]) : o = n(o), t({ ...s, contents: o, expandedStates: a });
}
case xe:
case ye:
case Oe:
case vt:
case Et:
return t({ ...s, contents: n(s.contents) });
case Ye:
case _t:
case St:
case Ct:
case Y:
case De:
return t(s);
default:
throw new rn(s);
}
}
}
function L(e, t = nn) {
return ar(e, (r) => typeof r == "string" ? q(t, r.split(`
`)) : r);
}
function y(e) {
return D(e), { type: ye, contents: e };
}
function Is(e, t) {
return an(e), D(t), { type: xe, contents: t, n: e };
}
function on(e) {
return Is(Number.NEGATIVE_INFINITY, e);
}
function kt(e) {
return sn(e), { type: Le, parts: e };
}
function C(e, t = {}) {
return D(e), wt(t.expandedStates, !0), { type: Ne, id: t.id, contents: e, break: !!t.shouldBreak, expandedStates: t.expandedStates };
}
function X(e, t = "", r = {}) {
return D(e), t !== "" && D(t), { type: Pe, breakContents: e, flatContents: t, groupId: r.groupId };
}
function ln(e, t) {
return D(e), { type: Oe, contents: e, groupId: t.groupId, negate: t.negate };
}
function q(e, t) {
D(e), wt(t);
let r = [];
for (let n = 0; n < t.length; n++) n !== 0 && r.push(e), r.push(t[n]);
return r;
}
function Hs(e, t) {
let { preferred: r, alternate: n } = t === !0 || t === "'" ? Fs : qs, { length: i } = e, s = 0, a = 0;
for (let o = 0; o < i; o++) {
let c = e.charCodeAt(o);
c === r.codePoint ? s++ : c === n.codePoint && a++;
}
return (s > a ? n : r).character;
}
function or(e) {
if (typeof e != "string") throw new TypeError("Expected a string");
return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
}
function fn(e, t, r) {
if (e.kind === "text" || e.kind === "comment") return null;
if (e.kind === "yaml" && delete t.value, e.kind === "attribute") {
let { fullName: n, value: i } = e;
n === "style" || n === "class" || n === "srcset" && (r.fullName === "img" || r.fullName === "source") || n === "allow" && r.fullName === "iframe" || n.startsWith("on") || n.startsWith("@") || n.startsWith(":") || n.startsWith(".") || n.startsWith("#") || n.startsWith("v-") || n === "vars" && r.fullName === "style" || (n === "setup" || n === "generic") && r.fullName === "script" || n === "slot-scope" || n.startsWith("(") || n.startsWith("[") || n.startsWith("*") || n.startsWith("bind") || n.startsWith("i18n") || n.startsWith("on-") || n.startsWith("ng-") || i?.includes("{{") ? delete t.value : i && (t.value = w(0, i, /'|"|'/gu, '"'));
}
if (e.kind === "docType" && (t.value = w(0, e.value.toLowerCase(), /\s+/gu, " ")), e.kind === "angularControlFlowBlock" && e.parameters?.children) for (let n of t.parameters.children) Gs.has(e.name) ? delete n.expression : n.expression = n.expression.trim();
e.kind === "angularIcuExpression" && (t.switchValue = e.switchValue.trim()), e.kind === "angularLetDeclarationInitializer" && delete t.value, e.kind === "element" && e.isVoid && !e.isSelfClosing && (t.isSelfClosing = !0);
}
function K(e, t = !0) {
return [y([k, e]), t ? k : ""];
}
function W(e, t) {
let r = e.type === "NGRoot" ? e.node.type === "NGMicrosyntax" && e.node.body.length === 1 && e.node.body[0].type === "NGMicrosyntaxExpression" ? e.node.body[0].expression : e.node : e.type === "JsExpressionRoot" ? e.node : e;
return r && (r.type === "ObjectExpression" || r.type === "ArrayExpression" || (t.parser === "__vue_expression" || t.parser === "__vue_ts_expression") && (r.type === "TemplateLiteral" || r.type === "StringLiteral"));
}
async function A(e, t, r, n) {
r = { __isInHtmlAttribute: !0, __embeddedInHtml: !0, ...r };
let i = !0;
n && (r.__onHtmlBindingRoot = (a, o) => {
i = n(a, o);
});
let s = await t(e, r, t);
return i ? C(s) : K(s);
}
function $s(e, t, r, n) {
let { node: i } = r, s = n.originalText.slice(i.sourceSpan.start.offset, i.sourceSpan.end.offset);
return /^\s*$/u.test(s) ? "" : A(s, e, { parser: "__ng_directive", __isInHtmlAttribute: !1 }, W);
}
function js() {
let e = globalThis, t = e.Deno?.build?.os;
return typeof t == "string" ? t === "windows" : e.navigator?.platform?.startsWith("Win") ?? e.process?.platform?.startsWith("win") ?? !1;
}
function Sn(e) {
if (e = e instanceof URL ? e : new URL(e), e.protocol !== "file:") throw new TypeError(`URL must be a file URL: received "${e.protocol}"`);
return e;
}
function Ks(e) {
return e = Sn(e), decodeURIComponent(e.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25"));
}
function Qs(e) {
e = Sn(e);
let t = decodeURIComponent(e.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25")).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\");
return e.hostname !== "" && (t = `\\\\${e.hostname}${t}`), t;
}
function ur(e) {
return Xs ? Qs(e) : Ks(e);
}
function Js(e) {
return Array.isArray(e) && e.length > 0;
}
function vn(e, t) {
if (!t) return;
let r = En(t).toLowerCase();
return e.find(({ filenames: n }) => n?.some((i) => i.toLowerCase() === r)) ?? e.find(({ extensions: n }) => n?.some((i) => r.endsWith(i)));
}
function Zs(e, t) {
if (t) return e.find(({ name: r }) => r.toLowerCase() === t) ?? e.find(({ aliases: r }) => r?.includes(t)) ?? e.find(({ extensions: r }) => r?.includes(`.${t}`));
}
function Tn(e, t) {
if (t) {
if (Cn(t)) try {
t = ur(t);
} catch {
return;
}
if (typeof t == "string") return e.find(({ isSupported: r }) => r?.({ filepath: t }));
}
}
function ta(e, t) {
let r = _n(0, e.plugins).flatMap((i) => i.languages ?? []);
return (Zs(r, t.language) ?? vn(r, t.physicalFile) ?? vn(r, t.file) ?? Tn(r, t.physicalFile) ?? Tn(r, t.file) ?? ea?.(r, t.physicalFile))?.parsers[0];
}
function ra(e) {
return !!e?.[yt];
}
function na(e) {
let t = e.slice(0, Xe);
if (t !== "---" && t !== "+++") return;
let r = e.indexOf(`
`, Xe);
if (r === -1) return;
let n = e.slice(Xe, r).trim(), i = e.indexOf(`
${t}`, r), s = n;
if (s || (s = t === "+++" ? "toml" : "yaml"), i === -1 && t === "---" && s === "yaml" && (i = e.indexOf(`
...`, r)), i === -1) return;
let a = i + 1 + Xe, o = e.charAt(a + 1);
if (!/\s?/u.test(o)) return;
let c = e.slice(0, a), u;
return { language: s, explicitLanguage: n || null, value: e.slice(r + 1, i), startDelimiter: t, endDelimiter: c.slice(-Xe), raw: c, start: { line: 1, column: 0, index: 0 }, end: { index: c.length, get line() {
return u ?? (u = c.split(`
`)), u.length;
}, get column() {
return u ?? (u = c.split(`
`)), F(0, u, -1).length;
} }, [yt]: !0 };
}
function ia(e) {
let t = na(e);
return t ? { frontMatter: t, get content() {
let { raw: r } = t;
return w(0, r, /[^\n]/gu, " ") + e.slice(r.length);
} } : { content: e };
}
function sa(e) {
return e.kind === "element" && !e.hasExplicitNamespace && !["html", "svg"].includes(e.namespace);
}
function xt(e, t) {
return !!(e.kind === "ieConditionalComment" && e.lastChild && !e.lastChild.isSelfClosing && !e.lastChild.endSourceSpan || e.kind === "ieConditionalComment" && !e.complete || ue(e) && e.children.some((r) => r.kind !== "text" && r.kind !== "interpolation") || Pt(e, t) && !H(e, t) && e.kind !== "interpolation");
}
function pe(e) {
return e.kind === "attribute" || !e.parent || !e.prev ? !1 : oa(e.prev);
}
function oa(e) {
return e.kind === "comment" && e.value.trim() === "prettier-ignore";
}
function O(e) {
return e.kind === "text" || e.kind === "comment";
}
function H(e, t) {
return e.kind === "element" && (e.fullName === "script" || e.fullName === "style" || e.fullName === "svg:style" || e.fullName === "svg:script" || e.fullName === "mj-style" && t.parser === "mjml" || ce(e) && (e.name === "script" || e.name === "style"));
}
function An(e, t) {
return e.children && !H(e, t);
}
function yn(e, t) {
return H(e, t) || e.kind === "interpolation" || dr(e);
}
function dr(e) {
return Fn(e).startsWith("pre");
}
function xn(e, t) {
let r = n();
if (r && !e.prev && e.parent?.tagDefinition?.ignoreFirstLf) return e.kind === "interpolation";
return r;
function n() {
return le(e) || e.kind === "angularControlFlowBlock" ? !1 : (e.kind === "text" || e.kind === "interpolation") && e.prev && (e.prev.kind === "text" || e.prev.kind === "interpolation") ? !0 : !e.parent || e.parent.cssDisplay === "none" ? !1 : ue(e.parent) ? !0 : !(!e.prev && (e.parent.kind === "root" || ue(e) && e.parent || H(e.parent, t) || Je(e.parent, t) || !ma(e.parent.cssDisplay)) || e.prev && !ga(e.prev.cssDisplay));
}
}
function Nn(e, t) {
return le(e) || e.kind === "angularControlFlowBlock" ? !1 : (e.kind === "text" || e.kind === "interpolation") && e.next && (e.next.kind === "text" || e.next.kind === "interpolation") ? !0 : !e.parent || e.parent.cssDisplay === "none" ? !1 : ue(e.parent) ? !0 : !(!e.next && (e.parent.kind === "root" || ue(e) && e.parent || H(e.parent, t) || Je(e.parent, t) || !fa(e.parent.cssDisplay)) || e.next && !da(e.next.cssDisplay));
}
function Ln(e, t) {
return _a(e.cssDisplay) && !H(e, t);
}
function Ke(e) {
return le(e) || e.next && e.sourceSpan.end && e.sourceSpan.end.line + 1 < e.next.sourceSpan.start.line;
}
function Pn(e) {
return gr(e) || e.kind === "element" && e.children.length > 0 && (["body", "script", "style"].includes(e.name) || e.children.some((t) => ca(t))) || e.firstChild && e.firstChild === e.lastChild && e.firstChild.kind !== "text" && Dn(e.firstChild) && (!e.lastChild.isTrailingSpaceSensitive || Rn(e.lastChild));
}
function gr(e) {
return e.kind === "element" && e.children.length > 0 && (["html", "head", "ul", "ol", "select"].includes(e.name) || e.cssDisplay.startsWith("table") && e.cssDisplay !== "table-cell");
}
function Nt(e) {
return In(e) || e.prev && la(e.prev) || On(e);
}
function la(e) {
return In(e) || e.kind === "element" && e.fullName === "br" || On(e);
}
function On(e) {
return Dn(e) && Rn(e);
}
function Dn(e) {
return e.hasLeadingSpaces && (e.prev ? e.prev.sourceSpan.end.line < e.sourceSpan.start.line : e.parent.kind === "root" || e.parent.startSourceSpan.end.line < e.sourceSpan.start.line);
}
function Rn(e) {
return e.hasTrailingSpaces && (e.next ? e.next.sourceSpan.start.line > e.sourceSpan.end.line : e.parent.kind === "root" || e.parent.endSourceSpan && e.parent.endSourceSpan.start.line > e.sourceSpan.end.line);
}
function In(e) {
switch (e.kind) {
case "ieConditionalComment":
case "comment":
case "directive":
return !0;
case "element":
return ["script", "select"].includes(e.name);
}
return !1;
}
function Lt(e) {
return e.lastChild ? Lt(e.lastChild) : e;
}
function ca(e) {
return e.children?.some((t) => t.kind !== "text");
}
function Mn(e) {
if (e) switch (e) {
case "module":
case "text/javascript":
case "text/babel":
case "text/jsx":
case "application/javascript":
return "babel";
case "application/x-typescript":
return "typescript";
case "text/markdown":
return "markdown";
case "text/html":
return "html";
case "text/x-handlebars-template":
return "glimmer";
default:
if (e.endsWith("json") || e.endsWith("importmap") || e === "speculationrules") return "json";
}
}
function ua(e, t) {
let { name: r, attrMap: n } = e;
if (r !== "script" || Object.prototype.hasOwnProperty.call(n, "src")) return;
let { type: i, lang: s } = e.attrMap;
return !s && !i ? "babel" : At(t, { language: s }) ?? Mn(i);
}
function pa(e, t) {
if (!Pt(e, t)) return;
let { attrMap: r } = e;
if (Object.prototype.hasOwnProperty.call(r, "src")) return;
let { type: n, lang: i } = r;
return At(t, { language: i }) ?? Mn(n);
}
function ha(e, t) {
if (e.name === "style") {
let { lang: r } = e.attrMap;
return r ? At(t, { language: r }) : "css";
}
if (e.name === "mj-style" && t.parser === "mjml") return "css";
}
function _r(e, t) {
return ua(e, t) ?? ha(e, t) ?? pa(e, t);
}
function Qe(e) {
return e === "block" || e === "list-item" || e.startsWith("table");
}
function ma(e) {
return !Qe(e) && e !== "inline-block";
}
function fa(e) {
return !Qe(e) && e !== "inline-block";
}
function da(e) {
return !Qe(e);
}
function ga(e) {
return !Qe(e);
}
function _a(e) {
return !Qe(e) && e !== "inline-block";
}
function ue(e) {
return Fn(e).startsWith("pre");
}
function Sa(e, t) {
let r = e;
for (; r; ) {
if (t(r)) return !0;
r = r.parent;
}
return !1;
}
function Bn(e, t) {
if (he(e, t)) return "block";
if (e.prev?.kind === "comment") {
let n = e.prev.value.match(/^\s*display:\s*([a-z]+)\s*$/u);
if (n) return n[1];
}
let r = !1;
if (e.kind === "element" && e.namespace === "svg") if (Sa(e, (n) => n.fullName === "svg:foreignObject")) r = !0;
else return e.name === "svg" ? "inline-block" : "block";
switch (t.htmlWhitespaceSensitivity) {
case "strict":
return "inline";
case "ignore":
return "block";
default:
if (e.kind === "element" && (!e.namespace || r || ce(e)) && Object.prototype.hasOwnProperty.call(hr, e.name)) return hr[e.name];
}
return bn;
}
function Fn(e) {
return e.kind === "element" && (!e.namespace || ce(e)) && Object.prototype.hasOwnProperty.call(mr, e.name) ? mr[e.name] : wn;
}
function Sr(e) {
return w(0, w(0, e, "'", "'"), """, '"');
}
function b(e) {
return Sr(e.value);
}
function Je(e, t) {
return he(e, t) && !Ea.has(e.fullName);
}
function he(e, t) {
return t.parser === "vue" && e.kind === "element" && e.parent.kind === "root" && e.fullName.toLowerCase() !== "html";
}
function Pt(e, t) {
return he(e, t) && (Je(e, t) || e.attrMap.lang && e.attrMap.lang !== "html");
}
function qn(e) {
let t = e.fullName;
return t.charAt(0) === "#" || t === "slot-scope" || t === "v-slot" || t.startsWith("v-slot:");
}
function Hn(e, t) {
let r = e.parent;
if (!he(r, t)) return !1;
let n = r.fullName, i = e.fullName;
return n === "script" && i === "setup" || n === "style" && i === "vars";
}
function Ot(e, t = e.value) {
return e.parent.isWhitespaceSensitive ? e.parent.isIndentationSensitive ? L(t) : L(x.dedentString(fr(t)), v) : q(_, x.split(t));
}
function Dt(e, t) {
return he(e, t) && e.name === "script";
}
function Ca(e) {
let { valueSpan: t, value: r } = e;
return t.end.offset - t.start.offset === r.length + 2;
}
function Rt(e, t) {
if (Ca(e)) return !1;
let { value: r } = e;
return /^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/u.test(r) || t.parser === "lwc" && r.startsWith("{") && r.endsWith("}");
}
async function Wn(e, t, r) {
let n = b(r.node), i = [];
for (let [s, a] of n.split(Vn).entries()) if (s % 2 === 0) i.push(L(a));
else try {
i.push(C(["{{", y([_, await A(a, e, { parser: "__ng_interpolation", __isInHtmlInterpolation: !0 })]), _, "}}"]));
} catch {
i.push("{{", L(a), "}}");
}
return i;
}
function Ta(e, t, { node: r }) {
let n = b(r);
return K(kt(Ot(r, n.trim())), !n.includes("@@"));
}
function ka(e) {
let t = [];
for (let r of e.split(";")) {
if (r = x.trim(r), !r) continue;
let [n, ...i] = x.split(r);
t.push({ name: n, value: i });
}
return t;
}
function Qn(e, t, r) {
let { node: n } = r, i = Xn(b(n));
return i.length === 0 ? [""] : K(i.map(({ name: s, value: a }, o) => [[s, ...a].join(" "), o === i.length - 1 ? X(";") : [";", _]]));
}
function Jn(e) {
return e === " " || e === `
` || e === "\f" || e === "\r" || e === " ";
}
function Pa(e) {
let t = e.length, r, n, i, s, a, o = 0, c;
function u(m) {
let g, E = m.exec(e.substring(o));
if (E) return [g] = E, o += g.length, g;
}
let p = [];
for (; ; ) {
if (u(ya), o >= t) {
if (p.length === 0) throw new Error("Must contain one or more image candidate strings.");
return p;
}
c = o, r = u(xa), n = [], r.slice(-1) === "," ? (r = r.replace(Na, ""), S()) : d();
}
function d() {
for (u(Aa), i = "", s = "in descriptor"; ; ) {
if (a = e.charAt(o), s === "in descriptor") if (Jn(a)) i && (n.push(i), i = "", s = "after descriptor");
else if (a === ",") {
o += 1, i && n.push(i), S();
return;
} else if (a === "(") i += a, s = "in parens";
else if (a === "") {
i && n.push(i), S();
return;
} else i += a;
else if (s === "in parens") if (a === ")") i += a, s = "in descriptor";
else if (a === "") {
n.push(i), S();
return;
} else i += a;
else if (s === "after descriptor" && !Jn(a)) if (a === "") {
S();
return;
} else s = "in descriptor", o -= 1;
o += 1;
}
}
function S() {
let m = !1, g, E, P, z, oe = {}, ee, gt, ke, Ge, nr;
for (z = 0; z < n.length; z++) ee = n[z], gt = ee[ee.length - 1], ke = ee.substring(0, ee.length - 1), Ge = parseInt(ke, 10), nr = parseFloat(ke), Zn.test(ke) && gt === "w" ? ((g || E) && (m = !0), Ge === 0 ? m = !0 : g = Ge) : La.test(ke) && gt === "x" ? ((g || E || P) && (m = !0), nr < 0 ? m = !0 : E = nr) : Zn.test(ke) && gt === "h" ? ((P || E) && (m = !0), Ge === 0 ? m = !0 : P = Ge) : m = !0;
if (!m) oe.source = { value: r, startOffset: c }, g && (oe.width = { value: g }), E && (oe.density = { value: E }), P && (oe.height = { value: P }), p.push(oe);
else throw new Error(`Invalid srcset descriptor found in "${e}" at "${ee}".`);
}
}
function ni(e, t, r) {
let n = b(r.node), i = ei(n), s = Oa.filter((m) => i.some((g) => Object.prototype.hasOwnProperty.call(g, m)));
if (s.length > 1) throw new Error("Mixed descriptor in srcset is not supported");
let [a] = s, o = ri[a], c = i.map((m) => m.source.value), u = Math.max(...c.map((m) => m.length)), p = i.map((m) => m[a] ? String(m[a].value) : ""), d = p.map((m) => {
let g = m.indexOf(".");
return g === -1 ? m.length : g;
}), S = Math.max(...d);
return K(q([",", _], c.map((m, g) => {
let E = [m], P = p[g];
if (P) {
let z = u - m.length + 1, oe = S - d[g], ee = " ".repeat(z + oe);
E.push(X(ee, " "), P + o);
}
return E;
})));
}
function Da(e, t) {
let { root: r } = e;
return vr.has(r) || vr.set(r, r.children.some((n) => Dt(n, t) && ["ts", "typescript"].includes(n.attrMap.lang))), vr.get(r);
}
function ai(e, t, r) {
let n = b(r.node);
return A(`type T<${n}> = any`, e, { parser: "babel-ts", __isEmbeddedTypescriptGenericParameters: !0 }, W);
}
function oi(e, t, r, n) {
let i = b(r.node), s = G(r, n) ? "babel-ts" : "babel";
return A(`function _(${i}) {}`, e, { parser: s, __isVueBindings: !0 });
}
async function li(e, t, r, n) {
let i = b(r.node), { left: s, operator: a, right: o } = Ra(i), c = G(r, n);
return [C(await A(`function _(${s}) {}`, e, { parser: c ? "babel-ts" : "babel", __isVueForBindingLeft: !0 })), " ", a, " ", await A(o, e, { parser: c ? "__ts_expression" : "__js_expression" })];
}
function Ra(e) {
let t = /(.*?)\s+(in|of)\s+(.*)/su, r = /,([^,\]}]*)(?:,([^,\]}]*))?$/u, n = /^\(|\)$/gu, i = e.match(t);
if (!i) return;
let s = { for: i[3].trim() };
if (!s.for) return;
let a = w(0, i[1].trim(), n, ""), o = a.match(r);
o ? (s.alias = a.replace(r, ""), s.iterator1 = o[1].trim(), o[2] && (s.iterator2 = o[2].trim())) : s.alias = a;
let c = [s.alias, s.iterator1, s.iterator2];
if (!c.some((u, p) => !u && (p === 0 || c.slice(p + 1).some(Boolean)))) return { left: c.filter(Boolean).join(","), operator: i[2], right: s.for };
}
async function Ma(e, t, r, n) {
try {
return await ci(e, t, r, n);
} catch (a) {
if (a.cause?.code !== "BABEL_PARSER_SYNTAX_ERROR") throw a;
}
let i = b(r.node), s = G(r, n) ? "__vue_ts_event_binding" : "__vue_event_binding";
return A(i, e, { parser: s }, W);
}
function Ba(e, t, r, n) {
let i = b(r.node), s = G(r, n) ? "__vue_ts_expression" : "__vue_expression";
return A(i, e, { parser: s }, W);
}
function ci(e, t, r, n) {
let i = b(r.node), s = G(r, n) ? "__ts_expression" : "__js_expression";
return A(i, e, { parser: s }, W);
}
function qa(e, t) {
let { node: r } = e, { value: n } = r;
if (n) return Rt(r, t) ? [r.rawName, "=", n] : Fa.find(({ test: i }) => i(e, t))?.print;
}
function Ha(e) {
return async (t, r, n, i) => {
let s = await e(t, r, n, i);
if (s) return s = ar(s, (a) => typeof a == "string" ? w(0, a, '"', """) : a), [n.node.rawName, '="', C(s), '"'];
};
}
function Ze(e, t) {
return [e.isSelfClosing ? "" : Va(e, t), me(e, t)];
}
function Va(e, t) {
return e.lastChild && ge(e.lastChild) ? "" : [Ua(e, t), It(e, t)];
}
function me(e, t) {
return (e.next ? $(e.next) : de(e.parent)) ? "" : [fe(e, t), V(e, t)];
}
function Ua(e, t) {
return de(e) ? fe(e.lastChild, t) : "";
}
function V(e, t) {
return ge(e) ? It(e.parent, t) : et(e) ? Mt(e.next, t) : "";
}
function It(e, t) {
if (mi(e, t)) return "";
switch (e.kind) {
case "ieConditionalComment":
return "<!";
case "element":
if (e.hasHtmComponentClosingTag) return "<//";
default:
return `</${e.rawName}`;
}
}
function fe(e, t) {
if (mi(e, t)) return "";
switch (e.kind) {
case "ieConditionalComment":
case "ieConditionalEndComment":
return "[endif]-->";
case "ieConditionalStartComment":
return "]><!-->";
case "interpolation":
return "}}";
case "angularIcuExpression":
return "}";
case "element":
if (e.isSelfClosing) return "/>";
default:
return ">";
}
}
function mi(e, t) {
return !e.isSelfClosing && !e.endSourceSpan && (pe(e) || xt(e.parent, t));
}
function $(e) {
return e.prev && e.prev.kind !== "docType" && e.kind !== "angularControlFlowBlock" && !O(e.prev) && e.isLeadingSpaceSensitive && !e.hasLeadingSpaces;
}
function de(e) {
return e.lastChild?.isTrailingSpaceSensitive && !e.lastChild.hasTrailingSpaces && !O(Lt(e.lastChild)) && !ue(e);
}
function ge(e) {
return !e.next && !e.hasTrailingSpaces && e.isTrailingSpaceSensitive && O(Lt(e));
}
function et(e) {
return e.next && !O(e.next) && O(e) && e.isTrailingSpaceSensitive && !e.hasTrailingSpaces;
}
function Wa(e) {
let t = e.trim().match(/^prettier-ignore-attribute(?:\s+(.+))?$/su);
return t ? t[1] ? t[1].split(/\s+/u) : !0 : !1;
}
function tt(e) {
return !e.prev && e.isLeadingSpaceSensitive && !e.hasLeadingSpaces;
}
function Ga(e, t, r) {
let { node: n } = e;
if (!Re(n.attrs)) return n.isSelfClosing ? " " : "";
let i = n.prev?.kind === "comment" && Wa(n.prev.value), s = typeof i == "boolean" ? () => i : Array.isArray(i) ? (d) => i.includes(d.rawName) : () => !1, a = e.map(({ node: d }) => s(d) ? L(t.originalText.slice(Q(d), te(d))) : r(), "attrs"), o = n.kind === "element" && n.fullName === "script" && n.attrs.length === 1 && n.attrs[0].fullName === "src" && n.children.length === 0, u = t.singleAttributePerLine && n.attrs.length > 1 && !he(n, t) ? v : _, p = [y([o ? " " : _, q(u, a)])];
return n.firstChild && tt(n.firstChild) || n.isSelfClosing && de(n.parent) || o ? p.push(n.isSelfClosing ? " " : "") : p.push(t.bracketSameLine ? n.isSelfClosing ? " " : "" : n.isSelfClosing ? _ : k), p;
}
function $a(e) {
return e.firstChild && tt(e.firstChild) ? "" : Bt(e);
}
function rt(e, t, r) {
let { node: n } = e;
return [_e(n, t), Ga(e, t, r), n.isSelfClosing ? "" : $a(n)];
}
function _e(e, t) {
return e.prev && et(e.prev) ? "" : [U(e, t), Mt(e, t)];
}
function U(e, t) {
return tt(e) ? Bt(e.parent) : $(e) ? fe(e.prev, t) : "";
}
function Mt(e, t) {
switch (e.kind) {
case "ieConditionalComment":
case "ieConditionalStartComment":
return `<!--[if ${e.condition}`;
case "ieConditionalEndComment":
return "<!--<!";
case "interpolation":
return "{{";
case "docType": {
if (e.value === "html") {
let { filepath: n } = t;
if (n && /\.html?$/u.test(n)) return hi;
}
let r = Q(e);
return t.originalText.slice(r, r + hi.length);
}
case "angularIcuExpression":
return "{";
case "element":
if (e.condition) return `<!--[if ${e.condition}]><!--><${e.rawName}`;
default:
return `<${e.rawName}`;
}
}
function Bt(e) {
switch (e.kind) {
case "ieConditionalComment":
return "]>";
case "element":
if (e.condition) return "><!--<![endif]-->";
default:
return ">";
}
}
function za(e, t) {
if (!e.endSourceSpan) return "";
let r = e.startSourceSpan.end.offset;
e.firstChild && tt(e.firstChild) && (r -= Bt(e).length);
let n = e.endSourceSpan.start.offset;
return e.lastChild && ge(e.lastChild) ? n += It(e, t).length : de(e) && (n -= fe(e.lastChild, t).length), t.originalText.slice(r, n);
}
function ja(e, t) {
let { node: r } = e;
switch (r.kind) {
case "element":
if (H(r, t) || r.kind === "interpolation") return;
if (!r.isSelfClosing && Pt(r, t)) {
let n = _r(r, t);
return n ? async (i, s) => {
let a = Ft(r, t), o = /^\s*$/u.test(a), c = "";
return o || (c = await i(fr(a), { parser: n, __embeddedInHtml: !0 }), o = c === ""), [U(r, t), C(rt(e, t, s)), o ? "" : v, c, o ? "" : v, Ze(r, t), V(r, t)];
} : void 0;
}
break;
case "text":
if (H(r.parent, t)) {
let n = _r(r.parent, t);
if (n) return async (i) => {
let s = n === "markdown" ? x.dedentString(r.value.replace(/^[^\S\n]*\n/u, "")) : r.value, a = { parser: n, __embeddedInHtml: !0 };
if (t.parser === "html" && n === "babel") {
let o = "script", { attrMap: c } = r.parent;
c && (c.type === "module" || (c.type === "text/babel" || c.type === "text/jsx") && c["data-type"] === "module") && (o = "module"), a.__babelSourceType = o;
}
return [j, U(r, t), await i(s, a), V(r, t)];
};
} else if (r.parent.kind === "interpolation") return async (n) => {
let i = { __isInHtmlInterpolation: !0, __embeddedInHtml: !0 };
return t.parser === "angular" ? i.parser = "__ng_interpolation" : t.parser === "vue" ? i.parser = G(e, t) ? "__vue_ts_expression" : "__vue_expression" : i.parser = "__js_expression", [y([_, await n(r.value, i)]), r.parent.next && $(r.parent.next) ? " " : _];
};
break;
case "attribute":
return pi(e, t);
case "angularControlFlowBlockParameters":
return Ya.has(e.parent.name) ? gn : void 0;
case "angularLetDeclarationInitializer":
return (n) => A(r.value, n, { parser: "__ng_binding", __isInHtmlAttribute: !1 });
}
}
function it(e) {
if (nt !== null && typeof nt.property) {
let t = nt;
return nt = it.prototype = null, t;
}
return nt = it.prototype = e ?? /* @__PURE__ */ Object.create(null), new it();
}
function Tr(e) {
return it(e);
}
function Ka(e, t = "type") {
Tr(e);
function r(n) {
let i = n[t], s = e[i];
if (!Array.isArray(s)) throw Object.assign(new Error(`Missing visitor keys for '${i}'.`), { node: n });
return s;
}
return r;
}
function ki(e) {
let t = te(e);
return e.kind === "element" && !e.endSourceSpan && Re(e.children) ? Math.max(t, ki(F(0, e.children, -1))) : t;
}
function st(e, t, r) {
let n = e.node;
if (pe(n)) {
let i = ki(n);
return [U(n, t), L(x.trimEnd(t.originalText.slice(Q(n) + (n.prev && et(n.prev) ? Mt(n).length : 0), i - (n.next && $(n.next) ? fe(n, t).length : 0)))), V(n, t)];
}
return r();
}
function qt(e, t) {
return O(e) && O(t) ? e.isTrailingSpaceSensitive ? e.hasTrailingSpaces ? Nt(t) ? v : _ : "" : Nt(t) ? v : k : et(e) && (pe(t) || t.firstChild || t.isSelfClosing || t.kind === "element" && t.attrs.length > 0) || e.kind === "element" && e.isSelfClosing && $(t) ? "" : !t.isLeadingSpaceSensitive || Nt(t) || $(t) && e.lastChild && ge(e.lastChild) && e.lastChild.lastChild && ge(e.lastChild.lastChild) ? v : t.hasLeadingSpaces ? _ : k;
}
function Ie(e, t, r) {
let { node: n } = e;
if (gr(n)) return [j, ...e.map(() => {
let s = e.node, a = s.prev ? qt(s.prev, s) : "";
return [a ? [a, Ke(s.prev) ? v : ""] : "", st(e, t, r)];
}, "children")];
let i = n.children.map(() => /* @__PURE__ */ Symbol(""));
return e.map(({ node: s, index: a }) => {
if (O(s)) {
if (s.prev && O(s.prev)) {
let m = qt(s.prev, s);
if (m) return Ke(s.prev) ? [v, v, st(e, t, r)] : [m, st(e, t, r)];
}
return st(e, t, r);
}
let o = [], c = [], u = [], p = [], d = s.prev ? qt(s.prev, s) : "", S = s.next ? qt(s, s.next) : "";
return d && (Ke(s.prev) ? o.push(v, v) : d === v ? o.push(v) : O(s.prev) ? c.push(d) : c.push(X("", k, { groupId: i[a - 1] }))), S && (Ke(s) ? O(s.next) && p.push(v, v) : S === v ? O(s.next) && p.push(v) : u.push(S)), [...o, C([...c, C([st(e, t, r), ...u], { id: i[a] })]), ...p];
}, "children");
}
function Ai(e, t, r) {
let { node: n } = e, i = [];
Ja(e) && i.push("} "), i.push("@", n.name), n.parameters && i.push(" (", C(r("parameters")), ")"), i.push(" {");
let s = yi(n);
return n.children.length > 0 ? (n.firstChild.hasLeadingSpaces = !0, n.lastChild.hasTrailingSpaces = !0, i.push(y([v, Ie(e, t, r)])), s && i.push(v, "}")) : s && i.push("}"), C(i, { shouldBreak: !0 });
}
function yi(e) {
return !(e.next?.kind === "angularControlFlowBlock" && wi.get(e.name)?.has(e.next.name));
}
function Ja(e) {
let { previous: t } = e;
return t?.kind === "angularControlFlowBlock" && !pe(t) && !yi(t);
}
function xi(e, t, r) {
return [y([k, q([";", _], e.map(r, "children"))]), k];
}
function Ni(e, t, r) {
let { node: n } = e;
return [_e(n, t), C([n.switchValue.trim(), ", ", n.type, n.cases.length > 0 ? [",", y([_, q(_, e.map(r, "cases"))])] : "", k]), me(n, t)];
}
function Li(e, t, r) {
let { node: n } = e;
return [n.value, " {", C([y([k, e.map(({ node: i, isLast: s }) => {
let a = [r()];
return i.kind === "text" && (i.hasLeadingSpaces && a.unshift(_), i.hasTrailingSpaces && !s && a.push(_)), a;
}, "expression")]), k]), "}"];
}
function Pi(e, t, r) {
let { node: n } = e;
if (xt(n, t)) return [U(n, t), C(rt(e, t, r)), L(Ft(n, t)), ...Ze(n, t), V(n, t)];
let i = n.children.length === 1 && (n.firstChild.kind === "interpolation" || n.firstChild.kind === "angularIcuExpression") && n.firstChild.isLeadingSpaceSensitive && !n.firstChild.hasLeadingSpaces && n.lastChild.isTrailingSpaceSensitive && !n.lastChild.hasTrailingSpaces, s = /* @__PURE__ */ Symbol("element-attr-group-id"), a = (p) => C([C(rt(e, t, r), { id: s }), p, Ze(n, t)]), o = (p) => i ? ln(p, { groupId: s }) : (H(n, t) || Je(n, t)) && n.parent.kind === "root" && t.parser === "vue" && !t.vueIndentScriptAndStyle ? p : y(p), c = () => i ? X(k, "", { groupId: s }) : n.firstChild.hasLeadingSpaces && n.firstChild.isLeadingSpaceSensitive ? _ : n.firstChild.kind === "text" && n.isWhitespaceSensitive && n.isIndentationSensitive ? on(k) : k, u = () => (n.next ? $(n.next) : de(n.parent)) ? n.lastChild.hasTrailingSpaces && n.lastChild.isTrailingSpaceSensitive ? " " : "" : i ? X(k, "", { groupId: s }) : n.lastChild.hasTrailingSpaces && n.lastChild.isTrailingSpaceSensitive ? _ : (n.lastChild.kind === "comment" || n.lastChild.kind === "text" && n.isWhitespaceSensitive && n.isIndentationSensitive) && new RegExp(`\\n[\\t ]{${t.tabWidth * (e.ancestors.length - 1)}}$`, "u").test(n.lastChild.value) ? "" : k;
return n.children.length === 0 ? a(n.hasDanglingSpaces && n.isDanglingSpaceSensitive ? _ : "") : a([Pn(n) ? j : "", o([c(), Ie(e, t, r)]), u()]);
}
function at(e, t = !0) {
if (e[0] != ":") return [null, e];
let r = e.indexOf(":", 1);
if (r === -1) {
if (t) throw new Error(`Unsupported format "${e}" expecting ":namespace:name"`);
return [null, e];
}
return [e.slice(1, r), e.slice(r + 1)];
}
function br(e) {
return at(e)[1] === "ng-container";
}
function wr(e) {
return at(e)[1] === "ng-content";
}
function Me(e) {
return e === null ? null : at(e)[0];
}
function Se(e, t) {
return e ? `:${e}:${t}` : t;
}
function Oi(e) {
return e.replace(Za, (...t) => t[1].toUpperCase());
}
function yr() {
return Vt || (Vt = {}, Ht(Ee.HTML, ["iframe|srcdoc", "*|innerHTML", "*|outerHTML"]), Ht(Ee.STYLE, ["*|style"]), Ht(Ee.URL, ["*|formAction", "area|href", "area|ping", "audio|src", "a|href", "a|ping", "blockquote|cite", "body|background", "del|cite", "form|action", "img|src", "input|src", "ins|cite", "q|cite", "source|src", "track|src", "video|poster", "video|src"]), Ht(Ee.RESOURCE_URL, ["applet|code", "applet|codebase", "base|href", "embed|src", "frame|src", "head|profile", "html|manifest", "iframe|src", "link|href", "media|src", "object|codebase", "object|data", "script|src"])), Vt;
}
function Ht(e, t) {
for (let r of t) Vt[r.toLowerCase()] = e;
}
function ao(e) {
switch (e) {
case "width":
case "height":
case "minWidth":
case "minHeight":
case "maxWidth":
case "maxHeight":
case "left":
case "top":
case "bottom":
case "right":
case "fontSize":
case "outlineWidth":
case "outlineOffset":
case "paddingTop":
case "paddingLeft":
case "paddingBottom":
case "paddingRight":
case "marginTop":
case "marginLeft":
case "marginBottom":
case "marginRight":
case "borderRadius":
case "borderWidth":
case "borderTopWidth":
case "borderLeftWidth":
case "borderRightWidth":
case "borderBottomWidth":
case "textIndent":
return !0;
default:
return !1;
}
}
function Be(e) {
return ot || (Mi = new f({ canSelfClose: !0 }), ot = Object.assign(/* @__PURE__ */ Object.create(null), { base: new f({ isVoid: !0 }), meta: new f({ isVoid: !0 }), area: new f({ isVoid: !0 }), embed: new f({ isVoid: !0 }), link: new f({ isVoid: !0 }), img: new f({ isVoid: !0 }), input: new f({ isVoid: !0 }), param: new f({ isVoid: !0 }), hr: new f({ isVoid: !0 }), br: new f({ isVoid: !0 }), source: new f({ isVoid: !0 }), track: new f({ isVoid: !0 }), wbr: new f({ isVoid: !0 }), p: new f({ closedByChildren: ["address", "article", "aside", "blockquote", "div", "dl", "fieldset", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "main", "nav", "ol", "p", "pre", "section", "table", "ul"], closedByParent: !0 }), thead: new f({ closedByChildren: ["tbody", "tfoot"] }), tbody: new f({ closedByChildren: ["tbody", "tfoot"], closedByParent: !0 }), tfoot: new f({ closedByChildren: ["tbody"], closedByParent: !0 }), tr: new f({ closedByChildren: ["tr"], closedByParent: !0 }), td: new f({ closedByChildren: ["td", "th"], closedByParent: !0 }), th: new f({ closedByChildren: ["td", "th"], closedByParent: !0 }), col: new f({ isVoid: !0 }), svg: new f({ implicitNamespacePrefix: "svg" }), foreignObject: new f({ implicitNamespacePrefix: "svg", preventNamespaceInheritance: !0 }), math: new f({ implicitNamespacePrefix: "math" }), li: new f({ closedByChildren: ["li"], closedByParent: !0 }), dt: new f({ closedByChildren: ["dt", "dd"] }), dd: new f({ closedByChildren: ["dt", "dd"], closedByParent: !0 }), rb: new f({ closedByChildren: ["rb", "rt", "rtc", "rp"], closedByParent: !0 }), rt: new f({ closedByChildren: ["rb", "rt", "rtc", "rp"], closedByParent: !0 }), rtc: new f({ closedByChildren: ["rb", "rtc", "rp"], closedByParent: !0 }), rp: new f({ closedByChildren: ["rb", "rt", "rtc", "rp"], closedByParent: !0 }), optgroup: new f({ closedByChildren: ["optgroup"], closedByParent: !0 }), option: new f({ closedByChildren: ["option", "optgroup"], closedByParent: !0 }), pre: new f({ ignoreFirstLf: !0 }), listing: new f({ ignoreFirstLf: !0 }), style: new f({ contentType: I.RAW_TEXT }), script: new f({ contentType: I.RAW_TEXT }), title: new f({ contentType: { default: I.ESCAPABLE_RAW_TEXT, svg: I.PARSABLE_DATA } }), textarea: new f({ contentType: I.ESCAPABLE_RAW_TEXT, ignoreFirstLf: !0 }) }), new Ii().allKnownElementNames().forEach((t) => {
!ot[t] && Me(t) === null && (ot[t] = new f({ canSelfClose: !1 }));
})), ot[e] ?? Mi;
}
function lt(e) {
return e >= 9 && e <= 32 || e == 160;
}
function ct(e) {
return 48 <= e && e <= 57;
}
function Fe(e) {
return e >= 97 && e <= 122 || e >= 65 && e <= 90;
}
function Bi(e) {
return e >= 97 && e <= 102 || e >= 65 && e <= 70 || ct(e);
}
function ut(e) {
return e === 10 || e === 13;
}
function xr(e) {
return 48 <= e && e <= 55;
}
function Ut(e) {
return e === 39 || e === 34 || e === 96;
}
function Wt(e, t, r = null) {
let n = [], i = e.visit ? (s) => e.visit(s, r) || s.visit(e, r) : (s) => s.visit(e, r);
return t.forEach((s) => {
let a = i(s);
a && n.push(a);
}), n;
}
function ns(e, t, r, n = {}) {
let i = new Oo(new ht(e, t), r, n);
return i.tokenize(), new xo(qo(i.tokens), i.errors, i.nonNormalizedIcuExpressions);
}
function be(e) {
return `Unexpected character "${e === 0 ? "EOF" : String.fromCharCode(e)}"`;
}
function Qi(e) {
return `Unknown entity "${e}" - use the "&#<decimal>;" or "&#x<hex>;" syntax`;
}
function Lo(e, t) {
return `Unable to parse entity "${t}" - ${e} character reference entities must end with ";"`;
}
function T(e) {
return !lt(e) || e === 0;
}
function we(e) {
return lt(e) || e === 62 || e === 60 || e === 47 || e === 39 || e === 34 || e === 61 || e === 0;
}
function Do(e) {
return (e < 97 || 122 < e) && (e < 65 || 90 < e) && (e < 48 || e > 57);
}
function Ro(e) {
return e === 59 || e === 0 || !Bi(e);
}
function Io(e) {
return e === 59 || e === 0 || !Fe(e);
}
function Mo(e) {
return e !== 125;
}
function Bo(e, t) {
return Ji(e) === Ji(t);
}
function Ji(e) {
return e >= 97 && e <= 122 ? e - 97 + 65 : e;
}
function Fo(e) {
return Fe(e) || ct(e) || e === 95;
}
function Zi(e) {
return e !== 59 && T(e);
}
function zt(e) {
return e === 95 || e >= 65 && e <= 90;
}
function es(e) {
return Fe(e) || ct(e) || e === 95;
}
function ts(e) {
return e === 47 || e === 62 || e === 60 || e === 0;
}
function qo(e) {
let t = [], r;
for (let n = 0; n < e.length; n++) {
let i = e[n];
r && r.type === l.TEXT && i.type === l.TEXT || r && r.type === l.ATTR_VALUE_TEXT && i.type === l.ATTR_VALUE_TEXT ? (r.parts[0] += i.parts[0], r.sourceSpan.end = i.sourceSpan.end) : (r = i, t.push(r));
}
return t;
}
function ss(e, t) {
return e.length > 0 && e[e.length - 1] === t;
}
function as(e, t) {
return Te[t] !== void 0 ? Te[t] || e : /^#x[a-f0-9]+$/i.test(t) ? String.fromCodePoint(parseInt(t.slice(2), 16)) : /^#\d+$/.test(t) ? String.fromCodePoint(parseInt(t.slice(1), 10)) : e;
}
function Qt(e, t = {}) {
let { canSelfClose: r = !1, allowHtmComponentClosingTags: n = !1, isTagNameCaseSensitive: i = !1, getTagContentType: s, tokenizeAngularBlocks: a = !1, tokenizeAngularLetDeclaration: o = !1, enableAngularSelectorlessSyntax: c = !1 } = t;
return Wo().parse(e, "angular-html-parser", { tokenizeExpansionForms: a, canSelfClose: r, allowHtmComponentClosingTags: n, tokenizeBlocks: a, tokenizeLet: o, selectorlessEnabled: c }, i, s);
}
function $o(e, t) {
for (let r of Go) r(e, t);
return e;
}
function zo(e) {
e.walk((t) => {
if (t.kind === "element" && t.tagDefinition.ignoreFirstLf && t.children.length > 0 && t.children[0].kind === "text" && t.children[0].value[0] === `
`) {
let r = t.children[0];
r.value.length === 1 ? t.removeChild(r) : r.value = r.value.slice(1);
}
});
}
function Yo(e) {
let t = (r) => r.kind === "element" && r.prev?.kind === "ieConditionalStartComment" && r.prev.sourceSpan.end.offset === r.startSourceSpan.start.offset && r.firstChild?.kind === "ieConditionalEndComment" && r.firstChild.sourceSpan.start.offset === r.startSourceSpan.end.offset;
e.walk((r) => {
if (r.children) for (let n = 0; n < r.children.length; n++) {
let i = r.children[n];
if (!t(i)) continue;
let s = i.prev, a = i.firstChild;
r.removeChild(s), n--;
let o = new h(s.sourceSpan.start, a.sourceSpan.end), c = new h(o.start, i.sourceSpan.end);
i.condition = s.condition, i.sourceSpan = c, i.startSourceSpan = o, i.removeChild(a);
}
});
}
function jo(e, t, r) {
e.walk((n) => {
if (n.children) for (let i = 0; i < n.children.length; i++) {
let s = n.children[i];
if (s.kind !== "text" && !t(s)) continue;
s.kind !== "text" && (s.kind = "text", s.value = r(s));
let a = s.prev;
!a || a.kind !== "text" || (a.value += s.value, a.sourceSpan = new h(a.sourceSpan.start, s.sourceSpan.end), n.removeChild(s), i--);
}
});
}
function Xo(e) {
return jo(e, (t) => t.kind === "cdata", (t) => `<![CDATA[${t.value}]]>`);
}
function Ko(e) {
let t = (r) => r.kind === "element" && r.attrs.length === 0 && r.children.length === 1 && r.firstChild.kind === "text" && !x.hasWhitespaceCharacter(r.children[0].value) && !r.firstChild.hasLeadingSpaces && !r.firstChild.hasTrailingSpaces && r.isLeadingSpaceSensitive && !r.hasLeadingSpaces && r.isTrailingSpaceSensitive && !r.hasTrailingSpaces && r.prev?.kind === "text" && r.next?.kind === "text";
e.walk((r) => {
if (r.children) for (let n = 0; n < r.children.length; n++) {
let i = r.children[n];
if (!t(i)) continue;
let s = i.prev, a = i.next;
s.value += `<${i.rawName}>` + i.firstChild.value + `</${i.rawName}>` + a.value, s.sourceSpan = new h(s.sourceSpan.start, a.sourceSpan.end), s.isTrailingSpaceSensitive = a.isTrailingSpaceSensitive, s.hasTrailingSpaces = a.hasTrailingSpaces, r.removeChild(i), n--, r.removeChild(a);
}
});
}
function Qo(e, t) {
if (t.parser === "html") return;
let r = /\{\{(.+?)\}\}/su;
e.walk((n) => {
if (An(n, t)) for (let i of n.children) {
if (i.kind !== "text") continue;
let s = i.sourceSpan.start, a = null, o = i.value.split(r);
for (let c = 0; c < o.length; c++, s = a) {
let u = o[c];
if (c % 2 === 0) {
a = s.moveBy(u.length), u.length > 0 && n.insertChildBefore(i, { kind: "text", value: u, sourceSpan: new h(s, a) });
continue;
}
a = s.moveBy(u.length + 4), n.insertChildBefore(i, { kind: "interpolation", sourceSpan: new h(s, a), children: u.length === 0 ? [] : [{ kind: "text", value: u, sourceSpan: new h(s.moveBy(2), a.moveBy(-2)) }] });
}
n.removeChild(i);
}
});
}
function Jo(e, t) {
e.walk((r) => {
let n = r.$children;
if (!n) return;
if (n.length === 0 || n.length === 1 && n[0].kind === "text" && x.trim(n[0].value).length === 0) {
r.hasDanglingSpaces = n.length > 0, r.$children = [];
return;
}
let i = yn(r, t), s = dr(r);
if (!i) for (let a = 0; a < n.length; a++) {
let o = n[a];
if (o.kind !== "text") continue;
let { leadingWhitespace: c, text: u, trailingWhitespace: p } = kn(o.value), d = o.prev, S = o.next;
u ? (o.value = u, o.sourceSpan = new h(o.sourceSpan.start.moveBy(c.length), o.sourceSpan.end.moveBy(-p.length)), c && (d && (d.hasTrailingSpaces = !0), o.hasLeadingSpaces = !0), p && (o.hasTrailingSpaces = !0, S && (S.hasLeadingSpaces = !0))) : (r.removeChild(o), a--, (c || p) && (d && (d.hasTrailingSpaces = !0), S && (S.hasLeadingSpaces = !0)));
}
r.isWhitespaceSensitive = i, r.isIndentationSensitive = s;
});
}
function Zo(e) {
e.walk((t) => {
t.isSelfClosing = !t.children || t.kind === "element" && (t.tagDefinition.isVoid || t.endSourceSpan && t.startSourceSpan.start === t.endSourceSpan.start && t.startSourceSpan.end === t.endSourceSpan.end);
});
}
function el(e, t) {
e.walk((r) => {
r.kind === "element" && (r.hasHtmComponentClosingTag = r.endSourceSpan && /^<\s*\/\s*\/\s*>$/u.test(t.originalText.slice(r.endSourceSpan.start.offset, r.endSourceSpan.end.offset)));
});
}
function tl(e, t) {
e.walk((r) => {
r.cssDisplay = Bn(r, t);
});
}
function rl(e, t) {
e.walk((r) => {
let { children: n } = r;
if (n) {
if (n.length === 0) {
r.isDanglingSpaceSensitive = Ln(r, t);
return;
}
for (let i of n) i.isLeadingSpaceSensitive = xn(i, t), i.isTrailingSpaceSensitive = Nn(i, t);
for (let i = 0; i < n.length; i++) {
let s = n[i];
s.isLeadingSpaceSensitive = (i === 0 || s.prev.isTrailingSpaceSensitive) && s.isLeadingSpaceSensitive, s.isTrailingSpaceSensitive = (i === n.length - 1 || s.next.isLeadingSpaceSensitive) && s.isTrailingSpaceSensitive;
}
}
});
}
function nl(e, t, r) {
let { node: n } = e;
switch (n.kind) {
case "root":
return t.__onHtmlRoot && t.__onHtmlRoot(n), [C(Ie(e, t, r)), v];
case "element":
case "ieConditionalComment":
return Pi(e, t, r);
case "angularControlFlowBlock":
return Ai(e, t, r);
case "angularControlFlowBlockParameters":
return xi(e, t, r);
case "angularControlFlowBlockParameter":
return x.trim(n.expression);
case "angularLetDeclaration":
return C(["@let ", C([n.id, " =", C(y([_, r("init")]))]), ";"]);
case "angularLetDeclarationInitializer":
return n.value;
case "angularIcuExpression":
return Ni(e, t, r);
case "angularIcuCase":
return Li(e, t, r);
case "ieConditionalStartComment":
case "ieConditionalEndComment":
return [_e(n), me(n)];
case "interpolation":
return [_e(n, t), ...e.map(r, "children"), me(n, t)];
case "text": {
if (n.parent.kind === "interpolation") {
let o = /\n[^\S\n]*$/u, c = o.test(n.value), u = c ? n.value.replace(o, "") : n.value;
return [L(u), c ? v : ""];
}
let i = U(n, t), s = Ot(n), a = V(n, t);
return s[0] = [i, s[0]], s.push([s.pop(), a]), kt(s);
}
case "docType":
return [C([_e(n, t), " ", w(0, n.value.replace(/^html\b/iu, "html"), /\s+/gu, " ")]), me(n, t)];
case "comment":
return [U(n, t), L(t.originalText.slice(Q(n), te(n))), V(n, t)];
case "attribute": {
if (n.value === null) return n.rawName;
let i = Sr(n.value), s = Rt(n, t) ? "" : pn(i, '"');
return [n.rawName, "=", s, L(s === '"' ? w(0, i, '"', """) : w(0, i, "'", "'")), s];
}
default:
throw new mn(n, "HTML");
}
}
function al(e, t) {
let r = new SyntaxError(e + " (" + t.loc.start.line + ":" + t.loc.start.column + ")");
return Object.assign(r, t);
}
function Jt(e) {
return { ...ol, ...e };
}
function Gr(e) {
let { canSelfClose: t, allowHtmComponentClosingTags: r, isTagNameCaseSensitive: n, shouldParseAsRawText: i, tokenizeAngularBlocks: s, tokenizeAngularLetDeclaration: a } = e;
return { canSelfClose: t, allowHtmComponentClosingTags: r, isTagNameCaseSensitive: n, getTagContentType: i ? (...o) => i(...o) ? I.RAW_TEXT : void 0 : void 0, tokenizeAngularBlocks: s, tokenizeAngularLetDeclaration: a };
}
function ll(e, t) {
let r = e.map(t);
return r.some((n, i) => n !== e[i]) ? r : e;
}
function Es(e, t) {
if (e.value) for (let { regex: r, parse: n } of cl) {
let i = e.value.match(r);
if (i) return n(e, i, t);
}
return null;
}
function ul(e, t, r) {
let { openingTagSuffix: n, condition: i, data: s } = t.groups, a = 4 + n.length, o = e.sourceSpan.start.moveBy(a), c = o.moveBy(s.length), [u, p] = (() => {
try {
return [!0, r(s, o).children];
} catch {
return [!1, [{ kind: "text", value: s, sourceSpan: new h(o, c) }]];
}
})();
return { kind: "ieConditionalComment", complete: u, children: p, condition: w(0, i.trim(), /\s+/gu, " "), sourceSpan: e.sourceSpan, startSourceSpan: new h(e.sourceSpan.start, o), endSourceSpan: new h(c, e.sourceSpan.end) };
}
function pl(e, t) {
let { condition: r } = t.groups;
return { kind: "ieConditionalStartComment", condition: w(0, r.trim(), /\s+/gu, " "), sourceSpan: e.sourceSpan };
}
function hl(e) {
return { kind: "ieConditionalEndComment", sourceSpan: e.sourceSpan };
}
function Ts(e, t, r, n) {
Wt(new Yr(), e.children, { parseOptions: r }), t && e.children.unshift(t);
let i = new tr(e);
return i.walk((s) => {
if (s.kind === "comment") {
let a = Es(s, n);
a && s.parent.replaceChild(s, a);
}
ml(s), fl(s), dl(s);
}), i;
}
function ml(e) {
if (e.kind === "block") {
if (e.name = w(0, e.name.toLowerCase(), /\s+/gu, " ").trim(), e.kind = "angularControlFlowBlock", !Re(e.parameters)) {
delete e.parameters;
return;
}
for (let t of e.parameters) t.kind = "angularControlFlowBlockParameter";
e.parameters = { kind: "angularControlFlowBlockParameters", children: e.parameters, sourceSpan: new h(e.parameters[0].sourceSpan.start, F(0, e.parameters, -1).sourceSpan.end) };
}
}
function fl(e) {
e.kind === "letDeclaration" && (e.kind = "angularLetDeclaration", e.id = e.name, e.init = { kind: "angularLetDeclarationInitializer", sourceSpan: new h(e.valueSpan.start, e.valueSpan.end), value: e.value }, delete e.name, delete e.value);
}
function dl(e) {
e.kind === "expansion" && (e.kind = "angularIcuExpression"), e.kind === "expansionCas